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.
Files changed (314) hide show
  1. package/dist/index.d.mts +1 -1
  2. package/dist/index.mjs +1 -0
  3. package/package.json +4 -1
  4. package/dist/index.css.map +0 -1
  5. package/dist/index.mjs.map +0 -1
  6. package/dist/tailwind.preset.mjs.map +0 -1
  7. package/public/assets/images/bank-logos.png +0 -0
  8. package/public/assets/images/banner1.png +0 -0
  9. package/public/assets/images/banner2.png +0 -0
  10. package/public/assets/images/banner3.png +0 -0
  11. package/public/assets/images/banner4.png +0 -0
  12. package/public/assets/images/cashier.svg +0 -9
  13. package/public/assets/images/empty-cart.png +0 -0
  14. package/public/assets/images/empty-table-state.png +0 -0
  15. package/public/assets/images/layout-display/left-layout.png +0 -0
  16. package/public/assets/images/layout-display/right-layout.png +0 -0
  17. package/public/assets/images/modal-illustration.png +0 -0
  18. package/public/assets/images/order-empty-state.png +0 -0
  19. package/public/assets/images/order.png +0 -0
  20. package/public/assets/images/payment-success-label.png +0 -0
  21. package/public/assets/images/table-empty.png +0 -0
  22. package/public/assets/images/take-away.png +0 -0
  23. package/public/assets/lottie/loading.json +0 -1
  24. package/public/assets/lottie/soft_pos.json +0 -1
  25. package/public/assets/lottie/success.json +0 -1
  26. package/public/config.json +0 -27
  27. package/public/env.json +0 -17
  28. package/src/animations/success.json +0 -9730
  29. package/src/assets/icons/breadcrumbs-icon.tsx +0 -85
  30. package/src/assets/icons/cart-icon.tsx +0 -14
  31. package/src/assets/icons/common.tsx +0 -270
  32. package/src/assets/icons/customer-view-icon.tsx +0 -20
  33. package/src/assets/icons/dining-table.tsx +0 -34
  34. package/src/assets/icons/edit-line-icon.tsx +0 -18
  35. package/src/assets/icons/emenu-icon.tsx +0 -39
  36. package/src/assets/icons/file-close-line-icon.tsx +0 -18
  37. package/src/assets/icons/helper-icon.tsx +0 -84
  38. package/src/assets/icons/home-gear-line-icon.tsx +0 -18
  39. package/src/assets/icons/kanban-icon.tsx +0 -16
  40. package/src/assets/icons/loading-icon.tsx +0 -45
  41. package/src/assets/icons/logout-box-line-icon.tsx +0 -18
  42. package/src/assets/icons/order-icon.tsx +0 -92
  43. package/src/assets/icons/payment-icon.tsx +0 -429
  44. package/src/assets/icons/pincode.tsx +0 -196
  45. package/src/assets/icons/pos-connect-icon.tsx +0 -67
  46. package/src/assets/icons/pos-device-icon.tsx +0 -52
  47. package/src/assets/icons/pos-icon.tsx +0 -75
  48. package/src/assets/icons/printer-line-icon.tsx +0 -18
  49. package/src/assets/icons/star-icon.tsx +0 -174
  50. package/src/assets/icons/table-icon.tsx +0 -77
  51. package/src/assets/icons/user-add-line-icon.tsx +0 -33
  52. package/src/assets/icons/user-icon.tsx +0 -65
  53. package/src/components/common/button-action.tsx +0 -46
  54. package/src/components/common/button-icon.tsx +0 -23
  55. package/src/components/common/dropdown/index.tsx +0 -79
  56. package/src/components/common/empty-state.tsx +0 -60
  57. package/src/components/common/header/index.tsx +0 -89
  58. package/src/components/common/header/tabs.tsx +0 -119
  59. package/src/components/common/image.tsx +0 -20
  60. package/src/components/common/input/index.tsx +0 -55
  61. package/src/components/common/input/radio-group.tsx +0 -75
  62. package/src/components/common/input/text-area.tsx +0 -28
  63. package/src/components/common/modal/delete-confirm-modal-container.tsx +0 -65
  64. package/src/components/common/modal/index.ts +0 -2
  65. package/src/components/common/modal/modal-direction.tsx +0 -125
  66. package/src/components/common/modal/modal-header.tsx +0 -37
  67. package/src/components/common/modal/modal-wrapper.tsx +0 -56
  68. package/src/components/common/modal/modal-zoom.tsx +0 -61
  69. package/src/components/common/pagination.tsx +0 -95
  70. package/src/components/common/refresh-button.tsx +0 -28
  71. package/src/components/common/search-bar.tsx +0 -27
  72. package/src/components/common/search.tsx +0 -59
  73. package/src/components/common/skeleton.tsx +0 -7
  74. package/src/components/common/tabs-layout.tsx +0 -98
  75. package/src/components/common/use-check-session.tsx +0 -19
  76. package/src/components/customer-management/add-customer/add-customer-drawer.tsx +0 -286
  77. package/src/components/customer-management/add-customer/address-select.tsx +0 -51
  78. package/src/components/customer-management/choose-customer-drawer.tsx +0 -177
  79. package/src/components/customer-management/customer-info-drawer.tsx +0 -166
  80. package/src/components/customer-management/customer-no-data.tsx +0 -18
  81. package/src/components/emenu/emenu-qr-code.tsx +0 -59
  82. package/src/components/emenu/menu-link.tsx +0 -67
  83. package/src/components/index.ts +0 -8
  84. package/src/components/kanban-template/kitchen-template.tsx +0 -60
  85. package/src/components/kanban-template/pos-order-template.tsx +0 -77
  86. package/src/components/kanban-template/pos-template.tsx +0 -170
  87. package/src/components/kitchen-management/change-status-confirm-modal.tsx +0 -61
  88. package/src/components/kitchen-management/index.ts +0 -1
  89. package/src/components/kitchen-management/kitchen-order/index.tsx +0 -153
  90. package/src/components/kitchen-management/kitchen-order/line.tsx +0 -78
  91. package/src/components/kitchen-management/kitchen-order/state.tsx +0 -52
  92. package/src/components/kitchen-management/kitchen-status.tsx +0 -69
  93. package/src/components/kitchen-management/orders-kitchen-management.tsx +0 -113
  94. package/src/components/order-management/index.tsx +0 -128
  95. package/src/components/order-management/order-actions.tsx +0 -46
  96. package/src/components/order-management/order-detail/header.tsx +0 -37
  97. package/src/components/order-management/order-detail/index.ts +0 -3
  98. package/src/components/order-management/order-detail/information.tsx +0 -96
  99. package/src/components/order-management/order-detail/order-detail.tsx +0 -84
  100. package/src/components/order-management/order-detail/order-line.tsx +0 -56
  101. package/src/components/order-management/order-detail/summary.tsx +0 -221
  102. package/src/components/order-management/order-header.tsx +0 -113
  103. package/src/components/order-management/order-pagination.tsx +0 -49
  104. package/src/components/order-management/order-status.tsx +0 -58
  105. package/src/components/order-management/order-table.tsx +0 -179
  106. package/src/components/order-management/order-tabs.tsx +0 -48
  107. package/src/components/pos-management/add-product-from-barcode/index.tsx +0 -97
  108. package/src/components/pos-management/cart-content/action-line.tsx +0 -81
  109. package/src/components/pos-management/cart-content/cancel-order-line-modal.tsx +0 -41
  110. package/src/components/pos-management/cart-content/cart-item.tsx +0 -173
  111. package/src/components/pos-management/cart-content/cart-items.tsx +0 -130
  112. package/src/components/pos-management/cart-content/draft-orders/draft-order-line.tsx +0 -67
  113. package/src/components/pos-management/cart-content/draft-orders/index.tsx +0 -40
  114. package/src/components/pos-management/cart-content/edit-cart-modal.tsx +0 -11
  115. package/src/components/pos-management/cart-content/index.tsx +0 -260
  116. package/src/components/pos-management/cart-content/no-select-order.tsx +0 -26
  117. package/src/components/pos-management/cart-content/order-info/customer-info.tsx +0 -53
  118. package/src/components/pos-management/cart-content/order-info/index.tsx +0 -109
  119. package/src/components/pos-management/cart-content/order-total.tsx +0 -36
  120. package/src/components/pos-management/cart-content/orders-line.tsx +0 -72
  121. package/src/components/pos-management/menu-content/category-tab.tsx +0 -38
  122. package/src/components/pos-management/menu-content/create-order-modal.tsx +0 -65
  123. package/src/components/pos-management/menu-content/product-content.tsx +0 -93
  124. package/src/components/pos-management/menu-content/product-detail/info.tsx +0 -28
  125. package/src/components/pos-management/menu-content/product-detail/modal.tsx +0 -148
  126. package/src/components/pos-management/menu-content/product-detail/option.tsx +0 -87
  127. package/src/components/pos-management/menu-content/product-detail/quantity-control.tsx +0 -155
  128. package/src/components/pos-management/menu-content/product-detail/sale-keypad.tsx +0 -100
  129. package/src/components/pos-management/menu-content/product-item.tsx +0 -65
  130. package/src/components/pos-management/order-helper/cancel-order-confirm.tsx +0 -43
  131. package/src/components/pos-management/order-helper/history-call.tsx +0 -105
  132. package/src/components/pos-management/order-helper/order-helper-modal.tsx +0 -116
  133. package/src/components/pos-management/payment-content/bill/actions.tsx +0 -46
  134. package/src/components/pos-management/payment-content/bill/content.tsx +0 -207
  135. package/src/components/pos-management/payment-content/bill/index.tsx +0 -18
  136. package/src/components/pos-management/payment-content/card-payment/index.tsx +0 -124
  137. package/src/components/pos-management/payment-content/card-payment/pos-payment/pos-connect.tsx +0 -183
  138. package/src/components/pos-management/payment-content/card-payment/pos-payment/qr-connect.tsx +0 -185
  139. package/src/components/pos-management/payment-content/card-payment/waiting-for-payment-pos-modal.tsx +0 -37
  140. package/src/components/pos-management/payment-content/cash-payment/index.tsx +0 -216
  141. package/src/components/pos-management/payment-content/index.tsx +0 -70
  142. package/src/components/pos-management/payment-content/payment-info.tsx +0 -67
  143. package/src/components/pos-management/payment-content/payment-layout.tsx +0 -16
  144. package/src/components/pos-management/payment-content/payment-method-cards.tsx +0 -99
  145. package/src/components/pos-management/payment-content/qr-payment/index.tsx +0 -118
  146. package/src/components/pos-management/payment-content/qr-payment/qr_code.js +0 -29
  147. package/src/components/pos-management/payment-content/qr-payment/vietqr.js +0 -436
  148. package/src/components/pos-management/payment-content/session-close-modal.tsx +0 -35
  149. package/src/components/pos-management/payment-content/soft-pos-payment/index.tsx +0 -48
  150. package/src/components/pos-management/pos-helpers/back-confirm.tsx +0 -45
  151. package/src/components/pos-management/pos-helpers/index.tsx +0 -135
  152. package/src/components/pos-management/pos-helpers/layout-display-modal.tsx +0 -99
  153. package/src/components/pos-management/search.tsx +0 -48
  154. package/src/components/pos-management/table-content/filtered-tables.tsx +0 -59
  155. package/src/components/pos-management/table-content/floor-tabs.tsx +0 -65
  156. package/src/components/pos-management/table-content/index.tsx +0 -76
  157. package/src/components/pos-management/table-content/table-item.tsx +0 -127
  158. package/src/components/pos-management/table-content/tables.tsx +0 -96
  159. package/src/components/restaurant-management/add-floor-modal.tsx +0 -133
  160. package/src/components/restaurant-management/add-table-modal.tsx +0 -198
  161. package/src/components/restaurant-management/delete-floor-confirm-modal.tsx +0 -42
  162. package/src/components/restaurant-management/delete-table-confirm-modal.tsx +0 -51
  163. package/src/components/restaurant-management/header.tsx +0 -22
  164. package/src/components/restaurant-management/index.tsx +0 -54
  165. package/src/components/restaurant-management/left-side.tsx +0 -51
  166. package/src/components/restaurant-management/right-side.tsx +0 -179
  167. package/src/components/restaurant-management/table-empty.tsx +0 -43
  168. package/src/components/session-management/close-session-modal/actions.tsx +0 -45
  169. package/src/components/session-management/close-session-modal/close-session-confirm.tsx +0 -157
  170. package/src/components/session-management/close-session-modal/close-session-ticket.tsx +0 -218
  171. package/src/components/session-management/close-session-modal/container.tsx +0 -25
  172. package/src/components/session-management/close-session-modal/draft-orders-confirm.tsx +0 -53
  173. package/src/components/session-management/close-session-modal/draft-orders-summary.tsx +0 -82
  174. package/src/components/session-management/close-session-modal/draft-orders.tsx +0 -34
  175. package/src/components/session-management/close-session-modal/index.tsx +0 -35
  176. package/src/components/session-management/close-session-modal/order/index.ts +0 -1
  177. package/src/components/session-management/close-session-modal/order/order-line.tsx +0 -64
  178. package/src/components/session-management/close-session-modal/order/orders-in-draft.tsx +0 -31
  179. package/src/components/session-management/close-session-modal/session-summary.tsx +0 -165
  180. package/src/components/session-management/index.ts +0 -1
  181. package/src/components/session-management/open-shift/index.tsx +0 -172
  182. package/src/components/table-management/index.tsx +0 -0
  183. package/src/constants/api/index.ts +0 -1
  184. package/src/constants/headers.constant.tsx +0 -24
  185. package/src/constants/index.ts +0 -1
  186. package/src/constants/language.store.ts +0 -21
  187. package/src/constants/methods.constant.ts +0 -10
  188. package/src/constants/order-state.ts +0 -8
  189. package/src/constants/payment-color.constant.ts +0 -26
  190. package/src/constants/query.constant.ts +0 -14
  191. package/src/constants/routes.constants.ts +0 -23
  192. package/src/constants/template-name.constant.ts +0 -9
  193. package/src/hooks/bill/use-get-bill-information.ts +0 -49
  194. package/src/hooks/bill/use-print-bill.tsx +0 -0
  195. package/src/hooks/common/load-env-config.ts +0 -98
  196. package/src/hooks/common/use-back.ts +0 -13
  197. package/src/hooks/common/use-broadcast.ts +0 -22
  198. package/src/hooks/common/use-click-outside.ts +0 -58
  199. package/src/hooks/common/use-get-base64-photo.ts +0 -71
  200. package/src/hooks/common/use-get-query.ts +0 -25
  201. package/src/hooks/common/use-pos.ts +0 -21
  202. package/src/hooks/common/use-query-params.ts +0 -89
  203. package/src/hooks/common/use-speech.ts +0 -36
  204. package/src/hooks/customer/use-customer-provider.ts +0 -247
  205. package/src/hooks/floor/use-floor-provider.ts +0 -172
  206. package/src/hooks/kitchen/use-kitchen-provider.ts +0 -80
  207. package/src/hooks/order/use-get-point-reward.ts +0 -50
  208. package/src/hooks/order/use-loop-fetch-order.ts +0 -30
  209. package/src/hooks/order/use-order-items.ts +0 -61
  210. package/src/hooks/order/use-orders.ts +0 -76
  211. package/src/hooks/payment/use-payment-provider.ts +0 -221
  212. package/src/hooks/product/use-product-provider.ts +0 -87
  213. package/src/hooks/session/use-check-session.tsx +0 -19
  214. package/src/hooks/session/use-session-provider.ts +0 -79
  215. package/src/hooks/table/use-pos-table-provider.ts +0 -193
  216. package/src/index.css +0 -5
  217. package/src/index.ts +0 -13
  218. package/src/layouts/common.tsx +0 -15
  219. package/src/layouts/index.ts +0 -4
  220. package/src/layouts/pos-layout.tsx +0 -33
  221. package/src/layouts/pos-order-layout.tsx +0 -43
  222. package/src/layouts/sale-layout.tsx +0 -25
  223. package/src/locales/en.json +0 -394
  224. package/src/locales/vi.json +0 -400
  225. package/src/pages/index.ts +0 -4
  226. package/src/pages/login/index.tsx +0 -128
  227. package/src/pages/pincode/index.tsx +0 -198
  228. package/src/pages/pos/kitchen-management/layout.tsx +0 -18
  229. package/src/pages/pos/management-floor/index.tsx +0 -7
  230. package/src/pages/pos/management-order/index.tsx +0 -7
  231. package/src/pages/pos/management-order/order-detail/index.tsx +0 -7
  232. package/src/pages/pos/management-table/index.tsx +0 -0
  233. package/src/pages/pos/payment-success/index.tsx +0 -75
  234. package/src/provider/app-provider.tsx +0 -56
  235. package/src/provider/fallback/custom-error.tsx +0 -26
  236. package/src/provider/main-provider.tsx +0 -41
  237. package/src/provider/meta-provider.tsx +0 -72
  238. package/src/provider/modal-provider.tsx +0 -48
  239. package/src/provider/notification-provider.tsx +0 -64
  240. package/src/provider/pos-provider/close-session-provider/index.tsx +0 -207
  241. package/src/provider/pos-provider/customer-provider/index.tsx +0 -30
  242. package/src/provider/pos-provider/floor-provider/index.tsx +0 -39
  243. package/src/provider/pos-provider/index.ts +0 -6
  244. package/src/provider/pos-provider/kitchen-provider/index.tsx +0 -30
  245. package/src/provider/pos-provider/order-detail-provider/index.tsx +0 -233
  246. package/src/provider/pos-provider/order-provider/index.tsx +0 -803
  247. package/src/provider/pos-provider/payment-provider/index.tsx +0 -30
  248. package/src/provider/pos-provider/product-provider/index.tsx +0 -30
  249. package/src/provider/pos-provider/sale-provider/index.tsx +0 -168
  250. package/src/provider/pos-provider/session-provider/index.tsx +0 -30
  251. package/src/provider/pos-provider/socket-provider/index.tsx +0 -118
  252. package/src/provider/pos-provider/table-provider/index.tsx +0 -30
  253. package/src/provider/public-provider.tsx +0 -104
  254. package/src/provider/use-session-provider.ts +0 -79
  255. package/src/router/app-router.tsx +0 -38
  256. package/src/router/index.tsx +0 -26
  257. package/src/router/pos-route.tsx +0 -75
  258. package/src/router/protected-route.tsx +0 -16
  259. package/src/router/public-route.tsx +0 -11
  260. package/src/store/header/index.ts +0 -21
  261. package/src/store/session/index.ts +0 -25
  262. package/src/store/states/cart.state.ts +0 -135
  263. package/src/store/states/close-session.state.ts +0 -20
  264. package/src/store/states/customer.state.ts +0 -19
  265. package/src/store/states/payment.state.ts +0 -14
  266. package/src/styles/base.css +0 -212
  267. package/src/styles/common.css +0 -65
  268. package/src/styles/lib/tailwind.css +0 -0
  269. package/src/styles/lib/tailwind.theme.css +0 -34
  270. package/src/styles/loading.css +0 -72
  271. package/src/styles/main.css +0 -5
  272. package/src/styles/refreshing-content.css +0 -55
  273. package/src/styles/text.css +0 -44
  274. package/src/types/account.ts +0 -61
  275. package/src/types/branch.ts +0 -6
  276. package/src/types/category.ts +0 -13
  277. package/src/types/common.ts +0 -4
  278. package/src/types/customer.ts +0 -52
  279. package/src/types/dashboard.ts +0 -18
  280. package/src/types/edc.ts +0 -37
  281. package/src/types/export-e-invoice.ts +0 -17
  282. package/src/types/filter.d.ts +0 -12
  283. package/src/types/floor/floor.ts +0 -16
  284. package/src/types/floor.d.ts +0 -36
  285. package/src/types/index.ts +0 -127
  286. package/src/types/invoice.ts +0 -32
  287. package/src/types/modal.ts +0 -15
  288. package/src/types/notification.ts +0 -12
  289. package/src/types/order.ts +0 -182
  290. package/src/types/payment.ts +0 -44
  291. package/src/types/product/product.ts +0 -47
  292. package/src/types/product.ts +0 -137
  293. package/src/types/provider-info.d.ts +0 -14
  294. package/src/types/qr.d.ts +0 -25
  295. package/src/types/report.d.ts +0 -43
  296. package/src/types/sale.d.ts +0 -68
  297. package/src/types/search.d.ts +0 -7
  298. package/src/types/session.d.ts +0 -30
  299. package/src/types/shop-qr.d.ts +0 -89
  300. package/src/types/staff.d.ts +0 -35
  301. package/src/types/store.d.ts +0 -25
  302. package/src/types/table.d.ts +0 -57
  303. package/src/utils/close-session-ticket.tsx +0 -129
  304. package/src/utils/functions.ts +0 -299
  305. package/src/utils/i18n.ts +0 -25
  306. package/src/utils/pos/bill.ts +0 -156
  307. package/src/utils/pos/convert-order.ts +0 -58
  308. package/src/utils/pos/helpers.ts +0 -48
  309. package/src/utils/pos/session.ts +0 -44
  310. package/src/utils/storages/index.ts +0 -1
  311. package/src/utils/storages/local-storage.ts +0 -72
  312. package/tailwind.preset.ts +0 -25
  313. package/tsconfig.json +0 -30
  314. package/tsup.config.ts +0 -30
@@ -1,155 +0,0 @@
1
- import { IcPlus, IcSubtractLine } from "@assets/icons/breadcrumbs-icon";
2
- import { IcTrash } from "@assets/icons/common";
3
- import ButtonAction from "@components/common/button-action";
4
- import { ButtonIcon } from "@components/common/button-icon";
5
- import { QUERY_KEYS } from "@constants/query.constant";
6
- import { useQueryParams } from "@hooks/common/use-query-params";
7
- import { useOrder } from "@provider/pos-provider/order-provider";
8
- import { TAttributeLine, TProduct } from "@type/product/product";
9
- import { t } from "i18next";
10
- import { useState } from "react";
11
-
12
- type TProps = {
13
- productData: TProduct | undefined;
14
- onClose: () => void;
15
- selectedOject: Record<string, number[]> | undefined;
16
- isUpdate: boolean;
17
- quantity: number | string;
18
- setQuantity: (val: any) => void;
19
- note?: string;
20
- };
21
-
22
- const QuantityControl = (props: TProps) => {
23
- const {
24
- productData,
25
- onClose,
26
- selectedOject,
27
- quantity,
28
- setQuantity,
29
- isUpdate,
30
- note,
31
- } = props;
32
- const { changeProductQty } = useOrder();
33
- const { getQuery } = useQueryParams();
34
- const orderId = getQuery(QUERY_KEYS.ORDER_ID);
35
-
36
- const [showKeyPad, setShowKeyPad] = useState(false);
37
-
38
- const handleAddToCart = async (qty: number | string) => {
39
- if (!productData) return;
40
-
41
- try {
42
- const attributesValue = selectedOject
43
- ? Object.values(selectedOject).flat()
44
- : [];
45
- const pickAttributeValue = productData.attributeLines?.map(
46
- (attributeLine: TAttributeLine) => {
47
- return {
48
- ...attributeLine,
49
- value_string: attributeLine.value_string?.filter(
50
- (attributeValue: any) =>
51
- attributesValue?.includes(attributeValue.id)
52
- ),
53
- };
54
- }
55
- );
56
- await changeProductQty({
57
- product: {
58
- ...productData,
59
- attributeValueIds: attributesValue,
60
- pickAttributeValue: pickAttributeValue,
61
- },
62
- qty: Number(qty),
63
- orderId: Number(orderId),
64
- note: note,
65
- });
66
- onClose();
67
- } catch (error) {
68
- console.log("error", error);
69
- }
70
- };
71
-
72
- const onConfirm = (value: number) => handleAddToCart(value);
73
-
74
- const onPlus = () => {
75
- setQuantity((prev: any) => {
76
- if (prev === "") return 1;
77
- return prev + 1;
78
- });
79
- };
80
-
81
- const onMinus = () => {
82
- setQuantity((prev: any) => {
83
- if (prev <= 1) {
84
- return 1;
85
- }
86
- return prev - 1;
87
- });
88
- };
89
-
90
- const onShowKeyPad = () => {
91
- if (quantity === 1) {
92
- setQuantity(1);
93
- }
94
- setShowKeyPad(true);
95
- };
96
-
97
- return (
98
- <div className="flex flex-col gap-4 px-5 py-4">
99
- <div className="flex items-center justify-between">
100
- <button
101
- onClick={() => handleAddToCart(0)}
102
- style={{
103
- boxShadow: "0 1px 2px 0 rgba(228, 229, 231, 0.24)",
104
- }}
105
- className="w-12 aspect-square rounded-xl border border-stroke-disabled flex items-center justify-center"
106
- >
107
- <IcTrash />
108
- </button>
109
-
110
- <div className="flex items-center gap-2">
111
- <ButtonIcon
112
- onClick={onMinus}
113
- iconSrc={<IcSubtractLine />}
114
- className="rounded-full text-primary border-primary"
115
- />
116
-
117
- <input
118
- type="number"
119
- className="w-12 aspect-square text-center border-b-2 border-[--color-primary] outline-none"
120
- value={quantity}
121
- onChange={(e) => {
122
- const val = e.target.value;
123
- setQuantity(val === "" ? "" : Number(val));
124
- }}
125
- readOnly={false}
126
- onClick={onShowKeyPad}
127
- />
128
-
129
- <ButtonIcon
130
- onClick={onPlus}
131
- iconSrc={<IcPlus />}
132
- className="rounded-full text-white border-none bg-primary"
133
- />
134
- </div>
135
-
136
- <ButtonAction
137
- onClick={() => handleAddToCart(quantity)}
138
- className="w-fit button-primary text-white"
139
- text={isUpdate ? t("update") : t("add")}
140
- />
141
- </div>
142
-
143
- {/* {showKeyPad && isAndroid && (
144
- <SaleKeyPad
145
- onConfirm={onConfirm}
146
- onCancel={() => setShowKeyPad(false)}
147
- quantity={quantity}
148
- setQuantity={setQuantity}
149
- />
150
- )} */}
151
- </div>
152
- );
153
- };
154
-
155
- export default QuantityControl;
@@ -1,100 +0,0 @@
1
- import { useEffect, useRef, useState } from "react";
2
- import { toast } from "react-toastify";
3
-
4
- const numberKeys = [...Array(9).keys()].map((key) => String(key + 1));
5
-
6
- export const SaleKeyPad = ({
7
- onConfirm,
8
- onCancel,
9
- quantity,
10
- setQuantity,
11
- }: {
12
- onConfirm: (val: number) => void;
13
- quantity: number | string;
14
- setQuantity: (val: number) => void;
15
- onCancel: () => void;
16
- }) => {
17
- const [inputValue, setInputValue] = useState<string>("");
18
- const ref = useRef<HTMLDivElement>(null);
19
-
20
- const updateQuantity = (val: string) => {
21
- setInputValue(val);
22
- const num = val === "" ? 0 : Number(val);
23
- setQuantity(num);
24
- };
25
-
26
- const handlePress = (val: string) => updateQuantity(inputValue + val);
27
-
28
- const handleDelete = () => updateQuantity(inputValue.slice(0, -1));
29
-
30
- const handleConfirm = () => onConfirm(Number(quantity));
31
-
32
- useEffect(() => {
33
- ref.current?.scrollIntoView({ behavior: "smooth" });
34
- }, []);
35
-
36
- return (
37
- <div ref={ref} className="flex justify-center gap-2 h-full">
38
- <div className="grid grid-cols-3 gap-2 flex-1">
39
- {numberKeys.map((num) => (
40
- <button
41
- key={num}
42
- onClick={() => handlePress(num)}
43
- className="h-[50px] w-full rounded-xl border border-stroke-default bg-surface-default flex items-center justify-center"
44
- >
45
- <p className="text-sm text-text-primary tracking-[-0.14px] font-medium ">
46
- {num}
47
- </p>
48
- </button>
49
- ))}
50
-
51
- <button
52
- onClick={() => toast.info("Coming soon")}
53
- className="h-[50px] w-full rounded-xl border border-stroke-default bg-information flex items-center justify-center"
54
- >
55
- <p className="text-sm font-medium text-text-primary tracking-[-0.14px]">
56
- .
57
- </p>
58
- </button>
59
-
60
- <button
61
- onClick={() => handlePress("0")}
62
- className="h-[50px] w-full rounded-xl border border-stroke-default bg-surface-default flex items-center justify-center"
63
- >
64
- <p className="text-sm font-medium text-text-primary tracking-[-0.14px]">
65
- 0
66
- </p>
67
- </button>
68
-
69
- <button
70
- onClick={handleDelete}
71
- className="h-[50px] w-full rounded-xl border border-stroke-default bg-red-50 flex items-center justify-center"
72
- >
73
- <p className="text-sm font-medium text-colored-error tracking-[-0.14px]">
74
-
75
- </p>
76
- </button>
77
- </div>
78
-
79
- <div className="flex flex-col gap-2 w-[141px] self-stretch">
80
- <button
81
- onClick={onCancel}
82
- className="h-12 rounded-lg border border-stroke-disabled bg-white hover:bg-white"
83
- >
84
- <p className="font-bold text-sm leading-5 text-text-primary tracking-[-0.12px]">
85
- Huỷ
86
- </p>
87
- </button>
88
-
89
- <button
90
- onClick={handleConfirm}
91
- className="rounded-lg bg-brand-default flex-1"
92
- >
93
- <p className="text-sm font-bold leading-5 text-white tracking-[-0.12px]">
94
- Đồng ý
95
- </p>
96
- </button>
97
- </div>
98
- </div>
99
- );
100
- };
@@ -1,65 +0,0 @@
1
- import { VNCurrency } from "@components/common/header";
2
- import { QUERY_KEYS } from "@constants/query.constant";
3
- import { useQueryParams } from "@hooks/common/use-query-params";
4
- import { useOrder } from "@provider/pos-provider/order-provider";
5
- import { useCartStore } from "@store/states/cart.state";
6
- import { TProduct } from "@type/product/product";
7
- import { getKey } from "@utils/functions";
8
-
9
- type Props = {
10
- product: TProduct;
11
- setShowModal: (value: boolean) => void;
12
- };
13
-
14
- export const ProductItem = ({ product, setShowModal }: Props) => {
15
- const { changeProductQty } = useOrder();
16
- const { setActiveProduct } = useCartStore();
17
- const { getQuery } = useQueryParams();
18
- const orderId = getQuery(QUERY_KEYS.ORDER_ID);
19
-
20
- const onAddProductToCart = () => {
21
- if (!orderId) setShowModal(true);
22
-
23
- if (product.attributeLines && product.attributeLines?.length > 0) {
24
- setActiveProduct({ id: getKey(product), isFromCart: false });
25
- return;
26
- }
27
- changeProductQty({
28
- product: product,
29
- qty: 1,
30
- orderId: Number(orderId),
31
- });
32
- };
33
-
34
- return (
35
- <>
36
- <div
37
- className="bg-white rounded-lg h-fit overflow-hidden cursor-pointer border border-black/4"
38
- onClick={() => onAddProductToCart()}
39
- >
40
- <div className="relative">
41
- <img
42
- src={product.image_128}
43
- alt={product.name}
44
- className="w-full object-cover h-[81px] object-center z-0 relative"
45
- />
46
- <div
47
- className="z-10 absolute size-full px-2 py-1 bottom-0 left-0 flex items-end"
48
- style={{
49
- background:
50
- "linear-gradient(180deg, rgba(0, 0, 0, 0.20) 0%, rgba(0, 0, 0, 0.70) 100%)",
51
- }}
52
- >
53
- <p className="text-white text-sm font-medium">
54
- {product.display_name}
55
- </p>
56
- </div>
57
- </div>
58
- <p className="px-2 py-1 text-xs text-text-primary font-semibold">
59
- {product.lst_price.toLocaleString()}
60
- {VNCurrency}
61
- </p>
62
- </div>
63
- </>
64
- );
65
- };
@@ -1,43 +0,0 @@
1
- import ButtonAction from "@components/common/button-action";
2
- import ModalZoom from "@components/common/modal/modal-zoom";
3
- import { useOrder } from "@provider/pos-provider/order-provider";
4
- import { useTranslation } from "react-i18next";
5
-
6
- const CancelOrderConfirm = ({
7
- isOpen,
8
- onClose,
9
- }: {
10
- isOpen: boolean;
11
- onClose: () => void;
12
- }) => {
13
- const { t } = useTranslation();
14
- const { handleCancelOrder } = useOrder();
15
-
16
- return (
17
- <ModalZoom
18
- isOpen={isOpen}
19
- onClose={onClose}
20
- className="p-0 py-4 px-5"
21
- modalClassName="w-[50%]"
22
- title="Xác nhận hủy đơn hàng" //TODO
23
- footer={
24
- <div className="flex gap-2 justify-end p-4">
25
- <ButtonAction
26
- onClick={() => onClose()}
27
- text={t("cancel_button")}
28
- className="button-secondary w-full"
29
- />
30
- <ButtonAction
31
- onClick={() => handleCancelOrder()}
32
- text={t("confirm_button")}
33
- className="button-primary w-full"
34
- />
35
- </div>
36
- }
37
- >
38
- <p>Bạn có chắc muốn huỷ đơn hàng này không?</p>
39
- </ModalZoom>
40
- );
41
- };
42
-
43
- export default CancelOrderConfirm;
@@ -1,105 +0,0 @@
1
- import ModalZoom from "@components/common/modal/modal-zoom";
2
- import { QUERY_KEYS } from "@constants/query.constant";
3
- import { useQueryParams } from "@hooks/common/use-query-params";
4
- import { useKitchen } from "@provider/pos-provider/kitchen-provider";
5
- import { cn } from "@utils/functions";
6
- import { useMemo } from "react";
7
-
8
- type Props = {
9
- isOpen: boolean;
10
- onClose: () => void;
11
- };
12
-
13
- export const HistoryCall = (props: Props) => {
14
- const { isOpen, onClose } = props;
15
- const { getQuery } = useQueryParams();
16
- const orderId = getQuery(QUERY_KEYS.ORDER_ID);
17
- const { displayDataQueryResult } = useKitchen();
18
-
19
- const kitchenOrders: KitchenOrderType[] = useMemo(() => {
20
- const orders = displayDataQueryResult?.data?.orders
21
- ?.filter((item: any) => item?.pos_order_id === Number(orderId))
22
- ?.map((item: any) => {
23
- return {
24
- order_lines: item.orderlines,
25
- create_date: item.create_date,
26
- stage_name: displayDataQueryResult?.data?.stages?.find(
27
- (stage: any) => stage.id === item.stage_id
28
- )?.name,
29
- };
30
- });
31
- return orders;
32
- }, [displayDataQueryResult, orderId]);
33
-
34
- return (
35
- <ModalZoom
36
- isOpen={isOpen}
37
- onClose={onClose}
38
- className="p-0 py-4 px-5"
39
- modalClassName="w-[60%]"
40
- title={`Lịch sử gọi món`}
41
- >
42
- {kitchenOrders && kitchenOrders?.length > 0 ? (
43
- <div className="border border-stroke-disabled flex flex-col rounded-lg">
44
- {kitchenOrders?.map((order: KitchenOrderType, index: number) => {
45
- return (
46
- <div
47
- className={`flex flex-col text-text-primary font-medium ${
48
- index > 0 && "border-t border-stroke-disabled"
49
- }`}
50
- >
51
- <Cell
52
- text={order.create_date}
53
- className="text-sm font-semibold italic"
54
- />
55
- <div className="flex min-h-fit">
56
- <div className="flex flex-col flex-1">
57
- {order?.order_lines?.map((item: any, index: number) => (
58
- <div>
59
- <div className="flex border-t border-stroke-disabled">
60
- <Cell
61
- text={`x${item.product_quantity}`}
62
- className={`text-sm w-[100px] `}
63
- />
64
- <Cell
65
- text={item.product_name}
66
- className="text-sm flex-1 justify-start border-l border-stroke-disabled pl-5"
67
- />
68
- </div>
69
- </div>
70
- ))}
71
- </div>
72
- </div>
73
- </div>
74
- );
75
- })}
76
- </div>
77
- ) : (
78
- <p className="text-center py-10">Chưa có lịch sử gọi món</p>
79
- )}
80
- </ModalZoom>
81
- );
82
- };
83
-
84
- type CellProps = {
85
- text?: string;
86
- className?: string;
87
- children?: React.ReactNode;
88
- };
89
-
90
- const Cell = (props: CellProps) => {
91
- const { text, className, children } = props;
92
- return (
93
- <div
94
- className={cn("flex justify-center items-center h-11 w-full", className)}
95
- >
96
- {children ?? text}
97
- </div>
98
- );
99
- };
100
-
101
- type KitchenOrderType = {
102
- order_lines: any[];
103
- create_date: string;
104
- stage_name: string;
105
- };
@@ -1,116 +0,0 @@
1
- import FileCloseLineIcon from "@assets/icons/file-close-line-icon";
2
- import {
3
- IcChangeTable,
4
- IcHistoryCall,
5
- IcNote,
6
- } from "@assets/icons/helper-icon";
7
- import ModalZoom from "@components/common/modal/modal-zoom";
8
- import { useState } from "react";
9
- import { toast } from "react-toastify";
10
- import CancelOrderConfirm from "./cancel-order-confirm";
11
- import { HistoryCall } from "./history-call";
12
-
13
- type TProps = {
14
- isOpen: boolean;
15
- onClose: () => void;
16
- };
17
-
18
- enum EOrderHelper {
19
- CANCEL_ORDER = "cancel-order",
20
- CHANGE_TABLE = "change-table",
21
- HISTORY_CALL = "history-call",
22
- NOTE_ORDER = "note-order",
23
- }
24
-
25
- const OPTIONS = [
26
- {
27
- id: 1,
28
- label: "Lịch sử gọi món",
29
- value: EOrderHelper.HISTORY_CALL,
30
- icon: IcHistoryCall,
31
- },
32
- {
33
- id: 2,
34
- label: "Ghi chú đơn",
35
- value: EOrderHelper.NOTE_ORDER,
36
- icon: IcNote,
37
- },
38
- {
39
- id: 3,
40
- label: "Đổi bàn",
41
- value: EOrderHelper.CHANGE_TABLE,
42
- icon: IcChangeTable,
43
- },
44
- {
45
- id: 4,
46
- label: "Huỷ đơn",
47
- value: EOrderHelper.CANCEL_ORDER,
48
- icon: FileCloseLineIcon,
49
- },
50
- ];
51
-
52
- export const OrderHelperModal = ({ isOpen, onClose }: TProps) => {
53
- const [showConfirmCancelOrder, setShowConfirmCancelOrder] = useState(false);
54
- const [showHistoryCall, setHistoryCall] = useState(false);
55
-
56
- const onShowComingSoon = () => toast.info("Đang phát triển");
57
-
58
- const handleOptionClick = (value: EOrderHelper) => {
59
- switch (value) {
60
- case EOrderHelper.CANCEL_ORDER:
61
- setShowConfirmCancelOrder(true);
62
- onClose();
63
- break;
64
- case EOrderHelper.NOTE_ORDER:
65
- onShowComingSoon();
66
- break;
67
- case EOrderHelper.CHANGE_TABLE:
68
- onShowComingSoon();
69
- break;
70
- case EOrderHelper.HISTORY_CALL:
71
- setHistoryCall(true);
72
- onClose();
73
- break;
74
- default:
75
- break;
76
- }
77
- };
78
-
79
- return (
80
- <>
81
- <ModalZoom
82
- isOpen={isOpen}
83
- onClose={onClose}
84
- className="border-[0.5px] border-stroke-disabled p-2 bg-neutral-100-96 rounded-xl"
85
- modalClassName="w-[70%]"
86
- >
87
- <div className="grid grid-cols-2 gap-2 w-full">
88
- {OPTIONS.map((option) => (
89
- <button
90
- key={option.id}
91
- onClick={() => {
92
- handleOptionClick(option.value);
93
- }}
94
- className="flex flex-col items-center gap-4 w-full h-[189px] rounded-2xl bg-white justify-center text-colored-primary"
95
- >
96
- <option.icon />
97
- <span className="text-text-primary text-2xl font-semibold leading-8 tracking-[-0.24px]">
98
- {option.label}
99
- </span>
100
- </button>
101
- ))}
102
- </div>
103
- </ModalZoom>
104
-
105
- {showConfirmCancelOrder && (
106
- <CancelOrderConfirm
107
- isOpen={showConfirmCancelOrder}
108
- onClose={() => setShowConfirmCancelOrder(false)}
109
- />
110
- )}
111
- {showHistoryCall && (
112
- <HistoryCall isOpen onClose={() => setHistoryCall(false)} />
113
- )}
114
- </>
115
- );
116
- };
@@ -1,46 +0,0 @@
1
- // import { IcPlus, IcPrint } from "@assets/icons/breadcrumbs-icon"
2
- // import ButtonAction from "@components/common/button-action"
3
- // import { QUERY_KEYS } from "@constants/query.constant"
4
- // import { useQueryParams } from "@hooks/common/use-query-params"
5
- // import { useOrder } from "@provider/pos-provider/order-provider"
6
-
7
- // const Actions = ({
8
- // // handlePrintBase64,
9
- // handlePrintText,
10
- // setShowBill,
11
- // }: {
12
- // // handlePrintBase64: () => void
13
- // handlePrintText: () => void
14
- // setShowBill: (e: boolean) => void
15
- // }) => {
16
- // const { handleCreateOrder } = useOrder()
17
- // const { getQuery } = useQueryParams()
18
- // const tableId = getQuery(QUERY_KEYS.TABLE_ID)
19
- // const { updateQuery } = useQueryParams()
20
-
21
- // const onCreateNewOrder = async () => {
22
- // await handleCreateOrder(Number(tableId), (orderId: number) => {
23
- // updateQuery(QUERY_KEYS.ORDER_ID, orderId.toString())
24
- // setShowBill(false)
25
- // })
26
- // }
27
-
28
- // return (
29
- // <div className="flex items-center justify-center gap-2.5">
30
- // <ButtonAction
31
- // iconSrc={<IcPlus />}
32
- // onClick={onCreateNewOrder}
33
- // text="Tạo đơn mới"
34
- // className="button-primary"
35
- // />
36
- // <ButtonAction
37
- // iconSrc={<IcPrint />}
38
- // onClick={handlePrintText}
39
- // text="In hoá đơn"
40
- // className="button-secondary"
41
- // />
42
- // </div>
43
- // )
44
- // }
45
-
46
- // export default Actions