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

@@ -283,7 +283,8 @@ export default function CartMobileTabletLayout({
<RewardWaiterCard />
{/* Table Number */}
{orderType === OrderType.DineIn && <TableNumberCard />}
{(orderType === OrderType.DineIn ||
orderType === OrderType.ToOffice) && <TableNumberCard />}
{/* Invoice Summary */}
<OrderSummary />

View File

@@ -1,8 +1,9 @@
import { PlusOutlined } from "@ant-design/icons";
import { Button } from "antd";
import { Button, message } from "antd";
import { useTranslation } from "react-i18next";
import { useNavigate, useParams } from "react-router-dom";
import { useAppSelector } from "redux/hooks.ts";
import { useGetRestaurantDetailsQuery } from "redux/api/others";
import { colors } from "ThemeConstants.ts";
import styles from "./AddToCartButton.module.css";
@@ -12,6 +13,17 @@ export function AddToCartButton() {
const { subdomain } = useParams();
const navigate = useNavigate();
const { data: restaurant } = useGetRestaurantDetailsQuery(subdomain, {
skip: !subdomain,
});
const handleClick = () => {
if (restaurant && !restaurant.isOpened) {
message.warning(t("menu.restaurantIsClosed"));
return;
}
navigate(`/${subdomain}/menu`);
};
return (
<Button
@@ -20,9 +32,7 @@ export function AddToCartButton() {
iconPosition="start"
icon={<PlusOutlined title="add" className={styles.plusIcon} />}
size="small"
onClick={() => {
navigate(`/${subdomain}/menu`);
}}
onClick={handleClick}
className={`${styles.addButton} ${isRTL ? styles.addButtonRTL : styles.addButtonLTR}`}
style={{ backgroundColor: colors.primary }}
>

View File

@@ -190,7 +190,7 @@ export default function ProductCard({ item }: Props) {
height={90}
/>
<AddToCartButton />
{/* <AddToCartButton /> */}
</Badge>
</div>
</div>

View File

@@ -474,6 +474,15 @@
padding: 0 1rem;
}
.openingHours {
position: absolute;
top: 190px;
right: 10px;
font-size: 14px;
font-weight: 600;
color: #666;
}
.restaurantTitle {
font-size: 16px;
font-weight: bold;
@@ -693,4 +702,7 @@
right: -10px !important;
}
:global(.ant-app-rtl) .openingHours {
left: 10px;
right: auto;
}

View File

@@ -126,6 +126,13 @@ function MenuPage() {
{isRTL ? restaurant?.descriptionAR : restaurant?.description}
</ProText>
</div>
<ProText className={styles.openingHours}>
{t("menu.openingHours", {
openingTime: restaurant?.openingTime,
closingTime: restaurant?.closingTime,
})}
</ProText>
</div>
</div>
@@ -137,10 +144,7 @@ function MenuPage() {
<CategoriesList categories={menuData?.categories || []} />
</div>
<MenuList
data={menuData}
categoryRefs={categoryRefs}
/>
<MenuList data={menuData} categoryRefs={categoryRefs} />
</Space>
</div>

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;