xref: /webtrees/resources/views/admin/import-progress.phtml (revision 24931b29a0237a5f5f1b8620af661ea530451af0)
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     role="progressbar"
20     aria-valuenow="<?= $progress * 100 ?>"
21     aria-valuemin="0"
22     aria-valuemax="100"
23>
24    <div class="progress-bar" style="min-width: <?= $progress * 100 ?>%;">
25        <?= $status ?: I18N::percentage($progress, 1) ?>
26    </div>
27</div>
28
29<?php if ($errors === '') : ?>
30    <script>
31        $("#import<?= e($tree->id()) ?>")
32            .load("<?= route(GedcomLoad::class, ['tree' => $tree->name()]) ?>", {});
33    </script>
34<?php else : ?>
35    <div class="alert alert-danger">
36        <?= $errors ?>
37    </div>
38
39    <button class="btn btn-primary" onclick="" id="error-button-<?= $tree->id() ?>">
40        <?= I18N::translate('continue') ?>
41    </button>
42
43    <script>
44        $("#error-button-<?= $tree->id() ?>").click(function () {
45            $("#import<?= e($tree->id()) ?>")
46                .load("<?= route(GedcomLoad::class, ['tree' => $tree->name()]) ?>", {});
47        });
48    </script>
49<?php endif ?>
50