<div class="panel panel-default mg" ng-controller="PaperTaskDifficultyEstimateCtrl" cg-busy="{promise:loading,message:'正在加载...'}">
<div class="panel-body">
<form class="form-horizontal {{submitted ? 'submitted' : ''}}" name="form" novalidate ng-submit="submit()">
	<h3 class="text-center">
		高等教育自学考试试卷及格分数预估表
	</h3>
	<h5 class="text-center">
		课程名称：{{task.course.name}} <span class="m-l m-r">课程代码：{{task.course.code}}</span> 试卷代码：{{task.taskNo}}
	</h5>
	<form class="{{submitted ? 'submitted' : ''}}" name="form" novalidate ng-submit="submit()">
		<div class="col-sm-10 col-sm-offset-1">
			<table class="table table-bordered">
				<thead>
					<tr>
						<td>题型</td>
						<td>题号</td>
						<td>分值</td>
						<td>估计难度层次</td>
						<td>估计难度值</td>
						<td>估计平均分</td>
						<td>实测平均分</td>
						<td>实测难度值</td>
					</tr>
				</thead>
				<tbody>
					<tr ng-repeat="row in estimateDatas">
						<td ng-if="$index == 0 || row.questionType != estimateDatas[$index-1].questionType" 
							rowspan="{{(estimateDatas | filter:{questionType: row.questionType}:true).length}}" style="vertical-align:middle;">{{row.questionType}}</td>
						<td>{{row.sortNo}}</td>
						<td>{{row.questionScore}}</td>
						<td>{{row.estimateDifficultyName}}</td>
						<td ng-if="editable">
							<label>({{estimateValueRange[row.estimateDifficultyName].minValue}} - {{estimateValueRange[row.estimateDifficultyName].maxValue}})</label>
							<div class="col-sm-8">
								<input type="number" class="form-control" ng-model="row.estimateDifficultyValue" name="{{row.sortNo}}-Value" required 
									min-value="{{estimateValueRange[row.estimateDifficultyName].minValue}}"
									max-value="{{estimateValueRange[row.estimateDifficultyName].maxValue}}"
									ng-maxlength=4
									valid-input-value-range 
									ng-change="changeValue()"
									/>
								<div class="error-container" ng-show="form[row.sortNo + '-Value'].$dirty && form[row.sortNo + '-Value'].$invalid">
							    	<small class="text-danger" ng-show="form[row.sortNo + '-Value'].$error.required">请输入</small>
							    	<small class="text-danger" ng-show="form[row.sortNo + '-Value'].$error.inRange">输入的值超出了范围</small>
							    	<small class="text-danger" ng-show="form[row.sortNo + '-Value'].$error.maxlength">最多输入两位小数</small>
							    </div>
							</div>
						</td>
						<td ng-if="!editable">{{row.estimateDifficultyValue}}</td>
						<td>{{row.questionScore * row.estimateDifficultyValue | number : 2}}</td>
						<td></td>
						<td></td>
					</tr>
					<tr>
	        			<td colspan='5' style="text-align:right;">合计：</td>
	        			<td>{{totalAverageScore | number : 2}}</td>
	        			<td></td>
	        			<td></td>
	        		</tr>
				</tbody>
			</table>
		</div>
	
		<div class="col-sm-8 col-sm-offset-2 m-t">
			<p class="text-center"><b>填表说明</b></p>
			<p class="text-left">1. 估计难度值：以刚达标的应考者为群体样本，估计他们能正确回答一道试题的概率，即是该题的估计难度值(小数点后保留两位)，该值应落在该题的难度层次（A，B，C，D）的数值范围内。</p>
			<p class="text-left">2. 估计平均分：估计难度值乘以该题满分值，得到该题的估计平均分。</p>
			<p class="text-left">2*.前面两步也可简化为：直接估计刚达标群体（及格水平的学生）在每小题可能得到的分数为该题的估计平均分。</p>
			<p class="text-left">3. 试卷中所有试题的估计平均分之和为预估的试卷及格分数。</p>
			<p class="text-left">4. 如果预估的试卷及格分数在55-65分范围之外，则必须对有关试题进行调整。</p>
			<p class="text-left">5. 实测平均分和实测难度为试卷考后的统计数据，供作对比实验用，命题时不填写。</p>
		</div>
	  
		<div class="col-sm-7 col-sm-offset-5">
		      <button type="button" class="btn btn-primary btn-lg" ng-if="editable" ng-show="!estimateDatas || estimateDatas.length < 1" ng-click="initTableData()">创建预估表</button>
		      <button type="submit" class="btn btn-primary btn-lg" ng-if="editable">保存</button>
		      <button type="button" class="btn btn-danger btn-lg" ng-if="editable && estimateDatas.length > 0" ng-click="deleteTableData()">删除预估表</button>
		</div>
	</form>
</form>
</div>
</div>
