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