xref: /webtrees/resources/views/modules/personal_facts/tab.phtml (revision f077613912070df8f1da7e8a3a41f95474fd35b6)
1<?php
2
3declare(strict_types=1);
4
5use Fisharebest\Webtrees\Fact;
6use Fisharebest\Webtrees\I18N;
7use Fisharebest\Webtrees\Individual;
8use Illuminate\Support\Collection;
9
10/**
11 * @var bool                 $can_edit
12 * @var Collection<int,Fact> $clipboard_facts
13 * @var Collection<int,Fact> $facts
14 * @var bool                 $has_associate_facts
15 * @var bool                 $has_historic_facts
16 * @var bool                 $has_relative_facts
17 * @var Individual           $individual
18 */
19
20?>
21
22<div class="wt-tab-facts">
23    <table class="table wt-facts-table" style="table-layout: fixed">
24        <colgroup>
25            <col style="width:25%">
26            <col style="width:75%">
27        </colgroup>
28        <tbody>
29            <tr>
30                <td colspan="2">
31                    <?php if ($has_associate_facts) : ?>
32                        <label>
33                            <input id="show-associate-facts" type="checkbox" data-bs-toggle="collapse" data-bs-target=".wt-associate-fact" data-wt-persist="associates" autocomplete="off">
34                            <?= I18N::translate('Associated events') ?>
35                        </label>
36                    <?php endif ?>
37
38                    <?php if ($has_relative_facts) : ?>
39                        <label>
40                            <input id="show-relatives-facts" type="checkbox" data-bs-toggle="collapse" data-bs-target=".wt-relation-fact" data-wt-persist="relatives" autocomplete="off">
41                            <?= I18N::translate('Events of close relatives') ?>
42                        </label>
43                    <?php endif ?>
44
45                    <?php if ($has_historic_facts) : ?>
46                        <label>
47                            <input id="show-historical-facts" type="checkbox" data-bs-toggle="collapse" data-bs-target=".wt-historic-fact" data-wt-persist="historic-facts" autocomplete="off">
48                            <?= I18N::translate('Historic events') ?>
49                        </label>
50                    <?php endif ?>
51                </td>
52            </tr>
53
54            <?php foreach ($facts as $fact) : ?>
55                <?= view('fact', ['fact' => $fact, 'record' => $individual]) ?>
56            <?php endforeach ?>
57
58            <?php if ($facts->isEmpty()) : ?>
59                <tr>
60                    <td colspan="2">
61                        <?= I18N::translate('There are no facts for this individual.') ?>
62                    </td>
63                </tr>
64            <?php endif ?>
65
66            <?php if ($individual->canEdit()) : ?>
67                <?= view('fact-add-new', ['record' => $individual]) ?>
68            <?php endif ?>
69        </tbody>
70    </table>
71</div>
72