Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
114 changes: 0 additions & 114 deletions app/routes/clinics.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 7 additions & 8 deletions app/routes/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
2 changes: 1 addition & 1 deletion app/views/_templates/layout-base.html
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
text: "Log out"
}
]
},
} if not hideAccountMenu,
service: {
text: serviceName,
href: rootHref
Expand Down
3 changes: 3 additions & 0 deletions app/views/events/attended-not-screened-reason.html
Original file line number Diff line number Diff line change
Expand Up @@ -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) %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}

<h1 class="nhsuk-heading-l">
Expand Down
3 changes: 3 additions & 0 deletions app/views/events/exit-appointment.html
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}

<h1 class="nhsuk-heading-l">{{ pageHeading }}</h1>
Expand Down
20 changes: 20 additions & 0 deletions app/views/example-pages/404.html
Original file line number Diff line number Diff line change
@@ -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 %}

<h1>{{ pageHeading }}</h1>

<p>If you typed the web address, check it is correct.</p>

<p>If you pasted the web address, check you copied the entire address.</p>

<p>If the web address is correct or you selected a link or button, <a href="#">contact us</a> if you need to speak to someone about managing breast screening.</p>

{% endblock %}

17 changes: 17 additions & 0 deletions app/views/example-pages/500.html
Original file line number Diff line number Diff line change
@@ -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 %}

<h1>{{ pageHeading }}</h1>

<p>Try again later.</p>

<p>If you need to speak to someone about managing breast screening, you can <a href="#">contact us</a>.</p>

{% endblock %}
49 changes: 49 additions & 0 deletions app/views/example-pages/confirm-delete.html
Original file line number Diff line number Diff line change
@@ -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 %}

<h1>{{ pageHeading }}</h1>

<p>
[Details about the thing being deleted]
</p>

{% set insetTextHtml %}
<p>
This action is final and cannot be undone
</p>
{% endset %}

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


<div class="nhsuk-button-group">
{{ button({
text: "Delete [name of thing]",
classes: "nhsuk-button--warning"
}) }}

<a href="#" class="nhsuk-link nhsuk-link--no-visited-state">Cancel</a>
</div>

{% endblock %}
26 changes: 26 additions & 0 deletions app/views/example-pages/service-unavailable-planned.html
Original file line number Diff line number Diff line change
@@ -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 %}

<h1>{{ pageHeading }}</h1>

<p>
The service is unavailable due to planned maintenance.
</p>

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

<p>
[Message about who to contact in an emergency]
</p>

{% endblock %}
40 changes: 40 additions & 0 deletions app/views/example-pages/service-unavailable-unplanned.html
Original file line number Diff line number Diff line change
@@ -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 %}

<h1>{{ pageHeading }}</h1>

<p>
{{ serviceName }} is unavailable right now. We’re doing our best to fix the issue.
</p>

<p>
We will continue to put updates on this page to keep you informed.
</p>

{% set insetTextHtml %}
<h2 class="nhsuk-heading-s">
1:11pm, {{ today() | remove(1, 'day') | formatDate("dddd D MMMM YYYY") }}
</h2>
<p>
We are aware of an issue affecting the service and are working to resolve it as quickly as possible. We apologise for the inconvenience.
</p>
{% endset %}

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

<p>
[Message about who to contact in an emergency]
</p>

{% endblock %}
20 changes: 20 additions & 0 deletions app/views/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,26 @@ <h2>Other sections</h2>

</ul>

<h2>Example pages</h2>

<ul>
<li>
<a href="/example-pages/404">404 - Page not found</a>
</li>
<li>
<a href="/example-pages/500">500 - Sorry, there is a problem with the service</a>
</li>
<li>
<a href="/example-pages/service-unavailable-planned">Service unavailable - planned downtime</a>
</li>
<li>
<a href="/example-pages/service-unavailable-unplanned">Service unavailable - unplanned downtime</a>
</li>
<li>
<a href="/example-pages/confirm-delete">Confirm delete</a>
</li>
</ul>

<h2>Prototype stuff</h2>

<ul>
Expand Down