This commit is contained in:
YasinShaikh123
2024-08-13 13:47:29 +05:30
18 changed files with 160 additions and 75 deletions

View File

@@ -536,7 +536,7 @@ const FormField = ({
</span>
)}
{helperText && (
<FormHelperText className="web-text-small">{helperText}</FormHelperText>
<FormHelperText color={'gray.500'} className="web-text-small">{helperText}</FormHelperText>
)}
{type === "file" && (
<FormHelperText className="web-text-small">

View File

@@ -1,12 +1,18 @@
import React from "react";
import './FullscreenLoaders.css'
const Loader01 = () => {
return (
<div className="lds-ellipsis ">
<div></div>
<div></div>
<div></div>
<div></div>
<div className="dot-spinner">
<div className="dot-spinner__dot"></div>
<div className="dot-spinner__dot"></div>
<div className="dot-spinner__dot"></div>
<div className="dot-spinner__dot"></div>
<div className="dot-spinner__dot"></div>
<div className="dot-spinner__dot"></div>
<div className="dot-spinner__dot"></div>
<div className="dot-spinner__dot"></div>
</div>
);
};

View File

@@ -328,6 +328,7 @@ const DepositRequest = () => {
isLoading={isLoading}
/>
<DepositRequestApprove
data={data?.data?.rows}
isOpen={isConfirmOpen}
onClose={onConfirmClose}
id={actionId}

View File

@@ -35,11 +35,16 @@ export const conformModalSchema = yup.object().shape({
// }),
});
const DepositRequestApprove = ({ isOpen, onClose, firstField, id }) => {
const DepositRequestApprove = ({ isOpen, onClose, firstField, id, data:requestData }) => {
const toast = useToast()
const [file, setFile] = useState();
const [isBtnLoading , setIsBtnLoading] = useState(false)
const fileredData = requestData?.find((item)=> item?.id === id)
console.log(fileredData);
const [ updateDepositRequest ] = useUpdateDepositRequestMutation()
const {
@@ -51,6 +56,18 @@ const DepositRequestApprove = ({ isOpen, onClose, firstField, id }) => {
resolver: yupResolver(conformModalSchema),
});
useEffect(() => {
reset({
investorAmount:fileredData?.investorAmount
})
}, [requestData, id])
const onSubmit = async(data) => {
setIsBtnLoading(true)
const formData = new FormData();

View File

@@ -91,7 +91,9 @@ const CreateIO = () => {
height={"100vh"}
pb={10}
>
{id && <Box paddingInline={"12px"} mt={2}>
{id && <Box
ps={1}
pe={2} mt={2}>
{/* <span
onClick={() => navigate(-1)}
style={{ fontSize: "15px", cursor: "pointer" }}
@@ -104,6 +106,8 @@ const CreateIO = () => {
index={activeIndex}
onChange={(index) => setActiveIndex(index)}
mt={2}
ps={1}
pe={2}
>
<TabList>
{tabs?.map(({ label, isDisabled }, index) => (

View File

@@ -340,7 +340,9 @@ const IOArtifacts = ({ enableNextTab, index, data }) => {
Manage IO Images
</Box>
<HStack>
<SetDisplayOrder data={IObyID?.data?.artifactsImage} />
{IObyID?.data?.artifactsImage?.length !== 0 &&<SetDisplayOrder data={IObyID?.data?.artifactsImage} />}
<Button
leftIcon={<AddIcon />}
onClick={onOpen}
@@ -376,7 +378,7 @@ const IOArtifacts = ({ enableNextTab, index, data }) => {
Manage IO videos
</Box>
<HStack>
<SetDisplayOrder data={IObyID?.data?.artifactsImage} />
{IObyID?.data?.artifactsVideo?.length !== 0 &&<SetDisplayOrder data={IObyID?.data?.artifactsVideo} />}
<Button
leftIcon={<AddIcon />}
onClick={onOpenVideo}

View File

@@ -40,7 +40,7 @@ const schema = yup.object().shape({
.string()
.required("IO name in English is required")
.min(3, "IO name in English must be at least 3 characters long")
.max(50, "IO name in English must be at most 50 characters long"),
.max(150, "IO name in English must be at most 150 characters long"),
investmentNameArabic: yup
.string()
@@ -61,15 +61,13 @@ const schema = yup.object().shape({
.max(2000, "Description in Arabic must be at most 500 characters long"),
expectedReturnArabic: yup
.string()
.required("Expected return in Arabic is required")
.min(10, "Expected return in Arabic must be at least 10 characters long")
.max(2000, "Expected return in Arabic must be at most 500 characters long"),
.required("Expected return in Arabic is required"),
goalAmount: yup
.number()
.required("Goal amount is required")
.positive("Goal amount must be a positive number")
.min(1, "Goal amount must be at least 1"),
goalAmount: yup
.number()
.typeError("Goal Amount is must be number")
.required('Goal amount is required')
.positive('Goal amount must be a positive number'),
closingDate: yup
.date()
@@ -189,6 +187,7 @@ const IODetails = ({ enableNextTab, index, data }) => {
const {
control,
reset,
watch,
setValue,
handleSubmit,
formState: { errors },
@@ -239,6 +238,8 @@ const IODetails = ({ enableNextTab, index, data }) => {
isRequired: true,
section: " ",
width: "49%",
maxLength:150,
helperText:`Maximum length should be 150 characters. You have entered ${watch()?.investmentNameEnglish?.length || 0} characters.`
},
{
label: "IO Name (Arabic)",
@@ -249,6 +250,8 @@ const IODetails = ({ enableNextTab, index, data }) => {
arabic: true,
section: " ",
width: "49%",
maxLength:150,
helperText:`Maximum length should be 150 characters. You have entered ${watch()?.investmentNameArabic?.length || 0} characters.`
},
{
label: "Description",
@@ -258,7 +261,8 @@ const IODetails = ({ enableNextTab, index, data }) => {
isRequired: true,
section: " ",
width: "49%",
maxLength:1000
maxLength:1000,
helperText:`Maximum length should be 1000 characters. You have entered ${watch()?.descriptionEnglish?.length || 0} characters.`
},
{
label: "Description (Arabic)",
@@ -269,6 +273,8 @@ const IODetails = ({ enableNextTab, index, data }) => {
arabic: true,
section: " ",
width: "49%",
maxLength:1000,
helperText:`Maximum length should be 1000 characters. You have entered ${watch()?.descriptionArabic?.length || 0} characters.`
},
{
@@ -400,7 +406,8 @@ const IODetails = ({ enableNextTab, index, data }) => {
width: "100%",
options: investmentTypeOptions,
value: IObyID?.data?.comment,
maxLength:100
maxLength:100,
helperText:`Maximum length should be 100 characters. You have entered ${watch()?.comment?.length || 0} characters.`
},
];
//=======================[ Editor ]

View File

@@ -298,7 +298,9 @@ const InvestmentDocument = ({ control, errors, enableNextTab, index, }) => {
return (
<Box>
<Box display="flex" justifyContent="end" mb={4} gap={2}>
<SetDisplayOrder data={filteredData} />
{filteredData?.length !== 0 &&<SetDisplayOrder data={filteredData} />}
<Button
leftIcon={<AddIcon />}
onClick={onOpen}

View File

@@ -230,7 +230,9 @@ const KeyMerits = ({ enableNextTab, index, data: prepopData }) => {
/> */}
<Box display={"flex"} gap={2} as="span">
<SetDisplayOrder data={filteredData} />
{filteredData?.length !== 0 &&<SetDisplayOrder data={filteredData} />}
<Button
leftIcon={<AddIcon />}
onClick={onOpen}

View File

@@ -9,6 +9,7 @@ import {
DrawerHeader,
DrawerOverlay,
FormControl,
FormHelperText,
FormLabel,
Input,
Text,
@@ -252,6 +253,8 @@ const InvestmentDocuments = ({
{errors.document.message}
</Text>
)}
<FormHelperText mt={1} fontSize="xs" fontWeight={500} color="gray.500">File size should be max 2mb</FormHelperText>
</FormControl>
{file && (
<Box mt={4}>

View File

@@ -205,9 +205,9 @@ const ViewIOTable = () => {
<Tooltip
rounded={"sm"}
fontSize={"xs"}
label="View"
label="Edit"
bg="#fff"
color={"green.500"}
color={"blue.500"}
placement="top"
>
<Button

View File

@@ -39,6 +39,7 @@ import Exit from "./HeaderModal/Exit";
import Cancle from "./HeaderModal/Cancle";
import { AddIcon } from "@chakra-ui/icons";
import { GrGallery } from "react-icons/gr";
import Loader01 from "../../../Components/Loaders/Loader01";
const ViewIOdataHeader = ({data, isLoading}) => {
const params = useParams();
@@ -151,7 +152,7 @@ const ViewIOdataHeader = ({data, isLoading}) => {
const apiTransactionTitles = IODetails?.mainTranscation?.map(transaction => transaction.id);
// Filter menu items
const filteredMenu = menu?.filter(item => apiTransactionTitles?.includes(item.id));
console.log(filteredMenu);
@@ -161,7 +162,7 @@ console.log(isLoading);
return (
isLoading ?"":
IODetails?.investmentNameEnglish ?
<Box
display={"flex"}
alignItems={"center"}
@@ -192,8 +193,6 @@ console.log(isLoading);
// bgGradient='linear(to-r, #ffd54f, #caf5d8)'
// bgGradient='linear(to-r, #caf5d8, #a8e6cf)'
boxShadow={"md"}
paddingRight={"10px"}
borderRadius={"10px"}
position={"relative"}
>
@@ -252,17 +251,15 @@ console.log(isLoading);
</Box>
<Box display={"flex"} flexDirection={"column"} gap={2}>
<Text as={"span"} fontSize={"xs"} color={"gray.500"} fontWeight={"500"}>
<Text as={"span"} textAlign={'center'} fontSize={"xs"} color={"gray.500"} fontWeight={"500"}>
IO Status
</Text>
<Badge
rounded={"full"}
pt={1}
pb={1}
pt={0}
pb={0.5}
ps={4}
pe={4}
mt={1.5}
mb={1.5}
textTransform={"none"}
// variant={"solid"}
@@ -345,7 +342,7 @@ console.log(isLoading);
Tansaction
</MenuItem>
{menu?.map(({id, title, onClickFunction})=><MenuItem key={id} onClick={onClickFunction} className="border-bottom">
{filteredMenu?.map(({id, title, onClickFunction})=><MenuItem key={id} onClick={onClickFunction} className="border-bottom">
{title}
</MenuItem>)}
@@ -376,7 +373,23 @@ console.log(isLoading);
/>
</Box>
</Box>
</Box>:
<Box
display={"flex"}
alignItems={"center"}
justifyContent={"center"}
rounded={"md"}
height={100}
bg={"#fff"}
// bgGradient='linear(to-r, #caf5d8, #f5e8ca)'
// bgGradient='linear(to-r, #caf5d8, #d4a5a5)'
// bgGradient='linear(to-r, #caf5d8, #d4a5a5)'
// bgGradient='linear(to-r, #caf5d8, #b3e5fc)'
// bgGradient='linear(to-r, #ffd54f, #caf5d8)'
// bgGradient='linear(to-r, #caf5d8, #a8e6cf)'
boxShadow={"md"}
> <Loader01 /></Box>
);
};

View File

@@ -31,7 +31,9 @@ import * as Yup from "yup";
const validationSchema = Yup.object().shape({
emailAddress: Yup.string().required("Email address is required"),
emailAddress: Yup.string()
.email("Invalid email address")
.required("Email address is required"),
password_hash: Yup.string().required("Password is required"),
});
@@ -51,7 +53,7 @@ const Login = () => {
useEffect(() => {
if (isAuthenticate) {
navigate("/");
navigate("/sponser");
}
}, [navigate, isAuthenticate]);
@@ -69,7 +71,7 @@ const Login = () => {
setIsLoading(false);
setIsAuthenticate(true);
Cookies.set("isAuthenticated", true, { expires: 7 });
navigate("/");
navigate("/sponser");
reset();
}

View File

@@ -22,8 +22,10 @@ export const addInvestmentType = yup.object().shape({
investmentTypeName: yup.string()
.required('Investment type is required')
.max(50, 'Investment name cannot be more than 50 characters'),
note: yup.string().notRequired(),
investmentTypeNameArabic: yup.string().required(),
note: yup.string()
.optional()
.max(255, 'Note cannot exceed 255 characters'),
investmentTypeNameArabic: yup.string().required("Investment type in arabic required"),
noteArabic: yup.string().notRequired(),
});
@@ -62,6 +64,7 @@ const AddInvestmentType = () => {
const {
control,
handleSubmit,
watch,
formState: { errors },
reset,
} = useForm({
@@ -172,7 +175,8 @@ const AddInvestmentType = () => {
type: "text",
isRequired: true,
section: "Add Details",
maxLength: 50
maxLength: 50,
helperText:`Maximum length should be 50 characters. You have entered ${watch()?.investmentTypeName?.length || 0} characters.`
},
{
label: "Investment Type (Arabic) ",
@@ -182,7 +186,8 @@ const AddInvestmentType = () => {
isRequired: true,
section: "Add Details",
arabic: true,
maxLength: 255
maxLength: 255,
helperText:`Maximum length should be 255 characters. You have entered ${watch()?.investmentTypeNameArabic?.length || 0} characters.`
},
{
label: "Description (English)",
@@ -191,7 +196,8 @@ const AddInvestmentType = () => {
type: "textarea",
// isRequired: true,
section: "Add Details",
maxLength: 255
maxLength: 255,
helperText:`Maximum length should be 255 characters. You have entered ${watch()?.note?.length || 0} characters.`
},
{
label: "Description (Arabic)",
@@ -201,7 +207,8 @@ const AddInvestmentType = () => {
// isRequired: true,
arabic: true,
section: "Add Details",
maxLength: 255
maxLength: 255,
helperText:`Maximum length should be 255 characters. You have entered ${watch()?.noteArabic?.length || 0} characters.`
},
];
@@ -215,6 +222,8 @@ const AddInvestmentType = () => {
type: "text",
isRequired: true,
section: "Add Details",
maxLength: 50,
helperText:`Maximum length should be 50 characters. You have entered ${watch()?.investmentTypeName?.length || 0} characters.`
},
{
label: "Investment Type (Arabic)",
@@ -224,6 +233,8 @@ const AddInvestmentType = () => {
isRequired: true,
section: "Add Details",
arabic: true,
maxLength: 255,
helperText:`Maximum length should be 255 characters. You have entered ${watch()?.investmentTypeNameArabic?.length || 0} characters.`
},
{
label: "Description (English)",
@@ -232,6 +243,8 @@ const AddInvestmentType = () => {
type: "textarea",
// isRequired: true,
section: "Add Details",
maxLength: 255,
helperText:`Maximum length should be 255 characters. You have entered ${watch()?.note?.length || 0} characters.`
},
{
label: "Description (Arabic)",
@@ -241,6 +254,8 @@ const AddInvestmentType = () => {
// isRequired: true,
arabic: true,
section: "Add Details",
maxLength: 255,
helperText:`Maximum length should be 255 characters. You have entered ${watch()?.noteArabic?.length || 0} characters.`
},
];

View File

@@ -17,9 +17,13 @@ import DummyComponent from "../../../Components/DummyComponent";
// ======================= [validation] =========================
export const addSponser = yup.object().shape({
sponsorName: yup.string().required("Sponser name is required"),
sponsorNameArabic: yup.string().required("Sponser name is required"),
email: yup.string().email("Must be a valid email").notRequired(),
sponsorName: yup.
string()
.required('Sponsor Name is required')
.min(3, 'Sponsor Name must be at least 3 characters long')
.max(50, 'Investment Type Name cannot exceed 50 characters'),
sponsorNameArabic: yup.string().required("Sponser name in arabic is required"),
email: yup.string().email("Invalid email address").notRequired(),
// .test("emailValidity", "Email address is invalid", async function (value) {
// if (!value) {
// return true; // Allow if the field is empty
@@ -65,6 +69,7 @@ const AddSponser = () => {
const {
control,
watch,
handleSubmit,
formState: { errors },
reset,
@@ -158,7 +163,7 @@ const AddSponser = () => {
});
setIsLoadingBtn(false);
navigate("/sponser");
setAlert(false)
}
});
} catch (error) {
@@ -180,7 +185,8 @@ const AddSponser = () => {
type: "text",
isRequired: true,
section: "Add Details",
maxLength:50
maxLength:50,
helperText:`Maximum length should be 50 characters. You have entered ${watch()?.sponsorName?.length || 0} characters.`
},
{
label: "Sponser name (Arabic)",
@@ -191,7 +197,8 @@ const AddSponser = () => {
section: "Add Details",
arabic: true,
right: true,
maxLength:255
maxLength:55,
helperText:`Maximum length should be 55 characters. You have entered ${watch()?.sponsorNameArabic?.length || 0} characters.`
},
{
label: "Email address",
@@ -213,7 +220,8 @@ const AddSponser = () => {
type: "text",
isRequired: true,
section: "Add Details",
maxLength:50
maxLength:55,
helperText:`Maximum length should be 55 characters. You have entered ${watch()?.sponsorName?.length || 0} characters.`
},
{
label: "Sponser name (Arabic)",
@@ -223,7 +231,8 @@ const AddSponser = () => {
isRequired: true,
section: "Add Details",
arabic: true,
maxLength:255
maxLength:55,
helperText:`Maximum length should be 55 characters. You have entered ${watch()?.sponsorNameArabic?.length || 0} characters.`
},
{
label: "Email adress",
@@ -297,7 +306,7 @@ const AddSponser = () => {
isLoading={isLoadingBtn}
/>
<DummyComponent />
{/* <DummyComponent /> */}
</Box>
);
};

View File

@@ -39,7 +39,7 @@ export const RouteLink = [
// =============[ Tanami ]================
// ===============[ Management]===============
{ path: "/", Component: Dashbaord },
// { path: "/", Component: Dashbaord },
{ path: "/sponser", Component: Sponser },
{ path: "/sponser/add-sponser/:id", Component: AddSponser },
{ path: "/sponser/add-sponser", Component: AddSponser },

View File

@@ -50,7 +50,7 @@ export const ioService = createApi({
method: "PATCH",
body: data,
}),
invalidatesTags: ["getIOById"],
invalidatesTags: ["getIOById", "getIO"],
}),
// =====[Key Merits]
@@ -58,6 +58,7 @@ export const ioService = createApi({
query: (id) => `/io/admin/key-merits/${id}`,
providesTags: ["getKeyMerits"],
}),
createKeyMerits: builder.mutation({
query: ({ data, id }) => ({
url: `/io/admin/key-merits/${id}`,
@@ -75,6 +76,7 @@ export const ioService = createApi({
}),
invalidatesTags: ["getIOById"],
}),
updateKeyMerits: builder.mutation({
query: ({ data, id }) => ({
url: `/io/admin/key-merits/byId/${id}`,
@@ -126,20 +128,20 @@ export const ioService = createApi({
// =====[createImageArtifacts]
createImageArtifacts: builder.mutation({
query: ({ data, id }) => ({
url: `/io/admin/artifact/image/${id}`,
method: "POST",
body: data,
}),
invalidatesTags: ["getIOById"],
}),
// =====[createImageArtifacts]
createImageArtifacts: builder.mutation({
query: ({ data, id }) => ({
url: `/io/admin/artifact/image/${id}`,
method: "POST",
body: data,
}),
invalidatesTags: ["getIOById"],
}),
updateImageArtifacts: builder.mutation({
query: ({ data, id }) => ({
url: `/io/admin/artifact/image/byId/${id}`,
@@ -148,10 +150,10 @@ export const ioService = createApi({
}),
invalidatesTags: ["getIOById"],
}),
// =====[createVideoArtifacts]
createVideoArtifacts: builder.mutation({
query: ({ data, id }) => ({
@@ -178,7 +180,7 @@ export const ioService = createApi({
}),
invalidatesTags: ["getIOById"],
}),
updateVideoArtifacts: builder.mutation({
query: ({ data, id }) => ({
url: `/io/admin/artifact/video/byId/${id}`,
@@ -196,7 +198,7 @@ export const ioService = createApi({
}),
invalidatesTags: ["getIOById"],
}),
updateStatusIo: builder.mutation({
query: ({ data, id }) => ({
url: `/io/admin/update-status/${id}`,
@@ -206,7 +208,7 @@ export const ioService = createApi({
invalidatesTags: ["getIOById", 'getIO'],
}),
createIoCash : builder.mutation({
createIoCash: builder.mutation({
query: ({ data, id }) => ({
url: `/io/admin/io-cash/${id}`,
method: "POST",
@@ -217,7 +219,7 @@ export const ioService = createApi({
}),
createIoNav : builder.mutation({
createIoNav: builder.mutation({
query: ({ data, id }) => ({
url: `/io/admin/io-nav/${id}`,
method: "POST",

View File

@@ -17,7 +17,7 @@ import { ioService } from "./io.service";
export const sponserMaster = createApi({
reducerPath: "sponserMaster",
baseQuery: baseQuery,
tagTypes: ["getSponser"],
tagTypes: ["getSponser", "prePopulate"],
endpoints: (builder) => ({
@@ -65,7 +65,7 @@ export const sponserMaster = createApi({
method: "POST",
body: data,
}),
invalidatesTags: ["getSponser"],
invalidatesTags: ["getSponser","prePopulate"],
}),
// ========[Update Sponser]========