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