xref: /webtrees/resources/views/admin/map-import-form.phtml (revision 3f0247b283a74c64ac885446380ea81de9cf779e)
1<?php
2
3use Fisharebest\Webtrees\Http\RequestHandlers\ControlPanel;
4use Fisharebest\Webtrees\Http\RequestHandlers\MapDataImportAction;
5use Fisharebest\Webtrees\Http\RequestHandlers\MapDataList;
6use Fisharebest\Webtrees\I18N;
7
8/**
9 * @var array<string> $files
10 * @var string        $folder
11 * @var string        $title
12 */
13
14?>
15
16<?= view('components/breadcrumbs', ['links' => [route(ControlPanel::class) => I18N::translate('Control panel'), route(MapDataList::class)  => I18N::translate('Geographic data'), $title]]) ?>
17
18<h3><?= $title ?></h3>
19
20<form method="post" action="<?= e(route(MapDataImportAction::class)) ?>" id="upload_form" enctype="multipart/form-data">
21    <!-- Server file -->
22    <div class="row mb-3">
23        <label class="col-form-label col-sm-4" for="serverfile">
24            <?= I18N::translate('A file on the server') ?>
25        </label>
26        <div class="col-sm-8">
27            <div class="input-group" dir="ltr">
28                <span class="input-group-text">
29                    <?= e($folder) ?>
30                </span>
31
32                <select id="serverfile" name="serverfile" class="form-select">
33                    <option selected value=""></option>
34                    <?php foreach ($files as $file) : ?>
35                        <option value="<?= e($file) ?>">
36                            <?= e($file) ?>
37                        </option>
38                    <?php endforeach ?>
39                </select>
40            </div>
41        </div>
42    </div>
43
44    <!-- local file -->
45    <div class="row mb-3">
46        <label class="col-form-label col-sm-4" for="localfile">
47            <?= I18N::translate('A file on your computer') ?>
48        </label>
49        <div class="col-sm-8">
50            <input id="localfile" type="file" name="localfile" class="form-control">
51        </div>
52    </div>
53
54    <!-- Import options -->
55    <fieldset class="row mb-3">
56        <legend class="col-form-label col-sm-4">
57            <?= I18N::translate('Import') ?>
58        </legend>
59        <div class="col-sm-8">
60            <?= view('components/select', ['name' => 'import-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')]]) ?>
61        </div>
62    </fieldset>
63
64    <!-- SAVE BUTTON -->
65    <div class="row mb-3">
66        <div class="offset-sm-4 col-sm-8">
67            <button type="submit" class="btn btn-primary">
68                <?= view('icons/save') ?>
69                <?= I18N::translate('continue') ?>
70            </button>
71            <a href="<?= e(route(MapDataList::class)) ?>">
72                <?= view('icons/cancel') ?>
73                <?= /* I18N: A button label. */ I18N::translate('cancel') ?>
74            </a>
75        </div>
76    </div>
77
78    <?= csrf_field() ?>
79</form>
80