<html xmlns:th="http://www.thymeleaf.org">
<head>
<title>朗读者</title>
<script th:include="sys/common/metaCSS" th:remove="tag"></script> 
<script th:include="sys/common/metaJS" th:remove="tag"></script> 
<script src="sys/js/jquery.validate.min.js" th:src="@{/static/sys/js/jquery.validate.min.js}"></script>
<script src="sys/js/jquery-validation/messages_zh.js" th:src="@{/static/sys/js/jquery-validation/messages_zh.js}"></script>
<script src="sys/js/My97DatePicker/WdatePicker.js" th:src="@{/static/sys/js/My97DatePicker/WdatePicker.js}"></script>
 <style>
    	.clearfix:after {
			visibility: hidden;
			display: block;
			font-size: 0;
			content: " ";
			clear: both;
			height: 0;
		}
		.clearfix { display: inline-table; }
		* html .clearfix { height: 1%; }
		.clearfix { display: block; }
		.fl{display:inline;float:left}
		clearfix >control-label-error{display:inline;float:left;marign-left:10px}
		 label.control-label-error {
  				color: Red;
             }
             .lispan {line-height: 34px;}
    </style>
</head>

<body>
<div class="place">
    <span>位置：</span>
    <ul class="placeul">
    	<li><a href="#">系统管理</a></li>
    	<li><a href="#">图书管理</a></li>
    </ul>
</div>
<div class="formbody">
	<div class="formtitle"><span>新增图书</span></div>
	<form id="roleFrom"   method="post" class="form-horizontal form-validate">
		<input  type="hidden" id="id"  th:value="${jxy.id}" name="id">
		<ul class="forminfo">
			<li class="clearfix" >
					<label>图书isbn编号:<b>*</b></label> 
					 <div   onclick="window.open('../jxy/jxyliblist.html', 'newwindow', 'height=530, width=1100, top=200, left=250, toolbar=no, menubar=no, scrollbars=yes, resizable=no,location=no, status=no');" style="margin-right: 5px; width: 346px">
					    <input type="text" id="isbn13" style="width: 180px; " th:value="${isbn13}" disabled="disabled" class="dfinput" >
					   </div>
				     <input type="hidden" id="isbn" name="isbn13" th:value="${jxy.isbn13}"/>
			</li>
			<li class="clearfix" >
					<label>图书:<b>*</b></label> 
					 <div   onclick="window.open('../jxy/jxyliblist.html', 'newwindow', 'height=530, width=1100, top=200, left=250, toolbar=no, menubar=no, scrollbars=yes, resizable=no,location=no, status=no');" style="margin-right: 5px; width: 346px">
					    <input type="text" id="name" style="width: 180px; " th:value="${name}" disabled="disabled" class="dfinput" >
					   </div>
				     <input type="hidden" id="namea" name="name" th:value="${jxy.name}"/>
			</li>
			<li class="clearfix">
				<label class="fl">标题<b>*</b></label>
				  <input  type="text" id="title"  th:value="${jxy.title}" class="dfinput fl"  name="title">
			</li>
			<li class="clearfix">
				<label class="fl">预计阅读时间<b>*</b></label>
				  <input  type="text" id="needTime"  th:value="${jxy.needTime}" class="dfinput fl"  name="needTime">
			</li>
			<li class="clearfix">
				<label class="fl">副标题<b>*</b></label>
				  <input  type="text" id="subTitle"  th:value="${jxy.subTitle}" class="dfinput fl"  name="subTitle">
			</li>
			<li>
				<label>&nbsp;</label>
				<button type="submit" class="btn">保存</button>
				<button type="button" class="btn" onclick="window.history.go(-1);">取消</button>
			</li>
		</ul>
	</form>
</div>
</body>
<script type="text/javascript">

$(function(){
	$("#roleFrom").validate({
		rules : {
			isbn13 : {
				required : true
			},
			title : {
		        required : true
	         },
	         needTime : {
			    required : true
		     
			  }
			},
		messages: {
			isbn13 : {
				required : "请输图书编号"
			},
			title : {
		        required : "请输入标题"
	         },
	         needTime : {
			    required : "请输入预计阅读时长"
		     
		    
		     }	
		   },
		errorPlacement : function(error, element) {
				error.appendTo(element.parent()); 
		},
		submitHandler : function(form) {
			roleFrom();
		}
	});
	
});
function roleFrom(){
	var url="[[${sysUrl}]]/sys/jxy/saveJxy";
	var params = $("#roleFrom").serialize();
	$.post(url,params,function(data){
		if(data != null){
			if(data.code=="999"){
					layer.msg("操作成功!",{icon:1});
			    	setTimeout(function(){
			    		window.location.href ='[[${sysUrl}]]/sys/jxy/jxylist.html';
					},1000);
				}else{
					layer.msg(data.meta.message,{icon:11});
				}
		}
		
	});
}
</script>
</html>