xref: /webtrees/resources/views/modules/notes/tab.phtml (revision 00b1984e374faddab4698e73088f0c964e529b65)
1<?php
2
3use Fisharebest\Webtrees\Functions\FunctionsPrintFacts;
4use Fisharebest\Webtrees\Http\RequestHandlers\AddNewFact;
5use Fisharebest\Webtrees\I18N;
6use Fisharebest\Webtrees\View;
7
8?>
9
10<div class="wt-tan-notes py-4">
11    <table class="table wt-facts-table">
12        <tr>
13            <td colspan="2">
14                <label>
15                    <input id="show-level-2-notes" type="checkbox" data-toggle="collapse" data-target=".wt-level-two-note">
16                    <?= I18N::translate('Show all notes') ?>
17                </label>
18            </td>
19        </tr>
20
21        <?php foreach ($facts as $fact) : ?>
22            <?php FunctionsPrintFacts::printMainNotes($fact, 1) ?>
23            <?php FunctionsPrintFacts::printMainNotes($fact, 2) ?>
24            <?php FunctionsPrintFacts::printMainNotes($fact, 3) ?>
25            <?php FunctionsPrintFacts::printMainNotes($fact, 4) ?>
26        <?php endforeach ?>
27
28        <?php if ($facts->isEmpty()) : ?>
29            <tr>
30                <td colspan="2">
31                    <?= I18N::translate('There are no notes for this individual.') ?>
32                </td>
33            </tr>
34        <?php endif ?>
35
36        <?php if ($can_edit) : ?>
37            <?= view('edit/paste-fact-row', ['record' => $individual, 'facts' => $clipboard_facts]) ?>
38
39            <tr>
40                <th scope="row">
41                    <?= I18N::translate('Note') ?>
42                </th>
43                <td>
44                    <a href="<?= e(route(AddNewFact::class, ['tree' => $individual->tree()->name(), 'xref' => $individual->xref(), 'fact' => 'NOTE'])) ?>">
45                        <?= I18N::translate('Add a note') ?>
46                    </a>
47                </td>
48            </tr>
49            <tr>
50                <th scope="row">
51                    <?= I18N::translate('Shared note') ?>
52                </th>
53                <td>
54                    <a href="<?= e(route(AddNewFact::class, ['tree' => $individual->tree()->name(), 'xref' => $individual->xref(), 'fact' => 'SHARED_NOTE'])) ?>">
55                        <?= I18N::translate('Add a shared 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  persistent_toggle("show-level-2-notes");
68</script>
69<?php View::endpush() ?>
70