xref: /webtrees/resources/views/family-page.phtml (revision 7c2c99fad7cacd17c98be88238ff735d82c6351b)
117dd427eSGreg Roach<?php
217dd427eSGreg Roach
317dd427eSGreg Roachuse Fisharebest\Webtrees\Auth;
4*7c2c99faSGreg Roachuse Fisharebest\Webtrees\Fact;
502467d32SGreg Roachuse Fisharebest\Webtrees\Family;
617dd427eSGreg Roachuse Fisharebest\Webtrees\Functions\FunctionsPrint;
717dd427eSGreg Roachuse Fisharebest\Webtrees\Functions\FunctionsPrintFacts;
82917771cSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\AddNewFact;
922e73debSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\PendingChangesAcceptRecord;
1022e73debSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\PendingChangesRejectRecord;
1117dd427eSGreg Roachuse Fisharebest\Webtrees\I18N;
12*7c2c99faSGreg Roachuse Illuminate\Support\Collection;
13*7c2c99faSGreg Roach
14*7c2c99faSGreg Roach/**
15*7c2c99faSGreg Roach * @var Collection<Fact> $clipboard_facts
16*7c2c99faSGreg Roach * @var Collection<Fact> $facts
17*7c2c99faSGreg Roach * @var Family           $record
18*7c2c99faSGreg Roach */
1917dd427eSGreg Roach
2017dd427eSGreg Roach?>
21dd6b2bfcSGreg Roach
22dd6b2bfcSGreg Roach<?php if ($record->isPendingDeletion()) : ?>
23f4afa648SGreg Roach    <?php if (Auth::isModerator($record->tree())) : ?>
240973b4d2SGreg Roach        <?= view('components/alert-warning-dismissible', ['alert' => /* I18N: %1$s is “accept”, %2$s is “reject”. These are links. */ I18N::translate('This family has been deleted. You should review the deletion and then %1$s or %2$s it.', '<a href="#" class="alert-link" data-post-url="' . e(route(PendingChangesAcceptRecord::class, ['tree' => $record->tree()->name(), 'xref' => $record->xref()])) . '">' . I18N::translateContext('You should review the deletion and then accept or reject it.', 'accept') . '</a>', '<a href="#" class="alert-link" data-post-url="' . e(route(PendingChangesRejectRecord::class, ['tree' => $record->tree()->name(), 'xref' => $record->xref()])) . '">' . I18N::translateContext('You should review the deletion and then accept or reject it.', 'reject') . '</a>') . ' ' . view('help/link', ['topic' => 'pending_changes'])]) ?>
25f4afa648SGreg Roach    <?php elseif (Auth::isEditor($record->tree())) : ?>
260973b4d2SGreg Roach        <?= view('components/alert-warning-dismissible', ['alert' => I18N::translate('This family has been deleted. The deletion will need to be reviewed by a moderator.') . ' ' . view('help/link', ['topic' => 'pending_changes'])]) ?>
27dd6b2bfcSGreg Roach    <?php endif ?>
28dd6b2bfcSGreg Roach<?php elseif ($record->isPendingAddition()) : ?>
29f4afa648SGreg Roach    <?php if (Auth::isModerator($record->tree())) : ?>
300973b4d2SGreg Roach        <?= view('components/alert-warning-dismissible', ['alert' => /* I18N: %1$s is “accept”, %2$s is “reject”. These are links. */ I18N::translate('This family has been edited. You should review the changes and then %1$s or %2$s them.', '<a href="#" class="alert-link" data-post-url="' . e(route(PendingChangesAcceptRecord::class, ['tree' => $record->tree()->name(), 'xref' => $record->xref()])) . '">' . I18N::translateContext('You should review the changes and then accept or reject them.', 'accept') . '</a>', '<a href="#" class="alert-link" data-post-url="' . e(route(PendingChangesRejectRecord::class, ['tree' => $record->tree()->name(), 'xref' => $record->xref()])) . '">' . I18N::translateContext('You should review the changes and then accept or reject them.', 'reject') . '</a>') . ' ' . view('help/link', ['topic' => 'pending_changes'])]) ?>
31f4afa648SGreg Roach    <?php elseif (Auth::isEditor($record->tree())) : ?>
320973b4d2SGreg Roach        <?= view('components/alert-warning-dismissible', ['alert' => I18N::translate('This family has been edited. The changes need to be reviewed by a moderator.') . ' ' . view('help/link', ['topic' => 'pending_changes'])]) ?>
33dd6b2bfcSGreg Roach    <?php endif ?>
34dd6b2bfcSGreg Roach<?php endif ?>
35dd6b2bfcSGreg Roach
36dd6b2bfcSGreg Roach<div class="d-flex mb-4">
37dd6b2bfcSGreg Roach    <h2 class="wt-page-title mx-auto">
3839ca88baSGreg Roach        <?= $record->fullName() ?>
39dd6b2bfcSGreg Roach    </h2>
401450f098SGreg Roach    <?php if ($record->canEdit()) : ?>
41dd6b2bfcSGreg Roach        <?= view('family-page-menu', ['record' => $record]) ?>
42dd6b2bfcSGreg Roach    <?php endif ?>
43dd6b2bfcSGreg Roach</div>
44dd6b2bfcSGreg Roach
45dd6b2bfcSGreg Roach<div class="wt-page-content">
4617dd427eSGreg Roach    <div class="wt-family-members d-flex">
4717dd427eSGreg Roach        <?= view('family-page-children', ['family' => $record]) ?>
4817dd427eSGreg Roach        <?= view('family-page-parents', ['family' => $record]) ?>
4917dd427eSGreg Roach    </div>
5017dd427eSGreg Roach
5117dd427eSGreg Roach    <h3 class="mt-4"><?= I18N::translate('Facts and events') ?></h3>
52dd6b2bfcSGreg Roach    <table class="table wt-facts-table">
5339ca88baSGreg Roach        <?php if ($facts->isEmpty()) : ?>
54dd6b2bfcSGreg Roach            <tr>
55d224ae93SGreg Roach                <td colspan="2">
56dd6b2bfcSGreg Roach                    <?= I18N::translate('No facts exist for this family.') ?>
57dd6b2bfcSGreg Roach                </td>
58dd6b2bfcSGreg Roach            </tr>
59dd6b2bfcSGreg Roach        <?php else : ?>
60dd6b2bfcSGreg Roach            <?php foreach ($facts as $fact) : ?>
61dd6b2bfcSGreg Roach                <?php FunctionsPrintFacts::printFact($fact, $record) ?>
62dd6b2bfcSGreg Roach            <?php endforeach ?>
63dd6b2bfcSGreg Roach        <?php endif ?>
64dd6b2bfcSGreg Roach
65f4afa648SGreg Roach        <?php if (Auth::isEditor($record->tree())) : ?>
662adcbd9aSGreg Roach            <?= view('edit/paste-fact-row', ['record' => $record, 'facts' => $clipboard_facts]) ?>
672adcbd9aSGreg Roach
6802467d32SGreg Roach            <?php FunctionsPrint::printAddNewFact($record, $facts, Family::RECORD_TYPE) ?>
69dd6b2bfcSGreg Roach            <tr>
70dd6b2bfcSGreg Roach                <th scope="row">
71dd6b2bfcSGreg Roach                    <?= I18N::translate('Note') ?>
72dd6b2bfcSGreg Roach                </th>
73dd6b2bfcSGreg Roach                <td>
742917771cSGreg Roach                    <a href="<?= e(route(AddNewFact::class, ['tree' => $record->tree()->name(), 'xref' => $record->xref(), 'fact' => 'NOTE'])) ?>">
75dd6b2bfcSGreg Roach                        <?= I18N::translate('Add a note') ?>
76dd6b2bfcSGreg Roach                    </a>
77dd6b2bfcSGreg Roach                </td>
78dd6b2bfcSGreg Roach            </tr>
79dd6b2bfcSGreg Roach
80dd6b2bfcSGreg Roach            <tr>
81dd6b2bfcSGreg Roach                <th scope="row">
82dd6b2bfcSGreg Roach                    <?= I18N::translate('Shared note') ?>
83dd6b2bfcSGreg Roach                </th>
84ac1d7be4SGreg Roach                <td>
852917771cSGreg Roach                    <a href="<?= e(route(AddNewFact::class, ['tree' => $record->tree()->name(), 'xref' => $record->xref(), 'fact' => 'SHARED_NOTE'])) ?>">
86dd6b2bfcSGreg Roach                        <?= I18N::translate('Add a shared note') ?>
87dd6b2bfcSGreg Roach                    </a>
88dd6b2bfcSGreg Roach                </td>
89dd6b2bfcSGreg Roach            </tr>
90dd6b2bfcSGreg Roach
91f4afa648SGreg Roach            <?php if ($record->tree()->getPreference('MEDIA_UPLOAD') >= Auth::accessLevel($record->tree())) : ?>
92dd6b2bfcSGreg Roach                <tr>
93dd6b2bfcSGreg Roach                    <th scope="row">
94dd6b2bfcSGreg Roach                        <?= I18N::translate('Media object') ?>
95dd6b2bfcSGreg Roach                    </th>
96ac1d7be4SGreg Roach                    <td>
972917771cSGreg Roach                        <a href="<?= e(route(AddNewFact::class, ['tree' => $record->tree()->name(), 'xref' => $record->xref(), 'fact' => 'OBJE'])) ?>">
98dd6b2bfcSGreg Roach                            <?= I18N::translate('Add a media object') ?>
99dd6b2bfcSGreg Roach                        </a>
100dd6b2bfcSGreg Roach                    </td>
101dd6b2bfcSGreg Roach                </tr>
102dd6b2bfcSGreg Roach            <?php endif ?>
103dd6b2bfcSGreg Roach
104dd6b2bfcSGreg Roach            <tr>
105dd6b2bfcSGreg Roach                <th scope="row">
106dd6b2bfcSGreg Roach                    <?= I18N::translate('Source') ?>
107dd6b2bfcSGreg Roach                </th>
108dd6b2bfcSGreg Roach                <td>
1092917771cSGreg Roach                    <a href="<?= e(route(AddNewFact::class, ['tree' => $record->tree()->name(), 'xref' => $record->xref(), 'fact' => 'SOUR'])) ?>">
110dd6b2bfcSGreg Roach                        <?= I18N::translate('Add a source citation') ?>
111dd6b2bfcSGreg Roach                    </a>
112dd6b2bfcSGreg Roach                </td>
113dd6b2bfcSGreg Roach            </tr>
114dd6b2bfcSGreg Roach        <?php endif ?>
115dd6b2bfcSGreg Roach    </table>
116dd6b2bfcSGreg Roach</div>
117dd6b2bfcSGreg Roach
118dd6b2bfcSGreg Roach<?= view('modals/ajax') ?>
119