xref: /webtrees/resources/views/modules/recent_changes/changes-table.phtml (revision bd77bf389a9b57f2cd2ff4371c57b8ed32028a48)
1<?php
2
3use Fisharebest\Webtrees\Family;
4use Fisharebest\Webtrees\I18N;
5use Fisharebest\Webtrees\Individual;
6use Fisharebest\Webtrees\Media;
7use Fisharebest\Webtrees\Note;
8use Fisharebest\Webtrees\Repository;
9use Fisharebest\Webtrees\Source;
10use Fisharebest\Webtrees\Submitter;
11use Fisharebest\Webtrees\View;
12use Illuminate\Support\Collection;
13
14/**
15 * @var bool                 $show_user
16 * @var Collection<stdClass> $rows
17 */
18?>
19
20<div class="table-responsive">
21    <table
22        class="table table-sm wt-table-changes datatables d-none"
23        <?= view('lists/datatables-attributes') ?>
24        data-filter="false"
25        data-info="false"
26        data-paging="false"
27    >
28        <thead>
29            <tr>
30                <th class="wt-side-block-optional">
31                <span class="sr-only">
32                    <?= I18N::translate('Type') ?>
33                </span>
34                </th>
35                <th>
36                    <?= I18N::translate('Record') ?>
37                </th>
38                <th>
39                    <?= I18N::translate('Last change') ?>
40                </th>
41                <?php if ($show_user) : ?>
42                    <th>
43                        <?= I18N::translate('User') ?>
44                    </th>
45                <?php endif ?>
46            </tr>
47        </thead>
48        <tbody>
49            <?php foreach ($rows as $row) : ?>
50                <tr>
51                    <td data-sort="<?= $row->record::RECORD_TYPE ?>" class="text-centre wt-side-block-optional">
52                        <?php if ($row->record::RECORD_TYPE === Individual::RECORD_TYPE) : ?>
53                            <?= view('icons/individual') ?>
54                            <span class="sr-only"><?= I18N::translate('Individual') ?></span>
55                        <?php elseif ($row->record::RECORD_TYPE === Family::RECORD_TYPE) : ?>
56                            <?= view('icons/family') ?>
57                            <span class="sr-only"><?= I18N::translate('Family') ?></span>
58                        <?php elseif ($row->record::RECORD_TYPE === Media::RECORD_TYPE) : ?>
59                            <?= view('icons/media') ?>
60                            <span class="sr-only"><?= I18N::translate('Media') ?></span>
61                        <?php elseif ($row->record::RECORD_TYPE === Note::RECORD_TYPE) : ?>
62                            <?= view('icons/note') ?>
63                            <span class="sr-only"><?= I18N::translate('Note') ?></span>
64                        <?php elseif ($row->record::RECORD_TYPE === Source::RECORD_TYPE) : ?>
65                            <?= view('icons/source') ?>
66                            <span class="sr-only"><?= I18N::translate('Source') ?></span>
67                        <?php elseif ($row->record::RECORD_TYPE === Submitter::RECORD_TYPE) : ?>
68                            <?= view('icons/submitter') ?>
69                            <span class="sr-only"><?= I18N::translate('Submitter') ?></span>
70                        <?php elseif ($row->record::RECORD_TYPE === Repository::RECORD_TYPE) : ?>
71                            <?= view('icons/repository') ?>
72                            <span class="sr-only"><?= I18N::translate('Repository') ?></span>
73                        <?php endif ?>
74                    </td>
75
76                    <td data-sort="<?= e($row->record->sortName()) ?>">
77                        <a href="<?= e($row->record->url()) ?>"><?= $row->record->fullName() ?></a>
78                    </td>
79
80                    <td data-sort="<?= $row->time->timestamp ?>">
81                        <?= view('components/datetime', ['timestamp' => $row->time]) ?>
82                    </td>
83
84                    <?php if ($show_user) : ?>
85                        <td>
86                            <?= e($row->user->userName()) ?>
87                        </td>
88                    <?php endif ?>
89                </tr>
90            <?php endforeach ?>
91        </tbody>
92    </table>
93</div>
94
95<?php View::push('javascript') ?>
96<script>
97  $(".wt-table-changes").dataTable().removeClass("d-none");
98</script>
99<?php View::endpush() ?>
100