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