Pembelian Saham
# feat: - Fitur pembelian saham - Status transaksi - Table transaksi - Table nama bank ### No Issue
This commit is contained in:
@@ -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,
|
||||
|
||||
11
src/app_modules/investasi/fun/fun_progress_bar.ts
Normal file
11
src/app_modules/investasi/fun/fun_progress_bar.ts
Normal 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;
|
||||
}
|
||||
@@ -18,6 +18,7 @@ export default async function getInvestasiByStatusId(
|
||||
hargaLembar: true,
|
||||
targetDana: true,
|
||||
totalLembar: true,
|
||||
sisaLembar: true,
|
||||
roi: true,
|
||||
active: true,
|
||||
imagesId: true,
|
||||
|
||||
@@ -24,6 +24,8 @@ export async function getListAllPublish() {
|
||||
hargaLembar: true,
|
||||
targetDana: true,
|
||||
totalLembar: true,
|
||||
sisaLembar: true,
|
||||
progress: true,
|
||||
roi: true,
|
||||
active: true,
|
||||
createdAt: true,
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user