xref: /webtrees/resources/views/note-page.phtml (revision 12a0693f1b6760e019806135ae71270602315868)
1<?php
2
3use Fisharebest\Webtrees\Auth;
4
5?>
6<?php use Fisharebest\Webtrees\Functions\FunctionsPrint; ?>
7<?php use Fisharebest\Webtrees\Functions\FunctionsPrintFacts; ?>
8<?php use Fisharebest\Webtrees\Http\RequestHandlers\PendingChangesAcceptRecord;
9use Fisharebest\Webtrees\Http\RequestHandlers\PendingChangesRejectRecord;
10use Fisharebest\Webtrees\I18N; ?>
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>') . ' ' . FunctionsPrint::helpLink('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.') . ' ' . FunctionsPrint::helpLink('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>') . ' ' . FunctionsPrint::helpLink('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.') . ' ' . FunctionsPrint::helpLink('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">
38            <a class="nav-link active" data-toggle="tab" role="tab" href="#details">
39                <?= I18N::translate('Details') ?>
40            </a>
41        </li>
42        <li class="nav-item">
43            <a class="nav-link<?= $individuals->isEmpty() ? ' text-muted' : '' ?>" data-toggle="tab" role="tab" href="#individuals">
44                <?= I18N::translate('Individuals') ?>
45                <?= view('components/badge', ['count' => count($individuals)]) ?>
46            </a>
47        </li>
48        <li class="nav-item">
49            <a class="nav-link<?= $families->isEmpty() ? ' text-muted' : '' ?>" data-toggle="tab" role="tab" href="#families">
50                <?= I18N::translate('Families') ?>
51                <?= view('components/badge', ['count' => count($families)]) ?>
52            </a>
53        </li>
54        <li class="nav-item">
55            <a class="nav-link<?= $media_objects->isEmpty() ? ' text-muted' : '' ?>" data-toggle="tab" role="tab" href="#media">
56                <?= I18N::translate('Media objects') ?>
57                <?= view('components/badge', ['count' => count($media_objects)]) ?>
58            </a>
59        </li>
60        <li class="nav-item">
61            <a class="nav-link<?= $sources->isEmpty() ? ' text-muted' : '' ?>" data-toggle="tab" role="tab" href="#sources">
62                <?= I18N::translate('Sources') ?>
63                <?= view('components/badge', ['count' => count($sources)]) ?>
64            </a>
65        </li>
66        <li class="nav-item">
67            <a class="nav-link<?= $notes->isEmpty() ? ' text-muted' : '' ?>" data-toggle="tab" role="tab" href="#notes">
68                <?= I18N::translate('Notes') ?>
69                <?= view('components/badge', ['count' => count($notes)]) ?>
70            </a>
71        </li>
72    </ul>
73
74    <div class="tab-content">
75        <div class="tab-pane active fade show" role="tabpanel" id="details">
76            <table class="table wt-facts-table">
77                <tr>
78                    <th scope="row">
79                        <?= I18N::translate('Shared note') ?>
80                        <?php if (Auth::isEditor($note->tree())) : ?>
81                            <div class="editfacts nowrap">
82                                <a class="btn btn-link" href="<?= e(route('edit-note-object', ['xref' => $note->xref(), 'tree' => $note->tree()->name()])) ?>" title="<?= I18N::translate('Edit') ?>">
83                                    <?= view('icons/edit') ?>
84                                    <span class="sr-only">
85                                        <?= I18N::translate('Edit') ?>
86                                    </span>
87                                </a>
88                            </div>
89                        <?php endif ?>
90                    </th>
91                    <td><?= $text ?></td>
92                </tr>
93                <?php foreach ($facts as $fact) : ?>
94                    <?php FunctionsPrintFacts::printFact($fact, $note) ?>
95                <?php endforeach ?>
96
97                <?php if ($note->canEdit()) : ?>
98                    <?= view('edit/paste-fact-row', ['record' => $note, 'facts' => $clipboard_facts]) ?>
99
100                    <?php FunctionsPrint::printAddNewFact($note, $facts, 'NOTE') ?>
101                <?php endif ?>
102            </table>
103        </div>
104
105        <div class="tab-pane fade" role="tabpanel" id="individuals">
106            <?= view('lists/individuals-table', ['individuals' => $individuals, 'sosa' => false, 'tree' => $tree]) ?>
107        </div>
108
109        <div class="tab-pane fade" role="tabpanel" id="families">
110            <?= view('lists/families-table', ['families' => $families, 'tree' => $tree]) ?>
111        </div>
112
113        <div class="tab-pane fade" role="tabpanel" id="media">
114            <?= view('lists/media-table', ['media_objects' => $media_objects, 'tree' => $tree]) ?>
115        </div>
116
117        <div class="tab-pane fade" role="tabpanel" id="sources">
118            <?= view('lists/sources-table', ['sources' => $sources, 'tree' => $tree]) ?>
119        </div>
120
121        <div class="tab-pane fade" role="tabpanel" id="notes">
122            <?= view('lists/notes-table', ['notes' => $notes, 'tree' => $tree]) ?>
123        </div>
124    </div>
125</div>
126
127<?= view('modals/ajax') ?>
128