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