xref: /webtrees/resources/views/modules/personal_facts/tab.phtml (revision 1f244d772ed55c1ea8eecba8f9ca36a77f054c34)
1<?php
2
3use Fisharebest\Webtrees\Functions\FunctionsPrint;
4use Fisharebest\Webtrees\Functions\FunctionsPrintFacts;
5use Fisharebest\Webtrees\I18N;
6use Fisharebest\Webtrees\Individual;
7use Fisharebest\Webtrees\View;
8
9?>
10
11<div class="wt-tab-facts py-4">
12    <table class="table wt-facts-table">
13        <tbody>
14            <tr>
15                <td colspan="2">
16                    <label>
17                        <input id="show-relatives-facts" type="checkbox" data-toggle="collapse" data-target=".wt-relation-fact">
18                        <?= I18N::translate('Events of close relatives') ?>
19                    </label>
20                    <?php if ($has_historical_facts) : ?>
21                        <label>
22                            <input id="show-historical-facts" type="checkbox" data-toggle="collapse" data-target=".wt-historic-fact">
23                            <?= I18N::translate('Historic events') ?>
24                        </label>
25                    <?php endif ?>
26                </td>
27            </tr>
28
29            <?php foreach ($facts as $fact) : ?>
30                <?php FunctionsPrintFacts::printFact($fact, $individual) ?>
31            <?php endforeach ?>
32
33            <?php if ($facts->isEmpty()) : ?>
34                <tr>
35                    <td colspan="2">
36                        <?= I18N::translate('There are no facts for this individual.') ?>
37                    </td>
38                </tr>
39            <?php endif ?>
40
41            <?php if ($individual->canEdit()) : ?>
42                <?= view('edit/paste-fact-row', ['record' => $individual, 'facts' => $clipboard_facts]) ?>
43
44                <?php FunctionsPrint::printAddNewFact($individual, $facts, Individual::RECORD_TYPE) ?>
45            <?php endif ?>
46        </tbody>
47    </table>
48</div>
49
50<?php View::push('javascript') ?>
51<script>
52  'use strict';
53
54  persistent_toggle('show-relatives-facts');
55  persistent_toggle('show-historical-facts');
56</script>
57<?php View::endpush() ?>
58