diff --git a/src/pages/CheckoutPage2.tsx b/src/pages/CheckoutPage2.tsx index 7f8f136..4897c2f 100644 --- a/src/pages/CheckoutPage2.tsx +++ b/src/pages/CheckoutPage2.tsx @@ -199,23 +199,44 @@ function CheckoutConfigCard({ const [noOfAdults, setNoOfAdults] = useState(1) const [noOfChildren, setNoOfChildren] = useState(0) const [noOfAttractions, setNoOfAttractions] = useState(item?.minNumber); + const [noOfDays, setNoOfDays] = useState(item?.minNumber) + const cityId = localStorage.getItem("cityId") + + const cardTypeId = item?.cardType?.id + const cardId = item?.id + const cardMode = item?.cardType?.name === "selective_pass" ? "flexi" : "unlimited" const adultPrice = item?.adultPrice * noOfAdults const childPrice = item?.childPrice * noOfChildren - const originalPrice = adultPrice + childPrice - const totalPrice = originalPrice - 20 + const basePrice = adultPrice + childPrice + const taxAmount = 10 + const strikedPrice = basePrice - 20 useEffect(() => { setNoOfAttractions(item?.minNumber) + setNoOfDays(item?.minNumber) }, [item]) const numberArray = Array.from( { length: item?.maxNumber - item?.minNumber + 1 }, (_, i) => item?.minNumber + i ); - const navigate = useNavigate(); + const cardBookingDetails = { + cityId, + cardTypeId, + cardId, + noOfAdults, + cardMode, + noOfChildren, + taxAmount, + noOfAttractions, + noOfDays + } + + + return (
@@ -259,7 +280,7 @@ function CheckoutConfigCard({
@@ -275,13 +296,14 @@ function CheckoutConfigCard({ @@ -295,8 +317,8 @@ function CheckoutConfigCard({
You Pay
- ${originalPrice} - ${totalPrice} + ${basePrice} + ${strikedPrice}
@@ -330,6 +352,7 @@ export function CheckoutPage2({ const navigate = useNavigate(); // Default item (you can pass via props later) + const baseUrl = import.meta.env.VITE_BASE_URL; const cityId = localStorage.getItem("cityId") const { data: checkoutPageData, isLoading } = useGetCheckoutPageDataQuery(cityId) @@ -339,6 +362,7 @@ export function CheckoutPage2({ const cards = checkoutPageData?.cards ?? [] const flexiCard = checkoutPageData?.cards[0] ?? null const unlimitedCard = checkoutPageData?.cards[1] ?? null + const attractions = checkoutPageData?.attractions ?? []; const [checkoutItem, setCheckoutItem] = useState(flexiCard); @@ -351,15 +375,13 @@ export function CheckoutPage2({ if (isLoading) { return } else { - console.log(flexiCard) + // console.log(flexiCard) } const handleCheckoutItemChange = (cardObject: any) => { setCheckoutItem(cardObject); }; - // const attractions = attractionsData[checkoutItem.city]?.[checkoutItem.cardType] || []; - // const offers = offersData[checkoutItem.cardType] || []; return (
@@ -452,15 +474,15 @@ export function CheckoutPage2({
{/* Offers Section (Exact) */} - {/*
-

{checkoutItem.cardType} Card Offers

-

Exclusive deals and discounts included with your {checkoutItem.cardType} pass

+
+

{checkoutItem?.cardType?.displayName} Offers

+

Exclusive deals and discounts included with your {checkoutItem?.cardType.displayName} pass

- {offers.map((offer, idx) => ( -
+ {checkoutItem?.offers.map((offer: any) => ( +
- +

{offer.title}

@@ -473,32 +495,32 @@ export function CheckoutPage2({
))}
-
*/} +
{/* Attractions Section (Exact) */} - {/*
+

Available Attractions

{attractions.length} included

Explore all the experiences you can enjoy with your pass

- {attractions.map((a) => ( + {attractions.map((a: any) => (
- +
{a.category}
-
{a.name}
+
{a.title}
))}
-
*/} +
{/* Right Column - Config Card */}