diff --git a/Api.SeaHavenIndustries/Controllers/WorkOrderController.cs b/Api.SeaHavenIndustries/Controllers/WorkOrderController.cs index 0bb4a43..c567180 100644 --- a/Api.SeaHavenIndustries/Controllers/WorkOrderController.cs +++ b/Api.SeaHavenIndustries/Controllers/WorkOrderController.cs @@ -369,7 +369,7 @@ namespace Api.SeaHavenIndustries.Controllers // GET: api/WorkOrder/GetWorkOrderList // ----------------------------------- [HttpGet("GetWorkOrderList")] - public IActionResult GetWorkOrderList(string? search = "", int page = 1, int pageSize = 12, string? sortBy = "lastUpdated", string? sortDir = "desc") + public IActionResult GetWorkOrderList(string? search = "", int page = 1, int pageSize = 12, string? sortBy = "lastUpdated", string? sortDir = "desc", string? status = "", string? assignee = "") { search ??= ""; @@ -378,6 +378,14 @@ namespace Api.SeaHavenIndustries.Controllers .Include(w => w.AssignToUser) .Where(w => w.istemplate != true); + if (!string.IsNullOrWhiteSpace(status)) + query = query.Where(w => w.Status == status); + + if (assignee == "__unassigned") + query = query.Where(w => w.AssignTo == null || w.AssignTo == ""); + else if (!string.IsNullOrWhiteSpace(assignee)) + query = query.Where(w => w.AssignToUser != null && (w.AssignToUser.FirstName + " " + w.AssignToUser.LastName).Contains(assignee)); + if (!string.IsNullOrWhiteSpace(search)) { var s = search.ToLower();