xref: /webtrees/resources/views/admin/import-progress.phtml (revision c5cb081f84eaf817fc43486524a23d6714850ec0)
1d70512abSGreg Roach<?php
2d70512abSGreg Roach
310e06497SGreg Roachdeclare(strict_types=1);
410e06497SGreg Roach
56fd01894SGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\GedcomLoad;
6d70512abSGreg Roachuse Fisharebest\Webtrees\I18N;
77c2c99faSGreg Roachuse Fisharebest\Webtrees\Tree;
87c2c99faSGreg Roach
97c2c99faSGreg Roach/**
107c2c99faSGreg Roach * @var string $errors
117c2c99faSGreg Roach * @var float  $progress
123ddb2c3fSGreg Roach * @var string $status
137c2c99faSGreg Roach * @var Tree   $tree
147c2c99faSGreg Roach */
15d70512abSGreg Roach
16d70512abSGreg Roach?>
17dd6b2bfcSGreg Roach
18*c5cb081fSGreg Roach<div class="progress" id="progress<?= e($tree->id()) ?>"
19dd6b2bfcSGreg Roach     role="progressbar"
20dd6b2bfcSGreg Roach     aria-valuenow="<?= $progress * 100 ?>"
21dd6b2bfcSGreg Roach     aria-valuemin="0"
22dd6b2bfcSGreg Roach     aria-valuemax="100"
23dd6b2bfcSGreg Roach>
24*c5cb081fSGreg Roach    <div class="progress-bar" style="min-width: <?= $progress * 100 ?>%;">
253ddb2c3fSGreg Roach        <?= $status ?: I18N::percentage($progress, 1) ?>
26dd6b2bfcSGreg Roach    </div>
27dd6b2bfcSGreg Roach</div>
28dd6b2bfcSGreg Roach
29b37c98e1SGreg Roach<?php if ($errors === '') : ?>
30dd6b2bfcSGreg Roach    <script>
3172cf66d4SGreg Roach        $("#import<?= e($tree->id()) ?>")
326fd01894SGreg Roach            .load("<?= route(GedcomLoad::class, ['tree' => $tree->name()]) ?>", {});
33dd6b2bfcSGreg Roach    </script>
34b37c98e1SGreg Roach<?php else : ?>
35b37c98e1SGreg Roach    <div class="alert alert-danger">
36b37c98e1SGreg Roach        <?= $errors ?>
37b37c98e1SGreg Roach    </div>
38b37c98e1SGreg Roach
39b37c98e1SGreg Roach    <button class="btn btn-primary" onclick="" id="error-button-<?= $tree->id() ?>">
40b37c98e1SGreg Roach        <?= I18N::translate('continue') ?>
41b37c98e1SGreg Roach    </button>
42b37c98e1SGreg Roach
43b37c98e1SGreg Roach    <script>
44b37c98e1SGreg Roach        $("#error-button-<?= $tree->id() ?>").click(function () {
45b37c98e1SGreg Roach            $("#import<?= e($tree->id()) ?>")
466fd01894SGreg Roach                .load("<?= route(GedcomLoad::class, ['tree' => $tree->name()]) ?>", {});
47b37c98e1SGreg Roach        });
48b37c98e1SGreg Roach    </script>
49b37c98e1SGreg Roach<?php endif ?>
50