1d70512abSGreg Roach<?php 2d70512abSGreg Roach 3d70512abSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\ControlPanel; 4*4b3ef6caSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\FixLevel0MediaAction; 5*4b3ef6caSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\FixLevel0MediaData; 6d70512abSGreg Roachuse Fisharebest\Webtrees\I18N; 7d70512abSGreg Roach 8d70512abSGreg Roach?> 9dd6b2bfcSGreg Roach<?php use Fisharebest\Webtrees\View; ?> 10dd6b2bfcSGreg Roach 110c0910bfSGreg Roach<?= view('components/breadcrumbs', ['links' => [route(ControlPanel::class) => I18N::translate('Control panel'), $title]]) ?> 12dd6b2bfcSGreg Roach 13dd6b2bfcSGreg Roach<h1><?= $title ?></h1> 14dd6b2bfcSGreg Roach 15dd6b2bfcSGreg Roach<p> 16dd6b2bfcSGreg Roach <?= I18N::translate('If a media object is linked to an individual, when it should be linked to a fact or event, then you can move it to the correct location.') ?> 17dd6b2bfcSGreg Roach</p> 18dd6b2bfcSGreg Roach 1971d313c5SGreg Roach<table 20b4139381SGreg Roach class="table table-bordered table-sm table-hover wt-fix-table datatables d-none" 2171d313c5SGreg Roach <?= view('lists/datatables-attributes') ?> 22*4b3ef6caSGreg Roach data-ajax="<?= e(json_encode(['url' => route(FixLevel0MediaData::class)])) ?>" 2371d313c5SGreg Roach data-server-side="true" 2471d313c5SGreg Roach> 25dd6b2bfcSGreg Roach <caption class="sr-only"> 26dd6b2bfcSGreg Roach <?= I18N::translate('Media objects') ?> 27dd6b2bfcSGreg Roach </caption> 28dd6b2bfcSGreg Roach <thead class="thead-dark"> 29dd6b2bfcSGreg Roach <tr> 30dd6b2bfcSGreg Roach <th data-sortable="false"><?= I18N::translate('Family tree') ?></th> 31dd6b2bfcSGreg Roach <th data-sortable="false"><?= I18N::translate('Media object') ?></th> 32dd6b2bfcSGreg Roach <th data-sortable="false"><?= I18N::translate('Title') ?></th> 33dd6b2bfcSGreg Roach <th data-sortable="false"><?= I18N::translate('Individual') ?></th> 34dd6b2bfcSGreg Roach <th data-sortable="false"><?= I18N::translate('Facts and events') ?></th> 35dd6b2bfcSGreg Roach </tr> 36dd6b2bfcSGreg Roach </thead> 37dd6b2bfcSGreg Roach</table> 38dd6b2bfcSGreg Roach 39dd6b2bfcSGreg Roach<?php View::push('javascript') ?> 40dd6b2bfcSGreg Roach<script> 41dd6b2bfcSGreg Roach 'use strict'; 42dd6b2bfcSGreg Roach 43dd6b2bfcSGreg Roach // If we click on a button, post the request and reload the table 44dd6b2bfcSGreg Roach document.querySelector(".wt-fix-table").onclick = function (event) { 45dd6b2bfcSGreg Roach let element = event.target; 46dd6b2bfcSGreg Roach if (element.classList.contains("wt-fix-button")) { 47dd6b2bfcSGreg Roach event.stopPropagation(); 48dd6b2bfcSGreg Roach if (confirm(element.dataset.confirm)) { 49dd6b2bfcSGreg Roach $.ajax({ 50dd6b2bfcSGreg Roach data: { 51dd6b2bfcSGreg Roach "fact_id": element.dataset.factId, 52dd6b2bfcSGreg Roach "indi_xref": element.dataset.individualXref, 53dd6b2bfcSGreg Roach "obje_xref": element.dataset.mediaXref, 54dd6b2bfcSGreg Roach "tree_id": element.dataset.treeId 55dd6b2bfcSGreg Roach }, 56dd6b2bfcSGreg Roach method: "POST", 57*4b3ef6caSGreg Roach url: <?= json_encode(route(FixLevel0MediaAction::class)) ?> 58dd6b2bfcSGreg Roach }).done(function () { 59dd6b2bfcSGreg Roach $(".wt-fix-table").DataTable().ajax.reload(null, false); 60dd6b2bfcSGreg Roach }); 61dd6b2bfcSGreg Roach } 62dd6b2bfcSGreg Roach } 63dd6b2bfcSGreg Roach }; 64dd6b2bfcSGreg Roach</script> 65dd6b2bfcSGreg Roach<?php View::endpush() ?> 66