diff --git a/CompanyManagment.App.Contracts/Leave/LeaveViewModel.cs b/CompanyManagment.App.Contracts/Leave/LeaveViewModel.cs index 2c69168f..a95f1148 100644 --- a/CompanyManagment.App.Contracts/Leave/LeaveViewModel.cs +++ b/CompanyManagment.App.Contracts/Leave/LeaveViewModel.cs @@ -27,4 +27,5 @@ public class LeaveViewModel public TimeSpan ShiftDuration { get; set; } public bool HasShiftDuration { get; set; } + public bool IsInvalid { get; set; } } \ No newline at end of file diff --git a/CompanyManagment.EFCore/Repository/LeaveRepository.cs b/CompanyManagment.EFCore/Repository/LeaveRepository.cs index 17566be2..f6f72f16 100644 --- a/CompanyManagment.EFCore/Repository/LeaveRepository.cs +++ b/CompanyManagment.EFCore/Repository/LeaveRepository.cs @@ -65,8 +65,12 @@ public class LeaveRepository : RepositoryBase, ILeaveRepository Month = x.Month, HasShiftDuration = x.HasShiftDuration, ShiftDuration = x.ShiftDuration, + IsInvalid = x.IsInvalid }); - + if (searchModel.IsInvalid) + { + query = query.IgnoreQueryFilters().Where(x => x.IsInvalid); + } if (searchModel.WorkshopId != 0 && searchModel.EmployeeId != 0) query = query.Where(x => x.WorkshopId == searchModel.WorkshopId && x.EmployeeId == searchModel.EmployeeId); diff --git a/ServiceHost/Areas/Client/Pages/Company/Employees/Leave.cshtml b/ServiceHost/Areas/Client/Pages/Company/Employees/Leave.cshtml index dd317a1a..d1a2e273 100644 --- a/ServiceHost/Areas/Client/Pages/Company/Employees/Leave.cshtml +++ b/ServiceHost/Areas/Client/Pages/Company/Employees/Leave.cshtml @@ -312,12 +312,14 @@ -
- +