Skip to content

Commit 821803f

Browse files
committed
linting for document
1 parent 3a38614 commit 821803f

File tree

1 file changed

+42
-38
lines changed

1 file changed

+42
-38
lines changed

src/compounds/Document/Document.jsx

Lines changed: 42 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import PropTypes from 'prop-types'
33
import { Dropdown, Offcanvas, Row } from 'react-bootstrap'
44
import LineItemsTable from '../../components/LineItemsTable/LineItemsTable'
55
import Notice from '../../components/Notice/Notice'
6+
import { allowNull } from '../../resources/utilityFunctions'
67
import './document.scss'
78

89
const Document = ({ accessToken, addClass, acceptSOW, backgroundColor, document, request }) => {
@@ -30,53 +31,54 @@ const Document = ({ accessToken, addClass, acceptSOW, backgroundColor, document,
3031
</small>
3132
</div>
3233
<div className='ms-auto p-2'>
33-
<div className='badge p-2' style={{backgroundColor: documentStatusColor}}>
34+
<div className='badge p-2' style={{ backgroundColor: documentStatusColor }}>
3435
{documentStatus}
3536
</div>
3637
</div>
3738
</div>
3839
<Offcanvas show={show} onHide={handleClose} placement='end' scroll='true'>
3940
<Offcanvas.Header className={`d-flex border-bottom px-3 py-2 bg-${backgroundColor}-8`} closeButton>
4041
<Offcanvas.Title> {documentType}: #{identifier}</Offcanvas.Title>
41-
{documentType === 'SOW' &&
42-
<div className='ms-auto me-2'>
43-
<Dropdown>
44-
<Dropdown.Toggle id='next-actions-dropdown' size='small' className='btn-outline-dark' variant={`btn-${backgroundColor}`}>
45-
Next Actions
46-
</Dropdown.Toggle>
47-
<Dropdown.Menu>
48-
{/* TODO: @summer-cook SOW should have submit for approval. It should also ONLY show the submit for approval when the SOW has not yet been submitted. Need to figure out a way to tell if it has been submitted or not. . */}
49-
<Dropdown.Item
50-
href='#/action-1'
51-
onClick={() => {
52-
acceptSOW({
53-
request: request,
54-
sowID: sowID,
55-
accessToken: accessToken,
56-
})
57-
setSowAccepted(true)
58-
}}
59-
>
60-
Submit for Approval
61-
</Dropdown.Item>
62-
</Dropdown.Menu>
63-
</Dropdown>
64-
</div>
65-
}
42+
{documentType === 'SOW'
43+
&& (
44+
<div className='ms-auto me-2'>
45+
<Dropdown>
46+
<Dropdown.Toggle id='next-actions-dropdown' size='small' className='btn-outline-dark' variant={`btn-${backgroundColor}`}>
47+
Next Actions
48+
</Dropdown.Toggle>
49+
<Dropdown.Menu>
50+
<Dropdown.Item
51+
href='#/action-1'
52+
onClick={() => {
53+
acceptSOW({
54+
request,
55+
sowID,
56+
accessToken,
57+
})
58+
setSowAccepted(true)
59+
}}
60+
>
61+
Submit for Approval
62+
</Dropdown.Item>
63+
</Dropdown.Menu>
64+
</Dropdown>
65+
</div>
66+
)}
6667
</Offcanvas.Header>
6768
<Offcanvas.Body>
68-
{sowAccepted &&
69-
<Row>
70-
<Notice
71-
addClass='my-3'
72-
alert={{
73-
body: [`SOW ${identifier} has been accepted successfully. Now awaiting purchase order.`],
74-
variant: 'success',
75-
onClose: () => setSowAccepted(false)
76-
}}
77-
/>
78-
</Row>
79-
}
69+
{sowAccepted
70+
&& (
71+
<Row>
72+
<Notice
73+
addClass='my-3'
74+
alert={{
75+
body: [`SOW ${identifier} has been accepted successfully. Now awaiting purchase order.`],
76+
variant: 'success',
77+
onClose: () => setSowAccepted(false),
78+
}}
79+
/>
80+
</Row>
81+
)}
8082
<div className='d-block d-md-flex justify-content-between'>
8183
<div className='details'>
8284
<h6>Details:</h6>
@@ -138,11 +140,13 @@ Document.propTypes = {
138140
organizationName: PropTypes.string,
139141
text: PropTypes.string,
140142
}).isRequired,
143+
sowID: allowNull(PropTypes.string),
141144
subtotalPrice: PropTypes.string.isRequired,
142145
taxAmount: PropTypes.string.isRequired,
143146
terms: PropTypes.string.isRequired,
144147
totalPrice: PropTypes.string.isRequired,
145148
}),
149+
request: PropTypes.string.isRequired,
146150
}
147151

148152
Document.defaultProps = {

0 commit comments

Comments
 (0)