<!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">
            <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="name" th:value="${param.name}" 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">
                <button class="layui-btn open-popup" data-title="添加角色" th:attr="data-url=@{/rbac/role/add}"
                        data-size="460,357">
                    <i class="fa fa-plus"></i> 添加
                </button>
            </div>
        </div>
        <div class="timo-table-wrap">
            <table class="layui-table timo-table">
                <thead>
                <tr>
                    <th data-field="name">角色</th>
                    <th data-field="description">描述</th>
                    <th data-field="createTime">创建时间</th>
                    <th>拥有角色的用户</th>
                    <th>授权资源</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                <tr th:each="item:${list}">
                    <td th:text="${item.name}">角色</td>
                    <td th:text="${item.description}">描述</td>
                    <td th:text="${item.createTime}">创建时间</td>
                    <td>
                        <a class="open-popup" data-title="拥有角色的用户"
                           th:attr="data-url=@{'/rbac/role/users/'+${item.roleId}}" data-size="800,600"
                           href="#">查看</a>
                    </td>
                    <td>
                        <a class="open-popup" data-title="资源授权"
                           th:attr="data-url=@{'/rbac/role/menus/'+${item.roleId}}" data-size="800,600"
                           href="#">设置</a>
                    </td>
                    <td>
                        <a class="open-popup" data-title="编辑角色" th:attr="data-url=@{'/rbac/role/edit/'+${item.roleId}}"
                           data-size="460,357" href="#">编辑</a>
                        <a class="open-popup" data-title="详细信息" th:attr="data-url=@{'/rbac/role/detail/'+${item.roleId}}"
                           data-size="800,600" href="#">详细</a>
                        <a class="ajax-delete" th:attr="data-msg='确定要删除 '+ ${item.name} + '?'"
                           th:href="@{'/api/rbac/role/' + ${item.roleId}}">删除</a>
                    </td>
                </tr>
                </tbody>
            </table>
        </div>
        <div th:replace="/common/fragment :: page"></div>
    </div>
</div>
<script th:replace="/common/template :: script"></script>
</body>
</html>