@extends('admin.layouts.app')
@section('title', 'Employer Reports')
@section('content')
Employer Reports
Serious complaints reported by healthcare workers against employers
@include('admin.components.stat_card', ['label' => 'Total', 'value' => $stats['total_reports'], 'icon' => 'fa-solid fa-flag', 'color' => 'slate'])
@include('admin.components.stat_card', ['label' => 'Open', 'value' => $stats['open'], 'icon' => '
', 'color' => 'amber'])
@include('admin.components.stat_card', ['label' => 'In Review', 'value' => $stats['in_review'], 'icon' => '
', 'color' => 'blue'])
@include('admin.components.stat_card', ['label' => 'Valid', 'value' => $stats['resolved_valid'], 'icon' => '
', 'color' => 'emerald'])
@include('admin.components.stat_card', ['label' => 'Invalid', 'value' => $stats['resolved_invalid'], 'icon' => '
', 'color' => 'slate'])
@php
$headers = [
['label' => 'Employer', 'class' => ''],
['label' => 'Reporter', 'class' => ''],
['label' => 'Type', 'class' => 'w-36'],
['label' => 'Severity', 'class' => 'w-28'],
['label' => 'Status', 'class' => 'w-36'],
['label' => 'Date', 'class' => 'w-36'],
['label' => 'Actions', 'class' => 'text-right w-28'],
];
$rows = [];
foreach($reports as $report) {
$cells = [];
$borderColor = match($report->status) {
'open' => 'border-l-2 border-amber-200',
'in_review' => 'border-l-2 border-blue-200',
'resolved_valid' => 'border-l-2 border-emerald-200',
'resolved_invalid' => 'border-l-2 border-slate-200',
default => ''
};
$employerHtml = '
' . e($report->employer->company_name ?? 'Unknown Employer') . '
' .
($report->job ? '
Job: ' . e(Str::limit($report->job->title, 40)) . '
' : '') . '
';
$cells[] = ['content' => $employerHtml, 'class' => ''];
$reporterHtml = '
' . e(strtoupper(substr($report->nurse->name ?? 'A', 0, 1))) . '
' . e($report->nurse->name ?? 'Anonymous') . '
' . e($report->created_at->diffForHumans()) . '
';
$cells[] = ['content' => $reporterHtml, 'class' => ''];
$cells[] = ['content' => '
' . e(ucfirst(str_replace('_', ' ', $report->type))) . '
' . e(Str::limit($report->description, 60)) . '
', 'class' => ''];
$cells[] = ['content' => '
' . e($report->severity) . '', 'class' => ''];
$cells[] = ['content' => '
' . e(ucfirst(str_replace('_', ' ', $report->status))) . '', 'class' => ''];
$cells[] = ['content' => '
' . e($report->created_at->format('M d, Y')) . '
' . e($report->created_at->format('h:i A')) . '
', 'class' => ''];
$actionHtml = '
';
$cells[] = ['content' => '
' . $actionHtml . '
', 'class' => 'text-right'];
$rows[] = ['cells' => $cells, 'class' => $borderColor ?? ''];
}
@endphp
@include('admin.components.table_shell', [
'title' => 'Employer Reports',
'headers' => $headers,
'rows' => $rows,
])
@if($reports->hasPages())
{{ $reports->links() }}
@endif
@push('scripts')
@endpush
@endsection