<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="calloutopt.aspx.cs" Inherits="HySoft.BaseCallCenter.Web.calloutmanage.calloutopt" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>外呼任务执行</title>
    <link href="../scripts/ui/skins/Aqua/css/ligerui-all.css" rel="stylesheet" type="text/css" />
    <script src="/scripts/jquery/jquery-1.3.2.min.js" type="text/javascript"></script>
    <script type="text/javascript" src="/scripts/jquery/jquery.form.js"></script>
    <script type="text/javascript" src="/scripts/jquery/jquery.validate.min.js"></script>
    <script type="text/javascript" src="/scripts/jquery/messages_cn.js"></script>
    <script src="../scripts/ui/js/core/base.js" type="text/javascript"></script>
    <script src="../scripts/ui/js/ligerui.min.js" type="text/javascript"></script>
    <link href="../scripts/ui/skins/Tab/css/tab.css" rel="stylesheet" type="text/css" />
    <link href="../scripts/ui/skins/Tab/css/grid.css" rel="stylesheet" type="text/css" />
    <script src="../scripts/ui/js/plugins/ligerGrid.js" type="text/javascript"></script>
    <script src="../scripts/ui/js/plugins/ligerLayout.js" type="text/javascript"></script>
    <script src="../scripts/ui/js/plugins/ligerTree.js" type="text/javascript"></script>
    <script src="../scripts/ui/js/plugins/ligerMenu.js" type="text/javascript"></script>
    <link href="../scripts/ui/skins/ligerui-icons.css" rel="stylesheet" type="text/css" />
    <script src="../scripts/My97DatePicker/lang/zh-cn.js" type="text/javascript"></script>
    <link href="../images/style.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript">
        var vtimeinterval;

        $(function () {
            //LoadPagerList();
            if (document.getElementById("txtcallstate").value == "1") {
                var html = document.getElementById("divShow").innerHTML;
                $.ligerDialog.waitting(html);
                //                $.ligerDialog.waitting('呼叫中,请稍后...');
                GetCallState();
                vtimeinterval = window.setInterval(GetCallState, 1000);
            }
        });
        function GetCallState() {
            var pstate = parent.CallOutRes();
            if (pstate) {
                $.ligerDialog.closeWaitting();
                clearInterval(vtimeinterval);
                return;
            }
        }
        document.onkeydown = function (event) {
            var e = event || window.event || arguments.callee.caller.arguments[0];
            if (e && e.keyCode == 13) {
                //LoadPagerList();
            }
        };
        function CheckHJJG(id, name) {
            document.getElementById("txtHJJGId").value = id;
            document.getElementById("txtHJJGName").value = name;
            document.getElementById("rdHJJGList_" + id).checked = true;
        }
        function CheckHJJGList(id, name) {
            document.getElementById("txtHJJGId").value = id;
            document.getElementById("txtHJJGName").value = name;
        }
        function SaveHJJGData() {
            var id = document.getElementById("txtHJJGId").value;
            var name = escape(document.getElementById("txtHJJGName").value);
            var keyid = document.getElementById("txtId").value;
            var timeno = new Date().getTime();
            $.ajax({
                type: "get",
                url: "ajax/calloutopt.ashx?action=updateHJJG&resid=" + id.toString() + "&id=" + keyid.toString() + "&name=" + name.toString() + "&timeno=" + timeno,
                dataType: "html",
                success: function (res) {
                    if (res == "success") {
                        SaveInfo("success", "保存呼叫结果成功");
                    } else {
                        $.ligerDialog.error("保存呼叫结果失败");
                    }
                }
            });
        }
        function SaveData() {
            $.ligerDialog.waitting('提交保存中,请稍后...');
            var id = document.getElementById("txtId").value;
            var taskid = document.getElementById("txtTaskId").value;
            var pagerid = document.getElementById("txtPagerId").value;
            var userid = document.getElementById("txtUserId").value;
            $("#form1").ajaxSubmit({
                beforeSubmit: function (formData, jqForm, options) {
                },
                success: function (data, textStatus) {
                    if (data.msg == 1) {
                        SaveInfo("success", data.info);
                        $.ligerDialog.closeWaitting();
                    } else {
                        $.ligerDialog.closeWaitting();
                        $.ligerDialog.error(data.info);
                    }
                },
                error: function (data, status, e) {
                    $.ligerDialog.closeWaitting();
                    $.ligerDialog.error("提交保存失败，错误信息：" + e);
                },
                url: "ajax/calloutopt.ashx?action=savedata&id=" + id + "&taskid=" + taskid + "&pagerid=" + pagerid + "&userid=" + userid,
                type: "post",
                dataType: "json"
            });
        }
        function SaveInfo(res, msg) {
            switch (res) {
                case 'success':
                    $.ligerDialog.success(msg, function (yes) { CloseThis(); });
                    break;
                case 'warn':
                    $.ligerDialog.error('提交保存失败，请确认数据正确性');
                    break;
                case 'error':
                    $.ligerDialog.error('提交保存失败，请联系开发商');
                    break;
                default:
                    break;
            }
        }
        function CloseThis() {
            var dialog = frameElement.dialog;
            parent.LoadTelList();
            dialog.close();
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div id="divShow" style="display: none;">
        <table cellpadding="1" cellspacing="1" border="0" style="width: 250px;">
            <tr>
                <td style="padding: 2px; text-align: center; height: 25px;">
                    <img src="../images/loading.gif" style="height: 19px; width: 20px" />&nbsp;呼叫中,请稍后...
                </td>
            </tr>
            <tr>
                <td valign="top" style="padding: 0px 0px 5px 0px;">
                    <div class="tools_box" style="height: 30px; width: 250px;">
                        <div class="tools_bar">
                            <div style="float: left; padding-top: 6px; padding-left: 1px; font-weight: bold;
                                color: red;">
                                <img src="../images/phone.png" style="height: 19px; width: 20px" />&nbsp;呼叫结果</div>
                        </div>
                    </div>
                    <div id="divHJJG" runat="server" style="width:252px;">
                    <table cellpadding="0" cellspacing="0" style="width: 252px; background-color: White;
                        border: 1px solid #D6D6D6;">
                        <tr>
                            <td style="border-bottom: 1px dotted #cccccc; padding:3px; height:23px;">
                                &nbsp;&nbsp;&nbsp;<input id="rdHJJG_1" type="radio" name="rdHJJG" checked /><label for="rdHJJG_1">正常接通</label>
                            </td>
                        </tr>
                        <tr>
                            <td style="border-bottom: 1px dotted #cccccc; padding:3px; height:23px;">
                                &nbsp;&nbsp;&nbsp;<input id="rdHJJG_2" type="radio" name="rdHJJG" /><label for="rdHJJG_2">拒访</label>
                            </td>
                        </tr>
                        <tr>
                            <td style="border-bottom: 1px dotted #cccccc; padding:3px; height:23px;">
                                &nbsp;&nbsp;&nbsp;<input id="rdHJJG_3" type="radio" name="rdHJJG"  /><label for="rdHJJG_3">不是本人</label>
                            </td>
                        </tr>
                        <tr>
                            <td style="border-bottom: 1px dotted #cccccc; padding:3px; height:23px;">
                                &nbsp;&nbsp;&nbsp;<input id="Radio1" type="radio" name="rdHJJG" /><label for="rdHJJG_2">拒访</label>
                            </td>
                        </tr>
                        <tr>
                            <td style="border-bottom: 1px dotted #cccccc; padding:3px; height:23px;">
                                &nbsp;&nbsp;&nbsp;<input id="Radio2" type="radio" name="rdHJJG"  /><label for="rdHJJG_3">不是本人</label>
                            </td>
                        </tr>
                        <tr>
                            <td style="border-bottom: 1px dotted #cccccc; padding:3px; height:23px;">
                                &nbsp;&nbsp;&nbsp;<input id="Radio3" type="radio" name="rdHJJG" /><label for="rdHJJG_2">拒访</label>
                            </td>
                        </tr>
                        <tr>
                            <td style="border-bottom: 1px dotted #cccccc; padding:3px; height:23px;">
                                &nbsp;&nbsp;&nbsp;<input id="Radio4" type="radio" name="rdHJJG"  /><label for="rdHJJG_3">不是本人</label>
                            </td>
                        </tr>
                    </table>
                    </div>
                </td>
            </tr>
            <tr>
                <td align="center" style="height: 35px;">
                    <input type="button" class="btnSubmit" onclick="SaveHJJGData();" value="保存" />
                </td>
            </tr>
        </table>
    </div>
    <table id="tableMessage" cellpadding="3" cellspacing="3" border="0" style="width: 100%;">
        <tr>
            <td id="tdLeft" valign="top" style="padding: 0px 2px 5px 2px;">
                <div class="tools_box" style="height: 30px;">
                    <div class="tools_bar">
                        <div style="float: left; padding-top: 6px; padding-left: 1px; font-weight: bold;
                            color: red;">
                            <img src="../images/phone.png" style="height: 19px; width: 20px" />&nbsp;电话信息</div>
                    </div>
                </div>
                <table id="table1" cellpadding="0" cellspacing="0" style="width: 100%; background-color: White;
                    border: 1px solid #D6D6D6;">
                    <tr>
                        <td valign="top">
                            <div id="divFieldList" runat="server" style="width: 100%;">
                            </div>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <td id="td1" valign="top" style="padding: 0px 2px 5px 2px;">
                <div class="tools_box" style="height: 30px;">
                    <div class="tools_bar">
                        <div style="float: left; padding-top: 6px; padding-left: 1px; font-weight: bold;
                            color: red;">
                            <img src="../images/phone.png" style="height: 19px; width: 20px" />&nbsp;呼叫结果</div>
                    </div>
                </div>
                <table id="table2" cellpadding="0" cellspacing="0" style="width: 100%; background-color: White;
                    border: 1px solid #D6D6D6;">
                    <tr>
                        <td valign="top">
                            <div id="divHJJGList" runat="server" style="width: 100%;">
                            </div>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <td valign="top" style="padding: 0px 2px 5px 2px;">
                <div class="tools_box" style="height: 30px;">
                    <div class="tools_bar">
                        <div style="float: left; padding-top: 6px; padding-left: 1px; font-weight: bold;
                            color: red;">
                            <img src="../images/ico-show-txt.png" />&nbsp;&nbsp;问卷信息</div>
                    </div>
                </div>
                <table id="tableTree" cellpadding="0" cellspacing="0" style="width: 100%; background-color: White;
                    border: 1px solid #D6D6D6;">
                    <tr>
                        <td valign="top">
                            <asp:HiddenField ID="txtId" runat="server" Value="" />
                            <asp:HiddenField ID="txtTaskId" runat="server" Value="" />
                            <asp:HiddenField ID="txtPhone" runat="server" Value="" />
                            <asp:HiddenField ID="txtPagerId" runat="server" Value="" />
                            <asp:HiddenField ID="txtUserId" runat="server" Value="0" />
                            <asp:HiddenField ID="txtcallstate" runat="server" Value="0" />
                            <asp:HiddenField ID="txtHJJGId" runat="server" Value="0" />
                            <asp:HiddenField ID="txtHJJGName" runat="server" Value="" />
                            <table class="form_table">
                                <col width="100px" />
                                <col />
                                <tbody>
                                    <tr>
                                        <th style="border-right: 1px dotted #cccccc;">
                                            <span>问卷名称：</span>
                                        </th>
                                        <td>
                                            <span id="spanTitle" runat="server"></span>
                                        </td>
                                    </tr>
                                    <tr>
                                        <th style="border-top: 1px dotted #cccccc; border-right: 1px dotted #cccccc;">
                                            <span>问卷说明：</span>
                                        </th>
                                        <td style="border-top: 1px dotted #cccccc;">
                                            <span id="spanRemark" runat="server"></span>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                            <div id="divDataItems" runat="server" style="width: 100%">
                            </div>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <td align="center" style="height: 50px;">
                <%--<asp:Button ID="btnSubmit" runat="server" Text="提交保存" CssClass="btnSubmit"  OnClick="btnSubmit_Click" />--%>
                <input id="btnSubmit" type="button" class="btnSubmit" onclick="SaveData();" value="提交保存" />
            </td>
        </tr>
    </table>
    <br />
    </form>
</body>
</html>
