Skip to content

Commit 950f362

Browse files
authored
Merge pull request #180 from scientist-softserv/138-display-pos-refactor
refactor #175
2 parents 12edc4c + bcf4ad7 commit 950f362

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

src/compounds/Document/Document.jsx

Lines changed: 10 additions & 11 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,8 +76,7 @@ const Document = ({ document, addClass }) => {
7676
<div className='address'>{shipFrom.text}</div>
7777
</div>
7878
</div>
79-
{lineItems
80-
&& (
79+
{lineItems && (
8180
<LineItemsTable
8281
lineItems={lineItems}
8382
subtotalPrice={subtotalPrice}
@@ -97,16 +96,16 @@ const Document = ({ document, addClass }) => {
9796
Document.propTypes = {
9897
addClass: PropTypes.string,
9998
document: PropTypes.shape({
100-
adPO: allowNull(PropTypes.string.isRequired),
99+
adPO: PropTypes.string,
101100
identifier: PropTypes.string.isRequired,
102101
date: PropTypes.string.isRequired,
103102
documentStatus: PropTypes.string.isRequired,
104103
documentStatusColor: PropTypes.string,
105104
documentType: PropTypes.string.isRequired,
106105
documentTypeColor: PropTypes.string,
107106
lineItems: PropTypes.arrayOf(PropTypes.shape({})).isRequired,
108-
poNumber: allowNull(PropTypes.string.isRequired),
109-
relatedSOWIdentifier: allowNull(PropTypes.string.isRequired),
107+
poNumber: PropTypes.string,
108+
relatedSOWIdentifier: PropTypes.string,
110109
requestIdentifier: PropTypes.string.isRequired,
111110
shippingPrice: PropTypes.string.isRequired,
112111
shipTo: PropTypes.shape({
@@ -121,7 +120,7 @@ Document.propTypes = {
121120
taxAmount: PropTypes.string.isRequired,
122121
terms: PropTypes.string.isRequired,
123122
totalPrice: PropTypes.string.isRequired,
124-
turnaroundTime: allowNull(PropTypes.string.isRequired),
123+
turnaroundTime: PropTypes.string,
125124
}),
126125
}
127126

0 commit comments

Comments
 (0)