Fix: Speichern ohne Eintragen von Studnen.

pull/18/head
Samuel Zielke 6 days ago
parent fdafc901f1
commit cdc3c3c0e9

@ -41,6 +41,12 @@ 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) {

@ -148,7 +148,7 @@
<div class="form-group col-7">
<p><b>Dauer</b></p>
<div class="input-group">
<input type="number" class="form-control" id="stunden" placeholder="00" min="0" max="99" maxlength="2" required>
<input type="number" class="form-control" id="stunden" placeholder="00" min="0" max="99" maxlength="2">
<div class="input-group-append">
<span class="input-group-text">h</span>
</div>
@ -215,7 +215,7 @@
<div class="form-group col-7">
<p><b>Dauer</b></p>
<div class="input-group">
<input type="number" class="form-control editItem" id="editStunden" placeholder="00" min="0" max="99" maxlength="2" required>
<input type="number" class="form-control editItem" id="editStunden" placeholder="00" min="0" max="99" maxlength="2">
<div class="input-group-append">
<span class="input-group-text">h</span>
</div>

Loading…
Cancel
Save

Powered by TurnKey Linux.