xref: /webtrees/resources/views/edit/reorder-names.phtml (revision ad7270802ba57a28d195fc58fcc55f26458a779a)
1<?php use Fisharebest\Webtrees\GedcomCode\GedcomCodeName; ?>
2<?php use Fisharebest\Webtrees\GedcomTag; ?>
3<?php use Fisharebest\Webtrees\I18N; ?>
4<?php use Fisharebest\Webtrees\View; ?>
5
6<h2 class="wt-page-title"><?= $title ?></h2>
7
8<form class="wt-page-content" method="post">
9    <?= csrf_field() ?>
10    <div class="wt-sortable-list">
11        <?php foreach ($individual->facts(['NAME']) as $fact) : ?>
12            <div class="card mb-2 wt-sortable-item">
13                <input type="hidden" name="order[]" value="<?= $fact->id() ?>">
14                <h3 class="card-header">
15                    <?= view('icons/drag-handle') ?>
16                    <?= $fact->value() ?>
17                </h3>
18                <div class="card-body">
19                    <?= GedcomTag::getLabelValue('TYPE', GedcomCodeName::getValue($fact->attribute('TYPE'), $fact->record())) ?>
20                </div>
21            </div>
22        <?php endforeach ?>
23    </div>
24
25    <p>
26        <button class="btn btn-primary" type="submit">
27            <?= view('icons/save') ?>
28            <?= /* I18N: A button label. */ I18N::translate('save') ?>
29        </button>
30
31        <a class="btn btn-secondary" href="<?= e($individual->url()) ?>">
32            <?= view('icons/cancel') ?>
33            <?= /* I18N: A button label. */ I18N::translate('cancel') ?>
34        </a>
35    </p>
36</form>
37
38<?php View::push('javascript') ?>
39<script>
40  new Sortable(document.querySelector(".wt-sortable-list"), {});
41</script>
42<?php View::endpush() ?>
43