@extends('layout.app') @section('content')
Patients ({{ $datas->count() }})   Ajouter


@if(!auth()->user()->isSecretary()) @endif @php // Closures for status mapping — defined once to avoid redeclaration $patient_get_status_slug = function($name) { $name = strtolower($name ?: ''); if (str_contains($name, 'guéri')) return 'guéri'; if (str_contains($name, 'amélioration')) return 'amélioration'; if (str_contains($name, 'stable')) return 'stable'; if (str_contains($name, 'convalescence')) return 'convalescence'; if (str_contains($name, 'critique')) return 'critique'; if (str_contains($name, 'coma')) return 'coma'; if (str_contains($name, 'décédé')) return 'décédé'; if (str_contains($name, 'transféré')) return 'transféré'; return 'all'; }; $patient_get_status_color = function($name) { $name = strtolower($name ?: ''); if (str_contains($name, 'guéri')) return 'color-guéri'; if (str_contains($name, 'amélioration')) return 'color-amélioration'; if (str_contains($name, 'stable')) return 'color-stable'; if (str_contains($name, 'convalescence')) return 'color-convalescence'; if (str_contains($name, 'critique')) return 'color-critique'; if (str_contains($name, 'coma')) return 'color-coma'; if (str_contains($name, 'décédé')) return 'color-décédé'; if (str_contains($name, 'transféré')) return 'color-transféré'; return 'color-all'; }; @endphp @foreach($datas as $data) @php $statusName = $data->lastIntervention() ? $data->lastIntervention()->status->name : null; $statusSlug = $patient_get_status_slug($statusName); $statusColorClass = $patient_get_status_color($statusName); @endphp @if(!$data->archive) @if(!auth()->user()->isSecretary()) @endif @else @php $statusNameArch = $data->lastIntervention() ? $data->lastIntervention()->status->name : null; $statusSlugArch = $patient_get_status_slug($statusNameArch); $statusColorClassArch = $patient_get_status_color($statusNameArch); @endphp @endif @endforeach
Lieu Noms Âge Genre Téléphone Groupe Etat Actuel Assuré Prise en charge Actions
{{ $data->place() }} {{ $data->name }} {{ $data->age ?? $data->calculateAgeFromBirth() }} {{ $data->sexAbrevia() }} {{ $data->tel ?? '—' }} {{ $data->group->name }} @if($statusName) {{ $statusName }} @else — @endif {{ $data->assured ? 'Oui' : 'Non' }} Suivi @if(auth()->user()->subStandard()) Téléconsulter @endif Consulter Hospitaliser {{-- @if(auth()->user()->subGold())--}} {{-- @endif--}} @if(!$data->hasRelatedRecords()) @endif
@endsection @push('scripts') @endpush