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

refactor #175 #180

Merged
merged 2 commits into from
Mar 8, 2023
Merged
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
35 changes: 16 additions & 19 deletions src/compounds/Document/Document.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ import PropTypes from 'prop-types'
import { Dropdown, Offcanvas } from 'react-bootstrap'
import LineItemsTable from '../../components/LineItemsTable/LineItemsTable'
import './document.scss'
import { allowNull } from '../../resources/utilityFunctions'

const Document = ({ document, addClass }) => {
const { adPO, date, documentStatusColor, documentType,
documentTypeColor, documentStatus, identifier, lineItems, poNumber, relatedSOWIdentifier, requestIdentifier,
shippingPrice, shipTo, shipFrom, subtotalPrice,
taxAmount, terms, totalPrice, turnaroundTime } = document
const {
adPO, date, documentStatusColor, documentType, documentTypeColor, documentStatus, identifier, lineItems, poNumber,
relatedSOWIdentifier, requestIdentifier, shippingPrice, shipTo, shipFrom, subtotalPrice, taxAmount, terms, totalPrice,
turnaroundTime,
} = document
const [show, setShow] = useState(false)
const handleClose = () => setShow(false)
const handleShow = () => setShow(true)
Expand Down Expand Up @@ -76,16 +76,13 @@ const Document = ({ document, addClass }) => {
<div className='address'>{shipFrom.text}</div>
</div>
</div>
{lineItems
&& (
<LineItemsTable
lineItems={lineItems}
subtotalPrice={subtotalPrice}
taxAmount={taxAmount}
shippingPrice={shippingPrice}
totalPrice={totalPrice}
/>
)}
<LineItemsTable
lineItems={lineItems}
subtotalPrice={subtotalPrice}
taxAmount={taxAmount}
shippingPrice={shippingPrice}
totalPrice={totalPrice}
/>
{turnaroundTime && <h5><b>Turnaround Time:</b> {turnaroundTime}</h5>}
</Offcanvas.Body>
</Offcanvas>
Expand All @@ -97,16 +94,16 @@ const Document = ({ document, addClass }) => {
Document.propTypes = {
addClass: PropTypes.string,
document: PropTypes.shape({
adPO: allowNull(PropTypes.string.isRequired),
adPO: PropTypes.string,
identifier: PropTypes.string.isRequired,
date: PropTypes.string.isRequired,
documentStatus: PropTypes.string.isRequired,
documentStatusColor: PropTypes.string,
documentType: PropTypes.string.isRequired,
documentTypeColor: PropTypes.string,
lineItems: PropTypes.arrayOf(PropTypes.shape({})).isRequired,
poNumber: allowNull(PropTypes.string.isRequired),
relatedSOWIdentifier: allowNull(PropTypes.string.isRequired),
poNumber: PropTypes.string,
relatedSOWIdentifier: PropTypes.string,
requestIdentifier: PropTypes.string.isRequired,
shippingPrice: PropTypes.string.isRequired,
shipTo: PropTypes.shape({
Expand All @@ -121,7 +118,7 @@ Document.propTypes = {
taxAmount: PropTypes.string.isRequired,
terms: PropTypes.string.isRequired,
totalPrice: PropTypes.string.isRequired,
turnaroundTime: allowNull(PropTypes.string.isRequired),
turnaroundTime: PropTypes.string,
}),
}

Expand Down