xref: /webtrees/resources/views/family-page-children.phtml (revision efd4768b0eab1f325771cdbc6181ff84f85f2149)
117dd427eSGreg Roach<?php
217dd427eSGreg Roach
37c2c99faSGreg Roachuse Fisharebest\Webtrees\Family;
47c7d1e03SGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\AddChildToFamilyPage;
55229eadeSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\ReorderChildrenPage;
617dd427eSGreg Roachuse Fisharebest\Webtrees\I18N;
717dd427eSGreg Roach
87c2c99faSGreg Roach/**
97c2c99faSGreg Roach * @var Family $family
107c2c99faSGreg Roach */
117c2c99faSGreg Roach
1217dd427eSGreg Roach?>
1317dd427eSGreg Roach
1417dd427eSGreg Roach<div class="align-self-center">
1517dd427eSGreg Roach    <div class="badge badge-secondary m-2">
1617dd427eSGreg Roach        <?php if ($family->children()->count() === 0) : ?>
1717dd427eSGreg Roach            <?= I18N::translate('No children') ?>
1817dd427eSGreg Roach        <?php else : ?>
1917dd427eSGreg Roach            <?= I18N::plural('%s child', '%s children', $family->children()->count(), I18N::number($family->children()->count())) ?>
2017dd427eSGreg Roach        <?php endif ?>
2117dd427eSGreg Roach    </div>
2217dd427eSGreg Roach    <?php foreach ($family->children() as $n => $child) : ?>
2317dd427eSGreg Roach        <div class="d-flex">
2417dd427eSGreg Roach            <?= view('chart-box', ['individual' => $child]) ?>
2517dd427eSGreg Roach            <div class="wt-chart-horizontal-spacer">
2617dd427eSGreg Roach                <?php if ($family->children()->count() === 1) : ?>
2717dd427eSGreg Roach                    <div class="wt-chart-horizontal-line"></div>
2817dd427eSGreg Roach                <?php elseif ($n === 0) : ?>
2917dd427eSGreg Roach                    <div class="wt-chart-horizontal-first-child"></div>
3017dd427eSGreg Roach                <?php elseif ($n + 1 === $family->children()->count()) : ?>
3117dd427eSGreg Roach                    <div class="wt-chart-horizontal-last-child"></div>
3217dd427eSGreg Roach                <?php else : ?>
3317dd427eSGreg Roach                    <div class="wt-chart-horizontal-middle-child"><div class="wt-chart-horizontal-line"></div></div>
3417dd427eSGreg Roach                <?php endif ?>
3517dd427eSGreg Roach            </div>
3617dd427eSGreg Roach        </div>
3717dd427eSGreg Roach    <?php endforeach ?>
380d55b628SGreg Roach    <?php if ($family->canEdit()) : ?>
3917dd427eSGreg Roach        <div class="wt-chart-box">
40*efd4768bSGreg Roach            <a class="btn btn-link" href="<?= e(route(AddChildToFamilyPage::class, ['tree' => $family->tree()->name(), 'xref' => $family->xref(), 'sex' => 'M'])) ?>">
415eca9df6SGreg Roach                <?= I18N::translate('Add a son') ?>
425eca9df6SGreg Roach            </a>
435eca9df6SGreg Roach            |
44*efd4768bSGreg Roach            <a class="btn btn-link" href="<?= e(route(AddChildToFamilyPage::class, ['tree' => $family->tree()->name(), 'xref' => $family->xref(), 'sex' => 'F'])) ?>">
455eca9df6SGreg Roach                <?= I18N::translate('Add a daughter') ?>
4617dd427eSGreg Roach            </a>
4717dd427eSGreg Roach            <br>
4817dd427eSGreg Roach            <?php if ($family->numberOfChildren() > 1) : ?>
495229eadeSGreg Roach                <a class="btn btn-link" href="<?= e(route(ReorderChildrenPage::class, ['tree' => $family->tree()->name(), 'xref' => $family->xref()])) ?>">
5017dd427eSGreg Roach                    <?= I18N::translate('Re-order children') ?>
5117dd427eSGreg Roach                </a>
5217dd427eSGreg Roach            <?php endif ?>
5317dd427eSGreg Roach        </div>
540d55b628SGreg Roach    <?php endif ?>
5517dd427eSGreg Roach</div>
5617dd427eSGreg Roach<?php if ($family->children()->count() !== 1) : ?>
5717dd427eSGreg Roach    <div class="wt-chart-horizontal-spacer">
5817dd427eSGreg Roach        <div class="wt-chart-horizontal-line"></div>
5917dd427eSGreg Roach    </div>
6017dd427eSGreg Roach<?php endif ?>
61