<%@ 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>
	<form id="searchForm" action="${ctx}/admin/exam/tag" method="post" 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 class="input-large" name="subjectCode">
				<option value="">请选择</option>
				<c:forEach items="${subjectList}" var="subject">
				<option value="${subject.code}" <c:if test="${subject.code==query.subjectCode}">selected</c:if>>${subject.code}-${subject.name}</option>
				</c:forEach>
			</select>
			<label>学习中心</label>
			<select class="input-large" name="campusId">
				<option value="0">请选择</option>
				<c:forEach items="${campusList}" var="campus">
				<option value="${campus.id}" <c:if test="${campus.id==query.campusId}">selected</c:if>>${campus.name}</option>
				</c:forEach>
			</select>
			<label>标记类型</label>
			<select class="input-medium" name="tagId">
				<c:forEach items="${tagList}" var="tag">
				<option value="${tag.id}" <c:if test="${tag.id==query.tagId}">selected</c:if>>${tag.name}</option>
				</c:forEach>
			</select>
			&nbsp;
			<input id="btnSubmit" class="btn btn-primary" type="button" value="查询" onclick="goSearch()"/>
		</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>
			</tr>
		</thead>
		<tbody>
		<c:forEach items="${resultList}" var="result">
			<tr>
				<td>${result.subjectCode}-${result.subjectName}</td>
				<td>${result.campusName}</td>
				<td>${result.examNumber}</td>
				<td>${result.name}</td>
				<td>${result.markTime}</td>
				<td>
					<a class="sheet-link" href="##" data-sheet-url="${result.sheetUrlString}" data-answer-url="<c:if test="${result.answerUrl!=null}">${cardServer}${result.answerUrl}</c:if>" data-title="${result.examNumber}&nbsp;&nbsp;${result.name}&nbsp;&nbsp;客观总分${result.objectiveScoreString}&nbsp;&nbsp;主观总分${result.subjectiveScoreString}&nbsp;&nbsp;全卷总分${result.totalScoreString}">原图</a>
					<!--
					<c:forEach items="${result.sheetUrls}" var="url" varStatus="status">
					<a href="${imageServer}${url}" data-jbox-image="${result.id}-sheet" title="总分：${result.totalScore}，客观总分：${result.objectiveScore }，主观总分：${result.subjectiveScore}">原图${status.count}</a>
					</c:forEach>
					-->
					<a href="##" class="back-button" data-student-id="${result.id}">打回</a>
				</td>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${query}</div>
	<%@include file="/WEB-INF/views/include/imageView.jsp" %>
<script type="text/javascript">
$(document).ready(function() {
    /* new jBox('Image', {
    	imageFade: 0,
    	delayOpen: 0,
    	delayClose: 0,
    	maxHeight: $(window).height()*0.88
    }); */
    $('.sheet-link').click(function(){
    	initImagePopover($(this).attr('data-title'), '${imageServer}', $(this).attr('data-sheet-url'), $(this).attr('data-answer-url'));
    	return false;
    });
    $('.back-button').click(function(){
        if(confirm('确定要打回改试卷?')){  
        $.post('${ctx}/admin/exam/tag/back', {studentId: $(this).attr('data-student-id')}, function(result){
            if(result.success==true){
            	$("#searchForm").submit();
            }else{
                alert(result.message || '提交失败，请稍后重试');
            }
        });
        }
    });
});
function page(n,s){
	$("#pageNumber").val(n);
	$("#searchForm").attr('action', '${ctx}/admin/exam/tag');
	$("#searchForm").submit();
	return false;
}
function goSearch(){
	$("#pageNumber").val(1);
	$("#searchForm").attr('action', '${ctx}/admin/exam/tag');
	$("#searchForm").submit();
	return false;
}
function goExport(){
	$("#searchForm").attr('action', '${ctx}/admin/exam/tag/export');
	$("#searchForm").submit();
	return false;
}
</script>	
</body>
</html>