@extends ('layouts.admin')
@section ('title')
SisVentas | Permisos
@endsection
@section ('contenido')
<div class="row">
    <div class="col-12">
        <div class="page-title-box">
            <div class="page-title-right">
                <ol class="breadcrumb m-0">
                    <li class="breadcrumb-item"><a href="javascript: void(0);">Inicio</a></li>
                    <li class="breadcrumb-item"><a href="javascript: void(0);">Accesos</a></li>
                    <li class="breadcrumb-item active">Permisos</li>
                </ol>
            </div>
            <h4 class="page-title">Administración de Permisos</h4>
        </div>
    </div>
</div>
<div class="row">
    <div class="col-12">
        <div class="card">
            <div class="card-body">
                <div class="row mb-2">
                    <div class="col-sm-4">
                        @can('role-create')
                        <a href="{{ route('permissions.create') }}" class="btn btn-success mb-2"><i class="mdi mdi-plus-circle me-2"></i> Nuevo Permiso</a>
                        @endcan
                    </div>
                    <div class="col-sm-8">
                        <div class="text-sm-end">

                        </div>
                    </div><!-- end col-->
                </div>                
                <div class="table-responsive">
                    <table class="table table-centered w-100 dt-responsive nowrap table-bordered table-condensed table-hover"> 
                        <thead class="table-light">
                            <tr>
                                <th>Id</th>
                                <th>Nombre</th>
                                <th style="width: 280px;">Acciones</th>
                            </tr>
                        </thead>
                        
                        <tbody>
                            @foreach ($data as $key => $permission)
                            <tr>
                                <td>{{ $permission->id }}</td>
                                <td>{{ $permission->name }}</td>
                                <td align="center">
                                    @can('role-show')
                                    <a href="{{ route('permissions.show',$permission->id) }}"><button class="btn btn-primary"><i class="mdi mdi-eye"></i> Ver</button></a>
                                    @endcan
                                    @can('role-edit')
                                    <a href="{{ route('permissions.edit',$permission->id) }}"><button class="btn btn-info"><i class="mdi mdi-square-edit-outline"></i> Editar</button></a>
                                    @endcan
                                    @can('role-delete')
                                    {!! Form::open(['method' => 'DELETE','route' => ['permissions.destroy', $permission->id],'style'=>'display:inline']) !!}
                                    {!! Form::submit('Eliminar', ['class' => 'btn btn-danger']) !!}
                                    {!! Form::close() !!}
                                    @endcan
                                </td>
                            </tr>
                            @endforeach
                        </tbody>
                    </table>
                    {{$data->render()}}
                </div>
            </div> <!-- end card-body-->
        </div> <!-- end card-->
    </div> <!-- end col -->
</div>
@push ('scripts')
<script>
    $('#liAcceso').addClass("sub active");
    $('#aAcceso').addClass("active");
    $('#liPermisos').addClass("active");
</script>
@endpush
@endsection