diff --git a/src/components/frontend/DateTimePicker.jsx b/src/components/frontend/DateTimePicker.jsx
index f0128a9..c4542e3 100644
--- a/src/components/frontend/DateTimePicker.jsx
+++ b/src/components/frontend/DateTimePicker.jsx
@@ -36,9 +36,11 @@ const DateTimePicker = ({
// Only check slots for the selected date
const selectedDateStr = moment(selectedDate).format("YYYY-MM-DD");
return bookedSlots.some((booking) => {
- // booking should have start and end in ISO or parseable format
- const bookingStart = moment(booking.start);
- const bookingEnd = moment(booking.end);
+ // booking should have booking_start_time and booking_end_time in ISO or parseable format
+ const bookingStart = moment(
+ booking.booking_start_time || booking.start_time
+ );
+ const bookingEnd = moment(booking.booking_end_time || booking.end_time);
// Only check if booking is on the same day
if (bookingStart.format("YYYY-MM-DD") !== selectedDateStr) return false;
// If slotTime is within booking range
diff --git a/src/components/frontend/StaticSearchBar.jsx b/src/components/frontend/StaticSearchBar.jsx
index a2e3adb..54ec6a1 100644
--- a/src/components/frontend/StaticSearchBar.jsx
+++ b/src/components/frontend/StaticSearchBar.jsx
@@ -6,6 +6,7 @@ import SearchIcon from "./icons/SearchIcon";
import ReactTestUtils from "react-dom/test-utils";
import { isNotInViewport, sleep } from "@/utils/utils";
import { useForm } from "react-hook-form";
+import CustomLocationAutoCompleteV2 from "../CustomLocationAutoCompleteV2";
import CustomComboBox from "../CustomComboBox";
import { GlobalContext } from "@/globalContext";
import { MagnifyingGlassIcon } from "@heroicons/react/24/solid";
diff --git a/src/pages/Common/Booking/PropertyPage.jsx b/src/pages/Common/Booking/PropertyPage.jsx
index 7f04a84..9c363c1 100644
--- a/src/pages/Common/Booking/PropertyPage.jsx
+++ b/src/pages/Common/Booking/PropertyPage.jsx
@@ -1,6 +1,12 @@
import React, { useContext, useEffect } from "react";
import { useState } from "react";
-import { Link, Navigate, useLocation, useNavigate, useParams } from "react-router-dom";
+import {
+ Link,
+ Navigate,
+ useLocation,
+ useNavigate,
+ useParams,
+} from "react-router-dom";
import FaqAccordion from "@/components/frontend/FaqAccordion";
import ReviewCard from "@/components/frontend/ReviewCard";
@@ -15,7 +21,15 @@ import { GlobalContext } from "@/globalContext";
import FavoriteButton from "@/components/frontend/FavoriteButton";
import Counter from "@/components/frontend/Counter";
import { Tooltip } from "react-tooltip";
-import { usePropertyAddons, usePropertySpace, usePropertySpaceImages, usePublicUserData, usePropertySpaceAmenities, usePropertySpaceFaqs, usePropertySpaceReviews } from "@/hooks/api";
+import {
+ usePropertyAddons,
+ usePropertySpace,
+ usePropertySpaceImages,
+ usePublicUserData,
+ usePropertySpaceAmenities,
+ usePropertySpaceFaqs,
+ usePropertySpaceReviews,
+} from "@/hooks/api";
import PropertyImageSlider from "@/components/frontend/PropertyImageSlider";
import PropertySpaceMapImage from "@/components/frontend/PropertySpaceMapImage";
import AllReviewsModal from "@/components/frontend/AllReviewsModal";
@@ -25,7 +39,8 @@ import CircleCheckIcon from "@/components/frontend/icons/CircleCheckIcon";
let sdk = new MkdSDK();
const PropertyPage = () => {
- const { dispatch: globalDispatch, state: globalState } = useContext(GlobalContext);
+ const { dispatch: globalDispatch, state: globalState } =
+ useContext(GlobalContext);
const { state: authState, dispatch: authDispatch } = useContext(AuthContext);
const { state: spaceData } = useLocation();
const { bookingData, dispatch } = useBookingContext();
@@ -34,7 +49,10 @@ const PropertyPage = () => {
const [fetching, setFetching] = useState(true);
const navigate = useNavigate();
const { id } = useParams();
- const bookingDetails = bookingData?.from === "" ? bookingData : JSON.parse(localStorage.getItem("booking_details"));
+ const bookingDetails =
+ bookingData?.from === ""
+ ? bookingData
+ : JSON.parse(localStorage.getItem("booking_details"));
const [reviewDirection, setReviewDirection] = useState("DESC");
const [bookedSlots, setBookedSlots] = useState([]);
const [scheduleTemplate, setScheduleTemplate] = useState({});
@@ -47,7 +65,11 @@ const PropertyPage = () => {
const { propertySpace, notFound } = usePropertySpace(id, render);
const hostData = usePublicUserData(propertySpace.host_id);
- const spaceImages = usePropertySpaceImages(propertySpace.id, true, setFetching);
+ const spaceImages = usePropertySpaceImages(
+ propertySpace.id,
+ true,
+ setFetching
+ );
const spaceAddons = usePropertyAddons(propertySpace.property_id);
const spaceAmenities = usePropertySpaceAmenities(propertySpace.id);
const faqs = usePropertySpaceFaqs(propertySpace.id);
@@ -56,12 +78,19 @@ const PropertyPage = () => {
const { pathname } = useLocation();
if (!fetching && spaceImages.length === 0) {
- navigate("*")
+ navigate("*");
}
async function fetchBookedSlots(id) {
try {
- const result = await callCustomAPI("customer/schedule", "post", { property_spaces_id: id }, "", null, "v3");
+ const result = await callCustomAPI(
+ "customer/schedule",
+ "post",
+ { property_spaces_id: id },
+ "",
+ null,
+ "v3"
+ );
if (Array.isArray(result.list)) {
setBookedSlots(result.list);
}
@@ -86,11 +115,10 @@ const PropertyPage = () => {
limit: 1,
where: [`property_spaces_id = ${id}`],
},
- "PAGINATE",
+ "PAGINATE"
);
if (Array.isArray(result.list) && result.list.length > 0) {
setScheduleTemplate({ custom_slots: result.list[0].custom_slots });
-
}
if (result.list[0]?.schedule_template_id) {
const templateResult = await callCustomAPI(
@@ -101,9 +129,12 @@ const PropertyPage = () => {
limit: 1,
where: [`id = ${result.list[0].schedule_template_id}`],
},
- "PAGINATE",
+ "PAGINATE"
);
- if (Array.isArray(templateResult.list) && (templateResult.list[0] ?? {})) {
+ if (
+ Array.isArray(templateResult.list) &&
+ (templateResult.list[0] ?? {})
+ ) {
setScheduleTemplate((prev) => {
let updated = { ...prev, ...templateResult.list[0] };
return updated;
@@ -140,15 +171,24 @@ const PropertyPage = () => {
}
if (authState.user == propertySpace.host_id) {
- globalDispatch({ type: "SHOW_ERROR", payload: { heading: "error", message: "Owners can't book their own spaces" } })
- return
+ globalDispatch({
+ type: "SHOW_ERROR",
+ payload: {
+ heading: "error",
+ message: "Owners can't book their own spaces",
+ },
+ });
+ return;
}
if (globalState.user.verificationStatus != 1) {
globalDispatch({ type: "OPEN_NOT_VERIFIED_MODAL" });
return;
}
- dispatch({ type: "SET_BOOKING_DETAILS", payload: { ...data, ...propertySpace } });
+ dispatch({
+ type: "SET_BOOKING_DETAILS",
+ payload: { ...data, ...propertySpace },
+ });
navigate("booking-preview");
};
@@ -169,99 +209,119 @@ const PropertyPage = () => {
return new Date(a.post_date) - new Date(b.post_date);
};
- if (notFound || isNaN(id)) return
+
{propertySpace.description ?? spaceData?.description}
-+ {propertySpace.description ?? spaceData?.description} +
+{propertySpace.first_name}
-{propertySpace.about ?? spaceData?.about}
++ {propertySpace.first_name} +
++ {propertySpace.about ?? spaceData?.about} +
{propertySpace.about ?? spaceData?.about}
++ {propertySpace.about ?? spaceData?.about} +
-{propertySpace.rule ?? spaceData?.rule}
+{propertySpace.rule ?? spaceData?.rule}