Bursa Investasi

# feat:
- Tampilan portofolio selesai
- Hapus investasi
- Function get data publish
### no issue
This commit is contained in:
2023-11-15 16:14:27 +08:00
parent 989c9eed32
commit e2e30c2af0
44 changed files with 910 additions and 414 deletions

View File

@@ -10,10 +10,12 @@ import {
Card,
CardSection,
Divider,
Flex,
Grid,
Group,
Image,
Paper,
Progress,
Slider,
Stack,
Text,
@@ -24,6 +26,8 @@ import dataDummy from "../dummy/data_dummy.json";
import moment from "moment";
import { IconCheck, IconCircleCheck } from "@tabler/icons-react";
import { MODEL_Investasi } from "../model/model_investasi";
import _ from "lodash";
import { useState } from "react";
export default function MainInvestasi({
listData,
@@ -31,17 +35,19 @@ export default function MainInvestasi({
periodeDeviden,
pembagianDeviden,
}: {
listData: MODEL_Investasi[]
listData: MODEL_Investasi[];
pencarianInvestor: MODEL_DEFAULT_MASTER[];
periodeDeviden: MODEL_DEFAULT_MASTER[];
pembagianDeviden: MODEL_DEFAULT_MASTER[];
}) {
const router = useRouter();
const [investasi, setInvestasi] = useState(listData);
return (
<>
{/* <pre>{JSON.stringify(listData, null, 2)}</pre> */}
{dataDummy.map((e) => (
{investasi.map((e) => (
<Card
key={e.id}
withBorder
@@ -58,17 +64,12 @@ export default function MainInvestasi({
</AspectRatio>
</CardSection>
{/* Progress dan titlr */}
<CardSection p={"lg"}>
<Box mb={"md"}>
<Stack >
<Title order={4}>{e.title}</Title>
<Slider
size={10}
disabled
labelAlwaysOn
value={e.persentase}
marks={[{ value: e.persentase, label: e.persentase + `%` }]}
/>
</Box>
<Progress label="0%" value={0} color="teal" size="xl" radius="xl" animate/>
</Stack>
</CardSection>
<CardSection p={"md"}>
<Box>
@@ -102,9 +103,9 @@ export default function MainInvestasi({
</CardSection>
<Divider />
<CardSection p={"md"}>
<Group position="apart" px={"sm"}>
<Flex gap={"xl"} align={"center"} justify={"center"}>
<Box>
{e.saham_beli === 0 ? (
{e.SahamTerbeli === null ? (
""
) : (
<Badge variant="dot" color="teal">
@@ -112,9 +113,10 @@ export default function MainInvestasi({
</Badge>
)}
</Box>
{(() => {
if (
e.masterPencarianInvestorId -
Number(e.MasterPencarianInvestor.name) -
moment(new Date()).diff(new Date(e.createdAt), "days") <=
0
) {
@@ -132,9 +134,9 @@ export default function MainInvestasi({
<Group position="right" spacing={"xs"}>
<Text>Sisa waktu:</Text>
<Text>
{e.masterPencarianInvestorId -
{Number(e.MasterPencarianInvestor.name) -
moment(new Date()).diff(
new Date(e.createdAt),
new Date(e.updatedAt),
"days"
)}
</Text>
@@ -144,7 +146,7 @@ export default function MainInvestasi({
);
}
})()}
</Group>
</Flex>
</CardSection>
</Card>
))}