<div ng-controller="BatchTopCtrl" class="wrapper">
<div class="panel panel-default">
	<div class="panel-body">
	<div class="panel-body">
			<div class="form-inline">
			<button ui-sref="batch.add" class="btn btn-default"><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.title" ng-change="goPage(1)" />
				</div>
				<label>类型：
					<select ng-model="search.type" class="form-control" ng-change="goPage(1)" >
						<option value="">所有</option>
						<option value="{{item.name}}" ng-repeat="item in batchTypes">{{item.value}}</option>
					</select>
				</label>
				</div>
    <table class="table table-striped">
	<thead>
	<tr>
		<th>#</th>
		<th class="col-md-2">批次标题</th>
		<th class="col-md-2">类型</th>
		<th>开始日期</th>
		<th>结束日期</th>
		<th>负责人</th>
		<th>备注</th>
		<th>操作</th>
	</tr>
	</thead>
	<tbody>
	<tr ng-repeat="row in pageModel.array | orderBy : id ">
		<th>{{$index+1}}</th>
		<td><a ng-click="showInfo(row)">{{row.title}}</a></td>
		<td>{{row.type}}</td>
		<td>{{row.startDate | date:'yyyy-MM-dd'}}</td>
		<td>{{row.endDate | date:'yyyy-MM-dd'}}</td>
		<td>{{row.admin}}</td>
		<td>{{row.remark}}</td>
		<td>
		<span ng-if="row.batchType == 'SUPPLY'">
			<a  href="#batch/info/{{row.id}}/supplymgt" class="m-r-sm" >
			<i class="icon icon-wrench"></i>&nbsp;管理
			</a>
			<a  href="#batch/info/{{row.id}}/supplypaper/form" class="m-r-sm" >
			<i class="icon icon-doc"></i>&nbsp;启用试卷
			</a>
		</span>
		<a  href="javascript:void(0)" ng-click="removeBatch(row.id)" class="text-danger">
			<i class="glyphicon glyphicon-trash"></i>&nbsp;删除
		</a>
		</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>