<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>添加用户</title>
<%@include file="/views/common.jsp"%>
<style>
.layui-form-select .layui-edge{
	right:40px;
}
.aaa{
	margin-left:140px;
	margin-top:140px
}
</style>
</head>
<body>
	<div class="layui-input-block layui-form" lay-filter="addUser"
		style="margin-top: 30px">
		<form class="layui-form " action="">
			<div class="layui-form-item">
				<label class="layui-form-label">生日</label>
				<div class="layui-input-inline">
					<input type="text" class="layui-input" name="birthDay" id="birthDay" autocomplete="off" placeholder="MM-dd" lay-verify="required">
				</div>
				<label class="layui-form-label">新历/农历</label>
				<div class="layui-input-inline">
					<select name="birthType" lay-verify="required">
						<option value=""></option>
						<option value="0">农历</option>
						<option value="1">新历</option>
					</select>
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">入职日期</label>
				<div class="layui-input-inline">
					<input type="text" class="layui-input" name="entryDate" id="entryDate" autocomplete="off" placeholder="yyyy-MM-dd" lay-verify="required">
				</div>
				<div class="layui-form-mid layui-word-aux">新历</div>
			</div>

			<div class="layui-form-item aaa">
				<div class="layui-input-block">
					<button class="layui-btn" lay-submit="" lay-filter="enadd">确认修改</button>
				</div>
			</div>
		</form>
	</div>
	<script type="text/javascript">
		layui.use([ 'table', 'laydate', 'form','layer'], function() {
			var $ = layui.jquery;
			var table = layui.table;
			var laydate = layui.laydate;
			var form = layui.form;
			var layer = layui.layer;
			
			//自定义格式
			laydate.render({
			    elem: '#birthDay',
			    format: 'MM-dd',
			    trigger: 'click'
			});
			laydate.render({
			    elem: '#entryDate',
			    format: 'yyyy-MM-dd',
			    trigger: 'click'
			});
			
			form.on('submit(enadd)',function(data){
				$.ajax({
					url:'${path}/addBirthDay',
					dataType : 'json',
					data:$(data.form).serialize(),
					type : 'post',
					success:function(data){
						if (data.code == 200) {
							layer.msg('修改成功！',{icon:6,offset:"auto",time:2000});//提示框
						}else  {
							layer.msg('修改失败！',{icon:5,offset:"auto",time:2000});//提示框
						}
						setTimeout(function(){
							var index = parent.layer.getFrameIndex(window.name);//获取窗口索引
							parent.layer.close(index);//关闭弹出层
						}, 2100);
					}
				})
				return false;
			});
		})
	</script>
</body>
</html>