diff --git a/BeWo/ServiceProxy/Generated.cs b/BeWo/ServiceProxy/Generated.cs index 625fd60b2..c4b46270c 100644 --- a/BeWo/ServiceProxy/Generated.cs +++ b/BeWo/ServiceProxy/Generated.cs @@ -4543,11 +4543,6 @@ namespace BeWo.ServiceProxy [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IDownloadService/GetFileAttachmentForMobile", ReplyAction="http://tempuri.org/IDownloadService/GetFileAttachmentForMobileResponse")] [System.ServiceModel.FaultContractAttribute(typeof(BeWo.ServiceProxy.BeWoFault), Action="http://tempuri.org/IDownloadService/GetFileAttachmentForMobileBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")] BS.Shared.DataContracts.FileAttachmentDC GetFileAttachmentForMobile(long oid, string tenant); - - [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IDownloadService/CreateTemporaryTokenForOneTimeLink", ReplyAction="http://tempuri.org/IDownloadService/CreateTemporaryTokenForOneTimeLinkResponse")] - [System.ServiceModel.FaultContractAttribute(typeof(BeWo.ServiceProxy.BeWoFault), Action="http://tempuri.org/IDownloadService/CreateTemporaryTokenForOneTimeLinkBeWoFaultFa" + - "ult", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")] - string CreateTemporaryTokenForOneTimeLink(string link, bool noExpiration, int expiringInXDays); } [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] @@ -4653,11 +4648,6 @@ namespace BeWo.ServiceProxy { return base.Channel.GetFileAttachmentForMobile(oid, tenant); } - - public string CreateTemporaryTokenForOneTimeLink(string link, bool noExpiration, int expiringInXDays) - { - return base.Channel.CreateTemporaryTokenForOneTimeLink(link, noExpiration, expiringInXDays); - } } [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] diff --git a/BeWo/ViewModel/MandatorVM.cs b/BeWo/ViewModel/MandatorVM.cs index 485b40e6c..3a2bd849a 100644 --- a/BeWo/ViewModel/MandatorVM.cs +++ b/BeWo/ViewModel/MandatorVM.cs @@ -271,7 +271,7 @@ namespace BeWo.ViewModel { BeWoApp.AppSettings.EnableArbeitszeiterfassung = value; - this.Settings = UserSettingsUtils.CreateNewSettingValue(this._Settings, "EnableArbeitszeiterfassung", value.ToString()); + this.Settings = UserSettingsUtils.CreateNewSettingValue(this._Settings, "EnableArbeitszeiterfassung", value ? "1" : "0"); } } } @@ -285,7 +285,7 @@ namespace BeWo.ViewModel { BeWoApp.AppSettings.EnableAutomaticPauses = value; - this.Settings = UserSettingsUtils.CreateNewSettingValue(this._Settings, "EnableAutomaticPauses", value.ToString()); + this.Settings = UserSettingsUtils.CreateNewSettingValue(this._Settings, "EnableAutomaticPauses", value ? "1" : "0"); } } } @@ -299,7 +299,7 @@ namespace BeWo.ViewModel { BeWoApp.AppSettings.EnableRestTimeWarning = value; - this.Settings = UserSettingsUtils.CreateNewSettingValue(this._Settings, "EnableRestTimeWarning", value.ToString()); + this.Settings = UserSettingsUtils.CreateNewSettingValue(this._Settings, "EnableRestTimeWarning", value ? "1" : "0"); } } } diff --git a/BeWoPlanerMobil/Controllers/ExternalSignatureController.cs b/BeWoPlanerMobil/Controllers/ExternalSignatureController.cs index 962975425..802377219 100644 --- a/BeWoPlanerMobil/Controllers/ExternalSignatureController.cs +++ b/BeWoPlanerMobil/Controllers/ExternalSignatureController.cs @@ -6,6 +6,8 @@ namespace BeWoPlanerMobil.Controllers { public ActionResult ExternalSignature(string token) { + var info = BeWo.Service.Security.SecurityUtils.SliceOneTimeLinkToken(token); + return View(); } } diff --git a/BeWoPlanerMobil/Controllers/MainController.cs b/BeWoPlanerMobil/Controllers/MainController.cs index b93c34390..081bf3d84 100644 --- a/BeWoPlanerMobil/Controllers/MainController.cs +++ b/BeWoPlanerMobil/Controllers/MainController.cs @@ -346,17 +346,6 @@ namespace BeWoPlanerMobil.Controllers UserService.UpdateUserSettings(loggedInUser.UserOid.Value, userSettings); } - [Authorize] - private void SaveServiceRecordTimeIntervalToSession(ServiceRecordTimeInterval serviceRecordTimeInterval) - { - if(Model is null) - { - return; - } - - Session[SessionConstants.ServiceRecordTimeIntervalKey] = serviceRecordTimeInterval; - } - [Authorize] public void LoadGoalRatings() { @@ -847,15 +836,15 @@ namespace BeWoPlanerMobil.Controllers try { - var scm = Model.ServiceCategories.FirstOrDefault(s => s.ServiceCategoryOid.HasValue && s.ServiceCategoryOid.Value == pServiceCategoryOid); + var serviceCategoryModel = Model.ServiceCategories.FirstOrDefault(s => s.ServiceCategoryOid.HasValue && s.ServiceCategoryOid.Value == pServiceCategoryOid); - if(scm != null) + if(serviceCategoryModel != null) { - Model.SelectedServiceCategoryOid = scm.ServiceCategoryOid; - Model.SelectedServiceDescriptionOid = scm.ServiceDescriptions.OrderBy(serviceDescription => serviceDescription.Position).FirstOrDefault()?.ServiceDescriptionOid; + Model.SelectedServiceCategoryOid = serviceCategoryModel.ServiceCategoryOid; + Model.SelectedServiceDescriptionOid = serviceCategoryModel.ServiceDescriptions.OrderBy(serviceDescription => serviceDescription.Position).FirstOrDefault()?.ServiceDescriptionOid; } - return SerializeObject(scm != null ? scm.ServiceDescriptions.OrderBy(serviceDescription => serviceDescription.Position).ToList() : new List()); + return SerializeObject(serviceCategoryModel != null ? serviceCategoryModel.ServiceDescriptions.OrderBy(serviceDescription => serviceDescription.Position).ToList() : new List()); } catch(Exception exception) { @@ -1750,6 +1739,27 @@ namespace BeWoPlanerMobil.Controllers { Model.ServiceCategories = Model.ServiceCategories.OrderBy(serviceCategory => serviceCategory.Position).ToList(); } + + if(Model.SelectedSupportConcept?.Customer?.AbsenceTimes?.Any() ?? false) + { + foreach(var absenceTime in Model.SelectedSupportConcept.Customer.AbsenceTimes) + { + if(absenceTime.Start.HasValue && DateTime.Now > absenceTime.Start.Value && (absenceTime.End is null || DateTime.Now < absenceTime.End.Value)) + { + Model.IsCustomerAbsence = true; + Model.CustomerAbsenceInfo = $"{absenceTime.Reason.Description} von {absenceTime.Start:dd.MM.yyyy} bis {(absenceTime.End.HasValue ? absenceTime.End.Value.ToString("dd.MM.yyyy") : "unbekannt")}"; + break; + } + + Model.IsCustomerAbsence = false; + Model.CustomerAbsenceInfo = null; + } + } + else + { + Model.IsCustomerAbsence = false; + Model.CustomerAbsenceInfo = null; + } } [HttpPost] @@ -2917,7 +2927,10 @@ namespace BeWoPlanerMobil.Controllers return; } - var firstServiceDescription = serviceDescriptions.OrderBy(sd => sd.Position).ThenBy(sd => sd.ServiceDescriptionOid).First(); + // Hier erst nach Kategorie gehen und dann die Leistung mit der niedrigsten Position nehmen! + + var firstCategory = serviceDescriptions.Select(sd => sd.Category).OrderBy(sc => sc.Position).ThenBy(sc => sc.ServiceCategoryOid).First(); + var firstServiceDescription = serviceDescriptions.Where(sd => sd.Category.ServiceCategoryOid.Value.Equals(firstCategory.ServiceCategoryOid.Value)).OrderBy(sd => sd.Position).ThenBy(sd => sd.ServiceDescriptionOid).First(); if(serviceDescriptions.Any(a => a.ServiceDescriptionOid.HasValue && Model.SelectedServiceDescriptionOid.HasValue && a.ServiceDescriptionOid.Value.Equals(Model.SelectedServiceDescriptionOid))) { @@ -4114,8 +4127,9 @@ namespace BeWoPlanerMobil.Controllers [Authorize] public ActionResult GenerateOneTimeLinkForSignature(long serviceRecordOid) { - var token = DownloadService.CreateTemporaryTokenForOneTimeLink(serviceRecordOid.ToString(), false, 2); - + //var token = DownloadService.CreateTemporaryTokenForOneTimeLink(serviceRecordOid.ToString(), false, 2); + var token = BeWo.Service.Security.SecurityUtils.CreateExternalSignatureToken(serviceRecordOid); + var server = LoginController.GetServerFromTenant(MobileSessionFacade.Tenant); #if DEBUG @@ -4145,6 +4159,11 @@ namespace BeWoPlanerMobil.Controllers Model.OneTimeLinkText = $"Hilfeplan: {hilfeplan}
Kategorie: {kategorie}
Leistung: {leistung}
Mitarbeiter: {employee}
Datum / Uhrzeit: {datumUhrzeit}

"; + #if DEBUG + // ToDo: Länge des Tokens angeben + Model.OneTimeLinkText += $"

Länge des Token: {token.Length}"; + #endif + return PartialView("OneTimeLinkCreationPartial", Model); } diff --git a/BeWoPlanerMobil/Models/MainModel.cs b/BeWoPlanerMobil/Models/MainModel.cs index f16824837..3b930b08f 100644 --- a/BeWoPlanerMobil/Models/MainModel.cs +++ b/BeWoPlanerMobil/Models/MainModel.cs @@ -317,6 +317,7 @@ namespace BeWoPlanerMobil.Models get { var result = new List(); + result.AddRange(ServiceCategories.Select(item => new SelectListItem {Value = item.ServiceCategoryOid.Value.ToString(), Text = item.Name}).ToList()); return result; @@ -760,6 +761,9 @@ namespace BeWoPlanerMobil.Models public string OneTimeLink { get; set; } public string OneTimeLinkText { get; set; } + + public bool IsCustomerAbsence { get; set; } + public string CustomerAbsenceInfo { get; set; } } public class CustomSelectListItem diff --git a/BeWoPlanerMobil/Util/FormCollectionConstants.cs b/BeWoPlanerMobil/Util/FormCollectionConstants.cs index 91fe8a81e..9140e5781 100644 --- a/BeWoPlanerMobil/Util/FormCollectionConstants.cs +++ b/BeWoPlanerMobil/Util/FormCollectionConstants.cs @@ -63,11 +63,6 @@ public static string ReportViewerModelKey => "ReportViewerModel"; } - public class SessionConstants - { - public static string ServiceRecordTimeIntervalKey => "ServiceRecordTimeInterval"; - } - public class TempDataConstants { public static string ShowSignatureSuggestionPopup => "ShowSignatureSuggestionPopup"; diff --git a/BeWoPlanerMobil/Views/Main/SingleBookingPartial.cshtml b/BeWoPlanerMobil/Views/Main/SingleBookingPartial.cshtml index 43a27d766..55d3c0e34 100644 --- a/BeWoPlanerMobil/Views/Main/SingleBookingPartial.cshtml +++ b/BeWoPlanerMobil/Views/Main/SingleBookingPartial.cshtml @@ -155,6 +155,17 @@ } + if(Model.IsCustomerAbsence) + { +
+ + +
Klient ist abwesend
+

@Model.CustomerAbsenceInfo

+
+
+ } + using(Html.BeginForm("CreateOrUpdateServiceRecord", "Main", FormMethod.Post, new { onreset = "serviceDescriptionSelectOnReset('category-select', 'leistung-select', 'textmodule-container', 'tree')", id = "singleBookingForm" })) {
@@ -489,189 +500,189 @@ { if(Model.SelectedSupportConcept != null || Model.CostBearer2SupportConceptOid == -2) { -
- @using(Html.BeginForm("LoadServiceRecords", "Main", FormMethod.Post, new { id = "selectServiceRecordForm" })) - { -
-
-
- +
+ @using(Html.BeginForm("LoadServiceRecords", "Main", FormMethod.Post, new { id = "selectServiceRecordForm" })) + { +
+
+
+ -
-
-
- -
-
- - @*----- Anzahl Tage: [Nummern-Input] ----- *@ -
-
-
-
-
- Anzahl Tage:
- +
+
+
-
-
- @*----- Zeitraum wählen: [Von-Datum] bis [Bis-Datum] erster des Monats bis aktuelles Datum ----- *@ - var defaultStartDate = DateTime.Now.GetFirstOfMonth().ToShortDateString(); - var defaultEndDate = DateTime.Today.ToShortDateString(); -
-
-
-
-
-
-
-
- Von -
- -
-
-
+ @*----- Anzahl Tage: [Nummern-Input] ----- *@ +
+
+
+
+
+ Anzahl Tage:
+
-
-
-
-
- Bis +
+
+ + @*----- Zeitraum wählen: [Von-Datum] bis [Bis-Datum] erster des Monats bis aktuelles Datum ----- *@ + var defaultStartDate = DateTime.Now.GetFirstOfMonth().ToShortDateString(); + var defaultEndDate = DateTime.Today.ToShortDateString(); +
+
+
+
+
+
+
+
+ Von +
+ +
+
+
+
- -
-
+
+
+
+
+
+ Bis +
+ +
+
+
+
-
-
-
-
-
-
-
- Monat -
- -
-
-
-
-
-
-
- Jahr -
- + - } - } - + + + + + + + + + + + + +
+
+
+
+
+
+
+ Jahr +
+ +
+
-
+ }
} -
- }