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