<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%
	response.setHeader("Pragma", "No-cache");
	response.setHeader("Cache-Control", "no-cache");
	response.setDateHeader("Expires", -10);
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"	+ request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<%@include file="/WEB-INF/views/base.jsp"%>
<!DOCTYPE html>
<html>

<head>

<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>addSmsUser</title>

<link href="${cssPath }/bootstrap.min.css" rel="stylesheet">
<link href="${fontAwsPath }/css/font-awesome.css" rel="stylesheet">

<!-- Data Tables -->
<link href="${cssPath }/plugins/dataTables/dataTables.bootstrap.css"
	rel="stylesheet">
<link href="${cssPath }/plugins/dataTables/dataTables.responsive.css"
	rel="stylesheet">
<link
	href="${cssPath }/plugins/dataTables/dataTables.tableTools.min.css"
	rel="stylesheet">

<link href="${cssPath }/animate.css" rel="stylesheet">
<link href="${cssPath }/style.css" rel="stylesheet">

</head>

<body>

	<div id="wrapper">

		<jsp:include page="../menu.jsp"></jsp:include>

		<div id="page-wrapper" class="gray-bg">
			<jsp:include page="../head.jsp"></jsp:include>
			<jsp:include page="../pageNav.jsp"></jsp:include>
			<!-- 页面 主题内容  开始-->
	        <div class="wrapper wrapper-content animated fadeInRight">
	        <div class="row">
	        	<!-- row开始 -->
	           <div class="row">
                	<div class="col-lg-12">
	                    <div class="ibox float-e-margins">
	                        <div class="ibox-title">
	                            <h5>添加信息</h5>
	                        </div>
	                        <div class="ibox-content">
	                        	<form:form id="form" modelAttribute="smsUser" onsubmit="return check()"
	                        	class="form-horizontal" action="${pageContext.request.contextPath}/sms/addSmsUser" method="post">
									
									<div class="form-group">
											<label class="col-sm-2 control-label">部门(分组)</label>
											<div class="col-md-10">
												<select id="classify"  name="classify" class="form-control">
													<option selected="selected" value="">请选择</option>
													<c:forEach items="${constList}" var="s">
														<option value="${s.dictvalue }">${s.dictname }</option>
													</c:forEach>
												</select>
												<label id="classify_se"  style="display:none;color: #cc5965;margin-left: 5px;margin-top: 5px;" >请选择所属部门</label>
											</div>
										</div>
									
									<div class="form-group">
										<label class="col-sm-2 control-label">姓名</label>
										<div class="col-md-10">
											<form:input class="form-control" path="name" autocomplete="off"  required="" />
										</div>
									</div>
									<div class="form-group">
										<label class="col-sm-2 control-label">电话号码</label>
										<div class="col-md-10">
											<form:input class="form-control" id="phoen" path="phoen" autocomplete="off" maxlength="11" required="" />
											<form:errors path="phoen" class="field-has-error"></form:errors> 
											<label id="phoen_err"  style="display:none;color: #cc5965;margin-left: 5px;margin-top: 5px;" >输入的手机号码格式有误</label>
										</div>
									</div>
										
									<div class="form-group">
	                                    <div class="col-sm-4 col-sm-offset-2">
	                                        <button onclick="history.go(-1)" class="btn btn-warning" type="button"><i class="fa fa-mail-forward"></i>&nbsp;&nbsp;返回</button>
	                                        <button class="btn btn-primary" type="submit"><i class="fa fa-save"></i>&nbsp;&nbsp;保存</button>
	                                    </div>
	                                </div>
								</form:form>
	                        </div>
	                    </div>
                	</div>
            	</div>
	            <!-- row结束 -->	
	        </div>    
	        </div>
	        <!-- 页面主题内容 结束 -->


		</div>
	</div>


<%@include file="/WEB-INF/views/common_base_script.jsp"%>
	
<script type="text/javascript">
		$(function(){
			//前台js验证
			var ruleObj = {name:{required:true},phoen:{required:true}};
			var messageObj = {name:{required:"请输入姓名"}, phoen:{required:"请输入电话号码"}};
		    CommonUtils.formValidate("form", ruleObj, messageObj);
			
		})
		
		function check() {
			var classify = $("#classify").val();
			if (classify == "") {
				$("#classify_se").show();
				return false;
			} else {
				$("#classify_se").hide();
			}
			
			var tel = $("#phoen").val();
			var partten = /^(\+?0?86\-?)?1[345789]\d{9}$/;
		 	if (!partten.test(tel) || tel.length < 11) {
              	$("#phoen_err").show();
              	return false;
            }else{
            	$("#phoen_err").hide();
            }
		}
		
</script>
</body>

</html>
