<!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-rule-edit" th:object="${sysCodeRule}">
            <input name="ruleId" th:field="*{ruleId}" type="hidden">
            <div class="col-xs-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label is-required">规则编码：</label>
                    <div class="col-sm-8">
                        <input name="ruleCode" th:field="*{ruleCode}" class="form-control" type="text" maxlength="64" required>
                    </div>
                </div>
            </div>
            <div class="col-xs-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label is-required">规则名称：</label>
                    <div class="col-sm-8">
                        <input name="ruleName" th:field="*{ruleName}" class="form-control" type="text" maxlength="100" required>
                    </div>
                </div>
            </div>
            <div class="col-xs-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">编码前缀：</label>
                    <div class="col-sm-8">
                        <input name="codePrefix" th:field="*{codePrefix}" class="form-control" type="text" maxlength="20">
                    </div>
                </div>
            </div>
            <div class="col-xs-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label is-required">日期格式：</label>
                    <div class="col-sm-8">
                        <input name="dateFormat" th:field="*{dateFormat}" class="form-control" type="text" maxlength="20" required>
                    </div>
                </div>
            </div>
            <div class="col-xs-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label is-required">流水号长度：</label>
                    <div class="col-sm-8">
                        <input name="serialLength" th:field="*{serialLength}" class="form-control" type="number" min="1" max="10" required>
                    </div>
                </div>
            </div>
            <div class="col-xs-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">当前流水号：</label>
                    <div class="col-sm-8">
                        <p class="form-control-static" th:text="*{currentSerial}"></p>
                    </div>
                </div>
            </div>
            <div class="col-xs-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label is-required">重置周期：</label>
                    <div class="col-sm-8">
                        <select name="resetCycle" class="form-control" th:with="type=${@dict.getType('ams_code_reset_cycle')}" required>
                            <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{resetCycle}"></option>
                        </select>
                    </div>
                </div>
            </div>
            <div class="col-xs-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">上次流水键：</label>
                    <div class="col-sm-8">
                        <p class="form-control-static" th:text="*{lastSerialKey}"></p>
                    </div>
                </div>
            </div>
            <div class="col-xs-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label is-required">启用状态：</label>
                    <div class="col-sm-8">
                        <div class="radio-box" th:each="dict : ${@dict.getType('ams_enabled_status')}">
                            <input type="radio" th:id="${'enabled_' + dict.dictCode}" name="enabled" th:value="${dict.dictValue}" th:field="*{enabled}" required>
                            <label th:for="${'enabled_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
                        </div>
                    </div>
                </div>
            </div>
            <div class="col-xs-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">备注：</label>
                    <div class="col-sm-8">
                        <textarea name="remark" class="form-control">[[*{remark}]]</textarea>
                    </div>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "system/rule";
        $("#form-rule-edit").validate({
            focusCleanup: true
        });

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