diff --git a/app/[locale]/(protected)/contributor/report/components/columns.tsx b/app/[locale]/(protected)/contributor/report/components/columns.tsx index e244576c..f12626f3 100644 --- a/app/[locale]/(protected)/contributor/report/components/columns.tsx +++ b/app/[locale]/(protected)/contributor/report/components/columns.tsx @@ -23,7 +23,7 @@ import { Link, useRouter } from "@/components/navigation"; import Swal from "sweetalert2"; import withReactContent from "sweetalert2-react-content"; import { deleteBlog } from "@/service/blog/blog"; -import { error, loading } from "@/lib/swal"; +import { error, loading, close } from "@/lib/swal"; import { useTranslations } from "next-intl"; import axios from "axios"; @@ -126,6 +126,7 @@ const useTableColumns = ({ const handleDownload = async (id: string) => { try { + loading(); const response = await axios.get( `https://netidhub.com/api/media/report/download?id=${id}`, { @@ -140,6 +141,7 @@ const useTableColumns = ({ document.body.appendChild(link); link.click(); link.remove(); + close(); } catch (error) { console.error("Download failed", error); MySwal.fire({ diff --git a/app/[locale]/(protected)/dashboard/executive-data/page.tsx b/app/[locale]/(protected)/dashboard/executive-data/page.tsx index bee89e65..209eb27c 100644 --- a/app/[locale]/(protected)/dashboard/executive-data/page.tsx +++ b/app/[locale]/(protected)/dashboard/executive-data/page.tsx @@ -37,6 +37,7 @@ export default function ExecutiveDataDashboard() { const state = Cookies.get("state"); const provState = Cookies.get("state-prov"); const t = useTranslations("AnalyticsDashboard"); + const [refreshTicket, setRefreshTicket] = useState(true); const [ticket1, setTicket1] = useState(""); const [ticket2, setTicket2] = useState(""); @@ -44,6 +45,7 @@ export default function ExecutiveDataDashboard() { const [ticket4, setTicket4] = useState(""); const [ticket5, setTicket5] = useState(""); const [ticket6, setTicket6] = useState(""); + const [ticket7, setTicket7] = useState(""); const [isInternational, setIsInternational] = useState([false, false, false]); const baseUrl = "https://analytic.sitani.info/"; @@ -54,13 +56,40 @@ export default function ExecutiveDataDashboard() { const view1 = levelName == "MABES POLRI" ? isInternational[0] - ? "views/2023_08_MediaHUB-KtnMgt_Rev100/db-emg-issue-executive?" - : "views/2023_08_MediaHUB-KtnMgt_Rev100/db-emg-issue-executive?" + ? "views/2023_04_MediaHUB-Viz-POLDA_Rev200/db-content-interaction-per-polda-new?polda-selected=ALL" + : "views/2023_04_MediaHUB-Viz-POLDA_Rev200/db-content-interaction-per-polda-new?polda-selected=ALL" : 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}&`; + ? `views/2023_04_MediaHUB-Viz-POLDA_Rev200/db-content-interaction-per-polda-new?polda-selected=${state}&` + : `views/2023_04_MediaHUB-Viz-POLDA_Rev200/db-content-interaction-per-polda-new?polda-selected=${state}&`; const view2 = + levelName == "MABES POLRI" + ? isInternational[1] + ? "views/2023_04_MediaHUB-Viz_INTL_Rev202/db-content-interaction-per-satker?polda-selected=ALL" + : "views/2023_04_MediaHUB-Viz-POLDA_Rev200/db-content-interaction-per-satker?polda-selected=ALL" + : safeLevelName.includes("POLDA") + ? `views/2023_04_MediaHUB-Viz-POLDA_Rev200/db-content-interaction-per-satker?polda-selected=SATKER POLRI&` + : `views/2023_04_MediaHUB-Viz-POLDA_Rev200/db-content-interaction-per-satker?polda-selected=SATKER POLRI&`; + + const view3 = + levelName == "MABES POLRI" + ? isInternational[2] + ? "views/2023_04_MediaHUB-Viz_INTL_Rev202/db-content-category-per-polda-new?polda-selected=ALL" + : "views/2023_04_MediaHUB-Viz-POLDA_Rev200/db-content-category-per-polda-new?polda-selected=ALL" + : safeLevelName.includes("POLDA") + ? `views/2023_04_MediaHUB-Viz-POLDA_Rev200/db-content-category-per-polda-new?polda-selected=${state}&` + : `views/2023_04_MediaHUB-Viz-POLDA_Rev200/db-content-category-per-polda-new?polda-selected=${state}&`; + + const view4 = + levelName == "MABES POLRI" + ? isInternational[1] + ? "views/2023_04_MediaHUB-Viz-POLDA_Rev200/db-content-category-per-satker?polda-selected=ALL" + : "views/2023_04_MediaHUB-Viz-POLDA_Rev200/db-content-category-per-satker?polda-selected=ALL" + : safeLevelName.includes("POLDA") + ? `views/2023_04_MediaHUB-Viz-POLDA_Rev200/db-content-category-per-satker?polda-selected=SATKER POLRI&` + : `views/2023_04_MediaHUB-Viz-POLDA_Rev200/db-content-category-per-satker?polda-selected=SATKER POLRI&`; + + const view5 = levelName == "MABES POLRI" ? isInternational[1] ? "views/2023_04_MediaHUB-Viz_INTL_Rev202/db-published-produksi?" @@ -69,7 +98,7 @@ export default function ExecutiveDataDashboard() { ? `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 = + const view6 = levelName == "MABES POLRI" ? isInternational[2] ? "views/2023_04_MediaHUB-Viz_INTL_Rev202/db-waktu-akses-pengguna?" @@ -78,59 +107,14 @@ export default function ExecutiveDataDashboard() { ? `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?" - : safeLevelName.includes("POLDA") - ? `views/2023_04_MediaHUB-Viz-POLDA_Rev200/db-content-interaction-per-polda-new?polda-selected=${state}&` - : `views/2023_04_MediaHUB-Viz-POLDA_Rev200/db-content-interaction-per-polda-new?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?" - : 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 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 view7 = 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_INTL_Rev202/db-penugasan-vertical-bar?" + : "views/2023_09_db-penugasan_rev100/db-penugasan-vertical-bar?" : safeLevelName.includes("POLDA") - ? `views/2023_09_db-penugasan_rev100/db-penugasan?polda-selected=${state}&` - : `views/2023_09_db-penugasan_rev100/db-penugasan?polda-selected=${state}&`; - - const view8 = - levelName == "MABES POLRI" - ? isInternational[2] - ? "views/2023_04_MediaHUB-Viz_INTL_Rev202/db-konten-kategori-top10?" - : "views/2023_04_MediaHUB-Viz-POLDA_Rev200/db-konten-kategori-top10?" - : safeLevelName.includes("POLDA") - ? `views/2023_04_MediaHUB-Viz-POLDA_Rev200/db-content-interaction-polda-new?polda-selected=${state}&` - : `views/2023_04_MediaHUB-Viz-POLDA_Rev200/db-content-interaction-polda-new?polda-selected=${state}&`; - - const view9 = - levelName == "MABES POLRI" - ? isInternational[3] - ? "views/2023_04_MediaHUB-Viz_INTL_Rev202/db-konten-kategori?" - : "views/2023_04_MediaHUB-Viz-POLDA_Rev200/db-konten-kategori?" - : safeLevelName.includes("POLDA") - ? `views/2023_04_MediaHUB-Viz-POLDA_Rev200/db-konten-kategori-polda?polda-selected=${state}&` - : `views/2023_04_MediaHUB-Viz-POLDA_Rev200/db-konten-kategori-polda?polda-selected=${state}&`; + ? `views/2023_09_db-penugasan_rev100/db-penugasan-vertical-bar?polda-selected=${state}&` + : `views/2023_09_db-penugasan_rev100/db-penugasan-vertical-bar?polda-selected=${state}&`; const param = ":embed=yes&:toolbar=no&:iframeSizedToWindow=true"; @@ -153,10 +137,13 @@ export default function ExecutiveDataDashboard() { const response6 = await generateTicket(); setTicket6(response6?.data?.data); + + const response7 = await generateTicket(); + setTicket7(response7?.data?.data); } initState(); - }, [isInternational]); + }, [isInternational, refreshTicket]); // Hooks useEffect(() => { @@ -178,7 +165,7 @@ export default function ExecutiveDataDashboard() {
- + setRefreshTicket(!refreshTicket)}> -
+ {/*

Upload konten hari ini Polda

-
+
*/}
{ticket1 == "w-full" ? (