shoc-backend/SeaHaven.DataServices/Helpers/WorkOrderBoardDispatchAssignment.cs
Arthur Bassi 75d337df0f fix(work-orders): omit inactive primary vendor from board rows (SH-183)
Do not project VendorId/VendorName for Cancelled, Canceled, or Refused primary dispatches, and expose PrimaryDispatchStatus on the board DTO.
2026-08-20 13:22:12 -03:00

28 lines
924 B
C#

namespace SeaHaven.DataServices.Helpers
{
/// <summary>
/// SH-183: a cancelled or refused primary dispatch is not a live vendor assignment.
/// Verified/Completed remain live — the company that did the work.
/// </summary>
public static class WorkOrderBoardDispatchAssignment
{
public static bool IsInactivePrimaryDispatch(string? status)
{
var normalized = (status ?? string.Empty).Trim().ToLowerInvariant();
return normalized is "cancelled" or "canceled" or "refused";
}
public static (int? VendorId, string? VendorName) LiveVendor(
int? vendorId,
string? vendorName,
string? primaryDispatchStatus)
{
if (IsInactivePrimaryDispatch(primaryDispatchStatus))
{
return (null, null);
}
return (vendorId, vendorName);
}
}
}