xref: /webtrees/resources/views/edit/raw-gedcom-record.phtml (revision 00b1984e374faddab4698e73088f0c964e529b65)
1<?php
2
3use Fisharebest\Webtrees\Http\RequestHandlers\EditRawRecordAction;
4use Fisharebest\Webtrees\I18N;
5use Fisharebest\Webtrees\View;
6use Fisharebest\Webtrees\Webtrees;
7
8?>
9
10<h2 class="wt-page-title"><?= $title ?></h2>
11
12<form method="post" action="<?= e(route(EditRawRecordAction::class, ['tree' => $tree->name(), 'xref' => $record->xref()])) ?>" class="wt-page-content">
13    <?= csrf_field() ?>
14
15    <p class="text-muted small">
16        <?= 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.') ?>
17    </p>
18    <p class="text-muted small">
19        <?= /* I18N: %s is a URL */ I18N::translate('You can download a copy of the GEDCOM specification from %s.', '<a href="' . e(Webtrees::GEDCOM_PDF) . '">' . e(Webtrees::GEDCOM_PDF) . '</a>') ?>
20    </p>
21
22    <div class="card">
23        <label class="card-header py-1 px-2" for="fact0">
24            <?= $record->fullName() ?>
25        </label>
26        <div class="card-body form-control py-1 px-2">
27            <textarea class="card-body form-control py-1 px-2" id="fact0" rows="1" dir="ltr" readonly>0 @<?= e($record->xref()) ?>@ <?= e($record::RECORD_TYPE) ?></textarea>
28        </div>
29    </div>
30
31    <div id="wt-sortable-list">
32        <?php foreach ($record->facts([], false, null, true) as $fact) : ?>
33            <div class="card my-2">
34                <label class="card-header py-1 px-2 d-flex" for="fact-<?= e($fact->id()) ?>">
35                    <span class="drag-handle">
36                        <?= view('icons/drag-handle') ?>
37                    </span>
38                    <?= $fact->summary() ?>
39                </label>
40                <input type="hidden" name="fact_id[]" value="<?= e($fact->id()) ?>">
41                <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>
42            </div>
43        <?php endforeach ?>
44
45        <div class="card my-2">
46            <label class="card-header py-1 px-2" for="fact-add">
47                <?= I18N::translate('Add a fact') ?>
48            </label>
49            <input type="hidden" name="fact_id[]" value="">
50            <textarea class="card-body form-control py-1 px-2" dir="ltr" id="fact-add" name="fact[]" rows="5"></textarea>
51        </div>
52    </div>
53
54    <div class="row form-group">
55        <div class="col-sm-9 offset-sm-3">
56            <button class="btn btn-primary" type="submit">
57                <?= view('icons/save') ?>
58                <?= /* I18N: A button label. */ I18N::translate('save') ?>
59            </button>
60            <a class="btn btn-secondary" href="<?= e($record->url()) ?>">
61                <?= view('icons/cancel') ?>
62                <?= /* I18N: A button label. */ I18N::translate('cancel') ?>
63            </a>
64        </div>
65    </div>
66</form>
67
68<?php View::push('javascript') ?>
69<script>
70    new Sortable(document.getElementById("wt-sortable-list"), {
71        handle: ".drag-handle",
72    });
73</script>
74<?php View::endpush() ?>
75