Nicht abrechenbare ServiceRecords tauchen nicht mehr im Quittierungsbelegsmodul auf.

This commit is contained in:
2026-03-23 15:23:00 +01:00
parent b788d79496
commit 1629e10357
14 changed files with 855 additions and 230 deletions

View File

@@ -104,6 +104,42 @@ namespace BeWoPlanerMobil.Controllers
Model.PossibleCustomers = CustomerService.GetAllAuthorizedCompactCustomers();
Model.PossibleResources = KalenderService.GetAllResources();
if(Model.HasRightToInsertRessourceAppointments || Model.HasRightToViewAllResourceAppointments)
{
var allResources = KalenderService.GetAllResources().OrderBy(r => r.Name).ToList();
var categories2Resources = new Dictionary<ValueListEntryDC, List<ResourceDC>>();
foreach(var category in allResources.Select(resource => resource.ResourceCategory))
{
categories2Resources.AddOrUpdateValueInDictionary(category, allResources.Where(resource => resource.ResourceCategory.Equals(category)).OrderBy(r => r.Name).ToList());
}
Model.ResourceCategories2Resources = categories2Resources.OrderBy(kvp => kvp.Key.DisplayName).ToDictionary(kvp => kvp.Key, kvp => kvp.Value);
}
if(Model.LoggedInEmployee?.EmployeeOid.HasValue ?? false)
{
var compactEmployee = EmployeeService.GetActiveCompactEmployeeWithOid(Model.LoggedInEmployee.EmployeeOid.Value);
Model.MyTeamEmployees = EmployeeService.GetAllTeamMember(compactEmployee).OrderBy(employee => employee.LastName).ToList();
}
else
{
Model.MyTeamEmployees = new List<CompactEmployeeDC>();
}
if(Model.HasRightToViewTeams && (Model?.LoggedInEmployee?.EmployeeOid.HasValue ?? false))
{
Model.MyTeams = EmployeeService.GetAllActiveCompactTeamsForEmployee(Model.LoggedInEmployee.EmployeeOid.Value).OrderBy(team => team.Name).ToList();
}
Model.TeamMemberCustomerOids = EmployeeService.LoadTeamsRelatedCustomerOids(LoggedInUser.Employee.EmployeeOid);
Model.SelectedEmployeesForFiltering = Model.PossibleEmployees.Where(possibleEmployee => Model.SelectedEmployeeOidsForFiltering?.Contains(possibleEmployee.EmployeeOid) ?? false).ToList();
Model.SelectedCustomersForFiltering = Model.PossibleCustomers.Where(possibleCustomer => Model.SelectedCustomerOidsForFiltering?.Contains(possibleCustomer.CustomerOid) ?? false).ToList();
Model.SelectedResourcesForFiltering = Model.PossibleResources.Where(possibleResource => possibleResource.ResourceOid.HasValue && (Model.SelectedResourceOidsForFiltering?.Contains(possibleResource.ResourceOid.Value) ?? false)).ToList();
ReloadAppointments();
}
@@ -114,6 +150,8 @@ namespace BeWoPlanerMobil.Controllers
throw new Exception("Bei DevExpressSchedulerController.ReloadAppointments() ist die Oid des angemeldeten Benutzers wider Erwarten NULL!");
}
UpdateSelectedObjects();
var employeeOid = Model.LoggedInEmployee.EmployeeOid.Value;
var user = LoggedInUser;
@@ -130,15 +168,15 @@ namespace BeWoPlanerMobil.Controllers
employeeOid,
intervalStart,
intervalEnd,
new List<long>(),
new List<long>(),
new List<long>(),
false,
false,
false,
false,
false,
true
Model.SelectedEmployeeOidsForFiltering,
Model.SelectedCustomerOidsForFiltering,
Model.SelectedResourceOidsForFiltering,
Model.ShowOnlyEmployees,
Model.ShowOnlyCustomers,
Model.ShowOnlyResources,
Model.ShowOnlyMyOwnAppointments,
Model.ShowOnlyMyOwnAppointments,
Model.ShowTasks
);
var selectedCustomerOids = Model.PossibleCustomers.Select(s => s.CustomerOid).ToList();
@@ -424,12 +462,35 @@ namespace BeWoPlanerMobil.Controllers
var showMenuItem = false;
//var isTask = appointment.IsTask;
//var isAbsenceTime = appointment.
var isTask = appointment.IsTask;
var isAbsenceTime = appointment.AbsenceReason != null;
if(isTask)
{
//showMenuItem =
}
return JsonConvert.SerializeObject(showMenuItem);
}
private void UpdateSelectedObjects()
{
var list = new List<ResourceDC>();
Model.ResourceCategories2Resources.Values.DoForEach(l => l.DoForEach(s => list.AddIfNotIn(s)));
Model.SelectedEmployees = Model.PossibleEmployees.Where(employee => Model.SelectedEmployeeOids.Contains(employee.EmployeeOid)).ToList();
Model.SelectedCustomers = Model.PossibleCustomers.Where(customer => Model.SelectedCustomerOids.Contains(customer.CustomerOid)).ToList();
Model.SelectedResources = list.Where(resource => resource.ResourceOid.HasValue && Model.SelectedResourceOids.Contains(resource.ResourceOid.Value)).ToList();
Model.SelectedEmployeesForFiltering = Model.PossibleEmployees.Where(employee => Model.SelectedEmployeeOidsForFiltering.Contains(employee.EmployeeOid)).ToList();
Model.SelectedCustomersForFiltering = Model.PossibleCustomers.Where(customer => Model.SelectedCustomerOidsForFiltering.Contains(customer.CustomerOid)).ToList();
Model.SelectedResourcesForFiltering = list.Where(resource => resource.ResourceOid.HasValue && Model.SelectedResourceOidsForFiltering.Contains(resource.ResourceOid.Value)).ToList();
Model.SelectedEmployeesForIntervalFinder = Model.PossibleEmployees.Where(employee => Model.SelectedEmployeeOidsForIntervalFinder.Contains(employee.EmployeeOid)).ToList();
Model.SelectedCustomersForIntervalFinder = Model.PossibleCustomers.Where(customer => Model.SelectedCustomerOidsForIntervalFinder.Contains(customer.CustomerOid)).ToList();
Model.SelectedResourcesForIntervalFinder = list.Where(resource => resource.ResourceOid.HasValue && Model.SelectedResourceOidsForIntervalFinder.Contains(resource.ResourceOid.Value)).ToList();
}
[Authorize]
public ActionResult CheckEmployeeAvailability(string startString, string endString)
{
@@ -446,29 +507,110 @@ namespace BeWoPlanerMobil.Controllers
}
[Authorize]
public ActionResult SelectAllEmployeesForFiltering()
public ActionResult SelectAllEmployeesForFiltering(bool isChecked)
{
Model.SelectedEmployeesForFiltering = Model.PossibleEmployees.Select(employee => employee.EmployeeOid).ToList();
if(Model is null)
{
TempData[TempDataConstants.DoLogoutKey] = true;
return PartialView("AptFltEmployeePopupListPartial");
}
Model.SelectedEmployeeOidsForFiltering = Model.PossibleEmployees.Select(employee => employee.EmployeeOid).ToList();
return PartialView("AptFltEmployeePopupListPartial", Model);
}
[Authorize]
public ActionResult SelectAllCustomersForFiltering(bool isChecked)
{
if(Model is null)
{
TempData[TempDataConstants.DoLogoutKey] = true;
return PartialView("AptFltCustomerPopupListPartial");
}
Model.SelectedCustomerOidsForFiltering = Model.PossibleCustomers.Select(customer => customer.CustomerOid).ToList();
return PartialView("AptFltCustomerPopupListPartial", Model);
}
[Authorize]
public ActionResult SelectAllResourcesForFiltering(bool isChecked)
{
if(Model is null)
{
TempData[TempDataConstants.DoLogoutKey] = true;
return PartialView("AptFltResourcePopupListPartial");
}
Model.SelectedResourceOidsForFiltering = Model.PossibleResources.Where(resource => resource.ResourceOid.HasValue).Select(resource => resource.ResourceOid.Value).ToList();
return PartialView("AptFltResourcePopupListPartial");
}
[Authorize]
public ActionResult SelectTeamForAppointment(long teamOid)
{
if(Model is null)
{
TempData[TempDataConstants.DoLogoutKey] = true;
return PartialView("AptFltEmployeePopupListPartial");
}
var selectedTeam = Model.MyTeams.FirstOrDefault(team => team.TeamOid.Equals(teamOid));
if(selectedTeam is null)
{
return PartialView("AptFltEmployeePopupListPartial");
}
var fullTeamObj = EmployeeService.LoadTeam(teamOid);
Model.SelectedEmployeeOids.AddRangeIfElementsNotIn(fullTeamObj.Member.Select(member => member.EmployeeOid));
return PartialView("AptFltEmployeePopupListPartial");
}
[Authorize]
public ActionResult SelectAllCustomersForFiltering()
public ActionResult UpdateEmployeeSelection(long[] selectedEmployeeOids)
{
Model.SelectedCustomersForFiltering = Model.PossibleCustomers.Select(customer => customer.CustomerOid).ToList();
if(Model is null)
{
TempData[TempDataConstants.DoLogoutKey] = true;
return PartialView("AptFltEmployeePopupListPartial");
}
return PartialView("AptFltCustomerPopupListPartial");
var selectedEmployees = Model.PossibleEmployees.Where(possibleEmployee => selectedEmployeeOids.Contains(possibleEmployee.EmployeeOid)).ToList();
Model.SelectedEmployeeOidsForFiltering = selectedEmployees.Select(employee => employee.EmployeeOid).ToList();
return PartialView("AptFltEmployeePopupListPartial", Model);
}
[Authorize]
public ActionResult SelectAllResourcesForFiltering()
public ActionResult UpdateCustomerSelection(long[] selectedCustomerOids)
{
Model.SelectedResourcesForFiltering = Model.PossibleResources.Where(resource => resource.ResourceOid.HasValue).Select(resource => resource.ResourceOid.Value).ToList();
if(Model is null)
{
TempData[TempDataConstants.DoLogoutKey] = true;
return PartialView("AptFltCustomerPopupListPartial");
}
return PartialView("AptFltResourcePopupListPartial");
var selectedCustomers = Model.PossibleCustomers.Where(possibleCustomer => selectedCustomerOids.Contains(possibleCustomer.CustomerOid)).ToList();
return PartialView("AptFltCustomerPopupListPartial", Model);
}
[Authorize]
public ActionResult UpdateResourceSelection(long[] selectedResourceOids)
{
if(Model is null)
{
TempData[TempDataConstants.DoLogoutKey] = true;
return PartialView("AptFltResourcePopupListPartial");
}
return PartialView("AptFltResourcePopupListPartial", Model);
}
}
}

View File

@@ -4925,7 +4925,7 @@ namespace BeWoPlanerMobil.Controllers
[Authorize]
public ActionResult ChangePassword(FormCollection formCollection)
{
if(Model is null || !MobileSessionFacade.IsUserLoggedIn() || LoggedInUser.UserVersion is null)
if(Model is null || false == MobileSessionFacade.IsUserLoggedIn() || LoggedInUser.UserVersion is null)
{
TempData[TempDataConstants.DoLogoutKey] = true;
return Logout();
@@ -4946,13 +4946,13 @@ namespace BeWoPlanerMobil.Controllers
{
var checkResult = UserService.CheckPassword(LoggedInUser.UserOid.Value, oldPassword, newPassword);
if(!(checkResult is null))
if(false == checkResult is null)
{
TempData[TempDataConstants.PwChErrKey] = checkResult;
return RedirectToActionPermanent("Main");
}
}
var userName = LoggedInUser.LoginName;
var userVersion = LoggedInUser.UserVersion.Value;

View File

@@ -28,28 +28,20 @@ namespace BeWoPlanerMobil.Controllers
{
get
{
if(!MobileSessionFacade.IsUserLoggedIn())
if(false == MobileSessionFacade.IsUserLoggedIn())
{
RedirectToActionPermanent("Index", "Login");
return null;
}
if (_Model == null)
if(false == _Model is null)
{
_Model = new ReportModel { ReportCreator = GetReportCreator() };
InitModel(_Model);
InitViewModel();
return _Model;
}
//if (((ReportModel) Session[ModelSessionConstants.ReportModelKey])?.LoggedInEmployee is null)
//{
// _Model = new ReportModel {ReportCreator = GetReportCreator()};
// InitModel(_Model);
// Session[ModelSessionConstants.ReportModelKey] = _Model;
//}
//else
//{
// _Model = (ReportModel) Session[ModelSessionConstants.ReportModelKey];
//}
_Model = new ReportModel { ReportCreator = GetReportCreator() };
InitModel(_Model);
InitViewModel();
return _Model;
}
@@ -93,29 +85,33 @@ namespace BeWoPlanerMobil.Controllers
Model.AllTeams = EmployeeService.GetAllActiveCompactTeamsForEmployee(LoggedInEmployee.EmployeeOid.Value);
Model.Dokutypes = ValueListService.GetAllValueListEntrysByType(ValueListEntryType.DocumentType);
if (Model.Dokutypes != null)
if(false == Model.Dokutypes is null)
{
Model.Dokutypes = Model.Dokutypes.OrderBy(s => s.ValueListEntryOid).ToArray();
}
if (Model.SelectedCustomerOid.HasValue)
if(Model.SelectedCustomerOid.HasValue)
{
Model.SelectedCustomer = Model.Customers.FirstOrDefault(customer => customer.CustomerOid == Model.SelectedCustomerOid.Value);
}
if (Model.SelectedEmployeeOid.HasValue)
if(Model.SelectedEmployeeOid.HasValue)
{
Model.SelectedEmployee = Model.Employees.FirstOrDefault(employee => employee.EmployeeOid.Equals(Model.SelectedEmployeeOid.Value));
}
if (Model.SelectedTeamOid.HasValue)
if(Model.SelectedTeamOid.HasValue)
{
Model.SelectedTeam = Model.AllTeams.FirstOrDefault(team => team.TeamOid == Model.SelectedTeamOid.Value);
}
if (Model.SelectedOrganisationOid.HasValue)
if(Model.SelectedOrganisationOid.HasValue)
{
Model.SelectedOrganisation= Model.Organisations.FirstOrDefault(organisation => organisation.OrganisationOid.Equals(Model.SelectedOrganisationOid.Value));
}
if (Model.SelectedServiceCategoryOid.HasValue)
if(Model.SelectedServiceCategoryOid.HasValue)
{
Model.SelectedServiceCategory = Model.ServiceCategories.FirstOrDefault(serviceCategory => serviceCategory.ServiceCategoryOid == Model.SelectedServiceCategoryOid.Value);
}
@@ -137,12 +133,12 @@ namespace BeWoPlanerMobil.Controllers
[Authorize]
public ActionResult Report()
{
if(!MobileSessionFacade.IsUserLoggedIn() || Request.Browser.Browser.Equals("InternetExplorer"))
if(false == MobileSessionFacade.IsUserLoggedIn() || Request.Browser.Browser.Equals("InternetExplorer"))
{
return Logout();
}
if(!Model.HasRightToViewQuittierungsbelege)
if(false == Model.HasRightToViewQuittierungsbelege)
{
return RedirectToActionPermanent("Main", "Main");
}
@@ -161,7 +157,7 @@ namespace BeWoPlanerMobil.Controllers
return Logout();
}
if(!Model.HasRightToViewQuittierungsbelege)
if(false == Model.HasRightToViewQuittierungsbelege)
{
return RedirectToActionPermanent("Main", "Main");
}
@@ -171,8 +167,6 @@ namespace BeWoPlanerMobil.Controllers
TempData[TempDataConstants.DoLogoutKey] = true;
return Logout();
}
}
catch(Exception e)
{
@@ -1232,11 +1226,23 @@ namespace BeWoPlanerMobil.Controllers
Model.QbEntryPageCount = pageCount;
Model.QbEntryCount = rowCount;
reportObjects = reportObjects.Where(x => x != null).ToList();
reportObjects = reportObjects.Where(servicesOverview => false == servicesOverview is null).ToList();
var srOids = new List<long>();
//var srOidsBillable = new List<long>();
reportObjects.DoForEach(x => x.Services.DoForEach(s => srOids.AddIfNotIn(s.ServiceRecordOid)));
//reportObjects.DoForEach(servicesOverview => servicesOverview.Services.DoForEach(s => srOids.AddIfNotIn(s.ServiceRecordOid)));
foreach(var reportObject in reportObjects)
{
foreach(var serviceDetail in reportObject.Services)
{
if(serviceDetail.IsBillable)
{
srOids.AddIfNotIn(serviceDetail.ServiceRecordOid);
}
}
}
Model.ConfirmationReceiptSignatures = OperationsService.LoadAllConfirmationReceiptSignaturesByServiceRecordOids(srOids, out var serviceRecordOidsWithSignature);
@@ -1246,12 +1252,14 @@ namespace BeWoPlanerMobil.Controllers
Model.ReportServiceRecordOids = new List<long>();
reportObjects.DoForEach(ro => ro.Services.DoForEach(s =>
{
Model.ReportServiceRecordOids.AddIfNotIn(s.ServiceRecordOid);
if(s.IsBillable)
{
Model.ReportServiceRecordOids.AddIfNotIn(s.ServiceRecordOid);
}
}));
var hasEmployeeSignature = srOids.All(a => serviceRecordOidsWithSignature.ContainsValueAtKey(SignatureType.Employee, a));
var anyEmployeeSignatures = srOids.Any(a => serviceRecordOidsWithSignature.ContainsValueAtKey(SignatureType.Employee, a));
var hasEmployeeSignature = srOids.All(serviceRecordOid => serviceRecordOidsWithSignature.ContainsValueAtKey(SignatureType.Employee, serviceRecordOid));
var anyEmployeeSignatures = srOids.Any(serviceRecordOid => serviceRecordOidsWithSignature.ContainsValueAtKey(SignatureType.Employee, serviceRecordOid));
var employeeSignatureState = SignatureState.None;
@@ -1265,7 +1273,7 @@ namespace BeWoPlanerMobil.Controllers
employeeSignatureState = SignatureState.All;
}
if(!Model.HasRightToProvideEmployeeSignatureForOthers)
if(false == Model.HasRightToProvideEmployeeSignatureForOthers)
{
// Prüfen, ob alle eigenen ServiceRecords unterschrieben sind
var ownServiceRecordOids = new List<long>();
@@ -1296,20 +1304,26 @@ namespace BeWoPlanerMobil.Controllers
reportObjects.DoForEach(reportObject =>
{
var quittierungsbelegItems = new List<QuittierungsbelegItem>();
bool fristAbgelaufen = false;
var fristAbgelaufen = false;
reportObject.Services.DoForEach(serviceDetail =>
{
quittierungsbelegItems.Add(new QuittierungsbelegItem(serviceDetail));
if (this.Model.MokSettings != null && this.Model.MokSettings.AnzTageUnterschriftErfolgt > 0)
if(false == serviceDetail.IsBillable)
{
if (DateTime.Now.Date.Subtract(serviceDetail.StartDate).TotalDays > this.Model.MokSettings.AnzTageUnterschriftErfolgt)
{
fristAbgelaufen = true;
}
return;
}
quittierungsbelegItems.Add(new QuittierungsbelegItem(serviceDetail));
if(false == Model.MokSettings?.AnzTageUnterschriftErfolgt > 0)
{
return;
}
if(DateTime.Now.Date.Subtract(serviceDetail.StartDate).TotalDays > Model.MokSettings.AnzTageUnterschriftErfolgt)
{
fristAbgelaufen = true;
}
});
if(quittierungsbelegItems.Count == 0)
@@ -1319,11 +1333,11 @@ namespace BeWoPlanerMobil.Controllers
var oids = quittierungsbelegItems.Select(s => s.ServiceRecordOid).ToList();
var hasCustomerSignature = oids.All(a => serviceRecordOidsWithSignature.ContainsValueAtKey(SignatureType.Customer, a));
var hasCustomerSignature = srOids.All(a => serviceRecordOidsWithSignature.ContainsValueAtKey(SignatureType.Customer, a));
var employeeSignatureState2 = GetSignatureState(oids, serviceRecordOidsWithSignature, SignatureType.Employee);
var employeeSignatureState2 = GetSignatureState(srOids, serviceRecordOidsWithSignature, SignatureType.Employee);
var customerSignatureState = GetSignatureState(oids, serviceRecordOidsWithSignature, SignatureType.Customer);
var customerSignatureState = GetSignatureState(srOids, serviceRecordOidsWithSignature, SignatureType.Customer);
var customerSignatureOid = hasCustomerSignature ? customerSignatures.FirstOrDefault(cs => cs.ServiceRecords.All(a => a.Customer.CustomerOid.Equals(reportObject.CustomerOid) && a.ServiceRecordOid.HasValue && serviceRecordOidsWithSignature[SignatureType.Customer].Contains(a.ServiceRecordOid.Value)))?.ConfirmationReceiptSignatureOid : null;
var sigs = customerSignatures.Where(cs => cs.ServiceRecords.All(a => a.Customer.CustomerOid.Equals(reportObject.CustomerOid) && a.ServiceRecordOid.HasValue && serviceRecordOidsWithSignature[SignatureType.Customer].Contains(a.ServiceRecordOid.Value))).ToList();
@@ -1350,6 +1364,7 @@ namespace BeWoPlanerMobil.Controllers
var customerSignatureServiceRecordOids = new List<long>();
var employeeSignatureServiceRecordOids = new List<long>();
if(serviceRecordOidsWithSignature.ContainsKey(SignatureType.Customer))
{
customerSignatureServiceRecordOids = serviceRecordOidsWithSignature[SignatureType.Customer];
@@ -1360,7 +1375,7 @@ namespace BeWoPlanerMobil.Controllers
employeeSignatureServiceRecordOids = serviceRecordOidsWithSignature[SignatureType.Employee];
}
foreach (var quittierungsbelegItem in quittierungsbelegItems)
foreach(var quittierungsbelegItem in quittierungsbelegItems)
{
var serviceRecordOid = quittierungsbelegItem.ServiceRecordOid;
@@ -1374,7 +1389,7 @@ namespace BeWoPlanerMobil.Controllers
employeeOids.AddIfNotIn(serviceDetail.EmployeeOid);
}
if(!Model.HasRightToProvideEmployeeSignatureForOthers)
if(false == Model.HasRightToProvideEmployeeSignatureForOthers)
{
var serviceRecordOidsFromOtherEmployees = reportObject.Services.Where(serviceDetail => !serviceDetail.EmployeeOid.Equals(LoggedInEmployee.EmployeeOid)).Select(serviceDetail => serviceDetail.ServiceRecordOid).ToList();
var ownServiceRecordOids = reportObject.Services.Where(serviceDetail => serviceDetail.EmployeeOid.Equals(LoggedInEmployee.EmployeeOid)).Select(serviceDetail => serviceDetail.ServiceRecordOid).ToList();

View File

@@ -58,7 +58,12 @@ namespace BeWoPlanerMobil.Controllers
private void InitViewModel()
{
if (Model.HasRightToInsertRessourceAppointments || Model.HasRightToViewAllResourceAppointments)
if(Model is null)
{
throw new Exception("Das Model im SchedulerController ist wider Erwarten null!");
}
if(Model.HasRightToInsertRessourceAppointments || Model.HasRightToViewAllResourceAppointments)
{
var allResources = KalenderService.GetAllResources().OrderBy(r => r.Name).ToList();
@@ -72,51 +77,46 @@ namespace BeWoPlanerMobil.Controllers
Model.ResourceCategories2Resources = categories2Resources.OrderBy(kvp => kvp.Key.DisplayName).ToDictionary(kvp => kvp.Key, kvp => kvp.Value);
}
if (Model?.LoggedInEmployee?.EmployeeOid.HasValue ?? false)
if(Model.LoggedInEmployee?.EmployeeOid.HasValue ?? false)
{
var compactEmployee = EmployeeService.GetActiveCompactEmployeeWithOid(Model.LoggedInEmployee.EmployeeOid.Value);
Model.MyTeamEmployees = EmployeeService.GetAllTeamMember(compactEmployee).OrderBy(employee => employee.LastName).ToList();
}
else if (!(Model is null))
else
{
Model.MyTeamEmployees = new List<CompactEmployeeDC>();
}
if (Model.HasRightToViewTeams && (Model?.LoggedInEmployee?.EmployeeOid.HasValue ?? false))
if(Model.HasRightToViewTeams && (Model?.LoggedInEmployee?.EmployeeOid.HasValue ?? false))
{
Model.MyTeams = EmployeeService.GetAllActiveCompactTeamsForEmployee(Model.LoggedInEmployee.EmployeeOid.Value).OrderBy(team => team.Name).ToList();
}
if (!(Model is null))
{
Model.TeamMemberCustomerOids = EmployeeService.LoadTeamsRelatedCustomerOids(LoggedInUser.Employee.EmployeeOid);
}
Model.TeamMemberCustomerOids = EmployeeService.LoadTeamsRelatedCustomerOids(LoggedInUser.Employee.EmployeeOid);
if (Model.HasRightToViewCustomerSelectionInScheduler)
if(Model.HasRightToViewCustomerSelectionInScheduler)
{
Model.AllCustomers = CustomerService.GetAllActiveCompactCustomers().OrderBy(customer => customer.LastName).ToList();
}
if (Model.HasRightToViewEmployeeAppointments)
if(Model.HasRightToViewEmployeeAppointments)
{
Model.AllEmployees = EmployeeService.GetAllActiveEmployeesCompact().OrderBy(employee => employee.LastName).ToList();
}
//LoadAppointmentsForDate();
if (Model.SelectedAppointmentOid.HasValue)
if(Model.SelectedAppointmentOid.HasValue)
{
if (Model.Appointments == null)
if(Model.Appointments is null)
{
LoadAppointmentsForDate();
}
Model.SelectedAppointment = Model.Appointments.FirstOrDefault(app => app.SchedulerAppointmentOid.HasValue && app.SchedulerAppointmentOid.Value == Model.SelectedAppointmentOid.Value);
Model.SelectedAppointment = Model.Appointments?.FirstOrDefault(app => app.SchedulerAppointmentOid.HasValue && app.SchedulerAppointmentOid.Value == Model.SelectedAppointmentOid.Value);
}
SetHasResourcesEmployeesOrCustomers();
UpdateSelectedObjects();
}
private void UpdateSelectedObjects()

View File

@@ -27,6 +27,7 @@ namespace BeWoPlanerMobil.Models
public List<ResourceDC> PossibleResources { get; set; }
public List<CompactEmployeeDC> PossibleEmployees { get; set; }
#region Terminformular-Elemente
public List<CompactCustomerDC> SelectedCustomers { get; set; }
public List<ResourceDC> SelectedResources { get; set; }
public List<CompactEmployeeDC> SelectedEmployees { get; set; }
@@ -48,6 +49,7 @@ namespace BeWoPlanerMobil.Models
get => DevExpressSchedulerSessionModel.SelectedResourceOids;
set => DevExpressSchedulerSessionModel.SelectedResourceOids = value;
}
#endregion
public EmployeeAvailabilityObject EmployeeAvailabilityObject { get; set; }
@@ -67,22 +69,101 @@ namespace BeWoPlanerMobil.Models
return null;
}
public List<long> SelectedEmployeesForFiltering
public List<long> SelectedEmployeeOidsForFiltering
{
get => DevExpressSchedulerSessionModel.SelectedEmployeesForFiltering;
set => DevExpressSchedulerSessionModel.SelectedEmployeesForFiltering = value;
get => DevExpressSchedulerSessionModel.SelectedEmployeeOidsForFiltering;
set => DevExpressSchedulerSessionModel.SelectedEmployeeOidsForFiltering = value;
}
public List<long> SelectedCustomersForFiltering
public List<long> SelectedCustomerOidsForFiltering
{
get => DevExpressSchedulerSessionModel.SelectedCustomersForFiltering;
set => DevExpressSchedulerSessionModel.SelectedCustomersForFiltering = value;
get => DevExpressSchedulerSessionModel.SelectedCustomerOidsForFiltering;
set => DevExpressSchedulerSessionModel.SelectedCustomerOidsForFiltering = value;
}
public List<long> SelectedResourcesForFiltering
public List<long> SelectedResourceOidsForFiltering
{
get => DevExpressSchedulerSessionModel.SelectedResourcesForFiltering;
set => DevExpressSchedulerSessionModel.SelectedResourcesForFiltering = value;
get => DevExpressSchedulerSessionModel.SelectedResourceOidsForFiltering;
set => DevExpressSchedulerSessionModel.SelectedResourceOidsForFiltering = value;
}
public List<CompactTeamDC> MyTeams { get; set; } = new List<CompactTeamDC>();
public Dictionary<ValueListEntryDC, List<ResourceDC>> ResourceCategories2Resources { get; set; } = new Dictionary<ValueListEntryDC, List<ResourceDC>>();
public List<CompactEmployeeDC> MyTeamEmployees { get; set; }
public List<long> TeamMemberCustomerOids { get; set; }
public List<CompactEmployeeDC> SelectedEmployeesForFiltering { get; set; }
public List<CompactCustomerDC> SelectedCustomersForFiltering { get; set; }
public List<ResourceDC> SelectedResourcesForFiltering { get; set; }
public List<CompactEmployeeDC> SelectedEmployeesForIntervalFinder { get; set; }
public List<CompactCustomerDC> SelectedCustomersForIntervalFinder { get; set; }
public List<ResourceDC> SelectedResourcesForIntervalFinder { get; set; }
public List<long> SelectedEmployeeOidsForIntervalFinder
{
get => DevExpressSchedulerSessionModel.SelectedEmployeeOidsForIntervalFinder;
set => DevExpressSchedulerSessionModel.SelectedEmployeeOidsForIntervalFinder = value;
}
public List<long> SelectedCustomerOidsForIntervalFinder
{
get => DevExpressSchedulerSessionModel.SelectedCustomerOidsForIntervalFinder;
set => DevExpressSchedulerSessionModel.SelectedCustomerOidsForIntervalFinder = value;
}
public List<long> SelectedResourceOidsForIntervalFinder
{
get => DevExpressSchedulerSessionModel.SelectedResourceOidsForIntervalFinder;
set => DevExpressSchedulerSessionModel.SelectedResourceOidsForIntervalFinder = value;
}
public bool ShowTasks
{
get => DevExpressSchedulerSessionModel.ShowTasks;
set => DevExpressSchedulerSessionModel.ShowTasks = value;
}
public bool ShowOnlyPrivateAppointments
{
get => DevExpressSchedulerSessionModel.ShowOnlyPrivateAppointments;
set => DevExpressSchedulerSessionModel.ShowOnlyPrivateAppointments = value;
}
public bool ShowOnlyEmployees
{
get => DevExpressSchedulerSessionModel.ShowOnlyEmployees;
set => DevExpressSchedulerSessionModel.ShowOnlyEmployees = value;
}
public bool ShowOnlyCustomers
{
get => DevExpressSchedulerSessionModel.ShowOnlyCustomers;
set => DevExpressSchedulerSessionModel.ShowOnlyCustomers = value;
}
public bool ShowOnlyResources
{
get => DevExpressSchedulerSessionModel.ShowOnlyResources;
set => DevExpressSchedulerSessionModel.ShowOnlyResources = value;
}
public bool ShowAbsenceTimes
{
get => DevExpressSchedulerSessionModel.ShowAbsenceTimes;
set => DevExpressSchedulerSessionModel.ShowAbsenceTimes = value;
}
public bool ShowEmployeeColors
{
get => DevExpressSchedulerSessionModel.ShowEmployeeColors;
set => DevExpressSchedulerSessionModel.ShowEmployeeColors = value;
}
public bool ShowOnlyMyOwnAppointments
{
get => DevExpressSchedulerSessionModel.ShowOnlyMyOwnAppointments;
set => DevExpressSchedulerSessionModel.ShowOnlyMyOwnAppointments = value;
}
}
}

View File

@@ -10,20 +10,47 @@ namespace BeWoPlanerMobil.Models
public List<long> SelectedResourceOids { get; set; }
public SchedulerViewType CurrentSchedulerViewType { get; set; }
public List<long> SelectedEmployeesForFiltering { get; set; }
public List<long> SelectedCustomersForFiltering { get; set; }
public List<long> SelectedResourcesForFiltering { get; set; }
public List<long> SelectedEmployeeOidsForFiltering { get; set; }
public List<long> SelectedCustomerOidsForFiltering { get; set; }
public List<long> SelectedResourceOidsForFiltering { get; set; }
public List<long> SelectedEmployeeOidsForIntervalFinder { get; set; }
public List<long> SelectedCustomerOidsForIntervalFinder { get; set; }
public List<long> SelectedResourceOidsForIntervalFinder { get; set; }
public bool ShowTasks { get; set; }
public bool ShowOnlyPrivateAppointments { get; set; }
public bool ShowOnlyEmployees { get; set; }
public bool ShowOnlyCustomers { get; set; }
public bool ShowOnlyResources { get; set; }
public bool ShowAbsenceTimes { get; set; }
public bool ShowEmployeeColors { get; set; }
public bool ShowOnlyMyOwnAppointments { get; set; }
public override void ResetValues()
{
base.ResetValues();
SelectedCustomerOids = null;
SelectedEmployeeOids = null;
SelectedResourceOids = null;
SelectedEmployeesForFiltering = null;
SelectedCustomersForFiltering = null;
SelectedResourcesForFiltering = null;
SelectedCustomerOids = new List<long>();
SelectedEmployeeOids = new List<long>();
SelectedResourceOids = new List<long>();
SelectedEmployeeOidsForFiltering = new List<long>();
SelectedCustomerOidsForFiltering = new List<long>();
SelectedResourceOidsForFiltering = new List<long>();
SelectedEmployeeOidsForIntervalFinder = new List<long>();
SelectedCustomerOidsForIntervalFinder = new List<long>();
SelectedResourceOidsForIntervalFinder = new List<long>();
ShowTasks = false;
ShowOnlyPrivateAppointments = false;
ShowOnlyEmployees = false;
ShowOnlyCustomers = false;
ShowOnlyResources = false;
ShowAbsenceTimes = false;
ShowEmployeeColors = false;
ShowOnlyMyOwnAppointments = false;
}
}
}

View File

@@ -3,7 +3,6 @@ using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web.Mvc;
using BeWoPlanerMobil.Service;
using BeWoPlanerMobil.Util;
using BS.Shared;
using BS.Shared.Core;
@@ -21,19 +20,21 @@ namespace BeWoPlanerMobil.Models
SessionModel.ResetValues();
}
public SchedulerSessionModel SchedulerSessionModel
{
get
{
return SessionModel as SchedulerSessionModel;
}
}
public SchedulerSessionModel SchedulerSessionModel => SessionModel as SchedulerSessionModel;
public List<long> TeamMemberCustomerOids { get; set; }
public DateTime SelectedDate { get { return SchedulerSessionModel.SelectedDate; } set { SchedulerSessionModel.SelectedDate = value; } }
public DateTime SelectedDate
{
get => SchedulerSessionModel.SelectedDate;
set => SchedulerSessionModel.SelectedDate = value;
}
public long? SelectedAppointmentOid { get { return SchedulerSessionModel.SelectedAppointmentOid; } set { SchedulerSessionModel.SelectedAppointmentOid = value; } }
public long? SelectedAppointmentOid
{
get => SchedulerSessionModel.SelectedAppointmentOid;
set => SchedulerSessionModel.SelectedAppointmentOid = value;
}
public SchedulerAppointmentDC SelectedAppointment { get; set; }
@@ -42,11 +43,11 @@ namespace BeWoPlanerMobil.Models
public List<AppointmentListItem> AppointmentListItems { get; set; }
public bool HasRightToEditAppointment(String identifier)
public bool HasRightToEditAppointment(string identifier)
{
var appointment = AppointmentListItems.FirstOrDefault(app => app.Identifier.Equals(identifier))?.SchedulerAppointment; //Appointments.FirstOrDefault(app => app.SchedulerAppointmentOid.HasValue && app.SchedulerAppointmentOid.Value == appointmentOid);
var appointment = AppointmentListItems.FirstOrDefault(app => app.Identifier.Equals(identifier))?.SchedulerAppointment;
return appointment != null && BS.Shared.Core.Utils.CheckSchedulerRights(appointment.CustomerList, appointment.ResourceList, appointment.EmployeeList, appointment.Originator, appointment.SchedulerAppointmentOid is null, SchedulerRightsCheckType.Edit, LoggedInUser, TeamMemberCustomerOids ?? new List<long>());
return appointment != null && Utils.CheckSchedulerRights(appointment.CustomerList, appointment.ResourceList, appointment.EmployeeList, appointment.Originator, appointment.SchedulerAppointmentOid is null, SchedulerRightsCheckType.Edit, LoggedInUser, TeamMemberCustomerOids ?? new List<long>());
}
public string DescriptionToEdit => SelectedAppointment?.Description ?? string.Empty;
@@ -65,16 +66,20 @@ namespace BeWoPlanerMobil.Models
{
var allResources = new List<ResourceDC>();
foreach(var cat2res in ResourceCategories2Resources)
foreach(var cat2Res in ResourceCategories2Resources)
{
allResources.AddRangeIfElementsNotIn(cat2res.Value);
allResources.AddRangeIfElementsNotIn(cat2Res.Value);
}
return allResources.OrderBy(resource => resource.Name).ToList();
}
}
public List<long> SelectedResourceOids { get { return SchedulerSessionModel.SelectedResourceOids; } set { SchedulerSessionModel.SelectedResourceOids = value; } }
public List<long> SelectedResourceOids
{
get => SchedulerSessionModel.SelectedResourceOids;
set => SchedulerSessionModel.SelectedResourceOids = value;
}
public List<ResourceDC> SelectedResources { get; set; }
@@ -103,13 +108,21 @@ namespace BeWoPlanerMobil.Models
public List<CompactEmployeeDC> AllEmployees { get; set; } = new List<CompactEmployeeDC>();
public List<long> SelectedEmployeeOids { get { return SchedulerSessionModel.SelectedEmployeeOids; } set { SchedulerSessionModel.SelectedEmployeeOids = value; } }
public List<long> SelectedEmployeeOids
{
get => SchedulerSessionModel.SelectedEmployeeOids;
set => SchedulerSessionModel.SelectedEmployeeOids = value;
}
public List<CompactEmployeeDC> SelectedEmployees { get; set; }
public List<CompactCustomerDC> AllCustomers { get; set; } = new List<CompactCustomerDC>();
public List<long> SelectedCustomerOids { get { return SchedulerSessionModel.SelectedCustomerOids; } set { SchedulerSessionModel.SelectedCustomerOids = value; } }
public List<long> SelectedCustomerOids
{
get => SchedulerSessionModel.SelectedCustomerOids;
set => SchedulerSessionModel.SelectedCustomerOids = value;
}
public List<CompactCustomerDC> SelectedCustomers { get; set; } = new List<CompactCustomerDC>();
@@ -122,11 +135,25 @@ namespace BeWoPlanerMobil.Models
public bool ShowCustomerButton => IsInEditMode ? HasRightToInsertCustomerAppointments : HasRightToEditCustomerAppointments;
//IntervalFinder
public List<long> SelectedEmployeeOidsForIntervalFinder { get { return SchedulerSessionModel.SelectedEmployeeOidsForIntervalFinder; } set { SchedulerSessionModel.SelectedEmployeeOidsForIntervalFinder = value; } }
public List<long> SelectedEmployeeOidsForIntervalFinder
{
get => SchedulerSessionModel.SelectedEmployeeOidsForIntervalFinder;
set => SchedulerSessionModel.SelectedEmployeeOidsForIntervalFinder = value;
}
public List<CompactEmployeeDC> SelectedEmployeesForIntervalFinder { get; set; } = new List<CompactEmployeeDC>();
public List<long> SelectedCustomerOidsForIntervalFinder { get { return SchedulerSessionModel.SelectedCustomerOidsForIntervalFinder; } set { SchedulerSessionModel.SelectedCustomerOidsForIntervalFinder = value; } }
public List<long> SelectedCustomerOidsForIntervalFinder
{
get => SchedulerSessionModel.SelectedCustomerOidsForIntervalFinder;
set => SchedulerSessionModel.SelectedCustomerOidsForIntervalFinder = value;
}
public List<CompactCustomerDC> SelectedCustomersForIntervalFinder { get; set; } = new List<CompactCustomerDC>();
public List<long> SelectedResourceOidsForIntervalFinder { get { return SchedulerSessionModel.SelectedResourceOidsForIntervalFinder; } set { SchedulerSessionModel.SelectedResourceOidsForIntervalFinder = value; } }
public List<long> SelectedResourceOidsForIntervalFinder
{
get => SchedulerSessionModel.SelectedResourceOidsForIntervalFinder;
set => SchedulerSessionModel.SelectedResourceOidsForIntervalFinder = value;
}
public List<ResourceDC> SelectedResourcesForIntervalFinder { get; set; } = new List<ResourceDC>();
public Dictionary<DateTimeSpan, Dictionary<DateTime, bool>> FreeIntervals { get; set; } = new Dictionary<DateTimeSpan, Dictionary<DateTime, bool>>();
@@ -149,38 +176,82 @@ namespace BeWoPlanerMobil.Models
}
}
public bool IsInIntervalFinderMode { get { return SchedulerSessionModel.IsInIntervalFinderMode; } set { SchedulerSessionModel.IsInIntervalFinderMode = value; } }
public DateTime? IntervalStartDate { get { return SchedulerSessionModel.IntervalStartDate; } set { SchedulerSessionModel.IntervalStartDate = value; } }
public DateTime? IntervalEndDate { get { return SchedulerSessionModel.IntervalEndDate; } set { SchedulerSessionModel.IntervalEndDate = value; } }
public bool IsInIntervalFinderMode
{
get => SchedulerSessionModel.IsInIntervalFinderMode;
set => SchedulerSessionModel.IsInIntervalFinderMode = value;
}
public DateTime? IntervalStartDate
{
get => SchedulerSessionModel.IntervalStartDate;
set => SchedulerSessionModel.IntervalStartDate = value;
}
public DateTime? IntervalEndDate
{
get => SchedulerSessionModel.IntervalEndDate;
set => SchedulerSessionModel.IntervalEndDate = value;
}
public string IntervalStartDateStr => IntervalStartDate.HasValue ? IntervalStartDate.Value.ToString("yyyy-MM-ddTHH:mm") : string.Empty;
public string IntervalEndDateStr => IntervalEndDate.HasValue ? IntervalEndDate.Value.ToString("yyyy-MM-ddTHH:mm") : string.Empty;
public string IntervalStartTimeStr => IntervalStartDate.HasValue ? $"{IntervalStartDate:HH:mm}" : string.Empty;
public string IntervalEndTimeStr => IntervalEndDate.HasValue ? $"{IntervalEndDate:HH:mm}" : string.Empty;
public int? IntervalDuration { get { return SchedulerSessionModel.IntervalDuration; } set { SchedulerSessionModel.IntervalDuration = value; } }
public int? IntervalDuration
{
get => SchedulerSessionModel.IntervalDuration;
set => SchedulerSessionModel.IntervalDuration = value;
}
public string IntervalDurationStr => IntervalDuration.HasValue ? $"{IntervalDuration}" : string.Empty;
[Display(Name = "Ganztägig")]
public bool IsAllDay { get { return SchedulerSessionModel.IsAllDay; } set { SchedulerSessionModel.IsAllDay = value; } }
public bool IsAllDay
{
get => SchedulerSessionModel.IsAllDay;
set => SchedulerSessionModel.IsAllDay = value;
}
[Display(Name = "Privat")]
public bool IsPrivate { get { return SchedulerSessionModel.IsPrivate; } set { SchedulerSessionModel.IsPrivate = value; } }
public bool IsPrivate
{
get => SchedulerSessionModel.IsPrivate;
set => SchedulerSessionModel.IsPrivate = value;
}
public List<CompactEmployeeDC> MyTeamEmployees { get; set; }
public List<long> SelectedResourceOidsForFiltering { get { return SchedulerSessionModel.SelectedResourceOidsForFiltering; } set { SchedulerSessionModel.SelectedResourceOidsForFiltering = value; } }
public List<long> SelectedResourceOidsForFiltering
{
get => SchedulerSessionModel.SelectedResourceOidsForFiltering;
set => SchedulerSessionModel.SelectedResourceOidsForFiltering = value;
}
public List<ResourceDC> SelectedResourcesForFiltering { get; set; }
public List<long> SelectedEmployeeOidsForFiltering { get { return SchedulerSessionModel.SelectedEmployeeOidsForFiltering; } set { SchedulerSessionModel.SelectedEmployeeOidsForFiltering = value; } }
public List<long> SelectedEmployeeOidsForFiltering
{
get => SchedulerSessionModel.SelectedEmployeeOidsForFiltering;
set => SchedulerSessionModel.SelectedEmployeeOidsForFiltering = value;
}
public List<CompactEmployeeDC> SelectedEmployeesForFiltering { get; set; }
public List<long> SelectedCustomerOidsForFiltering { get { return SchedulerSessionModel.SelectedCustomerOidsForFiltering; } set { SchedulerSessionModel.SelectedCustomerOidsForFiltering = value; } }
public List<long> SelectedCustomerOidsForFiltering
{
get => SchedulerSessionModel.SelectedCustomerOidsForFiltering;
set => SchedulerSessionModel.SelectedCustomerOidsForFiltering = value;
}
public List<CompactCustomerDC> SelectedCustomersForFiltering { get; set; }
public List<CompactTeamDC> MyTeams { get; set; } = new List<CompactTeamDC>();
public bool ShouldLoadTasks { get { return SchedulerSessionModel.ShouldLoadTasks; } set { SchedulerSessionModel.ShouldLoadTasks = value; } }
public bool ShouldLoadTasks
{
get => SchedulerSessionModel.ShouldLoadTasks;
set => SchedulerSessionModel.ShouldLoadTasks = value;
}
}
public class WeekViewObject

View File

@@ -1,7 +1,11 @@
@using BeWoPlanerMobil.Util
@using BS.Shared.Extensions
@model BeWoPlanerMobil.Models.DevExpressSchedulerModel
@model BeWoPlanerMobil.Models.DevExpressSchedulerModel
<script type="text/javascript">
@foreach(var customer in Model.PossibleCustomers)
{
var checkedValue = Model.SelectedCustomersForFiltering.Contains(customer) ? "checked" : string.Empty;
</script>
<div class="custom-control custom-checkbox customer-text">
<input type="checkbox" class="custom-control-input" id="customer-@customer.CustomerOid-checkbox" @checkedValue onchange="window.changeCustomerListSelection()" />
<label class="custom-control-label customer-name-label" for="customer-@customer.CustomerOid-checkbox">@customer.DetailDescription</label>
</div>
}

View File

@@ -1,7 +1,103 @@
@using BeWoPlanerMobil.Util
@using BS.Shared.Extensions
@using BS.Shared.Extensions
@model BeWoPlanerMobil.Models.DevExpressSchedulerModel
<script type="text/javascript">
function selectAllCustomersOnChange() {
const isChecked = $("#all-customers-checkbox").prop("checked");
</script>
$("#customer-input-container").load("@Url.Action("SelectAllCustomersForFiltering")", { isChecked: isChecked }, () => { scheduler.Refresh(); });
}
function customerListSearchOnChange() {
var text = $("#customer-search-input").val().toLowerCase();
const entries = $(".customer-text");
if(text.length === 0) {
entries.show();
}
$.each(entries, function (index, item) {
const customer = $(item);
if(customer.find(".customer-name-label").text().toLowerCase().includes(text)) {
customer.show();
} else {
customer.hide();
}
});
}
function resetCustomerSeach() {
$("#customer-search-input").val("");
$(".customer-text").show();
}
function removeSelectedCustomer(customerOid) {
const checkbox = $(`#customer-${customerOid}-checkbox`);
if(checkbox.length) {
checkbox.prop("checked", false);
}
changeCustomerListSelection();
}
function changeCustomerListSelection() {
const selectedCustomerOids = $("#customer-input-container input:checked").map(function () {return $(this).attr("id").split("-")[1];}).get();
const allCustomersCount = $("#customer-input-container input[type=checkbox]").map(function () {return $(this).attr("id").split("-")[1];}).get();
const selectedCustomersCount = selectedCustomerOids.length;
$("#all-customers-checkbox").prop("checked", (allCustomersCount === selectedCustomersCount));
$("#customer-input-container").load("@Url.Action("UpdateCustomerSelection")", { selectedCustomerOids: selectedCustomerOids }, () => { scheduler.Refresh(); });
}
</script>
<div class="modal" tabindex="-1" role="dialog" id="customers-popup-apt-flt">
<div class="modal-dialog modal-dialog-scrollable" role="document">
<div class="modal-content">
<div class="modal-header">
<h6 class="modal-title text-center w-100 font-weight-bold">
<span class="fas fa-user text-bewo-customers"></span>
Klienten
</h6>
<button type="button" class="close" data-dismiss="modal" onclick="resetCustomerSeach()">
<span>&times;</span>
</button>
</div>
<div class="modal-body">
<div class="container-fluid">
<div class="input-group mb-3">
<div class="input-group-prepend">
<div class="input-group-text">
@{
var allCustomersCheckedVal = Model.PossibleCustomers.AreListEqual(Model.SelectedCustomers) ? "checked" : string.Empty;
}
<div class="custom-control custom-checkbox custom-control-inline mx-auto">
<input type="checkbox" class="custom-control-input" id="all-customers-checkbox" @allCustomersCheckedVal onchange="selectAllCustomersOnChange()" />
<label class="custom-control-label" for="all-customers-checkbox">Alle</label>
</div>
</div>
</div>
<input class="form-control w-100" type="text" placeholder="Suchen..." oninput="customerListSearchOnChange()" id="customer-search-input" />
<div class="input-group-append">
<button class="btn btn-outline-secondary" type="button" onclick="resetCustomerSeach()">
<span class="fas fa-times-circle"></span>
</button>
</div>
</div>
<div id="customer-input-container">
@Html.Partial("AptFltCustomerPopupListPartial", Model)
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" data-dismiss="modal">Übernehmen</button>
</div>
</div>
</div>
</div>

View File

@@ -1,7 +1,11 @@
@using BeWoPlanerMobil.Util
@using BS.Shared.Extensions
@model BeWoPlanerMobil.Models.DevExpressSchedulerModel
@model BeWoPlanerMobil.Models.DevExpressSchedulerModel
<script type="text/javascript">
@foreach(var employee in Model.PossibleEmployees)
{
var checkedValue = Model.SelectedEmployeesForFiltering.Contains(employee) ? "checked" : string.Empty;
</script>
<div class="custom-control custom-checkbox employee-text">
<input type="checkbox" class="custom-control-input" id="employee-@employee.EmployeeOid-checkbox" @checkedValue onchange="window.changeEmployeeListSelection()" />
<label class="custom-control-label employee-name-label" for="employee-@employee.EmployeeOid-checkbox">@employee.DetailDescription</label>
</div>
}

View File

@@ -6,20 +6,7 @@
function selectAllEmployeesOnChange() {
const isChecked = $("#all-employees-checkbox").prop("checked");
$("#employee-input-container").load(
"@Url.Action("SelectAllEmployees")",
{
isChecked: isChecked
},
() => {
$("#selected-employees-list").load(
"@Url.Action("LoadUpdatedEmployees")",
() => {
$("#one-day-scheduler-partial-container").load('@Url.Action("FetchAppointments", "Scheduler")');
}
);
}
);
$("#employee-input-container").load("@Url.Action("SelectAllEmployeesForFiltering")", { isChecked: isChecked }, () => { scheduler.Refresh(); });
}
function employeeListSearchOnChange() {
@@ -45,5 +32,102 @@
function resetEmployeeSearch() {
$("#employee-search-input").val("");
$(".employee-text").show();
}
function selectTeamForAppointment(teamOid) {
$("#employee-input-container").load("@Url.Action("SelectTeamForAppointment")", { teamOid: teamOid }, () => {
scheduler.Refresh();
});
}
function removeSelectedEmployee(employeeOid) {
const checkbox = $(`#employee-${employeeOid}-checkbox`);
if(checkbox.length) {
checkbox.prop("checked", false);
}
changeEmployeeListSelection();
}
function changeEmployeeListSelection() {
const selectedEmployeeOids = $("#employee-input-container input:checked").map(function() { return $(this).attr("id").split("-")[1]; }).get();
const allEmployeesCount = $("#employee-input-container input[type=checkbox]").map(function () { return $(this).attr("id").split("-")[1]; }).get().length;
const selectedEmployeesCount = selectedEmployeeOids.length;
console.log(selectedEmployeeOids);
$("#all-employees-checkbox").prop("checked", (allEmployeesCount === selectedEmployeesCount));
$("#employee-input-container").load("@Url.Action("UpdateEmployeeSelection", "DevExpressScheduler")", {selectedEmployeeOids: selectedEmployeeOids }, () => { scheduler.Refresh(); });
}
</script>
<div class="modal" tabindex="-1" role="dialog" id="employees-popup-apt-flt">
<div class="modal-dialog modal-dialog-scrollable" role="document">
<div class="modal-content">
<div class="modal-header">
<h6 class="modal-title text-center w-100 font-weight-bold">
<span class="fas fa-user text-bewo-employee"></span>
Mitarbeiter
</h6>
<button type="button" class="close" data-dismiss="modal" onclick="resetEmployeeSearch()">
<span>&times;</span>
</button>
</div>
<div class="modal-body">
<div class="container-fluid">
<div class="input-group mb-3">
<div class="input-group-prepend">
<div class="input-group-text">
<div class="custom-control custom-checkbox custom-control-inline mx-auto">
@{
var allEmployeesCheckedVal = Model.PossibleEmployees.AreListEqual(Model.SelectedEmployees) ? "checked" : string.Empty;
}
<input type="checkbox" class="custom-control-input" id="all-employees-checkbox" @allEmployeesCheckedVal onchange="selectAllEmployeesOnChange()" />
<label class="custom-control-label" for="all-employees-checkbox">Alle</label>
</div>
</div>
</div>
<input class="form-control w-100" type="text" placeholder="Suchen..." oninput="employeeListSearchOnChange()" id="employee-search-input" />
<div class="input-group-append">
<button class="btn btn-outline-secondary" type="button" onclick="resetEmployeeSearch()">
<span class="fas fa-times-circle"></span>
</button>
</div>
</div>
@if(Model.HasRightToViewTeams)
{
<div class="card w-100 mb-3">
<div class="card-header" data-toggle="collapse" data-target="#collapsable-teams-selection">
<div class="d-flex align-items-center">
<h5 class="mr-auto">Meine Teams</h5>
<div class="btn-group" role="group">
<span class="fas fa-chevron-down text-primary"></span>
</div>
</div>
</div>
<div class="collapse @Html.GetCollapsibleClass(Model.Collapsibles2IsShown, "collapsable-teams-selection")" id="collapsable-teams-selection">
<div class="card-body">
@foreach(var team in Model.MyTeams)
{
<button type="button" class="btn btn-bewo-teams w-100 my-2" onclick="selectTeamForAppointment(@team.TeamOid)">@team.Name</button>
}
</div>
</div>
</div>
<hr />
}
<div id="employee-input-container">
@Html.Partial("AptFltEmployeePopupListPartial")
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" data-dismiss="modal">Übernehmen</button>
</div>
</div>
</div>
</div>

View File

@@ -1,7 +1,29 @@
@using BeWoPlanerMobil.Util
@using BS.Shared.Extensions
@model BeWoPlanerMobil.Models.DevExpressSchedulerModel
<script type="text/javascript">
@foreach(var category2Resources in Model.ResourceCategories2Resources)
{
<div class="card w-100 mb-3 category-card" id="resource-category-@category2Resources.Key.ValueListEntryOid">
<div class="card-header tree-card-header" data-toggle="collapse" data-target="#collapsable-resource-category-@category2Resources.Key.ValueListEntryOid">
<div class="d-flex align-items-center">
<h5 class="mr-auto">@category2Resources.Key.DisplayName</h5>
<div class="btn-group" role="group">
<span class="fas fa-chevron-down text-primary"></span>
</div>
</div>
</div>
<div class="collapse @Html.GetCollapsibleClass(Model.Collapsibles2IsShown, $"collapsable-resource-category-{category2Resources.Key.ValueListEntryOid}")" id="collapsable-resource-category-@category2Resources.Key.ValueListEntryOid">
<div class="card-body resource-list">
@foreach(var resource in category2Resources.Value)
{
var checkedValue = Model.SelectedResourcesForFiltering.Contains(resource) ? "checked" : string.Empty;
</script>
<div class="custom-control custom-checkbox resource-text">
<input type="checkbox" class="custom-control-input" id="resource-@resource.ResourceOid-checkbox" @checkedValue onchange="window.changeResourceListSelection()" />
<label class="custom-control-label resource-name-label" for="resource-@resource.ResourceOid-checkbox">@resource.Name</label>
</div>
}
</div>
</div>
</div>
}

View File

@@ -3,5 +3,78 @@
@model BeWoPlanerMobil.Models.DevExpressSchedulerModel
<script type="text/javascript">
function selectAllResourcesOnChange() {
const isChecked = $("#all-resources-checkbox").prop("checked");
</script>
$("#resource-input-container").load("@Url.Action("SelectAllResourcesForFiltering")", { isChecked: isChecked }, () => { scheduler.Refresh(); });
}
function removeSelectedResource(resourceOid) {
const checkbox = $(`#resource-${resourceOid}-checkbox`);
if(checkbox.length) {
checkbox.prop("checked", false);
}
changeResourceListSelection();
}
function changeResourceListSelection() {
const selectedResourceOids = $("#resource-input-container input:checked").map(function() {return $(this).attr("id").split("-")[1];}).get();
const allResourcesCount = $("#resource-input-container input[type=checkbox]").map(function () {return $(this).attr("id").split("-")[1];}).get().length;
const selectedResourcesCount = selectedResourceOids.length;
$("#all-resources-checkbox").prop("checked", (allResourcesCount === selectedResourcesCount));
$("#resource-input-container").load("@Url.Action("UpdateResourceSelection")", { selectedResourceOids: selectedResourceOids }, () => { scheduler.Refresh(); });
}
</script>
<div class="modal" tabindex="-1" role="dialog" id="resources-popup-apt-flt">
<div class="modal-dialog modal-dialog-scrollable" role="document">
<div class="modal-content">
<div class="modal-header">
<h6 class="modal-title text-center w-100 font-weight-bold">
<span class="fas fa-cubes text-bewo-resource"></span>
Ressourcen
</h6>
<button type="button" class="close" data-dismiss="modal" onclick="resetTreeSearch('resource-search-input', 'resource-text', 'category-card')">
<span>&times;</span>
</button>
</div>
<div class="modal-body">
<div class="container-fluid">
<div class="input-group mb-3">
<div class="input-group-prepend">
<div class="input-group-text">
<div class="custom-control custom-checkbox custom-control-inline mx-auto">
@{
var allResourcesCheckedVal = Model.PossibleResources.AreListEqual(Model.SelectedResources) ? "checked" : string.Empty;
}
<input type="checkbox" class="custom-control-input" id="all-resources-checkbox" @allResourcesCheckedVal onchange="selectAllResourcesOnChange()" />
<label class="custom-control-label" for="all-resources-checkbox">Alle</label>
</div>
</div>
</div>
<input class="form-control w-100" type="text" placeholder="Suchen..." oninput="treeSearchOnChange('resource-search-input', 'resource-text', 'category-card', 'resource-name-label', 'resource-list')" id="resource-search-input" />
<div class="input-group-append">
<button class="btn btn-outline-secondary" type="button" onclick="resetTreeSearch('resource-search-input', 'resource-text', 'category-card')">
<span class="fas fa-times-circle"></span>
</button>
</div>
</div>
<div id="resource-input-container">
@Html.Partial("AptFltResourcePopupListPartial")
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" data-dismiss="modal">Übernehmen</button>
</div>
</div>
</div>
</div>

View File

@@ -106,7 +106,7 @@
const tmpDate = new Date();
const end = new Date(tmpDate.setTime(start.getTime() + duration));
e.handled = true;
const startStr = getTimeStamp(start, false, false);
@@ -133,57 +133,57 @@
currentItem.SetVisible(false);
}
}
}
}
}
</script>
<div class="dropdown">
<button class="btn btn-primary dropdown-toggle m-1" type="button" data-toggle="dropdown">
Filtern
</button>
<button class="btn btn-primary dropdown-toggle m-1" type="button" data-toggle="dropdown">
Filtern
</button>
<div class="dropdown-menu">
<div class="dropdown-item">
<form class="form-inline">
<div class="form-group form-check">
<input type="checkbox" class="form-check-input" id="only-my-own-appointments-cb2">
<label class="form-check-label" for="only-my-own-appointments-cb2">Nur meine Termine</label>
</div>
</form>
</div>
<div class="dropdown-item">
<form class="form-inline">
<div class="form-group form-check">
<input type="checkbox" class="form-check-input" id="only-private-appointments-cb2">
<label class="form-check-label" for="only-private-appointments-cb2">Nur private Termine</label>
</div>
</form>
</div>
<div class="dropdown-divider"></div>
<div class="dropdown-item">
<form class="form-inline">
<div class="form-group form-check">
<input type="checkbox" class="form-check-input" id="employee-colors-cb2">
<label class="form-check-label" for="employee-colors-cb2">Mitarbeiterfarben</label>
</div>
</form>
</div>
<div class="dropdown-item">
<form class="form-inline">
<div class="form-group form-check">
<input type="checkbox" class="form-check-input" id="absence-times-cb2">
<label class="form-check-label" for="absence-times-cb2">Abwesenheiten</label>
</div>
</form>
</div>
<div class="dropdown-item">
<form class="form-inline">
<div class="form-group form-check">
<input type="checkbox" class="form-check-input" id="tasks-cb2">
<label class="form-check-label" for="tasks-cb2">Aufgaben</label>
</div>
</form>
</div>
<div class="dropdown-divider"></div>
<div class="dropdown-item">
<form class="form-inline">
<div class="form-group form-check">
<input type="checkbox" class="form-check-input" id="only-my-own-appointments-cb2">
<label class="form-check-label" for="only-my-own-appointments-cb2">Nur meine Termine</label>
</div>
</form>
</div>
<div class="dropdown-item">
<form class="form-inline">
<div class="form-group form-check">
<input type="checkbox" class="form-check-input" id="only-private-appointments-cb2">
<label class="form-check-label" for="only-private-appointments-cb2">Nur private Termine</label>
</div>
</form>
</div>
<div class="dropdown-divider"></div>
<div class="dropdown-item">
<form class="form-inline">
<div class="form-group form-check">
<input type="checkbox" class="form-check-input" id="employee-colors-cb2">
<label class="form-check-label" for="employee-colors-cb2">Mitarbeiterfarben</label>
</div>
</form>
</div>
<div class="dropdown-item">
<form class="form-inline">
<div class="form-group form-check">
<input type="checkbox" class="form-check-input" id="absence-times-cb2">
<label class="form-check-label" for="absence-times-cb2">Abwesenheiten</label>
</div>
</form>
</div>
<div class="dropdown-item">
<form class="form-inline">
<div class="form-group form-check">
<input type="checkbox" class="form-check-input" id="tasks-cb2">
<label class="form-check-label" for="tasks-cb2">Aufgaben</label>
</div>
</form>
</div>
<div class="dropdown-divider"></div>
<div class="dropdown-item">
<form class="form-inline">
<div class="form-group form-check">
@@ -209,27 +209,33 @@
</form>
</div>
<div class="dropdown-divider"></div>
<a href="#" class="dropdown-item">
<i class="fas fa-user text-bewo-employee"></i>
Mitarbeiter
<span class="badge badge-bewo-employee">0</span>
<a href="#" class="dropdown-item" onclick="$('#employees-popup-apt-flt').modal('show')">
<i class="fas fa-user text-bewo-employee"></i>
Mitarbeiter
<span class="badge badge-bewo-employee">0</span>
</a>
<a href="#" class="dropdown-item" onclick="$('#customers-popup-apt-flt').modal('show')">
<i class="fas fa-user text-bewo-customers"></i>
Klienten
<span class="badge badge-bewo-customers">0</span>
</a>
<a href="#" class="dropdown-item">
<i class="fas fa-user text-bewo-customers"></i>
Klienten
<span class="badge badge-bewo-customers">0</span>
</a>
<a href="#" class="dropdown-item">
<i class="fas fa-cubes text-bewo-resource"></i>
Ressourcen
<span class="badge badge-bewo-resource">0</span>
<i class="fas fa-cubes text-bewo-resource" onclick="$('#resources-popup-apt-flt').modal('show')"></i>
Ressourcen
<span class="badge badge-bewo-resource">0</span>
</a>
</div>
</div>
@using(Html.BeginForm())
{
<div id="scheduler-container">
@Html.Partial("SchedulerPagePartial", Model)
</div>
}
<div id="scheduler-container">
@Html.Partial("SchedulerPagePartial", Model)
</div>
}
@Html.Partial("AptFltEmployeesPartial")
@Html.Partial("AptFltCustomersPartial")
@Html.Partial("AptFltResourcesPartial")