xref: /webtrees/resources/views/lists/anniversaries-table.phtml (revision 76937c180deb84856ce02e1dd263df1d97c8c03a)
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 */
12
13?>
14
15<div class="table-responsive">
16    <table class="table table-sm datatable wt-table-events" data-info="false" data-paging="false" data-searching="false" data-sorting="<?= e('[[1, "asc" ]]') ?>">
17        <thead>
18            <tr>
19                <th>
20                    <?= I18N::translate('Record') ?>
21                </th>
22                <th>
23                    <?= I18N::translate('Date') ?>
24                </th>
25                <th>
26                    <?= view('icons/anniversary') ?>
27                    <span class="sr-only"><?= I18N::translate('Anniversary') ?></span>
28                </th>
29                <th>
30                    <?= I18N::translate('Event') ?>
31                </th>
32            </tr>
33        </thead>
34        <tbody>
35            <?php foreach ($facts as $fact) : ?>
36                <?php $record = $fact->record(); ?>
37                <tr>
38                    <td data-sort="<?= e($record->sortName()) ?>">
39                        <a href="<?= e($record->url()) ?>">
40                            <?= $record->fullName() ?>
41                        </a>
42                        <?php if ($record instanceof Individual) : ?>
43                            <small><?= view('icons/sex', ['sex' => $record->sex()]) ?></small>
44                        <?php endif ?>
45                    </td>
46                    <td data-sort="<?= $fact->jd ?>">
47                        <?= $fact->date()->display(true) ?>
48                    </td>
49                    <td data-sort="<?= $fact->anniv ?>">
50                        <?= $fact->anniv ?>
51                    </td>
52                    <td data-sort="<?= $fact->label() ?>">
53                        <?= $fact->label() ?>
54                    </td>
55                </tr>
56            <?php endforeach ?>
57        </tbody>
58    </table>
59</div>
60
61<?php View::push('javascript') ?>
62<script>
63  $(".wt-table-events").dataTable();
64</script>
65<?php View::endpush() ?>
66