add rstaurant opening hours
This commit is contained in:
@@ -153,7 +153,9 @@
|
|||||||
"restaurantCover": "غلاف المطعم",
|
"restaurantCover": "غلاف المطعم",
|
||||||
"restaurantLogo": "شعار المطعم",
|
"restaurantLogo": "شعار المطعم",
|
||||||
"joinUs": "انضم إلى الولاء",
|
"joinUs": "انضم إلى الولاء",
|
||||||
"joinUsDescription": "لتحصل على هدية مجانية"
|
"joinUsDescription": "لتحصل على هدية مجانية",
|
||||||
|
"openingHours": "ساعات العمل: {{openingTime}} - {{closingTime}}",
|
||||||
|
"restaurantIsClosed": "المطعم مغلق"
|
||||||
},
|
},
|
||||||
"cart": {
|
"cart": {
|
||||||
"title": "السلة",
|
"title": "السلة",
|
||||||
@@ -185,7 +187,9 @@
|
|||||||
"specialRequest": "طلب خاص",
|
"specialRequest": "طلب خاص",
|
||||||
"specialRequestPlaceholder": "أي تعليمات خاصة لطلبك؟",
|
"specialRequestPlaceholder": "أي تعليمات خاصة لطلبك؟",
|
||||||
"tableNumber": "رقم الطاولة",
|
"tableNumber": "رقم الطاولة",
|
||||||
|
"selectCompany": "اختر الشركة",
|
||||||
"tableNumberPlaceholder": "اختر طاولتك",
|
"tableNumberPlaceholder": "اختر طاولتك",
|
||||||
|
"selectCompanyPlaceholder": "اختر الشركة",
|
||||||
"coupon": "القسيمة",
|
"coupon": "القسيمة",
|
||||||
"apply": "تطبيق",
|
"apply": "تطبيق",
|
||||||
"viewOffers": "عرض العروض",
|
"viewOffers": "عرض العروض",
|
||||||
|
|||||||
@@ -165,7 +165,9 @@
|
|||||||
"noResultsFound": "No results found",
|
"noResultsFound": "No results found",
|
||||||
"cart": "Cart",
|
"cart": "Cart",
|
||||||
"joinUs": "Join us",
|
"joinUs": "Join us",
|
||||||
"joinUsDescription": "to earn loyalty points"
|
"joinUsDescription": "to earn loyalty points",
|
||||||
|
"openingHours": "Opening Hours: {{openingTime}} - {{closingTime}}",
|
||||||
|
"restaurantIsClosed": "Restaurant is closed"
|
||||||
},
|
},
|
||||||
"cart": {
|
"cart": {
|
||||||
"title": "Cart",
|
"title": "Cart",
|
||||||
@@ -197,7 +199,9 @@
|
|||||||
"specialRequest": "Special Request",
|
"specialRequest": "Special Request",
|
||||||
"specialRequestPlaceholder": "Any special instructions for your order?",
|
"specialRequestPlaceholder": "Any special instructions for your order?",
|
||||||
"tableNumber": "Table Number",
|
"tableNumber": "Table Number",
|
||||||
|
"selectCompany": "Select Company",
|
||||||
"tableNumberPlaceholder": "Select your table",
|
"tableNumberPlaceholder": "Select your table",
|
||||||
|
"selectCompanyPlaceholder": "Select company",
|
||||||
"coupon": "Coupon",
|
"coupon": "Coupon",
|
||||||
"apply": "Apply",
|
"apply": "Apply",
|
||||||
"viewOffers": "View Offers",
|
"viewOffers": "View Offers",
|
||||||
|
|||||||
@@ -283,7 +283,8 @@ export default function CartMobileTabletLayout({
|
|||||||
<RewardWaiterCard />
|
<RewardWaiterCard />
|
||||||
|
|
||||||
{/* Table Number */}
|
{/* Table Number */}
|
||||||
{orderType === OrderType.DineIn && <TableNumberCard />}
|
{(orderType === OrderType.DineIn ||
|
||||||
|
orderType === OrderType.ToOffice) && <TableNumberCard />}
|
||||||
|
|
||||||
{/* Invoice Summary */}
|
{/* Invoice Summary */}
|
||||||
<OrderSummary />
|
<OrderSummary />
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
import { PlusOutlined } from "@ant-design/icons";
|
import { PlusOutlined } from "@ant-design/icons";
|
||||||
import { Button } from "antd";
|
import { Button, message } from "antd";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { useNavigate, useParams } from "react-router-dom";
|
import { useNavigate, useParams } from "react-router-dom";
|
||||||
import { useAppSelector } from "redux/hooks.ts";
|
import { useAppSelector } from "redux/hooks.ts";
|
||||||
|
import { useGetRestaurantDetailsQuery } from "redux/api/others";
|
||||||
import { colors } from "ThemeConstants.ts";
|
import { colors } from "ThemeConstants.ts";
|
||||||
import styles from "./AddToCartButton.module.css";
|
import styles from "./AddToCartButton.module.css";
|
||||||
|
|
||||||
@@ -12,6 +13,17 @@ export function AddToCartButton() {
|
|||||||
|
|
||||||
const { subdomain } = useParams();
|
const { subdomain } = useParams();
|
||||||
const navigate = useNavigate();
|
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 (
|
return (
|
||||||
<Button
|
<Button
|
||||||
@@ -20,9 +32,7 @@ export function AddToCartButton() {
|
|||||||
iconPosition="start"
|
iconPosition="start"
|
||||||
icon={<PlusOutlined title="add" className={styles.plusIcon} />}
|
icon={<PlusOutlined title="add" className={styles.plusIcon} />}
|
||||||
size="small"
|
size="small"
|
||||||
onClick={() => {
|
onClick={handleClick}
|
||||||
navigate(`/${subdomain}/menu`);
|
|
||||||
}}
|
|
||||||
className={`${styles.addButton} ${isRTL ? styles.addButtonRTL : styles.addButtonLTR}`}
|
className={`${styles.addButton} ${isRTL ? styles.addButtonRTL : styles.addButtonLTR}`}
|
||||||
style={{ backgroundColor: colors.primary }}
|
style={{ backgroundColor: colors.primary }}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -190,7 +190,7 @@ export default function ProductCard({ item }: Props) {
|
|||||||
height={90}
|
height={90}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<AddToCartButton />
|
{/* <AddToCartButton /> */}
|
||||||
</Badge>
|
</Badge>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -474,6 +474,15 @@
|
|||||||
padding: 0 1rem;
|
padding: 0 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.openingHours {
|
||||||
|
position: absolute;
|
||||||
|
top: 190px;
|
||||||
|
right: 10px;
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
|
||||||
.restaurantTitle {
|
.restaurantTitle {
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
@@ -693,4 +702,7 @@
|
|||||||
right: -10px !important;
|
right: -10px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
:global(.ant-app-rtl) .openingHours {
|
||||||
|
left: 10px;
|
||||||
|
right: auto;
|
||||||
|
}
|
||||||
|
|||||||
@@ -126,6 +126,13 @@ function MenuPage() {
|
|||||||
{isRTL ? restaurant?.descriptionAR : restaurant?.description}
|
{isRTL ? restaurant?.descriptionAR : restaurant?.description}
|
||||||
</ProText>
|
</ProText>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<ProText className={styles.openingHours}>
|
||||||
|
{t("menu.openingHours", {
|
||||||
|
openingTime: restaurant?.openingTime,
|
||||||
|
closingTime: restaurant?.closingTime,
|
||||||
|
})}
|
||||||
|
</ProText>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -137,10 +144,7 @@ function MenuPage() {
|
|||||||
<CategoriesList categories={menuData?.categories || []} />
|
<CategoriesList categories={menuData?.categories || []} />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<MenuList
|
<MenuList data={menuData} categoryRefs={categoryRefs} />
|
||||||
data={menuData}
|
|
||||||
categoryRefs={categoryRefs}
|
|
||||||
/>
|
|
||||||
</Space>
|
</Space>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ import { useAppDispatch, useAppSelector } from "redux/hooks";
|
|||||||
import { colors, ProBlack2 } from "ThemeConstants";
|
import { colors, ProBlack2 } from "ThemeConstants";
|
||||||
import { Extra, Product, Variant } from "utils/types/appTypes";
|
import { Extra, Product, Variant } from "utils/types/appTypes";
|
||||||
import styles from "../product.module.css";
|
import styles from "../product.module.css";
|
||||||
|
import { useGetRestaurantDetailsQuery } from "redux/api/others";
|
||||||
|
import { useParams } from "react-router-dom";
|
||||||
|
|
||||||
export default function ProductFooter({
|
export default function ProductFooter({
|
||||||
product,
|
product,
|
||||||
@@ -34,7 +36,10 @@ export default function ProductFooter({
|
|||||||
const { isMobile, isDesktop } = useBreakPoint();
|
const { isMobile, isDesktop } = useBreakPoint();
|
||||||
const { isRTL } = useAppSelector((state) => state.locale);
|
const { isRTL } = useAppSelector((state) => state.locale);
|
||||||
const [specialRequest, setSpecialRequest] = useState("");
|
const [specialRequest, setSpecialRequest] = useState("");
|
||||||
|
const { subdomain } = useParams();
|
||||||
|
const { data: restaurant } = useGetRestaurantDetailsQuery(subdomain, {
|
||||||
|
skip: !subdomain,
|
||||||
|
});
|
||||||
// Check if product has any customization options
|
// Check if product has any customization options
|
||||||
const hasCustomizationOptions = useMemo(() => {
|
const hasCustomizationOptions = useMemo(() => {
|
||||||
const hasVariants = product?.variants?.length > 0;
|
const hasVariants = product?.variants?.length > 0;
|
||||||
@@ -49,6 +54,11 @@ export default function ProductFooter({
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
const handleAddToCart = () => {
|
const handleAddToCart = () => {
|
||||||
|
if (restaurant && !restaurant.isOpened) {
|
||||||
|
message.warning(t("menu.restaurantIsClosed"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!isValid) {
|
if (!isValid) {
|
||||||
message.error(t("menu.pleaseSelectRequiredOptions"));
|
message.error(t("menu.pleaseSelectRequiredOptions"));
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user