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