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