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/utils/pos/bill.ts
DELETED
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
import { OrderDetailItemType } from "@type/order";
|
|
2
|
-
import { dd_mm_yyyy, formatCurrency, hh_mm } from "@utils/functions";
|
|
3
|
-
|
|
4
|
-
type TProps = {
|
|
5
|
-
items: OrderDetailItemType[];
|
|
6
|
-
data: any;
|
|
7
|
-
company: any;
|
|
8
|
-
userProfile: any;
|
|
9
|
-
addressFormat: string;
|
|
10
|
-
table: string;
|
|
11
|
-
paymentMethod: string;
|
|
12
|
-
amountTotalWithoutTax: number;
|
|
13
|
-
label: string;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
const W_IDX = 2;
|
|
17
|
-
const W_NAME = 18;
|
|
18
|
-
const W_QTY = 3;
|
|
19
|
-
const W_PRICE = 9;
|
|
20
|
-
const W_AMT = 12;
|
|
21
|
-
|
|
22
|
-
const padLeft = (s: string, w: number) => {
|
|
23
|
-
if (s.length >= w) return s.slice(-w);
|
|
24
|
-
return " ".repeat(w - s.length) + s;
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
const padRight = (s: string, w: number) => {
|
|
28
|
-
if (s.length >= w) return s.slice(0, w);
|
|
29
|
-
return s + " ".repeat(w - s.length);
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
const padCenter = (s: string, w: number) => {
|
|
33
|
-
if (s.length >= w) return s.slice(0, w);
|
|
34
|
-
|
|
35
|
-
const total = w - s.length;
|
|
36
|
-
const left = Math.floor(total / 2);
|
|
37
|
-
const right = Math.ceil(total / 2);
|
|
38
|
-
|
|
39
|
-
return " ".repeat(left) + s + " ".repeat(right);
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
const wrap = (text: string, w: number): string[] => {
|
|
43
|
-
if (w <= 0) return [""];
|
|
44
|
-
const words = text.split(/\s+/);
|
|
45
|
-
const lines: string[] = [];
|
|
46
|
-
let line = "";
|
|
47
|
-
for (const wrd of words) {
|
|
48
|
-
if (line.length === 0) {
|
|
49
|
-
line = wrd.slice(0, w);
|
|
50
|
-
} else if (line.length + 1 + wrd.length <= w) {
|
|
51
|
-
line += ` ${wrd}`;
|
|
52
|
-
} else {
|
|
53
|
-
lines.push(padRight(line, w));
|
|
54
|
-
line = wrd.slice(0, w);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
if (line.length > 0) lines.push(padRight(line, w));
|
|
58
|
-
return lines.length === 0 ? [padRight("", w)] : lines;
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
const itemRows = (index: number, item: any): string => {
|
|
62
|
-
const itemTotal = item.price * item.quantity;
|
|
63
|
-
const itemName = item.name;
|
|
64
|
-
const nameLines = wrap(itemName, W_NAME);
|
|
65
|
-
|
|
66
|
-
let first =
|
|
67
|
-
"[L]" +
|
|
68
|
-
padLeft(index.toString(), W_IDX) +
|
|
69
|
-
" " +
|
|
70
|
-
nameLines[0] +
|
|
71
|
-
" " +
|
|
72
|
-
padLeft(item.quantity.toString(), W_QTY) +
|
|
73
|
-
" " +
|
|
74
|
-
padLeft(formatCurrency(item.unitPrice), W_PRICE) +
|
|
75
|
-
" " +
|
|
76
|
-
padLeft(formatCurrency(itemTotal), W_AMT);
|
|
77
|
-
|
|
78
|
-
if (nameLines.length === 1) return first;
|
|
79
|
-
|
|
80
|
-
const cont = nameLines
|
|
81
|
-
.slice(1)
|
|
82
|
-
.map((ln) => {
|
|
83
|
-
return "[L]" + " ".repeat(W_IDX + 1) + ln;
|
|
84
|
-
})
|
|
85
|
-
.join("\n");
|
|
86
|
-
return first + "\n" + cont;
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
const headerRow = () => {
|
|
90
|
-
const row =
|
|
91
|
-
padLeft("TT", W_IDX) +
|
|
92
|
-
" " +
|
|
93
|
-
padCenter("Ten mon", W_NAME) +
|
|
94
|
-
" " +
|
|
95
|
-
padLeft("SL", W_QTY) +
|
|
96
|
-
" " +
|
|
97
|
-
padLeft("Don gia", W_PRICE) +
|
|
98
|
-
" " +
|
|
99
|
-
padLeft("Thanh tien", W_AMT);
|
|
100
|
-
return `[L]<b>${row}</b>`;
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
export const generateBill = ({
|
|
104
|
-
items,
|
|
105
|
-
data,
|
|
106
|
-
company,
|
|
107
|
-
userProfile,
|
|
108
|
-
addressFormat,
|
|
109
|
-
table,
|
|
110
|
-
paymentMethod,
|
|
111
|
-
amountTotalWithoutTax,
|
|
112
|
-
label,
|
|
113
|
-
}: TProps) => {
|
|
114
|
-
const tableBlock =
|
|
115
|
-
items
|
|
116
|
-
?.map((item, index) => {
|
|
117
|
-
return itemRows(index + 1, item);
|
|
118
|
-
})
|
|
119
|
-
.join("\n[C]\n") || "";
|
|
120
|
-
|
|
121
|
-
const textBill = `[C]{LOGO}
|
|
122
|
-
[C]
|
|
123
|
-
[L]<font size='small'>${addressFormat}</font>
|
|
124
|
-
|
|
125
|
-
[C]<font size='wide'><b>${label}</b></font>
|
|
126
|
-
[C]
|
|
127
|
-
[C]<b>${table}</b> | Thoi gian: <b>${hh_mm(data?.date_order)} - ${dd_mm_yyyy(
|
|
128
|
-
data?.date_order
|
|
129
|
-
)}</b></font>
|
|
130
|
-
[C]
|
|
131
|
-
[C]------------------------------------------------
|
|
132
|
-
[C]
|
|
133
|
-
[L]So hoa don:[R]<b>${data?.pos_reference}</b>
|
|
134
|
-
[L]Phuong thuc thanh toan:[R]<b>${paymentMethod || "Chua xac dinh"}</b>
|
|
135
|
-
[C]
|
|
136
|
-
[C]------------------------------------------------
|
|
137
|
-
${headerRow()}
|
|
138
|
-
[C]------------------------------------------------
|
|
139
|
-
${tableBlock}
|
|
140
|
-
|
|
141
|
-
[C]Thue (VAT): [R]${formatCurrency(data?.amount_tax)}d
|
|
142
|
-
[C]Thanh tien: [R]${formatCurrency(amountTotalWithoutTax)}d
|
|
143
|
-
[C]------------------------------------------------
|
|
144
|
-
[L]<font size='wide,tall'><b>Tong tien:</b></font>[R]<font size='wide,tall'><b>${formatCurrency(
|
|
145
|
-
data?.amount_total
|
|
146
|
-
)}d</b></font>
|
|
147
|
-
[C]
|
|
148
|
-
[C]<font size='small'>${
|
|
149
|
-
userProfile?.company?.invoice_name
|
|
150
|
-
} xin chan thanh cam on!
|
|
151
|
-
[C]Powered by ${company?.companyInfo?.data?.[0]?.display_name}</font>
|
|
152
|
-
[C]
|
|
153
|
-
[C]
|
|
154
|
-
[C]`;
|
|
155
|
-
return textBill.trimStart();
|
|
156
|
-
};
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { ORDER_STATE } from "@constants/order-state";
|
|
2
|
-
import { OrderStatus, TBasicOrder } from "@type/order";
|
|
3
|
-
import { TOrder } from "@type/sale";
|
|
4
|
-
|
|
5
|
-
type ApiOrder = {
|
|
6
|
-
id: number;
|
|
7
|
-
pos_reference: string;
|
|
8
|
-
amount_total: number;
|
|
9
|
-
date_order: string | Date;
|
|
10
|
-
state: string;
|
|
11
|
-
table_id: string | number | boolean;
|
|
12
|
-
[key: string]: any;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
function formatOrderStatus(status: string): OrderStatus {
|
|
16
|
-
switch (status) {
|
|
17
|
-
case "draft":
|
|
18
|
-
return ORDER_STATE.NEW;
|
|
19
|
-
default:
|
|
20
|
-
return status as OrderStatus;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export function convertOrders(records: ApiOrder[]) {
|
|
25
|
-
return records.map((order) => {
|
|
26
|
-
const date = add7Hours(order.date_order);
|
|
27
|
-
return {
|
|
28
|
-
id: order.id,
|
|
29
|
-
table_id: order.table_id,
|
|
30
|
-
state: formatOrderStatus(order.state),
|
|
31
|
-
lines: order.lines,
|
|
32
|
-
create_date: date,
|
|
33
|
-
pos_reference: order.pos_reference,
|
|
34
|
-
amount_total: order.amount_total,
|
|
35
|
-
amount_tax: 0,
|
|
36
|
-
user_id: order.user_id,
|
|
37
|
-
partner_id: order.partner_id,
|
|
38
|
-
} as TBasicOrder;
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export function convertOrderDetail(apiOrder?: TOrder): TOrder | undefined {
|
|
43
|
-
if (!apiOrder) {
|
|
44
|
-
return undefined;
|
|
45
|
-
}
|
|
46
|
-
const date_order = add7Hours(apiOrder.date_order);
|
|
47
|
-
|
|
48
|
-
return {
|
|
49
|
-
...apiOrder,
|
|
50
|
-
table_id: apiOrder.table_id ? apiOrder.table_id.toString() : false,
|
|
51
|
-
date_order,
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
function add7Hours(str: string | Date) {
|
|
56
|
-
const d = new Date(str);
|
|
57
|
-
return new Date(d.getTime() + 7 * 3600 * 1000);
|
|
58
|
-
}
|
package/src/utils/pos/helpers.ts
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { TEMPLATE_NAME } from "@constants/template-name.constant";
|
|
2
|
-
import { JSX } from "react";
|
|
3
|
-
|
|
4
|
-
export const getGridColsClass = (templateName: string | undefined) => {
|
|
5
|
-
switch (templateName) {
|
|
6
|
-
case TEMPLATE_NAME.PRODUCT_TEMPLATE:
|
|
7
|
-
return "grid-cols-[repeat(auto-fill,minmax(202px,1fr))]";
|
|
8
|
-
case TEMPLATE_NAME.PREPARATION_TEMPLATE:
|
|
9
|
-
return "grid-cols-[repeat(auto-fill,minmax(324px,1fr))]";
|
|
10
|
-
case TEMPLATE_NAME.CUSTOMER_PROFILE_TEMPLATE:
|
|
11
|
-
return "grid-cols-[repeat(auto-fill,minmax(350px,1fr))]";
|
|
12
|
-
default:
|
|
13
|
-
return "grid-cols-[repeat(auto-fill,minmax(397px,1fr))]";
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
type CurrencyOptions = {
|
|
18
|
-
value?: number | string;
|
|
19
|
-
currency?: string;
|
|
20
|
-
render?: (value: string, currency: string) => JSX.Element;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
function formatCurrency(value?: number | string, currency?: string): string;
|
|
24
|
-
function formatCurrency(props: CurrencyOptions): JSX.Element;
|
|
25
|
-
function formatCurrency(
|
|
26
|
-
arg1?: number | string | CurrencyOptions,
|
|
27
|
-
arg2?: string
|
|
28
|
-
): string | JSX.Element {
|
|
29
|
-
let value = 0;
|
|
30
|
-
let currency = "đ";
|
|
31
|
-
let render = undefined;
|
|
32
|
-
if (typeof arg1 === "object") {
|
|
33
|
-
if (arg1.value) value = Number(arg1.value);
|
|
34
|
-
if (arg1.currency) currency = arg1.currency;
|
|
35
|
-
render = arg1.render;
|
|
36
|
-
} else {
|
|
37
|
-
if (arg1) value = Number(arg1);
|
|
38
|
-
if (arg2) currency = arg2;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
const format = new Intl.NumberFormat("en-US");
|
|
42
|
-
const valueString = format.format(Math.ceil(Number(value)));
|
|
43
|
-
if (render) return render(valueString, currency);
|
|
44
|
-
if (!value || Number(value) <= 0) return "0 " + currency;
|
|
45
|
-
return valueString + " " + currency;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export { formatCurrency };
|
package/src/utils/pos/session.ts
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { QrCodeLine } from "@assets/icons/order-icon";
|
|
2
|
-
import { IcBankCard, IcCashLine } from "@assets/icons/payment-icon";
|
|
3
|
-
|
|
4
|
-
export const generateCloseSessionData = (
|
|
5
|
-
data: TSessionData | undefined,
|
|
6
|
-
cashCount: number
|
|
7
|
-
): TCloseSessionItemProps[] => {
|
|
8
|
-
if (!data) return [];
|
|
9
|
-
|
|
10
|
-
const cashOpening = data.default_cash_details.opening || 0;
|
|
11
|
-
const cashAmount = data.default_cash_details.amount || 0;
|
|
12
|
-
const cashDifference = Number(cashCount) - cashOpening - cashAmount;
|
|
13
|
-
|
|
14
|
-
const getNonCashPayment = () => {
|
|
15
|
-
return data.non_cash_payment_methods.map((method) => {
|
|
16
|
-
return {
|
|
17
|
-
id: method.id,
|
|
18
|
-
title: method.name,
|
|
19
|
-
price: method.amount,
|
|
20
|
-
subItems: [
|
|
21
|
-
{ title: "record", price: method.amount },
|
|
22
|
-
{ title: "difference", price: 0 },
|
|
23
|
-
],
|
|
24
|
-
icon: method.type === "bank" ? IcBankCard : QrCodeLine,
|
|
25
|
-
};
|
|
26
|
-
});
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
return [
|
|
30
|
-
{
|
|
31
|
-
id: 1,
|
|
32
|
-
title: data.default_cash_details.name,
|
|
33
|
-
price: data.default_cash_details.amount || 0,
|
|
34
|
-
subItems: [
|
|
35
|
-
{ title: "open_session", price: cashOpening },
|
|
36
|
-
{ title: "cash_in_out", price: 0 },
|
|
37
|
-
{ title: "counted", price: cashCount || 0 },
|
|
38
|
-
{ title: "difference", price: cashDifference },
|
|
39
|
-
],
|
|
40
|
-
icon: IcCashLine,
|
|
41
|
-
},
|
|
42
|
-
...getNonCashPayment(),
|
|
43
|
-
];
|
|
44
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./local-storage";
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
export interface Context {
|
|
2
|
-
uid: number;
|
|
3
|
-
lang: string;
|
|
4
|
-
allowCompanys: number[];
|
|
5
|
-
[key: string]: string | number | number[] | undefined;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export const localStorageUtils = (() => {
|
|
9
|
-
const setToken = (access_token: string) => {
|
|
10
|
-
localStorage.setItem("accessToken", access_token);
|
|
11
|
-
};
|
|
12
|
-
const setRefreshToken = (refresh_token: string) => {
|
|
13
|
-
localStorage.setItem("refreshToken", refresh_token);
|
|
14
|
-
};
|
|
15
|
-
const setContext = (context: Context) => {
|
|
16
|
-
localStorage.setItem("rootContext", JSON.stringify(context));
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
const getAccessToken = (): string | null => {
|
|
20
|
-
return localStorage.getItem("accessToken");
|
|
21
|
-
};
|
|
22
|
-
const getRefreshToken = (): string | null => {
|
|
23
|
-
return localStorage.getItem("refreshToken");
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
const getContext = (): Context | null => {
|
|
27
|
-
const context = localStorage.getItem("context");
|
|
28
|
-
return context ? JSON.parse(context) : null;
|
|
29
|
-
};
|
|
30
|
-
const setNavbarStyle = (style: string) => {
|
|
31
|
-
localStorage.setItem("navbarStyle", style);
|
|
32
|
-
};
|
|
33
|
-
const getNavbarStyle = (): string | null => {
|
|
34
|
-
return localStorage.getItem("navbarStyle");
|
|
35
|
-
};
|
|
36
|
-
const setLayoutDisplay = (layoutDisplay: "left" | "right") => {
|
|
37
|
-
localStorage.setItem("layoutDisplay", layoutDisplay);
|
|
38
|
-
};
|
|
39
|
-
const getLayoutDisplay = (): "left" | "right" => {
|
|
40
|
-
return localStorage.getItem("layoutDisplay") as "left" | "right";
|
|
41
|
-
};
|
|
42
|
-
const clearToken = () => {
|
|
43
|
-
localStorage.removeItem("accessToken");
|
|
44
|
-
localStorage.removeItem("refreshToken");
|
|
45
|
-
};
|
|
46
|
-
const setBackUrl = (backUrl: string) => {
|
|
47
|
-
localStorage.setItem("backUrl", backUrl);
|
|
48
|
-
};
|
|
49
|
-
const getBackUrl = (): string | null => {
|
|
50
|
-
return localStorage.getItem("backUrl");
|
|
51
|
-
};
|
|
52
|
-
const removeBackUrl = () => {
|
|
53
|
-
localStorage.removeItem("backUrl");
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
return {
|
|
57
|
-
setToken,
|
|
58
|
-
setRefreshToken,
|
|
59
|
-
setContext,
|
|
60
|
-
getAccessToken,
|
|
61
|
-
getRefreshToken,
|
|
62
|
-
getContext,
|
|
63
|
-
clearToken,
|
|
64
|
-
setNavbarStyle,
|
|
65
|
-
getNavbarStyle,
|
|
66
|
-
setLayoutDisplay,
|
|
67
|
-
getLayoutDisplay,
|
|
68
|
-
setBackUrl,
|
|
69
|
-
getBackUrl,
|
|
70
|
-
removeBackUrl,
|
|
71
|
-
};
|
|
72
|
-
})();
|
package/tailwind.preset.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
theme: {
|
|
3
|
-
extend: {
|
|
4
|
-
colors: {
|
|
5
|
-
primary: "var(--color-primary)",
|
|
6
|
-
secondary: "var(--color-secondary)",
|
|
7
|
-
text: {
|
|
8
|
-
primary: "#060606",
|
|
9
|
-
disable: "#666",
|
|
10
|
-
btn: "var(--text-button)",
|
|
11
|
-
active: "var(--text-active-primary)",
|
|
12
|
-
secondary: "var(--text-active-secondary)",
|
|
13
|
-
},
|
|
14
|
-
table: {
|
|
15
|
-
unavailable: "var(--text-unavailable-table-color)",
|
|
16
|
-
takeaway: "var(--text-take-away-color)",
|
|
17
|
-
},
|
|
18
|
-
surface: {
|
|
19
|
-
default: "#FAFAFA",
|
|
20
|
-
primary: "var(--text-surface-primary)",
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
};
|
package/tsconfig.json
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "es2020",
|
|
4
|
-
"outDir": "dist",
|
|
5
|
-
"sourceMap": true,
|
|
6
|
-
"jsx": "react-jsx",
|
|
7
|
-
"moduleResolution": "bundler",
|
|
8
|
-
"module": "ESNext",
|
|
9
|
-
"declaration": true,
|
|
10
|
-
"declarationMap": true,
|
|
11
|
-
"baseUrl": ".",
|
|
12
|
-
"paths": {
|
|
13
|
-
"@assets/*": ["./src/assets/*"],
|
|
14
|
-
"@pages/*": ["./src/pages/*"],
|
|
15
|
-
"@utils/*": ["./src/utils/*"],
|
|
16
|
-
"@styles/*": ["./src/styles/*"],
|
|
17
|
-
"@components/*": ["./src/components/*"],
|
|
18
|
-
"@icons/*": ["./src/icons/*"],
|
|
19
|
-
"@layouts/*": ["./src/layouts/*"],
|
|
20
|
-
"@layouts": ["./src/layouts"],
|
|
21
|
-
"@router/*": ["./src/router/*"],
|
|
22
|
-
"@constants/*": ["./src/constants/*"],
|
|
23
|
-
"@type/*": ["./src/types/*"],
|
|
24
|
-
"@hooks/*": ["./src/hooks/*"],
|
|
25
|
-
"@store/*": ["./src/store/*"],
|
|
26
|
-
"@provider/*": ["./src/provider/*"]
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
"include": ["src"]
|
|
30
|
-
}
|
package/tsup.config.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { defineConfig } from "tsup";
|
|
2
|
-
|
|
3
|
-
export default defineConfig({
|
|
4
|
-
// target: "es2020",
|
|
5
|
-
entry: {
|
|
6
|
-
index: "src/index.ts",
|
|
7
|
-
"tailwind.preset": "tailwind.preset.ts",
|
|
8
|
-
},
|
|
9
|
-
format: ["esm"],
|
|
10
|
-
// platform: "neutral",
|
|
11
|
-
dts: true, // Generate TypeScript declaration files
|
|
12
|
-
// splitting: false,
|
|
13
|
-
// clean: true,
|
|
14
|
-
// sourcemap: true,
|
|
15
|
-
// minify: true,
|
|
16
|
-
external: [
|
|
17
|
-
"react",
|
|
18
|
-
"react-dom",
|
|
19
|
-
"react-router-dom",
|
|
20
|
-
// "@fctc/sme-widget-ui",
|
|
21
|
-
// "@fctc/widget-logic",
|
|
22
|
-
// "lottie-react",
|
|
23
|
-
// "readable-stream", // 🔥 QUAN TRỌNG
|
|
24
|
-
// "stream",
|
|
25
|
-
// "mqtt",
|
|
26
|
-
],
|
|
27
|
-
// define: {
|
|
28
|
-
// "process.env.NODE_ENV": '"production"',
|
|
29
|
-
// },
|
|
30
|
-
});
|