From da1563aded7cedf597dbe9dc274f9642dfd64277 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Henke?= Date: Wed, 6 Jul 2022 10:21:46 +0200 Subject: [PATCH] time suggestions --- src/main/resources/static/js/helper.js | 30 ++++++++ src/main/resources/templates/done/item.html | 76 ++++++++++++++----- src/main/resources/templates/layout/main.html | 1 + src/main/webapp/pages/done/add.xhtml | 7 +- 4 files changed, 90 insertions(+), 24 deletions(-) create mode 100644 src/main/resources/static/js/helper.js diff --git a/src/main/resources/static/js/helper.js b/src/main/resources/static/js/helper.js new file mode 100644 index 0000000..b307231 --- /dev/null +++ b/src/main/resources/static/js/helper.js @@ -0,0 +1,30 @@ +resetValue = function(selector, value) { + $(selector).val(value); + $(selector).change(); + return false; +} + +nowPlus = function(summand) { + const roundToQuarter = date => new Date(Math.round(date / 9e5) * 9e5); + var now = roundToQuarter(new Date()); + var wanted = new Date(now); + wanted.setMinutes(now.getMinutes() + summand); + return wanted.toLocaleTimeString('de', { + hour12: false, + hour: "numeric", + minute: "numeric" + }); +} + +validateTime = function(inputField, okButtonId) { + var value = inputField.value; + var regexPattern = /^([01]?[0-9]|2[0-3]):[0-5][0-9]$/; + var valid = value == "" ? true : regexPattern.test(value); + if (valid) { + $(inputField).css("background-color", "#cfc"); + $("[id='" + okButtonId + "']").removeAttr('disabled'); + } else { + $(inputField).css("background-color", "#fcc"); + $("[id='" + okButtonId + "']").attr('disabled', 'disabled'); + } +} \ No newline at end of file diff --git a/src/main/resources/templates/done/item.html b/src/main/resources/templates/done/item.html index ada8682..d58826f 100644 --- a/src/main/resources/templates/done/item.html +++ b/src/main/resources/templates/done/item.html @@ -10,7 +10,7 @@
-
+
@@ -24,44 +24,84 @@
-
- +
+ +
+
+ + + + + + + + + + +
-
- +
+ +
+
+ + + + + + + + + + +
- +
+ +
+
+ TODO: suggestions +
- +
+ +
+
TODO: suggestions
- +
+ +
+
TODO: suggestions
- +
+ +
+
TODO: suggestions
Änderung
- + abbrechen