Skip to content

NHSDigital/mya-provocotype

Repository files navigation

Manage Your Appointments — Prototype

An NHS Prototype Kit project for managing pharmacy booking sessions, bookings, and blocked time.

Block Time

Block time lets pharmacy staff block out a one-off time window within a session on a specific date — for example, "no bookings next Friday between 1pm and 3pm." It's different from breaks (which are recurring and part of the session definition) and site closures (which are full-day and site-wide).

How it works

  • Each block is per-session and per-date (not site-wide)
  • Blocked slots appear as a distinct row in the day view bookings table
  • If existing bookings fall within the blocked window, the user is asked whether to keep or cancel them
  • Cancelled patients are notified by text or email where possible

Data model

Each site has a blockedTimes array in app/data/seed.js:

blockedTimes: [
  {
    id: 'bt_1',
    availabilityId: 'avail_1',   // links to a specific session
    date: '2026-03-06',          // the date this block applies to
    startTime: '10:00',
    endTime: '11:00'
  }
]

User flows

Add — from the "Block time" button on a session header in the day view:

  1. Enter start and end times
  2. If bookings exist in that window, choose to keep or cancel them
  3. Check your answers
  4. Success confirmation (with notification details if bookings were cancelled)

Edit — from the "Edit" link on a blocked row:

Same flow as add, but pre-populated with existing times. Updates the block in-place.

Remove — from the "Remove" link on a blocked row:

  1. Confirm removal (summary of session, date, times)
  2. Success confirmation

Removing a block re-opens the slots for bookings. Previously cancelled bookings are not restored.

Display

In the bookings day view, blocked time appears as a highlighted row:

  • Yellow left border + grey background
  • Shows the start time and duration (e.g. "Blocked for 1 hr")
  • Edit and Remove action links
  • Bookings that were kept still appear as normal rows within the blocked window

Routes

All block time routes are in app/routes.js:

URL pattern Purpose
/sites/:siteId/block-time/:availId/:date Add block time form
/sites/:siteId/block-time/:availId/:date/warning Bookings warning (keep/cancel)
/sites/:siteId/block-time/:availId/:date/check Check your answers
/sites/:siteId/block-time/:availId/:date/success Add success
/sites/:siteId/block-time/:blockId/edit Edit block time form
/sites/:siteId/block-time/:blockId/edit/check Edit check your answers
/sites/:siteId/block-time/:blockId/edit/success Edit success
/sites/:siteId/block-time/:blockId/remove Remove confirmation
/sites/:siteId/block-time/:blockId/remove/success Remove success

Templates

File Purpose
block-time-form.html Start/end time inputs
block-time-check.html Check your answers summary
block-time-success.html Success confirmation + notification info
block-time-remove.html Remove confirmation
block-time-remove-success.html Remove success

The warning step reuses availability-shared-warning.html (keep/cancel radios). The not-notified page reuses availability-shared-not-notified.html.

Key functions in routes.js

Function Purpose
getBookingsInWindow() Finds scheduled bookings within a time window for a session + date
buildDisplayRows() Builds the day view table rows, including blocked time grouping
getSessionsForDate() Returns sessions active on a given date with computed slots
parseTime() Parses flexible time input (e.g. "9am", "13:00") into HH:MM

Testing

The seed data includes one blocked time entry on site 1:

  1. Start the server: npm start
  2. Navigate to /sites/site_1/bookings?date=2026-03-06
  3. The "Weekday flu clinic" session shows a "Blocked for 1 hr" row at 10am
  4. Use the Edit/Remove links to test those flows
  5. Click "Block time" on a session header to test the add flow

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors