import { FormControl, FormLabel, Input, Textarea, Select, Checkbox, RadioGroup, Radio, Stack, Box, Heading, FormHelperText, Kbd, Image, Text, Table, Thead, Tr, Th, Tbody, Td, InputGroup, InputRightAddon, } from "@chakra-ui/react"; import { Controller } from "react-hook-form"; import { TiWarning } from "react-icons/ti"; import { motion } from "framer-motion"; import { AddIcon, CloseIcon } from "@chakra-ui/icons"; import CurrencyInput from "./CurrencyInput"; const today = new Date().toISOString().split("T")[0]; export const formatDatee = (dateString) => { const date = new Date(dateString); const year = date.getFullYear(); const month = String(date.getMonth() + 1).padStart(2, "0"); // Months are zero-based const day = String(date.getDate()).padStart(2, "0"); return `${year}-${month}-${day}`; }; const defaultDate = "8/2/2024"; // Format the default date as YYYY-MM-DD const formattedDate = formatDatee(defaultDate); const FormField = ({ label, control, name, id, type = "text", options = [], errors, isRequired, rules, arabic, placeHolder, helperText, multiple, handleImageChange, selectedImageData, setSelectedImageData, removeImage, imageData, width, value, handleInputChange, align, maxLength, dateValue, ...props }) => ( {label} { if (type === "select") { return ( ); } else if (type === "textarea") { return (