xref: /webtrees/resources/views/modules/hourglass-chart/children.phtml (revision d70512ab02636ee884ef6d7907223ed02c754ff5)
1cb0eb4a9SGreg Roach<?php
2cb0eb4a9SGreg Roach
3cb0eb4a9SGreg Roachuse Fisharebest\Webtrees\Family;
4cb0eb4a9SGreg Roachuse Illuminate\Support\Collection;
5cb0eb4a9SGreg Roach
6cb0eb4a9SGreg Roach/**
7cb0eb4a9SGreg Roach * @var Collection $children
8cb0eb4a9SGreg Roach * @var int        $generations
971378461SGreg Roach * @var bool       $spouses
10cb0eb4a9SGreg Roach */
11cb0eb4a9SGreg Roach
12cb0eb4a9SGreg Roach?>
13cb0eb4a9SGreg Roach<div class="align-self-center">
14cb0eb4a9SGreg Roach    <?php foreach ($children as $n => $child) : ?>
15*d70512abSGreg Roach        <?php $grandchildren = $child->spouseFamilies()->map(static function (Family $family): Collection {
16*d70512abSGreg Roach    return $family->children();
17*d70512abSGreg Roach        })->flatten() ?>
18cb0eb4a9SGreg Roach        <div class="d-flex justify-content-end">
19cb0eb4a9SGreg Roach            <?php if ($grandchildren->isNotEmpty()) : ?>
20cb0eb4a9SGreg Roach                <?php if ($generations > 1) : ?>
2171378461SGreg Roach                    <?= view('modules/hourglass-chart/children', ['children' => $grandchildren, 'generations' => $generations - 1, 'spouses' => $spouses]) ?>
22cb0eb4a9SGreg Roach                <?php else : ?>
23cb0eb4a9SGreg Roach                    <div class="d-flex align-self-center">
24d72b284aSGreg Roach                        <div class="hourglass-arrow" data-xref="<?= route('module', ['module' => 'hourglass_chart', 'action' => 'Descendants', 'xref' => $child->xref(), 'tree' => $child->tree()->name(), 'spouses' => $spouses]) ?>">
25cb0eb4a9SGreg Roach                            <?= view('icons/arrow-left') ?>
26cb0eb4a9SGreg Roach                        </div>
27cb0eb4a9SGreg Roach                    </div>
28cb0eb4a9SGreg Roach                <?php endif ?>
29cb0eb4a9SGreg Roach            <?php endif ?>
30cb0eb4a9SGreg Roach            <div class="align-self-center">
3171378461SGreg Roach                <?php if ($spouses) : ?>
32cb0eb4a9SGreg Roach                    <div>&nbsp;</div>
33cb0eb4a9SGreg Roach                <?php endif ?>
34cb0eb4a9SGreg Roach                <?= view('chart-box', ['individual' => $child]) ?>
3571378461SGreg Roach                <?php if ($spouses) : ?>
36cb0eb4a9SGreg Roach                    <?php foreach ($child->spouseFamilies() as $spouse_family) : ?>
37cb0eb4a9SGreg Roach                        <?= view('chart-box', ['individual' => $spouse_family->spouse($child)]) ?>
38cb0eb4a9SGreg Roach                    <?php endforeach ?>
39cb0eb4a9SGreg Roach                    <div>&nbsp;</div>
40b332fbfeSGreg Roach                <?php endif ?>
41cb0eb4a9SGreg Roach            </div>
42cb0eb4a9SGreg Roach            <div class="wt-chart-horizontal-spacer">
43cb0eb4a9SGreg Roach                <?php if ($children->count() === 1) : ?>
44cb0eb4a9SGreg Roach                    <div class="wt-chart-horizontal-line"></div>
45cb0eb4a9SGreg Roach                <?php elseif ($n === 0) : ?>
46cb0eb4a9SGreg Roach                    <div class="wt-chart-horizontal-first-child"></div>
47cb0eb4a9SGreg Roach                <?php elseif ($n + 1 === $children->count()) : ?>
48cb0eb4a9SGreg Roach                    <div class="wt-chart-horizontal-last-child"></div>
49cb0eb4a9SGreg Roach                <?php else : ?>
50cb0eb4a9SGreg Roach                    <div class="wt-chart-horizontal-middle-child">
51cb0eb4a9SGreg Roach                        <div class="wt-chart-horizontal-line"></div>
52cb0eb4a9SGreg Roach                    </div>
53cb0eb4a9SGreg Roach                <?php endif ?>
54cb0eb4a9SGreg Roach            </div>
55cb0eb4a9SGreg Roach        </div>
56cb0eb4a9SGreg Roach    <?php endforeach ?>
57cb0eb4a9SGreg Roach</div>
58cb0eb4a9SGreg Roach
59cb0eb4a9SGreg Roach<?php if ($children->count() > 0) : ?>
60cb0eb4a9SGreg Roach    <div class="wt-chart-horizontal-spacer">
61cb0eb4a9SGreg Roach        <div class="wt-chart-horizontal-line"></div>
62cb0eb4a9SGreg Roach    </div>
63cb0eb4a9SGreg Roach<?php endif ?>
64