@extends('layouts.admin', ['title' => 'الموظفون والصلاحيات']) @php($currentAdmin = auth()->user()) @section('content')
إدارة الفريق

الموظفون والصلاحيات

اختار الأقسام فقط. أي قسم تفتحه للموظف يقدر يشتغل ويعدل فيه عادي.

{{ number_format($staffUsers->total()) }}كل الأدمن
{{ number_format(\App\Models\User::where('role', 'admin')->where('status', 'active')->count()) }}نشط
{{ number_format(\App\Models\User::where('role', 'admin')->where('status', 'suspended')->count()) }}موقوف
@if($errors->any())
{{ $errors->first() }}
@endif
+ إضافة موظف جديد افتح، اكتب البيانات، واختار الأقسام
@csrf
الأقسام المسموحة سيبها فاضية = أدمن كامل الصلاحيات.
@foreach($adminSections as $key => $label) @endforeach
@foreach($staffUsers as $staff)
{{ mb_strtoupper(mb_substr($staff->display_name ?: $staff->name, 0, 1)) }}

{{ $staff->display_name ?: $staff->name }}

{{ $staff->email }}

{{ $staff->status === 'active' ? 'نشط' : 'موقوف' }}
@if(blank($staff->admin_sections)) كل الصلاحيات @else @foreach(array_slice((array) $staff->admin_sections, 0, 4) as $section) {{ $adminSections[$section] ?? $section }} @endforeach @if(count((array) $staff->admin_sections) > 4) +{{ count((array) $staff->admin_sections) - 4 }} @endif @endif
تعديل الموظف
@csrf @method('PATCH')
الأقسام المسموحة {{ blank($staff->admin_sections) ? 'أدمن كامل الصلاحيات' : count((array) $staff->admin_sections).' قسم مفعّل' }}
@foreach($adminSections as $key => $label) @endforeach
@unless($staff->is($currentAdmin))
@csrf @method('DELETE')
@endunless
@endforeach
{{ $staffUsers->links() }}
@endsection