<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@include file="/WEB-INF/jsp/common/taglibs.jspf"%>
<div class="modal-dialog" style="width: 860px;"><!-- BEGIN modal-dialog -->
    <div class="modal-content"><!-- BEGIN modal-content -->
        <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal">&times;</button>
            <h4 class="modal-title">修改短信设置</h4>
        </div>
        <form action="system/sms/smsSetUpdate.do" id="form_sms_tables" method="post"><!-- BEGIN FORM -->
            <input name="smsId" id="smsId" type="hidden" value="${sysSms.smsId}">
            <div class="modal-body">
                <div class="row form-group">
                    <div class="col-sm-2">
                        <label class="span">状态</label>
                    </div>
                    <div class="col-sm-4">
                        <select id="smsEnable" name="enable">
                            <option value="1" <c:if test="${1 eq sysSms.enable}">selected="true"</c:if>>启用</option>
                            <option value="0" <c:if test="${0 eq sysSms.enable}">selected="true"</c:if>>停用</option>
                        </select>
                    </div>
                </div>
                <div class="row form-group">
                    <div class="col-sm-2">
                        <label class="span">短信内容</label>
                    </div>
                    <div class="col-sm-4">
                        <input name="content" id="smsContent" type="text" class="form-control" placeholder="请输入短信内容" value="${sysSms.content}">
                    </div>
                </div>
                <div class="row form-group">
                    <div class="col-sm-2">
                        <label class="span">备注</label>
                    </div>
                    <div class="col-sm-4">
                        <input name="memo" id="smsMemo" type="text" class="form-control" placeholder="请输入备注" value="${sysSms.memo}">
                    </div>
                </div>
            </div>
            <div class="modal-footer clearfix">
                <button type="button" class="btn btn-danger" data-dismiss="modal"><i class="fa fa-times"></i>取消</button>
                <button type="submit" class="btn btn-primary pull-left"><i class="fa fa-envelope"></i>确定</button>
            </div>
        </form><!-- END FORM -->
    </div><!-- END modal-content -->
</div><!-- END modal-dialog -->
<script type="text/javascript">
    $(function() {
        // 验证表单
        var form = $('#form_sms_tables');

        form.validate({
            errorElement: 'span',errorClass: 'help-inline',focusInvalid: false,ignore: "",
            rules: {smsEnable:{required: true},//用户名称
                smsContent: {required: true,maxlength:300},// 用户登录名称
                smsMemo:{required: true,maxlength:50}
            },
            messages:{smsEnable:{required: "请选择短信设置状态!"},
                smsContent:{required:"请输入短信内容!", maxlength:"短信内容最大长度为300"},
                smsMemo: {maxlength: "备注不能大于50个字符"}
            },
            highlight: function (element) {
                $(element).closest('.help-inline').removeClass('ok');
                $(element).closest('.control-group').removeClass('success').addClass('error');
            },
            unhighlight: function (element) {
                $(element).closest('.control-group').removeClass('error');
            },
            submitHandler: function (form) {
                form.submit();
            }
        });
    });
</script>