<%@ 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="${ctx}/admin/exam/check/answer">识别结果检查</a></li>
		<li><a href="${ctx}/admin/exam/check/image">图片检查</a></li>
<%-- 		<li><a href="${ctx}/admin/exam/check/score">分数检查</a></li> --%>
		<li><a href="${ctx}/admin/exam/check/student">人工确认</a></li>
	</ul>
	<form id="searchForm" action="${ctx}/admin/exam/check/answer/start" method="post" class="form-horizontal" target="_blank">
	    <input type="hidden" class="hiddenField" id="examNumberIn" name="examNumberIn"/>
	    <input type="hidden" class="hiddenField" id="subjectCodeIn" name="subjectCodeIn"/>
	    <input type="hidden" class="hiddenField" id="subjectCodeNotIn" name="subjectCodeNotIn"/>
	    <input type="hidden" class="hiddenField" id="examSiteIn" name="examSiteIn"/>
	    <input type="hidden" class="hiddenField" id="examSiteNotIn" name="examSiteNotIn"/>
	   <!--  <input type="hidden" class="hiddenField" id="campusNameIn" name="campusNameIn"/>
        <input type="hidden" class="hiddenField" id="campusNameNotIn" name="campusNameNotIn"/> -->
        <input type="hidden" class="hiddenField" id="objectiveScoreGt" name="objectiveScoreGt"/>
        <input type="hidden" class="hiddenField" id="objectiveScoreLt" name="objectiveScoreLt"/>
        <input type="hidden" class="hiddenField" id="objectiveScore" name="objectiveScore"/>
        <input type="hidden" class="hiddenField" id="subjectiveScore" name="subjectiveScore"/>
        <input type="hidden" class="hiddenField" id="subjectiveScoreGt" name="subjectiveScoreGt"/>
        <input type="hidden" class="hiddenField" id="subjectiveScoreLt" name="subjectiveScoreLt"/>
        <div class="control-group">
            <label class="control-label">是否缺考</label>
            <div class="controls">
                <select name="absent" class="input-small">
                    <option value="">不限</option>
                    <option value="true">是</option>
                    <option value="false">否</option>
                </select>
            </div>
        </div>
		<div class="control-group">
            <label class="control-label">准考证号</label>
            <div class="controls">
                <input type="hidden" id="examNumberFunction" value="In"/>
                <textarea id="examNumberInput" rows="4" maxlength="10000" class="input-xxlarge" placeholder="多个准考证号用英文逗号分隔"></textarea>
            </div>
        </div>
        <div class="control-group">
            <label class="control-label">科目</label>
            <div class="controls">
                <select id="subjectCodeFunction" class="input-small">
                    <option value="In">属于</option>
                    <option value="NotIn">不属于</option>
                </select>
                <br/><br/>
                <textarea id="subjectCodeInput" rows="6" maxlength="10000" class="input-xxlarge" placeholder="多个科目代码用英文逗号分隔"></textarea>
            </div>
        </div>
<!--         <div class="control-group">
            <label class="control-label">学习中心</label>
            <div class="controls">
                <select id="campusNameFunction" class="input-small">
                    <option value="In">属于</option>
                    <option value="NotIn">不属于</option>
                </select>
                <br/><br/>
                <textarea id="campusNameInput" rows="6" maxlength="10000" class="input-xxlarge" placeholder="多个学习中心名称用英文逗号分隔"></textarea>
            </div>
        </div> -->
		<div class="control-group">
            <label class="control-label">考点</label>
            <div class="controls">
                <select id="examSiteFunction" class="input-small">
                    <option value="In">属于</option>
                    <option value="NotIn">不属于</option>
                </select>
                <br/><br/>
                <textarea id="examSiteInput" rows="6" maxlength="10000" class="input-xxlarge" placeholder="多个考点用英文逗号分隔"></textarea>
            </div>
        </div>
        <div class="control-group">
            <label class="control-label">客观总分</label>
            <div class="controls">
                <select id="objectiveScoreFunction" class="input-small">
                    <option value="Gt">大于</option>
                    <option value="">等于</option>
                    <option value="Lt">小于</option>
                </select>
                <input id="objectiveScoreInput" class="input-large" type="number"/>
            </div>
        </div>
        <div class="control-group">
            <label class="control-label">主观总分</label>
            <div class="controls">
                <select id="subjectiveScoreFunction" class="input-small">
                    <option value="Gt">大于</option>
                    <option value="">等于</option>
                    <option value="Lt">小于</option>
                </select>
                <input id="subjectiveScoreInput" class="input-large" type="number"/>
            </div>
        </div>
		<div class="control-group">
            <label class="control-label">试卷类型</label>
            <div class="controls">
                <input id="paperType" name="paperType" class="input-large" maxlength="1"/>
            </div>
        </div>
        <div class="control-group">
            <label class="control-label">查询结果</label>
            <div class="controls">
                <input id="count" class="input-large" disabled/>
            </div>
        </div>
        <div class="form-actions">
            <a href="javascript:void(0)" class="btn" id="count-button">查询数量</a>
            <a href="javascript:void(0)" class="btn btn-primary hide" id="start-button" target="_blank">开始处理</a>
        </div>
	</form>
<script type="text/javascript">
$('#count-button').click(function(){
    $('.hiddenField').val('');
    check('examNumber');
    check('subjectCode');
    check('examSite');
   // check('campusName');
    check('objectiveScore');
    check('subjectiveScore');
    var paperType = $('#paperType').val();
    if(paperType.length>1){
    	return;
    }
    var re = new RegExp("^[a-zA-Z#]+$"); 
    if(paperType.length!=0 && !re.test(paperType)){
    	alert("试卷类型仅支持英文或#!");
    	return;
    }
    $.post('${ctx}/admin/exam/check/answer/count', $("#searchForm").serialize(), function(result){
        $('#count').val(result);
        if(result>0){
            $('#start-button').show();
        }else{
            $('#start-button').hide();
        }
    });
});

$('#start-button').click(function(){
	var queryId=new Date().getTime();
	localStorage.setItem(queryId, JSON.stringify($("#searchForm").serializeArray()));
	$('#start-button').attr('href','${ctx}/web/admin/exam/check/answer/start?queryId='+queryId);
});

function check(name){
    var input = $('#'+name+'Input').val();
    if(input.length>0){
        var func = $('#'+name+'Function').val();
        $('#'+name+func).val(input.replace(/\n/g,''));
    }
}
</script>	
</body>
</html>
