xref: /webtrees/resources/views/edit/raw-gedcom-record.phtml (revision 61f0428a4cf2a6780c2454b25c65a99608e81792)
13b3db8adSGreg Roach<?php
23b3db8adSGreg Roach
32917771cSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\EditRawRecordAction;
43b3db8adSGreg Roachuse Fisharebest\Webtrees\I18N;
53b3db8adSGreg Roachuse Fisharebest\Webtrees\View;
69d7cdf93SGreg Roachuse Fisharebest\Webtrees\Webtrees;
73b3db8adSGreg Roach
83b3db8adSGreg Roach?>
9dd6b2bfcSGreg Roach
10dd6b2bfcSGreg Roach<h2 class="wt-page-title"><?= $title ?></h2>
11dd6b2bfcSGreg Roach
122917771cSGreg Roach<form method="post" action="<?= e(route(EditRawRecordAction::class, ['tree' => $tree->name(), 'xref' => $record->xref()])) ?>" class="wt-page-content">
13dd6b2bfcSGreg Roach    <?= csrf_field() ?>
14dd6b2bfcSGreg Roach
15dd6b2bfcSGreg Roach    <p class="text-muted small">
16dd6b2bfcSGreg Roach        <?= 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.') ?>
17dd6b2bfcSGreg Roach    </p>
18dd6b2bfcSGreg Roach    <p class="text-muted small">
199d7cdf93SGreg Roach        <?= /* 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>') ?>
20dd6b2bfcSGreg Roach    </p>
21dd6b2bfcSGreg Roach
22dd6b2bfcSGreg Roach    <div class="card">
23dd6b2bfcSGreg Roach        <label class="card-header py-1 px-2" for="fact0">
2439ca88baSGreg Roach            <?= $record->fullName() ?>
25dd6b2bfcSGreg Roach        </label>
26*61f0428aSGreg Roach        <textarea class="card-body form-control py-1 px-2" id="fact0" rows="1" dir="ltr" readonly disabled><?= e($level0) ?></textarea>
27dd6b2bfcSGreg Roach    </div>
28dd6b2bfcSGreg Roach
2992044e0dSGreg Roach    <div class="wt-sortable-list">
307bb122d6SGreg Roach        <?php foreach ($record->facts([], false, null, true) as $fact) : ?>
3192044e0dSGreg Roach            <div class="card my-2 wt-sortable-item">
329ba7eeb1SGreg Roach                <input type="hidden" name="fact_id[]" value="<?= e($fact->id()) ?>">
3392044e0dSGreg Roach                <div class="card-header">
3492044e0dSGreg Roach                    <?= view('edit/reorder-card-header', ['title' => $fact->summary()]) ?>
3592044e0dSGreg Roach                </div>
3692044e0dSGreg Roach                <label class="sr-only" for="fact-<?= e($fact->id()) ?>"><?= $fact->summary() ?></label>
3792044e0dSGreg Roach
38c67a93abSGreg Roach                <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>
39dd6b2bfcSGreg Roach            </div>
40dd6b2bfcSGreg Roach        <?php endforeach ?>
41dd6b2bfcSGreg Roach
42dd6b2bfcSGreg Roach        <div class="card my-2">
43dd6b2bfcSGreg Roach            <label class="card-header py-1 px-2" for="fact-add">
44dd6b2bfcSGreg Roach                <?= I18N::translate('Add a fact') ?>
45dd6b2bfcSGreg Roach            </label>
46cd0fe2c5SGreg Roach            <input type="hidden" name="fact_id[]" value="">
47c67a93abSGreg Roach            <textarea class="card-body form-control py-1 px-2" dir="ltr" id="fact-add" name="fact[]" rows="5"></textarea>
48dd6b2bfcSGreg Roach        </div>
49dd6b2bfcSGreg Roach    </div>
50dd6b2bfcSGreg Roach
51dd6b2bfcSGreg Roach    <div class="row form-group">
52dd6b2bfcSGreg Roach        <div class="col-sm-9 offset-sm-3">
53dd6b2bfcSGreg Roach            <button class="btn btn-primary" type="submit">
54d993d560SGreg Roach                <?= view('icons/save') ?>
55dd6b2bfcSGreg Roach                <?= /* I18N: A button label. */ I18N::translate('save') ?>
56dd6b2bfcSGreg Roach            </button>
57dd6b2bfcSGreg Roach            <a class="btn btn-secondary" href="<?= e($record->url()) ?>">
58d993d560SGreg Roach                <?= view('icons/cancel') ?>
59dd6b2bfcSGreg Roach                <?= /* I18N: A button label. */ I18N::translate('cancel') ?>
60dd6b2bfcSGreg Roach            </a>
61dd6b2bfcSGreg Roach        </div>
62dd6b2bfcSGreg Roach    </div>
63dd6b2bfcSGreg Roach</form>
64dd6b2bfcSGreg Roach
65dd6b2bfcSGreg Roach<?php View::push('javascript') ?>
66dd6b2bfcSGreg Roach<script>
6792044e0dSGreg Roach    new Sortable(document.querySelector(".wt-sortable-list"), {
6892044e0dSGreg Roach        handle: ".card-header",
69dd6b2bfcSGreg Roach    });
70dd6b2bfcSGreg Roach</script>
71dd6b2bfcSGreg Roach<?php View::endpush() ?>
72