This commit is contained in:
2024-08-20 20:24:40 +05:30

View File

@@ -31,18 +31,13 @@ import { Controller, useForm } from "react-hook-form";
import * as yup from "yup";
import { yupResolver } from "@hookform/resolvers/yup";
export const investor = yup.object().shape({
amount: yup.string().required("Amount is required"),
});
const DistributionInvestor = ({ isOpen, onClose, }) => {
const params = useParams()
const id = params?.id
const DistributionInvestor = ({ isOpen, onClose }) => {
const params = useParams();
const id = params?.id;
// const {
// data:IObyID,
@@ -50,7 +45,7 @@ const DistributionInvestor = ({ isOpen, onClose, }) => {
// isLoading,
// } = useGetDistributionInvestorMutation(id);
const [ getDistributionInvestment ] = useGetDistributionInvestorMutation()
const [getDistributionInvestment] = useGetDistributionInvestorMutation();
const {
control,
@@ -65,19 +60,13 @@ const DistributionInvestor = ({ isOpen, onClose, }) => {
// try {
// const res = getDistributionInvestment({id,data})
// console.log(res);
// } catch (error) {
// }
// },[])
// console.log(IObyID);
// ====================================================[Table Setup]================================================================
const tableHeadRow = [
@@ -259,14 +248,11 @@ const DistributionInvestor = ({ isOpen, onClose, }) => {
);
};
const onSubmit = (data) => {
console.log(data);
};
const onSubmit = (data) =>{
console.log( data );
}
console.log(errors);
return (
<Modal size={"xl"} isOpen={isOpen} onClose={onClose}>
@@ -283,27 +269,36 @@ const DistributionInvestor = ({ isOpen, onClose, }) => {
<HStack onSubmit={handleSubmit(onSubmit)} as={"form"} mb={4}>
{/* <Input placeholder="$00.00" size={"sm"} className="col" /> */}
<FormControl isInvalid={errors.amount}>
<FormLabel fontSize={"sm"}> Amount to Distribute</FormLabel>
<FormLabel fontSize={"sm"}> Amount to Distribute</FormLabel>
<Box display={"flex"} alignItems={"center"}>
<Controller
name="amount"
control={control}
render={({ field }) => (
<Input {...field} fontSize={"sm"} type="number" size={"sm"} textAlign={"right"} />
<Input
{...field}
fontSize={"sm"}
type="number"
size={"sm"}
textAlign={"right"}
/>
)}
/>
<FormErrorMessage fontSize={"xs"} fontWeight={500}>
{errors.amount?.message}
</FormErrorMessage>
</FormControl>
<Button
// leftIcon={<AddIcon />}
size={"sm"}
rounded={"sm"}
colorScheme="forestGreen"
type="submit"
>
Calculate
</Button>
<Button
ml={3}
// leftIcon={<AddIcon />}
size={"sm"}
rounded={"sm"}
colorScheme="forestGreen"
type="submit"
>
Calculate
</Button>
</Box>
<FormErrorMessage fontSize={"xs"} fontWeight={500}>
{errors.amount?.message}
</FormErrorMessage>
</FormControl>
</HStack>
<DataTable