xref: /webtrees/resources/views/note-page.phtml (revision 39ca88ba08cefcfcaf891abfcf748f9c808eb326)
1<?php use Fisharebest\Webtrees\Auth; ?>
2<?php use Fisharebest\Webtrees\Functions\FunctionsPrint; ?>
3<?php use Fisharebest\Webtrees\Functions\FunctionsPrintFacts; ?>
4<?php use Fisharebest\Webtrees\I18N; ?>
5
6<?php if ($note->isPendingDeletion()) : ?>
7    <?php if (Auth::isModerator($note->tree())) : ?>
8        <?= view('components/alert-warning-dismissible', ['alert' => /* I18N: %1$s is “accept”, %2$s is “reject”. These are links. */ I18N::translate('This note has been deleted. You should review the deletion and then %1$s or %2$s it.', '<a href="#" class="alert-link" onclick="accept_changes(\'' . e($note->xref()) . '\', \'' . e($note->tree()->name()) . '\');">' . I18N::translateContext('You should review the deletion and then accept or reject it.', 'accept') . '</a>', '<a href="#" class="alert-link" onclick="reject_changes(\'' . e($note->xref()) . '\', \'' . e($note->tree()->name()) . '\');">' . I18N::translateContext('You should review the deletion and then accept or reject it.', 'reject') . '</a>') . ' ' . FunctionsPrint::helpLink('pending_changes')]) ?>
9    <?php elseif (Auth::isEditor($note->tree())) : ?>
10        <?= view('components/alert-warning-dismissible', ['alert' => I18N::translate('This note has been deleted. The deletion will need to be reviewed by a moderator.') . ' ' . FunctionsPrint::helpLink('pending_changes')]) ?>
11    <?php endif ?>
12<?php elseif ($note->isPendingAddition()) : ?>
13    <?php if (Auth::isModerator($note->tree())) : ?>
14        <?= view('components/alert-warning-dismissible', ['alert' => /* I18N: %1$s is “accept”, %2$s is “reject”. These are links. */ I18N::translate('This note has been edited. You should review the changes and then %1$s or %2$s them.', '<a href="#" class="alert-link" onclick="accept_changes(\'' . e($note->xref()) . '\', \'' . e($note->tree()->name()) . '\');">' . I18N::translateContext('You should review the changes and then accept or reject them.', 'accept') . '</a>', '<a href="#" class="alert-link" onclick="reject_changes(\'' . e($note->xref()) . '\', \'' . e($note->tree()->name()) . '\');">' . I18N::translateContext('You should review the changes and then accept or reject them.', 'reject') . '</a>') . ' ' . FunctionsPrint::helpLink('pending_changes')]) ?>
15    <?php elseif (Auth::isEditor($note->tree())) : ?>
16        <?= view('components/alert-warning-dismissible', ['alert' => I18N::translate('This note has been edited. The changes need to be reviewed by a moderator.') . ' ' . FunctionsPrint::helpLink('pending_changes')]) ?>
17    <?php endif ?>
18<?php endif ?>
19
20<div class="d-flex mb-4">
21    <h2 class="wt-page-title mx-auto">
22        <?= $note->fullName() ?>
23    </h2>
24    <?php if ($note->canEdit() && !$note->isPendingDeletion()) : ?>
25        <?= view('note-page-menu', ['record' => $note]) ?>
26    <?php endif ?>
27</div>
28
29<div class="wt-page-content">
30    <ul class="nav nav-tabs" role="tablist">
31        <li class="nav-item">
32            <a class="nav-link active" data-toggle="tab" role="tab" href="#details">
33                <?= I18N::translate('Details') ?>
34            </a>
35        </li>
36        <li class="nav-item">
37            <a class="nav-link<?= empty($individuals) ? ' text-muted' : '' ?>" data-toggle="tab" role="tab" href="#individuals">
38                <?= I18N::translate('Individuals') ?>
39                <?= view('components/badge', ['count' => count($individuals)]) ?>
40            </a>
41        </li>
42        <li class="nav-item">
43            <a class="nav-link<?= empty($families) ? ' text-muted' : '' ?>" data-toggle="tab" role="tab" href="#families">
44                <?= I18N::translate('Families') ?>
45                <?= view('components/badge', ['count' => count($families)]) ?>
46            </a>
47        </li>
48        <li class="nav-item">
49            <a class="nav-link<?= empty($media_objects) ? ' text-muted' : '' ?>" data-toggle="tab" role="tab" href="#media">
50                <?= I18N::translate('Media objects') ?>
51                <?= view('components/badge', ['count' => count($media_objects)]) ?>
52            </a>
53        </li>
54        <li class="nav-item">
55            <a class="nav-link<?= empty($sources) ? ' text-muted' : '' ?>" data-toggle="tab" role="tab" href="#sources">
56                <?= I18N::translate('Sources') ?>
57                <?= view('components/badge', ['count' => count($sources)]) ?>
58            </a>
59        </li>
60        <li class="nav-item">
61            <a class="nav-link<?= empty($notes) ? ' text-muted' : '' ?>" data-toggle="tab" role="tab" href="#notes">
62                <?= I18N::translate('Notes') ?>
63                <?= view('components/badge', ['count' => count($notes)]) ?>
64            </a>
65        </li>
66    </ul>
67
68    <div class="tab-content">
69        <div class="tab-pane active fade show" role="tabpanel" id="details">
70            <table class="table wt-facts-table">
71                <tr>
72                    <th scope="row">
73                        <?= I18N::translate('Shared note') ?>
74                        <?php if (Auth::isEditor($note->tree())) : ?>
75                            <div class="editfacts">
76                                <a class="btn btn-link" href="<?= e(route('edit-note-object', ['xref' => $note->xref(), 'ged' => $note->tree()->name()])) ?>" title="<?= I18N::translate('Edit') ?>">
77                                    <?= view('icons/edit') ?>
78                                    <span class="sr-only">
79                                        <?= I18N::translate('Edit') ?>
80                                    </span>
81                                </a>
82                            </div>
83                        <?php endif ?>
84                    </th>
85                    <td><?= $text ?></td>
86                </tr>
87                <?php foreach ($facts as $fact) : ?>
88                    <?php FunctionsPrintFacts::printFact($fact, $note) ?>
89                <?php endforeach ?>
90
91                <?php if ($note->canEdit()) : ?>
92                    <?= view('edit/paste-fact-row', ['record' => $note, 'facts' => $clipboard_facts]) ?>
93
94                    <?php FunctionsPrint::printAddNewFact($note, $facts, 'NOTE') ?>
95                <?php endif ?>
96            </table>
97        </div>
98
99        <div class="tab-pane fade" role="tabpanel" id="individuals">
100            <?= view('lists/individuals-table', ['individuals' => $individuals, 'sosa' => false, 'tree' => $tree]) ?>
101        </div>
102
103        <div class="tab-pane fade" role="tabpanel" id="families">
104            <?= view('lists/families-table', ['families' => $families, 'tree' => $tree]) ?>
105        </div>
106
107        <div class="tab-pane fade" role="tabpanel" id="media">
108            <?= view('lists/media-table', ['media_objects' => $media_objects, 'tree' => $tree]) ?>
109        </div>
110
111        <div class="tab-pane fade" role="tabpanel" id="sources">
112            <?= view('lists/sources-table', ['sources' => $sources, 'tree' => $tree]) ?>
113        </div>
114
115        <div class="tab-pane fade" role="tabpanel" id="notes">
116            <?= view('lists/notes-table', ['notes' => $notes, 'tree' => $tree]) ?>
117        </div>
118    </div>
119</div>
120
121<?= view('modals/ajax') ?>
122