@feedmepos/mf-inventory-portal 0.0.19-dev.9 → 0.0.20-dev.1

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 (196) hide show
  1. package/dist/App.vue.d.ts +1 -1
  2. package/dist/{ApprovalView-Bcxk6B7K.js → ApprovalView-CF-RhtHH.js} +5 -5
  3. package/dist/{BindingsDialog-XDkcjW_c.js → BindingsDialog-0_fCmf7t.js} +26 -26
  4. package/dist/{BindingsPicker-CgbiqX72.js → BindingsPicker-CT-56t-W.js} +17 -17
  5. package/dist/BindingsTable-DEftAnTN.js +120 -0
  6. package/dist/Entry.vue.d.ts +1 -1
  7. package/dist/FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-6yg6_JPe.js +308 -0
  8. package/dist/IngredientsView-Au6oRwF2.js +1663 -0
  9. package/dist/{IntegrationView-CErHEVAO.js → IntegrationView-D7hqf0P5.js} +278 -278
  10. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-XXoPyhlc.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-HcOKpAlW.js} +1 -1
  11. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-BpyUheXn.js → PremiumBadge.vue_vue_type_script_setup_true_lang-BTOE1vFl.js} +1 -1
  12. package/dist/PurchaseOrderPrintPreview-C92PdleC.js +152 -0
  13. package/dist/{ReceiveRequestView-BKbeFDxm.js → ReceiveRequestView-BaxEQWOD.js} +8 -8
  14. package/dist/{RecipeView-Drp4l4gL.js → RecipeView-CDgZpLPk.js} +181 -181
  15. package/dist/Standalone.vue.d.ts +1 -1
  16. package/dist/{StockView-Cj6fErwD.js → StockView-B77CrARl.js} +498 -502
  17. package/dist/SupplierView-DQ3hB7q2.js +819 -0
  18. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-lsyakQIl.js +738 -0
  19. package/dist/TransferDialog.vue_vue_type_script_setup_true_lang-DN7NCT72.js +1435 -0
  20. package/dist/TransferTemplateView-Dt04xMCK.js +1290 -0
  21. package/dist/{UnitView-C_tAxIpq.js → UnitView-DlmlVNOx.js} +242 -242
  22. package/dist/{WarehouseView-BAqVtbD6.js → WarehouseView-DXWls5vv.js} +360 -362
  23. package/dist/api/bill.d.ts +238 -84
  24. package/dist/api/inventory.d.ts +3 -3
  25. package/dist/api/purchase-order-template.d.ts +4 -0
  26. package/dist/api/stock.d.ts +0 -8
  27. package/dist/api/supplier.d.ts +2 -0
  28. package/dist/app-P7rGzGsF.js +68600 -0
  29. package/dist/app.d.ts +200 -7
  30. package/dist/app.js +3 -3
  31. package/dist/{array-AvWd53LI.js → array-ClJzD_Lt.js} +3 -3
  32. package/dist/components/ChangeLocationComponent.vue.d.ts +14 -1
  33. package/dist/components/DeferableLoading.vue.d.ts +1 -1
  34. package/dist/components/DeleteDialog.vue.d.ts +1 -1
  35. package/dist/components/FmCoordinateInput.vue.d.ts +3 -3
  36. package/dist/components/FmDroppableField.vue.d.ts +6 -6
  37. package/dist/components/FmFilterableSelect.vue.d.ts +3 -3
  38. package/dist/components/FmInventoryTableToolbar.vue.d.ts +19 -10
  39. package/dist/components/FmMinMaxInput.vue.d.ts +20 -0
  40. package/dist/components/FmMinMaxInputProps.d.ts +16 -0
  41. package/dist/components/FmMinMaxInputRules.d.ts +4 -0
  42. package/dist/components/FmMultiselectDialog.vue.d.ts +5 -5
  43. package/dist/components/FmMultiselectDialogProps.d.ts +14 -1
  44. package/dist/components/FmUnitInputRules.d.ts +1 -0
  45. package/dist/components/MultiSelectDialog.vue.d.ts +1 -1
  46. package/dist/components/NavigationTab.vue.d.ts +1 -1
  47. package/dist/components/NumberPrecisionInput.vue.d.ts +3 -3
  48. package/dist/components/PremiumBadge.vue.d.ts +3 -3
  49. package/dist/components/PreviewBadge.vue.d.ts +3 -3
  50. package/dist/components/StockForecast.vue.d.ts +1 -1
  51. package/dist/components/TableActionableRow.vue.d.ts +4 -4
  52. package/dist/components/UnitDisplayControl.vue.d.ts +1 -1
  53. package/dist/components/icons/IconCommunity.vue.d.ts +1 -1
  54. package/dist/components/icons/IconDocumentation.vue.d.ts +1 -1
  55. package/dist/components/icons/IconEcosystem.vue.d.ts +1 -1
  56. package/dist/components/icons/IconSupport.vue.d.ts +1 -1
  57. package/dist/components/icons/IconTooling.vue.d.ts +1 -1
  58. package/dist/components/inventory-binding/InventoryBinding.vue.d.ts +6 -6
  59. package/dist/components/map/CoordinateDialog.vue.d.ts +4 -4
  60. package/dist/components/map/GoogleMap.vue.d.ts +6 -6
  61. package/dist/components/nested-multiselect/FmNestedMultiselectDialog.vue.d.ts +3 -3
  62. package/dist/components/row-action.enum.d.ts +3 -1
  63. package/dist/components/shell/inventory/binding-dialog.vue.d.ts +3 -3
  64. package/dist/components/shell/inventory/binding-ui.vue.d.ts +6 -6
  65. package/dist/components/ui-library/FmDateRangePickerChip.vue.d.ts +5 -5
  66. package/dist/composable/useIframe.d.ts +1 -1
  67. package/dist/composable/useSearch.d.ts +1 -1
  68. package/dist/{decimal-D3KXLC4T.js → decimal-4ONRlhOO.js} +1 -1
  69. package/dist/format-unit-display-DJpElzu_.js +707 -0
  70. package/dist/helper/number.d.ts +2 -0
  71. package/dist/{id-to-date-Cj02m808.js → id-to-date-D8Ey2CVj.js} +1 -1
  72. package/dist/is-linked-ingredient-error-fJ2TJb3z.js +37 -0
  73. package/dist/layout/InventoryLayout.vue.d.ts +1 -1
  74. package/dist/layout/SingleColumnLayout.vue.d.ts +6 -5
  75. package/dist/layout/components/NavigationButton.vue.d.ts +4 -4
  76. package/dist/layout-D-zXtsSp.js +151 -0
  77. package/dist/row-action.enum-PMKMRrZR.js +50 -0
  78. package/dist/stores/feature.d.ts +5 -1
  79. package/dist/stores/inventory.d.ts +4 -4
  80. package/dist/stores/location.d.ts +185 -152
  81. package/dist/stores/supplier.d.ts +666 -12
  82. package/dist/stores/warehouse.d.ts +17 -5
  83. package/dist/supplier-DsUIjl-L.js +69 -0
  84. package/dist/tsconfig.app.tsbuildinfo +1 -1
  85. package/dist/views/InventoryView.vue.d.ts +1 -1
  86. package/dist/views/SelectBussinessDialog.vue.d.ts +1 -1
  87. package/dist/views/approval/ApprovalView.vue.d.ts +1 -1
  88. package/dist/views/dev/ComponentPreview.vue.d.ts +1 -1
  89. package/dist/views/dev/components/CoordinateTest.vue.d.ts +1 -1
  90. package/dist/views/dev/components/DateRange.vue.d.ts +1 -1
  91. package/dist/views/dev/components/FmDecimalInputTest.vue.d.ts +1 -1
  92. package/dist/views/dev/components/FmMultiselectDialogGrouped.vue.d.ts +2 -0
  93. package/dist/views/dev/components/FmSelectTest.vue.d.ts +1 -1
  94. package/dist/views/dev/components/InventoryIframe.vue.d.ts +1 -1
  95. package/dist/views/dev/components/LayoutDev.vue.d.ts +1 -1
  96. package/dist/views/dev/components/MfCommontTest.vue.d.ts +1 -1
  97. package/dist/views/dev/components/NestedSelection.vue.d.ts +1 -1
  98. package/dist/views/dev/components/NumberStepper.vue.d.ts +1 -1
  99. package/dist/views/dev/components/TabStorageTest.vue.d.ts +1 -1
  100. package/dist/views/dev/components/UnitInput.vue.d.ts +1 -1
  101. package/dist/views/dev/helpers/pinia-test.d.ts +1 -1
  102. package/dist/views/home/HomeView.vue.d.ts +1 -1
  103. package/dist/views/iframe/inventory-bindings/bindings-dialog/BindingsDialog.vue.d.ts +1 -1
  104. package/dist/views/iframe/inventory-bindings/bindings-picker/BindingsPicker.vue.d.ts +1 -1
  105. package/dist/views/iframe/inventory-bindings/bindings-table/BindingsTable.vue.d.ts +1 -1
  106. package/dist/views/ingredients/IngredientsView.vue.d.ts +1 -1
  107. package/dist/views/ingredients/components/cannot-delete/CannotDelete.vue.d.ts +4 -4
  108. package/dist/views/ingredients/components/convert/ConvertForm.vue.d.ts +3 -3
  109. package/dist/views/ingredients/components/import-ingredients/ImportIngredientItem.vue.d.ts +1 -1
  110. package/dist/views/ingredients/components/import-ingredients/ImportIngredients.vue.d.ts +1 -1
  111. package/dist/views/ingredients/components/ingredient-binded-item/IngredientBindedItem.vue.d.ts +1 -1
  112. package/dist/views/ingredients/components/ingredient-dialog/IngredientDialog.vue.d.ts +5 -5
  113. package/dist/views/ingredients/components/ingredient-form/IngredientForm.vue.d.ts +6 -6
  114. package/dist/views/ingredients/components/inventory-binding/InventoryBindingForm.vue.d.ts +5 -5
  115. package/dist/views/ingredients/components/inventory-binding/InventoryBindingSummary.vue.d.ts +3 -3
  116. package/dist/views/ingredients/composables/use-ingredient-form.d.ts +8 -8
  117. package/dist/views/ingredients/composables/use-ingredient-table.d.ts +1 -1
  118. package/dist/views/integration/IntegrationView.vue.d.ts +1 -1
  119. package/dist/views/integration/components/ApplyAddon.vue.d.ts +5 -5
  120. package/dist/views/integration/components/ApplyProduct.vue.d.ts +5 -5
  121. package/dist/views/integration/components/ApplyProductDialog.vue.d.ts +5 -5
  122. package/dist/views/integration/components/ApplyProductDialogV4.vue.d.ts +5 -5
  123. package/dist/views/receive-request/ReceiveRequestView.vue.d.ts +1 -1
  124. package/dist/views/receive-request/components/select-template-dialog/SelectTemplateDialog.vue.d.ts +8 -0
  125. package/dist/views/receive-request/components/supplier-price-history/SupplierPriceHistory.vue.d.ts +1 -1
  126. package/dist/views/receive-request/components/transfer-details/TransferDetails.vue.d.ts +3 -3
  127. package/dist/views/receive-request/components/transfer-dialog/TransferDialog.vue.d.ts +4 -4
  128. package/dist/views/receive-request/components/transfer-dialog/TransferDialogProps.d.ts +1 -1
  129. package/dist/views/receive-request/components/transfer-form/SparkIcon.vue.d.ts +4 -4
  130. package/dist/views/receive-request/components/transfer-form/TransferForm.vue.d.ts +34 -32
  131. package/dist/views/receive-request/components/transfer-form/TransferForm2.vue.d.ts +8 -2
  132. package/dist/views/receive-request/components/transfer-form/TransferFormProps.d.ts +1 -0
  133. package/dist/views/receive-request/components/transfer-form/components/ForecastStock.vue.d.ts +6 -6
  134. package/dist/views/receive-request/components/transfer-form/components/TransferItem.vue.d.ts +3 -3
  135. package/dist/views/receive-request/components/transfer-form/components/TransferItemTable.vue.d.ts +3 -3
  136. package/dist/views/receive-request/components/transfer-form/composables/use-backdate-po.d.ts +4 -4
  137. package/dist/views/receive-request/components/transfer-form/composables/use-compare-price.d.ts +3 -3
  138. package/dist/views/receive-request/components/transfer-form/composables/use-transfer-items.d.ts +2 -9
  139. package/dist/views/receive-request/composables/use-receive-request-form.d.ts +1016 -70
  140. package/dist/views/receive-request/composables/use-receive-request-table.d.ts +36 -36
  141. package/dist/views/receive-request/print-preview/PurchaseOrderPrintPreview.vue.d.ts +1 -1
  142. package/dist/views/recipe/RecipeView.vue.d.ts +1 -1
  143. package/dist/views/recipe/components/recipe-dialog/RecipeDialog.vue.d.ts +5 -5
  144. package/dist/views/recipe/components/recipe-form/RecipeForm.vue.d.ts +4 -4
  145. package/dist/views/recipe/composables/use-recipe-form.d.ts +8 -8
  146. package/dist/views/stock/StockView.vue.d.ts +1 -1
  147. package/dist/views/stock/components/StockHeaderPreview.vue.d.ts +1 -1
  148. package/dist/views/stock/components/StockHistory.vue.d.ts +3 -3
  149. package/dist/views/stock/components/StockRecordCard.vue.d.ts +123 -46
  150. package/dist/views/stock/components/dialog/AdjustSkuDialog.vue.d.ts +4 -4
  151. package/dist/views/stock/components/dialog/AdjustedItemForm.vue.d.ts +5 -5
  152. package/dist/views/stock/components/dialog/ConvertSkuDialog.vue.d.ts +4 -4
  153. package/dist/views/stock/composables/use-stock-action.d.ts +11 -11
  154. package/dist/views/stock/helper/stock-row-action.d.ts +4 -2
  155. package/dist/views/supplier/SupplierView.vue.d.ts +1 -1
  156. package/dist/views/supplier/components/SupplierDialog.vue.d.ts +4 -4
  157. package/dist/views/supplier/components/SupplierForm.vue.d.ts +10 -10
  158. package/dist/views/supplier/components/SupplierSupplyItemField.vue.d.ts +3 -3
  159. package/dist/views/supplier/composables/use-supplier-table.d.ts +3 -3
  160. package/dist/views/transfer-template/TransferTemplateView.vue.d.ts +1 -1
  161. package/dist/views/transfer-template/components/transfer-template-details/TransferTemplateDetails.vue.d.ts +20 -0
  162. package/dist/views/transfer-template/components/transfer-template-details/TransferTemplateDetailsProps.d.ts +9 -0
  163. package/dist/views/transfer-template/components/transfer-template-dialog/TransferTemplateDialog.vue.d.ts +4 -4
  164. package/dist/views/transfer-template/components/transfer-template-form/TransferTemplateForm.vue.d.ts +2 -2
  165. package/dist/views/transfer-template/components/transfer-template-form/components/TransferTemplateItem.vue.d.ts +3 -3
  166. package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-locations.d.ts +7 -7
  167. package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-template-items.d.ts +15 -9
  168. package/dist/views/transfer-template/composables/use-transfer-template-actions.d.ts +1428 -43
  169. package/dist/views/transfer-template/composables/use-transfer-template-table.d.ts +893 -13
  170. package/dist/views/unit/UnitView.vue.d.ts +1 -1
  171. package/dist/views/unit/components/unit-dialog/UnitDialog.vue.d.ts +5 -5
  172. package/dist/views/unit/components/unit-form/UnitForm.vue.d.ts +4 -4
  173. package/dist/views/unit/components/unit-summary/UnitSummary.vue.d.ts +3 -3
  174. package/dist/views/unit/components/unit-used-by/UnitUsedBy.vue.d.ts +1 -1
  175. package/dist/views/unit/composables/use-unit-form.d.ts +8 -8
  176. package/dist/views/warehouse/WarehouseView.vue.d.ts +1 -1
  177. package/dist/views/warehouse/components/WarehouseDialog.vue.d.ts +4 -4
  178. package/dist/views/warehouse/components/WarehouseForm.vue.d.ts +38 -14
  179. package/dist/{xlsx-B-2KyDJq.js → xlsx-zfERRe6K.js} +3383 -3383
  180. package/dist/{xlsx.util-D6EzRE71.js → xlsx.util-DnbiJzsk.js} +4 -4
  181. package/package.json +6 -5
  182. package/dist/BindingsTable-xNXNsBAd.js +0 -145
  183. package/dist/FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DFPkUHl-.js +0 -272
  184. package/dist/IngredientsView-DD7ns3mP.js +0 -1751
  185. package/dist/PurchaseOrderPrintPreview-L_iaaURb.js +0 -152
  186. package/dist/SupplierView-EFsHWet-.js +0 -801
  187. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-kM5fyqq6.js +0 -745
  188. package/dist/TransferDialog.vue_vue_type_script_setup_true_lang-CyFMCmXw.js +0 -1605
  189. package/dist/TransferTemplateView-Cymhrayh.js +0 -933
  190. package/dist/app-CeUU5Gd8.js +0 -66938
  191. package/dist/is-linked-ingredient-error-C6AghEwR.js +0 -37
  192. package/dist/layout-2zzAZIVO.js +0 -147
  193. package/dist/purchase-order-transaction-type-Dz0YF5qh.js +0 -294
  194. package/dist/row-action.enum-7jVyol1k.js +0 -36
  195. package/dist/supplier-mDVKd7Ge.js +0 -54
  196. package/dist/views/stock/components/StockRecalculateDialog.vue.d.ts +0 -9
@@ -1,22 +1,22 @@
1
- import { ref as R, defineComponent as re, computed as T, resolveComponent as D, openBlock as B, createBlock as O, withCtx as C, createElementVNode as n, normalizeClass as Ce, toDisplayString as g, createVNode as x, createElementBlock as L, Fragment as te, renderList as ae, unref as v, h as ye, watch as he, isRef as Ue, createCommentVNode as ee, reactive as it, onMounted as Je, normalizeStyle as Qe, createTextVNode as ve, Teleport as ut, normalizeProps as $e, mergeProps as we } from "vue";
2
- import { i as ct, _ as dt, a as mt } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DFPkUHl-.js";
3
- import { n as Xe, j as ue, o as pt, c as Pe, p as vt, u as Te, q as Oe, r as De, a as ie, k as ft, t as be, m as Me, A as yt, M as _t, l as fe, s as kt, v as Z, w as ht, x as ze, R as bt, y as gt, z as xt, B as Ze, D as q, E as St, f as et, G as je, H as $t, d as Ye, b as wt, J as Bt, K as Ft, C as Be, L as At, N as Vt, O as Ct, P as Dt } from "./app-CeUU5Gd8.js";
1
+ import { ref as R, defineComponent as re, computed as T, resolveComponent as D, openBlock as B, createBlock as O, withCtx as C, createElementVNode as n, normalizeClass as Ce, toDisplayString as g, createVNode as b, createElementBlock as L, Fragment as te, renderList as ae, unref as v, h as ye, watch as he, isRef as Ie, createCommentVNode as ee, reactive as it, onMounted as Je, normalizeStyle as Qe, createTextVNode as ve, Teleport as ut, normalizeProps as $e, mergeProps as we } from "vue";
2
+ import { i as ct, _ as dt, a as mt } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-6yg6_JPe.js";
3
+ import { n as Xe, j as ue, o as pt, c as Pe, p as vt, u as Te, q as Oe, r as De, a as ie, k as ft, t as ge, m as Me, A as yt, M as _t, l as fe, s as kt, v as Z, w as ht, x as ze, R as gt, y as bt, z as xt, B as Ze, D as q, E as St, f as et, G as je, H as $t, d as Ye, b as wt, J as Bt, K as Ft, C as Be, L as Vt, N as At, O as Ct, P as Dt } from "./app-P7rGzGsF.js";
4
4
  import { useCoreStore as tt, useI18n as le } from "@feedmepos/mf-common";
5
5
  import { useSnackbar as de, useDialog as nt, useProxiedModel as Re, useBreakpoints as Mt } from "@feedmepos/ui-library";
6
- import { c as jt, _ as It, F as Ke, u as Ut } from "./layout-2zzAZIVO.js";
7
- import { g as ge } from "./decimal-D3KXLC4T.js";
8
- import { e as Pt, i as ot } from "./id-to-date-Cj02m808.js";
9
- import { _ as Ie, S as Fe, g as st } from "./StockForecast.vue_vue_type_style_index_0_lang-KLXSWvo5.js";
6
+ import { c as jt, _ as Ut, F as Ke, u as It } from "./layout-D-zXtsSp.js";
7
+ import { g as be } from "./decimal-4ONRlhOO.js";
8
+ import { e as Pt, i as ot } from "./id-to-date-D8Ey2CVj.js";
9
+ import { _ as Ue, S as Fe, g as st } from "./StockForecast.vue_vue_type_style_index_0_lang-KLXSWvo5.js";
10
10
  import { _ as Tt } from "./PreviewBadge.vue_vue_type_script_setup_true_lang-CRZiQHjx.js";
11
- import { u as at, _ as Ge } from "./PremiumBadge.vue_vue_type_script_setup_true_lang-BpyUheXn.js";
11
+ import { u as at, _ as Ge } from "./PremiumBadge.vue_vue_type_script_setup_true_lang-BTOE1vFl.js";
12
12
  import { defineStore as Rt } from "pinia";
13
- import { _ as Ht } from "./NumberPrecisionInput.vue_vue_type_script_setup_true_lang-XXoPyhlc.js";
13
+ import { _ as Ht } from "./NumberPrecisionInput.vue_vue_type_script_setup_true_lang-HcOKpAlW.js";
14
14
  import { E as Et } from "./empty-placeholder-wf6-BWE8.js";
15
- import "./array-AvWd53LI.js";
16
- const Se = Xe((c, d) => {
17
- const r = ue(), s = tt(), S = de();
18
- return d.onError(async (l) => {
19
- l.name === "SvcForbiddenError" && (S == null || S.open({
15
+ import "./array-ClJzD_Lt.js";
16
+ const Se = Xe((c, m) => {
17
+ const r = ue(), s = tt(), x = de();
18
+ return m.onError(async (l) => {
19
+ l.name === "SvcForbiddenError" && (x == null || x.open({
20
20
  title: l.title,
21
21
  message: l.message,
22
22
  type: "error"
@@ -24,42 +24,30 @@ const Se = Xe((c, d) => {
24
24
  }), {
25
25
  async readStockBalance() {
26
26
  const l = r.currentLocationDBName, a = `${c.inventoryBackendUrl}/${l}/stock-balance`;
27
- return await d.get(a);
27
+ return await m.get(a);
28
28
  },
29
29
  async readSkuBalance() {
30
- var h;
30
+ var S;
31
31
  const l = r.currentLocationDBName, a = `${c.inventoryBackendUrl}/${l}/sku/balance`;
32
- return (((h = s.currentBusiness.value) == null ? void 0 : h.menuVersion) ?? "") === "v3" ? await d.get(a) : await d.get(`${a}?useInventoryDoc=true`);
32
+ return (((S = s.currentBusiness.value) == null ? void 0 : S.menuVersion) ?? "") === "v3" ? await m.get(a) : await m.get(`${a}?useInventoryDoc=true`);
33
33
  },
34
34
  async readSingleAdjustment(l) {
35
- const a = r.currentLocationDBName, i = `${c.inventoryBackendUrl}/${a}/adjustment`;
36
- return await d.get(`${i}?adjustmentId=${l}`);
35
+ const a = r.currentLocationDBName, u = `${c.inventoryBackendUrl}/${a}/adjustment`;
36
+ return await m.get(`${u}?adjustmentId=${l}`);
37
37
  },
38
- async readStockAdjustment(l, a, i) {
39
- const h = r.currentLocationDBName, k = `${c.inventoryBackendUrl}/${h}/sku`;
40
- return await d.get(`${k}?skuId=${l}&start=${a}&end=${i}`);
38
+ async readStockAdjustment(l, a, u) {
39
+ const S = r.currentLocationDBName, k = `${c.inventoryBackendUrl}/${S}/sku`;
40
+ return await m.get(`${k}?skuId=${l}&start=${a}&end=${u}`);
41
41
  },
42
42
  async convertSku(l) {
43
43
  var k;
44
- const a = r.currentLocationDBName, i = `${c.inventoryBackendUrl}/${a}/sku/convert`;
45
- return (((k = s.currentBusiness.value) == null ? void 0 : k.menuVersion) ?? "") === "v3" ? await d.post(i, l) : await d.post(`${i}?useInventoryDoc=true`, l);
44
+ const a = r.currentLocationDBName, u = `${c.inventoryBackendUrl}/${a}/sku/convert`;
45
+ return (((k = s.currentBusiness.value) == null ? void 0 : k.menuVersion) ?? "") === "v3" ? await m.post(u, l) : await m.post(`${u}?useInventoryDoc=true`, l);
46
46
  },
47
47
  async adjustSku(l) {
48
48
  var k;
49
- const a = r.currentLocationDBName, i = `${c.inventoryBackendUrl}/${a}/sku/adjust`;
50
- return (((k = s.currentBusiness.value) == null ? void 0 : k.menuVersion) ?? "") === "v3" ? await d.post(i, l) : await d.post(`${i}?useInventoryDoc=true`, l);
51
- },
52
- recalculation: {
53
- getRecalculateAbility() {
54
- var h;
55
- const a = `business_${(h = s.currentBusiness.value) == null ? void 0 : h._id}`, i = `${c.inventoryBackendUrl}/${a}/stock/operations/recalculate`;
56
- return d.get(i);
57
- },
58
- startRecalculateTask() {
59
- var h;
60
- const a = `business_${(h = s.currentBusiness.value) == null ? void 0 : h._id}`, i = `${c.inventoryBackendUrl}/${a}/stock/operations/recalculate?refundFromPreviousAdjustment=true`;
61
- return d.post(i);
62
- }
49
+ const a = r.currentLocationDBName, u = `${c.inventoryBackendUrl}/${a}/sku/adjust`;
50
+ return (((k = s.currentBusiness.value) == null ? void 0 : k.menuVersion) ?? "") === "v3" ? await m.post(u, l) : await m.post(`${u}?useInventoryDoc=true`, l);
63
51
  }
64
52
  };
65
53
  });
@@ -79,14 +67,14 @@ const _e = R(Lt()), He = () => {
79
67
  get stockBalance() {
80
68
  return _e.value.stockBalance;
81
69
  },
82
- set stockBalance(d) {
83
- _e.value.stockBalance = d;
70
+ set stockBalance(m) {
71
+ _e.value.stockBalance = m;
84
72
  },
85
73
  get productBalance() {
86
74
  return _e.value.productBalance;
87
75
  },
88
- set productBalance(d) {
89
- _e.value.productBalance = d;
76
+ set productBalance(m) {
77
+ _e.value.productBalance = m;
90
78
  },
91
79
  // actions
92
80
  async readStockBalance() {
@@ -100,21 +88,29 @@ const _e = R(Lt()), He = () => {
100
88
  var ke = /* @__PURE__ */ ((c) => (c.History = "History", c.Convert = "Convert", c.Adjust = "Adjust", c))(ke || {});
101
89
  const Nt = [
102
90
  {
103
- label: "History",
104
- color: "text-neutral-700"
91
+ translationKey: "inventory.stock.action.history",
92
+ color: "text-neutral-700",
93
+ value: "History"
94
+ /* History */
105
95
  }
106
96
  ], Ot = [
107
97
  {
108
- label: "History",
109
- color: "text-neutral-700"
98
+ translationKey: "inventory.stock.action.history",
99
+ color: "text-neutral-700",
100
+ value: "History"
101
+ /* History */
110
102
  },
111
103
  {
112
- label: "Convert",
113
- color: "text-neutral-700"
104
+ translationKey: "inventory.stock.action.convert",
105
+ color: "text-neutral-700",
106
+ value: "Convert"
107
+ /* Convert */
114
108
  },
115
109
  {
116
- label: "Adjust",
117
- color: "text-neutral-700"
110
+ translationKey: "inventory.stock.action.adjust",
111
+ color: "text-neutral-700",
112
+ value: "Adjust"
113
+ /* Adjust */
118
114
  }
119
115
  ];
120
116
  async function zt(c) {
@@ -139,16 +135,16 @@ async function zt(c) {
139
135
  {
140
136
  name: "Balance",
141
137
  selector: (s) => {
142
- const S = xe(s, s.unit);
143
- return S.type === "unit" ? ge(s.balance, s.unit, null, !1) : ge(s.balance, s.unit, S.measurement, !1);
138
+ const x = xe(s, s.unit);
139
+ return x.type === "unit" ? be(s.balance, s.unit, null, !1) : be(s.balance, s.unit, x.measurement, !1);
144
140
  }
145
141
  },
146
142
  {
147
143
  name: "Unit",
148
144
  selector: (s) => {
149
145
  var l;
150
- const S = xe(s, s.unit);
151
- return S.type === "unit" ? s.unit.abbrev : ((l = s.unit.measurements.find((a) => a.id === S.measurement)) == null ? void 0 : l.abbrev) || "";
146
+ const x = xe(s, s.unit);
147
+ return x.type === "unit" ? s.unit.abbrev : ((l = s.unit.measurements.find((a) => a.id === x.measurement)) == null ? void 0 : l.abbrev) || "";
152
148
  }
153
149
  }
154
150
  ]
@@ -157,16 +153,16 @@ async function zt(c) {
157
153
  r
158
154
  );
159
155
  }
160
- function xe(c, d) {
156
+ function xe(c, m) {
161
157
  const r = localStorage.getItem(`uom:${c._id}`);
162
- return r ? r === d._id ? {
158
+ return r ? r === m._id ? {
163
159
  type: "unit"
164
- } : d.measurements.find((s) => s.id === r) ? {
160
+ } : m.measurements.find((s) => s.id === r) ? {
165
161
  type: "measurement",
166
162
  measurement: r
167
163
  } : {
168
164
  type: "unit"
169
- } : c.trackingMeasurement && d.measurements.find((s) => s.id === c.trackingMeasurement) ? {
165
+ } : c.trackingMeasurement && m.measurements.find((s) => s.id === c.trackingMeasurement) ? {
170
166
  type: "measurement",
171
167
  measurement: c.trackingMeasurement
172
168
  } : {
@@ -182,62 +178,62 @@ const Yt = { class: "fm-typo-en-body-md-400 flex-grow" }, rt = /* @__PURE__ */ r
182
178
  defaultTrackingMeasurement: {}
183
179
  },
184
180
  setup(c) {
185
- function d(k) {
181
+ function m(k) {
186
182
  return `uom:${k._id}`;
187
183
  }
188
184
  function r(k) {
189
- const u = d(s.sku);
190
- k ? localStorage.setItem(u, k) : localStorage.setItem(u, s.unit._id), S.value = xe(s.sku, s.unit);
185
+ const i = m(s.sku);
186
+ k ? localStorage.setItem(i, k) : localStorage.setItem(i, s.unit._id), x.value = xe(s.sku, s.unit);
191
187
  }
192
- const s = c, S = R(xe(s.sku, s.unit)), l = T(() => {
188
+ const s = c, x = R(xe(s.sku, s.unit)), l = T(() => {
193
189
  const { measurements: k } = s.unit;
194
190
  return [
195
191
  {
196
- label: `${ge(s.amount, s.unit)}`,
192
+ label: `${be(s.amount, s.unit)}`,
197
193
  value: null
198
194
  },
199
- ...k.map(({ id: u }) => ({
200
- label: `${ge(s.amount, s.unit, u)}`,
201
- value: u
195
+ ...k.map(({ id: i }) => ({
196
+ label: `${be(s.amount, s.unit, i)}`,
197
+ value: i
202
198
  }))
203
199
  ];
204
200
  });
205
201
  function a({ value: k }) {
206
- return v(S).type === "unit" ? k === null : k === v(S).measurement;
202
+ return v(x).type === "unit" ? k === null : k === v(x).measurement;
207
203
  }
208
- const i = T(
204
+ const u = T(
209
205
  () => {
210
206
  var k;
211
- return ((k = l.value.find((u) => a(u))) == null ? void 0 : k.label) ?? "";
207
+ return ((k = l.value.find((i) => a(i))) == null ? void 0 : k.label) ?? "";
212
208
  }
213
- ), h = R(!1);
214
- return (k, u) => {
215
- const o = D("FmIcon"), w = D("FmMenuItem"), A = D("FmMenu");
216
- return B(), O(A, {
209
+ ), S = R(!1);
210
+ return (k, i) => {
211
+ const o = D("FmIcon"), w = D("FmMenuItem"), V = D("FmMenu");
212
+ return B(), O(V, {
217
213
  "stop-click-propagation": "",
218
- onMenuChanged: u[0] || (u[0] = (b) => h.value = b)
214
+ onMenuChanged: i[0] || (i[0] = (h) => S.value = h)
219
215
  }, {
220
216
  "menu-button": C(() => [
221
217
  n("button", {
222
218
  type: "button",
223
219
  class: Ce([
224
220
  "w-full text-left flex items-center gap-8 cursor-pointer fm-corner-radius-sm px-8 py-4 border bg-white",
225
- h.value ? "border-fm-color-primary" : "border-fm-color-neutral-gray-100"
221
+ S.value ? "border-fm-color-primary" : "border-fm-color-neutral-gray-100"
226
222
  ])
227
223
  }, [
228
- n("div", Yt, g(i.value), 1),
229
- x(o, {
224
+ n("div", Yt, g(u.value), 1),
225
+ b(o, {
230
226
  class: "text-fm-color-neutral-gray-400",
231
227
  name: "expand_more"
232
228
  })
233
229
  ], 2)
234
230
  ]),
235
231
  default: C(() => [
236
- (B(!0), L(te, null, ae(l.value, (b) => (B(), O(w, {
237
- key: b.value ?? 0,
238
- label: b.label,
239
- "model-value": a(b),
240
- onClick: (p) => r(b.value)
232
+ (B(!0), L(te, null, ae(l.value, (h) => (B(), O(w, {
233
+ key: h.value ?? 0,
234
+ label: h.label,
235
+ "model-value": a(h),
236
+ onClick: (p) => r(h.value)
241
237
  }, null, 8, ["label", "model-value", "onClick"]))), 128))
242
238
  ]),
243
239
  _: 1
@@ -247,23 +243,23 @@ const Yt = { class: "fm-typo-en-body-md-400 flex-grow" }, rt = /* @__PURE__ */ r
247
243
  }), Kt = { class: "whitespace-nowrap" }, Gt = /* @__PURE__ */ re({
248
244
  __name: "StockHeaderPreview",
249
245
  setup(c) {
250
- const { t: d } = le();
246
+ const { t: m } = le();
251
247
  return (r, s) => (B(), O(Tt, null, {
252
248
  default: C(() => [
253
- n("div", Kt, g(v(d)("inventory.stock.prediction.daysRemaining")), 1)
249
+ n("div", Kt, g(v(m)("inventory.stock.prediction.daysRemaining")), 1)
254
250
  ]),
255
251
  _: 1
256
252
  }));
257
253
  }
258
254
  }), lt = Rt("stockActions", () => {
259
- const c = R(!1), d = ue(), r = He(), s = at(), S = de(), l = nt(), { t: a } = le();
260
- async function i() {
261
- if (d._currentLocation) {
255
+ const c = R(!1), m = ue(), r = He(), s = at(), x = de(), l = nt(), { t: a } = le();
256
+ async function u() {
257
+ if (m._currentLocation) {
262
258
  c.value = !0;
263
259
  try {
264
260
  await r.readStockBalance(), await r.readProductBalance(), await s.readStockEstimateBalance();
265
261
  } catch {
266
- S.open({
262
+ x.open({
267
263
  title: a("inventory.stock.error.title"),
268
264
  message: a("inventory.stock.error.message"),
269
265
  type: "error"
@@ -273,9 +269,9 @@ const Yt = { class: "fm-typo-en-body-md-400 flex-grow" }, rt = /* @__PURE__ */ r
273
269
  }
274
270
  }
275
271
  }
276
- const h = R();
272
+ const S = R();
277
273
  async function k(p) {
278
- var F, j, I;
274
+ var F, j, U;
279
275
  if (!!!((j = (F = p.convert) == null ? void 0 : F.inventoryBindings) != null && j.length)) {
280
276
  l.open({
281
277
  title: a("inventory.stock.error.convert.title"),
@@ -284,34 +280,34 @@ const Yt = { class: "fm-typo-en-body-md-400 flex-grow" }, rt = /* @__PURE__ */ r
284
280
  return;
285
281
  }
286
282
  const $ = {
287
- maxCount: ((I = r.productBalance.find(({ id: E }) => E === p._id)) == null ? void 0 : I.count) || 0,
283
+ maxCount: ((U = r.productBalance.find(({ id: E }) => E === p._id)) == null ? void 0 : U.count) || 0,
288
284
  sku: p,
289
285
  show: !0,
290
286
  "onUpdate:show"(E) {
291
- h.value.show = E;
287
+ S.value.show = E;
292
288
  },
293
289
  onSubmitted() {
294
- i();
290
+ u();
295
291
  }
296
292
  };
297
- h.value = $;
293
+ S.value = $;
298
294
  }
299
- const u = R();
295
+ const i = R();
300
296
  async function o(p) {
301
297
  const M = {
302
298
  stock: p,
303
299
  show: !0,
304
300
  "onUpdate:show"(H) {
305
- u.value.show = H;
301
+ i.value.show = H;
306
302
  },
307
303
  onSubmitted() {
308
- i();
304
+ u();
309
305
  }
310
306
  };
311
- u.value = M;
307
+ i.value = M;
312
308
  }
313
309
  const w = R();
314
- async function A(p) {
310
+ async function V(p) {
315
311
  const M = {
316
312
  sku: p,
317
313
  show: !0,
@@ -321,11 +317,11 @@ const Yt = { class: "fm-typo-en-body-md-400 flex-grow" }, rt = /* @__PURE__ */ r
321
317
  };
322
318
  w.value = M;
323
319
  }
324
- function b(p, M) {
320
+ function h(p, M) {
325
321
  const H = Pe(M);
326
322
  switch (p) {
327
323
  case ke.History:
328
- A(H);
324
+ V(H);
329
325
  return;
330
326
  case ke.Convert:
331
327
  k(H);
@@ -336,16 +332,16 @@ const Yt = { class: "fm-typo-en-body-md-400 flex-grow" }, rt = /* @__PURE__ */ r
336
332
  }
337
333
  }
338
334
  return {
339
- fetchStockBalance: i,
340
- onActionMenu: b,
335
+ fetchStockBalance: u,
336
+ onActionMenu: h,
341
337
  stockHistoryProps: w,
342
- showSkuHistory: A,
343
- convertSkuDialogProps: h,
344
- adjustSkuDialogProps: u
338
+ showSkuHistory: V,
339
+ convertSkuDialogProps: S,
340
+ adjustSkuDialogProps: i
345
341
  };
346
342
  });
347
343
  function qt() {
348
- const c = ue(), d = lt(), { t: r } = le();
344
+ const c = ue(), m = lt(), { t: r } = le();
349
345
  return {
350
346
  columnDefs: [
351
347
  {
@@ -363,8 +359,8 @@ function qt() {
363
359
  {
364
360
  id: "UOM",
365
361
  header: () => r("inventory.stock.balance"),
366
- cell(S) {
367
- const l = S.row.original, a = {
362
+ cell(x) {
363
+ const l = x.row.original, a = {
368
364
  unit: l.unit,
369
365
  sku: l,
370
366
  amount: l.balance,
@@ -380,28 +376,28 @@ function qt() {
380
376
  header: () => ye(Gt),
381
377
  enableSorting: !0,
382
378
  sortUndefined: "last",
383
- cell(S) {
384
- var u, o;
385
- const l = S.row.original.day, a = (u = S.row.original.thresholds) == null ? void 0 : u.low, i = (o = S.row.original.thresholds) == null ? void 0 : o.mid;
386
- if (typeof l != "number" || typeof a != "number" || typeof i != "number")
387
- return ye(Ie, {
379
+ cell(x) {
380
+ var i, o;
381
+ const l = x.row.original.day, a = (i = x.row.original.thresholds) == null ? void 0 : i.low, u = (o = x.row.original.thresholds) == null ? void 0 : o.mid;
382
+ if (typeof l != "number" || typeof a != "number" || typeof u != "number")
383
+ return ye(Ue, {
388
384
  days: l
389
385
  });
390
- const h = l <= a ? Fe.low : l <= i ? Fe.mid : Fe.high;
391
- return ye(Ie, {
386
+ const S = l <= a ? Fe.low : l <= u ? Fe.mid : Fe.high;
387
+ return ye(Ue, {
392
388
  days: l,
393
- level: h
389
+ level: S
394
390
  });
395
391
  },
396
392
  size: 200
397
393
  },
398
394
  {
399
395
  id: "action",
400
- cell(S) {
396
+ cell(x) {
401
397
  var l;
402
398
  return jt(
403
399
  ((l = c._currentLocation) == null ? void 0 : l.type) === "restaurant" ? Nt : Ot,
404
- (a) => d.onActionMenu(a, S.row.original)
400
+ (a) => m.onActionMenu(a, x.row.original)
405
401
  );
406
402
  },
407
403
  enableSorting: !1,
@@ -429,19 +425,19 @@ const Wt = {
429
425
  isInteger(c = "Must be an integer") {
430
426
  return this.error ? this : (this.toInt(), isNaN(this.context) && (this.error = c), this);
431
427
  },
432
- min(c, d) {
428
+ min(c, m) {
433
429
  if (this.error) return this;
434
430
  try {
435
- typeof this.context == "number" ? +this.context < c && (this.error = d ?? `Must be at least ${c}`) : Object.prototype.hasOwnProperty.call(this.context, "length") ? +this.context.length < c && (this.error = d ?? `Must be at least ${c}`) : this.error = "Length cannot be determined";
431
+ typeof this.context == "number" ? +this.context < c && (this.error = m ?? `Must be at least ${c}`) : Object.prototype.hasOwnProperty.call(this.context, "length") ? +this.context.length < c && (this.error = m ?? `Must be at least ${c}`) : this.error = "Length cannot be determined";
436
432
  } catch {
437
433
  this.error = "Length cannot be determined";
438
434
  }
439
435
  return this;
440
436
  },
441
- max(c, d) {
437
+ max(c, m) {
442
438
  if (this.error) return this;
443
439
  try {
444
- typeof this.context == "number" ? +this.context > c && (this.error = d ?? `Must be at most ${c}`) : "length" in this.context ? +this.context.length > c && (this.error = d ?? `Must be at most ${c}`) : this.error = "Length cannot be determined";
440
+ typeof this.context == "number" ? +this.context > c && (this.error = m ?? `Must be at most ${c}`) : "length" in this.context ? +this.context.length > c && (this.error = m ?? `Must be at most ${c}`) : this.error = "Length cannot be determined";
445
441
  } catch {
446
442
  this.error = "Length cannot be determined";
447
443
  }
@@ -459,27 +455,27 @@ const Jt = { class: "flex items-center" }, Qt = { class: "fm-typo-en-title-md-80
459
455
  show: { type: Boolean }
460
456
  },
461
457
  emits: ["update:show", "submitted"],
462
- setup(c, { expose: d, emit: r }) {
463
- const s = c, S = r, l = vt(), a = Te(), i = Se(), h = de(), { t: k } = le(), u = R(0), o = R(null), w = T(() => a.skus), A = T(
458
+ setup(c, { expose: m, emit: r }) {
459
+ const s = c, x = r, l = vt(), a = Te(), u = Se(), S = de(), { t: k } = le(), i = R(0), o = R(null), w = T(() => a.skus), V = T(
464
460
  () => {
465
461
  var e, t;
466
462
  return (((t = (e = s.sku) == null ? void 0 : e.convert) == null ? void 0 : t.inventoryBindings) ?? []).filter(
467
463
  (f) => f.type === Oe.enum.SKU
468
464
  );
469
465
  }
470
- ), b = T({
466
+ ), h = T({
471
467
  get() {
472
468
  return !!o.value;
473
469
  },
474
470
  set(e) {
475
- e ? o.value = Pe(A.value) : (o.value = null, u.value = Math.min(u.value, s.maxCount ?? 0));
471
+ e ? o.value = Pe(V.value) : (o.value = null, i.value = Math.min(i.value, s.maxCount ?? 0));
476
472
  }
477
473
  }), p = R(!1);
478
474
  he([() => s.show], ([e]) => {
479
- e && (u.value = 0);
475
+ e && (i.value = 0);
480
476
  });
481
477
  function M() {
482
- W(s.sku, be(u.value), o.value);
478
+ W(s.sku, ge(i.value), o.value);
483
479
  }
484
480
  function H(e) {
485
481
  if (o.value)
@@ -489,117 +485,117 @@ const Jt = { class: "flex items-center" }, Qt = { class: "fm-typo-en-title-md-80
489
485
  }
490
486
  function $(e) {
491
487
  var y;
492
- const t = (y = s.sku.convert) != null && y.measurement ? s.sku.unit.measurements.find((V) => {
488
+ const t = (y = s.sku.convert) != null && y.measurement ? s.sku.unit.measurements.find((A) => {
493
489
  var K;
494
- return V.id === ((K = s.sku.convert) == null ? void 0 : K.measurement);
495
- }) ?? null : null, f = De(s.sku.unit, t), m = kt(+e);
496
- return qe(m).isInteger().max(f).error ? "Precision cannot be more than " + f : !0;
490
+ return A.id === ((K = s.sku.convert) == null ? void 0 : K.measurement);
491
+ }) ?? null : null, f = De(s.sku.unit, t), d = kt(+e);
492
+ return qe(d).isInteger().max(f).error ? "Precision cannot be more than " + f : !0;
497
493
  }
498
494
  const F = T(
499
495
  () => {
500
496
  var e, t;
501
497
  return (e = s.sku.convert) != null && e.measurement ? (t = s.sku.unit.measurements.find((f) => {
502
- var m;
503
- return f.id === ((m = s.sku.convert) == null ? void 0 : m.measurement);
498
+ var d;
499
+ return f.id === ((d = s.sku.convert) == null ? void 0 : d.measurement);
504
500
  })) == null ? void 0 : t.abbrev : s.sku.unit.abbrev;
505
501
  }
506
502
  ), j = T(() => {
507
- var f, m, _;
508
- const e = (m = (f = s.sku.convert) == null ? void 0 : f.inventoryBindings) == null ? void 0 : m.filter((y) => y.type === "SKU");
503
+ var f, d, _;
504
+ const e = (d = (f = s.sku.convert) == null ? void 0 : f.inventoryBindings) == null ? void 0 : d.filter((y) => y.type === "SKU");
509
505
  return (_ = o.value ?? e) == null ? void 0 : _.map((y) => {
510
506
  var X, G, se, Ee, Le;
511
- const V = a.skus.find((pe) => pe._id === y.id), K = ((X = y.measurement) == null ? void 0 : X.abbrev) ?? ((G = V == null ? void 0 : V.unit) == null ? void 0 : G.abbrev), Q = (se = s.sku.convert) != null && se.measurement ? s.sku.unit.measurements.find((pe) => {
507
+ const A = a.skus.find((pe) => pe._id === y.id), K = ((X = y.measurement) == null ? void 0 : X.abbrev) ?? ((G = A == null ? void 0 : A.unit) == null ? void 0 : G.abbrev), Q = (se = s.sku.convert) != null && se.measurement ? s.sku.unit.measurements.find((pe) => {
512
508
  var Ne;
513
509
  return pe.id === ((Ne = s.sku.convert) == null ? void 0 : Ne.measurement);
514
- }) ?? null : null, me = De(s.sku.unit, Q), U = $(`${u.value}`) === !0 ? ie(
510
+ }) ?? null : null, me = De(s.sku.unit, Q), I = $(`${i.value}`) === !0 ? ie(
515
511
  ft(
516
512
  y.amount,
517
- be(+u.value, me)
513
+ ge(+i.value, me)
518
514
  ),
519
515
  !1
520
- ) : "0", Y = (Le = (Ee = o.value) == null ? void 0 : Ee.find((pe) => pe.id === (V == null ? void 0 : V._id))) == null ? void 0 : Le.amount, J = Y ? ie(Y, !1) : null;
516
+ ) : "0", Y = (Le = (Ee = o.value) == null ? void 0 : Ee.find((pe) => pe.id === (A == null ? void 0 : A._id))) == null ? void 0 : Le.amount, J = Y ? ie(Y, !1) : null;
521
517
  return {
522
- sku: V,
523
- convertAmount: J ?? U,
518
+ sku: A,
519
+ convertAmount: J ?? I,
524
520
  abbrev: K
525
521
  };
526
522
  });
527
- }), I = R();
528
- d({
523
+ }), U = R();
524
+ m({
529
525
  validateInputs: () => {
530
526
  var e, t;
531
- (t = (e = I.value) == null ? void 0 : e.validateInputs) == null || t.call(e);
527
+ (t = (e = U.value) == null ? void 0 : e.validateInputs) == null || t.call(e);
532
528
  },
533
529
  resetInputsValidation: () => {
534
530
  var e, t;
535
- (t = (e = I.value) == null ? void 0 : e.resetInputsValidation) == null || t.call(e);
531
+ (t = (e = U.value) == null ? void 0 : e.resetInputsValidation) == null || t.call(e);
536
532
  },
537
533
  resetInputs: () => {
538
534
  var e, t;
539
- (t = (e = I.value) == null ? void 0 : e.resetInputs) == null || t.call(e);
535
+ (t = (e = U.value) == null ? void 0 : e.resetInputs) == null || t.call(e);
540
536
  }
541
537
  });
542
538
  const E = Re(s, "show");
543
539
  async function W(e, t, f) {
544
540
  p.value = !0;
545
541
  try {
546
- await i.convertSku({
542
+ await u.convertSku({
547
543
  conversions: [
548
544
  {
549
545
  doc: e,
550
546
  amount: t,
551
- overrides: f == null ? void 0 : f.map((m) => ({
552
- ...m,
547
+ overrides: f == null ? void 0 : f.map((d) => ({
548
+ ...d,
553
549
  amount: {
554
- ...m.amount,
555
- amount: -1 * Math.abs(m.amount.amount)
550
+ ...d.amount,
551
+ amount: -1 * Math.abs(d.amount.amount)
556
552
  // ensure truly negative
557
553
  }
558
554
  }))
559
555
  }
560
556
  ]
561
- }), S("update:show", !1), S("submitted");
562
- } catch (m) {
563
- h.open({
557
+ }), x("update:show", !1), x("submitted");
558
+ } catch (d) {
559
+ S.open({
564
560
  title: "Something went wrong",
565
561
  message: `Cannot convert ${e.name}. Please try again.`,
566
562
  type: "error"
567
- }), console.error("error at converting stock amount", e, t, m);
563
+ }), console.error("error at converting stock amount", e, t, d);
568
564
  } finally {
569
565
  p.value = !1;
570
566
  }
571
567
  }
572
568
  function z(e, t, f) {
573
- const m = +t;
569
+ const d = +t;
574
570
  let _ = f;
575
- t.length > 0 && isFinite(m) ? _ = f.map((y) => (y.id !== e || (y.amount = fe(m)), y)) : _ = f.map((y) => (y.id !== e || (y.amount = { amount: 0, precision: 0 }), y)), o.value = _;
571
+ t.length > 0 && isFinite(d) ? _ = f.map((y) => (y.id !== e || (y.amount = fe(d)), y)) : _ = f.map((y) => (y.id !== e || (y.amount = { amount: 0, precision: 0 }), y)), o.value = _;
576
572
  }
577
573
  function P(e) {
578
574
  const t = w.value.find((f) => f._id === e);
579
575
  return t ? st(t.unit, !0) : [];
580
576
  }
581
577
  function N(e, t) {
582
- const f = P(e), m = f.find((_) => _.value === t) ?? f.find((_) => _.value === null);
583
- return m ? {
584
- ...m,
585
- label: m.abbrev
578
+ const f = P(e), d = f.find((_) => _.value === t) ?? f.find((_) => _.value === null);
579
+ return d ? {
580
+ ...d,
581
+ label: d.abbrev
586
582
  } : null;
587
583
  }
588
584
  function ne(e, t, f) {
589
- let m;
585
+ let d;
590
586
  if (t === null)
591
- m = f.map((_) => (_.id !== e || (_.measurement = null), _)) ?? [];
587
+ d = f.map((_) => (_.id !== e || (_.measurement = null), _)) ?? [];
592
588
  else {
593
589
  const _ = w.value.find((y) => y._id === e);
594
- m = f.map((y) => {
595
- var V, K;
596
- return y.id !== e || (y.measurement = (K = (V = _ == null ? void 0 : _.unit) == null ? void 0 : V.measurements) == null ? void 0 : K.find((Q) => Q.id === t)), y;
590
+ d = f.map((y) => {
591
+ var A, K;
592
+ return y.id !== e || (y.measurement = (K = (A = _ == null ? void 0 : _.unit) == null ? void 0 : A.measurements) == null ? void 0 : K.find((Q) => Q.id === t)), y;
597
593
  }) ?? [];
598
594
  }
599
- o.value = m;
595
+ o.value = d;
600
596
  }
601
597
  function ce(e, t) {
602
- const f = t.filter((m) => m.id !== e);
598
+ const f = t.filter((d) => d.id !== e);
603
599
  o.value = f;
604
600
  }
605
601
  function oe() {
@@ -616,14 +612,14 @@ const Jt = { class: "flex items-center" }, Qt = { class: "fm-typo-en-title-md-80
616
612
  return he(
617
613
  () => s.show,
618
614
  (e) => {
619
- e || (o.value = null, u.value = 0);
615
+ e || (o.value = null, i.value = 0);
620
616
  }
621
617
  ), (e, t) => {
622
- const f = D("FmTextField"), m = D("FmForm"), _ = D("FmCard"), y = D("FmSwitch"), V = D("FmFormGroup"), K = D("FmSelect"), Q = D("FmButton"), me = D("FmSideSheet");
618
+ const f = D("FmTextField"), d = D("FmForm"), _ = D("FmCard"), y = D("FmSwitch"), A = D("FmFormGroup"), K = D("FmSelect"), Q = D("FmButton"), me = D("FmSideSheet");
623
619
  return B(), O(me, {
624
620
  "dismiss-away": "",
625
621
  modelValue: v(E),
626
- "onUpdate:modelValue": t[3] || (t[3] = (U) => Ue(E) ? E.value = U : null),
622
+ "onUpdate:modelValue": t[3] || (t[3] = (I) => Ie(E) ? E.value = I : null),
627
623
  "max-width": 500
628
624
  }, {
629
625
  "side-sheet-header": C(() => [
@@ -633,16 +629,16 @@ const Jt = { class: "flex items-center" }, Qt = { class: "fm-typo-en-title-md-80
633
629
  ]),
634
630
  default: C(() => [
635
631
  n("div", Xt, [
636
- x(m, {
632
+ b(d, {
637
633
  ref_key: "formRef",
638
- ref: I,
634
+ ref: U,
639
635
  onValidationSuccess: M
640
636
  }, {
641
637
  default: C(() => [
642
- x(f, {
638
+ b(f, {
643
639
  disabled: p.value,
644
- "model-value": u.value,
645
- "onUpdate:modelValue": t[0] || (t[0] = (U) => u.value = U),
640
+ "model-value": i.value,
641
+ "onUpdate:modelValue": t[0] || (t[0] = (I) => i.value = I),
646
642
  label: v(k)("inventory.stock.convert.amount"),
647
643
  rules: [H, $, v(Me)(0)],
648
644
  "append-text": F.value,
@@ -651,52 +647,52 @@ const Jt = { class: "flex items-center" }, Qt = { class: "fm-typo-en-title-md-80
651
647
  ]),
652
648
  _: 1
653
649
  }, 512),
654
- x(_, {
650
+ b(_, {
655
651
  variant: "outlined",
656
652
  class: "p-16"
657
653
  }, {
658
654
  default: C(() => [
659
655
  n("div", Zt, [
660
656
  n("div", en, g(v(k)("inventory.stock.convert.deductionSummary")), 1),
661
- (B(!0), L(te, null, ae(j.value, (U) => {
657
+ (B(!0), L(te, null, ae(j.value, (I) => {
662
658
  var Y, J;
663
659
  return B(), L("div", {
664
- key: (Y = U.sku) == null ? void 0 : Y._id,
660
+ key: (Y = I.sku) == null ? void 0 : Y._id,
665
661
  class: "flex items-center"
666
662
  }, [
667
- n("div", tn, g((J = U.sku) == null ? void 0 : J.name), 1),
668
- n("div", nn, " -" + g(U.convertAmount) + " " + g(U.abbrev), 1)
663
+ n("div", tn, g((J = I.sku) == null ? void 0 : J.name), 1),
664
+ n("div", nn, " -" + g(I.convertAmount) + " " + g(I.abbrev), 1)
669
665
  ]);
670
666
  }), 128))
671
667
  ])
672
668
  ]),
673
669
  _: 1
674
670
  }),
675
- x(_, { variant: "outlined" }, {
671
+ b(_, { variant: "outlined" }, {
676
672
  default: C(() => [
677
673
  n("div", on, [
678
- x(y, {
674
+ b(y, {
679
675
  value: "",
680
- modelValue: b.value,
681
- "onUpdate:modelValue": t[1] || (t[1] = (U) => b.value = U),
676
+ modelValue: h.value,
677
+ "onUpdate:modelValue": t[1] || (t[1] = (I) => h.value = I),
682
678
  label: v(k)("inventory.stock.convert.overrideDeduction"),
683
679
  "label-placement": "right"
684
680
  }, null, 8, ["modelValue", "label"]),
685
- b.value ? (B(), L(te, { key: 0 }, [
686
- x(V, {
681
+ h.value ? (B(), L(te, { key: 0 }, [
682
+ b(A, {
687
683
  modelValue: o.value,
688
684
  rules: [v(yt)(1, "Must have at least one ingredient binding")]
689
685
  }, null, 8, ["modelValue", "rules"]),
690
686
  n("div", sn, [
691
687
  n("div", an, g(v(k)("inventory.stock.convert.ingredients")), 1),
692
- (B(!0), L(te, null, ae(o.value, (U) => (B(), O(V, {
693
- key: U.id,
688
+ (B(!0), L(te, null, ae(o.value, (I) => (B(), O(A, {
689
+ key: I.id,
694
690
  disabled: p.value,
695
- modelValue: +v(ie)(U.amount ?? { amount: 1, precision: 0 }),
691
+ modelValue: +v(ie)(I.amount ?? { amount: 1, precision: 0 }),
696
692
  rules: [
697
693
  v(_t)(
698
- w.value.find((Y) => Y._id === U.id).unit,
699
- U.measurement
694
+ w.value.find((Y) => Y._id === I.id).unit,
695
+ I.measurement
700
696
  ),
701
697
  v(Me)(0)
702
698
  ]
@@ -705,33 +701,33 @@ const Jt = { class: "flex items-center" }, Qt = { class: "fm-typo-en-title-md-80
705
701
  var J, X, G;
706
702
  return [
707
703
  n("div", rn, [
708
- n("div", ln, g((J = w.value.find((se) => se._id === U.id)) == null ? void 0 : J.name), 1),
709
- x(f, {
704
+ n("div", ln, g((J = w.value.find((se) => se._id === I.id)) == null ? void 0 : J.name), 1),
705
+ b(f, {
710
706
  class: "xs:col-span-2",
711
707
  disabled: p.value,
712
708
  modelValue: +v(ie)(
713
- U.amount ?? { amount: 1, precision: 0 }
709
+ I.amount ?? { amount: 1, precision: 0 }
714
710
  ),
715
- "onUpdate:modelValue": (se) => z(U.id, se, o.value ?? []),
711
+ "onUpdate:modelValue": (se) => z(I.id, se, o.value ?? []),
716
712
  invalid: Y
717
713
  }, null, 8, ["disabled", "modelValue", "onUpdate:modelValue", "invalid"]),
718
- x(K, {
714
+ b(K, {
719
715
  disabled: p.value,
720
716
  class: "translate-y-[2px]",
721
- items: P(U.id),
722
- "model-value": (G = N(U.id, (X = U.measurement) == null ? void 0 : X.id)) == null ? void 0 : G.value,
723
- "onUpdate:modelValue": (se) => ne(U.id, se, o.value ?? []),
717
+ items: P(I.id),
718
+ "model-value": (G = N(I.id, (X = I.measurement) == null ? void 0 : X.id)) == null ? void 0 : G.value,
719
+ "onUpdate:modelValue": (se) => ne(I.id, se, o.value ?? []),
724
720
  invalid: Y
725
721
  }, {
726
- "helper-text": C(() => []),
722
+ "helper-text": C(() => t[4] || (t[4] = [])),
727
723
  _: 2
728
724
  }, 1032, ["disabled", "items", "model-value", "onUpdate:modelValue", "invalid"]),
729
- x(Q, {
725
+ b(Q, {
730
726
  disabled: p.value,
731
727
  type: "button",
732
728
  variant: "tertiary",
733
729
  icon: "delete",
734
- onClick: (se) => ce(U.id, o.value ?? [])
730
+ onClick: (se) => ce(I.id, o.value ?? [])
735
731
  }, null, 8, ["disabled", "onClick"])
736
732
  ])
737
733
  ];
@@ -740,7 +736,7 @@ const Jt = { class: "flex items-center" }, Qt = { class: "fm-typo-en-title-md-80
740
736
  }, 1032, ["disabled", "modelValue", "rules"]))), 128))
741
737
  ]),
742
738
  n("div", null, [
743
- x(Q, {
739
+ b(Q, {
744
740
  icon: "link",
745
741
  label: v(k)("inventory.stock.convert.linkIngredient"),
746
742
  variant: "plain",
@@ -756,12 +752,12 @@ const Jt = { class: "flex items-center" }, Qt = { class: "fm-typo-en-title-md-80
756
752
  ]),
757
753
  "side-sheet-footer": C(() => [
758
754
  n("div", un, [
759
- x(Q, {
755
+ b(Q, {
760
756
  loading: p.value,
761
757
  label: v(k)("inventory.stock.convert.convertButton"),
762
- onClick: t[2] || (t[2] = (U) => {
758
+ onClick: t[2] || (t[2] = (I) => {
763
759
  var Y, J;
764
- return (J = (Y = I.value) == null ? void 0 : Y.validateInputs) == null ? void 0 : J.call(Y);
760
+ return (J = (Y = U.value) == null ? void 0 : Y.validateInputs) == null ? void 0 : J.call(Y);
765
761
  })
766
762
  }, null, 8, ["loading", "label"])
767
763
  ])
@@ -771,25 +767,25 @@ const Jt = { class: "flex items-center" }, Qt = { class: "fm-typo-en-title-md-80
771
767
  };
772
768
  }
773
769
  });
774
- function Ae(c, d) {
775
- const r = be(c, d);
770
+ function Ve(c, m) {
771
+ const r = ge(c, m);
776
772
  return { ...r, amount: -r.amount };
777
773
  }
778
- function We(c, d) {
779
- return be(Math.abs(c), d);
774
+ function We(c, m) {
775
+ return ge(Math.abs(c), m);
780
776
  }
781
- const Ve = {
777
+ const Ae = {
782
778
  [Z.enum.DAMAGE]: {
783
779
  label: "Waste",
784
- toAdjustmentAmount: Ae
780
+ toAdjustmentAmount: Ve
785
781
  },
786
782
  [Z.enum.THEFT]: {
787
783
  label: "Theft",
788
- toAdjustmentAmount: Ae
784
+ toAdjustmentAmount: Ve
789
785
  },
790
786
  [Z.enum.LOSE]: {
791
787
  label: "Lose",
792
- toAdjustmentAmount: Ae
788
+ toAdjustmentAmount: Ve
793
789
  },
794
790
  [Z.enum.EXTRA]: {
795
791
  label: "Extra",
@@ -806,110 +802,110 @@ const Ve = {
806
802
  disabled: { type: Boolean }
807
803
  },
808
804
  emits: ["update:modelValue", "click:delete"],
809
- setup(c, { emit: d }) {
810
- const r = c, s = d, S = T(
811
- () => Object.keys(Ve).map((u) => ({
812
- label: ht(u),
813
- value: u
805
+ setup(c, { emit: m }) {
806
+ const r = c, s = m, x = T(
807
+ () => Object.keys(Ae).map((i) => ({
808
+ label: ht(i),
809
+ value: i
814
810
  }))
815
811
  ), l = T(() => st(r.modelValue.doc.unit, !0)), a = T({
816
812
  get() {
817
813
  return r.modelValue.type ?? Z.enum.PURCHASE;
818
814
  },
819
- set(u) {
815
+ set(i) {
820
816
  const o = {
821
817
  ...r.modelValue
822
818
  };
823
- o.type = u;
819
+ o.type = i;
824
820
  const w = ze(r.modelValue.amount);
825
- o.amount = Ve[o.type].toAdjustmentAmount(
821
+ o.amount = Ae[o.type].toAdjustmentAmount(
826
822
  +ie(w),
827
823
  w.precision
828
824
  ), s("update:modelValue", o);
829
825
  }
830
- }), i = T({
826
+ }), u = T({
831
827
  get() {
832
- const u = ze(r.modelValue.amount);
833
- return +ie(u);
828
+ const i = ze(r.modelValue.amount);
829
+ return +ie(i);
834
830
  },
835
- set(u) {
831
+ set(i) {
836
832
  const o = {
837
833
  ...r.modelValue
838
- }, w = fe(u);
839
- o.amount = Ve[a.value].toAdjustmentAmount(
840
- u,
834
+ }, w = fe(i);
835
+ o.amount = Ae[a.value].toAdjustmentAmount(
836
+ i,
841
837
  w.precision
842
838
  ), s("update:modelValue", o);
843
839
  }
844
- }), h = T({
840
+ }), S = T({
845
841
  get() {
846
- var u;
847
- return ((u = r.modelValue.measurement) == null ? void 0 : u.id) ?? null;
842
+ var i;
843
+ return ((i = r.modelValue.measurement) == null ? void 0 : i.id) ?? null;
848
844
  },
849
- set(u) {
850
- var w, A;
845
+ set(i) {
846
+ var w, V;
851
847
  const o = {
852
848
  ...r.modelValue
853
849
  };
854
- o.measurement = ((A = (w = r.modelValue.doc.unit) == null ? void 0 : w.measurements) == null ? void 0 : A.find((b) => b.id === u)) ?? null, s("update:modelValue", o);
850
+ o.measurement = ((V = (w = r.modelValue.doc.unit) == null ? void 0 : w.measurements) == null ? void 0 : V.find((h) => h.id === i)) ?? null, s("update:modelValue", o);
855
851
  }
856
852
  }), k = T({
857
853
  get() {
858
854
  return r.modelValue.remark ?? "";
859
855
  },
860
- set(u) {
856
+ set(i) {
861
857
  const o = {
862
858
  ...r.modelValue
863
859
  };
864
- o.remark = u, s("update:modelValue", o);
860
+ o.remark = i, s("update:modelValue", o);
865
861
  }
866
862
  });
867
- return (u, o) => {
868
- const w = D("FmButton"), A = D("FmSelect"), b = D("FmTextarea"), p = D("FmCard");
863
+ return (i, o) => {
864
+ const w = D("FmButton"), V = D("FmSelect"), h = D("FmTextarea"), p = D("FmCard");
869
865
  return B(), O(p, {
870
866
  variant: "outlined",
871
867
  class: "grid grid-cols-2 gap-8 p-16"
872
868
  }, {
873
869
  default: C(() => [
874
870
  n("div", dn, [
875
- n("div", mn, g(u.modelValue.doc.name), 1),
876
- x(w, {
871
+ n("div", mn, g(i.modelValue.doc.name), 1),
872
+ b(w, {
877
873
  variant: "tertiary",
878
874
  "prepend-icon": "delete",
879
875
  onClick: o[0] || (o[0] = (M) => s("click:delete"))
880
876
  })
881
877
  ]),
882
- x(A, {
883
- disabled: u.disabled,
878
+ b(V, {
879
+ disabled: i.disabled,
884
880
  class: "col-span-2",
885
881
  label: "Type",
886
- items: S.value,
882
+ items: x.value,
887
883
  modelValue: a.value,
888
884
  "onUpdate:modelValue": o[1] || (o[1] = (M) => a.value = M),
889
- rules: [v(bt)()],
885
+ rules: [v(gt)()],
890
886
  "label-mark": "required"
891
887
  }, null, 8, ["disabled", "items", "modelValue", "rules"]),
892
- x(Ht, {
893
- disabled: u.disabled,
888
+ b(Ht, {
889
+ disabled: i.disabled,
894
890
  label: "Amount",
895
891
  step: +v(ie)({
896
892
  amount: 1,
897
- precision: v(De)(u.modelValue.doc.unit, u.modelValue.measurement)
893
+ precision: v(De)(i.modelValue.doc.unit, i.modelValue.measurement)
898
894
  }),
899
- modelValue: i.value,
900
- "onUpdate:modelValue": o[2] || (o[2] = (M) => i.value = M),
895
+ modelValue: u.value,
896
+ "onUpdate:modelValue": o[2] || (o[2] = (M) => u.value = M),
901
897
  rules: [v(Me)(0)]
902
898
  }, null, 8, ["disabled", "step", "modelValue", "rules"]),
903
- x(A, {
904
- disabled: u.disabled,
899
+ b(V, {
900
+ disabled: i.disabled,
905
901
  label: "Unit",
906
902
  items: l.value,
907
- modelValue: h.value,
908
- "onUpdate:modelValue": o[3] || (o[3] = (M) => h.value = M)
903
+ modelValue: S.value,
904
+ "onUpdate:modelValue": o[3] || (o[3] = (M) => S.value = M)
909
905
  }, null, 8, ["disabled", "items", "modelValue"]),
910
- x(b, {
906
+ b(h, {
911
907
  class: "col-span-2",
912
- disabled: u.disabled,
908
+ disabled: i.disabled,
913
909
  label: "Remark",
914
910
  modelValue: k.value,
915
911
  "onUpdate:modelValue": o[4] || (o[4] = (M) => k.value = M),
@@ -927,13 +923,13 @@ const Ve = {
927
923
  show: { type: Boolean }
928
924
  },
929
925
  emits: ["update:show", "submitted"],
930
- setup(c, { expose: d, emit: r }) {
931
- const s = c, S = r, l = Te(), a = nt(), i = Se(), h = de(), k = R(!1), { t: u } = le();
926
+ setup(c, { expose: m, emit: r }) {
927
+ const s = c, x = r, l = Te(), a = nt(), u = Se(), S = de(), k = R(!1), { t: i } = le();
932
928
  function o() {
933
- p(Pe(b));
929
+ p(Pe(h));
934
930
  }
935
931
  const w = R();
936
- d({
932
+ m({
937
933
  validateInputs: () => {
938
934
  var $, F;
939
935
  (F = ($ = w.value) == null ? void 0 : $.validateInputs) == null || F.call($);
@@ -947,7 +943,7 @@ const Ve = {
947
943
  (F = ($ = w.value) == null ? void 0 : $.resetInputs) == null || F.call($);
948
944
  }
949
945
  });
950
- const A = Re(s, "show"), b = it({
946
+ const V = Re(s, "show"), h = it({
951
947
  remark: "",
952
948
  adjustments: [
953
949
  {
@@ -961,7 +957,7 @@ const Ve = {
961
957
  ]
962
958
  });
963
959
  he([() => s.show], ([$]) => {
964
- $ && (b.remark = "", b.adjustments = [
960
+ $ && (h.remark = "", h.adjustments = [
965
961
  {
966
962
  id: `sku_${(/* @__PURE__ */ new Date()).toISOString()}_${Math.random().toString(16).slice(2, 8)}`,
967
963
  type: Z.enum.PURCHASE,
@@ -975,21 +971,21 @@ const Ve = {
975
971
  async function p($) {
976
972
  k.value = !0;
977
973
  try {
978
- await i.adjustSku({
974
+ await u.adjustSku({
979
975
  remark: $.remark,
980
- adjustments: $.adjustments.map(({ doc: F, remark: j, type: I, amount: E, measurement: W }) => ({
976
+ adjustments: $.adjustments.map(({ doc: F, remark: j, type: U, amount: E, measurement: W }) => ({
981
977
  id: F._id,
982
978
  amount: E,
983
979
  measurement: W,
984
980
  remark: j,
985
981
  doc: F,
986
- type: I
982
+ type: U
987
983
  }))
988
- }), S("update:show", !1), S("submitted");
984
+ }), x("update:show", !1), x("submitted");
989
985
  } catch (F) {
990
- h.open({
991
- title: u("inventory.stock.adjust.error.title"),
992
- message: u("inventory.stock.adjust.error.message"),
986
+ S.open({
987
+ title: i("inventory.stock.adjust.error.title"),
988
+ message: i("inventory.stock.adjust.error.message"),
993
989
  type: "error"
994
990
  }), console.log("error on adjust ingredients", $, F);
995
991
  } finally {
@@ -1001,10 +997,10 @@ const Ve = {
1001
997
  label: j.name,
1002
998
  sublabel: j.code,
1003
999
  value: j._id
1004
- })), F = $.filter((j) => b.adjustments.find((I) => I.doc._id === j.value)).map((j) => j.value);
1000
+ })), F = $.filter((j) => h.adjustments.find((U) => U.doc._id === j.value)).map((j) => j.value);
1005
1001
  a.open({
1006
1002
  title: "Select ingredients",
1007
- contentComponent: gt,
1003
+ contentComponent: bt,
1008
1004
  contentComponentProps: {
1009
1005
  items: $,
1010
1006
  modelValue: F
@@ -1022,11 +1018,11 @@ const Ve = {
1022
1018
  variant: "tertiary"
1023
1019
  }
1024
1020
  }).onPrimary((j) => {
1025
- b.adjustments = j.map(
1026
- (I) => b.adjustments.find((E) => E.doc._id === I) ?? {
1021
+ h.adjustments = j.map(
1022
+ (U) => h.adjustments.find((E) => E.doc._id === U) ?? {
1027
1023
  id: `sku_${(/* @__PURE__ */ new Date()).toISOString()}_${Math.random().toString(16).slice(2, 8)}`,
1028
1024
  type: Z.enum.PURCHASE,
1029
- doc: l.skus.find((E) => E._id === I),
1025
+ doc: l.skus.find((E) => E._id === U),
1030
1026
  measurement: null,
1031
1027
  remark: "",
1032
1028
  amount: fe(1)
@@ -1035,47 +1031,47 @@ const Ve = {
1035
1031
  });
1036
1032
  }
1037
1033
  function H($) {
1038
- b.adjustments.splice($, 1);
1034
+ h.adjustments.splice($, 1);
1039
1035
  }
1040
1036
  return ($, F) => {
1041
- const j = D("FmTextarea"), I = D("FmButton"), E = D("FmForm"), W = D("FmSideSheet");
1037
+ const j = D("FmTextarea"), U = D("FmButton"), E = D("FmForm"), W = D("FmSideSheet");
1042
1038
  return B(), O(W, {
1043
- modelValue: v(A),
1044
- "onUpdate:modelValue": F[2] || (F[2] = (z) => Ue(A) ? A.value = z : null),
1039
+ modelValue: v(V),
1040
+ "onUpdate:modelValue": F[2] || (F[2] = (z) => Ie(V) ? V.value = z : null),
1045
1041
  "dismiss-away": "",
1046
1042
  "max-width": 500
1047
1043
  }, {
1048
1044
  "side-sheet-header": C(() => [
1049
1045
  n("div", vn, [
1050
- n("div", fn, g(v(u)("inventory.stock.adjust.title")), 1)
1046
+ n("div", fn, g(v(i)("inventory.stock.adjust.title")), 1)
1051
1047
  ])
1052
1048
  ]),
1053
1049
  default: C(() => [
1054
- x(E, {
1050
+ b(E, {
1055
1051
  class: "w-full flex flex-col gap-12",
1056
1052
  ref_key: "formRef",
1057
1053
  ref: w,
1058
1054
  onValidationSuccess: o
1059
1055
  }, {
1060
1056
  default: C(() => [
1061
- x(j, {
1062
- label: v(u)("inventory.stock.adjust.remark"),
1063
- modelValue: b.remark,
1064
- "onUpdate:modelValue": F[0] || (F[0] = (z) => b.remark = z)
1057
+ b(j, {
1058
+ label: v(i)("inventory.stock.adjust.remark"),
1059
+ modelValue: h.remark,
1060
+ "onUpdate:modelValue": F[0] || (F[0] = (z) => h.remark = z)
1065
1061
  }, null, 8, ["label", "modelValue"]),
1066
1062
  n("div", yn, [
1067
- n("div", _n, g(v(u)("inventory.stock.adjust.adjustedItems")), 1),
1068
- x(I, {
1063
+ n("div", _n, g(v(i)("inventory.stock.adjust.adjustedItems")), 1),
1064
+ b(U, {
1069
1065
  "prepend-icon": "add",
1070
1066
  variant: "tertiary",
1071
1067
  size: "md",
1072
1068
  onClick: M
1073
1069
  })
1074
1070
  ]),
1075
- (B(!0), L(te, null, ae(b.adjustments, (z, P) => (B(), O(pn, {
1071
+ (B(!0), L(te, null, ae(h.adjustments, (z, P) => (B(), O(pn, {
1076
1072
  key: z.id,
1077
- modelValue: b.adjustments[P],
1078
- "onUpdate:modelValue": (N) => b.adjustments[P] = N,
1073
+ modelValue: h.adjustments[P],
1074
+ "onUpdate:modelValue": (N) => h.adjustments[P] = N,
1079
1075
  "onClick:delete": (N) => H(P)
1080
1076
  }, null, 8, ["modelValue", "onUpdate:modelValue", "onClick:delete"]))), 128))
1081
1077
  ]),
@@ -1084,8 +1080,8 @@ const Ve = {
1084
1080
  ]),
1085
1081
  "side-sheet-footer": C(() => [
1086
1082
  n("div", kn, [
1087
- x(I, {
1088
- label: v(u)("inventory.stock.adjust.adjustButton"),
1083
+ b(U, {
1084
+ label: v(i)("inventory.stock.adjust.adjustButton"),
1089
1085
  loading: k.value,
1090
1086
  onClick: F[1] || (F[1] = (z) => {
1091
1087
  var P, N;
@@ -1098,27 +1094,27 @@ const Ve = {
1098
1094
  }, 8, ["modelValue"]);
1099
1095
  };
1100
1096
  }
1101
- }), bn = Xe((c, d) => ({
1097
+ }), gn = Xe((c, m) => ({
1102
1098
  // TODO: remove once latest inventory backend has been push
1103
- async findBillsByBusinessId(r, s, S) {
1099
+ async findBillsByBusinessId(r, s, x) {
1104
1100
  const l = `${c.businessesBackendUrl}/${r}/reports/find-many`, a = {
1105
1101
  // type: TYPE.bill,
1106
1102
  type: "bill",
1107
1103
  restaurantIds: s,
1108
- ids: S
1104
+ ids: x
1109
1105
  };
1110
- return await d.post(l, a);
1106
+ return await m.post(l, a);
1111
1107
  },
1112
1108
  async findBillsById(r) {
1113
- const S = ue().currentLocationDBName, l = `${c.inventoryBackendUrl}/${S}/bill/search`, a = {
1109
+ const x = ue().currentLocationDBName, l = `${c.inventoryBackendUrl}/${x}/bill/search`, a = {
1114
1110
  ids: r
1115
1111
  };
1116
- return await d.post(l, a);
1112
+ return await m.post(l, a);
1117
1113
  }
1118
- })), gn = { class: "p-16" }, xn = { class: "fm-typo-en-body-md-600 flex-grow" }, Sn = { class: "flex-grow text-fm-color-typo-secondary" }, $n = {
1114
+ })), bn = { class: "p-16" }, xn = { class: "fm-typo-en-body-md-600 flex-grow" }, Sn = { class: "flex-grow text-fm-color-typo-secondary" }, $n = {
1119
1115
  key: 0,
1120
1116
  class: "my-5"
1121
- }, wn = { class: "text-neutral-400" }, Bn = { class: "flex-grow" }, Fn = { class: "flex gap-1" }, An = { class: "flex flex-col gap-1" }, Vn = {
1117
+ }, wn = { class: "text-neutral-400" }, Bn = { class: "flex-grow" }, Fn = { class: "flex gap-1" }, Vn = { class: "flex flex-col gap-1" }, An = {
1122
1118
  key: 1,
1123
1119
  class: "t-system text-fsecondary"
1124
1120
  }, Cn = {
@@ -1132,84 +1128,84 @@ const Ve = {
1132
1128
  bills: { default: () => [] }
1133
1129
  },
1134
1130
  setup(c) {
1135
- const d = c, r = R(!1), s = R(), S = R(null), l = T(() => S.value === null ? "unset" : r.value ? `${S.value}px` : "0px");
1131
+ const m = c, r = R(!1), s = R(), x = R(null), l = T(() => x.value === null ? "unset" : r.value ? `${x.value}px` : "0px");
1136
1132
  Je(() => {
1137
1133
  var k;
1138
- S.value = ((k = s.value) == null ? void 0 : k.scrollHeight) || 0;
1134
+ x.value = ((k = s.value) == null ? void 0 : k.scrollHeight) || 0;
1139
1135
  });
1140
1136
  const a = T(() => {
1141
- var b;
1142
- const k = d.record.adjustments, u = d.sku, o = {}, A = k.flatMap((p) => {
1137
+ var h;
1138
+ const k = m.record.adjustments, i = m.sku, o = {}, V = k.flatMap((p) => {
1143
1139
  var M;
1144
- return ((M = p.skus) == null ? void 0 : M.filter((H) => H.sku._id === u._id)) ?? [];
1140
+ return ((M = p.skus) == null ? void 0 : M.filter((H) => H.sku._id === i._id)) ?? [];
1145
1141
  }).flatMap((p) => p.amounts);
1146
- for (const p of A) {
1142
+ for (const p of V) {
1147
1143
  const M = p.measurement ? xt(p.measurement.conversion, p.amount) : p.amount;
1148
- o[b = p.type] ?? (o[b] = { amount: 0, precision: 0 }), o[p.type] = Ze(M, o[p.type]);
1144
+ o[h = p.type] ?? (o[h] = { amount: 0, precision: 0 }), o[p.type] = Ze(M, o[p.type]);
1149
1145
  }
1150
1146
  return Object.entries(o).reduce(
1151
1147
  (p, [M, H]) => (p[M] = /// comment, because without it formatter makes code uglier
1152
1148
  `${q.toFormatString({
1153
1149
  value: H,
1154
1150
  precision: 4
1155
- })} ${u.unit.abbrev}`, p),
1151
+ })} ${i.unit.abbrev}`, p),
1156
1152
  {}
1157
1153
  );
1158
- }), { t: i } = le(), h = T(() => d.record.adjustmentsByTime.map(({ date: k, adjustments: u }) => ({
1154
+ }), { t: u } = le(), S = T(() => m.record.adjustmentsByTime.map(({ date: k, adjustments: i }) => ({
1159
1155
  time: St(new Date(k)),
1160
- adjustments: u.flatMap(
1156
+ adjustments: i.flatMap(
1161
1157
  (o) => {
1162
- var w, A;
1163
- return ((A = (w = o.skus) == null ? void 0 : w.map) == null ? void 0 : A.call(w, (b) => ({
1164
- ...b,
1158
+ var w, V;
1159
+ return ((V = (w = o.skus) == null ? void 0 : w.map) == null ? void 0 : V.call(w, (h) => ({
1160
+ ...h,
1165
1161
  ref: o.ref,
1166
1162
  backdateFrom: o.effectiveAt != null ? ot(o._id) : null
1167
1163
  }))) ?? [];
1168
1164
  }
1169
1165
  ).flatMap((o) => {
1170
- var b;
1171
- const w = (b = d.bills.find((p) => p._id === o.ref)) == null ? void 0 : b.seqNumber, A = w ? i("inventory.stock.record.bill", [w]) : "";
1166
+ var h;
1167
+ const w = (h = m.bills.find((p) => p._id === o.ref)) == null ? void 0 : h.seqNumber, V = w ? u("inventory.stock.record.bill", [w]) : "";
1172
1168
  return o.amounts.map((p) => {
1173
1169
  var M;
1174
1170
  return {
1175
1171
  amount: `${q.toFormatString({ value: p.amount, precision: 4 })} ${((M = p.measurement) == null ? void 0 : M.abbrev) ?? o.sku.unit.abbrev}`,
1176
1172
  backdateFrom: o.backdateFrom,
1177
1173
  name: p.type,
1178
- remark: p.remark || A || "",
1174
+ remark: p.remark || V || "",
1179
1175
  cost: p.cost
1180
1176
  };
1181
1177
  });
1182
1178
  })
1183
1179
  })));
1184
- return (k, u) => {
1185
- const o = D("FmIcon"), w = D("FmTooltip"), A = D("FmCard");
1186
- return B(), O(A, { variant: "outlined" }, {
1180
+ return (k, i) => {
1181
+ const o = D("FmIcon"), w = D("FmTooltip"), V = D("FmCard");
1182
+ return B(), O(V, { variant: "outlined" }, {
1187
1183
  default: C(() => [
1188
- n("div", gn, [
1184
+ n("div", bn, [
1189
1185
  n("div", {
1190
1186
  class: "flex items-center cursor-pointer mb-1",
1191
- onClick: u[0] || (u[0] = (b) => r.value = !r.value)
1187
+ onClick: i[0] || (i[0] = (h) => r.value = !r.value)
1192
1188
  }, [
1193
1189
  n("div", xn, g(k.record.date), 1),
1194
- x(o, {
1190
+ b(o, {
1195
1191
  name: r.value ? "expand_more" : "expand_less",
1196
1192
  color: "#777777",
1197
1193
  size: "md"
1198
1194
  }, null, 8, ["name"])
1199
1195
  ]),
1200
- (B(!0), L(te, null, ae(a.value, (b, p) => (B(), L("div", {
1196
+ (B(!0), L(te, null, ae(a.value, (h, p) => (B(), L("div", {
1201
1197
  key: p,
1202
1198
  class: "flex flex-row py-1",
1203
1199
  style: { "font-size": "0.8rem" }
1204
1200
  }, [
1205
- n("div", Sn, g(v(i)(`inventory.inventoryAdjustment.type.${p}`)), 1),
1201
+ n("div", Sn, g(v(u)(`inventory.inventoryAdjustment.type.${p}`)), 1),
1206
1202
  n("div", {
1207
1203
  class: Ce({
1208
- "text-fm-color-typo-error": b.startsWith("-"),
1209
- "text-fm-color-typo-success": !b.startsWith("-"),
1204
+ "text-fm-color-typo-error": h.startsWith("-"),
1205
+ "text-fm-color-typo-success": !h.startsWith("-"),
1210
1206
  "ml-auto": !0
1211
1207
  })
1212
- }, g(b), 3)
1208
+ }, g(h), 3)
1213
1209
  ]))), 128)),
1214
1210
  n("div", {
1215
1211
  ref_key: "detailRef",
@@ -1221,19 +1217,19 @@ const Ve = {
1221
1217
  transition: "max-height 0.2s ease-out"
1222
1218
  })
1223
1219
  }, [
1224
- h.value.length ? (B(), L("hr", $n)) : ee("", !0),
1225
- (B(!0), L(te, null, ae(h.value, (b) => (B(), L("div", {
1226
- key: b.time,
1220
+ S.value.length ? (B(), L("hr", $n)) : ee("", !0),
1221
+ (B(!0), L(te, null, ae(S.value, (h) => (B(), L("div", {
1222
+ key: h.time,
1227
1223
  class: "flex gap-1 w-full"
1228
1224
  }, [
1229
- n("div", wn, g(b.time), 1),
1225
+ n("div", wn, g(h.time), 1),
1230
1226
  n("div", Bn, [
1231
- (B(!0), L(te, null, ae(b.adjustments, (p) => (B(), L("div", {
1227
+ (B(!0), L(te, null, ae(h.adjustments, (p) => (B(), L("div", {
1232
1228
  key: p.name,
1233
1229
  class: "flex gap-1"
1234
1230
  }, [
1235
1231
  n("div", Fn, [
1236
- ve(g(v(i)(`inventory.inventoryAdjustment.type.${p.name}`)) + " ", 1),
1232
+ ve(g(v(u)(`inventory.inventoryAdjustment.type.${p.name}`)) + " ", 1),
1237
1233
  p.backdateFrom ? (B(), O(w, {
1238
1234
  key: 0,
1239
1235
  variant: "plain",
@@ -1241,10 +1237,10 @@ const Ve = {
1241
1237
  "z-index": 50
1242
1238
  }, {
1243
1239
  content: C(() => [
1244
- n("div", An, g(v(i)("inventory.stock.record.backdate", [v(et)(new Date(p.backdateFrom))])), 1)
1240
+ n("div", Vn, g(v(u)("inventory.stock.record.backdate", [v(et)(new Date(p.backdateFrom))])), 1)
1245
1241
  ]),
1246
1242
  default: C(() => [
1247
- x(o, {
1243
+ b(o, {
1248
1244
  name: "info",
1249
1245
  size: "sm",
1250
1246
  color: "primary"
@@ -1252,7 +1248,7 @@ const Ve = {
1252
1248
  ]),
1253
1249
  _: 2
1254
1250
  }, 1024)) : ee("", !0),
1255
- p.remark ? (B(), L("span", Vn, " # " + g(p.remark), 1)) : ee("", !0)
1251
+ p.remark ? (B(), L("span", An, " # " + g(p.remark), 1)) : ee("", !0)
1256
1252
  ]),
1257
1253
  n("div", {
1258
1254
  class: Ce({
@@ -1273,66 +1269,66 @@ const Ve = {
1273
1269
  };
1274
1270
  }
1275
1271
  });
1276
- function Mn(c, d) {
1272
+ function Mn(c, m) {
1277
1273
  var l;
1278
1274
  const r = Object.keys(Z.enum).reduce(
1279
- (a, i) => (a[i] = { amount: 0, precision: 0 }, a),
1275
+ (a, u) => (a[u] = { amount: 0, precision: 0 }, a),
1280
1276
  {}
1281
1277
  );
1282
- if (!d)
1278
+ if (!m)
1283
1279
  return Object.entries(r).reduce(
1284
- (a, [i]) => (a[i] = q.fromNumber(0), a),
1280
+ (a, [u]) => (a[u] = q.fromNumber(0), a),
1285
1281
  {}
1286
1282
  );
1287
- const S = c.flatMap((a) => {
1288
- var i;
1289
- return ((i = a.skus) == null ? void 0 : i.filter((h) => h.sku._id === d._id)) ?? [];
1283
+ const x = c.flatMap((a) => {
1284
+ var u;
1285
+ return ((u = a.skus) == null ? void 0 : u.filter((S) => S.sku._id === m._id)) ?? [];
1290
1286
  }).flatMap((a) => a.amounts);
1291
- for (const a of S) {
1292
- const i = a.measurement ? q.multiply([a.measurement.conversion, a.amount]) : a.amount;
1293
- r[l = a.type] ?? (r[l] = { amount: 0, precision: 0 }), r[a.type] = q.add([i, r[a.type]]);
1287
+ for (const a of x) {
1288
+ const u = a.measurement ? q.multiply([a.measurement.conversion, a.amount]) : a.amount;
1289
+ r[l = a.type] ?? (r[l] = { amount: 0, precision: 0 }), r[a.type] = q.add([u, r[a.type]]);
1294
1290
  }
1295
1291
  return Object.entries(r).reduce(
1296
- (a, [i, h]) => {
1292
+ (a, [u, S]) => {
1297
1293
  const k = {
1298
- ...h,
1299
- amount: Math.abs(h.amount)
1294
+ ...S,
1295
+ amount: Math.abs(S.amount)
1300
1296
  };
1301
- return a[i] = /// comment, because without it formatter makes code uglier
1297
+ return a[u] = /// comment, because without it formatter makes code uglier
1302
1298
  `${q.toFormatString({
1303
1299
  value: k,
1304
1300
  precision: 4
1305
- })} ${d.unit.abbrev}`, a;
1301
+ })} ${m.unit.abbrev}`, a;
1306
1302
  },
1307
1303
  {}
1308
1304
  );
1309
1305
  }
1310
- function jn(c, d) {
1311
- if (!d)
1306
+ function jn(c, m) {
1307
+ if (!m)
1312
1308
  return null;
1313
1309
  let r = null;
1314
- const S = c.flatMap((l) => {
1310
+ const x = c.flatMap((l) => {
1315
1311
  var a;
1316
- return ((a = l.skus) == null ? void 0 : a.filter((i) => i.sku._id === d._id)) ?? [];
1312
+ return ((a = l.skus) == null ? void 0 : a.filter((u) => u.sku._id === m._id)) ?? [];
1317
1313
  }).flatMap((l) => {
1318
1314
  var a;
1319
1315
  return !l.history || ((a = l.history) == null ? void 0 : a.length) === 0 ? [] : l.history[0];
1320
1316
  });
1321
- for (const l of S) {
1317
+ for (const l of x) {
1322
1318
  const a = l.amounts;
1323
- for (const i of a) {
1324
- if (i.type !== Z.Enum.SALES)
1319
+ for (const u of a) {
1320
+ if (u.type !== Z.Enum.SALES)
1325
1321
  continue;
1326
- const h = i.measurement ? q.multiply([i.measurement.conversion, i.amount]) : i.amount;
1327
- r ?? (r = q.fromNumber(0)), r = q.add([r, h]);
1322
+ const S = u.measurement ? q.multiply([u.measurement.conversion, u.amount]) : u.amount;
1323
+ r ?? (r = q.fromNumber(0)), r = q.add([r, S]);
1328
1324
  }
1329
1325
  }
1330
1326
  return r != null ? (r.amount = Math.abs(r.amount), `${q.toFormatString({
1331
1327
  value: r,
1332
1328
  precision: 4
1333
- })} ${d.unit.abbrev}`) : null;
1329
+ })} ${m.unit.abbrev}`) : null;
1334
1330
  }
1335
- const In = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Un = { class: "flex-1 line-clamp-2" }, Pn = { class: "flex flex-col gap-32 w-full h-full" }, Tn = { class: "flex items-center relative gap-4" }, Rn = { class: "flex-1" }, Hn = {
1331
+ const Un = { class: "flex items-center w-full fm-typo-en-title-md-800" }, In = { class: "flex-1 line-clamp-2" }, Pn = { class: "flex flex-col gap-32 w-full h-full" }, Tn = { class: "flex items-center relative gap-4" }, Rn = { class: "flex-1" }, Hn = {
1336
1332
  key: 0,
1337
1333
  class: "flex-1 flex flex-col items-center gap-16"
1338
1334
  }, En = { class: "fm-typo-en-body-lg-400 translate-x-4" }, Ln = {
@@ -1344,10 +1340,10 @@ const In = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Un = {
1344
1340
  }, Yn = { class: "flex flex-col gap-1" }, Kn = { class: "text-fm-color-typo-secondary" }, Gn = { class: "font-bold" }, qn = { class: "flex flex-col gap-1" }, Wn = { class: "text-fm-color-typo-secondary flex" }, Jn = { class: "font-bold" }, Qn = { class: "flex flex-col gap-1" }, Xn = { class: "text-fm-color-typo-secondary" }, Zn = { class: "font-bold" }, eo = { class: "flex flex-col gap-1" }, to = { class: "text-fm-color-typo-secondary" }, no = { class: "font-bold" }, oo = { class: "flex flex-col gap-1" }, so = { class: "text-fm-color-typo-secondary" }, ao = { class: "font-bold" }, ro = { class: "flex flex-col gap-1" }, lo = { class: "text-fm-color-typo-secondary" }, io = { class: "font-bold" }, uo = { class: "flex flex-col gap-1" }, co = { class: "text-fm-color-typo-secondary" }, mo = { class: "font-bold" }, po = { class: "flex flex-col gap-1" }, vo = { class: "text-fm-color-typo-secondary" }, fo = { class: "font-bold" }, yo = { class: "flex flex-col gap-1" }, _o = { class: "text-fm-color-typo-secondary" }, ko = { class: "font-bold" }, ho = {
1345
1341
  key: 0,
1346
1342
  class: "flex flex-col gap-8"
1347
- }, bo = { class: "flex" }, go = { class: "flex-1 flex flex-col gap-1" }, xo = { class: "flex gap-1 items-center text-fm-color-typo-secondary" }, So = { class: "font-bold" }, $o = { class: "flex-1 flex flex-col gap-1" }, wo = { class: "flex gap-1 items-center text-fm-color-typo-secondary" }, Bo = { class: "flex flex-col gap-1" }, Fo = { class: "font-bold" }, Ao = /* @__PURE__ */ n("div", null, null, -1), Vo = {
1343
+ }, go = { class: "flex" }, bo = { class: "flex-1 flex flex-col gap-1" }, xo = { class: "flex gap-1 items-center text-fm-color-typo-secondary" }, So = { class: "font-bold" }, $o = { class: "flex-1 flex flex-col gap-1" }, wo = { class: "flex gap-1 items-center text-fm-color-typo-secondary" }, Bo = { class: "flex flex-col gap-1" }, Fo = { class: "font-bold" }, Vo = {
1348
1344
  key: 2,
1349
1345
  class: "flex-1 flex flex-col items-center gap-8"
1350
- }, Co = ["src"], Do = { class: "font-bold text-lg" }, Mo = { class: "text-xs text-neutral-400 text-center" }, jo = /* @__PURE__ */ re({
1346
+ }, Ao = ["src"], Co = { class: "font-bold text-lg" }, Do = { class: "text-xs text-neutral-400 text-center" }, Mo = /* @__PURE__ */ re({
1351
1347
  __name: "StockHistory",
1352
1348
  props: {
1353
1349
  sku: {},
@@ -1355,96 +1351,96 @@ const In = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Un = {
1355
1351
  },
1356
1352
  emits: ["update:show"],
1357
1353
  setup(c) {
1358
- const d = tt(), r = He(), s = Se(), S = bn(), l = ue(), a = wt(), { t: i } = le(), h = c, k = R(!1), u = de(), o = R(ct(0));
1354
+ const m = tt(), r = He(), s = Se(), x = gn(), l = ue(), a = wt(), { t: u } = le(), S = c, k = R(!1), i = de(), o = R(ct(0));
1359
1355
  async function w() {
1360
1356
  k.value = !0;
1361
1357
  try {
1362
1358
  await $(), await r.readStockBalance();
1363
1359
  } catch (e) {
1364
- u.open({
1360
+ i.open({
1365
1361
  title: "Something went wrong",
1366
1362
  message: "Cannot fetch stock history. Please try again.",
1367
1363
  type: "error"
1368
- }), console.log("failed at fetching item adjustment history", h.sku, o, e);
1364
+ }), console.log("failed at fetching item adjustment history", S.sku, o, e);
1369
1365
  } finally {
1370
1366
  k.value = !1;
1371
1367
  }
1372
1368
  }
1373
1369
  Je(() => {
1374
1370
  w();
1375
- }), he([() => o.value, () => h.sku], () => {
1371
+ }), he([() => o.value, () => S.sku], () => {
1376
1372
  w();
1377
1373
  });
1378
- const A = R([]), b = R([]), p = R(new Array());
1374
+ const V = R([]), h = R([]), p = R(new Array());
1379
1375
  function M(e, t) {
1380
1376
  return t === "day" ? Ct(e) : et(e);
1381
1377
  }
1382
1378
  function H(e, t) {
1383
1379
  const f = e.reduce(
1384
- (m, _) => {
1380
+ (d, _) => {
1385
1381
  const y = _.effectiveAt ?? ot(_._id);
1386
1382
  if (!y)
1387
- return m;
1388
- const V = M(new Date(y), t);
1389
- return m[V] ?? (m[V] = []), m[V].push(_), m;
1383
+ return d;
1384
+ const A = M(new Date(y), t);
1385
+ return d[A] ?? (d[A] = []), d[A].push(_), d;
1390
1386
  },
1391
1387
  {}
1392
1388
  );
1393
- return Object.keys(f).map((m) => ({
1394
- date: m,
1395
- adjustments: f[m]
1389
+ return Object.keys(f).map((d) => ({
1390
+ date: d,
1391
+ adjustments: f[d]
1396
1392
  }));
1397
1393
  }
1398
1394
  async function $() {
1399
1395
  let e = await s.readStockAdjustment(
1400
- h.sku._id,
1396
+ S.sku._id,
1401
1397
  Bt(new Date(o.value.startDate)).toISOString(),
1402
1398
  Ft(new Date(o.value.endDate)).toISOString()
1403
1399
  );
1404
- A.value = e;
1400
+ V.value = e;
1405
1401
  const t = e.filter(({ ref: f }) => f == null ? void 0 : f.startsWith("bill_")).map(({ ref: f }) => f);
1406
- await F(t), b.value = H(e, "day").map(({ date: f, adjustments: m }) => ({
1402
+ await F(t), h.value = H(e, "day").map(({ date: f, adjustments: d }) => ({
1407
1403
  date: f,
1408
- adjustments: m,
1409
- adjustmentsByTime: H(m, "minute")
1404
+ adjustments: d,
1405
+ adjustmentsByTime: H(d, "minute")
1410
1406
  }));
1411
1407
  }
1412
1408
  async function F(e) {
1413
- e.length && (p.value = await S.findBillsById(e).catch((t) => {
1409
+ e.length && (p.value = await x.findBillsById(e).catch((t) => {
1414
1410
  var _;
1415
1411
  console.error("Error on using latest bill API, retrying using legacy api", t);
1416
- const f = ((_ = d.currentBusiness.value) == null ? void 0 : _._id) ?? "", m = l.currentLocation.doc._id;
1417
- return S.findBillsByBusinessId(f, [m], e);
1412
+ const f = ((_ = m.currentBusiness.value) == null ? void 0 : _._id) ?? "", d = l.currentLocation.doc._id;
1413
+ return x.findBillsByBusinessId(f, [d], e);
1418
1414
  }));
1419
1415
  }
1420
1416
  const j = T(() => {
1421
- const e = A.value, t = h.sku;
1417
+ const e = V.value, t = S.sku;
1422
1418
  return Mn(e, t);
1423
- }), I = T(() => {
1424
- const e = A.value, t = h.sku;
1419
+ }), U = T(() => {
1420
+ const e = V.value, t = S.sku;
1425
1421
  return jn(e, t);
1426
1422
  }), E = T(() => {
1427
- const e = [...A.value].computeFirst((f) => {
1423
+ const e = [...V.value].computeFirst((f) => {
1428
1424
  var _, y;
1429
- const m = (y = (_ = f.skus) == null ? void 0 : _.find) == null ? void 0 : y.call(_, (V) => V.sku._id === h.sku._id);
1430
- return m == null ? void 0 : m.fromBalance;
1425
+ const d = (y = (_ = f.skus) == null ? void 0 : _.find) == null ? void 0 : y.call(_, (A) => A.sku._id === S.sku._id);
1426
+ return d == null ? void 0 : d.fromBalance;
1431
1427
  }) ?? {
1432
1428
  amount: 0,
1433
1429
  precision: 0
1434
- }, t = h.sku;
1430
+ }, t = S.sku;
1435
1431
  return t ? `${q.toFormatString({
1436
1432
  value: e,
1437
1433
  precision: 4
1438
1434
  })} ${t.unit.abbrev}` : "";
1439
1435
  }), W = T(() => {
1440
- const e = [...A.value].reverse().computeFirst((f) => {
1436
+ const e = [...V.value].reverse().computeFirst((f) => {
1441
1437
  var _, y;
1442
- const m = (y = (_ = f.skus) == null ? void 0 : _.find) == null ? void 0 : y.call(_, (V) => V.sku._id === h.sku._id);
1443
- return m == null ? void 0 : m.toBalance;
1438
+ const d = (y = (_ = f.skus) == null ? void 0 : _.find) == null ? void 0 : y.call(_, (A) => A.sku._id === S.sku._id);
1439
+ return d == null ? void 0 : d.toBalance;
1444
1440
  }) ?? {
1445
1441
  amount: 0,
1446
1442
  precision: 0
1447
- }, t = h.sku;
1443
+ }, t = S.sku;
1448
1444
  return t ? `${q.toFormatString({ value: e, precision: 4 })} ${t.unit.abbrev}` : "";
1449
1445
  });
1450
1446
  function z(e) {
@@ -1461,32 +1457,32 @@ const In = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Un = {
1461
1457
  }
1462
1458
  const P = T(() => {
1463
1459
  var f;
1464
- const t = A.value.flatMap((m) => {
1460
+ const t = V.value.flatMap((d) => {
1465
1461
  var _;
1466
- return ((_ = m.skus) == null ? void 0 : _.flatMap((y) => y.amounts)) ?? [];
1467
- }).filter((m) => m.amount.amount < 0).reduce(
1468
- (m, _) => {
1462
+ return ((_ = d.skus) == null ? void 0 : _.flatMap((y) => y.amounts)) ?? [];
1463
+ }).filter((d) => d.amount.amount < 0).reduce(
1464
+ (d, _) => {
1469
1465
  const y = _.cost;
1470
- if (!y) return m;
1471
- const V = {
1472
- ...$t(m, Math.max(m.precision, y.precision)),
1466
+ if (!y) return d;
1467
+ const A = {
1468
+ ...$t(d, Math.max(d.precision, y.precision)),
1473
1469
  currency: y.currency
1474
1470
  };
1475
1471
  return {
1476
- ...Ze(V, y),
1477
- currency: m.currency
1472
+ ...Ze(A, y),
1473
+ currency: d.currency
1478
1474
  };
1479
1475
  },
1480
1476
  {
1481
1477
  amount: 0,
1482
1478
  precision: 0,
1483
- currency: z(((f = d.currentCountry) == null ? void 0 : f.value) ?? Ye)
1479
+ currency: z(((f = m.currentCountry) == null ? void 0 : f.value) ?? Ye)
1484
1480
  }
1485
1481
  );
1486
1482
  return je(t, !1, t.precision);
1487
1483
  });
1488
1484
  function N() {
1489
- const { startDate: e, endDate: t } = At(o.value);
1485
+ const { startDate: e, endDate: t } = Vt(o.value);
1490
1486
  e !== null && t !== null && (o.value = {
1491
1487
  startDate: e,
1492
1488
  endDate: t
@@ -1494,40 +1490,40 @@ const In = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Un = {
1494
1490
  }
1495
1491
  const ne = T(() => {
1496
1492
  var f;
1497
- const e = [...A.value].reverse().computeFirst((m) => {
1498
- var y, V;
1499
- const _ = (V = (y = m.skus) == null ? void 0 : y.find) == null ? void 0 : V.call(y, (K) => K.sku._id === h.sku._id);
1493
+ const e = [...V.value].reverse().computeFirst((d) => {
1494
+ var y, A;
1495
+ const _ = (A = (y = d.skus) == null ? void 0 : y.find) == null ? void 0 : A.call(y, (K) => K.sku._id === S.sku._id);
1500
1496
  return _ == null ? void 0 : _.toCostBalances;
1501
1497
  });
1502
1498
  return e ? {
1503
- ...e.reduce((m, _) => q.add([m, q.fromDinero(_.cost)]), {
1499
+ ...e.reduce((d, _) => q.add([d, q.fromDinero(_.cost)]), {
1504
1500
  amount: 0,
1505
1501
  precision: 0
1506
1502
  }),
1507
- currency: z(((f = d.currentCountry) == null ? void 0 : f.value) ?? Ye)
1503
+ currency: z(((f = m.currentCountry) == null ? void 0 : f.value) ?? Ye)
1508
1504
  } : "No data";
1509
1505
  });
1510
1506
  function ce() {
1511
- const { startDate: e, endDate: t } = Vt(o.value);
1507
+ const { startDate: e, endDate: t } = At(o.value);
1512
1508
  e !== null && t !== null && (o.value = {
1513
1509
  startDate: e,
1514
1510
  endDate: t
1515
1511
  });
1516
1512
  }
1517
- const oe = Re(h, "show");
1513
+ const oe = Re(S, "show");
1518
1514
  return (e, t) => {
1519
- const f = D("FmButton"), m = D("FmField"), _ = D("FmDateRangePicker"), y = D("FmSpacer"), V = D("FmCircularProgress"), K = D("FmIcon"), Q = D("FmTooltip"), me = D("FmMenuDivider"), U = D("FmCardSection"), Y = D("FmCard"), J = D("FmSideSheet");
1515
+ const f = D("FmButton"), d = D("FmField"), _ = D("FmDateRangePicker"), y = D("FmSpacer"), A = D("FmCircularProgress"), K = D("FmIcon"), Q = D("FmTooltip"), me = D("FmMenuDivider"), I = D("FmCardSection"), Y = D("FmCard"), J = D("FmSideSheet");
1520
1516
  return B(), O(J, {
1521
1517
  "dismiss-away": "",
1522
1518
  modelValue: v(oe),
1523
- "onUpdate:modelValue": t[4] || (t[4] = (X) => Ue(oe) ? oe.value = X : null),
1519
+ "onUpdate:modelValue": t[4] || (t[4] = (X) => Ie(oe) ? oe.value = X : null),
1524
1520
  "close-button": !1,
1525
1521
  "max-width": 560
1526
1522
  }, {
1527
1523
  "side-sheet-header": C(() => [
1528
- n("div", In, [
1529
- n("div", Un, g(v(i)("inventory.stock.history.title", [e.sku.name])), 1),
1530
- x(f, {
1524
+ n("div", Un, [
1525
+ n("div", In, g(v(u)("inventory.stock.history.title", [e.sku.name])), 1),
1526
+ b(f, {
1531
1527
  variant: "tertiary",
1532
1528
  "prepend-icon": "close",
1533
1529
  onClick: t[0] || (t[0] = (X) => oe.value = !1)
@@ -1540,7 +1536,7 @@ const In = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Un = {
1540
1536
  n("div", Pn, [
1541
1537
  n("div", Tn, [
1542
1538
  n("div", Rn, [
1543
- x(_, {
1539
+ b(_, {
1544
1540
  modelValue: o.value,
1545
1541
  "onUpdate:modelValue": t[1] || (t[1] = (G) => o.value = G),
1546
1542
  "show-predefined-range": "",
@@ -1549,7 +1545,7 @@ const In = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Un = {
1549
1545
  "z-index": 50
1550
1546
  }, {
1551
1547
  "trigger-button": C(({ opened: G }) => [
1552
- x(m, {
1548
+ b(d, {
1553
1549
  "prepend-icon": "calendar_month",
1554
1550
  focused: G
1555
1551
  }, {
@@ -1562,48 +1558,48 @@ const In = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Un = {
1562
1558
  _: 1
1563
1559
  }, 8, ["modelValue"])
1564
1560
  ]),
1565
- x(f, {
1561
+ b(f, {
1566
1562
  variant: "tertiary",
1567
1563
  onClick: t[2] || (t[2] = (G) => N()),
1568
1564
  "prepend-icon": "navigate_before"
1569
1565
  }),
1570
- x(f, {
1566
+ b(f, {
1571
1567
  variant: "tertiary",
1572
1568
  onClick: t[3] || (t[3] = (G) => ce()),
1573
1569
  "prepend-icon": "navigate_next"
1574
1570
  })
1575
1571
  ]),
1576
1572
  k.value ? (B(), L("div", Hn, [
1577
- x(y),
1578
- x(V, { size: "xl" }),
1579
- n("div", En, g(v(i)("inventory.stock.history.loading")), 1),
1580
- x(y),
1581
- x(y)
1582
- ])) : b.value && ((X = b.value) == null ? void 0 : X.length) > 0 ? (B(), L("div", Ln, [
1583
- x(Y, { variant: "outlined" }, {
1573
+ b(y),
1574
+ b(A, { size: "xl" }),
1575
+ n("div", En, g(v(u)("inventory.stock.history.loading")), 1),
1576
+ b(y),
1577
+ b(y)
1578
+ ])) : h.value && ((X = h.value) == null ? void 0 : X.length) > 0 ? (B(), L("div", Ln, [
1579
+ b(Y, { variant: "outlined" }, {
1584
1580
  default: C(() => [
1585
- x(U, { class: "flex flex-col gap-4" }, {
1581
+ b(I, { class: "flex flex-col gap-4" }, {
1586
1582
  default: C(() => [
1587
1583
  n("div", Nn, [
1588
- n("div", On, g(v(i)("inventory.stock.history.summary.title")), 1)
1584
+ n("div", On, g(v(u)("inventory.stock.history.summary.title")), 1)
1589
1585
  ]),
1590
1586
  n("div", zn, [
1591
1587
  n("div", Yn, [
1592
- n("div", Kn, g(v(i)("inventory.stock.history.summary.totalPurchase")), 1),
1588
+ n("div", Kn, g(v(u)("inventory.stock.history.summary.totalPurchase")), 1),
1593
1589
  n("div", Gn, g(j.value.PURCHASE), 1)
1594
1590
  ]),
1595
1591
  n("div", qn, [
1596
1592
  n("div", Wn, [
1597
- ve(g(v(i)("inventory.stock.history.summary.totalSales")) + "  ", 1),
1598
- I.value != null ? (B(), O(Q, {
1593
+ ve(g(v(u)("inventory.stock.history.summary.totalSales")) + "  ", 1),
1594
+ U.value != null ? (B(), O(Q, {
1599
1595
  key: 0,
1600
1596
  variant: "plain",
1601
1597
  placement: "top",
1602
- content: `Before: ${I.value}`,
1598
+ content: `Before: ${U.value}`,
1603
1599
  "z-index": 50
1604
1600
  }, {
1605
1601
  default: C(() => [
1606
- x(K, {
1602
+ b(K, {
1607
1603
  name: "warning",
1608
1604
  size: "sm"
1609
1605
  })
@@ -1614,50 +1610,50 @@ const In = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Un = {
1614
1610
  n("div", Jn, g(j.value.SALES), 1)
1615
1611
  ]),
1616
1612
  n("div", Qn, [
1617
- n("div", Xn, g(v(i)("inventory.stock.history.summary.totalLose")), 1),
1613
+ n("div", Xn, g(v(u)("inventory.stock.history.summary.totalLose")), 1),
1618
1614
  n("div", Zn, g(j.value.LOSE), 1)
1619
1615
  ]),
1620
1616
  n("div", eo, [
1621
- n("div", to, g(v(i)("inventory.stock.history.summary.totalRequest")), 1),
1617
+ n("div", to, g(v(u)("inventory.stock.history.summary.totalRequest")), 1),
1622
1618
  n("div", no, g(j.value.REQUEST), 1)
1623
1619
  ]),
1624
1620
  n("div", oo, [
1625
- n("div", so, g(v(i)("inventory.stock.history.summary.totalReceive")), 1),
1621
+ n("div", so, g(v(u)("inventory.stock.history.summary.totalReceive")), 1),
1626
1622
  n("div", ao, g(j.value.RECEIVE), 1)
1627
1623
  ]),
1628
1624
  n("div", ro, [
1629
- n("div", lo, g(v(i)("inventory.stock.history.summary.totalConvert")), 1),
1625
+ n("div", lo, g(v(u)("inventory.stock.history.summary.totalConvert")), 1),
1630
1626
  n("div", io, g(j.value.CONVERT), 1)
1631
1627
  ]),
1632
1628
  n("div", uo, [
1633
- n("div", co, g(v(i)("inventory.stock.history.summary.totalDamage")), 1),
1629
+ n("div", co, g(v(u)("inventory.stock.history.summary.totalDamage")), 1),
1634
1630
  n("div", mo, g(j.value.DAMAGE), 1)
1635
1631
  ]),
1636
1632
  n("div", po, [
1637
- n("div", vo, g(v(i)("inventory.stock.history.summary.openingBalance")), 1),
1633
+ n("div", vo, g(v(u)("inventory.stock.history.summary.openingBalance")), 1),
1638
1634
  n("div", fo, g(E.value), 1)
1639
1635
  ]),
1640
1636
  n("div", yo, [
1641
- n("div", _o, g(v(i)("inventory.stock.history.summary.lastStockBalance")), 1),
1637
+ n("div", _o, g(v(u)("inventory.stock.history.summary.lastStockBalance")), 1),
1642
1638
  n("div", ko, g(W.value), 1)
1643
1639
  ])
1644
1640
  ]),
1645
1641
  v(a).enableTotalCost ? (B(), L("div", ho, [
1646
- x(me, { class: "w-full" }),
1647
- n("div", bo, [
1648
- n("div", go, [
1649
- x(Ge, { "z-index": 50 }, {
1642
+ b(me, { class: "w-full" }),
1643
+ n("div", go, [
1644
+ n("div", bo, [
1645
+ b(Ge, { "z-index": 50 }, {
1650
1646
  default: C(() => [
1651
1647
  n("div", xo, [
1652
- ve(g(v(i)("inventory.stock.history.estimatedValue")) + " ", 1),
1653
- x(Q, {
1648
+ ve(g(v(u)("inventory.stock.history.estimatedValue")) + " ", 1),
1649
+ b(Q, {
1654
1650
  variant: "plain",
1655
1651
  placement: "top",
1656
- content: v(i)("inventory.stock.history.estimatedValueTooltip"),
1652
+ content: v(u)("inventory.stock.history.estimatedValueTooltip"),
1657
1653
  "z-index": 50
1658
1654
  }, {
1659
1655
  default: C(() => [
1660
- x(K, {
1656
+ b(K, {
1661
1657
  name: "help",
1662
1658
  size: "sm"
1663
1659
  })
@@ -1671,20 +1667,20 @@ const In = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Un = {
1671
1667
  n("div", So, g(typeof ne.value != "string" ? v(je)(ne.value, !1, ne.value.precision) : ne.value), 1)
1672
1668
  ]),
1673
1669
  n("div", $o, [
1674
- x(Ge, { "z-index": 50 }, {
1670
+ b(Ge, { "z-index": 50 }, {
1675
1671
  default: C(() => [
1676
1672
  n("div", wo, [
1677
- ve(g(v(i)("inventory.stock.history.costSold")) + " ", 1),
1678
- x(Q, {
1673
+ ve(g(v(u)("inventory.stock.history.costSold")) + " ", 1),
1674
+ b(Q, {
1679
1675
  variant: "plain",
1680
1676
  placement: "top",
1681
1677
  "z-index": 50
1682
1678
  }, {
1683
1679
  content: C(() => [
1684
- n("div", Bo, g(v(i)("inventory.stock.history.costSoldTooltip")), 1)
1680
+ n("div", Bo, g(v(u)("inventory.stock.history.costSoldTooltip")), 1)
1685
1681
  ]),
1686
1682
  default: C(() => [
1687
- x(K, {
1683
+ b(K, {
1688
1684
  name: "help",
1689
1685
  size: "sm"
1690
1686
  })
@@ -1705,8 +1701,8 @@ const In = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Un = {
1705
1701
  ]),
1706
1702
  _: 1
1707
1703
  }),
1708
- Ao,
1709
- (B(!0), L(te, null, ae(b.value, (G) => (B(), L(te, {
1704
+ t[5] || (t[5] = n("div", null, null, -1)),
1705
+ (B(!0), L(te, null, ae(h.value, (G) => (B(), L(te, {
1710
1706
  key: G.date
1711
1707
  }, [
1712
1708
  e.sku ? (B(), O(Dn, {
@@ -1717,17 +1713,17 @@ const In = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Un = {
1717
1713
  }, null, 8, ["record", "sku", "bills"])) : ee("", !0)
1718
1714
  ], 64))), 128))
1719
1715
  ])) : (B(), L("div", Vo, [
1720
- x(y),
1716
+ b(y),
1721
1717
  n("div", null, [
1722
1718
  n("img", {
1723
1719
  src: v(Et),
1724
1720
  alt: "List is empty"
1725
- }, null, 8, Co)
1721
+ }, null, 8, Ao)
1726
1722
  ]),
1727
- n("div", Do, g(v(i)("inventory.stock.history.noRecords")), 1),
1728
- n("div", Mo, g(v(i)("inventory.stock.history.changeDateRange")), 1),
1729
- x(y),
1730
- x(y)
1723
+ n("div", Co, g(v(u)("inventory.stock.history.noRecords")), 1),
1724
+ n("div", Do, g(v(u)("inventory.stock.history.changeDateRange")), 1),
1725
+ b(y),
1726
+ b(y)
1731
1727
  ]))
1732
1728
  ])
1733
1729
  ];
@@ -1736,25 +1732,25 @@ const In = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Un = {
1736
1732
  }, 8, ["modelValue"]);
1737
1733
  };
1738
1734
  }
1739
- }), Io = { class: "px-24 xs:p-0 sm:p-0 flex flex-col gap-8 h-full" }, Uo = { class: "flex flex-col gap-8" }, Po = { class: "flex flex-col" }, To = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ro = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary line-clamp-1" }, es = /* @__PURE__ */ re({
1735
+ }), jo = { class: "px-24 xs:p-0 sm:p-0 flex flex-col gap-8 h-full" }, Uo = { class: "flex flex-col gap-8" }, Io = { class: "flex flex-col" }, Po = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, To = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary line-clamp-1" }, Zo = /* @__PURE__ */ re({
1740
1736
  __name: "StockView",
1741
1737
  setup(c) {
1742
- const { t: d } = le(), r = Te(), s = ue(), S = He(), l = lt(), a = at(), { columnDefs: i } = qt();
1743
- s.watchLocation(u);
1744
- const h = R(!1), k = de();
1745
- async function u() {
1738
+ const { t: m } = le(), r = Te(), s = ue(), x = He(), l = lt(), a = at(), { columnDefs: u } = qt();
1739
+ s.watchLocation(i);
1740
+ const S = R(!1), k = de();
1741
+ async function i() {
1746
1742
  if (s._currentLocation) {
1747
- h.value = !0;
1743
+ S.value = !0;
1748
1744
  try {
1749
- await S.readStockBalance(), await S.readProductBalance(), await a.readStockEstimateBalance();
1745
+ await x.readStockBalance(), await x.readProductBalance(), await a.readStockEstimateBalance();
1750
1746
  } catch {
1751
1747
  k.open({
1752
- title: d("inventory.stock.error.title"),
1753
- message: d("inventory.stock.error.message"),
1748
+ title: m("inventory.stock.error.title"),
1749
+ message: m("inventory.stock.error.message"),
1754
1750
  type: "error"
1755
1751
  });
1756
1752
  } finally {
1757
- h.value = !1;
1753
+ S.value = !1;
1758
1754
  }
1759
1755
  }
1760
1756
  }
@@ -1762,9 +1758,9 @@ const In = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Un = {
1762
1758
  () => r.skus.map(($) => {
1763
1759
  var W, z, P;
1764
1760
  const F = $.trackingMeasurement;
1765
- let j = (z = (W = S.stockBalance.skus) == null ? void 0 : W.find(
1761
+ let j = (z = (W = x.stockBalance.skus) == null ? void 0 : W.find(
1766
1762
  (N) => N.id === $._id
1767
- )) == null ? void 0 : z.balance, I = a.inventoryForecast.skus.find(
1763
+ )) == null ? void 0 : z.balance, U = a.inventoryForecast.skus.find(
1768
1764
  (N) => N.id === $._id
1769
1765
  );
1770
1766
  return {
@@ -1773,11 +1769,11 @@ const In = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Un = {
1773
1769
  amount: 0,
1774
1770
  precision: 0
1775
1771
  },
1776
- day: (I == null ? void 0 : I.depletionDays) ?? void 0,
1772
+ day: (U == null ? void 0 : U.depletionDays) ?? void 0,
1777
1773
  trackingUnitAbbrev: F ? ((P = $.unit.measurements.find((N) => N.id === F)) == null ? void 0 : P.abbrev) ?? "" : $.unit.abbrev
1778
1774
  };
1779
1775
  })
1780
- ), w = R(""), { breakpoints: A } = Mt(), b = T(() => A.value.xs || A.value.sm ? 10 : 20), p = Ut(), M = T(
1776
+ ), w = R(""), { breakpoints: V } = Mt(), h = T(() => V.value.xs || V.value.sm ? 10 : 20), p = It(), M = T(
1781
1777
  () => {
1782
1778
  var $;
1783
1779
  return (($ = s._currentLocation) == null ? void 0 : $.type) === Dt.restaurant;
@@ -1786,18 +1782,18 @@ const In = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Un = {
1786
1782
  const $ = [
1787
1783
  { icon: "ios_share", onClick: () => zt(o.value) }
1788
1784
  ];
1789
- return M.value ? [{ icon: "refresh", onClick: u }, ...$] : $;
1785
+ return M.value ? [{ icon: "refresh", onClick: i }, ...$] : $;
1790
1786
  });
1791
1787
  return ($, F) => {
1792
1788
  const j = D("FmTable");
1793
1789
  return B(), O(dt, {
1794
- title: v(d)("inventory.stock.title")
1790
+ title: v(m)("inventory.stock.title")
1795
1791
  }, {
1796
1792
  default: C(() => {
1797
- var I, E, W, z;
1793
+ var U, E, W, z;
1798
1794
  return [
1799
- n("div", Io, [
1800
- x(mt, {
1795
+ n("div", jo, [
1796
+ b(mt, {
1801
1797
  searchable: "",
1802
1798
  "change-location": "",
1803
1799
  search: w.value,
@@ -1806,44 +1802,44 @@ const In = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Un = {
1806
1802
  }, null, 8, ["search", "actions"]),
1807
1803
  (B(), O(j, {
1808
1804
  style: Qe(v(p).tableHeight),
1809
- "column-defs": v(i),
1805
+ "column-defs": v(u),
1810
1806
  "row-data": o.value,
1811
1807
  "search-value": w.value,
1812
- loading: h.value || !v(s)._currentLocation,
1813
- key: (I = v(s)._currentLocation) == null ? void 0 : I.dbName,
1808
+ loading: S.value || !v(s)._currentLocation,
1809
+ key: (U = v(s)._currentLocation) == null ? void 0 : U.dbName,
1814
1810
  onRowClick: F[1] || (F[1] = (P) => v(l).showSkuHistory(P.original)),
1815
- "page-size": b.value
1811
+ "page-size": h.value
1816
1812
  }, {
1817
1813
  "list-row": C((P) => [
1818
- x(It, {
1814
+ b(Ut, {
1819
1815
  row: P,
1820
1816
  onRowClick: v(l).showSkuHistory
1821
1817
  }, {
1822
1818
  default: C((N) => {
1823
- var ne, ce, oe, e, t, f, m, _, y, V;
1819
+ var ne, ce, oe, e, t, f, d, _, y, A;
1824
1820
  return [
1825
1821
  n("div", Uo, [
1826
- n("div", Po, [
1827
- n("div", To, [
1828
- x(v(Ke), {
1822
+ n("div", Io, [
1823
+ n("div", Po, [
1824
+ b(v(Ke), {
1829
1825
  render: (oe = (ce = (ne = N.code) == null ? void 0 : ne.column) == null ? void 0 : ce.columnDef) == null ? void 0 : oe.cell,
1830
1826
  props: (t = (e = N.code) == null ? void 0 : e.getContext) == null ? void 0 : t.call(e)
1831
1827
  }, null, 8, ["render", "props"])
1832
1828
  ]),
1833
- n("div", Ro, [
1834
- x(v(Ke), {
1835
- render: (_ = (m = (f = N.name) == null ? void 0 : f.column) == null ? void 0 : m.columnDef) == null ? void 0 : _.cell,
1836
- props: (V = (y = N.name) == null ? void 0 : y.getContext) == null ? void 0 : V.call(y)
1829
+ n("div", To, [
1830
+ b(v(Ke), {
1831
+ render: (_ = (d = (f = N.name) == null ? void 0 : f.column) == null ? void 0 : d.columnDef) == null ? void 0 : _.cell,
1832
+ props: (A = (y = N.name) == null ? void 0 : y.getContext) == null ? void 0 : A.call(y)
1837
1833
  }, null, 8, ["render", "props"])
1838
1834
  ])
1839
1835
  ]),
1840
1836
  n("div", null, [
1841
- x(Ie, {
1837
+ b(Ue, {
1842
1838
  days: P.original.day
1843
1839
  }, null, 8, ["days"])
1844
1840
  ]),
1845
1841
  n("div", null, [
1846
- x(rt, {
1842
+ b(rt, {
1847
1843
  class: "xs:w-[160px]",
1848
1844
  unit: P.original.unit,
1849
1845
  sku: P.original,
@@ -1861,7 +1857,7 @@ const In = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Un = {
1861
1857
  }, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"]))
1862
1858
  ]),
1863
1859
  (B(), O(ut, { to: "body" }, [
1864
- (E = v(l).stockHistoryProps) != null && E.sku ? (B(), O(jo, $e(we({ key: 0 }, v(l).stockHistoryProps)), null, 16)) : ee("", !0),
1860
+ (E = v(l).stockHistoryProps) != null && E.sku ? (B(), O(Mo, $e(we({ key: 0 }, v(l).stockHistoryProps)), null, 16)) : ee("", !0),
1865
1861
  (W = v(l).convertSkuDialogProps) != null && W.sku ? (B(), O(cn, $e(we({ key: 1 }, v(l).convertSkuDialogProps)), null, 16)) : ee("", !0),
1866
1862
  (z = v(l).adjustSkuDialogProps) != null && z.stock ? (B(), O(hn, $e(we({ key: 2 }, v(l).adjustSkuDialogProps)), null, 16)) : ee("", !0)
1867
1863
  ]))
@@ -1873,5 +1869,5 @@ const In = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Un = {
1873
1869
  }
1874
1870
  });
1875
1871
  export {
1876
- es as default
1872
+ Zo as default
1877
1873
  };