@extends('admin.layouts.app') @section('title', __('patients.show')) @section('content') @php $tabs = [ 'overview' => __('patients.show_page.tabs.overview'), 'history' => __('patients.show_page.tabs.history'), 'contacts' => __('patients.show_page.tabs.contacts'), 'files' => __('patients.show_page.tabs.files'), 'timeline' => __('patients.show_page.tabs.timeline'), ]; $activeTab = array_key_exists($tab, $tabs) ? $tab : 'overview'; $genderKey = in_array(strtolower((string) $patient->gender), ['male', 'female', 'other'], true) ? strtolower((string) $patient->gender) : null; @endphp

{{ $patient->display_name }}

{{ $patient->patient_code }} • {{ $genderKey ? __('patients.form.gender_options.' . $genderKey) : __('common.not_available') }} • {{ $patient->date_of_birth?->format('M d, Y') }} @if($patient->age) • {{ __('patients.show_page.years_old', ['age' => $patient->age]) }} @endif
@if (session('success'))
{{ session('success') }}
@endif
{{ __('patients.show_page.stats.appointments') }}
{{ $stats['appointments'] }}
{{ __('patients.show_page.stats.visits') }}
{{ $stats['visits'] }}
{{ __('patients.show_page.stats.prescriptions') }}
{{ $stats['prescriptions'] }}
{{ __('patients.show_page.stats.invoices') }}
{{ $stats['invoices'] }}
{{ __('patients.show_page.stats.files') }}
{{ $stats['files'] }}
{{ __('common.status') }}
{{ $patient->status?->label() ?? __('common.not_available') }}
@if ($activeTab === 'overview')
{{ __('patients.show_page.sections.profile_details') }}
{{ __('patients.form.fields.phone') }}
{{ $patient->phone }}
{{ __('patients.form.fields.alternate_phone') }}
{{ $patient->alternate_phone ?: __('common.none') }}
{{ __('patients.form.fields.email') }}
{{ $patient->email ?: __('common.none') }}
{{ __('patients.form.fields.city') }}
{{ $patient->city ?: __('common.none') }}
{{ __('patients.form.fields.occupation') }}
{{ $patient->profile?->occupation ?: __('common.none') }}
{{ __('patients.form.fields.blood_group') }}
{{ $patient->profile?->blood_group ?: __('common.none') }}
{{ __('patients.form.fields.preferred_language') }}
{{ $patient->profile?->preferred_language ?: __('common.none') }}
{{ __('patients.form.fields.marital_status') }}
{{ $patient->profile?->marital_status ?: __('common.none') }}
{{ __('patients.form.fields.address') }}
{{ $patient->address ?: __('common.none') }}
{{ __('patients.form.fields.notes') }}
{{ $patient->notes ?: ($patient->profile?->notes ?: __('common.none')) }}
{{ __('patients.show_page.sections.all_appointments') }}
{{ $allAppointments->total() }}
@forelse ($allAppointments as $appointment) @empty @endforelse
{{ __('patients.show_page.labels.appointment_no') }} {{ __('patients.show_page.labels.date') }} {{ __('common.status') }} {{ __('patients.show_page.labels.doctor') }} {{ __('common.actions') }}
{{ $appointment->appointment_no ?? ('#' . $appointment->id) }} {{ $appointment->appointment_date?->format('M d, Y') ?? __('common.not_available') }} {{ $appointment->status?->label() ?? ucfirst((string) $appointment->status?->value) }} {{ $appointment->doctor?->display_name ?? $appointment->doctor?->full_name ?? __('common.not_available') }} @can('appointments.view') {{ __('patients.show_page.actions.open') }} @endcan
{{ __('patients.show_page.empty.no_appointments') }}
@if ($allAppointments->hasPages())
{{ $allAppointments->links() }}
@endif
{{ __('patients.show_page.sections.completed_appointments') }}
{{ $completedAppointments->total() }}
@forelse ($completedAppointments as $appointment) @empty @endforelse
{{ __('patients.show_page.labels.appointment_no') }} {{ __('patients.show_page.labels.date') }} {{ __('patients.show_page.labels.doctor') }} {{ __('common.actions') }}
{{ $appointment->appointment_no ?? ('#' . $appointment->id) }} {{ $appointment->appointment_date?->format('M d, Y') ?? __('common.not_available') }} {{ $appointment->doctor?->display_name ?? $appointment->doctor?->full_name ?? __('common.not_available') }} @can('appointments.view') {{ __('patients.show_page.actions.open') }} @endcan
{{ __('patients.show_page.empty.no_completed_appointments') }}
@if ($completedAppointments->hasPages())
{{ $completedAppointments->links() }}
@endif
{{ __('patients.show_page.sections.visit_history') }}
{{ $visitHistory->total() }}
@forelse ($visitHistory as $visit) @empty @endforelse
{{ __('patients.show_page.labels.visit_no') }} {{ __('patients.show_page.labels.date') }} {{ __('common.status') }} {{ __('common.actions') }}
{{ $visit->visit_no }} {{ $visit->visit_date?->format('M d, Y') ?? __('common.not_available') }} {{ $visit->status?->label() ?? ucfirst((string) $visit->status?->value) }} @can('visits.view') {{ __('patients.show_page.actions.open') }} @endcan
{{ __('patients.show_page.empty.no_visits') }}
@if ($visitHistory->hasPages())
{{ $visitHistory->links() }}
@endif
{{ __('patients.show_page.sections.prescriptions') }}
{{ $patientPrescriptions->total() }}
@can('prescriptions.view') @endcan
@forelse ($patientPrescriptions as $prescription) @empty @endforelse
# {{ __('patients.show_page.labels.date') }} {{ __('patients.show_page.labels.medicines_count') }} {{ __('common.actions') }}
#{{ $prescription->id }} {{ $prescription->issued_at?->format('M d, Y H:i') ?? __('common.not_available') }} {{ $prescription->items_count }} @can('prescriptions.view') {{ __('patients.show_page.actions.open') }} {{ __('patients.show_page.actions.print_prescription') }} @endcan
{{ __('patients.show_page.empty.no_prescriptions') }}
@if ($patientPrescriptions->hasPages())
{{ $patientPrescriptions->links() }}
@endif
{{ __('patients.show_page.sections.recent_timeline') }}
{{ __('patients.show_page.actions.view_full_timeline') }}
@forelse ($timeline->take(5) as $item)
{{ ucfirst($item['type']) }} • {{ \Illuminate\Support\Carbon::parse($item['date'])->format('M d, Y H:i') }}
{{ $item['title'] }}
{{ $item['subtitle'] }}
@if (filled($item['description']))
{{ $item['description'] }}
@endif
@empty

{{ __('patients.show_page.empty.no_activity') }}

@endforelse
{{ __('patients.show_page.sections.alerts_allergies') }}
{{ __('patients.form.fields.allergies') }}
{{ $patient->medicalHistory?->allergies ?: __('patients.show_page.empty.no_allergy_info') }}
{{ __('patients.show_page.labels.conditions') }}
{{ $patient->medicalHistory?->chronic_diseases ?: __('patients.show_page.empty.no_conditions') }}
{{ __('patients.form.fields.important_alerts') }}
{{ $patient->medicalHistory?->important_alerts ?: __('patients.show_page.empty.no_alerts') }}
{{ __('patients.show_page.sections.emergency_contacts') }}
@forelse ($patient->emergencyContacts as $contact)
{{ $contact->name }}
{{ $contact->relation ?: __('patients.show_page.empty.relation_not_set') }}
{{ $contact->phone }}
@if ($contact->notes)
{{ $contact->notes }}
@endif
@empty

{{ __('patients.show_page.empty.no_contacts') }}

@endforelse
@elseif ($activeTab === 'history')
{{ __('patients.show_page.sections.medical_history') }}
{{ __('patients.show_page.labels.last_updated') }} {{ $patient->medicalHistory?->updated_at?->diffForHumans() ?? __('patients.show_page.empty.never') }}
@csrf
{{ __('patients.show_page.labels.updated_by') }} {{ $patient->medicalHistory?->updatedBy?->displayName ?? __('common.not_available') }}
@elseif ($activeTab === 'contacts')
{{ __('patients.show_page.actions.add_emergency_contact') }}
@csrf
{{ __('patients.show_page.sections.existing_contacts') }}
@forelse ($patient->emergencyContacts as $contact)
@csrf @method('PUT')
@csrf @method('DELETE')
@empty

{{ __('patients.show_page.empty.no_contacts') }}

@endforelse
@elseif ($activeTab === 'files')
{{ __('patients.form.sections.upload_medical_file') }}
@csrf
{{ __('patients.show_page.sections.uploaded_files') }}
@forelse ($patient->medicalFiles as $file) @empty @endforelse
{{ __('patients.form.fields.title') }} {{ __('patients.form.fields.category') }} {{ __('patients.show_page.labels.uploaded') }} {{ __('patients.show_page.labels.visible') }} {{ __('common.actions') }}
{{ $file->title }}
{{ $file->file_name }}
{{ str($file->file_category?->value ?? $file->file_category)->replace('_', ' ')->title() }} {{ $file->uploaded_at?->format('M d, Y H:i') ?: __('common.none') }} {{ $file->is_visible_to_patient ? __('patients.show_page.labels.yes') : __('patients.show_page.labels.no') }} @if ($file->file_path) {{ __('patients.show_page.actions.open') }} @endif
@csrf @method('DELETE')
{{ __('patients.show_page.empty.no_files') }}
@else
{{ __('patients.show_page.sections.patient_timeline') }}
{{ __('patients.show_page.timeline_subtitle') }}
@forelse ($timeline as $item)
{{ ucfirst($item['type']) }}
{{ $item['title'] }}
{{ $item['subtitle'] }}
{{ \Illuminate\Support\Carbon::parse($item['date'])->format('M d, Y H:i') }}
@if (filled($item['description']))
{{ $item['description'] }}
@endif @if (!empty($item['route'])) {{ __('patients.show_page.actions.open') }} @endif
@empty

{{ __('patients.show_page.empty.no_timeline') }}

@endforelse
@endif
@endsection