<!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="sponsorId"/>
                        </li>
                        <li>
                            上线状态：<select name="isOnline" th:with="type=${@dict.getType('zhengzai_sponsor_is_online')}">
                            <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 dicSponsorIsOnline = [[${@dict.getType('zhengzai_sponsor_is_online')}]];

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

    var prefix = ctx + "merchant/sponsor";

    $(function () {
        var options = {
            url: prefix + "/list",
            detailUrl: prefix + "/details/{id}",
            sortName: "createdAt",
            sortOrder: "desc",
            modalName: "主办",
            columns: [
                {
                    checkbox: true
                },
                {
                    field: 'sponsorId',
                    title: '主办id'
                },
                {
                    field: 'name',
                    title: '主办名称'
                },
                {
                    field: 'isOnline',
                    title: '上线状态',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(dicSponsorIsOnline, 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.sponsorId + '\')"></i>查看</a> ');
                        return actions.join('');
                    }
                }]
        };

        $.table.init(options);

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