Compare commits
9 Commits
046773cb8b
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| e86966062a | |||
| 3fe0c68526 | |||
| 5cb681c4a8 | |||
| f97b83062c | |||
| 69425580d6 | |||
| 8083e9ec96 | |||
| 4dfa08d26c | |||
| 788b05d6f4 | |||
| 0ce2d320a8 |
BIN
public/thawani.png
Normal file
BIN
public/thawani.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.2 KiB |
@@ -170,7 +170,17 @@
|
|||||||
"justXMorePurchasesToUnlockYourFREEItem": "فقط {{cups}} أكثر للفتح الوجبة المجانية!",
|
"justXMorePurchasesToUnlockYourFREEItem": "فقط {{cups}} أكثر للفتح الوجبة المجانية!",
|
||||||
"youreJustXCupsAwayFromYourNextReward": "🎉 أنت فقط {{cups}} أكثر للحصول على المكافأة التالية!",
|
"youreJustXCupsAwayFromYourNextReward": "🎉 أنت فقط {{cups}} أكثر للحصول على المكافأة التالية!",
|
||||||
"callWaiter": "اتصل بالرادير",
|
"callWaiter": "اتصل بالرادير",
|
||||||
"balance": "الرصيد"
|
"balance": "الرصيد",
|
||||||
|
"closed": "مغلق",
|
||||||
|
"sunday": "الأحد",
|
||||||
|
"monday": "الإثنين",
|
||||||
|
"tuesday": "الثلاثاء",
|
||||||
|
"wednesday": "الأربعاء",
|
||||||
|
"thursday": "الخميس",
|
||||||
|
"friday": "الجمعة",
|
||||||
|
"saturday": "السبت",
|
||||||
|
"selectYourTable": "اختر طاولتك",
|
||||||
|
"calledWaiterSuccess": "تم اتصال الرادير بنجاح"
|
||||||
},
|
},
|
||||||
"cart": {
|
"cart": {
|
||||||
"addSpecialRequestOptional": "إضافة طلب خاص (اختياري)",
|
"addSpecialRequestOptional": "إضافة طلب خاص (اختياري)",
|
||||||
@@ -279,8 +289,8 @@
|
|||||||
"cannotSelectPastDate": "لا يمكنك اختيار تاريخ سابق. يرجى اختيار اليوم أو تاريخ مستقبلي.",
|
"cannotSelectPastDate": "لا يمكنك اختيار تاريخ سابق. يرجى اختيار اليوم أو تاريخ مستقبلي.",
|
||||||
"checkRequiredFields": "يرجى التحقق من الحقول المطلوبة",
|
"checkRequiredFields": "يرجى التحقق من الحقول المطلوبة",
|
||||||
"loyalty": "ولاء",
|
"loyalty": "ولاء",
|
||||||
"vatTax": "ضريبة (القيمة المضافة)",
|
"vat": "ضريبة القيمة المضافة ({{value}}%))",
|
||||||
"otherTaxes": "ضريبة (أخرى)"
|
"otherTaxes": "{{name}} ({{value}}%)"
|
||||||
},
|
},
|
||||||
"checkout": {
|
"checkout": {
|
||||||
"addCarDetails": "إضافة تفاصيل السيارة",
|
"addCarDetails": "إضافة تفاصيل السيارة",
|
||||||
@@ -325,7 +335,9 @@
|
|||||||
"change": "تغيير",
|
"change": "تغيير",
|
||||||
"pickup": "استلام",
|
"pickup": "استلام",
|
||||||
"setPickupTime": "تحديد وقت الاستلام",
|
"setPickupTime": "تحديد وقت الاستلام",
|
||||||
"carPlateNumber": "رقم لوحة السيارة"
|
"carPlateNumber": "رقم لوحة السيارة",
|
||||||
|
"noItems": "لا يوجد عناصر في السلة",
|
||||||
|
"thawani": "ثواني"
|
||||||
},
|
},
|
||||||
"address": {
|
"address": {
|
||||||
"title": "العنوان",
|
"title": "العنوان",
|
||||||
|
|||||||
@@ -182,7 +182,17 @@
|
|||||||
"justXMorePurchasesToUnlockYourFREEItem": "Just {{cups}} more purchases to unlock your FREE item!",
|
"justXMorePurchasesToUnlockYourFREEItem": "Just {{cups}} more purchases to unlock your FREE item!",
|
||||||
"youreJustXCupsAwayFromYourNextReward": "🎉 You're just {{cups}} stamps away from your next reward!",
|
"youreJustXCupsAwayFromYourNextReward": "🎉 You're just {{cups}} stamps away from your next reward!",
|
||||||
"callWaiter": "Call Waiter",
|
"callWaiter": "Call Waiter",
|
||||||
"balance": "Balance"
|
"balance": "Balance",
|
||||||
|
"closed": "Closed",
|
||||||
|
"sunday": "Sunday",
|
||||||
|
"monday": "Monday",
|
||||||
|
"tuesday": "Tuesday",
|
||||||
|
"wednesday": "Wednesday",
|
||||||
|
"thursday": "Thursday",
|
||||||
|
"friday": "Friday",
|
||||||
|
"saturday": "Saturday",
|
||||||
|
"selectYourTable": "Select your table",
|
||||||
|
"calledWaiterSuccess": "Waiter has been called successfully"
|
||||||
},
|
},
|
||||||
"cart": {
|
"cart": {
|
||||||
"remainingToPay": "Remaining to Pay",
|
"remainingToPay": "Remaining to Pay",
|
||||||
@@ -296,8 +306,8 @@
|
|||||||
"checkRequiredFields": "Please check required fields",
|
"checkRequiredFields": "Please check required fields",
|
||||||
"applyYourAvailableRewardsToGetDiscountsOnItemsInYourCart": "Apply your available rewards to get discounts on items in your cart",
|
"applyYourAvailableRewardsToGetDiscountsOnItemsInYourCart": "Apply your available rewards to get discounts on items in your cart",
|
||||||
"loyalty": "Loyalty",
|
"loyalty": "Loyalty",
|
||||||
"vatTax": "Tax (Vat)",
|
"vat": "Vat ({{value}}%)",
|
||||||
"otherTaxes": "Tax (Other)"
|
"otherTaxes": "{{name}} ({{value}}%)"
|
||||||
},
|
},
|
||||||
"checkout": {
|
"checkout": {
|
||||||
"addCarDetails": "Add Car Details",
|
"addCarDetails": "Add Car Details",
|
||||||
@@ -344,7 +354,9 @@
|
|||||||
"change": "Change",
|
"change": "Change",
|
||||||
"pickup": "Pickup",
|
"pickup": "Pickup",
|
||||||
"setPickupTime": "Set Pickup Time",
|
"setPickupTime": "Set Pickup Time",
|
||||||
"carPlateNumber": "Car Plate Number"
|
"carPlateNumber": "Car Plate Number",
|
||||||
|
"noItems": "No items in cart",
|
||||||
|
"thawani": "Thawani"
|
||||||
},
|
},
|
||||||
"address": {
|
"address": {
|
||||||
"title": "Address",
|
"title": "Address",
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ const ArabicPrice: React.FC<ArabicPriceProps> = ({
|
|||||||
|
|
||||||
// Format the price to ensure it has 2 decimal places
|
// Format the price to ensure it has 2 decimal places
|
||||||
const formattedPrice =
|
const formattedPrice =
|
||||||
typeof price === "number" ? formatPriceUi(price, 3) : price;
|
typeof price === "number" ? formatPriceUi(price, restaurant?.currency_decimals ?? 3) : price;
|
||||||
const { textDecoration, ...restStyle } = style;
|
const { textDecoration, ...restStyle } = style;
|
||||||
const decorationStyle = textDecoration
|
const decorationStyle = textDecoration
|
||||||
? ({ textDecoration } as React.CSSProperties)
|
? ({ textDecoration } as React.CSSProperties)
|
||||||
|
|||||||
@@ -1,22 +1,58 @@
|
|||||||
import { Button } from "antd";
|
import { Card } from "antd";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { ProBottomSheet } from "../ProBottomSheet/ProBottomSheet";
|
import { ProBottomSheet } from "../ProBottomSheet/ProBottomSheet";
|
||||||
import ProText from "components/ProText";
|
import ProText from "components/ProText";
|
||||||
import ProTitle from "components/ProTitle";
|
import ProTitle from "components/ProTitle";
|
||||||
import { useAppSelector } from "redux/hooks";
|
import { useAppSelector } from "redux/hooks";
|
||||||
|
import { useGetOpeningTimesQuery } from "redux/api/others";
|
||||||
|
import { useMemo } from "react";
|
||||||
|
import TimeIcon from "components/Icons/order/TimeIcon";
|
||||||
|
|
||||||
interface OpeningTimesBottomSheetProps {
|
interface OpeningTimesBottomSheetProps {
|
||||||
isOpen: boolean;
|
isOpen: boolean;
|
||||||
onClose: () => void;
|
onClose: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
const textStyle: React.CSSProperties = {
|
// Helper function to format time (HH:mm to 12h format)
|
||||||
fontWeight: 400,
|
const formatTime = (time: string | null | undefined): string => {
|
||||||
fontStyle: "Regular",
|
if (!time) return "";
|
||||||
fontSize: 14,
|
|
||||||
lineHeight: "140%",
|
// If already in 12h format (contains AM/PM), return as is
|
||||||
letterSpacing: "0%",
|
if (time.includes("AM") || time.includes("PM")) {
|
||||||
marginBottom: 4,
|
return time;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parse 24h format (HH:mm)
|
||||||
|
const [hours, minutes] = time.split(":");
|
||||||
|
const hour24 = parseInt(hours, 10);
|
||||||
|
|
||||||
|
if (isNaN(hour24)) return time;
|
||||||
|
|
||||||
|
const hour12 = hour24 % 12 || 12;
|
||||||
|
const ampm = hour24 >= 12 ? "PM" : "AM";
|
||||||
|
return `${hour12}:${minutes} ${ampm}`;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Helper function to get time ranges for a day
|
||||||
|
const getDayTimes = (
|
||||||
|
openingTimes: any,
|
||||||
|
dayIndex: number,
|
||||||
|
): { shift1: string | null; shift2: string | null } => {
|
||||||
|
if (!openingTimes) {
|
||||||
|
return { shift1: null, shift2: null };
|
||||||
|
}
|
||||||
|
|
||||||
|
const from1 = openingTimes[`${dayIndex}_from` as keyof typeof openingTimes];
|
||||||
|
const to1 = openingTimes[`${dayIndex}_to` as keyof typeof openingTimes];
|
||||||
|
const from2 = openingTimes[`2_${dayIndex}_from` as keyof typeof openingTimes];
|
||||||
|
const to2 = openingTimes[`2_${dayIndex}_to` as keyof typeof openingTimes];
|
||||||
|
|
||||||
|
const shift1 =
|
||||||
|
from1 && to1 ? `${formatTime(from1)} - ${formatTime(to1)}` : null;
|
||||||
|
const shift2 =
|
||||||
|
from2 && to2 ? `${formatTime(from2)} - ${formatTime(to2)}` : null;
|
||||||
|
|
||||||
|
return { shift1, shift2 };
|
||||||
};
|
};
|
||||||
|
|
||||||
export function OpeningTimesBottomSheet({
|
export function OpeningTimesBottomSheet({
|
||||||
@@ -26,6 +62,12 @@ export function OpeningTimesBottomSheet({
|
|||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { isRTL } = useAppSelector((state) => state.locale);
|
const { isRTL } = useAppSelector((state) => state.locale);
|
||||||
const { restaurant } = useAppSelector((state) => state.order);
|
const { restaurant } = useAppSelector((state) => state.order);
|
||||||
|
const { data: openingTimes } = useGetOpeningTimesQuery(
|
||||||
|
restaurant?.restautantId,
|
||||||
|
{
|
||||||
|
skip: !restaurant?.restautantId,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
const days = [
|
const days = [
|
||||||
"sunday",
|
"sunday",
|
||||||
@@ -37,7 +79,11 @@ export function OpeningTimesBottomSheet({
|
|||||||
"saturday",
|
"saturday",
|
||||||
];
|
];
|
||||||
const todayIndex = new Date().getDay();
|
const todayIndex = new Date().getDay();
|
||||||
const todayDay = days[todayIndex];
|
|
||||||
|
// Memoize day times to avoid recalculating on every render
|
||||||
|
const dayTimes = useMemo(() => {
|
||||||
|
return days.map((_, index) => getDayTimes(openingTimes, index));
|
||||||
|
}, [openingTimes]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ProBottomSheet
|
<ProBottomSheet
|
||||||
@@ -46,170 +92,205 @@ export function OpeningTimesBottomSheet({
|
|||||||
title={t("menu.openingTimes")}
|
title={t("menu.openingTimes")}
|
||||||
showCloseButton={false}
|
showCloseButton={false}
|
||||||
initialSnap={1}
|
initialSnap={1}
|
||||||
height={445}
|
height={600}
|
||||||
snapPoints={[445]}
|
snapPoints={[600]}
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
display: "flex",
|
display: "flex",
|
||||||
flexDirection: "column",
|
flexDirection: "column",
|
||||||
padding: 20,
|
padding: "20px 0",
|
||||||
|
gap: 20,
|
||||||
|
maxHeight: "calc(600px - 120px)",
|
||||||
|
overflowY: "auto",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<ProTitle level={5}>{t("menu.address")}</ProTitle>
|
{/* Address Section */}
|
||||||
<ProText type="secondary">
|
<Card
|
||||||
{isRTL ? restaurant?.addressAR : restaurant?.address}
|
bordered={false}
|
||||||
</ProText>
|
style={{
|
||||||
|
backgroundColor: "#f8f9fa",
|
||||||
|
borderRadius: 12,
|
||||||
|
boxShadow: "none",
|
||||||
|
}}
|
||||||
|
bodyStyle={{ padding: "16px" }}
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
display: "flex",
|
||||||
|
flexDirection: "column",
|
||||||
|
gap: 8,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<ProTitle
|
||||||
|
level={5}
|
||||||
|
style={{
|
||||||
|
marginBottom: 0,
|
||||||
|
fontSize: 16,
|
||||||
|
fontWeight: 600,
|
||||||
|
color: "#333",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{t("menu.address")}
|
||||||
|
</ProTitle>
|
||||||
|
<ProText
|
||||||
|
type="secondary"
|
||||||
|
style={{
|
||||||
|
fontSize: 14,
|
||||||
|
lineHeight: "20px",
|
||||||
|
color: "#666",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{isRTL ? restaurant?.addressAR : restaurant?.address}
|
||||||
|
</ProText>
|
||||||
|
</div>
|
||||||
|
</Card>
|
||||||
|
|
||||||
<ProTitle level={5}>{t("menu.openingTimes")}</ProTitle>
|
{/* Opening Times Section */}
|
||||||
<div style={{ display: "flex", justifyContent: "space-between" }}>
|
<div style={{ display: "flex", flexDirection: "column", gap: 16 }}>
|
||||||
<ProText
|
<div
|
||||||
type="secondary"
|
|
||||||
style={{
|
style={{
|
||||||
...textStyle,
|
display: "flex",
|
||||||
fontWeight: todayDay === "sunday" ? 700 : 400,
|
alignItems: "center",
|
||||||
|
gap: 8,
|
||||||
|
marginBottom: 4,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
sunday
|
<TimeIcon color="#333" />
|
||||||
</ProText>
|
<ProTitle
|
||||||
<ProText
|
level={5}
|
||||||
type="secondary"
|
style={{
|
||||||
|
marginBottom: 0,
|
||||||
|
fontSize: 16,
|
||||||
|
fontWeight: 600,
|
||||||
|
color: "#333",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{t("menu.openingTimes")}
|
||||||
|
</ProTitle>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div
|
||||||
style={{
|
style={{
|
||||||
...textStyle,
|
display: "flex",
|
||||||
fontWeight: todayDay === "sunday" ? 700 : 400,
|
flexDirection: "column",
|
||||||
|
gap: 8,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
10:00 AM to 10:00 PM
|
{days.map((day, index) => {
|
||||||
</ProText>
|
const isToday = index === todayIndex;
|
||||||
</div>
|
const { shift1, shift2 } = dayTimes[index];
|
||||||
<div style={{ display: "flex", justifyContent: "space-between" }}>
|
const hasShifts = shift1 || shift2;
|
||||||
<ProText
|
|
||||||
type="secondary"
|
return (
|
||||||
style={{
|
<Card
|
||||||
...textStyle,
|
key={day}
|
||||||
fontWeight: todayDay === "monday" ? 700 : 400,
|
bordered
|
||||||
}}
|
style={{
|
||||||
>
|
borderRadius: 12,
|
||||||
monday
|
borderColor: isToday ? "#1890ff" : "#e8e8e8",
|
||||||
</ProText>
|
borderWidth: isToday ? 2 : 1,
|
||||||
<ProText
|
backgroundColor: isToday ? "#f0f8ff" : "#ffffff",
|
||||||
type="secondary"
|
boxShadow: isToday
|
||||||
style={{
|
? "0 2px 8px rgba(24, 144, 255, 0.15)"
|
||||||
...textStyle,
|
: "0 1px 2px rgba(0, 0, 0, 0.05)",
|
||||||
fontWeight: todayDay === "monday" ? 700 : 400,
|
transition: "all 0.2s ease",
|
||||||
}}
|
}}
|
||||||
>
|
bodyStyle={{ padding: "14px 16px" }}
|
||||||
10:00 AM to 10:00 PM
|
>
|
||||||
</ProText>
|
<div
|
||||||
</div>
|
style={{
|
||||||
<div style={{ display: "flex", justifyContent: "space-between"}}>
|
display: "flex",
|
||||||
<ProText
|
justifyContent: "space-between",
|
||||||
type="secondary"
|
alignItems: "center",
|
||||||
style={{
|
gap: 16,
|
||||||
...textStyle,
|
}}
|
||||||
fontWeight: todayDay === "tuesday" ? 700 : 400,
|
>
|
||||||
}}
|
<div
|
||||||
>
|
style={{
|
||||||
tuesday
|
display: "flex",
|
||||||
</ProText>
|
alignItems: "center",
|
||||||
<ProText
|
gap: 12,
|
||||||
type="secondary"
|
flex: 1,
|
||||||
style={{
|
}}
|
||||||
...textStyle,
|
>
|
||||||
fontWeight: todayDay === "tuesday" ? 700 : 400,
|
{isToday && (
|
||||||
}}
|
<div
|
||||||
>
|
style={{
|
||||||
10:00 AM to 10:00 PM
|
width: 6,
|
||||||
</ProText>
|
height: 6,
|
||||||
</div>
|
borderRadius: "50%",
|
||||||
<div style={{ display: "flex", justifyContent: "space-between" }}>
|
backgroundColor: "#1890ff",
|
||||||
<ProText
|
flexShrink: 0,
|
||||||
type="secondary"
|
}}
|
||||||
style={{
|
/>
|
||||||
...textStyle,
|
)}
|
||||||
fontWeight: todayDay === "wednesday" ? 700 : 400,
|
<ProText
|
||||||
}}
|
style={{
|
||||||
>
|
fontSize: 15,
|
||||||
wednesday
|
fontWeight: isToday ? 600 : 500,
|
||||||
</ProText>
|
color: isToday ? "#1890ff" : "#333",
|
||||||
<ProText
|
textTransform: "capitalize",
|
||||||
type="secondary"
|
}}
|
||||||
style={{
|
>
|
||||||
...textStyle,
|
{t(`menu.${day}`)}
|
||||||
fontWeight: todayDay === "wednesday" ? 700 : 400,
|
</ProText>
|
||||||
}}
|
</div>
|
||||||
>
|
|
||||||
10:00 AM to 10:00 PM
|
<div
|
||||||
</ProText>
|
style={{
|
||||||
</div>
|
display: "flex",
|
||||||
<div style={{ display: "flex", justifyContent: "space-between" }}>
|
flexDirection: "column",
|
||||||
<ProText
|
alignItems: isRTL ? "flex-start" : "flex-end",
|
||||||
type="secondary"
|
gap: shift2 ? 4 : 0,
|
||||||
style={{
|
flex: 1,
|
||||||
...textStyle,
|
}}
|
||||||
fontWeight: todayDay === "thursday" ? 700 : 400,
|
>
|
||||||
}}
|
{hasShifts ? (
|
||||||
>
|
<>
|
||||||
thursday
|
<ProText
|
||||||
</ProText>
|
style={{
|
||||||
<ProText
|
fontSize: 14,
|
||||||
type="secondary"
|
fontWeight: isToday ? 500 : 400,
|
||||||
style={{
|
color: isToday ? "#1890ff" : "#666",
|
||||||
...textStyle,
|
lineHeight: "20px",
|
||||||
fontWeight: todayDay === "thursday" ? 700 : 400,
|
}}
|
||||||
}}
|
>
|
||||||
>
|
{shift1}
|
||||||
10:00 AM to 10:00 PM
|
</ProText>
|
||||||
</ProText>
|
{shift2 && (
|
||||||
</div>
|
<ProText
|
||||||
<div style={{ display: "flex", justifyContent: "space-between" }}>
|
style={{
|
||||||
<ProText
|
fontSize: 14,
|
||||||
type="secondary"
|
fontWeight: isToday ? 500 : 400,
|
||||||
style={{
|
color: isToday ? "#1890ff" : "#666",
|
||||||
...textStyle,
|
lineHeight: "20px",
|
||||||
fontWeight: todayDay === "friday" ? 700 : 400,
|
}}
|
||||||
}}
|
>
|
||||||
>
|
{shift2}
|
||||||
friday
|
</ProText>
|
||||||
</ProText>
|
)}
|
||||||
<ProText
|
</>
|
||||||
type="secondary"
|
) : (
|
||||||
style={{
|
<ProText
|
||||||
...textStyle,
|
type="secondary"
|
||||||
fontWeight: todayDay === "friday" ? 700 : 400,
|
style={{
|
||||||
}}
|
fontSize: 14,
|
||||||
>
|
color: "#999",
|
||||||
10:00 AM to 10:00 PM
|
fontStyle: "italic",
|
||||||
</ProText>
|
}}
|
||||||
</div>
|
>
|
||||||
<div style={{ display: "flex", justifyContent: "space-between" }}>
|
{t("menu.closed")}
|
||||||
<ProText
|
</ProText>
|
||||||
type="secondary"
|
)}
|
||||||
style={{
|
</div>
|
||||||
...textStyle,
|
</div>
|
||||||
fontWeight: todayDay === "saturday" ? 700 : 400,
|
</Card>
|
||||||
}}
|
);
|
||||||
>
|
})}
|
||||||
saturday
|
</div>
|
||||||
</ProText>
|
|
||||||
<ProText
|
|
||||||
type="secondary"
|
|
||||||
style={{
|
|
||||||
...textStyle,
|
|
||||||
fontWeight: todayDay === "saturday" ? 700 : 400,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
10:00 AM to 10:00 PM
|
|
||||||
</ProText>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<Button
|
|
||||||
type="primary"
|
|
||||||
style={{ width: "100%", height: 48 }}
|
|
||||||
onClick={onClose}
|
|
||||||
>
|
|
||||||
{t("menu.close")}
|
|
||||||
</Button>
|
|
||||||
</ProBottomSheet>
|
</ProBottomSheet>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,9 +18,9 @@ const RefershIcon = ({ className, onClick, dimension }: RefershIconType) => {
|
|||||||
<path
|
<path
|
||||||
d="M1.5 7.5C1.5 7.5 1.59099 6.86307 4.22703 4.22703C6.86307 1.59099 11.1369 1.59099 13.773 4.22703C14.7069 5.16099 15.31 6.30054 15.5821 7.5M1.5 7.5V3M1.5 7.5H6M16.5 10.5C16.5 10.5 16.409 11.1369 13.773 13.773C11.1369 16.409 6.86307 16.409 4.22703 13.773C3.29307 12.839 2.69002 11.6995 2.41787 10.5M16.5 10.5V15M16.5 10.5H12"
|
d="M1.5 7.5C1.5 7.5 1.59099 6.86307 4.22703 4.22703C6.86307 1.59099 11.1369 1.59099 13.773 4.22703C14.7069 5.16099 15.31 6.30054 15.5821 7.5M1.5 7.5V3M1.5 7.5H6M16.5 10.5C16.5 10.5 16.409 11.1369 13.773 13.773C11.1369 16.409 6.86307 16.409 4.22703 13.773C3.29307 12.839 2.69002 11.6995 2.41787 10.5M16.5 10.5V15M16.5 10.5H12"
|
||||||
stroke="#5F6C7B"
|
stroke="#5F6C7B"
|
||||||
stroke-width="1.5"
|
strokeWidth="1.5"
|
||||||
stroke-linecap="round"
|
strokeLinecap="round"
|
||||||
stroke-linejoin="round"
|
strokeLinejoin="round"
|
||||||
/>
|
/>
|
||||||
</svg>
|
</svg>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ const RateIcon = ({ className, onClick }: RateIconType) => {
|
|||||||
<path
|
<path
|
||||||
d="M26.4351 131.263C18.2009 129.563 9.45442 127.066 4.20797 120.496C-0.552335 114.535 -1.36302 105.7 2.23265 98.9722C7.4747 89.1632 20.3229 84.8319 24.4402 74.5003C27.401 67.0706 24.9679 58.7427 24.4263 50.7633C23.852 42.2992 25.5683 33.5602 30.0859 26.379C34.6035 19.1981 42.0585 13.7282 50.4398 12.4131C62.6515 10.4973 74.6822 17.2329 87.0409 17.0031C101.49 16.7343 113.941 7.17211 127.741 2.8807C135.732 0.395575 144.272 -0.303884 152.561 0.847569C160.267 1.91822 168.283 4.99429 172.479 11.5457C176.514 17.8476 176.178 25.8983 178.116 33.1264C180.159 40.7481 184.913 47.6136 191.329 52.2072C195.925 55.498 201.301 57.6369 205.675 61.218C209.591 64.4246 212.539 68.6589 215.048 73.0551C218.27 78.7035 220.892 84.8722 221.249 91.3654C221.937 103.879 213.897 115.647 203.429 122.538C192.961 129.429 180.37 132.237 167.99 134.188C158.175 135.734 148.289 136.826 138.373 137.458C128.55 138.083 118.471 138.613 108.638 137.94C105.646 137.735 102.889 136.912 99.9902 136.244C96.2772 135.389 92.5503 135.76 88.7856 135.959C78.9527 136.48 69.0879 136.405 59.2637 135.738C49.4395 135.072 39.6552 133.813 29.9831 131.967C28.7985 131.741 27.616 131.506 26.4351 131.263Z"
|
d="M26.4351 131.263C18.2009 129.563 9.45442 127.066 4.20797 120.496C-0.552335 114.535 -1.36302 105.7 2.23265 98.9722C7.4747 89.1632 20.3229 84.8319 24.4402 74.5003C27.401 67.0706 24.9679 58.7427 24.4263 50.7633C23.852 42.2992 25.5683 33.5602 30.0859 26.379C34.6035 19.1981 42.0585 13.7282 50.4398 12.4131C62.6515 10.4973 74.6822 17.2329 87.0409 17.0031C101.49 16.7343 113.941 7.17211 127.741 2.8807C135.732 0.395575 144.272 -0.303884 152.561 0.847569C160.267 1.91822 168.283 4.99429 172.479 11.5457C176.514 17.8476 176.178 25.8983 178.116 33.1264C180.159 40.7481 184.913 47.6136 191.329 52.2072C195.925 55.498 201.301 57.6369 205.675 61.218C209.591 64.4246 212.539 68.6589 215.048 73.0551C218.27 78.7035 220.892 84.8722 221.249 91.3654C221.937 103.879 213.897 115.647 203.429 122.538C192.961 129.429 180.37 132.237 167.99 134.188C158.175 135.734 148.289 136.826 138.373 137.458C128.55 138.083 118.471 138.613 108.638 137.94C105.646 137.735 102.889 136.912 99.9902 136.244C96.2772 135.389 92.5503 135.76 88.7856 135.959C78.9527 136.48 69.0879 136.405 59.2637 135.738C49.4395 135.072 39.6552 133.813 29.9831 131.967C28.7985 131.741 27.616 131.506 26.4351 131.263Z"
|
||||||
fill="#FFB700"
|
fill="#FFB700"
|
||||||
fill-opacity="0.12"
|
fillOpacity="0.12"
|
||||||
/>
|
/>
|
||||||
<path
|
<path
|
||||||
d="M149.572 150H69.6144C67.3832 150 65.5576 148.174 65.5576 145.943V145.546C65.5576 143.315 67.3832 141.489 69.6144 141.489H149.572C151.803 141.489 153.629 143.315 153.629 145.546V145.943C153.629 148.174 151.803 150 149.572 150Z"
|
d="M149.572 150H69.6144C67.3832 150 65.5576 148.174 65.5576 145.943V145.546C65.5576 143.315 67.3832 141.489 69.6144 141.489H149.572C151.803 141.489 153.629 143.315 153.629 145.546V145.943C153.629 148.174 151.803 150 149.572 150Z"
|
||||||
@@ -42,22 +42,22 @@ const RateIcon = ({ className, onClick }: RateIconType) => {
|
|||||||
<path
|
<path
|
||||||
d="M142.231 13.9854C142.231 10.7734 139.603 8.14526 136.391 8.14526H134.134C114.797 23.8846 96.1683 40.5151 79.0111 58.5438C78.5128 59.0675 78.0168 59.5935 77.5195 60.1188V89.5343C80.7173 86.54 83.9063 83.5363 87.0804 80.5174C88.8163 78.8666 90.5472 77.2104 92.2788 75.5549C108.944 60.8335 125.605 46.108 142.231 31.3423L142.231 13.9854Z"
|
d="M142.231 13.9854C142.231 10.7734 139.603 8.14526 136.391 8.14526H134.134C114.797 23.8846 96.1683 40.5151 79.0111 58.5438C78.5128 59.0675 78.0168 59.5935 77.5195 60.1188V89.5343C80.7173 86.54 83.9063 83.5363 87.0804 80.5174C88.8163 78.8666 90.5472 77.2104 92.2788 75.5549C108.944 60.8335 125.605 46.108 142.231 31.3423L142.231 13.9854Z"
|
||||||
fill="#FFB700"
|
fill="#FFB700"
|
||||||
fill-opacity="0.12"
|
fillOpacity="0.12"
|
||||||
/>
|
/>
|
||||||
<path
|
<path
|
||||||
d="M95.8987 119.961C93.5809 122.338 91.2756 124.728 88.9967 127.149C85.3554 131.016 81.8398 134.99 78.3311 138.969C79.3493 140.693 81.2222 141.859 83.3584 141.859H99.6052C101.571 139.656 103.547 137.461 105.543 135.286C111.156 129.168 116.897 123.176 122.743 117.288C129.246 111.064 135.741 104.833 142.23 98.5942V76.4097C137.105 80.4905 132.061 84.6713 127.162 89.03C116.203 98.7802 105.84 109.178 95.8987 119.961Z"
|
d="M95.8987 119.961C93.5809 122.338 91.2756 124.728 88.9967 127.149C85.3554 131.016 81.8398 134.99 78.3311 138.969C79.3493 140.693 81.2222 141.859 83.3584 141.859H99.6052C101.571 139.656 103.547 137.461 105.543 135.286C111.156 129.168 116.897 123.176 122.743 117.288C129.246 111.064 135.741 104.833 142.23 98.5942V76.4097C137.105 80.4905 132.061 84.6713 127.162 89.03C116.203 98.7802 105.84 109.178 95.8987 119.961Z"
|
||||||
fill="#FFB700"
|
fill="#FFB700"
|
||||||
fill-opacity="0.12"
|
fillOpacity="0.12"
|
||||||
/>
|
/>
|
||||||
<path
|
<path
|
||||||
d="M142.231 116.867C136.361 122.2 130.579 127.631 124.896 133.164C121.948 136.035 119.027 138.934 116.13 141.858H130.067C132.121 139.96 134.17 138.057 136.206 136.14C138.217 134.247 140.225 132.35 142.231 130.453V116.867Z"
|
d="M142.231 116.867C136.361 122.2 130.579 127.631 124.896 133.164C121.948 136.035 119.027 138.934 116.13 141.858H130.067C132.121 139.96 134.17 138.057 136.206 136.14C138.217 134.247 140.225 132.35 142.231 130.453V116.867Z"
|
||||||
fill="#FFB700"
|
fill="#FFB700"
|
||||||
fill-opacity="0.12"
|
fillOpacity="0.12"
|
||||||
/>
|
/>
|
||||||
<path
|
<path
|
||||||
d="M114.568 8.14502H100.676C92.7524 14.6636 85.003 21.3827 77.5195 28.407V37.3576C83.8437 32.2819 90.1625 27.196 96.5533 22.2048C102.559 17.5142 108.55 12.811 114.568 8.14502Z"
|
d="M114.568 8.14502H100.676C92.7524 14.6636 85.003 21.3827 77.5195 28.407V37.3576C83.8437 32.2819 90.1625 27.196 96.5533 22.2048C102.559 17.5142 108.55 12.811 114.568 8.14502Z"
|
||||||
fill="#FFB700"
|
fill="#FFB700"
|
||||||
fill-opacity="0.12"
|
fillOpacity="0.12"
|
||||||
/>
|
/>
|
||||||
<path
|
<path
|
||||||
d="M111.138 11.8819C111.138 12.6409 110.523 13.2561 109.764 13.2561C109.005 13.2561 108.39 12.6409 108.39 11.8819C108.39 11.1229 109.005 10.5073 109.764 10.5073C110.523 10.5073 111.138 11.1226 111.138 11.8819Z"
|
d="M111.138 11.8819C111.138 12.6409 110.523 13.2561 109.764 13.2561C109.005 13.2561 108.39 12.6409 108.39 11.8819C108.39 11.1229 109.005 10.5073 109.764 10.5073C110.523 10.5073 111.138 11.1226 111.138 11.8819Z"
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ export default function InputCard({
|
|||||||
};
|
};
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<ProInputCard title={title} dividerStyle={{ margin: "5px 0 0 0" }}>
|
<ProInputCard title={title}>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name={name}
|
name={name}
|
||||||
rules={[{ required, message: reuireqMessage }]}
|
rules={[{ required, message: reuireqMessage }]}
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
import { Card, Col, Image, Row } from "antd";
|
import { Card, Col, Image, Row } from "antd";
|
||||||
import PresentIcon from "components/Icons/cart/PresentIcon";
|
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { Link, useParams } from "react-router-dom";
|
import { Link, useParams } from "react-router-dom";
|
||||||
import { useGetRestaurantDetailsQuery } from "redux/api/others";
|
|
||||||
import { ACCESS_TOKEN } from "utils/constants";
|
import { ACCESS_TOKEN } from "utils/constants";
|
||||||
import { colors } from "ThemeConstants.ts";
|
import { colors } from "ThemeConstants.ts";
|
||||||
import ProText from "../ProText";
|
import ProText from "../ProText";
|
||||||
@@ -12,7 +10,7 @@ import { useAppSelector } from "redux/hooks";
|
|||||||
const LoyaltyCard = () => {
|
const LoyaltyCard = () => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { subdomain } = useParams();
|
const { subdomain } = useParams();
|
||||||
const { data: restaurant } = useGetRestaurantDetailsQuery(subdomain);
|
const { restaurant } = useAppSelector((state) => state.order);
|
||||||
const { isRTL } = useAppSelector((state) => state.locale);
|
const { isRTL } = useAppSelector((state) => state.locale);
|
||||||
const token = localStorage.getItem(ACCESS_TOKEN);
|
const token = localStorage.getItem(ACCESS_TOKEN);
|
||||||
const loyaltyStamps = restaurant?.loyalty_stamps ?? 0;
|
const loyaltyStamps = restaurant?.loyalty_stamps ?? 0;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Card, Checkbox, Divider, Space, Tag } from "antd";
|
import { Card, Divider, Space, Tag } from "antd";
|
||||||
import ArabicPrice from "components/ArabicPrice";
|
import ArabicPrice from "components/ArabicPrice";
|
||||||
import {
|
import {
|
||||||
selectCart,
|
selectCart,
|
||||||
@@ -6,7 +6,7 @@ import {
|
|||||||
selectDiscountTotal,
|
selectDiscountTotal,
|
||||||
selectGrandTotal,
|
selectGrandTotal,
|
||||||
selectHighestPricedLoyaltyItem,
|
selectHighestPricedLoyaltyItem,
|
||||||
selectTaxAmount,
|
totalTaxes,
|
||||||
} from "features/order/orderSlice";
|
} from "features/order/orderSlice";
|
||||||
import { OrderType } from "pages/checkout/hooks/types";
|
import { OrderType } from "pages/checkout/hooks/types";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
@@ -16,7 +16,7 @@ import { useAppSelector } from "redux/hooks";
|
|||||||
import ProText from "../ProText";
|
import ProText from "../ProText";
|
||||||
import ProTitle from "../ProTitle";
|
import ProTitle from "../ProTitle";
|
||||||
import styles from "./OrderSummary.module.css";
|
import styles from "./OrderSummary.module.css";
|
||||||
import { CSSProperties } from "react";
|
import { CSSProperties, useMemo } from "react";
|
||||||
|
|
||||||
export default function OrderSummary() {
|
export default function OrderSummary() {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
@@ -26,13 +26,13 @@ export default function OrderSummary() {
|
|||||||
const { orderType } = useAppSelector(selectCart);
|
const { orderType } = useAppSelector(selectCart);
|
||||||
const subtotal = useAppSelector(selectCartTotal);
|
const subtotal = useAppSelector(selectCartTotal);
|
||||||
const highestLoyaltyItem = useAppSelector(selectHighestPricedLoyaltyItem);
|
const highestLoyaltyItem = useAppSelector(selectHighestPricedLoyaltyItem);
|
||||||
const taxAmount = useAppSelector(selectTaxAmount);
|
const totalTaxesAmount = useAppSelector(totalTaxes);
|
||||||
const grandTotal = useAppSelector(selectGrandTotal);
|
const grandTotal = useAppSelector(selectGrandTotal);
|
||||||
const discountAmount = useAppSelector(selectDiscountTotal);
|
const discountAmount = useAppSelector(selectDiscountTotal);
|
||||||
|
|
||||||
const isHasLoyaltyGift =
|
const isHasLoyaltyGift =
|
||||||
(restaurant?.loyalty_stamps ?? 0) -
|
(restaurant?.loyalty_stamps ?? 0) -
|
||||||
(restaurant?.customer_loyalty_points ?? 0) <=
|
(restaurant?.customer_loyalty_points ?? 0) <=
|
||||||
0;
|
0;
|
||||||
|
|
||||||
const titlesStyle: CSSProperties = {
|
const titlesStyle: CSSProperties = {
|
||||||
@@ -44,7 +44,27 @@ export default function OrderSummary() {
|
|||||||
textAlign: "center",
|
textAlign: "center",
|
||||||
};
|
};
|
||||||
|
|
||||||
const vat = (restaurant?.vat ?? 0) / 100 * subtotal || 0
|
const vat = ((restaurant?.vat ?? 0) / 100) * (subtotal - discountAmount) || 0;
|
||||||
|
|
||||||
|
// Calculate individual taxes
|
||||||
|
const taxesList = useMemo(() => {
|
||||||
|
if (!restaurant?.taxes) return [];
|
||||||
|
|
||||||
|
const subtotalAfterDiscount = subtotal - discountAmount;
|
||||||
|
|
||||||
|
return restaurant.taxes
|
||||||
|
.filter((tax) => tax.is_active === 1)
|
||||||
|
.map((tax) => {
|
||||||
|
const amount = ((Number(tax.percentage) || 0) / 100) * subtotalAfterDiscount;
|
||||||
|
return {
|
||||||
|
id: tax.id,
|
||||||
|
name: tax.name,
|
||||||
|
name_local: tax.name_local,
|
||||||
|
percentage: tax.percentage,
|
||||||
|
amount,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}, [restaurant?.taxes, subtotal, discountAmount]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@@ -93,9 +113,9 @@ export default function OrderSummary() {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{isHasLoyaltyGift &&
|
{isHasLoyaltyGift &&
|
||||||
useLoyaltyPoints &&
|
useLoyaltyPoints &&
|
||||||
highestLoyaltyItem &&
|
highestLoyaltyItem &&
|
||||||
restaurant?.is_loyalty_enabled === 1 ? (
|
restaurant?.is_loyalty_enabled === 1 ? (
|
||||||
<Tag
|
<Tag
|
||||||
color="green"
|
color="green"
|
||||||
style={{
|
style={{
|
||||||
@@ -117,7 +137,7 @@ export default function OrderSummary() {
|
|||||||
</Tag>
|
</Tag>
|
||||||
) : null}
|
) : null}
|
||||||
<ArabicPrice
|
<ArabicPrice
|
||||||
price={discountAmount}
|
price={discountAmount + (useLoyaltyPoints && restaurant?.is_loyalty_enabled === 1 ? ((highestLoyaltyItem?.price || 0) * (totalTaxesAmount / 100)) : 0)}
|
||||||
textStyle={{ ...titlesStyle, color: "#434E5C" }}
|
textStyle={{ ...titlesStyle, color: "#434E5C" }}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@@ -156,10 +176,10 @@ export default function OrderSummary() {
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{orderType !== OrderType.Redeem && (
|
{orderType !== OrderType.Redeem && restaurant?.vat && (
|
||||||
<div className={styles.summaryRow}>
|
<div className={styles.summaryRow}>
|
||||||
<ProText type="secondary" style={titlesStyle}>
|
<ProText type="secondary" style={titlesStyle}>
|
||||||
{t("cart.vatTax")}
|
{t("cart.vat", { value: restaurant.vat })}
|
||||||
</ProText>
|
</ProText>
|
||||||
<ArabicPrice
|
<ArabicPrice
|
||||||
price={vat}
|
price={vat}
|
||||||
@@ -167,17 +187,21 @@ export default function OrderSummary() {
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{orderType !== OrderType.Redeem && (
|
{orderType !== OrderType.Redeem &&
|
||||||
<div className={styles.summaryRow}>
|
taxesList.map((tax) => (
|
||||||
<ProText type="secondary" style={titlesStyle}>
|
<div key={tax.id} className={styles.summaryRow}>
|
||||||
{t("cart.otherTaxes")}
|
<ProText type="secondary" style={titlesStyle}>
|
||||||
</ProText>
|
{t("cart.otherTaxes", {
|
||||||
<ArabicPrice
|
name: tax.name || tax.name_local,
|
||||||
price={taxAmount - vat || 0}
|
value: tax.percentage,
|
||||||
textStyle={{ ...titlesStyle, color: "#434E5C" }}
|
})}
|
||||||
/>
|
</ProText>
|
||||||
</div>
|
<ArabicPrice
|
||||||
)}
|
price={tax.amount}
|
||||||
|
textStyle={{ ...titlesStyle, color: "#434E5C" }}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
{orderType !== OrderType.Redeem && splitBillAmount > 0 && (
|
{orderType !== OrderType.Redeem && splitBillAmount > 0 && (
|
||||||
<div className={styles.summaryRow}>
|
<div className={styles.summaryRow}>
|
||||||
<ProText type="secondary" style={titlesStyle}>
|
<ProText type="secondary" style={titlesStyle}>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { Form, Radio, Space } from "antd";
|
import { Form, Image, Radio, Space } from "antd";
|
||||||
import { Group } from "antd/es/radio";
|
import { Group } from "antd/es/radio";
|
||||||
import ArabicPrice from "components/ArabicPrice";
|
import ArabicPrice from "components/ArabicPrice";
|
||||||
import DifferentCardIcon from "components/Icons/paymentMethods/DifferentCardIcon";
|
// import DifferentCardIcon from "components/Icons/paymentMethods/DifferentCardIcon";
|
||||||
import ProText from "components/ProText";
|
import ProText from "components/ProText";
|
||||||
import {
|
import {
|
||||||
selectCart,
|
selectCart,
|
||||||
@@ -14,7 +14,6 @@ import { colors, ProGray1 } from "../../ThemeConstants";
|
|||||||
import ProInputCard from "../ProInputCard/ProInputCard";
|
import ProInputCard from "../ProInputCard/ProInputCard";
|
||||||
import styles from "./PaymentMethods.module.css";
|
import styles from "./PaymentMethods.module.css";
|
||||||
import { OrderType } from "pages/checkout/hooks/types.ts";
|
import { OrderType } from "pages/checkout/hooks/types.ts";
|
||||||
import RCardIcon from "components/Icons/RCardIcon";
|
|
||||||
import { formatPriceUi } from "utils/helpers";
|
import { formatPriceUi } from "utils/helpers";
|
||||||
|
|
||||||
const PaymentMethods = () => {
|
const PaymentMethods = () => {
|
||||||
@@ -22,7 +21,8 @@ const PaymentMethods = () => {
|
|||||||
const { paymentMethod, orderType } = useAppSelector(selectCart);
|
const { paymentMethod, orderType } = useAppSelector(selectCart);
|
||||||
const dispatch = useAppDispatch();
|
const dispatch = useAppDispatch();
|
||||||
const grandTotal = useAppSelector(selectGrandTotal);
|
const grandTotal = useAppSelector(selectGrandTotal);
|
||||||
const { isRTL } = useAppSelector((state) => state.locale);
|
const { restaurant } = useAppSelector((state) => state.order);
|
||||||
|
// const { isRTL } = useAppSelector((state) => state.locale);
|
||||||
|
|
||||||
const options: {
|
const options: {
|
||||||
label: React.ReactNode;
|
label: React.ReactNode;
|
||||||
@@ -40,16 +40,18 @@ const PaymentMethods = () => {
|
|||||||
<ProText
|
<ProText
|
||||||
style={{
|
style={{
|
||||||
color: "#E8B400",
|
color: "#E8B400",
|
||||||
[isRTL ? "marginLeft" : "marginRight"]: 4,
|
// [isRTL ? "marginLeft" : "marginRight"]: 4,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
$
|
{/* $ */}
|
||||||
|
</ProText>
|
||||||
|
<ProText style={{ color: "#5F6C7B" }}>
|
||||||
|
{t("checkout.cash")}
|
||||||
</ProText>
|
</ProText>
|
||||||
<ProText style={{color: '#5F6C7B'}}>{t("checkout.cash")}</ProText>
|
|
||||||
</>
|
</>
|
||||||
),
|
),
|
||||||
value: "cash",
|
value: "cash",
|
||||||
price: formatPriceUi(grandTotal, 3),
|
price: formatPriceUi(grandTotal, restaurant.currency_decimals ?? 3),
|
||||||
style: {
|
style: {
|
||||||
color: colors.primary,
|
color: colors.primary,
|
||||||
},
|
},
|
||||||
@@ -65,14 +67,26 @@ const PaymentMethods = () => {
|
|||||||
{
|
{
|
||||||
label: (
|
label: (
|
||||||
<>
|
<>
|
||||||
<RCardIcon className={styles.eCardIcon} />
|
{/* <RCardIcon className={styles.eCardIcon} /> */}
|
||||||
<ProText style={{color: '#5F6C7B'}}>{t("checkout.differentCard")}</ProText>
|
<ProText style={{ color: "#5F6C7B" }}>
|
||||||
|
{t("checkout.thawani")}
|
||||||
|
</ProText>
|
||||||
</>
|
</>
|
||||||
),
|
),
|
||||||
value: "differentCard",
|
value: "thawani",
|
||||||
icon: (
|
icon: (
|
||||||
<div className={styles.differentCardIcon}>
|
<div className={styles.differentCardIcon}>
|
||||||
<DifferentCardIcon />
|
<Image
|
||||||
|
preview={false}
|
||||||
|
src={"thawani.png"}
|
||||||
|
alt="thawani"
|
||||||
|
width={24}
|
||||||
|
height={24}
|
||||||
|
style={{
|
||||||
|
position: "relative",
|
||||||
|
bottom: 3,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
),
|
),
|
||||||
hideCurrency: true,
|
hideCurrency: true,
|
||||||
|
|||||||
@@ -1,47 +0,0 @@
|
|||||||
import { Loader } from "components/Loader/Loader";
|
|
||||||
import { Navigate, useParams } from "react-router-dom";
|
|
||||||
import { useAppSelector } from "redux/hooks";
|
|
||||||
|
|
||||||
export const PrivateRoute = ({
|
|
||||||
children,
|
|
||||||
}: // permission,
|
|
||||||
{
|
|
||||||
children: JSX.Element;
|
|
||||||
permission?: string;
|
|
||||||
}) => {
|
|
||||||
const { token, loading } = useAppSelector((state) => state.auth);
|
|
||||||
const { subdomain } = useParams();
|
|
||||||
|
|
||||||
// const { data: user, isLoading: loadingUser } = useGetSignedUserInfoQuery();
|
|
||||||
|
|
||||||
// useEffect(() => {
|
|
||||||
// if (user) dispatch(setUser(user));
|
|
||||||
// }, [dispatch, user]);
|
|
||||||
|
|
||||||
if (loading) {
|
|
||||||
return <Loader />;
|
|
||||||
}
|
|
||||||
|
|
||||||
// let newPermissions: any[] = [];
|
|
||||||
// // aggregate the rules from multi
|
|
||||||
// user?.roles?.forEach(
|
|
||||||
// (r) => (newPermissions = [...newPermissions, ...r.permissions])
|
|
||||||
// );
|
|
||||||
|
|
||||||
// const userHasRequiredPermission = permission
|
|
||||||
// ? !!newPermissions.find((p) => p.name === permission)
|
|
||||||
// : true;
|
|
||||||
|
|
||||||
console.log(token);
|
|
||||||
|
|
||||||
|
|
||||||
if (!token) {
|
|
||||||
return <Navigate to={`/${subdomain}/login`} />;
|
|
||||||
}
|
|
||||||
|
|
||||||
// if (token && !userHasRequiredPermission) {
|
|
||||||
// return <AccessDenied />; // build your won access denied page (sth like 404)
|
|
||||||
// }
|
|
||||||
|
|
||||||
return children;
|
|
||||||
};
|
|
||||||
@@ -380,7 +380,11 @@ const orderSlice = createSlice({
|
|||||||
// Clear all cart data from localStorage
|
// Clear all cart data from localStorage
|
||||||
if (typeof window !== "undefined") {
|
if (typeof window !== "undefined") {
|
||||||
Object.values(CART_STORAGE_KEYS)
|
Object.values(CART_STORAGE_KEYS)
|
||||||
.filter((key) => key !== CART_STORAGE_KEYS.ORDER_TYPE)
|
.filter(
|
||||||
|
(key) =>
|
||||||
|
key !== CART_STORAGE_KEYS.ORDER_TYPE &&
|
||||||
|
key !== CART_STORAGE_KEYS.PAYMENT_METHOD,
|
||||||
|
)
|
||||||
.forEach((key) => {
|
.forEach((key) => {
|
||||||
localStorage.removeItem(key);
|
localStorage.removeItem(key);
|
||||||
});
|
});
|
||||||
@@ -702,7 +706,8 @@ const orderSlice = createSlice({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
updateOrder(state, action: PayloadAction<any>) {
|
updateOrder(state, action: PayloadAction<any>) {
|
||||||
state.order = { ...state.order, ...action.payload };
|
state.order = { ...(state.order || {}), ...action.payload };
|
||||||
|
|
||||||
if (typeof window !== "undefined") {
|
if (typeof window !== "undefined") {
|
||||||
localStorage.setItem(
|
localStorage.setItem(
|
||||||
CART_STORAGE_KEYS.ORDER,
|
CART_STORAGE_KEYS.ORDER,
|
||||||
@@ -766,23 +771,21 @@ export const {
|
|||||||
|
|
||||||
// Tax calculation helper functions
|
// Tax calculation helper functions
|
||||||
const calculateTaxAmount = (
|
const calculateTaxAmount = (
|
||||||
state: RootState,
|
|
||||||
amount: number,
|
amount: number,
|
||||||
tax: Tax,
|
tax: Tax,
|
||||||
): number => {
|
): number => {
|
||||||
const percentage = parseFloat(tax.percentage);
|
const percentage = parseFloat(tax.percentage);
|
||||||
return (((state.order.restaurant?.vat || 0) + percentage) * amount) / 100;
|
return (percentage * amount) / 100;
|
||||||
};
|
};
|
||||||
|
|
||||||
const calculateTotalTax = (
|
const calculateTotalTax = (
|
||||||
state: RootState,
|
|
||||||
subtotal: number,
|
subtotal: number,
|
||||||
taxes: Tax[],
|
taxes: Tax[],
|
||||||
): number => {
|
): number => {
|
||||||
return taxes
|
return taxes
|
||||||
.filter((tax) => tax.is_active === 1)
|
.filter((tax) => tax.is_active === 1)
|
||||||
.reduce(
|
.reduce(
|
||||||
(total, tax) => total + calculateTaxAmount(state, subtotal, tax),
|
(total, tax) => total + calculateTaxAmount(subtotal, tax),
|
||||||
0,
|
0,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@@ -821,21 +824,31 @@ export const selectLoyaltyItems = createSelector([selectOrderItems], (items) =>
|
|||||||
items.filter((item) => item.isHasLoyalty),
|
items.filter((item) => item.isHasLoyalty),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Tax selectors
|
||||||
|
export const selectTaxes = (state: RootState) => state.order.restaurant.taxes;
|
||||||
|
export const totalTaxes = (state: RootState) => {
|
||||||
|
const taxes = selectTaxes(state);
|
||||||
|
const totalTaxes = taxes?.reduce((total, tax) => total + parseFloat(tax.percentage), 0) || 0;
|
||||||
|
const vat = (state.order.restaurant?.vat || 0);
|
||||||
|
return totalTaxes + vat;
|
||||||
|
};
|
||||||
|
|
||||||
export const selectHighestPricedLoyaltyItem = (state: RootState) => {
|
export const selectHighestPricedLoyaltyItem = (state: RootState) => {
|
||||||
const loyaltyItems = selectLoyaltyItems(state);
|
const loyaltyItems = selectLoyaltyItems(state);
|
||||||
if (loyaltyItems.length === 0) return null;
|
if (loyaltyItems.length === 0) return null;
|
||||||
|
const highestItem = loyaltyItems.reduce((highest, current) =>
|
||||||
return loyaltyItems.reduce((highest, current) =>
|
|
||||||
current.price > highest.price ? current : highest,
|
current.price > highest.price ? current : highest,
|
||||||
);
|
)
|
||||||
|
return highestItem;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const selectDiscountTotal = (state: RootState) =>
|
export const selectDiscountTotal = (state: RootState) => {
|
||||||
(state.order.discount.value / 100) * selectCartTotal(state) +
|
return (state.order.discount.value / 100) * selectCartTotal(state) +
|
||||||
(state.order.useLoyaltyPoints &&
|
(state.order.useLoyaltyPoints &&
|
||||||
state.order.restaurant?.is_loyalty_enabled === 1
|
state.order.restaurant?.is_loyalty_enabled === 1
|
||||||
? selectHighestPricedLoyaltyItem(state)?.price || 0
|
? ((selectHighestPricedLoyaltyItem(state)?.price || 0))
|
||||||
: 0);
|
: 0);
|
||||||
|
}
|
||||||
|
|
||||||
export const selectLoyaltyValidation = createSelector(
|
export const selectLoyaltyValidation = createSelector(
|
||||||
[(state: RootState) => state.order.useLoyaltyPoints, selectLoyaltyItems],
|
[(state: RootState) => state.order.useLoyaltyPoints, selectLoyaltyItems],
|
||||||
@@ -850,18 +863,18 @@ export const selectLoyaltyValidation = createSelector(
|
|||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
// Tax selectors
|
|
||||||
export const selectTaxes = (state: RootState) => state.order.restaurant.taxes;
|
|
||||||
|
|
||||||
export const selectTaxAmount = (state: RootState) => {
|
export const selectTaxAmount = (state: RootState) => {
|
||||||
const subtotal = selectCartTotal(state) - selectDiscountTotal(state);
|
const subtotal = selectCartTotal(state) - selectDiscountTotal(state);
|
||||||
const taxes = selectTaxes(state);
|
const taxes = selectTaxes(state);
|
||||||
return calculateTotalTax(state, subtotal, taxes || []);
|
return calculateTotalTax(subtotal, taxes || []);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const selectGrandTotal = (state: RootState) => {
|
export const selectGrandTotal = (state: RootState) => {
|
||||||
const totalDiscount = selectDiscountTotal(state);
|
const totalDiscount = selectDiscountTotal(state);
|
||||||
const taxAmount = selectTaxAmount(state);
|
const taxAmount = selectTaxAmount(state);
|
||||||
|
const vatAmount = ((state.order.restaurant?.vat || 0) / 100) * (selectCartTotal(state) - selectDiscountTotal(state));
|
||||||
const subtotal = selectCartTotal(state);
|
const subtotal = selectCartTotal(state);
|
||||||
const deliveryFee =
|
const deliveryFee =
|
||||||
state.order.orderType === OrderType.Delivery
|
state.order.orderType === OrderType.Delivery
|
||||||
@@ -869,12 +882,13 @@ export const selectGrandTotal = (state: RootState) => {
|
|||||||
: 0;
|
: 0;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
subtotal +
|
subtotal -
|
||||||
taxAmount -
|
|
||||||
totalDiscount +
|
totalDiscount +
|
||||||
deliveryFee -
|
taxAmount +
|
||||||
state.order.splitBillAmount +
|
vatAmount -
|
||||||
Number(state.order.tip)
|
deliveryFee
|
||||||
|
// state.order.splitBillAmount +
|
||||||
|
// Number(state.order.tip)
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,39 +0,0 @@
|
|||||||
import { useEffect, useState } from "react";
|
|
||||||
|
|
||||||
export function useDetectBarcode() {
|
|
||||||
const [barcode, setBarcode] = useState<string>("");
|
|
||||||
const [lastBarcode, setLastBarcode] = useState<string>("");
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
let interval: any;
|
|
||||||
|
|
||||||
const handleKeydown = (evt: any) => {
|
|
||||||
if (interval) clearInterval(interval);
|
|
||||||
|
|
||||||
if (evt.code === "Enter") {
|
|
||||||
if (barcode) handleBarcode(barcode);
|
|
||||||
setBarcode("");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (evt.key !== "Shift") setBarcode((prev) => prev + evt.key);
|
|
||||||
|
|
||||||
interval = setInterval(() => setBarcode(""), 20);
|
|
||||||
};
|
|
||||||
|
|
||||||
// Adding the event listener when the component mounts
|
|
||||||
document.addEventListener("keydown", handleKeydown);
|
|
||||||
|
|
||||||
// Cleanup the event listener when the component unmounts
|
|
||||||
return () => {
|
|
||||||
document.removeEventListener("keydown", handleKeydown);
|
|
||||||
if (interval) clearInterval(interval);
|
|
||||||
};
|
|
||||||
}, [barcode]);
|
|
||||||
|
|
||||||
const handleBarcode = (scannedBarcode: string) => {
|
|
||||||
setLastBarcode(scannedBarcode);
|
|
||||||
};
|
|
||||||
|
|
||||||
return lastBarcode;
|
|
||||||
}
|
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
import { useRef, useState, useCallback } from "react";
|
|
||||||
|
|
||||||
type Props = { isEnabled: boolean; swipeAction: () => void };
|
|
||||||
|
|
||||||
export default function useSwipeUp({ isEnabled, swipeAction }: Props) {
|
|
||||||
// Swipe detection
|
|
||||||
const startYRef = useRef(0);
|
|
||||||
const [isSwiping, setIsSwiping] = useState(false);
|
|
||||||
const containerRef = useRef<HTMLDivElement>(null);
|
|
||||||
// Touch event handlers for swipe detection
|
|
||||||
const handleTouchStart = useCallback(
|
|
||||||
(e: React.TouchEvent) => {
|
|
||||||
if (!isEnabled) return;
|
|
||||||
startYRef.current = e.touches[0].clientY;
|
|
||||||
setIsSwiping(true);
|
|
||||||
},
|
|
||||||
[isEnabled],
|
|
||||||
);
|
|
||||||
|
|
||||||
/*
|
|
||||||
const handleTouchMove = useCallback(
|
|
||||||
(e: React.TouchEvent) => {
|
|
||||||
if (!isSwiping) return;
|
|
||||||
},
|
|
||||||
[isSwiping],
|
|
||||||
);
|
|
||||||
*/
|
|
||||||
|
|
||||||
const handleTouchEnd = useCallback(
|
|
||||||
(e: React.TouchEvent) => {
|
|
||||||
if (!isSwiping || !isEnabled) return;
|
|
||||||
|
|
||||||
const endY = e.changedTouches[0].clientY;
|
|
||||||
const deltaY = startYRef.current - endY;
|
|
||||||
const threshold = 70; // Threshold to detect a swipe up
|
|
||||||
|
|
||||||
if (deltaY > threshold) {
|
|
||||||
// Swipe up detected
|
|
||||||
swipeAction();
|
|
||||||
}
|
|
||||||
|
|
||||||
setIsSwiping(false);
|
|
||||||
},
|
|
||||||
[isSwiping, isEnabled],
|
|
||||||
);
|
|
||||||
|
|
||||||
return {
|
|
||||||
containerRef,
|
|
||||||
handleTouchStart,
|
|
||||||
handleTouchEnd,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
import { useAppSelector } from "redux/hooks";
|
|
||||||
|
|
||||||
export function useTranslations() {
|
|
||||||
const { isRTL } = useAppSelector((state) => state.locale);
|
|
||||||
const nameProp = isRTL ? "arabic_name" : "name";
|
|
||||||
return [nameProp] as const ;
|
|
||||||
}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
import { Layout } from 'antd';
|
|
||||||
|
|
||||||
const { Footer } = Layout;
|
|
||||||
|
|
||||||
type FooterNavProps = React.HTMLAttributes<HTMLDivElement>;
|
|
||||||
|
|
||||||
const FooterNav = ({ ...others }: FooterNavProps) => {
|
|
||||||
return (
|
|
||||||
<Footer {...others}>AntD Dashboard © 2023 Created by Design Sparx</Footer>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default FooterNav;
|
|
||||||
@@ -1,70 +0,0 @@
|
|||||||
import { BugFilled } from "@ant-design/icons";
|
|
||||||
import { MenuProps } from "antd";
|
|
||||||
import { PATHS } from "utils/constants";
|
|
||||||
|
|
||||||
// import WarehouseIcon from "components/Icons/WarehouseIcon";
|
|
||||||
import { useTranslation } from "react-i18next";
|
|
||||||
import { Link } from "react-router-dom";
|
|
||||||
|
|
||||||
export default function useSidebarItems() {
|
|
||||||
type MenuItem = Required<MenuProps>["items"][number] & {
|
|
||||||
permission: string;
|
|
||||||
children?: MenuItem[];
|
|
||||||
};
|
|
||||||
const { t } = useTranslation();
|
|
||||||
// const [isAuth] = useAuth();
|
|
||||||
const getItem = (
|
|
||||||
label: React.ReactNode,
|
|
||||||
key: React.Key,
|
|
||||||
permission?: string,
|
|
||||||
icon?: React.ReactNode,
|
|
||||||
children?: MenuItem[],
|
|
||||||
type?: "group"
|
|
||||||
): MenuItem => {
|
|
||||||
return {
|
|
||||||
key,
|
|
||||||
icon,
|
|
||||||
children,
|
|
||||||
label,
|
|
||||||
type,
|
|
||||||
permission,
|
|
||||||
} as MenuItem;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Recursive function to filter items based on permissions
|
|
||||||
const getGrantedItems = (items: any[]): MenuItem[] => {
|
|
||||||
return items
|
|
||||||
.filter(() => true)// Filter out items without permission
|
|
||||||
.map((item: any) => {
|
|
||||||
if (item.children) {
|
|
||||||
// Recursively filter children
|
|
||||||
return {
|
|
||||||
...item,
|
|
||||||
children: getGrantedItems(item.children),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
return item;
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const items: MenuProps["items"] = [
|
|
||||||
getItem(
|
|
||||||
t("menu"),
|
|
||||||
PATHS.menu,
|
|
||||||
undefined,
|
|
||||||
<div style={{ marginTop: 10 }}>
|
|
||||||
<Link style={{}} to={PATHS.menu}>
|
|
||||||
<BugFilled className="icon-container pos-icon" />
|
|
||||||
</Link>
|
|
||||||
</div>
|
|
||||||
),
|
|
||||||
];
|
|
||||||
|
|
||||||
// if we have a menu with empty children after applying "getGrantedItems"
|
|
||||||
// we going to remove it
|
|
||||||
const grantedItems = getGrantedItems(items).filter(
|
|
||||||
(i) => (i.children && i.children.length !== 0) || !i.children
|
|
||||||
);
|
|
||||||
|
|
||||||
return grantedItems;
|
|
||||||
}
|
|
||||||
@@ -33,7 +33,6 @@ export default function CartMobileTabletLayout({
|
|||||||
const { items, orderType } = useAppSelector(selectCart);
|
const { items, orderType } = useAppSelector(selectCart);
|
||||||
const { isRTL } = useAppSelector((state) => state.locale);
|
const { isRTL } = useAppSelector((state) => state.locale);
|
||||||
const { subdomain } = useParams();
|
const { subdomain } = useParams();
|
||||||
const { pickup_type } = useAppSelector((state) => state.order.restaurant);
|
|
||||||
const { isMobile, isTablet } = useBreakPoint();
|
const { isMobile, isTablet } = useBreakPoint();
|
||||||
const getResponsiveClass = () => (isTablet ? "tablet" : "mobile");
|
const getResponsiveClass = () => (isTablet ? "tablet" : "mobile");
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Button, FormInstance, Layout } from "antd";
|
import { Button, FormInstance, Layout, message } from "antd";
|
||||||
import { selectCart, updateSplitBillAmount } from "features/order/orderSlice";
|
import { selectCart, updateSplitBillAmount } from "features/order/orderSlice";
|
||||||
import { OrderType } from "pages/checkout/hooks/types.ts";
|
import { OrderType } from "pages/checkout/hooks/types.ts";
|
||||||
import { useCallback, useMemo, useState } from "react";
|
import { useCallback, useMemo, useState } from "react";
|
||||||
@@ -18,7 +18,7 @@ type SplitWay = "customAmount" | "equality" | "payForItems" | null;
|
|||||||
export default function CheckoutButton({ form }: { form: FormInstance }) {
|
export default function CheckoutButton({ form }: { form: FormInstance }) {
|
||||||
const dispatch = useAppDispatch();
|
const dispatch = useAppDispatch();
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { orderType, giftDetails } = useAppSelector(selectCart);
|
const { orderType, giftDetails, items } = useAppSelector(selectCart);
|
||||||
const { handleCreateOrder } = useOrder();
|
const { handleCreateOrder } = useOrder();
|
||||||
const { handleCreateGiftAmount } = useGidtAmount();
|
const { handleCreateGiftAmount } = useGidtAmount();
|
||||||
const [selectedSplitWay, setSelectedSplitWay] = useState<SplitWay>(null);
|
const [selectedSplitWay, setSelectedSplitWay] = useState<SplitWay>(null);
|
||||||
@@ -56,7 +56,11 @@ export default function CheckoutButton({ form }: { form: FormInstance }) {
|
|||||||
) {
|
) {
|
||||||
handleCreateGiftAmount();
|
handleCreateGiftAmount();
|
||||||
} else {
|
} else {
|
||||||
handleCreateOrder();
|
if (items.length > 0) {
|
||||||
|
handleCreateOrder();
|
||||||
|
} else {
|
||||||
|
message.error(t("checkout.noItems"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ export default function useOrder() {
|
|||||||
giftDetails,
|
giftDetails,
|
||||||
order,
|
order,
|
||||||
restaurant,
|
restaurant,
|
||||||
} = useAppSelector(selectCart);
|
} = useAppSelector((state) => state.order);
|
||||||
const highestLoyaltyItem = useAppSelector(selectHighestPricedLoyaltyItem);
|
const highestLoyaltyItem = useAppSelector(selectHighestPricedLoyaltyItem);
|
||||||
const { useLoyaltyPoints } = useAppSelector(selectCart);
|
const { useLoyaltyPoints } = useAppSelector(selectCart);
|
||||||
|
|
||||||
@@ -54,8 +54,6 @@ export default function useOrder() {
|
|||||||
|
|
||||||
const [createOrder] = useCreateOrderMutation();
|
const [createOrder] = useCreateOrderMutation();
|
||||||
|
|
||||||
console.log(order);
|
|
||||||
|
|
||||||
const getDeliveryMethod = useCallback(() => {
|
const getDeliveryMethod = useCallback(() => {
|
||||||
if (orderType === OrderType.Delivery) return 1;
|
if (orderType === OrderType.Delivery) return 1;
|
||||||
if (orderType === OrderType.Pickup) return 2;
|
if (orderType === OrderType.Pickup) return 2;
|
||||||
@@ -152,8 +150,9 @@ export default function useOrder() {
|
|||||||
);
|
);
|
||||||
else {
|
else {
|
||||||
const redirectMessageKey = "order-redirect-loader";
|
const redirectMessageKey = "order-redirect-loader";
|
||||||
|
|
||||||
if (
|
if (
|
||||||
orderType === OrderType.Gift &&
|
localStorage.getItem("fascano_payment_method")?.toString() === '"thawani"' &&
|
||||||
mutationResult.data?.result?.orderID
|
mutationResult.data?.result?.orderID
|
||||||
) {
|
) {
|
||||||
message.loading({
|
message.loading({
|
||||||
@@ -204,6 +203,14 @@ export default function useOrder() {
|
|||||||
location?.lat,
|
location?.lat,
|
||||||
location?.lng,
|
location?.lng,
|
||||||
location?.address,
|
location?.address,
|
||||||
|
order,
|
||||||
|
pickupTime,
|
||||||
|
pickupDate,
|
||||||
|
plateCar,
|
||||||
|
pickupType,
|
||||||
|
discountAmount,
|
||||||
|
subtotal,
|
||||||
|
restaurant,
|
||||||
t,
|
t,
|
||||||
navigate,
|
navigate,
|
||||||
subdomain,
|
subdomain,
|
||||||
|
|||||||
@@ -13,13 +13,14 @@ import "react-phone-input-2/lib/style.css";
|
|||||||
import { useNavigate, useParams } from "react-router-dom";
|
import { useNavigate, useParams } from "react-router-dom";
|
||||||
import { useSendOtpMutation } from "redux/api/auth";
|
import { useSendOtpMutation } from "redux/api/auth";
|
||||||
import { useGetRestaurantDetailsQuery } from "redux/api/others";
|
import { useGetRestaurantDetailsQuery } from "redux/api/others";
|
||||||
import { useAppSelector } from "redux/hooks";
|
import { useAppDispatch, useAppSelector } from "redux/hooks";
|
||||||
import { colors, DisabledColor, ProGray1 } from "ThemeConstants";
|
import { colors, DisabledColor, ProGray1 } from "ThemeConstants";
|
||||||
import { default_image } from "utils/constants";
|
import { default_image } from "utils/constants";
|
||||||
import styles from "./login.module.css";
|
import styles from "./login.module.css";
|
||||||
import { Layout } from "antd";
|
import { Layout } from "antd";
|
||||||
import ProHeader from "components/ProHeader/ProHeader";
|
import ProHeader from "components/ProHeader/ProHeader";
|
||||||
import useBreakPoint from "hooks/useBreakPoint";
|
import useBreakPoint from "hooks/useBreakPoint";
|
||||||
|
import { updateCustomerName } from "features/order/orderSlice";
|
||||||
|
|
||||||
export default function LoginPage() {
|
export default function LoginPage() {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
@@ -32,7 +33,7 @@ export default function LoginPage() {
|
|||||||
skip: !subdomain,
|
skip: !subdomain,
|
||||||
});
|
});
|
||||||
const { isTablet } = useBreakPoint();
|
const { isTablet } = useBreakPoint();
|
||||||
|
const dispatch = useAppDispatch();
|
||||||
// const [phone, setPhone] = useState<string>("");
|
// const [phone, setPhone] = useState<string>("");
|
||||||
const [selectedDate, setSelectedDate] = useState<string>("");
|
const [selectedDate, setSelectedDate] = useState<string>("");
|
||||||
const [isOpen, setIsOpen] = useState(false);
|
const [isOpen, setIsOpen] = useState(false);
|
||||||
@@ -113,6 +114,10 @@ export default function LoginPage() {
|
|||||||
height: 50,
|
height: 50,
|
||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
}}
|
}}
|
||||||
|
onBlur={(e) => {
|
||||||
|
dispatch(updateCustomerName(e.target.value));
|
||||||
|
}}
|
||||||
|
disabled={isLoading}
|
||||||
/>
|
/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { StarFilled } from "@ant-design/icons";
|
import { StarFilled } from "@ant-design/icons";
|
||||||
import { Button, Image, Select, Space } from "antd";
|
import { Button, Image, message, Select, Space } from "antd";
|
||||||
import { FloatingButton } from "components/FloatingButton/FloatingButton";
|
import { FloatingButton } from "components/FloatingButton/FloatingButton";
|
||||||
import LogoContainerIcon from "components/Icons/LogoContainerIcon";
|
import LogoContainerIcon from "components/Icons/LogoContainerIcon";
|
||||||
import ImageWithFallback from "components/ImageWithFallback";
|
import ImageWithFallback from "components/ImageWithFallback";
|
||||||
@@ -12,6 +12,7 @@ import { OrderType } from "pages/checkout/hooks/types.ts";
|
|||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { useParams } from "react-router-dom";
|
import { useParams } from "react-router-dom";
|
||||||
import {
|
import {
|
||||||
|
useCallWaiterMutation,
|
||||||
useGetMenuQuery,
|
useGetMenuQuery,
|
||||||
useGetRestaurantDetailsQuery,
|
useGetRestaurantDetailsQuery,
|
||||||
} from "redux/api/others";
|
} from "redux/api/others";
|
||||||
@@ -37,7 +38,7 @@ import { OrderTypesBottomSheet } from "components/CustomBottomSheet/OrderTypesBo
|
|||||||
function MenuPage() {
|
function MenuPage() {
|
||||||
const { subdomain } = useParams();
|
const { subdomain } = useParams();
|
||||||
const { isRTL } = useAppSelector((state) => state.locale);
|
const { isRTL } = useAppSelector((state) => state.locale);
|
||||||
const { orderType } = useAppSelector((state) => state.order);
|
const { orderType, table } = useAppSelector((state) => state.order);
|
||||||
const { token } = useAppSelector((state) => state.auth);
|
const { token } = useAppSelector((state) => state.auth);
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { data: restaurant, isLoading: isLoadingRestaurant } =
|
const { data: restaurant, isLoading: isLoadingRestaurant } =
|
||||||
@@ -56,6 +57,7 @@ function MenuPage() {
|
|||||||
const [isOpeningTimesOpen, setIsOpeningTimesOpen] = useState(false);
|
const [isOpeningTimesOpen, setIsOpeningTimesOpen] = useState(false);
|
||||||
const [isOrderTypesOpen, setIsOrderTypesOpen] = useState(false);
|
const [isOrderTypesOpen, setIsOrderTypesOpen] = useState(false);
|
||||||
const orderTypeOptions = enumToSelectOptions(OrderType, t, "orderTypes");
|
const orderTypeOptions = enumToSelectOptions(OrderType, t, "orderTypes");
|
||||||
|
const [callWaiter] = useCallWaiterMutation()
|
||||||
|
|
||||||
// Automatically load restaurant taxes when restaurant data is available
|
// Automatically load restaurant taxes when restaurant data is available
|
||||||
useRestaurant(restaurant);
|
useRestaurant(restaurant);
|
||||||
@@ -203,6 +205,19 @@ function MenuPage() {
|
|||||||
backgroundColor: "#EBEBEC",
|
backgroundColor: "#EBEBEC",
|
||||||
border: "none",
|
border: "none",
|
||||||
}}
|
}}
|
||||||
|
onClick={() => {
|
||||||
|
if (table) callWaiter({
|
||||||
|
table_id: table,
|
||||||
|
call_reason: "call_waiter",
|
||||||
|
}).unwrap().then(() => {
|
||||||
|
message.success(t("menu.calledWaiterSuccess"));
|
||||||
|
}).catch((err) => {
|
||||||
|
message.error(err.data.message);
|
||||||
|
})
|
||||||
|
else
|
||||||
|
message.info(t("menu.selectYourTable"));
|
||||||
|
}
|
||||||
|
}
|
||||||
>
|
>
|
||||||
<ProText
|
<ProText
|
||||||
style={{
|
style={{
|
||||||
|
|||||||
@@ -37,13 +37,14 @@ import NewRateIcon from "components/Icons/order/NewRateIcon";
|
|||||||
import NoteIcon from "components/Icons/NoteIcon";
|
import NoteIcon from "components/Icons/NoteIcon";
|
||||||
import SuccessIcon from "components/Icons/SuccessIcon";
|
import SuccessIcon from "components/Icons/SuccessIcon";
|
||||||
import { SplitBillParticipantsBottomSheet } from "./components/SplitBillParticipantsBottomSheet";
|
import { SplitBillParticipantsBottomSheet } from "./components/SplitBillParticipantsBottomSheet";
|
||||||
|
import { OrderType } from "pages/checkout/hooks/types";
|
||||||
|
|
||||||
export default function OrderPage() {
|
export default function OrderPage() {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { orderId } = useParams();
|
const { orderId } = useParams();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const { isRTL } = useAppSelector((state) => state.locale);
|
const { isRTL } = useAppSelector((state) => state.locale);
|
||||||
const { restaurant } = useAppSelector((state) => state.order);
|
const { restaurant, orderType } = useAppSelector((state) => state.order);
|
||||||
const hasRefetchedRef = useRef(false);
|
const hasRefetchedRef = useRef(false);
|
||||||
const [isOpen, setIsOpen] = useState(false);
|
const [isOpen, setIsOpen] = useState(false);
|
||||||
const [isRateOrderOpen, setIsRateOrderOpen] = useState(false);
|
const [isRateOrderOpen, setIsRateOrderOpen] = useState(false);
|
||||||
@@ -429,7 +430,7 @@ export default function OrderPage() {
|
|||||||
<Stepper statuses={orderDetails?.status} />
|
<Stepper statuses={orderDetails?.status} />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{!hasClosedStatus && (
|
{!hasClosedStatus && orderType === OrderType.DineIn && (
|
||||||
<div className={styles.orderNotes}>
|
<div className={styles.orderNotes}>
|
||||||
<NoteIcon className={styles.noteIcon} />
|
<NoteIcon className={styles.noteIcon} />
|
||||||
<div
|
<div
|
||||||
@@ -464,7 +465,7 @@ export default function OrderPage() {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{hasClosedStatus && (
|
{hasClosedStatus && orderType === OrderType.DineIn && (
|
||||||
<div className={styles.orderNotesClosed}>
|
<div className={styles.orderNotesClosed}>
|
||||||
<SuccessIcon className={styles.noteIcon} />
|
<SuccessIcon className={styles.noteIcon} />
|
||||||
<ProText
|
<ProText
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import { useTranslation } from "react-i18next";
|
|||||||
import { Extra as ExtraType } from "utils/types/appTypes";
|
import { Extra as ExtraType } from "utils/types/appTypes";
|
||||||
import styles from "../product.module.css";
|
import styles from "../product.module.css";
|
||||||
import { formatPriceUi } from "utils/helpers";
|
import { formatPriceUi } from "utils/helpers";
|
||||||
|
import { useAppSelector } from "redux/hooks";
|
||||||
|
|
||||||
export default function Extra({
|
export default function Extra({
|
||||||
extrasList,
|
extrasList,
|
||||||
@@ -17,7 +18,7 @@ export default function Extra({
|
|||||||
setSelectedExtras: Dispatch<SetStateAction<ExtraType[]>>;
|
setSelectedExtras: Dispatch<SetStateAction<ExtraType[]>>;
|
||||||
}) {
|
}) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
const { restaurant } = useAppSelector((state) => state.order);
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{extrasList.length > 0 && (
|
{extrasList.length > 0 && (
|
||||||
@@ -46,7 +47,7 @@ export default function Extra({
|
|||||||
return {
|
return {
|
||||||
value: value.id.toString(),
|
value: value.id.toString(),
|
||||||
label: value.name,
|
label: value.name,
|
||||||
price: `+${formatPriceUi(value.price, 3)}`,
|
price: `+${formatPriceUi(value.price, restaurant.currency_decimals ?? 3)}`,
|
||||||
};
|
};
|
||||||
})}
|
})}
|
||||||
value={selectedExtras.map((ex) => ex.id.toString())}
|
value={selectedExtras.map((ex) => ex.id.toString())}
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ export default function ExtraGroupsContainer({
|
|||||||
selectedExtrasByGroup: Record<number, string[]>;
|
selectedExtrasByGroup: Record<number, string[]>;
|
||||||
setSelectedExtrasByGroup: Dispatch<SetStateAction<Record<number, string[]>>>;
|
setSelectedExtrasByGroup: Dispatch<SetStateAction<Record<number, string[]>>>;
|
||||||
}) {
|
}) {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{groupsList.length > 0 && (
|
{groupsList.length > 0 && (
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ export default function Variants({
|
|||||||
const { isRTL } = useAppSelector((state) => state.locale);
|
const { isRTL } = useAppSelector((state) => state.locale);
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { isDesktop } = useBreakPoint();
|
const { isDesktop } = useBreakPoint();
|
||||||
|
const { restaurant } = useAppSelector((state) => state.order);
|
||||||
// Determine variant levels based on options array length
|
// Determine variant levels based on options array length
|
||||||
const variantLevels = useMemo(() => {
|
const variantLevels = useMemo(() => {
|
||||||
if (!variantsList || variantsList.length === 0) return [];
|
if (!variantsList || variantsList.length === 0) return [];
|
||||||
@@ -170,7 +170,7 @@ export default function Variants({
|
|||||||
value: value,
|
value: value,
|
||||||
label: value,
|
label: value,
|
||||||
price: variant
|
price: variant
|
||||||
? `+${formatPriceUi(variant.price, 3)}`
|
? `+${formatPriceUi(variant.price, restaurant.currency_decimals ?? 3)}`
|
||||||
: "",
|
: "",
|
||||||
};
|
};
|
||||||
})}
|
})}
|
||||||
|
|||||||
@@ -214,6 +214,8 @@ export default function ProductDetailPage({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log(product.theExtrasGroups);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
@@ -367,14 +369,13 @@ export default function ProductDetailPage({
|
|||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{product.theExtrasGroups.length === 0 &&
|
{getExtras()?.length > 0 && (
|
||||||
getExtras()?.length > 0 && (
|
<ExtraComponent
|
||||||
<ExtraComponent
|
extrasList={getExtras()}
|
||||||
extrasList={getExtras()}
|
selectedExtras={selectedExtras}
|
||||||
selectedExtras={selectedExtras}
|
setSelectedExtras={setSelectedExtras}
|
||||||
setSelectedExtras={setSelectedExtras}
|
/>
|
||||||
/>
|
)}
|
||||||
)}
|
|
||||||
</Space>
|
</Space>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -10,16 +10,13 @@ import styles from "./restaurant.module.css";
|
|||||||
import RestaurantServices from "./RestaurantServices";
|
import RestaurantServices from "./RestaurantServices";
|
||||||
|
|
||||||
// Import the Client Component for localStorage handling
|
// Import the Client Component for localStorage handling
|
||||||
import Ads1 from "components/Ads/Ads1";
|
|
||||||
import { OrderDetailsBottomSheet } from "components/CustomBottomSheet/orderDetailsSheet/OrderDetailsBottomSheet.tsx";
|
import { OrderDetailsBottomSheet } from "components/CustomBottomSheet/orderDetailsSheet/OrderDetailsBottomSheet.tsx";
|
||||||
import { Loader } from "components/Loader/Loader";
|
import { Loader } from "components/Loader/Loader";
|
||||||
import {
|
import {
|
||||||
CART_STORAGE_KEYS,
|
CART_STORAGE_KEYS,
|
||||||
updateOrderType,
|
updateOrderType,
|
||||||
} from "features/order/orderSlice.ts";
|
} from "features/order/orderSlice.ts";
|
||||||
import useBreakPoint from "hooks/useBreakPoint";
|
|
||||||
import { useRestaurant } from "hooks/useRestaurant";
|
import { useRestaurant } from "hooks/useRestaurant";
|
||||||
import useSwipeUp from "hooks/useSwipeUp";
|
|
||||||
import { OrderType } from "pages/checkout/hooks/types.ts";
|
import { OrderType } from "pages/checkout/hooks/types.ts";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ import {
|
|||||||
REDEEM_DETAILS_URL,
|
REDEEM_DETAILS_URL,
|
||||||
LOYALTY_HISTORY_URL,
|
LOYALTY_HISTORY_URL,
|
||||||
CREATE_GIFT_AMOUNT_URL,
|
CREATE_GIFT_AMOUNT_URL,
|
||||||
|
CALL_WAITER_URL,
|
||||||
|
OPENING_TIMES_URL,
|
||||||
} from "utils/constants";
|
} from "utils/constants";
|
||||||
|
|
||||||
import { OrderDetails } from "pages/checkout/hooks/types";
|
import { OrderDetails } from "pages/checkout/hooks/types";
|
||||||
@@ -25,6 +27,7 @@ import {
|
|||||||
import { baseApi } from "./apiSlice";
|
import { baseApi } from "./apiSlice";
|
||||||
import { EGiftCard } from "pages/EGiftCards/type";
|
import { EGiftCard } from "pages/EGiftCards/type";
|
||||||
import { RedeemResponse } from "pages/redeem/types";
|
import { RedeemResponse } from "pages/redeem/types";
|
||||||
|
import { OpeningTimeResponse } from "./types";
|
||||||
|
|
||||||
export const branchApi = baseApi.injectEndpoints({
|
export const branchApi = baseApi.injectEndpoints({
|
||||||
endpoints: (builder) => ({
|
endpoints: (builder) => ({
|
||||||
@@ -210,6 +213,22 @@ export const branchApi = baseApi.injectEndpoints({
|
|||||||
body,
|
body,
|
||||||
}),
|
}),
|
||||||
}),
|
}),
|
||||||
|
getOpeningTimes: builder.query<OpeningTimeResponse, string | void>({
|
||||||
|
query: (restaurantId: string) => ({
|
||||||
|
url: OPENING_TIMES_URL +"/"+ restaurantId,
|
||||||
|
method: "GET",
|
||||||
|
}),
|
||||||
|
transformResponse: (response: any) => {
|
||||||
|
return response.result;
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
callWaiter: builder.mutation({
|
||||||
|
query: (body: any) => ({
|
||||||
|
url: CALL_WAITER_URL,
|
||||||
|
method: "POST",
|
||||||
|
body,
|
||||||
|
}),
|
||||||
|
}),
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
export const {
|
export const {
|
||||||
@@ -227,4 +246,6 @@ export const {
|
|||||||
useGetRedeemDetailsQuery,
|
useGetRedeemDetailsQuery,
|
||||||
useGetLoyaltyHistoryQuery,
|
useGetLoyaltyHistoryQuery,
|
||||||
useCreateGiftAmountMutation,
|
useCreateGiftAmountMutation,
|
||||||
|
useGetOpeningTimesQuery,
|
||||||
|
useCallWaiterMutation
|
||||||
} = branchApi;
|
} = branchApi;
|
||||||
|
|||||||
34
src/redux/api/types.ts
Normal file
34
src/redux/api/types.ts
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
export interface OpeningTimeResponse {
|
||||||
|
id: number;
|
||||||
|
created_at: string;
|
||||||
|
updated_at: string;
|
||||||
|
"0_from": string;
|
||||||
|
"0_to": string;
|
||||||
|
"1_from": string;
|
||||||
|
"1_to": string;
|
||||||
|
"2_from": string;
|
||||||
|
"2_to": string;
|
||||||
|
"3_from": string;
|
||||||
|
"3_to": string;
|
||||||
|
"4_from": string;
|
||||||
|
"4_to": string;
|
||||||
|
"5_from": string;
|
||||||
|
"5_to": string;
|
||||||
|
"6_from": string;
|
||||||
|
"6_to": string;
|
||||||
|
restorant_id: number;
|
||||||
|
"2_0_from": any;
|
||||||
|
"2_0_to": any;
|
||||||
|
"2_1_from": any;
|
||||||
|
"2_1_to": any;
|
||||||
|
"2_2_from": any;
|
||||||
|
"2_2_to": any;
|
||||||
|
"2_3_from": any;
|
||||||
|
"2_3_to": any;
|
||||||
|
"2_4_from": any;
|
||||||
|
"2_4_to": any;
|
||||||
|
"2_5_from": any;
|
||||||
|
"2_5_to": any;
|
||||||
|
"2_6_from": any;
|
||||||
|
"2_6_to": any;
|
||||||
|
}
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
import { Grid } from "antd";
|
import { Grid } from "antd";
|
||||||
import { Loader } from "components/Loader/Loader";
|
import { Loader } from "components/Loader/Loader";
|
||||||
import { PrivateRoute } from "components/privateRoute/PrivateRoute";
|
|
||||||
import { PublicRoute } from "components/publicRoute/PublicRoute";
|
import { PublicRoute } from "components/publicRoute/PublicRoute";
|
||||||
import { AppLayout } from "layouts";
|
import { AppLayout } from "layouts";
|
||||||
import HeaderMenuDrawer from "layouts/app/HeaderMenuDrawer";
|
import HeaderMenuDrawer from "layouts/app/HeaderMenuDrawer";
|
||||||
@@ -9,7 +8,7 @@ import CardDetailsPage from "pages/CardDetails/CardDetails";
|
|||||||
import CartPage from "pages/cart/page";
|
import CartPage from "pages/cart/page";
|
||||||
import CheckoutPage from "pages/checkout/page";
|
import CheckoutPage from "pages/checkout/page";
|
||||||
import EGiftCardsPage from "pages/EGiftCards/EGiftCards";
|
import EGiftCardsPage from "pages/EGiftCards/EGiftCards";
|
||||||
import { Error400Page, ErrorPage } from "pages/errors";
|
import { ErrorPage } from "pages/errors";
|
||||||
import LoginPage from "pages/login/page";
|
import LoginPage from "pages/login/page";
|
||||||
import MenuPage from "pages/menu/page";
|
import MenuPage from "pages/menu/page";
|
||||||
import OrderDetails from "pages/order/components/OrderDetails";
|
import OrderDetails from "pages/order/components/OrderDetails";
|
||||||
@@ -123,9 +122,9 @@ export const router = createHashRouter([
|
|||||||
element: (
|
element: (
|
||||||
<PageWrapper
|
<PageWrapper
|
||||||
children={
|
children={
|
||||||
<PrivateRoute>
|
<PublicRoute>
|
||||||
<OrdersPage />
|
<OrdersPage />
|
||||||
</PrivateRoute>
|
</PublicRoute>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
@@ -195,20 +194,6 @@ export const router = createHashRouter([
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
|
||||||
path: "errors",
|
|
||||||
errorElement: <ErrorPage />,
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
path: "400",
|
|
||||||
element: (
|
|
||||||
<PrivateRoute>
|
|
||||||
<Error400Page />
|
|
||||||
</PrivateRoute>
|
|
||||||
),
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
export default router;
|
export default router;
|
||||||
|
|||||||
@@ -112,3 +112,5 @@ export const EGIFT_CARDS_URL = `${BASE_URL}gift/cards`;
|
|||||||
export const REDEEM_DETAILS_URL = `${BASE_URL}gift/getGiftOrderByVoucherCode`;
|
export const REDEEM_DETAILS_URL = `${BASE_URL}gift/getGiftOrderByVoucherCode`;
|
||||||
export const LOYALTY_HISTORY_URL = `${BASE_URL}loyaltyHistory`;
|
export const LOYALTY_HISTORY_URL = `${BASE_URL}loyaltyHistory`;
|
||||||
export const CREATE_GIFT_AMOUNT_URL = `${BASE_URL}gift/addGiftAmount`;
|
export const CREATE_GIFT_AMOUNT_URL = `${BASE_URL}gift/addGiftAmount`;
|
||||||
|
export const OPENING_TIMES_URL = `${BASE_URL}restaurant/getWorkingHours`;
|
||||||
|
export const CALL_WAITER_URL = `${BASE_URL}call_waiter`;
|
||||||
@@ -534,6 +534,7 @@ export interface RestaurantDetails {
|
|||||||
closingTime: string;
|
closingTime: string;
|
||||||
isOpened: boolean;
|
isOpened: boolean;
|
||||||
isFav: boolean;
|
isFav: boolean;
|
||||||
|
currency_decimals: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Banner {
|
export interface Banner {
|
||||||
|
|||||||
Reference in New Issue
Block a user