xref: /webtrees/resources/views/note-page.phtml (revision f4afa648fcb1eff2558e414d35a921dbfbf02078)
1<?php use Fisharebest\Webtrees\Auth; ?>
2<?php use Fisharebest\Webtrees\Bootstrap4; ?>
3<?php use Fisharebest\Webtrees\FontAwesome; ?>
4<?php use Fisharebest\Webtrees\Functions\FunctionsPrint; ?>
5<?php use Fisharebest\Webtrees\Functions\FunctionsPrintFacts; ?>
6<?php use 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" 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')]) ?>
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" 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')]) ?>
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->getFullName() ?>
25    </h2>
26    <?php if ($note->canEdit() && !$note->isPendingDeletion()) : ?>
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<?= empty($individuals) ? ' text-muted' : '' ?>" data-toggle="tab" role="tab" href="#individuals">
40                <?= I18N::translate('Individuals') ?>
41                <?= Bootstrap4::badgeCount($individuals) ?>
42            </a>
43        </li>
44        <li class="nav-item">
45            <a class="nav-link<?= empty($families) ? ' text-muted' : '' ?>" data-toggle="tab" role="tab" href="#families">
46                <?= I18N::translate('Families') ?>
47                <?= Bootstrap4::badgeCount($families) ?>
48            </a>
49        </li>
50        <li class="nav-item">
51            <a class="nav-link<?= empty($media_objects) ? ' text-muted' : '' ?>" data-toggle="tab" role="tab" href="#media">
52                <?= I18N::translate('Media objects') ?>
53                <?= Bootstrap4::badgeCount($media_objects) ?>
54            </a>
55        </li>
56        <li class="nav-item">
57            <a class="nav-link<?= empty($sources) ? ' text-muted' : '' ?>" data-toggle="tab" role="tab" href="#sources">
58                <?= I18N::translate('Sources') ?>
59                <?= Bootstrap4::badgeCount($sources) ?>
60            </a>
61        </li>
62        <li class="nav-item">
63            <a class="nav-link<?= empty($notes) ? ' text-muted' : '' ?>" data-toggle="tab" role="tab" href="#notes">
64                <?= I18N::translate('Notes') ?>
65                <?= Bootstrap4::badgeCount($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">
78                                <?= FontAwesome::linkIcon('edit', I18N::translate('Edit'), ['class' => 'btn btn-link', 'href' => route('edit-note-object', ['xref' => $note->xref(), 'ged' => $note->tree()->name()])]) ?>
79                            </div>
80                        <?php endif ?>
81                    </th>
82                    <td><?= $text ?></td>
83                </tr>
84                <?php foreach ($facts as $fact) : ?>
85                    <?php FunctionsPrintFacts::printFact($fact, $note) ?>
86                <?php endforeach ?>
87
88                <?php if ($note->canEdit()) : ?>
89                    <?php FunctionsPrint::printAddNewFact($note, $facts, 'NOTE') ?>
90                <?php endif ?>
91            </table>
92        </div>
93
94        <div class="tab-pane fade" role="tabpanel" id="individuals">
95            <?= view('lists/individuals-table', ['individuals' => $individuals, 'sosa' => false, 'tree' => $tree]) ?>
96        </div>
97
98        <div class="tab-pane fade" role="tabpanel" id="families">
99            <?= view('lists/families-table', ['families' => $families, 'tree' => $tree]) ?>
100        </div>
101
102        <div class="tab-pane fade" role="tabpanel" id="media">
103            <?= view('lists/media-table', ['media_objects' => $media_objects, 'tree' => $tree]) ?>
104        </div>
105
106        <div class="tab-pane fade" role="tabpanel" id="sources">
107            <?= view('lists/sources-table', ['sources' => $sources, 'tree' => $tree]) ?>
108        </div>
109
110        <div class="tab-pane fade" role="tabpanel" id="notes">
111            <?= view('lists/notes-table', ['notes' => $notes, 'tree' => $tree]) ?>
112        </div>
113    </div>
114</div>
115
116<?= view('modals/ajax') ?>
117