@extends('layouts.app') @section('title', 'Staff') @section('content') @php /* |-------------------------------------------------------------------------- | Dynamic Staff Statistics |-------------------------------------------------------------------------- */ $totalStaff = $staff->count(); $activeStaff = $staff->where('is_active', 1)->count(); $administrators = $staff->filter(function ($member) { $roleName = strtolower(trim($member->role->role_name ?? '')); return str_contains($roleName, 'admin'); })->count(); $orderTakers = $staff->filter(function ($member) { $roleName = strtolower(trim($member->role->role_name ?? '')); return str_contains($roleName, 'order taker'); })->count(); // Progress percentages $activePercentage = $totalStaff > 0 ? round(($activeStaff / $totalStaff) * 100) : 0; $administratorPercentage = $totalStaff > 0 ? round(($administrators / $totalStaff) * 100) : 0; $orderTakerPercentage = $totalStaff > 0 ? round(($orderTakers / $totalStaff) * 100) : 0; @endphp
{{-- ================================================================ PAGE HEADER ================================================================= --}}

Staff Management

Add Staff
{{-- ================================================================ STAFF STATISTICS ================================================================= --}}
{{-- TOTAL STAFF --}}

Total Staff

{{ $totalStaff }}

{{-- ACTIVE STAFF --}}

Active Staff

{{ $activeStaff }}

{{-- ADMINISTRATORS --}}

Administrators

{{ $administrators }}

{{-- ORDER TAKERS --}}

Order Taker

{{ $orderTakers }}

{{-- ================================================================ SEARCH & FILTER ================================================================= --}}

Search & Filter

{{-- ================================================================ STAFF LIST ================================================================= --}}

Staff List

@forelse($staff as $member) {{-- Checkbox --}} {{-- Staff Name --}} {{-- Email --}} {{-- Role --}} {{-- Status --}} {{-- Actions --}} @empty @endforelse
Staff Name Email Address Role Status Actions
{{ $member->user_name }} {{ $member->user_email }} {{ $member->role->role_name ?? 'No Role' }} @if($member->is_active) Active @else Inactive @endif
{{-- View --}} {{-- Edit --}} @if(auth()->user()->role && str_contains(strtolower(auth()->user()->role->role_name), 'admin')) {{-- ADMIN: REAL EDIT LINK --}} @else {{-- STAFF: BLOCKED ACTION --}} @endif {{-- Delete --}}
@csrf @method('DELETE')
No staff members found.
@endsection