xref: /webtrees/resources/views/edit/change-family-members.phtml (revision 9e3c2cf9009c4c2140f50ddfc80b91f2f82cdce5)
1d70512abSGreg Roach<?php
2d70512abSGreg Roach
37c2c99faSGreg Roachuse Fisharebest\Webtrees\Family;
443322877SGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\ChangeFamilyMembersAction;
5d70512abSGreg Roachuse Fisharebest\Webtrees\I18N;
67c2c99faSGreg Roachuse Fisharebest\Webtrees\Individual;
77c2c99faSGreg Roachuse Fisharebest\Webtrees\Tree;
87c2c99faSGreg Roachuse Illuminate\Support\Collection;
97c2c99faSGreg Roach
107c2c99faSGreg Roach/**
1136779af1SGreg Roach * @var Collection<int,Individual> $children
127c2c99faSGreg Roach * @var Family                     $family
137c2c99faSGreg Roach * @var Individual|null            $father
147c2c99faSGreg Roach * @var Individual|null            $mother
157c2c99faSGreg Roach * @var string                     $title
167c2c99faSGreg Roach * @var Tree                       $tree
177c2c99faSGreg Roach */
18d70512abSGreg Roach
19d70512abSGreg Roach?>
20dd6b2bfcSGreg Roach
21dd6b2bfcSGreg Roach<h2 class="wt-page-title"><?= $title ?></h2>
22dd6b2bfcSGreg Roach
2343322877SGreg Roach<form method="post" action="<?= e(route(ChangeFamilyMembersAction::class, ['tree' => $tree->name()])) ?>" class="wt-page-content" name="changefamform">
24dd6b2bfcSGreg Roach    <?= csrf_field() ?>
25dd6b2bfcSGreg Roach
269022ab66SGreg Roach    <input type="hidden" name="tree" value="<?= e($tree->name()) ?>">
27c0935879SGreg Roach    <input type="hidden" name="xref" value="<?= e($family->xref()) ?>">
28dd6b2bfcSGreg Roach
29*9e3c2cf9SGreg Roach    <div class="row">
30dd6b2bfcSGreg Roach        <label class="col-sm-3 col-form-label wt-page-options-label" for="HUSB">
317c2c99faSGreg Roach            <?php if ($father instanceof Individual && $father->sex() === 'M') : ?>
32dd6b2bfcSGreg Roach                <?= I18N::translate('Husband') ?>
3339ca88baSGreg Roach            <?php elseif ($father !== null && $father->sex() === 'F') : ?>
34dd6b2bfcSGreg Roach                <?= I18N::translate('Wife') ?>
35dd6b2bfcSGreg Roach            <?php else : ?>
36dd6b2bfcSGreg Roach                <?= I18N::translate('Spouse') ?>
37dd6b2bfcSGreg Roach            <?php endif ?>
38dd6b2bfcSGreg Roach        </label>
39dd6b2bfcSGreg Roach        <div class="col-sm-9 wt-page-options-value">
40b6c326d8SGreg Roach            <?= view('components/select-individual', ['name' => 'HUSB', 'individual' => $father, 'tree' => $tree]) ?>
41dd6b2bfcSGreg Roach        </div>
42dd6b2bfcSGreg Roach    </div>
43dd6b2bfcSGreg Roach
44*9e3c2cf9SGreg Roach    <div class="row">
45dd6b2bfcSGreg Roach        <label class="col-sm-3 col-form-label wt-page-options-label" for="WIFE">
467c2c99faSGreg Roach            <?php if ($mother  instanceof Individual && $mother->sex() === 'M') : ?>
47dd6b2bfcSGreg Roach                <?= I18N::translate('Husband') ?>
4839ca88baSGreg Roach            <?php elseif ($mother !== null && $mother->sex() === 'F') : ?>
49dd6b2bfcSGreg Roach                <?= I18N::translate('Wife') ?>
50dd6b2bfcSGreg Roach            <?php else : ?>
51dd6b2bfcSGreg Roach                <?= I18N::translate('Spouse') ?>
52dd6b2bfcSGreg Roach            <?php endif ?>
53dd6b2bfcSGreg Roach        </label>
54dd6b2bfcSGreg Roach        <div class="col-sm-9 wt-page-options-value">
55b6c326d8SGreg Roach            <?= view('components/select-individual', ['name' => 'WIFE', 'individual' => $mother, 'tree' => $tree]) ?>
56dd6b2bfcSGreg Roach        </div>
57dd6b2bfcSGreg Roach    </div>
58dd6b2bfcSGreg Roach
59dd6b2bfcSGreg Roach    <?php foreach ($children as $n => $child) : ?>
60*9e3c2cf9SGreg Roach        <div class="row">
61dd6b2bfcSGreg Roach            <label class="col-sm-3 col-form-label wt-page-options-label" for="CHIL<?= e($n) ?>">
6239ca88baSGreg Roach                <?php if ($child !== null && $child->sex() === 'M') : ?>
63dd6b2bfcSGreg Roach                    <?= I18N::translate('Son') ?>
6439ca88baSGreg Roach                <?php elseif ($child !== null && $child->sex() === 'F') : ?>
65dd6b2bfcSGreg Roach                    <?= I18N::translate('Daughter') ?>
66dd6b2bfcSGreg Roach                <?php else : ?>
67dd6b2bfcSGreg Roach                    <?= I18N::translate('Child') ?>
68dd6b2bfcSGreg Roach                <?php endif ?>
69dd6b2bfcSGreg Roach            </label>
70dd6b2bfcSGreg Roach            <div class="col-sm-9 wt-page-options-value">
71b6c326d8SGreg Roach                <?= view('components/select-individual', ['name' => 'CHIL[]', 'id' => 'CHIL' . $n, 'individual' => $child, 'tree' => $tree]) ?>
72dd6b2bfcSGreg Roach            </div>
73dd6b2bfcSGreg Roach        </div>
74dd6b2bfcSGreg Roach    <?php endforeach ?>
75dd6b2bfcSGreg Roach
76*9e3c2cf9SGreg Roach    <div class="row">
77dd6b2bfcSGreg Roach        <label class="col-sm-3 col-form-label wt-page-options-label" for="CHIL<?= e(count($children) + 1) ?>">
78dd6b2bfcSGreg Roach            <?= I18N::translate('Child') ?>
79dd6b2bfcSGreg Roach        </label>
80dd6b2bfcSGreg Roach        <div class="col-sm-9 wt-page-options-value">
81b6c326d8SGreg Roach            <?= view('components/select-individual', ['name' => 'CHIL[]', 'id' => 'CHIL' . (count($children) + 1), 'tree' => $tree]) ?>
82dd6b2bfcSGreg Roach        </div>
83dd6b2bfcSGreg Roach    </div>
84dd6b2bfcSGreg Roach
85*9e3c2cf9SGreg Roach    <div class="row mb-3">
86dd6b2bfcSGreg Roach        <div class="col-sm-3 wt-page-options-label">
87dd6b2bfcSGreg Roach        </div>
88dd6b2bfcSGreg Roach        <div class="col-sm-9 wt-page-options-value">
89dd6b2bfcSGreg Roach            <button class="btn btn-primary" type="submit">
90d993d560SGreg Roach                <?= view('icons/save') ?>
91dd6b2bfcSGreg Roach                <?= /* I18N: A button label. */
92dd6b2bfcSGreg Roach                I18N::translate('save') ?>
93dd6b2bfcSGreg Roach            </button>
94dd6b2bfcSGreg Roach            <a class="btn btn-secondary" href="<?= e($family->url()) ?>">
95d993d560SGreg Roach                <?= view('icons/cancel') ?>
96dd6b2bfcSGreg Roach                <?= /* I18N: A button label. */
97dd6b2bfcSGreg Roach                I18N::translate('cancel') ?>
98dd6b2bfcSGreg Roach            </a>
99dd6b2bfcSGreg Roach        </div>
100dd6b2bfcSGreg Roach    </div>
101dd6b2bfcSGreg Roach</form>
102