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