diff --git a/app/static/app/js/home01.js b/app/static/app/js/home01.js index a791f24..fb9df18 100644 --- a/app/static/app/js/home01.js +++ b/app/static/app/js/home01.js @@ -39,7 +39,13 @@ mins.addEventListener('input', () => { }) document.getElementById('sonstigesInput').addEventListener('input', () => { checkInput(); -}) +}) + +// Button-Status beim Öffnen des Modals einmal anhand der Standardwerte (z.B. Minuten = 0) setzen, +// da sonst ohne ein tatsächliches 'input'-Event der Button trotz gültiger Vorbelegung deaktiviert bleibt +document.getElementById('newEntryModal').addEventListener('show.bs.modal', () => { + checkInput(); +}) // Einstellungen wenn Neuer Eintrag erstellt wird NewEntryButton.addEventListener('click', () => { @@ -58,8 +64,8 @@ NewEntryButton.addEventListener('click', () => { sonstigesText.style.display = 'none'; } - // Berechnen der Duration - const duration = (parseInt(hours.value)*60) + parseInt(mins.value) + // Berechnen der Duration (Stunden sind optional -> ohne Eingabe wird 0 gespeichert) + const duration = ((parseInt(hours.value) || 0)*60) + parseInt(mins.value) const newEntryData = { date: document.getElementById('datum').value, @@ -326,7 +332,7 @@ document.getElementById('editEntrySubmitButton').addEventListener('click', () => updateEntry(parseInt(ToEditID), 'hours', { date: document.getElementById('editDatum').value, - duration: (parseInt(edithours.value)*60) + parseInt(editMins.value), + duration: ((parseInt(edithours.value) || 0)*60) + parseInt(editMins.value), type: type, status: 1, sondertext: document.getElementById('editsonstigesInput').value, @@ -438,7 +444,7 @@ function checkInput() { if ((sonstigesCheck.checked && sonstigesInput.value !== "") || !(sonstigesCheck.checked)) { // Debug Ausgabe für Bedingungsstufen // console.log("Erste Bedingung: TRUE") - if (hours.value && mins.value) { + if (mins.value) { // Stunden sind optional, Minuten bleiben Pflicht // Debug Ausgabe für Bedingungsstufen // console.log("Zweite Bedingung: TRUE") if (!allowToSend) { @@ -478,7 +484,7 @@ function checkEditInput() { if ((editsonstigesCheck.checked && editsonstigesInput.value !== "") || !(editsonstigesCheck.checked)) { // Debug Ausgabe für Bedingungsstufen // console.log("Erste Bedingung: TRUE") - if (edithours.value && editMins.value) { + if (editMins.value) { // Stunden sind optional, Minuten bleiben Pflicht // Debug Ausgabe für Bedingungsstufen // console.log("Zweite Bedingung: TRUE") if (!editallowToSend) { diff --git a/app/templates/app/home.html b/app/templates/app/home.html index 70bd8b2..abe4f4d 100644 --- a/app/templates/app/home.html +++ b/app/templates/app/home.html @@ -148,7 +148,7 @@

Dauer

- +
h
@@ -215,7 +215,7 @@

Dauer

- +
h