@@ -3,6 +3,7 @@ import PropTypes from 'prop-types'
3
3
import { Dropdown , Offcanvas , Row } from 'react-bootstrap'
4
4
import LineItemsTable from '../../components/LineItemsTable/LineItemsTable'
5
5
import Notice from '../../components/Notice/Notice'
6
+ import { allowNull } from '../../resources/utilityFunctions'
6
7
import './document.scss'
7
8
8
9
const Document = ( { accessToken, addClass, acceptSOW, backgroundColor, document, request } ) => {
@@ -30,53 +31,54 @@ const Document = ({ accessToken, addClass, acceptSOW, backgroundColor, document,
30
31
</ small >
31
32
</ div >
32
33
< div className = 'ms-auto p-2' >
33
- < div className = 'badge p-2' style = { { backgroundColor : documentStatusColor } } >
34
+ < div className = 'badge p-2' style = { { backgroundColor : documentStatusColor } } >
34
35
{ documentStatus }
35
36
</ div >
36
37
</ div >
37
38
</ div >
38
39
< Offcanvas show = { show } onHide = { handleClose } placement = 'end' scroll = 'true' >
39
40
< Offcanvas . Header className = { `d-flex border-bottom px-3 py-2 bg-${ backgroundColor } -8` } closeButton >
40
41
< 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
+ ) }
66
67
</ Offcanvas . Header >
67
68
< 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
+ ) }
80
82
< div className = 'd-block d-md-flex justify-content-between' >
81
83
< div className = 'details' >
82
84
< h6 > Details:</ h6 >
@@ -138,11 +140,13 @@ Document.propTypes = {
138
140
organizationName : PropTypes . string ,
139
141
text : PropTypes . string ,
140
142
} ) . isRequired ,
143
+ sowID : allowNull ( PropTypes . string ) ,
141
144
subtotalPrice : PropTypes . string . isRequired ,
142
145
taxAmount : PropTypes . string . isRequired ,
143
146
terms : PropTypes . string . isRequired ,
144
147
totalPrice : PropTypes . string . isRequired ,
145
148
} ) ,
149
+ request : PropTypes . string . isRequired ,
146
150
}
147
151
148
152
Document . defaultProps = {
0 commit comments