<%@ 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">
	<c:if test="${fnx:hasPrivilegeCode(role_privilege_codes, 'exam_inspected_info-info')}">
		<li><a href="${ctx}/admin/exam/inspected/info">成绩复核进度</a></li>
		</c:if>
		<c:if test="${fnx:hasPrivilegeCode(role_privilege_codes, 'exam_inspected_info-list')}">
		<li><a href="${ctx}/admin/exam/inspected/list">全卷复核</a></li>
		</c:if>
		<li class="active"><a href="##">成绩校验</a></li>
	</ul>
	<form id="searchForm" action="#"
		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>
			<input id="btnResetData" class="btn" type="button" value="重置"
				onclick="resetData()" />
			<input id="btnStart" class="btn" type="button" value="批量校验:${needVerifyCount}"
				onclick="goStart(${needVerifyCount})" />
			<input id="btnExportData" class="btn" type="button" value="导出标记卷"
			onclick="exportData()" />
		</div>
	</form>
	<tags:message content="${message}" />
	<tags:message content="${errmsg}" type="error" />
	<form id="dataForm" action="#"
		method="post" class="breadcrumb form-search">
		<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>
				</tr>
			</thead>
			<tbody>
				<c:forEach items="${query.result}" var="result">
					<tr>
						<td>${result.studentName}</td>
						<td>${result.studentCode}</td>
						<td>${result.subjectCode}-${result.subjectName}</td>
						<td>${result.subjectScoreString}</td>
						<td>
                <c:if test="${result.upload==true}">
                    <c:if test="${examType!='MULTI_MEDIA'}">
                        <a class="sheet-link" href="##" data-sheet-url="${result.sheetUrlString}" 
                           data-title="${result.examNumber}&nbsp;&nbsp;${result.studentName}&nbsp;&nbsp;客观总分${result.objectiveScoreString}&nbsp;&nbsp;主观总分${result.subjectiveScoreString}&nbsp;&nbsp;全卷总分${result.totalScoreString}">已上传</a>
                    </c:if>
                    <c:if test="${examType=='MULTI_MEDIA'}">
                        已上传
                    </c:if>
                    &nbsp;
                    <c:if test="${result.absent==true}">
                        缺考
                    </c:if>
                    <c:if test="${result.absent==false}">
                        正常
                    </c:if>
                </c:if>
                
                <c:if test="${result.upload==false}">
                    未上传
                </c:if>
            
            </td>
						<td><c:choose>
                    <c:when test="${result.absent == true || result.upload == false }">
                        -
                    </c:when>
                    <c:when test="${result.breach == true}">
                        0
                    </c:when>
                    <c:otherwise>
                        ${result.totalScoreString}
                    </c:otherwise>
                </c:choose></td>
						<td>${result.subjectiveScoreList}</td>
						<td><a
							href="${ctx}/web/admin/exam/track/student?studentId=${result.studentId}&subjectCode=${result.subjectCode}"
							target="_blank">轨迹图</a>
								<a target="_blank"
									href="${ctx}/web/admin/exam/score/verify/start?studentId=${result.studentId}">进入校验</a>
							</td>
							<td>${result.scoreVerifyUserName}</td>
							<td>
							<c:if test="${result.scoreVerifyTime!=null}">
			                    <fmt:formatDate value="${result.scoreVerifyTime}" pattern="yyyy-MM-dd HH:mm:ss"/>
			                </c:if>
			                <c:if test="${result.scoreVerifyTime==null}">
	                    &nbsp;
	                </c:if>
	                </td>
					</tr>
				</c:forEach>
			</tbody>
		</table>
	</form>
	<div class="pagination">${query}</div>
	<%@include file="/WEB-INF/views/include/sheetView.jsp" %>
	<script type="text/javascript">
	$(document).ready(function () {
        $('.sheet-link').click(function () {
            initSheetPopover($(this).attr('data-title'), '${fileServer}', $(this).attr('data-sheet-url'), $(this).attr('data-answer-url'));
            return false;
        });
    });
		function page(n, s) {
			$("#pageNumber").val(n);
			$("#pageSize").val(s);
			$("#searchForm").attr('target', "_self");
			$("#searchForm").attr('action', '${ctx}/admin/exam/score/verify/page');
			$("#searchForm").submit();
			return false;
		}
		function resetData() {
			if (!confirm('确定重置？')) {
	            return;
	        }
			$("#searchForm").attr('target', "_self");
			$("#searchForm").attr('action', '${ctx}/admin/exam/score/verify/reset');
			$("#searchForm").submit();
			return false;
		}
		function exportData() {
			$("#searchForm").attr("action", "${ctx}/admin/exam/score/verify/export");
	        $("#searchForm").submit();
		}
		function goStart(count) {
			if (count==0) {
				alert("没有数据需要校验");
				return false;
			}
			var url = '${ctx}/web/admin/exam/score/verify/start';
			window.open(url, '_blank');
			return false;
		}
	</script>
</body>
</html>