<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改【请填写功能名称】')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-num-edit" th:object="${ccExtNum}">
            <input name="extId" th:field="*{extId}" type="hidden">
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label is-required" th:text="#{extnum.form.extNum}"></label>
                    <div class="col-sm-8">
                        <input name="extNum" th:field="*{extNum}" class="form-control" type="text" required readonly>
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label is-required" th:text="#{extnum.form.extPass}"></label>
                    <div class="col-sm-8">
                        <input name="extPass" th:field="*{extPass}" class="form-control" type="text" required>
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label" th:text="#{extnum.form.userCode}"></label>
                    <div class="col-sm-8">
                        <input name="userCode" th:field="*{userCode}" class="form-control" type="text">
                    </div>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "cc/extnum";
        $.validator.addMethod("pattern", function(value, element, regexp) {
            return this.optional(element) || regexp.test(value);
        }, "格式不正确");

        $("#form-num-edit").validate({
            focusCleanup: true,
            rules: {
                extNum: {
                    required: true,
                    pattern: /^1\d{3}$/
                }
            },
            messages: {
                extNum: {
                    pattern: "请输入以1开头的4位数字分机号，例如：1001"
                }
            }
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/edit", $('#form-num-edit').serialize());
            }
        }
    </script>
</body>
</html>