diff --git a/app/routes/clinics.js b/app/routes/clinics.js index 0dddd6eb..7b4e2d66 100644 --- a/app/routes/clinics.js +++ b/app/routes/clinics.js @@ -106,120 +106,6 @@ module.exports = (router) => { }) }) - // const QUESTIONNAIRE_SECTIONS = ['health-status', 'medical-history', 'current-symptoms'] - - // // Helper to get next section - // const getNextSection = (currentSection) => { - // const currentIndex = QUESTIONNAIRE_SECTIONS.indexOf(currentSection) - // return QUESTIONNAIRE_SECTIONS[currentIndex + 1] - // } - - // // Check your answers - route needs to be before later wildcard route - // router.get('/clinics/:clinicId/participants/:participantId/questionnaire/summary', (req, res) => { - // const { clinicId, participantId } = req.params - - // const participant = req.session.data.participants.find(p => p.id === participantId) - // const clinic = req.session.data.clinics.find(c => c.id === clinicId) - // const event = req.session.data.events.find(e => - // e.clinicId === clinicId && - // e.participantId === participantId - // ) - - // if (!participant || !clinic || !event) { - // res.redirect('/clinics/' + clinicId) - // return - // } - - // // Collect all questionnaire data - // const questionnaireData = QUESTIONNAIRE_SECTIONS.reduce((acc, section) => { - // acc[section] = req.session.data[`questionnaire_${section}`] || {} - // return acc - // }, {}) - - // res.render('participants/questionnaire/summary', { - // participant, - // clinic, - // event, - // clinicId, - // participantId, - // questionnaireData, - // }) - // }) - - // // Base questionnaire route - // router.get('/clinics/:clinicId/participants/:participantId/questionnaire/:section', (req, res) => { - // const { clinicId, participantId, section } = req.params - - // // Validate section name - // if (!QUESTIONNAIRE_SECTIONS.includes(section)) { - // res.redirect(`/clinics/${clinicId}/participants/${participantId}/questionnaire/health-status`) - // return - // } - - // const participant = req.session.data.participants.find(p => p.id === participantId) - // const clinic = req.session.data.clinics.find(c => c.id === clinicId) - // const event = req.session.data.events.find(e => - // e.clinicId === clinicId && - // e.participantId === participantId - // ) - - // if (!participant || !clinic || !event) { - // res.redirect('/clinics/' + clinicId) - // return - // } - - // res.render(`participants/questionnaire/${section}`, { - // participant, - // clinic, - // event, - // clinicId, - // participantId, - // currentSection: section, - // sections: QUESTIONNAIRE_SECTIONS, - // }) - // }) - - // // After summary confirmation, we could save back to participant record - // router.post('/clinics/:clinicId/participants/:participantId/questionnaire/complete', (req, res) => { - // const { clinicId, participantId } = req.params - - // // Find participant - // const participantIndex = req.session.data.participants.findIndex(p => p.id === participantId) - - // if (participantIndex !== -1) { - // // Update participant record with questionnaire data - // req.session.data.participants[participantIndex] = { - // ...req.session.data.participants[participantIndex], - // questionnaire: req.session.data.questionnaire, - // } - // } - - // // Clear questionnaire data from session - // delete req.session.data.questionnaire - - // res.redirect(`/clinics/${clinicId}/participants/${participantId}`) - // }) - - // // Handle form submissions - // router.post('/clinics/:clinicId/participants/:participantId/questionnaire/:section', (req, res) => { - // const { clinicId, participantId, section } = req.params - - // // Get next section - // const nextSection = getNextSection(section) - - // if (nextSection) { - // res.redirect(`/clinics/${clinicId}/participants/${participantId}/questionnaire/${nextSection}`) - // } else { - // res.redirect(`/clinics/${clinicId}/participants/${participantId}/questionnaire/summary`) - // } - // }) - - // // Add a convenience redirect from the base questionnaire URL to the first section - // router.get('/clinics/:clinicId/participants/:participantId/questionnaire', (req, res) => { - // const { clinicId, participantId } = req.params - // res.redirect(`/clinics/${clinicId}/participants/${participantId}/questionnaire/health-status`) - // }) - // Handle check-in router.get('/clinics/:clinicId/check-in/:eventId', (req, res) => { const { clinicId, eventId } = req.params diff --git a/app/routes/events.js b/app/routes/events.js index e73100b6..09e75320 100644 --- a/app/routes/events.js +++ b/app/routes/events.js @@ -2545,25 +2545,24 @@ module.exports = (router) => { return } - // Capture session end time only if appointment was started - const event = getEvent(data, eventId) - if (event?.sessionDetails?.startedAt) { - captureSessionEndTime(data, eventId, data.currentUser.id) - } - // If yes, redirect to reschedule page if (needsReschedule === 'yes') { // Save the appointmentStopped data before redirecting + // Don't update status yet - keep workflow active until reschedule is complete saveTempEventToEvent(data) saveTempParticipantToParticipant(data) - updateEventStatus(data, eventId, 'event_attended_not_screened') res.redirect( `/clinics/${clinicId}/events/${eventId}/cancel-or-reschedule-appointment/reschedule` ) } else { - // Get participant info BEFORE saving (which clears temp data) + // Capture session end time only if appointment was started + const event = getEvent(data, eventId) + if (event?.sessionDetails?.startedAt) { + captureSessionEndTime(data, eventId, data.currentUser.id) + } + // Get participant info BEFORE saving (which clears temp data) saveTempEventToEvent(data) saveTempParticipantToParticipant(data) updateEventStatus(data, eventId, 'event_attended_not_screened') diff --git a/app/views/_templates/layout-base.html b/app/views/_templates/layout-base.html index f32a1224..5394ae35 100644 --- a/app/views/_templates/layout-base.html +++ b/app/views/_templates/layout-base.html @@ -93,7 +93,7 @@ text: "Log out" } ] - }, + } if not hideAccountMenu, service: { text: serviceName, href: rootHref diff --git a/app/views/events/attended-not-screened-reason.html b/app/views/events/attended-not-screened-reason.html index 1b7c5b73..2c39b61b 100644 --- a/app/views/events/attended-not-screened-reason.html +++ b/app/views/events/attended-not-screened-reason.html @@ -6,6 +6,9 @@ {% set formAction = './attended-not-screened-answer' %} +{# Suppress nav as we don't want the user to leave without making a decision #} +{% set useMinimalNav = true %} + {% block pageContent %} {% set unit = data.breastScreeningUnits | findById(clinic.breastScreeningUnitId) %} diff --git a/app/views/events/cancel-or-reschedule-appointment/reschedule.html b/app/views/events/cancel-or-reschedule-appointment/reschedule.html index e97fa98e..05efd188 100644 --- a/app/views/events/cancel-or-reschedule-appointment/reschedule.html +++ b/app/views/events/cancel-or-reschedule-appointment/reschedule.html @@ -8,6 +8,9 @@ {% set formAction = "./reschedule-answer" %} +{# Suppress nav as we don't want the user to leave without making a decision #} +{% set useMinimalNav = true %} + {% block pageContent %}

diff --git a/app/views/events/exit-appointment.html b/app/views/events/exit-appointment.html index 723a7cb5..115e0f3b 100644 --- a/app/views/events/exit-appointment.html +++ b/app/views/events/exit-appointment.html @@ -5,6 +5,9 @@ {% set pageHeading = "Exit appointment" %} {% set formAction = eventUrl + "/exit-appointment-answer" %} +{# Suppress nav as it's a link to the page we're on #} +{% set useMinimalNav = true %} + {% block pageContent %}

{{ pageHeading }}

diff --git a/app/views/example-pages/404.html b/app/views/example-pages/404.html new file mode 100644 index 00000000..43ae0f89 --- /dev/null +++ b/app/views/example-pages/404.html @@ -0,0 +1,20 @@ +{# app/views/example-pages/404.html #} + +{% extends "layout-app.html" %} + +{% set pageHeading = "Page not found" %} +{# {% set useMinimalNav = true %} #} +{% set hideBackLink = true %} + +{% block pageContent %} + +

{{ pageHeading }}

+ +

If you typed the web address, check it is correct.

+ +

If you pasted the web address, check you copied the entire address.

+ +

If the web address is correct or you selected a link or button, contact us if you need to speak to someone about managing breast screening.

+ +{% endblock %} + \ No newline at end of file diff --git a/app/views/example-pages/500.html b/app/views/example-pages/500.html new file mode 100644 index 00000000..54f3227d --- /dev/null +++ b/app/views/example-pages/500.html @@ -0,0 +1,17 @@ +{# app/views/example-pages/500.html #} + +{% extends "layout-app.html" %} + +{% set pageHeading = "Sorry, there is a problem with the service" %} +{% set useMinimalNav = true %} +{% set hideBackLink = true %} + +{% block pageContent %} + +

{{ pageHeading }}

+ +

Try again later.

+ +

If you need to speak to someone about managing breast screening, you can contact us.

+ +{% endblock %} diff --git a/app/views/example-pages/confirm-delete.html b/app/views/example-pages/confirm-delete.html new file mode 100644 index 00000000..dff7db7c --- /dev/null +++ b/app/views/example-pages/confirm-delete.html @@ -0,0 +1,49 @@ +{# app/views/example-pages/500.html #} + +{% extends "layout-appointment.html" %} + +{% set pageHeading = "Are you sure you want to delete this [name of thing]?" %} +{% set useMinimalNav = true %} +{% set hideBackLink = true %} +{# {% set showNavigation = true %} #} +{% set isAppointmentWorkflow = true %} + +{# Janet Williams #} +{% set eventId = "5gpn41oi" %} +{% set participantId = "bc724e9f" %} +{% set clinicId = "wtrl7jud" %} +{% set participant = data | getParticipant(participantId) %} +{% set clinic = data.clinics | findById(clinicId) %} +{% set event = data.events | findById(eventId) %} + + +{% block pageContent %} + +

{{ pageHeading }}

+ +

+ [Details about the thing being deleted] +

+ + {% set insetTextHtml %} +

+ This action is final and cannot be undone +

+ {% endset %} + + {{ insetText({ + html: insetTextHtml, + classes: "nhsuk-u-margin-top-6 nhsuk-u-margin-bottom-6" + }) }} + + +
+ {{ button({ + text: "Delete [name of thing]", + classes: "nhsuk-button--warning" + }) }} + + Cancel +
+ +{% endblock %} diff --git a/app/views/example-pages/service-unavailable-planned.html b/app/views/example-pages/service-unavailable-planned.html new file mode 100644 index 00000000..198c59a8 --- /dev/null +++ b/app/views/example-pages/service-unavailable-planned.html @@ -0,0 +1,26 @@ +{# app/views/example-pages/500.html #} + +{% extends "layout-app.html" %} + +{% set pageHeading = "Sorry, this service is unavailable" %} +{% set useMinimalNav = true %} +{% set hideBackLink = true %} +{% set hideAccountMenu = true %} + +{% block pageContent %} + +

{{ pageHeading }}

+ +

+ The service is unavailable due to planned maintenance. +

+ +

+ You will be able to use the service from 9am on {{ today() | add(1, 'day') | formatDate("dddd D MMMM YYYY") }}. +

+ +

+ [Message about who to contact in an emergency] +

+ +{% endblock %} diff --git a/app/views/example-pages/service-unavailable-unplanned.html b/app/views/example-pages/service-unavailable-unplanned.html new file mode 100644 index 00000000..3f2aa057 --- /dev/null +++ b/app/views/example-pages/service-unavailable-unplanned.html @@ -0,0 +1,40 @@ +{# app/views/example-pages/500.html #} + +{% extends "layout-app.html" %} + +{% set pageHeading = "Sorry, this service is unavailable" %} +{% set useMinimalNav = true %} +{% set hideBackLink = true %} +{% set hideAccountMenu = true %} + +{% block pageContent %} + +

{{ pageHeading }}

+ +

+ {{ serviceName }} is unavailable right now. We’re doing our best to fix the issue. +

+ +

+ We will continue to put updates on this page to keep you informed. +

+ + {% set insetTextHtml %} +

+ 1:11pm, {{ today() | remove(1, 'day') | formatDate("dddd D MMMM YYYY") }} +

+

+ We are aware of an issue affecting the service and are working to resolve it as quickly as possible. We apologise for the inconvenience. +

+ {% endset %} + + {{ insetText({ + html: insetTextHtml, + classes: "nhsuk-u-margin-top-6 nhsuk-u-margin-bottom-6" + }) }} + +

+ [Message about who to contact in an emergency] +

+ +{% endblock %} diff --git a/app/views/index.html b/app/views/index.html index 07e3c733..016ac790 100755 --- a/app/views/index.html +++ b/app/views/index.html @@ -200,6 +200,26 @@

Other sections

+

Example pages

+ + +

Prototype stuff