xref: /webtrees/resources/views/modules/relatives/tab.phtml (revision 4e54fb47ea2fc584c07c0c135853d49a85735c1a)
1d70512abSGreg Roach<?php
2d70512abSGreg Roach
310e06497SGreg Roachdeclare(strict_types=1);
410e06497SGreg Roach
57c2c99faSGreg Roachuse Fisharebest\Webtrees\Family;
67c7d1e03SGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\AddChildToIndividualPage;
77c7d1e03SGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\AddParentToIndividualPage;
87c7d1e03SGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\AddSpouseToIndividualPage;
97c7d1e03SGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\LinkChildToFamilyPage;
107c7d1e03SGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\LinkSpouseToIndividualPage;
11d70512abSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\ReorderFamiliesPage;
12d70512abSGreg Roachuse Fisharebest\Webtrees\I18N;
137c2c99faSGreg Roachuse Fisharebest\Webtrees\Individual;
147c2c99faSGreg Roachuse Illuminate\Support\Collection;
157c2c99faSGreg Roach
167c2c99faSGreg Roach/**
177c2c99faSGreg Roach * @var bool                   $can_edit
187c2c99faSGreg Roach * @var int                    $fam_access_level
197c2c99faSGreg Roach * @var Individual             $individual
2036779af1SGreg Roach * @var Collection<int,Family> $parent_families
2136779af1SGreg Roach * @var Collection<int,Family> $spouse_families
2236779af1SGreg Roach * @var Collection<int,Family> $step_child_families
2336779af1SGreg Roach * @var Collection<int,Family> $step_parent_families
247c2c99faSGreg Roach */
25d70512abSGreg Roach
26d70512abSGreg Roach?>
277c2c99faSGreg Roach<?php
287c2c99faSGreg Roach?>
29dd6b2bfcSGreg Roach
30*4e54fb47SGreg Roach<div class="wt-tab-relatives">
31dd6b2bfcSGreg Roach    <table class="table table-sm wt-facts-table" role="presentation">
32dd6b2bfcSGreg Roach    <tbody>
33dd6b2bfcSGreg Roach        <tr>
34dd6b2bfcSGreg Roach            <td>
35dd6b2bfcSGreg Roach                <label>
360363a7fdSDavid Drury                    <input id="show-date-differences" type="checkbox" data-bs-toggle="collapse" data-bs-target=".wt-date-difference" data-wt-persist="date-differences" autocomplete="off">
37dd6b2bfcSGreg Roach                    <?= I18N::translate('Date differences') ?>
38dd6b2bfcSGreg Roach                </label>
39dd6b2bfcSGreg Roach            </td>
40dd6b2bfcSGreg Roach        </tr>
41dd6b2bfcSGreg Roach    </tbody>
42dd6b2bfcSGreg Roach</table>
43dd6b2bfcSGreg Roach
44dd6b2bfcSGreg Roach<!-- Parents -->
45dd6b2bfcSGreg Roach<?php foreach ($parent_families as $family) : ?>
46dd6b2bfcSGreg Roach    <?= view('modules/relatives/family', [
47dd6b2bfcSGreg Roach        'individual'       => $individual,
48dd6b2bfcSGreg Roach        'family'           => $family,
49dd6b2bfcSGreg Roach        'type'             => 'FAMC',
50dd6b2bfcSGreg Roach        'label'            => $individual->getChildFamilyLabel($family),
51dd6b2bfcSGreg Roach        'fam_access_level' => $fam_access_level,
52dd6b2bfcSGreg Roach    ]) ?>
53dd6b2bfcSGreg Roach<?php endforeach ?>
54dd6b2bfcSGreg Roach
55dd6b2bfcSGreg Roach<!-- step-parents -->
56dd6b2bfcSGreg Roach<?php foreach ($step_parent_families as $family) : ?>
57dd6b2bfcSGreg Roach    <?= view('modules/relatives/family', [
58dd6b2bfcSGreg Roach        'individual'       => $individual,
59dd6b2bfcSGreg Roach        'family'           => $family,
60dd6b2bfcSGreg Roach        'type'             => 'FAMC',
61dd6b2bfcSGreg Roach        'label'            => $individual->getStepFamilyLabel($family),
62dd6b2bfcSGreg Roach        'fam_access_level' => $fam_access_level,
63dd6b2bfcSGreg Roach    ]) ?>
64dd6b2bfcSGreg Roach<?php endforeach ?>
65dd6b2bfcSGreg Roach
66dd6b2bfcSGreg Roach<!-- spouses -->
67dd6b2bfcSGreg Roach<?php foreach ($spouse_families as $family) : ?>
68dd6b2bfcSGreg Roach    <?= view('modules/relatives/family', [
69dd6b2bfcSGreg Roach        'individual'       => $individual,
70dd6b2bfcSGreg Roach        'family'           => $family,
71dd6b2bfcSGreg Roach        'type'             => 'FAMS',
72dd6b2bfcSGreg Roach        'label'            => $individual->getSpouseFamilyLabel($family),
73dd6b2bfcSGreg Roach        'fam_access_level' => $fam_access_level,
74dd6b2bfcSGreg Roach    ]) ?>
75dd6b2bfcSGreg Roach<?php endforeach ?>
76dd6b2bfcSGreg Roach
77dd6b2bfcSGreg Roach<!-- step-children -->
78fceda430SGreg Roach<?php foreach ($step_child_families as $family) : ?>
79dd6b2bfcSGreg Roach    <?= view('modules/relatives/family', [
80dd6b2bfcSGreg Roach        'individual'       => $individual,
81dd6b2bfcSGreg Roach        'family'           => $family,
82dd6b2bfcSGreg Roach        'type'             => 'FAMS',
8339ca88baSGreg Roach        'label'            => $family->fullName(),
84dd6b2bfcSGreg Roach        'fam_access_level' => $fam_access_level,
85dd6b2bfcSGreg Roach    ]) ?>
86dd6b2bfcSGreg Roach<?php endforeach ?>
87dd6b2bfcSGreg Roach
88dd6b2bfcSGreg Roach<?php if ($can_edit) : ?>
89dd6b2bfcSGreg Roach    <br>
90dd6b2bfcSGreg Roach    <table class="table table-sm wt-facts-table" role="presentation">
91dd6b2bfcSGreg Roach        <tbody>
9283615acfSGreg Roach            <?php if ($spouse_families->count() > 1) : ?>
93dd6b2bfcSGreg Roach                <tr>
94dd6b2bfcSGreg Roach                    <td>
951afbbc50SGreg Roach                        <a href="<?= e(route(ReorderFamiliesPage::class, ['tree' => $individual->tree()->name(), 'xref' => $individual->xref()])) ?>">
96e39fd5c6SGreg Roach                            <?= view('icons/reorder') ?>
97dd6b2bfcSGreg Roach                            <?= I18N::translate('Re-order families') ?>
98dd6b2bfcSGreg Roach                        </a>
99dd6b2bfcSGreg Roach                    </td>
100dd6b2bfcSGreg Roach                </tr>
101dd6b2bfcSGreg Roach            <?php endif ?>
1026de87b62SGreg Roach
1036de87b62SGreg Roach            <?php if ($parent_families->isEmpty()) : ?>
1046de87b62SGreg Roach                <tr>
1056de87b62SGreg Roach                    <td>
1066de87b62SGreg Roach                        <a href="<?= e(route(AddParentToIndividualPage::class, ['tree' => $individual->tree()->name(), 'xref' => $individual->xref(), 'sex' => 'M', 'url' => $individual->url() . '#tab-relatives'])) ?>">
1076de87b62SGreg Roach                            <?= I18N::translate('Add a father') ?>
1086de87b62SGreg Roach                        </a>
1096de87b62SGreg Roach                    </td>
1106de87b62SGreg Roach                </tr>
1116de87b62SGreg Roach                <tr>
1126de87b62SGreg Roach                    <td>
1136de87b62SGreg Roach                        <a href="<?= e(route(AddParentToIndividualPage::class, ['tree' => $individual->tree()->name(), 'xref' => $individual->xref(), 'sex' => 'F', 'url' => $individual->url() . '#tab-relatives'])) ?>">
1146de87b62SGreg Roach                            <?= I18N::translate('Add a mother') ?>
1156de87b62SGreg Roach                        </a>
1166de87b62SGreg Roach                    </td>
1176de87b62SGreg Roach                </tr>
1186de87b62SGreg Roach            <?php endif ?>
1196de87b62SGreg Roach
120dd6b2bfcSGreg Roach            <tr>
121dd6b2bfcSGreg Roach                <td>
1227c7d1e03SGreg Roach                    <a href="<?= e(route(LinkChildToFamilyPage::class, ['tree' => $individual->tree()->name(), 'xref' => $individual->xref()])) ?>">
123dd6b2bfcSGreg Roach                        <?= I18N::translate('Link this individual to an existing family as a child') ?>
124dd6b2bfcSGreg Roach                    </a>
125dd6b2bfcSGreg Roach                </td>
126dd6b2bfcSGreg Roach            </tr>
127dd6b2bfcSGreg Roach
128dd6b2bfcSGreg Roach            <tr>
129dd6b2bfcSGreg Roach                <td>
130efd4768bSGreg Roach                    <a href="<?= e(route(AddSpouseToIndividualPage::class, ['tree' => $individual->tree()->name(), 'xref' => $individual->xref(), 'url' => $individual->url() . '#tab-relatives'])) ?>">
13139ca88baSGreg Roach                        <?php if ($individual->sex() !== 'F') : ?>
132dd6b2bfcSGreg Roach                            <?= I18N::translate('Add a wife') ?>
133dd6b2bfcSGreg Roach                        <?php else : ?>
134dd6b2bfcSGreg Roach                            <?= I18N::translate('Add a husband') ?>
135dd6b2bfcSGreg Roach                        <?php endif ?>
136dd6b2bfcSGreg Roach                    </a>
137dd6b2bfcSGreg Roach                </td>
138dd6b2bfcSGreg Roach            </tr>
139dd6b2bfcSGreg Roach
140dd6b2bfcSGreg Roach            <tr>
141dd6b2bfcSGreg Roach                <td>
1427c7d1e03SGreg Roach                    <a href="<?= e(route(LinkSpouseToIndividualPage::class, ['tree' => $individual->tree()->name(), 'xref' => $individual->xref()])) ?>">
14339ca88baSGreg Roach                        <?php if ($individual->sex() !== 'F') : ?>
144dd6b2bfcSGreg Roach                            <?= I18N::translate('Add a wife using an existing individual') ?>
145dd6b2bfcSGreg Roach                        <?php else : ?>
146dd6b2bfcSGreg Roach                            <?= I18N::translate('Add a husband using an existing individual') ?>
147dd6b2bfcSGreg Roach                        <?php endif ?>
148dd6b2bfcSGreg Roach                    </a>
149dd6b2bfcSGreg Roach                </td>
150dd6b2bfcSGreg Roach            </tr>
151dd6b2bfcSGreg Roach
152dd6b2bfcSGreg Roach            <tr>
153dd6b2bfcSGreg Roach                <td>
154efd4768bSGreg Roach                    <a href="<?= e(route(AddChildToIndividualPage::class, ['tree' => $individual->tree()->name(), 'xref' => $individual->xref(), 'sex' => 'U'])) ?>">
155dd6b2bfcSGreg Roach                        <?= I18N::translate('Add a child to create a one-parent family') ?>
156dd6b2bfcSGreg Roach                    </a>
157dd6b2bfcSGreg Roach                </td>
158dd6b2bfcSGreg Roach            </tr>
159dd6b2bfcSGreg Roach        </tbody>
160dd6b2bfcSGreg Roach    </table>
161dd6b2bfcSGreg Roach<?php endif ?>
162dd6b2bfcSGreg Roach</div>
163