sme-pos-package 1.0.14 → 1.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +1 -0
- package/package.json +4 -1
- package/dist/index.css.map +0 -1
- package/dist/index.mjs.map +0 -1
- package/dist/tailwind.preset.mjs.map +0 -1
- package/public/assets/images/bank-logos.png +0 -0
- package/public/assets/images/banner1.png +0 -0
- package/public/assets/images/banner2.png +0 -0
- package/public/assets/images/banner3.png +0 -0
- package/public/assets/images/banner4.png +0 -0
- package/public/assets/images/cashier.svg +0 -9
- package/public/assets/images/empty-cart.png +0 -0
- package/public/assets/images/empty-table-state.png +0 -0
- package/public/assets/images/layout-display/left-layout.png +0 -0
- package/public/assets/images/layout-display/right-layout.png +0 -0
- package/public/assets/images/modal-illustration.png +0 -0
- package/public/assets/images/order-empty-state.png +0 -0
- package/public/assets/images/order.png +0 -0
- package/public/assets/images/payment-success-label.png +0 -0
- package/public/assets/images/table-empty.png +0 -0
- package/public/assets/images/take-away.png +0 -0
- package/public/assets/lottie/loading.json +0 -1
- package/public/assets/lottie/soft_pos.json +0 -1
- package/public/assets/lottie/success.json +0 -1
- package/public/config.json +0 -27
- package/public/env.json +0 -17
- package/src/animations/success.json +0 -9730
- package/src/assets/icons/breadcrumbs-icon.tsx +0 -85
- package/src/assets/icons/cart-icon.tsx +0 -14
- package/src/assets/icons/common.tsx +0 -270
- package/src/assets/icons/customer-view-icon.tsx +0 -20
- package/src/assets/icons/dining-table.tsx +0 -34
- package/src/assets/icons/edit-line-icon.tsx +0 -18
- package/src/assets/icons/emenu-icon.tsx +0 -39
- package/src/assets/icons/file-close-line-icon.tsx +0 -18
- package/src/assets/icons/helper-icon.tsx +0 -84
- package/src/assets/icons/home-gear-line-icon.tsx +0 -18
- package/src/assets/icons/kanban-icon.tsx +0 -16
- package/src/assets/icons/loading-icon.tsx +0 -45
- package/src/assets/icons/logout-box-line-icon.tsx +0 -18
- package/src/assets/icons/order-icon.tsx +0 -92
- package/src/assets/icons/payment-icon.tsx +0 -429
- package/src/assets/icons/pincode.tsx +0 -196
- package/src/assets/icons/pos-connect-icon.tsx +0 -67
- package/src/assets/icons/pos-device-icon.tsx +0 -52
- package/src/assets/icons/pos-icon.tsx +0 -75
- package/src/assets/icons/printer-line-icon.tsx +0 -18
- package/src/assets/icons/star-icon.tsx +0 -174
- package/src/assets/icons/table-icon.tsx +0 -77
- package/src/assets/icons/user-add-line-icon.tsx +0 -33
- package/src/assets/icons/user-icon.tsx +0 -65
- package/src/components/common/button-action.tsx +0 -46
- package/src/components/common/button-icon.tsx +0 -23
- package/src/components/common/dropdown/index.tsx +0 -79
- package/src/components/common/empty-state.tsx +0 -60
- package/src/components/common/header/index.tsx +0 -89
- package/src/components/common/header/tabs.tsx +0 -119
- package/src/components/common/image.tsx +0 -20
- package/src/components/common/input/index.tsx +0 -55
- package/src/components/common/input/radio-group.tsx +0 -75
- package/src/components/common/input/text-area.tsx +0 -28
- package/src/components/common/modal/delete-confirm-modal-container.tsx +0 -65
- package/src/components/common/modal/index.ts +0 -2
- package/src/components/common/modal/modal-direction.tsx +0 -125
- package/src/components/common/modal/modal-header.tsx +0 -37
- package/src/components/common/modal/modal-wrapper.tsx +0 -56
- package/src/components/common/modal/modal-zoom.tsx +0 -61
- package/src/components/common/pagination.tsx +0 -95
- package/src/components/common/refresh-button.tsx +0 -28
- package/src/components/common/search-bar.tsx +0 -27
- package/src/components/common/search.tsx +0 -59
- package/src/components/common/skeleton.tsx +0 -7
- package/src/components/common/tabs-layout.tsx +0 -98
- package/src/components/common/use-check-session.tsx +0 -19
- package/src/components/customer-management/add-customer/add-customer-drawer.tsx +0 -286
- package/src/components/customer-management/add-customer/address-select.tsx +0 -51
- package/src/components/customer-management/choose-customer-drawer.tsx +0 -177
- package/src/components/customer-management/customer-info-drawer.tsx +0 -166
- package/src/components/customer-management/customer-no-data.tsx +0 -18
- package/src/components/emenu/emenu-qr-code.tsx +0 -59
- package/src/components/emenu/menu-link.tsx +0 -67
- package/src/components/index.ts +0 -8
- package/src/components/kanban-template/kitchen-template.tsx +0 -60
- package/src/components/kanban-template/pos-order-template.tsx +0 -77
- package/src/components/kanban-template/pos-template.tsx +0 -170
- package/src/components/kitchen-management/change-status-confirm-modal.tsx +0 -61
- package/src/components/kitchen-management/index.ts +0 -1
- package/src/components/kitchen-management/kitchen-order/index.tsx +0 -153
- package/src/components/kitchen-management/kitchen-order/line.tsx +0 -78
- package/src/components/kitchen-management/kitchen-order/state.tsx +0 -52
- package/src/components/kitchen-management/kitchen-status.tsx +0 -69
- package/src/components/kitchen-management/orders-kitchen-management.tsx +0 -113
- package/src/components/order-management/index.tsx +0 -128
- package/src/components/order-management/order-actions.tsx +0 -46
- package/src/components/order-management/order-detail/header.tsx +0 -37
- package/src/components/order-management/order-detail/index.ts +0 -3
- package/src/components/order-management/order-detail/information.tsx +0 -96
- package/src/components/order-management/order-detail/order-detail.tsx +0 -84
- package/src/components/order-management/order-detail/order-line.tsx +0 -56
- package/src/components/order-management/order-detail/summary.tsx +0 -221
- package/src/components/order-management/order-header.tsx +0 -113
- package/src/components/order-management/order-pagination.tsx +0 -49
- package/src/components/order-management/order-status.tsx +0 -58
- package/src/components/order-management/order-table.tsx +0 -179
- package/src/components/order-management/order-tabs.tsx +0 -48
- package/src/components/pos-management/add-product-from-barcode/index.tsx +0 -97
- package/src/components/pos-management/cart-content/action-line.tsx +0 -81
- package/src/components/pos-management/cart-content/cancel-order-line-modal.tsx +0 -41
- package/src/components/pos-management/cart-content/cart-item.tsx +0 -173
- package/src/components/pos-management/cart-content/cart-items.tsx +0 -130
- package/src/components/pos-management/cart-content/draft-orders/draft-order-line.tsx +0 -67
- package/src/components/pos-management/cart-content/draft-orders/index.tsx +0 -40
- package/src/components/pos-management/cart-content/edit-cart-modal.tsx +0 -11
- package/src/components/pos-management/cart-content/index.tsx +0 -260
- package/src/components/pos-management/cart-content/no-select-order.tsx +0 -26
- package/src/components/pos-management/cart-content/order-info/customer-info.tsx +0 -53
- package/src/components/pos-management/cart-content/order-info/index.tsx +0 -109
- package/src/components/pos-management/cart-content/order-total.tsx +0 -36
- package/src/components/pos-management/cart-content/orders-line.tsx +0 -72
- package/src/components/pos-management/menu-content/category-tab.tsx +0 -38
- package/src/components/pos-management/menu-content/create-order-modal.tsx +0 -65
- package/src/components/pos-management/menu-content/product-content.tsx +0 -93
- package/src/components/pos-management/menu-content/product-detail/info.tsx +0 -28
- package/src/components/pos-management/menu-content/product-detail/modal.tsx +0 -148
- package/src/components/pos-management/menu-content/product-detail/option.tsx +0 -87
- package/src/components/pos-management/menu-content/product-detail/quantity-control.tsx +0 -155
- package/src/components/pos-management/menu-content/product-detail/sale-keypad.tsx +0 -100
- package/src/components/pos-management/menu-content/product-item.tsx +0 -65
- package/src/components/pos-management/order-helper/cancel-order-confirm.tsx +0 -43
- package/src/components/pos-management/order-helper/history-call.tsx +0 -105
- package/src/components/pos-management/order-helper/order-helper-modal.tsx +0 -116
- package/src/components/pos-management/payment-content/bill/actions.tsx +0 -46
- package/src/components/pos-management/payment-content/bill/content.tsx +0 -207
- package/src/components/pos-management/payment-content/bill/index.tsx +0 -18
- package/src/components/pos-management/payment-content/card-payment/index.tsx +0 -124
- package/src/components/pos-management/payment-content/card-payment/pos-payment/pos-connect.tsx +0 -183
- package/src/components/pos-management/payment-content/card-payment/pos-payment/qr-connect.tsx +0 -185
- package/src/components/pos-management/payment-content/card-payment/waiting-for-payment-pos-modal.tsx +0 -37
- package/src/components/pos-management/payment-content/cash-payment/index.tsx +0 -216
- package/src/components/pos-management/payment-content/index.tsx +0 -70
- package/src/components/pos-management/payment-content/payment-info.tsx +0 -67
- package/src/components/pos-management/payment-content/payment-layout.tsx +0 -16
- package/src/components/pos-management/payment-content/payment-method-cards.tsx +0 -99
- package/src/components/pos-management/payment-content/qr-payment/index.tsx +0 -118
- package/src/components/pos-management/payment-content/qr-payment/qr_code.js +0 -29
- package/src/components/pos-management/payment-content/qr-payment/vietqr.js +0 -436
- package/src/components/pos-management/payment-content/session-close-modal.tsx +0 -35
- package/src/components/pos-management/payment-content/soft-pos-payment/index.tsx +0 -48
- package/src/components/pos-management/pos-helpers/back-confirm.tsx +0 -45
- package/src/components/pos-management/pos-helpers/index.tsx +0 -135
- package/src/components/pos-management/pos-helpers/layout-display-modal.tsx +0 -99
- package/src/components/pos-management/search.tsx +0 -48
- package/src/components/pos-management/table-content/filtered-tables.tsx +0 -59
- package/src/components/pos-management/table-content/floor-tabs.tsx +0 -65
- package/src/components/pos-management/table-content/index.tsx +0 -76
- package/src/components/pos-management/table-content/table-item.tsx +0 -127
- package/src/components/pos-management/table-content/tables.tsx +0 -96
- package/src/components/restaurant-management/add-floor-modal.tsx +0 -133
- package/src/components/restaurant-management/add-table-modal.tsx +0 -198
- package/src/components/restaurant-management/delete-floor-confirm-modal.tsx +0 -42
- package/src/components/restaurant-management/delete-table-confirm-modal.tsx +0 -51
- package/src/components/restaurant-management/header.tsx +0 -22
- package/src/components/restaurant-management/index.tsx +0 -54
- package/src/components/restaurant-management/left-side.tsx +0 -51
- package/src/components/restaurant-management/right-side.tsx +0 -179
- package/src/components/restaurant-management/table-empty.tsx +0 -43
- package/src/components/session-management/close-session-modal/actions.tsx +0 -45
- package/src/components/session-management/close-session-modal/close-session-confirm.tsx +0 -157
- package/src/components/session-management/close-session-modal/close-session-ticket.tsx +0 -218
- package/src/components/session-management/close-session-modal/container.tsx +0 -25
- package/src/components/session-management/close-session-modal/draft-orders-confirm.tsx +0 -53
- package/src/components/session-management/close-session-modal/draft-orders-summary.tsx +0 -82
- package/src/components/session-management/close-session-modal/draft-orders.tsx +0 -34
- package/src/components/session-management/close-session-modal/index.tsx +0 -35
- package/src/components/session-management/close-session-modal/order/index.ts +0 -1
- package/src/components/session-management/close-session-modal/order/order-line.tsx +0 -64
- package/src/components/session-management/close-session-modal/order/orders-in-draft.tsx +0 -31
- package/src/components/session-management/close-session-modal/session-summary.tsx +0 -165
- package/src/components/session-management/index.ts +0 -1
- package/src/components/session-management/open-shift/index.tsx +0 -172
- package/src/components/table-management/index.tsx +0 -0
- package/src/constants/api/index.ts +0 -1
- package/src/constants/headers.constant.tsx +0 -24
- package/src/constants/index.ts +0 -1
- package/src/constants/language.store.ts +0 -21
- package/src/constants/methods.constant.ts +0 -10
- package/src/constants/order-state.ts +0 -8
- package/src/constants/payment-color.constant.ts +0 -26
- package/src/constants/query.constant.ts +0 -14
- package/src/constants/routes.constants.ts +0 -23
- package/src/constants/template-name.constant.ts +0 -9
- package/src/hooks/bill/use-get-bill-information.ts +0 -49
- package/src/hooks/bill/use-print-bill.tsx +0 -0
- package/src/hooks/common/load-env-config.ts +0 -98
- package/src/hooks/common/use-back.ts +0 -13
- package/src/hooks/common/use-broadcast.ts +0 -22
- package/src/hooks/common/use-click-outside.ts +0 -58
- package/src/hooks/common/use-get-base64-photo.ts +0 -71
- package/src/hooks/common/use-get-query.ts +0 -25
- package/src/hooks/common/use-pos.ts +0 -21
- package/src/hooks/common/use-query-params.ts +0 -89
- package/src/hooks/common/use-speech.ts +0 -36
- package/src/hooks/customer/use-customer-provider.ts +0 -247
- package/src/hooks/floor/use-floor-provider.ts +0 -172
- package/src/hooks/kitchen/use-kitchen-provider.ts +0 -80
- package/src/hooks/order/use-get-point-reward.ts +0 -50
- package/src/hooks/order/use-loop-fetch-order.ts +0 -30
- package/src/hooks/order/use-order-items.ts +0 -61
- package/src/hooks/order/use-orders.ts +0 -76
- package/src/hooks/payment/use-payment-provider.ts +0 -221
- package/src/hooks/product/use-product-provider.ts +0 -87
- package/src/hooks/session/use-check-session.tsx +0 -19
- package/src/hooks/session/use-session-provider.ts +0 -79
- package/src/hooks/table/use-pos-table-provider.ts +0 -193
- package/src/index.css +0 -5
- package/src/index.ts +0 -13
- package/src/layouts/common.tsx +0 -15
- package/src/layouts/index.ts +0 -4
- package/src/layouts/pos-layout.tsx +0 -33
- package/src/layouts/pos-order-layout.tsx +0 -43
- package/src/layouts/sale-layout.tsx +0 -25
- package/src/locales/en.json +0 -394
- package/src/locales/vi.json +0 -400
- package/src/pages/index.ts +0 -4
- package/src/pages/login/index.tsx +0 -128
- package/src/pages/pincode/index.tsx +0 -198
- package/src/pages/pos/kitchen-management/layout.tsx +0 -18
- package/src/pages/pos/management-floor/index.tsx +0 -7
- package/src/pages/pos/management-order/index.tsx +0 -7
- package/src/pages/pos/management-order/order-detail/index.tsx +0 -7
- package/src/pages/pos/management-table/index.tsx +0 -0
- package/src/pages/pos/payment-success/index.tsx +0 -75
- package/src/provider/app-provider.tsx +0 -56
- package/src/provider/fallback/custom-error.tsx +0 -26
- package/src/provider/main-provider.tsx +0 -41
- package/src/provider/meta-provider.tsx +0 -72
- package/src/provider/modal-provider.tsx +0 -48
- package/src/provider/notification-provider.tsx +0 -64
- package/src/provider/pos-provider/close-session-provider/index.tsx +0 -207
- package/src/provider/pos-provider/customer-provider/index.tsx +0 -30
- package/src/provider/pos-provider/floor-provider/index.tsx +0 -39
- package/src/provider/pos-provider/index.ts +0 -6
- package/src/provider/pos-provider/kitchen-provider/index.tsx +0 -30
- package/src/provider/pos-provider/order-detail-provider/index.tsx +0 -233
- package/src/provider/pos-provider/order-provider/index.tsx +0 -803
- package/src/provider/pos-provider/payment-provider/index.tsx +0 -30
- package/src/provider/pos-provider/product-provider/index.tsx +0 -30
- package/src/provider/pos-provider/sale-provider/index.tsx +0 -168
- package/src/provider/pos-provider/session-provider/index.tsx +0 -30
- package/src/provider/pos-provider/socket-provider/index.tsx +0 -118
- package/src/provider/pos-provider/table-provider/index.tsx +0 -30
- package/src/provider/public-provider.tsx +0 -104
- package/src/provider/use-session-provider.ts +0 -79
- package/src/router/app-router.tsx +0 -38
- package/src/router/index.tsx +0 -26
- package/src/router/pos-route.tsx +0 -75
- package/src/router/protected-route.tsx +0 -16
- package/src/router/public-route.tsx +0 -11
- package/src/store/header/index.ts +0 -21
- package/src/store/session/index.ts +0 -25
- package/src/store/states/cart.state.ts +0 -135
- package/src/store/states/close-session.state.ts +0 -20
- package/src/store/states/customer.state.ts +0 -19
- package/src/store/states/payment.state.ts +0 -14
- package/src/styles/base.css +0 -212
- package/src/styles/common.css +0 -65
- package/src/styles/lib/tailwind.css +0 -0
- package/src/styles/lib/tailwind.theme.css +0 -34
- package/src/styles/loading.css +0 -72
- package/src/styles/main.css +0 -5
- package/src/styles/refreshing-content.css +0 -55
- package/src/styles/text.css +0 -44
- package/src/types/account.ts +0 -61
- package/src/types/branch.ts +0 -6
- package/src/types/category.ts +0 -13
- package/src/types/common.ts +0 -4
- package/src/types/customer.ts +0 -52
- package/src/types/dashboard.ts +0 -18
- package/src/types/edc.ts +0 -37
- package/src/types/export-e-invoice.ts +0 -17
- package/src/types/filter.d.ts +0 -12
- package/src/types/floor/floor.ts +0 -16
- package/src/types/floor.d.ts +0 -36
- package/src/types/index.ts +0 -127
- package/src/types/invoice.ts +0 -32
- package/src/types/modal.ts +0 -15
- package/src/types/notification.ts +0 -12
- package/src/types/order.ts +0 -182
- package/src/types/payment.ts +0 -44
- package/src/types/product/product.ts +0 -47
- package/src/types/product.ts +0 -137
- package/src/types/provider-info.d.ts +0 -14
- package/src/types/qr.d.ts +0 -25
- package/src/types/report.d.ts +0 -43
- package/src/types/sale.d.ts +0 -68
- package/src/types/search.d.ts +0 -7
- package/src/types/session.d.ts +0 -30
- package/src/types/shop-qr.d.ts +0 -89
- package/src/types/staff.d.ts +0 -35
- package/src/types/store.d.ts +0 -25
- package/src/types/table.d.ts +0 -57
- package/src/utils/close-session-ticket.tsx +0 -129
- package/src/utils/functions.ts +0 -299
- package/src/utils/i18n.ts +0 -25
- package/src/utils/pos/bill.ts +0 -156
- package/src/utils/pos/convert-order.ts +0 -58
- package/src/utils/pos/helpers.ts +0 -48
- package/src/utils/pos/session.ts +0 -44
- package/src/utils/storages/index.ts +0 -1
- package/src/utils/storages/local-storage.ts +0 -72
- package/tailwind.preset.ts +0 -25
- package/tsconfig.json +0 -30
- package/tsup.config.ts +0 -30
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import { IcThreeDots } from "@assets/icons/common";
|
|
2
|
-
import { ButtonIcon } from "@components/common/button-icon";
|
|
3
|
-
import { AddCustomerDrawer } from "@components/customer-management/add-customer/add-customer-drawer";
|
|
4
|
-
import { ChooseCustomerDrawer } from "@components/customer-management/choose-customer-drawer";
|
|
5
|
-
import CustomerInfo from "@components/pos-management/cart-content/order-info/customer-info";
|
|
6
|
-
import { OrderHelperModal } from "@components/pos-management/order-helper/order-helper-modal";
|
|
7
|
-
import { QUERY_KEYS } from "@constants/query.constant";
|
|
8
|
-
import { useQueryParams } from "@hooks/common/use-query-params";
|
|
9
|
-
import { useFloor } from "@provider/pos-provider/floor-provider";
|
|
10
|
-
import { useSale } from "@provider/pos-provider/sale-provider";
|
|
11
|
-
import { useCustomerStore } from "@store/states/customer.state";
|
|
12
|
-
import { TCustomer } from "@type/customer";
|
|
13
|
-
import { TFloor } from "@type/floor/floor";
|
|
14
|
-
import { TBasicOrder } from "@type/order";
|
|
15
|
-
import { useMemo, useState } from "react";
|
|
16
|
-
|
|
17
|
-
export const OrderInfo = ({
|
|
18
|
-
orderDetail,
|
|
19
|
-
showPayment,
|
|
20
|
-
}: {
|
|
21
|
-
orderDetail: TBasicOrder;
|
|
22
|
-
showPayment: boolean;
|
|
23
|
-
}) => {
|
|
24
|
-
const { getQuery } = useQueryParams();
|
|
25
|
-
const { setCustomer, setIsEditMode } = useCustomerStore();
|
|
26
|
-
|
|
27
|
-
const [openOrderHelperModal, setOpenOrderHelperModal] = useState(false);
|
|
28
|
-
const [openChooseCustomerModal, setOpenChooseCustomerModal] = useState(false);
|
|
29
|
-
const [openAddCustomerModal, setOpenAddCustomerModal] = useState(false);
|
|
30
|
-
|
|
31
|
-
const onOpenChooseCustomerModal = () => setOpenChooseCustomerModal(true);
|
|
32
|
-
|
|
33
|
-
const onOpenAddCustomerModal = () => {
|
|
34
|
-
setOpenChooseCustomerModal(false);
|
|
35
|
-
setOpenAddCustomerModal(true);
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
const onEditCustomer = ({ customer }: { customer: TCustomer }) => {
|
|
39
|
-
setOpenChooseCustomerModal(false);
|
|
40
|
-
setOpenAddCustomerModal(true);
|
|
41
|
-
setIsEditMode(true);
|
|
42
|
-
setCustomer(customer);
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
const orderIdActive = getQuery(QUERY_KEYS.ORDER_ID);
|
|
46
|
-
const { floors: floorData } = useFloor();
|
|
47
|
-
const tableName = useMemo(() => {
|
|
48
|
-
const tableNumber = floorData
|
|
49
|
-
?.find((item: TFloor) =>
|
|
50
|
-
item.table_ids?.find((item) => item.id == orderDetail.table_id)
|
|
51
|
-
)
|
|
52
|
-
?.table_ids?.find(
|
|
53
|
-
(item) => item.id == orderDetail.table_id
|
|
54
|
-
)?.table_number;
|
|
55
|
-
|
|
56
|
-
return tableNumber;
|
|
57
|
-
}, [orderDetail, orderIdActive]);
|
|
58
|
-
|
|
59
|
-
const { getData, isModePosRestaurant } = useSale();
|
|
60
|
-
|
|
61
|
-
return (
|
|
62
|
-
<div className="flex justify-between items-center">
|
|
63
|
-
<div className="flex gap-2 items-center">
|
|
64
|
-
<div className="flex flex-col ">
|
|
65
|
-
{
|
|
66
|
-
<p className="font-bold text-text-primary">
|
|
67
|
-
{!isModePosRestaurant
|
|
68
|
-
? "Mã đơn hàng"
|
|
69
|
-
: orderDetail.table_id
|
|
70
|
-
? `Bàn ${tableName}`
|
|
71
|
-
: "Mang đi"}
|
|
72
|
-
</p>
|
|
73
|
-
}
|
|
74
|
-
<p className="text-sm font-medium text-text-disable">
|
|
75
|
-
#{orderDetail.id}
|
|
76
|
-
</p>
|
|
77
|
-
</div>
|
|
78
|
-
</div>
|
|
79
|
-
<div className="flex gap-2">
|
|
80
|
-
<CustomerInfo
|
|
81
|
-
onOpenChooseCustomerModal={onOpenChooseCustomerModal}
|
|
82
|
-
onEditCustomer={onEditCustomer}
|
|
83
|
-
/>
|
|
84
|
-
{!showPayment && (
|
|
85
|
-
<ButtonIcon
|
|
86
|
-
iconSrc={<IcThreeDots />}
|
|
87
|
-
onClick={() => setOpenOrderHelperModal(true)}
|
|
88
|
-
/>
|
|
89
|
-
)}
|
|
90
|
-
</div>
|
|
91
|
-
|
|
92
|
-
<OrderHelperModal
|
|
93
|
-
isOpen={openOrderHelperModal}
|
|
94
|
-
onClose={() => setOpenOrderHelperModal(false)}
|
|
95
|
-
/>
|
|
96
|
-
|
|
97
|
-
<ChooseCustomerDrawer
|
|
98
|
-
isOpen={openChooseCustomerModal}
|
|
99
|
-
onClose={() => setOpenChooseCustomerModal(false)}
|
|
100
|
-
onOpenAddCustomerModal={onOpenAddCustomerModal}
|
|
101
|
-
/>
|
|
102
|
-
|
|
103
|
-
<AddCustomerDrawer
|
|
104
|
-
isOpen={openAddCustomerModal}
|
|
105
|
-
onClose={() => setOpenAddCustomerModal(false)}
|
|
106
|
-
/>
|
|
107
|
-
</div>
|
|
108
|
-
);
|
|
109
|
-
};
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { VNCurrency } from "@components/common/header";
|
|
2
|
-
import { useOrderDetail } from "@provider/pos-provider/order-detail-provider";
|
|
3
|
-
import { ceilDecimal } from "@utils/functions";
|
|
4
|
-
import { t } from "i18next";
|
|
5
|
-
|
|
6
|
-
export const OrderTotal = () => {
|
|
7
|
-
const { taxAmount, totalAmount, totalQty } = useOrderDetail();
|
|
8
|
-
|
|
9
|
-
return (
|
|
10
|
-
<div className="border-t border-stroke-default px-3 py-2 bg-white text-text-disable">
|
|
11
|
-
<div className="flex justify-between items-center text-[--color-secondary]">
|
|
12
|
-
<p className="text-sm leading-5 tracking-[-0.12px]">{t("tax_vat")}</p>
|
|
13
|
-
<div className="flex gap-1 items-center font-medium">
|
|
14
|
-
<p className="leading-[26px]">
|
|
15
|
-
{ceilDecimal(taxAmount)?.toLocaleString()}
|
|
16
|
-
</p>
|
|
17
|
-
<p className="leading-6 tracking-[-0.24px]">{VNCurrency}</p>
|
|
18
|
-
</div>
|
|
19
|
-
</div>
|
|
20
|
-
|
|
21
|
-
<div className="flex justify-between items-center text-[--color-secondary]">
|
|
22
|
-
<p className="text-sm leading-5 tracking-[-0.12px]">
|
|
23
|
-
{t("total")} {`(${totalQty} ${t("product")})`}
|
|
24
|
-
</p>
|
|
25
|
-
<div className="flex gap-1 items-center font-semibold text-text-active">
|
|
26
|
-
<p className="leading-7 tracking-[-0.2px]">
|
|
27
|
-
{ceilDecimal(totalAmount)?.toLocaleString()}
|
|
28
|
-
</p>
|
|
29
|
-
<p className="font-semibold leading-6 tracking-[-0.24px]">
|
|
30
|
-
{VNCurrency}
|
|
31
|
-
</p>
|
|
32
|
-
</div>
|
|
33
|
-
</div>
|
|
34
|
-
</div>
|
|
35
|
-
);
|
|
36
|
-
};
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { IcPlus } from "@assets/icons/breadcrumbs-icon";
|
|
2
|
-
import { IcOrderList } from "@assets/icons/pos-icon";
|
|
3
|
-
import ButtonAction from "@components/common/button-action";
|
|
4
|
-
import { ButtonIcon } from "@components/common/button-icon";
|
|
5
|
-
import { TabsLayout, TTab } from "@components/common/tabs-layout";
|
|
6
|
-
import { QUERY_KEYS } from "@constants/query.constant";
|
|
7
|
-
import { useQueryParams } from "@hooks/common/use-query-params";
|
|
8
|
-
import { useOrder } from "@provider/pos-provider/order-provider";
|
|
9
|
-
import { TBasicOrder } from "@type/order";
|
|
10
|
-
import { useEffect, useMemo } from "react";
|
|
11
|
-
|
|
12
|
-
export const OrdersLine = ({
|
|
13
|
-
draftOrders,
|
|
14
|
-
onShowDraftOrders,
|
|
15
|
-
displayedOrders,
|
|
16
|
-
setDisplayedOrders,
|
|
17
|
-
}: {
|
|
18
|
-
draftOrders: TBasicOrder[];
|
|
19
|
-
onShowDraftOrders: () => void;
|
|
20
|
-
displayedOrders: string[];
|
|
21
|
-
setDisplayedOrders: (value: string[]) => void;
|
|
22
|
-
}) => {
|
|
23
|
-
const { getQuery } = useQueryParams();
|
|
24
|
-
|
|
25
|
-
const orderId = getQuery(QUERY_KEYS.ORDER_ID);
|
|
26
|
-
const tableId = getQuery(QUERY_KEYS.TABLE_ID);
|
|
27
|
-
const { handleCreateOrder } = useOrder();
|
|
28
|
-
|
|
29
|
-
const orderTabsValue: TTab[] = useMemo(() => {
|
|
30
|
-
return displayedOrders
|
|
31
|
-
?.filter((id) => !!id)
|
|
32
|
-
?.map((orderId) => ({
|
|
33
|
-
id: orderId,
|
|
34
|
-
name: `DH-${orderId}`,
|
|
35
|
-
}));
|
|
36
|
-
}, [displayedOrders]);
|
|
37
|
-
|
|
38
|
-
useEffect(() => {
|
|
39
|
-
if (displayedOrders.length == 0 || !orderId) return;
|
|
40
|
-
const isDisplayOrder = displayedOrders.includes(orderId);
|
|
41
|
-
if (!isDisplayOrder) {
|
|
42
|
-
setDisplayedOrders([orderId, ...displayedOrders.slice(0, 2)]);
|
|
43
|
-
}
|
|
44
|
-
}, [orderId]);
|
|
45
|
-
|
|
46
|
-
return (
|
|
47
|
-
<TabsLayout
|
|
48
|
-
tabs={orderTabsValue}
|
|
49
|
-
queryKey={QUERY_KEYS.ORDER_ID}
|
|
50
|
-
className="border-b border-[--stroke-default] sticky top-0 z-10 px-[6px]"
|
|
51
|
-
rightButton={
|
|
52
|
-
<>
|
|
53
|
-
{draftOrders.length > 0 && (
|
|
54
|
-
<ButtonAction
|
|
55
|
-
onClick={() => onShowDraftOrders()}
|
|
56
|
-
className="border border-text-active !px-3 text-text-active min-w-0"
|
|
57
|
-
text={draftOrders.length.toString()}
|
|
58
|
-
iconSrc={<IcOrderList />}
|
|
59
|
-
/>
|
|
60
|
-
)}
|
|
61
|
-
{!tableId && (
|
|
62
|
-
<ButtonIcon
|
|
63
|
-
iconSrc={<IcPlus />}
|
|
64
|
-
onClick={() => handleCreateOrder()}
|
|
65
|
-
className="border-text-active text-text-active"
|
|
66
|
-
/>
|
|
67
|
-
)}
|
|
68
|
-
</>
|
|
69
|
-
}
|
|
70
|
-
/>
|
|
71
|
-
);
|
|
72
|
-
};
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { IcSearch } from "@assets/icons/breadcrumbs-icon";
|
|
2
|
-
import { IcBarCode } from "@assets/icons/order-icon";
|
|
3
|
-
import { ButtonIcon } from "@components/common/button-icon";
|
|
4
|
-
import { QUERY_KEYS } from "@constants/query.constant";
|
|
5
|
-
import { Dispatch, SetStateAction } from "react";
|
|
6
|
-
import { TabsLayout } from "../../common/tabs-layout";
|
|
7
|
-
|
|
8
|
-
export const CategoryTabs = ({
|
|
9
|
-
categoriesData,
|
|
10
|
-
setIsSearchMode,
|
|
11
|
-
setIsScanMode,
|
|
12
|
-
}: {
|
|
13
|
-
categoriesData: TCategory[];
|
|
14
|
-
setIsSearchMode: Dispatch<SetStateAction<boolean>>;
|
|
15
|
-
setIsScanMode: () => void;
|
|
16
|
-
}) => {
|
|
17
|
-
return (
|
|
18
|
-
<TabsLayout
|
|
19
|
-
tabs={categoriesData}
|
|
20
|
-
queryKey={QUERY_KEYS.CATEGORY_ID}
|
|
21
|
-
className="sticky top-0 z-20"
|
|
22
|
-
rightButton={
|
|
23
|
-
<>
|
|
24
|
-
<ButtonIcon
|
|
25
|
-
iconSrc={<IcSearch />}
|
|
26
|
-
onClick={() => setIsSearchMode(true)}
|
|
27
|
-
/>
|
|
28
|
-
<ButtonIcon iconSrc={<IcBarCode />} onClick={setIsScanMode} />
|
|
29
|
-
</>
|
|
30
|
-
}
|
|
31
|
-
/>
|
|
32
|
-
);
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
export type TCategory = {
|
|
36
|
-
id: number;
|
|
37
|
-
name: string;
|
|
38
|
-
};
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { IcCart } from "@assets/icons/cart-icon";
|
|
2
|
-
import { IcSeatTable } from "@assets/icons/table-icon";
|
|
3
|
-
import ButtonAction from "@components/common/button-action";
|
|
4
|
-
import ModalZoom from "@components/common/modal/modal-zoom";
|
|
5
|
-
import { QUERY_KEYS } from "@constants/query.constant";
|
|
6
|
-
import POSPath from "@constants/routes.constants";
|
|
7
|
-
import { useQueryParams } from "@hooks/common/use-query-params";
|
|
8
|
-
import { useOrder } from "@provider/pos-provider/order-provider";
|
|
9
|
-
import { useSale } from "@provider/pos-provider/sale-provider";
|
|
10
|
-
import { useNavigate } from "react-router-dom";
|
|
11
|
-
|
|
12
|
-
type Props = {
|
|
13
|
-
onClose: () => void;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export const CreateOrderModal = ({ onClose }: Props) => {
|
|
17
|
-
const { handleCreateOrder } = useOrder();
|
|
18
|
-
const { formatQuery } = useQueryParams();
|
|
19
|
-
const navigate = useNavigate();
|
|
20
|
-
const { getData, isModePosRestaurant } = useSale();
|
|
21
|
-
|
|
22
|
-
const onCreateOrder = () => {
|
|
23
|
-
handleCreateOrder();
|
|
24
|
-
onClose();
|
|
25
|
-
};
|
|
26
|
-
const onChooseTable = () => {
|
|
27
|
-
navigate({
|
|
28
|
-
pathname: POSPath.MENUS,
|
|
29
|
-
search: `?${formatQuery([QUERY_KEYS.POS_ID, QUERY_KEYS.SESSION_ID])}`,
|
|
30
|
-
});
|
|
31
|
-
onClose();
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
return (
|
|
35
|
-
<ModalZoom
|
|
36
|
-
isOpen
|
|
37
|
-
onClose={onClose}
|
|
38
|
-
className=""
|
|
39
|
-
modalClassName="w-[50%] text-text-primary"
|
|
40
|
-
title="Chưa tạo đơn hàng"
|
|
41
|
-
>
|
|
42
|
-
<div className="flex flex-col gap-5">
|
|
43
|
-
<p className="font-medium">
|
|
44
|
-
Bạn chưa khởi tạo đơn hàng. Vui lòng tạo đơn hàng trước khi thêm món
|
|
45
|
-
</p>
|
|
46
|
-
<div className="flex gap-2 w-full">
|
|
47
|
-
<ButtonAction
|
|
48
|
-
onClick={onCreateOrder}
|
|
49
|
-
text="Tạo đơn mang đi"
|
|
50
|
-
iconSrc={<IcCart />}
|
|
51
|
-
className="button-secondary w-full"
|
|
52
|
-
/>
|
|
53
|
-
{isModePosRestaurant && (
|
|
54
|
-
<ButtonAction
|
|
55
|
-
onClick={onChooseTable}
|
|
56
|
-
text="Chọn bàn"
|
|
57
|
-
iconSrc={<IcSeatTable />}
|
|
58
|
-
className="button-primary w-full"
|
|
59
|
-
/>
|
|
60
|
-
)}
|
|
61
|
-
</div>
|
|
62
|
-
</div>
|
|
63
|
-
</ModalZoom>
|
|
64
|
-
);
|
|
65
|
-
};
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import { EmptyState } from "@components/common/empty-state";
|
|
2
|
-
import Search from "@components/pos-management/search";
|
|
3
|
-
import { QUERY_KEYS } from "@constants/query.constant";
|
|
4
|
-
import { useQueryParams } from "@hooks/common/use-query-params";
|
|
5
|
-
import { useProduct } from "@provider/pos-provider/product-provider";
|
|
6
|
-
import { LoadDataModel, useSale } from "@provider/pos-provider/sale-provider";
|
|
7
|
-
import { TProduct } from "@type/product/product";
|
|
8
|
-
import { useMemo, useState } from "react";
|
|
9
|
-
import { AddProductFromBarcode } from "../add-product-from-barcode";
|
|
10
|
-
import { CategoryTabs } from "./category-tab";
|
|
11
|
-
import { CreateOrderModal } from "./create-order-modal";
|
|
12
|
-
import { ProductItem } from "./product-item";
|
|
13
|
-
|
|
14
|
-
const ProductContent = () => {
|
|
15
|
-
const [searchValue, setSearchValue] = useState("");
|
|
16
|
-
const [isScanMode, setIsScanMode] = useState(false);
|
|
17
|
-
const [isSearchMode, setIsSearchMode] = useState(false);
|
|
18
|
-
const [showModal, setShowModal] = useState(false);
|
|
19
|
-
|
|
20
|
-
const {
|
|
21
|
-
queryResult: { data: posSession },
|
|
22
|
-
} = useSale();
|
|
23
|
-
|
|
24
|
-
const { getQuery } = useQueryParams();
|
|
25
|
-
const activeCategoryId = getQuery(QUERY_KEYS.CATEGORY_ID);
|
|
26
|
-
const categoriesData = posSession?.[LoadDataModel.POS_CATEGORY]?.data ?? [];
|
|
27
|
-
const { data: products } = useProduct();
|
|
28
|
-
|
|
29
|
-
const productData = useMemo(() => {
|
|
30
|
-
const productsToFilter = isSearchMode
|
|
31
|
-
? products
|
|
32
|
-
: products?.filter((product: TProduct) =>
|
|
33
|
-
product?.pos_categ_ids?.includes(Number(activeCategoryId))
|
|
34
|
-
);
|
|
35
|
-
|
|
36
|
-
const data =
|
|
37
|
-
productsToFilter?.filter((product: TProduct) =>
|
|
38
|
-
product.display_name.toLowerCase().includes(searchValue.toLowerCase())
|
|
39
|
-
) ?? [];
|
|
40
|
-
return data as TProduct[];
|
|
41
|
-
}, [products, activeCategoryId, searchValue, isSearchMode]);
|
|
42
|
-
|
|
43
|
-
return (
|
|
44
|
-
<div className="h-full overflow-y-auto">
|
|
45
|
-
{isSearchMode ? (
|
|
46
|
-
<Search
|
|
47
|
-
placeholder="Tìm kiếm món"
|
|
48
|
-
searchValue={searchValue}
|
|
49
|
-
onSearchChange={setSearchValue}
|
|
50
|
-
onClose={() => setIsSearchMode(false)}
|
|
51
|
-
isNumericMode={false}
|
|
52
|
-
/>
|
|
53
|
-
) : (
|
|
54
|
-
<CategoryTabs
|
|
55
|
-
categoriesData={categoriesData}
|
|
56
|
-
setIsSearchMode={setIsSearchMode}
|
|
57
|
-
setIsScanMode={() => setIsScanMode(!isScanMode)}
|
|
58
|
-
/>
|
|
59
|
-
)}
|
|
60
|
-
<div className="overflow-auto p-4 z-0 border-t border-stroke-default">
|
|
61
|
-
{isSearchMode && !searchValue.length ? (
|
|
62
|
-
""
|
|
63
|
-
) : isSearchMode && searchValue.length && productData?.length === 0 ? (
|
|
64
|
-
<EmptyState
|
|
65
|
-
image="/assets/images/empty-cart.svg"
|
|
66
|
-
imageAlt="product_no_data"
|
|
67
|
-
description="Không có món bạn tìm kiếm"
|
|
68
|
-
className="pt-20"
|
|
69
|
-
imageClassName="size-[200px]"
|
|
70
|
-
/>
|
|
71
|
-
) : (
|
|
72
|
-
<div className="grid gap-2 grid-cols-[repeat(auto-fill,minmax(162px,1fr))]">
|
|
73
|
-
{productData?.map((product: TProduct) => (
|
|
74
|
-
<ProductItem
|
|
75
|
-
key={product.id}
|
|
76
|
-
product={product}
|
|
77
|
-
setShowModal={setShowModal}
|
|
78
|
-
/>
|
|
79
|
-
))}
|
|
80
|
-
{showModal && (
|
|
81
|
-
<CreateOrderModal onClose={() => setShowModal(false)} />
|
|
82
|
-
)}
|
|
83
|
-
</div>
|
|
84
|
-
)}
|
|
85
|
-
</div>
|
|
86
|
-
{isScanMode && productData && (
|
|
87
|
-
<AddProductFromBarcode productsData={productData} />
|
|
88
|
-
)}
|
|
89
|
-
</div>
|
|
90
|
-
);
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
export default ProductContent;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { VNCurrency } from "@components/common/header";
|
|
2
|
-
import { TProduct } from "@type/product/product";
|
|
3
|
-
|
|
4
|
-
type TProps = {
|
|
5
|
-
productData: TProduct | undefined;
|
|
6
|
-
totalPrice: number;
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
const ProductInfo = (props: TProps) => {
|
|
10
|
-
const { productData, totalPrice } = props;
|
|
11
|
-
|
|
12
|
-
if (!productData) return null;
|
|
13
|
-
|
|
14
|
-
return (
|
|
15
|
-
<div className="flex flex-col gap-2">
|
|
16
|
-
<div className="flex items-center justify-between">
|
|
17
|
-
<p className="font-medium leading-6 tracking-[-0.24px] text-text-primary">
|
|
18
|
-
{productData.display_name}
|
|
19
|
-
</p>
|
|
20
|
-
<p className="font-semibold leading-6 tracking-[-0.24px] text-text-primary">
|
|
21
|
-
{totalPrice.toLocaleString()} {VNCurrency}
|
|
22
|
-
</p>
|
|
23
|
-
</div>
|
|
24
|
-
</div>
|
|
25
|
-
);
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export default ProductInfo;
|
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
import TextArea from "@components/common/input/text-area";
|
|
2
|
-
import ModalZoom from "@components/common/modal/modal-zoom";
|
|
3
|
-
import { useProduct } from "@provider/pos-provider/product-provider";
|
|
4
|
-
import { useCartStore } from "@store/states/cart.state";
|
|
5
|
-
import { TAttributeLine, TAttributeValue } from "@type/product/product";
|
|
6
|
-
import { getKey } from "@utils/functions";
|
|
7
|
-
import { t } from "i18next";
|
|
8
|
-
import { useEffect, useMemo, useState } from "react";
|
|
9
|
-
import ProductInfo from "./info";
|
|
10
|
-
import ProductOption from "./option";
|
|
11
|
-
import QuantityControl from "./quantity-control";
|
|
12
|
-
|
|
13
|
-
const ProductDetailModal = () => {
|
|
14
|
-
const { productData } = useProduct();
|
|
15
|
-
const { activeProduct, setActiveProduct, cartItems } = useCartStore();
|
|
16
|
-
const [selectedOject, setSelectedOject] = useState<Record<number, number[]>>(
|
|
17
|
-
{}
|
|
18
|
-
);
|
|
19
|
-
const [productAttributeValueIds, setProductAttributeValueIds] = useState<
|
|
20
|
-
number[]
|
|
21
|
-
>([]);
|
|
22
|
-
const [quantity, setQuantity] = useState<number>(1);
|
|
23
|
-
const [note, setNote] = useState<string>("");
|
|
24
|
-
const onClose = () => {
|
|
25
|
-
setActiveProduct({ id: "", isFromCart: false });
|
|
26
|
-
setSelectedOject({});
|
|
27
|
-
setProductAttributeValueIds([]);
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
const onSetSelectedOject = (
|
|
31
|
-
id: number,
|
|
32
|
-
value: number,
|
|
33
|
-
isMultiOption?: boolean
|
|
34
|
-
) => {
|
|
35
|
-
if (selectedOject?.[id]?.includes(value) && isMultiOption) {
|
|
36
|
-
setSelectedOject({
|
|
37
|
-
...selectedOject,
|
|
38
|
-
[id]: [...selectedOject[id].filter((item) => item !== value)],
|
|
39
|
-
});
|
|
40
|
-
} else
|
|
41
|
-
setSelectedOject((prev) => ({
|
|
42
|
-
...prev,
|
|
43
|
-
[id]: isMultiOption ? [...(prev?.[id] ?? []), value] : [value],
|
|
44
|
-
}));
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
useEffect(() => {
|
|
48
|
-
cartItems?.[activeProduct.id]?.qty &&
|
|
49
|
-
activeProduct.isFromCart &&
|
|
50
|
-
setQuantity(cartItems?.[activeProduct.id]?.qty);
|
|
51
|
-
const attributeValueIds =
|
|
52
|
-
cartItems?.[activeProduct.id]?.product?.attributeValueIds ?? [];
|
|
53
|
-
const attributeValue = productData?.attributeLines?.map(
|
|
54
|
-
(attributeLine: TAttributeLine) => {
|
|
55
|
-
const pickValue = attributeLine.value_string
|
|
56
|
-
?.filter((item: TAttributeValue) =>
|
|
57
|
-
attributeValueIds.includes(item.id)
|
|
58
|
-
)
|
|
59
|
-
.map((item: TAttributeValue) => item.id);
|
|
60
|
-
pickValue.length > 0 &&
|
|
61
|
-
setSelectedOject((prev) => ({
|
|
62
|
-
...prev,
|
|
63
|
-
[attributeLine.id]: pickValue,
|
|
64
|
-
}));
|
|
65
|
-
return pickValue;
|
|
66
|
-
}
|
|
67
|
-
);
|
|
68
|
-
attributeValue?.flat() &&
|
|
69
|
-
setProductAttributeValueIds(attributeValue?.flat());
|
|
70
|
-
return () => {
|
|
71
|
-
setQuantity(1);
|
|
72
|
-
};
|
|
73
|
-
}, [cartItems, activeProduct]);
|
|
74
|
-
|
|
75
|
-
const totalPrice = useMemo(() => {
|
|
76
|
-
const totalAttributePrice =
|
|
77
|
-
productData?.attributeLines?.reduce((acc, line) => {
|
|
78
|
-
if (selectedOject?.[line.id]) {
|
|
79
|
-
return (
|
|
80
|
-
acc +
|
|
81
|
-
(line.value_string?.reduce(
|
|
82
|
-
(totalExtra, item) =>
|
|
83
|
-
totalExtra +
|
|
84
|
-
(selectedOject?.[line.id].includes(item.id)
|
|
85
|
-
? item.price_extra
|
|
86
|
-
: 0),
|
|
87
|
-
0
|
|
88
|
-
) ?? 0)
|
|
89
|
-
);
|
|
90
|
-
}
|
|
91
|
-
return acc;
|
|
92
|
-
}, 0) ?? 0;
|
|
93
|
-
return (totalAttributePrice + (productData?.lst_price ?? 0)) * quantity;
|
|
94
|
-
}, [productData, selectedOject, quantity]);
|
|
95
|
-
return (
|
|
96
|
-
<ModalZoom
|
|
97
|
-
isOpen={!!activeProduct.id}
|
|
98
|
-
onClose={onClose}
|
|
99
|
-
className="p-0 py-4 px-5"
|
|
100
|
-
modalClassName="w-[70%]"
|
|
101
|
-
title="Tùy chọn" //multi language
|
|
102
|
-
footer={
|
|
103
|
-
<QuantityControl
|
|
104
|
-
isUpdate={!!activeProduct.isFromCart}
|
|
105
|
-
onClose={onClose}
|
|
106
|
-
productData={
|
|
107
|
-
productData
|
|
108
|
-
? {
|
|
109
|
-
...productData,
|
|
110
|
-
productCartKey: getKey({
|
|
111
|
-
...productData,
|
|
112
|
-
attributeValueIds: productAttributeValueIds?.flat(),
|
|
113
|
-
}),
|
|
114
|
-
}
|
|
115
|
-
: undefined
|
|
116
|
-
}
|
|
117
|
-
selectedOject={selectedOject}
|
|
118
|
-
quantity={quantity}
|
|
119
|
-
setQuantity={setQuantity}
|
|
120
|
-
note={note}
|
|
121
|
-
/>
|
|
122
|
-
}
|
|
123
|
-
>
|
|
124
|
-
<div className="flex flex-col gap-4">
|
|
125
|
-
<ProductInfo productData={productData} totalPrice={totalPrice} />
|
|
126
|
-
|
|
127
|
-
<div className="flex flex-col gap-4">
|
|
128
|
-
{productData?.attributeLines?.map((option, index) => (
|
|
129
|
-
<ProductOption
|
|
130
|
-
key={index}
|
|
131
|
-
option={option}
|
|
132
|
-
optionsSelected={selectedOject}
|
|
133
|
-
onSetSelectedOject={onSetSelectedOject}
|
|
134
|
-
/>
|
|
135
|
-
))}
|
|
136
|
-
</div>
|
|
137
|
-
|
|
138
|
-
<TextArea
|
|
139
|
-
title={t("note_for_kitchen")}
|
|
140
|
-
placeholder={t("note_for_kitchen_subtitle")}
|
|
141
|
-
onChange={(e) => setNote(e.target.value)}
|
|
142
|
-
/>
|
|
143
|
-
</div>
|
|
144
|
-
</ModalZoom>
|
|
145
|
-
);
|
|
146
|
-
};
|
|
147
|
-
|
|
148
|
-
export default ProductDetailModal;
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import { TAttributeLine, TAttributeValue } from "@type/product/product";
|
|
2
|
-
import { t } from "i18next";
|
|
3
|
-
import { useEffect } from "react";
|
|
4
|
-
|
|
5
|
-
type TProductOptionProps = {
|
|
6
|
-
option: TAttributeLine;
|
|
7
|
-
optionsSelected?: Record<string, number[]>;
|
|
8
|
-
onSetSelectedOject: (
|
|
9
|
-
id: number,
|
|
10
|
-
value: number,
|
|
11
|
-
isMultiOption?: boolean
|
|
12
|
-
) => void;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
const ProductOption = (props: TProductOptionProps) => {
|
|
16
|
-
const { option, optionsSelected, onSetSelectedOject } = props;
|
|
17
|
-
useEffect(() => {
|
|
18
|
-
if (option.type == "pills")
|
|
19
|
-
onSetSelectedOject(option.id, option.value_string[0].id);
|
|
20
|
-
}, [option]);
|
|
21
|
-
|
|
22
|
-
return (
|
|
23
|
-
<div className="flex flex-col gap-4">
|
|
24
|
-
<div className="flex items-center justify-between">
|
|
25
|
-
<p className="font-semibold leading-6 tracking-[-0.24px] text-text-primary">
|
|
26
|
-
{option.name}
|
|
27
|
-
</p>
|
|
28
|
-
{option.type == "multi" && (
|
|
29
|
-
<p className="px-2 py-1 rounded border border-tertiary text-xs font-medium text-text-secondary leading-4">
|
|
30
|
-
{t("optional")}
|
|
31
|
-
</p>
|
|
32
|
-
)}
|
|
33
|
-
</div>
|
|
34
|
-
|
|
35
|
-
<div className="flex justify-start flex-wrap items-center gap-3">
|
|
36
|
-
{option.value_string.map((item, index) => (
|
|
37
|
-
<Option
|
|
38
|
-
key={index}
|
|
39
|
-
option={item}
|
|
40
|
-
isActive={optionsSelected?.[option.id]?.includes(item.id)}
|
|
41
|
-
onSetSelectedOject={(value: number) =>
|
|
42
|
-
onSetSelectedOject(option.id, value, option.type == "multi")
|
|
43
|
-
}
|
|
44
|
-
/>
|
|
45
|
-
))}
|
|
46
|
-
</div>
|
|
47
|
-
</div>
|
|
48
|
-
);
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
export default ProductOption;
|
|
52
|
-
|
|
53
|
-
const Option = ({
|
|
54
|
-
option,
|
|
55
|
-
isActive,
|
|
56
|
-
onSetSelectedOject,
|
|
57
|
-
}: {
|
|
58
|
-
option: TAttributeValue;
|
|
59
|
-
isActive?: boolean;
|
|
60
|
-
onSetSelectedOject: (value: number) => void;
|
|
61
|
-
}) => {
|
|
62
|
-
const { name, id } = option;
|
|
63
|
-
|
|
64
|
-
return (
|
|
65
|
-
<div
|
|
66
|
-
onClick={() => onSetSelectedOject(id)}
|
|
67
|
-
className={`rounded-full ${
|
|
68
|
-
isActive
|
|
69
|
-
? "border-2 border-primary bg-surface-primary"
|
|
70
|
-
: "border border-stroke-disabled"
|
|
71
|
-
} px-3 cursor-pointer py-2 w-fit`}
|
|
72
|
-
>
|
|
73
|
-
<p
|
|
74
|
-
className={`text-xs font-medium leading-4 ${
|
|
75
|
-
isActive ? "menu-title" : "text-text-primary"
|
|
76
|
-
}`}
|
|
77
|
-
>
|
|
78
|
-
{name}{" "}
|
|
79
|
-
{option.price_extra != 0 && (
|
|
80
|
-
<span className="menu-title">
|
|
81
|
-
+{option.price_extra?.toLocaleString("en-EN")}đ
|
|
82
|
-
</span>
|
|
83
|
-
)}
|
|
84
|
-
</p>
|
|
85
|
-
</div>
|
|
86
|
-
);
|
|
87
|
-
};
|