xref: /webtrees/resources/views/lists/anniversaries-table.phtml (revision 10e0649788c8d7d4974d81c048ca2b225df8f22e)
1d70512abSGreg Roach<?php
2d70512abSGreg Roach
3*10e06497SGreg Roachdeclare(strict_types=1);
4*10e06497SGreg Roach
5cd51dbdfSGreg Roachuse Fisharebest\Webtrees\Fact;
6d70512abSGreg Roachuse Fisharebest\Webtrees\I18N;
7cd51dbdfSGreg Roachuse Fisharebest\Webtrees\Individual;
8cd51dbdfSGreg Roachuse Fisharebest\Webtrees\View;
9cd51dbdfSGreg Roachuse Illuminate\Support\Collection;
10d70512abSGreg Roach
1142a132ddSGreg Roach/**
1236779af1SGreg Roach * @var Collection<int,Fact>     $facts
1301221f27SGreg Roach * @var int                      $limit_high
1401221f27SGreg Roach * @var int                      $limit_low
15c9128110SGreg Roach * @var array<array<int,string>> $order
1642a132ddSGreg Roach */
1742a132ddSGreg Roach
18d70512abSGreg Roach?>
1948f08416SGreg Roach
2042a132ddSGreg Roach<div class="table-responsive">
21e24053e5SGreg Roach    <table
22e24053e5SGreg Roach        class="table table-sm datatable wt-table-events"
23e24053e5SGreg Roach        <?= view('lists/datatables-attributes') ?>
24dc270d8cSGreg Roach        data-paging="<?= $facts->count() >= $limit_high ? 'true' : 'false' ?>"
25e24053e5SGreg Roach        data-filter="false"
26e24053e5SGreg Roach        data-info="false"
27e24053e5SGreg Roach        data-length-change="false"
2801221f27SGreg Roach        data-page-length="<?= e($limit_low) ?>"
29c9128110SGreg Roach        data-order="<?= e(json_encode($order, JSON_THROW_ON_ERROR)) ?>"
30e24053e5SGreg Roach    >
3148f08416SGreg Roach        <thead>
3248f08416SGreg Roach            <tr>
3348f08416SGreg Roach                <th>
3448f08416SGreg Roach                    <?= I18N::translate('Record') ?>
3548f08416SGreg Roach                </th>
3648f08416SGreg Roach                <th>
3748f08416SGreg Roach                    <?= I18N::translate('Date') ?>
3848f08416SGreg Roach                </th>
3948f08416SGreg Roach                <th>
4048f08416SGreg Roach                    <?= view('icons/anniversary') ?>
41315eb316SGreg Roach                    <span class="visually-hidden"><?= I18N::translate('Anniversary') ?></span>
4248f08416SGreg Roach                </th>
4348f08416SGreg Roach                <th>
4448f08416SGreg Roach                    <?= I18N::translate('Event') ?>
4548f08416SGreg Roach                </th>
4648f08416SGreg Roach            </tr>
4748f08416SGreg Roach        </thead>
4848f08416SGreg Roach        <tbody>
4948f08416SGreg Roach            <?php foreach ($facts as $fact) : ?>
5048f08416SGreg Roach                <?php $record = $fact->record(); ?>
5148f08416SGreg Roach                <tr>
5248f08416SGreg Roach                    <td data-sort="<?= e($record->sortName()) ?>">
5348f08416SGreg Roach                        <a href="<?= e($record->url()) ?>">
5448f08416SGreg Roach                            <?= $record->fullName() ?>
5548f08416SGreg Roach                        </a>
5648f08416SGreg Roach                        <?php if ($record instanceof Individual) : ?>
5708362db4SGreg Roach                            <small><?= view('icons/sex', ['sex' => $record->sex()]) ?></small>
5848f08416SGreg Roach                        <?php endif ?>
5948f08416SGreg Roach                    </td>
6054764cfcSGreg Roach                    <td data-sort="<?= $fact->jd + $fact->anniv / 10000.0 ?>">
6166ecd017SGreg Roach                        <?= $fact->date()->display($record->tree(), null, true) ?>
6248f08416SGreg Roach                    </td>
6348f08416SGreg Roach                    <td data-sort="<?= $fact->anniv ?>">
6448f08416SGreg Roach                        <?= $fact->anniv ?>
6548f08416SGreg Roach                    </td>
6648f08416SGreg Roach                    <td data-sort="<?= $fact->label() ?>">
6748f08416SGreg Roach                        <?= $fact->label() ?>
6848f08416SGreg Roach                    </td>
6948f08416SGreg Roach                </tr>
7048f08416SGreg Roach            <?php endforeach ?>
7148f08416SGreg Roach        </tbody>
7248f08416SGreg Roach    </table>
7342a132ddSGreg Roach</div>
7448f08416SGreg Roach
7548f08416SGreg Roach<?php View::push('javascript') ?>
7648f08416SGreg Roach<script>
7748f08416SGreg Roach  $(".wt-table-events").dataTable();
7848f08416SGreg Roach</script>
7948f08416SGreg Roach<?php View::endpush() ?>
80