<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改分机权限')" />
    <th:block th:include="include :: select2-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-power-edit" th:object="${ccExtPower}">
            <input name="powerId" th:field="*{powerId}" type="hidden">
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label is-required" th:text="#{extpower.form.extNum}"></label>
                    <div class="col-sm-8">
                        <input name="extNum" th:field="*{extNum}" class="form-control" type="text" required readonly="true">
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label is-required" th:text="#{extpower.form.groupId}"></label>
                    <div class="col-sm-8">
                        <select id="groupId" class="form-control select2-multiple" multiple>
                            <option th:each="bizGroup:${bizGroups}" th:value="${bizGroup.groupId}" th:text="${bizGroup.bizGroupName}" th:selected="${bizGroup.flag}"></option>
                        </select>
                    </div>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: select2-js" />
    <script th:inline="javascript">
        var prefix = ctx + "cc/extpower";
        $("#form-power-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                var data = $('#form-power-edit').serializeArray();
                var groupIds = $.form.selectSelects("groupId");
                data.push({"name": "groupIds", "value": groupIds});
                $.operate.save(prefix + "/edit", data);
            }
        }
        $(function() {
            $('#groupId').select2({
                placeholder: "请选择业务组",
                allowClear: true
            });
        })
    </script>
</body>
</html>