diff --git a/BeWo/Scheduler/View/AbstractAppointmentEditForm.cs b/BeWo/Scheduler/View/AbstractAppointmentEditForm.cs index fe3795501..6d24ccc09 100644 --- a/BeWo/Scheduler/View/AbstractAppointmentEditForm.cs +++ b/BeWo/Scheduler/View/AbstractAppointmentEditForm.cs @@ -40,7 +40,7 @@ namespace BeWo.Scheduler.View public string TimeEditMask => CultureInfo.CurrentCulture.DateTimeFormat.LongTimePattern; public RecurrenceVisualController RecurrenceVisualController { get; } - protected internal bool IsNewAppointment => Controller == null || Controller.IsNewAppointment; + protected internal bool IsNewAppointment => Controller is null || Controller.IsNewAppointment; protected bool ShouldShowRecurrence => !Appointment.IsOccurrence && Controller.ShouldShowRecurrenceButton; diff --git a/BeWo/Scheduler/View/NewSchedulerView.xaml.cs b/BeWo/Scheduler/View/NewSchedulerView.xaml.cs index 01a903667..5f60c6a16 100644 --- a/BeWo/Scheduler/View/NewSchedulerView.xaml.cs +++ b/BeWo/Scheduler/View/NewSchedulerView.xaml.cs @@ -1547,7 +1547,7 @@ namespace BeWo.Scheduler.View var darfTerminDetailsSehen = true; var appointment = e.Appointment; - if(appointment.GetCustomFieldStorage() == null) + if(appointment.GetCustomFieldStorage() is null) { e.Allow = false; return; diff --git a/BeWoPlanerMobil/BeWoPlanerMobil.csproj b/BeWoPlanerMobil/BeWoPlanerMobil.csproj index 6ad2bb2b3..c8ba485bd 100644 --- a/BeWoPlanerMobil/BeWoPlanerMobil.csproj +++ b/BeWoPlanerMobil/BeWoPlanerMobil.csproj @@ -232,6 +232,7 @@ + diff --git a/BeWoPlanerMobil/Controllers/ReportController.cs b/BeWoPlanerMobil/Controllers/ReportController.cs index aed5cac3c..74626125b 100644 --- a/BeWoPlanerMobil/Controllers/ReportController.cs +++ b/BeWoPlanerMobil/Controllers/ReportController.cs @@ -76,15 +76,14 @@ namespace BeWoPlanerMobil.Controllers } var month = DateTime.Today.Month; - var year = DateTime.Today.Year; - + var year = DateTime.Today.Year; var first = new DateTime(year, month, 1).AddMonths(-1); - var last = first.AddMonths(1).AddDays(-1); + var last = first.AddMonths(1).AddDays(-1); - Model.SelectedYear = first.Year; - Model.SelectedMonth = first.Month; - Model.SelectedStartDay = first.Day; - Model.SelectedEndDay = last.Day; + Model.SelectedYear = Model.SelectedYear ?? first.Year; + Model.SelectedMonth = Model.SelectedMonth ?? first.Month; + Model.SelectedStartDay = Model.SelectedStartDay ?? first.Day; + Model.SelectedEndDay = Model.SelectedEndDay ?? last.Day; var filterEnums = Enum.GetValues(typeof(QBFilterEnum)).Cast(); @@ -158,14 +157,11 @@ namespace BeWoPlanerMobil.Controllers Model.SelectedTeam = null; } - var startDay = Model.SelectedStartDay; - var endDay = Model.SelectedEndDay; + // Datumsangaben laden in separater Methode + var reportTimeFrame = GetReportTimeFrame(); var reportObjects = new List(); - var month = Model.SelectedMonth; - var year = Model.SelectedYear; - var organisationOid = Model.SelectedOrganisationOid ?? 0; var employeeOid = Model.SelectedEmployeeOid ?? 0; var serviceCategoryOid = Model.SelectedServiceCategoryOid; @@ -175,25 +171,25 @@ namespace BeWoPlanerMobil.Controllers switch(Model.SelectedFilterItem.FilterEnum) { case QBFilterEnum.AlleKlienten: - reportObjects = ServicesOverviewRO.Create(month, year, organisationOid, employeeOid, startDay, endDay, serviceCategoryOid); + reportObjects = ServicesOverviewRO.Create(reportTimeFrame.Month, reportTimeFrame.Year, organisationOid, employeeOid, reportTimeFrame.StartDay, reportTimeFrame.EndDay, serviceCategoryOid); break; case QBFilterEnum.NurKlientenMeinesTeams: var teamRelatedCustomerOids = GetTeamCustomerOids(); - reportObjects.AddRange(teamRelatedCustomerOids.Select(cOid => ServicesOverviewRO.Create(cOid, month, year, true, organisationOid, employeeOid, startDay, endDay, serviceCategoryOid))); + reportObjects.AddRange(teamRelatedCustomerOids.Select(cOid => ServicesOverviewRO.Create(cOid, reportTimeFrame.Month, reportTimeFrame.Year, true, organisationOid, employeeOid, reportTimeFrame.StartDay, reportTimeFrame.EndDay, serviceCategoryOid))); break; case QBFilterEnum.MeineKlienten: var myRelatedCustomerOids = DefaultReportCreator.GetMeineKlientenOids(); - reportObjects.AddRange(myRelatedCustomerOids.Select(cOid => ServicesOverviewRO.Create(cOid, month, year, true, organisationOid, employeeOid, startDay, endDay, serviceCategoryOid))); + reportObjects.AddRange(myRelatedCustomerOids.Select(cOid => ServicesOverviewRO.Create(cOid, reportTimeFrame.Month, reportTimeFrame.Year, true, organisationOid, employeeOid, reportTimeFrame.StartDay, reportTimeFrame.EndDay, serviceCategoryOid))); break; case QBFilterEnum.KlientenAuswahl: - reportObjects = new List { ServicesOverviewRO.Create(customerOid, month, year, false, organisationOid, employeeOid, startDay, endDay, serviceCategoryOid)}; + reportObjects = new List { ServicesOverviewRO.Create(customerOid, reportTimeFrame.Month, reportTimeFrame.Year, false, organisationOid, employeeOid, reportTimeFrame.StartDay, reportTimeFrame.EndDay, serviceCategoryOid)}; break; case QBFilterEnum.TeamAuswahl: var customerOids = GetTeamCustomerOids(teamOid); - reportObjects.AddRange(customerOids.Select(cOid => ServicesOverviewRO.Create(cOid, month, year, true, organisationOid, employeeOid, startDay, endDay, serviceCategoryOid))); + reportObjects.AddRange(customerOids.Select(cOid => ServicesOverviewRO.Create(cOid, reportTimeFrame.Month, reportTimeFrame.Year, true, organisationOid, employeeOid, reportTimeFrame.StartDay, reportTimeFrame.EndDay, serviceCategoryOid))); break; default: - reportObjects = ServicesOverviewRO.Create(month, year, organisationOid, employeeOid, startDay, endDay, serviceCategoryOid, true, false); + reportObjects = ServicesOverviewRO.Create(reportTimeFrame.Month, reportTimeFrame.Year, organisationOid, employeeOid, reportTimeFrame.StartDay, reportTimeFrame.EndDay, serviceCategoryOid, true, false); break; } @@ -444,9 +440,10 @@ namespace BeWoPlanerMobil.Controllers [Authorize] public string ChangeDateSelection(string startDayString, string endDayString, string monthString, string yearString) { - if(Model == null) + if(Model is null) { Logout(); + return _LeerzeichenFuerGetMethoden; } var isParsingSuccessful1 = int.TryParse(startDayString, out var startDay); @@ -469,7 +466,7 @@ namespace BeWoPlanerMobil.Controllers } [Authorize] - public string ChangeFilters(string employeeOidStr, string organisationOidStr, string categoryOidStr) + public string ChangeFilters(string organisationOidStr, string categoryOidStr) { if(Model is null) { @@ -477,22 +474,18 @@ namespace BeWoPlanerMobil.Controllers return _LeerzeichenFuerGetMethoden; } - var isParsingSuccessful1 = long.TryParse(employeeOidStr, out var employeeOid); var isParsingSuccessful2 = long.TryParse(organisationOidStr, out var organisationOid); var isParsingSuccessful3 = long.TryParse(categoryOidStr, out var categoryOid); - Model.SelectedEmployee = isParsingSuccessful1 ? EmployeeService.LoadCompactEmployee(employeeOid) : null; - - Model.SelectedOrganisation = isParsingSuccessful2 ? CustomerService.LoadOrganisationCompact(organisationOid) : null; + Model.SelectedOrganisation = isParsingSuccessful2 ? Model.Organisations.FirstOrDefault(organisation => organisation.OrganisationOid.Equals(organisationOid)) : null; Model.SelectedServiceCategory = isParsingSuccessful3 ? OperationsService.LoadServiceCategory(categoryOid) : null; return _LeerzeichenFuerGetMethoden; } - // ToDo: Mittels CheckBoxFor realisieren, um den Wert zu erhalten. [Authorize] - public string ChangeIsForSelectedEmployeesOnly(bool isForSelectedEmployeesOnly) + public string ChangeIsForSelectedEmployeesOnly(bool? isForSelectedEmployeeOnly, long? employeeOid) { if(Model is null) { @@ -500,7 +493,86 @@ namespace BeWoPlanerMobil.Controllers return _LeerzeichenFuerGetMethoden; } - Model.IsForSelectedEmployeesOnly = isForSelectedEmployeesOnly; + Model.IsForSelectedEmployeesOnly = isForSelectedEmployeeOnly ?? false; + Model.SelectedEmployee = employeeOid.HasValue ? Model.Employees.FirstOrDefault(employee => employee.EmployeeOid.Equals(employeeOid.Value)) : null; + + return _LeerzeichenFuerGetMethoden; + } + + [Authorize] + public string SetEmployeeOid(long? employeeOid) + { + if(Model is null) + { + Logout(); + return _LeerzeichenFuerGetMethoden; + } + + Model.SelectedEmployee = employeeOid.HasValue ? Model.Employees.FirstOrDefault(employee => employee.EmployeeOid.Equals(employeeOid)) : null; + + return _LeerzeichenFuerGetMethoden; + } + + [Authorize] + public string ChangeIsForSelectedOrganisationOnly(bool? isForSelectedOrganisationOnly, long? organisationOid) + { + if(Model is null) + { + Logout(); + return _LeerzeichenFuerGetMethoden; + } + + Model.IsForSelectedCostbearersOnly = isForSelectedOrganisationOnly ?? false; + Model.SelectedOrganisation = organisationOid.HasValue ? Model.Organisations.FirstOrDefault(organisation => organisation.OrganisationOid.Equals(organisationOid)) : null; + + return _LeerzeichenFuerGetMethoden; + } + + [Authorize] + public string SetOrganisationOid(long? organisationOid) + { + if(Model is null) + { + Logout(); + return _LeerzeichenFuerGetMethoden; + } + + Model.SelectedOrganisation = organisationOid.HasValue ? Model.Organisations.FirstOrDefault(organisation => organisation.OrganisationOid.Equals(organisationOid)) : null; + + return _LeerzeichenFuerGetMethoden; + } + + [Authorize] + public string ChangeIsForSelectedServiceCategoryOnly(bool? isForSelectedServiceCategoryOnly, long? serviceCategoryOid) + { + if(Model is null) + { + Logout(); + return _LeerzeichenFuerGetMethoden; + } + + Model.IsForSelectedCategoryOnly = isForSelectedServiceCategoryOnly ?? false; + if(serviceCategoryOid.HasValue) + { + Model.SelectedServiceCategory = Model.ServiceCategories.FirstOrDefault(serviceCategory => serviceCategory.ServiceCategoryOid == serviceCategoryOid); + } + + return _LeerzeichenFuerGetMethoden; + } + + [Authorize] + public string SetServiceCategoryOid(long? serviceCategoryOid) + { + if(Model is null) + { + Logout(); + return _LeerzeichenFuerGetMethoden; + } + + if(serviceCategoryOid.HasValue) + { + Model.SelectedServiceCategory = Model.ServiceCategories.FirstOrDefault(serviceCategory => serviceCategory.ServiceCategoryOid == serviceCategoryOid); + } return _LeerzeichenFuerGetMethoden; } @@ -713,14 +785,10 @@ namespace BeWoPlanerMobil.Controllers Model.SelectedTeam = null; } - var startDay = Model.SelectedStartDay; - var endDay = Model.SelectedEndDay; + var reportTimeFrame = GetReportTimeFrame(); var reportObjects = new List(); - var month = Model.SelectedMonth; - var year = Model.SelectedYear; - var organisationOid = Model.SelectedOrganisationOid ?? 0; var employeeOid = Model.SelectedEmployeeOid ?? 0; var serviceCategoryOid = Model.SelectedServiceCategoryOid; @@ -730,25 +798,25 @@ namespace BeWoPlanerMobil.Controllers switch(Model.SelectedFilterItem.FilterEnum) { case QBFilterEnum.AlleKlienten: - reportObjects = ServicesOverviewRO.Create(month, year, organisationOid, employeeOid, startDay, endDay, serviceCategoryOid); + reportObjects = ServicesOverviewRO.Create(reportTimeFrame.Month, reportTimeFrame.Year, organisationOid, employeeOid, reportTimeFrame.StartDay, reportTimeFrame.EndDay, serviceCategoryOid); break; case QBFilterEnum.NurKlientenMeinesTeams: var teamRelatedCustomerOids = GetTeamCustomerOids(); - reportObjects.AddRange(teamRelatedCustomerOids.Select(cOid => ServicesOverviewRO.Create(cOid, month, year, true, organisationOid, employeeOid, startDay, endDay, serviceCategoryOid))); + reportObjects.AddRange(teamRelatedCustomerOids.Select(cOid => ServicesOverviewRO.Create(cOid, reportTimeFrame.Month, reportTimeFrame.Year, true, organisationOid, employeeOid, reportTimeFrame.StartDay, reportTimeFrame.EndDay, serviceCategoryOid))); break; case QBFilterEnum.MeineKlienten: var myRelatedCustomerOids = DefaultReportCreator.GetMeineKlientenOids(); - reportObjects.AddRange(myRelatedCustomerOids.Select(cOid => ServicesOverviewRO.Create(cOid, month, year, true, organisationOid, employeeOid, startDay, endDay, serviceCategoryOid))); + reportObjects.AddRange(myRelatedCustomerOids.Select(cOid => ServicesOverviewRO.Create(cOid, reportTimeFrame.Month, reportTimeFrame.Year, true, organisationOid, employeeOid, reportTimeFrame.StartDay, reportTimeFrame.EndDay, serviceCategoryOid))); break; case QBFilterEnum.KlientenAuswahl: - reportObjects = new List { ServicesOverviewRO.Create(customerOid, month, year, false, organisationOid, employeeOid, startDay, endDay, serviceCategoryOid) }; + reportObjects = new List { ServicesOverviewRO.Create(customerOid, reportTimeFrame.Month, reportTimeFrame.Year, false, organisationOid, employeeOid, reportTimeFrame.StartDay, reportTimeFrame.EndDay, serviceCategoryOid) }; break; case QBFilterEnum.TeamAuswahl: var customerOids = GetTeamCustomerOids(teamOid); - reportObjects.AddRange(customerOids.Select(cOid => ServicesOverviewRO.Create(cOid, month, year, true, organisationOid, employeeOid, startDay, endDay, serviceCategoryOid))); + reportObjects.AddRange(customerOids.Select(cOid => ServicesOverviewRO.Create(cOid, reportTimeFrame.Month, reportTimeFrame.Year, true, organisationOid, employeeOid, reportTimeFrame.StartDay, reportTimeFrame.EndDay, serviceCategoryOid))); break; default: - reportObjects = ServicesOverviewRO.Create(month, year, organisationOid, employeeOid, startDay, endDay, serviceCategoryOid, true, false); + reportObjects = ServicesOverviewRO.Create(reportTimeFrame.Month, reportTimeFrame.Year, organisationOid, employeeOid, reportTimeFrame.StartDay, reportTimeFrame.EndDay, serviceCategoryOid, true, false); break; } @@ -887,5 +955,44 @@ namespace BeWoPlanerMobil.Controllers return PartialView("QuittierungsbelegsResultPartial", Model); } + + private ReportTimeFrame GetReportTimeFrame() + { + var month = DateTime.Today.Month; + var year = DateTime.Today.Year; + + var first = new DateTime(year, month, 1).AddMonths(-1); + var last = first.AddMonths(1).AddDays(-1); + + return new ReportTimeFrame(Model.SelectedYear ?? year, Model.SelectedMonth ?? month, Model.SelectedStartDay ?? first.Day, Model.SelectedEndDay ?? last.Day); + } + + [Authorize] + [HttpPost] + public ActionResult DeleteCustomerSignature() + { + if(Model is null) + { + return Logout(); + } + + // ToDo: Unterschriften laden und gegebenenfalls Parameter einbauen + + return RedirectToActionPermanent("InitReports", Model); + } + + [Authorize] + [HttpPost] + public ActionResult DeleteEmployeeSignature() + { + if(Model is null) + { + return Logout(); + } + + // ToDo: Unterschrift laden und gebenenfalls Parameter einbauen + + return RedirectToActionPermanent("InitReports", Model); + } } } \ No newline at end of file diff --git a/BeWoPlanerMobil/Models/ReportModel.cs b/BeWoPlanerMobil/Models/ReportModel.cs index 5b2669327..553e995e7 100644 --- a/BeWoPlanerMobil/Models/ReportModel.cs +++ b/BeWoPlanerMobil/Models/ReportModel.cs @@ -35,9 +35,11 @@ namespace BeWoPlanerMobil.Models } } - [Display(Name = "Monat")] public int SelectedMonth { get; set; } = 1; + [Display(Name = "Monat")] + public int? SelectedMonth { get; set; } - [Display(Name = "Jahr")] public int SelectedYear { get; set; } = 2021; + [Display(Name = "Jahr")] + public int? SelectedYear { get; set; } public List Months { @@ -83,8 +85,8 @@ namespace BeWoPlanerMobil.Models { var result = new List(); - var month = SelectedMonth; - var year = SelectedYear; + var month = SelectedMonth ?? DateTime.Today.Month; + var year = SelectedYear ?? DateTime.Today.Year; var last = new DateTime(year, month, 1).AddMonths(1).AddDays(-1).Day; @@ -93,7 +95,7 @@ namespace BeWoPlanerMobil.Models result.Add(new SelectListItem { Value = i.ToString(), - Text = i.ToString() + Text = i.ToString() }); } @@ -102,10 +104,10 @@ namespace BeWoPlanerMobil.Models } [Display(Name = "Vom")] - public int SelectedStartDay { get; set; } + public int? SelectedStartDay { get; set; } [Display(Name = "Bis")] - public int SelectedEndDay { get; set; } + public int? SelectedEndDay { get; set; } public ConfirmationReceiptObject ConfirmationReceiptObject { get; set; } diff --git a/BeWoPlanerMobil/Scripts/utils/logging.js b/BeWoPlanerMobil/Scripts/utils/logging.js index 91aa1ded6..eea9a61be 100644 --- a/BeWoPlanerMobil/Scripts/utils/logging.js +++ b/BeWoPlanerMobil/Scripts/utils/logging.js @@ -7,7 +7,7 @@ function logWarning(message) { } function logError(message) { - logColorfulMessage(message, "red"); + console.error("%c" + message, "font-size: 16px; font-weight:bold; color: red"); } function logDebug(message) { diff --git a/BeWoPlanerMobil/Scripts/view-scripts/report.js b/BeWoPlanerMobil/Scripts/view-scripts/report.js index 392a4f6fd..338ee2ca9 100644 --- a/BeWoPlanerMobil/Scripts/view-scripts/report.js +++ b/BeWoPlanerMobil/Scripts/view-scripts/report.js @@ -4,10 +4,8 @@ function initializeReportView() { checkForExistingSignature(); - + calculateDays(); qbFilterSelectionChange(); - - filterCheckBoxChange(); } function calculateDays() { @@ -128,25 +126,6 @@ function qbFilterSelectionChange() { $.get(selectedFilterEnumUrl, { filterEnumString: selectedOption}); } -function filterCheckBoxChange() { - var changeFiltersUrl = getChangeFiltersUrl(); - - var isEmployeeSelected = $("#selected-employee-cb").is(":checked"); - var isOrganisationSelected = $("#selected-organisation-cb").is(":checked"); - var isCategorySelected = $("#selected-category-cb").is(":checked"); - - var employeeOid = isEmployeeSelected ? $("#employee-select option:selected").val() : null; - var organisationOid = isOrganisationSelected ? $("#organisation-select option:selected").val() : null; - var categoryOid = isCategorySelected ? $("#category-select option:selected").val() : null; - - $.get(changeFiltersUrl, - { - employeeOidStr: employeeOid, - organisationOidStr: organisationOid, - categoryOidStr: categoryOid - }); -} - function onCustomerSelectionChange() { var url = getSetCustomerUrl(); diff --git a/BeWoPlanerMobil/Views/Report/QuittierungsbelegsResultPartial.cshtml b/BeWoPlanerMobil/Views/Report/QuittierungsbelegsResultPartial.cshtml index f34bef827..dfb69fc32 100644 --- a/BeWoPlanerMobil/Views/Report/QuittierungsbelegsResultPartial.cshtml +++ b/BeWoPlanerMobil/Views/Report/QuittierungsbelegsResultPartial.cshtml @@ -49,7 +49,7 @@ //overwrite, signatureOidsString, canSign, cardBodyId, customerOid, numberOfEntries, customerName, timeSpan, isEmployeeSignature var methodName = "showSignaturePad(" + - $"{result.HasCustomerSignature.ToString().ToLower()}, " + + $"{result.HasCustomerSignature.ToString().ToLower()}, " + $"'{customerSignatureOidsString}', " + $"{canCustomerSign.ToString().ToLower()}, " + $"'#collapse-result-{result.Identifier}', " + @@ -107,25 +107,66 @@ break; } } + + + + @* Todo: Löschfunktionen implementieren *@ +
+
+
+
+ +
+

+ @result.CustomerName +

+
-

- @result.CustomerName -

-
- - +
+
+
+ @**@ + +
+
+ @**@ + +
+
diff --git a/BeWoPlanerMobil/Views/Report/Report.cshtml b/BeWoPlanerMobil/Views/Report/Report.cshtml index b5ffe6825..bdf98a2d6 100644 --- a/BeWoPlanerMobil/Views/Report/Report.cshtml +++ b/BeWoPlanerMobil/Views/Report/Report.cshtml @@ -1,6 +1,4 @@ -@using BeWoPlanerMobil.Util.ReportUtils -@using BS.Shared.Extensions -@model BeWoPlanerMobil.Models.ReportModel +@model BeWoPlanerMobil.Models.ReportModel @{ ViewBag.Title = "Quittierungsbeleg"; @@ -34,6 +32,21 @@ $(document).ready(function() { initializeReportView(); calcReportFormPrependWidth(); + + if($("#selected-employee-cb").is(":checked")) { + $("#employee-select-container").removeClass("d-none"); + $("#employee-select-container").addClass("d-block"); + } + + if($("#selected-organisation-cb").is(":checked")) { + $("#organisation-select-container").removeClass("d-none"); + $("#organisation-select-container").addClass("d-block"); + } + + if($("#selected-category-cb").is(":checked")) { + $("#test-div3").removeClass("d-none"); + $("#test-div3").addClass("d-block"); + } }); $(window).resize(function() { @@ -70,6 +83,107 @@ logError(error); } } + + function setIsOnlyForSelectedEmployee() { + try { + var cb = $("#selected-employee-cb"); + var isChecked = cb.is(":checked"); + var employeeOid = isChecked ? parseFloat($("#employee-select option:selected").val()) : null; + + $.get("@Url.Action("ChangeIsForSelectedEmployeesOnly")", { isForSelectedEmployeeOnly: isChecked, employeeOid: employeeOid}); + } catch (error) { + logError(error); + } + } + + function setIsOnlyForSelectedOrganisation() { + try { + var cb = $("#selected-organisation-cb"); + var isChecked = cb.is(":checked"); + var organisationOid = isChecked ? parseFloat($("#organisation-select option:selected").val()) : null; + + $.get("@Url.Action("ChangeIsForSelectedOrganisationOnly")", { isForSelectedOrganisationOnly: isChecked, organisationOid: organisationOid}); + } catch(error) { + logError(error); + } + } + + function setIsOnlyForSelectedServiceCategory() { + try { + var cb = $("#selected-category-cb"); + var isChecked = cb.is(":checked"); + var serviceCategoryOid = isChecked ? parseFloat($("#category-select option:selected").val()) : null; + + $.get("@Url.Action("ChangeIsForSelectedServiceCategoryOnly")", { isForSelectedServiceCategoryOnly: isChecked, serviceCategoryOid: serviceCategoryOid}); + } catch(error) { + logError(error); + } + } + + function setReportEmployee() { + try { + var employeeOid = parseFloat($("#employee-select option:selected").val()); + if(employeeOid !== null && $.isNumeric(employeeOid)) { + $.get("@Url.Action("SetEmployeeOid")", { employeeOid: employeeOid }); + } else { + logWarning("employeeOid '" + employeeOid + "' ist nicht numerisch!"); + } + } catch(error) { + logError(error); + } + } + + function setReportOrganisation() { + try { + var organisationOid = parseFloat($("#organisation-select option:selected").val()); + if(organisationOid !== null && $.isNumeric(organisationOid)) { + $.get("@Url.Action("SetOrganisationOid")", { organisationOid: organisationOid }); + } else { + logWarning("organisationOid '" + organisationOid + "' ist nicht numerisch!"); + } + } catch(error) { + logError(error); + } + } + + function setReportServiceCategory() { + try { + var serviceCategoryOid = parseFloat($("#category-select option:selected").val()); + if(serviceCategoryOid !== null && $.isNumeric(serviceCategoryOid)) { + $.get("@Url.Action("SetServiceCategoryOid")", { serviceCategoryOid: serviceCategoryOid }); + } else { + logWarning("serviceCategoryOid '" + serviceCategoryOid + "' ist nicht numerisch!"); + } + } catch (error) { + logError(error); + } + } + + function deleteCustomerSignatures(cardBodyId) { + try { + cardHeaderButtonClick(cardBodyId); + + // ToDo: Nachfragen, ob die Unterschriften wirklich gelöscht werden sollen + showMessagePopupWithCallback("Unterschriften löschen", "", function() { + + }, false); + } catch (error) { + logError(error); + } + } + + function deleteEmployeeSignature(cardBodyId) { + try { + cardHeaderButtonClick(cardBodyId); + + // ToDo: Nachfragen, ob die Unterschrift wirklich gelöscht werden soll + showMessagePopupWithCallback("Unterschrift löschen", "", function () { + + }, false); + } catch(error) { + logError(error); + } + }
@@ -123,35 +237,38 @@
+
- + @Html.CheckBoxFor(m => m.IsForSelectedEmployeesOnly, new { onchange = "setIsOnlyForSelectedEmployee()", @class = "custom-control-input", id = "selected-employee-cb", data_toggle = "collapse", data_target = "#employee-select-container" })
- @Html.DropDownListFor(m => m.SelectedEmployeeOid, Model.EmployeeItems, new { id = "employee-select", @class = "custom-select", onchange = "filterCheckBoxChange()" }) + @Html.DropDownListFor(m => m.SelectedEmployeeOid, Model.EmployeeItems, new { id = "employee-select", @class = "custom-select", onchange = "setReportEmployee()" })
+
- + @Html.CheckBoxFor(m => m.IsForSelectedCostbearersOnly, new { id = "selected-organisation-cb", @class = "custom-control-input", onchange = "setIsOnlyForSelectedOrganisation()", data_toggle = "collapse", data_target = "#organisation-select-container" })
- @Html.DropDownListFor(m => m.SelectedOrganisationOid, Model.OrganisationItems, new { id = "organisation-select", @class = "custom-select", onchange = "filterCheckBoxChange()" }) + @Html.DropDownListFor(m => m.SelectedOrganisationOid, Model.OrganisationItems, new { id = "organisation-select", @class = "custom-select", onchange = "setReportOrganisation()" })
+
- + @Html.CheckBoxFor(m => m.IsForSelectedCategoryOnly, new { id = "selected-category-cb", @class = "custom-control-input", onchange = "setIsOnlyForSelectedServiceCategory()", data_toggle = "collapse", data_target = "#test-div3" })
- @Html.DropDownListFor(m => m.SelectedServiceCategoryOid, Model.ServiceCategoryItems, new { id = "category-select", @class = "custom-select", onchange = "filterCheckBoxChange()" }) + @Html.DropDownListFor(m => m.SelectedServiceCategoryOid, Model.ServiceCategoryItems, new { id = "category-select", @class = "custom-select", onchange = "setReportServiceCategory()" })
diff --git a/BeWoPlanerMobil/Views/Shared/_Layout.cshtml b/BeWoPlanerMobil/Views/Shared/_Layout.cshtml index 33d81b987..dd770a23a 100644 --- a/BeWoPlanerMobil/Views/Shared/_Layout.cshtml +++ b/BeWoPlanerMobil/Views/Shared/_Layout.cshtml @@ -38,7 +38,7 @@ - + diff --git a/Data/Access/SearchDAO.cs b/Data/Access/SearchDAO.cs index 6f0f11256..9b191b1f6 100644 --- a/Data/Access/SearchDAO.cs +++ b/Data/Access/SearchDAO.cs @@ -3616,11 +3616,11 @@ namespace BeWo.Data.Access { var c = CreateCriteria("r").Add(Restrictions.Eq(nameof(BeWoEntityBase.IsActive), ActivationTypeId.Active)).Add(Restrictions.In(nameof(BeWoEntityBase.Oid), resourceOids)); - var excludingSelectedAppointment = selectedAppointmentOid.HasValue ? $"oid <> {selectedAppointmentOid} AND " : ""; + var excludingSelectedAppointment = selectedAppointmentOid.HasValue ? $"Oid <> {selectedAppointmentOid} AND " : ""; var sql = "Oid IN " + - "(SELECT resourceoid FROM resource2newschapp r2n WHERE r2n.newschappoid IN " + - $"(SELECT oid FROM newschedulerappointment WHERE IsActive = 1 AND {excludingSelectedAppointment}('{start:yyyy-MM-dd HH:mm:ss}' > startdate OR '{end:yyyy-MM-dd HH:mm:ss}' > startdate) AND ('{start:yyyy-MM-dd HH:mm:ss}' < enddate OR '{end:yyyy-MM-dd HH:mm:ss}' < enddate)))"; + "(SELECT ResourceOid FROM resource2newschapp r2n WHERE r2n.NewSchAppOid IN " + + $"(SELECT Oid FROM newschedulerappointment WHERE IsActive = 1 AND Type <> 4 AND {excludingSelectedAppointment}('{start:yyyy-MM-dd HH:mm:ss}' > StartDate OR '{end:yyyy-MM-dd HH:mm:ss}' > StartDate) AND ('{start:yyyy-MM-dd HH:mm:ss}' < EndDate OR '{end:yyyy-MM-dd HH:mm:ss}' < EndDate)))"; var criterion = Expression.Sql(sql); @@ -3683,7 +3683,7 @@ namespace BeWo.Data.Access foreach(var occurrence in occurrenceAppointments) { - if(recurringAppointment.EndDate == null || recurringAppointment.StartDate == null) + if(recurringAppointment.EndDate is null || recurringAppointment.StartDate is null) { continue; } diff --git a/Service/ServiceImplementations/ResourceServiceImp.cs b/Service/ServiceImplementations/ResourceServiceImp.cs index 2328c94a1..0fefade49 100644 --- a/Service/ServiceImplementations/ResourceServiceImp.cs +++ b/Service/ServiceImplementations/ResourceServiceImp.cs @@ -1358,6 +1358,7 @@ namespace BeWo.Service.ServiceImplementations //visibleEmployees = new List {user.Employee}; } + // ToDo: Nicht anonymisieren, wenn der Benutzer/Mitarbeiter das Recht hat, Termine anderer Mitarbeiter anzusehen foreach(var appointment in appointments) { var isOriginator = appointment.Originator.EmployeeOid.Equals(user.Employee.Oid.Value); @@ -1365,15 +1366,14 @@ namespace BeWo.Service.ServiceImplementations var isInEmployeeList = appointment.EmployeeList.Any(e2a => e2a.Employee.EmployeeOid.Equals(user.Employee.Oid.Value)); // Betreff und Ort werden anonymisiert, wenn der angemeldete Benutzer nicht Ersteller ist und nicht in der Mitarbeiterliste ist und er den Ersteller nicht ansehen darf. - if(!isOriginator && !isInEmployeeList && !isAllowedToSeeOriginator) + if(!isOriginator && !isInEmployeeList && !hasRightToViewEmployeeAppointments) { appointment.Subject = anonymisiert; appointment.Location = anonymisiert; appointment.CanBeEdited = false; } - - if(!isOriginator && !visibleEmployees.Any(employee => employee.Oid.HasValue && employee.Oid.Value.Equals(appointment.Originator.EmployeeOid))) + if(!isOriginator && !hasRightToViewEmployeeAppointments) { appointment.Originator.FirstName = anonymisiert; appointment.Originator.LastName = anonymisiert; @@ -1383,7 +1383,7 @@ namespace BeWo.Service.ServiceImplementations // Klienten anonymisieren appointment.CustomerList.DoForEach(customer => { - if(!visibleCustomers.Any(c => c.Oid.HasValue && c.Oid.Equals(customer.CustomerOid))) + if(!hasRightToViewCustomerAppointments) { customer.FirstName = anonymisiert; customer.LastName = anonymisiert; @@ -1395,7 +1395,7 @@ namespace BeWo.Service.ServiceImplementations // Mitarbeiter anonymisieren appointment.EmployeeList.DoForEach(employee2Appointment => { - if(!visibleEmployees.Any(employee => employee.Oid.HasValue && employee.Oid.Value.Equals(employee2Appointment.Employee.EmployeeOid))) + if(!hasRightToViewEmployeeAppointments) { employee2Appointment.Employee.FirstName = anonymisiert; employee2Appointment.Employee.LastName = anonymisiert; @@ -1833,6 +1833,7 @@ namespace BeWo.Service.ServiceImplementations } } + // ToDo: Anonymisieren? public List LoadTasksAndAppointmentsForEmployee(long pEmployeeOid, DateTime pInvertalStart, int pBufferSize, long? pEmployeeAppointmentsOid) { try