@feedmepos/mf-inventory-portal 1.5.9 → 1.5.11-dev.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. package/dist/{App-D_elK-3W.js → App-D4rysNfh.js} +4 -4
  2. package/dist/{ApprovalView-WdSQEpGQ.js → ApprovalView-DpYJmgiG.js} +7 -7
  3. package/dist/{BindingsDialog-CkqhKrrD.js → BindingsDialog-C7z0HH48.js} +2 -2
  4. package/dist/{BindingsPicker-HPjbSTJd.js → BindingsPicker-C5IKp9CT.js} +2 -2
  5. package/dist/{BindingsTable-BF4WTUsf.js → BindingsTable-BRDooCs4.js} +3 -3
  6. package/dist/{ClosingDraftView-CTEaBuhS.js → ClosingDraftView-CSCbfIFE.js} +159 -158
  7. package/dist/ClosingHistoryView-DCIJ5ONT.js +1114 -0
  8. package/dist/{ClosingTemplateView-DMtIj04r.js → ClosingTemplateView-D1n9_dFc.js} +14 -14
  9. package/dist/{DefaultView-v-32G42G.js → DefaultView-Llrh9ufI.js} +2 -2
  10. package/dist/{DeliveryOrderPrintPreview-DHD9kykc.js → DeliveryOrderPrintPreview-DSkU-sqv.js} +2 -2
  11. package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-FRe1RX5T.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-DL6AKT9H.js} +2 -2
  12. package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-KTtYD7qS.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-JHabBWJb.js} +2 -2
  13. package/dist/{FmMultiselectDialog-BTNJvhnt.js → FmMultiselectDialog-BWujDEnX.js} +2 -2
  14. package/dist/{FmMultiselectDialog-LmjSdrn3.js → FmMultiselectDialog-C0lCYHla.js} +1 -1
  15. package/dist/FmUnitInput.vue_vue_type_script_setup_true_lang-CjCNHugK.js +388 -0
  16. package/dist/{ImportView-DoHL35I-.js → ImportView-C6q4gB3S.js} +6 -6
  17. package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-D8JocFRD.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-Df7B8ZEG.js} +1 -1
  18. package/dist/{IngredientGroupView-CVhShbuq.js → IngredientGroupView-DO8OKEVU.js} +5 -5
  19. package/dist/{IngredientsView-XOTuP5ZI.js → IngredientsView-CD2YtXPJ.js} +15 -15
  20. package/dist/{IntegrationExplorerView-BsY4Ca2E.js → IntegrationExplorerView-CZCMnwZG.js} +352 -352
  21. package/dist/{IntegrationView-C_Y3_I_8.js → IntegrationView--3nVS_X6.js} +13 -13
  22. package/dist/{InventoryBindingForm-CHsrJSnp.js → InventoryBindingForm-FjFTiN7R.js} +1 -1
  23. package/dist/InventoryBindingForm.vue_vue_type_script_setup_true_lang-CcF5cko8.js +441 -0
  24. package/dist/{InventoryBindingSummary-C9UE6Zh2.js → InventoryBindingSummary-D90hAi96.js} +1 -1
  25. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DFj3HtnZ.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-1iDUXU2T.js} +1 -1
  26. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-oNk0zO9K.js → PremiumBadge.vue_vue_type_script_setup_true_lang-DTYnX8kn.js} +1 -1
  27. package/dist/{PublishView-DVk0ZUlG.js → PublishView-BtcGl7zM.js} +3 -3
  28. package/dist/{PurchaseOrderPrintPreview-poHk4RMP.js → PurchaseOrderPrintPreview-DvkMQv1w.js} +2 -2
  29. package/dist/{ReceiveRequestView-CaPoxKBs.js → ReceiveRequestView-DSfj36r3.js} +9631 -9552
  30. package/dist/{RecipeView-bbhd-mNL.js → RecipeView-DkDSr3LN.js} +1304 -1267
  31. package/dist/{SettingsView-DxiMiFpz.js → SettingsView-iRqUoEPg.js} +4 -4
  32. package/dist/{StockView-Dc4ICHq3.js → StockView-DxUXHYD_.js} +279 -278
  33. package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-Cn3NL6mQ.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-WJ0Fz21v.js} +1 -1
  34. package/dist/{SupplierView-6fETAO2h.js → SupplierView-BYQjWeU7.js} +12 -12
  35. package/dist/{SurchargeView-7ucdobpg.js → SurchargeView-CyhTe1B8.js} +6 -6
  36. package/dist/{SystemTrailDialog.vue_vue_type_script_setup_true_lang-C4EeNPwc.js → SystemTrailDialog.vue_vue_type_script_setup_true_lang-CBM8jJqP.js} +2 -2
  37. package/dist/{TemplatePublishDialog.vue_vue_type_script_setup_true_lang-D-PqQ3Mi.js → TemplatePublishDialog.vue_vue_type_script_setup_true_lang-DM9Cg0uk.js} +1 -1
  38. package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-D-nG9kcq.js → TransferDetails.vue_vue_type_script_setup_true_lang-D2MztVse.js} +20 -20
  39. package/dist/{TransferTemplateView-CDD_5s5s.js → TransferTemplateView-FNI6jVh0.js} +18 -18
  40. package/dist/{UnitCostHistoryView-BrYXJWz0.js → UnitCostHistoryView-sGxNtk0Y.js} +4 -4
  41. package/dist/UnitDisplayControl.vue_vue_type_script_setup_true_lang-Cn6q11Ts.js +160 -0
  42. package/dist/{UnitView-CMXUZZvZ.js → UnitView-P8jU14k8.js} +7 -7
  43. package/dist/{WarehouseView-CUgJ4YGF.js → WarehouseView-NILk42Zj.js} +5 -5
  44. package/dist/{WastageTemplateView-Di6ffpTU.js → WastageTemplateView-DNrKoK3S.js} +14 -14
  45. package/dist/{app-D3gm3Lsw.js → app-DIOXPCfI.js} +23 -11
  46. package/dist/app.d.ts +12 -0
  47. package/dist/app.js +1 -1
  48. package/dist/{closing-template-BiSW9398.js → closing-template-DAlwSsqC.js} +1 -1
  49. package/dist/{date2-DJotzNeB.js → date2-DBIy5hnh.js} +1 -1
  50. package/dist/{dayjs.min-DxOA6M7_.js → dayjs.min-B2EqUP7W.js} +1 -1
  51. package/dist/{decimal-BPZo97WQ.js → decimal-e6enR5yT.js} +2 -2
  52. package/dist/{defineDeepModel-BMU9Poed.js → defineDeepModel-CwqnmttS.js} +1 -1
  53. package/dist/{duplicate-template-4bkTBQu0.js → duplicate-template-DRtq-b-P.js} +1 -1
  54. package/dist/{feature-WVA_2Jx-.js → feature-BCSp38rL.js} +2 -2
  55. package/dist/{format-time-from-id-gcRrHjjv.js → format-time-from-id-CTWNRFSC.js} +1 -1
  56. package/dist/{format-unit-display-BXkR_Hu0.js → format-unit-display-BFP12VU7.js} +11 -11
  57. package/dist/{import-export.helper-5AEiNKim.js → import-export.helper-Dr7R0Zql.js} +6 -6
  58. package/dist/{index-DkCy3EG9.js → index-BhS1AhF-.js} +1 -1
  59. package/dist/{index-YVMa0U0j.js → index-C2MhE26a.js} +3 -3
  60. package/dist/{index-DU4iyU3D.js → index-Df-NlbKu.js} +1 -1
  61. package/dist/{inventory-core-dart.default-B7xHV5Y6.js → inventory-core-dart.default-CW9d8gJh.js} +1 -1
  62. package/dist/{lz-string-BtgOc0yQ.js → lz-string-BHfmMoLE.js} +1 -1
  63. package/dist/{netsuite-DmXOUJo-.js → netsuite-BSEnJOMn.js} +2 -2
  64. package/dist/{number-BfNWSAkN.js → number-B1buZ_S4.js} +3 -3
  65. package/dist/{predefined-templates-BKxLIZg6.js → predefined-templates-BIFClpKf.js} +1 -1
  66. package/dist/{purchase-order-template-7iNDStWd.js → purchase-order-template-BCt-pDW-.js} +1 -1
  67. package/dist/{recalculationUtils-BVuC0H2j.js → recalculationUtils-CASVCqt7.js} +1 -1
  68. package/dist/{rules-BK8yTx5p.js → rules-C60UHyIn.js} +2 -2
  69. package/dist/{stock-BSA86fOX.js → stock-CkWMLoi7.js} +1 -1
  70. package/dist/{supplier-DA3y7WoU.js → supplier-CiW6zfX_.js} +2 -2
  71. package/dist/{surcharge-BiYvWPv-.js → surcharge-B9FUKx0L.js} +1 -1
  72. package/dist/tsconfig.app.tsbuildinfo +1 -1
  73. package/dist/{uom-rules-BxHGqiP7.js → uom-rules-DXiQ0ZIA.js} +1 -1
  74. package/dist/{use-ingredient-select-dialog-CPiX95uf.js → use-ingredient-select-dialog-Bn8C8IG1.js} +2 -2
  75. package/dist/{use-inventory-binding-dialog-CxKLW2Xh.js → use-inventory-binding-dialog-DZQ1WG1S.js} +2 -2
  76. package/dist/{use-template-enabled-locations-CrwOCxDu.js → use-template-enabled-locations-B9YKq5YY.js} +2 -2
  77. package/dist/{use-transfer-locations-CNY1m-5P.js → use-transfer-locations-D0mDjUMQ.js} +2 -2
  78. package/dist/{useHrmPermission-YEdf2QFW.js → useHrmPermission-BTkOHa4h.js} +1 -1
  79. package/dist/{useNavigationMenu-Bz5AabkY.js → useNavigationMenu-CSfM_5Wy.js} +2 -2
  80. package/dist/{useSseClient-BWrz2czP.js → useSseClient-DwJXBOEF.js} +3 -3
  81. package/dist/views/receive-request/components/transfer-form/TransferFormProps.d.ts +2 -0
  82. package/dist/views/receive-request/components/transfer-form/composables/use-stock-balance-toggle.d.ts +3 -0
  83. package/dist/views/receive-request/components/transfer-form/composables/use-transfer-items.d.ts +4 -0
  84. package/dist/{vue-i18n-DyHvEzel.js → vue-i18n-BWe-vqm2.js} +287 -287
  85. package/dist/{xlsx-DQfBpM_Q.js → xlsx-BT7Z_gt_.js} +1 -1
  86. package/dist/{xlsx.util-XLH11fha.js → xlsx.util-Bm6lJRyh.js} +3 -3
  87. package/package.json +5 -5
  88. package/dist/ClosingHistoryView-DL9g4naX.js +0 -1108
  89. package/dist/FmUnitInput.vue_vue_type_script_setup_true_lang-CvUDKcli.js +0 -362
  90. package/dist/InventoryBindingForm.vue_vue_type_script_setup_true_lang-DMGMZ556.js +0 -404
  91. package/dist/UnitDisplayControl.vue_vue_type_script_setup_true_lang-Cj15fCG9.js +0 -137
  92. package/dist/export-BS0TrI3Q.js +0 -26
@@ -1,32 +1,32 @@
1
1
  import { defineComponent as ve, openBlock as V, createBlock as ne, withCtx as M, createElementVNode as e, toDisplayString as p, unref as s, ref as Y, h as be, computed as T, watch as Fe, resolveComponent as B, isRef as Pe, createVNode as _, createElementBlock as q, Fragment as ue, renderList as fe, createCommentVNode as se, normalizeClass as He, reactive as _t, mergeModels as nt, useModel as jt, onMounted as qe, createTextVNode as ye, normalizeStyle as kt, watchEffect as Vt, renderSlot as st, onUnmounted as Ct, Teleport as Dt, normalizeProps as at, mergeProps as ze } from "vue";
2
2
  import { u as Bt, _ as Mt } from "./SingleColumnLayout.vue_vue_type_script_setup_true_lang-DGlWE5I8.js";
3
- import { u as Se, c as Re, a as Ne, F as rt, t as It, D as ie, s as Ht, m as Tt, B as Et, w as oe, f as Ce, h as lt, d as it, J as ge, K as De } from "./app-D3gm3Lsw.js";
4
- import { u as Oe, a as Ut } from "./useSseClient-BWrz2czP.js";
3
+ import { u as Se, c as Re, a as Ne, F as rt, t as It, D as ie, s as Ht, m as Tt, B as Et, w as oe, f as Ce, h as lt, d as it, J as ge, K as De } from "./app-DIOXPCfI.js";
4
+ import { u as Oe, a as Ut } from "./useSseClient-DwJXBOEF.js";
5
5
  import { c as Pt } from "./component-kqxARxvM.js";
6
- import { _ as ht, o as Rt } from "./UnitDisplayControl.vue_vue_type_script_setup_true_lang-Cj15fCG9.js";
7
- import { _ as Ke, S as Ge, g as bt, a as Nt } from "./SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-Cn3NL6mQ.js";
6
+ import { _ as ht, o as Rt } from "./UnitDisplayControl.vue_vue_type_script_setup_true_lang-Cn6q11Ts.js";
7
+ import { _ as Ke, S as Ge, g as bt, a as Nt } from "./SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-WJ0Fz21v.js";
8
8
  import { _ as Ot } from "./PreviewBadge.vue_vue_type_script_setup_true_lang-CRZiQHjx.js";
9
9
  import { useI18n as pe, useCoreStore as Xe } from "@feedmepos/mf-common";
10
- import { u as gt, i as Te, _ as ut } from "./PremiumBadge.vue_vue_type_script_setup_true_lang-oNk0zO9K.js";
10
+ import { u as gt, i as Te, _ as ut } from "./PremiumBadge.vue_vue_type_script_setup_true_lang-DTYnX8kn.js";
11
11
  import { useSnackbar as we, useDialog as Le, useProxiedModel as Ye, useBreakpoints as Lt } from "@feedmepos/ui-library";
12
12
  import { defineStore as Yt } from "pinia";
13
13
  import { F as Je } from "./FmAdminBadge-DjnBAgyv.js";
14
- import { g as $e, a as he, e as zt, t as Ee, c as xe, f as Gt, h as ct, i as xt, j as Qe, d as Me, k as Wt } from "./number-BfNWSAkN.js";
15
- import { u as Ae } from "./stock-BSA86fOX.js";
16
- import { c as Ue, A as Kt, M as qt, R as Xt } from "./rules-BK8yTx5p.js";
17
- import { u as Jt } from "./use-inventory-binding-dialog-CxKLW2Xh.js";
18
- import { a as St } from "./FmMultiselectDialog-BTNJvhnt.js";
19
- import { d as ke } from "./dayjs.min-DxOA6M7_.js";
20
- import { _ as Qt } from "./NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DFj3HtnZ.js";
21
- import { g as Zt } from "./decimal-BPZo97WQ.js";
22
- import { a as eo, c as to, f as wt, t as dt, d as mt, p as oo, n as no, b as so } from "./date2-DJotzNeB.js";
23
- import { i as ao, _ as ro } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-KTtYD7qS.js";
14
+ import { g as $e, a as he, e as zt, t as Ee, c as xe, f as Gt, h as ct, i as xt, j as Qe, d as Me, k as Wt } from "./number-B1buZ_S4.js";
15
+ import { u as Ae } from "./stock-CkWMLoi7.js";
16
+ import { c as Ue, A as Kt, M as qt, R as Xt } from "./rules-C60UHyIn.js";
17
+ import { u as Jt } from "./use-inventory-binding-dialog-DZQ1WG1S.js";
18
+ import { a as St } from "./FmMultiselectDialog-BWujDEnX.js";
19
+ import { d as ke } from "./dayjs.min-B2EqUP7W.js";
20
+ import { _ as Qt } from "./NumberPrecisionInput.vue_vue_type_script_setup_true_lang-1iDUXU2T.js";
21
+ import { g as Zt } from "./decimal-e6enR5yT.js";
22
+ import { a as eo, c as to, f as wt, t as dt, d as mt, p as oo, n as no, b as so } from "./date2-DBIy5hnh.js";
23
+ import { i as ao, _ as ro } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-JHabBWJb.js";
24
24
  import { _ as lo } from "./empty-placeholder-B0QU467o.js";
25
- import { F as _e } from "./inventory-core-dart.default-B7xHV5Y6.js";
26
- import { u as io } from "./feature-WVA_2Jx-.js";
27
- import { u as At } from "./useHrmPermission-YEdf2QFW.js";
25
+ import { F as _e } from "./inventory-core-dart.default-CW9d8gJh.js";
26
+ import { u as io } from "./feature-BCSp38rL.js";
27
+ import { u as At } from "./useHrmPermission-BTkOHa4h.js";
28
28
  import { _ as uo, F as ft } from "./TableActionableRow.vue_vue_type_script_setup_true_lang-Ca_eYa8-.js";
29
- import { u as co } from "./netsuite-DmXOUJo-.js";
29
+ import { u as co } from "./netsuite-BSEnJOMn.js";
30
30
  import { P as mo, J as fo } from "./app-DiX-EfV6.js";
31
31
  var Ie = /* @__PURE__ */ ((A) => (A.History = "History", A.Convert = "Convert", A.Adjust = "Adjust", A))(Ie || {});
32
32
  const vo = [
@@ -67,14 +67,14 @@ const vo = [
67
67
  }));
68
68
  }
69
69
  }), Ft = Yt("stockActions", () => {
70
- const A = Y(!1), u = Se(), k = Oe(), y = gt(), S = we(), j = Le(), { t: d } = pe();
70
+ const A = Y(!1), u = Se(), k = Oe(), y = gt(), w = we(), j = Le(), { t: d } = pe();
71
71
  async function r() {
72
72
  if (u._currentLocation) {
73
73
  A.value = !0;
74
74
  try {
75
75
  await k.readStockBalance(), await k.readProductBalance(), await y.readStockEstimateBalance();
76
76
  } catch {
77
- S.open({
77
+ w.open({
78
78
  title: d("inventory.stock.error.title"),
79
79
  message: d("inventory.stock.error.message"),
80
80
  type: "error"
@@ -84,10 +84,10 @@ const vo = [
84
84
  }
85
85
  }
86
86
  }
87
- const b = Y();
88
- async function R(w) {
87
+ const g = Y();
88
+ async function R(b) {
89
89
  var $, E, N;
90
- if (!!!((E = ($ = w.convert) == null ? void 0 : $.inventoryBindings) != null && E.length)) {
90
+ if (!!!((E = ($ = b.convert) == null ? void 0 : $.inventoryBindings) != null && E.length)) {
91
91
  j.open({
92
92
  title: d("inventory.stock.error.convert.title"),
93
93
  message: d("inventory.stock.error.convert.message")
@@ -95,22 +95,22 @@ const vo = [
95
95
  return;
96
96
  }
97
97
  const n = {
98
- maxCount: ((N = k.productBalance.find(({ id: O }) => O === w._id)) == null ? void 0 : N.count) || 0,
99
- sku: w,
98
+ maxCount: ((N = k.productBalance.find(({ id: O }) => O === b._id)) == null ? void 0 : N.count) || 0,
99
+ sku: b,
100
100
  show: !0,
101
101
  "onUpdate:show"(O) {
102
- b.value.show = O;
102
+ g.value.show = O;
103
103
  },
104
104
  onSubmitted() {
105
105
  r();
106
106
  }
107
107
  };
108
- b.value = n;
108
+ g.value = n;
109
109
  }
110
110
  const C = Y();
111
- async function l(w) {
111
+ async function l(b) {
112
112
  const o = {
113
- stock: w,
113
+ stock: b,
114
114
  show: !0,
115
115
  "onUpdate:show"(t) {
116
116
  C.value.show = t;
@@ -122,9 +122,9 @@ const vo = [
122
122
  C.value = o;
123
123
  }
124
124
  const a = Y();
125
- async function D(w) {
125
+ async function D(b) {
126
126
  const o = {
127
- sku: w,
127
+ sku: b,
128
128
  show: !0,
129
129
  "onUpdate:show"(t) {
130
130
  a.value.show = t;
@@ -132,9 +132,9 @@ const vo = [
132
132
  };
133
133
  a.value = o;
134
134
  }
135
- function m(w, o) {
135
+ function m(b, o) {
136
136
  const t = Re(o);
137
- switch (w) {
137
+ switch (b) {
138
138
  case Ie.History:
139
139
  D(t);
140
140
  return;
@@ -151,7 +151,7 @@ const vo = [
151
151
  onActionMenu: m,
152
152
  stockHistoryProps: a,
153
153
  showSkuHistory: D,
154
- convertSkuDialogProps: b,
154
+ convertSkuDialogProps: g,
155
155
  adjustSkuDialogProps: C
156
156
  };
157
157
  });
@@ -176,13 +176,13 @@ function ko() {
176
176
  id: "UOM",
177
177
  header: () => y("inventory.stock.balance"),
178
178
  cell(d) {
179
- const r = d.row.original, b = {
179
+ const r = d.row.original, g = {
180
180
  unit: r.unit,
181
181
  sku: r,
182
182
  amount: r.balance,
183
183
  defaultTrackingMeasurement: r.trackingMeasurement ?? void 0
184
184
  };
185
- return be(ht, b);
185
+ return be(ht, g);
186
186
  },
187
187
  size: 180
188
188
  },
@@ -214,11 +214,11 @@ function ko() {
214
214
  sortUndefined: "last",
215
215
  cell(d) {
216
216
  var D, m;
217
- const r = d.row.original.day, b = d.row.original.operator, R = (D = d.row.original.thresholds) == null ? void 0 : D.low, C = (m = d.row.original.thresholds) == null ? void 0 : m.mid;
217
+ const r = d.row.original.day, g = d.row.original.operator, R = (D = d.row.original.thresholds) == null ? void 0 : D.low, C = (m = d.row.original.thresholds) == null ? void 0 : m.mid;
218
218
  if (typeof r != "number" || typeof R != "number" || typeof C != "number")
219
219
  return be(Ke, {
220
220
  days: r,
221
- operator: b
221
+ operator: g
222
222
  });
223
223
  const l = r <= R ? Ge.low : r <= C ? Ge.mid : Ge.high;
224
224
  return be(Ke, {
@@ -234,7 +234,7 @@ function ko() {
234
234
  var r;
235
235
  return Pt(
236
236
  ((r = A._currentLocation) == null ? void 0 : r.type) === "restaurant" ? vo : po,
237
- (b) => u.onActionMenu(b, d.row.original)
237
+ (g) => u.onActionMenu(g, d.row.original)
238
238
  );
239
239
  },
240
240
  enableSorting: !1,
@@ -293,10 +293,10 @@ const bo = { class: "flex items-center" }, go = { class: "fm-typo-en-title-md-80
293
293
  },
294
294
  emits: ["update:show", "submitted"],
295
295
  setup(A, { expose: u, emit: k }) {
296
- const y = A, S = k, j = Jt(), d = Ne(), r = Ae(), b = we(), { t: R } = pe(), C = Y(0), l = Y(null), a = T(() => d.skus), D = T(
296
+ const y = A, w = k, j = Jt(), d = Ne(), r = Ae(), g = we(), { t: R } = pe(), C = Y(0), l = Y(null), a = T(() => d.skus), D = T(
297
297
  () => {
298
- var g, F;
299
- return (((F = (g = y.sku) == null ? void 0 : g.convert) == null ? void 0 : F.inventoryBindings) ?? []).filter(
298
+ var x, F;
299
+ return (((F = (x = y.sku) == null ? void 0 : x.convert) == null ? void 0 : F.inventoryBindings) ?? []).filter(
300
300
  (G) => G.type === rt.enum.SKU
301
301
  );
302
302
  }
@@ -304,34 +304,34 @@ const bo = { class: "flex items-center" }, go = { class: "fm-typo-en-title-md-80
304
304
  get() {
305
305
  return !!l.value;
306
306
  },
307
- set(g) {
308
- g ? l.value = Re(D.value) : (l.value = null, C.value = Math.min(C.value, y.maxCount ?? 0));
307
+ set(x) {
308
+ x ? l.value = Re(D.value) : (l.value = null, C.value = Math.min(C.value, y.maxCount ?? 0));
309
309
  }
310
- }), w = Y(!1);
311
- Fe([() => y.show], ([g]) => {
312
- g && (C.value = 0);
310
+ }), b = Y(!1);
311
+ Fe([() => y.show], ([x]) => {
312
+ x && (C.value = 0);
313
313
  });
314
314
  function o() {
315
315
  L(y.sku, Ee(C.value), l.value);
316
316
  }
317
- function t(g) {
317
+ function t(x) {
318
318
  if (l.value)
319
319
  return !0;
320
- const F = vt(g).isInteger().max(y.maxCount ?? 0).error ?? "";
320
+ const F = vt(x).isInteger().max(y.maxCount ?? 0).error ?? "";
321
321
  return F || !0;
322
322
  }
323
- function n(g) {
323
+ function n(x) {
324
324
  var I;
325
325
  const F = (I = y.sku.convert) != null && I.measurement ? y.sku.unit.measurements.find((c) => {
326
326
  var h;
327
327
  return c.id === ((h = y.sku.convert) == null ? void 0 : h.measurement);
328
- }) ?? null : null, G = $e(y.sku.unit, F), H = Gt(+g);
328
+ }) ?? null : null, G = $e(y.sku.unit, F), H = Gt(+x);
329
329
  return vt(H).isInteger().max(G).error ? "Precision cannot be more than " + G : !0;
330
330
  }
331
331
  const $ = T(
332
332
  () => {
333
- var g, F;
334
- return (g = y.sku.convert) != null && g.measurement ? (F = y.sku.unit.measurements.find((G) => {
333
+ var x, F;
334
+ return (x = y.sku.convert) != null && x.measurement ? (F = y.sku.unit.measurements.find((G) => {
335
335
  var H;
336
336
  return G.id === ((H = y.sku.convert) == null ? void 0 : H.measurement);
337
337
  })) == null ? void 0 : F.abbrev : y.sku.unit.abbrev;
@@ -355,7 +355,7 @@ const bo = { class: "flex items-center" }, go = { class: "fm-typo-en-title-md-80
355
355
  Ee(+C.value, v)
356
356
  ),
357
357
  !1
358
- ) : "0", x = (te = (W = l.value) == null ? void 0 : W.find((le) => le.id === (c == null ? void 0 : c._id))) == null ? void 0 : te.amount, P = x ? he(x, !1) : null;
358
+ ) : "0", S = (te = (W = l.value) == null ? void 0 : W.find((le) => le.id === (c == null ? void 0 : c._id))) == null ? void 0 : te.amount, P = S ? he(S, !1) : null;
359
359
  return {
360
360
  sku: c,
361
361
  convertAmount: P ?? i,
@@ -365,26 +365,26 @@ const bo = { class: "flex items-center" }, go = { class: "fm-typo-en-title-md-80
365
365
  }), N = Y();
366
366
  u({
367
367
  validateInputs: () => {
368
- var g, F;
369
- (F = (g = N.value) == null ? void 0 : g.validateInputs) == null || F.call(g);
368
+ var x, F;
369
+ (F = (x = N.value) == null ? void 0 : x.validateInputs) == null || F.call(x);
370
370
  },
371
371
  resetInputsValidation: () => {
372
- var g, F;
373
- (F = (g = N.value) == null ? void 0 : g.resetInputsValidation) == null || F.call(g);
372
+ var x, F;
373
+ (F = (x = N.value) == null ? void 0 : x.resetInputsValidation) == null || F.call(x);
374
374
  },
375
375
  resetInputs: () => {
376
- var g, F;
377
- (F = (g = N.value) == null ? void 0 : g.resetInputs) == null || F.call(g);
376
+ var x, F;
377
+ (F = (x = N.value) == null ? void 0 : x.resetInputs) == null || F.call(x);
378
378
  }
379
379
  });
380
380
  const O = Ye(y, "show");
381
- async function L(g, F, G) {
382
- w.value = !0;
381
+ async function L(x, F, G) {
382
+ b.value = !0;
383
383
  try {
384
384
  await r.convertSku({
385
385
  conversions: [
386
386
  {
387
- doc: g,
387
+ doc: x,
388
388
  amount: F,
389
389
  overrides: G == null ? void 0 : G.map((H) => ({
390
390
  ...H,
@@ -396,67 +396,67 @@ const bo = { class: "flex items-center" }, go = { class: "fm-typo-en-title-md-80
396
396
  }))
397
397
  }
398
398
  ]
399
- }), S("update:show", !1), S("submitted");
399
+ }), w("update:show", !1), w("submitted");
400
400
  } catch (H) {
401
- b.open({
401
+ g.open({
402
402
  title: "Something went wrong",
403
- message: `Cannot convert ${g.name}. Please try again.`,
403
+ message: `Cannot convert ${x.name}. Please try again.`,
404
404
  type: "error"
405
- }), console.error("error at converting stock amount", g, F, H);
405
+ }), console.error("error at converting stock amount", x, F, H);
406
406
  } finally {
407
- w.value = !1;
407
+ b.value = !1;
408
408
  }
409
409
  }
410
- function X(g, F, G) {
410
+ function X(x, F, G) {
411
411
  const H = +F;
412
412
  let J = G;
413
- F.length > 0 && isFinite(H) ? J = G.map((I) => (I.id !== g || (I.amount = xe(H)), I)) : J = G.map((I) => (I.id !== g || (I.amount = { amount: 0, precision: 0 }), I)), l.value = J;
413
+ F.length > 0 && isFinite(H) ? J = G.map((I) => (I.id !== x || (I.amount = xe(H)), I)) : J = G.map((I) => (I.id !== x || (I.amount = { amount: 0, precision: 0 }), I)), l.value = J;
414
414
  }
415
- function z(g) {
416
- const F = a.value.find((G) => G._id === g);
415
+ function z(x) {
416
+ const F = a.value.find((G) => G._id === x);
417
417
  return F ? bt(F.unit, !0) : [];
418
418
  }
419
- function K(g, F) {
420
- const G = z(g), H = G.find((J) => J.value === F) ?? G.find((J) => J.value === null);
419
+ function K(x, F) {
420
+ const G = z(x), H = G.find((J) => J.value === F) ?? G.find((J) => J.value === null);
421
421
  return H ? {
422
422
  ...H,
423
423
  label: H.abbrev
424
424
  } : null;
425
425
  }
426
- function U(g, F, G) {
426
+ function U(x, F, G) {
427
427
  let H;
428
428
  if (F === null)
429
- H = G.map((J) => (J.id !== g || (J.measurement = null), J)) ?? [];
429
+ H = G.map((J) => (J.id !== x || (J.measurement = null), J)) ?? [];
430
430
  else {
431
- const J = a.value.find((I) => I._id === g);
431
+ const J = a.value.find((I) => I._id === x);
432
432
  H = G.map((I) => {
433
433
  var c, h;
434
- return I.id !== g || (I.measurement = (h = (c = J == null ? void 0 : J.unit) == null ? void 0 : c.measurements) == null ? void 0 : h.find((f) => f.id === F)), I;
434
+ return I.id !== x || (I.measurement = (h = (c = J == null ? void 0 : J.unit) == null ? void 0 : c.measurements) == null ? void 0 : h.find((f) => f.id === F)), I;
435
435
  }) ?? [];
436
436
  }
437
437
  l.value = H;
438
438
  }
439
- function Z(g, F) {
440
- const G = F.filter((H) => H.id !== g);
439
+ function Z(x, F) {
440
+ const G = F.filter((H) => H.id !== x);
441
441
  l.value = G;
442
442
  }
443
443
  function re() {
444
- const g = (l.value ?? []).map((F) => ({
444
+ const x = (l.value ?? []).map((F) => ({
445
445
  ...F,
446
446
  type: rt.enum.SKU
447
447
  }));
448
448
  j.promptIngredientsBinding(
449
- g,
449
+ x,
450
450
  (F) => l.value = F,
451
451
  y.sku._id
452
452
  );
453
453
  }
454
454
  return Fe(
455
455
  () => y.show,
456
- (g) => {
457
- g || (l.value = null, C.value = 0);
456
+ (x) => {
457
+ x || (l.value = null, C.value = 0);
458
458
  }
459
- ), (g, F) => {
459
+ ), (x, F) => {
460
460
  const G = B("FmTextField"), H = B("FmForm"), J = B("FmCard"), I = B("FmSwitch"), c = B("FmFormGroup"), h = B("FmSelect"), f = B("FmButton"), v = B("FmSideSheet");
461
461
  return V(), ne(v, {
462
462
  "dismiss-away": "",
@@ -466,7 +466,7 @@ const bo = { class: "flex items-center" }, go = { class: "fm-typo-en-title-md-80
466
466
  }, {
467
467
  "side-sheet-header": M(() => [
468
468
  e("div", bo, [
469
- e("div", go, p(s(R)("inventory.stock.convert.title", { name: g.sku.name })), 1)
469
+ e("div", go, p(s(R)("inventory.stock.convert.title", { name: x.sku.name })), 1)
470
470
  ])
471
471
  ]),
472
472
  default: M(() => [
@@ -478,13 +478,13 @@ const bo = { class: "flex items-center" }, go = { class: "fm-typo-en-title-md-80
478
478
  }, {
479
479
  default: M(() => [
480
480
  _(G, {
481
- disabled: w.value,
481
+ disabled: b.value,
482
482
  "model-value": C.value,
483
483
  "onUpdate:modelValue": F[0] || (F[0] = (i) => C.value = i),
484
484
  label: s(R)("inventory.stock.convert.amount"),
485
485
  rules: [t, n, s(Ue)(0)],
486
486
  "append-text": $.value,
487
- "helper-text": l.value ? void 0 : `Max ${g.maxCount} ${$.value}`
487
+ "helper-text": l.value ? void 0 : `Max ${x.maxCount} ${$.value}`
488
488
  }, null, 8, ["disabled", "model-value", "label", "rules", "append-text", "helper-text"])
489
489
  ]),
490
490
  _: 1
@@ -497,9 +497,9 @@ const bo = { class: "flex items-center" }, go = { class: "fm-typo-en-title-md-80
497
497
  e("div", So, [
498
498
  e("div", wo, p(s(R)("inventory.stock.convert.deductionSummary")), 1),
499
499
  (V(!0), q(ue, null, fe(E.value, (i) => {
500
- var x, P;
500
+ var S, P;
501
501
  return V(), q("div", {
502
- key: (x = i.sku) == null ? void 0 : x._id,
502
+ key: (S = i.sku) == null ? void 0 : S._id,
503
503
  class: "flex items-center"
504
504
  }, [
505
505
  e("div", Ao, p((P = i.sku) == null ? void 0 : P.name), 1),
@@ -529,43 +529,43 @@ const bo = { class: "flex items-center" }, go = { class: "fm-typo-en-title-md-80
529
529
  e("div", Vo, p(s(R)("inventory.stock.convert.ingredients")), 1),
530
530
  (V(!0), q(ue, null, fe(l.value, (i) => (V(), ne(c, {
531
531
  key: i.id,
532
- disabled: w.value,
532
+ disabled: b.value,
533
533
  modelValue: +s(he)(i.amount ?? { amount: 1, precision: 0 }),
534
534
  rules: [
535
535
  s(qt)(
536
- a.value.find((x) => x._id === i.id).unit,
536
+ a.value.find((S) => S._id === i.id).unit,
537
537
  i.measurement
538
538
  ),
539
539
  s(Ue)(0)
540
540
  ]
541
541
  }, {
542
- default: M(({ invalid: x }) => {
542
+ default: M(({ invalid: S }) => {
543
543
  var P, ee, ae;
544
544
  return [
545
545
  e("div", Co, [
546
546
  e("div", Do, p((P = a.value.find((Q) => Q._id === i.id)) == null ? void 0 : P.name), 1),
547
547
  _(G, {
548
548
  class: "xs:col-span-2",
549
- disabled: w.value,
549
+ disabled: b.value,
550
550
  modelValue: +s(he)(
551
551
  i.amount ?? { amount: 1, precision: 0 }
552
552
  ),
553
553
  "onUpdate:modelValue": (Q) => X(i.id, Q, l.value ?? []),
554
- invalid: x
554
+ invalid: S
555
555
  }, null, 8, ["disabled", "modelValue", "onUpdate:modelValue", "invalid"]),
556
556
  _(h, {
557
- disabled: w.value,
557
+ disabled: b.value,
558
558
  class: "translate-y-[2px]",
559
559
  items: z(i.id),
560
560
  "model-value": (ae = K(i.id, (ee = i.measurement) == null ? void 0 : ee.id)) == null ? void 0 : ae.value,
561
561
  "onUpdate:modelValue": (Q) => U(i.id, Q, l.value ?? []),
562
- invalid: x
562
+ invalid: S
563
563
  }, {
564
564
  "helper-text": M(() => F[4] || (F[4] = [])),
565
565
  _: 2
566
566
  }, 1032, ["disabled", "items", "model-value", "onUpdate:modelValue", "invalid"]),
567
567
  _(f, {
568
- disabled: w.value,
568
+ disabled: b.value,
569
569
  type: "button",
570
570
  variant: "tertiary",
571
571
  icon: "delete",
@@ -595,11 +595,11 @@ const bo = { class: "flex items-center" }, go = { class: "fm-typo-en-title-md-80
595
595
  "side-sheet-footer": M(() => [
596
596
  e("div", Bo, [
597
597
  _(f, {
598
- loading: w.value,
598
+ loading: b.value,
599
599
  label: s(R)("inventory.stock.convert.convertButton"),
600
600
  onClick: F[2] || (F[2] = (i) => {
601
- var x, P;
602
- return (P = (x = N.value) == null ? void 0 : x.validateInputs) == null ? void 0 : P.call(x);
601
+ var S, P;
602
+ return (P = (S = N.value) == null ? void 0 : S.validateInputs) == null ? void 0 : P.call(S);
603
603
  })
604
604
  }, null, 8, ["loading", "label"])
605
605
  ])
@@ -653,12 +653,12 @@ const We = {
653
653
  },
654
654
  emits: ["update:modelValue", "click:delete"],
655
655
  setup(A, { emit: u }) {
656
- const k = A, y = u, { t: S } = pe(), j = Oe(), d = T(
656
+ const k = A, y = u, { t: w } = pe(), j = Oe(), d = T(
657
657
  () => Object.keys(We).map((t) => ({
658
658
  label: Ht(t),
659
659
  value: t
660
660
  }))
661
- ), r = T(() => bt(k.modelValue.doc.unit, !0)), b = T({
661
+ ), r = T(() => bt(k.modelValue.doc.unit, !0)), g = T({
662
662
  get() {
663
663
  return k.modelValue.type ?? ie.enum.PURCHASE;
664
664
  },
@@ -682,7 +682,7 @@ const We = {
682
682
  const n = {
683
683
  ...k.modelValue
684
684
  }, $ = xe(t);
685
- n.amount = We[b.value].toAdjustmentAmount(
685
+ n.amount = We[g.value].toAdjustmentAmount(
686
686
  t,
687
687
  $.precision
688
688
  ), y("update:modelValue", n);
@@ -718,7 +718,7 @@ const We = {
718
718
  return n ? xt(t, n.conversion) : t;
719
719
  }), m = T(
720
720
  () => k.isBackdate ? a.value : Qe(a.value, D.value)
721
- ), w = T(
721
+ ), b = T(
722
722
  () => Zt(m.value, k.modelValue.doc.unit)
723
723
  ), o = T(
724
724
  () => !k.isBackdate && D.value.amount < 0
@@ -746,8 +746,8 @@ const We = {
746
746
  class: "col-span-2",
747
747
  label: "Type",
748
748
  items: d.value,
749
- modelValue: b.value,
750
- "onUpdate:modelValue": n[1] || (n[1] = (L) => b.value = L),
749
+ modelValue: g.value,
750
+ "onUpdate:modelValue": n[1] || (n[1] = (L) => g.value = L),
751
751
  rules: [s(Xt)()],
752
752
  "label-mark": "required"
753
753
  }, null, 8, ["disabled", "items", "modelValue", "rules"]),
@@ -778,11 +778,11 @@ const We = {
778
778
  "label-mark": "optional"
779
779
  }, null, 8, ["disabled", "modelValue"]),
780
780
  e("div", Uo, [
781
- e("div", Po, p(s(S)("inventory.stock.stock_adjustment.stockAfter")), 1),
781
+ e("div", Po, p(s(w)("inventory.stock.stock_adjustment.stockAfter")), 1),
782
782
  e("div", {
783
783
  class: He(["fm-typo-en-body-lg-600", o.value ? "text-red-700" : "text-green-700"])
784
- }, p(w.value), 3),
785
- t.isBackdate ? (V(), q("div", Ro, p(s(S)("inventory.stock.stock_adjustment.backdatePreviewWarning")), 1)) : se("", !0)
784
+ }, p(b.value), 3),
785
+ t.isBackdate ? (V(), q("div", Ro, p(s(w)("inventory.stock.stock_adjustment.backdatePreviewWarning")), 1)) : se("", !0)
786
786
  ])
787
787
  ]),
788
788
  _: 1
@@ -797,9 +797,9 @@ const We = {
797
797
  },
798
798
  emits: ["update:show", "submitted"],
799
799
  setup(A, { expose: u, emit: k }) {
800
- const y = A, S = k, j = Ne(), d = Le(), r = Ae(), b = we(), R = Y(!1), { t: C } = pe();
800
+ const y = A, w = k, j = Ne(), d = Le(), r = Ae(), g = we(), R = Y(!1), { t: C } = pe();
801
801
  function l() {
802
- w(Re(m));
802
+ b(Re(m));
803
803
  }
804
804
  const a = Y();
805
805
  u({
@@ -841,7 +841,7 @@ const We = {
841
841
  }
842
842
  ]);
843
843
  });
844
- async function w(n) {
844
+ async function b(n) {
845
845
  R.value = !0;
846
846
  try {
847
847
  await r.adjustSku({
@@ -854,9 +854,9 @@ const We = {
854
854
  doc: $,
855
855
  type: N
856
856
  }))
857
- }), S("update:show", !1), S("submitted");
857
+ }), w("update:show", !1), w("submitted");
858
858
  } catch ($) {
859
- b.open({
859
+ g.open({
860
860
  title: C("inventory.stock.adjust.error.title"),
861
861
  message: C("inventory.stock.adjust.error.message"),
862
862
  type: "error"
@@ -977,11 +977,11 @@ const We = {
977
977
  },
978
978
  emits: ["update:show", "submitted"],
979
979
  setup(A, { emit: u }) {
980
- const k = A, y = u, { t: S } = pe(), j = Ne(), d = Ae(), r = Le(), b = we(), R = Ye(k, "show"), C = Y(!1), l = _t({
980
+ const k = A, y = u, { t: w } = pe(), j = Ne(), d = Ae(), r = Le(), g = we(), R = Ye(k, "show"), C = Y(!1), l = _t({
981
981
  remark: "",
982
982
  effectiveAt: /* @__PURE__ */ new Date(),
983
983
  adjustments: []
984
- }), a = Y(!1), D = Y(ke().format("YYYY-MM-DD")), m = Y(ke().format("HH:mm")), w = Y();
984
+ }), a = Y(!1), D = Y(ke().format("YYYY-MM-DD")), m = Y(ke().format("HH:mm")), b = Y();
985
985
  Fe([D, m], () => {
986
986
  if (D.value && m.value) {
987
987
  const K = ke(`${D.value} ${m.value}`, "YYYY-MM-DD HH:mm");
@@ -992,12 +992,12 @@ const We = {
992
992
  function t() {
993
993
  if (!a.value) return !0;
994
994
  const K = ke(`${D.value} ${m.value}`, "YYYY-MM-DD HH:mm");
995
- if (!K.isValid()) return S("inventory.stock.stock_adjustment.invalidDateTime");
995
+ if (!K.isValid()) return w("inventory.stock.stock_adjustment.invalidDateTime");
996
996
  const U = ke();
997
997
  if (K.isAfter(U))
998
- return S("inventory.stock.stock_adjustment.futureDateNotAllowed");
998
+ return w("inventory.stock.stock_adjustment.futureDateNotAllowed");
999
999
  const Z = U.subtract(yt, "day");
1000
- return K.isBefore(Z) ? S("inventory.stock.stock_adjustment.backdateLimitError", { days: yt }) : !0;
1000
+ return K.isBefore(Z) ? w("inventory.stock.stock_adjustment.backdateLimitError", { days: yt }) : !0;
1001
1001
  }
1002
1002
  const n = T(() => [() => t()]), $ = T(() => l.adjustments.length === 0 || t() !== !0);
1003
1003
  function E() {
@@ -1019,7 +1019,7 @@ const We = {
1019
1019
  value: Z._id
1020
1020
  })), U = l.adjustments.map((Z) => Z.doc._id);
1021
1021
  r.open({
1022
- title: S("inventory.stock.adjust.selectIngredients"),
1022
+ title: w("inventory.stock.adjust.selectIngredients"),
1023
1023
  contentComponent: St,
1024
1024
  contentComponentProps: {
1025
1025
  items: K,
@@ -1030,17 +1030,17 @@ const We = {
1030
1030
  closeButton: !0,
1031
1031
  dismissAway: !0,
1032
1032
  primaryActions: {
1033
- text: S("common.confirm"),
1033
+ text: w("common.confirm"),
1034
1034
  close: !0
1035
1035
  },
1036
1036
  secondaryActions: {
1037
- text: S("common.close"),
1037
+ text: w("common.close"),
1038
1038
  close: !0,
1039
1039
  variant: "tertiary"
1040
1040
  }
1041
1041
  }).onPrimary((Z) => {
1042
1042
  l.adjustments = Z.map(
1043
- (re) => l.adjustments.find((g) => g.doc._id === re) ?? {
1043
+ (re) => l.adjustments.find((x) => x.doc._id === re) ?? {
1044
1044
  id: "",
1045
1045
  type: ie.enum.PURCHASE,
1046
1046
  doc: O.value[re],
@@ -1056,9 +1056,9 @@ const We = {
1056
1056
  }
1057
1057
  async function z() {
1058
1058
  if (l.adjustments.length === 0) {
1059
- b.open({
1060
- title: S("inventory.stock.error.title"),
1061
- message: S("inventory.stock.stock_adjustment.noAdjustments"),
1059
+ g.open({
1060
+ title: w("inventory.stock.error.title"),
1061
+ message: w("inventory.stock.stock_adjustment.noAdjustments"),
1062
1062
  type: "warning"
1063
1063
  });
1064
1064
  return;
@@ -1066,13 +1066,13 @@ const We = {
1066
1066
  C.value = !0;
1067
1067
  try {
1068
1068
  const K = l.adjustments.map(
1069
- ({ doc: Z, remark: re, type: g, amount: F, measurement: G }) => ({
1069
+ ({ doc: Z, remark: re, type: x, amount: F, measurement: G }) => ({
1070
1070
  id: Z._id,
1071
1071
  amount: F,
1072
1072
  measurement: G,
1073
1073
  remark: re,
1074
1074
  doc: Z,
1075
- type: g
1075
+ type: x
1076
1076
  })
1077
1077
  ), U = {
1078
1078
  remark: l.remark,
@@ -1081,9 +1081,9 @@ const We = {
1081
1081
  };
1082
1082
  await d.adjustSku(Re(U)), y("submitted"), y("update:show", !1);
1083
1083
  } catch (K) {
1084
- b.open({
1085
- title: S("inventory.stock.adjust.error.title"),
1086
- message: S("inventory.stock.adjust.error.message"),
1084
+ g.open({
1085
+ title: w("inventory.stock.adjust.error.title"),
1086
+ message: w("inventory.stock.adjust.error.message"),
1087
1087
  type: "error"
1088
1088
  }), console.error("error on stock adjustment", K);
1089
1089
  } finally {
@@ -1091,7 +1091,7 @@ const We = {
1091
1091
  }
1092
1092
  }
1093
1093
  return (K, U) => {
1094
- const Z = B("FmTextarea"), re = B("FmSwitch"), g = B("FmDatePicker"), F = B("FmTimePicker"), G = B("FmFormGroup"), H = B("FmButton"), J = B("FmForm"), I = B("FmSideSheet");
1094
+ const Z = B("FmTextarea"), re = B("FmSwitch"), x = B("FmDatePicker"), F = B("FmTimePicker"), G = B("FmFormGroup"), H = B("FmButton"), J = B("FmForm"), I = B("FmSideSheet");
1095
1095
  return V(), ne(I, {
1096
1096
  modelValue: s(R),
1097
1097
  "onUpdate:modelValue": U[6] || (U[6] = (c) => Pe(R) ? R.value = c : null),
@@ -1101,19 +1101,19 @@ const We = {
1101
1101
  }, {
1102
1102
  "side-sheet-header": M(() => [
1103
1103
  e("div", Wo, [
1104
- e("div", Ko, p(s(S)("inventory.stock.stock_adjustment.title")), 1)
1104
+ e("div", Ko, p(s(w)("inventory.stock.stock_adjustment.title")), 1)
1105
1105
  ])
1106
1106
  ]),
1107
1107
  default: M(() => [
1108
1108
  _(J, {
1109
1109
  class: "flex flex-col gap-16",
1110
1110
  ref_key: "formRef",
1111
- ref: w,
1111
+ ref: b,
1112
1112
  onValidationSuccess: z
1113
1113
  }, {
1114
1114
  default: M(() => [
1115
1115
  _(Z, {
1116
- label: s(S)("inventory.stock.adjust.remark"),
1116
+ label: s(w)("inventory.stock.adjust.remark"),
1117
1117
  modelValue: l.remark,
1118
1118
  "onUpdate:modelValue": U[0] || (U[0] = (c) => l.remark = c),
1119
1119
  "label-mark": "optional"
@@ -1122,15 +1122,15 @@ const We = {
1122
1122
  value: "",
1123
1123
  "model-value": a.value,
1124
1124
  "onUpdate:modelValue": U[1] || (U[1] = (c) => a.value = c),
1125
- label: s(S)("inventory.stock.stock_adjustment.backdateLabel"),
1126
- sublabel: s(S)("inventory.stock.stock_adjustment.backdateSublabel"),
1125
+ label: s(w)("inventory.stock.stock_adjustment.backdateLabel"),
1126
+ sublabel: s(w)("inventory.stock.stock_adjustment.backdateSublabel"),
1127
1127
  labelPlacement: "right"
1128
1128
  }, null, 8, ["model-value", "label", "sublabel"]),
1129
1129
  a.value ? (V(), q("div", qo, [
1130
- e("label", Xo, p(s(S)("inventory.stock.stock_adjustment.effectiveAt")), 1),
1130
+ e("label", Xo, p(s(w)("inventory.stock.stock_adjustment.effectiveAt")), 1),
1131
1131
  e("div", Jo, [
1132
1132
  e("div", Qo, [
1133
- _(g, {
1133
+ _(x, {
1134
1134
  class: "w-full",
1135
1135
  modelValue: D.value,
1136
1136
  "onUpdate:modelValue": U[2] || (U[2] = (c) => D.value = c),
@@ -1150,10 +1150,10 @@ const We = {
1150
1150
  "model-value": o.value,
1151
1151
  rules: n.value
1152
1152
  }, null, 8, ["model-value", "rules"]),
1153
- e("div", en, p(s(S)("inventory.stock.stock_adjustment.immediateHint")), 1)
1153
+ e("div", en, p(s(w)("inventory.stock.stock_adjustment.immediateHint")), 1)
1154
1154
  ])) : se("", !0),
1155
1155
  e("div", tn, [
1156
- e("div", on, p(s(S)("inventory.stock.adjust.adjustedItems")), 1),
1156
+ e("div", on, p(s(w)("inventory.stock.adjust.adjustedItems")), 1),
1157
1157
  _(H, {
1158
1158
  "prepend-icon": "add",
1159
1159
  variant: "tertiary",
@@ -1175,16 +1175,16 @@ const We = {
1175
1175
  "side-sheet-footer": M(() => [
1176
1176
  e("div", nn, [
1177
1177
  _(H, {
1178
- label: s(S)("common.confirm"),
1178
+ label: s(w)("common.confirm"),
1179
1179
  loading: C.value,
1180
1180
  disabled: $.value,
1181
1181
  onClick: U[4] || (U[4] = (c) => {
1182
1182
  var h, f;
1183
- return (f = (h = w.value) == null ? void 0 : h.validateInputs) == null ? void 0 : f.call(h);
1183
+ return (f = (h = b.value) == null ? void 0 : h.validateInputs) == null ? void 0 : f.call(h);
1184
1184
  })
1185
1185
  }, null, 8, ["label", "loading", "disabled"]),
1186
1186
  _(H, {
1187
- label: s(S)("common.close"),
1187
+ label: s(w)("common.close"),
1188
1188
  variant: "tertiary",
1189
1189
  onClick: U[5] || (U[5] = (c) => y("update:show", !1))
1190
1190
  }, null, 8, ["label"])
@@ -1196,17 +1196,17 @@ const We = {
1196
1196
  }
1197
1197
  }), an = Tt((A, u) => ({
1198
1198
  // TODO: remove once latest inventory backend has been push
1199
- async findBillsByBusinessId(k, y, S) {
1199
+ async findBillsByBusinessId(k, y, w) {
1200
1200
  const j = `${A.businessesBackendUrl}/${k}/reports/find-many`, d = {
1201
1201
  // type: TYPE.bill,
1202
1202
  type: "bill",
1203
1203
  restaurantIds: y,
1204
- ids: S
1204
+ ids: w
1205
1205
  };
1206
1206
  return await u.post(j, d);
1207
1207
  },
1208
1208
  async findBillsById(k) {
1209
- const S = Se().currentLocationDBName, j = `${A.inventoryBackendUrl}/${S}/bill/search`, d = {
1209
+ const w = Se().currentLocationDBName, j = `${A.inventoryBackendUrl}/${w}/bill/search`, d = {
1210
1210
  ids: k
1211
1211
  };
1212
1212
  return await u.post(j, d);
@@ -1224,13 +1224,13 @@ const We = {
1224
1224
  }),
1225
1225
  emits: /* @__PURE__ */ nt(["refreshHistory"], ["update:modelValue"]),
1226
1226
  setup(A, { emit: u }) {
1227
- const k = A, y = u, S = Ae(), j = jt(A, "modelValue"), d = Y(!1), r = Y(!1), b = Y(!1), R = Y({
1227
+ const k = A, y = u, w = Ae(), j = jt(A, "modelValue"), d = Y(!1), r = Y(!1), g = Y(!1), R = Y({
1228
1228
  _id: `inventoryAdjustment_${(/* @__PURE__ */ new Date()).toISOString()}_XXXXX`,
1229
1229
  skus: []
1230
1230
  }), C = Y();
1231
1231
  qe(async () => {
1232
1232
  d.value = !0;
1233
- const o = await S.readSingleAdjustment(k.adjustmentId);
1233
+ const o = await w.readSingleAdjustment(k.adjustmentId);
1234
1234
  if (!o) throw new Error("Adjustment not found");
1235
1235
  R.value = o, d.value = !1;
1236
1236
  });
@@ -1245,10 +1245,10 @@ const We = {
1245
1245
  const O = (X = (L = j.value) == null ? void 0 : L[$]) == null ? void 0 : X[Number(N)];
1246
1246
  O && D(O.amount) > 0 && (o[$] || (o[$] = []), o[$].push(O));
1247
1247
  });
1248
- }), await S.revertWastageAdjustment({
1248
+ }), await w.revertWastageAdjustment({
1249
1249
  targetWastageAdjustmentId: k.adjustmentId,
1250
1250
  amountsGoingToAdjust: o
1251
- }), y("refreshHistory"), b.value = !1, j.value = {};
1251
+ }), y("refreshHistory"), g.value = !1, j.value = {};
1252
1252
  }
1253
1253
  function a(o) {
1254
1254
  const { skuId: t, idx: n, unit: $, measurement: E } = o;
@@ -1279,7 +1279,7 @@ const We = {
1279
1279
  function m(o, t) {
1280
1280
  return t.measurement ? t.measurement.abbrev : o.sku.unit.abbrev;
1281
1281
  }
1282
- function w(o, t) {
1282
+ function b(o, t) {
1283
1283
  if (t.amount === 0) return "N/A";
1284
1284
  const n = _e.add([o, t]);
1285
1285
  return n ? _e.toFormatString({ value: n }) : "N/A";
@@ -1287,15 +1287,15 @@ const We = {
1287
1287
  return (o, t) => {
1288
1288
  const n = B("FmIcon"), $ = B("FmStepperField"), E = B("FmCard"), N = B("FmForm"), O = B("FmSpacer"), L = B("FmButton"), X = B("FmDialog");
1289
1289
  return V(), ne(X, {
1290
- modelValue: b.value,
1291
- "onUpdate:modelValue": t[4] || (t[4] = (z) => b.value = z),
1290
+ modelValue: g.value,
1291
+ "onUpdate:modelValue": t[4] || (t[4] = (z) => g.value = z),
1292
1292
  overlay: !0
1293
1293
  }, {
1294
1294
  "dialog-button": M(() => [
1295
1295
  _(Je, null, {
1296
1296
  default: M(() => [
1297
1297
  e("button", {
1298
- onClick: t[0] || (t[0] = (z) => b.value = !0),
1298
+ onClick: t[0] || (t[0] = (z) => g.value = !0),
1299
1299
  class: "rounded-md hover:bg-gray-100 transition-colors"
1300
1300
  }, [
1301
1301
  _(n, {
@@ -1320,7 +1320,7 @@ const We = {
1320
1320
  label: "Close",
1321
1321
  size: "md",
1322
1322
  variant: "tertiary",
1323
- onClick: t[3] || (t[3] = (z) => b.value = !1)
1323
+ onClick: t[3] || (t[3] = (z) => g.value = !1)
1324
1324
  }),
1325
1325
  _(L, {
1326
1326
  class: "sm:w-full xs:w-full",
@@ -1396,7 +1396,7 @@ const We = {
1396
1396
  e("div", vn, [
1397
1397
  t[10] || (t[10] = e("span", { class: "fm-typo-en-body-lg-600" }, "Amount after amend:", -1)),
1398
1398
  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)),
1399
- ye(" " + p(w(
1399
+ ye(" " + p(b(
1400
1400
  U.amount,
1401
1401
  s(_e).fromNumber(
1402
1402
  a({
@@ -1450,31 +1450,31 @@ const We = {
1450
1450
  if (u.costMechanism === "adjustment")
1451
1451
  return null;
1452
1452
  const a = u.unitCostHistory.filter(
1453
- (w) => w.mechanism === u.costMechanism && w.skuId === u.sku._id
1453
+ (b) => b.mechanism === u.costMechanism && b.skuId === u.sku._id
1454
1454
  );
1455
1455
  if (a.length === 0) return null;
1456
- const D = a.find((w) => {
1457
- const o = w.meta;
1456
+ const D = a.find((b) => {
1457
+ const o = b.meta;
1458
1458
  return (o == null ? void 0 : o.adjustmentId) === C;
1459
1459
  });
1460
1460
  if (D) return D.cost;
1461
- const m = [...a].filter((w) => new Date(w.snapshotAt) <= new Date(l)).sort((w, o) => new Date(o.snapshotAt).getTime() - new Date(w.snapshotAt).getTime());
1461
+ const m = [...a].filter((b) => new Date(b.snapshotAt) <= new Date(l)).sort((b, o) => new Date(o.snapshotAt).getTime() - new Date(b.snapshotAt).getTime());
1462
1462
  return m.length > 0 ? m[0].cost : null;
1463
1463
  }
1464
- const y = Y(!1), S = Y(), j = Y(null), d = T(() => j.value === null ? "unset" : y.value ? `${j.value}px` : "0px");
1464
+ const y = Y(!1), w = Y(), j = Y(null), d = T(() => j.value === null ? "unset" : y.value ? `${j.value}px` : "0px");
1465
1465
  qe(() => {
1466
1466
  var C;
1467
- j.value = ((C = S.value) == null ? void 0 : C.scrollHeight) || 0;
1467
+ j.value = ((C = w.value) == null ? void 0 : C.scrollHeight) || 0;
1468
1468
  });
1469
1469
  const r = T(() => {
1470
- var w;
1470
+ var b;
1471
1471
  const C = u.record.adjustments, l = u.sku, a = {}, m = C.flatMap((o) => {
1472
1472
  var t;
1473
1473
  return ((t = o.skus) == null ? void 0 : t.filter((n) => n.sku._id === l._id)) ?? [];
1474
1474
  }).flatMap((o) => o.amounts);
1475
1475
  for (const o of m) {
1476
1476
  const t = o.measurement ? xt(o.measurement.conversion, o.amount) : o.amount;
1477
- a[w = o.type] ?? (a[w] = { amount: 0, precision: 0 }), a[o.type] = Qe(t, a[o.type]);
1477
+ a[b = o.type] ?? (a[b] = { amount: 0, precision: 0 }), a[o.type] = Qe(t, a[o.type]);
1478
1478
  }
1479
1479
  return Object.entries(a).reduce(
1480
1480
  (o, [t, n]) => (o[t] = /// comment, because without it formatter makes code uglier
@@ -1484,15 +1484,15 @@ const We = {
1484
1484
  })} ${l.unit.abbrev}`, o),
1485
1485
  {}
1486
1486
  );
1487
- }), { t: b } = pe(), R = T(() => u.record.adjustmentsByTime.map(({ date: C, adjustments: l }) => ({
1487
+ }), { t: g } = pe(), R = T(() => u.record.adjustmentsByTime.map(({ date: C, adjustments: l }) => ({
1488
1488
  time: to(new Date(C)),
1489
1489
  adjustments: l.flatMap(
1490
1490
  (a) => {
1491
1491
  var D, m;
1492
- return ((m = (D = a.skus) == null ? void 0 : D.map) == null ? void 0 : m.call(D, (w) => {
1492
+ return ((m = (D = a.skus) == null ? void 0 : D.map) == null ? void 0 : m.call(D, (b) => {
1493
1493
  var o, t;
1494
1494
  return {
1495
- ...w,
1495
+ ...b,
1496
1496
  ref: a.ref,
1497
1497
  reason: a.reason,
1498
1498
  adjustmentRemark: a.remark,
@@ -1505,7 +1505,7 @@ const We = {
1505
1505
  }
1506
1506
  ).flatMap((a) => {
1507
1507
  var t;
1508
- const D = (t = u.bills.find((n) => n._id === a.ref)) == null ? void 0 : t.seqNumber, m = D ? b("inventory.stock.record.bill", [D]) : "", w = a.adjustmentTime ?? (/* @__PURE__ */ new Date()).toISOString(), o = k(a.adjustmentId, w);
1508
+ const D = (t = u.bills.find((n) => n._id === a.ref)) == null ? void 0 : t.seqNumber, m = D ? g("inventory.stock.record.bill", [D]) : "", b = a.adjustmentTime ?? (/* @__PURE__ */ new Date()).toISOString(), o = k(a.adjustmentId, b);
1509
1509
  return (a.amounts || []).filter((n) => n != null).map((n) => {
1510
1510
  var N;
1511
1511
  let $ = n.cost;
@@ -1545,7 +1545,7 @@ const We = {
1545
1545
  e("div", kn, [
1546
1546
  e("div", {
1547
1547
  class: "flex items-center cursor-pointer mb-1",
1548
- onClick: l[0] || (l[0] = (w) => y.value = !y.value)
1548
+ onClick: l[0] || (l[0] = (b) => y.value = !y.value)
1549
1549
  }, [
1550
1550
  e("div", hn, p(C.record.date), 1),
1551
1551
  _(a, {
@@ -1554,23 +1554,23 @@ const We = {
1554
1554
  size: "md"
1555
1555
  }, null, 8, ["name"])
1556
1556
  ]),
1557
- (V(!0), q(ue, null, fe(r.value, (w, o) => (V(), q("div", {
1557
+ (V(!0), q(ue, null, fe(r.value, (b, o) => (V(), q("div", {
1558
1558
  key: o,
1559
1559
  class: "flex flex-row py-1",
1560
1560
  style: { "font-size": "0.8rem" }
1561
1561
  }, [
1562
- e("div", bn, p(s(b)(`inventory.inventoryAdjustment.type.${o}`)), 1),
1562
+ e("div", bn, p(s(g)(`inventory.inventoryAdjustment.type.${o}`)), 1),
1563
1563
  e("div", {
1564
1564
  class: He({
1565
- "text-fm-color-typo-error": w.startsWith("-"),
1566
- "text-fm-color-typo-success": !w.startsWith("-"),
1565
+ "text-fm-color-typo-error": b.startsWith("-"),
1566
+ "text-fm-color-typo-success": !b.startsWith("-"),
1567
1567
  "ml-auto": !0
1568
1568
  })
1569
- }, p(w), 3)
1569
+ }, p(b), 3)
1570
1570
  ]))), 128)),
1571
1571
  e("div", {
1572
1572
  ref_key: "detailRef",
1573
- ref: S,
1573
+ ref: w,
1574
1574
  style: kt({
1575
1575
  fontSize: "0.8rem",
1576
1576
  maxHeight: d.value,
@@ -1579,18 +1579,18 @@ const We = {
1579
1579
  })
1580
1580
  }, [
1581
1581
  R.value.length ? (V(), q("hr", gn)) : se("", !0),
1582
- (V(!0), q(ue, null, fe(R.value, (w) => (V(), q("div", {
1583
- key: w.time,
1582
+ (V(!0), q(ue, null, fe(R.value, (b) => (V(), q("div", {
1583
+ key: b.time,
1584
1584
  class: "flex gap-1 w-full"
1585
1585
  }, [
1586
- e("div", xn, p(w.time), 1),
1586
+ e("div", xn, p(b.time), 1),
1587
1587
  e("div", Sn, [
1588
- (V(!0), q(ue, null, fe(w.adjustments, (o) => (V(), q("div", {
1588
+ (V(!0), q(ue, null, fe(b.adjustments, (o) => (V(), q("div", {
1589
1589
  key: o.name,
1590
1590
  class: "flex gap-1"
1591
1591
  }, [
1592
1592
  e("div", wn, [
1593
- ye(p(s(b)(`inventory.inventoryAdjustment.type.${o.name}`)) + " ", 1),
1593
+ ye(p(s(g)(`inventory.inventoryAdjustment.type.${o.name}`)) + " ", 1),
1594
1594
  o.backdateFrom ? (V(), ne(D, {
1595
1595
  key: 0,
1596
1596
  variant: "plain",
@@ -1598,7 +1598,7 @@ const We = {
1598
1598
  "z-index": 50
1599
1599
  }, {
1600
1600
  content: M(() => [
1601
- e("div", An, p(s(b)("inventory.stock.record.backdate", [
1601
+ e("div", An, p(s(g)("inventory.stock.record.backdate", [
1602
1602
  s(wt)(new Date(o.backdateFrom))
1603
1603
  ])), 1)
1604
1604
  ]),
@@ -1652,19 +1652,19 @@ function Mn(A, u) {
1652
1652
  (d, [r]) => (d[r] = oe.fromNumber(0), d),
1653
1653
  {}
1654
1654
  );
1655
- const S = A.flatMap((d) => {
1655
+ const w = A.flatMap((d) => {
1656
1656
  var r;
1657
- return ((r = d.skus) == null ? void 0 : r.filter((b) => b.sku._id === u._id)) ?? [];
1657
+ return ((r = d.skus) == null ? void 0 : r.filter((g) => g.sku._id === u._id)) ?? [];
1658
1658
  }).flatMap((d) => d.amounts);
1659
- for (const d of S) {
1659
+ for (const d of w) {
1660
1660
  const r = d.measurement ? oe.multiply([d.measurement.conversion, d.amount]) : d.amount;
1661
1661
  k[j = d.type] ?? (k[j] = { amount: 0, precision: 0 }), k[d.type] = oe.add([r, k[d.type]]);
1662
1662
  }
1663
1663
  return Object.entries(k).reduce(
1664
- (d, [r, b]) => {
1664
+ (d, [r, g]) => {
1665
1665
  const R = {
1666
- ...b,
1667
- amount: Math.abs(b.amount)
1666
+ ...g,
1667
+ amount: Math.abs(g.amount)
1668
1668
  };
1669
1669
  return d[r] = /// comment, because without it formatter makes code uglier
1670
1670
  `${oe.toFormatString({
@@ -1679,20 +1679,20 @@ function In(A, u) {
1679
1679
  if (!u)
1680
1680
  return null;
1681
1681
  let k = null;
1682
- const S = A.flatMap((j) => {
1682
+ const w = A.flatMap((j) => {
1683
1683
  var d;
1684
1684
  return ((d = j.skus) == null ? void 0 : d.filter((r) => r.sku._id === u._id)) ?? [];
1685
1685
  }).flatMap((j) => {
1686
1686
  var d;
1687
1687
  return !j.history || ((d = j.history) == null ? void 0 : d.length) === 0 ? [] : j.history[0];
1688
1688
  });
1689
- for (const j of S) {
1689
+ for (const j of w) {
1690
1690
  const d = j.amounts;
1691
1691
  for (const r of d) {
1692
1692
  if (r.type !== ie.Enum.SALES)
1693
1693
  continue;
1694
- const b = r.measurement ? oe.multiply([r.measurement.conversion, r.amount]) : r.amount;
1695
- k ?? (k = oe.fromNumber(0)), k = oe.add([k, b]);
1694
+ const g = r.measurement ? oe.multiply([r.measurement.conversion, r.amount]) : r.amount;
1695
+ k ?? (k = oe.fromNumber(0)), k = oe.add([k, g]);
1696
1696
  }
1697
1697
  }
1698
1698
  return k != null ? (k.amount = Math.abs(k.amount), `${oe.toFormatString({
@@ -1723,10 +1723,10 @@ const Hn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Tn = {
1723
1723
  },
1724
1724
  emits: ["update:show"],
1725
1725
  setup(A) {
1726
- const u = Xe(), k = Oe(), y = Ae(), S = an(), j = Se(), d = io(), { t: r } = pe(), b = A, R = Y(!1), C = we(), l = Y("adjustment"), a = Y([
1726
+ const u = Xe(), k = Oe(), y = Ae(), w = an(), j = Se(), d = io(), { t: r } = pe(), g = A, R = Y(!1), C = we(), l = Y("adjustment"), a = Y([
1727
1727
  { label: "Adjustment (Default)", value: "adjustment" }
1728
1728
  ]), D = Y([]), m = Y(ao(0));
1729
- async function w() {
1729
+ async function b() {
1730
1730
  R.value = !0;
1731
1731
  try {
1732
1732
  await N(), await k.readStockBalance();
@@ -1735,15 +1735,15 @@ const Hn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Tn = {
1735
1735
  title: "Something went wrong",
1736
1736
  message: "Cannot fetch stock history. Please try again.",
1737
1737
  type: "error"
1738
- }), console.log("failed at fetching item adjustment history", b.sku, m, c);
1738
+ }), console.log("failed at fetching item adjustment history", g.sku, m, c);
1739
1739
  } finally {
1740
1740
  R.value = !1;
1741
1741
  }
1742
1742
  }
1743
1743
  qe(() => {
1744
- w();
1745
- }), Fe([() => m.value, () => b.sku], () => {
1746
- w();
1744
+ b();
1745
+ }), Fe([() => m.value, () => g.sku], () => {
1746
+ b();
1747
1747
  });
1748
1748
  const o = Y([]), t = Y([]), n = Y(new Array());
1749
1749
  function $(c, h) {
@@ -1752,10 +1752,10 @@ const Hn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Tn = {
1752
1752
  function E(c, h) {
1753
1753
  const f = c.reduce(
1754
1754
  (v, i) => {
1755
- const x = i.effectiveAt ?? Te(i._id);
1756
- if (!x)
1755
+ const S = i.effectiveAt ?? Te(i._id);
1756
+ if (!S)
1757
1757
  return v;
1758
- const P = $(new Date(x), h);
1758
+ const P = $(new Date(S), h);
1759
1759
  return v[P] ?? (v[P] = []), v[P].push(i), v;
1760
1760
  },
1761
1761
  {}
@@ -1767,7 +1767,7 @@ const Hn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Tn = {
1767
1767
  }
1768
1768
  async function N() {
1769
1769
  let c = await y.readStockAdjustment(
1770
- b.sku._id,
1770
+ g.sku._id,
1771
1771
  dt(new Date(m.value.startDate)).toISOString(),
1772
1772
  mt(new Date(m.value.endDate)).toISOString()
1773
1773
  );
@@ -1780,14 +1780,14 @@ const Hn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Tn = {
1780
1780
  }));
1781
1781
  try {
1782
1782
  const f = await y.readUnitCostHistory(
1783
- b.sku._id,
1783
+ g.sku._id,
1784
1784
  dt(new Date(m.value.startDate)).toISOString(),
1785
1785
  mt(new Date(m.value.endDate)).toISOString()
1786
1786
  );
1787
1787
  D.value = f;
1788
1788
  const v = /* @__PURE__ */ new Set();
1789
- f.forEach((x) => {
1790
- v.add(x.mechanism);
1789
+ f.forEach((S) => {
1790
+ v.add(S.mechanism);
1791
1791
  });
1792
1792
  const i = [{ label: "Default", value: "adjustment" }];
1793
1793
  v.has(ge.Enum.weightedAverage) && i.push({
@@ -1802,57 +1802,57 @@ const Hn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Tn = {
1802
1802
  }
1803
1803
  }
1804
1804
  async function O(c) {
1805
- c.length && (n.value = await S.findBillsById(c).catch((h) => {
1805
+ c.length && (n.value = await w.findBillsById(c).catch((h) => {
1806
1806
  var i;
1807
1807
  console.error("Error on using latest bill API, retrying using legacy api", h);
1808
1808
  const f = ((i = u.currentBusiness.value) == null ? void 0 : i._id) ?? "", v = j.currentLocation.doc._id;
1809
- return S.findBillsByBusinessId(f, [v], c);
1809
+ return w.findBillsByBusinessId(f, [v], c);
1810
1810
  }));
1811
1811
  }
1812
1812
  const L = T(() => {
1813
- const c = o.value, h = b.sku;
1813
+ const c = o.value, h = g.sku;
1814
1814
  return Mn(c, h);
1815
1815
  }), X = T(() => {
1816
- const c = o.value, h = b.sku;
1816
+ const c = o.value, h = g.sku;
1817
1817
  return In(c, h);
1818
1818
  }), z = T(() => {
1819
1819
  const c = [...o.value].computeFirst((f) => {
1820
- var i, x;
1821
- const v = (x = (i = f.skus) == null ? void 0 : i.find) == null ? void 0 : x.call(i, (P) => P.sku._id === b.sku._id);
1820
+ var i, S;
1821
+ const v = (S = (i = f.skus) == null ? void 0 : i.find) == null ? void 0 : S.call(i, (P) => P.sku._id === g.sku._id);
1822
1822
  return v == null ? void 0 : v.fromBalance;
1823
1823
  }) ?? {
1824
1824
  amount: 0,
1825
1825
  precision: 0
1826
- }, h = b.sku;
1826
+ }, h = g.sku;
1827
1827
  return h ? `${oe.toFormatString({
1828
1828
  value: c,
1829
1829
  precision: 4
1830
1830
  })} ${h.unit.abbrev}` : "";
1831
1831
  }), K = T(() => {
1832
1832
  const c = [...o.value].reverse().computeFirst((f) => {
1833
- var i, x;
1834
- const v = (x = (i = f.skus) == null ? void 0 : i.find) == null ? void 0 : x.call(i, (P) => P.sku._id === b.sku._id);
1833
+ var i, S;
1834
+ const v = (S = (i = f.skus) == null ? void 0 : i.find) == null ? void 0 : S.call(i, (P) => P.sku._id === g.sku._id);
1835
1835
  return v == null ? void 0 : v.toBalance;
1836
1836
  }) ?? {
1837
1837
  amount: 0,
1838
1838
  precision: 0
1839
- }, h = b.sku;
1839
+ }, h = g.sku;
1840
1840
  return h ? `${oe.toFormatString({ value: c, precision: 4 })} ${h.unit.abbrev}` : "";
1841
1841
  }), U = T(() => {
1842
1842
  var f;
1843
1843
  const h = o.value.flatMap((v) => {
1844
1844
  var i;
1845
- return ((i = v.skus) == null ? void 0 : i.flatMap((x) => x.amounts)) ?? [];
1845
+ return ((i = v.skus) == null ? void 0 : i.flatMap((S) => S.amounts)) ?? [];
1846
1846
  }).filter((v) => v.amount.amount < 0).reduce(
1847
1847
  (v, i) => {
1848
- const x = i.cost;
1849
- if (!x) return v;
1848
+ const S = i.cost;
1849
+ if (!S) return v;
1850
1850
  const P = {
1851
- ...Wt(v, Math.max(v.precision, x.precision)),
1852
- currency: x.currency
1851
+ ...Wt(v, Math.max(v.precision, S.precision)),
1852
+ currency: S.currency
1853
1853
  };
1854
1854
  return {
1855
- ...Qe(P, x),
1855
+ ...Qe(P, S),
1856
1856
  currency: v.currency
1857
1857
  };
1858
1858
  },
@@ -1872,42 +1872,42 @@ const Hn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Tn = {
1872
1872
  });
1873
1873
  }
1874
1874
  const re = T(() => r("inventory.ingredient.valuationMethod.WAVG"));
1875
- function g(c, h) {
1875
+ function x(c, h) {
1876
1876
  if (l.value === "adjustment")
1877
1877
  return null;
1878
1878
  const f = D.value.filter(
1879
- (x) => x.mechanism === l.value && x.skuId === b.sku._id
1879
+ (S) => S.mechanism === l.value && S.skuId === g.sku._id
1880
1880
  );
1881
1881
  if (f.length === 0) return null;
1882
- const v = f.find((x) => {
1883
- const P = x.meta;
1882
+ const v = f.find((S) => {
1883
+ const P = S.meta;
1884
1884
  return (P == null ? void 0 : P.adjustmentId) === c;
1885
1885
  });
1886
1886
  if (v) return v.cost;
1887
- const i = [...f].filter((x) => new Date(x.snapshotAt) <= new Date(h)).sort((x, P) => new Date(P.snapshotAt).getTime() - new Date(x.snapshotAt).getTime());
1887
+ const i = [...f].filter((S) => new Date(S.snapshotAt) <= new Date(h)).sort((S, P) => new Date(P.snapshotAt).getTime() - new Date(S.snapshotAt).getTime());
1888
1888
  return i.length > 0 ? i[0].cost : null;
1889
1889
  }
1890
1890
  const F = T(() => {
1891
- var v, i, x, P, ee, ae;
1891
+ var v, i, S, P, ee, ae;
1892
1892
  const c = [...o.value].reverse().find((Q) => {
1893
1893
  var W, te;
1894
- return (te = (W = Q.skus) == null ? void 0 : W.find) == null ? void 0 : te.call(W, (le) => le.sku._id === b.sku._id);
1894
+ return (te = (W = Q.skus) == null ? void 0 : W.find) == null ? void 0 : te.call(W, (le) => le.sku._id === g.sku._id);
1895
1895
  });
1896
1896
  if (!c) return "No data";
1897
- const h = (v = c.skus) == null ? void 0 : v.find((Q) => Q.sku._id === b.sku._id);
1897
+ const h = (v = c.skus) == null ? void 0 : v.find((Q) => Q.sku._id === g.sku._id);
1898
1898
  if (!h) return "No data";
1899
1899
  const f = h.toBalance;
1900
1900
  if (l.value === "adjustment") {
1901
1901
  const Q = [...h.amounts].reverse()[0], W = {
1902
1902
  amount: ((i = Q.cost) == null ? void 0 : i.amount) ?? 0,
1903
- precision: ((x = Q.cost) == null ? void 0 : x.precision) ?? 0
1903
+ precision: ((S = Q.cost) == null ? void 0 : S.precision) ?? 0
1904
1904
  }, te = Q.amount, le = te.amount == 0 ? oe.fromNumber(0) : oe.divide([W, te]);
1905
1905
  return {
1906
1906
  ...oe.multiply([le, f]),
1907
1907
  currency: ((P = Q.cost) == null ? void 0 : P.currency) || Ce(((ee = u.currentCountry) == null ? void 0 : ee.value) ?? lt)
1908
1908
  };
1909
1909
  } else {
1910
- const Q = c.effectiveAt ?? Te(c._id), W = g(
1910
+ const Q = c.effectiveAt ?? Te(c._id), W = x(
1911
1911
  c._id,
1912
1912
  Q ?? (/* @__PURE__ */ new Date()).toISOString()
1913
1913
  );
@@ -1921,8 +1921,8 @@ const Hn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Tn = {
1921
1921
  }), G = T(() => {
1922
1922
  var f;
1923
1923
  const c = [...o.value].reverse().computeFirst((v) => {
1924
- var x, P;
1925
- const i = (P = (x = v.skus) == null ? void 0 : x.find) == null ? void 0 : P.call(x, (ee) => ee.sku._id === b.sku._id);
1924
+ var S, P;
1925
+ const i = (P = (S = v.skus) == null ? void 0 : S.find) == null ? void 0 : P.call(S, (ee) => ee.sku._id === g.sku._id);
1926
1926
  return i == null ? void 0 : i.toCostBalances;
1927
1927
  });
1928
1928
  return c ? {
@@ -1932,7 +1932,7 @@ const Hn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Tn = {
1932
1932
  }),
1933
1933
  currency: Ce((f = u.currentCountry) == null ? void 0 : f.value)
1934
1934
  } : "No data";
1935
- }), H = T(() => b.sku.valuation === it.Enum.FIFO ? G.value : F.value);
1935
+ }), H = T(() => g.sku.valuation === it.Enum.FIFO ? G.value : F.value);
1936
1936
  function J() {
1937
1937
  const { startDate: c, endDate: h } = no(m.value);
1938
1938
  c !== null && h !== null && (m.value = {
@@ -1940,9 +1940,9 @@ const Hn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Tn = {
1940
1940
  endDate: h
1941
1941
  });
1942
1942
  }
1943
- const I = Ye(b, "show");
1943
+ const I = Ye(g, "show");
1944
1944
  return (c, h) => {
1945
- const f = B("FmButton"), v = B("FmField"), i = B("FmDateRangePicker"), x = B("FmSpacer"), P = B("FmCircularProgress"), ee = B("FmIcon"), ae = B("FmTooltip"), Q = B("FmMenuDivider"), W = B("FmChip"), te = B("FmSelect"), le = B("FmCardSection"), ce = B("FmCard"), je = B("FmSideSheet");
1945
+ const f = B("FmButton"), v = B("FmField"), i = B("FmDateRangePicker"), S = B("FmSpacer"), P = B("FmCircularProgress"), ee = B("FmIcon"), ae = B("FmTooltip"), Q = B("FmMenuDivider"), W = B("FmChip"), te = B("FmSelect"), le = B("FmCardSection"), ce = B("FmCard"), je = B("FmSideSheet");
1946
1946
  return V(), ne(je, {
1947
1947
  "dismiss-away": "",
1948
1948
  modelValue: s(I),
@@ -2000,11 +2000,11 @@ const Hn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Tn = {
2000
2000
  })
2001
2001
  ]),
2002
2002
  R.value ? (V(), q("div", Rn, [
2003
- _(x),
2003
+ _(S),
2004
2004
  _(P, { size: "xl" }),
2005
2005
  e("div", Nn, p(s(r)("inventory.stock.history.loading")), 1),
2006
- _(x),
2007
- _(x)
2006
+ _(S),
2007
+ _(S)
2008
2008
  ])) : t.value && ((me = t.value) == null ? void 0 : me.length) > 0 ? (V(), q("div", On, [
2009
2009
  _(ce, { variant: "outlined" }, {
2010
2010
  default: M(() => [
@@ -2168,11 +2168,11 @@ const Hn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Tn = {
2168
2168
  bills: n.value,
2169
2169
  "unit-cost-history": D.value,
2170
2170
  "cost-mechanism": l.value,
2171
- onRefreshHistory: w
2171
+ onRefreshHistory: b
2172
2172
  }, null, 8, ["record", "sku", "bills", "unit-cost-history", "cost-mechanism"])) : se("", !0)
2173
2173
  ], 64))), 128))
2174
2174
  ])) : (V(), q("div", js, [
2175
- _(x),
2175
+ _(S),
2176
2176
  e("div", null, [
2177
2177
  e("img", {
2178
2178
  src: s(lo),
@@ -2181,8 +2181,8 @@ const Hn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Tn = {
2181
2181
  ]),
2182
2182
  e("div", Cs, p(s(r)("inventory.stock.history.noRecords")), 1),
2183
2183
  e("div", Ds, p(s(r)("inventory.stock.history.changeDateRange")), 1),
2184
- _(x),
2185
- _(x)
2184
+ _(S),
2185
+ _(S)
2186
2186
  ]))
2187
2187
  ])
2188
2188
  ];
@@ -2200,40 +2200,40 @@ const Hn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Tn = {
2200
2200
  },
2201
2201
  setup(A) {
2202
2202
  const u = A, k = T(() => {
2203
- const S = [];
2204
- return u.permission && S.push(u.permission), u.permissions && S.push(...u.permissions), S;
2203
+ const w = [];
2204
+ return u.permission && w.push(u.permission), u.permissions && w.push(...u.permissions), w;
2205
2205
  });
2206
2206
  Vt(() => {
2207
2207
  });
2208
2208
  const { hasPermission: y } = At(k, () => u.mode);
2209
- return (S, j) => s(y) ? st(S.$slots, "default", { key: 0 }) : st(S.$slots, "fallback", { key: 1 });
2209
+ return (w, j) => s(y) ? st(w.$slots, "default", { key: 0 }) : st(w.$slots, "fallback", { key: 1 });
2210
2210
  }
2211
2211
  });
2212
2212
  function Is(A) {
2213
- const u = Ut(), k = Se(), y = Y(!1), S = Y(null), j = Y(null);
2214
- let d = null, r = !1, b = !1;
2213
+ const u = Ut(), k = Se(), y = Y(!1), w = Y(null), j = Y(null);
2214
+ let d = null, r = !1, g = !1;
2215
2215
  function R() {
2216
- if (b) return;
2216
+ if (g) return;
2217
2217
  const a = k.currentLocationDBName;
2218
2218
  if (!a) return;
2219
- b = !0;
2219
+ g = !0;
2220
2220
  const D = {
2221
2221
  type: "refresh-balance",
2222
2222
  params: { locationId: a }
2223
- }, { unsubscribe: m, initialState: w } = u.subscribe(
2223
+ }, { unsubscribe: m, initialState: b } = u.subscribe(
2224
2224
  D,
2225
2225
  C
2226
2226
  );
2227
- d = m, w.then((o) => {
2227
+ d = m, b.then((o) => {
2228
2228
  o != null && o.initialState && C(o.initialState);
2229
2229
  }).catch((o) => {
2230
2230
  console.error("Failed to fetch refresh-balance initial state", o);
2231
2231
  });
2232
2232
  }
2233
2233
  async function C(a) {
2234
- var D;
2235
- if (!(!b || !a)) {
2236
- if (S.value = a, a.completedAt && (j.value = a.completedAt), a.message === "processing" || !a.completedAt && !a.message) {
2234
+ var D, m, b;
2235
+ if (!(!g || !a)) {
2236
+ if (w.value = a, a.completedAt && (j.value = a.completedAt), a.message === "processing" || !a.completedAt && !a.message) {
2237
2237
  r = !0, y.value = !0;
2238
2238
  return;
2239
2239
  }
@@ -2242,25 +2242,26 @@ function Is(A) {
2242
2242
  l();
2243
2243
  try {
2244
2244
  await A.onCompleted();
2245
- } catch (m) {
2246
- console.error("Failed to reload after refresh", m);
2245
+ } catch (o) {
2246
+ console.error("Failed to reload after refresh", o);
2247
2247
  }
2248
2248
  return;
2249
2249
  }
2250
- if (a.message === "error") {
2251
- const m = a.error ?? "Failed to refresh stock balance.";
2252
- l(), await ((D = A.onError) == null ? void 0 : D.call(A, m));
2250
+ if (a.message === "error" || (D = a.message) != null && D.startsWith("error:")) {
2251
+ console.log("Stock balance refresh error:", a.message);
2252
+ const o = (m = a.message) != null && m.startsWith("error:") ? a.message.slice(6).trim() : "Failed to refresh stock balance.";
2253
+ l(), await ((b = A.onError) == null ? void 0 : b.call(A, o));
2253
2254
  }
2254
2255
  }
2255
2256
  }
2256
2257
  function l() {
2257
- d && (d(), d = null), b = !1, r = !1, y.value = !1, S.value = null;
2258
+ d && (d(), d = null), g = !1, r = !1, y.value = !1, w.value = null;
2258
2259
  }
2259
2260
  return Ct(() => {
2260
2261
  l();
2261
2262
  }), {
2262
2263
  refreshing: y,
2263
- refreshStatus: S,
2264
+ refreshStatus: w,
2264
2265
  lastCompletedAt: j,
2265
2266
  startListening: R,
2266
2267
  stopListening: l
@@ -2272,7 +2273,7 @@ const Hs = {
2272
2273
  }, Ts = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Es = { class: "flex flex-col gap-8" }, Us = { class: "flex flex-col" }, Ps = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Rs = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary line-clamp-1" }, _a = /* @__PURE__ */ ve({
2273
2274
  __name: "StockView",
2274
2275
  setup(A) {
2275
- const { t: u } = pe(), k = Ne(), y = Se(), S = Oe(), j = Ft(), d = Ae(), r = gt(), b = co(), { columnDefs: R } = ko(), C = Xe(), { hasPermission: l } = At(
2276
+ const { t: u } = pe(), k = Ne(), y = Se(), w = Oe(), j = Ft(), d = Ae(), r = gt(), g = co(), { columnDefs: R } = ko(), C = Xe(), { hasPermission: l } = At(
2276
2277
  T(() => [
2277
2278
  {
2278
2279
  action: De.Action.manage,
@@ -2286,8 +2287,8 @@ const Hs = {
2286
2287
  }
2287
2288
  ), D = Le(), m = we();
2288
2289
  y.watchLocation(X);
2289
- const w = T(
2290
- () => new Set(b.getAvailableItems(b.businessSubsidiaryId))
2290
+ const b = T(
2291
+ () => new Set(g.getAvailableItems(g.businessSubsidiaryId))
2291
2292
  ), o = Y(!1), t = Y(!1), { refreshing: n, lastCompletedAt: $, startListening: E, stopListening: N } = Is({
2292
2293
  onCompleted: async () => {
2293
2294
  await X(), t.value = !1, m.open({
@@ -2332,8 +2333,8 @@ Last refreshed: ${new Date($.value).toLocaleString()}` : f;
2332
2333
  await d.recalculation.refreshCurrentBalances();
2333
2334
  } catch (i) {
2334
2335
  console.log("Failed to queue refresh balan22ce", typeof i);
2335
- const x = typeof i == "object" ? JSON.stringify(i) : String(i);
2336
- console.log("Error details:", x), t.value = !1, m.open({
2336
+ const S = typeof i == "object" ? JSON.stringify(i) : String(i);
2337
+ console.log("Error details:", S), t.value = !1, m.open({
2337
2338
  title: u("inventory.common.refreshFailed"),
2338
2339
  message: (i instanceof Error ? i.message : null) ?? u("inventory.stock.stock_balance.refreshBalanceError"),
2339
2340
  type: "error"
@@ -2348,7 +2349,7 @@ Last refreshed: ${new Date($.value).toLocaleString()}` : f;
2348
2349
  if (y._currentLocation) {
2349
2350
  o.value = !0;
2350
2351
  try {
2351
- await S.readStockBalance(), await S.readProductBalance(), await r.readStockEstimateBalance();
2352
+ await w.readStockBalance(), await w.readProductBalance(), await r.readStockEstimateBalance();
2352
2353
  } catch (f) {
2353
2354
  m.open({
2354
2355
  title: u("inventory.stock.error.title"),
@@ -2378,20 +2379,20 @@ Last refreshed: ${new Date($.value).toLocaleString()}` : f;
2378
2379
  }
2379
2380
  ]
2380
2381
  }), U = T(() => {
2381
- var i, x, P;
2382
+ var i, S, P;
2382
2383
  const f = K.value ? mo.build(K.value) : null, v = [];
2383
2384
  for (const ee of k.skus) {
2384
2385
  let ae = !0;
2385
- if (b.isEnabled && re.value && w.value && ae && (ae = w.value.has(ee._id)), f && ae && (ae = fo(
2386
+ if (g.isEnabled && re.value && b.value && ae && (ae = b.value.has(ee._id)), f && ae && (ae = fo(
2386
2387
  {
2387
2388
  status: ee.isInactive ? "Inactive" : "Active"
2388
2389
  },
2389
2390
  f
2390
2391
  )), ae) {
2391
2392
  const Q = ee.trackingMeasurement;
2392
- let W = (x = (i = S.stockBalance.skus) == null ? void 0 : i.find(
2393
+ let W = (S = (i = w.stockBalance.skus) == null ? void 0 : i.find(
2393
2394
  (ce) => ce.id === ee._id
2394
- )) == null ? void 0 : x.balance, te = r.inventoryForecast.skus.find(
2395
+ )) == null ? void 0 : S.balance, te = r.inventoryForecast.skus.find(
2395
2396
  (ce) => ce.id === ee._id
2396
2397
  );
2397
2398
  const le = {
@@ -2408,7 +2409,7 @@ Last refreshed: ${new Date($.value).toLocaleString()}` : f;
2408
2409
  }
2409
2410
  }
2410
2411
  return v;
2411
- }), Z = Y(""), re = Y(!0), { breakpoints: g } = Lt(), F = T(() => g.value.xs || g.value.sm), G = T(() => F.value ? 10 : 20), H = Bt(), J = T(() => {
2412
+ }), Z = Y(""), re = Y(!0), { breakpoints: x } = Lt(), F = T(() => x.value.xs || x.value.sm), G = T(() => F.value ? 10 : 20), H = Bt(), J = T(() => {
2412
2413
  const f = [
2413
2414
  {
2414
2415
  label: u("inventory.stock.stock_balance.refreshBalance"),
@@ -2446,7 +2447,7 @@ Last refreshed: ${new Date($.value).toLocaleString()}` : f;
2446
2447
  }
2447
2448
  }
2448
2449
  return (f, v) => {
2449
- const i = B("FmSwitch"), x = B("FmTable");
2450
+ const i = B("FmSwitch"), S = B("FmTable");
2450
2451
  return V(), ne(Mt, {
2451
2452
  title: s(u)("inventory.stock.title"),
2452
2453
  actions: J.value,
@@ -2476,7 +2477,7 @@ Last refreshed: ${new Date($.value).toLocaleString()}` : f;
2476
2477
  "onUpdate:filter": v[2] || (v[2] = (W) => K.value = W)
2477
2478
  }, {
2478
2479
  default: M(() => [
2479
- s(b).isEnabled ? (V(), q("div", Hs, [
2480
+ s(g).isEnabled ? (V(), q("div", Hs, [
2480
2481
  e("span", Ts, p(s(u)("inventory.integration.netsuite.subsidiaryHierarchy.filtering")), 1),
2481
2482
  _(Nt),
2482
2483
  _(Je, null, {
@@ -2492,7 +2493,7 @@ Last refreshed: ${new Date($.value).toLocaleString()}` : f;
2492
2493
  ]),
2493
2494
  _: 1
2494
2495
  }, 8, ["search", "filter-attributes", "filter"]),
2495
- (V(), ne(x, {
2496
+ (V(), ne(S, {
2496
2497
  style: kt(s(H).tableHeight),
2497
2498
  "column-defs": s(R),
2498
2499
  "row-data": U.value,