<!DOCTYPE HTML>
<html>
<head>
<#include "/common.html"/>
<style type="text/css">
.layui-form-label {
	width: 140px;
}

.layui-input-block {
	margin-left: 170px;
}
</style>

</head>
<body class="layui-layout-body">
	<div class="layui-layout layui-layout-admin">

		<#include "/header.html"/>
		<#include "/menu.html"/>

		<div class="layui-body">
			<!-- 内容主体区域 -->
			<div style="padding: 15px">
				<fieldset class="layui-elem-field layui-field-title">
					<legend>演示模块</legend>
				</fieldset>

				<form action="${ctx}/examplePage/example" id="searchForm" method="post">
					<div class="layui-form">
						<div class="layui-inline">
							<button type="button" class="layui-btn layui-btn-normal layui-btn-sm" onclick="add()">添加模块</button>
						</div>
						
						<div class="layui-inline">
							<label class="layui-form-label" style="width: 70px;">关键字</label>
							<div class="layui-input-inline" style="width: 150px;">
								<input type="text" name="keyword" value="${keyword}" class="layui-input">
							</div>
						</div>
						
						<div class="layui-inline">
							<button type="button" class="layui-btn layui-btn-sm" onclick="search()">搜索</button>
						</div>
						
						
						<input type="hidden" name="pageNum" value="${page.pageNum}"> 
						<input type="hidden" name="pageSize" value="${page.pageSize}">
					</div>
				</form>

				<table class="layui-table" lay-size="sm">
					<thead>
						<tr>
							<th>模块名称</th>
							<th>描述</th>
							<th>所属管理员</th>
							<th>操作</th>
						</tr>
					</thead>
					<tbody>
						<#list page.list as example>
						<tr>
							<td>${example.name}</td>
							<td>
								${example.descr}
							</td>
							<td>
								${example.admin.name}
							</td>
							
							<td>
								<div class="layui-inline">
									<button class="layui-btn layui-btn-sm" onclick="edit('${example.id}')">编辑</button>
								</div>
								<div class="layui-inline">
									<button class="layui-btn layui-btn-danger layui-btn-sm" onclick="del('${example.id}')">删除</button>
								</div>
							</td>
						</tr>
						</#list>
					</tbody>
				</table>
				<div id="pageInfo"></div>
				
				<#include '/copyright.html'/>
			</div>
		</div>
	</div>

	<div style="height: 0px; width: 0px; overflow: hidden;">
		<!-- 弹出框 -->
		<div class="layui-form" id="windowDiv" style="padding: 15px; display: none">
			<form id="addForm">
				<input type="hidden" name="id" id="id">

				<div class="layui-form-item">
					<label class="layui-form-label">模块名称</label>
					<div class="layui-input-inline">
						<input type="text" name="name" id="name" class="layui-input" autocomplete="off">
					</div>
				</div>
				
				<div class="layui-form-item">
					<label class="layui-form-label">描述</label>
					<div class="layui-input-inline">
						<textarea name="descr" id="descr" class="layui-textarea" autocomplete="off"></textarea>
					</div>
				</div>
				
				<div class="layui-form-item">
					<label class="layui-form-label">所属管理员</label>
					<div class="layui-input-inline">
						<select name="adminId" id="adminId" class="layui-input" autocomplete="off">
							<#list adminList as admin>
								<option value="${admin.id}">${admin.name}</option>
							</#list>
						</select>
					</div>
				</div>
				
				<div class="layui-form-item center">
					<button type="button" class="layui-btn layui-btn-normal layui-btn-sm" onclick="addOver()">提交</button>
					<button type="button" class="layui-btn layui-btn-sm" onclick="layer.closeAll()">关闭</button>
				</div>
			</form>
		</div>

	</div>

	<#include '/script.html'/>
	<script src="${ctx}/js/example/index.js?v=${jsrandom}" type="text/javascript"></script>
</body>
 
</html>