update amount👍

This commit is contained in:
YasinShaikh123
2024-09-24 18:43:51 +05:30
parent 9dca99b1c1
commit 7f1ef99b6c
10 changed files with 245 additions and 167 deletions

43
package-lock.json generated
View File

@@ -28,6 +28,7 @@
"react-dom": "^18.2.0",
"react-hook-form": "^7.51.3",
"react-icons": "^5.1.0",
"react-phone-input-2": "^2.15.1",
"react-quill": "^0.0.2",
"react-redux": "^9.1.1",
"react-router-dom": "^6.22.3",
@@ -3255,6 +3256,11 @@
"pnpm": ">=8"
}
},
"node_modules/classnames": {
"version": "2.5.1",
"resolved": "https://registry.npmjs.org/classnames/-/classnames-2.5.1.tgz",
"integrity": "sha512-saHYOzhIQs6wy2sVxTM6bUDsQO4F50V9RQ22qBpEdCW+I+/Wmke2HOl6lS6dTpdxVhb88/I6+Hs+438c3lfUow=="
},
"node_modules/codepage": {
"version": "1.15.0",
"resolved": "https://registry.npmjs.org/codepage/-/codepage-1.15.0.tgz",
@@ -5232,6 +5238,16 @@
],
"license": "MIT"
},
"node_modules/lodash.debounce": {
"version": "4.0.8",
"resolved": "https://registry.npmjs.org/lodash.debounce/-/lodash.debounce-4.0.8.tgz",
"integrity": "sha512-FT1yDzDYEoYWhnSGnpE/4Kj1fLZkDFyqRb7fNt6FdYOSxlUWAtp42Eh6Wb0rGIv/m9Bgo7x4GhQbm5Ys4SG5ow=="
},
"node_modules/lodash.memoize": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz",
"integrity": "sha512-t7j+NzmgnQzTAYXcsHYLgimltOV1MXHtlOWf6GjL9Kj8GK5FInw5JotxvbOs+IvV1/Dzo04/fCGfLVs7aXb4Ag=="
},
"node_modules/lodash.merge": {
"version": "4.6.2",
"resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz",
@@ -5245,6 +5261,16 @@
"integrity": "sha512-GK3g5RPZWTRSeLSpgP8Xhra+pnjBC56q9FZYe1d5RN3TJ35dbkGy3YqBSMbyCrlbi+CM9Z3Jk5yTL7RCsqboyQ==",
"license": "MIT"
},
"node_modules/lodash.reduce": {
"version": "4.6.0",
"resolved": "https://registry.npmjs.org/lodash.reduce/-/lodash.reduce-4.6.0.tgz",
"integrity": "sha512-6raRe2vxCYBhpBu+B+TtNGUzah+hQjVdu3E17wfusjyrXBka2nBS8OH/gjVZ5PvHOhWmIZTYri09Z6n/QfnNMw=="
},
"node_modules/lodash.startswith": {
"version": "4.2.1",
"resolved": "https://registry.npmjs.org/lodash.startswith/-/lodash.startswith-4.2.1.tgz",
"integrity": "sha512-XClYR1h4/fJ7H+mmCKppbiBmljN/nGs73iq2SjCT9SF4CBPoUHzLvWmH1GtZMhMBZSiRkHXfeA2RY1eIlJ75ww=="
},
"node_modules/loose-envify": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz",
@@ -5875,6 +5901,23 @@
"integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==",
"license": "MIT"
},
"node_modules/react-phone-input-2": {
"version": "2.15.1",
"resolved": "https://registry.npmjs.org/react-phone-input-2/-/react-phone-input-2-2.15.1.tgz",
"integrity": "sha512-W03abwhXcwUoq+vUFvC6ch2+LJYMN8qSOiO889UH6S7SyMCQvox/LF3QWt+cZagZrRdi5z2ON3omnjoCUmlaYw==",
"dependencies": {
"classnames": "^2.2.6",
"lodash.debounce": "^4.0.8",
"lodash.memoize": "^4.1.2",
"lodash.reduce": "^4.6.0",
"lodash.startswith": "^4.2.1",
"prop-types": "^15.7.2"
},
"peerDependencies": {
"react": "^16.12.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^20.0.0 || ^21.0.0",
"react-dom": "^16.12.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^20.0.0 || ^21.0.0"
}
},
"node_modules/react-quill": {
"version": "0.0.2",
"resolved": "https://registry.npmjs.org/react-quill/-/react-quill-0.0.2.tgz",

View File

@@ -30,6 +30,7 @@
"react-dom": "^18.2.0",
"react-hook-form": "^7.51.3",
"react-icons": "^5.1.0",
"react-phone-input-2": "^2.15.1",
"react-quill": "^0.0.2",
"react-redux": "^9.1.1",
"react-router-dom": "^6.22.3",

View File

@@ -383,11 +383,11 @@ const DashboardLayout = ({ isOnline }) => {
No Internet !
</Alert>
<Box
{/* <Box
bottom={4}
right={!slideFromRight ? 4 : "auto"}
left={slideFromRight ? 4 : "auto"}
backgroundColor={"#fff"}
backgroundColor={"#000"}
rounded={"full"}
p={2}
w={8}
@@ -408,11 +408,11 @@ const DashboardLayout = ({ isOnline }) => {
zIndex={999}
>
<IoMdSwap />
</Box>
</Box> */}
{slideFromRight ? null : (
<aside
className="h-100 position-relative sideBar "
className="h-100 position-relative sideBar"
// onMouseOver={() => setIsDrawerOpen(true)}
// onMouseLeave={() => setIsDrawerOpen(false)}
style={{
@@ -687,9 +687,9 @@ const DashboardLayout = ({ isOnline }) => {
{/* =======[ Left ]============ */}
{slideFromRight ? (
{/* {slideFromRight ? (
<aside
className="h-100 position-relative sideBar pe-1"
className="h-100 position-relative sideBar pe-1 bg-black"
// onMouseOver={() => setIsDrawerOpen(true)}
// onMouseLeave={() => setIsDrawerOpen(false)}
style={{
@@ -916,7 +916,7 @@ const DashboardLayout = ({ isOnline }) => {
)}
</Button>
</aside>
) : null}
) : null} */}
</Box>
);
};

View File

@@ -103,15 +103,15 @@ const IODetails = ({ enableNextTab, index, data }) => {
const toast = useToast();
// const handleInputChange = (index, newValue) => {
const handleInputChangeCreate = (index, newValue) => {
// const updatedValues = [...values];
// updatedValues[index].value = newValue;
// setValues(updatedValues);
// console.log(values);
// };
const updatedValues = [...values];
updatedValues[index].value = newValue;
setValues(updatedValues);
console.log(values);
};
const handleInputChange = (index, newValue) => {
const handleInputChangeEdit = (index, newValue) => {
// Allow only whole numbers using regex
if (/^\d*$/.test(newValue)) {
const updatedValues = [...values];
@@ -476,10 +476,10 @@ const IODetails = ({ enableNextTab, index, data }) => {
name: "table",
type: "table",
section: " ",
width: "100%",
width: "100%",
isRequired: true,
options: investmentTypeOptions,
handleInputChange: handleInputChange,
handleInputChange:id ? handleInputChangeEdit : handleInputChangeCreate,
value: values,
},

View File

@@ -60,7 +60,6 @@ const IOArtifactsAdd = ({
const found = data?.find((item) => item?.id === actionId);
const fileInputRef = useRef(null);
const {
control,
handleSubmit,
@@ -82,7 +81,6 @@ const IOArtifactsAdd = ({
}
}, [found, reset]);
const onSubmit = async (data) => {
console.log("hit");
setIsLoading(true);
@@ -110,9 +108,11 @@ const IOArtifactsAdd = ({
artifactName: "",
artifactPathName: "",
});
} else{
} else {
toast({
render: () => <ToastBox message={"Something went wronng"} error="error" />,
render: () => (
<ToastBox message={"Something went wronng"} error="error" />
),
});
setFile(null);
setIsLoading(false);
@@ -123,7 +123,6 @@ const IOArtifactsAdd = ({
artifactName: "",
artifactPathName: "",
});
}
if (res?.error) {
@@ -171,8 +170,6 @@ const IOArtifactsAdd = ({
reader.readAsDataURL(file);
};
const handleSave = () => {
handleSubmit(onSubmit)();
};
@@ -189,22 +186,19 @@ const IOArtifactsAdd = ({
setActionId(false);
};
const handleRemove = () => {
setFile(null)
setPreview(null)
setFile(null);
setPreview(null);
// Reset the file input value
if (fileInputRef.current) {
fileInputRef.current.value = "";
}
}
const handleAlertClose = () =>{
setAlert(false)
setIsLoading(false)
}
};
const handleAlertClose = () => {
setAlert(false);
setIsLoading(false);
};
return (
<>
@@ -219,100 +213,133 @@ const IOArtifactsAdd = ({
<DrawerContent>
<DrawerCloseButton />
<DrawerHeader fontSize={"sm"}>IO Artifacts Image</DrawerHeader>
<Box as="form">
<DrawerBody>
<Stack spacing={4}>
<FormControl isInvalid={errors.artifactName}>
<FormLabel fontSize={"sm"}>Artifact Name</FormLabel>
<Controller
name="artifactName"
control={control}
render={({ field }) => (
<Input
{...field}
fontSize={"sm"}
type="text"
size={"sm"}
/>
)}
/>
<FormErrorMessage fontSize={"xs"} fontWeight={500}>
{errors.artifactName?.message}
</FormErrorMessage>
</FormControl>
<DrawerBody>
<Stack spacing={4}>
<FormControl isInvalid={errors.artifactName}>
<FormLabel fontSize={"sm"}>Artifact Name</FormLabel>
<Controller
name="artifactName"
control={control}
render={({ field }) => (
<Input {...field} fontSize={"sm"} type="text" size={"sm"} />
)}
/>
<FormErrorMessage fontSize={"xs"} fontWeight={500}>
{errors.artifactName?.message}
</FormErrorMessage>
</FormControl>
<FormControl
isInvalid={
!preview &&
errors.artifactPathName?.message &&
errors.artifactPathName
}
>
<FormLabel fontSize={"sm"}>Artifact Image</FormLabel>
<Input
type="file"
accept=".jpg,.jpeg,.png"
onChange={handleFileChange}
fontSize={"sm"}
size={"sm"}
className="form-control"
ref={fileInputRef} // Set the ref here
/>
<FormErrorMessage fontSize={"xs"} fontWeight={500}>
{!preview &&
<FormControl
isInvalid={
!preview &&
errors.artifactPathName?.message &&
errors.artifactPathName?.message}
</FormErrorMessage>
{preview && (
<>
errors.artifactPathName
}
>
<FormLabel fontSize={"sm"}>Artifact Image</FormLabel>
<Input
type="file"
accept=".jpg,.jpeg,.png"
onChange={handleFileChange}
fontSize={"sm"}
size={"sm"}
className="form-control"
ref={fileInputRef} // Set the ref here
/>
<FormErrorMessage fontSize={"xs"} fontWeight={500}>
{!preview &&
errors.artifactPathName?.message &&
errors.artifactPathName?.message}
</FormErrorMessage>
{preview && (
<>
<Image
rounded={"md"}
src={preview}
alt="Image Preview"
mt={3}
width={300}
height={150}
objectFit={"cover"}
backgroundSize={"cover"}
/>
<Box
w={"100%"}
position={"relative"}
mt={2}
fontSize={"xs"}
display={"flex"}
flexDirection={"column"}
as="span"
>
<Text as={"span"}>Name: {file?.name}</Text>
<Text as={"span"} fontSize={"xs"}>
File size: {bytesToMB(file?.size)}
</Text>
<Text as={"span"} fontSize={"xs"}>
Last update:{" "}
{formatTimestampInGulfTimezone(file?.lastModified)}
</Text>
<Icon
onClick={() => handleRemove()}
_hover={{ bg: "gray.100" }}
transition={"all 0-5s"}
cursor={"pointer"}
position={"absolute"}
right={0}
p={1}
bottom={0}
rounded={"lg"}
boxSize={7}
as={IoMdRemoveCircleOutline}
/>
</Box>
</>
)}
{found && !preview && (
<Image
rounded={"md"}
src={preview}
src={
import.meta.env.VITE_IMAGE_URL +
watch()?.artifactPathName
}
alt="Image Preview"
mt={3}
width={'100%'}
height={300}
objectFit={'cover'}
mt={2}
/>
<Box w={'100%'} position={'relative'} mt={2} fontSize={'xs'} display={'flex'} flexDirection={'column'} as="span">
<Text as={'span'}>Name: {file?.name}</Text>
<Text as={'span'} fontSize={'xs'}>File size: {bytesToMB(file?.size)}</Text>
<Text as={'span'} fontSize={'xs'}>Last update: {formatTimestampInGulfTimezone(file?.lastModified)}</Text>
<Icon onClick={() => handleRemove()} _hover={{ bg: "gray.100" }} transition={'all 0-5s'} cursor={'pointer'} position={'absolute'} right={0} p={1} bottom={0} rounded={'lg'} boxSize={7} as={IoMdRemoveCircleOutline} />
</Box>
</>
)}
{found && !preview && (
<Image
rounded={"md"}
src={
import.meta.env.VITE_IMAGE_URL +
watch()?.artifactPathName
}
alt="Image Preview"
mt={2}
/>
)}
</FormControl>
</Stack>
</DrawerBody>
)}
</FormControl>
</Stack>
</DrawerBody>
<DrawerFooter>
<Button
variant="outline"
colorScheme={"forestGreen"}
rounded={"sm"}
size={"sm"}
mr={3}
onClick={handleClose}
>
Cancel
</Button>
<DrawerFooter mt={5}>
<Button
variant="outline"
colorScheme={"forestGreen"}
rounded={"sm"}
size={"sm"}
mr={3}
onClick={handleClose}
>
Cancel
</Button>
<Button
colorScheme={"forestGreen"}
rounded={"sm"}
size={"sm"}
onClick={() => setAlert(true)}
>
Save
</Button>
</DrawerFooter>
<Button
colorScheme={"forestGreen"}
rounded={"sm"}
size={"sm"}
onClick={() => setAlert(true)}
// type="submit"
>
Save
</Button>
</DrawerFooter>
</Box>
</DrawerContent>
</Drawer>
<CustomAlertDialog

View File

@@ -30,6 +30,7 @@ import CustomAlertDialog from "../../Components/CustomAlertDialog";
const [alert, setAlert] = useState(false);
const {
reset,
control,
handleSubmit,
formState: { errors },
@@ -75,7 +76,7 @@ import CustomAlertDialog from "../../Components/CustomAlertDialog";
size={"sm"}
/>
</FormControl>
<FormControl mb={4}>
<FormControl mb={4}>
<FormLabel fontSize={"sm"}>Vimeo video link *</FormLabel>
<Input
value={file}

View File

@@ -126,7 +126,7 @@ const ViewIOTable = () => {
{/* {item.id} */}
{generateSerialNumber(idx, currentPage, pageSize)}
</Text>
),
),
"IO ID": (
<Box w={"auto"} isTruncated={true}>
<Text as={"span"} color={"teal.900"} fontWeight={"500"}>

View File

@@ -50,7 +50,6 @@ const ExchangeRate = () => {
const [mouseEntered, setMouseEntered] = useState(false);
const [mouseEnteredId, setMouseEnteredId] = useState("");
const { isOpen, onOpen, onClose } = useDisclosure();
// ===============================[ Paginations ]
@@ -65,6 +64,15 @@ const ExchangeRate = () => {
console.log(data?.data);
const filteredData = data?.data?.filter((item) => {
const name = item?.fromCurrency?.currencyCode;
const searchLower = searchTerm.toLowerCase();
const nameMatches = name.toLowerCase().includes(searchLower);
return nameMatches;
});
// ====================================================[Table Setup]================================================================
const tableHeadRow = [
"Sr.No",
@@ -75,7 +83,7 @@ const ExchangeRate = () => {
"Action",
];
const extractedArray = data?.data?.map((item, index) => ({
const extractedArray = filteredData?.map((item, index) => ({
"Sr.No": (
<Text
justifyContent={slideFromRight ? "right" : "left"}
@@ -137,34 +145,34 @@ const ExchangeRate = () => {
// Edit
// </Button>
<Box display={"flex"} justifyContent={"center"} gap={2}>
<Tooltip
rounded={"sm"}
fontSize={"xs"}
label="Edit"
bg="#fff"
color={"blue.500"}
placement="top"
>
<Button
ref={btnRef}
onClick={()=>{
setActionId(item?.id)
onOpen()
}}
// _hover={{ color: "blue.500" }}
// transition={"0.5s all"}
// color="blue.400"
colorScheme="blue"
size={"xs"}
// size={{base:'xs', lg:'sm'}}
<Tooltip
rounded={"sm"}
display={"flex"}
alignItems={"center"}
gap={1}
fontSize={"xs"}
label="Edit"
bg="#fff"
color={"blue.500"}
placement="top"
>
<EditIcon />
</Button>
</Tooltip>
<Button
ref={btnRef}
onClick={() => {
setActionId(item?.id);
onOpen();
}}
// _hover={{ color: "blue.500" }}
// transition={"0.5s all"}
// color="blue.400"
colorScheme="blue"
size={"xs"}
// size={{base:'xs', lg:'sm'}}
rounded={"sm"}
display={"flex"}
alignItems={"center"}
gap={1}
>
<EditIcon />
</Button>
</Tooltip>
<Tooltip
rounded={"sm"}
fontSize={"xs"}
@@ -235,8 +243,6 @@ const ExchangeRate = () => {
tableHeadRow={tableHeadRow}
data={extractedArray}
isLoading={isExchangeRateLoading}
// totalPages={10}
setMouseEnteredId={setMouseEnteredId}
setMouseEntered={setMouseEntered}
/>
@@ -249,18 +255,17 @@ const ExchangeRate = () => {
isLoading={isLoading}
/>
<EditExchangeRate
setIsLoading={setIsLoading}
id={actionId}
setId={setActionId}
onClose={onClose}
onOpen={onOpen}
isOpen={isOpen}
btnRef={btnRef}
// id={item.id}
// updateHistory={updateHistory}
/>
<EditExchangeRate
setIsLoading={setIsLoading}
id={actionId}
setId={setActionId}
onClose={onClose}
onOpen={onOpen}
isOpen={isOpen}
btnRef={btnRef}
// id={item.id}
// updateHistory={updateHistory}
/>
</Box>
);
};

View File

@@ -92,7 +92,7 @@ const InvestmentType = () => {
"Action",
];
const extractedArray = filteredData?.map((item, idx) => ({
const extractedArray = filteredData?.map((item, index) => ({
"Sr No": (
<Text
w={'24px'}
@@ -102,7 +102,7 @@ const InvestmentType = () => {
className="d-flex align-items-center fw-bold web-text-small"
>
{/* {item.id} */}
{generateSerialNumber(idx,currentPage, pageSize )}
{generateSerialNumber(index,currentPage, pageSize )}
</Text>),
"Investment Type": (
@@ -137,7 +137,7 @@ const InvestmentType = () => {
textOverflow="ellipsis"
cursor={"grab"}
>
{item.note}
{item.note ? item: "---"}
</Text>
</Tooltip>
),
@@ -145,6 +145,7 @@ const InvestmentType = () => {
<Box isTruncated={true}>
<Text as={"span"} fontWeight={"500"}>
<Badge
bg={index % 2 === 0 ? "#6311cb14" : "#fff"}
fontWeight={"500"}
textTransform={"none"}
color={item.isActive ? "green" : "red"}

View File

@@ -97,7 +97,7 @@ const Sponser = () => {
"Email Address": (
<Box isTruncated={true}>
<Text as={"span"} color={"teal.900"} fontWeight={"500"}>
{item.email}
{item.email ? item.email : "---" }
</Text>
</Box>
),