@@ -548,6 +548,7 @@ module.exports = router => {
548548
549549 router . get ( '/record-vaccinations/eligibility' , ( req , res ) => {
550550 const data = req . session . data
551+ const from = req . query . from
551552 const eligibility = data . eligibility
552553 let errors = [ ]
553554
@@ -561,7 +562,8 @@ module.exports = router => {
561562 }
562563
563564 res . render ( 'record-vaccinations/eligibility' , {
564- errors
565+ errors,
566+ from
565567 } )
566568 } )
567569
@@ -583,16 +585,22 @@ module.exports = router => {
583585 nextPage = "/record-vaccinations/patient-history"
584586 }
585587
586- } else if ( data . vaccine == "flu" ) {
587- if ( data . eligibility === "Health or social care worker" ) {
588- nextPage = "/record-vaccinations/healthcare-worker"
589- } else {
590- nextPage = "/record-vaccinations/patient"
591- }
592- } else if ( data . vaccine == "COVID-19" ) {
588+ } else if ( data . vaccine == "flu" && data . eligibility === "Health or social care worker" && ( ! data . healthcareWorker || data . healthcareWorker === "" ) ) {
589+
590+ nextPage = "/record-vaccinations/healthcare-worker"
591+
592+ } else if ( data . vaccine == "COVID-19" && ( ! data . locationType || data . locationType === "" ) ) {
593+
593594 nextPage = "/record-vaccinations/location"
595+
596+ } else if ( data . repeatVaccination === "yes" ) {
597+
598+ nextPage = "/record-vaccinations/review-previous"
599+
594600 } else {
601+
595602 nextPage = "/record-vaccinations/patient"
603+
596604 }
597605
598606 res . redirect ( nextPage )
@@ -695,10 +703,12 @@ module.exports = router => {
695703 const healthcareWorker = data . healthcareWorker
696704 let nextPage
697705
698- if ( healthcareWorker && healthcareWorker != '' ) {
699- nextPage = '/record-vaccinations/location'
700- } else {
706+ if ( ! healthcareWorker || healthcareWorker === '' ) {
701707 nextPage = '/record-vaccinations/healthcare-worker?showErrors=yes'
708+ } else if ( data . repeatVaccination === "yes" ) {
709+ nextPage = '/record-vaccinations/review-previous'
710+ } else {
711+ nextPage = '/record-vaccinations/location'
702712 }
703713
704714 res . redirect ( nextPage )
@@ -737,7 +747,7 @@ module.exports = router => {
737747 data . newBatchNumber = ""
738748 }
739749
740- res . redirect ( '/record-vaccinations/review-previous' )
750+ res . redirect ( '/record-vaccinations/review-previous?repeatVaccination=yes&repeatPatient=no ' )
741751
742752 } else if ( answer === 'same-patient-another-vaccination' ) {
743753
@@ -759,7 +769,7 @@ module.exports = router => {
759769 req . session . data . legalMechanism = ""
760770 req . session . data . healthcareWorker = ""
761771
762- res . redirect ( '/record-vaccinations/vaccine' )
772+ res . redirect ( '/record-vaccinations/vaccine?repeatPatient=no&repeatVaccination=no ' )
763773 } else {
764774 res . redirect ( '/record-vaccinations/done?showErrors=yes' )
765775 }
0 commit comments