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