From 6ebc263dc0d31aabac38bd0f3864cd44ff5ae2e6 Mon Sep 17 00:00:00 2001 From: Lyndon Date: Tue, 18 Nov 2025 13:36:30 +0100 Subject: [PATCH] =?UTF-8?q?Wenn=20keine=20Ziele=20ausw=C3=A4hlbar=20sind,?= =?UTF-8?q?=20es=20aber=20Pflicht=20ist,=20mindestens=20eines=20auszuw?= =?UTF-8?q?=C3=A4hlen,=20kam=20bisher=20eine=20Fehlermeldung,=20die=20das?= =?UTF-8?q?=20Speichern=20verhindert=20hat.=20Das=20ist=20jetzt=20behoben.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Hat man keine Uhrzeit eingetragen, wurde ein mehrtägiger ServiceRecord daraus. --- .../ownSoft-Scripts/utils/dateUtils.js | 4 ++ .../utils/service-record-time-calc.js | 20 ++++---- .../ownSoft-Scripts/view-scripts/main.js | 19 +++++--- .../Views/Main/GoalTreePartial.cshtml | 2 +- .../Views/Main/GroupBookingScCbRelList.cshtml | 1 + BeWoPlanerMobil/Views/Main/Main.cshtml | 47 ------------------- .../QuittierungsbelegsResultPartial.cshtml | 1 - BeWoPlanerMobil/Views/Shared/_Layout.cshtml | 2 +- Host/Host.csproj.user | 4 +- 9 files changed, 33 insertions(+), 67 deletions(-) diff --git a/BeWoPlanerMobil/Scripts/ownSoft-Scripts/utils/dateUtils.js b/BeWoPlanerMobil/Scripts/ownSoft-Scripts/utils/dateUtils.js index d5518a03e..3eeae22e6 100644 --- a/BeWoPlanerMobil/Scripts/ownSoft-Scripts/utils/dateUtils.js +++ b/BeWoPlanerMobil/Scripts/ownSoft-Scripts/utils/dateUtils.js @@ -81,4 +81,8 @@ function ddMMyyyyToyyyyMMdd(dateString) { const yyyy = dayMonthYear[2]; return `${yyyy}-${mm}-${dd}`; +} + +function toStringWithSeconds(date) { + return `${date.getDate()}.${date.getMonth()}.${date.getFullYear()} ${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}`; } \ No newline at end of file diff --git a/BeWoPlanerMobil/Scripts/ownSoft-Scripts/utils/service-record-time-calc.js b/BeWoPlanerMobil/Scripts/ownSoft-Scripts/utils/service-record-time-calc.js index 2e05e0025..abfe643d7 100644 --- a/BeWoPlanerMobil/Scripts/ownSoft-Scripts/utils/service-record-time-calc.js +++ b/BeWoPlanerMobil/Scripts/ownSoft-Scripts/utils/service-record-time-calc.js @@ -32,10 +32,12 @@ let start = new Date(startDateValue); let end = hasEndDate ? new Date(endDateValue) : start; + logInfo3(`Input-Values: startTimeValue: <<${startTimeValue}>>; endTimeValue: <<${endTimeValue}>>; duration: <<${durationValue}>>`); + // Von und Bis haben gültige Werte und es wurde nicht durch den Dauereinheitsbutton ausgelöst if(true === isStartTimeValid && true === isEndTimeValid && false === isFormatChange) { - start = combineDateAndTime(start, startTimeValue); - end = combineDateAndTime(end, endTimeValue); + start = combineDateAndTime(start, startTimeValue, false); + end = combineDateAndTime(end, endTimeValue, false); let dauer = (end.getTime() - start.getTime()) / 60000; @@ -135,9 +137,7 @@ function formatDuration(isInMin, durationAsNumber) { } function calcTimeWithDuration(timeAsString, timeElement, start, duration, isFormatChange, isInMin) { - start = combineDateAndTime(start, timeAsString); - - logInfo3(`calcTimeWithDuration(timeAsString: ${timeAsString}, timeElement: ${timeElement}, start: ${start}, duration: ${duration}, isFormatChange: ${isFormatChange}, isInMin: ${isInMin})`); + start = combineDateAndTime(start, timeAsString, false); const x = new Date(start.getTime() + duration * 60000); const timeString = `${x.getHours().toString().padStart(2, "0")}:${x.getMinutes().toString().padStart(2, "0")}`; @@ -194,7 +194,7 @@ function beiDaueraenderung(idPrefix) { } if(true === isStartTimeValid) { - const startDateAndTimeCombined = combineDateAndTime(start, startTimeInput.val()); + const startDateAndTimeCombined = combineDateAndTime(start, startTimeInput.val(), false); end = new Date(startDateAndTimeCombined.getTime() + duration * 60000); @@ -204,7 +204,7 @@ function beiDaueraenderung(idPrefix) { endTimeInput.trigger("change"); endDateInput.trigger("change"); } else { - const endDateAndTimeCombined = combineDateAndTime(end, endTimeInput.val()); + const endDateAndTimeCombined = combineDateAndTime(end, endTimeInput.val(), false); start = new Date(endDateAndTimeCombined.getTime() - duration * 60000); @@ -216,7 +216,11 @@ function beiDaueraenderung(idPrefix) { } } -function combineDateAndTime(date, time) { +function combineDateAndTime(date, time, isOneSecond) { + if(true === isOneSecond) { + return new Date(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 1); + } + const hours = time.split(":")[0]; const minutes = time.split(":")[1]; diff --git a/BeWoPlanerMobil/Scripts/ownSoft-Scripts/view-scripts/main.js b/BeWoPlanerMobil/Scripts/ownSoft-Scripts/view-scripts/main.js index 504689a15..95789f9bf 100644 --- a/BeWoPlanerMobil/Scripts/ownSoft-Scripts/view-scripts/main.js +++ b/BeWoPlanerMobil/Scripts/ownSoft-Scripts/view-scripts/main.js @@ -200,10 +200,12 @@ function validateForm(form, prefix) { const isNoticeMandatory = window.getIsDocumentationMandatory(); const isServiceRecordGoalMandatory = window.getIsServiceRecordGoalMandatory(); const numberOfNoticeTextareas = window.getNumberOfDokutypes(); - + + const hasGoalsToChooseFrom = $("#goals-tree").length > 0; + var isValid = true; - if(isServiceRecordGoalMandatory) { + if(isServiceRecordGoalMandatory && hasGoalsToChooseFrom) { const selectedGoalOids = window.getCheckedGoalsAsArray(); if(selectedGoalOids.length === 0) { @@ -272,7 +274,7 @@ function validateForm(form, prefix) { if(startAndEndDates !== null && isValid) { var [start, end] = startAndEndDates; - if(end.getTime() < start.getTime() || end.getTime() === start.getTime()) { + if((start.getSeconds() !== 1 && end.getSeconds() !== 1) && (end.getTime() < start.getTime() || end.getTime() === start.getTime())) { end.setDate(end.getDate() + 1); } @@ -417,13 +419,16 @@ function validateStartAndEndInputs(startDateInput, startTimeInput, endDateInput, } const isStartDateValid = false === isNaN(startDate.getTime()); - const isEndDateValid = endDateInput.length ? false === isNaN(endDate.getTime()) : true; + const isEndDateValid = false === isNaN(endDate.getTime()); if(isStartDateValid && startTime.length === 0 || isEndDateValid && endTime.length === 0) { const startValue = `${getDateAsString(startDate)}T00:00:0${(isServiceRecord ? "1" : "0")}`; const endValue = `${getDateAsString(endDate)}T00:00:0${(isServiceRecord ? "1" : "0")}`; - - return [new Date(startValue), new Date(endValue)]; + + const newStartDate = new Date(startValue); + const newEndDate = new Date(endValue); + + return [newStartDate, newEndDate]; } const isStartTimeValid = startTime.length > 0; @@ -433,7 +438,7 @@ function validateStartAndEndInputs(startDateInput, startTimeInput, endDateInput, return null; } - return [combineDateAndTime(startDate, startTime), combineDateAndTime(endDate, endTime)]; + return [combineDateAndTime(startDate, startTime, false), combineDateAndTime(endDate, endTime, false)]; } function supportConceptSearchOnChange() { diff --git a/BeWoPlanerMobil/Views/Main/GoalTreePartial.cshtml b/BeWoPlanerMobil/Views/Main/GoalTreePartial.cshtml index e74fdf29b..9d0511c2c 100644 --- a/BeWoPlanerMobil/Views/Main/GoalTreePartial.cshtml +++ b/BeWoPlanerMobil/Views/Main/GoalTreePartial.cshtml @@ -183,7 +183,7 @@ if(!goalTreeItem.IsLeaf) { -
+
diff --git a/BeWoPlanerMobil/Views/Main/GroupBookingScCbRelList.cshtml b/BeWoPlanerMobil/Views/Main/GroupBookingScCbRelList.cshtml index 89f8c0707..441188359 100644 --- a/BeWoPlanerMobil/Views/Main/GroupBookingScCbRelList.cshtml +++ b/BeWoPlanerMobil/Views/Main/GroupBookingScCbRelList.cshtml @@ -15,6 +15,7 @@ var isSingleTabPaneActive = TempData[TempDataConstants.IsGroupTabActiveKey] is true ? string.Empty : "active"; } +@* ToDo: Suchfeld einbauen und je nach Auswahl (HP oder Gruppe) suchen/filtern *@
    @foreach(var cb2Sc in Model.SupportConceptListObjectsForGroupBooking) diff --git a/BeWoPlanerMobil/Views/Main/Main.cshtml b/BeWoPlanerMobil/Views/Main/Main.cshtml index 3bbc7c850..afceba1df 100644 --- a/BeWoPlanerMobil/Views/Main/Main.cshtml +++ b/BeWoPlanerMobil/Views/Main/Main.cshtml @@ -821,50 +821,3 @@ } - - -@*----- Ziele/Maßnahmen-Popup ----- *@ - \ No newline at end of file diff --git a/BeWoPlanerMobil/Views/Report/QuittierungsbelegsResultPartial.cshtml b/BeWoPlanerMobil/Views/Report/QuittierungsbelegsResultPartial.cshtml index a8a2bb67b..f8ee32158 100644 --- a/BeWoPlanerMobil/Views/Report/QuittierungsbelegsResultPartial.cshtml +++ b/BeWoPlanerMobil/Views/Report/QuittierungsbelegsResultPartial.cshtml @@ -433,7 +433,6 @@
} - page = Model.CurrentQbEntryPage - 2; if(page > Model.QbEntryPageCount - 4) diff --git a/BeWoPlanerMobil/Views/Shared/_Layout.cshtml b/BeWoPlanerMobil/Views/Shared/_Layout.cshtml index a83ddb1d4..e593b2b70 100644 --- a/BeWoPlanerMobil/Views/Shared/_Layout.cshtml +++ b/BeWoPlanerMobil/Views/Shared/_Layout.cshtml @@ -55,7 +55,7 @@ - + diff --git a/Host/Host.csproj.user b/Host/Host.csproj.user index 7e7306c78..5ee749fcf 100644 --- a/Host/Host.csproj.user +++ b/Host/Host.csproj.user @@ -1,9 +1,9 @@ - + C:\Projects\Bewo\BeWo - Main\Host\Properties\PublishProfiles\FolderProfile.pubxml true - Release|Any CPU + Debug|Any CPU