xref: /webtrees/resources/views/admin/locations.phtml (revision dd6b2bfcc550270bb6d6778e11576148f71e4330)
1*dd6b2bfcSGreg Roach<?php use Fisharebest\Webtrees\Bootstrap4; ?>
2*dd6b2bfcSGreg Roach<?php use Fisharebest\Webtrees\FontAwesome; ?>
3*dd6b2bfcSGreg Roach<?php use Fisharebest\Webtrees\I18N; ?>
4*dd6b2bfcSGreg Roach<?php use Fisharebest\Webtrees\Tree; ?>
5*dd6b2bfcSGreg Roach
6*dd6b2bfcSGreg Roach<?= view('components/breadcrumbs', ['links' => $breadcrumbs]) ?>
7*dd6b2bfcSGreg Roach
8*dd6b2bfcSGreg Roach<h1><?= $title ?></h1>
9*dd6b2bfcSGreg Roach
10*dd6b2bfcSGreg Roach<table class="table table-bordered table-striped table-sm table-hover">
11*dd6b2bfcSGreg Roach    <thead class="thead-dark">
12*dd6b2bfcSGreg Roach    <tr>
13*dd6b2bfcSGreg Roach        <th><?= I18N::translate('Place') ?></th>
14*dd6b2bfcSGreg Roach        <th><?= I18N::translate('Latitude') ?></th>
15*dd6b2bfcSGreg Roach        <th><?= I18N::translate('Longitude') ?></th>
16*dd6b2bfcSGreg Roach        <th><?= I18N::translate('Zoom level') ?></th>
17*dd6b2bfcSGreg Roach        <th><?= I18N::translate('Flag') ?> </th>
18*dd6b2bfcSGreg Roach        <th><?= I18N::translate('Edit') ?></th>
19*dd6b2bfcSGreg Roach        <th><?= I18N::translate('Delete') ?></th>
20*dd6b2bfcSGreg Roach    </tr>
21*dd6b2bfcSGreg Roach    </thead>
22*dd6b2bfcSGreg Roach    <tbody>
23*dd6b2bfcSGreg Roach
24*dd6b2bfcSGreg Roach    <?php foreach ($placelist as $place) : ?>
25*dd6b2bfcSGreg Roach        <tr>
26*dd6b2bfcSGreg Roach            <th scope="row">
27*dd6b2bfcSGreg Roach                <a href="<?= e(route('map-data', ['parent_id' => $place->pl_id])) ?>">
28*dd6b2bfcSGreg Roach                    <?= e($place->pl_place) ?>
29*dd6b2bfcSGreg Roach                    <span class="badge badge-pill badge-<?= $place->badge ?>">
30*dd6b2bfcSGreg Roach                        <?= I18N::number($place->child_count) ?>
31*dd6b2bfcSGreg Roach                    </span>
32*dd6b2bfcSGreg Roach                </a>
33*dd6b2bfcSGreg Roach            </th>
34*dd6b2bfcSGreg Roach            <td>
35*dd6b2bfcSGreg Roach                <?= ($place->pl_lati === null) ? FontAwesome::decorativeIcon('warning') : strtr($place->pl_lati, ['N' => '', 'S' => '-', ',' => '.']) ?>
36*dd6b2bfcSGreg Roach            </td>
37*dd6b2bfcSGreg Roach            <td>
38*dd6b2bfcSGreg Roach                <?= ($place->pl_long === null) ? FontAwesome::decorativeIcon('warning') : strtr($place->pl_long, ['E' => '', 'W' => '-', ',' => '.']) ?>
39*dd6b2bfcSGreg Roach            </td>
40*dd6b2bfcSGreg Roach            <td>
41*dd6b2bfcSGreg Roach                <?= $place->pl_long === null ? FontAwesome::decorativeIcon('warning') : $place->pl_zoom ?>
42*dd6b2bfcSGreg Roach            </td>
43*dd6b2bfcSGreg Roach            <td>
44*dd6b2bfcSGreg Roach                <?php if (is_file(WT_MODULES_DIR . 'openstreetmap' . '/' . $place->pl_icon)) : ?>
45*dd6b2bfcSGreg Roach                    <img src="<?= e(WT_MODULES_DIR . 'openstreetmap' . '/' . $place->pl_icon) ?>" width="25" height="15" alt="<?= I18N::translate("Flag of %s", $place->pl_place) ?>">
46*dd6b2bfcSGreg Roach                <?php endif ?>
47*dd6b2bfcSGreg Roach            </td>
48*dd6b2bfcSGreg Roach            <td>
49*dd6b2bfcSGreg Roach                <?= FontAwesome::linkIcon('edit', I18N::translate('Edit'), ['href' => route('map-data-edit', ['place_id'  => $place->pl_id, 'parent_id' => $place->pl_parent_id]), 'class' => 'btn btn-primary']) ?>
50*dd6b2bfcSGreg Roach            </td>
51*dd6b2bfcSGreg Roach            <td>
52*dd6b2bfcSGreg Roach                <?php if ($place->child_count === 0) : ?>
53*dd6b2bfcSGreg Roach                    <form method="POST" action="<?= e(route('map-data-delete', ['parent_id' => $parent_id, 'place_id' => $place->pl_id])) ?>"
54*dd6b2bfcSGreg Roach                          data-confirm="<?= I18N::translate('Remove this location?') ?>"
55*dd6b2bfcSGreg Roach                          onsubmit="return confirm(this.dataset.confirm)">
56*dd6b2bfcSGreg Roach                        <?= csrf_field() ?>
57*dd6b2bfcSGreg Roach                        <button type="submit" class="btn btn-danger">
58*dd6b2bfcSGreg Roach                            <?= FontAwesome::semanticIcon('delete', I18N::translate('delete')) ?>
59*dd6b2bfcSGreg Roach                        </button>
60*dd6b2bfcSGreg Roach                    </form>
61*dd6b2bfcSGreg Roach                <?php else : ?>
62*dd6b2bfcSGreg Roach                    <button type="button" class="btn btn-danger" disabled>
63*dd6b2bfcSGreg Roach                        <?= FontAwesome::decorativeIcon('delete') ?>
64*dd6b2bfcSGreg Roach                    </button>
65*dd6b2bfcSGreg Roach                <?php endif ?>
66*dd6b2bfcSGreg Roach            </td>
67*dd6b2bfcSGreg Roach        </tr>
68*dd6b2bfcSGreg Roach    <?php endforeach ?>
69*dd6b2bfcSGreg Roach    </tbody>
70*dd6b2bfcSGreg Roach    <tfoot>
71*dd6b2bfcSGreg Roach    <tr>
72*dd6b2bfcSGreg Roach        <td colspan="7">
73*dd6b2bfcSGreg Roach            <a class="btn btn-primary" href="<?= e(route('map-data', ['parent_id' => $parent_id])) ?>">
74*dd6b2bfcSGreg Roach                <?= FontAwesome::decorativeIcon('add') ?>
75*dd6b2bfcSGreg Roach                <?= /* I18N: A button label. */
76*dd6b2bfcSGreg Roach                I18N::translate('add place') ?>
77*dd6b2bfcSGreg Roach            </a>
78*dd6b2bfcSGreg Roach            <button class="btn btn-primary dropdown-toggle" type="button" id="dropdownMenuButton"
79*dd6b2bfcSGreg Roach                    data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
80*dd6b2bfcSGreg Roach                <?= FontAwesome::decorativeIcon('download') ?>
81*dd6b2bfcSGreg Roach                <?= /* I18N: A button label. */
82*dd6b2bfcSGreg Roach                I18N::translate('export file') ?>
83*dd6b2bfcSGreg Roach            </button>
84*dd6b2bfcSGreg Roach            <div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
85*dd6b2bfcSGreg Roach                <a class="dropdown-item" href="<?= e(route('locations-export', ['parent_id' => $parent_id, 'format' => 'csv'])) ?>">
86*dd6b2bfcSGreg Roach                    csv
87*dd6b2bfcSGreg Roach                </a>
88*dd6b2bfcSGreg Roach                <a class="dropdown-item" href="<?= e(route('locations-export', ['parent_id' => $parent_id, 'format' => 'geojson'])) ?>">
89*dd6b2bfcSGreg Roach                    geoJSON
90*dd6b2bfcSGreg Roach                </a>
91*dd6b2bfcSGreg Roach            </div>
92*dd6b2bfcSGreg Roach            <a class="btn btn-primary" href="<?= e(route('locations-import', ['parent_id' => $parent_id])) ?>">
93*dd6b2bfcSGreg Roach                <?= FontAwesome::decorativeIcon('upload') ?>
94*dd6b2bfcSGreg Roach                <?= /* I18N: A button label. */
95*dd6b2bfcSGreg Roach                I18N::translate('import file') ?>
96*dd6b2bfcSGreg Roach            </a>
97*dd6b2bfcSGreg Roach        </td>
98*dd6b2bfcSGreg Roach    </tr>
99*dd6b2bfcSGreg Roach    </tfoot>
100*dd6b2bfcSGreg Roach</table>
101*dd6b2bfcSGreg Roach
102*dd6b2bfcSGreg Roach<form method="POST" action="<?= e(route('locations-import-from-tree')) ?>">
103*dd6b2bfcSGreg Roach    <?= csrf_field() ?>
104*dd6b2bfcSGreg Roach
105*dd6b2bfcSGreg Roach    <div class="form-group row">
106*dd6b2bfcSGreg Roach        <label class="form-control-plaintext col-sm-4" for="ged">
107*dd6b2bfcSGreg Roach            <?= I18N::translate('Import all places from a family tree') ?>
108*dd6b2bfcSGreg Roach        </label>
109*dd6b2bfcSGreg Roach        <div class="col-sm-6">
110*dd6b2bfcSGreg Roach            <?= Bootstrap4::select(
111*dd6b2bfcSGreg Roach                Tree::getNameList(),
112*dd6b2bfcSGreg Roach                '',
113*dd6b2bfcSGreg Roach                ['id' => 'ged', 'name' => 'ged']
114*dd6b2bfcSGreg Roach            ) ?>
115*dd6b2bfcSGreg Roach        </div>
116*dd6b2bfcSGreg Roach        <div class="col-sm-2">
117*dd6b2bfcSGreg Roach            <button type="submit" class="btn btn-primary">
118*dd6b2bfcSGreg Roach                <?= view('icons/upload') ?>
119*dd6b2bfcSGreg Roach                <?= /* I18N: A button label. */
120*dd6b2bfcSGreg Roach                I18N::translate('import') ?>
121*dd6b2bfcSGreg Roach            </button>
122*dd6b2bfcSGreg Roach        </div>
123*dd6b2bfcSGreg Roach    </div>
124*dd6b2bfcSGreg Roach</form>
125