@feedmepos/mf-inventory-portal 0.0.5

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 (284) hide show
  1. package/README.md +31 -0
  2. package/dist/App.vue.d.ts +2 -0
  3. package/dist/ApprovalView-CTQdDgGH.js +119 -0
  4. package/dist/BindingsDialog-DvX_DRsO.js +82 -0
  5. package/dist/BindingsPicker-CQIGhTCR.js +124 -0
  6. package/dist/BindingsTable-Da4BLkvc.js +122 -0
  7. package/dist/ChangeLocationComponent.vue_vue_type_script_setup_true_lang-DcixBOcX.js +97 -0
  8. package/dist/Entry.vue.d.ts +2 -0
  9. package/dist/FmMultiselectDialog.vue_vue_type_script_setup_true_lang-BXU7x6di.js +144 -0
  10. package/dist/IngredientBindedItem.vue_vue_type_script_setup_true_lang-CD89qCIa.js +49 -0
  11. package/dist/IngredientsView-2ZKdzsgI.js +739 -0
  12. package/dist/IntegrationView-BRWYO3VE.js +1172 -0
  13. package/dist/InventoryBindingForm.vue_vue_type_script_setup_true_lang-CnsDmPTe.js +240 -0
  14. package/dist/NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DBK7mpQS.js +66 -0
  15. package/dist/PurchaseOrderPrintPreview-CH9gVYDg.js +152 -0
  16. package/dist/ReceiveRequestView-DQBqc3GF.js +1298 -0
  17. package/dist/RecipeView-DFG9Wkx-.js +594 -0
  18. package/dist/SingleColumnLayout.vue_vue_type_script_setup_true_lang-CFjO4TPG.js +53 -0
  19. package/dist/Standalone.vue.d.ts +2 -0
  20. package/dist/StockView-DLWMp_I5.js +1733 -0
  21. package/dist/SupplierView-CZhM2ie3.js +607 -0
  22. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-Ffe9bhq8.js +1027 -0
  23. package/dist/UnitView-C3XVSbJY.js +626 -0
  24. package/dist/WarehouseView-BntzAdz3.js +1139 -0
  25. package/dist/api/bill.d.ts +1364 -0
  26. package/dist/api/closing.d.ts +3 -0
  27. package/dist/api/error.d.ts +31 -0
  28. package/dist/api/food-market-hub.d.ts +38 -0
  29. package/dist/api/inventory.d.ts +176 -0
  30. package/dist/api/purchase-order.d.ts +13 -0
  31. package/dist/api/stock.d.ts +9 -0
  32. package/dist/api/supplier.d.ts +7 -0
  33. package/dist/api/type.d.ts +12 -0
  34. package/dist/api/warehouse.d.ts +7 -0
  35. package/dist/app-BzDhmCVx.js +36639 -0
  36. package/dist/app.d.ts +2 -0
  37. package/dist/app.js +5 -0
  38. package/dist/components/ChangeLocationComponent.vue.d.ts +2 -0
  39. package/dist/components/DeferableLoading.vue.d.ts +19 -0
  40. package/dist/components/DeferableLoadingProps.d.ts +4 -0
  41. package/dist/components/DeleteDialog.vue.d.ts +18 -0
  42. package/dist/components/FmCoordinateInput.vue.d.ts +24 -0
  43. package/dist/components/FmCoordinateInputProps.d.ts +23 -0
  44. package/dist/components/FmFilterableSelect.vue.d.ts +25 -0
  45. package/dist/components/FmFilterableSelectProps.d.ts +28 -0
  46. package/dist/components/FmMultiselectDialog.vue.d.ts +30 -0
  47. package/dist/components/FmMultiselectDialogProps.d.ts +16 -0
  48. package/dist/components/FmTableToolbar.vue.d.ts +49 -0
  49. package/dist/components/MultiSelectDialog.vue.d.ts +12 -0
  50. package/dist/components/MultiSelectDialogProps.d.ts +7 -0
  51. package/dist/components/NavigationTab.vue.d.ts +2 -0
  52. package/dist/components/NumberPrecisionInput.vue.d.ts +16 -0
  53. package/dist/components/NumberPrecisionInputProps.d.ts +12 -0
  54. package/dist/components/TableActionableRow.vue.d.ts +40 -0
  55. package/dist/components/UnitDisplayControl.vue.d.ts +12 -0
  56. package/dist/components/UnitDisplayControlProp.d.ts +7 -0
  57. package/dist/components/fm-components.type.d.ts +8 -0
  58. package/dist/components/form/form-mode.enum.d.ts +5 -0
  59. package/dist/components/icons/IconCommunity.vue.d.ts +2 -0
  60. package/dist/components/icons/IconDocumentation.vue.d.ts +2 -0
  61. package/dist/components/icons/IconEcosystem.vue.d.ts +2 -0
  62. package/dist/components/icons/IconSupport.vue.d.ts +2 -0
  63. package/dist/components/icons/IconTooling.vue.d.ts +2 -0
  64. package/dist/components/inventory-binding/InventoryBinding.vue.d.ts +145 -0
  65. package/dist/components/inventory-binding/InventoryBindingProps.d.ts +11 -0
  66. package/dist/components/map/CoordinateDialog.vue.d.ts +24 -0
  67. package/dist/components/map/GoogleMap.vue.d.ts +79 -0
  68. package/dist/components/map/coordinates.d.ts +6 -0
  69. package/dist/components/map/helper/coords-to-latlong.d.ts +8 -0
  70. package/dist/components/map/type.d.ts +27 -0
  71. package/dist/components/nested-multiselect/FmNestedMultiselectDialog.vue.d.ts +7 -0
  72. package/dist/components/nested-multiselect/FmNestedMultiselectDialogProps.d.ts +22 -0
  73. package/dist/components/nested-multiselect/helper/multiselect-utils.d.ts +2 -0
  74. package/dist/components/row-action.enum.d.ts +13 -0
  75. package/dist/components/shell/inventory/binding-dialog.vue.d.ts +84 -0
  76. package/dist/components/shell/inventory/binding-ui.test.d.ts +1 -0
  77. package/dist/components/shell/inventory/binding-ui.vue.d.ts +110 -0
  78. package/dist/components/shell/inventory/utils.d.ts +5 -0
  79. package/dist/components/ui-library/FmDateRangePickerChip.vue.d.ts +36 -0
  80. package/dist/components/ui-library/FmSpecialChip.vue.d.ts +79 -0
  81. package/dist/composable/defineApi.d.ts +18 -0
  82. package/dist/composable/useBreakpoints.d.ts +7 -0
  83. package/dist/composable/useIframe.d.ts +37 -0
  84. package/dist/composable/useSearch.d.ts +5 -0
  85. package/dist/composable/useTabStorage.d.ts +2 -0
  86. package/dist/composable/useToast.d.ts +36 -0
  87. package/dist/core.d.ts +12 -0
  88. package/dist/cypress/component/FmFilterableSelect.cy.d.ts +1 -0
  89. package/dist/cypress/component/FmNestedMultiselectDialog.cy.d.ts +1 -0
  90. package/dist/cypress/component/UnitDisplayControl.cy.d.ts +1 -0
  91. package/dist/cypress/component/receive-request/KDI-15-total-price-currency.cy.d.ts +2 -0
  92. package/dist/cypress/e2e/views/MenuV3.spec.cy.d.ts +0 -0
  93. package/dist/cypress/e2e/views/MenuV4.spec.cy.d.ts +0 -0
  94. package/dist/cypress/e2e/views/Root.spec.cy.d.ts +0 -0
  95. package/dist/cypress/e2e/views/StockView.spec.cy.d.ts +0 -0
  96. package/dist/cypress/support/commands.d.ts +0 -0
  97. package/dist/cypress/support/component.d.ts +10 -0
  98. package/dist/cypress/support/e2e.d.ts +1 -0
  99. package/dist/date2-C7HiAWQG.js +209 -0
  100. package/dist/dayjs.min-Db57WhI9.js +282 -0
  101. package/dist/decimal-D3a0BwVj.js +98 -0
  102. package/dist/empty-placeholder-wf6-BWE8.js +4 -0
  103. package/dist/extensions/array.d.ts +15 -0
  104. package/dist/favicon.ico +0 -0
  105. package/dist/fuzzy-BW8ZYsDG.js +41 -0
  106. package/dist/helper/address.d.ts +2 -0
  107. package/dist/helper/component.d.ts +4 -0
  108. package/dist/helper/core/country/codes.d.ts +255 -0
  109. package/dist/helper/core/country/utils.d.ts +8 -0
  110. package/dist/helper/core/id-to-date.d.ts +1 -0
  111. package/dist/helper/core/store/type.d.ts +2 -0
  112. package/dist/helper/country.d.ts +260 -0
  113. package/dist/helper/date.spec.d.ts +1 -0
  114. package/dist/helper/date2.d.ts +20 -0
  115. package/dist/helper/decimal.d.ts +15 -0
  116. package/dist/helper/decimal.spec.d.ts +1 -0
  117. package/dist/helper/export.d.ts +12 -0
  118. package/dist/helper/form.d.ts +5 -0
  119. package/dist/helper/inventory.d.ts +1 -0
  120. package/dist/helper/iteration.d.ts +15 -0
  121. package/dist/helper/number.d.ts +27 -0
  122. package/dist/helper/number.spec.d.ts +1 -0
  123. package/dist/helper/object.d.ts +36 -0
  124. package/dist/helper/object.spec.d.ts +1 -0
  125. package/dist/helper/rules.d.ts +22 -0
  126. package/dist/helper/search.d.ts +21 -0
  127. package/dist/helper/semver.d.ts +20 -0
  128. package/dist/helper/semver.spec.d.ts +1 -0
  129. package/dist/helper/type.d.ts +8 -0
  130. package/dist/helper/url.d.ts +7 -0
  131. package/dist/helper/validate.d.ts +70 -0
  132. package/dist/helper/xlsx.util.d.ts +8 -0
  133. package/dist/helper/zod.d.ts +21 -0
  134. package/dist/id-to-date-ReZIpUDw.js +30 -0
  135. package/dist/index-D46it8Rk.js +12956 -0
  136. package/dist/init-date-range-M3Q03-Fd.js +21 -0
  137. package/dist/is-linked-ingredient-error-C6AghEwR.js +37 -0
  138. package/dist/layout/InventoryLayout.vue.d.ts +2 -0
  139. package/dist/layout/SingleColumnLayout.vue.d.ts +55 -0
  140. package/dist/layout/components/NavigationButton.vue.d.ts +22 -0
  141. package/dist/layout/layout-routes.d.ts +7 -0
  142. package/dist/layout/type.d.ts +17 -0
  143. package/dist/layout-BvUjg6JS.js +151 -0
  144. package/dist/locales/en/common.json +7 -0
  145. package/dist/main.d.ts +2 -0
  146. package/dist/router/index.d.ts +5 -0
  147. package/dist/router/name.d.ts +17 -0
  148. package/dist/router/shared.d.ts +11 -0
  149. package/dist/row-action.enum-BwQbURNh.js +28 -0
  150. package/dist/rules-DHfAMDW3.js +86 -0
  151. package/dist/stores/api.d.ts +10 -0
  152. package/dist/stores/env.d.ts +5 -0
  153. package/dist/stores/feature.d.ts +9 -0
  154. package/dist/stores/googlemap.d.ts +37 -0
  155. package/dist/stores/helper/generate-backend-urls.d.ts +8 -0
  156. package/dist/stores/inventory.d.ts +1983 -0
  157. package/dist/stores/layout.d.ts +5 -0
  158. package/dist/stores/location.d.ts +1898 -0
  159. package/dist/stores/route.d.ts +12 -0
  160. package/dist/stores/stock.d.ts +58 -0
  161. package/dist/stores/supplier.d.ts +30 -0
  162. package/dist/stores/warehouse.d.ts +88 -0
  163. package/dist/style.css +1 -0
  164. package/dist/supplier-DTiiOLtg.js +65 -0
  165. package/dist/tsconfig.app.tsbuildinfo +1 -0
  166. package/dist/use-inventory-binding-dialog-B6JO7050.js +109 -0
  167. package/dist/views/InventoryView.vue.d.ts +2 -0
  168. package/dist/views/SelectBussinessDialog.vue.d.ts +2 -0
  169. package/dist/views/approval/ApprovalView.vue.d.ts +2 -0
  170. package/dist/views/dev/ComponentPreview.vue.d.ts +2 -0
  171. package/dist/views/dev/components/CoordinateTest.vue.d.ts +2 -0
  172. package/dist/views/dev/components/DateRange.vue.d.ts +2 -0
  173. package/dist/views/dev/components/FmSelectTest.vue.d.ts +2 -0
  174. package/dist/views/dev/components/InventoryIframe.vue.d.ts +2 -0
  175. package/dist/views/dev/components/LayoutDev.vue.d.ts +2 -0
  176. package/dist/views/dev/components/MfCommontTest.vue.d.ts +2 -0
  177. package/dist/views/dev/components/NestedSelection.vue.d.ts +2 -0
  178. package/dist/views/dev/components/NumberStepper.vue.d.ts +2 -0
  179. package/dist/views/dev/components/TabStorageTest.vue.d.ts +2 -0
  180. package/dist/views/dev/helpers/debug.d.ts +22 -0
  181. package/dist/views/dev/helpers/nested-options.d.ts +60 -0
  182. package/dist/views/dev/helpers/pinia-test.d.ts +9 -0
  183. package/dist/views/home/HomeView.vue.d.ts +2 -0
  184. package/dist/views/iframe/inventory-bindings/bindings-dialog/BindingsDialog.vue.d.ts +2 -0
  185. package/dist/views/iframe/inventory-bindings/bindings-picker/BindingsPicker.vue.d.ts +2 -0
  186. package/dist/views/iframe/inventory-bindings/bindings-table/BindingsTable.vue.d.ts +2 -0
  187. package/dist/views/ingredients/IngredientsView.vue.d.ts +2 -0
  188. package/dist/views/ingredients/components/cannot-delete/CannotDelete.vue.d.ts +30 -0
  189. package/dist/views/ingredients/components/convert/ConvertForm.vue.d.ts +54 -0
  190. package/dist/views/ingredients/components/convert/ConvertFormProps.d.ts +8 -0
  191. package/dist/views/ingredients/components/ingredient-binded-item/IngredientBindedItem.vue.d.ts +12 -0
  192. package/dist/views/ingredients/components/ingredient-binded-item/IngredientBindedItemProps.d.ts +5 -0
  193. package/dist/views/ingredients/components/ingredient-dialog/IngredientDialog.vue.d.ts +31 -0
  194. package/dist/views/ingredients/components/ingredient-dialog/IngredientDialogProps.d.ts +9 -0
  195. package/dist/views/ingredients/components/ingredient-form/IngredientForm.vue.d.ts +104 -0
  196. package/dist/views/ingredients/components/ingredient-form/IngredientFormProps.d.ts +10 -0
  197. package/dist/views/ingredients/components/inventory-binding/InventoryBindingForm.vue.d.ts +88 -0
  198. package/dist/views/ingredients/components/inventory-binding/composables/use-inventory-binding-dialog.d.ts +4 -0
  199. package/dist/views/ingredients/components/inventory-binding/util.d.ts +7 -0
  200. package/dist/views/ingredients/composables/use-ingredient-form.d.ts +8 -0
  201. package/dist/views/ingredients/composables/use-ingredient-table.d.ts +46 -0
  202. package/dist/views/ingredients/helper/is-linked-ingredient-error.d.ts +7 -0
  203. package/dist/views/integration/IntegrationView.vue.d.ts +2 -0
  204. package/dist/views/integration/components/ApplyAddon.vue.d.ts +379 -0
  205. package/dist/views/integration/components/ApplyProduct.vue.d.ts +303 -0
  206. package/dist/views/integration/components/ApplyProductDialog.vue.d.ts +277 -0
  207. package/dist/views/integration/components/ApplyProductDialogProps.d.ts +17 -0
  208. package/dist/views/integration/components/ApplyProductDialogV4.vue.d.ts +277 -0
  209. package/dist/views/integration/helper/menu.d.ts +36 -0
  210. package/dist/views/receive-request/ReceiveRequestView.vue.d.ts +2 -0
  211. package/dist/views/receive-request/components/supplier-price-history/SupplierPriceHistory.vue.d.ts +12 -0
  212. package/dist/views/receive-request/components/supplier-price-history/SupplierPriceHistoryProps.d.ts +11 -0
  213. package/dist/views/receive-request/components/transfer-details/TransferDetails.vue.d.ts +18 -0
  214. package/dist/views/receive-request/components/transfer-details/TransferDetailsProps.d.ts +12 -0
  215. package/dist/views/receive-request/components/transfer-dialog/TransferDialog.vue.d.ts +22 -0
  216. package/dist/views/receive-request/components/transfer-dialog/TransferDialogProps.d.ts +11 -0
  217. package/dist/views/receive-request/components/transfer-form/TransferForm.vue.d.ts +450 -0
  218. package/dist/views/receive-request/components/transfer-form/TransferFormProps.d.ts +10 -0
  219. package/dist/views/receive-request/composables/use-receive-request-form.d.ts +369 -0
  220. package/dist/views/receive-request/composables/use-receive-request-table.d.ts +1202 -0
  221. package/dist/views/receive-request/constants/dialog-templates.d.ts +8 -0
  222. package/dist/views/receive-request/constants/purchase-order-transaction-type.d.ts +4 -0
  223. package/dist/views/receive-request/constants/purchase-row-actions.d.ts +2 -0
  224. package/dist/views/receive-request/helper/format-time-from-id.d.ts +2 -0
  225. package/dist/views/receive-request/helper/format-unit-display.d.ts +6 -0
  226. package/dist/views/receive-request/helper/get-received-amount.d.ts +2 -0
  227. package/dist/views/receive-request/helper/init-date-range.d.ts +8 -0
  228. package/dist/views/receive-request/helper/print-po.d.ts +2 -0
  229. package/dist/views/receive-request/helper/status-to-background.d.ts +2 -0
  230. package/dist/views/receive-request/print-preview/PurchaseOrderPrintPreview.vue.d.ts +47 -0
  231. package/dist/views/recipe/RecipeView.vue.d.ts +2 -0
  232. package/dist/views/recipe/components/recipe-dialog/RecipeDialog.vue.d.ts +31 -0
  233. package/dist/views/recipe/components/recipe-dialog/RecipeDialogProps.d.ts +9 -0
  234. package/dist/views/recipe/components/recipe-form/RecipeForm.vue.d.ts +62 -0
  235. package/dist/views/recipe/components/recipe-form/RecipeFormProps.d.ts +10 -0
  236. package/dist/views/recipe/composables/use-recipe-form.d.ts +9 -0
  237. package/dist/views/recipe/composables/use-recipe-table.d.ts +11 -0
  238. package/dist/views/recipe/helper/export-recipe.d.ts +1 -0
  239. package/dist/views/stock/StockView.vue.d.ts +2 -0
  240. package/dist/views/stock/components/StockHistory.vue.d.ts +17 -0
  241. package/dist/views/stock/components/StockHistoryProps.d.ts +7 -0
  242. package/dist/views/stock/components/StockRecordCard.vue.d.ts +712 -0
  243. package/dist/views/stock/components/dialog/AdjustSkuDialog.vue.d.ts +22 -0
  244. package/dist/views/stock/components/dialog/AdjustSkuDialogProps.d.ts +8 -0
  245. package/dist/views/stock/components/dialog/AdjustedItemForm.vue.d.ts +164 -0
  246. package/dist/views/stock/components/dialog/AdjustedItemFormProps.d.ts +8 -0
  247. package/dist/views/stock/components/dialog/ConvertSkuDialog.vue.d.ts +22 -0
  248. package/dist/views/stock/components/dialog/ConvertSkuDialogProps.d.ts +9 -0
  249. package/dist/views/stock/components/dialog/constant/adjustment-type-options.d.ts +7 -0
  250. package/dist/views/stock/components/dialog/helper/adjust.d.ts +3 -0
  251. package/dist/views/stock/components/dialog/helper/form-adjust.d.ts +10 -0
  252. package/dist/views/stock/composables/use-stock-table.d.ts +12 -0
  253. package/dist/views/stock/helper/compute-summary-total-test.d.ts +1 -0
  254. package/dist/views/stock/helper/compute-summary-total.d.ts +1 -0
  255. package/dist/views/stock/helper/compute-summary-total.spec.d.ts +1 -0
  256. package/dist/views/stock/helper/format-date-from-id.d.ts +2 -0
  257. package/dist/views/stock/helper/on-click-export-excel.d.ts +9 -0
  258. package/dist/views/stock/helper/stock-row-action.d.ts +13 -0
  259. package/dist/views/stock/type.d.ts +9 -0
  260. package/dist/views/supplier/SupplierView.vue.d.ts +2 -0
  261. package/dist/views/supplier/components/SupplierDialog.vue.d.ts +22 -0
  262. package/dist/views/supplier/components/SupplierDialogProps.d.ts +10 -0
  263. package/dist/views/supplier/components/SupplierForm.vue.d.ts +58 -0
  264. package/dist/views/supplier/components/SupplierFormProps.d.ts +8 -0
  265. package/dist/views/supplier/composables/use-supplier-table.d.ts +22 -0
  266. package/dist/views/unit/UnitView.vue.d.ts +2 -0
  267. package/dist/views/unit/components/unit-dialog/UnitDialog.vue.d.ts +31 -0
  268. package/dist/views/unit/components/unit-dialog/UnitDialogProps.d.ts +9 -0
  269. package/dist/views/unit/components/unit-form/UnitForm.vue.d.ts +50 -0
  270. package/dist/views/unit/components/unit-form/UnitFormProps.d.ts +10 -0
  271. package/dist/views/unit/components/unit-summary/UnitSummary.vue.d.ts +43 -0
  272. package/dist/views/unit/components/unit-used-by/UnitUsedBy.vue.d.ts +12 -0
  273. package/dist/views/unit/components/unit-used-by/UnitUsedByProps.d.ts +3 -0
  274. package/dist/views/unit/composables/use-unit-form.d.ts +8 -0
  275. package/dist/views/unit/composables/use-unit-table.d.ts +19 -0
  276. package/dist/views/unit/type.d.ts +2 -0
  277. package/dist/views/warehouse/WarehouseView.vue.d.ts +2 -0
  278. package/dist/views/warehouse/components/WarehouseDialog.vue.d.ts +22 -0
  279. package/dist/views/warehouse/components/WarehouseDialogProps.d.ts +10 -0
  280. package/dist/views/warehouse/components/WarehouseForm.vue.d.ts +174 -0
  281. package/dist/views/warehouse/components/WarehouseFormProps.d.ts +8 -0
  282. package/dist/views/warehouse/composables/use-warehouse-table.d.ts +12 -0
  283. package/dist/xlsx-BljO4Lx2.js +15510 -0
  284. package/package.json +93 -0
@@ -0,0 +1,1139 @@
1
+ import { ref as E, defineComponent as I, watch as oe, onMounted as ae, onUnmounted as Fe, openBlock as D, createElementBlock as B, toRaw as we, reactive as Ee, createElementVNode as g, toDisplayString as ee, createVNode as k, pushScopeId as Pe, popScopeId as De, resolveComponent as U, unref as A, createSlots as Te, withCtx as j, createTextVNode as Re, renderSlot as We, createBlock as N, createCommentVNode as Me, computed as F, isRef as Ve, normalizeStyle as Ue } from "vue";
2
+ import { d as Le, j as je, k as Be, c as q, l as Ne, _ as Ie, b as qe } from "./app-BzDhmCVx.js";
3
+ import { useCoreStore as ze } from "@feedmepos/mf-common";
4
+ import { D as _e, R as Q, F as R } from "./row-action.enum-BwQbURNh.js";
5
+ import { c as Ge, _ as Ke, F as X, u as Oe } from "./layout-BvUjg6JS.js";
6
+ import { _ as He } from "./SingleColumnLayout.vue_vue_type_script_setup_true_lang-CFjO4TPG.js";
7
+ import { useDialogChild as Ze, useDialog as xe, useSnackbar as le, useProxiedModel as te, useBreakpoints as Je } from "@feedmepos/ui-library";
8
+ import { R as L } from "./rules-DHfAMDW3.js";
9
+ const Y = Le((r, d) => {
10
+ const s = ze();
11
+ return {
12
+ async readWarehouses() {
13
+ var u;
14
+ const t = ((u = s.currentBusiness.value) == null ? void 0 : u._id) ?? "", l = `${r.inventoryBackendUrl}/businesses/${t}/warehouses`;
15
+ return await d.get(l);
16
+ },
17
+ async createWarehouse(t) {
18
+ var i;
19
+ const l = ((i = s.currentBusiness.value) == null ? void 0 : i._id) ?? "", u = `${r.inventoryBackendUrl}/businesses/${l}/warehouse`;
20
+ return await d.post(u, t);
21
+ },
22
+ async updateWarehouse(t, l) {
23
+ var n;
24
+ const u = ((n = s.currentBusiness.value) == null ? void 0 : n._id) ?? "", i = `${r.inventoryBackendUrl}/businesses/${u}/warehouse/${t}`;
25
+ return await d.put(i, l);
26
+ },
27
+ async deleteWarehouse(t) {
28
+ var i;
29
+ const l = ((i = s.currentBusiness.value) == null ? void 0 : i._id) ?? "", u = `${r.inventoryBackendUrl}/businesses/${l}/warehouse/${t}`;
30
+ return await d.delete(u);
31
+ }
32
+ };
33
+ });
34
+ function Qe() {
35
+ return {
36
+ warehouses: []
37
+ };
38
+ }
39
+ const ke = E(Qe());
40
+ function $e() {
41
+ return {
42
+ // state
43
+ get warehouses() {
44
+ return ke.value.warehouses;
45
+ },
46
+ set warehouses(r) {
47
+ ke.value.warehouses = r;
48
+ },
49
+ // actions
50
+ async readWarehouses() {
51
+ const r = Y();
52
+ this.warehouses = await r.readWarehouses();
53
+ },
54
+ async createWarehouse(r) {
55
+ await Y().createWarehouse(r);
56
+ },
57
+ async updateWarehouse(r) {
58
+ await Y().updateWarehouse(r._id, r.profile);
59
+ },
60
+ async deleteWarehouse(r) {
61
+ await Y().deleteWarehouse(r._id);
62
+ },
63
+ async init() {
64
+ const r = je();
65
+ try {
66
+ await this.readWarehouses();
67
+ } catch (d) {
68
+ throw d instanceof Be || r.error("Error at reading warehouses"), d;
69
+ }
70
+ }
71
+ };
72
+ }
73
+ function Xe(r, d) {
74
+ function s(u, i) {
75
+ if (u === Q.Edit) {
76
+ r(q(i));
77
+ return;
78
+ }
79
+ if (u === Q.Delete) {
80
+ d(q(i));
81
+ return;
82
+ }
83
+ }
84
+ const t = [
85
+ {
86
+ accessorKey: "warehouse",
87
+ header: "Warehouse",
88
+ size: 200
89
+ },
90
+ {
91
+ accessorKey: "contact",
92
+ header: "Contact",
93
+ size: 200
94
+ },
95
+ {
96
+ accessorKey: "email",
97
+ header: "Email",
98
+ size: 200
99
+ },
100
+ {
101
+ accessorKey: "address",
102
+ header: "Address",
103
+ size: "auto"
104
+ },
105
+ {
106
+ id: "action",
107
+ header: "",
108
+ cell(u) {
109
+ return Ge(
110
+ [_e[Q.Edit], _e[Q.Delete]],
111
+ (i) => {
112
+ s(i, u.row.original.original);
113
+ }
114
+ );
115
+ },
116
+ enableSorting: !1,
117
+ size: 40,
118
+ meta: {
119
+ cellClass: "",
120
+ headerClass: ""
121
+ }
122
+ }
123
+ ];
124
+ function l(u) {
125
+ return u.map((i) => ({
126
+ original: i,
127
+ warehouse: i.profile.name,
128
+ contact: i.profile.phoneNo,
129
+ email: i.profile.email,
130
+ get address() {
131
+ const n = i.profile.address;
132
+ return [
133
+ n == null ? void 0 : n.line1,
134
+ n == null ? void 0 : n.line2,
135
+ n == null ? void 0 : n.city,
136
+ n == null ? void 0 : n.postcode,
137
+ n == null ? void 0 : n.state,
138
+ n == null ? void 0 : n.country
139
+ ].map((y) => y == null ? void 0 : y.trim()).filter((y) => y).join(", ");
140
+ }
141
+ }));
142
+ }
143
+ return { columnDefs: t, formatRowData: l };
144
+ }
145
+ class z {
146
+ constructor(d = null, s = {}) {
147
+ if (this.apiKey = d, this.options = s, typeof window > "u")
148
+ throw new Error("google-maps is supported only in browser environment");
149
+ }
150
+ load() {
151
+ return typeof this.api < "u" ? Promise.resolve(this.api) : typeof this.loader < "u" ? this.loader : (window[z.CALLBACK_NAME] = () => {
152
+ if (this.api = window.google, typeof this.resolve > "u")
153
+ throw new Error("Should not happen");
154
+ this.resolve(this.api);
155
+ }, window.gm_authFailure = () => {
156
+ if (typeof this.reject > "u")
157
+ throw new Error("Should not happen");
158
+ this.reject(new Error("google-maps: authentication error"));
159
+ }, this.loader = new Promise((d, s) => {
160
+ this.resolve = d, this.reject = s;
161
+ const t = document.createElement("script");
162
+ t.src = this.createUrl(), t.async = !0, t.onerror = (l) => s(l), document.head.appendChild(t);
163
+ }));
164
+ }
165
+ createUrl() {
166
+ const d = [
167
+ `callback=${z.CALLBACK_NAME}`
168
+ ];
169
+ this.apiKey && d.push(`key=${this.apiKey}`);
170
+ for (let s in this.options)
171
+ if (this.options.hasOwnProperty(s)) {
172
+ let t = this.options[s];
173
+ s === "version" && (s = "v"), s === "libraries" && (t = t.join(",")), d.push(`${s}=${t}`);
174
+ }
175
+ return `https://maps.googleapis.com/maps/api/js?${d.join("&")}`;
176
+ }
177
+ }
178
+ z.CALLBACK_NAME = "_dk_google_maps_loader_cb";
179
+ const G = Object.freeze({
180
+ jb: {
181
+ lat: 1.492659,
182
+ lng: 103.7413591
183
+ }
184
+ }), Ce = E({});
185
+ function se() {
186
+ return {
187
+ // state
188
+ get _googleMap() {
189
+ return Ce.value._googleMap;
190
+ },
191
+ set _googleMap(r) {
192
+ Ce.value._googleMap = r;
193
+ },
194
+ // computed
195
+ get googleMap() {
196
+ if (!this._googleMap) throw new Error("Google Map is not initialized!");
197
+ return this._googleMap;
198
+ },
199
+ get isGoogleMapReady() {
200
+ return !!this._googleMap;
201
+ },
202
+ // actions
203
+ async initGoogleMap(r) {
204
+ if (this._googleMap) return;
205
+ const s = await new z(r, {
206
+ libraries: ["places"]
207
+ }).load();
208
+ this._googleMap = s;
209
+ },
210
+ getGeocoder() {
211
+ return new this.googleMap.maps.Geocoder();
212
+ },
213
+ getFirstMatchingAddress(r, d) {
214
+ return new Promise((s) => {
215
+ this.getGeocoder().geocode({ location: { lat: r, lng: d } }, (t) => {
216
+ if (t != null && t.length) {
217
+ const [l] = t;
218
+ s(l.formatted_address);
219
+ } else
220
+ s("");
221
+ });
222
+ });
223
+ },
224
+ getFirstMatchingCoordinate(r) {
225
+ return new Promise((d) => {
226
+ this.getGeocoder().geocode({ address: r }, (s) => {
227
+ if (s != null && s.length) {
228
+ const [{ geometry: t }] = s;
229
+ d([t.location.lng(), t.location.lat()]);
230
+ } else
231
+ d([G.jb.lng, G.jb.lat]);
232
+ });
233
+ });
234
+ }
235
+ };
236
+ }
237
+ const Ye = /* @__PURE__ */ I({
238
+ __name: "GoogleMap",
239
+ props: {
240
+ markers: {
241
+ type: Array,
242
+ default: () => []
243
+ },
244
+ polygons: {
245
+ type: Array,
246
+ default: () => []
247
+ },
248
+ zoom: {
249
+ type: Number,
250
+ default: 14
251
+ },
252
+ editable: {
253
+ type: Boolean,
254
+ default: !1
255
+ },
256
+ center: {
257
+ type: Object,
258
+ default: G.jb
259
+ }
260
+ },
261
+ emits: ["map-click", "marker-change", "polygon-change", "polygon-right-click"],
262
+ setup(r, { expose: d, emit: s }) {
263
+ const t = r, l = s;
264
+ d({
265
+ setCenter: (p) => {
266
+ var m, V;
267
+ (m = n.value) == null || m.setCenter(p), (V = n.value) == null || V.setZoom(18);
268
+ }
269
+ });
270
+ const { googleMap: u } = se(), i = E(), n = E(null), M = [];
271
+ function y(p) {
272
+ return {
273
+ lat: p.latLng.lat(),
274
+ lng: p.latLng.lng()
275
+ };
276
+ }
277
+ function w(p, m, V) {
278
+ const $ = u.maps.event.addListener(p, m, V);
279
+ M.push($);
280
+ }
281
+ const _ = E([]);
282
+ function b(p, m, V) {
283
+ w(p, m, V);
284
+ }
285
+ function S(p) {
286
+ c(null), _.value = p.map((m, V) => {
287
+ const $ = new u.maps.Marker({
288
+ position: m,
289
+ draggable: !0
290
+ });
291
+ return b($, "dragend", (W) => {
292
+ l("marker-change", { index: V, position: y(W) });
293
+ }), $;
294
+ }), c(n.value);
295
+ }
296
+ function c(p) {
297
+ _.value.map((m) => we(m).setMap(p));
298
+ }
299
+ const C = E([]);
300
+ function x(p, m, V) {
301
+ w(p, m, V);
302
+ }
303
+ function o(p, m, V) {
304
+ w(p, m, V);
305
+ }
306
+ function e(p) {
307
+ return C.value[p].getPath().getArray().map(({ lat: V, lng: $ }) => ({
308
+ lat: V(),
309
+ lng: $()
310
+ }));
311
+ }
312
+ function a(p) {
313
+ const m = e(p);
314
+ l("polygon-change", { index: p, path: m });
315
+ }
316
+ function v(p, m) {
317
+ const $ = e(p).filter((W, O) => O !== m);
318
+ l("polygon-change", { index: p, path: $ });
319
+ }
320
+ function h(p, m) {
321
+ m.vertex !== void 0 ? v(p, m.vertex) : l("polygon-right-click", p);
322
+ }
323
+ function f(p) {
324
+ K(null), C.value = p.map((m, V) => {
325
+ const $ = new u.maps.Polygon({
326
+ paths: m.paths,
327
+ strokeColor: m.strokeColor,
328
+ fillColor: m.fillColor,
329
+ fillOpacity: 0.5,
330
+ editable: t.editable
331
+ });
332
+ return x($, "contextmenu", (W) => h(V, W)), $.getPaths().forEach((W) => {
333
+ o(W, "insert_at", () => a(V)), o(W, "set_at", () => a(V));
334
+ }), $;
335
+ }), K(n.value);
336
+ }
337
+ function K(p) {
338
+ C.value.map((m) => we(m).setMap(p));
339
+ }
340
+ function T(p, m, V) {
341
+ w(p, m, V);
342
+ }
343
+ function P() {
344
+ n.value = new u.maps.Map(i.value, {
345
+ center: t.center,
346
+ zoom: t.zoom,
347
+ mapTypeControl: !1,
348
+ streetViewControl: !1,
349
+ draggable: !0,
350
+ scrollwheel: !0
351
+ }), T(n.value, "click", (p) => l("map-click", y(p)));
352
+ }
353
+ return oe(() => t.markers, S, { deep: !0 }), oe(() => t.polygons, f, { deep: !0 }), ae(() => {
354
+ !i.value || !u || (P(), S(t.markers), f(t.polygons));
355
+ }), Fe(() => {
356
+ M.forEach((p) => p.remove());
357
+ }), (p, m) => (D(), B("div", {
358
+ ref_key: "mapRef",
359
+ ref: i,
360
+ class: "map app-map"
361
+ }, null, 512));
362
+ }
363
+ });
364
+ var ne = { exports: {} };
365
+ function Se(r, d = 100, s = {}) {
366
+ if (typeof r != "function")
367
+ throw new TypeError(`Expected the first parameter to be a function, got \`${typeof r}\`.`);
368
+ if (d < 0)
369
+ throw new RangeError("`wait` must not be negative.");
370
+ const { immediate: t } = typeof s == "boolean" ? { immediate: s } : s;
371
+ let l, u, i, n, M;
372
+ function y() {
373
+ const _ = Date.now() - n;
374
+ if (_ < d && _ >= 0)
375
+ i = setTimeout(y, d - _);
376
+ else if (i = void 0, !t) {
377
+ const b = l, S = u;
378
+ l = void 0, u = void 0, M = r.apply(b, S);
379
+ }
380
+ }
381
+ const w = function(..._) {
382
+ if (l && this !== l)
383
+ throw new Error("Debounced method called with different contexts.");
384
+ l = this, u = _, n = Date.now();
385
+ const b = t && !i;
386
+ if (i || (i = setTimeout(y, d)), b) {
387
+ const S = l, c = u;
388
+ l = void 0, u = void 0, M = r.apply(S, c);
389
+ }
390
+ return M;
391
+ };
392
+ return w.clear = () => {
393
+ i && (clearTimeout(i), i = void 0);
394
+ }, w.flush = () => {
395
+ if (!i)
396
+ return;
397
+ const _ = l, b = u;
398
+ l = void 0, u = void 0, M = r.apply(_, b), clearTimeout(i), i = void 0;
399
+ }, w;
400
+ }
401
+ ne.exports.debounce = Se;
402
+ ne.exports = Se;
403
+ var eo = ne.exports;
404
+ const oo = /* @__PURE__ */ Ne(eo), re = (r) => (Pe("data-v-ea67d23a"), r = r(), De(), r), to = { class: "flex flex-col gap-24" }, ao = { class: "flex flex-col gap-8" }, lo = /* @__PURE__ */ re(() => /* @__PURE__ */ g("span", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, "Address: ", -1)), so = { class: "fm-typo-en-body-lg-600" }, no = /* @__PURE__ */ re(() => /* @__PURE__ */ g("span", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, "Longitude: ", -1)), ro = { class: "fm-typo-en-body-lg-600" }, io = /* @__PURE__ */ re(() => /* @__PURE__ */ g("span", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, "Latitude: ", -1)), uo = { class: "fm-typo-en-body-lg-600" }, co = /* @__PURE__ */ I({
405
+ __name: "CoordinateDialog",
406
+ props: {
407
+ address: {
408
+ type: String,
409
+ required: !0
410
+ },
411
+ coordinate: {
412
+ type: Object,
413
+ default: void 0
414
+ }
415
+ },
416
+ setup(r) {
417
+ const d = r, s = Ze(), t = se(), l = Ee(
418
+ q(d.coordinate ? d.coordinate : G.jb)
419
+ ), u = E(""), i = oo(async function() {
420
+ u.value = await t.getFirstMatchingAddress(
421
+ l.lat,
422
+ l.lng
423
+ );
424
+ }, 1e3);
425
+ ae(() => {
426
+ s.emitData(q(l)), i();
427
+ });
428
+ function n({ position: y }) {
429
+ l.lat = y.lat, l.lng = y.lng, s.emitData(q(l)), i();
430
+ }
431
+ const M = E();
432
+ return (y, w) => (D(), B("div", to, [
433
+ g("div", ao, [
434
+ g("div", null, [
435
+ lo,
436
+ g("span", so, ee(u.value), 1)
437
+ ]),
438
+ g("div", null, [
439
+ no,
440
+ g("span", ro, ee(l.lng), 1)
441
+ ]),
442
+ g("div", null, [
443
+ io,
444
+ g("span", uo, ee(l.lat), 1)
445
+ ])
446
+ ]),
447
+ k(Ye, {
448
+ ref_key: "gmapRef",
449
+ ref: M,
450
+ class: "h-[272px] sm:h-[240px] xs:h-[240px]",
451
+ editable: "",
452
+ center: l,
453
+ markers: [l],
454
+ onMarkerChange: n,
455
+ onMapClick: w[0] || (w[0] = (_) => n({ position: _ }))
456
+ }, null, 8, ["center", "markers"])
457
+ ]));
458
+ }
459
+ }), po = /* @__PURE__ */ Ie(co, [["__scopeId", "data-v-ea67d23a"]]);
460
+ function Ae([r, d]) {
461
+ return {
462
+ lat: d,
463
+ lng: r
464
+ };
465
+ }
466
+ function mo({ lng: r, lat: d }) {
467
+ return [r, d];
468
+ }
469
+ const fo = { class: "flex gap-8 items-center" }, ho = { key: 0 }, go = { key: 1 }, yo = /* @__PURE__ */ I({
470
+ __name: "FmCoordinateInput",
471
+ props: {
472
+ address: {},
473
+ modelValue: {},
474
+ dialogTitle: {},
475
+ label: {},
476
+ helperText: {},
477
+ helperState: {},
478
+ labelMark: {},
479
+ labelInfo: {},
480
+ placeholder: {},
481
+ disabled: { type: Boolean },
482
+ rules: {}
483
+ },
484
+ emits: ["update:modelValue"],
485
+ setup(r, { emit: d }) {
486
+ const s = r, t = d, l = se(), u = xe(), i = le(), n = te(s, "modelValue"), M = E(!1);
487
+ function y(c) {
488
+ if (c != null && c[0] && (c != null && c[1]))
489
+ return `${c[0].toFixed(3)} Long ${c[1].toFixed(3)} Lat`;
490
+ }
491
+ async function w(c) {
492
+ var e, a;
493
+ const C = s.modelValue, x = !C && ((e = s.address) != null && e.formatted) ? await l.getFirstMatchingCoordinate(s.address.formatted) : null, o = C ? Ae(C) : x ? Ae(x) : G.jb;
494
+ u.open({
495
+ title: s.dialogTitle ?? s.label ?? "Pin location",
496
+ closeButton: !0,
497
+ contentComponent: po,
498
+ contentComponentProps: {
499
+ address: (a = s.address) == null ? void 0 : a.formatted,
500
+ coordinate: o
501
+ },
502
+ primaryActions: {
503
+ text: "Select",
504
+ close: !0
505
+ },
506
+ secondaryActions: {
507
+ text: "Close",
508
+ close: !0
509
+ }
510
+ }).onPrimary(c);
511
+ }
512
+ const _ = (c) => t("update:modelValue", c ? mo(c) : null);
513
+ async function b() {
514
+ if (!s.disabled) {
515
+ if (!l.isGoogleMapReady) {
516
+ i.open({
517
+ title: "Something went wrong",
518
+ message: "Cannot load map component. Please try again.",
519
+ type: "error"
520
+ });
521
+ return;
522
+ }
523
+ w(_);
524
+ }
525
+ }
526
+ function S() {
527
+ t("update:modelValue", null);
528
+ }
529
+ return (c, C) => {
530
+ const x = U("FmField"), o = U("FmButton"), e = U("FmFormGroup");
531
+ return D(), B("div", fo, [
532
+ k(e, {
533
+ class: "flex-1",
534
+ "model-value": A(n),
535
+ label: c.label,
536
+ disabled: c.disabled,
537
+ required: c.labelMark === "required",
538
+ optional: c.labelMark === "optional",
539
+ info: c.labelInfo,
540
+ rules: c.rules,
541
+ focused: M.value,
542
+ "helper-text": c.helperText,
543
+ "helper-state": c.helperState,
544
+ onClick: C[0] || (C[0] = (a) => b())
545
+ }, Te({
546
+ default: j(({ invalid: a }) => [
547
+ c.modelValue && c.modelValue[0] && c.modelValue[1] ? (D(), B("div", ho, [
548
+ k(x, {
549
+ invalid: a,
550
+ class: "fm-typo-en-body-lg-400"
551
+ }, {
552
+ default: j(() => [
553
+ Re(ee(y(c.modelValue)), 1)
554
+ ]),
555
+ _: 2
556
+ }, 1032, ["invalid"])
557
+ ])) : (D(), B("div", go, [
558
+ k(o, {
559
+ label: "Add coordinate",
560
+ "prepend-icon": "add",
561
+ variant: "plain"
562
+ })
563
+ ]))
564
+ ]),
565
+ _: 2
566
+ }, [
567
+ c.$slots.label ? {
568
+ name: "label",
569
+ fn: j(() => [
570
+ We(c.$slots, "label")
571
+ ]),
572
+ key: "0"
573
+ } : void 0
574
+ ]), 1032, ["model-value", "label", "disabled", "required", "optional", "info", "rules", "focused", "helper-text", "helper-state"]),
575
+ c.modelValue && c.modelValue[0] && c.modelValue[1] ? (D(), N(o, {
576
+ key: 0,
577
+ "prepend-icon": "delete",
578
+ variant: "tertiary",
579
+ onClick: C[1] || (C[1] = (a) => S())
580
+ })) : Me("", !0)
581
+ ]);
582
+ };
583
+ }
584
+ }), bo = { class: "flex flex-col gap-40" }, vo = { class: "flex flex-col gap-16" }, wo = { class: "flex flex-col gap-8" }, Vo = /* @__PURE__ */ g("div", { class: "fm-typo-en-title-sm-800" }, "Address", -1), _o = { class: "grid grid-cols-2 gap-24" }, ko = { class: "flex flex-col gap-8" }, Co = /* @__PURE__ */ g("div", { class: "fm-typo-en-title-sm-800" }, "Coordinate", -1), Ao = { class: "flex flex-col gap-8" }, Mo = /* @__PURE__ */ g("div", { class: "fm-typo-en-title-sm-800" }, "Contact", -1), xo = { class: "flex flex-col gap-16" }, $o = /* @__PURE__ */ I({
585
+ __name: "WarehouseForm",
586
+ props: {
587
+ modelValue: {},
588
+ disabled: { type: Boolean }
589
+ },
590
+ emits: ["update:modelValue", "validation-success"],
591
+ setup(r, { expose: d, emit: s }) {
592
+ const t = r, l = s, u = F({
593
+ get() {
594
+ var o, e;
595
+ return ((e = (o = t.modelValue) == null ? void 0 : o.profile) == null ? void 0 : e.name) ?? "";
596
+ },
597
+ set(o) {
598
+ const e = t.modelValue ?? {};
599
+ e.profile ?? (e.profile = {}), e.profile.name = o, l("update:modelValue", e);
600
+ }
601
+ }), i = F({
602
+ get() {
603
+ var o, e;
604
+ return ((e = (o = t.modelValue) == null ? void 0 : o.profile) == null ? void 0 : e.regNo) ?? "";
605
+ },
606
+ set(o) {
607
+ const e = t.modelValue ?? {};
608
+ e.profile ?? (e.profile = {}), e.profile.regNo = o, l("update:modelValue", e);
609
+ }
610
+ }), n = F({
611
+ get() {
612
+ var o, e, a;
613
+ return ((a = (e = (o = t.modelValue) == null ? void 0 : o.profile) == null ? void 0 : e.address) == null ? void 0 : a.line1) ?? "";
614
+ },
615
+ set(o) {
616
+ var a;
617
+ const e = t.modelValue ?? {};
618
+ e.profile ?? (e.profile = {}), (a = e.profile).address ?? (a.address = {}), e.profile.address.line1 = o, l("update:modelValue", e);
619
+ }
620
+ }), M = F({
621
+ get() {
622
+ var o, e, a;
623
+ return ((a = (e = (o = t.modelValue) == null ? void 0 : o.profile) == null ? void 0 : e.address) == null ? void 0 : a.line2) ?? "";
624
+ },
625
+ set(o) {
626
+ var a;
627
+ const e = t.modelValue ?? {};
628
+ e.profile ?? (e.profile = {}), (a = e.profile).address ?? (a.address = {}), e.profile.address.line2 = o, l("update:modelValue", e);
629
+ }
630
+ }), y = F({
631
+ get() {
632
+ var o, e, a;
633
+ return ((a = (e = (o = t.modelValue) == null ? void 0 : o.profile) == null ? void 0 : e.address) == null ? void 0 : a.city) ?? "";
634
+ },
635
+ set(o) {
636
+ var a;
637
+ const e = t.modelValue ?? {};
638
+ e.profile ?? (e.profile = {}), (a = e.profile).address ?? (a.address = {}), e.profile.address.city = o, l("update:modelValue", e);
639
+ }
640
+ }), w = F({
641
+ get() {
642
+ var o, e, a;
643
+ return ((a = (e = (o = t.modelValue) == null ? void 0 : o.profile) == null ? void 0 : e.address) == null ? void 0 : a.postcode) ?? "";
644
+ },
645
+ set(o) {
646
+ var a;
647
+ const e = t.modelValue ?? {};
648
+ e.profile ?? (e.profile = {}), (a = e.profile).address ?? (a.address = {}), e.profile.address.postcode = o, l("update:modelValue", e);
649
+ }
650
+ }), _ = F({
651
+ get() {
652
+ var o, e, a;
653
+ return ((a = (e = (o = t.modelValue) == null ? void 0 : o.profile) == null ? void 0 : e.address) == null ? void 0 : a.state) ?? "";
654
+ },
655
+ set(o) {
656
+ var a;
657
+ const e = t.modelValue ?? {};
658
+ e.profile ?? (e.profile = {}), (a = e.profile).address ?? (a.address = {}), e.profile.address.state = o, l("update:modelValue", e);
659
+ }
660
+ }), b = F({
661
+ get() {
662
+ var o, e, a;
663
+ return ((a = (e = (o = t.modelValue) == null ? void 0 : o.profile) == null ? void 0 : e.address) == null ? void 0 : a.country) ?? "";
664
+ },
665
+ set(o) {
666
+ var a;
667
+ const e = t.modelValue ?? {};
668
+ e.profile ?? (e.profile = {}), (a = e.profile).address ?? (a.address = {}), e.profile.address.country = o, l("update:modelValue", e);
669
+ }
670
+ }), S = F({
671
+ get() {
672
+ var o, e, a;
673
+ return ((a = (e = (o = t.modelValue) == null ? void 0 : o.profile) == null ? void 0 : e.address) == null ? void 0 : a.coordinates) ?? null;
674
+ },
675
+ set(o) {
676
+ var a;
677
+ const e = t.modelValue ?? {};
678
+ e.profile ?? (e.profile = {}), (a = e.profile).address ?? (a.address = {}), e.profile.address.coordinates = o, l("update:modelValue", e);
679
+ }
680
+ }), c = F({
681
+ get() {
682
+ var o, e;
683
+ return ((e = (o = t.modelValue) == null ? void 0 : o.profile) == null ? void 0 : e.phoneNo) ?? "";
684
+ },
685
+ set(o) {
686
+ const e = t.modelValue ?? {};
687
+ e.profile ?? (e.profile = {}), e.profile.phoneNo = o, l("update:modelValue", e);
688
+ }
689
+ }), C = F({
690
+ get() {
691
+ var o, e;
692
+ return ((e = (o = t.modelValue) == null ? void 0 : o.profile) == null ? void 0 : e.email) ?? "";
693
+ },
694
+ set(o) {
695
+ const e = t.modelValue ?? {};
696
+ e.profile ?? (e.profile = {}), e.profile.email = o, l("update:modelValue", e);
697
+ }
698
+ }), x = E();
699
+ return d({
700
+ validateInputs: () => {
701
+ var o, e;
702
+ (e = (o = x.value) == null ? void 0 : o.validateInputs) == null || e.call(o);
703
+ },
704
+ resetInputsValidation: () => {
705
+ var o, e;
706
+ (e = (o = x.value) == null ? void 0 : o.resetInputsValidation) == null || e.call(o);
707
+ },
708
+ resetInputs: () => {
709
+ var o, e;
710
+ (e = (o = x.value) == null ? void 0 : o.resetInputs) == null || e.call(o);
711
+ }
712
+ }), (o, e) => {
713
+ const a = U("FmTextField"), v = U("FmPhoneNumber"), h = U("FmForm");
714
+ return D(), N(h, {
715
+ ref_key: "formRef",
716
+ ref: x,
717
+ onValidationSuccess: e[11] || (e[11] = (f) => l("validation-success"))
718
+ }, {
719
+ default: j(() => [
720
+ g("div", bo, [
721
+ g("div", vo, [
722
+ k(a, {
723
+ disabled: o.disabled,
724
+ rules: [A(L)()],
725
+ "label-mark": "required",
726
+ label: "Company name",
727
+ modelValue: u.value,
728
+ "onUpdate:modelValue": e[0] || (e[0] = (f) => u.value = f)
729
+ }, null, 8, ["disabled", "rules", "modelValue"]),
730
+ k(a, {
731
+ disabled: o.disabled,
732
+ rules: [A(L)()],
733
+ "label-mark": "required",
734
+ label: "Registration no.",
735
+ modelValue: i.value,
736
+ "onUpdate:modelValue": e[1] || (e[1] = (f) => i.value = f)
737
+ }, null, 8, ["disabled", "rules", "modelValue"])
738
+ ]),
739
+ g("div", wo, [
740
+ Vo,
741
+ g("div", _o, [
742
+ k(a, {
743
+ disabled: o.disabled,
744
+ rules: [A(L)()],
745
+ "label-mark": "required",
746
+ label: "Line 1",
747
+ modelValue: n.value,
748
+ "onUpdate:modelValue": e[2] || (e[2] = (f) => n.value = f)
749
+ }, null, 8, ["disabled", "rules", "modelValue"]),
750
+ k(a, {
751
+ disabled: o.disabled,
752
+ "label-mark": "optional",
753
+ label: "Line 2",
754
+ modelValue: M.value,
755
+ "onUpdate:modelValue": e[3] || (e[3] = (f) => M.value = f)
756
+ }, null, 8, ["disabled", "modelValue"]),
757
+ k(a, {
758
+ disabled: o.disabled,
759
+ rules: [A(L)()],
760
+ "label-mark": "required",
761
+ label: "City",
762
+ modelValue: y.value,
763
+ "onUpdate:modelValue": e[4] || (e[4] = (f) => y.value = f)
764
+ }, null, 8, ["disabled", "rules", "modelValue"]),
765
+ k(a, {
766
+ disabled: o.disabled,
767
+ rules: [A(L)()],
768
+ "label-mark": "required",
769
+ label: "Postal code",
770
+ modelValue: w.value,
771
+ "onUpdate:modelValue": e[5] || (e[5] = (f) => w.value = f)
772
+ }, null, 8, ["disabled", "rules", "modelValue"]),
773
+ k(a, {
774
+ disabled: o.disabled,
775
+ rules: [A(L)()],
776
+ "label-mark": "required",
777
+ label: "State",
778
+ modelValue: _.value,
779
+ "onUpdate:modelValue": e[6] || (e[6] = (f) => _.value = f)
780
+ }, null, 8, ["disabled", "rules", "modelValue"]),
781
+ k(a, {
782
+ disabled: o.disabled,
783
+ rules: [A(L)()],
784
+ "label-mark": "required",
785
+ label: "Country",
786
+ modelValue: b.value,
787
+ "onUpdate:modelValue": e[7] || (e[7] = (f) => b.value = f)
788
+ }, null, 8, ["disabled", "rules", "modelValue"])
789
+ ])
790
+ ]),
791
+ g("div", ko, [
792
+ Co,
793
+ k(yo, {
794
+ disabled: o.disabled,
795
+ rules: [A(L)()],
796
+ "label-mark": "required",
797
+ modelValue: S.value,
798
+ "onUpdate:modelValue": e[8] || (e[8] = (f) => S.value = f)
799
+ }, null, 8, ["disabled", "rules", "modelValue"])
800
+ ]),
801
+ g("div", Ao, [
802
+ Mo,
803
+ g("div", xo, [
804
+ k(v, {
805
+ disabled: o.disabled,
806
+ rules: [A(L)()],
807
+ "label-mark": "required",
808
+ label: "Phone number",
809
+ modelValue: c.value,
810
+ "onUpdate:modelValue": e[9] || (e[9] = (f) => c.value = f)
811
+ }, null, 8, ["disabled", "rules", "modelValue"]),
812
+ k(a, {
813
+ disabled: o.disabled,
814
+ "label-mark": "optional",
815
+ label: "Email",
816
+ modelValue: C.value,
817
+ "onUpdate:modelValue": e[10] || (e[10] = (f) => C.value = f)
818
+ }, null, 8, ["disabled", "modelValue"])
819
+ ])
820
+ ])
821
+ ])
822
+ ]),
823
+ _: 1
824
+ }, 512);
825
+ };
826
+ }
827
+ }), So = { class: "flex gap-4" }, Fo = /* @__PURE__ */ I({
828
+ __name: "WarehouseDialog",
829
+ props: {
830
+ mode: {},
831
+ warehouse: {},
832
+ show: { type: Boolean }
833
+ },
834
+ emits: ["update:show", "submitted"],
835
+ setup(r, { expose: d, emit: s }) {
836
+ const t = r, l = s, u = E(!1), i = le(), n = $e(), M = F(() => {
837
+ switch (t.mode) {
838
+ case R.CREATE:
839
+ return "Add warehouse";
840
+ case R.READ:
841
+ return "View";
842
+ case R.UPDATE:
843
+ return "Edit warehouse";
844
+ }
845
+ return "";
846
+ }), y = F(() => {
847
+ switch (t.mode) {
848
+ case R.READ:
849
+ return "";
850
+ case R.UPDATE:
851
+ return "Save";
852
+ case R.CREATE:
853
+ return "Add";
854
+ }
855
+ return "";
856
+ }), w = E();
857
+ d({
858
+ validateInputs: () => {
859
+ var o, e;
860
+ (e = (o = w.value) == null ? void 0 : o.validateInputs) == null || e.call(o);
861
+ },
862
+ resetInputsValidation: () => {
863
+ var o, e;
864
+ (e = (o = w.value) == null ? void 0 : o.resetInputsValidation) == null || e.call(o);
865
+ },
866
+ resetInputs: () => {
867
+ var o, e;
868
+ (e = (o = w.value) == null ? void 0 : o.resetInputs) == null || e.call(o);
869
+ }
870
+ });
871
+ const _ = te(t, "show"), b = te(t, "warehouse");
872
+ function S() {
873
+ var o, e;
874
+ (e = (o = w.value) == null ? void 0 : o.validateInputs) == null || e.call(o);
875
+ }
876
+ function c() {
877
+ switch (t.mode) {
878
+ case R.READ:
879
+ return;
880
+ case R.UPDATE:
881
+ return x();
882
+ case R.CREATE:
883
+ return C();
884
+ }
885
+ }
886
+ async function C() {
887
+ var o, e, a, v;
888
+ u.value = !0;
889
+ try {
890
+ await Promise.all([
891
+ n.createWarehouse(b.value),
892
+ new Promise((h) => setTimeout(h, 1e3))
893
+ ]), i.open({
894
+ title: "Success",
895
+ message: `Created ${(e = (o = b.value) == null ? void 0 : o.profile) == null ? void 0 : e.name} warehouse`,
896
+ type: "success"
897
+ }), l("update:show", !1), l("submitted");
898
+ } catch (h) {
899
+ i.open({
900
+ title: "Something went wrong",
901
+ message: `Cannot create ${(v = (a = b.value) == null ? void 0 : a.profile) == null ? void 0 : v.name} warehouse. Please try again`,
902
+ type: "error"
903
+ }), console.error("cannot create warehouse", h);
904
+ } finally {
905
+ u.value = !1;
906
+ }
907
+ }
908
+ async function x() {
909
+ var o, e, a, v;
910
+ if (b.value === null) {
911
+ i.open({
912
+ title: "Something went wrong",
913
+ message: "Cannot update empty warehouse info",
914
+ type: "error"
915
+ });
916
+ return;
917
+ }
918
+ u.value = !0;
919
+ try {
920
+ await Promise.all([
921
+ n.updateWarehouse(b.value),
922
+ new Promise((h) => setTimeout(h, 1e3))
923
+ ]), i.open({
924
+ title: "Success",
925
+ message: `Updated ${(e = (o = b.value) == null ? void 0 : o.profile) == null ? void 0 : e.name} warehouse`,
926
+ type: "success"
927
+ }), l("update:show", !1), l("submitted");
928
+ } catch (h) {
929
+ i.open({
930
+ title: "Something went wrong",
931
+ message: `Cannot update ${(v = (a = b.value) == null ? void 0 : a.profile) == null ? void 0 : v.name} warehouse. Please try again`,
932
+ type: "error"
933
+ }), console.error("cannot update warehouse", h);
934
+ } finally {
935
+ u.value = !1;
936
+ }
937
+ }
938
+ return (o, e) => {
939
+ const a = U("FmButton"), v = U("FmSideSheet");
940
+ return D(), N(v, {
941
+ header: M.value,
942
+ modelValue: A(_),
943
+ "onUpdate:modelValue": e[1] || (e[1] = (h) => Ve(_) ? _.value = h : null),
944
+ "dismiss-away": !u.value,
945
+ "close-button": "",
946
+ "max-width": 500
947
+ }, {
948
+ default: j(() => {
949
+ var h;
950
+ return [
951
+ (D(), N($o, {
952
+ class: "w-full",
953
+ ref_key: "formRef",
954
+ ref: w,
955
+ modelValue: A(b),
956
+ "onUpdate:modelValue": e[0] || (e[0] = (f) => Ve(b) ? b.value = f : null),
957
+ onValidationSuccess: c,
958
+ key: ((h = o.warehouse) == null ? void 0 : h._id) ?? "",
959
+ disabled: u.value
960
+ }, null, 8, ["modelValue", "disabled"]))
961
+ ];
962
+ }),
963
+ "side-sheet-footer": j(() => [
964
+ g("div", So, [
965
+ k(a, {
966
+ loading: u.value,
967
+ label: y.value,
968
+ onClick: S
969
+ }, null, 8, ["loading", "label"])
970
+ ])
971
+ ]),
972
+ _: 1
973
+ }, 8, ["header", "modelValue", "dismiss-away"]);
974
+ };
975
+ }
976
+ }), Eo = { class: "px-24 xs:p-0 sm:p-0 flex flex-col gap-8 max-h-full" }, Po = { class: "px-8 flex gap-8 items-center xs:gap-0 xs:flex-col-reverse sm:gap-0 sm:flex-col-reverse" }, Do = { class: "flex-1 w-full" }, To = { class: "flex flex-col py-8" }, Ro = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, Wo = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Uo = {
977
+ key: 0,
978
+ class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary"
979
+ }, Lo = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary line-clamp-3" }, Oo = /* @__PURE__ */ I({
980
+ __name: "WarehouseView",
981
+ setup(r) {
982
+ const d = $e(), s = qe(), t = F(() => d.warehouses), l = xe(), u = le(), i = E(!1);
983
+ ae(() => {
984
+ s._currentLocation && x();
985
+ }), oe([() => s._currentLocation], () => {
986
+ s._currentLocation && x();
987
+ });
988
+ const n = E({});
989
+ function M() {
990
+ n.value.mode = R.CREATE, n.value.warehouse = {}, n.value.show = !0;
991
+ }
992
+ function y(v) {
993
+ n.value.mode = R.UPDATE, n.value.warehouse = v, n.value.show = !0;
994
+ }
995
+ async function w(v) {
996
+ l.open({
997
+ title: "Delete warehouse?",
998
+ message: `Confirm deleting ${v.profile.name}?`,
999
+ primaryActions: {
1000
+ text: "Delete",
1001
+ close: !0,
1002
+ variant: "destructive"
1003
+ },
1004
+ secondaryActions: {
1005
+ text: "Cancel",
1006
+ close: !0
1007
+ }
1008
+ }).onPrimary(() => _(v));
1009
+ }
1010
+ async function _(v) {
1011
+ l.open({
1012
+ title: "Deleting warehouse...",
1013
+ closeButton: !1
1014
+ });
1015
+ try {
1016
+ await d.deleteWarehouse(v), u.open({
1017
+ title: "Success",
1018
+ message: `Deleted ${v.profile.name}.`,
1019
+ type: "success"
1020
+ }), await x(!0);
1021
+ } catch (h) {
1022
+ u.open({
1023
+ title: "Something went wrong",
1024
+ message: `Cannot delete ${v.profile.name}. Please try again.`,
1025
+ type: "error"
1026
+ }), console.error("failed to delete warehouse", h);
1027
+ } finally {
1028
+ l.close();
1029
+ }
1030
+ }
1031
+ const { columnDefs: b, formatRowData: S } = Xe(
1032
+ y,
1033
+ w
1034
+ );
1035
+ function c(v) {
1036
+ v === "create" && M();
1037
+ }
1038
+ const C = E("");
1039
+ async function x(v = !1) {
1040
+ i.value = !0;
1041
+ try {
1042
+ await d.readWarehouses(), v && await s.readLocations();
1043
+ } catch {
1044
+ u.open({
1045
+ title: "Cannot fetch warehouse list",
1046
+ type: "error"
1047
+ });
1048
+ } finally {
1049
+ i.value = !1;
1050
+ }
1051
+ }
1052
+ const { breakpoints: o } = Je(), e = F(() => o.value.xs || o.value.sm ? 10 : 20), a = Oe();
1053
+ return (v, h) => {
1054
+ const f = U("FmTableToolbar"), K = U("FmTable");
1055
+ return D(), N(He, {
1056
+ title: "Warehouse",
1057
+ actions: [{ label: "Create warehouse", value: "create", isPrimary: !0, prependIcon: "add" }],
1058
+ "onClick:action": c
1059
+ }, {
1060
+ default: j(() => [
1061
+ g("div", Eo, [
1062
+ g("div", Po, [
1063
+ g("div", Do, [
1064
+ k(f, {
1065
+ class: "xs:px-8",
1066
+ searchable: "",
1067
+ "search-model": C.value,
1068
+ "onUpdate:searchModel": h[0] || (h[0] = (T) => C.value = T)
1069
+ }, null, 8, ["search-model"])
1070
+ ])
1071
+ ]),
1072
+ (D(), N(K, {
1073
+ style: Ue(A(a).tableHeight),
1074
+ "column-defs": A(b),
1075
+ "row-data": A(S)(t.value),
1076
+ "search-value": C.value,
1077
+ loading: !A(s)._currentLocation || i.value,
1078
+ onRowClick: h[1] || (h[1] = (T) => y(T.original.original)),
1079
+ key: t.value.length,
1080
+ "page-size": e.value
1081
+ }, {
1082
+ "list-row": j((T) => [
1083
+ k(Ke, {
1084
+ row: T,
1085
+ onRowClick: (P) => y(P.original)
1086
+ }, {
1087
+ default: j((P) => {
1088
+ var p, m, V, $, W, O, ie, de, H, ue, ce, pe, me, fe, Z, he, ge, ye, be, J, ve;
1089
+ return [
1090
+ g("div", To, [
1091
+ g("div", Ro, [
1092
+ k(A(X), {
1093
+ render: (V = (m = (p = P.warehouse) == null ? void 0 : p.column) == null ? void 0 : m.columnDef) == null ? void 0 : V.cell,
1094
+ props: (W = ($ = P.warehouse) == null ? void 0 : $.getContext) == null ? void 0 : W.call($)
1095
+ }, null, 8, ["render", "props"])
1096
+ ]),
1097
+ g("div", Wo, [
1098
+ k(A(X), {
1099
+ render: (de = (ie = (O = P.contact) == null ? void 0 : O.column) == null ? void 0 : ie.columnDef) == null ? void 0 : de.cell,
1100
+ props: (ue = (H = P.contact) == null ? void 0 : H.getContext) == null ? void 0 : ue.call(H)
1101
+ }, null, 8, ["render", "props"])
1102
+ ]),
1103
+ (ce = T.original) != null && ce.email ? (D(), B("div", Uo, [
1104
+ k(A(X), {
1105
+ render: (fe = (me = (pe = P.email) == null ? void 0 : pe.column) == null ? void 0 : me.columnDef) == null ? void 0 : fe.cell,
1106
+ props: (he = (Z = P.email) == null ? void 0 : Z.getContext) == null ? void 0 : he.call(Z)
1107
+ }, null, 8, ["render", "props"])
1108
+ ])) : Me("", !0),
1109
+ g("div", Lo, [
1110
+ k(A(X), {
1111
+ render: (be = (ye = (ge = P.address) == null ? void 0 : ge.column) == null ? void 0 : ye.columnDef) == null ? void 0 : be.cell,
1112
+ props: (ve = (J = P.address) == null ? void 0 : J.getContext) == null ? void 0 : ve.call(J)
1113
+ }, null, 8, ["render", "props"])
1114
+ ])
1115
+ ])
1116
+ ];
1117
+ }),
1118
+ _: 2
1119
+ }, 1032, ["row", "onRowClick"])
1120
+ ]),
1121
+ _: 1
1122
+ }, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"]))
1123
+ ]),
1124
+ k(Fo, {
1125
+ show: n.value.show,
1126
+ "onUpdate:show": h[2] || (h[2] = (T) => n.value.show = T),
1127
+ warehouse: n.value.warehouse,
1128
+ mode: n.value.mode,
1129
+ onSubmitted: h[3] || (h[3] = (T) => x(!0))
1130
+ }, null, 8, ["show", "warehouse", "mode"])
1131
+ ]),
1132
+ _: 1
1133
+ });
1134
+ };
1135
+ }
1136
+ });
1137
+ export {
1138
+ Oo as default
1139
+ };