From 5ed789035a7ce96ab20b8b31791b010b651ec5e4 Mon Sep 17 00:00:00 2001 From: Lyndon Date: Mon, 8 Oct 2018 12:11:10 +0200 Subject: [PATCH 01/18] =?UTF-8?q?config=20Dateien=20ge=C3=A4ndert?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BeWo/BeWo.csproj | 2 +- Host/Host.csproj.user | 1 + Host/Multitenancy/demo.config | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/BeWo/BeWo.csproj b/BeWo/BeWo.csproj index 54b636677..b04d51fc9 100644 --- a/BeWo/BeWo.csproj +++ b/BeWo/BeWo.csproj @@ -2004,7 +2004,7 @@ - + {8a83c4dc-a0b1-4a51-ae1d-366d7a05b298} ChatController diff --git a/Host/Host.csproj.user b/Host/Host.csproj.user index 8e7e866da..fdd817a24 100644 --- a/Host/Host.csproj.user +++ b/Host/Host.csproj.user @@ -3,6 +3,7 @@ BeWo2.0 true + Debug|Any CPU diff --git a/Host/Multitenancy/demo.config b/Host/Multitenancy/demo.config index 9938abaea..e495d6f53 100644 --- a/Host/Multitenancy/demo.config +++ b/Host/Multitenancy/demo.config @@ -24,7 +24,7 @@ --> - Server=localhost;Password=root;User ID=root;Initial Catalog=sbdtest + Server=localhost;Password=root;User ID=root;Initial Catalog=bewodemo From cc388de5919c915300df487d41fb12fd3eb2e84c Mon Sep 17 00:00:00 2001 From: Lyndon Date: Wed, 10 Oct 2018 16:43:11 +0200 Subject: [PATCH 02/18] =?UTF-8?q?BeWoPlanerMobil:=20=20=20=20=20Das=20Unte?= =?UTF-8?q?rschriftenfeld=20befindet=20sich=20jetzt=20unter=20den=20Button?= =?UTF-8?q?s=20und=20ist=20gr=C3=B6=C3=9Fer.=20Ca.=2080%=20des=20Browserfe?= =?UTF-8?q?nsters.=20=20=20=20=20Der=20Kommentar=20wird=20jetzt=20im=20Kli?= =?UTF-8?q?entenfeld=20angezeigt.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BeWoPlanerAndroid.csproj.user | 1 + BeWoPlanerMobil/BeWoPlanerMobil.csproj | 4 +- BeWoPlanerMobil/BeWoPlanerMobil.csproj.user | 3 +- BeWoPlanerMobil/Content/BeWoMobileStyle.css | 10 +- BeWoPlanerMobil/Controllers/MainController.cs | 7 + BeWoPlanerMobil/Scripts/initialization.js | 18 +++ BeWoPlanerMobil/Scripts/mainView.js | 75 ++++----- BeWoPlanerMobil/Util/MobileUtils.cs | 14 +- BeWoPlanerMobil/Views/Main/Main.cshtml | 144 ++++++++++-------- BeWoPlanerMobil/Web.config | 2 +- Service/Plugins/PluginLoader.cs | 4 +- .../CustomerServiceImp.cs | 2 +- 12 files changed, 173 insertions(+), 111 deletions(-) diff --git a/BeWoPlanerAndroid/BeWoPlanerAndroid.csproj.user b/BeWoPlanerAndroid/BeWoPlanerAndroid.csproj.user index 96a963155..3ebed1770 100644 --- a/BeWoPlanerAndroid/BeWoPlanerAndroid.csproj.user +++ b/BeWoPlanerAndroid/BeWoPlanerAndroid.csproj.user @@ -3,6 +3,7 @@ Test true + Debug|Any CPU diff --git a/BeWoPlanerMobil/BeWoPlanerMobil.csproj b/BeWoPlanerMobil/BeWoPlanerMobil.csproj index d8621999d..4056ddbdb 100644 --- a/BeWoPlanerMobil/BeWoPlanerMobil.csproj +++ b/BeWoPlanerMobil/BeWoPlanerMobil.csproj @@ -263,11 +263,11 @@ - False + True False 8808 / - http://localhost/BeWoPlanerMobil + http://localhost:8808/ False False diff --git a/BeWoPlanerMobil/BeWoPlanerMobil.csproj.user b/BeWoPlanerMobil/BeWoPlanerMobil.csproj.user index 46ff1ddb2..65f36bd35 100644 --- a/BeWoPlanerMobil/BeWoPlanerMobil.csproj.user +++ b/BeWoPlanerMobil/BeWoPlanerMobil.csproj.user @@ -1,13 +1,14 @@  - false + true + Debug|Any CPU diff --git a/BeWoPlanerMobil/Content/BeWoMobileStyle.css b/BeWoPlanerMobil/Content/BeWoMobileStyle.css index 52077e815..13bb6bfce 100644 --- a/BeWoPlanerMobil/Content/BeWoMobileStyle.css +++ b/BeWoPlanerMobil/Content/BeWoMobileStyle.css @@ -42,6 +42,12 @@ body { height: 100%; } +pre { + font-family: "Microsoft Sans Serif", Arial, sans-serif; + white-space: pre-line; + word-wrap: normal; +} + a, a:active, a:visited, a:hover { color: #555; } @@ -438,8 +444,8 @@ textarea { margin-top: 1em; } -#umfeldContainer { - display: none; +#umfeldContainer, #kommentarContainer { + display: none; } .contentTd { diff --git a/BeWoPlanerMobil/Controllers/MainController.cs b/BeWoPlanerMobil/Controllers/MainController.cs index a1aa0edd0..18a223cea 100644 --- a/BeWoPlanerMobil/Controllers/MainController.cs +++ b/BeWoPlanerMobil/Controllers/MainController.cs @@ -77,6 +77,10 @@ namespace BeWoPlanerMobil.Controllers var unter = GetSettingValue("ShowSignature"); Model.ShowSignature = unter == "1"; + #if DEBUG + Model.ShowSignature = true; + #endif + Model.GroupsOfPeople = EmployeeService.GetAllGroups(GetUser().Employee.EmployeeOid); Model.SelectedGoals = null; @@ -2611,6 +2615,7 @@ namespace BeWoPlanerMobil.Controllers public string Fax { get; set; } public string Telefon { get; set; } public string Handy { get; set; } + public string Kommentar { get; set; } public List Umfeldpersonen { get; set; } @@ -2631,6 +2636,8 @@ namespace BeWoPlanerMobil.Controllers RechnungsadressePostleitzahl = init.InvoiceAddressPostalCode; RechnungsadresseOrt = init.InvoiceAddressTown; + Kommentar = init.Notice; + foreach (var iContactDC in init.ContactInformations) { switch(iContactDC.ContactType) diff --git a/BeWoPlanerMobil/Scripts/initialization.js b/BeWoPlanerMobil/Scripts/initialization.js index 305dadb74..39d3d7217 100644 --- a/BeWoPlanerMobil/Scripts/initialization.js +++ b/BeWoPlanerMobil/Scripts/initialization.js @@ -1,6 +1,8 @@ var isEnddateSet; var numberOfDocumentationTypes; +var canvasWidth; + $(document).ready(function() { if(!$("#zeiterfassung").length) { return; @@ -55,9 +57,23 @@ $(document).ready(function() { vm = new KlientenVM(); ko.applyBindings(vm); + var documentWidth = $(document).width(); + canvasWidth = documentWidth * scaleFactor; + + $("#sketchpad").prop("width", canvasWidth); + loadSettingsAccordingToBWP(); }); +var scaleFactor = .8; +$(window).resize(function() { + var documentWidth = $(document).width(); + + if(canvasWidth !== (documentWidth * scaleFactor) && $("#sketchpad").css("display") === "inline") { + $("#sketchpad").prop("width", documentWidth * scaleFactor); + } +}); + function initBeWoMobile(actionPath) { try { $("#recordLoader_select, #kategorien_select, #leistungen_select, #textbausteine_select").prop("disabled", true); @@ -269,6 +285,8 @@ $(document).on("change", ".edit-form-input", saveFormValuesLocally(); }); +$(document).change(function() { console.log("test"); }); + function saveFormValuesLocally() { var recordObject = { category: $("#kategorien_select").val(), diff --git a/BeWoPlanerMobil/Scripts/mainView.js b/BeWoPlanerMobil/Scripts/mainView.js index d50cf5522..01ce3982f 100644 --- a/BeWoPlanerMobil/Scripts/mainView.js +++ b/BeWoPlanerMobil/Scripts/mainView.js @@ -976,6 +976,9 @@ function nextDayButtonClick() { loadAppointments(newtoday); } + + + var canvas, ctx; var mouseX, mouseY, mouseDown = 0; var lastpositionx = 0; @@ -985,16 +988,15 @@ var newpositiony = 0; var minuswert = -20; var maxwert = 20; var posix = 0; -var posiy = 0; +var posiy = 0; +var r, g, b = 0; +var a = 255; function loadUnterschriftFeldFunktion() { function drawDot(ctx, x, y, size) { - r = 0; g = 0; b = 0; a = 255; - ctx.fillStyle = "rgba(" + r + "," + g + "," + b + "," + (a / 255) + ")"; - if(lastpositionx != 0) { - + if(lastpositionx !== 0) { ctx.beginPath(); ctx.arc(x, y, size, 1, Math.PI * 0.25, true); newpositionx = x; @@ -1042,14 +1044,14 @@ function loadUnterschriftFeldFunktion() { function sketchpadMouseMove(e) { getMousePos(e); - if(mouseDown == 1) { + if(mouseDown === 1) { drawDot(ctx, mouseX, mouseY, 3); } } function getMousePos(e) { if(!e) { - var e = event; + e = event; } if(e.offsetX) { @@ -1076,7 +1078,7 @@ function loadUnterschriftFeldFunktion() { function getTouchPos(e) { if (!e) { - var e = event; + e = event; } if (e.touches) { @@ -1089,12 +1091,12 @@ function loadUnterschriftFeldFunktion() { } function init() { - //canvas = $("#sketchpad"); - canvas = document.getElementById('sketchpad'); + canvas = document.getElementById("sketchpad"); if (canvas.getContext) { - ctx = canvas.getContext('2d'); + ctx = canvas.getContext("2d"); } + if (ctx) { canvas.addEventListener("mousedown", sketchpadMouseDown, false); canvas.addEventListener("mousemove", sketchpadMouseMove, false); @@ -1245,6 +1247,8 @@ function loescheUnterschrift(canvas, ctx) { } + + function preloadData(serviceRecordOid) { initSignatureInfo(serviceRecordOid); } @@ -1291,6 +1295,7 @@ function klientenLaden() { if(oid === -1) { $("#klientenTabelle").css("display", "none"); $("#umfeldContainer").css("display", "none"); + $("#kommentarContainer").css("display", "none"); hideSanduhr(); @@ -1300,6 +1305,7 @@ function klientenLaden() { makeAjaxCall("GET", getSelectedCustomerUrl, function (json) { $("#klientenTabelle").css("display", "block"); $("#umfeldContainer").css("display", "block"); + $("#kommentarContainer").css("display", "block"); if(json === "SessionTimeout") { window.location.href = redirectLink; @@ -1313,11 +1319,10 @@ function klientenLaden() { }); }, - { - customerOid: oid - }, + { + customerOid: oid + }, hideSanduhr); - } function KlientenVM() { @@ -1342,6 +1347,7 @@ function KlientenVM() { this.Wohnheim = ko.observable(""); this.mobileLink = ko.observable(""); this.landLineLink = ko.observable(""); + this.kommentar = ko.observable(""); this.update = function (data) { this.vorname(data.Vorname); @@ -1366,6 +1372,7 @@ function KlientenVM() { this.handy(data.Handy); this.mobileLink('tel:' + data.Handy); this.landLineLink('tel:' + data.Telefon); + this.kommentar(data.Kommentar); var mappedUmfeldpersonen = $.map(data.Umfeldpersonen, function (item) { return new UmfPers(item); }); @@ -1427,22 +1434,22 @@ function calcPropFieldMinSizes() { $(".eigenschaftsdiv").each( function (index, element) { - var x = $(element).clone().css({ "height": "auto", "width": "auto" }).appendTo("body"); + var x = $(element).clone().css({ "height": "auto", "width": "auto" }).appendTo("body"); - var temporaryWidth = x.outerWidth(true); - var temporaryHeight = x.outerHeight(true); + var temporaryWidth = x.outerWidth(true); + var temporaryHeight = x.outerHeight(true); - x.remove(); + x.remove(); - elementCount++; + elementCount++; - if(temporaryWidth > width) { - width = temporaryWidth; - } + if(temporaryWidth > width) { + width = temporaryWidth; + } - if(temporaryHeight > height) { - height = temporaryHeight; - } + if(temporaryHeight > height) { + height = temporaryHeight; + } } ); @@ -1468,11 +1475,11 @@ function updateEigenschaftsfelder() { var width = parseInt(customerTableWidth / maxAnzahl) - 16; - if(minSizes != undefined) { + if(minSizes !== undefined) { $(".eigenschaftsdiv").each( function (index, element) { - $(element).css("width", width + "px"); - $(element).css("height", (minSizes.minHeight - 16) + "px"); + $(element).css("width", width + "px"); + $(element).css("height", (minSizes.minHeight - 16) + "px"); } ); } @@ -1498,13 +1505,13 @@ function hideSanduhr() { } if($("#SuccessPopupDiv").css("display") === "none" && $("#popupDiv").css("display") === "none") { - $(".modalWrapper").css("display", "none"); - $(".modalWrapper").css("height", "0"); + $(".modalWrapper").css("display", "none"); + $(".modalWrapper").css("height", "0"); } if($("#AendernPopupDiv").css("display") === "none" && $("#popupDiv").css("display") === "none") { - $(".modalWrapper").css("display", "none"); - $(".modalWrapper").css("height", "0"); + $(".modalWrapper").css("display", "none"); + $(".modalWrapper").css("height", "0"); } $(".warte-animation").css("display", "none"); @@ -1652,7 +1659,7 @@ function preselectCustomer() { $("#customersDropDown option").each(function () { if(this.value === valueToSelect === true) { $("#customersDropDown").val(valueToSelect); - $("#customersDropDown").trigger('change'); + $("#customersDropDown").trigger("change"); return false; } else { diff --git a/BeWoPlanerMobil/Util/MobileUtils.cs b/BeWoPlanerMobil/Util/MobileUtils.cs index 001eed563..771f41725 100644 --- a/BeWoPlanerMobil/Util/MobileUtils.cs +++ b/BeWoPlanerMobil/Util/MobileUtils.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; - +using System.Web; using BS.Shared.DataContracts; namespace BeWoPlanerMobil.Util @@ -48,5 +48,17 @@ namespace BeWoPlanerMobil.Util return decValue; } + + public static string TextToHtml(string text) + { + var result = HttpUtility.HtmlEncode(text); + + result = result.Replace("\r\n", "\r"); + result = result.Replace("\n", "\r"); + result = result.Replace("\r", "
\r\n"); + result = result.Replace(" ", "  "); + + return result; + } } } \ No newline at end of file diff --git a/BeWoPlanerMobil/Views/Main/Main.cshtml b/BeWoPlanerMobil/Views/Main/Main.cshtml index 2f7ff53de..bba306a88 100644 --- a/BeWoPlanerMobil/Views/Main/Main.cshtml +++ b/BeWoPlanerMobil/Views/Main/Main.cshtml @@ -796,36 +796,42 @@ - - + + +
+

Kommentar

+
+

+    
+

Umfeld


@@ -835,46 +841,47 @@
+
@@ -973,14 +980,17 @@ + +

+ + +
+
- +
-

- - - + - @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 -
-
-
- - @foreach (var gruppe in Model.GroupOfPeopleListItems) - { + @using (Html.BeginForm("AddSupportConceptsToGroupBooking", "Main", FormMethod.Post, new {id = "groupBookingSupportConceptSelectionForm"})) + { + var i = 0; + var j = 0; +
+
+ @foreach (var hp in Model.SupporConceptListItemsForGroupBooking) + { - j++; - } -
- - @gruppe.Text + @hp.Text
-
- } + i++; + } + + + +
+ + @foreach (var gruppe in Model.GroupOfPeopleListItems) + { + + + + + j++; + } +
+ + + @gruppe.Text +
+
+ } @@ -1017,15 +1016,11 @@ SetSaveSignatureUrl = '@Url.Action("SetSaveSignature")'; loadTextbausteineForCategoryUrl = '@Url.Action("LoadTextbausteineForServiceCategory")'; loadCompleteTextbausteinByOidUrl = '@Url.Action("LoadCompleteTextbausteinByOid")'; - @*addSupportConceptForGruppenbuchungUrl = '@Url.Action("AddSupportConceptToGruppenbuchung")'; - addEmployeeForGruppenbuchungUrl = '@Url.Action("AddEmployeeToGruppenbuchung")'; - removeSupportConceptFromGruppenbuchungUrl = '@Url.Action("RemoveSupportConceptFromGruppenbuchung")'; - removeEmployeeFromGruppenbuchungUrl = '@Url.Action("RemoveEmployeeFromGruppenbuchung")';*@ setGroupbookinModeUrl = '@Url.Action("SetGroupBookingMode")'; setSelectedGroupServiceRecordUrl = '@Url.Action("SetSelectedGroupServiceRecord")'; resetEditingModeUrl = '@Url.Action("ResetEditingMode")'; - loadCategoryAndDescriptionUrl = '@Url.Action("LoadCategoryAndDescription")'; - addEmployeesToGroupBookingUrl = '@Url.Action("AddEmployeesToGroupBooking")'; + loadCategoryAndDescriptionUrl = '@Url.Action("LoadCategoryAndDescription")'; + addEmployeesToGroupBookingUrl = '@Url.Action("AddEmployeesToGroupBooking")'; From 78492b8edc6a495d1655d50b2ba051f8ca187f73 Mon Sep 17 00:00:00 2001 From: Lyndon Jetten Date: Mon, 26 Nov 2018 13:44:01 -0400 Subject: [PATCH 08/18] Gruppenbuchung auskommentiert. --- BeWoPlanerMobil/Views/Main/Main.cshtml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/BeWoPlanerMobil/Views/Main/Main.cshtml b/BeWoPlanerMobil/Views/Main/Main.cshtml index 3adffe582..67aa1f854 100644 --- a/BeWoPlanerMobil/Views/Main/Main.cshtml +++ b/BeWoPlanerMobil/Views/Main/Main.cshtml @@ -53,7 +53,7 @@ } @* , new { style = "display: none;"} *@ - @using (Html.BeginForm("SetGroupBookingMode", "Main", FormMethod.Post)) + @using (Html.BeginForm("SetGroupBookingMode", "Main", FormMethod.Post, new { style = "display: none;" })) { @Html.CheckBoxFor(m => m.IsInGroupBookingMode, new { onchange = "showSanduhr();this.form.submit();", id = "changeBookingModeCheckBox" }) @Html.LabelFor(m => m.IsInGroupBookingMode, new { id = "labelForChangeBookingModeCheckBox" }) @@ -319,8 +319,8 @@ { } - - @**@ + @**@ + @{if((record.SignatureOid == null || record.SignatureOid.Equals("")) && Model.ShowSignature) From f49f833db3cd474c5322ef8f076d73e1faa2b68e Mon Sep 17 00:00:00 2001 From: Lyndon Jetten Date: Fri, 30 Nov 2018 16:47:57 -0400 Subject: [PATCH 09/18] =?UTF-8?q?Gruppenbuchung=20im=20Mobilklienten=20->?= =?UTF-8?q?=20Validierung=20serverseitig=20fertig.=20Die=20Meldungen=20im?= =?UTF-8?q?=20JavaScript=20m=C3=BCssen=20noch=20angepasst=20werden.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BeWoPlanerMobil/BeWoPlanerMobil.csproj | 3 + BeWoPlanerMobil/Controllers/MainController.cs | 177 ++++++++++---- BeWoPlanerMobil/Models/MainModel.cs | 56 +---- BeWoPlanerMobil/Scripts/initialization.js | 4 - BeWoPlanerMobil/Scripts/mainView.js | 218 ++++++++++-------- BeWoPlanerMobil/Util/MobileUtils.cs | 69 +++++- BeWoPlanerMobil/Views/Main/Main.cshtml | 62 +++-- Service/ServiceContracts/ICustomerService.cs | 4 + .../CustomerServiceImp.cs | 13 ++ 9 files changed, 388 insertions(+), 218 deletions(-) diff --git a/BeWoPlanerMobil/BeWoPlanerMobil.csproj b/BeWoPlanerMobil/BeWoPlanerMobil.csproj index 51b5e31b4..f935677e7 100644 --- a/BeWoPlanerMobil/BeWoPlanerMobil.csproj +++ b/BeWoPlanerMobil/BeWoPlanerMobil.csproj @@ -80,6 +80,7 @@ + @@ -176,8 +177,10 @@ + +
diff --git a/BeWoPlanerMobil/Controllers/MainController.cs b/BeWoPlanerMobil/Controllers/MainController.cs index 6af60cc9a..0ad86dcf6 100644 --- a/BeWoPlanerMobil/Controllers/MainController.cs +++ b/BeWoPlanerMobil/Controllers/MainController.cs @@ -4,7 +4,7 @@ using System.Diagnostics; using System.Linq; using System.Text; using System.Web.Mvc; - +using BeWo.Service.DCEntityMapper; using BeWo.Service.ServiceImplementations; using BeWoPlanerMobil.Models; @@ -23,6 +23,7 @@ using BS.Shared.Services; using DevExpress.XtraScheduler; using DevExpress.XtraScheduler.Compatibility; +using ServiceRecordDC = BS.Shared.DataContracts.ServiceRecordDC; namespace BeWoPlanerMobil.Controllers { @@ -623,23 +624,22 @@ namespace BeWoPlanerMobil.Controllers } } - public void SetSaveSignature(bool save) + public string SetSaveSignature(bool save) { try { if (Model == null) { - SerializeObject("SessionTimeout"); - } - else - { - Model.SaveSignature = save; + return SerializeObject("SessionTimeout"); } + + Model.SaveSignature = save; + return " "; } catch (Exception e) { log.Error(e.Message, e); - SerializeObject("Fehler 777: Fail Error Compilation"); + return SerializeObject("Fehler 777: Fail Error Compilation"); } } @@ -1137,8 +1137,8 @@ namespace BeWoPlanerMobil.Controllers Model.SelectedSupportConcepts = new List(); Model.SelectedEmployees = new List(); - //TODO: Die Dauer neuberechnen und die einzelnen ServiceRecords an die Änderungen, die gemacht wurden, anpassen. (Model.SelectedServiceRecord) - //TODO: Fast alle Eigenschaften von Model.NewServiceRecord kopieren + ResetGroupBookingMode(false); + Model.IsInEditingMode = false; return RedirectToActionPermanent("Main"); } @@ -1621,13 +1621,15 @@ namespace BeWoPlanerMobil.Controllers [HttpPost] [Authorize] - public ActionResult DeleteServiceRecord() + public ActionResult DeleteServiceRecord(FormCollection formCollection) { if (Model == null) { return RedirectToActionPermanent("Index", "Login"); } + Model.ServiceRecordOidToDelete = long.Parse(formCollection["serviceRecordOidHolder"]); + if (Model.ServiceRecordOidToDelete != null && Model.ServiceRecordOidToDelete > 0 && MobileSessionFacade.LoggedInUser.UserGroups.Any(a => a.Rights.Any(f => f.RightType.Equals(UserRightType.ServiceRecordView_Delete)))) { var serviceRecordDC = Model.ServiceRecords.FirstOrDefault(f => f.ServiceRecordOid != null && f.ServiceRecordOid.Value.Equals(Model.ServiceRecordOidToDelete)); @@ -1641,6 +1643,8 @@ namespace BeWoPlanerMobil.Controllers } } + ResetGroupBookingMode(false); + return RedirectToActionPermanent("Main"); } @@ -1690,15 +1694,16 @@ namespace BeWoPlanerMobil.Controllers } } - public void SetServiceDescription(long pServiceDescriptionOid) + public string SetServiceDescription(long pServiceDescriptionOid) { if (Model == null) { RedirectToActionPermanent("Index", "Login"); - return; + return " "; } Model.SelectedServiceDescriptionOid = pServiceDescriptionOid; + return " "; } [HttpPost] @@ -1789,6 +1794,9 @@ namespace BeWoPlanerMobil.Controllers Model.SelectedServiceRecord = serviceRecord; Model.SelectedSupportConcepts.Clear(); Model.SelectedEmployees.Clear(); + Model.SelectedCostbearerRelOids.Clear(); + + var relationOids = new List(); if (serviceRecord?.GroupOid != null) { @@ -1797,7 +1805,7 @@ namespace BeWoPlanerMobil.Controllers if(serviceRecordGroup != null) { employees.AddRangeIfElementsNotIn(serviceRecordGroup.ServiceRecordList.Select(s => s.Employee)); - var relationOids = serviceRecordGroup.ServiceRecordList.Select(s => s.CostBearer2SupportConceptOid.Value).ToList(); + relationOids = serviceRecordGroup.ServiceRecordList.Select(s => s.CostBearer2SupportConceptOid.Value).ToList(); var costBearerRelations = CustomerService.GetSupportConceptCostBearerRelationsById(relationOids); foreach(var rel in costBearerRelations) @@ -1812,12 +1820,12 @@ namespace BeWoPlanerMobil.Controllers } } } + + Model.SelectedCostbearerRelOids.AddRangeIfElementsNotIn(relationOids); Model.SelectedSupportConcepts = supportConcepts; Model.SelectedEmployees = employees; - // TODO: Wie bei SetGroupBooking - //LoadServiceCategoriesForGroupBooking(); Model.ServiceCategories = CreateServiceCategoryModels(OperationsService.GetAllServiceDescriptions()); return RedirectToActionPermanent("Main"); @@ -1923,11 +1931,11 @@ namespace BeWoPlanerMobil.Controllers checkSR.ServiceDescription = OperationsService.GetServiceDescription(Model.SelectedServiceDescriptionOid.Value); - var man = OperationsService.GetMandator(); - var s = man.Settings ?? string.Empty; - var einzeln = s.Split(';'); - var g = einzeln.ToList().FirstOrDefault(f => f.Contains("MaxDaysEditServiceRecordsAllowed")); - var t = g != null ? int.Parse(g.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; SupportConceptStatisticsDC stats = null; @@ -1936,21 +1944,69 @@ namespace BeWoPlanerMobil.Controllers stats = OperationsService.CreateSupportConceptStatistics(Model.CostBearer2SupportConceptOid.Value, DateTime.Now); } - var result = OperationsService.ValidateServiceRecordEntry(checkSR, stats, t, false, new List { checkSR.Employee.EmployeeOid }); - var valStruct = new ValidationStruct - { - ValidationResults = result, - Rights = new Dictionary(), - MaxDaysEditServiceRecordsAllowed = t.ToString() - }; + var employees = new List {checkSR.Employee.EmployeeOid}; - valStruct.Rights.Add(0, MobileSessionFacade.LoggedInUser.UserGroups.Any(a => a.Rights.Any(f => f.RightType.Equals(UserRightType.ServiceRecord_AllowCreateOverlappingFLS)))); - valStruct.Rights.Add(1, MobileSessionFacade.LoggedInUser.UserGroups.Any(a => a.Rights.Any(f => f.RightType.Equals(UserRightType.ServiceRecord_AllowCreateMoreFLSThanApproved)))); - valStruct.Rights.Add(2, MobileSessionFacade.LoggedInUser.UserGroups.Any(a => a.Rights.Any(f => f.RightType.Equals(UserRightType.BookServiceRecordAfterSettlementInvoice)))); + var newResult = new ValidationResult(); + + //if (checkSR.GroupOid.HasValue) + if(Model.IsInGroupBookingMode) + { + if (checkSR.GroupOid.HasValue) + { + var serviceRecordGroup = OperationsService.GetServiceRecordGroup(checkSR.GroupOid.Value); + + serviceRecordGroup.ServiceRecordList.DoForEach(sr => employees.AddIfNotIn(sr.Employee.EmployeeOid)); + } + else + { + Model.SelectedEmployees.DoForEach(e => employees.AddIfNotIn(e.EmployeeOid)); + } + + var cb2scOids = (from scDc in Model.SelectedSupportConcepts where scDc.CostBearerRelations != null && scDc.CostBearerRelations.Count > 0 select scDc.CostBearerRelations[0].CostBearer2SupportConceptOid.Value).ToList(); + + var nodes = new List(); + foreach (var sc in CustomerService.LoadCompactSupportConceptsById(Model.SelectedSupportConcepts.Select(s => s.SupportConceptOid.Value))) + { + nodes.Add(CreateFlatSupportConceptItem(sc, null)); + } + + foreach (var node in nodes) + { + if (node?.SupportConceptTreeNodeDC != null) + { + var scDc = node.SupportConceptTreeNodeDC.SupportConcept; + var cbDc = node.SupportConceptTreeNodeDC.CostBearer; + var relDc = node.SupportConceptTreeNodeDC.SupportConceptCostBearerRelDC; + + checkSR.SupportConcept = scDc; + checkSR.CostBearer = cbDc; + + if (relDc != null) + { + checkSR.CostBearer2SupportConceptOid = relDc.CostBearer2SupportConceptOid; + } + } + + var result = OperationsService.ValidateServiceRecord(checkSR, stats, maxDaysEditSRsAllowed, employees, cb2scOids); + newResult.ServiceRecord2Validations.Add(new ServiceRecord2Validation(checkSR, result)); + } + } + else + { + var result = OperationsService.ValidateServiceRecordEntry(checkSR, stats, maxDaysEditSRsAllowed, checkSR.GroupOid.HasValue, employees); + newResult.ServiceRecord2Validations.Add(new ServiceRecord2Validation(checkSR, result)); + } + + newResult.Rights = new Dictionary(); + newResult.MaxDaysEditServiceRecordsAllowed = maxDaysEditSRsAllowed.ToString(); + + newResult.Rights.Add(0, MobileSessionFacade.LoggedInUser.UserGroups.Any(a => a.Rights.Any(f => f.RightType.Equals(UserRightType.ServiceRecord_AllowCreateOverlappingFLS)))); + newResult.Rights.Add(1, MobileSessionFacade.LoggedInUser.UserGroups.Any(a => a.Rights.Any(f => f.RightType.Equals(UserRightType.ServiceRecord_AllowCreateMoreFLSThanApproved)))); + newResult.Rights.Add(2, MobileSessionFacade.LoggedInUser.UserGroups.Any(a => a.Rights.Any(f => f.RightType.Equals(UserRightType.BookServiceRecordAfterSettlementInvoice)))); Model.NewServiceRecord = new ServiceRecordDC(); - return SerializeObject(valStruct); + return SerializeObject(newResult); } public bool CheckRightsAfterCrash(string von, string bis, bool inEditMode, string dateString, string startString, string endString, long costbearerOId, string leistung) @@ -2074,13 +2130,6 @@ namespace BeWoPlanerMobil.Controllers return true; } - private struct ValidationStruct - { - public List ValidationResults { get; set; } - public Dictionary Rights { get; set; } - public string MaxDaysEditServiceRecordsAllowed { get; set; } - } - public void SetViewMode() { if (Model == null) @@ -2170,22 +2219,48 @@ namespace BeWoPlanerMobil.Controllers { var isInGroupBookingMode = "true,false" == pFormCollection["IsInGroupBookingMode"]; - Model.IsInGroupBookingMode = isInGroupBookingMode; + ResetGroupBookingMode(isInGroupBookingMode); - if(isInGroupBookingMode) + return RedirectToAction("Main"); + } + + private void ResetGroupBookingMode(bool pIsInGroupBookingMode) + { + Model.IsInGroupBookingMode = pIsInGroupBookingMode; + + if (pIsInGroupBookingMode) { Model.SelectedSupportConcept = null; Model.SelectedEmployee = null; Model.SelectedEmployeeOid = null; Model.ServiceCategories = CreateServiceCategoryModels(OperationsService.GetAllServiceDescriptions()); + + Model.SelectedEmployees.Add(MobileSessionFacade.LoggedInCompactEmployee); } else { Model.ServiceCategories.Clear(); - } + Model.SelectedCostbearerRelOids.Clear(); + Model.SelectedEmployees.Clear(); + Model.SelectedSupportConcepts.Clear(); - return RedirectToAction("Main"); + if (Model.SelectedSupportConcept != null) + { + var details = OperationsService.GetSupportConceptTreeNodeDetailInfo(Model.SelectedSupportConcept.Customer.CustomerOid, Model.SelectedSupportConcept.SupportConceptOid, Model.CostBearer2SupportConceptOid); + + Model.ServiceCategories = details.ServiceAccountings.Count > 0 + ? CreateServiceCategoryModels(details.ServiceAccountings.Select(sa => sa.ServiceDescription).ToList()) + : CreateServiceCategoryModels(OperationsService.GetAllServiceDescriptions()); + + Model.ServiceCategories = Model.ServiceCategories.Where(c => !c.OhneHilfeplan.HasValue || c.OhneHilfeplan.Value == AccountingvisibilityType.Beides || c.OhneHilfeplan.Value == AccountingvisibilityType.NurKlientenbezogen).ToList(); + } + else if (Model.CostBearer2SupportConceptOid == -2) + { + Model.ServiceCategories = CreateServiceCategoryModels(OperationsService.GetAllServiceDescriptions()); + Model.ServiceCategories = Model.ServiceCategories.Where(c => !c.OhneHilfeplan.HasValue || c.OhneHilfeplan.Value == AccountingvisibilityType.Beides || c.OhneHilfeplan.Value == AccountingvisibilityType.NichtKlientenbezogen).ToList(); + } + } } [HttpPost] @@ -2204,6 +2279,11 @@ namespace BeWoPlanerMobil.Controllers public string LoadCategoryAndDescription() { + if (Model.SelectedServiceRecord == null) + { + return null; + } + var serviceDescriptionOid = Model.SelectedServiceRecord.ServiceDescription.ServiceDescriptionOid.ToString(); var serviceCategoryOid = Model.SelectedServiceRecord.ServiceDescription.Category.ServiceCategoryOid.ToString(); @@ -2297,5 +2377,16 @@ namespace BeWoPlanerMobil.Controllers return RedirectToAction("Main"); } + + [Authorize] + public string ResetGroupBookingModeViaGET() + { + Model.IsInGroupBookingMode = false; + Model.SelectedCostbearerRelOids.Clear(); + Model.SelectedEmployees.Clear(); + Model.SelectedSupportConcepts.Clear(); + + return MainModel.IsEmployeeSelectionVisible.ToString(); + } } } diff --git a/BeWoPlanerMobil/Models/MainModel.cs b/BeWoPlanerMobil/Models/MainModel.cs index 29c2ee8fc..d8acf32d6 100644 --- a/BeWoPlanerMobil/Models/MainModel.cs +++ b/BeWoPlanerMobil/Models/MainModel.cs @@ -150,29 +150,6 @@ namespace BeWoPlanerMobil.Models } } - // TODO: KGW? - //public IEnumerable SelectedSupportConceptListItemsForGroupBooking - //{ - // get - // { - // var selectedSCs = new List(); - - // if(SelectedSupportConcepts != null) - // { - // foreach(var sc in SelectedSupportConcepts.OrderBy(sc => sc.Customer.LastName)) - // { - // selectedSCs.AddRange(sc.CostBearerRelations.Where(w => ShowExpiredSupportConcepts || w.EndDate == null || w.EndDate.Value >= DateTime.Now).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 selectedSCs; - // } - //} - public IEnumerable ServiceCategoryListItems { get @@ -199,26 +176,6 @@ namespace BeWoPlanerMobil.Models } } - // TODO: KGW? - // [Display(Name = "Textbaustein")] - // public long? SelectedTextbausteinOid { get; set; } - - // TODO: KGW? - //public IEnumerable TextbausteinListItems - //{ - // get - // { - // var result = new List(); - - // if (Textbausteine != null) - // { - // result.AddRange(Textbausteine.Select(item => new SelectListItem { Value = item.TextModuleOid.Value.ToString(), Text = item.Name }).ToList()); - // } - - // return result; - // } - //} - public List Customers { get; set; } public List Employees { get; set; } @@ -252,10 +209,6 @@ namespace BeWoPlanerMobil.Models public List SelectedGroupOfPeopleOids { get; set; } = new List(); - // TODO: KGW - //[Display(Name = "Gruppen")] - //public string SelectedGroupInfo { get; set; } - public IEnumerable EmployeeListItems { get @@ -292,16 +245,13 @@ namespace BeWoPlanerMobil.Models public List SelectedEmployees { get; set; } = new List(); - // TODO: KGW - //public List SelectedCostbearer2SupportConceptOids { get; set; } = new List(); - [Display(Name = "Gruppenbuchung")] public bool IsInGroupBookingMode { - //get => _IsInGroupBookingMode; - get => false; + get => _IsInGroupBookingMode; + //get => false; - set + set { _IsInGroupBookingMode = value; diff --git a/BeWoPlanerMobil/Scripts/initialization.js b/BeWoPlanerMobil/Scripts/initialization.js index aa5a3ca85..e492f8f02 100644 --- a/BeWoPlanerMobil/Scripts/initialization.js +++ b/BeWoPlanerMobil/Scripts/initialization.js @@ -170,10 +170,6 @@ function initBeWoMobile(actionPath) { var value = (supportConceptTableHasEntries === 0 || employeesTableHasEntries === 0) ? false : true; $("#anlegenEditierenBtn").prop("disabled", value); - - hideElement($("#selectSCForm")); - } else { - showElement($("#selectSCForm")); } } catch(err) { console.log('Fehler: ' + err.message); diff --git a/BeWoPlanerMobil/Scripts/mainView.js b/BeWoPlanerMobil/Scripts/mainView.js index b1f22a37c..8516c4d82 100644 --- a/BeWoPlanerMobil/Scripts/mainView.js +++ b/BeWoPlanerMobil/Scripts/mainView.js @@ -21,7 +21,7 @@ function buildCollapsibleSet(jsonString) { actuallyBuildCollapsibleSet(kollektion, null); } catch(exception) { - console.log('Fehler(BuildCollapsibleSet): ' + exception.message); + console.log("Fehler(BuildCollapsibleSet): " + exception.message); } } @@ -66,9 +66,6 @@ function buildGoalTreeItem(goalItem, selectedGoalOids) { collapsibleHtml += '
' + goalHeader + '
'; } - - - } function loadGoalsOnSuccess(json) { @@ -132,7 +129,7 @@ function showAjaxError(jqXHR, textStatus, errorThrown) { //else if(jqXHR.status === 0) { - console.log("status is 0; ajax call aborted"); + console.log("status is 0; ajax call aborted.\nError thrown: " + errorThrown + ";\nText status: " + textStatus); return; } @@ -340,6 +337,28 @@ function selectServiceRecord(oid) { $("#abbrechenBtn").prop("disabled", false); + if (isInGroupBookingMode()) { + $("#changeBookingModeCheckBox").prop("checked", false); + + console.log("Gruppenbuchungsmodus abgewählt"); + + makeAjaxCall("GET", window.resetGroupBookingModeViaGETUrl, function (result) { + $("#changeBookingModeCheckBox").prop("checked", false); + $("#leftContent input[type=checkbox]").prop("checked", false); + $("#rightContent input[type=checkbox]").prop("checked", false); + $("#employeeCollapsible input[type=checkbox]").prop("checked", false); + + showElement($("#selectSCForm")); + + if (result === "True") { + showElement($("#singleSCEmployeeSelectionContainer")); + } + + hideElement($("#groupBookingOpenPopupBtn")); + hideElement($("#groupBookingOpenEmployeeSelectionPopupBtn")); + }, null, null); + } + hideSanduhr(); }, error: showErrorMsg, @@ -385,6 +404,12 @@ function resetRecordForm() { clearZED(); + if (isInGroupBookingMode()) { + $("#changeBookingModeCheckBox").prop("checked", false); + showSanduhr(); + $("#groupBookingForm").submit(); + } + $("#start_textbox").val("").trigger("change"); $("#ende_textbox").val("").trigger("change"); $("#notiz_textbox").val("").trigger("change"); @@ -403,7 +428,7 @@ function resetRecordForm() { var selectedCategory = $("#kategorien_select").find(":selected").val(); if(isInEditingMode()) { - makeAjaxCall("POST", resetEditingModeUrl, function(response) { window.location.reload(); }, { pFormCollection: null }, null); + makeAjaxCall("POST", window.resetEditingModeUrl, function(response) { window.location.reload(); }, { pFormCollection: null }, null); } $.ajax({ @@ -471,9 +496,8 @@ function validateTimeField(id) { } } -recordToDelete = 0; function togglePopup(serviceRecordOid) { - window.recordToDelete = serviceRecordOid; + $("#oidHolder").val(serviceRecordOid); var isShowing = $(".modalWrapper").css("display") === "none"; var displayValue = $(".modalWrapper").css("display") === "block" ? "none" : "block"; @@ -505,25 +529,6 @@ function toggleModalWrapper() { $(".modalWrapper").css("height", $(document).height()); } -$(function () { - $("#deletionForm").submit(function () { - $.ajax({ - type: "GET", - url: setRecordForDeletionUrl, - data: { serviceRecordOid: recordToDelete }, - success: function () { - return true; - }, - error: function () { - showAjaxError(); - return false; - } - }); - - return true; - }); -}); - function validateServiceRecordBeforeSubmit() { function getLocation() { if (navigator.geolocation) { @@ -566,8 +571,10 @@ function validateServiceRecordBeforeSubmit() { } var meldungen = $.parseJSON(json); + console.log(meldungen); - var results = meldungen.ValidationResults; + var relations = meldungen.ServiceRecord2Validations; + var results = null; var allowOverlappingFLS = false; var allowMoreFLSThanApproved = false; var bookAfterSettlementInvoice = false; @@ -591,83 +598,90 @@ function validateServiceRecordBeforeSubmit() { } }); - var exitLoop = false; - for (var i = 0; i < results.length; i++) { - if (exitLoop) - break; - switch (results[i].ResultType) { - case 0: - var msg1 = 'An dem gewählten Datum \'' + vonDatum + '\' existiert bereits ein Eintrag (' + results[i].Message + ' bei Klient/in ' + results[i].CustomerName + '). Speichern nicht möglich.'; - if (allowOverlappingFLS === true) { - var r = confirm('An dem gewählten Datum \'' + vonDatum + '\' existiert bereits ein Eintrag (' + results[i].Message + ' bei Klient/in ' + results[i].CustomerName + '). Möchten Sie trotzdem speichern?'); - isValidRecord = r; - exitLoop = !isValidRecord; - } else { - writeFatalErrorMessage(msg1); - isValidRecord = false; - exitLoop = true; - } - break; - case 1: - var msg2 = 'An dem gewählten Datum ' + vonDatum + ' existiert bereits ein Eintrag für den ausgewählten Mitarbeiter(' + results[i].EmployeeName + '). Speichern nicht möglich.'; - if (allowOverlappingFLS === true) { - var r2 = confirm('An dem gewählten Datum ' + vonDatum + ' existiert bereits ein Eintrag für den ausgewählten Mitarbeiter(' + results[i].EmployeeName + '). Möchten Sie trotzdem speichern?'); - isValidRecord = r2; - exitLoop = !isValidRecord; - } else { - writeFatalErrorMessage(msg2); - isValidRecord = false; - exitLoop = true; - } - break; - case 2: - writeFatalErrorMessage('Das gewählte Datum ' + vonDatum.slice(0, 10) + ' liegt außerhalb des Zeitraumes des gewählten Hilfeplans. Speichern nicht möglich.'); - isValidRecord = false; - exitLoop = true; - break; - case 3: - var msg3 = 'Die für diesen Hilfeplan genehmigten FLS (' + results[i].ApprovedHours + ') werden mit diesem Eintrag überschritten. (' + results[i].HoursNew + ').'; - if (allowMoreFLSThanApproved === true) { - var r3 = confirm(msg3 + " Möchten Sie trotzdem speichern?"); - isValidRecord = r3; - exitLoop = !isValidRecord; - } else { - writeFatalErrorMessage(msg3); - isValidRecord = false; - exitLoop = true; + for (var j = 0; j < relations.length; j++) { + results = relations[j].ValidationResults; + + var exitLoop = false; + for (var i = 0; i < results.length; i++) { + if (exitLoop) { + break; } - break; - case 4: - writeFatalErrorMessage('Sie können keine neuen Leistungen für den ' + vonDatum + ' dokumentieren, da bereits der ' + meldungen.MaxDaysEditServiceRecordsAllowed + '. des nachfolgenden Monats überschritten ist.'); - isValidRecord = false; - exitLoop = true; - break; - case 5: - writeFatalErrorMessage("Beim Speichern ist ein Fehler aufgetreten. Speichern nicht möglich."); - isValidRecord = false; - exitLoop = true; - break; - case 6: - var msg6 = "Es existiert bereits eine Spitzabrechnung. Um diesen Eintrag zu berücksichtigen, muss eventuell eine neue Spitzabrechnung erstellt werden. Das Speichern ist nicht möglich."; - if (bookAfterSettlementInvoice === true) { - msg6 = "Sie können den Eintrag nicht bearbeiten, da bereits eine Spitzabrechnung für diesen Hilfeplan erstellt wurde. Speichern nicht möglich."; + + switch (results[i].ResultType) { + case 0: + var msg1 = 'An dem gewählten Datum \'' + vonDatum + '\' existiert bereits ein Eintrag (' + results[i].Message + ' bei Klient/in ' + results[i].CustomerName + '). Speichern nicht möglich.'; + if (allowOverlappingFLS === true) { + var r = confirm('An dem gewählten Datum \'' + vonDatum + '\' existiert bereits ein Eintrag (' + results[i].Message + ' bei Klient/in ' + results[i].CustomerName + '). Möchten Sie trotzdem speichern?'); + isValidRecord = r; + exitLoop = !isValidRecord; + } else { + writeFatalErrorMessage(msg1); + isValidRecord = false; + exitLoop = true; + } + break; + case 1: + var msg2 = 'An dem gewählten Datum ' + vonDatum + ' existiert bereits ein Eintrag für den ausgewählten Mitarbeiter(' + results[i].EmployeeName + '). Speichern nicht möglich.'; + if (allowOverlappingFLS === true) { + var r2 = confirm('An dem gewählten Datum ' + vonDatum + ' existiert bereits ein Eintrag für den ausgewählten Mitarbeiter(' + results[i].EmployeeName + '). Möchten Sie trotzdem speichern?'); + isValidRecord = r2; + exitLoop = !isValidRecord; + } else { + writeFatalErrorMessage(msg2); + isValidRecord = false; + exitLoop = true; + } + break; + case 2: + writeFatalErrorMessage('Das gewählte Datum ' + vonDatum.slice(0, 10) + ' liegt außerhalb des Zeitraumes des gewählten Hilfeplans. Speichern nicht möglich.'); + + isValidRecord = false; + exitLoop = true; + break; + case 3: + var msg3 = 'Die für diesen Hilfeplan genehmigten FLS (' + results[i].ApprovedHours + ') werden mit diesem Eintrag überschritten. (' + results[i].HoursNew + ').'; + if (allowMoreFLSThanApproved === true) { + var r3 = confirm(msg3 + " Möchten Sie trotzdem speichern?"); + isValidRecord = r3; + exitLoop = !isValidRecord; + } else { + writeFatalErrorMessage(msg3); + isValidRecord = false; + exitLoop = true; + } + break; + case 4: + writeFatalErrorMessage('Sie können keine neuen Leistungen für den ' + vonDatum + ' dokumentieren, da bereits der ' + meldungen.MaxDaysEditServiceRecordsAllowed + '. des nachfolgenden Monats überschritten ist.'); + isValidRecord = false; + exitLoop = true; + break; + case 5: + writeFatalErrorMessage("Beim Speichern ist ein Fehler aufgetreten. Speichern nicht möglich."); + isValidRecord = false; + exitLoop = true; + break; + case 6: + var msg6 = "Es existiert bereits eine Spitzabrechnung. Um diesen Eintrag zu berücksichtigen, muss eventuell eine neue Spitzabrechnung erstellt werden. Das Speichern ist nicht möglich."; + if (bookAfterSettlementInvoice === true) { + msg6 = "Sie können den Eintrag nicht bearbeiten, da bereits eine Spitzabrechnung für diesen Hilfeplan erstellt wurde. Speichern nicht möglich."; + } + writeFatalErrorMessage(msg6); + isValidRecord = false; + exitLoop = true; + break; + case 7: + var msg7 = "Sie können keine neuen Leistungen dokumentieren, da die Frist zur Bearbeitung abgelaufen ist. Das Speichern ist nicht möglich."; + writeFatalErrorMessage(msg7); + isValidRecord = false; + exitLoop = true; + break; + default: + writeFatalErrorMessage(results[i].Message); + isValidRecord = false; + exitLoop = true; + break; } - writeFatalErrorMessage(msg6); - isValidRecord = false; - exitLoop = true; - break; - case 7: - var msg7 = "Sie können keine neuen Leistungen dokumentieren, da die Frist zur Bearbeitung abgelaufen ist. Das Speichern ist nicht möglich."; - writeFatalErrorMessage(msg7); - isValidRecord = false; - exitLoop = true; - break; - default: - writeFatalErrorMessage(results[i].Message); - isValidRecord = false; - exitLoop = true; - break; } } diff --git a/BeWoPlanerMobil/Util/MobileUtils.cs b/BeWoPlanerMobil/Util/MobileUtils.cs index 94dba949c..786644459 100644 --- a/BeWoPlanerMobil/Util/MobileUtils.cs +++ b/BeWoPlanerMobil/Util/MobileUtils.cs @@ -5,10 +5,11 @@ 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; @@ -261,5 +262,71 @@ namespace BeWoPlanerMobil.Util return list; } + + public static FlatSupportConceptTreeNodeDC CreateFlatSupportConceptItem(CompactSupportConceptDC dc, CompactOrganisationDC orga) + { + var flatNode = new FlatSupportConceptTreeNodeDC(); + + if (dc != null) + { + var treeNode = new SupportConceptTreeNodeDC {SupportConcept = dc, Customer = dc.Customer}; + + if (dc.CostBearerList.Count > 0) + { + CompactCostBearerDC cbDC = null; + + if (orga != null) + { + foreach (var item in dc.CostBearerList) + { + if (orga.Equals(item.Organisation)) + { + cbDC = item; + } + } + } + if (cbDC == null) + cbDC = dc.CostBearerList[0]; + + + var orgDC = new CompactOrganisationDC(); + var relDC = new SupportConceptCostBearerRelDC(); + + orgDC.CostBearerID = cbDC.CostBearerID; + orgDC.CostBearerOid = cbDC.CostBearerOid; + + var o = orga ?? cbDC.Organisation; + + if (o != null) + { + orgDC.OrganisationOid = o.OrganisationOid; + orgDC.Name = o.Name; + orgDC.ActualHourlyRate = o.ActualHourlyRate; + orgDC.ActualMinuteIntervall = o.ActualMinuteIntervall; + orgDC.ActualRateFactor = o.ActualRateFactor; + orgDC.CostRatePeriods = o.CostRatePeriods; + orgDC.IsCalculatingWithFactor = o.IsCalculatingWithFactor; + + } + + relDC.ApprovedEndDate = cbDC.ApprovedEndDate; + relDC.ApprovedStartDate = cbDC.ApprovedStartDate; + relDC.CostBearer = orgDC; + relDC.CostBearer2SupportConceptOid = cbDC.CostBearer2SupportConceptOid; + relDC.RequestedEndDate = cbDC.RequestedEndDate; + relDC.RequestedStartDate = cbDC.RequestedStartDate; + relDC.Status = cbDC.SupportConceptStatus; + relDC.SupportConcept = dc; + relDC.AuswahlBezeichnung = cbDC.Bezeichnung; + + treeNode.SupportConceptCostBearerRelDC = relDC; + treeNode.CostBearer = orgDC; + } + + flatNode.SupportConceptTreeNodeDC = treeNode; + } + + return flatNode; + } } } \ No newline at end of file diff --git a/BeWoPlanerMobil/Views/Main/Main.cshtml b/BeWoPlanerMobil/Views/Main/Main.cshtml index 67aa1f854..0beaef798 100644 --- a/BeWoPlanerMobil/Views/Main/Main.cshtml +++ b/BeWoPlanerMobil/Views/Main/Main.cshtml @@ -53,7 +53,7 @@ } @* , new { style = "display: none;"} *@ - @using (Html.BeginForm("SetGroupBookingMode", "Main", FormMethod.Post, new { style = "display: none;" })) + @using (Html.BeginForm("SetGroupBookingMode", "Main", FormMethod.Post, new {id = "groupBookingForm"})) { @Html.CheckBoxFor(m => m.IsInGroupBookingMode, new { onchange = "showSanduhr();this.form.submit();", id = "changeBookingModeCheckBox" }) @Html.LabelFor(m => m.IsInGroupBookingMode, new { id = "labelForChangeBookingModeCheckBox" }) @@ -69,8 +69,15 @@ };" /> + @{ + var shouldShowSingleBookingElements = "display: block"; - @using (Html.BeginForm("SelectSupportConcept", "Main", FormMethod.Post, new { id = "selectSCForm" })) + if (Model.IsInGroupBookingMode) + { + shouldShowSingleBookingElements = "display: none"; + } + } + @using (Html.BeginForm("SelectSupportConcept", "Main", FormMethod.Post, new { id = "selectSCForm", style= shouldShowSingleBookingElements })) { @@ -88,8 +95,15 @@
} + +
+ @Html.LabelFor(m => m.SelectedEmployeeOid) +
+ @Html.DropDownListFor(m => m.SelectedEmployeeOid, Model.EmployeeListItems, new { onchange = "setSelectedEmployee()", id = "employeesDropDown", @class = "dropdownlist-for" }) +
+
-
+
@using (Html.BeginForm("CreateServiceRecord", "Main", FormMethod.Post, new { id = "createSRForm" })) { @@ -273,8 +287,17 @@ + + @{ + var shouldShowServiceRecordList = "display: block"; - @using (Html.BeginForm("LoadServiceRecords", "Main", FormMethod.Post, new { id = "selectSCForm2" })) + if (Model.IsInGroupBookingMode && !Model.IsInEditingMode) + { + shouldShowServiceRecordList = "display: none"; + } + } + + @using (Html.BeginForm("LoadServiceRecords", "Main", FormMethod.Post, new { id = "selectSCForm2", style = shouldShowServiceRecordList })) {
@@ -292,22 +315,29 @@
-
+
@foreach(var record in Model.ServiceRecords) {
-
@@ -319,8 +349,8 @@ { } - @**@ - + + @**@ @{if((record.SignatureOid == null || record.SignatureOid.Equals("")) && Model.ShowSignature) @@ -534,6 +564,7 @@
@using (Html.BeginForm("DeleteServiceRecord", "Main", FormMethod.Post, new { id = "deletionForm" })) { + } @@ -1020,7 +1051,8 @@ setSelectedGroupServiceRecordUrl = '@Url.Action("SetSelectedGroupServiceRecord")'; resetEditingModeUrl = '@Url.Action("ResetEditingMode")'; loadCategoryAndDescriptionUrl = '@Url.Action("LoadCategoryAndDescription")'; - addEmployeesToGroupBookingUrl = '@Url.Action("AddEmployeesToGroupBooking")'; + addEmployeesToGroupBookingUrl = '@Url.Action("AddEmployeesToGroupBooking")'; + resetGroupBookingModeViaGETUrl = '@Url.Action("ResetGroupBookingModeViaGET")'; diff --git a/Service/ServiceContracts/ICustomerService.cs b/Service/ServiceContracts/ICustomerService.cs index 028de1fcf..034229975 100644 --- a/Service/ServiceContracts/ICustomerService.cs +++ b/Service/ServiceContracts/ICustomerService.cs @@ -700,5 +700,9 @@ namespace BeWo.Service.ServiceContracts [FaultContract(typeof(BeWoFault))] [OperationContract] List GetSupportConceptCostBearerRelationsById(IEnumerable relOids); + + [FaultContract(typeof(BeWoFault))] + [OperationContract] + List LoadCompactSupportConceptsById(IEnumerable pOids); } } \ No newline at end of file diff --git a/Service/ServiceImplementations/CustomerServiceImp.cs b/Service/ServiceImplementations/CustomerServiceImp.cs index 83e7a5fe1..a75fd6c54 100644 --- a/Service/ServiceImplementations/CustomerServiceImp.cs +++ b/Service/ServiceImplementations/CustomerServiceImp.cs @@ -3862,6 +3862,19 @@ namespace BeWo.Service.ServiceImplementations throw Utils.CreateBeWoFaultException(e); } } + + public List LoadCompactSupportConceptsById(IEnumerable pOids) + { + try + { + var originals = DAOFactory.GenericDAO.LoadByIDs(pOids); + return MapperFactory.CompactSupportConceptDC_SupportConcept.MapToNewDCs(originals); + } + catch (Exception e) + { + throw Utils.CreateBeWoFaultException(e); + } + } } internal struct WohnheimbuchungsIntervallStruct From 199f114d29b47e71039b8b8f04f6bc040aa60eff Mon Sep 17 00:00:00 2001 From: Lyndon Date: Mon, 3 Dec 2018 19:14:35 -0400 Subject: [PATCH 10/18] BeWoPlanerMobil: Die Validierung von ServiceRecords auf dem Server und die Anzeige im Browser der Anzeige im Fat-Client angepasst. --- BeWoPlanerMobil/BeWoPlanerMobil.csproj | 4 +- BeWoPlanerMobil/BeWoPlanerMobil.csproj.user | 2 +- BeWoPlanerMobil/Controllers/MainController.cs | 51 ++++++++++++-- BeWoPlanerMobil/Scripts/mainView.js | 67 +++++++++++++------ .../Util/ServiceRecord2Validation.cs | 19 ++++++ BeWoPlanerMobil/Util/ValidationResult.cs | 13 ++++ BeWoPlanerMobil/Web.config | 2 +- 7 files changed, 129 insertions(+), 29 deletions(-) create mode 100644 BeWoPlanerMobil/Util/ServiceRecord2Validation.cs create mode 100644 BeWoPlanerMobil/Util/ValidationResult.cs diff --git a/BeWoPlanerMobil/BeWoPlanerMobil.csproj b/BeWoPlanerMobil/BeWoPlanerMobil.csproj index f935677e7..d487dd916 100644 --- a/BeWoPlanerMobil/BeWoPlanerMobil.csproj +++ b/BeWoPlanerMobil/BeWoPlanerMobil.csproj @@ -15,7 +15,7 @@ BeWoPlanerMobil v4.5 false - true + false @@ -276,7 +276,7 @@ False 8808 / - http://localhost:8808/ + http://localhost/BeWoPlanerMobil False False diff --git a/BeWoPlanerMobil/BeWoPlanerMobil.csproj.user b/BeWoPlanerMobil/BeWoPlanerMobil.csproj.user index 65f36bd35..5cffa0aed 100644 --- a/BeWoPlanerMobil/BeWoPlanerMobil.csproj.user +++ b/BeWoPlanerMobil/BeWoPlanerMobil.csproj.user @@ -1,7 +1,7 @@  - true + false diff --git a/BeWoPlanerMobil/Controllers/MainController.cs b/BeWoPlanerMobil/Controllers/MainController.cs index 0ad86dcf6..f45c2f4cc 100644 --- a/BeWoPlanerMobil/Controllers/MainController.cs +++ b/BeWoPlanerMobil/Controllers/MainController.cs @@ -1936,6 +1936,8 @@ namespace BeWoPlanerMobil.Controllers 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 ? limitFuerZeiterfassungSetting.Split('=')[1] : "0"; SupportConceptStatisticsDC stats = null; @@ -1948,7 +1950,8 @@ namespace BeWoPlanerMobil.Controllers var newResult = new ValidationResult(); - //if (checkSR.GroupOid.HasValue) + string dateRangeString; + if(Model.IsInGroupBookingMode) { if (checkSR.GroupOid.HasValue) @@ -1988,17 +1991,22 @@ namespace BeWoPlanerMobil.Controllers } var result = OperationsService.ValidateServiceRecord(checkSR, stats, maxDaysEditSRsAllowed, employees, cb2scOids); - newResult.ServiceRecord2Validations.Add(new ServiceRecord2Validation(checkSR, result)); + dateRangeString = node?.SupportConceptTreeNodeDC != null ? node.SupportConceptTreeNodeDC.SupportConceptCostBearerRelDC.DateRangeString : ""; + + newResult.ServiceRecord2Validations.Add(new ServiceRecord2Validation(checkSR, result, dateRangeString)); } } else { + var node = CreateFlatSupportConceptItem(CustomerService.LoadCompactSupportConceptDC(Model.SelectedSupportConcept.SupportConceptOid.Value, Model.SelectedEmployee.EmployeeOid), null); + dateRangeString = node?.SupportConceptTreeNodeDC != null ? node.SupportConceptTreeNodeDC.SupportConceptCostBearerRelDC.DateRangeString : ""; + var result = OperationsService.ValidateServiceRecordEntry(checkSR, stats, maxDaysEditSRsAllowed, checkSR.GroupOid.HasValue, employees); - newResult.ServiceRecord2Validations.Add(new ServiceRecord2Validation(checkSR, result)); + newResult.ServiceRecord2Validations.Add(new ServiceRecord2Validation(checkSR, result, dateRangeString)); } - newResult.Rights = new Dictionary(); newResult.MaxDaysEditServiceRecordsAllowed = maxDaysEditSRsAllowed.ToString(); + newResult.LimitFuerZeiterfassung = limitFuerZeiterfassung; newResult.Rights.Add(0, MobileSessionFacade.LoggedInUser.UserGroups.Any(a => a.Rights.Any(f => f.RightType.Equals(UserRightType.ServiceRecord_AllowCreateOverlappingFLS)))); newResult.Rights.Add(1, MobileSessionFacade.LoggedInUser.UserGroups.Any(a => a.Rights.Any(f => f.RightType.Equals(UserRightType.ServiceRecord_AllowCreateMoreFLSThanApproved)))); @@ -2217,6 +2225,11 @@ namespace BeWoPlanerMobil.Controllers [Authorize] public ActionResult SetGroupBookingMode(FormCollection pFormCollection) { + if (Model == null) + { + return RedirectToActionPermanent("Index", "Login"); + } + var isInGroupBookingMode = "true,false" == pFormCollection["IsInGroupBookingMode"]; ResetGroupBookingMode(isInGroupBookingMode); @@ -2226,6 +2239,12 @@ namespace BeWoPlanerMobil.Controllers private void ResetGroupBookingMode(bool pIsInGroupBookingMode) { + if (Model == null) + { + RedirectToActionPermanent("Index", "Login"); + return; + } + Model.IsInGroupBookingMode = pIsInGroupBookingMode; if (pIsInGroupBookingMode) @@ -2267,6 +2286,11 @@ namespace BeWoPlanerMobil.Controllers [Authorize] public ActionResult ResetEditingMode(FormCollection pFormCollection) { + if (Model == null) + { + return RedirectToActionPermanent("Index", "Login"); + } + Model.NewServiceRecord = new ServiceRecordDC(); Model.SelectedServiceRecord = null; Model.SelectedSupportConcepts.Clear(); @@ -2279,6 +2303,12 @@ namespace BeWoPlanerMobil.Controllers public string LoadCategoryAndDescription() { + if (Model == null) + { + RedirectToActionPermanent("Index", "Login"); + return null; + } + if (Model.SelectedServiceRecord == null) { return null; @@ -2296,7 +2326,7 @@ namespace BeWoPlanerMobil.Controllers { if (Model == null) { - return RedirectToAction("Main"); + return RedirectToActionPermanent("Index", "Login"); } var oids = new List(); @@ -2322,6 +2352,11 @@ namespace BeWoPlanerMobil.Controllers [HttpPost] public ActionResult AddSupportConceptsToGroupBooking(FormCollection pFormCollection) { + if (Model == null) + { + return RedirectToActionPermanent("Index", "Login"); + } + var relOids = new List(); var groups = new List(); @@ -2381,6 +2416,12 @@ namespace BeWoPlanerMobil.Controllers [Authorize] public string ResetGroupBookingModeViaGET() { + if (Model == null) + { + RedirectToActionPermanent("Index", "Login"); + return null; + } + Model.IsInGroupBookingMode = false; Model.SelectedCostbearerRelOids.Clear(); Model.SelectedEmployees.Clear(); diff --git a/BeWoPlanerMobil/Scripts/mainView.js b/BeWoPlanerMobil/Scripts/mainView.js index 8516c4d82..192c74b03 100644 --- a/BeWoPlanerMobil/Scripts/mainView.js +++ b/BeWoPlanerMobil/Scripts/mainView.js @@ -598,11 +598,10 @@ function validateServiceRecordBeforeSubmit() { } }); - for (var j = 0; j < relations.length; j++) { results = relations[j].ValidationResults; - var exitLoop = false; + for (var i = 0; i < results.length; i++) { if (exitLoop) { break; @@ -610,74 +609,101 @@ function validateServiceRecordBeforeSubmit() { switch (results[i].ResultType) { case 0: - var msg1 = 'An dem gewählten Datum \'' + vonDatum + '\' existiert bereits ein Eintrag (' + results[i].Message + ' bei Klient/in ' + results[i].CustomerName + '). Speichern nicht möglich.'; + // ServiceRecordOverlapping: ServiceRecord überschneidet sich mit einem anderen Eintrag + var msg1 = "An dem gewählten Datum '" + vonDatum + "' existiert bereits ein Eintrag (" + results[i].Message + " bei Klient/in " + results[i].CustomerName + "). Speichern nicht möglich."; if (allowOverlappingFLS === true) { - var r = confirm('An dem gewählten Datum \'' + vonDatum + '\' existiert bereits ein Eintrag (' + results[i].Message + ' bei Klient/in ' + results[i].CustomerName + '). Möchten Sie trotzdem speichern?'); + var r = confirm("An dem gewählten Datum '" + vonDatum + "' existiert bereits ein Eintrag (" + results[i].Message + " bei Klient/in " + results[i].CustomerName + "). Möchten Sie trotzdem speichern?"); isValidRecord = r; exitLoop = !isValidRecord; } else { - writeFatalErrorMessage(msg1); + alert(msg1); isValidRecord = false; exitLoop = true; } break; case 1: - var msg2 = 'An dem gewählten Datum ' + vonDatum + ' existiert bereits ein Eintrag für den ausgewählten Mitarbeiter(' + results[i].EmployeeName + '). Speichern nicht möglich.'; + // EmployeeOverlapping: Employee hat einen mit diesem Eintrag sich überschneidenden Eintrag + var msg2 = "An dem gewählten Datum " + vonDatum + " existiert bereits ein Eintrag von " + results[i].EmployeeName + "(" + results[i].Message + "). Speichern nicht möglich."; if (allowOverlappingFLS === true) { - var r2 = confirm('An dem gewählten Datum ' + vonDatum + ' existiert bereits ein Eintrag für den ausgewählten Mitarbeiter(' + results[i].EmployeeName + '). Möchten Sie trotzdem speichern?'); + var r2 = confirm("An dem gewählten Datum " + vonDatum + " existiert bereits ein Eintrag von " + results[i].EmployeeName + "(" + results[i].Message + "). Möchten Sie trotzdem speichern?"); isValidRecord = r2; exitLoop = !isValidRecord; } else { - writeFatalErrorMessage(msg2); + alert(msg2); isValidRecord = false; exitLoop = true; } break; case 2: - writeFatalErrorMessage('Das gewählte Datum ' + vonDatum.slice(0, 10) + ' liegt außerhalb des Zeitraumes des gewählten Hilfeplans. Speichern nicht möglich.'); + // OutsideOfSupportConcept: Der Eintrag liegt außerhalb des Hilfeplanzeitraumes + alert("Das gewählte Datum " + vonDatum.slice(0, 10) + " liegt außerhalb des Zeitraumes des gewählten Hilfeplans (" + relations[j].HilfePlanZeitraum + "). Speichern nicht möglich."); + //writeFatalErrorMessage("Das gewählte Datum " + vonDatum.slice(0, 10) + " liegt außerhalb des Zeitraumes des gewählten Hilfeplans (" + relations[j].HilfePlanZeitraum + "). Speichern nicht möglich."); isValidRecord = false; exitLoop = true; break; case 3: - var msg3 = 'Die für diesen Hilfeplan genehmigten FLS (' + results[i].ApprovedHours + ') werden mit diesem Eintrag überschritten. (' + results[i].HoursNew + ').'; + // ApprovedFLSOverspending: Die Anzahl der genehmigten FLS wird überschritten + var klient = "diesen Hilfeplan"; + if (results[i].CustomerName !== null && results[i].CustomerName.length >= 0) { + klient = "Klient/in " + results[i].CustomerName; + } + + var msg3 = "Die für " + klient + " genehmigten FLS (" + results[i].ApprovedHours + ") werden mit diesem Eintrag überschritten. (" + results[i].HoursNew + ")."; if (allowMoreFLSThanApproved === true) { var r3 = confirm(msg3 + " Möchten Sie trotzdem speichern?"); isValidRecord = r3; exitLoop = !isValidRecord; } else { - writeFatalErrorMessage(msg3); + alert(msg3); isValidRecord = false; exitLoop = true; } break; case 4: - writeFatalErrorMessage('Sie können keine neuen Leistungen für den ' + vonDatum + ' dokumentieren, da bereits der ' + meldungen.MaxDaysEditServiceRecordsAllowed + '. des nachfolgenden Monats überschritten ist.'); + // OutOfEditLimit: MaxDaysEditServiceRecordAllowed überschritten + alert("Sie können keine neuen Leistungen für den " + vonDatum + " dokumentieren, da bereits der " + meldungen.MaxDaysEditServiceRecordsAllowed + ". des nachfolgenden Monats überschritten ist."); isValidRecord = false; exitLoop = true; break; case 5: - writeFatalErrorMessage("Beim Speichern ist ein Fehler aufgetreten. Speichern nicht möglich."); + // Error: Ein genereller Fehler ist bei der Validierung aufgetreten + alert("Beim Speichern ist ein Fehler aufgetreten. Speichern nicht möglich."); isValidRecord = false; exitLoop = true; break; case 6: - var msg6 = "Es existiert bereits eine Spitzabrechnung. Um diesen Eintrag zu berücksichtigen, muss eventuell eine neue Spitzabrechnung erstellt werden. Das Speichern ist nicht möglich."; - if (bookAfterSettlementInvoice === true) { - msg6 = "Sie können den Eintrag nicht bearbeiten, da bereits eine Spitzabrechnung für diesen Hilfeplan erstellt wurde. Speichern nicht möglich."; + // SettlementInvoiceAlreadyExisting: Es existiert bereits eine Spitzabrechnung + var klient2 = "diesen Hilfeplan"; + if (results[i].CustomerName !== null && results[i].CustomerName.length >= 0) { + klient2 = "Klient/in " + results[i].CustomerName; } - writeFatalErrorMessage(msg6); + + var msg6 = "Es existiert bereits eine Spitzabrechnung für " + klient2 + ". Um diesen Eintrag zu berücksichtigen, muss eventuell eine neue Spitzabrechnung erstellt werden. Das Speichern ist nicht möglich."; + if (bookAfterSettlementInvoice === true) { + msg6 = "Sie können den Eintrag nicht bearbeiten, da bereits eine Spitzabrechnung für " + klient2 + " erstellt wurde. Speichern nicht möglich."; + } + alert(msg6); isValidRecord = false; exitLoop = true; break; case 7: - var msg7 = "Sie können keine neuen Leistungen dokumentieren, da die Frist zur Bearbeitung abgelaufen ist. Das Speichern ist nicht möglich."; - writeFatalErrorMessage(msg7); + // FristAbgelaufen: Die Frist zur Bearbeitung ist abgelaufen + var intervall = "einem Tag"; + + if (results[i].LimitFuerZeiterfassung !== "1") { + intervall = results[i].LimitFuerZeiterfassung + " Tagen"; + } + + var msg7 = "Sie können keine neuen Leistungen für den " + vonDatum + " dokumentieren, da die Zeiterfassung innerhalb von " + intervall + " erfolgen muss. Das Speichern ist nicht möglich."; + + alert(msg7); isValidRecord = false; exitLoop = true; break; default: - writeFatalErrorMessage(results[i].Message); + // Custom(8), da default: ServiceRecordValidationResult.Custom + alert(results[i].Message); isValidRecord = false; exitLoop = true; break; @@ -754,6 +780,7 @@ function initSignatureInfo(serviceRecordOid){ }); } +// Man kann nur eine fatale Fehlermeldung auf einmal anzeigen. Ein Aufruf dieser Methode bei einem bereits angezeigten Fehler führt dazu, dass das Popup wieder unsichtbar geschaltet wird. function writeFatalErrorMessage(msg, i) { toggleErrorPopup(msg, i); } diff --git a/BeWoPlanerMobil/Util/ServiceRecord2Validation.cs b/BeWoPlanerMobil/Util/ServiceRecord2Validation.cs new file mode 100644 index 000000000..5b7872789 --- /dev/null +++ b/BeWoPlanerMobil/Util/ServiceRecord2Validation.cs @@ -0,0 +1,19 @@ +using System.Collections.Generic; +using BS.Shared.DataContracts; + +namespace BeWoPlanerMobil.Util +{ + public class ServiceRecord2Validation + { + public ServiceRecordDC ServiceRecord { get; set; } + public List ValidationResults { get; set; } + public string HilfePlanZeitraum { get; } + + public ServiceRecord2Validation(ServiceRecordDC pServiceRecord, List pValidationResults, string pHilfePlanZeitraum) + { + ServiceRecord = pServiceRecord; + ValidationResults = pValidationResults; + HilfePlanZeitraum = pHilfePlanZeitraum; + } + } +} \ No newline at end of file diff --git a/BeWoPlanerMobil/Util/ValidationResult.cs b/BeWoPlanerMobil/Util/ValidationResult.cs new file mode 100644 index 000000000..621789fe5 --- /dev/null +++ b/BeWoPlanerMobil/Util/ValidationResult.cs @@ -0,0 +1,13 @@ +using System.Collections.Generic; + +namespace BeWoPlanerMobil.Util +{ + public class ValidationResult + { + public Dictionary Rights { get; set; } = new Dictionary(); + public string MaxDaysEditServiceRecordsAllowed { get; set; } + public string LimitFuerZeiterfassung { get; set; } = "0"; + + public List ServiceRecord2Validations { get; set; } = new List(); + } +} \ No newline at end of file diff --git a/BeWoPlanerMobil/Web.config b/BeWoPlanerMobil/Web.config index 42f97ecc5..380e28618 100644 --- a/BeWoPlanerMobil/Web.config +++ b/BeWoPlanerMobil/Web.config @@ -119,7 +119,7 @@ - + From f4e7d42d444688cf1dd87ae98497b52ae77e6d2e Mon Sep 17 00:00:00 2001 From: Lyndon Date: Mon, 10 Dec 2018 23:40:38 -0400 Subject: [PATCH 11/18] =?UTF-8?q?Die=20ServiceRecord-Validierung=20geschie?= =?UTF-8?q?ht=20jetzt=20ausschlie=C3=9Flich=20auf=20dem=20Server.=20Der=20?= =?UTF-8?q?Benutzer=20wird=20lediglich=20gefragt,=20ob=20trotz=20vorhanden?= =?UTF-8?q?er=20=C3=9Cberschneidungen=20etc.=20gespeichert=20werden=20soll?= =?UTF-8?q?,=20sofern=20er=20die=20Rechte=20dazu=20hat.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BeWoPlanerMobil/BeWoPlanerMobil.csproj | 1 + BeWoPlanerMobil/Content/BeWoMobileStyle.css | 147 +++-- BeWoPlanerMobil/Controllers/MainController.cs | 519 ++++++++++++++---- BeWoPlanerMobil/Scripts/gruppenbuchung.js | 49 +- BeWoPlanerMobil/Scripts/initialization.js | 62 ++- BeWoPlanerMobil/Scripts/mainView.js | 282 ++-------- .../Scripts/serviceRecordValidation.js | 104 ++++ BeWoPlanerMobil/Scripts/textbausteine.js | 12 +- BeWoPlanerMobil/Util/MobileUtils.cs | 46 ++ .../Util/ServiceRecord2Validation.cs | 5 +- BeWoPlanerMobil/Util/ValidationResult.cs | 11 +- BeWoPlanerMobil/Views/Main/Main.cshtml | 97 ++-- BeWoPlanerMobil/Views/Shared/_Layout.cshtml | 1 + Service/Plugins/PluginLoader.cs | 2 +- Service/Plugins/ServiceRecordValidator.cs | 7 +- Shared/DataContracts/ServiceRecordDC.cs | 4 +- 16 files changed, 795 insertions(+), 554 deletions(-) create mode 100644 BeWoPlanerMobil/Scripts/serviceRecordValidation.js diff --git a/BeWoPlanerMobil/BeWoPlanerMobil.csproj b/BeWoPlanerMobil/BeWoPlanerMobil.csproj index d487dd916..4812f262d 100644 --- a/BeWoPlanerMobil/BeWoPlanerMobil.csproj +++ b/BeWoPlanerMobil/BeWoPlanerMobil.csproj @@ -216,6 +216,7 @@ + diff --git a/BeWoPlanerMobil/Content/BeWoMobileStyle.css b/BeWoPlanerMobil/Content/BeWoMobileStyle.css index 8c3705983..fc14b6ea7 100644 --- a/BeWoPlanerMobil/Content/BeWoMobileStyle.css +++ b/BeWoPlanerMobil/Content/BeWoMobileStyle.css @@ -16,6 +16,11 @@ table { margin: 1em auto; } +button { + -webkit-border-radius: 0; + border-radius: 0; +} + hr { border: 0; height: 0; @@ -386,19 +391,19 @@ ul { right:0; } -#popupDiv, #errorPopupDiv,#SuccessPopupDiv,#AendernPopupDiv { - width:90%; - height: 20%; - background-color: #ffffff; - border: 1px solid #FF5A00; - display: none; - margin: auto; - position: absolute; +#popupDiv, #errorPopupDiv, #SuccessPopupDiv, #AendernPopupDiv, #validationPopupDiv { + width: 90%; + height: 20%; + background-color: #ffffff; + border: 1px solid #FF5A00; + display: none; + margin: auto; + position: absolute; z-index: 900; - top: 0; - left: 0; - bottom: 0; - right: 0; + top: 0; + left: 0; + bottom: 0; + right: 0; } .popupBtn{ @@ -681,81 +686,10 @@ input[type="checkbox"] { background-size: contain; } -article.infobox section { - position: absolute; - display: table-row; - width: 100%; - background-color: #ffffff; - top: 30px; -} - -article.infobox section textarea:focus { - border-color: #FF5A00; -} - -article.infobox section h2 { - position: absolute; - left: 0; - top: -30px; - - width: 25%; - height: 29px; - font-size: 12px; - font-weight: normal; - - margin: 0; - background-color: rgba(0, 0, 0, 0.1); - border-radius: 0 0 0 0; - border: double #ffffff; - border-width: 1px 1px 0 1px; - z-index: 0; - word-wrap: break-word; - border-color: rgba(0, 0, 0, 0.1); -} - -article.infobox section:nth-child(2) h2{ - left: 25%; - z-index: 1; -} - -article.infobox section:nth-child(3) h2{ - left: 50%; - z-index:2; -} - -article.infobox section:nth-child(4) h2{ - left: 75%; - z-index: 3; -} - -article.infobox section:nth-child(5) h2{ - left: 90%; - z-index: 4; -} - -article.infobox section h2 a { - display: block; - margin: 5px 0 0 0; - text-align: center; - text-decoration: none; - color:#000000; -} - -article.infobox section:target, article.infobox section:target h2 { - color: #000000; - z-index: 1; - background-color: #FFFFFF; - border-color:#FF5A00; -} - -article.infobox section:target h2 a { - color: #000000; - border-color:#FF5A00; -} - .documentationTextArea { height: 60px; display: none; + margin-top: 0; } .removeButton { @@ -897,5 +831,48 @@ article.infobox section:target h2 a { } #employeeCollapsible { - max-height: 50%; + overflow-y: auto; +} + +#employeePopupDiv { + overflow-y: hidden; +} + +/* Neue Dokumentationstabs */ +.doku-tab { + overflow: hidden; + margin-bottom: 0; + word-wrap: break-word; +} + +.doku-tab-link { + display: none; + padding: 10px 20px; + float: left; + border: none; + outline: none; + background-color: #e5e5e5; + width: 20%; + font-size: 13px; +} + +.doku-tab-link.active { + background-color: #ff5a00; + color: white; +} + +.doku-tab-link:disabled { + background-color: #e5e5e5; + color: black; +} + +.doku-tab-content { + display: none; +} + + +#validationPopupDiv { + height: auto; + z-index: 9999; + padding: 0 1.5em; } \ No newline at end of file diff --git a/BeWoPlanerMobil/Controllers/MainController.cs b/BeWoPlanerMobil/Controllers/MainController.cs index f45c2f4cc..83584d0b7 100644 --- a/BeWoPlanerMobil/Controllers/MainController.cs +++ b/BeWoPlanerMobil/Controllers/MainController.cs @@ -4,7 +4,7 @@ using System.Diagnostics; using System.Linq; using System.Text; using System.Web.Mvc; -using BeWo.Service.DCEntityMapper; + using BeWo.Service.ServiceImplementations; using BeWoPlanerMobil.Models; @@ -23,6 +23,7 @@ using BS.Shared.Services; using DevExpress.XtraScheduler; using DevExpress.XtraScheduler.Compatibility; +using static BS.Shared.ServiceRecordValidationResult; using ServiceRecordDC = BS.Shared.DataContracts.ServiceRecordDC; namespace BeWoPlanerMobil.Controllers @@ -158,6 +159,11 @@ namespace BeWoPlanerMobil.Controllers { LoadRecordsToModel(); } + + if (Model.SelectedEmployee == null) + { + Model.SelectedEmployee = MobileSessionFacade.LoggedInCompactEmployee; + } } catch (Exception e) { @@ -171,6 +177,11 @@ namespace BeWoPlanerMobil.Controllers [Authorize] public ActionResult SetShowOnlyOwnSupportConcepts(FormCollection collection) { + if (Model == null) + { + return RedirectToActionPermanent("Index", "Login"); + } + var newValue = "true,false" == collection["ShowOnlyOwnSupportConcepts"]; Model.ShowOnlyOwnSupportConcepts = newValue; @@ -182,6 +193,11 @@ namespace BeWoPlanerMobil.Controllers [Authorize] public ActionResult SetShowExpiredSupportConcepts(FormCollection pCollection) { + if (Model == null) + { + return RedirectToActionPermanent("Index", "Login"); + } + var newValue = "true,false" == pCollection["ShowExpiredSupportConcepts"]; Model.ShowExpiredSupportConcepts = newValue; @@ -191,6 +207,12 @@ namespace BeWoPlanerMobil.Controllers public ActionResult UpdateSettings(string pKey, string pValue) { + if (Model == null) + { + RedirectToActionPermanent("Index", "Login"); + return null; + } + var userSettings = GetUser().Settings; UserSettingsUtils.SetSettingValue(SettingsType.ApplicationSettings, pKey, pValue, userSettings); @@ -211,7 +233,8 @@ namespace BeWoPlanerMobil.Controllers { if (Model == null) { - return "SessionTimeout"; + RedirectToActionPermanent("Index", "Login"); + return null; } var sc = Model.SupportConcepts.FirstOrDefault(f => f.CostBearerRelations.Any(cbr => cbr.CostBearer2SupportConceptOid.HasValue && cbr.CostBearer2SupportConceptOid.Value.Equals(pCostbearer2SupportConceptOid))); @@ -305,8 +328,15 @@ namespace BeWoPlanerMobil.Controllers } } + [Authorize] public string LoadBWPSettings() { + if (Model == null) + { + RedirectToActionPermanent("Index", "Login"); + return null; + } + var m = OperationsService.GetMandator(); var time = MobileUtils.GetSettingValue(m.Settings, "TimeUntilUILock"); @@ -315,6 +345,12 @@ namespace BeWoPlanerMobil.Controllers public string CheckEndDate() { + if (Model == null) + { + RedirectToActionPermanent("Index", "Login"); + return null; + } + var m = OperationsService.GetMandator(); var endtime = MobileUtils.GetSettingValue(m.Settings, "IsEndDateVisible"); @@ -323,6 +359,12 @@ namespace BeWoPlanerMobil.Controllers public string CheckOnlyYearMonth() { + if (Model == null) + { + RedirectToActionPermanent("Index", "Login"); + return null; + } + var m = OperationsService.GetMandator(); var yearMonth = MobileUtils.GetSettingValue(m.Settings, "IsOnlyYearMonthVisible"); @@ -331,6 +373,12 @@ namespace BeWoPlanerMobil.Controllers public string CheckIsZeiterfassDateNormal() { + if (Model == null) + { + RedirectToActionPermanent("Index", "Login"); + return null; + } + var m = OperationsService.GetMandator(); var normal = MobileUtils.GetSettingValue(m.Settings, "IsZeiterfassDateNormal"); @@ -339,6 +387,12 @@ namespace BeWoPlanerMobil.Controllers public string CheckIsZeiterfassungInStdMin() { + if (Model == null) + { + RedirectToActionPermanent("Index", "Login"); + return null; + } + var m = OperationsService.GetMandator(); var zeiterInStdMin = MobileUtils.GetSettingValue(m.Settings, "IsZeiterfassungInStdMin"); @@ -347,6 +401,12 @@ namespace BeWoPlanerMobil.Controllers public string CheckDokuReiter() { + if (Model == null) + { + RedirectToActionPermanent("Index", "Login"); + return null; + } + return SerializeObject(Model.Dokutypes); } @@ -370,10 +430,11 @@ namespace BeWoPlanerMobil.Controllers { try { - + if (Model == null) { - return "SessionTimeout"; + RedirectToActionPermanent("Index", "Login"); + return null; } var date = DateTime.ParseExact(newtoday, "dd.MM.yyyy", null); @@ -470,9 +531,10 @@ namespace BeWoPlanerMobil.Controllers { try { - if(Model == null) + if (Model == null) { - return "SessionTimeout"; + RedirectToActionPermanent("Index", "Login"); + return null; } var supportConceptStatistics = OperationsService.CreateSupportConceptStatistics(oid, DateTime.Now); @@ -493,7 +555,8 @@ namespace BeWoPlanerMobil.Controllers { if (Model == null) { - SerializeObject("SessionTimeout"); + RedirectToActionPermanent("Index", "Login"); + return; } var date = DateTime.Parse(day); @@ -523,7 +586,8 @@ namespace BeWoPlanerMobil.Controllers { if (Model == null) { - SerializeObject("SessionTimeout"); + RedirectToActionPermanent("Index", "Login"); + return; } var date = DateTime.Parse(pStartDate); @@ -542,13 +606,14 @@ namespace BeWoPlanerMobil.Controllers Originator = MobileSessionFacade.LoggedInCompactEmployee }; - var newE2S = new Employee2SchedulerAppointmentDC(); - newE2S.Employee = MobileSessionFacade.LoggedInCompactEmployee; + var newE2S = new Employee2SchedulerAppointmentDC + { + Employee = MobileSessionFacade.LoggedInCompactEmployee + }; newApp.EmployeeList.Add(newE2S); - var list = new List(); - list.Add(newApp); + var list = new List {newApp}; //var a1 = new List { // new SchedulerAppointmentDC // { @@ -579,7 +644,8 @@ namespace BeWoPlanerMobil.Controllers { if (Model == null) { - return "SessionTimeout"; + RedirectToActionPermanent("Index", "Login"); + return null; } var date = DateTime.ParseExact(newtoday, "dd.MM.yyyy", null); @@ -603,7 +669,8 @@ namespace BeWoPlanerMobil.Controllers { if (Model == null) { - SerializeObject("SessionTimeout"); + RedirectToActionPermanent("Index", "Login"); + return; } var date = DateTime.Parse(zeitstempel); @@ -630,7 +697,8 @@ namespace BeWoPlanerMobil.Controllers { if (Model == null) { - return SerializeObject("SessionTimeout"); + RedirectToActionPermanent("Index", "Login"); + return null; } Model.SaveSignature = save; @@ -645,7 +713,13 @@ namespace BeWoPlanerMobil.Controllers public string LoadServiceCategories(long pServiceCategoryOid) { - try + if (Model == null) + { + RedirectToActionPermanent("Index", "Login"); + return null; + } + + try { var scm = Model?.ServiceCategories.FirstOrDefault(s => s.ServiceCategoryOid.Value == pServiceCategoryOid); @@ -661,6 +735,12 @@ namespace BeWoPlanerMobil.Controllers [Authorize] public string LoadTextbausteineForServiceCategory(long pServiceCategoryOid) { + if (Model == null) + { + RedirectToActionPermanent("Index", "Login"); + return null; + } + try { if (!MobileSessionFacade.CheckForUserRight(UserRightType.TextbausteineNurEigeneAnsehen) && !MobileSessionFacade.CheckForUserRight(UserRightType.TextbausteineAlleAnsehen)) @@ -709,6 +789,12 @@ namespace BeWoPlanerMobil.Controllers public string LoadCompleteTextbausteinByOid(long pTextbausteinOid) { + if (Model == null) + { + RedirectToActionPermanent("Index", "Login"); + return null; + } + var abc = Model.Textbausteine.FirstOrDefault(f => f.TextModuleOid.HasValue && f.TextModuleOid.Value == pTextbausteinOid); return abc?.Text; @@ -718,14 +804,13 @@ namespace BeWoPlanerMobil.Controllers { try { - if (Model == null) + if (Model == null) { - SerializeObject("SessionTimeout"); - } - else - { - Model.ErrorWert = errorwert; + RedirectToActionPermanent("Index", "Login"); + return; } + + Model.ErrorWert = errorwert; } catch (Exception e) { @@ -891,12 +976,12 @@ namespace BeWoPlanerMobil.Controllers Model.NewServiceRecord.ServiceRecordFormat = ServiceRecordFormate.OriginaleZeiterfassung; - Model.NewServiceRecord.Notice = doku1 == string.Empty ? null : doku1; + Model.NewServiceRecord.Notice = string.IsNullOrEmpty(doku1) ? null : doku1; - Model.NewServiceRecord.Notice2 = doku2 == string.Empty ? null : doku2; - Model.NewServiceRecord.Notice3 = doku3 == string.Empty ? null : doku3; - Model.NewServiceRecord.Notice4 = doku4 == string.Empty ? null : doku4; - Model.NewServiceRecord.Notice5 = doku5 == string.Empty ? null : doku5; + Model.NewServiceRecord.Notice2 = string.IsNullOrEmpty(doku2) ? null : doku2; + Model.NewServiceRecord.Notice3 = string.IsNullOrEmpty(doku3) ? null : doku3; + Model.NewServiceRecord.Notice4 = string.IsNullOrEmpty(doku4) ? null : doku4; + Model.NewServiceRecord.Notice5 = string.IsNullOrEmpty(doku5) ? null : doku5; var serviceDescOid = 0L; @@ -1357,52 +1442,6 @@ namespace BeWoPlanerMobil.Controllers } } } - - private static ServiceRecordDC CloneServiceRecordForGroupBooking(ServiceRecordDC pOriginal) - { - var m = pOriginal; - - var clone = new ServiceRecordDC - { - 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 - }; - - return clone; - } [Authorize] public ActionResult SaveZeiterfassungAfterCrash(string pDatum, string pStartDate, string pEndDate, string pDuration, string pNotice, string pServiceDescription, string pNotice2, string pNotice3, string pNotice4, string pNotice5, string pEndDate2) @@ -1699,7 +1738,7 @@ namespace BeWoPlanerMobil.Controllers if (Model == null) { RedirectToActionPermanent("Index", "Login"); - return " "; + return null; } Model.SelectedServiceDescriptionOid = pServiceDescriptionOid; @@ -1730,7 +1769,13 @@ namespace BeWoPlanerMobil.Controllers private void LoadRecordsToModel() { - if(Model.Zeitraum < 0 || Model.CostBearer2SupportConceptOid.HasValue && Model.CostBearer2SupportConceptOid.Value == -1) + if (Model == null) + { + RedirectToActionPermanent("Index", "Login"); + return; + } + + if (Model.Zeitraum < 0 || Model.CostBearer2SupportConceptOid.HasValue && Model.CostBearer2SupportConceptOid.Value == -1) { Model.ServiceRecords = new List(); return; @@ -1833,6 +1878,12 @@ namespace BeWoPlanerMobil.Controllers public string GetSelectedRecordInformation() { + if (Model == null) + { + RedirectToActionPermanent("Index", "Login"); + return null; + } + var result = string.Empty; if (Model.SelectedServiceRecordOid.HasValue) @@ -1845,16 +1896,24 @@ namespace BeWoPlanerMobil.Controllers public string GetSelectedRecordInformationWithOid(long oid) { + if (Model == null) + { + RedirectToActionPermanent("Index", "Login"); + return null; + } + LoadRecordsToModel(); return SerializeObject(Model.ServiceRecords.First(f => f.ServiceRecordOid == oid)); } + [Authorize] public string CheckRights(string von, string bis, bool inEditMode, string dateString, string startString, string endString) - { + { if (Model == null) { - return "SessionTimeout"; + RedirectToActionPermanent("Index", "Login"); + return null; } log.Info($"CheckRights: von:{von};bis:{bis};inEditMode:{inEditMode};dateString:{dateString};startString:{startString};endString:{endString}"); @@ -1898,10 +1957,14 @@ namespace BeWoPlanerMobil.Controllers checkSR.Start = startDt; checkSR.End = endDt; - if (Model.Employee.EmployeeOid != null) + checkSR.IP = Request.UserHostAddress; + + checkSR.ServiceDescription = OperationsService.GetServiceDescription(Model.SelectedServiceDescriptionOid.Value); + + checkSR.Employee = Model.SelectedEmployee ?? MobileSessionFacade.LoggedInCompactEmployee; + + if (Model.SelectedEmployee != null && !Model.IsInGroupBookingMode) { - checkSR.Employee = MobileSessionFacade.LoggedInCompactEmployee; - var sc = Model.SupportConcepts.FirstOrDefault(fod => fod.CostBearerRelations.Any(a => a.CostBearer2SupportConceptOid.HasValue && a.CostBearer2SupportConceptOid.Value.Equals(Model.CostBearer2SupportConceptOid))); if (sc != null) @@ -1918,26 +1981,25 @@ namespace BeWoPlanerMobil.Controllers if (intervall > 0) { - checkSR.RoundedDuration = dauer % intervall != 0 ? dauer + (intervall - (dauer % intervall)) : dauer; + checkSR.RoundedDuration = dauer % intervall != 0 ? dauer + (intervall - dauer % intervall) : dauer; } checkSR.CostBearer2SupportConceptOid = Model.CostBearer2SupportConceptOid; } } - checkSR.IP = Request.UserHostAddress; - checkSR.InsertedOn = DateTime.Now; - checkSR.InsUser = $"{MobileSessionFacade.LoggedInEmployee.FirstName} {MobileSessionFacade.LoggedInEmployee.LastName}"; - - checkSR.ServiceDescription = OperationsService.GetServiceDescription(Model.SelectedServiceDescriptionOid.Value); - 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 ? limitFuerZeiterfassungSetting.Split('=')[1] : "0"; + var limitFuerZeiterfassung = limitFuerZeiterfassungSetting != null ? int.Parse(limitFuerZeiterfassungSetting.Split('=')[1]) : 0; + + if (MobileSessionFacade.CheckForUserRight(UserRightType.ServiceRecord_AllowEditAfterMaxDaysInNextMonth)) + { + maxDaysEditSRsAllowed = -1; + } SupportConceptStatisticsDC stats = null; @@ -1948,7 +2010,10 @@ namespace BeWoPlanerMobil.Controllers var employees = new List {checkSR.Employee.EmployeeOid}; - var newResult = new ValidationResult(); + var validationResults = new List(); + + checkSR.ServiceRecordFormat = ServiceRecordFormate.OriginaleZeiterfassung; + checkSR.DurationInStunden = ZeiterfassungsDauer.Minuten; string dateRangeString; @@ -1967,33 +2032,21 @@ namespace BeWoPlanerMobil.Controllers var cb2scOids = (from scDc in Model.SelectedSupportConcepts where scDc.CostBearerRelations != null && scDc.CostBearerRelations.Count > 0 select scDc.CostBearerRelations[0].CostBearer2SupportConceptOid.Value).ToList(); - var nodes = new List(); - foreach (var sc in CustomerService.LoadCompactSupportConceptsById(Model.SelectedSupportConcepts.Select(s => s.SupportConceptOid.Value))) + var relations = CustomerService.GetSupportConceptCostBearerRelationsById(cb2scOids); + + foreach (var rel in relations) { - nodes.Add(CreateFlatSupportConceptItem(sc, null)); - } + var sr = CloneServiceRecordForGroupBooking(checkSR); - foreach (var node in nodes) - { - if (node?.SupportConceptTreeNodeDC != null) - { - var scDc = node.SupportConceptTreeNodeDC.SupportConcept; - var cbDc = node.SupportConceptTreeNodeDC.CostBearer; - var relDc = node.SupportConceptTreeNodeDC.SupportConceptCostBearerRelDC; + sr.SupportConcept = rel.SupportConcept; + sr.CostBearer = rel.CostBearer; + sr.CostBearer2SupportConceptOid = rel.CostBearer2SupportConceptOid; + - checkSR.SupportConcept = scDc; - checkSR.CostBearer = cbDc; + var result = OperationsService.ValidateServiceRecord(sr, null, maxDaysEditSRsAllowed, employees, cb2scOids); + dateRangeString = rel.DateRangeString; - if (relDc != null) - { - checkSR.CostBearer2SupportConceptOid = relDc.CostBearer2SupportConceptOid; - } - } - - var result = OperationsService.ValidateServiceRecord(checkSR, stats, maxDaysEditSRsAllowed, employees, cb2scOids); - dateRangeString = node?.SupportConceptTreeNodeDC != null ? node.SupportConceptTreeNodeDC.SupportConceptCostBearerRelDC.DateRangeString : ""; - - newResult.ServiceRecord2Validations.Add(new ServiceRecord2Validation(checkSR, result, dateRangeString)); + validationResults.Add(new ServiceRecord2Validation(sr, result, dateRangeString)); } } else @@ -2002,15 +2055,142 @@ namespace BeWoPlanerMobil.Controllers dateRangeString = node?.SupportConceptTreeNodeDC != null ? node.SupportConceptTreeNodeDC.SupportConceptCostBearerRelDC.DateRangeString : ""; var result = OperationsService.ValidateServiceRecordEntry(checkSR, stats, maxDaysEditSRsAllowed, checkSR.GroupOid.HasValue, employees); - newResult.ServiceRecord2Validations.Add(new ServiceRecord2Validation(checkSR, result, dateRangeString)); + validationResults.Add(new ServiceRecord2Validation(checkSR, result, dateRangeString)); } - - newResult.MaxDaysEditServiceRecordsAllowed = maxDaysEditSRsAllowed.ToString(); - newResult.LimitFuerZeiterfassung = limitFuerZeiterfassung; - newResult.Rights.Add(0, MobileSessionFacade.LoggedInUser.UserGroups.Any(a => a.Rights.Any(f => f.RightType.Equals(UserRightType.ServiceRecord_AllowCreateOverlappingFLS)))); - newResult.Rights.Add(1, MobileSessionFacade.LoggedInUser.UserGroups.Any(a => a.Rights.Any(f => f.RightType.Equals(UserRightType.ServiceRecord_AllowCreateMoreFLSThanApproved)))); - newResult.Rights.Add(2, MobileSessionFacade.LoggedInUser.UserGroups.Any(a => a.Rights.Any(f => f.RightType.Equals(UserRightType.BookServiceRecordAfterSettlementInvoice)))); + var allowOverlappingFLS = MobileSessionFacade.CheckForUserRight(UserRightType.ServiceRecord_AllowCreateOverlappingFLS); + var allowMoreFLSThanApproved = MobileSessionFacade.CheckForUserRight(UserRightType.ServiceRecord_AllowCreateMoreFLSThanApproved); + var bookAfterSettlementInvoice = MobileSessionFacade.CheckForUserRight(UserRightType.BookServiceRecordAfterSettlementInvoice); + + var newResult = new ValidationResult(); + var exitLoop = false; + foreach (var sr2v in validationResults) + { + if(exitLoop) + { + break; + } + + foreach (var vr in sr2v.ValidationResults) + { + if (exitLoop) + { + break; + } + + 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 + "). Möchten Sie trotzdem speichern?
"; + exitLoop = false; + } + else + { + newResult.Message += "An dem gewählten Datum '" + von + "' existiert bereits ein Eintrag (" + vr.Message + " bei Klient/in " + vr.CustomerName + "). Speichern nicht möglich.
"; + exitLoop = true; + newResult.KannTrotzdemGespeichertWerden = false; + } + break; + case EmployeeOverlapping: + if (allowOverlappingFLS) + { + newResult.Message += "An dem gewählten Datum " + von + " existiert bereits ein Eintrag von " + vr.EmployeeName + " (" + vr.Message + "). Möchten Sie trotzdem speichern?
"; + exitLoop = false; + newResult.KannTrotzdemGespeichertWerden = true; + } + else + { + newResult.Message += "An dem gewählten Datum " + von + " existiert bereits ein Eintrag von " + vr.EmployeeName + " (" + vr.Message + "). Speichern nicht möglich.
"; + + 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 + "). Speichern nicht möglich.
"; + + newResult.KannTrotzdemGespeichertWerden = false; + exitLoop = true; + break; + case ApprovedFLSOverspending: + var klient = "diesen Hilfeplan"; + if (!string.IsNullOrEmpty(vr.CustomerName)) + { + klient = "Klient/in " + vr.CustomerName; + } + + var msg = "Die für " + klient + " genehmigten FLS (" + vr.ApprovedHours + ") werden mit diesem Eintrag überschritten. (" + vr.HoursNew + ")."; + if (allowMoreFLSThanApproved) + { + newResult.Message += msg + " Möchten Sie trotzdem speichern?
"; + exitLoop = false; + newResult.KannTrotzdemGespeichertWerden = true; + } + else + { + newResult.Message += msg + " Speichern nicht möglich.
"; + exitLoop = true; + newResult.KannTrotzdemGespeichertWerden = false; + } + + 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. Speichern nicht möglich.
"; + exitLoop = true; + newResult.KannTrotzdemGespeichertWerden = false; + + break; + case Error: + newResult.Message += "Beim Speichern ist ein Fehler aufgetreten. Speichern nicht möglich.
"; + exitLoop = true; + newResult.KannTrotzdemGespeichertWerden = false; + + break; + case SettlementInvoiceAlreadyExisting: + var klient2 = "diesen Hilfeplan"; + if(!string.IsNullOrEmpty(vr.CustomerName)) + { + klient2 = "Klient/in " + vr.CustomerName; + } + + 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. Möchten Sie trotzdem speichern?
"; + exitLoop = false; + newResult.KannTrotzdemGespeichertWerden = true; + } + else + { + newResult.Message += "Sie können den Eintrag nicht bearbeiten, da bereits eine Spitzabrechnung für " + klient2 + " erstellt wurde. Speichern nicht möglich.
"; + exitLoop = true; + newResult.KannTrotzdemGespeichertWerden = false; + } + + break; + case FristAbgelaufen: + var intervall = "einem Tag"; + if (limitFuerZeiterfassung != 1) + { + intervall = "" + limitFuerZeiterfassung + " Tagen"; + } + + newResult.Message += "Sie können keine neuen Leistungen für den " + von + " dokumentieren, da die Zeiterfassung innerhalb von " + intervall + " erfolgen muss. Das Speichern ist nicht möglich.
"; + exitLoop = true; + newResult.KannTrotzdemGespeichertWerden = false; + + break; + case Custom: + newResult.Message += vr.Message + "
"; + + exitLoop = true; + newResult.KannTrotzdemGespeichertWerden = false; + break; + } + } + } Model.NewServiceRecord = new ServiceRecordDC(); @@ -2264,6 +2444,8 @@ namespace BeWoPlanerMobil.Controllers Model.SelectedEmployees.Clear(); Model.SelectedSupportConcepts.Clear(); + Model.SelectedEmployee = MobileSessionFacade.LoggedInCompactEmployee; + if (Model.SelectedSupportConcept != null) { var details = OperationsService.GetSupportConceptTreeNodeDetailInfo(Model.SelectedSupportConcept.Customer.CustomerOid, Model.SelectedSupportConcept.SupportConceptOid, Model.CostBearer2SupportConceptOid); @@ -2429,5 +2611,104 @@ namespace BeWoPlanerMobil.Controllers return MainModel.IsEmployeeSelectionVisible.ToString(); } + + private IEnumerable CalculateGroupBookingDuration(int pEmployeeCount, int pCustomerCount, ICollection cb2ScOids, ServiceRecordDC pBaseRecord) + { + var compactSupportConcepts = CustomerServiceImp.GetCompactSupportConcepts((from sc in Model.SelectedSupportConcepts where sc.SupportConceptOid != null select sc.SupportConceptOid.Value).ToList(), GetUser().Employee.EmployeeOid); + + var nodes = (from supportConcept in Model.SelectedSupportConcepts let cb = supportConcept.CostBearerRelations.FirstOrDefault(f => cb2ScOids.Contains(f.CostBearer2SupportConceptOid.Value)) let sc = compactSupportConcepts.FirstOrDefault(f => f.SupportConceptOid == supportConcept.SupportConceptOid) where cb != null && sc != null select SupportConceptService.CreateFlatSupportConceptItem(sc, CustomerService.LoadOrganisationCompact(cb.CostBearer.OrganisationOid))).ToList(); + + var list = new List(); + foreach(var node in nodes) + { + var sc = CloneServiceRecordForGroupBooking(pBaseRecord); + + if(pBaseRecord.RoundedDuration == 0) + { + if(pBaseRecord.Start.HasValue && pBaseRecord.End.HasValue) + { + var minutes = pBaseRecord.End.Value.Subtract(pBaseRecord.Start.Value).TotalMinutes; + + pBaseRecord.RoundedDuration = (decimal)minutes; + } + } + + sc.GroupRoundedDuration = pBaseRecord.RoundedDuration; + + sc.CostBearer2SupportConceptOid = node.SupportConceptTreeNodeDC.SupportConceptCostBearerRelDC.CostBearer2SupportConceptOid; + + sc.SupportConcept = node.SupportConceptTreeNodeDC.SupportConcept; + + sc.CostBearer = node.SupportConceptTreeNodeDC.CostBearer; + + sc.Customer = node.SupportConceptTreeNodeDC.Customer; + + sc.GroupEmployeeCount = pEmployeeCount; + + sc.GroupPersonCount = pCustomerCount; + + list.Add(sc); + } + + var roundDuration = false; + var minuteInterval = 0; + string calcdId = null; + var lastMinuteInterval = -1; + + if(Model.SelectedServiceDescriptionOid.HasValue && IsBillable(Model.SelectedServiceDescriptionOid.Value, Model.GetServiceDesctiptions())) + { + roundDuration = true; + + foreach(var org in from dc in Model.SelectedSupportConcepts where dc.CostBearerRelations.Count > 0 select dc.CostBearerRelations.First().CostBearer) + { + if(org != null) + { + minuteInterval = org.ActualMinuteIntervall; + + if(lastMinuteInterval == -1) + { + lastMinuteInterval = minuteInterval; + calcdId = org.CostBearerID; + } + else if(lastMinuteInterval != minuteInterval) + { + roundDuration = false; + } + } + else if(minuteInterval >= 0) + { + roundDuration = false; + } + else + { + minuteInterval = 0; + } + } + } + + var duration = Model.NewServiceRecord.RoundedDuration; + var totalDuration = duration; + + var groupDuration = OperationsService.CalculateGroupDuration2(pCustomerCount, pEmployeeCount, Model.NewServiceRecord.RoundedDuration, nodes.Select(s => s.SupportConceptTreeNodeDC.SupportConceptCostBearerRelDC.CostBearer2SupportConceptOid.Value).ToArray()); + + if(groupDuration != null) + { + pBaseRecord.GroupRoundedDuration = groupDuration.TotalDuration; + pBaseRecord.RoundedDuration = groupDuration.SingleDuration; + } + else + { + if(minuteInterval > 0 && roundDuration) + { + var calc = Calculations.GetInstance(calcdId); + totalDuration = calc.GetRoundedDuration(minuteInterval, duration); + } + + pBaseRecord.RoundedDuration = Math.Round(totalDuration / pCustomerCount, 0, MidpointRounding.AwayFromZero); + pBaseRecord.GroupRoundedDuration = totalDuration; + } + + return list; + } } } diff --git a/BeWoPlanerMobil/Scripts/gruppenbuchung.js b/BeWoPlanerMobil/Scripts/gruppenbuchung.js index 888003ea8..63e36c7d6 100644 --- a/BeWoPlanerMobil/Scripts/gruppenbuchung.js +++ b/BeWoPlanerMobil/Scripts/gruppenbuchung.js @@ -1,8 +1,6 @@ function selectGroupBookingForEditing(serviceRecordOid) { hideSanduhr(); - console.log("Gruppenbuchung wird bearbeitet"); - setGroupEditingFlag(true); $("#editGroupServiceRecord_" + serviceRecordOid).submit(); @@ -39,7 +37,8 @@ function getGroupEditingFlag() { return flagData.obj || {}; } -/* NEUE GRUPPENBUCHUNG */ + + function hideGroupBookingPopup() { var btn = $("#groupBookingOpenPopupBtn"); var container = $("#groupBookingPopupDivContainer"); @@ -48,12 +47,12 @@ function hideGroupBookingPopup() { var rightContent = $("#rightContent"); var leftContent = $("#leftContent"); - hideElement(container); - hideElement(popup); - hideElement(collapsible); + container.hide(); + popup.hide(); + collapsible.hide(); - hideElement(rightContent); - hideElement(leftContent); + rightContent.hide(); + leftContent.hide(); btn.css("background-image", "url('../Content/images/toggle-icon-d.svg')"); } @@ -70,9 +69,8 @@ function openGroupBookingDiv() { var popup = $("#groupBookingPopupDiv"); - showElement(container); - showElement(popup); - + container.show(); + popup.show(); btn.css("background-image", "url('../Content/images/toggle-icon-u.svg')"); @@ -84,7 +82,7 @@ function openGroupBookingDiv() { popup.css("top", parseInt(sum) + "px"); popup.css("width", (btn.innerWidth() - 2) + "px"); - showElement(collapsible); + collapsible.show(); openGroupBookingTab(true); } @@ -98,13 +96,13 @@ function openGroupBookingTab(isSupportConceptTab) { if (isSupportConceptTab) { leftBtn.addClass("active"); rightBtn.removeClass("active"); - showElement(leftContent); - hideElement(rightContent); + leftContent.show(); + rightContent.hide(); } else { rightBtn.addClass("active"); leftBtn.removeClass("active"); - showElement(rightContent); - hideElement(leftContent); + rightContent.show(); + leftContent.hide(); } } @@ -115,10 +113,9 @@ function addSupportConcepts() { $("#groupBookingSupportConceptSelectionForm").submit(); } -/* ------------------- */ -/* NEUE MITARBEITERMEHRFACHAUSWAHL */ + function openEmployeePopup() { var container = $("#employeePopupContainer"); @@ -131,8 +128,8 @@ function openEmployeePopup() { var collapsible = $("#employeeCollapsible"); var popup = $("#employeePopupDiv"); - showElement(container); - showElement(popup); + container.show(); + popup.show(); btn.css("background-image", "url('../Content/images/toggle-icon-u.svg')"); @@ -143,8 +140,11 @@ function openEmployeePopup() { popup.css("top", parseInt(sum) + "px"); popup.css("width", (btn.innerWidth() - 2) + "px"); + popup.css("max-width", (btn.innerWidth() - 2) + "px"); - showElement(collapsible); + collapsible.height(($(window).height() / 2) + "px"); + + collapsible.show(); } function hideEmployeePopup() { @@ -158,9 +158,9 @@ function hideEmployeePopup() { var collapsible = $("#employeeCollapsible"); var popup = $("#employeePopupDiv"); - hideElement(container); - hideElement(popup); - hideElement(collapsible); + container.hide(); + popup.hide(); + collapsible.hide(); btn.css("background-image", "url('../Content/images/toggle-icon-d.svg')"); } @@ -172,4 +172,3 @@ function addEmployees() { $("#groupBookingEmployeeSelectionForm").submit(); } -/* ------------------------------- */ \ No newline at end of file diff --git a/BeWoPlanerMobil/Scripts/initialization.js b/BeWoPlanerMobil/Scripts/initialization.js index e492f8f02..9de200e38 100644 --- a/BeWoPlanerMobil/Scripts/initialization.js +++ b/BeWoPlanerMobil/Scripts/initialization.js @@ -94,7 +94,7 @@ function initBeWoMobile(actionPath) { toggleSelectClassesForElement("#recordLoader_select", "#record-loader-select-container"); toggleSelectClassesForElement("#textbausteine_select", "#textbausteine-select-container"); - var selectedServiceCategory = $($("#scDropDown")).find(":selected").val(); + var selectedServiceCategory = $("#scDropDown").find(":selected").val() if(isInGroupBookingMode() && isInEditingMode()) { if(getGroupEditingFlag().flag === false) { @@ -164,10 +164,10 @@ function initBeWoMobile(actionPath) { }); var supportConceptTableHasEntries = $("#leftContent input:checked").length; - var employeesTableHasEntries = $("#rightContent input:checked").length; + var employeesTableHasEntries = $("#employeeCollapsible input:checked").length; if (isInGroupBookingMode()) { - var value = (supportConceptTableHasEntries === 0 || employeesTableHasEntries === 0) ? false : true; + var value = supportConceptTableHasEntries > 0 && employeesTableHasEntries > 0 ? false : true; $("#anlegenEditierenBtn").prop("disabled", value); } @@ -254,14 +254,18 @@ function loadSettingsAccordingToBWP() { } function initializeDocumentationTextareas() { - $.ajax({ - type: "GET", - url: CheckDokuReiterUrl, - success: function (json) { - var documentationTypes = $.parseJSON(json); - numberOfDocumentationTypes = documentationTypes.length; + makeAjaxCall( + "GET", + CheckDokuReiterUrl, + function (json) { + var dokuTypes = $.parseJSON(json); - if(numberOfDocumentationTypes === 0) { + numberOfDocumentationTypes = dokuTypes.length; + + var tabWidth = 100 / numberOfDocumentationTypes; + $(".doku-tab-link").css("width", tabWidth + "%"); + + if (numberOfDocumentationTypes === 0) { $("#tddokureiter").css("display", "none"); $("#trnormalDoku").css("display", "table-row"); window.focusedDokuTextarea = $("#notiz_textbox"); @@ -269,28 +273,44 @@ function initializeDocumentationTextareas() { window.focusedDokuTextarea = $("#notiz_textbox1"); } - if(numberOfDocumentationTypes === 1) { + if (numberOfDocumentationTypes === 1) { $("#tddokureiter").css("display", "none"); $("#trnormalDoku").css("display", "table-row"); - $("#trnormalDokuLabel").text(documentationTypes[0].TypeDescription); + $("#trnormalDokuLabel").text(dokuTypes[0].TypeDescription); } - if(numberOfDocumentationTypes > 1) { - for(var i = 0; i < numberOfDocumentationTypes; i++) { + if (numberOfDocumentationTypes > 1) { + var height = 0; + + for (var i = 0; i < numberOfDocumentationTypes; i++) { var idNumber = i + 1; - $('#DokName' + idNumber).text(documentationTypes[i].TypeDescription); - $('#Dokumentation' + idNumber).css("display", "block"); + var dokuTab = $("#doku-name-" + idNumber); + + dokuTab.html(dokuTypes[i].TypeDescription); + showElement(dokuTab); + + var outerHeight = dokuTab.outerHeight(); + + if (outerHeight > height) { + height = outerHeight; + } } + + $(".doku-tab-link").css("height", height + "px"); } - if(numberOfDocumentationTypes > 0) { - focusOnTab(1); + if (numberOfDocumentationTypes > 0) { + focusOnDoku(1); } - } - }); + }, + null, + null + ); } + +// Formulardaten im Browser speichern, um nach einem erneuten Laden der Seite (z.B. beim Hinzufügen von Hilfeplänen bzw. Gruppen oder Mitarbeitern) die Daten wiederherzustellen. var savedEditFormValues = {}; $(document).on("change", ".edit-form-input", @@ -298,8 +318,6 @@ $(document).on("change", ".edit-form-input", saveFormValuesLocally(); }); -//$(document).change(function() { console.log("test"); }); - function saveFormValuesLocally() { var recordObject = { category: $("#kategorien_select").val(), diff --git a/BeWoPlanerMobil/Scripts/mainView.js b/BeWoPlanerMobil/Scripts/mainView.js index 192c74b03..d22ac4089 100644 --- a/BeWoPlanerMobil/Scripts/mainView.js +++ b/BeWoPlanerMobil/Scripts/mainView.js @@ -43,7 +43,7 @@ var collapsibleHtml; function buildGoalTreeItem(goalItem, selectedGoalOids) { var goalOid = goalItem.ValueListEntryOid; var goalHeader = goalItem.Header; - var isChecked = selectedGoalOids != null && isElementInArray(selectedGoalOids, goalOid) ? "checked" : ""; + var isChecked = selectedGoalOids !== null && isElementInArray(selectedGoalOids, goalOid) ? "checked" : ""; if (!goalItem.IsLeaf) { //collapsibleHtml += ''; @@ -354,8 +354,8 @@ function selectServiceRecord(oid) { showElement($("#singleSCEmployeeSelectionContainer")); } - hideElement($("#groupBookingOpenPopupBtn")); - hideElement($("#groupBookingOpenEmployeeSelectionPopupBtn")); + $("#groupBookingOpenPopupBtn").hide(); + $("#groupBookingOpenEmployeeSelectionPopupBtn").hide(); }, null, null); } @@ -381,7 +381,8 @@ function selectServiceRecord(oid) { function activateForm(actionPath) { $("input").prop("disabled", false); - $("textarea").prop("disabled", false); + $("textarea").prop("disabled", false); + $(".doku-tab-link").prop("disabled", false); $("#kategorien_select, #leistungen_select, #recordLoader_select, #textbausteine_select").prop("disabled", false); toggleSelectClassesForElement("#kategorien_select", "#kategorien-select-container"); @@ -529,201 +530,7 @@ function toggleModalWrapper() { $(".modalWrapper").css("height", $(document).height()); } -function validateServiceRecordBeforeSubmit() { - function getLocation() { - if (navigator.geolocation) { - navigator.geolocation.getCurrentPosition(showPosition, showError); - } else { - console.log("Ortung wird von diesem Browser nicht unterstützt"); - showPosition(null); - } - } - var dateStr = $("#datum_textbox").val(); - var startStr = $("#start_textbox").val(); - var endStr = $("#ende_textbox").val(); - - var x = getDateObj(true); - - var y; - - if ($("#enddatum_textbox").val() !== "") { - y = getEndDateObj(); - } else { - y = getDateObj(false); - } - - var vonDatum = getDateTimeStringWithLeadingZeros(x); - var bisDatum = getDateTimeStringWithLeadingZeros(y); - - var isValidRecord = true; - - makeAjaxCall("POST", checkRightsUrl, function(json) { - if (json === "SessionTimeout") { - window.location.href = redirectLink; - return; - } - - if (json === "StartGreaterEnd") { - hideSanduhr(); - writeFatalErrorMessage("Die Startzeit darf nicht größer als die Endzeit sein!"); - return; - } - - var meldungen = $.parseJSON(json); - console.log(meldungen); - - var relations = meldungen.ServiceRecord2Validations; - var results = null; - var allowOverlappingFLS = false; - var allowMoreFLSThanApproved = false; - var bookAfterSettlementInvoice = false; - - $.each(meldungen.Rights, function(position) { - var value = meldungen.Rights[position]; - var key = parseInt(position); - - switch (key) { - case 0: - allowOverlappingFLS = value; - break; - case 1: - allowMoreFLSThanApproved = value; - break; - case 2: - bookAfterSettlementInvoice = value; - break; - default: - break; - } - }); - - for (var j = 0; j < relations.length; j++) { - results = relations[j].ValidationResults; - var exitLoop = false; - - for (var i = 0; i < results.length; i++) { - if (exitLoop) { - break; - } - - switch (results[i].ResultType) { - case 0: - // ServiceRecordOverlapping: ServiceRecord überschneidet sich mit einem anderen Eintrag - var msg1 = "An dem gewählten Datum '" + vonDatum + "' existiert bereits ein Eintrag (" + results[i].Message + " bei Klient/in " + results[i].CustomerName + "). Speichern nicht möglich."; - if (allowOverlappingFLS === true) { - var r = confirm("An dem gewählten Datum '" + vonDatum + "' existiert bereits ein Eintrag (" + results[i].Message + " bei Klient/in " + results[i].CustomerName + "). Möchten Sie trotzdem speichern?"); - isValidRecord = r; - exitLoop = !isValidRecord; - } else { - alert(msg1); - isValidRecord = false; - exitLoop = true; - } - break; - case 1: - // EmployeeOverlapping: Employee hat einen mit diesem Eintrag sich überschneidenden Eintrag - var msg2 = "An dem gewählten Datum " + vonDatum + " existiert bereits ein Eintrag von " + results[i].EmployeeName + "(" + results[i].Message + "). Speichern nicht möglich."; - if (allowOverlappingFLS === true) { - var r2 = confirm("An dem gewählten Datum " + vonDatum + " existiert bereits ein Eintrag von " + results[i].EmployeeName + "(" + results[i].Message + "). Möchten Sie trotzdem speichern?"); - isValidRecord = r2; - exitLoop = !isValidRecord; - } else { - alert(msg2); - isValidRecord = false; - exitLoop = true; - } - break; - case 2: - // OutsideOfSupportConcept: Der Eintrag liegt außerhalb des Hilfeplanzeitraumes - alert("Das gewählte Datum " + vonDatum.slice(0, 10) + " liegt außerhalb des Zeitraumes des gewählten Hilfeplans (" + relations[j].HilfePlanZeitraum + "). Speichern nicht möglich."); - //writeFatalErrorMessage("Das gewählte Datum " + vonDatum.slice(0, 10) + " liegt außerhalb des Zeitraumes des gewählten Hilfeplans (" + relations[j].HilfePlanZeitraum + "). Speichern nicht möglich."); - - isValidRecord = false; - exitLoop = true; - break; - case 3: - // ApprovedFLSOverspending: Die Anzahl der genehmigten FLS wird überschritten - var klient = "diesen Hilfeplan"; - if (results[i].CustomerName !== null && results[i].CustomerName.length >= 0) { - klient = "Klient/in " + results[i].CustomerName; - } - - var msg3 = "Die für " + klient + " genehmigten FLS (" + results[i].ApprovedHours + ") werden mit diesem Eintrag überschritten. (" + results[i].HoursNew + ")."; - if (allowMoreFLSThanApproved === true) { - var r3 = confirm(msg3 + " Möchten Sie trotzdem speichern?"); - isValidRecord = r3; - exitLoop = !isValidRecord; - } else { - alert(msg3); - isValidRecord = false; - exitLoop = true; - } - break; - case 4: - // OutOfEditLimit: MaxDaysEditServiceRecordAllowed überschritten - alert("Sie können keine neuen Leistungen für den " + vonDatum + " dokumentieren, da bereits der " + meldungen.MaxDaysEditServiceRecordsAllowed + ". des nachfolgenden Monats überschritten ist."); - isValidRecord = false; - exitLoop = true; - break; - case 5: - // Error: Ein genereller Fehler ist bei der Validierung aufgetreten - alert("Beim Speichern ist ein Fehler aufgetreten. Speichern nicht möglich."); - isValidRecord = false; - exitLoop = true; - break; - case 6: - // SettlementInvoiceAlreadyExisting: Es existiert bereits eine Spitzabrechnung - var klient2 = "diesen Hilfeplan"; - if (results[i].CustomerName !== null && results[i].CustomerName.length >= 0) { - klient2 = "Klient/in " + results[i].CustomerName; - } - - var msg6 = "Es existiert bereits eine Spitzabrechnung für " + klient2 + ". Um diesen Eintrag zu berücksichtigen, muss eventuell eine neue Spitzabrechnung erstellt werden. Das Speichern ist nicht möglich."; - if (bookAfterSettlementInvoice === true) { - msg6 = "Sie können den Eintrag nicht bearbeiten, da bereits eine Spitzabrechnung für " + klient2 + " erstellt wurde. Speichern nicht möglich."; - } - alert(msg6); - isValidRecord = false; - exitLoop = true; - break; - case 7: - // FristAbgelaufen: Die Frist zur Bearbeitung ist abgelaufen - var intervall = "einem Tag"; - - if (results[i].LimitFuerZeiterfassung !== "1") { - intervall = results[i].LimitFuerZeiterfassung + " Tagen"; - } - - var msg7 = "Sie können keine neuen Leistungen für den " + vonDatum + " dokumentieren, da die Zeiterfassung innerhalb von " + intervall + " erfolgen muss. Das Speichern ist nicht möglich."; - - alert(msg7); - isValidRecord = false; - exitLoop = true; - break; - default: - // Custom(8), da default: ServiceRecordValidationResult.Custom - alert(results[i].Message); - isValidRecord = false; - exitLoop = true; - break; - } - } - } - - $("#URLSave").val(dataURL); - $("#TimeStampSave").val(newday); - $("#GeoLocSaveXCOOR").val(langenGrad); - $("#GeoLocSaveYCOOR").val(breitenGrad); - - if (isValidRecord) { - $("#createSRForm").submit(); - } else { - hideSanduhr(); - } - }, - { von: vonDatum, bis: bisDatum, inEditMode: $("#anlegenEditierenBtn").val() === "Speichern", dateString: dateStr, startString: startStr, endString: endStr }); -} function ErfolgteSpx() { if (document.getElementById("SaveSignature").value === "True") { @@ -887,10 +694,10 @@ function initAppointmentEditForm() { currTime.setMinutes(currTime.getMinutes() + j); } - $("#AppointmentEditForm").css("display", "block"); - $("#KalenderTable").css("display", "none"); - $("#KalenderNavigation").css("display", "none"); - $("#KalenderTableTask").css("display", "none"); + $("#AppointmentEditForm").show();//css("display", "block"); + $("#KalenderTable").hide();//css("display", "none"); + $("#KalenderNavigation").hide();//css("display", "none"); + $("#KalenderTableTask").hide();//css("display", "none"); $("#StartDate").val($("#KalenderDatumFormat").val()); $("#EndDate").val($("#KalenderDatumFormat").val()); $("#TerminStartZeit").val(getHoursAndMinutesWithLeadingZeros(currTime)); @@ -908,21 +715,22 @@ function initAppointmentEditForm() { $("#TerminSpeichern").val("Speichern"); $("#TerminSpeichernAbbrechen").val("Abbrechen"); - $("#TerminSpeichern").css("display", "none"); + $("#TerminSpeichern").hide();//css("display", "none"); $("#InsertAppointmentButton").css("display", "inline"); } function hideEditForm() { - $("#AppointmentEditForm").css("display", "none"); - $("#KalenderTable").css("display", "block"); - $("#KalenderNavigation").css("display", "block"); - $("#KalenderTableTask").css("display", "block"); + $("#AppointmentEditForm").hide(); + $("#KalenderTable").show(); + $("#KalenderNavigation").show(); + $("#KalenderTableTask").show(); $("#StartDate").val(""); } function nextDayButtonClick() { - var nextdatum = new Date($("#KalenderDatum").val()); + var nextdatum = new Date($("#KalenderDatum").val() + "T00:00:00Z"); + nextdatum.setDate((nextdatum.getDate() + 1)); $("#KalenderDatum").val(toDateStringYearMonthDay(nextdatum)); @@ -1206,6 +1014,7 @@ function loescheUnterschrift(canvas, ctx) { + function preloadData(serviceRecordOid) { initSignatureInfo(serviceRecordOid); } @@ -1419,7 +1228,7 @@ function updateEigenschaftsfelder() { $("#map-canvas").css("width", customerTableWidth - 16); $("#map-canvas").css("height", customerTableWidth - 16); - if(minSizes == undefined) { + if(minSizes === undefined) { return; } @@ -1446,6 +1255,8 @@ $(window).resize(function () { if($("#klientenTabelle").css("display") === "block") { updateEigenschaftsfelder(); } + + updateDokuTabLinks(); }); function showSanduhr() { @@ -1457,21 +1268,21 @@ function showSanduhr() { function hideSanduhr() { if($("#errorPopupDiv").css("display") === "none" && $("#popupDiv").css("display") === "none") { - $(".modalWrapper").css("display", "none"); + $(".modalWrapper").hide(); $(".modalWrapper").css("height", "0"); } if($("#SuccessPopupDiv").css("display") === "none" && $("#popupDiv").css("display") === "none") { - $(".modalWrapper").css("display", "none"); + $(".modalWrapper").hide(); $(".modalWrapper").css("height", "0"); } if($("#AendernPopupDiv").css("display") === "none" && $("#popupDiv").css("display") === "none") { - $(".modalWrapper").css("display", "none"); + $(".modalWrapper").hide(); $(".modalWrapper").css("height", "0"); } - $(".warte-animation").css("display", "none"); + $(".warte-animation").hide(); } function submitDeletionForm() { @@ -1630,8 +1441,6 @@ function preselectCustomer() { function setSelectedEmployee() { var oid = parseInt($("#employeesDropDown").find(":selected").val()); - console.log('selected employee oid: ' + oid); - if(isNaN(oid)) { return; } @@ -1642,7 +1451,7 @@ function setSelectedEmployee() { } function SaveOnly() { - if(typeof(Storage) != "undefined") { + if(typeof Storage !== "undefined") { clearLocalStorage(1); var costBearer2SupportConceptOid = $("#scDropDown").val(); @@ -1776,19 +1585,50 @@ function showErrorAfterCrash() { } function focusOnTab(tabIdentifier) { + focusOnDoku(tabIdentifier); +} + +function focusOnDoku(number) { setTimeout(function() { var displayValue; - for(var i = 0; i < window.numberOfDocumentationTypes; i++) { + for (var i = 0; i < window.numberOfDocumentationTypes; i++) { var idNumber = i + 1; - displayValue = idNumber === tabIdentifier ? "block" : "none"; + displayValue = idNumber === number ? "block" : "none"; - $('#notiz_textbox' + idNumber).css("display", displayValue); + if (idNumber === number) { + $("#doku-name-" + idNumber).addClass("active"); + } else { + $("#doku-name-" + idNumber).removeClass("active"); + } + + $("#doku-tab-content-" + idNumber).css("display", displayValue); + $("#notiz_textbox" + idNumber).css("display", displayValue); } - $('#notiz_textbox' + tabIdentifier).get(0).focus(); - window.focusedDokuTextarea = $('#notiz_textbox' + tabIdentifier); + $("#notiz_textbox" + number).get(0).focus(); + window.focusedDokuTextarea = $("#notiz_textbox" + number); }, 100); } +function updateDokuTabLinks() { + if (numberOfDocumentationTypes !== undefined && numberOfDocumentationTypes > 1) { + var height = 0; + $(".doku-tab-link").css("height", "auto"); + + for (var i = 0; i < numberOfDocumentationTypes; i++) { + var idNumber = i + 1; + + var dokuTab = $("#doku-name-" + idNumber); + + var outerHeight = dokuTab.outerHeight(); + + if (outerHeight > height) { + height = outerHeight; + } + } + + $(".doku-tab-link").css("height", height + "px"); + } +} diff --git a/BeWoPlanerMobil/Scripts/serviceRecordValidation.js b/BeWoPlanerMobil/Scripts/serviceRecordValidation.js new file mode 100644 index 000000000..b1d8b40d9 --- /dev/null +++ b/BeWoPlanerMobil/Scripts/serviceRecordValidation.js @@ -0,0 +1,104 @@ +var isValidRecord = true; + +function validateServiceRecordBeforeSubmit() { + function getLocation() { + if (navigator.geolocation) { + navigator.geolocation.getCurrentPosition(showPosition, showError); + } else { + console.log("Ortung wird von diesem Browser nicht unterstützt"); + showPosition(null); + } + } + + var dateStr = $("#datum_textbox").val(); + var startStr = $("#start_textbox").val(); + var endStr = $("#ende_textbox").val(); + + var x = getDateObj(true); + + var y; + + if ($("#enddatum_textbox").val() !== "") { + y = getEndDateObj(); + } else { + y = getDateObj(false); + } + + var vonDatum = getDateTimeStringWithLeadingZeros(x); + var bisDatum = getDateTimeStringWithLeadingZeros(y); + + //console.log("Validiere Eintrag..."); + + makeAjaxCall("POST", window.checkRightsUrl, function (json) { + $("#URLSave").val(dataURL); + $("#TimeStampSave").val(newday); + $("#GeoLocSaveXCOOR").val(langenGrad); + $("#GeoLocSaveYCOOR").val(breitenGrad); + + if (json === "SessionTimeout") { + window.location.href = redirectLink; + return; + } + + if (json === "StartGreaterEnd") { + hideSanduhr(); + writeFatalErrorMessage("Die Startzeit darf nicht größer als die Endzeit sein!"); + return; + } + + var meldungen = $.parseJSON(json); + kannTrotzdemGespeichertWerden = meldungen.KannTrotzdemGespeichertWerden; + + //console.log("Validierung abgeschlossen. Meldung: " + meldungen.Message + "; Kann trotzdem gespeichert werden: " + meldungen.KannTrotzdemGespeichertWerden); + + if (meldungen.Message === null) { + submitCreationForm(); + return; + } + + toggleValidationPopup(meldungen.Message); + }, + { von: vonDatum, bis: bisDatum, inEditMode: $("#anlegenEditierenBtn").val() === "Speichern", dateString: dateStr, startString: startStr, endString: endStr }); +} + +var kannTrotzdemGespeichertWerden = false; + +function submitCreationForm() { + toggleValidationPopup(null); + + if (kannTrotzdemGespeichertWerden) { + $(".modalWrapper").show(); + $(".warte-animation").show(); + $("#createSRForm").submit(); + } else { + $(".warte-animation").hide(); + } +} + +function toggleValidationPopup(validationMessage) { + $(".warte-animation").hide(); + + var popupDiv = $("#validationPopupDiv"); + + popupDiv.toggle(); + + if (popupDiv.css("display") === "block" && validationMessage !== null && validationMessage !== undefined && validationMessage.length > 0) { + $("#validationPopupText").html(validationMessage); + + var t = $("#validationPopupTitle").outerHeight(); + var u = $("#validationPopupText").outerHeight(); + var v = $("#validationBtn1").outerHeight(); + var w = $("#validationBtn2").outerHeight(); + var x = $("#validationResultList").outerHeight(); + + var h = t + u + v + w + w + x; + + popupDiv.css("height", h + "px"); + + popupDiv.css("top", window.pageYOffset + window.innerHeight / 2 - h / 2); + popupDiv.css("margin-top", "0"); + } else { + $(".modalWrapper").hide(); + popupDiv.css("margin-top", "auto"); + } +} \ No newline at end of file diff --git a/BeWoPlanerMobil/Scripts/textbausteine.js b/BeWoPlanerMobil/Scripts/textbausteine.js index 068d4c8f1..ce70ba35f 100644 --- a/BeWoPlanerMobil/Scripts/textbausteine.js +++ b/BeWoPlanerMobil/Scripts/textbausteine.js @@ -3,7 +3,7 @@ } function loadTextbausteineForCategoryOnSuccess(json) { - if (json == null) { + if (json === null) { return; } @@ -56,7 +56,7 @@ function buildTreeRecursively(textmodule) { } function setTextModule(moduleOid) { - if (window.focusedDokuTextarea == null) { + if (window.focusedDokuTextarea === null) { if ($("#trnormalDoku").css("display") !== "none") { window.focusedDokuTextarea = $("#notiz_textbox"); } else { @@ -78,7 +78,7 @@ function setTextbaustein() { } function loadTextbausteinContentOnSuccess(textbausteintext) { - if (focusedDokuTextarea != null) { + if (focusedDokuTextarea !== null) { var cursorPosition = focusedDokuTextarea.prop("selectionStart"); var v = focusedDokuTextarea.val(); var textBefore = v.substring(0, cursorPosition); @@ -104,7 +104,7 @@ function showTextModulesPopup() { } function hideTextModulePopup() { - hideElement($("#textModulePopupDivContainer")); - hideElement($("#textModulePopupDiv")); - hideElement($("#kollabierbar2")); + $("#textModulePopupDivContainer").hide(); + $("#textModulePopupDiv").hide(); + $("#kollabierbar2").hide(); } \ No newline at end of file diff --git a/BeWoPlanerMobil/Util/MobileUtils.cs b/BeWoPlanerMobil/Util/MobileUtils.cs index 786644459..62a8a67f6 100644 --- a/BeWoPlanerMobil/Util/MobileUtils.cs +++ b/BeWoPlanerMobil/Util/MobileUtils.cs @@ -328,5 +328,51 @@ namespace BeWoPlanerMobil.Util return flatNode; } + + public static ServiceRecordDC CloneServiceRecordForGroupBooking(ServiceRecordDC pOriginal) + { + var m = pOriginal; + + var clone = new ServiceRecordDC + { + 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 + }; + + return clone; + } } } \ No newline at end of file diff --git a/BeWoPlanerMobil/Util/ServiceRecord2Validation.cs b/BeWoPlanerMobil/Util/ServiceRecord2Validation.cs index 5b7872789..64d7e3498 100644 --- a/BeWoPlanerMobil/Util/ServiceRecord2Validation.cs +++ b/BeWoPlanerMobil/Util/ServiceRecord2Validation.cs @@ -1,12 +1,13 @@ using System.Collections.Generic; + using BS.Shared.DataContracts; namespace BeWoPlanerMobil.Util { public class ServiceRecord2Validation { - public ServiceRecordDC ServiceRecord { get; set; } - public List ValidationResults { get; set; } + public ServiceRecordDC ServiceRecord { get; } + public List ValidationResults { get; } public string HilfePlanZeitraum { get; } public ServiceRecord2Validation(ServiceRecordDC pServiceRecord, List pValidationResults, string pHilfePlanZeitraum) diff --git a/BeWoPlanerMobil/Util/ValidationResult.cs b/BeWoPlanerMobil/Util/ValidationResult.cs index 621789fe5..402ed44e6 100644 --- a/BeWoPlanerMobil/Util/ValidationResult.cs +++ b/BeWoPlanerMobil/Util/ValidationResult.cs @@ -1,13 +1,8 @@ -using System.Collections.Generic; - -namespace BeWoPlanerMobil.Util +namespace BeWoPlanerMobil.Util { public class ValidationResult { - public Dictionary Rights { get; set; } = new Dictionary(); - public string MaxDaysEditServiceRecordsAllowed { get; set; } - public string LimitFuerZeiterfassung { get; set; } = "0"; - - public List ServiceRecord2Validations { get; set; } = new List(); + public bool KannTrotzdemGespeichertWerden { get; set; } = true; + public string Message { get; set; } } } \ No newline at end of file diff --git a/BeWoPlanerMobil/Views/Main/Main.cshtml b/BeWoPlanerMobil/Views/Main/Main.cshtml index 0beaef798..098d6e29f 100644 --- a/BeWoPlanerMobil/Views/Main/Main.cshtml +++ b/BeWoPlanerMobil/Views/Main/Main.cshtml @@ -196,64 +196,37 @@
- +
-
-
- - - - - -
+
+
+ + + + + +
+ +
+ +
+
+ +
+
+ +
+
+ +
+
+ +
@@ -664,16 +637,15 @@
- @using (Html.BeginForm("AddEmployeesToGroupBooking", "Main", FormMethod.Post, new { id = "groupBookingEmployeeSelectionForm" })) + @using(Html.BeginForm("AddEmployeesToGroupBooking", "Main", FormMethod.Post, new { id = "groupBookingEmployeeSelectionForm" })) { var i = 0; - - @foreach (var ma in Model.EmployeeListItems) +
+ @foreach(var ma in Model.EmployeeListItems) {
- long.Parse(ma.Value).Equals(a.EmployeeOid))) { @Html.Raw("checked=\"checked\"") } /> + long.Parse(ma.Value).Equals(a.EmployeeOid))) { @Html.Raw("checked=\"checked\"") } /> @ma.Text @@ -683,8 +655,8 @@ }
} -
+
@@ -964,6 +936,15 @@
+
+

Validierung

+

+
+ + +
+
+ @@ -1036,6 +1036,8 @@ resetGroupBookingModeViaGETUrl = '@Url.Action("ResetGroupBookingModeViaGET")'; + var isServiceRecordNoticeMandatory = '@(Model.IsServiceRecordNoticeMandatory)'.toLowerCase() === "true"; + focusedDokuTextarea = null; $.ajax({ From 5ee742592edafd28c57b31b65ab9b3ab7d4293ed Mon Sep 17 00:00:00 2001 From: Lyndon Date: Wed, 12 Dec 2018 19:10:07 -0400 Subject: [PATCH 13/18] JavaScript Funktionen der Unterschriften funktion in seperate Datei ausgelagert. --- BeWoPlanerMobil/Controllers/MainController.cs | 101 ------ BeWoPlanerMobil/Scripts/calendar.js | 8 +- BeWoPlanerMobil/Scripts/mainView.js | 332 ++---------------- .../Scripts/serviceRecordValidation.js | 2 - BeWoPlanerMobil/Scripts/unterschrift.js | 270 ++++++++++++++ BeWoPlanerMobil/Views/Shared/_Layout.cshtml | 1 + 6 files changed, 306 insertions(+), 408 deletions(-) create mode 100644 BeWoPlanerMobil/Scripts/unterschrift.js diff --git a/BeWoPlanerMobil/Controllers/MainController.cs b/BeWoPlanerMobil/Controllers/MainController.cs index dacea304d..832cd187f 100644 --- a/BeWoPlanerMobil/Controllers/MainController.cs +++ b/BeWoPlanerMobil/Controllers/MainController.cs @@ -138,8 +138,6 @@ namespace BeWoPlanerMobil.Controllers Model.SupportConcepts = CustomerService.GetAllActiveSupportConceptsByCustomers(myRelatedCustomers.Select(c => c.Customer.CustomerOid)); } - var test = Model.ServiceRecords.Any(a => a.GroupPersonCount != null && a.IsCreatedInMobileClient); - if(!Model.ShowExpiredSupportConcepts) { Model.SupportConcepts = Model.SupportConcepts.Where(w => @@ -2629,104 +2627,5 @@ namespace BeWoPlanerMobil.Controllers return MainModel.IsEmployeeSelectionVisible.ToString(); } - - private IEnumerable CalculateGroupBookingDuration(int pEmployeeCount, int pCustomerCount, ICollection cb2ScOids, ServiceRecordDC pBaseRecord) - { - var compactSupportConcepts = CustomerServiceImp.GetCompactSupportConcepts((from sc in Model.SelectedSupportConcepts where sc.SupportConceptOid != null select sc.SupportConceptOid.Value).ToList(), GetUser().Employee.EmployeeOid); - - var nodes = (from supportConcept in Model.SelectedSupportConcepts let cb = supportConcept.CostBearerRelations.FirstOrDefault(f => cb2ScOids.Contains(f.CostBearer2SupportConceptOid.Value)) let sc = compactSupportConcepts.FirstOrDefault(f => f.SupportConceptOid == supportConcept.SupportConceptOid) where cb != null && sc != null select SupportConceptService.CreateFlatSupportConceptItem(sc, CustomerService.LoadOrganisationCompact(cb.CostBearer.OrganisationOid))).ToList(); - - var list = new List(); - foreach(var node in nodes) - { - var sc = CloneServiceRecordForGroupBooking(pBaseRecord); - - if(pBaseRecord.RoundedDuration == 0) - { - if(pBaseRecord.Start.HasValue && pBaseRecord.End.HasValue) - { - var minutes = pBaseRecord.End.Value.Subtract(pBaseRecord.Start.Value).TotalMinutes; - - pBaseRecord.RoundedDuration = (decimal)minutes; - } - } - - sc.GroupRoundedDuration = pBaseRecord.RoundedDuration; - - sc.CostBearer2SupportConceptOid = node.SupportConceptTreeNodeDC.SupportConceptCostBearerRelDC.CostBearer2SupportConceptOid; - - sc.SupportConcept = node.SupportConceptTreeNodeDC.SupportConcept; - - sc.CostBearer = node.SupportConceptTreeNodeDC.CostBearer; - - sc.Customer = node.SupportConceptTreeNodeDC.Customer; - - sc.GroupEmployeeCount = pEmployeeCount; - - sc.GroupPersonCount = pCustomerCount; - - list.Add(sc); - } - - var roundDuration = false; - var minuteInterval = 0; - string calcdId = null; - var lastMinuteInterval = -1; - - if(Model.SelectedServiceDescriptionOid.HasValue && IsBillable(Model.SelectedServiceDescriptionOid.Value, Model.GetServiceDesctiptions())) - { - roundDuration = true; - - foreach(var org in from dc in Model.SelectedSupportConcepts where dc.CostBearerRelations.Count > 0 select dc.CostBearerRelations.First().CostBearer) - { - if(org != null) - { - minuteInterval = org.ActualMinuteIntervall; - - if(lastMinuteInterval == -1) - { - lastMinuteInterval = minuteInterval; - calcdId = org.CostBearerID; - } - else if(lastMinuteInterval != minuteInterval) - { - roundDuration = false; - } - } - else if(minuteInterval >= 0) - { - roundDuration = false; - } - else - { - minuteInterval = 0; - } - } - } - - var duration = Model.NewServiceRecord.RoundedDuration; - var totalDuration = duration; - - var groupDuration = OperationsService.CalculateGroupDuration2(pCustomerCount, pEmployeeCount, Model.NewServiceRecord.RoundedDuration, nodes.Select(s => s.SupportConceptTreeNodeDC.SupportConceptCostBearerRelDC.CostBearer2SupportConceptOid.Value).ToArray()); - - if(groupDuration != null) - { - pBaseRecord.GroupRoundedDuration = groupDuration.TotalDuration; - pBaseRecord.RoundedDuration = groupDuration.SingleDuration; - } - else - { - if(minuteInterval > 0 && roundDuration) - { - var calc = Calculations.GetInstance(calcdId); - totalDuration = calc.GetRoundedDuration(minuteInterval, duration); - } - - pBaseRecord.RoundedDuration = Math.Round(totalDuration / pCustomerCount, 0, MidpointRounding.AwayFromZero); - pBaseRecord.GroupRoundedDuration = totalDuration; - } - - return list; - } } } diff --git a/BeWoPlanerMobil/Scripts/calendar.js b/BeWoPlanerMobil/Scripts/calendar.js index 76bc47c2a..e6c9be8ac 100644 --- a/BeWoPlanerMobil/Scripts/calendar.js +++ b/BeWoPlanerMobil/Scripts/calendar.js @@ -252,8 +252,8 @@ function LoadOnly(i, x) { var serviceRecord = localStorage.getItem("Zeitdaten"); var appointment = localStorage.getItem("Kalenderdaten"); - if(serviceRecord != null || appointment != null) { - if(serviceRecord != null && i === 1) { + if(serviceRecord !== null || appointment !== null) { + if(serviceRecord !== null && i === 1) { if(serviceRecord.startTime !== "" && serviceRecord.endTime !== "" && serviceRecord.duration !== "" && serviceRecord.notice !== "" && serviceRecord.supportConceptIndex !== "" && serviceRecord.date !== "") { writeFatalErrorMessage("Es ist ein nicht gespeicherter Eintrag vorhanden. Dieser wird nun an den Server gesendet."); @@ -265,8 +265,8 @@ function LoadOnly(i, x) { } } - if(kalenderdata != null && x === 2) { - if (appointment != null && appointment.isValid()) { + if(kalenderdata !== null && x === 2) { + if (appointment !== null && appointment.isValid()) { writeFatalErrorMessage("Es ist ein nicht gespeicherter Kalendereintrag vorhanden. Dieser wird nun an den Server gesendet.", 1); setTimeout(function() { diff --git a/BeWoPlanerMobil/Scripts/mainView.js b/BeWoPlanerMobil/Scripts/mainView.js index f82856d40..9b0aaadaa 100644 --- a/BeWoPlanerMobil/Scripts/mainView.js +++ b/BeWoPlanerMobil/Scripts/mainView.js @@ -260,7 +260,7 @@ function selectServiceRecord(oid) { try { meinGoalsArray = goalsJson !== "" ? $.parseJSON(goalsJson) : ""; } catch (exception) { - console.log('Fehler beim JSON Parsing von selectServiceRecord(' + oid + '): ' + exception.message); + console.log("Fehler beim JSON Parsing von selectServiceRecord(" + oid + "): " + exception.message); } var rawStartDateStr = record.Start[18] === "1" ? "" : record.Start.slice(11, 16); @@ -728,6 +728,9 @@ function hideEditForm() { $("#StartDate").val(""); } + + + function nextDayButtonClick() { var nextdatum = new Date($("#KalenderDatum").val() + "T00:00:00Z"); @@ -745,293 +748,20 @@ function nextDayButtonClick() { -var canvas, ctx; -var mouseX, mouseY, mouseDown = 0; -var lastpositionx = 0; -var lastpositiony = 0; -var newpositionx = 0; -var newpositiony = 0; -var minuswert = -20; -var maxwert = 20; -var posix = 0; -var posiy = 0; -var r, g, b = 0; -var a = 255; - -function loadUnterschriftFeldFunktion() { - function drawDot(ctx, x, y, size) { - ctx.fillStyle = "rgba(" + r + "," + g + "," + b + "," + (a / 255) + ")"; - - if(lastpositionx !== 0) { - ctx.beginPath(); - ctx.arc(x, y, size, 1, Math.PI * 0.25, true); - newpositionx = x; - newpositiony = y; - posix = newpositionx - lastpositionx; - posiy = newpositiony - lastpositiony; - - if(posiy > minuswert && posix > minuswert && posiy < maxwert && posix < maxwert) { - ctx.lineTo(lastpositionx + 2, lastpositiony + 2); - ctx.lineWidth = 2; - ctx.lineCap = "butt"; - ctx.lineJoin = "round"; - ctx.stroke(); - - lastpositionx = x; - lastpositiony = y; - } else { - lastpositionx = 0; - lastpositiony = 0; - } - - ctx.closePath(); - ctx.fill(); - - } else { - ctx.beginPath(); - ctx.arc(x, y, size, 1, Math.PI * 0.25, true); - ctx.closePath(); - ctx.fill(); - - lastpositionx = x; - lastpositiony = y; - } - } - - function sketchpadMouseDown() { - mouseDown = 1; - drawDot(ctx, mouseX, mouseY, 3); - } - - function sketchpadMouseUp() { - mouseDown = 0; - } - - function sketchpadMouseMove(e) { - getMousePos(e); - - if(mouseDown === 1) { - drawDot(ctx, mouseX, mouseY, 3); - } - } - - function getMousePos(e) { - if(!e) { - e = event; - } - - if(e.offsetX) { - mouseX = e.offsetX; - mouseY = e.offsetY; - } - else if(e.layerX) { - mouseX = e.layerX; - mouseY = e.layerY; - } - } - - function sketchpadTouchStart() { - getTouchPos(); - drawDot(ctx, touchX, touchY, 3); - event.preventDefault(); - } - - function sketchpadTouchMove(e) { - getTouchPos(e); - drawDot(ctx, touchX, touchY, 3); - event.preventDefault(); - } - - function getTouchPos(e) { - if (!e) { - e = event; - } - - if (e.touches) { - if (e.touches.length === 1) { - var touch = e.touches[0]; - touchX = touch.pageX - touch.target.offsetLeft; - touchY = touch.pageY - touch.target.offsetTop; - } - } - } - - function init() { - canvas = document.getElementById("sketchpad"); - - if (canvas.getContext) { - ctx = canvas.getContext("2d"); - } - - if (ctx) { - canvas.addEventListener("mousedown", sketchpadMouseDown, false); - canvas.addEventListener("mousemove", sketchpadMouseMove, false); - window.addEventListener("mouseup", sketchpadMouseUp, false); - - canvas.addEventListener("touchstart", sketchpadTouchStart, false); - canvas.addEventListener("touchmove", sketchpadTouchMove, false); - } - } - - init(); -} - -function showUnterschrift(serviceRecordOid, zahl) { - $("#customersDropDown").val($("#customersDropDown option").eq(0).val()); - $("#zeiterfassung").css("display", "none"); - $("#KalenderNavigation").css("display", "none"); - $("#Kalender").css("display", "none"); - $("#klienten").css("display", "none"); - $("#colorRibbon").css("background-color", "#04b4d0"); - $("#UnterschriftBereich").css("display", "block"); - - $("#Statistics").css("display", "none"); - $("#SupportStatistik").css("display", "none"); - - if (zahl === 1) { - serviceRecordOid = document.getElementById("ServiceRecordOIDSave").value; - - toggleSuccessPopup(""); - - loadUnterschriftFeldFunktion(); - preloadData(serviceRecordOid); - } else { - loadUnterschriftFeldFunktion(); - - preloadData(serviceRecordOid); - } -} - -function backToZeiterfassung() { - $("#customersDropDown").val($("#customersDropDown option").eq(0).val()); - $("#zeiterfassung").css("display", "block"); - $("#KalenderNavigation").css("display", "none"); - $("#Kalender").css("display", "none"); - $("#klienten").css("display", "none"); - $("#colorRibbon").css("background-color", "#c80000"); - $("#UnterschriftBereich").css("display", "none"); - - $("#Statistics").css("display", "none"); - $("#SupportStatistik").css("display", "none"); - - loescheUnterschrift(canvas, ctx); -} - -function speichereUnterschrift() { - date = ""; - date = new Date(); - - dataURL = ""; - dataURL = canvas.toDataURL(); - - blob = new Blob([dataURL], { type: "URL/String" }); - - lastpositionx = 0; - lastpositiony = 0; - - var dd = date.getDate(); - var mm = date.getMonth() + 1; - var yyyy = date.getFullYear(); - var hh = date.getHours(); - var Min = date.getMinutes(); - var Sec = date.getSeconds(); - - var ddStr = dd < 10 ? "0" + dd : dd; - var mmStr = mm < 10 ? "0" + mm : mm; - var hhStr = hh < 10 ? "0" + hh : hh; - var MnStr = Min < 10 ? "0" + Min : Min; - var ScStr = Sec < 10 ? "0" + Sec : Sec; - - newday = ""; - newday = ddStr + '.' + mmStr + '.' + yyyy + " " + hhStr + ":" + MnStr + ":" + ScStr; - - var serviceRecordOid = $("#SaveRecordOID").val(); - //console.log(ServRecord + " das ist die Oid"); - - function getLocation() { - if(navigator.geolocation) { - navigator.geolocation.getCurrentPosition(showPosition, showError); - } else { - x.innerHTML = "Geolocation is not supported by this browser."; - } - } - - function showPosition(position) { - var breitenGrad = ""; - var langenGrad = ""; - //var breitenGrad = position.coords.latitude; - //var langenGrad = position.coords.longitude; - - longrider = ""; - //longrider = langenGrad.toString(); - //console.log(ServRecord); - $.ajax({ - type: "POST", - url: setSelectedUnterschriftUrl, - data: { breitengrad: breitenGrad, langengrad: langenGrad, blob: dataURL, zeitstempel: newday, ServiceRecord: serviceRecordOid }, - success: function () { - loescheUnterschrift(canvas, ctx); - backToZeiterfassung(); - toggleSuccessPopup("Die Unterschrift wurde erfolgreich gespeichert.", 2); - }, - error: function () { - toggleSuccessPopup("Ein Fehler ist aufgetreten. Bitte wenden Sie sich an den Support", 3); - } - - }); - } - - function showError(error) { - var message = "Fehler"; - switch(error.code) { - case error.PERMISSION_DENIED: - message = "Ortungsanfrage abgelehnt."; - break; - case error.POSITION_UNAVAILABLE: - message = "Ortsangabe ist nicht verfügbar."; - break; - case error.TIMEOUT: - message = "Timeout."; - break; - case error.UNKNOWN_ERROR: - message = "Ein unbekannter Fehler ist aufgetreten."; - break; - } - - //console.log(message); - showPosition(null); - } - - //getLocation(); - showPosition(null); -} - -function loescheUnterschrift(canvas, ctx) { - ctx.clearRect(0, 0, canvas.width, canvas.height); - lastpositionx = 0; - lastpositiony = 0; -} - - - - -function preloadData(serviceRecordOid) { - initSignatureInfo(serviceRecordOid); -} - function showServiceRecords() { location.reload(); - $("#customersDropDown").val($("#customersDropDown option").eq(0).val()); - $("#klientenTabelle").css("display", "none"); - $("#zeiterfassung").css("display", "block"); - $("#KalenderNavigation").css("display", "none"); - $("#klienten").css("display", "none"); - $("#Kalender").css("display", "none"); - $("#colorRibbon").css("background-color", "#c80000"); - $("#UnterschriftBereich").css("display", "none"); - $("#Statistics").css("display", "block"); - $("#SupportStatistik").css("display", "none"); + $("#customersDropDown").val($("#customersDropDown option").eq(0).val()); + $("#klientenTabelle").hide(); + $("#zeiterfassung").show(); + $("#KalenderNavigation").hide(); + $("#klienten").hide(); + $("#Kalender").hide(); + $("#colorRibbon").css("background-color", "#c80000"); + $("#UnterschriftBereich").hide(); + + $("#Statistics").show(); + $("#SupportStatistik").hide(); toggleMenu(); } @@ -1039,16 +769,16 @@ function showServiceRecords() { function goBackToZeiterfassung() { showSanduhr(); $("#customersDropDown").val($("#customersDropDown option").eq(0).val()); - $("#klientenTabelle").css("display", "none"); - $("#zeiterfassung").css("display", "block"); - $("#KalenderNavigation").css("display", "none"); - $("#klienten").css("display", "none"); - $("#Kalender").css("display", "none"); + $("#klientenTabelle").hide(); + $("#zeiterfassung").show(); + $("#KalenderNavigation").hide(); + $("#klienten").hide(); + $("#Kalender").hide(); $("#colorRibbon").css("background-color", "#c80000"); - $("#UnterschriftBereich").css("display", "none"); + $("#UnterschriftBereich").hide(); - $("#Statistics").css("display", "block"); - $("#SupportStatistik").css("display", "none"); + $("#Statistics").show(); + $("#SupportStatistik").hide(); } function klientenLaden() { @@ -1059,9 +789,9 @@ function klientenLaden() { var oid = parseInt($("#customersDropDown").find(":selected").val()); if(oid === -1) { - $("#klientenTabelle").css("display", "none"); - $("#umfeldContainer").css("display", "none"); - $("#kommentarContainer").css("display", "none"); + $("#klientenTabelle").hide(); + $("#umfeldContainer").hide(); + $("#kommentarContainer").hide(); hideSanduhr(); @@ -1069,12 +799,12 @@ function klientenLaden() { } makeAjaxCall("GET", getSelectedCustomerUrl, function (json) { - $("#klientenTabelle").css("display", "block"); - $("#umfeldContainer").css("display", "block"); - $("#kommentarContainer").css("display", "block"); + $("#klientenTabelle").show(); + $("#umfeldContainer").show(); + $("#kommentarContainer").show(); if(json === "SessionTimeout") { - window.location.href = redirectLink; + window.location.href = window.redirectLink; return; } @@ -1260,7 +990,7 @@ $(window).resize(function () { }); function showSanduhr() { - $(".modalWrapper").css("display", "block"); + $(".modalWrapper").show(); $(".modalWrapper").css("height", $(document).height()); $(".warte-animation").css("display", "inline-block"); diff --git a/BeWoPlanerMobil/Scripts/serviceRecordValidation.js b/BeWoPlanerMobil/Scripts/serviceRecordValidation.js index 15368bc6e..7469f1fa1 100644 --- a/BeWoPlanerMobil/Scripts/serviceRecordValidation.js +++ b/BeWoPlanerMobil/Scripts/serviceRecordValidation.js @@ -120,8 +120,6 @@ function showValidationPopup(validationMessage) { popupDiv.css("top", window.pageYOffset + window.innerHeight / 2 - h / 2); popupDiv.css("margin-top", "0"); - - } function hideValidationPopup() { diff --git a/BeWoPlanerMobil/Scripts/unterschrift.js b/BeWoPlanerMobil/Scripts/unterschrift.js new file mode 100644 index 000000000..dc73e6f5d --- /dev/null +++ b/BeWoPlanerMobil/Scripts/unterschrift.js @@ -0,0 +1,270 @@ +var canvas, ctx; +var mouseX, mouseY, mouseDown = 0; +var lastpositionx = 0; +var lastpositiony = 0; +var newpositionx = 0; +var newpositiony = 0; +var minuswert = -20; +var maxwert = 20; +var posix = 0; +var posiy = 0; +var r, g, b = 0; +var a = 255; + +function loadUnterschriftFeldFunktion() { + function drawDot(ctx, x, y, size) { + ctx.fillStyle = "rgba(" + r + "," + g + "," + b + "," + (a / 255) + ")"; + + if (lastpositionx !== 0) { + ctx.beginPath(); + ctx.arc(x, y, size, 1, Math.PI * 0.25, true); + newpositionx = x; + newpositiony = y; + posix = newpositionx - lastpositionx; + posiy = newpositiony - lastpositiony; + + if (posiy > minuswert && posix > minuswert && posiy < maxwert && posix < maxwert) { + ctx.lineTo(lastpositionx + 2, lastpositiony + 2); + ctx.lineWidth = 2; + ctx.lineCap = "butt"; + ctx.lineJoin = "round"; + ctx.stroke(); + + lastpositionx = x; + lastpositiony = y; + } else { + lastpositionx = 0; + lastpositiony = 0; + } + + ctx.closePath(); + ctx.fill(); + + } else { + ctx.beginPath(); + ctx.arc(x, y, size, 1, Math.PI * 0.25, true); + ctx.closePath(); + ctx.fill(); + + lastpositionx = x; + lastpositiony = y; + } + } + + function sketchpadMouseDown() { + mouseDown = 1; + drawDot(ctx, mouseX, mouseY, 3); + } + + function sketchpadMouseUp() { + mouseDown = 0; + } + + function sketchpadMouseMove(e) { + getMousePos(e); + + if (mouseDown === 1) { + drawDot(ctx, mouseX, mouseY, 3); + } + } + + function getMousePos(e) { + if (!e) { + e = event; + } + + if (e.offsetX) { + mouseX = e.offsetX; + mouseY = e.offsetY; + } + else if (e.layerX) { + mouseX = e.layerX; + mouseY = e.layerY; + } + } + + function sketchpadTouchStart() { + getTouchPos(); + drawDot(ctx, touchX, touchY, 3); + event.preventDefault(); + } + + function sketchpadTouchMove(e) { + getTouchPos(e); + drawDot(ctx, touchX, touchY, 3); + event.preventDefault(); + } + + function getTouchPos(e) { + if (!e) { + e = event; + } + + if (e.touches) { + if (e.touches.length === 1) { + var touch = e.touches[0]; + touchX = touch.pageX - touch.target.offsetLeft; + touchY = touch.pageY - touch.target.offsetTop; + } + } + } + + function init() { + canvas = document.getElementById("sketchpad"); + + if (canvas.getContext) { + ctx = canvas.getContext("2d"); + } + + if (ctx) { + canvas.addEventListener("mousedown", sketchpadMouseDown, false); + canvas.addEventListener("mousemove", sketchpadMouseMove, false); + window.addEventListener("mouseup", sketchpadMouseUp, false); + + canvas.addEventListener("touchstart", sketchpadTouchStart, false); + canvas.addEventListener("touchmove", sketchpadTouchMove, false); + } + } + + init(); +} + +function showUnterschrift(serviceRecordOid, zahl) { + $("#customersDropDown").val($("#customersDropDown option").eq(0).val()); + $("#zeiterfassung").css("display", "none"); + $("#KalenderNavigation").css("display", "none"); + $("#Kalender").css("display", "none"); + $("#klienten").css("display", "none"); + $("#colorRibbon").css("background-color", "#04b4d0"); + $("#UnterschriftBereich").css("display", "block"); + + $("#Statistics").css("display", "none"); + $("#SupportStatistik").css("display", "none"); + + if (zahl === 1) { + serviceRecordOid = document.getElementById("ServiceRecordOIDSave").value; + + toggleSuccessPopup(""); + + loadUnterschriftFeldFunktion(); + preloadData(serviceRecordOid); + } else { + loadUnterschriftFeldFunktion(); + + preloadData(serviceRecordOid); + } +} + +function backToZeiterfassung() { + $("#customersDropDown").val($("#customersDropDown option").eq(0).val()); + $("#zeiterfassung").css("display", "block"); + $("#KalenderNavigation").css("display", "none"); + $("#Kalender").css("display", "none"); + $("#klienten").css("display", "none"); + $("#colorRibbon").css("background-color", "#c80000"); + $("#UnterschriftBereich").css("display", "none"); + + $("#Statistics").css("display", "none"); + $("#SupportStatistik").css("display", "none"); + + loescheUnterschrift(canvas, ctx); +} + +function speichereUnterschrift() { + date = ""; + date = new Date(); + + dataURL = ""; + dataURL = canvas.toDataURL(); + + blob = new Blob([dataURL], { type: "URL/String" }); + + lastpositionx = 0; + lastpositiony = 0; + + var dd = date.getDate(); + var mm = date.getMonth() + 1; + var yyyy = date.getFullYear(); + var hh = date.getHours(); + var Min = date.getMinutes(); + var Sec = date.getSeconds(); + + var ddStr = dd < 10 ? "0" + dd : dd; + var mmStr = mm < 10 ? "0" + mm : mm; + var hhStr = hh < 10 ? "0" + hh : hh; + var MnStr = Min < 10 ? "0" + Min : Min; + var ScStr = Sec < 10 ? "0" + Sec : Sec; + + newday = ""; + newday = ddStr + '.' + mmStr + '.' + yyyy + " " + hhStr + ":" + MnStr + ":" + ScStr; + + var serviceRecordOid = $("#SaveRecordOID").val(); + //console.log(ServRecord + " das ist die Oid"); + + function getLocation() { + if (navigator.geolocation) { + navigator.geolocation.getCurrentPosition(showPosition, showError); + } else { + x.innerHTML = "Geolocation is not supported by this browser."; + } + } + + function showPosition(position) { + var breitenGrad = ""; + var langenGrad = ""; + //var breitenGrad = position.coords.latitude; + //var langenGrad = position.coords.longitude; + + longrider = ""; + //longrider = langenGrad.toString(); + //console.log(ServRecord); + $.ajax({ + type: "POST", + url: setSelectedUnterschriftUrl, + data: { breitengrad: breitenGrad, langengrad: langenGrad, blob: dataURL, zeitstempel: newday, ServiceRecord: serviceRecordOid }, + success: function () { + loescheUnterschrift(canvas, ctx); + backToZeiterfassung(); + toggleSuccessPopup("Die Unterschrift wurde erfolgreich gespeichert.", 2); + }, + error: function () { + toggleSuccessPopup("Ein Fehler ist aufgetreten. Bitte wenden Sie sich an den Support", 3); + } + + }); + } + + function showError(error) { + var message = "Fehler"; + switch (error.code) { + case error.PERMISSION_DENIED: + message = "Ortungsanfrage abgelehnt."; + break; + case error.POSITION_UNAVAILABLE: + message = "Ortsangabe ist nicht verfügbar."; + break; + case error.TIMEOUT: + message = "Timeout."; + break; + case error.UNKNOWN_ERROR: + message = "Ein unbekannter Fehler ist aufgetreten."; + break; + } + + //console.log(message); + showPosition(null); + } + + //getLocation(); + showPosition(null); +} + +function loescheUnterschrift(canvas, ctx) { + ctx.clearRect(0, 0, canvas.width, canvas.height); + lastpositionx = 0; + lastpositiony = 0; +} + +function preloadData(serviceRecordOid) { + initSignatureInfo(serviceRecordOid); +} \ No newline at end of file diff --git a/BeWoPlanerMobil/Views/Shared/_Layout.cshtml b/BeWoPlanerMobil/Views/Shared/_Layout.cshtml index 4e193a79b..1fc548ed1 100644 --- a/BeWoPlanerMobil/Views/Shared/_Layout.cshtml +++ b/BeWoPlanerMobil/Views/Shared/_Layout.cshtml @@ -26,6 +26,7 @@ + @RenderBody() From 6977090416dc975b2e7bca2bbbaa7e4e6536ee8e Mon Sep 17 00:00:00 2001 From: Lyndon Date: Thu, 13 Dec 2018 07:15:24 -0400 Subject: [PATCH 14/18] Refactoring --- BeWoPlanerMobil/BeWoPlanerMobil.csproj | 1 + BeWoPlanerMobil/Scripts/calendar.js | 15 +++++++++++ BeWoPlanerMobil/Scripts/mainView.js | 27 +++---------------- .../Scripts/serviceRecordValidation.js | 11 -------- 4 files changed, 19 insertions(+), 35 deletions(-) diff --git a/BeWoPlanerMobil/BeWoPlanerMobil.csproj b/BeWoPlanerMobil/BeWoPlanerMobil.csproj index 4812f262d..7569f28fb 100644 --- a/BeWoPlanerMobil/BeWoPlanerMobil.csproj +++ b/BeWoPlanerMobil/BeWoPlanerMobil.csproj @@ -219,6 +219,7 @@ + diff --git a/BeWoPlanerMobil/Scripts/calendar.js b/BeWoPlanerMobil/Scripts/calendar.js index e6c9be8ac..1e48c4a6b 100644 --- a/BeWoPlanerMobil/Scripts/calendar.js +++ b/BeWoPlanerMobil/Scripts/calendar.js @@ -278,3 +278,18 @@ function LoadOnly(i, x) { } } } + + +function nextDayButtonClick() { + var nextdatum = new Date($("#KalenderDatum").val() + "T00:00:00Z"); + + nextdatum.setDate((nextdatum.getDate() + 1)); + + $("#KalenderDatum").val(toDateStringYearMonthDay(nextdatum)); + + var newtoday = getDateStringWithLeadingZeros(nextdatum); + + $("#KalenderDatumFormat").val(newtoday); + + loadAppointments(newtoday); +} \ No newline at end of file diff --git a/BeWoPlanerMobil/Scripts/mainView.js b/BeWoPlanerMobil/Scripts/mainView.js index 9b0aaadaa..f4de77395 100644 --- a/BeWoPlanerMobil/Scripts/mainView.js +++ b/BeWoPlanerMobil/Scripts/mainView.js @@ -1,8 +1,6 @@ var breitenGrad, langenGrad, date; var dataURL = ""; var blob, newday, longrider; -var xinner = $("#GeoLocSaveXCOOR"); -var yinner = $("#GeoLocSaveYCOOR"); var ZeiterfassungDatakonstrukt = []; var KlientDatakonstrukt = []; @@ -40,6 +38,9 @@ function actuallyBuildCollapsibleSet(kollektion, selectedGoalOids) { var level = 0; var collapsibleHtml; + +zeitRegEx = /^(2[0-3]|[01]?[0-9])(:|,|\.|#|;)?([0-5][0-9])$/; + function buildGoalTreeItem(goalItem, selectedGoalOids) { var goalOid = goalItem.ValueListEntryOid; var goalHeader = goalItem.Header; @@ -144,8 +145,6 @@ function resizeLabelColumns() { $("#tabLbl").css("width", $("#zieleLbl").css("width")); } -zeitRegEx = /^(2[0-3]|[01]?[0-9])(:|,|\.|#|;)?([0-5][0-9])$/; - function loadGoals(actionPath) { var selectedServiceRecord = $($("#scDropDown")).find(":selected").val(); @@ -728,26 +727,6 @@ function hideEditForm() { $("#StartDate").val(""); } - - - -function nextDayButtonClick() { - var nextdatum = new Date($("#KalenderDatum").val() + "T00:00:00Z"); - - nextdatum.setDate((nextdatum.getDate() + 1)); - - $("#KalenderDatum").val(toDateStringYearMonthDay(nextdatum)); - - var newtoday = getDateStringWithLeadingZeros(nextdatum); - - $("#KalenderDatumFormat").val(newtoday); - - loadAppointments(newtoday); -} - - - - function showServiceRecords() { location.reload(); diff --git a/BeWoPlanerMobil/Scripts/serviceRecordValidation.js b/BeWoPlanerMobil/Scripts/serviceRecordValidation.js index 7469f1fa1..e080fdb8e 100644 --- a/BeWoPlanerMobil/Scripts/serviceRecordValidation.js +++ b/BeWoPlanerMobil/Scripts/serviceRecordValidation.js @@ -1,15 +1,6 @@ var isValidRecord = true; function validateServiceRecordBeforeSubmit() { - function getLocation() { - if (navigator.geolocation) { - navigator.geolocation.getCurrentPosition(showPosition, showError); - } else { - console.log("Ortung wird von diesem Browser nicht unterstützt"); - showPosition(null); - } - } - var hasDokutext = false; if (window.isServiceRecordNoticeMandatory) { @@ -59,8 +50,6 @@ function validateServiceRecordBeforeSubmit() { makeAjaxCall("POST", window.checkRightsUrl, function (json) { $("#URLSave").val(dataURL); $("#TimeStampSave").val(newday); - $("#GeoLocSaveXCOOR").val(langenGrad); - $("#GeoLocSaveYCOOR").val(breitenGrad); if (json === "SessionTimeout") { window.location.href = redirectLink; From 898c96246d567182288cd6a0b9a285c5a54e1304 Mon Sep 17 00:00:00 2001 From: Lyndon Date: Thu, 13 Dec 2018 20:59:05 -0400 Subject: [PATCH 15/18] =?UTF-8?q?Das=20=C3=84ndern=20der=20Leistungskatego?= =?UTF-8?q?rie=20beim=20Bearbeiten=20eines=20Zeiterfassungseintrags=20l?= =?UTF-8?q?=C3=B6st=20keinen=20Fehler=20mehr=20aus.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BeWoPlanerMobil/Controllers/MainController.cs | 131 ++++++++++-------- BeWoPlanerMobil/Scripts/mainView.js | 63 +++------ .../Scripts/serviceRecordValidation.js | 3 + BeWoPlanerMobil/Scripts/unterschrift.js | 103 +++++--------- 4 files changed, 133 insertions(+), 167 deletions(-) diff --git a/BeWoPlanerMobil/Controllers/MainController.cs b/BeWoPlanerMobil/Controllers/MainController.cs index 832cd187f..bb30a79b0 100644 --- a/BeWoPlanerMobil/Controllers/MainController.cs +++ b/BeWoPlanerMobil/Controllers/MainController.cs @@ -30,6 +30,8 @@ namespace BeWoPlanerMobil.Controllers { public class MainController : AbstractBaseController { + private const string _LeerzeichenFuerGetMethoden = " "; + private MainModel _Model; public MainModel Model { @@ -213,12 +215,12 @@ namespace BeWoPlanerMobil.Controllers return UpdateSettings("ShowExpiredSupportConcepts", newValue ? "1" : "0"); } + [Authorize] public ActionResult UpdateSettings(string pKey, string pValue) { if (Model == null) { - RedirectToActionPermanent("Index", "Login"); - return null; + return RedirectToActionPermanent("Index", "Login"); } var userSettings = GetUser().Settings; @@ -242,7 +244,7 @@ namespace BeWoPlanerMobil.Controllers if (Model == null) { RedirectToActionPermanent("Index", "Login"); - return null; + return " "; } var sc = Model.SupportConcepts.FirstOrDefault(f => f.CostBearerRelations.Any(cbr => cbr.CostBearer2SupportConceptOid.HasValue && cbr.CostBearer2SupportConceptOid.Value.Equals(pCostbearer2SupportConceptOid))); @@ -342,7 +344,7 @@ namespace BeWoPlanerMobil.Controllers if (Model == null) { RedirectToActionPermanent("Index", "Login"); - return null; + return _LeerzeichenFuerGetMethoden; } var m = OperationsService.GetMandator(); @@ -351,12 +353,13 @@ namespace BeWoPlanerMobil.Controllers return SerializeObject(time); } + [Authorize] public string CheckEndDate() { if (Model == null) { RedirectToActionPermanent("Index", "Login"); - return null; + return _LeerzeichenFuerGetMethoden; } var m = OperationsService.GetMandator(); @@ -365,12 +368,13 @@ namespace BeWoPlanerMobil.Controllers return SerializeObject(endtime); } + [Authorize] public string CheckOnlyYearMonth() { if (Model == null) { RedirectToActionPermanent("Index", "Login"); - return null; + return _LeerzeichenFuerGetMethoden; } var m = OperationsService.GetMandator(); @@ -379,12 +383,13 @@ namespace BeWoPlanerMobil.Controllers return SerializeObject(yearMonth); } + [Authorize] public string CheckIsZeiterfassDateNormal() { if (Model == null) { RedirectToActionPermanent("Index", "Login"); - return null; + return _LeerzeichenFuerGetMethoden; } var m = OperationsService.GetMandator(); @@ -393,12 +398,13 @@ namespace BeWoPlanerMobil.Controllers return SerializeObject(normal); } + [Authorize] public string CheckIsZeiterfassungInStdMin() { if (Model == null) { RedirectToActionPermanent("Index", "Login"); - return null; + return _LeerzeichenFuerGetMethoden; } var m = OperationsService.GetMandator(); @@ -407,12 +413,13 @@ namespace BeWoPlanerMobil.Controllers return SerializeObject(zeiterInStdMin); } + [Authorize] public string CheckDokuReiter() { if (Model == null) { RedirectToActionPermanent("Index", "Login"); - return null; + return _LeerzeichenFuerGetMethoden; } return SerializeObject(Model.Dokutypes); @@ -438,11 +445,10 @@ namespace BeWoPlanerMobil.Controllers { try { - if (Model == null) { RedirectToActionPermanent("Index", "Login"); - return null; + return _LeerzeichenFuerGetMethoden; } var date = DateTime.ParseExact(newtoday, "dd.MM.yyyy", null); @@ -542,7 +548,7 @@ namespace BeWoPlanerMobil.Controllers if (Model == null) { RedirectToActionPermanent("Index", "Login"); - return null; + return _LeerzeichenFuerGetMethoden; } var supportConceptStatistics = OperationsService.CreateSupportConceptStatistics(oid, DateTime.Now); @@ -557,14 +563,14 @@ namespace BeWoPlanerMobil.Controllers } [Authorize] - public void UpdateAppointment(long oid, string betreff, string notice, string startZeit, string endZeit, string day, string endDate) + public string UpdateAppointment(long oid, string betreff, string notice, string startZeit, string endZeit, string day, string endDate) { try { if (Model == null) { RedirectToActionPermanent("Index", "Login"); - return; + return _LeerzeichenFuerGetMethoden; } var date = DateTime.Parse(day); @@ -579,11 +585,13 @@ namespace BeWoPlanerMobil.Controllers b1.Description = notice; KalenderService.UpdateSchedulerAppointments(new List{b1}); + + return _LeerzeichenFuerGetMethoden; } catch (Exception e) { log.Error(e.Message, e); - SerializeObject("Fehler 550: Internal Server Error"); + return SerializeObject("Fehler 550: Internal Server Error"); } } @@ -653,7 +661,7 @@ namespace BeWoPlanerMobil.Controllers if (Model == null) { RedirectToActionPermanent("Index", "Login"); - return null; + return _LeerzeichenFuerGetMethoden; } var date = DateTime.ParseExact(newtoday, "dd.MM.yyyy", null); @@ -671,14 +679,14 @@ namespace BeWoPlanerMobil.Controllers } [Authorize] - public void SaveUnterschrift(string breitengrad, string langengrad, string blob, string zeitstempel, long? ServiceRecord) + public string SaveUnterschrift(string blob, string zeitstempel, long? ServiceRecord) { try { if (Model == null) { RedirectToActionPermanent("Index", "Login"); - return; + return _LeerzeichenFuerGetMethoden; } var date = DateTime.Parse(zeitstempel); @@ -686,19 +694,20 @@ namespace BeWoPlanerMobil.Controllers OperationsService.InsertSignature(new SignatureDC { DataBild = blob, - Latitute = breitengrad, - Longitute = langengrad, Zeitstempel = date, ServiceRecordOid = ServiceRecord }); + + return _LeerzeichenFuerGetMethoden; } catch (Exception e) { log.Error(e.Message, e); - SerializeObject("Fehler 540"); + return SerializeObject("Fehler 540"); } } + [Authorize] public string SetSaveSignature(bool save) { try @@ -706,11 +715,11 @@ namespace BeWoPlanerMobil.Controllers if (Model == null) { RedirectToActionPermanent("Index", "Login"); - return null; + return _LeerzeichenFuerGetMethoden; } Model.SaveSignature = save; - return " "; + return _LeerzeichenFuerGetMethoden; } catch (Exception e) { @@ -719,12 +728,13 @@ namespace BeWoPlanerMobil.Controllers } } + [Authorize] public string LoadServiceCategories(long pServiceCategoryOid) { if (Model == null) { RedirectToActionPermanent("Index", "Login"); - return null; + return _LeerzeichenFuerGetMethoden; } try @@ -746,14 +756,14 @@ namespace BeWoPlanerMobil.Controllers if (Model == null) { RedirectToActionPermanent("Index", "Login"); - return null; + return _LeerzeichenFuerGetMethoden; } try { if (!MobileSessionFacade.CheckForUserRight(UserRightType.TextbausteineNurEigeneAnsehen) && !MobileSessionFacade.CheckForUserRight(UserRightType.TextbausteineAlleAnsehen)) { - return null; + return _LeerzeichenFuerGetMethoden; } var textbausteine = OperationsService.GetAllTextModules(); @@ -795,12 +805,13 @@ namespace BeWoPlanerMobil.Controllers } } + [Authorize] public string LoadCompleteTextbausteinByOid(long pTextbausteinOid) { if (Model == null) { RedirectToActionPermanent("Index", "Login"); - return null; + return _LeerzeichenFuerGetMethoden; } var abc = Model.Textbausteine.FirstOrDefault(f => f.TextModuleOid.HasValue && f.TextModuleOid.Value == pTextbausteinOid); @@ -808,22 +819,24 @@ namespace BeWoPlanerMobil.Controllers return abc?.Text; } - public void ErrorZeiterfassungAnzeigen(int errorwert) + public string ErrorZeiterfassungAnzeigen(int errorwert) { try { if (Model == null) { RedirectToActionPermanent("Index", "Login"); - return; + return _LeerzeichenFuerGetMethoden; } Model.ErrorWert = errorwert; - } + + return _LeerzeichenFuerGetMethoden; + } catch (Exception e) { log.Error(e.Message, e); - SerializeObject("Fehler 777: Fail Error Compilation"); + return SerializeObject("Fehler 777: Fail Error Compilation"); } } @@ -1695,29 +1708,31 @@ namespace BeWoPlanerMobil.Controllers return RedirectToActionPermanent("Main"); } - public void SetRecordOidToDelete(long serviceRecordOid) + public string SetRecordOidToDelete(long serviceRecordOid) { if (Model == null) { RedirectToActionPermanent("Index", "Login"); - return; + return _LeerzeichenFuerGetMethoden; } Model.ServiceRecordOidToDelete = serviceRecordOid; + + return _LeerzeichenFuerGetMethoden; } - public void UpdateGoals(long pGoalOid) + public string UpdateGoals(long pGoalOid) { if (Model == null) { RedirectToActionPermanent("Index", "Login"); - return; + return _LeerzeichenFuerGetMethoden; } var sc = Model.SelectedSupportConcept; if (sc == null) { - return; + return _LeerzeichenFuerGetMethoden; } var goal = sc.Goals.FirstOrDefault(first => first.ValueListEntryOid.HasValue && first.ValueListEntryOid.Value.Equals(pGoalOid)); @@ -1728,7 +1743,7 @@ namespace BeWoPlanerMobil.Controllers if (Model.SelectedGoals == null) { Model.SelectedGoals = new List { goal }; - return; + return _LeerzeichenFuerGetMethoden; } if (Model.SelectedGoals.Contains(goal)) @@ -1739,6 +1754,8 @@ namespace BeWoPlanerMobil.Controllers { Model.SelectedGoals.Add(goal); } + + return _LeerzeichenFuerGetMethoden; } public string SetServiceDescription(long pServiceDescriptionOid) @@ -1746,11 +1763,11 @@ namespace BeWoPlanerMobil.Controllers if (Model == null) { RedirectToActionPermanent("Index", "Login"); - return null; + return _LeerzeichenFuerGetMethoden; } Model.SelectedServiceDescriptionOid = pServiceDescriptionOid; - return " "; + return _LeerzeichenFuerGetMethoden; } [HttpPost] @@ -1800,12 +1817,12 @@ namespace BeWoPlanerMobil.Controllers Model.ServiceRecords = recordsOhneDuplikate; } - public void SetSelectedServiceRecord(long? recordOid) + public string SetSelectedServiceRecord(long? recordOid) { if (Model == null) { RedirectToActionPermanent("Index", "Login"); - return; + return _LeerzeichenFuerGetMethoden; } Model.SelectedServiceRecordOid = recordOid; @@ -1819,9 +1836,12 @@ namespace BeWoPlanerMobil.Controllers var serviceRecordDC = Model.ServiceRecords.FirstOrDefault(f => f.ServiceRecordOid.HasValue && f.ServiceRecordOid.Value.Equals(Model.SelectedServiceRecordOid)); if (serviceRecordDC != null) { + Model.SelectedServiceRecord = serviceRecordDC; Model.SelectedGoals = serviceRecordDC.Goals; } } + + return _LeerzeichenFuerGetMethoden; } [HttpPost] @@ -1889,10 +1909,10 @@ namespace BeWoPlanerMobil.Controllers if (Model == null) { RedirectToActionPermanent("Index", "Login"); - return null; + return _LeerzeichenFuerGetMethoden; } - var result = string.Empty; + var result = _LeerzeichenFuerGetMethoden; if (Model.SelectedServiceRecordOid.HasValue) { @@ -1907,7 +1927,7 @@ namespace BeWoPlanerMobil.Controllers if (Model == null) { RedirectToActionPermanent("Index", "Login"); - return null; + return _LeerzeichenFuerGetMethoden; } LoadRecordsToModel(); @@ -1921,7 +1941,7 @@ namespace BeWoPlanerMobil.Controllers if (Model == null) { RedirectToActionPermanent("Index", "Login"); - return null; + return _LeerzeichenFuerGetMethoden; } log.Info($"CheckRights: von:{von};bis:{bis};inEditMode:{inEditMode};dateString:{dateString};startString:{startString};endString:{endString}"); @@ -2335,16 +2355,18 @@ namespace BeWoPlanerMobil.Controllers return true; } - public void SetViewMode() + public string SetViewMode() { if (Model == null) { RedirectToActionPermanent("Index", "Login"); - return; + return _LeerzeichenFuerGetMethoden; } Model.SelectedCustomer = null; Model.SelectedCustomerOid = null; + + return _LeerzeichenFuerGetMethoden; } public string GetSelectedSupportConceptCustomer() @@ -2362,21 +2384,21 @@ namespace BeWoPlanerMobil.Controllers Model.SelectedCustomer = CustomerService.LoadCustomer(customerOid); Model.SelectedCustomerOid = customerOid; - return SerializeObject(GetJSONCustomer(Model.SelectedCustomer)); } - public void SetServiceRecordEmployee(long employeeOid) + public string SetServiceRecordEmployee(long employeeOid) { try { if (Model == null) { RedirectToActionPermanent("Index", "Login"); - return; + return _LeerzeichenFuerGetMethoden; } Model.SelectedEmployee = MainModel.AllEmployees.First(f => f.EmployeeOid.Equals(employeeOid)); + return _LeerzeichenFuerGetMethoden; } catch (Exception e) { @@ -2405,7 +2427,6 @@ namespace BeWoPlanerMobil.Controllers } throw e; } - } public string CheckToken(string token) @@ -2415,7 +2436,7 @@ namespace BeWoPlanerMobil.Controllers return SerializeObject("localhost;demo"); } - return null; + return _LeerzeichenFuerGetMethoden; } [HttpPost] @@ -2504,12 +2525,12 @@ namespace BeWoPlanerMobil.Controllers if (Model == null) { RedirectToActionPermanent("Index", "Login"); - return null; + return _LeerzeichenFuerGetMethoden; } if (Model.SelectedServiceRecord == null) { - return null; + return _LeerzeichenFuerGetMethoden; } var serviceDescriptionOid = Model.SelectedServiceRecord.ServiceDescription.ServiceDescriptionOid.ToString(); @@ -2617,7 +2638,7 @@ namespace BeWoPlanerMobil.Controllers if (Model == null) { RedirectToActionPermanent("Index", "Login"); - return null; + return _LeerzeichenFuerGetMethoden; } Model.IsInGroupBookingMode = false; diff --git a/BeWoPlanerMobil/Scripts/mainView.js b/BeWoPlanerMobil/Scripts/mainView.js index f4de77395..15e4bf22f 100644 --- a/BeWoPlanerMobil/Scripts/mainView.js +++ b/BeWoPlanerMobil/Scripts/mainView.js @@ -1,7 +1,3 @@ -var breitenGrad, langenGrad, date; -var dataURL = ""; -var blob, newday, longrider; - var ZeiterfassungDatakonstrukt = []; var KlientDatakonstrukt = []; @@ -80,7 +76,7 @@ function loadGoalsOnSuccess(json) { function loadServiceDescriptionsOnSuccess(json) { if (json === "SessionTimeout") { - window.location.href = redirectLink; + window.location.href = window.redirectLink; return; } @@ -89,32 +85,14 @@ function loadServiceDescriptionsOnSuccess(json) { $("#leistungen_select").empty(); $("#leistungen_select").val(""); - $.each(liste, function(index, leistung) { - $("#leistungen_select").append(''); + $.each(liste, function (index, leistung) { + $("#leistungen_select").append('"); }); if(liste[0] !== undefined) { - if(isInEditingMode() === false) { - $("#leistungen_select").val(liste[0].ServiceDescriptionOid); + $("#leistungen_select").val(liste[0].ServiceDescriptionOid); - makeAjaxCall("GET", setServiceDescriptionUrl, null, { pServiceDescriptionOid: liste[0].ServiceDescriptionOid }, null); - } else { - makeAjaxCall("GET", - loadCategoryAndDescriptionUrl, - function(result) { - var arr = result.split("/"); - var descriptionOid = arr[0]; - var categoryOid = arr[1]; - - $("#kategorien_select").val(categoryOid); - - $("#leistungen_select").val(descriptionOid); - - $("#leistungen_select").trigger("change"); - }, - {}, - null); - } + makeAjaxCall("GET", window.setServiceDescriptionUrl, null, { pServiceDescriptionOid: liste[0].ServiceDescriptionOid }, null); } } @@ -164,11 +142,10 @@ function loadServiceDescriptions() { var selectedCategory = $("#kategorien_select").find(":selected").val(); if (selectedCategory === null || selectedCategory === undefined) { - console.log("Es wurde keine Leistungskategorie ausgewählt: " + selectedCategory); return; } - - makeAjaxCall("GET", loadServiceCategoriesUrl, loadServiceDescriptionsOnSuccess, { pServiceCategoryOid: selectedCategory }, null); + + makeAjaxCall("GET", window.loadServiceCategoriesUrl, loadServiceDescriptionsOnSuccess, { pServiceCategoryOid: selectedCategory }, null); loadTextbausteineForServiceCategory(selectedCategory); } @@ -207,9 +184,9 @@ function CheckChildGoalNodes(parent) { } function setServiceDescription() { - var sdOid = $("#leistungen_select").find(":selected").val(); + var sdOid = $($("#leistungen_select")).find(":selected").val(); - makeAjaxCall("GET", setServiceDescriptionUrl, function(kek) { }, { pServiceDescriptionOid: sdOid }, function(kek) { }); + makeAjaxCall("GET", window.setServiceDescriptionUrl, null, { pServiceDescriptionOid: sdOid }, null); } function selectServiceRecord(oid) { @@ -218,16 +195,16 @@ function selectServiceRecord(oid) { $.ajax({ type: "GET", - url: setSelectedServiceRecordUrl, + url: window.setSelectedServiceRecordUrl, data: { recordOid: oid }, success: function () { $.ajax({ type: "GET", - url: getSelectedRecordInformationUrl, + url: window.getSelectedRecordInformationUrl, success: function (jsonServiceRecord) { try { if(jsonServiceRecord === "SessionTimeout") { - window.location.href = redirectLink; + window.location.href = window.redirectLink; return; } @@ -248,11 +225,11 @@ function selectServiceRecord(oid) { $.ajax({ type: "GET", - url: loadGoalsUrl, + url: window.loadGoalsUrl, data: { pCostbearer2SupportConceptOid: $($("#scDropDown")).find(":selected").val() }, success: function (goalsJson) { if (goalsJson === "SessionTimeout") { - window.location.href = redirectLink; + window.location.href = window.redirectLink; return; } @@ -300,8 +277,13 @@ function selectServiceRecord(oid) { $.ajax({ type: "GET", - url: loadServiceCategoriesUrl, + url: window.loadServiceCategoriesUrl, success: function (result) { + if (isEmptyOrSpaces(result)) { + window.location.href = window.redirectLink; + return; + } + if (result === "SessionTimeout") { window.location.href = redirectLink; return; @@ -317,8 +299,9 @@ function selectServiceRecord(oid) { $("#leistungen_select").append(''); }); - $("#leistungen_select").val(record.ServiceDescription.ServiceDescriptionOid); - makeAjaxCall("GET", setServiceDescriptionUrl, null, { pServiceDescriptionOid: record.ServiceDescription.ServiceDescriptionOid }, null); + $("#leistungen_select").val(record.ServiceDescription.ServiceDescriptionOid); + + makeAjaxCall("GET", window.setServiceDescriptionUrl, null, { pServiceDescriptionOid: record.ServiceDescription.ServiceDescriptionOid }, null); toggleLabel("distance_textbox"); toggleLabel("duration_textbox"); diff --git a/BeWoPlanerMobil/Scripts/serviceRecordValidation.js b/BeWoPlanerMobil/Scripts/serviceRecordValidation.js index e080fdb8e..861e83c74 100644 --- a/BeWoPlanerMobil/Scripts/serviceRecordValidation.js +++ b/BeWoPlanerMobil/Scripts/serviceRecordValidation.js @@ -11,6 +11,9 @@ function validateServiceRecordBeforeSubmit() { } else { for (var q = 0; q < window.numberOfDocumentationTypes; q++) { hasDokutext = !isEmptyOrSpaces($("#notiz_textbox" + (q + 1)).val()); + if (hasDokutext) { + break; + } } } diff --git a/BeWoPlanerMobil/Scripts/unterschrift.js b/BeWoPlanerMobil/Scripts/unterschrift.js index dc73e6f5d..0af30c74c 100644 --- a/BeWoPlanerMobil/Scripts/unterschrift.js +++ b/BeWoPlanerMobil/Scripts/unterschrift.js @@ -10,6 +10,10 @@ var posix = 0; var posiy = 0; var r, g, b = 0; var a = 255; +var date; +var dataURL = ""; +var blob, newday; + function loadUnterschriftFeldFunktion() { function drawDot(ctx, x, y, size) { @@ -131,15 +135,15 @@ function loadUnterschriftFeldFunktion() { function showUnterschrift(serviceRecordOid, zahl) { $("#customersDropDown").val($("#customersDropDown option").eq(0).val()); - $("#zeiterfassung").css("display", "none"); - $("#KalenderNavigation").css("display", "none"); - $("#Kalender").css("display", "none"); - $("#klienten").css("display", "none"); + $("#zeiterfassung").hide(); + $("#KalenderNavigation").hide(); + $("#Kalender").hide(); + $("#klienten").hide(); $("#colorRibbon").css("background-color", "#04b4d0"); - $("#UnterschriftBereich").css("display", "block"); + $("#UnterschriftBereich").show(); - $("#Statistics").css("display", "none"); - $("#SupportStatistik").css("display", "none"); + $("#Statistics").hide(); + $("#SupportStatistik").hide(); if (zahl === 1) { serviceRecordOid = document.getElementById("ServiceRecordOIDSave").value; @@ -157,24 +161,22 @@ function showUnterschrift(serviceRecordOid, zahl) { function backToZeiterfassung() { $("#customersDropDown").val($("#customersDropDown option").eq(0).val()); - $("#zeiterfassung").css("display", "block"); - $("#KalenderNavigation").css("display", "none"); - $("#Kalender").css("display", "none"); - $("#klienten").css("display", "none"); + $("#zeiterfassung").show(); + $("#KalenderNavigation").hide(); + $("#Kalender").hide(); + $("#klienten").hide(); $("#colorRibbon").css("background-color", "#c80000"); - $("#UnterschriftBereich").css("display", "none"); + $("#UnterschriftBereich").hide(); - $("#Statistics").css("display", "none"); - $("#SupportStatistik").css("display", "none"); + $("#Statistics").hide(); + $("#SupportStatistik").hide(); loescheUnterschrift(canvas, ctx); } function speichereUnterschrift() { - date = ""; date = new Date(); - dataURL = ""; dataURL = canvas.toDataURL(); blob = new Blob([dataURL], { type: "URL/String" }); @@ -196,67 +198,24 @@ function speichereUnterschrift() { var ScStr = Sec < 10 ? "0" + Sec : Sec; newday = ""; - newday = ddStr + '.' + mmStr + '.' + yyyy + " " + hhStr + ":" + MnStr + ":" + ScStr; + newday = ddStr + "." + mmStr + "." + yyyy + " " + hhStr + ":" + MnStr + ":" + ScStr; var serviceRecordOid = $("#SaveRecordOID").val(); - //console.log(ServRecord + " das ist die Oid"); - function getLocation() { - if (navigator.geolocation) { - navigator.geolocation.getCurrentPosition(showPosition, showError); - } else { - x.innerHTML = "Geolocation is not supported by this browser."; - } - } - - function showPosition(position) { - var breitenGrad = ""; - var langenGrad = ""; - //var breitenGrad = position.coords.latitude; - //var langenGrad = position.coords.longitude; - - longrider = ""; - //longrider = langenGrad.toString(); - //console.log(ServRecord); - $.ajax({ - type: "POST", - url: setSelectedUnterschriftUrl, - data: { breitengrad: breitenGrad, langengrad: langenGrad, blob: dataURL, zeitstempel: newday, ServiceRecord: serviceRecordOid }, - success: function () { - loescheUnterschrift(canvas, ctx); - backToZeiterfassung(); - toggleSuccessPopup("Die Unterschrift wurde erfolgreich gespeichert.", 2); - }, - error: function () { - toggleSuccessPopup("Ein Fehler ist aufgetreten. Bitte wenden Sie sich an den Support", 3); - } - - }); - } - - function showError(error) { - var message = "Fehler"; - switch (error.code) { - case error.PERMISSION_DENIED: - message = "Ortungsanfrage abgelehnt."; - break; - case error.POSITION_UNAVAILABLE: - message = "Ortsangabe ist nicht verfügbar."; - break; - case error.TIMEOUT: - message = "Timeout."; - break; - case error.UNKNOWN_ERROR: - message = "Ein unbekannter Fehler ist aufgetreten."; - break; + $.ajax({ + type: "POST", + url: window.setSelectedUnterschriftUrl, + data: { blob: dataURL, zeitstempel: newday, ServiceRecord: serviceRecordOid }, + success: function () { + loescheUnterschrift(canvas, ctx); + backToZeiterfassung(); + toggleSuccessPopup("Die Unterschrift wurde erfolgreich gespeichert.", 2); + }, + error: function () { + toggleSuccessPopup("Ein Fehler ist aufgetreten. Bitte wenden Sie sich an den Support", 3); } - //console.log(message); - showPosition(null); - } - - //getLocation(); - showPosition(null); + }); } function loescheUnterschrift(canvas, ctx) { From c0881974963c2216858c3081701d300ffcecfd84 Mon Sep 17 00:00:00 2001 From: Lyndon Date: Mon, 17 Dec 2018 18:32:32 -0400 Subject: [PATCH 16/18] =?UTF-8?q?Ist=20kein=20HP=20ausgew=C3=A4hlt,=20sind?= =?UTF-8?q?=20alle=20Eingabefelder=20deaktiviert.=20Eine=20lange=20Liste?= =?UTF-8?q?=20an=20HPs=20oder=20Gruppen=20in=20den=20Gruppenbuchungstabs?= =?UTF-8?q?=20ist=20scrollbar.=20GUI=20an=20Rechte=20angepasst.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BeWoPlanerMobil/BeWoPlanerMobil.csproj | 1 + BeWoPlanerMobil/Content/BeWoMobileStyle.css | 15 +- BeWoPlanerMobil/Models/MainModel.cs | 2 + BeWoPlanerMobil/Scripts/gruppenbuchung.js | 4 + BeWoPlanerMobil/Scripts/initialization.js | 72 +++++++--- BeWoPlanerMobil/Scripts/mainView.js | 21 ++- .../Scripts/serviceRecordValidation.js | 47 +++--- BeWoPlanerMobil/Views/Main/Main.cshtml | 135 +++++++++--------- 8 files changed, 175 insertions(+), 122 deletions(-) diff --git a/BeWoPlanerMobil/BeWoPlanerMobil.csproj b/BeWoPlanerMobil/BeWoPlanerMobil.csproj index 7569f28fb..2b6a53261 100644 --- a/BeWoPlanerMobil/BeWoPlanerMobil.csproj +++ b/BeWoPlanerMobil/BeWoPlanerMobil.csproj @@ -199,6 +199,7 @@ + diff --git a/BeWoPlanerMobil/Content/BeWoMobileStyle.css b/BeWoPlanerMobil/Content/BeWoMobileStyle.css index fc14b6ea7..977621024 100644 --- a/BeWoPlanerMobil/Content/BeWoMobileStyle.css +++ b/BeWoPlanerMobil/Content/BeWoMobileStyle.css @@ -163,6 +163,12 @@ span { background-color: #f4f4f4; } +.toggle-btn:disabled { + background-image: url("images/toggle-icon-d-disabled.svg"); + background-repeat: no-repeat; + background-position: 99.5% center; +} + .toggle-btn-div { margin-top: .2em; margin-bottom: 0; @@ -807,6 +813,8 @@ input[type="checkbox"] { .tab-content { display: none; + overflow-y: auto; + overflow-x: hidden; } .collapsible-group-booking { @@ -830,11 +838,11 @@ input[type="checkbox"] { background-color: #f0f0f0; } -#employeeCollapsible { +#employeeCollapsible, #groupBookingCollapsible { overflow-y: auto; } -#employeePopupDiv { +#employeePopupDiv, #groupBookingPopupDiv { overflow-y: hidden; } @@ -854,6 +862,7 @@ input[type="checkbox"] { background-color: #e5e5e5; width: 20%; font-size: 13px; + color: #555555; } .doku-tab-link.active { @@ -863,7 +872,7 @@ input[type="checkbox"] { .doku-tab-link:disabled { background-color: #e5e5e5; - color: black; + color: #555555; } .doku-tab-content { diff --git a/BeWoPlanerMobil/Models/MainModel.cs b/BeWoPlanerMobil/Models/MainModel.cs index 355383df6..da1d6b7b6 100644 --- a/BeWoPlanerMobil/Models/MainModel.cs +++ b/BeWoPlanerMobil/Models/MainModel.cs @@ -105,6 +105,8 @@ namespace BeWoPlanerMobil.Models public static bool IsTextbausteineVisible => MobileSessionFacade.CheckForUserRight(UserRightType.TextbausteineAlleAnsehen) || MobileSessionFacade.CheckForUserRight(UserRightType.TextbausteineNurEigeneAnsehen); //public static bool IsTextbausteineVisible = false; + public static bool HasRightForGroupBookings => MobileSessionFacade.CheckForUserRight(UserRightType.ServiceRecord_AllowCreatingGroupBooking); + public bool ShowDistanceField { get; set; } public MainModel() diff --git a/BeWoPlanerMobil/Scripts/gruppenbuchung.js b/BeWoPlanerMobil/Scripts/gruppenbuchung.js index 63e36c7d6..4d25e396d 100644 --- a/BeWoPlanerMobil/Scripts/gruppenbuchung.js +++ b/BeWoPlanerMobil/Scripts/gruppenbuchung.js @@ -81,6 +81,7 @@ function openGroupBookingDiv() { popup.css("top", parseInt(sum) + "px"); popup.css("width", (btn.innerWidth() - 2) + "px"); + popup.css("max-width", (btn.innerWidth() - 2) + "px"); collapsible.show(); @@ -93,6 +94,9 @@ function openGroupBookingTab(isSupportConceptTab) { var leftContent = $("#leftContent"); var rightContent = $("#rightContent"); + leftContent.css("max-height", ($(window).height() / 2) + "px"); + rightContent.css("max-height", ($(window).height() / 2) + "px"); + if (isSupportConceptTab) { leftBtn.addClass("active"); rightBtn.removeClass("active"); diff --git a/BeWoPlanerMobil/Scripts/initialization.js b/BeWoPlanerMobil/Scripts/initialization.js index 8a5a84bd8..ae0d33155 100644 --- a/BeWoPlanerMobil/Scripts/initialization.js +++ b/BeWoPlanerMobil/Scripts/initialization.js @@ -12,15 +12,6 @@ function startBeWoMobile() { return; } - toggleErrorPopup2("errorPopupDiv2"); - - $("#leistungen_select,#kategorien_select,#recordLoader_select,#textbausteine_select").prop("disabled", false); - - toggleSelectClassesForElement("#kategorien_select", "#kategorien-select-container"); - toggleSelectClassesForElement("#leistungen_select", "#leistungen-select-container"); - toggleSelectClassesForElement("#recordLoader_select", "#record-loader-select-container"); - toggleSelectClassesForElement("#textbausteine_select", "#textbausteine-select-container"); - initializeDocumentationTextareas(); checkEndDate(); @@ -58,7 +49,7 @@ function startBeWoMobile() { var count = 0; - if (typeof vm !== 'undefined') { + if (typeof vm !== "undefined") { count = vm.vorname.getSubscriptionsCount(); } @@ -87,14 +78,7 @@ $(window).resize(function() { function initBeWoMobile(actionPath) { try { - $("#recordLoader_select, #kategorien_select, #leistungen_select, #textbausteine_select").prop("disabled", true); - - toggleSelectClassesForElement("#kategorien_select", "#kategorien-select-container"); - toggleSelectClassesForElement("#leistungen_select", "#leistungen-select-container"); - toggleSelectClassesForElement("#recordLoader_select", "#record-loader-select-container"); - toggleSelectClassesForElement("#textbausteine_select", "#textbausteine-select-container"); - - var selectedServiceCategory = $("#scDropDown").find(":selected").val() + var selectedServiceCategory = $("#scDropDown").find(":selected").val(); if(isInGroupBookingMode() && isInEditingMode()) { if(getGroupEditingFlag().flag === false) { @@ -108,14 +92,44 @@ function initBeWoMobile(actionPath) { var shouldActivateForm = isInGroupBookingMode() ? $("#leftContent input:checked").length > 0 : selectedServiceCategory !== "-1"; - if(shouldActivateForm) { + 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()) { + if (!isInEditingMode()) { $("#datum_textbox").val(getDateStringWithLeadingZeros(new Date())); } + } 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"); } $(".not-required-input").on("click blur change focus", @@ -172,7 +186,7 @@ function initBeWoMobile(actionPath) { $("#anlegenEditierenBtn").prop("disabled", value); } } catch(err) { - console.log('Fehler: ' + err.message); + console.log("Fehler: " + err.message); } } @@ -188,6 +202,16 @@ function toggleSelectClassesForElement(elementIdentifier, parentElement) { } } +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"; @@ -266,7 +290,7 @@ function initializeDocumentationTextareas() { $(".doku-tab-link").css("width", tabWidth + "%"); if (numberOfDocumentationTypes === 0) { - $("#tddokureiter").css("display", "none"); + $("#tddokureiter").hide(); $("#trnormalDoku").css("display", "table-row"); window.focusedDokuTextarea = $("#notiz_textbox"); } else { @@ -274,7 +298,7 @@ function initializeDocumentationTextareas() { } if (numberOfDocumentationTypes === 1) { - $("#tddokureiter").css("display", "none"); + $("#tddokureiter").hide(); $("#trnormalDoku").css("display", "table-row"); $("#trnormalDokuLabel").text(dokuTypes[0].TypeDescription); } @@ -319,6 +343,8 @@ $(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(), diff --git a/BeWoPlanerMobil/Scripts/mainView.js b/BeWoPlanerMobil/Scripts/mainView.js index 15e4bf22f..1b79bb779 100644 --- a/BeWoPlanerMobil/Scripts/mainView.js +++ b/BeWoPlanerMobil/Scripts/mainView.js @@ -365,12 +365,12 @@ function activateForm(actionPath) { $("input").prop("disabled", false); $("textarea").prop("disabled", false); $(".doku-tab-link").prop("disabled", false); - $("#kategorien_select, #leistungen_select, #recordLoader_select, #textbausteine_select").prop("disabled", false); + $("#kategorien_select, #leistungen_select, #recordLoader_select, #textbausteine_select, #employeesDropDown").prop("disabled", false); - toggleSelectClassesForElement("#kategorien_select", "#kategorien-select-container"); - toggleSelectClassesForElement("#leistungen_select", "#leistungen-select-container"); - toggleSelectClassesForElement("#recordLoader_select", "#record-loader-select-container"); - toggleSelectClassesForElement("#textbausteine_select", "#textbausteine-select-container"); + //toggleSelectClassesForElement("#kategorien_select", "#kategorien-select-container"); + //toggleSelectClassesForElement("#leistungen_select", "#leistungen-select-container"); + // toggleSelectClassesForElement("#recordLoader_select", "#record-loader-select-container"); + // toggleSelectClassesForElement("#employeesDropDown", "#employee-select-container"); loadGoals(actionPath); @@ -1276,6 +1276,8 @@ function showErrorAfterCrash() { } } + + function focusOnTab(tabIdentifier) { focusOnDoku(tabIdentifier); } @@ -1298,6 +1300,15 @@ function focusOnDoku(number) { $("#notiz_textbox" + idNumber).css("display", displayValue); } + var f = number - 1; + var c = window.numberOfDocumentationTypes; + + for (var e = 0; e < window.numberOfDocumentationTypes; e++) { + if ((e > f || e < (f - 1)) && e < (c - 1)) { + $("#doku-name-" + (e + 1)).css("border-right", "1px solid #bbbbbb"); + } + } + $("#notiz_textbox" + number).get(0).focus(); window.focusedDokuTextarea = $("#notiz_textbox" + number); }, 100); diff --git a/BeWoPlanerMobil/Scripts/serviceRecordValidation.js b/BeWoPlanerMobil/Scripts/serviceRecordValidation.js index 861e83c74..ae9893d75 100644 --- a/BeWoPlanerMobil/Scripts/serviceRecordValidation.js +++ b/BeWoPlanerMobil/Scripts/serviceRecordValidation.js @@ -4,8 +4,6 @@ function validateServiceRecordBeforeSubmit() { var hasDokutext = false; if (window.isServiceRecordNoticeMandatory) { - console.log("" + window.numberOfDocumentationTypes); - if (window.numberOfDocumentationTypes < 2) { hasDokutext = !isEmptyOrSpaces($("#notiz_textbox").val()); } else { @@ -50,32 +48,33 @@ function validateServiceRecordBeforeSubmit() { var vonDatum = getDateTimeStringWithLeadingZeros(x); var bisDatum = getDateTimeStringWithLeadingZeros(y); - makeAjaxCall("POST", window.checkRightsUrl, function (json) { - $("#URLSave").val(dataURL); - $("#TimeStampSave").val(newday); + makeAjaxCall("POST", window.checkRightsUrl, validationOnSuccess, { von: vonDatum, bis: bisDatum, inEditMode: $("#anlegenEditierenBtn").val() === "Speichern", dateString: dateStr, startString: startStr, endString: endStr }); +} - if (json === "SessionTimeout") { - window.location.href = redirectLink; - return; - } - - if (json === "StartGreaterEnd") { - hideSanduhr(); - writeFatalErrorMessage("Die Startzeit darf nicht größer als die Endzeit sein!"); - return; - } +function validationOnSuccess(json) { + $("#URLSave").val(dataURL); + $("#TimeStampSave").val(newday); - var meldungen = $.parseJSON(json); - kannTrotzdemGespeichertWerden = meldungen.KannTrotzdemGespeichertWerden; + if (json === "SessionTimeout") { + window.location.href = redirectLink; + return; + } - if (meldungen.Message === null) { - submitCreationForm(); - return; - } + if (json === "StartGreaterEnd") { + hideSanduhr(); + writeFatalErrorMessage("Die Startzeit darf nicht größer als die Endzeit sein!"); + return; + } - showValidationPopup(meldungen.Message); - }, - { von: vonDatum, bis: bisDatum, inEditMode: $("#anlegenEditierenBtn").val() === "Speichern", dateString: dateStr, startString: startStr, endString: endStr }); + var meldungen = $.parseJSON(json); + kannTrotzdemGespeichertWerden = meldungen.KannTrotzdemGespeichertWerden; + + if (meldungen.Message === null) { + submitCreationForm(); + return; + } + + showValidationPopup(meldungen.Message); } var kannTrotzdemGespeichertWerden = false; diff --git a/BeWoPlanerMobil/Views/Main/Main.cshtml b/BeWoPlanerMobil/Views/Main/Main.cshtml index f0dd00f17..5468703f4 100644 --- a/BeWoPlanerMobil/Views/Main/Main.cshtml +++ b/BeWoPlanerMobil/Views/Main/Main.cshtml @@ -1,5 +1,5 @@ @using BeWoPlanerMobil.Models; -@using BeWoPlanerMobil.Util +@using BeWoPlanerMobil.Util; @model MainModel @{ @@ -40,20 +40,28 @@
- @using (Html.BeginForm("SetShowOnlyOwnSupportConcepts", "Main", FormMethod.Post)) + @using(Html.BeginForm("SetShowOnlyOwnSupportConcepts", "Main", FormMethod.Post)) { @Html.CheckBoxFor(m => m.ShowOnlyOwnSupportConcepts, new { onchange = "showSanduhr();this.form.submit();", id = "ShowOnlyOwnSupportConceptsCheckBox" }) - @Html.LabelFor(m => m.ShowOnlyOwnSupportConcepts, new { id = "LabelForShowOnlyOwnSupporConceptsCB" }) + @Html.LabelFor(m => m.ShowOnlyOwnSupportConcepts, new { id = "LabelForShowOnlyOwnSupporConceptsCB", onclick ="alert('test');" }) } - @using (Html.BeginForm("SetShowExpiredSupportConcepts", "Main", FormMethod.Post)) + @using(Html.BeginForm("SetShowExpiredSupportConcepts", "Main", FormMethod.Post)) { @Html.CheckBoxFor(m => m.ShowExpiredSupportConcepts, new { onchange = "showSanduhr();this.form.submit();", id = "ShowExpiredSupportConceptsCheckBox" }) @Html.LabelFor(m => m.ShowExpiredSupportConcepts, new { id = "LabelForShowExpiredSupportConceptsCB" }) } - @* , new { style = "display: none;"} *@ - @using (Html.BeginForm("SetGroupBookingMode", "Main", FormMethod.Post, new {id = "groupBookingForm"})) + @* , new { style = "display: none;"} *@ + @{ + var shouldShowGroupBookingForm = "display: none"; + + if(MainModel.HasRightForGroupBookings) + { + shouldShowGroupBookingForm = "display: block"; + } + } + @using(Html.BeginForm("SetGroupBookingMode", "Main", FormMethod.Post, new { id = "groupBookingForm", style = shouldShowGroupBookingForm })) { @Html.CheckBoxFor(m => m.IsInGroupBookingMode, new { onchange = "showSanduhr();this.form.submit();", id = "changeBookingModeCheckBox" }) @Html.LabelFor(m => m.IsInGroupBookingMode, new { id = "labelForChangeBookingModeCheckBox" }) @@ -69,15 +77,15 @@ };" /> - @{ - var shouldShowSingleBookingElements = "display: block"; + @{ + var shouldShowSingleBookingElements = "display: block"; - if (Model.IsInGroupBookingMode) - { - shouldShowSingleBookingElements = "display: none"; + if(Model.IsInGroupBookingMode) + { + shouldShowSingleBookingElements = "display: none"; + } } - } - @using (Html.BeginForm("SelectSupportConcept", "Main", FormMethod.Post, new { id = "selectSCForm", style= shouldShowSingleBookingElements })) + @using(Html.BeginForm("SelectSupportConcept", "Main", FormMethod.Post, new { id = "selectSCForm", style = shouldShowSingleBookingElements })) { @@ -90,25 +98,25 @@
- +
} - -
- @Html.LabelFor(m => m.SelectedEmployeeOid) -
- @Html.DropDownListFor(m => m.SelectedEmployeeOid, Model.EmployeeListItems, new { onchange = "setSelectedEmployee()", id = "employeesDropDown", @class = "dropdownlist-for" }) -
-
-
+
+ @Html.LabelFor(m => m.SelectedEmployeeOid) +
+ @Html.DropDownListFor(m => m.SelectedEmployeeOid, Model.EmployeeListItems, new { onchange = "setSelectedEmployee()", id = "employeesDropDown", @class = "dropdownlist-for", disabled = "true" }) +
+
+ +
- @using (Html.BeginForm("CreateServiceRecord", "Main", FormMethod.Post, new { id = "createSRForm" })) + @using(Html.BeginForm("CreateServiceRecord", "Main", FormMethod.Post, new { id = "createSRForm" })) { - + @@ -148,7 +156,7 @@ @@ -161,13 +169,13 @@ @@ -175,15 +183,15 @@ - + @@ -260,26 +268,26 @@ - - @{ - var shouldShowServiceRecordList = "display: block"; - if (Model.IsInGroupBookingMode && !Model.IsInEditingMode) - { - shouldShowServiceRecordList = "display: none"; + @{ + var shouldShowServiceRecordList = "display: block"; + + if(Model.IsInGroupBookingMode && !Model.IsInEditingMode) + { + shouldShowServiceRecordList = "display: none"; + } } - } - @using (Html.BeginForm("LoadServiceRecords", "Main", FormMethod.Post, new { id = "selectSCForm2", style = shouldShowServiceRecordList })) + @using(Html.BeginForm("LoadServiceRecords", "Main", FormMethod.Post, new { id = "selectSCForm2", style = shouldShowServiceRecordList })) {
-
- - - - - + + + +
@@ -584,42 +592,35 @@ - @using (Html.BeginForm("AddSupportConceptsToGroupBooking", "Main", FormMethod.Post, new {id = "groupBookingSupportConceptSelectionForm"})) + @using(Html.BeginForm("AddSupportConceptsToGroupBooking", "Main", FormMethod.Post, new { id = "groupBookingSupportConceptSelectionForm" })) { var i = 0; var j = 0;
@@ -140,7 +148,7 @@
- +
- +
- +
- +
- +
- @foreach (var hp in Model.SupporConceptListItemsForGroupBooking) + @foreach(var hp in Model.SupporConceptListItemsForGroupBooking) { - - - - - i++; + + + + + i++; } -
- - - @hp.Text -
+ + + @hp.Text +
- @foreach (var gruppe in Model.GroupOfPeopleListItems) + @foreach(var gruppe in Model.GroupOfPeopleListItems) {
+ @if(Model.SelectedGroupOfPeopleOids.Contains(long.Parse(gruppe.Value))) { @Html.Raw("checked=\"checked\"") } /> @gruppe.Text @@ -630,8 +631,8 @@
} -
+
From fef04eab15d97f4fd085c8048ac00dbd2fa8579b Mon Sep 17 00:00:00 2001 From: Lyndon Date: Sat, 5 Jan 2019 17:03:44 -0400 Subject: [PATCH 17/18] Habe damit begonnen die Aufgaben in den Kalender zu integrieren. --- BeWo/BeWo.csproj | 147 +- .../AppointmentBackgroundConverter.cs | 48 + .../AppointmentForegroundConverter.cs | 40 + .../AppointmentToolTipTextConverter.cs | 55 + BeWo/Scheduler/ISchedulerViewModel.cs | 6 +- .../View/AbstractAppointmentEditForm.cs | 20 +- BeWo/Scheduler/View/NewSchedulerView.xaml | 113 +- BeWo/Scheduler/View/NewSchedulerView.xaml.cs | 192 +- .../View/SchedulerAppointmentEditForm.xaml | 126 +- .../View/SchedulerAppointmentEditForm.xaml.cs | 393 ++- .../ViewModel/NewSchedulerViewModel.cs | 5 + .../ViewModel/SchedulerAppointmentListVM.cs | 278 +- .../ViewModel/SchedulerAppointmentVM.cs | 290 +- BeWo/ServiceProxy/Generated.cs | 2833 +++++++++-------- BeWo/Styles/OrangeBlack.xaml | 4 +- Data/Entities/SchedulerAppointment.cs | 16 +- Data/Mappings/SchedulerAppointment.hbm.xml | 6 + Model/Changes_2018_12_19.sql | 6 + ...dulerAppointmentDC_SchedulerAppointment.cs | 26 +- Service/ServiceContracts/IResourceService.cs | 4 + .../ResourceServiceImp.cs | 117 +- .../DataContracts/SchedulerAppointmentDC.cs | 17 +- Shared/Extensions/DateTimeExtensions.cs | 3 +- 23 files changed, 2816 insertions(+), 1929 deletions(-) create mode 100644 BeWo/Scheduler/Converter/AppointmentBackgroundConverter.cs create mode 100644 BeWo/Scheduler/Converter/AppointmentForegroundConverter.cs create mode 100644 BeWo/Scheduler/Converter/AppointmentToolTipTextConverter.cs create mode 100644 Model/Changes_2018_12_19.sql diff --git a/BeWo/BeWo.csproj b/BeWo/BeWo.csproj index 92e4cdbfc..3c011a542 100644 --- a/BeWo/BeWo.csproj +++ b/BeWo/BeWo.csproj @@ -605,6 +605,9 @@ ProxyLoginView.xaml + + + SchulbegleitenderDienstEmployeeView.xaml @@ -2142,362 +2145,362 @@ False + Include + True - Include - True Assembly False + Include + True - Include - True Assembly False + Include + True - Include - True Assembly False + Include + True - Include - True Assembly False + Include + True - Include - True Assembly False + Include + True - Include - True Assembly False + Include + True - Include - True Assembly False + Include + True - Include - True Assembly False + Include + True - Include - True Assembly False + Include + True - Include - True Assembly False + Include + True - Include - True Assembly False + Include + True - Include - True Assembly False + Include + True - Include - True Assembly False + Include + True - Include - True Assembly False + Include + True - Include - True Assembly False + Include + True - Include - True Assembly False + Include + True - Include - True Assembly False + Include + True - Include - True Assembly False + Include + True - Include - True Assembly False + Include + True - Include - True Assembly False + Include + True - Include - True Assembly False + Include + True - Include - True Assembly False + Include + True - Include - True Assembly False + Include + True - Include - True Assembly False + Include + True - Include - True Assembly False + Include + True - Include - True Assembly False + Include + True - Include - True Assembly False + Include + True - Include - True Assembly False + Include + True - Include - True Assembly False + Include + True - Include - True Assembly False + Include + True - Include - True Assembly False + Include + True - Include - True Assembly False + Include + True - Include - True Assembly False + Include + True - Include - True Assembly False + Include + True - Include - True Assembly False + Include + True - Include - True Assembly diff --git a/BeWo/Scheduler/Converter/AppointmentBackgroundConverter.cs b/BeWo/Scheduler/Converter/AppointmentBackgroundConverter.cs new file mode 100644 index 000000000..21e797594 --- /dev/null +++ b/BeWo/Scheduler/Converter/AppointmentBackgroundConverter.cs @@ -0,0 +1,48 @@ +using System; +using System.Globalization; +using System.Windows; +using System.Windows.Data; +using System.Windows.Media; + +using BeWo.Scheduler.ViewModel; +using DevExpress.Xpf.Scheduler.Drawing; +using DevExpress.XtraScheduler; + +namespace BeWo.Scheduler.Converter +{ + public class AppointmentBackgroundConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + try + { + var farbe = Color.FromRgb(192, 255, 208); + + if (!(value is VisualAppointmentViewInfo customViewInfo)) + { + return new LinearGradientBrush(new GradientStopCollection { new GradientStop(farbe, 1) }, new Point(.5, 0), new Point(.5, 1)); + } + + var customFields = (CustomFieldCollection) customViewInfo.CustomViewInfo; + + var isTaskValue = customFields[nameof(SchedulerAppointmentVM.IsTask)]; + + if(isTaskValue != null && (bool)isTaskValue) + { + farbe = Color.FromRgb(153, 59, 59); + } + + return new LinearGradientBrush(new GradientStopCollection { new GradientStop(farbe, 1) }, new Point(.5, 0), new Point(.5, 1)); + } + catch (Exception) + { + return new LinearGradientBrush(new GradientStopCollection { new GradientStop(Color.FromRgb(192, 255, 208), 1) }, new Point(.5, 0), new Point(.5, 1)); + } + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/BeWo/Scheduler/Converter/AppointmentForegroundConverter.cs b/BeWo/Scheduler/Converter/AppointmentForegroundConverter.cs new file mode 100644 index 000000000..b7a6d3b6e --- /dev/null +++ b/BeWo/Scheduler/Converter/AppointmentForegroundConverter.cs @@ -0,0 +1,40 @@ +using System; +using System.Globalization; +using System.Windows; +using System.Windows.Data; +using System.Windows.Media; + +using BeWo.Scheduler.ViewModel; + +using DevExpress.XtraScheduler; + +namespace BeWo.Scheduler.Converter +{ + public class AppointmentForegroundConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + var farbe = Color.FromRgb(0, 0, 0); + + if(!(value is CustomFieldCollection customViewInfo)) + { + return new LinearGradientBrush(new GradientStopCollection { new GradientStop(farbe, 1) }, new Point(.5, 0), new Point(.5, 1)); + } + + var isTaskValue = customViewInfo[nameof(SchedulerAppointmentVM.IsTask)]; + var isTask = (bool?) isTaskValue ?? false; + + if (isTask) + { + farbe = Color.FromRgb(224, 224, 224); + } + + return new LinearGradientBrush(new GradientStopCollection { new GradientStop(farbe, 1) }, new Point(.5, 0), new Point(.5, 1)); + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/BeWo/Scheduler/Converter/AppointmentToolTipTextConverter.cs b/BeWo/Scheduler/Converter/AppointmentToolTipTextConverter.cs new file mode 100644 index 000000000..ef0090b4f --- /dev/null +++ b/BeWo/Scheduler/Converter/AppointmentToolTipTextConverter.cs @@ -0,0 +1,55 @@ +using System; +using System.Globalization; +using System.Windows.Data; + +using BeWo.Scheduler.ViewModel; + +using DevExpress.Xpf.Scheduler.Drawing; +using DevExpress.XtraScheduler; + +namespace BeWo.Scheduler.Converter +{ + public class AppointmentToolTipTextConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (!(value is VisualAppointmentViewInfo viewInfo)) + { + return string.Empty; + } + + var result = viewInfo.Subject; + + var customFields = (CustomFieldCollection) viewInfo.CustomViewInfo; + + var isTaskValue = customFields[nameof(SchedulerAppointmentVM.IsTask)]; + + var isTask = (bool?) isTaskValue ?? false; + + if (!isTask) + { + return result; + } + + var completedDate = (DateTime?) customFields[nameof(SchedulerAppointmentVM.CompletedDate)]; + var dueDate = (DateTime?) customFields[nameof(SchedulerAppointmentVM.DueDate)]; + + if (completedDate.HasValue) + { + return result + " erledigt am " + completedDate.Value.ToShortDateString(); + } + + if(dueDate.HasValue) + { + return result + " bis " + dueDate.Value.ToString("dd.MM.yyyy HH:mm"); + } + + return string.Empty; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/BeWo/Scheduler/ISchedulerViewModel.cs b/BeWo/Scheduler/ISchedulerViewModel.cs index deabbd317..b3900a820 100644 --- a/BeWo/Scheduler/ISchedulerViewModel.cs +++ b/BeWo/Scheduler/ISchedulerViewModel.cs @@ -25,7 +25,7 @@ namespace BeWo.Scheduler BindingList Appointments { get; } - Dictionary>> ChangedOccurencyCustomFields { get; } + Dictionary>> ChangedOccurenceCustomFields { get; } void UpdateViewModel(IEnumerable updatedDcList); @@ -39,7 +39,9 @@ namespace BeWo.Scheduler void InitNewAppointment(Appointment appointment); - bool HideAppointment(string filterCategory, object selectedObject, Appointment appointment, bool showPrivateAppointments, bool showAbsenceTimes); + void InitNewTask(Appointment pAppointment, DateTime? pDueDate, IEnumerable pSelectedEmployees, IEnumerable pSelectedCustomers, IEnumerable pSelectedResources); + + bool HideAppointment(string filterCategory, object selectedObject, Appointment appointment, bool showPrivateAppointments, bool showAbsenceTimes, bool pShowTasks); void InitChangedOccurrencyCustomFields(IEnumerable appList); } diff --git a/BeWo/Scheduler/View/AbstractAppointmentEditForm.cs b/BeWo/Scheduler/View/AbstractAppointmentEditForm.cs index 4c4e5618a..6e9f9d438 100644 --- a/BeWo/Scheduler/View/AbstractAppointmentEditForm.cs +++ b/BeWo/Scheduler/View/AbstractAppointmentEditForm.cs @@ -91,34 +91,28 @@ namespace BeWo.Scheduler.View for (var i = 0; i < VisualTreeHelper.GetChildrenCount(obj); i++) { var child = VisualTreeHelper.GetChild(obj, i); - if (child is WeekOfMonthEdit) + if (child is WeekOfMonthEdit edt1) { - var edt = child as WeekOfMonthEdit; + edt1.CustomDisplayText -= EditCustomDisplayText; + edt1.CustomDisplayText += EditCustomDisplayText; - edt.CustomDisplayText -= EditCustomDisplayText; - edt.CustomDisplayText += EditCustomDisplayText; - - foreach (var womEditItem in edt.Items) + foreach (var womEditItem in edt1.Items) { - var ne = womEditItem as NamedElement; - if (ne != null) + if (womEditItem is NamedElement ne) { ne.Caption = Translate(ne.Caption); } } } - if (child is WeekDaysEdit) + if (child is WeekDaysEdit edt) { - var edt = child as WeekDaysEdit; - edt.CustomDisplayText -= EditCustomDisplayText; edt.CustomDisplayText += EditCustomDisplayText; foreach (var womEditItem in edt.Items) { - var ne = womEditItem as NamedElement; - if (ne != null) + if (womEditItem is NamedElement ne) { ne.Caption = Translate(ne.Caption); } diff --git a/BeWo/Scheduler/View/NewSchedulerView.xaml b/BeWo/Scheduler/View/NewSchedulerView.xaml index e2fad1077..9c1de4f12 100644 --- a/BeWo/Scheduler/View/NewSchedulerView.xaml +++ b/BeWo/Scheduler/View/NewSchedulerView.xaml @@ -23,6 +23,7 @@ + - + - +