From 82cccdf94ffb427512e0db2d89b20aea22848758 Mon Sep 17 00:00:00 2001 From: Anang Yusman Date: Mon, 26 May 2025 18:51:11 +0800 Subject: [PATCH] [QUDO-98] feat:emergency issue --- .../questions/[title]/components/columns.tsx | 10 +++++----- .../form/communication/questions-reply-form.tsx | 7 ++----- components/form/ticketing/ticketing-detail-form.tsx | 11 ++++------- components/form/ticketing/ticketing-update-form.tsx | 11 ++++------- 4 files changed, 15 insertions(+), 24 deletions(-) diff --git a/app/[locale]/(protected)/supervisor/communications/questions/[title]/components/columns.tsx b/app/[locale]/(protected)/supervisor/communications/questions/[title]/components/columns.tsx index d8a284c4..d364193c 100644 --- a/app/[locale]/(protected)/supervisor/communications/questions/[title]/components/columns.tsx +++ b/app/[locale]/(protected)/supervisor/communications/questions/[title]/components/columns.tsx @@ -43,7 +43,7 @@ const columns: ColumnDef[] = [ accessorKey: "type", header: "Channel", cell: ({ row }) => { - const type = row.original.type; // Akses properti category + const type = row.original.type; return {type?.name || "N/A"}; }, }, @@ -67,11 +67,11 @@ const columns: ColumnDef[] = [ accessorKey: "isActive", header: "Status", cell: ({ row }) => { - const isActive = row.getValue("isActive") as boolean; // Ambil nilai isActive - const status = isActive ? "Open" : "Closed"; // Tentukan teks berdasarkan isActive + const isActive = row.getValue("isActive") as boolean; + const status = isActive ? "Open" : "Closed"; const statusStyles = isActive - ? "bg-green-100 text-green-600" // Gaya untuk "Open" - : "bg-red-100 text-red-600"; // Gaya untuk "Closed" + ? "bg-green-100 text-green-600" + : "bg-red-100 text-red-600"; return ( {status} diff --git a/components/form/communication/questions-reply-form.tsx b/components/form/communication/questions-reply-form.tsx index cb02c6cb..64d96c87 100644 --- a/components/form/communication/questions-reply-form.tsx +++ b/components/form/communication/questions-reply-form.tsx @@ -193,8 +193,8 @@ export default function FormQuestionsReply() { console.log("Berhasil kirim balasan:", res?.data); setReplyText(""); - setReplyValue(0); // tutup form setelah kirim - getTicketReply(); // refresh balasan + setReplyValue(0); + getTicketReply(); } catch (err) { console.error("Gagal kirim balasan:", err); } @@ -242,7 +242,6 @@ export default function FormQuestionsReply() { try { const response = await saveTicketReply(data); - // Tambahkan balasan baru ke daftar balasan const newReply: replyDetail = { id: response?.data?.id, comments: replyMessage, @@ -259,7 +258,6 @@ export default function FormQuestionsReply() { icon: "success", }); - // Reset input dan sembunyikan form balasan setReplyMessage(""); setReplyVisible(false); } catch (error) { @@ -293,7 +291,6 @@ export default function FormQuestionsReply() { icon: "success", }); - // Refresh data jika perlu getTicketReply(); } catch (error) { console.error("Gagal update:", error); diff --git a/components/form/ticketing/ticketing-detail-form.tsx b/components/form/ticketing/ticketing-detail-form.tsx index d72a8b02..81c02ec4 100644 --- a/components/form/ticketing/ticketing-detail-form.tsx +++ b/components/form/ticketing/ticketing-detail-form.tsx @@ -164,15 +164,14 @@ export default function FormDetailTicketing() { const optionArr = rawUser?.map((option: any) => ({ id: option.id, label: option.fullName, - value: option.id.toString(), // pastikan string + value: option.id.toString(), })); setOperatorOpt(optionArr); - // 👇 Parse `assignedTeams` ke dalam array string if (detailTickets?.assignedTeams) { const assigned = detailTickets.assignedTeams .split(":") - .filter((id: string) => id); // hapus string kosong + .filter((id: string) => id); setSelectedOperator(assigned); } } @@ -201,8 +200,8 @@ export default function FormDetailTicketing() { console.log("Berhasil kirim balasan:", res?.data); setReplyText(""); - setReplyValue(0); // tutup form setelah kirim - getTicketReply(); // refresh balasan + setReplyValue(0); + getTicketReply(); } catch (err) { console.error("Gagal kirim balasan:", err); } @@ -233,7 +232,6 @@ export default function FormDetailTicketing() { try { const response = await saveTicketReply(data); - // Tambahkan balasan baru ke daftar balasan const newReply: replyDetail = { id: response?.data?.id, comments: replyMessage, @@ -250,7 +248,6 @@ export default function FormDetailTicketing() { icon: "success", }); - // Reset input dan sembunyikan form balasan setReplyMessage(""); setReplyVisible(false); } catch (error) { diff --git a/components/form/ticketing/ticketing-update-form.tsx b/components/form/ticketing/ticketing-update-form.tsx index d8131ca6..3ae98dd7 100644 --- a/components/form/ticketing/ticketing-update-form.tsx +++ b/components/form/ticketing/ticketing-update-form.tsx @@ -174,15 +174,14 @@ export default function FormUpdateTicketing() { const optionArr = rawUser?.map((option: any) => ({ id: option.id, label: option.fullName, - value: option.id.toString(), // pastikan string + value: option.id.toString(), })); setOperatorOpt(optionArr); - // 👇 Parse `assignedTeams` ke dalam array string if (detailTickets?.assignedTeams) { const assigned = detailTickets.assignedTeams .split(":") - .filter((id: string) => id); // hapus string kosong + .filter((id: string) => id); setSelectedOperator(assigned); } } @@ -199,7 +198,7 @@ export default function FormUpdateTicketing() { } const handleReply = () => { - setReplyVisible((prev) => !prev); // Toggle visibility + setReplyVisible((prev) => !prev); }; const handleSendReply = async () => { @@ -220,7 +219,6 @@ export default function FormUpdateTicketing() { try { const response = await saveTicketReply(data); - // Tambahkan balasan baru ke daftar balasan const newReply: replyDetail = { id: response?.data?.id, comments: replyMessage, @@ -237,7 +235,6 @@ export default function FormUpdateTicketing() { icon: "success", }); - // Reset input dan sembunyikan form balasan setReplyMessage(""); setReplyVisible(false); } catch (error) { @@ -293,7 +290,7 @@ export default function FormUpdateTicketing() { description: data.description, priority: data.priority, status: data.status, - operatorTeam: selectedOperator.join(","), // Gunakan selectedOperator yang sudah ada + operatorTeam: selectedOperator.join(","), }; if (id) {