@@ -43,6 +43,9 @@ const useStyles = makeStyles(theme => ({
4343 needlesOut : {
4444 paddingLeft : theme . spacing ( 1 ) ,
4545 } ,
46+ needlesExchanged : {
47+ marginTop : "-12% !important" ,
48+ } ,
4649 clearButton : {
4750 marginLeft : theme . spacing ( 1 ) ,
4851 } ,
@@ -282,13 +285,15 @@ const SepForm = ({
282285 initialValues = { {
283286 needles_in : "" ,
284287 needles_out : "" ,
288+ exchanged_for : "" ,
285289 visit_date : new Date ( ) . toISOString ( ) . substring ( 0 , 10 ) ,
286290 } }
287291 validationSchema = { SEPNeedleSchema }
288292 onSubmit = { async ( values , { setSubmitting } ) => {
289293 const success = await participantStore . createSEP ( {
290294 needles_in : values . needles_in ,
291295 needles_out : values . needles_out ,
296+ exchanged_for : values . exchanged_for ,
292297 visit_date : values . visit_date ,
293298 site : currentSite ,
294299 participant : participantId ,
@@ -316,18 +321,12 @@ const SepForm = ({
316321 disabled = { participantId && currentSite ? false : true }
317322 >
318323 < InputLabel htmlFor = "needles_in" > Needles In</ InputLabel >
319- < Select
324+ < PrevPointInput
320325 id = "needles_in"
321326 name = "needles_in"
322327 onChange = { handleChange }
323328 value = { values . needles_in }
324- >
325- { [ ...Array ( 20 ) ] . map ( ( x , i ) => (
326- < MenuItem key = { i + 1 } value = { i + 1 } >
327- { i + 1 }
328- </ MenuItem >
329- ) ) }
330- </ Select >
329+ />
331330 </ FormControl >
332331 </ Grid >
333332 < Grid item xs = { 6 } >
@@ -336,18 +335,28 @@ const SepForm = ({
336335 disabled = { participantId && currentSite ? false : true }
337336 >
338337 < InputLabel htmlFor = "needles_out" > Needles Out</ InputLabel >
339- < Select
338+ < PrevPointInput
340339 id = "needles_out"
341340 name = "needles_out"
342341 onChange = { handleChange }
343342 value = { values . needles_out }
344- >
345- { [ ...Array ( 20 ) ] . map ( ( x , i ) => (
346- < MenuItem key = { i + 1 } value = { i + 1 } >
347- { i + 1 }
348- </ MenuItem >
349- ) ) }
350- </ Select >
343+ />
344+ </ FormControl >
345+ </ Grid >
346+ < Grid className = { classes . needlesExchanged } item xs = { 12 } >
347+ < FormControl
348+ error = { errors . exchanged_for && touched . exchanged_for }
349+ disabled = { participantId && currentSite ? false : true }
350+ >
351+ < InputLabel htmlFor = "exchanged_for" >
352+ Needles Exchanged For
353+ </ InputLabel >
354+ < PrevPointInput
355+ id = "exchanged_for"
356+ name = "exchanged_for"
357+ onChange = { handleChange }
358+ value = { values . exchanged_for }
359+ />
351360 </ FormControl >
352361 </ Grid >
353362 </ Grid >
@@ -390,10 +399,12 @@ const SepForm = ({
390399 </ PrevPointButton >
391400 { ( errors . needles_in ||
392401 errors . needles_out ||
402+ errors . exchanged_for ||
393403 errors . visit_date ) && (
394404 < PrevPointCopy className = { classes . errorMessage } >
395405 { errors . needles_in ||
396406 errors . needles_out ||
407+ errors . exchanged_for ||
397408 errors . visit_date }
398409 </ PrevPointCopy >
399410 ) }
0 commit comments