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