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