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