Add 'new' status as default, in_transit becomes branch state

New tickets start as 'new' (just created, not yet examined). In Transit
is now a branch status off New for school pickups and shipped instruments.
Intake means the instrument has been physically received and documented.
Status progress bar, labels, filters, and default status all updated.
Removed debug logging from file upload endpoint.
This commit is contained in:
Ryan Moon
2026-03-29 11:45:41 -05:00
parent ba94adb8d7
commit b0379052d6
10 changed files with 28 additions and 9 deletions

View File

@@ -39,6 +39,7 @@ export const Route = createFileRoute('/_authenticated/repairs/$ticketId')({
})
const STATUS_LABELS: Record<string, string> = {
new: 'New',
in_transit: 'In Transit',
intake: 'Intake',
diagnosing: 'Diagnosing',
@@ -52,7 +53,7 @@ const STATUS_LABELS: Record<string, string> = {
cancelled: 'Cancelled',
}
const STATUS_FLOW = ['in_transit', 'intake', 'diagnosing', 'pending_approval', 'approved', 'in_progress', 'ready', 'picked_up']
const STATUS_FLOW = ['new', 'intake', 'diagnosing', 'pending_approval', 'approved', 'in_progress', 'ready', 'picked_up']
const TABS = [
{ key: 'details', label: 'Details' },
@@ -217,6 +218,11 @@ function RepairTicketDetailPage() {
Move to {STATUS_LABELS[nextStatus]}
</Button>
)}
{ticket.status === 'new' && (
<Button variant="secondary" onClick={() => statusMutation.mutate('in_transit')} disabled={statusMutation.isPending}>
In Transit
</Button>
)}
{ticket.status === 'in_progress' && (
<Button variant="secondary" onClick={() => statusMutation.mutate('pending_parts')} disabled={statusMutation.isPending}>
Pending Parts
@@ -235,7 +241,7 @@ function RepairTicketDetailPage() {
</>
)}
{ticket.status === 'cancelled' && hasPermission('repairs.admin') && (
<Button variant="outline" onClick={() => statusMutation.mutate('intake')} disabled={statusMutation.isPending}>
<Button variant="outline" onClick={() => statusMutation.mutate('new')} disabled={statusMutation.isPending}>
<RotateCcw className="mr-2 h-4 w-4" />Reopen
</Button>
)}

View File

@@ -26,6 +26,7 @@ export const Route = createFileRoute('/_authenticated/repairs/')({
function statusBadge(status: string) {
const variants: Record<string, 'default' | 'secondary' | 'destructive' | 'outline'> = {
new: 'outline',
in_transit: 'secondary',
intake: 'outline',
diagnosing: 'secondary',
@@ -39,6 +40,7 @@ function statusBadge(status: string) {
cancelled: 'destructive',
}
const labels: Record<string, string> = {
new: 'New',
in_transit: 'In Transit',
intake: 'Intake',
diagnosing: 'Diagnosing',