xref: /webtrees/resources/views/family-page-children.phtml (revision f60bdb82d4dd2cd0b37ee9598ec6e772e3935798)
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' => 'U', 'tree' => $family->tree()->name(), 'xref' => $family->xref()])) ?>">
35                <?= I18N::translate('Add a child') ?>
36            </a>
37            <br>
38            <?php if ($family->numberOfChildren() > 1) : ?>
39                <a class="btn btn-link" href="<?= e(route(ReorderChildrenPage::class, ['tree' => $family->tree()->name(), 'xref' => $family->xref()])) ?>">
40                    <?= I18N::translate('Re-order children') ?>
41                </a>
42            <?php endif ?>
43        </div>
44    <?php endif ?>
45</div>
46<?php if ($family->children()->count() !== 1): ?>
47    <div class="wt-chart-horizontal-spacer">
48        <div class="wt-chart-horizontal-line"></div>
49    </div>
50<?php endif ?>
51