From 847cc99b53d7756f88dd32cd78192f8085dcc30e Mon Sep 17 00:00:00 2001 From: bhanupratapsingh21 Date: Mon, 4 Nov 2024 17:42:38 +0530 Subject: [PATCH 1/2] updated api data to accroding to new schema --- .../(vendor onboarding)/decorator/page.tsx | 4 +- src/app/(vendor onboarding)/pav/page.tsx | 132 ++++++++---------- 2 files changed, 60 insertions(+), 76 deletions(-) diff --git a/src/app/(vendor onboarding)/decorator/page.tsx b/src/app/(vendor onboarding)/decorator/page.tsx index 0a6c647..a11bee5 100644 --- a/src/app/(vendor onboarding)/decorator/page.tsx +++ b/src/app/(vendor onboarding)/decorator/page.tsx @@ -269,7 +269,7 @@ const Decorators: React.FC = () => { formData.append(`cancellationPolicy`, file); }); } else { - formData.append("cancellation_policy", formState.cancellationPolicy); + formData.append("cancellationPolicy", formState.cancellationPolicy); } if (Array.isArray(formState.termsAndConditions)) { @@ -277,7 +277,7 @@ const Decorators: React.FC = () => { formData.append(`termsAndConditions`, file); }); } else { - formData.append("terms_and_conditions", formState.termsAndConditions); + formData.append("termsAndConditions", formState.termsAndConditions); } // Additional fields diff --git a/src/app/(vendor onboarding)/pav/page.tsx b/src/app/(vendor onboarding)/pav/page.tsx index 2ca275e..ceb03db 100644 --- a/src/app/(vendor onboarding)/pav/page.tsx +++ b/src/app/(vendor onboarding)/pav/page.tsx @@ -129,99 +129,83 @@ const Page = () => { console.error("No token found!"); return; } + const formData = new FormData(); formData.append("venId", venId); // page 1 formData.append("name", name); formData.append("description", description); - formData.append("events", JSON.stringify(events)); - formData.append("eventsize", JSON.stringify(eventsize)); + formData.append("eventTypes", JSON.stringify(events)); + formData.append("eventSize", eventsize); - // page 2 - formData.append("Photosstyles", JSON.stringify(Photosstyles)); - formData.append("Photosequipments", JSON.stringify(Photosequipments)); - formData.append("PhotosAddones", JSON.stringify(PhotosAddons)); - formData.append( - "Photosfinaldeliverymethods", - JSON.stringify(Photosfinaldeliverymethods), - ); + // page 2: Photography and Videography details + formData.append("Photography.equipmentAvailable", JSON.stringify(Photosequipments)); + formData.append("Photography.typesofstyles", JSON.stringify(Photosstyles)); + formData.append("Photography.addonsOrUpgradeAvailable", JSON.stringify(PhotosAddons)); + formData.append("Photography.finalDeliveryMethods", JSON.stringify(Photosfinaldeliverymethods)); - // page 3 - formData.append("Videosstyles", JSON.stringify(Videosstyles)); - formData.append("Videosequipments", JSON.stringify(Videosequipments)); - formData.append("VideoAddones", JSON.stringify(VideoAddons)); - formData.append( - "Videofinaldeliverymethods", - JSON.stringify(Videofinaldeliverymethods), - ); + formData.append("Videography.equipmentAvailable", JSON.stringify(Videosequipments)); + formData.append("Videography.typesofstyles", JSON.stringify(Videosstyles)); + formData.append("Videography.addonsOrUpgradeAvailable", JSON.stringify(VideoAddons)); + formData.append("Videography.finalDeliveryMethods", JSON.stringify(Videofinaldeliverymethods)); + // page 3 + formData.append("duration", Durationoffinaldelivery); + formData.append("PackageTypes", Packagetype); + formData.append("availableForOutofTownbooking", JSON.stringify(availablefordestinationevents)); + formData.append("postproductionservices", JSON.stringify(postproductionservices)); + formData.append("freeInitialConsultation", JSON.stringify(freeInitialConsultation)); + formData.append("Advancesetup", JSON.stringify(advanceSetup)); + formData.append("bookingDepositRequired", JSON.stringify(bookingDeposit)); + formData.append("designProposals", JSON.stringify(proposalsToClients)); // page 4 - formData.append("Durationoffinaldelivery", Durationoffinaldelivery); - formData.append("Packagetype", Packagetype); - formData.append( - "availablefordestinationevents", - JSON.stringify(availablefordestinationevents), - ); - formData.append( - "postproductionservices", - JSON.stringify(postproductionservices), - ); - - formData.append( - "freeInitialConsultation", - JSON.stringify(freeInitialConsultation), - ); - formData.append("advanceSetup", JSON.stringify(advanceSetup)); - formData.append("setupsInstallations", JSON.stringify(setupsInstallations)); - formData.append("bookingDeposit", JSON.stringify(bookingDeposit)); + formData.append("website", websiteurl); + formData.append("instagram", intstagramurl); + formData.append("awards", Recongnition_awards); + formData.append("advanceBookingPeriod", advbookingperiod); + formData.append("clientTestimonials", clientTestimonials); + formData.append("WrittenthemeProposelsafterconsultaion", JSON.stringify(writtenthemeproposalafterconsultaion)); + formData.append("initialthemeProposels", JSON.stringify(freerevisionforinitialthemeproposal)); // page 5 - formData.append( - "termsandconditions", - termsandconditions instanceof File - ? termsandconditions - : JSON.stringify(termsandconditions), - ); - formData.append( - "policy", - policy instanceof File ? policy : JSON.stringify(policy), - ); - formData.append("websiteurl", websiteurl); - formData.append("intstagramurl", intstagramurl); - formData.append("Recongnition_awards", Recongnition_awards); - formData.append("advbookingperiod", advbookingperiod); - formData.append("clientTestimonials", clientTestimonials); - formData.append( - "writtenthemeproposalafterconsultaion", - JSON.stringify(writtenthemeproposalafterconsultaion), - ); - formData.append( - "freerevisionforinitialthemeproposal", - JSON.stringify(freerevisionforinitialthemeproposal), - ); - // page 6 - if (photos instanceof File) { - formData.append("photos", photos); - } else if (Array.isArray(photos)) { - photos.forEach((photo, index) => - formData.append(`photos[${index}]`, photo), - ); + if (Array.isArray(policy)) { + policy.forEach((file, index) => { + formData.append(`cancellationPolicy`, file); + }); + } else { + formData.append("cancellationPolicy", policy); + } + + if (Array.isArray(termsandconditions)) { + termsandconditions.forEach((file, index) => { + formData.append(`termsAndConditions`, file); + }); } else { - formData.append("photos", JSON.stringify(photos)); + formData.append("termsAndConditions", termsandconditions); } - if (videos instanceof File) { - formData.append("videos", videos); - } else if (Array.isArray(videos)) { - videos.forEach((video, index) => - formData.append(`videos[${index}]`, video), - ); + + // page 4: Photos and Videos + if (Array.isArray(photos)) { + photos.forEach((file) => { + formData.append("photos", file); // No index here + }); } else { - formData.append("videos", JSON.stringify(videos)); + formData.append("photos", photos); + } + if (Array.isArray(videos)) { + videos.forEach((file) => { + if (file instanceof File) { + formData.append("videos", file); // Append as 'videos' without the array index + } + }); + } else if (typeof videos === "string") { + formData.append("videos", videos); // Append the string (URL) } + try { toast({ variant: "default", From 44a54bad126430c680bb43c5875851d53c191548 Mon Sep 17 00:00:00 2001 From: Bhanupratapsingh21 Date: Mon, 4 Nov 2024 12:14:25 +0000 Subject: [PATCH 2/2] chore: apply formatting changes [skip ci] --- src/app/(vendor onboarding)/pav/page.tsx | 57 ++++++++++++++++++------ 1 file changed, 44 insertions(+), 13 deletions(-) diff --git a/src/app/(vendor onboarding)/pav/page.tsx b/src/app/(vendor onboarding)/pav/page.tsx index ceb03db..050247f 100644 --- a/src/app/(vendor onboarding)/pav/page.tsx +++ b/src/app/(vendor onboarding)/pav/page.tsx @@ -140,22 +140,49 @@ const Page = () => { formData.append("eventSize", eventsize); // page 2: Photography and Videography details - formData.append("Photography.equipmentAvailable", JSON.stringify(Photosequipments)); + formData.append( + "Photography.equipmentAvailable", + JSON.stringify(Photosequipments), + ); formData.append("Photography.typesofstyles", JSON.stringify(Photosstyles)); - formData.append("Photography.addonsOrUpgradeAvailable", JSON.stringify(PhotosAddons)); - formData.append("Photography.finalDeliveryMethods", JSON.stringify(Photosfinaldeliverymethods)); + formData.append( + "Photography.addonsOrUpgradeAvailable", + JSON.stringify(PhotosAddons), + ); + formData.append( + "Photography.finalDeliveryMethods", + JSON.stringify(Photosfinaldeliverymethods), + ); - formData.append("Videography.equipmentAvailable", JSON.stringify(Videosequipments)); + formData.append( + "Videography.equipmentAvailable", + JSON.stringify(Videosequipments), + ); formData.append("Videography.typesofstyles", JSON.stringify(Videosstyles)); - formData.append("Videography.addonsOrUpgradeAvailable", JSON.stringify(VideoAddons)); - formData.append("Videography.finalDeliveryMethods", JSON.stringify(Videofinaldeliverymethods)); + formData.append( + "Videography.addonsOrUpgradeAvailable", + JSON.stringify(VideoAddons), + ); + formData.append( + "Videography.finalDeliveryMethods", + JSON.stringify(Videofinaldeliverymethods), + ); // page 3 formData.append("duration", Durationoffinaldelivery); formData.append("PackageTypes", Packagetype); - formData.append("availableForOutofTownbooking", JSON.stringify(availablefordestinationevents)); - formData.append("postproductionservices", JSON.stringify(postproductionservices)); - formData.append("freeInitialConsultation", JSON.stringify(freeInitialConsultation)); + formData.append( + "availableForOutofTownbooking", + JSON.stringify(availablefordestinationevents), + ); + formData.append( + "postproductionservices", + JSON.stringify(postproductionservices), + ); + formData.append( + "freeInitialConsultation", + JSON.stringify(freeInitialConsultation), + ); formData.append("Advancesetup", JSON.stringify(advanceSetup)); formData.append("bookingDepositRequired", JSON.stringify(bookingDeposit)); formData.append("designProposals", JSON.stringify(proposalsToClients)); @@ -165,8 +192,14 @@ const Page = () => { formData.append("awards", Recongnition_awards); formData.append("advanceBookingPeriod", advbookingperiod); formData.append("clientTestimonials", clientTestimonials); - formData.append("WrittenthemeProposelsafterconsultaion", JSON.stringify(writtenthemeproposalafterconsultaion)); - formData.append("initialthemeProposels", JSON.stringify(freerevisionforinitialthemeproposal)); + formData.append( + "WrittenthemeProposelsafterconsultaion", + JSON.stringify(writtenthemeproposalafterconsultaion), + ); + formData.append( + "initialthemeProposels", + JSON.stringify(freerevisionforinitialthemeproposal), + ); // page 5 @@ -186,7 +219,6 @@ const Page = () => { formData.append("termsAndConditions", termsandconditions); } - // page 4: Photos and Videos if (Array.isArray(photos)) { photos.forEach((file) => { @@ -205,7 +237,6 @@ const Page = () => { formData.append("videos", videos); // Append the string (URL) } - try { toast({ variant: "default",