xref: /webtrees/resources/views/modules/notes/tab.phtml (revision cd1ec0d0efaac433e873afc688050c81d1b4ad02)
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 Illuminate\Support\Collection;
9
10/**
11 * @var bool             $can_edit
12 * @var Collection<Fact> $clipboard_facts
13 * @var Collection<Fact> $facts
14 * @var Individual       $individual
15 */
16
17?>
18
19<div class="wt-tan-notes py-4">
20    <table class="table wt-facts-table">
21        <tr>
22            <td colspan="2">
23                <label>
24                    <input id="show-level-2-notes" type="checkbox" data-bs-toggle="collapse" data-bs-target=".wt-level-two-note" data-wt-persist="level-two-notes">
25                    <?= I18N::translate('Show all notes') ?>
26                </label>
27            </td>
28        </tr>
29
30        <?php foreach ($facts as $fact) : ?>
31            <?php FunctionsPrintFacts::printMainNotes($fact, 1) ?>
32            <?php FunctionsPrintFacts::printMainNotes($fact, 2) ?>
33            <?php FunctionsPrintFacts::printMainNotes($fact, 3) ?>
34            <?php FunctionsPrintFacts::printMainNotes($fact, 4) ?>
35        <?php endforeach ?>
36
37        <?php if ($facts->isEmpty()) : ?>
38            <tr>
39                <td colspan="2">
40                    <?= I18N::translate('There are no notes for this individual.') ?>
41                </td>
42            </tr>
43        <?php endif ?>
44
45        <?php if ($can_edit) : ?>
46            <tr>
47                <th scope="row">
48                    <?= I18N::translate('Note') ?>
49                </th>
50                <td>
51                    <a href="<?= e(route(AddNewFact::class, ['tree' => $individual->tree()->name(), 'xref' => $individual->xref(), 'fact' => 'NOTE'])) ?>">
52                        <?= I18N::translate('Add a note') ?>
53                    </a>
54                </td>
55            </tr>
56        <?php endif ?>
57    </table>
58</div>
59