<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/views/admin/include/taglib.jsp"%>
<link href="assets/admin/bootstrap/2.3.1/css_cerulean/bootstrap.min.css" type="text/css" rel="stylesheet" />
<link href="assets/admin/bootstrap/2.3.1/awesome/font-awesome.min.css" type="text/css" rel="stylesheet" />
<script src="assets/admin/bootstrap/2.3.1/js/bootstrap.min.js" type="text/javascript"></script>
<link type="text/css" rel="stylesheet" href="assets/js/jquery/easyui/themes/bootstrap/easyui.css"/>
<script type="text/javascript">
$(document).ready(function() {
	var arg = new Array();
	arg='${page.list}';
	if(arg=='[]'){  
		$.messager.alert("提示","当前查询条件暂无数据","info")
	}
});
function page(n,s){
	searchlist(n,s);
}
function searchlist(n,s){
	var STATIONNAME=$("#STATIONNAME").val().trim();
	var LOCATION=$("#LOCATION").val().trim();
// 	STATIONNAME=STATIONNAME.replace(/\s/g, "");
// 	LOCATION=LOCATION.replace(/\s/g, "");
	
	
	var flag1=false,flag2=false;
	for(var k=0;k<STATIONNAME.length;k++){  
	     if ((!/^\s+$/g.test(STATIONNAME.charAt(k)))&&(!/^[\u4e00-\u9fa5]+$/.test(STATIONNAME.charAt(k)))&&(!STATIONNAME.charAt(k).match(/\d+/g))&&(!/^[A-Za-z]+$/.test(STATIONNAME.charAt(k)))){   
	    	 flag1=true;
	    	break;
		 }   
    }
	for(var k=0;k<LOCATION.length;k++){  
	     if ((!/^\s+$/g.test(LOCATION.charAt(k)))&&(!/^[\u4e00-\u9fa5]+$/.test(LOCATION.charAt(k)))&&(!LOCATION.charAt(k).match(/\d+/g))&&(!/^[A-Za-z]+$/.test(LOCATION.charAt(k)))){   
	    	 flag2=true;
	    	break;
		 }   
   }
	if(flag1||flag2){  
		  $.messager.alert("提示","您输入的数据含有非法字符！","info");
		  if(flag1){
			  $("#STATIONNAME").val("");
		  }
		  if(flag2){
			  $("#LOCATION").val("");
		  }
		 return false;     
	}     
	else{
		$("#pageNo").val(n);
		$("#pageSize").val(s);
		var url="table/getPbsGridData?stationName="+encodeURI(STATIONNAME)+"&location="+encodeURI(LOCATION)+"&pageNo="+n+"&pageSize="+s;
		loadPage(url);  
	}
}
</script>
<div class="about_top">
	当前位置: 公共自行车
</div>

<!-- about_form -->
<div class="about_form">
	<form:form method="post" action="table/getPbsGridData" id="pbSearchForm" class="breadcrumb form-search" modelAttribute="pbs">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		<label>站点名称：</label><form:input id="STATIONNAME" path="stationName" value="${stationName}" htmlEscape="false" maxlength="50" class="input_text"/>&nbsp;
		<label style="margin-left: 3%;">地址：</label><form:input id="LOCATION" path="location" value="${location}" htmlEscape="false" maxlength="50" class="input_text"/>&nbsp;
		<p class="last">
		<button type="button" onclick="searchlist('','')" class="searchbutton" ><a >查询</a></button>
<!-- 		style="color:#fff;position: absolute;right: 34px;top: 7px" -->
		</p>
	</form:form>
</div>


<div class="cont">
<!-- grid-->
<table id="contentTable" class="table table-striped table-bordered table-condensed" style="width:98%">
	<thead><tr><th>站点名称</th><th>地址</th><th>最大自行车数（辆）</th><th>可借数（辆）</th><th>可还数（辆）</th></tr></thead>
	<tbody>
	<c:forEach items="${page.list}" var="pbStation">
		<tr>
			<%-- <td>${pbStation.stationId}</td> --%>
			<td>${pbStation.stationName}</td>
			<td>${pbStation.location}</td>
			<td>${pbStation.capacity}</td>
			<td>${pbStation.availbleBike}</td>
			<td>${pbStation.capacity - pbStation.availbleBike}</td>
		</tr>
	</c:forEach>
	</tbody>
</table>
<%-- <div class="pagination2">${page}</div> --%>
<div class="pagination" >${page}</div>
	
<div class="bottom" >
	<p>以上数据仅供参考，以实际公布信息为准！</p>
</div>
</div>