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
package/src/types/staff.d.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
export type TStaff = {
|
|
2
|
-
staff_id: string
|
|
3
|
-
email: string
|
|
4
|
-
phone: string
|
|
5
|
-
id: number
|
|
6
|
-
updated_at: string
|
|
7
|
-
store_id: number
|
|
8
|
-
password: string
|
|
9
|
-
merchant_id: number
|
|
10
|
-
created_at: string
|
|
11
|
-
is_deleted: boolean
|
|
12
|
-
store_name: string
|
|
13
|
-
full_name: string
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export type TCreateStaffPayload = {
|
|
17
|
-
staff_id: string
|
|
18
|
-
full_name: string
|
|
19
|
-
store_id: number
|
|
20
|
-
phone: string
|
|
21
|
-
email: string
|
|
22
|
-
password: string
|
|
23
|
-
old_password?: string
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export type TUpdateStaffPayload = {
|
|
27
|
-
id: number
|
|
28
|
-
staff_id: string
|
|
29
|
-
full_name: string
|
|
30
|
-
store_id: number
|
|
31
|
-
phone: string
|
|
32
|
-
email: string
|
|
33
|
-
password?: string
|
|
34
|
-
old_password?: string
|
|
35
|
-
}
|
package/src/types/store.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
export type TStore = {
|
|
2
|
-
source_id: number
|
|
3
|
-
name: string
|
|
4
|
-
vat: string | null
|
|
5
|
-
email: string | null
|
|
6
|
-
parent_id: number | null
|
|
7
|
-
create_date: number
|
|
8
|
-
id: number
|
|
9
|
-
address: string
|
|
10
|
-
phone: string | null
|
|
11
|
-
va_account_no: string | null
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export type TCreateStorePayload = {
|
|
15
|
-
store_name: string
|
|
16
|
-
tax_no: string
|
|
17
|
-
address_line_1: string
|
|
18
|
-
country_id: number
|
|
19
|
-
city_id: string
|
|
20
|
-
district_id: string
|
|
21
|
-
ward_id: string
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export type TAreaItem = { id: string; name: string }
|
|
25
|
-
export type TAreaItemBE1 = { code: string; full_name: string }
|
package/src/types/table.d.ts
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { TBasicOrder } from "./order";
|
|
2
|
-
import { TProductInBill } from "./product";
|
|
3
|
-
|
|
4
|
-
export type TOrderInfor = {
|
|
5
|
-
order_id: number;
|
|
6
|
-
table_name: string;
|
|
7
|
-
name: string;
|
|
8
|
-
point: number;
|
|
9
|
-
updated_at: number;
|
|
10
|
-
status: 0 | 1 | 2; // 0: thanh toán, 1: Có món, 2: Chưa có món
|
|
11
|
-
product_amount: number;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export type TOrderDetail = {
|
|
15
|
-
order_info: TOrderInfor;
|
|
16
|
-
products: TProductInBill[];
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export type TTable = {
|
|
20
|
-
id: number;
|
|
21
|
-
table_id: number;
|
|
22
|
-
table_number: number;
|
|
23
|
-
max_slot: number;
|
|
24
|
-
available_slot: number;
|
|
25
|
-
customer_id: number | null;
|
|
26
|
-
is_available: boolean;
|
|
27
|
-
order_id: number | null;
|
|
28
|
-
order_code: string | null;
|
|
29
|
-
total_price: number | null;
|
|
30
|
-
product_amount: number | null;
|
|
31
|
-
[key: string]: any;
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
export type TBasicTable = {
|
|
35
|
-
id: number;
|
|
36
|
-
table_number: number;
|
|
37
|
-
floor_id: number;
|
|
38
|
-
seats: number;
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
export type TMapedTable = {
|
|
42
|
-
table: TBasicTable;
|
|
43
|
-
isTakeAway: boolean;
|
|
44
|
-
currentOrder?: TBasicOrder;
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
export type TQRTable = {
|
|
48
|
-
tableName: string;
|
|
49
|
-
qrString: string;
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
export type TCreateTablePayload = {
|
|
53
|
-
tableNumber: number;
|
|
54
|
-
floorId: number;
|
|
55
|
-
seats: number;
|
|
56
|
-
onSuccess?: () => void;
|
|
57
|
-
};
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
import { formatCurrency, getDate, hh_mm_dd_mm_yyyy } from "@utils/functions";
|
|
2
|
-
|
|
3
|
-
type TProps = {
|
|
4
|
-
sessionConfirmParams: {
|
|
5
|
-
cashCount: number;
|
|
6
|
-
note: string;
|
|
7
|
-
};
|
|
8
|
-
userData: any;
|
|
9
|
-
posId: number;
|
|
10
|
-
dataCloseSession: any;
|
|
11
|
-
posDetailInfo: any;
|
|
12
|
-
cashDifference: number;
|
|
13
|
-
company: any;
|
|
14
|
-
openAt: any;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export const generateTextShift = async (props: TProps) => {
|
|
18
|
-
const {
|
|
19
|
-
sessionConfirmParams,
|
|
20
|
-
userData,
|
|
21
|
-
posId,
|
|
22
|
-
dataCloseSession,
|
|
23
|
-
posDetailInfo,
|
|
24
|
-
cashDifference,
|
|
25
|
-
company,
|
|
26
|
-
openAt,
|
|
27
|
-
} = props;
|
|
28
|
-
|
|
29
|
-
const user = userData?.userProfile?.data;
|
|
30
|
-
const companyName = userData?.userProfile?.data?.company?.invoice_name;
|
|
31
|
-
const address = user?.company?.address;
|
|
32
|
-
const addressFormat = `${address?.street ?? ""} ${address?.street2 ?? ""}, ${
|
|
33
|
-
address?.ward ?? ""
|
|
34
|
-
}, ${address?.state ?? ""}`;
|
|
35
|
-
|
|
36
|
-
const currentPos = posDetailInfo?.records?.find(
|
|
37
|
-
(item: any) => item.id === Number(posId)
|
|
38
|
-
);
|
|
39
|
-
const closeSessionDate = getDate(new Date());
|
|
40
|
-
|
|
41
|
-
const line = "----------------------------------------";
|
|
42
|
-
|
|
43
|
-
const header = `
|
|
44
|
-
[C]{LOGO}
|
|
45
|
-
[C]
|
|
46
|
-
[C]${addressFormat}
|
|
47
|
-
|
|
48
|
-
[C]<font size='big'><b>PHIẾU GIAO CA</b></font>
|
|
49
|
-
`;
|
|
50
|
-
|
|
51
|
-
const infoRows = `
|
|
52
|
-
[L]Mã ca / Quầy:[R]<b>${[
|
|
53
|
-
currentPos?.current_session_id?.display_name,
|
|
54
|
-
currentPos?.name,
|
|
55
|
-
].join("/")}</b>
|
|
56
|
-
|
|
57
|
-
[L]Nhân viên:[R]<b>${currentPos?.current_user_id?.display_name}</b>
|
|
58
|
-
|
|
59
|
-
[L]Giờ mở ca:[R]${hh_mm_dd_mm_yyyy(openAt)}
|
|
60
|
-
[L]Giờ đóng ca:[R]${hh_mm_dd_mm_yyyy(new Date())}
|
|
61
|
-
`;
|
|
62
|
-
|
|
63
|
-
const openingCash = `
|
|
64
|
-
${line}
|
|
65
|
-
[L]<b>Tiền mặt đầu ca (1)</b>[R]<b>${
|
|
66
|
-
formatCurrency(dataCloseSession?.default_cash_details?.opening) || 0
|
|
67
|
-
} đ</b>
|
|
68
|
-
`;
|
|
69
|
-
|
|
70
|
-
const middleSections = `
|
|
71
|
-
${line}
|
|
72
|
-
[L]<b>Tiền mặt trong ca (2)</b>[R]<b>${
|
|
73
|
-
formatCurrency(dataCloseSession?.default_cash_details?.payment_amount) || 0
|
|
74
|
-
} đ</b>
|
|
75
|
-
[L]Bán hàng[R]${
|
|
76
|
-
formatCurrency(dataCloseSession?.default_cash_details?.payment_amount) || 0
|
|
77
|
-
} đ
|
|
78
|
-
|
|
79
|
-
${line}
|
|
80
|
-
[L]<b>Tiền mặt cuối ca (3)=(1)+(2)</b>[R]<b>${
|
|
81
|
-
formatCurrency(dataCloseSession?.default_cash_details?.amount) || 0
|
|
82
|
-
} đ</b>
|
|
83
|
-
[L]Tiền mặt bàn giao thực tế[R]${
|
|
84
|
-
formatCurrency(sessionConfirmParams.cashCount) || 0
|
|
85
|
-
} đ
|
|
86
|
-
[L]Số tiền chênh lệch[R]${formatCurrency(cashDifference) || 0} đ
|
|
87
|
-
|
|
88
|
-
${line}
|
|
89
|
-
[L]<b>Phương thức thanh toán khác</b>[R]<b>${
|
|
90
|
-
formatCurrency(
|
|
91
|
-
dataCloseSession?.non_cash_payment_methods?.reduce(
|
|
92
|
-
(a: number, b: any) => a + (b?.amount || 0),
|
|
93
|
-
0
|
|
94
|
-
)
|
|
95
|
-
) || 0
|
|
96
|
-
} đ</b>
|
|
97
|
-
${
|
|
98
|
-
dataCloseSession?.non_cash_payment_methods
|
|
99
|
-
?.map(
|
|
100
|
-
(i: any) => `[L]${i?.name}[R]${formatCurrency(i?.amount || 0) || 0} đ`
|
|
101
|
-
)
|
|
102
|
-
?.join("\n") || ""
|
|
103
|
-
}
|
|
104
|
-
`;
|
|
105
|
-
const footer = `
|
|
106
|
-
${line}
|
|
107
|
-
|
|
108
|
-
[C]Ngày ${closeSessionDate.day} tháng ${closeSessionDate.month} năm ${closeSessionDate.year}
|
|
109
|
-
|
|
110
|
-
[C]<b>Người bàn giao Người nhận bàn giao</b>
|
|
111
|
-
|
|
112
|
-
[C]
|
|
113
|
-
[C]
|
|
114
|
-
|
|
115
|
-
[C]<font size='small'>Powered by ${company?.companyInfo?.data?.[0]?.display_name}</font>
|
|
116
|
-
|
|
117
|
-
[C]
|
|
118
|
-
[C]
|
|
119
|
-
[C]
|
|
120
|
-
`;
|
|
121
|
-
|
|
122
|
-
return `
|
|
123
|
-
${header}
|
|
124
|
-
${infoRows}
|
|
125
|
-
${openingCash}
|
|
126
|
-
${middleSections}
|
|
127
|
-
${footer}
|
|
128
|
-
`.trim();
|
|
129
|
-
};
|
package/src/utils/functions.ts
DELETED
|
@@ -1,299 +0,0 @@
|
|
|
1
|
-
import { TProduct } from "@type/product/product";
|
|
2
|
-
import { clsx } from "clsx";
|
|
3
|
-
import { twMerge } from "tailwind-merge";
|
|
4
|
-
|
|
5
|
-
export function cn(...inputs: any[]) {
|
|
6
|
-
return twMerge(clsx(inputs));
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export const generateRandomText = (length: number) => {
|
|
10
|
-
const chars =
|
|
11
|
-
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
12
|
-
let result = "";
|
|
13
|
-
for (let i = 0; i < length; i++) {
|
|
14
|
-
result += chars.charAt(Math.floor(Math.random() * chars.length));
|
|
15
|
-
}
|
|
16
|
-
return result;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export const isObjectEmpty = (obj: object): boolean => {
|
|
20
|
-
return Object.keys(obj).length === 0;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
export function arraysEqual(a: any[], b: any[]): boolean {
|
|
24
|
-
if (a.length !== b.length) return false;
|
|
25
|
-
return a.every((val, i) => val === b[i]);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export const formatCurrency = (value: string | number) => {
|
|
29
|
-
if (!value) return "";
|
|
30
|
-
return new Intl.NumberFormat("en-US").format(Number(value));
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export const getTimeNow = () => {
|
|
34
|
-
const now = new Date();
|
|
35
|
-
const formatted = `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(
|
|
36
|
-
2,
|
|
37
|
-
"0"
|
|
38
|
-
)}-${String(now.getDate()).padStart(2, "0")} ${String(
|
|
39
|
-
now.getHours()
|
|
40
|
-
).padStart(2, "0")}:${String(now.getMinutes()).padStart(2, "0")}:${String(
|
|
41
|
-
now.getSeconds()
|
|
42
|
-
).padStart(2, "0")}`;
|
|
43
|
-
|
|
44
|
-
return formatted;
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
export const parseStringToObject = (str: string) => {
|
|
48
|
-
try {
|
|
49
|
-
// First parse once — this removes outer quotes if needed
|
|
50
|
-
const firstParse = JSON.parse(str);
|
|
51
|
-
|
|
52
|
-
// If the result is still a string (double-encoded), parse again
|
|
53
|
-
if (typeof firstParse === "string") {
|
|
54
|
-
return JSON.parse(firstParse);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
// Otherwise, it's already an object
|
|
58
|
-
return firstParse;
|
|
59
|
-
} catch (error) {
|
|
60
|
-
console.error("❌ Failed to parse JSON:", error);
|
|
61
|
-
return null;
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
export function cleanObject<T extends Record<string, any>>(obj: T): Partial<T> {
|
|
66
|
-
const result: Partial<T> = {};
|
|
67
|
-
for (const [k, v] of Object.entries(obj)) {
|
|
68
|
-
if (v != null) {
|
|
69
|
-
result[k as keyof T] = v;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
return result;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
export function filterObject(obj: Record<string, any>) {
|
|
76
|
-
return Object.fromEntries(
|
|
77
|
-
Object.entries(obj).filter(([_, value]) => {
|
|
78
|
-
if (value === "" || value === null || value === undefined) return false;
|
|
79
|
-
if (value === 0 || value === false) return false;
|
|
80
|
-
if (typeof value === "number" && Number.isNaN(value)) return false;
|
|
81
|
-
return true;
|
|
82
|
-
})
|
|
83
|
-
);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
export function normalizeObject(obj: Record<string, any> | null) {
|
|
87
|
-
if (!obj) return null;
|
|
88
|
-
return Object.fromEntries(
|
|
89
|
-
Object.entries(obj).map(([key, value]) => {
|
|
90
|
-
if (value === false) return [key, ""];
|
|
91
|
-
if (typeof value === "string") return [key, value.trim()];
|
|
92
|
-
return [key, value];
|
|
93
|
-
})
|
|
94
|
-
);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
export const makeTaxIds = (taxIds: number[]) => {
|
|
98
|
-
if (!taxIds || taxIds.length === 0) return [];
|
|
99
|
-
|
|
100
|
-
if (taxIds.length === 1) {
|
|
101
|
-
const id = taxIds[0];
|
|
102
|
-
return [4, id, { id }];
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
return taxIds.map((id) => [4, id, { id }]);
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
export function generatePosReference({
|
|
109
|
-
posId,
|
|
110
|
-
loginNum,
|
|
111
|
-
orderLength,
|
|
112
|
-
}: {
|
|
113
|
-
posId: number | string;
|
|
114
|
-
loginNum: number | string;
|
|
115
|
-
orderLength: number | string;
|
|
116
|
-
}) {
|
|
117
|
-
return (
|
|
118
|
-
"Order " +
|
|
119
|
-
posId.toString().padStart(5, "0") +
|
|
120
|
-
"-" +
|
|
121
|
-
loginNum.toString().padStart(3, "0") +
|
|
122
|
-
"-" +
|
|
123
|
-
orderLength.toString().padStart(4, "0")
|
|
124
|
-
);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
export const getKey = (prodct: TProduct) => {
|
|
128
|
-
const attributeIds = prodct?.attributeValueIds?.join(".") ?? [];
|
|
129
|
-
return `${prodct?.id}${attributeIds.length > 0 ? "-" : ""}${attributeIds}`;
|
|
130
|
-
};
|
|
131
|
-
|
|
132
|
-
export const getProductIdFromKey = (key?: string) => {
|
|
133
|
-
return key?.includes("-") ? key?.split?.("-")?.[0] : key;
|
|
134
|
-
};
|
|
135
|
-
|
|
136
|
-
//format date
|
|
137
|
-
|
|
138
|
-
export const getDate = (date: Date | string) => {
|
|
139
|
-
const value = new Date(date);
|
|
140
|
-
const day = value?.getDate().toString().padStart(2, "0");
|
|
141
|
-
const month = (value?.getMonth() + 1).toString().padStart(2, "0");
|
|
142
|
-
const year = value?.getFullYear();
|
|
143
|
-
|
|
144
|
-
return {
|
|
145
|
-
day,
|
|
146
|
-
month,
|
|
147
|
-
year,
|
|
148
|
-
};
|
|
149
|
-
};
|
|
150
|
-
|
|
151
|
-
export const hh_mm = (date: Date | string) => {
|
|
152
|
-
const value = new Date(date);
|
|
153
|
-
const hours = value?.getHours().toString().padStart(2, "0");
|
|
154
|
-
const minutes = value?.getMinutes().toString().padStart(2, "0");
|
|
155
|
-
|
|
156
|
-
return `${hours}:${minutes}`;
|
|
157
|
-
};
|
|
158
|
-
|
|
159
|
-
export const dd_mm_yyyy = (date: Date | string) => {
|
|
160
|
-
const value = new Date(date);
|
|
161
|
-
const day = value?.getDate().toString().padStart(2, "0");
|
|
162
|
-
const month = (value?.getMonth() + 1).toString().padStart(2, "0");
|
|
163
|
-
const year = value?.getFullYear();
|
|
164
|
-
|
|
165
|
-
return `${day}/${month}/${year}`;
|
|
166
|
-
};
|
|
167
|
-
|
|
168
|
-
export const hh_mm_dd_mm_yyyy = (date: Date | string) => {
|
|
169
|
-
return `${hh_mm(date)} ${dd_mm_yyyy(date)}`;
|
|
170
|
-
};
|
|
171
|
-
|
|
172
|
-
export function add7Hours(str: string | Date) {
|
|
173
|
-
const d = new Date(str);
|
|
174
|
-
return new Date(d.getTime() + 7 * 3600 * 1000);
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
// format currency
|
|
178
|
-
export const unFormatCurrency = (value: string) => {
|
|
179
|
-
return value.replace(/\,/g, "");
|
|
180
|
-
};
|
|
181
|
-
|
|
182
|
-
export function ceilDecimal(value: number, decimals: number = 0): number {
|
|
183
|
-
const factor = Math.pow(10, decimals);
|
|
184
|
-
return Math.ceil(value * factor) / factor;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
export function ceilToThousands(value: number): number {
|
|
188
|
-
return Math.ceil(value / 1000) * 1000;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
export const formatVND = (amount: number) => {
|
|
192
|
-
return Math.ceil(amount).toLocaleString("en-US");
|
|
193
|
-
};
|
|
194
|
-
|
|
195
|
-
export const formatOrderPrice = (price: number) =>
|
|
196
|
-
price.toLocaleString("vi-VN", { maximumFractionDigits: 0 });
|
|
197
|
-
|
|
198
|
-
export const randomNumber = () => {
|
|
199
|
-
return (Date.now() + Math.floor(Math.random() * 1000)).toString();
|
|
200
|
-
};
|
|
201
|
-
|
|
202
|
-
export const onFindTable = ({
|
|
203
|
-
order,
|
|
204
|
-
tables,
|
|
205
|
-
floors,
|
|
206
|
-
}: {
|
|
207
|
-
order: any;
|
|
208
|
-
tables: any;
|
|
209
|
-
floors: any;
|
|
210
|
-
}) => {
|
|
211
|
-
if (!tables || !floors || !tables.length || !floors.length)
|
|
212
|
-
return "Chưa xác định";
|
|
213
|
-
|
|
214
|
-
const tableMatched = tables?.find(
|
|
215
|
-
(table: any) => table.id === order?.table_id
|
|
216
|
-
);
|
|
217
|
-
const floorMatched = floors?.find(
|
|
218
|
-
(floor: any) => floor.id === tableMatched?.floor_id
|
|
219
|
-
);
|
|
220
|
-
|
|
221
|
-
const floor = floorMatched?.name;
|
|
222
|
-
const table = tableMatched?.table_number;
|
|
223
|
-
|
|
224
|
-
if ((order?.table_id && !tableMatched) || (!order?.table_id && floorMatched))
|
|
225
|
-
return "Chưa xác định";
|
|
226
|
-
|
|
227
|
-
const label = floor || table ? `${floor} - Bàn ${table}` : "Mang đi";
|
|
228
|
-
|
|
229
|
-
return label;
|
|
230
|
-
};
|
|
231
|
-
|
|
232
|
-
type ApiOrder = {
|
|
233
|
-
id: number;
|
|
234
|
-
pos_reference: string;
|
|
235
|
-
amount_total: number;
|
|
236
|
-
date_order: string | Date;
|
|
237
|
-
state: string;
|
|
238
|
-
table_id: string | number | boolean;
|
|
239
|
-
lines: number[];
|
|
240
|
-
};
|
|
241
|
-
|
|
242
|
-
export const imageToHex = (
|
|
243
|
-
imageUrl: string
|
|
244
|
-
): Promise<{ width: number; height: number; hexString: string }> => {
|
|
245
|
-
return new Promise((resolve, reject) => {
|
|
246
|
-
const img = new Image();
|
|
247
|
-
img.crossOrigin = "anonymous";
|
|
248
|
-
img.src = imageUrl;
|
|
249
|
-
|
|
250
|
-
img.onload = () => {
|
|
251
|
-
const width = img.width;
|
|
252
|
-
const height = img.height;
|
|
253
|
-
const canvas = document.createElement("canvas");
|
|
254
|
-
canvas.width = width;
|
|
255
|
-
canvas.height = height;
|
|
256
|
-
const ctx = canvas.getContext("2d");
|
|
257
|
-
if (!ctx) return reject("Cannot get canvas context");
|
|
258
|
-
|
|
259
|
-
ctx.drawImage(img, 0, 0, width, height);
|
|
260
|
-
const imageData = ctx.getImageData(0, 0, width, height);
|
|
261
|
-
const pixels = imageData.data;
|
|
262
|
-
|
|
263
|
-
let hexString = "";
|
|
264
|
-
|
|
265
|
-
for (let y = 0; y < height; y++) {
|
|
266
|
-
let byte = 0;
|
|
267
|
-
let bitCount = 0;
|
|
268
|
-
|
|
269
|
-
for (let x = 0; x < width; x++) {
|
|
270
|
-
const idx = (y * width + x) * 4;
|
|
271
|
-
const r = pixels[idx];
|
|
272
|
-
const g = pixels[idx + 1];
|
|
273
|
-
const b = pixels[idx + 2];
|
|
274
|
-
|
|
275
|
-
const gray = 0.299 * r + 0.587 * g + 0.114 * b;
|
|
276
|
-
const bw = gray < 128 ? 1 : 0;
|
|
277
|
-
|
|
278
|
-
byte = (byte << 1) | bw;
|
|
279
|
-
bitCount++;
|
|
280
|
-
|
|
281
|
-
if (bitCount === 8) {
|
|
282
|
-
hexString += byte.toString(16).padStart(2, "0");
|
|
283
|
-
byte = 0;
|
|
284
|
-
bitCount = 0;
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
if (bitCount > 0) {
|
|
289
|
-
byte = byte << (8 - bitCount);
|
|
290
|
-
hexString += byte.toString(16).padStart(2, "0");
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
resolve({ width, height, hexString });
|
|
295
|
-
};
|
|
296
|
-
|
|
297
|
-
img.onerror = reject;
|
|
298
|
-
});
|
|
299
|
-
};
|
package/src/utils/i18n.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import i18n from "i18next";
|
|
2
|
-
import LanguageDetector from "i18next-browser-languagedetector";
|
|
3
|
-
import { initReactI18next } from "react-i18next";
|
|
4
|
-
import vi from "../locales/vi.json";
|
|
5
|
-
import en from "../locales/en.json";
|
|
6
|
-
i18n
|
|
7
|
-
.use(LanguageDetector)
|
|
8
|
-
.use(initReactI18next)
|
|
9
|
-
.init({
|
|
10
|
-
resources: {
|
|
11
|
-
vi: { translation: vi },
|
|
12
|
-
en: { translation: en },
|
|
13
|
-
},
|
|
14
|
-
fallbackLng: "vi",
|
|
15
|
-
debug: false,
|
|
16
|
-
nonExplicitSupportedLngs: true,
|
|
17
|
-
interpolation: {
|
|
18
|
-
escapeValue: false,
|
|
19
|
-
},
|
|
20
|
-
detection: {
|
|
21
|
-
caches: ["cookie"],
|
|
22
|
-
},
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
export default i18n;
|