Compare commits
2 Commits
827fb317bc
...
868dc3f7e2
Author | SHA1 | Date | |
---|---|---|---|
868dc3f7e2 | |||
9e8c236281 |
@ -2,8 +2,15 @@
|
||||
|
||||
All notable changes to this project will be documented in this file. Dates are displayed in UTC.
|
||||
|
||||
#### [1.12.2](https://git.odit.services/lfk/frontend/compare/1.12.1...1.12.2)
|
||||
|
||||
- feat(cardassignment): Now with hand scanner support [`9e8c236`](https://git.odit.services/lfk/frontend/commit/9e8c236281f6686318c27dcb1bd02dfbc2b30ee8)
|
||||
|
||||
#### [1.12.1](https://git.odit.services/lfk/frontend/compare/1.12.0...1.12.1)
|
||||
|
||||
> 28 April 2025
|
||||
|
||||
- chore(release): 1.12.1 [`827fb31`](https://git.odit.services/lfk/frontend/commit/827fb317bc946268e4a1d60b15f3805b67b240f6)
|
||||
- fix(donations): Don't show enter payment for anon donations [`32f72df`](https://git.odit.services/lfk/frontend/commit/32f72df10583a08efb26e0983c0c5c829ab03e19)
|
||||
- chore(deps): Fresh lock [`1ec8e21`](https://git.odit.services/lfk/frontend/commit/1ec8e2186bdcd69c2acbc785feef4927973bc986)
|
||||
- fix(donations): Support anon donations in deletion modal [`27187b4`](https://git.odit.services/lfk/frontend/commit/27187b428da1e757f85392d77d49670f51a19829)
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
<body>
|
||||
<span style="display: none; visibility: hidden" id="buildinfo"
|
||||
>RELEASE_INFO-1.12.1-RELEASE_INFO</span
|
||||
>RELEASE_INFO-1.12.2-RELEASE_INFO</span
|
||||
>
|
||||
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||||
<script src="/env.js"></script>
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@odit/lfk-frontend",
|
||||
"version": "1.12.1",
|
||||
"version": "1.12.2",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"i18n-order": "node order.js",
|
||||
|
@ -1,16 +1,111 @@
|
||||
<script>
|
||||
import { _ } from "svelte-i18n";
|
||||
import { _, time } from "svelte-i18n";
|
||||
import { RunnerCardService, RunnerService } from "@odit/lfk-client-js";
|
||||
import QrCodeScanner from "./QrCodeScanner.svelte";
|
||||
import { onMount } from "svelte";
|
||||
let state = "scan_runner";
|
||||
let runnerinfo = { id: 0, firstname: "", lastname: "" };
|
||||
let cardCode = "";
|
||||
let scannerActive = true;
|
||||
let barcodeInput;
|
||||
let nextButton;
|
||||
let tryAgainButton;
|
||||
|
||||
function resetAll() {
|
||||
state = "scan_runner";
|
||||
runnerinfo = { id: 0, firstname: "", lastname: "" };
|
||||
cardCode = "";
|
||||
scannerActive = true;
|
||||
setTimeout(() => {
|
||||
barcodeInput && barcodeInput.focus();
|
||||
}, 100);
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
if (barcodeInput) {
|
||||
barcodeInput.focus();
|
||||
}
|
||||
});
|
||||
|
||||
function handleInput(input) {
|
||||
if (runnerinfo.id === 0) {
|
||||
new Audio("/beep.mp3").play();
|
||||
if (input.includes("https://portal.lauf-fuer-kaya.de/profile/")) {
|
||||
const runnerID = JSON.parse(
|
||||
atob(
|
||||
input
|
||||
.replace("https://portal.lauf-fuer-kaya.de/profile/", "")
|
||||
.split(".")[1]
|
||||
)
|
||||
).id;
|
||||
RunnerService.runnerControllerGetOne(runnerID)
|
||||
.then((runner) => {
|
||||
runnerinfo = runner;
|
||||
})
|
||||
.catch((e) => {
|
||||
console.error(e);
|
||||
state = "error_runner";
|
||||
setTimeout(() => {
|
||||
tryAgainButton && tryAgainButton.focus();
|
||||
}, 100);
|
||||
// resetAll();
|
||||
});
|
||||
} else {
|
||||
const runnerID = parseInt(input);
|
||||
RunnerService.runnerControllerGetOne(runnerID)
|
||||
.then((runner) => {
|
||||
runnerinfo = runner;
|
||||
})
|
||||
.catch((e) => {
|
||||
console.error(e);
|
||||
state = "error_runner";
|
||||
setTimeout(() => {
|
||||
tryAgainButton && tryAgainButton.focus();
|
||||
}, 100);
|
||||
// resetAll();
|
||||
});
|
||||
}
|
||||
} else {
|
||||
if (`${input}`.length > 10) {
|
||||
cardCode = input;
|
||||
new Audio("/beep.mp3").play();
|
||||
state = "assigning";
|
||||
RunnerCardService.runnerCardControllerGetAll()
|
||||
.then((cards) => {
|
||||
// console.log(cards);
|
||||
const card = cards.find((c) => c.code === cardCode);
|
||||
if (card) {
|
||||
console.log("card found", card);
|
||||
RunnerCardService.runnerCardControllerPut(card.id, {
|
||||
enabled: true,
|
||||
id: card.id,
|
||||
runner: runnerinfo.id,
|
||||
})
|
||||
.then(() => {
|
||||
state = "done";
|
||||
setTimeout(() => {
|
||||
nextButton && nextButton.focus();
|
||||
}, 100);
|
||||
})
|
||||
.catch(() => {
|
||||
state = "error_card";
|
||||
scannerActive = false;
|
||||
setTimeout(() => {
|
||||
tryAgainButton && tryAgainButton.focus();
|
||||
}, 100);
|
||||
});
|
||||
} else {
|
||||
console.log("card not found");
|
||||
// scannerActive = true;
|
||||
state = "error_card";
|
||||
scannerActive = false;
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
scannerActive = true;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@ -257,6 +352,7 @@
|
||||
on:click={() => {
|
||||
resetAll();
|
||||
}}
|
||||
bind:this={nextButton}
|
||||
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 mt-2"
|
||||
>
|
||||
@ -307,6 +403,7 @@
|
||||
on:click={() => {
|
||||
resetAll();
|
||||
}}
|
||||
bind:this={tryAgainButton}
|
||||
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 mt-2"
|
||||
>
|
||||
@ -397,82 +494,28 @@
|
||||
}
|
||||
scannerActive = false;
|
||||
console.log({ type: "DETECT", code: e.detail.decodedText });
|
||||
if (runnerinfo.id === 0) {
|
||||
new Audio("/beep.mp3").play();
|
||||
if (
|
||||
e.detail.decodedText.includes(
|
||||
"https://portal.lauf-fuer-kaya.de/profile/"
|
||||
)
|
||||
) {
|
||||
const runnerID = JSON.parse(
|
||||
atob(
|
||||
e.detail.decodedText
|
||||
.replace("https://portal.lauf-fuer-kaya.de/profile/", "")
|
||||
.split(".")[1]
|
||||
)
|
||||
).id;
|
||||
RunnerService.runnerControllerGetOne(runnerID)
|
||||
.then((runner) => {
|
||||
runnerinfo = runner;
|
||||
})
|
||||
.catch((e) => {
|
||||
console.error(e);
|
||||
state = "error_runner";
|
||||
// resetAll();
|
||||
});
|
||||
} else {
|
||||
const runnerID = parseInt(e.detail.decodedText);
|
||||
RunnerService.runnerControllerGetOne(runnerID)
|
||||
.then((runner) => {
|
||||
runnerinfo = runner;
|
||||
})
|
||||
.catch((e) => {
|
||||
console.error(e);
|
||||
state = "error_runner";
|
||||
// resetAll();
|
||||
});
|
||||
}
|
||||
} else {
|
||||
if (`${e.detail.decodedText}`.length > 10) {
|
||||
cardCode = e.detail.decodedText;
|
||||
new Audio("/beep.mp3").play();
|
||||
state = "assigning";
|
||||
RunnerCardService.runnerCardControllerGetAll()
|
||||
.then((cards) => {
|
||||
// console.log(cards);
|
||||
const card = cards.find((c) => c.code === cardCode);
|
||||
if (card) {
|
||||
console.log("card found", card);
|
||||
RunnerCardService.runnerCardControllerPut(card.id, {
|
||||
enabled: true,
|
||||
id: card.id,
|
||||
runner: runnerinfo.id,
|
||||
})
|
||||
.then(() => {
|
||||
state = "done";
|
||||
})
|
||||
.catch(() => {
|
||||
state = "error_card";
|
||||
scannerActive = false;
|
||||
});
|
||||
} else {
|
||||
console.log("card not found");
|
||||
// scannerActive = true;
|
||||
state = "error_card";
|
||||
scannerActive = false;
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
scannerActive = true;
|
||||
});
|
||||
}
|
||||
}
|
||||
handleInput(e.detail.decodedText);
|
||||
}
|
||||
}}
|
||||
width={320}
|
||||
height={320}
|
||||
class="w-full max-w-sm bg-neutral-300 rounded-lg overflow-hidden"
|
||||
/>
|
||||
<form
|
||||
on:submit={(e) => {
|
||||
handleInput(barcodeInput.value);
|
||||
barcodeInput.value = "";
|
||||
e.preventDefault();
|
||||
}}
|
||||
class="mt-2"
|
||||
>
|
||||
<input
|
||||
type="text"
|
||||
placeholder={$_("barcode_scanner")}
|
||||
class="w-full max-w-sm bg-neutral-300 rounded-lg overflow-hidden mt-2"
|
||||
bind:this={barcodeInput}
|
||||
/>
|
||||
</form>
|
||||
{/if}
|
||||
{#if runnerinfo.id !== 0 && state !== "scan_card"}
|
||||
<button
|
||||
|
@ -52,6 +52,7 @@
|
||||
"available-permissions": "Verfügbar",
|
||||
"average-distance": "∅ Strecke/Läufer",
|
||||
"average-donation": "∅ Sponsoring",
|
||||
"barcode_scanner": "Scannen mit Handscanner",
|
||||
"by": "von",
|
||||
"cancel": "Abbrechen",
|
||||
"cancel-delete": "Löschen abbrechen",
|
||||
|
@ -52,6 +52,7 @@
|
||||
"available-permissions": "available",
|
||||
"average-distance": "∅ distance",
|
||||
"average-donation": "∅ donation",
|
||||
"barcode_scanner": "Scan via barcode scanner",
|
||||
"by": "by",
|
||||
"cancel": "Cancel",
|
||||
"cancel-delete": "Cancel Delete",
|
||||
|
Loading…
x
Reference in New Issue
Block a user