<?php $directoryFieldId = $directoryFieldId ?? uniqid('medical_', false); ?>
<div class="col-md-6">
    <label class="form-label"><?= h(t('animal.veterinary_clinic')) ?></label>
    <select class="form-select directory-contact-select medical-clinic-select" name="clinic_contact_id"
        data-pair="<?= h($directoryFieldId) ?>" data-new-target="<?= h($directoryFieldId) ?>ClinicNew" required>
        <option value="">— <?= h(t('common.choose')) ?> —</option>
        <?php foreach ($directoryClinics as $contact): ?><option value="<?= (int)$contact['id'] ?>">
            <?= h($contact['name']) ?></option><?php endforeach; ?>
        <option value="new">＋ <?= h(t('animal.create_clinic')) ?></option>
    </select>
    <input class="form-control mt-2 d-none" id="<?= h($directoryFieldId) ?>ClinicNew" name="new_clinic_name"
        placeholder="<?= h(t('animal.new_clinic_name')) ?>">
</div>
<div class="col-md-6">
    <label class="form-label"><?= h(t('animal.form.veterinarian')) ?></label>
    <select class="form-select directory-contact-select medical-vet-select" name="vet_contact_id"
        data-pair="<?= h($directoryFieldId) ?>" data-new-target="<?= h($directoryFieldId) ?>VetNew" required>
        <option value="">— <?= h(t('common.choose')) ?> —</option>
        <?php foreach ($veterinarians as $contact): ?><option value="<?= (int)$contact['id'] ?>"
            data-organization="<?= (int)($contact['organization_id'] ?? 0) ?>"><?= h($contact['name']) ?></option>
        <?php endforeach; ?>
        <option value="new">＋ <?= h(t('animal.create_vet')) ?></option>
    </select>
    <input class="form-control mt-2 d-none" id="<?= h($directoryFieldId) ?>VetNew" name="new_vet_name"
        placeholder="<?= h(t('animal.new_vet_name')) ?>">
</div>
<div class="col-12">
    <div class="form-hint"><?= h(t('animal.medical_pair_hint')) ?></div>
</div>
