diff --git a/src/app/marketing/create/_components/HeroStep.tsx b/src/app/marketing/create/_components/HeroStep.tsx index dbd9272..fd42846 100644 --- a/src/app/marketing/create/_components/HeroStep.tsx +++ b/src/app/marketing/create/_components/HeroStep.tsx @@ -2,6 +2,7 @@ import InputGroup from "@/components/FormElements/InputGroup"; import { TextAreaGroup } from "@/components/FormElements/InputGroup/text-area"; import { ShowcaseSection } from "@/components/Layouts/showcase-section"; +import { REGEX } from "@/constants/regex"; import { FormErrorMessages } from "@/constants/Texts"; import { forwardRef, useImperativeHandle } from "react"; import useHeroStepPresenter from "./useHeroStepPresenter"; @@ -113,6 +114,7 @@ const HeroStep = forwardRef((props, ref) => { { const [step, setStep] = useState(0); const [formData, setFormData] = useState({}); @@ -24,6 +35,20 @@ const Marketing = () => { const contactsRef = useRef(null); const footerRef = useRef(null); + const { + register: registerPageType, + watch: watchPageType, + formState: { errors: pageTypeErrors }, + getValues: getPageTypeValues, + } = useForm({ + defaultValues: { + page_type: "company", + }, + }); + + const pageType = watchPageType("page_type"); + const isCompany = pageType === "company"; + const { mutate: createCms, isPending } = useCreateCms(); const breadcrumbItems: BreadcrumbItem[] = [ @@ -120,9 +145,21 @@ const Marketing = () => { const handleSubmitAll = async () => { const allData = await collectAllStepsData(); - console.log("All collected data:", allData); + const pageTypeData = getPageTypeValues(); + + const finalData = { + ...allData, + page_type: pageTypeData.page_type, + ...(pageTypeData.page_type === "company" && { + language: pageTypeData.language, + company_name: pageTypeData.company_name, + country: pageTypeData.country, + }), + }; - createCms(allData, { + console.log("All collected data:", finalData); + + createCms(finalData, { onSuccess: () => { console.log("CMS created successfully"); }, @@ -179,6 +216,107 @@ const Marketing = () => { <> + {/* Page Type Selection */} +
+

+ Page Configuration +

+
+