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