<div class="content_wrapper">

    <div class="container-fluid">
        <div class="row">
            <div class="col-sm-12">
                <aside>
                    <header><i class="fa fa-fw fa-file"></i>角色管理</header>
                    <section>
                        <div class="container-fluid">
                            <div class="row">
                                <div class="col-sm-12">
                                    <div class="btn-group" style="margin-bottom:20px;">
                                        <a class="btn btn-primary" href="<?php echo base_url('#permission/roleAdd')?>" role="button">添加角色</a>
                                    </div>
                                    <div class="table-responsive">
                                        <table id="example" class="table table-striped table-bordered table-hover" cellspacing="0" width="100%">
                                            <thead>
                                            <tr>
                                                <th>名称</th>
                                                <th>编辑</th>
                                            </tr>
                                            </thead>
                                            <tbody>
                                            <?php
                                                if($list){
                                                    foreach ($list as $val) {
                                                        ?>
                                            <tr>
                                                <td><?php echo $val['rolename'];?></td>
                                                <td>
                                                    <a href="<?php echo base_url('#permission/roleEdit/'.$val['id'])?>" class="btn btn-primary" role="button">权限编辑</a>
                                                    <button pid="<?php echo $val['id'];?>" class="btn btn-danger delp">删除</button>
                                                </td>
                                            </tr>
                                            <?php
                                                    }}
                                            ?>
                                            </tbody>
                                        </table>
                                    </div>
                                    <nav>
                                        <ul class="pagination">
                                            <li class="disabled"><a href="#">共<?php echo count($list);?>条</a></li>
<!--                                            <li class="disabled"><a href="#"><i class="fa fa-angle-left"></i></a></li>-->
<!--                                            <li class="active"><a href="#">1</a></li>-->
<!--                                            <li><a href="#">2</a></li>-->
<!--                                            <li><a href="#"><i class="fa fa-angle-right"></i></a></li>-->
                                        </ul>
                                    </nav>
                                </div>
                            </div>
                        </div>
                    </section>
                </aside>
            </div>
        </div>
    </div>

</div>

<script type="text/javascript">
    $('.delp').click(function(){
        if(confirm('确定删除该角色吗?')){
            var id = $(this).attr('pid');
            $.post(
                "<?php echo base_url('permission/actionDelRole')?>",
                {id:id},
                function(){
                    alert('删除成功');
                    window.location.reload();
                }
            );
        }
    });
</script>