<#include "/common/defaultEngine.html"/>
<@pageTheme mark="${config.optimize()?string('true', 'false')}">
<@header title="新增参数" bodyClass="white-bg"/>
<div class="wrapper wrapper-content ibox-content">
    <@f.form id="form-config-add" class="form-horizontal">
        <div class="form-group">
            <label class="col-sm-3 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "参数名称"/>：</label>
            <div class="col-sm-8">
                <@f.input name="paramName" required=true/>
            </div>
        </div>
        <div class="form-group">	
            <label class="col-sm-3 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "参数键名"/>：</label>
            <div class="col-sm-8">
<#--                <input id="paramKey" name="paramKey" class="form-control" type="text" required>-->
<#--                <span class="help-block m-b-none"><i class="fa fa-info-circle" style="color: red"></i></span>-->
                <@f.input name="paramKey" required=true/>
                <span class="help-block m-b-none"><i class="fa fa-info-circle" style="color: red"></i>统一规范:请务必使用大写字母下划线定义.页面获取,如: <#noparse>${config.getKey("SYS_KEY")}</#noparse></span>
            </div>
        </div>
        <div class="form-group">	
            <label class="col-sm-3 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "参数键值"/>：</label>
            <div class="col-sm-8">
                <@f.textarea name="paramValue" rows="10"  required=true/>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "系统内置"/>：</label>
            <div class="col-sm-8">
                <@f.radio name="configType" dictType="sys_yes_no"/>
            </div>
        </div>
		<div class="form-group">	
            <label class="col-sm-3 control-label"><@ctx.i18n text = "备注"/>：</label>
            <div class="col-sm-8">
                <@f.textarea name="remark"/>
            </div>
        </div>
        </@f.form>
</div>
<@footer>
<script>
    var prefix = baseURL + "sys/config";

    $("#form-config-add").validate({
        onkeyup: false,
        rules: {
            configKey: {
                remote: {
                    url: prefix + "/checkConfigKeyUnique",
                    type: "post",
                    dataType: "json",
                    data: {
                        "configKey": function() {
                            return opt.common.trim($("#configKey").val());
                        }
                    },
                    dataFilter: function(data, type) {
                        return opt.validate.unique(data);
                    }
                }
            },
        },
        messages: {
            "configKey": {
                remote: "参数键名已经存在"
            }
        },
        focusCleanup: true
    });

    function submitHandler() {
        if (opt.validate.form()) {
            opt.operate.save(prefix + "/add", $('#form-config-add').serialize());
        }
    }
</script>
</@footer>
</@pageTheme>
