.row
    .col-lg-12
        h1.site-h1
            | 对话列表
            div(style='clefloat:right;')
                .layui-btn-group
                    a(href="/agent/index.html?sort=lastmessage", style=(sort && sort == "lastmessage" ? "color:#ffffff !important" : ""))
                        button.layui-btn.layui-btn-primary.layui-btn-small(style=(sort && sort == "lastmessage" ? "color:#ffffff !important" : "background-color:#ffffff !important;color:#32c24d  !important;"))
                            | 消息
                    a(href="/agent/index.html?sort=logintime", style=(sort && sort == "logintime" ? "color:#ffffff !important" : ""))
                        button.layui-btn.layui-btn-primary.layui-btn-small(style=(sort && sort == "logintime" ? "color:#ffffff !important" : "background-color:#ffffff !important;color:#32c24d  !important;"))
                            | 接入
                    a(href="/agent/index.html?sort=default", style=(!sort || sort == "default" ? "color:#ffffff !important" : ""))
                        button.layui-btn.layui-btn-primary.layui-btn-small(style=(!sort || sort == "default" ? "color:#ffffff !important" : "background-color:#ffffff !important;color:#32c24d  !important;"))
                            | 默认
                    a(href='/agent/clean.html', data-toggle='tip', data-title='清理对话列表将会删除已结束对话，请确认是否清理？')
                        button.layui-btn.layui-btn-original.layui-btn-small(style='background-color:#ffffff !important;color:#32c24d  !important;')
                            i.layui-icon(style='font-size:22px;color:red;') &#xe640;
        ul.dialog-list#chat_users
            if agentUserList
                for agentuser in agentUserList
                    li(class={
                        'clearfix': true,
                        'chat-list-item': true,
                        'active': (curagentuser.id == agentuser.id)
                    }, id='agentuser_' + agentuser.userid, remove-id=agentuser.id, data-id=agentuser.userid)
                        a(href='/agent/agentuser.html?id=' + agentuser.id + '&channel=' + agentuser.channel, data-toggle="load", data-target="#ukefu-chat-agent", onclick="$('.chat-list-item.active').removeClass('active');$(this).closest('li.chat-list-item').addClass('active');cleanTopMsgTip(this) ;$('#last_msg_#{agentuser.userid}').text(0).hide();")
                            img(src=(agentuser.headimgurl && agentuser.headimgurl != '' ? agentuser.headimgurl : '/images/im/user.png'), style="width:45px;height:45px;")
                            if agentuser.status && agentuser.status == 'end'
                                if agentuser.channel && agentuser.channel == "weixin"
                                    i.kfont.ukefu-channel-icon-end(id="tip_icon_wenxin_#{agentuser.userid}")
                                        | &#xe64d;
                                else if agentuser.channel && agentuser.channel == "webim"
                                    i.kfont.ukefu-channel-icon-end(id="tip_icon_webim_#{agentuser.userid}")
                                        | &#xe60d;
                                else if agentuser.channel && agentuser.channel == "skype"
                                    i.csfont.ukefu-channel-icon-end(id="tip_icon_skype_#{agentuser.userid}")
                                        | &#59404;
                                else if agentuser.channel && agentuser.channel == "messenger"
                                    i.csfont.ukefu-channel-icon-end(id="tip_icon_messenger_#{agentuser.userid}")
                                        | &#xec11;
                                else if agentuser.channel && agentuser.channel == "phone"
                                    img.ukefu-channel-image(src="/images/cde-ico-gray.png", id="tip_icon_phone_#{agentuser.userid}")
                            else
                                if agentuser.channel && agentuser.channel == "weixin"
                                    i.kfont.ukefu-channel-icon(id="tip_icon_wenxin_#{agentuser.userid}")
                                        | &#xe64d;
                                else if agentuser.channel && agentuser.channel == "webim"
                                    i.kfont.ukefu-channel-icon(id="tip_icon_webim_#{agentuser.userid}")
                                        | &#xe60d;
                                else if agentuser.channel && agentuser.channel == "skype"
                                    i.csfont.ukefu-channel-icon(id="tip_icon_skype_#{agentuser.userid}")
                                        | &#59404;
                                else if agentuser.channel && agentuser.channel == "messenger"
                                    i.csfont.ukefu-channel-icon(id="tip_icon_messenger_#{agentuser.userid}")
                                        | &#xec11;
                                else if agentuser.channel && agentuser.channel == "phone"
                                    img.ukefu-channel-image(src="/images/phone-ico.png", id="tip_icon_phone_#{agentuser.userid}")
                            .dialog-info
                                .address
                                    span(style="width:90px;display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;word-wrap: break-word;word-break: break-all;")
                                        | #{agentuser.username}
                                .news
                                    | #{pugHelper.formatDate('yyyy-MM-dd HH:mm:ss', agentuser.servicetime)}
                                    if agentuser.status && agentuser.status == 'end'
                                        small.label.bg-gray.pull-right(id="tip_message_#{agentuser.userid}") 离开
                                    else
                                        small.label.bg-green.pull-right(id="tip_message_#{agentuser.userid}") 在线
                            .last-msg
                                small.ukefu-badge.bg-red(id="last_msg_#{agentuser.userid}",style="#{(agentuser.tokenum == 0 || (curagentuser && curagentuser.id == agentuser.id)) ? 'display:none' : ''}")
                                    | #{agentuser.tokenum ? agentuser.tokenum : 0}
