<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">

<head>

    <title>分配权限</title>

    <!-- 页面meta -->
    <th:block th:replace="/backstage/common_resources::common_meta"></th:block>

    <!-- 引入需要的CSS -->
    <th:block th:replace="/backstage/common_resources::common_css"></th:block>

    <!-- 要用的CSS  /-->
    <th:block th:replace="/backstage/common_resources::common_js"></th:block>


</head>

<body class="hold-transition skin-purple sidebar-mini">

    <!-- 引入页面的头部  -->
    <header th:replace="~{/backstage/common_header::header}"></header>
    <!-- 引入页面的导航侧栏 -->
    <aside th:replace="/backstage/common_aside::aside"></aside>

    <div class="wrapper">

        <!-- 内容区域 -->
        <!-- @@master = role-layout.html-->
        <!-- @@block = content -->

        <div class="content-wrapper">

            <!-- 内容头部 -->
            <section class="content-header">
                <h1>
                    角色管理
                    <small>分配权限</small>
                </h1>
                <ol class="breadcrumb">
                    <li><a th:href="@{/backstage/index}"><i class="fa fa-dashboard"></i> 首页</a></li>
                    <li><a th:href="@{/backstage/role/all}">角色管理</a></li>
                    <li class="active">分配权限</li>
                </ol>
            </section>
            <!-- 内容头部 /-->

            <!-- 正文区域 -->
            <section class="content">

                <!-- .box-body -->
                <div class="box box-primary">
                    <div class="box-header with-border">
                        <h3 class="box-title">列表</h3>
                    </div>

                    <div class="box-body">

                        <!-- 数据表格 -->
                        <div class="table-box">

                            <form th:action="@{/backstage/role/updatePermission}">
                                <input type="hidden" name="rid" th:value="${rid}"/>
                                <!--数据列表-->
                                <table id="dataList" class="table table-bordered table-striped table-hover dataTable">
                                    <thead>
                                        <tr>
                                            <th class="" style="padding-right:0px;">
                                                <input id="selall" type="checkbox" class="icheckbox_square-blue">
                                            </th>
                                            <th >权限名</th>
                                            <th >权限描述</th>
                                        </tr>
                                    </thead>
                                    <tbody>

                                        <!-- thymeleaf中遍历数据并呈现到页面之中 -->
                                        <tr th:each="permission:${permissions}">
                                            <td th:if="${permission.roleHas}">
                                                <input name="pids" type="checkbox" th:value="${permission.pid}" class="icheckbox_square-blue" checked>
                                            </td>
                                            <td th:if="${!permission.roleHas}">
                                                <input name="pids" type="checkbox" th:value="${permission.pid}" class="icheckbox_square-blue">
                                            </td>
                                            <td th:text="${permission.permissionName}"></td>
                                            <td th:text="${permission.permissionDesc}"></td>
                                        </tr>

                                    </tbody>
                                </table>
                                <!--数据列表/-->

                                <div class="col-md-2 title"></div>
                                <div class="col-md-10 data text-center">
                                    <button type="submit" class="btn bg-maroon">保存</button>
                                    <button type="button" class="btn bg-default" onclick="history.back(-1);">返回</button>
                                </div>
                            </form>

                        </div>
                        <!-- 数据表格 /-->


                    </div>
                    <!-- /.box-body -->

                </div>

            </section>
            <!-- 正文区域 /-->

        </div>

        <!-- @@close -->
        <!-- 内容区域 /-->

    </div>

    <!-- 引入页面的底部导航 -->
    <footer th:replace="/backstage/common_footer::footer"></footer>

</body>

</html>