<%@ 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>
	<div id="objImportBox" class="hide">
		<form id="objImportForm" action="${ctx}/admin/exam-param/paper/import" method="post" enctype="multipart/form-data"
			style="padding-left:20px;text-align:center;" class="form-search" onsubmit="loading('正在导入，请稍等...');"><br/>
			<input name="objective" type="hidden" value="true"/>
			<input name="file" type="file" style="width:330px"/><br/><br/>　　
			<input class="btn btn-primary" type="submit" value="导入" onclick="goObjImport()"/>
			<a href="${ctx}/admin/exam-param/paper/template?objective=true">下载模板</a>
		</form>
	</div>
	<div id="subImportBox" class="hide">
		<form id="subImportForm" action="${ctx}/admin/exam-param/paper/import" method="post" enctype="multipart/form-data"
			style="padding-left:20px;text-align:center;" class="form-search" onsubmit="loading('正在导入，请稍等...');"><br/>
			<input name="objective" type="hidden" value="false"/>
			<input name="file" type="file" style="width:330px"/><br/><br/>　　
			<input class="btn btn-primary" type="submit" value="导入" onclick="goSubImport()"/>
			<a href="${ctx}/admin/exam-param/paper/template?objective=false">下载模板</a>
		</form>
	</div>
	<%-- <%@include file="/WEB-INF/views/include/examInfoNavTabs.jsp" %> --%>
	<form id="searchForm" action="${ctx}/admin/exam-param/paper" 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="code" id="subject-select">
				<option value="">请选择</option>
				<c:forEach items="${subjectList}" var="subject">
				<option value="${subject.code}" data-level="${subject.level}" <c:if test="${subject.code==query.code}">selected</c:if>>${subject.code}-${subject.name}</option>
				</c:forEach>
			</select>
			<label>层次</label>
			<select class="input-small" name="level" id="level-select">
				<option value="">请选择</option>
				<c:forEach items="${levelList}" var="level">
				<option value="${level}" data-level="${level}" <c:if test="${level==query.level}">selected</c:if>>${level}</option>
				</c:forEach>
			</select>
			<label>专业类型</label>
			<select class="input-small" name="category" id="category-select">
				<option value="">请选择</option>
				<c:forEach items="${categoryList}" var="category">
				<option value="${category}" <c:if test="${category==query.category}">selected</c:if>>${category}</option>
				</c:forEach>
			</select>
			&nbsp;
			<label>状态</label>
			<select class="input-small" name="upload">
				<option value="">不限</option>
				<option value="1" <c:if test="${upload!=null && upload==true}">selected</c:if>>已扫描</option>
				<option value="0" <c:if test="${upload!=null && upload==false}">selected</c:if>>未扫描</option>
			</select>
			&nbsp;
			<label>总分不等于</label>
			<input type="text" name="totalScoreNotEqual" value="${query.totalScoreNotEqual}"  maxlength="10" class="input-mini"/>
			<br/><br/>
			<input id="btnSubmit" class="btn btn-primary" type="button" value="查询" onclick="goSearch()"/>
			&nbsp;
			<!--  
			<input id="obj-import" class="btn" type="button" value="导入客观题"/>
			&nbsp;
			<input id="sub-import" class="btn" type="button" value="导入主观题"/>
			&nbsp;
			-->
			<div class="btn-group">
				<a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
					导入<span class="caret"></span>
				</a>
				<ul class="dropdown-menu">
					<li><a href="##" id="obj-import">客观题</a></li>
					<li><a href="##" id="sub-import">主观题</a></li>
				</ul>
			</div>
			&nbsp;
			<div class="btn-group">
				<a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
					导出<span class="caret"></span>
				</a>
				<ul class="dropdown-menu">
					<li><a href="${ctx}/admin/exam-param/paper/export?objective=true">客观题</a></li>
					<li><a href="${ctx}/admin/exam-param/paper/export?objective=false">主观题</a></li>
				</ul>
			</div>
		</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>
			</tr>
		</thead>
		<tbody>
		<c:forEach items="${query.result}" var="subject">
			<tr>
				<td>
					<a href="${ctx}/admin/exam-param/paper/detail?subjectCode=${subject.code}">${subject.code}-${subject.name}&nbsp;${subject.remark}</a>
				</td>
				<td>${subject.level}</td>
				<td>${subject.category}</td>
				<td>
				<c:if test="${subject.hasPaper}">
				<a href="${cardServer}${subject.paperUrl}" target="_blank">已上传</a>
				</c:if>
				</td>
				<td>
				<c:if test="${subject.hasAnswer}">
				<a href="${cardServer}${subject.answerUrl}" target="_blank">已上传</a>
				</c:if>
				</td>
				<td>${subject.objectiveScore}</td>
				<td>${subject.subjectiveScore}</td>
				<td>${subject.totalScore}</td>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${query}</div>
<script type="text/javascript">
function page(n,s){
	$("#pageNumber").val(n);
	$("#pageSize").val(s);
	$("#searchForm").submit();
	return false;
}
function goSearch(){
	$("#pageNumber").val(1);
	$("#pageSize").val('${query.pageSize}');
	$("#searchForm").submit();
	return false;
}
$("#obj-import").click(function(){
	$.jBox($("#objImportBox").html(), {title:"导入客观题", buttons:{"关闭":true}, 
		bottomText:"导入文件不能超过5M，仅允许导入“xls”或“xlsx”格式文件！"});
});
$("#sub-import").click(function(){
	$.jBox($("#subImportBox").html(), {title:"导入主观题", buttons:{"关闭":true}, 
		bottomText:"导入文件不能超过5M，仅允许导入“xls”或“xlsx”格式文件！"});
});
function goObjImport(){
    alert("导入后请务必重新统分");
};
function goSubImport(){
    alert("导入后请务必重新统分");
};
</script>	
</body>
</html>