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

<!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 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/CustomersData.js" type="text/javascript"></script>
    <link href="../scripts/ui/skins/ligerui-icons.css" rel="stylesheet" type="text/css" />
    <link href="../images/style.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript">
        var currentSelectUserNo; //当前选中的坐席工号
        var Phone = parent.document.getElementById("Phone");
        $(function () {
            LoadList();
        });

        function LoadList() {
            try {
                $.ajax({
                    type: 'get',
                    url: 'ajax/seatmonitoring.ashx?action=getseatlist',
                    data: { userid: '' },
                    dataType: 'html',
                    async: false,
                    cache: false,
                    success: function (res) {
                        document.getElementById("divDataItems").innerHTML = res;
                        $("#pageloading").hide();
                        Phone = parent.document.getElementById("Phone");
                        showAllAgentState(); //显示坐席状态
                    }
                });
            }
            catch (e) {
                alert(e.Message);
            }
        }

        function GetOneState(userNo, username) {
            document.getElementById("span_tittle").innerHTML = username;
            document.getElementById("span_zxstate_tittle").innerHTML = userNo;
//            currentSelectUserNo = userNo;
//            rtn = Phone.QueryAgentStatusEx(userNo);
//            showSelectAgentInfo(Phone.AgentInfoEx_CurState);
        }

        //显示所有坐席状态
        function showAllAgentState() {
            var wdl = 0; //未签入
            var kx = 0; //空闲
            var zl = 0; //振铃
            var thz = 0; //通话中
            var ms = 0; //忙
            var arruser = document.getElementsByName("forcount");
            try {
                if (arruser.length > 0) {
                    for (i = 0; i < arruser.length; i++) {
                        parent.document.getElementById("Phone").QueryAgentStatusEx(arruser[i].id);
                        var state = parent.document.getElementById("Phone").AgentInfoEx_CurState;
                        switch (state) {
                            case 0:
                                wdl++;
                                break;
                            case 1:
                                kx++;
                                break;
                            case 2: wdl++; break;
                            case 3: wdl++; break;
                            case 4:
                                zl++;
                                break;
                            case 5:
                                thz++;
                                break;
                            case 6: wdl++; break;
                            case 7: ms++; break;
                            case 8: wdl++; break;
                            case 9: wdl++; break;
                            case 10: ms++; break;
                            default: wdl++; break;

                        }
                        GetState(arruser[i].id, state);
                    }
                }

                document.getElementById("span0").innerHTML = wdl;
                document.getElementById("span1").innerHTML = kx;
                document.getElementById("span2").innerHTML = ms;
                document.getElementById("span3").innerHTML = zl;
                document.getElementById("span4").innerHTML = thz;
            }
            catch (e) {alert(e.Message);}
            var showState = window.setTimeout("showAllAgentState()", 3000);
        }

        function GetState(userNo, state) {
            if (document.getElementById(userNo) != null) {
                var img_userinfo = document.getElementById("img_zxstate_" + userNo);
                var span_userState = document.getElementById("span_zxstate_" + userNo);
                switch (state) {
                    case 0:
                        img_userinfo.src = "../images/seatimgs/weiqianru.jpg";
                        span_userState.style.color = "#cccccc";
                        span_userState.innerHTML = "未签入";
                        break;
                    case 1:
                        img_userinfo.src = "../images/seatimgs/kongxian.jpg";
                        span_userState.style.color = "Green";
                        span_userState.innerHTML = "空闲";
                        break;
                    case 2: break;
                    case 3: break;
                    case 4:
                        img_userinfo.src = "../images/seatimgs/zhenglin.jpg";
                        span_userState.style.color = "Green";
                        span_userState.innerHTML = "振铃";
                        break;
                    case 5:
                        img_userinfo.src = "../images/seatimgs/tonghua.jpg";
                        span_userState.style.color = "Green";
                        span_userState.innerHTML = "通话中";
                        break;
                    case 6: break;
                    case 7: img_userinfo.src = "../images/seatimgs/mang.jpg";
                        span_userState.style.color = "Red";
                        span_userState.innerHTML = "忙";
                        break;
                    case 8: break;
                    case 9: break;
                    case 10: break;


                    default:
                        break;
                }
            }
        }

    </script>
</head>
<body style="margin: 0px; padding: 0px; overflow: hidden;">
    <form id="form1" runat="server">
    <div class="l-loading" style="display: block" id="pageloading">
    </div>
    <div class="tools_box">
        <div class="tools_bar">
            <table cellspacing="3" cellpadding="0" width="100%">
                <tr style="height: 42px;">
                    <td id="td0" style="padding-left: 8px;">
                        <div style="float: left;">
                            <img id="img0" src="../images/seatimgs/weiqianru.jpg" /></div>
                        <div style="float: left; padding-left: 8px; padding-top: 4px; color: #cccccc;">
                            未签入&nbsp;&nbsp;<span id="span0" style="font-weight: bold;">(0)</span></div>
                    </td>
                    <td id="td1" style="padding-left: 8px;">
                        <div style="float: left;">
                            <img id="img5" src="../images/seatimgs/kongxian.jpg" /></div>
                        <div style="float: left; padding-left: 8px; padding-top: 4px; color: Green;">
                            空闲&nbsp;&nbsp;<span id="span1" style="font-weight: bold;">(0)</span></div>
                    </td>
                    <td id="td2" style="color: Red; padding-left: 8px;">
                        <div style="float: left;">
                            <img id="img6" src="../images/seatimgs/mang.jpg" /></div>
                        <div style="float: left; padding-left: 8px; padding-top: 4px;">
                            忙&nbsp;&nbsp;<span id="span2" style="font-weight: bold;">(0)</span></div>
                    </td>
                    <td id="td3" style="color: Green; padding-left: 8px;">
                        <div style="float: left;">
                            <img id="img3" src="../images/seatimgs/zhenglin.jpg" /></div>
                        <div style="float: left; padding-left: 8px; padding-top: 4px;">
                            振铃&nbsp;&nbsp;<span id="span3" style="font-weight: bold;">(0)</span></div>
                    </td>
                    <td id="td7" style="color: Green; padding-left: 8px;">
                        <div style="float: left;">
                            <img id="img7" src="../images/seatimgs/tonghua.jpg" /></div>
                        <div style="float: left; padding-left: 8px; padding-top: 4px;">
                            通话中&nbsp;&nbsp;<span id="span4" style="font-weight: bold;">(0)</span></div>
                    </td>
                </tr>
            </table>
        </div>
        <div class="select_box" style="height: 42px;">
            <table cellspacing="0" cellpadding="0" width="100%" height="100%">
                <tbody>
                    <tr>
                        <td style="width: 160px;">
                            <div style="height: 30px; border: 1px solid #CCCCCC; text-align: center;" onmouseover="this.style.border='1px solid #3A8BDC'"
                                onmouseout="this.style.border='1px solid #CCCCCC'">
                                <table border="0" cellspacing="0" cellpadding="0" width="100%" height="100%" style="text-align: center;">
                                    <tr>
                                        <td>
                                            <span id="span_tittle" style="color: #00000;">姓名</span>
                                        </td>
                                        <td>
                                            <img id="img_zxstate_tittle" src="../images/seatimgs/weiqianru.jpg" />
                                        </td>
                                        <td>
                                            <span id="span_zxstate_tittle" style="color: #cccccc;">工号</span>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                        </td>
                        <td style="width: 20px;">
                            &nbsp;
                        </td>
                        <td>
                            <table border="0" cellspacing="0" cellpadding="0" width="100%" height="20px" style="text-align: center;">
                                <tr>
                                    <td style="width: 100px">
                                        <img id="img1" src="../images/seatimgs/zx1.png" title="置闲" onclick="ztzx()" style="cursor: hand;" />
                                    </td>
                                    <td style="width: 100px">
                                        <img id="img2" src="../images/seatimgs/zm1.png" title="置忙" onclick="ztzm()" style="cursor: hand;" />
                                    </td>
                                    <td>
                                        &nbsp;
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
            </table>
        </div>
    </div>
    <div id="divDataItems" style="width: 100%; height: 380px; text-align: center; cursor: text;
                    overflow-y: auto; scrollbar-face-color: #DBEBFE; scrollbar-shadow-color: #B8D6FA;
                    scrollbar-highlight-color: #FFFFFF; scrollbar-3dlight-color: #DBEBFE; scrollbar-darkshadow-color: #458CE4;
                    scrollbar-track-color: #FFFFFF; scrollbar-arrow-color: #458CE4;" runat="server">
                </div>
    </form>
</body>
</html>
