diff --git a/BeWo/BeWo.csproj b/BeWo/BeWo.csproj index aa599c87b..702658535 100644 --- a/BeWo/BeWo.csproj +++ b/BeWo/BeWo.csproj @@ -63,7 +63,7 @@ TRACE;DEBUG prompt 4 - x86 + AnyCPU AllRules.ruleset true false diff --git a/BeWo/Scheduler/View/NewSchedulerView.xaml.cs b/BeWo/Scheduler/View/NewSchedulerView.xaml.cs index 37621e971..f3681c1d7 100644 --- a/BeWo/Scheduler/View/NewSchedulerView.xaml.cs +++ b/BeWo/Scheduler/View/NewSchedulerView.xaml.cs @@ -1578,7 +1578,9 @@ namespace BeWo.Scheduler.View var mitarbeiterliste = appointment.CF_EmployeeList(); var istErsteller = ersteller?.EmployeeOid.Equals(BeWoApp.LoggedOnEmployee.EmployeeOid) ?? false; - if(!istErsteller && appointment.CF_IsPrivate() && !mitarbeiterliste.Any(a => Equals(a.Employee, BeWoApp.CompactLoggedOnEmployee)) || !appointment.CF_CanBeEdited()) + bool canBeEdited = appointment.CF_CanBeEdited(); + + if (!istErsteller && appointment.CF_IsPrivate() && !mitarbeiterliste.Any(a => Equals(a.Employee, BeWoApp.CompactLoggedOnEmployee)) || !canBeEdited) { darfTerminDetailsSehen = false; } @@ -1946,8 +1948,13 @@ namespace BeWo.Scheduler.View var customerList = appointment.CF_CustomerList(); var employeeList = employee2SchedulerAppointmentList.Select(employee2SchedulerAppointment => employee2SchedulerAppointment.Employee).ToList(); + String notice = appointment.Description; + if (String.IsNullOrEmpty(notice)) + { + notice = appointment.Subject; + } - BeWoUtils.CreateZeiterfassung(appointment.Start, appointment.End, customerList, employeeList, appointment.Subject, appointment, serviceRecords => + BeWoUtils.CreateZeiterfassung(appointment.Start, appointment.End, customerList, employeeList, notice, appointment, serviceRecords => { try { diff --git a/BeWo/Scheduler/ViewModel/CustomFieldStorage.cs b/BeWo/Scheduler/ViewModel/CustomFieldStorage.cs index 6f78af236..d190fa5a9 100644 --- a/BeWo/Scheduler/ViewModel/CustomFieldStorage.cs +++ b/BeWo/Scheduler/ViewModel/CustomFieldStorage.cs @@ -141,6 +141,10 @@ namespace BeWo.Scheduler.ViewModel _AbsenceTimeEnd = pAppointment.AbsenceTimeEnd; HasServiceRecordEntry = pAppointment.HasServiceRecordEntry; + if (Subject.Contains("Flingern")) + { + int test = 0; + } CanBeEdited = pAppointment.CanBeEdited; AbsenceTimeOid = pAppointment.AbsenceTimeOid; diff --git a/BeWo/ownChat/ChatDokumentationsView.xaml.cs b/BeWo/ownChat/ChatDokumentationsView.xaml.cs index d7a3e96f5..68031b05a 100644 --- a/BeWo/ownChat/ChatDokumentationsView.xaml.cs +++ b/BeWo/ownChat/ChatDokumentationsView.xaml.cs @@ -192,8 +192,13 @@ namespace BeWo.ownChat if(vm.PrototypeVM.SortedCategories != null && vm.PrototypeVM.SortedCategories.Count > 0) { var cat1 = vm.PrototypeVM.SortedCategories[0]; - - dc.ServiceDescription = vm.PrototypeVM.Category2Services[cat1][0]; + if (vm.PrototypeVM.Category2Services.ContainsKey(cat1)) + { + if (vm.PrototypeVM.Category2Services[cat1].Count > 0) + { + dc.ServiceDescription = vm.PrototypeVM.Category2Services[cat1][0]; + } + } } _ServiceRecord = new ServiceRecordVM(dc, vm.PrototypeVM.Category2Services, vm.PrototypeVM.AllGoalCategories, vm.PrototypeVM.AllGoals) diff --git a/BeWoPlanerMobil/BeWoPlanerMobil.csproj b/BeWoPlanerMobil/BeWoPlanerMobil.csproj index 5a4a7d69b..eb41afbeb 100644 --- a/BeWoPlanerMobil/BeWoPlanerMobil.csproj +++ b/BeWoPlanerMobil/BeWoPlanerMobil.csproj @@ -24,7 +24,7 @@ - false + true 4.3 @@ -74,6 +74,7 @@ True + x64 @@ -316,6 +317,7 @@ + @@ -325,7 +327,6 @@ - @@ -588,6 +589,7 @@ + @@ -677,6 +679,7 @@ + diff --git a/BeWoPlanerMobil/BeWoPlanerMobil.csproj.user b/BeWoPlanerMobil/BeWoPlanerMobil.csproj.user index b4ed802f5..91a3728dd 100644 --- a/BeWoPlanerMobil/BeWoPlanerMobil.csproj.user +++ b/BeWoPlanerMobil/BeWoPlanerMobil.csproj.user @@ -2,7 +2,7 @@ false - false + true diff --git a/BeWoPlanerMobil/Controllers/AbstractBaseController.cs b/BeWoPlanerMobil/Controllers/AbstractBaseController.cs index 70862f4a8..80733ca9f 100644 --- a/BeWoPlanerMobil/Controllers/AbstractBaseController.cs +++ b/BeWoPlanerMobil/Controllers/AbstractBaseController.cs @@ -66,7 +66,7 @@ namespace BeWoPlanerMobil.Controllers } else { - model.SessionModel = (ISessionModel)Session[sessionkey]; + model.SessionModel = (BaseSessionModel)Session[sessionkey]; } } } diff --git a/BeWoPlanerMobil/Controllers/CustomerController.cs b/BeWoPlanerMobil/Controllers/CustomerController.cs index 58473a40d..d7bd42ba0 100644 --- a/BeWoPlanerMobil/Controllers/CustomerController.cs +++ b/BeWoPlanerMobil/Controllers/CustomerController.cs @@ -983,8 +983,9 @@ namespace BeWoPlanerMobil.Controllers var zahlung = kassenbuch?.Bargeldtransaktionen.FirstOrDefault(bargeldtransaktion => bargeldtransaktion.BargeldtransaktionOid.Equals(transaktionsOid)); Model.SelectedBargeldtransaktion = zahlung; + Model.SelectedBargeldtransaktionOid = zahlung?.BargeldtransaktionOid; - if(zahlung != null) + if (zahlung != null) { Model.SelectedTransaktionsart = (int) zahlung.Zahlungstyp; } @@ -1018,6 +1019,7 @@ namespace BeWoPlanerMobil.Controllers } Model.SelectedBargeldtransaktion = null; + Model.SelectedBargeldtransaktionOid = null; Model.SelectedTransaktionsart = 0; Model.SelectedBargeldkasseOid = bargeldkassenOid; @@ -1088,6 +1090,7 @@ namespace BeWoPlanerMobil.Controllers OperationsService.UpdateBargeldkasse(bargeldkasse); Model.SelectedBargeldkasseOid = null; + Model.SelectedBargeldtransaktionOid = null; ReloadBargeldkassen(); diff --git a/BeWoPlanerMobil/Controllers/MainController.cs b/BeWoPlanerMobil/Controllers/MainController.cs index 9762d7e13..cbb5c99c7 100644 --- a/BeWoPlanerMobil/Controllers/MainController.cs +++ b/BeWoPlanerMobil/Controllers/MainController.cs @@ -87,11 +87,11 @@ namespace BeWoPlanerMobil.Controllers private static readonly List _GoalTypes = new List { ValueListEntryType.SupportConceptGoalCategoryType, ValueListEntryType.SupportConceptIndividualGoalCategoryType }; private static readonly List _MeasureTypes = new List { ValueListEntryType.SupportConceptGoalType, ValueListEntryType.SupportConceptIndividualGoalType }; - public void InitViewModel() + public void InitViewModel(bool forceReload = false) { InitSettings(); - CreateModelSupportConceptListObjects(false); + CreateModelSupportConceptListObjects(forceReload); Model.GroupsOfPeople = EmployeeService.GetAllGroups(LoggedInEmployee.EmployeeOid).OrderBy(gop => gop.Name).ToList(); @@ -289,7 +289,7 @@ namespace BeWoPlanerMobil.Controllers if(Model.IsInEditingMode && Model.SelectedServiceRecordOid.HasValue) { - Model.SelectedServiceRecord = Model.ServiceRecords.FirstOrDefault(sr => sr.ServiceRecordOid.Equals(Model.SelectedServiceRecordOid.Value)); + Model.SelectedServiceRecord = GetServiceRecordDC(Model.SelectedServiceRecordOid.Value, false); } } @@ -313,14 +313,15 @@ namespace BeWoPlanerMobil.Controllers Model.FilterGroupServiceCategories = UserSettingsUtils.GetSettingValueAsBool(Model.Mandator.Settings, SettingsKeys.FilterGroupServiceCategories); Model.SetStartTimeToEndTimeAfterSave = UserSettingsUtils.GetSettingValueAsBool(Model.Mandator.Settings, SettingsKeys.SetStartTimeToEndTimeAfterSave); - Model.MokSettings = new MokSettings(); - - Model.MokSettings.SupportConceptExpirationLimitInMonths = UserSettingsUtils.GetSettingValueAsInteger(Model.Mandator.Settings, SettingsKeys.HilfeplanAuslaufAuswahl, 3); - Model.MokSettings.AnzTageZeiterfassErfolgt = UserSettingsUtils.GetSettingValueAsInteger(Model.Mandator.Settings, SettingsKeys.AnzTageZeiterfassErfolgt); - Model.MokSettings.AnzTageUnterschriftErfolgt = UserSettingsUtils.GetSettingValueAsInteger(Model.Mandator.Settings, SettingsKeys.AnzTageUnterschriftErfolgt); - Model.MokSettings.MaxDaysEditServiceRecordsAllowed = UserSettingsUtils.GetSettingValueAsInteger(Model.Mandator.Settings, SettingsKeys.MaxDaysEditServiceRecordsAllowed); - Model.MokSettings.TimeUntilUILock = UserSettingsUtils.GetSettingValueAsInteger(Model.Mandator.Settings, SettingsKeys.TimeUntilUILock); - Model.MokSettings.ServiceRecordAllowChangeHours = UserSettingsUtils.GetSettingValueAsInteger(Model.Mandator.Settings, SettingsKeys.ServiceRecordAllowChangeHours); + Model.MokSettings = new MokSettings + { + SupportConceptExpirationLimitInMonths = UserSettingsUtils.GetSettingValueAsInteger(Model.Mandator.Settings, SettingsKeys.HilfeplanAuslaufAuswahl, 3), + AnzTageZeiterfassErfolgt = UserSettingsUtils.GetSettingValueAsInteger(Model.Mandator.Settings, SettingsKeys.AnzTageZeiterfassErfolgt), + AnzTageUnterschriftErfolgt = UserSettingsUtils.GetSettingValueAsInteger(Model.Mandator.Settings, SettingsKeys.AnzTageUnterschriftErfolgt), + MaxDaysEditServiceRecordsAllowed = UserSettingsUtils.GetSettingValueAsInteger(Model.Mandator.Settings, SettingsKeys.MaxDaysEditServiceRecordsAllowed), + TimeUntilUILock = UserSettingsUtils.GetSettingValueAsInteger(Model.Mandator.Settings, SettingsKeys.TimeUntilUILock), + ServiceRecordAllowChangeHours = UserSettingsUtils.GetSettingValueAsInteger(Model.Mandator.Settings, SettingsKeys.ServiceRecordAllowChangeHours) + }; Model.ShowServiceRecordInsertedOn = !UserSettingsUtils.GetSettingValueAsBool(Model.Mandator.Settings, SettingsKeys.HideServiceRecordInsertedByAndInsertedOn); @@ -398,15 +399,15 @@ namespace BeWoPlanerMobil.Controllers { Model.SelectedCostBearerSupportConceptOid = cb2ScOid; - bool istEinzelBuchung = !Model.IsInGroupBookingMode && !Model.IsInMultiBookingMode; + var istEinzelBuchung = !Model.IsInGroupBookingMode && !Model.IsInMultiBookingMode; - if (istEinzelBuchung) + if(istEinzelBuchung) { Model.SelectedSupportConcept = Model.SupportConcepts.FirstOrDefault(sc => sc.CostBearerRelOids.Any(a => a.Equals(Model.SelectedCostBearerSupportConceptOid))); } - if (istEinzelBuchung && ((!cb2ScOid.HasValue) || cb2ScOid.Value == -1)) + if(istEinzelBuchung && (!cb2ScOid.HasValue || cb2ScOid.Value == -1)) { // Im Einzelmodus entweder nichts oder "Hilfeplan auswählen" (-1) ausgewählt. Model.Categories2Descriptions = new Dictionary>(); @@ -416,11 +417,11 @@ namespace BeWoPlanerMobil.Controllers { var allC2SOids = new List(); - if (!istEinzelBuchung) + if(!istEinzelBuchung) { allC2SOids = Model.GroupBookingSelectedCostBearerSupportConceptOids; } - else if (cb2ScOid.HasValue && cb2ScOid.Value > 0) + else if(cb2ScOid.HasValue && cb2ScOid.Value > 0) { allC2SOids.Add(cb2ScOid.Value); } @@ -434,31 +435,31 @@ namespace BeWoPlanerMobil.Controllers LoadGoals(infos); - if (istEinzelBuchung && Model.SelectedSupportConcept != null && infos.Count == 1) + if(istEinzelBuchung && Model.SelectedSupportConcept != null && infos.Count == 1) { Model.SelectedSupportConcept.Goals = infos[0].SupportConceptGoals; } - if (Model.SupportConcepts != null) + + if(Model.SupportConcepts != null) { - foreach (var info in infos) + foreach(var info in infos) { var sc = Model.SupportConcepts.FirstOrDefault(s => s.SupportConceptOid == info.SupportConceptOid); - if (sc != null) + + if(sc != null) { sc.Goals = info.SupportConceptGoals; } } } } - - // Ist der Klient abwesend, wird dies wie im FaC angezeigt if (Model.SelectedSupportConcept?.Customer?.AbsenceTimes?.Any() ?? false) { - foreach (var absenceTime in Model.SelectedSupportConcept.Customer.AbsenceTimes) + foreach(var absenceTime in Model.SelectedSupportConcept.Customer.AbsenceTimes) { - if (absenceTime.Start.HasValue && DateTime.Now > absenceTime.Start.Value && (absenceTime.End is null || DateTime.Now < absenceTime.End.Value)) + if(absenceTime.Start.HasValue && DateTime.Now > absenceTime.Start.Value && (absenceTime.End is null || DateTime.Now < absenceTime.End.Value)) { Model.IsCustomerAbsence = true; Model.CustomerAbsenceInfo = $"{absenceTime.Reason.Description} von {absenceTime.Start:dd.MM.yyyy} bis {(absenceTime.End.HasValue ? absenceTime.End.Value.ToString("dd.MM.yyyy") : "unbekannt")}"; @@ -476,7 +477,7 @@ namespace BeWoPlanerMobil.Controllers } - if (loadTextModules) + if(loadTextModules) { LoadTextModules(); } @@ -535,7 +536,7 @@ namespace BeWoPlanerMobil.Controllers private IList GetSelectedGroupBookingSupportConcepts() { - if (Model.SupportConcepts == null || Model.SupportConcepts.Count == 0) + if(Model.SupportConcepts is null || Model.SupportConcepts.Count == 0) { CreateModelSupportConceptListObjects(true); } @@ -1125,7 +1126,7 @@ namespace BeWoPlanerMobil.Controllers var date = DateTime.Parse(formCollection[FormCollectionConstants.ServiceRecordSignatureDateKey]); long.TryParse(formCollection[FormCollectionConstants.ServiceRecordSignatureRecordOidKey], out var serviceRecordOid); - var serviceRecord = Model.ServiceRecords.FirstOrDefault(sr => sr.ServiceRecordOid.HasValue && sr.ServiceRecordOid.Value.Equals(serviceRecordOid)); + var serviceRecord = GetServiceRecordDC(serviceRecordOid, false); if (serviceRecordOid < 1 || serviceRecord is null) { @@ -1243,57 +1244,13 @@ namespace BeWoPlanerMobil.Controllers [Authorize] public ActionResult LoadUpToDateTextModules() { - - - if (!IsUserLoggedIn()) + if(!IsUserLoggedIn()) { TempData[TempDataConstants.DoLogoutKey] = true; return PartialView("TextModulePartial"); } - - //Wird alles im InitViewModel gemacht: - - //Model.TextModules.Clear(); - - //if(Model.SelectedServiceCategoryOid.HasValue && (Model.LoggedInEmployee?.EmployeeOid.HasValue ?? false)) - //{ - // var allTextModules = OperationsService.GetTextModules(Model.HasRightToSeeGlobalTextModules, Model.LoggedInEmployee.EmployeeOid.Value, Model.HasRightToSeeGlobalTextModules, false); - - // foreach(var tm in allTextModules.Where(textModule => textModule.IsParent == false)) - // { - // if(string.IsNullOrWhiteSpace(tm.Text)) - // { - // tm.Text = tm.Name; - // } - // } - - // Model.AllTextModules = allTextModules.Where(tb => tb.TextModuleOid.HasValue).Select(tb => new TextbausteinDisplayItem(tb.Name, tb.Text, tb.Parent?.TextModuleOid, tb.TextModuleOid.Value, tb.IsExpanded)).ToList(); - - // var x = allTextModules.Where( - // w => (w.ServiceCategory is null || w.ServiceCategory.ServiceCategoryOid == Model.SelectedServiceCategoryOid.Value) - // && !string.IsNullOrEmpty(w.Text) - // && (w.IsOnlyForEmployee && w.Employee.EmployeeOid.Equals(Model.LoggedInEmployee.EmployeeOid) || !w.IsOnlyForEmployee)).OrderBy(t => t.Text).ToList(); - - // x.AddRangeIfElementsNotIn(BS.Shared.Core.Utils.GetParentTextModules(x)); - - // var textModuleDisplayItems = x.Where(tb => tb.TextModuleOid.HasValue).Select(tb => new TextbausteinDisplayItem(tb.Name, tb.Text, tb.Parent?.TextModuleOid, tb.TextModuleOid.Value, tb.IsExpanded)).ToList(); - - // foreach(var item in textModuleDisplayItems) - // { - // if(item.ParentOid is null) - // { - // continue; - // } - - // var parent = textModuleDisplayItems.FirstOrDefault(p => p.Oid == item.ParentOid); - - // parent?.Children.AddIfNotIn(item); - // } - - // Model.TextModules = textModuleDisplayItems.Where(item => item.ParentOid is null).OrderBy(item => item.Name).ToList(); - //} - + //Wird alles im InitViewModel gemacht return PartialView("TextModulePartial", Model); } @@ -2104,28 +2061,22 @@ namespace BeWoPlanerMobil.Controllers { SkipModelInitialization = true; //Verhindere mehrfache Initialisierung, weil später sowieso zur Main Action geleitet wird - if (Model is null) + if(Model is null) { TempData[TempDataConstants.DoLogoutKey] = true; return Logout(); } long? cb2ScOid = Convert.ToInt64(formCollection[FormCollectionConstants.CostBearer2SupportConceptOidKey]); - if (Model.SelectedCostBearerSupportConceptOid.HasValue && Model.SelectedCostBearerSupportConceptOid != cb2ScOid) - { - Model.SelectedGoalOids = new List(); - Model.SelectedGoals = new List(); - } - Model.SelectedCostBearerSupportConceptOid = cb2ScOid; - Model.CurrentPage = 1; + SelectCb2ScRelation(cb2ScOid); // Sorgt dafür, dass nach dem Neuladen die Abhängigkeiten vom Hilfeplan erhalten bleiben TempData[TempDataConstants.SupportConceptRelSelectedKey] = true; return RedirectToActionPermanent("Main");//ResetEditingMode(); } - catch (Exception e) + catch(Exception e) { Log.Error($"ERROR SelectSupportConcept: {e.Message}\n{e.StackTrace}"); @@ -2133,6 +2084,18 @@ namespace BeWoPlanerMobil.Controllers } } + private void SelectCb2ScRelation(long? cb2ScOid) + { + if(Model.SelectedCostBearerSupportConceptOid.HasValue && Model.SelectedCostBearerSupportConceptOid != cb2ScOid) + { + Model.SelectedGoalOids = new List(); + Model.SelectedGoals = new List(); + } + + Model.SelectedCostBearerSupportConceptOid = cb2ScOid; + Model.CurrentPage = 1; + } + private void LoadServiceCategoriesToModel(List infos) { Model.Categories2Descriptions = new Dictionary>(); @@ -2340,7 +2303,7 @@ namespace BeWoPlanerMobil.Controllers if(Model.ServiceRecordOidToDelete != null && Model.ServiceRecordOidToDelete > 0 && LoggedInUser.UserGroups.Any(a => a.Rights.Any(f => f.Equals(UserRightType.ServiceRecordView_Delete)))) { - var serviceRecordDC = Model.ServiceRecords.FirstOrDefault(f => f.ServiceRecordOid != null && f.ServiceRecordOid.Value.Equals(Model.ServiceRecordOidToDelete)); + var serviceRecordDC = GetServiceRecordDC(Model.ServiceRecordOidToDelete.Value, false); var version = serviceRecordDC?.ServiceRecordVersion; if(version != null && Model.IsAllowedToDeleteServiceRecord(serviceRecordDC)) @@ -2683,7 +2646,7 @@ namespace BeWoPlanerMobil.Controllers if(Model.SelectedServiceRecordOid.HasValue) { - result = SerializeObject(Model.ServiceRecords.First(f => f.ServiceRecordOid == Model.SelectedServiceRecordOid)); + result = SerializeObject(GetServiceRecordDC(Model.SelectedServiceRecordOid.Value, false)); } return result; @@ -2698,7 +2661,7 @@ namespace BeWoPlanerMobil.Controllers return LeerzeichenFuerGetMethoden; } - var serviceRecord = Model.ServiceRecords.FirstOrDefault(f => f.ServiceRecordOid.HasValue && f.ServiceRecordOid.Value.Equals(oid)) ?? OperationsService.GetServiceRecordById(oid); + var serviceRecord = GetServiceRecordDC(oid, false); if(serviceRecord?.ServiceRecordOid is null) { @@ -2772,9 +2735,9 @@ namespace BeWoPlanerMobil.Controllers } var checkServiceRecord = new ServiceRecordDC(); - if(inEditMode) + if(inEditMode && Model.SelectedServiceRecordOid.HasValue) { - checkServiceRecord = Model.ServiceRecords.FirstOrDefault(f => f.ServiceRecordOid.HasValue && f.ServiceRecordOid.Value.Equals(Model.SelectedServiceRecordOid)); + checkServiceRecord = GetServiceRecordDC(Model.SelectedServiceRecordOid.Value, false); } if(checkServiceRecord is null) @@ -3640,41 +3603,43 @@ namespace BeWoPlanerMobil.Controllers } [Authorize] - public ActionResult AddScCbRelsToGroupBooking(string[] relOids, string[] groupOids) + public ActionResult AddScCbRelsToGroupBooking(string[] relOids, string[] groupOids, bool isGroupTabActive) { - if(!IsUserLoggedIn()) - { + { TempData[TempDataConstants.DoLogoutKey] = true; return PartialView("GroupBookingScCbRelList"); } AddScCbRelsToGroupOrMultiBooking(relOids, groupOids); + TempData[TempDataConstants.IsGroupTabActiveKey] = isGroupTabActive; + return PartialView("GroupBookingScCbRelList", Model); } [Authorize] - public ActionResult AddScCbRelsToMultiBooking(string[] relOids, string[] groupOids) + public ActionResult AddScCbRelsToMultiBooking(string[] relOids, string[] groupOids, bool isGroupTabActive) { - if (!IsUserLoggedIn()) + if(!IsUserLoggedIn()) { TempData[TempDataConstants.DoLogoutKey] = true; return PartialView("MultiBookingScCbRelList"); } + AddScCbRelsToGroupOrMultiBooking(relOids, groupOids); + TempData[TempDataConstants.IsGroupTabActiveKey] = isGroupTabActive; + return PartialView("MultiBookingScCbRelList", Model); } private void AddScCbRelsToGroupOrMultiBooking(string[] relOids, string[] groupOids) { - SkipModelInitialization = true; var singleRels = new List(); var groupRels = new List(); - var groups = new List(); if (groupOids is null) { @@ -3702,6 +3667,27 @@ namespace BeWoPlanerMobil.Controllers } }); + AddScCbRelsToBooking(singleRels, groupRels); + + // Sorgt dafür, dass nach dem Neuladen die Abhängigkeiten vom Hilfeplan erhalten bleiben + TempData[TempDataConstants.SupportConceptRelSelectedKey] = true; + } + + [Authorize] + public void AddScCbRelsToBooking(List singleRels, List groupRels, bool forceReload = false) + { + var groups = new List(); + + if(singleRels is null) + { + singleRels = new List(); + } + + if(groupRels is null) + { + groupRels = new List(); + } + Model.GroupsOfPeople = EmployeeService.GetAllGroups(LoggedInEmployee.EmployeeOid).OrderBy(gop => gop.Name).ToList(); Model.GroupBookingSelectedGroupOfPeopleOids.Clear(); @@ -3710,7 +3696,7 @@ namespace BeWoPlanerMobil.Controllers { var group = Model.GroupsOfPeople.FirstOrDefault(f => f.GroupOfPeopleOid.HasValue && f.GroupOfPeopleOid.Value.Equals(groupOid)); - if (group is null) + if(group is null) { return; } @@ -3721,45 +3707,33 @@ namespace BeWoPlanerMobil.Controllers Model.GroupBookingSelectedCostBearerSupportConcepts.Clear(); - Model.GroupBookingSelectedCostBearerSupportConceptOids.Clear(); Model.GroupBookingSelectedCostBearerSupportConceptOids.AddRangeIfElementsNotIn(singleRels); - //var selectedSupportConcepts = CustomerService.GetSupportConceptsByCostbearer2SupportConceptRelOids(singleRels); - - //var groupCostBearerRelations = CustomerService.GetSupportConceptCostBearerRelationsById(singleRels); - - - foreach (var gruppe in groups.Where(g => g.GroupOfPeopleOid.HasValue)) + foreach(var gruppe in groups.Where(g => g.GroupOfPeopleOid.HasValue)) { var groupRelOids = new List(); gruppe.SupportConceptList.ForEach(f => groupRelOids.AddRange(f.CostBearerRelOids)); - if (!gruppe.GroupOfPeopleOid.HasValue) + if(!gruppe.GroupOfPeopleOid.HasValue) { continue; } var groupOid = gruppe.GroupOfPeopleOid.Value; - if (singleRels.ContainsItems(groupRelOids)) + if(singleRels.ContainsItems(groupRelOids)) { Model.GroupBookingSelectedGroupOfPeopleOids.AddIfNotIn(groupOid); } - else if (Model.GroupBookingSelectedGroupOfPeopleOids.Contains(groupOid)) + else if(Model.GroupBookingSelectedGroupOfPeopleOids.Contains(groupOid)) { Model.GroupBookingSelectedGroupOfPeopleOids.Remove(groupOid); } } - //Model.SelectedConceptCostBearerRelationOids = Model.SelectedConceptCostBearerRelations.Select(s => s.CostBearer2SupportConceptOid.Value).ToList(); - //Model.GroupBookingSelectedSupportConceptOids = Model.GroupBookingSelectedSupportConcepts.Select(s => s.SupportConceptOid.Value).ToList(); - - CreateModelSupportConceptListObjects(false); + CreateModelSupportConceptListObjects(forceReload); LoadSupportConceptThings(null, true); - - // Sorgt dafür, dass nach dem Neuladen die Abhängigkeiten vom Hilfeplan erhalten bleiben - TempData[TempDataConstants.SupportConceptRelSelectedKey] = true; } [Authorize] @@ -3817,14 +3791,26 @@ namespace BeWoPlanerMobil.Controllers rawEmployeeOids.DoForEach(s => oids.AddIfNotIn(long.Parse(s))); - var employees = Model.EmployeesForGroupAndMultiBooking.Where(w => oids.Contains(w.EmployeeOid)); + AddEmployeesToGroupBookingInternally(oids); + + return JsonConvert.SerializeObject(Model.GroupBookingSelectedEmployees.Count); + } + + [Authorize] + public void AddEmployeesToGroupBookingInternally(List employeeOids) + { + if(employeeOids == null || employeeOids.Count == 0) + { + Model.GroupBookingSelectedEmployees.Clear(); + Model.GroupBookingSelectedEmployeeOids.Clear(); + return; + } + + var employees = Model.EmployeesForGroupAndMultiBooking.Where(w => employeeOids.Contains(w.EmployeeOid)); Model.GroupBookingSelectedEmployees.Clear(); Model.GroupBookingSelectedEmployees.AddRangeIfElementsNotIn(employees); Model.GroupBookingSelectedEmployeeOids = Model.GroupBookingSelectedEmployees.Select(e => e.EmployeeOid).ToList(); - - return JsonConvert.SerializeObject(Model.GroupBookingSelectedEmployees.Count); - } [Authorize] @@ -4745,17 +4731,26 @@ namespace BeWoPlanerMobil.Controllers return JsonConvert.SerializeObject(Model.GroupBookingSelectedEmployees.Count); } - var rawEmployeeOids = pEmployeeOids.Split(','); - var oids = new List(); + var oids = string.IsNullOrWhiteSpace(pEmployeeOids) ? new List() : pEmployeeOids.Split(new[] {','}, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToList(); - rawEmployeeOids.DoForEach(s => oids.AddIfNotIn(long.Parse(s))); + AddEmployeesToMultiBookingInternally(oids); - var employees = Model.EmployeesForGroupAndMultiBooking.Where(w => oids.Contains(w.EmployeeOid)); + return JsonConvert.SerializeObject(Model.GroupBookingSelectedEmployees.Count); + } + + [Authorize] + public void AddEmployeesToMultiBookingInternally(List employeeOids) + { + if(employeeOids is null || employeeOids.Count == 0) + { + Model.GroupBookingSelectedEmployees.Clear(); + return; + } + + var employees = Model.EmployeesForGroupAndMultiBooking.Where(w => employeeOids.Contains(w.EmployeeOid)); Model.GroupBookingSelectedEmployees.Clear(); Model.GroupBookingSelectedEmployees.AddRangeIfElementsNotIn(employees); - - return JsonConvert.SerializeObject(Model.GroupBookingSelectedEmployees.Count); } // Veraltet @@ -5035,7 +5030,7 @@ namespace BeWoPlanerMobil.Controllers } [Authorize] - public ActionResult ReloadGoals() + public ActionResult ReloadGoals(bool forceReload = false) { SkipModelInitialization = true; if (!IsUserLoggedIn()) @@ -5045,7 +5040,7 @@ namespace BeWoPlanerMobil.Controllers //LoadGoals(); - CreateModelSupportConceptListObjects(false); + CreateModelSupportConceptListObjects(forceReload); LoadSupportConceptThings(null, true); return PartialView("GoalTreePartial", Model); @@ -5062,14 +5057,19 @@ namespace BeWoPlanerMobil.Controllers if(long.TryParse(categoryOidStr, out var categoryOid)) { - Model.SelectedServiceCategory = Model.Categories2Descriptions.FirstOrDefault(f => f.Key?.ServiceCategoryOid != null && f.Key.ServiceCategoryOid.Value.Equals(categoryOid)).Key; - Model.SelectedServiceDescription = null; + SelectServiceCategory(categoryOid); + } - if(Model.SelectedServiceCategory is null) - { - return PartialView("Category2ServiceDescriptionPartial", Model); - } + return PartialView("Category2ServiceDescriptionPartial", Model); + } + private void SelectServiceCategory(long categoryOid) + { + Model.SelectedServiceCategory = Model.Categories2Descriptions.FirstOrDefault(f => f.Key?.ServiceCategoryOid != null && f.Key.ServiceCategoryOid.Value.Equals(categoryOid)).Key; + Model.SelectedServiceDescription = null; + + if(Model.SelectedServiceCategory != null) + { var selectedServiceDescription = Model.Categories2Descriptions[Model.SelectedServiceCategory].OrderBy(sd => sd.Position).ThenBy(sd => sd.ServiceDescriptionOid).FirstOrDefault(); Model.SelectedServiceDescription = selectedServiceDescription; @@ -5077,8 +5077,6 @@ namespace BeWoPlanerMobil.Controllers Model.SelectedServiceCategoryOid = Model.SelectedServiceCategory?.ServiceCategoryOid; Model.SelectedServiceDescriptionOid = Model.SelectedServiceDescription?.ServiceDescriptionOid; } - - return PartialView("Category2ServiceDescriptionPartial", Model); } [Authorize] @@ -5115,15 +5113,23 @@ namespace BeWoPlanerMobil.Controllers [HttpPost] public ActionResult RestoreServiceRecordForm(FormCollection formCollection) { - // Neuen ServiceRecord bauen, als wenn der Nutzer das normal gemacht hätte? - // Geht das auch bei Gruppen- und Mehrfachbuchungen? Ja, siehe Bearbeiten! - + if(Model is null) + { + return Logout(); + } + + var bookingModeValue = formCollection[FormCollectionConstants.BookingModeKey]; + var bookingModeInt = int.Parse(bookingModeValue); + var bookingMode = (BookingMode) bookingModeInt; + var dateInputValue = formCollection[FormCollectionConstants.DateKey]; var startTimeInputValue = formCollection[FormCollectionConstants.StartKey]; var endDateInputValue = formCollection[FormCollectionConstants.EndDateKey]; var endTimeInputValue = formCollection[FormCollectionConstants.EndKey]; + var currentPageValue = formCollection[FormCollectionConstants.CurrentPageKey]; + var doku1 = formCollection[FormCollectionConstants.Dokumentation1Key]; var doku2 = formCollection[FormCollectionConstants.Dokumentation2Key]; var doku3 = formCollection[FormCollectionConstants.Dokumentation3Key]; @@ -5131,42 +5137,146 @@ namespace BeWoPlanerMobil.Controllers var doku5 = formCollection[FormCollectionConstants.Dokumentation5Key]; var doku6 = formCollection[FormCollectionConstants.Dokumentation6Key]; var distanceInputValue = formCollection[FormCollectionConstants.DistanceKey]; - var marker = formCollection[FormCollectionConstants.MarkerKey] == "true"; + + distanceInputValue = distanceInputValue.Replace(".", ","); + var markerRaw = formCollection[FormCollectionConstants.MarkerKey]; + var marker = markerRaw == "true" || markerRaw == "on"; var serviceDescriptionOidInputValue = formCollection[FormCollectionConstants.ServiceDescriptionKey]; var durationInputValue = formCollection[FormCollectionConstants.DurationKey]; + var durationUnit = formCollection[FormCollectionConstants.DurationUnitKey]; + var betragInputValue = formCollection[FormCollectionConstants.BetragKey]; + + var selectedSingleBookingCb2ScOidInputValue = formCollection[FormCollectionConstants.CostBearer2SupportConceptOidKey]; var selectedGroupBookingCb2ScOidsInputValue = formCollection[FormCollectionConstants.GroupBookingSelectedCb2ScOidsKey]; var selectedMultiBookingCb2ScOidsInputValue = formCollection[FormCollectionConstants.MultiBookingSelectedCb2ScOidsKey]; + var selectedSingleBookingEmployeeOidInputValue = formCollection[FormCollectionConstants.SingleBookingEmployeeOidKey]; + if(false == long.TryParse(selectedSingleBookingEmployeeOidInputValue, out var sbEmployeeOid)) + { + sbEmployeeOid = Model.LoggedInEmployee.EmployeeOid.Value; + } + var selectedGroupBookingEmployeeOidsInputValue = formCollection[FormCollectionConstants.GroupBookingSelectedEmployeeOidsKey]; var selectedMultiBookingEmployeeOidsInputValue = formCollection[FormCollectionConstants.MultiBookingSelectedEmployeeOidsKey]; + var selectedGoalOidsInputValue = formCollection[FormCollectionConstants.SelectedGoalOids]; + var goalOids = string.IsNullOrWhiteSpace(selectedGoalOidsInputValue) ? new List() : selectedGoalOidsInputValue.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToList(); + var isStartDateValid = DateTime.TryParse(dateInputValue, out var startDate); + if(false == isStartDateValid) + { + startDate = DateTime.Today; + } + var isEndDateValid = DateTime.TryParse(endDateInputValue, out var endDate); + decimal.TryParse(distanceInputValue, out var distance); + decimal.TryParse(betragInputValue, out var betrag); + + var isServiceDescriptionOidValid = long.TryParse(serviceDescriptionOidInputValue, out var serviceDescriptionOid); + var isSbCb2ScOidValid = long.TryParse(selectedSingleBookingCb2ScOidInputValue, out var sbCb2ScOid); + + var isCurrentPageValid = int.TryParse(currentPageValue, out var currentPage); + + decimal.TryParse(durationInputValue, out var duration); + + if(durationUnit == "h") + { + duration *= 60; + } + + if(currentPage == 0 || false == isCurrentPageValid) + { + currentPage = 1; + } - TempData[TempDataConstants.AfterRestoreKey] = true; + if(isSbCb2ScOidValid) + { + Model.SelectedCostBearerSupportConceptOid = sbCb2ScOid; + + SelectCb2ScRelation(sbCb2ScOid); + + InitViewModel(true); + LoadSupportConceptThings(sbCb2ScOid, true); + + Model.CurrentPage = currentPage; + } var serviceRecord = new ServiceRecordDC(); - if(Model.SelectedServiceRecord is ServiceRecordDC selectedServiceRecord) + // Gruppen- oder Mehrfachbuchung + if(bookingMode is BookingMode.GroupBookingMode || bookingMode is BookingMode.MultiBookingMode) { - serviceRecord = selectedServiceRecord; + var relStr = bookingMode == BookingMode.GroupBookingMode ? selectedGroupBookingCb2ScOidsInputValue : selectedMultiBookingCb2ScOidsInputValue; + var empStr = bookingMode == BookingMode.GroupBookingMode ? selectedGroupBookingEmployeeOidsInputValue : selectedMultiBookingEmployeeOidsInputValue; + + var cb2ScOids = string.IsNullOrWhiteSpace(relStr) ? new List() : relStr.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToList(); + var empOids = string.IsNullOrWhiteSpace(empStr) ? new List() : empStr.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToList(); + + AddScCbRelsToBooking(cb2ScOids, new List(), true); + AddEmployeesToGroupBookingInternally(empOids); + + InitViewModel(true); + + LoadSupportConceptThings(null, true); } - serviceRecord.ServiceRecordType = marker ? ServiceRecordTypeId.Content : ServiceRecordTypeId.DefaultActivity; - serviceRecord.Start = startDate.MergeDateAndTimeString(startTimeInputValue); + if(isServiceDescriptionOidValid) + { + var selectedServiceDescription = Model.Categories2Descriptions.FirstOrDefault(f => f.Value.Any(a => a.ServiceDescriptionOid.HasValue && a.ServiceDescriptionOid.Value.Equals(serviceDescriptionOid))); + + if(selectedServiceDescription is KeyValuePair> category2Description && (category2Description.Key?.ServiceCategoryOid.HasValue ?? false)) + { + SelectServiceCategory(category2Description.Key.ServiceCategoryOid.Value); + + Model.SelectedServiceDescription = category2Description.Value.First(f => f.ServiceDescriptionOid.HasValue && f.ServiceDescriptionOid.Value.Equals(serviceDescriptionOid)); + } + } + + // ToDo für den 13.10.2025: Ziele noch einbauen if(isEndDateValid == false) { endDate = startDate; } + serviceRecord.ServiceRecordType = marker ? ServiceRecordTypeId.Content : ServiceRecordTypeId.DefaultActivity; + serviceRecord.Start = startDate.MergeDateAndTimeString(startTimeInputValue); serviceRecord.End = endDate.MergeDateAndTimeString(endTimeInputValue); + serviceRecord.ServiceDescription = Model.SelectedServiceDescription; + serviceRecord.Betrag = betrag; - return RedirectToActionPermanent("Main", Model); + serviceRecord.RoundedDuration = duration; + + if(bookingMode == BookingMode.SingleBookingMode) + { + serviceRecord.Employee = Model.AllEmployees.FirstOrDefault(f => f.EmployeeOid == sbEmployeeOid) ?? Model.LoggedInUser.Employee; + } + + if(Model.NumberOfDokuTypes == 0) + { + serviceRecord.Notice = doku6; + } + else + { + serviceRecord.Notice = doku1; + serviceRecord.Notice2 = doku2; + serviceRecord.Notice3 = doku3; + serviceRecord.Notice4 = doku4; + serviceRecord.Notice5 = doku5; + } + + serviceRecord.DistanceInMeter = null; + serviceRecord.DistanceInMeterDecimal = distance; + + Model.SelectedServiceRecord = serviceRecord; + + TempData[TempDataConstants.AfterRestoreKey] = true; + + return View("Main", Model); } } diff --git a/BeWoPlanerMobil/Global.asax.cs b/BeWoPlanerMobil/Global.asax.cs index 602ebc385..6b5d8ac7c 100644 --- a/BeWoPlanerMobil/Global.asax.cs +++ b/BeWoPlanerMobil/Global.asax.cs @@ -31,6 +31,9 @@ namespace BeWoPlanerMobil protected void Application_BeginRequest(object sender, EventArgs e) { ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; + + // ToDo: Könnte Probleme beim Login machen, falls der den Header der Login-Anfrage benutzt. + Response.Headers["Referrer-Policy"] = "no-referrer"; } protected void Application_PreRequestHandlerExecute(object sender, EventArgs e) diff --git a/BeWoPlanerMobil/Models/AbstractModel.cs b/BeWoPlanerMobil/Models/AbstractModel.cs index 6907ee331..9ed527393 100644 --- a/BeWoPlanerMobil/Models/AbstractModel.cs +++ b/BeWoPlanerMobil/Models/AbstractModel.cs @@ -27,7 +27,7 @@ namespace BeWoPlanerMobil.Models public bool HasRightToViewEmployeeAppointments => CheckRight(UserRightType.KalenderMitarbeitertermineAnsehen) || CheckRight(UserRightType.ViewAll); public bool HasRightToViewAllResourceAppointments => CheckRight(UserRightType.KalenderRessourcentermineAnsehen) || CheckRight(UserRightType.ViewAll); - public ISessionModel SessionModel { get; internal set; } + public BaseSessionModel SessionModel { get; internal set; } public UserDC LoggedInUser { get; set; } @@ -252,7 +252,7 @@ namespace BeWoPlanerMobil.Models public List Customers { get; set; } = new List(); - public Dictionary Collapsibles2IsShown { get; set; } = new Dictionary(); + public Dictionary Collapsibles2IsShown { get { return SessionModel.Collapsibles2IsShown; } set {SessionModel.Collapsibles2IsShown = value;} } public bool ShowDifferentQBInterval { diff --git a/BeWoPlanerMobil/Models/BaseSessionModel.cs b/BeWoPlanerMobil/Models/BaseSessionModel.cs new file mode 100644 index 000000000..373b4f390 --- /dev/null +++ b/BeWoPlanerMobil/Models/BaseSessionModel.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Web.Mvc; +using BeWo.View.Navigation.Filter; +using BeWoPlanerMobil.Controllers; +using BeWoPlanerMobil.Service; +using BeWoPlanerMobil.Util; +using BS.Shared; +using BS.Shared.DataContracts; +using BS.Shared.DataContracts.Compact; +using DevExpress.XtraReports.UI; + +namespace BeWoPlanerMobil.Models +{ + [Serializable] + public abstract class BaseSessionModel + { + public Dictionary Collapsibles2IsShown { get; set; } = new Dictionary(); + + public virtual void ResetValues() + { + Collapsibles2IsShown = new Dictionary(); + } + } +} \ No newline at end of file diff --git a/BeWoPlanerMobil/Models/CustomerSessionModel.cs b/BeWoPlanerMobil/Models/CustomerSessionModel.cs index ae8e2e361..149059094 100644 --- a/BeWoPlanerMobil/Models/CustomerSessionModel.cs +++ b/BeWoPlanerMobil/Models/CustomerSessionModel.cs @@ -15,7 +15,7 @@ using DevExpress.XtraReports.UI; namespace BeWoPlanerMobil.Models { [Serializable] - public class CustomerSessionModel : ISessionModel + public class CustomerSessionModel : BaseSessionModel { public long? SelectedCustomerOid { get; set; } @@ -35,8 +35,10 @@ namespace BeWoPlanerMobil.Models public int SelectedTransaktionsart { get; set; } - public void ResetValues() + public override void ResetValues() { + base.ResetValues(); + SelectedCustomerOid = null; //SelectedCustomerFilter = CustomerFilterEnum.All; //SelectedReportType = CustomerReportType.Medikamentenliste; diff --git a/BeWoPlanerMobil/Models/ISessionModel.cs b/BeWoPlanerMobil/Models/ISessionModel.cs deleted file mode 100644 index ec84e0c65..000000000 --- a/BeWoPlanerMobil/Models/ISessionModel.cs +++ /dev/null @@ -1,9 +0,0 @@ -using BeWoPlanerMobil.Service; - -namespace BeWoPlanerMobil.Models -{ - public interface ISessionModel - { - void ResetValues(); - } -} \ No newline at end of file diff --git a/BeWoPlanerMobil/Models/MainModel.cs b/BeWoPlanerMobil/Models/MainModel.cs index fe073823c..543b80438 100644 --- a/BeWoPlanerMobil/Models/MainModel.cs +++ b/BeWoPlanerMobil/Models/MainModel.cs @@ -406,7 +406,11 @@ namespace BeWoPlanerMobil.Models } - public bool IsInEditingMode { get { return MainSessionModel.IsInEditingMode; } set { MainSessionModel.IsInEditingMode = value; } } + public bool IsInEditingMode + { + get => MainSessionModel.IsInEditingMode; + set => MainSessionModel.IsInEditingMode = value; + } public List GetServiceDesctiptions() { @@ -422,7 +426,11 @@ namespace BeWoPlanerMobil.Models public bool IsServiceRecordNoticeMandatory { get; set; } = true; - public long? PreviouslySelectedEmployeeOid { get { return MainSessionModel.PreviouslySelectedEmployeeOid; } set { MainSessionModel.PreviouslySelectedEmployeeOid = value; } } + public long? PreviouslySelectedEmployeeOid + { + get => MainSessionModel.PreviouslySelectedEmployeeOid; + set => MainSessionModel.PreviouslySelectedEmployeeOid = value; + } public CompactEmployeeDC PreviouslySelectedEmployee { get; set; } @@ -679,11 +687,11 @@ namespace BeWoPlanerMobil.Models { get { - if (SelectedServiceRecord != null && SelectedServiceRecord.DistanceInMeterDecimal.HasValue) + if(SelectedServiceRecord != null && SelectedServiceRecord.DistanceInMeterDecimal.HasValue) { var dist = SelectedServiceRecord.DistanceInMeterDecimal.Value; - return Math.Round(dist, 0, MidpointRounding.AwayFromZero).ToString(); + return Math.Round(dist, 2, MidpointRounding.AwayFromZero).ToString(); } return string.Empty; @@ -876,6 +884,28 @@ namespace BeWoPlanerMobil.Models return result; } } + + public string GroupMembers(long groupOid) + { + var group = GroupsOfPeople.FirstOrDefault(f => f.GroupOfPeopleOid.Equals(groupOid)); + + if(group is null) + { + return string.Empty; + } + + var result = string.Empty; + + foreach(var item in group.SupportConceptList) + { + foreach(var costBearerRelOid in item.CostBearerRelOids) + { + result += $"{costBearerRelOid},"; + } + } + + return result.Trim(','); + } } public class CustomSelectListItem diff --git a/BeWoPlanerMobil/Models/MainSessionModel.cs b/BeWoPlanerMobil/Models/MainSessionModel.cs index 717553c6c..ccecfbce7 100644 --- a/BeWoPlanerMobil/Models/MainSessionModel.cs +++ b/BeWoPlanerMobil/Models/MainSessionModel.cs @@ -6,7 +6,7 @@ using BeWoPlanerMobil.Util; namespace BeWoPlanerMobil.Models { [Serializable] - public class MainSessionModel : ISessionModel + public class MainSessionModel : BaseSessionModel { public bool SessionInitialized { get; internal set; } public long? SelectedSupportConceptOid { get; internal set; } @@ -38,9 +38,12 @@ namespace BeWoPlanerMobil.Models public bool IsInTransferMode { get; internal set; } public IList SelectedGoals { get; internal set; } public List SupportConceptOids { get; set; } + public MokServiceRecord SelectedServiceRecord { get; internal set; } - public void ResetValues() + public override void ResetValues() { + base.ResetValues(); + SessionInitialized = false; SelectedSupportConceptOid = null; SelectedCostBearerSupportConceptOid = null; @@ -84,6 +87,7 @@ namespace BeWoPlanerMobil.Models SelectedGoals = new List(); SupportConceptOids = new List(); + SelectedServiceRecord = null; } } } \ No newline at end of file diff --git a/BeWoPlanerMobil/Models/MokServiceRecord.cs b/BeWoPlanerMobil/Models/MokServiceRecord.cs index e4bf29445..2afeef0b6 100644 --- a/BeWoPlanerMobil/Models/MokServiceRecord.cs +++ b/BeWoPlanerMobil/Models/MokServiceRecord.cs @@ -1,3 +1,4 @@ +using BS.Shared; using BS.Shared.DataContracts.Compact; using BS.Shared.DataContracts.Invoicing; using System; @@ -10,7 +11,11 @@ namespace BeWoPlanerMobil.Models [Serializable] public class MokServiceRecord { - public long Oid { get; set; } + public long? Oid { get; set; } + + public ServiceRecordTypeId ServiceRecordType { get; set; } + + public int? DistanceInMeter { get; set; } public DateTime? Start { get; set; } diff --git a/BeWoPlanerMobil/Models/ReportSessionModel .cs b/BeWoPlanerMobil/Models/ReportSessionModel .cs index c41bb5f86..d19aed200 100644 --- a/BeWoPlanerMobil/Models/ReportSessionModel .cs +++ b/BeWoPlanerMobil/Models/ReportSessionModel .cs @@ -16,7 +16,7 @@ using DevExpress.XtraReports.UI; namespace BeWoPlanerMobil.Models { [Serializable] - public class ReportSessionModel : ISessionModel + public class ReportSessionModel : BaseSessionModel { public long? SelectedCustomerOid { get; set; } public long? SelectedEmployeeOid { get; set; } @@ -37,8 +37,10 @@ namespace BeWoPlanerMobil.Models public List SelectedConfirmationReceiptSignatures { get; internal set; } public QbSignatureIntervalSelection SelectedIntervalSelection { get; internal set; } - public void ResetValues() + public override void ResetValues() { + base.ResetValues(); + SelectedCustomerOid = null; SelectedEmployeeOid = null; SelectedTeamOid = null; diff --git a/BeWoPlanerMobil/Models/ReportViewerSessionModel.cs b/BeWoPlanerMobil/Models/ReportViewerSessionModel.cs index 2db225d3d..05f747be0 100644 --- a/BeWoPlanerMobil/Models/ReportViewerSessionModel.cs +++ b/BeWoPlanerMobil/Models/ReportViewerSessionModel.cs @@ -15,7 +15,7 @@ using DevExpress.XtraReports.UI; namespace BeWoPlanerMobil.Models { [Serializable] - public class ReportViewerSessionModel : ISessionModel + public class ReportViewerSessionModel : BaseSessionModel { public long? SelectedEmployeeOid { get; set; } public long? SelectedTeamOid { get; set; } @@ -24,8 +24,10 @@ namespace BeWoPlanerMobil.Models public ReportType SelectedReportType { get; internal set; } public long? SelectedQueryOid { get; internal set; } - public void ResetValues() + public override void ResetValues() { + base.ResetValues(); + SelectedEmployeeOid = null; SelectedTeamOid = null; SelectedMonth = null; diff --git a/BeWoPlanerMobil/Models/SchedulerSessionModel.cs b/BeWoPlanerMobil/Models/SchedulerSessionModel.cs index 8ccea54fa..c2661514d 100644 --- a/BeWoPlanerMobil/Models/SchedulerSessionModel.cs +++ b/BeWoPlanerMobil/Models/SchedulerSessionModel.cs @@ -15,7 +15,7 @@ using DevExpress.XtraReports.UI; namespace BeWoPlanerMobil.Models { [Serializable] - public class SchedulerSessionModel : ISessionModel + public class SchedulerSessionModel : BaseSessionModel { public DateTime SelectedDate { get; set; } public long? SelectedAppointmentOid { get; internal set; } @@ -36,8 +36,10 @@ namespace BeWoPlanerMobil.Models public DateTime? IntervalEndDate { get; internal set; } public int? IntervalDuration { get; internal set; } - public void ResetValues() + public override void ResetValues() { + base.ResetValues(); + SelectedDate = DateTime.Today; SelectedAppointmentOid = null; SelectedResourceOids = new List(); diff --git a/BeWoPlanerMobil/Scripts/bs-custom-file-input.min.js.map b/BeWoPlanerMobil/Scripts/bs-custom-file-input.min.js.map new file mode 100644 index 000000000..648a38ad8 --- /dev/null +++ b/BeWoPlanerMobil/Scripts/bs-custom-file-input.min.js.map @@ -0,0 +1 @@ +{"version":3,"file":"bs-custom-file-input.min.js","sources":["../src/selector.js","../src/util.js","../src/eventHandlers.js","../src/index.js"],"sourcesContent":["const Selector = {\n CUSTOMFILE: '.custom-file input[type=\"file\"]',\n CUSTOMFILELABEL: '.custom-file-label',\n FORM: 'form',\n INPUT: 'input',\n}\n\nexport default Selector\n","import Selector from './selector'\n\nconst textNodeType = 3\nconst getDefaultText = (input) => {\n let defaultText = ''\n\n const label = input.parentNode.querySelector(Selector.CUSTOMFILELABEL)\n\n if (label) {\n defaultText = label.textContent\n }\n\n return defaultText\n}\n\nconst findFirstChildNode = (element) => {\n if (element.childNodes.length > 0) {\n const childNodes = [].slice.call(element.childNodes)\n\n for (let i = 0; i < childNodes.length; i++) {\n const node = childNodes[i]\n if (node.nodeType !== textNodeType) {\n return node\n }\n }\n }\n\n return element\n}\n\nconst restoreDefaultText = (input) => {\n const defaultText = input.bsCustomFileInput.defaultText\n const label = input.parentNode.querySelector(Selector.CUSTOMFILELABEL)\n\n if (label) {\n const element = findFirstChildNode(label)\n\n element.textContent = defaultText\n }\n}\n\nexport {\n getDefaultText,\n findFirstChildNode,\n restoreDefaultText,\n}\n","import { findFirstChildNode, restoreDefaultText } from './util'\nimport Selector from './selector'\n\nconst fileApi = !!window.File\nconst FAKE_PATH = 'fakepath'\nconst FAKE_PATH_SEPARATOR = '\\\\'\n\nconst getSelectedFiles = (input) => {\n if (input.hasAttribute('multiple') && fileApi) {\n return [].slice.call(input.files)\n .map((file) => file.name)\n .join(', ')\n }\n\n if (input.value.indexOf(FAKE_PATH) !== -1) {\n const splittedValue = input.value.split(FAKE_PATH_SEPARATOR)\n\n return splittedValue[splittedValue.length - 1]\n }\n\n return input.value\n}\n\nfunction handleInputChange() {\n const label = this.parentNode.querySelector(Selector.CUSTOMFILELABEL)\n\n if (label) {\n const element = findFirstChildNode(label)\n const inputValue = getSelectedFiles(this)\n\n if (inputValue.length) {\n element.textContent = inputValue\n } else {\n restoreDefaultText(this)\n }\n }\n}\n\nfunction handleFormReset() {\n const customFileList = [].slice.call(this.querySelectorAll(Selector.INPUT))\n .filter((input) => !!input.bsCustomFileInput)\n\n for (let i = 0, len = customFileList.length; i < len; i++) {\n restoreDefaultText(customFileList[i])\n }\n}\n\nexport {\n handleInputChange,\n handleFormReset,\n}\n","import { getDefaultText, restoreDefaultText } from './util'\nimport { handleFormReset, handleInputChange } from './eventHandlers'\nimport Selector from './selector'\n\nconst customProperty = 'bsCustomFileInput'\nconst Event = {\n FORMRESET : 'reset',\n INPUTCHANGE : 'change',\n}\n\nconst bsCustomFileInput = {\n init(inputSelector = Selector.CUSTOMFILE, formSelector = Selector.FORM) {\n const customFileInputList = [].slice.call(document.querySelectorAll(inputSelector))\n const formList = [].slice.call(document.querySelectorAll(formSelector))\n\n for (let i = 0, len = customFileInputList.length; i < len; i++) {\n const input = customFileInputList[i]\n\n Object.defineProperty(input, customProperty, {\n value: {\n defaultText: getDefaultText(input),\n },\n writable: true,\n })\n\n handleInputChange.call(input)\n input.addEventListener(Event.INPUTCHANGE, handleInputChange)\n }\n\n for (let i = 0, len = formList.length; i < len; i++) {\n formList[i].addEventListener(Event.FORMRESET, handleFormReset)\n Object.defineProperty(formList[i], customProperty, {\n value: true,\n writable: true,\n })\n }\n },\n\n destroy() {\n const formList = [].slice.call(document.querySelectorAll(Selector.FORM))\n .filter((form) => !!form.bsCustomFileInput)\n const customFileInputList = [].slice.call(document.querySelectorAll(Selector.INPUT))\n .filter((input) => !!input.bsCustomFileInput)\n\n for (let i = 0, len = customFileInputList.length; i < len; i++) {\n const input = customFileInputList[i]\n\n restoreDefaultText(input)\n input[customProperty] = undefined\n\n input.removeEventListener(Event.INPUTCHANGE, handleInputChange)\n }\n\n for (let i = 0, len = formList.length; i < len; i++) {\n formList[i].removeEventListener(Event.FORMRESET, handleFormReset)\n formList[i][customProperty] = undefined\n }\n },\n}\n\nexport default bsCustomFileInput\n"],"names":["Selector","CUSTOMFILE","CUSTOMFILELABEL","FORM","INPUT","findFirstChildNode","element","childNodes","length","slice","call","i","node","nodeType","restoreDefaultText","input","defaultText","bsCustomFileInput","label","parentNode","querySelector","textContent","fileApi","window","File","getSelectedFiles","hasAttribute","files","map","file","name","join","value","indexOf","splittedValue","split","handleInputChange","this","inputValue","handleFormReset","customFileList","querySelectorAll","filter","len","customProperty","Event","init","inputSelector","formSelector","customFileInputList","document","formList","Object","defineProperty","writable","addEventListener","destroy","form","undefined","removeEventListener"],"mappings":";;;;;uMAAA,IAAMA,EAAW,CACfC,WAAY,kCACZC,gBAAiB,qBACjBC,KAAM,OACNC,MAAO,SCWHC,EAAqB,SAACC,MACM,EAA5BA,EAAQC,WAAWC,eACfD,EAAa,GAAGE,MAAMC,KAAKJ,EAAQC,YAEhCI,EAAI,EAAGA,EAAIJ,EAAWC,OAAQG,IAAK,KACpCC,EAAOL,EAAWI,MAlBT,IAmBXC,EAAKC,gBACAD,SAKNN,GAGHQ,EAAqB,SAACC,OACpBC,EAAcD,EAAME,kBAAkBD,YACtCE,EAAQH,EAAMI,WAAWC,cAAcpB,EAASE,iBAElDgB,IACcb,EAAmBa,GAE3BG,YAAcL,IClCpBM,IAAYC,OAAOC,KAInBC,EAAmB,SAACV,MACpBA,EAAMW,aAAa,aAAeJ,QAC7B,GAAGb,MAAMC,KAAKK,EAAMY,OACxBC,IAAI,SAACC,UAASA,EAAKC,OACnBC,KAAK,UAG8B,IAApChB,EAAMiB,MAAMC,QAVA,mBAgBTlB,EAAMiB,UALLE,EAAgBnB,EAAMiB,MAAMG,MAVV,aAYjBD,EAAcA,EAAc1B,OAAS,IAMhD,SAAS4B,QACDlB,EAAQmB,KAAKlB,WAAWC,cAAcpB,EAASE,oBAEjDgB,EAAO,KACHZ,EAAUD,EAAmBa,GAC7BoB,EAAab,EAAiBY,MAEhCC,EAAW9B,OACbF,EAAQe,YAAciB,EAEtBxB,EAAmBuB,OAKzB,SAASE,YACDC,EAAiB,GAAG/B,MAAMC,KAAK2B,KAAKI,iBAAiBzC,EAASI,QACjEsC,OAAO,SAAC3B,WAAYA,EAAME,oBAEpBN,EAAI,EAAGgC,EAAMH,EAAehC,OAAQG,EAAIgC,EAAKhC,IACpDG,EAAmB0B,EAAe7B,ICvCtC,IAAMiC,EAAiB,oBACjBC,EACU,QADVA,EAEU,eAGU,CACxBC,cAAKC,EAAqCC,YAArCD,IAAAA,EAAgB/C,EAASC,qBAAY+C,IAAAA,EAAehD,EAASG,cFP9Da,EAEEE,EEME+B,EAAsB,GAAGxC,MAAMC,KAAKwC,SAAST,iBAAiBM,IAC9DI,EAAW,GAAG1C,MAAMC,KAAKwC,SAAST,iBAAiBO,IAEhDrC,EAAI,EAAGgC,EAAMM,EAAoBzC,OAAQG,EAAIgC,EAAKhC,IAAK,KACxDI,EAAQkC,EAAoBtC,GAElCyC,OAAOC,eAAetC,EAAO6B,EAAgB,CAC3CZ,MAAO,CACLhB,aFhBJA,OAAAA,EAAAA,EAAc,IAEZE,EEc8BH,EFdhBI,WAAWC,cAAcpB,EAASE,oBAGpDc,EAAcE,EAAMG,aAGfL,IEUDsC,UAAU,IAGZlB,EAAkB1B,KAAKK,GACvBA,EAAMwC,iBAAiBV,EAAmBT,OAGvC,IAAIzB,EAAI,EAAGgC,EAAMQ,EAAS3C,OAAQG,EAAIgC,EAAKhC,IAC9CwC,EAASxC,GAAG4C,iBAAiBV,EAAiBN,GAC9Ca,OAAOC,eAAeF,EAASxC,GAAIiC,EAAgB,CACjDZ,OAAO,EACPsB,UAAU,KAKhBE,2BACQL,EAAW,GAAG1C,MAAMC,KAAKwC,SAAST,iBAAiBzC,EAASG,OAC/DuC,OAAO,SAACe,WAAWA,EAAKxC,oBACrBgC,EAAsB,GAAGxC,MAAMC,KAAKwC,SAAST,iBAAiBzC,EAASI,QAC1EsC,OAAO,SAAC3B,WAAYA,EAAME,oBAEpBN,EAAI,EAAGgC,EAAMM,EAAoBzC,OAAQG,EAAIgC,EAAKhC,IAAK,KACxDI,EAAQkC,EAAoBtC,GAElCG,EAAmBC,GACnBA,EAAM6B,QAAkBc,EAExB3C,EAAM4C,oBAAoBd,EAAmBT,OAG1C,IAAIzB,EAAI,EAAGgC,EAAMQ,EAAS3C,OAAQG,EAAIgC,EAAKhC,IAC9CwC,EAASxC,GAAGgD,oBAAoBd,EAAiBN,GACjDY,EAASxC,GAAGiC,QAAkBc"} \ No newline at end of file diff --git a/BeWoPlanerMobil/Scripts/ownSoft-Scripts/mobileUtils.js b/BeWoPlanerMobil/Scripts/ownSoft-Scripts/mobileUtils.js index 84490d05f..f531f97b7 100644 --- a/BeWoPlanerMobil/Scripts/ownSoft-Scripts/mobileUtils.js +++ b/BeWoPlanerMobil/Scripts/ownSoft-Scripts/mobileUtils.js @@ -467,4 +467,12 @@ function firstCharToUpperCase(str) { } return str.charAt(0).toUpperCase() + str.slice(1); +} + +function commaSeparatedOid2Array(csv) { + if(csv === undefined || csv === null) { + return []; + } + + return csv.split(",").map(num => parseInt(num, 10)); } \ No newline at end of file diff --git a/BeWoPlanerMobil/Scripts/ownSoft-Scripts/signature.js b/BeWoPlanerMobil/Scripts/ownSoft-Scripts/signature.js index d43611854..fb42574b5 100644 --- a/BeWoPlanerMobil/Scripts/ownSoft-Scripts/signature.js +++ b/BeWoPlanerMobil/Scripts/ownSoft-Scripts/signature.js @@ -108,7 +108,7 @@ function resizeCanvas(sketchPadId, canvasRoId) { // Das Initialisieren der Einzelunterschrift function initializeSignature(selectedServiceRecordOid) { - $("#main-container, #checkbox-container").hide(); + $("#form-container, #checkbox-container").hide(); $("#signature-container").addClass("d-block"); $.get(window.getSelectedRecordInformationUrlWithOid(), { oid: selectedServiceRecordOid }).done(function(jsonServiceRecord2Monatsunterschrift) { @@ -118,7 +118,7 @@ function initializeSignature(selectedServiceRecordOid) { } if(isEmptyOrSpaces(jsonServiceRecord2Monatsunterschrift)) { - $("#main-container, #checkbox-container").show(); + $("#form-container, #checkbox-container").show(); $("#signature-container").removeClass("d-block"); showMessagePopupWithHtmlAndCallback("Fehler", "Der zu unterschreibende Zeiterfassungseintrag konnte nicht geladen werden. Bitte wenden Sie sich an den Support.

support@bewoplaner.de", false, @@ -248,7 +248,7 @@ function cancelButtonClick(signaturePad) { function () { $("#signature-container, #checkbox-container").removeClass("d-block"); $("#signature-alert").addClass("d-none"); - $("#main-container").show(); + $("#form-container").show(); signaturePad.clear(); }, false); diff --git a/BeWoPlanerMobil/Scripts/ownSoft-Scripts/utils/countdown.js b/BeWoPlanerMobil/Scripts/ownSoft-Scripts/utils/countdown.js new file mode 100644 index 000000000..b9de5132a --- /dev/null +++ b/BeWoPlanerMobil/Scripts/ownSoft-Scripts/utils/countdown.js @@ -0,0 +1,38 @@ +class Countdown { + constructor(duration, onTick, onFinish) { + this.duration = duration; + this.timeLeft = duration; + this.onTick = onTick; + this.onFinish = onFinish; + this.timer = null; + } + + start() { + this.stop(); + + this.timeLeft = this.duration; + this.onTick?.(this.timeLeft); + + this.timer = setInterval(() => { + this.timeLeft--; + this.onTick?.(this.timeLeft); + + if(this.timeLeft <= 0) { + this.stop(); + this.onFinish(); + } + }, 1000); + } + + stop() { + if(this.timer) { + clearInterval(this.timer); + } + + this.timer = null; + } + + reset() { + this.start(); + } +} \ 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 330590a8c..bc91b72fd 100644 --- a/BeWoPlanerMobil/Scripts/ownSoft-Scripts/utils/service-record-time-calc.js +++ b/BeWoPlanerMobil/Scripts/ownSoft-Scripts/utils/service-record-time-calc.js @@ -137,6 +137,7 @@ function calcTimeWithDuration(timeAsString, timeElement, start, duration, isForm } function beiDaueraenderung(idPrefix) { + logInfo2(`${idPrefix}-Dauer geändert`); const hoursMinutesDropdown = $(`#${idPrefix}-hours-minutes-dropdown-btn`); const startTimeInput = $(`#${idPrefix}-start-time-input`); @@ -215,6 +216,10 @@ function combineDateAndTime(date, time) { } function getTimeAsString(date) { + if(date === null || date === undefined) { + return null; + } + const hours = date.getHours().toString().padStart(2, "0"); const minutes = date.getMinutes().toString().padStart(2, "0"); @@ -222,9 +227,30 @@ function getTimeAsString(date) { } function getDateAsString(dateObject) { + if(dateObject === null || dateObject === undefined) { + return null; + } + const year = dateObject.getFullYear(); const date = dateObject.getDate().toString().padStart(2, "0"); const month = (dateObject.getMonth() + 1).toString().padStart(2, "0"); return `${year}-${month}-${date}`; +} + +function getDateAndTimeAsString(dateObject) { + if(dateObject === null || dateObject === undefined) { + return null; + } + + const hours = dateObject.getHours().toString().padStart(2, "0"); + const minutes = dateObject.getMinutes().toString().padStart(2, "0"); + const seconds = dateObject.getSeconds().toString().padStart(2, "0"); + const milliseconds = dateObject.getMilliseconds().toString().padStart(3, "0"); + + const year = dateObject.getFullYear(); + const date = dateObject.getDate().toString().padStart(2, "0"); + const month = (dateObject.getMonth() + 1).toString().padStart(2, "0"); + + return `${year}-${month}-${date} ${hours}:${minutes}:${seconds}.${milliseconds}`; } \ No newline at end of file diff --git a/BeWoPlanerMobil/Util/DcToMokMapper.cs b/BeWoPlanerMobil/Util/DcToMokMapper.cs index cf92be3d9..6e3462b26 100644 --- a/BeWoPlanerMobil/Util/DcToMokMapper.cs +++ b/BeWoPlanerMobil/Util/DcToMokMapper.cs @@ -46,6 +46,8 @@ namespace BeWoPlanerMobil.Util var s = new MokServiceRecord { Oid = dc.ServiceRecordOid.Value, + ServiceRecordType = dc.ServiceRecordType, + DistanceInMeter = dc.DistanceInMeter, Start = dc.Start, End = dc.End, EmployeeName = dc.Employee.FirstNameLastName, @@ -106,7 +108,7 @@ namespace BeWoPlanerMobil.Util } #if DEBUG - if (goal.RatingTypeOid.HasValue) + if (model != null && goal.RatingTypeOid.HasValue) { var goalRating = model.GoalRatingTypes.FirstOrDefault(g => g.RatingTypeOid.HasValue && g.RatingTypeOid.Equals(goal.RatingTypeOid.Value)); @@ -123,7 +125,7 @@ namespace BeWoPlanerMobil.Util } } - if (model.ServiceRecordOids2GoalHeader.ContainsKey(s.Oid)) + if (model != null && model.ServiceRecordOids2GoalHeader.ContainsKey(s.Oid.Value)) { var ziele = dc.Goals.Where(g => g.Type == ValueListEntryType.SupportConceptIndividualGoalCategoryType || g.Type == ValueListEntryType.SupportConceptGoalCategoryType).ToList(); diff --git a/BeWoPlanerMobil/Util/FormCollectionConstants.cs b/BeWoPlanerMobil/Util/FormCollectionConstants.cs index 674d72321..4a6bef662 100644 --- a/BeWoPlanerMobil/Util/FormCollectionConstants.cs +++ b/BeWoPlanerMobil/Util/FormCollectionConstants.cs @@ -39,7 +39,9 @@ public static string SingleBookingEmployeeOidKey => "service-record-single-booking-employee-oid"; public static string SelectedGoalOids => "service-record-selected-goal-oids"; public static string BookingModeKey => "BookingMode"; - + public static string DurationUnitKey => "DurationUnit"; + public static string CurrentPageKey => "CurrentPage"; + // Kalender public static string AppointmentStartDateKey => "StartDate"; @@ -96,5 +98,6 @@ public static string SaveSupportConceptDependenciesKey => "SaveSupportConceptDependencies"; public static string DeleteLocalInputsKey => "DeleteLocalInputsKey"; public static string SupportConceptRelSelectedKey => "SupportConceptRelSelected"; + public static string IsGroupTabActiveKey => "IsGroupTabActive"; } } \ No newline at end of file diff --git a/BeWoPlanerMobil/Views/Customer/CustomerBargeldtransaktionshistorienPartial.cshtml b/BeWoPlanerMobil/Views/Customer/CustomerBargeldtransaktionshistorienPartial.cshtml index 7742ed220..dab739866 100644 --- a/BeWoPlanerMobil/Views/Customer/CustomerBargeldtransaktionshistorienPartial.cshtml +++ b/BeWoPlanerMobil/Views/Customer/CustomerBargeldtransaktionshistorienPartial.cshtml @@ -25,7 +25,7 @@ Geändert von - @historyEntry.BargeldtransaktionUdpUser + @historyEntry.InsUser diff --git a/BeWoPlanerMobil/Views/Main/GoalTreePartial.cshtml b/BeWoPlanerMobil/Views/Main/GoalTreePartial.cshtml index 075ade629..7bc53e3c7 100644 --- a/BeWoPlanerMobil/Views/Main/GoalTreePartial.cshtml +++ b/BeWoPlanerMobil/Views/Main/GoalTreePartial.cshtml @@ -87,12 +87,15 @@ return selectedGoals.substr(0, selectedGoals.length - 1); } catch(error) { showErrorPopup(error); + return null; } } function updateSelectedGoals() { try { const selectedGoals = getCheckedGoals(); + console.log(selectedGoals); + window.updateGoals2Ratings("@Model.BookingModePrefix", new Map(selectedGoals.split(";").map(item => [item, ""]))); $.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 9bbae7ee0..54aa33db3 100644 --- a/BeWoPlanerMobil/Views/Main/GroupBookingFormPartial.cshtml +++ b/BeWoPlanerMobil/Views/Main/GroupBookingFormPartial.cshtml @@ -1,69 +1,53 @@ -@using BeWoPlanerMobil.Util +@using BeWoPlanerMobil.Service +@using BeWoPlanerMobil.Util @using BS.Shared @model BeWoPlanerMobil.Models.MainModel @{ - if(TempData[TempDataConstants.DoLogoutKey] is true) - { - - - - } + if(TempData[TempDataConstants.DoLogoutKey] is true) + { + + + + } } @if(Model != null) @@ -75,7 +59,7 @@ var startDate = Model.SelectedServiceRecord?.Start?.ToString("yyyy-MM-dd") ?? DateTime.Today.ToString("yyyy-MM-dd"); var endDate = Model.SelectedServiceRecord?.End?.ToString("yyyy-MM-dd") ?? DateTime.Today.ToString("yyyy-MM-dd"); - var distance = Model.SelectedServiceRecord?.DistanceInMeter?.ToString() ?? string.Empty; + var distance = Model.DistanceToEdit; var notice0 = Model.SelectedServiceRecord?.Notice ?? string.Empty; var noticeList = new[] { string.Empty, string.Empty, string.Empty, string.Empty, string.Empty }; @@ -179,7 +163,7 @@ } - @* Von und Bis *@ + @* Von und Bis *@
@{ var startTimeValue = Model.StartTimeToEdit; @@ -281,7 +265,7 @@ {
- +
} else diff --git a/BeWoPlanerMobil/Views/Main/GroupBookingPartial.cshtml b/BeWoPlanerMobil/Views/Main/GroupBookingPartial.cshtml index 1c4fc1124..1df975c38 100644 --- a/BeWoPlanerMobil/Views/Main/GroupBookingPartial.cshtml +++ b/BeWoPlanerMobil/Views/Main/GroupBookingPartial.cshtml @@ -13,21 +13,6 @@ } } + + var isGroupTabPaneActive = TempData[TempDataConstants.IsGroupTabActiveKey] is true ? "active" : string.Empty; + var isSingleTabPaneActive = TempData[TempDataConstants.IsGroupTabActiveKey] is true ? string.Empty : "active"; } -
-
    +
    +
      @foreach(var cb2Sc in Model.SupportConceptListObjectsForGroupBooking) {
    • @@ -26,7 +29,7 @@
      + class="custom-control-input cb2sc-input" id="gb-cb2sc-checkbox-@cb2Sc.CostBearer2SupportConceptOid" onchange="window.updateScCbRelOids('gb', false)" name="cb2sc-checkbox-@cb2Sc.CostBearer2SupportConceptOid" value="@cb2Sc.CostBearer2SupportConceptOid">
    -
    -
      +
      +
        @foreach(var group in Model.GroupOfPeopleListItems) {
      • @@ -54,10 +57,11 @@ var attribute = shouldBeChecked ? "checked=\"checked\"" : string.Empty; }
        - - + + +
      • } diff --git a/BeWoPlanerMobil/Views/Main/GroupBookingSelectionPartial.cshtml b/BeWoPlanerMobil/Views/Main/GroupBookingSelectionPartial.cshtml index 46866dbb3..7103b10d9 100644 --- a/BeWoPlanerMobil/Views/Main/GroupBookingSelectionPartial.cshtml +++ b/BeWoPlanerMobil/Views/Main/GroupBookingSelectionPartial.cshtml @@ -2,7 +2,7 @@ @model BeWoPlanerMobil.Models.MainModel @{ - if(TempData[TempDataConstants.DoLogoutKey] is bool doLogout && doLogout) + if(TempData[TempDataConstants.DoLogoutKey] is true) {
        @@ -378,30 +478,9 @@
      -@* ----- Einzelbuchung ----- *@ -
      - @if(!Model.IsInGroupBookingMode && !Model.IsInMultiBookingMode) - { - @Html.Partial("SingleBookingPartial", Model) - } -
      - -@* ----- Gruppenbuchung ----- *@ -
      - @if(Model.IsInGroupBookingMode && !Model.IsInMultiBookingMode) - { -
      - @Html.Partial("GroupBookingPartial", Model) -
      - } -
      - -@* ----- Mehrfachbuchung ----- *@ -
      - @if(Model.IsInMultiBookingMode && !Model.IsInGroupBookingMode) - { - @Html.Partial("MultiBookingPartial", Model); - } +@* ----- Formularcontainer für Einzel-, Gruppen-, und Mehrfachbuchungen ----- *@ +
      + @Html.Partial("Zeiterfassungspartial", Model)
      @* ----- Textbausteine-Popup ----- *@ diff --git a/BeWoPlanerMobil/Views/Main/MultiBookingFormPartial.cshtml b/BeWoPlanerMobil/Views/Main/MultiBookingFormPartial.cshtml index 4690934b1..1f6d6c145 100644 --- a/BeWoPlanerMobil/Views/Main/MultiBookingFormPartial.cshtml +++ b/BeWoPlanerMobil/Views/Main/MultiBookingFormPartial.cshtml @@ -1,4 +1,6 @@ -@using BeWoPlanerMobil.Util +@using BeWoPlanerMobil.Service +@using BeWoPlanerMobil.Util +@using BS.Shared @model BeWoPlanerMobil.Models.MainModel @{ @@ -6,82 +8,64 @@ { } } + + + + + + + + @if(Model != null) { using(Html.BeginForm("CreateMultiBooking", "Main", FormMethod.Post, new { id = "multiBookingForm" })) { - var startDate = Model.SelectedServiceRecord?.Start?.ToShortDateString() ?? DateTime.Today.ToString("yyyy-MM-dd"); - var endDate = Model.SelectedServiceRecord?.End?.ToShortDateString() ?? DateTime.Today.ToString("yyyy-MM-dd"); + var startDate = Model.SelectedServiceRecord?.Start?.ToString("yyyy-MM-dd") ?? DateTime.Today.ToString("yyyy-MM-dd"); + var endDate = Model.SelectedServiceRecord?.End?.ToString("yyyy-MM-dd") ?? DateTime.Today.ToString("yyyy-MM-dd"); - var distance = Model.SelectedServiceRecord?.DistanceInMeter?.ToString() ?? string.Empty; + var distance = Model.DistanceToEdit; var notice0 = Model.SelectedServiceRecord?.Notice ?? string.Empty; var noticeList = new[] { string.Empty, string.Empty, string.Empty, string.Empty, string.Empty }; @@ -94,226 +78,228 @@ noticeList[i] = selectedNoticeList[i] ?? string.Empty; } } -
      -
      - @Html.Partial("MultiBookingSelectionPartial", Model) -
      - - @* Marker *@ - @if(Model.ShowMarker) - { -
      -
      -
      - - -
      +
      +
      + @Html.Partial("MultiBookingSelectionPartial", Model)
      -
      - } - - @* ----- Betrag ----- *@ - @if(Model.ShowBetrag) - { -
      -
      -
      + + @* Marker *@ + @if(Model.ShowMarker) + { + var markerCheckedValue = Model.SelectedServiceRecord?.ServiceRecordType == ServiceRecordTypeId.Content ? "checked" : string.Empty; + +
      +
      +
      + + +
      +
      +
      + } + + @* ----- Betrag ----- *@ + @if(Model.ShowBetrag) + { +
      +
      +
      +
      +
      +
      + Betrag +
      +
      + +
      +
      €
      +
      +
      +
      +
      +
      + } + + @* Trennstrich *@ +
      + + @* Start- und Enddatum *@ + @{ + var columnWidth = Model.IsEndDateVisible ? "col-md-6" : "col"; + } + +
      +
      -
      - Betrag -
      -
      - -
      -
      €
      + + Startdatum +
      +
      -
      -
      - } - - @* Trennstrich *@ -
      - - @* Start- und Enddatum *@ - @{ - var columnWidth = Model.IsEndDateVisible ? "col-md-6" : "col"; - } - -
      -
      -
      -
      - - Startdatum - -
      - -
      -
      - @if(Model.IsEndDateVisible) - { -
      -
      -
      - - Enddatum - -
      - -
      -
      - } -
      - - @* Start- und Endzeit *@ -
      - @{ - var startTimeValue = Model.StartTimeToEdit; - var endTimeValue = Model.EndTimeToEdit; - - var divisor = Model.SelectedDurationUnit == "Stunden" ? 60 : 1; - - var durationValue = Model.DurationToEdit; - - var afterValidationState = TempData[TempDataConstants.AfterValidationStateKey]; - - if(Model.SetStartTimeToEndTimeAfterSave && !Model.IsInEditingMode && afterValidationState is bool isAfterValidation && isAfterValidation == false) - { - startTimeValue = Model.NewStartTime; - endTimeValue = Model.NewEndTime; - if(Model.NewDuration.HasValue) + @if(Model.IsEndDateVisible) { - durationValue = (Model.NewDuration / divisor).ToString(); +
      +
      +
      + + Enddatum + +
      + +
      +
      } - } - } -
      -
      -
      - - Von - -
      - - - Bis - - -
      -
      -
      +
      - @* Dauer und Stunden/Minuten-Auswahl *@ -
      -
      -
      -
      -
      - @{ - var labelText = Model.EinheitZeiterfassung == 1 ? "Dauer (h)" : "Dauer"; + @* Start- und Endzeit *@ +
      + @{ + var startTimeValue = Model.StartTimeToEdit; + var endTimeValue = Model.EndTimeToEdit; + + var divisor = Model.SelectedDurationUnit == "Stunden" ? 60 : 1; + + var durationValue = Model.DurationToEdit; + + var afterValidationState = TempData[TempDataConstants.AfterValidationStateKey]; + + if(Model.SetStartTimeToEndTimeAfterSave && !Model.IsInEditingMode && afterValidationState is bool isAfterValidation && isAfterValidation == false) + { + startTimeValue = Model.NewStartTime; + endTimeValue = Model.NewEndTime; + if(Model.NewDuration.HasValue) + { + durationValue = (Model.NewDuration / divisor).ToString(); } -
      - @labelText -
      -
      - - @if(Model.IsZeiterfassungInStdMin) - { -
      - - -
      } -
      -
      -
      -
      - - @* Gefahrene Kilometer *@ - @if(Model.ShowDistanceField) - { -
      -
      -
      -
      + } +
      +
      -
      - Gefahrene Kilometer -
      + + Von +
      - + + + Bis + +
      -
      - } - @* Textbausteinebutton *@ - @if(Model.HasRightToSeeTextModules) - { -
      -
      - + @* Dauer und Stunden/Minuten-Auswahl *@ +
      +
      +
      +
      +
      + @{ + var labelText = Model.EinheitZeiterfassung == 1 ? "Dauer (h)" : "Dauer"; + } +
      + @labelText +
      +
      + + @if(Model.IsZeiterfassungInStdMin) + { +
      + + +
      + } +
      +
      +
      +
      + + @* Gefahrene Kilometer *@ + @if(Model.ShowDistanceField) + { +
      +
      +
      +
      +
      +
      + Gefahrene Kilometer +
      +
      + +
      +
      +
      +
      + } + + @* Textbausteinebutton *@ + @if(Model.HasRightToSeeTextModules) + { +
      +
      + +
      +
      + } + + @* Dokumentationsfelder *@ +
      +
      + @if(Model.NumberOfDokuTypes == 0) + { +
      + + +
      + } + else + { + +
      + @for(var i = 0; i < Model.Dokutypes.Length; i++) + { + var textareaName = i + 1 < 1 ? "Dokumentation" : "Dokumentation" + (i + 1); + +
      + +
      + } +
      + } +
      } - @* Dokumentationsfelder *@ -
      -
      - @if(Model.NumberOfDokuTypes == 0) - { -
      - - -
      - } - else - { - -
      - @for(var i = 0; i < Model.Dokutypes.Length; i++) - { - var textareaName = i + 1 < 1 ? "Dokumentation" : "Dokumentation" + (i + 1); + @using(Html.BeginForm("ResetMultiBookingForm", "Main", FormMethod.Post)) + { + + } -
      - -
      - } -
      - } -
      + @Html.Partial("RestoreServiceRecordInputsPartial", Model)
      -
      - } - -
      - - - @using(Html.BeginForm("ResetMultiBookingForm", "Main", FormMethod.Post)) - { - - } - - @Html.Partial("RestoreServiceRecordInputsPartial", Model) -
      } \ No newline at end of file diff --git a/BeWoPlanerMobil/Views/Main/MultiBookingPartial.cshtml b/BeWoPlanerMobil/Views/Main/MultiBookingPartial.cshtml index 15a34bd26..d8e3b56e3 100644 --- a/BeWoPlanerMobil/Views/Main/MultiBookingPartial.cshtml +++ b/BeWoPlanerMobil/Views/Main/MultiBookingPartial.cshtml @@ -13,22 +13,9 @@ } } + + var isGroupTabPaneActive = TempData[TempDataConstants.IsGroupTabActiveKey] is true ? "active" : string.Empty; + var isSingleTabPaneActive = TempData[TempDataConstants.IsGroupTabActiveKey] is true ? string.Empty : "active"; } -
      -
        +
        +
          @foreach(var cb2Sc in Model.SupportConceptListObjectsForGroupBooking) {
        • @@ -25,8 +28,8 @@
          + @{ if(checkedValue) { @Html.Raw("checked=\"checked\"") } } + class="custom-control-input mb-cb2sc-input" id="mb-cb2sc-checkbox-@cb2Sc.CostBearer2SupportConceptOid" onchange="updateScCbRelOids('mb', false)" name="mb-cb2sc-checkbox-@cb2Sc.CostBearer2SupportConceptOid" value="@cb2Sc.CostBearer2SupportConceptOid">
        -
        -
          +
          +
            @foreach(var group in Model.GroupOfPeopleListItems) {
          • @@ -54,7 +57,8 @@ var attribute = shouldBeChecked ? "checked=\"checked\"" : string.Empty; }
            - + + diff --git a/BeWoPlanerMobil/Views/Main/MultiBookingSelectionPartial.cshtml b/BeWoPlanerMobil/Views/Main/MultiBookingSelectionPartial.cshtml index ee45788c7..8d4ec12da 100644 --- a/BeWoPlanerMobil/Views/Main/MultiBookingSelectionPartial.cshtml +++ b/BeWoPlanerMobil/Views/Main/MultiBookingSelectionPartial.cshtml @@ -6,12 +6,14 @@ { } } + + @* (Mehrfachbuchung) Hilfeplanauswahl-Button *@
            @@ -25,7 +27,7 @@
            @if(Model.GroupBookingSelectionObject.SelectedRelations.Any()) { -
            +
            @foreach(var selectedCb2ScRelation in Model.GroupBookingSelectionObject.SelectedRelations) {
            diff --git a/BeWoPlanerMobil/Views/Main/RestoreServiceRecordInputsPartial.cshtml b/BeWoPlanerMobil/Views/Main/RestoreServiceRecordInputsPartial.cshtml index fd20aaa26..11573b25c 100644 --- a/BeWoPlanerMobil/Views/Main/RestoreServiceRecordInputsPartial.cshtml +++ b/BeWoPlanerMobil/Views/Main/RestoreServiceRecordInputsPartial.cshtml @@ -17,81 +17,189 @@ } + var keyMap = new Map( + [ + [`${getLocalStorageKey()}-SbCb2ScRelOid`, "Hilfeplan"], + [`${getLocalStorageKey()}-SbEmployeeOids`, "Mitarbeiter"], + [`${getLocalStorageKey()}-SbCategory`, "Kategorie"], + [`${getLocalStorageKey()}-SbServiceDescription`, "Leistung"], + [`${getLocalStorageKey()}-SbStartDate`, "Start"], + [`${getLocalStorageKey()}-SbEndDate`, "Enddatum"], + [`${getLocalStorageKey()}-SbStartTime`, "Von"], + [`${getLocalStorageKey()}-SbEndTime`, "Bis"], + [`${getLocalStorageKey()}-SbDuration`, "Dauer"], + [`${getLocalStorageKey()}-SbDurationUnit`, "Einheit der Dauer"], + [`${getLocalStorageKey()}-SbDistance`, "Gefahrene Kilometer"], + [`${getLocalStorageKey()}-SbMarker`, "Marker"], + [`${getLocalStorageKey()}-SbBetrag`, "Betrag"], + [`${getLocalStorageKey()}-SbDoku1`, "Doku 1"], + [`${getLocalStorageKey()}-SbDoku2`, "Doku 2"], + [`${getLocalStorageKey()}-SbDoku3`, "Doku 3"], + [`${getLocalStorageKey()}-SbDoku4`, "Doku 4"], + [`${getLocalStorageKey()}-SbDoku5`, "Doku 5"], + [`${getLocalStorageKey()}-SbDoku6`, "Doku 6"], + [`${getLocalStorageKey()}-SbGoals2Ratings`, "Ziele & Maßnahmen"], + [`${getLocalStorageKey()}-SbCurrentPage`, "Ausgewählte Seite"], + + [`${getLocalStorageKey()}-GbCb2ScRelOids`, "Hilfepläne"], + [`${getLocalStorageKey()}-GbEmployeeOids`, "Mitarbeiter"], + [`${getLocalStorageKey()}-GbCategory`, "Kategorie"], + [`${getLocalStorageKey()}-GbServiceDescription`, "Leistung"], + [`${getLocalStorageKey()}-GbStartDate`, "Start"], + [`${getLocalStorageKey()}-GbEndDate`, "Enddatum"], + [`${getLocalStorageKey()}-GbStartTime`, "Von"], + [`${getLocalStorageKey()}-GbEndTime`, "Bis"], + [`${getLocalStorageKey()}-GbDuration`, "Dauer"], + [`${getLocalStorageKey()}-GbDurationUnit`, "Einheit der Dauer"], + [`${getLocalStorageKey()}-GbDistance`, "Gefahrene Kilometer"], + [`${getLocalStorageKey()}-GbMarker`, "Marker"], + [`${getLocalStorageKey()}-GbBetrag`, "Betrag"], + [`${getLocalStorageKey()}-GbDoku1`, "Doku 1"], + [`${getLocalStorageKey()}-GbDoku2`, "Doku 2"], + [`${getLocalStorageKey()}-GbDoku3`, "Doku 3"], + [`${getLocalStorageKey()}-GbDoku4`, "Doku 4"], + [`${getLocalStorageKey()}-GbDoku5`, "Doku 5"], + [`${getLocalStorageKey()}-GbDoku6`, "Doku 6"], + [`${getLocalStorageKey()}-GbGoals2Ratings`, "Ziele & Maßnahmen"], + + [`${getLocalStorageKey()}-MbCb2ScRelOids`, "Hilfepläne"], + [`${getLocalStorageKey()}-MbEmployeeOids`, "Mitarbeiter"], + [`${getLocalStorageKey()}-MbCategory`, "Kategorie"], + [`${getLocalStorageKey()}-MbServiceDescription`, "Leistung"], + [`${getLocalStorageKey()}-MbStartDate`, "Start"], + [`${getLocalStorageKey()}-MbEndDate`, "Enddatum"], + [`${getLocalStorageKey()}-MbStartTime`, "Von"], + [`${getLocalStorageKey()}-MbEndTime`, "Bis"], + [`${getLocalStorageKey()}-MbDuration`, "Dauer"], + [`${getLocalStorageKey()}-MbDurationUnit`, "Einheit der Dauer"], + [`${getLocalStorageKey()}-MbDistance`, "Gefahrene Kilometer"], + [`${getLocalStorageKey()}-MbMarker`, "Marker"], + [`${getLocalStorageKey()}-MbBetrag`, "Betrag"], + [`${getLocalStorageKey()}-MbDoku1`, "Doku 1"], + [`${getLocalStorageKey()}-MbDoku2`, "Doku 2"], + [`${getLocalStorageKey()}-MbDoku3`, "Doku 3"], + [`${getLocalStorageKey()}-MbDoku4`, "Doku 4"], + [`${getLocalStorageKey()}-MbDoku5`, "Doku 5"], + [`${getLocalStorageKey()}-MbDoku6`, "Doku 6"], + [`${getLocalStorageKey()}-MbGoals2Ratings`, "Ziele & Maßnahmen"] + ] + ); + + var timeRegex = /^(?:[01]\d|2[0-3]):[0-5]\d$/; + + function saveLocally(key, value) { + if(value === undefined || value === null || value.length === 0) { + logWarning(`Der Wert "${value}" bei Schlüssel "${key}" ist ungültig!`); + return; + } + + localStorage.setItem(key, value); + } + function getLocalStorageKey() { return "@MobileSessionFacade.LocalStorageKey"; } function updateGoals2Ratings(prefix, map) { - localStorage.setItem(`@MobileSessionFacade.LocalStorageKey-${firstCharToUpperCase(prefix)}`, [...map]); + if(map === null || map === undefined || map.length === 0) { + localStorage.removeItem(`@MobileSessionFacade.LocalStorageKey-${firstCharToUpperCase(prefix)}Goals2Ratings`); + } + + saveLocally(`@MobileSessionFacade.LocalStorageKey-${firstCharToUpperCase(prefix)}Goals2Ratings`, [...map]); } function updateCbScRelOids(prefix, csv) { - localStorage.setItem(`@MobileSessionFacade.LocalStorageKey-${firstCharToUpperCase(prefix)}Cb2ScRelOid${(prefix === "sb" ? "" : "s")}`, csv); + if(csv === null || csv === undefined || csv.toString().length === 0) { + localStorage.removeItem(`@MobileSessionFacade.LocalStorageKey-${firstCharToUpperCase(prefix)}Cb2ScRelOid${(prefix === "sb" ? "" : "s")}`); + return; + } + + saveLocally(`@MobileSessionFacade.LocalStorageKey-${firstCharToUpperCase(prefix)}Cb2ScRelOid${(prefix === "sb" ? "" : "s")}`, csv); } function updateEmployeeOids(prefix, csv) { - logInfo3(`Speichere die MitarbeiterOids: "${csv}"`); + if(csv === null || csv === undefined || csv.toString().length === 0) { + localStorage.removeItem(`@MobileSessionFacade.LocalStorageKey-${firstCharToUpperCase(prefix)}EmployeeOids`); + return; + } - localStorage.setItem(`@MobileSessionFacade.LocalStorageKey-${firstCharToUpperCase(prefix)}EmployeeOids`, csv); + saveLocally(`@MobileSessionFacade.LocalStorageKey-${firstCharToUpperCase(prefix)}EmployeeOids`, csv); } function updateCategory(prefix, categoryOid) { - localStorage.setItem(`@MobileSessionFacade.LocalStorageKey-${firstCharToUpperCase(prefix)}Category`, categoryOid); + saveLocally(`@MobileSessionFacade.LocalStorageKey-${firstCharToUpperCase(prefix)}Category`, categoryOid); } function updateServiceDescription(prefix, serviceDescriptionOid) { - localStorage.setItem(`@MobileSessionFacade.LocalStorageKey-${firstCharToUpperCase(prefix)}ServiceDescription`, serviceDescriptionOid); + saveLocally(`@MobileSessionFacade.LocalStorageKey-${firstCharToUpperCase(prefix)}ServiceDescription`, serviceDescriptionOid); } function updateStartDate(prefix, startDate) { - localStorage.setItem(`@MobileSessionFacade.LocalStorageKey-${firstCharToUpperCase(prefix)}StartDate`, startDate); + saveLocally(`@MobileSessionFacade.LocalStorageKey-${firstCharToUpperCase(prefix)}StartDate`, startDate); } function updateStartTime(prefix, startTime) { - localStorage.setItem(`@MobileSessionFacade.LocalStorageKey-${firstCharToUpperCase(prefix)}StartTime`, startTime); + if(false === timeRegex.test(startTime)) { + return; + } + + saveLocally(`@MobileSessionFacade.LocalStorageKey-${firstCharToUpperCase(prefix)}StartTime`, startTime); } function updateEndDate(prefix, endDate) { - localStorage.setItem(`@MobileSessionFacade.LocalStorageKey-${firstCharToUpperCase(prefix)}EndDate`, endDate); + saveLocally(`@MobileSessionFacade.LocalStorageKey-${firstCharToUpperCase(prefix)}EndDate`, endDate); } function updateEndTime(prefix, endTime) { - localStorage.setItem(`@MobileSessionFacade.LocalStorageKey-${firstCharToUpperCase(prefix)}EndTime`, endTime); + if(false === timeRegex.test(endTime)) { + return; + } + + saveLocally(`@MobileSessionFacade.LocalStorageKey-${firstCharToUpperCase(prefix)}EndTime`, endTime); } function updateDuration(prefix, duration) { - localStorage.setItem(`@MobileSessionFacade.LocalStorageKey-${firstCharToUpperCase(prefix)}Duration`, duration); + saveLocally(`@MobileSessionFacade.LocalStorageKey-${firstCharToUpperCase(prefix)}Duration`, duration); } function updateDistance(prefix, distance) { - localStorage.setItem(`@MobileSessionFacade.LocalStorageKey-${firstCharToUpperCase(prefix)}Distance`, distance); + saveLocally(`@MobileSessionFacade.LocalStorageKey-${firstCharToUpperCase(prefix)}Distance`, distance); } function updateMarker(prefix, marker) { - localStorage.setItem(`@MobileSessionFacade.LocalStorageKey-${firstCharToUpperCase(prefix)}Marker`, marker); + saveLocally(`@MobileSessionFacade.LocalStorageKey-${firstCharToUpperCase(prefix)}Marker`, marker); } function updateBetrag(prefix, betrag) { - localStorage.setItem(`@MobileSessionFacade.LocalStorageKey-${firstCharToUpperCase(prefix)}Betrag`, betrag); + saveLocally(`@MobileSessionFacade.LocalStorageKey-${firstCharToUpperCase(prefix)}Betrag`, betrag); } - + function updateDokuText(prefix, text, nr) { - localStorage.setItem(`@MobileSessionFacade.LocalStorageKey-${firstCharToUpperCase(prefix)}Doku${(nr + 1)}`, text); + saveLocally(`@MobileSessionFacade.LocalStorageKey-${firstCharToUpperCase(prefix)}Doku${(nr + 1)}`, text); } function removeGoals2Ratings(prefix) { localStorage.removeItem(`@MobileSessionFacade.LocalStorageKey-${firstCharToUpperCase(prefix)}Goals2Ratings`); } + function updateDurationUnit(prefix, durationUnit) { + logInfo(`Speichere die ${prefix}-Dauereinheit ${durationUnit} lokal.`); + + saveLocally(`@MobileSessionFacade.LocalStorageKey-${firstCharToUpperCase(prefix)}DurationUnit`, durationUnit); + } + + function updateCurrentPage(currentPage) { + saveLocally(`@MobileSessionFacade.LocalStorageKey-SbCurrentPage`, currentPage); + } + + function clearLocalBeWoStorage() { for(let i = 0; i < localStorage.length; i++) { const key = localStorage.key(i); - if(!key.startsWith(`@MobileSessionFacade.LocalStorageKey`)) { - continue; + if(key.startsWith(`@MobileSessionFacade.LocalStorageKey`)) { + localStorage.removeItem(key); } - - localStorage.removeItem(key); } } @@ -99,16 +207,16 @@ const localStorageKey = `@MobileSessionFacade.LocalStorageKey-${firstCharToUpperCase(prefix)}Goals2Ratings`; const stored = localStorage.getItem(localStorageKey); + console.log(stored); const map = stored ? new Map(JSON.parse(stored)) : new Map(); map.set(goalOid, ratingTypeOid); - localStorage.setItem(localStorageKey, JSON.stringify([...map])); + saveLocally(localStorageKey, JSON.stringify([...map])); } function printLocalStorage() { - $("#dev-popup-body").html(""); - + $("#local-storage-popup-body").html(""); let output = ""; let singleBookingOutput = "

            Einzelbuchung

            " + @@ -116,6 +224,8 @@ "" + "" + "" + + "" + + "" + "" + ""; @@ -123,7 +233,9 @@ "" + "" + "" + - "" + + "" + + "" + + "" + "" + ""; @@ -132,6 +244,8 @@ "" + "" + "" + + "" + + "" + "" + ""; @@ -145,11 +259,11 @@ const value = localStorage.getItem(key); if(key.startsWith(`@MobileSessionFacade.LocalStorageKey-Sb`)) { - singleBookingOutput += ``; + singleBookingOutput += ``; } else if(key.startsWith(`@MobileSessionFacade.LocalStorageKey-Gb`)) { - groupBookingOutput += ``; + groupBookingOutput += ``; } else if(key.startsWith(`@MobileSessionFacade.LocalStorageKey-Mb`)) { - multiBookingOutput += ``; + multiBookingOutput += ``; } } @@ -158,12 +272,13 @@ multiBookingOutput += "
            IdWertFeld
            IdWertWertFeld
            IdWertFeld
            ${key}${value}
            ${key}${keyMap.get(key)}${value}
            ${key}${value}
            ${key}${keyMap.get(key)}${value}
            ${key}${value}
            ${key}${keyMap.get(key)}${value}
            "; output += singleBookingOutput + "
            " + groupBookingOutput + "
            " + multiBookingOutput; - $("#dev-local-storage-body").html(`

            ${ - output}`); - $("#dev-local-storage").modal("show"); + $("#local-storage-popup-body").html(`

            ${output}`); + $("#local-storage-popup").modal("show"); } function restoreAllFields() { + showSpinner(); + const bookingMode = @((int) Model.CurrentBookingMode); const prefix = bookingMode === 0 ? "Sb" : bookingMode === 1 ? "Gb" : "Mb"; @@ -174,37 +289,44 @@ $("#srr-mb-cb2sc-oids").val(localStorage.getItem(`@MobileSessionFacade.LocalStorageKey-MbCb2ScRelOids`)); $("#srr-mb-emp-oids").val(localStorage.getItem(`@MobileSessionFacade.LocalStorageKey-MbEmployeeOids`)); - - $("#srr-start-date-input").val(localStorage.getItem(`@MobileSessionFacade.LocalStorageKey-${prefix}StartDate`)); $("#srr-start-time-input").val(localStorage.getItem(`@MobileSessionFacade.LocalStorageKey-${prefix}StartTime`)); $("#srr-end-date-input").val(localStorage.getItem(`@MobileSessionFacade.LocalStorageKey-${prefix}EndDate`)); $("#srr-end-time-input").val(localStorage.getItem(`@MobileSessionFacade.LocalStorageKey-${prefix}EndTime`)); - //$("#srr-marker-cb").val(); - //$("#srr-betrag").val(); + $("#srr-marker-cb").val(localStorage.getItem(`@MobileSessionFacade.LocalStorageKey-${prefix}Marker`)); + $("#srr-betrag").val(localStorage.getItem(`@MobileSessionFacade.LocalStorageKey-${prefix}Betrag`)); - //$("#srr-duration-input").val(); + $("#srr-duration-input").val(localStorage.getItem(`@MobileSessionFacade.LocalStorageKey-${prefix}Duration`)); + $("#srr-duration-unit").val(localStorage.getItem(`@MobileSessionFacade.LocalStorageKey-${prefix}DurationUnit`)); - //$("#srr-distance-input").val(); + $("#srr-distance-input").val(localStorage.getItem(`@MobileSessionFacade.LocalStorageKey-${prefix}Distance`)); - //$("#srr-doku-textarea-1").val(beWoStorage.getItemValueById(`${prefix}doku-textarea-0`)); - //$("#srr-doku-textarea-2").val(beWoStorage.getItemValueById(`${prefix}doku-textarea-1`)); - //$("#srr-doku-textarea-3").val(beWoStorage.getItemValueById(`${prefix}doku-textarea-2`)); - //$("#srr-doku-textarea-4").val(beWoStorage.getItemValueById(`${prefix}doku-textarea-3`)); - //$("#srr-doku-textarea-5").val(beWoStorage.getItemValueById(`${prefix}doku-textarea-4`)); - //$("#srr-doku-textarea-6").val(beWoStorage.getItemValueById(`${prefix}doku-textarea`)); + $("#srr-doku-textarea-1").val(localStorage.getItem(`@MobileSessionFacade.LocalStorageKey-${prefix}Doku1`)); + $("#srr-doku-textarea-2").val(localStorage.getItem(`@MobileSessionFacade.LocalStorageKey-${prefix}Doku2`)); + $("#srr-doku-textarea-3").val(localStorage.getItem(`@MobileSessionFacade.LocalStorageKey-${prefix}Doku3`)); + $("#srr-doku-textarea-4").val(localStorage.getItem(`@MobileSessionFacade.LocalStorageKey-${prefix}Doku4`)); + $("#srr-doku-textarea-5").val(localStorage.getItem(`@MobileSessionFacade.LocalStorageKey-${prefix}Doku5`)); + $("#srr-doku-textarea-6").val(localStorage.getItem(`@MobileSessionFacade.LocalStorageKey-${prefix}Doku6`)); + + $("#srr-leistung-select").val(localStorage.getItem(`@MobileSessionFacade.LocalStorageKey-${prefix}ServiceDescription`)); $("#srr-booking-mode").val(bookingMode); - //$("#restore-service-record-form").submit(); + $("#srr-sb-cb2sc-oid").val(localStorage.getItem(`@MobileSessionFacade.LocalStorageKey-SbCb2ScRelOid`)); + + $("#srr-current-page").val(localStorage.getItem(`@MobileSessionFacade.LocalStorageKey-SbCurrentPage`)); + + $("#restore-service-record-form").submit(); } @using(Html.BeginForm("RestoreServiceRecordForm", "Main", FormMethod.Post, new { id = "restore-service-record-form" })) { - + + + @@ -215,6 +337,7 @@ + @@ -225,6 +348,7 @@ + @@ -245,7 +369,7 @@ @if(Html.IsInDebugMode()) {