<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: 150px;
	}
</style>
<body>
<div class="place">
	<span>位置：</span>
	<ul class="placeul">
		<li><a th:href="@{/sys/imuser/school/list}">导入老师/学生</a></li>
		<li><a href="#">老师列表</a></li>
	</ul>
</div>
<div class="rightinfo">
	<form id="seachform" th:action="${sysUrl+'/sys/imuser/teacher/list/'+tbClass.id}" method="post">
	  <input type="hidden" name="reportType" id="reportType" />
		<ul class="seachform">
			<li>
			  <input style="width: 250px;" name="name" placeholder="输入老师名称" type="text" class="scinput" />
		    </li>
		    <li>
			  <input type="button" class="scbtn" value="查询" />
		    </li>
		    <li style="line-height: 35px;">
		    	<span th:text="${tbClass.school +'' + tbClass.grade +''+ tbClass.className} "></span> 
		    </li>
		</ul>
	</form>
	
	<ul class="seachform">
	    <li>
		  <input type="button" onclick="javascript:teacherAdd();" style="width: 100px;height: 30px"  class="scbtn" value="添加老师" />
	    </li>
	</ul>
	
	
	<table class="tablelist">
		<thead>
		    <tr>
		    	<th>老师姓名</th>
		    	<th>所受科目</th>
		    	<th>老师电话</th>
		        <th>操作</th>
		    </tr> 
		</thead>
		<tbody>
			<tr th:each="item:${list}" >
				<td th:text="${item.teacher_name}"></td>
				<td th:text="${item.subject}"></td>
				<td th:text="${item.teacher_phone}"></td>
				<td>
					<a th:href="${'javascript:teacherDel(''' + item.im_lib_teacher_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>
</body>

<script type="text/javascript">
	
	function teacherAdd(){
		layer.open({
		    type: 2,
		    title: '添加老师',
		    closeBtn: 1, //不显示关闭按钮
		    shift: 0.8,
		    offset: '100px',
		    area: ['50%', '50%'],
		    content: '[[${sysUrl}]]/sys/imuser/teacher/add/[[${tbClass.id}]]'
		});
	}

	function teacherDel(studentId){
		parent.layer.confirm("您确定要删除老师关联?", {
			icon: 4, btn: ['确定','关闭'],offset: '100px' //按钮
		}, function(){
			var url="[[${sysUrl}]]/sys/imuser/teacher/data/del/"+studentId;
			var params ={};
			$.post(url,params,function(data){
				if(data.meta.success){
					parent.layer.msg("删除成功",{icon:1});
					parent.location.reload();
				}else{
					parent.layer.msg(data.meta.message,{icon:11});
				}
			});
		});
	}

	
</script>


</html>