<!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-words-edit" th:object="${trsPolicyWords}">
            <input name="id" th:field="*{id}" type="hidden">
            <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="wrongWord" th:field="*{wrongWord}" 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">错误规则：</label>
                    <div class="col-sm-8">
                        <input name="errorRule" th:field="*{errorRule}" class="form-control" type="text">
                    </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">
                        <select name="errorType" class="form-control" th:with="type=${@dict.getType('trs_policy_error_type')}">
                            <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{errorType}"></option>
                        </select>
                    </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">
                        <select name="errorGrade" class="form-control" th:with="type=${@dict.getType('trs_error_grade')}">
                            <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{errorGrade}"></option>
                        </select>
                    </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="accord" th:field="*{accord}" class="form-control" type="text" >
                    </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="source" th:field="*{source}" class="form-control" type="text" >
                    </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="linkurl" th:field="*{linkurl}" class="form-control" type="text" >
                    </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 type="text"
                               th:value="${trsPolicyWords.effectstart != null} ? ${#dates.format(trsPolicyWords.effectstart, 'yyyy-MM-dd')} : ''"
                               class="time-input"
                               placeholder="yyyy-MM-dd"
                               name="effectstart"/>
                    </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 type="text"
                               th:value="${trsPolicyWords.effectend != null} ? ${#dates.format(trsPolicyWords.effectend, 'yyyy-MM-dd')} : ''"
                               class="time-input"
                               placeholder="yyyy-MM-dd"
                               name="effectend"/>
                    </div>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "project/words";
        $("#form-words-edit").validate({
            focusCleanup: true
        });

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