+
+
+ {isInternational[0]
+ ? "CREATORS WITH THE MOST PUBLISHED CONTENT"
+ : "KREATOR DENGAN PUBLISH KONTEN TERBANYAK"}
+
+
+ {levelName === "MABES POLRI" ? (
+
+
{t("choose_category")}
+
+
+
+
+
+ ) : (
+ ""
+ )}
+
+ {ticket1 == "" ? (
+
+ ) : (
+
+ )}
+
+
+
+ {isInternational[1]
+ ? "CREATORS WITH THE MOST INTERACTION OF CONTENT"
+ : "KREATOR DENGAN INTERAKSI KONTEN TERBANYAK"}
+
+
+ {levelName === "MABES POLRI" ? (
+
+
{t("choose_category")}
+
+
+
+
+
+ ) : (
+ ""
+ )}
+
+ {ticket2 == "" ? (
+
+ ) : (
+
+ )}
+
+
+
+ {isInternational[2]
+ ? "ACCESS TIME PER CONTENT / CATEGORY"
+ : "WAKTU AKSES PER KONTEN / KATEGORI"}
+
+
+ {levelName === "MABES POLRI" ? (
+
+
{t("choose_category")}
+
+
+
+
+
+ ) : (
+ ""
+ )}
+
+ {ticket3 == "" ? (
+
+ ) : (
+
+ )}
+
+
+ );
+}
diff --git a/components/visualization/dashboard-viz.tsx b/components/visualization/dashboard-viz.tsx
new file mode 100644
index 00000000..730377e5
--- /dev/null
+++ b/components/visualization/dashboard-viz.tsx
@@ -0,0 +1,248 @@
+"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 DashboardVisualization() {
+ const levelName = getCookiesDecrypt("ulnae");
+ const poldaState = Cookies.get("state");
+ const t = useTranslations("AnalyticsDashboard");
+
+ const [ticket1, setTicket1] = useState("");
+ const [ticket2, setTicket2] = useState("");
+ const [ticket3, setTicket3] = useState("");
+ const [isInternational, setIsInternational] = useState([false, false, false]);
+ const baseUrl = "https://analytic.sitani.info/";
+ const url = "https://analytic.sitani.info/trusted/";
+
+ const view1 =
+ levelName == "MABES POLRI"
+ ? isInternational[0]
+ ? "views/2023_04_MediaHUB-Viz_INTL_Rev202/db-content-monitor?"
+ : "views/2023_09_MediaHUB-Viz-POLDA-content-monitor_Rev100/db-content-monitor?"
+ : `views/2023_09_MediaHUB-Viz-ADMIN-POLDA-content-monitor_Rev100/db-content-monitor?provinsi-polda=${poldaState}&`;
+
+ const view2 =
+ levelName == "MABES POLRI"
+ ? isInternational[1]
+ ? "views/2023_04_MediaHUB-Viz_INTL_Rev202/db-content-interaction-konten?"
+ : "views/2023_04_MediaHUB-Viz-POLDA_Rev201/db-content-interaction-konten?"
+ : `views/2023_04_MediaHUB-Viz-POLDA_Rev201/db-content-interaction-konten-polda?provinsi-polda=${poldaState}&`;
+
+ const view3 =
+ levelName == "MABES POLRI"
+ ? isInternational[2]
+ ? "views/2023_04_MediaHUB-Viz_INTL_Rev202/db-penugasan?"
+ : "views/2023_09_db-penugasan_rev100/db-penugasan?"
+ : `views/2023_04_MediaHUB-Viz-POLDA_Rev201/db-penugasan-polda?provinsi-polda=${poldaState}&`;
+
+ const param = ":embed=yes&:toolbar=yes&:iframeSizedToWindow=true";
+
+ useEffect(() => {
+ async function initState() {
+ const response1 = await generateTicket();
+ setTicket1(response1.data?.data);
+ console.log("response", response1);
+ const response2 = await generateTicket();
+ setTicket2(response2.data?.data);
+
+ const response3 = await generateTicket();
+ setTicket3(response3.data?.data);
+ }
+
+ initState();
+ }, [isInternational]);
+
+ const handleInternational = (index: number, val: boolean) => {
+ const updatedIsInternational = [...isInternational];
+
+ updatedIsInternational[index] = val;
+ setIsInternational(updatedIsInternational);
+ };
+
+ useEffect(() => {
+ async function fetchUrl() {
+ console.log("Fetch tableau");
+ const urlView = `${url + ticket1}/${view1}${param}`;
+ console.log("Fetch tableau ", urlView);
+ const urlRender = await fetch(urlView)
+ .then((response) => {
+ console.log("Tableau res : ", response);
+ })
+ .catch((error) => {
+ console.log("Tableau error: ", error);
+ });
+ }
+
+ fetchUrl();
+ }, [ticket1]);
+
+ return (
+
+
+
+ {isInternational[0]
+ ? "COMMULATION OF USERS, CONTENTS AND INTERACTIONS"
+ : "KUMULASI PENGGUNA, KONTEN, DAN INTERAKSI"}
+
+
+ {levelName === "MABES POLRI" ? (
+
+
{t("choose_category")}
+
+
+
+
+
+ ) : (
+ ""
+ )}
+
+ {ticket1 == "" ? (
+
+ ) : (
+
+ )}
+
+
+
+ {isInternational[1]
+ ? "ADDITION OF CONTENT AND INTERACTION"
+ : "PENAMBAHAN KONTEN DAN INTERAKSI"}
+
+
+ {levelName === "MABES POLRI" ? (
+
+
{t("choose_category")}
+
+
+
+
+
+ ) : (
+ ""
+ )}
+
+ {ticket2 == "" ? (
+
+ ) : (
+
+ )}
+
+
+ {isInternational[2] ? "ASSIGNMENT" : "PENUGASAN"}
+
+ {levelName === "MABES POLRI" ? (
+
+
{t("choose_category")}
+
+
+
+
+
+ ) : (
+ ""
+ )}
+
+ {ticket3 == "" ? (
+
+ ) : (
+
+ )}
+
+
+ );
+}
diff --git a/components/visualization/pattern-relation-viz.tsx b/components/visualization/pattern-relation-viz.tsx
new file mode 100644
index 00000000..c038792d
--- /dev/null
+++ b/components/visualization/pattern-relation-viz.tsx
@@ -0,0 +1,312 @@
+"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 PatternRelationVisualization() {
+ 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_04_MediaHUB-Viz-POLDA_Rev201/db-konten-top10-polda?provinsi-polda=${provState}&`;
+
+ const view2 =
+ levelName == "MABES POLRI"
+ ? isInternational[1]
+ ? "views/2023_04_MediaHUB-Viz_INTL_Rev202/db-konten?"
+ : "views/2023_04_MediaHUB-Viz-POLDA_Rev201/db-konten?"
+ : `views/2023_04_MediaHUB-Viz-POLDA_Rev201/db-konten-polda?provinsi-polda=${poldaState}&`;
+
+ const view3 =
+ levelName == "MABES POLRI"
+ ? isInternational[2]
+ ? "views/2023_04_MediaHUB-Viz_INTL_Rev202/db-konten-kategori-top10?"
+ : "views/2023_04_MediaHUB-Viz-POLDA_Rev201/db-konten-kategori-top10?"
+ : `views/2023_04_MediaHUB-Viz-POLDA_Rev201/db-konten-kategori-top10-polda?provinsi-polda=${poldaState}&`;
+
+ const view4 =
+ levelName == "MABES POLRI"
+ ? isInternational[3]
+ ? "views/2023_04_MediaHUB-Viz_INTL_Rev202/db-konten-kategori?"
+ : "views/2023_04_MediaHUB-Viz-POLDA_Rev201/db-konten-kategori?"
+ : `views/2023_04_MediaHUB-Viz-POLDA_Rev201/db-konten-kategori-polda?provinsi-polda=${poldaState}&`;
+
+ const param = ":embed=yes&:toolbar=yes&:iframeSizedToWindow=true";
+
+ useEffect(() => {
+ async function initState() {
+ const response1 = await generateTicket();
+ setTicket1(response1.data?.data);
+
+ const response2 = await generateTicket();
+ setTicket2(response2.data?.data);
+
+ const response3 = await generateTicket();
+ setTicket3(response3.data?.data);
+
+ const response4 = await generateTicket();
+ setTicket4(response4.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]
+ ? "INTERACTION OF THE MOST POPULAR CONTENT AND TITLES"
+ : "INTERAKSI KONTEN DAN JUDUL TERPOPULER"}
+
+
+ {levelName === "MABES POLRI" ? (
+
+
{t("choose_category")}
+
+
+
+
+
+ ) : (
+ ""
+ )}
+
+ {ticket1 == "" ? (
+
+ ) : (
+
+ )}
+
+
+
+ {isInternational[1]
+ ? "INTERACTION OF CONTENT AND ACCESS TIME"
+ : "INTERAKSI KONTEN DAN WAKTU AKSES"}
+
+
+ {levelName === "MABES POLRI" ? (
+
+
{t("choose_category")}
+
+
+
+
+
+ ) : (
+ ""
+ )}
+
+ {ticket2 == "" ? (
+
+ ) : (
+
+ )}
+
+
+
+ {isInternational[2]
+ ? "INTERACTION OF THE MOST POPULAR CATEGORIES AND TITLES"
+ : "INTERAKSI KATEGORI DAN JUDUL TERPOPULER"}
+
+
+ {levelName === "MABES POLRI" ? (
+
+
{t("choose_category")}
+
+
+
+
+
+ ) : (
+ ""
+ )}
+
+ {ticket3 == "" ? (
+
+ ) : (
+
+ )}
+
+
+
+ {isInternational[3]
+ ? "INTERACTIONS OF CATEGORY AND ACCESS TIME"
+ : "INTERAKSI KATEGORI DAN WAKTU AKSES"}
+
+
+ {levelName === "MABES POLRI" ? (
+
+
{t("choose_category")}
+
+
+
+
+
+ ) : (
+ ""
+ )}
+
+ {ticket4 == "" ? (
+
+ ) : (
+
+ )}
+
+
+ );
+}
diff --git a/messages/en.json b/messages/en.json
index c6951fa0..7428b5bf 100644
--- a/messages/en.json
+++ b/messages/en.json
@@ -20,7 +20,9 @@
"invested_amount": "Invested amount",
"last_28_days": "Last 28 days",
"last_months": "Last months",
- "last_year": "Last year"
+ "last_year": "Last year",
+ "choose_category": "Choose Category",
+ "international": "International"
},
"BankingDashboard": {
"widget_title": "Good evening",
@@ -121,7 +123,6 @@
"ratings": "ratings",
"view_less": "View Less",
"add_to_cart": "Add to Cart"
-
},
"Menu": {
"dashboard": "Dashboard",
@@ -221,14 +222,14 @@
"input": "Input",
"textarea": "Textarea",
"select": "Select",
- "reactSelect":"React Select",
+ "reactSelect": "React Select",
"slider": "Slider",
"switch": "Switch",
"inputGroup": "Input Group",
- "inputLayout":"Input Layout",
- "inputMask":"Input Mask",
- "inputFile":"File Input",
- "formValidation":"Form Validation",
+ "inputLayout": "Input Layout",
+ "inputMask": "Input Mask",
+ "inputFile": "File Input",
+ "formValidation": "Form Validation",
"radio": "Radio",
"checkbox": "Checkbox",
"inputOtp": "Input Otp",
diff --git a/messages/in.json b/messages/in.json
index d1faef62..6faa946b 100644
--- a/messages/in.json
+++ b/messages/in.json
@@ -20,7 +20,9 @@
"invested_amount": "Invested amount",
"last_28_days": "Last 28 days",
"last_months": "Last months",
- "last_year": "Last year"
+ "last_year": "Last year",
+ "choose_category": "Pilih Kategori",
+ "international": "Internasional"
},
"BankingDashboard": {
"widget_title": "Good evening",
@@ -121,7 +123,6 @@
"ratings": "ratings",
"view_less": "View Less",
"add_to_cart": "Add to Cart"
-
},
"Menu": {
"dashboard": "Dashboard",
@@ -221,14 +222,14 @@
"input": "Input",
"textarea": "Textarea",
"select": "Select",
- "reactSelect":"React Select",
+ "reactSelect": "React Select",
"slider": "Slider",
"switch": "Switch",
"inputGroup": "Input Group",
- "inputLayout":"Input Layout",
- "inputMask":"Input Mask",
- "inputFile":"File Input",
- "formValidation":"Form Validation",
+ "inputLayout": "Input Layout",
+ "inputMask": "Input Mask",
+ "inputFile": "File Input",
+ "formValidation": "Form Validation",
"radio": "Radio",
"checkbox": "Checkbox",
"inputOtp": "Input Otp",
diff --git a/next.config.mjs b/next.config.mjs
index 6e8fa11f..6d5bcdda 100644
--- a/next.config.mjs
+++ b/next.config.mjs
@@ -38,10 +38,11 @@ const nextConfig = {
protocol: "https",
hostname: "i.pravatar.cc",
},
+ { protocol: "https", hostname: "netidhub.com" },
{
protocol: "https",
hostname: "netidhub.com",
- }
+ },
],
},
};
diff --git a/service/agenda-setting/agenda-setting.ts b/service/agenda-setting/agenda-setting.ts
index c59acbd6..b3fd52fb 100644
--- a/service/agenda-setting/agenda-setting.ts
+++ b/service/agenda-setting/agenda-setting.ts
@@ -2,7 +2,7 @@ import { getAPIInterceptor, postAPIInterceptor } from "@/config/api";
export async function getAgendaSettingsById(id: any) {
const url = `agenda-settings?id=${id}`;
- return getAPIInterceptor({ url });
+ return getAPIInterceptor(url);
}
export async function getAgendaSettingsList(year = "", month = "", type = "") {
@@ -14,3 +14,52 @@ export async function saveAgendaSettings(data: any) {
const url = `agenda-settings`;
return postAPIInterceptor(url, data);
}
+
+export async function getPlanningDailyByTypeId(
+ page: number,
+ size = 10,
+ parentId: any,
+ date: string,
+ typeId: number
+) {
+ const url = `planning/pagination/daily?enablePage=1&size=${size}&page=${page}&date=${date}&typeId=${typeId}${
+ parentId ? `&parentId=${parentId}` : ""
+ }`;
+ return getAPIInterceptor(url);
+}
+
+export async function getMonthlyPlanList(dates: number, typeId: number) {
+ const url = `planning/monthly/list?date=${dates}&typeId=${typeId}`;
+ return getAPIInterceptor(url);
+}
+
+export async function getWeeklyPlanList(
+ dates: number | undefined,
+ typeId: number,
+ isMonthly = false
+) {
+ const url = `planning/weekly/list?date=${dates}&typeId=${typeId}&isMonthly=${isMonthly}`;
+ return getAPIInterceptor(url);
+}
+
+export async function getWeeklyPlanListByParentId(id: string, typeId: number) {
+ const url = `planning/weekly/list?parentId=${id}&typeId=${typeId}`;
+ return getAPIInterceptor(url);
+}
+
+export async function getPlanningPagination(
+ page: number,
+ title = "",
+ size = 10,
+ typeId: number,
+ time: number,
+ parentId = ""
+) {
+ const url = `planning/pagination?enablePage=1&size=${size}&page=${page}&title=${title}&typeId=${typeId}&time=${time}&parentId=${parentId}`;
+ return getAPIInterceptor(url);
+}
+
+export async function savePlanning(data: any) {
+ const url = "planning";
+ return postAPIInterceptor(url, data);
+}
diff --git a/service/tableau/tableau-service.ts b/service/tableau/tableau-service.ts
new file mode 100644
index 00000000..299bd206
--- /dev/null
+++ b/service/tableau/tableau-service.ts
@@ -0,0 +1,50 @@
+"use client";
+import axios from "axios";
+import Cookies from "js-cookie";
+import qs from "qs";
+
+import { data } from "@/app/[locale]/(protected)/charts/rechart/charts-rechart-bar/data";
+import { url } from "inspector";
+
+const baseURL = "https://netidhub.com/api/";
+const tokenAuth = Cookies.get("access_token")
+ ? Cookies.get("access_token")
+ : null;
+import { getAPIInterceptor } from "@/config/api";
+import axiosInterceptor from "@/config/axiosInterceptor";
+
+export async function postAPIInterceptorTableau(url: string, data?: any) {
+ const response = await axiosInterceptor
+ .post(url, data)
+ .catch((error) => error.response);
+
+ if (response?.status === 401) {
+ Object.keys(Cookies.get()).forEach((cookieName) => {
+ Cookies.remove(cookieName);
+ });
+ window.location.href = "/";
+ } else if (response?.status > 300 && response?.status !== 401) {
+ return {
+ error: true,
+ message: response?.data?.message,
+ data: null,
+ };
+ } else if (response?.data?.success) {
+ return {
+ error: false,
+ message: "success",
+ data: response?.data,
+ };
+ }
+
+ return {
+ error: true,
+ message: response?.data?.message,
+ data: null,
+ };
+}
+
+export async function generateTicket() {
+ const url = "/admin/tableau-ticket";
+ return postAPIInterceptorTableau(url);
+}
diff --git a/utils/globals.tsx b/utils/globals.tsx
index 2d7e5386..452b64b8 100644
--- a/utils/globals.tsx
+++ b/utils/globals.tsx
@@ -1,8 +1,6 @@
import { format } from "date-fns";
import { id, tr } from "date-fns/locale";
-
-
export const generateLocalizedPath = (href: string, locale: string): string => {
if (href.startsWith(`/${locale}`)) {
return href;
@@ -10,7 +8,11 @@ export const generateLocalizedPath = (href: string, locale: string): string => {
return `/${locale}${href}`;
};
-export function textEllipsis(str: string, maxLength: number, { side = "end", ellipsis = "..." } = {}) {
+export function textEllipsis(
+ str: string,
+ maxLength: number,
+ { side = "end", ellipsis = "..." } = {}
+) {
if (str !== undefined && str?.length > maxLength) {
switch (side) {
case "start":
@@ -21,7 +23,7 @@ export function textEllipsis(str: string, maxLength: number, { side = "end", ell
}
}
return str;
-};
+}
export function formatDateToIndonesian(d: Date) {
try {
@@ -31,3 +33,33 @@ export function formatDateToIndonesian(d: Date) {
return "";
}
}
+
+export function htmlToString(str: string) {
+ if (str == undefined || str == null) {
+ return "";
+ }
+ return (
+ str
+ .replaceAll(/