fixes
This commit is contained in:
@@ -38,7 +38,10 @@ export default function TableNumberCard() {
|
|||||||
mode="multiple"
|
mode="multiple"
|
||||||
placeholder={t("cart.tableNumber")}
|
placeholder={t("cart.tableNumber")}
|
||||||
size="large"
|
size="large"
|
||||||
options={tableList}
|
options={tableList?.map((table: any) => ({
|
||||||
|
label: table.name,
|
||||||
|
value: table.id,
|
||||||
|
}))}
|
||||||
style={{
|
style={{
|
||||||
width: "100%",
|
width: "100%",
|
||||||
height: 50,
|
height: 50,
|
||||||
|
|||||||
@@ -4,24 +4,24 @@ import { useEffect } from "react";
|
|||||||
|
|
||||||
// Cart storage keys - same as in CartContext
|
// Cart storage keys - same as in CartContext
|
||||||
const CART_STORAGE_KEYS = {
|
const CART_STORAGE_KEYS = {
|
||||||
ITEMS: 'fascano_cart_items',
|
ITEMS: "fascano_cart_items",
|
||||||
SPECIAL_REQUEST: 'fascano_special_request',
|
SPECIAL_REQUEST: "fascano_special_request",
|
||||||
COUPON: 'fascano_coupon',
|
COUPON: "fascano_coupon",
|
||||||
TIP: 'fascano_tip',
|
TIP: "fascano_tip",
|
||||||
TABLES: 'fascano_tables',
|
TABLES: "fascano_tables",
|
||||||
LOCATION: 'fascano_location',
|
LOCATION: "fascano_location",
|
||||||
ROOM_DETAILS: 'fascano_room_details',
|
ROOM_DETAILS: "fascano_room_details",
|
||||||
OFFICE_DETAILS: 'fascano_office_details',
|
OFFICE_DETAILS: "fascano_office_details",
|
||||||
GIFT_DETAILS: 'fascano_gift_details',
|
GIFT_DETAILS: "fascano_gift_details",
|
||||||
ESTIMATE_TIME: 'fascano_estimate_time',
|
ESTIMATE_TIME: "fascano_estimate_time",
|
||||||
ESTIMATE_TIME_DATE: 'fascano_estimate_time_date',
|
ESTIMATE_TIME_DATE: "fascano_estimate_time_date",
|
||||||
ESTIMATE_TIME_TIME: 'fascano_estimate_time_time',
|
ESTIMATE_TIME_TIME: "fascano_estimate_time_time",
|
||||||
COLLECTION_METHOD: 'fascano_collection_method',
|
COLLECTION_METHOD: "fascano_collection_method",
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
const clearCartFromLocalStorage = () => {
|
const clearCartFromLocalStorage = () => {
|
||||||
// Clear all cart-related data from localStorage
|
// Clear all cart-related data from localStorage
|
||||||
Object.values(CART_STORAGE_KEYS).forEach(key => {
|
Object.values(CART_STORAGE_KEYS).forEach((key) => {
|
||||||
localStorage.removeItem(key);
|
localStorage.removeItem(key);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@@ -29,26 +29,27 @@ const clearCartFromLocalStorage = () => {
|
|||||||
export default function LocalStorageHandler({
|
export default function LocalStorageHandler({
|
||||||
restaurantID,
|
restaurantID,
|
||||||
restaurantName,
|
restaurantName,
|
||||||
orderType,
|
|
||||||
}: {
|
}: {
|
||||||
restaurantID: string;
|
restaurantID: string;
|
||||||
restaurantName: string;
|
restaurantName: string;
|
||||||
orderType: string;
|
|
||||||
}) {
|
}) {
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// Check if restaurant has changed
|
// Check if restaurant has changed
|
||||||
const currentStoredRestaurantID = localStorage.getItem("restaurantID");
|
const currentStoredRestaurantID = localStorage.getItem("restaurantID");
|
||||||
|
|
||||||
// If there's a stored restaurant ID and it's different from the current one, clear the cart
|
// If there's a stored restaurant ID and it's different from the current one, clear the cart
|
||||||
if (currentStoredRestaurantID && currentStoredRestaurantID !== restaurantID) {
|
if (
|
||||||
|
currentStoredRestaurantID &&
|
||||||
|
currentStoredRestaurantID !== restaurantID
|
||||||
|
) {
|
||||||
clearCartFromLocalStorage();
|
clearCartFromLocalStorage();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update localStorage with new values
|
// Update localStorage with new values
|
||||||
localStorage.setItem("restaurantID", restaurantID);
|
localStorage.setItem("restaurantID", restaurantID);
|
||||||
localStorage.setItem("restaurantName", restaurantName);
|
localStorage.setItem("restaurantName", restaurantName);
|
||||||
localStorage.setItem("orderType", orderType);
|
// localStorage.setItem("orderType", orderType);
|
||||||
}, [restaurantID, restaurantName, orderType]);
|
}, [restaurantID, restaurantName]);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import ProTitle from "components/ProTitle";
|
|||||||
import { useScrollHandler } from "contexts/ScrollHandlerContext";
|
import { useScrollHandler } from "contexts/ScrollHandlerContext";
|
||||||
import useBreakPoint from "hooks/useBreakPoint";
|
import useBreakPoint from "hooks/useBreakPoint";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { useParams, useSearchParams } from "react-router-dom";
|
import { useParams } from "react-router-dom";
|
||||||
import {
|
import {
|
||||||
useGetMenuQuery,
|
useGetMenuQuery,
|
||||||
useGetRestaurantDetailsQuery,
|
useGetRestaurantDetailsQuery,
|
||||||
@@ -28,8 +28,6 @@ import styles from "./menu.module.css";
|
|||||||
|
|
||||||
function MenuPage() {
|
function MenuPage() {
|
||||||
const { id } = useParams();
|
const { id } = useParams();
|
||||||
const [searchParams] = useSearchParams();
|
|
||||||
const orderType = searchParams.get("orderType");
|
|
||||||
const { isRTL } = useAppSelector((state) => state.locale);
|
const { isRTL } = useAppSelector((state) => state.locale);
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { data: restaurantDetails, isLoading: isLoadingRestaurant } =
|
const { data: restaurantDetails, isLoading: isLoadingRestaurant } =
|
||||||
@@ -45,7 +43,6 @@ function MenuPage() {
|
|||||||
);
|
);
|
||||||
const { categoryRefs } = useScrollHandler();
|
const { categoryRefs } = useScrollHandler();
|
||||||
const { isMobile, isTablet, isDesktop } = useBreakPoint();
|
const { isMobile, isTablet, isDesktop } = useBreakPoint();
|
||||||
|
|
||||||
const isLoading = isLoadingRestaurant || isLoadingMenu;
|
const isLoading = isLoadingRestaurant || isLoadingMenu;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -53,7 +50,6 @@ function MenuPage() {
|
|||||||
<LocalStorageHandler
|
<LocalStorageHandler
|
||||||
restaurantID={restaurant?.id || ""}
|
restaurantID={restaurant?.id || ""}
|
||||||
restaurantName={restaurant?.subdomain || ""}
|
restaurantName={restaurant?.subdomain || ""}
|
||||||
orderType={orderType || ""}
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{isLoading ? (
|
{isLoading ? (
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import ProHeader from "components/ProHeader/ProHeader";
|
|||||||
import ProInputCard from "components/ProInputCard/ProInputCard";
|
import ProInputCard from "components/ProInputCard/ProInputCard";
|
||||||
import ProText from "components/ProText";
|
import ProText from "components/ProText";
|
||||||
import ProTitle from "components/ProTitle";
|
import ProTitle from "components/ProTitle";
|
||||||
|
import dayjs from "dayjs";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { useParams } from "react-router-dom";
|
import { useParams } from "react-router-dom";
|
||||||
import { useGetOrderDetailsQuery } from "redux/api/others";
|
import { useGetOrderDetailsQuery } from "redux/api/others";
|
||||||
@@ -71,6 +72,7 @@ export default function OrderPage() {
|
|||||||
className={styles.profileImage}
|
className={styles.profileImage}
|
||||||
width={50}
|
width={50}
|
||||||
height={50}
|
height={50}
|
||||||
|
preview={false}
|
||||||
/>
|
/>
|
||||||
</Button>
|
</Button>
|
||||||
<div>
|
<div>
|
||||||
@@ -105,7 +107,10 @@ export default function OrderPage() {
|
|||||||
</ProText>
|
</ProText>
|
||||||
<TimeIcon className={styles.timeIcon} />
|
<TimeIcon className={styles.timeIcon} />
|
||||||
<ProText type="secondary" style={{ fontSize: "14px" }}>
|
<ProText type="secondary" style={{ fontSize: "14px" }}>
|
||||||
ordered :- Today - {orderDetails?.status[0]?.pivot?.created_at.split(" ")[1]} PM
|
ordered :- Today -{" "}
|
||||||
|
{dayjs(orderDetails?.status[0]?.pivot?.created_at).format(
|
||||||
|
"h:mm A",
|
||||||
|
)}
|
||||||
</ProText>
|
</ProText>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -87,7 +87,6 @@ export default function RestaurantPage() {
|
|||||||
<LocalStorageHandler
|
<LocalStorageHandler
|
||||||
restaurantID={restaurant.id}
|
restaurantID={restaurant.id}
|
||||||
restaurantName={restaurant.subdomain}
|
restaurantName={restaurant.subdomain}
|
||||||
orderType=""
|
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user