<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('场地申请列表')"/>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>
                        <li>
                            <label>申请Id：</label>
                            <input type="text" name="fieldApplyId"/>
                        </li>
                        <li>
                            类型：<select name="applyType" th:with="type=${@dict.getType('zhengzai_field_apply_type')}">
                            <option value="all">所有</option>
                            <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                        </select>
                        </li>
                        <li>
                            状态：<select name="applyStatus" th:with="type=${@dict.getType('zhengzai_field_apply_status')}">
                            <option value="-1">所有</option>
                            <option th:each="dict : ${type}" th:text="${dict.dictLabel}"th:value="${dict.dictValue}"></option>
                        </select>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                    class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                    class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="col-sm-12 select-table table-bordered">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
    var dicFieldApplyType = [[${@dict.getType('zhengzai_field_apply_type')}]];
    var dicFieldApplyStatus = [[${@dict.getType('zhengzai_field_apply_status')}]];

    var detailFlag = [[${@permission.hasPermi('merchant:field:apply:detail')}]];

    var prefix = ctx + "merchant/field/apply";

    $(function () {
        var options = {
            url: prefix + "/list",
            detailUrl: prefix + "/details/{id}",
            sortName: "createdAt",
            sortOrder: "desc",
            modalName: "场地申请",
            columns: [{
                checkbox: true
            },
                {
                    field: 'fieldApplyId',
                    title: '申请id'
                },
                {
                    field: 'fieldId',
                    title: '场地id'
                },
                {
                    field: 'name',
                    title: '场地名称'
                },
                {
                    field: 'applyType',
                    title: '类型',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(dicFieldApplyType, value);
                    }
                },
                {
                    field: 'applyStatus',
                    title: '状态',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(dicFieldApplyStatus, value);
                    }
                },
                {
                    field: 'createdAt',
                    title: '申请时间',
                    sortable: true,
                    formatter: function (value, row, index) {
                        return $.common.sprintf("<span>%s</span>", null != value ? value.replace("T"," ").substring(0, 19) : value);
                    }
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-info btn-xs ' + detailFlag + '" href="javascript:void(0)" onclick="$.operate.detailTab(\'' + row.fieldApplyId + '\')"></i>查看</a> ');
                        return actions.join('');
                    }
                }]
        };

        $.table.init(options);

    });
</script>
</body>
</html>