xref: /webtrees/resources/views/edit/change-family-members.phtml (revision 58a588c63196cb1f4cc1926f6fe552c754b0d27a)
1d70512abSGreg Roach<?php
2d70512abSGreg Roach
310e06497SGreg Roachdeclare(strict_types=1);
410e06497SGreg Roach
57c2c99faSGreg Roachuse Fisharebest\Webtrees\Family;
643322877SGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\ChangeFamilyMembersAction;
7d70512abSGreg Roachuse Fisharebest\Webtrees\I18N;
87c2c99faSGreg Roachuse Fisharebest\Webtrees\Tree;
97c2c99faSGreg Roach
107c2c99faSGreg Roach/**
117c2c99faSGreg Roach * @var Family $family
127c2c99faSGreg Roach * @var string $title
137c2c99faSGreg Roach * @var Tree   $tree
147c2c99faSGreg Roach */
15d70512abSGreg Roach
16d70512abSGreg Roach?>
17dd6b2bfcSGreg Roach
18dd6b2bfcSGreg Roach<h2 class="wt-page-title"><?= $title ?></h2>
19dd6b2bfcSGreg Roach
2043322877SGreg Roach<form method="post" action="<?= e(route(ChangeFamilyMembersAction::class, ['tree' => $tree->name()])) ?>" class="wt-page-content" name="changefamform">
219022ab66SGreg Roach    <input type="hidden" name="tree" value="<?= e($tree->name()) ?>">
22c0935879SGreg Roach    <input type="hidden" name="xref" value="<?= e($family->xref()) ?>">
23dd6b2bfcSGreg Roach
249e3c2cf9SGreg Roach    <div class="row">
25dd6b2bfcSGreg Roach        <label class="col-sm-3 col-form-label wt-page-options-label" for="HUSB">
26*58a588c6SGreg Roach            <?php if ($family->husband()?->sex() === 'M') : ?>
27dd6b2bfcSGreg Roach                <?= I18N::translate('Husband') ?>
28*58a588c6SGreg Roach            <?php elseif ($family->husband()?->sex() === 'F') : ?>
29dd6b2bfcSGreg Roach                <?= I18N::translate('Wife') ?>
30dd6b2bfcSGreg Roach            <?php else : ?>
31dd6b2bfcSGreg Roach                <?= I18N::translate('Spouse') ?>
32dd6b2bfcSGreg Roach            <?php endif ?>
33dd6b2bfcSGreg Roach        </label>
34dd6b2bfcSGreg Roach        <div class="col-sm-9 wt-page-options-value">
35*58a588c6SGreg Roach            <?= view('components/select-individual', ['name' => 'HUSB', 'individual' => $family->husband(), 'tree' => $tree]) ?>
36dd6b2bfcSGreg Roach        </div>
37dd6b2bfcSGreg Roach    </div>
38dd6b2bfcSGreg Roach
399e3c2cf9SGreg Roach    <div class="row">
40dd6b2bfcSGreg Roach        <label class="col-sm-3 col-form-label wt-page-options-label" for="WIFE">
41*58a588c6SGreg Roach            <?php if ($family->wife()?->sex() === 'M') : ?>
42dd6b2bfcSGreg Roach                <?= I18N::translate('Husband') ?>
43*58a588c6SGreg Roach            <?php elseif ($family->wife()?->sex() === 'F') : ?>
44dd6b2bfcSGreg Roach                <?= I18N::translate('Wife') ?>
45dd6b2bfcSGreg Roach            <?php else : ?>
46dd6b2bfcSGreg Roach                <?= I18N::translate('Spouse') ?>
47dd6b2bfcSGreg Roach            <?php endif ?>
48dd6b2bfcSGreg Roach        </label>
49dd6b2bfcSGreg Roach        <div class="col-sm-9 wt-page-options-value">
50*58a588c6SGreg Roach            <?= view('components/select-individual', ['name' => 'WIFE', 'individual' => $family->wife(), 'tree' => $tree]) ?>
51dd6b2bfcSGreg Roach        </div>
52dd6b2bfcSGreg Roach    </div>
53dd6b2bfcSGreg Roach
54*58a588c6SGreg Roach    <?php foreach ($family->children() as $n => $child) : ?>
559e3c2cf9SGreg Roach        <div class="row">
56*58a588c6SGreg Roach            <label class="col-sm-3 col-form-label wt-page-options-label" for="CHIL<?= $n ?>">
57*58a588c6SGreg Roach                <?php if ($child->sex() === 'M') : ?>
58dd6b2bfcSGreg Roach                    <?= I18N::translate('Son') ?>
59*58a588c6SGreg Roach                <?php elseif ($child->sex() === 'F') : ?>
60dd6b2bfcSGreg Roach                    <?= I18N::translate('Daughter') ?>
61dd6b2bfcSGreg Roach                <?php else : ?>
62dd6b2bfcSGreg Roach                    <?= I18N::translate('Child') ?>
63dd6b2bfcSGreg Roach                <?php endif ?>
64dd6b2bfcSGreg Roach            </label>
65dd6b2bfcSGreg Roach            <div class="col-sm-9 wt-page-options-value">
66b6c326d8SGreg Roach                <?= view('components/select-individual', ['name' => 'CHIL[]', 'id' => 'CHIL' . $n, 'individual' => $child, 'tree' => $tree]) ?>
67dd6b2bfcSGreg Roach            </div>
68dd6b2bfcSGreg Roach        </div>
69dd6b2bfcSGreg Roach    <?php endforeach ?>
70dd6b2bfcSGreg Roach
719e3c2cf9SGreg Roach    <div class="row">
72*58a588c6SGreg Roach        <label class="col-sm-3 col-form-label wt-page-options-label" for="CHIL<?= count($family->children()) + 1 ?>">
73dd6b2bfcSGreg Roach            <?= I18N::translate('Child') ?>
74dd6b2bfcSGreg Roach        </label>
75dd6b2bfcSGreg Roach        <div class="col-sm-9 wt-page-options-value">
76*58a588c6SGreg Roach            <?= view('components/select-individual', ['name' => 'CHIL[]', 'id' => 'CHIL' . (count($family->children()) + 1), 'tree' => $tree]) ?>
77dd6b2bfcSGreg Roach        </div>
78dd6b2bfcSGreg Roach    </div>
79dd6b2bfcSGreg Roach
809e3c2cf9SGreg Roach    <div class="row mb-3">
81dd6b2bfcSGreg Roach        <div class="col-sm-3 wt-page-options-label">
82dd6b2bfcSGreg Roach        </div>
83dd6b2bfcSGreg Roach        <div class="col-sm-9 wt-page-options-value">
84dd6b2bfcSGreg Roach            <button class="btn btn-primary" type="submit">
85d993d560SGreg Roach                <?= view('icons/save') ?>
86dd6b2bfcSGreg Roach                <?= /* I18N: A button label. */
87dd6b2bfcSGreg Roach                I18N::translate('save') ?>
88dd6b2bfcSGreg Roach            </button>
89dd6b2bfcSGreg Roach            <a class="btn btn-secondary" href="<?= e($family->url()) ?>">
90d993d560SGreg Roach                <?= view('icons/cancel') ?>
91dd6b2bfcSGreg Roach                <?= /* I18N: A button label. */
92dd6b2bfcSGreg Roach                I18N::translate('cancel') ?>
93dd6b2bfcSGreg Roach            </a>
94dd6b2bfcSGreg Roach        </div>
95dd6b2bfcSGreg Roach    </div>
9681443e3cSGreg Roach
9781443e3cSGreg Roach    <?= csrf_field() ?>
98dd6b2bfcSGreg Roach</form>
99