<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<!DOCTYPE html>
<html>
<head>
<title>商城管理</title>
<meta
	content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no'
	name='viewport'>
<!-- 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" />
<link rel="stylesheet" type="text/css" href="<c:url value='/styles/site/resource_edit.css' />" />
<!-- Theme style -->
<link href="<c:url value='/styles/AdminLTE.css'/>" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<c:url value='/scripts/lib/jquery-1.8.2.min.js'/>"></script>
<script type="text/javascript">
	$(function(){
		$("#btn-search").click(function(){
			$("#conditionform").submit();
		});
	});
	
	function goPage(pageNo){
		if(pageNo=="gopage"){
			$("#pageNo").val($("#gopage").val());
		}else{
			$("#pageNo").val(pageNo);
		}
		$("#conditionform").submit();
	}
	
	function initaddSiteProperty(propertyId){
		window.location.href="../site/initaddSiteProperty?propertyId="+propertyId;
	}
	
	//删除场地属性
	function sitePropertyDelete(id){
		$.ajax({
			type : 'POST',
			url : '../site/sitePropertyDelete',
			data:{"id":id},
			dataType : 'json',// 返回值类型 一般设置为json
			success : function(data) // 服务器成功响应处理函数
			{
				if(data.code == '0'){
					alert(data.msg);
					window.location.href="../site/findSiteResourceList";
				}else{
					alert(data.msg);
				}
			}
		});
	}
</script>
</head>
<body>
	<section class="content">
		<div class="row">
			<div class="col-xs-12">
				<div class="boxlist">
					<!-- /.box-header -->
					<div class="box-body table-responsive">
							<!-- 查询条件 -->
			        <form class="query_frame form-inline" role="form" id="conditionform" action="<c:url value='/admin/shoppingMall/list' />" method="POST">
			            <input id="pageNo" name="pageNo" type="hidden"/>
			            <div class="form-group">
			                <label for="">所属校区名称</label>
			                <input type="text" id="mallName" name="mallName" value="${mallName}" placeholder="请输入所属校区名称查询"/>
			            </div>
			            <div class="form-group">
			                <label for="">商城url名称</label>
			                <input type="text" id="orgName" name="orgName" value="${orgName}" placeholder="请输入商城url名称查询"/>
			            </div>
			        </form>
			        </div>
							<!-- 按钮组 -->
	            <div class="form-search-wp">
	                <button class="btn-red js_btn_reserve" = onclick="window.location.href='../shoppingMall/toAddMallUrl'" title="添加商城url">添加商城url</button>
	                <button id="btn-search" class="btn btn-white" >查询</button>
	            </div>
		<table class="table table-bordered table-hover">
		<thead>	
		<tr>
            <th>登录商城url名称</th>
            <th>所属校区名称</th>
            <th>url唯一key</th>
            <th>商城唯一code</th>
            <th>状态</th>
            <th>操作</th>
        </tr>
	</thead>
	<tbody>
		<c:forEach items="${page.items}" var="list" varStatus="status">
			<tr>
				<td nowrap="nowrap">${list.mallName}</td>
				<td nowrap="nowrap">${list.orgName}</td>
				<td nowrap="nowrap">${list.urlKey}</td>
				<td nowrap="nowrap">${list.addressCode}</td>
				<td nowrap="nowrap">
					<c:if test="${list.isEnabled == '0'}">禁用</c:if>
					<c:if test="${list.isEnabled == '1'}">启用</c:if>
				</td>
				<td>
               		<a href="../shoppingMall/toAddMallUrl?id=${list.id}" class="btn-table btn-gray" title="编辑">
               			编辑
               		</a>
               		<a href="javascript:updateMall('${list.id}')" class="btn-table btn-red" title="删除">
               			<c:if test="${list.isEnabled == '0'}">启用</c:if>
						<c:if test="${list.isEnabled == '1'}">禁用</c:if>
               		</a>
               	</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>
					<!-- /.box-body -->
				</div>
			</div>
		</div>
	</section>
</body>
</html>