diff --git a/src/app/ProcosysRouter.tsx b/src/app/ProcosysRouter.tsx index 5ceb6ac15..380bf3c0c 100644 --- a/src/app/ProcosysRouter.tsx +++ b/src/app/ProcosysRouter.tsx @@ -21,7 +21,7 @@ const UserGreeting = React.lazy(() => import('./../modules/UserGreeting')); const Preservation = React.lazy(() => import('./../modules/Preservation')); const PlantConfig = React.lazy(() => import('./../modules/PlantConfig')); const InvitationForPunchOut = React.lazy( - () => import('./../modules/InvitationForPunchOut') + () => import('../modules/InvitationForPunchOut/InvitationForPunchOut') ); const Page404 = (): JSX.Element => { diff --git a/src/modules/InvitationForPunchOut/index.tsx b/src/modules/InvitationForPunchOut/InvitationForPunchOut.tsx similarity index 98% rename from src/modules/InvitationForPunchOut/index.tsx rename to src/modules/InvitationForPunchOut/InvitationForPunchOut.tsx index d4073130b..205e0d39d 100644 --- a/src/modules/InvitationForPunchOut/index.tsx +++ b/src/modules/InvitationForPunchOut/InvitationForPunchOut.tsx @@ -11,7 +11,7 @@ import CreateIPO from './views/CreateAndEditIPO/CreateIPO'; import EditIPO from './views/CreateAndEditIPO/EditIPO'; import { Helmet } from 'react-helmet'; import { InvitationForPunchOutContextProvider } from './context/InvitationForPunchOutContext'; -import SearchIPO from './views/SearchIPO'; +import SearchIPO from './views/SearchIPO/SearchIpo'; import ViewIPO from './views/ViewIPO/ViewIPO'; import withAccessControl from '@procosys/core/security/withAccessControl'; diff --git a/src/modules/InvitationForPunchOut/http/InvitationForPunchOutApiClient.ts b/src/modules/InvitationForPunchOut/http/InvitationForPunchOutApiClient.ts index b2078ac58..02e799620 100644 --- a/src/modules/InvitationForPunchOut/http/InvitationForPunchOutApiClient.ts +++ b/src/modules/InvitationForPunchOut/http/InvitationForPunchOutApiClient.ts @@ -5,6 +5,7 @@ import { ProCoSysApiError } from '../../../core/ProCoSysApiError'; import ProCoSysSettings from '../../../core/ProCoSysSettings'; import Qs from 'qs'; import { RequestCanceler } from '../../../http/HttpClient'; +import { IpoStatusEnum } from '../views/enums'; export class IpoApiError extends ProCoSysApiError { constructor(error: AxiosError) { @@ -183,7 +184,7 @@ interface FunctionalRoleResponse { interface IPO { id: number; title: string; - status: string; + status: IpoStatusEnum; type: string; createdAtUtc: Date; startTimeUtc: Date; diff --git a/src/modules/InvitationForPunchOut/views/SearchIPO/Filter/CheckboxFilterWithDates/index.tsx b/src/modules/InvitationForPunchOut/views/SearchIPO/Filter/CheckboxFilterWithDates/CheckboxFilterWithDates.tsx similarity index 99% rename from src/modules/InvitationForPunchOut/views/SearchIPO/Filter/CheckboxFilterWithDates/index.tsx rename to src/modules/InvitationForPunchOut/views/SearchIPO/Filter/CheckboxFilterWithDates/CheckboxFilterWithDates.tsx index 622d905bb..066f66860 100644 --- a/src/modules/InvitationForPunchOut/views/SearchIPO/Filter/CheckboxFilterWithDates/index.tsx +++ b/src/modules/InvitationForPunchOut/views/SearchIPO/Filter/CheckboxFilterWithDates/CheckboxFilterWithDates.tsx @@ -2,7 +2,7 @@ import { CheckboxFilterValue, dateFilterParamType, filterParamType, -} from '../index'; +} from '../InvitationsFilter'; import { CheckboxSection, DateField, DatesContainer } from './index.style'; import { Collapse, CollapseInfo } from '../index.style'; import React, { ChangeEvent, useState } from 'react'; diff --git a/src/modules/InvitationForPunchOut/views/SearchIPO/Filter/CheckboxFilterWithDates/__tests__/CheckboxFilterWithDates.test.jsx b/src/modules/InvitationForPunchOut/views/SearchIPO/Filter/CheckboxFilterWithDates/__tests__/CheckboxFilterWithDates.test.jsx index 8f1567655..bd2ede3e1 100644 --- a/src/modules/InvitationForPunchOut/views/SearchIPO/Filter/CheckboxFilterWithDates/__tests__/CheckboxFilterWithDates.test.jsx +++ b/src/modules/InvitationForPunchOut/views/SearchIPO/Filter/CheckboxFilterWithDates/__tests__/CheckboxFilterWithDates.test.jsx @@ -1,6 +1,6 @@ import { fireEvent, render } from '@testing-library/react'; -import CheckboxFilterWithDates from '../index'; +import CheckboxFilterWithDates from '../CheckboxFilterWithDates'; import React from 'react'; const checkboxItems = [ diff --git a/src/modules/InvitationForPunchOut/views/SearchIPO/Filter/index.tsx b/src/modules/InvitationForPunchOut/views/SearchIPO/Filter/InvitationsFilter.tsx similarity index 98% rename from src/modules/InvitationForPunchOut/views/SearchIPO/Filter/index.tsx rename to src/modules/InvitationForPunchOut/views/SearchIPO/Filter/InvitationsFilter.tsx index 2afdb60ae..e22a83c86 100644 --- a/src/modules/InvitationForPunchOut/views/SearchIPO/Filter/index.tsx +++ b/src/modules/InvitationForPunchOut/views/SearchIPO/Filter/InvitationsFilter.tsx @@ -10,11 +10,11 @@ import { import { IPOFilter, ProjectDetails, SavedIPOFilter } from '../types'; import React, { useEffect, useRef, useState } from 'react'; -import CheckboxFilterWithDates from './CheckboxFilterWithDates'; +import CheckboxFilterWithDates from './CheckboxFilterWithDates/CheckboxFilterWithDates'; import EdsIcon from '@procosys/components/EdsIcon'; import { IpoStatusEnum } from '../../enums'; import SavedFilters from './SavedFilters'; -import SelectFilter from './SelectFilter'; +import SelectFilter from './SelectFilter/SelectFilter'; import { SelectItem } from '@procosys/components/Select'; import { isValidDate } from '@procosys/core/services/DateService'; import { @@ -93,6 +93,10 @@ const ipoStatuses: FilterInput[] = [ id: IpoStatusEnum.ACCEPTED, title: 'Accepted', }, + { + id: IpoStatusEnum.SCOPEHANDEDOVER, + title: 'Scope Handed Over', + }, ]; const punchOutDateFields: FilterInput[] = [ diff --git a/src/modules/InvitationForPunchOut/views/SearchIPO/Filter/PersonSelector/index.tsx b/src/modules/InvitationForPunchOut/views/SearchIPO/Filter/PersonSelector/PersonSelector.tsx similarity index 98% rename from src/modules/InvitationForPunchOut/views/SearchIPO/Filter/PersonSelector/index.tsx rename to src/modules/InvitationForPunchOut/views/SearchIPO/Filter/PersonSelector/PersonSelector.tsx index 094b1a04a..44e1547c3 100644 --- a/src/modules/InvitationForPunchOut/views/SearchIPO/Filter/PersonSelector/index.tsx +++ b/src/modules/InvitationForPunchOut/views/SearchIPO/Filter/PersonSelector/PersonSelector.tsx @@ -6,7 +6,7 @@ import Dropdown from '@procosys/components/Dropdown'; import EdsIcon from '@procosys/components/EdsIcon'; import { SelectItem } from '@procosys/components/Select'; import Spinner from '@procosys/components/Spinner'; -import { rolePersonParamType } from '..'; +import { rolePersonParamType } from '../InvitationsFilter'; import { showSnackbarNotification } from '@procosys/core/services/NotificationService'; import { useInvitationForPunchOutContext } from '@procosys/modules/InvitationForPunchOut/context/InvitationForPunchOutContext'; diff --git a/src/modules/InvitationForPunchOut/views/SearchIPO/Filter/PersonSelector/__tests__/PersonSelector.test.jsx b/src/modules/InvitationForPunchOut/views/SearchIPO/Filter/PersonSelector/__tests__/PersonSelector.test.jsx index 25c5da83a..35c5aa682 100644 --- a/src/modules/InvitationForPunchOut/views/SearchIPO/Filter/PersonSelector/__tests__/PersonSelector.test.jsx +++ b/src/modules/InvitationForPunchOut/views/SearchIPO/Filter/PersonSelector/__tests__/PersonSelector.test.jsx @@ -1,4 +1,4 @@ -import PersonSelector from '../index'; +import PersonSelector from '../PersonSelector'; import React from 'react'; import { render } from '@testing-library/react'; diff --git a/src/modules/InvitationForPunchOut/views/SearchIPO/Filter/RoleSelector/index.style.tsx b/src/modules/InvitationForPunchOut/views/SearchIPO/Filter/RoleSelector/RoleSelector.style.tsx similarity index 100% rename from src/modules/InvitationForPunchOut/views/SearchIPO/Filter/RoleSelector/index.style.tsx rename to src/modules/InvitationForPunchOut/views/SearchIPO/Filter/RoleSelector/RoleSelector.style.tsx diff --git a/src/modules/InvitationForPunchOut/views/SearchIPO/Filter/RoleSelector/index.tsx b/src/modules/InvitationForPunchOut/views/SearchIPO/Filter/RoleSelector/RoleSelector.tsx similarity index 95% rename from src/modules/InvitationForPunchOut/views/SearchIPO/Filter/RoleSelector/index.tsx rename to src/modules/InvitationForPunchOut/views/SearchIPO/Filter/RoleSelector/RoleSelector.tsx index d38c2fe6b..04ba7bb1c 100644 --- a/src/modules/InvitationForPunchOut/views/SearchIPO/Filter/RoleSelector/index.tsx +++ b/src/modules/InvitationForPunchOut/views/SearchIPO/Filter/RoleSelector/RoleSelector.tsx @@ -1,11 +1,11 @@ -import { Container, DropdownItem } from './index.style'; +import { Container, DropdownItem } from './RoleSelector.style'; import React, { useEffect, useState } from 'react'; import Dropdown from '@procosys/components/Dropdown'; import EdsIcon from '@procosys/components/EdsIcon'; import { SelectItem } from '@procosys/components/Select'; import Spinner from '@procosys/components/Spinner'; -import { rolePersonParamType } from '..'; +import { rolePersonParamType } from '../InvitationsFilter'; interface RoleSelectorProps { functionalRoleCode: string; diff --git a/src/modules/InvitationForPunchOut/views/SearchIPO/Filter/RoleSelector/__tests__/RoleSelector.test.jsx b/src/modules/InvitationForPunchOut/views/SearchIPO/Filter/RoleSelector/__tests__/RoleSelector.test.jsx index b54496559..607b982d3 100644 --- a/src/modules/InvitationForPunchOut/views/SearchIPO/Filter/RoleSelector/__tests__/RoleSelector.test.jsx +++ b/src/modules/InvitationForPunchOut/views/SearchIPO/Filter/RoleSelector/__tests__/RoleSelector.test.jsx @@ -1,5 +1,5 @@ import React from 'react'; -import RoleSelector from '../index'; +import RoleSelector from '../RoleSelector'; import { render } from '@testing-library/react'; const roles = [ diff --git a/src/modules/InvitationForPunchOut/views/SearchIPO/Filter/SelectFilter/index.style.tsx b/src/modules/InvitationForPunchOut/views/SearchIPO/Filter/SelectFilter/SelectFilter.style.tsx similarity index 100% rename from src/modules/InvitationForPunchOut/views/SearchIPO/Filter/SelectFilter/index.style.tsx rename to src/modules/InvitationForPunchOut/views/SearchIPO/Filter/SelectFilter/SelectFilter.style.tsx diff --git a/src/modules/InvitationForPunchOut/views/SearchIPO/Filter/SelectFilter/index.tsx b/src/modules/InvitationForPunchOut/views/SearchIPO/Filter/SelectFilter/SelectFilter.tsx similarity index 87% rename from src/modules/InvitationForPunchOut/views/SearchIPO/Filter/SelectFilter/index.tsx rename to src/modules/InvitationForPunchOut/views/SearchIPO/Filter/SelectFilter/SelectFilter.tsx index 600984c94..2eda065d1 100644 --- a/src/modules/InvitationForPunchOut/views/SearchIPO/Filter/SelectFilter/index.tsx +++ b/src/modules/InvitationForPunchOut/views/SearchIPO/Filter/SelectFilter/SelectFilter.tsx @@ -1,10 +1,10 @@ import { Collapse, CollapseInfo } from '../index.style'; import React, { useState } from 'react'; -import { FilterContainer } from './index.style'; -import PersonSelector from '../PersonSelector'; -import RoleSelector from '../RoleSelector'; +import { FilterContainer } from './SelectFilter.style'; +import PersonSelector from '../PersonSelector/PersonSelector'; +import RoleSelector from '../RoleSelector/RoleSelector'; import { SelectItem } from '@procosys/components/Select'; -import { rolePersonParamType } from '..'; +import { rolePersonParamType } from '../InvitationsFilter'; import { KeyboardArrowUp, KeyboardArrowDown } from '@mui/icons-material'; type SelectProps = { diff --git a/src/modules/InvitationForPunchOut/views/SearchIPO/Filter/SelectFilter/__tests__/SelectFilter.test.jsx b/src/modules/InvitationForPunchOut/views/SearchIPO/Filter/SelectFilter/__tests__/SelectFilter.test.jsx index 907c361ef..b383d4888 100644 --- a/src/modules/InvitationForPunchOut/views/SearchIPO/Filter/SelectFilter/__tests__/SelectFilter.test.jsx +++ b/src/modules/InvitationForPunchOut/views/SearchIPO/Filter/SelectFilter/__tests__/SelectFilter.test.jsx @@ -2,7 +2,7 @@ import { fireEvent, render } from '@testing-library/react'; import EdsIcon from '@procosys/components/EdsIcon'; import React from 'react'; -import SelectFilter from '../index'; +import SelectFilter from '../SelectFilter'; const roles = [ { diff --git a/src/modules/InvitationForPunchOut/views/SearchIPO/Filter/__tests__/Filter.test.jsx b/src/modules/InvitationForPunchOut/views/SearchIPO/Filter/__tests__/Filter.test.jsx index bcbeec7df..dfa32dfc6 100644 --- a/src/modules/InvitationForPunchOut/views/SearchIPO/Filter/__tests__/Filter.test.jsx +++ b/src/modules/InvitationForPunchOut/views/SearchIPO/Filter/__tests__/Filter.test.jsx @@ -1,6 +1,6 @@ import { fireEvent, render } from '@testing-library/react'; -import InvitationsFilter from '../index'; +import InvitationsFilter from '../InvitationsFilter'; import React from 'react'; const emptyFilter = { diff --git a/src/modules/InvitationForPunchOut/views/SearchIPO/index.style.tsx b/src/modules/InvitationForPunchOut/views/SearchIPO/SearchIpo.style.tsx similarity index 100% rename from src/modules/InvitationForPunchOut/views/SearchIPO/index.style.tsx rename to src/modules/InvitationForPunchOut/views/SearchIPO/SearchIpo.style.tsx diff --git a/src/modules/InvitationForPunchOut/views/SearchIPO/index.tsx b/src/modules/InvitationForPunchOut/views/SearchIPO/SearchIpo.tsx similarity index 99% rename from src/modules/InvitationForPunchOut/views/SearchIPO/index.tsx rename to src/modules/InvitationForPunchOut/views/SearchIPO/SearchIpo.tsx index 64191e671..dd5d819b8 100644 --- a/src/modules/InvitationForPunchOut/views/SearchIPO/index.tsx +++ b/src/modules/InvitationForPunchOut/views/SearchIPO/SearchIpo.tsx @@ -10,15 +10,15 @@ import { LeftPartOfHeader, StyledButton, TooltipText, -} from './index.style'; +} from './SearchIpo.style'; import { IPOFilter, IPOs, SavedIPOFilter } from './types'; import React, { useEffect, useReducer, useRef, useState } from 'react'; import { Canceler } from 'axios'; import Dropdown from '@procosys/components/Dropdown'; import EdsIcon from '@procosys/components/EdsIcon'; -import InvitationsFilter from './Filter'; -import InvitationsTable from './Table'; +import InvitationsFilter from './Filter/InvitationsFilter'; +import InvitationsTable from './Table/InvitationsTable'; import { Link } from 'react-router-dom'; import { ProjectDetails } from '@procosys/modules/InvitationForPunchOut/types'; import { SelectItem } from '@procosys/components/Select'; diff --git a/src/modules/InvitationForPunchOut/views/SearchIPO/Table/index.style.tsx b/src/modules/InvitationForPunchOut/views/SearchIPO/Table/InvitationsTable.style.tsx similarity index 100% rename from src/modules/InvitationForPunchOut/views/SearchIPO/Table/index.style.tsx rename to src/modules/InvitationForPunchOut/views/SearchIPO/Table/InvitationsTable.style.tsx diff --git a/src/modules/InvitationForPunchOut/views/SearchIPO/Table/index.tsx b/src/modules/InvitationForPunchOut/views/SearchIPO/Table/InvitationsTable.tsx similarity index 98% rename from src/modules/InvitationForPunchOut/views/SearchIPO/Table/index.tsx rename to src/modules/InvitationForPunchOut/views/SearchIPO/Table/InvitationsTable.tsx index 004669f9d..3d5e3aafc 100644 --- a/src/modules/InvitationForPunchOut/views/SearchIPO/Table/index.tsx +++ b/src/modules/InvitationForPunchOut/views/SearchIPO/Table/InvitationsTable.tsx @@ -1,4 +1,4 @@ -import { Container, CustomLink } from './index.style'; +import { Container, CustomLink } from './InvitationsTable.style'; import React, { useEffect, useState } from 'react'; import { IPO } from '../types'; import { Typography } from '@equinor/eds-core-react'; @@ -6,6 +6,7 @@ import { getFormattedDate } from '@procosys/core/services/DateService'; import { Query, TableOptions, UseTableRowProps } from 'react-table'; import ProcosysTable, { TableSorting } from '@procosys/components/Table'; import { Tooltip } from '@mui/material'; +import { IpoStatusEnum } from '../../enums'; interface InvitationsTableProps { getIPOs: ( @@ -336,7 +337,9 @@ const InvitationsTable = ({ Header: 'Status', id: 'status', accessor: (d: IPO): string | undefined => { - return d.status; + if (d.status == IpoStatusEnum.SCOPEHANDEDOVER) + return 'Scope handed over'; + else return d.status; }, Cell: (rowData: TableOptions): JSX.Element => { return {rowData.row.values.status}; diff --git a/src/modules/InvitationForPunchOut/views/SearchIPO/Table/__tests__/Table.test.jsx b/src/modules/InvitationForPunchOut/views/SearchIPO/Table/__tests__/Table.test.jsx index b55b34012..fe15183d5 100644 --- a/src/modules/InvitationForPunchOut/views/SearchIPO/Table/__tests__/Table.test.jsx +++ b/src/modules/InvitationForPunchOut/views/SearchIPO/Table/__tests__/Table.test.jsx @@ -1,4 +1,4 @@ -import InvitationsTable from '../index'; +import InvitationsTable from '../InvitationsTable'; import React from 'react'; import { render, waitFor } from '@testing-library/react'; diff --git a/src/modules/InvitationForPunchOut/views/SearchIPO/__tests__/SearchIPO.test.jsx b/src/modules/InvitationForPunchOut/views/SearchIPO/__tests__/SearchIPO.test.jsx index c9d13f798..3125ca3b1 100644 --- a/src/modules/InvitationForPunchOut/views/SearchIPO/__tests__/SearchIPO.test.jsx +++ b/src/modules/InvitationForPunchOut/views/SearchIPO/__tests__/SearchIPO.test.jsx @@ -1,7 +1,7 @@ import { render, waitFor } from '@testing-library/react'; import React from 'react'; -import SearchIPO from '../../SearchIPO'; +import SearchIPO from '../SearchIpo'; import { createMemoryHistory } from 'history'; import { Router } from 'react-router'; diff --git a/src/modules/InvitationForPunchOut/views/SearchIPO/types.d.ts b/src/modules/InvitationForPunchOut/views/SearchIPO/types.d.ts index 03bdf7cb9..2d86c910b 100644 --- a/src/modules/InvitationForPunchOut/views/SearchIPO/types.d.ts +++ b/src/modules/InvitationForPunchOut/views/SearchIPO/types.d.ts @@ -1,7 +1,9 @@ +import { IpoStatusEnum } from '../enums'; + export interface IPO { id: number; title: string; - status: string; + status: IpoStatusEnum; type: string; createdAtUtc: Date; startTimeUtc: Date; diff --git a/src/modules/InvitationForPunchOut/views/ViewIPO/ViewIPO.tsx b/src/modules/InvitationForPunchOut/views/ViewIPO/ViewIPO.tsx index 8911e26d5..603bce999 100644 --- a/src/modules/InvitationForPunchOut/views/ViewIPO/ViewIPO.tsx +++ b/src/modules/InvitationForPunchOut/views/ViewIPO/ViewIPO.tsx @@ -49,11 +49,17 @@ const stepsWhenCanceled: Step[] = [ { title: 'Punch-out is canceled', isCompleted: true }, ]; +const stepsWhenHandedOver: Step[] = [ + { title: 'Invitation for punch-out sent', isCompleted: true }, + { title: 'Punch-out scope handed over', isCompleted: true }, +]; + enum StepsEnum { Planned = 1, Completed = 2, Accepted = 3, Canceled = 4, + ScopeHandedOver = 5, } const ipoHeaderSize = 136; @@ -143,6 +149,10 @@ const ViewIPO = (): JSX.Element => { setSteps(stepsWhenCanceled); setCurrentStep(StepsEnum.Canceled + 1); break; + case StepsEnum[5]: + setSteps(stepsWhenHandedOver); + setCurrentStep(StepsEnum.ScopeHandedOver + 1); + break; default: setCurrentStep(StepsEnum.Planned + 1); } @@ -525,6 +535,10 @@ const ViewIPO = (): JSX.Element => { canDelete={ invitation.canDelete || (invitation.status === IpoStatusEnum.CANCELED && + isAdmin && + isUsingAdminRights) || + (invitation.status === + IpoStatusEnum.SCOPEHANDEDOVER && isAdmin && isUsingAdminRights) } diff --git a/src/modules/InvitationForPunchOut/views/enums.ts b/src/modules/InvitationForPunchOut/views/enums.ts index 09231a899..a344572c4 100644 --- a/src/modules/InvitationForPunchOut/views/enums.ts +++ b/src/modules/InvitationForPunchOut/views/enums.ts @@ -21,6 +21,7 @@ export enum IpoStatusEnum { PLANNED = 'Planned', COMPLETED = 'Completed', ACCEPTED = 'Accepted', + SCOPEHANDEDOVER = 'ScopeHandedOver', CANCELED = 'Canceled', }