<div ng-controller="PaperSearchCtrl" class="wrapper">
	<div class="panel panel-default">
		<div class="panel-body">
			<div class="form-inline">
			<a href="examPaper/downloadDBF/0" class="btn btn-default"><i class="glyphicon glyphicon-export"> 导出dbf</i></a>
				<div class="input-group col-sm-4">
			      	<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>
				<label>状态：
					<select class="input-sm form-control" ng-model="search.status" ng-change="goPage(1)">
						<option value="">所有</option>
						<option value="DRAFT">毛坯</option>
						<option value="FORMAL">清样</option>
						<option value="USED">启用</option>
					</select>
				</label>
				</div>
			<table class="paper-table table-striped m-t" style="table-layout: fixed;">
				<thead>
					<tr>
						<th width="3%">#</th>
						<th width="10%">试卷编号</th>
						<th width="5%">状态</th>
						<th width="5%">是否专卡</th>
						<th width="7%">课程代码</th>
						<th width="10%">课程名称</th>
						<th width="10%">教材名称</th>
						<th width="7%">编者</th>
						<th width="10%">出版社</th>
						<th width="8%">版次</th>
						<th width="3%">网评</th>
						<th width="3%">标答</th>
						<th width="3%">分卷</th>
						<th width="3%">专卡</th>
						<th width="3%">转印</th>
						<th width="10%">操作</th>
					</tr>									
				</thead>
				<tbody>
					<tr ng-repeat="row in pageModel.array">
						<td>{{$index+1}}</td>
						<td>{{row.code}}</td>
						<td>{{row.status | paperStatus}}</td>
						<td>{{row.isSpecialAnswerSheet | isSpecialCard}}</td>
						<td>{{row.courseCode}}</td>
						<td class="clip" title="{{row.courseName}}">{{row.courseName}}</td>
						<td class="clip" title="{{row.bookName}}">
							<span editable-text="row.bookName" e-name="bookName" e-form="rowform" >
								{{row.bookName}}
							</span>
						</td>
						<td>
							<span editable-text="row.bookAuthor" e-name="bookAuthor" e-form="rowform" >
								{{row.bookAuthor}}
							</span>
						</td>
						<td class="clip" title="{{row.bookPress}}">
							<span editable-text="row.bookPress" e-name="bookPress" e-form="rowform" >
								{{row.bookPress}}
							</span>
						</td>
						<td>
							<span editable-text="row.bookPressYear" e-name="bookPressYear" e-form="rowform" >
								{{row.bookPressYear}}
							</span>
						</td>
						<td align="center" class="{{row.wPaperPath != null ? 'text-success' : 'text-danger'}} font-bold">{{row.wPaperPath != null ? '&radic;' : 'X'}}</td>
						<td align="center" class="{{row.standardAnswerPath!= null ? 'text-success' : 'text-danger'}} font-bold">{{row.standardAnswerPath != null ? '&radic;' : 'X'}}</td>
						<td align="center" class="{{row.separatePaperPath != null ? 'text-success' : 'text-warning'}} font-bold">{{row.separatePaperPath != null ? '&radic;' : '-'}}</td>
						<td align="center" class="{{row.answerSheetPath != null ? 'text-success' : 'text-warning'}} font-bold">{{row.answerSheetPath != null ? '&radic;' : '-'}}</td>
						<td align="center" class="{{row.zyPath != null ? 'text-success' : 'text-warning'}} font-bold">{{row.zyPath != null ? '&radic;' : '-'}}</td>
						<td style="white-space: nowrap">
					        <!-- form -->
					        <form editable-form name="rowform" onbeforesave="savePaper($data, row.id)" ng-show="rowform.$visible" class="form-buttons form-inline" shown="inserted == row">
					          <button type="submit" ng-disabled="rowform.$waiting" class="btn btn-default btn-md">
					            保存
					          </button>
					          <button type="button" ng-disabled="rowform.$waiting" ng-click="rowform.$cancel()" class="btn btn-default btn-md">
					            取消
					          </button>
					        </form>
					        <div class="buttons" ng-show="!rowform.$visible">
					          <button class="btn btn-xs btn-default"  ng-click="rowform.$show()">
					          	<i class="glyphicon glyphicon-pencil"></i>
					          </button>
					        </div>  
					    </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>
			</div>
		</div>
	</div>
</div>