<p class="text-success font-bold" ng-controller="UseBatchSummaryCtrl">{{batchSummary}}</p>
<div ng-controller="UseBatchPaperCtrl">
	<ul class="nav nav-pills padder">
         <li ui-sref-active="active" class="active"><a ui-sref="batch.info.use" >启用卷管理</a></li>
         <li ui-sref-active="active" ><a ui-sref="batch.info.useExtract">抽卷</a></li>
         <li ui-sref-active="active" ><a ui-sref="batch.info.useStock">库存统计</a></li>
	</ul>
	<div class="panel panel-default">
		<div class="panel-body">
			<button ui-sref="batch.info.addUsePaper" class="btn btn-success">
				<i class="glyphicon glyphicon-plus"> 选择</i>
			</button>
			<button ng-click="removeSelectedPapers()" class="btn btn-danger">
				<i class="glyphicon glyphicon-minus"> 移出</i>
			</button>
			<a href="examPaper/downloadDBF/{{batch.id}}" class="btn btn-default">
				<i class="glyphicon glyphicon-export"> 导出DBF</i>
			</a>
			<a href="examPaper/downloadPaper/{{batch.id}}" class="btn btn-default" ng-show="downloadPapers"><i class="glyphicon glyphicon-download"> 下载电子试卷</i></a>
			<button type="button" class="btn btn-default" disabled="disabled" ng-show="!downloadPapers" title="没有可用的下载密码"><i class="glyphicon glyphicon-download"> 下载电子试卷</i></button>
			
			<div class="btn-group">
				<button type="button" class="btn btn-dark dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
				   <i class="glyphicon glyphicon-print"></i>&nbsp;&nbsp;打印 <span class="caret"></span>
				</button>
				<ul class="dropdown-menu">
				 	<li><a target="_blank" href="examPaper/printAllCodeInfo/{{batch.id}}">打印试卷条码</a></li>
					<li><a target="_blank" href="examPaper/printAllAnswerCodeInfo/{{batch.id}}">打印答案条码</a></li>
				   	<li role="separator" class="divider"></li>
					<li><a target="_blank" href="examPaper/recordByBatchId/{{batch.id}}">打印工作登记表</a></li>
				</ul>
			</div>
			
			<button ui-sref="batch.info.useOutScan" class="btn btn-warning">
				<i class="glyphicon glyphicon-barcode"> 出库扫描</i>
			</button>
			<button ng-click="confirmUsed()" class="btn btn-success">
				<i class="glyphicon glyphicon-ok"> 确认启用</i>
			</button>
			<button ui-sref="batch.info.useInScan" class="btn btn-danger" title="回库扫描后，试卷状态自动变为清样">
				<i class="glyphicon glyphicon-barcode"> 回库扫描</i>
			</button>
			<table class="table m-t">
				<thead>
					<tr>
						<th><input type="checkbox" ng-model="isCheckAll" ng-change="checkAll()"></th>
						<th>试卷编号</th>
						<th>试卷状态</th>
						<th>专卡</th>
						<th>课程代码</th>
						<th>课程</th>
						<th>教材</th>
						<th>编者</th>
						<th>出版社</th>
						<th>版次</th>
						<th>出库扫描</th>
						<th>回库扫描</th>
					</tr>
				</thead>
				<tbody>
					<tr ng-repeat="row in pageModel.array" class="{{row.isChecked ? 'danger' : ''}}">
						<td><input type="checkbox" ng-model="row.isChecked"></td>
						<td>{{row.code}}</td>
						<td class="{{row.status == 'USED' ? 'text-success' : ''}}">{{row.status | paperStatus}}</td>
						<td>{{row.isSpecialAnswerSheet == 1?'有':'无'}}</td>
						<td>{{row.courseCode}}</td>
						<td title="{{row.courseName}}">{{row.courseName}}</td>
						<td title="{{row.bookName}}">{{row.bookName}}</td>
						<td title="{{row.bookAuthor}}">{{row.bookAuthor}}</td>
						<td title="{{row.bookPress}}">{{row.bookPress}}</td>
						<td title="{{row.bookPressYear}}">{{row.bookPressYear}}</td>
						<td align="center" class="{{row.isOutBoundScanned == 1 ? 'text-success' : 'text-danger'}} font-bold">{{row.isOutBoundScanned == 1 ? '&radic;' : 'X'}}</td>
						<td align="center" class="{{row.isStorageScanned == 1 ? 'text-success' : 'text-danger'}} font-bold">{{row.isStorageScanned == 1 ? '&radic;' : 'X'}}</td>
					</tr>
				</tbody>
			</table>
			
			<nav ng-if="pageModel.totalPage > 1">
				<ul class="pagination">
					<li class="{{pageModel.curPage == 1 ? 'disabled' : ''}}" ng-click="goPage(pageModel.curPage - 1)">
						<a aria-label="Previous"><span aria-hidden="true">&laquo;</span></a>
			      	</li>
				    <li ng-repeat="i in [9,8,7,6,5,4,3,2,1]" ng-if="pageModel.curPage - i > 0" ng-click="goPage(pageModel.curPage - i)">
				    	<a>{{pageModel.curPage - i}}</a>
			    	</li>
				    <li class="active"><a href="#">{{pageModel.curPage}}</a></li>
				    <li ng-repeat="i in [1,2,3,4,5,6,7,8,9]" ng-if="pageModel.curPage + i <= pageModel.totalPage" ng-click="goPage(pageModel.curPage + i)">
				    	<a>{{pageModel.curPage + i}}</a>
			    	</li>
				    <li class="{{pageModel.curPage == pageModel.totalPage ? 'disabled' : ''}}" ng-click="goPage(pageModel.curPage + 1)">
				      	<a aria-label="Next"><span aria-hidden="true">&raquo;</span></a>
				    </li>
				</ul>
			</nav>
		</div>
	</div>
</div>
