@extends('layouts.staff') @section('content')
{{-- HEADER & ACTIONS --}}

Customer Database

Manage user profiles, verification status, and history.

{{-- SEARCH & FILTER FORM --}}
{{-- 1. SEARCH INPUT --}}
{{-- 2. STATUS DROPDOWN (UPDATED WITH COUNTS) --}} @php $currentStatus = request('status', 'all'); $statuses = [ 'all' => 'All Status', 'approved' => 'Approved', 'pending' => 'Pending', 'rejected' => 'Rejected', 'blacklisted' => 'Blacklisted' ]; $currentLabel = $statuses[$currentStatus] ?? 'All Status'; // Helper to get counts (Direct Model Query to ensure accuracy across pages) $getCount = function($status) { $query = \App\Models\Customer::query(); return match($status) { 'all' => $query->count(), 'blacklisted' => $query->where('blacklisted', 1)->count(), 'approved' => $query->whereIn('accountStat', ['approved', 'active'])->count(), default => $query->where('accountStat', $status)->count(), }; }; $currentCount = $getCount($currentStatus); @endphp
{{-- CUSTOMER LIST (CARD STYLE) --}}
@forelse($customers as $customer)
{{-- 1. AVATAR & NAME --}}
{{ substr($customer->fullName, 0, 1) }}

{{ $customer->fullName }}

ID: {{ $customer->stustaffID ?? 'N/A' }}

{{-- 2. ROLE & FACULTY --}}

Faculty

{{ $customer->faculty ?? 'General' }}
{{-- 3. CONTACT INFO --}}

Contact

{{ $customer->email }}
{{ $customer->phoneNo ?? '-' }}
{{-- 4. STATUS --}}

Status

@if($customer->blacklisted) Blacklisted @elseif($customer->accountStat == 'Approved' || $customer->accountStat == 'active') Approved @elseif($customer->accountStat == 'pending') Pending @elseif($customer->accountStat == 'rejected') Rejected @else Unverified @endif
{{-- 5. ACTION --}}
@empty

No customers found.

@if(request('status') || request('search')) Clear Filters @endif
@endforelse
{{-- PAGINATION --}}
{{ $customers->links() }}
{{-- ANIMATION STYLES --}} {{-- DROPDOWN SCRIPT --}} @endsection