<!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-batch-add">
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label is-required">生成分机号数量：</label>
                    <div class="col-sm-8">
                        <input name="count" class="form-control" type="number" min="1" max="2000" required placeholder="请输入要生成的分机号数量（1-10000）">
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">起始分机号：</label>
                    <div class="col-sm-8">
                        <input name="startExtNum" class="form-control" type="number" min="1" placeholder="选填">
                        <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 非必填，指定后将从该分机号开始生成</span>
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label is-required">分机密码：</label>
                    <div class="col-sm-8">
                        <input name="extPass" class="form-control" type="text" placeholder="选填，所有分机密码将相同">
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">绑定工号：</label>
                    <div class="col-sm-8">
                        <input name="userCode" class="form-control" type="text" placeholder="选填，所有分机将绑定同一工号">
                        <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 非必填，如需绑定请填写</span>
                    </div>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "cc/extnum"

        $("#form-num-batch-add").validate({
            focusCleanup: true,
            rules: {
                count: {
                    required: true,
                    digits: true,
                    range: [1, 10000]
                },
            },
            messages: {
                count: {
                    required: "请输入生成数量",
                    digits: "请输入数字",
                    range: "数量范围为1-10000"
                },
            }
        });

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