summaryrefslogtreecommitdiff
path: root/resources/views/modules/personal_facts/tab.phtml
blob: ed3ae5f3020d9f2020f0f33af521b650dbc44c2f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<?php

use Fisharebest\Webtrees\Fact;
use Fisharebest\Webtrees\Functions\FunctionsPrint;
use Fisharebest\Webtrees\Functions\FunctionsPrintFacts;
use Fisharebest\Webtrees\I18N;
use Fisharebest\Webtrees\Individual;
use Fisharebest\Webtrees\View;
use Illuminate\Support\Collection;

/**
 * @var bool             $can_edit
 * @var Collection<Fact> $clipboard_facts
 * @var Collection<Fact> $facts
 * @var bool             $has_associate_facts
 * @var bool             $has_historic_facts
 * @var bool             $has_relative_facts
 * @var Individual       $individual
 */

?>

<div class="wt-tab-facts py-4">
    <table class="table wt-facts-table">
        <tbody>
            <tr>
                <td colspan="2">
                    <?php if ($has_associate_facts) : ?>
                        <label>
                            <input id="show-associate-facts" type="checkbox" data-toggle="collapse" data-target=".wt-associate-fact">
                            <?= I18N::translate('Associated events') ?>
                        </label>
                    <?php endif ?>

                    <?php if ($has_relative_facts) : ?>
                        <label>
                            <input id="show-relatives-facts" type="checkbox" data-toggle="collapse" data-target=".wt-relation-fact">
                            <?= I18N::translate('Events of close relatives') ?>
                        </label>
                    <?php endif ?>

                    <?php if ($has_historic_facts) : ?>
                        <label>
                            <input id="show-historical-facts" type="checkbox" data-toggle="collapse" data-target=".wt-historic-fact">
                            <?= I18N::translate('Historic events') ?>
                        </label>
                    <?php endif ?>
                </td>
            </tr>

            <?php foreach ($facts as $fact) : ?>
                <?php FunctionsPrintFacts::printFact($fact, $individual) ?>
            <?php endforeach ?>

            <?php if ($facts->isEmpty()) : ?>
                <tr>
                    <td colspan="2">
                        <?= I18N::translate('There are no facts for this individual.') ?>
                    </td>
                </tr>
            <?php endif ?>

            <?php if ($individual->canEdit()) : ?>
                <?php FunctionsPrint::printAddNewFact($individual) ?>
            <?php endif ?>
        </tbody>
    </table>
</div>

<?php View::push('javascript') ?>
<script>
  'use strict';

  webtrees.persistentToggle('show-associate-facts');
  webtrees.persistentToggle('show-relatives-facts');
  webtrees.persistentToggle('show-historical-facts');
</script>
<?php View::endpush() ?>