<div ng-controller="BatchInfoSupplyCtrl" style="padding-bottom:60px;">
<div style="min-height: 300px;" cg-busy="{promise:promise,backdrop:true,message:'正在加载...'}">
<div class="pull-right m-r">
	<select class="form-control" ng-model="cc" >
		<option value="" >全部课程</option>
		<option value="{{item.courseCode}}" ng-repeat="item in courses" >
			{{item.courseCode}} - {{item.courseName}}
		</option>
	</select>
</div>
<a ui-sref="batch.info.supplymgt" class="btn btn-default"><i class="glyphicon glyphicon-cog"> 管理供卷课程</i></a>
<a ng-click="refresh()" class="btn btn-default"><i class="fa fa-refresh"> 刷新</i></a>
<a ui-sref="batch.info.printLog" class="btn btn-default"><i class="glyphicon glyphicon-book"> 查看打印日志</i></a>
<a ng-click="expStartedPapers()" class="btn btn-default"><i class="glyphicon glyphicon-export"> 导出启用试卷列表</i></a>
<div class="pull-right m-r">
	<select class="form-control" ng-model="pv" >
		<option value="" >全部省份</option>
		<option value="{{p.provCode}}" ng-repeat="p in provs" >
			{{p.provName}}
		</option>
	</select>
</div>

<div class="pull-right m-r">
	<select class="form-control" ng-model="trackType">
		<option value="paperPrint" >试卷打印进度跟踪</option>
		<option value="answerPrint" >答案打印进度跟踪</option>
		<option value="paperScan" >试卷扫描进度跟踪</option>
		<option value="answerScan" >答案扫描进度跟踪</option>
	</select>
</div>

<!-- 
<table ng-show="courses.length > 0" class="supply-table bg-white m-t" 
	style="width:100%;table-layout: fixed;"  >
	<thead>
		<tr>
			<th width="2%">#</th>
			<th width="4%">代码</th>
			<th width="15%">课程</th>
			<th width="5%">合卷</th>
			<th width="5%">分卷</th>
			<th width="5%">总数</th>
			<th width="2%" ng-repeat="p in provs | filter:{code:pv}">
				{{p.name}}
			</th>
		</tr>
	</thead>
</table>
<div style="height:400px;" ng-scrollbar scrollbar-x="false" scrollbar-y="true" scrollbar-config="{show: auto}">
-->
<table ng-show="courses.length > 0" class="supply-table bg-white m-t" style="width:100%;table-layout: fixed;"  >
	<thead>
		<tr>
			<th width="2%">#</th>
			<th width="7%">代码</th>
			<th width="18%">课程</th>
			<th width="5%">省份数</th>
			<th width="2%" ng-repeat="p in provs | filter:{provCode:pv}">
				{{p.provName}}
			</th>
		</tr>
		<tr>
			<th align="center" colspan="4">应打课程总数</th>
			<th width="2%" ng-repeat="p in provs | filter:{provCode:pv}">
				<span ng-show="(trackType == 'paperPrint'|| trackType == 'paperScan') && (p.taskItems | filter:{shouldPrintPaper:true}).length > 0">{{(p.taskItems | filter:{shouldPrintPaper:true}).length}}</span>
				<span ng-show="(trackType == 'answerPrint'|| trackType == 'answerScan')">{{p.courseCount}}</span>
			</th>
		</tr>
		<tr>
			<th align="center" colspan="4">未完成课程数</th>
			<th width="2%" ng-repeat="p in provs | filter:{provCode:pv}">
				<span ng-show="trackType == 'paperPrint' && (p.taskItems | filter:{shouldPrintPaper:true}).length - (p.taskItems | filter:{shouldPrintPaper:true,paperPrintComplete:true}).length > 0">{{ (p.taskItems | filter:{shouldPrintPaper:true}).length - (p.taskItems | filter:{shouldPrintPaper:true,paperPrintComplete:true}).length}}</span>
				<span ng-show="trackType == 'answerPrint' && p.taskItems.length - (p.taskItems | filter:{answerPrintComplete:true}).length > 0">{{p.taskItems.length - (p.taskItems | filter:{answerPrintComplete:true}).length}}</span>
				<span ng-show="trackType == 'paperScan' &&  (p.taskItems | filter:{shouldPrintPaper:true}).length - (p.taskItems | filter:{isPaperScanned:true}).length > 0">{{ (p.taskItems | filter:{shouldPrintPaper:true}).length - (p.taskItems | filter:{isPaperScanned:true}).length}}</span>
				<span ng-show="trackType == 'answerScan' && p.taskItems.length - (p.taskItems | filter:{isAnswerScanned:true}).length > 0">{{p.taskItems.length - (p.taskItems | filter:{isAnswerScanned:true}).length}}</span>
			</th>
		</tr>
	</thead>
	<tbody >
		<tr ng-repeat="row in courses | filter:{courseCode:cc}">
			<td align="center">{{$index+1}}</td>
			<td align="center">{{row.courseCode}}</td>
			<td class="clip">{{row.courseName}}</td>
			<td align="center">{{row.supplyProvInfo.length}}</td>
			<td align="center" ng-repeat="p in provs | filter:{provCode:pv}">
				<span ng-show="trackType == 'paperPrint'" class="text-success" ng-if="(p.taskItems | filter:{shouldPrintPaper:true,paperPrintComplete:true,courseCode:row.courseCode}).length > 0"><i class="glyphicon glyphicon-ok"></i></span>
				<span ng-show="trackType == 'paperPrint'" class="text-danger" ng-if="(p.taskItems | filter:{shouldPrintPaper:true,paperPrintComplete:false,courseCode:row.courseCode}).length > 0"><i class="glyphicon glyphicon-ok"></i></span>
				<span ng-show="trackType == 'answerPrint'" class="text-success" ng-if="(p.taskItems | filter:{answerPrintComplete:true,courseCode:row.courseCode}).length > 0"><i class="glyphicon glyphicon-ok"></i></span>
				<span ng-show="trackType == 'answerPrint'" class="text-danger" ng-if="(p.taskItems | filter:{answerPrintComplete:false,courseCode:row.courseCode}).length > 0"><i class="glyphicon glyphicon-ok"></i></span>
				<span ng-show="trackType == 'paperScan'" class="text-success" ng-if="(p.taskItems | filter:{shouldPrintPaper:true,isPaperScanned:true,courseCode:row.courseCode}).length > 0"><i class="glyphicon glyphicon-ok"></i></span>
				<span ng-show="trackType == 'paperScan'" class="text-danger" ng-if="(p.taskItems | filter:{shouldPrintPaper:true,isPaperScanned:null,courseCode:row.courseCode}).length > 0"><i class="glyphicon glyphicon-ok"></i></span>
				<span ng-show="trackType == 'answerScan'" class="text-success" ng-if="(p.taskItems | filter:{isAnswerScanned:true,courseCode:row.courseCode}).length > 0"><i class="glyphicon glyphicon-ok"></i></span>
				<span ng-show="trackType == 'answerScan'" class="text-danger" ng-if="(p.taskItems | filter:{isAnswerScanned:null,courseCode:row.courseCode}).length > 0"><i class="glyphicon glyphicon-ok"></i></span>
			</td>
		</tr>
		<!-- 
		<tr>
			<td colspan="3">总计</td>
			<td>{{courses | sumByField:'mergeCount'}}</td>
			<td>{{courses | sumByField:'sepCount'}}</td>
			<td>{{courses | sumByField:'total'}}</td>
		</tr>
		-->
	</tbody>
	<thead>
		<tr>
			<th width="2%">#</th>
			<th width="7%">代码</th>
			<th width="20%">课程</th>
			<th width="5%">省份数</th>
			<th width="2%" ng-repeat="p in provs | filter:{provCode:pv}">
				{{p.provName}}
			</th>
		</tr>
	</thead>
</table>
<!-- 
<h3>省份打印进度</h3>
<div ng-show="courses.length > 0" class="row" ng-repeat="p in provs | filter:{provCode:pv}" >
		<div class="col-md-2">{{p.provName}}</div>
		<div class="col-md-10">
		<div class="progress" style="margin-bottom:10">
  		<div class="progress-bar progress-bar-success" style="width: {{p.progress}}%;">
    		{{p.progress}}%
	  		</div>
		</div>
		</div>
</div>
 -->
</div>
</div>