xref: /webtrees/resources/views/modules/personal_facts/tab.phtml (revision 6fcafd028e511367c3fcdbfaa31aa05a85bf85c0)
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                <?= view('edit/paste-fact-row', ['record' => $individual, 'facts' => $clipboard_facts]) ?>
65
66                <?php FunctionsPrint::printAddNewFact($individual, $facts, Individual::RECORD_TYPE) ?>
67            <?php endif ?>
68        </tbody>
69    </table>
70</div>
71
72<?php View::push('javascript') ?>
73<script>
74  'use strict';
75
76  webtrees.persistentToggle('show-associate-facts');
77  webtrees.persistentToggle('show-relatives-facts');
78  webtrees.persistentToggle('show-historical-facts');
79</script>
80<?php View::endpush() ?>
81