feaT:suspend user, kontenhumas->layananpemerintahri
This commit is contained in:
parent
edad636ba1
commit
ed4f1c20e2
|
|
@ -74,6 +74,13 @@ export default function Login() {
|
||||||
const response: any = await emailValidation(data);
|
const response: any = await emailValidation(data);
|
||||||
if (response?.error) {
|
if (response?.error) {
|
||||||
console.log("error", response);
|
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")) {
|
if (response?.message?.messages[0]?.includes("failed to send mail")) {
|
||||||
error("Gagal Mengirim OTP");
|
error("Gagal Mengirim OTP");
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -2732,3 +2732,23 @@ export const VideoIcon = ({
|
||||||
</g>
|
</g>
|
||||||
</svg>
|
</svg>
|
||||||
);
|
);
|
||||||
|
export const SuspendIcon = ({
|
||||||
|
size,
|
||||||
|
height = 37,
|
||||||
|
width = 32,
|
||||||
|
fill = "currentColor",
|
||||||
|
...props
|
||||||
|
}: IconSvgProps) => (
|
||||||
|
<svg
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
width={size || width}
|
||||||
|
height={size || height}
|
||||||
|
{...props}
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
fill="currentColor"
|
||||||
|
d="M12 2c5.5 0 10 4.5 10 10s-4.5 10-10 10S2 17.5 2 12S6.5 2 12 2m0 2c-1.9 0-3.6.6-4.9 1.7l11.2 11.2c1-1.4 1.7-3.1 1.7-4.9c0-4.4-3.6-8-8-8m4.9 14.3L5.7 7.1C4.6 8.4 4 10.1 4 12c0 4.4 3.6 8 8 8c1.9 0 3.6-.6 4.9-1.7"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
);
|
||||||
|
|
|
||||||
|
|
@ -112,7 +112,7 @@ export default function Comment(props: { id: string | null }) {
|
||||||
}
|
}
|
||||||
const req: any = {
|
const req: any = {
|
||||||
activityTypeId: 5,
|
activityTypeId: 5,
|
||||||
url: "https://kontenhumas.com/" + pathname,
|
url: "https://layananpemerintahri.com/" + pathname,
|
||||||
articleId: Number(id),
|
articleId: Number(id),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -172,7 +172,7 @@ export default function Comment(props: { id: string | null }) {
|
||||||
}
|
}
|
||||||
const req: any = {
|
const req: any = {
|
||||||
activityTypeId: 5,
|
activityTypeId: 5,
|
||||||
url: "https://kontenhumas.com/" + pathname,
|
url: "https://layananpemerintahri.com/" + pathname,
|
||||||
articleId: Number(id),
|
articleId: Number(id),
|
||||||
userId: Number(userId),
|
userId: Number(userId),
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ export default function EMagazineDetail() {
|
||||||
const doDownload = async (fileName: string, title: string): Promise<void> => {
|
const doDownload = async (fileName: string, title: string): Promise<void> => {
|
||||||
try {
|
try {
|
||||||
const response = await fetch(
|
const response = await fetch(
|
||||||
`https://kontenhumas.com/magazine-files/viewer/${fileName}`
|
`https://layananpemerintahri.com/magazine-files/viewer/${fileName}`
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ export default function NewsDetailPage(props: { datas: any }) {
|
||||||
const sendActivity = async () => {
|
const sendActivity = async () => {
|
||||||
let req: any = {
|
let req: any = {
|
||||||
activityTypeId: 2,
|
activityTypeId: 2,
|
||||||
url: "https://kontenhumas.com" + pathname,
|
url: "https://layananpemerintahri.com/" + pathname,
|
||||||
articleId: Number(id?.split("-")[0]),
|
articleId: Number(id?.split("-")[0]),
|
||||||
};
|
};
|
||||||
if (uid) {
|
if (uid) {
|
||||||
|
|
|
||||||
|
|
@ -49,11 +49,11 @@ export default function DetailNews(props: { data: any; listArticle: any }) {
|
||||||
|
|
||||||
const handleShare = async (platform: string) => {
|
const handleShare = async (platform: string) => {
|
||||||
let shareLink = "";
|
let shareLink = "";
|
||||||
const urls = "https://kontenhumas.com/" + pathname;
|
const urls = "https://layananpemerintahri.com/" + pathname;
|
||||||
|
|
||||||
let req: any = {
|
let req: any = {
|
||||||
activityTypeId: 3,
|
activityTypeId: 3,
|
||||||
url: "https://kontenhumas.com/" + pathname,
|
url: "https://layananpemerintahri.com/" + pathname,
|
||||||
articleId: Number(id?.split("-")[0]),
|
articleId: Number(id?.split("-")[0]),
|
||||||
};
|
};
|
||||||
if (uid) {
|
if (uid) {
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import {
|
||||||
DotsYIcon,
|
DotsYIcon,
|
||||||
EyeIconMdi,
|
EyeIconMdi,
|
||||||
SearchIcon,
|
SearchIcon,
|
||||||
|
SuspendIcon,
|
||||||
} from "@/components/icons";
|
} from "@/components/icons";
|
||||||
import { error, success } from "@/config/swal";
|
import { error, success } from "@/config/swal";
|
||||||
import { deleteArticle, getListArticle } from "@/services/article";
|
import { deleteArticle, getListArticle } from "@/services/article";
|
||||||
|
|
@ -40,8 +41,10 @@ const columns = [
|
||||||
{ name: "Username", uid: "username" },
|
{ name: "Username", uid: "username" },
|
||||||
{ name: "Fullname", uid: "fullname" },
|
{ name: "Fullname", uid: "fullname" },
|
||||||
{ name: "Email", uid: "email" },
|
{ name: "Email", uid: "email" },
|
||||||
{ name: "Identity Type", uid: "identityType" },
|
{ name: "Status", uid: "status" },
|
||||||
{ name: "Identity Number", uid: "identityNumber" },
|
// { name: "Identity Type", uid: "identityType" },
|
||||||
|
// { name: "Identity Number", uid: "identityNumber" },
|
||||||
|
|
||||||
// { name: "Users", uid: "users" },
|
// { name: "Users", uid: "users" },
|
||||||
// { name: "Status", uid: "status" },
|
// { name: "Status", uid: "status" },
|
||||||
{ name: "Aksi", uid: "actions" },
|
{ 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 renderCell = useCallback((user: MasterUser, columnKey: Key) => {
|
||||||
const cellValue = user[columnKey as keyof MasterUser];
|
const cellValue = user[columnKey as keyof MasterUser];
|
||||||
const statusColorMap: Record<string, ChipProps["color"]> = {
|
const statusColorMap: Record<string, ChipProps["color"]> = {
|
||||||
|
|
@ -140,12 +172,12 @@ export default function MasterUserTable() {
|
||||||
return (
|
return (
|
||||||
<Chip
|
<Chip
|
||||||
className="capitalize "
|
className="capitalize "
|
||||||
// color={statusColorMap[user.status]}
|
color={user?.isSuspend ? "danger" : "success"}
|
||||||
size="lg"
|
size="lg"
|
||||||
variant="flat"
|
variant="flat"
|
||||||
>
|
>
|
||||||
<div className="flex flex-row items-center gap-2 justify-center">
|
<div className="flex flex-row items-center gap-2 justify-center">
|
||||||
{cellValue}
|
{user?.isSuspend ? "Suspend" : "Active"}
|
||||||
</div>
|
</div>
|
||||||
</Chip>
|
</Chip>
|
||||||
);
|
);
|
||||||
|
|
@ -166,6 +198,18 @@ export default function MasterUserTable() {
|
||||||
Edit
|
Edit
|
||||||
</Link>
|
</Link>
|
||||||
</DropdownItem>
|
</DropdownItem>
|
||||||
|
<DropdownItem
|
||||||
|
key="Suspend"
|
||||||
|
onClick={() => handleSuspend(user.id, !user?.isSuspend)}
|
||||||
|
>
|
||||||
|
<SuspendIcon
|
||||||
|
color="red"
|
||||||
|
width={20}
|
||||||
|
height={16}
|
||||||
|
className="inline mr-2 mb-1"
|
||||||
|
/>
|
||||||
|
Suspend
|
||||||
|
</DropdownItem>
|
||||||
<DropdownItem
|
<DropdownItem
|
||||||
key="Delete"
|
key="Delete"
|
||||||
onClick={() => handleDelete(user.id)}
|
onClick={() => handleDelete(user.id)}
|
||||||
|
|
|
||||||
|
|
@ -125,5 +125,5 @@ self.addEventListener("push", function (event) {
|
||||||
self.addEventListener("notificationclick", function (event) {
|
self.addEventListener("notificationclick", function (event) {
|
||||||
console.log("Notification click received.");
|
console.log("Notification click received.");
|
||||||
event.notification.close();
|
event.notification.close();
|
||||||
event.waitUntil(clients.openWindow("<https://kontenhumas.com>"));
|
event.waitUntil(clients.openWindow("<https://layananpemerintahri.com>"));
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
|
|
||||||
const baseURL = "https://kontenhumas.com/api";
|
const baseURL = "https://layananpemerintahri.com/api";
|
||||||
|
|
||||||
const axiosInterceptorInstance = axios.create({
|
const axiosInterceptorInstance = axios.create({
|
||||||
baseURL,
|
baseURL,
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ import axios from "axios";
|
||||||
import { postSignIn } from "../master-user";
|
import { postSignIn } from "../master-user";
|
||||||
import Cookies from "js-cookie";
|
import Cookies from "js-cookie";
|
||||||
|
|
||||||
const baseURL = "https://kontenhumas.com/api";
|
const baseURL = "https://layananpemerintahri.com/api";
|
||||||
|
|
||||||
const refreshToken = Cookies.get("refresh_token");
|
const refreshToken = Cookies.get("refresh_token");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
|
|
||||||
const baseURL = "https://kontenhumas.com/api";
|
const baseURL = "https://layananpemerintahri.com/api";
|
||||||
|
|
||||||
const axiosBaseInstance = axios.create({
|
const axiosBaseInstance = axios.create({
|
||||||
baseURL,
|
baseURL,
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,7 @@ export type MasterUser = {
|
||||||
userRoleId: number;
|
userRoleId: number;
|
||||||
username: string;
|
username: string;
|
||||||
workType: string;
|
workType: string;
|
||||||
|
isSuspend?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type MasterUserRole = {
|
export type MasterUserRole = {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue