Skip to content

Commit 91b8b43

Browse files
committed
no longer passing null values so we do not need to account for them
1 parent 12edc4c commit 91b8b43

File tree

1 file changed

+16
-19
lines changed

1 file changed

+16
-19
lines changed

src/compounds/Document/Document.jsx

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ import PropTypes from 'prop-types'
33
import { Dropdown, Offcanvas } from 'react-bootstrap'
44
import LineItemsTable from '../../components/LineItemsTable/LineItemsTable'
55
import './document.scss'
6-
import { allowNull } from '../../resources/utilityFunctions'
76

87
const Document = ({ document, addClass }) => {
9-
const { adPO, date, documentStatusColor, documentType,
10-
documentTypeColor, documentStatus, identifier, lineItems, poNumber, relatedSOWIdentifier, requestIdentifier,
11-
shippingPrice, shipTo, shipFrom, subtotalPrice,
12-
taxAmount, terms, totalPrice, turnaroundTime } = document
8+
const {
9+
adPO, date, documentStatusColor, documentType, documentTypeColor, documentStatus, identifier, lineItems, poNumber,
10+
relatedSOWIdentifier, requestIdentifier, shippingPrice, shipTo, shipFrom, subtotalPrice, taxAmount, terms, totalPrice,
11+
turnaroundTime,
12+
} = document
1313
const [show, setShow] = useState(false)
1414
const handleClose = () => setShow(false)
1515
const handleShow = () => setShow(true)
@@ -76,16 +76,13 @@ const Document = ({ document, addClass }) => {
7676
<div className='address'>{shipFrom.text}</div>
7777
</div>
7878
</div>
79-
{lineItems
80-
&& (
81-
<LineItemsTable
82-
lineItems={lineItems}
83-
subtotalPrice={subtotalPrice}
84-
taxAmount={taxAmount}
85-
shippingPrice={shippingPrice}
86-
totalPrice={totalPrice}
87-
/>
88-
)}
79+
<LineItemsTable
80+
lineItems={lineItems}
81+
subtotalPrice={subtotalPrice}
82+
taxAmount={taxAmount}
83+
shippingPrice={shippingPrice}
84+
totalPrice={totalPrice}
85+
/>
8986
{turnaroundTime && <h5><b>Turnaround Time:</b> {turnaroundTime}</h5>}
9087
</Offcanvas.Body>
9188
</Offcanvas>
@@ -97,16 +94,16 @@ const Document = ({ document, addClass }) => {
9794
Document.propTypes = {
9895
addClass: PropTypes.string,
9996
document: PropTypes.shape({
100-
adPO: allowNull(PropTypes.string.isRequired),
97+
adPO: PropTypes.string,
10198
identifier: PropTypes.string.isRequired,
10299
date: PropTypes.string.isRequired,
103100
documentStatus: PropTypes.string.isRequired,
104101
documentStatusColor: PropTypes.string,
105102
documentType: PropTypes.string.isRequired,
106103
documentTypeColor: PropTypes.string,
107104
lineItems: PropTypes.arrayOf(PropTypes.shape({})).isRequired,
108-
poNumber: allowNull(PropTypes.string.isRequired),
109-
relatedSOWIdentifier: allowNull(PropTypes.string.isRequired),
105+
poNumber: PropTypes.string,
106+
relatedSOWIdentifier: PropTypes.string,
110107
requestIdentifier: PropTypes.string.isRequired,
111108
shippingPrice: PropTypes.string.isRequired,
112109
shipTo: PropTypes.shape({
@@ -121,7 +118,7 @@ Document.propTypes = {
121118
taxAmount: PropTypes.string.isRequired,
122119
terms: PropTypes.string.isRequired,
123120
totalPrice: PropTypes.string.isRequired,
124-
turnaroundTime: allowNull(PropTypes.string.isRequired),
121+
turnaroundTime: PropTypes.string,
125122
}),
126123
}
127124

0 commit comments

Comments
 (0)