From 3de300db6dba6f12610d5f46bb7dd18338f67063 Mon Sep 17 00:00:00 2001 From: Lyndon Date: Wed, 22 Oct 2025 13:22:31 +0200 Subject: [PATCH] =?UTF-8?q?Ziele=20und=20Ma=C3=9Fnahmen=20mit=20Bewertunge?= =?UTF-8?q?n=20lokal=20gespeichert.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BeWoPlanerMobil/Controllers/MainController.cs | 74 ++++- .../Scripts/ownSoft-Scripts/mobileUtils.js | 10 + .../ownSoft-Scripts/view-scripts/main.js | 15 +- .../Main/GoalRatingPopupContentPartial.cshtml | 2 +- .../Views/Main/GoalTreePartial.cshtml | 12 +- .../Views/Main/GroupBookingFormPartial.cshtml | 4 +- .../Main/GroupBookingSelectionPartial.cshtml | 29 +- BeWoPlanerMobil/Views/Main/Main.cshtml | 2 +- .../Views/Main/MultiBookingFormPartial.cshtml | 4 +- .../RestoreServiceRecordInputsPartial.cshtml | 270 ++++++++++-------- .../Views/Main/SingleBookingPartial.cshtml | 29 +- .../Views/Main/TextModulePartial.cshtml | 2 +- BeWoPlanerMobil/Views/Shared/_Layout.cshtml | 2 +- Shared/Core/Utils.cs | 35 ++- 14 files changed, 329 insertions(+), 161 deletions(-) diff --git a/BeWoPlanerMobil/Controllers/MainController.cs b/BeWoPlanerMobil/Controllers/MainController.cs index 0a71a17a7..eead657c6 100644 --- a/BeWoPlanerMobil/Controllers/MainController.cs +++ b/BeWoPlanerMobil/Controllers/MainController.cs @@ -417,10 +417,10 @@ namespace BeWoPlanerMobil.Controllers Model.SelectedSupportConcept = Model.SupportConcepts.FirstOrDefault(sc => sc.CostBearerRelOids.Any(a => a.Equals(Model.SelectedCostBearerSupportConceptOid))); } - + // Im Einzelbuchungsmodus entweder nichts oder "Hilfeplan auswählen" (-1) ausgewählt. if(istEinzelBuchung && (!cb2ScOid.HasValue || cb2ScOid.Value == -1)) { - // Im Einzelmodus entweder nichts oder "Hilfeplan auswählen" (-1) ausgewählt. + Model.Categories2Descriptions = new Dictionary>(); Model.SelectedGoalOids = new List(); } @@ -432,7 +432,7 @@ namespace BeWoPlanerMobil.Controllers { allC2SOids = Model.GroupBookingSelectedCostBearerSupportConceptOids; } - else if(cb2ScOid.HasValue && cb2ScOid.Value > 0) + else if(cb2ScOid > 0) { allC2SOids.Add(cb2ScOid.Value); } @@ -5172,7 +5172,14 @@ namespace BeWoPlanerMobil.Controllers var selectedGoalOidsInputValue = formCollection[FormCollectionConstants.SelectedGoalOids]; - var goalOids = string.IsNullOrWhiteSpace(selectedGoalOidsInputValue) ? new List() : selectedGoalOidsInputValue.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToList(); + var goals2Ratings = string.IsNullOrWhiteSpace(selectedGoalOidsInputValue) ? new Dictionary() : Utils.JsonMap2Dictionary(selectedGoalOidsInputValue); + + var goalOids = new List(); + + foreach(var goal2Rating in goals2Ratings) + { + goalOids.AddIfNotIn(goal2Rating.Key); + } var isStartDateValid = DateTime.TryParse(dateInputValue, out var startDate); if(false == isStartDateValid) @@ -5246,8 +5253,6 @@ namespace BeWoPlanerMobil.Controllers } } - // ToDo für den 13.10.2025: Ziele noch einbauen - if(isEndDateValid == false) { endDate = startDate; @@ -5266,6 +5271,61 @@ namespace BeWoPlanerMobil.Controllers serviceRecord.Employee = Model.AllEmployees.FirstOrDefault(f => f.EmployeeOid == sbEmployeeOid) ?? Model.LoggedInUser.Employee; } + var scOids = new List(); + + if(bookingMode is BookingMode.GroupBookingMode || bookingMode is BookingMode.MultiBookingMode) + { + scOids = Model.GroupBookingSelectedCostBearerSupportConcepts.Select(sc2Cb => sc2Cb.SupportConcept.SupportConceptOid).ToList(); + } + else + { + scOids.Add(Model.SelectedSupportConcept.SupportConceptOid); + } + + var infos = OperationsService.GetSupportConceptTreeNodeDetailInfos(scOids); + + LoadGoals(infos); + + Model.SelectedGoalOids = new List(); + + var allGoalOids = Model.AllGoals.Where(w => w.ValueListEntryOid.HasValue).Select(s => s.ValueListEntryOid.Value); + + var selectedGoalOids = allGoalOids.Intersect(goalOids).ToList(); + + Model.SelectedGoalOids = selectedGoalOids; + + foreach(var goalOid in Model.SelectedGoalOids) + { + var goal = Model.AllGoals.FirstOrDefault(f => f.ValueListEntryOid.HasValue && f.ValueListEntryOid.Equals(goalOid)); + + if(goal is null) + { + continue; + } + + Model.SelectedGoals.Add(DcToMokMapper.CreateZiel(goal)); + } + + foreach(var goalOid2RatingOid in goals2Ratings) + { + var goalOid = goalOid2RatingOid.Key; + var ratingTypeOid = goalOid2RatingOid.Value; + + if(false == Model.SelectedGoalOids.Contains(goalOid)) + { + continue; + } + + var goal = Model.SelectedGoals.FirstOrDefault(f => f.ValueListEntryOid.HasValue && f.ValueListEntryOid.Equals(goalOid)); + + if(goal is null) + { + continue; + } + + goal.RatingTypeOid = ratingTypeOid; + } + if(Model.NumberOfDokuTypes == 0) { serviceRecord.Notice = doku6; @@ -5281,7 +5341,7 @@ namespace BeWoPlanerMobil.Controllers serviceRecord.DistanceInMeter = null; serviceRecord.DistanceInMeterDecimal = distance; - + Model.SelectedServiceRecord = serviceRecord; TempData[TempDataConstants.AfterRestoreKey] = true; diff --git a/BeWoPlanerMobil/Scripts/ownSoft-Scripts/mobileUtils.js b/BeWoPlanerMobil/Scripts/ownSoft-Scripts/mobileUtils.js index f531f97b7..037c83003 100644 --- a/BeWoPlanerMobil/Scripts/ownSoft-Scripts/mobileUtils.js +++ b/BeWoPlanerMobil/Scripts/ownSoft-Scripts/mobileUtils.js @@ -475,4 +475,14 @@ function commaSeparatedOid2Array(csv) { } return csv.split(",").map(num => parseInt(num, 10)); +} + +function map2String(map) { + var output = `Map mit ${map.size} Einträgen:\r\n`; + + map.forEach((value, key, map) => { + output += `\t[${key}: ${value}]\r\n`; + }); + + return output; } \ No newline at end of file diff --git a/BeWoPlanerMobil/Scripts/ownSoft-Scripts/view-scripts/main.js b/BeWoPlanerMobil/Scripts/ownSoft-Scripts/view-scripts/main.js index 202084fe6..c9c476b47 100644 --- a/BeWoPlanerMobil/Scripts/ownSoft-Scripts/view-scripts/main.js +++ b/BeWoPlanerMobil/Scripts/ownSoft-Scripts/view-scripts/main.js @@ -204,7 +204,7 @@ function validateForm(form, prefix) { if(isNoticeMandatory) { if(numberOfNoticeTextareas === 0) { - var doku = $(`#${prefix}-doku-textarea`).val(); + var doku = $(`#${prefix}-doku-textarea-5`).val(); if(doku === undefined || doku === null) { doku = ""; @@ -307,7 +307,7 @@ function getDokuTexte(prefix) { const noticeList = [null, null, null, null, null]; try { - const hasMultipleDokufelder = $(`#${prefix}-doku-textarea`).length === 0; + const hasMultipleDokufelder = $(`#${prefix}-doku-textarea-5`).length === 0; let dokufeldCounter = 0; @@ -321,18 +321,9 @@ function getDokuTexte(prefix) { } } } else { - noticeList[0] = $(`#${prefix}-doku-textarea`).val(); + noticeList[0] = $(`#${prefix}-doku-textarea-5`).val(); dokufeldCounter = 1; } - - let x = ""; - for(let j = 0; j < dokufeldCounter; j++) { - x += noticeList[j]; - - if(j < noticeList.length - 1) { - x += ", "; - } - } } catch(error) { window.showErrorPopup(error); } finally { diff --git a/BeWoPlanerMobil/Views/Main/GoalRatingPopupContentPartial.cshtml b/BeWoPlanerMobil/Views/Main/GoalRatingPopupContentPartial.cshtml index d57cad4f4..fd25861cd 100644 --- a/BeWoPlanerMobil/Views/Main/GoalRatingPopupContentPartial.cshtml +++ b/BeWoPlanerMobil/Views/Main/GoalRatingPopupContentPartial.cshtml @@ -17,7 +17,7 @@ try { var goalOid = $("#goal-to-rate-oid").val(); - window.updateGoal2Rating("@Model.BookingModePrefix", goalOid, ratingTypeOid); + window.updateGoalRating("@Model.BookingModePrefix", goalOid, ratingTypeOid); $.get("@Url.Action("RateSelectedGoal")", { diff --git a/BeWoPlanerMobil/Views/Main/GoalTreePartial.cshtml b/BeWoPlanerMobil/Views/Main/GoalTreePartial.cshtml index b7b281436..38a189599 100644 --- a/BeWoPlanerMobil/Views/Main/GoalTreePartial.cshtml +++ b/BeWoPlanerMobil/Views/Main/GoalTreePartial.cshtml @@ -80,11 +80,13 @@ const id = box.attr("id").split("-")[2]; if(box.prop("checked") === true && !id.includes("goal")) { - selectedGoals += id + ";"; + selectedGoals += `${id};`; } }); - return selectedGoals.substr(0, selectedGoals.length - 1); + const result = selectedGoals.substr(0, selectedGoals.length - 1); + + return result; } catch(error) { showErrorPopup(error); return null; @@ -94,8 +96,10 @@ function updateSelectedGoals() { try { const selectedGoals = getCheckedGoals(); - console.log(selectedGoals); - window.updateGoals2Ratings("@Model.BookingModePrefix", new Map(selectedGoals.split(";").map(item => [item, ""]))); + + const goalsAsMap = new Map(selectedGoals.split(";").map(item => [item, null])); + + window.updateGoals2Ratings("@Model.BookingModePrefix", goalsAsMap); $.get("@Url.Action("UpdateGoals")", {pGoalOids: selectedGoals}, function (numberOfSelectedGoals) { $("#goals-button").html(`Ziele ${numberOfSelectedGoals}`); diff --git a/BeWoPlanerMobil/Views/Main/GroupBookingFormPartial.cshtml b/BeWoPlanerMobil/Views/Main/GroupBookingFormPartial.cshtml index 54aa33db3..a34b9ee90 100644 --- a/BeWoPlanerMobil/Views/Main/GroupBookingFormPartial.cshtml +++ b/BeWoPlanerMobil/Views/Main/GroupBookingFormPartial.cshtml @@ -264,8 +264,8 @@ @if(Model.NumberOfDokuTypes == 0) {
- - + +
} else diff --git a/BeWoPlanerMobil/Views/Main/GroupBookingSelectionPartial.cshtml b/BeWoPlanerMobil/Views/Main/GroupBookingSelectionPartial.cshtml index 7103b10d9..c4ff2a268 100644 --- a/BeWoPlanerMobil/Views/Main/GroupBookingSelectionPartial.cshtml +++ b/BeWoPlanerMobil/Views/Main/GroupBookingSelectionPartial.cshtml @@ -67,7 +67,32 @@ @* Ziele *@ @if((Model.GroupBookingSelectedCostBearerSupportConcepts?.Any() ?? false) && (Model.AllGoals?.Any() ?? false)) { -
+
+
+
+
+
+ +
+
+ +
+
+
+
+
+ @Html.Partial("GoalTreePartial", Model) +
+
+
+
+
+
+ + + @*
+
*@ } @* Kategorie und Leistungen *@ diff --git a/BeWoPlanerMobil/Views/Main/Main.cshtml b/BeWoPlanerMobil/Views/Main/Main.cshtml index 581f8b32d..9938dca2a 100644 --- a/BeWoPlanerMobil/Views/Main/Main.cshtml +++ b/BeWoPlanerMobil/Views/Main/Main.cshtml @@ -60,7 +60,7 @@ function validatePasswordStrength() { try{ - (new window.MoKPasswordSecurity("pw-strength-feedback")).validatePassword($("#new-password").val()); + (new MoKPasswordSecurity("pw-strength-feedback")).validatePassword($("#new-password").val()); } catch(error) { window.showErrorPopup(error); } diff --git a/BeWoPlanerMobil/Views/Main/MultiBookingFormPartial.cshtml b/BeWoPlanerMobil/Views/Main/MultiBookingFormPartial.cshtml index 1f6d6c145..ff473a3d4 100644 --- a/BeWoPlanerMobil/Views/Main/MultiBookingFormPartial.cshtml +++ b/BeWoPlanerMobil/Views/Main/MultiBookingFormPartial.cshtml @@ -258,8 +258,8 @@ @if(Model.NumberOfDokuTypes == 0) {
- - + +
} else diff --git a/BeWoPlanerMobil/Views/Main/RestoreServiceRecordInputsPartial.cshtml b/BeWoPlanerMobil/Views/Main/RestoreServiceRecordInputsPartial.cshtml index 11573b25c..e2f50ace6 100644 --- a/BeWoPlanerMobil/Views/Main/RestoreServiceRecordInputsPartial.cshtml +++ b/BeWoPlanerMobil/Views/Main/RestoreServiceRecordInputsPartial.cshtml @@ -3,27 +3,21 @@ @using BeWoPlanerMobil.Util @model BeWoPlanerMobil.Models.MainModel -@* - ToDo: Bei Hilfeplan schauen, ob die Ziele/Maßnahmen, Kategorie/Leistung, Textbausteines korrekt sind. -*@ - - - - + diff --git a/Shared/Core/Utils.cs b/Shared/Core/Utils.cs index edbf91c84..129ad720e 100644 --- a/Shared/Core/Utils.cs +++ b/Shared/Core/Utils.cs @@ -1,4 +1,9 @@ -using System; +using BS.Shared.DataContracts; +using BS.Shared.DataContracts.Compact; +using BS.Shared.Extensions; +using DevExpress.XtraScheduler; +using Newtonsoft.Json; +using System; using System.Collections; using System.Collections.Generic; using System.Collections.Specialized; @@ -15,10 +20,6 @@ using System.Text.RegularExpressions; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Xml.Serialization; -using BS.Shared.DataContracts; -using BS.Shared.DataContracts.Compact; -using BS.Shared.Extensions; -using DevExpress.XtraScheduler; namespace BS.Shared.Core { @@ -1198,7 +1199,29 @@ namespace BS.Shared.Core string msg = iso.GetString(isoBytes); return msg; } - } + + /// + /// Wandelt einen JSON-String in ein Wörterbuch vom Typ Dictionary um. + /// + /// Die serialisierte Map + /// Dictionary vom Typ Dictionary. + public static Dictionary JsonMap2Dictionary(string json) + { + var dictionary = new Dictionary(); + + var pairs = JsonConvert.DeserializeObject>>(json); + + foreach(var pair in pairs) + { + if(pair.Count >= 2 && pair[0].HasValue) + { + dictionary[pair[0].Value] = pair[1]; + } + } + + return dictionary; + } + } public struct NullCompareResult {