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