This document catalogs all status enums in Taskr, their allowed transitions,
and database definitions.
Quick Reference
| Entity | Statuses | Terminal States | Workflow |
|---|---|---|---|
| Job | 7 | invoiced, cancelled | Customer Lifecycle |
| Quote | 7 | rejected, expired, converted | Customer Lifecycle |
| Invoice | 6 | paid, canceled | Invoice Payment |
| Fault | 4 | closed | Fault Resolution |
| Purchase Order | 7 | converted, rejected | Customer Lifecycle |
| Expense | 5 | paid, rejected | Financial |
| Timesheet | 5 | billed | Timesheet Billing |
| Compliance | 5 | completed, cancelled | Asset Compliance |
| Asset | 4 | disposed | Asset Compliance |
Job Statuses
type JobStatus =
| "draft" // Created but not ready
| "scheduled" // Assigned and dated
| "in_progress" // Work underway
| "on_hold" // Temporarily paused
| "completed" // Work finished
| "cancelled" // Job cancelled
| "invoiced"; // Invoice generated
Transition Matrix
| From | To | Trigger |
|---|---|---|
| draft | scheduled | Assign tech + set date |
| draft | cancelled | Cancel job |
| scheduled | in_progress | Start work |
| scheduled | cancelled | Cancel job |
| in_progress | completed | Finish work |
| in_progress | on_hold | Pause (waiting) |
| in_progress | cancelled | Cancel job |
| on_hold | in_progress | Resume work |
| completed | invoiced | Generate invoice |
Quote Statuses
type QuoteStatus =
| "draft" // Being prepared
| "sent" // Sent to customer
| "viewed" // Customer opened
| "accepted" // Customer approved
| "rejected" // Customer declined
| "expired" // Validity passed
| "converted"; // Became a job
Invoice Statuses
type InvoiceStatus =
| "draft" // Being prepared
| "pending" // Ready to send
| "unpaid" // Sent, awaiting payment
| "partial" // Partially paid
| "paid" // Fully paid
| "canceled"; // Voided
Fault Statuses
type FaultStatus =
| "open" // Just reported
| "investigating" // Being assessed
| "resolved" // Work completed
| "closed"; // Finalized
Purchase Order Statuses
type POStatus =
| "draft" // Being prepared
| "submitted" // Sent for approval
| "approved" // Approved by customer
| "rejected" // Declined
| "converted" // Became quote or job
| "expired" // Validity passed
| "cancelled"; // Voided
Expense Statuses
type ExpenseStatus =
| "draft" // Being prepared
| "submitted" // Sent for approval
| "approved" // Approved
| "rejected" // Declined
| "paid"; // Reimbursed
Timesheet Statuses
type TimesheetStatus =
| "draft" // Time being entered
| "submitted" // Sent for approval
| "approved" // Time approved
| "rejected" // Time rejected
| "billed"; // Included in invoice
Compliance Schedule Statuses
type ComplianceStatus =
| "upcoming" // Future due date
| "due" // Due date approaching
| "overdue" // Past due date
| "completed" // Work finished
| "cancelled"; // Schedule cancelled
Asset Statuses
type AssetStatus =
| "active" // In service
| "inactive" // Not in use
| "maintenance" // Under repair
| "disposed"; // Removed from service
Status Color Mapping
| Status Category | Color | Meaning |
|---|---|---|
| Draft/Pending | Gray | Not started |
| Active/In Progress | Blue | Work underway |
| Warning/Due | Yellow | Attention needed |
| Success/Complete | Green | Finished successfully |
| Error/Overdue | Red | Problem or late |
| Cancelled | Gray (strikethrough) | Voided |
Implementation
Database Enum
-- Example: Job status enum
CREATE TYPE job_status AS ENUM (
'draft',
'scheduled',
'in_progress',
'on_hold',
'completed',
'cancelled',
'invoiced'
);
Validation Function
// apps/workbooks-api/src/trpc/routers/workbooks-jobs.ts
const validTransitions: Record<JobStatus, JobStatus[]> = {
draft: ["scheduled", "cancelled"],
scheduled: ["in_progress", "cancelled"],
in_progress: ["completed", "on_hold", "cancelled"],
on_hold: ["in_progress", "cancelled"],
completed: ["invoiced"],
cancelled: [],
invoiced: [],
};
function isValidTransition(from: JobStatus, to: JobStatus): boolean {
return validTransitions[from]?.includes(to) ?? false;
}
Related Documentation
Customer Lifecycle
Job and quote status flows
Invoice Payment
Invoice status handling
Asset Compliance
Compliance schedule statuses
Fault Resolution
Fault status transitions