xref: /webtrees/resources/views/individual-page-menu.phtml (revision 29a51599e39417638370fe4c2c4d77201726c9ff)
1<?php
2
3use Fisharebest\Webtrees\Auth;
4use Fisharebest\Webtrees\Http\RequestHandlers\AddNewFact;
5use Fisharebest\Webtrees\Http\RequestHandlers\DeleteRecord;
6use Fisharebest\Webtrees\Http\RequestHandlers\EditFact;
7use Fisharebest\Webtrees\Http\RequestHandlers\EditRawRecordPage;
8use Fisharebest\Webtrees\Http\RequestHandlers\ReorderMediaPage;
9use Fisharebest\Webtrees\Http\RequestHandlers\ReorderNamesPage;
10use Fisharebest\Webtrees\Http\RequestHandlers\ReorderFamiliesPage;
11use Fisharebest\Webtrees\I18N;
12
13?>
14
15<div class="dropdown wt-page-menu">
16    <button class="btn btn-primary dropdown-toggle wt-page-menu-button" type="button" id="page-menu" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
17        <?= view('icons/edit') ?>
18        <?= I18N::translate('edit') ?>
19    </button>
20
21    <div class="dropdown-menu dropdown-menu-right wt-page-menu-items" aria-labelledby="page-menu">
22        <a class="dropdown-item" href="<?= e(route('add-name', ['tree' => $individual->tree()->name(), 'xref' => $individual->xref()])) ?>">
23            <?= view('icons/add') ?>
24            <?= I18N::translate('Add a name') ?>
25        </a>
26
27        <?php if ($count_names > 1) : ?>
28            <a class="dropdown-item" href="<?= e(route(ReorderNamesPage::class, ['tree' => $tree->name(), 'xref' => $individual->xref()])) ?>">
29                <?= view('icons/reorder') ?>
30                <?= I18N::translate('Re-order names') ?>
31            </a>
32        <?php else : ?>
33            <div class="dropdown-item disabled">
34                <?= view('icons/spacer') ?>
35                <?= I18N::translate('Re-order names') ?>
36            </div>
37        <?php endif ?>
38
39        <div class="dropdown-divider"></div>
40
41        <?php if ($count_sex === 0) : ?>
42            <a class="dropdown-item" href="<?= e(route(AddNewFact::class, ['fact' => 'SEX', 'tree' => $individual->tree()->name(), 'xref' => $individual->xref()])) ?>">
43                <?= view('icons/edit') ?>
44                <?= I18N::translate('Edit the gender') ?>
45            </a>
46        <?php endif ?>
47
48        <?php foreach ($individual->facts(['SEX']) as $fact) : ?>
49            <?php if ($fact->canEdit()) : ?>
50                <a class="dropdown-item" href="<?= e(route(EditFact::class, ['xref' => $individual->xref(), 'fact_id' => $fact->id(), 'tree' => $individual->tree()->name()])) ?>">
51                    <?= view('icons/edit') ?>
52                    <?= I18N::translate('Edit the gender') ?>
53                </a>
54            <?php endif ?>
55        <?php endforeach ?>
56
57        <div class="dropdown-divider"></div>
58
59        <?php if ($individual->spouseFamilies()->count() > 1 || $individual->childFamilies()->count() > 1) : ?>
60            <a class="dropdown-item" href="<?= e(route(ReorderFamiliesPage::class, ['tree' => $individual->tree()->name(), 'xref' => $individual->xref()])) ?>">
61                <?= view('icons/reorder') ?>
62                <?= I18N::translate('Re-order families') ?>
63            </a>
64        <?php else : ?>
65            <div class="dropdown-item disabled">
66                <?= view('icons/spacer') ?>
67                <?= I18N::translate('Re-order families') ?>
68            </div>
69        <?php endif ?>
70
71        <div class="dropdown-divider"></div>
72
73        <a class="dropdown-item" href="<?= e(route(AddNewFact::class, ['tree' => $individual->tree()->name(), 'xref' => $individual->xref(), 'fact' => 'OBJE'])) ?>">
74            <?= view('icons/add') ?>
75            <?= I18N::translate('Add a media object') ?>
76        </a>
77
78        <?php if ($individual->facts(['OBJE'])->count() > 1) : ?>
79            <a class="dropdown-item" href="<?= e(route(ReorderMediaPage::class, ['tree' => $tree->name(), 'xref' => $individual->xref()])) ?>">
80                <?= view('icons/reorder') ?>
81                <?= I18N::translate('Re-order media') ?>
82            </a>
83        <?php else : ?>
84            <div class="dropdown-item disabled">
85                <?= view('icons/spacer') ?>
86                <?= I18N::translate('Re-order media') ?>
87            </div>
88        <?php endif ?>
89
90        <div class="dropdown-divider"></div>
91
92        <a class="dropdown-item" href="#" data-confirm="<?= I18N::translate('Are you sure you want to delete “%s”?', strip_tags($individual->fullName())) ?>" data-post-url="<?= e(route(DeleteRecord::class, ['tree' => $individual->tree()->name(), 'xref' => $individual->xref()])) ?>">
93            <?= view('icons/delete') ?>
94            <?= I18N::translate('Delete') ?>
95        </a>
96
97        <?php if (Auth::isAdmin() || $individual->tree()->getPreference('SHOW_GEDCOM_RECORD')) : ?>
98            <a class="dropdown-item" href="<?= e(route(EditRawRecordPage::class, ['tree' => $individual->tree()->name(), 'xref' => $individual->xref()])) ?>">
99                <?= view('icons/edit') ?>
100                <?= I18N::translate('Edit the raw GEDCOM') ?>
101            </a>
102        <?php endif ?>
103    </div>
104</div>
105