Skip to content

Commit c76abbc

Browse files
committed
Add homepage links for booking into clinic journeys
One link per primary programme (aka session preset).
1 parent 11151e0 commit c76abbc

3 files changed

Lines changed: 37 additions & 0 deletions

File tree

app/middleware/navigation.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { SessionPresetName } from '../enums.js'
22
import { Session } from '../models.js'
3+
import { getClinicBookingUrl } from '../utils/clinic-booking.js'
34
import { formatDate, today } from '../utils/date.js'
45
import { getSessionConsentUrl } from '../utils/session.js'
56

@@ -23,6 +24,12 @@ export const navigation = (request, response, next) => {
2324
HPV: getSessionConsentUrl(sessions, SessionPresetName.HPV),
2425
Doubles: getSessionConsentUrl(sessions, SessionPresetName.Doubles),
2526
'MMR(V)': getSessionConsentUrl(sessions, SessionPresetName.MMR)
27+
},
28+
clinicBookingUrl: {
29+
Flu: getClinicBookingUrl(SessionPresetName.Flu),
30+
HPV: getClinicBookingUrl(SessionPresetName.HPV),
31+
Doubles: getClinicBookingUrl(SessionPresetName.Doubles),
32+
'MMR(V)': getClinicBookingUrl(SessionPresetName.MMR)
2633
}
2734
}
2835

app/utils/clinic-booking.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { SessionPresets } from '../enums.js'
2+
3+
/**
4+
* Generate a URL for booking into a clinic whose primary programme is given by the session preset
5+
*
6+
* @param {string} sessionPresetName - the primary programme for the clinic
7+
*/
8+
export const getClinicBookingUrl = (sessionPresetName) => {
9+
const sessionPreset = SessionPresets.find(
10+
(preset) => preset.name === sessionPresetName
11+
)
12+
return `/book-into-a-clinic/${sessionPreset.slug}`
13+
}

app/views/index.njk

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,23 @@
7171
}) }}
7272
{% endif %}
7373
{% endfor %}
74+
75+
{{ appHeading({
76+
level: 2,
77+
title: "Book into a clinic",
78+
size: "m"
79+
}) }}
80+
81+
{% for preset in SessionPresets %}
82+
{% if preset.active %}
83+
{{ actionLink({
84+
classes: "nhsuk-u-margin-bottom-2",
85+
text: "Start page for parents to book into a clinic for " + preset.name | replace("Flu", "flu"),
86+
href: navigation.clinicBookingUrl[preset.name] + "/start"
87+
}) }}
88+
{% endif %}
89+
{% endfor %}
90+
7491
</main>
7592
</div>
7693
{% endblock %}

0 commit comments

Comments
 (0)