<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/SimonMasterPage.Master"
    Inherits="System.Web.Mvc.ViewPage<dynamic>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    获取资料记录查询
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div class="easyui-layout" data-options="fit:true">
        <div data-options="region:'north',border:false" style="overflow: hidden; height: 30px;">
            <div class="toolbar" style="position: relative;">
                <span style="padding-left: 5px;">
                    <label>
                        开始时间：</label><input id="txtStartDate" type="text" class="easyui-datebox" style="width: 100px;"
                            data-options="editable:false" />
                    <label>
                        截止时间：</label><input id="txtEndDate" type="text" class="easyui-datebox" style="width: 100px;"
                            data-options="editable:false" />
                    <a href="javascript:void(0)" class="toolbar-button tb-icon-search" onclick="query()">
                        查询</a> </span><span style="position: absolute; right: 10px;">
                            <%--<a href="javascript:void(0)"class="toolbar-button tb-icon-refresh" onclick="refresh()">刷新</a>--%>
                            <%--<a href="javascript:void(0)" class="toolbar-button tb-icon-remove" onclick="delData()"><%: Html.Language("Delete")%></a>--%>
                            <%--<a href="javascript:void(0)" class="toolbar-button tb-icon-clear" onclick="clearData()"><%: Html.Language("Empty")%></a>--%>
                        </span>
            </div>
        </div>
        <div data-options="region:'center',border:false">
            <table id="dg" class="easyui-datagrid" style="width: 100%; height: auto;" data-options="
						toolbar: '#tb',
						border: false,
						singleSelect: false,
						pagination: true,
						pageSize: 50,
						rownumbers: true,
						striped: true,
						sortName: 'CreatedDate',
						sortOrder: 'desc',
						fit: true,
						fitColumns: true,
						idField: 'ID',
                        nowrap:true,
						frozenColumns: [[
							{ field: 'ID', checkbox: true }
						]],
						method: 'post'
					">
                <thead>
                    <tr>
                        <th data-options="field:'Name',sortable:true">
                            姓名
                        </th>
                        <th data-options="field:'CompanyName',sortable:true">
                            公司名
                        </th>
                        <th data-options="field:'PhoneNumber',sortable:true">
                            手机号
                        </th>
                        <th data-options="field:'ValidateCode',sortable:true">
                            验证码
                        </th>
                        <th data-options="field:'CreatedDate',sortable:true,formatter:$.tools.formatDateTime">
                            创建日期
                        </th>
                    </tr>
                </thead>
            </table>
        </div>
    </div>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ScriptContent" runat="server">
    <style type="text/css">
        .toolbar label
        {
            font-size: 12px;
        }
    </style>
    <script type="text/javascript">
        function query() {
            var startDate = $("#txtStartDate").datebox("getValue");
            var endDate = $("#txtEndDate").datebox("getValue");
            if (startDate == "" && endDate != "") {
                $.tools.alert(lang.PEASD);
                return;
            }
            if (startDate != "" && endDate == "") {
                $.tools.alert(lang.PETED);
                return;
            }
            if (startDate != "" && endDate != "") {
                startDate += " 00:00:00";
                endDate += " 23:59:59";
                var start = new Date(startDate.replace("-", "/"));
                var end = new Date(endDate.replace("-", "/"));
                if (end < start) {
                    $.tools.alert(lang.EDMBGTOETSD);
                    return;
                }
            }
            var params = {
                startDate: startDate != "" ? startDate : undefined,
                endDate: endDate != "" ? endDate : undefined
            };
            $('#dg').datagrid({ url: '/ManualVisit/LoadAllByPage/', queryParams: params });
        }
        $(function () {
            var curTime = new Date();
            var startTime = new Date(curTime.getTime() - 1 * 24 * 60 * 60 * 1000);
            $("#txtStartDate").datebox("setValue", startTime.format('yyyy-MM-dd hh:mm:ss'));
            $("#txtEndDate").datebox("setValue", curTime.format('yyyy-MM-dd hh:mm:ss'));
        });
    </script>
</asp:Content>
