<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head th:replace="/common/template :: header(~{::title},~{::link},~{::style})"></head>
<body class="timo-layout-page">
<div class="layui-card">
    <div class="layui-card-header timo-card-header">
        <span><i class="fa fa-bars"></i> 用户管理</span>
        <i class="layui-icon layui-icon-refresh refresh-btn"></i>
    </div>
    <div class="layui-card-body">
        <div class="layui-row timo-card-screen put-row">
            <div class="pull-left layui-form-pane timo-search-box">
                <div class="layui-inline">
                    <label class="layui-form-label">用户名</label>
                    <div class="layui-input-block">
                        <input type="text" name="nickname" th:value="${param.nickname}" placeholder="请输入用户名"
                               autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-inline">
                    <button class="layui-btn timo-search-btn">
                        <i class="fa fa-search"></i>
                    </button>
                </div>
            </div>
            <div class="pull-right screen-btn-group">
                <div class="btn-group-right">
                    <button class="layui-btn open-popup" data-title="添加用户" th:attr="data-url=@{/rbac/user/add}"
                             data-size="auto">
                        <i class="fa fa-plus"></i> 添加
                    </button>
                    <div class="btn-group">
                        <button class="layui-btn">启用/禁用<span class="caret"></span></button>
                        <dl class="layui-nav-child layui-anim layui-anim-upbit">
                            <dd><a class="ajax-status" th:href="@{/api/rbac/user/status/1}">启用</a></dd>
                            <dd><a class="ajax-status" th:href="@{/api/rbac/user/status/0}">禁用</a></dd>
                        </dl>
                    </div>
                </div>
            </div>
        </div>
        <div class="timo-table-wrap">
            <table class="layui-table timo-table">
                <thead>
                <tr>
                    <th class="timo-table-checkbox">
                        <label class="timo-checkbox"><input type="checkbox">
                            <i class="layui-icon layui-icon-ok"></i></label>
                    </th>
                    <th data-field="username">登录名</th>
                    <th data-field="nickname">用户名</th>
                    <th data-field="sex">性别</th>
                    <th data-field="mobilePhone">手机号</th>
                    <th data-field="email">邮箱</th>
                    <th data-field="createDate">创建时间</th>
                    <th>状态</th>
                    <th>分配角色</th>
                    <th>修改密码</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                <tr th:each="item:${list}">
                    <td><label class="timo-checkbox"><input type="checkbox" th:value="${item.userId}">
                        <i class="layui-icon layui-icon-ok"></i></label></td>
                    <td th:text="${item.username}">登录名</td>
                    <td th:text="${item.nickname}">用户名</td>
                    <td th:text="${item.gender}">性别</td>
                    <td th:text="${item.mobilePhone}">手机号</td>
                    <td th:text="${item.email}">邮箱</td>
                    <td th:text="${item.createTime}">创建时间</td>
                    <td th:text="${item.status}">状态</td>
                    <td>
                        <a class="open-popup" data-title="分配角色"
                           th:attr="data-url=@{'/rbac/user/role/'+${item.userId}}" data-size="640,480"
                           href="#">设置</a>
                    </td>
                    <td>
                        <a class="open-popup" data-title="修改密码"
                           th:attr="data-url=@{'/rbac/user/passwd/'+${item.userId}}" data-size="640,480"
                           href="#">修改</a>
                    </td>
                    <td>
                        <a class="open-popup" data-title="编辑用户" th:attr="data-url=@{'/rbac/user/edit/'+${item.userId}}"
                           data-size="640,480" href="#">编辑</a>
                        <a class="open-popup" data-title="详细信息" th:attr="data-url=@{'/rbac/user/detail/'+${item.userId}}"
                           data-size="640,480" href="#">详细</a>
                        <a class="ajax-delete" th:attr="data-msg='确定要删除 '+ ${item.username} + '?'"
                           th:href="@{'/api/rbac/user/' + ${item.userId}}">删除</a>
                    </td>
                </tr>
                </tbody>
            </table>
        </div>
        <div th:replace="/common/fragment :: page"></div>
    </div>
</div>
<script th:replace="/common/template :: script"></script>
</body>
</html>