xref: /webtrees/resources/views/edit/raw-gedcom-record.phtml (revision 7c2c99fad7cacd17c98be88238ff735d82c6351b)
13b3db8adSGreg Roach<?php
23b3db8adSGreg Roach
3*7c2c99faSGreg Roachuse Fisharebest\Webtrees\GedcomRecord;
42917771cSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\EditRawRecordAction;
53b3db8adSGreg Roachuse Fisharebest\Webtrees\I18N;
6*7c2c99faSGreg Roachuse Fisharebest\Webtrees\Tree;
73b3db8adSGreg Roachuse Fisharebest\Webtrees\View;
89d7cdf93SGreg Roachuse Fisharebest\Webtrees\Webtrees;
93b3db8adSGreg Roach
10*7c2c99faSGreg Roach/**
11*7c2c99faSGreg Roach * @var string       $level0
12*7c2c99faSGreg Roach * @var GedcomRecord $record
13*7c2c99faSGreg Roach * @var string       $title
14*7c2c99faSGreg Roach * @var Tree         $tree
15*7c2c99faSGreg Roach */
16*7c2c99faSGreg 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
24dd6b2bfcSGreg Roach    <p class="text-muted small">
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.') ?>
26dd6b2bfcSGreg Roach    </p>
27dd6b2bfcSGreg Roach    <p class="text-muted small">
289d7cdf93SGreg 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>') ?>
29dd6b2bfcSGreg Roach    </p>
30dd6b2bfcSGreg Roach
31dd6b2bfcSGreg Roach    <div class="card">
32dd6b2bfcSGreg Roach        <label class="card-header py-1 px-2" for="fact0">
3339ca88baSGreg Roach            <?= $record->fullName() ?>
34dd6b2bfcSGreg Roach        </label>
3561f0428aSGreg Roach        <textarea class="card-body form-control py-1 px-2" id="fact0" rows="1" dir="ltr" readonly disabled><?= e($level0) ?></textarea>
36dd6b2bfcSGreg Roach    </div>
37dd6b2bfcSGreg Roach
3892044e0dSGreg Roach    <div class="wt-sortable-list">
397bb122d6SGreg Roach        <?php foreach ($record->facts([], false, null, true) as $fact) : ?>
4092044e0dSGreg Roach            <div class="card my-2 wt-sortable-item">
419ba7eeb1SGreg Roach                <input type="hidden" name="fact_id[]" value="<?= e($fact->id()) ?>">
4292044e0dSGreg Roach                <div class="card-header">
4392044e0dSGreg Roach                    <?= view('edit/reorder-card-header', ['title' => $fact->summary()]) ?>
4492044e0dSGreg Roach                </div>
4592044e0dSGreg Roach                <label class="sr-only" for="fact-<?= e($fact->id()) ?>"><?= $fact->summary() ?></label>
4692044e0dSGreg Roach
47c67a93abSGreg 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>
48dd6b2bfcSGreg Roach            </div>
49dd6b2bfcSGreg Roach        <?php endforeach ?>
50dd6b2bfcSGreg Roach
51dd6b2bfcSGreg Roach        <div class="card my-2">
52dd6b2bfcSGreg Roach            <label class="card-header py-1 px-2" for="fact-add">
53dd6b2bfcSGreg Roach                <?= I18N::translate('Add a fact') ?>
54dd6b2bfcSGreg Roach            </label>
55cd0fe2c5SGreg Roach            <input type="hidden" name="fact_id[]" value="">
56c67a93abSGreg Roach            <textarea class="card-body form-control py-1 px-2" dir="ltr" id="fact-add" name="fact[]" rows="5"></textarea>
57dd6b2bfcSGreg Roach        </div>
58dd6b2bfcSGreg Roach    </div>
59dd6b2bfcSGreg Roach
60dd6b2bfcSGreg Roach    <div class="row form-group">
61dd6b2bfcSGreg Roach        <div class="col-sm-9 offset-sm-3">
62dd6b2bfcSGreg Roach            <button class="btn btn-primary" type="submit">
63d993d560SGreg Roach                <?= view('icons/save') ?>
64dd6b2bfcSGreg Roach                <?= /* I18N: A button label. */ I18N::translate('save') ?>
65dd6b2bfcSGreg Roach            </button>
66dd6b2bfcSGreg Roach            <a class="btn btn-secondary" href="<?= e($record->url()) ?>">
67d993d560SGreg Roach                <?= view('icons/cancel') ?>
68dd6b2bfcSGreg Roach                <?= /* I18N: A button label. */ I18N::translate('cancel') ?>
69dd6b2bfcSGreg Roach            </a>
70dd6b2bfcSGreg Roach        </div>
71dd6b2bfcSGreg Roach    </div>
72dd6b2bfcSGreg Roach</form>
73dd6b2bfcSGreg Roach
74dd6b2bfcSGreg Roach<?php View::push('javascript') ?>
75dd6b2bfcSGreg Roach<script>
7692044e0dSGreg Roach    new Sortable(document.querySelector(".wt-sortable-list"), {
7792044e0dSGreg Roach        handle: ".card-header",
78dd6b2bfcSGreg Roach    });
79dd6b2bfcSGreg Roach</script>
80dd6b2bfcSGreg Roach<?php View::endpush() ?>
81