Skip to content

Commit 74858a4

Browse files
Provide option to invite home-schooled children to a clinic
1 parent e5e362e commit 74858a4

5 files changed

Lines changed: 59 additions & 1 deletion

File tree

app/controllers/school.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -450,5 +450,29 @@ export const schoolController = {
450450
request.flash('success', __(`school.delete.success`))
451451

452452
response.redirect(referrer)
453+
},
454+
455+
inviteToClinic(request, response) {
456+
const { school_id } = request.params
457+
const { data } = request.session
458+
const { __mf } = response.locals
459+
460+
const school = School.findOne(school_id, data)
461+
462+
// Find patients to invite to clinic
463+
const patientSessionsForClinic = school.patients.map(
464+
(patient) => patient.uuid
465+
)
466+
467+
// TODO: Move patients to clinic
468+
469+
request.flash(
470+
'success',
471+
__mf(`school.inviteToClinic.success`, {
472+
count: patientSessionsForClinic.length
473+
})
474+
)
475+
476+
response.redirect(school.uri)
453477
}
454478
}

app/locales/en.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1535,6 +1535,17 @@ export const en = {
15351535
yes: 'Yes, I want to add this school',
15361536
no: 'No, I want to add a different school'
15371537
},
1538+
inviteToClinic: {
1539+
title: 'Invite parents to book a clinic appointment',
1540+
label: 'Send clinic invitations',
1541+
count:
1542+
'{count, plural, =0 {No children} one {1 child} other {# children}} have not been vaccinated. They have not been invited to a clinic yet.',
1543+
description:
1544+
'You can now send clinic booking invitations to their parents.\n\nThe next clinic is on %s.',
1545+
confirm: 'Send clinic invitations',
1546+
success:
1547+
'{count, plural, =0 {No children} one {1 child} other {# children}} invited to the clinic'
1548+
},
15381549
patients: {
15391550
label: 'Children',
15401551
title: 'Children'

app/routes/school.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ router.get('/:school_id/sessions', school.readSessions)
3232
router.all('/:school_id', school.readPatients)
3333
router.post('/:school_id', school.filterPatients)
3434

35+
router.post('/:school_id/invite-to-clinic', school.inviteToClinic)
36+
3537
router.get('/:school_id{/:view}', school.show)
3638

3739
export const schoolRoutes = router
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{% extends "_layouts/form.njk" %}
2+
3+
{% set title = __("school.inviteToClinic.title") %}
4+
{% set confirmButtonText = __("school.inviteToClinic.confirm") %}
5+
6+
{% block form %}
7+
{{ appHeading({
8+
caption: school.name,
9+
title: title
10+
}) }}
11+
12+
{{ __mf("school.inviteToClinic.count", {
13+
count: school.patients.length
14+
}) | nhsukMarkdown }}
15+
16+
{{ __("school.inviteToClinic.description", "1 June 2026") | nhsukMarkdown }}
17+
{% endblock %}

app/views/school/show.njk

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,11 @@
3232
classes: "nhsuk-button--secondary",
3333
href: "/uploads/new?type=" + UploadType.School + "&school_id=" + school.id,
3434
text: __("session.upload-class-list.title")
35-
}) if school.id != "888888" and school.id != "999999" }}
35+
} if not school.homeOrUnknown else {
36+
classes: "nhsuk-button--secondary",
37+
href: school.uri + "/invite-to-clinic",
38+
text: __("session.inviteToClinic.label")
39+
}) }}
3640

3741
<div class="nhsuk-grid-row">
3842
<app-auto-submit class="app-grid-column-filters">

0 commit comments

Comments
 (0)