From 07bcddae55f2ae5ca3b7aec4e0ae3835e1b4b7d9 Mon Sep 17 00:00:00 2001 From: Lyndon Date: Fri, 29 Mar 2019 14:04:12 +0100 Subject: [PATCH] =?UTF-8?q?Bei=20Gruppenbuchungen=20im=20Mobilklienten=20w?= =?UTF-8?q?ird=20eine=20Liste=20mit=20den=20ausgew=C3=A4hlten=20Hilfepl?= =?UTF-8?q?=C3=A4nen=20angezeigt.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BeWo/BeWoApp.xaml.cs | 2 +- BeWo/View/HomeDragPanelView.xaml.cs | 22 +- BeWo/ownChat/ChatView.xaml | 2 +- BeWo/ownChat/ChatView.xaml.cs | 9 +- BeWoPlanerMobil/Content/BeWoMobileStyle.css | 72 ++++-- BeWoPlanerMobil/Controllers/MainController.cs | 213 ++++++++++-------- BeWoPlanerMobil/Models/MainModel.cs | 83 ++++++- .../Models/ServiceCategoryModel.cs | 2 +- BeWoPlanerMobil/Scripts/dateHelper.js | 4 - BeWoPlanerMobil/Scripts/gruppenbuchung.js | 132 ++++++++++- BeWoPlanerMobil/Scripts/initialization.js | 145 ++++-------- BeWoPlanerMobil/Scripts/mainView.js | 27 +-- BeWoPlanerMobil/Scripts/utils.js | 130 ++++++++++- BeWoPlanerMobil/Util/MobileUtils.cs | 72 +++--- BeWoPlanerMobil/Views/Main/Main.cshtml | 160 +++++++------ BeWoPlanerMobil/Views/Shared/_Layout.cshtml | 2 +- 16 files changed, 700 insertions(+), 377 deletions(-) diff --git a/BeWo/BeWoApp.xaml.cs b/BeWo/BeWoApp.xaml.cs index 52210e7c3..036e56e8c 100644 --- a/BeWo/BeWoApp.xaml.cs +++ b/BeWo/BeWoApp.xaml.cs @@ -985,7 +985,7 @@ namespace BeWo #else Login login = new Login(BeWoApp.Tenant); #endif - chatServerURL = login._serverUrl; + chatServerURL = Login.ServerUrl; } return chatServerURL; diff --git a/BeWo/View/HomeDragPanelView.xaml.cs b/BeWo/View/HomeDragPanelView.xaml.cs index d107bd951..f8aae2e38 100644 --- a/BeWo/View/HomeDragPanelView.xaml.cs +++ b/BeWo/View/HomeDragPanelView.xaml.cs @@ -1323,7 +1323,7 @@ namespace BeWo.View public ChatView ServiceChatView; - private void HyperlinkChat_OnRequestNavigate(object sender, RequestNavigateEventArgs e) + private async void HyperlinkChat_OnRequestNavigate(object sender, RequestNavigateEventArgs e) { //#if DEBUG @@ -1375,26 +1375,19 @@ namespace BeWo.View // _ChatCode = xxx.EmployeeCode; //} - if (BeWoApp.Mandator.Apikey != null) - _apikey = BeWoApp.Mandator.Apikey; - else - _apikey = "0000"; //erstmal zu default zwecken damit nichts abstürzt + _apikey = BeWoApp.Mandator.Apikey ?? "0000"; if (!_Code.Equals("")) { Login _login = new Login(_kundennummer, _Code, _benutzername, _passwort, _apikey); - var x = _login.AnmeldevorgangDurchFuehren(); + var x = _login.TryLogin(); - if (x != null) + if (x.Result != null) { - ServiceChatView = new ChatView(x); + ServiceChatView = new ChatView(x.Result); ServiceChatView.Show(); } - else - { - // Fehler ermittlung erfolgt bereits wärend anmelde versuch - } } else { @@ -1405,7 +1398,6 @@ namespace BeWo.View { MessageBox.Show("Sie benötigen einen gültigen Zugang zum Chat. Bitte wenden Sie sich an den Support.", "Info"); } - } else if (ServiceChatView.Visibility == Visibility.Visible) { @@ -1414,15 +1406,15 @@ namespace BeWo.View else if (ServiceChatView.Visibility == Visibility.Hidden) { ServiceChatView.Visibility = Visibility.Visible; + if (ServiceChatView.WindowState == WindowState.Minimized) { ServiceChatView.WindowState = WindowState.Normal; ServiceChatView.Height = 700; ServiceChatView.Width = 900; } - ServiceChatView.Activate(); - + ServiceChatView.Activate(); } //#endif } diff --git a/BeWo/ownChat/ChatView.xaml b/BeWo/ownChat/ChatView.xaml index 17c7de55b..1e7aeaa04 100644 --- a/BeWo/ownChat/ChatView.xaml +++ b/BeWo/ownChat/ChatView.xaml @@ -12,7 +12,7 @@ - + diff --git a/BeWo/ownChat/ChatView.xaml.cs b/BeWo/ownChat/ChatView.xaml.cs index ffb167761..e2ba5013f 100644 --- a/BeWo/ownChat/ChatView.xaml.cs +++ b/BeWo/ownChat/ChatView.xaml.cs @@ -15,8 +15,10 @@ using BeWo.ViewModel; using BS.Shared.DataContracts.Compact; using BS.Shared.Extensions; using BS.Shared.Translation; +using ChatController; using ChatController.ChatKlassen; using ChatController.Klassen; +using ChatController.LoginKlassen; using Button = System.Windows.Controls.Button; using MessageBox = System.Windows.MessageBox; using Panel = System.Windows.Controls.Panel; @@ -26,13 +28,14 @@ namespace BeWo.ownChat public partial class ChatView { public ChatEmojiView _emojiView; + public ChatMainControl ChatMainControl { get; set; } - public ChatView(ChatDatenUebergabe chatDaten) + public ChatView(ChatConnectionData chatDaten) { InitializeComponent(); CloseWindow(); - ChatMainControl.InitMitChatdaten(chatDaten); + ChatMainControl = new ChatMainControl(chatDaten); ChatMainControl.AddContextMenu("In Dokumentation übernehmen", ChatMainControl_OnClickContextMenuItem); LadeMessageInfoAusDatenBank(); @@ -96,7 +99,7 @@ namespace BeWo.ownChat private void ChatMainControl_OnClickContextMenuItem(string menuItem) { - var aktuellerKontakt = ChatMainControl.GetAktuellenKontakt(); + var aktuellerKontakt = ChatMainControl.GetCurrentContact(); if (aktuellerKontakt != null) { diff --git a/BeWoPlanerMobil/Content/BeWoMobileStyle.css b/BeWoPlanerMobil/Content/BeWoMobileStyle.css index 977621024..ef8a462b3 100644 --- a/BeWoPlanerMobil/Content/BeWoMobileStyle.css +++ b/BeWoPlanerMobil/Content/BeWoMobileStyle.css @@ -1,8 +1,4 @@ -input::-moz-focus-inner { - border: 0; -} - -table, tr, td { +table, tr, td { padding: .11em 0 .11em 0; border-spacing: 0; } @@ -118,6 +114,10 @@ input, textarea { box-sizing: border-box; } +input::-moz-focus-inner { + border: 0; +} + textarea { resize: none; } @@ -135,16 +135,16 @@ input:focus + label, textarea:focus + label { color: #FF5A00 !important; } +input[type=submit], input[type=button] { + background-color: #E6E6E6; + border: none; +} + input[type=submit]:active, input[type=button]:active { background-color: #FF5A00; color: #FFF; } -input[type=submit], input[type=button] { - background-color: #E6E6E6; - border: none; -} - span { white-space: normal !important; overflow: hidden !important; @@ -585,7 +585,6 @@ textarea { #logout-form { display: inline; - margin: 0; padding: 0; } @@ -786,10 +785,10 @@ input[type="checkbox"] { margin-top: .25em; } -#groupBookingOpenPopupBtn { +/*#groupBookingOpenPopupBtn { margin-bottom: 1em; margin-top: .5em; -} +}*/ .group-booking-tab { overflow: hidden; @@ -884,4 +883,49 @@ input[type="checkbox"] { height: auto; z-index: 9999; padding: 0 1.5em; -} \ No newline at end of file +} + +.remove_btn { + width: auto; + background-image: url("data:image/svg+xml;charset=US-ASCII,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22iso-8859-1%22%3F%3E%3C!DOCTYPE%20svg%20PUBLIC%20%22-%2F%2FW3C%2F%2FDTD%20SVG%201.1%2F%2FEN%22%20%22http%3A%2F%2Fwww.w3.org%2FGraphics%2FSVG%2F1.1%2FDTD%2Fsvg11.dtd%22%3E%3Csvg%20version%3D%221.1%22%20id%3D%22Layer_1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20x%3D%220px%22%20y%3D%220px%22%20%20width%3D%2216px%22%20height%3D%2216px%22%20viewBox%3D%220%200%2016%2016%22%20style%3D%22enable-background%3Anew%200%200%2016%2016%3B%22%20xml%3Aspace%3D%22preserve%22%3E%3Cpolygon%20fill%3D%22%23FF5A00%22%20points%3D%2215%2C4%2012%2C1%208%2C5%204%2C1%201%2C4%205%2C8%201%2C12%204%2C15%208%2C11%2012%2C15%2015%2C12%2011%2C8%20%22%3E%3C%2Fpolygon%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3C%2Fsvg%3E"); + background-repeat: no-repeat; + background-position: center; + background-size: contain; + background-color: #F4F4F4; + float: right; + margin: .3em; +} + +.remove_btn:active { + background-image: url("data:image/svg+xml;charset=US-ASCII,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22iso-8859-1%22%3F%3E%3C!DOCTYPE%20svg%20PUBLIC%20%22-%2F%2FW3C%2F%2FDTD%20SVG%201.1%2F%2FEN%22%20%22http%3A%2F%2Fwww.w3.org%2FGraphics%2FSVG%2F1.1%2FDTD%2Fsvg11.dtd%22%3E%3Csvg%20version%3D%221.1%22%20id%3D%22Layer_1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20x%3D%220px%22%20y%3D%220px%22%20%20width%3D%2216px%22%20height%3D%2216px%22%20viewBox%3D%220%200%2016%2016%22%20style%3D%22enable-background%3Anew%200%200%2016%2016%3B%22%20xml%3Aspace%3D%22preserve%22%3E%3Cpolygon%20fill%3D%22%23F4F4F4%22%20points%3D%2215%2C4%2012%2C1%208%2C5%204%2C1%201%2C4%205%2C8%201%2C12%204%2C15%208%2C11%2012%2C15%2015%2C12%2011%2C8%20%22%3E%3C%2Fpolygon%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3C%2Fsvg%3E"); + background-repeat: no-repeat; + background-position: center; + background-size: contain; + background-color: #FF5A00; +} + +#groupBookingSelectionTable { + border-collapse: collapse; + width: 100%; +} + +.groupBookingSelectionTableRow { + background-color: #F4F4F4; + color: #555555; + font-size: 13px; +} + +.groupBookingSelectionLeftCell { + padding-left: 1.3em; + border-bottom: 1px solid #BBBBBB; +} + +.groupBookingSelectionRightCell { + width: auto; + border-bottom: 1px solid #BBBBBB; +} + +.groupBookingPTag { + display: inline; + padding: 0; +} diff --git a/BeWoPlanerMobil/Controllers/MainController.cs b/BeWoPlanerMobil/Controllers/MainController.cs index bb30a79b0..9c80f6640 100644 --- a/BeWoPlanerMobil/Controllers/MainController.cs +++ b/BeWoPlanerMobil/Controllers/MainController.cs @@ -155,6 +155,11 @@ namespace BeWoPlanerMobil.Controllers Model.ServiceCategories = new List(); } + if(Model.SelectedConceptCostBearerRelations == null) + { + Model.SelectedConceptCostBearerRelations = new List(); + } + if (Model.CostBearer2SupportConceptOid != null) { LoadRecordsToModel(); @@ -1116,9 +1121,12 @@ namespace BeWoPlanerMobil.Controllers OperationsService.InsertNewServiceRecordGroup(groupDC); } } - - Model.SelectedSupportConcepts = new List(); - Model.SelectedEmployees = new List(); + + Model.SelectedSupportConcepts.Clear(); + Model.SelectedConceptCostBearerRelations.Clear(); + Model.SelectedCostbearerRelOids.Clear(); + Model.SelectedGroupOfPeopleOids.Clear(); + Model.SelectedEmployees = new List{ MobileSessionFacade.LoggedInCompactEmployee }; return RedirectToActionPermanent("Main"); } @@ -1141,7 +1149,6 @@ namespace BeWoPlanerMobil.Controllers CompactOrganisationDC org = null; - Calculations calc = null; var cb2scOids = new List(); foreach(var scdc in Model.SelectedSupportConcepts) @@ -1868,6 +1875,7 @@ namespace BeWoPlanerMobil.Controllers Model.SelectedSupportConcepts.Clear(); Model.SelectedEmployees.Clear(); Model.SelectedCostbearerRelOids.Clear(); + Model.SelectedConceptCostBearerRelations.Clear(); var relationOids = new List(); @@ -1881,6 +1889,8 @@ namespace BeWoPlanerMobil.Controllers relationOids = serviceRecordGroup.ServiceRecordList.Select(s => s.CostBearer2SupportConceptOid.Value).ToList(); var costBearerRelations = CustomerService.GetSupportConceptCostBearerRelationsById(relationOids); + Model.SelectedConceptCostBearerRelations.AddRangeIfElementsNotIn(costBearerRelations); + foreach(var rel in costBearerRelations) { var sc = CustomerService.LoadSupportConcept(rel.SupportConcept.SupportConceptOid); @@ -2016,13 +2026,13 @@ namespace BeWoPlanerMobil.Controllers } } - var mandator = OperationsService.GetMandator(); - var settings = mandator.Settings ?? string.Empty; - var splitSettings = settings.Split(';'); - var maxDaysEditSRsAllowedSetting = splitSettings.ToList().FirstOrDefault(f => f.Contains("MaxDaysEditServiceRecordsAllowed")); - var maxDaysEditSRsAllowed = maxDaysEditSRsAllowedSetting != null ? int.Parse(maxDaysEditSRsAllowedSetting.Split('=')[1]) : 0; + var mandator = OperationsService.GetMandator(); + var settings = mandator.Settings ?? string.Empty; + var splitSettings = settings.Split(';'); + var maxDaysEditSRsAllowedSetting = splitSettings.ToList().FirstOrDefault(f => f.Contains("MaxDaysEditServiceRecordsAllowed")); + var maxDaysEditSRsAllowed = maxDaysEditSRsAllowedSetting != null ? int.Parse(maxDaysEditSRsAllowedSetting.Split('=')[1]) : 0; var limitFuerZeiterfassungSetting = splitSettings.ToList().FirstOrDefault(f => f.Contains("AnzTageZeiterfassErfolgt")); - var limitFuerZeiterfassung = limitFuerZeiterfassungSetting != null ? int.Parse(limitFuerZeiterfassungSetting.Split('=')[1]) : 0; + var limitFuerZeiterfassung = limitFuerZeiterfassungSetting != null ? int.Parse(limitFuerZeiterfassungSetting.Split('=')[1]) : 0; if (MobileSessionFacade.CheckForUserRight(UserRightType.ServiceRecord_AllowEditAfterMaxDaysInNextMonth)) { @@ -2089,13 +2099,13 @@ namespace BeWoPlanerMobil.Controllers validationResults.Add(new ServiceRecord2Validation(checkSR, result, dateRangeString ?? "")); } - var allowOverlappingFLS = MobileSessionFacade.CheckForUserRight(UserRightType.ServiceRecord_AllowCreateOverlappingFLS); + var allowOverlappingFLS = MobileSessionFacade.CheckForUserRight(UserRightType.ServiceRecord_AllowCreateOverlappingFLS); var allowOverlappingFLSForEmployee = MobileSessionFacade.CheckForUserRight(UserRightType.ServiceRecord_AllowCreateOverlappingFLSForEmployee); - var allowMoreFLSThanApproved = MobileSessionFacade.CheckForUserRight(UserRightType.ServiceRecord_AllowCreateMoreFLSThanApproved); - var bookAfterSettlementInvoice = MobileSessionFacade.CheckForUserRight(UserRightType.BookServiceRecordAfterSettlementInvoice); + var allowMoreFLSThanApproved = MobileSessionFacade.CheckForUserRight(UserRightType.ServiceRecord_AllowCreateMoreFLSThanApproved); + var bookAfterSettlementInvoice = MobileSessionFacade.CheckForUserRight(UserRightType.BookServiceRecordAfterSettlementInvoice); var newResult = new ValidationResult(); - var exitLoop = false; + var exitLoop = false; foreach (var sr2v in validationResults) { if(exitLoop) @@ -2113,39 +2123,25 @@ namespace BeWoPlanerMobil.Controllers switch(vr.ResultType) { case ServiceRecordOverlapping: - if (allowOverlappingFLS) - { - newResult.KannTrotzdemGespeichertWerden = true; - newResult.Message += "An dem gewählten Datum '" + von + "' existiert bereits ein Eintrag (" + vr.Message + " bei Klient/in " + vr.CustomerName + ").

"; - exitLoop = false; - } - else - { - newResult.Message += "An dem gewählten Datum '" + von + "' existiert bereits ein Eintrag (" + vr.Message + " bei Klient/in " + vr.CustomerName + ").

"; - exitLoop = true; - newResult.KannTrotzdemGespeichertWerden = false; - } + newResult.Message += "An dem gewählten Datum '" + von + "' existiert bereits ein Eintrag (" + vr.Message + " bei Klient/in " + vr.CustomerName + ").

"; + newResult.KannTrotzdemGespeichertWerden = allowOverlappingFLS; + + exitLoop = !allowOverlappingFLS; + break; case EmployeeOverlapping: - if (allowOverlappingFLSForEmployee) - { - newResult.Message += "An dem gewählten Datum " + von + " existiert bereits ein Eintrag von " + vr.EmployeeName + " (" + vr.Message + ").

"; - exitLoop = false; - newResult.KannTrotzdemGespeichertWerden = true; - } - else - { - newResult.Message += "An dem gewählten Datum " + von + " existiert bereits ein Eintrag von " + vr.EmployeeName + " (" + vr.Message + ").

"; + newResult.Message += "An dem gewählten Datum " + von + " existiert bereits ein Eintrag von " + vr.EmployeeName + " (" + vr.Message + ").

"; + newResult.KannTrotzdemGespeichertWerden = allowOverlappingFLSForEmployee; + exitLoop = !allowOverlappingFLSForEmployee; + - exitLoop = true; - newResult.KannTrotzdemGespeichertWerden = false; - } break; case OutsideOfSupportConcept: newResult.Message += "Das gewählte Datum " + von.Substring(0, 10) + " liegt außerhalb des Zeitraumes des gewählten Hilfeplans (" + sr2v.HilfePlanZeitraum + ").

"; - newResult.KannTrotzdemGespeichertWerden = false; + exitLoop = true; + break; case ApprovedFLSOverspending: var klient = "diesen Hilfeplan"; @@ -2155,19 +2151,12 @@ namespace BeWoPlanerMobil.Controllers } var msg = "Die für " + klient + " genehmigten FLS (" + vr.ApprovedHours + ") werden mit diesem Eintrag überschritten. (" + vr.HoursNew + ")."; - if (allowMoreFLSThanApproved) - { - newResult.Message += msg + "

"; - exitLoop = false; - newResult.KannTrotzdemGespeichertWerden = true; - } - else - { - newResult.Message += msg + "

"; - exitLoop = true; - newResult.KannTrotzdemGespeichertWerden = false; - } + + newResult.Message += msg + "

"; + newResult.KannTrotzdemGespeichertWerden = allowMoreFLSThanApproved; + exitLoop = !allowMoreFLSThanApproved; + break; case OutOfEditLimit: newResult.Message += "Sie können keine neuen Leistungen für den " + von + " dokumentieren, da bereits der " + maxDaysEditSRsAllowed + ". des nachfolgenden Monats überschritten ist.

"; @@ -2188,17 +2177,16 @@ namespace BeWoPlanerMobil.Controllers klient2 = "Klient/in " + vr.CustomerName; } + newResult.KannTrotzdemGespeichertWerden = bookAfterSettlementInvoice; + exitLoop = !bookAfterSettlementInvoice; + if (bookAfterSettlementInvoice) { newResult.Message += "Es existiert bereits eine Spitzabrechnung für " + klient2 + ". Um diesen Eintrag zu berücksichtigen, muss eventuell eine neue Spitzabrechnung erstellt werden.

"; - exitLoop = false; - newResult.KannTrotzdemGespeichertWerden = true; } else { newResult.Message += "Sie können den Eintrag nicht bearbeiten, da bereits eine Spitzabrechnung für " + klient2 + "

"; - exitLoop = true; - newResult.KannTrotzdemGespeichertWerden = false; } break; @@ -2439,6 +2427,7 @@ namespace BeWoPlanerMobil.Controllers return _LeerzeichenFuerGetMethoden; } + // Gruppenbuchungen [HttpPost] [Authorize] public ActionResult SetGroupBookingMode(FormCollection pFormCollection) @@ -2480,6 +2469,7 @@ namespace BeWoPlanerMobil.Controllers Model.SelectedCostbearerRelOids.Clear(); Model.SelectedEmployees.Clear(); Model.SelectedSupportConcepts.Clear(); + Model.SelectedConceptCostBearerRelations.Clear(); Model.SelectedEmployee = MobileSessionFacade.LoggedInCompactEmployee; @@ -2540,63 +2530,53 @@ namespace BeWoPlanerMobil.Controllers } [Authorize] - [HttpPost] - public ActionResult AddEmployeesToGroupBooking(FormCollection pFormCollection) + public string ResetGroupBookingModeViaGET() { if (Model == null) { - return RedirectToActionPermanent("Index", "Login"); + RedirectToActionPermanent("Index", "Login"); + return _LeerzeichenFuerGetMethoden; } - var oids = new List(); - - var keys = pFormCollection.Keys; - foreach (var key in keys) - { - if (key.ToString().Contains("employee_")) - { - oids.AddIfNotIn(long.Parse(pFormCollection[key.ToString()])); - } - } - - var employees = Model.Employees.Where(w => oids.Contains(w.EmployeeOid)); - + Model.IsInGroupBookingMode = false; + Model.SelectedCostbearerRelOids.Clear(); Model.SelectedEmployees.Clear(); - Model.SelectedEmployees.AddRangeIfElementsNotIn(employees); + Model.SelectedSupportConcepts.Clear(); + Model.SelectedConceptCostBearerRelations.Clear(); - return RedirectToAction("Main"); + return MainModel.IsEmployeeSelectionVisible.ToString(); } [Authorize] - [HttpPost] - public ActionResult AddSupportConceptsToGroupBooking(FormCollection pFormCollection) + public string AddSupportConceptCostBearerRelationsToGroupBooking(string pRelOids, string pGroupOids) { - if (Model == null) + if(Model == null) { - return RedirectToActionPermanent("Index", "Login"); + RedirectToActionPermanent("Index", "Login"); + return _LeerzeichenFuerGetMethoden; } + var rawRelOids = string.IsNullOrEmpty(pRelOids) ? new string[0] : pRelOids.Split(','); + var rawGroupOids = string.IsNullOrEmpty(pGroupOids) ? new string[0] : pGroupOids.Split(','); + var relOids = new List(); var groups = new List(); + rawRelOids.DoForEach(s => relOids.AddIfNotIn(long.Parse(s))); + Model.SelectedGroupOfPeopleOids.Clear(); - var keys = pFormCollection.Keys; - foreach (var key in keys) + rawGroupOids.DoForEach(s => { - if (key.ToString().Contains("costbearer2supportconcept_")) + var group = Model.GroupsOfPeople.FirstOrDefault(f => f.GroupOfPeopleOid.HasValue && f.GroupOfPeopleOid.Value.Equals(long.Parse(s))); + if(group == null) { - relOids.AddIfNotIn(long.Parse(pFormCollection[key.ToString()])); + return; } - else if (key.ToString().Contains("group_")) - { - var group = Model.GroupsOfPeople.FirstOrDefault(f => f.GroupOfPeopleOid.HasValue && f.GroupOfPeopleOid.Value.Equals(long.Parse(pFormCollection[key.ToString()]))); - - groups.AddIfNotIn(group); - - group?.SupportConceptList.DoForEach(f => relOids.AddRangeIfElementsNotIn(f.CostBearerRelOids)); - } - } + + groups.AddIfNotIn(group); + group.SupportConceptList.DoForEach(f => relOids.AddRangeIfElementsNotIn(f.CostBearerRelOids)); + }); Model.SelectedSupportConcepts.Clear(); @@ -2605,6 +2585,11 @@ namespace BeWoPlanerMobil.Controllers var selectedSupportConcepts = Model.SupportConcepts.Where(w => w != null && w.CostBearerRelations.Any(a => a.CostBearer2SupportConceptOid.HasValue && relOids.Contains(a.CostBearer2SupportConceptOid.Value))).ToList(); + var groupCostBearerRelations = CustomerService.GetSupportConceptCostBearerRelationsById(relOids); + + Model.SelectedConceptCostBearerRelations.Clear(); + Model.SelectedConceptCostBearerRelations.AddRangeIfElementsNotIn(groupCostBearerRelations); + Model.SelectedSupportConcepts.AddRangeIfElementsNotIn(selectedSupportConcepts); foreach (var gruppe in groups.Where(g => g.GroupOfPeopleOid.HasValue)) @@ -2629,24 +2614,56 @@ namespace BeWoPlanerMobil.Controllers } } - return RedirectToAction("Main"); + return SerializeObject(Model.SelectedRelations.ToArray()); } [Authorize] - public string ResetGroupBookingModeViaGET() + public string RemoveSupportConceptCostBearerRelationFromGroupBooking(string pRelOid) { - if (Model == null) + if(Model == null) { RedirectToActionPermanent("Index", "Login"); return _LeerzeichenFuerGetMethoden; } - Model.IsInGroupBookingMode = false; - Model.SelectedCostbearerRelOids.Clear(); - Model.SelectedEmployees.Clear(); - Model.SelectedSupportConcepts.Clear(); + long.TryParse(pRelOid, out var supportConceptCostBearerRelationOid); - return MainModel.IsEmployeeSelectionVisible.ToString(); + var supportConcept = Model.SelectedSupportConcepts.FirstOrDefault(f => f.CostBearerRelations.Any(a => a.CostBearer2SupportConceptOid == supportConceptCostBearerRelationOid)); + + var relation = Model.SelectedConceptCostBearerRelations.FirstOrDefault(f => f.CostBearer2SupportConceptOid == supportConceptCostBearerRelationOid); + + Model.SelectedSupportConcepts.Remove(supportConcept); + Model.SelectedConceptCostBearerRelations.Remove(relation); + + return _LeerzeichenFuerGetMethoden; + } + + [Authorize] + public string AddEmployeesToGroupBooking(string pEmployeeOids) + { + if(Model == null) + { + RedirectToActionPermanent("Index", "Login"); + return _LeerzeichenFuerGetMethoden; + } + + if(string.IsNullOrEmpty(pEmployeeOids)) + { + Model.SelectedEmployees.Clear(); + return _LeerzeichenFuerGetMethoden; + } + + var rawEmployeeOids = pEmployeeOids.Split(','); + var oids = new List(); + + rawEmployeeOids.DoForEach(s => oids.AddIfNotIn(long.Parse(s))); + + var employees = Model.Employees.Where(w => oids.Contains(w.EmployeeOid)); + + Model.SelectedEmployees.Clear(); + Model.SelectedEmployees.AddRangeIfElementsNotIn(employees); + + return _LeerzeichenFuerGetMethoden; } } } diff --git a/BeWoPlanerMobil/Models/MainModel.cs b/BeWoPlanerMobil/Models/MainModel.cs index da1d6b7b6..d6735cdcc 100644 --- a/BeWoPlanerMobil/Models/MainModel.cs +++ b/BeWoPlanerMobil/Models/MainModel.cs @@ -25,7 +25,7 @@ namespace BeWoPlanerMobil.Models public long? CostBearer2SupportConceptOid { get; set; } [Display(Name = "Kategorie")] - public long? SelectedServiceCategoryConceptOid { get; set; } + public long? SelectedServiceCategoryOid { get; set; } public long? SelectedServiceDescriptionOid { get; set; } @@ -84,8 +84,9 @@ namespace BeWoPlanerMobil.Models public static bool IsAllowedToCreateOrEditRecord { - get { return MobileSessionFacade.LoggedInUser.UserGroups.Any(a => a.Rights.Any(f => f.RightType.Equals(UserRightType.ServiceRecordView_Create))) || - MobileSessionFacade.LoggedInUser.UserGroups.Any(a => a.Rights.Any(f => f.RightType.Equals(UserRightType.ServiceRecordView_Edit))); + get { + return MobileSessionFacade.LoggedInUser.UserGroups.Any(a => a.Rights.Any(f => f.RightType.Equals(UserRightType.ServiceRecordView_Create))) || + MobileSessionFacade.LoggedInUser.UserGroups.Any(a => a.Rights.Any(f => f.RightType.Equals(UserRightType.ServiceRecordView_Edit))); } } @@ -134,6 +135,39 @@ namespace BeWoPlanerMobil.Models } } + public List SelectedConceptCostBearerRelations { get; set; } + + public IEnumerable SelectedRelations + { + get + { + var result = new List(); + + foreach(var rel in SelectedConceptCostBearerRelations) + { + + var text1 = $"{rel.SupportConcept.Customer.LastNameFirstName}"; + var text2 = $"{rel.StartDate?.ToShortDateString() ?? string.Empty} - {rel.EndDate?.ToShortDateString()} {rel.CostBearer.Name}"; + var value = rel.CostBearer2SupportConceptOid.ToString(); + var textColor = "#555555"; + if(rel.EndDate.HasValue) + { + var isExpired = DateTime.Now > rel.EndDate.Value; + if(isExpired) + { + textColor = "#FF0000"; + } + } + + var listItem = new CustomSelectListItem(text1, text2, value, textColor); + + result.Add(listItem); + } + + return result; + } + } + public IEnumerable SupporConceptListItemsForGroupBooking { get @@ -167,14 +201,7 @@ namespace BeWoPlanerMobil.Models { get { - var result = new List(); - - foreach(var group in GroupsOfPeople) - { - result.Add(new SelectListItem { Value = $"{group.GroupOfPeopleOid.Value}", Text = group.Name }); - } - - return result; + return GroupsOfPeople.Select(group => new SelectListItem {Value = $"{group.GroupOfPeopleOid.Value}", Text = group.Name}).ToList(); } } @@ -251,7 +278,6 @@ namespace BeWoPlanerMobil.Models public bool IsInGroupBookingMode { get => _IsInGroupBookingMode; - //get => false; set { @@ -286,5 +312,38 @@ namespace BeWoPlanerMobil.Models public bool IsServiceRecordNoticeMandatory { get; set; } = true; + public List SelectedSupportConceptListItems + { + get + { + var allCostBearerRelations = new List(); + foreach (var sc in SelectedSupportConcepts.OrderBy(sc => sc.Customer.LastName)) + { + allCostBearerRelations.AddRangeIfElementsNotIn(sc.CostBearerRelations.Select(cb => new SelectListItem + { + Value = cb.CostBearer2SupportConceptOid.ToString(), + Text = $"{sc.Customer.LastNameFirstName} | {cb.StartDate?.ToShortDateString().Remove(6, 2) ?? string.Empty}-{cb.EndDate?.ToShortDateString().Remove(6, 2) ?? string.Empty} {cb.CostBearer.Name}" + })); + } + + return allCostBearerRelations; + } + } } + + public class CustomSelectListItem + { + public string Text1 { get; set; } + public string Text2 { get; set; } + public string Value { get; set; } + public string TextColor { get; set; } + + public CustomSelectListItem(string pText1, string pText2, string pValue, string pTextColor) + { + Text1 = pText1; + Text2 = pText2; + Value = pValue; + TextColor = pTextColor; + } + } } \ No newline at end of file diff --git a/BeWoPlanerMobil/Models/ServiceCategoryModel.cs b/BeWoPlanerMobil/Models/ServiceCategoryModel.cs index 0967004a2..bea83e777 100644 --- a/BeWoPlanerMobil/Models/ServiceCategoryModel.cs +++ b/BeWoPlanerMobil/Models/ServiceCategoryModel.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; + using BS.Shared; using BS.Shared.DataContracts; @@ -17,7 +18,6 @@ namespace BeWoPlanerMobil.Models public int Position { get; set; } public AccountingvisibilityType? OhneHilfeplan { get; set; } - public List ServiceDescriptions { get; set; } } diff --git a/BeWoPlanerMobil/Scripts/dateHelper.js b/BeWoPlanerMobil/Scripts/dateHelper.js index 455c51fe2..dec70b302 100644 --- a/BeWoPlanerMobil/Scripts/dateHelper.js +++ b/BeWoPlanerMobil/Scripts/dateHelper.js @@ -152,9 +152,6 @@ function getHoursAndMinutesWithLeadingZeros(pDate) { var hours = pDate.getHours(); var minutes = pDate.getMinutes(); - //var hoursString = hours < 10 ? `0${hours.toString()}` : hours.toString(); - //var minutesString = minutes < 10 ? `0${minutes.toString()}` : minutes.toString(); - var hoursString = hours < 10 ? '0' + hours.toString() : hours.toString(); var minutesString = minutes < 10 ? '0' + minutes.toString() : minutes.toString(); @@ -211,7 +208,6 @@ function endDateVisibleEh() { } function calcDurationByStartEnd() { - //console.log(`is end date visible: ${endDateVisibleEh()}`); console.log('is end date visible: ' + endDateVisibleEh()); if($("#enddatum_textbox").val() === $("#datum_textbox").val() || $("#enddatum_textbox").val() === "") { diff --git a/BeWoPlanerMobil/Scripts/gruppenbuchung.js b/BeWoPlanerMobil/Scripts/gruppenbuchung.js index 4d25e396d..9d2f5cb6c 100644 --- a/BeWoPlanerMobil/Scripts/gruppenbuchung.js +++ b/BeWoPlanerMobil/Scripts/gruppenbuchung.js @@ -16,11 +16,7 @@ function isInEditingMode() { var flagData = {}; function setGroupEditingFlag(flag) { - var obj = { - flag: flag - }; - - flagData.obj = obj; + flagData.obj = {flag: flag}; localStorage.flagData = JSON.stringify(flagData); } @@ -113,9 +109,7 @@ function openGroupBookingTab(isSupportConceptTab) { function addSupportConcepts() { hideGroupBookingPopup(); - showSanduhr(); - - $("#groupBookingSupportConceptSelectionForm").submit(); + addSupportConceptsViaGet(); } @@ -172,7 +166,123 @@ function hideEmployeePopup() { function addEmployees() { hideEmployeePopup(); - showSanduhr(); - - $("#groupBookingEmployeeSelectionForm").submit(); + addEmployeesViaGet(); } + +function addEmployeesViaGet() { + var checkedEmployees = []; + + $("#groupBookingEmployeeTable input:checked").each(function() { + checkedEmployees.push($(this).attr("value")); + }); + + var oidString = ""; + for(var i = 0; i < checkedEmployees.length; i++) { + oidString += checkedEmployees[i]; + + if(i < checkedEmployees.length - 1) { + oidString += ","; + } + } + + makeAjaxCall("GET", window.addEmployeesToGroupBookingUrl, null, { pEmployeeOids: oidString}, null); +} + +function addSupportConceptsViaGet() { + var selectedGroups = []; + var selectedSupportConcepts = []; + + var scOidString = ""; + var groupOidString = ""; + + $("#leftContent input:checked").each(function () { + selectedSupportConcepts.push($(this).attr("value")); + }); + + for (var i = 0; i < selectedSupportConcepts.length; i++) { + scOidString += selectedSupportConcepts[i]; + + if (i < selectedSupportConcepts.length - 1) { + scOidString += ","; + } + } + + $("#rightContent input:checked").each(function () { + selectedGroups.push($(this).attr("value")); + }); + + for (var j = 0; j < selectedGroups.length; j++) { + groupOidString += selectedGroups[j]; + + if (j < selectedGroups.length - 1) { + groupOidString += ","; + } + } + + makeAjaxCall("GET", window.addSupportConceptCostBearerRelationsToGroupBookingUrl, addSupportConceptsToTable, { pRelOids: scOidString, pGroupOids: groupOidString }, null); +} + +function removeSupportConceptViaGet(pRelOid) { + $("#groupSelectionRow_" + pRelOid).remove(); + + if($("#costbearer2supportconcept_" + pRelOid).length) { + $("#costbearer2supportconcept_" + pRelOid).prop("checked", false); + } + + if($("#groupBookingSelectionTable tr").length === 0) { + deactivateInputFormCompletely(); + + $("#rightContent input:checked").each(function () { + $(this).prop("checked", false); + }); + } + + makeAjaxCall("GET", window.removeSupportConceptCostBearerRelationFromGroupBookingUrl, null, { pRelOid: pRelOid}, null); +} + +function addSupportConceptsToTable(result) { + if (isEmptyOrSpaces(result)) { + window.location.href = window.redirectLink; + return; + } + + if (result === "SessionTimeout") { + window.location.href = redirectLink; + return; + } + + var list = $.parseJSON(result); + + var tableRows = ""; + + $.each(list, + function (index, customListItem) { + var style = ""; + if(list.length - 1 === index) { + style = "border-bottom: none;"; + } + + tableRows += ""; + + tableRows += ""; + tableRows += "

" + customListItem.Text1 + "

"; + tableRows += "
"; + tableRows += "

" + customListItem.Text2 + "

"; + tableRows += ""; + tableRows += ""; + + tableRows += ""; + tableRows += ""; + tableRows += ""; + + tableRows += ""; + }); + + if(!isEmptyOrSpaces(tableRows)) { + activateInputForm(window.loadGoalsUrl, true); + } else { + deactivateInputFormCompletely(); + } + + $("#groupBookingSelectionTable").empty().append(tableRows); +} \ No newline at end of file diff --git a/BeWoPlanerMobil/Scripts/initialization.js b/BeWoPlanerMobil/Scripts/initialization.js index ae0d33155..63db0632e 100644 --- a/BeWoPlanerMobil/Scripts/initialization.js +++ b/BeWoPlanerMobil/Scripts/initialization.js @@ -71,7 +71,7 @@ var scaleFactor = .8; $(window).resize(function() { var documentWidth = $(document).width(); - if(canvasWidth !== (documentWidth * scaleFactor) && $("#sketchpad").css("display") === "inline") { + if(canvasWidth !== documentWidth * scaleFactor && $("#sketchpad").css("display") === "inline") { $("#sketchpad").prop("width", documentWidth * scaleFactor); } }); @@ -79,12 +79,47 @@ $(window).resize(function() { function initBeWoMobile(actionPath) { try { var selectedServiceCategory = $("#scDropDown").find(":selected").val(); + var shouldLoadServiceDescriptions = true; - if(isInGroupBookingMode() && isInEditingMode()) { - if(getGroupEditingFlag().flag === false) { + if (isInGroupBookingMode() && isInEditingMode()) { + if (getGroupEditingFlag().flag === false) { loadSavedValuesIntoForm(); } else { - saveFormValuesLocally(); + var serviceCategoryOid = $("#selectedServiceCategoryOidHolder").val(); + var serviceDescriptionOid = $("#selectedServiceDescriptionOidHolder").val(); + + shouldLoadServiceDescriptions = false; + + showSanduhr(); + makeAjaxCall("GET", window.loadServiceCategoriesUrl, function (result) { + if (isEmptyOrSpaces(result)) { + window.location.href = window.redirectLink; + return; + } + + if (result === "SessionTimeout") { + window.location.href = redirectLink; + return; + } + + $("#kategorien_select").val(serviceCategoryOid); + + var liste = $.parseJSON(result); + $("#leistungen_select").empty(); + $("#leistungen_select").val(""); + + $.each(liste, function (index, leistung) { + $("#leistungen_select").append(''); + }); + + $("#leistungen_select").val(serviceDescriptionOid); + + makeAjaxCall("GET", window.setServiceDescriptionUrl, function () { + hideSanduhr(); + + saveFormValuesLocally(); + }, { pServiceDescriptionOid: serviceDescriptionOid }, null); + }, { pServiceCategoryOid: serviceCategoryOid }, null); } setGroupEditingFlag(false); @@ -93,43 +128,9 @@ function initBeWoMobile(actionPath) { var shouldActivateForm = isInGroupBookingMode() ? $("#leftContent input:checked").length > 0 : selectedServiceCategory !== "-1"; if (shouldActivateForm) { - $("#recordLoader_select").prop("disabled", false); - activateInput("#record-loader-select-container"); - - $("#kategorien_select").prop("disabled", false); - activateInput("#kategorien-select-container"); - - $("#leistungen_select").prop("disabled", false); - activateInput("#leistungen-select-container"); - - $("#textbausteine_select").prop("disabled", false); - activateInput("#textbausteine-select-container"); - - activateInput("#employee-select-container"); - - $("#statistik-button").prop("disabled", false); - $("#statistik-button").css("background-image", "url('../Content/images/statistik-orange.svg')"); - - activateForm(actionPath); - - if (!isInEditingMode()) { - $("#datum_textbox").val(getDateStringWithLeadingZeros(new Date())); - } + activateInputForm(actionPath, shouldLoadServiceDescriptions); } else { - $("#statistik-button").prop("disabled", true); - $("#statistik-button").css("background-image", "url('../Content/images/statistik-disabled.svg')"); - - $("#recordLoader_select").prop("disabled", true); - disableInput("#record-loader-select-container"); - - $("#kategorien_select").prop("disabled", true); - disableInput("#kategorien-select-container"); - - $("#leistungen_select").prop("disabled", true); - disableInput("#leistungen-select-container"); - - $("#textbausteine_select").prop("disabled", true); - disableInput("#textbausteine-select-container"); + deactivateInputForm(); } $(".not-required-input").on("click blur change focus", @@ -190,56 +191,6 @@ function initBeWoMobile(actionPath) { } } -function toggleSelectClassesForElement(elementIdentifier, parentElement) { - var enabled = $(elementIdentifier).prop("disabled") === "false"; - - if(enabled) { - $(parentElement).removeClass("disabled-select-container"); - $(parentElement).addClass("styled-select-div"); - } else { - $(parentElement).removeClass("styled-select-div"); - $(parentElement).addClass("disabled-select-container"); - } -} - -function activateInput(parentElement) { - $(parentElement).removeClass("disabled-select-container"); - $(parentElement).addClass("styled-select-div"); -} - -function disableInput(parentElement) { - $(parentElement).removeClass("styled-select-div"); - $(parentElement).addClass("disabled-select-container"); -} - -function toggleErrorPopup2(errorMessage) { - var isDisplayNone = $("#errorPopupDiv2").css("display") === "none"; - var displayValue = isDisplayNone ? "block" : "none"; - - $("#errorPopupDiv2").css("display", displayValue); - $(".modalWrapper").css("display", displayValue); - $(".modalWrapper").css("height", $(document).height()); - - if(isDisplayNone) { - $("#errorPopupText2").text(errorMessage); - - var h = 0; - var t = $("#errorPopupTitle2").outerHeight(); - var u = $("#errorPopupText2").outerHeight(); - var v = $("#errorPopupBtnDiv2").outerHeight(); - var w = $("#errorPopupOkBtn2").outerHeight(); - - h += t + u + v + w + w; - - $("#errorPopupDiv2").css("height", h + "px"); - - $("#errorPopupDiv2").css("top", window.pageYOffset + window.innerHeight / 2 - h / 2); - $("#errorPopupDiv2").css("margin-top", "0"); - } else { - $("#errorPopupDiv2").css("margin-top", "auto"); - } -} - function logoutSettingsAccordingToBWP(timeoutTime) { if(timeoutTime > 0) { timeoutTime = timeoutTime * 1000 * 60; @@ -300,7 +251,7 @@ function initializeDocumentationTextareas() { if (numberOfDocumentationTypes === 1) { $("#tddokureiter").hide(); $("#trnormalDoku").css("display", "table-row"); - $("#trnormalDokuLabel").text(dokuTypes[0].TypeDescription); + $("#trnormalDokuLabel").val(dokuTypes[0].TypeDescription); } if (numberOfDocumentationTypes > 1) { @@ -311,7 +262,7 @@ function initializeDocumentationTextareas() { var dokuTab = $("#doku-name-" + idNumber); - dokuTab.html(dokuTypes[i].TypeDescription); + dokuTab.val(dokuTypes[i].TypeDescription); dokuTab.show(); var outerHeight = dokuTab.outerHeight(); @@ -343,8 +294,6 @@ $(document).on("change", ".edit-form-input", }); function saveFormValuesLocally() { - console.log("Speichere Eingaben als Objekt im Browser..."); - var recordObject = { category: $("#kategorien_select").val(), serviceDescription: $("#leistungen_select").val(), @@ -390,10 +339,6 @@ function loadSavedValuesIntoForm() { $("#kategorien_select").val(values.category); } - if(values.serviceDescription !== "undefined") { - $("#leistungen_select").val(values.serviceDescription); - } - if(values.startDate !== "undefined") { $("#datum_textbox").val(values.startDate); } @@ -441,4 +386,8 @@ function loadSavedValuesIntoForm() { if(values.notice5 !== "undefined") { $("#notiz_textbox5").val(values.notice5); } + + if (values.serviceDescription !== "undefined") { + $("#leistungen_select").val(values.serviceDescription); + } } diff --git a/BeWoPlanerMobil/Scripts/mainView.js b/BeWoPlanerMobil/Scripts/mainView.js index cc569ce47..5c4b7c997 100644 --- a/BeWoPlanerMobil/Scripts/mainView.js +++ b/BeWoPlanerMobil/Scripts/mainView.js @@ -139,13 +139,12 @@ function toggleMenu() { } function loadServiceDescriptions() { - var selectedCategory = $("#kategorien_select").find(":selected").val(); if (selectedCategory === null || selectedCategory === undefined) { return; } - + makeAjaxCall("GET", window.loadServiceCategoriesUrl, loadServiceDescriptionsOnSuccess, { pServiceCategoryOid: selectedCategory }, null); loadTextbausteineForServiceCategory(selectedCategory); @@ -362,7 +361,7 @@ function selectServiceRecord(oid) { }); } -function activateForm(actionPath) { +function activateForm(actionPath, shouldLoadServiceDescriptions) { $("input").prop("disabled", false); $("textarea").prop("disabled", false); $(".doku-tab-link").prop("disabled", false); @@ -377,7 +376,9 @@ function activateForm(actionPath) { $("#kategorien_select").val($("#kategorien_select option").eq(0).val()); - loadServiceDescriptions(); + if(shouldLoadServiceDescriptions) { + loadServiceDescriptions(); + } } function resetRecordForm() { @@ -460,11 +461,7 @@ $(document).mouseup(function(e) { function saveCreateServicerecod() { showSanduhr(); - //if (validateTimeField("#start_textbox") && validateTimeField("#ende_textbox")) { - validateServiceRecordBeforeSubmit(); - //} else { -// hideSanduhr(); -// } + validateServiceRecordBeforeSubmit(); } function validateTimeField(id) { @@ -677,10 +674,10 @@ function initAppointmentEditForm() { currTime.setMinutes(currTime.getMinutes() + j); } - $("#AppointmentEditForm").show();//css("display", "block"); - $("#KalenderTable").hide();//css("display", "none"); - $("#KalenderNavigation").hide();//css("display", "none"); - $("#KalenderTableTask").hide();//css("display", "none"); + $("#AppointmentEditForm").show(); + $("#KalenderTable").hide(); + $("#KalenderNavigation").hide(); + $("#KalenderTableTask").hide(); $("#StartDate").val($("#KalenderDatumFormat").val()); $("#EndDate").val($("#KalenderDatumFormat").val()); $("#TerminStartZeit").val(getHoursAndMinutesWithLeadingZeros(currTime)); @@ -698,7 +695,7 @@ function initAppointmentEditForm() { $("#TerminSpeichern").val("Speichern"); $("#TerminSpeichernAbbrechen").val("Abbrechen"); - $("#TerminSpeichern").hide();//css("display", "none"); + $("#TerminSpeichern").hide(); $("#InsertAppointmentButton").css("display", "inline"); } @@ -1305,7 +1302,7 @@ function focusOnDoku(number) { var c = window.numberOfDocumentationTypes; for (var e = 0; e < window.numberOfDocumentationTypes; e++) { - if ((e > f || e < (f - 1)) && e < (c - 1)) { + if ((e > f || e < f - 1) && e < c - 1) { $("#doku-name-" + (e + 1)).css("border-right", "1px solid #bbbbbb"); } } diff --git a/BeWoPlanerMobil/Scripts/utils.js b/BeWoPlanerMobil/Scripts/utils.js index 98e909b2d..c4acb50ad 100644 --- a/BeWoPlanerMobil/Scripts/utils.js +++ b/BeWoPlanerMobil/Scripts/utils.js @@ -55,7 +55,7 @@ function adjustLabel(inputId) { } function isInEditingMode() { - return $("#isInEditModeIndicator").val() == "true"; + return $("#isInEditModeIndicator").val() === "true"; } function isElementInArray(array, element) { @@ -78,4 +78,132 @@ function isElementInArray(array, element) { function isEmptyOrSpaces(str) { return str === null || str === undefined || str.match(/^ *$/) !== null; +} + +function toggleSelectClassesForElement(elementIdentifier, parentElement) { + var enabled = $(elementIdentifier).prop("disabled") === "false"; + + if (enabled) { + $(parentElement).removeClass("disabled-select-container"); + $(parentElement).addClass("styled-select-div"); + } else { + $(parentElement).removeClass("styled-select-div"); + $(parentElement).addClass("disabled-select-container"); + } +} + +function activateInput(parentElement) { + $(parentElement).removeClass("disabled-select-container"); + $(parentElement).addClass("styled-select-div"); +} + +function disableInput(parentElement) { + $(parentElement).removeClass("styled-select-div"); + $(parentElement).addClass("disabled-select-container"); +} + +function toggleErrorPopup2(errorMessage) { + var isDisplayNone = $("#errorPopupDiv2").css("display") === "none"; + var displayValue = isDisplayNone ? "block" : "none"; + + $("#errorPopupDiv2").css("display", displayValue); + $(".modalWrapper").css("display", displayValue); + $(".modalWrapper").css("height", $(document).height()); + + if (isDisplayNone) { + $("#errorPopupText2").text(errorMessage); + + var h = 0; + var t = $("#errorPopupTitle2").outerHeight(); + var u = $("#errorPopupText2").outerHeight(); + var v = $("#errorPopupBtnDiv2").outerHeight(); + var w = $("#errorPopupOkBtn2").outerHeight(); + + h += t + u + v + w + w; + + $("#errorPopupDiv2").css("height", h + "px"); + + $("#errorPopupDiv2").css("top", window.pageYOffset + window.innerHeight / 2 - h / 2); + $("#errorPopupDiv2").css("margin-top", "0"); + } else { + $("#errorPopupDiv2").css("margin-top", "auto"); + } +} + +function disableElement(pElement) { + pElement.prop("disabled", true); +} + +function enableElement(pElement) { + pElement.prop("disabled", false); +} + +function deactivateInputForm() { + $("#statistik-button").prop("disabled", true); + $("#statistik-button").css("background-image", "url('../Content/images/statistik-disabled.svg')"); + + $("#recordLoader_select").prop("disabled", true); + disableInput("#record-loader-select-container"); + + $("#kategorien_select").prop("disabled", true); + disableInput("#kategorien-select-container"); + + $("#leistungen_select").prop("disabled", true); + disableInput("#leistungen-select-container"); + + $("#textbausteine_select").prop("disabled", true); + disableInput("#textbausteine-select-container"); +} + +function activateInputForm(actionPath, shouldLoadServiceDescriptions) { + enableElement($("#recordLoader_select")); + activateInput("#record-loader-select-container"); + + $("#kategorien_select").prop("disabled", false); + activateInput("#kategorien-select-container"); + + $("#leistungen_select").prop("disabled", false); + activateInput("#leistungen-select-container"); + + $("#textbausteine_select").prop("disabled", false); + activateInput("#textbausteine-select-container"); + + activateInput("#employee-select-container"); + + $("#statistik-button").prop("disabled", false); + $("#statistik-button").css("background-image", "url('../Content/images/statistik-orange.svg')"); + + activateForm(actionPath, shouldLoadServiceDescriptions); + + if (!isInEditingMode()) { + $("#datum_textbox").val(getDateStringWithLeadingZeros(new Date())); + } +} + +function deactivateInputFormCompletely() { + deactivateInputForm(); + + disableElement($("#datum_textbox")); + disableElement($("#start_textbox")); + disableElement($("#ende_textbox")); + disableElement($("#duration_textbox")); + disableElement($("#distance_textbox")); + + disableElement($("#kollabier-btn2")); + + disableElement($("#doku-name-1")); + disableElement($("#doku-name-2")); + disableElement($("#doku-name-3")); + disableElement($("#doku-name-4")); + disableElement($("#doku-name-5")); + disableElement($("#notiz_textbox")); + disableElement($("#notiz_textbox1")); + disableElement($("#notiz_textbox2")); + disableElement($("#notiz_textbox3")); + disableElement($("#notiz_textbox4")); + disableElement($("#notiz_textbox5")); + + + disableElement($("#abbrechenBtn")); + disableElement($("#anlegenEditierenBtn")); } \ No newline at end of file diff --git a/BeWoPlanerMobil/Util/MobileUtils.cs b/BeWoPlanerMobil/Util/MobileUtils.cs index 62a8a67f6..c042f7b84 100644 --- a/BeWoPlanerMobil/Util/MobileUtils.cs +++ b/BeWoPlanerMobil/Util/MobileUtils.cs @@ -2,14 +2,16 @@ using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; + using BeWoPlanerMobil.Models; + using BS.Shared.Core; using BS.Shared.DataContracts; using BS.Shared.DataContracts.Compact; using BS.Shared.Extensions; using DevExpress.XtraScheduler; -using DevExpress.XtraScheduler.UI; + using Newtonsoft.Json; using static System.Int32; @@ -335,41 +337,41 @@ namespace BeWoPlanerMobil.Util var clone = new ServiceRecordDC { - CostBearer = m.CostBearer, + CostBearer = m.CostBearer, CostBearer2SupportConceptOid = m.CostBearer2SupportConceptOid, - Customer = m.Customer, - Employee = m.Employee, - End = m.End, - Goals = m.Goals, - GroupEmployeeCount = m.GroupEmployeeCount, - GroupOid = m.GroupOid, - SignatureOid = m.SignatureOid, - GroupPersonCount = m.GroupPersonCount, - GroupRoundedDuration = m.GroupRoundedDuration, - InsUser = m.InsUser, - InsertedOn = m.InsertedOn, - Notice = m.Notice, - Notice2 = m.Notice2, - Notice3 = m.Notice3, - Notice4 = m.Notice4, - Notice5 = m.Notice5, - RTFNotice1 = m.RTFNotice1, - RTFNotice2 = m.RTFNotice2, - RTFNotice3 = m.RTFNotice3, - RTFNotice4 = m.RTFNotice4, - RTFNotice5 = m.RTFNotice5, - RoundedDuration = m.RoundedDuration, - ServiceDescription = m.ServiceDescription, - Start = m.Start, - SupportConcept = m.SupportConcept, - ServiceRecordType = m.ServiceRecordType, - DistanceInMeter = m.DistanceInMeter, - IP = m.IP, - Relevance = m.Relevance, - IsCreatedInMobileClient = true, - WohnheimbuchungsOid = m.WohnheimbuchungsOid, - DurationInStunden = m.DurationInStunden, - ServiceRecordFormat = m.ServiceRecordFormat + Customer = m.Customer, + Employee = m.Employee, + End = m.End, + Goals = m.Goals, + GroupEmployeeCount = m.GroupEmployeeCount, + GroupOid = m.GroupOid, + SignatureOid = m.SignatureOid, + GroupPersonCount = m.GroupPersonCount, + GroupRoundedDuration = m.GroupRoundedDuration, + InsUser = m.InsUser, + InsertedOn = m.InsertedOn, + Notice = m.Notice, + Notice2 = m.Notice2, + Notice3 = m.Notice3, + Notice4 = m.Notice4, + Notice5 = m.Notice5, + RTFNotice1 = m.RTFNotice1, + RTFNotice2 = m.RTFNotice2, + RTFNotice3 = m.RTFNotice3, + RTFNotice4 = m.RTFNotice4, + RTFNotice5 = m.RTFNotice5, + RoundedDuration = m.RoundedDuration, + ServiceDescription = m.ServiceDescription, + Start = m.Start, + SupportConcept = m.SupportConcept, + ServiceRecordType = m.ServiceRecordType, + DistanceInMeter = m.DistanceInMeter, + IP = m.IP, + Relevance = m.Relevance, + IsCreatedInMobileClient = true, + WohnheimbuchungsOid = m.WohnheimbuchungsOid, + DurationInStunden = m.DurationInStunden, + ServiceRecordFormat = m.ServiceRecordFormat }; return clone; diff --git a/BeWoPlanerMobil/Views/Main/Main.cshtml b/BeWoPlanerMobil/Views/Main/Main.cshtml index a14ae88b3..7fa80659f 100644 --- a/BeWoPlanerMobil/Views/Main/Main.cshtml +++ b/BeWoPlanerMobil/Views/Main/Main.cshtml @@ -52,7 +52,6 @@ @Html.LabelFor(m => m.ShowExpiredSupportConcepts, new { id = "LabelForShowExpiredSupportConceptsCB" }) } - @* , new { style = "display: none;"} *@ @{ var shouldShowGroupBookingForm = "display: none"; @@ -60,6 +59,13 @@ { shouldShowGroupBookingForm = "display: block"; } + + var groupBookingElementDisplayValue = "display: none"; + + if(Model.IsInGroupBookingMode) + { + groupBookingElementDisplayValue = "display: block"; + } } @using(Html.BeginForm("SetGroupBookingMode", "Main", FormMethod.Post, new { id = "groupBookingForm", style = shouldShowGroupBookingForm })) { @@ -67,16 +73,40 @@ @Html.LabelFor(m => m.IsInGroupBookingMode, new { id = "labelForChangeBookingModeCheckBox" }) } - + + +
+ + @{ var counter = 0; } + @foreach (var x in Model.SelectedRelations) + { + + + + + counter++; + } +
+

@x.Text1

+
+

@x.Text2

+ +
+ +
+
- + @{ var shouldShowSingleBookingElements = "display: block"; @@ -113,6 +143,8 @@
+ + @using(Html.BeginForm("CreateServiceRecord", "Main", FormMethod.Post, new { id = "createSRForm" })) { @@ -128,9 +160,9 @@ @@ -213,11 +245,11 @@ - j++; }
- @Html.LabelFor(m => m.SelectedServiceCategoryConceptOid) + @Html.LabelFor(m => m.SelectedServiceCategoryOid)
- @Html.DropDownListFor(m => m.SelectedServiceCategoryConceptOid, Model.ServiceCategoryListItems, new { onchange = "loadServiceDescriptions();", id = "kategorien_select", required = "required", @class = "dropdownlist-for edit-form-input" }) + @Html.DropDownListFor(m => m.SelectedServiceCategoryOid, Model.ServiceCategoryListItems, new { onchange = "loadServiceDescriptions()", id = "kategorien_select", required = "required", @class = "dropdownlist-for edit-form-input" })
- - - - - + + + + +
@@ -596,24 +628,18 @@
- @using(Html.BeginForm("AddSupportConceptsToGroupBooking", "Main", FormMethod.Post, new { id = "groupBookingSupportConceptSelectionForm" })) - { - var i = 0; - var j = 0;
@foreach(var hp in Model.SupporConceptListItemsForGroupBooking) { - i++; }
- + @hp.Text
@@ -623,18 +649,15 @@ {
- + @gruppe.Text
- } @@ -650,7 +673,7 @@ { - long.Parse(ma.Value).Equals(a.EmployeeOid))) { @Html.Raw("checked=\"checked\"") } /> + a.EmployeeOid == long.Parse(ma.Value))) {@Html.Raw("checked=\"checked\"")} /> @ma.Text @@ -1001,44 +1024,47 @@ - +