@extends('layouts.admin') @section('title', 'Role Permissions') @section('page-title', 'Role & Permission Management') @section('page-subtitle', 'Control what each staff role can access and do') @section('content') @php $roleLabels = [ 'admin' => ['label'=>'Administrator', 'color'=>'red'], 'manager' => ['label'=>'Manager', 'color'=>'purple'], 'cashier' => ['label'=>'Cashier', 'color'=>'blue'], 'agent' => ['label'=>'Field Agent', 'color'=>'green'], 'loan_officer' => ['label'=>'Loan Officer', 'color'=>'yellow'], 'pos' => ['label'=>'POS Operator', 'color'=>'indigo'], 'auditor' => ['label'=>'Auditor', 'color'=>'pink'], ]; $actions = ['can_view'=>'View', 'can_create'=>'Create', 'can_edit'=>'Edit', 'can_delete'=>'Delete', 'can_approve'=>'Approve']; @endphp
@foreach($roleLabels as $roleKey => $info)

{{ $info['label'] }}

@php $count = isset($permissions[$roleKey]) ? $permissions[$roleKey]->where('can_view', true)->count() : 0; @endphp

{{ $count }} modules accessible

{{ strtoupper($roleKey) }}
@endforeach Back to Settings

Full Permission Matrix

Admin permissions are always full access and locked
@csrf @method('PUT')
@foreach(array_filter($roleLabels, fn($r) => $r !== 'admin', ARRAY_FILTER_USE_KEY) as $roleKey => $info) @endforeach @foreach(array_filter($roleLabels, fn($r) => $r !== 'admin', ARRAY_FILTER_USE_KEY) as $roleKey => $info) @foreach($actions as $action => $label) @endforeach @endforeach @foreach($modules as $moduleKey => $moduleLabel) @foreach(array_filter($roleLabels, fn($r) => $r !== 'admin', ARRAY_FILTER_USE_KEY) as $roleKey => $info) @foreach($actions as $action => $label) @php $perm = $permissions[$roleKey]->firstWhere('module', $moduleKey) ?? null; $checked = $perm ? $perm->$action : false; $inputName = "{$roleKey}_{$moduleKey}_{$action}"; @endphp @endforeach @endforeach @endforeach
Module {{ $info['label'] }}
{{ $label }}
{{ $moduleLabel }}

Changes take effect immediately for all subsequent logins.

@endsection