xref: /webtrees/resources/views/modules/personal_facts/tab.phtml (revision 91a257a4cd149099de2291e3d62a1b61f2f06bcd)
1d70512abSGreg Roach<?php
2d70512abSGreg Roach
37c2c99faSGreg Roachuse Fisharebest\Webtrees\Fact;
4d70512abSGreg Roachuse Fisharebest\Webtrees\Functions\FunctionsPrint;
502467d32SGreg Roachuse Fisharebest\Webtrees\Functions\FunctionsPrintFacts;
602467d32SGreg Roachuse Fisharebest\Webtrees\I18N;
702467d32SGreg Roachuse Fisharebest\Webtrees\Individual;
802467d32SGreg Roachuse Fisharebest\Webtrees\View;
97c2c99faSGreg Roachuse Illuminate\Support\Collection;
107c2c99faSGreg Roach
117c2c99faSGreg Roach/**
127c2c99faSGreg Roach * @var bool             $can_edit
137c2c99faSGreg Roach * @var Collection<Fact> $clipboard_facts
147c2c99faSGreg Roach * @var Collection<Fact> $facts
15*91a257a4SGreg Roach * @var bool             $has_associate_facts
16*91a257a4SGreg Roach * @var bool             $has_historic_facts
17*91a257a4SGreg Roach * @var bool             $has_relative_facts
187c2c99faSGreg Roach * @var Individual       $individual
197c2c99faSGreg Roach */
20d70512abSGreg Roach
21d70512abSGreg Roach?>
22dd6b2bfcSGreg Roach
234a2590a5SGreg Roach<div class="wt-tab-facts py-4">
24dd6b2bfcSGreg Roach    <table class="table wt-facts-table">
25dd6b2bfcSGreg Roach        <tbody>
26dd6b2bfcSGreg Roach            <tr>
27dd6b2bfcSGreg Roach                <td colspan="2">
28*91a257a4SGreg Roach                    <?php if ($has_associate_facts) : ?>
29*91a257a4SGreg Roach                        <label>
30*91a257a4SGreg Roach                            <input id="show-associate-facts" type="checkbox" data-toggle="collapse" data-target=".wt-associate-fact">
31*91a257a4SGreg Roach                            <?= I18N::translate('Associated events') ?>
32*91a257a4SGreg Roach                        </label>
33*91a257a4SGreg Roach                    <?php endif ?>
34*91a257a4SGreg Roach
35*91a257a4SGreg Roach                    <?php if ($has_relative_facts) : ?>
36dd6b2bfcSGreg Roach                        <label>
37dd6b2bfcSGreg Roach                            <input id="show-relatives-facts" type="checkbox" data-toggle="collapse" data-target=".wt-relation-fact">
38dd6b2bfcSGreg Roach                            <?= I18N::translate('Events of close relatives') ?>
39dd6b2bfcSGreg Roach                        </label>
40*91a257a4SGreg Roach                    <?php endif ?>
41*91a257a4SGreg Roach
42*91a257a4SGreg Roach                    <?php if ($has_historic_facts) : ?>
43dd6b2bfcSGreg Roach                        <label>
44dd6b2bfcSGreg Roach                            <input id="show-historical-facts" type="checkbox" data-toggle="collapse" data-target=".wt-historic-fact">
45051c822dSGreg Roach                            <?= I18N::translate('Historic events') ?>
46dd6b2bfcSGreg Roach                        </label>
47dd6b2bfcSGreg Roach                    <?php endif ?>
48dd6b2bfcSGreg Roach                </td>
49dd6b2bfcSGreg Roach            </tr>
50dd6b2bfcSGreg Roach
51dd6b2bfcSGreg Roach            <?php foreach ($facts as $fact) : ?>
52dd6b2bfcSGreg Roach                <?php FunctionsPrintFacts::printFact($fact, $individual) ?>
53dd6b2bfcSGreg Roach            <?php endforeach ?>
54dd6b2bfcSGreg Roach
5539ca88baSGreg Roach            <?php if ($facts->isEmpty()) : ?>
56dd6b2bfcSGreg Roach                <tr>
57dd6b2bfcSGreg Roach                    <td colspan="2">
58dd6b2bfcSGreg Roach                        <?= I18N::translate('There are no facts for this individual.') ?>
59dd6b2bfcSGreg Roach                    </td>
60dd6b2bfcSGreg Roach                </tr>
61dd6b2bfcSGreg Roach            <?php endif ?>
62dd6b2bfcSGreg Roach
63dd6b2bfcSGreg Roach            <?php if ($individual->canEdit()) : ?>
642adcbd9aSGreg Roach                <?= view('edit/paste-fact-row', ['record' => $individual, 'facts' => $clipboard_facts]) ?>
652adcbd9aSGreg Roach
6602467d32SGreg Roach                <?php FunctionsPrint::printAddNewFact($individual, $facts, Individual::RECORD_TYPE) ?>
67dd6b2bfcSGreg Roach            <?php endif ?>
68dd6b2bfcSGreg Roach        </tbody>
69dd6b2bfcSGreg Roach    </table>
70dd6b2bfcSGreg Roach</div>
71dd6b2bfcSGreg Roach
72dd6b2bfcSGreg Roach<?php View::push('javascript') ?>
73dd6b2bfcSGreg Roach<script>
74dd6b2bfcSGreg Roach  'use strict';
75dd6b2bfcSGreg Roach
76*91a257a4SGreg Roach  webtrees.persistentToggle('show-associate-facts');
772cf1b3d7SGreg Roach  webtrees.persistentToggle('show-relatives-facts');
782cf1b3d7SGreg Roach  webtrees.persistentToggle('show-historical-facts');
79dd6b2bfcSGreg Roach</script>
80dd6b2bfcSGreg Roach<?php View::endpush() ?>
81