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