From 7b1b0cdf35d6478f3bbfad133a5b4273dce6a507 Mon Sep 17 00:00:00 2001 From: espenkalle Date: Mon, 11 Dec 2023 12:08:24 +0100 Subject: [PATCH 1/2] added mccr to mc sidesheet --- .../src/lib/types/index.ts | 1 + .../src/lib/types/mcMccr.ts | 53 +++++++++++++++++++ .../src/lib/ui-sidesheet/McSidesheet.tsx | 47 +++++++++++++++- .../src/lib/utils-sidesheet/useMcResource.ts | 5 +- 4 files changed, 103 insertions(+), 3 deletions(-) create mode 100644 libs/mechanicalcompletionsidesheet/src/lib/types/mcMccr.ts diff --git a/libs/mechanicalcompletionsidesheet/src/lib/types/index.ts b/libs/mechanicalcompletionsidesheet/src/lib/types/index.ts index bbf2e7c66..5ed8f65cb 100644 --- a/libs/mechanicalcompletionsidesheet/src/lib/types/index.ts +++ b/libs/mechanicalcompletionsidesheet/src/lib/types/index.ts @@ -1,3 +1,4 @@ export * from './mcNcr'; export * from './mcPunchItem'; export * from './mcWorkOrder'; +export * from './mcMccr'; diff --git a/libs/mechanicalcompletionsidesheet/src/lib/types/mcMccr.ts b/libs/mechanicalcompletionsidesheet/src/lib/types/mcMccr.ts new file mode 100644 index 000000000..3ea890708 --- /dev/null +++ b/libs/mechanicalcompletionsidesheet/src/lib/types/mcMccr.ts @@ -0,0 +1,53 @@ +export type McMccr = { + checklistID: string | null; + checklistUrlId: string | null; + facility: string | null; + project: string | null; + tagNo: string | null; + tagId: string | null; + tagUrlId: string | null; + formularType: string | null; + formularGroup: string | null; + formularDisciplineCode: string | null; + formularDiscipline: string | null; + pipingRevisionMechanicalCompletionPackageNo: string | null; + responsible: string | null; + status: string | null; + createdDate: string | null; + updatedDate: string | null; + signedDate: string | null; + verifiedDate: string | null; + famUpsertedTime: string | null; + callOffNo: string | null; + packageNo: string | null; + isVoided: string | null; + description: string | null; + register: string | null; + tagArea: string | null; + tagCategory: string | null; + mechanicalCompletionPackageNo: string | null; + mechanicalCompletionPackageId: string | null; + mechanicalCompletionStatus: string | null; + commissioningPackageNo: string | null; + commissioningPackageId: string | null; + woPlannedCompletionDate: string | null; + wOs: string | null; + hasWO: string | null; + handoverPlan: string | null; + woPlan: string | null; + pOplan: string | null; + countdownDiscipline: string | null; + mcPlan: string | null; + signingStatus: string | null; + m01ActualDate: string | null; + m02ActualDate: string | null; + projectDescription: string | null; + projectSchema: string | null; + mechanicalCompletionPhase: string | null; + mechanicalCompletionUrlId: string | null; + checklistUrl: string | null; + tagUrl: string | null; + commissioningPackageUrl: string | null; + mechanicalCompletionPackageUrl: string | null; + commissioningPackageUrlId: string | null; +}; diff --git a/libs/mechanicalcompletionsidesheet/src/lib/ui-sidesheet/McSidesheet.tsx b/libs/mechanicalcompletionsidesheet/src/lib/ui-sidesheet/McSidesheet.tsx index 18587fd7a..daf10d6f5 100644 --- a/libs/mechanicalcompletionsidesheet/src/lib/ui-sidesheet/McSidesheet.tsx +++ b/libs/mechanicalcompletionsidesheet/src/lib/ui-sidesheet/McSidesheet.tsx @@ -2,7 +2,7 @@ import { McPackage } from '@cc-components/mechanicalcompletionshared'; import { useContextId } from '@cc-components/shared'; import { StatusCircle, StyledItemLink } from '@cc-components/shared/common'; import { statusColorMap } from '@cc-components/shared/mapping'; -import { NcrTab, PunchTab, WorkorderTab } from '@cc-components/shared/sidesheet'; +import { MccrTab, NcrTab, PunchTab, WorkorderTab } from '@cc-components/shared/sidesheet'; import { BannerItem, SidesheetHeader, @@ -60,6 +60,12 @@ const McSideSheetComponent = (props: Required) => { error: ncrError, } = useMcResource(props.id, 'ncr'); + const { + data: mccrs, + isFetching: isFetchingMccr, + error: mccrError, + } = useMcResource(props.id, 'mccr'); + return ( ) => { NCR + + MCCR + @@ -154,6 +163,41 @@ const McSideSheetComponent = (props: Required) => { + + ({ + ...mccr, + commissioningPackageId: mccr.commissioningPackageId, + commissioningPackageUrl: mccr.commissioningPackageUrl, + commissioningPackageUrlId: mccr.commissioningPackageUrlId, + commpkgId: mccr.commissioningPackageId, + commpkgNumber: mccr.commissioningPackageNo, + description: mccr.description, + facility: mccr.facility, + mcPkgId: mccr.mechanicalCompletionPackageId, + mccrId: mccr.checklistID, + mccrResponsible: mccr.responsible, + mccrStatus: mccr.status, + mccrType: mccr.formularType, + mccrUrlId: mccr.checklistUrlId, + mcpkgNumber: mccr.mechanicalCompletionPackageNo, + mechanicalCompletionPackageUrl: mccr.mechanicalCompletionPackageUrl, + mechanicalCompletionPackageUrlId: mccr.mechanicalCompletionUrlId, + project: mccr.project, + tagId: mccr.tagId, + tagNumber: mccr.tagNo, + tagUrl: mccr.tagUrl, + tagUrlId: mccr.tagUrlId, + workOrderId: null, + workOrderUrl: null, + workOrderUrlId: null, + }) + )} + /> + @@ -162,6 +206,7 @@ const McSideSheetComponent = (props: Required) => { import { useHttpClient } from '@equinor/fusion-framework-react-app/http'; import { useQuery } from '@tanstack/react-query'; +import { MccrBase } from 'libs/shared/dist/src/packages/sidesheet/src/lib/sidesheet/tabs/mccr/types'; const EnsureMcPkg = ({ id, close, item }: McProps) => { const client = useHttpClient('cc-app'); diff --git a/libs/mechanicalcompletionsidesheet/src/lib/utils-sidesheet/useMcResource.ts b/libs/mechanicalcompletionsidesheet/src/lib/utils-sidesheet/useMcResource.ts index 2a3c143b0..868699964 100644 --- a/libs/mechanicalcompletionsidesheet/src/lib/utils-sidesheet/useMcResource.ts +++ b/libs/mechanicalcompletionsidesheet/src/lib/utils-sidesheet/useMcResource.ts @@ -1,13 +1,14 @@ import { useContextId, usePackageResource } from '@cc-components/shared/hooks'; import { useHttpClient } from '@equinor/fusion-framework-react-app/http'; +import { WorkorderBase } from 'libs/shared/dist/src'; import { PunchBase } from 'libs/shared/dist/src/packages/sidesheet/src/lib/sidesheet/tabs/punch/type'; import { useCallback } from 'react'; -import { McNcr, McWorkOrder } from '../types'; -import { WorkorderBase } from 'libs/shared/dist/src'; +import { McMccr, McNcr } from '../types'; type McResourceTypeMap = { ncr: McNcr; 'work-orders': WorkorderBase; punch: PunchBase; + mccr: McMccr; }; export const useMcResource = ( packageId: string, From 352588251ded4527f33d7f65d5b0381fd5a5ee6a Mon Sep 17 00:00:00 2001 From: espenkalle Date: Mon, 11 Dec 2023 13:09:03 +0100 Subject: [PATCH 2/2] resolve --- .../src/lib/utils-sidesheet/useMcResource.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/mechanicalcompletionsidesheet/src/lib/utils-sidesheet/useMcResource.ts b/libs/mechanicalcompletionsidesheet/src/lib/utils-sidesheet/useMcResource.ts index 868699964..e95ae0b6e 100644 --- a/libs/mechanicalcompletionsidesheet/src/lib/utils-sidesheet/useMcResource.ts +++ b/libs/mechanicalcompletionsidesheet/src/lib/utils-sidesheet/useMcResource.ts @@ -1,9 +1,9 @@ import { useContextId, usePackageResource } from '@cc-components/shared/hooks'; import { useHttpClient } from '@equinor/fusion-framework-react-app/http'; -import { WorkorderBase } from 'libs/shared/dist/src'; -import { PunchBase } from 'libs/shared/dist/src/packages/sidesheet/src/lib/sidesheet/tabs/punch/type'; import { useCallback } from 'react'; import { McMccr, McNcr } from '../types'; +import { PunchBase } from 'libs/shared/dist/src/packages/sidesheet/src/lib/sidesheet/tabs/punch/type'; +import { WorkorderBase } from 'libs/shared/dist/src/packages/sidesheet/src/lib/sidesheet/tabs/workorder/types'; type McResourceTypeMap = { ncr: McNcr; 'work-orders': WorkorderBase;