xref: /webtrees/resources/views/edit/edit-record.phtml (revision e04233f94df2a4ebf85185b9e8350a7369ed80a8)
1<?php
2
3use Fisharebest\Webtrees\GedcomRecord;
4use Fisharebest\Webtrees\Http\RequestHandlers\EditRawRecordPage;
5use Fisharebest\Webtrees\Http\RequestHandlers\EditRecordAction;
6use Fisharebest\Webtrees\I18N;
7use Fisharebest\Webtrees\Tree;
8
9/**
10 * @var bool         $can_edit_raw
11 * @var GedcomRecord $record
12 * @var string       $title
13 * @var Tree         $tree
14 */
15
16?>
17
18<h2 class="wt-page-title"><?= $title ?></h2>
19
20<form method="post" action="<?= e(route(EditRecordAction::class, ['tree' => $tree->name(), 'xref' => $record->xref()])) ?>" class="wt-page-content">
21    <?= csrf_field() ?>
22
23    <?= view('edit/edit-gedcom-fields', ['gedcom' => $record->insertMissingSubtags(), 'hierarchy' => [$record->tag()], 'tree' => $tree, 'prefix' => '']) ?>
24
25    <?php if ($has_chan): ?>
26        <div class="form-group row">
27            <label class="col-sm-3 col-form-label" for="keep_chan">
28                <?= I18N::translate('Last change') ?>
29            </label>
30            <div class="col-sm-9">
31                <?= view('components/checkbox-inline', ['label' => I18N::translate('Keep the existing “last change” information'), 'name' => 'keep_chan', 'checked' => (bool) $tree->getPreference('NO_UPDATE_CHAN')]) ?>
32                <div>
33                    <?= I18N::translate('%1$s: %2$s', I18N::translate('Timestamp'), view('components/datetime', ['timestamp' => $record->lastChangeTimestamp()])) ?>
34                </div>
35                <div>
36                    <?= I18N::translate('%1$s: %2$s', I18N::translate('Author of last change'), e($record->lastChangeUser())) ?>
37                </div>
38            </div>
39        </div>
40    <?php endif ?>
41
42    <div class="form-group row">
43        <div class="col-sm-3 wt-page-options-label">
44        </div>
45        <div class="col-sm-9 wt-page-options-value">
46            <button class="btn btn-primary" type="submit">
47                <?= view('icons/save') ?>
48                <?= /* I18N: A button label. */
49                I18N::translate('save') ?>
50            </button>
51            <a class="btn btn-secondary" href="<?= e($record->url()) ?>">
52                <?= view('icons/cancel') ?>
53                <?= /* I18N: A button label. */
54                I18N::translate('cancel') ?>
55            </a>
56            <?php if ($can_edit_raw) : ?>
57                <a class="btn btn-link" href="<?= e(route(EditRawRecordPage::class, ['xref' => $record->xref(), 'tree' => $tree->name()])) ?>">
58                    <?= I18N::translate('Edit the raw GEDCOM') ?>
59                </a>
60            <?php endif; ?>
61        </div>
62    </div>
63</form>
64
65<?= view('modals/on-screen-keyboard') ?>
66<?= view('modals/ajax') ?>
67<?= view('edit/initialize-calendar-popup') ?>
68