Skip to content

Commit db74b06

Browse files
committed
move the actual function for accept sow to the webstore
1 parent 8131f46 commit db74b06

File tree

1 file changed

+18
-26
lines changed

1 file changed

+18
-26
lines changed

src/compounds/Document/Document.jsx

Lines changed: 18 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,15 @@ import Notice from '../../components/Notice/Notice'
66
import { allowNull } from '../../resources/utilityFunctions'
77
import './document.scss'
88

9-
const Document = ({ accessToken, addClass, acceptSOW, backgroundColor, document, request }) => {
9+
const Document = ({ addClass, acceptSOW, backgroundColor, document }) => {
1010
const { identifier, date, documentStatusColor, documentType,
1111
documentTypeColor, documentStatus, lineItems, requestIdentifier,
1212
shippingPrice, shipTo, shipFrom, sowID, subtotalPrice,
1313
taxAmount, terms, totalPrice } = document
1414
const [show, setShow] = useState(false)
15-
const [sowAccepted, setSowAccepted] = useState(false)
15+
const [showNotice, setShowNotice] = useState(false)
1616
const handleClose = () => setShow(false)
1717
const handleShow = () => setShow(true)
18-
1918
return (
2019
<>
2120
<div className={`d-flex border rounded mb-2 bg-light document-wrapper ${addClass}`} onClick={handleShow} role='presentation'>
@@ -50,12 +49,8 @@ const Document = ({ accessToken, addClass, acceptSOW, backgroundColor, document,
5049
<Dropdown.Item
5150
href='#/action-1'
5251
onClick={() => {
53-
acceptSOW({
54-
request,
55-
sowID,
56-
accessToken,
57-
})
58-
setSowAccepted(true)
52+
acceptSOW
53+
setShowNotice(true)
5954
}}
6055
>
6156
Submit for Approval
@@ -66,19 +61,18 @@ const Document = ({ accessToken, addClass, acceptSOW, backgroundColor, document,
6661
)}
6762
</Offcanvas.Header>
6863
<Offcanvas.Body>
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-
)}
64+
{showNotice && (
65+
<Row>
66+
<Notice
67+
addClass='my-3'
68+
alert={{
69+
body: [alertBody],
70+
variant: 'success',
71+
onClose: () => setShowNotice(false),
72+
}}
73+
/>
74+
</Row>
75+
)}
8276
<div className='d-block d-md-flex justify-content-between'>
8377
<div className='details'>
8478
<h6>Details:</h6>
@@ -100,8 +94,7 @@ const Document = ({ accessToken, addClass, acceptSOW, backgroundColor, document,
10094
<div className='address'>{shipFrom.text}</div>
10195
</div>
10296
</div>
103-
{lineItems
104-
&& (
97+
{lineItems && (
10598
<LineItemsTable
10699
lineItems={lineItems}
107100
subtotalPrice={subtotalPrice}
@@ -119,8 +112,8 @@ const Document = ({ accessToken, addClass, acceptSOW, backgroundColor, document,
119112

120113
Document.propTypes = {
121114
addClass: PropTypes.string,
115+
alertBody: PropTypes.string,
122116
backgroundColor: PropTypes.string,
123-
accessToken: PropTypes.string.isRequired,
124117
acceptSOW: PropTypes.func.isRequired,
125118
document: PropTypes.shape({
126119
identifier: PropTypes.string.isRequired,
@@ -146,7 +139,6 @@ Document.propTypes = {
146139
terms: PropTypes.string.isRequired,
147140
totalPrice: PropTypes.string.isRequired,
148141
}),
149-
request: PropTypes.string.isRequired,
150142
}
151143

152144
Document.defaultProps = {

0 commit comments

Comments
 (0)