xref: /webtrees/resources/views/edit/reorder-names.phtml (revision 7d70e4a7551f406d455dd5e56ab783c194bb5a1b)
15229eadeSGreg Roach<?php
25229eadeSGreg Roach
35229eadeSGreg Roachuse Fisharebest\Webtrees\GedcomCode\GedcomCodeName;
475b444f7SGreg Roachuse Fisharebest\Webtrees\GedcomTag;
55229eadeSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\ReorderNamesAction;
675b444f7SGreg Roachuse Fisharebest\Webtrees\I18N;
7*7d70e4a7SGreg Roachuse Fisharebest\Webtrees\Individual;
8*7d70e4a7SGreg Roachuse Fisharebest\Webtrees\Tree;
95229eadeSGreg Roachuse Fisharebest\Webtrees\View;
105229eadeSGreg Roach
11*7d70e4a7SGreg Roach/**
12*7d70e4a7SGreg Roach * @var Individual $individual
13*7d70e4a7SGreg Roach * @var string     $title
14*7d70e4a7SGreg Roach * @var Tree       $tree
15*7d70e4a7SGreg Roach */
16*7d70e4a7SGreg Roach
175229eadeSGreg Roach?>
18dd6b2bfcSGreg Roach
19dd6b2bfcSGreg Roach<h2 class="wt-page-title"><?= $title ?></h2>
20dd6b2bfcSGreg Roach
21aabcb63cSGreg Roach<form method="post" action="<?= e(route(ReorderNamesAction::class, ['tree' => $tree->name(), 'xref' => $individual->xref()])) ?>" class="wt-page-content">
22dd6b2bfcSGreg Roach    <?= csrf_field() ?>
2383615acfSGreg Roach
24dd6b2bfcSGreg Roach    <div class="wt-sortable-list">
257bb122d6SGreg Roach        <?php foreach ($individual->facts(['NAME'], false, null, true) as $fact) : ?>
2692044e0dSGreg Roach            <div class="card my-2 wt-sortable-item">
27905ab80aSGreg Roach                <input type="hidden" name="order[]" value="<?= $fact->id() ?>">
2875b444f7SGreg Roach                <div class="card-header">
2992044e0dSGreg Roach                    <?= view('edit/reorder-card-header', ['title' => e($fact->value())]) ?>
3075b444f7SGreg Roach                </div>
3192044e0dSGreg Roach
32dd6b2bfcSGreg Roach                <div class="card-body">
333425616eSGreg Roach                    <?= GedcomTag::getLabelValue('TYPE', GedcomCodeName::getValue($fact->attribute('TYPE'), $fact->record())) ?>
34dd6b2bfcSGreg Roach                </div>
35dd6b2bfcSGreg Roach            </div>
36dd6b2bfcSGreg Roach        <?php endforeach ?>
37dd6b2bfcSGreg Roach    </div>
38dd6b2bfcSGreg Roach
39dd6b2bfcSGreg Roach    <p>
40dd6b2bfcSGreg Roach        <button class="btn btn-primary" type="submit">
41d993d560SGreg Roach            <?= view('icons/save') ?>
42dd6b2bfcSGreg Roach            <?= /* I18N: A button label. */ I18N::translate('save') ?>
43dd6b2bfcSGreg Roach        </button>
44dd6b2bfcSGreg Roach
45dd6b2bfcSGreg Roach        <a class="btn btn-secondary" href="<?= e($individual->url()) ?>">
46d993d560SGreg Roach            <?= view('icons/cancel') ?>
47dd6b2bfcSGreg Roach            <?= /* I18N: A button label. */ I18N::translate('cancel') ?>
48dd6b2bfcSGreg Roach        </a>
49dd6b2bfcSGreg Roach    </p>
50dd6b2bfcSGreg Roach</form>
51dd6b2bfcSGreg Roach
52dd6b2bfcSGreg Roach<?php View::push('javascript') ?>
53dd6b2bfcSGreg Roach<script>
5475b444f7SGreg Roach    new Sortable(document.querySelector(".wt-sortable-list"), {
5592044e0dSGreg Roach        handle: ".card-header",
5675b444f7SGreg Roach    });
57dd6b2bfcSGreg Roach</script>
58dd6b2bfcSGreg Roach<?php View::endpush() ?>
59