From 682e4b922215fde3e95d1ca8353007dd4e570a90 Mon Sep 17 00:00:00 2001 From: Lyndon Jetten Date: Wed, 10 Aug 2022 14:13:29 +0200 Subject: [PATCH] MoK: - Nach Mitarbeitern, Ressourcen, und Klienten filtern - Ziele in Modal-Popup mit PartialView gepackt --- BeWoPlanerMobil/BeWoPlanerMobil.csproj | 6 +- BeWoPlanerMobil/BeWoPlanerMobil.csproj.user | 4 +- BeWoPlanerMobil/Controllers/MainController.cs | 194 +++++++++------- .../Controllers/SchedulerController.cs | 59 +++-- BeWoPlanerMobil/Models/MainModel.cs | 12 + BeWoPlanerMobil/Scripts/utils/list-utils.js | 14 +- .../Scripts/utils/resources-list-utils.js | 15 +- BeWoPlanerMobil/Scripts/view-scripts/main.js | 47 +--- .../Scripts/view-scripts/report.js | 10 +- BeWoPlanerMobil/Util/GoalTreeItem.cs | 2 +- BeWoPlanerMobil/Views/Main/Main.cshtml | 34 --- .../Views/Main/SingleBookingPartial.cshtml | 104 +++++---- BeWoPlanerMobil/Views/Report/Report.cshtml | 27 ++- .../Scheduler/AppointmentFormPartial.cshtml | 12 +- .../AppointmentIntervalFinderPartial.cshtml | 20 +- .../Scheduler/OneDaySchedulerPartial.cshtml | 209 +++++++++--------- .../Views/Scheduler/Scheduler.cshtml | 4 +- BeWoPlanerMobil/Views/Shared/_Layout.cshtml | 14 +- Data/ICF/ICFDAO.cs | 3 + .../OperationsServiceImp.cs | 1 + Shared/Core/Utils.cs | 2 +- Shared/DataContracts/RatingTypeDC.cs | 6 +- 22 files changed, 412 insertions(+), 387 deletions(-) diff --git a/BeWoPlanerMobil/BeWoPlanerMobil.csproj b/BeWoPlanerMobil/BeWoPlanerMobil.csproj index 27a337e2c..47908e450 100644 --- a/BeWoPlanerMobil/BeWoPlanerMobil.csproj +++ b/BeWoPlanerMobil/BeWoPlanerMobil.csproj @@ -17,7 +17,7 @@ BeWoPlanerMobil v4.7.2 false - true + false @@ -1335,7 +1335,6 @@ - Designer @@ -1374,6 +1373,7 @@ + @@ -1573,7 +1573,7 @@ False 8808 / - http://localhost:8808/ + http://localhost/BeWoPlanerMobil False False diff --git a/BeWoPlanerMobil/BeWoPlanerMobil.csproj.user b/BeWoPlanerMobil/BeWoPlanerMobil.csproj.user index aed93f702..2c93437fb 100644 --- a/BeWoPlanerMobil/BeWoPlanerMobil.csproj.user +++ b/BeWoPlanerMobil/BeWoPlanerMobil.csproj.user @@ -1,14 +1,14 @@  - true + false false - Release|Any CPU + Debug|Any CPU ShowAllFiles 600 MvcControllerEmptyScaffolder diff --git a/BeWoPlanerMobil/Controllers/MainController.cs b/BeWoPlanerMobil/Controllers/MainController.cs index 384a51bee..9ffe0eb87 100644 --- a/BeWoPlanerMobil/Controllers/MainController.cs +++ b/BeWoPlanerMobil/Controllers/MainController.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Collections.ObjectModel; using System.Diagnostics; using System.Drawing; using System.Linq; @@ -40,7 +41,7 @@ namespace BeWoPlanerMobil.Controllers return null; } - if(((MainModel) Session[ModelSessionConstants.MainModelKey])?.Employee == null) + if(((MainModel) Session[ModelSessionConstants.MainModelKey])?.Employee is null) { _Model = new MainModel { Employee = MobileSessionFacade.LoggedInEmployee }; Session[ModelSessionConstants.MainModelKey] = _Model; @@ -63,7 +64,7 @@ namespace BeWoPlanerMobil.Controllers { var mandator = (MandatorDC) HttpContext.Session["mandator"]; - if(mandator == null) + if(mandator is null) { mandator = OperationsService.GetMandator(); HttpContext.Session["mandator"] = mandator; @@ -152,12 +153,12 @@ namespace BeWoPlanerMobil.Controllers Model.ShowDistanceField = UserSettingsUtils.GetSettingValueAsBool(mandatorSettings, SettingsKeys.ShowDistanceFields); Model.Dokutypes = ValueListService.GetAllValueListEntrysByType(ValueListEntryType.DocumentType); - if (Model.Dokutypes != null) + if(!(Model.Dokutypes is null)) { Model.Dokutypes = Model.Dokutypes.OrderBy(s => s.ValueListEntryOid).ToArray(); } - if(MainModel.AllEmployees == null) + if(MainModel.AllEmployees is null) { MainModel.AllEmployees = EmployeeService.GetAllActiveEmployeesCompact().OrderBy(e => e.LastName).ToList(); } @@ -192,38 +193,38 @@ namespace BeWoPlanerMobil.Controllers { var endDate = MainModel.GetEndDateOfSupportConcept(supportConcept); - return endDate == null || endDate.Value >= DateTime.Now.Date; + return endDate is null || endDate.Value >= DateTime.Now.Date; }).ToList(); } - if(Model.ServiceCategories == null) + if(Model.ServiceCategories is null) { Model.ServiceCategories = new List(); } - if(Model.SelectedConceptCostBearerRelations == null) + if(Model.SelectedConceptCostBearerRelations is null) { Model.SelectedConceptCostBearerRelations = new List(); } - if (Model.SelectedEmployee == null) + if(Model.SelectedEmployee is null) { Model.SelectedEmployee = MobileSessionFacade.LoggedInCompactEmployee; } Model.IsServiceRecordNoticeMandatory = UserSettingsUtils.GetSettingValueAsBool(mandatorSettings, SettingsKeys.IsServiceRecordNoticeMandatory); - var isInList = Model.SelectedSupportConceptListObject != null && Model.SupportConceptListObjects.Contains(Model.SelectedSupportConceptListObject); + var isInList = !(Model.SelectedSupportConceptListObject is null) && Model.SupportConceptListObjects.Contains(Model.SelectedSupportConceptListObject); - if(Model.SelectedSupportConceptListObject == null || !isInList) + if(Model.SelectedSupportConceptListObject is null || !isInList) { - if (Model.SelectedSupportConceptListObject != null && !isInList) + if(!(Model.SelectedSupportConceptListObject is null) && !isInList) { Log.Info($"Model.SelectedSupportConceptListObject.Oid = {Model.SelectedSupportConceptListObject.CostBearer2SupportConceptOid} is not in list !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); - StringBuilder sb = new StringBuilder(); - foreach (var o in Model.SupportConceptListObjects) + var sb = new StringBuilder(); + foreach(var o in Model.SupportConceptListObjects) { if (sb.Length > 0) { @@ -235,7 +236,7 @@ namespace BeWoPlanerMobil.Controllers Log.Info($"Model.SupportConceptListObjects Oids = {sb}"); } - //Log.Info(String.Format("Main() Set CostBearer2SupportConceptOid = -1: Model.SelectedSupportConceptListObject == null {0}, isInList {1}", Model.SelectedSupportConceptListObject == null, isInList)); + //Log.Info(String.Format("Main() Set CostBearer2SupportConceptOid = -1: Model.SelectedSupportConceptListObject is null {0}, isInList {1}", Model.SelectedSupportConceptListObject is null, isInList)); Model.SelectedSupportConceptListObject = Model.SupportConceptListObjects.FirstOrDefault(f => f.CostBearer2SupportConceptOid == "-1") ?? Model.SupportConceptListObjects.First(); Model.CostBearer2SupportConceptOid = -1; @@ -243,7 +244,7 @@ namespace BeWoPlanerMobil.Controllers Model.HasAnyRatingTypes = OperationsService.GetAllRatingTypes().Any(); } - if(Model.CostBearer2SupportConceptOid != null) + if(!(Model.CostBearer2SupportConceptOid is null)) { LoadRecordsToModel(); } @@ -252,7 +253,7 @@ namespace BeWoPlanerMobil.Controllers Model.IsZeiterfassungInStdMin = UserSettingsUtils.GetSettingValueAsBool(mandatorSettings, SettingsKeys.IsZeiterfassungInStdMin); } - catch (Exception e) + catch(Exception e) { Log.Error(e.Message, e); } @@ -263,7 +264,7 @@ namespace BeWoPlanerMobil.Controllers [Authorize] public void LoadGoalRatings() { - if(Model == null) + if(Model is null) { return; } @@ -276,7 +277,7 @@ namespace BeWoPlanerMobil.Controllers [Authorize] public string RateSelectedGoal(long? ratingTypeOid, long? goalOid) { - if(Model == null || ratingTypeOid == null || goalOid == null) + if(Model is null || ratingTypeOid is null || goalOid is null) { return _LeerzeichenFuerGetMethoden; } @@ -289,6 +290,15 @@ namespace BeWoPlanerMobil.Controllers goal.RatingTypeOid = ratingTypeOid; + if(Model.IsInEditingMode && Model.SelectedGoals.Any(a => a.ValueListEntryOid.HasValue && a.ValueListEntryOid.Value == goal.ValueListEntryOid)) + { + var selectedGoal = Model.SelectedGoals.FirstOrDefault(a => a.ValueListEntryOid.HasValue && a.ValueListEntryOid.Value == goal.ValueListEntryOid); + if(!(selectedGoal is null)) + { + selectedGoal.RatingTypeOid = ratingTypeOid; + } + } + return SerializeObject(new GoalRating(rating?.DisplayName ?? string.Empty, goal.ValueListEntryOid ?? 0)); } @@ -299,7 +309,7 @@ namespace BeWoPlanerMobil.Controllers [Authorize] public ActionResult SetShowExpiredSupportConcepts(FormCollection pCollection) { - if (Model == null) + if(Model is null) { return Logout(); } @@ -317,21 +327,19 @@ namespace BeWoPlanerMobil.Controllers return base.Logout(); } - // Wird beim Neuladen der Seite ausgeführt per Get-Aufruf [Authorize] - public string LoadGoals() + public void LoadGoals() { - if((!Model.CostBearer2SupportConceptOid.HasValue || Model.CostBearer2SupportConceptOid.Value > 0) && Model.SelectedSupportConcept == null) + if((!Model.CostBearer2SupportConceptOid.HasValue || Model.CostBearer2SupportConceptOid.Value > 0) && Model.SelectedSupportConcept is null) { Logout(); - return null; } var supportConcept = Model.SupportConcepts.FirstOrDefault(sc => sc.CostBearerRelations.Any(sc2Cb => sc2Cb.CostBearer2SupportConceptOid.HasValue && sc2Cb.CostBearer2SupportConceptOid.Value.Equals(Model.CostBearer2SupportConceptOid.Value))); - if (supportConcept == null) + if (supportConcept is null) { - return null; + return; } Model.SelectedSupportConcept = supportConcept; @@ -343,14 +351,15 @@ namespace BeWoPlanerMobil.Controllers _ParentGoals = new Dictionary(); foreach (var oid in missingParents) { - LoadMissingParents(oid.Value); + if(oid.HasValue) + { + LoadMissingParents(oid.Value); + } } var allGoals = selectedGoals.Union(_ParentGoals.Values).ToList(); - var goalTree = BuildGoalTree(allGoals); - - return SerializeObject(goalTree); + Model.GoalTree = BuildGoalTree(allGoals); } private List BuildGoalTree(IReadOnlyCollection goals) @@ -368,7 +377,7 @@ namespace BeWoPlanerMobil.Controllers goalTreeDic.Add(ziel.ValueListEntryOid.Value, treeItem); - if(ziel.ParentOid == null) + if(ziel.ParentOid is null) { goalTree.Add(treeItem); } @@ -438,9 +447,24 @@ namespace BeWoPlanerMobil.Controllers } */ + goalTree = goalTree.OrderBy(o => o.ValueListEntryOid).ToList(); + foreach(var item in goalTree) + { + SortGoals(item); + } + return goalTree; } + private void SortGoals(GoalTreeItem goalTreeItem) + { + goalTreeItem.Children = goalTreeItem.Children.OrderBy(s => s.ValueListEntryOid).ToList(); + foreach(var test in goalTreeItem.Children) + { + SortGoals(test); + } + } + private void LoadMissingParents(long pParentOid) { while(true) @@ -467,7 +491,7 @@ namespace BeWoPlanerMobil.Controllers { try { - if (Model == null) + if (Model is null) { Logout(); return _LeerzeichenFuerGetMethoden; @@ -613,7 +637,7 @@ namespace BeWoPlanerMobil.Controllers { try { - if (Model == null) + if (Model is null) { Logout(); return _LeerzeichenFuerGetMethoden; @@ -692,7 +716,7 @@ namespace BeWoPlanerMobil.Controllers [Authorize] public string LoadServiceCategories(long pServiceCategoryOid) { - if (Model == null) + if (Model is null) { Logout(); return _LeerzeichenFuerGetMethoden; @@ -719,7 +743,7 @@ namespace BeWoPlanerMobil.Controllers [Authorize] public string LoadTextbausteineForServiceCategory(long pServiceCategoryOid) { - if (Model == null) + if (Model is null) { Logout(); return _LeerzeichenFuerGetMethoden; @@ -747,7 +771,7 @@ namespace BeWoPlanerMobil.Controllers } Model.Textbausteine = textbausteine.Where( - w => (w.ServiceCategory == null || w.ServiceCategory.ServiceCategoryOid == pServiceCategoryOid) && !string.IsNullOrEmpty(w.Text) + w => (w.ServiceCategory is null || w.ServiceCategory.ServiceCategoryOid == pServiceCategoryOid) && !string.IsNullOrEmpty(w.Text) && (w.IsOnlyForEmployee && w.Employee.EmployeeOid.Equals(Model.Employee.EmployeeOid) || !w.IsOnlyForEmployee)).OrderBy(t => t.Text).ToList(); Model.Textbausteine.AddRangeIfElementsNotIn(Utils.GetParentTextModules(Model.Textbausteine)); @@ -764,7 +788,7 @@ namespace BeWoPlanerMobil.Controllers } } - var test = newItems.Where(item => item.ParentOid == null).ToList(); + var test = newItems.Where(item => item.ParentOid is null).ToList(); if(test.Count == 0) { @@ -817,7 +841,7 @@ namespace BeWoPlanerMobil.Controllers [Authorize] public string LoadCompleteTextbausteinByOid(long pTextbausteinOid) { - if (Model == null) + if(Model is null) { Logout(); return _LeerzeichenFuerGetMethoden; @@ -825,7 +849,7 @@ namespace BeWoPlanerMobil.Controllers var textModule = Model.Textbausteine.FirstOrDefault(f => f.TextModuleOid.HasValue && f.TextModuleOid.Value == pTextbausteinOid); - return textModule == null ? null : string.IsNullOrWhiteSpace(textModule.Text) ? textModule.Name : textModule.Text; + return textModule is null ? null : string.IsNullOrWhiteSpace(textModule.Text) ? textModule.Name : textModule.Text; } [HttpPost] @@ -834,7 +858,7 @@ namespace BeWoPlanerMobil.Controllers { try { - if(Model == null) + if(Model is null) { return Logout(); } @@ -929,13 +953,13 @@ namespace BeWoPlanerMobil.Controllers Model.NewServiceRecord = Model.GetServiceRecord(selectedRecordOid.Value); } - if(Model.NewServiceRecord == null) + if(Model.NewServiceRecord is null) { return RedirectToActionPermanent("Main"); } Model.NewServiceRecord.IP = Request.UserHostAddress; - + // ToDo: Funktioniert noch nicht zu 100 % Model.NewServiceRecord.Goals = Model.SelectedGoals; Model.NewServiceRecord.Start = zeitenFeld[0]; Model.NewServiceRecord.End = zeitenFeld[1]; @@ -1151,7 +1175,7 @@ namespace BeWoPlanerMobil.Controllers { cb2ScOids.Add(scdc.CostBearerRelations.ElementAt(0).CostBearer2SupportConceptOid.Value); - if(org == null) + if(org is null) { org = scdc.CostBearerRelations.ElementAt(0).CostBearer; if(org != null) @@ -1161,7 +1185,7 @@ namespace BeWoPlanerMobil.Controllers } else { - if(scdc.CostBearerRelations.ElementAt(0).CostBearer == null || !org.Equals(scdc.CostBearerRelations.ElementAt(0).CostBearer)) + if(scdc.CostBearerRelations.ElementAt(0).CostBearer is null || !org.Equals(scdc.CostBearerRelations.ElementAt(0).CostBearer)) { roundDuration = false; } @@ -1228,7 +1252,7 @@ namespace BeWoPlanerMobil.Controllers item.GroupOid = Model.NewServiceRecord.GroupOid; item.GroupRoundedDuration = groupDuration; - if(item.CostBearer != null && item.CostBearer.CostBearerOid == null && item.SupportConcept != null && item.SupportConcept.CostBearerList.Count > 0) + if(item.CostBearer != null && item.CostBearer.CostBearerOid is null && item.SupportConcept != null && item.SupportConcept.CostBearerList.Count > 0) { item.CostBearer.CostBearerOid = item.SupportConcept.CostBearerList[0].CostBearerOid; } @@ -1472,7 +1496,7 @@ namespace BeWoPlanerMobil.Controllers { try { - if (Model == null) + if (Model is null) { return Logout(); } @@ -1486,6 +1510,9 @@ namespace BeWoPlanerMobil.Controllers LoadGoalRatings(); + // ToDo: Hier LoadGoals aufrufen! + LoadGoals(); + return ResetEditingMode(); } catch (Exception e) @@ -1498,12 +1525,12 @@ namespace BeWoPlanerMobil.Controllers private void LoadServiceCategoriesToModel(long? cb2ScOid) { - if (cb2ScOid == null) + if (cb2ScOid is null) { - Log.Info("cb2ScOid == null !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); + Log.Info("cb2ScOid is null !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); } - if (cb2ScOid == null && Model.IsInGroupBookingMode) + if (cb2ScOid is null && Model.IsInGroupBookingMode) { Model.ServiceCategories = CreateServiceCategoryModels(OperationsService.GetAllServiceDescriptions()); @@ -1544,14 +1571,14 @@ namespace BeWoPlanerMobil.Controllers } else { - Log.Info("Model.SelectedSupportConcept == null !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); + Log.Info("Model.SelectedSupportConcept is null !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); } - if (Model.SelectedSupportConceptListObject == null || + if (Model.SelectedSupportConceptListObject is null || Model.SelectedSupportConceptListObject.CostBearer2SupportConceptOid == "-1") { - Log.Info($"LoadServiceCategoriesToModel() Model.SelectedSupportConceptListObject == null {Model.SelectedSupportConceptListObject == null}, Model.SelectedSupportConceptListObject.CostBearer2SupportConceptOid == {Model.SelectedSupportConceptListObject?.CostBearer2SupportConceptOid}"); + Log.Info($"LoadServiceCategoriesToModel() Model.SelectedSupportConceptListObject is null {Model.SelectedSupportConceptListObject is null}, Model.SelectedSupportConceptListObject.CostBearer2SupportConceptOid == {Model.SelectedSupportConceptListObject?.CostBearer2SupportConceptOid}"); } if (Model.ServiceCategories != null) @@ -1564,7 +1591,7 @@ namespace BeWoPlanerMobil.Controllers [Authorize] public ActionResult DeleteServiceRecord(FormCollection formCollection) { - if (Model == null) + if (Model is null) { return Logout(); } @@ -1592,14 +1619,14 @@ namespace BeWoPlanerMobil.Controllers [Authorize] public string UpdateGoals(string pGoalOids) { - if (Model == null) + if (Model is null) { Logout(); return _LeerzeichenFuerGetMethoden; } var sc = Model.SelectedSupportConcept; - if (sc == null) + if (sc is null) { return _LeerzeichenFuerGetMethoden; } @@ -1616,7 +1643,14 @@ namespace BeWoPlanerMobil.Controllers var goals = sc.Goals.Where(w => w.ValueListEntryOid.HasValue && selectedGoalOids.Contains(w.ValueListEntryOid.Value)).ToList(); - Model.SelectedGoals = goals; + // ToDo: Hier liegt der Bug! + // ToDo: vorhandene Bewertungen beachten! + var stillSelectedGoals = Model.SelectedGoals.Where(s => goals.Any(a => a.ValueListEntryOid.HasValue && a.ValueListEntryOid.Value == s.ValueListEntryOid)).ToList(); + + Model.SelectedGoals = stillSelectedGoals; + Model.SelectedGoals.AddRangeIfElementsNotIn(goals); + + //Model.SelectedGoals = goals; return _LeerzeichenFuerGetMethoden; } @@ -1624,7 +1658,7 @@ namespace BeWoPlanerMobil.Controllers [Authorize] public string SetServiceDescription(long pServiceDescriptionOid) { - if (Model == null) + if (Model is null) { Logout(); return _LeerzeichenFuerGetMethoden; @@ -1638,7 +1672,7 @@ namespace BeWoPlanerMobil.Controllers [Authorize] public ActionResult LoadServiceRecords(FormCollection formCollection) { - if (Model == null) + if (Model is null) { return Logout(); } @@ -1658,7 +1692,7 @@ namespace BeWoPlanerMobil.Controllers private void LoadRecordsToModel() { - if (Model == null) + if (Model is null) { Logout(); return; @@ -1693,7 +1727,7 @@ namespace BeWoPlanerMobil.Controllers [Authorize] public ActionResult SelectRecordToEdit(FormCollection formCollection) { - if(Model == null) + if(Model is null) { return Logout(); } @@ -1711,7 +1745,7 @@ namespace BeWoPlanerMobil.Controllers var selectedServiceRecord = Model.GetServiceRecord(serviceRecordOid); - if(selectedServiceRecord == null) + if(selectedServiceRecord is null) { return RedirectToActionPermanent("Main"); } @@ -1759,7 +1793,7 @@ namespace BeWoPlanerMobil.Controllers [Authorize] public string GetSelectedRecordInformation() { - if (Model == null) + if (Model is null) { Logout(); return _LeerzeichenFuerGetMethoden; @@ -1778,7 +1812,7 @@ namespace BeWoPlanerMobil.Controllers [Authorize] public string GetSelectedRecordInformationWithOid(long oid) { - if (Model == null) + if (Model is null) { Logout(); return _LeerzeichenFuerGetMethoden; @@ -1792,7 +1826,7 @@ namespace BeWoPlanerMobil.Controllers [Authorize] public string CheckRights(string von, string bis, bool inEditMode, string dateString, string startString, string endString) { - if (Model == null) + if (Model is null) { Logout(); return _LeerzeichenFuerGetMethoden; @@ -1834,7 +1868,7 @@ namespace BeWoPlanerMobil.Controllers checkServiceRecord = Model.ServiceRecords.FirstOrDefault(f => f.ServiceRecordOid.HasValue && f.ServiceRecordOid.Value.Equals(Model.SelectedServiceRecordOid)); } - if (checkServiceRecord == null) + if (checkServiceRecord is null) { checkServiceRecord = new ServiceRecordDC(); } @@ -2101,7 +2135,7 @@ namespace BeWoPlanerMobil.Controllers [Authorize] public string ValidateServiceRecordDeletion(string serviceRecordOidString) { - if(Model == null) + if(Model is null) { Logout(); return _LeerzeichenFuerGetMethoden; @@ -2118,7 +2152,7 @@ namespace BeWoPlanerMobil.Controllers var serviceRecord = Model.GetServiceRecord(serviceRecordOid); - if(serviceRecord == null) + if(serviceRecord is null) { return _LeerzeichenFuerGetMethoden; } @@ -2155,7 +2189,7 @@ namespace BeWoPlanerMobil.Controllers { try { - if (Model == null) + if (Model is null) { Logout(); return _LeerzeichenFuerGetMethoden; @@ -2169,7 +2203,7 @@ namespace BeWoPlanerMobil.Controllers Log.Info("Error in SetServiceRecordEmployee:"); Log.Error(e.Message, e); - if (MainModel.AllEmployees == null) + if (MainModel.AllEmployees is null) { Log.Info("Weitere Infos: AllEmployees = null!"); } @@ -2221,7 +2255,7 @@ namespace BeWoPlanerMobil.Controllers return RedirectToActionPermanent("PreselectCustomer", "Customer", new {Model.SelectedSupportConcept.Customer.CustomerOid}); } - if(Model?.SelectedSupportConcept == null && (CustomerModel)Session[ModelSessionConstants.CustomerModelKey] != null) + if(Model?.SelectedSupportConcept is null && (CustomerModel)Session[ModelSessionConstants.CustomerModelKey] != null) { var customerModel = (CustomerModel) Session[ModelSessionConstants.CustomerModelKey]; customerModel.SelectedCustomerOid = null; @@ -2257,7 +2291,7 @@ namespace BeWoPlanerMobil.Controllers [Authorize] public ActionResult SetGroupBookingMode(FormCollection pFormCollection) { - if (Model == null) + if (Model is null) { return Logout(); } @@ -2277,7 +2311,7 @@ namespace BeWoPlanerMobil.Controllers /// Bei false wird davon ausgegangen, dass man von der Gruppenbuchung in eine Einzelbuchung wechselt und der vorher ausgewählte Mitarbeiter und Hilfeplan wird automatisch ausgewählt. private void ResetGroupBookingMode(bool pIsInGroupBookingMode) { - if (Model == null) + if (Model is null) { Logout(); return; @@ -2335,7 +2369,7 @@ namespace BeWoPlanerMobil.Controllers [Authorize] public ActionResult ResetEditingMode() { - if (Model == null) + if (Model is null) { return Logout(); } @@ -2368,7 +2402,7 @@ namespace BeWoPlanerMobil.Controllers [Authorize] public string AddSupportConceptCostBearerRelationsToGroupBooking(string pRelOids, string pGroupOids) { - if(Model == null) + if(Model is null) { Logout(); return _LeerzeichenFuerGetMethoden; @@ -2387,7 +2421,7 @@ namespace BeWoPlanerMobil.Controllers rawGroupOids.DoForEach(s => { var group = Model.GroupsOfPeople.FirstOrDefault(f => f.GroupOfPeopleOid.HasValue && f.GroupOfPeopleOid.Value.Equals(long.Parse(s))); - if(group == null) + if(group is null) { return; } @@ -2438,7 +2472,7 @@ namespace BeWoPlanerMobil.Controllers [Authorize] public string RemoveSupportConceptCostBearerRelationFromGroupBooking(string pRelOid) { - if(Model == null) + if(Model is null) { Logout(); return _LeerzeichenFuerGetMethoden; @@ -2465,7 +2499,7 @@ namespace BeWoPlanerMobil.Controllers [Authorize] public string AddEmployeesToGroupBooking(string pEmployeeOids) { - if(Model == null) + if(Model is null) { Logout(); return _LeerzeichenFuerGetMethoden; @@ -2493,7 +2527,7 @@ namespace BeWoPlanerMobil.Controllers [Authorize] public string GetSignatureImage(long serviceRecordOid, long signatureOid) { - if(Model == null) + if(Model is null) { Logout(); return _LeerzeichenFuerGetMethoden; @@ -2519,7 +2553,7 @@ namespace BeWoPlanerMobil.Controllers [Authorize] public ActionResult SetSupportConceptFilter(FormCollection formCollection) { - if(Model == null) + if(Model is null) { return Logout(); } @@ -2540,7 +2574,7 @@ namespace BeWoPlanerMobil.Controllers [HttpPost] public ActionResult CreateOrUpdateGroupBooking(FormCollection formCollection) { - if(Model == null) + if(Model is null) { return Logout(); } @@ -2658,7 +2692,7 @@ namespace BeWoPlanerMobil.Controllers dauer = (int)(zeitenFeld[1] - zeitenFeld[0]).TotalMinutes; } - if(Model.NewServiceRecord == null) + if(Model.NewServiceRecord is null) { return RedirectToActionPermanent("Main"); } diff --git a/BeWoPlanerMobil/Controllers/SchedulerController.cs b/BeWoPlanerMobil/Controllers/SchedulerController.cs index 92ec69f0b..d7d68f15b 100644 --- a/BeWoPlanerMobil/Controllers/SchedulerController.cs +++ b/BeWoPlanerMobil/Controllers/SchedulerController.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using System.Globalization; using System.Linq; -using System.Web; using System.Web.Mvc; using BeWoPlanerMobil.Models; @@ -33,7 +32,7 @@ namespace BeWoPlanerMobil.Controllers return null; } - if (((SchedulerModel) Session[ModelSessionConstants.SchedulerModelKey])?.Employee == null) + if (((SchedulerModel) Session[ModelSessionConstants.SchedulerModelKey])?.Employee is null) { _Model = new SchedulerModel { Employee = MobileSessionFacade.LoggedInEmployee }; Session[ModelSessionConstants.SchedulerModelKey] = _Model; @@ -76,7 +75,7 @@ namespace BeWoPlanerMobil.Controllers private void LoadAppointmentsForDate() { - if(Model?.Employee.EmployeeOid == null) + if(Model?.Employee.EmployeeOid is null) { return; } @@ -99,7 +98,11 @@ namespace BeWoPlanerMobil.Controllers end = sunday; } - var appointments = KalenderService.LoadFilteredAppointmentsMitAufgaben(AbstractModel.HasRightToSeeAllEmployeeAppointments, Model.Employee.EmployeeOid.Value, start.Date, end, new List(), new List(), new List(), false, false, false, false, true, true).ToList(); + var selectedCustomers = Model.SelectedCustomers?.Select(s => s.CustomerOid).ToList() ?? new List(); + var selectedEmployees = Model.SelectedEmployees?.Select(s => s.EmployeeOid).ToList() ?? new List(); + var selectedResources = Model.SelectedResources?.Where(w => w.ResourceOid.HasValue).Select(s => s.ResourceOid.Value).ToList() ?? new List(); + + var appointments = KalenderService.LoadFilteredAppointmentsMitAufgaben(AbstractModel.HasRightToSeeAllEmployeeAppointments, Model.Employee.EmployeeOid.Value, start.Date, end, selectedEmployees, selectedCustomers, selectedResources, false, false, false, false, true, true).ToList(); var tasks = appointments.Where(w => w.IsTask).ToList(); @@ -127,7 +130,7 @@ namespace BeWoPlanerMobil.Controllers (date.InBetween(w.StartDate.Value, w.EndDate.Value, false) || date.CompareShortDates(w.StartDate.Value)) // Einzeltermine oder Ausnahmen und gelöschte Ausnahmen - && (w.RecurrenceInfo == null || w.RecurrenceInfo != null && (w.Type == 3 || w.Type == 4)) + && (w.RecurrenceInfo is null || w.RecurrenceInfo != null && (w.Type == 3 || w.Type == 4)) ).ToList(); @@ -239,7 +242,7 @@ namespace BeWoPlanerMobil.Controllers { try { - if (Model == null) + if (Model is null) { Logout(); } @@ -258,12 +261,12 @@ namespace BeWoPlanerMobil.Controllers var isSuccessfulStartTime = DateTime.TryParseExact(rawStartTime, "HH:mm", null, DateTimeStyles.None, out var startTime); var isSuccessfulEndTime = DateTime.TryParseExact(rawEndTime, "HH:mm", null, DateTimeStyles.None, out var endTime); - if(rawStartTime == null) + if(rawStartTime is null) { rawStartTime = "00:00"; } - if (rawEndTime == null) + if (rawEndTime is null) { rawEndTime = "00:00"; } @@ -346,7 +349,7 @@ namespace BeWoPlanerMobil.Controllers [HttpPost] public ActionResult NavigateToPreviousDate() { - if (Model == null) + if (Model is null) { Logout(); } @@ -366,7 +369,7 @@ namespace BeWoPlanerMobil.Controllers [HttpPost] public ActionResult NavigateToNextDate() { - if(Model == null) + if(Model is null) { Logout(); } @@ -385,7 +388,7 @@ namespace BeWoPlanerMobil.Controllers [Authorize] [HttpPost] public ActionResult SelectSchedulerDate(FormCollection formCollection) { - if (Model == null) + if (Model is null) { Logout(); } @@ -447,7 +450,7 @@ namespace BeWoPlanerMobil.Controllers [Authorize] public JsonResult CheckForOverlappingAppointments(string startDateRaw, string endDateRaw, string startTimeRaw, string endTimeRaw) { - if (Model == null) + if (Model is null) { Logout(); return null; @@ -480,7 +483,7 @@ namespace BeWoPlanerMobil.Controllers // TODO: Serientermine überprüfen if(Model.Appointments != null) { - foreach(var appointment in Model.Appointments.Where(app => app.SchedulerAppointmentOid == null && app.IsTask == false)) + foreach(var appointment in Model.Appointments.Where(app => app.SchedulerAppointmentOid is null && app.IsTask == false)) { } @@ -493,7 +496,7 @@ namespace BeWoPlanerMobil.Controllers [Authorize] public string SelectResourcesForAppointment(string resourceOids) { - if(Model == null) + if(Model is null) { Logout(); return _LeerzeichenFuerGetMethoden; @@ -513,7 +516,7 @@ namespace BeWoPlanerMobil.Controllers [Authorize] public string SelectEmployeesForAppointment(string oidString) { - if (Model == null) + if (Model is null) { Logout(); return _LeerzeichenFuerGetMethoden; @@ -529,7 +532,7 @@ namespace BeWoPlanerMobil.Controllers [Authorize] public string SelectCustomersForAppointment(string oidString) { - if (Model == null) + if (Model is null) { Logout(); return _LeerzeichenFuerGetMethoden; @@ -582,7 +585,7 @@ namespace BeWoPlanerMobil.Controllers [HttpPost] public ActionResult ChangeSchedulerView(FormCollection formCollection) { - if(Model == null) + if(Model is null) { return Logout(); } @@ -598,7 +601,7 @@ namespace BeWoPlanerMobil.Controllers [HttpPost] public ActionResult FindFreeIntervals(FormCollection formCollection) { - if(Model == null) + if(Model is null) { return Logout(); } @@ -628,7 +631,7 @@ namespace BeWoPlanerMobil.Controllers [Authorize] public string SelectEmployeesForIntervalFinder(string oidString) { - if (Model == null) + if (Model is null) { Logout(); return _LeerzeichenFuerGetMethoden; @@ -644,7 +647,7 @@ namespace BeWoPlanerMobil.Controllers [Authorize] public string SelectCustomersForIntervalFinder(string oidString) { - if (Model == null) + if (Model is null) { Logout(); return _LeerzeichenFuerGetMethoden; @@ -660,7 +663,7 @@ namespace BeWoPlanerMobil.Controllers [Authorize] public string SelectResourcesForIntervalFinder(string resourceOids) { - if (Model == null) + if (Model is null) { Logout(); return _LeerzeichenFuerGetMethoden; @@ -681,7 +684,7 @@ namespace BeWoPlanerMobil.Controllers [HttpPost] public ActionResult SetIsInIntervalFinderMode(FormCollection formCollection) { - if(Model == null) + if(Model is null) { return Logout(); } @@ -704,7 +707,7 @@ namespace BeWoPlanerMobil.Controllers [HttpPost] public ActionResult SelectIntervalForForm(FormCollection formCollection) { - if(Model == null) + if(Model is null) { return Logout(); } @@ -754,7 +757,7 @@ namespace BeWoPlanerMobil.Controllers [Authorize] public string ResetIntervalFinder() { - if(Model == null) + if(Model is null) { return _LeerzeichenFuerGetMethoden; } @@ -765,5 +768,13 @@ namespace BeWoPlanerMobil.Controllers return _LeerzeichenFuerGetMethoden; } + + [Authorize] + public ActionResult FetchAppointments() + { + LoadAppointmentsForDate(); + + return PartialView("OneDaySchedulerPartial", Model); + } } } diff --git a/BeWoPlanerMobil/Models/MainModel.cs b/BeWoPlanerMobil/Models/MainModel.cs index 1b59f3513..e09a7afcd 100644 --- a/BeWoPlanerMobil/Models/MainModel.cs +++ b/BeWoPlanerMobil/Models/MainModel.cs @@ -1,6 +1,9 @@ using System; using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Collections.Specialized; using System.ComponentModel.DataAnnotations; +using System.Diagnostics; using System.Linq; using System.Web.Mvc; using BeWo.View.Navigation.Filter; @@ -212,6 +215,13 @@ namespace BeWoPlanerMobil.Models set => _SelectedGoals = value; } + private string GetRatingName(ValueListEntryDC ratedValueListEntry) + { + var rating = GoalRatingTypes.FirstOrDefault(f => f.RatingTypeOid.HasValue && f.RatingTypeOid.Value.Equals(ratedValueListEntry.RatingTypeOid)); + + return rating?.DisplayName ?? "NULL"; + } + public ServiceRecordDC NewServiceRecord { get; set; } public long? ServiceRecordOidToDelete { get; set; } @@ -572,6 +582,8 @@ namespace BeWoPlanerMobil.Models } public bool HasAnyRatingTypes { get; set; } + + public List GoalTree { get; set; } = new List(); } public class CustomSelectListItem diff --git a/BeWoPlanerMobil/Scripts/utils/list-utils.js b/BeWoPlanerMobil/Scripts/utils/list-utils.js index 79c45b955..1350c6ca7 100644 --- a/BeWoPlanerMobil/Scripts/utils/list-utils.js +++ b/BeWoPlanerMobil/Scripts/utils/list-utils.js @@ -1,4 +1,4 @@ -function changeItemListSelection(url, popupId, listId, itemIdPrefix, isCustomer, checkBoxIdSuffix) { +function changeItemListSelection(url, popupId, listId, itemIdPrefix, isCustomer, checkBoxIdSuffix, filterAppointmentsUrl) { try { if (url === undefined || url === null) { return; @@ -12,7 +12,9 @@ }); $.get(url, { oidString: oidStr }).done(function (jsonResult) { - updateSelectedList(jsonResult, listId, itemIdPrefix, isCustomer, popupId, checkBoxIdSuffix, url); + updateSelectedList(jsonResult, listId, itemIdPrefix, isCustomer, popupId, checkBoxIdSuffix, url, filterAppointmentsUrl); + + $("#one-day-scheduler-partial-container").load(filterAppointmentsUrl); }); } catch(error) { logError(error.message); @@ -20,7 +22,7 @@ } // Col-Value berechnen -function updateSelectedList(jsonResult, listId, itemIdPrefix, isCustomer, popupId, checkBoxIdSuffix, url) { +function updateSelectedList(jsonResult, listId, itemIdPrefix, isCustomer, popupId, checkBoxIdSuffix, url, filterAppointmentsUrl) { try { if(isEmptyOrSpaces(jsonResult)) { return; @@ -48,7 +50,7 @@ function updateSelectedList(jsonResult, listId, itemIdPrefix, isCustomer, popupI var id = itemIdPrefix + oid; - var removeParams = oid + ", '" + checkBoxIdSuffix + "', " + isCustomer + ", '" + url + "', '" + popupId + "', '" + listId + "', '" + itemIdPrefix + "'"; + var removeParams = oid + ", '" + checkBoxIdSuffix + "', " + isCustomer + ", '" + url + "', '" + popupId + "', '" + listId + "', '" + itemIdPrefix + "', '" + filterAppointmentsUrl + "'"; var html = "
" + @@ -76,7 +78,7 @@ function updateSelectedList(jsonResult, listId, itemIdPrefix, isCustomer, popupI } } -function removeSelectedItem(itemOid, itemSuffix, isCustomer, url, popupId, listId, itemIdPrefix) { +function removeSelectedItem(itemOid, itemSuffix, isCustomer, url, popupId, listId, itemIdPrefix, filterAppointmentsUrl) { try { var prefix = isCustomer ? "customer-" : "employee-"; @@ -86,7 +88,7 @@ function removeSelectedItem(itemOid, itemSuffix, isCustomer, url, popupId, listI checkBox.prop("checked", false); } - changeItemListSelection(url, popupId, listId, itemIdPrefix, isCustomer, itemSuffix); + changeItemListSelection(url, popupId, listId, itemIdPrefix, isCustomer, itemSuffix, filterAppointmentsUrl); } catch(error) { logError(error); } diff --git a/BeWoPlanerMobil/Scripts/utils/resources-list-utils.js b/BeWoPlanerMobil/Scripts/utils/resources-list-utils.js index 1e72f871b..c87864adc 100644 --- a/BeWoPlanerMobil/Scripts/utils/resources-list-utils.js +++ b/BeWoPlanerMobil/Scripts/utils/resources-list-utils.js @@ -1,4 +1,4 @@ -function changeResourceSelection(popupId, url, listId, listItemIdPrefix, checkBoxIdPrefix) { +function changeResourceSelection(popupId, url, listId, listItemIdPrefix, checkBoxIdPrefix, filterAppointmentsUrl) { var selectedOids = []; var oidString = ""; @@ -13,11 +13,13 @@ } $.get(url, { resourceOids: oidString }).done(function (jsonResult) { - updateSelectedResourceList(jsonResult, listId, listItemIdPrefix, popupId, checkBoxIdPrefix, url); + updateSelectedResourceList(jsonResult, listId, listItemIdPrefix, popupId, checkBoxIdPrefix, url, filterAppointmentsUrl); + + $("#one-day-scheduler-partial-container").load(filterAppointmentsUrl); }); } -function updateSelectedResourceList(jsonResult, listId, listItemIdPrefix, popupId, checkBoxIdPrefix, url) { +function updateSelectedResourceList(jsonResult, listId, listItemIdPrefix, popupId, checkBoxIdPrefix, url, filterAppointmentsUrl) { var list = $("#" + listId); list.empty(); @@ -41,7 +43,7 @@ function updateSelectedResourceList(jsonResult, listId, listItemIdPrefix, popupI "
" + "

" + customListItem.Name + "

" + "

" + - "" + + "" + "
" + "" + "" + @@ -51,7 +53,8 @@ function updateSelectedResourceList(jsonResult, listId, listItemIdPrefix, popupI }); } -function removeSelectedResource(listItemId, checkBoxId, popupId, url, listId) { +// ToDo: FetchAppointments-Url hinzufügen +function removeSelectedResource(listItemId, checkBoxId, popupId, url, listId, fetchAppointmentsUrl) { $("#" + listItemId).remove(); var checkbox = $("#" + checkBoxId); @@ -60,5 +63,5 @@ function removeSelectedResource(listItemId, checkBoxId, popupId, url, listId) { checkbox.prop("checked", false); } - changeResourceSelection(popupId, url, listId); + changeResourceSelection(popupId, url, listId, null, null, fetchAppointmentsUrl); } diff --git a/BeWoPlanerMobil/Scripts/view-scripts/main.js b/BeWoPlanerMobil/Scripts/view-scripts/main.js index 1e55196fd..06d5103ef 100644 --- a/BeWoPlanerMobil/Scripts/view-scripts/main.js +++ b/BeWoPlanerMobil/Scripts/view-scripts/main.js @@ -440,53 +440,8 @@ function validateForm(form) { } } -var treeHtml = ""; - -function buildGoalsTree(treeData) { - var container = $("#goals-container"); - - container.empty(); - treeHtml = ""; - - $.each(treeData, function(index) { - buildGoaldTreeBranch(treeData[index]); - }); - - container.append(treeHtml); -} - -function buildGoaldTreeBranch(goalItem) { - var goalOid = goalItem.ValueListEntryOid; - var goalHeader = goalItem.Header; - var isChecked = getSelectedGoalOids() !== null && isInArray(goalOid, getSelectedGoalOids()) ? "checked" : ""; - var ratingName = goalItem.RatingName; - - if(!goalItem.IsLeaf) { - treeHtml += - '
' + - '
' + goalHeader + "
" + - '
'; - - $.each(goalItem.Children, function(index) { - buildGoaldTreeBranch(goalItem.Children[index]); - }); - - treeHtml += - "
" + - "
"; - } else { - treeHtml += - '
' + - '' + - '" + - "" + ratingName + "" + - "
"; - } -} - function showGoalRatingPopup(goalOid) { try { - console.log("jquery version " + $().jquery); $("#goal-rating-popup").modal("show"); $("#goal-to-rate-oid").val(goalOid); } catch (error) { @@ -540,7 +495,7 @@ function checkChildNodes(parentOid) { } function getCheckedGoals() { - var rootElement = $("#goals-container"); + var rootElement = $("#goals-tree"); var checkboxes = rootElement.find("input"); var selectedGoals = ""; diff --git a/BeWoPlanerMobil/Scripts/view-scripts/report.js b/BeWoPlanerMobil/Scripts/view-scripts/report.js index c1cd7d48e..c903ea9e7 100644 --- a/BeWoPlanerMobil/Scripts/view-scripts/report.js +++ b/BeWoPlanerMobil/Scripts/view-scripts/report.js @@ -177,7 +177,7 @@ function getSignatures(signatureOidStrings, containerId) { if(isUndefinedOrNull(json) || !checkJson(json)) { if(!checkJson(json)) { hideSpinner(); - logError("Fehler loadConfirmationReceiptSignatures: " + json); + logError("Fehler loadConfirmationReceiptSignatures: <" + json + ">"); } } @@ -236,10 +236,10 @@ function hideSignatureContainer() { $("#report-form-container").show(); } -function showSignaturePad(overwrite, signatureOidsString, canSign, cardBodyId, customerOid, numberOfEntries, customerName, timeSpan, isEmployeeSignature) { +function showSignaturePad(overwrite, signatureOidsString, canSign, cardBodyId, customerOid, numberOfEntries, customerName, timeSpan, isEmployeeSignature, employeeName) { try { cardHeaderButtonClick(cardBodyId); - + $("#report-form-container").hide(); $("#report-signature-container-div").addClass("d-block"); @@ -252,7 +252,9 @@ function showSignaturePad(overwrite, signatureOidsString, canSign, cardBodyId, c var leistungPlural = entryCount > 1 ? "en" : ""; - $("#report-info-column-h4").html("Unterschrift" + plural + " für " + numberOfEntries + " erbrachte Leistung" + leistungPlural + " von " + customerName + " (" + timeSpan + ")"); + var signatureGiverName = isEmployeeSignature ? employeeName : customerName; + + $("#report-info-column-h4").html("Unterschrift" + plural + " von " + signatureGiverName + " für " + numberOfEntries + " erbrachte Leistung" + leistungPlural + " von " + customerName + " (" + timeSpan + ")"); if(overwrite) { $("#overwriting-signature-alert").addClass("d-block"); diff --git a/BeWoPlanerMobil/Util/GoalTreeItem.cs b/BeWoPlanerMobil/Util/GoalTreeItem.cs index 647d7035c..94b799771 100644 --- a/BeWoPlanerMobil/Util/GoalTreeItem.cs +++ b/BeWoPlanerMobil/Util/GoalTreeItem.cs @@ -16,6 +16,6 @@ namespace BeWoPlanerMobil.Util public long? TopmostParentOid { get; set; } - public string RatingName { get; set; } = "Bewerten";//string.Empty; + public string RatingName { get; set; } = "Bewerten"; } } diff --git a/BeWoPlanerMobil/Views/Main/Main.cshtml b/BeWoPlanerMobil/Views/Main/Main.cshtml index d27e0bc53..b5f7eb097 100644 --- a/BeWoPlanerMobil/Views/Main/Main.cshtml +++ b/BeWoPlanerMobil/Views/Main/Main.cshtml @@ -117,13 +117,6 @@ } - @if(Model?.SelectedSupportConcept != null && Model.SelectedSupportConcept.Goals.Any()) - { - - initializeGoalsTreeView(); - - } - setInputFilter(); @if(Model.IsInGroupBookingMode) @@ -248,12 +241,6 @@ return @(Model != null && Model.IsServiceRecordNoticeMandatory ? "true" : "false"); } - function initializeGoalsTreeView() { - $.get("@Url.Action("LoadGoals")").done(function(jsonGoals) { - buildGoalsTree($.parseJSON(jsonGoals)); - }); - } - function getSelectedGoalOids() { return @Html.Raw(Json.Encode(Model.SelectedGoals.Select(s => s.ValueListEntryOid.Value).ToArray())); } @@ -372,27 +359,6 @@ - - - -
diff --git a/BeWoPlanerMobil/Views/Main/SingleBookingPartial.cshtml b/BeWoPlanerMobil/Views/Main/SingleBookingPartial.cshtml index e2fb60d53..651003fc0 100644 --- a/BeWoPlanerMobil/Views/Main/SingleBookingPartial.cshtml +++ b/BeWoPlanerMobil/Views/Main/SingleBookingPartial.cshtml @@ -5,9 +5,9 @@
- @if (Model != null) + @if(Model != null) { - using (Html.BeginForm("SelectSupportConcept", "Main", FormMethod.Post, new { Id = "selectSupportConceptForm" })) + using(Html.BeginForm("SelectSupportConcept", "Main", FormMethod.Post, new { Id = "selectSupportConceptForm" })) { var selectedSuportConceptTimeSpanColorClass = Model.SelectedSupportConceptListObject.IsAboutToExpire ? "text-bewo-is-about-to-expire" : Model.SelectedSupportConceptListObject.ExpiresInThreeMonthsOrLess ? "text-bewo-expires-in-three-months" : "text-dark";
@@ -25,7 +25,7 @@
- @if (Model.CostBearer2SupportConceptOid != null && Model.CostBearer2SupportConceptOid > 0) + @if(Model.CostBearer2SupportConceptOid != null && Model.CostBearer2SupportConceptOid > 0) {
- @if (Model.SelectedSupportConcept != null && Model.SelectedSupportConcept.Goals.Any()) + @if(Model.SelectedSupportConcept != null && Model.SelectedSupportConcept.Goals.Any()) {
- +
@@ -151,7 +151,7 @@
- @if (Model.IsEndDateVisible) + @if(Model.IsEndDateVisible) {
@@ -200,7 +200,7 @@
- @if (Model.IsZeiterfassungInStdMin) + @if(Model.IsZeiterfassungInStdMin) {
@@ -219,7 +219,7 @@ }
- @if (Model.ShowDistanceField) + @if(Model.ShowDistanceField) {
@@ -230,7 +230,7 @@
} - @if (AbstractModel.HasRightToSeeTextModules) + @if(AbstractModel.HasRightToSeeTextModules) {
@@ -241,7 +241,7 @@ }
- @if (Model.NumberOfDokuTypes == 0) + @if(Model.NumberOfDokuTypes == 0) {
@@ -251,7 +251,7 @@ else {
- @for (var i = 0; i < Model.Dokutypes.Length; i++) + @for(var i = 0; i < Model.Dokutypes.Length; i++) { var textareaName = i + 1 < 1 ? "Dokumentation" : "Dokumentation" + (i + 1); @@ -282,9 +282,9 @@
- @if (Model.IsInEditingMode) + @if(Model.IsInEditingMode) { - using (Html.BeginForm("ResetEditingMode", "Main", FormMethod.Post)) + using(Html.BeginForm("ResetEditingMode", "Main", FormMethod.Post)) { } @@ -305,29 +305,29 @@
- @if (Model != null) + @if(Model != null) { - if (Model.SelectedSupportConcept != null || Model.CostBearer2SupportConceptOid == -2) + if(Model.SelectedSupportConcept != null || Model.CostBearer2SupportConceptOid == -2) {
- @using (Html.BeginForm("LoadServiceRecords", "Main", FormMethod.Post, new { id = "selectServiceRecordForm" })) + @using(Html.BeginForm("LoadServiceRecords", "Main", FormMethod.Post, new { id = "selectServiceRecordForm" })) { @@ -338,9 +338,9 @@
@{ - foreach (var serviceRecord in Model.ServiceRecords) + foreach(var serviceRecord in Model.ServiceRecords) { - if (serviceRecord.Start == null || serviceRecord.End == null) + if(serviceRecord.Start == null || serviceRecord.End == null) { continue; } @@ -352,7 +352,7 @@ var duration = (end - start).TotalMinutes; var roundedDuration = MobileUtils.GetDecimalValueWithMaxDecimal(serviceRecord.RoundedDuration, 2); - if (serviceRecord.ServiceDescription.Category.Percentage > 0 && serviceRecord.ServiceDescription.Category.Percentage < 100) + if(serviceRecord.ServiceDescription.Category.Percentage > 0 && serviceRecord.ServiceDescription.Category.Percentage < 100) { roundedDuration = roundedDuration * serviceRecord.ServiceDescription.Category.Percentage / 100; } @@ -361,13 +361,13 @@ var goalsString = string.Empty; - if (serviceRecord.Goals != null && serviceRecord.Goals.Count > 0) + if(serviceRecord.Goals != null && serviceRecord.Goals.Count > 0) { - foreach (var goal in serviceRecord.Goals) + foreach(var goal in serviceRecord.Goals) { goalsString += goal.TypeDescription; - if (serviceRecord.Goals.IndexOf(goal) < serviceRecord.Goals.Count - 1) + if(serviceRecord.Goals.IndexOf(goal) < serviceRecord.Goals.Count - 1) { goalsString += ", "; } @@ -392,9 +392,9 @@
- @if (Model.HasRightToEditServiceRecord(serviceRecord)) + @if(Model.HasRightToEditServiceRecord(serviceRecord)) { - using (Html.BeginForm("SelectRecordToEdit", "Main", FormMethod.Post)) + using(Html.BeginForm("SelectRecordToEdit", "Main", FormMethod.Post)) {
} - @if (Model.ShowSignature && !serviceRecord.SignatureOid.HasValue) + @if(Model.ShowSignature && !serviceRecord.SignatureOid.HasValue) {
} - else if (Model.ShowSignature && serviceRecord.SignatureOid.HasValue) + else if(Model.ShowSignature && serviceRecord.SignatureOid.HasValue) {
- @if (Model.ShowDistanceField && serviceRecord.DistanceInMeter != null && serviceRecord.DistanceInMeter.Value > 0) + @if(Model.ShowDistanceField && serviceRecord.DistanceInMeter != null && serviceRecord.DistanceInMeter.Value > 0) {
@@ -450,7 +450,7 @@
} - @if (serviceRecord.Goals != null && serviceRecord.Goals.Count > 0) + @if(serviceRecord.Goals != null && serviceRecord.Goals.Count > 0) {
@@ -496,7 +496,7 @@ @{ var header1 = "Dokumentation"; - if (Model.NumberOfDokuTypes >= 1) + if(Model.NumberOfDokuTypes >= 1) { header1 = Model.Dokutypes[0].TypeDescription; } @@ -510,20 +510,20 @@
- for (var i = 1; i < serviceRecord.NoticeList.Count; i++) + for(var i = 1; i < serviceRecord.NoticeList.Count; i++) { var notice = serviceRecord.NoticeList[i]; - if (string.IsNullOrWhiteSpace(notice) || Model.NumberOfDokuTypes <= i) + if(string.IsNullOrWhiteSpace(notice) || Model.NumberOfDokuTypes <= i) { continue; } var header = $"Dokumentation {i + 1}"; - if (Model.NumberOfDokuTypes >= 2) + if(Model.NumberOfDokuTypes >= 2) { - if (Model.NumberOfDokuTypes <= i) + if(Model.NumberOfDokuTypes <= i) { continue; } @@ -560,4 +560,26 @@ }
+ + +
\ No newline at end of file diff --git a/BeWoPlanerMobil/Views/Report/Report.cshtml b/BeWoPlanerMobil/Views/Report/Report.cshtml index 034b6d225..711ea87a5 100644 --- a/BeWoPlanerMobil/Views/Report/Report.cshtml +++ b/BeWoPlanerMobil/Views/Report/Report.cshtml @@ -200,17 +200,20 @@ var canCustomerSign = customerSignatureState != SignatureState.All; var canEmployeeSign = employeeSignatureState != SignatureState.All; + var employeeName = Model.Employee.ToString(); + //overwrite, signatureOidsString, canSign, cardBodyId, customerOid, numberOfEntries, customerName, timeSpan, isEmployeeSignature var methodName = "showSignaturePad(" + - $"{result.HasCustomerSignature.ToString().ToLower()}, " + - $"'{customerSignatureOidsString}', " + - $"{canCustomerSign.ToString().ToLower()}, " + - $"'#collapse-result-{result.Identifier}', " + - $"{result.CustomerOid}, " + - $"{result.Items.Count}, " + - $"'{result.CustomerName}', " + - $"'{Model.ConfirmationReceiptObject.TimeSpanString}', " + - "false)" ; + $"{result.HasCustomerSignature.ToString().ToLower()}, " + + $"'{customerSignatureOidsString}', " + + $"{canCustomerSign.ToString().ToLower()}, " + + $"'#collapse-result-{result.Identifier}', " + + $"{result.CustomerOid}, " + + $"{result.Items.Count}, " + + $"'{result.CustomerName}', " + + $"'{Model.ConfirmationReceiptObject.TimeSpanString}', " + + "false, " + + $"'{employeeName}')" ; //overwrite, signatureOidsString, canSign, cardBodyId, customerOid, numberOfEntries, customerName, timeSpan, isEmployeeSignature var overwrite_ssp = (employeeSignatureState == SignatureState.All).ToString().ToLower(); @@ -222,7 +225,9 @@ var customerName_ssp = result.CustomerName; var timeSpan_ssp = Model.ConfirmationReceiptObject.TimeSpanString; - var employeeMethodName = $"showSignaturePad({overwrite_ssp}, '{signatureOidsString_ssp}', {canSign_ssp}, '{cardBodyId_ssp}', {customerOid_ssp}, {numberOfEntries_ssp}, '{customerName_ssp}', '{timeSpan_ssp}', true)"; + + + var employeeMethodName = $"showSignaturePad({overwrite_ssp}, '{signatureOidsString_ssp}', {canSign_ssp}, '{cardBodyId_ssp}', {customerOid_ssp}, {numberOfEntries_ssp}, '{customerName_ssp}', '{timeSpan_ssp}', true, '{employeeName}')"; var employeeBtnColor = "transparent"; var customerBtnColor = "transparent"; @@ -269,10 +274,12 @@
diff --git a/BeWoPlanerMobil/Views/Scheduler/AppointmentFormPartial.cshtml b/BeWoPlanerMobil/Views/Scheduler/AppointmentFormPartial.cshtml index ba5f675a1..8f9707650 100644 --- a/BeWoPlanerMobil/Views/Scheduler/AppointmentFormPartial.cshtml +++ b/BeWoPlanerMobil/Views/Scheduler/AppointmentFormPartial.cshtml @@ -126,7 +126,7 @@ @selectedEmployee.DetailDescription

-
@@ -159,7 +159,9 @@ var url = Url.Action("SelectCustomersForAppointment", "Scheduler"); var oid = selectedCustomer.CustomerOid; - var onClickParams = $"{oid}, '-checkbox', true, '{url}', 'customers-popup', 'selected-customers-list', 'related-customer-'"; + var filterAppointmentsUrl = Url.Action("FetchAppointments", "Scheduler"); + + var onClickParams = $"{oid}, '-checkbox', true, '{url}', 'customers-popup', 'selected-customers-list', 'related-customer-', '{filterAppointmentsUrl}'"; }
@@ -366,7 +370,7 @@ var checkedValue = Model.SelectedResourcesForIntervalFinder.Contains(resource) ? "checked" : string.Empty;
- +
} @@ -411,8 +415,10 @@ var checkedValue = Model.SelectedEmployeesForIntervalFinder.Contains(employee) ? "checked" : string.Empty; var url = Url.Action("SelectEmployeesForIntervalFinder", "Scheduler"); + + var filterAppointmentsUrl = Url.Action("FetchAppointments", "Scheduler"); - var onClickParams = $"'{url}', 'employees-interval-finder-popup', 'selected-employees-interval-finder-list', 'related-employee-interval-finder-', false, '-interval-finder-checkbox'"; + var onClickParams = $"'{url}', 'employees-interval-finder-popup', 'selected-employees-interval-finder-list', 'related-employee-interval-finder-', false, '-interval-finder-checkbox', '{filterAppointmentsUrl}'";
@@ -457,7 +463,9 @@ var url = Url.Action("SelectCustomersForIntervalFinder", "Scheduler"); - var onClickParams = $"'{url}', 'customers-interval-finder-popup', 'selected-customers-interval-finder-list', 'related-customer-interval-finder-', true, '-interval-finder-checkbox'"; + var filterAppointmentsUrl = Url.Action("FetchAppointments", "Scheduler"); + + var onClickParams = $"'{url}', 'customers-interval-finder-popup', 'selected-customers-interval-finder-list', 'related-customer-interval-finder-', true, '-interval-finder-checkbox', '{filterAppointmentsUrl}'";
diff --git a/BeWoPlanerMobil/Views/Scheduler/OneDaySchedulerPartial.cshtml b/BeWoPlanerMobil/Views/Scheduler/OneDaySchedulerPartial.cshtml index e0d0320a3..cba13f903 100644 --- a/BeWoPlanerMobil/Views/Scheduler/OneDaySchedulerPartial.cshtml +++ b/BeWoPlanerMobil/Views/Scheduler/OneDaySchedulerPartial.cshtml @@ -1,19 +1,107 @@ @model BeWoPlanerMobil.Models.SchedulerModel @* Ganztagestermine in eine Liste mit weniger Margin und Padding *@ - -@if (Model.AppointmentListItems.Any(a => a.AllDay)) -{ - foreach (var appointment in Model.AppointmentListItems.Where(a => a.AllDay)) +
+ @if(Model.AppointmentListItems.Any(a => a.AllDay)) { -
-
-
+ foreach(var appointment in Model.AppointmentListItems.Where(a => a.AllDay)) + { +
+
+
+ +
+
+ +
+
+
+
+
+ @if(appointment.HasEmployeesCustomersOrResources && !appointment.IsTask) + { +
+ @if(!string.IsNullOrWhiteSpace(appointment.EmployeeListInfo)) + { +
+ + @appointment.EmployeeListInfo +
+ } + @if(!string.IsNullOrWhiteSpace(appointment.CustomerListInfo)) + { +
+ + @appointment.CustomerListInfo +
+ } + @if(!string.IsNullOrWhiteSpace(appointment.ResourceListInfo)) + { +
+ + @appointment.ResourceListInfo +
+ } +
+
+ } + + @if(Model.HasRightToEditAppointment(appointment.Oid) && !appointment.IsTask && appointment.Oid.HasValue) + { + using(Html.BeginForm("SelectAppointmentToEdit", "Scheduler", FormMethod.Post)) + { +
+
+ + +
+
+ } + } +

@appointment.Description

+
+
+
+
+ } + +
+ } + + @foreach(var appointment in Model.AppointmentListItems.Where(a => !a.AllDay)) + { +
+
+
-
-
-
-
-
- @if (appointment.HasEmployeesCustomersOrResources && !appointment.IsTask) - { -
- @if (!string.IsNullOrWhiteSpace(appointment.EmployeeListInfo)) - { -
- - @appointment.EmployeeListInfo -
- } - @if (!string.IsNullOrWhiteSpace(appointment.CustomerListInfo)) - { -
- - @appointment.CustomerListInfo -
- } - @if (!string.IsNullOrWhiteSpace(appointment.ResourceListInfo)) - { -
- - @appointment.ResourceListInfo -
- } -
-
- } - - @if (Model.HasRightToEditAppointment(appointment.Oid) && !appointment.IsTask && appointment.Oid.HasValue) - { - using (Html.BeginForm("SelectAppointmentToEdit", "Scheduler", FormMethod.Post)) - { -
-
- - -
-
- } - } -

@appointment.Description

-
-
-
-
-} \ No newline at end of file +
\ No newline at end of file diff --git a/BeWoPlanerMobil/Views/Scheduler/Scheduler.cshtml b/BeWoPlanerMobil/Views/Scheduler/Scheduler.cshtml index fa8241f03..49f77068d 100644 --- a/BeWoPlanerMobil/Views/Scheduler/Scheduler.cshtml +++ b/BeWoPlanerMobil/Views/Scheduler/Scheduler.cshtml @@ -118,7 +118,7 @@ listCol = "col-md-12"; } } -
+
@if (Model.IsInIntervalFinderMode) { @@ -144,7 +144,7 @@ } else { - @Html.Partial("OneDaySchedulerPartial", Model) + Html.RenderAction("FetchAppointments", Model); }
diff --git a/BeWoPlanerMobil/Views/Shared/_Layout.cshtml b/BeWoPlanerMobil/Views/Shared/_Layout.cshtml index 697fe7ac7..7996a6df0 100644 --- a/BeWoPlanerMobil/Views/Shared/_Layout.cshtml +++ b/BeWoPlanerMobil/Views/Shared/_Layout.cshtml @@ -38,13 +38,13 @@ - + - + - @Html.DevExpress().GetStyleSheets( + @*@Html.DevExpress().GetStyleSheets( new StyleSheet { ExtensionSuite = ExtensionSuite.NavigationAndLayout }, new StyleSheet { ExtensionSuite = ExtensionSuite.Editors }, new StyleSheet { ExtensionSuite = ExtensionSuite.HtmlEditor }, @@ -70,9 +70,9 @@ new Script { ExtensionSuite = ExtensionSuite.TreeList }, new Script { ExtensionSuite = ExtensionSuite.Spreadsheet }, new Script { ExtensionSuite = ExtensionSuite.SpellChecker } - ) + )*@ - + *@