xref: /webtrees/resources/views/edit/reorder-names.phtml (revision 10e0649788c8d7d4974d81c048ca2b225df8f22e)
15229eadeSGreg Roach<?php
25229eadeSGreg Roach
3*10e06497SGreg Roachdeclare(strict_types=1);
4*10e06497SGreg Roach
55229eadeSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\ReorderNamesAction;
675b444f7SGreg Roachuse Fisharebest\Webtrees\I18N;
77d70e4a7SGreg Roachuse Fisharebest\Webtrees\Individual;
8c2ed51d1SGreg Roachuse Fisharebest\Webtrees\Registry;
97d70e4a7SGreg Roachuse Fisharebest\Webtrees\Tree;
105229eadeSGreg Roachuse Fisharebest\Webtrees\View;
115229eadeSGreg Roach
127d70e4a7SGreg Roach/**
137d70e4a7SGreg Roach * @var Individual $individual
147d70e4a7SGreg Roach * @var string     $title
157d70e4a7SGreg Roach * @var Tree       $tree
167d70e4a7SGreg Roach */
177d70e4a7SGreg Roach
185229eadeSGreg Roach?>
19dd6b2bfcSGreg Roach
20dd6b2bfcSGreg Roach<h2 class="wt-page-title"><?= $title ?></h2>
21dd6b2bfcSGreg Roach
22aabcb63cSGreg Roach<form method="post" action="<?= e(route(ReorderNamesAction::class, ['tree' => $tree->name(), 'xref' => $individual->xref()])) ?>" class="wt-page-content">
23dd6b2bfcSGreg Roach    <div class="wt-sortable-list">
247bb122d6SGreg Roach        <?php foreach ($individual->facts(['NAME'], false, null, true) as $fact) : ?>
2592044e0dSGreg Roach            <div class="card my-2 wt-sortable-item">
26905ab80aSGreg Roach                <input type="hidden" name="order[]" value="<?= $fact->id() ?>">
2775b444f7SGreg Roach                <div class="card-header">
2892044e0dSGreg Roach                    <?= view('edit/reorder-card-header', ['title' => e($fact->value())]) ?>
2975b444f7SGreg Roach                </div>
3092044e0dSGreg Roach
31dd6b2bfcSGreg Roach                <div class="card-body">
32c2ed51d1SGreg Roach                    <?= Registry::elementFactory()->make('INDI:NAME:TYPE')->value($fact->attribute('TYPE'), $tree) ?>
33dd6b2bfcSGreg Roach                </div>
34dd6b2bfcSGreg Roach            </div>
35dd6b2bfcSGreg Roach        <?php endforeach ?>
36dd6b2bfcSGreg Roach    </div>
37dd6b2bfcSGreg Roach
38dd6b2bfcSGreg Roach    <p>
39dd6b2bfcSGreg Roach        <button class="btn btn-primary" type="submit">
40d993d560SGreg Roach            <?= view('icons/save') ?>
41dd6b2bfcSGreg Roach            <?= /* I18N: A button label. */ I18N::translate('save') ?>
42dd6b2bfcSGreg Roach        </button>
43dd6b2bfcSGreg Roach
44dd6b2bfcSGreg Roach        <a class="btn btn-secondary" href="<?= e($individual->url()) ?>">
45d993d560SGreg Roach            <?= view('icons/cancel') ?>
46dd6b2bfcSGreg Roach            <?= /* I18N: A button label. */ I18N::translate('cancel') ?>
47dd6b2bfcSGreg Roach        </a>
48dd6b2bfcSGreg Roach    </p>
4981443e3cSGreg Roach
5081443e3cSGreg Roach    <?= csrf_field() ?>
51dd6b2bfcSGreg Roach</form>
52dd6b2bfcSGreg Roach
53dd6b2bfcSGreg Roach<?php View::push('javascript') ?>
54dd6b2bfcSGreg Roach<script>
5575b444f7SGreg Roach    new Sortable(document.querySelector(".wt-sortable-list"), {
5692044e0dSGreg Roach        handle: ".card-header",
5775b444f7SGreg Roach    });
58dd6b2bfcSGreg Roach</script>
59dd6b2bfcSGreg Roach<?php View::endpush() ?>
60