File tree Expand file tree Collapse file tree 2 files changed +34
-2
lines changed
Expand file tree Collapse file tree 2 files changed +34
-2
lines changed Original file line number Diff line number Diff line change @@ -2727,4 +2727,30 @@ module.exports = (router) => {
27272727 res . redirect ( `/clinics/${ clinicId } /events/${ eventId } ` )
27282728 }
27292729 )
2730- }
2730+
2731+ // Handle undo check in
2732+ router . get (
2733+ '/clinics/:clinicId/events/:eventId/undo-check-in' ,
2734+ ( req , res ) => {
2735+ const { clinicId, eventId } = req . params
2736+ const data = req . session . data
2737+ const event = getEvent ( data , eventId )
2738+
2739+ if ( event && event . status === 'event_checked_in' ) {
2740+ const participantName = getFullName ( data . participant )
2741+
2742+ // Save changes
2743+ saveTempEventToEvent ( data )
2744+
2745+ // Revert to scheduled status
2746+ updateEventStatus ( data , eventId , 'event_scheduled' )
2747+
2748+ req . flash ( 'success' , `${ participantName } is no longer checked in for their appointment` )
2749+
2750+ return res . redirect ( `/clinics/${ clinicId } ` )
2751+ }
2752+
2753+ res . redirect ( `/clinics/${ clinicId } /events/${ eventId } ` )
2754+ }
2755+ )
2756+ }
Original file line number Diff line number Diff line change 185185 text: "Undo reschedule request",
186186 visuallyHiddenText: "appointment"
187187 }
188- ] if event.status == "event_rescheduled" else [])
188+ ] if event.status == "event_rescheduled" else ([
189+ {
190+ href: "./undo-check-in",
191+ text: "Undo check in",
192+ visuallyHiddenText: "appointment"
193+ }
194+ ] if event.status == "event_checked_in" else []))
189195 }
190196 },
191197 {
You can’t perform that action at this time.
0 commit comments