<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/My97DatePicker/WdatePicker.js" th:src="@{/static/sys/js/My97DatePicker/WdatePicker.js}"></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="#">0元活动</a></li>
	</ul>
</div>
<div class="rightinfo">
	<form id="seachform" th:action="@{/sys/problem/experiencelist.html}" method="post">
	<ul class="seachform">
	<li>
			<label>学生姓名</label>
			<input name="name" type="text" class="scinput" th:value="${search.get('name')}"/>
		</li>
		<li>
				<label>年级</label>
					<select class="scinput select_width"  name="grade"   style="width: 70px;" >
						<option value=""   >全部</option>
						<option th:each="sort:${grade}"  th:value="${sort.name}"  th:selected="${ search.get('grade') eq sort.name }"  th:text="${sort.name}"></option>
					</select>
		</li>
		<li>
		<label>类别</label>
					<select class="scinput select_width" name="type"  style="width: 100px;">
					    <option value=""  th:selected="${ search.get('type') eq '' }"  >全部</option>
						<option value="1" th:selected="${ search.get('type') eq '1' }" >0元阅读</option>
						<option value="2" th:selected="${ search.get('type') eq '2' }" >0元试听课</option>
					</select>
		</li>
		 <li>
				<label>开始时间</label>
				<input type="text" id="beginDate" name="beginDate"  onclick="WdatePicker({readOnly:true,maxDate:'#F{$dp.$D(\'endDate\')}'})" th:value="${search.beginDate }" class="scinput date_width " placeholder="开始时间">
			</li>
			
			
			<li>
				<label>结束时间</label>
				<input type="text" id="endDate" name="endDate"  onclick="WdatePicker({minDate:'#F{$dp.$D(\'beginDate\')}',maxDate:'%y-%M-%d'})" th:value="${search.endDate }" class="scinput date_width" placeholder="结束时间">
			</li>
		<li>
		<li>
			<input type="button" class="scbtn" value="查询" />
		</li>
	<li>
				<ul class="toolbar">
		<a th:href="@{/sys/problem/addexperience.html}"><li class="click"><span><img th:src="@{/static/sys/images/t01.png}" /></span>添加</li></a>
				</ul>
		</li>
		<li>
			<input type="button" id="button" style="width: 100px;" class="scbtnbution" value="导出明细" />
		</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>
		        <th>图书馆</th>
		        <th>来源</th>
		        <th>操作</th>
		    </tr>
		</thead>
		<tbody>
			<tr th:each="experiencelist:${list}" >
				<td th:text="${experiencelistStat.count}" ></td>
				<td th:text="${experiencelist.get('name')}"></td>
				<td th:text="${experiencelist.get('grade')}"></td>
				<td th:text="${experiencelist.get('phone')}"></td>
				<td th:text="${#calendars.format(experiencelist.get('date_time'),'yyyy-MM-dd HH:mm:ss')}" ></td>
				<td th:switch="${experiencelist.get('type')}" >
				    <span th:case="1">0元阅读</span>
				    <span th:case="2">0元试听课</span>
				</td>
				<td th:text="${experiencelist.get('course')}"></td>
				<td th:text="${experiencelist.get('library')}"></td>
				<td th:text="${experiencelist.get('source')}"></td>
				<td>
					<a th:href="@{/sys/problem/addexperience.html(id=${experiencelist.get('id')})}" class="tablelink" >修改</a>
				 <!--   <a href="javascript:;" th:onclick="'deleteById(\''+${experiencelist.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 deleteById(id){
	parent.layer.confirm("确定删除该用户？",
			{icon: 4, btn: ['确定','取消']
	}, function(){
		$.ajax({
			url: '[[${sysUrl}]]/sys/problem/experienceDelete',
			type: "post",
			data:{
				'id': id
			},
			dataType: "json",
			success:function(data){
					
					if(data.meta.success){
						parent.layer.msg("删除成功",{icon:1});
						setTimeout(function(){
				    		location.reload();
						},1000);
					}else{
						parent.layer.msg(data.meta.message,{icon:11});
					}
			}
		});
	});
}
$("#button").on('click',function(){
	$('#reportType').val(3);
	document.getElementById("seachform").action = "[[${sysUrl}]]/sys/report/exportLibEX";
	$("#seachform").submit();
	document.getElementById("seachform").action = "[[${sysUrl}]]/sys/problem/experiencelist.html";
});
</script>