diff --git a/components/form/login.tsx b/components/form/login.tsx index 6afbbff..f42f0ce 100644 --- a/components/form/login.tsx +++ b/components/form/login.tsx @@ -74,6 +74,13 @@ export default function Login() { const response: any = await emailValidation(data); if (response?.error) { console.log("error", response); + if (response?.message?.messages[0]?.includes("suspended")) { + error( + "Untuk sementara akun Polda/Polres Anda di tangguhkan, silahkan hubungi Admin Mabes untuk konfirmasi, Terima Kasih" + ); + return false; + } + if (response?.message?.messages[0]?.includes("failed to send mail")) { error("Gagal Mengirim OTP"); return false; diff --git a/components/icons.tsx b/components/icons.tsx index 7f3a70a..1a3b799 100644 --- a/components/icons.tsx +++ b/components/icons.tsx @@ -2732,3 +2732,23 @@ export const VideoIcon = ({ ); +export const SuspendIcon = ({ + size, + height = 37, + width = 32, + fill = "currentColor", + ...props +}: IconSvgProps) => ( + + + +); diff --git a/components/main/detail/comment.tsx b/components/main/detail/comment.tsx index 134580a..d0c5629 100644 --- a/components/main/detail/comment.tsx +++ b/components/main/detail/comment.tsx @@ -112,7 +112,7 @@ export default function Comment(props: { id: string | null }) { } const req: any = { activityTypeId: 5, - url: "https://kontenhumas.com/" + pathname, + url: "https://layananpemerintahri.com/" + pathname, articleId: Number(id), }; @@ -172,7 +172,7 @@ export default function Comment(props: { id: string | null }) { } const req: any = { activityTypeId: 5, - url: "https://kontenhumas.com/" + pathname, + url: "https://layananpemerintahri.com/" + pathname, articleId: Number(id), userId: Number(userId), }; diff --git a/components/main/detail/e-magazine-detail.tsx b/components/main/detail/e-magazine-detail.tsx index c02db8c..d886ae9 100644 --- a/components/main/detail/e-magazine-detail.tsx +++ b/components/main/detail/e-magazine-detail.tsx @@ -36,7 +36,7 @@ export default function EMagazineDetail() { const doDownload = async (fileName: string, title: string): Promise => { try { const response = await fetch( - `https://kontenhumas.com/magazine-files/viewer/${fileName}` + `https://layananpemerintahri.com/magazine-files/viewer/${fileName}` ); if (!response.ok) { diff --git a/components/main/detail/new-detail.tsx b/components/main/detail/new-detail.tsx index f2e039b..becb287 100644 --- a/components/main/detail/new-detail.tsx +++ b/components/main/detail/new-detail.tsx @@ -39,7 +39,7 @@ export default function NewsDetailPage(props: { datas: any }) { const sendActivity = async () => { let req: any = { activityTypeId: 2, - url: "https://kontenhumas.com" + pathname, + url: "https://layananpemerintahri.com/" + pathname, articleId: Number(id?.split("-")[0]), }; if (uid) { diff --git a/components/page/detail-news.tsx b/components/page/detail-news.tsx index 951f8df..c07baeb 100644 --- a/components/page/detail-news.tsx +++ b/components/page/detail-news.tsx @@ -49,11 +49,11 @@ export default function DetailNews(props: { data: any; listArticle: any }) { const handleShare = async (platform: string) => { let shareLink = ""; - const urls = "https://kontenhumas.com/" + pathname; + const urls = "https://layananpemerintahri.com/" + pathname; let req: any = { activityTypeId: 3, - url: "https://kontenhumas.com/" + pathname, + url: "https://layananpemerintahri.com/" + pathname, articleId: Number(id?.split("-")[0]), }; if (uid) { diff --git a/components/table/master-user-table.tsx b/components/table/master-user-table.tsx index 1e2f198..322254e 100644 --- a/components/table/master-user-table.tsx +++ b/components/table/master-user-table.tsx @@ -5,6 +5,7 @@ import { DotsYIcon, EyeIconMdi, SearchIcon, + SuspendIcon, } from "@/components/icons"; import { error, success } from "@/config/swal"; import { deleteArticle, getListArticle } from "@/services/article"; @@ -40,8 +41,10 @@ const columns = [ { name: "Username", uid: "username" }, { name: "Fullname", uid: "fullname" }, { name: "Email", uid: "email" }, - { name: "Identity Type", uid: "identityType" }, - { name: "Identity Number", uid: "identityNumber" }, + { name: "Status", uid: "status" }, + // { name: "Identity Type", uid: "identityType" }, + // { name: "Identity Number", uid: "identityNumber" }, + // { name: "Users", uid: "users" }, // { name: "Status", uid: "status" }, { name: "Aksi", uid: "actions" }, @@ -124,6 +127,35 @@ export default function MasterUserTable() { }); } + const handleSuspend = (id: number, status: boolean) => { + MySwal.fire({ + title: `${!status ? "Lepas " : ""}Suspend User?`, + icon: "warning", + showCancelButton: true, + cancelButtonColor: "#3085d6", + confirmButtonColor: "#d33", + confirmButtonText: "Yes", + }).then((result) => { + if (result.isConfirmed) { + doSuspend(id, status); + } + }); + }; + + async function doSuspend(id: number, status: boolean) { + // loading(); + + console.log("do suspend", id, status); + // const resDelete = await deleteMasterUser(id); + + // if (resDelete?.error) { + // error(resDelete.message); + // return false; + // } + // close(); + successSubmit(); + } + const renderCell = useCallback((user: MasterUser, columnKey: Key) => { const cellValue = user[columnKey as keyof MasterUser]; const statusColorMap: Record = { @@ -140,12 +172,12 @@ export default function MasterUserTable() { return ( - {cellValue} + {user?.isSuspend ? "Suspend" : "Active"} ); @@ -166,6 +198,18 @@ export default function MasterUserTable() { Edit + handleSuspend(user.id, !user?.isSuspend)} + > + + Suspend + handleDelete(user.id)} diff --git a/public/sw.js b/public/sw.js index b276670..3e85c6d 100644 --- a/public/sw.js +++ b/public/sw.js @@ -125,5 +125,5 @@ self.addEventListener("push", function (event) { self.addEventListener("notificationclick", function (event) { console.log("Notification click received."); event.notification.close(); - event.waitUntil(clients.openWindow("")); + event.waitUntil(clients.openWindow("")); }); diff --git a/services/http-config/axios-interceptor-instance.ts b/services/http-config/axios-interceptor-instance.ts index 49f3864..18e34a6 100644 --- a/services/http-config/axios-interceptor-instance.ts +++ b/services/http-config/axios-interceptor-instance.ts @@ -1,6 +1,6 @@ import axios from "axios"; -const baseURL = "https://kontenhumas.com/api"; +const baseURL = "https://layananpemerintahri.com/api"; const axiosInterceptorInstance = axios.create({ baseURL, diff --git a/services/http-config/axios-interceptor-service.ts b/services/http-config/axios-interceptor-service.ts index fc3e37d..728df7b 100644 --- a/services/http-config/axios-interceptor-service.ts +++ b/services/http-config/axios-interceptor-service.ts @@ -2,7 +2,7 @@ import axios from "axios"; import { postSignIn } from "../master-user"; import Cookies from "js-cookie"; -const baseURL = "https://kontenhumas.com/api"; +const baseURL = "https://layananpemerintahri.com/api"; const refreshToken = Cookies.get("refresh_token"); diff --git a/services/http-config/http-base-instance.ts b/services/http-config/http-base-instance.ts index 95ebf60..44b7f61 100644 --- a/services/http-config/http-base-instance.ts +++ b/services/http-config/http-base-instance.ts @@ -1,6 +1,6 @@ import axios from "axios"; -const baseURL = "https://kontenhumas.com/api"; +const baseURL = "https://layananpemerintahri.com/api"; const axiosBaseInstance = axios.create({ baseURL, diff --git a/types/globals.tsx b/types/globals.tsx index a9e1597..85def70 100644 --- a/types/globals.tsx +++ b/types/globals.tsx @@ -40,6 +40,7 @@ export type MasterUser = { userRoleId: number; username: string; workType: string; + isSuspend?: boolean; }; export type MasterUserRole = {