Files
tanami-admin-panel/src/Pages/IO_Management/ViewIO/HeaderModal/DistributionInvestor.jsx

263 lines
6.2 KiB
React
Raw Normal View History

import {
Box,
Button,
2024-07-09 19:05:08 +05:30
FormControl,
FormLabel,
2024-07-15 12:27:23 +05:30
HStack,
Input,
Modal,
ModalBody,
ModalCloseButton,
ModalContent,
ModalFooter,
ModalHeader,
ModalOverlay,
2024-07-15 12:27:23 +05:30
Switch,
Table,
Tbody,
Text,
Textarea,
2024-07-15 12:27:23 +05:30
Th,
Tr,
} from "@chakra-ui/react";
2024-07-15 12:27:23 +05:30
import DataTable from "../../../../Components/DataTable/DataTable";
import { useState } from "react";
import { AddIcon } from "@chakra-ui/icons";
const DistributionInvestor = ({ isOpen, onClose }) => {
2024-07-15 12:27:23 +05:30
// ====================================================[Table Setup]================================================================
const tableHeadRow = [
"Sr No.",
"Client Id",
"First name",
"Last Name",
"Amount",
"%",
"($)",
];
const filteredData = [
{
id: 1,
},
{
id: 1,
},
{
id: 1,
},
{
id: 1,
2024-07-30 13:30:34 +05:30
},
];
2024-07-15 12:27:23 +05:30
const [extractedArray, setExtractedArray] = useState(
filteredData?.map((item, index) => ({
id: item?.id,
2024-07-30 13:30:34 +05:30
"Sr No.": (
<Box
w={9}
display={"flex"}
alignItems={"center"}
isTruncated={true}
h={25}
>
<Text as={"span"} color={"teal.900"} fontWeight={"500"}>
{index + 1}
</Text>
</Box>
),
2024-07-15 12:27:23 +05:30
"Client Id": (
<Box w={100} isTruncated={true}>
<Text as={"span"} color={"teal.900"} fontWeight={"500"}>
2024-07-30 13:30:34 +05:30
BH00000001
2024-07-15 12:27:23 +05:30
</Text>
</Box>
),
"First name": (
<Box minW={24} isTruncated={true}>
<Text as={"span"} color={"teal.900"} fontWeight={"500"}>
2024-07-30 13:30:34 +05:30
Faisal
2024-07-15 12:27:23 +05:30
</Text>
</Box>
),
"Last Name": (
<Box minW={24} isTruncated={true}>
2024-07-30 13:30:34 +05:30
<Text as={"span"} color={"teal.900"} fontWeight={"500"}>
Aljalahma
</Text>
2024-07-15 12:27:23 +05:30
</Box>
),
2024-07-30 13:30:34 +05:30
Amount: (
2024-07-15 12:27:23 +05:30
<Box minW={24} isTruncated={true}>
2024-07-30 13:30:34 +05:30
<Text as={"span"} color={"teal.900"} fontWeight={"500"}>
$100,000 /-
</Text>
2024-07-15 12:27:23 +05:30
</Box>
),
"%": (
<Box minW={19} isTruncated={true}>
2024-07-30 13:30:34 +05:30
<Text
textAlign={"right"}
as={"span"}
color={"teal.900"}
fontWeight={"500"}
>
26.0 %
</Text>
2024-07-15 12:27:23 +05:30
</Box>
),
"($)": (
<Box minW={24} isTruncated={true}>
2024-07-30 13:30:34 +05:30
<Text as={"span"} color={"teal.900"} fontWeight={"500"}>
$100,000 /-
</Text>
2024-07-15 12:27:23 +05:30
</Box>
),
}))
);
const Total = () => {
return (
<Table size="sm">
<Tbody backgroundColor="gray.50">
2024-07-30 13:30:34 +05:30
<Tr>
2024-07-15 12:27:23 +05:30
<Th
textAlign={"left"}
p={3}
width="90px"
color={"#004118"}
whiteSpace="normal"
wordBreak="normal"
overflowWrap="normal"
>
Total
</Th>
<Th
textAlign={"center"}
p={3}
width="110px"
color={"#004118"}
whiteSpace="normal"
wordBreak="normal"
overflowWrap="normal"
>
{" "}
</Th>
<Th
textAlign={"center"}
p={3}
width="110px"
color={"#004118"}
whiteSpace="normal"
wordBreak="normal"
overflowWrap="normal"
>
{" "}
</Th>
<Th
textAlign={"center"}
p={3}
width="110px"
color={"#004118"}
whiteSpace="normal"
wordBreak="normal"
overflowWrap="normal"
>
{" "}
</Th>
<Th
textAlign={"left"}
p={3}
width="110px"
color={"#004118"}
whiteSpace="normal"
wordBreak="normal"
overflowWrap="normal"
>
$100200
</Th>
<Th
textAlign={"left"}
p={3}
width="90px"
color={"#004118"}
whiteSpace="normal"
wordBreak="normal"
overflowWrap="normal"
>
2024-07-30 13:30:34 +05:30
100.0%
2024-07-15 12:27:23 +05:30
</Th>
<Th
textAlign={"center"}
p={3}
width="100px"
color={"#004118"}
whiteSpace="normal"
wordBreak="normal"
overflowWrap="normal"
>
$100230
</Th>
</Tr>
</Tbody>
</Table>
);
};
return (
2024-07-30 13:30:34 +05:30
<Modal size={"xl"} isOpen={isOpen} onClose={onClose}>
<ModalOverlay />
2024-07-30 13:30:34 +05:30
<ModalContent maxW={1000}>
<ModalHeader fontSize={"md"}>Distribution To Investor Transaction</ModalHeader>
<ModalCloseButton />
2024-07-30 13:30:34 +05:30
<ModalBody>
<Text as="label" mb='5px' fontSize='sm' fontWeight={500}>Amount to Distribute</Text>
<HStack mb={4}>
<Input placeholder="$00.00" size={"sm"} className="col" />
{/* <Input placeholder="$00.00" size={"sm"} className="col" /> */}
<Button
// leftIcon={<AddIcon />}
size={"sm"}
rounded={"sm"}
colorScheme="forestGreen"
>
Calculate
</Button>
</HStack>
2024-07-15 12:27:23 +05:30
2024-07-30 13:30:34 +05:30
<DataTable
emptyMessage={`We don't have any Sponers `}
tableHeadRow={tableHeadRow}
data={extractedArray}
setData={setExtractedArray}
caption={<Total />}
// isLoading={isLoading}
/>
</ModalBody>
2024-07-30 13:30:34 +05:30
<ModalFooter pt={0}>
<Button
bg={"hsla(139, 100%, 14%, 1)"}
mr={3}
color={"#fff"}
_hover={{
bg: "hsl(139deg 98.99% 26.59%)",
}}
2024-07-09 19:05:08 +05:30
size={'sm'}
rounded={"sm"}
>
Save
</Button>
2024-07-09 19:05:08 +05:30
<Button
size={'sm'}
rounded={"sm"} mr={3} onClick={onClose}>
Close
</Button>
2024-07-30 13:30:34 +05:30
</ModalFooter>
</ModalContent>
</Modal>
);
};
export default DistributionInvestor;