@extends('layouts.app') @section('title', __('dashboard.sidebar_moderators')) @section('page_heading', __('dashboard.sidebar_moderators')) @section('content')
@can('create moderators') {{ __('dashboard.Add New Moderator') }} @endcan
@php $total = \App\Models\User::where('type','admin')->count(); $active = \App\Models\User::where('type','admin')->where('is_active',true)->count(); $inactive = $total - $active; @endphp {{-- KPIs --}}
@foreach([ ['fa-solid fa-users-gear', '#eff6ff','#2563eb', $total, __('dashboard.All Moderators')], ['fa-solid fa-circle-check', '#f0fdf4','#16a34a', $active, __('dashboard.active')], ['fa-solid fa-circle-pause', '#fef2f2','#dc2626', $inactive, 'معطلون'], ] as [$ic,$bg,$cl,$val,$lbl])
{{ $val }}
{{ $lbl }}
@endforeach
{{-- Table card --}}
{{-- Head --}}
{{ __('dashboard.All Moderators') }} {{ $moderators->total() }}
@if(request('search')) @endif
@if($moderators->isEmpty())
@include('layouts.partials.index-empty-state', ['icon'=>'fa-solid fa-users-gear','title'=>__('dashboard.No moderators found.'),'message'=>''])
@else
@foreach($moderators as $m) @php $canEdit = !($m->isSuperAdminAccount() && !auth()->user()->hasRole('support')) && !($m->isSupportAccount() && !auth()->user()->hasRole('admin')); $canDelete = !$m->isProtectedSystemAccount(); @endphp {{-- Name --}} {{-- Email --}} {{-- Phone --}} {{-- Roles --}} {{-- Status --}} {{-- Date --}} {{-- Actions --}} @endforeach
{{ __('dashboard.Name') }} {{ __('dashboard.Email') }} {{ __('dashboard.Phone') }} {{ __('dashboard.Roles') }} {{ __('dashboard.status_label') }} {{ __('dashboard.Created At') }} {{ __('dashboard.Actions') }}
@if($m->avatar) @else
{{ mb_substr($m->name,0,1) }}
@endif
{{ $m->name }}
#{{ $m->id }}
{{ $m->email }}{{ $m->phone ?? '—' }}
@forelse($m->roles as $role) {{ \App\Support\PermissionRegistry::roleLabel($role->name) }} @empty @endforelse
@if($m->is_active) {{ __('dashboard.active') }} @else معطل @endif {{ $m->created_at?->format('Y-m-d') ?? '—' }} @canany(['view moderators','edit moderators','delete moderators'])
@can('view moderators') {{ __('dashboard.Show') }} @endcan @can('edit moderators') @if($canEdit) {{ __('dashboard.Edit') }} @endif @if($m->id !== auth()->id())
@csrf @method('PATCH')
@endif @endcan @can('delete moderators') @if($canDelete)
@csrf @method('DELETE')
@endif @endcan
@endcanany
{{ $moderators->appends(request()->query())->links() }}
@endif
@endsection