<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <!-- 避免IE使用兼容模式 -->
    <meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1">
    <meta name="renderer" content="webkit">
     <%@ include file="ap.jsp" %>
</head>

<body>
<div data-toggle="topjui-layout" data-options="fit:true">
    <div data-options="region:'center',iconCls:'icon-reload',title:'',split:true,border:false,bodyCls:'border_left_right'">
        <!-- datagrid表格 -->
        <table data-toggle="topjui-datagrid"
               data-options="id:'userDg',
               singleSelect:true,
				selectOnCheck:false,
				checkOnSelect:false,
                    url:'visitorlist.action',
                    childTab: [{id:'eastTabs'}],
                    filter: [{
                        field: 'visitor_name',
                        type: 'textbox',
                        op: ['contains', 'equal', 'notequal', 'less', 'greater']
                    },{
                        field: 'car_number',
                        type: 'textbox',
                        op: ['contains', 'equal', 'notequal', 'less', 'greater']
                    }]">
            <thead>
            <tr>
                <th data-options="field:'id',title:'UUID',checkbox:true"></th>
                <th data-options="field:'visitor_name',title:'姓名',sortable:true"></th>
                <th data-options="field:'visitor_phone',title:'联系手机',sortable:true"></th>
                <th data-options="field:'car_number',title:'车牌号',sortable:true"></th>
                <th data-options="field:'reason',title:'访问原由',sortable:true"></th>
                <th data-options="field:'state',title:'状态',sortable:true,
                    formatter:function(value,row,index){
                         if (value == '2') {
                            return '<font color=green>已推送</font>';
                        } else if (value == '1'){
                        	return '<font color=red>未推送</font>';
                        } else if (value == '3'){
                        	return '<font color=blue>已拒绝</font>';
                        }
                    }"
                ></th>
                <th data-options="field:'created_time',title:'创建时间',sortable:true,
                    formatter:function(value,row,index){
                        return new Date(parseInt(value) * 1000).toLocaleString().replace(/:\d{1,2}$/,' ');
                    }"
                ></th>
                <th data-options="field:'visit_start_time',title:'起始时间',sortable:true,
                    formatter:function(value,row,index){
                        return new Date(parseInt(value) * 1000).toLocaleString().replace(/:\d{1,2}$/,' ');
                    }
                "></th>
                <th data-options="field:'visit_end_time',title:'结束时间',sortable:true,
                    formatter:function(value,row,index){
                        return new Date(parseInt(value) * 1000).toLocaleString().replace(/:\d{1,2}$/,' ');
                    }
                "></th>
                <th data-options="field:'member_name',title:'受访者姓名',sortable:true"></th>
                <th data-options="field:'member_org',title:'受访者部门',sortable:true"></th>
                <th data-options="field:'member_phone',title:'受访者手机',sortable:true"></th>
            </tr>
            </thead>
        </table>
    </div>

</div>

<!-- 表格工具栏开始 -->
<div id="userDg-toolbar" class="topjui-toolbar"
     data-options="grid:{
           type:'datagrid',
           id:'userDg'
       }">
    <a href="javascript:void(0)"
       data-toggle="topjui-menubutton"
       data-options="method:'openDialog',
       extend: '#userDg-toolbar',
       iconCls: 'fa fa-plus',
       btnCls: 'topjui-btn-blue',
       dialog:{
           width: 650,
           height: 380,
           id:'userAddDialog',
           href:'add_user.jsp',
           buttonsGroup:[
               {text:'保存',url:'visitoradd.action',iconCls:'fa fa-plus',handler:'ajaxForm',btnCls:'topjui-btn-brown'}
           ]
       }">新增访客</a>
    <a href="javascript:void(0)"
       data-toggle="topjui-menubutton"
       data-options="method: 'openDialog',
            extend: '#userDg-toolbar',
            iconCls: 'fa fa-pencil',
            btnCls: 'topjui-btn-green',
            grid: {
                type: 'datagrid',
                id: 'userDg'
            },
            dialog: {
                width: 650,
                height: 380,
                href: 'update_user.jsp?id={id}',
                url:'visitorqueryById.action?id={id}',
                buttonsGroup: [
                    {
                        text: '添加到白名单',
                        url:'visitortoVisitor.action',
                        iconCls: 'fa fa-save',
                        handler: 'ajaxForm',
                        btnCls: 'topjui-btn-green'
                    }
                ]
            }">添加到白名单</a>
    <a href="javascript:void(0)"
       data-toggle="topjui-menubutton"
       data-options="method: 'openDialog',
            extend: '#userDg-toolbar',
            iconCls: 'fa fa-pencil',
            btnCls: 'topjui-btn-red',
            grid: {
                type: 'datagrid',
                id: 'userDg'
            },
            dialog: {
                width: 650,
                height: 380,
                href: 'update_user.jsp?id={id}',
                url:'visitorqueryById.action?id={id}',
                buttonsGroup: [
                    {
                        text: '拒绝',
                        url:'visitorrefuse.action',
                        iconCls: 'fa fa-save',
                        handler: 'ajaxForm',
                        btnCls: 'topjui-btn-green'
                    }
                ]
            }">拒绝访客</a>
    <a href="javascript:void(0)"
       data-toggle="topjui-menubutton"
       data-options="method:'doAjax',
       extend: '#userDg-toolbar',
       btnCls:'topjui-btn-brown',
       iconCls:'fa fa-trash',
       url:'visitordel.action',
       grid: {uncheckedMsg:'请先勾选要删除的数据',param:'ids:id'}">删除访客</a>
    <a href="javascript:void(0)"
       data-toggle="topjui-menubutton"
       data-options="method:'filter',
       extend: '#userDg-toolbar',
       btnCls:'topjui-btn-black'">查询</a>
    
    </div>
<!-- 表格工具栏结束 -->
</body>
</html>