<?php
// Sous-vue de la fiche animale ; les variables sont préparées par AnimalsController::show().
?>
<!-- DOCUMENTS -->
<?php if ($canViewMedical): ?>
<div class="tab-pane" id="tab-documents">
    <div class="card card-sm">
        <div class="card-header">
            <div>
                <h3 class="card-title mb-1"><?= h(t('animal.adoption_contract')) ?></h3>
                <div class="text-muted small"><?= h(t('animal.generated_copy_help')) ?></div>
            </div>
        </div>
        <div class="card-body">
            <div class="row g-3 align-items-center">
                <div class="col-md">
                    <div class="fw-bold"><?= h(t('animal.prefilled_information')) ?></div>
                    <div class="text-muted small"><?= h(t('animal.adoption_prefill')) ?></div>
                    <?php if (!empty($adoption)): ?><div class="text-success small mt-1">✓
                        <?= h(t('animal.linked_adopter', ['name' => $adoption['adopter_name'] ?? ''])) ?></div>
                    <?php else: ?><div class="text-warning small mt-1">⚠ <?= h(t('animal.no_linked_adopter')) ?></div>
                    <?php endif; ?>
                </div>
                <div class="col-md-auto d-flex flex-wrap gap-2"><a class="btn btn-outline-primary"
                        href="/animal/documents/adoption?animal_id=<?= (int)$animal['id'] ?>&format=odt"><?= h(t('animal.download_odt')) ?></a><a
                        class="btn btn-danger"
                        href="/animal/documents/adoption?animal_id=<?= (int)$animal['id'] ?>&format=pdf"
                        target="_blank"><?= h(t('animal.view_print_pdf')) ?></a></div>
            </div>
        </div>
    </div>
    <div class="card card-sm mt-3">
        <div class="card-header">
            <div>
                <h3 class="card-title mb-1"><?= h(t('animal.abandon_found')) ?></h3>
                <div class="text-muted small"><?= h(t('animal.known_info_added')) ?></div>
            </div>
        </div>
        <div class="card-body d-flex flex-wrap align-items-center gap-2">
            <div class="me-auto text-muted small"><?= h(t('animal.identity_summary')) ?></div><a
                class="btn btn-outline-primary"
                href="/animal/documents/abandon?animal_id=<?= (int)$animal['id'] ?>&format=odt"><?= h(t('animal.download_odt')) ?></a><a
                class="btn btn-danger" href="/animal/documents/abandon?animal_id=<?= (int)$animal['id'] ?>&format=pdf"
                target="_blank"><?= h(t('animal.view_print_pdf')) ?></a>
        </div>
    </div>
</div>
<?php endif; ?>
