xref: /webtrees/resources/views/modules/notes/tab.phtml (revision 53a83c54b8b942be5ba4e73683d0401e77cc44e4)
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            <?= view('edit/paste-fact-row', ['record' => $individual, 'facts' => $clipboard_facts]) ?>
48
49            <tr>
50                <th scope="row">
51                    <?= I18N::translate('Note') ?>
52                </th>
53                <td>
54                    <a href="<?= e(route(AddNewFact::class, ['tree' => $individual->tree()->name(), 'xref' => $individual->xref(), 'fact' => 'NOTE'])) ?>">
55                        <?= I18N::translate('Add a note') ?>
56                    </a>
57                </td>
58            </tr>
59        <?php endif ?>
60    </table>
61</div>
62
63<?php View::push('javascript') ?>
64<script>
65  'use strict';
66
67  webtrees.persistentToggle("show-level-2-notes");
68</script>
69<?php View::endpush() ?>
70