<div ng-controller="BatchListCtrl" class="wrapper" cg-busy="{promise:loading, backdrop:true, message:loadingMsg}">
	<div class="panel panel-default">
		<div class="panel-body">
			<div class="form-inline">
			<button ui-sref="batch.add" class="btn btn-default" ng-if="curUserRole.code=='processManagement'">
				<i class="glyphicon glyphicon-plus"> 添加批次</i>
			</button>
			<button ui-sref="batch.revertBatchTask" class="btn btn-default" ng-if="1 != 1 && curUserRole.code=='processManagement'">
				<i class="glyphicon"> 还原</i>
			</button>
			<button class="btn btn-default" ng-click="showInputStat()" ng-if="curUserRole.code=='processManagement'">
				<i class="glyphicon"> 录题统计</i>
			</button>
			<button ui-sref="batch.toStartPapers" class="btn btn-default" ng-if="curUserRole.code=='processManagement'">
				<i class="glyphicon"> 试卷启用</i>
			</button>
				<div class="input-group col-sm-3">
		      		<div class="input-group-addon"><i class="glyphicon glyphicon-search"></i></div>
					<input type="text" class="form-control" ng-model="search.keyword" placeholder="批次名称" ng-change="goPage(1)" />
				</div>
			</div>
			
			<table class="table table-striped">
				<thead>
					<tr>
						<th>序号</th>
						<th>批次名称</th>
						<th>批次类型</th>
						<th>计划开始时间</th>
						<th>计划结束时间</th>
						<th>操作</th>
					</tr>										
				</thead>
				<tbody>
					<tr ng-repeat="row in pageModel.array">
						<td>{{$index+1}}</td>
						<td><a ng-click="showInfo(row)">{{row.name}}</a></td>
						<td>{{row.batchTypeLabel}}</td>
						<td>{{row.planStartTime | date:'yyyy-MM-dd'}}</td>
						<td>{{row.planEndTime | date:'yyyy-MM-dd'}}</td>
						<td>
							<button ng-click="edit(row.id)" class="btn btn-primary btn-xs">
								<i class="glyphicon glyphicon-edit"> 编辑</i>								
							</button>
							<button ng-click="exportBatch(row.id)" class="btn btn-default btn-xs" ng-if="1 != 1">
								<i class="glyphicon "> 备份导出</i>								
							</button>
							<button ng-click="expTkjsForClient(row.id)" class="btn btn-default btn-xs" ng-if="row.batchType=='TI_KU_JIAN_SHE'">
								<i class="glyphicon "> 客户端导出</i>								
							</button>
							<button ng-click="deleteBatch(row.id)" class="btn btn-danger btn-xs">
								<i class="glyphicon glyphicon-trash"> 删除</i>								
							</button>
						</td>
					</tr>
				</tbody>

			</table>
			<div>
			<form id="downloadForm" action="#"></form>
			</div>
			<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>
			</div>
		</div>
	</div>
</div>