diff --git a/app/[locale]/(protected)/admin/performance-polda/page.tsx b/app/[locale]/(protected)/admin/performance-polda/page.tsx
index f3d145fe..df7d89c1 100644
--- a/app/[locale]/(protected)/admin/performance-polda/page.tsx
+++ b/app/[locale]/(protected)/admin/performance-polda/page.tsx
@@ -1,10 +1,12 @@
import SiteBreadcrumb from "@/components/site-breadcrumb";
+import PerformancePoldaViz from "@/components/visualization/performance-polda";
export default function PerformancePolda() {
return (
PERFORMANCE KUMULATIF PER POLDA
+
);
}
diff --git a/app/[locale]/(protected)/admin/performance-polres/page.tsx b/app/[locale]/(protected)/admin/performance-polres/page.tsx
new file mode 100644
index 00000000..7301a74e
--- /dev/null
+++ b/app/[locale]/(protected)/admin/performance-polres/page.tsx
@@ -0,0 +1,12 @@
+import SiteBreadcrumb from "@/components/site-breadcrumb";
+import PerformancePolresViz from "@/components/visualization/performance-polres";
+
+export default function PerformancePolda() {
+ return (
+
+
+
PERFORMANCE KUMULATIF PER POLDA
+
+
+ );
+}
diff --git a/components/visualization/performance-polda.tsx b/components/visualization/performance-polda.tsx
new file mode 100644
index 00000000..30a0f57e
--- /dev/null
+++ b/components/visualization/performance-polda.tsx
@@ -0,0 +1,86 @@
+"use client";
+import Cookies from "js-cookie";
+import { useEffect, useState } from "react";
+import { getCookiesDecrypt } from "@/lib/utils";
+import { generateTicket } from "@/service/tableau/tableau-service";
+import { Button } from "../ui/button";
+import { useTranslations } from "next-intl";
+
+export default function PerformancePoldaViz() {
+ const [hasMounted, setHasMounted] = useState(false);
+ const t = useTranslations("AnalyticsDashboard");
+ const levelName = getCookiesDecrypt("ulnae");
+ const poldaState = Cookies.get("state");
+ const provState = Cookies.get("state-prov");
+
+ const [ticket1, setTicket1] = useState("");
+ const [ticket2, setTicket2] = useState("");
+ const [ticket3, setTicket3] = useState("");
+ const [ticket4, setTicket4] = useState("");
+ const [isInternational, setIsInternational] = useState([false, false, false]);
+
+ const baseUrl = "https://db-mediahub.polri.go.id/";
+ const url = "https://db-mediahub.polri.go.id/trusted/";
+
+ const view1 =
+ levelName == "MABES POLRI"
+ ? isInternational[0]
+ ? "views/2023_04_MediaHUB-Viz_INTL_Rev202/db-konten-top10?"
+ : "views/2023_04_MediaHUB-Viz-POLDA_Rev201/db-konten-top10?"
+ : `/views/2023_09_db-ranking-polres-by-polda_rev100/db-ranking-by-polda?`;
+
+ const param = ":embed=yes&:toolbar=yes&:iframeSizedToWindow=true";
+
+ useEffect(() => {
+ async function initState() {
+ const response1 = await generateTicket();
+ setTicket1(response1?.data?.data);
+ }
+
+ initState();
+ }, [isInternational]);
+
+ // Hooks
+ useEffect(() => {
+ setHasMounted(true);
+ }, []);
+
+ // Render
+ if (!hasMounted) return null;
+
+ const handleInternational = (index: number, val: boolean) => {
+ const updatedIsInternational = [...isInternational];
+
+ updatedIsInternational[index] = val;
+ setIsInternational(updatedIsInternational);
+ };
+
+ return (
+
+
+
+ {isInternational[0]
+ ? "POLRES PERFORMANCE"
+ : "POLFORMANCE POLRES"}
+
+
+
+ {ticket1 == "" ? (
+
+ ) : (
+
+ )}
+
+
+ );
+}
diff --git a/components/visualization/performance-polres.tsx b/components/visualization/performance-polres.tsx
new file mode 100644
index 00000000..29d3dd96
--- /dev/null
+++ b/components/visualization/performance-polres.tsx
@@ -0,0 +1,86 @@
+"use client";
+import Cookies from "js-cookie";
+import { useEffect, useState } from "react";
+import { getCookiesDecrypt } from "@/lib/utils";
+import { generateTicket } from "@/service/tableau/tableau-service";
+import { Button } from "../ui/button";
+import { useTranslations } from "next-intl";
+
+export default function PerformancePolresViz() {
+ const [hasMounted, setHasMounted] = useState(false);
+ const t = useTranslations("AnalyticsDashboard");
+ const levelName = getCookiesDecrypt("ulnae");
+ const poldaState = Cookies.get("state");
+ const provState = Cookies.get("state-prov");
+
+ const [ticket1, setTicket1] = useState("");
+ const [ticket2, setTicket2] = useState("");
+ const [ticket3, setTicket3] = useState("");
+ const [ticket4, setTicket4] = useState("");
+ const [isInternational, setIsInternational] = useState([false, false, false]);
+
+ const baseUrl = "https://db-mediahub.polri.go.id/";
+ const url = "https://db-mediahub.polri.go.id/trusted/";
+
+ const view1 =
+ levelName == "MABES POLRI"
+ ? isInternational[0]
+ ? "views/2023_04_MediaHUB-Viz_INTL_Rev202/db-konten-top10?"
+ : "views/2023_04_MediaHUB-Viz-POLDA_Rev201/db-konten-top10?"
+ : `/views/2023_09_db-ranking-polres-by-polda_rev100/db-ranking-by-polda?polda-selected=${provState}&`;
+
+ const param = ":embed=yes&:toolbar=yes&:iframeSizedToWindow=true";
+
+ useEffect(() => {
+ async function initState() {
+ const response1 = await generateTicket();
+ setTicket1(response1?.data?.data);
+ }
+
+ initState();
+ }, [isInternational]);
+
+ // Hooks
+ useEffect(() => {
+ setHasMounted(true);
+ }, []);
+
+ // Render
+ if (!hasMounted) return null;
+
+ const handleInternational = (index: number, val: boolean) => {
+ const updatedIsInternational = [...isInternational];
+
+ updatedIsInternational[index] = val;
+ setIsInternational(updatedIsInternational);
+ };
+
+ return (
+
+
+
+ {isInternational[0]
+ ? "POLRES PERFORMANCE"
+ : "POLFORMANCE POLRES"}
+
+
+
+ {ticket1 == "" ? (
+
+ ) : (
+
+ )}
+
+
+ );
+}