xref: /webtrees/resources/views/family-page.phtml (revision ad3143cc1f5191f21ec566a4ccc46aa1a5e4f909)
1<?php
2
3use Fisharebest\Webtrees\Auth;
4use Fisharebest\Webtrees\Fact;
5use Fisharebest\Webtrees\Family;
6use Fisharebest\Webtrees\Functions\FunctionsPrint;
7use Fisharebest\Webtrees\Functions\FunctionsPrintFacts;
8use Fisharebest\Webtrees\Http\RequestHandlers\AddNewFact;
9use Fisharebest\Webtrees\I18N;
10use Illuminate\Support\Collection;
11
12/**
13 * @var Collection<Fact> $clipboard_facts
14 * @var Collection<Fact> $facts
15 * @var Family           $record
16 */
17
18?>
19
20<?= view('family-page-pending', ['record' => $record]) ?>
21
22<div class="d-flex mb-4">
23    <h2 class="wt-page-title mx-auto">
24        <?= $record->fullName() ?>
25    </h2>
26    <?php if ($record->canEdit()) : ?>
27        <?= view('family-page-menu', ['clipboard_facts' => $clipboard_facts, 'record' => $record]) ?>
28    <?php endif ?>
29</div>
30
31<div class="wt-page-content">
32    <div class="wt-family-members d-flex">
33        <?= view('family-page-children', ['family' => $record]) ?>
34        <?= view('family-page-parents', ['family' => $record]) ?>
35    </div>
36
37    <h3 class="mt-4"><?= I18N::translate('Facts and events') ?></h3>
38    <table class="table wt-facts-table">
39        <?php if ($facts->isEmpty()) : ?>
40            <tr>
41                <td colspan="2">
42                    <?= I18N::translate('No facts exist for this family.') ?>
43                </td>
44            </tr>
45        <?php else : ?>
46            <?php foreach ($facts as $fact) : ?>
47                <?php FunctionsPrintFacts::printFact($fact, $record) ?>
48            <?php endforeach ?>
49        <?php endif ?>
50
51        <?php if (Auth::isEditor($record->tree())) : ?>
52            <?php FunctionsPrint::printAddNewFact($record) ?>
53            <tr>
54                <th scope="row">
55                    <?= I18N::translate('Note') ?>
56                </th>
57                <td>
58                    <a href="<?= e(route(AddNewFact::class, ['tree' => $record->tree()->name(), 'xref' => $record->xref(), 'fact' => 'NOTE'])) ?>">
59                        <?= I18N::translate('Add a note') ?>
60                    </a>
61                </td>
62            </tr>
63
64            <?php if ($record->tree()->getPreference('MEDIA_UPLOAD') >= Auth::accessLevel($record->tree())) : ?>
65                <tr>
66                    <th scope="row">
67                        <?= I18N::translate('Media object') ?>
68                    </th>
69                    <td>
70                        <a href="<?= e(route(AddNewFact::class, ['tree' => $record->tree()->name(), 'xref' => $record->xref(), 'fact' => 'OBJE'])) ?>">
71                            <?= I18N::translate('Add a media object') ?>
72                        </a>
73                    </td>
74                </tr>
75            <?php endif ?>
76
77            <tr>
78                <th scope="row">
79                    <?= I18N::translate('Source') ?>
80                </th>
81                <td>
82                    <a href="<?= e(route(AddNewFact::class, ['tree' => $record->tree()->name(), 'xref' => $record->xref(), 'fact' => 'SOUR'])) ?>">
83                        <?= I18N::translate('Add a source citation') ?>
84                    </a>
85                </td>
86            </tr>
87        <?php endif ?>
88    </table>
89</div>
90
91<?= view('modals/ajax') ?>
92