@php $teethMap = $dentalTeethMap ?? []; $selected = old('tooth_code', request('tooth', ($dentalRows['upper'][0] ?? '16'))); $selectedData = $teethMap[$selected] ?? ['status' => 'present', 'surfaces' => [], 'conditions' => [], 'notes' => null]; $dentition = $dentalChart->dentition ?? 'adult'; $canManage = $canConsult ?? false; @endphp

Odontogram (FDI)

{{ $canManage ? 'Click a tooth to chart status, surfaces, and conditions.' : 'View tooth chart status, surfaces, and conditions.' }}

@if ($canManage)
@csrf
@else

Dentition: {{ ($dentalDentitions ?? [])[$dentition] ?? $dentition }}

@endif Print
@foreach (['upper' => 'Upper', 'lower' => 'Lower'] as $rowKey => $rowLabel)

{{ $rowLabel }}

@foreach (($dentalRows[$rowKey] ?? []) as $code) @php $t = $teethMap[$code] ?? ['status' => 'present', 'surfaces' => [], 'conditions' => []]; $baseClass = \App\Services\Care\Dentistry\DentalCatalog::toothCssClass($t['status'] ?? 'present', $t['conditions'] ?? []); $surfaces = $t['surfaces'] ?? []; @endphp {{ $code }} @if (! empty($surfaces)) @foreach (['M','O','D','B','L','I'] as $s) in_array($s, $surfaces, true), 'bg-slate-300/60' => ! in_array($s, $surfaces, true), ])> @endforeach @endif @endforeach
@endforeach
@if ($canManage)
@csrf

{{ $selected }}

Surfaces

@foreach ($dentalSurfaces as $surface) @endforeach

Conditions

@foreach ($dentalConditions as $value => $label) @endforeach
@else
Selected tooth
{{ $selected }}
Status
{{ ($dentalStatuses ?? [])[$selectedData['status'] ?? 'present'] ?? ($selectedData['status'] ?? '—') }}
Surfaces
{{ ! empty($selectedData['surfaces']) ? implode(', ', $selectedData['surfaces']) : '—' }}
Conditions
@php $conditionLabels = collect($selectedData['conditions'] ?? []) ->map(fn ($c) => ($dentalConditions ?? [])[$c] ?? $c) ->filter() ->all(); @endphp {{ $conditionLabels !== [] ? implode(', ', $conditionLabels) : '—' }}
Notes
{{ $selectedData['notes'] ?: '—' }}
@endif