From e92a8daba16a3ed87d45525bee0abbe58e6e21f9 Mon Sep 17 00:00:00 2001 From: Lyndon Jetten Date: Wed, 11 Nov 2020 14:21:29 +0100 Subject: [PATCH 1/2] Textbausteine wird IsActive zugewiesen beim Insert Mitarbeiteranzahl ist jetzt korrekt bei Gruppenbuchungen im Mobilklienten Textbausteine-Button in der Mobilversion wird nicht angezeigt, wenn es keine Textbausteine gibt Der Klienten-Kommentar wird in der Mobilversion angezeigt --- BeWo/ViewModel/TextModuleVM.cs | 22 ++++- BeWoPlanerMobil/Controllers/MainController.cs | 8 +- BeWoPlanerMobil/Models/MainModel.cs | 2 +- BeWoPlanerMobil/Scripts/mobileUtils.js | 3 +- BeWoPlanerMobil/Scripts/view-scripts/main.js | 9 ++ .../Util/FormCollectionConstants.cs | 2 + .../Views/Customer/Customer.cshtml | 17 ++++ BeWoPlanerMobil/Views/Main/Main.cshtml | 94 ++++++++++++------- BeWoPlanerMobil/Views/Shared/_Layout.cshtml | 4 +- .../OperationsServiceImp.cs | 3 + 10 files changed, 122 insertions(+), 42 deletions(-) diff --git a/BeWo/ViewModel/TextModuleVM.cs b/BeWo/ViewModel/TextModuleVM.cs index 7f99327f2..874a33672 100644 --- a/BeWo/ViewModel/TextModuleVM.cs +++ b/BeWo/ViewModel/TextModuleVM.cs @@ -28,9 +28,10 @@ namespace BeWo.ViewModel private bool _IsExpanded; private TextModuleVM _Parent; - - public TextModuleVM(TextModuleDC pDataContract) : base(pDataContract, pDataContract.TextModuleOid == null) {} + private ActivationTypeId _ActivationType; + + public TextModuleVM(TextModuleDC pDataContract) : base(pDataContract, pDataContract.TextModuleOid == null) {} public bool IsExpanded @@ -78,6 +79,22 @@ namespace BeWo.ViewModel } } + public ActivationTypeId ActivationType + { + get => _ActivationType; + + set + { + if(AreDifferent(_ActivationType, value)) + { + _ActivationType = value; + StoreDirtyInformation(AreDifferent(DataContract.ActivationType, value), nameof(ActivationType)); + + FirePropertyChanged(nameof(ActivationType)); + } + } + } + public int Position { get => _Position; @@ -207,6 +224,7 @@ namespace BeWo.ViewModel pDataContract.Name = _Name; pDataContract.IsParent = _IsParent; pDataContract.IsExpanded = _IsExpanded; + pDataContract.ActivationType = _ActivationType; pDataContract.IsOnlyForEmployee = _IsOnlyForEmployee; diff --git a/BeWoPlanerMobil/Controllers/MainController.cs b/BeWoPlanerMobil/Controllers/MainController.cs index 52c9e1816..5629190a1 100644 --- a/BeWoPlanerMobil/Controllers/MainController.cs +++ b/BeWoPlanerMobil/Controllers/MainController.cs @@ -91,6 +91,7 @@ namespace BeWoPlanerMobil.Controllers Model.ShowExpiredSupportConcepts = GetUserSettingValue("ShowExpiredSupportConcepts") == "1"; Model.ShowOnlyOwnSupportConcepts = GetUserSettingValue("ShowOnlyMySupportConcepts") == "1"; + var mandator = GetMandator(); @@ -912,6 +913,11 @@ namespace BeWoPlanerMobil.Controllers var oidList = OperationsService.InsertNewServiceRecords(new List { Model.NewServiceRecord }); Model.ServiceRecordOid = oidList[0]; + + if(Model.NewServiceRecord.CostBearer != null) + { + TempData[FormCollectionConstants.ShowSignatureSuggestionPopup] = true; + } } else { @@ -2143,7 +2149,7 @@ namespace BeWoPlanerMobil.Controllers Model.ServiceCategories = CreateServiceCategoryModels(OperationsService.GetAllServiceDescriptions()); - Model.SelectedEmployees.Add(MobileSessionFacade.LoggedInCompactEmployee); + Model.SelectedEmployees.AddIfNotIn(MobileSessionFacade.LoggedInCompactEmployee); Model.IsInEditingMode = false; Model.SelectedServiceRecord = null; diff --git a/BeWoPlanerMobil/Models/MainModel.cs b/BeWoPlanerMobil/Models/MainModel.cs index 8f3c7658a..b10188620 100644 --- a/BeWoPlanerMobil/Models/MainModel.cs +++ b/BeWoPlanerMobil/Models/MainModel.cs @@ -120,7 +120,7 @@ namespace BeWoPlanerMobil.Models public List SupportConcepts { get; set; } public List ServiceCategories { get; set; } - public List Textbausteine { get; set; } + public List Textbausteine { get; set; } = new List(); private List _ServiceRecords; diff --git a/BeWoPlanerMobil/Scripts/mobileUtils.js b/BeWoPlanerMobil/Scripts/mobileUtils.js index b7ac9531d..a759cd660 100644 --- a/BeWoPlanerMobil/Scripts/mobileUtils.js +++ b/BeWoPlanerMobil/Scripts/mobileUtils.js @@ -40,7 +40,8 @@ function showMessagePopupWithCallback(title, message, callback, executeCallbackB }); if (executeCallbackByBothButtons === true) { - $("#message-popup-close-btn").on("click", function() { + $("#message-popup-close-btn, #message-popup-esc-btn").on("click", + function() { callback(); }); } diff --git a/BeWoPlanerMobil/Scripts/view-scripts/main.js b/BeWoPlanerMobil/Scripts/view-scripts/main.js index 62386de66..3f02b70d2 100644 --- a/BeWoPlanerMobil/Scripts/view-scripts/main.js +++ b/BeWoPlanerMobil/Scripts/view-scripts/main.js @@ -62,6 +62,15 @@ function loadServiceDescriptions() { return; } + var test = $.parseJSON(result); + if(test.length === 0) { + $("#textmodule-container").hide(); + + return; + } + + $("#textmodule-container").show(); + $("#tree").treeview({ data: result, onNodeSelected: function (event, data) { diff --git a/BeWoPlanerMobil/Util/FormCollectionConstants.cs b/BeWoPlanerMobil/Util/FormCollectionConstants.cs index 6b7b4a5d8..95e76fe38 100644 --- a/BeWoPlanerMobil/Util/FormCollectionConstants.cs +++ b/BeWoPlanerMobil/Util/FormCollectionConstants.cs @@ -44,6 +44,8 @@ public static string SelectedMonthKey => "SelectedMonth"; public static string SelectedYearKey => "SelectedYear"; public static string SelectedTeamOidKey => "SelectedTeamOid"; + public static string ShowSignatureSuggestionPopup => "ShowSignatureSuggestionPopup"; + public static string ServiceRecordOidForSignature => "ServiceRecordOidForSignature"; } public class ModelSessionConstants diff --git a/BeWoPlanerMobil/Views/Customer/Customer.cshtml b/BeWoPlanerMobil/Views/Customer/Customer.cshtml index 583fc1777..958d39245 100644 --- a/BeWoPlanerMobil/Views/Customer/Customer.cshtml +++ b/BeWoPlanerMobil/Views/Customer/Customer.cshtml @@ -185,6 +185,23 @@ + + + @if(Model.SelectedJsonCustomer.Kommentar != null) + { +
+
+
+
Kommentar
+
+
+
+ @Model.SelectedJsonCustomer.Kommentar +
+
+
+
+ } @if(Model.SelectedJsonCustomer.ReferenceNumbers.Any()) diff --git a/BeWoPlanerMobil/Views/Main/Main.cshtml b/BeWoPlanerMobil/Views/Main/Main.cshtml index e47421ebb..e8a999aea 100644 --- a/BeWoPlanerMobil/Views/Main/Main.cshtml +++ b/BeWoPlanerMobil/Views/Main/Main.cshtml @@ -105,6 +105,22 @@ $("#create-button").prop("disabled", @Model.SelectedEmployees.Count === 0 ? true : false); } + + @{ + var shouldShowSignaturePopup = TempData[FormCollectionConstants.ShowSignatureSuggestionPopup]?.GetType() == typeof(bool) && (bool) TempData[FormCollectionConstants.ShowSignatureSuggestionPopup]; + + if(Model.ServiceRecordOid > 0) + { + if(shouldShowSignaturePopup && Model.ShowSignature) + { + + showMessagePopupWithCallback("Erfolgreich gespeichert", "Möchten Sie den Eintrag unterschreiben lassen?", function() { + initializeSignature(@Model.ServiceRecordOid); + }, false); + + } + } + } }); function setInputFilter() { @@ -490,18 +506,21 @@ } -
-
-
- - + @if(Model.ShowDistanceField) + { +
+
+
+ + +
-
+ } @if(AbstractModel.HasRightToSeeTextModules) { -
+
@@ -794,7 +813,6 @@ var header = $"Dokumentation { i + 1 }"; - // TODO: 3 Notices bei 2 aktiven Dokufeldern führt zu Exception. Was ist mit der dritten Notice? Nicht anzeigen? if(Model.NumberOfDokuTypes >= 2) { if(Model.NumberOfDokuTypes <= i) @@ -1012,19 +1030,22 @@
-
-
-
- - + @if(Model.ShowDistanceField) + { +
+
+
+ + +
-
+ } @if(AbstractModel.HasRightToSeeTextModules) { -
+
@@ -1110,7 +1131,7 @@
- +
@@ -1141,7 +1162,7 @@
- +
@@ -1152,7 +1173,7 @@
- +
@@ -1162,7 +1183,7 @@
- +
@@ -1172,7 +1193,7 @@
- +
@@ -1201,7 +1222,7 @@ }
- +
@@ -1227,7 +1248,7 @@
- +
@@ -1254,27 +1275,30 @@ }
- -
-
-
- - -
-
-
- - - @if(AbstractModel.HasRightToSeeTextModules) + + @if(Model.ShowDistanceField) {
+
+
+ + +
+
+
+ } + + + @if(AbstractModel.HasRightToSeeTextModules) + { +
} - +
@if(Model.NumberOfDokuTypes == 0) diff --git a/BeWoPlanerMobil/Views/Shared/_Layout.cshtml b/BeWoPlanerMobil/Views/Shared/_Layout.cshtml index 82c3d84a7..3e68f403f 100644 --- a/BeWoPlanerMobil/Views/Shared/_Layout.cshtml +++ b/BeWoPlanerMobil/Views/Shared/_Layout.cshtml @@ -207,7 +207,7 @@
diff --git a/Service/ServiceImplementations/OperationsServiceImp.cs b/Service/ServiceImplementations/OperationsServiceImp.cs index 36718cf5b..181bfd15f 100644 --- a/Service/ServiceImplementations/OperationsServiceImp.cs +++ b/Service/ServiceImplementations/OperationsServiceImp.cs @@ -3134,7 +3134,10 @@ namespace BeWo.Service.ServiceImplementations { try { + pTextbausteine.DoForEach(tb => tb.ActivationType = ActivationTypeId.Active); + var lTextbausteine = MapperFactory.TextModuleDC_TextModule.MapToNewEntities(pTextbausteine); + DAOFactory.GenericDAO.Insert(lTextbausteine); return lTextbausteine.Select(asb => asb.Oid.Value).ToList(); From 05a0436a9fad1f94d3638210a401e4e478eec24e Mon Sep 17 00:00:00 2001 From: Lyndon Jetten Date: Wed, 11 Nov 2020 19:39:11 +0100 Subject: [PATCH 2/2] =?UTF-8?q?IsActive=20bzw.=20ActivationType=20wird=20b?= =?UTF-8?q?ei=20Textbausteinen=20ignoriert.=20Es=20wird=20eh=20sofort=20ge?= =?UTF-8?q?l=C3=B6scht=20und=20nicht=20auf=20Deleted=20gesetzt.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Data/Access/SearchDAO.cs | 6 ++-- Data/Entities/Textbaustein.cs | 32 +++++++++---------- .../DCEntityMapper/TextModuleDC_TextModule.cs | 4 +-- .../OperationsServiceImp.cs | 2 +- 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/Data/Access/SearchDAO.cs b/Data/Access/SearchDAO.cs index 5cf407459..696604539 100644 --- a/Data/Access/SearchDAO.cs +++ b/Data/Access/SearchDAO.cs @@ -1560,7 +1560,7 @@ namespace BeWo.Data.Access public IEnumerable GetActiveTextModuleByServiceCategory(long pServiceCategoryOid) { - var c = CreateCriteriaIsActive(); + var c = CreateCriteria(); c.Add(Restrictions.Or(Restrictions.Eq(TextModule.PropertyName_ServiceCategory + ".Oid", pServiceCategoryOid), Restrictions.IsNull(TextModule.PropertyName_ServiceCategory))); @@ -2380,7 +2380,7 @@ namespace BeWo.Data.Access public IEnumerable GetActiveTextModules(bool pShouldOnlyLoadOwnTextModules, bool pHasRightToSeeAll, bool pIsInAdministrationView, long pEmployeeOid) { - var criteria = CreateCriteriaIsActive(); + var criteria = CreateCriteria(); if(pIsInAdministrationView) { @@ -2406,7 +2406,7 @@ namespace BeWo.Data.Access public IEnumerable GetChildTextModules(TextModule textModule) { - var criteria = CreateCriteriaIsActive(); + var criteria = CreateCriteria(); criteria.Add(Restrictions.Eq(nameof(TextModule.Parent), textModule)); diff --git a/Data/Entities/Textbaustein.cs b/Data/Entities/Textbaustein.cs index c8c3c3631..e885065d2 100644 --- a/Data/Entities/Textbaustein.cs +++ b/Data/Entities/Textbaustein.cs @@ -4,26 +4,26 @@ namespace BeWo.Data.Entities { public class Textbaustein : BeWoEntityBase { - public static string PropertyName_Text = "Text"; - public static string PropertyName_Position = "Position"; - public static string PropertyName_ServiceCategory = "ServiceCategory"; - public static string PropertyName_Name = "Name"; - public static string PropertyName_Employee = "Employee"; + public static string PropertyName_Text = "Text"; + public static string PropertyName_Position = "Position"; + public static string PropertyName_ServiceCategory = "ServiceCategory"; + public static string PropertyName_Name = "Name"; + public static string PropertyName_Employee = "Employee"; public static string PropertyName_IsOnlyForEmployee = "IsOnlyForEmployee"; - public static string PropertyName_ParentOid = "ParentOid"; - public static string PropertyName_IsParent = "IsParent"; - public static string PropertyName_IsExpanded = "IsExpanded"; + public static string PropertyName_ParentOid = "ParentOid"; + public static string PropertyName_IsParent = "IsParent"; + public static string PropertyName_IsExpanded = "IsExpanded"; - private string _Text; - private string _Name; - private int _Position; + private string _Text; + private string _Name; + private int _Position; private ServiceCategory _ServiceCategory; - private Employee _Employee; - private bool _IsOnlyForEmployee; - private TextModule _Parent; - private bool _IsParent; - private bool _IsExpanded; + private Employee _Employee; + private bool _IsOnlyForEmployee; + private TextModule _Parent; + private bool _IsParent; + private bool _IsExpanded; public Textbaustein() diff --git a/Service/DCEntityMapper/TextModuleDC_TextModule.cs b/Service/DCEntityMapper/TextModuleDC_TextModule.cs index a2f477c3c..fcfc6efbd 100644 --- a/Service/DCEntityMapper/TextModuleDC_TextModule.cs +++ b/Service/DCEntityMapper/TextModuleDC_TextModule.cs @@ -17,7 +17,7 @@ namespace BeWo.Service.DCEntityMapper pDataContract.IsOnlyForEmployee = pEntity.IsOnlyForEmployee; pDataContract.IsParent = pEntity.IsParent; pDataContract.IsExpanded = pEntity.IsExpanded; - pDataContract.ActivationType = pEntity.IsActive; + //pDataContract.ActivationType = pEntity.IsActive; pDataContract.Parent = pEntity.Parent != null ? MapperFactory.TextModuleDC_TextModule.MapToNewDC(pEntity.Parent) : null; @@ -39,7 +39,7 @@ namespace BeWo.Service.DCEntityMapper pEntity.IsOnlyForEmployee = pDataContract.IsOnlyForEmployee; pEntity.IsParent = pDataContract.IsParent; pEntity.IsExpanded = pDataContract.IsExpanded; - pEntity.IsActive = pDataContract.ActivationType; + //pEntity.IsActive = pDataContract.ActivationType; pEntity.Parent = pDataContract.Parent != null ? DAOFactory.GenericDAO.LoadByID(pDataContract.Parent.TextModuleOid.Value) : null; diff --git a/Service/ServiceImplementations/OperationsServiceImp.cs b/Service/ServiceImplementations/OperationsServiceImp.cs index 81804a01e..61606872d 100644 --- a/Service/ServiceImplementations/OperationsServiceImp.cs +++ b/Service/ServiceImplementations/OperationsServiceImp.cs @@ -3119,7 +3119,7 @@ namespace BeWo.Service.ServiceImplementations { try { - return MapperFactory.TextModuleDC_TextModule.MapToNewDCs(DAOFactory.GenericDAO.GetAllActive()); + return MapperFactory.TextModuleDC_TextModule.MapToNewDCs(DAOFactory.GenericDAO.GetAll()); } catch (Exception e) {