<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>科组长列表</title>
	<meta name="decorator" content="default"/>
	<%@include file="/WEB-INF/views/include/head.jsp" %>
	<style type="text/css">.sort{color:#0663A2;cursor:pointer;}</style>
</head>
<body>
	<ul class="nav nav-tabs">
		<li><a href="${ctx}/admin/exam-param/marker">评卷员列表</a></li>
		<li><a href="${ctx}/admin/exam-param/marker/batch-create">批量创建</a></li>
		<li class="active"><a href="${ctx}/admin/exam-param/marker/subjectViewer">科组长列表</a></li>
	</ul>
	<form id="searchForm"  action="${ctx}/admin/exam-param/marker" method="get" class="breadcrumb form-search">
		<input type="hidden" id="pageNumber" name="pageNumber" value="${query.pageNumber}"/>
		<input type="hidden" id="pageSize" name="pageSize" value="${query.pageSize}"/>
		<div>
			<label>科目：</label>
			<select id="subject-select" name="loginName">
				<option value="">请选择</option>
				<c:forEach items="${subjectList}" var="subject">
				<option value="${subject.code}" <c:if test="${subject.code==query.loginName}">selected</c:if>>${subject.code}-${subject.name}</option>
				</c:forEach>
			</select>
			
			&nbsp;
			<input id="btnSubmit" class="btn btn-primary" type="button" value="查询" onclick="goSearch()"/>
			&nbsp;
			<input id="btnExport" class="btn" type="button" value="导出"/>
		</div>
	</form>
	<tags:message content="${message}"/>
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
				<th>科目</th>
				<th>登录名</th>
				<th>姓名</th>
				<th>操作</th>
			</tr>
		</thead>
		<tbody>
		<c:forEach items="${markers}" var="marker">
			<tr>
				<td>
				${marker.subject.code}-${marker.subject.name}
				</td>
				<td>${marker.loginName}</td>
				<td>${marker.name}</td>
				<td>
					<a href="javascript:void(0)" class="rest-button" data-id="${marker.id}">恢复初始密码</a>
				</td>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${query}</div>
<script type="text/javascript">

$("#btnExport").click(function(){
	top.$.jBox.confirm("确认要导出科组长数据吗？","系统提示",function(v,h,f){
		if(v=="ok"){
			$("#searchForm").attr("action","/admin/exam-param/marker/exportSubjectViewer");
			$("#searchForm").submit();
		}
	},{buttonsFocus:1});
	top.$('.jbox-body .jbox-icon').css('top','55px');
});

$('.rest-button').click(function(){
	var id = $(this).attr('data-id');
	$.post('${ctx}/admin/exam-param/marker/rest', {id: id}, function(result){
		if(result.success==true){
			alert('修改成功');
			$("#searchForm").submit();
		}else{
			alert(result.message);
		}
	});
});

function page(n,s){
	$("#pageNumber").val(n);
	$("#pageSize").val(s);
	$("#searchForm").attr("action","${ctx}/admin/exam-param/marker/subjectViewer");
	$("#searchForm").submit();
	return false;
}
function goSearch(){
	$("#pageNumber").val(1);
	$("#pageSize").val('${query.pageSize}');
	$("#searchForm").attr("action","${ctx}/admin/exam-param/marker/subjectViewer");
	$("#searchForm").submit();
	return false;
}
</script>	
</body>
</html>