Compare commits
3 Commits
fix-mobile
...
fix-mobile
| Author | SHA1 | Date | |
|---|---|---|---|
| 94e4b884a7 | |||
| fcad857422 | |||
| 32619ee9b3 |
@@ -2,6 +2,8 @@
|
||||
|
||||
All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.
|
||||
|
||||
## [1.5.15](https://wibugit.wibudev.com/wibu/hipmi/compare/v1.5.14...v1.5.15) (2025-11-18)
|
||||
|
||||
## [1.5.14](https://wibugit.wibudev.com/wibu/hipmi/compare/v1.5.13...v1.5.14) (2025-11-17)
|
||||
|
||||
## [1.5.13](https://wibugit.wibudev.com/wibu/hipmi/compare/v1.5.12...v1.5.13) (2025-11-17)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "hipmi",
|
||||
"version": "1.5.14",
|
||||
"version": "1.5.15",
|
||||
"private": true,
|
||||
"prisma": {
|
||||
"seed": "bun prisma/seed.ts"
|
||||
|
||||
@@ -20,6 +20,7 @@ export default function DeleteAccount() {
|
||||
const [data, setData] = useState({
|
||||
description: "",
|
||||
});
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
// Hanya di client, setelah mount
|
||||
@@ -31,15 +32,32 @@ export default function DeleteAccount() {
|
||||
}, []);
|
||||
|
||||
const handlerSubmit = async () => {
|
||||
if (!phoneNumber || !data.description) {
|
||||
if (!phoneNumber) {
|
||||
return notifications.show({
|
||||
title: "Error",
|
||||
message: "Please fill in description & phone number",
|
||||
message: "Please check your phone number",
|
||||
color: "red",
|
||||
});
|
||||
}
|
||||
|
||||
if (!data.description) {
|
||||
return notifications.show({
|
||||
title: "Error",
|
||||
message: "Please fill in description with 'Delete Account'",
|
||||
color: "red",
|
||||
});
|
||||
}
|
||||
|
||||
if (data.description !== "Delete Account") {
|
||||
return notifications.show({
|
||||
title: "Error",
|
||||
message: "Please fill in description with 'Delete Account'",
|
||||
color: "red",
|
||||
});
|
||||
}
|
||||
|
||||
try {
|
||||
setIsLoading(true);
|
||||
const response = await fetch("/api/helper/delete-account", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
@@ -67,12 +85,14 @@ export default function DeleteAccount() {
|
||||
if (!result.success) {
|
||||
notifications.show({
|
||||
title: "Error",
|
||||
message: result.error,
|
||||
message: result.error || "Failed to delete account.",
|
||||
color: "red",
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
} finally {
|
||||
setIsLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -121,7 +141,7 @@ export default function DeleteAccount() {
|
||||
/>
|
||||
</Grid.Col>
|
||||
<Grid.Col span={4}>
|
||||
<Button onClick={handlerSubmit} w={"100%"}>
|
||||
<Button onClick={handlerSubmit} w={"100%"} loading={isLoading}>
|
||||
Submit
|
||||
</Button>
|
||||
</Grid.Col>
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
"use client";
|
||||
import {
|
||||
Box,
|
||||
Button,
|
||||
Group,
|
||||
Paper,
|
||||
SimpleGrid,
|
||||
Stack,
|
||||
Text,
|
||||
Textarea,
|
||||
TextInput,
|
||||
Title
|
||||
Box,
|
||||
Button,
|
||||
Group,
|
||||
Paper,
|
||||
SimpleGrid,
|
||||
Stack,
|
||||
Text,
|
||||
Textarea,
|
||||
TextInput,
|
||||
Title,
|
||||
} from "@mantine/core";
|
||||
import { notifications } from "@mantine/notifications";
|
||||
import { IconBrandGmail, IconLocation } from "@tabler/icons-react";
|
||||
@@ -22,6 +22,7 @@ export default function SupportCenter() {
|
||||
title: "",
|
||||
description: "",
|
||||
});
|
||||
const [isLoading, setLoading] = useState(false);
|
||||
|
||||
const handleSubmit = async () => {
|
||||
if (!data.email || !data.title || !data.description) {
|
||||
@@ -32,35 +33,43 @@ export default function SupportCenter() {
|
||||
});
|
||||
}
|
||||
|
||||
const response = await fetch("/api/helper/support-center", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify(data),
|
||||
});
|
||||
const result = await response.json();
|
||||
try {
|
||||
setLoading(true);
|
||||
|
||||
if (result.success) {
|
||||
notifications.show({
|
||||
title: "Success",
|
||||
color: "green",
|
||||
message: "Message sent successfully.",
|
||||
const response = await fetch("/api/helper/support-center", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify(data),
|
||||
});
|
||||
const result = await response.json();
|
||||
|
||||
setData({
|
||||
email: "",
|
||||
title: "",
|
||||
description: "",
|
||||
});
|
||||
}
|
||||
if (result.success) {
|
||||
notifications.show({
|
||||
title: "Success",
|
||||
color: "green",
|
||||
message: "Message sent successfully.",
|
||||
});
|
||||
|
||||
if (!result.success) {
|
||||
notifications.show({
|
||||
title: "Error",
|
||||
color: "red",
|
||||
message: result.error,
|
||||
});
|
||||
setData({
|
||||
email: "",
|
||||
title: "",
|
||||
description: "",
|
||||
});
|
||||
}
|
||||
|
||||
if (!result.success) {
|
||||
notifications.show({
|
||||
title: "Error",
|
||||
color: "red",
|
||||
message: result.error || "Failed to send message.",
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -177,7 +186,11 @@ export default function SupportCenter() {
|
||||
}}
|
||||
/>
|
||||
|
||||
<Button color="yellow" onClick={() => handleSubmit()}>
|
||||
<Button
|
||||
loading={isLoading}
|
||||
color="yellow"
|
||||
onClick={() => handleSubmit()}
|
||||
>
|
||||
Submit
|
||||
</Button>
|
||||
</Stack>
|
||||
|
||||
@@ -18,7 +18,8 @@ export async function POST(req: Request) {
|
||||
|
||||
const data = await resend.emails.send({
|
||||
from: `${email} <onboarding@resend.dev>`,
|
||||
to: ["bip.baliinteraktifperkasa@gmail.com"], // ganti sesuai email kamu
|
||||
to: ["bagasbanuna02@gmail.com"],
|
||||
// to: ["bip.baliinteraktifperkasa@gmail.com"],
|
||||
subject: title,
|
||||
html: `
|
||||
<div style="font-family: Arial, sans-serif; font-size: 16px; color: #333;">
|
||||
|
||||
@@ -47,6 +47,8 @@ async function POST(request: Request) {
|
||||
},
|
||||
});
|
||||
|
||||
console.log("[DATA DONASI]", dataDonasi);
|
||||
|
||||
if (!dataDonasi)
|
||||
return NextResponse.json({
|
||||
status: 400,
|
||||
@@ -68,6 +70,8 @@ async function POST(request: Request) {
|
||||
},
|
||||
});
|
||||
|
||||
console.log("[DATA CERITA]", dataCerita);
|
||||
|
||||
if (!dataCerita)
|
||||
return NextResponse.json({
|
||||
status: 400,
|
||||
|
||||
@@ -32,3 +32,505 @@ export async function GET(
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export async function DELETE(
|
||||
request: Request,
|
||||
{ params }: { params: { id: string } }
|
||||
) {
|
||||
const { id } = params;
|
||||
console.log("[ID USER", id);
|
||||
try {
|
||||
console.log("[START DELETE ALL >>>]");
|
||||
const checkUser = await prisma.user.findUnique({
|
||||
where: {
|
||||
id: id,
|
||||
},
|
||||
select: {
|
||||
Profile: {
|
||||
select: {
|
||||
id: true,
|
||||
Portofolio: {
|
||||
select: {
|
||||
id: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
// EVENT START
|
||||
Event: {
|
||||
select: {
|
||||
id: true,
|
||||
},
|
||||
},
|
||||
Event_Peserta: {
|
||||
select: {
|
||||
id: true,
|
||||
},
|
||||
},
|
||||
// EVENT END
|
||||
|
||||
// COLLABORATION START
|
||||
ProjectCollaboration: {
|
||||
select: {
|
||||
id: true,
|
||||
},
|
||||
},
|
||||
ProjectCollaboration_Partisipasi: {
|
||||
select: {
|
||||
id: true,
|
||||
},
|
||||
},
|
||||
ProjectCollaboration_RoomChat: {
|
||||
select: {
|
||||
id: true,
|
||||
},
|
||||
},
|
||||
ProjectCollaboration_AnggotaRoomChat: {
|
||||
select: {
|
||||
id: true,
|
||||
},
|
||||
},
|
||||
ProjectCollaboration_Message: {
|
||||
select: {
|
||||
id: true,
|
||||
},
|
||||
},
|
||||
// COLLABORATION END
|
||||
|
||||
// VOTING START
|
||||
Voting: {
|
||||
select: {
|
||||
id: true,
|
||||
Voting_DaftarNamaVote: {
|
||||
select: {
|
||||
id: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
Voting_Kontributor: {
|
||||
select: {
|
||||
id: true,
|
||||
},
|
||||
},
|
||||
|
||||
// VOTING END
|
||||
|
||||
// JOB START
|
||||
Job: {
|
||||
select: {
|
||||
id: true,
|
||||
},
|
||||
},
|
||||
// JOB END
|
||||
|
||||
// FORUM START
|
||||
Forum_Posting: {
|
||||
select: {
|
||||
id: true,
|
||||
},
|
||||
},
|
||||
Forum_Komentar: {
|
||||
select: {
|
||||
id: true,
|
||||
},
|
||||
},
|
||||
Forum_ReportKomentar: {
|
||||
select: {
|
||||
id: true,
|
||||
},
|
||||
},
|
||||
Forum_ReportPosting: {
|
||||
select: {
|
||||
id: true,
|
||||
},
|
||||
},
|
||||
// FORUM END
|
||||
|
||||
// INVITATION START
|
||||
Investasi: {
|
||||
select: {
|
||||
id: true,
|
||||
BeritaInvestasi: {
|
||||
select: {
|
||||
id: true,
|
||||
},
|
||||
},
|
||||
DokumenInvestasi: {
|
||||
select: {
|
||||
id: true,
|
||||
},
|
||||
},
|
||||
ProspektusInvestasi: {
|
||||
select: {
|
||||
id: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
Investasi_Invoice: {
|
||||
select: {
|
||||
id: true,
|
||||
},
|
||||
},
|
||||
|
||||
// INVITATION END
|
||||
|
||||
// DONATION START
|
||||
Donasi: {
|
||||
select: {
|
||||
id: true,
|
||||
CeritaDonasi: {
|
||||
select: {
|
||||
id: true,
|
||||
},
|
||||
},
|
||||
Donasi_Kabar: {
|
||||
select: {
|
||||
id: true,
|
||||
},
|
||||
},
|
||||
Donasi_PencairanDana: {
|
||||
select: {
|
||||
id: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
Donasi_Invoice: {
|
||||
select: {
|
||||
id: true,
|
||||
},
|
||||
},
|
||||
|
||||
// DONATION END
|
||||
},
|
||||
});
|
||||
|
||||
// EVENT DELETE START
|
||||
for (let event of checkUser?.Event as any) {
|
||||
const deleteEvent = await prisma.event.findFirst({
|
||||
where: {
|
||||
id: event.id,
|
||||
},
|
||||
});
|
||||
|
||||
console.log(["DELETE EVENT", deleteEvent]);
|
||||
}
|
||||
|
||||
for (let event of checkUser?.Event_Peserta as any) {
|
||||
const deleteEvent = await prisma.event_Peserta.findFirst({
|
||||
where: {
|
||||
id: event.id,
|
||||
},
|
||||
select: {
|
||||
Event: {
|
||||
select: {
|
||||
title: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
console.log(["DELETE EVENT PESERTA", deleteEvent]);
|
||||
}
|
||||
// EVENT DELETE END
|
||||
|
||||
// COLLABORATION START
|
||||
for (let project of checkUser?.ProjectCollaboration as any) {
|
||||
const deleteProject = await prisma.projectCollaboration.findFirst({
|
||||
where: {
|
||||
id: project.id,
|
||||
},
|
||||
});
|
||||
|
||||
console.log(["DELETE PROJECT", deleteProject]);
|
||||
}
|
||||
|
||||
for (let project of checkUser?.ProjectCollaboration_Partisipasi as any) {
|
||||
const deleteProject =
|
||||
await prisma.projectCollaboration_Partisipasi.findFirst({
|
||||
where: {
|
||||
id: project.id,
|
||||
},
|
||||
});
|
||||
|
||||
console.log(["DELETE PROJECT PARTISIPASI", deleteProject]);
|
||||
}
|
||||
|
||||
for (let project of checkUser?.ProjectCollaboration_RoomChat as any) {
|
||||
const deleteProject =
|
||||
await prisma.projectCollaboration_RoomChat.findFirst({
|
||||
where: {
|
||||
id: project.id,
|
||||
},
|
||||
});
|
||||
|
||||
console.log(["DELETE PROJECT ROOMCHAT", deleteProject]);
|
||||
}
|
||||
|
||||
for (let project of checkUser?.ProjectCollaboration_AnggotaRoomChat as any) {
|
||||
const deleteProject =
|
||||
await prisma.projectCollaboration_AnggotaRoomChat.findFirst({
|
||||
where: {
|
||||
id: project.id,
|
||||
},
|
||||
});
|
||||
|
||||
console.log(["DELETE PROJECT ANGGOTA ROOMCHAT", deleteProject]);
|
||||
}
|
||||
|
||||
for (let project of checkUser?.ProjectCollaboration_Message as any) {
|
||||
const deleteProject = await prisma.projectCollaboration_Message.findFirst(
|
||||
{
|
||||
where: {
|
||||
id: project.id,
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
console.log(["DELETE PROJECT MESSAGE", deleteProject]);
|
||||
}
|
||||
// COLLABORATION END
|
||||
|
||||
// VOTING START
|
||||
for (let voting of checkUser?.Voting as any) {
|
||||
for (let id of voting?.Voting_DaftarNamaVote as any) {
|
||||
const deleteVotingListName =
|
||||
await prisma.voting_DaftarNamaVote.findFirst({
|
||||
where: {
|
||||
id: id.id,
|
||||
},
|
||||
});
|
||||
console.log(["DELETE VOTING LIST NAME", deleteVotingListName]);
|
||||
}
|
||||
|
||||
const deleteVoting = await prisma.voting.findFirst({
|
||||
where: {
|
||||
id: voting.id,
|
||||
},
|
||||
});
|
||||
console.log(["DELETE VOTING", deleteVoting]);
|
||||
}
|
||||
// VOTING END
|
||||
|
||||
// JOB START
|
||||
for (let job of checkUser?.Job as any) {
|
||||
const deleteJob = await prisma.job.findFirst({
|
||||
where: {
|
||||
id: job.id,
|
||||
},
|
||||
});
|
||||
console.log(["DELETE JOB", deleteJob]);
|
||||
}
|
||||
// JOB END
|
||||
|
||||
// FORUM START
|
||||
for (let forum of checkUser?.Forum_Posting as any) {
|
||||
const deleteForum = await prisma.forum_Posting.findFirst({
|
||||
where: {
|
||||
id: forum.id,
|
||||
},
|
||||
});
|
||||
console.log(["DELETE FORUM POSTING", deleteForum]);
|
||||
}
|
||||
|
||||
for (let forum of checkUser?.Forum_Komentar as any) {
|
||||
const deleteForum = await prisma.forum_Komentar.findFirst({
|
||||
where: {
|
||||
id: forum.id,
|
||||
},
|
||||
});
|
||||
console.log(["DELETE FORUM KOMENTAR", deleteForum]);
|
||||
}
|
||||
|
||||
for (let forum of checkUser?.Forum_ReportKomentar as any) {
|
||||
const deleteForum = await prisma.forum_ReportKomentar.findFirst({
|
||||
where: {
|
||||
id: forum.id,
|
||||
},
|
||||
});
|
||||
console.log(["DELETE FORUM REPORT KOMENTAR", deleteForum]);
|
||||
}
|
||||
|
||||
for (let forum of checkUser?.Forum_ReportPosting as any) {
|
||||
const deleteForum = await prisma.forum_ReportPosting.findFirst({
|
||||
where: {
|
||||
id: forum.id,
|
||||
},
|
||||
});
|
||||
console.log(["DELETE FORUM REPORT POSTING", deleteForum]);
|
||||
}
|
||||
// FORUM END
|
||||
|
||||
// INVESTASI START
|
||||
|
||||
for (let invoice of checkUser?.Investasi_Invoice as any) {
|
||||
const deleteInvoice = await prisma.investasi_Invoice.findFirst({
|
||||
where: {
|
||||
id: invoice.id,
|
||||
},
|
||||
});
|
||||
console.log(["DELETE INVOICE INVESTASI", deleteInvoice]);
|
||||
}
|
||||
|
||||
for (let investasi of checkUser?.Investasi as any) {
|
||||
for (let berita of investasi?.BeritaInvestasi as any) {
|
||||
const deleteBerita = await prisma.beritaInvestasi.findFirst({
|
||||
where: {
|
||||
id: berita.id,
|
||||
},
|
||||
});
|
||||
console.log(["DELETE BERITA INVESTASI", deleteBerita]);
|
||||
}
|
||||
|
||||
for (let dokumen of investasi?.DokumenInvestasi as any) {
|
||||
const deleteDokumen = await prisma.dokumenInvestasi.findFirst({
|
||||
where: {
|
||||
id: dokumen.id,
|
||||
},
|
||||
});
|
||||
console.log(["DELETE DOKUMEN INVESTASI", deleteDokumen]);
|
||||
}
|
||||
|
||||
const deleteProspektus = await prisma.prospektusInvestasi.findFirst({
|
||||
where: {
|
||||
investasiId: investasi.id,
|
||||
},
|
||||
});
|
||||
console.log(["DELETE PROSPEKTUS INVESTASI", deleteProspektus]);
|
||||
|
||||
const deleteInvestasi = await prisma.investasi.findFirst({
|
||||
where: {
|
||||
id: investasi.id,
|
||||
},
|
||||
});
|
||||
console.log(["DELETE INVESTASI", deleteInvestasi]);
|
||||
}
|
||||
// INVESTASI END
|
||||
|
||||
// DONASI START
|
||||
|
||||
for (let donasi of checkUser?.Donasi_Invoice as any) {
|
||||
const deleteInvoice = await prisma.donasi_Invoice.findFirst({
|
||||
where: {
|
||||
id: donasi.id,
|
||||
},
|
||||
});
|
||||
console.log(["DELETE INVOICE DONASI", deleteInvoice]);
|
||||
}
|
||||
|
||||
for (let invoice of checkUser?.Donasi as any) {
|
||||
for (let kabar of invoice?.Donasi_Kabar as any) {
|
||||
const deleteKabar = await prisma.donasi_Kabar.findFirst({
|
||||
where: {
|
||||
id: kabar.id,
|
||||
},
|
||||
});
|
||||
console.log(["DELETE KABAR DONASI", deleteKabar]);
|
||||
}
|
||||
|
||||
for (let pencairanDana of invoice?.Donasi_PencairanDana as any) {
|
||||
const deletePencairanDana = await prisma.donasi_PencairanDana.findFirst(
|
||||
{
|
||||
where: {
|
||||
id: pencairanDana.id,
|
||||
},
|
||||
}
|
||||
);
|
||||
console.log(["DELETE PENCAIRAN DANA DONASI", deletePencairanDana]);
|
||||
}
|
||||
|
||||
const deleteCerita = await prisma.donasi_Cerita.findFirst({
|
||||
where: {
|
||||
id: invoice.id,
|
||||
},
|
||||
});
|
||||
|
||||
console.log(["DELETE CERITA DONASI", deleteCerita]);
|
||||
|
||||
const deleteDonasi = await prisma.donasi.findFirst({
|
||||
where: {
|
||||
id: invoice.id,
|
||||
},
|
||||
});
|
||||
console.log(["DELETE DONASI", deleteDonasi]);
|
||||
}
|
||||
|
||||
// DONASI END
|
||||
|
||||
// PORTOFOLIO DELETE START
|
||||
for (const portofolio of checkUser?.Profile?.Portofolio as any) {
|
||||
const deletePortofolio = await prisma.portofolio.findFirst({
|
||||
where: {
|
||||
id: portofolio.id,
|
||||
},
|
||||
select: {
|
||||
logoId: true,
|
||||
},
|
||||
});
|
||||
|
||||
// const deleteLogo = await fetch(
|
||||
// `https://wibu-storage.wibudev.com/api/files/${deletePortofolio.logoId}/delete`,
|
||||
// {
|
||||
// method: "DELETE",
|
||||
// headers: {
|
||||
// Authorization: `Bearer ${process.env.WS_APIKEY}`,
|
||||
// },
|
||||
// }
|
||||
// );
|
||||
|
||||
// if (deleteLogo.ok) {
|
||||
// console.log("Success delete logo");
|
||||
// }
|
||||
|
||||
console.log(["DELETE PORTOFOLIO", deletePortofolio]);
|
||||
|
||||
const deleteMaps = await prisma.businessMaps.findFirst({
|
||||
where: {
|
||||
portofolioId: portofolio.id,
|
||||
},
|
||||
});
|
||||
|
||||
console.log(["DELETE MAPS", deleteMaps]);
|
||||
|
||||
const deleteSosialMedia = await prisma.portofolio_MediaSosial.findFirst({
|
||||
where: {
|
||||
portofolioId: portofolio.id,
|
||||
},
|
||||
});
|
||||
|
||||
console.log(["DELETE SOSIAL MEDIA", deleteSosialMedia]);
|
||||
|
||||
console.log(["DELETE PORTOFOLIOID:", portofolio.id]);
|
||||
}
|
||||
|
||||
const deleteProfile = await prisma.profile.findFirst({
|
||||
where: {
|
||||
userId: id,
|
||||
},
|
||||
});
|
||||
console.log(["DELETE PROFILE", deleteProfile]);
|
||||
// PORTOFOLIO DELETE END
|
||||
|
||||
console.log("[END DELETE ALL >>>]");
|
||||
|
||||
return NextResponse.json(
|
||||
{ success: true, message: "Berhasil menghapus data" },
|
||||
{ status: 200 }
|
||||
);
|
||||
} catch (error) {
|
||||
console.log(["ERROR DELETE ALL", error]);
|
||||
return NextResponse.json(
|
||||
{
|
||||
success: false,
|
||||
message: "Error delete data from API ",
|
||||
reason: (error as Error).message,
|
||||
},
|
||||
{ status: 500 }
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user