11e653452SGreg Roach<?php 21e653452SGreg Roach 310e06497SGreg Roachdeclare(strict_types=1); 410e06497SGreg Roach 590949315SGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\MapDataAdd; 694e35917SGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\MapDataDelete; 77b5ff3baSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\MapDataDeleteUnused; 890949315SGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\MapDataEdit; 990949315SGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\MapDataExportCSV; 1090949315SGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\MapDataExportGeoJson; 1190949315SGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\MapDataImportPage; 1294e35917SGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\MapDataList; 131e653452SGreg Roachuse Fisharebest\Webtrees\I18N; 1494e35917SGreg Roachuse Fisharebest\Webtrees\Module\PlaceHierarchyListModule; 15ed612bd3SGreg Roachuse Fisharebest\Webtrees\Tree; 16ed612bd3SGreg Roachuse Illuminate\Support\Collection; 171e653452SGreg Roach 1894e35917SGreg Roach/** 19f70bcff5SGreg Roach * @var array<object> $active 2036779af1SGreg Roach * @var Collection<int,Tree> $all_trees 2194e35917SGreg Roach * @var array<string,string> $breadcrumbs 2294e35917SGreg Roach * @var int $parent_id 231d7ba1fbSGreg Roach * @var array<object> $placelist 24ed612bd3SGreg Roach * @var PlaceHierarchyListModule|null $list_module 2594e35917SGreg Roach * @var string $title 2694e35917SGreg Roach */ 2794e35917SGreg Roach 281e653452SGreg Roach?> 29dd6b2bfcSGreg Roach 30dd6b2bfcSGreg Roach<?= view('components/breadcrumbs', ['links' => $breadcrumbs]) ?> 31dd6b2bfcSGreg Roach 32dd6b2bfcSGreg Roach<h1><?= $title ?></h1> 33dd6b2bfcSGreg Roach 34d2dac12aSGreg Roach<p> 35d2dac12aSGreg Roach <label> 360363a7fdSDavid Drury <input id="hide-unused-locations" type="checkbox" data-bs-toggle="collapse" data-bs-target=".unused-location" data-wt-persist="hide-unused-locations" autocomplete="off"> 37d2dac12aSGreg Roach <?= I18N::translate('Hide unused locations') ?> 38d2dac12aSGreg Roach </label> 39d2dac12aSGreg Roach</p> 40d2dac12aSGreg Roach 41d2dac12aSGreg Roach<table class="table table-bordered table-striped table-sm table-hover wt-table-locations"> 42dd6b2bfcSGreg Roach <thead class="thead-dark"> 43dd6b2bfcSGreg Roach <tr> 44dd6b2bfcSGreg Roach <th><?= I18N::translate('Place') ?></th> 45dd6b2bfcSGreg Roach <th><?= I18N::translate('Latitude') ?></th> 46dd6b2bfcSGreg Roach <th><?= I18N::translate('Longitude') ?></th> 47e340fe65SGreg Roach <!-- 48dd6b2bfcSGreg Roach <th><?= I18N::translate('Flag') ?> </th> 49e340fe65SGreg Roach --> 50dd6b2bfcSGreg Roach <th><?= I18N::translate('Edit') ?></th> 5194e35917SGreg Roach <th><?= I18N::translate('Facts and events') ?></th> 52dd6b2bfcSGreg Roach <th><?= I18N::translate('Delete') ?></th> 53dd6b2bfcSGreg Roach </tr> 54dd6b2bfcSGreg Roach </thead> 55dd6b2bfcSGreg Roach 567039fd97SGreg Roach <tbody> 57dd6b2bfcSGreg Roach <?php foreach ($placelist as $place) : ?> 5890949315SGreg Roach <tr class="<?= $active[$place->key] ?? null ? '' : 'unused-location collapse show' ?>"> 59dd6b2bfcSGreg Roach <th scope="row"> 6090949315SGreg Roach <a href="<?= e(route(MapDataList::class, ['parent_id' => $place->id])) ?>"> 61315eb316SGreg Roach <bdi><?= e($place->place) ?></bdi> 6294e35917SGreg Roach <?php if ($place->no_coord > 0) : ?> 634ab569c4SGreg Roach <span class="badge bg-secondary rounded-pill"> 6494e35917SGreg Roach <?= view('icons/warning') ?> 6594e35917SGreg Roach <?= I18N::number($place->no_coord) ?> 6694e35917SGreg Roach / 67dd6b2bfcSGreg Roach <?= I18N::number($place->child_count) ?> 68dd6b2bfcSGreg Roach </span> 6994e35917SGreg Roach <?php elseif ($place->child_count > 0) : ?> 704ab569c4SGreg Roach <span class="badge bg-secondary rounded-pill"> 7194e35917SGreg Roach <?= I18N::number($place->child_count) ?> 7294e35917SGreg Roach </span> 7394e35917SGreg Roach <?php endif ?> 74dd6b2bfcSGreg Roach </a> 75dd6b2bfcSGreg Roach </th> 76d993d560SGreg Roach 770e7a2d23SGreg Roach <td dir="ltr"> 7890949315SGreg Roach <?php if ($place->latitude === null) : ?> 79d993d560SGreg Roach <?= view('icons/warning') ?> 80d993d560SGreg Roach <?php else : ?> 8190949315SGreg Roach <?= $place->latitude ?> 82d993d560SGreg Roach <?php endif ?> 83dd6b2bfcSGreg Roach </td> 84d993d560SGreg Roach 850e7a2d23SGreg Roach <td dir="ltr"> 8690949315SGreg Roach <?php if ($place->longitude === null) : ?> 87d993d560SGreg Roach <?= view('icons/warning') ?> 88d993d560SGreg Roach <?php else : ?> 8990949315SGreg Roach <?= $place->longitude ?> 90d993d560SGreg Roach <?php endif ?> 91dd6b2bfcSGreg Roach </td> 92d993d560SGreg Roach 93dd6b2bfcSGreg Roach <td> 94*0e54db38SGreg Roach <a class="btn btn-primary" href="<?= e(route(MapDataEdit::class, ['location_id' => $place->id])) ?>" title="<?= I18N::translate('Edit') ?>"> 9539b853a7SGreg Roach <?= view('icons/edit') ?> 96315eb316SGreg Roach <span class="visually-hidden"> 9739b853a7SGreg Roach <?= I18N::translate('Edit') ?> 9839b853a7SGreg Roach </span> 9939b853a7SGreg Roach </a> 100dd6b2bfcSGreg Roach </td> 101d993d560SGreg Roach 102dd6b2bfcSGreg Roach <td> 10390949315SGreg Roach <?php if ($list_module !== null && array_key_exists($place->key, $active)) : ?> 10490949315SGreg Roach <?php if (count($active[$place->key]) === 1) : ?> 10590949315SGreg Roach <a class="btn btn-link" href="<?= e($list_module->listUrl($all_trees->get($active[$place->key][0]->tree_name), ['place_id' => $active[$place->key][0]->p_id, 'action2' => 'hierarchy-e'])) ?>"> 10690949315SGreg Roach <?= e($active[$place->key][0]->tree_title) ?> 10794e35917SGreg Roach </a> 10894e35917SGreg Roach <?php else : ?> 10994e35917SGreg Roach <div class="dropdown"> 110315eb316SGreg Roach <a class="btn btn-link dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> 11190949315SGreg Roach <?= I18N::plural('%s family tree', '%s family trees', count($active[$place->key]), I18N::number(count($active[$place->key]))) ?> 11294e35917SGreg Roach </a> 11394e35917SGreg Roach 11494e35917SGreg Roach <div class="dropdown-menu" aria-labelledby="dropdownMenuLink"> 115a8dca90aSGreg Roach <?php foreach ($active[$place->key] as $n => $link) : ?> 116a8dca90aSGreg Roach <a class="dropdown-item" href="<?= e($list_module->listUrl($all_trees->get($active[$place->key][$n]->tree_name), ['place_id' => $link->p_id])) ?>"> 11794e35917SGreg Roach <?= e($link->tree_title) ?> 11894e35917SGreg Roach </a> 11994e35917SGreg Roach <?php endforeach ?> 12094e35917SGreg Roach </div> 12194e35917SGreg Roach </div> 12294e35917SGreg Roach <?php endif ?> 12394e35917SGreg Roach <?php endif ?> 12494e35917SGreg Roach </td> 12594e35917SGreg Roach 12694e35917SGreg Roach <td> 12790949315SGreg Roach <?php if (!array_key_exists($place->key, $active)) : ?> 12890949315SGreg Roach <form method="post" action="<?= e(route(MapDataDelete::class, ['place_id' => $place->id])) ?>"> 129d4786c66SGreg Roach <button type="submit" class="btn btn-danger" aria-label="<?= I18N::translate('delete') ?>" data-wt-confirm="<?= I18N::translate('Remove this location?') ?>"> 1306a83cfe8SGreg Roach <?= view('icons/delete') ?> 131dd6b2bfcSGreg Roach </button> 13281443e3cSGreg Roach 13381443e3cSGreg Roach <?= csrf_field() ?> 134dd6b2bfcSGreg Roach </form> 135dd6b2bfcSGreg Roach <?php endif ?> 136dd6b2bfcSGreg Roach </td> 137dd6b2bfcSGreg Roach </tr> 138dd6b2bfcSGreg Roach <?php endforeach ?> 139dd6b2bfcSGreg Roach </tbody> 1407039fd97SGreg Roach 141dd6b2bfcSGreg Roach <tfoot> 142dd6b2bfcSGreg Roach <tr> 1437b5ff3baSGreg Roach <td colspan="4"> 14490949315SGreg Roach <a class="btn btn-primary" href="<?= e(route(MapDataAdd::class, ['parent_id' => $parent_id])) ?>"> 145d993d560SGreg Roach <?= view('icons/add') ?> 146dd6b2bfcSGreg Roach <?= /* I18N: A button label. */ 147dd6b2bfcSGreg Roach I18N::translate('add place') ?> 148dd6b2bfcSGreg Roach </a> 149dd6b2bfcSGreg Roach <button class="btn btn-primary dropdown-toggle" type="button" id="dropdownMenuButton" 150315eb316SGreg Roach data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> 151d993d560SGreg Roach <?= view('icons/download') ?> 152dd6b2bfcSGreg Roach <?= /* I18N: A button label. */ 153dd6b2bfcSGreg Roach I18N::translate('export file') ?> 154dd6b2bfcSGreg Roach </button> 155dd6b2bfcSGreg Roach <div class="dropdown-menu" aria-labelledby="dropdownMenuButton"> 15690949315SGreg Roach <a class="dropdown-item" href="<?= e(route(MapDataExportCSV::class, ['parent_id' => $parent_id])) ?>"> 157dd6b2bfcSGreg Roach csv 158dd6b2bfcSGreg Roach </a> 15990949315SGreg Roach <a class="dropdown-item" href="<?= e(route(MapDataExportGeoJson::class, ['parent_id' => $parent_id])) ?>"> 160dd6b2bfcSGreg Roach geoJSON 161dd6b2bfcSGreg Roach </a> 162dd6b2bfcSGreg Roach </div> 16390949315SGreg Roach <a class="btn btn-primary" href="<?= e(route(MapDataImportPage::class, ['parent_id' => $parent_id])) ?>"> 164d993d560SGreg Roach <?= view('icons/upload') ?> 165dd6b2bfcSGreg Roach <?= /* I18N: A button label. */ 166dd6b2bfcSGreg Roach I18N::translate('import file') ?> 167dd6b2bfcSGreg Roach </a> 168dd6b2bfcSGreg Roach </td> 1697b5ff3baSGreg Roach <td colspan="2"> 1707b5ff3baSGreg Roach <?php if (count($active) !== count($placelist)) : ?> 1719e3c2cf9SGreg Roach <form class="d-inline" method="post" action="<?= route(MapDataDeleteUnused::class) ?>"> 1727b5ff3baSGreg Roach <button type="submit" class="btn btn-danger"> 1737b5ff3baSGreg Roach <?= view('icons/delete') ?> 1747b5ff3baSGreg Roach <?= I18N::translate('Delete unused locations') ?> 1757b5ff3baSGreg Roach </button> 17681443e3cSGreg Roach 17781443e3cSGreg Roach <?= csrf_field() ?> 1787b5ff3baSGreg Roach </form> 1797b5ff3baSGreg Roach <?php endif ?> 1807b5ff3baSGreg Roach </td> 181dd6b2bfcSGreg Roach </tr> 182dd6b2bfcSGreg Roach </tfoot> 183dd6b2bfcSGreg Roach</table> 184