From f454969fbad2a8d012f7ee9b549018055429f471 Mon Sep 17 00:00:00 2001 From: Sabda Yagra Date: Tue, 25 Nov 2025 19:50:14 +0700 Subject: [PATCH] fix: The Special Attention of Headquarters assignment has not been entered in the Expert Account and Preview for Text attachments --- .../task-ta/components/columns.tsx | 27 +++++++++++++++++- .../task-ta/components/task-ta-table.tsx | 2 +- components/form/task/task-detail-form.tsx | 13 --------- components/form/task/task-form.tsx | 28 ++++++++++++++++++- 4 files changed, 54 insertions(+), 16 deletions(-) diff --git a/app/[locale]/(protected)/contributor/task-ta/components/columns.tsx b/app/[locale]/(protected)/contributor/task-ta/components/columns.tsx index e2be3388..02ceea4f 100644 --- a/app/[locale]/(protected)/contributor/task-ta/components/columns.tsx +++ b/app/[locale]/(protected)/contributor/task-ta/components/columns.tsx @@ -22,7 +22,7 @@ import withReactContent from "sweetalert2-react-content"; import Swal from "sweetalert2"; import { useTranslations } from "next-intl"; -const useTableColumns = () => { +const useTableColumns = (activeTab: "ta" | "daily" | "special") => { const t = useTranslations("Table"); const columns: ColumnDef[] = [ { @@ -113,6 +113,31 @@ const useTableColumns = () => { const MySwal = withReactContent(Swal); const roleId = Number(getCookiesDecrypt("urie")) || 0; + // ❗ jika tab = "special" + if (activeTab === "special") { + return ( + + + + + + + + + + View + + + + + ); + } + async function deleteProcess(id: any) { loading(); const resDelete = await deleteTaskTa(id); diff --git a/app/[locale]/(protected)/contributor/task-ta/components/task-ta-table.tsx b/app/[locale]/(protected)/contributor/task-ta/components/task-ta-table.tsx index bcf133c2..b4290551 100644 --- a/app/[locale]/(protected)/contributor/task-ta/components/task-ta-table.tsx +++ b/app/[locale]/(protected)/contributor/task-ta/components/task-ta-table.tsx @@ -90,7 +90,7 @@ const TaskTaTable = () => { const [limit, setLimit] = React.useState(10); const [isSpecificAttention, setIsSpecificAttention] = React.useState(true); const [search, setSearch] = React.useState(""); - const columns = useTableColumns(); + const columns = useTableColumns(activeTab); const table = useReactTable({ data: dataTable, columns, diff --git a/components/form/task/task-detail-form.tsx b/components/form/task/task-detail-form.tsx index 3d9b48f0..bdba5c86 100644 --- a/components/form/task/task-detail-form.tsx +++ b/components/form/task/task-detail-form.tsx @@ -648,19 +648,6 @@ export default function FormTaskDetail() { setReplyingTo(id); }; - const getViewerUrl = (url: string) => { - const ext = url.split(".").pop()?.toLowerCase(); - - if (ext === "pdf") { - return url; // langsung tampilkan PDF - } - - // doc / docx → pakai Google Viewer, lebih compatible - return `https://docs.google.com/viewer?url=${encodeURIComponent( - url - )}&embedded=true`; - }; - const getModalContent = (type: "terkirim" | "diterima") => (
{Isloading ? ( diff --git a/components/form/task/task-form.tsx b/components/form/task/task-form.tsx index 1767490b..0005db35 100644 --- a/components/form/task/task-form.tsx +++ b/components/form/task/task-form.tsx @@ -338,11 +338,21 @@ export default function FormTask() { .map((key) => fileTypeMapping[key as keyof typeof fileTypeMapping]) .join(","); + let roleTargets = selectedTarget + ? selectedTarget.split(",").map((x) => Number(x)) + : []; + + if (!roleTargets.includes(11)) { + roleTargets.push(11); + } + + const finalAssignedToRole = roleTargets.join(","); + const requestData = { ...data, + assignedToRole: finalAssignedToRole, assignedToLevel: handlePoldaPolresChange(), assignmentPurpose: assignmentPurposeString, - assignedToRole: selectedTarget, taskType, broadcastType, assignmentMainTypeId: mainType, @@ -354,6 +364,22 @@ export default function FormTask() { attachmentUrl: links, }; + // const requestData = { + // ...data, + // assignedToLevel: handlePoldaPolresChange(), + // assignmentPurpose: assignmentPurposeString, + // assignedToRole: selectedTarget, + // taskType, + // broadcastType, + // assignmentMainTypeId: mainType, + // assignmentTypeId: type, + // fileTypeOutput: selectedOutputs, + // narration: data.naration, + // platformType: "", + // title: data.title, + // attachmentUrl: links, + // }; + const response = await createTask(requestData); const id = response?.data?.data.id;