xref: /webtrees/resources/views/family-page-children.phtml (revision 10e0649788c8d7d4974d81c048ca2b225df8f22e)
117dd427eSGreg Roach<?php
217dd427eSGreg Roach
3*10e06497SGreg Roachdeclare(strict_types=1);
4*10e06497SGreg Roach
57c2c99faSGreg Roachuse Fisharebest\Webtrees\Family;
67c7d1e03SGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\AddChildToFamilyPage;
75229eadeSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\ReorderChildrenPage;
817dd427eSGreg Roachuse Fisharebest\Webtrees\I18N;
917dd427eSGreg Roach
107c2c99faSGreg Roach/**
117c2c99faSGreg Roach * @var Family $family
127c2c99faSGreg Roach */
137c2c99faSGreg Roach
1417dd427eSGreg Roach?>
1517dd427eSGreg Roach
1617dd427eSGreg Roach<div class="align-self-center">
174ab569c4SGreg Roach    <div class="badge bg-secondary m-2">
1817dd427eSGreg Roach        <?php if ($family->children()->count() === 0) : ?>
1917dd427eSGreg Roach            <?= I18N::translate('No children') ?>
2017dd427eSGreg Roach        <?php else : ?>
2117dd427eSGreg Roach            <?= I18N::plural('%s child', '%s children', $family->children()->count(), I18N::number($family->children()->count())) ?>
2217dd427eSGreg Roach        <?php endif ?>
2317dd427eSGreg Roach    </div>
2417dd427eSGreg Roach    <?php foreach ($family->children() as $n => $child) : ?>
2517dd427eSGreg Roach        <div class="d-flex">
2617dd427eSGreg Roach            <?= view('chart-box', ['individual' => $child]) ?>
2717dd427eSGreg Roach            <div class="wt-chart-horizontal-spacer">
2817dd427eSGreg Roach                <?php if ($family->children()->count() === 1) : ?>
2917dd427eSGreg Roach                    <div class="wt-chart-horizontal-line"></div>
3017dd427eSGreg Roach                <?php elseif ($n === 0) : ?>
3117dd427eSGreg Roach                    <div class="wt-chart-horizontal-first-child"></div>
3217dd427eSGreg Roach                <?php elseif ($n + 1 === $family->children()->count()) : ?>
3317dd427eSGreg Roach                    <div class="wt-chart-horizontal-last-child"></div>
3417dd427eSGreg Roach                <?php else : ?>
3517dd427eSGreg Roach                    <div class="wt-chart-horizontal-middle-child"><div class="wt-chart-horizontal-line"></div></div>
3617dd427eSGreg Roach                <?php endif ?>
3717dd427eSGreg Roach            </div>
3817dd427eSGreg Roach        </div>
3917dd427eSGreg Roach    <?php endforeach ?>
400d55b628SGreg Roach    <?php if ($family->canEdit()) : ?>
4117dd427eSGreg Roach        <div class="wt-chart-box">
42efd4768bSGreg Roach            <a class="btn btn-link" href="<?= e(route(AddChildToFamilyPage::class, ['tree' => $family->tree()->name(), 'xref' => $family->xref(), 'sex' => 'M'])) ?>">
435eca9df6SGreg Roach                <?= I18N::translate('Add a son') ?>
445eca9df6SGreg Roach            </a>
455eca9df6SGreg Roach            |
46efd4768bSGreg Roach            <a class="btn btn-link" href="<?= e(route(AddChildToFamilyPage::class, ['tree' => $family->tree()->name(), 'xref' => $family->xref(), 'sex' => 'F'])) ?>">
475eca9df6SGreg Roach                <?= I18N::translate('Add a daughter') ?>
4817dd427eSGreg Roach            </a>
4917dd427eSGreg Roach            <br>
5017dd427eSGreg Roach            <?php if ($family->numberOfChildren() > 1) : ?>
515229eadeSGreg Roach                <a class="btn btn-link" href="<?= e(route(ReorderChildrenPage::class, ['tree' => $family->tree()->name(), 'xref' => $family->xref()])) ?>">
5217dd427eSGreg Roach                    <?= I18N::translate('Re-order children') ?>
5317dd427eSGreg Roach                </a>
5417dd427eSGreg Roach            <?php endif ?>
5517dd427eSGreg Roach        </div>
560d55b628SGreg Roach    <?php endif ?>
5717dd427eSGreg Roach</div>
5817dd427eSGreg Roach<?php if ($family->children()->count() !== 1) : ?>
5917dd427eSGreg Roach    <div class="wt-chart-horizontal-spacer">
6017dd427eSGreg Roach        <div class="wt-chart-horizontal-line"></div>
6117dd427eSGreg Roach    </div>
6217dd427eSGreg Roach<?php endif ?>
63