An NHS Prototype Kit project for managing pharmacy booking sessions, bookings, and blocked 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).
- 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
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'
}
]Add — from the "Block time" button on a session header in the day view:
- Enter start and end times
- If bookings exist in that window, choose to keep or cancel them
- Check your answers
- 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:
- Confirm removal (summary of session, date, times)
- Success confirmation
Removing a block re-opens the slots for bookings. Previously cancelled bookings are not restored.
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
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 |
| 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.
| 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 |
The seed data includes one blocked time entry on site 1:
- Start the server:
npm start - Navigate to
/sites/site_1/bookings?date=2026-03-06 - The "Weekday flu clinic" session shows a "Blocked for 1 hr" row at 10am
- Use the Edit/Remove links to test those flows
- Click "Block time" on a session header to test the add flow