xref: /webtrees/resources/views/admin/map-import-form.phtml (revision 6c5ec5a2a844b94999976fc1cd158f8a62d75fa5)
1b6c326d8SGreg Roach<?php
2b6c326d8SGreg Roach
310e06497SGreg Roachdeclare(strict_types=1);
410e06497SGreg Roach
50c0910bfSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\ControlPanel;
690949315SGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\MapDataImportAction;
794e35917SGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\MapDataList;
8b6c326d8SGreg Roachuse Fisharebest\Webtrees\I18N;
9*6c5ec5a2SGreg Roachuse Fisharebest\Webtrees\View;
10b6c326d8SGreg Roach
1190949315SGreg Roach/**
1290949315SGreg Roach * @var array<string> $files
1390949315SGreg Roach * @var string        $folder
1490949315SGreg Roach * @var string        $title
1590949315SGreg Roach */
1690949315SGreg Roach
17b6c326d8SGreg Roach?>
18dd6b2bfcSGreg Roach
1994e35917SGreg Roach<?= view('components/breadcrumbs', ['links' => [route(ControlPanel::class) => I18N::translate('Control panel'), route(MapDataList::class)  => I18N::translate('Geographic data'), $title]]) ?>
20dd6b2bfcSGreg Roach
21dd6b2bfcSGreg Roach<h3><?= $title ?></h3>
22dd6b2bfcSGreg Roach
2390949315SGreg Roach<form method="post" action="<?= e(route(MapDataImportAction::class)) ?>" id="upload_form" enctype="multipart/form-data">
249e3c2cf9SGreg Roach    <div class="row mb-3">
25*6c5ec5a2SGreg Roach        <label class="col-form-label col-sm-4">
26*6c5ec5a2SGreg Roach            <input type="radio" name="source" id="import-client" value="client" checked>
27*6c5ec5a2SGreg Roach            <?= I18N::translate('A file on your computer') ?>
28*6c5ec5a2SGreg Roach        </label>
29*6c5ec5a2SGreg Roach        <div class="col-sm-8">
30*6c5ec5a2SGreg Roach            <input id="import-client-file" type="file" name="client_file" class="form-control">
31*6c5ec5a2SGreg Roach        </div>
32*6c5ec5a2SGreg Roach    </div>
33*6c5ec5a2SGreg Roach
34*6c5ec5a2SGreg Roach    <div class="row mb-3">
35*6c5ec5a2SGreg Roach        <label class="col-form-label col-sm-4">
36*6c5ec5a2SGreg Roach            <input type="radio" name="source" id="import-server" value="server">
37dd6b2bfcSGreg Roach            <?= I18N::translate('A file on the server') ?>
38dd6b2bfcSGreg Roach        </label>
39dd6b2bfcSGreg Roach        <div class="col-sm-8">
40dd6b2bfcSGreg Roach            <div class="input-group" dir="ltr">
41*6c5ec5a2SGreg Roach                <span class="input-group-text" dir="ltr">
4290949315SGreg Roach                    <?= e($folder) ?>
43dd6b2bfcSGreg Roach                </span>
44315eb316SGreg Roach
45*6c5ec5a2SGreg Roach                <select name="server_file" class="form-select" dir="ltr" id="import-server-file">
46*6c5ec5a2SGreg Roach                    <option selected="selected" value="">&nbsp;</option>
47dd6b2bfcSGreg Roach                    <?php foreach ($files as $file) : ?>
48dd6b2bfcSGreg Roach                        <option value="<?= e($file) ?>">
49dd6b2bfcSGreg Roach                            <?= e($file) ?>
50dd6b2bfcSGreg Roach                        </option>
51dd6b2bfcSGreg Roach                    <?php endforeach ?>
52dd6b2bfcSGreg Roach                </select>
53dd6b2bfcSGreg Roach            </div>
54dd6b2bfcSGreg Roach        </div>
55dd6b2bfcSGreg Roach    </div>
56dd6b2bfcSGreg Roach
57dd6b2bfcSGreg Roach    <!-- Import options -->
589e3c2cf9SGreg Roach    <fieldset class="row mb-3">
59315eb316SGreg Roach        <legend class="col-form-label col-sm-4">
60b5e8e56bSGreg Roach            <?= I18N::translate('Import') ?>
61dd6b2bfcSGreg Roach        </legend>
62dd6b2bfcSGreg Roach        <div class="col-sm-8">
63*6c5ec5a2SGreg Roach            <?= view('components/select', ['name' => 'options', 'selected' => '', 'options' => ['update' => I18N::translate('Only update existing records'), 'add' => I18N::translate('Only add new records'), 'addupdate' => I18N::translate('Add new, and update existing records')]]) ?>
64dd6b2bfcSGreg Roach        </div>
65dd6b2bfcSGreg Roach    </fieldset>
66dd6b2bfcSGreg Roach
67dd6b2bfcSGreg Roach    <!-- SAVE BUTTON -->
689e3c2cf9SGreg Roach    <div class="row mb-3">
69dd6b2bfcSGreg Roach        <div class="offset-sm-4 col-sm-8">
70dd6b2bfcSGreg Roach            <button type="submit" class="btn btn-primary">
71dd6b2bfcSGreg Roach                <?= view('icons/save') ?>
72dd6b2bfcSGreg Roach                <?= I18N::translate('continue') ?>
73dd6b2bfcSGreg Roach            </button>
7494e35917SGreg Roach            <a href="<?= e(route(MapDataList::class)) ?>">
7594e35917SGreg Roach                <?= view('icons/cancel') ?>
7694e35917SGreg Roach                <?= /* I18N: A button label. */ I18N::translate('cancel') ?>
7794e35917SGreg Roach            </a>
78dd6b2bfcSGreg Roach        </div>
79dd6b2bfcSGreg Roach    </div>
8081443e3cSGreg Roach
8181443e3cSGreg Roach    <?= csrf_field() ?>
82dd6b2bfcSGreg Roach</form>
83*6c5ec5a2SGreg Roach
84*6c5ec5a2SGreg Roach<?php View::push('javascript') ?>
85*6c5ec5a2SGreg Roach<script>
86*6c5ec5a2SGreg Roach  document.getElementById('import-client-file').addEventListener('focus', function () {
87*6c5ec5a2SGreg Roach    document.getElementById('import-client').checked = true;
88*6c5ec5a2SGreg Roach  });
89*6c5ec5a2SGreg Roach
90*6c5ec5a2SGreg Roach  document.getElementById('import-server-file').addEventListener('focus', function () {
91*6c5ec5a2SGreg Roach    document.getElementById('import-server').checked = true;
92*6c5ec5a2SGreg Roach  });
93*6c5ec5a2SGreg Roach</script>
94*6c5ec5a2SGreg Roach<?php View::endpush() ?>
95