Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added mccr to mc sidesheet #764

Merged
merged 2 commits into from
Dec 12, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from './mcNcr';
export * from './mcPunchItem';
export * from './mcWorkOrder';
export * from './mcMccr';
53 changes: 53 additions & 0 deletions libs/mechanicalcompletionsidesheet/src/lib/types/mcMccr.ts
Original file line number Diff line number Diff line change
@@ -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;
};
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -60,6 +60,12 @@ const McSideSheetComponent = (props: Required<McProps>) => {
error: ncrError,
} = useMcResource(props.id, 'ncr');

const {
data: mccrs,
isFetching: isFetchingMccr,
error: mccrError,
} = useMcResource(props.id, 'mccr');

return (
<StyledSideSheetContainer>
<SidesheetHeader
Expand Down Expand Up @@ -130,6 +136,9 @@ const McSideSheetComponent = (props: Required<McProps>) => {
<Tabs.Tab>
NCR <TabTitle data={ncr} isLoading={isFetchingNcr} />
</Tabs.Tab>
<Tabs.Tab>
MCCR <TabTitle data={mccrs} isLoading={isFetchingMccr} />
</Tabs.Tab>
</Tabs.List>
</StyledTabListWrapper>

Expand All @@ -154,6 +163,41 @@ const McSideSheetComponent = (props: Required<McProps>) => {
<Tabs.Panel>
<NcrTab error={ncrError} isFetching={isFetchingNcr} ncrs={ncr} />
</Tabs.Panel>
<Tabs.Panel>
<MccrTab
error={mccrError}
isFetching={isFetchingMccr}
mccr={(mccrs ?? []).map(
(mccr): MccrBase => ({
...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,
})
)}
/>
</Tabs.Panel>
</StyledPanels>
</StyledTabs>
</StyledSideSheetContainer>
Expand All @@ -162,6 +206,7 @@ const McSideSheetComponent = (props: Required<McProps>) => {

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';
espenkalle marked this conversation as resolved.
Show resolved Hide resolved

const EnsureMcPkg = ({ id, close, item }: McProps) => {
const client = useHttpClient('cc-app');
Expand Down
Original file line number Diff line number Diff line change
@@ -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';
espenkalle marked this conversation as resolved.
Show resolved Hide resolved
import { PunchBase } from 'libs/shared/dist/src/packages/sidesheet/src/lib/sidesheet/tabs/punch/type';
espenkalle marked this conversation as resolved.
Show resolved Hide resolved
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 = <T extends keyof McResourceTypeMap>(
packageId: string,
Expand Down
Loading