diff --git a/BeWoPlanerMobil/BeWoPlanerMobil.csproj b/BeWoPlanerMobil/BeWoPlanerMobil.csproj index 1da3ceb41..f9dee8aea 100644 --- a/BeWoPlanerMobil/BeWoPlanerMobil.csproj +++ b/BeWoPlanerMobil/BeWoPlanerMobil.csproj @@ -595,7 +595,7 @@ - False + True False 8808 / diff --git a/BeWoPlanerMobil/Controllers/AbstractBaseController.cs b/BeWoPlanerMobil/Controllers/AbstractBaseController.cs index d827ac189..edaf22f2e 100644 --- a/BeWoPlanerMobil/Controllers/AbstractBaseController.cs +++ b/BeWoPlanerMobil/Controllers/AbstractBaseController.cs @@ -4,6 +4,8 @@ using System.Web.Security; using BeWo.Service.ServiceContracts; using BeWoPlanerMobil.Models; using BeWoPlanerMobil.Service; +using BS.Shared; +using BS.Shared.Core; using BS.Shared.DataContracts; namespace BeWoPlanerMobil.Controllers @@ -60,5 +62,22 @@ namespace BeWoPlanerMobil.Controllers return System.Web.HttpContext.Current.Session.Timeout; } } + + [Authorize] + public ActionResult UpdateSettings(string pKey, string pValue) + { + var userSettings = GetUser().Settings; + + UserSettingsUtils.SetSettingValue(SettingsType.ApplicationSettings, pKey, pValue, userSettings); + + var loggedInUser = GetUser(); + + if(loggedInUser?.UserOid.HasValue ?? false) + { + UserService.UpdateUserSettings(loggedInUser.UserOid.Value, userSettings); + } + + return RedirectToAction("Main"); + } } } diff --git a/BeWoPlanerMobil/Controllers/CustomerController.cs b/BeWoPlanerMobil/Controllers/CustomerController.cs index 75c8bbd62..6facbcc8f 100644 --- a/BeWoPlanerMobil/Controllers/CustomerController.cs +++ b/BeWoPlanerMobil/Controllers/CustomerController.cs @@ -2,16 +2,13 @@ using System.Collections.Generic; using System.Linq; using System.Web.Mvc; - +using BeWo.View.Navigation.Filter; using BeWoPlanerMobil.Models; using BeWoPlanerMobil.Service; using BeWoPlanerMobil.Util; -using BS.Shared; -using BS.Shared.DataContracts; +using BS.Shared.Core; using BS.Shared.DataContracts.Compact; -using static BeWoPlanerMobil.Util.MobileUtils; - namespace BeWoPlanerMobil.Controllers { public class CustomerController : AbstractBaseController @@ -49,6 +46,10 @@ namespace BeWoPlanerMobil.Controllers return Logout(); } + var customerFilter = MobileUserSettingsUtils.GetSettingValueAsEnum(AbstractModel.UserSettings, SettingsKeys.CustomerFilterCustomers, CustomerFilterEnum.MyCustomer); + + Model.SelectedCustomerFilter = customerFilter; + InitViewModel(); return View(Model); @@ -56,14 +57,15 @@ namespace BeWoPlanerMobil.Controllers private void InitViewModel() { - if(Model == null) + if(Model == null || !MobileSessionFacade.IsUserLoggedIn() || Request.Browser.Browser.Equals("InternetExplorer")) { Logout(); } if(Model.Employee?.EmployeeOid.HasValue ?? false) { - Model.Customers = EmployeeService.GetActiveCompactCustomersForEmployee(Model.Employee.EmployeeOid.Value).OrderBy(customer => customer.LastName).ToList(); + //Model.Customers = EmployeeService.GetActiveCompactCustomersForEmployee(Model.Employee.EmployeeOid.Value).OrderBy(customer => customer.LastName).ToList(); + Model.Customers = EmployeeService.GetActiveCustomersForEmployee(Model.Employee.EmployeeOid.Value, Model.SelectedCustomerFilter).OrderBy(customer => customer.LastName).ToList(); } else { @@ -74,7 +76,7 @@ namespace BeWoPlanerMobil.Controllers [Authorize] public ActionResult PreselectCustomer(long? customerOid) { - if (!MobileSessionFacade.IsUserLoggedIn() || Request.Browser.Browser.Equals("InternetExplorer")) + if (Model == null || !MobileSessionFacade.IsUserLoggedIn() || Request.Browser.Browser.Equals("InternetExplorer")) { return Logout(); } @@ -96,7 +98,7 @@ namespace BeWoPlanerMobil.Controllers { try { - if (Model == null) + if (Model == null || !MobileSessionFacade.IsUserLoggedIn() || Request.Browser.Browser.Equals("InternetExplorer")) { return Logout(); } @@ -118,5 +120,26 @@ namespace BeWoPlanerMobil.Controllers return RedirectToActionPermanent("Customer"); } + + [HttpPost] + [Authorize] + public ActionResult SetCustomerFilter(FormCollection formCollection) + { + if(Model == null || !MobileSessionFacade.IsUserLoggedIn() || Request.Browser.Browser.Equals("InternetExplorer")) + { + return Logout(); + } + + var selectedCustomerFilter = formCollection[nameof(Model.SelectedCustomerFilter)]; + + if(!Enum.TryParse(selectedCustomerFilter, out CustomerFilterEnum customerFilter)) + { + customerFilter = CustomerFilterEnum.MyCustomer; + } + + UpdateSettings(SettingsKeys.CustomerFilterCustomers, customerFilter.ToString()); + + return RedirectToActionPermanent("Customer"); + } } } diff --git a/BeWoPlanerMobil/Controllers/MainController.cs b/BeWoPlanerMobil/Controllers/MainController.cs index 21440c31e..f5127d270 100644 --- a/BeWoPlanerMobil/Controllers/MainController.cs +++ b/BeWoPlanerMobil/Controllers/MainController.cs @@ -127,12 +127,7 @@ namespace BeWoPlanerMobil.Controllers Model.Zeitraum = zeitraum; } - var customerFilterRaw = UserSettingsUtils.GetSettingValue(userSettings, SettingsKeys.CustomerFilterInZeiterfassung); - - if(!Enum.TryParse(customerFilterRaw, out CustomerFilterEnum customerFilter)) - { - customerFilter = CustomerFilterEnum.MyCustomer; - } + var customerFilter = MobileUserSettingsUtils.GetSettingValueAsEnum(userSettings, SettingsKeys.CustomerFilterInZeiterfassung, CustomerFilterEnum.MyCustomer); Model.SelectedSupportConceptFilter = customerFilter; @@ -278,28 +273,6 @@ namespace BeWoPlanerMobil.Controllers return UpdateSettings(SettingsKeys.ShowExpiredSupportConcepts, newValue ? "1" : "0"); } - [Authorize] - public ActionResult UpdateSettings(string pKey, string pValue) - { - if (Model == null) - { - return Logout(); - } - - var userSettings = GetUser().Settings; - - UserSettingsUtils.SetSettingValue(SettingsType.ApplicationSettings, pKey, pValue, userSettings); - - var loggedInUser = GetUser(); - - if(loggedInUser?.UserOid.HasValue ?? false) - { - UserService.UpdateUserSettings(loggedInUser.UserOid.Value, userSettings); - } - - return RedirectToAction("Main"); - } - [HttpPost] public new ActionResult Logout() { @@ -2456,241 +2429,75 @@ namespace BeWoPlanerMobil.Controllers return signatureServiceRecordHeader + ";" + ApplyWatermark(signatureImage, Server.MapPath("../Content/images/bewoplaner_logo_big.png")); } - + [HttpPost] - [Authorize] - public ActionResult CreateGroupBooking(FormCollection formCollection) + public ActionResult LogOutAfterSessionTimeout() { - try - { - if(Model == null) - { - return Logout(); - } + Logout(); - if(Model.SelectedConceptCostBearerRelations.Count == 1) - { - var cb2ScOids = (from scDc in Model.SelectedSupportConcepts - where scDc.CostBearerRelations != null && scDc.CostBearerRelations.Count > 0 - let costBearer2SupportConceptOid = scDc.CostBearerRelations[0].CostBearer2SupportConceptOid - where costBearer2SupportConceptOid != null - select costBearer2SupportConceptOid.Value).ToList(); - - var cb2ScOidsCount = cb2ScOids.Count; - - if (cb2ScOidsCount == 1) - { - Model.CostBearer2SupportConceptOid = cb2ScOids[0]; - } - else - { - return RedirectToActionPermanent("Main"); - } - } - - string doku1; - - if(Model.Dokutypes != null && Model.Dokutypes.Length > 0) - { - doku1 = formCollection[FormCollectionConstants.Dokumentation1Key]; - } - else - { - doku1 = formCollection[FormCollectionConstants.Dokumentation6Key]; - } - - Log.Info($"CreateServiceRecord: datum:{formCollection[FormCollectionConstants.DateKey]}; start:{formCollection[FormCollectionConstants.StartKey]}; ende:{formCollection[FormCollectionConstants.EndKey]}; dauer:{formCollection[FormCollectionConstants.DurationKey]}; doku:{doku1}; aktion:{formCollection[FormCollectionConstants.HiddenInputKey]}"); - - if(string.IsNullOrEmpty(formCollection[FormCollectionConstants.DateKey])) - { - return View("Main", Model); - } - - var distanz = formCollection[FormCollectionConstants.DistanceKey]; - var distanceInMeters = 0; - - if(!string.IsNullOrEmpty(distanz)) - { - if(int.TryParse(distanz, out var parsedDistance)) - { - distanceInMeters = parsedDistance; - } - } - - var selectedCostbearerScRelOid = Model.CostBearer2SupportConceptOid < 1 ? null : Model.CostBearer2SupportConceptOid; - var datum = Convert.ToDateTime(formCollection[FormCollectionConstants.DateKey]); - - var enddatum = datum; - - var endDateString = formCollection[FormCollectionConstants.EndDateKey]; - if(endDateString != null) - { - enddatum = Convert.ToDateTime(endDateString); - } - - var start = formCollection[FormCollectionConstants.StartKey]; - var ende = formCollection[FormCollectionConstants.EndKey]; - var dauer = 0; - - if(datum > enddatum) - { - enddatum = datum; - } - - if(!string.IsNullOrEmpty(formCollection[FormCollectionConstants.DurationKey])) - { - int.TryParse(formCollection[FormCollectionConstants.DurationKey], out dauer); - } - - var doku2 = formCollection[FormCollectionConstants.Dokumentation2Key]; - var doku3 = formCollection[FormCollectionConstants.Dokumentation3Key]; - var doku4 = formCollection[FormCollectionConstants.Dokumentation4Key]; - var doku5 = formCollection[FormCollectionConstants.Dokumentation5Key]; - - var zeitenFeld = new DateTime[2]; - - if(start == string.Empty && ende == string.Empty) - { - zeitenFeld[0] = new DateTime(datum.Year, datum.Month, datum.Day, 0, 0, 1); - - if(enddatum == datum) - { - zeitenFeld[1] = new DateTime(datum.Year, datum.Month, datum.Day, 0, 0, 1).AddMinutes(dauer); - } - else - { - zeitenFeld[1] = new DateTime(enddatum.Year, enddatum.Month, enddatum.Day, 0, 0, 1).AddMinutes(dauer); - } - } - else - { - zeitenFeld = enddatum == datum ? ConvertRecordTimes(start, ende, datum, dauer) : ConvertRecordTimesWithEndDate(start, ende, datum, enddatum, dauer); - } - - if(dauer == 0 || zeitenFeld[1] != zeitenFeld[0]) - { - dauer = (int)(zeitenFeld[1] - zeitenFeld[0]).TotalMinutes; - } - - if(Model.NewServiceRecord == null) - { - return RedirectToActionPermanent("Main"); - } - - Model.NewServiceRecord.IP = Request.UserHostAddress; - - Model.NewServiceRecord.Goals = Model.SelectedGoals; - Model.NewServiceRecord.Start = zeitenFeld[0]; - Model.NewServiceRecord.End = zeitenFeld[1]; - - Model.NewServiceRecord.DistanceInMeter = distanceInMeters; - - if(Model.Employee.EmployeeOid != null) - { - if(Model.SelectedEmployee != null) - { - Model.NewServiceRecord.Employee = Model.SelectedEmployee; - } - - var sc = Model.SupportConcepts.FirstOrDefault(fod => fod.CostBearerRelations.Any(a => a.CostBearer2SupportConceptOid.HasValue && a.CostBearer2SupportConceptOid.Value.Equals(selectedCostbearerScRelOid))); - if(sc != null) - { - if(sc.SupportConceptOid != null) - { - Model.NewServiceRecord.SupportConcept = CustomerService.LoadCompactSupportConceptDC(sc.SupportConceptOid.Value, Model.Employee.EmployeeOid); - } - - Model.NewServiceRecord.Customer = sc.Customer; - - var cb2ScRel = sc.CostBearerRelations.First(f => f.CostBearer2SupportConceptOid.HasValue && f.CostBearer2SupportConceptOid.Equals(selectedCostbearerScRelOid)); - Model.NewServiceRecord.CostBearer = cb2ScRel.CostBearer; - - var intervall = Model.NewServiceRecord.CostBearer.ActualMinuteIntervall; - - if(intervall > 0) - { - Model.NewServiceRecord.RoundedDuration = dauer % intervall != 0 ? dauer + (intervall - dauer % intervall) : dauer; - } - else - { - Model.NewServiceRecord.RoundedDuration = dauer; - } - - Model.NewServiceRecord.CostBearer2SupportConceptOid = selectedCostbearerScRelOid; - } - else - { - Model.NewServiceRecord.RoundedDuration = dauer; - } - } - - Model.NewServiceRecord.DurationInStunden = ZeiterfassungsDauer.Minuten; - - Model.NewServiceRecord.ServiceRecordFormat = ServiceRecordFormate.OriginaleZeiterfassung; - - Model.NewServiceRecord.Notice = string.IsNullOrEmpty(doku1) ? null : doku1; - - 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; - - if(!string.IsNullOrEmpty(formCollection[FormCollectionConstants.ServiceDescriptionKey])) - { - serviceDescOid = Convert.ToInt64(formCollection[FormCollectionConstants.ServiceDescriptionKey]); - } - else if(Model.SelectedServiceDescriptionOid.HasValue) - { - serviceDescOid = Model.SelectedServiceDescriptionOid.Value; - } - - if(serviceDescOid > 0) - { - Model.NewServiceRecord.ServiceDescription = OperationsService.GetServiceDescription(serviceDescOid); - } - - if(Model.NewServiceRecord.RoundedDuration == 0) - { - Model.NewServiceRecord.RoundedDuration = dauer; - } - - Model.NewServiceRecord.IP = Request.UserHostAddress; - Model.NewServiceRecord.InsertedOn = DateTime.Now; - Model.NewServiceRecord.InsUser = $"{MobileSessionFacade.LoggedInEmployee.FirstName} {MobileSessionFacade.LoggedInEmployee.LastName}"; - Model.NewServiceRecord.IsCreatedInMobileClient = true; - - if(Model.IsInGroupBookingMode && Model.SelectedSupportConcepts.Count > 1) - { - return SaveGroupBooking(); - } - - var oidList = OperationsService.InsertNewServiceRecords(new List { Model.NewServiceRecord }); - - Model.ServiceRecordOid = oidList[0]; - - Model.NewServiceRecord = new ServiceRecordDC(); - } - catch(Exception e) - { - Log.Error(e.Message, e); - } - - return ResetEditingMode(); + return RedirectToActionPermanent("Index", "Login", new { isSessionTimedOut = true}); } - // Wird zum Bearbeiten von Gruppenbuchungen benutzt [HttpPost] [Authorize] - public ActionResult EditServiceRecord(FormCollection formCollection) + public ActionResult SetSupportConceptFilter(FormCollection formCollection) { if(Model == null) { return Logout(); } + + var selectedSupportConceptFilter = formCollection[nameof(Model.SelectedSupportConceptFilter)]; + + if(!Enum.TryParse(selectedSupportConceptFilter, out CustomerFilterEnum customerFilter)) + { + customerFilter = CustomerFilterEnum.MyCustomer; + } + + UpdateSettings("CustomerFilterInZeiterfassung", customerFilter.ToString()); + + return RedirectToActionPermanent("Main"); + } + + [Authorize] + [HttpPost] + public ActionResult CreateOrUpdateGroupBooking(FormCollection formCollection) + { + if(Model == null) + { + return Logout(); + } + try { + if(!Model.IsInEditingMode) + { + if(Model.SelectedConceptCostBearerRelations.Count == 1) + { + var cb2ScOids = (from scDc in Model.SelectedSupportConcepts + where scDc.CostBearerRelations != null && scDc.CostBearerRelations.Count > 0 + let costBearer2SupportConceptOid = scDc.CostBearerRelations[0].CostBearer2SupportConceptOid + where costBearer2SupportConceptOid != null + select costBearer2SupportConceptOid.Value).ToList(); + + var cb2ScOidsCount = cb2ScOids.Count; + + if(cb2ScOidsCount == 1) + { + Model.CostBearer2SupportConceptOid = cb2ScOids[0]; + } + else + { + return RedirectToActionPermanent("Main"); + } + } + } + else + { + var selectedRecordOid = Model.SelectedServiceRecordOid ?? Model.SelectedServiceRecord.ServiceRecordOid; + Model.NewServiceRecord = OperationsService.GetServiceRecordById(selectedRecordOid.Value); + } + string doku1; if(Model.Dokutypes != null && Model.Dokutypes.Length > 0) @@ -2702,8 +2509,7 @@ namespace BeWoPlanerMobil.Controllers doku1 = formCollection[FormCollectionConstants.Dokumentation6Key]; } - Log.Info($"EditServiceRecord: datum:{formCollection[FormCollectionConstants.DateKey]}; start:{formCollection[FormCollectionConstants.StartKey]}; ende:{formCollection[FormCollectionConstants.EndKey]}; dauer:{formCollection[FormCollectionConstants.DurationKey]}; doku:{doku1}; aktion:Speichern"); - + // Wenn kein Datum angegeben wurde, wird die Main-Seite geladen und abgebrochen if(string.IsNullOrEmpty(formCollection[FormCollectionConstants.DateKey])) { return View("Main", Model); @@ -2775,9 +2581,6 @@ namespace BeWoPlanerMobil.Controllers dauer = (int)(zeitenFeld[1] - zeitenFeld[0]).TotalMinutes; } - var selectedRecordOid = Model.SelectedServiceRecordOid ?? Model.SelectedServiceRecord.ServiceRecordOid; - Model.NewServiceRecord = OperationsService.GetServiceRecordById(selectedRecordOid.Value); - if(Model.NewServiceRecord == null) { return RedirectToActionPermanent("Main"); @@ -2864,17 +2667,29 @@ namespace BeWoPlanerMobil.Controllers Model.NewServiceRecord.RoundedDuration = dauer; } - Model.NewServiceRecord.IP = Request.UserHostAddress; Model.NewServiceRecord.InsertedOn = DateTime.Now; Model.NewServiceRecord.InsUser = $"{MobileSessionFacade.LoggedInEmployee.FirstName} {MobileSessionFacade.LoggedInEmployee.LastName}"; Model.NewServiceRecord.IsCreatedInMobileClient = true; - if(Model.IsInGroupBookingMode && Model.SelectedSupportConcepts.Count > 1) - { - return UpdateGroupBooking(); - } - OperationsService.UpdateServiceRecords(new List { Model.NewServiceRecord }); + if(Model.IsInEditingMode) + { + if(Model.SelectedSupportConcepts.Count > 1) + { + return UpdateGroupBooking(); + } + + OperationsService.UpdateServiceRecords(new List { Model.NewServiceRecord }); + } + else + { + if(Model.SelectedSupportConcepts.Count > 1) + { + return SaveGroupBooking(); + } + + OperationsService.InsertNewServiceRecords(new List { Model.NewServiceRecord }); + } Model.NewServiceRecord = new ServiceRecordDC(); @@ -2883,41 +2698,12 @@ namespace BeWoPlanerMobil.Controllers Model.ServiceRecords = OperationsService.FindServiceRecordsForLastDays(selectedCostbearer2SupportConceptRelOid, Model.Zeitraum, Model.Employee.EmployeeOid).ToList(); } } - catch(Exception e) + catch(Exception exception) { - Log.Error(e.Message, e); + Log.Error(exception.Message, exception); } return ResetEditingMode(); } - - [HttpPost] - public ActionResult LogOutAfterSessionTimeout() - { - Logout(); - - return RedirectToActionPermanent("Index", "Login", new { isSessionTimedOut = true}); - } - - [HttpPost] - [Authorize] - public ActionResult SetSupportConceptFilter(FormCollection formCollection) - { - if(Model == null) - { - return Logout(); - } - - var selectedSupportConceptFilter = formCollection[nameof(Model.SelectedSupportConceptFilter)]; - - if(!Enum.TryParse(selectedSupportConceptFilter, out CustomerFilterEnum customerFilter)) - { - customerFilter = CustomerFilterEnum.MyCustomer; - } - - UpdateSettings("CustomerFilterInZeiterfassung", customerFilter.ToString()); - - return RedirectToActionPermanent("Main"); - } } } diff --git a/BeWoPlanerMobil/Models/AbstractModel.cs b/BeWoPlanerMobil/Models/AbstractModel.cs index 42e3dc77a..7b61b0cb0 100644 --- a/BeWoPlanerMobil/Models/AbstractModel.cs +++ b/BeWoPlanerMobil/Models/AbstractModel.cs @@ -78,5 +78,22 @@ namespace BeWoPlanerMobil.Models return user?.SettingList.FirstOrDefault(f => f.Type.Equals(SettingsType.ApplicationSettings))?.Value; } } + + public static bool IsAllowedToSeeCustomerFilter + { + get + { + var user = MobileSessionFacade.LoggedInUser; + + if(user != null) + { + return + user.CheckForRight(UserRightType.ViewAll) || + user.CheckForRight(UserRightType.Customer_ViewMyTeams); + } + + return false; + } + } } } \ No newline at end of file diff --git a/BeWoPlanerMobil/Models/CustomerModel.cs b/BeWoPlanerMobil/Models/CustomerModel.cs index 5ec621465..8a583eafe 100644 --- a/BeWoPlanerMobil/Models/CustomerModel.cs +++ b/BeWoPlanerMobil/Models/CustomerModel.cs @@ -2,7 +2,10 @@ using System.ComponentModel.DataAnnotations; using System.Linq; using System.Web.Mvc; +using BeWo.View.Navigation.Filter; +using BeWoPlanerMobil.Service; using BeWoPlanerMobil.Util; +using BS.Shared; using BS.Shared.DataContracts; using BS.Shared.DataContracts.Compact; @@ -29,5 +32,47 @@ namespace BeWoPlanerMobil.Models } public JsonCustomer SelectedJsonCustomer => SelectedCustomer != null ? new JsonCustomer(SelectedCustomer) : null; + + [Display(Name = "Filter")] + public CustomerFilterEnum SelectedCustomerFilter { get; set; } + + public List CustomerFilter + { + get + { + var result = new List(); + + var user = MobileSessionFacade.LoggedInUser; + + const string allCustomers = "Alle Klienten anzeigen"; + const string myCustomersOnly = "Nur meine Klienten anzeigen"; + const string myTeamsCustomersOnly = "Nur Klienten meiner Teams anzeigen"; + + const string allCustomersValue = "0"; + const string myCustomersValue = "1"; + const string myTeamsCustomersValue = "2"; + + if(user != null) + { + if(user.CheckForRight(UserRightType.ViewAll)) + { + result.Add(new SelectListItem { Text = allCustomers, Value = allCustomersValue }); + result.Add(new SelectListItem { Text = myCustomersOnly, Value = myCustomersValue }); + + if(user.CheckForRight(UserRightType.Customer_ViewMyTeams)) + { + result.Add(new SelectListItem {Text = myTeamsCustomersOnly, Value = myTeamsCustomersValue }); + } + } + else if(user.CheckForRight(UserRightType.Customer_ViewMyTeams)) + { + result.Add(new SelectListItem { Text = myCustomersOnly, Value = myCustomersValue }); + result.Add(new SelectListItem { Text = myTeamsCustomersOnly, Value = myTeamsCustomersValue }); + } + } + + return result; + } + } } } \ No newline at end of file diff --git a/BeWoPlanerMobil/Models/MainModel.cs b/BeWoPlanerMobil/Models/MainModel.cs index dec6229f0..a502a9c9d 100644 --- a/BeWoPlanerMobil/Models/MainModel.cs +++ b/BeWoPlanerMobil/Models/MainModel.cs @@ -176,8 +176,6 @@ namespace BeWoPlanerMobil.Models public int Zeitraum { get; set; } - public bool SaveSignature { get; set; } - public int ErrorWert { get; set; } public bool ShowSignature { get; set; } diff --git a/BeWoPlanerMobil/Scripts/view-scripts/main.js b/BeWoPlanerMobil/Scripts/view-scripts/main.js index 2fb9b9381..375c58d94 100644 --- a/BeWoPlanerMobil/Scripts/view-scripts/main.js +++ b/BeWoPlanerMobil/Scripts/view-scripts/main.js @@ -266,6 +266,12 @@ function submitGroupBookingEditForm() { validateForm($("#groupBookingEditingForm")); } +function submitGroupBookingForm() { + showSpinner(); + + validateForm($("#groupBookingForm")); +} + function deactivateGroupBookingForm() { $("#employees-button, #category-select, #leistung-select, #start-date, #end-date, #start-time, #end-time, #duration, #distance, textarea, #reset-button, #create-button, #textbausteine-button").prop("disabled", true); } diff --git a/BeWoPlanerMobil/Views/Customer/Customer.cshtml b/BeWoPlanerMobil/Views/Customer/Customer.cshtml index e171f2a44..2d91b3abf 100644 --- a/BeWoPlanerMobil/Views/Customer/Customer.cshtml +++ b/BeWoPlanerMobil/Views/Customer/Customer.cshtml @@ -6,328 +6,343 @@ }
-@using(Html.BeginForm("SelectCustomer", "Customer", FormMethod.Post, new { id = "select-customer-form" })) -{ -
-
- @Html.LabelFor(m => m.SelectedCustomerOid) -
-
- @Html.DropDownListFor(m => m.SelectedCustomerOid, Model.CustomerListItems, new { onchange = "submitCustomerSelectionForm();", @class = "custom-select" }) -
-
-} - -@if (Model?.SelectedJsonCustomer != null) -{ -
-
-
-
-
- Eigenschaften -
-
-
- Vorname: -
-
- @Model.SelectedJsonCustomer.Vorname -
-
-
-
- Nachname: -
-
- @Model.SelectedJsonCustomer.Nachname -
-
-
-
- Geburtstag: -
-
- @Model.SelectedJsonCustomer.Geburtstag -
-
-
-
- Geschlecht: -
-
- @Model.SelectedJsonCustomer.Geschlecht -
-
-
-
-
-
-
-
-
- Adresse -
-
-
- Adresszusatz: -
-
- @Model.SelectedJsonCustomer.Adresszusatz -
-
-
-
- Straße: -
-
- @Model.SelectedJsonCustomer.Strasse -
-
-
-
- PLZ: -
-
- @Model.SelectedJsonCustomer.Postleitzahl -
-
-
-
- Ort: -
-
- @Model.SelectedJsonCustomer.Ort -
-
-
-
-
-
-
-
-
- Rechnungsadresse -
-
-
- Name: -
-
- @Model.SelectedJsonCustomer.RechnungsadresseName -
-
-
-
- Straße: -
-
- @Model.SelectedJsonCustomer.RechnungsadresseStrasse -
-
-
-
- PLZ: -
-
- @Model.SelectedJsonCustomer.RechnungsadressePostleitzahl -
-
-
-
- Ort: -
-
- @Model.SelectedJsonCustomer.RechnungsadresseOrt -
-
-
-
-
-
-
-
-
- Kontakt -
-
-
- Handy: -
- -
-
-
- Telefon: -
- -
-
-
- Fax: -
-
- @Model.SelectedJsonCustomer.Fax -
-
-
-
- Mail: -
- -
-
-
-
- - - @if(Model.SelectedJsonCustomer.Kommentar != null) + @if(AbstractModel.IsAllowedToSeeCustomerFilter) { -
-
-
-
Kommentar
+ using(Html.BeginForm("SetCustomerFilter", "Customer", FormMethod.Post)) + { +
+
+ @Html.LabelFor(m => m.SelectedCustomerFilter)
-
-
- @Model.SelectedJsonCustomer.Kommentar -
+
+ @Html.DropDownListFor(m => m.SelectedCustomerFilter, Model.CustomerFilter, new { onchange = "submitForm(this)", @class = "custom-select" })
+ } + } + + @using(Html.BeginForm("SelectCustomer", "Customer", FormMethod.Post, new { id = "select-customer-form" })) + { +
+
+ @Html.LabelFor(m => m.SelectedCustomerOid) +
+
+ @Html.DropDownListFor(m => m.SelectedCustomerOid, Model.CustomerListItems, new { onchange = "submitCustomerSelectionForm();", @class = "custom-select" }) +
} - - @if(Model.SelectedJsonCustomer.ReferenceNumbers.Any()) + @if(Model?.SelectedJsonCustomer != null) { -
-
-
-
Aktenzeichen pro Kostenträger
-
+
+
+
-
- - - - - - - - - @foreach(var x in Model.SelectedJsonCustomer.ReferenceNumbers) - { - - - - - } - -
- Kostenträger - - Aktenzeichen -
- @x.Costbearer - - @x.ReferenceNumber -
+
+ Eigenschaften +
+
+
+ Vorname: +
+
+ @Model.SelectedJsonCustomer.Vorname +
+
+
+
+ Nachname: +
+
+ @Model.SelectedJsonCustomer.Nachname +
+
+
+
+ Geburtstag: +
+
+ @Model.SelectedJsonCustomer.Geburtstag +
+
+
+
+ Geschlecht: +
+
+ @Model.SelectedJsonCustomer.Geschlecht +
- } - - - @if(Model.SelectedJsonCustomer.Umfeldpersonen.Any()) - { -
-
-
-
Umfeld
+
+
+
+
+ Adresse +
+
+
+ Adresszusatz: +
+
+ @Model.SelectedJsonCustomer.Adresszusatz +
+
+
+
+ Straße: +
+
+ @Model.SelectedJsonCustomer.Strasse +
+
+
+
+ PLZ: +
+
+ @Model.SelectedJsonCustomer.Postleitzahl +
+
+
+
+ Ort: +
+
+ @Model.SelectedJsonCustomer.Ort +
+
+
-
-
- @foreach(var umfeldPerson in Model.SelectedJsonCustomer.Umfeldpersonen) - { -
-
-
- -
-
- -
-
-
-
-
-
-
- Rolle: -
-
- @umfeldPerson.Rolle -
+
+
+
+
+
+ Rechnungsadresse +
+
+
+ Name: +
+
+ @Model.SelectedJsonCustomer.RechnungsadresseName +
+
+
+
+ Straße: +
+
+ @Model.SelectedJsonCustomer.RechnungsadresseStrasse +
+
+
+
+ PLZ: +
+
+ @Model.SelectedJsonCustomer.RechnungsadressePostleitzahl +
+
+
+
+ Ort: +
+
+ @Model.SelectedJsonCustomer.RechnungsadresseOrt +
+
+
+
+
+
+
+
+
+ Kontakt +
+
+
+ Handy: +
+ +
+
+
+ Telefon: +
+ +
+
+
+ Fax: +
+
+ @Model.SelectedJsonCustomer.Fax +
+
+
+
+ Mail: +
+ +
+
+
+
+ + + @if(Model.SelectedJsonCustomer.Kommentar != null) + { +
+
+
+
Kommentar
+
+
+
+ @Model.SelectedJsonCustomer.Kommentar +
+
+
+
+ } + + + @if(Model.SelectedJsonCustomer.ReferenceNumbers.Any()) + { +
+
+
+
Aktenzeichen pro Kostenträger
+
+
+
+ + + + + + + + + @foreach(var x in Model.SelectedJsonCustomer.ReferenceNumbers) + { + + + + + } + +
+ Kostenträger + + Aktenzeichen +
+ @x.Costbearer + + @x.ReferenceNumber +
+
+
+
+
+ } + + + @if(Model.SelectedJsonCustomer.Umfeldpersonen.Any()) + { +
+
+
+
Umfeld
+
+
+
+ @foreach(var umfeldPerson in Model.SelectedJsonCustomer.Umfeldpersonen) + { +
+
+
+
-
-
- Adresse: -
-
- @umfeldPerson.StrNameNr
@umfeldPerson.PLZOrt -
+
+
-
-
- Tel.: -
- -
-
-
- Mobil: -
- -
-
-
- E-Mail: -
- -
-
-
- Fax: -
-
- @umfeldPerson.Fax +
+
+
+
+
+
+ Rolle: +
+
+ @umfeldPerson.Rolle +
+
+
+
+ Adresse: +
+
+ @umfeldPerson.StrNameNr
@umfeldPerson.PLZOrt +
+
+
+
+ Tel.: +
+ +
+
+
+ Mobil: +
+ +
+
+
+ E-Mail: +
+ +
+
+
+ Fax: +
+
+ @umfeldPerson.Fax +
+
-
+ }
- } +
-
+ }
} -
- }
\ No newline at end of file diff --git a/BeWoPlanerMobil/Views/Main/Main.cshtml b/BeWoPlanerMobil/Views/Main/Main.cshtml index ec25f6cd4..e46d6d08f 100644 --- a/BeWoPlanerMobil/Views/Main/Main.cshtml +++ b/BeWoPlanerMobil/Views/Main/Main.cshtml @@ -5,7 +5,7 @@ @{ ViewBag.Title = "BeWoPlaner Mobil"; - if (TempData[MobileUtils.TempDataLoginStateKey] is BeWoLoginState loginState && loginState.Message != null) + if(TempData[MobileUtils.TempDataLoginStateKey] is BeWoLoginState loginState && loginState.Message != null) { var loginStateMessage = new HtmlString(loginState.Message.Replace("\n", "
").Replace("\"", "\\")); @@ -16,8 +16,6 @@ }