xref: /webtrees/resources/views/edit/raw-gedcom-record.phtml (revision 9e3c2cf9009c4c2140f50ddfc80b91f2f82cdce5)
13b3db8adSGreg Roach<?php
23b3db8adSGreg Roach
37c2c99faSGreg Roachuse Fisharebest\Webtrees\GedcomRecord;
42917771cSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\EditRawRecordAction;
53b3db8adSGreg Roachuse Fisharebest\Webtrees\I18N;
67c2c99faSGreg Roachuse Fisharebest\Webtrees\Tree;
73b3db8adSGreg Roachuse Fisharebest\Webtrees\View;
89d7cdf93SGreg Roachuse Fisharebest\Webtrees\Webtrees;
93b3db8adSGreg Roach
107c2c99faSGreg Roach/**
117c2c99faSGreg Roach * @var string       $level0
127c2c99faSGreg Roach * @var GedcomRecord $record
137c2c99faSGreg Roach * @var string       $title
147c2c99faSGreg Roach * @var Tree         $tree
157c2c99faSGreg Roach */
167c2c99faSGreg Roach
173b3db8adSGreg Roach?>
18dd6b2bfcSGreg Roach
19dd6b2bfcSGreg Roach<h2 class="wt-page-title"><?= $title ?></h2>
20dd6b2bfcSGreg Roach
212917771cSGreg Roach<form method="post" action="<?= e(route(EditRawRecordAction::class, ['tree' => $tree->name(), 'xref' => $record->xref()])) ?>" class="wt-page-content">
22dd6b2bfcSGreg Roach    <?= csrf_field() ?>
23dd6b2bfcSGreg Roach
24315eb316SGreg Roach    <div class="form-text">
25dd6b2bfcSGreg 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.') ?>
26315eb316SGreg Roach        <br>
279d7cdf93SGreg 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>') ?>
28315eb316SGreg Roach    </div>
29dd6b2bfcSGreg Roach
30dd6b2bfcSGreg Roach    <div class="card">
314c3814d0SGreg Roach        <label class="card-header py-1 px-2" for="level0">
3239ca88baSGreg Roach            <?= $record->fullName() ?>
33dd6b2bfcSGreg Roach        </label>
344c3814d0SGreg Roach        <textarea class="card-body form-control py-1 px-2" id="level0" name="level0" rows="1" dir="ltr" readonly><?= e($level0) ?></textarea>
35dd6b2bfcSGreg Roach    </div>
36dd6b2bfcSGreg Roach
3792044e0dSGreg Roach    <div class="wt-sortable-list">
387bb122d6SGreg Roach        <?php foreach ($record->facts([], false, null, true) as $fact) : ?>
3992044e0dSGreg Roach            <div class="card my-2 wt-sortable-item">
409ba7eeb1SGreg Roach                <input type="hidden" name="fact_id[]" value="<?= e($fact->id()) ?>">
4192044e0dSGreg Roach                <div class="card-header">
4292044e0dSGreg Roach                    <?= view('edit/reorder-card-header', ['title' => $fact->summary()]) ?>
4392044e0dSGreg Roach                </div>
44315eb316SGreg Roach                <label class="visually-hidden" for="fact-<?= e($fact->id()) ?>"><?= $fact->summary() ?></label>
4592044e0dSGreg Roach
46c67a93abSGreg 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>
47dd6b2bfcSGreg Roach            </div>
48dd6b2bfcSGreg Roach        <?php endforeach ?>
49dd6b2bfcSGreg Roach
50dd6b2bfcSGreg Roach        <div class="card my-2">
51dd6b2bfcSGreg Roach            <label class="card-header py-1 px-2" for="fact-add">
52dd6b2bfcSGreg Roach                <?= I18N::translate('Add a fact') ?>
53dd6b2bfcSGreg Roach            </label>
54cd0fe2c5SGreg Roach            <input type="hidden" name="fact_id[]" value="">
55c67a93abSGreg Roach            <textarea class="card-body form-control py-1 px-2" dir="ltr" id="fact-add" name="fact[]" rows="5"></textarea>
56dd6b2bfcSGreg Roach        </div>
57dd6b2bfcSGreg Roach    </div>
58dd6b2bfcSGreg Roach
59*9e3c2cf9SGreg Roach    <div class="row mb-3">
60dd6b2bfcSGreg Roach        <div class="col-sm-9 offset-sm-3">
61dd6b2bfcSGreg Roach            <button class="btn btn-primary" type="submit">
62d993d560SGreg Roach                <?= view('icons/save') ?>
63dd6b2bfcSGreg Roach                <?= /* I18N: A button label. */ I18N::translate('save') ?>
64dd6b2bfcSGreg Roach            </button>
65dd6b2bfcSGreg Roach            <a class="btn btn-secondary" href="<?= e($record->url()) ?>">
66d993d560SGreg Roach                <?= view('icons/cancel') ?>
67dd6b2bfcSGreg Roach                <?= /* I18N: A button label. */ I18N::translate('cancel') ?>
68dd6b2bfcSGreg Roach            </a>
69dd6b2bfcSGreg Roach        </div>
70dd6b2bfcSGreg Roach    </div>
71dd6b2bfcSGreg Roach</form>
72dd6b2bfcSGreg Roach
73dd6b2bfcSGreg Roach<?php View::push('javascript') ?>
74dd6b2bfcSGreg Roach<script>
7592044e0dSGreg Roach    new Sortable(document.querySelector(".wt-sortable-list"), {
7692044e0dSGreg Roach        handle: ".card-header",
77dd6b2bfcSGreg Roach    });
78dd6b2bfcSGreg Roach</script>
79dd6b2bfcSGreg Roach<?php View::endpush() ?>
80