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