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