forked from USEPA/haztrak
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
customize transporter information accordian button and rename title o…
…f transporter row action buttons to better reflect behavior and clean up
- Loading branch information
1 parent
36f86b7
commit 1f7af3b
Showing
8 changed files
with
144 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "haztrak", | ||
"version": "0.7.0", | ||
"version": "0.6.2", | ||
"private": true, | ||
"scripts": { | ||
"start": "vite", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
127 changes: 127 additions & 0 deletions
127
client/src/components/Manifest/Transporter/TransporterTable.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<Transporter>; | ||
arrayFieldMethods: UseFieldArrayReturn<Manifest, 'transporters', 'id'>; | ||
readOnly?: boolean; | ||
setupSign: (data: QuickerSignData) => void; | ||
} | ||
|
||
function CustomToggle({ eventKey }: any) { | ||
const [open, setOpen] = useState(false); | ||
const decoratedOnClick = useAccordionButton(eventKey, () => setOpen(!open)); | ||
|
||
return ( | ||
<Button | ||
onClick={decoratedOnClick} | ||
className="bg-transparent border-0 text-dark" | ||
title="more info" | ||
> | ||
<FontAwesomeIcon | ||
icon={faAngleRight} | ||
className={`sb-sidenav-collapse-arrow ${open ? 'rotate-90' : ''} `} | ||
/> | ||
</Button> | ||
); | ||
} | ||
|
||
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 ( | ||
<> | ||
<Accordion ref={parent}> | ||
{transporters.map((transporter, index) => { | ||
return ( | ||
<Card key={transporter.epaSiteId} className="py-2 px-4 my-2"> | ||
<Row className="d-flex justify-content-between"> | ||
<Col xs={8} className="d-flex align-items-center"> | ||
<div> | ||
<h5 className="d-inline border-3 me-3">{transporter.order} </h5> | ||
<span>{transporter.name}</span> | ||
</div> | ||
</Col> | ||
<Col xs={1}> | ||
{readOnly ? ( | ||
<QuickerSignModalBtn | ||
siteType={'Transporter'} | ||
mtnHandler={transporter} | ||
handleClick={setupSign} | ||
iconOnly={true} | ||
disabled={transporter.signed} | ||
/> | ||
) : transporter.signed ? ( | ||
<FontAwesomeIcon icon={faSignature} /> | ||
) : ( | ||
<></> | ||
)} | ||
</Col> | ||
<Col xs={1}> | ||
{readOnly || ( | ||
<TransporterRowActions | ||
removeTransporter={arrayFieldMethods.remove} | ||
swapTransporter={arrayFieldMethods.swap} | ||
index={index} | ||
length={transporters?.length} | ||
/> | ||
)} | ||
</Col> | ||
<Col xs={1}> | ||
<CustomToggle eventKey={transporter.epaSiteId}></CustomToggle> | ||
</Col> | ||
</Row> | ||
<Accordion.Collapse eventKey={transporter.epaSiteId}> | ||
<Card.Body> | ||
<Table> | ||
<thead> | ||
<tr> | ||
<th>EPA ID</th> | ||
<th>Phone</th> | ||
<th>Can e-Sign?</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr> | ||
<td>{transporter.epaSiteId}</td> | ||
<td>{transporter.contact.phone?.number}</td> | ||
<td className="text-success text-center"> | ||
{transporter ? <FontAwesomeIcon icon={faCheck} /> : 'no'} | ||
</td> | ||
</tr> | ||
</tbody> | ||
</Table> | ||
</Card.Body> | ||
</Accordion.Collapse> | ||
</Card> | ||
); | ||
})} | ||
</Accordion> | ||
</> | ||
); | ||
} | ||
|
||
export { TransporterTable }; |
95 changes: 0 additions & 95 deletions
95
client/src/components/Manifest/Transporter/TransporterTable/TransporterTable.tsx
This file was deleted.
Oops, something went wrong.
4 changes: 0 additions & 4 deletions
4
client/src/components/Manifest/Transporter/TransporterTable/index.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters