{{-- Primary Care profile, injected into ClinicCore's patient/appointment screens. --}}
@php
    $model = \Modules\PrimaryCareClinic\Entities\PrimaryCarePatientProfile::class;
    $prof = $model::where('clc_patient_id', $patient->id)->first();
    $driver = \Modules\ClinicCore\Entities\Services\SpecialtyDriverRegistry::get('primary_care');
    $fields = $driver ? $driver->fields() : [];
    $hasAny = false;
    if ($prof) { foreach ($fields as $f) { $v = $prof->{$f['name']}; if (!empty($v)) { $hasAny = true; break; } } }
@endphp
@if($prof && $hasAny)
<div class="detail-row" style="display:block;">
    <span class="dk" style="display:block;margin-bottom:6px;"><i class="fas fa-stethoscope fa-fw"></i> Primary Care</span>
    @foreach($fields as $f)
        @php $v = $prof->{$f['name']}; @endphp
        @if($f['type'] === 'bool')
            @if($v)<span class="label label-info" style="font-size:10px;margin-right:3px;">{{ $f['label'] }}</span>@endif
        @elseif($v !== null && $v !== '')
            <div class="detail-row"><span class="dk">{{ $f['label'] }}</span><span class="dv">{{ $f['type'] === 'select' ? ($f['options'][$v] ?? $v) : $v }}</span></div>
        @endif
    @endforeach
</div>
@endif
