- {[
- { id: 1, name: "Lazord Grill - half kilo" },
- { id: 2, name: "Lazord Grill - half kilo" },
- { id: 3, name: "Lazord Grill - half kilo" },
- ].map((item, index) => (
+ {orderDetails?.orderItems.map((item, index) => (
diff --git a/src/redux/api/others.ts b/src/redux/api/others.ts
index 9007847..5825e51 100644
--- a/src/redux/api/others.ts
+++ b/src/redux/api/others.ts
@@ -1,10 +1,13 @@
import {
- CREATE_ORDER_URL,
- ORDERS_URL,
- PRODUCTS_AND_CATEGORIES_URL,
- RESTAURANT_DETAILS_URL,
+ CREATE_ORDER_URL,
+ ORDER_DETAILS_URL,
+ ORDERS_URL,
+ PRODUCTS_AND_CATEGORIES_URL,
+ RESTAURANT_DETAILS_URL,
+ TABLES_URL,
} from "utils/constants";
+import { OrderDetails } from "pages/checkout/hooks/types";
import menuParser from "pages/menu/helper";
import { RestaurantDetails } from "utils/types/appTypes";
import { baseApi } from "./apiSlice";
@@ -43,6 +46,40 @@ export const branchApi = baseApi.injectEndpoints({
}),
invalidatesTags: ["Orders"],
}),
+ getTables: builder.query<
+ any,
+ { restaurantID: string; tableType: string }
+ >({
+ query: ({
+ restaurantID,
+ tableType,
+ }: {
+ restaurantID: string;
+ tableType: string;
+ }) => ({
+ url: TABLES_URL,
+ method: "POST",
+ body: {
+ restaurantID,
+ tableType,
+ },
+ }),
+ transformResponse: (response: any) => {
+ return response.result.data;
+ },
+ }),
+ getOrderDetails: builder.query
({
+ query: ({ orderID, restaurantID }: { orderID: string; restaurantID: string }) => ({
+ url: `${ORDER_DETAILS_URL}/${orderID}`,
+ method: "POST",
+ body: {
+ restaurantID,
+ },
+ }),
+ transformResponse: (response: any) => {
+ return response.result;
+ },
+ }),
}),
});
export const {
@@ -50,4 +87,6 @@ export const {
useGetMenuQuery,
useCreateOrderMutation,
useGetOrdersQuery,
+ useGetTablesQuery,
+ useGetOrderDetailsQuery,
} = branchApi;
diff --git a/src/routes/routes.tsx b/src/routes/routes.tsx
index c385043..def79dc 100644
--- a/src/routes/routes.tsx
+++ b/src/routes/routes.tsx
@@ -142,7 +142,7 @@ export const router = createHashRouter([
},
{
- path: "/:id/order",
+ path: "/:id/order/:orderId",
element: } />,
errorElement: ,
},
diff --git a/src/utils/constants.ts b/src/utils/constants.ts
index 5fb51f6..eb5990e 100644
--- a/src/utils/constants.ts
+++ b/src/utils/constants.ts
@@ -95,12 +95,9 @@ export const RESTAURANT_DETAILS_URL = `${BASE_URL}restaurant/selectLanguage/`;
export const PRODUCTS_AND_CATEGORIES_URL = `${BASE_URL}getRestaurantItems/`;
export const PRODUCT_DETAILS_URL = `${BASE_URL}getOptionsForItem/`;
export const ORDERS_URL = `${BASE_URL}customer_orders`;
+export const ORDER_DETAILS_URL = `${BASE_URL}restaurant/getOneOrderForWebmenu`;
export const CREATE_ORDER_URL = `${BASE_URL}create_order_webmenu`;
+export const TABLES_URL = `${BASE_URL}restaurant/getTables`;
export const LOGIN_URL = `${API_BASE_URL}login`;
export const SEND_OTP_URL = `${API_BASE_URL}sendOtp`;
export const CONFIRM_OTP_URL = `${API_BASE_URL}confirmOtp`;
-export const USERS_DATA_URL = `${API_BASE_URL}users`;
-export const TABLE_HEADERS = `${API_BASE_URL}tableheader`;
-export const PERMISSIONS_DATA_URL = `${API_BASE_URL}permissions`;
-export const SINGED_USER_INFO_URL = `${API_BASE_URL}users/authenticated`;
-export const ROLES_DATA_URL = `${API_BASE_URL}roles`;
diff --git a/src/utils/types/appTypes.ts b/src/utils/types/appTypes.ts
index 1bc92da..b6bc477 100644
--- a/src/utils/types/appTypes.ts
+++ b/src/utils/types/appTypes.ts
@@ -1,9 +1,5 @@
// zero value may be considered an undefined ... donn't use in enums
import { ColumnType } from "antd/es/table";
-import { PermissionType } from "modules/system/rolesManagement/types";
-import { TaxType } from "modules/system/taxes/types";
-import { QrCode } from "pages/pos/orders/components/order-panel/types";
-import { ItemType, OrderType } from "pages/pos/orders/types";
export enum AlignType {
"left" = "left",
@@ -148,25 +144,6 @@ export type LoginUserType = {
password?: string;
};
-export type UserType = {
- id?: number;
- first_name?: string;
- last_name?: string;
- password?: string;
- phone_number?: string;
- salary?: any;
- employment_date?: any;
- email?: string;
- username?: string;
- personal_image?: any;
- identity_card_front?: any;
- identity_card_back?: any;
- driving_license_front?: any;
- driving_license_back?: any;
- roles?: RolesType[];
- menus: string[];
-};
-
export enum Mode {
Edit = 1,
New = 2,
@@ -297,33 +274,6 @@ export enum TableStatus {
requestPayment = "PENDING_INVOICE",
}
-export interface ReservationType {
- id: number;
- start_datetime: string;
- end_datetime: any;
- seats_reserved: number;
- orders: OrderType[];
- invoice: InvoiceType;
-}
-
-export interface InvoiceType {
- id: number;
- number: number;
- uuid: string;
- sub_total: number;
- grand_total: number;
- discount_amount: number;
- taxes_total: number;
- print_times: number;
- start_datetime: string;
- end_datetime: string;
- printed_at: string;
- remaining_amount: number;
- qr_code: QrCode;
- taxes: TaxType[];
- items: ItemType[];
-}
-
export interface RegisterType {
id: number;
opening_balance: number;
@@ -339,12 +289,6 @@ export interface SessionPayload {
total_expenses?: number;
}
-export interface RolesType {
- id: number;
- name: string;
- permissions: PermissionType[];
-}
-
export enum Roles {
SuperUser = "super-admin",
Admin = "admin",
@@ -399,14 +343,6 @@ export interface User {
role: "admin" | "user";
}
-export interface Order {
- id: string;
- userId: string;
- items: CartItem[];
- total: number;
- status: "pending" | "confirmed" | "completed" | "cancelled";
- createdAt: string;
-}
export type Locale = "en" | "ar";
export type Theme = "light" | "dark";