<%@ 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() {
			
		});
		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}/charge/">计费列表</a></li>
		<shiro:hasPermission name="gateway:charge:edit"><li><a href="${ctx}/charge/form">计费添加</a></li></shiro:hasPermission>
	</ul>
	<form:form id="searchForm" modelAttribute="charge" action="${ctx}/charge/" 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>路由ID：</label>
				<form:input path="routeId" htmlEscape="false" maxlength="255" class="input-medium"/>
			</li>
			<li><label>应用ID：</label>
				<form:input path="appId" htmlEscape="false" maxlength="255" class="input-medium"/>
			</li>
			<li><label>用户ID：</label>
				<form:input path="userId" htmlEscape="false" maxlength="255" class="input-medium"/>
			</li>
			<li><label>计费方式：</label>
			<form:select path="chargeMethod" class="input-medium">
				<form:option value="" label="请选择"/>
				<form:options items="${fns:getDictList('charge_type')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
			</form:select>
			</li>
			<li class="btns"><input id="btnSubmit" class="btn btn-primary" type="submit" 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>路由ID</th>
				<th>应用ID</th>
				<th>用户ID</th>
				<th>计费方式</th>
				<th>计费值（次数/时长）</th>
				<th>已使用值</th>
				<th>剩余值</th>
				<%--<th>过期时间</th>--%>
				<th>生效时间</th>
				<th>备注</th>
				<th>创建时间</th>
				<th>创建人</th>
				<shiro:hasPermission name="gateway:charge:edit"><th>操作</th></shiro:hasPermission>
			</tr>
		</thead>
		<tbody>
		<c:forEach items="${page.list}" var="charge">
			<tr>
				<td>
					${charge.routeId}
				</td>
				<td>
					${charge.appId}
				</td>
				<td>
					${charge.userId}
				</td>
				<td>
						${fns:getDictLabel(charge.chargeMethod, 'charge_type', '')}
				</td>
				<td>
					${charge.chargeValue}
				</td>
				<td>
					${charge.usedValue}
				</td>
				<td>
					${charge.restValue}
				</td>
				<%--<td>
					<fmt:formatDate value="${charge.expiredTime}" pattern="yyyy-MM-dd HH:mm:ss"/>
				</td>--%>
				<td>
					<fmt:formatDate value="${charge.effectiveTime}" pattern="yyyy-MM-dd HH:mm:ss"/>
				</td>
				<td>
					${charge.remark}
				</td>
				<td>
					<fmt:formatDate value="${charge.createdAt}" pattern="yyyy-MM-dd HH:mm:ss"/>
				</td>
				<td>
					${charge.createdBy}
				</td>
				<shiro:hasPermission name="gateway:charge:edit"><td>
    				<a href="${ctx}/charge/form?id=${charge.id}">修改</a>
					<a href="${ctx}/charge/delete?id=${charge.id}" onclick="return confirmx('确认要删除该计费吗？', this.href)">删除</a>
				</td></shiro:hasPermission>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
</body>
</html>