From 91b8b431059107e876e156c8d39a77cf01213668 Mon Sep 17 00:00:00 2001 From: Alisha Evans Date: Tue, 7 Mar 2023 16:43:04 -0600 Subject: [PATCH 1/2] no longer passing null values so we do not need to account for them --- src/compounds/Document/Document.jsx | 35 +++++++++++++---------------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/src/compounds/Document/Document.jsx b/src/compounds/Document/Document.jsx index 53e95e4..33667a6 100644 --- a/src/compounds/Document/Document.jsx +++ b/src/compounds/Document/Document.jsx @@ -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) @@ -76,16 +76,13 @@ const Document = ({ document, addClass }) => {
{shipFrom.text}
- {lineItems - && ( - - )} + {turnaroundTime &&
Turnaround Time: {turnaroundTime}
} @@ -97,7 +94,7 @@ 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, @@ -105,8 +102,8 @@ Document.propTypes = { 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({ @@ -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, }), } From bcf4ad70a3a173df644862c0c49ff816cbbb75ee Mon Sep 17 00:00:00 2001 From: Alisha Evans Date: Tue, 7 Mar 2023 17:00:35 -0600 Subject: [PATCH 2/2] check for lineItems again --- src/compounds/Document/Document.jsx | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/compounds/Document/Document.jsx b/src/compounds/Document/Document.jsx index 33667a6..50e03f9 100644 --- a/src/compounds/Document/Document.jsx +++ b/src/compounds/Document/Document.jsx @@ -76,13 +76,15 @@ const Document = ({ document, addClass }) => {
{shipFrom.text}
- + {lineItems && ( + + )} {turnaroundTime &&
Turnaround Time: {turnaroundTime}
}