diff --git a/src/components/JobStatusNavigation.tsx b/src/components/JobStatusNavigation.tsx index 206a520..9eedc6a 100644 --- a/src/components/JobStatusNavigation.tsx +++ b/src/components/JobStatusNavigation.tsx @@ -2,7 +2,7 @@ import { ChevronLeft, ChevronRight } from 'lucide-react'; import { Button } from '@/components/ui/button'; import { IndJob } from '@/lib/types'; -import { getNextStatus, getPreviousStatus } from '@/utils/jobStatusUtils'; +import { getNextStatus, getPreviousStatus, getStatusColor } from '@/utils/jobStatusUtils'; import { useJobs } from '@/hooks/useDataService'; import { useToast } from '@/hooks/use-toast'; @@ -67,38 +67,34 @@ const JobStatusNavigation: React.FC = ({ job }) => { }; return ( -
+
{previousStatus && ( - + + {previousStatus} + )} {nextStatus && ( - + {nextStatus} + + )}
); diff --git a/src/utils/jobStatusUtils.ts b/src/utils/jobStatusUtils.ts index 7891c07..448a758 100644 --- a/src/utils/jobStatusUtils.ts +++ b/src/utils/jobStatusUtils.ts @@ -52,20 +52,20 @@ export const getStatusPriority = (status: IndJobStatusOptions): number => { } }; -// Use the actual type values from the enum -export const JOB_STATUSES: IndJobStatusOptions[] = [ +// Define the status sequence - using the actual enum values +export const JOB_STATUSES = [ 'Planned', 'Acquisition', 'Staging', 'Inbound', 'Running', 'Done', 'Delivered', 'Outbound', 'Selling', 'Closed', 'Tracked' -]; +] as const; -export const getNextStatus = (currentStatus: string): IndJobStatusOptions | null => { - const currentIndex = JOB_STATUSES.indexOf(currentStatus as IndJobStatusOptions); +export const getNextStatus = (currentStatus: string): string | null => { + const currentIndex = JOB_STATUSES.indexOf(currentStatus as any); if (currentIndex === -1 || currentIndex === JOB_STATUSES.length - 1) return null; return JOB_STATUSES[currentIndex + 1]; }; -export const getPreviousStatus = (currentStatus: string): IndJobStatusOptions | null => { - const currentIndex = JOB_STATUSES.indexOf(currentStatus as IndJobStatusOptions); +export const getPreviousStatus = (currentStatus: string): string | null => { + const currentIndex = JOB_STATUSES.indexOf(currentStatus as any); if (currentIndex <= 0) return null; return JOB_STATUSES[currentIndex - 1]; };