@@ -11,6 +11,7 @@ import FormField from "components/FormField";
11
11
import BaseCreateModal from "../BaseCreateModal" ;
12
12
import { FORM_FIELD_TYPE } from "constants/" ;
13
13
import { formatPlural } from "utils/format" ;
14
+ import { isUuid } from "utils/helpers" ;
14
15
import Button from "components/Button" ;
15
16
import MonthPicker from "components/MonthPicker" ;
16
17
import InformationTooltip from "components/InformationTooltip" ;
@@ -28,7 +29,7 @@ const Error = ({ name }) => {
28
29
} ;
29
30
30
31
function TeamDetailsModal ( { open, onClose, submitForm, addedRoles } ) {
31
- const [ showDescription , setShowDescription ] = useState ( false ) ;
32
+ const [ showAdvanced , setShowAdvanced ] = useState ( false ) ;
32
33
const [ startMonthVisible , setStartMonthVisible ] = useState ( { } ) ;
33
34
34
35
// Ensure role is removed from form state when it is removed from redux store
@@ -37,7 +38,7 @@ function TeamDetailsModal({ open, onClose, submitForm, addedRoles }) {
37
38
useEffect ( ( ) => {
38
39
const values = getFormState ( ) . values ;
39
40
for ( let fieldName of Object . keys ( values ) ) {
40
- if ( fieldName === "teamName" || fieldName === "teamDescription" ) {
41
+ if ( ! isUuid ( fieldName ) ) {
41
42
continue ;
42
43
}
43
44
if ( addedRoles . findIndex ( ( role ) => role . searchId === fieldName ) === - 1 ) {
@@ -49,8 +50,8 @@ function TeamDetailsModal({ open, onClose, submitForm, addedRoles }) {
49
50
50
51
const dispatch = useDispatch ( ) ;
51
52
52
- const toggleDescription = ( ) => {
53
- setShowDescription ( ( prevState ) => ! prevState ) ;
53
+ const toggleAdvanced = ( ) => {
54
+ setShowAdvanced ( ( prevState ) => ! prevState ) ;
54
55
} ;
55
56
56
57
return (
@@ -78,7 +79,7 @@ function TeamDetailsModal({ open, onClose, submitForm, addedRoles }) {
78
79
open = { open }
79
80
onClose = { onClose }
80
81
title = "Team Details"
81
- subtitle = "Please provide your team details before submitting a request."
82
+ subtitle = "Please provide a name for your Team. This could be the name of the project they will work on, the name of the team they are joining, or whatever else will make this talent request meaningful for you ."
82
83
buttons = {
83
84
< Button
84
85
type = "primary"
@@ -102,26 +103,38 @@ function TeamDetailsModal({ open, onClose, submitForm, addedRoles }) {
102
103
customValidator : true ,
103
104
} }
104
105
/>
105
- { showDescription && (
106
- < FormField
107
- field = { {
108
- type : FORM_FIELD_TYPE . TEXTAREA ,
109
- name : "teamDescription" ,
110
- label : "Short description about the team/ project" ,
111
- placeholder : "Short description about the team/ project" ,
112
- maxLength : 600 ,
113
- } }
114
- />
106
+ { showAdvanced && (
107
+ < >
108
+ < FormField
109
+ field = { {
110
+ type : FORM_FIELD_TYPE . TEXTAREA ,
111
+ name : "teamDescription" ,
112
+ label : "Short description about the team/ project" ,
113
+ placeholder : "Short description about the team/ project" ,
114
+ maxLength : 600 ,
115
+ } }
116
+ />
117
+ < FormField
118
+ field = { {
119
+ type : FORM_FIELD_TYPE . TEXT ,
120
+ name : "refCode" ,
121
+ label : "Ref Code" ,
122
+ placeholder : "Ref Code" ,
123
+ maxLength : 255 ,
124
+ } }
125
+ />
126
+ </ >
115
127
) }
116
128
< button
117
- styleName = "toggle-button toggle-description "
129
+ styleName = "toggle-button toggle-advanced "
118
130
onClick = { ( ) => {
119
131
clearField ( "teamDescription" ) ;
120
- toggleDescription ( ) ;
132
+ clearField ( "refCode" ) ;
133
+ toggleAdvanced ( ) ;
121
134
} }
122
135
>
123
- < span > { showDescription ? "–" : "+" } </ span >
124
- { showDescription ? " Remove Description" : " Add Description" }
136
+ < span > { showAdvanced ? "– " : "+ " } </ span >
137
+ Advanced Options
125
138
</ button >
126
139
< table styleName = "table" >
127
140
< tr >
@@ -147,7 +160,7 @@ function TeamDetailsModal({ open, onClose, submitForm, addedRoles }) {
147
160
< Field
148
161
validate = { validateExists }
149
162
name = { `${ id } .numberOfResources` }
150
- initialValue = { numberOfResources }
163
+ initialValue = { numberOfResources || 1 }
151
164
>
152
165
{ ( { input, meta } ) => (
153
166
< NumberInput
@@ -167,7 +180,7 @@ function TeamDetailsModal({ open, onClose, submitForm, addedRoles }) {
167
180
< Field
168
181
validate = { validateExists }
169
182
name = { `${ id } .durationWeeks` }
170
- initialValue = { durationWeeks }
183
+ initialValue = { durationWeeks || 4 }
171
184
>
172
185
{ ( { input, meta } ) => (
173
186
< NumberInput
0 commit comments