include /mixins/client.mixin.pug
form.layui-form(action='/service/transfer/save.html', method='post')
    input(type='hidden', name='id', value=agentserviceid)
    input(type='hidden', name='userid', value=userid)
    input(type='hidden', name='agentserviceid', value=agentserviceid)
    input(type='hidden', name='agentuserid', value=agentuserid)
    .row(style='height:295px;')
        .col-lg-3
            .box
                .box-title
                    h1.site-h1(style='background-color:#FFFFFF;margin:0px;padding:0 0 4px 20px;') 技能组
                .box-body(style='padding:0px 0px;position: relative;height:250px;overflow-y:auto;')
                    ul
                        if skillGroups
                            for skill in skillGroups
                                if skill.id == user.organ
                                    - var agentNum = 0
                                    if userList
                                        for agent in userList
                                            if skill.id && agent.organs[skill.id]
                                                - agentNum = agentNum + 1
                                    li.uk_role(title= skill.name + "(" + agentNum + ")", class=({'this': skill.id == currentorgan}),  style="margin:0px;padding:7px 0 7px 20px;", onclick="$('.uk_role.this').removeClass('this');$(this).addClass('this');")
                                        a(href="/agent/transfer/agent.html?organ=" + skill.id + "&agentid=" + agentservice.agentno, data-toggle="load", data-target="#skillAgentList")
                                            i.kfont(style="margin-top: 3px;float: left") 
                                            span(style="max-width: 120px;text-overflow: ellipsis;white-space: nowrap; overflow: hidden;float: left;margin: 0 3px") #{skill.name}
                                        |（#{agentNum}）

                                if skill.id != user.organ
                                    - var agentNum = 0
                                    if userList
                                        for agent in userList
                                            if skill.id && agent.organs[skill.id]
                                                - agentNum = agentNum + 1
                                    li.uk_role(title= skill.name + "(" + agentNum + ")", class=({'this': skill.id == currentorgan}), style="margin:0px;padding:7px 0 7px 20px;", onclick="$('.uk_role.this').removeClass('this');$(this).addClass('this');")
                                        a(href="/agent/transfer/agent.html?organ=" + skill.id + "&agentid=" + agentservice.agentno, data-toggle="load", data-target="#skillAgentList")
                                            i.kfont(style="margin-top: 3px;float: left") 
                                            span(style="max-width: 120px;text-overflow: ellipsis;white-space: nowrap; overflow: hidden;float: left;margin: 0 3px") #{skill.name}
                                        |（#{agentNum}）
        .col-lg-9(style='border-left:1px solid #dedede;')
            .box
                .box-body#skillAgentList(style='padding:0px 2px;position: relative;height:295px;overflow-y:auto;')
                    include /apps/agent/transferagentlist.pug
    .row(style='margin-top:5px;')
        .col-lg-12
            h1.site-h1(style='background-color:#EEEEEE;padding-left: 20px') 转接附言（最多不超过255个字符）
            .layui-form-item(style='padding-left:10px;padding-top:5px;')
                .layui-inline
                    .layui-input-inline(style='width: 720px;')
                        textarea.layui-textarea(name='memo', placeholder='请输入转接附言', style='resize:none;height:90px;min-height:90px;margin-left: 5px', maxlength='255') #{agentservice.transmemo}
    .layui-form-button
        .layui-button-block
            button.layui-btn(lay-submit, lay-filter='contactsForm') 转接
            button.layui-btn.layui-btn-original(type='button', onclick='closedPage()') 关闭

    script.
        function closedPage(){
                layer.closeAll("page")
            }

            $('.ukefu-agentstatus td:not(:last-child)').on("click" , function(){
                $('.ctxid').prop("checked" , false);
                if($(this).parent().find("input").prop("checked")){
                    $(this).parent().find("input").prop("checked" , false);
                }else{
                    $(this).parent().find("input").prop("checked" , true);
                }
            });

            layui.use('form', function(){
                var form = layui.form();
                //监听提交
                form.on('submit(contactsForm)', function(data){
                    if(!data.field.agentno){
                        layer.msg("请选择坐席");
                        return false
                    }
                });
            });
