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