<%@ page language="java" pageEncoding="utf-8"%>
<%@ taglib uri="/WEB-INF/taglib/c.tld" prefix="c"%>
<%@ include file="../common/init.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<%@ include file="../common/top.jsp"%>
</head>
<body class="easyui-layout">
	<%@ include file="../common/header.jsp"%>
	<%@ include file="../leftMenu/exam-admin.jsp"%>
	<div data-options="region:'center',title:'首页 -【考试管理】- 分析用户管理'">
		<div class="easyui-layout" data-options="fit:true,border:false">
			<div data-options="region:'north',border:false" class="domain">
				<c:if test="${message!=null}">
					<div class="curr-info alert alert-error ">
						<a class="close" data-dismiss="alert">×</a>${message }
					</div>
				</c:if>
				<form class="form-inline" action="${ctx}/admin/analysis/user" method="post" id="search-form">
					<input type="hidden" name="pageNumber" value="${query.pageNumber}" /> 
					<input type="hidden" name="pageSize" value="${query.pageSize}" /> 
					<span class="help-inline">登录名：</span> 
					<input class="input-small" name="loginName" type="text" value="${query.loginName}"/> 
					<span class="help-inline">角色：</span>
        			<select class="span2" name="roleName">
        				<option value="">不限</option>
        				<c:forEach items="${roles}" var="role">
	        			<option value="${role.name}" <c:if test="${roleName==role.name}">selected</c:if>>${role.display}</option>
        				</c:forEach>
        			</select>
					<button type="submit" class="btn">
						<i class="icon-search"></i> 查询
					</button>
					<a href="${ctx}/admin/analysis/user/add" class="btn btn-success"> 
						<i class="icon-plus icon-white"></i> 新建用户 
					</a>
				</form>
			</div>
			
			<div class="border" data-options="region:'center'">
				<div class="table-container col4">
					<div class="tab-header"> 
						<i class="list-text"><strong>登录名</strong></i>
						<i class="list-text"><strong>姓名</strong></i>
						<i class="list-text"><strong>角色</strong></i>
						<p class="list-edit"><strong>操作</strong></p>
					</div>
					<c:if test="${userList!=null}">
					<c:forEach var="user" items="${userList}">
					<div class="tab-list" data-id="${user.id}">
						<i class="list-text">${user.loginName}</i>
						<i class="list-text">${user.name}</i>
						<i class="list-text">${user.roleDisplays}</i>
						<p class="list-edit">
							<a href="${ctx}/admin/analysis/user/edit/${user.id}" class="btn btn-small btn-primary">编辑</a>
							<a href="javascript:void(0)" class="btn btn-small btn-danger" onclick="del(${user.id})">删除</a>
						</p>
					</div>
					</c:forEach>
					</c:if>
					
					<c:set var="pageNumber" value="${query.pageNumber}"></c:set>
					<%@ include file="../common/paginator.jsp"%>
				</div>
			</div>
		</div>
	</div>
</body>
<script type="text/javascript">
function del(userId) {
	$.messager.confirm('删除', '确定删除这个用户吗?', function(r) {
		if (r) {
			window.location.href = "${ctx}/admin/analysis/user/delete/" + userId;
		}
	});
}
</script>
</html>
