Add locationId filter to GetWorkOrderList

- Accept locationId query parameter for server-side location filtering
- Used by dispatch modal to find all WOs at the same site
This commit is contained in:
Adam Moussa 2026-04-17 16:13:18 -04:00
parent 575e8ab6fc
commit 3355df111f

View file

@ -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", string? status = "", string? assignee = "")
public IActionResult GetWorkOrderList(string? search = "", int page = 1, int pageSize = 12, string? sortBy = "lastUpdated", string? sortDir = "desc", string? status = "", string? assignee = "", int? locationId = null)
{
search ??= "";
@ -378,6 +378,9 @@ namespace Api.SeaHavenIndustries.Controllers
.Include(w => w.AssignToUser)
.Where(w => w.istemplate != true);
if (locationId.HasValue)
query = query.Where(w => w.LocationId == locationId.Value);
if (!string.IsNullOrWhiteSpace(status))
query = query.Where(w => w.Status == status);