deposit table
This commit is contained in:
@@ -201,7 +201,7 @@ const DepositRequest = () => {
|
||||
</Text>
|
||||
),
|
||||
Action: (
|
||||
<Box display={"flex"} justifyContent={"space-around"} gap={2}>
|
||||
<Box display={"flex"} justifyContent={"center"} gap={2}>
|
||||
<Tooltip
|
||||
rounded={"sm"}
|
||||
fontSize={"xs"}
|
||||
@@ -263,6 +263,7 @@ const DepositRequest = () => {
|
||||
}, 100);
|
||||
setIsLoading(true);
|
||||
};
|
||||
|
||||
|
||||
return (
|
||||
<Box {...OPACITY_ON_LOAD} overflowY={"scroll"} height={"100vh"} pb={38}>
|
||||
@@ -294,7 +295,7 @@ const DepositRequest = () => {
|
||||
setPageSize={setPageSize}
|
||||
currentPage={currentPage}
|
||||
setCurrentPage={setCurrentPage}
|
||||
totalItems={depositRequest?.data?.totalItems}
|
||||
totalItems={data?.data?.totalItems}
|
||||
/>
|
||||
</HStack>
|
||||
</HStack>
|
||||
|
||||
@@ -1,131 +1,142 @@
|
||||
import {
|
||||
Box,
|
||||
Button,
|
||||
FormControl,
|
||||
FormLabel,
|
||||
Input,
|
||||
Modal,
|
||||
ModalBody,
|
||||
ModalCloseButton,
|
||||
ModalContent,
|
||||
ModalFooter,
|
||||
ModalHeader,
|
||||
ModalOverlay,
|
||||
Text,
|
||||
Textarea,
|
||||
useDisclosure,
|
||||
} from "@chakra-ui/react";
|
||||
import React from "react";
|
||||
import * as yup from "yup";
|
||||
import { yupResolver } from "@hookform/resolvers/yup";
|
||||
import { useForm } from "react-hook-form";
|
||||
|
||||
export const conformModalSchema = yup.object().shape({
|
||||
fees: yup.string().required("File name is required"),
|
||||
totalAmount: yup.string().required("File name is required"),
|
||||
Box,
|
||||
Button,
|
||||
FormControl,
|
||||
FormLabel,
|
||||
Input,
|
||||
Modal,
|
||||
ModalBody,
|
||||
ModalCloseButton,
|
||||
ModalContent,
|
||||
ModalFooter,
|
||||
ModalHeader,
|
||||
ModalOverlay,
|
||||
Text,
|
||||
Textarea,
|
||||
useDisclosure,
|
||||
} from "@chakra-ui/react";
|
||||
import React from "react";
|
||||
import * as yup from "yup";
|
||||
import { yupResolver } from "@hookform/resolvers/yup";
|
||||
import { useForm } from "react-hook-form";
|
||||
|
||||
export const conformModalSchema = yup.object().shape({
|
||||
fees: yup.string().required("File name is required"),
|
||||
totalAmount: yup.string().required("File name is required"),
|
||||
});
|
||||
|
||||
const DepositRequestApprove = ({ isOpen, onClose, firstField }) => {
|
||||
const {
|
||||
register,
|
||||
handleSubmit,
|
||||
formState: { errors },
|
||||
} = useForm({
|
||||
resolver: yupResolver(conformModalSchema),
|
||||
});
|
||||
|
||||
const DepositRequestApprove = ({ isOpen, onClose, firstField }) => {
|
||||
const {
|
||||
register,
|
||||
handleSubmit,
|
||||
formState: { errors },
|
||||
} = useForm({
|
||||
resolver: yupResolver(conformModalSchema),
|
||||
});
|
||||
|
||||
const onSubmit = (data) => {
|
||||
setFile(data.document[0]);
|
||||
|
||||
const newDocument = {
|
||||
...data,
|
||||
document: data.document[0].name, // Store the document name
|
||||
status: true,
|
||||
id: uuidv4(),
|
||||
createdAt: new Date().toISOString(),
|
||||
Type: getFileIcon(file.type),
|
||||
};
|
||||
|
||||
setCreate((prevCreate) => [...prevCreate, newDocument]);
|
||||
onClose();
|
||||
|
||||
const onSubmit = (data) => {
|
||||
setFile(data.document[0]);
|
||||
|
||||
const newDocument = {
|
||||
...data,
|
||||
document: data.document[0].name, // Store the document name
|
||||
status: true,
|
||||
id: uuidv4(),
|
||||
createdAt: new Date().toISOString(),
|
||||
Type: getFileIcon(file.type),
|
||||
};
|
||||
|
||||
const handleFileChange = (event) => {
|
||||
const selectedFile = event.target.files[0];
|
||||
setFile(selectedFile);
|
||||
};
|
||||
|
||||
return (
|
||||
<Modal isOpen={isOpen} onClose={onClose} initialFocusRef={firstField}>
|
||||
<ModalOverlay />
|
||||
<ModalContent pb={4}>
|
||||
<ModalHeader fontSize={"md"}>Confirm</ModalHeader>
|
||||
<ModalCloseButton />
|
||||
<Box as="form" onSubmit={handleSubmit(onSubmit)}>
|
||||
<ModalBody>
|
||||
<FormControl mb={4}>
|
||||
<FormLabel fontSize="sm">Deposit Amount (SAR)</FormLabel>
|
||||
<Input
|
||||
focusBorderColor='green.400'
|
||||
name="fileName"
|
||||
{...register("fileName")}
|
||||
fontSize="sm"
|
||||
type="text"
|
||||
size="sm"
|
||||
placeholder={"$100,000"}
|
||||
readOnly
|
||||
/>
|
||||
</FormControl>
|
||||
<FormControl mb={4}>
|
||||
<FormLabel fontSize="sm">Upload Supporting*</FormLabel>
|
||||
<Input
|
||||
focusBorderColor='green.400'
|
||||
name="fileName"
|
||||
{...register("fileName")}
|
||||
fontSize="sm"
|
||||
type="file"
|
||||
size="sm"
|
||||
placeholder={"$100,000"}
|
||||
className="form-control"
|
||||
/>
|
||||
{errors.fees && (
|
||||
<Text fontSize="xs" color="red">
|
||||
{errors.fees.message}
|
||||
</Text>
|
||||
)}
|
||||
</FormControl>
|
||||
<FormControl mb={4}>
|
||||
<FormLabel fontSize="sm">Comments</FormLabel>
|
||||
<Textarea rows={5}
|
||||
focusBorderColor='green.400'
|
||||
name="fileName"
|
||||
{...register("fileName")}
|
||||
fontSize="sm"
|
||||
type="textarea"
|
||||
size="sm"
|
||||
placeholder={"Enter your comments...."}
|
||||
resize={'none'}
|
||||
/>
|
||||
{errors.totalAmount && (
|
||||
<Text fontSize="xs" color="red">
|
||||
{errors.totalAmount.message}
|
||||
</Text>
|
||||
)}
|
||||
</FormControl>
|
||||
</ModalBody>
|
||||
<ModalFooter>
|
||||
<Button colorScheme="gray" mr={3} onClick={onClose} size={'sm'} rounded={'sm'}>
|
||||
Cancel
|
||||
</Button>
|
||||
<Button colorScheme="forestGreen" variant="solid" size={'sm'} rounded={'sm'}>
|
||||
Confirm
|
||||
</Button>
|
||||
</ModalFooter>
|
||||
</Box>
|
||||
</ModalContent>
|
||||
</Modal>
|
||||
);
|
||||
|
||||
setCreate((prevCreate) => [...prevCreate, newDocument]);
|
||||
onClose();
|
||||
};
|
||||
|
||||
export default DepositRequestApprove;
|
||||
|
||||
|
||||
const handleFileChange = (event) => {
|
||||
const selectedFile = event.target.files[0];
|
||||
setFile(selectedFile);
|
||||
};
|
||||
|
||||
return (
|
||||
<Modal isOpen={isOpen} onClose={onClose} initialFocusRef={firstField}>
|
||||
<ModalOverlay />
|
||||
<ModalContent pb={4}>
|
||||
<ModalHeader fontSize={"md"}>Confirm</ModalHeader>
|
||||
<ModalCloseButton />
|
||||
<Box as="form" onSubmit={handleSubmit(onSubmit)}>
|
||||
<ModalBody>
|
||||
<FormControl mb={4}>
|
||||
<FormLabel fontSize="sm">Deposit Amount (SAR)</FormLabel>
|
||||
<Input
|
||||
focusBorderColor="green.400"
|
||||
name="fileName"
|
||||
{...register("fileName")}
|
||||
fontSize="sm"
|
||||
type="text"
|
||||
size="sm"
|
||||
placeholder={"$100,000"}
|
||||
readOnly
|
||||
/>
|
||||
</FormControl>
|
||||
<FormControl mb={4}>
|
||||
<FormLabel fontSize="sm">Upload Supporting*</FormLabel>
|
||||
<Input
|
||||
focusBorderColor="green.400"
|
||||
name="fileName"
|
||||
{...register("fileName")}
|
||||
fontSize="sm"
|
||||
type="file"
|
||||
size="sm"
|
||||
placeholder={"$100,000"}
|
||||
className="form-control"
|
||||
/>
|
||||
{errors.fees && (
|
||||
<Text fontSize="xs" color="red">
|
||||
{errors.fees.message}
|
||||
</Text>
|
||||
)}
|
||||
</FormControl>
|
||||
<FormControl mb={4}>
|
||||
<FormLabel fontSize="sm">Comments</FormLabel>
|
||||
<Textarea
|
||||
rows={5}
|
||||
focusBorderColor="green.400"
|
||||
name="fileName"
|
||||
{...register("fileName")}
|
||||
fontSize="sm"
|
||||
type="textarea"
|
||||
size="sm"
|
||||
placeholder={"Enter your comments...."}
|
||||
resize={"none"}
|
||||
/>
|
||||
{errors.totalAmount && (
|
||||
<Text fontSize="xs" color="red">
|
||||
{errors.totalAmount.message}
|
||||
</Text>
|
||||
)}
|
||||
</FormControl>
|
||||
</ModalBody>
|
||||
<ModalFooter>
|
||||
<Button
|
||||
colorScheme="gray"
|
||||
mr={3}
|
||||
onClick={onClose}
|
||||
size={"sm"}
|
||||
rounded={"sm"}
|
||||
>
|
||||
Cancel
|
||||
</Button>
|
||||
<Button
|
||||
colorScheme="forestGreen"
|
||||
variant="solid"
|
||||
size={"sm"}
|
||||
rounded={"sm"}
|
||||
>
|
||||
Confirm
|
||||
</Button>
|
||||
</ModalFooter>
|
||||
</Box>
|
||||
</ModalContent>
|
||||
</Modal>
|
||||
);
|
||||
};
|
||||
|
||||
export default DepositRequestApprove;
|
||||
|
||||
@@ -121,73 +121,85 @@ const EditExchangeRate = ({ id, setIsLoading, updateHistory }) => {
|
||||
onClose={onClose}
|
||||
finalFocusRef={btnRef}
|
||||
>
|
||||
<form onSubmit={(e) =>{
|
||||
e.preventDefault()
|
||||
setAlert(true)}}>
|
||||
<DrawerOverlay />
|
||||
<DrawerContent>
|
||||
<DrawerCloseButton />
|
||||
<DrawerHeader fontSize={"md"}>Edit rate</DrawerHeader>
|
||||
<form
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
setAlert(true);
|
||||
}}
|
||||
>
|
||||
<DrawerOverlay />
|
||||
<DrawerContent>
|
||||
<DrawerCloseButton />
|
||||
<DrawerHeader fontSize={"md"}>Edit rate</DrawerHeader>
|
||||
|
||||
<DrawerBody>
|
||||
|
||||
<Box display={"flex"} mb={5}>
|
||||
<Box w={"50%"} display={"flex"} flexDirection={"column"} gap={1}>
|
||||
<FormLabel fontSize={"sm"}>From</FormLabel>
|
||||
<Text as={"span"} fontSize={"sm"} fontWeight={"bold"}>
|
||||
{foundObject?.fromCurrency?.currencyCode}
|
||||
</Text>
|
||||
<DrawerBody>
|
||||
<Box display={"flex"} mb={5}>
|
||||
<Box
|
||||
w={"50%"}
|
||||
display={"flex"}
|
||||
flexDirection={"column"}
|
||||
gap={1}
|
||||
>
|
||||
<FormLabel fontSize={"sm"}>From</FormLabel>
|
||||
<Text as={"span"} fontSize={"sm"} fontWeight={"bold"}>
|
||||
{foundObject?.fromCurrency?.currencyCode}
|
||||
</Text>
|
||||
</Box>
|
||||
<Box
|
||||
w={"50%"}
|
||||
display={"flex"}
|
||||
flexDirection={"column"}
|
||||
gap={1}
|
||||
>
|
||||
<FormLabel fontSize={"sm"}>To</FormLabel>
|
||||
<Text as={"span"} fontSize={"sm"} fontWeight={"bold"}>
|
||||
{foundObject?.toCurrency?.currencyCode}
|
||||
</Text>
|
||||
</Box>
|
||||
</Box>
|
||||
<Box w={"50%"} display={"flex"} flexDirection={"column"} gap={1}>
|
||||
<FormLabel fontSize={"sm"}>To</FormLabel>
|
||||
<Text as={"span"} fontSize={"sm"} fontWeight={"bold"}>
|
||||
{foundObject?.toCurrency?.currencyCode}
|
||||
|
||||
<FormControl mb={4}>
|
||||
<FormLabel fontSize={"sm"}>Effective from</FormLabel>
|
||||
<Text fontSize={"sm"}>
|
||||
{formatDate(foundObject?.effectiveFrom)}
|
||||
</Text>
|
||||
</Box>
|
||||
</Box>
|
||||
</FormControl>
|
||||
|
||||
<FormControl mb={4}>
|
||||
<FormLabel fontSize={"sm"}>Effective from</FormLabel>
|
||||
<Text fontSize={"sm"}>
|
||||
{formatDate(foundObject?.effectiveFrom)}
|
||||
</Text>
|
||||
</FormControl>
|
||||
<FormControl mb={4} isRequired>
|
||||
<FormLabel fontSize={"sm"}>Rate</FormLabel>
|
||||
<Input
|
||||
required
|
||||
type="number"
|
||||
placeholder="Type rate here..."
|
||||
size={"sm"}
|
||||
value={rate}
|
||||
onChange={(e) => setRate(e.target.value)}
|
||||
/>
|
||||
</FormControl>
|
||||
</DrawerBody>
|
||||
|
||||
<FormControl mb={4} isRequired>
|
||||
<FormLabel fontSize={"sm"}>Rate</FormLabel>
|
||||
<Input
|
||||
required
|
||||
type="number"
|
||||
placeholder="Type rate here..."
|
||||
<DrawerFooter>
|
||||
<Button
|
||||
variant="outline"
|
||||
colorScheme={"forestGreen"}
|
||||
rounded={"sm"}
|
||||
size={"sm"}
|
||||
value={rate}
|
||||
onChange={(e) => setRate(e.target.value)}
|
||||
/>
|
||||
</FormControl>
|
||||
</DrawerBody>
|
||||
mr={3}
|
||||
onClick={onClose}
|
||||
>
|
||||
Cancel
|
||||
</Button>
|
||||
|
||||
<DrawerFooter>
|
||||
<Button
|
||||
variant="outline"
|
||||
colorScheme={"forestGreen"}
|
||||
rounded={"sm"}
|
||||
size={"sm"}
|
||||
mr={3}
|
||||
onClick={onClose}
|
||||
>
|
||||
Cancel
|
||||
</Button>
|
||||
|
||||
<Button
|
||||
colorScheme={"forestGreen"}
|
||||
rounded={"sm"}
|
||||
size={"sm"}
|
||||
type="submit"
|
||||
>
|
||||
Save
|
||||
</Button>
|
||||
</DrawerFooter>
|
||||
</DrawerContent>
|
||||
<Button
|
||||
colorScheme={"forestGreen"}
|
||||
rounded={"sm"}
|
||||
size={"sm"}
|
||||
type="submit"
|
||||
>
|
||||
Save
|
||||
</Button>
|
||||
</DrawerFooter>
|
||||
</DrawerContent>
|
||||
</form>
|
||||
</Drawer>
|
||||
<CustomAlertDialog
|
||||
|
||||
@@ -155,7 +155,7 @@ const ExchangeRate = () => {
|
||||
</Text>
|
||||
),
|
||||
|
||||
Action: (
|
||||
Action: (
|
||||
// <Button colorScheme="forestGreen" size={"xs"} variant={"ghost"}>
|
||||
// Edit
|
||||
// </Button>
|
||||
|
||||
Reference in New Issue
Block a user