refactor: simplify ticket lifecycle flow, remove processing and completed state
This commit is contained in:
@@ -5,7 +5,6 @@ import type { ColumnDef } from '@tanstack/react-table';
|
||||
|
||||
import type { TicketListItem } from '@/types';
|
||||
|
||||
import { TicketStatusBadge } from './TicketStatusBadge';
|
||||
import { formatDate } from '@/utils/date';
|
||||
|
||||
export function useTicketColumns(): ColumnDef<TicketListItem>[] {
|
||||
@@ -19,12 +18,6 @@ export function useTicketColumns(): ColumnDef<TicketListItem>[] {
|
||||
<span className="font-medium">{row.original.ticket_name}</span>
|
||||
),
|
||||
},
|
||||
{
|
||||
accessorKey: 'status',
|
||||
header: 'Status',
|
||||
size: 150,
|
||||
cell: ({ row }) => <TicketStatusBadge status={row.original.status} />,
|
||||
},
|
||||
{
|
||||
accessorKey: 'chainage_name',
|
||||
header: 'Segment',
|
||||
|
||||
@@ -1,60 +1,19 @@
|
||||
'use client';
|
||||
|
||||
import { SegmentSelect } from '@/components/lookups/SegmentSelect';
|
||||
import {
|
||||
Select,
|
||||
SelectContent,
|
||||
SelectItem,
|
||||
SelectTrigger,
|
||||
SelectValue,
|
||||
} from '@/components/ui/select';
|
||||
import type { TicketStatus } from '@/types';
|
||||
|
||||
import { formatTicketStatus } from './TicketStatusBadge';
|
||||
|
||||
const ticketStatuses: TicketStatus[] = [
|
||||
'processing',
|
||||
'unassigned',
|
||||
'assigned',
|
||||
'under_review',
|
||||
'closed',
|
||||
];
|
||||
|
||||
interface TicketFiltersProps {
|
||||
status: TicketStatus | 'all';
|
||||
segmentId: string;
|
||||
onStatusChange: (status: TicketStatus | 'all') => void;
|
||||
onSegmentChange: (segmentId: string) => void;
|
||||
}
|
||||
|
||||
export function TicketFilters({
|
||||
status,
|
||||
segmentId,
|
||||
onStatusChange,
|
||||
onSegmentChange,
|
||||
}: TicketFiltersProps) {
|
||||
return (
|
||||
<div className="flex flex-col gap-2 sm:flex-row sm:items-center">
|
||||
<Select
|
||||
value={status}
|
||||
onValueChange={(value) => onStatusChange(value as TicketStatus | 'all')}
|
||||
>
|
||||
<SelectTrigger className="w-full sm:w-48">
|
||||
<SelectValue placeholder="Status" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value="all">All statuses</SelectItem>
|
||||
{ticketStatuses.map((item) => (
|
||||
<SelectItem key={item} value={item}>
|
||||
{formatTicketStatus(item)}
|
||||
</SelectItem>
|
||||
))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
|
||||
<div className="w-full sm:w-64">
|
||||
<SegmentSelect value={segmentId} onValueChange={onSegmentChange} />
|
||||
</div>
|
||||
<div className="w-full sm:w-64">
|
||||
<SegmentSelect value={segmentId} onValueChange={onSegmentChange} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@ import { cn } from '@/lib/utils';
|
||||
import type { TicketStatus } from '@/types';
|
||||
|
||||
const statusClasses: Record<TicketStatus, string> = {
|
||||
processing: 'bg-sky-100 text-sky-700 border-sky-200',
|
||||
unassigned: 'bg-amber-100 text-amber-800 border-amber-200',
|
||||
assigned: 'bg-indigo-100 text-indigo-700 border-indigo-200',
|
||||
under_review: 'bg-violet-100 text-violet-700 border-violet-200',
|
||||
|
||||
@@ -39,7 +39,7 @@ export function TicketTable({
|
||||
isLoading={isLoading}
|
||||
toolbar={toolbar}
|
||||
emptyTitle="No tickets found."
|
||||
emptyDescription="Ticket rows will appear after video processing creates them."
|
||||
emptyDescription="Tickets will appear when road issues are detected."
|
||||
pagination={{
|
||||
skip,
|
||||
limit,
|
||||
|
||||
Reference in New Issue
Block a user