xref: /webtrees/resources/views/lists/anniversaries-table.phtml (revision 1792ff1cf1956b41f3e3c853cfb279a803a71ed2)
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 */
14
15?>
16
17<div class="table-responsive">
18    <table
19        class="table table-sm datatable wt-table-events"
20        <?= view('lists/datatables-attributes') ?>
21        <?php if ($facts->count() < e($limit_high)) : ?>
22            data-paging="false"
23        <?php endif ?>
24        data-filter="false"
25        data-info="false"
26        data-length-change="false"
27        data-page-length="<?= e($limit_low) ?>"
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="sr-only"><?= 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 ?>">
59                        <?= $fact->date()->display(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