title: auto
des: auto note:auto
This commit is contained in:
@@ -63,7 +63,6 @@ export default function EditIntroInvestasi({
|
|||||||
async function onUpdate() {
|
async function onUpdate() {
|
||||||
const body = edit_inves;
|
const body = edit_inves;
|
||||||
if (_.values(edit_inves).includes("")) return toast("Lengkapi data");
|
if (_.values(edit_inves).includes("")) return toast("Lengkapi data");
|
||||||
// if (!fl) return toast("File Kosong");
|
|
||||||
|
|
||||||
const fd = new FormData();
|
const fd = new FormData();
|
||||||
fd.append("file", fl as any);
|
fd.append("file", fl as any);
|
||||||
@@ -72,11 +71,6 @@ export default function EditIntroInvestasi({
|
|||||||
res.status === 200
|
res.status === 200
|
||||||
? (toast(res.message), router.back())
|
? (toast(res.message), router.back())
|
||||||
: toast(res.message);
|
: toast(res.message);
|
||||||
// if (res.status === 200) {
|
|
||||||
// router.back()
|
|
||||||
// } else {
|
|
||||||
// toast(res.message);
|
|
||||||
// }
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -90,8 +84,12 @@ export default function EditIntroInvestasi({
|
|||||||
withCloseButton={false}
|
withCloseButton={false}
|
||||||
>
|
>
|
||||||
<Group position="center">
|
<Group position="center">
|
||||||
<Button onClick={close} bg={"red"} color="red">Batal</Button>
|
<Button onClick={close} bg={"red"} color="red">
|
||||||
<Button onClick={onUpdate} bg={Warna.hijau_muda} color="green">Simpan</Button>
|
Batal
|
||||||
|
</Button>
|
||||||
|
<Button onClick={onUpdate} bg={Warna.hijau_muda} color="green">
|
||||||
|
Simpan
|
||||||
|
</Button>
|
||||||
</Group>
|
</Group>
|
||||||
</Modal>
|
</Modal>
|
||||||
|
|
||||||
@@ -249,7 +247,7 @@ export default function EditIntroInvestasi({
|
|||||||
bg={Warna.hijau_muda}
|
bg={Warna.hijau_muda}
|
||||||
color="green"
|
color="green"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
scrollTo({y: 0})
|
scrollTo({ y: 0 });
|
||||||
open();
|
open();
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -15,34 +15,34 @@ export default async function funEditInvestasi(
|
|||||||
const file = formData.get("file");
|
const file = formData.get("file");
|
||||||
|
|
||||||
if (file !== "null") {
|
if (file !== "null") {
|
||||||
const editInves = await prisma.investasi.update({
|
// const editInves = await prisma.investasi.update({
|
||||||
where: {
|
// where: {
|
||||||
id: data.id,
|
// id: data.id,
|
||||||
},
|
// },
|
||||||
data: {
|
// data: {
|
||||||
title: data.title,
|
// title: data.title,
|
||||||
targetDana: data.targetDana,
|
// targetDana: data.targetDana,
|
||||||
hargaLembar: data.hargaLembar,
|
// hargaLembar: data.hargaLembar,
|
||||||
totalLembar: data.totalLembar,
|
// totalLembar: data.totalLembar,
|
||||||
roi: data.roi,
|
// roi: data.roi,
|
||||||
masterPencarianInvestorId: data.MasterPencarianInvestor.id,
|
// masterPencarianInvestorId: data.MasterPencarianInvestor.id,
|
||||||
masterPembagianDevidenId: data.MasterPembagianDeviden.id,
|
// masterPembagianDevidenId: data.MasterPembagianDeviden.id,
|
||||||
masterPeriodeDevidenId: data.MasterPeriodeDeviden.id,
|
// masterPeriodeDevidenId: data.MasterPeriodeDeviden.id,
|
||||||
},
|
// },
|
||||||
});
|
// });
|
||||||
|
|
||||||
if (!editInves) {
|
// if (!editInves) {
|
||||||
return {
|
// return {
|
||||||
status: 400,
|
// status: 400,
|
||||||
message: "Gagal update",
|
// message: "Gagal update",
|
||||||
};
|
// };
|
||||||
}
|
// }
|
||||||
|
|
||||||
const file: any = formData.get("file");
|
const file: any = formData.get("file");
|
||||||
const fName = file.name;
|
const fName = file.name;
|
||||||
const fExt =
|
const fExt =
|
||||||
file && file.name ? _.lowerCase(file.name.split(".").pop()) : "";
|
file && file.name ? _.lowerCase(file.name.split(".").pop()) : "";
|
||||||
const fRandomName = editInves.id + "." + fExt;
|
const fRandomName = "file_" + _.random(100000000, 999999999999) + "." + fExt;
|
||||||
|
|
||||||
const updateImage = await prisma.images.update({
|
const updateImage = await prisma.images.update({
|
||||||
where: {
|
where: {
|
||||||
|
|||||||
Reference in New Issue
Block a user