mirror of
https://github.com/Sea-Haven-Industries/shoc-backend.git
synced 2026-09-30 04:53:11 +00:00
109 lines
3.9 KiB
C#
109 lines
3.9 KiB
C#
namespace SeaHaven.Services.Helpers
|
|
{
|
|
public static class WorkOrderBoardFieldNames
|
|
{
|
|
public const string WoNumber = "woNumber";
|
|
public const string WorkOrderType = "workOrderType";
|
|
public const string SiteCode = "siteCode";
|
|
public const string LifecycleStatus = "lifecycleStatus";
|
|
public const string AssignTo = "assignTo";
|
|
public const string DueDate = "dueDate";
|
|
public const string ScheduledDate = "scheduledDate";
|
|
public const string TargetWeek = "targetWeek";
|
|
public const string ScheduleWeekOnly = "scheduleWeekOnly";
|
|
public const string VendorId = "vendorId";
|
|
public const string ApptDate = "apptDate";
|
|
public const string ApptTime = "apptTime";
|
|
public const string DocStatus = "docStatus";
|
|
public const string CompletedDate = "completedDate";
|
|
public const string Pm = "pm";
|
|
public const string ServiceId = "serviceId";
|
|
public const string ServiceNotes = "serviceNotes";
|
|
public const string ExtraServices = "extraServices";
|
|
public const string AdditionalContacts = "additionalContacts";
|
|
public const string FlagColor = "flagColor";
|
|
public const string AvetaRequired = "avetaRequired";
|
|
public const string Severity = "severity";
|
|
public const string RescheduleCount = "RescheduleCount";
|
|
|
|
private static readonly HashSet<string> DispatchFields = new(StringComparer.OrdinalIgnoreCase)
|
|
{
|
|
VendorId,
|
|
ApptDate,
|
|
ApptTime
|
|
};
|
|
|
|
private static readonly HashSet<string> AllEditable = new(StringComparer.OrdinalIgnoreCase)
|
|
{
|
|
WoNumber,
|
|
WorkOrderType,
|
|
SiteCode,
|
|
LifecycleStatus,
|
|
AssignTo,
|
|
DueDate,
|
|
ScheduledDate,
|
|
TargetWeek,
|
|
ScheduleWeekOnly,
|
|
VendorId,
|
|
ApptDate,
|
|
ApptTime,
|
|
DocStatus,
|
|
CompletedDate,
|
|
Pm,
|
|
ServiceId,
|
|
ServiceNotes,
|
|
ExtraServices,
|
|
AdditionalContacts,
|
|
FlagColor,
|
|
AvetaRequired,
|
|
Severity
|
|
};
|
|
|
|
public static bool IsEditable(string field) => Canonicalize(field) != null;
|
|
|
|
public static bool IsDispatchField(string field)
|
|
{
|
|
var canonical = Canonicalize(field);
|
|
return canonical != null && DispatchFields.Contains(canonical);
|
|
}
|
|
|
|
public static string? Canonicalize(string field)
|
|
{
|
|
if (string.IsNullOrWhiteSpace(field))
|
|
return null;
|
|
|
|
return AllEditable.FirstOrDefault(f => string.Equals(f, field, StringComparison.OrdinalIgnoreCase));
|
|
}
|
|
|
|
public static string ToAuditFieldName(string field)
|
|
{
|
|
var canonical = Canonicalize(field) ?? field;
|
|
return canonical switch
|
|
{
|
|
WoNumber => "InternalWONumber",
|
|
WorkOrderType => "WorkOrderType",
|
|
SiteCode => "SiteCode",
|
|
LifecycleStatus => "LifecycleStatus",
|
|
AssignTo => "AssignTo",
|
|
DueDate => "DueDate",
|
|
ScheduledDate => "ScheduledDate",
|
|
TargetWeek => "TargetWeek",
|
|
ScheduleWeekOnly => "ScheduleWeekOnly",
|
|
VendorId => "VendorId",
|
|
ApptDate => "ApptDate",
|
|
ApptTime => "ApptTime",
|
|
DocStatus => "DocStatus",
|
|
CompletedDate => "CompletedDate",
|
|
Pm => "Trade",
|
|
ServiceId => "ServiceId",
|
|
ServiceNotes => "ServiceNotes",
|
|
ExtraServices => "ExtraServices",
|
|
AdditionalContacts => "AdditionalContacts",
|
|
FlagColor => "FlagColor",
|
|
AvetaRequired => "AvetaRequired",
|
|
Severity => "Severity",
|
|
_ => canonical
|
|
};
|
|
}
|
|
}
|
|
}
|