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