xref: /webtrees/resources/views/family-page-children.phtml (revision 9f1f531b76be8d725214b03940bdee3674b55e88)
1<?php
2
3use Fisharebest\Webtrees\Http\RequestHandlers\ReorderChildrenPage;
4use Fisharebest\Webtrees\I18N;
5
6?>
7
8<div class="align-self-center">
9    <div class="badge badge-secondary m-2">
10        <?php if ($family->children()->count() === 0) : ?>
11            <?= I18N::translate('No children') ?>
12        <?php else : ?>
13            <?= I18N::plural('%s child', '%s children', $family->children()->count(), I18N::number($family->children()->count())) ?>
14        <?php endif ?>
15    </div>
16    <?php foreach ($family->children() as $n => $child) : ?>
17        <div class="d-flex">
18            <?= view('chart-box', ['individual' => $child]) ?>
19            <div class="wt-chart-horizontal-spacer">
20                <?php if ($family->children()->count() === 1) : ?>
21                    <div class="wt-chart-horizontal-line"></div>
22                <?php elseif ($n === 0) : ?>
23                    <div class="wt-chart-horizontal-first-child"></div>
24                <?php elseif ($n + 1 === $family->children()->count()) : ?>
25                    <div class="wt-chart-horizontal-last-child"></div>
26                <?php else : ?>
27                    <div class="wt-chart-horizontal-middle-child"><div class="wt-chart-horizontal-line"></div></div>
28                <?php endif ?>
29            </div>
30        </div>
31    <?php endforeach ?>
32    <?php if ($family->canEdit()) : ?>
33        <div class="wt-chart-box">
34            <a class="btn btn-link" href="<?= e(route('add-child-to-family', ['gender' => 'M', 'tree' => $family->tree()->name(), 'xref' => $family->xref()])) ?>">
35                <?= I18N::translate('Add a son') ?>
36            </a>
37            |
38            <a class="btn btn-link" href="<?= e(route('add-child-to-family', ['gender' => 'F', 'tree' => $family->tree()->name(), 'xref' => $family->xref()])) ?>">
39                <?= I18N::translate('Add a daughter') ?>
40            </a>
41            <br>
42            <?php if ($family->numberOfChildren() > 1) : ?>
43                <a class="btn btn-link" href="<?= e(route(ReorderChildrenPage::class, ['tree' => $family->tree()->name(), 'xref' => $family->xref()])) ?>">
44                    <?= I18N::translate('Re-order children') ?>
45                </a>
46            <?php endif ?>
47        </div>
48    <?php endif ?>
49</div>
50<?php if ($family->children()->count() !== 1) : ?>
51    <div class="wt-chart-horizontal-spacer">
52        <div class="wt-chart-horizontal-line"></div>
53    </div>
54<?php endif ?>
55