#include("./header.html", {active:'users', title:'用户管理'})
<div class=main-content>
	<div class="panel mb25">
		<div class="panel-heading">用户列表</div>
		<div class="panel-body">
			<div class="table-responsive">
				<div class="row">
					<div class="pull-left pl10">
						<form action="${base_url('/admin/users')}" method="post">
							<label>
								<input type="search" class="form-control" name="email" placeholder="搜索..." value="${email}"/>
							</label>
							<button type="submit" class="btn btn-icon-icon btn-sm btn-google-plus btn-round"><i class="fa fa-search"></i></button>
						</form>
					</div>
				</div>
				<table class="table table-bordered table-striped mb0">
					<thead>
						<tr>
							<th width="20%">用户名</th>
							<th width="20%">用户邮箱</th>
							<th width="20%">注册日期</th>
							<th width="20%">用户状态</th>
							<th  align="center">操作</th>
						</tr>
					</thead>
					<tbody class="user-table">
						#for(user : userPage.results)
						<tr>
							<td>
								<a href="${base_url('/member/') + user.login_name}" target="_blank">${user.login_name}</a>
							</td>
							<td>${user.email}</td>
							<td>${fmtdate(user.create_time, 'yyyy-MM-dd HH:mm')}</td>
							<td>
								#if(user.status == 0)
								未激活
								#elseif(user.status == 1)
								正常
								#elseif(user.status == 2)
								已拉黑
								#end
							</td>
							<td>
								#if(user.status == 0)
									<a href="javascript:;" uid="${user.uid}" class="btn btn-danger btn-outline btn-sm activeAccount">激活账户</a>
								#elseif(user.status == 1)
									<a href="javascript:;" uid="${user.uid}" class="btn btn-danger btn-outline btn-sm disable">拉黑</a>
									#if(user.role_id == 3)
										<a href="javascript:;" uid="${user.uid}" class="btn btn-danger btn-outline btn-sm removeAdmin">取消管理员</a>
									#else
										<a href="javascript:;" uid="${user.uid}" class="btn btn-danger btn-outline btn-sm setAdmin">设置管理员</a>
									#end
								#elseif(user.status == 2)
									<a href="javascript:;" uid="${user.uid}" class="btn btn-danger btn-outline btn-sm recoveryAccount">恢复账户</a>
								#end
							</td>
						</tr>
						#end
					</tbody>
				</table>
			</div>
			<div class="datatable-bottom pt10">
				<div class="pull-right">
					#if(userPage.totalPage > 1)
					<ul class="pager">
						#if(userPage.page > 1)
						<li class="pull-left"><a href="${base_url('/admin/users?p=') + userPage.prev_page}">上一页</a></li>
						#end
						#if(userPage.totalPage > 1 && userPage.page != userPage.totalPage)
						<li class="pull-right"><a href="${base_url('/admin/users?p=') + userPage.next_page}">下一页</a></li>
						#end
					</ul>
					#end
				</div>
			</div>
		</div>
	</div>
</div>
#include("./footer.html")
</body>
</html>