@php
$permissionRows = $rolePermissionRows ?? [];
$permissionLabels = $rolePermissionLabels ?? [];
$roleNames = $roleDisplayNames ?? [];
$roleStates = $roleActiveStates ?? [];
$roleMeta = $rolePermissionMeta ?? [];
$systemRoleKeys = \App\Support\WorkflowPermission::systemRoleKeys();
$permissionLockedRoleKeys = \App\Support\WorkflowPermission::permissionLockedRoleKeys();
$permissionSubtitles = [
'can_request_document' => __('Create and submit new document requests.'),
'can_review_document' => __('Read and approve/reject a document at the assigned workflow step.'),
'is_organization_officer' => __('Requires an organization assignment and receives organization-routed workflow work.'),
'register_document_number' => __('Register registry and finished document numbers for requests.'),
'manage_users' => __('Manage user accounts, status, and role assignments.'),
'manage_organizations' => __('Create and maintain organization entries.'),
'manage_document_types' => __('Set document types, forms, and submitter roles.'),
'manage_workflow_templates' => __('Configure workflow paths and approval steps.'),
'manage_role_permissions' => __('Control which roles can use each admin feature.'),
'manage_branding' => __('Manage application branding, logos, and visual identity.'),
'view_audit_trails' => __('View admin, workflow, and system activity history.'),
'use_priority_handling' => __('Enable priority processing for urgent requests.'),
];
$permissionSections = [
__('Document Access') => [
'can_request_document',
'can_review_document',
'is_organization_officer',
'register_document_number',
],
__('Admin Management') => [
'manage_users',
'manage_organizations',
'manage_document_types',
'manage_workflow_templates',
'manage_role_permissions',
'manage_branding',
'view_audit_trails',
],
__('Workflow Tools') => [
'use_priority_handling',
],
];
@endphp
@php
$filteredPermissionRows = $permissionRows;
$permissionTotal = count($permissionLabels);
@endphp
| {{ __('Role') }} |
{{ __('Type') }} |
{{ __('Permissions') }} |
{{ __('Status') }} |
{{ __('Actions') }} |
@forelse($filteredPermissionRows as $roleKey => $permissions)
@php
$isSystemRole = in_array($roleKey, $systemRoleKeys, true);
$isPermissionLockedRole = in_array($roleKey, $permissionLockedRoleKeys, true);
$isActiveRole = (bool) ($roleStates[$roleKey] ?? true);
$roleFormId = 'roleActionForm' . md5($roleKey);
$enabledPermissionKeys = collect($permissions)->filter()->keys()->values();
$enabledPermissionLabels = $enabledPermissionKeys
->map(fn ($permissionKey) => __($permissionLabels[$permissionKey] ?? $permissionKey));
$permissionPreview = $enabledPermissionLabels->take(3);
$remainingPermissionCount = max(0, $enabledPermissionLabels->count() - $permissionPreview->count());
@endphp
|
{{ __($roleNames[$roleKey] ?? $roleKey) }}
{{ $roleKey }}
|
|
@forelse($permissionPreview as $permissionLabel)
@empty
—
@endforelse
@if($remainingPermissionCount > 0)
@endif
{{ __('Permissions') }}: {{ $enabledPermissionLabels->count() }} / {{ $permissionTotal }}
|
|
|
@empty
|
{{ __('No roles available for permission editing.') }}
|
@endforelse
@if(count($filteredPermissionRows) > 0)
|
{{ __('No roles available for permission editing.') }}
|
@endif
@foreach($filteredPermissionRows as $roleKey => $permissions)
@continue(in_array($roleKey, $systemRoleKeys, true))
@php $roleFormId = 'roleActionForm' . md5($roleKey); @endphp
@endforeach