xref: /webtrees/resources/views/individual-page-menu.phtml (revision 10e0649788c8d7d4974d81c048ca2b225df8f22e)
15229eadeSGreg Roach<?php
25229eadeSGreg Roach
3*10e06497SGreg Roachdeclare(strict_types=1);
4*10e06497SGreg Roach
55229eadeSGreg Roachuse Fisharebest\Webtrees\Auth;
60f5fd22fSGreg Roachuse Fisharebest\Webtrees\Fact;
72917771cSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\AddNewFact;
83b3db8adSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\DeleteRecord;
9a53fee79SGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\EditFactPage;
103b3db8adSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\EditRawRecordPage;
11853f2b8aSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\ReorderFamiliesPage;
125229eadeSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\ReorderMediaPage;
135229eadeSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\ReorderNamesPage;
145229eadeSGreg Roachuse Fisharebest\Webtrees\I18N;
15203146cfSGreg Roachuse Fisharebest\Webtrees\Individual;
16853f2b8aSGreg Roachuse Illuminate\Support\Collection;
175229eadeSGreg Roach
18203146cfSGreg Roach/**
190ea4a3f2SGreg Roach * @var bool                   $can_upload_media
2036779af1SGreg Roach * @var Collection<int,Fact>   $clipboard_facts
21203146cfSGreg Roach * @var Individual             $record
2236779af1SGreg Roach * @var Collection<int,string> $shares
23203146cfSGreg Roach */
2460f314e9SGreg Roach
255229eadeSGreg Roach?>
26dd6b2bfcSGreg Roach
27dd6b2bfcSGreg Roach<div class="dropdown wt-page-menu">
28315eb316SGreg 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">
297f85bc37SGreg Roach        <?= view('icons/menu') ?>
30dd6b2bfcSGreg Roach        <?= I18N::translate('edit') ?>
31dd6b2bfcSGreg Roach    </button>
3204fe0783SGreg Roach
33315eb316SGreg Roach    <div class="dropdown-menu dropdown-menu-end wt-page-menu-items" aria-labelledby="page-menu">
34853f2b8aSGreg Roach        <?php if ($shares->isNotEmpty()) : ?>
35315eb316SGreg Roach            <button class="dropdown-item"  data-bs-toggle="modal" data-bs-target="#wt-shares-modal">
36853f2b8aSGreg Roach                <?= view('icons/share') ?>
37853f2b8aSGreg Roach                <?= I18N::translate('Share') ?>
38853f2b8aSGreg Roach            </button>
39853f2b8aSGreg Roach
40853f2b8aSGreg Roach            <hr>
41853f2b8aSGreg Roach        <?php endif ?>
42853f2b8aSGreg Roach
43efd4768bSGreg Roach        <a class="dropdown-item" href="<?= e(route(AddNewFact::class, ['tree' => $record->tree()->name(), 'xref' => $record->xref(), 'fact' => 'NAME'])) ?>">
4404fe0783SGreg Roach            <?= view('icons/add') ?>
45dd6b2bfcSGreg Roach            <?= I18N::translate('Add a name') ?>
46dd6b2bfcSGreg Roach        </a>
47dd6b2bfcSGreg Roach
48203146cfSGreg Roach        <?php if ($record->facts(['NAME'], false, null, true)->count() > 1) : ?>
49203146cfSGreg Roach            <a class="dropdown-item" href="<?= e(route(ReorderNamesPage::class, ['tree' => $record->tree()->name(), 'xref' => $record->xref()])) ?>">
5004fe0783SGreg Roach                <?= view('icons/reorder') ?>
51dd6b2bfcSGreg Roach                <?= I18N::translate('Re-order names') ?>
52dd6b2bfcSGreg Roach            </a>
538e64ca84SGreg Roach        <?php else : ?>
548e64ca84SGreg Roach            <div class="dropdown-item disabled">
558e64ca84SGreg Roach                <?= view('icons/spacer') ?>
568e64ca84SGreg Roach                <?= I18N::translate('Re-order names') ?>
578e64ca84SGreg Roach            </div>
58dd6b2bfcSGreg Roach        <?php endif ?>
59dd6b2bfcSGreg Roach
6004fe0783SGreg Roach        <div class="dropdown-divider"></div>
6104fe0783SGreg Roach
62203146cfSGreg Roach        <?php if ($record->facts(['SEX'], false, null, true)->isEmpty()) : ?>
63203146cfSGreg Roach            <a class="dropdown-item" href="<?= e(route(AddNewFact::class, ['fact' => 'SEX', 'tree' => $record->tree()->name(), 'xref' => $record->xref()])) ?>">
6404fe0783SGreg Roach                <?= view('icons/edit') ?>
65dd6b2bfcSGreg Roach                <?= I18N::translate('Edit the gender') ?>
66dd6b2bfcSGreg Roach            </a>
678e64ca84SGreg Roach        <?php endif ?>
688e64ca84SGreg Roach
69203146cfSGreg Roach        <?php foreach ($record->facts(['SEX'], false, null, true) as $fact) : ?>
708e64ca84SGreg Roach            <?php if ($fact->canEdit()) : ?>
71203146cfSGreg Roach                <a class="dropdown-item" href="<?= e(route(EditFactPage::class, ['xref' => $record->xref(), 'fact_id' => $fact->id(), 'tree' => $record->tree()->name()])) ?>">
728e64ca84SGreg Roach                    <?= view('icons/edit') ?>
738e64ca84SGreg Roach                    <?= I18N::translate('Edit the gender') ?>
748e64ca84SGreg Roach                </a>
758e64ca84SGreg Roach            <?php endif ?>
768e64ca84SGreg Roach        <?php endforeach ?>
7704fe0783SGreg Roach
7804fe0783SGreg Roach        <div class="dropdown-divider"></div>
798e64ca84SGreg Roach
80203146cfSGreg Roach        <?php if ($record->spouseFamilies()->count() > 1 || $record->childFamilies()->count() > 1) : ?>
81203146cfSGreg Roach            <a class="dropdown-item" href="<?= e(route(ReorderFamiliesPage::class, ['tree' => $record->tree()->name(), 'xref' => $record->xref()])) ?>">
8283615acfSGreg Roach                <?= view('icons/reorder') ?>
8383615acfSGreg Roach                <?= I18N::translate('Re-order families') ?>
8483615acfSGreg Roach            </a>
8583615acfSGreg Roach        <?php else : ?>
8683615acfSGreg Roach            <div class="dropdown-item disabled">
8783615acfSGreg Roach                <?= view('icons/spacer') ?>
8883615acfSGreg Roach                <?= I18N::translate('Re-order families') ?>
8983615acfSGreg Roach            </div>
9083615acfSGreg Roach        <?php endif ?>
9183615acfSGreg Roach
9283615acfSGreg Roach        <div class="dropdown-divider"></div>
9383615acfSGreg Roach
940ea4a3f2SGreg Roach        <?php if ($can_upload_media) : ?>
95203146cfSGreg Roach            <a class="dropdown-item" href="<?= e(route(AddNewFact::class, ['tree' => $record->tree()->name(), 'xref' => $record->xref(), 'fact' => 'OBJE'])) ?>">
968e64ca84SGreg Roach                <?= view('icons/add') ?>
978e64ca84SGreg Roach                <?= I18N::translate('Add a media object') ?>
988e64ca84SGreg Roach            </a>
990ea4a3f2SGreg Roach        <?php endif ?>
1008e64ca84SGreg Roach
101203146cfSGreg Roach        <?php if ($record->facts(['OBJE'], false, null, true)->count() > 1) : ?>
102203146cfSGreg Roach            <a class="dropdown-item" href="<?= e(route(ReorderMediaPage::class, ['tree' => $record->tree()->name(), 'xref' => $record->xref()])) ?>">
103a6c1d617SGreg Roach                <?= view('icons/reorder') ?>
1048e64ca84SGreg Roach                <?= I18N::translate('Re-order media') ?>
1058e64ca84SGreg Roach            </a>
1068e64ca84SGreg Roach        <?php else : ?>
1078e64ca84SGreg Roach            <div class="dropdown-item disabled">
1088e64ca84SGreg Roach                <?= view('icons/spacer') ?>
1098e64ca84SGreg Roach                <?= I18N::translate('Re-order media') ?>
1108e64ca84SGreg Roach            </div>
111dd6b2bfcSGreg Roach        <?php endif ?>
112dd6b2bfcSGreg Roach
1130f5fd22fSGreg Roach        <?php if ($clipboard_facts->isNotEmpty()) : ?>
1140f5fd22fSGreg Roach            <div class="dropdown-divider"></div>
1150f5fd22fSGreg Roach
1160f5fd22fSGreg Roach            <?= view('record-page-menu-clipboard', ['clipboard_facts' => $clipboard_facts, 'record' => $record]) ?>
1170f5fd22fSGreg Roach        <?php endif ?>
1180f5fd22fSGreg Roach
1198e64ca84SGreg Roach        <div class="dropdown-divider"></div>
1208e64ca84SGreg Roach
121d4786c66SGreg 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()])) ?>">
12204fe0783SGreg Roach            <?= view('icons/delete') ?>
123dd6b2bfcSGreg Roach            <?= I18N::translate('Delete') ?>
124dd6b2bfcSGreg Roach        </a>
125dd6b2bfcSGreg Roach
126bd29d468SGreg Roach        <?php if (Auth::isAdmin() || $record->tree()->getPreference('SHOW_GEDCOM_RECORD') === '1') : ?>
127203146cfSGreg Roach            <a class="dropdown-item" href="<?= e(route(EditRawRecordPage::class, ['tree' => $record->tree()->name(), 'xref' => $record->xref()])) ?>">
12804fe0783SGreg Roach                <?= view('icons/edit') ?>
129dd6b2bfcSGreg Roach                <?= I18N::translate('Edit the raw GEDCOM') ?>
130dd6b2bfcSGreg Roach            </a>
131dd6b2bfcSGreg Roach        <?php endif ?>
132dd6b2bfcSGreg Roach    </div>
133dd6b2bfcSGreg Roach</div>
134