@extends('layouts.app') @push('styles') @endpush @section('content') @auth

Pre-TB records

Search and update visits @if (!empty($recentOnly)) Showing only last 60 days (from {{ \Carbon\Carbon::parse($recentCutoff)->format('d-m-Y') }}) @endif
@if (session('status'))
{{ session('status') }}
@endif
Reset
@if (empty($recentOnly))
Search results include all matching records, including older and completed visits.
@endif
@forelse ($records as $r) @empty @endforelse
ID CID Name Date of screening Mode Updated Required Actions
{{ $r->id }} {{ $r->cid }} {{ $r->name }} {{ $r->date_of_screening ? $r->date_of_screening->format('d-m-Y') : '' }} @php $modeLabels = [ '1' => 'General', '2' => 'PLHIV', '3' => 'Diabetes', '7' => 'Diabetes', '4' => 'Remote (ICMV)', '5' => 'Remote (TB mobile)', '6' => 'Contact tracing', ]; $modeValues = array_filter(array_map('trim', explode(',', (string) $r->mode_of_entry))); @endphp {{ empty($modeValues) ? '' : implode(', ', array_map(fn($value) => $modeLabels[$value] ?? $value, $modeValues)) }} {{ $r->updated_at ? $r->updated_at->format('d-m-Y H:i') : '' }} @php $isFilled = static function ($value): bool { if (is_null($value)) return false; if (is_string($value)) return trim($value) !== ''; return true; }; $commentText = strtolower((string) ($r->comment ?? '')); $skipFieldMissing = [ 'md_diagnosis' => str_contains($commentText, 'md other:'), 'radiologist_result' => str_contains($commentText, 'radiologist other:'), ]; $statusDefinitions = [ ['label' => 'Chest X-ray', 'toggle' => 'chest_xray', 'fields' => ['chest_xray_date' => 'Date', 'chest_xray_fac' => 'Facility', 'md_diagnosis' => 'MD diagnosis']], ['label' => 'Radiologist requested', 'toggle' => 'radio_request', 'fields' => ['radio_request_date' => 'Date', 'radiologist_result' => 'Result']], ['label' => 'Sputum AFB', 'toggle' => 'sputum_afb', 'fields' => ['sputum_afb_date' => 'Date', 'sputum_afb_res' => 'Result']], ['label' => 'GeneXpert', 'toggle' => 'genexpert', 'fields' => ['genexpert_date' => 'Date', 'genexpert_res' => 'Result']], ['label' => 'Truenat', 'toggle' => 'truenat', 'fields' => ['truenat_date' => 'Date', 'truenat_res' => 'Result']], ['label' => 'HIV (determine)', 'toggle' => 'hiv_det', 'fields' => ['hiv_det_date' => 'Date', 'hiv_det_res' => 'Result']], ['label' => 'Antibiotics', 'toggle' => 'antibiotics', 'fields' => ['antibiotic_date' => 'Date', 'drug' => 'Drug']], ['label' => 'TB treatment', 'toggle' => 'tb_treat', 'fields' => ['tb_treat_date' => 'Date', 'tb_treat_regimen' => 'Regimen']], ]; $missingStatuses = []; foreach ($statusDefinitions as $definition) { $enabled = (string) data_get($r, $definition['toggle']) === '1'; if (!$enabled) { continue; } $missingFields = []; foreach ($definition['fields'] as $field => $fieldLabel) { if (!empty($skipFieldMissing[$field])) { continue; } if (!$isFilled(data_get($r, $field))) { $missingFields[] = $fieldLabel; } } if (!empty($missingFields)) { $missingStatuses[] = [ 'label' => $definition['label'], 'missing' => $missingFields, ]; } } @endphp @if (empty($missingStatuses)) - @else
@foreach ($missingStatuses as $status) {{ $status['label'] }} @endforeach
@endif
PDF Edit
@csrf @method('DELETE')
No records found.
{{ $records->links() }}
@endauth @endsection @push('scripts') @endpush