fix(repair): fetch full ticket queue, map all 5 stages, and show customer & tech status on cards
This commit is contained in:
parent
6527831bdd
commit
27bb90c0f9
2 changed files with 22 additions and 4 deletions
|
|
@ -21,7 +21,7 @@ export default function RepairTicketsPage() {
|
|||
const loadTickets = async () => {
|
||||
try {
|
||||
setLoading(true);
|
||||
const data = await repairService.getTickets();
|
||||
const data = await repairService.getTickets(undefined, 200);
|
||||
setTickets(data);
|
||||
} catch (err) {
|
||||
setTickets([
|
||||
|
|
@ -135,7 +135,8 @@ export default function RepairTicketsPage() {
|
|||
return currentStage === stage.toUpperCase() ||
|
||||
(stage === 'INTAKE' && (currentStage === 'RECEIVED' || currentStage === 'INTAKE')) ||
|
||||
(stage === 'REPAIRING' && (currentStage === 'UNDER_REPAIR' || currentStage === 'PART_PENDING')) ||
|
||||
(stage === 'COMPLETED' && (currentStage === 'READY_FOR_DELIVERY' || currentStage === 'QC_TESTING'));
|
||||
(stage === 'COMPLETED' && (currentStage === 'READY_FOR_DELIVERY' || currentStage === 'QC_TESTING')) ||
|
||||
(stage === 'DELIVERED' && (currentStage === 'CLOSED' || currentStage === 'DELIVERED' || currentStage === 'CANCELLED'));
|
||||
});
|
||||
|
||||
return (
|
||||
|
|
@ -170,6 +171,19 @@ export default function RepairTicketsPage() {
|
|||
</span>
|
||||
</div>
|
||||
|
||||
<div className="flex items-center justify-between gap-1 text-[11px] text-muted-foreground mb-1.5">
|
||||
<span className="truncate font-medium text-foreground">{t.customer_name || 'Walk-in Customer'}</span>
|
||||
{t.assigned_technician_name ? (
|
||||
<span className="inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-semibold bg-emerald-500/10 text-emerald-600 dark:text-emerald-400">
|
||||
{t.assigned_technician_name}
|
||||
</span>
|
||||
) : (
|
||||
<span className="inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-semibold bg-amber-500/10 text-amber-600 dark:text-amber-400">
|
||||
Unassigned
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="text-[13px] font-medium text-foreground flex items-center gap-1.5 mb-1">
|
||||
<Smartphone className="w-3.5 h-3.5 text-muted-foreground shrink-0" />
|
||||
{(t.brand_name || t.model_name)
|
||||
|
|
|
|||
|
|
@ -17,13 +17,17 @@ export interface RepairTicket {
|
|||
priority?: string;
|
||||
device_id?: string;
|
||||
assigned_technician_id?: string;
|
||||
assigned_technician_name?: string;
|
||||
sla_due_at?: string;
|
||||
created_at?: string;
|
||||
}
|
||||
|
||||
export const repairService = {
|
||||
getTickets: async (status?: string) => {
|
||||
const query = status ? `?status=${encodeURIComponent(status)}` : '';
|
||||
getTickets: async (stage?: string, limit = 200) => {
|
||||
const params = new URLSearchParams();
|
||||
if (stage) params.append('stage', stage);
|
||||
if (limit) params.append('limit', String(limit));
|
||||
const query = params.toString() ? `?${params.toString()}` : '';
|
||||
return apiFetch<RepairTicket[]>(`/api/v1/repair/tickets${query}`);
|
||||
},
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue