Jobs & customersLifecycle

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

StateMeaning
pendingCreated, not yet started. Waiting for material assignment.
in_progressMaterial assigned, may have parts cut.
completedAll parts cut. Ready to ship.
shippedCustomer has the parts. Job closed.
cancelledTerminated 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).

pendingin_progresscompletedshipped
The default flow is top-down. Cancellation is reachable from any state and is its own terminal.

The job record

jobs:

ColumnNotes
id, barcodeUUIDs
customer_name, customer_email, customer_phone, customer_notesInline customer info — see why no separate CRM
material_idFK
partsJSONB — array of { polygon, quantity, allow_rotation }
statusOne of the five values
prioritylow / normal / high / rush
due_dateCustomer-promised date
assigned_operator_idNullable FK to auth.users
roll_idFK to inventory.rolls, populated on assignment

Side effects per transition

Each state change triggers:

pending → in_progress

  • Roll assigned and inventory.rolls.remaining_area reserved (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_email is 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_at populated
  • 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:

  1. priority desc (rush > high > normal > low)
  2. due_date asc
  3. created_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.

See also