xref: /webtrees/resources/views/modules/personal_facts/tab.phtml (revision 090a06287954f43677f06ea778b3f67c029de8fe)
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_historical_facts
16 * @var Individual       $individual
17 */
18
19?>
20
21<div class="wt-tab-facts py-4">
22    <table class="table wt-facts-table">
23        <tbody>
24            <tr>
25                <td colspan="2">
26                    <label>
27                        <input id="show-relatives-facts" type="checkbox" data-toggle="collapse" data-target=".wt-relation-fact">
28                        <?= I18N::translate('Events of close relatives') ?>
29                    </label>
30                    <?php if ($has_historical_facts) : ?>
31                        <label>
32                            <input id="show-historical-facts" type="checkbox" data-toggle="collapse" data-target=".wt-historic-fact">
33                            <?= I18N::translate('Historic events') ?>
34                        </label>
35                    <?php endif ?>
36                </td>
37            </tr>
38
39            <?php foreach ($facts as $fact) : ?>
40                <?php FunctionsPrintFacts::printFact($fact, $individual) ?>
41            <?php endforeach ?>
42
43            <?php if ($facts->isEmpty()) : ?>
44                <tr>
45                    <td colspan="2">
46                        <?= I18N::translate('There are no facts for this individual.') ?>
47                    </td>
48                </tr>
49            <?php endif ?>
50
51            <?php if ($individual->canEdit()) : ?>
52                <?= view('edit/paste-fact-row', ['record' => $individual, 'facts' => $clipboard_facts]) ?>
53
54                <?php FunctionsPrint::printAddNewFact($individual, $facts, Individual::RECORD_TYPE) ?>
55            <?php endif ?>
56        </tbody>
57    </table>
58</div>
59
60<?php View::push('javascript') ?>
61<script>
62  'use strict';
63
64  webtrees.persistentToggle('show-relatives-facts');
65  webtrees.persistentToggle('show-historical-facts');
66</script>
67<?php View::endpush() ?>
68