xref: /webtrees/resources/views/admin/import-progress.phtml (revision 3ddb2c3f1b75331c0af6be131557ffc6c3bfb468)
1d70512abSGreg Roach<?php
2d70512abSGreg Roach
36fd01894SGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\GedcomLoad;
4d70512abSGreg Roachuse Fisharebest\Webtrees\I18N;
57c2c99faSGreg Roachuse Fisharebest\Webtrees\Tree;
67c2c99faSGreg Roach
77c2c99faSGreg Roach/**
87c2c99faSGreg Roach * @var string $errors
97c2c99faSGreg Roach * @var float  $progress
10*3ddb2c3fSGreg Roach * @var string $status
117c2c99faSGreg Roach * @var Tree   $tree
127c2c99faSGreg Roach */
13d70512abSGreg Roach
14d70512abSGreg Roach?>
15dd6b2bfcSGreg Roach
1672cf66d4SGreg Roach<div class="progress" id="progress<?= e($tree->id()) ?>">
17dd6b2bfcSGreg Roach    <div
18dd6b2bfcSGreg Roach        class="progress-bar"
19dd6b2bfcSGreg Roach        role="progressbar"
20dd6b2bfcSGreg Roach        aria-valuenow="<?= $progress * 100 ?>"
21dd6b2bfcSGreg Roach        aria-valuemin="0"
22dd6b2bfcSGreg Roach        aria-valuemax="100"
23*3ddb2c3fSGreg Roach        style="min-width: <?= $progress * 100 ?>%;"
24dd6b2bfcSGreg Roach    >
25*3ddb2c3fSGreg 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