feat:add checkbox all SPIT
This commit is contained in:
commit
35d828369a
|
|
@ -181,16 +181,16 @@ export default function ExecutiveDashboard() {
|
||||||
const view2 =
|
const view2 =
|
||||||
levelName == "MABES POLRI"
|
levelName == "MABES POLRI"
|
||||||
? isInternational[1]
|
? isInternational[1]
|
||||||
? "views/2023_04_MediaHUB-Viz_INTL_Rev202/db-konten-publisher?"
|
? "views/2023_04_MediaHUB-Viz_INTL_Rev202/db-published-produksi?"
|
||||||
: "views/2023_04_MediaHUB-Viz-POLDA_Rev201/db-konten-publisher?"
|
: "views/2023_04_MediaHUB-Viz-POLDA_Rev202/db-published-produksi-executive?"
|
||||||
: `views/2023_04_MediaHUB-Viz-POLDA_Rev201/db-konten-publisher-polda?provinsi-polda=${poldaState}&`;
|
: `views/2023_04_MediaHUB-Viz-POLDA_Rev202/db-konten-publisher-polda-executive?provinsi-polda=${poldaState}&`;
|
||||||
|
|
||||||
const view3 =
|
const view3 =
|
||||||
levelName == "MABES POLRI"
|
levelName == "MABES POLRI"
|
||||||
? isInternational[2]
|
? isInternational[2]
|
||||||
? "views/2023_04_MediaHUB-Viz_INTL_Rev202/db-waktu-akses-pengguna?"
|
? "views/2023_04_MediaHUB-Viz_INTL_Rev202/db-waktu-akses-pengguna?"
|
||||||
: "views/2023_04_MediaHUB-Viz-POLDA_Rev201/db-waktu-akses-pengguna?"
|
: "views/2023_04_MediaHUB-Viz-POLDA_Rev202/db-waktu-akses-pengguna-executive?"
|
||||||
: `views/2023_04_MediaHUB-Viz-POLDA_Rev201/db-waktu-akses-pengguna-polda?provinsi-polda=${poldaState}&`;
|
: `views/2023_04_MediaHUB-Viz-POLDA_Rev202/db-waktu-akses-pengguna-polda-executive?provinsi-polda=${poldaState}&`;
|
||||||
|
|
||||||
const view4 =
|
const view4 =
|
||||||
levelName == "MABES POLRI"
|
levelName == "MABES POLRI"
|
||||||
|
|
@ -212,6 +212,21 @@ export default function ExecutiveDashboard() {
|
||||||
async function initState() {
|
async function initState() {
|
||||||
const response1 = await generateTicket();
|
const response1 = await generateTicket();
|
||||||
setTicket1(response1?.data?.data);
|
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);
|
||||||
|
|
||||||
|
const response5 = await generateTicket();
|
||||||
|
setTicket5(response5?.data?.data);
|
||||||
|
|
||||||
|
const response6 = await generateTicket();
|
||||||
|
setTicket6(response6?.data?.data);
|
||||||
}
|
}
|
||||||
|
|
||||||
initState();
|
initState();
|
||||||
|
|
@ -298,7 +313,7 @@ export default function ExecutiveDashboard() {
|
||||||
<LucideBoxSelect />
|
<LucideBoxSelect />
|
||||||
</div>
|
</div>
|
||||||
<div className="my-5">
|
<div className="my-5">
|
||||||
{ticket1 == "" ? (
|
{ticket2 == "" ? (
|
||||||
<iframe
|
<iframe
|
||||||
src={`${baseUrl + view4 + param}`}
|
src={`${baseUrl + view4 + param}`}
|
||||||
width="100%"
|
width="100%"
|
||||||
|
|
@ -307,7 +322,7 @@ export default function ExecutiveDashboard() {
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<iframe
|
<iframe
|
||||||
src={`${`${url + ticket1}/${view4}${param}`}`}
|
src={`${`${url + ticket2}/${view4}${param}`}`}
|
||||||
width="100%"
|
width="100%"
|
||||||
height="750"
|
height="750"
|
||||||
frameBorder="0"
|
frameBorder="0"
|
||||||
|
|
@ -323,7 +338,7 @@ export default function ExecutiveDashboard() {
|
||||||
<LucideBoxSelect />
|
<LucideBoxSelect />
|
||||||
</div>
|
</div>
|
||||||
<div className="my-5">
|
<div className="my-5">
|
||||||
{ticket1 == "" ? (
|
{ticket3 == "" ? (
|
||||||
<iframe
|
<iframe
|
||||||
src={`${baseUrl + view5 + param}`}
|
src={`${baseUrl + view5 + param}`}
|
||||||
width="100%"
|
width="100%"
|
||||||
|
|
@ -332,7 +347,7 @@ export default function ExecutiveDashboard() {
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<iframe
|
<iframe
|
||||||
src={`${`${url + ticket1}/${view5}${param}`}`}
|
src={`${`${url + ticket3}/${view5}${param}`}`}
|
||||||
width="100%"
|
width="100%"
|
||||||
height="750"
|
height="750"
|
||||||
frameBorder="0"
|
frameBorder="0"
|
||||||
|
|
@ -348,18 +363,18 @@ export default function ExecutiveDashboard() {
|
||||||
<LucideBoxSelect />
|
<LucideBoxSelect />
|
||||||
</div>
|
</div>
|
||||||
<div className="my-5">
|
<div className="my-5">
|
||||||
{ticket2 == "" ? (
|
{ticket4 == "" ? (
|
||||||
<iframe
|
<iframe
|
||||||
src={`${baseUrl + view2 + param}`}
|
src={`${baseUrl + view2 + param}`}
|
||||||
width="100%"
|
width="100%"
|
||||||
height="750"
|
height="500"
|
||||||
frameBorder="0"
|
frameBorder="0"
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<iframe
|
<iframe
|
||||||
src={`${`${url + ticket2}/${view2}${param}`}`}
|
src={`${`${url + ticket4}/${view2}${param}`}`}
|
||||||
width="100%"
|
width="100%"
|
||||||
height="750"
|
height="500"
|
||||||
frameBorder="0"
|
frameBorder="0"
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
@ -378,18 +393,18 @@ export default function ExecutiveDashboard() {
|
||||||
<LucideBoxSelect />
|
<LucideBoxSelect />
|
||||||
</div>
|
</div>
|
||||||
<div className="my-5">
|
<div className="my-5">
|
||||||
{ticket3 == "" ? (
|
{ticket5 == "" ? (
|
||||||
<iframe
|
<iframe
|
||||||
src={`${baseUrl + view3 + param}`}
|
src={`${baseUrl + view3 + param}`}
|
||||||
width="100%"
|
width="100%"
|
||||||
height="750"
|
height="600"
|
||||||
frameBorder="0"
|
frameBorder="0"
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<iframe
|
<iframe
|
||||||
src={`${`${url + ticket3}/${view3}${param}`}`}
|
src={`${`${url + ticket5}/${view3}${param}`}`}
|
||||||
width="100%"
|
width="100%"
|
||||||
height="750"
|
height="600"
|
||||||
frameBorder="0"
|
frameBorder="0"
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
@ -405,7 +420,7 @@ export default function ExecutiveDashboard() {
|
||||||
|
|
||||||
<div className="flex flex-col">
|
<div className="flex flex-col">
|
||||||
<div className="my-5">
|
<div className="my-5">
|
||||||
{ticket1 == "" ? (
|
{ticket6 == "" ? (
|
||||||
<iframe
|
<iframe
|
||||||
src={`${baseUrl + view1 + param}`}
|
src={`${baseUrl + view1 + param}`}
|
||||||
width="100%"
|
width="100%"
|
||||||
|
|
@ -414,7 +429,7 @@ export default function ExecutiveDashboard() {
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<iframe
|
<iframe
|
||||||
src={`${`${url + ticket1}/${view1}${param}`}`}
|
src={`${`${url + ticket6}/${view1}${param}`}`}
|
||||||
width="100%"
|
width="100%"
|
||||||
height="750"
|
height="750"
|
||||||
frameBorder="0"
|
frameBorder="0"
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ export default function PerformancePoldaViz() {
|
||||||
? isInternational[0]
|
? isInternational[0]
|
||||||
? "views/2023_04_MediaHUB-Viz_INTL_Rev202/db-konten-top10?"
|
? "views/2023_04_MediaHUB-Viz_INTL_Rev202/db-konten-top10?"
|
||||||
: "views/2023_04_MediaHUB-Viz-POLDA_Rev201/db-ranking-polda?"
|
: "views/2023_04_MediaHUB-Viz-POLDA_Rev201/db-ranking-polda?"
|
||||||
: `/views/2023_09_db-ranking-polres-by-polda_rev100/db-ranking-by-polda?`;
|
: `/views/2023_09_db-ranking-polres-by-polda_rev100/db-ranking-by-polda?polda-selected=${provState}&`;
|
||||||
|
|
||||||
const view2 =
|
const view2 =
|
||||||
levelName == "MABES POLRI"
|
levelName == "MABES POLRI"
|
||||||
|
|
|
||||||
24
lib/menus.ts
24
lib/menus.ts
|
|
@ -2834,16 +2834,16 @@ export function getMenuList(pathname: string, t: any): Group[] {
|
||||||
icon: "material-symbols:dashboard",
|
icon: "material-symbols:dashboard",
|
||||||
submenus: [
|
submenus: [
|
||||||
{
|
{
|
||||||
href: "/dashboard",
|
href: "/dashboard/executive",
|
||||||
label: "Breakdown",
|
label: "Executive",
|
||||||
active: pathname === "/dashboard",
|
active: pathname === "/dashboard/executive",
|
||||||
icon: "heroicons:arrow-trending-up",
|
icon: "heroicons:arrow-trending-up",
|
||||||
children: [],
|
children: [],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
href: "/dashboard/executive",
|
href: "/dashboard",
|
||||||
label: "Executive",
|
label: "Breakdown",
|
||||||
active: pathname === "/dashboard/executive",
|
active: pathname === "/dashboard",
|
||||||
icon: "heroicons:arrow-trending-up",
|
icon: "heroicons:arrow-trending-up",
|
||||||
children: [],
|
children: [],
|
||||||
},
|
},
|
||||||
|
|
@ -3143,16 +3143,16 @@ export function getMenuList(pathname: string, t: any): Group[] {
|
||||||
icon: "material-symbols:dashboard",
|
icon: "material-symbols:dashboard",
|
||||||
submenus: [
|
submenus: [
|
||||||
{
|
{
|
||||||
href: "/dashboard",
|
href: "/dashboard/executive",
|
||||||
label: "Breakdown",
|
label: "Executive",
|
||||||
active: pathname === "/dashboard",
|
active: pathname === "/dashboard/executive",
|
||||||
icon: "heroicons:arrow-trending-up",
|
icon: "heroicons:arrow-trending-up",
|
||||||
children: [],
|
children: [],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
href: "/dashboard/executive",
|
href: "/dashboard",
|
||||||
label: "Executive",
|
label: "Breakdown",
|
||||||
active: pathname === "/dashboard/executive",
|
active: pathname === "/dashboard",
|
||||||
icon: "heroicons:arrow-trending-up",
|
icon: "heroicons:arrow-trending-up",
|
||||||
children: [],
|
children: [],
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -155,7 +155,7 @@ export async function listEnableCategory(type: any) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function listCategory(type: any) {
|
export async function listCategory(type: any) {
|
||||||
const url = `media/categories/list/publish?enablePage=0&sort=desc&sortBy=id&categoryId=${type}`;
|
const url = `media/categories/list?enablePage=0&sort=desc&sortBy=id&categoryId=${type}`;
|
||||||
return httpGetInterceptor(url);
|
return httpGetInterceptor(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
import axios from "axios";
|
||||||
|
|
||||||
|
const baseURL = "https://mediahub.polri.go.id/api/";
|
||||||
|
|
||||||
|
const axiosBaseProdInstance = axios.create({
|
||||||
|
baseURL,
|
||||||
|
headers: {
|
||||||
|
"content-type": "application/json",
|
||||||
|
},
|
||||||
|
withCredentials: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
export default axiosBaseProdInstance;
|
||||||
|
|
@ -0,0 +1,174 @@
|
||||||
|
import { useRouter } from "next/navigation";
|
||||||
|
import Cookies from "js-cookie";
|
||||||
|
import { getCsrfToken } from "../auth";
|
||||||
|
import axiosBaseProdInstance from "./axios-base-prod-instance";
|
||||||
|
|
||||||
|
export async function httpGetInterceptor(pathUrl: any) {
|
||||||
|
const pathname = window.location.pathname;
|
||||||
|
const response = await axiosBaseProdInstance
|
||||||
|
.get(pathUrl)
|
||||||
|
.catch((error) => error.response);
|
||||||
|
console.log("Response interceptor : ", response);
|
||||||
|
if (response?.status == 200 || response?.status == 201) {
|
||||||
|
return {
|
||||||
|
error: false,
|
||||||
|
message: "success",
|
||||||
|
data: response?.data,
|
||||||
|
};
|
||||||
|
} else if (response?.status == 401) {
|
||||||
|
Object.keys(Cookies.get()).forEach((cookieName) => {
|
||||||
|
Cookies.remove(cookieName);
|
||||||
|
});
|
||||||
|
if (
|
||||||
|
pathname?.includes("/contributor/") ||
|
||||||
|
pathname?.includes("/admin/") ||
|
||||||
|
pathname?.includes("/supervisor/")
|
||||||
|
) {
|
||||||
|
window.location.href = "/";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return {
|
||||||
|
error: true,
|
||||||
|
message: response?.data?.message || response?.data || null,
|
||||||
|
data: null,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function httpPostInterceptor(
|
||||||
|
pathUrl: any,
|
||||||
|
data?: any,
|
||||||
|
headers?: any
|
||||||
|
) {
|
||||||
|
const resCsrf = await getCsrfToken();
|
||||||
|
const csrfToken = resCsrf?.data?.token;
|
||||||
|
|
||||||
|
const defaultHeaders = {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
};
|
||||||
|
const mergedHeaders = {
|
||||||
|
...defaultHeaders,
|
||||||
|
...headers,
|
||||||
|
...(csrfToken ? { "X-XSRF-TOKEN": csrfToken } : {}),
|
||||||
|
};
|
||||||
|
|
||||||
|
const response = await axiosBaseProdInstance
|
||||||
|
.post(pathUrl, data, { headers: mergedHeaders })
|
||||||
|
.catch((error) => error.response);
|
||||||
|
console.log("Response interceptor : ", response);
|
||||||
|
if (response?.status == 200 || response?.status == 201) {
|
||||||
|
return {
|
||||||
|
error: false,
|
||||||
|
message: "success",
|
||||||
|
data: response?.data,
|
||||||
|
};
|
||||||
|
} else if (response?.status == 401) {
|
||||||
|
Object.keys(Cookies.get()).forEach((cookieName) => {
|
||||||
|
Cookies.remove(cookieName);
|
||||||
|
});
|
||||||
|
window.location.href = "/";
|
||||||
|
} else {
|
||||||
|
return {
|
||||||
|
error: true,
|
||||||
|
message: response?.data?.message || response?.data || null,
|
||||||
|
data: null,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function httpPutInterceptor(
|
||||||
|
pathUrl: any,
|
||||||
|
data: any,
|
||||||
|
headers?: any
|
||||||
|
) {
|
||||||
|
const resCsrf = await getCsrfToken();
|
||||||
|
const csrfToken = resCsrf?.data?.token;
|
||||||
|
|
||||||
|
const defaultHeaders = {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
};
|
||||||
|
const mergedHeaders = {
|
||||||
|
...defaultHeaders,
|
||||||
|
...headers,
|
||||||
|
...(csrfToken ? { "X-XSRF-TOKEN": csrfToken } : {}),
|
||||||
|
};
|
||||||
|
|
||||||
|
const response = await axiosBaseProdInstance
|
||||||
|
.put(pathUrl, data, { headers: mergedHeaders })
|
||||||
|
.catch((error) => error.response);
|
||||||
|
console.log("Response interceptor : ", response);
|
||||||
|
if (response?.status == 200 || response?.status == 201) {
|
||||||
|
return {
|
||||||
|
error: false,
|
||||||
|
message: "success",
|
||||||
|
data: response?.data,
|
||||||
|
};
|
||||||
|
} else if (response?.status == 401) {
|
||||||
|
Object.keys(Cookies.get()).forEach((cookieName) => {
|
||||||
|
Cookies.remove(cookieName);
|
||||||
|
});
|
||||||
|
window.location.href = "/";
|
||||||
|
} else {
|
||||||
|
return {
|
||||||
|
error: true,
|
||||||
|
message: response?.data?.message || response?.data || null,
|
||||||
|
data: null,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function httpDeleteInterceptor(pathUrl: any, data?: any) {
|
||||||
|
const resCsrf = await getCsrfToken();
|
||||||
|
const csrfToken = resCsrf?.data?.token;
|
||||||
|
|
||||||
|
const defaultHeaders = {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
};
|
||||||
|
const mergedHeaders = {
|
||||||
|
...defaultHeaders,
|
||||||
|
...(csrfToken ? { "X-XSRF-TOKEN": csrfToken } : {}),
|
||||||
|
};
|
||||||
|
|
||||||
|
const response = await axiosBaseProdInstance
|
||||||
|
.delete(pathUrl, { headers: mergedHeaders, data })
|
||||||
|
.catch((error) => error.response);
|
||||||
|
console.log("Response interceptor : ", response);
|
||||||
|
if (response?.status == 200 || response?.status == 201) {
|
||||||
|
return {
|
||||||
|
error: false,
|
||||||
|
message: "success",
|
||||||
|
data: response?.data,
|
||||||
|
};
|
||||||
|
} else if (response?.status == 401) {
|
||||||
|
Object.keys(Cookies.get()).forEach((cookieName) => {
|
||||||
|
Cookies.remove(cookieName);
|
||||||
|
});
|
||||||
|
window.location.href = "/";
|
||||||
|
} else {
|
||||||
|
return {
|
||||||
|
error: true,
|
||||||
|
message: response?.data?.message || response?.data || null,
|
||||||
|
data: null,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function httpGetInterceptorWithToken(pathUrl: any, headers?: any) {
|
||||||
|
const response = await axiosBaseProdInstance
|
||||||
|
.get(pathUrl, headers)
|
||||||
|
.catch((error) => error.response);
|
||||||
|
console.log("Response interceptor : ", response);
|
||||||
|
if (response?.status == 200 || response?.status == 201) {
|
||||||
|
return {
|
||||||
|
error: false,
|
||||||
|
message: "success",
|
||||||
|
data: response?.data,
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
return {
|
||||||
|
error: true,
|
||||||
|
message: response?.data?.message || response?.data || null,
|
||||||
|
data: null,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import { httpPostInterceptor } from "../http-config/http-interceptor-service";
|
import { httpPostInterceptor } from "../http-config/http-interceptor-prod-service";
|
||||||
|
|
||||||
export async function generateTicket() {
|
export async function generateTicket() {
|
||||||
const url = "/admin/tableau-ticket";
|
const url = "/admin/tableau-ticket";
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue