feat(reports): simplify dashboards, align OT flow labels, and normalize filters
This commit is contained in:
@@ -2,16 +2,14 @@ import type { WorkOrder } from '@/lib/types'
|
||||
|
||||
export const WORK_ORDER_STATUS_LABEL: Record<WorkOrder['status'], string> = {
|
||||
quote: 'Orçamento',
|
||||
open: 'Orçamento Aprovado',
|
||||
in_progress: 'Em Curso',
|
||||
completed: 'Concluída',
|
||||
invoiced: 'Faturada',
|
||||
in_progress: 'Iniciar Trabalho',
|
||||
completed: 'Concluir OT',
|
||||
invoiced: 'Faturado',
|
||||
cancelled: 'Cancelada',
|
||||
}
|
||||
|
||||
const LIGHT_STATUS_BADGE: Record<WorkOrder['status'], string> = {
|
||||
quote: 'border-[var(--ui-warning)] bg-[var(--ui-warning)] text-[var(--ui-warning-text)]',
|
||||
open: 'border-sky-400 bg-sky-100 text-slate-800',
|
||||
in_progress: 'border-indigo-400 bg-indigo-100 text-slate-800',
|
||||
completed: 'border-emerald-400 bg-emerald-100 text-slate-800',
|
||||
invoiced: 'border-teal-400 bg-teal-100 text-slate-800',
|
||||
@@ -21,3 +19,30 @@ const LIGHT_STATUS_BADGE: Record<WorkOrder['status'], string> = {
|
||||
export function workOrderStatusBadgeClass(status: WorkOrder['status']) {
|
||||
return `border ${LIGHT_STATUS_BADGE[status]}`
|
||||
}
|
||||
|
||||
export type WorkOrderPhase = 'draft' | 'active' | 'done' | 'cancelled'
|
||||
|
||||
export const WORK_ORDER_PHASE_LABEL: Record<WorkOrderPhase, string> = {
|
||||
draft: 'Orçamento',
|
||||
active: 'Iniciar Trabalho',
|
||||
done: 'Concluir OT',
|
||||
cancelled: 'Cancelada',
|
||||
}
|
||||
|
||||
const PHASE_BADGE: Record<WorkOrderPhase, string> = {
|
||||
draft: 'border-amber-300 bg-amber-100 text-amber-900',
|
||||
active: 'border-blue-300 bg-blue-100 text-blue-900',
|
||||
done: 'border-emerald-300 bg-emerald-100 text-emerald-900',
|
||||
cancelled: 'border-[var(--ui-danger)] bg-[var(--ui-danger)] text-[var(--ui-danger-text)]',
|
||||
}
|
||||
|
||||
export function getWorkOrderPhase(status: WorkOrder['status']): WorkOrderPhase {
|
||||
if (status === 'cancelled') return 'cancelled'
|
||||
if (status === 'quote') return 'draft'
|
||||
if (status === 'in_progress') return 'active'
|
||||
return 'done'
|
||||
}
|
||||
|
||||
export function workOrderPhaseBadgeClass(phase: WorkOrderPhase) {
|
||||
return `border ${PHASE_BADGE[phase]}`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user