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