<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>
    	.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;}   
          
          .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;
    	}
    </style>
</head>

<body>
<div class="place">
	<span>位置：</span>
	<ul class="placeul">
		<li><a href="#">图书馆管理</a></li>
		<li><a th:href="@{/sys/lib/libBookInfoList.html}">添加图书题目</a></li>
	</ul>
</div>
<div class="formbody">
	<div class="formtitle"><span >添加图书题目</span></div>
	<form id="submitFrom" action="/sys/lib/saveLibBookInfoSubject"  method="post" class="form-horizontal form-validate">
		     <input type="hidden" name="isbn13_t" th:if="${info.isbn13}" th:value="${info.isbn13}"/>
		     <input type="hidden" name="bookid"  th:value="${info.id}"/>
		     <input type="hidden" name="libId_t"  th:value="${info.libId}"/>
		<ul class="forminfo">
			<li class="clearfix">
				<label>图书名称:<b>*</b></label>
				<input type="text"  class="dfinput fl"  th:value="${info.title}"/>
			</li>
			 <li class="clearfix">
			    <label>本书题目级别：<b>*</b></label>
				<div class="vocation" style="margin-right: 5px; width: 346px">
					<select class="select1" name="level_t" th:if="${subjects==null || subjects.size()<=0}">
					   	<option value="1" selected="selected">初级</option>
					   	<option value="2">中级</option>
					   	<option value="3">高级</option>
					</select>
					<select class="select1" name="level_t" th:if="${subjects!=null && subjects.size()>0}">
					   	<option value="1" th:selected="${subjects.get(0).level==1 ? 'true' : 'false'}">初级</option>
					   	<option value="2" th:selected="${subjects.get(0).level==2 ? 'true' : 'false'}">中级</option>
					   	<option value="3" th:selected="${subjects.get(0).level==3 ? 'true' : 'false'}">高级</option>
					</select>
				</div>
		   </li>
		   <div th:each="item:${subjects}">
				<li class="clearfix">
					<label>题目:<b>*</b></label>
					<input type="hidden" id="author" class="dfinput fl" name="ids" th:value="${item.id}"  />
					<input type="text" id="author" class="dfinput fl" name="titles" th:value="${item.title}"  />
					<label style="color:red;width: 150px">严格输入的数据格式:</label>
					<label style="color:red;width: 400px" > 1+1=？</label>
				</li>
				<li class="clearfix">
					<label>答案选择:<b>*</b></label>
					<input type="text" id="price" class="dfinput fl" name="answers" th:value="${item.answer}" />
					<label style="color:red;width: 150px">严格输入的数据格式:</label>
					<label style="color:red;width: 400px" >[{"A":"1"},{"B":"2"},{"C":"3"},{"D":"4"}] </label>
				</li>
				<li class="clearfix"  >
					<label>正确答案:<b>*</b></label>
					<input type="text" id="price" class="dfinput fl" name="correctAnswers" th:value="${item.correct_answer}"  />
						<label style="color:red;width: 150px">严格输入的数据格式:</label>
					<label style="color:red;width: 400px" >B </label>
				</li>
				<li class="clearfix"  ><label style="width: 100%">&nbsp;</label></li>
			</div>
			
			
			
			<li style="color:red" class="clearfix"  id="addSubject" >
				<label>继续添加题目>></label>
			</li>
			
			
			<li>
				<label>&nbsp;</label>
				<button type="submit" id="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 (){
		
		$("#addSubject").click(function (){
			var html=[];
			html.push('<li class="clearfix">');
			html.push('<label>题目:<b></b></label>');
			html.push('<input type="hidden"  class="dfinput fl" name="ids"   />');
			html.push('<input type="text"  class="dfinput fl" name="titles"   />');
			html.push('</li>');
			html.push('<li class="clearfix">');
			html.push('<label>答案选择:<b></b></label>');
			html.push('<input type="text" class="dfinput fl" name="answers"  />');
			html.push('</li>');
			html.push('<li class="clearfix" >');
			html.push('<label>正确答案:<b></b></label>');
			html.push('<input type="text"  class="dfinput fl" name="correctAnswers"   />');
			html.push('</li><li class="clearfix"  ><label style="width: 100%">&nbsp;</label></li>');
			$(this).before(html.join(''));
			
		});
		
	})
	


</script>


</html>