xref: /webtrees/resources/views/family-page-grandparents.phtml (revision b11cdcd45131b1585d66693fab363cfeb18c51a4)
1<?php
2
3declare(strict_types=1);
4
5use Fisharebest\Webtrees\Family;
6use Fisharebest\Webtrees\Http\RequestHandlers\AddParentToIndividualPage;
7use Fisharebest\Webtrees\Http\RequestHandlers\AddSpouseToFamilyPage;
8use Fisharebest\Webtrees\I18N;
9use Fisharebest\Webtrees\Individual;
10
11/**
12 * @var Family          $family
13 * @var Individual|null $individual
14 * @var Family|null     $parent_family
15 */
16
17?>
18
19<div class="d-flex my-2">
20    <div class="wt-chart-horizontal-spacer">
21        <div class="wt-chart-horizontal-line"></div>
22    </div>
23    <div class="align-self-center">
24        <div class="d-flex">
25            <div class="wt-chart-horizontal-spacer">
26                <div class="wt-chart-horizontal-first-parent"></div>
27            </div>
28
29            <div class="align-self-center">
30                <?php if ($individual === null) : ?>
31                    <?= view('chart-box', ['individual' => null]) ?>
32                <?php elseif ($parent_family === null) : ?>
33                    <div class="wt-chart-box wt-chart-box-m">
34                        <?php if ($individual->canEdit()) : ?>
35                            <a class="btn btn-link" href="<?= e(route(AddParentToIndividualPage::class, ['tree' => $individual->tree()->name(), 'xref' => $individual->xref(), 'sex' => 'M', 'url' => $family->url()])) ?>">
36                                <?= I18N::translate('Add a father') ?>
37                            </a>
38                        <?php endif ?>
39                    </div>
40                <?php elseif ($parent_family->husband() === null) : ?>
41                    <div class="wt-chart-box wt-chart-box-m">
42                        <?php if ($parent_family->canEdit()) : ?>
43                            <a class="btn btn-link" href="<?= e(route(AddSpouseToFamilyPage::class, ['tree' => $parent_family->tree()->name(), 'xref' => $parent_family->xref(), 'sex' => 'M', 'url' => $family->url()])) ?>">
44                                <?= I18N::translate('Add a father') ?>
45                            </a>
46                        <?php endif ?>
47                    </div>
48                <?php else : ?>
49                    <?= view('chart-box', ['individual' => $parent_family->husband()]) ?>
50                <?php endif ?>
51            </div>
52        </div>
53
54        <div class="d-flex">
55            <div class="wt-chart-horizontal-spacer">
56                <div class="wt-chart-horizontal-last-parent"></div>
57            </div>
58
59            <div class="align-self-center">
60                <?php if ($individual === null) : ?>
61                    <?= view('chart-box', ['individual' => null]) ?>
62                <?php elseif ($parent_family === null) : ?>
63                    <div class="wt-chart-box wt-chart-box-f">
64                        <?php if ($individual->canEdit()) : ?>
65                            <a class="btn btn-link" href="<?= e(route(AddParentToIndividualPage::class, ['tree' => $individual->tree()->name(), 'xref' => $individual->xref(), 'sex' => 'F', 'url' => $family->url()])) ?>">
66                                <?= I18N::translate('Add a mother') ?>
67                            </a>
68                        <?php endif ?>
69                    </div>
70                <?php elseif ($parent_family->wife() === null) : ?>
71                    <div class="wt-chart-box wt-chart-box-f">
72                        <?php if ($parent_family->canEdit()) : ?>
73                            <a class="btn btn-link" href="<?= e(route(AddSpouseToFamilyPage::class, ['tree' => $parent_family->tree()->name(), 'xref' => $parent_family->xref(), 'sex' => 'F', 'url' => $family->url()])) ?>">
74                                <?= I18N::translate('Add a mother') ?>
75                            </a>
76                        <?php endif ?>
77                    </div>
78                <?php else : ?>
79                    <?= view('chart-box', ['individual' => $parent_family->wife()]) ?>
80                <?php endif ?>
81            </div>
82        </div>
83    </div>
84    <?php if ($parent_family !== null) : ?>
85        <div class="align-self-center">
86            <a class="btn btn-text" href="<?= e($parent_family->url()) ?>" title="<?= strip_tags($parent_family->fullName()) ?>">
87                <?= view('icons/arrow-right') ?>
88            </a>
89        </div>
90    <?php endif ?>
91</div>
92
93