@@ -6,16 +6,15 @@ import Notice from '../../components/Notice/Notice'
6
6
import { allowNull } from '../../resources/utilityFunctions'
7
7
import './document.scss'
8
8
9
- const Document = ( { accessToken , addClass, acceptSOW, backgroundColor, document, request } ) => {
9
+ const Document = ( { addClass, acceptSOW, backgroundColor, document } ) => {
10
10
const { identifier, date, documentStatusColor, documentType,
11
11
documentTypeColor, documentStatus, lineItems, requestIdentifier,
12
12
shippingPrice, shipTo, shipFrom, sowID, subtotalPrice,
13
13
taxAmount, terms, totalPrice } = document
14
14
const [ show , setShow ] = useState ( false )
15
- const [ sowAccepted , setSowAccepted ] = useState ( false )
15
+ const [ showNotice , setShowNotice ] = useState ( false )
16
16
const handleClose = ( ) => setShow ( false )
17
17
const handleShow = ( ) => setShow ( true )
18
-
19
18
return (
20
19
< >
21
20
< 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,
50
49
< Dropdown . Item
51
50
href = '#/action-1'
52
51
onClick = { ( ) => {
53
- acceptSOW ( {
54
- request,
55
- sowID,
56
- accessToken,
57
- } )
58
- setSowAccepted ( true )
52
+ acceptSOW
53
+ setShowNotice ( true )
59
54
} }
60
55
>
61
56
Submit for Approval
@@ -66,19 +61,18 @@ const Document = ({ accessToken, addClass, acceptSOW, backgroundColor, document,
66
61
) }
67
62
</ Offcanvas . Header >
68
63
< 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
+ ) }
82
76
< div className = 'd-block d-md-flex justify-content-between' >
83
77
< div className = 'details' >
84
78
< h6 > Details:</ h6 >
@@ -100,8 +94,7 @@ const Document = ({ accessToken, addClass, acceptSOW, backgroundColor, document,
100
94
< div className = 'address' > { shipFrom . text } </ div >
101
95
</ div >
102
96
</ div >
103
- { lineItems
104
- && (
97
+ { lineItems && (
105
98
< LineItemsTable
106
99
lineItems = { lineItems }
107
100
subtotalPrice = { subtotalPrice }
@@ -119,8 +112,8 @@ const Document = ({ accessToken, addClass, acceptSOW, backgroundColor, document,
119
112
120
113
Document . propTypes = {
121
114
addClass : PropTypes . string ,
115
+ alertBody : PropTypes . string ,
122
116
backgroundColor : PropTypes . string ,
123
- accessToken : PropTypes . string . isRequired ,
124
117
acceptSOW : PropTypes . func . isRequired ,
125
118
document : PropTypes . shape ( {
126
119
identifier : PropTypes . string . isRequired ,
@@ -146,7 +139,6 @@ Document.propTypes = {
146
139
terms : PropTypes . string . isRequired ,
147
140
totalPrice : PropTypes . string . isRequired ,
148
141
} ) ,
149
- request : PropTypes . string . isRequired ,
150
142
}
151
143
152
144
Document . defaultProps = {
0 commit comments