192044e0dSGreg Roach<?php 292044e0dSGreg Roach 3*10e06497SGreg Roachdeclare(strict_types=1); 4*10e06497SGreg Roach 592044e0dSGreg Roachuse Fisharebest\Webtrees\I18N; 692044e0dSGreg Roachuse Fisharebest\Webtrees\View; 792044e0dSGreg Roach 892044e0dSGreg Roach/** 992044e0dSGreg Roach * @var string $title 1092044e0dSGreg Roach */ 1192044e0dSGreg Roach 1292044e0dSGreg Roach?> 1392044e0dSGreg Roach<div class="d-flex"> 1492044e0dSGreg Roach <button class="btn btn-outline-secondary btn-sm drag-handle"> 1592044e0dSGreg Roach <?= view('icons/drag-handle') ?> 1692044e0dSGreg Roach </button> 1792044e0dSGreg Roach 18315eb316SGreg Roach <div class="ms-2 me-auto"> 1992044e0dSGreg Roach <?= $title ?> 2092044e0dSGreg Roach </div> 2192044e0dSGreg Roach 2292044e0dSGreg Roach <div class="btn-group"> 2392044e0dSGreg Roach <button class="btn btn-outline-secondary btn-sm wt-btn-reorder wt-btn-reorder-first" type="button"> 2492044e0dSGreg Roach <?= I18N::translate('first') ?> 2592044e0dSGreg Roach </button> 2692044e0dSGreg Roach 2792044e0dSGreg Roach <button class="btn btn-outline-secondary btn-sm wt-btn-reorder wt-btn-reorder-previous" type="button"> 2892044e0dSGreg Roach <?= I18N::translate('up') ?> 2992044e0dSGreg Roach </button> 3092044e0dSGreg Roach 3192044e0dSGreg Roach <button class="btn btn-outline-secondary btn-sm wt-btn-reorder wt-btn-reorder-next" type="button"> 3292044e0dSGreg Roach <?= I18N::translate('down') ?> 3392044e0dSGreg Roach </button> 3492044e0dSGreg Roach 3592044e0dSGreg Roach <button class="btn btn-outline-secondary btn-sm wt-btn-reorder wt-btn-reorder-last" type="button"> 3692044e0dSGreg Roach <?= I18N::translate('last') ?> 3792044e0dSGreg Roach </button> 3892044e0dSGreg Roach </div> 3992044e0dSGreg Roach</div> 4092044e0dSGreg Roach 4192044e0dSGreg Roach<?php View::pushunique('javascript') ?> 4292044e0dSGreg Roach<script> 4392044e0dSGreg Roach document.body.addEventListener('click', function(event) { 4492044e0dSGreg Roach let target = event.target; 4592044e0dSGreg Roach 4692044e0dSGreg Roach if (target.matches('.wt-btn-reorder')) { 4792044e0dSGreg Roach let item = target.closest('.wt-sortable-item'); 4892044e0dSGreg Roach let list = target.closest('.wt-sortable-list'); 4992044e0dSGreg Roach 5092044e0dSGreg Roach if (target.matches('.wt-btn-reorder-first')) { 5192044e0dSGreg Roach list.insertBefore(item, list.childNodes[0]); 5292044e0dSGreg Roach } 5392044e0dSGreg Roach if (target.matches('.wt-btn-reorder-previous') && item.previousElementSibling) { 5492044e0dSGreg Roach list.insertBefore(item, item.previousElementSibling); 5592044e0dSGreg Roach } 5692044e0dSGreg Roach if (target.matches('.wt-btn-reorder-next') && item.nextElementSibling) { 5792044e0dSGreg Roach list.insertBefore(item.nextElementSibling, item); 5892044e0dSGreg Roach } 5992044e0dSGreg Roach if (target.matches('.wt-btn-reorder-last')) { 6092044e0dSGreg Roach list.insertBefore(item, null); 6192044e0dSGreg Roach } 6292044e0dSGreg Roach } 6392044e0dSGreg Roach }); 6492044e0dSGreg Roach</script> 6592044e0dSGreg Roach<?php View::endpushunique() ?> 66