xref: /webtrees/resources/views/edit/change-family-members.phtml (revision 54c1426ef019dee75f3e7bd3fa3ca06d5420591a)
1<?php
2
3declare(strict_types=1);
4
5use Fisharebest\Webtrees\Family;
6use Fisharebest\Webtrees\Http\RequestHandlers\ChangeFamilyMembersAction;
7use Fisharebest\Webtrees\I18N;
8use Fisharebest\Webtrees\Tree;
9
10/**
11 * @var Family $family
12 * @var string $title
13 * @var Tree   $tree
14 */
15
16?>
17
18<h2 class="wt-page-title"><?= $title ?></h2>
19
20<form method="post" action="<?= e(route(ChangeFamilyMembersAction::class, ['tree' => $tree->name()])) ?>" class="wt-page-content" name="changefamform">
21    <input type="hidden" name="tree" value="<?= e($tree->name()) ?>">
22    <input type="hidden" name="xref" value="<?= e($family->xref()) ?>">
23
24    <div class="row">
25        <label class="col-sm-3 col-form-label wt-page-options-label" for="HUSB">
26            <?php if ($family->husband()?->sex() === 'M') : ?>
27                <?= I18N::translate('Husband') ?>
28            <?php elseif ($family->husband()?->sex() === 'F') : ?>
29                <?= I18N::translate('Wife') ?>
30            <?php else : ?>
31                <?= I18N::translate('Spouse') ?>
32            <?php endif ?>
33        </label>
34        <div class="col-sm-9 wt-page-options-value">
35            <?= view('components/select-individual', ['name' => 'HUSB', 'individual' => $family->husband(), 'tree' => $tree]) ?>
36        </div>
37    </div>
38
39    <div class="row">
40        <label class="col-sm-3 col-form-label wt-page-options-label" for="WIFE">
41            <?php if ($family->wife()?->sex() === 'M') : ?>
42                <?= I18N::translate('Husband') ?>
43            <?php elseif ($family->wife()?->sex() === 'F') : ?>
44                <?= I18N::translate('Wife') ?>
45            <?php else : ?>
46                <?= I18N::translate('Spouse') ?>
47            <?php endif ?>
48        </label>
49        <div class="col-sm-9 wt-page-options-value">
50            <?= view('components/select-individual', ['name' => 'WIFE', 'individual' => $family->wife(), 'tree' => $tree]) ?>
51        </div>
52    </div>
53
54    <?php foreach ($family->children() as $n => $child) : ?>
55        <div class="row">
56            <label class="col-sm-3 col-form-label wt-page-options-label" for="CHIL<?= $n ?>">
57                <?php if ($child->sex() === 'M') : ?>
58                    <?= I18N::translate('Son') ?>
59                <?php elseif ($child->sex() === 'F') : ?>
60                    <?= I18N::translate('Daughter') ?>
61                <?php else : ?>
62                    <?= I18N::translate('Child') ?>
63                <?php endif ?>
64            </label>
65            <div class="col-sm-9 wt-page-options-value">
66                <?= view('components/select-individual', ['name' => 'CHIL[]', 'id' => 'CHIL' . $n, 'individual' => $child, 'tree' => $tree]) ?>
67            </div>
68        </div>
69    <?php endforeach ?>
70
71    <div class="row">
72        <label class="col-sm-3 col-form-label wt-page-options-label" for="CHIL<?= count($family->children()) + 1 ?>">
73            <?= I18N::translate('Child') ?>
74        </label>
75        <div class="col-sm-9 wt-page-options-value">
76            <?= view('components/select-individual', ['name' => 'CHIL[]', 'id' => 'CHIL' . (count($family->children()) + 1), 'tree' => $tree]) ?>
77        </div>
78    </div>
79
80    <div class="row mb-3">
81        <div class="col-sm-3 wt-page-options-label">
82        </div>
83        <div class="col-sm-9 wt-page-options-value">
84            <button class="btn btn-primary" type="submit">
85                <?= view('icons/save') ?>
86                <?= /* I18N: A button label. */
87                I18N::translate('save') ?>
88            </button>
89            <a class="btn btn-secondary" href="<?= e($family->url()) ?>">
90                <?= view('icons/cancel') ?>
91                <?= /* I18N: A button label. */
92                I18N::translate('cancel') ?>
93            </a>
94        </div>
95    </div>
96
97    <?= csrf_field() ?>
98</form>
99