<%@ page language="java" errorPage="/error.jsp" pageEncoding="UTF-8" contentType="text/html; charset=UTF-8" %>
<%@ include file="/common/taglibs.jsp"%>
<!DOCTYPE html>
<html>
<head>
<!-- bootstrap 3.0.2 -->
<link href="<c:url value='/styles/lib/bootstrap.min.css'/>" rel="stylesheet" type="text/css" />
<!-- font Awesome -->
<link href="<c:url value='/styles/lib/font-awesome.min.css'/>" rel="stylesheet" type="text/css" />
<!-- Ionicons -->
<link href='<c:url value='/styles/lib/ionicons.min.css' />' rel="stylesheet" type="text/css" />
<!-- DATA TABLES -->
<link href="<c:url value='/styles/lib/datatables/dataTables.bootstrap.css' />" rel="stylesheet" type="text/css" />
<!-- Theme style -->
<link href="<c:url value='/styles/AdminLTE.css'/>" rel="stylesheet" type="text/css" />
<!-- date -->
<link rel="stylesheet" type="text/css" href="${ctx}/scripts/js_datetime/date.css" />
<script src="${ctx }/scripts/lib/jquery-1.8.2.min.js"></script>
<script type="text/javascript" src="<c:url value='/scripts/loading/jquery.blockUI.js'/>"></script>
<script type="text/javascript" src="<c:url value='/scripts/loading/loading.js'/>"></script>
<script type="text/javascript">
	function bindstaff(staffid){
		var contextPath =$("#contextPath").val();
		var wxuserid =$("#id").val();
		var funcid=$("#funcid").val();
		location.href=contextPath+"/admin/staffBind/bindstaff?wxuserid="+wxuserid+"&staffid="+staffid+"&funcid="+funcid;
	}
	
	//翻页
	function goPage(pageNo){
		showBlock();
		if(pageNo=="gopage"){
			$("#pageNo").val($("#gopage").val());
		}else{
			$("#pageNo").val(pageNo);
		}
		$("#conditionform").submit();
	}
</script>
</head>
<body>
	<input type="hidden" value="${ctx}" id="contextPath"> 
	<input type="hidden" value="${funcid}" id="funcid"> 
	<section>
		<div class="row">
			<div class="col-xs-12">
				<div class="boxlist">
					<!-- /.box-header -->
					<div class="box-body table-responsive">
						<form:form modelAttribute="scComplain"
							action="${ctx}/admin/staffBind/prebind?funcid=${funcid }" method="POST" id="conditionform">
							<input type="hidden" id="pageNo" name="pageNo" />
							<input type="hidden" id="id" name="id" value="${obj.id }" />
							<input type="hidden" id="organizationId" name="organizationId" value="${organizationId }" />
							<div class="form-group">
								<label>姓名</label>
								<input id="staffName" name="staffName" value="${staffName }" /> 
								<label>工号</label>
								<input id="staffNo" name="staffNo" value="${staffNo }" /> 
							</div>
							<span style="float:right;">
								<button class="btn btn-default" type="button" onclick="goPage('<c:url value='/admin/staffBind/prebind'/>',1);">查询</button>
								<a class="btn btn-default" href="${ctx }/admin/staffBind/query?funcid=${funcid }" >返回</a>
							</span>
						</form:form>
						<table class="table table-bordered table-hover" id="dataareaid">
							<thead>
								<tr>
									<th>姓名</th>
									<th>工号</th>
									<th>手机号</th>
									<th width="10%">绑定</th>
								</tr>
							</thead>
							<tbody>
								<c:forEach items="${page.items }" var="obj">
									<tr>
										<td>${obj.name }</td>
										<td>${obj.staffNo }</td>
										<td>${obj.userMobile }</td>
										<td><button class="btn-sm btn-success" type="button" onclick="bindstaff(${obj.id });">绑定</button></td>
									</tr>
								</c:forEach>
							</tbody>
						</table>
						
						<div class="btn-page">
		                    <!-- 页码 -->
		                    <div align="center" class="pages clearfix">
		                           <c:forEach items="${page.iterPages }" var="pageNo">
									<c:choose>
										<c:when test="${pageNo == page.currentPage }">
											<span class='current'>${pageNo }</span>
										</c:when>
										<c:when test="${pageNo != null}">
											<a href="javascript:void(0);" onclick='goPage(${pageNo});'>${pageNo}</a>
										</c:when>
										<c:otherwise>
											<em>...</em>
										</c:otherwise>
									</c:choose>
								</c:forEach>
								<strong>共<span style="color:black;font-weight:bold;font-size:16px;">${page.totalCount}</span>条</strong>
								<strong>跳转到第</strong><input type="text" id="gopage" style="width: 40px;" onkeyup="this.value=this.value.replace(/\D/g,'')" onkeypress="this.value=this.value.replace(/\D/g,'')"/><strong>页</strong>
								<a class="btn-sm btn-success" href="javascript:goPage('gopage');" id='bindBtn'>确定</a>
		                	</div>
			            </div>
			            
					</div>
				</div>
			</div>
		</div>
	</section>
</body>
</html>