I built a web app that matches emergency callouts to technician shifts, lets site managers approve allowances, and exports the approved records as a CSV for payroll.
Imagine a warehouse pump fails at 19:17. Dispatch sends a technician and logs the job. The schedule lives in another system. Before payroll adds an allowance, someone has to check that the technician was rostered at that site when the job came in, then get the manager’s approval.
I used Northline Facilities, a fictional company, to show how that review can work from the two source files through to the payroll handoff.
The workflow
From source files to payroll
01 · Operations
Import the dispatches and roster
Operations uploads both CSVs for the company. The importer checks the rows before saving the batch and reports which records were added or already saved. Uploading the same records again keeps a single copy of each.
The repeat dispatch upload processed 172 rows. All 172 were already on file.
02 · Roster matching
See which callouts need a closer look
PostgreSQL checks the company, site, technician and callout time against the roster. Shift review distinguishes a single match from a missing shift, overlapping shifts or a missing technician code.
The 03:03 Depot callout matches a shift that started the previous night. The Central overlap is flagged for review.
03 · Site manager
Approve an eligible callout
The manager works from the records for their assigned site. When they approve an eligible callout, the database checks the match again and saves the shift, amount, reviewer and approval time.
The Central manager can approve matched callouts for Central. Rows with a scheduling exception still need investigation.
04 · Payroll handoff
Download the approved allowances
Operations opens the approved ledger and downloads a CSV for payroll. Each row carries the saved approval details, so payroll can trace the amount back to the callout and the person who signed it off.
The captured demo run shows two approved allowances totalling £50.
Behind the screens
Where the rules live
Next.js and TypeScript handle the pages, CSV upload and approval actions.
Supabase Auth signs users in. PostgreSQL access policies scope records to the user’s company or assigned site.
PostgreSQL validates imports, matches shifts and stores the approved record. Database functions check permissions for imports, approvals and exports.
The SQL checks run with temporary records and roll them back when they finish. The import suite covers cases such as re-uploading the same records or submitting a row for a site outside the selected company.
A captured run of the import test suite in Supabase. Twelve CSV import checks passed.
Try Callout Review
Try both roles in a sample Northline Facilities workspace without signing in.