@php $actionAr = [ 'view' => 'عرض', 'create' => 'إضافة', 'edit' => 'تعديل', 'delete' => 'حذف', ]; $moduleAr = [ 'branches' => 'الفروع', 'users' => 'المستخدمون', 'products' => 'المنتجات', 'categories' => 'الأصناف', 'units' => 'وحدات القياس', 'suppliers' => 'الموردون', 'customers' => 'العملاء', 'purchases' => 'المشتريات', 'sales' => 'المبيعات', 'pos' => 'نقطة البيع', 'inventory' => 'المخزون', 'transfers' => 'تحويلات المخزون', 'stock-counts' => 'جرد المخزون', 'accounting' => 'المحاسبة', 'reports' => 'التقارير', 'vouchers' => 'السندات', 'audit-log' => 'سجل التدقيق', 'recycle-bin' => 'سلة المحذوفات', ]; $roleAr = [ 'Admin' => 'مدير النظام', 'Manager' => 'مدير فرع', 'Cashier' => 'كاشير', ]; $colors = [ 'view' => 'secondary', 'create' => 'success', 'edit' => 'warning', 'delete' => 'danger', ]; @endphp

الأدوار والصلاحيات

@if (session('success'))
{{ session('success') }}
@endif @if ($editingRoleId) {{-- Permission Editor --}} @php $editRole = \Spatie\Permission\Models\Role::findById($editingRoleId); @endphp
تعديل صلاحيات: {{ $roleAr[$editRole->name] ?? $editRole->name }}
@foreach ($this->groupedPermissions as $module => $perms) @php $allChecked = collect($perms)->every(fn($p) => in_array($p->name, $selectedPermissions)); $moduleLabel = $moduleAr[$module] ?? $module; @endphp
{{ $moduleLabel }}
@foreach ($perms as $perm) @php $action = explode('-', $perm->name, 2)[0]; $color = $colors[$action] ?? 'primary'; $actionLabel = $actionAr[$action] ?? $action; @endphp @endforeach
@endforeach
@else {{-- Roles List --}}
@foreach ($roles as $role)
{{ $roleAr[$role->name] ?? $role->name }}
{{ $role->name }}
@can('manage-roles') @endcan

{{ $role->permissions_count }} صلاحية مُسندة

{{-- Summary badges by action --}}
@foreach ($role->permissions->groupBy(fn($p) => explode('-', $p->name, 2)[0]) as $action => $group) {{ $actionAr[$action] ?? $action }} × {{ $group->count() }} @endforeach
@endforeach
@endif