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