diff --git a/app/(app)/clients/page.tsx b/app/(app)/clients/page.tsx index cb4d746..06e3494 100644 --- a/app/(app)/clients/page.tsx +++ b/app/(app)/clients/page.tsx @@ -60,11 +60,11 @@ export default function ClientsPage() { const createClient = useMutation({ mutationFn: async () => { - const res = await api.post("/api/v1/clients/onboard", { + const res = await api.post("/api/v1/clients", { firstName: form.firstName, lastName: form.lastName, email: form.email, phone: form.phone, address: form.address, - areaId: form.areaId || undefined, planId: form.planId, - billingType: form.billingType, + areaId: form.areaId || undefined, + planId: form.planId || undefined, }); return res.data; }, @@ -73,7 +73,7 @@ export default function ClientsPage() { qc.invalidateQueries({ queryKey: ["clients"] }); setShowAdd(false); setForm({ firstName: "", lastName: "", email: "", phone: "", address: "", areaId: "", planId: "", billingType: "POSTPAID" }); - if (data?.client?.id) router.push(`/clients/${data.client.id}`); + if (data?.id) router.push(`/clients/${data.id}`); }, onError: (e: any) => toast.error(e.response?.data?.message ?? "Failed to create client"), }); diff --git a/app/(app)/remittances/page.tsx b/app/(app)/remittances/page.tsx index 585330c..540101c 100644 --- a/app/(app)/remittances/page.tsx +++ b/app/(app)/remittances/page.tsx @@ -114,7 +114,7 @@ export default function RemittancesPage() { setSelected(r)} className="cursor-pointer hover:bg-blue-50 transition-colors"> {formatDate(r.createdAt)} {r.collector ? `${r.collector.firstName} ${r.collector.lastName}` : "—"} - {formatCurrency(Number(r.amount))} + {formatCurrency(Number(r.totalAmount))} {r.status} {r.notes ?? "—"} @@ -152,7 +152,7 @@ export default function RemittancesPage() {
{selected.payments.map(p => (
- {p.client ? `${p.client.firstName} ${p.client.lastName}` : p.clientId.slice(0, 8)} + {p.client ? `${p.client.firstName} ${p.client.lastName}` : p.clientId ? p.clientId.slice(0, 8) : p.id.slice(0, 8)} {formatCurrency(Number(p.amount))}
))} diff --git a/app/(app)/tickets/page.tsx b/app/(app)/tickets/page.tsx index 0c52b70..41cc7a6 100644 --- a/app/(app)/tickets/page.tsx +++ b/app/(app)/tickets/page.tsx @@ -13,7 +13,7 @@ import { formatDate } from "@/lib/utils"; import api from "@/lib/api"; import { toast } from "sonner"; -interface TicketComment { id: string; body: string; createdAt: string; author?: { firstName: string; lastName: string }; } +interface TicketComment { id: string; body: string; createdAt: string; sender?: { firstName: string; lastName: string }; author?: { firstName: string; lastName: string }; } interface TicketItem { id: string; ticketNumber?: string; subject: string; description?: string; type: string; priority: string; status: string; clientId?: string; @@ -86,7 +86,7 @@ export default function TicketsPage() { const addComment = useMutation({ mutationFn: async () => { - await api.post(`/api/v1/tickets/${selected!.id}/comments`, { body: comment }); + await api.post(`/api/v1/tickets/${selected!.id}/messages`, { body: comment }); }, onSuccess: () => { toast.success("Comment added"); setComment(""); refetchDetail(); }, onError: (e: any) => toast.error(e.response?.data?.message ?? "Failed"), @@ -112,7 +112,7 @@ export default function TicketsPage() { const tickets = data?.data ?? []; const total = data?.meta?.total ?? 0; const detail = ticketDetail ?? selected; - const comments = (ticketDetail as any)?.comments ?? []; + const comments = (ticketDetail as any)?.messages ?? []; const nextStatus: Record = { OPEN: "IN_PROGRESS", IN_PROGRESS: "RESOLVED", RESOLVED: "CLOSED" }; @@ -216,7 +216,7 @@ export default function TicketsPage() { {comments.length === 0 ?

No comments yet.

: comments.map((c: TicketComment) => (
-

{c.author ? `${c.author.firstName} ${c.author.lastName}` : "Staff"} · {formatDate(c.createdAt)}

+

{(c.sender || c.author) ? `${(c.sender || c.author)!.firstName} ${(c.sender || c.author)!.lastName}` : "Staff"} · {formatDate(c.createdAt)}

{c.body}

))