xref: /webtrees/resources/views/admin/import-progress.phtml (revision 5062b1ca554e9384a3865a8ed7fa201483b30720)
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