<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>

 <style>
   body{min-width:180px;}
       .select1{
   		    width:100%;
		    height: 32px;
		    line-height: 32px;
		    border-top: solid 1px #a7b5bc;
		    border-left: solid 1px #a7b5bc;
		    border-right: solid 1px #ced9df;
		    border-bottom: solid 1px #ced9df;
		    opacity:1;
	        margin-bottom: 10px;
    	}
    	.btn{
    	  width: 100px;
    	}
     label.control-label-error {color: Red;}	
    </style>
</head>

<body>
<div class="formbody">
 <input type="hidden" name="" id="" th:value="${how.type}"/>
	<form id="submitFrom"   method="post" class="form-horizontal form-validate">
		     <input type="hidden" name="libId" id="libId" th:value="${how.libId}"/>
		     <input type="hidden" name="howId" id="howId" th:value="${how.howId}"/>
		     <input type="hidden" name="stat" id="stat" th:value="${how.stat}"/>
		     <input type="hidden" name="courseName" id="courseName" th:value="${how.courseName}"/>
		     <input type="hidden" name="id" id="id" th:if="${how.id}"  th:value="${how.id}"/>、
		     
		<ul class="forminfo">
			   	<li class="clearfix">
				    <label>教程版本：<b>*</b></label>
						<div class="vocation_version" style="margin-right: 5px; width: 646px">
						
								<label th:each="version:${versions[how.courseName] }"  ><input type="radio" class="version" name="type" th:checked="${ how.type == version.versionType }"   th:value="${version.versionType }" />[[${version.versionName}]]</label>
							

<!-- 						    <label th:if="${how.courseName eq '数学'}"><input type="radio" class="version" name="type" th:checked="${ how.type eq 1  }"  value="1" />北师大</label> -->
<!-- 							<label th:if="${how.courseName eq '数学'}"><input type="radio" class="version" name="type"  th:checked="${ how.type eq 2 }"  value="2" />人教版</label> -->
<!-- 							<label th:if="${how.courseName eq '数学'}"><input type="radio" class="version" name="type"  th:checked="${ how.type eq 5 }"  value="5" />江苏版</label> -->
<!-- 							<label th:if="${how.courseName eq '数学'}"><input type="radio" class="version" name="type"  th:checked="${ how.type eq 6 }"  value="6" />思维拓展</label> -->
							
<!-- 							<label th:if="${how.courseName eq '语文'}"><input type="radio" class="version" name="type"  th:checked="${ how.type eq 2 }"  value="2" />人教(部编)</label> -->
							
							
<!-- 							<label th:if="${how.courseName eq '英语'}"><input type="radio" class="version" name="type"  th:checked="${ how.type eq 2 }"  value="2" />教科版</label> -->
<!-- 							<label th:if="${how.courseName eq '英语'}"><input type="radio" class="version" name="type"  th:checked="${ how.type eq 3 }"  value="3" />沪教版（新）</label> -->
<!-- 							<label th:if="${how.courseName eq '英语'}"><input type="radio" class="version" name="type"  th:checked="${ how.type eq 7 }"  value="7" />朗文版</label> -->
<!-- 							<label th:if="${how.courseName eq '英语'}"><input type="radio" class="version" name="type"  th:checked="${ how.type eq 8 }"  value="8" />人教版（PEP）</label> -->
<!-- 						<label th:if="${how.courseName eq '英语'}"><input type="radio" class="version" name="type"  th:checked="${ how.type eq 9 }"  value="9" />牛津版</label> -->
					
						</div>
			   </li>
			   <li class="clearfix">
				    <label>年级：<b>*</b></label>
					<div class="vocation" style="margin-right: 5px; width: 300px">
						<select class="select1" name="gradeNum">
						   		 <option th:value="${list.aliases}" th:selected="${ how.gradeNum+'' eq list.aliases }" 
						   		  th:if="${list.aliases ne '0'}"
						   		  th:each="list:${grade}" th:text="${list.name}">学前</option>
						</select>
					</div>
			   </li>
			   <li class="clearfix">
				    <label>学期：<b>*</b></label>
					<div class="vocation" style="margin-right: 5px; width: 346px">
					    <label><input type="radio" class="isZt" name="semester"  th:checked="${ how.semester eq 1 }"  value="1" />上学期</label>
						<label><input type="radio" class="isZt" name="semester"   th:checked="${ how.semester eq 2  }"  value="2" />下学期</label>
				    </div>
			   </li>
			  <li>
				<label >单元名称:<b>*</b></label>
				<input type="text" id="alias" class="dfinput fl" name="alias"  th:value="${how.alias}" />
			 </li>
			  <li>
				<label >单元序号:<b>*</b></label>
				<input type="number" id="num" class="dfinput fl" name="num"  th:value="${how.num}" />
			 </li>
				<li>
					<label>&nbsp;</label>
					<button type="submit" class="btn">保存</button>
					<button type="button" class="btn" onclick="closeWin();">取消</button>
				</li>
		</ul>
	</form>
</div>
</body>
<script type="text/javascript">

$(function(){
	$("#submitFrom").validate({
		rules : {
			
			type : {
				required : true
			}
		},
		messages: {
			type : {
				required : "教程版本不能为空"
			}
			
		},
		errorPlacement : function(error, element) {
				error.appendTo(element.parent()); 
		},
		submitHandler : function(form) {
			roleFrom();
		}
	});
	
	
});
function roleFrom(){
	var url="[[${sysUrl}]]/sys/zuoyb/knowHowDetailSortSave";
	var params = $("#submitFrom").serialize();
	$.post(url,params,function(data){
		if(data != null){
				if(data.meta.success){
					parent.layer.msg("新增成功",{icon:1});
					closeWin();
				}else{
					parent.layer.msg(data.meta.message,{icon:11});
					closeWin();
				}
		}
		
	});
}
function closeWin(){
	parent.location.reload();
	parent.layer.close(parent.layer.getFrameIndex(window.name));
}



</script>
</html>