summaryrefslogtreecommitdiff
path: root/resources/views/family-page-children.phtml
blob: 73aeb2e35a85aed617714942ae0ef17c6edd4ff8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php

use Fisharebest\Webtrees\Http\RequestHandlers\ReorderChildrenPage;
use Fisharebest\Webtrees\I18N;

?>

<div class="align-self-center">
    <div class="badge badge-secondary m-2">
        <?php if ($family->children()->count() === 0): ?>
            <?= I18N::translate('No children') ?>
        <?php else: ?>
            <?= I18N::plural('%s child', '%s children', $family->children()->count(), I18N::number($family->children()->count())) ?>
        <?php endif ?>
    </div>
    <?php foreach ($family->children() as $n => $child): ?>
        <div class="d-flex">
            <?= view('chart-box', ['individual' => $child]) ?>
            <div class="wt-chart-horizontal-spacer">
                <?php if ($family->children()->count() === 1): ?>
                    <div class="wt-chart-horizontal-line"></div>
                <?php elseif ($n === 0): ?>
                    <div class="wt-chart-horizontal-first-child"></div>
                <?php elseif ($n + 1 === $family->children()->count()): ?>
                    <div class="wt-chart-horizontal-last-child"></div>
                <?php else: ?>
                    <div class="wt-chart-horizontal-middle-child"><div class="wt-chart-horizontal-line"></div></div>
                <?php endif ?>
            </div>
        </div>
    <?php endforeach ?>
    <?php if ($family->canEdit()): ?>
        <div class="wt-chart-box">
            <a class="btn btn-link" href="<?= e(route('add-child-to-family', ['gender' => 'U', 'tree' => $family->tree()->name(), 'xref' => $family->xref()])) ?>">
                <?= I18N::translate('Add a child') ?>
            </a>
            <br>
            <?php if ($family->numberOfChildren() > 1) : ?>
                <a class="btn btn-link" href="<?= e(route(ReorderChildrenPage::class, ['tree' => $family->tree()->name(), 'xref' => $family->xref()])) ?>">
                    <?= I18N::translate('Re-order children') ?>
                </a>
            <?php endif ?>
        </div>
    <?php endif ?>
</div>
<?php if ($family->children()->count() !== 1): ?>
    <div class="wt-chart-horizontal-spacer">
        <div class="wt-chart-horizontal-line"></div>
    </div>
<?php endif ?>