xref: /webtrees/resources/views/edit/raw-gedcom-record.phtml (revision fcfa147e10aaa6c7ff580c29bd6e5b88666befc1)
1<?php use Fisharebest\Webtrees\I18N;
2use Fisharebest\Webtrees\View; ?>
3<?php ?>
4
5<h2 class="wt-page-title"><?= $title ?></h2>
6
7<form method="post" action="<?= e(route('edit-raw-record-action', ['tree' => $tree->name()])) ?>" class="wt-page-content">
8    <?= csrf_field() ?>
9    <input type="hidden" name="tree" value="<?= e($tree->name()) ?>">
10    <input type="hidden" name="xref" value="<?= e($record->xref()) ?>">
11
12    <p class="text-muted small">
13        <?= I18N::translate('This page allows you to bypass the usual forms, and edit the underlying data directly. It is an advanced option, and you should not use it unless you understand the GEDCOM format. If you make a mistake here, it can be difficult to fix.') ?>
14    </p>
15    <p class="text-muted small">
16        <?= /* I18N: %s is a URL */ I18N::translate('You can download a copy of the GEDCOM specification from %s.', '<a href="https://wiki.webtrees.net/w/images-en/Ged551-5.pdf">https://wiki.webtrees.net/w/images-en/Ged551-5.pdf</a>') ?>
17    </p>
18
19    <div class="card">
20        <label class="card-header py-1 px-2" for="fact0">
21            <?= $record->fullName() ?>
22        </label>
23        <div class="card-body form-control py-1 px-2">
24            <textarea class="card-body form-control py-1 px-2" id="fact0" rows="1" dir="ltr">0 @<?= e($record->xref()) ?>@ <?= e($record::RECORD_TYPE) ?></textarea>
25        </div>
26    </div>
27
28    <div id="wt-sortable-list">
29        <?php foreach ($record->facts() as $fact) : ?>
30            <?php if (!$fact->isPendingDeletion()) : ?>
31                <div class="card my-2">
32                    <label class="card-header py-1 px-2 d-flex" for="fact-<?= e($fact->id()) ?>">
33                        <span class="drag-handle">
34                            <?= view('icons/drag-handle') ?>
35                        </span>
36                        <?= $fact->summary() ?>
37                    </label>
38                    <input type="hidden" name="fact_id[]" value="<?= e($fact->id()) ?>">
39                    <textarea class="card-body form-control py-1 px-2" dir="ltr" id="fact-<?= e($fact->id()) ?>" name="fact[]" rows="<?= 1 + preg_match_all('/\n/', $fact->gedcom()) ?>"><?= e($fact->gedcom()) ?></textarea>
40                </div>
41            <?php endif ?>
42        <?php endforeach ?>
43
44        <div class="card my-2">
45            <label class="card-header py-1 px-2" for="fact-add">
46                <?= I18N::translate('Add a fact') ?>
47            </label>
48            <input type="hidden" name="fact_id[]" value="">
49            <textarea class="card-body form-control py-1 px-2" dir="ltr" id="fact-add" name="fact[]" rows="5"></textarea>
50        </div>
51    </div>
52
53    <div class="row form-group">
54        <div class="col-sm-9 offset-sm-3">
55            <button class="btn btn-primary" type="submit">
56                <?= view('icons/save') ?>
57                <?= /* I18N: A button label. */ I18N::translate('save') ?>
58            </button>
59            <a class="btn btn-secondary" href="<?= e($record->url()) ?>">
60                <?= view('icons/cancel') ?>
61                <?= /* I18N: A button label. */ I18N::translate('cancel') ?>
62            </a>
63        </div>
64    </div>
65</form>
66
67<?php View::push('javascript') ?>
68<script>
69    new Sortable(document.getElementById("wt-sortable-list"), {
70        handle: ".drag-handle",
71    });
72</script>
73<?php View::endpush() ?>
74