xref: /webtrees/resources/views/individual-page-menu.phtml (revision 0ea4a3f27557abd0fc7491da72d684de4d58648b)
15229eadeSGreg Roach<?php
25229eadeSGreg Roach
35229eadeSGreg Roachuse Fisharebest\Webtrees\Auth;
40f5fd22fSGreg Roachuse Fisharebest\Webtrees\Fact;
52917771cSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\AddNewFact;
63b3db8adSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\DeleteRecord;
7a53fee79SGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\EditFactPage;
83b3db8adSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\EditRawRecordPage;
9853f2b8aSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\ReorderFamiliesPage;
105229eadeSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\ReorderMediaPage;
115229eadeSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\ReorderNamesPage;
125229eadeSGreg Roachuse Fisharebest\Webtrees\I18N;
13203146cfSGreg Roachuse Fisharebest\Webtrees\Individual;
14853f2b8aSGreg Roachuse Illuminate\Support\Collection;
155229eadeSGreg Roach
16203146cfSGreg Roach/**
17*0ea4a3f2SGreg Roach * @var bool               $can_upload_media
180f5fd22fSGreg Roach * @var Collection<Fact>   $clipboard_facts
19203146cfSGreg Roach * @var Individual         $record
20853f2b8aSGreg Roach * @var Collection<string> $shares
21203146cfSGreg Roach */
2260f314e9SGreg Roach
235229eadeSGreg Roach?>
24dd6b2bfcSGreg Roach
25dd6b2bfcSGreg Roach<div class="dropdown wt-page-menu">
26315eb316SGreg Roach    <button class="btn btn-primary dropdown-toggle wt-page-menu-button" type="button" id="page-menu" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
277f85bc37SGreg Roach        <?= view('icons/menu') ?>
28dd6b2bfcSGreg Roach        <?= I18N::translate('edit') ?>
29dd6b2bfcSGreg Roach    </button>
3004fe0783SGreg Roach
31315eb316SGreg Roach    <div class="dropdown-menu dropdown-menu-end wt-page-menu-items" aria-labelledby="page-menu">
32853f2b8aSGreg Roach        <?php if ($shares->isNotEmpty()): ?>
33315eb316SGreg Roach            <button class="dropdown-item"  data-bs-toggle="modal" data-bs-target="#wt-shares-modal">
34853f2b8aSGreg Roach                <?= view('icons/share') ?>
35853f2b8aSGreg Roach                <?= I18N::translate('Share') ?>
36853f2b8aSGreg Roach            </button>
37853f2b8aSGreg Roach
38853f2b8aSGreg Roach            <hr>
39853f2b8aSGreg Roach        <?php endif ?>
40853f2b8aSGreg Roach
41efd4768bSGreg Roach        <a class="dropdown-item" href="<?= e(route(AddNewFact::class, ['tree' => $record->tree()->name(), 'xref' => $record->xref(), 'fact' => 'NAME'])) ?>">
4204fe0783SGreg Roach            <?= view('icons/add') ?>
43dd6b2bfcSGreg Roach            <?= I18N::translate('Add a name') ?>
44dd6b2bfcSGreg Roach        </a>
45dd6b2bfcSGreg Roach
46203146cfSGreg Roach        <?php if ($record->facts(['NAME'], false, null, true)->count() > 1) : ?>
47203146cfSGreg Roach            <a class="dropdown-item" href="<?= e(route(ReorderNamesPage::class, ['tree' => $record->tree()->name(), 'xref' => $record->xref()])) ?>">
4804fe0783SGreg Roach                <?= view('icons/reorder') ?>
49dd6b2bfcSGreg Roach                <?= I18N::translate('Re-order names') ?>
50dd6b2bfcSGreg Roach            </a>
518e64ca84SGreg Roach        <?php else : ?>
528e64ca84SGreg Roach            <div class="dropdown-item disabled">
538e64ca84SGreg Roach                <?= view('icons/spacer') ?>
548e64ca84SGreg Roach                <?= I18N::translate('Re-order names') ?>
558e64ca84SGreg Roach            </div>
56dd6b2bfcSGreg Roach        <?php endif ?>
57dd6b2bfcSGreg Roach
5804fe0783SGreg Roach        <div class="dropdown-divider"></div>
5904fe0783SGreg Roach
60203146cfSGreg Roach        <?php if ($record->facts(['SEX'], false, null, true)->isEmpty()) : ?>
61203146cfSGreg Roach            <a class="dropdown-item" href="<?= e(route(AddNewFact::class, ['fact' => 'SEX', 'tree' => $record->tree()->name(), 'xref' => $record->xref()])) ?>">
6204fe0783SGreg Roach                <?= view('icons/edit') ?>
63dd6b2bfcSGreg Roach                <?= I18N::translate('Edit the gender') ?>
64dd6b2bfcSGreg Roach            </a>
658e64ca84SGreg Roach        <?php endif ?>
668e64ca84SGreg Roach
67203146cfSGreg Roach        <?php foreach ($record->facts(['SEX'], false, null, true) as $fact) : ?>
688e64ca84SGreg Roach            <?php if ($fact->canEdit()) : ?>
69203146cfSGreg Roach                <a class="dropdown-item" href="<?= e(route(EditFactPage::class, ['xref' => $record->xref(), 'fact_id' => $fact->id(), 'tree' => $record->tree()->name()])) ?>">
708e64ca84SGreg Roach                    <?= view('icons/edit') ?>
718e64ca84SGreg Roach                    <?= I18N::translate('Edit the gender') ?>
728e64ca84SGreg Roach                </a>
738e64ca84SGreg Roach            <?php endif ?>
748e64ca84SGreg Roach        <?php endforeach ?>
7504fe0783SGreg Roach
7604fe0783SGreg Roach        <div class="dropdown-divider"></div>
778e64ca84SGreg Roach
78203146cfSGreg Roach        <?php if ($record->spouseFamilies()->count() > 1 || $record->childFamilies()->count() > 1) : ?>
79203146cfSGreg Roach            <a class="dropdown-item" href="<?= e(route(ReorderFamiliesPage::class, ['tree' => $record->tree()->name(), 'xref' => $record->xref()])) ?>">
8083615acfSGreg Roach                <?= view('icons/reorder') ?>
8183615acfSGreg Roach                <?= I18N::translate('Re-order families') ?>
8283615acfSGreg Roach            </a>
8383615acfSGreg Roach        <?php else : ?>
8483615acfSGreg Roach            <div class="dropdown-item disabled">
8583615acfSGreg Roach                <?= view('icons/spacer') ?>
8683615acfSGreg Roach                <?= I18N::translate('Re-order families') ?>
8783615acfSGreg Roach            </div>
8883615acfSGreg Roach        <?php endif ?>
8983615acfSGreg Roach
9083615acfSGreg Roach        <div class="dropdown-divider"></div>
9183615acfSGreg Roach
92*0ea4a3f2SGreg Roach        <?php if ($can_upload_media) : ?>
93203146cfSGreg Roach            <a class="dropdown-item" href="<?= e(route(AddNewFact::class, ['tree' => $record->tree()->name(), 'xref' => $record->xref(), 'fact' => 'OBJE'])) ?>">
948e64ca84SGreg Roach                <?= view('icons/add') ?>
958e64ca84SGreg Roach                <?= I18N::translate('Add a media object') ?>
968e64ca84SGreg Roach            </a>
97*0ea4a3f2SGreg Roach        <?php endif ?>
988e64ca84SGreg Roach
99203146cfSGreg Roach        <?php if ($record->facts(['OBJE'], false, null, true)->count() > 1) : ?>
100203146cfSGreg Roach            <a class="dropdown-item" href="<?= e(route(ReorderMediaPage::class, ['tree' => $record->tree()->name(), 'xref' => $record->xref()])) ?>">
101a6c1d617SGreg Roach                <?= view('icons/reorder') ?>
1028e64ca84SGreg Roach                <?= I18N::translate('Re-order media') ?>
1038e64ca84SGreg Roach            </a>
1048e64ca84SGreg Roach        <?php else : ?>
1058e64ca84SGreg Roach            <div class="dropdown-item disabled">
1068e64ca84SGreg Roach                <?= view('icons/spacer') ?>
1078e64ca84SGreg Roach                <?= I18N::translate('Re-order media') ?>
1088e64ca84SGreg Roach            </div>
109dd6b2bfcSGreg Roach        <?php endif ?>
110dd6b2bfcSGreg Roach
1110f5fd22fSGreg Roach        <?php if ($clipboard_facts->isNotEmpty()) : ?>
1120f5fd22fSGreg Roach            <div class="dropdown-divider"></div>
1130f5fd22fSGreg Roach
1140f5fd22fSGreg Roach            <?= view('record-page-menu-clipboard', ['clipboard_facts' => $clipboard_facts, 'record' => $record]) ?>
1150f5fd22fSGreg Roach        <?php endif ?>
1160f5fd22fSGreg Roach
1178e64ca84SGreg Roach        <div class="dropdown-divider"></div>
1188e64ca84SGreg Roach
119d4786c66SGreg Roach        <a class="dropdown-item" href="#" data-wt-confirm="<?= I18N::translate('Are you sure you want to delete “%s”?', strip_tags($record->fullName())) ?>" data-wt-post-url="<?= e(route(DeleteRecord::class, ['tree' => $record->tree()->name(), 'xref' => $record->xref()])) ?>">
12004fe0783SGreg Roach            <?= view('icons/delete') ?>
121dd6b2bfcSGreg Roach            <?= I18N::translate('Delete') ?>
122dd6b2bfcSGreg Roach        </a>
123dd6b2bfcSGreg Roach
124203146cfSGreg Roach        <?php if (Auth::isAdmin() || $record->tree()->getPreference('SHOW_GEDCOM_RECORD')) : ?>
125203146cfSGreg Roach            <a class="dropdown-item" href="<?= e(route(EditRawRecordPage::class, ['tree' => $record->tree()->name(), 'xref' => $record->xref()])) ?>">
12604fe0783SGreg Roach                <?= view('icons/edit') ?>
127dd6b2bfcSGreg Roach                <?= I18N::translate('Edit the raw GEDCOM') ?>
128dd6b2bfcSGreg Roach            </a>
129dd6b2bfcSGreg Roach        <?php endif ?>
130dd6b2bfcSGreg Roach    </div>
131dd6b2bfcSGreg Roach</div>
132