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