<%@ 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 class="active"><a href="##">大题管理</a></li>
        <li><a href="${ctx}/admin/exam/marker?subjectCode=${subject.code}">评卷员管理</a></li>
        <li><a href="${ctx}/admin/exam/library?subjectCode=${subject.code}">评卷任务管理</a></li>
        <li><a href="${ctx}/admin/exam/arbitrate?subjectCode=${subject.code}">仲裁管理</a></li>
    </ul>
	<form id="searchForm" action="${ctx}/admin/exam/group" method="post" class="breadcrumb form-search">
		<div>
			<label>科目</label>
			<select class="input-large" name="subjectCode">
				<c:forEach items="${subjectList}" var="item">
				<option value="${item.code}" <c:if test="${item.code==subject.code}">selected</c:if>>${item.code}-${item.name}</option>
				</c:forEach>
			</select>
			&nbsp;
			<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
			
			<c:if test="${web_user.schoolAdmin==true}">
			&nbsp;
			<a href="${ctx}/admin/exam/group/add?subjectCode=${subject.code}" class="btn">新增</a>
			&nbsp;
			<a href="${ctx}/admin/exam/group/check-count?subjectCode=${subject.code}" class="btn">数量校对</a>
			</c:if>
		</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>-->
				<th>评卷员人数</th>
				<th>任务总数</th>
				<th>完成总数</th>
				<th>剩余总数</th>
				<th>正在评卷</th>
				<th>进度</th>
				<th>操作</th>
			</tr>
		</thead>
		<tbody>
		<c:forEach items="${resultList}" var="result">
			<tr>
				<td>${result.title}</td>
				<td>${result.number}</td>
				<td>${result.scoreList}</td>
				<!--<td>${result.picList}</td>-->
                <td>
                    <a href="${ctx}/admin/exam/marker?subjectCode=${result.subjectCode}&groupNumber=${result.number}">${result.markerCount}</a>
                </td>
				<td>${result.libraryCount}</td>
				<td>${result.markedCount}</td>
				<td>${result.leftCount}</td>
				<td>${result.currentCount}</td>
				<td>
				  ${result.percent}%
				</td>
				<td>
				    <c:if test="${web_user.schoolAdmin==true}">
					<c:if test="${result.currentCount>0}">
					<a href="${ctx}/admin/exam/group/release?subjectCode=${result.subjectCode}&number=${result.number}">回收</a>
					</c:if>
					<c:if test="${result.libraryCount>0}">
					<a href="${ctx}/admin/exam/group/reset?subjectCode=${result.subjectCode}&number=${result.number}" data-number="${result.number}" class="reset-button">重置</a>
					</c:if>
					<a href="${ctx}/admin/exam/group/edit-simple?subjectCode=${result.subjectCode}&number=${result.number}" data-number="${result.number}" class="edit-button">修改</a>
					<a href="${ctx}/admin/exam/group/delete?subjectCode=${result.subjectCode}&number=${result.number}" data-number="${result.number}" class="delete-button">删除</a>
					</c:if>
				</td>
			</tr>
		</c:forEach>
		</tbody>
	</table>
<script type="text/javascript">
function page(n,s){
    $("#pageNumber").val(n);
    $("#pageSize").val(s);
    $("#searchForm").submit();
    return false;
}
function goSearch(){
    $("#pageNumber").val(1);
    $("#searchForm").submit();
    return false;
}
$('.reset-button').click(function(){
	var number = $(this).attr('data-number');
	return confirm('确定要重置第'+number+'大题的评卷任务吗?');
});
$('.delete-button').click(function(){
    var number = $(this).attr('data-number');
    return confirm('确定要删除第'+number+'大题吗？相关评卷任务与评卷员都将一并删除！');
});
</script>	
</body>
</html>