<#include "/common/defaultEngine.html"/>
<@pageTheme mark="${config.optimize()?string('true', 'false')}">
<@header title="修改公告" bodyClass="white-bg" libs=["ueditor","bootstrapSelect"]/>
<div class="wrapper wrapper-content ibox-content">
<@f.form id="form-notice-edit" class="form-horizontal">
    <@f.hidden id="id" name="id"  value="${notice.id}"/>
    <@f.hidden id="htmlNo"  name="htmlNo" value="${notice.htmlNo}"/>
    <div class="alert alert-dismissible callout callout-info animated bounceInDown">
        <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
        <p><i class="icon fa fa-info"></i><strong>重要提示:</strong>如果选择发布公告,等级是<u>严重</u>才会在登陆页面Top提示,等级是<u>紧急</u>只在登陆之后Top提示,等级是<u>普通</u>则在Top提醒栏提示!</p>
    </div>
    <h4 class="form-header h4">基本信息</h4>
    <div class="row">
        <div class="col-sm-6">
            <div class="form-group">
                <label class="col-sm-4 control-label"><span style="color: red; ">*</span>公告标题：</label>
                <div class="col-sm-8">
                    <@f.input name="noticeTitle" value="${notice.noticeTitle}" placeholder="请输入公告标题" required=true/>
                </div>
            </div>
        </div>
        <div class="col-sm-6">
            <div class="form-group">
                <label class="col-sm-4 control-label"><span style="color: red; ">*</span>公告类型：</label>
                <div class="col-sm-8">
                    <@f.select name="noticeType" value="${notice.noticeType}" dictType="sys_notice_type" required=true/>
                </div>
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-sm-6">
            <div class="form-group">
                <label class="col-sm-4 control-label">提示标题：</label>
                <div class="col-sm-8">
                    <@f.input name="noticeTipTitle" value="${notice.noticeTipTitle}" maxlength="100" placeholder="提示标题" required=true/>
                </div>
            </div>
        </div>
        <div class="col-sm-6">
            <div class="form-group">
                <label class="col-sm-4 control-label"><span style="color: red; ">*</span>等级：</label>
                <div class="col-sm-8">
                    <@f.select name="noticeLevel" value="${notice.noticeLevel}" dictType="sys_notice_level" required=true/>
                </div>
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-sm-6">
            <div class="form-group">
                <label class="col-sm-4 control-label"><span style="color: red; ">*</span>有效时长：</label>
                <div class="col-sm-8">
                    <div class="time-label">
                        <input type="text" class="time-input" id="startTime" placeholder="发布时间" value="${notice.startTime?string('yyyy-MM-dd HH:mm:ss')}" name="startTime" data-type="datetime" data-format="yyyy-MM-dd HH:mm:ss"/>
                        <span>-</span>
                        <input type="text" class="time-input" id="endTime" placeholder="结束时间" value="${notice.endTime?string('yyyy-MM-dd HH:mm:ss')}" name="endTime" data-type="datetime" data-format="yyyy-MM-dd HH:mm:ss" required/>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <h4 class="form-header h4">公告内容</h4>
    <div class="row">
        <div class="col-sm-12">
            <div class="form-group">
                <div class="col-sm-12">
                    <@f.ueditor name="noticeContent" value="${notice.noticeContent?html}"/>
                </div>
            </div>
        </div>
    </div>
</@f.form>
    <div class="hr-line-dashed"></div>
    <div class="row" id="_addTab">
        <div class="col-sm-offset-5 col-sm-10">
            <button type="button" class="btn btn-sm btn-primary" onclick="opt.form.submit()"><i class="fa fa-check"></i><@ctx.i18n text = "保存"/></button>&nbsp;
            <button type="button" class="btn btn-sm btn-danger" onclick="opt.modal.closeTab()"><i class="fa fa-reply-all"></i><@ctx.i18n text = "关闭"/></button>
        </div>
    </div>
</div>
    <@footer>
        <script>
            var prefix = baseURL + "sys/notice";

            $("#form-notice-edit").validate({
                onkeyup: false,
                rules:{
                    startTime:{
                        required: true
                    },
                    endTime: {
                        required: true,
                        compareDate: "#startTime"
                    }
                },
                messages: {
                    "startTime":{
                        required: "开始时间不能为空"
                    },
                    "endTime":{
                        required: "结束时间不能为空",
                        compareDate: "结束日期选择错误!"
                    }
                },
                focusCleanup: true
            });

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