xref: /webtrees/resources/views/family-page-children.phtml (revision 5eca9df651f3259e62aaeeb88bffc96727bbb8d7)
117dd427eSGreg Roach<?php
217dd427eSGreg Roach
35229eadeSGreg 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">
34*5eca9df6SGreg Roach            <a class="btn btn-link" href="<?= e(route('add-child-to-family', ['gender' => 'M', 'tree' => $family->tree()->name(), 'xref' => $family->xref()])) ?>">
35*5eca9df6SGreg Roach                <?= I18N::translate('Add a son') ?>
36*5eca9df6SGreg Roach            </a>
37*5eca9df6SGreg Roach            |
38*5eca9df6SGreg Roach            <a class="btn btn-link" href="<?= e(route('add-child-to-family', ['gender' => 'F', 'tree' => $family->tree()->name(), 'xref' => $family->xref()])) ?>">
39*5eca9df6SGreg Roach                <?= I18N::translate('Add a daughter') ?>
4017dd427eSGreg Roach            </a>
4117dd427eSGreg Roach            <br>
4217dd427eSGreg Roach            <?php if ($family->numberOfChildren() > 1) : ?>
435229eadeSGreg Roach                <a class="btn btn-link" href="<?= e(route(ReorderChildrenPage::class, ['tree' => $family->tree()->name(), 'xref' => $family->xref()])) ?>">
4417dd427eSGreg Roach                    <?= I18N::translate('Re-order children') ?>
4517dd427eSGreg Roach                </a>
4617dd427eSGreg Roach            <?php endif ?>
4717dd427eSGreg Roach        </div>
480d55b628SGreg Roach    <?php endif ?>
4917dd427eSGreg Roach</div>
5017dd427eSGreg Roach<?php if ($family->children()->count() !== 1) : ?>
5117dd427eSGreg Roach    <div class="wt-chart-horizontal-spacer">
5217dd427eSGreg Roach        <div class="wt-chart-horizontal-line"></div>
5317dd427eSGreg Roach    </div>
5417dd427eSGreg Roach<?php endif ?>
55