Job lifecycle
A Rubberfit job moves through five states. Each transition is recorded with the operator, timestamp, and the row’s prior values.
The five states
| State | Meaning |
|---|---|
pending | Created, not yet started. Waiting for material assignment. |
in_progress | Material assigned, may have parts cut. |
completed | All parts cut. Ready to ship. |
shipped | Customer has the parts. Job closed. |
cancelled | Terminated before completion. |
State transitions
pending → in_progress happens automatically when a roll is assigned. in_progress → completed happens automatically when the last part is scanned cut. completed → shipped requires a manual action — the shipping team scans the job barcode at the loading dock, and the system flips the status. Any state can transition to cancelled (with a manager+ role and a reason note).
The job record
jobs:
| Column | Notes |
|---|---|
id, barcode | UUIDs |
customer_name, customer_email, customer_phone, customer_notes | Inline customer info — see why no separate CRM |
material_id | FK |
parts | JSONB — array of { polygon, quantity, allow_rotation } |
status | One of the five values |
priority | low / normal / high / rush |
due_date | Customer-promised date |
assigned_operator_id | Nullable FK to auth.users |
roll_id | FK to inventory.rolls, populated on assignment |
Side effects per transition
Each state change triggers:
pending → in_progress
- Roll assigned and
inventory.rolls.remaining_areareserved (not decremented yet) - Notification to the assigned operator
- The transition is recorded with the actor, timestamp, and prior values
in_progress → completed
- Triggered by the final part-cut scan
- The customer-facing PDF is generated and stored at a signed URL
- A notification is sent to the customer email (if
customer_emailis set) - The transition is recorded
- The shipping team’s queue surfaces the job
completed → shipped
- Operator scans the job barcode at the loading dock
- Status flips,
shipped_atpopulated - The customer-facing PDF gains a “Shipped” stamp
- The transition is recorded
any → cancelled
- Requires a manager+ role and a reason note
- Reserved roll area is released back to inventory
- The customer is notified by email
- The job barcode is marked invalid for future scans
- A row is recorded with the reason
A cancelled job cannot be uncancelled. Operators who need to recover work create a new job with the same parts and reference the cancelled job’s ID in the notes.
Priority sort
The dashboard cut queue sorts by:
priority desc(rush > high > normal > low)due_date asccreated_at asc
A rush job with a far-future due date still sorts above a normal job with today’s due date. This is intentional — operators should be able to see “what’s the most urgent thing right now” without doing date math.