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