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