@extends('layouts/base_view')
@section('title')
<li class="breadcrumb-item">Configurations</li>
<li class="breadcrumb-item active">Roles</li>
@endsection
@section('content')
<!-- Main content -->
<section class="content">
    <div class="container-fluid">
        <div class="row">
            <div class="col-12">

                <div class="card">
                    <div class="card-header">
                        <div class="row">
                            <div class="col-md-2 mr">
                                <a href="{{ route('roles.create') }}" class="btn btn-warning btn-block btn-sm button-cek-permission" data-permission="roles.create">
                                    <i class="fas fa-plus"></i> Tambah
                                </a>
                            </div>
                        </div>
                    </div>
                    <!-- /.card-header -->
                    <div class="card-body">
                        <table id="tblPeran" class="table table-hover table-sm">
                            <thead class="bg-warning">
                                <tr>
                                    <th>ID</th>
                                    <th>Nama Peran</th>
                                    <th>Sumber</th>
                                    <th width="5%" class="text-center">Aksi</th>
                                </tr>
                            </thead>
                            <tbody>
                                @foreach ($roles as $key => $role)
                                <tr>
                                    <td>{{ $role->id }}</td>
                                    <td>{{ $role->name }}</td>
                                    <td>{{ $role->guard_name }}</td>
                                    <td class="text-center">
                                        <a href="{{ route('roles.edit', $role->id) }}" class="btn btn-sm btn-warning btn-xs button-cek-permission" data-permission="roles.edit" data-toggle="tooltip" data-placement="top" title="Ubah {{$role->name}}?">
                                            <i class="fas fa-edit btn-xs"></i>
                                        </a>
                                    </td>

                                </tr>
                                @endforeach
                            </tbody>
                            <tfoot> </tfoot>
                        </table>
                    </div>
                    <!-- /.card-body -->
                </div>
                <!-- /.card -->
            </div>
            <!-- /.col -->
        </div>
        <!-- /.row -->
    </div>
    <!-- /.container-fluid -->
</section>
<script>
    $(function() {
        $("#tblPeran").DataTable({
            "responsive": false,
            "lengthChange": true,
            "autoWidth": false,
            buttons: [
                //{
                //    extend: "copy",
                //    className: "btn btn-warning"
                //},
                //{
                //    extend: "csv",
                //    className: "btn btn-warning"
                //},
                //{
                //    extend: "excel",
                //    className: "btn btn-warning"
                //},
                //{
                //    extend: "pdf",
                //    className: "btn btn-warning"
                //},
                //{
                //    extend: "print",
                //    className: "btn btn-warning"
                //},
                // {
                //     extend: "colvis",
                //     className: "btn btn-warning"
                // }
            ]
        }).buttons().container().appendTo('#tblPeran_wrapper .col-md-6:eq(0)');
    });
</script>
<!-- /.content -->
@endsection