Managing staff allocation in a healthcare or ward setting can be a daily challenge—especially when it comes to organizing shifts, accounting for breaks, and ensuring fair task distribution. In this post, I’ll show you how to build an interactive, mobile-friendly Shift Allocation Tool using pure HTML, CSS, and JavaScript.
This tool allows you to:
Add staff with their break times and roles
Assign special care requirements (1:1, 2:1, Seclusion)
Automatically distribute staff to tasks
Print or export the allocation schedule
Let’s dive in
Features
Easy staff input interface
Role-based assignment (General Obs, 1:1, 2:1, etc.)
Automatic randomized distribution avoiding duplicates and breaks
First slot honors manually chosen special care assignments
Fully responsive layout
1-click printable output
Step-by-Step Breakdown
1. Staff Management
Each staff member is added via a form with:
Name
Role (e.g., Nurse, Meds, Safety Nurse, Extra)
Break time (drop-down from predefined slots)
2. Special Care Requirements
With one click, you can define how many staff are needed for:
1:1 supervision
2:1 supervision
Seclusion
You can assign specific people to these for the first time slot only; the rest is randomized fairly.
3. Randomized Allocation
The script checks:
If the person is on break
If they’re already assigned in that time slot
Rotates among remaining available staff
This ensures a balanced and fair distribution of workload across the shift.
4. Print Feature
After generating the allocation, just click the “🖨️ Print Result” button. The page is print-optimized so it will look clean and organized on paper or PDF.
How to Use It in WordPress
Open your WordPress dashboard
Create a new Page or Post
Switch to the Code Editor (Top-right menu → Code Editor)
Paste the full HTML script
Publish and enjoy
Final Thoughts
This script is especially helpful for healthcare teams, hospitals, or any workplace with scheduled duties and staff rotation. You can also customize it to export CSVs or connect to a backend later if needed.
If you’d like to upgrade this with database features, role filters, or PDF export, let me know—I’m planning to release an advanced version soon.
Demo
click on this link to preview the demo