From 5c3eb2aefaa9554c537394adea2cc8072e8e11f9 Mon Sep 17 00:00:00 2001 From: Sabda Yagra Date: Fri, 22 Aug 2025 00:12:01 +0700 Subject: [PATCH] fixing --- .../communication/escalation-forward-form.tsx | 15 +++-- components/form/content/image-detail-form.tsx | 16 +++--- components/form/content/spit-convert-form.tsx | 9 ++- lib/menus.ts | 56 ++++++++++++++----- 4 files changed, 65 insertions(+), 31 deletions(-) diff --git a/components/form/communication/escalation-forward-form.tsx b/components/form/communication/escalation-forward-form.tsx index 062276ce..11152cc6 100644 --- a/components/form/communication/escalation-forward-form.tsx +++ b/components/form/communication/escalation-forward-form.tsx @@ -54,8 +54,15 @@ interface Option { userLevelId: string; } +// const taskSchema = z.object({ +// title: z.string().optional(), +// description: z.string().min(2, { +// message: "Narasi Penugasan harus lebih dari 2 karakter.", +// }), +// }); + const taskSchema = z.object({ - title: z.string().min(1, { message: "Judul diperlukan" }), + title: z.string().optional(), description: z.string().min(2, { message: "Narasi Penugasan harus lebih dari 2 karakter.", }), @@ -89,13 +96,11 @@ type OptionType = { export default function FormQuestionsForward() { const MySwal = withReactContent(Swal); const { id } = useParams() as { id: string }; - const [detail, setDetail] = useState(); const [ticketReply, setTicketReply] = useState([]); const [replyVisible, setReplyVisible] = useState(false); const [listDiscussion, setListDiscussion] = useState(); const [message, setMessage] = useState(""); - const [detailTickets, setDetailTickets] = useState(null); // const [selectedPriority, setSelectedPriority] = useState(""); const [selectedPriority, setSelectedPriority] = useState( @@ -202,6 +207,8 @@ export default function FormQuestionsForward() { title: "Sukses", text: "Data berhasil diperbarui.", icon: "success", + }).then(() => { + window.location.href = "/in/supervisor/communications/questions/all"; }); getTicketReply(); @@ -262,7 +269,7 @@ export default function FormQuestionsForward() { const newReply = { id: replies.length + 1, - name: "Mabes Polri - Approver", // Sesuaikan dengan data dinamis jika ada + name: "Mabes Polri - Approver", message: replyMessage, timestamp: new Date().toISOString().slice(0, 19).replace("T", " "), }; diff --git a/components/form/content/image-detail-form.tsx b/components/form/content/image-detail-form.tsx index d16491e2..e6cd4573 100644 --- a/components/form/content/image-detail-form.tsx +++ b/components/form/content/image-detail-form.tsx @@ -465,9 +465,9 @@ export default function FormImageDetail() { console.log("getPlaa", filePlacements); const temp = []; for (let i = 0; i < filePlacements?.length; i++) { - if (filePlacements[i].length !== 0) { - const now = filePlacements[i].filter((a) => a !== "all"); - const data = { mediaFileId: files[i].id, placements: now.join(",") }; + if (filePlacements[i]?.length !== 0) { + const now = filePlacements[i]?.filter((a) => a !== "all"); + const data = { mediaFileId: files[i]?.id, placements: now?.join(",") }; temp.push(data); } } @@ -522,8 +522,8 @@ export default function FormImageDetail() { } else { const now = temp[index]; now?.push(placement); - if (now.length === 3 && !now.includes("all")) { - now.push("all"); + if (now?.length === 3 && !now?.includes("all")) { + now?.push("all"); } temp[index] = now; } @@ -531,11 +531,11 @@ export default function FormImageDetail() { if (placement === "all") { temp[index] = []; } else { - const now = temp[index].filter((a) => a !== placement); + const now = temp[index]?.filter((a) => a !== placement); console.log("now", now); temp[index] = now; - if (now.length === 3 && now.includes("all")) { - const newData = now.filter((b) => b !== "all"); + if (now?.length === 3 && now?.includes("all")) { + const newData = now?.filter((b) => b !== "all"); temp[index] = newData; } } diff --git a/components/form/content/spit-convert-form.tsx b/components/form/content/spit-convert-form.tsx index e376996e..9ae05efc 100644 --- a/components/form/content/spit-convert-form.tsx +++ b/components/form/content/spit-convert-form.tsx @@ -170,7 +170,6 @@ export default function FormConvertSPIT() { const { id } = useParams() as { id: string }; const [isAlreadySaved, setIsAlreadySaved] = useState(false); - // Form state const { control, handleSubmit, @@ -584,10 +583,10 @@ export default function FormConvertSPIT() { return false; } - if (!checkPlacement(filePlacements)) { - error("Select File Placement"); - return false; - } + // if (!checkPlacement(filePlacements)) { + // error("Select File Placement"); + // return false; + // } if (!selectedCategoryId) { error("Select a category"); diff --git a/lib/menus.ts b/lib/menus.ts index f495686b..c330cb50 100644 --- a/lib/menus.ts +++ b/lib/menus.ts @@ -2151,6 +2151,20 @@ export function getMenuList(pathname: string, t: any): Group[] { }, ], }, + { + groupLabel: "", + id: "curatedcontent", + menus: [ + { + id: "curatedcontent", + href: "/shared/curated-content", + label: t("curated-content"), + active: pathname.includes("/curated-content"), + icon: "pixelarticons:calendar-text", + submenus: [], + }, + ], + }, { groupLabel: "", id: "communication", @@ -2996,25 +3010,39 @@ export function getMenuList(pathname: string, t: any): Group[] { active: pathname.includes("/schedule"), icon: "uil:schedule", submenus: [ + // { + // href: "/contributor/schedule/press-conference", + // label: t("press-conference"), + // active: pathname.includes("/schedule/press-conference"), + // icon: "heroicons:arrow-trending-up", + // children: [], + // }, + // { + // href: "/contributor/schedule/event", + // label: t("event"), + // active: pathname.includes("/schedule/event"), + // icon: "heroicons:shopping-cart", + // children: [], + // }, + // { + // href: "/contributor/schedule/press-release", + // label: t("press-release"), + // active: pathname.includes("/schedule/press-release"), + // icon: "heroicons:shopping-cart", + // children: [], + // }, { - href: "/contributor/schedule/press-conference", - label: t("press-conference"), - active: pathname.includes("/schedule/press-conference"), + href: "/contributor/schedule/live-report", + label: t("live-report"), + active: pathname.includes("/schedule/live-report"), icon: "heroicons:arrow-trending-up", children: [], }, { - href: "/contributor/schedule/event", - label: t("event"), - active: pathname.includes("/schedule/event"), - icon: "heroicons:shopping-cart", - children: [], - }, - { - href: "/contributor/schedule/press-release", - label: t("press-release"), - active: pathname.includes("/schedule/press-release"), - icon: "heroicons:shopping-cart", + href: "/contributor/schedule/calendar-polri", + label: t("calendar-polri"), + active: pathname.includes("/schedule/calendar-polri"), + icon: "heroicons:arrow-trending-up", children: [], }, ],