<div ng-controller="BatchInfoSupplyScanCtrl" style="padding-bottom:60px;">
<div style="min-height: 300px;" cg-busy="{promise:promise,backdrop:true,message:'正在加载...'}">
<form class="form-horizontal m-t" name="form" novalidate ng-submit="submit()">
	<div class="form-group">
		<label for="" class="col-lg-2 control-label">条形码<span class="req">*</span></label>
		<div class="col-lg-3">
			<input type="text" class="form-control" ng-model="model.barcode" placeholder="条形码" ng-required="true" focus-me='true'>
		</div>
		<button type="submit" ng-disabled='form.$invalid' class="btn btn-primary">确认扫描</button>
	</div>
</form>

<div class="pull-right m-r m-b">
	<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>
<div class="pull-right m-r m-b">
	<select class="form-control" ng-model="pv" >
		<option value="" >全部省份</option>
		<option value="{{p.provCode}}" ng-repeat="p in provs" >
			{{p.provName}}
		</option>
	</select>
</div>
			

<table ng-show="courses.length > 0" class="supply-table bg-white m-t m-l m-r" style="width:98%;table-layout: fixed;"  >
	<thead>
		<tr>
			<th width="2%">#</th>
			<th width="7%">代码</th>
			<th width="20%">课程</th>
			<th width="5%">省份数</th>
			<th 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="scanType == 'paper'">{{(p.taskItems | filter : {shouldPrintPaper : true}).length}}</span>
				<span ng-show="scanType == 'answer'">{{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="scanType == 'paper' && (p.taskItems | filter : {shouldPrintPaper : true}).length - ((p.taskItems | filter : {shouldPrintPaper : true}) | filter:{isPaperScanned:true}).length > 0">{{(p.taskItems | filter : {shouldPrintPaper : true}).length - (p.taskItems | filter:{isPaperScanned:true}).length}}</span>
				<span ng-show="scanType == 'answer' && 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="scanType == 'paper'" 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="scanType == 'paper'" 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="scanType == 'answer'" 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="scanType == 'answer'" class="text-danger" ng-if="(p.taskItems | filter:{isAnswerScanned:null,courseCode:row.courseCode}).length > 0"><i class="glyphicon glyphicon-ok"></i></span>
			</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>
</div>
</div>