-
-
-
-
-
+
+
diff --git a/src/app/[locale]/(client-components)/(Header)/MyTripButton.tsx b/src/app/[locale]/(client-components)/(Header)/MyTripButton.tsx
new file mode 100644
index 0000000..80a1912
--- /dev/null
+++ b/src/app/[locale]/(client-components)/(Header)/MyTripButton.tsx
@@ -0,0 +1,25 @@
+import { useUserContext } from "@/components/contexts/userContext";
+import Link from "next/link";
+import { MdOutlineCardTravel } from "react-icons/md";
+
+function MyTripButton() {
+
+ const {user} = useUserContext()
+
+
+ if (!Object.keys(user).length) {
+ return null
+ }
+ return (
+
+
+
+
+
+ );
+}
+
+export default MyTripButton;
diff --git a/src/app/[locale]/(client-components)/(Header)/SearchDropdown.tsx b/src/app/[locale]/(client-components)/(Header)/SearchDropdown.tsx
index 8341989..e8b05e8 100644
--- a/src/app/[locale]/(client-components)/(Header)/SearchDropdown.tsx
+++ b/src/app/[locale]/(client-components)/(Header)/SearchDropdown.tsx
@@ -4,6 +4,8 @@ import React, { FC, Fragment, useEffect, useState } from "react";
import { useToursContext } from "@/components/contexts/tourDetails";
import SearchCard from "@/components/SearchCard";
import axiosInstance from "@/components/api/axios";
+import SearchImage from "@/images/mynaui_search.svg"
+import Image from "next/image";
interface Props {
className?: string;
@@ -76,8 +78,8 @@ const SearchDropdown: FC
= ({ className = "" }) => {
return (
<>
-
-
+
+
{
return (
-
-
+
+
-
+
-
*/}
-
-
+
+
Mobile Apps
-
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed dapibus
porttitor nisl, sit amet finibus libero.
@@ -47,14 +47,14 @@ const SectionDowloadApp = () => {
-
+ /> */}
-
+ {/* */}
diff --git a/src/app/[locale]/(server-components)/SectionHero.tsx b/src/app/[locale]/(server-components)/SectionHero.tsx
index e9724dc..a57e3bb 100644
--- a/src/app/[locale]/(server-components)/SectionHero.tsx
+++ b/src/app/[locale]/(server-components)/SectionHero.tsx
@@ -1,7 +1,8 @@
-"use client"
+"use client";
import React, { FC } from "react";
import imagePng from "@/images/hero-right.png";
+import vectorPng from "@/images/Vector.png";
import HeroSearchForm from "../(client-components)/(HeroSearchForm)/HeroSearchForm";
import Image from "next/image";
import ButtonPrimary from "@/shared/ButtonPrimary";
@@ -15,28 +16,43 @@ const SectionHero: FC = ({ className = "" }) => {
const { t } = useTranslation("common"); // Initialize useTranslation
return (
-
-
-
-
- {t("beginAdventure")} {/* Translate the heading */}
-
-
- {t("planPilgrimage")} {/* Translate the description */}
-
-
- {t("startJourney")} {/* Translate the button text */}
-
-
-
-
+
+
+
+
+
+
+
+ {t("beginAdventure")}
+
+
+ {t("beginAdventure1")}
+
+
+ {t("beginAdventure2")}
+
+
+ {t("planPilgrimage")}
+
+
+ {t("startJourney")}
+
+
+
+
+
-
-
);
diff --git a/src/app/[locale]/custom-trip/page.tsx b/src/app/[locale]/custom-trip/page.tsx
index b868afb..3cda235 100644
--- a/src/app/[locale]/custom-trip/page.tsx
+++ b/src/app/[locale]/custom-trip/page.tsx
@@ -22,6 +22,12 @@ interface Country {
city: City[];
}
+interface Passengers {
+ adults: number;
+ children: number;
+ infants: number;
+}
+
interface CommonLayoutProps {}
const CommonLayout: FC
= () => {
@@ -32,10 +38,11 @@ const CommonLayout: FC = () => {
const [countries, setCountries] = useState([]);
const [startCity, setStartCity] = useState("");
const [startDate, setStartDate] = useState("");
- const [guestAdultsInputValue, setGuestAdultsInputValue] = useState(1);
- const [guestChildrenInputValue, setGuestChildrenInputValue] = useState(0);
- const [guestInfantsInputValue, setGuestInfantsInputValue] = useState(0);
- const [passengers, setPassengers] = useState(1);
+ const [passengers, setPassengers] = useState({
+ adults: 1,
+ children: 0,
+ infants: 0,
+ });
const [transport, setTransport] = useState([]);
const [hotel, setHotel] = useState([]);
const [estimatedCost, setEstimatedCost] = useState(0);
@@ -77,7 +84,7 @@ const CommonLayout: FC = () => {
.catch((error) => console.error("Error fetching countries:", error));
}, []);
console.log(destinations);
-
+
useEffect(() => {
const lastDestination = destinations[destinations.length - 1];
if (lastDestination?.endCity) {
@@ -87,7 +94,9 @@ const CommonLayout: FC = () => {
.split("/")[2]
.trim()}&to_city=${lastDestination.endCity.split("/")[2].trim()}`
)
- .then((response) => {setTransport(response.data) ;console.log(response);
+ .then((response) => {
+ setTransport(response.data);
+ console.log(response);
})
.catch((error) =>
console.error("Error fetching transport options:", error)
@@ -97,7 +106,9 @@ const CommonLayout: FC = () => {
.get(
`/api/trip/hotels/${lastDestination.endCity.split("/")[2].trim()}/`
)
- .then((response) => {setHotel(response.data.results) ; console.log(response);
+ .then((response) => {
+ setHotel(response.data.results);
+ console.log(response);
})
.catch((error) => console.error("Error fetching hotels:", error));
}
@@ -113,20 +124,8 @@ const CommonLayout: FC = () => {
const calculateTransportCost = (
transport: any,
- adults: number,
- children: number,
- infants: number
+ { adults, children, infants }: Passengers
) => {
- console.log(
- transport,
- adults,
- children,
- infants,
- transport.price * adults +
- transport.price_child * children +
- transport.price_infant * infants
- );
-
return (
transport.price * adults +
transport.price_child * children +
@@ -137,21 +136,8 @@ const CommonLayout: FC = () => {
const calculateHotelCost = (
hotel: any,
days: number,
- adults: number,
- children: number,
- infants: number
+ { adults, children, infants }: Passengers
) => {
- console.log(
- hotel,
- adults,
- children,
- infants,
- (hotel.price_per_day * adults +
- hotel.price_per_day_child * children +
- hotel.price_per_day_infant * infants) * days
-
- );
-
return (
(hotel.price_per_day * adults +
hotel.price_per_day_child * children +
@@ -161,9 +147,8 @@ const CommonLayout: FC = () => {
const updateEstimatedCost = () => {
const totalCost = destinations.reduce((acc, destination) => {
- const transportCost = destination.transportCost * passengers;
- const hotelCost =
- destination.hotelCost * destination.duration * passengers;
+ const transportCost = destination.transportCost;
+ const hotelCost = destination.hotelCost * destination.duration;
return acc + transportCost + hotelCost;
}, 0);
setEstimatedCost(totalCost);
@@ -173,7 +158,7 @@ const CommonLayout: FC = () => {
const isValid =
startCity !== "" &&
startDate !== "" &&
- passengers > 0 &&
+ passengers.adults > 0 &&
destinations.every(
(destination) =>
destination.endCity !== "" &&
@@ -191,7 +176,7 @@ const CommonLayout: FC = () => {
isFormValid &&
startCity !== "" &&
startDate !== "" &&
- passengers > 0;
+ passengers.adults > 0;
setIsContinueValid(isValid);
}, [destinations, startCity, startDate, passengers, isFormValid]);
@@ -228,9 +213,7 @@ const CommonLayout: FC = () => {
);
updatedDestinations[index].transportCost = calculateTransportCost(
selected,
- guestAdultsInputValue,
- guestChildrenInputValue,
- guestInfantsInputValue
+ passengers
);
}
@@ -239,9 +222,7 @@ const CommonLayout: FC = () => {
updatedDestinations[index].hotelCost = calculateHotelCost(
selected,
updatedDestinations[index].duration,
- guestAdultsInputValue,
- guestChildrenInputValue,
- guestInfantsInputValue
+ passengers
);
}
@@ -263,22 +244,13 @@ const CommonLayout: FC = () => {
validateForm();
};
- const handleChangeData = (value: number, type: string) => {
- if (type === "guestAdults") {
- setGuestAdultsInputValue(value);
- } else if (type === "guestChildren") {
- setGuestChildrenInputValue(value);
- } else if (type === "guestInfants") {
- setGuestInfantsInputValue(value);
- }
+ const handleChangeData = (value: number, type: keyof Passengers) => {
+ setPassengers((prev) => ({
+ ...prev,
+ [type]: value,
+ }));
};
- useEffect(() => {
- setPassengers(
- guestAdultsInputValue + guestChildrenInputValue + guestInfantsInputValue
- );
- }, [guestAdultsInputValue, guestChildrenInputValue, guestInfantsInputValue]);
-
const submitTour = async () => {
const formData = {
destinations: destinations.map((destination) => ({
@@ -293,7 +265,7 @@ const CommonLayout: FC = () => {
city: `${startCity.split("/")[0].trim()}-${startCity
.split("/")[1]
.trim()} `,
- number_passenger: `${passengers}`,
+ number_passenger: passengers ,
start_date: startDate.replace(/-/g, "/"),
},
...destinations.reduce<{ [key: number]: any }>(
@@ -330,7 +302,10 @@ const CommonLayout: FC = () => {
Authorization: `token ${user.token}`,
"Content-Type": "application/json",
},
- });
+ }).then((response) => {
+ console.log(response);
+
+ })
toast.success(t("successMessage"));
router.push("/custom-history");
} catch (error) {
@@ -343,21 +318,21 @@ const CommonLayout: FC = () => {