xref: /webtrees/resources/views/modules/personal_facts/tab.phtml (revision fe18b1170b60ae6b04cc492983ad345e8206b16d)
1<?php
2
3use Fisharebest\Webtrees\Fact;
4use Fisharebest\Webtrees\Functions\FunctionsPrint;
5use Fisharebest\Webtrees\Functions\FunctionsPrintFacts;
6use Fisharebest\Webtrees\I18N;
7use Fisharebest\Webtrees\Individual;
8use Illuminate\Support\Collection;
9
10/**
11 * @var bool             $can_edit
12 * @var Collection<Fact> $clipboard_facts
13 * @var Collection<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 py-4">
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">
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">
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">
48                            <?= I18N::translate('Historic events') ?>
49                        </label>
50                    <?php endif ?>
51                </td>
52            </tr>
53
54            <?php foreach ($facts as $fact) : ?>
55                <?php FunctionsPrintFacts::printFact($fact, $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                <?php FunctionsPrint::printAddNewFact($individual) ?>
68            <?php endif ?>
69        </tbody>
70    </table>
71</div>
72