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