{{-- Obstetrics & Gynaecology fields, injected into ClinicCore's patient form
     via the SpecialtyDriverRegistry. Receives $patient (ClcPatient|null). --}}
@php
    $ob = (isset($patient) && $patient)
        ? \Modules\GynaecologyClinic\Entities\ObgynPatientProfile::where('clc_patient_id', $patient->id)->first()
        : null;
    $v = fn($f) => old($f, $ob->{$f} ?? '');
    $lmp = old('lmp_date', $ob && $ob->lmp_date ? $ob->lmp_date->format('Y-m-d') : '');
@endphp
<div class="row">
    <div class="col-md-12"><h5 style="margin:6px 0;"><i class="fas fa-venus" style="color:#e83e8c;"></i> Obstetrics &amp; Gynaecology</h5><hr style="margin:4px 0 12px;"></div>
</div>
<div class="row">
    <div class="col-md-3"><div class="form-group"><label>Gravida</label><input type="number" min="0" name="gravida" class="form-control input-sm" value="{{ $v('gravida') }}"></div></div>
    <div class="col-md-3"><div class="form-group"><label>Para</label><input type="number" min="0" name="para" class="form-control input-sm" value="{{ $v('para') }}"></div></div>
    <div class="col-md-3"><div class="form-group"><label>Abortions</label><input type="number" min="0" name="abortions" class="form-control input-sm" value="{{ $v('abortions') }}"></div></div>
    <div class="col-md-3"><div class="form-group"><label>Living</label><input type="number" min="0" name="living" class="form-control input-sm" value="{{ $v('living') }}"></div></div>
</div>
<div class="row">
    <div class="col-md-3"><div class="form-group"><label>Menarche age</label><input type="number" min="0" name="menarche_age" class="form-control input-sm" value="{{ $v('menarche_age') }}"></div></div>
    <div class="col-md-3"><div class="form-group"><label>Cycle length (days)</label><input type="number" min="0" name="cycle_length_days" class="form-control input-sm" value="{{ $v('cycle_length_days') }}"></div></div>
    <div class="col-md-3"><div class="form-group"><label>LMP date</label><input type="date" name="lmp_date" class="form-control input-sm" value="{{ $lmp }}"></div></div>
    <div class="col-md-3"><div class="form-group"><label>Contraception</label><input type="text" name="contraception" class="form-control input-sm" value="{{ $v('contraception') }}" placeholder="OCP, IUD, none…"></div></div>
</div>
<div class="row">
    <div class="col-md-3">
        <div class="checkbox"><label><input type="checkbox" name="is_pregnant" value="1" {{ old('is_pregnant', $ob->is_pregnant ?? false) ? 'checked' : '' }}> Currently pregnant</label></div>
    </div>
    <div class="col-md-3">
        <div class="checkbox"><label><input type="checkbox" name="cycle_regular" value="1" {{ old('cycle_regular', $ob ? $ob->cycle_regular : true) ? 'checked' : '' }}> Regular cycle</label></div>
    </div>
    <div class="col-md-3">
        <div class="checkbox"><label><input type="checkbox" name="menopause" value="1" {{ old('menopause', $ob->menopause ?? false) ? 'checked' : '' }}> Menopause</label></div>
    </div>
    <div class="col-md-3"><div class="form-group"><label>Notes</label><input type="text" name="notes" class="form-control input-sm" value="{{ $v('notes') }}"></div></div>
</div>
<p class="text-muted" style="font-size:11px;margin-top:-4px;"><i class="fas fa-calculator"></i> When pregnant with an LMP, gestational age &amp; estimated due date are computed automatically.</p>
