@extends('layout.app')
@section('content')

<div class="card">
    <div class="card-header d-flex justify-content-between align-items-center">
        <h3 class="card-title mb-0">Permissions</h3>
        <a href="{{ route('permissions.editGroups') }}" class="btn btn-info btn-sm"><i class="fa fa-layer-group"></i> Edit Permission Groups</a>
    </div>
    <div class="card-body">
        <div class="table-responsive">
                    <table id="dataTable" class="table table-bordered">
                        <thead class="bg-gray-50">
                           <tr>
                               <th>SL</th>
                               <th>Permission Name</th>
                               <th>Group</th>
                               <th>Status</th>
                               <th>Action</th>
                           </tr>
                            
                        </thead>
                        <tbody>

                            @foreach ($list as $r)
                            
                            <tr>
                                <td>{{ $r->id }}</td>
                                <td>{{ $r->name }}</td>
                                <td>{{ $r->group ?: \App\Services\PermissionGroupHelper::getGroupName($r->name) }}</td>
                                <td class="text-center">
                                    @if($r->status=='enable') <span class="text-green-300">Enabled</span>
                                    @elseif($r->status =='disable') <span class="text-red-300">Disabled</span>
                                    @endif
                                </td>
                                <td class="text-center">
                                    <a href="{{ route('permissions.edit', $r->id) }}" class="btn btn-primary btn-sm">Edit</a>
                                </td>
                            </tr>

                            @endforeach

                            <!-- More items... -->
                        </tbody>
                    </table>
        </div>
    </div>
</div>




@endsection

