<div class="wrapper">
	<div class="panel panel-default">
		<div class="panel-body">
			<div class="form-inline">
				<div>
					<div class="form-group">
						<label>状态</label>
						<select class="form-control" ng-model="search.statusCode">
							<option value=""></option>
				      		<option ng-repeat="item in status" value="{{item.itemType}}">
				      			{{item.itemCode}}
			      			</option>
		      			  </select>
					</div>
					<div class="form-group">
						<label>课程</label>
						<select class="form-control" ng-model="search.courseId" style="width:200px;" ng-change="changeCourse()">
							<option value=""></option>
				      		<option ng-repeat="item in courses" value="{{item.id}}">
				      			{{item.code}} - {{item.name}}
			      			</option>
		      			  </select>
		      			  
		      			  <button class="btn btn-success btn-xs" ng-if="auditTask && search.courseId" ng-click="showAuditStatsModal()">审核统计</button>
					</div>
					<div class="form-group">
						<label>题型</label>
						<select class="form-control" ng-model="search.typeId" style="width:150px;">
							<option value=""></option>
				      		<option ng-repeat="item in questionTypes" value="{{item.id}}">
				      			{{item.name}}
			      			</option>
		      			  </select>
					</div>
					<div class="form-group">
						<label>教材</label>
						<select class="form-control" ng-model="search.bookId" style="width:150px;">
							<option value=""></option>
				      		<option ng-repeat="item in books" value="{{item.id}}">
				      			{{item.name}}
			      			</option>
		      			  </select>
					</div>
					<div class="form-group">
						<label>知识点</label>
						<input type="number" class="form-control" ng-model="search.chapter" placeholder="章" style="width:60px;">
						<input type="number" class="form-control" ng-model="search.section" placeholder="节" style="width:60px;">
						<input type="number" class="form-control" ng-model="search.item" placeholder="目" style="width:60px;">
						<input type="number" class="form-control" ng-model="search.page2" placeholder="页" style="width:60px;">
					</div>
				</div>
				<div class="m-t">
					<div class="form-group">
						<label>能力要求</label>
						<select class="form-control" ng-model="search.abilityCode">
							<option value=""></option>
				      		<option ng-repeat="item in codes | filter:{itemType: 'ABILITY'}" value="{{item.itemCode}}">
				      			{{item.itemValue}}
			      			</option>
		      			  </select>
					</div>
					<div class="form-group">
						<label>考核要求</label>
						<select class="form-control" ng-model="search.assessmentDemand">
							<option value=""></option>
				      		<option ng-repeat="item in codes | filter:{itemType: 'ASSESSMENT_DEMAND'}" value="{{item.itemCode}}">
				      			{{item.itemValue}}
			      			</option>
		      			  </select>
					</div>
					<div class="form-group">
						<label>预计难度</label>
						<select class="form-control" ng-model="search.estimateDifficultyCode">
							<option value=""></option>
				      		<option ng-repeat="item in codes | filter:{itemType: 'QUESTION_DIFFICULTY'}" value="{{item.itemCode}}">
				      			{{item.itemValue}}
			      			</option>
		      			  </select>
					</div>
					<div class="input-group col-md-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>
					<button class="btn btn-primary">
						<i class="glyphicon glyphicon-search" ng-click="goPage(1)"> 查询</i>
					</button>
					<!-- <button ui-sref="toInput.add" class="btn btn-primary">
						<i class="glyphicon glyphicon-plus"> 添加试题</i>
					</button> -->
					<!-- <select class="form-control">
	      				<option  class="btn btn-primary">
	      					<i class="glyphicon glyphicon-plus"> 添加试题</i>
	      				</option>
	      				<option ng-change="openClientForAdd(row.id)" class="btn btn-primary">
	      					<i class="glyphicon"> 录题客户端</i>
	      				</option>
     				</select> -->
						<div class="btn-group" ng-if="!auditTask">
							<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
							    添加试题 <span class="caret"></span>
							  </button>
							  <ul class="dropdown-menu">
							    <li ui-sref="toInput.add"><a>添加试题</a></li>
								<li ng-click="openClientForAdd(search.courseId)"><a href="#"> 录题客户端</a></li>
							</ul>
						</div>
				</div>				
			</div>
			<div class="alert alert-success m-t-xs" role="alert">满足条件的试题数量为：{{pageModel.total}}</div>
			<table class="table table-striped">
				<thead>
					<tr>
						<th class="col-md-1">题号</th>
						<th class="col-md-2">试题属性</th>
						<th class="col-md-3">试题</th>
						<th class="col-md-1">状态</th>
						<th class="col-md-2">操作</th>
					</tr>										
				</thead>
				<tbody>
					<tr ng-repeat="row in pageModel.array">
						<td>{{row.questionNo}}</td>
						<td>
							<div>题型：{{row.typeName}}</div>
							<div>分值：{{row.score}}</div>
							<div>课程：{{(courses | filter:{id: row.courseId})[0].code}} - {{row.courseName}}</div>
							<div>教材：{{row.bookName}}</div>
							<div>知识点：{{row.chapter}}章{{row.section}}节{{row.item}}目{{row.page}}页</div>
							<div>能力要求：{{(codes | filter:{itemCode: row.abilityCode, itemType: 'ABILITY'})[0].itemValue}}</div>
							<div>考核要求：{{(codes | filter:{itemCode: row.assessmentDemand, itemType: 'ASSESSMENT_DEMAND'})[0].itemValue}}</div>
							<div>预计难度：{{(codes | filter:{itemCode: row.estimateDifficultyCode, itemType: 'QUESTION_DIFFICULTY'})[0].itemValue}}</div>
							<div>命题教师：{{row.setTeacherName}}</div>
							<div>命题时间：{{row.setTime | date:'yyyy-MM-dd'}}</div>
							<div>启用时间：{{row.enableTime | date:'yyyy-MM'}}</div>
						</td>
						<td>
							<div style="font-family: 宋体" data-ng-bind-html="row.body"></div>
							<table style="width: 100%;" ng-if="row.options != null && row.options.length > 0">
								<tr class="{{option.isCorrectOption ? 'list-group-item-success' : ''}}" ng-repeat="option in row.options">
									<td style="width: 20px;vertical-align: middle;padding-top: 6px;padding-bottom: 6px;">{{option.optionNo | optionNoStr}}.</td>
									<td style="text-align: left;padding-top: 6px;padding-bottom: 6px;"><span style="font-family: 宋体" data-ng-bind-html="option.content"></span></td>
								</tr>
							</table>
							<div ng-if="row.answer" class="m-t">
								答案与解析：<span style="font-family: 宋体" data-ng-bind-html="row.answer"></span>
							</div>
						</td>
						<td class="{{row.status == 1 ? 'text-success' : 'text-danger'}}">{{(status | filter: {'itemType' : row.statusCode})[0].itemCode}}</td>
						<td>
							<div class="btn-group">
							  <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
							    编辑 <span class="caret"></span>
							  </button>
							  <ul class="dropdown-menu">
							    <li ng-click="edit(row.id)"><a>编辑</a></li>
							    <li ng-click="openClientForEdit(row.id)"><a href="#"> 录题客户端</a></li>
							  </ul>
							</div>
							<button class="btn btn-info btn-xs" ng-if="auditTask" ng-click="showWorkflowAuditModal(row.id)">审核</button>
							<button class="btn btn-default btn-xs" ng-if="auditTask" ng-click="showAuditLogModal(row.id)">日志</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>
			</div>
			<div style="display:none;"><iframe id="iframeForClient" ng-src="{{iframeUrl}}"></iframe></div>
		</div>
	</div>
</div>