diff --git a/public/assets/css/core-extend.css b/public/assets/css/core-extend.css index 5b328e9b..940f2065 100644 --- a/public/assets/css/core-extend.css +++ b/public/assets/css/core-extend.css @@ -4,6 +4,29 @@ --bg-border-color :#f8f6f6 } + +/* ===========================% Background_Colors %========================================================== */ +.bg-light-primary { + background-color: color-mix(in srgb, var(--bs-primary) 10.4%, transparent); + border:var(--bs-primary-border-subtle) +} +.bg-light-secondary { + background-color: color-mix(in srgb, var(--bs-secondary) 10.4%, transparent); +} +.bg-light-danger { + background-color: color-mix(in srgb, var(--bs-danger) 10.4%, transparent); +} +.bg-light-success { + background-color: color-mix(in srgb, var(--bs-success) 10.4%, transparent); +} + +.bg-light-info { + background-color: color-mix(in srgb, var(--bs-info) 10.4%, transparent); +} +.bg-light-warning { + background-color: color-mix(in srgb, var(--bs-warning) 10.4%, transparent); +} + .card-header { padding: 0.5rem var(--bs-card-cap-padding-x); } diff --git a/src/hooks/usePayment.jsx b/src/hooks/usePayment.jsx new file mode 100644 index 00000000..f5d30ca1 --- /dev/null +++ b/src/hooks/usePayment.jsx @@ -0,0 +1,38 @@ +import { useMutation, useQueryClient } from "@tanstack/react-query"; +import { PaymentRepository } from "../repositories/PaymentRepository"; + +export const useMakePayment = (onSuccessCallBack) => { + const client = useQueryClient(); + return useMutation({ + mutationFn: (payload) => PaymentRepository.makePayment(payload), + onSuccess: (_, varibales) => { + if (onSuccessCallBack) onSuccessCallBack(); + }, + onError: (error) => { + showToast( + error.message || + error.response.message || + "Something went wrong.Please try again later.", + "error" + ); + }, + }); +}; + +export const useVerifyPayment = () => { + const client = useQueryClient(); + return useMutation({ + mutationFn: (payload) => PaymentRepository.verifyPayment(payload), + onSuccess: (_, varibales) => { + if (onSuccessCallBack) onSuccessCallBack(); + }, + onError: (error) => { + showToast( + error.message || + error.response.message || + "Something went wrong.Please try again later.", + "error" + ); + }, + }); +}; diff --git a/src/pages/Home/HomeSchema.jsx b/src/pages/Home/HomeSchema.jsx new file mode 100644 index 00000000..344ad024 --- /dev/null +++ b/src/pages/Home/HomeSchema.jsx @@ -0,0 +1,27 @@ +import { z } from "zod"; + +export const OrganizationSchema = z.object({ + firstName: z.string().min(1, "First Name is required"), + lastName: z.string().min(1, "Last Name is required"), + email: z.string().email("Invalid email address"), + billingAddress: z.string().min(1, "Billing Address is required"), + organizationName: z.string().min(1, "Organization Name is required"), + contactNumber: z + .string() + .min(5, "Contact Number is too short") + .regex( + /^[+]?[(]?[0-9]{1,4}[)]?[-\s./0-9]*$/, + "Invalid phone number format" + ), + onBoardingDate: z.coerce + .date() + .refine((d) => !Number.isNaN(d.getTime()), { message: "Invalid date" }), + organizationSize: z.string().min(1, "Organization Size is required"), + industryId: z.string().uuid("Industry is required"), + reference: z.string().optional(), +}); + + +export const OrganizationDefaultValue = { + +} \ No newline at end of file diff --git a/src/pages/Home/MakeSubscription.jsx b/src/pages/Home/MakeSubscription.jsx new file mode 100644 index 00000000..1ce873a9 --- /dev/null +++ b/src/pages/Home/MakeSubscription.jsx @@ -0,0 +1,308 @@ +import React, { useState } from "react"; +import { useForm } from "react-hook-form"; +import { OrganizationDefaultValue, OrganizationSchema } from "./HomeSchema"; +import { zodResolver } from "@hookform/resolvers/zod"; +import Label from "../../components/common/Label"; +import { orgSize, reference } from "../../utils/constants"; +import DatePicker from "../../components/common/DatePicker"; +import { useIndustries } from "../../hooks/useTenant"; + +const MakeSubscription = () => { + const [selectedPlan, setSelectedPlan] = useState("basic"); + + const handleChange = (e) => { + const value = e.target.value; + setSelectedPlan(value); + }; + + const { data, isError, isLoading: industryLoading } = useIndustries(); + const options = [ + { + id: 1, + title: "Basic", + value: "basic", // ✅ Added value + price: "Free", + description: "Get 1 project with 1 team member.", + }, + { + id: 2, + title: "Pro", + value: "pro", // ✅ Added value + price: "$10/mo", + description: "Up to 10 projects and 5 team members.", + }, + { + id: 3, + title: "Enterprise", + value: "enterprise", // ✅ Added value + price: "$30/mo", + description: "Unlimited projects and team members.", + }, + ]; + + const { + register, + handleSubmit, + control, + formState: { errors }, + reset, + } = useForm({ + resolver: zodResolver(OrganizationSchema), + defaultValues: OrganizationDefaultValue, + }); + + const onSubmit = (data) => { + console.log("Form Submitted:", data); + alert("Form submitted successfully!"); + reset(); + }; + + return ( +