From 0d35d18b36b66302b38b50aa2a8a80fd9e1dcd22 Mon Sep 17 00:00:00 2001 From: kibin Date: Wed, 1 Apr 2026 07:59:26 +0000 Subject: [PATCH] feat(257,253): revert status, assign-to-me, map pin, activate client --- app/(app)/tickets/page.tsx | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/app/(app)/tickets/page.tsx b/app/(app)/tickets/page.tsx index 1c6cdf4..7b4f25f 100644 --- a/app/(app)/tickets/page.tsx +++ b/app/(app)/tickets/page.tsx @@ -2,7 +2,7 @@ import { useState } from "react"; import { useQuery, useMutation, useQueryClient } from "@tanstack/react-query"; -import { RefreshCw, Ticket, Plus, Send, RotateCcw, User } from "lucide-react"; +import { RefreshCw, Ticket, Plus, Send, RotateCcw, User, MapPin, Zap } from "lucide-react"; import { useAuth } from "@/contexts/AuthContext"; import { Card, CardContent, CardHeader } from "@/components/ui/Card"; import { Table, TableHead, TableBody, TableRow, Th, Td, EmptyState } from "@/components/ui/Table"; @@ -120,6 +120,14 @@ export default function TicketsPage() { onError: (e: any) => toast.error(e.response?.data?.message ?? "Failed to create ticket"), }); + const activateClient = useMutation({ + mutationFn: async (clientId: string) => { + await api.patch(`/api/v1/clients/${clientId}`, { isActive: true }); + }, + onSuccess: () => { toast.success("Client activated! 🎉"); refetch(); refetchDetail(); }, + onError: (e: any) => toast.error(e.response?.data?.message ?? "Failed to activate client"), + }); + const revertStatus = useMutation({ mutationFn: async ({ id, status }: { id: string; status: string }) => { await api.patch(`/api/v1/tickets/${id}`, { status }); @@ -226,6 +234,21 @@ export default function TicketsPage() {
Status

{detail.status}

Created

{formatDate(detail.createdAt)}

{detail.description &&
Description

{detail.description}

} + {/* Installation: show Google Maps link using client address */} + {detail.type === "INSTALLATION" && detail.client && ( +
+ Map +

+ + View on Google Maps + +

+
+ )} {/* Status actions */} @@ -240,6 +263,13 @@ export default function TicketsPage() { Revert to {prevStatus[detail.status].replace("_", " ")} )} + {/* Installation ticket RESOLVED → show Activate Client button */} + {detail.type === "INSTALLATION" && detail.status === "RESOLVED" && detail.clientId && ( + + )} {/* Comments */}