/
ReviewPackageCaseTitle.jsx
148 lines (126 loc) · 3.6 KB
/
ReviewPackageCaseTitle.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
import { css } from 'glamor';
import PropTypes from 'prop-types';
import React, { useState } from 'react';
import COPY from 'app/../COPY';
import Button from '../../../components/Button';
import SearchableDropdown from '../../../components/SearchableDropdown';
import RemovePackageModal from '../component/RemovePackageModal';
const containingDivStyling = css({
display: 'block',
// Offsets the padding from .cf-app-segment--alt to make the bottom border full width.
margin: '-2rem -4rem 0 -4rem',
padding: '0 0 1.5rem 4rem',
'& > *': {
display: 'inline-block',
margin: '0'
}
});
const removebotton = css({
float: 'right',
marginRight: '2rem !important'
});
const headerStyling = css({
paddingRight: '2.5rem'
});
const listStyling = css({
listStyleType: 'none',
verticalAlign: 'super',
padding: '0 0 4rem 0',
display: 'flex',
flexWrap: 'wrap'
});
const columnStyling = css({
flexBasis: '0',
webkitBoxFlex: '1',
msFlexPositive: '1',
flexGrow: '1',
maxWidth: '100%'
});
const dropDownDiv = css({
marginTop: '-10px',
flexBasis: '0',
webkitBoxFlex: '1',
msFlexPositive: '1',
flexGrow: '1',
maxWidth: '100%'
});
const ReviewPackageCaseTitle = (props) => {
return (
<div>
<CaseTitleScaffolding correspondence_id = {props.correspondence.id} isReadOnly={props.isReadOnly} />
<CaseSubTitleScaffolding {...props} isReadOnly={props.isReadOnly} />
</div>
);
};
const CaseTitleScaffolding = (props) => {
const [modalState, setModalState] = useState(false);
const openModal = () => {
setModalState(true);
};
const closeModal = () => {
setModalState(false);
};
return (
<div {...containingDivStyling}>
<h1 {...headerStyling}>{COPY.CORRESPONDENCE_REVIEW_PACKAGE_TITLE}</h1>
<span {...removebotton}>
{ props.isReadOnly &&
<Button
name="Review removal request"
styling={{ style: { marginRight: '2rem', padding: '15px', fontSize: 'larger' } }}
classNames={['usa-button-primary']}
onClick={() => {
openModal();
}}
/>
}
</span>
{ modalState &&
<RemovePackageModal
modalState={modalState}
setModalState={setModalState}
onCancel={closeModal}
correspondence_id = {props.correspondence_id} />
}
</div>
);
};
const CaseSubTitleScaffolding = (props) => (
<div {...listStyling}>
<div {...columnStyling}>
{COPY.CORRESPONDENCE_REVIEW_PACKAGE_SUB_TITLE}
</div>
<div {...dropDownDiv} style = {{ maxWidth: '25%' }}>
{ !props.isReadOnly &&
<SearchableDropdown
options={[
{ value: 'splitPackage', label: 'Split package' },
{ value: 'mergePackage', label: 'Merge package' },
{ value: 'removePackage', label: 'Remove package from Caseflow' },
{ value: 'reassignPackage', label: 'Reassign package' }
]}
onChange={(option) => props.handlePackageActionModal(option.value)}
placeholder="Request package action"
label="Request package action dropdown"
hideLabel
name=""
value={props.packageActionModal}
/> }
</div>
</div>
);
ReviewPackageCaseTitle.propTypes = {
handlePackageActionModal: PropTypes.func,
correspondence: PropTypes.object,
isReadOnly: PropTypes.bool
};
CaseSubTitleScaffolding.propTypes = {
handlePackageActionModal: PropTypes.func,
packageActionModal: PropTypes.string,
isReadOnly: PropTypes.bool
};
CaseTitleScaffolding.propTypes = {
correspondence_id: PropTypes.number,
isReadOnly: PropTypes.bool
};
export default ReviewPackageCaseTitle;