xref: /webtrees/resources/views/edit/edit-fact.phtml (revision 9af6b024736711ef85eba12979344b0241b8b348)
1<?php use Fisharebest\Webtrees\Auth; ?>
2<?php use Fisharebest\Webtrees\Bootstrap4; ?>
3<?php use Fisharebest\Webtrees\Config; ?>
4<?php use Fisharebest\Webtrees\Functions\FunctionsEdit; ?>
5<?php use Fisharebest\Webtrees\GedcomTag; ?>
6<?php use Fisharebest\Webtrees\I18N; ?>
7<?php use Ramsey\Uuid\Uuid; ?>
8
9<h2 class="wt-page-title"><?= $title ?></h2>
10
11<form class="wt-page-content" action="<?= e(route('update-fact', ['ged' => $tree->name(), 'xref' => $record->xref(), 'fact_id' => $edit_fact->id()])) ?>" method="post">   <?= csrf_field() ?>
12
13    <?php FunctionsEdit::createEditForm($edit_fact) ?>
14
15    <?php
16    $level1type = $edit_fact->getTag();
17    switch ($record::RECORD_TYPE) {
18        case 'FAM':
19        case 'INDI':
20            // FAM and INDI records have real facts. They can take NOTE/SOUR/OBJE/etc.
21            if ($level1type !== 'SEX' && $level1type !== 'NOTE' && $level1type !== 'ALIA') {
22                if ($level1type !== 'SOUR') {
23                    echo view('cards/add-source-citation', [
24                        'level'          => 2,
25                        'full_citations' => $tree->getPreference('FULL_SOURCES'),
26                        'tree'           => $tree,
27                    ]);
28                }
29                if ($level1type !== 'OBJE') {
30                    if ($tree->getPreference('MEDIA_UPLOAD') >= Auth::accessLevel($tree)) {
31                        echo view('cards/add-media-object', [
32                            'level' => 2,
33                            'tree'  => $tree,
34                        ]);
35                    }
36                }
37                echo view('cards/add-note', [
38                    'level' => 2,
39                    'tree' => $tree,
40                ]);
41                echo view('cards/add-shared-note', [
42                    'level' => 2,
43                    'tree' => $tree,
44                ]);
45                if ($level1type !== 'ASSO' && $level1type !== 'NOTE' && $level1type !== 'SOUR') {
46                    echo view('cards/add-associate', [
47                        'id'    => Uuid::uuid4()->toString(),
48                        'level' => 2,
49                        'tree' => $tree,
50                    ]);
51                }
52                // allow to add godfather and godmother for CHR fact or best man and bridesmaid  for MARR fact in one window
53                if (in_array($level1type, Config::twoAssociates())) {
54                    echo view('cards/add-associate', [
55                        'id'    => Uuid::uuid4()->toString(),
56                        'level' => 2,
57                        'tree' => $tree,
58                    ]);
59                }
60                if ($level1type !== 'SOUR') {
61                    echo view('cards/add-restriction', [
62                        'level' => 2,
63                        'tree' => $tree,
64                    ]);
65                }
66            }
67            break;
68        default:
69            // Other types of record do not have these lower-level records
70            break;
71    }
72
73    ?>
74
75    <div class="form-group row">
76        <label class="col-sm-3 col-form-label" for="keep_chan">
77            <?= I18N::translate('Last change') ?>
78        </label>
79        <div class="col-sm-9">
80            <?= Bootstrap4::checkbox(I18N::translate('Keep the existing “last change” information'), true, ['name' => 'keep_chan', 'checked' => (bool) $tree->getPreference('NO_UPDATE_CHAN')]) ?>
81            <?= GedcomTag::getLabelValue('DATE', view('components/datetime', ['timestamp' => $record->lastChangeTimestamp()])) ?>
82            <?= GedcomTag::getLabelValue('_WT_USER', e($record->lastChangeUser())) ?>
83        </div>
84    </div>
85
86    <div class="form-group row">
87        <div class="col-sm-3 wt-page-options-label">
88        </div>
89        <div class="col-sm-9 wt-page-options-value">
90            <button class="btn btn-primary" type="submit">
91                <?= view('icons/save') ?>
92                <?= /* I18N: A button label. */
93                I18N::translate('save') ?>
94            </button>
95            <a class="btn btn-secondary" href="<?= e($record->url()) ?>">
96                <?= view('icons/cancel') ?>
97                <?= /* I18N: A button label. */
98                I18N::translate('cancel') ?>
99            </a>
100            <?php if ($can_edit_raw) : ?>
101                <a class="btn btn-link" href="<?= e(route('edit-raw-fact', ['xref' => $record->xref(), 'fact_id' => $edit_fact->id(), 'ged' => $tree->name()])) ?>">
102                    <?= I18N::translate('Edit the raw GEDCOM') ?>
103                </a>
104            <?php endif; ?>
105        </div>
106    </div>
107</form>
108
109<?= view('modals/on-screen-keyboard') ?>
110<?= view('modals/ajax') ?>
111<?= view('edit/initialize-calendar-popup') ?>
112