xref: /webtrees/resources/views/modules/personal_facts/tab.phtml (revision 076e4c54ac11a9904fac036564df1cb3d89b3c22)
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 Fisharebest\Webtrees\View;
9use Illuminate\Support\Collection;
10
11/**
12 * @var bool             $can_edit
13 * @var Collection<Fact> $clipboard_facts
14 * @var Collection<Fact> $facts
15 * @var bool             $has_associate_facts
16 * @var bool             $has_historic_facts
17 * @var bool             $has_relative_facts
18 * @var Individual       $individual
19 */
20
21?>
22
23<div class="wt-tab-facts py-4">
24    <table class="table wt-facts-table">
25        <tbody>
26            <tr>
27                <td colspan="2">
28                    <?php if ($has_associate_facts) : ?>
29                        <label>
30                            <input id="show-associate-facts" type="checkbox" data-toggle="collapse" data-target=".wt-associate-fact">
31                            <?= I18N::translate('Associated events') ?>
32                        </label>
33                    <?php endif ?>
34
35                    <?php if ($has_relative_facts) : ?>
36                        <label>
37                            <input id="show-relatives-facts" type="checkbox" data-toggle="collapse" data-target=".wt-relation-fact">
38                            <?= I18N::translate('Events of close relatives') ?>
39                        </label>
40                    <?php endif ?>
41
42                    <?php if ($has_historic_facts) : ?>
43                        <label>
44                            <input id="show-historical-facts" type="checkbox" data-toggle="collapse" data-target=".wt-historic-fact">
45                            <?= I18N::translate('Historic events') ?>
46                        </label>
47                    <?php endif ?>
48                </td>
49            </tr>
50
51            <?php foreach ($facts as $fact) : ?>
52                <?php FunctionsPrintFacts::printFact($fact, $individual) ?>
53            <?php endforeach ?>
54
55            <?php if ($facts->isEmpty()) : ?>
56                <tr>
57                    <td colspan="2">
58                        <?= I18N::translate('There are no facts for this individual.') ?>
59                    </td>
60                </tr>
61            <?php endif ?>
62
63            <?php if ($individual->canEdit()) : ?>
64                <?php FunctionsPrint::printAddNewFact($individual) ?>
65            <?php endif ?>
66        </tbody>
67    </table>
68</div>
69
70<?php View::push('javascript') ?>
71<script>
72  'use strict';
73
74  webtrees.persistentToggle('show-associate-facts');
75  webtrees.persistentToggle('show-relatives-facts');
76  webtrees.persistentToggle('show-historical-facts');
77</script>
78<?php View::endpush() ?>
79