diff --git a/app/[locale]/(protected)/admin/analysis/content-management/page.tsx b/app/[locale]/(protected)/admin/analysis/content-management/page.tsx index 62fe0ab0..f85d6a2e 100644 --- a/app/[locale]/(protected)/admin/analysis/content-management/page.tsx +++ b/app/[locale]/(protected)/admin/analysis/content-management/page.tsx @@ -87,7 +87,7 @@ export default function ContentManagement() { ? "views/2023_08_MediaHUB-KtnMgt_Rev100/db-ktn-intl?" : "views/2023_08_MediaHUB-KtnMgt_Rev100/db-ktn-intl?" : `views/2023_08_MediaHUB-KtnMgt_Rev100/db-ktn-intl?provinsi-polda=${poldaState}&`; - const param = ":embed=yes&:toolbar=yes&:iframeSizedToWindow=true"; + const param = ":embed=yes&:toolbar=no&:iframeSizedToWindow=true"; useEffect(() => { async function initState() { diff --git a/app/[locale]/(protected)/admin/analysis/emergency-issue/page.tsx b/app/[locale]/(protected)/admin/analysis/emergency-issue/page.tsx index 7ccb7c31..5a3b72c8 100644 --- a/app/[locale]/(protected)/admin/analysis/emergency-issue/page.tsx +++ b/app/[locale]/(protected)/admin/analysis/emergency-issue/page.tsx @@ -53,7 +53,7 @@ export default function EmergencyIssue() { : "views/2023_08_MediaHUB-KtnMgt_Rev100/db-emg-issue?" : `views/2023_08_MediaHUB-KtnMgt_Rev100/db-emg-issue?provinsi-polda=${provState}&`; - const param = ":embed=yes&:toolbar=yes&:iframeSizedToWindow=true"; + const param = ":embed=yes&:toolbar=no&:iframeSizedToWindow=true"; useEffect(() => { async function initState() { diff --git a/app/[locale]/(protected)/admin/analysis/feedback-center/page.tsx b/app/[locale]/(protected)/admin/analysis/feedback-center/page.tsx index 1ccb475e..0518e0fc 100644 --- a/app/[locale]/(protected)/admin/analysis/feedback-center/page.tsx +++ b/app/[locale]/(protected)/admin/analysis/feedback-center/page.tsx @@ -53,7 +53,7 @@ export default function FeedbackCenter() { : "views/2023_08_MediaHUB-KtnMgt_Rev100/db-tickets?" : `views/2023_08_MediaHUB-KtnMgt_Rev100/db-tickets?provinsi-polda=${provState}&`; - const param = ":embed=yes&:toolbar=yes&:iframeSizedToWindow=true"; + const param = ":embed=yes&:toolbar=no&:iframeSizedToWindow=true"; useEffect(() => { async function initState() { diff --git a/app/[locale]/(protected)/admin/analysis/schedule/page.tsx b/app/[locale]/(protected)/admin/analysis/schedule/page.tsx index 5e51bc33..99eff969 100644 --- a/app/[locale]/(protected)/admin/analysis/schedule/page.tsx +++ b/app/[locale]/(protected)/admin/analysis/schedule/page.tsx @@ -69,7 +69,7 @@ export default function ContentManagement() { : "views/2023_08_MediaHUB-KtnMgt_Rev100/db-ktn-act-jnl?" : `views/2023_08_MediaHUB-KtnMgt_Rev100/db-ktn-act-jnl?provinsi-polda=${poldaState}&`; - const param = ":embed=yes&:toolbar=yes&:iframeSizedToWindow=true"; + const param = ":embed=yes&:toolbar=no&:iframeSizedToWindow=true"; useEffect(() => { async function initState() { diff --git a/app/[locale]/(protected)/admin/survey/component/column.tsx b/app/[locale]/(protected)/admin/survey/component/column.tsx index dfbf1b9e..e576e68f 100644 --- a/app/[locale]/(protected)/admin/survey/component/column.tsx +++ b/app/[locale]/(protected)/admin/survey/component/column.tsx @@ -13,6 +13,9 @@ import { Button } from "@/components/ui/button"; import { Badge } from "@/components/ui/badge"; import { Link, useRouter } from "@/i18n/routing"; +import { format } from "date-fns"; +import header from "@/components/partials/header"; +import { date } from "zod"; const columns: ColumnDef[] = [ { @@ -23,50 +26,61 @@ const columns: ColumnDef[] = [ { accessorKey: "createdAt", header: "Tanggal", - cell: ({ row }) => ( - {row.getValue("createdAt")} - ), + cell: ({ row }) => { + const createdAt = row.getValue("createdAt") as + | string + | number + | undefined; + + const formattedDate = + createdAt && !isNaN(new Date(createdAt).getTime()) + ? format(new Date(createdAt), "dd-MM-yyyy HH:mm:ss") + : "-"; + return {formattedDate}; + }, }, { - accessorKey: "account-type", + accessorKey: "createdByCategory", header: "Jenis Akun", cell: ({ row }) => ( - {row.getValue("account-type")} + {row.getValue("createdByCategory")} ), }, { - accessorKey: "userName", + accessorKey: "createdByUsername", header: "UserName", cell: ({ row }) => ( - {row.getValue("userName")} + {row.getValue("createdByUsername")} ), }, { - accessorKey: "accessMediahub", + accessorKey: "accessFrequency", header: "Akses Mediahub", cell: ({ row }) => ( - {row.getValue("accessMediahub")} + {row.getValue("accessFrequency")} ), }, { - accessorKey: "desaignWeb", + accessorKey: "uiExperienceDesign", header: "Tampilan Desain Web", cell: ({ row }) => ( - {row.getValue("desaignWeb")} + {row.getValue("uiExperienceDesign")} ), }, { - accessorKey: "navigation", + accessorKey: "uiExperienceNavigation", header: "Kemudahan Navigasi", cell: ({ row }) => ( - {row.getValue("navigation")} + + {row.getValue("uiExperienceNavigation")} + ), }, { - accessorKey: "fastAccess", + accessorKey: "uiExperienceSpeed", header: "Kecepatan Akses", cell: ({ row }) => ( - {row.getValue("fastAccess")} + {row.getValue("uiExperienceSpeed")} ), }, { @@ -86,13 +100,12 @@ const columns: ColumnDef[] = [ - - - Detail - - + + + + View + + ); diff --git a/app/[locale]/(protected)/admin/survey/component/table.tsx b/app/[locale]/(protected)/admin/survey/component/table.tsx index a6efa990..5e084b5a 100644 --- a/app/[locale]/(protected)/admin/survey/component/table.tsx +++ b/app/[locale]/(protected)/admin/survey/component/table.tsx @@ -90,6 +90,7 @@ import { XAxis, YAxis, } from "recharts"; +import { getSurveyData } from "@/service/survey/survey"; const data = [ { @@ -181,7 +182,7 @@ const SurveyListTable = () => { async function fetchData() { try { loading(); - const res = await getMediaBlastCampaignPage(page - 1); + const res = await getSurveyData(); const data = res?.data?.data; const contentData = data?.content; contentData.forEach((item: any, index: number) => { @@ -249,7 +250,7 @@ const SurveyListTable = () => { -
+

Survei Kepuasan Pengguna MediaHub Polri

diff --git a/app/[locale]/(protected)/admin/survey/detail/[id]/page.tsx b/app/[locale]/(protected)/admin/survey/detail/[id]/page.tsx new file mode 100644 index 00000000..7b24ff71 --- /dev/null +++ b/app/[locale]/(protected)/admin/survey/detail/[id]/page.tsx @@ -0,0 +1,17 @@ +import SiteBreadcrumb from "@/components/site-breadcrumb"; +import FormBlogDetail from "@/components/form/blog/blog--detail-form"; +import FormSurvey from "@/components/landing-page/survey"; +import FormSurveyDetail from "@/components/form/survey/survey-detail"; + +const SurveyDetailPage = async () => { + return ( +
+ +
+ +
+
+ ); +}; + +export default SurveyDetailPage; diff --git a/app/[locale]/(protected)/contributor/blog/detail/[id]/page.tsx b/app/[locale]/(protected)/contributor/blog/detail/[id]/page.tsx index 1906dc83..c196cb0d 100644 --- a/app/[locale]/(protected)/contributor/blog/detail/[id]/page.tsx +++ b/app/[locale]/(protected)/contributor/blog/detail/[id]/page.tsx @@ -1,12 +1,13 @@ import SiteBreadcrumb from "@/components/site-breadcrumb"; import FormBlogDetail from "@/components/form/blog/blog--detail-form"; +import FormSurveyDetailPage from "@/components/form/survey/survey-detail"; const BlogDetailPage = async () => { return (
- +
); diff --git a/app/[locale]/(protected)/contributor/content/spit/table-spit/table-spit.tsx b/app/[locale]/(protected)/contributor/content/spit/table-spit/table-spit.tsx index 791ea4f9..77fcfd17 100644 --- a/app/[locale]/(protected)/contributor/content/spit/table-spit/table-spit.tsx +++ b/app/[locale]/(protected)/contributor/content/spit/table-spit/table-spit.tsx @@ -43,6 +43,7 @@ import { InputGroup, InputGroupText } from "@/components/ui/input-group"; import columns from "./columns"; import { DropdownMenu, + DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuTrigger, } from "@/components/ui/dropdown-menu"; @@ -192,56 +193,86 @@ const TableSPIT = () => { />
-
- - - - - -
-

Filter

-
-
- - setDateFilter(e.target.value)} - className="max-w-sm" - /> -
- -
- handleStatusCheckboxChange(1)} - /> - -
-
- handleStatusCheckboxChange(2)} - /> - -
-
-
+
+
+ + + + + +
+

Filter

+
+
+ + setDateFilter(e.target.value)} + className="max-w-sm" + /> +
+ +
+ handleStatusCheckboxChange(1)} + /> + +
+
+ handleStatusCheckboxChange(2)} + /> + +
+
+
+
+
+ + + + + + {table + .getAllColumns() + .filter((column) => column.getCanHide()) + .map((column) => { + return ( + + column.toggleVisibility(!!value) + } + > + {column.id} + + ); + })} + + +
diff --git a/app/[locale]/(protected)/contributor/planning/mediahub/components/mediahub-table.tsx b/app/[locale]/(protected)/contributor/planning/mediahub/components/mediahub-table.tsx index 9d3d6fc5..c1d72b98 100644 --- a/app/[locale]/(protected)/contributor/planning/mediahub/components/mediahub-table.tsx +++ b/app/[locale]/(protected)/contributor/planning/mediahub/components/mediahub-table.tsx @@ -26,6 +26,7 @@ import { } from "@/components/ui/table"; import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"; import { + ChevronDown, ChevronLeft, ChevronRight, Eye, @@ -39,6 +40,7 @@ import { import { cn } from "@/lib/utils"; import { DropdownMenu, + DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, @@ -163,17 +165,47 @@ const MediahubTable = () => { />
-
- ) => - table.getColumn("status")?.setFilterValue(event.target.value) - } - className="max-w-sm " - /> +
+
+ ) => + table.getColumn("status")?.setFilterValue(event.target.value) + } + className="max-w-sm " + /> +
+
+ + + + + + {table + .getAllColumns() + .filter((column) => column.getCanHide()) + .map((column) => { + return ( + + column.toggleVisibility(!!value) + } + > + {column.id} + + ); + })} + + +
diff --git a/app/[locale]/(protected)/contributor/planning/medsos-mediahub/components/medsos-table.tsx b/app/[locale]/(protected)/contributor/planning/medsos-mediahub/components/medsos-table.tsx index b909ffeb..ab41096f 100644 --- a/app/[locale]/(protected)/contributor/planning/medsos-mediahub/components/medsos-table.tsx +++ b/app/[locale]/(protected)/contributor/planning/medsos-mediahub/components/medsos-table.tsx @@ -26,6 +26,7 @@ import { } from "@/components/ui/table"; import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"; import { + ChevronDown, ChevronLeft, ChevronRight, Eye, @@ -39,6 +40,7 @@ import { import { cn } from "@/lib/utils"; import { DropdownMenu, + DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, @@ -162,17 +164,47 @@ const MedsosTable = () => { /> -
- ) => - table.getColumn("status")?.setFilterValue(event.target.value) - } - className="max-w-sm " - /> +
+
+ ) => + table.getColumn("status")?.setFilterValue(event.target.value) + } + className="max-w-sm " + /> +
+
+ + + + + + {table + .getAllColumns() + .filter((column) => column.getCanHide()) + .map((column) => { + return ( + + column.toggleVisibility(!!value) + } + > + {column.id} + + ); + })} + + +
diff --git a/app/[locale]/(protected)/contributor/report/components/columns.tsx b/app/[locale]/(protected)/contributor/report/components/columns.tsx index 8bf9f31e..e244576c 100644 --- a/app/[locale]/(protected)/contributor/report/components/columns.tsx +++ b/app/[locale]/(protected)/contributor/report/components/columns.tsx @@ -49,7 +49,7 @@ const useTableColumns = ({ }, { accessorKey: "createdAt", - header: t("upload-date"), + header: t("generate-date"), cell: ({ row }) => { const createdAt = row.getValue("createdAt") as | string @@ -69,6 +69,12 @@ const useTableColumns = ({ cell: ({ row }) => {row.getValue("version")}, }, + { + accessorKey: "status", + header: t("status"), + cell: ({ row }) => {row.getValue("status")}, + }, + { id: "actions", accessorKey: "action", diff --git a/app/[locale]/(protected)/contributor/schedule/event/components/event-table.tsx b/app/[locale]/(protected)/contributor/schedule/event/components/event-table.tsx index a4524e72..33ce62ae 100644 --- a/app/[locale]/(protected)/contributor/schedule/event/components/event-table.tsx +++ b/app/[locale]/(protected)/contributor/schedule/event/components/event-table.tsx @@ -36,6 +36,7 @@ import { Button } from "@/components/ui/button"; import useTableColumns from "./columns"; import { DropdownMenu, + DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuRadioGroup, DropdownMenuRadioItem, @@ -172,8 +173,8 @@ const EventTable = () => { /> -
-
+
+
+
+ + + + + + {table + .getAllColumns() + .filter((column) => column.getCanHide()) + .map((column) => { + return ( + + column.toggleVisibility(!!value) + } + > + {column.id} + + ); + })} + + +
diff --git a/app/[locale]/(protected)/contributor/schedule/press-conference/components/presscon-table.tsx b/app/[locale]/(protected)/contributor/schedule/press-conference/components/presscon-table.tsx index c409f222..a52a9ed6 100644 --- a/app/[locale]/(protected)/contributor/schedule/press-conference/components/presscon-table.tsx +++ b/app/[locale]/(protected)/contributor/schedule/press-conference/components/presscon-table.tsx @@ -50,6 +50,7 @@ import { useTranslations } from "next-intl"; import useTableColumns from "./columns"; import { DropdownMenu, + DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuRadioGroup, DropdownMenuRadioItem, @@ -186,8 +187,8 @@ const PressConferenceTable = () => { /> -
-
+
+
+
+ + + + + + {table + .getAllColumns() + .filter((column) => column.getCanHide()) + .map((column) => { + return ( + + column.toggleVisibility(!!value) + } + > + {column.id} + + ); + })} + + +
diff --git a/app/[locale]/(protected)/contributor/schedule/press-release/components/pressrilis-table.tsx b/app/[locale]/(protected)/contributor/schedule/press-release/components/pressrilis-table.tsx index 3315fc3e..68f90688 100644 --- a/app/[locale]/(protected)/contributor/schedule/press-release/components/pressrilis-table.tsx +++ b/app/[locale]/(protected)/contributor/schedule/press-release/components/pressrilis-table.tsx @@ -51,6 +51,7 @@ import { Link } from "@/i18n/routing"; import useTableColumns from "./columns"; import { DropdownMenu, + DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuRadioGroup, DropdownMenuRadioItem, @@ -187,8 +188,8 @@ const PressReleaseTable = () => { /> -
-
+
+
+
+ + + + + + {table + .getAllColumns() + .filter((column) => column.getCanHide()) + .map((column) => { + return ( + + column.toggleVisibility(!!value) + } + > + {column.id} + + ); + })} + + +
diff --git a/app/[locale]/(protected)/contributor/task-ta/components/columns.tsx b/app/[locale]/(protected)/contributor/task-ta/components/columns.tsx index c05d82f0..9a9ae4db 100644 --- a/app/[locale]/(protected)/contributor/task-ta/components/columns.tsx +++ b/app/[locale]/(protected)/contributor/task-ta/components/columns.tsx @@ -1,8 +1,8 @@ import * as React from "react"; import { ColumnDef } from "@tanstack/react-table"; -import { Eye, MoreVertical, SquarePen, Trash2 } from "lucide-react"; -import { cn } from "@/lib/utils"; +import { Eye, MoreVertical, SquarePen, Trash2, Upload } from "lucide-react"; +import { cn, getCookiesDecrypt } from "@/lib/utils"; import { DropdownMenu, DropdownMenuContent, @@ -105,6 +105,7 @@ const useTableColumns = () => { cell: ({ row }) => { const router = useRouter(); const MySwal = withReactContent(Swal); + const roleId = Number(getCookiesDecrypt("urie")) || 0; async function deleteProcess(id: any) { loading(); @@ -170,6 +171,16 @@ const useTableColumns = () => { Edit + {roleId == 12 && ( + + + + Upload Tugas + + + )} TaskDelete(row.original.id)} className="p-2 border-b text-destructive bg-destructive/30 focus:bg-destructive focus:text-destructive-foreground rounded-none" diff --git a/app/[locale]/(protected)/contributor/task-ta/page.tsx b/app/[locale]/(protected)/contributor/task-ta/page.tsx index 7873633d..b1b9a4c5 100644 --- a/app/[locale]/(protected)/contributor/task-ta/page.tsx +++ b/app/[locale]/(protected)/contributor/task-ta/page.tsx @@ -5,7 +5,11 @@ import { Button } from "@/components/ui/button"; import { UploadIcon } from "lucide-react"; import SiteBreadcrumb from "@/components/site-breadcrumb"; import { Link } from "@/components/navigation"; -import { checkAuthorization, checkLoginSession } from "@/lib/utils"; +import { + checkAuthorization, + checkLoginSession, + getCookiesDecrypt, +} from "@/lib/utils"; import React, { useEffect } from "react"; import { useTranslations } from "next-intl"; import TaskTaTable from "./components/task-ta-table"; @@ -20,6 +24,7 @@ const TaskTaPage = () => { initState(); }, []); + const roleId = Number(getCookiesDecrypt("urie")) || 0; return (
@@ -33,12 +38,14 @@ const TaskTaPage = () => { {t("tabel")} {t("task-ta")}
- - - + {roleId !== 12 && ( + + + + )}
diff --git a/app/[locale]/(protected)/contributor/task-ta/upload-task/[id]/page.tsx b/app/[locale]/(protected)/contributor/task-ta/upload-task/[id]/page.tsx new file mode 100644 index 00000000..5ee62efc --- /dev/null +++ b/app/[locale]/(protected)/contributor/task-ta/upload-task/[id]/page.tsx @@ -0,0 +1,17 @@ +import { Card, CardContent } from "@/components/ui/card"; +import SiteBreadcrumb from "@/components/site-breadcrumb"; +import FormTaskTa from "@/components/form/task-ta/task-ta-form"; +import FormTaskTaNew from "@/components/form/task-ta/task-ta-upload-form"; + +const TaskTaUploadPage = () => { + return ( +
+ +
+ +
+
+ ); +}; + +export default TaskTaUploadPage; diff --git a/app/[locale]/(protected)/contributor/task/components/task-table.tsx b/app/[locale]/(protected)/contributor/task/components/task-table.tsx index 50b45411..fdd7be32 100644 --- a/app/[locale]/(protected)/contributor/task/components/task-table.tsx +++ b/app/[locale]/(protected)/contributor/task/components/task-table.tsx @@ -40,6 +40,7 @@ import { import { cn } from "@/lib/utils"; import { DropdownMenu, + DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuItem, DropdownMenuRadioGroup, @@ -338,6 +339,35 @@ const TaskTable = () => { + +
+ + + + + + {table + .getAllColumns() + .filter((column) => column.getCanHide()) + .map((column) => { + return ( + + column.toggleVisibility(!!value) + } + > + {column.id} + + ); + })} + + +
{/*
{ + return import("@/components/editor/view-editor"); + }, + { ssr: false } +); + export default function DetailDaily() { const id = useParams()?.id; const MySwal = withReactContent(Swal); @@ -725,16 +738,10 @@ export default function DetailDaily() { ( + render={({ field: { onChange, value } }) => ( Detail Perencanaan - + diff --git a/app/[locale]/(protected)/curator/task-plan/mediahub/create-daily/edit/[id]/page.tsx b/app/[locale]/(protected)/curator/task-plan/mediahub/create-daily/edit/[id]/page.tsx index 9697b9e2..5de5c34a 100644 --- a/app/[locale]/(protected)/curator/task-plan/mediahub/create-daily/edit/[id]/page.tsx +++ b/app/[locale]/(protected)/curator/task-plan/mediahub/create-daily/edit/[id]/page.tsx @@ -61,6 +61,7 @@ import { import { getOnlyDate } from "@/utils/globals"; import { useParams } from "next/navigation"; import { getPlanningById } from "@/service/planning/planning"; +import dynamic from "next/dynamic"; const FormSchema = z.object({ date: z.date({ @@ -118,7 +119,18 @@ const units = [ id: "3", label: "Polres", }, + { + id: "4", + label: "Satker", + }, ]; +const CustomEditor = dynamic( + () => { + return import("@/components/editor/custom-editor"); + }, + { ssr: false } +); + export default function EditDaily() { const id = useParams()?.id; const MySwal = withReactContent(Swal); @@ -728,15 +740,10 @@ export default function EditDaily() { ( + render={({ field: { onChange, value } }) => ( Detail Perencanaan - + diff --git a/app/[locale]/(protected)/curator/task-plan/mediahub/create-daily/page.tsx b/app/[locale]/(protected)/curator/task-plan/mediahub/create-daily/page.tsx index fc166890..1a48ecfc 100644 --- a/app/[locale]/(protected)/curator/task-plan/mediahub/create-daily/page.tsx +++ b/app/[locale]/(protected)/curator/task-plan/mediahub/create-daily/page.tsx @@ -59,6 +59,7 @@ import { savePlanning, } from "@/service/agenda-setting/agenda-setting"; import { getOnlyDate } from "@/utils/globals"; +import dynamic from "next/dynamic"; const FormSchema = z.object({ date: z.date({ @@ -116,7 +117,18 @@ const units = [ id: "3", label: "Polres", }, + { + id: "4", + label: "Satker", + }, ]; + +const CustomEditor = dynamic( + () => { + return import("@/components/editor/custom-editor"); + }, + { ssr: false } +); export default function CreateDaily() { const MySwal = withReactContent(Swal); const [listDest, setListDest] = useState([]); @@ -694,15 +706,10 @@ export default function CreateDaily() { ( + render={({ field: { onChange, value } }) => ( Detail Perencanaan - + diff --git a/app/[locale]/(protected)/curator/task-plan/mediahub/create-monthly/detail/[id]/page.tsx b/app/[locale]/(protected)/curator/task-plan/mediahub/create-monthly/detail/[id]/page.tsx index 80991505..a10f3bec 100644 --- a/app/[locale]/(protected)/curator/task-plan/mediahub/create-monthly/detail/[id]/page.tsx +++ b/app/[locale]/(protected)/curator/task-plan/mediahub/create-monthly/detail/[id]/page.tsx @@ -32,6 +32,7 @@ import { close, error, loading } from "@/config/swal"; import { savePlanning } from "@/service/agenda-setting/agenda-setting"; import { getPlanningById } from "@/service/planning/planning"; import { useParams } from "next/navigation"; +import dynamic from "next/dynamic"; const FormSchema = z.object({ month: z.date({ @@ -44,6 +45,13 @@ const FormSchema = z.object({ required_error: "Required", }), }); + +const ViewEditor = dynamic( + () => { + return import("@/components/editor/view-editor"); + }, + { ssr: false } +); export default function DetailMonthly() { const id = useParams()?.id; const MySwal = withReactContent(Swal); @@ -215,16 +223,10 @@ export default function DetailMonthly() { ( + render={({ field: { onChange, value } }) => ( Detail Perencanaan - + diff --git a/app/[locale]/(protected)/curator/task-plan/mediahub/create-monthly/edit/[id]/page.tsx b/app/[locale]/(protected)/curator/task-plan/mediahub/create-monthly/edit/[id]/page.tsx index ab6dc3ae..530e4318 100644 --- a/app/[locale]/(protected)/curator/task-plan/mediahub/create-monthly/edit/[id]/page.tsx +++ b/app/[locale]/(protected)/curator/task-plan/mediahub/create-monthly/edit/[id]/page.tsx @@ -32,6 +32,7 @@ import { close, error, loading } from "@/config/swal"; import { savePlanning } from "@/service/agenda-setting/agenda-setting"; import { getPlanningById } from "@/service/planning/planning"; import { useParams } from "next/navigation"; +import dynamic from "next/dynamic"; const FormSchema = z.object({ month: z.date({ @@ -44,6 +45,14 @@ const FormSchema = z.object({ required_error: "Required", }), }); + +const CustomEditor = dynamic( + () => { + return import("@/components/editor/custom-editor"); + }, + { ssr: false } +); + export default function EditMonthly() { const id = useParams()?.id; const MySwal = withReactContent(Swal); @@ -108,6 +117,8 @@ export default function EditMonthly() { }; const save = async (data: z.infer) => { + const month = new Date(data.month).getMonth() + 1; + const year = new Date(data.month).getFullYear(); const reqData = { id: id, planningTypeId: 1, @@ -115,9 +126,7 @@ export default function EditMonthly() { time: "3", description: data.detail, username: "", - date: `${new Date(data.month).getMonth() + 1}/${new Date( - data.month - ).getFullYear()}`, + date: `${month.toString().padStart(2, "0")}/${year}`, status: "Open", }; console.log("req", reqData, data.month); @@ -214,15 +223,10 @@ export default function EditMonthly() { ( + render={({ field: { onChange, value } }) => ( Detail Perencanaan - + diff --git a/app/[locale]/(protected)/curator/task-plan/mediahub/create-monthly/page.tsx b/app/[locale]/(protected)/curator/task-plan/mediahub/create-monthly/page.tsx index a581bbb0..8ecbbb2e 100644 --- a/app/[locale]/(protected)/curator/task-plan/mediahub/create-monthly/page.tsx +++ b/app/[locale]/(protected)/curator/task-plan/mediahub/create-monthly/page.tsx @@ -30,6 +30,9 @@ import Swal from "sweetalert2"; import withReactContent from "sweetalert2-react-content"; import { error } from "@/config/swal"; import { savePlanning } from "@/service/agenda-setting/agenda-setting"; +import month from "react-datepicker/dist/month"; +import year from "react-datepicker/dist/year"; +import dynamic from "next/dynamic"; const FormSchema = z.object({ month: z.date({ @@ -42,6 +45,12 @@ const FormSchema = z.object({ required_error: "Required", }), }); +const CustomEditor = dynamic( + () => { + return import("@/components/editor/custom-editor"); + }, + { ssr: false } +); export default function CreateMonthly() { const MySwal = withReactContent(Swal); const router = useRouter(); @@ -77,15 +86,15 @@ export default function CreateMonthly() { }; const save = async (data: z.infer) => { + const month = new Date(data.month).getMonth() + 1; + const year = new Date(data.month).getFullYear(); const reqData = { planningTypeId: 1, title: data.title, time: "3", description: data.detail, - username: "", - date: `${new Date(data.month).getMonth() + 1}/${new Date( - data.month - ).getFullYear()}`, + // username: "", + date: `${month.toString().padStart(2, "0")}/${year}`, status: "Open", }; console.log("req", reqData, data.month); @@ -110,6 +119,7 @@ export default function CreateMonthly() { const handleMonthSelect = (selectedDate: Date | undefined) => { if (!selectedDate) return; + // Set ke tanggal 1 agar tidak ada hari yang diambil const newDate = new Date( selectedDate.getFullYear(), selectedDate.getMonth(), @@ -198,15 +208,10 @@ export default function CreateMonthly() { ( + render={({ field: { onChange, value } }) => ( Detail Perencanaan - + diff --git a/app/[locale]/(protected)/curator/task-plan/mediahub/create-weekly/detail/[id]/page.tsx b/app/[locale]/(protected)/curator/task-plan/mediahub/create-weekly/detail/[id]/page.tsx index 8d1f652f..88aae51b 100644 --- a/app/[locale]/(protected)/curator/task-plan/mediahub/create-weekly/detail/[id]/page.tsx +++ b/app/[locale]/(protected)/curator/task-plan/mediahub/create-weekly/detail/[id]/page.tsx @@ -44,6 +44,7 @@ import { import dayjs from "dayjs"; import { getPlanningById } from "@/service/planning/planning"; import { useParams } from "next/navigation"; +import dynamic from "next/dynamic"; const FormSchema = z.object({ week: z.object({ @@ -61,7 +62,15 @@ const FormSchema = z.object({ required_error: "Required", }), }); -export default function DetailMonthly() { + +const ViewEditor = dynamic( + () => { + return import("@/components/editor/view-editor"); + }, + { ssr: false } +); + +export default function DetailWeekly() { const id = useParams()?.id; const MySwal = withReactContent(Swal); const router = useRouter(); @@ -227,16 +236,10 @@ export default function DetailMonthly() { ( + render={({ field: { onChange, value } }) => ( Detail Perencanaan - + diff --git a/app/[locale]/(protected)/curator/task-plan/mediahub/create-weekly/edit/[id]/page.tsx b/app/[locale]/(protected)/curator/task-plan/mediahub/create-weekly/edit/[id]/page.tsx index 1173fb81..a4d7ef68 100644 --- a/app/[locale]/(protected)/curator/task-plan/mediahub/create-weekly/edit/[id]/page.tsx +++ b/app/[locale]/(protected)/curator/task-plan/mediahub/create-weekly/edit/[id]/page.tsx @@ -44,6 +44,7 @@ import { import dayjs from "dayjs"; import { getPlanningById } from "@/service/planning/planning"; import { useParams } from "next/navigation"; +import dynamic from "next/dynamic"; const FormSchema = z.object({ week: z.object({ @@ -61,7 +62,14 @@ const FormSchema = z.object({ required_error: "Required", }), }); -export default function EditMonthly() { + +const CustomEditor = dynamic( + () => { + return import("@/components/editor/custom-editor"); + }, + { ssr: false } +); +export default function EditWeekly() { const id = useParams()?.id; const MySwal = withReactContent(Swal); const router = useRouter(); @@ -225,15 +233,10 @@ export default function EditMonthly() { ( + render={({ field: { onChange, value } }) => ( Detail Perencanaan - + diff --git a/app/[locale]/(protected)/curator/task-plan/mediahub/create-weekly/page.tsx b/app/[locale]/(protected)/curator/task-plan/mediahub/create-weekly/page.tsx index 6f854743..42e466ac 100644 --- a/app/[locale]/(protected)/curator/task-plan/mediahub/create-weekly/page.tsx +++ b/app/[locale]/(protected)/curator/task-plan/mediahub/create-weekly/page.tsx @@ -42,6 +42,14 @@ import { SelectValue, } from "@/components/ui/select"; import dayjs from "dayjs"; +import dynamic from "next/dynamic"; + +const CustomEditor = dynamic( + () => { + return import("@/components/editor/custom-editor"); + }, + { ssr: false } +); const FormSchema = z.object({ week: z.object({ @@ -260,15 +268,10 @@ export default function CreateMonthly() { ( + render={({ field: { onChange, value } }) => ( Detail Perencanaan - + diff --git a/app/[locale]/(protected)/curator/task-plan/medsos-mediahub/components/columns.tsx b/app/[locale]/(protected)/curator/task-plan/medsos-mediahub/components/columns.tsx index d7fd5b5b..ee6dc0c3 100644 --- a/app/[locale]/(protected)/curator/task-plan/medsos-mediahub/components/columns.tsx +++ b/app/[locale]/(protected)/curator/task-plan/medsos-mediahub/components/columns.tsx @@ -65,6 +65,16 @@ const columns: ColumnDef[] = [ Detail + + + Edit + + + + Delete + ); diff --git a/app/[locale]/(protected)/curator/task-plan/medsos-mediahub/create-daily/detail/[id]/page.tsx b/app/[locale]/(protected)/curator/task-plan/medsos-mediahub/create-daily/detail/[id]/page.tsx new file mode 100644 index 00000000..25bbe8c8 --- /dev/null +++ b/app/[locale]/(protected)/curator/task-plan/medsos-mediahub/create-daily/detail/[id]/page.tsx @@ -0,0 +1,766 @@ +"use client"; +import SiteBreadcrumb from "@/components/site-breadcrumb"; +import { Button } from "@/components/ui/button"; +import { Calendar } from "@/components/ui/calendar"; +import { Input } from "@/components/ui/input"; +import { + Popover, + PopoverContent, + PopoverTrigger, +} from "@/components/ui/popover"; +import { Link, useRouter } from "@/i18n/routing"; +import { CalendarIcon } from "lucide-react"; +import React, { useEffect, useRef, useState } from "react"; +import { cn } from "@/lib/utils"; +import { format } from "date-fns"; +import JoditEditor from "jodit-react"; +import { + Form, + FormControl, + FormDescription, + FormField, + FormItem, + FormLabel, + FormMessage, +} from "@/components/ui/form"; +import { z } from "zod"; +import { useForm } from "react-hook-form"; +import { zodResolver } from "@hookform/resolvers/zod"; +import Swal from "sweetalert2"; +import withReactContent from "sweetalert2-react-content"; +import { Checkbox } from "@/components/ui/checkbox"; +import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group"; +import { + Dialog, + DialogContent, + DialogHeader, + DialogTitle, + DialogTrigger, +} from "@/components/ui/dialog"; +import { getUserLevelForAssignments } from "@/service/task"; +import { list } from "postcss"; +import { + Accordion, + AccordionContent, + AccordionItem, + AccordionTrigger, +} from "@/components/ui/accordion"; +import { close, error, loading } from "@/config/swal"; +import { id } from "date-fns/locale"; +import { + Select, + SelectContent, + SelectItem, + SelectTrigger, + SelectValue, +} from "@/components/ui/select"; +import { + getWeeklyPlanList, + savePlanning, +} from "@/service/agenda-setting/agenda-setting"; +import { getOnlyDate } from "@/utils/globals"; +import { useParams } from "next/navigation"; +import { getPlanningById } from "@/service/planning/planning"; +import dynamic from "next/dynamic"; + +const FormSchema = z.object({ + date: z.date({ + required_error: "Required", + }), + title: z.string({ + required_error: "Required", + }), + detail: z.string({ + required_error: "Required", + }), + output: z.array(z.string()).refine((value) => value.some((item) => item), { + message: "Required", + }), + unit: z.array(z.string()).refine((value) => value.some((item) => item), { + message: "Required", + }), + type: z.string({ + required_error: "Required", + }), + parentId: z.string({ + required_error: "Required", + }), +}); + +const items = [ + { + id: "2", + label: "Audio Visual", + }, + { + id: "1", + label: "Foto", + }, + { + id: "4", + label: "Audio", + }, + { + id: "3", + label: "Text", + }, +]; + +const units = [ + { + id: "1", + label: "Mabes Polri", + }, + { + id: "2", + label: "Polda", + }, + { + id: "3", + label: "Polres", + }, + { + id: "4", + label: "Satker", + }, +]; + +const ViewEditor = dynamic( + () => { + return import("@/components/editor/view-editor"); + }, + { ssr: false } +); + +export default function DetailDaily() { + const id = useParams()?.id; + const MySwal = withReactContent(Swal); + const [listDest, setListDest] = useState([]); + const router = useRouter(); + const [weeklyList, setWeeklyList] = useState(); + const [selected, setSelected] = useState<{ [key: string]: boolean }>({}); + const [selectAll, setSelectAll] = useState<{ [key: string]: boolean }>({}); + + useEffect(() => { + initFetch(); + }, [id]); + + async function initFetch() { + if (id != undefined) { + loading(); + const res = await getPlanningById(id); + close(); + + if (res?.data?.data != undefined) { + const data = res?.data?.data; + console.log("data"); + console.log("Data :", data); + form.setValue("title", data.title); + form.setValue("detail", data.description); + form.setValue("date", new Date(data.date)); + form.setValue( + "output", + data.fileTypeOutput.split(",")?.length > 1 + ? data.fileTypeOutput.split(",") + : [data.fileTypeOutput] + ); + form.setValue( + "unit", + data.assignedToLevel.split(",")?.length > 1 + ? data.assignedToLevel.split(",") + : [data.assignedToLevel] + ); + form.setValue("type", String(data?.assignmentTypeId)); + form.setValue("parentId", String(data?.parentId)); + } + } + } + + useEffect(() => { + getWeeklyPlanning(); + }, []); + + async function getWeeklyPlanning() { + const res = await getWeeklyPlanList(new Date().getDate(), 2); + + if (res?.data !== null) { + const rawUser = res?.data?.data; + const optionArr = rawUser.map((option: any) => ({ + id: option.id, + label: option.title, + value: String(option.id), + })); + setWeeklyList(optionArr); + } + } + + const form = useForm>({ + resolver: zodResolver(FormSchema), + defaultValues: { + unit: [], + output: [], + detail: "", + }, + }); + const editor = useRef(null); + + const onSubmit = async (data: z.infer) => { + console.log("data", data); + if (form.getValues("detail") == "") { + form.setError("detail", { + type: "manual", + message: "Required", + }); + } else { + MySwal.fire({ + title: "Simpan Data", + text: "Apakah Anda yakin ingin menyimpan data ini?", + icon: "warning", + showCancelButton: true, + cancelButtonColor: "#d33", + confirmButtonColor: "#3085d6", + confirmButtonText: "Simpan", + }).then((result) => { + if (result.isConfirmed) { + save(data); + } + }); + } + }; + + const save = async (data: z.infer) => { + const getSelectedString = () => { + return Object.keys(selected) + .filter((key) => selected[key]) + .join(", "); + }; + console.log("data", data, selected); + loading(); + + const reqData = { + planningTypeId: 2, + time: "1", + title: data.title, + assignmentTypeId: data.type, //string + description: data.detail, + assignedToLevel: unit?.join(","), //string + assignmentPurpose: getSelectedString(), //string + fileTypeOutput: data.output?.join(","), //string + status: "Open", + date: getOnlyDate(data.date), + // date: + // isPublish || isUpdate + // ? selectedDate?.length > 10 + // ? data.date?.toISOString().slice(0, 10) + // : selectedDate + // : data.date?.toISOString().slice(0, 10), + parentId: Number(data.parentId), //number + assignmentMainTypeId: 1, + }; + + console.log("req =>", reqData); + const response = await savePlanning(reqData); + + if (response?.error) { + error(response?.message); + return false; + } + + close(); + MySwal.fire({ + title: "Sukses", + icon: "success", + confirmButtonColor: "#3085d6", + confirmButtonText: "OK", + }).then((result) => { + if (result.isConfirmed) { + router.push("/curator/task-plan/mediahub"); + } + }); + }; + + const output = form.watch("output"); + + const isAllChecked = items.every((item) => output?.includes(item.id)); + + const unit = form.watch("unit"); + + const isAllUnitChecked = units.every((item) => unit?.includes(item.id)); + + const handleAllCheckedChange = (checked: boolean | string) => { + if (checked) { + form.setValue( + "output", + items.map((item) => item.id) + ); + } else { + form.setValue("output", []); + } + }; + + const handleItemCheckedChange = (id: string, checked: boolean | string) => { + form.setValue( + "output", + checked ? [...output, id] : output.filter((value) => value !== id) + ); + }; + + const handleAllUnitCheckedChange = (checked: boolean | string) => { + if (checked) { + form.setValue( + "unit", + units.map((item) => item.id) + ); + } else { + form.setValue("unit", []); + } + }; + + const handleUnitCheckedChange = (id: string, checked: boolean | string) => { + if (checked) { + form.setValue("unit", [...unit, id]); + } else { + if (id == "2") { + const temp = []; + for (const element of unit) { + if (element == "1") { + temp.push("1"); + } + } + form.setValue("unit", temp); + } else { + form.setValue( + "unit", + unit.filter((value) => value !== id) + ); + } + } + }; + + useEffect(() => { + async function initState() { + const response = await getUserLevelForAssignments(); + setListDest(response?.data?.data.list); + } + + initState(); + }, []); + + const handleParentChange = (listId: string) => { + setSelected((prev) => ({ + ...prev, + [listId]: !prev[listId], + })); + }; + + const handleSelectAllPolres = (listId: string, isChecked: boolean) => { + setSelectAll((prev) => ({ + ...prev, + [listId]: isChecked, + })); + + setSelected((prev) => { + const updatedState = { ...prev }; + listDest + .find((list: any) => list.id === listId) + ?.subDestination.forEach((subDes: any) => { + updatedState[`${listId}${subDes.id}`] = isChecked; + }); + return updatedState; + }); + }; + + const handleChildChange = (childId: string) => { + setSelected((prev) => ({ + ...prev, + [childId]: !prev[childId], + })); + }; + + return ( +
+ +
+
+

Perencanaan MediaHub

+ +
+ + ( + + Judul Perencanaan + + + + + )} + /> + ( + +
+ Output Tugas +
+
+
+ + handleAllCheckedChange(checked) + } + disabled + /> + +
+ + {items.map((item) => ( + { + return ( + + + + handleItemCheckedChange(item.id, checked) + } + disabled + /> + + + {item.label} + + + ); + }} + /> + ))} +
+ +
+ )} + /> + ( + +
+ Pelaksana Tugas +
+
+
+ + handleAllUnitCheckedChange(checked) + } + disabled + /> + +
+ + {units.map((item) => ( + { + return ( + + + + handleUnitCheckedChange(item.id, checked) + } + disabled + /> + + + {item.label} + + + ); + }} + /> + ))} + + + + {`[Kustom]`} + + + + + + Daftar Wilayah Polda dan Polres + + +
+ {listDest?.map((list: any) => ( +
+ + +
+ + handleParentChange(list.id) + } + disabled={unit.includes("2")} + /> + + +
+ +
+
+ + handleSelectAllPolres( + list.id, + Boolean(e) + ) + } + disabled={unit.includes("3")} + /> + +
+ {list.subDestination.map( + (subDes: any) => ( +
+ + handleChildChange( + `${list.id}${subDes.id}` + ) + } + disabled={unit.includes("3")} + /> + +
+ ) + )} +
+
+
+
+
+ ))} +
+
+
+
+ +
+ )} + /> + ( + + Jenis Penugasan + + + + + + + + Publikasi + + + + + + + + Amplifikasi + + + + + + + Kontra + + + + + + )} + /> + ( + + Pilih Tanggal + + + + + + + + + + + )} + /> + ( + + Perencanaan Mingguan + + + + + )} + /> + ( + + Detail Perencanaan + + + + + )} + /> +
+ +
+ + +
+
+
+ ); +} diff --git a/app/[locale]/(protected)/curator/task-plan/medsos-mediahub/create-daily/edit/[id]/page.tsx b/app/[locale]/(protected)/curator/task-plan/medsos-mediahub/create-daily/edit/[id]/page.tsx new file mode 100644 index 00000000..a713a101 --- /dev/null +++ b/app/[locale]/(protected)/curator/task-plan/medsos-mediahub/create-daily/edit/[id]/page.tsx @@ -0,0 +1,771 @@ +"use client"; +import SiteBreadcrumb from "@/components/site-breadcrumb"; +import { Button } from "@/components/ui/button"; +import { Calendar } from "@/components/ui/calendar"; +import { Input } from "@/components/ui/input"; +import { + Popover, + PopoverContent, + PopoverTrigger, +} from "@/components/ui/popover"; +import { Link, useRouter } from "@/i18n/routing"; +import { CalendarIcon } from "lucide-react"; +import React, { useEffect, useRef, useState } from "react"; +import { cn } from "@/lib/utils"; +import { format } from "date-fns"; +import JoditEditor from "jodit-react"; +import { + Form, + FormControl, + FormDescription, + FormField, + FormItem, + FormLabel, + FormMessage, +} from "@/components/ui/form"; +import { z } from "zod"; +import { useForm } from "react-hook-form"; +import { zodResolver } from "@hookform/resolvers/zod"; +import Swal from "sweetalert2"; +import withReactContent from "sweetalert2-react-content"; +import { Checkbox } from "@/components/ui/checkbox"; +import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group"; +import { + Dialog, + DialogContent, + DialogHeader, + DialogTitle, + DialogTrigger, +} from "@/components/ui/dialog"; +import { getUserLevelForAssignments } from "@/service/task"; +import { list } from "postcss"; +import { + Accordion, + AccordionContent, + AccordionItem, + AccordionTrigger, +} from "@/components/ui/accordion"; +import { close, error, loading } from "@/config/swal"; +import { id, te } from "date-fns/locale"; +import { + Select, + SelectContent, + SelectItem, + SelectTrigger, + SelectValue, +} from "@/components/ui/select"; +import { + getWeeklyPlanList, + savePlanning, +} from "@/service/agenda-setting/agenda-setting"; +import { getOnlyDate } from "@/utils/globals"; +import { useParams } from "next/navigation"; +import { getPlanningById } from "@/service/planning/planning"; +import dynamic from "next/dynamic"; + +const FormSchema = z.object({ + date: z.date({ + required_error: "Required", + }), + title: z.string({ + required_error: "Required", + }), + detail: z.string({ + required_error: "Required", + }), + output: z.array(z.string()).refine((value) => value.some((item) => item), { + message: "Required", + }), + unit: z.array(z.string()).refine((value) => value.some((item) => item), { + message: "Required", + }), + type: z.string({ + required_error: "Required", + }), + parentId: z.string({ + required_error: "Required", + }), +}); + +const items = [ + { + id: "2", + label: "Audio Visual", + }, + { + id: "1", + label: "Foto", + }, + { + id: "4", + label: "Audio", + }, + { + id: "3", + label: "Text", + }, +]; + +const units = [ + { + id: "1", + label: "Mabes Polri", + }, + { + id: "2", + label: "Polda", + }, + { + id: "3", + label: "Polres", + }, + { + id: "4", + label: "Satker", + }, +]; +const CustomEditor = dynamic( + () => { + return import("@/components/editor/custom-editor"); + }, + { ssr: false } +); + +export default function EditDaily() { + const id = useParams()?.id; + const MySwal = withReactContent(Swal); + const [listDest, setListDest] = useState([]); + const router = useRouter(); + const [weeklyList, setWeeklyList] = useState(); + const [selected, setSelected] = useState<{ [key: string]: boolean }>({}); + const [selectAll, setSelectAll] = useState<{ [key: string]: boolean }>({}); + + useEffect(() => { + initFetch(); + }, [id]); + + async function initFetch() { + if (id != undefined) { + loading(); + const res = await getPlanningById(id); + close(); + + if (res?.data?.data != undefined) { + const data = res?.data?.data; + console.log("data"); + console.log("Data :", data); + form.setValue("title", data.title); + form.setValue("detail", data.description); + form.setValue("date", new Date(data.date)); + form.setValue( + "output", + data.fileTypeOutput.split(",")?.length > 1 + ? data.fileTypeOutput.split(",") + : [data.fileTypeOutput] + ); + form.setValue("type", String(data?.assignmentTypeId)); + form.setValue("parentId", String(data?.parentId)); + mapTopDestination(data?.assignedToLevel); + mapDestination(data?.assignedToTopLevel); + } + } + } + + const mapTopDestination = (data: string) => { + const temp: string[] = []; + data.split(",").map((list) => { + if (list.length < 2) { + temp.push(list); + } + }); + form.setValue("unit", temp); + }; + + const mapDestination = (data: string) => { + const temp: { [key: number]: boolean } = {}; + data.split(",").forEach((list) => { + temp[Number(list)] = true; + }); + setSelected(temp); + }; + + useEffect(() => { + getWeeklyPlanning(); + }, []); + + async function getWeeklyPlanning() { + const res = await getWeeklyPlanList(new Date().getDate(), 2); + + if (res?.data !== null) { + const rawUser = res?.data?.data; + const optionArr = rawUser.map((option: any) => ({ + id: option.id, + label: option.title, + value: String(option.id), + })); + setWeeklyList(optionArr); + } + } + + const form = useForm>({ + resolver: zodResolver(FormSchema), + defaultValues: { + unit: [], + output: [], + detail: "", + }, + }); + const editor = useRef(null); + + const onSubmit = async (data: z.infer) => { + console.log("data", data); + if (form.getValues("detail") == "") { + form.setError("detail", { + type: "manual", + message: "Required", + }); + } else { + MySwal.fire({ + title: "Simpan Data", + text: "Apakah Anda yakin ingin menyimpan data ini?", + icon: "warning", + showCancelButton: true, + cancelButtonColor: "#d33", + confirmButtonColor: "#3085d6", + confirmButtonText: "Simpan", + }).then((result) => { + if (result.isConfirmed) { + save(data); + } + }); + } + }; + + const save = async (data: z.infer) => { + const getSelectedString = () => { + return Object.keys(selected) + .filter((key) => selected[key]) + .join(", "); + }; + console.log("data", data, selected); + loading(); + + const reqData = { + id: id, + planningTypeId: 2, + time: "1", + title: data.title, + assignmentTypeId: data.type, //string + description: data.detail, + assignedToLevel: unit?.join(","), //string + assignmentPurpose: getSelectedString(), //string + fileTypeOutput: data.output?.join(","), //string + status: "Open", + date: getOnlyDate(data.date), + // date: + // isPublish || isUpdate + // ? selectedDate?.length > 10 + // ? data.date?.toISOString().slice(0, 10) + // : selectedDate + // : data.date?.toISOString().slice(0, 10), + parentId: Number(data.parentId), //number + assignmentMainTypeId: 1, + }; + + const response = await savePlanning(reqData); + + if (response?.error) { + error(response?.message); + return false; + } + + close(); + MySwal.fire({ + title: "Sukses", + icon: "success", + confirmButtonColor: "#3085d6", + confirmButtonText: "OK", + }).then((result) => { + if (result.isConfirmed) { + router.push("/curator/task-plan/mediahub"); + } + }); + }; + + const output = form.watch("output"); + + const isAllChecked = items.every((item) => output?.includes(item.id)); + + const unit = form.watch("unit"); + + const isAllUnitChecked = units.every((item) => unit?.includes(item.id)); + + const handleAllCheckedChange = (checked: boolean | string) => { + if (checked) { + form.setValue( + "output", + items.map((item) => item.id) + ); + } else { + form.setValue("output", []); + } + }; + + const handleItemCheckedChange = (id: string, checked: boolean | string) => { + form.setValue( + "output", + checked ? [...output, id] : output.filter((value) => value !== id) + ); + }; + + const handleAllUnitCheckedChange = (checked: boolean | string) => { + if (checked) { + form.setValue( + "unit", + units.map((item) => item.id) + ); + } else { + form.setValue("unit", []); + } + }; + + const handleUnitCheckedChange = (id: string, checked: boolean | string) => { + if (checked) { + form.setValue("unit", [...unit, id]); + } else { + if (id == "2") { + const temp = []; + for (const element of unit) { + if (element == "1") { + temp.push("1"); + } + } + form.setValue("unit", temp); + } else { + form.setValue( + "unit", + unit.filter((value) => value !== id) + ); + } + } + }; + + useEffect(() => { + async function initState() { + const response = await getUserLevelForAssignments(); + setListDest(response?.data?.data.list); + } + + initState(); + }, []); + + const handleParentChange = (listId: string) => { + setSelected((prev) => ({ + ...prev, + [listId]: !prev[listId], + })); + }; + + const handleSelectAllPolres = (listId: string, isChecked: boolean) => { + setSelectAll((prev) => ({ + ...prev, + [listId]: isChecked, + })); + + setSelected((prev) => { + const updatedState = { ...prev }; + listDest + .find((list: any) => list.id === listId) + ?.subDestination.forEach((subDes: any) => { + updatedState[`${listId}${subDes.id}`] = isChecked; + }); + return updatedState; + }); + }; + + const handleChildChange = (childId: string) => { + setSelected((prev) => ({ + ...prev, + [childId]: !prev[childId], + })); + }; + + return ( +
+ +
+
+

Perencanaan MediaHub

+ +
+ + ( + + Judul Perencanaan + + + + + )} + /> + ( + +
+ Output Tugas +
+
+
+ + handleAllCheckedChange(checked) + } + /> + +
+ + {items.map((item) => ( + { + return ( + + + + handleItemCheckedChange(item.id, checked) + } + /> + + + {item.label} + + + ); + }} + /> + ))} +
+ +
+ )} + /> + ( + +
+ Pelaksana Tugas +
+
+
+ + handleAllUnitCheckedChange(checked) + } + /> + +
+ + {units.map((item) => ( + { + return ( + + + + handleUnitCheckedChange(item.id, checked) + } + /> + + + {item.label} + + + ); + }} + /> + ))} + + + + {`[Kustom]`} + + + + + + Daftar Wilayah Polda dan Polres + + +
+ {listDest?.map((list: any) => ( +
+ + +
+ + handleParentChange(list.id) + } + disabled={unit.includes("2")} + /> + + +
+ +
+
+ + handleSelectAllPolres( + list.id, + Boolean(e) + ) + } + disabled={unit.includes("3")} + /> + +
+ {list.subDestination.map( + (subDes: any) => ( +
+ + handleChildChange( + `${list.id}${subDes.id}` + ) + } + disabled={unit.includes("3")} + /> + +
+ ) + )} +
+
+
+
+
+ ))} +
+
+
+
+ +
+ )} + /> + ( + + Jenis Penugasan + + + + + + + + Publikasi + + + + + + + + Amplifikasi + + + + + + + Kontra + + + + + + )} + /> + ( + + Pilih Tanggal + + + + + + + + + + + )} + /> + ( + + Perencanaan Mingguan + + + + + )} + /> + ( + + Detail Perencanaan + + + + + )} + /> +
+ + +
+ + +
+
+
+ ); +} diff --git a/app/[locale]/(protected)/curator/task-plan/medsos-mediahub/create-daily/page.tsx b/app/[locale]/(protected)/curator/task-plan/medsos-mediahub/create-daily/page.tsx index c739bc83..d26347cd 100644 --- a/app/[locale]/(protected)/curator/task-plan/medsos-mediahub/create-daily/page.tsx +++ b/app/[locale]/(protected)/curator/task-plan/medsos-mediahub/create-daily/page.tsx @@ -58,6 +58,7 @@ import { DialogTrigger, } from "@/components/ui/dialog"; import { getUserLevelForAssignments } from "@/service/task"; +import dynamic from "next/dynamic"; const FormSchema = z.object({ date: z.date({ @@ -141,8 +142,20 @@ const units = [ id: "3", label: "Polres", }, + { + id: "4", + label: "Satker", + }, ]; -export default function CreateMonthly() { + +const CustomEditor = dynamic( + () => { + return import("@/components/editor/custom-editor"); + }, + { ssr: false } +); + +export default function CreateDaily() { const MySwal = withReactContent(Swal); const [weeklyList, setWeeklyList] = useState(); const router = useRouter(); @@ -760,15 +773,10 @@ export default function CreateMonthly() { ( + render={({ field: { onChange, value } }) => ( Detail Perencanaan - + diff --git a/app/[locale]/(protected)/curator/task-plan/medsos-mediahub/create-monthly/detail/[id]/page.tsx b/app/[locale]/(protected)/curator/task-plan/medsos-mediahub/create-monthly/detail/[id]/page.tsx index 80991505..a7af5287 100644 --- a/app/[locale]/(protected)/curator/task-plan/medsos-mediahub/create-monthly/detail/[id]/page.tsx +++ b/app/[locale]/(protected)/curator/task-plan/medsos-mediahub/create-monthly/detail/[id]/page.tsx @@ -32,6 +32,7 @@ import { close, error, loading } from "@/config/swal"; import { savePlanning } from "@/service/agenda-setting/agenda-setting"; import { getPlanningById } from "@/service/planning/planning"; import { useParams } from "next/navigation"; +import dynamic from "next/dynamic"; const FormSchema = z.object({ month: z.date({ @@ -44,6 +45,13 @@ const FormSchema = z.object({ required_error: "Required", }), }); + +const ViewEditor = dynamic( + () => { + return import("@/components/editor/view-editor"); + }, + { ssr: false } +); export default function DetailMonthly() { const id = useParams()?.id; const MySwal = withReactContent(Swal); @@ -108,15 +116,15 @@ export default function DetailMonthly() { }; const save = async (data: z.infer) => { + const month = new Date(data.month).getMonth() + 1; + const year = new Date(data.month).getFullYear(); const reqData = { planningTypeId: 1, title: data.title, time: "3", description: data.detail, username: "", - date: `${new Date(data.month).getMonth() + 1}/${new Date( - data.month - ).getFullYear()}`, + date: `${month.toString().padStart(2, "0")}/${year}`, status: "Open", }; console.log("req", reqData, data.month); @@ -215,16 +223,10 @@ export default function DetailMonthly() { ( + render={({ field: { onChange, value } }) => ( Detail Perencanaan - + diff --git a/app/[locale]/(protected)/curator/task-plan/medsos-mediahub/create-monthly/edit/[id]/page.tsx b/app/[locale]/(protected)/curator/task-plan/medsos-mediahub/create-monthly/edit/[id]/page.tsx index ab6dc3ae..bd23381d 100644 --- a/app/[locale]/(protected)/curator/task-plan/medsos-mediahub/create-monthly/edit/[id]/page.tsx +++ b/app/[locale]/(protected)/curator/task-plan/medsos-mediahub/create-monthly/edit/[id]/page.tsx @@ -32,6 +32,7 @@ import { close, error, loading } from "@/config/swal"; import { savePlanning } from "@/service/agenda-setting/agenda-setting"; import { getPlanningById } from "@/service/planning/planning"; import { useParams } from "next/navigation"; +import dynamic from "next/dynamic"; const FormSchema = z.object({ month: z.date({ @@ -44,6 +45,13 @@ const FormSchema = z.object({ required_error: "Required", }), }); + +const CustomEditor = dynamic( + () => { + return import("@/components/editor/custom-editor"); + }, + { ssr: false } +); export default function EditMonthly() { const id = useParams()?.id; const MySwal = withReactContent(Swal); @@ -108,6 +116,8 @@ export default function EditMonthly() { }; const save = async (data: z.infer) => { + const month = new Date(data.month).getMonth() + 1; + const year = new Date(data.month).getFullYear(); const reqData = { id: id, planningTypeId: 1, @@ -115,9 +125,7 @@ export default function EditMonthly() { time: "3", description: data.detail, username: "", - date: `${new Date(data.month).getMonth() + 1}/${new Date( - data.month - ).getFullYear()}`, + date: `${month.toString().padStart(2, "0")}/${year}`, status: "Open", }; console.log("req", reqData, data.month); @@ -214,15 +222,10 @@ export default function EditMonthly() { ( + render={({ field: { onChange, value } }) => ( Detail Perencanaan - + diff --git a/app/[locale]/(protected)/curator/task-plan/medsos-mediahub/create-monthly/page.tsx b/app/[locale]/(protected)/curator/task-plan/medsos-mediahub/create-monthly/page.tsx index dfb0ac47..8c61aa68 100644 --- a/app/[locale]/(protected)/curator/task-plan/medsos-mediahub/create-monthly/page.tsx +++ b/app/[locale]/(protected)/curator/task-plan/medsos-mediahub/create-monthly/page.tsx @@ -30,6 +30,7 @@ import Swal from "sweetalert2"; import withReactContent from "sweetalert2-react-content"; import { error } from "@/config/swal"; import { savePlanning } from "@/service/agenda-setting/agenda-setting"; +import dynamic from "next/dynamic"; const FormSchema = z.object({ month: z.date({ @@ -42,6 +43,12 @@ const FormSchema = z.object({ required_error: "Required", }), }); +const CustomEditor = dynamic( + () => { + return import("@/components/editor/custom-editor"); + }, + { ssr: false } +); export default function CreateMonthly() { const MySwal = withReactContent(Swal); const router = useRouter(); @@ -77,15 +84,15 @@ export default function CreateMonthly() { }; const save = async (data: z.infer) => { + const month = new Date(data.month).getMonth() + 1; + const year = new Date(data.month).getFullYear(); const reqData = { planningTypeId: 2, title: data.title, time: "3", description: data.detail, username: "", - date: `${new Date(data.month).getMonth() + 1}/${new Date( - data.month - ).getFullYear()}`, + date: `${month.toString().padStart(2, "0")}/${year}`, status: "Open", }; console.log("req", reqData, data.month); @@ -198,15 +205,10 @@ export default function CreateMonthly() { ( + render={({ field: { onChange, value } }) => ( Detail Perencanaan - + diff --git a/app/[locale]/(protected)/curator/task-plan/medsos-mediahub/create-weekly/detail/[id]/page.tsx b/app/[locale]/(protected)/curator/task-plan/medsos-mediahub/create-weekly/detail/[id]/page.tsx index 8d1f652f..88aae51b 100644 --- a/app/[locale]/(protected)/curator/task-plan/medsos-mediahub/create-weekly/detail/[id]/page.tsx +++ b/app/[locale]/(protected)/curator/task-plan/medsos-mediahub/create-weekly/detail/[id]/page.tsx @@ -44,6 +44,7 @@ import { import dayjs from "dayjs"; import { getPlanningById } from "@/service/planning/planning"; import { useParams } from "next/navigation"; +import dynamic from "next/dynamic"; const FormSchema = z.object({ week: z.object({ @@ -61,7 +62,15 @@ const FormSchema = z.object({ required_error: "Required", }), }); -export default function DetailMonthly() { + +const ViewEditor = dynamic( + () => { + return import("@/components/editor/view-editor"); + }, + { ssr: false } +); + +export default function DetailWeekly() { const id = useParams()?.id; const MySwal = withReactContent(Swal); const router = useRouter(); @@ -227,16 +236,10 @@ export default function DetailMonthly() { ( + render={({ field: { onChange, value } }) => ( Detail Perencanaan - + diff --git a/app/[locale]/(protected)/curator/task-plan/medsos-mediahub/create-weekly/edit/[id]/page.tsx b/app/[locale]/(protected)/curator/task-plan/medsos-mediahub/create-weekly/edit/[id]/page.tsx index 1173fb81..2ec52087 100644 --- a/app/[locale]/(protected)/curator/task-plan/medsos-mediahub/create-weekly/edit/[id]/page.tsx +++ b/app/[locale]/(protected)/curator/task-plan/medsos-mediahub/create-weekly/edit/[id]/page.tsx @@ -44,6 +44,7 @@ import { import dayjs from "dayjs"; import { getPlanningById } from "@/service/planning/planning"; import { useParams } from "next/navigation"; +import dynamic from "next/dynamic"; const FormSchema = z.object({ week: z.object({ @@ -61,7 +62,13 @@ const FormSchema = z.object({ required_error: "Required", }), }); -export default function EditMonthly() { +const CustomEditor = dynamic( + () => { + return import("@/components/editor/custom-editor"); + }, + { ssr: false } +); +export default function EditWeekly() { const id = useParams()?.id; const MySwal = withReactContent(Swal); const router = useRouter(); @@ -225,15 +232,10 @@ export default function EditMonthly() { ( + render={({ field: { onChange, value } }) => ( Detail Perencanaan - + diff --git a/app/[locale]/(protected)/curator/task-plan/medsos-mediahub/create-weekly/page.tsx b/app/[locale]/(protected)/curator/task-plan/medsos-mediahub/create-weekly/page.tsx index e3707a90..e2588f21 100644 --- a/app/[locale]/(protected)/curator/task-plan/medsos-mediahub/create-weekly/page.tsx +++ b/app/[locale]/(protected)/curator/task-plan/medsos-mediahub/create-weekly/page.tsx @@ -41,6 +41,7 @@ import { SelectTrigger, SelectValue, } from "@/components/ui/select"; +import dynamic from "next/dynamic"; const FormSchema = z.object({ week: z.object({ @@ -61,6 +62,12 @@ const FormSchema = z.object({ required_error: "Required", }), }); +const CustomEditor = dynamic( + () => { + return import("@/components/editor/custom-editor"); + }, + { ssr: false } +); export default function CreateMonthly() { const MySwal = withReactContent(Swal); const router = useRouter(); @@ -261,15 +268,10 @@ export default function CreateMonthly() { ( + render={({ field: { onChange, value } }) => ( Detail Perencanaan - + diff --git a/app/[locale]/(protected)/dashboard/executive/page.tsx b/app/[locale]/(protected)/dashboard/executive/page.tsx index 0decf9a8..e161b04c 100644 --- a/app/[locale]/(protected)/dashboard/executive/page.tsx +++ b/app/[locale]/(protected)/dashboard/executive/page.tsx @@ -20,144 +20,13 @@ import { useEffect, useState } from "react"; import Cookies from "js-cookie"; export default function ExecutiveDashboard() { - // const downloadReport = async () => { - // // const formattedDate = `${reportDate.year}-${String( - // // reportDate.month - // // ).padStart(2, "0")}-${String(reportDate.day).padStart(2, "0")}`; - // // const resLogin = await tableauSignin(); - // // const token = resLogin?.data.data?.credentials?.token; - // // const resCover = await tableauViewImage( - // // token, - // // "1df3df4a-0457-4483-a8e1-160f70e7834f", - // // formattedDate - // // ); - // // const resTotalLink = await tableauViewImage( - // // token, - // // "8f902032-a6eb-4083-817a-57350f509b75", - // // formattedDate - // // ); - // // const resCount = await tableauViewImage( - // // token, - // // "11b2fe3c-f853-4156-800e-43342bf8e5ce", - // // formattedDate - // // ); - // // const resCoverCommentTwitter = await tableauViewImage( - // // token, - // // "28183e0b-80d0-428d-8684-2cbb572e97b3", - // // formattedDate, - // // 2 - // // ); - // // const resCoverCommentTiktok = await tableauViewImage( - // // token, - // // "28183e0b-80d0-428d-8684-2cbb572e97b3", - // // formattedDate, - // // 3 - // // ); - // // const resCoverCommentFacebook = await tableauViewImage( - // // token, - // // "28183e0b-80d0-428d-8684-2cbb572e97b3", - // // formattedDate, - // // 4 - // // ); - // // const resCoverCommentInstagram = await tableauViewImage( - // // token, - // // "28183e0b-80d0-428d-8684-2cbb572e97b3", - // // formattedDate, - // // 5 - // // ); - // // const resCoverCommentYoutube = await tableauViewImage( - // // token, - // // "28183e0b-80d0-428d-8684-2cbb572e97b3", - // // formattedDate, - // // 6 - // // ); - // // const resCommentTwitter = await tableauViewImage( - // // token, - // // "9a6d05ed-dea7-4a93-b709-82d0dab4790d", - // // formattedDate, - // // 2 - // // ); - // // const resCommentTiktok = await tableauViewImage( - // // token, - // // "9a6d05ed-dea7-4a93-b709-82d0dab4790d", - // // formattedDate, - // // 3 - // // ); - // // const resCommentFacebook = await tableauViewImage( - // // token, - // // "9a6d05ed-dea7-4a93-b709-82d0dab4790d", - // // formattedDate, - // // 4 - // // ); - // // const resCommentInstagram = await tableauViewImage( - // // token, - // // "9a6d05ed-dea7-4a93-b709-82d0dab4790d", - // // formattedDate, - // // 5 - // // ); - // // const resCommentYoutube = await tableauViewImage( - // // token, - // // "9a6d05ed-dea7-4a93-b709-82d0dab4790d", - // // formattedDate, - // // 6 - // // ); - // // const blobCover = new Blob([resCover.data], { type: "image/png" }); - // // const blobTotalLink = new Blob([resTotalLink.data], { type: "image/png" }); - // // const blobCount = new Blob([resCount.data], { type: "image/png" }); - // // const blobCoverCommentTwitter = new Blob([resCoverCommentTwitter.data], { - // // type: "image/png", - // // }); - // // const blobCoverCommentTiktok = new Blob([resCoverCommentTiktok.data], { - // // type: "image/png", - // // }); - // // const blobCoverCommentFacebook = new Blob([resCoverCommentFacebook.data], { - // // type: "image/png", - // // }); - // // const blobCoverCommentInstagram = new Blob( - // // [resCoverCommentInstagram.data], - // // { type: "image/png" } - // // ); - // // const blobCoverCommentYoutube = new Blob([resCoverCommentYoutube.data], { - // // type: "image/png", - // // }); - // // const blobCommentTwitter = new Blob([resCommentTwitter.data], { - // // type: "image/png", - // // }); - // // const blobCommentTiktok = new Blob([resCommentTiktok.data], { - // // type: "image/png", - // // }); - // // const blobCommentFacebook = new Blob([resCommentFacebook.data], { - // // type: "image/png", - // // }); - // // const blobCommentInstagram = new Blob([resCommentInstagram.data], { - // // type: "image/png", - // // }); - // // const blobCommentYoutube = new Blob([resCommentYoutube.data], { - // // type: "image/png", - // // }); - // // await pdfGenerator([ - // // blobCover, - // // blobTotalLink, - // // blobCount, - // // blobCoverCommentTwitter, - // // blobCommentTwitter, - // // blobCoverCommentTiktok, - // // blobCommentTiktok, - // // blobCoverCommentFacebook, - // // blobCommentFacebook, - // // blobCoverCommentInstagram, - // // blobCommentInstagram, - // // blobCoverCommentYoutube, - // // blobCommentYoutube, - // // ]); - // }; - const [startDate, setStartDate] = useState(new Date()); const [endDate, setEndDate] = useState(new Date()); const [hasMounted, setHasMounted] = useState(false); // const t = useTranslations("AnalyticsDashboard"); const levelName = getCookiesDecrypt("ulnae"); - const poldaState = Cookies.get("state"); + const levelNumber = getCookiesDecrypt("ulne"); + const state = Cookies.get("state"); const provState = Cookies.get("state-prov"); const [ticket1, setTicket1] = useState(""); @@ -171,42 +40,63 @@ export default function ExecutiveDashboard() { const baseUrl = "https://analytic.sitani.info/"; const url = "https://analytic.sitani.info/trusted/"; + const safeLevelName = levelNumber ?? ""; + const view1 = levelName == "MABES POLRI" ? isInternational[0] - ? "views/2023_08_MediaHUB-KtnMgt_Rev100/db-emg-issue?" - : "views/2023_08_MediaHUB-KtnMgt_Rev100/db-emg-issue?" - : `views/2023_08_MediaHUB-KtnMgt_Rev100/db-emg-issue?provinsi-polda=${provState}&`; + ? "views/2023_08_MediaHUB-KtnMgt_Rev100/db-emg-issue-executive?" + : "views/2023_08_MediaHUB-KtnMgt_Rev100/db-emg-issue-executive?" + : safeLevelName.includes("POLDA") + ? `views/2023_08_MediaHUB-KtnMgt_Rev100/db-emg-issue?provinsi-polda=${state}&` + : `views/2023_08_MediaHUB-KtnMgt_Rev100/db-emg-issue?provinsi-polda=${state}&`; const view2 = levelName == "MABES POLRI" ? isInternational[1] ? "views/2023_04_MediaHUB-Viz_INTL_Rev202/db-published-produksi?" : "views/2023_04_MediaHUB-Viz-POLDA_Rev200/db-published-produksi-executive?" - : `views/2023_04_MediaHUB-Viz-POLDA_Rev200/db-konten-publisher-polda-executive?provinsi-polda=${poldaState}&`; + : safeLevelName.includes("POLDA") + ? `views/2023_04_MediaHUB-Viz-POLDA_Rev200/db-published-produksi-polda-executive?polda-selected=${state}&` + : `views/2023_04_MediaHUB-Viz-POLDA_Rev200/db-published-produksi-polda-executive?polda-selected=${state}&`; const view3 = levelName == "MABES POLRI" ? isInternational[2] ? "views/2023_04_MediaHUB-Viz_INTL_Rev202/db-waktu-akses-pengguna?" : "views/2023_04_MediaHUB-Viz-POLDA_Rev200/db-waktu-akses-pengguna-executive?" - : `views/2023_04_MediaHUB-Viz-POLDA_Rev200/db-waktu-akses-pengguna-polda-executive?provinsi-polda=${poldaState}&`; + : safeLevelName.includes("POLDA") + ? `views/2023_04_MediaHUB-Viz-POLDA_Rev200/db-waktu-akses-pengguna-polda-executive?polda-selected=${state}&` + : `views/2023_04_MediaHUB-Viz-POLDA_Rev200/db-waktu-akses-pengguna-polda-executive?polda-selected=${state}&`; const view4 = levelName == "MABES POLRI" ? isInternational[1] ? "views/2023_04_MediaHUB-Viz-POLDA_Rev200/db-content-interaction-polda?" : "views/2023_04_MediaHUB-Viz-POLDA_Rev200/db-content-interaction-polda?" - : `views/2023_04_MediaHUB-Viz-POLDA_Rev200/db-content-interaction-polda?provinsi-polda=${poldaState}&`; + : safeLevelName.includes("POLDA") + ? `views/2023_04_MediaHUB-Viz-POLDA_Rev200/db-content-interaction-polda?polda-selected=${state}&` + : `views/2023_04_MediaHUB-Viz-POLDA_Rev200/db-content-interaction-polda?polda-selected=${state}&`; const view5 = levelName == "MABES POLRI" ? isInternational[1] ? "views/2023_04_MediaHUB-Viz-POLDA_Rev200/db-content-interaction-polres?" : "views/2023_04_MediaHUB-Viz-POLDA_Rev200/db-content-interaction-polres?" - : `views/2023_04_MediaHUB-Viz-POLDA_Rev200/db-content-interaction-polres?provinsi-polda=${poldaState}&`; + : safeLevelName.includes("POLDA") + ? `views/2023_04_MediaHUB-Viz-POLDA_Rev200/db-content-interaction-polres?provinsi-polda=${state}&` + : `views/2023_04_MediaHUB-Viz-POLDA_Rev200/db-content-interaction-polres?provinsi-polda=${state}&`; - const param = ":embed=yes&:toolbar=yes&:iframeSizedToWindow=true"; + const view6 = + levelName == "MABES POLRI" + ? isInternational[1] + ? "views/2023_04_MediaHUB-Viz-POLDA_Rev200/db-content-interaction-satker?" + : "views/2023_04_MediaHUB-Viz-POLDA_Rev200/db-content-interaction-satker?" + : safeLevelName.includes("POLDA") + ? `views/2023_04_MediaHUB-Viz-POLDA_Rev200/db-content-interaction-satker?satker-selected=${state}&` + : `views/2023_04_MediaHUB-Viz-POLDA_Rev200/db-content-interaction-satker?satker-selected=${state}&`; + + const param = ":embed=yes&:toolbar=no&:iframeSizedToWindow=true"; useEffect(() => { async function initState() { @@ -250,88 +140,107 @@ export default function ExecutiveDashboard() { return (
-
- -
-

- Upload konten hari ini Polda -

- -
-
- {ticket1 == "" ? ( -