Pembelian Saham

# feat:
- Fitur pembelian saham
- Status transaksi
- Table transaksi
- Table nama bank
### No Issue
This commit is contained in:
2023-11-21 10:08:46 +08:00
parent 19e870f8cd
commit 812f47fbf9
155 changed files with 208 additions and 359411 deletions

View File

@@ -12,7 +12,12 @@ export async function funCreateInvestasi(
formData: FormData,
data: MODEL_Investasi | any
) {
console.log(data)
// return {
// status: 201,
// message: "Berhasil Disimpan",
// };
const file: any = formData.get("file");
const fName = file.name;
const fExt = _.lowerCase(file.name.split(".").pop());
@@ -37,6 +42,8 @@ export async function funCreateInvestasi(
const upFolder = Buffer.from(await file.arrayBuffer());
fs.writeFileSync(`./public/investasi/${upload.url}`, upFolder);
// console.log(data)
const createInvest = await prisma.investasi.create({
data: {
authorId: data.authorId,
@@ -44,6 +51,7 @@ export async function funCreateInvestasi(
targetDana: data.targetDana.toString(),
hargaLembar: data.hargaLembar.toString(),
totalLembar: data.totalLembar.toString(),
sisaLembar: data.totalLembar.toString() ,
roi: data.roi.toString(),
masterPembagianDevidenId: data.masterPeriodeDevidenId,
masterPeriodeDevidenId: data.masterPembagianDevidenId,
@@ -53,6 +61,7 @@ export async function funCreateInvestasi(
},
});
if (!createInvest)
return {
status: 400,

View File

@@ -0,0 +1,11 @@
"use server";
export default async function funProgressBar(total: number, beli: number) {
const t = total;
const b = beli;
const progress = (b / t) * 100;
const pembulatan = Math.round(progress);
return pembulatan;
}

View File

@@ -18,6 +18,7 @@ export default async function getInvestasiByStatusId(
hargaLembar: true,
targetDana: true,
totalLembar: true,
sisaLembar: true,
roi: true,
active: true,
imagesId: true,

View File

@@ -24,6 +24,8 @@ export async function getListAllPublish() {
hargaLembar: true,
targetDana: true,
totalLembar: true,
sisaLembar: true,
progress: true,
roi: true,
active: true,
createdAt: true,

View File

@@ -14,6 +14,9 @@ export default async function getOneInvestasiById(id: string) {
hargaLembar: true,
targetDana: true,
totalLembar: true,
sisaLembar: true,
lembarTerbeli: true,
progress: true,
roi: true,
active: true,
createdAt: true,