diff --git a/app/assets/sass/components/_calendar-table.scss b/app/assets/sass/components/_calendar-table.scss index 26d2040..eae3d13 100644 --- a/app/assets/sass/components/_calendar-table.scss +++ b/app/assets/sass/components/_calendar-table.scss @@ -38,6 +38,11 @@ background-color: nhsuk-colour("pale-yellow"); } + .calendar-table-td-header { + display: flex; + justify-content: space-between; + } + // the number that is the date .calendar-table-date { display: flex; @@ -47,7 +52,7 @@ height: 2rem; border-radius: 50%; background-color: nhsuk-colour("grey-5"); - margin-bottom: nhsuk-spacing(3); + margin-bottom: nhsuk-spacing(2); } .--date-selected .calendar-table-date { @@ -74,11 +79,11 @@ .--schedule-name { display: block; border-radius: 4px; - background-color: nhsuk-colour("grey-2"); - color: nhsuk-colour("white"); + border: 2px solid $nhsuk-input-border-colour; padding: nhsuk-spacing(1); margin-top: nhsuk-spacing(2); font-size: nhsuk-px-to-rem(14); + color: $nhsuk-input-border-colour; text-wrap: nowrap; } } @@ -106,7 +111,7 @@ display: flex; align-items: center; @include nhsuk-font-size(16); - color: nhsuk-colour("grey-2"); + color: $nhsuk-secondary-text-colour; margin-bottom: nhsuk-spacing(2); } diff --git a/app/routes/clinic-sessions.js b/app/routes/clinic-sessions.js index ce6a768..a0111f8 100644 --- a/app/routes/clinic-sessions.js +++ b/app/routes/clinic-sessions.js @@ -119,12 +119,20 @@ router.post('/sessions/save-template', function (req, res) { delete req.session.data.editingTemplateId req.session.data.sessionTemplateSaved = existing ? 'updated' : 'created' - res.redirect('/sessions/00-template-listing') + res.redirect(takeTemplateReturnPath(req)) }) +// Where to go after saving or cancelling, set when the flow is started from another journey +const takeTemplateReturnPath = (req) => { + const returnPath = req.session.data.sessionTemplateReturnTo || '/sessions/00-template-listing' + delete req.session.data.sessionTemplateReturnTo + return returnPath +} + router.get('/sessions/new-template', function (req, res) { req.session.data.createSessionTemplate = {} delete req.session.data.editingTemplateId + delete req.session.data.sessionTemplateReturnTo res.redirect('/sessions/01-template-name') }) @@ -138,6 +146,7 @@ router.get('/sessions/edit-template/:id', function (req, res) { req.session.data.createSessionTemplate = JSON.parse(JSON.stringify(template.source)) req.session.data.editingTemplateId = template.id + delete req.session.data.sessionTemplateReturnTo res.redirect('/sessions/04-check-template') }) @@ -146,7 +155,7 @@ router.get('/sessions/cancel-edit', function (req, res) { req.session.data.createSessionTemplate = {} delete req.session.data.editingTemplateId - res.redirect('/sessions/00-template-listing') + res.redirect(takeTemplateReturnPath(req)) }) // Shows the success banner once, straight after a template is saved diff --git a/app/routes/create-capacity-from-zero.js b/app/routes/create-capacity-from-zero.js index cd24fe1..34f5067 100644 --- a/app/routes/create-capacity-from-zero.js +++ b/app/routes/create-capacity-from-zero.js @@ -10,7 +10,7 @@ const router = express.Router() // Slot/held totals per session template, matching select-session-template.html const sessionTemplates = { - 'Standard': { totalSlots: 42, heldSlots: 8 }, + 'Standard day': { totalSlots: 42, heldSlots: 8 }, 'Special appointments': { totalSlots: 42, heldSlots: 42 } } @@ -187,7 +187,9 @@ router.get('/create-capacity-from-zero/clinic-summary', function (req, res) { templateName, templateId: matchedTemplate && matchedTemplate.id, totalSlots: template.totalSlots, - heldSlots: template.heldSlots + heldSlots: template.heldSlots, + startTime: matchedTemplate && matchedTemplate.sessionStartLabel, + endTime: matchedTemplate && matchedTemplate.sessionEndLabel }) })) @@ -213,8 +215,25 @@ router.post('/create-capacity-from-zero/select-days', function (req, res) { res.redirect('/create-capacity-from-zero/select-session-template') }) +// Starts the session template flow, returning to the template picker once saved or cancelled +router.get('/create-capacity-from-zero/new-session-template', function (req, res) { + req.session.data.createSessionTemplate = {} + delete req.session.data.editingTemplateId + req.session.data.sessionTemplateReturnTo = '/create-capacity-from-zero/select-session-template' + + res.redirect('/sessions/01-template-name') +}) + +// Shows the success banner and "New" tag once, straight after a template is saved +router.get('/create-capacity-from-zero/select-session-template', function (req, res) { + const templateSaved = req.session.data.sessionTemplateSaved + delete req.session.data.sessionTemplateSaved + + res.render('create-capacity-from-zero/select-session-template', { templateSaved }) +}) + const exampleTemplateSlugs = { - 'standard': 'Standard', + 'standard': 'Standard day', 'special-appointments': 'Special appointments' } @@ -364,4 +383,13 @@ router.post('/create-capacity-from-zero/create-schedule', function (req, res) { }) +router.get('/create-capacity-from-zero/index-manage', function (req, res) { + const today = new Intl.DateTimeFormat('en-GB', { + day: 'numeric', + month: 'long', + year: 'numeric' + }).format(new Date()) + res.render('create-capacity-from-zero/index-manage', { today }) +}); + module.exports = router \ No newline at end of file diff --git a/app/views/create-capacity-from-zero/clinic-summary.html b/app/views/create-capacity-from-zero/clinic-summary.html index 680c908..eebe484 100644 --- a/app/views/create-capacity-from-zero/clinic-summary.html +++ b/app/views/create-capacity-from-zero/clinic-summary.html @@ -16,15 +16,15 @@ {% block content %} {% set padlockSvg %} -
+ - Locked -
+ Locked + {% endset %} {% include "create-capacity-from-zero/_local-includes/clinic-summary.html" %} @@ -54,13 +54,17 @@ {% for dayItem in week %} {% if dayItem %} - {{ dayItem.date }} +
+ {{ dayItem.date }} + {% if dayItem.templateName %} + {{ padlockSvg | safe }} + {% endif %} +
{% if dayItem.templateName %} - {{ padlockSvg | safe }} + Template:

- {{ dayItem.totalSlots }} slots
- 0 booked
- {{ dayItem.heldSlots }} held
+ {{ dayItem.startTime }} to {{ dayItem.endTime }}
+ {{ dayItem.totalSlots }} total slots {% endif %} {% if dayItem.isScheduleStart %} Select schedule @@ -79,18 +83,56 @@ {% endfor %} -
-
-

With selected days:

-
+
+
+
+

+ Availability +

- + +
+
+
+
+

+ Clinic sessions +

+
+
    +
  • + +
  • +
  • + +
  • +
+
+ +
+
+
+
+
+

+ Schedule +

+
    +
  • + +
  • +
  • + +
  • +
diff --git a/app/views/create-capacity-from-zero/create-clinic.html b/app/views/create-capacity-from-zero/create-clinic.html index 2f93783..a54461b 100644 --- a/app/views/create-capacity-from-zero/create-clinic.html +++ b/app/views/create-capacity-from-zero/create-clinic.html @@ -18,51 +18,46 @@ {% block content %}
+
+ + {% if errorState === "true" %} + {% set errorList = [] %} + {% if errors.clinicName %} + {% set errorList = errorList.concat([{ text: errors.clinicName, href: "#clinic-name" }]) %} + {% endif %} + {% if errors.unit %} + {% set errorList = errorList.concat([{ text: errors.unit, href: "#unit" }]) %} + {% endif %} + {% if errors.location %} + {% set errorList = errorList.concat([{ text: errors.location, href: "#location-0" }]) %} + {% endif %} + {{ errorSummary({ + titleText: "There is a problem", + errorList: errorList + }) }} + {% endif %} + +

Clinic details

+ +
+ + {% if errors and errors.clinicName %} + + Error: {{ errors.clinicName }} + + {% endif %} + +
-
-
-
- - {% if errorState === "true" %} - {% set errorList = [] %} - {% if errors.clinicName %} - {% set errorList = errorList.concat([{ text: errors.clinicName, href: "#clinic-name" }]) %} - {% endif %} - {% if errors.unit %} - {% set errorList = errorList.concat([{ text: errors.unit, href: "#unit" }]) %} - {% endif %} - {% if errors.location %} - {% set errorList = errorList.concat([{ text: errors.location, href: "#location-0" }]) %} - {% endif %} - {{ errorSummary({ - titleText: "There is a problem", - errorList: errorList - }) }} - {% endif %} - -

Clinic details

- -
- - {% if errors and errors.clinicName %} - - Error: {{ errors.clinicName }} - - {% endif %} - -
- -
- - -
- -
+
+ +
+
@@ -133,10 +128,13 @@

Clinic details

- -
- - + +
+
+
+ +
+
diff --git a/app/views/create-capacity-from-zero/index-all-clinics.html b/app/views/create-capacity-from-zero/index-all-clinics.html index 2d43365..2d1948e 100644 --- a/app/views/create-capacity-from-zero/index-all-clinics.html +++ b/app/views/create-capacity-from-zero/index-all-clinics.html @@ -106,10 +106,10 @@