{
- setValue({
- ...value,
- deskripsi: val.target.value,
- });
- }}
- />
+
+
+
+ {
+ setValue({
+ ...value,
+ namaBisnis: val.target.value,
+ });
+ }}
+ />
+ ({
+ value: e.id,
+ label: e.name,
+ }))}
+ onChange={(val) => {
+ setValue({
+ ...value,
+ masterBidangBisnisId: val as any,
+ });
+ }}
+ />
+ {
+ setValue({
+ ...value,
+ alamatKantor: val.target.value,
+ });
+ }}
+ />
+ {
+ setValue({
+ ...value,
+ tlpn: val.target.value,
+ });
+ }}
+ />
+
+
+
+
+
+
+
+
+
+
+ {
+ try {
+ const buffer = URL.createObjectURL(
+ new Blob([new Uint8Array(await files.arrayBuffer())])
+ );
+ // console.log(buffer, "ini buffer");
+ // console.log(files, " ini file");
+ setImg(buffer);
+ setFile(files);
+ } catch (error) {
+ console.log(error);
+ }
+ }}
+ accept="image/png,image/jpeg"
+ >
+ {(props) => (
+ }
+ compact
+ >
+ Upload
+
+ )}
+
+
+
+
+
+
+ {
+ setMedsos({
+ ...medsos,
+ facebook: val.target.value,
+ });
+ }}
+ />
+ {
+ setMedsos({
+ ...medsos,
+ instagram: val.target.value,
+ });
+ }}
+ />
+ {
+ setMedsos({
+ ...medsos,
+ tiktok: val.target.value,
+ });
+ }}
+ />
+ {
+ setMedsos({
+ ...medsos,
+ twitter: val.target.value,
+ });
+ }}
+ />
+ {
+ setMedsos({
+ ...medsos,
+ youtube: val.target.value,
+ });
+ }}
+ />
+
{
- onSubmit();
+ onSubmit(router, profileId, value as any, file, medsos);
}}
>
Simpan
- {/* {JSON.stringify(data, null, 2)} */}
+ {/* {JSON.stringify(bidangBisnis, null, 2)} */}
>
);
}
+
+async function onSubmit(
+ router: AppRouterInstance,
+ profileId: string,
+ dataPorto: MODEL_PORTOFOLIO_OLD,
+ file: FormData,
+ dataMedsos: any
+) {
+ const porto = {
+ namaBisnis: dataPorto.namaBisnis,
+ masterBidangBisnisId: dataPorto.masterBidangBisnisId,
+ alamatKantor: dataPorto.alamatKantor,
+ tlpn: dataPorto.tlpn,
+ deskripsi: dataPorto.deskripsi,
+ };
+ if (_.values(porto).includes("")) return toast("Lengkapi Data");
+ if (!file) return NotifPeringatan("Lengkapi logo binnis");
+
+ const gambar = new FormData
+ gambar.append("file",file as any)
+
+ await funCreatePortofolio(profileId, porto as any, gambar, dataMedsos).then(
+ (res) => {
+ if (res.status === 201) {
+ ComponentGlobal_NotifikasiBerhasil("Berhasil disimpan");
+ router.back();
+ } else {
+ ComponentGlobal_NotifikasiGagal("Gagal disimpan");
+ }
+ }
+ );
+}
diff --git a/src/app_modules/katalog/portofolio/edit/data/index.tsx b/src/app_modules/katalog/portofolio/edit/data/index.tsx
new file mode 100644
index 00000000..6099e6d7
--- /dev/null
+++ b/src/app_modules/katalog/portofolio/edit/data/index.tsx
@@ -0,0 +1,130 @@
+"use client";
+
+import { Box, Button, Select, Stack, TextInput, Textarea } from "@mantine/core";
+import {
+ MODEL_PORTOFOLIO,
+ MODEL_PORTOFOLIO_BIDANG_BISNIS,
+} from "../../model/interface";
+import { useState } from "react";
+import _ from "lodash";
+import { AppRouterInstance } from "next/dist/shared/lib/app-router-context.shared-runtime";
+import { useRouter } from "next/navigation";
+import { Portofolio_funEditDataBisnis } from "../../fun/edit/fun_edit_data_bisnis_by_id";
+import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/component_global/notif_global/notifikasi_berhasil";
+import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/component_global/notif_global/notifikasi_gagal";
+
+export default function Portofolio_EditDataBisnis({
+ dataPorto,
+ listBidang,
+}: {
+ dataPorto: MODEL_PORTOFOLIO;
+ listBidang: MODEL_PORTOFOLIO_BIDANG_BISNIS[];
+}) {
+ const router = useRouter();
+ const [porto, setPorto] = useState(dataPorto);
+ // const [value, setPorto] = useState({
+ // namaBisnis: "",
+ // masterBidangBisnisId: "",
+ // alamatKantor: "",
+ // tlpn: "",
+ // deskripsi: "",
+ // });
+ return (
+ <>
+ {/* {JSON.stringify(porto, null, 2)} */}
+
+
+ {
+ setPorto({
+ ...porto,
+ namaBisnis: val.target.value,
+ });
+ }}
+ />
+ ({
+ value: e.id,
+ label: e.name,
+ }))}
+ onChange={(val) => {
+ setPorto({
+ ...(porto as any),
+ MasterBidangBisnis: {
+ id: val,
+ },
+ });
+ }}
+ />
+ {
+ setPorto({
+ ...porto,
+ alamatKantor: val.target.value,
+ });
+ }}
+ />
+ {
+ setPorto({
+ ...porto,
+ tlpn: val.target.value,
+ });
+ }}
+ />
+
+ {
+ onUpdate(router, porto as any);
+ }}
+ >
+ Update
+
+
+ >
+ );
+}
+
+async function onUpdate(router: AppRouterInstance, data: MODEL_PORTOFOLIO) {
+ await Portofolio_funEditDataBisnis(data).then((res) => {
+ if (res.status === 200) {
+ ComponentGlobal_NotifikasiBerhasil(res.message);
+ router.back();
+ } else {
+ ComponentGlobal_NotifikasiGagal(res.message);
+ }
+ });
+}
diff --git a/src/app_modules/katalog/portofolio/edit/data/layout.tsx b/src/app_modules/katalog/portofolio/edit/data/layout.tsx
new file mode 100644
index 00000000..3fa11f29
--- /dev/null
+++ b/src/app_modules/katalog/portofolio/edit/data/layout.tsx
@@ -0,0 +1,22 @@
+"use client";
+
+import ComponentKatalog_HeaderTamplate from "@/app_modules/katalog/component/header_tamplate";
+import { AppShell } from "@mantine/core";
+import React from "react";
+
+
+export default function LayoutPortofolio_EditDataBisnis({
+ children,
+}: {
+ children: React.ReactNode;
+}) {
+ return (
+ <>
+ }
+ >
+ {children}
+