<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<meta http-equiv="content-type" content="text/html;charset=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" />
<link type="text/css" rel="stylesheet" href="assets/js/jquery/easyui/themes/bootstrap/easyui.css"/>
<script src="assets/admin/bootstrap/2.3.1/js/bootstrap.min.js" type="text/javascript"></script>
<script src="assets/admin/bootstrap/2.3.1/js/bootstrap.min.js" type="text/javascript"></script>
<script src="assets/js/chajian.js"></script>
<script type="text/javascript">
$(document).ready(function() {
	var arg = new Array();
	arg='${page.list}';
	console.log(arg)
	if(arg=='[]'){  
		$.messager.alert("提示","当前查询条件暂无数据","info")
	}
});
function page(n,s){
	searchlist(n,s);
}
function searchlist(n,s){
	var departurePort=$("#departurePort").val().trim();
	var arrivalPort=$("#arrivalPort").val().trim();

	var flag1=false,flag2=false;
	for(var k=0;k<departurePort.length;k++){  
	     if ((!/^\s+$/g.test(departurePort.charAt(k)))&&(!/^[\u4e00-\u9fa5]+$/.test(departurePort.charAt(k)))&&(!departurePort.charAt(k).match(/\d+/g))&&(!/^[A-Za-z]+$/.test(departurePort.charAt(k)))){   
	    	 flag1=true;
	    	break;
		 }   
    }
	for(var k=0;k<arrivalPort.length;k++){  
	     if ((!/^\s+$/g.test(arrivalPort.charAt(k)))&&(!/^[\u4e00-\u9fa5]+$/.test(arrivalPort.charAt(k)))&&(!arrivalPort.charAt(k).match(/\d+/g))&&(!/^[A-Za-z]+$/.test(arrivalPort.charAt(k)))){   
	    	 flag2=true;
	    	break;
		 }   
   }
	if(flag1||flag2){  
		  $.messager.alert("提示","您输入的数据含有非法字符！","info");
		  if(flag1){
			  $("#departurePort").val("");
		  }
		  if(flag2){
			  $("#arrivalPort").val("");
		  }
		 return false;     
	}     
	else{
	   	 $("#pageNo").val(n);
	   		$("#pageSize").val(s);
	   		var url="table/getFerryList?departurePort="+encodeURI(departurePort)+"&arrivalPort="+encodeURI(arrivalPort)+"&pageNo="+n+"&pageSize="+s;
	   	 	loadPage(url); 
     } 
  
}


</script>
<div class="about_top">
	当前位置: 轮渡码头
</div>

<!-- about_form -->
<div class="about_form">
	<form:form method="post" action="table/getFerryList" id="ferrySearchForm" class="breadcrumb form-search" modelAttribute="fs">
		<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="departurePort" path="departurePort" value="${departurePort}" htmlEscape="false" maxlength="50" class="input_text"/>&nbsp;
		<label style="margin-left: 3%;">到达港口：</label><form:input id="arrivalPort" path="arrivalPort" value="${arrivalPort}" htmlEscape="false" maxlength="50" class="input_text"/>&nbsp;
		<p class="last">
			<button type="button" onclick="searchlist('','')" class="searchbutton" ><a >查询</a></button>
		</p>
	</form:form>
</div>

<!-- 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="ferryship">
		<tr>
			<td>${ferryship.departurePort}</td>
			<td>${ferryship.shipNumber}</td>
			<td>${ferryship.departureTime}</td>
			<td>${ferryship.arrivalTime}</td>
			<td>${ferryship.arrivalPort}</td>
		</tr>
	</c:forEach>
	</tbody>
</table>
<div class="pagination">${page}</div>


<div class="bottom" >
	<p>以上数据仅供参考，以实际公布信息为准！</p>
</div>
</div>