<div class="modal center" ng-controller="TeacherRelatedCourseCtrl">
<div class="modal-dialog">
	<div class="modal-content">
		<div class="modal-header">
			<button type="button" class="close" aria-label="Close"
				ng-click="$hide()">
				<span aria-hidden="true">×</span>
			</button>
			<h4 class="modal-title">关联课程 - {{curTeacher.name}}</h4>
		</div>
		
		<div class="modal-body">
				<span>已选中课程：</span>
				<span ng-repeat="row in curTeacher.courses" class="m-l">{{row.code}} - {{row.name}}</span> 
				<div class="form-inline m-t">
					<label>所有课程：</label>
					<div class="input-group">
			      		<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 table-bordered">
			  	<tr>
			  		<th class="col-sm-2">课程代码</th>
			  		<th class="col-sm-4">课程名称</th>
			  		<th>操作</th>
			 	</tr>
			 	<tr ng-repeat="row in pageModel.array">
			 		<td>{{row.code}}</td>
			 		<td>{{row.name}}</td>
					<td>
						<button ng-click="addRelation(row)" class="btn btn-primary btn-xs" ng-if="!row.related">
							<i class="glyphicon glyphicon-plus"> 关联</i>								
						</button>
						<button ng-click="removeRelation(row)" class="btn btn-danger btn-xs" ng-if="row.related">
							<i class="glyphicon glyphicon-remove"> 取消</i>								
						</button>
					</td>
			 	</tr>
			  </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"> 上一页</span></a>
			      	</li>
				    <li class="{{pageModel.curPage == pageModel.totalPage ? 'disabled' : ''}}" ng-click="goPage(pageModel.curPage + 1)">
				      	<a aria-label="Next"><span aria-hidden="true"> 下一页</span></a>
				    </li>
			    </ul>
		   	</nav>
	    </div>
	    
	    	<div class="modal-footer">
				<button type="submit" ng-click="$hide()" class="btn btn-default" >关闭</button>
			</div>
    
		</div>
	</div>
</div>
