"use client"; import { useEffect, useState } from "react"; import StepLine from "./StepLine"; import Link from "next/link"; import OtpInput from "react-otp-input"; import { FaArrowRightLong } from "react-icons/fa6"; import { FaArrowLeftLong } from "react-icons/fa6"; import { FaChevronRight } from "react-icons/fa"; import { RxCross2 } from "react-icons/rx"; import Image from "next/image"; import { FaCheck } from "react-icons/fa6"; import ServiceCard from "../register/ServiceCard"; import MembershipCard from "../register/MembershipCard"; import PaymentMethodCard from "../register/PaymentMethodCard"; import { Route } from "lucide-react"; import { useRouter } from "next/navigation"; import RegisterStepOne from "../register/RegisterStepOne"; import RegisterStepFor from "../register/RegisterStepFor"; import RegisterStepThree from "../register/RegisterStepThree"; export default function RegistrationForm() { const [step, setStep] = useState(1); const [otp, setOtp] = useState(""); const [SelectedService, setSelectedService] = useState(false); const [timer, setTimer] = useState(60); const [ShowService, setShowService] = useState(null); const [showPopup, setShowPopup] = useState(false); const [showSubcategories, setShowSubcategories] = useState(false); const [activeMainService, setActiveMainService] = useState(null); const [selectedMainServices, setSelectedMainServices] = useState([]); const [selectedSubcategories, setSelectedSubcategories] = useState({}); const [subPrices, setSubPrices] = useState({}); const [ServiceOkk, setServiceOkk] = useState(false); const [pendingServiceData, setPendingServiceData] = useState(null); const [ShowSelected, setShowSelected] = useState(false); const router = useRouter(); useEffect(() => { if (timer > 0) { const interval = setInterval(() => setTimer((prev) => prev - 1), 1000); return () => clearInterval(interval); } }, [timer]); const handleResendOtp = () => { setTimer(60); setOtp(); console.log("OTP resent!"); }; const handleFocus = (e) => { e.target.style.backgroundColor = "#d3d3d3"; // Dark background on focus e.target.style.color = "#000"; // Optional: change text color to white for contrast e.target.style.border = "none"; }; const handleBlur = (e) => { e.target.style.backgroundColor = ""; // Reset background color when focus is lost e.target.style.color = ""; // Optional: reset text color e.target.style.border = "1px solid #ccc"; }; const toggleSubService = (mainService, subName) => { setSelectedSubcategories((prev) => { const current = prev[mainService] || []; if (current.includes(subName)) { return { ...prev, [mainService]: current.filter((n) => n !== subName) }; } else { return { ...prev, [mainService]: [...current, subName] }; } }); }; // Handle price change const handlePriceChange = (subName, value) => { setSubPrices((prev) => ({ ...prev, [subName]: value, })); }; const ServiceData = [ { name: "Appliances", path: "/Services/Appliances 1.png", }, { name: "Assembly", path: "/Services/Assembly.png", }, { name: "Cleaning", path: "/Services/Cleaning.png", }, { name: "Electricity", path: "/Services/Electricity.png", }, { name: "Fitting and fixing", path: "/Services/Fitting and fixing.png", }, { name: "Plumbing", path: "/Services/Changing a siphon.png", }, { name: "Installation", path: "/Services/Installation.png", }, { name: "Interior design", path: "/Services/Interior design.png", }, { name: "Lighting", path: "/Services/Lighting.png", }, { name: "Appliances", path: "/Services/Appliances 1.png", }, { name: "Assembly", path: "/Services/Assembly.png", }, { name: "Cleaning", path: "/Services/Cleaning.png", }, { name: "Electricity", path: "/Services/Electricity.png", }, { name: "Fitting and fixing", path: "/Services/Fitting and fixing.png", }, { name: "Plumbing", path: "/Services/Changing a siphon.png", }, { name: "Installation", path: "/Services/Installation.png", }, { name: "Interior design", path: "/Services/Interior design.png", }, { name: "Lighting", path: "/Services/Lighting.png", }, ]; const Selectedservices = [ { title: "Assembly", subtitle: "Bed", price: 20, image: "/images/bed.png", }, { title: "Assembly", subtitle: "Cabinets", price: 20, image: "/images/cabinets.png", }, { title: "Assembly", subtitle: "Dressing room", price: 20, image: "/images/dressing-room.png", }, { title: "Assembly", subtitle: "Cabinets", price: 20, image: "/images/cabinets.png", }, { title: "Assembly", subtitle: "Dressing room", price: 20, image: "/images/dressing-room.png", }, { title: "Assembly", subtitle: "Cabinets", price: 20, image: "/images/cabinets.png", }, { title: "Assembly", subtitle: "Dressing room", price: 20, image: "/images/dressing-room.png", }, ]; const handleServicePopUp = (data) => { if (data) { console.log(data, "item"); setPendingServiceData(data); } if (showPopup) { setShowPopup(true); if (ServiceOkk && pendingServiceData) { setActiveMainService(pendingServiceData.name); setShowSubcategories(true); setShowPopup(false); setServiceOkk(false); } } else { setShowPopup(true); setServiceOkk(true); } }; const handleNextToSix = () => { setShowSelected(true); setSelectedService(false); }; const nextStep = () => { router.push("#top"); setStep((prev) => prev + 1); }; const prevStep = () => setStep((prev) => prev - 1); return (
{" "} We have sent a code to your email.
Didnt receive the code? {Math.floor(timer / 60)}: {(timer % 60).toString().padStart(2, "0")}
{timer === 0 ? (Resend OTP
) : (Resend OTP
)}Select the services you can provide
Let’s get started
Add the services you can provide
Select a plan that fits your business needs
Your application is under review wait while your employer is accepting you
Choose your service category which you provide
{item.name}
{item.name}
Insert prices now to simplify
quote creation