{extend name="common/common2" /}
{block name="main"}
<div class="ibox">
    <div class="ibox-content">
        <div class="row">

            <div class="col-xs-12" style="text-align: right;">
                <form class="form-inline" id="form-search" action="{:url('index')}">
                    <div class="input-group">
                        <input type="text" id="date" readonly class="form-control" name="begin" placeholder="截至开始时间">
                    </div>
                    <div class="input-group">
                        <input type="text" id="date1" readonly class="form-control" name="end" placeholder="截至结束时间">
                    </div>
                    <div class="input-group">
                         <span class="input-group-btn">
                            <button class="btn-sm btn-primary" type="button" id ="search-btn" ><i class="fa fa-search"></i></button>
                        </span>
                        &nbsp;
                        <span class="input-group-btn">
                            <button class="btn-sm btn-primary " type="button" id="search-clear"><i class="fa fa-undo"></i></button>
                        </span>

                    </div>
                </form>
            </div>
        </div>

    </div>
    <div class="ibox-content">
        <div class="jqGrid_wrapper">
            <table id="table" style="border-collapse: collapse"></table>
            <div id="pager"></div>
        </div>
    </div>
</div>
<script src="/static/layDate-v5.0.9/laydate.js"></script>
{/block}
{block name="script"}
<script>
    laydate.render({
        elem: '#date',
        //设置开始日期、日期日期的 input 选择器
        //数组格式为 5.3.0 开始新增,之前版本直接配置 true 或任意分割字符即可
        trigger: 'click' ,
        theme: '#3C65F9',
        type:'datetime'
    });
    laydate.render({
        elem: '#date1',
        //设置开始日期、日期日期的 input 选择器
        //数组格式为 5.3.0 开始新增,之前版本直接配置 true 或任意分割字符即可
        trigger: 'click' ,
        theme: '#3C65F9',
        type:'datetime'
    });
    $(function () {

        $(window).bind("resize",function(){
            var width=$(".jqGrid_wrapper").width();
            $("#table").setGridWidth(width);
        });

        $.jgrid.defaults.styleUI="Bootstrap";
        $("#table").jqGrid({
            url:"{:url('index')}",
            datatype: "json",
            colModel:[
                {label:'序号',name:'id',index:'id', width:30,sortable: false},
                {label:'订单编号',name:'sn',index:'sn', width:50,sortable: false},
                {label:'联系人',name:'contact',index:'contact', width:30,sortable: false},
                {label:'联系电话',name:'phone',index:'phone', width:30,sortable: false},
                {label:'预收金',name:'pre_money',index:'pre_money',width:30,editable: false,sortable: false},
                {label:'已花费金额',name:'cost_money',index:'cost_money',width:30,editable: false,sortable: false},
                {label:'开始时间',name:'start',index:'start',width:60,editable: false,sortable: false},
                {label:'截至时间',name:'end',index:'end',width:60,editable: false,sortable: false},

                // {label:'操作',width:100,sortable: false,formatter: function (a, b, c) {
                //     var detail = "{:url('detail',[],'')}/id/"+c.id;
                //
                //         var btn = '<a url="'+detail+'" href="javascript:;" data-title="详情" onclick="layer_open(this,1)"><span class="label label-primary" title="详情">详情</span></a>&nbsp;';
                //
                //         return btn;
                // }},
            ],
            rowNum:10,
            rowList:[10,20,30,50,100],
            pager: '#pager',
            sortname: 'id',
            viewrecords: true,
            autowidth:true,
            mtype: 'post',
            height: 'auto',
            emptyrecords: "暂无数据",
            sortorder: "desc",
            caption:"预警记录",
            loadComplete: function (xhr) {
                if(xhr.code==0){
                    layer.msg(xhr.msg);
                    return false;
                }

            },
        });
    });

</script>
{/block}