HEX
Server: Apache/2.4.58 (Ubuntu)
System: Linux ip-172-26-0-120 6.17.0-1009-aws #9~24.04.2-Ubuntu SMP Fri Mar 6 23:50:29 UTC 2026 x86_64
User: ubuntu (1000)
PHP: 8.3.6
Disabled: NONE
Upload Files
File: /var/www/html/dashboard.orbiwheels.com/resources/views/admin/roles/permission.blade.php
 @extends('layout.master')
@section('content')
 <div class="right_col" role="main">
        <div class="">
            {{-- <div class="page-title">
                <div class="title_left">
                    <h3>Staff <small>List</small></h3>
                </div>
            </div> --}}

            <div class="clearfix"></div>

            <div class="row" style="display: block;">
                <div class="col-md-12 col-sm-12 ">
                    <div class="x_panel">
                        <div class="x_title">
                            <h2>Assign Permission<small>({{$role->name}})</small></h2>

                            <div class="clearfix"></div>
                        </div>
                        <div class="x_content">
                            <form action="{{ route('admin.roles.permission.assign', $role->id) }}" method="POST">
                                @csrf

                                <table class="table jambo_table">
                                    <thead>
                                        <tr>
                                            <th style="width: 60%;">Module</th>
                                            <th class="text-center" style="width: 10%;">View</th>
                                            <th class="text-center" style="width: 10%;">Create</th>
                                            <th class="text-center" style="width: 10%;">Edit</th>
                                            <th class="text-center" style="width: 10%;">Delete</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        @foreach ($permissions->groupBy(function($p) {
                                        return explode('.', $p->name)[0]; // Group by 'user', 'transporter', etc.
                                    }) as $entity => $entityPermissions)
                                        @if($entity != 'role')
                                        <tr>
                                            <td><strong>{{ ucfirst($entity) }}</strong></td>
                                            @foreach (['view', 'create', 'edit', 'delete'] as $action)
                                                @php
                                                    $permName = "$entity.$action";
                                                    $permissionExists = $entityPermissions->contains('name', $permName);
                                                    $hasPermission = $permissionExists ? $role->hasPermissionTo($permName) : false;
                                                @endphp
                                                <td class="text-center">
                                                    @if ($permissionExists)
                                                        <input type="checkbox" name="permissions[]" value="{{ $permName }}"
                                                            {{ $hasPermission ? 'checked' : '' }}>
                                                    @else
                                                        <span class="text-muted">—</span> {{-- Placeholder for missing permission --}}
                                                    @endif
                                                </td>
                                            @endforeach
                                        </tr>
                                        @endif
                                    @endforeach
                                    </tbody>
                                </table>

                                <button type="submit" class="btn btn-primary">Assign Permissions</button>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
 </div>
 @endsection