xref: /webtrees/resources/views/lists/anniversaries-table.phtml (revision 1ff45046fabc22237b5d0d8e489c96f031fc598d)
1<?php
2
3declare(strict_types=1);
4
5use Fisharebest\Webtrees\Fact;
6use Fisharebest\Webtrees\I18N;
7use Fisharebest\Webtrees\Individual;
8use Fisharebest\Webtrees\View;
9use Illuminate\Support\Collection;
10
11/**
12 * @var Collection<int,Fact>     $facts
13 * @var int                      $limit_high
14 * @var int                      $limit_low
15 * @var array<array<int,string>> $order
16 */
17
18?>
19
20<div class="table-responsive">
21    <table
22        class="table table-sm datatable wt-table-events"
23        <?= view('lists/datatables-attributes') ?>
24        data-paging="<?= $facts->count() >= $limit_high ? 'true' : 'false' ?>"
25        data-filter="false"
26        data-info="false"
27        data-length-change="false"
28        data-page-length="<?= e($limit_low) ?>"
29        data-order="<?= e(json_encode($order, JSON_THROW_ON_ERROR)) ?>"
30    >
31        <thead>
32            <tr>
33                <th>
34                    <?= I18N::translate('Record') ?>
35                </th>
36                <th>
37                    <?= I18N::translate('Date') ?>
38                </th>
39                <th>
40                    <?= view('icons/anniversary') ?>
41                    <span class="visually-hidden"><?= I18N::translate('Anniversary') ?></span>
42                </th>
43                <th>
44                    <?= I18N::translate('Event') ?>
45                </th>
46            </tr>
47        </thead>
48        <tbody>
49            <?php foreach ($facts as $fact) : ?>
50                <?php $record = $fact->record(); ?>
51                <tr>
52                    <td data-sort="<?= e($record->sortName()) ?>">
53                        <a href="<?= e($record->url()) ?>">
54                            <?= $record->fullName() ?>
55                        </a>
56                        <?php if ($record instanceof Individual) : ?>
57                            <small><?= view('icons/sex', ['sex' => $record->sex()]) ?></small>
58                        <?php endif ?>
59                    </td>
60                    <td data-sort="<?= $fact->jd + $fact->anniv / 10000.0 ?>">
61                        <?= $fact->date()->display($record->tree(), null, true) ?>
62                    </td>
63                    <td data-sort="<?= $fact->anniv ?>">
64                        <?= $fact->anniv ?>
65                    </td>
66                    <td data-sort="<?= $fact->label() ?>">
67                        <?= $fact->label() ?>
68                    </td>
69                </tr>
70            <?php endforeach ?>
71        </tbody>
72    </table>
73</div>
74
75<?php View::push('javascript') ?>
76<script>
77  $(".wt-table-events").dataTable();
78</script>
79<?php View::endpush() ?>
80