<?php

declare(strict_types=1);

use Fisharebest\Webtrees\Fact;
use Fisharebest\Webtrees\I18N;

/**
 * @var iterable<int,Fact> $family_anniversaries
 * @var iterable<int,Fact> $individual_anniversaries
 * @var int                $family_count
 * @var int                $individual_count
 */

?>

<table class="w-100" role="presentation">
    <tr>
        <td class="wt-page-options-label text-center w-50">
            <?= view('icons/individual') ?>
            <?= I18N::plural('%s individual', '%s individuals', $individual_count, I18N::number($individual_count)) ?>
        </td>

        <td class="wt-page-options-label text-center w-50">
            <?= view('icons/family') ?>
            <?= I18N::plural('%s family', '%s families', $family_count, I18N::number($family_count)) ?>
        </td>
    </tr>

    <tr>
        <td class="wt-page-options-value align-top">
            <ul class="list-unstyled">
                <?php foreach ($individual_anniversaries as $fact) : ?>
                    <li>
                        <a href="<?= e($fact->record()->url()) ?>">
                            <?= $fact->record()->fullName() ?>
                        </a>

                        <div class="indent">
                            <?= $fact->label() ?> — <?= $fact->date()->display($fact->record()->tree()) ?>
                            <?php if ($fact->attribute('PLAC') !== '') : ?>
                                — <?=  $fact->attribute('PLAC') ?>
                            <?php endif ?>
                        </div>
                    </li>
                <?php endforeach ?>
            </ul>
        </td>
        <td class="wt-page-options-value align-top">
            <ul class="list-unstyled">
                <?php foreach ($family_anniversaries as $fact) : ?>
                    <li>
                        <a href="<?= e($fact->record()->url()) ?>">
                            <?= $fact->record()->fullName() ?>
                        </a>

                        <div class="indent">
                            <?= $fact->label() ?> — <?= $fact->date()->display($fact->record()->tree()) ?>
                            <?php if ($fact->attribute('PLAC') !== '') : ?>
                                — <?=  $fact->attribute('PLAC') ?>
                            <?php endif ?>
                        </div>
                    </li>
                <?php endforeach ?>
            </ul>
        </td>
    </tr>
</table>
