diff --git a/client/package.json b/client/package.json index c0c79d8fe..8d1e03674 100644 --- a/client/package.json +++ b/client/package.json @@ -1,6 +1,6 @@ { "name": "haztrak", - "version": "0.7.0", + "version": "0.6.2", "private": true, "scripts": { "start": "vite", diff --git a/client/src/App.scss b/client/src/App.scss index a6ba0b54e..f3867153e 100644 --- a/client/src/App.scss +++ b/client/src/App.scss @@ -88,6 +88,10 @@ $info: #009999; transform: rotate(-90deg); } +.rotate-90 { + transform: rotate(90deg); +} + .app-container { min-height: 350px; } diff --git a/client/src/components/Manifest/Transporter/TransporterTable/TransporterRowActions.tsx b/client/src/components/Manifest/Transporter/TransporterRowActions.tsx similarity index 98% rename from client/src/components/Manifest/Transporter/TransporterTable/TransporterRowActions.tsx rename to client/src/components/Manifest/Transporter/TransporterRowActions.tsx index 0ac514aad..e790858f6 100644 --- a/client/src/components/Manifest/Transporter/TransporterTable/TransporterRowActions.tsx +++ b/client/src/components/Manifest/Transporter/TransporterRowActions.tsx @@ -79,7 +79,7 @@ function TransporterRowActions({ <> diff --git a/client/src/components/Manifest/Transporter/TransporterTable/TransporterTable.spec.tsx b/client/src/components/Manifest/Transporter/TransporterTable.spec.tsx similarity index 95% rename from client/src/components/Manifest/Transporter/TransporterTable/TransporterTable.spec.tsx rename to client/src/components/Manifest/Transporter/TransporterTable.spec.tsx index 23774f540..aead09e6d 100644 --- a/client/src/components/Manifest/Transporter/TransporterTable/TransporterTable.spec.tsx +++ b/client/src/components/Manifest/Transporter/TransporterTable.spec.tsx @@ -52,7 +52,7 @@ describe('TransporterTable', () => { {} ); const actionDropdown = await screen.findAllByRole('button', { - name: /transporter action [0-9]/, + name: /transporter [0-9] actions/, }); expect(actionDropdown).length(2); }); @@ -69,7 +69,7 @@ describe('TransporterTable', () => { {} ); const actionDropdown = screen.queryAllByRole('button', { - name: /transporter action [0-9]/, + name: /transporter [0-9] actions/, }); expect(actionDropdown).length(0); }); @@ -85,7 +85,7 @@ describe('TransporterTable', () => { {} ); const actionDropdowns = await screen.findAllByRole('button', { - name: /transporter action [0-9]/, + name: /transporter [0-9] actions/, }); for (let i = 1; i < TRAN_ARRAY.length; i++) { await userEvent.click(actionDropdowns[i]); @@ -104,7 +104,7 @@ describe('TransporterTable', () => { {} ); const actionDropdowns = await screen.findAllByRole('button', { - name: /transporter action [0-9]/, + name: /transporter [0-9] actions/, }); for (let i = 0; i < TRAN_ARRAY.length; i++) { await userEvent.click(actionDropdowns[i]); diff --git a/client/src/components/Manifest/Transporter/TransporterTable.tsx b/client/src/components/Manifest/Transporter/TransporterTable.tsx new file mode 100644 index 000000000..d2e8007a6 --- /dev/null +++ b/client/src/components/Manifest/Transporter/TransporterTable.tsx @@ -0,0 +1,127 @@ +import { useAutoAnimate } from '@formkit/auto-animate/react'; +import { faAngleRight, faCheck, faSignature } from '@fortawesome/free-solid-svg-icons'; +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; +import { Transporter } from 'components/Manifest'; +import { Manifest } from 'components/Manifest/manifestSchema'; +import { QuickerSignData, QuickerSignModalBtn } from 'components/Manifest/QuickerSign'; +import React, { useState } from 'react'; +import { Accordion, Button, Card, Col, Row, Table, useAccordionButton } from 'react-bootstrap'; +import { UseFieldArrayReturn } from 'react-hook-form'; +import { TransporterRowActions } from './TransporterRowActions'; + +interface TransporterTableProps { + transporters?: Array; + arrayFieldMethods: UseFieldArrayReturn; + readOnly?: boolean; + setupSign: (data: QuickerSignData) => void; +} + +function CustomToggle({ eventKey }: any) { + const [open, setOpen] = useState(false); + const decoratedOnClick = useAccordionButton(eventKey, () => setOpen(!open)); + + return ( + + ); +} + +function TransporterTable({ + transporters, + arrayFieldMethods, + readOnly, + setupSign, +}: TransporterTableProps) { + const [parent] = useAutoAnimate(); + + if (!transporters || transporters.length < 1) { + return <>; + } + + if (transporters) { + for (let i = 0; i < transporters?.length; i++) { + transporters[i].order = i + 1; + } + } + + return ( + <> + + {transporters.map((transporter, index) => { + return ( + + + +
+
{transporter.order}
+ {transporter.name} +
+ + + {readOnly ? ( + + ) : transporter.signed ? ( + + ) : ( + <> + )} + + + {readOnly || ( + + )} + + + + +
+ + + + + + + + + + + + + + + + + +
EPA IDPhoneCan e-Sign?
{transporter.epaSiteId}{transporter.contact.phone?.number} + {transporter ? : 'no'} +
+
+
+
+ ); + })} +
+ + ); +} + +export { TransporterTable }; diff --git a/client/src/components/Manifest/Transporter/TransporterTable/TransporterTable.tsx b/client/src/components/Manifest/Transporter/TransporterTable/TransporterTable.tsx deleted file mode 100644 index ec1afa0d9..000000000 --- a/client/src/components/Manifest/Transporter/TransporterTable/TransporterTable.tsx +++ /dev/null @@ -1,95 +0,0 @@ -import { useAutoAnimate } from '@formkit/auto-animate/react'; -import { Transporter } from 'components/Manifest'; -import { Manifest } from 'components/Manifest/manifestSchema'; -import { QuickerSignData, QuickerSignModalBtn } from 'components/Manifest/QuickerSign'; -import { TransporterRowActions } from 'components/Manifest/Transporter/TransporterTable/TransporterRowActions'; -import React from 'react'; -import { Accordion, AccordionButton, Card, Col, Row, useAccordionButton } from 'react-bootstrap'; -import { UseFieldArrayReturn } from 'react-hook-form'; - -interface TransporterTableProps { - transporters?: Array; - arrayFieldMethods: UseFieldArrayReturn; - readOnly?: boolean; - setupSign: (data: QuickerSignData) => void; -} - -function CustomToggle({ children, eventKey }: any) { - const decoratedOnClick = useAccordionButton(eventKey); - - return ( - // -
- -
- ); -} - -function TransporterTable({ - transporters, - arrayFieldMethods, - readOnly, - setupSign, -}: TransporterTableProps) { - const [parent, enableAnimations] = useAutoAnimate(); - - if (!transporters || transporters.length < 1) { - return <>; - } - - if (transporters) { - for (let i = 0; i < transporters?.length; i++) { - transporters[i].order = i + 1; - } - } - - return ( - <> - - {transporters.map((transporter, index) => { - return ( - - - -
{transporter.order}
- {transporter.name} - {transporter.epaSiteId} - - - {readOnly ? ( - - ) : ( - <> - - - )} - - - - -
- - Hello! I'm the body - -
- ); - })} -
- - ); -} - -export { TransporterTable }; diff --git a/client/src/components/Manifest/Transporter/TransporterTable/index.ts b/client/src/components/Manifest/Transporter/TransporterTable/index.ts deleted file mode 100644 index 0e983b6dd..000000000 --- a/client/src/components/Manifest/Transporter/TransporterTable/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { TransporterTable } from './TransporterTable'; -import { TransporterRowActions } from './TransporterRowActions'; - -export { TransporterTable, TransporterRowActions }; diff --git a/client/src/components/Manifest/UpdateRcra/UpdateRcra.tsx b/client/src/components/Manifest/UpdateRcra/UpdateRcra.tsx index 846a52179..3dd6a4be8 100644 --- a/client/src/components/Manifest/UpdateRcra/UpdateRcra.tsx +++ b/client/src/components/Manifest/UpdateRcra/UpdateRcra.tsx @@ -8,6 +8,13 @@ interface UpdateRcraProps { taskId: string; } +/** + * UpdateRcra is a component that will poll the server for the status of an asynchronous task and + * display that status to the user. If the task is successful, the user will be redirected to the + * manifest view page. + * @param taskId + * @constructor + */ export function UpdateRcra({ taskId }: UpdateRcraProps) { const [showToast, setShowToast] = React.useState(true);