<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;
	}
	.select_width{
	     width: 220px;
	}
	.date_width{
	     width: 83px;
	}
</style>
<body>
<div class="place">
	<span>位置：</span>
	<ul class="placeul">
		<li><a href="#">首页</a></li>
		<li><a href="#">版本管理</a></li>
	</ul>
</div>
<div class="rightinfo">
	<form id="seachform" th:action="@{/sys/problem/schoolBanbenlist.html}" method="post">
	<ul class="seachform">
	<li>
			<label>学校名字</label>
			<input name="name" type="text" class="scinput" th:value="${search.get('school_name')}"/>
		</li>
		<li>
			<label>科目</label>
			<select class="scinput select_width" name="courseName" id="courseName">
				<option value=""  th:selected="${ search.get('courseName') eq '' }"  >全部</option>
				<option  th:each="sort:${zyb_course}"  th:value="${sort.name}"  th:if="${sort.name ne '总体'}" th:selected="${ search.get('courseName')  eq sort.name }" th:text="${sort.name}" ></option>
			</select>
		</li>
		<li>
			<label>年级</label>
			<select class="scinput select_width" name="grade">
				<option value=""  th:selected="${ search.get('grade') eq '' }"  >全部</option>
				<option th:value="${list.name}" th:if="${list.aliases ne '0'}" th:each="list:${grade}" th:selected="${ search.get('grade')  eq list.name }" th:text="${list.name}">学前</option>
			</select>
		</li>
		<li>
			<input type="button" class="scbtn" value="查询" />
		</li>
		<li>
			<ul class="toolbar"  th:onclick="'knowHowAdd()'">
				<li class="click"><span><img th:src="@{/static/sys/images/t01.png}" /></span>新增</li>
			</ul>
		</li>
	</ul>
	</form>
	<table class="tablelist">
		<thead>
		    <tr>
		        <th style="width: 50px;">序号</th>
				<th>地区</th>
		        <th>学校名称</th>
		        <th>科目</th>
		        <th>年级</th>
		        <th>版本</th>
		        <th>操作</th>
		    </tr>
		</thead>
		<tbody>
			<tr th:each="cnArealist:${list}" >
				<td th:text="${cnArealistStat.count}" ></td>
				<td th:text="${cnArealist.get('area')}"></td>
				<td th:text="${cnArealist.get('school_name')}"></td>

				<td th:text="${cnArealist.get('course_name')}"></td>
				<td th:text="${cnArealist.get('grade')}"></td>
				<td>
					<div th:remove="tag" th:each="map:${version}">
						<div th:remove="tag" th:each="item:${map.value}">
							<span th:if="${cnArealist.get('course_name') eq item.courseName && cnArealist.get('banben') == item.versionType}" th:text="${item.versionName}"></span>
						</div>
					</div>
				</td>
				<td>
					<a href="javascript:void(0)" th:onclick="'knowHowAdd(\''+${cnArealist.get('id')}+'\')'"  class="tablelink" >修改</a>
					<a href="javascript:void(0)" th:onclick="'deleteById(\''+${cnArealist.get('id')}+'\')'" class="tablelink" >删除</a>
				</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>
<script type="text/javascript">
function knowHowAdd(id){
	layer.open({
		type: 2,
		title: "添加学校年级版本信息",
		closeBtn: 1, //不显示关闭按钮
		shift: 0.8,
		//offset: '100px',
		area: ['50%', '90%'],
		content: "[[${sysUrl}]]/sys/problem/schoolBanbenAdit?id="+id
	});
}

function deleteById(id){
	layer.confirm("确定删除吗？",
			{icon: 4, btn: ['确定','取消']
			}, function(){
				$.ajax({
					url: '[[${sysUrl}]]/sys/problem/banbenDelete',
					type: "post",
					data:{
						'id': id
					},
					dataType: "json",
					success:function(data){

						if(data.meta.success){
							layer.msg("删除成功",{icon:1});
							setTimeout(function(){
								location.reload();
							},1000);
						}else{
							layer.msg(data.meta.message,{icon:11});
						}
					}
				});
			});
}
</script>