add rstaurant opening hours
This commit is contained in:
@@ -9,6 +9,8 @@ import { useAppDispatch, useAppSelector } from "redux/hooks";
|
||||
import { colors, ProBlack2 } from "ThemeConstants";
|
||||
import { Extra, Product, Variant } from "utils/types/appTypes";
|
||||
import styles from "../product.module.css";
|
||||
import { useGetRestaurantDetailsQuery } from "redux/api/others";
|
||||
import { useParams } from "react-router-dom";
|
||||
|
||||
export default function ProductFooter({
|
||||
product,
|
||||
@@ -34,7 +36,10 @@ export default function ProductFooter({
|
||||
const { isMobile, isDesktop } = useBreakPoint();
|
||||
const { isRTL } = useAppSelector((state) => state.locale);
|
||||
const [specialRequest, setSpecialRequest] = useState("");
|
||||
|
||||
const { subdomain } = useParams();
|
||||
const { data: restaurant } = useGetRestaurantDetailsQuery(subdomain, {
|
||||
skip: !subdomain,
|
||||
});
|
||||
// Check if product has any customization options
|
||||
const hasCustomizationOptions = useMemo(() => {
|
||||
const hasVariants = product?.variants?.length > 0;
|
||||
@@ -49,6 +54,11 @@ export default function ProductFooter({
|
||||
]);
|
||||
|
||||
const handleAddToCart = () => {
|
||||
if (restaurant && !restaurant.isOpened) {
|
||||
message.warning(t("menu.restaurantIsClosed"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isValid) {
|
||||
message.error(t("menu.pleaseSelectRequiredOptions"));
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user