26 lines
761 B
TypeScript
26 lines
761 B
TypeScript
export const WORK_ORDER_STATUS = {
|
|
PENDING_MATERIAL: 'pending_material',
|
|
UNASSIGNED: 'unassigned',
|
|
OPEN: 'open',
|
|
IN_PROGRESS: 'in_progress',
|
|
PENDING_ACCEPTANCE: 'pending_acceptance',
|
|
PROBLEM: 'problem',
|
|
ACCEPTED: 'accepted',
|
|
CANCELLED: 'cancelled',
|
|
} as const
|
|
|
|
export type WorkOrderStatus = (typeof WORK_ORDER_STATUS)[keyof typeof WORK_ORDER_STATUS] | (string & {})
|
|
|
|
const FINAL_STATUSES = new Set<WorkOrderStatus>([
|
|
WORK_ORDER_STATUS.ACCEPTED,
|
|
WORK_ORDER_STATUS.CANCELLED,
|
|
])
|
|
|
|
export function normalizeWorkOrderStatus(value: unknown): WorkOrderStatus {
|
|
return String(value || '').trim() as WorkOrderStatus
|
|
}
|
|
|
|
export function isWorkOrderFinalStatus(value: unknown): boolean {
|
|
return FINAL_STATUSES.has(normalizeWorkOrderStatus(value))
|
|
}
|