<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> 
</head>
<style>
	.tablelink{margin-right:10px;}
	.stylecss{
	      color: red;
	}
</style>
<body>
<div class="rightinfo">
	<form id="seachform" th:action="@{/sys/bookList/selectMaterielList.html}" method="post">
		<input type="hidden" id="divIndex" name="divIndex" th:value="${search.get('divIndex')}">
	<ul class="seachform">
		<li>
			<label>物料名称</label>
			<input name="name" type="text" class="scinput" th:value="${search.get('name')} == null  ? '': ${search.get('name')}"/>
		</li>

		<li>
			<label>&nbsp;</label>
			<input type="button" class="scbtn" value="查询" />
		</li>
		<li>
				<ul class="toolbar">
					<li class="click"><span><img style="width: 24px;height: 24px" th:src="@{/static/sys/images/select.png}" /></span>选择</li>
				</ul>
		</li>
		
	</ul>
	</form>
	<table class="tablelist">
		<thead>
		    <tr>
		        <th></th>
		        <th style="width: 50px;">序号</th>
		        <th>物料编码</th>
		        <th>物料名称</th>
		        <th>物料规格</th>
		    </tr>
		</thead>
		<tbody>
			<tr th:each="item:${list}" >
				    <td><input name="selectlist" type="radio" th:data-id="${item.id}" /></td>
				    <td th:text="${itemStat.count}" ></td>
					<td th:text="${item.code}" class="code" ></td>
					<td th:text="${item.name}" class="name" ></td>
					<td th:text="${item.aliases}"></td>
			</tr>
		</tbody>
	</table>
	<!-- 分页 -->
	<div class="pagin">
    	<div class="message">共<i class="blue">[[${page.rowCnt}]]</i>条记录，当前显示第&nbsp;<i class="blue">[[${page.pageNo }]]&nbsp;</i>页</div>
    	<div th:utext='${listNavigatHtml}' th:remove="tag" ></div>
   	</div>
</div>
</body>
<script type="text/javascript">
$(function(){
	$('ul.toolbar li.click').click(function () {
	    var selectIds=[];
		 $('[name=selectlist]:radio:checked').each(function() {
				 var id = $(this).attr('data-id');
				 var code= $(this).parent().siblings(".code").html();
			 	 var name= $(this).parent().siblings(".name").html();
			 	 var index = $("#divIndex").val();
				 $('#findDiv', parent.document).find('.templatediv').eq(index).find('input[name=materielCode]').first().val(code);
				 $('#findDiv', parent.document).find('.templatediv').eq(index).find('input[name=materielName]').first().val(name);
				 selectIds.push(id);
		 });
		closeWin();
	 });
	$('[name=selectlist]:radio').change(function () {
		$(this).checked = !$(this).checked;
	 });
	
})
function closeWin(){
	//parent.location.reload();
	parent.layer.close(parent.layer.getFrameIndex(window.name));
}

</script>
</html>