add rstaurant opening hours

This commit is contained in:
2025-11-16 23:45:29 +03:00
parent 73afaea60a
commit 05c190ad5b
8 changed files with 59 additions and 14 deletions

View File

@@ -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;