<%@ page language="java" errorPage="/error.jsp" pageEncoding="UTF-8"
	contentType="text/html; charset=UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<!-- bootstrap 3.0.2 -->
<link href="<c:url value='/styles/lib/bootstrap.min.css'/>"
	rel="stylesheet" type="text/css" />
<link href="<c:url value='/styles/lib/font-awesome.min.css'/>"
	rel="stylesheet" type="text/css" />
<link href='<c:url value='/styles/lib/ionicons.min.css' />'
	rel="stylesheet" type="text/css" />
<link
	href="<c:url value='/styles/lib/datatables/dataTables.bootstrap.css' />"
	rel="stylesheet" type="text/css" />
<link href="<c:url value='/styles/AdminLTE.css'/>" rel="stylesheet"
	type="text/css" />
<script src="${ctx }/scripts/lib/jquery-1.8.2.min.js"></script>
<script type="text/javascript">
	$(function(){
		$("#btn-search").click(function(){
			$("#conditionform").submit();
		});
	});
	
	function dele(id){
		if(confirm("确定删除？")){
			window.location.href="deleteTbCompany/"+id+"&"+$("#funcid").val();
		}	
	}
	function goPage(pageNo){
		if(pageNo=="gopage"){
			$("#pageNo").val($("#gopage").val());
		}else{
			$("#pageNo").val(pageNo);
		}
		$("#conditionform").submit();
	}
</script>
<style type="text/css">
th {
	text-align: center;
}

td {
	text-align: center;
	vertical-align: middle;
}
</style>
</head>
<body>
	<input type="hidden" id="funcid" value="${funcid}">
	<section class="content">
		<div class="row">
			<div class="col-xs-12">
				<div class="boxlist">
					<!-- /.box-header -->
					<div class="box-body table-responsive">
						<form:form id="conditionform"
							action="${ctx}/admin/organization/companylist?funcid=${funcid}" method="POST">
							<div class="form-group">
								<label>关键字</label> 
								<input type="text" name="keyName" placeholder="请输入运营中心名称或者编码" value="${keyName}" style="width: 250px;">
							</div>
							
						</form:form>
						<div  class="form-search-wp"> 
						<button class="btn btn-red"
								href="#" id='btn-search'>查询</button>
								<perm:hasPermission permCode="pc:organization:company:add">
								<button class="btn btn-white" onclick="window.location.href='<c:url value='/admin/organization/companyForm?funcid=${funcid}' />'">新增</button>
								</perm:hasPermission>
							</div>
						<table class="table table-bordered table-hover" id="dataareaid">
							<thead>
								<tr>
									<th>序号</th>
									<th>运营中心名称</th>
									<th>编码</th>
									<th>联系电话</th>
									<th>具体地址</th>
									<th>创建人</th>
									<th>创建时间</th>
									<th>操作</th>
								</tr>
							</thead>
							<tbody>
								<c:forEach items="${page.items }" var="obj" varStatus="status">
									<tr>
										<td width="5%">${ (page.currentPage-1)*page.pageSize+(status.index+1)}</td>
										<td>${obj.name}</td>
										<td>${obj.code}</td>
										<td>${obj.telePhone}</td>
										<td>${obj.address}</td>
										<td>${obj.creator}</td>
										<td><fmt:formatDate value="${obj.createTime}" pattern="yyyy-MM-dd  HH:mm:ss" /></td>
										<td>
											<perm:hasPermission permCode="pc:organization:company:edit">
												<a href="updateTbCompany/${obj.id}&${funcid}" title="修改">
	                                        		<span style="text-decoration:underline">修改</span>
	                                    		</a>
											</perm:hasPermission>
											<perm:hasPermission permCode="pc:organization:company:delete">
	                                    		<a href="javascript:dele('${obj.id}');" title="删除">
	                                    			<span style="text-decoration:underline">删除</span>
	                                    		</a>
											</perm:hasPermission>
                                    	</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-red" href="javascript:goPage('gopage');" id='bindBtn'>确定</a>
		                	</div>
			            </div>
					</div>
				</div>
			</div>
		</div>
	</section>
</body>
</html>