<!-- 清样、启用批次添加关联试卷 -->
<div>
	<div class="panel panel-default">
		<div class="panel-body">
			<div class="form-inline">
				<button ng-click="relateSelectedPapers()" class="btn btn-primary btn-sm"><i class="glyphicon glyphicon-plus"> 批量添加</i></button>
				<div class="input-group col-sm-2">
			      	<div class="input-group-addon"><i class="glyphicon glyphicon-search"></i></div>
					<input type="text" placeholder="试卷编号或课程代码" class="input-sm form-control" ng-model="search.keyword" ng-change="goPage(1)" />
				</div>
			</div>
			<table class="table table-hover 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>
					</tr>
				</thead>
				<tbody>
					<tr ng-repeat="row in pageModel.array" class="{{row.isChecked ? 'danger' : ''}}">
						<td ng-click="row.isChecked = !row.isChecked"><input type="checkbox" ng-model="row.isChecked"> {{$index+1}}</td>
						<td>{{row.code}}</td>
						<td>{{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">
							<button ng-if="!row.isRelated" ng-click="relatedPaper(row, batch.id)" class="btn btn-primary btn-xs">
								<i class="glyphicon glyphicon-plus"> 关联</i>								
							</button>
							<button ng-if="row.isRelated" class="btn btn-default btn-xs">
								<i class="glyphicon glyphicon-ok"> 已关联</i>								
							</button>
						</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>
