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