@endif
{{-- Officer --}}
@php
use App\Models\Application;
use Illuminate\Support\Facades\Auth;
// Get all service IDs assigned to the logged-in user via the pivot table
$user = Auth::user();
$assignedServiceIds = $user->services()->pluck('services.id')->toArray();
// Count applications by status for the services assigned to this user
$allCount = Application::whereIn('service_id', $assignedServiceIds)->count();
$approvedCount = Application::whereIn('service_id', $assignedServiceIds)->where('status', 'approved')->count();
$rejectedCount = Application::whereIn('service_id', $assignedServiceIds)->where('status', 'rejected')->count();
$pendingCount = Application::whereIn('service_id', $assignedServiceIds)->where('status', 'request')->count();
@endphp
@if(Auth::user()->role_id == 3)