xref: /webtrees/resources/views/modules/notes/tab.phtml (revision 9320815f1ce8e5a76b792d0fc59d7ba088fe3793)
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            <tr>
60                <th scope="row">
61                    <?= I18N::translate('Shared note') ?>
62                </th>
63                <td>
64                    <a href="<?= e(route(AddNewFact::class, ['tree' => $individual->tree()->name(), 'xref' => $individual->xref(), 'fact' => 'SHARED_NOTE'])) ?>">
65                        <?= I18N::translate('Add a shared note') ?>
66                    </a>
67                </td>
68            </tr>
69        <?php endif ?>
70    </table>
71</div>
72
73<?php View::push('javascript') ?>
74<script>
75  'use strict';
76
77  webtrees.persistentToggle("show-level-2-notes");
78</script>
79<?php View::endpush() ?>
80