xref: /webtrees/resources/views/individual-page-menu.phtml (revision 315eb31683006273e24c08b447e6e1095d6f2147)
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/**
170f5fd22fSGreg Roach * @var Collection<Fact>   $clipboard_facts
18203146cfSGreg Roach * @var Individual         $record
19853f2b8aSGreg Roach * @var Collection<string> $shares
20203146cfSGreg Roach */
2160f314e9SGreg Roach
225229eadeSGreg Roach?>
23dd6b2bfcSGreg Roach
24dd6b2bfcSGreg Roach<div class="dropdown wt-page-menu">
25*315eb316SGreg 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">
267f85bc37SGreg Roach        <?= view('icons/menu') ?>
27dd6b2bfcSGreg Roach        <?= I18N::translate('edit') ?>
28dd6b2bfcSGreg Roach    </button>
2904fe0783SGreg Roach
30*315eb316SGreg Roach    <div class="dropdown-menu dropdown-menu-end wt-page-menu-items" aria-labelledby="page-menu">
31853f2b8aSGreg Roach        <?php if ($shares->isNotEmpty()): ?>
32*315eb316SGreg Roach            <button class="dropdown-item"  data-bs-toggle="modal" data-bs-target="#wt-shares-modal">
33853f2b8aSGreg Roach                <?= view('icons/share') ?>
34853f2b8aSGreg Roach                <?= I18N::translate('Share') ?>
35853f2b8aSGreg Roach            </button>
36853f2b8aSGreg Roach
37853f2b8aSGreg Roach            <hr>
38853f2b8aSGreg Roach        <?php endif ?>
39853f2b8aSGreg Roach
40efd4768bSGreg Roach        <a class="dropdown-item" href="<?= e(route(AddNewFact::class, ['tree' => $record->tree()->name(), 'xref' => $record->xref(), 'fact' => 'NAME'])) ?>">
4104fe0783SGreg Roach            <?= view('icons/add') ?>
42dd6b2bfcSGreg Roach            <?= I18N::translate('Add a name') ?>
43dd6b2bfcSGreg Roach        </a>
44dd6b2bfcSGreg Roach
45203146cfSGreg Roach        <?php if ($record->facts(['NAME'], false, null, true)->count() > 1) : ?>
46203146cfSGreg Roach            <a class="dropdown-item" href="<?= e(route(ReorderNamesPage::class, ['tree' => $record->tree()->name(), 'xref' => $record->xref()])) ?>">
4704fe0783SGreg Roach                <?= view('icons/reorder') ?>
48dd6b2bfcSGreg Roach                <?= I18N::translate('Re-order names') ?>
49dd6b2bfcSGreg Roach            </a>
508e64ca84SGreg Roach        <?php else : ?>
518e64ca84SGreg Roach            <div class="dropdown-item disabled">
528e64ca84SGreg Roach                <?= view('icons/spacer') ?>
538e64ca84SGreg Roach                <?= I18N::translate('Re-order names') ?>
548e64ca84SGreg Roach            </div>
55dd6b2bfcSGreg Roach        <?php endif ?>
56dd6b2bfcSGreg Roach
5704fe0783SGreg Roach        <div class="dropdown-divider"></div>
5804fe0783SGreg Roach
59203146cfSGreg Roach        <?php if ($record->facts(['SEX'], false, null, true)->isEmpty()) : ?>
60203146cfSGreg Roach            <a class="dropdown-item" href="<?= e(route(AddNewFact::class, ['fact' => 'SEX', 'tree' => $record->tree()->name(), 'xref' => $record->xref()])) ?>">
6104fe0783SGreg Roach                <?= view('icons/edit') ?>
62dd6b2bfcSGreg Roach                <?= I18N::translate('Edit the gender') ?>
63dd6b2bfcSGreg Roach            </a>
648e64ca84SGreg Roach        <?php endif ?>
658e64ca84SGreg Roach
66203146cfSGreg Roach        <?php foreach ($record->facts(['SEX'], false, null, true) as $fact) : ?>
678e64ca84SGreg Roach            <?php if ($fact->canEdit()) : ?>
68203146cfSGreg Roach                <a class="dropdown-item" href="<?= e(route(EditFactPage::class, ['xref' => $record->xref(), 'fact_id' => $fact->id(), 'tree' => $record->tree()->name()])) ?>">
698e64ca84SGreg Roach                    <?= view('icons/edit') ?>
708e64ca84SGreg Roach                    <?= I18N::translate('Edit the gender') ?>
718e64ca84SGreg Roach                </a>
728e64ca84SGreg Roach            <?php endif ?>
738e64ca84SGreg Roach        <?php endforeach ?>
7404fe0783SGreg Roach
7504fe0783SGreg Roach        <div class="dropdown-divider"></div>
768e64ca84SGreg Roach
77203146cfSGreg Roach        <?php if ($record->spouseFamilies()->count() > 1 || $record->childFamilies()->count() > 1) : ?>
78203146cfSGreg Roach            <a class="dropdown-item" href="<?= e(route(ReorderFamiliesPage::class, ['tree' => $record->tree()->name(), 'xref' => $record->xref()])) ?>">
7983615acfSGreg Roach                <?= view('icons/reorder') ?>
8083615acfSGreg Roach                <?= I18N::translate('Re-order families') ?>
8183615acfSGreg Roach            </a>
8283615acfSGreg Roach        <?php else : ?>
8383615acfSGreg Roach            <div class="dropdown-item disabled">
8483615acfSGreg Roach                <?= view('icons/spacer') ?>
8583615acfSGreg Roach                <?= I18N::translate('Re-order families') ?>
8683615acfSGreg Roach            </div>
8783615acfSGreg Roach        <?php endif ?>
8883615acfSGreg Roach
8983615acfSGreg Roach        <div class="dropdown-divider"></div>
9083615acfSGreg Roach
91203146cfSGreg Roach        <a class="dropdown-item" href="<?= e(route(AddNewFact::class, ['tree' => $record->tree()->name(), 'xref' => $record->xref(), 'fact' => 'OBJE'])) ?>">
928e64ca84SGreg Roach            <?= view('icons/add') ?>
938e64ca84SGreg Roach            <?= I18N::translate('Add a media object') ?>
948e64ca84SGreg Roach        </a>
958e64ca84SGreg Roach
96203146cfSGreg Roach        <?php if ($record->facts(['OBJE'], false, null, true)->count() > 1) : ?>
97203146cfSGreg Roach            <a class="dropdown-item" href="<?= e(route(ReorderMediaPage::class, ['tree' => $record->tree()->name(), 'xref' => $record->xref()])) ?>">
98a6c1d617SGreg Roach                <?= view('icons/reorder') ?>
998e64ca84SGreg Roach                <?= I18N::translate('Re-order media') ?>
1008e64ca84SGreg Roach            </a>
1018e64ca84SGreg Roach        <?php else : ?>
1028e64ca84SGreg Roach            <div class="dropdown-item disabled">
1038e64ca84SGreg Roach                <?= view('icons/spacer') ?>
1048e64ca84SGreg Roach                <?= I18N::translate('Re-order media') ?>
1058e64ca84SGreg Roach            </div>
106dd6b2bfcSGreg Roach        <?php endif ?>
107dd6b2bfcSGreg Roach
1080f5fd22fSGreg Roach        <?php if ($clipboard_facts->isNotEmpty()) : ?>
1090f5fd22fSGreg Roach            <div class="dropdown-divider"></div>
1100f5fd22fSGreg Roach
1110f5fd22fSGreg Roach            <?= view('record-page-menu-clipboard', ['clipboard_facts' => $clipboard_facts, 'record' => $record]) ?>
1120f5fd22fSGreg Roach        <?php endif ?>
1130f5fd22fSGreg Roach
1148e64ca84SGreg Roach        <div class="dropdown-divider"></div>
1158e64ca84SGreg Roach
116203146cfSGreg Roach        <a class="dropdown-item" href="#" data-confirm="<?= I18N::translate('Are you sure you want to delete “%s”?', strip_tags($record->fullName())) ?>" data-post-url="<?= e(route(DeleteRecord::class, ['tree' => $record->tree()->name(), 'xref' => $record->xref()])) ?>">
11704fe0783SGreg Roach            <?= view('icons/delete') ?>
118dd6b2bfcSGreg Roach            <?= I18N::translate('Delete') ?>
119dd6b2bfcSGreg Roach        </a>
120dd6b2bfcSGreg Roach
121203146cfSGreg Roach        <?php if (Auth::isAdmin() || $record->tree()->getPreference('SHOW_GEDCOM_RECORD')) : ?>
122203146cfSGreg Roach            <a class="dropdown-item" href="<?= e(route(EditRawRecordPage::class, ['tree' => $record->tree()->name(), 'xref' => $record->xref()])) ?>">
12304fe0783SGreg Roach                <?= view('icons/edit') ?>
124dd6b2bfcSGreg Roach                <?= I18N::translate('Edit the raw GEDCOM') ?>
125dd6b2bfcSGreg Roach            </a>
126dd6b2bfcSGreg Roach        <?php endif ?>
127dd6b2bfcSGreg Roach    </div>
128dd6b2bfcSGreg Roach</div>
129