Admin Report - eService Applications

Admin Report - eService Applications

@if (request()->anyFilled(['time', 'status', 'application_type', 'window', 'officer']))
Active Filters: @php $activeFilters = []; if (request('time') && request('time') !== 'all') { $activeFilters[] = 'Time: ' . ucfirst(request('time')); } if (request('status') && request('status') !== 'all') { $activeFilters[] = 'Status: ' . ucfirst(request('status')); } if (request('application_type') && request('application_type') !== 'all') { $activeFilters[] = 'Type: ' . ucfirst(request('application_type')); } if (request('window') && request('window') !== 'all') { $windowName = 'N/A'; foreach ($windows as $window) { if ($window->id == request('window')) { $windowName = is_array($window->name) ? $window->name[app()->getLocale()] ?? ($window->name['en'] ?? current($window->name)) : $window->name; break; } } $activeFilters[] = 'Window: ' . $windowName; } if (request('officer') && request('officer') !== 'all') { $officerName = 'N/A'; foreach ($officers as $officer) { if ($officer->id == request('officer')) { $officerName = is_array($officer->name) ? $officer->name[app()->getLocale()] ?? ($officer->name['en'] ?? current($officer->name)) : $officer->name; break; } } $activeFilters[] = 'Officer: ' . $officerName; } @endphp {{ implode(' • ', $activeFilters) }}
@endif

Total Applications

{{ $totalApplications }}

Pending

{{ $pendingCount }}

Rejected

{{ $rejectedCount }}

Approved

{{ $approvedCount }}

Application Records

@forelse($applications as $index => $application) @empty @endforelse
# Application Number Applicant Name Applicant Gender Service Window Type Officer Status Date
{{ ($applications->currentPage() - 1) * $applications->perPage() + $index + 1 }} APP-{{ str_pad($application->id, 6, '0', STR_PAD_LEFT) }} @if ($application->user && $application->user->name) @php $applicantName = is_array($application->user->name) ? $application->user->name[app()->getLocale()] ?? ($application->user->name['en'] ?? current($application->user->name)) : $application->user->name; @endphp {{ $applicantName }} @else N/A @endif @if ($application->user && $application->user->gender) {{ ucfirst($application->user->gender) }} @else N/A @endif @if ($application->service && $application->service->name) @php $serviceName = is_array($application->service->name) ? $application->service->name[app()->getLocale()] ?? ($application->service->name['en'] ?? current($application->service->name)) : $application->service->name; @endphp {{ $serviceName }} @else N/A @endif @if ($application->service && $application->service->window && $application->service->window->name) @php $windowName = is_array($application->service->window->name) ? $application->service->window->name[app()->getLocale()] ?? ($application->service->window->name['en'] ?? current($application->service->window->name)) : $application->service->window->name; @endphp {{ $windowName }} @else N/A @endif {{ ucfirst($application->apply_type) }} @php $officers = $application->service->users ?? collect(); // Filter officers explicitly (in case we didn’t restrict in query) $officers = $officers->filter(fn($u) => $u->role_id == 3); // Extract readable localized names $officerNames = $officers->map(function ($officer) { if (is_array($officer->name)) { return $officer->name[app()->getLocale()] ?? ($officer->name['en'] ?? current($officer->name)); } return $officer->name; }); @endphp @if ($officerNames->isNotEmpty()) {{ $officerNames->join(', ') }} @else N/A @endif {{ ucfirst($application->status) }} {{ $application->created_at->format('M d, Y') }}

No applications found for the selected filters.

Try adjusting your filter criteria or check if there are applications in the database.

Total Records: {{ $applications->total() }}
Last Updated: {{ now()->format('M d, Y H:i') }}
Male: {{ $totalMale }} | Female: {{ $totalFemale }} | Online: {{ $totalOnline }} | Physical: {{ $totalPhysical }}
@if ($applications->hasPages())
Showing {{ $applications->firstItem() ?? 0 }} to {{ $applications->lastItem() ?? 0 }} of {{ $applications->total() }} results
    {{-- Previous Page Link --}} @if ($applications->onFirstPage())
  • Previous
  • @else
  • @endif {{-- Pagination Numbers --}} @php $current = $applications->currentPage(); $total = $applications->lastPage(); $start = max(1, $current - 2); $end = min($total, $current + 2); @endphp {{-- First Page --}} @if ($start > 1)
  • 1
  • @if ($start > 2)
  • ...
  • @endif @endif {{-- Page Numbers --}} @for ($page = $start; $page <= $end; $page++) @if ($page == $current)
  • {{ $page }}
  • @else
  • {{ $page }}
  • @endif @endfor {{-- Last Page --}} @if ($end < $total) @if ($end < $total - 1)
  • ...
  • @endif
  • {{ $total }}
  • @endif {{-- Next Page Link --}} @if ($applications->hasMorePages())
  • @else
  • Next
  • @endif
@endif