<!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 th:text="#{extnum.query.extNum}"></label>
                                <input type="text" name="extNum"/>
                            </li>
                            <li>
                                <label th:text="#{extnum.query.userCode}"></label>
                                <input type="text" name="userCode"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;<span th:text="#{btn.search}"></span></a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;<span th:text="#{btn.reset}"></span></a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="cc:extnum:add">
                    <i class="fa fa-plus"></i> <span th:text="#{btn.add}"></span>
                </a>
                <a class="btn btn-info" onclick="batchAdd()" shiro:hasPermission="cc:extnum:batchAdd">
                    <i class="fa fa-plus-circle"></i> 批量新增
                </a>
                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="cc:extnum:edit">
                    <i class="fa fa-edit"></i> <span th:text="#{btn.edit}"></span>
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('cc:extnum:edit')}]];
        var removeFlag = [[${@permission.hasPermi('cc:extnum:remove')}]];
        var prefix = ctx + "cc/extnum";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: i18n('extnum.modalName'),
                columns: [{
                    checkbox: true
                },
                {
                    field: 'extId',
                    title: i18n('extnum.table.extId'),
                    visible: false
                },
                {
                    field: 'extNum',
                    title: i18n('extnum.table.extNum')
                },
                {
                    field: 'extPass',
                    title: i18n('extnum.table.extPass')
                },
                {
                    field: 'userCode',
                    title: i18n('extnum.table.userCode')
                },
                {
                    title: i18n('extnum.table.opra'),
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.extId + '\')"><i class="fa fa-edit"></i>' + i18n('btn.edit') + '</a> ');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });

        // 批量新增分机
        function batchAdd() {
            $.modal.open("批量新增分机", prefix + "/batchAdd", '700', '500');
        }
    </script>
</body>
</html>