<%@ page language="java" pageEncoding="utf-8"%>
<%@ taglib uri="/WEB-INF/taglib/c.tld" prefix="c"%>
<%@ include file="../common/init.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<%@ include file="../common/top.jsp"%>
<link rel="stylesheet" type="text/css" href="${ctx}/static/subjecthead/style/subjectheader-content.css">
</head>
<body class="easyui-layout">
	<%@ include file="../common/header.jsp"%>
	<%@ include file="../common/menu.jsp"%>
	<div
		data-options="region:'center',title:'首页 -<a href=>【问题卷处理】</a>- 列表'">
		<div class="easyui-layout" data-options="fit:true,border:false">
			<div data-options="region:'north',border:false" class="domain">
			<form class="form-horizontal">
				<div id="tb" style="padding:5px;height:auto">  
				    <div>
				    	提交人:   
				       <select id="submitter" name="submitter" style="width:100px;" class="easyui-combobox">
		     		        <option value="" >请选择...</option>
		     		        <c:forEach items="${mList }" var="marker">
		     		        	<option value="${marker.id }" >${marker.name }</option>
		     		        </c:forEach>
		            	</select>
		            	类型:   
				       <select id="reason" name="reason" style="width:100px;" class="easyui-combobox">
		     		        <option value="">请选择...</option>
		     		        <c:forEach items="${reason }" var="type">
		     		        	<option value="${type.value }" >${type.name }</option>
		     		        </c:forEach>
		            	</select>
		            	状态:   
				       <select id="status" name=status style="width:100px;" class="easyui-combobox">
		     		        <option value="">请选择...</option>
		     		        <option value="0" >未处理</option>
		     		        <option value="1" >已给分</option>
		     		        <option value="2" >已打回</option>
		            	</select>  
		            	题目:   
				       <select id="blockId" name="blockId" style="width:100px;" class="easyui-combobox">
		     		        <option value="" >请选择...</option>
		     		        <c:forEach items="${bList }" var="block">
		     		        	<option value="${block.id}" >${block.title }</option>
		     		        </c:forEach>
		            	</select>  
		            	密号: <input id="paperNumber" name="paperNumber" class="easyui-numberbox" style="width:80px">
				        提交时间: <input id="startTime" name="startTime" class="easyui-datetimebox" style="width:80px">-<input id="endTime" name="endTime" class="easyui-datetimebox" style="width:80px">  
				        
				        <button type="submit" class="btn" id="searchButton"><i class="icon-search"></i> 搜索</button> 
				    </div>  
			    </div> 
			</form>
			</div>
			<div data-options="region:'center'"
				style="border-color: #ccc; border-left: none;">
				<table class="easyui-datagrid" id="dg"
					data-options="pagination:'true',url:'${ctx}/subjectheader/problem/list.json',rownumbers:true,singleSelect:true,fit:true,border:false,fitColumns:true,striped:true">
					<thead>
						<tr>
							<th width="10%"  data-options="field:'secretNo'"><strong>密号</strong></th>
							<th width="15%"  data-options="field:'marker',title:'marker',formatter:marker"><strong>提交人</strong></th>
							<th width="15%"  data-options="field:'reason',formatter:reason"><strong>类型</strong></th>
							<th width="15%"  data-options="field:'blockId',title:'subjectiveBlock',formatter:block"><strong>题目</strong></th>
							<th width="15%"  data-options="field:'status',formatter:status"><strong>状态</strong></th>
							<th width="15%"  data-options="field:'submitTime',formatter:formattime"><strong>提交时间</strong></th>
							<th width="15%"  data-options="field:'operate',formatter:operate"><strong>操作</strong></th>
						</tr>
					</thead>
				</table>
			</div>
		</div>
	</div>
</body>
<script type="text/javascript">
	function operate(value, row, index) {
		if(row.status=="WAITING"){
			return '<button class="btn btn-success" onclick="view('
			+ row.id
			+ ')">处理</button>';
		}else{
			return "";
		}
		
	}
	
	function marker(value, row, index) {
		return row.marker.name;
	}
	
	function block(value, row, index) {
		return row.subjectiveBlock.title;
	}
	
	function reason(value, row, index) {
		var str;
		if(value==0){
			str="试卷模糊";
		}else if(value==1){
			str = "答错位置";
		}else{
			str = "无法判别";
		}
		return str;
	}
	
	function status(value, row, index) {
		var str;
		if(value=="WAITING"){
			str="未处理";
		}else if(value=="QUEUED"){
			str = "已放入队列";
		}else if(value == "EXCEPTION"){
			str = "异常待处理";
		}else if(value == "MARKED"){
			str = "已给分";
		}else{
			str = "已打回";
		}
		return str;
	}
	
	function formattime(value, row, index) {
		var date = new Date(value);
        return date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate()+" "+date.getHours()+":"+date.getMinutes()+":"+date.getSeconds();
	}
	
	function view(id){
		window.location.href="${ctx}/subjectheader/problem/view/"+id;
	}
	
	
	$('.form-horizontal').submit(function(event) {
		event.preventDefault();
		var query = $('.form-horizontal').serializeJson();
		$('#dg').datagrid('load', query);
	});
	
</script>
</html>
