sme-pos-package 1.0.13 → 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 -10
  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,179 +0,0 @@
1
- import { EmptyState } from "@components/common/empty-state";
2
- import { useOrder } from "@provider/pos-provider/order-provider";
3
- import { LoadDataModel, useSale } from "@provider/pos-provider/sale-provider";
4
- import { TBasicOrder } from "@type/order";
5
- import { add7Hours, onFindTable } from "@utils/functions";
6
- import moment from "moment";
7
- import { useEffect, useMemo, useState } from "react";
8
- import OrderStatus from "./order-status";
9
-
10
- type Props = {
11
- orderData?: TBasicOrder[];
12
- handleClick: (order: any) => void;
13
- isLoading: boolean;
14
- };
15
-
16
- const TABLE_HEADERS = [
17
- "Ngày tạo",
18
- "Mã đơn hàng",
19
- "Số đơn hàng",
20
- "Bàn",
21
- "Nhân viên",
22
- "Tên khách hàng",
23
- "Trạng thái",
24
- "Tổng tiền",
25
- ];
26
-
27
- export default function OrderTable({
28
- orderData,
29
- handleClick,
30
- isLoading,
31
- }: Props) {
32
- const { getData, isModePosRestaurant } = useSale();
33
- const { onGetCurrentUser } = useOrder();
34
- const [userMap, setUserMap] = useState<Record<number, string>>({});
35
-
36
- const floors = getData(LoadDataModel.RESTAURANT_FLOOR);
37
- const tables = getData(LoadDataModel.RESTAURANT_TABLE);
38
- const partners = getData(LoadDataModel.RES_PARTNER);
39
-
40
- const tableHeader = useMemo(() => {
41
- if (isModePosRestaurant) return TABLE_HEADERS;
42
-
43
- return TABLE_HEADERS.filter((_, index) => index !== 2);
44
- }, [isModePosRestaurant]);
45
-
46
- useEffect(() => {
47
- if (!orderData?.length) return;
48
-
49
- const loadUsers = async () => {
50
- const result: Record<number, string> = {};
51
-
52
- for (const order of orderData) {
53
- const userId = order?.user_id;
54
-
55
- if (!result[userId]) {
56
- const matchedUser = await onGetCurrentUser({ userId });
57
- result[userId] = matchedUser ?? "Chưa xác định";
58
- }
59
- }
60
-
61
- setUserMap(result);
62
- };
63
-
64
- loadUsers();
65
- }, [orderData]);
66
-
67
- return (
68
- <div className="bg-white shadow-sm overflow-hidden">
69
- <div className="overflow-x-auto max-h-[600px] overflow-y-auto border-y border-stroke-disabled">
70
- <table className="min-w-full divide-y divide-stroke-disabled table-fixed">
71
- <thead className="bg-white sticky top-0 z-10 border-b border-stroke-disabled">
72
- <tr>
73
- {tableHeader.map((header, idx) => (
74
- <th
75
- key={idx}
76
- className="px-5 py-3 text-left text-sm font-semibold text-text-primary border-r border-stroke-disabled bg-white"
77
- >
78
- <div
79
- className={
80
- [isModePosRestaurant ? [5, 6] : 4, 5].includes(idx)
81
- ? "flex justify-end items-center"
82
- : ""
83
- }
84
- >
85
- {header}
86
- </div>
87
- </th>
88
- ))}
89
- </tr>
90
- </thead>
91
-
92
- {/* Body */}
93
- <tbody className="bg-white divide-y divide-stroke-disabled [&>tr]:h-11">
94
- {orderData?.length ? (
95
- orderData.map((order) => {
96
- const orderDateIn7Hours = add7Hours(order.create_date);
97
- const orderDateFormatted = moment(orderDateIn7Hours).format(
98
- "HH:mm:ss DD-MM-YYYY"
99
- );
100
-
101
- return (
102
- <tr
103
- key={order.id}
104
- className="hover:bg-gray-50 cursor-pointer text-sm text-text-primary font-medium leading-5 tracking-[-0.12px]"
105
- onClick={() => handleClick(order)}
106
- >
107
- <td className="px-5 text-text-disable text-sm border-r border-stroke-disabled leading-5 tracking-[-0.12px] italic">
108
- {orderDateFormatted}
109
- </td>
110
-
111
- <td className="px-5 border-r border-stroke-disabled">
112
- {order.pos_reference}
113
- </td>
114
-
115
- <td className="px-5 border-r border-stroke-disabled">
116
- {order.id}
117
- </td>
118
-
119
- {isModePosRestaurant && (
120
- <td className="px-5 border-r border-stroke-disabled">
121
- {onFindTable({
122
- order,
123
- tables,
124
- floors,
125
- })}
126
- </td>
127
- )}
128
-
129
- <td className="px-5 border-r border-stroke-disabled">
130
- {userMap[order.user_id]}
131
- </td>
132
-
133
- <td className="px-5 border-r border-stroke-disabled">
134
- {
135
- partners?.find(
136
- (item: any) => item.id === Number(order.partner_id)
137
- )?.name
138
- }
139
- </td>
140
-
141
- <td className="px-5 whitespace-nowrap border-r border-stroke-disabled">
142
- <div className="flex justify-end items-center">
143
- <OrderStatus status={order.state} />
144
- </div>
145
- </td>
146
-
147
- <td className="px-5 border-r border-stroke-disabled">
148
- <div className="flex justify-end items-center">
149
- {Number(order.amount_total).toLocaleString()} ₫
150
- </div>
151
- </td>
152
- </tr>
153
- );
154
- })
155
- ) : (
156
- <tr>
157
- <td
158
- colSpan={TABLE_HEADERS.length}
159
- className="text-center text-sm text-gray-500 py-6"
160
- >
161
- {isLoading ? (
162
- "Đang tải đơn hàng..."
163
- ) : (
164
- <EmptyState
165
- image="/assets/images/order-empty-state.png"
166
- imageAlt="empty-order"
167
- description="Chưa có đơn"
168
- imageClassName="size-[200px]"
169
- />
170
- )}
171
- </td>
172
- </tr>
173
- )}
174
- </tbody>
175
- </table>
176
- </div>
177
- </div>
178
- );
179
- }
@@ -1,48 +0,0 @@
1
- import { cn } from "@utils/functions";
2
-
3
- type TProps = {
4
- activeTab: string;
5
- onActiveTabChange: (tab: string) => void;
6
- onPageChange: (page: number) => void;
7
- onPageSizeChange: (pageSize: number) => void;
8
- tabs: { key: string; label: string }[];
9
- };
10
-
11
- const OrderTabs = ({
12
- activeTab,
13
- onActiveTabChange,
14
- tabs,
15
- onPageChange,
16
- onPageSizeChange,
17
- }: TProps) => {
18
- return (
19
- <div className="flex items-center justify-start">
20
- {tabs.map((tab) => (
21
- <button
22
- key={tab.key}
23
- className={cn("p-3 rounded-lg ", {
24
- "bg-surface-primary": activeTab === tab.key,
25
- })}
26
- onClick={() => {
27
- onActiveTabChange(tab.key);
28
- onPageChange(1);
29
- onPageSizeChange(10);
30
- }}
31
- >
32
- <span
33
- className={cn(
34
- "text-sm font-medium leading-5 text-secondary tracking-[-0.12px]",
35
- {
36
- "text-text-active": activeTab === tab.key,
37
- }
38
- )}
39
- >
40
- {tab.label}
41
- </span>
42
- </button>
43
- ))}
44
- </div>
45
- );
46
- };
47
-
48
- export default OrderTabs;
@@ -1,97 +0,0 @@
1
- import { QUERY_KEYS } from "@constants/query.constant";
2
- import { useQueryParams } from "@hooks/common/use-query-params";
3
- import { useOrder } from "@provider/pos-provider/order-provider";
4
- import { TProduct } from "@type/product/product";
5
- import { useEffect, useRef, useState } from "react";
6
-
7
- export const AddProductFromBarcode = ({
8
- productsData,
9
- }: {
10
- productsData: TProduct[];
11
- }) => {
12
- const { changeProductQty } = useOrder();
13
- const { getQuery } = useQueryParams();
14
-
15
- const inputRef = useRef<HTMLInputElement>(null);
16
- const orderId = getQuery(QUERY_KEYS.ORDER_ID);
17
-
18
- const [productBarcode, setProductBarCode] = useState("");
19
-
20
- const onClear = () => {
21
- setProductBarCode("");
22
-
23
- inputRef.current &&
24
- inputRef.current.value === "" &&
25
- inputRef.current.focus();
26
- };
27
-
28
- const handleAddToCart = async ({
29
- qty,
30
- product,
31
- }: {
32
- qty: number;
33
- product: TProduct;
34
- }) => {
35
- if (!product) return;
36
-
37
- try {
38
- await changeProductQty({
39
- product,
40
- qty,
41
- orderId: Number(orderId),
42
- });
43
- onClear();
44
- } catch (error) {
45
- console.log("error", error);
46
- }
47
- };
48
-
49
- const handleKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {
50
- const productMatched = productsData.find(
51
- (product: TProduct) => product.barcode == Number(productBarcode)
52
- );
53
-
54
- if (e.key === "Enter") {
55
- if (productMatched) {
56
- handleAddToCart({
57
- qty: 1,
58
- product: productMatched,
59
- });
60
- } else {
61
- onClear();
62
- }
63
- }
64
- };
65
-
66
- useEffect(() => {
67
- const input = inputRef.current;
68
-
69
- if (!input) return;
70
-
71
- input.focus();
72
-
73
- const handleBlur = () => input.focus();
74
-
75
- input.addEventListener("blur", handleBlur);
76
-
77
- return () => {
78
- input.removeEventListener("blur", handleBlur);
79
- };
80
- }, []);
81
-
82
- return (
83
- <input
84
- ref={inputRef}
85
- type="number"
86
- className="absolute w-12 aspect-square text-center border-b-2 border-brand-default outline-none opacity-0"
87
- onChange={(e) => {
88
- setProductBarCode(e.target.value);
89
- }}
90
- autoFocus
91
- value={productBarcode}
92
- onKeyDown={(e) => {
93
- handleKeyDown(e);
94
- }}
95
- />
96
- );
97
- };
@@ -1,81 +0,0 @@
1
- import { 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 { useKitchen } from "@provider/pos-provider/kitchen-provider";
6
- import { useOrderDetail } from "@provider/pos-provider/order-detail-provider";
7
- import { useOrder } from "@provider/pos-provider/order-provider";
8
- import { CartItemType } from "@store/states/cart.state";
9
- import { t } from "i18next";
10
- import { useMemo } from "react";
11
- import { toast } from "react-toastify";
12
-
13
- type Props = {
14
- cartItemsArr: CartItemType[];
15
- showPayment?: boolean;
16
- setShowPayment: (e: boolean) => void;
17
- };
18
-
19
- export const ActionLine = ({
20
- showPayment,
21
- cartItemsArr,
22
- setShowPayment,
23
- }: Props) => {
24
- const { taxAmount, totalAmount } = useOrderDetail();
25
- const { onProcessOrder } = useOrder();
26
- const { displayDataQueryResult, isPosMapKitchen } = useKitchen();
27
- const { getQuery } = useQueryParams();
28
-
29
- const orderId = getQuery(QUERY_KEYS.ORDER_ID);
30
- const refetchDisplayDataResult = displayDataQueryResult?.refetch;
31
-
32
- const onCallDish = async () => {
33
- if (!orderId) return;
34
- try {
35
- await onProcessOrder.mutateAsync(Number(orderId));
36
- refetchDisplayDataResult();
37
- toast.success(t("callDishSuccess"));
38
- } catch (error: any) {
39
- toast.error(error);
40
- }
41
- };
42
- const isNewLine = useMemo(() => {
43
- return cartItemsArr?.some((item: any) => !item.ordered);
44
- }, [cartItemsArr]);
45
-
46
- return (
47
- <div className="h-[56px] w-full flex text-text-btn">
48
- <div className="min-w-[60px] h-full flex items-center justify-center text-text-active bg-surface-primary">
49
- <IcPrint />
50
- </div>
51
- {showPayment ? (
52
- <ButtonAction
53
- onClick={() => setShowPayment(false)}
54
- className={`button-primary h-full border-l-0 border-b-0 border-t border-stroke-disabled rounded-none w-full !px-0`}
55
- text={t("back_dish")}
56
- />
57
- ) : (
58
- isPosMapKitchen && (
59
- <ButtonAction
60
- onClick={onCallDish}
61
- className={`button-primary !px-0 h-full border-l-0 border-b-0 border-t border-stroke-disabled rounded-none w-full`}
62
- text={t("call_dish")}
63
- disabled={!isNewLine}
64
- style={{
65
- background: "#0C66E4",
66
- color: "#fff",
67
- }}
68
- />
69
- )
70
- )}
71
- {!showPayment && (
72
- <ButtonAction
73
- disabled={taxAmount + totalAmount == 0}
74
- onClick={() => setShowPayment(true)}
75
- text={t("purchases")}
76
- className="button-primary h-full rounded-none w-full "
77
- />
78
- )}
79
- </div>
80
- );
81
- };
@@ -1,41 +0,0 @@
1
- import ButtonAction from "@components/common/button-action";
2
- import ModalZoom from "@components/common/modal/modal-zoom";
3
- import { useTranslation } from "react-i18next";
4
-
5
- const CancelOrderLineConfirm = ({
6
- onClose,
7
- onCancelOrderLine,
8
- }: {
9
- onClose: () => void;
10
- onCancelOrderLine: () => void;
11
- }) => {
12
- const { t } = useTranslation();
13
-
14
- return (
15
- <ModalZoom
16
- isOpen
17
- onClose={onClose}
18
- className="p-0 py-4 px-5"
19
- modalClassName="w-[50%]"
20
- title="Xác nhận hủy món" //TODO
21
- footer={
22
- <div className="flex gap-2 justify-end p-4">
23
- <ButtonAction
24
- onClick={() => onClose()}
25
- text={t("cancel_button")}
26
- className="button-secondary w-full"
27
- />
28
- <ButtonAction
29
- onClick={() => onCancelOrderLine()}
30
- text={t("confirm_button")}
31
- className="button-primary w-full"
32
- />
33
- </div>
34
- }
35
- >
36
- <p>Bạn có chắc muốn huỷ món hàng này không?</p>
37
- </ModalZoom>
38
- );
39
- };
40
-
41
- export default CancelOrderLineConfirm;
@@ -1,173 +0,0 @@
1
- import { IcPlus, IcSubtract } from "@assets/icons/common";
2
- import { IcKitchenOrder } from "@assets/icons/order-icon";
3
- import { VNCurrency } from "@components/common/header";
4
- import { QUERY_KEYS } from "@constants/query.constant";
5
- import { useQueryParams } from "@hooks/common/use-query-params";
6
- import { useKitchen } from "@provider/pos-provider/kitchen-provider";
7
- import {
8
- getTotalProductPrice,
9
- useOrder,
10
- } from "@provider/pos-provider/order-provider";
11
- import { CartItemType, useCartStore } from "@store/states/cart.state";
12
- import { getKey } from "@utils/functions";
13
- import { useMemo } from "react";
14
-
15
- const cartItemStatus = {
16
- ordered: {
17
- display_name: "Đã gọi",
18
- color: "#5946F9",
19
- backgroundColor: "#DCD5FF",
20
- border: "#5946F9",
21
- },
22
- ["non-ordered"]: {
23
- display_name: "Chưa gọi",
24
- color: "#666",
25
- backgroundColor: "#F6F6F6",
26
- border: "#E5E5E5",
27
- },
28
- ["not-preparing"]: {
29
- display_name: "Không chế biến",
30
- color: "#995E1F",
31
- backgroundColor: "rgba(153, 94, 31, 0.08)",
32
- border: "rgba(153, 94, 31, 0.20)",
33
- },
34
- };
35
-
36
- export const CartItem = ({
37
- item,
38
- setCancelOrder,
39
- }: {
40
- item: CartItemType;
41
- setCancelOrder: (value: CartItemType) => void;
42
- }) => {
43
- const { changeProductQty } = useOrder();
44
- const { setActiveProduct } = useCartStore();
45
- const { getQuery } = useQueryParams();
46
- const orderId = getQuery(QUERY_KEYS.ORDER_ID);
47
-
48
- const { displayDataQueryResult } = useKitchen();
49
-
50
- const status = useMemo(() => {
51
- const kitchenCategories =
52
- displayDataQueryResult?.data?.categories?.map(
53
- (category: any) => category.id
54
- ) || [];
55
- return !kitchenCategories.some((catId: number) =>
56
- item?.product?.pos_categ_ids?.includes(catId)
57
- )
58
- ? "not-preparing"
59
- : item.ordered
60
- ? "ordered"
61
- : "non-ordered";
62
- }, [displayDataQueryResult, item]);
63
-
64
- const onAddProductToCart = () => {
65
- changeProductQty({
66
- product: { ...item.product },
67
- qty: 1,
68
- orderId: Number(orderId),
69
- });
70
- };
71
-
72
- const onSubtractProductFromCart = () => {
73
- if (item.qty > 1)
74
- changeProductQty({
75
- product: { ...item.product },
76
- qty: -1,
77
- orderId: Number(orderId),
78
- });
79
- else {
80
- setCancelOrder(item);
81
- }
82
- };
83
-
84
- const attributeValue = useMemo(() => {
85
- const pickAttributeValue = item?.product?.pickAttributeValue;
86
- return pickAttributeValue?.filter((item) => item.value_string?.length > 0);
87
- }, [item?.product?.pickAttributeValue]);
88
-
89
- const onClickCartItem = () => {
90
- setActiveProduct({ id: getKey(item.product), isFromCart: true });
91
- };
92
- return (
93
- <div
94
- className="p-3 flex flex-col gap-2 border-b border-stroke-disabled cursor-pointer"
95
- onClick={() => onClickCartItem()}
96
- >
97
- <div className="flex justify-between gap-5">
98
- <div className="flex flex-col flex-1 gap-[6px]">
99
- <p>{item.product.name}</p>
100
- <div className="flex justify-between items-center">
101
- <div className="flex gap-4 items-center">
102
- {(item?.orderedNumber ?? 0) > 0 && (
103
- <div className="flex gap-1 items-center text-colored-primary">
104
- <IcKitchenOrder />
105
- <span className="text-sm font-medium">
106
- {item?.orderedNumber}
107
- </span>
108
- </div>
109
- )}
110
- <div
111
- className={` border rounded w-fit h-6 flex items-center text-xs p-2`}
112
- style={{
113
- borderColor: cartItemStatus[status]?.border,
114
- color: cartItemStatus[status]?.color,
115
- backgroundColor: cartItemStatus[status]?.backgroundColor,
116
- }}
117
- >
118
- {cartItemStatus[status].display_name}
119
- </div>
120
- </div>
121
- <p className="text-text-primary">
122
- {(getTotalProductPrice(item.product) * item.qty).toLocaleString()}{" "}
123
- {VNCurrency}
124
- </p>
125
- </div>
126
- </div>
127
- <div className="flex items-center gap-2">
128
- <div
129
- className={`size-10 cursor-pointer rounded-full border border-stroke-disabled flex justify-center items-center ${
130
- item.qty <= 1 ? "text-[#BDBDBD]" : "text-[#575757]"
131
- }`}
132
- onClick={(e) => {
133
- e.stopPropagation();
134
- onSubtractProductFromCart();
135
- }}
136
- >
137
- <IcSubtract />
138
- </div>
139
- <p>{item.qty}</p>
140
- <div
141
- className={`size-10 cursor-pointer rounded-full border border-stroke-disabled flex justify-center items-center text-[#575757]`}
142
- onClick={(e) => {
143
- e.stopPropagation();
144
- onAddProductToCart();
145
- }}
146
- >
147
- <IcPlus />
148
- </div>
149
- </div>
150
- </div>
151
- {attributeValue &&
152
- attributeValue?.length > 0 &&
153
- attributeValue.map((item) => (
154
- <div className="border-t border-dashed">
155
- <p className="text-xs pt-2 flex gap-1 items-center">
156
- <span className="text-tertiary font-semibold">
157
- {item?.name}:{" "}
158
- </span>
159
- <span className="font-medium">
160
- {item?.value_string?.map((item) => item?.name).join(", ")}
161
- </span>
162
- </p>
163
- </div>
164
- ))}
165
- {item.note && (
166
- <div className="border-t border-dashed text-xs pt-2">
167
- <span className="text-tertiary font-semibold">Ghi chú:</span>
168
- <span className="font-medium"> {item.note}</span>
169
- </div>
170
- )}
171
- </div>
172
- );
173
- };