Admin Investment

Add:
- admin/investment/[id]
- admin/investment/[status]

Fix:
- delete: publish, reject, review

### No Issue
This commit is contained in:
2025-08-13 15:38:03 +08:00
parent 52c16b25b7
commit 40cb0bfc47
12 changed files with 594 additions and 42 deletions

View File

@@ -51,9 +51,6 @@ export default function AdminLayout() {
<Stack.Screen name="dashboard" />
{/* ================== Investment Start ================== */}
<Stack.Screen name="investment/index" />
<Stack.Screen name="investment/publish" />
<Stack.Screen name="investment/review" />
<Stack.Screen name="investment/reject" />
{/* ================== Investment End ================== */}
{/* ================== Maps Start ================== */}

View File

@@ -0,0 +1,244 @@
import {
ActionIcon,
AlertDefaultSystem,
BadgeCustom,
BaseBox,
ButtonCustom,
DrawerCustom,
DummyLandscapeImage,
MenuDrawerDynamicGrid,
ProgressCustom,
Spacing,
StackCustom,
TextCustom,
ViewWrapper
} from "@/components";
import { IconProspectus } from "@/components/_Icon";
import { IconDot, IconList } from "@/components/_Icon/IconComponent";
import AdminBackButtonAntTitle from "@/components/_ShareComponent/Admin/BackButtonAntTitle";
import AdminButtonReject from "@/components/_ShareComponent/Admin/ButtonReject";
import AdminButtonReview from "@/components/_ShareComponent/Admin/ButtonReview";
import { GridDetail_4_8 } from "@/components/_ShareComponent/GridDetail_4_8";
import { MainColor } from "@/constants/color-palet";
import { ICON_SIZE_BUTTON } from "@/constants/constans-value";
import { router, useLocalSearchParams } from "expo-router";
import _ from "lodash";
import React from "react";
export default function AdminInvestmentDetail() {
const { id, status } = useLocalSearchParams();
const [openDrawer, setOpenDrawer] = React.useState(false);
const colorBadge = () => {
if (status === "publish") {
return MainColor.green;
} else if (status === "review") {
return MainColor.orange;
} else if (status === "reject") {
return MainColor.red;
} else {
return MainColor.placeholder;
}
};
const listData = [
{
label: "Username",
value: `Bagas Banuna ${id}`,
},
{
label: "Judul",
value: `Donasi Lorem ipsum dolor sit amet, consectetur adipisicing elit.`,
},
{
label: "Status",
value: (
<BadgeCustom color={colorBadge()}>
{_.startCase(status as string)}
</BadgeCustom>
),
},
{
label: "Dana Dibutuhkan",
value: "Rp 10.000.000",
},
{
label: "Harga Perlembar",
value: "Rp 2500",
},
{
label: "Total Lembar",
value: "2490 lembar",
},
{
label: "ROI",
value: "4 %",
},
{
label: "Pembagian Deviden",
value: "3 bulan",
},
{
label: "Jadwal Pembagian",
value: "Selamanya",
},
{
label: "Pencarian Investor",
value: "30 Hari",
},
];
const rightComponent = (
<ActionIcon
icon={<IconDot size={ICON_SIZE_BUTTON} />}
onPress={() => {
setOpenDrawer(true);
}}
/>
);
return (
<>
<ViewWrapper
headerComponent={
<AdminBackButtonAntTitle
title={`Detail Data`}
rightComponent={status === "publish" && rightComponent}
/>
}
>
{status === "publish" && (
<BaseBox>
<ProgressCustom size="lg" />
<Spacing />
<StackCustom gap={"xs"}>
<GridDetail_4_8
label={<TextCustom bold>Sisa Saham</TextCustom>}
value={<TextCustom>2490 lembar</TextCustom>}
/>
<GridDetail_4_8
label={<TextCustom bold>Validasi Transaksi</TextCustom>}
value={<TextCustom>4 Transaksi</TextCustom>}
/>
</StackCustom>
</BaseBox>
)}
<BaseBox>
<StackCustom>
<DummyLandscapeImage />
{listData.map((item, i) => (
<GridDetail_4_8
key={i}
label={<TextCustom bold>{item.label}</TextCustom>}
value={<TextCustom>{item.value}</TextCustom>}
/>
))}
</StackCustom>
</BaseBox>
<BaseBox>
<StackCustom>
<GridDetail_4_8
label={<TextCustom bold>File Prospektus</TextCustom>}
value={
<ButtonCustom
iconLeft={
<IconProspectus
size={ICON_SIZE_BUTTON}
color={MainColor.darkblue}
/>
}
onPress={() => {
router.push(`/(application)/(file)/${id}`);
}}
>
Preview
</ButtonCustom>
}
/>
<GridDetail_4_8
label={<TextCustom bold>File Dokumen</TextCustom>}
value={
<StackCustom>
{Array.from({ length: 5 }).map((_, i) => (
<ButtonCustom
key={i}
iconLeft={
<IconProspectus
size={ICON_SIZE_BUTTON}
color={MainColor.darkblue}
/>
}
onPress={() => {
router.push(`/(application)/(file)/${id}`);
}}
>
Dokumen {i + 1}
</ButtonCustom>
))}
</StackCustom>
}
/>
</StackCustom>
</BaseBox>
{status === "review" && (
<AdminButtonReview
onPublish={() => {
AlertDefaultSystem({
title: "Publish",
message: "Apakah anda yakin ingin mempublikasikan data ini?",
textLeft: "Batal",
textRight: "Ya",
onPressLeft: () => {
router.back();
},
onPressRight: () => {
router.back();
},
});
}}
onReject={() => {
router.push(`/admin/investment/${id}/reject-input`);
}}
/>
)}
{status === "reject" && (
<AdminButtonReject
title="Tambah Catatan"
onReject={() => {
router.push(`/admin/investment/${id}/reject-input`);
}}
/>
)}
</ViewWrapper>
<DrawerCustom
isVisible={openDrawer}
closeDrawer={() => setOpenDrawer(false)}
height={"auto"}
>
<MenuDrawerDynamicGrid
data={[
{
label: "Daftar Investor",
icon: <IconList />,
path: `/admin/investment/${id}/list-of-investor`,
},
// {
// label: "Daftar Pencarian Dana",
// icon: <IconList />,
// path: `/admin/donation/${id}/list-disbursement-of-funds`,
// },
]}
onPressItem={(item) => {
setOpenDrawer(false);
router.push(item.path as any);
}}
/>
</DrawerCustom>
</>
);
}

View File

@@ -0,0 +1,80 @@
import {
BadgeCustom,
BaseBox,
BoxButtonOnFooter,
ButtonCustom,
StackCustom,
TextCustom,
ViewWrapper,
} from "@/components";
import AdminBackButtonAntTitle from "@/components/_ShareComponent/Admin/BackButtonAntTitle";
import { GridDetail_4_8 } from "@/components/_ShareComponent/GridDetail_4_8";
import { MainColor } from "@/constants/color-palet";
import dayjs from "dayjs";
import { router, useLocalSearchParams } from "expo-router";
export default function AdminInvestmentTransactionDetail() {
const { id } = useLocalSearchParams();
const buttonAction = (
<BoxButtonOnFooter>
<ButtonCustom onPress={() => router.back()}>Terima</ButtonCustom>
</BoxButtonOnFooter>
);
const listData = [
{
label: "Investor",
value: "Bagas Banuna",
},
{
label: "Bank",
value: "BCA",
},
{
label: "Jumlah Investasi",
value: "Rp. 1.000.000",
},
{
label: "Status",
value: <BadgeCustom color={MainColor.green}>Berhasil</BadgeCustom>,
},
{
label: "Tanggal",
value: dayjs().format("DD-MM-YYYY HH:mm:ss"),
},
{
label: "Bukti Transfer",
value: (
<ButtonCustom
onPress={() =>
router.push(`/(application)/(image)/preview-image/${id}`)
}
>
Cek
</ButtonCustom>
),
},
];
return (
<>
<ViewWrapper
headerComponent={<AdminBackButtonAntTitle title="Detail Transaksi Investor" />}
footerComponent={buttonAction}
>
<BaseBox>
<StackCustom>
{listData.map((item, index) => (
<GridDetail_4_8
key={index}
label={<TextCustom bold>{item.label}</TextCustom>}
value={<TextCustom>{item.value}</TextCustom>}
/>
))}
</StackCustom>
</BaseBox>
</ViewWrapper>
</>
);
}

View File

@@ -0,0 +1,107 @@
import {
ActionIcon,
BadgeCustom,
CenterCustom,
SelectCustom,
StackCustom,
TextCustom,
ViewWrapper,
} from "@/components";
import { IconView } from "@/components/_Icon/IconComponent";
import AdminBackButtonAntTitle from "@/components/_ShareComponent/Admin/BackButtonAntTitle";
import { GridViewCustomSpan } from "@/components/_ShareComponent/GridViewCustomSpan";
import { MainColor } from "@/constants/color-palet";
import { ICON_SIZE_BUTTON } from "@/constants/constans-value";
import { dummyMasterStatusTransaction } from "@/lib/dummy-data/_master/status-transaction";
import { router, useLocalSearchParams } from "expo-router";
import React from "react";
import { View } from "react-native";
import { Divider } from "react-native-paper";
export default function AdminInvestmentListOfInvestor() {
const { id } = useLocalSearchParams();
const searchComponent = (
<View style={{ flexDirection: "row", gap: 5 }}>
<SelectCustom
placeholder="Pilih status transaksi"
data={dummyMasterStatusTransaction}
onChange={(value) => console.log(value)}
styleContainer={{ width: "100%", marginBottom: 0 }}
/>
</View>
);
const headerComponent = (
<StackCustom gap={"xs"}>
<AdminBackButtonAntTitle title="Daftar Investor" />
{searchComponent}
</StackCustom>
);
return (
<>
<ViewWrapper
headerComponent={headerComponent}
>
<GridViewCustomSpan
span1={3}
span2={5}
span3={4}
component1={
<TextCustom bold align="center">
Aksi
</TextCustom>
}
component2={
<TextCustom bold align="center">
Investor
</TextCustom>
}
component3={
<TextCustom bold align="center">
Status
</TextCustom>
}
/>
<Divider />
<StackCustom>
{Array.from({ length: 10 }).map((_, index) => (
<View key={index}>
<GridViewCustomSpan
span1={3}
span2={5}
span3={4}
component1={
<CenterCustom>
<ActionIcon
icon={<IconView size={ICON_SIZE_BUTTON} color="black" />}
onPress={() => {
router.push(
`/admin/investment/${id}/berhasil/transaction-detail`
);
}}
/>
</CenterCustom>
}
component2={
<TextCustom bold align="center" truncate>
Bagas Banuna
</TextCustom>
}
component3={
<BadgeCustom
style={{ alignSelf: "center" }}
color={MainColor.green}
>
Berhasil
</BadgeCustom>
}
/>
<Divider />
</View>
))}
</StackCustom>
</ViewWrapper>
</>
);
}

View File

@@ -0,0 +1,55 @@
import {
AlertDefaultSystem,
BoxButtonOnFooter,
TextAreaCustom,
ViewWrapper,
} from "@/components";
import AdminBackButtonAntTitle from "@/components/_ShareComponent/Admin/BackButtonAntTitle";
import AdminButtonReject from "@/components/_ShareComponent/Admin/ButtonReject";
import { router, useLocalSearchParams } from "expo-router";
import { useState } from "react";
export default function AdminInvestmentRejectInput() {
const { id } = useLocalSearchParams();
const [value, setValue] = useState(id as string);
const buttonSubmit = (
<BoxButtonOnFooter>
<AdminButtonReject
title="Reject"
onReject={() =>
AlertDefaultSystem({
title: "Reject",
message: "Apakah anda yakin ingin menolak data ini?",
textLeft: "Batal",
textRight: "Ya",
onPressLeft: () => {
router.back();
},
onPressRight: () => {
console.log("value:", value);
router.replace(`/admin/investment/reject/status`);
},
})
}
/>
</BoxButtonOnFooter>
);
return (
<>
<ViewWrapper
footerComponent={buttonSubmit}
headerComponent={<AdminBackButtonAntTitle title="Penolakan Investasi" />}
>
<TextAreaCustom
value={value}
onChangeText={setValue}
placeholder="Masukan alasan"
required
showCount
maxLength={1000}
/>
</ViewWrapper>
</>
);
}

View File

@@ -0,0 +1,70 @@
import {
ActionIcon,
SearchInput,
Spacing,
TextCustom,
ViewWrapper
} from "@/components";
import AdminComp_BoxTitle from "@/components/_ShareComponent/Admin/BoxTitlePage";
import AdminTitleTable from "@/components/_ShareComponent/Admin/TableTitle";
import AdminTableValue from "@/components/_ShareComponent/Admin/TableValue";
import { ICON_SIZE_BUTTON } from "@/constants/constans-value";
import { Octicons } from "@expo/vector-icons";
import { router, useLocalSearchParams } from "expo-router";
import _ from "lodash";
import { Divider } from "react-native-paper";
export default function AdminInvestmentStatus() {
const { status } = useLocalSearchParams();
const rightComponent = (
<SearchInput
containerStyle={{ width: "100%", marginBottom: 0 }}
placeholder="Cari"
/>
);
return (
<>
<ViewWrapper
headerComponent={
<AdminComp_BoxTitle
title={`Investasi ${_.startCase(status as string)}`}
rightComponent={rightComponent}
/>
}
>
<AdminTitleTable
title1="Aksi"
title2="Username"
title3="Judul Investasi"
/>
<Spacing />
<Divider />
{Array.from({ length: 10 }).map((_, index) => (
<AdminTableValue
key={index}
value1={
<ActionIcon
icon={
<Octicons name="eye" size={ICON_SIZE_BUTTON} color="black" />
}
onPress={() => {
router.push(`/admin/investment/${index}/${status}`);
}}
/>
}
value2={<TextCustom truncate={1}>Username username</TextCustom>}
value3={
<TextCustom truncate={2}>
Lorem ipsum dolor sit amet consectetur adipisicing elit.
Blanditiis asperiores quidem deleniti architecto eaque et
nostrum, ad consequuntur eveniet quisquam quae voluptatum
ducimus! Dolorem nobis modi officia debitis, beatae mollitia.
</TextCustom>
}
/>
))}
</ViewWrapper>
</>
);
}

View File

@@ -1,11 +1,43 @@
import { TextCustom, ViewWrapper } from "@/components";
import { Spacing, StackCustom, ViewWrapper } from "@/components";
import {
IconPublish,
IconReject,
IconReview,
} from "@/components/_Icon/IconComponent";
import AdminComp_BoxDashboard from "@/components/_ShareComponent/Admin/BoxDashboard";
import AdminTitlePage from "@/components/_ShareComponent/Admin/TitlePage";
import { MainColor } from "@/constants/color-palet";
export default function AdminInvestment() {
return (
<>
<ViewWrapper>
<TextCustom>Admin Investment</TextCustom>
<AdminTitlePage title="Investasi" />
<Spacing />
<StackCustom gap={"xs"}>
{listData.map((item, i) => (
<AdminComp_BoxDashboard key={i} item={item} />
))}
</StackCustom>
</ViewWrapper>
</>
);
}
const listData = [
{
label: "Publish",
value: 3,
icon: <IconPublish size={25} color={MainColor.green} />,
},
{
label: "Review",
value: 5,
icon: <IconReview size={25} color={MainColor.orange} />,
},
{
label: "Reject",
value: 8,
icon: <IconReject size={25} color={MainColor.red} />,
},
];

View File

@@ -1,11 +0,0 @@
import { TextCustom, ViewWrapper } from "@/components";
export default function AdminInvestmentPublish() {
return (
<>
<ViewWrapper>
<TextCustom>Admin Investment Publish</TextCustom>
</ViewWrapper>
</>
);
}

View File

@@ -1,11 +0,0 @@
import { TextCustom, ViewWrapper } from "@/components";
export default function AdminInvestmentReject() {
return (
<>
<ViewWrapper>
<TextCustom>Admin Investment Reject</TextCustom>
</ViewWrapper>
</>
);
}

View File

@@ -1,11 +0,0 @@
import { TextCustom, ViewWrapper } from "@/components";
export default function AdminInvestmentReview() {
return (
<>
<ViewWrapper>
<TextCustom>Admin Investment Review</TextCustom>
</ViewWrapper>
</>
);
}

View File

@@ -13,9 +13,9 @@ const adminListMenu: NavbarItem[] = [
icon: "wallet",
links: [
{ label: "Dashboard", link: "/admin/investment" },
{ label: "Publish", link: "/admin/investment/publish" },
{ label: "Review", link: "/admin/investment/review" },
{ label: "Reject", link: "/admin/investment/reject" },
{ label: "Publish", link: "/admin/investment/publish/status" },
{ label: "Review", link: "/admin/investment/review/status" },
{ label: "Reject", link: "/admin/investment/reject/status" },
],
},
{

View File

@@ -84,7 +84,7 @@ export default function LoginView() {
<Spacing />
<ButtonCustom onPress={() => router.navigate("/admin/donation")}>
<ButtonCustom onPress={() => router.navigate("/admin/investment")}>
Admin ( Delete Soon )
</ButtonCustom>
</View>