## Deskripsi :
- Notifikasi investasi
## Issue : Gerbang pembayaran
This commit is contained in:
2024-08-12 10:20:28 +08:00
parent 7131e93a49
commit 6ffeb097e8
188 changed files with 4409 additions and 2488 deletions

View File

@@ -0,0 +1,46 @@
"use server";
import prisma from "@/app/lib/prisma";
import { RouterInvestasi } from "@/app/lib/router_hipmi/router_investasi";
import { revalidatePath } from "next/cache";
export async function adminInvestasi_funEditStatusPublishById({
investasiId,
statusId,
progesInvestasiId,
}: {
investasiId: string;
statusId: string;
progesInvestasiId: string;
}) {
const publishTime = new Date();
const res = await prisma.investasi.update({
where: {
id: investasiId,
},
data: {
countDown: publishTime,
masterStatusInvestasiId: statusId,
masterProgresInvestasiId: progesInvestasiId,
},
select: {
id: true,
title: true,
authorId: true,
MasterStatusInvestasi: {
select: {
name: true,
},
},
}
});
if (!res) return { status: 400, message: "Gagal Update" };
revalidatePath(RouterInvestasi.portofolio);
return {
data: res,
status: 200,
message: "Publish Berhasil",
};
}

View File

@@ -1,26 +1,36 @@
"use server"
"use server";
import prisma from "@/app/lib/prisma"
import { RouterAdminInvestasi_OLD } from "@/app/lib/router_hipmi/router_admin"
import { RouterInvestasi } from "@/app/lib/router_hipmi/router_investasi"
import { revalidatePath } from "next/cache"
import prisma from "@/app/lib/prisma";
import { RouterAdminInvestasi } from "@/app/lib/router_admin/router_admin_investasi";
import { revalidatePath } from "next/cache";
export default async function Admin_funRejectInvestasi(data: any) {
// console.log(data)
// console.log(data)
const res = await prisma.investasi.update({
where: { id: data.id },
data: {
masterStatusInvestasiId: data.status,
catatan: data.catatan
}
})
if(!res) return {status: 400, message: "Gagal reject"}
const res = await prisma.investasi.update({
where: { id: data.id },
data: {
masterStatusInvestasiId: data.status,
catatan: data.catatan,
},
select: {
id: true,
title: true,
authorId: true,
MasterStatusInvestasi: {
select: {
name: true,
},
},
},
});
if (!res) return { status: 400, message: "Gagal reject" };
revalidatePath(RouterAdminInvestasi_OLD.main_investasi)
revalidatePath(RouterAdminInvestasi.detail_review);
return {
status: 200,
message: "Reject berhasil"
}
}
return {
data: res,
status: 200,
message: "Reject berhasil",
};
}

View File

@@ -0,0 +1,71 @@
"use server";
import prisma from "@/app/lib/prisma";
import { ceil } from "lodash";
export async function adminInvestasi_funGetAllPublish({
page,
search,
}: {
page: number;
search?: string;
}) {
const takeData = 10;
const skipData = page * takeData - takeData;
const data = await prisma.investasi.findMany({
take: takeData,
skip: skipData,
orderBy: {
countDown: "desc",
},
where: {
active: true,
masterStatusInvestasiId: "1",
title: {
contains: search,
mode: "insensitive",
},
},
select: {
id: true,
title: true,
authorId: true,
hargaLembar: true,
targetDana: true,
totalLembar: true,
roi: true,
active: true,
imagesId: true,
catatan: true,
MasterStatusInvestasi: true,
BeritaInvestasi: true,
DokumenInvestasi: true,
ProspektusInvestasi: true,
MasterPembagianDeviden: true,
MasterPencarianInvestor: true,
MasterPeriodeDeviden: true,
author: true,
progress: true,
sisaLembar: true,
},
});
const nCount = await prisma.investasi.count({
where: {
active: true,
masterStatusInvestasiId: "1",
title: {
contains: search,
mode: "insensitive",
},
},
});
const allData = {
data: data,
nPage: ceil(nCount / takeData),
};
return allData;
}

View File

@@ -0,0 +1,61 @@
"use server";
import prisma from "@/app/lib/prisma";
import { ceil } from "lodash";
export async function adminInvestasi_funGetAllReject({
page,
search,
}: {
page: number;
search?: string;
}) {
const takeData = 10;
const skipData = page * takeData - takeData;
const data = await prisma.investasi.findMany({
take: takeData,
skip: skipData,
orderBy: {
createdAt: "desc",
},
where: {
active: true,
masterStatusInvestasiId: "4",
title: {
contains: search,
mode: "insensitive",
},
},
select: {
id: true,
title: true,
authorId: true,
hargaLembar: true,
targetDana: true,
totalLembar: true,
roi: true,
active: true,
author: true,
catatan: true,
},
});
const nCount = await prisma.investasi.count({
where: {
active: true,
masterStatusInvestasiId: "4",
title: {
contains: search,
mode: "insensitive",
},
},
});
const allData = {
data: data,
nPage: ceil(nCount / takeData),
};
return allData;
}

View File

@@ -0,0 +1,60 @@
"use server";
import prisma from "@/app/lib/prisma";
import { ceil } from "lodash";
export async function adminInvestasi_funGetAllReview({
page,
search,
}: {
page: number;
search?: string;
}) {
const takeData = 10;
const skipData = page * takeData - takeData;
const data = await prisma.investasi.findMany({
take: takeData,
skip: skipData,
orderBy: {
createdAt: "desc",
},
where: {
active: true,
masterStatusInvestasiId: "2",
title: {
contains: search,
mode: "insensitive",
},
},
select: {
id: true,
title: true,
authorId: true,
hargaLembar: true,
targetDana: true,
totalLembar: true,
roi: true,
active: true,
author: true,
},
});
const nCount = await prisma.investasi.count({
where: {
active: true,
masterStatusInvestasiId: "2",
title: {
contains: search,
mode: "insensitive",
},
},
});
const allData = {
data: data,
nPage: ceil(nCount / takeData),
};
return allData;
}