This commit is contained in:
Philipp Dormann 2025-04-22 18:47:41 +02:00
parent 2a4fe2b28f
commit fcadedaa30
Signed by: philipp
GPG Key ID: 3BB9ADD52DCA4314

View File

@ -2,6 +2,7 @@
import { RunnerCardService, RunnerService } from "@odit/lfk-client-js";
import QrCodeScanner from "./QrCodeScanner.svelte";
let state = "scan_runner";
let state_tmp = "";
let runnerinfo = { id: 0, firstname: "", lastname: "" };
let cardCode = "";
let scannerActive = true;
@ -34,6 +35,29 @@
{:else if state === "assigning"}
<p>Assigning Card {cardCode}</p>
<p>Please wait a moment while we assign the card...</p>
{:else if state === "error_runner"}
<p>Runner not found...</p>
<button
on:click={() => {
resetAll();
}}
type="button"
class="py-3 px-4 inline-flex items-center gap-x-2 text-sm font-medium rounded-lg border border-transparent bg-blue-100 text-blue-800 hover:bg-blue-200 focus:outline-hidden focus:bg-blue-200 disabled:opacity-50 disabled:pointer-events-none dark:text-blue-500 dark:bg-blue-800/30 dark:hover:bg-blue-800/20 dark:focus:bg-blue-800/20 w-full mt-2"
>
Try Again
</button>
{:else if state === "error_card"}
<p>Card not found...</p>
<button
on:click={() => {
state = "scan_card";
scannerActive = true;
}}
type="button"
class="py-3 px-4 inline-flex items-center gap-x-2 text-sm font-medium rounded-lg border border-transparent bg-blue-100 text-blue-800 hover:bg-blue-200 focus:outline-hidden focus:bg-blue-200 disabled:opacity-50 disabled:pointer-events-none dark:text-blue-500 dark:bg-blue-800/30 dark:hover:bg-blue-800/20 dark:focus:bg-blue-800/20 w-full mt-2"
>
Try Again
</button>
{:else}
<!-- -->
{#if runnerinfo.id === 0}
@ -85,8 +109,8 @@
})
.catch((e) => {
console.error(e);
state = "scan_error_runner_404";
resetAll();
state = "error_runner";
// resetAll();
});
} else {
const runnerID = parseInt(e.detail.decodedText);
@ -96,8 +120,8 @@
})
.catch((e) => {
console.error(e);
state = "scan_error_runner_404";
resetAll();
state = "error_runner";
// resetAll();
});
}
} else {
@ -120,7 +144,8 @@
state = "done";
})
.catch(() => {
scannerActive = true;
state = "error_card";
scannerActive = false;
});
} else {
scannerActive = true;