From 828895e773cc63f495de841edd96bb1bc24e33aa Mon Sep 17 00:00:00 2001 From: Patrick Date: Thu, 26 Dec 2024 00:14:02 +0100 Subject: [PATCH] added other input fields and implemented form validation --- src/routes/+page.svelte | 264 +++++++++++++++++++++++++++++++++++----- 1 file changed, 232 insertions(+), 32 deletions(-) diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index 6acf75a..20787c6 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -1,15 +1,24 @@ -
+
+ +
+ - {#each HEADERS as header} - - {/each} - + + + + + + + + + + + + + + {#each entries as entry} @@ -354,10 +552,13 @@ {/if}
Stundenliste
{header}Actions
{ - (event.target as HTMLInputElement).select(); + (_) => { + dateInput.select(); dateValid = true; } } onfocusout={ - (event) => { - dateValid = validateDate(event.target as HTMLInputElement); + (_) => { + dateValid = validateDate(dateInput); + if (dateValid) { + inWeekDay = WEEKDAYS[parseDate(dateInput.value)!.getDay()]; + } } } required> + {inWeekDay} + + { + startInput.select(); + startValid = true; + } + } + onfocusout={ + (_) => { + startValid = validateTime(startInput); + inDuration = calculateDuration(startInput.value, endInput.value); + } + } + required> + + { + endInput.select(); + endValid = true; + } + } + onfocusout={ + (_) => { + endValid = validateTime(endInput); + inDuration = calculateDuration(startInput.value, endInput.value); + } + } + required> + + {inDuration} + + + + +
+
+