xref: /webtrees/resources/views/edit/raw-gedcom-record.phtml (revision 3b3db8adf3fd54bb8a196a781da9123905e54adf)
1*3b3db8adSGreg Roach<?php
2*3b3db8adSGreg Roach
3*3b3db8adSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlerInterface\EditRawRecordAction;
4*3b3db8adSGreg Roachuse Fisharebest\Webtrees\I18N;
5*3b3db8adSGreg Roachuse Fisharebest\Webtrees\View;
6*3b3db8adSGreg Roach
7*3b3db8adSGreg Roach?>
8dd6b2bfcSGreg Roach
9dd6b2bfcSGreg Roach<h2 class="wt-page-title"><?= $title ?></h2>
10dd6b2bfcSGreg Roach
11*3b3db8adSGreg Roach<form method="post" action="<?= e(route(EditRawRecordAction::class, ['tree' => $tree->name()])) ?>" class="wt-page-content">
12dd6b2bfcSGreg Roach    <?= csrf_field() ?>
139022ab66SGreg Roach    <input type="hidden" name="tree" value="<?= e($tree->name()) ?>">
14c0935879SGreg Roach    <input type="hidden" name="xref" value="<?= e($record->xref()) ?>">
15dd6b2bfcSGreg Roach
16dd6b2bfcSGreg Roach    <p class="text-muted small">
17dd6b2bfcSGreg 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.') ?>
18dd6b2bfcSGreg Roach    </p>
19dd6b2bfcSGreg Roach    <p class="text-muted small">
20dd6b2bfcSGreg Roach        <?= /* 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>') ?>
21dd6b2bfcSGreg Roach    </p>
22dd6b2bfcSGreg Roach
23dd6b2bfcSGreg Roach    <div class="card">
24dd6b2bfcSGreg Roach        <label class="card-header py-1 px-2" for="fact0">
2539ca88baSGreg Roach            <?= $record->fullName() ?>
26dd6b2bfcSGreg Roach        </label>
27dd6b2bfcSGreg Roach        <div class="card-body form-control py-1 px-2">
28b51c2707SGreg Roach            <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>
29dd6b2bfcSGreg Roach        </div>
30dd6b2bfcSGreg Roach    </div>
31dd6b2bfcSGreg Roach
3275b444f7SGreg Roach    <div id="wt-sortable-list">
3330158ae7SGreg Roach        <?php foreach ($record->facts() as $fact) : ?>
34dd6b2bfcSGreg Roach            <?php if (!$fact->isPendingDeletion()) : ?>
35dd6b2bfcSGreg Roach                <div class="card my-2">
369ba7eeb1SGreg Roach                    <label class="card-header py-1 px-2 d-flex" for="fact-<?= e($fact->id()) ?>">
3710e872f2SGreg Roach                        <span class="drag-handle">
38dd6b2bfcSGreg Roach                            <?= view('icons/drag-handle') ?>
3910e872f2SGreg Roach                        </span>
40dd6b2bfcSGreg Roach                        <?= $fact->summary() ?>
41dd6b2bfcSGreg Roach                    </label>
429ba7eeb1SGreg Roach                    <input type="hidden" name="fact_id[]" value="<?= e($fact->id()) ?>">
43c67a93abSGreg 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>
44dd6b2bfcSGreg Roach                </div>
45dd6b2bfcSGreg Roach            <?php endif ?>
46dd6b2bfcSGreg Roach        <?php endforeach ?>
47dd6b2bfcSGreg Roach
48dd6b2bfcSGreg Roach        <div class="card my-2">
49dd6b2bfcSGreg Roach            <label class="card-header py-1 px-2" for="fact-add">
50dd6b2bfcSGreg Roach                <?= I18N::translate('Add a fact') ?>
51dd6b2bfcSGreg Roach            </label>
52cd0fe2c5SGreg Roach            <input type="hidden" name="fact_id[]" value="">
53c67a93abSGreg Roach            <textarea class="card-body form-control py-1 px-2" dir="ltr" id="fact-add" name="fact[]" rows="5"></textarea>
54dd6b2bfcSGreg Roach        </div>
55dd6b2bfcSGreg Roach    </div>
56dd6b2bfcSGreg Roach
57dd6b2bfcSGreg Roach    <div class="row form-group">
58dd6b2bfcSGreg Roach        <div class="col-sm-9 offset-sm-3">
59dd6b2bfcSGreg Roach            <button class="btn btn-primary" type="submit">
60d993d560SGreg Roach                <?= view('icons/save') ?>
61dd6b2bfcSGreg Roach                <?= /* I18N: A button label. */ I18N::translate('save') ?>
62dd6b2bfcSGreg Roach            </button>
63dd6b2bfcSGreg Roach            <a class="btn btn-secondary" href="<?= e($record->url()) ?>">
64d993d560SGreg Roach                <?= view('icons/cancel') ?>
65dd6b2bfcSGreg Roach                <?= /* I18N: A button label. */ I18N::translate('cancel') ?>
66dd6b2bfcSGreg Roach            </a>
67dd6b2bfcSGreg Roach        </div>
68dd6b2bfcSGreg Roach    </div>
69dd6b2bfcSGreg Roach</form>
70dd6b2bfcSGreg Roach
71dd6b2bfcSGreg Roach<?php View::push('javascript') ?>
72dd6b2bfcSGreg Roach<script>
7375b444f7SGreg Roach    new Sortable(document.getElementById("wt-sortable-list"), {
7475b444f7SGreg Roach        handle: ".drag-handle",
75dd6b2bfcSGreg Roach    });
76dd6b2bfcSGreg Roach</script>
77dd6b2bfcSGreg Roach<?php View::endpush() ?>
78