Repair Workflow & Statuses

Repair Workflow & Statuses

Every repair follows a strict 8-status state machine defined by the RepairStatus enum. The workflow enforces valid transitions, tracks progress percentages, and automatically adjusts equipment availability as repairs progress.

Status Lifecycle & Transitions

Status Progress Colour Allowed Transitions
Reported10%warning diagnosed, cancelled
Diagnosed25%info awaiting_approval, awaiting_parts, in_repair, cancelled
Awaiting Approval35%warning awaiting_parts, in_repair, cancelled
Awaiting Parts40%warning in_repair, cancelled
In Repair60%primary testing, completed, cancelled
Testing85%info completed, in_repair (failed test), cancelled
Completed100%success Terminal — no further transitions
Cancelled0%error Terminal — no further transitions

RepairStatus Enum Methods

The backend RepairStatus enum provides the following helper methods:

  • label() — Returns the human-readable display name (e.g. “Awaiting Approval”)
  • color() — Returns the Material Design colour string for UI chips
  • progressPercentage() — Returns the integer percentage (0–100)
  • canTransitionTo(RepairStatus $target) — Returns true if the transition is permitted
  • getNextStatuses() — Returns an array of all valid next status values
  • isTerminal() — Returns true for completed and cancelled
  • isActive() — Returns true for all non-terminal statuses

Equipment Availability on Status Changes

The system automatically adjusts equipment availability when status transitions occur. The behaviour depends on the equipment tracking mode:

Tracking Mode Enter Repair Complete/Cancel
Bulk Reduces available quantity by quantity_affected Restores available quantity
Serialised Sets serial status to “in_repair” Sets serial status to “available”
Unique Sets equipment status to “in_repair” Sets equipment status to “available”

Equipment with critical or major severity is automatically removed from available stock when the repair is created, regardless of the equipment_usable_during_repair toggle.

Project Conflict Detection

When equipment enters repair, the system checks for active project bookings. If conflicts are found, the relevant project managers are notified that the equipment may be unavailable for their upcoming events.

Events Fired

The following domain events are dispatched during the repair lifecycle:

  • RepairCreated — When a new repair record is saved
  • RepairStatusChanged — On every valid status transition
  • RepairAssigned — When a technician or vendor is assigned
  • RepairCompleted — When status reaches completed
  • RepairOverdue — Triggered by the scheduler when a repair passes its deadline

useRepair Composable (Frontend)

The useRepair Vue composable provides reactive helpers for the workflow:

  • allowedTransitions — Computed array of valid next statuses from current state
  • canTransitionTo(status) — Boolean check for a specific target status
  • updateStatus(status, notes?) — Performs the transition with optional notes
  • getStatusColor(status) / getStatusIcon(status) — Returns the Vuetify colour or MDI icon for a status
  • getProgressPercentage(status) — Returns the numeric progress value
  • getPriorityColor(priority) / getPriorityIcon(priority) — Returns colour or icon for priority chips
  • formatStatus(status) — Converts snake_case to Title Case display label
  • isOverdue / daysOverdue — Computed deadline tracking values
  • totalCost — Computed sum of labor_cost + parts_cost + external_cost

Status Icon Reference

StatusIcon
reportedmdi-alert-circle
diagnosedmdi-clipboard-text
awaiting_approvalmdi-clock-alert
awaiting_partsmdi-package-variant-closed
in_repairmdi-progress-wrench
testingmdi-test-tube
completedmdi-check-circle
cancelledmdi-close-circle

Was this article helpful?