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,118 +0,0 @@
|
|
|
1
|
-
import { Skeleton } from "@components/common/skeleton";
|
|
2
|
-
import useCheckSession from "@components/common/use-check-session";
|
|
3
|
-
import { ORDER_STATE } from "@constants/order-state";
|
|
4
|
-
import { useEnv } from "@fctc/widget-logic/provider";
|
|
5
|
-
import useGetQuery from "@hooks/common/use-get-query";
|
|
6
|
-
import { useQueryParams } from "@hooks/common/use-query-params";
|
|
7
|
-
import { useOrder } from "@provider/pos-provider/order-provider";
|
|
8
|
-
import { usePayment } from "@provider/pos-provider/payment-provider";
|
|
9
|
-
import { useSale } from "@provider/pos-provider/sale-provider";
|
|
10
|
-
import { useEffect, useState } from "react";
|
|
11
|
-
import { toast } from "react-toastify";
|
|
12
|
-
import { PaymentInfo } from "../payment-info";
|
|
13
|
-
import { PaymentLayout } from "../payment-layout";
|
|
14
|
-
import SessionCloseModal from "../session-close-modal";
|
|
15
|
-
import QRCode from "./qr_code";
|
|
16
|
-
|
|
17
|
-
type Props = {
|
|
18
|
-
total: number;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export const QRPayment = ({ total }: Props) => {
|
|
22
|
-
const { onGeneratePaymentQrInfo } = usePayment();
|
|
23
|
-
const [qrCode, setQrCode] = useState("");
|
|
24
|
-
const { env } = useEnv();
|
|
25
|
-
const { orderId, sessionId } = useGetQuery();
|
|
26
|
-
const { updateQuery } = useQueryParams();
|
|
27
|
-
const { orderDetailById } = useOrder();
|
|
28
|
-
|
|
29
|
-
const handleGetQrPaymentInfo = async () => {
|
|
30
|
-
try {
|
|
31
|
-
if (!sessionId) return;
|
|
32
|
-
if (!orderId) return;
|
|
33
|
-
const data = await onGeneratePaymentQrInfo(total, sessionId, orderId);
|
|
34
|
-
if (!data) return;
|
|
35
|
-
|
|
36
|
-
const qrCode = QRCode(
|
|
37
|
-
data.amount.toString(),
|
|
38
|
-
data.narrative,
|
|
39
|
-
data.account_no,
|
|
40
|
-
data.bin_code
|
|
41
|
-
);
|
|
42
|
-
setQrCode(qrCode.imgTag);
|
|
43
|
-
} catch (error: any) {
|
|
44
|
-
toast.error(error?.message || "");
|
|
45
|
-
console.log("error", error);
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
const [showCloseSessionModal, setShowCloseSessionModal] = useState(false);
|
|
50
|
-
const { onCheckSession } = useCheckSession();
|
|
51
|
-
const { queryResult } = useSale();
|
|
52
|
-
|
|
53
|
-
const handleCheckPayment = async () => {
|
|
54
|
-
const isSessionOpened = await onCheckSession();
|
|
55
|
-
|
|
56
|
-
if (!isSessionOpened) {
|
|
57
|
-
setShowCloseSessionModal(true);
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
useEffect(() => {
|
|
63
|
-
try {
|
|
64
|
-
handleGetQrPaymentInfo();
|
|
65
|
-
} catch (error) {
|
|
66
|
-
console.log("error", error);
|
|
67
|
-
}
|
|
68
|
-
handleCheckPayment();
|
|
69
|
-
const interval = setInterval(() => {
|
|
70
|
-
if (
|
|
71
|
-
orderDetailById?.state === ORDER_STATE.IN_PAID ||
|
|
72
|
-
orderDetailById?.state === ORDER_STATE.NEW
|
|
73
|
-
) {
|
|
74
|
-
queryResult.refetch();
|
|
75
|
-
}
|
|
76
|
-
}, 3000);
|
|
77
|
-
|
|
78
|
-
return () => {
|
|
79
|
-
clearInterval(interval);
|
|
80
|
-
};
|
|
81
|
-
}, []);
|
|
82
|
-
|
|
83
|
-
return (
|
|
84
|
-
<div className="h-full flex items-center justify-center w-full">
|
|
85
|
-
<QRContent qrData={qrCode} />
|
|
86
|
-
{showCloseSessionModal && (
|
|
87
|
-
<SessionCloseModal isOpen={showCloseSessionModal} onClose={() => {}} />
|
|
88
|
-
)}
|
|
89
|
-
</div>
|
|
90
|
-
);
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
export const QRContent = ({ qrData }: { qrData: string }) => {
|
|
94
|
-
return (
|
|
95
|
-
<PaymentLayout
|
|
96
|
-
leftContent={<QrPaymentCode qrData={qrData} />}
|
|
97
|
-
rightContent={<PaymentInfo />}
|
|
98
|
-
/>
|
|
99
|
-
);
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
export const QrPaymentCode = ({ qrData }: { qrData: string }) => {
|
|
103
|
-
return (
|
|
104
|
-
<div className="flex flex-col items-center gap-4 size-[250px]">
|
|
105
|
-
<div className="flex-1 flex flex-col gap-2 items-center justify-center w-[235px]">
|
|
106
|
-
{qrData ? (
|
|
107
|
-
<div
|
|
108
|
-
className="w-full h-full [&>img]:w-full [&>img]:h-full [&>img]:object-contain"
|
|
109
|
-
dangerouslySetInnerHTML={{ __html: qrData }}
|
|
110
|
-
/>
|
|
111
|
-
) : (
|
|
112
|
-
<Skeleton className="size-[260px] rounded-lg" />
|
|
113
|
-
)}
|
|
114
|
-
<img src="/assets/images/bank-logos.png" className="w-full" />
|
|
115
|
-
</div>
|
|
116
|
-
</div>
|
|
117
|
-
);
|
|
118
|
-
};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import QRCODE from "@unicube/vietqr/qrcode.js";
|
|
2
|
-
|
|
3
|
-
import { CURRENCY, SERVICE_CODE, VIETQR } from "./vietqr.js";
|
|
4
|
-
|
|
5
|
-
const QRCode = (amount, description, accountNumber, bankCode) => {
|
|
6
|
-
let vietQRdata = new VIETQR();
|
|
7
|
-
|
|
8
|
-
vietQRdata.fields.is_dynamic_qr = true;
|
|
9
|
-
vietQRdata.fields.merchant_category = "9999";
|
|
10
|
-
vietQRdata.fields.amount = amount;
|
|
11
|
-
vietQRdata.fields.acq = bankCode;
|
|
12
|
-
vietQRdata.fields.merchant_id = accountNumber;
|
|
13
|
-
vietQRdata.fields.service_code = SERVICE_CODE.TO_ACCOUNT;
|
|
14
|
-
vietQRdata.fields.purpose_txn = description;
|
|
15
|
-
vietQRdata.fields.currency = CURRENCY.VND;
|
|
16
|
-
let vietQRData = vietQRdata.builder();
|
|
17
|
-
let qrcode = new QRCODE(0, "M");
|
|
18
|
-
|
|
19
|
-
qrcode.addData(vietQRData, "Byte");
|
|
20
|
-
|
|
21
|
-
qrcode.make();
|
|
22
|
-
|
|
23
|
-
return {
|
|
24
|
-
imgTag: qrcode.createImgTag(),
|
|
25
|
-
qrData: vietQRData,
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
export default QRCode;
|
|
@@ -1,436 +0,0 @@
|
|
|
1
|
-
const SERVICE_CODE = {
|
|
2
|
-
PAYMENT: "QRPUSH",
|
|
3
|
-
TO_CARD: "QRIBFTTC",
|
|
4
|
-
TO_ACCOUNT: "QRIBFTTA",
|
|
5
|
-
};
|
|
6
|
-
const NAPAS_GUID = "A000000727";
|
|
7
|
-
const CURRENCY = {
|
|
8
|
-
VND: "704",
|
|
9
|
-
USD: "840",
|
|
10
|
-
};
|
|
11
|
-
var FIELDS = {
|
|
12
|
-
is_dynamic_qr: true,
|
|
13
|
-
merchant_category: "",
|
|
14
|
-
merchant_name: "",
|
|
15
|
-
merchant_city: "",
|
|
16
|
-
postal_code: "",
|
|
17
|
-
currency: "704",
|
|
18
|
-
country_code: "VN",
|
|
19
|
-
amount: "0",
|
|
20
|
-
acq: "970403",
|
|
21
|
-
merchant_id: "",
|
|
22
|
-
service_code: SERVICE_CODE.TO_ACCOUNT,
|
|
23
|
-
bill_number: "",
|
|
24
|
-
mobile_number: "",
|
|
25
|
-
store_label: "",
|
|
26
|
-
loyalty_number: "",
|
|
27
|
-
ref_label: "",
|
|
28
|
-
customer_label: "",
|
|
29
|
-
terminal_label: "",
|
|
30
|
-
purpose_txn: "",
|
|
31
|
-
additional_data: "",
|
|
32
|
-
lang_ref: "",
|
|
33
|
-
local_merchant_name: "",
|
|
34
|
-
local_merchant_city: "",
|
|
35
|
-
uuid: "",
|
|
36
|
-
ipn_url: "",
|
|
37
|
-
app_package_name: "",
|
|
38
|
-
custom_data: "",
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
function pad_left(n, width, z) {
|
|
42
|
-
z = z || "0";
|
|
43
|
-
n = n + "";
|
|
44
|
-
return n.length >= width ? n : new Array(width - n.length + 1).join(z) + n;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
const CRC = {
|
|
48
|
-
stringToUtf8ByteArray(str) {
|
|
49
|
-
var out = [],
|
|
50
|
-
p = 0;
|
|
51
|
-
for (var i = 0; i < str.length; i++) {
|
|
52
|
-
var c = str.charCodeAt(i);
|
|
53
|
-
if (c < 128) {
|
|
54
|
-
out[p++] = c;
|
|
55
|
-
} else if (c < 2048) {
|
|
56
|
-
out[p++] = (c >> 6) | 192;
|
|
57
|
-
out[p++] = (c & 63) | 128;
|
|
58
|
-
} else if (
|
|
59
|
-
(c & 0xfc00) == 0xd800 &&
|
|
60
|
-
i + 1 < str.length &&
|
|
61
|
-
(str.charCodeAt(i + 1) & 0xfc00) == 0xdc00
|
|
62
|
-
) {
|
|
63
|
-
// Surrogate Pair
|
|
64
|
-
c = 0x10000 + ((c & 0x03ff) << 10) + (str.charCodeAt(++i) & 0x03ff);
|
|
65
|
-
out[p++] = (c >> 18) | 240;
|
|
66
|
-
out[p++] = ((c >> 12) & 63) | 128;
|
|
67
|
-
out[p++] = ((c >> 6) & 63) | 128;
|
|
68
|
-
out[p++] = (c & 63) | 128;
|
|
69
|
-
} else {
|
|
70
|
-
out[p++] = (c >> 12) | 224;
|
|
71
|
-
out[p++] = ((c >> 6) & 63) | 128;
|
|
72
|
-
out[p++] = (c & 63) | 128;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
return out;
|
|
76
|
-
},
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* Function này phải dùng stringToUtf8ByteArray để convert về Byte[]
|
|
80
|
-
* @param {*} str
|
|
81
|
-
* @param {*} offset
|
|
82
|
-
* @returns
|
|
83
|
-
*/
|
|
84
|
-
|
|
85
|
-
getCrc16(str, offset = 0) {
|
|
86
|
-
let data = this.stringToUtf8ByteArray(str);
|
|
87
|
-
if (
|
|
88
|
-
data == null ||
|
|
89
|
-
offset < 0 ||
|
|
90
|
-
offset > data.length - 1 ||
|
|
91
|
-
offset + length > data.length
|
|
92
|
-
) {
|
|
93
|
-
return 0;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
let crc = 0xffff;
|
|
97
|
-
for (let i = 0; i < str.length; ++i) {
|
|
98
|
-
crc ^= data[offset + i] << 8;
|
|
99
|
-
for (let j = 0; j < 8; ++j) {
|
|
100
|
-
crc = (crc & 0x8000) > 0 ? (crc << 1) ^ 0x1021 : crc << 1;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
return (crc & 0xffff).toString(16).toUpperCase();
|
|
104
|
-
},
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* Function này không dùng stringToUtf8ByteArray để convert về Byte[]
|
|
108
|
-
* @param {Chuỗi cần check CRC} text
|
|
109
|
-
* @param {true hoặc false, mặc định là true} hex_output
|
|
110
|
-
* @returns {Chuỗi CRC}
|
|
111
|
-
*/
|
|
112
|
-
|
|
113
|
-
getCrc16_array(text, hex_output = true) {
|
|
114
|
-
if (!Array.isArray(text)) text = [[text]];
|
|
115
|
-
const polynomial = 0x1021;
|
|
116
|
-
let result = text.map((row) =>
|
|
117
|
-
row.map((string) => {
|
|
118
|
-
if (!string.length) return null;
|
|
119
|
-
const bytes = Array.from(String(string)).map(
|
|
120
|
-
(char) => char.charCodeAt(0) & 0xff
|
|
121
|
-
); // gives 8 bits; higher bits get discarded
|
|
122
|
-
let crc = 0xffff;
|
|
123
|
-
bytes.forEach((byte) => {
|
|
124
|
-
for (let i = 0; i < 8; i++) {
|
|
125
|
-
let bit = 1 === ((byte >> (7 - i)) & 1);
|
|
126
|
-
let c15 = 1 === ((crc >> 15) & 1);
|
|
127
|
-
crc <<= 1;
|
|
128
|
-
if (c15 ^ bit) crc ^= polynomial;
|
|
129
|
-
}
|
|
130
|
-
});
|
|
131
|
-
crc &= 0xffff;
|
|
132
|
-
// Padding handling
|
|
133
|
-
let crcHexString = crc.toString(16).toUpperCase();
|
|
134
|
-
crcHexString =
|
|
135
|
-
crcHexString.length < 4 ? pad_left(crcHexString, 4) : crcHexString;
|
|
136
|
-
return hex_output ? crcHexString : crc;
|
|
137
|
-
})
|
|
138
|
-
);
|
|
139
|
-
return result.toString();
|
|
140
|
-
},
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
* This function is used for replace special character and Vietnamese Utf-8 character to ASCII character
|
|
144
|
-
* @param {*} str
|
|
145
|
-
* @returns
|
|
146
|
-
*/
|
|
147
|
-
nonAccentVietnamese(str) {
|
|
148
|
-
str = str.toLowerCase();
|
|
149
|
-
str = str.replace(new RegExp("/", "g"), "-");
|
|
150
|
-
str = str.replace(/à|á|ạ|ả|ã|â|ầ|ấ|ậ|ẩ|ẫ|ă|ằ|ắ|ặ|ẳ|ẵ/g, "a");
|
|
151
|
-
str = str.replace(/è|é|ẹ|ẻ|ẽ|ê|ề|ế|ệ|ể|ễ/g, "e");
|
|
152
|
-
str = str.replace(/ì|í|ị|ỉ|ĩ/g, "i");
|
|
153
|
-
str = str.replace(/ò|ó|ọ|ỏ|õ|ô|ồ|ố|ộ|ổ|ỗ|ơ|ờ|ớ|ợ|ở|ỡ/g, "o");
|
|
154
|
-
str = str.replace(/ù|ú|ụ|ủ|ũ|ư|ừ|ứ|ự|ử|ữ/g, "u");
|
|
155
|
-
str = str.replace(/ỳ|ý|ỵ|ỷ|ỹ/g, "y");
|
|
156
|
-
str = str.replace(/đ/g, "d");
|
|
157
|
-
// Some system encode vietnamese combining accent as individual utf-8 characters
|
|
158
|
-
str = str.replace(/\u0300|\u0301|\u0303|\u0309|\u0323/g, ""); // Huyền sắc hỏi ngã nặng
|
|
159
|
-
str = str.replace(/\u02C6|\u0306|\u031B/g, ""); // Â, Ê, Ă, Ơ, Ư
|
|
160
|
-
return str.toUpperCase().trim();
|
|
161
|
-
},
|
|
162
|
-
};
|
|
163
|
-
|
|
164
|
-
const TLV = class {
|
|
165
|
-
constructor(
|
|
166
|
-
id = 0,
|
|
167
|
-
name = "",
|
|
168
|
-
length = 99,
|
|
169
|
-
is_fixed = true,
|
|
170
|
-
presense = "O",
|
|
171
|
-
// eslint-disable-next-line no-constant-binary-expression
|
|
172
|
-
value = "" || []
|
|
173
|
-
) {
|
|
174
|
-
this.tagId = id;
|
|
175
|
-
this.tagName = name;
|
|
176
|
-
if (is_fixed) {
|
|
177
|
-
this.tagLength = length;
|
|
178
|
-
} else {
|
|
179
|
-
this.tagLength = name.length;
|
|
180
|
-
}
|
|
181
|
-
this.tagValue = value;
|
|
182
|
-
this.presense = presense;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
toString() {
|
|
186
|
-
let value = "";
|
|
187
|
-
if (Array.isArray(this.tagValue)) {
|
|
188
|
-
for (let de = 0; de < this.tagValue.length; de++) {
|
|
189
|
-
if (this.tagValue[de] instanceof TLV) {
|
|
190
|
-
if (this.tagValue[de].tagValue !== "") {
|
|
191
|
-
value += this.tagValue[de].toString();
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
} else {
|
|
196
|
-
value = this.tagValue;
|
|
197
|
-
}
|
|
198
|
-
if (value === "") {
|
|
199
|
-
return "";
|
|
200
|
-
} else {
|
|
201
|
-
this.tagLength = value.length;
|
|
202
|
-
return `${this.tagId >= 10 ? `${this.tagId}` : `0${this.tagId}`}${
|
|
203
|
-
this.tagLength >= 10 ? `${this.tagLength}` : `0${this.tagLength}`
|
|
204
|
-
}${value}`;
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
};
|
|
208
|
-
|
|
209
|
-
//Classes
|
|
210
|
-
const VIETQR = class {
|
|
211
|
-
constructor() {
|
|
212
|
-
this.data = [];
|
|
213
|
-
this.fields = FIELDS;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
toStringNoCrc() {
|
|
217
|
-
let str = "";
|
|
218
|
-
for (let de = 0; de < this.data.length; de++) {
|
|
219
|
-
if (this.data[de] instanceof TLV) {
|
|
220
|
-
let deString = this.data[de].toString();
|
|
221
|
-
str += deString;
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
return `${str}6304`;
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
getCrc() {
|
|
228
|
-
return CRC.getCrc16_array(this.toStringNoCrc());
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
toString() {
|
|
232
|
-
let semi_vietqr = this.toStringNoCrc();
|
|
233
|
-
let crc_value = this.getCrc();
|
|
234
|
-
return `${semi_vietqr}${crc_value}`;
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
builder() {
|
|
238
|
-
this.data[0] = new TLV(0, "Payload Format Indicator", 2, true, "M", "01");
|
|
239
|
-
this.data[1] = new TLV(
|
|
240
|
-
1,
|
|
241
|
-
"QR Type",
|
|
242
|
-
2,
|
|
243
|
-
true,
|
|
244
|
-
"M",
|
|
245
|
-
this.fields.is_dynamic_qr ? "12" : "11"
|
|
246
|
-
);
|
|
247
|
-
this.data[38] = new TLV(
|
|
248
|
-
38,
|
|
249
|
-
"QR code service on NAPAS system",
|
|
250
|
-
99,
|
|
251
|
-
false,
|
|
252
|
-
"M",
|
|
253
|
-
[
|
|
254
|
-
new TLV(
|
|
255
|
-
0,
|
|
256
|
-
"Global Unique Identifier - GUID",
|
|
257
|
-
10,
|
|
258
|
-
true,
|
|
259
|
-
"M",
|
|
260
|
-
NAPAS_GUID
|
|
261
|
-
),
|
|
262
|
-
new TLV(1, "Payment network specific", 32, false, "M", [
|
|
263
|
-
new TLV(0, "Acquier ID/BNB ID", 6, true, "M", this.fields.acq),
|
|
264
|
-
new TLV(
|
|
265
|
-
1,
|
|
266
|
-
"Merchant ID/Consumer ID",
|
|
267
|
-
19,
|
|
268
|
-
false,
|
|
269
|
-
"M",
|
|
270
|
-
this.fields.merchant_id
|
|
271
|
-
),
|
|
272
|
-
]),
|
|
273
|
-
new TLV(2, "Service Code", 10, false, "C", this.fields.service_code),
|
|
274
|
-
]
|
|
275
|
-
);
|
|
276
|
-
this.data[52] = new TLV(
|
|
277
|
-
52,
|
|
278
|
-
"Merchant Category Code",
|
|
279
|
-
4,
|
|
280
|
-
true,
|
|
281
|
-
"O",
|
|
282
|
-
this.fields.merchant_category
|
|
283
|
-
);
|
|
284
|
-
this.data[53] = new TLV(
|
|
285
|
-
53,
|
|
286
|
-
"Transaction Currency",
|
|
287
|
-
3,
|
|
288
|
-
true,
|
|
289
|
-
"M",
|
|
290
|
-
this.fields.currency
|
|
291
|
-
);
|
|
292
|
-
this.data[54] = new TLV(
|
|
293
|
-
54,
|
|
294
|
-
"Transaction Amount",
|
|
295
|
-
13,
|
|
296
|
-
false,
|
|
297
|
-
"C",
|
|
298
|
-
this.fields.is_dynamic_qr ? this.fields.amount : ""
|
|
299
|
-
);
|
|
300
|
-
this.data[55] = new TLV(55, "Tip or Convenience Indicator", 2, true, "O");
|
|
301
|
-
this.data[56] = new TLV(
|
|
302
|
-
56,
|
|
303
|
-
"Value of Convenience Fee Fixed",
|
|
304
|
-
13,
|
|
305
|
-
false,
|
|
306
|
-
"O"
|
|
307
|
-
);
|
|
308
|
-
this.data[57] = new TLV(
|
|
309
|
-
57,
|
|
310
|
-
"Value of Convenience Fee Percentage",
|
|
311
|
-
5,
|
|
312
|
-
false,
|
|
313
|
-
"O"
|
|
314
|
-
);
|
|
315
|
-
this.data[58] = new TLV(
|
|
316
|
-
58,
|
|
317
|
-
"Country Code",
|
|
318
|
-
2,
|
|
319
|
-
true,
|
|
320
|
-
"M",
|
|
321
|
-
this.fields.country_code
|
|
322
|
-
);
|
|
323
|
-
this.data[59] = new TLV(
|
|
324
|
-
59,
|
|
325
|
-
"Merchant Name",
|
|
326
|
-
25,
|
|
327
|
-
false,
|
|
328
|
-
"O",
|
|
329
|
-
this.fields.merchant_name
|
|
330
|
-
);
|
|
331
|
-
this.data[60] = new TLV(
|
|
332
|
-
60,
|
|
333
|
-
"Merchant City",
|
|
334
|
-
15,
|
|
335
|
-
false,
|
|
336
|
-
"O",
|
|
337
|
-
this.fields.merchant_city
|
|
338
|
-
);
|
|
339
|
-
this.data[61] = new TLV(
|
|
340
|
-
61,
|
|
341
|
-
"Postal Code",
|
|
342
|
-
10,
|
|
343
|
-
false,
|
|
344
|
-
"O",
|
|
345
|
-
this.fields.postal_code
|
|
346
|
-
);
|
|
347
|
-
this.data[62] = new TLV(
|
|
348
|
-
62,
|
|
349
|
-
"Additional Data Field Template",
|
|
350
|
-
99,
|
|
351
|
-
true,
|
|
352
|
-
"O",
|
|
353
|
-
[
|
|
354
|
-
null,
|
|
355
|
-
new TLV(1, "Bill Number", 25, false, "C", this.fields.bill_number),
|
|
356
|
-
new TLV(2, "Mobile Number", 25, false, "C", this.fields.mobile_number),
|
|
357
|
-
new TLV(3, "Store Label", 25, false, "O", this.fields.store_label),
|
|
358
|
-
new TLV(
|
|
359
|
-
4,
|
|
360
|
-
"Loyalty Number",
|
|
361
|
-
25,
|
|
362
|
-
false,
|
|
363
|
-
"O",
|
|
364
|
-
this.fields.loyalty_number
|
|
365
|
-
),
|
|
366
|
-
new TLV(5, "Reference Label", 25, false, "C", this.fields.ref_label),
|
|
367
|
-
new TLV(
|
|
368
|
-
6,
|
|
369
|
-
"Customer Label",
|
|
370
|
-
25,
|
|
371
|
-
false,
|
|
372
|
-
"C",
|
|
373
|
-
this.fields.customer_label
|
|
374
|
-
),
|
|
375
|
-
new TLV(
|
|
376
|
-
7,
|
|
377
|
-
"Terminal Label",
|
|
378
|
-
25,
|
|
379
|
-
false,
|
|
380
|
-
"O",
|
|
381
|
-
this.fields.terminal_label
|
|
382
|
-
),
|
|
383
|
-
new TLV(
|
|
384
|
-
8,
|
|
385
|
-
"Purpose of Transaction",
|
|
386
|
-
25,
|
|
387
|
-
false,
|
|
388
|
-
"C",
|
|
389
|
-
CRC.nonAccentVietnamese(this.fields.purpose_txn)
|
|
390
|
-
),
|
|
391
|
-
new TLV(
|
|
392
|
-
9,
|
|
393
|
-
"Additional Consumer Data Request",
|
|
394
|
-
3,
|
|
395
|
-
false,
|
|
396
|
-
"O",
|
|
397
|
-
this.fields.additional_data
|
|
398
|
-
),
|
|
399
|
-
]
|
|
400
|
-
);
|
|
401
|
-
this.data[63] = new TLV(63, "CRC (Cyclic Redundancy Check)", 4, true, "M");
|
|
402
|
-
this.data[64] = new TLV(
|
|
403
|
-
64,
|
|
404
|
-
"Merchant Information - Language Template",
|
|
405
|
-
2,
|
|
406
|
-
true,
|
|
407
|
-
"O",
|
|
408
|
-
[
|
|
409
|
-
new TLV(0, "Language Preference", 2, true, "M", this.fields.lang_ref),
|
|
410
|
-
new TLV(
|
|
411
|
-
1,
|
|
412
|
-
"Merchant Name - Alternate Language",
|
|
413
|
-
25,
|
|
414
|
-
false,
|
|
415
|
-
"M",
|
|
416
|
-
this.fields.local_merchant_name
|
|
417
|
-
),
|
|
418
|
-
new TLV(
|
|
419
|
-
2,
|
|
420
|
-
"Merchant City - Alternate Language",
|
|
421
|
-
15,
|
|
422
|
-
false,
|
|
423
|
-
"O",
|
|
424
|
-
this.fields.local_merchant_city
|
|
425
|
-
),
|
|
426
|
-
]
|
|
427
|
-
);
|
|
428
|
-
this.data[80] = new TLV(80, "UniCube data", 99, false, "0", [
|
|
429
|
-
new TLV(0, "uuid", 16, false, "O", this.fields.uuid),
|
|
430
|
-
new TLV(1, "custom data", 83, false, "O", this.fields.custom_data),
|
|
431
|
-
]);
|
|
432
|
-
return this.toString();
|
|
433
|
-
}
|
|
434
|
-
};
|
|
435
|
-
|
|
436
|
-
export { CURRENCY, SERVICE_CODE, VIETQR };
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import ModalZoom from "@components/common/modal/modal-zoom"
|
|
2
|
-
import { useNavigate } from "react-router-dom"
|
|
3
|
-
|
|
4
|
-
type TProps = {
|
|
5
|
-
isOpen: boolean
|
|
6
|
-
onClose: () => void
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
const SessionCloseModal = ({ isOpen, onClose }: TProps) => {
|
|
10
|
-
const navigate = useNavigate()
|
|
11
|
-
|
|
12
|
-
const onBack = () => {
|
|
13
|
-
navigate(`/console${sessionStorage.getItem("enter_pincode")}`)
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
return (
|
|
17
|
-
<ModalZoom isOpen={isOpen} onClose={onClose}>
|
|
18
|
-
<div className="flex flex-col gap-2 items-center justify-center">
|
|
19
|
-
<p className="text-[32px] font-semibold text-text-primary">
|
|
20
|
-
Opps! Đóng cửa rồi
|
|
21
|
-
</p>
|
|
22
|
-
|
|
23
|
-
<p className="leading-6 text-text-secondary tracking-[-0.24px]">
|
|
24
|
-
Cửa hàng chúng tôi đang đóng cửa, bạn hãy quay lại sau nhé
|
|
25
|
-
</p>
|
|
26
|
-
|
|
27
|
-
<button onClick={onBack} className="rounded-lg button-primary mt-4">
|
|
28
|
-
Trở về
|
|
29
|
-
</button>
|
|
30
|
-
</div>
|
|
31
|
-
</ModalZoom>
|
|
32
|
-
)
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export default SessionCloseModal
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import ButtonAction from "@components/common/button-action";
|
|
2
|
-
import { QUERY_KEYS } from "@constants/query.constant";
|
|
3
|
-
import { useQueryParams } from "@hooks/common/use-query-params";
|
|
4
|
-
import { usePayment } from "@provider/pos-provider/payment-provider";
|
|
5
|
-
import Lottie from "lottie-react";
|
|
6
|
-
import animationData from "../../../../../public/assets/lottie/soft_pos.json";
|
|
7
|
-
import { PaymentInfo } from "../payment-info";
|
|
8
|
-
import { PaymentLayout } from "../payment-layout";
|
|
9
|
-
|
|
10
|
-
export const SoftPosPayment = ({ total }: { total: number }) => {
|
|
11
|
-
return (
|
|
12
|
-
<PaymentLayout
|
|
13
|
-
leftContent={<LeftContent />}
|
|
14
|
-
rightContent={<RightContent total={total} />}
|
|
15
|
-
/>
|
|
16
|
-
);
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
const LeftContent = () => {
|
|
20
|
-
return (
|
|
21
|
-
<div className="flex flex-col gap-3 items-center">
|
|
22
|
-
<div style={{ width: 280 }}>
|
|
23
|
-
<Lottie animationData={animationData} />
|
|
24
|
-
</div>
|
|
25
|
-
</div>
|
|
26
|
-
);
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
const RightContent = ({ total }: { total: number }) => {
|
|
30
|
-
const { onPaymentSoftPos } = usePayment();
|
|
31
|
-
const { updateQuery } = useQueryParams();
|
|
32
|
-
const handlePayment = () => {
|
|
33
|
-
updateQuery(QUERY_KEYS.SHOW_SCREEN, "true");
|
|
34
|
-
onPaymentSoftPos(total);
|
|
35
|
-
};
|
|
36
|
-
return (
|
|
37
|
-
<>
|
|
38
|
-
<div className="flex flex-col gap-3 h-full justify-center ">
|
|
39
|
-
<PaymentInfo />
|
|
40
|
-
<ButtonAction
|
|
41
|
-
onClick={() => handlePayment()}
|
|
42
|
-
text="Thanh toán SoftPos"
|
|
43
|
-
className="button-primary h-[56px]"
|
|
44
|
-
/>
|
|
45
|
-
</div>
|
|
46
|
-
</>
|
|
47
|
-
);
|
|
48
|
-
};
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import ButtonAction from "@components/common/button-action";
|
|
2
|
-
import ModalZoom from "@components/common/modal/modal-zoom";
|
|
3
|
-
import { t } from "i18next";
|
|
4
|
-
import { useNavigate } from "react-router-dom";
|
|
5
|
-
|
|
6
|
-
export const BackConfirm = ({
|
|
7
|
-
isOpen,
|
|
8
|
-
onClose,
|
|
9
|
-
}: {
|
|
10
|
-
isOpen: boolean;
|
|
11
|
-
onClose: () => void;
|
|
12
|
-
}) => {
|
|
13
|
-
const navigate = useNavigate();
|
|
14
|
-
const onBack = () => {
|
|
15
|
-
navigate(`/console${sessionStorage.getItem("enter_pincode")}`);
|
|
16
|
-
};
|
|
17
|
-
return (
|
|
18
|
-
<ModalZoom
|
|
19
|
-
isOpen={isOpen}
|
|
20
|
-
onClose={onClose}
|
|
21
|
-
className="p-0 py-4 px-5"
|
|
22
|
-
modalClassName="w-[40%]"
|
|
23
|
-
title="Xác nhận thoát điểm bán" //multi language
|
|
24
|
-
footer={
|
|
25
|
-
<div className="flex gap-2 justify-end p-4">
|
|
26
|
-
<ButtonAction
|
|
27
|
-
onClick={() => onClose()}
|
|
28
|
-
text={t("cancel_button")}
|
|
29
|
-
className="button-secondary w-full"
|
|
30
|
-
/>
|
|
31
|
-
<ButtonAction
|
|
32
|
-
onClick={() => onBack()}
|
|
33
|
-
text={t("confirm_button")}
|
|
34
|
-
className="button-primary w-full"
|
|
35
|
-
/>
|
|
36
|
-
</div>
|
|
37
|
-
}
|
|
38
|
-
>
|
|
39
|
-
<p>
|
|
40
|
-
Bạn có đang thoát khỏi điểm bán này. Bạn có muốn thoát điểm bán này
|
|
41
|
-
không?
|
|
42
|
-
</p>
|
|
43
|
-
</ModalZoom>
|
|
44
|
-
);
|
|
45
|
-
};
|