feat(registration): autofocus input fields + done button
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
418fe7773f
commit
cbfbd92d0e
@ -2,6 +2,7 @@
|
|||||||
import { RunnerService, type ResponseRunner } from '@odit/lfk-client-js';
|
import { RunnerService, type ResponseRunner } from '@odit/lfk-client-js';
|
||||||
import bwipjs from 'bwip-js';
|
import bwipjs from 'bwip-js';
|
||||||
import lfkbackground from './background.png';
|
import lfkbackground from './background.png';
|
||||||
|
import { onMount } from 'svelte';
|
||||||
|
|
||||||
$: firstname = '';
|
$: firstname = '';
|
||||||
$: lastname = '';
|
$: lastname = '';
|
||||||
@ -11,6 +12,23 @@
|
|||||||
let response: ResponseRunner;
|
let response: ResponseRunner;
|
||||||
const group = 1; //Default to Bürgerlauf
|
const group = 1; //Default to Bürgerlauf
|
||||||
|
|
||||||
|
function focusFirstName() {
|
||||||
|
setTimeout(() => {
|
||||||
|
document.getElementById('firstname')?.focus();
|
||||||
|
}, 50);
|
||||||
|
setTimeout(() => {
|
||||||
|
document.getElementById('firstname')?.focus();
|
||||||
|
}, 100);
|
||||||
|
}
|
||||||
|
function focusDoneButton() {
|
||||||
|
setTimeout(() => {
|
||||||
|
document.getElementById('done')?.focus();
|
||||||
|
}, 50);
|
||||||
|
setTimeout(() => {
|
||||||
|
document.getElementById('done')?.focus();
|
||||||
|
}, 100);
|
||||||
|
}
|
||||||
|
|
||||||
async function register() {
|
async function register() {
|
||||||
try {
|
try {
|
||||||
response = (await RunnerService.runnerControllerPost({
|
response = (await RunnerService.runnerControllerPost({
|
||||||
@ -20,6 +38,7 @@
|
|||||||
})) as ResponseRunner;
|
})) as ResponseRunner;
|
||||||
showError = false;
|
showError = false;
|
||||||
showResult = true;
|
showResult = true;
|
||||||
|
focusDoneButton();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
showError = true;
|
showError = true;
|
||||||
@ -46,6 +65,10 @@
|
|||||||
});
|
});
|
||||||
return canvas.toDataURL('image/png');
|
return canvas.toDataURL('image/png');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onMount(() => {
|
||||||
|
focusFirstName();
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
@ -178,8 +201,10 @@
|
|||||||
|
|
||||||
<div class="mx-auto text-center items-center">
|
<div class="mx-auto text-center items-center">
|
||||||
<button
|
<button
|
||||||
|
id="done"
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
showResult = false;
|
showResult = false;
|
||||||
|
focusFirstName();
|
||||||
}}
|
}}
|
||||||
class="w-full py-3 px-4 inline-flex justify-center items-center gap-2 rounded-md border border-transparent font-semibold bg-blue-500 text-white hover:bg-blue-600 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 transition-all text-sm dark:focus:ring-offset-gray-800"
|
class="w-full py-3 px-4 inline-flex justify-center items-center gap-2 rounded-md border border-transparent font-semibold bg-blue-500 text-white hover:bg-blue-600 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 transition-all text-sm dark:focus:ring-offset-gray-800"
|
||||||
>Fertig</button
|
>Fertig</button
|
||||||
@ -191,7 +216,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="fixed bottom-0 w-full text-center text-xl p-4 dark:text-white">
|
<div class="fixed bottom-0 w-full text-center text-xl p-4 dark:text-white select-none">
|
||||||
<a
|
<a
|
||||||
rel="noopener noreferrer"
|
rel="noopener noreferrer"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user