From ec49999f99653f9f8fdbc64ca34c882d4e2d1f2e Mon Sep 17 00:00:00 2001 From: Bagasbanuna02 Date: Tue, 4 Nov 2025 12:13:49 +0800 Subject: [PATCH] Integrasi API: Add: - hipmi-note.md Fix: - app/(application)/(user)/donation/[id]/(transaction-flow)/[invoiceId]/failed.tsx - app/(application)/(user)/donation/[id]/(transaction-flow)/[invoiceId]/success.tsx - app/(application)/(user)/event/[id]/confirmation.tsx - app/(application)/(user)/investment/(tabs)/index.tsx - app/(application)/(user)/investment/(tabs)/my-holding.tsx - app/(application)/(user)/investment/[id]/(my-holding)/[id].tsx - app/(application)/(user)/investment/[id]/(transaction-flow)/failed.tsx - app/(application)/(user)/investment/[id]/(transaction-flow)/index.tsx - app/(application)/(user)/investment/[id]/(transaction-flow)/success.tsx - app/(application)/(user)/investment/[id]/investor.tsx - app/(application)/admin/investment/[id]/[status]/index.tsx - app/(application)/admin/investment/[id]/[status]/transaction-detail.tsx - app/(application)/admin/investment/[id]/list-of-investor.tsx - lib/dummy-data/investment/dummy-data-not-publish.ts - screens/Authentication/VerificationView.tsx - screens/Home/bottomFeatureSection.tsx - service/api-client/api-investment.ts ### No Issue --- .../(transaction-flow)/[invoiceId]/failed.tsx | 75 +++++++---- .../[invoiceId]/success.tsx | 75 +++++++---- .../(user)/event/[id]/confirmation.tsx | 22 ++-- .../(user)/investment/(tabs)/index.tsx | 4 +- .../(user)/investment/(tabs)/my-holding.tsx | 116 +++++++++++++----- .../investment/[id]/(my-holding)/[id].tsx | 64 +++++++--- .../[id]/(transaction-flow)/failed.tsx | 96 ++++++++++----- .../[id]/(transaction-flow)/index.tsx | 8 +- .../[id]/(transaction-flow)/success.tsx | 91 +++++++++----- .../(user)/investment/[id]/investor.tsx | 58 ++++++++- .../admin/investment/[id]/[status]/index.tsx | 18 ++- .../[id]/[status]/transaction-detail.tsx | 33 +++-- .../investment/[id]/list-of-investor.tsx | 2 - hipmi-note.md | 9 ++ .../investment/dummy-data-not-publish.ts | 2 +- screens/Authentication/VerificationView.tsx | 47 +++++-- screens/Home/bottomFeatureSection.tsx | 62 ++++++---- service/api-client/api-investment.ts | 28 ++++- 18 files changed, 583 insertions(+), 227 deletions(-) create mode 100644 hipmi-note.md diff --git a/app/(application)/(user)/donation/[id]/(transaction-flow)/[invoiceId]/failed.tsx b/app/(application)/(user)/donation/[id]/(transaction-flow)/[invoiceId]/failed.tsx index f2c1d50..b715c52 100644 --- a/app/(application)/(user)/donation/[id]/(transaction-flow)/[invoiceId]/failed.tsx +++ b/app/(application)/(user)/donation/[id]/(transaction-flow)/[invoiceId]/failed.tsx @@ -1,3 +1,4 @@ +/* eslint-disable react-hooks/exhaustive-deps */ import { BaseBox, Grid, @@ -7,11 +8,60 @@ import { ViewWrapper, } from "@/components"; import { MainColor } from "@/constants/color-palet"; +import { apiDonationGetInvoiceById } from "@/service/api-client/api-donation"; import { GStyles } from "@/styles/global-styles"; +import { dateTimeView } from "@/utils/dateTimeView"; +import { formatCurrencyDisplay } from "@/utils/formatCurrencyDisplay"; import { FontAwesome6 } from "@expo/vector-icons"; -import dayjs from "dayjs"; +import { useFocusEffect, useLocalSearchParams } from "expo-router"; +import { useCallback, useState } from "react"; export default function DonasiFailed() { + const { id, invoiceId } = useLocalSearchParams(); + const [data, setData] = useState(null); + + useFocusEffect( + useCallback(() => { + onLoadData(); + }, [id, invoiceId]) + ); + + const onLoadData = async () => { + try { + const response = await apiDonationGetInvoiceById({ + id: invoiceId as string, + }); + + console.log("[DATA]", JSON.stringify(response.data, null, 2)); + setData(response.data); + } catch (error) { + console.log("[ERROR]", error); + } + }; + + const listData = [ + { + label: "Bank", + value: (data && data?.MasterBank?.namaBank) || "-", + }, + { + label: "Rekening Penerima", + value: (data && data?.MasterBank?.namaAkun) || "-", + }, + { + label: "No Rekening", + value: (data && data?.MasterBank?.norek) || "-", + }, + { + label: "Jumlah Donasi", + value: (data && formatCurrencyDisplay(data?.nominal)) || "-", + }, + { + label: "Tanggal", + value: (data && dateTimeView({ date: data?.createdAt })) || "-", + }, + ]; + return ( @@ -58,26 +108,3 @@ export default function DonasiFailed() { ); } - -const listData = [ - { - label: "Bank", - value: " BCA", - }, - { - label: "Rekening Penerima", - value: "Himpunan Pengusaha Muda Indonesia", - }, - { - label: "No Rekening", - value: "2304235678854332", - }, - { - label: "Jumlah Donasi", - value: "Rp. 750.000", - }, - { - label: "Tanggal", - value: `${dayjs(new Date()).format("DD/MM/YYYY")}`, - }, -]; diff --git a/app/(application)/(user)/donation/[id]/(transaction-flow)/[invoiceId]/success.tsx b/app/(application)/(user)/donation/[id]/(transaction-flow)/[invoiceId]/success.tsx index 41f7a9b..eb9f456 100644 --- a/app/(application)/(user)/donation/[id]/(transaction-flow)/[invoiceId]/success.tsx +++ b/app/(application)/(user)/donation/[id]/(transaction-flow)/[invoiceId]/success.tsx @@ -1,3 +1,4 @@ +/* eslint-disable react-hooks/exhaustive-deps */ import { BaseBox, Grid, @@ -7,11 +8,60 @@ import { ViewWrapper, } from "@/components"; import { MainColor } from "@/constants/color-palet"; +import { apiDonationGetInvoiceById } from "@/service/api-client/api-donation"; import { GStyles } from "@/styles/global-styles"; +import { dateTimeView } from "@/utils/dateTimeView"; +import { formatCurrencyDisplay } from "@/utils/formatCurrencyDisplay"; import { FontAwesome6 } from "@expo/vector-icons"; -import dayjs from "dayjs"; +import { useFocusEffect, useLocalSearchParams } from "expo-router"; +import { useCallback, useState } from "react"; export default function DonationSuccess() { + const { id, invoiceId } = useLocalSearchParams(); + const [data, setData] = useState(null); + + useFocusEffect( + useCallback(() => { + onLoadData(); + }, [id, invoiceId]) + ); + + const onLoadData = async () => { + try { + const response = await apiDonationGetInvoiceById({ + id: invoiceId as string, + }); + + console.log("[DATA]", JSON.stringify(response.data, null, 2)); + setData(response.data); + } catch (error) { + console.log("[ERROR]", error); + } + }; + + const listData = [ + { + label: "Bank", + value: (data && data?.MasterBank?.namaBank) || "-", + }, + { + label: "Rekening Penerima", + value: (data && data?.MasterBank?.namaAkun) || "-", + }, + { + label: "No Rekening", + value: (data && data?.MasterBank?.norek) || "-", + }, + { + label: "Jumlah Donasi", + value: (data && formatCurrencyDisplay(data?.nominal)) || "-", + }, + { + label: "Tanggal", + value: (data && dateTimeView({ date: data?.createdAt })) || "-", + }, + ]; + return ( @@ -59,25 +109,4 @@ export default function DonationSuccess() { ); } -const listData = [ - { - label: "Bank", - value: " BCA", - }, - { - label: "Rekening Penerima", - value: "Himpunan Pengusaha Muda Indonesia", - }, - { - label: "No Rekening", - value: "2304235678854332", - }, - { - label: "Jumlah Donasi", - value: "Rp. 750.000", - }, - { - label: "Tanggal", - value: `${dayjs(new Date()).format("DD/MM/YYYY")}`, - }, -]; + diff --git a/app/(application)/(user)/event/[id]/confirmation.tsx b/app/(application)/(user)/event/[id]/confirmation.tsx index fb73251..7151fbf 100644 --- a/app/(application)/(user)/event/[id]/confirmation.tsx +++ b/app/(application)/(user)/event/[id]/confirmation.tsx @@ -261,17 +261,17 @@ export default function UserEventConfirmation() { ( - - router.navigate("/(application)/(user)/event/create") - } - /> - ), - }} + // headerLeft: () => ( + // + // router.navigate("/(application)/(user)/event/create") + // } + // /> + // ), + }} /> {handlerReturn()} diff --git a/app/(application)/(user)/investment/(tabs)/index.tsx b/app/(application)/(user)/investment/(tabs)/index.tsx index 0df5a60..328fae0 100644 --- a/app/(application)/(user)/investment/(tabs)/index.tsx +++ b/app/(application)/(user)/investment/(tabs)/index.tsx @@ -23,7 +23,9 @@ export default function InvestmentBursa() { const onLoadList = async () => { try { setLoadingList(true); - const response = await apiInvestmentGetAll(); + const response = await apiInvestmentGetAll({ + category: "bursa" + }); // console.log("[DATA LIST]", JSON.stringify(response.data, null, 2)); setList(response.data); } catch (error) { diff --git a/app/(application)/(user)/investment/(tabs)/my-holding.tsx b/app/(application)/(user)/investment/(tabs)/my-holding.tsx index ccdb619..cef61cd 100644 --- a/app/(application)/(user)/investment/(tabs)/my-holding.tsx +++ b/app/(application)/(user)/investment/(tabs)/my-holding.tsx @@ -1,50 +1,102 @@ +/* eslint-disable react-hooks/exhaustive-deps */ import { BaseBox, Grid, + LoaderCustom, ProgressCustom, Spacing, StackCustom, TextCustom, ViewWrapper, } from "@/components"; -import { router } from "expo-router"; +import NoDataText from "@/components/_ShareComponent/NoDataText"; +import { useAuth } from "@/hooks/use-auth"; +import { + apiInvestmentGetAll +} from "@/service/api-client/api-investment"; +import { formatCurrencyDisplay } from "@/utils/formatCurrencyDisplay"; +import { router, useFocusEffect } from "expo-router"; +import _ from "lodash"; +import React, { useCallback, useState } from "react"; import { View } from "react-native"; export default function InvestmentMyHolding() { + const { user } = useAuth(); + const [list, setList] = useState(null); + const [loadingList, setLoadingList] = useState(false); + + useFocusEffect( + useCallback(() => { + onLoadList(); + }, [user?.id]) + ); + + const onLoadList = async () => { + try { + setLoadingList(true); + const response = await apiInvestmentGetAll({ + category: "my-holding", + authorId: user?.id, + }); + console.log("[DATA LIST]", JSON.stringify(response.data, null, 2)); + setList(response.data); + } catch (error) { + console.log("[ERROR]", error); + } finally { + setLoadingList(false); + } + }; + return ( - {Array.from({ length: 10 }).map((_, index) => ( - router.push(`/investment/${index}/(my-holding)/holding-${index}`)}> - - - - - Title here : Lorem ipsum dolor sit amet consectetur - adipisicing elit. Omnis, exercitationem, sequi enim quod - distinctio maiores laudantium amet, quidem atque repellat sit - vitae qui aliquam est veritatis laborum eum voluptatum totam! - + {loadingList ? ( + + ) : _.isEmpty(list) ? ( + + ) : ( + list?.map((item, index) => ( + + router.push(`/investment/${item?.id}/(my-holding)/${item?.id}`) + } + > + + + + {item?.title} - - Rp. 7.500.000 - 300 Lembar - - - - - - - - - - - ))} + + + Rp. {formatCurrencyDisplay(item?.nominal)} + + + {item?.lembarTerbeli} Lembar + + + + + + + + + + + + )) + )} ); } diff --git a/app/(application)/(user)/investment/[id]/(my-holding)/[id].tsx b/app/(application)/(user)/investment/[id]/(my-holding)/[id].tsx index ae0dc73..95a6fc0 100644 --- a/app/(application)/(user)/investment/[id]/(my-holding)/[id].tsx +++ b/app/(application)/(user)/investment/[id]/(my-holding)/[id].tsx @@ -1,29 +1,56 @@ +/* eslint-disable react-hooks/exhaustive-deps */ import { - BackButton, - BaseBox, - DotButton, - DrawerCustom, - Grid, - MenuDrawerDynamicGrid, - StackCustom, - TextCustom, - ViewWrapper, + BackButton, + BaseBox, + DotButton, + DrawerCustom, + Grid, + MenuDrawerDynamicGrid, + StackCustom, + TextCustom, + ViewWrapper, } from "@/components"; import { IconDocument, IconEdit, IconNews } from "@/components/_Icon"; import { IMenuDrawerItem } from "@/components/_Interface/types"; import { MainColor } from "@/constants/color-palet"; import { ICON_SIZE_MEDIUM } from "@/constants/constans-value"; +import { useAuth } from "@/hooks/use-auth"; import Invesment_ComponentBoxOnBottomDetail from "@/screens/Invesment/ComponentBoxOnBottomDetail"; import Invesment_DetailDataPublishSection from "@/screens/Invesment/DetailDataPublishSection"; +import { apiInvestmentGetInvoice } from "@/service/api-client/api-investment"; +import { formatCurrencyDisplay } from "@/utils/formatCurrencyDisplay"; import { AntDesign, MaterialIcons } from "@expo/vector-icons"; -import { router, Stack, useLocalSearchParams } from "expo-router"; +import { router, Stack, useFocusEffect, useLocalSearchParams } from "expo-router"; import _ from "lodash"; -import { useState } from "react"; +import { useCallback, useState } from "react"; export default function InvestmentDetailHolding() { + const { user } = useAuth(); const { id, status } = useLocalSearchParams(); const [openDrawerDraft, setOpenDrawerDraft] = useState(false); const [openDrawerPublish, setOpenDrawerPublish] = useState(false); + const [data, setData] = useState(null); + + useFocusEffect( + useCallback(() => { + onLoadData(); + }, [id, status]) + ); + + const onLoadData = async () => { + try { + const response = await apiInvestmentGetInvoice({ + id: id as string, + authorId: user?.id, + category: "invoice", + }); + + console.log("[DATA]", JSON.stringify(response.data, null, 2)); + setData(response.data); + } catch (error) { + console.log("[ERROR]", error); + } + }; const handlePressDraft = (item: IMenuDrawerItem) => { console.log("PATH >> ", item.path); @@ -39,7 +66,8 @@ export default function InvestmentDetailHolding() { const bottomSection = ( ); @@ -64,10 +92,12 @@ export default function InvestmentDetailHolding() { - Nila Transaksi + Nilai Transaksi - Rp. 7.500.000 + + Rp. {data ? formatCurrencyDisplay(data?.nominal) : ""} + @@ -75,12 +105,16 @@ export default function InvestmentDetailHolding() { Saham Terbeli - 300 Lembar + + {data ? data?.lembarTerbeli : ""} Lembar + + diff --git a/app/(application)/(user)/investment/[id]/(transaction-flow)/failed.tsx b/app/(application)/(user)/investment/[id]/(transaction-flow)/failed.tsx index 9b10578..b1e1d29 100644 --- a/app/(application)/(user)/investment/[id]/(transaction-flow)/failed.tsx +++ b/app/(application)/(user)/investment/[id]/(transaction-flow)/failed.tsx @@ -1,9 +1,73 @@ -import { BaseBox, Grid, Spacing, StackCustom, TextCustom, ViewWrapper } from "@/components"; +/* eslint-disable react-hooks/exhaustive-deps */ +import { + BaseBox, + Grid, + Spacing, + StackCustom, + TextCustom, + ViewWrapper, +} from "@/components"; import { MainColor } from "@/constants/color-palet"; +import { apiInvestmentGetInvoice } from "@/service/api-client/api-investment"; import { GStyles } from "@/styles/global-styles"; +import { dateTimeView } from "@/utils/dateTimeView"; +import { formatCurrencyDisplay } from "@/utils/formatCurrencyDisplay"; import { FontAwesome6 } from "@expo/vector-icons"; +import { useLocalSearchParams, useFocusEffect } from "expo-router"; +import React from "react"; export default function InvestmentFailed() { + const { id } = useLocalSearchParams(); + console.log("[ID]", id); + + const [data, setData] = React.useState(null); + + useFocusEffect( + React.useCallback(() => { + onLoadData(); + }, [id]) + ); + const onLoadData = async () => { + try { + const response = await apiInvestmentGetInvoice({ + id: id as string, + category: "invoice", + }); + + console.log("[RES INVOICE]", JSON.stringify(response.data, null, 2)); + setData(response.data); + } catch (error) { + console.log("[ERROR]", error); + } + }; + + const listData = [ + { + label: "Bank", + value: (data && data?.MasterBank?.namaBank) || "-", + }, + { + label: "Rekening Penerima", + value: (data && data?.MasterBank?.namaAkun) || "-", + }, + { + label: "No Rekening", + value: (data && data?.MasterBank?.norek) || "-", + }, + { + label: "Jumlah", + value: `Rp ${data && formatCurrencyDisplay(data?.nominal)}` || "-", + }, + { + label: "Tanggal", + value: (data && dateTimeView({ date: data?.createdAt })) || "-", + }, + { + label: "Lembar Terbeli", + value: (data && formatCurrencyDisplay(data?.lembarTerbeli)) || "-", + }, + ]; + return ( @@ -11,8 +75,7 @@ export default function InvestmentFailed() { Transaksi anda gagal karena bukti transfer tidak sesuai dengan - data kami. Jika ini masalah khusus silahkan hubungi pada kontak - whatsapp kami. + data kami. Hubungi admin untuk memperbaiki masalah ini. ); } - -const listData = [ - { - label: "Bank", - value: " BCA", - }, - { - label: "Rekening Penerima", - value: "Himpunan Pengusaha Muda Indonesia", - }, - { - label: "No Rekening", - value: "2304235678854332", - }, - { - label: "Jumlah", - value: "Rp. 1.000.000", - }, - { - label: "Tanggal", - value: "2022-01-01", - }, - { - label: "Lembar Terbeli", - value: "100", - }, -]; diff --git a/app/(application)/(user)/investment/[id]/(transaction-flow)/index.tsx b/app/(application)/(user)/investment/[id]/(transaction-flow)/index.tsx index a3f2494..ca205b0 100644 --- a/app/(application)/(user)/investment/[id]/(transaction-flow)/index.tsx +++ b/app/(application)/(user)/investment/[id]/(transaction-flow)/index.tsx @@ -108,7 +108,9 @@ export default function InvestmentInvest() { Sisa Lembar Saham - {data?.sisaLembar || "-"} + + {data && formatCurrencyDisplay(data?.sisaLembar) || "-"} + @@ -116,7 +118,9 @@ export default function InvestmentInvest() { Harga Per Lembar - {data?.hargaLembar || "-"} + + {data && formatCurrencyDisplay(data?.hargaLembar) || "-"} + diff --git a/app/(application)/(user)/investment/[id]/(transaction-flow)/success.tsx b/app/(application)/(user)/investment/[id]/(transaction-flow)/success.tsx index a087ecb..d8778c7 100644 --- a/app/(application)/(user)/investment/[id]/(transaction-flow)/success.tsx +++ b/app/(application)/(user)/investment/[id]/(transaction-flow)/success.tsx @@ -1,3 +1,4 @@ +/* eslint-disable react-hooks/exhaustive-deps */ import { BaseBox, Grid, @@ -7,10 +8,66 @@ import { ViewWrapper, } from "@/components"; import { MainColor } from "@/constants/color-palet"; +import { apiInvestmentGetInvoice } from "@/service/api-client/api-investment"; import { GStyles } from "@/styles/global-styles"; +import { dateTimeView } from "@/utils/dateTimeView"; +import { formatCurrencyDisplay } from "@/utils/formatCurrencyDisplay"; import { FontAwesome6 } from "@expo/vector-icons"; +import { useFocusEffect, useLocalSearchParams } from "expo-router"; +import React from "react"; export default function InvestmentSuccess() { + const { id } = useLocalSearchParams(); + console.log("[ID]", id); + + const [data, setData] = React.useState(null); + + useFocusEffect( + React.useCallback(() => { + onLoadData(); + }, [id]) + ); + const onLoadData = async () => { + try { + const response = await apiInvestmentGetInvoice({ + id: id as string, + category: "invoice", + }); + + console.log("[RES INVOICE]", JSON.stringify(response.data, null, 2)); + setData(response.data); + } catch (error) { + console.log("[ERROR]", error); + } + }; + + const listData = [ + { + label: "Bank", + value: (data && data?.MasterBank?.namaBank) || "-", + }, + { + label: "Rekening Penerima", + value: (data && data?.MasterBank?.namaAkun) || "-", + }, + { + label: "No Rekening", + value: (data && data?.MasterBank?.norek) || "-", + }, + { + label: "Jumlah", + value: `Rp ${data && formatCurrencyDisplay(data?.nominal)}` || "-", + }, + { + label: "Tanggal", + value: (data && dateTimeView({ date: data?.createdAt })) || "-", + }, + { + label: "Lembar Terbeli", + value: (data && formatCurrencyDisplay(data?.lembarTerbeli)) || "-", + }, + ]; + return ( @@ -35,8 +92,7 @@ export default function InvestmentSuccess() { Detail Transaksi - - + {listData.map((item, i) => ( @@ -45,7 +101,9 @@ export default function InvestmentSuccess() { {item.label} - {item.value} + + {item.value} + ))} @@ -55,30 +113,3 @@ export default function InvestmentSuccess() { ); } - -const listData = [ - { - label: "Bank", - value: " BCA", - }, - { - label: "Rekening Penerima", - value: "Himpunan Pengusaha Muda Indonesia", - }, - { - label: "No Rekening", - value: "2304235678854332", - }, - { - label: "Jumlah", - value: "Rp. 1.000.000", - }, - { - label: "Tanggal", - value: "2022-01-01", - }, - { - label: "Lembar Terbeli", - value: "100", - }, -]; diff --git a/app/(application)/(user)/investment/[id]/investor.tsx b/app/(application)/(user)/investment/[id]/investor.tsx index 703d954..a64abb3 100644 --- a/app/(application)/(user)/investment/[id]/investor.tsx +++ b/app/(application)/(user)/investment/[id]/investor.tsx @@ -1,20 +1,66 @@ +/* eslint-disable react-hooks/exhaustive-deps */ import { AvatarUsernameAndOtherComponent, BoxWithHeaderSection, + LoaderCustom, TextCustom, ViewWrapper, } from "@/components"; +import NoDataText from "@/components/_ShareComponent/NoDataText"; +import { apiInvestmentGetInvestorById } from "@/service/api-client/api-investment"; +import { formatCurrencyDisplay } from "@/utils/formatCurrencyDisplay"; +import { useFocusEffect, useLocalSearchParams } from "expo-router"; +import _ from "lodash"; +import { useCallback, useState } from "react"; export default function InvestmentInvestor() { + const { id } = useLocalSearchParams(); + const [list, setList] = useState(null); + const [loadingList, setLoadingList] = useState(false); + + useFocusEffect( + useCallback(() => { + onLoadList(); + }, [id]) + ); + + const onLoadList = async () => { + try { + setLoadingList(true); + const response = await apiInvestmentGetInvestorById({ + id: id as string, + }) + console.log("[DATA LIST]", JSON.stringify(response.data, null, 2)); + setList(response.data); + } catch (error) { + console.log("[ERROR]", error); + } finally { + setLoadingList(false); + } + } + + return ( <> - {Array.from({ length: 10 }).map((_, index) => ( - - - Rp. 7.000.000 - - ))} + {loadingList ? ( + + ) : _.isEmpty(list) ? ( + + ) : ( + list?.map((item: any, index: number) => ( + + + + Rp. {formatCurrencyDisplay(item?.nominal)} + + + )) + )} ); diff --git a/app/(application)/admin/investment/[id]/[status]/index.tsx b/app/(application)/admin/investment/[id]/[status]/index.tsx index ec60080..f265b28 100644 --- a/app/(application)/admin/investment/[id]/[status]/index.tsx +++ b/app/(application)/admin/investment/[id]/[status]/index.tsx @@ -50,7 +50,7 @@ export default function AdminInvestmentDetail() { const onLoadData = async () => { try { const response = await apiAdminInvestmentDetailById({ id: id as string }); - console.log("[GETONE INVEST]", JSON.stringify(response, null, 2)); + // console.log("[GETONE INVEST]", JSON.stringify(response, null, 2)); if (response.success) { setData(response.data); } @@ -176,18 +176,28 @@ export default function AdminInvestmentDetail() { > {status === "publish" && ( - + Sisa Saham} value={ - {data && formatCurrencyDisplay(data?.sisaLembar)} lembar + + {data && formatCurrencyDisplay(data && data?.sisaLembar)} lembar + } /> Validasi Transaksi} - value={{data && formatCurrencyDisplay(data?.lembarTerbeli)} Transaksi} + value={ + + {data && data?.Investasi_Invoice.length} Proses + + } /> diff --git a/app/(application)/admin/investment/[id]/[status]/transaction-detail.tsx b/app/(application)/admin/investment/[id]/[status]/transaction-detail.tsx index 4248b33..f8cb183 100644 --- a/app/(application)/admin/investment/[id]/[status]/transaction-detail.tsx +++ b/app/(application)/admin/investment/[id]/[status]/transaction-detail.tsx @@ -1,12 +1,13 @@ /* eslint-disable react-hooks/exhaustive-deps */ import { + AlertDefaultSystem, BadgeCustom, BaseBox, ButtonCustom, Spacing, StackCustom, TextCustom, - ViewWrapper + ViewWrapper, } from "@/components"; import AdminBackButtonAntTitle from "@/components/_ShareComponent/Admin/BackButtonAntTitle"; import { GridDetail_4_8 } from "@/components/_ShareComponent/GridDetail_4_8"; @@ -25,8 +26,6 @@ import Toast from "react-native-toast-message"; export default function AdminInvestmentTransactionDetail() { const { id } = useLocalSearchParams(); - console.log("[ID]", id); - const [data, setData] = useState(null); const [isLoading, setLoading] = useState(false); @@ -41,7 +40,7 @@ export default function AdminInvestmentTransactionDetail() { const response = await apiAdminInvestmentGetOneInvoiceById({ id: id as string, }); - console.log("[RESPONSE]", JSON.stringify(response, null, 2)); + // console.log("[RESPONSE]", JSON.stringify(response, null, 2)); if (response.success) { setData(response.data); } @@ -121,7 +120,7 @@ export default function AdminInvestmentTransactionDetail() { }, }); - console.log("[RESPONSE SUBMIT]", JSON.stringify(response, null, 2)); + // console.log("[RESPONSE SUBMIT]", JSON.stringify(response, null, 2)); if (!response.success) { Toast.show({ @@ -158,8 +157,16 @@ export default function AdminInvestmentTransactionDetail() { backgroundColor={MainColor.red} textColor="white" onPress={() => { - handlerSubmit({ - category: "deny", + AlertDefaultSystem({ + title: "Konfirmasi transaksi", + message: "Apakah anda yakin ingin menolak transaksi ini?", + textLeft: "Tidak", + textRight: "Ya", + onPressRight: () => { + handlerSubmit({ + category: "deny", + }); + }, }); }} > @@ -170,8 +177,16 @@ export default function AdminInvestmentTransactionDetail() { { - handlerSubmit({ - category: "accept", + AlertDefaultSystem({ + title: "Konfirmasi transaksi", + message: "Apakah anda yakin ingin menyetujui transaksi ini?", + textLeft: "Tidak", + textRight: "Ya", + onPressRight: () => { + handlerSubmit({ + category: "accept", + }); + }, }); }} > diff --git a/app/(application)/admin/investment/[id]/list-of-investor.tsx b/app/(application)/admin/investment/[id]/list-of-investor.tsx index bcd8ce5..9d5bbb8 100644 --- a/app/(application)/admin/investment/[id]/list-of-investor.tsx +++ b/app/(application)/admin/investment/[id]/list-of-investor.tsx @@ -13,9 +13,7 @@ import { IconView } from "@/components/_Icon/IconComponent"; import AdminBackButtonAntTitle from "@/components/_ShareComponent/Admin/BackButtonAntTitle"; import { GridViewCustomSpan } from "@/components/_ShareComponent/GridViewCustomSpan"; import NoDataText from "@/components/_ShareComponent/NoDataText"; -import { MainColor } from "@/constants/color-palet"; import { ICON_SIZE_BUTTON } from "@/constants/constans-value"; -import { dummyMasterStatusTransaction } from "@/lib/dummy-data/_master/status-transaction"; import { apiAdminInvestmentListOfInvestor } from "@/service/api-admin/api-admin-investment"; import { apiMasterTransaction } from "@/service/api-client/api-master"; import { colorBadgeTransaction } from "@/utils/colorBadge"; diff --git a/hipmi-note.md b/hipmi-note.md new file mode 100644 index 0000000..2f8df08 --- /dev/null +++ b/hipmi-note.md @@ -0,0 +1,9 @@ +eas build --profile production : for build production on expo with eas + +npx expo prebuild : untuk build dan membuat folder android & ios + +open ios/.xcworkspace : untuk membuka file xcode +Build ios : bun run ios +Build android : bun run android +Exp: open ios/HIPMIBADUNG.xcworkspace + diff --git a/lib/dummy-data/investment/dummy-data-not-publish.ts b/lib/dummy-data/investment/dummy-data-not-publish.ts index b5a5b6c..d8e8476 100644 --- a/lib/dummy-data/investment/dummy-data-not-publish.ts +++ b/lib/dummy-data/investment/dummy-data-not-publish.ts @@ -36,7 +36,7 @@ const listDataNotPublishInvesment = ({ data }: { data: any }) => [ const listDataPublishInvesment = ({ data }: { data: any }) => [ { label: "Investor", - value: data?.investor, + value: data?.Investasi_Invoice.length || "-", }, { label: "Target Dana", diff --git a/screens/Authentication/VerificationView.tsx b/screens/Authentication/VerificationView.tsx index f531a7a..13e20e2 100644 --- a/screens/Authentication/VerificationView.tsx +++ b/screens/Authentication/VerificationView.tsx @@ -10,6 +10,7 @@ import { router, useLocalSearchParams } from "expo-router"; import { useEffect, useState } from "react"; import { Text, View } from "react-native"; import { OtpInput } from "react-native-otp-entry"; +import { ActivityIndicator } from "react-native-paper"; import Toast from "react-native-toast-message"; export default function VerificationView() { @@ -18,22 +19,41 @@ export default function VerificationView() { const [codeOtp, setCodeOtp] = useState(""); const [inputOtp, setInputOtp] = useState(""); const [userNumber, setUserNumber] = useState(""); + const [loading, setLoading] = useState(false); + const [recodeOtp, setRecodeOtp] = useState(false); // --- Context --- - const { validateOtp, isLoading } = useAuth(); + const { validateOtp, isLoading, loginWithNomor } = useAuth(); useEffect(() => { onLoadCheckCodeOtp(); - }, []); + }, [recodeOtp]); async function onLoadCheckCodeOtp() { + setRecodeOtp(false); const kodeId = await AsyncStorage.getItem("kode_otp"); const response = await apiCheckCodeOtp({ kodeId: kodeId as string }); - console.log("Response check code otp >>", JSON.stringify(response.otp, null, 2)); + console.log( + "Response check code otp >>", + JSON.stringify(response.otp, null, 2) + ); setCodeOtp(response.otp); setUserNumber(response.nomor); } + const handlerResendOtp = async () => { + try { + setLoading(true); + await loginWithNomor(nomor as string); + setRecodeOtp(true); + } catch (error) { + console.log("Error check code otp", error); + } finally { + setLoading(false); + } + }; + + const handleVerification = async () => { const codeOtpNumber = parseInt(codeOtp); const inputOtpNumber = parseInt(inputOtp); @@ -109,17 +129,28 @@ export default function VerificationView() { onTextChange={(otp: string) => setInputOtp(otp)} /> - - Tidak menerima kode ?{" "} - Kirim Ulang - + + Tidak menerima kode ? + {loading ? ( + + ) : ( + { + handlerResendOtp(); + }} + > + Kirim Ulang + + )} + handleVerification()} diff --git a/screens/Home/bottomFeatureSection.tsx b/screens/Home/bottomFeatureSection.tsx index a924795..b952055 100644 --- a/screens/Home/bottomFeatureSection.tsx +++ b/screens/Home/bottomFeatureSection.tsx @@ -1,12 +1,35 @@ import { ClickableCustom, TextCustom } from "@/components"; import Spacing from "@/components/_ShareComponent/Spacing"; -import React from "react"; +import React, { useCallback, useState } from "react"; import { View } from "react-native"; import Icon from "react-native-vector-icons/FontAwesome"; import { stylesHome } from "./homeViewStyle"; -import { router } from "expo-router"; +import { router, useFocusEffect } from "expo-router"; +import { apiJobGetAll } from "@/service/api-client/api-job"; export default function Home_BottomFeatureSection() { + const [listData, setListData] = useState([]); + + const onLoadData = async () => { + try { + const response = await apiJobGetAll({ + category: "beranda", + }); + + // console.log("[DATA JOB]", JSON.stringify(response.data, null, 2)); + const result = response.data.slice(-2); + setListData(result); + } catch (error) { + console.log("[ERROR]", error); + } + }; + + useFocusEffect( + useCallback(() => { + onLoadData(); + }, []) + ); + return ( <> router.push("/job")}> @@ -21,32 +44,17 @@ export default function Home_BottomFeatureSection() { {/* Vacancy Item 1 */} - - {/* */} - - - Bagas_banuna - - - - Dicari perawat kucing dan perawat anjing - + {listData.map((item: any, index: number) => ( + + + + {item.title} + + + {item.deskripsi} + - - - {/* Vacancy Item 2 */} - - {/* */} - - - fibramarcell - - - - Di Butuhkan Seorang Programer dan Designer - - - + ))} diff --git a/service/api-client/api-investment.ts b/service/api-client/api-investment.ts index edd856d..25e147f 100644 --- a/service/api-client/api-investment.ts +++ b/service/api-client/api-investment.ts @@ -128,9 +128,19 @@ export async function apiInvestmentDeleteDocument({ id }: { id: string }) { } } -export async function apiInvestmentGetAll() { +export async function apiInvestmentGetAll({ + category, + authorId, +}: { + category: "my-holding" | "bursa"; + authorId?: string; +}) { try { - const response = await apiConfig.get(`/mobile/investment`); + const response = await apiConfig.get( + `/mobile/investment?category=${category}${ + authorId ? `&authorId=${authorId}` : "" + }` + ); return response.data; } catch (error) { throw error; @@ -241,3 +251,17 @@ export async function apiInvestmentDeleteNews({ id }: { id: string }) { throw error; } } + +export async function apiInvestmentGetInvestorById({ + id, +}: { + id: string; +}) { + try { + const response = await apiConfig.get(`/mobile/investment/${id}/investor`); + return response.data; + } catch (error) { + throw error; + } +} + \ No newline at end of file