diff --git a/.env.build b/.env.build deleted file mode 100644 index 4529a401..00000000 --- a/.env.build +++ /dev/null @@ -1,9 +0,0 @@ -DATABASE_URL="postgresql://bip:Production_123@localhost:5433/hipmi_build?schema=public" -WIBU_PWD="QWERTYUIOPLKJHGFDSAZXCVBNMQAZWSXEDCRFVTGBYHNUJMIKOLPPOIUYTREWQLKJHGFDSAMNBVCXZlghvftyguhijknhbgvcfytguu8okjnhbgvfty7u8oilkjnhgvtygu7u8ojilnkhbgvhujnkhghvjhukjnhb" -Client_KEY="SB-Mid-client-9NDTxltqdZrEB9m-" -Server_KEY="SB-Mid-server-NyltU-U7fLVQd1nv1LWBKylr" -MAPBOX_TOKEN="pk.eyJ1IjoibWFsaWtrdXJvc2FraSIsImEiOiJjbHppZHh2enYwZnQ3MmlyMWc2Y2RlMzZoIn0.XssvJvq_iniclf8UhvXaIg" -WS_APIKEY="eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyIjp7ImlkIjoiY20wdXIxeXh3MDAwMDU2bnNqbHI2MTg3cCIsIm5hbWUiOiJiYWdhcyIsImVtYWlsIjoiYmFnYXNAZ21haWwuY29tIiwiQXBpS2V5IjpbeyJpZCI6ImNtMHVyMXl5MzAwMDI1Nm5zazNia2xyc28iLCJuYW1lIjoiZGVmYXVsdCJ9XX0sImlhdCI6MTcyNTk1NjMyMSwiZXhwIjo0ODgxNzE2MzIxfQ.9D3YszZA_ljrkTKMcgo03u7PL5mo9OaoM41rbUrOsz8" -NEXT_PUBLIC_WIBU_REALTIME_TOKEN="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Inp5aml4c2J1c2diYnR2am9namhvIiwicm9sZSI6ImFub24iLCJpYXQiOjE3MjY3Mzk1NDUsImV4cCI6MjA0MjMxNTU0NX0.jHNW5Pwhj-KXUQOMqzILaAz62k3xlKEL5XKE4xoR7Xc" -NEXT_PUBLIC_BASE_TOKEN_KEY="QWERTYUIOPLKJHGFDSAZXCVBNMQAZWSXEDCRFVTGBYHNUJMIKOLPPOIUYTREWQLKJHGFDSAMNBVCXZlghvftyguhijknhbgvcfytguu8okjnhbgvfty7u8oilkjnhgvtygu7u8ojilnkhbgvhujnkhghvjhukjnhb" -NEXT_PUBLIC_BASE_SESSION_KEY="hipmi-key" \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index beaf1e6a..00000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "WillLuke.nextjs.addTypesOnSave": true, - "WillLuke.nextjs.hasPrompted": true, - "prismaERDPreviewer.preferredTheme": "dark" -} diff --git a/CHANGELOG.md b/CHANGELOG.md index 68b5f9cf..44f4498e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines. +## [1.2.55](https://github.com/bipproduction/hipmi/compare/v1.2.54...v1.2.55) (2025-02-12) + ## [1.2.54](https://github.com/bipproduction/hipmi/compare/v1.2.53...v1.2.54) (2025-02-12) ## [1.2.53](https://github.com/bipproduction/hipmi/compare/v1.2.52...v1.2.53) (2025-02-11) diff --git a/package.json b/package.json index b56febe2..5aa3d0d0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hipmi", - "version": "1.2.54", + "version": "1.2.55", "private": true, "prisma": { "seed": "bun prisma/seed.ts" diff --git a/run.build.dev b/run.build.dev new file mode 100644 index 00000000..57e0310d --- /dev/null +++ b/run.build.dev @@ -0,0 +1 @@ +nice -n 19 bun --env-file=.env.build run build diff --git a/src/app/(admin)/logs/logs.module.css b/src/app/(admin)/logs/logs.module.css deleted file mode 100644 index 42dadbaa..00000000 --- a/src/app/(admin)/logs/logs.module.css +++ /dev/null @@ -1,138 +0,0 @@ -/* app/admin/logs/logs.module.css */ -.container { - padding: 24px; - max-width: 1200px; - margin: 0 auto; - } - - .title { - font-size: 24px; - font-weight: bold; - margin-bottom: 16px; - } - - .filterContainer { - margin-bottom: 16px; - } - - .select { - padding: 8px; - border: 1px solid #ddd; - border-radius: 4px; - min-width: 200px; - } - - .logsContainer { - display: flex; - flex-direction: column; - gap: 8px; - } - - .logItem { - padding: 16px; - border-radius: 4px; - box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); - } - - .errorLog { - background-color: #fef2f2; - } - - .warnLog { - background-color: #fefce8; - } - - .infoLog { - background-color: #ffffff; - } - - .logHeader { - display: flex; - align-items: center; - gap: 8px; - } - - .timestamp { - font-size: 14px; - color: #666; - } - - .level { - padding: 4px 8px; - border-radius: 4px; - font-size: 12px; - font-weight: 500; - } - - .errorLevel { - background-color: #fee2e2; - color: #991b1b; - } - - .warnLevel { - background-color: #fef3c7; - color: #92400e; - } - - .infoLevel { - background-color: #dbeafe; - color: #1e40af; - } - - .message { - margin-top: 8px; - } - - .metadata { - margin-top: 8px; - padding: 8px; - background-color: #f9fafb; - border-radius: 4px; - font-size: 14px; - overflow-x: auto; - white-space: pre-wrap; - } - - .loading { - text-align: center; - padding: 24px; - color: #666; - } - - .error { - color: #dc2626; - text-align: center; - padding: 24px; - } - - /* Hover effects */ - .logItem:hover { - box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); - } - - .select:hover { - border-color: #999; - } - - /* Focus states */ - .select:focus { - outline: none; - border-color: #2563eb; - box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2); - } - - /* Responsive adjustments */ - @media (max-width: 768px) { - .container { - padding: 16px; - } - - .logHeader { - flex-direction: column; - align-items: flex-start; - } - - .metadata { - font-size: 12px; - } - } \ No newline at end of file diff --git a/src/app/(admin)/logs/page.tsx b/src/app/(admin)/logs/page.tsx deleted file mode 100644 index 2ac03d42..00000000 --- a/src/app/(admin)/logs/page.tsx +++ /dev/null @@ -1,106 +0,0 @@ -// app/admin/logs/page.tsx -"use client"; - -import { useEffect, useState } from "react"; -import { format } from "date-fns"; -import styles from "./logs.module.css"; - -interface LogEntry { - timestamp: string; - level: string; - message: string; - metadata?: any; -} - -export default function LogsPage() { - const [logs, setLogs] = useState([]); - const [loading, setLoading] = useState(true); - const [error, setError] = useState(null); - const [filter, setFilter] = useState<"all" | "error" | "info" | "warn">( - "all" - ); - - useEffect(() => { - fetchLogs(); - }, []); - - async function fetchLogs() { - try { - const response = await fetch("/api/logs/view"); - if (!response.ok) throw new Error("Failed to fetch logs"); - - const data = await response.json(); - setLogs(data.logs); - } catch (err) { - setError(err instanceof Error ? err.message : "Error fetching logs"); - } finally { - setLoading(false); - } - } - - const filteredLogs = logs.filter((log) => - filter === "all" ? true : log.level === filter - ); - - if (loading) return
Loading logs...
; - if (error) return
Error: {error}
; - - return ( -
-

System Logs

- -
- -
- -
- {filteredLogs.map((log, index) => ( -
-
- - {format(new Date(log.timestamp), "yyyy-MM-dd HH:mm:ss")} - - - {log.level.toUpperCase()} - -
- -
{log.message}
- - {log.metadata && ( -
-                {JSON.stringify(log.metadata, null, 2)}
-              
- )} -
- ))} -
-
- ); -} diff --git a/src/app/api/logs/view/route.ts b/src/app/api/logs/view/route.ts deleted file mode 100644 index b660e323..00000000 --- a/src/app/api/logs/view/route.ts +++ /dev/null @@ -1,71 +0,0 @@ -// app/api/logs/view/route.ts -import { NextRequest, NextResponse } from "next/server"; -import fs from "fs/promises"; -import path from "path"; - -interface LogEntry { - timestamp: string; - level: string; - message: string; - metadata?: any; -} - -async function readLogFiles(directory: string): Promise { - try { - const logPath = path.join(process.cwd(), directory); - const files = await fs.readdir(logPath); - const logFiles = files.filter((file) => file.endsWith(".log")); - - const allLogs: LogEntry[] = []; - - for (const file of logFiles) { - const filePath = path.join(logPath, file); - const content = await fs.readFile(filePath, "utf-8"); - - // Parse setiap baris log - const logs = content - .split("\n") - .filter(Boolean) - .map((line) => { - try { - return JSON.parse(line); - } catch (e) { - return null; - } - }) - .filter(Boolean); - - allLogs.push(...logs); - } - - // Sort berdasarkan timestamp, terbaru di atas - return allLogs.sort( - (a, b) => - new Date(b.timestamp).getTime() - new Date(a.timestamp).getTime() - ); - } catch (error) { - console.error("Error reading log files:", error); - return []; - } -} - -export async function GET(request: NextRequest) { - try { - // Baca logs dari frontend dan backend - const frontendLogs = await readLogFiles("logs/frontend"); - const backendLogs = await readLogFiles("logs/backend"); - - // Gabungkan dan sort semua logs - const allLogs = [...frontendLogs, ...backendLogs].sort( - (a, b) => - new Date(b.timestamp).getTime() - new Date(a.timestamp).getTime() - ); - - return NextResponse.json({ logs: allLogs }); - } catch (error) { - return NextResponse.json( - { error: "Failed to fetch logs" }, - { status: 500 } - ); - } -} diff --git a/src/app/api/portofolio/[id]/route.ts b/src/app/api/portofolio/[id]/route.ts index 0e5e4947..9222acb9 100644 --- a/src/app/api/portofolio/[id]/route.ts +++ b/src/app/api/portofolio/[id]/route.ts @@ -1,7 +1,131 @@ import { prisma } from "@/lib"; +import backendLogger from "@/util/backendLogger"; import { NextResponse } from "next/server"; -export { POST }; +export { GET, POST, PUT }; + +async function GET(request: Request, { params }: { params: { id: string } }) { + try { + const { id } = params; + + const data = await prisma.portofolio.findUnique({ + where: { + id: id, + }, + include: { + MasterBidangBisnis: { + select: { + id: true, + name: true, + active: true, + }, + }, + Portofolio_MediaSosial: true, + Profile: { + select: { + userId: true, + User: { + select: { + id: true, + }, + }, + }, + }, + BusinessMaps: { + include: { + Author: true, + }, + }, + }, + }); + + if (!data) + return NextResponse.json( + { + success: false, + message: "Data tidak ditemukan", + }, + { status: 404 } + ); + + return NextResponse.json( + { + success: true, + message: "Berhasil mendapatkan data", + data: data, + }, + { status: 200 } + ); + } catch (error) { + backendLogger.error("API Error Get Data Portofolio", error); + return NextResponse.json( + { + success: false, + message: "API Error Get Data Potofolio", + reason: (error as Error).message, + }, + { status: 500 } + ); + } +} + +async function PUT(request: Request, { params }: { params: { id: string } }) { + if (request.method !== "PUT") { + return NextResponse.json( + { + success: false, + message: "Method not allowed", + }, + { status: 405 } + ); + } + + try { + const { id } = params; + const { data } = await request.json(); + + const udpateData = await prisma.portofolio.update({ + where: { + id: id, + }, + data: { + namaBisnis: data.namaBisnis, + alamatKantor: data.alamatKantor, + tlpn: data.tlpn, + deskripsi: data.deskripsi, + masterBidangBisnisId: data.masterBidangBisnisId, + }, + }); + + if (!udpateData) + return NextResponse.json( + { + success: false, + message: "Gagal update data", + }, + { status: 400 } + ); + + return NextResponse.json( + { + success: true, + message: "Berhasil mendapatkan data", + data: udpateData, + }, + + { status: 200 } + ); + } catch (error) { + return NextResponse.json( + { + success: false, + message: "Error update data", + reason: (error as Error).message, + }, + { status: 500 } + ); + } +} async function POST(request: Request, { params }: { params: { id: string } }) { if (request.method !== "POST") { diff --git a/src/app/dev/portofolio/edit/data/[id]/page.tsx b/src/app/dev/portofolio/edit/data/[id]/page.tsx index 6d23121d..625d8ee4 100644 --- a/src/app/dev/portofolio/edit/data/[id]/page.tsx +++ b/src/app/dev/portofolio/edit/data/[id]/page.tsx @@ -1,24 +1,9 @@ import { Portofolio_EditDataBisnis } from "@/app_modules/katalog/portofolio"; -import { portofolio_getOneById } from "@/app_modules/katalog/portofolio/fun/get/get_one_portofolio"; -import { Portofolio_getMasterBidangBisnis } from "@/app_modules/katalog/portofolio/fun/master/get_bidang_bisnis"; -import _ from "lodash"; - -export default async function Page({ params }: { params: { id: string } }) { - let portoId = params.id; - const data = await portofolio_getOneById(portoId); - const dataPorto = _.omit(data, [ - "Logo", - "Portofolio_MediaSosial", - "Portofolio_MediaSosial", - "logoId", - "profileId", - ]); - - const listBidang = await Portofolio_getMasterBidangBisnis() +export default async function Page() { return ( <> - + ); } diff --git a/src/app/dev/portofolio/edit/logo/[id]/page.tsx b/src/app/dev/portofolio/edit/logo/[id]/page.tsx index 11d25a47..ef22c078 100644 --- a/src/app/dev/portofolio/edit/logo/[id]/page.tsx +++ b/src/app/dev/portofolio/edit/logo/[id]/page.tsx @@ -2,26 +2,11 @@ import { Portofolio_EditLogoBisnis } from "@/app_modules/katalog/portofolio"; import { portofolio_getOneById } from "@/app_modules/katalog/portofolio/fun/get/get_one_portofolio"; import _ from "lodash"; -export default async function Page({ params }: { params: { id: string } }) { - let portoId = params.id; - const dataPorto = await portofolio_getOneById(portoId).then((res) => - _.omit(res, [ - "Logo", - "MasterBidangBisnis", - "Portofolio_MediaSosial", - "active", - "alamatKantor", - "deskripsi", - "masterBidangBisnisId", - "profileId", - "tlpn", - "namaBisnis" - ]) - ); +export default async function Page() { return ( <> - + ); } diff --git a/src/app/zCoba/skeleton/page.tsx b/src/app/zCoba/skeleton/page.tsx index a5b62d10..83058314 100644 --- a/src/app/zCoba/skeleton/page.tsx +++ b/src/app/zCoba/skeleton/page.tsx @@ -5,6 +5,7 @@ import { UIGlobal_LayoutHeaderTamplate, UIGlobal_LayoutTamplate, } from "@/app_modules/_global/ui"; +import CustomSkeleton from "@/app_modules/components/CustomSkeleton"; import { Button, Grid, Skeleton, Stack } from "@mantine/core"; import Link from "next/link"; @@ -14,100 +15,12 @@ export default function Voting_ComponentSkeletonViewPuh() { } > - - - - - - - - {Array.from(new Array(2)).map((e, i) => ( - - - - - - - - - ))} - - - - {/* - - - - - - - - - -
- -
- - - - - - - - - - - - - - - - - - - - - - - -
-
*/} - - {/* - -
- -
- - - - - - - - - - - -
-
*/} + + {Array.from({ length: 4 }).map((_, i) => ( + + ))} + +
diff --git a/src/app_modules/katalog/portofolio/component/api_fetch_portofolio.ts b/src/app_modules/katalog/portofolio/component/api_fetch_portofolio.ts index 14f8f677..699249c9 100644 --- a/src/app_modules/katalog/portofolio/component/api_fetch_portofolio.ts +++ b/src/app_modules/katalog/portofolio/component/api_fetch_portofolio.ts @@ -1,8 +1,12 @@ -export { - apiCreatePortofolio, -}; +export { apiCreatePortofolio, apiGetPortofolioById, apiUpdatePortofolioById }; -const apiCreatePortofolio = async ({ profileId, data }: { profileId: string, data: any }) => { +const apiCreatePortofolio = async ({ + profileId, + data, +}: { + profileId: string; + data: any; +}) => { const { token } = await fetch("/api/get-cookie").then((res) => res.json()); if (!token) return await token.json().catch(() => null); @@ -19,3 +23,49 @@ const apiCreatePortofolio = async ({ profileId, data }: { profileId: string, dat return await res.json().catch(() => null); }; + +const apiGetPortofolioById = async ({ id }: { id: string }) => { + const { token } = await fetch("/api/get-cookie").then((res) => res.json()); + if (!token) return await token.json().catch(() => null); + + const res = await fetch(`/api/portofolio/${id}`, { + method: "GET", + headers: { + "Content-Type": "application/json", + Accept: "application/json", + "Access-Control-Allow-Origin": "*", + Authorization: `Bearer ${token}`, + }, + }); + + return await res.json().catch(() => null); +}; + +const apiUpdatePortofolioById = async ({ + id, + data, +}: { + id: string; + data: any; +}) => { + const { token } = await fetch("/api/get-cookie").then((res) => res.json()); + if (!token) return await token.json().catch(() => null); + + const respone = await fetch(`/api/portofolio/${id}`, { + method: "PUT", + body: JSON.stringify({ data }), + headers: { + "Content-Type": "application/json", + Accept: "application/json", + "Access-Control-Allow-Origin": "*", + Authorization: `Bearer ${token}`, + }, + }); + + if (!respone.ok) { + console.error("Failed to send logs:", respone.statusText); + return null; + } + + return await respone.json(); +}; diff --git a/src/app_modules/katalog/portofolio/component/button/comp_button_edit_logo_bisnis.tsx b/src/app_modules/katalog/portofolio/component/button/comp_button_edit_logo_bisnis.tsx index 387d4742..2864f981 100644 --- a/src/app_modules/katalog/portofolio/component/button/comp_button_edit_logo_bisnis.tsx +++ b/src/app_modules/katalog/portofolio/component/button/comp_button_edit_logo_bisnis.tsx @@ -76,8 +76,6 @@ export function ComponentPortofolio_ButtonEditLogoBisnis({ return ( <> + + {Array.from({ length: 4 }).map((_, i) => ( + + ))} + + + + + ); } -function Portofolio_SkeletonListPorto() { - - +function Portofolio_SkeletonEditLogoBisnis() { + return ( + <> + + + + + ); } \ No newline at end of file diff --git a/src/app_modules/katalog/portofolio/create/view.tsx b/src/app_modules/katalog/portofolio/create/view.tsx index 244dadf4..2b622d15 100644 --- a/src/app_modules/katalog/portofolio/create/view.tsx +++ b/src/app_modules/katalog/portofolio/create/view.tsx @@ -184,12 +184,13 @@ export default function CreatePortofolio() { backgroundColor: MainColor.login, }, }} - inputStyle={{ width: "100%", backgroundColor: MainColor.login }} + inputStyle={{ width: "100%", backgroundColor: MainColor.white }} defaultCountry="id" onChange={(val) => { const valPhone = val.substring(1); setDataPortofolio({ ...dataPortofolio, + tlpn: valPhone, }); }} diff --git a/src/app_modules/katalog/portofolio/edit/data/ui_edit_data.tsx b/src/app_modules/katalog/portofolio/edit/data/ui_edit_data.tsx index 887bab2e..d8c6261e 100644 --- a/src/app_modules/katalog/portofolio/edit/data/ui_edit_data.tsx +++ b/src/app_modules/katalog/portofolio/edit/data/ui_edit_data.tsx @@ -1,66 +1,179 @@ "use client"; -import { - MainColor -} from "@/app_modules/_global/color/color_pallet"; +import { MainColor } from "@/app_modules/_global/color/color_pallet"; import ComponentGlobal_ErrorInput from "@/app_modules/_global/component/error_input"; import ComponentGlobal_InputCountDown from "@/app_modules/_global/component/input_countdown"; +import { apiGetMasterBidangBisnis } from "@/app_modules/_global/lib/api_master"; +import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/_global/notif_global"; import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/_global/notif_global/notifikasi_berhasil"; import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/_global/notif_global/notifikasi_gagal"; -import { Button, Select, Stack, TextInput, Textarea } from "@mantine/core"; +import { clientLogger } from "@/util/clientLogger"; +import { + Button, + Select, + Stack, + Text, + TextInput, + Textarea, +} from "@mantine/core"; +import { useShallowEffect } from "@mantine/hooks"; import _ from "lodash"; -import { AppRouterInstance } from "next/dist/shared/lib/app-router-context.shared-runtime"; -import { useRouter } from "next/navigation"; +import { useParams, useRouter } from "next/navigation"; import { useState } from "react"; -import { Portofolio_funEditDataBisnis } from "../../fun/edit/fun_edit_data_bisnis_by_id"; +import { PhoneInput } from "react-international-phone"; +import { + apiGetPortofolioById, + apiUpdatePortofolioById, +} from "../../component/api_fetch_portofolio"; +import { Portofolio_SkeletonEditDataBisnis } from "../../component/skeleton_view"; import { MODEL_PORTOFOLIO, MODEL_PORTOFOLIO_BIDANG_BISNIS, } from "../../model/interface"; -export default function Portofolio_EditDataBisnis({ - dataPorto, - listBidang, -}: { - dataPorto: MODEL_PORTOFOLIO; - listBidang: MODEL_PORTOFOLIO_BIDANG_BISNIS[]; -}) { +interface IUpdatePortofoli { + namaBisnis: string; + alamatKantor: string; + tlpn: string; + deskripsi: string; + masterBidangBisnisId: string; +} + +export default function Portofolio_EditDataBisnis() { const router = useRouter(); - const [value, setValue] = useState(dataPorto); const [loading, setLoading] = useState(false); + const params = useParams<{ id: string }>(); + const portofolioId = params.id; + const [data, setData] = useState(null); + const [listBidang, setListBidang] = useState< + MODEL_PORTOFOLIO_BIDANG_BISNIS[] + >([]); + + useShallowEffect(() => { + onLoadBidang(); + onLoadData(); + }, []); + + const onLoadData = async () => { + try { + const respone = await apiGetPortofolioById({ + id: portofolioId, + }); + + if (respone.success) { + setData(respone.data); + } else { + setData(null); + } + } catch (error) { + clientLogger.error("Error get data portofolio", error); + } + }; + + const onLoadBidang = async () => { + try { + const respone = await apiGetMasterBidangBisnis(); + if (respone.success) { + setListBidang(respone.data); + } else { + setListBidang([]); + } + } catch (error) { + clientLogger.error("Error get data master bidang bisnis", error); + } + }; + + const validateData = async (data: any) => { + if (_.values(data).includes("")) { + // VALIDASI NOMOR TELEPON + return "Lengkapi data"; + } + + if (data?.tlpn.length < 8) { + return "Nomor telepon minimal 8 digit"; + } + }; + + const hanldeUpadteData = async (data: any) => { + try { + const newData: IUpdatePortofoli = { + namaBisnis: data?.namaBisnis, + alamatKantor: data?.alamatKantor, + tlpn: data?.tlpn, + deskripsi: data?.deskripsi, + masterBidangBisnisId: data?.MasterBidangBisnis.id, + }; + + const respone = await apiUpdatePortofolioById({ + data: newData, + id: portofolioId, + }); + + return respone; + } catch (error) { + console.error("Error update data portofolio", error); + return null; + } + }; + + const submitUpdate = async () => { + const validate = await validateData(data); + if (validate) { + ComponentGlobal_NotifikasiPeringatan(validate); + return; + } + + try { + setLoading(true); + const updateData = await hanldeUpadteData(data); + + if (updateData.success) { + ComponentGlobal_NotifikasiBerhasil(updateData.message); + router.back(); + } else { + setLoading(false); + ComponentGlobal_NotifikasiGagal(updateData.message); + } + } catch (error) { + setLoading(false); + clientLogger.error("Error update data portofolio", error); + } + }; + + if (!data) return ; + return ( <> - {/*
{JSON.stringify(porto, null, 2)}
*/} ) : ( "" ) } onChange={(val) => { - setValue({ - ...value, + setData({ + ...data, namaBisnis: val.target.value, }); }} @@ -68,17 +181,17 @@ export default function Portofolio_EditDataBisnis({