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