apply call waiter api
This commit is contained in:
@@ -178,7 +178,9 @@
|
|||||||
"wednesday": "الأربعاء",
|
"wednesday": "الأربعاء",
|
||||||
"thursday": "الخميس",
|
"thursday": "الخميس",
|
||||||
"friday": "الجمعة",
|
"friday": "الجمعة",
|
||||||
"saturday": "السبت"
|
"saturday": "السبت",
|
||||||
|
"selectYourTable": "اختر طاولتك",
|
||||||
|
"calledWaiterSuccess": "تم اتصال الرادير بنجاح"
|
||||||
},
|
},
|
||||||
"cart": {
|
"cart": {
|
||||||
"addSpecialRequestOptional": "إضافة طلب خاص (اختياري)",
|
"addSpecialRequestOptional": "إضافة طلب خاص (اختياري)",
|
||||||
|
|||||||
@@ -190,7 +190,9 @@
|
|||||||
"wednesday": "Wednesday",
|
"wednesday": "Wednesday",
|
||||||
"thursday": "Thursday",
|
"thursday": "Thursday",
|
||||||
"friday": "Friday",
|
"friday": "Friday",
|
||||||
"saturday": "Saturday"
|
"saturday": "Saturday",
|
||||||
|
"selectYourTable": "Select your table",
|
||||||
|
"calledWaiterSuccess": "Waiter has been called successfully"
|
||||||
},
|
},
|
||||||
"cart": {
|
"cart": {
|
||||||
"remainingToPay": "Remaining to Pay",
|
"remainingToPay": "Remaining to Pay",
|
||||||
|
|||||||
@@ -872,8 +872,6 @@ export const selectGrandTotal = (state: RootState) => {
|
|||||||
? Number(state.order.restaurant?.delivery_fees) || 0
|
? Number(state.order.restaurant?.delivery_fees) || 0
|
||||||
: 0;
|
: 0;
|
||||||
|
|
||||||
console.log(subtotal, totalDiscount, taxAmount, deliveryFee);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
subtotal -
|
subtotal -
|
||||||
totalDiscount +
|
totalDiscount +
|
||||||
|
|||||||
@@ -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={{
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ 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,
|
OPENING_TIMES_URL,
|
||||||
} from "utils/constants";
|
} from "utils/constants";
|
||||||
|
|
||||||
@@ -221,6 +222,13 @@ export const branchApi = baseApi.injectEndpoints({
|
|||||||
return response.result;
|
return response.result;
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
|
callWaiter: builder.mutation({
|
||||||
|
query: (body: any) => ({
|
||||||
|
url: CALL_WAITER_URL,
|
||||||
|
method: "POST",
|
||||||
|
body,
|
||||||
|
}),
|
||||||
|
}),
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
export const {
|
export const {
|
||||||
@@ -239,4 +247,5 @@ export const {
|
|||||||
useGetLoyaltyHistoryQuery,
|
useGetLoyaltyHistoryQuery,
|
||||||
useCreateGiftAmountMutation,
|
useCreateGiftAmountMutation,
|
||||||
useGetOpeningTimesQuery,
|
useGetOpeningTimesQuery,
|
||||||
|
useCallWaiterMutation
|
||||||
} = branchApi;
|
} = branchApi;
|
||||||
|
|||||||
@@ -112,4 +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 OPENING_TIMES_URL = `${BASE_URL}restaurant/getWorkingHours`;
|
||||||
|
export const CALL_WAITER_URL = `${BASE_URL}call_waiter`;
|
||||||
Reference in New Issue
Block a user