<%@ 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"%>
</head>
<body class="easyui-layout">
	<%@ include file="../common/header.jsp"%>
	<%@ include file="../leftMenu/exam-admin.jsp"%>
	<div data-options="region:'center',title:'首页 -【考试管理】- 【总体参数设置】 - 详情'">
		<div class="border mr-t" data-options="region:'center'">
				<form id="condition-form" action="${ctx}/admin/analysis/total/data" method="post">
					<div class="mr-l">
						<input type="hidden" name="examId" value="${examId}" />
							<span class="help-inline">文理科：</span>
							<select name="classType" class="span2" id="class-type-select">
								<c:forEach items="${classTypeValue}" var="cValue">
									<c:if test="${cValue==0}"><option value="0" <c:if test="${classType==0}">selected="selected"</c:if>>不区分</option></c:if>
									<c:if test="${cValue==1}"><option value="1" <c:if test="${classType==1}">selected="selected"</c:if>>文科</option></c:if>
									<c:if test="${cValue==2}"><option value="2" <c:if test="${classType==2}">selected="selected"</c:if>>理科</option></c:if>
								</c:forEach>
							</select>
					</div>
				</form>
				
				<c:if test="${! empty epvoList}">
				<form id="parameter-form" class="form-horizontal"
					action="${ctx}/admin/analysis/total/update" method="post">
					<input type="hidden" name="examId" value="${examId}" />
					<input type="hidden" name="classType" value="${classType}" />
					<input type="hidden" name="parameterValue" id="parameterValue"/>
					
					<ul class="nav nav-tabs mr-t">
					<c:forEach items="${epvoList}" var="entry">
						<li><a href="#subject-${entry.subjectId}-${entry.classType}" data-toggle="tab" name="${entry.subjectId}">${entry.subjectName}</a></li>
					</c:forEach>
					</ul>
					
					<div class="tab-content">
					<c:forEach items="${epvoList}" var="entry">
					<div class="tab-pane" id="subject-${entry.subjectId}-${entry.classType}">
					
					<div class="control-group">
						<label class="control-label" for="graduate1">一本分数线</label>
						<div class="controls">
							<input name="graduate1" type="text" value="${entry.graduate1}"/>
						</div>
					</div>
					<div class="control-group">
						<label class="control-label" for="graduate2">二本分数线</label>
						<div class="controls">
							<input name="graduate2" type="text" value="${entry.graduate2}"/>
						</div>
					</div>
					<div class="control-group">
						<label class="control-label" for="graduate3">三本分数线</label>
						<div class="controls">
							<input name="graduate3" type="text" value="${entry.graduate3}"/>
						</div>
					</div>
					<div class="control-group">
						<label class="control-label" for="professional1">专科一类分数线</label>
						<div class="controls">
							<input name="professional1" type="text" value="${entry.professional1}"/>
						</div>
					</div>
					<div class="control-group">
						<label class="control-label" for="professional2">专科二类分数线</label>
						<div class="controls">
							<input name="professional2" type="text" value="${entry.professional2}"/>
						</div>
					</div>
					<div class="control-group">
						<label class="control-label" for="passScore">及格分</label>
						<div class="controls">
							<input name="passScore" type="text" value="${entry.passScore}"/>
						</div>
					</div>
					<div class="control-group">
						<label class="control-label" for="goodScore">优良分</label>
						<div class="controls">
							<input name="goodScore" type="text" value="${entry.goodScore}"/>
						</div>
					</div>
					<div class="control-group">
						<label class="control-label" for="excellentScore">优秀分</label>
						<div class="controls">
							<input name="excellentScore" type="text" value="${entry.excellentScore}"/>
						</div>
					</div>
					</div>
					</c:forEach>
					</div>
					<a href="javascript:void(0)" class="btn btn-primary mr-l" id="save-button">保存</a> 
				</form>
				</c:if>
		</div>	
	</div>
</body>
<script type="text/javascript">
$('#class-type-select').change(function(){
	$('#condition-form').submit();
});
$('.nav-tabs a:first').tab('show');

$('#save-button').click(function(){
	var parameterArray = new Array();
	$('.nav-tabs a').each(function(index, href){
		var parameter = {
			"examId" : ${examId},
			"subjectId" : href.name,
			"classType" : '${classType}',
			"graduate1" : "",
			"graduate2" : "",
			"graduate3" : "",
			"professional1" : "",
			"professional2" : "",
			"passScore" : "",
			"goodScore" : "",
			"excellentScore" : ""
		}
		parameterArray.push(parameter);
	});
	
	$.each(parameterArray, function(index, parameter){
		parameter.graduate1 = $('#subject-'+parameter.subjectId+'-'+parameter.classType+' input[name="graduate1"]').val();
		parameter.graduate2 = $('#subject-'+parameter.subjectId+'-'+parameter.classType+' input[name="graduate2"]').val();
		parameter.graduate3 = $('#subject-'+parameter.subjectId+'-'+parameter.classType+' input[name="graduate3"]').val();
		parameter.professional1 = $('#subject-'+parameter.subjectId+'-'+parameter.classType+' input[name="professional1"]').val();
		parameter.professional2 = $('#subject-'+parameter.subjectId+'-'+parameter.classType+' input[name="professional2"]').val();
		parameter.passScore = $('#subject-'+parameter.subjectId+'-'+parameter.classType+' input[name="passScore"]').val();
		parameter.goodScore = $('#subject-'+parameter.subjectId+'-'+parameter.classType+' input[name="goodScore"]').val();
		parameter.excellentScore = $('#subject-'+parameter.subjectId+'-'+parameter.classType+' input[name="excellentScore"]').val();
	});
	
	$('#parameterValue').val(JSON.stringify(parameterArray));
	$('#parameter-form').submit();
});
</script>
</html>
