@feedmepos/mf-inventory-portal 1.2.60-dev.1 → 1.2.60

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 (132) hide show
  1. package/dist/{App-Dgk5k8U-.js → App-B6JtYLP4.js} +78 -82
  2. package/dist/{ApprovalView-CU2YMuZb.js → ApprovalView-fiHlFJKJ.js} +5 -5
  3. package/dist/{BindingsDialog-Cu0AR6jW.js → BindingsDialog-BlF79qCu.js} +5 -5
  4. package/dist/{BindingsPicker-DyycJJ6i.js → BindingsPicker-BS2OcyII.js} +3 -3
  5. package/dist/{BindingsTable-wFAnOCdU.js → BindingsTable-RyfzT4g6.js} +5 -5
  6. package/dist/{ClosingDraftView-C01bZNv_.js → ClosingDraftView-B2d-XA_E.js} +216 -217
  7. package/dist/{ClosingHistoryView-Bwjadf1x.js → ClosingHistoryView-DZPNorN6.js} +36 -36
  8. package/dist/{ClosingTemplateView-BAalivwa.js → ClosingTemplateView-L596UQJH.js} +14 -14
  9. package/dist/{DeliveryOrderPrintPreview-CaEmXkPV.js → DeliveryOrderPrintPreview-C82JPcVR.js} +7 -7
  10. package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-D7J8uo_B.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-CNf3PA0N.js} +17 -17
  11. package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DU4I0imJ.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-WWzwaGw-.js} +2 -2
  12. package/dist/{FmMultiselectDialog-v004bPKF.js → FmMultiselectDialog-CcMB_4yD.js} +16 -16
  13. package/dist/{FmMultiselectDialog-CdhcCzVw.js → FmMultiselectDialog-DTLcPYaF.js} +1 -1
  14. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-C756UIBL.js → FmUnitInput.vue_vue_type_script_setup_true_lang-ChqG8Av1.js} +22 -23
  15. package/dist/{ImportView-WyG44i3g.js → ImportView-diTEPSKt.js} +6 -6
  16. package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-Y74PdyhQ.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-Cu-dNL-B.js} +1 -1
  17. package/dist/{IngredientGroupView-7bkBWvrQ.js → IngredientGroupView-CYqZOXH1.js} +5 -5
  18. package/dist/{IngredientsView-BDgOWARl.js → IngredientsView-DoCTezXa.js} +24 -25
  19. package/dist/{IntegrationView-BB7asiWy.js → IntegrationView-JboVfhvd.js} +17 -18
  20. package/dist/{InventoryBindingForm-CU9dnGdy.js → InventoryBindingForm-B1MrDzRK.js} +1 -1
  21. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-BmlVB1SU.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-Br1hzlQ5.js} +16 -17
  22. package/dist/{InventoryBindingSummary-D2W_WcLV.js → InventoryBindingSummary-B09SU9pE.js} +1 -1
  23. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-CVfShkXe.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-BX26mYQG.js} +5 -5
  24. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-CC4jkZg4.js → PremiumBadge.vue_vue_type_script_setup_true_lang-DIk5aP_6.js} +2 -2
  25. package/dist/{PublishView-DR_TwAkf.js → PublishView-BLu0VGTW.js} +8 -8
  26. package/dist/{PurchaseOrderPrintPreview-CoX0u7jn.js → PurchaseOrderPrintPreview-CFZX2Yen.js} +11 -11
  27. package/dist/{ReceiveRequestView-VBePJl-U.js → ReceiveRequestView-DD0kz7x8.js} +248 -249
  28. package/dist/RecipeView-Cg7v20hW.js +646 -0
  29. package/dist/{StockView-BFv_Tl8E.js → StockView-CJk1YeM_.js} +646 -645
  30. package/dist/SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-BFCjZO6S.js +183 -0
  31. package/dist/{SupplierView-PSGUQEzz.js → SupplierView-CTEInwI-.js} +19 -20
  32. package/dist/{SurchargeView-B7qTXk1L.js → SurchargeView-CKJ2LS9l.js} +6 -6
  33. package/dist/{SystemTrailDialog.vue_vue_type_script_setup_true_lang-CxEeb4BW.js → SystemTrailDialog.vue_vue_type_script_setup_true_lang-DVhI5Qy6.js} +2 -2
  34. package/dist/{TemplatePublishDialog.vue_vue_type_script_setup_true_lang-Dxg6HaiQ.js → TemplatePublishDialog.vue_vue_type_script_setup_true_lang-DjjLI4tM.js} +1 -1
  35. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-Dte8E0MX.js +3354 -0
  36. package/dist/{TransferTemplateView-CsRPCwN_.js → TransferTemplateView-rmrQtfX8.js} +21 -22
  37. package/dist/{UnitView-CdZ_GaUr.js → UnitView-Drvo3Tew.js} +10 -11
  38. package/dist/{WarehouseView-DQGYq00N.js → WarehouseView-DIBgCCzG.js} +5 -5
  39. package/dist/{WastageTemplateView-CE7aiWUH.js → WastageTemplateView-Cdvx4Ist.js} +14 -14
  40. package/dist/api/inventory.d.ts +36 -126
  41. package/dist/api/netsuite.d.ts +1 -8
  42. package/dist/api/stock-estimate.d.ts +2 -0
  43. package/dist/{app-CpEqZK89.js → app-BQahEYX9.js} +6708 -7673
  44. package/dist/app.d.ts +32 -228
  45. package/dist/app.js +1 -1
  46. package/dist/{closing-template-C20qxOGw.js → closing-template-ByR8ktYf.js} +1 -1
  47. package/dist/components/StockForecastProps.d.ts +6 -0
  48. package/dist/components/inventory-binding/InventoryBinding.vue.d.ts +1 -37
  49. package/dist/components/shell/inventory/binding-dialog.vue.d.ts +0 -14
  50. package/dist/components/shell/inventory/binding-ui.vue.d.ts +1 -16
  51. package/dist/{date2-C37x5LGh.js → date2-BTP8kRm1.js} +1 -1
  52. package/dist/{dayjs.min-C5A6b5Ut.js → dayjs.min-1rxaqCQM.js} +16 -16
  53. package/dist/{defineDeepModel-btW96tVp.js → defineDeepModel-BaJIlpWC.js} +1 -1
  54. package/dist/{duplicate-template-BPduDL4a.js → duplicate-template-XaB2svr5.js} +1 -1
  55. package/dist/{feature-Cu77Fha2.js → feature-Ce7hky70.js} +1696 -1560
  56. package/dist/{format-time-from-id-ULW7QQVk.js → format-time-from-id-DwTuSEMw.js} +1 -1
  57. package/dist/{format-unit-display-CeyXEKCV.js → format-unit-display-DviFIF9R.js} +15 -16
  58. package/dist/{import-export.helper-DpgGeeZ4.js → import-export.helper-CyeFjIHv.js} +15 -16
  59. package/dist/{index-Cl2lmtBz.js → index-CC_ls9B4.js} +1412 -1471
  60. package/dist/{index-DKDWBhbI.js → index-CeTIFqwk.js} +3 -3
  61. package/dist/{index-6Is7orHh.js → index-f1rjUE_a.js} +1 -1
  62. package/dist/{lodash-BS2snJNb.js → lodash-Be4onxQF.js} +1 -1
  63. package/dist/{netsuite-B5YYhPhU.js → netsuite-CB9u725A.js} +374 -372
  64. package/dist/{purchase-order-template-DVz_OXJ7.js → purchase-order-template-DoBDYEtP.js} +1 -1
  65. package/dist/router/name.d.ts +0 -1
  66. package/dist/rules-DZnC9R5E.js +327 -0
  67. package/dist/stock-DcXdnfU0.js +75 -0
  68. package/dist/{stock-D9iwDDOz.js → stock-DjHGX36M.js} +1 -1
  69. package/dist/stores/feature.d.ts +0 -2
  70. package/dist/stores/integration/netsuite.d.ts +1 -8
  71. package/dist/stores/inventory.d.ts +30 -119
  72. package/dist/style.css +1 -1
  73. package/dist/{supplier-UJg1gtQ8.js → supplier-BtZvsnMx.js} +2 -2
  74. package/dist/{surcharge-CcJatYN4.js → surcharge-CDGjoxGm.js} +1 -1
  75. package/dist/tsconfig.app.tsbuildinfo +1 -1
  76. package/dist/{use-ingredient-select-dialog-C--_de2u.js → use-ingredient-select-dialog-l54ucmfp.js} +2 -2
  77. package/dist/{use-inventory-binding-dialog-JsmcY8OK.js → use-inventory-binding-dialog-adxsJaIL.js} +2 -2
  78. package/dist/{use-template-enabled-locations-2-Ce6Y0gQ_.js → use-template-enabled-locations-2-CgWtnf8k.js} +2 -2
  79. package/dist/views/closing-draft/components/closing-draft-dialog/ClosingDraftDialog.vue.d.ts +8 -64
  80. package/dist/views/closing-draft/composables/use-closing-draft-table.d.ts +24 -192
  81. package/dist/views/closing-template/components/closing-template-form/composables/use-closing-template-items.d.ts +1 -8
  82. package/dist/views/closing-template/composables/use-closing-template-actions.d.ts +12 -96
  83. package/dist/views/closing-template/composables/use-closing-template-table.d.ts +12 -96
  84. package/dist/views/ingredient-group/composables/use-ingredient-group-table.d.ts +18 -18
  85. package/dist/views/ingredients/components/convert/ConvertForm.vue.d.ts +0 -14
  86. package/dist/views/ingredients/components/ingredient-form/IngredientForm.vue.d.ts +4 -32
  87. package/dist/views/ingredients/components/inventory-binding/InventoryBindingForm.vue.d.ts +0 -28
  88. package/dist/views/ingredients/composables/use-ingredient-table.d.ts +1 -8
  89. package/dist/views/integration/components/netsuite/InventoryTransferIngredientTable.vue.d.ts +2 -16
  90. package/dist/views/receive-request/components/transfer-details/RejectDraftForm.vue.d.ts +19 -0
  91. package/dist/views/receive-request/components/transfer-details/TransferDetailsProps.d.ts +5 -1
  92. package/dist/views/receive-request/components/transfer-form/TransferFormWithController.vue.d.ts +6 -33
  93. package/dist/views/receive-request/components/transfer-form/components/ForecastStock.vue.d.ts +2 -16
  94. package/dist/views/receive-request/components/transfer-form/components/TransferItemTable.vue.d.ts +4 -32
  95. package/dist/views/receive-request/components/transfer-form/composables/use-transfer-items.d.ts +1 -8
  96. package/dist/views/receive-request/composables/use-process-purchase-order.d.ts +7 -41
  97. package/dist/views/receive-request/composables/use-receive-request-form.d.ts +42 -246
  98. package/dist/views/receive-request/composables/use-receive-request-table.d.ts +49 -287
  99. package/dist/views/recipe/components/recipe-form/RecipeForm.vue.d.ts +0 -16
  100. package/dist/views/stock/components/StockRecordCard.vue.d.ts +0 -1
  101. package/dist/views/stock/components/dialog/AdjustedItemForm.vue.d.ts +2 -16
  102. package/dist/views/stock/type.d.ts +2 -0
  103. package/dist/views/transfer-template/components/transfer-template-dialog/TransferTemplateDialog.vue.d.ts +2 -16
  104. package/dist/views/transfer-template/components/transfer-template-form/components/NetSuiteCustomCodeSelection.vue.d.ts +2 -16
  105. package/dist/views/transfer-template/components/transfer-template-form/components/TransferTemplateItemTable.vue.d.ts +2 -16
  106. package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-template-items.d.ts +1 -8
  107. package/dist/views/transfer-template/composables/use-netsuite-custom-field.d.ts +3 -24
  108. package/dist/views/transfer-template/composables/use-transfer-template-actions.d.ts +12 -96
  109. package/dist/views/transfer-template/composables/use-transfer-template-table.d.ts +12 -96
  110. package/dist/{vue-i18n-Cv_EPb3h.js → vue-i18n-CgWPe8oO.js} +438 -438
  111. package/dist/{xlsx-DuXSmSdO.js → xlsx-FLEhrhiP.js} +1 -1
  112. package/dist/{xlsx.util-B75iIY7V.js → xlsx.util-DoAD8sxa.js} +1 -1
  113. package/package.json +2 -2
  114. package/dist/RecipeView-CiZw14m_.js +0 -1558
  115. package/dist/SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-BMEsUpAC.js +0 -172
  116. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-CAviJscD.js +0 -3241
  117. package/dist/UnitCostHistoryView-Byd2FHbH.js +0 -651
  118. package/dist/api/unit-cost-history.d.ts +0 -28
  119. package/dist/number-DgdltWRu.js +0 -232
  120. package/dist/rules-BPG3Fjva.js +0 -98
  121. package/dist/stock-BXorYvfp.js +0 -75
  122. package/dist/views/ingredients/components/inventory-binding/v2/InventoryBindingFormV2.vue.d.ts +0 -169
  123. package/dist/views/ingredients/components/inventory-binding/v2/components/InventoryBindingAlternative.vue.d.ts +0 -43
  124. package/dist/views/ingredients/components/inventory-binding/v2/components/InventoryBindingRule.vue.d.ts +0 -25
  125. package/dist/views/ingredients/components/inventory-binding/v2/components/InventoryRecipeBindingV2Field.vue.d.ts +0 -125
  126. package/dist/views/ingredients/components/inventory-binding/v2/components/InventorySkuBindingV2Field.vue.d.ts +0 -129
  127. package/dist/views/ingredients/components/inventory-binding/v2/composables/use-inventory-binding-alternative-table.d.ts +0 -30
  128. package/dist/views/ingredients/components/inventory-binding/v2/composables/use-inventory-binding-dialog.d.ts +0 -4
  129. package/dist/views/unit-cost-history/UnitCostHistoryView.vue.d.ts +0 -2
  130. package/dist/views/unit-cost-history/components/UnitCostDetailsSideSheet.vue.d.ts +0 -19
  131. package/dist/views/unit-cost-history/components/UnitCostRecalculationDialog.vue.d.ts +0 -11
  132. package/dist/views/unit-cost-history/composables/use-unit-cost-history.d.ts +0 -65
@@ -1,29 +1,28 @@
1
- import { defineComponent as me, ref as z, computed as Y, resolveComponent as U, openBlock as D, createBlock as X, withCtx as H, createElementVNode as e, normalizeClass as ge, toDisplayString as p, createVNode as y, createElementBlock as W, Fragment as le, renderList as ce, unref as a, h as ke, watch as $e, isRef as Ee, createCommentVNode as se, reactive as ut, mergeModels as Qe, useModel as bt, onMounted as qe, createTextVNode as ve, normalizeStyle as ct, Teleport as xt, normalizeProps as Le, mergeProps as ze } from "vue";
1
+ import { defineComponent as me, ref as z, computed as Y, resolveComponent as H, openBlock as j, createBlock as X, withCtx as U, createElementVNode as e, normalizeClass as ge, toDisplayString as p, createVNode as y, createElementBlock as W, Fragment as le, renderList as ce, unref as a, h as ke, watch as $e, isRef as Ee, createCommentVNode as se, reactive as ut, mergeModels as Qe, useModel as bt, onMounted as qe, createTextVNode as pe, normalizeStyle as ct, Teleport as xt, normalizeProps as Le, mergeProps as ze } from "vue";
2
2
  import { F as Xe, u as St, _ as wt } from "./SingleColumnLayout.vue_vue_type_script_setup_true_lang-CWZkVCAj.js";
3
- import { u as xe, c as Pe, a as Re, F as Ze, w as Ft, G as ae, v as At, o as $t, D as Vt, y as Q, h as De, i as et, e as tt, J as he } from "./app-CpEqZK89.js";
4
- import { u as Oe } from "./stock-BXorYvfp.js";
3
+ import { u as xe, c as Pe, a as Re, F as Ze, H as Ft, D as ae, v as At, o as $t, B as Vt, w as Q, h as De, i as et, e as tt, I as he } from "./app-BQahEYX9.js";
4
+ import { u as Oe } from "./stock-DcXdnfU0.js";
5
5
  import { c as Ct } from "./component-DpCUABT3.js";
6
- import { f as Ve, g as Ce, a as _e, e as Dt, t as Ie, c as be, h as jt, i as nt, j as dt, k as Je, d as Me, l as Mt } from "./number-DgdltWRu.js";
7
- import { d as ye } from "./dayjs.min-C5A6b5Ut.js";
8
- import { e as Bt, u as mt, i as Te, _ as ot } from "./PremiumBadge.vue_vue_type_script_setup_true_lang-CC4jkZg4.js";
9
- import { _ as Ke, S as Ge, g as ft, a as It } from "./SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-BMEsUpAC.js";
10
- import { _ as Tt } from "./PreviewBadge.vue_vue_type_script_setup_true_lang-CRZiQHjx.js";
11
- import { useI18n as fe, useCoreStore as vt } from "@feedmepos/mf-common";
12
- import { useSnackbar as Se, useDialog as Ne, useProxiedModel as Ye, useBreakpoints as Ut } from "@feedmepos/ui-library";
13
- import { defineStore as Ht } from "pinia";
14
- import { u as we } from "./stock-D9iwDDOz.js";
15
- import { c as Ue, A as Et, M as Pt, R as Rt } from "./rules-BPG3Fjva.js";
16
- import { u as Ot } from "./use-inventory-binding-dialog-JsmcY8OK.js";
17
- import { a as pt } from "./FmMultiselectDialog-v004bPKF.js";
18
- import { _ as Nt } from "./NumberPrecisionInput.vue_vue_type_script_setup_true_lang-CVfShkXe.js";
19
- import { a as Yt, b as Lt, f as yt, t as st, c as at, p as zt, n as Gt, d as Wt } from "./date2-C37x5LGh.js";
20
- import { i as Kt, _ as qt } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DU4I0imJ.js";
6
+ import { i as Ve, g as Ce, a as _e, f as Dt, t as Ie, h as Te, A as jt, M as Mt, d as be, j as Bt, k as nt, l as dt, m as Je, R as It, e as Me, o as Tt } from "./rules-DZnC9R5E.js";
7
+ import { d as ye } from "./dayjs.min-1rxaqCQM.js";
8
+ import { e as Ht, u as mt, i as He, _ as ot } from "./PremiumBadge.vue_vue_type_script_setup_true_lang-DIk5aP_6.js";
9
+ import { _ as Ke, S as Ge, g as ft, a as Ut } from "./SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-BFCjZO6S.js";
10
+ import { _ as Et } from "./PreviewBadge.vue_vue_type_script_setup_true_lang-CRZiQHjx.js";
11
+ import { useI18n as fe, useCoreStore as pt } from "@feedmepos/mf-common";
12
+ import { useSnackbar as Se, useDialog as Ne, useProxiedModel as Ye, useBreakpoints as Pt } from "@feedmepos/ui-library";
13
+ import { defineStore as Rt } from "pinia";
14
+ import { u as we } from "./stock-DjHGX36M.js";
15
+ import { u as Ot } from "./use-inventory-binding-dialog-adxsJaIL.js";
16
+ import { a as vt } from "./FmMultiselectDialog-CcMB_4yD.js";
17
+ import { _ as Nt } from "./NumberPrecisionInput.vue_vue_type_script_setup_true_lang-BX26mYQG.js";
18
+ import { a as Yt, b as Lt, f as yt, t as st, c as at, p as zt, n as Gt, d as Wt } from "./date2-BTP8kRm1.js";
19
+ import { i as Kt, _ as qt } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-WWzwaGw-.js";
21
20
  import { E as Xt } from "./empty-placeholder-wf6-BWE8.js";
22
- import { F as pe, u as Jt } from "./feature-Cu77Fha2.js";
21
+ import { F as ve, u as Jt } from "./feature-Ce7hky70.js";
23
22
  import { _ as Qt, F as lt } from "./TableActionableRow.vue_vue_type_script_setup_true_lang-Ca_eYa8-.js";
24
- import { u as Zt } from "./netsuite-B5YYhPhU.js";
23
+ import { u as Zt } from "./netsuite-CB9u725A.js";
25
24
  import { P as en, J as tn } from "./app-DiX-EfV6.js";
26
- var Be = /* @__PURE__ */ ((k) => (k.History = "History", k.Convert = "Convert", k.Adjust = "Adjust", k))(Be || {});
25
+ var Be = /* @__PURE__ */ ((h) => (h.History = "History", h.Convert = "Convert", h.Adjust = "Adjust", h))(Be || {});
27
26
  const nn = [
28
27
  {
29
28
  translationKey: "inventory.stock.action.history",
@@ -51,16 +50,16 @@ const nn = [
51
50
  /* Adjust */
52
51
  }
53
52
  ];
54
- async function sn(k) {
53
+ async function sn(h) {
55
54
  const d = `${(xe().currentLocation.name || "").replace(
56
55
  / /g,
57
56
  "_"
58
57
  )}_${ye().format("DD_MM_YYYY_HHmm")}.xlsx`;
59
- await Bt(
58
+ await Ht(
60
59
  [
61
60
  {
62
61
  name: "stock",
63
- data: k,
62
+ data: h,
64
63
  columns: [
65
64
  {
66
65
  name: "Code",
@@ -73,16 +72,16 @@ async function sn(k) {
73
72
  {
74
73
  name: "Balance",
75
74
  selector: (s) => {
76
- const j = He(s, s.unit);
77
- return j.type === "unit" ? Ve(s.balance, s.unit, null, !1) : Ve(s.balance, s.unit, j.measurement, !1);
75
+ const M = Ue(s, s.unit);
76
+ return M.type === "unit" ? Ve(s.balance, s.unit, null, !1) : Ve(s.balance, s.unit, M.measurement, !1);
78
77
  }
79
78
  },
80
79
  {
81
80
  name: "Unit",
82
81
  selector: (s) => {
83
82
  var w;
84
- const j = He(s, s.unit);
85
- return j.type === "unit" ? s.unit.abbrev : ((w = s.unit.measurements.find((c) => c.id === j.measurement)) == null ? void 0 : w.abbrev) || "";
83
+ const M = Ue(s, s.unit);
84
+ return M.type === "unit" ? s.unit.abbrev : ((w = s.unit.measurements.find((c) => c.id === M.measurement)) == null ? void 0 : w.abbrev) || "";
86
85
  }
87
86
  }
88
87
  ]
@@ -91,8 +90,8 @@ async function sn(k) {
91
90
  d
92
91
  );
93
92
  }
94
- function He(k, m) {
95
- const d = localStorage.getItem(`uom:${k._id}`);
93
+ function Ue(h, m) {
94
+ const d = localStorage.getItem(`uom:${h._id}`);
96
95
  return d ? d === m._id ? {
97
96
  type: "unit"
98
97
  } : m.measurements.find((s) => s.id === d) ? {
@@ -100,9 +99,9 @@ function He(k, m) {
100
99
  measurement: d
101
100
  } : {
102
101
  type: "unit"
103
- } : k.trackingMeasurement && m.measurements.find((s) => s.id === k.trackingMeasurement) ? {
102
+ } : h.trackingMeasurement && m.measurements.find((s) => s.id === h.trackingMeasurement) ? {
104
103
  type: "measurement",
105
- measurement: k.trackingMeasurement
104
+ measurement: h.trackingMeasurement
106
105
  } : {
107
106
  type: "unit"
108
107
  };
@@ -115,15 +114,15 @@ const an = { class: "fm-typo-en-body-md-400 flex-grow" }, _t = /* @__PURE__ */ m
115
114
  amount: {},
116
115
  defaultTrackingMeasurement: {}
117
116
  },
118
- setup(k) {
117
+ setup(h) {
119
118
  function m(B) {
120
119
  return `uom:${B._id}`;
121
120
  }
122
121
  function d(B) {
123
122
  const b = m(s.sku);
124
- B ? localStorage.setItem(b, B) : localStorage.setItem(b, s.unit._id), j.value = He(s.sku, s.unit);
123
+ B ? localStorage.setItem(b, B) : localStorage.setItem(b, s.unit._id), M.value = Ue(s.sku, s.unit);
125
124
  }
126
- const s = k, j = z(He(s.sku, s.unit)), w = Y(() => {
125
+ const s = h, M = z(Ue(s.sku, s.unit)), w = Y(() => {
127
126
  const { measurements: B } = s.unit;
128
127
  return [
129
128
  {
@@ -137,41 +136,41 @@ const an = { class: "fm-typo-en-body-md-400 flex-grow" }, _t = /* @__PURE__ */ m
137
136
  ];
138
137
  });
139
138
  function c({ value: B }) {
140
- return a(j).type === "unit" ? B === null : B === a(j).measurement;
139
+ return a(M).type === "unit" ? B === null : B === a(M).measurement;
141
140
  }
142
141
  const l = Y(
143
142
  () => {
144
143
  var B;
145
144
  return ((B = w.value.find((b) => c(b))) == null ? void 0 : B.label) ?? "";
146
145
  }
147
- ), h = z(!1);
146
+ ), g = z(!1);
148
147
  return (B, b) => {
149
- const i = U("FmIcon"), f = U("FmMenuItem"), T = U("FmMenu");
150
- return D(), X(T, {
148
+ const r = H("FmIcon"), v = H("FmMenuItem"), T = H("FmMenu");
149
+ return j(), X(T, {
151
150
  "stop-click-propagation": "",
152
- onMenuChanged: b[0] || (b[0] = (g) => h.value = g)
151
+ onMenuChanged: b[0] || (b[0] = (k) => g.value = k)
153
152
  }, {
154
- "menu-button": H(() => [
153
+ "menu-button": U(() => [
155
154
  e("button", {
156
155
  type: "button",
157
156
  class: ge([
158
157
  "w-full text-left flex items-center gap-8 cursor-pointer fm-corner-radius-sm px-8 py-4 border bg-white",
159
- h.value ? "border-fm-color-primary" : "border-fm-color-neutral-gray-100"
158
+ g.value ? "border-fm-color-primary" : "border-fm-color-neutral-gray-100"
160
159
  ])
161
160
  }, [
162
161
  e("div", an, p(l.value), 1),
163
- y(i, {
162
+ y(r, {
164
163
  class: "text-fm-color-neutral-gray-400",
165
164
  name: "expand_more"
166
165
  })
167
166
  ], 2)
168
167
  ]),
169
- default: H(() => [
170
- (D(!0), W(le, null, ce(w.value, (g) => (D(), X(f, {
171
- key: g.value ?? 0,
172
- label: g.label,
173
- "model-value": c(g),
174
- onClick: (x) => d(g.value)
168
+ default: U(() => [
169
+ (j(!0), W(le, null, ce(w.value, (k) => (j(), X(v, {
170
+ key: k.value ?? 0,
171
+ label: k.label,
172
+ "model-value": c(k),
173
+ onClick: (x) => d(k.value)
175
174
  }, null, 8, ["label", "model-value", "onClick"]))), 128))
176
175
  ]),
177
176
  _: 1
@@ -180,37 +179,37 @@ const an = { class: "fm-typo-en-body-md-400 flex-grow" }, _t = /* @__PURE__ */ m
180
179
  }
181
180
  }), ln = { class: "whitespace-nowrap" }, rn = /* @__PURE__ */ me({
182
181
  __name: "StockHeaderPreview",
183
- setup(k) {
182
+ setup(h) {
184
183
  const { t: m } = fe();
185
- return (d, s) => (D(), X(Tt, null, {
186
- default: H(() => [
184
+ return (d, s) => (j(), X(Et, null, {
185
+ default: U(() => [
187
186
  e("div", ln, p(a(m)("inventory.stock.prediction.daysRemaining")), 1)
188
187
  ]),
189
188
  _: 1
190
189
  }));
191
190
  }
192
- }), kt = Ht("stockActions", () => {
193
- const k = z(!1), m = xe(), d = Oe(), s = mt(), j = Se(), w = Ne(), { t: c } = fe();
191
+ }), kt = Rt("stockActions", () => {
192
+ const h = z(!1), m = xe(), d = Oe(), s = mt(), M = Se(), w = Ne(), { t: c } = fe();
194
193
  async function l() {
195
194
  if (m._currentLocation) {
196
- k.value = !0;
195
+ h.value = !0;
197
196
  try {
198
197
  await d.readStockBalance(), await d.readProductBalance(), await s.readStockEstimateBalance();
199
198
  } catch {
200
- j.open({
199
+ M.open({
201
200
  title: c("inventory.stock.error.title"),
202
201
  message: c("inventory.stock.error.message"),
203
202
  type: "error"
204
203
  });
205
204
  } finally {
206
- k.value = !1;
205
+ h.value = !1;
207
206
  }
208
207
  }
209
208
  }
210
- const h = z();
209
+ const g = z();
211
210
  async function B(x) {
212
- var S, C, A;
213
- if (!!!((C = (S = x.convert) == null ? void 0 : S.inventoryBindings) != null && C.length)) {
211
+ var S, D, A;
212
+ if (!!!((D = (S = x.convert) == null ? void 0 : S.inventoryBindings) != null && D.length)) {
214
213
  w.open({
215
214
  title: c("inventory.stock.error.convert.title"),
216
215
  message: c("inventory.stock.error.convert.message")
@@ -222,16 +221,16 @@ const an = { class: "fm-typo-en-body-md-400 flex-grow" }, _t = /* @__PURE__ */ m
222
221
  sku: x,
223
222
  show: !0,
224
223
  "onUpdate:show"(I) {
225
- h.value.show = I;
224
+ g.value.show = I;
226
225
  },
227
226
  onSubmitted() {
228
227
  l();
229
228
  }
230
229
  };
231
- h.value = n;
230
+ g.value = n;
232
231
  }
233
232
  const b = z();
234
- async function i(x) {
233
+ async function r(x) {
235
234
  const o = {
236
235
  stock: x,
237
236
  show: !0,
@@ -244,18 +243,18 @@ const an = { class: "fm-typo-en-body-md-400 flex-grow" }, _t = /* @__PURE__ */ m
244
243
  };
245
244
  b.value = o;
246
245
  }
247
- const f = z();
246
+ const v = z();
248
247
  async function T(x) {
249
248
  const o = {
250
249
  sku: x,
251
250
  show: !0,
252
251
  "onUpdate:show"(t) {
253
- f.value.show = t;
252
+ v.value.show = t;
254
253
  }
255
254
  };
256
- f.value = o;
255
+ v.value = o;
257
256
  }
258
- function g(x, o) {
257
+ function k(x, o) {
259
258
  const t = Pe(o);
260
259
  switch (x) {
261
260
  case Be.History:
@@ -265,22 +264,22 @@ const an = { class: "fm-typo-en-body-md-400 flex-grow" }, _t = /* @__PURE__ */ m
265
264
  B(t);
266
265
  return;
267
266
  case Be.Adjust:
268
- i(t);
267
+ r(t);
269
268
  return;
270
269
  }
271
270
  }
272
271
  return {
273
272
  fetchStockBalance: l,
274
- onActionMenu: g,
275
- stockHistoryProps: f,
273
+ onActionMenu: k,
274
+ stockHistoryProps: v,
276
275
  showSkuHistory: T,
277
- convertSkuDialogProps: h,
276
+ convertSkuDialogProps: g,
278
277
  adjustSkuDialogProps: b
279
278
  };
280
279
  });
281
280
  function un() {
282
281
  var w;
283
- const k = xe(), m = kt(), d = vt(), { t: s } = fe();
282
+ const h = xe(), m = kt(), d = pt(), { t: s } = fe();
284
283
  return {
285
284
  columnDefs: [
286
285
  {
@@ -299,13 +298,13 @@ function un() {
299
298
  id: "UOM",
300
299
  header: () => s("inventory.stock.balance"),
301
300
  cell(c) {
302
- const l = c.row.original, h = {
301
+ const l = c.row.original, g = {
303
302
  unit: l.unit,
304
303
  sku: l,
305
304
  amount: l.balance,
306
305
  defaultTrackingMeasurement: l.trackingMeasurement ?? void 0
307
306
  };
308
- return ke(_t, h);
307
+ return ke(_t, g);
309
308
  },
310
309
  size: 180
311
310
  },
@@ -336,16 +335,17 @@ function un() {
336
335
  enableSorting: !0,
337
336
  sortUndefined: "last",
338
337
  cell(c) {
339
- var f, T;
340
- const l = c.row.original.day, h = (f = c.row.original.thresholds) == null ? void 0 : f.low, B = (T = c.row.original.thresholds) == null ? void 0 : T.mid;
341
- if (typeof l != "number" || typeof h != "number" || typeof B != "number")
338
+ var T, k;
339
+ const l = c.row.original.day, g = c.row.original.operator, B = (T = c.row.original.thresholds) == null ? void 0 : T.low, b = (k = c.row.original.thresholds) == null ? void 0 : k.mid;
340
+ if (typeof l != "number" || typeof B != "number" || typeof b != "number")
342
341
  return ke(Ke, {
343
- days: l
342
+ days: l,
343
+ operator: g
344
344
  });
345
- const b = l <= h ? Ge.low : l <= B ? Ge.mid : Ge.high;
345
+ const r = l <= B ? Ge.low : l <= b ? Ge.mid : Ge.high;
346
346
  return ke(Ke, {
347
347
  days: l,
348
- level: b
348
+ level: r
349
349
  });
350
350
  },
351
351
  size: 200
@@ -355,8 +355,8 @@ function un() {
355
355
  cell(c) {
356
356
  var l;
357
357
  return Ct(
358
- ((l = k._currentLocation) == null ? void 0 : l.type) === "restaurant" ? nn : on,
359
- (h) => m.onActionMenu(h, c.row.original)
358
+ ((l = h._currentLocation) == null ? void 0 : l.type) === "restaurant" ? nn : on,
359
+ (g) => m.onActionMenu(g, c.row.original)
360
360
  );
361
361
  },
362
362
  enableSorting: !1,
@@ -372,41 +372,41 @@ function un() {
372
372
  const cn = {
373
373
  context: null,
374
374
  error: null,
375
- isRequired(k = "This field is required") {
376
- return `${this.context ?? ""}`.length === 0 && (this.error = k), this;
375
+ isRequired(h = "This field is required") {
376
+ return `${this.context ?? ""}`.length === 0 && (this.error = h), this;
377
377
  },
378
- isString(k = "Must be a valid string") {
379
- return this.error ? this : (typeof this.context != "string" && (this.error ?? (this.error = k)), this);
378
+ isString(h = "Must be a valid string") {
379
+ return this.error ? this : (typeof this.context != "string" && (this.error ?? (this.error = h)), this);
380
380
  },
381
381
  toInt() {
382
382
  return this.error ? this : (this.context = +this.context, this);
383
383
  },
384
- isInteger(k = "Must be an integer") {
385
- return this.error ? this : (this.toInt(), isNaN(this.context) && (this.error = k), this);
384
+ isInteger(h = "Must be an integer") {
385
+ return this.error ? this : (this.toInt(), isNaN(this.context) && (this.error = h), this);
386
386
  },
387
- min(k, m) {
387
+ min(h, m) {
388
388
  if (this.error) return this;
389
389
  try {
390
- typeof this.context == "number" ? +this.context < k && (this.error = m ?? `Must be at least ${k}`) : Object.prototype.hasOwnProperty.call(this.context, "length") ? +this.context.length < k && (this.error = m ?? `Must be at least ${k}`) : this.error = "Length cannot be determined";
390
+ typeof this.context == "number" ? +this.context < h && (this.error = m ?? `Must be at least ${h}`) : Object.prototype.hasOwnProperty.call(this.context, "length") ? +this.context.length < h && (this.error = m ?? `Must be at least ${h}`) : this.error = "Length cannot be determined";
391
391
  } catch {
392
392
  this.error = "Length cannot be determined";
393
393
  }
394
394
  return this;
395
395
  },
396
- max(k, m) {
396
+ max(h, m) {
397
397
  if (this.error) return this;
398
398
  try {
399
- typeof this.context == "number" ? +this.context > k && (this.error = m ?? `Must be at most ${k}`) : "length" in this.context ? +this.context.length > k && (this.error = m ?? `Must be at most ${k}`) : this.error = "Length cannot be determined";
399
+ typeof this.context == "number" ? +this.context > h && (this.error = m ?? `Must be at most ${h}`) : "length" in this.context ? +this.context.length > h && (this.error = m ?? `Must be at most ${h}`) : this.error = "Length cannot be determined";
400
400
  } catch {
401
401
  this.error = "Length cannot be determined";
402
402
  }
403
403
  return this;
404
404
  }
405
405
  };
406
- function rt(k) {
407
- return { ...cn, context: k };
406
+ function rt(h) {
407
+ return { ...cn, context: h };
408
408
  }
409
- const dn = { class: "flex items-center" }, mn = { class: "fm-typo-en-title-md-800" }, fn = { class: "flex flex-col gap-24 w-full" }, vn = { class: "flex flex-col gap-8" }, pn = { class: "fm-typo-en-body-lg-600" }, yn = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary flex-grow" }, _n = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-error" }, kn = { class: "flex flex-col p-16 gap-8" }, hn = { class: "flex flex-col gap-4" }, gn = { class: "fm-typo-en-body-md-600 text-fm-color-typo-secondary bg-fm-color-neutral-gray-100 border-b py-12 px-16" }, bn = { class: "grid grid-cols-[auto_100px_100px_48px] xs:grid-cols-[auto_80px_120px_48px] gap-8 px-8 items-center" }, xn = { class: "xs:col-span-3" }, Sn = { class: "flex gap-8" }, wn = /* @__PURE__ */ me({
409
+ const dn = { class: "flex items-center" }, mn = { class: "fm-typo-en-title-md-800" }, fn = { class: "flex flex-col gap-24 w-full" }, pn = { class: "flex flex-col gap-8" }, vn = { class: "fm-typo-en-body-lg-600" }, yn = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary flex-grow" }, _n = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-error" }, kn = { class: "flex flex-col p-16 gap-8" }, hn = { class: "flex flex-col gap-4" }, gn = { class: "fm-typo-en-body-md-600 text-fm-color-typo-secondary bg-fm-color-neutral-gray-100 border-b py-12 px-16" }, bn = { class: "grid grid-cols-[auto_100px_100px_48px] xs:grid-cols-[auto_80px_120px_48px] gap-8 px-8 items-center" }, xn = { class: "xs:col-span-3" }, Sn = { class: "flex gap-8" }, wn = /* @__PURE__ */ me({
410
410
  __name: "ConvertSkuDialog",
411
411
  props: {
412
412
  sku: {},
@@ -414,51 +414,51 @@ const dn = { class: "flex items-center" }, mn = { class: "fm-typo-en-title-md-80
414
414
  show: { type: Boolean }
415
415
  },
416
416
  emits: ["update:show", "submitted"],
417
- setup(k, { expose: m, emit: d }) {
418
- const s = k, j = d, w = Ot(), c = Re(), l = we(), h = Se(), { t: B } = fe(), b = z(0), i = z(null), f = Y(() => c.skus), T = Y(
417
+ setup(h, { expose: m, emit: d }) {
418
+ const s = h, M = d, w = Ot(), c = Re(), l = we(), g = Se(), { t: B } = fe(), b = z(0), r = z(null), v = Y(() => c.skus), T = Y(
419
419
  () => {
420
- var v, $;
421
- return ((($ = (v = s.sku) == null ? void 0 : v.convert) == null ? void 0 : $.inventoryBindings) ?? []).filter(
420
+ var f, $;
421
+ return ((($ = (f = s.sku) == null ? void 0 : f.convert) == null ? void 0 : $.inventoryBindings) ?? []).filter(
422
422
  (G) => G.type === Ze.enum.SKU
423
423
  );
424
424
  }
425
- ), g = Y({
425
+ ), k = Y({
426
426
  get() {
427
- return !!i.value;
427
+ return !!r.value;
428
428
  },
429
- set(v) {
430
- v ? i.value = Pe(T.value) : (i.value = null, b.value = Math.min(b.value, s.maxCount ?? 0));
429
+ set(f) {
430
+ f ? r.value = Pe(T.value) : (r.value = null, b.value = Math.min(b.value, s.maxCount ?? 0));
431
431
  }
432
432
  }), x = z(!1);
433
- $e([() => s.show], ([v]) => {
434
- v && (b.value = 0);
433
+ $e([() => s.show], ([f]) => {
434
+ f && (b.value = 0);
435
435
  });
436
436
  function o() {
437
- R(s.sku, Ie(b.value), i.value);
437
+ R(s.sku, Ie(b.value), r.value);
438
438
  }
439
- function t(v) {
440
- if (i.value)
439
+ function t(f) {
440
+ if (r.value)
441
441
  return !0;
442
- const $ = rt(v).isInteger().max(s.maxCount ?? 0).error ?? "";
442
+ const $ = rt(f).isInteger().max(s.maxCount ?? 0).error ?? "";
443
443
  return $ || !0;
444
444
  }
445
- function n(v) {
445
+ function n(f) {
446
446
  var E;
447
447
  const $ = (E = s.sku.convert) != null && E.measurement ? s.sku.unit.measurements.find((_) => {
448
- var r;
449
- return _.id === ((r = s.sku.convert) == null ? void 0 : r.measurement);
450
- }) ?? null : null, G = Ce(s.sku.unit, $), P = jt(+v);
448
+ var i;
449
+ return _.id === ((i = s.sku.convert) == null ? void 0 : i.measurement);
450
+ }) ?? null : null, G = Ce(s.sku.unit, $), P = Bt(+f);
451
451
  return rt(P).isInteger().max(G).error ? "Precision cannot be more than " + G : !0;
452
452
  }
453
453
  const S = Y(
454
454
  () => {
455
- var v, $;
456
- return (v = s.sku.convert) != null && v.measurement ? ($ = s.sku.unit.measurements.find((G) => {
455
+ var f, $;
456
+ return (f = s.sku.convert) != null && f.measurement ? ($ = s.sku.unit.measurements.find((G) => {
457
457
  var P;
458
458
  return G.id === ((P = s.sku.convert) == null ? void 0 : P.measurement);
459
459
  })) == null ? void 0 : $.abbrev : s.sku.unit.abbrev;
460
460
  }
461
- ), C = Y(() => {
461
+ ), D = Y(() => {
462
462
  var P, L;
463
463
  const $ = Ft({
464
464
  bindings: ((P = s.sku.convert) == null ? void 0 : P.inventoryBindings) ?? [],
@@ -466,47 +466,47 @@ const dn = { class: "flex items-center" }, mn = { class: "fm-typo-en-title-md-80
466
466
  skuGroups: c.skuGroups,
467
467
  recipes: c.recipes
468
468
  }).inventoryBindings.filter((E) => "success" in E && E.success).map((E) => E).map((E) => E.binding);
469
- return (L = i.value ?? $) == null ? void 0 : L.map((E) => {
469
+ return (L = r.value ?? $) == null ? void 0 : L.map((E) => {
470
470
  var ne, re, J, te, oe;
471
- const _ = c.skus.find((ie) => ie._id === E.id), r = ((ne = E.measurement) == null ? void 0 : ne.abbrev) ?? ((re = _ == null ? void 0 : _.unit) == null ? void 0 : re.abbrev), M = (J = s.sku.convert) != null && J.measurement ? s.sku.unit.measurements.find((ie) => {
471
+ const _ = c.skus.find((ie) => ie._id === E.id), i = ((ne = E.measurement) == null ? void 0 : ne.abbrev) ?? ((re = _ == null ? void 0 : _.unit) == null ? void 0 : re.abbrev), V = (J = s.sku.convert) != null && J.measurement ? s.sku.unit.measurements.find((ie) => {
472
472
  var Fe;
473
473
  return ie.id === ((Fe = s.sku.convert) == null ? void 0 : Fe.measurement);
474
- }) ?? null : null, V = Ce(s.sku.unit, M), u = n(`${b.value}`) === !0 ? _e(
474
+ }) ?? null : null, C = Ce(s.sku.unit, V), u = n(`${b.value}`) === !0 ? _e(
475
475
  Dt(
476
476
  E.amount,
477
- Ie(+b.value, V)
477
+ Ie(+b.value, C)
478
478
  ),
479
479
  !1
480
- ) : "0", F = (oe = (te = i.value) == null ? void 0 : te.find((ie) => ie.id === (_ == null ? void 0 : _._id))) == null ? void 0 : oe.amount, N = F ? _e(F, !1) : null;
480
+ ) : "0", F = (oe = (te = r.value) == null ? void 0 : te.find((ie) => ie.id === (_ == null ? void 0 : _._id))) == null ? void 0 : oe.amount, N = F ? _e(F, !1) : null;
481
481
  return {
482
482
  sku: _,
483
483
  convertAmount: N ?? u,
484
- abbrev: r
484
+ abbrev: i
485
485
  };
486
486
  });
487
487
  }), A = z();
488
488
  m({
489
489
  validateInputs: () => {
490
- var v, $;
491
- ($ = (v = A.value) == null ? void 0 : v.validateInputs) == null || $.call(v);
490
+ var f, $;
491
+ ($ = (f = A.value) == null ? void 0 : f.validateInputs) == null || $.call(f);
492
492
  },
493
493
  resetInputsValidation: () => {
494
- var v, $;
495
- ($ = (v = A.value) == null ? void 0 : v.resetInputsValidation) == null || $.call(v);
494
+ var f, $;
495
+ ($ = (f = A.value) == null ? void 0 : f.resetInputsValidation) == null || $.call(f);
496
496
  },
497
497
  resetInputs: () => {
498
- var v, $;
499
- ($ = (v = A.value) == null ? void 0 : v.resetInputs) == null || $.call(v);
498
+ var f, $;
499
+ ($ = (f = A.value) == null ? void 0 : f.resetInputs) == null || $.call(f);
500
500
  }
501
501
  });
502
502
  const I = Ye(s, "show");
503
- async function R(v, $, G) {
503
+ async function R(f, $, G) {
504
504
  x.value = !0;
505
505
  try {
506
506
  await l.convertSku({
507
507
  conversions: [
508
508
  {
509
- doc: v,
509
+ doc: f,
510
510
  amount: $,
511
511
  overrides: G == null ? void 0 : G.map((P) => ({
512
512
  ...P,
@@ -518,95 +518,95 @@ const dn = { class: "flex items-center" }, mn = { class: "fm-typo-en-title-md-80
518
518
  }))
519
519
  }
520
520
  ]
521
- }), j("update:show", !1), j("submitted");
521
+ }), M("update:show", !1), M("submitted");
522
522
  } catch (P) {
523
- h.open({
523
+ g.open({
524
524
  title: "Something went wrong",
525
- message: `Cannot convert ${v.name}. Please try again.`,
525
+ message: `Cannot convert ${f.name}. Please try again.`,
526
526
  type: "error"
527
- }), console.error("error at converting stock amount", v, $, P);
527
+ }), console.error("error at converting stock amount", f, $, P);
528
528
  } finally {
529
529
  x.value = !1;
530
530
  }
531
531
  }
532
- function K(v, $, G) {
532
+ function K(f, $, G) {
533
533
  const P = +$;
534
534
  let L = G;
535
- $.length > 0 && isFinite(P) ? L = G.map((E) => (E.id !== v || (E.amount = be(P)), E)) : L = G.map((E) => (E.id !== v || (E.amount = { amount: 0, precision: 0 }), E)), i.value = L;
535
+ $.length > 0 && isFinite(P) ? L = G.map((E) => (E.id !== f || (E.amount = be(P)), E)) : L = G.map((E) => (E.id !== f || (E.amount = { amount: 0, precision: 0 }), E)), r.value = L;
536
536
  }
537
- function O(v) {
538
- const $ = f.value.find((G) => G._id === v);
537
+ function O(f) {
538
+ const $ = v.value.find((G) => G._id === f);
539
539
  return $ ? ft($.unit, !0) : [];
540
540
  }
541
- function Z(v, $) {
542
- const G = O(v), P = G.find((L) => L.value === $) ?? G.find((L) => L.value === null);
541
+ function Z(f, $) {
542
+ const G = O(f), P = G.find((L) => L.value === $) ?? G.find((L) => L.value === null);
543
543
  return P ? {
544
544
  ...P,
545
545
  label: P.abbrev
546
546
  } : null;
547
547
  }
548
- function q(v, $, G) {
548
+ function q(f, $, G) {
549
549
  let P;
550
550
  if ($ === null)
551
- P = G.map((L) => (L.id !== v || (L.measurement = null), L)) ?? [];
551
+ P = G.map((L) => (L.id !== f || (L.measurement = null), L)) ?? [];
552
552
  else {
553
- const L = f.value.find((E) => E._id === v);
553
+ const L = v.value.find((E) => E._id === f);
554
554
  P = G.map((E) => {
555
- var _, r;
556
- return E.id !== v || (E.measurement = (r = (_ = L == null ? void 0 : L.unit) == null ? void 0 : _.measurements) == null ? void 0 : r.find((M) => M.id === $)), E;
555
+ var _, i;
556
+ return E.id !== f || (E.measurement = (i = (_ = L == null ? void 0 : L.unit) == null ? void 0 : _.measurements) == null ? void 0 : i.find((V) => V.id === $)), E;
557
557
  }) ?? [];
558
558
  }
559
- i.value = P;
559
+ r.value = P;
560
560
  }
561
- function ue(v, $) {
562
- const G = $.filter((P) => P.id !== v);
563
- i.value = G;
561
+ function ue(f, $) {
562
+ const G = $.filter((P) => P.id !== f);
563
+ r.value = G;
564
564
  }
565
565
  function ee() {
566
- const v = (i.value ?? []).map(($) => ({
566
+ const f = (r.value ?? []).map(($) => ({
567
567
  ...$,
568
568
  type: Ze.enum.SKU
569
569
  }));
570
570
  w.promptIngredientsBinding(
571
- v,
572
- ($) => i.value = $,
571
+ f,
572
+ ($) => r.value = $,
573
573
  s.sku._id
574
574
  );
575
575
  }
576
576
  return $e(
577
577
  () => s.show,
578
- (v) => {
579
- v || (i.value = null, b.value = 0);
578
+ (f) => {
579
+ f || (r.value = null, b.value = 0);
580
580
  }
581
- ), (v, $) => {
582
- const G = U("FmTextField"), P = U("FmForm"), L = U("FmCard"), E = U("FmSwitch"), _ = U("FmFormGroup"), r = U("FmSelect"), M = U("FmButton"), V = U("FmSideSheet");
583
- return D(), X(V, {
581
+ ), (f, $) => {
582
+ const G = H("FmTextField"), P = H("FmForm"), L = H("FmCard"), E = H("FmSwitch"), _ = H("FmFormGroup"), i = H("FmSelect"), V = H("FmButton"), C = H("FmSideSheet");
583
+ return j(), X(C, {
584
584
  "dismiss-away": "",
585
585
  modelValue: a(I),
586
586
  "onUpdate:modelValue": $[3] || ($[3] = (u) => Ee(I) ? I.value = u : null),
587
587
  "max-width": 500
588
588
  }, {
589
- "side-sheet-header": H(() => [
589
+ "side-sheet-header": U(() => [
590
590
  e("div", dn, [
591
- e("div", mn, p(a(B)("inventory.stock.convert.title", { name: v.sku.name })), 1)
591
+ e("div", mn, p(a(B)("inventory.stock.convert.title", { name: f.sku.name })), 1)
592
592
  ])
593
593
  ]),
594
- default: H(() => [
594
+ default: U(() => [
595
595
  e("div", fn, [
596
596
  y(P, {
597
597
  ref_key: "formRef",
598
598
  ref: A,
599
599
  onValidationSuccess: o
600
600
  }, {
601
- default: H(() => [
601
+ default: U(() => [
602
602
  y(G, {
603
603
  disabled: x.value,
604
604
  "model-value": b.value,
605
605
  "onUpdate:modelValue": $[0] || ($[0] = (u) => b.value = u),
606
606
  label: a(B)("inventory.stock.convert.amount"),
607
- rules: [t, n, a(Ue)(0)],
607
+ rules: [t, n, a(Te)(0)],
608
608
  "append-text": S.value,
609
- "helper-text": i.value ? void 0 : `Max ${v.maxCount} ${S.value}`
609
+ "helper-text": r.value ? void 0 : `Max ${f.maxCount} ${S.value}`
610
610
  }, null, 8, ["disabled", "model-value", "label", "rules", "append-text", "helper-text"])
611
611
  ]),
612
612
  _: 1
@@ -615,12 +615,12 @@ const dn = { class: "flex items-center" }, mn = { class: "fm-typo-en-title-md-80
615
615
  variant: "outlined",
616
616
  class: "p-16"
617
617
  }, {
618
- default: H(() => [
619
- e("div", vn, [
620
- e("div", pn, p(a(B)("inventory.stock.convert.deductionSummary")), 1),
621
- (D(!0), W(le, null, ce(C.value, (u) => {
618
+ default: U(() => [
619
+ e("div", pn, [
620
+ e("div", vn, p(a(B)("inventory.stock.convert.deductionSummary")), 1),
621
+ (j(!0), W(le, null, ce(D.value, (u) => {
622
622
  var F, N;
623
- return D(), W("div", {
623
+ return j(), W("div", {
624
624
  key: (F = u.sku) == null ? void 0 : F._id,
625
625
  class: "flex items-center"
626
626
  }, [
@@ -633,65 +633,65 @@ const dn = { class: "flex items-center" }, mn = { class: "fm-typo-en-title-md-80
633
633
  _: 1
634
634
  }),
635
635
  y(L, { variant: "outlined" }, {
636
- default: H(() => [
636
+ default: U(() => [
637
637
  e("div", kn, [
638
638
  y(E, {
639
639
  value: "",
640
- modelValue: g.value,
641
- "onUpdate:modelValue": $[1] || ($[1] = (u) => g.value = u),
640
+ modelValue: k.value,
641
+ "onUpdate:modelValue": $[1] || ($[1] = (u) => k.value = u),
642
642
  label: a(B)("inventory.stock.convert.overrideDeduction"),
643
643
  "label-placement": "right"
644
644
  }, null, 8, ["modelValue", "label"]),
645
- g.value ? (D(), W(le, { key: 0 }, [
645
+ k.value ? (j(), W(le, { key: 0 }, [
646
646
  y(_, {
647
- modelValue: i.value,
648
- rules: [a(Et)(1, "Must have at least one ingredient binding")]
647
+ modelValue: r.value,
648
+ rules: [a(jt)(1, "Must have at least one ingredient binding")]
649
649
  }, null, 8, ["modelValue", "rules"]),
650
650
  e("div", hn, [
651
651
  e("div", gn, p(a(B)("inventory.stock.convert.ingredients")), 1),
652
- (D(!0), W(le, null, ce(i.value, (u) => (D(), X(_, {
652
+ (j(!0), W(le, null, ce(r.value, (u) => (j(), X(_, {
653
653
  key: u.id,
654
654
  disabled: x.value,
655
655
  modelValue: +a(_e)(u.amount ?? { amount: 1, precision: 0 }),
656
656
  rules: [
657
- a(Pt)(
658
- f.value.find((F) => F._id === u.id).unit,
657
+ a(Mt)(
658
+ v.value.find((F) => F._id === u.id).unit,
659
659
  u.measurement
660
660
  ),
661
- a(Ue)(0)
661
+ a(Te)(0)
662
662
  ]
663
663
  }, {
664
- default: H(({ invalid: F }) => {
664
+ default: U(({ invalid: F }) => {
665
665
  var N, ne, re;
666
666
  return [
667
667
  e("div", bn, [
668
- e("div", xn, p((N = f.value.find((J) => J._id === u.id)) == null ? void 0 : N.name), 1),
668
+ e("div", xn, p((N = v.value.find((J) => J._id === u.id)) == null ? void 0 : N.name), 1),
669
669
  y(G, {
670
670
  class: "xs:col-span-2",
671
671
  disabled: x.value,
672
672
  modelValue: +a(_e)(
673
673
  u.amount ?? { amount: 1, precision: 0 }
674
674
  ),
675
- "onUpdate:modelValue": (J) => K(u.id, J, i.value ?? []),
675
+ "onUpdate:modelValue": (J) => K(u.id, J, r.value ?? []),
676
676
  invalid: F
677
677
  }, null, 8, ["disabled", "modelValue", "onUpdate:modelValue", "invalid"]),
678
- y(r, {
678
+ y(i, {
679
679
  disabled: x.value,
680
680
  class: "translate-y-[2px]",
681
681
  items: O(u.id),
682
682
  "model-value": (re = Z(u.id, (ne = u.measurement) == null ? void 0 : ne.id)) == null ? void 0 : re.value,
683
- "onUpdate:modelValue": (J) => q(u.id, J, i.value ?? []),
683
+ "onUpdate:modelValue": (J) => q(u.id, J, r.value ?? []),
684
684
  invalid: F
685
685
  }, {
686
- "helper-text": H(() => $[4] || ($[4] = [])),
686
+ "helper-text": U(() => $[4] || ($[4] = [])),
687
687
  _: 2
688
688
  }, 1032, ["disabled", "items", "model-value", "onUpdate:modelValue", "invalid"]),
689
- y(M, {
689
+ y(V, {
690
690
  disabled: x.value,
691
691
  type: "button",
692
692
  variant: "tertiary",
693
693
  icon: "delete",
694
- onClick: (J) => ue(u.id, i.value ?? [])
694
+ onClick: (J) => ue(u.id, r.value ?? [])
695
695
  }, null, 8, ["disabled", "onClick"])
696
696
  ])
697
697
  ];
@@ -700,7 +700,7 @@ const dn = { class: "flex items-center" }, mn = { class: "fm-typo-en-title-md-80
700
700
  }, 1032, ["disabled", "modelValue", "rules"]))), 128))
701
701
  ]),
702
702
  e("div", null, [
703
- y(M, {
703
+ y(V, {
704
704
  icon: "link",
705
705
  label: a(B)("inventory.stock.convert.linkIngredient"),
706
706
  variant: "plain",
@@ -714,9 +714,9 @@ const dn = { class: "flex items-center" }, mn = { class: "fm-typo-en-title-md-80
714
714
  })
715
715
  ])
716
716
  ]),
717
- "side-sheet-footer": H(() => [
717
+ "side-sheet-footer": U(() => [
718
718
  e("div", Sn, [
719
- y(M, {
719
+ y(V, {
720
720
  loading: x.value,
721
721
  label: a(B)("inventory.stock.convert.convertButton"),
722
722
  onClick: $[2] || ($[2] = (u) => {
@@ -731,12 +731,12 @@ const dn = { class: "flex items-center" }, mn = { class: "fm-typo-en-title-md-80
731
731
  };
732
732
  }
733
733
  });
734
- function je(k, m) {
735
- const d = Ie(k, m);
734
+ function je(h, m) {
735
+ const d = Ie(h, m);
736
736
  return { ...d, amount: -d.amount };
737
737
  }
738
- function it(k, m) {
739
- return Ie(Math.abs(k), m);
738
+ function it(h, m) {
739
+ return Ie(Math.abs(h), m);
740
740
  }
741
741
  const We = {
742
742
  [ae.enum.DAMAGE]: {
@@ -770,13 +770,13 @@ const We = {
770
770
  disabled: { type: Boolean }
771
771
  },
772
772
  emits: ["update:modelValue", "click:delete"],
773
- setup(k, { emit: m }) {
774
- const d = k, s = m, { t: j } = fe(), w = Oe(), c = Y(
773
+ setup(h, { emit: m }) {
774
+ const d = h, s = m, { t: M } = fe(), w = Oe(), c = Y(
775
775
  () => Object.keys(We).map((t) => ({
776
776
  label: At(t),
777
777
  value: t
778
778
  }))
779
- ), l = Y(() => ft(d.modelValue.doc.unit, !0)), h = Y({
779
+ ), l = Y(() => ft(d.modelValue.doc.unit, !0)), g = Y({
780
780
  get() {
781
781
  return d.modelValue.type ?? ae.enum.PURCHASE;
782
782
  },
@@ -800,7 +800,7 @@ const We = {
800
800
  const n = {
801
801
  ...d.modelValue
802
802
  }, S = be(t);
803
- n.amount = We[h.value].toAdjustmentAmount(
803
+ n.amount = We[g.value].toAdjustmentAmount(
804
804
  t,
805
805
  S.precision
806
806
  ), s("update:modelValue", n);
@@ -811,13 +811,13 @@ const We = {
811
811
  return ((t = d.modelValue.measurement) == null ? void 0 : t.id) ?? null;
812
812
  },
813
813
  set(t) {
814
- var S, C;
814
+ var S, D;
815
815
  const n = {
816
816
  ...d.modelValue
817
817
  };
818
- n.measurement = ((C = (S = d.modelValue.doc.unit) == null ? void 0 : S.measurements) == null ? void 0 : C.find((A) => A.id === t)) ?? null, s("update:modelValue", n);
818
+ n.measurement = ((D = (S = d.modelValue.doc.unit) == null ? void 0 : S.measurements) == null ? void 0 : D.find((A) => A.id === t)) ?? null, s("update:modelValue", n);
819
819
  }
820
- }), i = Y({
820
+ }), r = Y({
821
821
  get() {
822
822
  return d.modelValue.remark ?? "";
823
823
  },
@@ -827,25 +827,25 @@ const We = {
827
827
  };
828
828
  n.remark = t, s("update:modelValue", n);
829
829
  }
830
- }), f = Y(() => {
830
+ }), v = Y(() => {
831
831
  var n;
832
832
  const t = (n = w.stockBalance.skus) == null ? void 0 : n.find((S) => S.id === d.modelValue.doc._id);
833
833
  return (t == null ? void 0 : t.balance) ?? { amount: 0, precision: 0 };
834
834
  }), T = Y(() => {
835
835
  const t = d.modelValue.amount, n = d.modelValue.measurement;
836
836
  return n ? dt(t, n.conversion) : t;
837
- }), g = Y(
838
- () => Je(f.value, T.value)
837
+ }), k = Y(
838
+ () => Je(v.value, T.value)
839
839
  ), x = Y(
840
- () => Ve(g.value, d.modelValue.doc.unit)
840
+ () => Ve(k.value, d.modelValue.doc.unit)
841
841
  ), o = Y(() => T.value.amount < 0);
842
842
  return (t, n) => {
843
- const S = U("FmButton"), C = U("FmSelect"), A = U("FmTextarea"), I = U("FmCard");
844
- return D(), X(I, {
843
+ const S = H("FmButton"), D = H("FmSelect"), A = H("FmTextarea"), I = H("FmCard");
844
+ return j(), X(I, {
845
845
  variant: "outlined",
846
846
  class: "grid grid-cols-2 gap-8 p-16"
847
847
  }, {
848
- default: H(() => [
848
+ default: U(() => [
849
849
  e("div", Fn, [
850
850
  e("div", An, [
851
851
  e("div", $n, p(t.modelValue.doc.name), 1),
@@ -857,14 +857,14 @@ const We = {
857
857
  onClick: n[0] || (n[0] = (R) => s("click:delete"))
858
858
  })
859
859
  ]),
860
- y(C, {
860
+ y(D, {
861
861
  disabled: t.disabled,
862
862
  class: "col-span-2",
863
863
  label: "Type",
864
864
  items: c.value,
865
- modelValue: h.value,
866
- "onUpdate:modelValue": n[1] || (n[1] = (R) => h.value = R),
867
- rules: [a(Rt)()],
865
+ modelValue: g.value,
866
+ "onUpdate:modelValue": n[1] || (n[1] = (R) => g.value = R),
867
+ rules: [a(It)()],
868
868
  "label-mark": "required"
869
869
  }, null, 8, ["disabled", "items", "modelValue", "rules"]),
870
870
  y(Nt, {
@@ -876,9 +876,9 @@ const We = {
876
876
  }),
877
877
  modelValue: B.value,
878
878
  "onUpdate:modelValue": n[2] || (n[2] = (R) => B.value = R),
879
- rules: [a(Ue)(0)]
879
+ rules: [a(Te)(0)]
880
880
  }, null, 8, ["disabled", "step", "modelValue", "rules"]),
881
- y(C, {
881
+ y(D, {
882
882
  disabled: t.disabled,
883
883
  label: "Unit",
884
884
  items: l.value,
@@ -889,12 +889,12 @@ const We = {
889
889
  class: "col-span-2",
890
890
  disabled: t.disabled,
891
891
  label: "Remark",
892
- modelValue: i.value,
893
- "onUpdate:modelValue": n[4] || (n[4] = (R) => i.value = R),
892
+ modelValue: r.value,
893
+ "onUpdate:modelValue": n[4] || (n[4] = (R) => r.value = R),
894
894
  "label-mark": "optional"
895
895
  }, null, 8, ["disabled", "modelValue"]),
896
896
  e("div", Cn, [
897
- e("div", Dn, p(a(j)("inventory.stock.stock_adjustment.stockAfter")), 1),
897
+ e("div", Dn, p(a(M)("inventory.stock.stock_adjustment.stockAfter")), 1),
898
898
  e("div", {
899
899
  class: ge(["fm-typo-en-body-lg-600", o.value ? "text-red-700" : "text-green-700"])
900
900
  }, p(x.value), 3)
@@ -904,34 +904,34 @@ const We = {
904
904
  });
905
905
  };
906
906
  }
907
- }), jn = { class: "flex items-center" }, Mn = { class: "fm-typo-en-title-md-800" }, Bn = { class: "flex items-center" }, In = { class: "fm-typo-en-title-sm-800 flex-1" }, Tn = { class: "flex gap-8" }, Un = /* @__PURE__ */ me({
907
+ }), jn = { class: "flex items-center" }, Mn = { class: "fm-typo-en-title-md-800" }, Bn = { class: "flex items-center" }, In = { class: "fm-typo-en-title-sm-800 flex-1" }, Tn = { class: "flex gap-8" }, Hn = /* @__PURE__ */ me({
908
908
  __name: "AdjustSkuDialog",
909
909
  props: {
910
910
  stock: {},
911
911
  show: { type: Boolean }
912
912
  },
913
913
  emits: ["update:show", "submitted"],
914
- setup(k, { expose: m, emit: d }) {
915
- const s = k, j = d, w = Re(), c = Ne(), l = we(), h = Se(), B = z(!1), { t: b } = fe();
916
- function i() {
917
- x(Pe(g));
914
+ setup(h, { expose: m, emit: d }) {
915
+ const s = h, M = d, w = Re(), c = Ne(), l = we(), g = Se(), B = z(!1), { t: b } = fe();
916
+ function r() {
917
+ x(Pe(k));
918
918
  }
919
- const f = z();
919
+ const v = z();
920
920
  m({
921
921
  validateInputs: () => {
922
922
  var n, S;
923
- (S = (n = f.value) == null ? void 0 : n.validateInputs) == null || S.call(n);
923
+ (S = (n = v.value) == null ? void 0 : n.validateInputs) == null || S.call(n);
924
924
  },
925
925
  resetInputsValidation: () => {
926
926
  var n, S;
927
- (S = (n = f.value) == null ? void 0 : n.resetInputsValidation) == null || S.call(n);
927
+ (S = (n = v.value) == null ? void 0 : n.resetInputsValidation) == null || S.call(n);
928
928
  },
929
929
  resetInputs: () => {
930
930
  var n, S;
931
- (S = (n = f.value) == null ? void 0 : n.resetInputs) == null || S.call(n);
931
+ (S = (n = v.value) == null ? void 0 : n.resetInputs) == null || S.call(n);
932
932
  }
933
933
  });
934
- const T = Ye(s, "show"), g = ut({
934
+ const T = Ye(s, "show"), k = ut({
935
935
  remark: "",
936
936
  adjustments: [
937
937
  {
@@ -945,7 +945,7 @@ const We = {
945
945
  ]
946
946
  });
947
947
  $e([() => s.show], ([n]) => {
948
- n && (g.remark = "", g.adjustments = [
948
+ n && (k.remark = "", k.adjustments = [
949
949
  {
950
950
  id: `sku_${(/* @__PURE__ */ new Date()).toISOString()}_${Math.random().toString(16).slice(2, 8)}`,
951
951
  type: ae.enum.PURCHASE,
@@ -961,17 +961,17 @@ const We = {
961
961
  try {
962
962
  await l.adjustSku({
963
963
  remark: n.remark,
964
- adjustments: n.adjustments.map(({ doc: S, remark: C, type: A, amount: I, measurement: R }) => ({
964
+ adjustments: n.adjustments.map(({ doc: S, remark: D, type: A, amount: I, measurement: R }) => ({
965
965
  id: S._id,
966
966
  amount: I,
967
967
  measurement: R,
968
- remark: C,
968
+ remark: D,
969
969
  doc: S,
970
970
  type: A
971
971
  }))
972
- }), j("update:show", !1), j("submitted");
972
+ }), M("update:show", !1), M("submitted");
973
973
  } catch (S) {
974
- h.open({
974
+ g.open({
975
975
  title: b("inventory.stock.adjust.error.title"),
976
976
  message: b("inventory.stock.adjust.error.message"),
977
977
  type: "error"
@@ -981,14 +981,14 @@ const We = {
981
981
  }
982
982
  }
983
983
  function o() {
984
- const n = w.skus.map((C) => ({
985
- label: C.name,
986
- sublabel: C.code,
987
- value: C._id
988
- })), S = n.filter((C) => g.adjustments.find((A) => A.doc._id === C.value)).map((C) => C.value);
984
+ const n = w.skus.map((D) => ({
985
+ label: D.name,
986
+ sublabel: D.code,
987
+ value: D._id
988
+ })), S = n.filter((D) => k.adjustments.find((A) => A.doc._id === D.value)).map((D) => D.value);
989
989
  c.open({
990
990
  title: "Select ingredients",
991
- contentComponent: pt,
991
+ contentComponent: vt,
992
992
  contentComponentProps: {
993
993
  items: n,
994
994
  modelValue: S
@@ -1005,9 +1005,9 @@ const We = {
1005
1005
  close: !0,
1006
1006
  variant: "tertiary"
1007
1007
  }
1008
- }).onPrimary((C) => {
1009
- g.adjustments = C.map(
1010
- (A) => g.adjustments.find((I) => I.doc._id === A) ?? {
1008
+ }).onPrimary((D) => {
1009
+ k.adjustments = D.map(
1010
+ (A) => k.adjustments.find((I) => I.doc._id === A) ?? {
1011
1011
  id: `sku_${(/* @__PURE__ */ new Date()).toISOString()}_${Math.random().toString(16).slice(2, 8)}`,
1012
1012
  type: ae.enum.PURCHASE,
1013
1013
  doc: w.skus.find((I) => I._id === A),
@@ -1019,33 +1019,33 @@ const We = {
1019
1019
  });
1020
1020
  }
1021
1021
  function t(n) {
1022
- g.adjustments.splice(n, 1);
1022
+ k.adjustments.splice(n, 1);
1023
1023
  }
1024
1024
  return (n, S) => {
1025
- const C = U("FmTextarea"), A = U("FmButton"), I = U("FmForm"), R = U("FmSideSheet");
1026
- return D(), X(R, {
1025
+ const D = H("FmTextarea"), A = H("FmButton"), I = H("FmForm"), R = H("FmSideSheet");
1026
+ return j(), X(R, {
1027
1027
  modelValue: a(T),
1028
1028
  "onUpdate:modelValue": S[2] || (S[2] = (K) => Ee(T) ? T.value = K : null),
1029
1029
  "dismiss-away": "",
1030
1030
  "max-width": 500
1031
1031
  }, {
1032
- "side-sheet-header": H(() => [
1032
+ "side-sheet-header": U(() => [
1033
1033
  e("div", jn, [
1034
1034
  e("div", Mn, p(a(b)("inventory.stock.adjust.title")), 1)
1035
1035
  ])
1036
1036
  ]),
1037
- default: H(() => [
1037
+ default: U(() => [
1038
1038
  y(I, {
1039
1039
  class: "w-full flex flex-col gap-12",
1040
1040
  ref_key: "formRef",
1041
- ref: f,
1042
- onValidationSuccess: i
1041
+ ref: v,
1042
+ onValidationSuccess: r
1043
1043
  }, {
1044
- default: H(() => [
1045
- y(C, {
1044
+ default: U(() => [
1045
+ y(D, {
1046
1046
  label: a(b)("inventory.stock.adjust.remark"),
1047
- modelValue: g.remark,
1048
- "onUpdate:modelValue": S[0] || (S[0] = (K) => g.remark = K)
1047
+ modelValue: k.remark,
1048
+ "onUpdate:modelValue": S[0] || (S[0] = (K) => k.remark = K)
1049
1049
  }, null, 8, ["label", "modelValue"]),
1050
1050
  e("div", Bn, [
1051
1051
  e("div", In, p(a(b)("inventory.stock.adjust.adjustedItems")), 1),
@@ -1056,24 +1056,24 @@ const We = {
1056
1056
  onClick: o
1057
1057
  })
1058
1058
  ]),
1059
- (D(!0), W(le, null, ce(g.adjustments, (K, O) => (D(), X(ht, {
1059
+ (j(!0), W(le, null, ce(k.adjustments, (K, O) => (j(), X(ht, {
1060
1060
  key: K.id,
1061
- modelValue: g.adjustments[O],
1062
- "onUpdate:modelValue": (Z) => g.adjustments[O] = Z,
1061
+ modelValue: k.adjustments[O],
1062
+ "onUpdate:modelValue": (Z) => k.adjustments[O] = Z,
1063
1063
  "onClick:delete": (Z) => t(O)
1064
1064
  }, null, 8, ["modelValue", "onUpdate:modelValue", "onClick:delete"]))), 128))
1065
1065
  ]),
1066
1066
  _: 1
1067
1067
  }, 512)
1068
1068
  ]),
1069
- "side-sheet-footer": H(() => [
1069
+ "side-sheet-footer": U(() => [
1070
1070
  e("div", Tn, [
1071
1071
  y(A, {
1072
1072
  label: a(b)("inventory.stock.adjust.adjustButton"),
1073
1073
  loading: B.value,
1074
1074
  onClick: S[1] || (S[1] = (K) => {
1075
1075
  var O, Z;
1076
- return (Z = (O = f.value) == null ? void 0 : O.validateInputs) == null ? void 0 : Z.call(O);
1076
+ return (Z = (O = v.value) == null ? void 0 : O.validateInputs) == null ? void 0 : Z.call(O);
1077
1077
  })
1078
1078
  }, null, 8, ["label", "loading"])
1079
1079
  ])
@@ -1082,50 +1082,50 @@ const We = {
1082
1082
  }, 8, ["modelValue"]);
1083
1083
  };
1084
1084
  }
1085
- }), Hn = { class: "flex items-center w-full gap-8" }, En = { class: "fm-typo-en-title-md-800 flex-1" }, Pn = { class: "flex flex-col gap-16" }, Rn = { class: "flex flex-col gap-4" }, On = { class: "fm-typo-en-body-md-600" }, Nn = { class: "flex gap-8 items-start" }, Yn = { class: "flex-1 min-w-0" }, Ln = { class: "flex-1 min-w-0" }, zn = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Gn = { class: "flex items-center" }, Wn = { class: "fm-typo-en-title-sm-800 flex-1" }, Kn = { class: "flex gap-8" }, qn = /* @__PURE__ */ me({
1085
+ }), Un = { class: "flex items-center w-full gap-8" }, En = { class: "fm-typo-en-title-md-800 flex-1" }, Pn = { class: "flex flex-col gap-16" }, Rn = { class: "flex flex-col gap-4" }, On = { class: "fm-typo-en-body-md-600" }, Nn = { class: "flex gap-8 items-start" }, Yn = { class: "flex-1 min-w-0" }, Ln = { class: "flex-1 min-w-0" }, zn = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Gn = { class: "flex items-center" }, Wn = { class: "fm-typo-en-title-sm-800 flex-1" }, Kn = { class: "flex gap-8" }, qn = /* @__PURE__ */ me({
1086
1086
  __name: "StockAdjustmentSideSheet",
1087
1087
  props: {
1088
1088
  show: { type: Boolean }
1089
1089
  },
1090
1090
  emits: ["update:show", "submitted"],
1091
- setup(k, { emit: m }) {
1092
- const d = k, s = m, { t: j } = fe(), w = Re(), c = we(), l = Ne(), h = Se(), B = Ye(d, "show"), b = z(!1), i = ut({
1091
+ setup(h, { emit: m }) {
1092
+ const d = h, s = m, { t: M } = fe(), w = Re(), c = we(), l = Ne(), g = Se(), B = Ye(d, "show"), b = z(!1), r = ut({
1093
1093
  remark: "",
1094
1094
  effectiveAt: /* @__PURE__ */ new Date(),
1095
1095
  adjustments: []
1096
- }), f = z(ye().format("YYYY-MM-DD")), T = z(ye().format("HH:mm"));
1097
- $e([f, T], () => {
1098
- if (f.value && T.value) {
1099
- const C = ye(`${f.value} ${T.value}`, "YYYY-MM-DD HH:mm");
1100
- if (C.isValid()) {
1096
+ }), v = z(ye().format("YYYY-MM-DD")), T = z(ye().format("HH:mm"));
1097
+ $e([v, T], () => {
1098
+ if (v.value && T.value) {
1099
+ const D = ye(`${v.value} ${T.value}`, "YYYY-MM-DD HH:mm");
1100
+ if (D.isValid()) {
1101
1101
  const A = ye();
1102
- C.isAfter(A) ? i.effectiveAt = A.toDate() : i.effectiveAt = C.toDate();
1102
+ D.isAfter(A) ? r.effectiveAt = A.toDate() : r.effectiveAt = D.toDate();
1103
1103
  }
1104
1104
  }
1105
1105
  });
1106
- function g() {
1107
- i.remark = "", i.effectiveAt = /* @__PURE__ */ new Date(), i.adjustments = [], f.value = ye(i.effectiveAt).format("YYYY-MM-DD"), T.value = ye(i.effectiveAt).format("HH:mm");
1106
+ function k() {
1107
+ r.remark = "", r.effectiveAt = /* @__PURE__ */ new Date(), r.adjustments = [], v.value = ye(r.effectiveAt).format("YYYY-MM-DD"), T.value = ye(r.effectiveAt).format("HH:mm");
1108
1108
  }
1109
1109
  function x() {
1110
- g();
1110
+ k();
1111
1111
  }
1112
1112
  const o = Y(() => {
1113
- const C = {};
1113
+ const D = {};
1114
1114
  return w.skus.forEach((A) => {
1115
- C[A._id] = A;
1116
- }), C;
1115
+ D[A._id] = A;
1116
+ }), D;
1117
1117
  });
1118
1118
  function t() {
1119
- const C = w.skus.map((I) => ({
1119
+ const D = w.skus.map((I) => ({
1120
1120
  label: I.name,
1121
1121
  sublabel: I.code,
1122
1122
  value: I._id
1123
- })), A = i.adjustments.map((I) => I.doc._id);
1123
+ })), A = r.adjustments.map((I) => I.doc._id);
1124
1124
  l.open({
1125
- title: j("inventory.stock.adjust.selectIngredients"),
1126
- contentComponent: pt,
1125
+ title: M("inventory.stock.adjust.selectIngredients"),
1126
+ contentComponent: vt,
1127
1127
  contentComponentProps: {
1128
- items: C,
1128
+ items: D,
1129
1129
  modelValue: A,
1130
1130
  virtualScroll: !0
1131
1131
  },
@@ -1133,17 +1133,17 @@ const We = {
1133
1133
  closeButton: !0,
1134
1134
  dismissAway: !0,
1135
1135
  primaryActions: {
1136
- text: j("common.confirm"),
1136
+ text: M("common.confirm"),
1137
1137
  close: !0
1138
1138
  },
1139
1139
  secondaryActions: {
1140
- text: j("common.close"),
1140
+ text: M("common.close"),
1141
1141
  close: !0,
1142
1142
  variant: "tertiary"
1143
1143
  }
1144
1144
  }).onPrimary((I) => {
1145
- i.adjustments = I.map(
1146
- (R) => i.adjustments.find((K) => K.doc._id === R) ?? {
1145
+ r.adjustments = I.map(
1146
+ (R) => r.adjustments.find((K) => K.doc._id === R) ?? {
1147
1147
  id: "",
1148
1148
  type: ae.enum.PURCHASE,
1149
1149
  doc: o.value[R],
@@ -1154,21 +1154,21 @@ const We = {
1154
1154
  );
1155
1155
  });
1156
1156
  }
1157
- function n(C) {
1158
- i.adjustments.splice(C, 1);
1157
+ function n(D) {
1158
+ r.adjustments.splice(D, 1);
1159
1159
  }
1160
1160
  async function S() {
1161
- if (i.adjustments.length === 0) {
1162
- h.open({
1163
- title: j("inventory.stock.error.title"),
1164
- message: j("inventory.stock.stock_adjustment.noAdjustments"),
1161
+ if (r.adjustments.length === 0) {
1162
+ g.open({
1163
+ title: M("inventory.stock.error.title"),
1164
+ message: M("inventory.stock.stock_adjustment.noAdjustments"),
1165
1165
  type: "warning"
1166
1166
  });
1167
1167
  return;
1168
1168
  }
1169
1169
  b.value = !0;
1170
1170
  try {
1171
- const C = i.adjustments.map(
1171
+ const D = r.adjustments.map(
1172
1172
  ({ doc: I, remark: R, type: K, amount: O, measurement: Z }) => ({
1173
1173
  id: I._id,
1174
1174
  amount: O,
@@ -1178,51 +1178,51 @@ const We = {
1178
1178
  type: K
1179
1179
  })
1180
1180
  ), A = {
1181
- remark: i.remark,
1182
- adjustments: C,
1183
- effectiveAt: i.effectiveAt.toISOString()
1181
+ remark: r.remark,
1182
+ adjustments: D,
1183
+ effectiveAt: r.effectiveAt.toISOString()
1184
1184
  };
1185
1185
  await c.adjustSku(Pe(A)), s("submitted"), s("update:show", !1);
1186
- } catch (C) {
1187
- h.open({
1188
- title: j("inventory.stock.adjust.error.title"),
1189
- message: j("inventory.stock.adjust.error.message"),
1186
+ } catch (D) {
1187
+ g.open({
1188
+ title: M("inventory.stock.adjust.error.title"),
1189
+ message: M("inventory.stock.adjust.error.message"),
1190
1190
  type: "error"
1191
- }), console.error("error on stock adjustment", C);
1191
+ }), console.error("error on stock adjustment", D);
1192
1192
  } finally {
1193
1193
  b.value = !1;
1194
1194
  }
1195
1195
  }
1196
- return (C, A) => {
1197
- const I = U("FmTextarea"), R = U("FmDatePicker"), K = U("FmTimePicker"), O = U("FmButton"), Z = U("FmSideSheet");
1198
- return D(), X(Z, {
1196
+ return (D, A) => {
1197
+ const I = H("FmTextarea"), R = H("FmDatePicker"), K = H("FmTimePicker"), O = H("FmButton"), Z = H("FmSideSheet");
1198
+ return j(), X(Z, {
1199
1199
  modelValue: a(B),
1200
1200
  "onUpdate:modelValue": A[4] || (A[4] = (q) => Ee(B) ? B.value = q : null),
1201
1201
  "dismiss-away": "",
1202
1202
  "max-width": 560,
1203
1203
  onAfterEnter: x
1204
1204
  }, {
1205
- "side-sheet-header": H(() => [
1206
- e("div", Hn, [
1207
- e("div", En, p(a(j)("inventory.stock.stock_adjustment.title")), 1)
1205
+ "side-sheet-header": U(() => [
1206
+ e("div", Un, [
1207
+ e("div", En, p(a(M)("inventory.stock.stock_adjustment.title")), 1)
1208
1208
  ])
1209
1209
  ]),
1210
- default: H(() => [
1210
+ default: U(() => [
1211
1211
  e("div", Pn, [
1212
1212
  y(I, {
1213
- label: a(j)("inventory.stock.adjust.remark"),
1214
- modelValue: i.remark,
1215
- "onUpdate:modelValue": A[0] || (A[0] = (q) => i.remark = q),
1213
+ label: a(M)("inventory.stock.adjust.remark"),
1214
+ modelValue: r.remark,
1215
+ "onUpdate:modelValue": A[0] || (A[0] = (q) => r.remark = q),
1216
1216
  "label-mark": "optional"
1217
1217
  }, null, 8, ["label", "modelValue"]),
1218
1218
  e("div", Rn, [
1219
- e("label", On, p(a(j)("inventory.stock.stock_adjustment.effectiveAt")), 1),
1219
+ e("label", On, p(a(M)("inventory.stock.stock_adjustment.effectiveAt")), 1),
1220
1220
  e("div", Nn, [
1221
1221
  e("div", Yn, [
1222
1222
  y(R, {
1223
1223
  class: "w-full",
1224
- modelValue: f.value,
1225
- "onUpdate:modelValue": A[1] || (A[1] = (q) => f.value = q),
1224
+ modelValue: v.value,
1225
+ "onUpdate:modelValue": A[1] || (A[1] = (q) => v.value = q),
1226
1226
  clearable: !1,
1227
1227
  max: a(ye)().format("YYYY-MM-DD")
1228
1228
  }, null, 8, ["modelValue", "max"])
@@ -1236,10 +1236,10 @@ const We = {
1236
1236
  }, null, 8, ["modelValue"])
1237
1237
  ])
1238
1238
  ]),
1239
- e("div", zn, p(a(j)("inventory.stock.stock_adjustment.immediateHint")), 1)
1239
+ e("div", zn, p(a(M)("inventory.stock.stock_adjustment.immediateHint")), 1)
1240
1240
  ]),
1241
1241
  e("div", Gn, [
1242
- e("div", Wn, p(a(j)("inventory.stock.adjust.adjustedItems")), 1),
1242
+ e("div", Wn, p(a(M)("inventory.stock.adjust.adjustedItems")), 1),
1243
1243
  y(O, {
1244
1244
  "prepend-icon": "add",
1245
1245
  variant: "tertiary",
@@ -1247,23 +1247,23 @@ const We = {
1247
1247
  onClick: t
1248
1248
  })
1249
1249
  ]),
1250
- (D(!0), W(le, null, ce(i.adjustments, (q, ue) => (D(), X(ht, {
1250
+ (j(!0), W(le, null, ce(r.adjustments, (q, ue) => (j(), X(ht, {
1251
1251
  key: q.id,
1252
- modelValue: i.adjustments[ue],
1253
- "onUpdate:modelValue": (ee) => i.adjustments[ue] = ee,
1252
+ modelValue: r.adjustments[ue],
1253
+ "onUpdate:modelValue": (ee) => r.adjustments[ue] = ee,
1254
1254
  "onClick:delete": (ee) => n(ue)
1255
1255
  }, null, 8, ["modelValue", "onUpdate:modelValue", "onClick:delete"]))), 128))
1256
1256
  ])
1257
1257
  ]),
1258
- "side-sheet-footer": H(() => [
1258
+ "side-sheet-footer": U(() => [
1259
1259
  e("div", Kn, [
1260
1260
  y(O, {
1261
- label: a(j)("common.confirm"),
1261
+ label: a(M)("common.confirm"),
1262
1262
  loading: b.value,
1263
1263
  onClick: S
1264
1264
  }, null, 8, ["label", "loading"]),
1265
1265
  y(O, {
1266
- label: a(j)("common.close"),
1266
+ label: a(M)("common.close"),
1267
1267
  variant: "tertiary",
1268
1268
  onClick: A[3] || (A[3] = (q) => s("update:show", !1))
1269
1269
  }, null, 8, ["label"])
@@ -1273,19 +1273,19 @@ const We = {
1273
1273
  }, 8, ["modelValue"]);
1274
1274
  };
1275
1275
  }
1276
- }), Xn = $t((k, m) => ({
1276
+ }), Xn = $t((h, m) => ({
1277
1277
  // TODO: remove once latest inventory backend has been push
1278
- async findBillsByBusinessId(d, s, j) {
1279
- const w = `${k.businessesBackendUrl}/${d}/reports/find-many`, c = {
1278
+ async findBillsByBusinessId(d, s, M) {
1279
+ const w = `${h.businessesBackendUrl}/${d}/reports/find-many`, c = {
1280
1280
  // type: TYPE.bill,
1281
1281
  type: "bill",
1282
1282
  restaurantIds: s,
1283
- ids: j
1283
+ ids: M
1284
1284
  };
1285
1285
  return await m.post(w, c);
1286
1286
  },
1287
1287
  async findBillsById(d) {
1288
- const j = xe().currentLocationDBName, w = `${k.inventoryBackendUrl}/${j}/bill/search`, c = {
1288
+ const M = xe().currentLocationDBName, w = `${h.inventoryBackendUrl}/${M}/bill/search`, c = {
1289
1289
  ids: d
1290
1290
  };
1291
1291
  return await m.post(w, c);
@@ -1302,79 +1302,79 @@ const We = {
1302
1302
  modelModifiers: {}
1303
1303
  }),
1304
1304
  emits: /* @__PURE__ */ Qe(["refreshHistory"], ["update:modelValue"]),
1305
- setup(k, { emit: m }) {
1306
- const d = k, s = m, j = we(), w = bt(k, "modelValue"), c = z(!1), l = z(!1), h = z(!1), B = z({
1305
+ setup(h, { emit: m }) {
1306
+ const d = h, s = m, M = we(), w = bt(h, "modelValue"), c = z(!1), l = z(!1), g = z(!1), B = z({
1307
1307
  _id: `inventoryAdjustment_${(/* @__PURE__ */ new Date()).toISOString()}_XXXXX`,
1308
1308
  skus: []
1309
1309
  }), b = z();
1310
1310
  qe(async () => {
1311
1311
  c.value = !0;
1312
- const o = await j.readSingleAdjustment(d.adjustmentId);
1312
+ const o = await M.readSingleAdjustment(d.adjustmentId);
1313
1313
  if (!o) throw new Error("Adjustment not found");
1314
1314
  B.value = o, c.value = !1;
1315
1315
  });
1316
- async function i() {
1316
+ async function r() {
1317
1317
  var t, n;
1318
1318
  if ((n = (t = b == null ? void 0 : b.value) == null ? void 0 : t.validateInputs) == null || n.call(t), !l.value) return;
1319
1319
  const o = {};
1320
1320
  Object.keys(w.value || {}).forEach((S) => {
1321
- var C;
1322
- Object.keys(((C = w.value) == null ? void 0 : C[S]) || {}).forEach((A) => {
1321
+ var D;
1322
+ Object.keys(((D = w.value) == null ? void 0 : D[S]) || {}).forEach((A) => {
1323
1323
  var R, K;
1324
1324
  const I = (K = (R = w.value) == null ? void 0 : R[S]) == null ? void 0 : K[Number(A)];
1325
1325
  I && T(I.amount) > 0 && (o[S] || (o[S] = []), o[S].push(I));
1326
1326
  });
1327
- }), await j.revertWastageAdjustment({
1327
+ }), await M.revertWastageAdjustment({
1328
1328
  targetWastageAdjustmentId: d.adjustmentId,
1329
1329
  amountsGoingToAdjust: o
1330
- }), s("refreshHistory"), h.value = !1, w.value = {};
1330
+ }), s("refreshHistory"), g.value = !1, w.value = {};
1331
1331
  }
1332
- function f(o) {
1333
- const { skuId: t, idx: n, unit: S, measurement: C } = o;
1332
+ function v(o) {
1333
+ const { skuId: t, idx: n, unit: S, measurement: D } = o;
1334
1334
  return Y({
1335
1335
  get: () => {
1336
1336
  var R, K, O;
1337
1337
  const A = (O = (K = (R = w.value) == null ? void 0 : R[t]) == null ? void 0 : K[n]) == null ? void 0 : O.amount;
1338
- return A ? Number(pe.toFormatString({ value: A })) : 0;
1338
+ return A ? Number(ve.toFormatString({ value: A })) : 0;
1339
1339
  },
1340
1340
  set: (A) => {
1341
1341
  w.value || (w.value = {});
1342
1342
  const I = { ...w.value };
1343
1343
  I[t] || (I[t] = {}), I[t][n] = {
1344
- amount: pe.convertPrecision({
1345
- value: pe.fromNumber(A),
1344
+ amount: ve.convertPrecision({
1345
+ value: ve.fromNumber(A),
1346
1346
  precision: Ce(S)
1347
1347
  }),
1348
1348
  type: ae.Enum.WASTAGE,
1349
- measurement: C
1349
+ measurement: D
1350
1350
  }, w.value = I;
1351
1351
  }
1352
1352
  });
1353
1353
  }
1354
1354
  function T(o, t = !0) {
1355
- const n = Number(pe.toFormatString({ value: o }));
1355
+ const n = Number(ve.toFormatString({ value: o }));
1356
1356
  return t ? Math.abs(n) : n;
1357
1357
  }
1358
- function g(o, t) {
1358
+ function k(o, t) {
1359
1359
  return t.measurement ? t.measurement.abbrev : o.sku.unit.abbrev;
1360
1360
  }
1361
1361
  function x(o, t) {
1362
1362
  if (t.amount === 0) return "N/A";
1363
- const n = pe.add([o, t]);
1364
- return n ? pe.toFormatString({ value: n }) : "N/A";
1363
+ const n = ve.add([o, t]);
1364
+ return n ? ve.toFormatString({ value: n }) : "N/A";
1365
1365
  }
1366
1366
  return (o, t) => {
1367
- const n = U("FmIcon"), S = U("FmStepperField"), C = U("FmCard"), A = U("FmForm"), I = U("FmSpacer"), R = U("FmButton"), K = U("FmDialog");
1368
- return D(), X(K, {
1369
- modelValue: h.value,
1370
- "onUpdate:modelValue": t[4] || (t[4] = (O) => h.value = O),
1367
+ const n = H("FmIcon"), S = H("FmStepperField"), D = H("FmCard"), A = H("FmForm"), I = H("FmSpacer"), R = H("FmButton"), K = H("FmDialog");
1368
+ return j(), X(K, {
1369
+ modelValue: g.value,
1370
+ "onUpdate:modelValue": t[4] || (t[4] = (O) => g.value = O),
1371
1371
  overlay: !0
1372
1372
  }, {
1373
- "dialog-button": H(() => [
1373
+ "dialog-button": U(() => [
1374
1374
  y(Xe, null, {
1375
- default: H(() => [
1375
+ default: U(() => [
1376
1376
  e("button", {
1377
- onClick: t[0] || (t[0] = (O) => h.value = !0),
1377
+ onClick: t[0] || (t[0] = (O) => g.value = !0),
1378
1378
  class: "rounded-md hover:bg-gray-100 transition-colors"
1379
1379
  }, [
1380
1380
  y(n, {
@@ -1386,10 +1386,10 @@ const We = {
1386
1386
  _: 1
1387
1387
  })
1388
1388
  ]),
1389
- "dialog-header": H(() => t[5] || (t[5] = [
1389
+ "dialog-header": U(() => t[5] || (t[5] = [
1390
1390
  e("div", null, "Amend Adjustment", -1)
1391
1391
  ])),
1392
- "dialog-footer": H(() => [
1392
+ "dialog-footer": U(() => [
1393
1393
  e("div", ao, [
1394
1394
  t[13] || (t[13] = e("span", { class: "text-fm-color-system-warning-400 fm-typo-en-body-sm-400" }, "1. New adjustment EXTRA will be created for each reversal", -1)),
1395
1395
  e("div", lo, [
@@ -1399,20 +1399,20 @@ const We = {
1399
1399
  label: "Close",
1400
1400
  size: "md",
1401
1401
  variant: "tertiary",
1402
- onClick: t[3] || (t[3] = (O) => h.value = !1)
1402
+ onClick: t[3] || (t[3] = (O) => g.value = !1)
1403
1403
  }),
1404
1404
  y(R, {
1405
1405
  class: "sm:w-full xs:w-full",
1406
1406
  label: "Submit",
1407
1407
  size: "md",
1408
1408
  variant: "primary",
1409
- onClick: i
1409
+ onClick: r
1410
1410
  })
1411
1411
  ])
1412
1412
  ])
1413
1413
  ]),
1414
- default: H(() => [
1415
- c.value ? (D(), W("div", Jn)) : (D(), X(A, {
1414
+ default: U(() => [
1415
+ c.value ? (j(), W("div", Jn)) : (j(), X(A, {
1416
1416
  key: 1,
1417
1417
  ref_key: "formRef",
1418
1418
  ref: b,
@@ -1424,20 +1424,20 @@ const We = {
1424
1424
  }),
1425
1425
  blameFormChildOnValidationFailed: ""
1426
1426
  }, {
1427
- default: H(() => [
1427
+ default: U(() => [
1428
1428
  e("p", Qn, [
1429
1429
  t[6] || (t[6] = e("b", null, "Date:", -1)),
1430
1430
  t[7] || (t[7] = e("br", null, null, -1)),
1431
- ve(" " + p(a(Yt)(a(Vt)(B.value._id))), 1)
1431
+ pe(" " + p(a(Yt)(a(Vt)(B.value._id))), 1)
1432
1432
  ]),
1433
1433
  e("div", Zn, [
1434
- (D(!0), W(le, null, ce(B.value.skus, (O, Z) => (D(), W(le, { key: Z }, [
1435
- (D(!0), W(le, null, ce(O.amounts, (q, ue) => (D(), X(C, {
1434
+ (j(!0), W(le, null, ce(B.value.skus, (O, Z) => (j(), W(le, { key: Z }, [
1435
+ (j(!0), W(le, null, ce(O.amounts, (q, ue) => (j(), X(D, {
1436
1436
  key: ue,
1437
1437
  variant: "outlined",
1438
1438
  class: "p-2"
1439
1439
  }, {
1440
- default: H(() => [
1440
+ default: U(() => [
1441
1441
  e("div", eo, [
1442
1442
  e("span", to, p(O.sku.code), 1),
1443
1443
  e("span", null, p(O.sku.name), 1)
@@ -1449,16 +1449,16 @@ const We = {
1449
1449
  ]),
1450
1450
  e("div", oo, [
1451
1451
  t[9] || (t[9] = e("span", { class: "fm-typo-en-body-lg-600" }, "Current amount:", -1)),
1452
- e("span", null, p(a(pe).toFormatString({ value: q.amount })) + " " + p(g(O, q)), 1)
1452
+ e("span", null, p(a(ve).toFormatString({ value: q.amount })) + " " + p(k(O, q)), 1)
1453
1453
  ]),
1454
1454
  y(S, {
1455
1455
  "max-fraction-digits": a(Ce)(O.sku.unit),
1456
- "model-value": f({
1456
+ "model-value": v({
1457
1457
  skuId: O.sku._id,
1458
1458
  idx: ue,
1459
1459
  unit: O.sku.unit
1460
1460
  }).value,
1461
- "onUpdate:modelValue": (ee) => f({
1461
+ "onUpdate:modelValue": (ee) => v({
1462
1462
  skuId: O.sku._id,
1463
1463
  idx: ue,
1464
1464
  unit: O.sku.unit
@@ -1466,25 +1466,25 @@ const We = {
1466
1466
  class: "mb-3",
1467
1467
  label: "Adjust Amount (Leave 0 to skip)",
1468
1468
  "helper-text": `Max: ${T(q.amount)}`,
1469
- "append-text": g(O, q),
1469
+ "append-text": k(O, q),
1470
1470
  rules: [
1471
1471
  (ee) => ee <= T(q.amount) || `Cannot be more than ${T(q.amount)}`,
1472
- a(Ue)(-1)
1472
+ a(Te)(-1)
1473
1473
  ]
1474
1474
  }, null, 8, ["max-fraction-digits", "model-value", "onUpdate:modelValue", "helper-text", "append-text", "rules"]),
1475
1475
  e("div", so, [
1476
1476
  t[10] || (t[10] = e("span", { class: "fm-typo-en-body-lg-600" }, "Amount after amend:", -1)),
1477
1477
  t[11] || (t[11] = e("span", { class: "text-fm-color-system-warning-400 fm-typo-en-body-sm-400" }, "* It's an estimate for your reference, as it didn't include all the reversals related to this adjustment", -1)),
1478
- ve(" " + p(x(
1478
+ pe(" " + p(x(
1479
1479
  q.amount,
1480
- a(pe).fromNumber(
1481
- f({
1480
+ a(ve).fromNumber(
1481
+ v({
1482
1482
  skuId: O.sku._id,
1483
1483
  idx: ue,
1484
1484
  unit: O.sku.unit
1485
1485
  }).value
1486
1486
  )
1487
- )) + " " + p(g(O, q)), 1)
1487
+ )) + " " + p(k(O, q)), 1)
1488
1488
  ])
1489
1489
  ]),
1490
1490
  _: 2
@@ -1502,7 +1502,7 @@ const We = {
1502
1502
  }), io = { class: "p-16" }, uo = { class: "fm-typo-en-body-md-600 flex-grow" }, co = { class: "flex-grow text-fm-color-typo-secondary" }, mo = {
1503
1503
  key: 0,
1504
1504
  class: "my-5"
1505
- }, fo = { class: "text-neutral-400" }, vo = { class: "flex-grow" }, po = { class: "flex gap-1" }, yo = { class: "flex flex-col gap-1" }, _o = {
1505
+ }, fo = { class: "text-neutral-400" }, po = { class: "flex-grow" }, vo = { class: "flex gap-1" }, yo = { class: "flex flex-col gap-1" }, _o = {
1506
1506
  key: 1,
1507
1507
  class: "t-system text-fsecondary"
1508
1508
  }, ko = {
@@ -1520,68 +1520,68 @@ const We = {
1520
1520
  unitCostHistory: { default: () => [] },
1521
1521
  costMechanism: { default: "adjustment" }
1522
1522
  },
1523
- setup(k) {
1524
- const m = k;
1525
- function d(b, i) {
1523
+ setup(h) {
1524
+ const m = h;
1525
+ function d(b, r) {
1526
1526
  if (m.costMechanism === "adjustment")
1527
1527
  return null;
1528
- const f = m.unitCostHistory.filter(
1528
+ const v = m.unitCostHistory.filter(
1529
1529
  (x) => x.mechanism === m.costMechanism && x.skuId === m.sku._id
1530
1530
  );
1531
- if (f.length === 0) return null;
1532
- const T = f.find((x) => {
1531
+ if (v.length === 0) return null;
1532
+ const T = v.find((x) => {
1533
1533
  const o = x.meta;
1534
1534
  return (o == null ? void 0 : o.adjustmentId) === b;
1535
1535
  });
1536
1536
  if (T) return T.cost;
1537
- const g = [...f].filter((x) => new Date(x.snapshotAt) <= new Date(i)).sort((x, o) => new Date(o.snapshotAt).getTime() - new Date(x.snapshotAt).getTime());
1538
- return g.length > 0 ? g[0].cost : null;
1537
+ const k = [...v].filter((x) => new Date(x.snapshotAt) <= new Date(r)).sort((x, o) => new Date(o.snapshotAt).getTime() - new Date(x.snapshotAt).getTime());
1538
+ return k.length > 0 ? k[0].cost : null;
1539
1539
  }
1540
- const s = z(!1), j = z(), w = z(null), c = Y(() => w.value === null ? "unset" : s.value ? `${w.value}px` : "0px");
1540
+ const s = z(!1), M = z(), w = z(null), c = Y(() => w.value === null ? "unset" : s.value ? `${w.value}px` : "0px");
1541
1541
  qe(() => {
1542
1542
  var b;
1543
- w.value = ((b = j.value) == null ? void 0 : b.scrollHeight) || 0;
1543
+ w.value = ((b = M.value) == null ? void 0 : b.scrollHeight) || 0;
1544
1544
  });
1545
1545
  const l = Y(() => {
1546
1546
  var x;
1547
- const b = m.record.adjustments, i = m.sku, f = {}, g = b.flatMap((o) => {
1547
+ const b = m.record.adjustments, r = m.sku, v = {}, k = b.flatMap((o) => {
1548
1548
  var t;
1549
- return ((t = o.skus) == null ? void 0 : t.filter((n) => n.sku._id === i._id)) ?? [];
1549
+ return ((t = o.skus) == null ? void 0 : t.filter((n) => n.sku._id === r._id)) ?? [];
1550
1550
  }).flatMap((o) => o.amounts);
1551
- for (const o of g) {
1551
+ for (const o of k) {
1552
1552
  const t = o.measurement ? dt(o.measurement.conversion, o.amount) : o.amount;
1553
- f[x = o.type] ?? (f[x] = { amount: 0, precision: 0 }), f[o.type] = Je(t, f[o.type]);
1553
+ v[x = o.type] ?? (v[x] = { amount: 0, precision: 0 }), v[o.type] = Je(t, v[o.type]);
1554
1554
  }
1555
- return Object.entries(f).reduce(
1555
+ return Object.entries(v).reduce(
1556
1556
  (o, [t, n]) => (o[t] = /// comment, because without it formatter makes code uglier
1557
1557
  `${Q.toFormatString({
1558
1558
  value: n,
1559
1559
  precision: 4
1560
- })} ${i.unit.abbrev}`, o),
1560
+ })} ${r.unit.abbrev}`, o),
1561
1561
  {}
1562
1562
  );
1563
- }), { t: h } = fe(), B = Y(() => m.record.adjustmentsByTime.map(({ date: b, adjustments: i }) => ({
1563
+ }), { t: g } = fe(), B = Y(() => m.record.adjustmentsByTime.map(({ date: b, adjustments: r }) => ({
1564
1564
  time: Lt(new Date(b)),
1565
- adjustments: i.flatMap(
1566
- (f) => {
1567
- var T, g;
1568
- return ((g = (T = f.skus) == null ? void 0 : T.map) == null ? void 0 : g.call(T, (x) => {
1565
+ adjustments: r.flatMap(
1566
+ (v) => {
1567
+ var T, k;
1568
+ return ((k = (T = v.skus) == null ? void 0 : T.map) == null ? void 0 : k.call(T, (x) => {
1569
1569
  var o, t;
1570
1570
  return {
1571
1571
  ...x,
1572
- ref: f.ref,
1573
- backdateFrom: f.effectiveAt != null ? Te(f._id) : null,
1574
- toBalance: (t = (o = f.skus) == null ? void 0 : o[0]) == null ? void 0 : t.toBalance,
1575
- adjustmentId: f._id,
1576
- adjustmentTime: f.effectiveAt ?? Te(f._id)
1572
+ ref: v.ref,
1573
+ backdateFrom: v.effectiveAt != null ? He(v._id) : null,
1574
+ toBalance: (t = (o = v.skus) == null ? void 0 : o[0]) == null ? void 0 : t.toBalance,
1575
+ adjustmentId: v._id,
1576
+ adjustmentTime: v.effectiveAt ?? He(v._id)
1577
1577
  };
1578
1578
  })) ?? [];
1579
1579
  }
1580
- ).flatMap((f) => {
1580
+ ).flatMap((v) => {
1581
1581
  var t;
1582
- const T = (t = m.bills.find((n) => n._id === f.ref)) == null ? void 0 : t.seqNumber, g = T ? h("inventory.stock.record.bill", [T]) : "", x = f.adjustmentTime ?? (/* @__PURE__ */ new Date()).toISOString(), o = d(f.adjustmentId, x);
1583
- return f.amounts.map((n) => {
1584
- var C;
1582
+ const T = (t = m.bills.find((n) => n._id === v.ref)) == null ? void 0 : t.seqNumber, k = T ? g("inventory.stock.record.bill", [T]) : "", x = v.adjustmentTime ?? (/* @__PURE__ */ new Date()).toISOString(), o = d(v.adjustmentId, x);
1583
+ return v.amounts.map((n) => {
1584
+ var D;
1585
1585
  let S = n.cost;
1586
1586
  if (o) {
1587
1587
  const A = Q.fromDinero(o), I = n.amount, R = n.measurement ? Q.multiply([I, n.measurement.conversion]) : I;
@@ -1591,44 +1591,44 @@ const We = {
1591
1591
  };
1592
1592
  }
1593
1593
  return {
1594
- amount: `${Q.toFormatString({ value: n.amount, precision: 4 })} ${((C = n.measurement) == null ? void 0 : C.abbrev) ?? f.sku.unit.abbrev}`,
1595
- backdateFrom: f.backdateFrom,
1594
+ amount: `${Q.toFormatString({ value: n.amount, precision: 4 })} ${((D = n.measurement) == null ? void 0 : D.abbrev) ?? v.sku.unit.abbrev}`,
1595
+ backdateFrom: v.backdateFrom,
1596
1596
  name: n.type,
1597
- billRemark: g,
1597
+ billRemark: k,
1598
1598
  remark: n.remark || "",
1599
1599
  cost: S,
1600
1600
  toBalance: Q.toFormatString({
1601
- value: f.toBalance ?? Q.fromNumber(0),
1601
+ value: v.toBalance ?? Q.fromNumber(0),
1602
1602
  precision: 4
1603
1603
  }),
1604
- baseUnit: f.sku.unit.abbrev,
1605
- adjustmentId: f.adjustmentId
1604
+ baseUnit: v.sku.unit.abbrev,
1605
+ adjustmentId: v.adjustmentId
1606
1606
  };
1607
1607
  });
1608
1608
  })
1609
1609
  })));
1610
- return (b, i) => {
1611
- const f = U("FmIcon"), T = U("FmTooltip"), g = U("FmCard");
1612
- return D(), X(g, { variant: "outlined" }, {
1613
- default: H(() => [
1610
+ return (b, r) => {
1611
+ const v = H("FmIcon"), T = H("FmTooltip"), k = H("FmCard");
1612
+ return j(), X(k, { variant: "outlined" }, {
1613
+ default: U(() => [
1614
1614
  e("div", io, [
1615
1615
  e("div", {
1616
1616
  class: "flex items-center cursor-pointer mb-1",
1617
- onClick: i[0] || (i[0] = (x) => s.value = !s.value)
1617
+ onClick: r[0] || (r[0] = (x) => s.value = !s.value)
1618
1618
  }, [
1619
1619
  e("div", uo, p(b.record.date), 1),
1620
- y(f, {
1620
+ y(v, {
1621
1621
  name: s.value ? "expand_more" : "expand_less",
1622
1622
  color: "#777777",
1623
1623
  size: "md"
1624
1624
  }, null, 8, ["name"])
1625
1625
  ]),
1626
- (D(!0), W(le, null, ce(l.value, (x, o) => (D(), W("div", {
1626
+ (j(!0), W(le, null, ce(l.value, (x, o) => (j(), W("div", {
1627
1627
  key: o,
1628
1628
  class: "flex flex-row py-1",
1629
1629
  style: { "font-size": "0.8rem" }
1630
1630
  }, [
1631
- e("div", co, p(a(h)(`inventory.inventoryAdjustment.type.${o}`)), 1),
1631
+ e("div", co, p(a(g)(`inventory.inventoryAdjustment.type.${o}`)), 1),
1632
1632
  e("div", {
1633
1633
  class: ge({
1634
1634
  "text-fm-color-typo-error": x.startsWith("-"),
@@ -1639,7 +1639,7 @@ const We = {
1639
1639
  ]))), 128)),
1640
1640
  e("div", {
1641
1641
  ref_key: "detailRef",
1642
- ref: j,
1642
+ ref: M,
1643
1643
  style: ct({
1644
1644
  fontSize: "0.8rem",
1645
1645
  maxHeight: c.value,
@@ -1647,32 +1647,32 @@ const We = {
1647
1647
  transition: "max-height 0.2s ease-out"
1648
1648
  })
1649
1649
  }, [
1650
- B.value.length ? (D(), W("hr", mo)) : se("", !0),
1651
- (D(!0), W(le, null, ce(B.value, (x) => (D(), W("div", {
1650
+ B.value.length ? (j(), W("hr", mo)) : se("", !0),
1651
+ (j(!0), W(le, null, ce(B.value, (x) => (j(), W("div", {
1652
1652
  key: x.time,
1653
1653
  class: "flex gap-1 w-full"
1654
1654
  }, [
1655
1655
  e("div", fo, p(x.time), 1),
1656
- e("div", vo, [
1657
- (D(!0), W(le, null, ce(x.adjustments, (o) => (D(), W("div", {
1656
+ e("div", po, [
1657
+ (j(!0), W(le, null, ce(x.adjustments, (o) => (j(), W("div", {
1658
1658
  key: o.name,
1659
1659
  class: "flex gap-1"
1660
1660
  }, [
1661
- e("div", po, [
1662
- ve(p(a(h)(`inventory.inventoryAdjustment.type.${o.name}`)) + " ", 1),
1663
- o.backdateFrom ? (D(), X(T, {
1661
+ e("div", vo, [
1662
+ pe(p(a(g)(`inventory.inventoryAdjustment.type.${o.name}`)) + " ", 1),
1663
+ o.backdateFrom ? (j(), X(T, {
1664
1664
  key: 0,
1665
1665
  variant: "plain",
1666
1666
  placement: "top",
1667
1667
  "z-index": 50
1668
1668
  }, {
1669
- content: H(() => [
1670
- e("div", yo, p(a(h)("inventory.stock.record.backdate", [
1669
+ content: U(() => [
1670
+ e("div", yo, p(a(g)("inventory.stock.record.backdate", [
1671
1671
  a(yt)(new Date(o.backdateFrom))
1672
1672
  ])), 1)
1673
1673
  ]),
1674
- default: H(() => [
1675
- y(f, {
1674
+ default: U(() => [
1675
+ y(v, {
1676
1676
  name: "info",
1677
1677
  size: "sm",
1678
1678
  color: "primary"
@@ -1680,12 +1680,12 @@ const We = {
1680
1680
  ]),
1681
1681
  _: 2
1682
1682
  }, 1024)) : se("", !0),
1683
- o.billRemark ? (D(), W("span", _o, " # " + p(o.billRemark), 1)) : se("", !0),
1684
- o.remark ? (D(), W("span", {
1683
+ o.billRemark ? (j(), W("span", _o, " # " + p(o.billRemark), 1)) : se("", !0),
1684
+ o.remark ? (j(), W("span", {
1685
1685
  key: 2,
1686
1686
  class: ge(o.billRemark ? "text-xs text-gray-400" : "")
1687
1687
  }, p(o.billRemark ? `(${o.remark})` : `# ${o.remark}`), 3)) : se("", !0),
1688
- o.name === a(ae).Enum.CLOSING ? (D(), W("span", ko, " Actual Balance: " + p(o.toBalance) + " " + p(o.baseUnit), 1)) : se("", !0)
1688
+ o.name === a(ae).Enum.CLOSING ? (j(), W("span", ko, " Actual Balance: " + p(o.toBalance) + " " + p(o.baseUnit), 1)) : se("", !0)
1689
1689
  ]),
1690
1690
  e("div", {
1691
1691
  class: ge({
@@ -1694,12 +1694,12 @@ const We = {
1694
1694
  "ml-auto": !0
1695
1695
  })
1696
1696
  }, p(o.amount), 3),
1697
- o.name === a(ae).Enum.WASTAGE ? (D(), X(ro, {
1697
+ o.name === a(ae).Enum.WASTAGE ? (j(), X(ro, {
1698
1698
  key: 0,
1699
1699
  adjustmentId: o.adjustmentId,
1700
- onRefreshHistory: i[1] || (i[1] = (t) => b.$emit("refreshHistory"))
1700
+ onRefreshHistory: r[1] || (r[1] = (t) => b.$emit("refreshHistory"))
1701
1701
  }, null, 8, ["adjustmentId"])) : se("", !0),
1702
- o.cost ? (D(), W("div", ho, " (" + p(a(Me)(o.cost, !1, o.cost.precision)) + ") ", 1)) : se("", !0)
1702
+ o.cost ? (j(), W("div", ho, " (" + p(a(Me)(o.cost, !1, o.cost.precision)) + ") ", 1)) : se("", !0)
1703
1703
  ]))), 128))
1704
1704
  ])
1705
1705
  ]))), 128))
@@ -1711,7 +1711,7 @@ const We = {
1711
1711
  };
1712
1712
  }
1713
1713
  });
1714
- function bo(k, m) {
1714
+ function bo(h, m) {
1715
1715
  var w;
1716
1716
  const d = Object.keys(ae.enum).reduce(
1717
1717
  (c, l) => (c[l] = { amount: 0, precision: 0 }, c),
@@ -1722,19 +1722,19 @@ function bo(k, m) {
1722
1722
  (c, [l]) => (c[l] = Q.fromNumber(0), c),
1723
1723
  {}
1724
1724
  );
1725
- const j = k.flatMap((c) => {
1725
+ const M = h.flatMap((c) => {
1726
1726
  var l;
1727
- return ((l = c.skus) == null ? void 0 : l.filter((h) => h.sku._id === m._id)) ?? [];
1727
+ return ((l = c.skus) == null ? void 0 : l.filter((g) => g.sku._id === m._id)) ?? [];
1728
1728
  }).flatMap((c) => c.amounts);
1729
- for (const c of j) {
1729
+ for (const c of M) {
1730
1730
  const l = c.measurement ? Q.multiply([c.measurement.conversion, c.amount]) : c.amount;
1731
1731
  d[w = c.type] ?? (d[w] = { amount: 0, precision: 0 }), d[c.type] = Q.add([l, d[c.type]]);
1732
1732
  }
1733
1733
  return Object.entries(d).reduce(
1734
- (c, [l, h]) => {
1734
+ (c, [l, g]) => {
1735
1735
  const B = {
1736
- ...h,
1737
- amount: Math.abs(h.amount)
1736
+ ...g,
1737
+ amount: Math.abs(g.amount)
1738
1738
  };
1739
1739
  return c[l] = /// comment, because without it formatter makes code uglier
1740
1740
  `${Q.toFormatString({
@@ -1745,24 +1745,24 @@ function bo(k, m) {
1745
1745
  {}
1746
1746
  );
1747
1747
  }
1748
- function xo(k, m) {
1748
+ function xo(h, m) {
1749
1749
  if (!m)
1750
1750
  return null;
1751
1751
  let d = null;
1752
- const j = k.flatMap((w) => {
1752
+ const M = h.flatMap((w) => {
1753
1753
  var c;
1754
1754
  return ((c = w.skus) == null ? void 0 : c.filter((l) => l.sku._id === m._id)) ?? [];
1755
1755
  }).flatMap((w) => {
1756
1756
  var c;
1757
1757
  return !w.history || ((c = w.history) == null ? void 0 : c.length) === 0 ? [] : w.history[0];
1758
1758
  });
1759
- for (const w of j) {
1759
+ for (const w of M) {
1760
1760
  const c = w.amounts;
1761
1761
  for (const l of c) {
1762
1762
  if (l.type !== ae.Enum.SALES)
1763
1763
  continue;
1764
- const h = l.measurement ? Q.multiply([l.measurement.conversion, l.amount]) : l.amount;
1765
- d ?? (d = Q.fromNumber(0)), d = Q.add([d, h]);
1764
+ const g = l.measurement ? Q.multiply([l.measurement.conversion, l.amount]) : l.amount;
1765
+ d ?? (d = Q.fromNumber(0)), d = Q.add([d, g]);
1766
1766
  }
1767
1767
  }
1768
1768
  return d != null ? (d.amount = Math.abs(d.amount), `${Q.toFormatString({
@@ -1779,10 +1779,10 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
1779
1779
  }, jo = { class: "pb-16" }, Mo = { class: "fm-typo-cn-body-lg-600" }, Bo = {
1780
1780
  class: "grid gap-12 fm-typo-en-body-md-400",
1781
1781
  style: { "grid-template-columns": "auto auto auto", "grid-auto-rows": "1fr" }
1782
- }, Io = { class: "flex flex-col gap-1" }, To = { class: "text-fm-color-typo-secondary" }, Uo = { class: "font-bold" }, Ho = { class: "flex flex-col gap-1" }, Eo = { class: "text-fm-color-typo-secondary flex" }, Po = { class: "font-bold" }, Ro = { class: "flex flex-col gap-1" }, Oo = { class: "text-fm-color-typo-secondary" }, No = { class: "font-bold" }, Yo = { class: "flex flex-col gap-1" }, Lo = { class: "text-fm-color-typo-secondary" }, zo = { class: "font-bold" }, Go = { class: "flex flex-col gap-1" }, Wo = { class: "text-fm-color-typo-secondary" }, Ko = { class: "font-bold" }, qo = { class: "flex flex-col gap-1" }, Xo = { class: "text-fm-color-typo-secondary" }, Jo = { class: "font-bold" }, Qo = { class: "flex flex-col gap-1" }, Zo = { class: "text-fm-color-typo-secondary" }, es = { class: "font-bold" }, ts = { class: "flex flex-col gap-1" }, ns = { class: "text-fm-color-typo-secondary" }, os = { class: "font-bold" }, ss = { class: "flex flex-col gap-1" }, as = { class: "text-fm-color-typo-secondary" }, ls = { class: "font-bold" }, rs = {
1782
+ }, Io = { class: "flex flex-col gap-1" }, To = { class: "text-fm-color-typo-secondary" }, Ho = { class: "font-bold" }, Uo = { class: "flex flex-col gap-1" }, Eo = { class: "text-fm-color-typo-secondary flex" }, Po = { class: "font-bold" }, Ro = { class: "flex flex-col gap-1" }, Oo = { class: "text-fm-color-typo-secondary" }, No = { class: "font-bold" }, Yo = { class: "flex flex-col gap-1" }, Lo = { class: "text-fm-color-typo-secondary" }, zo = { class: "font-bold" }, Go = { class: "flex flex-col gap-1" }, Wo = { class: "text-fm-color-typo-secondary" }, Ko = { class: "font-bold" }, qo = { class: "flex flex-col gap-1" }, Xo = { class: "text-fm-color-typo-secondary" }, Jo = { class: "font-bold" }, Qo = { class: "flex flex-col gap-1" }, Zo = { class: "text-fm-color-typo-secondary" }, es = { class: "font-bold" }, ts = { class: "flex flex-col gap-1" }, ns = { class: "text-fm-color-typo-secondary" }, os = { class: "font-bold" }, ss = { class: "flex flex-col gap-1" }, as = { class: "text-fm-color-typo-secondary" }, ls = { class: "font-bold" }, rs = {
1783
1783
  key: 0,
1784
1784
  class: "flex flex-col gap-8"
1785
- }, is = { class: "flex" }, us = { class: "flex-1 flex flex-col gap-1" }, cs = { class: "flex gap-1 items-center text-fm-color-typo-secondary" }, ds = { class: "font-bold" }, ms = { class: "flex-1 flex flex-col gap-1" }, fs = { class: "flex gap-1 items-center text-fm-color-typo-secondary" }, vs = { class: "flex flex-col gap-1" }, ps = { class: "font-bold" }, ys = {
1785
+ }, is = { class: "flex" }, us = { class: "flex-1 flex flex-col gap-1" }, cs = { class: "flex gap-1 items-center text-fm-color-typo-secondary" }, ds = { class: "font-bold" }, ms = { class: "flex-1 flex flex-col gap-1" }, fs = { class: "flex gap-1 items-center text-fm-color-typo-secondary" }, ps = { class: "flex flex-col gap-1" }, vs = { class: "font-bold" }, ys = {
1786
1786
  key: 2,
1787
1787
  class: "flex-1 flex flex-col items-center gap-8"
1788
1788
  }, _s = ["src"], ks = { class: "font-bold text-lg" }, hs = { class: "text-xs text-neutral-400 text-center" }, gs = /* @__PURE__ */ me({
@@ -1792,10 +1792,10 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
1792
1792
  show: { type: Boolean }
1793
1793
  },
1794
1794
  emits: ["update:show"],
1795
- setup(k) {
1796
- const m = vt(), d = Oe(), s = we(), j = Xn(), w = xe(), c = Jt(), { t: l } = fe(), h = k, B = z(!1), b = Se(), i = z("adjustment"), f = z([
1795
+ setup(h) {
1796
+ const m = pt(), d = Oe(), s = we(), M = Xn(), w = xe(), c = Jt(), { t: l } = fe(), g = h, B = z(!1), b = Se(), r = z("adjustment"), v = z([
1797
1797
  { label: "Adjustment (Default)", value: "adjustment" }
1798
- ]), T = z([]), g = z(Kt(0));
1798
+ ]), T = z([]), k = z(Kt(0));
1799
1799
  async function x() {
1800
1800
  B.value = !0;
1801
1801
  try {
@@ -1805,252 +1805,252 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
1805
1805
  title: "Something went wrong",
1806
1806
  message: "Cannot fetch stock history. Please try again.",
1807
1807
  type: "error"
1808
- }), console.log("failed at fetching item adjustment history", h.sku, g, _);
1808
+ }), console.log("failed at fetching item adjustment history", g.sku, k, _);
1809
1809
  } finally {
1810
1810
  B.value = !1;
1811
1811
  }
1812
1812
  }
1813
1813
  qe(() => {
1814
1814
  x();
1815
- }), $e([() => g.value, () => h.sku], () => {
1815
+ }), $e([() => k.value, () => g.sku], () => {
1816
1816
  x();
1817
1817
  });
1818
1818
  const o = z([]), t = z([]), n = z(new Array());
1819
- function S(_, r) {
1820
- return r === "day" ? Wt(_) : yt(_);
1819
+ function S(_, i) {
1820
+ return i === "day" ? Wt(_) : yt(_);
1821
1821
  }
1822
- function C(_, r) {
1823
- const M = _.reduce(
1824
- (V, u) => {
1825
- const F = u.effectiveAt ?? Te(u._id);
1822
+ function D(_, i) {
1823
+ const V = _.reduce(
1824
+ (C, u) => {
1825
+ const F = u.effectiveAt ?? He(u._id);
1826
1826
  if (!F)
1827
- return V;
1828
- const N = S(new Date(F), r);
1829
- return V[N] ?? (V[N] = []), V[N].push(u), V;
1827
+ return C;
1828
+ const N = S(new Date(F), i);
1829
+ return C[N] ?? (C[N] = []), C[N].push(u), C;
1830
1830
  },
1831
1831
  {}
1832
1832
  );
1833
- return Object.keys(M).map((V) => ({
1834
- date: V,
1835
- adjustments: M[V]
1833
+ return Object.keys(V).map((C) => ({
1834
+ date: C,
1835
+ adjustments: V[C]
1836
1836
  }));
1837
1837
  }
1838
1838
  async function A() {
1839
1839
  let _ = await s.readStockAdjustment(
1840
- h.sku._id,
1841
- st(new Date(g.value.startDate)).toISOString(),
1842
- at(new Date(g.value.endDate)).toISOString()
1840
+ g.sku._id,
1841
+ st(new Date(k.value.startDate)).toISOString(),
1842
+ at(new Date(k.value.endDate)).toISOString()
1843
1843
  );
1844
1844
  o.value = _;
1845
- const r = _.filter(({ ref: M }) => M == null ? void 0 : M.startsWith("bill_")).map(({ ref: M }) => M);
1846
- await I(r), t.value = C(_, "day").map(({ date: M, adjustments: V }) => ({
1847
- date: M,
1848
- adjustments: V,
1849
- adjustmentsByTime: C(V, "minute")
1845
+ const i = _.filter(({ ref: V }) => V == null ? void 0 : V.startsWith("bill_")).map(({ ref: V }) => V);
1846
+ await I(i), t.value = D(_, "day").map(({ date: V, adjustments: C }) => ({
1847
+ date: V,
1848
+ adjustments: C,
1849
+ adjustmentsByTime: D(C, "minute")
1850
1850
  }));
1851
1851
  try {
1852
- const M = await s.readUnitCostHistory(
1853
- h.sku._id,
1854
- st(new Date(g.value.startDate)).toISOString(),
1855
- at(new Date(g.value.endDate)).toISOString()
1852
+ const V = await s.readUnitCostHistory(
1853
+ g.sku._id,
1854
+ st(new Date(k.value.startDate)).toISOString(),
1855
+ at(new Date(k.value.endDate)).toISOString()
1856
1856
  );
1857
- T.value = M;
1858
- const V = /* @__PURE__ */ new Set();
1859
- M.forEach((F) => {
1860
- V.add(F.mechanism);
1857
+ T.value = V;
1858
+ const C = /* @__PURE__ */ new Set();
1859
+ V.forEach((F) => {
1860
+ C.add(F.mechanism);
1861
1861
  });
1862
1862
  const u = [{ label: "Default", value: "adjustment" }];
1863
- V.has(he.Enum.weightedAverage) && u.push({
1863
+ C.has(he.Enum.weightedAverage) && u.push({
1864
1864
  label: "Weighted Average (Beta)",
1865
1865
  value: he.Enum.weightedAverage
1866
- }), V.has(he.Enum.netsuite) && u.push({ label: "NetSuite (Beta)", value: he.Enum.netsuite }), V.has(he.Enum["netsuite-average"]) && u.push({
1866
+ }), C.has(he.Enum.netsuite) && u.push({ label: "NetSuite (Beta)", value: he.Enum.netsuite }), C.has(he.Enum["netsuite-average"]) && u.push({
1867
1867
  label: "NetSuite Average (Beta)",
1868
1868
  value: he.Enum["netsuite-average"]
1869
- }), f.value = u, !V.has(i.value) && i.value !== "adjustment" && (i.value = "adjustment");
1870
- } catch (M) {
1871
- console.error("Failed to fetch unit cost history:", M);
1869
+ }), v.value = u, !C.has(r.value) && r.value !== "adjustment" && (r.value = "adjustment");
1870
+ } catch (V) {
1871
+ console.error("Failed to fetch unit cost history:", V);
1872
1872
  }
1873
1873
  }
1874
1874
  async function I(_) {
1875
- _.length && (n.value = await j.findBillsById(_).catch((r) => {
1875
+ _.length && (n.value = await M.findBillsById(_).catch((i) => {
1876
1876
  var u;
1877
- console.error("Error on using latest bill API, retrying using legacy api", r);
1878
- const M = ((u = m.currentBusiness.value) == null ? void 0 : u._id) ?? "", V = w.currentLocation.doc._id;
1879
- return j.findBillsByBusinessId(M, [V], _);
1877
+ console.error("Error on using latest bill API, retrying using legacy api", i);
1878
+ const V = ((u = m.currentBusiness.value) == null ? void 0 : u._id) ?? "", C = w.currentLocation.doc._id;
1879
+ return M.findBillsByBusinessId(V, [C], _);
1880
1880
  }));
1881
1881
  }
1882
1882
  const R = Y(() => {
1883
- const _ = o.value, r = h.sku;
1884
- return bo(_, r);
1883
+ const _ = o.value, i = g.sku;
1884
+ return bo(_, i);
1885
1885
  }), K = Y(() => {
1886
- const _ = o.value, r = h.sku;
1887
- return xo(_, r);
1886
+ const _ = o.value, i = g.sku;
1887
+ return xo(_, i);
1888
1888
  }), O = Y(() => {
1889
- const _ = [...o.value].computeFirst((M) => {
1889
+ const _ = [...o.value].computeFirst((V) => {
1890
1890
  var u, F;
1891
- const V = (F = (u = M.skus) == null ? void 0 : u.find) == null ? void 0 : F.call(u, (N) => N.sku._id === h.sku._id);
1892
- return V == null ? void 0 : V.fromBalance;
1891
+ const C = (F = (u = V.skus) == null ? void 0 : u.find) == null ? void 0 : F.call(u, (N) => N.sku._id === g.sku._id);
1892
+ return C == null ? void 0 : C.fromBalance;
1893
1893
  }) ?? {
1894
1894
  amount: 0,
1895
1895
  precision: 0
1896
- }, r = h.sku;
1897
- return r ? `${Q.toFormatString({
1896
+ }, i = g.sku;
1897
+ return i ? `${Q.toFormatString({
1898
1898
  value: _,
1899
1899
  precision: 4
1900
- })} ${r.unit.abbrev}` : "";
1900
+ })} ${i.unit.abbrev}` : "";
1901
1901
  }), Z = Y(() => {
1902
- const _ = [...o.value].reverse().computeFirst((M) => {
1902
+ const _ = [...o.value].reverse().computeFirst((V) => {
1903
1903
  var u, F;
1904
- const V = (F = (u = M.skus) == null ? void 0 : u.find) == null ? void 0 : F.call(u, (N) => N.sku._id === h.sku._id);
1905
- return V == null ? void 0 : V.toBalance;
1904
+ const C = (F = (u = V.skus) == null ? void 0 : u.find) == null ? void 0 : F.call(u, (N) => N.sku._id === g.sku._id);
1905
+ return C == null ? void 0 : C.toBalance;
1906
1906
  }) ?? {
1907
1907
  amount: 0,
1908
1908
  precision: 0
1909
- }, r = h.sku;
1910
- return r ? `${Q.toFormatString({ value: _, precision: 4 })} ${r.unit.abbrev}` : "";
1909
+ }, i = g.sku;
1910
+ return i ? `${Q.toFormatString({ value: _, precision: 4 })} ${i.unit.abbrev}` : "";
1911
1911
  }), q = Y(() => {
1912
- var M;
1913
- const r = o.value.flatMap((V) => {
1912
+ var V;
1913
+ const i = o.value.flatMap((C) => {
1914
1914
  var u;
1915
- return ((u = V.skus) == null ? void 0 : u.flatMap((F) => F.amounts)) ?? [];
1916
- }).filter((V) => V.amount.amount < 0).reduce(
1917
- (V, u) => {
1915
+ return ((u = C.skus) == null ? void 0 : u.flatMap((F) => F.amounts)) ?? [];
1916
+ }).filter((C) => C.amount.amount < 0).reduce(
1917
+ (C, u) => {
1918
1918
  const F = u.cost;
1919
- if (!F) return V;
1919
+ if (!F) return C;
1920
1920
  const N = {
1921
- ...Mt(V, Math.max(V.precision, F.precision)),
1921
+ ...Tt(C, Math.max(C.precision, F.precision)),
1922
1922
  currency: F.currency
1923
1923
  };
1924
1924
  return {
1925
1925
  ...Je(N, F),
1926
- currency: V.currency
1926
+ currency: C.currency
1927
1927
  };
1928
1928
  },
1929
1929
  {
1930
1930
  amount: 0,
1931
1931
  precision: 0,
1932
- currency: De((M = m.currentCountry) == null ? void 0 : M.value)
1932
+ currency: De((V = m.currentCountry) == null ? void 0 : V.value)
1933
1933
  }
1934
1934
  );
1935
- return Me(r, !1, r.precision);
1935
+ return Me(i, !1, i.precision);
1936
1936
  });
1937
1937
  function ue() {
1938
- const { startDate: _, endDate: r } = zt(g.value);
1939
- _ !== null && r !== null && (g.value = {
1938
+ const { startDate: _, endDate: i } = zt(k.value);
1939
+ _ !== null && i !== null && (k.value = {
1940
1940
  startDate: _,
1941
- endDate: r
1941
+ endDate: i
1942
1942
  });
1943
1943
  }
1944
1944
  const ee = Y(() => l("inventory.ingredient.valuationMethod.WAVG"));
1945
- function v(_, r) {
1946
- if (i.value === "adjustment")
1945
+ function f(_, i) {
1946
+ if (r.value === "adjustment")
1947
1947
  return null;
1948
- const M = T.value.filter(
1949
- (F) => F.mechanism === i.value && F.skuId === h.sku._id
1948
+ const V = T.value.filter(
1949
+ (F) => F.mechanism === r.value && F.skuId === g.sku._id
1950
1950
  );
1951
- if (M.length === 0) return null;
1952
- const V = M.find((F) => {
1951
+ if (V.length === 0) return null;
1952
+ const C = V.find((F) => {
1953
1953
  const N = F.meta;
1954
1954
  return (N == null ? void 0 : N.adjustmentId) === _;
1955
1955
  });
1956
- if (V) return V.cost;
1957
- const u = [...M].filter((F) => new Date(F.snapshotAt) <= new Date(r)).sort((F, N) => new Date(N.snapshotAt).getTime() - new Date(F.snapshotAt).getTime());
1956
+ if (C) return C.cost;
1957
+ const u = [...V].filter((F) => new Date(F.snapshotAt) <= new Date(i)).sort((F, N) => new Date(N.snapshotAt).getTime() - new Date(F.snapshotAt).getTime());
1958
1958
  return u.length > 0 ? u[0].cost : null;
1959
1959
  }
1960
1960
  const $ = Y(() => {
1961
- var V, u, F, N, ne, re;
1961
+ var C, u, F, N, ne, re;
1962
1962
  const _ = [...o.value].reverse().find((J) => {
1963
1963
  var te, oe;
1964
- return (oe = (te = J.skus) == null ? void 0 : te.find) == null ? void 0 : oe.call(te, (ie) => ie.sku._id === h.sku._id);
1964
+ return (oe = (te = J.skus) == null ? void 0 : te.find) == null ? void 0 : oe.call(te, (ie) => ie.sku._id === g.sku._id);
1965
1965
  });
1966
1966
  if (!_) return "No data";
1967
- const r = (V = _.skus) == null ? void 0 : V.find((J) => J.sku._id === h.sku._id);
1968
- if (!r) return "No data";
1969
- const M = r.toBalance;
1970
- if (i.value === "adjustment") {
1971
- const J = [...r.amounts].reverse()[0], te = {
1967
+ const i = (C = _.skus) == null ? void 0 : C.find((J) => J.sku._id === g.sku._id);
1968
+ if (!i) return "No data";
1969
+ const V = i.toBalance;
1970
+ if (r.value === "adjustment") {
1971
+ const J = [...i.amounts].reverse()[0], te = {
1972
1972
  amount: ((u = J.cost) == null ? void 0 : u.amount) ?? 0,
1973
1973
  precision: ((F = J.cost) == null ? void 0 : F.precision) ?? 0
1974
1974
  }, oe = J.amount, ie = oe.amount == 0 ? Q.fromNumber(0) : Q.divide([te, oe]);
1975
1975
  return {
1976
- ...Q.multiply([ie, M]),
1976
+ ...Q.multiply([ie, V]),
1977
1977
  currency: ((N = J.cost) == null ? void 0 : N.currency) || De(((ne = m.currentCountry) == null ? void 0 : ne.value) ?? et)
1978
1978
  };
1979
1979
  } else {
1980
- const J = _.effectiveAt ?? Te(_._id), te = v(
1980
+ const J = _.effectiveAt ?? He(_._id), te = f(
1981
1981
  _._id,
1982
1982
  J ?? (/* @__PURE__ */ new Date()).toISOString()
1983
1983
  );
1984
1984
  if (!te) return "No data";
1985
1985
  const oe = Q.fromDinero(te);
1986
1986
  return {
1987
- ...Q.multiply([oe, M]),
1987
+ ...Q.multiply([oe, V]),
1988
1988
  currency: te.currency || De(((re = m.currentCountry) == null ? void 0 : re.value) ?? et)
1989
1989
  };
1990
1990
  }
1991
1991
  }), G = Y(() => {
1992
- var M;
1993
- const _ = [...o.value].reverse().computeFirst((V) => {
1992
+ var V;
1993
+ const _ = [...o.value].reverse().computeFirst((C) => {
1994
1994
  var F, N;
1995
- const u = (N = (F = V.skus) == null ? void 0 : F.find) == null ? void 0 : N.call(F, (ne) => ne.sku._id === h.sku._id);
1995
+ const u = (N = (F = C.skus) == null ? void 0 : F.find) == null ? void 0 : N.call(F, (ne) => ne.sku._id === g.sku._id);
1996
1996
  return u == null ? void 0 : u.toCostBalances;
1997
1997
  });
1998
1998
  return _ ? {
1999
- ..._.reduce((V, u) => Q.add([V, Q.fromDinero(u.cost)]), {
1999
+ ..._.reduce((C, u) => Q.add([C, Q.fromDinero(u.cost)]), {
2000
2000
  amount: 0,
2001
2001
  precision: 0
2002
2002
  }),
2003
- currency: De((M = m.currentCountry) == null ? void 0 : M.value)
2003
+ currency: De((V = m.currentCountry) == null ? void 0 : V.value)
2004
2004
  } : "No data";
2005
- }), P = Y(() => h.sku.valuation === tt.Enum.FIFO ? G.value : $.value);
2005
+ }), P = Y(() => g.sku.valuation === tt.Enum.FIFO ? G.value : $.value);
2006
2006
  function L() {
2007
- const { startDate: _, endDate: r } = Gt(g.value);
2008
- _ !== null && r !== null && (g.value = {
2007
+ const { startDate: _, endDate: i } = Gt(k.value);
2008
+ _ !== null && i !== null && (k.value = {
2009
2009
  startDate: _,
2010
- endDate: r
2010
+ endDate: i
2011
2011
  });
2012
2012
  }
2013
- const E = Ye(h, "show");
2014
- return (_, r) => {
2015
- const M = U("FmButton"), V = U("FmField"), u = U("FmDateRangePicker"), F = U("FmSpacer"), N = U("FmCircularProgress"), ne = U("FmIcon"), re = U("FmTooltip"), J = U("FmMenuDivider"), te = U("FmChip"), oe = U("FmSelect"), ie = U("FmCardSection"), Fe = U("FmCard"), gt = U("FmSideSheet");
2016
- return D(), X(gt, {
2013
+ const E = Ye(g, "show");
2014
+ return (_, i) => {
2015
+ const V = H("FmButton"), C = H("FmField"), u = H("FmDateRangePicker"), F = H("FmSpacer"), N = H("FmCircularProgress"), ne = H("FmIcon"), re = H("FmTooltip"), J = H("FmMenuDivider"), te = H("FmChip"), oe = H("FmSelect"), ie = H("FmCardSection"), Fe = H("FmCard"), gt = H("FmSideSheet");
2016
+ return j(), X(gt, {
2017
2017
  "dismiss-away": "",
2018
2018
  modelValue: a(E),
2019
- "onUpdate:modelValue": r[5] || (r[5] = (Ae) => Ee(E) ? E.value = Ae : null),
2019
+ "onUpdate:modelValue": i[5] || (i[5] = (Ae) => Ee(E) ? E.value = Ae : null),
2020
2020
  "close-button": !1,
2021
2021
  "max-width": 560
2022
2022
  }, {
2023
- "side-sheet-header": H(() => [
2023
+ "side-sheet-header": U(() => [
2024
2024
  e("div", So, [
2025
2025
  e("div", wo, p(a(l)("inventory.stock.history.title", [_.sku.name])), 1),
2026
- y(M, {
2026
+ y(V, {
2027
2027
  variant: "tertiary",
2028
2028
  "prepend-icon": "close",
2029
- onClick: r[0] || (r[0] = (Ae) => E.value = !1)
2029
+ onClick: i[0] || (i[0] = (Ae) => E.value = !1)
2030
2030
  })
2031
2031
  ])
2032
2032
  ]),
2033
- default: H(() => {
2033
+ default: U(() => {
2034
2034
  var Ae;
2035
2035
  return [
2036
2036
  e("div", Fo, [
2037
2037
  e("div", Ao, [
2038
2038
  e("div", $o, [
2039
2039
  y(u, {
2040
- modelValue: g.value,
2041
- "onUpdate:modelValue": r[1] || (r[1] = (de) => g.value = de),
2040
+ modelValue: k.value,
2041
+ "onUpdate:modelValue": i[1] || (i[1] = (de) => k.value = de),
2042
2042
  "show-predefined-range": "",
2043
2043
  "start-label": "",
2044
2044
  "end-label": "",
2045
2045
  "z-index": 50
2046
2046
  }, {
2047
- "trigger-button": H(({ opened: de }) => [
2048
- y(V, {
2047
+ "trigger-button": U(({ opened: de }) => [
2048
+ y(C, {
2049
2049
  "prepend-icon": "calendar_month",
2050
2050
  focused: de
2051
2051
  }, {
2052
- default: H(() => [
2053
- ve(p(g.value.startDate) + " - " + p(g.value.endDate), 1)
2052
+ default: U(() => [
2053
+ pe(p(k.value.startDate) + " - " + p(k.value.endDate), 1)
2054
2054
  ]),
2055
2055
  _: 2
2056
2056
  }, 1032, ["focused"])
@@ -2058,47 +2058,47 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
2058
2058
  _: 1
2059
2059
  }, 8, ["modelValue"])
2060
2060
  ]),
2061
- y(M, {
2061
+ y(V, {
2062
2062
  variant: "tertiary",
2063
- onClick: r[2] || (r[2] = (de) => ue()),
2063
+ onClick: i[2] || (i[2] = (de) => ue()),
2064
2064
  "prepend-icon": "navigate_before"
2065
2065
  }),
2066
- y(M, {
2066
+ y(V, {
2067
2067
  variant: "tertiary",
2068
- onClick: r[3] || (r[3] = (de) => L()),
2068
+ onClick: i[3] || (i[3] = (de) => L()),
2069
2069
  "prepend-icon": "navigate_next"
2070
2070
  })
2071
2071
  ]),
2072
- B.value ? (D(), W("div", Vo, [
2072
+ B.value ? (j(), W("div", Vo, [
2073
2073
  y(F),
2074
2074
  y(N, { size: "xl" }),
2075
2075
  e("div", Co, p(a(l)("inventory.stock.history.loading")), 1),
2076
2076
  y(F),
2077
2077
  y(F)
2078
- ])) : t.value && ((Ae = t.value) == null ? void 0 : Ae.length) > 0 ? (D(), W("div", Do, [
2078
+ ])) : t.value && ((Ae = t.value) == null ? void 0 : Ae.length) > 0 ? (j(), W("div", Do, [
2079
2079
  y(Fe, { variant: "outlined" }, {
2080
- default: H(() => [
2080
+ default: U(() => [
2081
2081
  y(ie, { class: "flex flex-col gap-4" }, {
2082
- default: H(() => [
2082
+ default: U(() => [
2083
2083
  e("div", jo, [
2084
2084
  e("div", Mo, p(a(l)("inventory.stock.history.summary.title")), 1)
2085
2085
  ]),
2086
2086
  e("div", Bo, [
2087
2087
  e("div", Io, [
2088
2088
  e("div", To, p(a(l)("inventory.stock.history.summary.totalPurchase")), 1),
2089
- e("div", Uo, p(R.value.PURCHASE), 1)
2089
+ e("div", Ho, p(R.value.PURCHASE), 1)
2090
2090
  ]),
2091
- e("div", Ho, [
2091
+ e("div", Uo, [
2092
2092
  e("div", Eo, [
2093
- ve(p(a(l)("inventory.stock.history.summary.totalSales")) + "  ", 1),
2094
- K.value != null ? (D(), X(re, {
2093
+ pe(p(a(l)("inventory.stock.history.summary.totalSales")) + "  ", 1),
2094
+ K.value != null ? (j(), X(re, {
2095
2095
  key: 0,
2096
2096
  variant: "plain",
2097
2097
  placement: "top",
2098
2098
  content: `Before: ${K.value}`,
2099
2099
  "z-index": 50
2100
2100
  }, {
2101
- default: H(() => [
2101
+ default: U(() => [
2102
2102
  y(ne, {
2103
2103
  name: "warning",
2104
2104
  size: "sm"
@@ -2138,21 +2138,21 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
2138
2138
  e("div", ls, p(Z.value), 1)
2139
2139
  ])
2140
2140
  ]),
2141
- a(c).enableTotalCost ? (D(), W("div", rs, [
2141
+ a(c).enableTotalCost ? (j(), W("div", rs, [
2142
2142
  y(J, { class: "w-full" }),
2143
2143
  e("div", is, [
2144
2144
  e("div", us, [
2145
2145
  y(ot, { "z-index": 50 }, {
2146
- default: H(() => [
2146
+ default: U(() => [
2147
2147
  e("div", cs, [
2148
- ve(p(a(l)("inventory.stock.history.estimatedValue")) + " ", 1),
2148
+ pe(p(a(l)("inventory.stock.history.estimatedValue")) + " ", 1),
2149
2149
  y(re, {
2150
2150
  variant: "plain",
2151
2151
  placement: "top",
2152
2152
  content: `[${ee.value}] ${a(l)("inventory.stock.history.estimatedValueTooltip")}`,
2153
2153
  "z-index": 50
2154
2154
  }, {
2155
- default: H(() => [
2155
+ default: U(() => [
2156
2156
  y(ne, {
2157
2157
  name: "help",
2158
2158
  size: "sm"
@@ -2165,18 +2165,18 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
2165
2165
  _: 1
2166
2166
  }),
2167
2167
  e("div", ds, [
2168
- _.sku.valuation === a(tt).Enum.FIFO ? (D(), W(le, { key: 0 }, [
2168
+ _.sku.valuation === a(tt).Enum.FIFO ? (j(), W(le, { key: 0 }, [
2169
2169
  y(te, {
2170
2170
  label: "FIFO",
2171
2171
  compact: ""
2172
2172
  }),
2173
- ve(" " + p(typeof P.value != "string" ? a(Me)(
2173
+ pe(" " + p(typeof P.value != "string" ? a(Me)(
2174
2174
  P.value,
2175
2175
  !1,
2176
2176
  P.value.precision
2177
2177
  ) : P.value), 1)
2178
- ], 64)) : (D(), W(le, { key: 1 }, [
2179
- ve(p(typeof P.value != "string" ? a(Me)(
2178
+ ], 64)) : (j(), W(le, { key: 1 }, [
2179
+ pe(p(typeof P.value != "string" ? a(Me)(
2180
2180
  P.value,
2181
2181
  !1,
2182
2182
  P.value.precision
@@ -2184,9 +2184,9 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
2184
2184
  ], 64))
2185
2185
  ]),
2186
2186
  y(oe, {
2187
- modelValue: i.value,
2188
- "onUpdate:modelValue": r[4] || (r[4] = (de) => i.value = de),
2189
- items: f.value,
2187
+ modelValue: r.value,
2188
+ "onUpdate:modelValue": i[4] || (i[4] = (de) => r.value = de),
2189
+ items: v.value,
2190
2190
  compact: "",
2191
2191
  size: "sm",
2192
2192
  style: { width: "200px" }
@@ -2194,18 +2194,18 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
2194
2194
  ]),
2195
2195
  e("div", ms, [
2196
2196
  y(ot, { "z-index": 50 }, {
2197
- default: H(() => [
2197
+ default: U(() => [
2198
2198
  e("div", fs, [
2199
- ve(p(a(l)("inventory.stock.history.costSold")) + " ", 1),
2199
+ pe(p(a(l)("inventory.stock.history.costSold")) + " ", 1),
2200
2200
  y(re, {
2201
2201
  variant: "plain",
2202
2202
  placement: "top",
2203
2203
  "z-index": 50
2204
2204
  }, {
2205
- content: H(() => [
2206
- e("div", vs, p(a(l)("inventory.stock.history.costSoldTooltip")), 1)
2205
+ content: U(() => [
2206
+ e("div", ps, p(a(l)("inventory.stock.history.costSoldTooltip")), 1)
2207
2207
  ]),
2208
- default: H(() => [
2208
+ default: U(() => [
2209
2209
  y(ne, {
2210
2210
  name: "help",
2211
2211
  size: "sm"
@@ -2217,7 +2217,7 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
2217
2217
  ]),
2218
2218
  _: 1
2219
2219
  }),
2220
- e("div", ps, p(q.value), 1)
2220
+ e("div", vs, p(q.value), 1)
2221
2221
  ])
2222
2222
  ])
2223
2223
  ])) : se("", !0)
@@ -2227,21 +2227,21 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
2227
2227
  ]),
2228
2228
  _: 1
2229
2229
  }),
2230
- r[6] || (r[6] = e("div", null, null, -1)),
2231
- (D(!0), W(le, null, ce(t.value, (de) => (D(), W(le, {
2230
+ i[6] || (i[6] = e("div", null, null, -1)),
2231
+ (j(!0), W(le, null, ce(t.value, (de) => (j(), W(le, {
2232
2232
  key: de.date
2233
2233
  }, [
2234
- _.sku ? (D(), X(go, {
2234
+ _.sku ? (j(), X(go, {
2235
2235
  key: 0,
2236
2236
  record: de,
2237
2237
  sku: _.sku,
2238
2238
  bills: n.value,
2239
2239
  "unit-cost-history": T.value,
2240
- "cost-mechanism": i.value,
2240
+ "cost-mechanism": r.value,
2241
2241
  onRefreshHistory: x
2242
2242
  }, null, 8, ["record", "sku", "bills", "unit-cost-history", "cost-mechanism"])) : se("", !0)
2243
2243
  ], 64))), 128))
2244
- ])) : (D(), W("div", ys, [
2244
+ ])) : (j(), W("div", ys, [
2245
2245
  y(F),
2246
2246
  e("div", null, [
2247
2247
  e("img", {
@@ -2264,15 +2264,15 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
2264
2264
  }), bs = {
2265
2265
  key: 0,
2266
2266
  class: "flex items-center gap-1"
2267
- }, xs = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ss = { class: "flex flex-col gap-8" }, ws = { class: "flex flex-col" }, Fs = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, As = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary line-clamp-1" }, Qs = /* @__PURE__ */ me({
2267
+ }, xs = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ss = { class: "flex flex-col gap-8" }, ws = { class: "flex flex-col" }, Fs = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, As = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary line-clamp-1" }, Js = /* @__PURE__ */ me({
2268
2268
  __name: "StockView",
2269
- setup(k) {
2270
- const { t: m } = fe(), d = Re(), s = xe(), j = Oe(), w = kt(), c = we(), l = mt(), h = Zt(), { columnDefs: B } = un(), b = Ne(), i = Se();
2269
+ setup(h) {
2270
+ const { t: m } = fe(), d = Re(), s = xe(), M = Oe(), w = kt(), c = we(), l = mt(), g = Zt(), { columnDefs: B } = un(), b = Ne(), r = Se();
2271
2271
  s.watchLocation(x);
2272
- const f = Y(
2273
- () => new Set(h.getAvailableItems(h.businessSubsidiaryId))
2272
+ const v = Y(
2273
+ () => new Set(g.getAvailableItems(g.businessSubsidiaryId))
2274
2274
  ), T = z(!1);
2275
- async function g() {
2275
+ async function k() {
2276
2276
  b.open({
2277
2277
  title: m("inventory.stock.stock_balance.refreshBalance"),
2278
2278
  message: m("inventory.stock.stock_balance.refreshBalanceDescription"),
@@ -2287,7 +2287,7 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
2287
2287
  variant: "tertiary"
2288
2288
  }
2289
2289
  }).onPrimary(async () => {
2290
- await c.recalculation.refreshCurrentBalances(), i.open({
2290
+ await c.recalculation.refreshCurrentBalances(), r.open({
2291
2291
  title: "Refresh Stock Balance",
2292
2292
  message: "Stock balance refresh has been queued. This may take a moment to complete.",
2293
2293
  type: "success"
@@ -2298,9 +2298,9 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
2298
2298
  if (s._currentLocation) {
2299
2299
  T.value = !0;
2300
2300
  try {
2301
- await j.readStockBalance(), await j.readProductBalance(), await l.readStockEstimateBalance();
2301
+ await M.readStockBalance(), await M.readProductBalance(), await l.readStockEstimateBalance();
2302
2302
  } catch (ee) {
2303
- i.open({
2303
+ r.open({
2304
2304
  title: m("inventory.stock.error.title"),
2305
2305
  message: m("inventory.stock.error.message"),
2306
2306
  type: "error"
@@ -2329,35 +2329,36 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
2329
2329
  ]
2330
2330
  }), n = Y(() => {
2331
2331
  var $, G, P;
2332
- const ee = t.value ? en.build(t.value) : null, v = [];
2332
+ const ee = t.value ? en.build(t.value) : null, f = [];
2333
2333
  for (const L of d.skus) {
2334
2334
  let E = !0;
2335
- if (h.isEnabled && C.value && f.value && E && (E = f.value.has(L._id)), ee && E && (E = tn(
2335
+ if (g.isEnabled && D.value && v.value && E && (E = v.value.has(L._id)), ee && E && (E = tn(
2336
2336
  {
2337
2337
  status: L.isInactive ? "Inactive" : "Active"
2338
2338
  },
2339
2339
  ee
2340
2340
  )), E) {
2341
2341
  const _ = L.trackingMeasurement;
2342
- let r = (G = ($ = j.stockBalance.skus) == null ? void 0 : $.find(
2342
+ let i = (G = ($ = M.stockBalance.skus) == null ? void 0 : $.find(
2343
2343
  (u) => u.id === L._id
2344
- )) == null ? void 0 : G.balance, M = l.inventoryForecast.skus.find(
2344
+ )) == null ? void 0 : G.balance, V = l.inventoryForecast.skus.find(
2345
2345
  (u) => u.id === L._id
2346
2346
  );
2347
- const V = {
2347
+ const C = {
2348
2348
  ...L,
2349
- balance: r ?? {
2349
+ balance: i ?? {
2350
2350
  amount: 0,
2351
2351
  precision: 0
2352
2352
  },
2353
- day: (M == null ? void 0 : M.depletionDays) ?? void 0,
2353
+ operator: V == null ? void 0 : V.operator,
2354
+ day: (V == null ? void 0 : V.depletionDays) ?? void 0,
2354
2355
  trackingUnitAbbrev: _ ? ((P = L.unit.measurements.find((u) => u.id === _)) == null ? void 0 : P.abbrev) ?? "" : L.unit.abbrev
2355
2356
  };
2356
- v.push(V);
2357
+ f.push(C);
2357
2358
  }
2358
2359
  }
2359
- return v;
2360
- }), S = z(""), C = z(!0), { breakpoints: A } = Ut(), I = Y(() => A.value.xs || A.value.sm), R = Y(() => I.value ? 10 : 20), K = St(), O = Y(() => [
2360
+ return f;
2361
+ }), S = z(""), D = z(!0), { breakpoints: A } = Pt(), I = Y(() => A.value.xs || A.value.sm), R = Y(() => I.value ? 10 : 20), K = St(), O = Y(() => [
2361
2362
  {
2362
2363
  label: m("inventory.stock.stock_balance.refreshBalance"),
2363
2364
  value: "refresh-balance",
@@ -2384,7 +2385,7 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
2384
2385
  function ue(ee) {
2385
2386
  switch (ee) {
2386
2387
  case "refresh-balance":
2387
- return g();
2388
+ return k();
2388
2389
  case "refresh":
2389
2390
  return x();
2390
2391
  case "export":
@@ -2393,14 +2394,14 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
2393
2394
  return q();
2394
2395
  }
2395
2396
  }
2396
- return (ee, v) => {
2397
- const $ = U("FmSwitch"), G = U("FmTable");
2398
- return D(), X(wt, {
2397
+ return (ee, f) => {
2398
+ const $ = H("FmSwitch"), G = H("FmTable");
2399
+ return j(), X(wt, {
2399
2400
  title: a(m)("inventory.stock.title"),
2400
2401
  actions: O.value,
2401
2402
  "onClick:action": ue
2402
2403
  }, {
2403
- default: H(() => {
2404
+ default: U(() => {
2404
2405
  var P, L, E, _;
2405
2406
  return [
2406
2407
  e("div", {
@@ -2416,22 +2417,22 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
2416
2417
  searchable: "",
2417
2418
  "change-location": "",
2418
2419
  search: S.value,
2419
- "onUpdate:search": v[1] || (v[1] = (r) => S.value = r),
2420
+ "onUpdate:search": f[1] || (f[1] = (i) => S.value = i),
2420
2421
  "hide-filter-options": !0,
2421
2422
  filterable: "",
2422
2423
  "filter-attributes": o.value,
2423
2424
  filter: t.value,
2424
- "onUpdate:filter": v[2] || (v[2] = (r) => t.value = r)
2425
+ "onUpdate:filter": f[2] || (f[2] = (i) => t.value = i)
2425
2426
  }, {
2426
- default: H(() => [
2427
- a(h).isEnabled ? (D(), W("div", bs, [
2427
+ default: U(() => [
2428
+ a(g).isEnabled ? (j(), W("div", bs, [
2428
2429
  e("span", xs, p(a(m)("inventory.integration.netsuite.subsidiaryHierarchy.filtering")), 1),
2429
- y(It),
2430
+ y(Ut),
2430
2431
  y(Xe, null, {
2431
- default: H(() => [
2432
+ default: U(() => [
2432
2433
  y($, {
2433
- modelValue: C.value,
2434
- "onUpdate:modelValue": v[0] || (v[0] = (r) => C.value = r)
2434
+ modelValue: D.value,
2435
+ "onUpdate:modelValue": f[0] || (f[0] = (i) => D.value = i)
2435
2436
  }, null, 8, ["modelValue"])
2436
2437
  ]),
2437
2438
  _: 1
@@ -2440,51 +2441,51 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
2440
2441
  ]),
2441
2442
  _: 1
2442
2443
  }, 8, ["search", "filter-attributes", "filter"]),
2443
- (D(), X(G, {
2444
+ (j(), X(G, {
2444
2445
  style: ct(a(K).tableHeight),
2445
2446
  "column-defs": a(B),
2446
2447
  "row-data": n.value,
2447
2448
  "search-value": S.value,
2448
2449
  loading: T.value || !a(s)._currentLocation,
2449
2450
  key: (P = a(s)._currentLocation) == null ? void 0 : P.dbName,
2450
- onRowClick: v[3] || (v[3] = (r) => a(w).showSkuHistory(r.original)),
2451
+ onRowClick: f[3] || (f[3] = (i) => a(w).showSkuHistory(i.original)),
2451
2452
  "page-size": R.value
2452
2453
  }, {
2453
- "list-row": H((r) => [
2454
+ "list-row": U((i) => [
2454
2455
  y(Qt, {
2455
- row: r,
2456
+ row: i,
2456
2457
  onRowClick: a(w).showSkuHistory
2457
2458
  }, {
2458
- default: H((M) => {
2459
- var V, u, F, N, ne, re, J, te, oe, ie;
2459
+ default: U((V) => {
2460
+ var C, u, F, N, ne, re, J, te, oe, ie;
2460
2461
  return [
2461
2462
  e("div", Ss, [
2462
2463
  e("div", ws, [
2463
2464
  e("div", Fs, [
2464
2465
  y(a(lt), {
2465
- render: (F = (u = (V = M.code) == null ? void 0 : V.column) == null ? void 0 : u.columnDef) == null ? void 0 : F.cell,
2466
- props: (ne = (N = M.code) == null ? void 0 : N.getContext) == null ? void 0 : ne.call(N)
2466
+ render: (F = (u = (C = V.code) == null ? void 0 : C.column) == null ? void 0 : u.columnDef) == null ? void 0 : F.cell,
2467
+ props: (ne = (N = V.code) == null ? void 0 : N.getContext) == null ? void 0 : ne.call(N)
2467
2468
  }, null, 8, ["render", "props"])
2468
2469
  ]),
2469
2470
  e("div", As, [
2470
2471
  y(a(lt), {
2471
- render: (te = (J = (re = M.name) == null ? void 0 : re.column) == null ? void 0 : J.columnDef) == null ? void 0 : te.cell,
2472
- props: (ie = (oe = M.name) == null ? void 0 : oe.getContext) == null ? void 0 : ie.call(oe)
2472
+ render: (te = (J = (re = V.name) == null ? void 0 : re.column) == null ? void 0 : J.columnDef) == null ? void 0 : te.cell,
2473
+ props: (ie = (oe = V.name) == null ? void 0 : oe.getContext) == null ? void 0 : ie.call(oe)
2473
2474
  }, null, 8, ["render", "props"])
2474
2475
  ])
2475
2476
  ]),
2476
2477
  e("div", null, [
2477
2478
  y(Ke, {
2478
- days: r.original.day
2479
+ days: i.original.day
2479
2480
  }, null, 8, ["days"])
2480
2481
  ]),
2481
2482
  e("div", null, [
2482
2483
  y(_t, {
2483
2484
  class: "xs:w-[160px]",
2484
- unit: r.original.unit,
2485
- sku: r.original,
2486
- amount: r.original.balance,
2487
- "default-tracking-measurement": r.original.trackingMeasurement ?? void 0
2485
+ unit: i.original.unit,
2486
+ sku: i.original,
2487
+ amount: i.original.balance,
2488
+ "default-tracking-measurement": i.original.trackingMeasurement ?? void 0
2488
2489
  }, null, 8, ["unit", "sku", "amount", "default-tracking-measurement"])
2489
2490
  ])
2490
2491
  ])
@@ -2496,15 +2497,15 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
2496
2497
  _: 1
2497
2498
  }, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"]))
2498
2499
  ], 2),
2499
- (D(), X(xt, { to: "body" }, [
2500
- (L = a(w).stockHistoryProps) != null && L.sku ? (D(), X(gs, Le(ze({ key: 0 }, a(w).stockHistoryProps)), null, 16)) : se("", !0),
2501
- (E = a(w).convertSkuDialogProps) != null && E.sku ? (D(), X(wn, Le(ze({ key: 1 }, a(w).convertSkuDialogProps)), null, 16)) : se("", !0),
2502
- (_ = a(w).adjustSkuDialogProps) != null && _.stock ? (D(), X(Un, Le(ze({ key: 2 }, a(w).adjustSkuDialogProps)), null, 16)) : se("", !0),
2503
- Z.value ? (D(), X(qn, {
2500
+ (j(), X(xt, { to: "body" }, [
2501
+ (L = a(w).stockHistoryProps) != null && L.sku ? (j(), X(gs, Le(ze({ key: 0 }, a(w).stockHistoryProps)), null, 16)) : se("", !0),
2502
+ (E = a(w).convertSkuDialogProps) != null && E.sku ? (j(), X(wn, Le(ze({ key: 1 }, a(w).convertSkuDialogProps)), null, 16)) : se("", !0),
2503
+ (_ = a(w).adjustSkuDialogProps) != null && _.stock ? (j(), X(Hn, Le(ze({ key: 2 }, a(w).adjustSkuDialogProps)), null, 16)) : se("", !0),
2504
+ Z.value ? (j(), X(qn, {
2504
2505
  key: 3,
2505
2506
  show: Z.value,
2506
- "onUpdate:show": v[4] || (v[4] = (r) => Z.value = r),
2507
- onSubmitted: v[5] || (v[5] = (r) => x())
2507
+ "onUpdate:show": f[4] || (f[4] = (i) => Z.value = i),
2508
+ onSubmitted: f[5] || (f[5] = (i) => x())
2508
2509
  }, null, 8, ["show"])) : se("", !0)
2509
2510
  ]))
2510
2511
  ];
@@ -2515,5 +2516,5 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
2515
2516
  }
2516
2517
  });
2517
2518
  export {
2518
- Qs as default
2519
+ Js as default
2519
2520
  };