<?php

use Fisharebest\Webtrees\Family;

/**
 * @var Family|null $family
 * @var int         $generations
 */

?>
<div class="d-flex">
    <div class="align-self-center">
        <div class="d-flex">
            <div class="wt-chart-horizontal-spacer">
                <div class="wt-chart-horizontal-first-parent"></div>
            </div>

            <div class="align-self-center">
                <?= view('chart-box', ['individual' => $family ? $family->husband() : null]) ?>
            </div>

            <?php if ($generations > 1) : ?>
                <div class="wt-chart-horizontal-spacer">
                    <div class="wt-chart-horizontal-line"></div>
                </div>

                <?= view('modules/family-book-chart/parents', ['family' => $family && $family->husband() ? $family->husband()->childFamilies()->first() : null, 'generations' => $generations - 1]) ?>
            <?php endif ?>
        </div>

        <div class="d-flex">
            <div class="wt-chart-horizontal-spacer">
                <div class="wt-chart-horizontal-last-parent"></div>
            </div>

            <div class="align-self-center">
                <?= view('chart-box', ['individual' => $family ? $family->wife() : null ]) ?>
            </div>

            <?php if ($generations > 1) : ?>
                <div class="wt-chart-horizontal-spacer">
                    <div class="wt-chart-horizontal-line"></div>
                </div>

                <?= view('modules/family-book-chart/parents', ['family' => $family && $family->wife() ? $family->wife()->childFamilies()->first() : null, 'generations' => $generations - 1]) ?>
            <?php endif ?>
        </div>
    </div>
</div>

