<!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-template-edit" th:object="${riskTemplate}">
        <input id="templateId" name="templateId" th:field="*{templateId}" type="hidden">
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">模板名称：</label>
            <div class="col-sm-8">
                <input id="templateName" name="templateName" th:field="*{templateName}" class="form-control" type="text" required>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">模板类型：</label>
            <div class="col-sm-8">
                <select name="templateType" class="form-control m-b" th:field="*{templateType}">
                    <option value="1">尽调模板</option>
                    <option value="2">评估模板</option>
                    <option value="3">风控清单</option>
                    <option value="4">标准函件</option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">版本号：</label>
            <div class="col-sm-8">
                <input id="versionNo" name="versionNo" th:field="*{versionNo}" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">适用场景：</label>
            <div class="col-sm-8">
                <input id="applicableScene" name="applicableScene" th:field="*{applicableScene}" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">维护人：</label>
            <div class="col-sm-8">
                <input id="maintainer" name="maintainer" th:field="*{maintainer}" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">模板状态：</label>
            <div class="col-sm-8">
                <select name="templateStatus" class="form-control m-b" th:field="*{templateStatus}">
                    <option value="0">草稿</option>
                    <option value="1">已发布</option>
                    <option value="2">停用</option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">发布时间：</label>
            <div class="col-sm-8">
                <input id="publishTime" name="publishTime" class="form-control" type="text" placeholder="yyyy-MM-dd"
                    th:value="${riskTemplate.publishTime != null ? #dates.format(riskTemplate.publishTime, 'yyyy-MM-dd') : ''}">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">备注：</label>
            <div class="col-sm-8">
                <textarea name="remark" class="form-control" th:field="*{remark}"></textarea>
            </div>
        </div>
    </form>
</div>
<th:block th:include="include :: footer" />
<script type="text/javascript">
    var prefix = ctx + "risk/template";

    $("#form-template-edit").validate({
        focusCleanup: true
    });

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