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