xref: /webtrees/resources/views/lists/anniversaries-table.phtml (revision 0999990b36236eec02be2ee4f380b67733f7bb38)
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<mixed>     $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        <?php if ($facts->count() < e($limit_high)) : ?>
23            data-paging="false"
24        <?php endif ?>
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 ?? [])) ?>"
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="sr-only"><?= 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 ?>">
61                        <?= $fact->date()->display(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