Skip to content

Commit f592149

Browse files
author
Jon Roobottom
committed
content updates
1 parent 43dfd4b commit f592149

7 files changed

Lines changed: 51 additions & 119 deletions

File tree

app/filters.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,15 @@ module.exports = function (env) {
5454
return Math.floor(Math.random() * (max - min + 1)) + min;
5555
}
5656

57+
filters.plural = (word, count, append = 's', prepend = '') => {
58+
if (count === 1) {
59+
return word;
60+
} else {
61+
// Simple pluralisation by adding 's'
62+
return prepend + word + append;
63+
}
64+
}
65+
5766
return filters
5867
}
5968

app/filters/datetime.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ module.exports = function registerDateTimeFilters(filters = {}) {
111111

112112
//follow the nhs date range logic
113113
//https://service-manual.nhs.uk/content/numbers-measurements-dates-time#ranges
114-
filters.nhsDateRange = (firstDate, secondDate, tz = DEFAULT_TZ) => {
114+
filters.nhsDateRange = (firstDate, secondDate, linkWord = 'to', tz = DEFAULT_TZ) => {
115115

116116
const dt1 = toDateTime(firstDate, tz);
117117
const dt2 = toDateTime(secondDate, tz);
@@ -125,16 +125,16 @@ module.exports = function registerDateTimeFilters(filters = {}) {
125125

126126
//same month and year
127127
if (dt1.hasSame(dt2, 'month') && dt1.hasSame(dt2, 'year')) {
128-
return `${dt1.toFormat('d')} to ${dt2.toFormat(DEFAULT_FORMAT)}`;
128+
return `${dt1.toFormat('d')} ${linkWord} ${dt2.toFormat(DEFAULT_FORMAT)}`;
129129
}
130130

131131
//same year
132132
if (dt1.hasSame(dt2, 'year')) {
133-
return `${dt1.toFormat('d LLLL')} to ${dt2.toFormat(DEFAULT_FORMAT)}`;
133+
return `${dt1.toFormat('d LLLL')} ${linkWord} ${dt2.toFormat(DEFAULT_FORMAT)}`;
134134
}
135135

136136
//different years
137-
return `${dt1.toFormat(DEFAULT_FORMAT)} to ${dt2.toFormat(DEFAULT_FORMAT)}`;
137+
return `${dt1.toFormat(DEFAULT_FORMAT)} ${linkWord} ${dt2.toFormat(DEFAULT_FORMAT)}`;
138138
}
139139

140140
filters.isDateBetween = (input, startDate, endDate, tz = DEFAULT_TZ) => {

app/views/site/cancel-availability/cancel-or-edit.html

Lines changed: 0 additions & 45 deletions
This file was deleted.

app/views/site/cancel-availability/dates.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{% extends '../../layouts/layout.html' %}
22

3-
{% set pageName = "Select dates to change" %}
3+
{% set pageName = "Select dates to cancel" %}
44

55
{% block beforeContent %}
66
{{ backLink({

app/views/site/cancel-availability/edit-guidance.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ <h1 class="nhsuk-heading-l">{{ pageName }}</h1>
2121
{# <p>Any bookings you keep will be automatically moved into the new sessions.</p> #}
2222

2323
{{ button({
24-
text: "Continue",
24+
text: "Continue to cancel",
2525
href: '/site/' + site_id + '/cancel-availability/dates'
2626
}) }}
2727
</div>

app/views/site/cancel-availability/sessions-and-bookings.html

Lines changed: 31 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -68,21 +68,24 @@
6868
<td class="nhsuk-table__cell" role="cell">
6969
<span class="nhsuk-table-responsive__heading" aria-hidden="true">Date time </span>{{ session.date | nhsDate }}<br>{{ session.from | nhsTime }} to {{ session.until | nhsTime }}
7070
</td>
71-
<td class="nhsuk-table__cell" role="cell">
72-
<span class="nhsuk-table-responsive__heading" aria-hidden="true">Services </span>
73-
{% for serviceId in session.services %}
74-
{{ data.services[serviceId].name }}{% if not loop.last %}<br>{% endif %}
75-
{% endfor %}
76-
</td>
77-
<td class="nhsuk-table__cell" role="cell">
78-
<span class="nhsuk-table-responsive__heading" aria-hidden="true">Bookings </span>
71+
<td class="nhsuk-table__cell" role="cell" colspan="2">
72+
<span class="nhsuk-table-responsive__heading" aria-hidden="true">Services and bookings </span>
7973
{% set bookingCount = 0 %}
8074
{% for booking in bookings %}
8175
{% if booking.datetime | formatDate('yyyy-MM-dd') == session.date and booking.status == "scheduled" and booking.datetime | isTimeBetween(session.from, session.until) %}
8276
{% set bookingCount = bookingCount + 1 %}
8377
{% endif %}
8478
{% endfor %}
85-
{{ bookingCount }}
79+
{% set displayBookings = 1 %}
80+
<ul class="nhsuk-list">
81+
{% for serviceId in session.services %}
82+
<li>
83+
{{ data.services[serviceId].name }}
84+
{{ displayBookings }}
85+
</li>
86+
{% endfor %}
87+
{% if bookingCount > displayBookings %}{{ displayBookings - 1 }}{% endif %}
88+
</ul>
8689
</td>
8790
<td class="nhsuk-table__cell" role="cell">
8891
<span class="nhsuk-table-responsive__heading" aria-hidden="true">Unbooked </span>
@@ -99,68 +102,27 @@
99102
</table>
100103
{% endmacro %}
101104

102-
{% macro sessionsTable(sessions) %}
103-
<table class="nhsuk-table-responsive" role="table">
104-
<caption class="nhsuk-table__caption">
105-
Sessions details
106-
</caption>
107-
<thead class="nhsuk-table__head" role="rowgroup">
108-
<tr class="nhsuk-table__row" role="row">
109-
<th scope="col" class="nhsuk-table__header nhsuk-u-width-one-quarter" role="columnheader">Date and time</th>
110-
<th scope="col" class="nhsuk-table__header nhsuk-u-width-one-quarter" role="columnheader">Services</th>
111-
</tr>
112-
</thead>
113-
<tbody class="nhsuk-table__body">
114-
{% for session in sessions %}
115-
<tr class="nhsuk-table__row" role="row">
116-
<td class="nhsuk-table__cell" role="cell">
117-
<span class="nhsuk-table-responsive__heading" aria-hidden="true">Date time </span>{{ session.date | nhsDate }}<br>{{ session.from | nhsTime }} to {{ session.until | nhsTime }}
118-
</td>
119-
<td class="nhsuk-table__cell" role="cell">
120-
<span class="nhsuk-table-responsive__heading" aria-hidden="true">Services </span>
121-
{% for serviceId in session.services %}
122-
{{ data.services[serviceId].name }}{% if not loop.last %}<br>{% endif %}
123-
{% endfor %}
124-
</td>
125-
</tr>
126-
{% endfor %}
127-
</tbody>
128-
</table>
129-
{% endmacro %}
130-
131-
{% set pageName = "You are about to cancel " ~affectedSessions|length~ " sessions"%}
105+
{% set pageName = "You are about to cancel " ~affectedSessions|length~ " "~ 'session' | plural(affectedSessions | length) %}
132106

133107
{% block beforeContent %}
134108
{{ backLink({
135109
href: '/site/' + site_id + '/cancel-availability/dates'
136110
}) }}
137111
{% endblock %}
138112

139-
{% set secondParagraph = "Bookings you keep appear in your appointments list. We automatically move them into new sessions when you add matching availability." %}
140-
{% if content == '2' %}
141-
{% set secondParagraph = "By cancelling these sessions, these bookings will be unsupported by a session but they will still appear in your scheduled list of appointments." %}
142-
{% endif %}
143-
{% if content == '3' %}
144-
{% set secondParagraph = "Any bookings you keep will appear in your scheduled list of appointments and these bookings will unsupported by a session unless a new session is created." %}
145-
{% endif %}
146-
147113
{% block content %}
148114
<div class="nhsuk-grid-row">
149115
<div class="nhsuk-grid-column-full">
150116
<h1 class="nhsuk-heading-l">{{ pageName }}</h1>
151117
{% if affectedBookings|length > 0 %}
152-
<p class="nhsuk-u-width-two-thirds">There are {{ affectedBookings | length }} bookings for these sessions.</p>
153-
<p class="nhsuk-u-width-two-thirds">{{ secondParagraph }}</p>
154-
{% if affectedSessions|length > 10 %}
155-
{% call details({
156-
summaryText: "View sessions and bookings",
157-
classes: "nhsuk-expander"
158-
}) %}
159-
{{ sessionsAndBookings(affectedSessions, affectedBookings) }}
160-
{% endcall %}
161-
{% else %}
162-
{{ sessionsAndBookings(affectedSessions, affectedBookings) }}
163-
{% endif %}
118+
<p class="nhsuk-u-width-two-thirds">There are {{ affectedBookings | length }} bookings for these {{ 'session' | plural(affectedSessions | length) }}</p>
119+
120+
{% call details({
121+
summaryText: "View sessions and bookings",
122+
classes: "nhsuk-expander"
123+
}) %}
124+
{{ sessionsAndBookings(affectedSessions, affectedBookings) }}
125+
{% endcall %}
164126

165127
<form method="post" action="/site/{{ site_id }}/cancel-availability/check-answers" class="nhsuk-u-width-two-thirds">
166128
<input type="hidden" name="[cancelAvailability][affectedSessions]" value="{{ affectedSessions | length }}">
@@ -178,12 +140,18 @@ <h1 class="nhsuk-heading-l">{{ pageName }}</h1>
178140
{
179141
value: "keep",
180142
text: "Keep bookings",
181-
checked: true if data.cancelAvailability.keepOrCancelBookings == 'keep'
143+
checked: true if data.cancelAvailability.keepOrCancelBookings == 'keep',
144+
hint: {
145+
text: "These will stay in your appointments list"
146+
}
182147
},
183148
{
184149
value: "cancel",
185150
text: "Cancel bookings",
186-
checked: true if data.cancelAvailability.keepOrCancelBookings == 'cancel'
151+
checked: true if data.cancelAvailability.keepOrCancelBookings == 'cancel',
152+
hint: {
153+
text: "We will email or text them to confirm the cancellation"
154+
}
187155
}
188156
]
189157
}) }}
@@ -193,17 +161,14 @@ <h1 class="nhsuk-heading-l">{{ pageName }}</h1>
193161
</form>
194162

195163
{% else %}
164+
196165
<p>There are no bookings for these sessions.</p>
197-
{% if affectedSessions|length > 10 %}
198166
{% call details({
199167
summaryText: "View sessions",
200168
classes: "nhsuk-expander"
201169
}) %}
202-
{{ sessionsTable(affectedSessions) }}
170+
{{ sessionsAndBookings(affectedSessions, affectedBookings) }}
203171
{% endcall %}
204-
{% else %}
205-
{{ sessionsTable(affectedSessions) }}
206-
{% endif %}
207172
{{
208173
button({
209174
text: "Continue",

app/views/site/cancel-availability/success.html

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,12 @@ <h2 class="nhsuk-heading-m">3 people have not been contacted</h2>
2828
<p>These people did not provide an email or mobile number, and have not been notified that their bookings were cancelled.</p>
2929
<p><a href="#">View the list of people who have not been notified.</a></p>
3030
{% else %}
31-
<p>No bookings were affected by this change.</p>
31+
<p>No bookings were affected by this change. They will stay in your appointments list.</p>
3232
<h2 class="nhsuk-heading-m">What to do next</h2>
33-
<p><a href="/site/{{ site_id }}/availability/day">Go back to availability</a></p>
33+
<ul class="nhsuk-list nhsuk-list--bullet">
34+
<li><a href="/site/{{ site_id }}/create-availability?start={{ startDate }}&end={{ endDate }}">Create availability between {{ startDate | nhsDateRange(endDate, 'and') }}</a></li>
35+
<li><a href="/site/{{ site_id }}/availability/day">Go back to availability</a></li>
36+
</ul>
3437
{% endif %}
3538

3639

0 commit comments

Comments
 (0)