apply call waiter api
This commit is contained in:
@@ -178,7 +178,9 @@
|
||||
"wednesday": "الأربعاء",
|
||||
"thursday": "الخميس",
|
||||
"friday": "الجمعة",
|
||||
"saturday": "السبت"
|
||||
"saturday": "السبت",
|
||||
"selectYourTable": "اختر طاولتك",
|
||||
"calledWaiterSuccess": "تم اتصال الرادير بنجاح"
|
||||
},
|
||||
"cart": {
|
||||
"addSpecialRequestOptional": "إضافة طلب خاص (اختياري)",
|
||||
|
||||
@@ -190,7 +190,9 @@
|
||||
"wednesday": "Wednesday",
|
||||
"thursday": "Thursday",
|
||||
"friday": "Friday",
|
||||
"saturday": "Saturday"
|
||||
"saturday": "Saturday",
|
||||
"selectYourTable": "Select your table",
|
||||
"calledWaiterSuccess": "Waiter has been called successfully"
|
||||
},
|
||||
"cart": {
|
||||
"remainingToPay": "Remaining to Pay",
|
||||
|
||||
@@ -872,8 +872,6 @@ export const selectGrandTotal = (state: RootState) => {
|
||||
? Number(state.order.restaurant?.delivery_fees) || 0
|
||||
: 0;
|
||||
|
||||
console.log(subtotal, totalDiscount, taxAmount, deliveryFee);
|
||||
|
||||
return (
|
||||
subtotal -
|
||||
totalDiscount +
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
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 LogoContainerIcon from "components/Icons/LogoContainerIcon";
|
||||
import ImageWithFallback from "components/ImageWithFallback";
|
||||
@@ -12,6 +12,7 @@ import { OrderType } from "pages/checkout/hooks/types.ts";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { useParams } from "react-router-dom";
|
||||
import {
|
||||
useCallWaiterMutation,
|
||||
useGetMenuQuery,
|
||||
useGetRestaurantDetailsQuery,
|
||||
} from "redux/api/others";
|
||||
@@ -37,7 +38,7 @@ import { OrderTypesBottomSheet } from "components/CustomBottomSheet/OrderTypesBo
|
||||
function MenuPage() {
|
||||
const { subdomain } = useParams();
|
||||
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 { t } = useTranslation();
|
||||
const { data: restaurant, isLoading: isLoadingRestaurant } =
|
||||
@@ -56,6 +57,7 @@ function MenuPage() {
|
||||
const [isOpeningTimesOpen, setIsOpeningTimesOpen] = useState(false);
|
||||
const [isOrderTypesOpen, setIsOrderTypesOpen] = useState(false);
|
||||
const orderTypeOptions = enumToSelectOptions(OrderType, t, "orderTypes");
|
||||
const [callWaiter] = useCallWaiterMutation()
|
||||
|
||||
// Automatically load restaurant taxes when restaurant data is available
|
||||
useRestaurant(restaurant);
|
||||
@@ -203,6 +205,19 @@ function MenuPage() {
|
||||
backgroundColor: "#EBEBEC",
|
||||
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
|
||||
style={{
|
||||
|
||||
@@ -13,6 +13,7 @@ import {
|
||||
REDEEM_DETAILS_URL,
|
||||
LOYALTY_HISTORY_URL,
|
||||
CREATE_GIFT_AMOUNT_URL,
|
||||
CALL_WAITER_URL,
|
||||
OPENING_TIMES_URL,
|
||||
} from "utils/constants";
|
||||
|
||||
@@ -221,6 +222,13 @@ export const branchApi = baseApi.injectEndpoints({
|
||||
return response.result;
|
||||
},
|
||||
}),
|
||||
callWaiter: builder.mutation({
|
||||
query: (body: any) => ({
|
||||
url: CALL_WAITER_URL,
|
||||
method: "POST",
|
||||
body,
|
||||
}),
|
||||
}),
|
||||
}),
|
||||
});
|
||||
export const {
|
||||
@@ -239,4 +247,5 @@ export const {
|
||||
useGetLoyaltyHistoryQuery,
|
||||
useCreateGiftAmountMutation,
|
||||
useGetOpeningTimesQuery,
|
||||
useCallWaiterMutation
|
||||
} = 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 LOYALTY_HISTORY_URL = `${BASE_URL}loyaltyHistory`;
|
||||
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