fix: remittances totalAmount+clientId (FIBEROPS-221), create client URL (FIBEROPS-222), tickets /messages (FIBEROPS-224)
This commit is contained in:
@@ -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<string, string> = { OPEN: "IN_PROGRESS", IN_PROGRESS: "RESOLVED", RESOLVED: "CLOSED" };
|
||||
|
||||
@@ -216,7 +216,7 @@ export default function TicketsPage() {
|
||||
{comments.length === 0 ? <p className="text-sm text-gray-400">No comments yet.</p> :
|
||||
comments.map((c: TicketComment) => (
|
||||
<div key={c.id} className="bg-white border rounded-lg px-3 py-2 text-sm">
|
||||
<p className="font-medium text-gray-700 text-xs">{c.author ? `${c.author.firstName} ${c.author.lastName}` : "Staff"} · {formatDate(c.createdAt)}</p>
|
||||
<p className="font-medium text-gray-700 text-xs">{(c.sender || c.author) ? `${(c.sender || c.author)!.firstName} ${(c.sender || c.author)!.lastName}` : "Staff"} · {formatDate(c.createdAt)}</p>
|
||||
<p className="text-gray-800 mt-0.5">{c.body}</p>
|
||||
</div>
|
||||
))
|
||||
|
||||
Reference in New Issue
Block a user