sme-pos-package 1.0.7 → 1.0.9

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 (318) hide show
  1. package/dist/index.d.mts +37 -2
  2. package/dist/index.mjs +17 -104
  3. package/dist/index.mjs.map +1 -1
  4. package/dist/tailwind.preset.d.mts +27 -0
  5. package/dist/tailwind.preset.mjs +2 -0
  6. package/dist/tailwind.preset.mjs.map +1 -0
  7. package/package.json +18 -30
  8. package/public/assets/images/bank-logos.png +0 -0
  9. package/public/assets/images/banner1.png +0 -0
  10. package/public/assets/images/banner2.png +0 -0
  11. package/public/assets/images/banner3.png +0 -0
  12. package/public/assets/images/banner4.png +0 -0
  13. package/public/assets/images/cashier.svg +9 -0
  14. package/public/assets/images/empty-cart.png +0 -0
  15. package/public/assets/images/empty-table-state.png +0 -0
  16. package/public/assets/images/layout-display/left-layout.png +0 -0
  17. package/public/assets/images/layout-display/right-layout.png +0 -0
  18. package/public/assets/images/modal-illustration.png +0 -0
  19. package/public/assets/images/order-empty-state.png +0 -0
  20. package/public/assets/images/order.png +0 -0
  21. package/public/assets/images/payment-success-label.png +0 -0
  22. package/public/assets/images/table-empty.png +0 -0
  23. package/public/assets/images/take-away.png +0 -0
  24. package/public/assets/lottie/loading.json +1 -0
  25. package/public/assets/lottie/soft_pos.json +1 -0
  26. package/public/assets/lottie/success.json +1 -0
  27. package/public/config.json +27 -0
  28. package/public/env.json +17 -0
  29. package/src/animations/success.json +9730 -0
  30. package/src/assets/icons/breadcrumbs-icon.tsx +85 -0
  31. package/src/assets/icons/cart-icon.tsx +14 -0
  32. package/src/assets/icons/common.tsx +270 -0
  33. package/src/assets/icons/customer-view-icon.tsx +20 -0
  34. package/src/assets/icons/dining-table.tsx +34 -0
  35. package/src/assets/icons/edit-line-icon.tsx +18 -0
  36. package/src/assets/icons/emenu-icon.tsx +39 -0
  37. package/src/assets/icons/file-close-line-icon.tsx +18 -0
  38. package/src/assets/icons/helper-icon.tsx +84 -0
  39. package/src/assets/icons/home-gear-line-icon.tsx +18 -0
  40. package/src/assets/icons/kanban-icon.tsx +16 -0
  41. package/src/assets/icons/loading-icon.tsx +45 -0
  42. package/src/assets/icons/logout-box-line-icon.tsx +18 -0
  43. package/src/assets/icons/order-icon.tsx +92 -0
  44. package/src/assets/icons/payment-icon.tsx +429 -0
  45. package/src/assets/icons/pincode.tsx +196 -0
  46. package/src/assets/icons/pos-connect-icon.tsx +67 -0
  47. package/src/assets/icons/pos-device-icon.tsx +52 -0
  48. package/src/assets/icons/pos-icon.tsx +75 -0
  49. package/src/assets/icons/printer-line-icon.tsx +18 -0
  50. package/src/assets/icons/star-icon.tsx +174 -0
  51. package/src/assets/icons/table-icon.tsx +77 -0
  52. package/src/assets/icons/user-add-line-icon.tsx +33 -0
  53. package/src/assets/icons/user-icon.tsx +65 -0
  54. package/src/components/common/button-action.tsx +46 -0
  55. package/src/components/common/button-icon.tsx +23 -0
  56. package/src/components/common/dropdown/index.tsx +79 -0
  57. package/src/components/common/empty-state.tsx +60 -0
  58. package/src/components/common/header/index.tsx +89 -0
  59. package/src/components/common/header/tabs.tsx +119 -0
  60. package/src/components/common/image.tsx +20 -0
  61. package/src/components/common/input/index.tsx +55 -0
  62. package/src/components/common/input/radio-group.tsx +75 -0
  63. package/src/components/common/input/text-area.tsx +28 -0
  64. package/src/components/common/modal/delete-confirm-modal-container.tsx +65 -0
  65. package/src/components/common/modal/index.ts +2 -0
  66. package/src/components/common/modal/modal-direction.tsx +125 -0
  67. package/src/components/common/modal/modal-header.tsx +37 -0
  68. package/src/components/common/modal/modal-wrapper.tsx +56 -0
  69. package/src/components/common/modal/modal-zoom.tsx +61 -0
  70. package/src/components/common/pagination.tsx +95 -0
  71. package/src/components/common/refresh-button.tsx +28 -0
  72. package/src/components/common/search-bar.tsx +27 -0
  73. package/src/components/common/search.tsx +59 -0
  74. package/src/components/common/skeleton.tsx +7 -0
  75. package/src/components/common/tabs-layout.tsx +98 -0
  76. package/src/components/common/use-check-session.tsx +19 -0
  77. package/src/components/customer-management/add-customer/add-customer-drawer.tsx +286 -0
  78. package/src/components/customer-management/add-customer/address-select.tsx +51 -0
  79. package/src/components/customer-management/choose-customer-drawer.tsx +177 -0
  80. package/src/components/customer-management/customer-info-drawer.tsx +166 -0
  81. package/src/components/customer-management/customer-no-data.tsx +18 -0
  82. package/src/components/emenu/emenu-qr-code.tsx +59 -0
  83. package/src/components/emenu/menu-link.tsx +67 -0
  84. package/src/components/index.ts +8 -0
  85. package/src/components/kanban-template/kitchen-template.tsx +60 -0
  86. package/src/components/kanban-template/pos-order-template.tsx +77 -0
  87. package/src/components/kanban-template/pos-template.tsx +170 -0
  88. package/src/components/kitchen-management/change-status-confirm-modal.tsx +61 -0
  89. package/src/components/kitchen-management/index.ts +1 -0
  90. package/src/components/kitchen-management/kitchen-order/index.tsx +153 -0
  91. package/src/components/kitchen-management/kitchen-order/line.tsx +78 -0
  92. package/src/components/kitchen-management/kitchen-order/state.tsx +52 -0
  93. package/src/components/kitchen-management/kitchen-status.tsx +69 -0
  94. package/src/components/kitchen-management/orders-kitchen-management.tsx +113 -0
  95. package/src/components/order-management/index.tsx +128 -0
  96. package/src/components/order-management/order-actions.tsx +46 -0
  97. package/src/components/order-management/order-detail/header.tsx +37 -0
  98. package/src/components/order-management/order-detail/index.ts +3 -0
  99. package/src/components/order-management/order-detail/information.tsx +96 -0
  100. package/src/components/order-management/order-detail/order-detail.tsx +84 -0
  101. package/src/components/order-management/order-detail/order-line.tsx +56 -0
  102. package/src/components/order-management/order-detail/summary.tsx +221 -0
  103. package/src/components/order-management/order-header.tsx +113 -0
  104. package/src/components/order-management/order-pagination.tsx +49 -0
  105. package/src/components/order-management/order-status.tsx +58 -0
  106. package/src/components/order-management/order-table.tsx +179 -0
  107. package/src/components/order-management/order-tabs.tsx +48 -0
  108. package/src/components/pos-management/add-product-from-barcode/index.tsx +97 -0
  109. package/src/components/pos-management/cart-content/action-line.tsx +81 -0
  110. package/src/components/pos-management/cart-content/cancel-order-line-modal.tsx +41 -0
  111. package/src/components/pos-management/cart-content/cart-item.tsx +173 -0
  112. package/src/components/pos-management/cart-content/cart-items.tsx +130 -0
  113. package/src/components/pos-management/cart-content/draft-orders/draft-order-line.tsx +67 -0
  114. package/src/components/pos-management/cart-content/draft-orders/index.tsx +40 -0
  115. package/src/components/pos-management/cart-content/edit-cart-modal.tsx +11 -0
  116. package/src/components/pos-management/cart-content/index.tsx +260 -0
  117. package/src/components/pos-management/cart-content/no-select-order.tsx +26 -0
  118. package/src/components/pos-management/cart-content/order-info/customer-info.tsx +53 -0
  119. package/src/components/pos-management/cart-content/order-info/index.tsx +109 -0
  120. package/src/components/pos-management/cart-content/order-total.tsx +36 -0
  121. package/src/components/pos-management/cart-content/orders-line.tsx +72 -0
  122. package/src/components/pos-management/menu-content/category-tab.tsx +38 -0
  123. package/src/components/pos-management/menu-content/create-order-modal.tsx +65 -0
  124. package/src/components/pos-management/menu-content/product-content.tsx +93 -0
  125. package/src/components/pos-management/menu-content/product-detail/info.tsx +28 -0
  126. package/src/components/pos-management/menu-content/product-detail/modal.tsx +148 -0
  127. package/src/components/pos-management/menu-content/product-detail/option.tsx +87 -0
  128. package/src/components/pos-management/menu-content/product-detail/quantity-control.tsx +155 -0
  129. package/src/components/pos-management/menu-content/product-detail/sale-keypad.tsx +100 -0
  130. package/src/components/pos-management/menu-content/product-item.tsx +65 -0
  131. package/src/components/pos-management/order-helper/cancel-order-confirm.tsx +43 -0
  132. package/src/components/pos-management/order-helper/history-call.tsx +105 -0
  133. package/src/components/pos-management/order-helper/order-helper-modal.tsx +116 -0
  134. package/src/components/pos-management/payment-content/bill/actions.tsx +46 -0
  135. package/src/components/pos-management/payment-content/bill/content.tsx +207 -0
  136. package/src/components/pos-management/payment-content/bill/index.tsx +18 -0
  137. package/src/components/pos-management/payment-content/card-payment/index.tsx +124 -0
  138. package/src/components/pos-management/payment-content/card-payment/pos-payment/pos-connect.tsx +183 -0
  139. package/src/components/pos-management/payment-content/card-payment/pos-payment/qr-connect.tsx +185 -0
  140. package/src/components/pos-management/payment-content/card-payment/waiting-for-payment-pos-modal.tsx +37 -0
  141. package/src/components/pos-management/payment-content/cash-payment/index.tsx +216 -0
  142. package/src/components/pos-management/payment-content/index.tsx +70 -0
  143. package/src/components/pos-management/payment-content/payment-info.tsx +67 -0
  144. package/src/components/pos-management/payment-content/payment-layout.tsx +16 -0
  145. package/src/components/pos-management/payment-content/payment-method-cards.tsx +99 -0
  146. package/src/components/pos-management/payment-content/qr-payment/index.tsx +118 -0
  147. package/src/components/pos-management/payment-content/qr-payment/qr_code.js +29 -0
  148. package/src/components/pos-management/payment-content/qr-payment/vietqr.js +436 -0
  149. package/src/components/pos-management/payment-content/session-close-modal.tsx +35 -0
  150. package/src/components/pos-management/payment-content/soft-pos-payment/index.tsx +48 -0
  151. package/src/components/pos-management/pos-helpers/back-confirm.tsx +45 -0
  152. package/src/components/pos-management/pos-helpers/index.tsx +135 -0
  153. package/src/components/pos-management/pos-helpers/layout-display-modal.tsx +99 -0
  154. package/src/components/pos-management/search.tsx +48 -0
  155. package/src/components/pos-management/table-content/filtered-tables.tsx +59 -0
  156. package/src/components/pos-management/table-content/floor-tabs.tsx +65 -0
  157. package/src/components/pos-management/table-content/index.tsx +76 -0
  158. package/src/components/pos-management/table-content/table-item.tsx +127 -0
  159. package/src/components/pos-management/table-content/tables.tsx +96 -0
  160. package/src/components/restaurant-management/add-floor-modal.tsx +133 -0
  161. package/src/components/restaurant-management/add-table-modal.tsx +198 -0
  162. package/src/components/restaurant-management/delete-floor-confirm-modal.tsx +42 -0
  163. package/src/components/restaurant-management/delete-table-confirm-modal.tsx +51 -0
  164. package/src/components/restaurant-management/header.tsx +22 -0
  165. package/src/components/restaurant-management/index.tsx +54 -0
  166. package/src/components/restaurant-management/left-side.tsx +51 -0
  167. package/src/components/restaurant-management/right-side.tsx +179 -0
  168. package/src/components/restaurant-management/table-empty.tsx +43 -0
  169. package/src/components/session-management/close-session-modal/actions.tsx +45 -0
  170. package/src/components/session-management/close-session-modal/close-session-confirm.tsx +157 -0
  171. package/src/components/session-management/close-session-modal/close-session-ticket.tsx +218 -0
  172. package/src/components/session-management/close-session-modal/container.tsx +25 -0
  173. package/src/components/session-management/close-session-modal/draft-orders-confirm.tsx +53 -0
  174. package/src/components/session-management/close-session-modal/draft-orders-summary.tsx +82 -0
  175. package/src/components/session-management/close-session-modal/draft-orders.tsx +34 -0
  176. package/src/components/session-management/close-session-modal/index.tsx +35 -0
  177. package/src/components/session-management/close-session-modal/order/index.ts +1 -0
  178. package/src/components/session-management/close-session-modal/order/order-line.tsx +64 -0
  179. package/src/components/session-management/close-session-modal/order/orders-in-draft.tsx +31 -0
  180. package/src/components/session-management/close-session-modal/session-summary.tsx +165 -0
  181. package/src/components/session-management/index.ts +1 -0
  182. package/src/components/session-management/open-shift/index.tsx +172 -0
  183. package/src/components/table-management/index.tsx +0 -0
  184. package/src/constants/api/index.ts +1 -0
  185. package/src/constants/headers.constant.tsx +24 -0
  186. package/src/constants/index.ts +1 -0
  187. package/src/constants/language.store.ts +21 -0
  188. package/src/constants/methods.constant.ts +10 -0
  189. package/src/constants/order-state.ts +8 -0
  190. package/src/constants/payment-color.constant.ts +26 -0
  191. package/src/constants/query.constant.ts +14 -0
  192. package/src/constants/routes.constants.ts +23 -0
  193. package/src/constants/template-name.constant.ts +9 -0
  194. package/src/hooks/bill/use-get-bill-information.ts +49 -0
  195. package/src/hooks/bill/use-print-bill.tsx +0 -0
  196. package/src/hooks/common/load-env-config.ts +98 -0
  197. package/src/hooks/common/use-back.ts +13 -0
  198. package/src/hooks/common/use-broadcast.ts +22 -0
  199. package/src/hooks/common/use-click-outside.ts +58 -0
  200. package/src/hooks/common/use-get-base64-photo.ts +71 -0
  201. package/src/hooks/common/use-get-query.ts +25 -0
  202. package/src/hooks/common/use-pos.ts +21 -0
  203. package/src/hooks/common/use-query-params.ts +89 -0
  204. package/src/hooks/common/use-speech.ts +36 -0
  205. package/src/hooks/customer/use-customer-provider.ts +247 -0
  206. package/src/hooks/floor/use-floor-provider.ts +172 -0
  207. package/src/hooks/kitchen/use-kitchen-provider.ts +80 -0
  208. package/src/hooks/order/use-get-point-reward.ts +50 -0
  209. package/src/hooks/order/use-loop-fetch-order.ts +30 -0
  210. package/src/hooks/order/use-order-items.ts +61 -0
  211. package/src/hooks/order/use-orders.ts +76 -0
  212. package/src/hooks/payment/use-payment-provider.ts +221 -0
  213. package/src/hooks/product/use-product-provider.ts +87 -0
  214. package/src/hooks/session/use-check-session.tsx +19 -0
  215. package/src/hooks/session/use-session-provider.ts +79 -0
  216. package/src/hooks/table/use-pos-table-provider.ts +193 -0
  217. package/src/index.css +5 -0
  218. package/src/index.ts +10 -0
  219. package/src/layouts/common.tsx +15 -0
  220. package/src/layouts/index.ts +4 -0
  221. package/src/layouts/pos-layout.tsx +33 -0
  222. package/src/layouts/pos-order-layout.tsx +43 -0
  223. package/src/layouts/sale-layout.tsx +25 -0
  224. package/src/locales/en.json +394 -0
  225. package/src/locales/vi.json +400 -0
  226. package/src/pages/index.ts +4 -0
  227. package/src/pages/login/index.tsx +128 -0
  228. package/src/pages/pincode/index.tsx +198 -0
  229. package/src/pages/pos/kitchen-management/layout.tsx +18 -0
  230. package/src/pages/pos/management-floor/index.tsx +7 -0
  231. package/src/pages/pos/management-order/index.tsx +7 -0
  232. package/src/pages/pos/management-order/order-detail/index.tsx +7 -0
  233. package/src/pages/pos/management-table/index.tsx +0 -0
  234. package/src/pages/pos/payment-success/index.tsx +75 -0
  235. package/src/provider/app-provider.tsx +56 -0
  236. package/src/provider/fallback/custom-error.tsx +26 -0
  237. package/src/provider/main-provider.tsx +41 -0
  238. package/src/provider/meta-provider.tsx +72 -0
  239. package/src/provider/modal-provider.tsx +48 -0
  240. package/src/provider/notification-provider.tsx +64 -0
  241. package/src/provider/pos-provider/close-session-provider/index.tsx +207 -0
  242. package/src/provider/pos-provider/customer-provider/index.tsx +30 -0
  243. package/src/provider/pos-provider/floor-provider/index.tsx +39 -0
  244. package/src/provider/pos-provider/index.ts +6 -0
  245. package/src/provider/pos-provider/kitchen-provider/index.tsx +30 -0
  246. package/src/provider/pos-provider/order-detail-provider/index.tsx +233 -0
  247. package/src/provider/pos-provider/order-provider/index.tsx +803 -0
  248. package/src/provider/pos-provider/payment-provider/index.tsx +30 -0
  249. package/src/provider/pos-provider/product-provider/index.tsx +30 -0
  250. package/src/provider/pos-provider/sale-provider/index.tsx +168 -0
  251. package/src/provider/pos-provider/session-provider/index.tsx +30 -0
  252. package/src/provider/pos-provider/socket-provider/index.tsx +118 -0
  253. package/src/provider/pos-provider/table-provider/index.tsx +30 -0
  254. package/src/provider/public-provider.tsx +104 -0
  255. package/src/provider/use-session-provider.ts +79 -0
  256. package/src/router/app-router.tsx +38 -0
  257. package/src/router/index.tsx +26 -0
  258. package/src/router/pos-route.tsx +75 -0
  259. package/src/router/protected-route.tsx +16 -0
  260. package/src/router/public-route.tsx +11 -0
  261. package/src/store/header/index.ts +21 -0
  262. package/src/store/session/index.ts +25 -0
  263. package/src/store/states/cart.state.ts +135 -0
  264. package/src/store/states/close-session.state.ts +20 -0
  265. package/src/store/states/customer.state.ts +19 -0
  266. package/src/store/states/payment.state.ts +14 -0
  267. package/src/styles/base.css +212 -0
  268. package/src/styles/common.css +65 -0
  269. package/src/styles/lib/tailwind.css +0 -0
  270. package/src/styles/lib/tailwind.theme.css +34 -0
  271. package/src/styles/loading.css +72 -0
  272. package/src/styles/main.css +5 -0
  273. package/src/styles/refreshing-content.css +55 -0
  274. package/src/styles/text.css +44 -0
  275. package/src/types/account.ts +61 -0
  276. package/src/types/branch.ts +6 -0
  277. package/src/types/category.ts +13 -0
  278. package/src/types/common.ts +4 -0
  279. package/src/types/customer.ts +52 -0
  280. package/src/types/dashboard.ts +18 -0
  281. package/src/types/edc.ts +37 -0
  282. package/src/types/export-e-invoice.ts +17 -0
  283. package/src/types/filter.d.ts +12 -0
  284. package/src/types/floor/floor.ts +16 -0
  285. package/src/types/floor.d.ts +36 -0
  286. package/src/types/index.ts +127 -0
  287. package/src/types/invoice.ts +32 -0
  288. package/src/types/modal.ts +15 -0
  289. package/src/types/notification.ts +12 -0
  290. package/src/types/order.ts +182 -0
  291. package/src/types/payment.ts +44 -0
  292. package/src/types/product/product.ts +47 -0
  293. package/src/types/product.ts +137 -0
  294. package/src/types/provider-info.d.ts +14 -0
  295. package/src/types/qr.d.ts +25 -0
  296. package/src/types/report.d.ts +43 -0
  297. package/src/types/sale.d.ts +68 -0
  298. package/src/types/search.d.ts +7 -0
  299. package/src/types/session.d.ts +30 -0
  300. package/src/types/shop-qr.d.ts +89 -0
  301. package/src/types/staff.d.ts +35 -0
  302. package/src/types/store.d.ts +25 -0
  303. package/src/types/table.d.ts +57 -0
  304. package/src/utils/close-session-ticket.tsx +129 -0
  305. package/src/utils/functions.ts +299 -0
  306. package/src/utils/i18n.ts +25 -0
  307. package/src/utils/pos/bill.ts +156 -0
  308. package/src/utils/pos/convert-order.ts +58 -0
  309. package/src/utils/pos/helpers.ts +48 -0
  310. package/src/utils/pos/session.ts +44 -0
  311. package/src/utils/storages/index.ts +1 -0
  312. package/src/utils/storages/local-storage.ts +72 -0
  313. package/tailwind.preset.ts +25 -0
  314. package/tsconfig.json +30 -0
  315. package/tsup.config.ts +30 -0
  316. package/dist/index.d.ts +0 -58
  317. package/dist/index.js +0 -145
  318. package/dist/index.js.map +0 -1
@@ -0,0 +1,75 @@
1
+ import { ProductContent, TableContent } from "@components/index";
2
+ import CommonLayout from "@layouts/common";
3
+ import PosLayout from "@layouts/pos-layout";
4
+ import PosOrderLayout from "@layouts/pos-order-layout";
5
+ import SaleLayout from "@layouts/sale-layout";
6
+ import {
7
+ ManagementFloorsPage,
8
+ ManagementOrderPage,
9
+ PaymentSuccess,
10
+ } from "@pages/index";
11
+ import OrderDetailPage from "@pages/pos/management-order/order-detail";
12
+ import { BrowserRouter, MemoryRouter, Route } from "react-router-dom";
13
+ import "../utils/i18n";
14
+ import POSPath from "@constants/routes.constants";
15
+
16
+ export type SaleAppProps = {
17
+ mode?: "standalone" | "embedded";
18
+ basePath?: string;
19
+ };
20
+
21
+ export const POSRoutes = ({
22
+ mode = "embedded",
23
+ basePath = "/sale",
24
+ }: SaleAppProps) => {
25
+ const Router = mode === "standalone" ? BrowserRouter : MemoryRouter;
26
+ return (
27
+ <Router basename={mode === "standalone" ? undefined : basePath}>
28
+ <Route path="" element={<PosLayout />}>
29
+ <Route
30
+ path={POSPath.MANAGEMENT_FLOOR}
31
+ element={<ManagementFloorsPage />}
32
+ />
33
+
34
+ <Route path={POSPath.POS} element={<SaleLayout />}>
35
+ <Route path="" element={<CommonLayout />}>
36
+ <Route path="" element={<PosOrderLayout />}>
37
+ <Route path={POSPath.TABLES} element={<TableContent />} />
38
+ <Route path={POSPath.MENUS} element={<ProductContent />} />
39
+ </Route>
40
+ <Route path={POSPath.ORDERS} element={<ManagementOrderPage />} />
41
+ </Route>
42
+ <Route path={POSPath.ORDER_DETAIL} element={<OrderDetailPage />} />
43
+
44
+ <Route path={POSPath.SUCCESS} element={<PaymentSuccess />} />
45
+ </Route>
46
+ </Route>
47
+ </Router>
48
+ );
49
+ };
50
+
51
+ export function createPOSRoutes() {
52
+ return (
53
+ <Route path="" element={<PosLayout />}>
54
+ <Route
55
+ path={POSPath.MANAGEMENT_FLOOR}
56
+ element={<ManagementFloorsPage />}
57
+ />
58
+
59
+ <Route path={POSPath.POS} element={<SaleLayout />}>
60
+ <Route path="" element={<CommonLayout />}>
61
+ <Route path="" element={<PosOrderLayout />}>
62
+ <Route path={POSPath.TABLES} element={<TableContent />} />
63
+ <Route path={POSPath.MENUS} element={<ProductContent />} />
64
+ </Route>
65
+ <Route path={POSPath.ORDERS} element={<ManagementOrderPage />} />
66
+ </Route>
67
+ <Route path={POSPath.ORDER_DETAIL} element={<OrderDetailPage />} />
68
+
69
+ <Route path={POSPath.SUCCESS} element={<PaymentSuccess />} />
70
+ </Route>
71
+ </Route>
72
+ );
73
+ }
74
+
75
+ export default createPOSRoutes;
@@ -0,0 +1,16 @@
1
+ import { Navigate, Outlet } from "react-router-dom";
2
+ import { ROUTES } from "../constants/routes.constants";
3
+ import { localStorageUtils } from "../utils/storages";
4
+ import PosAppProvider from "@provider/app-provider";
5
+
6
+ export default function ProtectedRoute() {
7
+ const accessToken = localStorageUtils.getAccessToken();
8
+
9
+ return accessToken ? (
10
+ <PosAppProvider>
11
+ <Outlet />
12
+ </PosAppProvider>
13
+ ) : (
14
+ <Navigate to={ROUTES.login} replace />
15
+ );
16
+ }
@@ -0,0 +1,11 @@
1
+ import { ROUTES } from "@constants/routes.constants";
2
+ import { localStorageUtils } from "@utils/storages";
3
+ import { Navigate, Outlet } from "react-router-dom";
4
+
5
+ export default function PublicRoute() {
6
+ const accessToken = localStorageUtils.getAccessToken();
7
+ const storedParams = sessionStorage.getItem("oauth_redirect_params");
8
+ const parsedParams = storedParams ? JSON.parse(storedParams) : null;
9
+ const validCondition = accessToken && !parsedParams?.redirect_uri;
10
+ return validCondition ? <Navigate to={ROUTES.pinCode} replace /> : <Outlet />;
11
+ }
@@ -0,0 +1,21 @@
1
+ import { languages, type ILanguage } from "@constants/language.store"
2
+ import { localStorageUtils } from "@utils/storages"
3
+ import { create } from "zustand"
4
+
5
+ type StateAction = {
6
+ selectedLang: ILanguage
7
+ layoutDisplay: "left" | "right"
8
+ setSelectedLang: (selectedLang: ILanguage) => void
9
+ setLayoutDisplay: (layoutDisplay: "left" | "right") => void
10
+ }
11
+
12
+ const useHeaderStore = create<StateAction>((set) => ({
13
+ selectedLang: languages[0],
14
+ layoutDisplay: localStorageUtils.getLayoutDisplay() || "left",
15
+ setSelectedLang: (selectedLang: ILanguage) =>
16
+ set(() => ({ selectedLang: selectedLang })),
17
+ setLayoutDisplay: (layoutDisplay: "left" | "right") =>
18
+ set(() => ({ layoutDisplay: layoutDisplay })),
19
+ }))
20
+
21
+ export default useHeaderStore
@@ -0,0 +1,25 @@
1
+ import { create } from "zustand";
2
+
3
+ type TState = {
4
+ step: number;
5
+ sessionConfirmParams: {
6
+ cashCount: number;
7
+ note: string;
8
+ };
9
+ };
10
+
11
+ type TActions = {
12
+ setStep: (step: number) => void;
13
+ setSessionConfirmParams: (params: TState["sessionConfirmParams"]) => void;
14
+ };
15
+
16
+ export const useSessionStore = create<TState & TActions>((set) => ({
17
+ step: 0,
18
+ setStep: (step: number) => set({ step }),
19
+ sessionConfirmParams: {
20
+ cashCount: 0,
21
+ note: "",
22
+ },
23
+ setSessionConfirmParams: (params: TState["sessionConfirmParams"]) =>
24
+ set({ sessionConfirmParams: params }),
25
+ }));
@@ -0,0 +1,135 @@
1
+ import { getTotalProductPrice } from "@provider/pos-provider/order-provider";
2
+ import { TProduct } from "@type/product/product";
3
+ import { getKey } from "@utils/functions";
4
+ import { create } from "zustand";
5
+
6
+ export type CartItemType = {
7
+ product: TProduct;
8
+ qty: number;
9
+ note?: string;
10
+ lineId?: number[];
11
+ orderId?: number;
12
+ ordered?: boolean;
13
+ orderedNumber?: number;
14
+ subTotal?: number;
15
+ inchTotal?: number;
16
+ };
17
+
18
+ type State = {
19
+ cartItems: Record<string, CartItemType>;
20
+ activeProduct: ActiveProductType;
21
+ };
22
+
23
+ type ActiveProductType = {
24
+ id: string;
25
+ isFromCart: boolean;
26
+ };
27
+
28
+ type Actions = {
29
+ add: (value: CartItemType) => void;
30
+ addList: (value: CartItemType[]) => void;
31
+ inc: (productId: string, qty?: number) => void;
32
+ dec: (value: string, qty?: number, lineId?: number[]) => void;
33
+ remove: (productId: string) => void;
34
+ updateQty: (productId: string, qty: number) => void;
35
+ clear: () => void;
36
+ setActiveProduct: (val: ActiveProductType) => void;
37
+ };
38
+
39
+ export const useCartStore = create<State & Actions>()((set) => ({
40
+ cartItems: {},
41
+ activeProduct: { id: "", isFromCart: false },
42
+ add: ({ product, qty = 1, lineId }) =>
43
+ set((state) => ({
44
+ cartItems: {
45
+ ...state.cartItems,
46
+ [getKey(product)]: {
47
+ product,
48
+ qty: (state.cartItems[getKey(product)]?.qty ?? 0) + qty,
49
+ lineId,
50
+ subTotal: getTotalProductPrice(product) * qty,
51
+ inchTotal:
52
+ Number(
53
+ (
54
+ getTotalProductPrice(product) *
55
+ (1 + product.tax * 0.01)
56
+ ).toFixed(2)
57
+ ) * qty,
58
+ },
59
+ },
60
+ })),
61
+ addList: (items) =>
62
+ set((state) => ({
63
+ cartItems: {
64
+ ...state.cartItems,
65
+ ...items.reduce<Record<string, CartItemType>>((acc, item) => {
66
+ return {
67
+ ...acc,
68
+ [getKey(item.product)]: {
69
+ ...item,
70
+ qty: (acc?.[getKey(item.product)]?.qty ?? 0) + item.qty,
71
+ lineId: item.lineId
72
+ ? [
73
+ ...(acc?.[getKey(item.product)]?.lineId ?? []),
74
+ item.lineId?.[0],
75
+ ]
76
+ : acc?.[getKey(item.product)]?.lineId,
77
+ },
78
+ };
79
+ }, {}),
80
+ },
81
+ })),
82
+ inc: (productId, qty = 1) =>
83
+ set((state) => ({
84
+ cartItems: {
85
+ ...state.cartItems,
86
+ [productId]: {
87
+ ...state.cartItems[productId],
88
+ qty: state.cartItems[productId].qty + qty,
89
+ },
90
+ },
91
+ })),
92
+ dec: (productId, qty = 1, lineId) =>
93
+ set((state) => {
94
+ const currentQty = state.cartItems[productId].qty - qty;
95
+ if (currentQty <= 0) {
96
+ const { [productId]: removed, ...remainingItems } = state.cartItems;
97
+ return {
98
+ cartItems: {
99
+ ...remainingItems,
100
+ [productId]: {
101
+ ...state.cartItems[productId],
102
+ lineId,
103
+ },
104
+ },
105
+ };
106
+ }
107
+ return {
108
+ cartItems: {
109
+ ...state.cartItems,
110
+ [productId]: {
111
+ ...state.cartItems[productId],
112
+ qty: currentQty,
113
+ lineId,
114
+ },
115
+ },
116
+ };
117
+ }),
118
+ remove: (productId) =>
119
+ set((state) => {
120
+ const { [productId]: removed, ...remainingItems } = state.cartItems;
121
+ return { cartItems: remainingItems };
122
+ }),
123
+ updateQty: (productId, qty) =>
124
+ set((state) => ({
125
+ cartItems: {
126
+ ...state.cartItems,
127
+ [productId]: {
128
+ ...state.cartItems[productId],
129
+ qty,
130
+ },
131
+ },
132
+ })),
133
+ clear: () => set({ cartItems: {} }),
134
+ setActiveProduct: (val: ActiveProductType) => set({ activeProduct: val }),
135
+ }));
@@ -0,0 +1,20 @@
1
+ import { create } from "zustand";
2
+
3
+ type TCloseSessionInfo = {
4
+ cashCount: number;
5
+ difference: number;
6
+ };
7
+
8
+ type State = {
9
+ closeSessionInfo: TCloseSessionInfo;
10
+ };
11
+
12
+ type Actions = {
13
+ setCloseSessionInfo: (closeSessionInfo: TCloseSessionInfo) => void;
14
+ };
15
+
16
+ export const useCloseSessionStore = create<State & Actions>()((set: any) => ({
17
+ closeSessionInfo: { cashCount: 0, difference: 0 },
18
+ setCloseSessionInfo: (closeSessionInfo: TCloseSessionInfo) =>
19
+ set((state: State) => ({ ...state, closeSessionInfo })),
20
+ }));
@@ -0,0 +1,19 @@
1
+ import { TCustomer } from "@type/customer";
2
+ import { create } from "zustand";
3
+
4
+ type State = {
5
+ isEditMode: boolean;
6
+ customer: TCustomer | null;
7
+ };
8
+
9
+ type Actions = {
10
+ setIsEditMode: (isEditMode: boolean) => void;
11
+ setCustomer: (customer: TCustomer | null) => void;
12
+ };
13
+
14
+ export const useCustomerStore = create<State & Actions>()((set: any) => ({
15
+ isEditMode: false,
16
+ customer: null,
17
+ setIsEditMode: (isEditMode: boolean) => set({ isEditMode }),
18
+ setCustomer: (customer: TCustomer | null) => set({ customer }),
19
+ }));
@@ -0,0 +1,14 @@
1
+ import { create } from "zustand";
2
+
3
+ type State = {
4
+ showPayment: boolean;
5
+ };
6
+
7
+ type Actions = {
8
+ setShowPayment: (showPayment: boolean) => void;
9
+ };
10
+
11
+ export const usePaymentStore = create<State & Actions>()((set: any) => ({
12
+ showPayment: false,
13
+ setShowPayment: (showPayment: boolean) => set({ showPayment }),
14
+ }));
@@ -0,0 +1,212 @@
1
+ @import url("https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap");
2
+ :root {
3
+ --color-primary: var(--primary);
4
+ --color-secondary: var(--secondary);
5
+ --text-primary: var(--text-primary);
6
+ --text-colored-light: var(--text-light);
7
+ }
8
+
9
+ html {
10
+ font-size: 16px;
11
+ }
12
+
13
+ body {
14
+ box-sizing: border-box;
15
+ background-color: #f1f6f1;
16
+ color: #525866;
17
+ overflow: hidden;
18
+ height: 100dvh;
19
+ }
20
+
21
+ hr {
22
+ border-top-width: 1px;
23
+ color: inherit;
24
+ height: 0;
25
+ border-top: 1px solid #e8ebed;
26
+ }
27
+
28
+ ::-webkit-scrollbar {
29
+ width: 5px;
30
+ height: 5px;
31
+ border-radius: 50px !important;
32
+ }
33
+
34
+ ::-webkit-scrollbar-track {
35
+ background: #e8ebed;
36
+ }
37
+
38
+ ::-webkit-scrollbar-thumb {
39
+ background: var(--color-primary);
40
+ border-radius: 12px;
41
+ }
42
+
43
+ .button {
44
+ height: 44px;
45
+ border-radius: 8px;
46
+ -webkit-border-radius: 8px;
47
+ -moz-border-radius: 8px;
48
+ -ms-border-radius: 8px;
49
+ -o-border-radius: 8px;
50
+ display: flex;
51
+ justify-content: center;
52
+ align-items: center;
53
+ gap: 8px;
54
+ padding: 0 12px;
55
+ min-width: 120px;
56
+ }
57
+
58
+ .button-primary {
59
+ height: 44px;
60
+ padding: 0 12px;
61
+ min-width: 120px;
62
+ border-radius: 8px;
63
+ background: var(--color-primary);
64
+ padding: 10px 32px;
65
+ color: var(--text-button);
66
+ font-weight: 600;
67
+ font-size: 14px;
68
+ letter-spacing: -0.005em;
69
+ cursor: pointer;
70
+ transition: all ease-in-out 0.5;
71
+ }
72
+
73
+ .button-primary:hover {
74
+ color: #0093f5;
75
+ }
76
+
77
+ .button-primary:disabled {
78
+ opacity: 0.5;
79
+ /* background: var(--color-background-disabled); */
80
+ /* color: var(--color-text-disabled); */
81
+ }
82
+
83
+ .button-secondary {
84
+ height: 44px;
85
+ padding: 0 12px;
86
+ min-width: 120px;
87
+ border: 1px solid #e5e7eb;
88
+ color: var(--text-primary);
89
+ background-color: #fff;
90
+ font-weight: 500;
91
+ font-size: 14px;
92
+ letter-spacing: -0.5%;
93
+ cursor: pointer;
94
+ border-radius: 8px;
95
+ padding: 10px 32px;
96
+ box-shadow: 0 1px 2px 0 rgba(228, 229, 231, 0.24);
97
+ }
98
+
99
+ .button-icon {
100
+ /* width: 44px !important; */
101
+ min-width: fit-content;
102
+ width: 44px;
103
+ }
104
+
105
+ button:disabled {
106
+ opacity: 0.5;
107
+ cursor: not-allowed;
108
+ pointer-events: none;
109
+ }
110
+
111
+ .title {
112
+ background: var(--color-secondary);
113
+ -webkit-background-clip: text;
114
+ -webkit-text-fill-color: transparent;
115
+ }
116
+
117
+ @media only screen and (max-width: 876px) {
118
+ .button-action-form:has(+ .statusbar) {
119
+ margin-right: 0;
120
+ }
121
+ }
122
+
123
+ .hide-scrollbar {
124
+ overflow: auto;
125
+ scrollbar-width: none;
126
+ -ms-overflow-style: none;
127
+ }
128
+
129
+ .hide-scrollbar::-webkit-scrollbar {
130
+ display: none !important;
131
+ }
132
+
133
+ .bg-primary {
134
+ background: var(--color-primary);
135
+ }
136
+
137
+ .bg-transparent {
138
+ background-color: transparent;
139
+ }
140
+
141
+ .bg-primary-20 {
142
+ background: color-mix(in oklab, var(--color-primary) 20%, transparent);
143
+ }
144
+
145
+ * {
146
+ font-family: "Inter", sans-serif;
147
+ }
148
+
149
+ .border-b-primary {
150
+ border-bottom: 1px solid transparent !important;
151
+ }
152
+ .border-b-primary:hover {
153
+ border: 1px solid transparent !important;
154
+ border-bottom-color: var(--active-border-color) !important;
155
+ }
156
+
157
+ .border-b-primary:focus {
158
+ border: 1px solid transparent !important;
159
+ border-bottom-color: var(--active-border-color) !important;
160
+ }
161
+
162
+ .border-input-primary:focus {
163
+ border: 1px solid var(--active-border-color) !important;
164
+ }
165
+
166
+ .search {
167
+ min-height: 44px;
168
+ }
169
+
170
+ .hide-scrollbar::-webkit-scrollbar {
171
+ display: none;
172
+ }
173
+
174
+ input[type="number"]::-webkit-inner-spin-button,
175
+ input[type="number"]::-webkit-outer-spin-button {
176
+ -webkit-appearance: none;
177
+ margin: 0;
178
+ }
179
+
180
+ input[type="number"] {
181
+ -moz-appearance: textfield;
182
+ }
183
+
184
+ .background-home {
185
+ background: url("/assets/images/home-bg.png") no-repeat center center;
186
+ background-size: cover;
187
+ }
188
+
189
+ .table-scrollbar::-webkit-scrollbar {
190
+ width: 6px;
191
+ height: 6px;
192
+ display: inline-block;
193
+ }
194
+ .table-scrollbar::-webkit-scrollbar-track {
195
+ background: transparent;
196
+ }
197
+
198
+ .table-scrollbar::-webkit-scrollbar-thumb {
199
+ background: var(--color-primary);
200
+ border-radius: 8px;
201
+ }
202
+
203
+ .table-scrollbar::-webkit-scrollbar-thumb:hover {
204
+ background: var(--color-primary);
205
+ }
206
+
207
+ @media print {
208
+ svg [filter],
209
+ svg [style*="drop-shadow"] {
210
+ filter: none !important;
211
+ }
212
+ }
@@ -0,0 +1,65 @@
1
+ body {
2
+ box-sizing: border-box;
3
+ }
4
+
5
+ .gradient-blur-circle {
6
+ border-radius: 640px;
7
+ opacity: 0.5;
8
+ background: conic-gradient(
9
+ from 211deg at 49.26% 49.01%,
10
+ #2b7cff 50.00729262828827deg,
11
+ #903ce9 95.19230604171753deg,
12
+ #e291ff 159.23076510429382deg,
13
+ #68cee2 235.38461208343506deg
14
+ );
15
+ filter: blur(90px);
16
+ }
17
+
18
+ .loader {
19
+ width: 8px;
20
+ height: 40px;
21
+ border-radius: 4px;
22
+ display: block;
23
+ margin: 20px auto;
24
+ position: relative;
25
+ background: currentColor;
26
+ color: #fff;
27
+ box-sizing: border-box;
28
+ animation: animloader 0.3s 0.3s linear infinite alternate;
29
+ }
30
+
31
+ .loader::after,
32
+ .loader::before {
33
+ content: '';
34
+ width: 8px;
35
+ height: 40px;
36
+ border-radius: 4px;
37
+ background: currentColor;
38
+ position: absolute;
39
+ top: 50%;
40
+ transform: translateY(-50%);
41
+ left: 20px;
42
+ box-sizing: border-box;
43
+ animation: animloader 0.3s 0.45s linear infinite alternate;
44
+ }
45
+ .loader::before {
46
+ left: -20px;
47
+ animation-delay: 0s;
48
+ }
49
+
50
+ @keyframes animloader {
51
+ 0% {
52
+ height: 48px;
53
+ }
54
+ 100% {
55
+ height: 4px;
56
+ }
57
+ }
58
+
59
+ button {
60
+ cursor: pointer;
61
+ }
62
+
63
+ ::-webkit-scrollbar {
64
+ display: none;
65
+ }
File without changes
@@ -0,0 +1,34 @@
1
+ :root {
2
+ /* --color-primary: var(--primary); */
3
+ /* --color-secondary: var(--secondary); */
4
+ /* --color-sub-300: #d4d5d8;
5
+ --color-sub-600: #525866;
6
+ --color-soft-150: #edeff0;
7
+ --color-soft-200: #e8e8ea;
8
+ --color-soft-400: #a9abae;
9
+ --color-strong-950: #1a1a1b;
10
+ --color-weak-100: #f6f7f8;
11
+ --color-information: #335cff;
12
+ --color-disable-300: #d4d5d8;
13
+ --color-error: #fb3748;
14
+ --text-primary: #060606;
15
+ --text-secondary: #666666;
16
+ --color-troke-disabled: rgba(66, 66, 66, 0.12);
17
+ --color-tertiary: #aeaeae;
18
+ --color-neutral-200: #f1f2f4;
19
+ --bg-brand: #363793;
20
+ --stroke-warning: #f6b51e;
21
+ --stroke-info: #35ade9;
22
+ --stroke-success: #1fc163;
23
+ --color-secondary-sub:#CEE1FF,
24
+
25
+ --color-neutral-50: #fafafa;
26
+ --color-background-disabled: rgba(66, 66, 66, 0.04);
27
+ --color-text-disabled: #C3C3C3; */
28
+ /* ... */
29
+
30
+ --shadow-button: 0px 4px 4px -1px #00000006, 0px 1px 1px 0px #00000013;
31
+ /* ... */
32
+ /* --color-secondary: #0101ff; */
33
+ --linear-primary: linear-gradient(180deg, #004FD3 0%, #2E74E9 100%);
34
+ }