From c2724f1d203d4921685de514321e18cb6c07c8e0 Mon Sep 17 00:00:00 2001 From: Edward Brunton <42774600+EdwardBrunton@users.noreply.github.com> Date: Fri, 20 Sep 2024 10:29:25 +0200 Subject: [PATCH] fix: Update material status codes to display correct status in garden (#1133) --- .../mapping/src/lib/materialStatusMap.ts | 10 ++++---- .../packages/types/src/lib/materialStatus.ts | 18 +++++++------- .../followup/getFollowUpStatus.ts | 2 +- .../utils-statuses/material/getMatStatus.ts | 2 +- .../lib/utils-statuses/material/material.ts | 24 +++++++++---------- 5 files changed, 28 insertions(+), 28 deletions(-) diff --git a/libs/shared/src/packages/mapping/src/lib/materialStatusMap.ts b/libs/shared/src/packages/mapping/src/lib/materialStatusMap.ts index e00dc4e49..01e4ef081 100644 --- a/libs/shared/src/packages/mapping/src/lib/materialStatusMap.ts +++ b/libs/shared/src/packages/mapping/src/lib/materialStatusMap.ts @@ -6,12 +6,12 @@ import { MaterialStatus } from '../../../types/src/lib/materialStatus'; export const materialStatusMap: Partial> = { M10: 'Material requested to job site', M12: 'Material received on job site', - M2: 'Materials linked to Smartpack/Jobcard', - M6: 'Material partly delivered', - M7: 'Materials fully delivered', - M9: 'Material returned', + M02: 'Materials linked to Smartpack/Jobcard', + M06: 'Material partly delivered', + M07: 'Materials fully delivered', + M09: 'Material returned', MN: 'No Material required', - MN1: 'Additional material to be issued Offshore from Min/Max Stock', + MN01: 'Additional material to be issued Offshore from Min/Max Stock', MNX1: 'Materials not linked to Smartpack/Jobcard', MNX2: 'Materials partially linked to Smartpack/Jobcard', }; diff --git a/libs/shared/src/packages/types/src/lib/materialStatus.ts b/libs/shared/src/packages/types/src/lib/materialStatus.ts index 04a147183..067210f27 100644 --- a/libs/shared/src/packages/types/src/lib/materialStatus.ts +++ b/libs/shared/src/packages/types/src/lib/materialStatus.ts @@ -1,17 +1,17 @@ export type MaterialStatus = | 'MN' - | 'MN1' + | 'MN01' | 'MNX1' | 'MNX2' | 'M13' | 'M12' | 'M11' | 'M10' - | 'M9' - | 'M8' - | 'M7' - | 'M6' - | 'M5' - | 'M4' - | 'M3' - | 'M2'; + | 'M09' + | 'M08' + | 'M07' + | 'M06' + | 'M05' + | 'M04' + | 'M03' + | 'M02'; diff --git a/libs/workorderapp/src/lib/utils-statuses/followup/getFollowUpStatus.ts b/libs/workorderapp/src/lib/utils-statuses/followup/getFollowUpStatus.ts index 6a6c412af..64afcefa6 100644 --- a/libs/workorderapp/src/lib/utils-statuses/followup/getFollowUpStatus.ts +++ b/libs/workorderapp/src/lib/utils-statuses/followup/getFollowUpStatus.ts @@ -31,7 +31,7 @@ const materialOk = (workOrder: WorkOrder): number => woHasMaterialStatus(workOrder, 'M12', 'M13', 'MN'); const materialAvailable = (workOrder: WorkOrder): number => - woHasMaterialStatus(workOrder, 'M7', 'M9', 'M10', 'M11', 'M12', 'MN'); + woHasMaterialStatus(workOrder, 'M07', 'M09', 'M10', 'M11', 'M12', 'MN'); /** * Function to retrieve "follow up" status of a package based on the package's projectProgress diff --git a/libs/workorderapp/src/lib/utils-statuses/material/getMatStatus.ts b/libs/workorderapp/src/lib/utils-statuses/material/getMatStatus.ts index 064064c88..47dbf2676 100644 --- a/libs/workorderapp/src/lib/utils-statuses/material/getMatStatus.ts +++ b/libs/workorderapp/src/lib/utils-statuses/material/getMatStatus.ts @@ -2,7 +2,7 @@ import { hasProperty } from '@cc-components/shared'; import { WorkOrder, materialPackageStatusMap } from '@cc-components/workordershared'; import { MappedMaterialStatus } from '@cc-components/workordershared'; -const DEFAULT_MAT_STATUS = materialPackageStatusMap.M4 as MappedMaterialStatus; +const DEFAULT_MAT_STATUS = materialPackageStatusMap.M04 as MappedMaterialStatus; export const getMatStatus = (workOrder: WorkOrder): MappedMaterialStatus => { if (!workOrder.materialStatus) { return DEFAULT_MAT_STATUS; diff --git a/libs/workordershared/src/lib/utils-statuses/material/material.ts b/libs/workordershared/src/lib/utils-statuses/material/material.ts index 8583f7d5f..e40a35cf1 100644 --- a/libs/workordershared/src/lib/utils-statuses/material/material.ts +++ b/libs/workordershared/src/lib/utils-statuses/material/material.ts @@ -8,16 +8,16 @@ export const materialColorMap: Record = { }; export const materialPackageStatusMap: Partial< Record -> = { - MN: 'OK', - M10: 'OK', - M11: 'OK', - M12: 'OK', - M5: 'AVAILABLE', - M6: 'AVAILABLE', - M7: 'AVAILABLE', - M9: 'AVAILABLE', - M2: 'NOT_AVAILABLE', - M3: 'NOT_AVAILABLE', - M4: 'NOT_AVAILABLE', + > = { + M02: 'NOT_AVAILABLE', + M03: 'NOT_AVAILABLE', + M04: 'NOT_AVAILABLE', + M05: 'AVAILABLE', + M06: 'AVAILABLE', + M07: 'AVAILABLE', + M09: 'AVAILABLE', + M10: 'OK', + M11: 'OK', + M12: 'OK', + MN: 'OK', };