xref: /webtrees/resources/views/family-page-menu.phtml (revision 0db1e7d20bab9209012a4f3fdc1af3ef87a1a528)
1<?php
2
3declare(strict_types=1);
4
5use Fisharebest\Webtrees\Auth;
6use Fisharebest\Webtrees\Fact;
7use Fisharebest\Webtrees\Family;
8use Fisharebest\Webtrees\Http\RequestHandlers\AddChildToFamilyPage;
9use Fisharebest\Webtrees\Http\RequestHandlers\AddNewFact;
10use Fisharebest\Webtrees\Http\RequestHandlers\AddSpouseToFamilyPage;
11use Fisharebest\Webtrees\Http\RequestHandlers\ChangeFamilyMembersPage;
12use Fisharebest\Webtrees\Http\RequestHandlers\DeleteRecord;
13use Fisharebest\Webtrees\Http\RequestHandlers\EditRawRecordPage;
14use Fisharebest\Webtrees\Http\RequestHandlers\ReorderChildrenPage;
15use Fisharebest\Webtrees\I18N;
16use Illuminate\Support\Collection;
17
18/**
19 * @var bool                 $can_upload_media
20 * @var Collection<int,Fact> $clipboard_facts
21 * @var Family               $record
22 */
23
24?>
25
26<div class="dropdown wt-page-menu">
27    <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">
28        <?= view('icons/menu') ?>
29        <?= I18N::translate('edit') ?>
30    </button>
31
32    <div class="dropdown-menu dropdown-menu-end wt-page-menu-items" aria-labelledby="page-menu">
33        <a class="dropdown-item" href="<?= e(route(ChangeFamilyMembersPage::class, ['tree' => $record->tree()->name(), 'xref' => $record->xref()])) ?>">
34            <?= view('icons/family') ?>
35            <?= I18N::translate('Change family members') ?>
36        </a>
37
38        <?php if ($record->husband() === null) : ?>
39            <a class="dropdown-item" href="<?= e(route(AddSpouseToFamilyPage::class, ['tree' => $record->tree()->name(), 'xref' => $record->xref(), 'sex' => 'M'])) ?>">
40                <?= view('icons/add') ?>
41                <?= I18N::translate('Add a husband') ?>
42            </a>
43        <?php endif ?>
44
45        <?php if ($record->wife() === null) : ?>
46            <a class="dropdown-item" href="<?= e(route(AddSpouseToFamilyPage::class, ['tree' => $record->tree()->name(), 'xref' => $record->xref(), 'sex' => 'F'])) ?>">
47                <?= view('icons/add') ?>
48                <?= I18N::translate('Add a wife') ?>
49            </a>
50        <?php endif ?>
51
52        <a class="dropdown-item" href="<?= e(route(AddChildToFamilyPage::class, ['tree' => $record->tree()->name(), 'xref' => $record->xref(), 'sex' => 'U'])) ?>">
53            <?= view('icons/add') ?>
54            <?= I18N::translate('Add a child') ?>
55        </a>
56
57        <?php if ($record->numberOfChildren() > 1) : ?>
58            <a class="dropdown-item" href="<?= e(route(ReorderChildrenPage::class, ['tree' => $record->tree()->name(), 'xref' => $record->xref()])) ?>">
59                <?= view('icons/reorder') ?>
60                <?= I18N::translate('Re-order children') ?>
61            </a>
62        <?php endif ?>
63
64        <?php if ($can_upload_media) : ?>
65            <div class="dropdown-divider"></div>
66
67            <a class="dropdown-item" href="<?= e(route(AddNewFact::class, ['tree' => $record->tree()->name(), 'xref' => $record->xref(), 'fact' => 'OBJE'])) ?>">
68                <?= view('icons/add') ?>
69                <?= I18N::translate('Add a media object') ?>
70            </a>
71        <?php endif ?>
72
73        <?php if ($clipboard_facts->isNotEmpty()) : ?>
74            <div class="dropdown-divider"></div>
75
76            <?= view('record-page-menu-clipboard', ['clipboard_facts' => $clipboard_facts, 'record' => $record]) ?>
77        <?php endif ?>
78
79        <div class="dropdown-divider"></div>
80
81        <a class="dropdown-item" href="#" data-wt-confirm="<?= I18N::translate('Deleting the family will unlink all of the individuals from each other but will leave the individuals in place. Are you sure you want to delete this family?') ?>" data-wt-post-url="<?= e(route(DeleteRecord::class, ['tree' => $record->tree()->name(), 'xref' => $record->xref()])) ?>">
82            <?= view('icons/delete') ?>
83            <?= I18N::translate('Delete') ?>
84        </a>
85
86        <?php if (Auth::isAdmin() || $record->tree()->getPreference('SHOW_GEDCOM_RECORD') === '1') : ?>
87            <a class="dropdown-item" href="<?= e(route(EditRawRecordPage::class, ['tree' => $record->tree()->name(), 'xref' => $record->xref()])) ?>">
88                <?= view('icons/edit') ?>
89                <?= I18N::translate('Edit the raw GEDCOM') ?>
90            </a>
91        <?php endif ?>
92    </div>
93</div>
94