xref: /webtrees/resources/views/family-page-children.phtml (revision 5229eade2a8cdd1381e19f96f67fc1c8b92ca95d)
117dd427eSGreg Roach<?php
217dd427eSGreg Roach
3*5229eadeSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\ReorderChildrenPage;
417dd427eSGreg Roachuse Fisharebest\Webtrees\I18N;
517dd427eSGreg Roach
617dd427eSGreg Roach?>
717dd427eSGreg Roach
817dd427eSGreg Roach<div class="align-self-center">
917dd427eSGreg Roach    <div class="badge badge-secondary m-2">
1017dd427eSGreg Roach        <?php if ($family->children()->count() === 0): ?>
1117dd427eSGreg Roach            <?= I18N::translate('No children') ?>
1217dd427eSGreg Roach        <?php else: ?>
1317dd427eSGreg Roach            <?= I18N::plural('%s child', '%s children', $family->children()->count(), I18N::number($family->children()->count())) ?>
1417dd427eSGreg Roach        <?php endif ?>
1517dd427eSGreg Roach    </div>
1617dd427eSGreg Roach    <?php foreach ($family->children() as $n => $child): ?>
1717dd427eSGreg Roach        <div class="d-flex">
1817dd427eSGreg Roach            <?= view('chart-box', ['individual' => $child]) ?>
1917dd427eSGreg Roach            <div class="wt-chart-horizontal-spacer">
2017dd427eSGreg Roach                <?php if ($family->children()->count() === 1): ?>
2117dd427eSGreg Roach                    <div class="wt-chart-horizontal-line"></div>
2217dd427eSGreg Roach                <?php elseif ($n === 0): ?>
2317dd427eSGreg Roach                    <div class="wt-chart-horizontal-first-child"></div>
2417dd427eSGreg Roach                <?php elseif ($n + 1 === $family->children()->count()): ?>
2517dd427eSGreg Roach                    <div class="wt-chart-horizontal-last-child"></div>
2617dd427eSGreg Roach                <?php else: ?>
2717dd427eSGreg Roach                    <div class="wt-chart-horizontal-middle-child"><div class="wt-chart-horizontal-line"></div></div>
2817dd427eSGreg Roach                <?php endif ?>
2917dd427eSGreg Roach            </div>
3017dd427eSGreg Roach        </div>
3117dd427eSGreg Roach    <?php endforeach ?>
320d55b628SGreg Roach    <?php if ($family->canEdit()): ?>
3317dd427eSGreg Roach        <div class="wt-chart-box">
34d72b284aSGreg Roach            <a class="btn btn-link" href="<?= e(route('add-child-to-family', ['gender' => 'U', 'tree' => $family->tree()->name(), 'xref' => $family->xref()])) ?>">
3517dd427eSGreg Roach                <?= I18N::translate('Add a child') ?>
3617dd427eSGreg Roach            </a>
3717dd427eSGreg Roach            <br>
3817dd427eSGreg Roach            <?php if ($family->numberOfChildren() > 1) : ?>
39*5229eadeSGreg Roach                <a class="btn btn-link" href="<?= e(route(ReorderChildrenPage::class, ['tree' => $family->tree()->name(), 'xref' => $family->xref()])) ?>">
4017dd427eSGreg Roach                    <?= I18N::translate('Re-order children') ?>
4117dd427eSGreg Roach                </a>
4217dd427eSGreg Roach            <?php endif ?>
4317dd427eSGreg Roach        </div>
440d55b628SGreg Roach    <?php endif ?>
4517dd427eSGreg Roach</div>
4617dd427eSGreg Roach<?php if ($family->children()->count() !== 1): ?>
4717dd427eSGreg Roach    <div class="wt-chart-horizontal-spacer">
4817dd427eSGreg Roach        <div class="wt-chart-horizontal-line"></div>
4917dd427eSGreg Roach    </div>
5017dd427eSGreg Roach<?php endif ?>
51