extends /apps/include/layout.pug
include /mixins/client.mixin.pug
block content
    .layui-side.layui-bg-black
        .layui-side-scroll
            include /apps/service/include/left.pug
    .layui-body
        .layui-side-scroll
            .row
                .col-lg-12
                    h1.site-h1(style='border-top:1px solid #e6e6e6;') 当前对话 #{agentServiceList.totalElements ?"（" + agentServiceList.totalElements + "）" : "（0）"}
                    table.layui-table(lay-skin='line', style='table-layout: fixed')
                        thead
                            tr.design-sortable-tr
                                th 用户名
                                th(width='60px') 接入渠道
                                th(width='50px') 状态
                                th 服务坐席
                                th 服务时间
                                th 等待时长
                                th 地域
                                th.operating 操作
                        tbody(style='table-layout: fixed; word-break: break-all;')
                            if agentServiceList.content.size() > 0
                                for agentService in agentServiceList.content
                                    tr.tdHasContorllor.design-dropable-td(title= agentService.username)
                                        td.first_td_head(style="text-overflow: ellipsis;white-space: nowrap;overflow: hidden;")
                                            a(href="/service/online/index.html?userid=" + agentService.userid + "&agentservice=" + agentService.id) #{agentService.username}
                                        td #{agentService.channel}
                                        if agentService.status == 'inservice'
                                            td 服务中
                                        if agentService.status == 'end'
                                            td 已结束
                                        td(style="text-overflow: ellipsis;white-space: nowrap;overflow: hidden;" title= agentService.agentusername) #{agentService.agentusername}
                                        td #{pugHelper.formatDate('yyyy-MM-dd HH:mm:ss', agentService.servicetime)}
                                        td #{pugHelper.padRight(agentService.waittingtime / (1000*60*60), "00")}:#{pugHelper.padRight(agentService.waittingtime % (1000*60*60) / (1000*60), "00")}:#{pugHelper.padRight(agentService.waittingtime % (1000*60) / 1000, "00")}
                                        td #{agentService.region}
                                        td(style="white-space:nowrap")
                                            a(href="/service/current/trans.html?id=" + agentService.id, data-toggle="ajax", data-title="转接坐席", data-width="750", data-height="550")
                                                i.kfont &#xe62c;
                                                | 转接
                                            if !agentService.agent && agentService.channel != 'skype'
                                                a.isInvite(href="/service/current/invite.html?id=" + agentService.id, style="margin-left:10px;")
                                                    i.kfont &#xe62c;
                                                    | 邀请
                                            a(href="/service/current/end.html?id=" + agentService.id, data-toggle="tip", data-title="关闭对话将会强制中断坐席和访客的对话，请确认是否关闭？", style="margin-left:10px;")
                                                i.kfont &#xe609;
                                                | 关闭
                                            a(href="/service/trace.html?sessionid=" + agentService.sessionid, title="查看访客轨迹", data-toggle="ajax", data-width="1050", style="margin-left:10px;")
                                                i.kfont &#xe638;
                                                | 轨迹
                            else
                                tr
                                    td(colspan="8" style="height:400px;")
                                        .ukefu-empty(style="background: none")
                                            i.layui-icon &#xe63a;
                                            div(style="") 当前没有进行中的对话
            .row(style='padding:5px;')
                .col-lg-12#page(style='text-align:center;')
    script.
        layui.use(['laypage', 'layer'], function(){
                  var laypage = layui.laypage
                  ,layer = layui.layer;

                  laypage({
                        cont: 'page'
                        , pages: #{agentServiceList ? agentServiceList.totalPages : 0} //总页数
                        , curr: #{agentServiceList ? agentServiceList.number + 1 : 0}
                        ,groups: 5 //连续显示分页数
                        ,jump:function(data , first){
                            if(!first){
                                location.href = "/service/current/index.html?p="+data.curr ;
                            }
                        }
                   });
                });

            $(function(){
                if($(".isInvite").length>0){
                    $(".operating").css('width','230px')
                }else{
                    $(".operating").css('width','175px')
                }
            });