xref: /webtrees/resources/views/modules/notes/tab.phtml (revision 9deadf1c5b187f630fcc0ae0771860f690e7f202)
1<?php
2
3use Fisharebest\Webtrees\Fact;
4use Fisharebest\Webtrees\Functions\FunctionsPrintFacts;
5use Fisharebest\Webtrees\Http\RequestHandlers\AddNewFact;
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 Individual       $individual
16 */
17
18?>
19
20<div class="wt-tan-notes py-4">
21    <table class="table wt-facts-table">
22        <tr>
23            <td colspan="2">
24                <label>
25                    <input id="show-level-2-notes" type="checkbox" data-toggle="collapse" data-target=".wt-level-two-note">
26                    <?= I18N::translate('Show all notes') ?>
27                </label>
28            </td>
29        </tr>
30
31        <?php foreach ($facts as $fact) : ?>
32            <?php FunctionsPrintFacts::printMainNotes($fact, 1) ?>
33            <?php FunctionsPrintFacts::printMainNotes($fact, 2) ?>
34            <?php FunctionsPrintFacts::printMainNotes($fact, 3) ?>
35            <?php FunctionsPrintFacts::printMainNotes($fact, 4) ?>
36        <?php endforeach ?>
37
38        <?php if ($facts->isEmpty()) : ?>
39            <tr>
40                <td colspan="2">
41                    <?= I18N::translate('There are no notes for this individual.') ?>
42                </td>
43            </tr>
44        <?php endif ?>
45
46        <?php if ($can_edit) : ?>
47            <tr>
48                <th scope="row">
49                    <?= I18N::translate('Note') ?>
50                </th>
51                <td>
52                    <a href="<?= e(route(AddNewFact::class, ['tree' => $individual->tree()->name(), 'xref' => $individual->xref(), 'fact' => 'NOTE'])) ?>">
53                        <?= I18N::translate('Add a note') ?>
54                    </a>
55                </td>
56            </tr>
57        <?php endif ?>
58    </table>
59</div>
60
61<?php View::push('javascript') ?>
62<script>
63  'use strict';
64
65  webtrees.persistentToggle("show-level-2-notes");
66</script>
67<?php View::endpush() ?>
68