<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>单表管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
			$('#updateCacheId').click(function() {
			    debugger
			    location.href="${ctx}/blackWhite/updateCache";
			})
		});
		function page(n,s){
			$("#pageNo").val(n);
			$("#pageSize").val(s);
			$("#searchForm").submit();
        	return false;
        }
	</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li class="active"><a href="${ctx}/blackWhite/">黑白名单列表</a></li>
		<shiro:hasPermission name="blackWhite:blackWhiteList:edit"><li><a href="${ctx}/blackWhite/form">黑白名单添加</a></li></shiro:hasPermission>
	</ul>
	<form:form id="searchForm" modelAttribute="blackWhiteList" action="${ctx}/blackWhite/list" method="post" class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		<ul class="ul-form">
			<li><label>名单类型：</label>
				<form:select path="listType" class="input-medium">
					<form:option value="" label="请选择"/>
					<form:options items="${fns:getDictList('list_type')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
				</form:select>
			</li>
			<li><label>IP：</label>
				<form:input path="ip" htmlEscape="false" maxlength="255" class="input-medium"/>
			</li>
			<li class="btns"><input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/></li>
			<li class="btns"><input id="updateCacheId" class="btn btn-primary" type="button" value="同步缓存"/></li>
			<li class="clearfix"></li>
		</ul>
	</form:form>
	<sys:message content="${message}"/>
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
				<th>名单类型</th>
				<th>IP</th>
				<th>用户ID</th>
				<th>生效时间</th>
				<th>过期时间</th>
				<th>创建时间</th>
				<th>创建人</th>
				<%--<th>删除时间</th>
				<th>删除人</th>--%>
				<shiro:hasPermission name="blackWhite:blackWhiteList:edit"><th>操作</th></shiro:hasPermission>
			</tr>
		</thead>
		<tbody>
		<c:forEach items="${page.list}" var="blackWhiteList">
			<tr>
				<td><a href="${ctx}/blackWhite/form?id=${blackWhiteList.id}">
					${blackWhiteList.listType}
				</a></td>
				<td>
					${blackWhiteList.ip}
				</td>
				<td>
					${blackWhiteList.userId}
				</td>
				<td>
					<fmt:formatDate value="${blackWhiteList.effectiveTime}" pattern="yyyy-MM-dd HH:mm:ss"/>
				</td>
				<td>
					<fmt:formatDate value="${blackWhiteList.expiredTime}" pattern="yyyy-MM-dd HH:mm:ss"/>
				</td>
				<td>
					<fmt:formatDate value="${blackWhiteList.createdAt}" pattern="yyyy-MM-dd HH:mm:ss"/>
				</td>
				<td>
					${blackWhiteList.createdBy}
				</td>
				<%--<td>
					<fmt:formatDate value="${blackWhiteList.deletedAt}" pattern="yyyy-MM-dd HH:mm:ss"/>
				</td>
				<td>
					${blackWhiteList.deletedBy}
				</td>--%>
				<shiro:hasPermission name="blackWhite:blackWhiteList:edit"><td>
    				<a href="${ctx}/blackWhite/form?id=${blackWhiteList.id}">修改</a>
					<a href="${ctx}/blackWhite/delete?id=${blackWhiteList.id}" onclick="return confirmx('确认要删除该黑白名单吗？', this.href)">删除</a>
				</td></shiro:hasPermission>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
</body>
</html>