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