@@ -100,14 +100,12 @@ const AppointmentForm: React.FC<AppointmentFormProps> = ({ appointment, patientU
100
100
const [ selectedProvider , setSelectedProvider ] = useState ( appointmentState . provider ) ;
101
101
const [ reminder , setReminder ] = useState ( '' ) ;
102
102
const [ appointmentComment , setAppointmentComment ] = useState ( appointmentState . comments ) ;
103
- const [ reason , setReason ] = useState ( '' ) ;
104
103
const [ timeFormat , setTimeFormat ] = useState < amPm > ( new Date ( ) . getHours ( ) >= 12 ? 'PM' : 'AM' ) ;
105
104
const [ visitDate , setVisitDate ] = React . useState (
106
105
appointmentState . dateTime ? new Date ( appointmentState . dateTime ) : new Date ( ) ,
107
106
) ;
108
- const [ isFullDay , setIsFullDay ] = useState < boolean > ( false ) ;
107
+ const [ isFullDay , setIsFullDay ] = useState < boolean > ( true ) ;
109
108
const [ day , setDay ] = useState ( appointmentState . dateTime ) ;
110
- const [ appointmentType , setAppointmentType ] = useState ( appointmentState . appointmentKind ) ;
111
109
const [ appointmentStatus , setAppointmentStatus ] = useState ( appointmentState . status ?? 'Scheduled' ) ;
112
110
const [ isSubmitting , setIsSubmitting ] = useState ( false ) ;
113
111
const appointmentStartDate = useAppointmentDate ( ) ;
@@ -123,7 +121,7 @@ const AppointmentForm: React.FC<AppointmentFormProps> = ({ appointment, patientU
123
121
( ) => getWeeklyCalendarDistribution ( new Date ( appointmentStartDate ) , appointmentSummary ) ?? [ ] ,
124
122
[ appointmentStartDate , appointmentSummary ] ,
125
123
) ;
126
- const isMissingRequirements = ! selectedService || ! appointmentType . length || ! selectedProvider ;
124
+ const isMissingRequirements = ! selectedService || ! selectedProvider ;
127
125
const appointmentService = services ?. find ( ( { uuid } ) => uuid === selectedService ) ;
128
126
129
127
useEffect ( ( ) => {
@@ -160,7 +158,7 @@ const AppointmentForm: React.FC<AppointmentFormProps> = ({ appointment, patientU
160
158
new Date ( dayjs ( visitDate ) . year ( ) , dayjs ( visitDate ) . month ( ) , dayjs ( visitDate ) . date ( ) , hours , minutes ) ,
161
159
) ;
162
160
const appointmentPayload : AppointmentPayload = {
163
- appointmentKind : appointmentType ,
161
+ appointmentKind : 'Scheduled' ,
164
162
status : appointmentStatus ,
165
163
serviceUuid : selectedService ,
166
164
startDateTime : dayjs ( startDatetime ) . format ( ) ,
@@ -206,6 +204,8 @@ const AppointmentForm: React.FC<AppointmentFormProps> = ({ appointment, patientU
206
204
mutate ( `/ws/rest/v1/appointment/appointmentStatus?forDate=${ appointmentStartDate } &status=Scheduled` ) ;
207
205
mutate ( `/ws/rest/v1/appointment/appointmentStatus?forDate=${ appointmentStartDate } &status=CheckedIn` ) ;
208
206
mutate ( `/ws/rest/v1/appointment/all?forDate=${ appointmentStartDate } ` ) ;
207
+ mutate ( `/ws/rest/v1/appointment/appointmentStatus?status=Scheduled&forDate=${ appointmentStartDate } ` ) ;
208
+ mutate ( `/ws/rest/v1/appointment/appointmentStatus?status=Pending&forDate=${ appointmentStartDate } ` ) ;
209
209
closeOverlay ( ) ;
210
210
}
211
211
} ,
@@ -324,7 +324,14 @@ const AppointmentForm: React.FC<AppointmentFormProps> = ({ appointment, patientU
324
324
< p > { t ( 'appointmentDateAndTime' , 'Appointments Date and Time' ) } </ p >
325
325
326
326
< div className = { styles . row } >
327
- < Toggle onToggle = { ( value ) => setIsFullDay ( value ) } id = "allDay" labelA = "Off" labelB = "On" labelText = "All Day" />
327
+ < Toggle
328
+ onToggle = { ( value ) => setIsFullDay ( value ) }
329
+ id = "allDay"
330
+ labelA = "Off"
331
+ labelB = "On"
332
+ labelText = "All Day"
333
+ toggled = { isFullDay }
334
+ />
328
335
< DatePicker
329
336
dateFormat = "d/m/Y"
330
337
datePickerType = "single"
@@ -444,24 +451,6 @@ const AppointmentForm: React.FC<AppointmentFormProps> = ({ appointment, patientU
444
451
</ div >
445
452
) }
446
453
447
- < Select
448
- id = "appointmentType"
449
- invalidText = "Required"
450
- labelText = { t ( 'selectAppointmentType' , 'Select an appointment type' ) }
451
- light
452
- className = { styles . inputContainer }
453
- onChange = { ( event ) => setAppointmentType ( event . target . value ) }
454
- value = { appointmentType } >
455
- { ! appointmentType || appointmentType == '--' ? (
456
- < SelectItem text = { t ( 'selectAppointmentType' , 'Select an appointment type' ) } value = "" />
457
- ) : null }
458
- { appointmentTypes ?. length > 0 &&
459
- appointmentTypes . map ( ( service ) => (
460
- < SelectItem key = { service } text = { service } value = { service } >
461
- { service }
462
- </ SelectItem >
463
- ) ) }
464
- </ Select >
465
454
{ context !== 'creating' && (
466
455
< Select
467
456
id = "appointmentStatus"
@@ -516,24 +505,26 @@ const AppointmentForm: React.FC<AppointmentFormProps> = ({ appointment, patientU
516
505
</ RadioButtonGroup >
517
506
</ div >
518
507
519
- < Select
520
- id = "reason"
521
- invalidText = "Required"
522
- labelText = { t ( 'reasonForChanges' , 'Reason for change' ) }
523
- light
524
- className = { styles . inputContainer }
525
- onChange = { ( event ) => setAppointmentComment ( event . target . value ) }
526
- value = { appointmentComment } >
527
- { ! appointmentComment || appointmentComment == '--' ? (
528
- < SelectItem text = { t ( 'reasonForChanges' , 'Reason for change' ) } value = "" />
529
- ) : null }
530
- { appointmentComments ?. length > 0 &&
531
- appointmentComments . map ( ( comments ) => (
532
- < SelectItem key = { comments } text = { comments } value = { comments } >
533
- { comments }
534
- </ SelectItem >
535
- ) ) }
536
- </ Select >
508
+ { context !== 'creating' && (
509
+ < Select
510
+ id = "reason"
511
+ invalidText = "Required"
512
+ labelText = { t ( 'reasonForChanges' , 'Reason for change' ) }
513
+ light
514
+ className = { styles . inputContainer }
515
+ onChange = { ( event ) => setAppointmentComment ( event . target . value ) }
516
+ value = { appointmentComment } >
517
+ { ! appointmentComment || appointmentComment == '--' ? (
518
+ < SelectItem text = { t ( 'reasonForChanges' , 'Reason for change' ) } value = "" />
519
+ ) : null }
520
+ { appointmentComments ?. length > 0 &&
521
+ appointmentComments . map ( ( comments ) => (
522
+ < SelectItem key = { comments } text = { comments } value = { comments } >
523
+ { comments }
524
+ </ SelectItem >
525
+ ) ) }
526
+ </ Select >
527
+ ) }
537
528
< ButtonSet >
538
529
< Button onClick = { closeOverlay } className = { styles . button } kind = "secondary" >
539
530
{ t ( 'discard' , 'Discard' ) }
0 commit comments