<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;}
</style>
<body>
<div class="rightinfo">
	<form id="seachform" th:action="@{/sys/problem/checklist.html}" method="post">
	 <input type="hidden" id="libId" name="libId" th:value="${search.get('libId')}"/>
	 <input type="hidden" id="type" name="type" th:value="${search.get('type')}"/>
	<ul class="seachform">
		<li>
			<label>孩子姓名</label>
			<input name="child_name" type="text" class="scinput" th:value="${search.get('child_name')}"/>
			
		</li>
		<li>
			<label>&nbsp;</label>
			<input type="button" class="scbtn" value="查询" />
		</li>
		<li>
				<ul class="toolbar">
					<li th:if="${search.get('type') eq '1' }" class="click"><span><img style="width: 24px;height: 24px" th:src="@{/static/sys/images/select.png}" /></span>签到</li>
					<li th:if="${search.get('type') eq '2' }" class="click"><span><img style="width: 24px;height: 24px" th:src="@{/static/sys/images/select.png}" /></span>签离</li>
				</ul>
		</li>
		<li>
				<ul class="toolbar">
					<a th:href="@{/sys/lib/libJoinList.html}"><li class="clic"><span><img style="width: 24px;height: 24px" th:src="@{/static/sys/images/goto.png}" /></span>返回</li></a>
				</ul>
		</li>
	</ul>
	</form>
	<table class="tablelist">
		<thead>
		    <tr>
		        <th style="width: 50px;"><input name="checkboxlist" type="checkbox"/></th>
		        <th>孩子姓名</th>
		        <th>家长姓名</th>
		        <th>头像</th>
		        <th>学校</th>
		        <th>年级</th>
		    </tr>
		</thead>
		<tbody>
			<tr th:each="item:${list}" >
				<td> <input name="selectlist" type="checkbox" th:data-id="${item.get('id')}" /> </td>
				<td th:text="${item.get('child_name')}"></td>
				<td th:text="${item.get('parent_name')}"></td>
				<td  class="imgtd">
							<img  th:if="${item.get('img_url')}!=null" th:src="${imgUrl}+''+${item.get('img_url')}" style="width: 50px;height: 50px;" />
					</td>
				<td th:text="${item.get('school')}" ></td>
				<td th:text="${item.get('grade')}"></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(){
	// checkNode();
	 $('[name=checkboxlist]').click(function() {
         checkAll();
     });
})
function checkAll(){
	$.each($('[name=selectlist]'), function () {
		   if($(this).prop('checked')){
			  $(this).prop('checked', false);
		   }else{
			   $(this).prop('checked', true);
		   } 
   });
	
}

$('ul.toolbar li.click').click(function () {
	var selectIds=[];
	 $.each($('[name=selectlist]'), function () {
		 if ($(this).prop('checked')) {
		 var id = $(this).attr('data-id');
		 selectIds.push(id);
		 }
    });
	 if(selectIds.length==0){
		 selectIds.push('');
	 }
	 var url="[[${sysUrl}]]/sys/problem/savesub";
	 var params ={
	            id : $("#id").val(),
	            vipIds : selectIds,
	            type:"[[${search.get('type')}]]",
	            libId:"[[${search.get('libId')}]]"
	        };
	$.post(url,params,function(data){
		if(data.meta.success){
			parent.layer.msg('操作成功',{icon:1});
			location.reload();
		}else{
			parent.layer.msg('操作失败',{icon: 9});
		}
	});
	
});



</script>
</html>