xref: /webtrees/resources/views/modules/relatives/tab.phtml (revision 3213013ede3591752a6702ce4e8d35f6396dd0f9)
1<?php
2
3use Fisharebest\Webtrees\Http\RequestHandlers\AddChildToIndividualPage;
4use Fisharebest\Webtrees\Http\RequestHandlers\AddParentToIndividualPage;
5use Fisharebest\Webtrees\Http\RequestHandlers\AddSpouseToIndividualPage;
6use Fisharebest\Webtrees\Http\RequestHandlers\LinkChildToFamilyPage;
7use Fisharebest\Webtrees\Http\RequestHandlers\LinkSpouseToIndividualPage;
8use Fisharebest\Webtrees\Http\RequestHandlers\ReorderFamiliesPage;
9use Fisharebest\Webtrees\I18N;
10
11?>
12<?php use Fisharebest\Webtrees\View; ?>
13
14<div class="wt-tab-relatives py-4">
15    <table class="table table-sm wt-facts-table" role="presentation">
16    <tbody>
17        <tr>
18            <td>
19                <label>
20                    <input id="show-date-differences" type="checkbox" data-toggle="collapse" data-target=".wt-date-difference">
21                    <?= I18N::translate('Date differences') ?>
22                </label>
23            </td>
24        </tr>
25    </tbody>
26</table>
27
28<?php if ($parent_families->isEmpty() && $can_edit) : ?>
29    <table class="table table-sm wt-facts-table" role="presentation">
30        <tbody>
31            <tr>
32                <td>
33                    <a href="<?= e(route(AddParentToIndividualPage::class, ['tree' => $individual->tree()->name(), 'xref' => $individual->xref(), 'gender' => 'M'])) ?>">
34                        <?= I18N::translate('Add a father') ?>
35                    </a>
36                </td>
37            </tr>
38            <tr>
39                <td>
40                    <a href="<?= e(route(AddParentToIndividualPage::class, ['tree' => $individual->tree()->name(), 'xref' => $individual->xref(), 'gender' => 'F'])) ?>">
41                        <?= I18N::translate('Add a mother') ?>
42                    </a>
43                </td>
44            </tr>
45        </tbody>
46    </table>
47<?php endif ?>
48
49<!-- Parents -->
50<?php foreach ($parent_families as $family) : ?>
51    <?= view('modules/relatives/family', [
52        'individual'       => $individual,
53        'family'           => $family,
54        'type'             => 'FAMC',
55        'label'            => $individual->getChildFamilyLabel($family),
56        'fam_access_level' => $fam_access_level,
57    ]) ?>
58<?php endforeach ?>
59
60<!-- step-parents -->
61<?php foreach ($step_parent_families as $family) : ?>
62    <?= view('modules/relatives/family', [
63        'individual'       => $individual,
64        'family'           => $family,
65        'type'             => 'FAMC',
66        'label'            => $individual->getStepFamilyLabel($family),
67        'fam_access_level' => $fam_access_level,
68    ]) ?>
69<?php endforeach ?>
70
71<!-- spouses -->
72<?php foreach ($spouse_families as $family) : ?>
73    <?= view('modules/relatives/family', [
74        'individual'       => $individual,
75        'family'           => $family,
76        'type'             => 'FAMS',
77        'label'            => $individual->getSpouseFamilyLabel($family),
78        'fam_access_level' => $fam_access_level,
79    ]) ?>
80<?php endforeach ?>
81
82<!-- step-children -->
83<?php foreach ($step_child_familiess as $family) : ?>
84    <?= view('modules/relatives/family', [
85        'individual'       => $individual,
86        'family'           => $family,
87        'type'             => 'FAMS',
88        'label'            => $family->fullName(),
89        'fam_access_level' => $fam_access_level,
90    ]) ?>
91<?php endforeach ?>
92
93<?php if ($can_edit) : ?>
94    <br>
95    <table class="table table-sm wt-facts-table" role="presentation">
96        <tbody>
97            <?php if ($spouse_families->count() > 1) : ?>
98                <tr>
99                    <td>
100                        <a href="<?= e(route(ReorderFamiliesPage::class, ['tree' => $individual->tree()->name(), 'xref' => $individual->xref()])) ?>">
101                            <?= view('icons/reorder') ?>
102                            <?= I18N::translate('Re-order families') ?>
103                        </a>
104                    </td>
105                </tr>
106            <?php endif ?>
107            <tr>
108                <td>
109                    <a href="<?= e(route(LinkChildToFamilyPage::class, ['tree' => $individual->tree()->name(), 'xref' => $individual->xref()])) ?>">
110                        <?= I18N::translate('Link this individual to an existing family as a child') ?>
111                    </a>
112                </td>
113            </tr>
114
115            <tr>
116                <td>
117                    <a href="<?= e(route(AddSpouseToIndividualPage::class, ['tree' => $individual->tree()->name(), 'xref' => $individual->xref()])) ?>">
118                        <?php if ($individual->sex() !== 'F') : ?>
119                            <?= I18N::translate('Add a wife') ?>
120                        <?php else : ?>
121                            <?= I18N::translate('Add a husband') ?>
122                        <?php endif ?>
123                    </a>
124                </td>
125            </tr>
126
127            <tr>
128                <td>
129                    <a href="<?= e(route(LinkSpouseToIndividualPage::class, ['tree' => $individual->tree()->name(), 'xref' => $individual->xref()])) ?>">
130                        <?php if ($individual->sex() !== 'F') : ?>
131                            <?= I18N::translate('Add a wife using an existing individual') ?>
132                        <?php else : ?>
133                            <?= I18N::translate('Add a husband using an existing individual') ?>
134                        <?php endif ?>
135                    </a>
136                </td>
137            </tr>
138
139            <tr>
140                <td>
141                    <a href="<?= e(route(AddChildToIndividualPage::class, ['tree' => $individual->tree()->name(), 'xref' => $individual->xref(), 'gender' => 'U'])) ?>">
142                        <?= I18N::translate('Add a child to create a one-parent family') ?>
143                    </a>
144                </td>
145            </tr>
146        </tbody>
147    </table>
148<?php endif ?>
149</div>
150
151<?php View::push('javascript') ?>
152<script>
153    'use strict';
154
155    webtrees.persistentToggle("show-date-differences");
156</script>
157<?php View::endpush() ?>
158