xref: /webtrees/resources/views/edit/change-family-members.phtml (revision 36de22acf6348b1059dac63e3cd19589574906ac)
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<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    <?= csrf_field() ?>
25
26    <input type="hidden" name="tree" value="<?= e($tree->name()) ?>">
27    <input type="hidden" name="xref" value="<?= e($family->xref()) ?>">
28
29    <div class="form-group row">
30        <label class="col-sm-3 col-form-label wt-page-options-label" for="HUSB">
31            <?php if ($father instanceof Individual && $father->sex() === 'M') : ?>
32                <?= I18N::translate('Husband') ?>
33            <?php elseif ($father !== null && $father->sex() === 'F') : ?>
34                <?= I18N::translate('Wife') ?>
35            <?php else : ?>
36                <?= I18N::translate('Spouse') ?>
37            <?php endif ?>
38        </label>
39        <div class="col-sm-9 wt-page-options-value">
40            <?= view('components/select-individual', ['name' => 'HUSB', 'individual' => $father, 'tree' => $tree]) ?>
41        </div>
42    </div>
43
44    <div class="form-group row">
45        <label class="col-sm-3 col-form-label wt-page-options-label" for="WIFE">
46            <?php if ($mother  instanceof Individual && $mother->sex() === 'M') : ?>
47                <?= I18N::translate('Husband') ?>
48            <?php elseif ($mother !== null && $mother->sex() === 'F') : ?>
49                <?= I18N::translate('Wife') ?>
50            <?php else : ?>
51                <?= I18N::translate('Spouse') ?>
52            <?php endif ?>
53        </label>
54        <div class="col-sm-9 wt-page-options-value">
55            <?= view('components/select-individual', ['name' => 'WIFE', 'individual' => $mother, 'tree' => $tree]) ?>
56        </div>
57    </div>
58
59    <?php foreach ($children as $n => $child) : ?>
60        <div class="form-group row">
61            <label class="col-sm-3 col-form-label wt-page-options-label" for="CHIL<?= e($n) ?>">
62                <?php if ($child !== null && $child->sex() === 'M') : ?>
63                    <?= I18N::translate('Son') ?>
64                <?php elseif ($child !== null && $child->sex() === 'F') : ?>
65                    <?= I18N::translate('Daughter') ?>
66                <?php else : ?>
67                    <?= I18N::translate('Child') ?>
68                <?php endif ?>
69            </label>
70            <div class="col-sm-9 wt-page-options-value">
71                <?= view('components/select-individual', ['name' => 'CHIL[]', 'id' => 'CHIL' . $n, 'individual' => $child, 'tree' => $tree]) ?>
72            </div>
73        </div>
74    <?php endforeach ?>
75
76    <div class="form-group row">
77        <label class="col-sm-3 col-form-label wt-page-options-label" for="CHIL<?= e(count($children) + 1) ?>">
78            <?= I18N::translate('Child') ?>
79        </label>
80        <div class="col-sm-9 wt-page-options-value">
81            <?= view('components/select-individual', ['name' => 'CHIL[]', 'id' => 'CHIL' . (count($children) + 1), 'tree' => $tree]) ?>
82        </div>
83    </div>
84
85    <div class="form-group row">
86        <div class="col-sm-3 wt-page-options-label">
87        </div>
88        <div class="col-sm-9 wt-page-options-value">
89            <button class="btn btn-primary" type="submit">
90                <?= view('icons/save') ?>
91                <?= /* I18N: A button label. */
92                I18N::translate('save') ?>
93            </button>
94            <a class="btn btn-secondary" href="<?= e($family->url()) ?>">
95                <?= view('icons/cancel') ?>
96                <?= /* I18N: A button label. */
97                I18N::translate('cancel') ?>
98            </a>
99        </div>
100    </div>
101</form>
102