xref: /webtrees/resources/views/edit/raw-gedcom-record.phtml (revision 30158ae76837ce51811d3e0fca2ea5852182f42e)
1dd6b2bfcSGreg Roach<?php use Fisharebest\Webtrees\FontAwesome; ?>
2dd6b2bfcSGreg Roach<?php use Fisharebest\Webtrees\I18N; ?>
3dd6b2bfcSGreg Roach<?php use Fisharebest\Webtrees\View; ?>
4dd6b2bfcSGreg Roach
5dd6b2bfcSGreg Roach<h2 class="wt-page-title"><?= $title ?></h2>
6dd6b2bfcSGreg Roach
7dd6b2bfcSGreg Roach<form class="wt-page-content" method="post">
8dd6b2bfcSGreg Roach    <?= csrf_field() ?>
9aa6f03bbSGreg Roach    <input type="hidden" name="ged" value="<?= e($tree->name()) ?>">
10c0935879SGreg Roach    <input type="hidden" name="xref" value="<?= e($record->xref()) ?>">
11dd6b2bfcSGreg Roach
12dd6b2bfcSGreg Roach    <p class="text-muted small">
13dd6b2bfcSGreg 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.') ?>
14dd6b2bfcSGreg Roach    </p>
15dd6b2bfcSGreg Roach    <p class="text-muted small">
16dd6b2bfcSGreg 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>') ?>
17dd6b2bfcSGreg Roach    </p>
18dd6b2bfcSGreg Roach
19dd6b2bfcSGreg Roach    <div class="card">
20dd6b2bfcSGreg Roach        <label class="card-header py-1 px-2" for="fact0">
21dd6b2bfcSGreg Roach            <?= $record->getFullName() ?>
22dd6b2bfcSGreg Roach        </label>
23dd6b2bfcSGreg Roach        <div class="card-body form-control py-1 px-2">
24c0935879SGreg Roach            <textarea class="card-body form-control py-1 px-2" dir="ltr" id="fact0" rows="1">0 @<?= e($record->xref()) ?>@ <?= e($record::RECORD_TYPE) ?></textarea>
25dd6b2bfcSGreg Roach        </div>
26dd6b2bfcSGreg Roach    </div>
27dd6b2bfcSGreg Roach
28dd6b2bfcSGreg Roach    <div id="raw-gedcom-list">
29*30158ae7SGreg Roach        <?php foreach ($record->facts() as $fact) : ?>
30dd6b2bfcSGreg Roach            <?php if (!$fact->isPendingDeletion()) : ?>
31dd6b2bfcSGreg Roach                <div class="card my-2">
32dd6b2bfcSGreg Roach                    <label class="card-header py-1 px-2 d-flex" for="fact-<?= e($fact->getFactId()) ?>">
33dd6b2bfcSGreg Roach                        <?= view('icons/drag-handle') ?>
34dd6b2bfcSGreg Roach                        <?= $fact->summary() ?>
35dd6b2bfcSGreg Roach                    </label>
36dd6b2bfcSGreg Roach                    <input type="hidden" name="fact_id[]" value="<?= e($fact->getFactId()) ?>">
377d0db648SGreg Roach                    <textarea class="card-body form-control py-1 px-2" dir="ltr" id="fact-<?= e($fact->getFactId()) ?>" name="fact[]" pattern="<?= e($pattern) ?>" rows="<?= 1 + preg_match_all('/\n/', $fact->gedcom()) ?>"><?= e($fact->gedcom()) ?></textarea>
38dd6b2bfcSGreg Roach                </div>
39dd6b2bfcSGreg Roach            <?php endif ?>
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>
46dd6b2bfcSGreg Roach            <input type="hidden" name="fact_id[]" value="<?= e($fact->getFactId()) ?>">
47dd6b2bfcSGreg Roach            <textarea class="card-body form-control py-1 px-2" dir="ltr" id="fact-add" name="fact[]" pattern="<?= e($pattern) ?>" rows="2"></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">
54dd6b2bfcSGreg Roach                <?= FontAwesome::decorativeIcon('save') ?>
55dd6b2bfcSGreg Roach                <?= /* I18N: A button label. */ I18N::translate('save') ?>
56dd6b2bfcSGreg Roach            </button>
57dd6b2bfcSGreg Roach            <a class="btn btn-secondary" href="<?= e($record->url()) ?>">
58dd6b2bfcSGreg Roach                <?= FontAwesome::decorativeIcon('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>
67dd6b2bfcSGreg Roach  new Sortable(document.getElementById("raw-gedcom-list"), {
68dd6b2bfcSGreg Roach    handle: '.drag-handle'
69dd6b2bfcSGreg Roach  });
70dd6b2bfcSGreg Roach</script>
71dd6b2bfcSGreg Roach<?php View::endpush() ?>
72