xref: /webtrees/resources/views/admin/import-progress.phtml (revision 36de22acf6348b1059dac63e3cd19589574906ac)
1<?php
2
3use Fisharebest\Webtrees\Http\RequestHandlers\GedcomLoad;
4use Fisharebest\Webtrees\I18N;
5use Fisharebest\Webtrees\Tree;
6
7/**
8 * @var string $errors
9 * @var float $progress
10 * @var Tree $tree
11 */
12
13?>
14
15<div class="progress" id="progress<?= e($tree->id()) ?>">
16    <div
17        class="progress-bar"
18        role="progressbar"
19        aria-valuenow="<?= $progress * 100 ?>"
20        aria-valuemin="0"
21        aria-valuemax="100"
22        style="width: <?= $progress * 100 ?>%; min-width: 40px;"
23    >
24        <?= I18N::percentage($progress, 1) ?>
25    </div>
26</div>
27
28<?php if ($errors === '') : ?>
29    <script>
30        $("#import<?= e($tree->id()) ?>")
31            .load("<?= route(GedcomLoad::class, ['tree' => $tree->name()]) ?>", {});
32    </script>
33<?php else : ?>
34    <div class="alert alert-danger">
35        <?= $errors ?>
36    </div>
37
38    <button class="btn btn-primary" onclick="" id="error-button-<?= $tree->id() ?>">
39        <?= I18N::translate('continue') ?>
40    </button>
41
42    <script>
43        $("#error-button-<?= $tree->id() ?>").click(function () {
44            $("#import<?= e($tree->id()) ?>")
45                .load("<?= route(GedcomLoad::class, ['tree' => $tree->name()]) ?>", {});
46        });
47    </script>
48<?php endif ?>
49