@feedmepos/mf-inventory-portal 0.0.21-dev.4 → 0.0.21-dev.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/dist/ApprovalView-BHoJzHuo.js +129 -0
  2. package/dist/{BindingsDialog-BFLeun5L.js → BindingsDialog-sUZjZtSl.js} +1 -1
  3. package/dist/{BindingsPicker-CnjJZH9t.js → BindingsPicker-CqzSUVc_.js} +1 -1
  4. package/dist/{BindingsTable-C3VTa0YL.js → BindingsTable-C1o5EgLy.js} +1 -1
  5. package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DYBTXD_J.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-CpN5Kn8b.js} +1 -1
  6. package/dist/{IngredientsView-CQYJfAze.js → IngredientsView-CrXPIQme.js} +99 -91
  7. package/dist/IntegrationView-BJT-KMVp.js +1141 -0
  8. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-Wv8RvXJL.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DH0CcGmX.js} +1 -1
  9. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-DsOGlAb7.js → PremiumBadge.vue_vue_type_script_setup_true_lang-kJKVCH40.js} +1 -1
  10. package/dist/{PurchaseOrderPrintPreview-B0hDduXB.js → PurchaseOrderPrintPreview-k26o__vy.js} +1 -1
  11. package/dist/ReceiveRequestView-ysOzzBTW.js +216 -0
  12. package/dist/{RecipeView-DYKhSgtw.js → RecipeView-DAH8YIzY.js} +182 -174
  13. package/dist/{StockView-BIGGG87A.js → StockView-BlCpuSLe.js} +547 -539
  14. package/dist/{SupplierView-DQzopnzt.js → SupplierView-Bwknjcke.js} +263 -255
  15. package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-D8-sMRGm.js → TransferDetails.vue_vue_type_script_setup_true_lang-LCNiBfi7.js} +3 -3
  16. package/dist/{TransferDialog.vue_vue_type_script_setup_true_lang-CSUnXAyq.js → TransferDialog.vue_vue_type_script_setup_true_lang-BDvtif2q.js} +4 -4
  17. package/dist/{TransferTemplateView-DWF54okN.js → TransferTemplateView-DcMdNiH6.js} +372 -364
  18. package/dist/{UnitView-Cdw8xxzV.js → UnitView-BVMr4KlR.js} +186 -178
  19. package/dist/{WarehouseView-DOelxuIh.js → WarehouseView-Dd-e-IlG.js} +388 -380
  20. package/dist/{app-SBnQEeEV.js → app-S6iG6Hux.js} +4 -4
  21. package/dist/app.js +1 -1
  22. package/dist/{decimal-BlEB2PrM.js → decimal-nOOdFIFP.js} +1 -1
  23. package/dist/{id-to-date-Y6berpHs.js → id-to-date-CKQ0n3Qi.js} +1 -1
  24. package/dist/{purchase-order-transaction-type-Dp0wsGal.js → purchase-order-transaction-type-CQ-RpJ0h.js} +2 -2
  25. package/dist/{supplier-I_rYvljH.js → supplier-DQsAfn3q.js} +1 -1
  26. package/dist/tsconfig.app.tsbuildinfo +1 -1
  27. package/dist/{xlsx-DGwG2ekM.js → xlsx-Dgjf-KvE.js} +1 -1
  28. package/dist/{xlsx.util-Dsf-EgrG.js → xlsx.util-CODYzgF8.js} +2 -2
  29. package/package.json +3 -3
  30. package/dist/ApprovalView-BS4jzhAR.js +0 -121
  31. package/dist/IntegrationView-9V2OcyP_.js +0 -1172
  32. package/dist/ReceiveRequestView-3boFHkOO.js +0 -208
@@ -1,19 +1,19 @@
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, u as dt, _ as mt, a as pt } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DYBTXD_J.js";
3
- import { n as Xe, j as ue, o as vt, c as Pe, p as ft, u as Te, q as Oe, r as De, a as ie, k as yt, t as ge, m as Me, A as _t, M as kt, l as fe, s as ht, v as Z, w as gt, x as ze, R as bt, y as xt, z as St, B as Ze, D as q, E as $t, f as et, G as je, H as wt, d as Ye, b as Bt, J as Ft, K as At, C as Be, L as Vt, N as Ct, O as Dt, P as Mt } from "./app-SBnQEeEV.js";
1
+ import { ref as H, defineComponent as re, computed as U, resolveComponent as M, openBlock as B, createBlock as O, withCtx as D, createElementVNode as n, normalizeClass as he, toDisplayString as b, createVNode as x, createElementBlock as L, Fragment as ne, renderList as ae, unref as v, h as ye, watch as ge, isRef as Ue, createCommentVNode as te, reactive as it, onMounted as Je, normalizeStyle as Qe, createTextVNode as ve, Teleport as ut, normalizeProps as we, mergeProps as Be } from "vue";
2
+ import { i as ct, u as dt, _ as mt, a as pt } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-CpN5Kn8b.js";
3
+ import { n as Xe, j as ue, o as vt, c as Pe, p as ft, u as Te, q as Oe, r as De, a as ie, k as yt, t as be, m as Me, A as _t, M as kt, l as fe, s as ht, v as ee, w as gt, x as ze, R as bt, y as xt, z as St, B as Ze, D as W, E as $t, f as et, G as je, H as wt, d as Ye, b as Bt, J as Ft, K as At, C as Fe, L as Vt, N as Ct, O as Dt, P as Mt } from "./app-S6iG6Hux.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 jt } from "@feedmepos/ui-library";
6
6
  import { c as It, _ as Ut, F as Ke } from "./TableActionableRow.vue_vue_type_script_setup_true_lang-DlNJ6kRg.js";
7
- import { g as be } from "./decimal-BlEB2PrM.js";
8
- import { e as Pt, i as ot } from "./id-to-date-Y6berpHs.js";
9
- import { _ as Ie, S as Fe, g as st } from "./StockForecast.vue_vue_type_style_index_0_lang-KLXSWvo5.js";
7
+ import { g as xe } from "./decimal-nOOdFIFP.js";
8
+ import { e as Pt, i as ot } from "./id-to-date-CKQ0n3Qi.js";
9
+ import { _ as Ie, S as Ae, 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-DsOGlAb7.js";
11
+ import { u as at, _ as Ge } from "./PremiumBadge.vue_vue_type_script_setup_true_lang-kJKVCH40.js";
12
12
  import { defineStore as Rt } from "pinia";
13
- import { _ as Ht } from "./NumberPrecisionInput.vue_vue_type_script_setup_true_lang-Wv8RvXJL.js";
13
+ import { _ as Ht } from "./NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DH0CcGmX.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, d) => {
16
+ const $e = Xe((c, d) => {
17
17
  const r = ue(), s = tt(), S = de();
18
18
  return d.onError(async (l) => {
19
19
  l.name === "SvcForbiddenError" && (S == null || S.open({
@@ -27,16 +27,16 @@ const Se = Xe((c, d) => {
27
27
  return await d.get(a);
28
28
  },
29
29
  async readSkuBalance() {
30
- var h;
30
+ var g;
31
31
  const l = r.currentLocationDBName, a = `${c.inventoryBackendUrl}/${l}/sku/balance`;
32
- return (((h = s.currentBusiness.value) == null ? void 0 : h.menuVersion) ?? "") === "v3" ? await d.get(a) : await d.get(`${a}?useInventoryDoc=true`);
32
+ return (((g = s.currentBusiness.value) == null ? void 0 : g.menuVersion) ?? "") === "v3" ? await d.get(a) : await d.get(`${a}?useInventoryDoc=true`);
33
33
  },
34
34
  async readSingleAdjustment(l) {
35
35
  const a = r.currentLocationDBName, i = `${c.inventoryBackendUrl}/${a}/adjustment`;
36
36
  return await d.get(`${i}?adjustmentId=${l}`);
37
37
  },
38
38
  async readStockAdjustment(l, a, i) {
39
- const h = r.currentLocationDBName, k = `${c.inventoryBackendUrl}/${h}/sku`;
39
+ const g = r.currentLocationDBName, k = `${c.inventoryBackendUrl}/${g}/sku`;
40
40
  return await d.get(`${k}?skuId=${l}&start=${a}&end=${i}`);
41
41
  },
42
42
  async convertSku(l) {
@@ -51,13 +51,13 @@ const Se = Xe((c, d) => {
51
51
  },
52
52
  recalculation: {
53
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`;
54
+ var g;
55
+ const a = `business_${(g = s.currentBusiness.value) == null ? void 0 : g._id}`, i = `${c.inventoryBackendUrl}/${a}/stock/operations/recalculate`;
56
56
  return d.get(i);
57
57
  },
58
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`;
59
+ var g;
60
+ const a = `business_${(g = s.currentBusiness.value) == null ? void 0 : g._id}`, i = `${c.inventoryBackendUrl}/${a}/stock/operations/recalculate?refundFromPreviousAdjustment=true`;
61
61
  return d.post(i);
62
62
  }
63
63
  }
@@ -72,8 +72,8 @@ function Lt() {
72
72
  productBalance: []
73
73
  };
74
74
  }
75
- const _e = R(Lt()), He = () => {
76
- const c = Se();
75
+ const _e = H(Lt()), He = () => {
76
+ const c = $e();
77
77
  return {
78
78
  // state
79
79
  get stockBalance() {
@@ -147,15 +147,15 @@ async function zt(c) {
147
147
  {
148
148
  name: "Balance",
149
149
  selector: (s) => {
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);
150
+ const S = Se(s, s.unit);
151
+ return S.type === "unit" ? xe(s.balance, s.unit, null, !1) : xe(s.balance, s.unit, S.measurement, !1);
152
152
  }
153
153
  },
154
154
  {
155
155
  name: "Unit",
156
156
  selector: (s) => {
157
157
  var l;
158
- const S = xe(s, s.unit);
158
+ const S = Se(s, s.unit);
159
159
  return S.type === "unit" ? s.unit.abbrev : ((l = s.unit.measurements.find((a) => a.id === S.measurement)) == null ? void 0 : l.abbrev) || "";
160
160
  }
161
161
  }
@@ -165,7 +165,7 @@ async function zt(c) {
165
165
  r
166
166
  );
167
167
  }
168
- function xe(c, d) {
168
+ function Se(c, d) {
169
169
  const r = localStorage.getItem(`uom:${c._id}`);
170
170
  return r ? r === d._id ? {
171
171
  type: "unit"
@@ -195,17 +195,17 @@ const Yt = { class: "fm-typo-en-body-md-400 flex-grow" }, rt = /* @__PURE__ */ r
195
195
  }
196
196
  function r(k) {
197
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);
198
+ k ? localStorage.setItem(u, k) : localStorage.setItem(u, s.unit._id), S.value = Se(s.sku, s.unit);
199
199
  }
200
- const s = c, S = R(xe(s.sku, s.unit)), l = T(() => {
200
+ const s = c, S = H(Se(s.sku, s.unit)), l = U(() => {
201
201
  const { measurements: k } = s.unit;
202
202
  return [
203
203
  {
204
- label: `${be(s.amount, s.unit)}`,
204
+ label: `${xe(s.amount, s.unit)}`,
205
205
  value: null
206
206
  },
207
207
  ...k.map(({ id: u }) => ({
208
- label: `${be(s.amount, s.unit, u)}`,
208
+ label: `${xe(s.amount, s.unit, u)}`,
209
209
  value: u
210
210
  }))
211
211
  ];
@@ -213,24 +213,24 @@ const Yt = { class: "fm-typo-en-body-md-400 flex-grow" }, rt = /* @__PURE__ */ r
213
213
  function a({ value: k }) {
214
214
  return v(S).type === "unit" ? k === null : k === v(S).measurement;
215
215
  }
216
- const i = T(
216
+ const i = U(
217
217
  () => {
218
218
  var k;
219
219
  return ((k = l.value.find((u) => a(u))) == null ? void 0 : k.label) ?? "";
220
220
  }
221
- ), h = R(!1);
221
+ ), g = H(!1);
222
222
  return (k, u) => {
223
- const o = D("FmIcon"), w = D("FmMenuItem"), A = D("FmMenu");
224
- return B(), O(A, {
223
+ const o = M("FmIcon"), $ = M("FmMenuItem"), F = M("FmMenu");
224
+ return B(), O(F, {
225
225
  "stop-click-propagation": "",
226
- onMenuChanged: u[0] || (u[0] = (g) => h.value = g)
226
+ onMenuChanged: u[0] || (u[0] = (h) => g.value = h)
227
227
  }, {
228
- "menu-button": C(() => [
228
+ "menu-button": D(() => [
229
229
  n("button", {
230
230
  type: "button",
231
- class: Ce([
231
+ class: he([
232
232
  "w-full text-left flex items-center gap-8 cursor-pointer fm-corner-radius-sm px-8 py-4 border bg-white",
233
- h.value ? "border-fm-color-primary" : "border-fm-color-neutral-gray-100"
233
+ g.value ? "border-fm-color-primary" : "border-fm-color-neutral-gray-100"
234
234
  ])
235
235
  }, [
236
236
  n("div", Yt, b(i.value), 1),
@@ -240,12 +240,12 @@ const Yt = { class: "fm-typo-en-body-md-400 flex-grow" }, rt = /* @__PURE__ */ r
240
240
  })
241
241
  ], 2)
242
242
  ]),
243
- default: C(() => [
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)
243
+ default: D(() => [
244
+ (B(!0), L(ne, null, ae(l.value, (h) => (B(), O($, {
245
+ key: h.value ?? 0,
246
+ label: h.label,
247
+ "model-value": a(h),
248
+ onClick: (p) => r(h.value)
249
249
  }, null, 8, ["label", "model-value", "onClick"]))), 128))
250
250
  ]),
251
251
  _: 1
@@ -257,14 +257,14 @@ const Yt = { class: "fm-typo-en-body-md-400 flex-grow" }, rt = /* @__PURE__ */ r
257
257
  setup(c) {
258
258
  const { t: d } = le();
259
259
  return (r, s) => (B(), O(Tt, null, {
260
- default: C(() => [
260
+ default: D(() => [
261
261
  n("div", Kt, b(v(d)("inventory.stock.prediction.daysRemaining")), 1)
262
262
  ]),
263
263
  _: 1
264
264
  }));
265
265
  }
266
266
  }), lt = Rt("stockActions", () => {
267
- const c = R(!1), d = ue(), r = He(), s = at(), S = de(), l = nt(), { t: a } = le();
267
+ const c = H(!1), d = ue(), r = He(), s = at(), S = de(), l = nt(), { t: a } = le();
268
268
  async function i() {
269
269
  if (d._currentLocation) {
270
270
  c.value = !0;
@@ -281,74 +281,74 @@ const Yt = { class: "fm-typo-en-body-md-400 flex-grow" }, rt = /* @__PURE__ */ r
281
281
  }
282
282
  }
283
283
  }
284
- const h = R();
284
+ const g = H();
285
285
  async function k(p) {
286
- var F, j, I;
287
- if (!!!((j = (F = p.convert) == null ? void 0 : F.inventoryBindings) != null && j.length)) {
286
+ var w, C, P;
287
+ if (!!!((C = (w = p.convert) == null ? void 0 : w.inventoryBindings) != null && C.length)) {
288
288
  l.open({
289
289
  title: a("inventory.stock.error.convert.title"),
290
290
  message: a("inventory.stock.error.convert.message")
291
291
  });
292
292
  return;
293
293
  }
294
- const $ = {
295
- maxCount: ((I = r.productBalance.find(({ id: E }) => E === p._id)) == null ? void 0 : I.count) || 0,
294
+ const V = {
295
+ maxCount: ((P = r.productBalance.find(({ id: T }) => T === p._id)) == null ? void 0 : P.count) || 0,
296
296
  sku: p,
297
297
  show: !0,
298
- "onUpdate:show"(E) {
299
- h.value.show = E;
298
+ "onUpdate:show"(T) {
299
+ g.value.show = T;
300
300
  },
301
301
  onSubmitted() {
302
302
  i();
303
303
  }
304
304
  };
305
- h.value = $;
305
+ g.value = V;
306
306
  }
307
- const u = R();
307
+ const u = H();
308
308
  async function o(p) {
309
- const M = {
309
+ const j = {
310
310
  stock: p,
311
311
  show: !0,
312
- "onUpdate:show"(H) {
313
- u.value.show = H;
312
+ "onUpdate:show"(E) {
313
+ u.value.show = E;
314
314
  },
315
315
  onSubmitted() {
316
316
  i();
317
317
  }
318
318
  };
319
- u.value = M;
319
+ u.value = j;
320
320
  }
321
- const w = R();
322
- async function A(p) {
323
- const M = {
321
+ const $ = H();
322
+ async function F(p) {
323
+ const j = {
324
324
  sku: p,
325
325
  show: !0,
326
- "onUpdate:show"(H) {
327
- w.value.show = H;
326
+ "onUpdate:show"(E) {
327
+ $.value.show = E;
328
328
  }
329
329
  };
330
- w.value = M;
330
+ $.value = j;
331
331
  }
332
- function g(p, M) {
333
- const H = Pe(M);
332
+ function h(p, j) {
333
+ const E = Pe(j);
334
334
  switch (p) {
335
335
  case ke.History:
336
- A(H);
336
+ F(E);
337
337
  return;
338
338
  case ke.Convert:
339
- k(H);
339
+ k(E);
340
340
  return;
341
341
  case ke.Adjust:
342
- o(H);
342
+ o(E);
343
343
  return;
344
344
  }
345
345
  }
346
346
  return {
347
347
  fetchStockBalance: i,
348
- onActionMenu: g,
349
- stockHistoryProps: w,
350
- showSkuHistory: A,
351
- convertSkuDialogProps: h,
348
+ onActionMenu: h,
349
+ stockHistoryProps: $,
350
+ showSkuHistory: F,
351
+ convertSkuDialogProps: g,
352
352
  adjustSkuDialogProps: u
353
353
  };
354
354
  });
@@ -395,10 +395,10 @@ function qt() {
395
395
  return ye(Ie, {
396
396
  days: l
397
397
  });
398
- const h = l <= a ? Fe.low : l <= i ? Fe.mid : Fe.high;
398
+ const g = l <= a ? Ae.low : l <= i ? Ae.mid : Ae.high;
399
399
  return ye(Ie, {
400
400
  days: l,
401
- level: h
401
+ level: g
402
402
  });
403
403
  },
404
404
  size: 200
@@ -468,94 +468,94 @@ const Jt = { class: "flex items-center" }, Qt = { class: "fm-typo-en-title-md-80
468
468
  },
469
469
  emits: ["update:show", "submitted"],
470
470
  setup(c, { expose: d, emit: r }) {
471
- const s = c, S = r, l = ft(), a = Te(), i = Se(), h = de(), { t: k } = le(), u = R(0), o = R(null), w = T(() => a.skus), A = T(
471
+ const s = c, S = r, l = ft(), a = Te(), i = $e(), g = de(), { t: k } = le(), u = H(0), o = H(null), $ = U(() => a.skus), F = U(
472
472
  () => {
473
- var e, t;
474
- return (((t = (e = s.sku) == null ? void 0 : e.convert) == null ? void 0 : t.inventoryBindings) ?? []).filter(
473
+ var t, e;
474
+ return (((e = (t = s.sku) == null ? void 0 : t.convert) == null ? void 0 : e.inventoryBindings) ?? []).filter(
475
475
  (f) => f.type === Oe.enum.SKU
476
476
  );
477
477
  }
478
- ), g = T({
478
+ ), h = U({
479
479
  get() {
480
480
  return !!o.value;
481
481
  },
482
- set(e) {
483
- e ? o.value = Pe(A.value) : (o.value = null, u.value = Math.min(u.value, s.maxCount ?? 0));
482
+ set(t) {
483
+ t ? o.value = Pe(F.value) : (o.value = null, u.value = Math.min(u.value, s.maxCount ?? 0));
484
484
  }
485
- }), p = R(!1);
486
- he([() => s.show], ([e]) => {
487
- e && (u.value = 0);
485
+ }), p = H(!1);
486
+ ge([() => s.show], ([t]) => {
487
+ t && (u.value = 0);
488
488
  });
489
- function M() {
490
- W(s.sku, ge(u.value), o.value);
489
+ function j() {
490
+ Q(s.sku, be(u.value), o.value);
491
491
  }
492
- function H(e) {
492
+ function E(t) {
493
493
  if (o.value)
494
494
  return !0;
495
- const t = qe(e).isInteger().max(s.maxCount ?? 0).error ?? "";
496
- return t || !0;
495
+ const e = qe(t).isInteger().max(s.maxCount ?? 0).error ?? "";
496
+ return e || !0;
497
497
  }
498
- function $(e) {
498
+ function V(t) {
499
499
  var y;
500
- const t = (y = s.sku.convert) != null && y.measurement ? s.sku.unit.measurements.find((V) => {
501
- var K;
502
- return V.id === ((K = s.sku.convert) == null ? void 0 : K.measurement);
503
- }) ?? null : null, f = De(s.sku.unit, t), m = ht(+e);
500
+ const e = (y = s.sku.convert) != null && y.measurement ? s.sku.unit.measurements.find((A) => {
501
+ var z;
502
+ return A.id === ((z = s.sku.convert) == null ? void 0 : z.measurement);
503
+ }) ?? null : null, f = De(s.sku.unit, e), m = ht(+t);
504
504
  return qe(m).isInteger().max(f).error ? "Precision cannot be more than " + f : !0;
505
505
  }
506
- const F = T(
506
+ const w = U(
507
507
  () => {
508
- var e, t;
509
- return (e = s.sku.convert) != null && e.measurement ? (t = s.sku.unit.measurements.find((f) => {
508
+ var t, e;
509
+ return (t = s.sku.convert) != null && t.measurement ? (e = s.sku.unit.measurements.find((f) => {
510
510
  var m;
511
511
  return f.id === ((m = s.sku.convert) == null ? void 0 : m.measurement);
512
- })) == null ? void 0 : t.abbrev : s.sku.unit.abbrev;
512
+ })) == null ? void 0 : e.abbrev : s.sku.unit.abbrev;
513
513
  }
514
- ), j = T(() => {
514
+ ), C = U(() => {
515
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");
517
- return (_ = o.value ?? e) == null ? void 0 : _.map((y) => {
518
- var X, G, se, Ee, Le;
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) => {
516
+ const t = (m = (f = s.sku.convert) == null ? void 0 : f.inventoryBindings) == null ? void 0 : m.filter((y) => y.type === "SKU");
517
+ return (_ = o.value ?? t) == null ? void 0 : _.map((y) => {
518
+ var Z, q, se, Ee, Le;
519
+ const A = a.skus.find((pe) => pe._id === y.id), z = ((Z = y.measurement) == null ? void 0 : Z.abbrev) ?? ((q = A == null ? void 0 : A.unit) == null ? void 0 : q.abbrev), X = (se = s.sku.convert) != null && se.measurement ? s.sku.unit.measurements.find((pe) => {
520
520
  var Ne;
521
521
  return pe.id === ((Ne = s.sku.convert) == null ? void 0 : Ne.measurement);
522
- }) ?? null : null, me = De(s.sku.unit, Q), U = $(`${u.value}`) === !0 ? ie(
522
+ }) ?? null : null, me = De(s.sku.unit, X), I = V(`${u.value}`) === !0 ? ie(
523
523
  yt(
524
524
  y.amount,
525
- ge(+u.value, me)
525
+ be(+u.value, me)
526
526
  ),
527
527
  !1
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;
528
+ ) : "0", G = (Le = (Ee = o.value) == null ? void 0 : Ee.find((pe) => pe.id === (A == null ? void 0 : A._id))) == null ? void 0 : Le.amount, J = G ? ie(G, !1) : null;
529
529
  return {
530
- sku: V,
531
- convertAmount: J ?? U,
532
- abbrev: K
530
+ sku: A,
531
+ convertAmount: J ?? I,
532
+ abbrev: z
533
533
  };
534
534
  });
535
- }), I = R();
535
+ }), P = H();
536
536
  d({
537
537
  validateInputs: () => {
538
- var e, t;
539
- (t = (e = I.value) == null ? void 0 : e.validateInputs) == null || t.call(e);
538
+ var t, e;
539
+ (e = (t = P.value) == null ? void 0 : t.validateInputs) == null || e.call(t);
540
540
  },
541
541
  resetInputsValidation: () => {
542
- var e, t;
543
- (t = (e = I.value) == null ? void 0 : e.resetInputsValidation) == null || t.call(e);
542
+ var t, e;
543
+ (e = (t = P.value) == null ? void 0 : t.resetInputsValidation) == null || e.call(t);
544
544
  },
545
545
  resetInputs: () => {
546
- var e, t;
547
- (t = (e = I.value) == null ? void 0 : e.resetInputs) == null || t.call(e);
546
+ var t, e;
547
+ (e = (t = P.value) == null ? void 0 : t.resetInputs) == null || e.call(t);
548
548
  }
549
549
  });
550
- const E = Re(s, "show");
551
- async function W(e, t, f) {
550
+ const T = Re(s, "show");
551
+ async function Q(t, e, f) {
552
552
  p.value = !0;
553
553
  try {
554
554
  await i.convertSku({
555
555
  conversions: [
556
556
  {
557
- doc: e,
558
- amount: t,
557
+ doc: t,
558
+ amount: e,
559
559
  overrides: f == null ? void 0 : f.map((m) => ({
560
560
  ...m,
561
561
  amount: {
@@ -568,93 +568,93 @@ const Jt = { class: "flex items-center" }, Qt = { class: "fm-typo-en-title-md-80
568
568
  ]
569
569
  }), S("update:show", !1), S("submitted");
570
570
  } catch (m) {
571
- h.open({
571
+ g.open({
572
572
  title: "Something went wrong",
573
- message: `Cannot convert ${e.name}. Please try again.`,
573
+ message: `Cannot convert ${t.name}. Please try again.`,
574
574
  type: "error"
575
- }), console.error("error at converting stock amount", e, t, m);
575
+ }), console.error("error at converting stock amount", t, e, m);
576
576
  } finally {
577
577
  p.value = !1;
578
578
  }
579
579
  }
580
- function z(e, t, f) {
581
- const m = +t;
580
+ function Y(t, e, f) {
581
+ const m = +e;
582
582
  let _ = f;
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 = _;
583
+ e.length > 0 && isFinite(m) ? _ = f.map((y) => (y.id !== t || (y.amount = fe(m)), y)) : _ = f.map((y) => (y.id !== t || (y.amount = { amount: 0, precision: 0 }), y)), o.value = _;
584
584
  }
585
- function P(e) {
586
- const t = w.value.find((f) => f._id === e);
587
- return t ? st(t.unit, !0) : [];
585
+ function N(t) {
586
+ const e = $.value.find((f) => f._id === t);
587
+ return e ? st(e.unit, !0) : [];
588
588
  }
589
- function N(e, t) {
590
- const f = P(e), m = f.find((_) => _.value === t) ?? f.find((_) => _.value === null);
589
+ function R(t, e) {
590
+ const f = N(t), m = f.find((_) => _.value === e) ?? f.find((_) => _.value === null);
591
591
  return m ? {
592
592
  ...m,
593
593
  label: m.abbrev
594
594
  } : null;
595
595
  }
596
- function ne(e, t, f) {
596
+ function K(t, e, f) {
597
597
  let m;
598
- if (t === null)
599
- m = f.map((_) => (_.id !== e || (_.measurement = null), _)) ?? [];
598
+ if (e === null)
599
+ m = f.map((_) => (_.id !== t || (_.measurement = null), _)) ?? [];
600
600
  else {
601
- const _ = w.value.find((y) => y._id === e);
601
+ const _ = $.value.find((y) => y._id === t);
602
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;
603
+ var A, z;
604
+ return y.id !== t || (y.measurement = (z = (A = _ == null ? void 0 : _.unit) == null ? void 0 : A.measurements) == null ? void 0 : z.find((X) => X.id === e)), y;
605
605
  }) ?? [];
606
606
  }
607
607
  o.value = m;
608
608
  }
609
- function ce(e, t) {
610
- const f = t.filter((m) => m.id !== e);
609
+ function ce(t, e) {
610
+ const f = e.filter((m) => m.id !== t);
611
611
  o.value = f;
612
612
  }
613
613
  function oe() {
614
- const e = (o.value ?? []).map((t) => ({
615
- ...t,
614
+ const t = (o.value ?? []).map((e) => ({
615
+ ...e,
616
616
  type: Oe.enum.SKU
617
617
  }));
618
618
  l.promptIngredientsBinding(
619
- e,
620
- (t) => o.value = t,
619
+ t,
620
+ (e) => o.value = e,
621
621
  s.sku._id
622
622
  );
623
623
  }
624
- return he(
624
+ return ge(
625
625
  () => s.show,
626
- (e) => {
627
- e || (o.value = null, u.value = 0);
626
+ (t) => {
627
+ t || (o.value = null, u.value = 0);
628
628
  }
629
- ), (e, t) => {
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");
629
+ ), (t, e) => {
630
+ const f = M("FmTextField"), m = M("FmForm"), _ = M("FmCard"), y = M("FmSwitch"), A = M("FmFormGroup"), z = M("FmSelect"), X = M("FmButton"), me = M("FmSideSheet");
631
631
  return B(), O(me, {
632
632
  "dismiss-away": "",
633
- modelValue: v(E),
634
- "onUpdate:modelValue": t[3] || (t[3] = (U) => Ue(E) ? E.value = U : null),
633
+ modelValue: v(T),
634
+ "onUpdate:modelValue": e[3] || (e[3] = (I) => Ue(T) ? T.value = I : null),
635
635
  "max-width": 500
636
636
  }, {
637
- "side-sheet-header": C(() => [
637
+ "side-sheet-header": D(() => [
638
638
  n("div", Jt, [
639
- n("div", Qt, b(v(k)("inventory.stock.convert.title", { name: e.sku.name })), 1)
639
+ n("div", Qt, b(v(k)("inventory.stock.convert.title", { name: t.sku.name })), 1)
640
640
  ])
641
641
  ]),
642
- default: C(() => [
642
+ default: D(() => [
643
643
  n("div", Xt, [
644
644
  x(m, {
645
645
  ref_key: "formRef",
646
- ref: I,
647
- onValidationSuccess: M
646
+ ref: P,
647
+ onValidationSuccess: j
648
648
  }, {
649
- default: C(() => [
649
+ default: D(() => [
650
650
  x(f, {
651
651
  disabled: p.value,
652
652
  "model-value": u.value,
653
- "onUpdate:modelValue": t[0] || (t[0] = (U) => u.value = U),
653
+ "onUpdate:modelValue": e[0] || (e[0] = (I) => u.value = I),
654
654
  label: v(k)("inventory.stock.convert.amount"),
655
- rules: [H, $, v(Me)(0)],
656
- "append-text": F.value,
657
- "helper-text": o.value ? void 0 : `Max ${e.maxCount} ${F.value}`
655
+ rules: [E, V, v(Me)(0)],
656
+ "append-text": w.value,
657
+ "helper-text": o.value ? void 0 : `Max ${t.maxCount} ${w.value}`
658
658
  }, null, 8, ["disabled", "model-value", "label", "rules", "append-text", "helper-text"])
659
659
  ]),
660
660
  _: 1
@@ -663,17 +663,17 @@ const Jt = { class: "flex items-center" }, Qt = { class: "fm-typo-en-title-md-80
663
663
  variant: "outlined",
664
664
  class: "p-16"
665
665
  }, {
666
- default: C(() => [
666
+ default: D(() => [
667
667
  n("div", Zt, [
668
668
  n("div", en, b(v(k)("inventory.stock.convert.deductionSummary")), 1),
669
- (B(!0), L(te, null, ae(j.value, (U) => {
670
- var Y, J;
669
+ (B(!0), L(ne, null, ae(C.value, (I) => {
670
+ var G, J;
671
671
  return B(), L("div", {
672
- key: (Y = U.sku) == null ? void 0 : Y._id,
672
+ key: (G = I.sku) == null ? void 0 : G._id,
673
673
  class: "flex items-center"
674
674
  }, [
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)
675
+ n("div", tn, b((J = I.sku) == null ? void 0 : J.name), 1),
676
+ n("div", nn, " -" + b(I.convertAmount) + " " + b(I.abbrev), 1)
677
677
  ]);
678
678
  }), 128))
679
679
  ])
@@ -681,65 +681,65 @@ const Jt = { class: "flex items-center" }, Qt = { class: "fm-typo-en-title-md-80
681
681
  _: 1
682
682
  }),
683
683
  x(_, { variant: "outlined" }, {
684
- default: C(() => [
684
+ default: D(() => [
685
685
  n("div", on, [
686
686
  x(y, {
687
687
  value: "",
688
- modelValue: g.value,
689
- "onUpdate:modelValue": t[1] || (t[1] = (U) => g.value = U),
688
+ modelValue: h.value,
689
+ "onUpdate:modelValue": e[1] || (e[1] = (I) => h.value = I),
690
690
  label: v(k)("inventory.stock.convert.overrideDeduction"),
691
691
  "label-placement": "right"
692
692
  }, null, 8, ["modelValue", "label"]),
693
- g.value ? (B(), L(te, { key: 0 }, [
694
- x(V, {
693
+ h.value ? (B(), L(ne, { key: 0 }, [
694
+ x(A, {
695
695
  modelValue: o.value,
696
696
  rules: [v(_t)(1, "Must have at least one ingredient binding")]
697
697
  }, null, 8, ["modelValue", "rules"]),
698
698
  n("div", sn, [
699
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,
700
+ (B(!0), L(ne, null, ae(o.value, (I) => (B(), O(A, {
701
+ key: I.id,
702
702
  disabled: p.value,
703
- modelValue: +v(ie)(U.amount ?? { amount: 1, precision: 0 }),
703
+ modelValue: +v(ie)(I.amount ?? { amount: 1, precision: 0 }),
704
704
  rules: [
705
705
  v(kt)(
706
- w.value.find((Y) => Y._id === U.id).unit,
707
- U.measurement
706
+ $.value.find((G) => G._id === I.id).unit,
707
+ I.measurement
708
708
  ),
709
709
  v(Me)(0)
710
710
  ]
711
711
  }, {
712
- default: C(({ invalid: Y }) => {
713
- var J, X, G;
712
+ default: D(({ invalid: G }) => {
713
+ var J, Z, q;
714
714
  return [
715
715
  n("div", rn, [
716
- n("div", ln, b((J = w.value.find((se) => se._id === U.id)) == null ? void 0 : J.name), 1),
716
+ n("div", ln, b((J = $.value.find((se) => se._id === I.id)) == null ? void 0 : J.name), 1),
717
717
  x(f, {
718
718
  class: "xs:col-span-2",
719
719
  disabled: p.value,
720
720
  modelValue: +v(ie)(
721
- U.amount ?? { amount: 1, precision: 0 }
721
+ I.amount ?? { amount: 1, precision: 0 }
722
722
  ),
723
- "onUpdate:modelValue": (se) => z(U.id, se, o.value ?? []),
724
- invalid: Y
723
+ "onUpdate:modelValue": (se) => Y(I.id, se, o.value ?? []),
724
+ invalid: G
725
725
  }, null, 8, ["disabled", "modelValue", "onUpdate:modelValue", "invalid"]),
726
- x(K, {
726
+ x(z, {
727
727
  disabled: p.value,
728
728
  class: "translate-y-[2px]",
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 ?? []),
732
- invalid: Y
729
+ items: N(I.id),
730
+ "model-value": (q = R(I.id, (Z = I.measurement) == null ? void 0 : Z.id)) == null ? void 0 : q.value,
731
+ "onUpdate:modelValue": (se) => K(I.id, se, o.value ?? []),
732
+ invalid: G
733
733
  }, {
734
- "helper-text": C(() => t[4] || (t[4] = [])),
734
+ "helper-text": D(() => e[4] || (e[4] = [])),
735
735
  _: 2
736
736
  }, 1032, ["disabled", "items", "model-value", "onUpdate:modelValue", "invalid"]),
737
- x(Q, {
737
+ x(X, {
738
738
  disabled: p.value,
739
739
  type: "button",
740
740
  variant: "tertiary",
741
741
  icon: "delete",
742
- onClick: (se) => ce(U.id, o.value ?? [])
742
+ onClick: (se) => ce(I.id, o.value ?? [])
743
743
  }, null, 8, ["disabled", "onClick"])
744
744
  ])
745
745
  ];
@@ -748,28 +748,28 @@ const Jt = { class: "flex items-center" }, Qt = { class: "fm-typo-en-title-md-80
748
748
  }, 1032, ["disabled", "modelValue", "rules"]))), 128))
749
749
  ]),
750
750
  n("div", null, [
751
- x(Q, {
751
+ x(X, {
752
752
  icon: "link",
753
753
  label: v(k)("inventory.stock.convert.linkIngredient"),
754
754
  variant: "plain",
755
755
  onClick: oe
756
756
  }, null, 8, ["label"])
757
757
  ])
758
- ], 64)) : ee("", !0)
758
+ ], 64)) : te("", !0)
759
759
  ])
760
760
  ]),
761
761
  _: 1
762
762
  })
763
763
  ])
764
764
  ]),
765
- "side-sheet-footer": C(() => [
765
+ "side-sheet-footer": D(() => [
766
766
  n("div", un, [
767
- x(Q, {
767
+ x(X, {
768
768
  loading: p.value,
769
769
  label: v(k)("inventory.stock.convert.convertButton"),
770
- onClick: t[2] || (t[2] = (U) => {
771
- var Y, J;
772
- return (J = (Y = I.value) == null ? void 0 : Y.validateInputs) == null ? void 0 : J.call(Y);
770
+ onClick: e[2] || (e[2] = (I) => {
771
+ var G, J;
772
+ return (J = (G = P.value) == null ? void 0 : G.validateInputs) == null ? void 0 : J.call(G);
773
773
  })
774
774
  }, null, 8, ["loading", "label"])
775
775
  ])
@@ -779,31 +779,31 @@ const Jt = { class: "flex items-center" }, Qt = { class: "fm-typo-en-title-md-80
779
779
  };
780
780
  }
781
781
  });
782
- function Ae(c, d) {
783
- const r = ge(c, d);
782
+ function Ve(c, d) {
783
+ const r = be(c, d);
784
784
  return { ...r, amount: -r.amount };
785
785
  }
786
786
  function We(c, d) {
787
- return ge(Math.abs(c), d);
787
+ return be(Math.abs(c), d);
788
788
  }
789
- const Ve = {
790
- [Z.enum.DAMAGE]: {
789
+ const Ce = {
790
+ [ee.enum.DAMAGE]: {
791
791
  label: "Waste",
792
- toAdjustmentAmount: Ae
792
+ toAdjustmentAmount: Ve
793
793
  },
794
- [Z.enum.THEFT]: {
794
+ [ee.enum.THEFT]: {
795
795
  label: "Theft",
796
- toAdjustmentAmount: Ae
796
+ toAdjustmentAmount: Ve
797
797
  },
798
- [Z.enum.LOSE]: {
798
+ [ee.enum.LOSE]: {
799
799
  label: "Lose",
800
- toAdjustmentAmount: Ae
800
+ toAdjustmentAmount: Ve
801
801
  },
802
- [Z.enum.EXTRA]: {
802
+ [ee.enum.EXTRA]: {
803
803
  label: "Extra",
804
804
  toAdjustmentAmount: We
805
805
  },
806
- [Z.enum.PURCHASE]: {
806
+ [ee.enum.PURCHASE]: {
807
807
  label: "Purchase",
808
808
  toAdjustmentAmount: We
809
809
  }
@@ -815,27 +815,27 @@ const Ve = {
815
815
  },
816
816
  emits: ["update:modelValue", "click:delete"],
817
817
  setup(c, { emit: d }) {
818
- const r = c, s = d, S = T(
819
- () => Object.keys(Ve).map((u) => ({
818
+ const r = c, s = d, S = U(
819
+ () => Object.keys(Ce).map((u) => ({
820
820
  label: gt(u),
821
821
  value: u
822
822
  }))
823
- ), l = T(() => st(r.modelValue.doc.unit, !0)), a = T({
823
+ ), l = U(() => st(r.modelValue.doc.unit, !0)), a = U({
824
824
  get() {
825
- return r.modelValue.type ?? Z.enum.PURCHASE;
825
+ return r.modelValue.type ?? ee.enum.PURCHASE;
826
826
  },
827
827
  set(u) {
828
828
  const o = {
829
829
  ...r.modelValue
830
830
  };
831
831
  o.type = u;
832
- const w = ze(r.modelValue.amount);
833
- o.amount = Ve[o.type].toAdjustmentAmount(
834
- +ie(w),
835
- w.precision
832
+ const $ = ze(r.modelValue.amount);
833
+ o.amount = Ce[o.type].toAdjustmentAmount(
834
+ +ie($),
835
+ $.precision
836
836
  ), s("update:modelValue", o);
837
837
  }
838
- }), i = T({
838
+ }), i = U({
839
839
  get() {
840
840
  const u = ze(r.modelValue.amount);
841
841
  return +ie(u);
@@ -843,25 +843,25 @@ const Ve = {
843
843
  set(u) {
844
844
  const o = {
845
845
  ...r.modelValue
846
- }, w = fe(u);
847
- o.amount = Ve[a.value].toAdjustmentAmount(
846
+ }, $ = fe(u);
847
+ o.amount = Ce[a.value].toAdjustmentAmount(
848
848
  u,
849
- w.precision
849
+ $.precision
850
850
  ), s("update:modelValue", o);
851
851
  }
852
- }), h = T({
852
+ }), g = U({
853
853
  get() {
854
854
  var u;
855
855
  return ((u = r.modelValue.measurement) == null ? void 0 : u.id) ?? null;
856
856
  },
857
857
  set(u) {
858
- var w, A;
858
+ var $, F;
859
859
  const o = {
860
860
  ...r.modelValue
861
861
  };
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);
862
+ o.measurement = ((F = ($ = r.modelValue.doc.unit) == null ? void 0 : $.measurements) == null ? void 0 : F.find((h) => h.id === u)) ?? null, s("update:modelValue", o);
863
863
  }
864
- }), k = T({
864
+ }), k = U({
865
865
  get() {
866
866
  return r.modelValue.remark ?? "";
867
867
  },
@@ -873,27 +873,27 @@ const Ve = {
873
873
  }
874
874
  });
875
875
  return (u, o) => {
876
- const w = D("FmButton"), A = D("FmSelect"), g = D("FmTextarea"), p = D("FmCard");
876
+ const $ = M("FmButton"), F = M("FmSelect"), h = M("FmTextarea"), p = M("FmCard");
877
877
  return B(), O(p, {
878
878
  variant: "outlined",
879
879
  class: "grid grid-cols-2 gap-8 p-16"
880
880
  }, {
881
- default: C(() => [
881
+ default: D(() => [
882
882
  n("div", dn, [
883
883
  n("div", mn, b(u.modelValue.doc.name), 1),
884
- x(w, {
884
+ x($, {
885
885
  variant: "tertiary",
886
886
  "prepend-icon": "delete",
887
- onClick: o[0] || (o[0] = (M) => s("click:delete"))
887
+ onClick: o[0] || (o[0] = (j) => s("click:delete"))
888
888
  })
889
889
  ]),
890
- x(A, {
890
+ x(F, {
891
891
  disabled: u.disabled,
892
892
  class: "col-span-2",
893
893
  label: "Type",
894
894
  items: S.value,
895
895
  modelValue: a.value,
896
- "onUpdate:modelValue": o[1] || (o[1] = (M) => a.value = M),
896
+ "onUpdate:modelValue": o[1] || (o[1] = (j) => a.value = j),
897
897
  rules: [v(bt)()],
898
898
  "label-mark": "required"
899
899
  }, null, 8, ["disabled", "items", "modelValue", "rules"]),
@@ -905,22 +905,22 @@ const Ve = {
905
905
  precision: v(De)(u.modelValue.doc.unit, u.modelValue.measurement)
906
906
  }),
907
907
  modelValue: i.value,
908
- "onUpdate:modelValue": o[2] || (o[2] = (M) => i.value = M),
908
+ "onUpdate:modelValue": o[2] || (o[2] = (j) => i.value = j),
909
909
  rules: [v(Me)(0)]
910
910
  }, null, 8, ["disabled", "step", "modelValue", "rules"]),
911
- x(A, {
911
+ x(F, {
912
912
  disabled: u.disabled,
913
913
  label: "Unit",
914
914
  items: l.value,
915
- modelValue: h.value,
916
- "onUpdate:modelValue": o[3] || (o[3] = (M) => h.value = M)
915
+ modelValue: g.value,
916
+ "onUpdate:modelValue": o[3] || (o[3] = (j) => g.value = j)
917
917
  }, null, 8, ["disabled", "items", "modelValue"]),
918
- x(g, {
918
+ x(h, {
919
919
  class: "col-span-2",
920
920
  disabled: u.disabled,
921
921
  label: "Remark",
922
922
  modelValue: k.value,
923
- "onUpdate:modelValue": o[4] || (o[4] = (M) => k.value = M),
923
+ "onUpdate:modelValue": o[4] || (o[4] = (j) => k.value = j),
924
924
  "label-mark": "optional"
925
925
  }, null, 8, ["disabled", "modelValue"])
926
926
  ]),
@@ -936,31 +936,31 @@ const Ve = {
936
936
  },
937
937
  emits: ["update:show", "submitted"],
938
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();
939
+ const s = c, S = r, l = Te(), a = nt(), i = $e(), g = de(), k = H(!1), { t: u } = le();
940
940
  function o() {
941
- p(Pe(g));
941
+ p(Pe(h));
942
942
  }
943
- const w = R();
943
+ const $ = H();
944
944
  d({
945
945
  validateInputs: () => {
946
- var $, F;
947
- (F = ($ = w.value) == null ? void 0 : $.validateInputs) == null || F.call($);
946
+ var V, w;
947
+ (w = (V = $.value) == null ? void 0 : V.validateInputs) == null || w.call(V);
948
948
  },
949
949
  resetInputsValidation: () => {
950
- var $, F;
951
- (F = ($ = w.value) == null ? void 0 : $.resetInputsValidation) == null || F.call($);
950
+ var V, w;
951
+ (w = (V = $.value) == null ? void 0 : V.resetInputsValidation) == null || w.call(V);
952
952
  },
953
953
  resetInputs: () => {
954
- var $, F;
955
- (F = ($ = w.value) == null ? void 0 : $.resetInputs) == null || F.call($);
954
+ var V, w;
955
+ (w = (V = $.value) == null ? void 0 : V.resetInputs) == null || w.call(V);
956
956
  }
957
957
  });
958
- const A = Re(s, "show"), g = it({
958
+ const F = Re(s, "show"), h = it({
959
959
  remark: "",
960
960
  adjustments: [
961
961
  {
962
962
  id: `sku_${(/* @__PURE__ */ new Date()).toISOString()}_${Math.random().toString(16).slice(2, 8)}`,
963
- type: Z.enum.PURCHASE,
963
+ type: ee.enum.PURCHASE,
964
964
  doc: s.stock,
965
965
  measurement: null,
966
966
  remark: "",
@@ -968,11 +968,11 @@ const Ve = {
968
968
  }
969
969
  ]
970
970
  });
971
- he([() => s.show], ([$]) => {
972
- $ && (g.remark = "", g.adjustments = [
971
+ ge([() => s.show], ([V]) => {
972
+ V && (h.remark = "", h.adjustments = [
973
973
  {
974
974
  id: `sku_${(/* @__PURE__ */ new Date()).toISOString()}_${Math.random().toString(16).slice(2, 8)}`,
975
- type: Z.enum.PURCHASE,
975
+ type: ee.enum.PURCHASE,
976
976
  doc: s.stock,
977
977
  measurement: null,
978
978
  remark: "",
@@ -980,42 +980,42 @@ const Ve = {
980
980
  }
981
981
  ]);
982
982
  });
983
- async function p($) {
983
+ async function p(V) {
984
984
  k.value = !0;
985
985
  try {
986
986
  await i.adjustSku({
987
- remark: $.remark,
988
- adjustments: $.adjustments.map(({ doc: F, remark: j, type: I, amount: E, measurement: W }) => ({
989
- id: F._id,
990
- amount: E,
991
- measurement: W,
992
- remark: j,
993
- doc: F,
994
- type: I
987
+ remark: V.remark,
988
+ adjustments: V.adjustments.map(({ doc: w, remark: C, type: P, amount: T, measurement: Q }) => ({
989
+ id: w._id,
990
+ amount: T,
991
+ measurement: Q,
992
+ remark: C,
993
+ doc: w,
994
+ type: P
995
995
  }))
996
996
  }), S("update:show", !1), S("submitted");
997
- } catch (F) {
998
- h.open({
997
+ } catch (w) {
998
+ g.open({
999
999
  title: u("inventory.stock.adjust.error.title"),
1000
1000
  message: u("inventory.stock.adjust.error.message"),
1001
1001
  type: "error"
1002
- }), console.log("error on adjust ingredients", $, F);
1002
+ }), console.log("error on adjust ingredients", V, w);
1003
1003
  } finally {
1004
1004
  k.value = !1;
1005
1005
  }
1006
1006
  }
1007
- function M() {
1008
- const $ = l.skus.map((j) => ({
1009
- label: j.name,
1010
- sublabel: j.code,
1011
- value: j._id
1012
- })), F = $.filter((j) => g.adjustments.find((I) => I.doc._id === j.value)).map((j) => j.value);
1007
+ function j() {
1008
+ const V = l.skus.map((C) => ({
1009
+ label: C.name,
1010
+ sublabel: C.code,
1011
+ value: C._id
1012
+ })), w = V.filter((C) => h.adjustments.find((P) => P.doc._id === C.value)).map((C) => C.value);
1013
1013
  a.open({
1014
1014
  title: "Select ingredients",
1015
1015
  contentComponent: xt,
1016
1016
  contentComponentProps: {
1017
- items: $,
1018
- modelValue: F
1017
+ items: V,
1018
+ modelValue: w
1019
1019
  },
1020
1020
  overlay: !0,
1021
1021
  closeButton: !0,
@@ -1029,12 +1029,12 @@ const Ve = {
1029
1029
  close: !0,
1030
1030
  variant: "tertiary"
1031
1031
  }
1032
- }).onPrimary((j) => {
1033
- g.adjustments = j.map(
1034
- (I) => g.adjustments.find((E) => E.doc._id === I) ?? {
1032
+ }).onPrimary((C) => {
1033
+ h.adjustments = C.map(
1034
+ (P) => h.adjustments.find((T) => T.doc._id === P) ?? {
1035
1035
  id: `sku_${(/* @__PURE__ */ new Date()).toISOString()}_${Math.random().toString(16).slice(2, 8)}`,
1036
- type: Z.enum.PURCHASE,
1037
- doc: l.skus.find((E) => E._id === I),
1036
+ type: ee.enum.PURCHASE,
1037
+ doc: l.skus.find((T) => T._id === P),
1038
1038
  measurement: null,
1039
1039
  remark: "",
1040
1040
  amount: fe(1)
@@ -1042,62 +1042,62 @@ const Ve = {
1042
1042
  );
1043
1043
  });
1044
1044
  }
1045
- function H($) {
1046
- g.adjustments.splice($, 1);
1045
+ function E(V) {
1046
+ h.adjustments.splice(V, 1);
1047
1047
  }
1048
- return ($, F) => {
1049
- const j = D("FmTextarea"), I = D("FmButton"), E = D("FmForm"), W = D("FmSideSheet");
1050
- return B(), O(W, {
1051
- modelValue: v(A),
1052
- "onUpdate:modelValue": F[2] || (F[2] = (z) => Ue(A) ? A.value = z : null),
1048
+ return (V, w) => {
1049
+ const C = M("FmTextarea"), P = M("FmButton"), T = M("FmForm"), Q = M("FmSideSheet");
1050
+ return B(), O(Q, {
1051
+ modelValue: v(F),
1052
+ "onUpdate:modelValue": w[2] || (w[2] = (Y) => Ue(F) ? F.value = Y : null),
1053
1053
  "dismiss-away": "",
1054
1054
  "max-width": 500
1055
1055
  }, {
1056
- "side-sheet-header": C(() => [
1056
+ "side-sheet-header": D(() => [
1057
1057
  n("div", vn, [
1058
1058
  n("div", fn, b(v(u)("inventory.stock.adjust.title")), 1)
1059
1059
  ])
1060
1060
  ]),
1061
- default: C(() => [
1062
- x(E, {
1061
+ default: D(() => [
1062
+ x(T, {
1063
1063
  class: "w-full flex flex-col gap-12",
1064
1064
  ref_key: "formRef",
1065
- ref: w,
1065
+ ref: $,
1066
1066
  onValidationSuccess: o
1067
1067
  }, {
1068
- default: C(() => [
1069
- x(j, {
1068
+ default: D(() => [
1069
+ x(C, {
1070
1070
  label: v(u)("inventory.stock.adjust.remark"),
1071
- modelValue: g.remark,
1072
- "onUpdate:modelValue": F[0] || (F[0] = (z) => g.remark = z)
1071
+ modelValue: h.remark,
1072
+ "onUpdate:modelValue": w[0] || (w[0] = (Y) => h.remark = Y)
1073
1073
  }, null, 8, ["label", "modelValue"]),
1074
1074
  n("div", yn, [
1075
1075
  n("div", _n, b(v(u)("inventory.stock.adjust.adjustedItems")), 1),
1076
- x(I, {
1076
+ x(P, {
1077
1077
  "prepend-icon": "add",
1078
1078
  variant: "tertiary",
1079
1079
  size: "md",
1080
- onClick: M
1080
+ onClick: j
1081
1081
  })
1082
1082
  ]),
1083
- (B(!0), L(te, null, ae(g.adjustments, (z, P) => (B(), O(pn, {
1084
- key: z.id,
1085
- modelValue: g.adjustments[P],
1086
- "onUpdate:modelValue": (N) => g.adjustments[P] = N,
1087
- "onClick:delete": (N) => H(P)
1083
+ (B(!0), L(ne, null, ae(h.adjustments, (Y, N) => (B(), O(pn, {
1084
+ key: Y.id,
1085
+ modelValue: h.adjustments[N],
1086
+ "onUpdate:modelValue": (R) => h.adjustments[N] = R,
1087
+ "onClick:delete": (R) => E(N)
1088
1088
  }, null, 8, ["modelValue", "onUpdate:modelValue", "onClick:delete"]))), 128))
1089
1089
  ]),
1090
1090
  _: 1
1091
1091
  }, 512)
1092
1092
  ]),
1093
- "side-sheet-footer": C(() => [
1093
+ "side-sheet-footer": D(() => [
1094
1094
  n("div", kn, [
1095
- x(I, {
1095
+ x(P, {
1096
1096
  label: v(u)("inventory.stock.adjust.adjustButton"),
1097
1097
  loading: k.value,
1098
- onClick: F[1] || (F[1] = (z) => {
1099
- var P, N;
1100
- return (N = (P = w.value) == null ? void 0 : P.validateInputs) == null ? void 0 : N.call(P);
1098
+ onClick: w[1] || (w[1] = (Y) => {
1099
+ var N, R;
1100
+ return (R = (N = $.value) == null ? void 0 : N.validateInputs) == null ? void 0 : R.call(N);
1101
1101
  })
1102
1102
  }, null, 8, ["label", "loading"])
1103
1103
  ])
@@ -1140,63 +1140,63 @@ const Ve = {
1140
1140
  bills: { default: () => [] }
1141
1141
  },
1142
1142
  setup(c) {
1143
- const d = c, r = R(!1), s = R(), S = R(null), l = T(() => S.value === null ? "unset" : r.value ? `${S.value}px` : "0px");
1143
+ const d = c, r = H(!1), s = H(), S = H(null), l = U(() => S.value === null ? "unset" : r.value ? `${S.value}px` : "0px");
1144
1144
  Je(() => {
1145
1145
  var k;
1146
1146
  S.value = ((k = s.value) == null ? void 0 : k.scrollHeight) || 0;
1147
1147
  });
1148
- const a = T(() => {
1149
- var g;
1150
- const k = d.record.adjustments, u = d.sku, o = {}, A = k.flatMap((p) => {
1151
- var M;
1152
- return ((M = p.skus) == null ? void 0 : M.filter((H) => H.sku._id === u._id)) ?? [];
1148
+ const a = U(() => {
1149
+ var h;
1150
+ const k = d.record.adjustments, u = d.sku, o = {}, F = k.flatMap((p) => {
1151
+ var j;
1152
+ return ((j = p.skus) == null ? void 0 : j.filter((E) => E.sku._id === u._id)) ?? [];
1153
1153
  }).flatMap((p) => p.amounts);
1154
- for (const p of A) {
1155
- const M = p.measurement ? St(p.measurement.conversion, p.amount) : p.amount;
1156
- o[g = p.type] ?? (o[g] = { amount: 0, precision: 0 }), o[p.type] = Ze(M, o[p.type]);
1154
+ for (const p of F) {
1155
+ const j = p.measurement ? St(p.measurement.conversion, p.amount) : p.amount;
1156
+ o[h = p.type] ?? (o[h] = { amount: 0, precision: 0 }), o[p.type] = Ze(j, o[p.type]);
1157
1157
  }
1158
1158
  return Object.entries(o).reduce(
1159
- (p, [M, H]) => (p[M] = /// comment, because without it formatter makes code uglier
1160
- `${q.toFormatString({
1161
- value: H,
1159
+ (p, [j, E]) => (p[j] = /// comment, because without it formatter makes code uglier
1160
+ `${W.toFormatString({
1161
+ value: E,
1162
1162
  precision: 4
1163
1163
  })} ${u.unit.abbrev}`, p),
1164
1164
  {}
1165
1165
  );
1166
- }), { t: i } = le(), h = T(() => d.record.adjustmentsByTime.map(({ date: k, adjustments: u }) => ({
1166
+ }), { t: i } = le(), g = U(() => d.record.adjustmentsByTime.map(({ date: k, adjustments: u }) => ({
1167
1167
  time: $t(new Date(k)),
1168
1168
  adjustments: u.flatMap(
1169
1169
  (o) => {
1170
- var w, A;
1171
- return ((A = (w = o.skus) == null ? void 0 : w.map) == null ? void 0 : A.call(w, (g) => ({
1172
- ...g,
1170
+ var $, F;
1171
+ return ((F = ($ = o.skus) == null ? void 0 : $.map) == null ? void 0 : F.call($, (h) => ({
1172
+ ...h,
1173
1173
  ref: o.ref,
1174
1174
  backdateFrom: o.effectiveAt != null ? ot(o._id) : null
1175
1175
  }))) ?? [];
1176
1176
  }
1177
1177
  ).flatMap((o) => {
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]) : "";
1178
+ var h;
1179
+ const $ = (h = d.bills.find((p) => p._id === o.ref)) == null ? void 0 : h.seqNumber, F = $ ? i("inventory.stock.record.bill", [$]) : "";
1180
1180
  return o.amounts.map((p) => {
1181
- var M;
1181
+ var j;
1182
1182
  return {
1183
- amount: `${q.toFormatString({ value: p.amount, precision: 4 })} ${((M = p.measurement) == null ? void 0 : M.abbrev) ?? o.sku.unit.abbrev}`,
1183
+ amount: `${W.toFormatString({ value: p.amount, precision: 4 })} ${((j = p.measurement) == null ? void 0 : j.abbrev) ?? o.sku.unit.abbrev}`,
1184
1184
  backdateFrom: o.backdateFrom,
1185
1185
  name: p.type,
1186
- remark: p.remark || A || "",
1186
+ remark: p.remark || F || "",
1187
1187
  cost: p.cost
1188
1188
  };
1189
1189
  });
1190
1190
  })
1191
1191
  })));
1192
1192
  return (k, u) => {
1193
- const o = D("FmIcon"), w = D("FmTooltip"), A = D("FmCard");
1194
- return B(), O(A, { variant: "outlined" }, {
1195
- default: C(() => [
1193
+ const o = M("FmIcon"), $ = M("FmTooltip"), F = M("FmCard");
1194
+ return B(), O(F, { variant: "outlined" }, {
1195
+ default: D(() => [
1196
1196
  n("div", bn, [
1197
1197
  n("div", {
1198
1198
  class: "flex items-center cursor-pointer mb-1",
1199
- onClick: u[0] || (u[0] = (g) => r.value = !r.value)
1199
+ onClick: u[0] || (u[0] = (h) => r.value = !r.value)
1200
1200
  }, [
1201
1201
  n("div", xn, b(k.record.date), 1),
1202
1202
  x(o, {
@@ -1205,19 +1205,19 @@ const Ve = {
1205
1205
  size: "md"
1206
1206
  }, null, 8, ["name"])
1207
1207
  ]),
1208
- (B(!0), L(te, null, ae(a.value, (g, p) => (B(), L("div", {
1208
+ (B(!0), L(ne, null, ae(a.value, (h, p) => (B(), L("div", {
1209
1209
  key: p,
1210
1210
  class: "flex flex-row py-1",
1211
1211
  style: { "font-size": "0.8rem" }
1212
1212
  }, [
1213
1213
  n("div", Sn, b(v(i)(`inventory.inventoryAdjustment.type.${p}`)), 1),
1214
1214
  n("div", {
1215
- class: Ce({
1216
- "text-fm-color-typo-error": g.startsWith("-"),
1217
- "text-fm-color-typo-success": !g.startsWith("-"),
1215
+ class: he({
1216
+ "text-fm-color-typo-error": h.startsWith("-"),
1217
+ "text-fm-color-typo-success": !h.startsWith("-"),
1218
1218
  "ml-auto": !0
1219
1219
  })
1220
- }, b(g), 3)
1220
+ }, b(h), 3)
1221
1221
  ]))), 128)),
1222
1222
  n("div", {
1223
1223
  ref_key: "detailRef",
@@ -1229,29 +1229,29 @@ const Ve = {
1229
1229
  transition: "max-height 0.2s ease-out"
1230
1230
  })
1231
1231
  }, [
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,
1232
+ g.value.length ? (B(), L("hr", $n)) : te("", !0),
1233
+ (B(!0), L(ne, null, ae(g.value, (h) => (B(), L("div", {
1234
+ key: h.time,
1235
1235
  class: "flex gap-1 w-full"
1236
1236
  }, [
1237
- n("div", wn, b(g.time), 1),
1237
+ n("div", wn, b(h.time), 1),
1238
1238
  n("div", Bn, [
1239
- (B(!0), L(te, null, ae(g.adjustments, (p) => (B(), L("div", {
1239
+ (B(!0), L(ne, null, ae(h.adjustments, (p) => (B(), L("div", {
1240
1240
  key: p.name,
1241
1241
  class: "flex gap-1"
1242
1242
  }, [
1243
1243
  n("div", Fn, [
1244
1244
  ve(b(v(i)(`inventory.inventoryAdjustment.type.${p.name}`)) + " ", 1),
1245
- p.backdateFrom ? (B(), O(w, {
1245
+ p.backdateFrom ? (B(), O($, {
1246
1246
  key: 0,
1247
1247
  variant: "plain",
1248
1248
  placement: "top",
1249
1249
  "z-index": 50
1250
1250
  }, {
1251
- content: C(() => [
1251
+ content: D(() => [
1252
1252
  n("div", An, b(v(i)("inventory.stock.record.backdate", [v(et)(new Date(p.backdateFrom))])), 1)
1253
1253
  ]),
1254
- default: C(() => [
1254
+ default: D(() => [
1255
1255
  x(o, {
1256
1256
  name: "info",
1257
1257
  size: "sm",
@@ -1259,17 +1259,17 @@ const Ve = {
1259
1259
  })
1260
1260
  ]),
1261
1261
  _: 2
1262
- }, 1024)) : ee("", !0),
1263
- p.remark ? (B(), L("span", Vn, " # " + b(p.remark), 1)) : ee("", !0)
1262
+ }, 1024)) : te("", !0),
1263
+ p.remark ? (B(), L("span", Vn, " # " + b(p.remark), 1)) : te("", !0)
1264
1264
  ]),
1265
1265
  n("div", {
1266
- class: Ce({
1266
+ class: he({
1267
1267
  "text-fm-color-typo-error": p.amount.startsWith("-"),
1268
1268
  "text-fm-color-typo-success": !p.amount.startsWith("-"),
1269
1269
  "ml-auto": !0
1270
1270
  })
1271
1271
  }, b(p.amount), 3),
1272
- p.cost ? (B(), L("div", Cn, " (" + b(v(je)(p.cost, !1, p.cost.precision)) + ") ", 1)) : ee("", !0)
1272
+ p.cost ? (B(), L("div", Cn, " (" + b(v(je)(p.cost, !1, p.cost.precision)) + ") ", 1)) : te("", !0)
1273
1273
  ]))), 128))
1274
1274
  ])
1275
1275
  ]))), 128))
@@ -1283,31 +1283,31 @@ const Ve = {
1283
1283
  });
1284
1284
  function Mn(c, d) {
1285
1285
  var l;
1286
- const r = Object.keys(Z.enum).reduce(
1286
+ const r = Object.keys(ee.enum).reduce(
1287
1287
  (a, i) => (a[i] = { amount: 0, precision: 0 }, a),
1288
1288
  {}
1289
1289
  );
1290
1290
  if (!d)
1291
1291
  return Object.entries(r).reduce(
1292
- (a, [i]) => (a[i] = q.fromNumber(0), a),
1292
+ (a, [i]) => (a[i] = W.fromNumber(0), a),
1293
1293
  {}
1294
1294
  );
1295
1295
  const S = c.flatMap((a) => {
1296
1296
  var i;
1297
- return ((i = a.skus) == null ? void 0 : i.filter((h) => h.sku._id === d._id)) ?? [];
1297
+ return ((i = a.skus) == null ? void 0 : i.filter((g) => g.sku._id === d._id)) ?? [];
1298
1298
  }).flatMap((a) => a.amounts);
1299
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]]);
1300
+ const i = a.measurement ? W.multiply([a.measurement.conversion, a.amount]) : a.amount;
1301
+ r[l = a.type] ?? (r[l] = { amount: 0, precision: 0 }), r[a.type] = W.add([i, r[a.type]]);
1302
1302
  }
1303
1303
  return Object.entries(r).reduce(
1304
- (a, [i, h]) => {
1304
+ (a, [i, g]) => {
1305
1305
  const k = {
1306
- ...h,
1307
- amount: Math.abs(h.amount)
1306
+ ...g,
1307
+ amount: Math.abs(g.amount)
1308
1308
  };
1309
1309
  return a[i] = /// comment, because without it formatter makes code uglier
1310
- `${q.toFormatString({
1310
+ `${W.toFormatString({
1311
1311
  value: k,
1312
1312
  precision: 4
1313
1313
  })} ${d.unit.abbrev}`, a;
@@ -1329,13 +1329,13 @@ function jn(c, d) {
1329
1329
  for (const l of S) {
1330
1330
  const a = l.amounts;
1331
1331
  for (const i of a) {
1332
- if (i.type !== Z.Enum.SALES)
1332
+ if (i.type !== ee.Enum.SALES)
1333
1333
  continue;
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]);
1334
+ const g = i.measurement ? W.multiply([i.measurement.conversion, i.amount]) : i.amount;
1335
+ r ?? (r = W.fromNumber(0)), r = W.add([r, g]);
1336
1336
  }
1337
1337
  }
1338
- return r != null ? (r.amount = Math.abs(r.amount), `${q.toFormatString({
1338
+ return r != null ? (r.amount = Math.abs(r.amount), `${W.toFormatString({
1339
1339
  value: r,
1340
1340
  precision: 4
1341
1341
  })} ${d.unit.abbrev}`) : null;
@@ -1363,38 +1363,38 @@ const In = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Un = {
1363
1363
  },
1364
1364
  emits: ["update:show"],
1365
1365
  setup(c) {
1366
- const d = tt(), r = He(), s = Se(), S = gn(), l = ue(), a = Bt(), { t: i } = le(), h = c, k = R(!1), u = de(), o = R(ct(0));
1367
- async function w() {
1366
+ const d = tt(), r = He(), s = $e(), S = gn(), l = ue(), a = Bt(), { t: i } = le(), g = c, k = H(!1), u = de(), o = H(ct(0));
1367
+ async function $() {
1368
1368
  k.value = !0;
1369
1369
  try {
1370
- await $(), await r.readStockBalance();
1371
- } catch (e) {
1370
+ await V(), await r.readStockBalance();
1371
+ } catch (t) {
1372
1372
  u.open({
1373
1373
  title: "Something went wrong",
1374
1374
  message: "Cannot fetch stock history. Please try again.",
1375
1375
  type: "error"
1376
- }), console.log("failed at fetching item adjustment history", h.sku, o, e);
1376
+ }), console.log("failed at fetching item adjustment history", g.sku, o, t);
1377
1377
  } finally {
1378
1378
  k.value = !1;
1379
1379
  }
1380
1380
  }
1381
1381
  Je(() => {
1382
- w();
1383
- }), he([() => o.value, () => h.sku], () => {
1384
- w();
1382
+ $();
1383
+ }), ge([() => o.value, () => g.sku], () => {
1384
+ $();
1385
1385
  });
1386
- const A = R([]), g = R([]), p = R(new Array());
1387
- function M(e, t) {
1388
- return t === "day" ? Dt(e) : et(e);
1386
+ const F = H([]), h = H([]), p = H(new Array());
1387
+ function j(t, e) {
1388
+ return e === "day" ? Dt(t) : et(t);
1389
1389
  }
1390
- function H(e, t) {
1391
- const f = e.reduce(
1390
+ function E(t, e) {
1391
+ const f = t.reduce(
1392
1392
  (m, _) => {
1393
1393
  const y = _.effectiveAt ?? ot(_._id);
1394
1394
  if (!y)
1395
1395
  return m;
1396
- const V = M(new Date(y), t);
1397
- return m[V] ?? (m[V] = []), m[V].push(_), m;
1396
+ const A = j(new Date(y), e);
1397
+ return m[A] ?? (m[A] = []), m[A].push(_), m;
1398
1398
  },
1399
1399
  {}
1400
1400
  );
@@ -1403,165 +1403,165 @@ const In = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Un = {
1403
1403
  adjustments: f[m]
1404
1404
  }));
1405
1405
  }
1406
- async function $() {
1407
- let e = await s.readStockAdjustment(
1408
- h.sku._id,
1406
+ async function V() {
1407
+ let t = await s.readStockAdjustment(
1408
+ g.sku._id,
1409
1409
  Ft(new Date(o.value.startDate)).toISOString(),
1410
1410
  At(new Date(o.value.endDate)).toISOString()
1411
1411
  );
1412
- A.value = e;
1413
- const t = e.filter(({ ref: f }) => f == null ? void 0 : f.startsWith("bill_")).map(({ ref: f }) => f);
1414
- await F(t), g.value = H(e, "day").map(({ date: f, adjustments: m }) => ({
1412
+ F.value = t;
1413
+ const e = t.filter(({ ref: f }) => f == null ? void 0 : f.startsWith("bill_")).map(({ ref: f }) => f);
1414
+ await w(e), h.value = E(t, "day").map(({ date: f, adjustments: m }) => ({
1415
1415
  date: f,
1416
1416
  adjustments: m,
1417
- adjustmentsByTime: H(m, "minute")
1417
+ adjustmentsByTime: E(m, "minute")
1418
1418
  }));
1419
1419
  }
1420
- async function F(e) {
1421
- e.length && (p.value = await S.findBillsById(e).catch((t) => {
1420
+ async function w(t) {
1421
+ t.length && (p.value = await S.findBillsById(t).catch((e) => {
1422
1422
  var _;
1423
- console.error("Error on using latest bill API, retrying using legacy api", t);
1423
+ console.error("Error on using latest bill API, retrying using legacy api", e);
1424
1424
  const f = ((_ = d.currentBusiness.value) == null ? void 0 : _._id) ?? "", m = l.currentLocation.doc._id;
1425
- return S.findBillsByBusinessId(f, [m], e);
1425
+ return S.findBillsByBusinessId(f, [m], t);
1426
1426
  }));
1427
1427
  }
1428
- const j = T(() => {
1429
- const e = A.value, t = h.sku;
1430
- return Mn(e, t);
1431
- }), I = T(() => {
1432
- const e = A.value, t = h.sku;
1433
- return jn(e, t);
1434
- }), E = T(() => {
1435
- const e = [...A.value].computeFirst((f) => {
1428
+ const C = U(() => {
1429
+ const t = F.value, e = g.sku;
1430
+ return Mn(t, e);
1431
+ }), P = U(() => {
1432
+ const t = F.value, e = g.sku;
1433
+ return jn(t, e);
1434
+ }), T = U(() => {
1435
+ const t = [...F.value].computeFirst((f) => {
1436
1436
  var _, y;
1437
- const m = (y = (_ = f.skus) == null ? void 0 : _.find) == null ? void 0 : y.call(_, (V) => V.sku._id === h.sku._id);
1437
+ const m = (y = (_ = f.skus) == null ? void 0 : _.find) == null ? void 0 : y.call(_, (A) => A.sku._id === g.sku._id);
1438
1438
  return m == null ? void 0 : m.fromBalance;
1439
1439
  }) ?? {
1440
1440
  amount: 0,
1441
1441
  precision: 0
1442
- }, t = h.sku;
1443
- return t ? `${q.toFormatString({
1444
- value: e,
1442
+ }, e = g.sku;
1443
+ return e ? `${W.toFormatString({
1444
+ value: t,
1445
1445
  precision: 4
1446
- })} ${t.unit.abbrev}` : "";
1447
- }), W = T(() => {
1448
- const e = [...A.value].reverse().computeFirst((f) => {
1446
+ })} ${e.unit.abbrev}` : "";
1447
+ }), Q = U(() => {
1448
+ const t = [...F.value].reverse().computeFirst((f) => {
1449
1449
  var _, y;
1450
- const m = (y = (_ = f.skus) == null ? void 0 : _.find) == null ? void 0 : y.call(_, (V) => V.sku._id === h.sku._id);
1450
+ const m = (y = (_ = f.skus) == null ? void 0 : _.find) == null ? void 0 : y.call(_, (A) => A.sku._id === g.sku._id);
1451
1451
  return m == null ? void 0 : m.toBalance;
1452
1452
  }) ?? {
1453
1453
  amount: 0,
1454
1454
  precision: 0
1455
- }, t = h.sku;
1456
- return t ? `${q.toFormatString({ value: e, precision: 4 })} ${t.unit.abbrev}` : "";
1455
+ }, e = g.sku;
1456
+ return e ? `${W.toFormatString({ value: t, precision: 4 })} ${e.unit.abbrev}` : "";
1457
1457
  });
1458
- function z(e) {
1459
- switch (e) {
1460
- case Be.MY:
1458
+ function Y(t) {
1459
+ switch (t) {
1460
+ case Fe.MY:
1461
1461
  return "MYR";
1462
- case Be.SG:
1462
+ case Fe.SG:
1463
1463
  return "SGD";
1464
- case Be.ID:
1464
+ case Fe.ID:
1465
1465
  return "IDR";
1466
1466
  default:
1467
1467
  return "MYR";
1468
1468
  }
1469
1469
  }
1470
- const P = T(() => {
1470
+ const N = U(() => {
1471
1471
  var f;
1472
- const t = A.value.flatMap((m) => {
1472
+ const e = F.value.flatMap((m) => {
1473
1473
  var _;
1474
1474
  return ((_ = m.skus) == null ? void 0 : _.flatMap((y) => y.amounts)) ?? [];
1475
1475
  }).filter((m) => m.amount.amount < 0).reduce(
1476
1476
  (m, _) => {
1477
1477
  const y = _.cost;
1478
1478
  if (!y) return m;
1479
- const V = {
1479
+ const A = {
1480
1480
  ...wt(m, Math.max(m.precision, y.precision)),
1481
1481
  currency: y.currency
1482
1482
  };
1483
1483
  return {
1484
- ...Ze(V, y),
1484
+ ...Ze(A, y),
1485
1485
  currency: m.currency
1486
1486
  };
1487
1487
  },
1488
1488
  {
1489
1489
  amount: 0,
1490
1490
  precision: 0,
1491
- currency: z(((f = d.currentCountry) == null ? void 0 : f.value) ?? Ye)
1491
+ currency: Y(((f = d.currentCountry) == null ? void 0 : f.value) ?? Ye)
1492
1492
  }
1493
1493
  );
1494
- return je(t, !1, t.precision);
1494
+ return je(e, !1, e.precision);
1495
1495
  });
1496
- function N() {
1497
- const { startDate: e, endDate: t } = Vt(o.value);
1498
- e !== null && t !== null && (o.value = {
1499
- startDate: e,
1500
- endDate: t
1496
+ function R() {
1497
+ const { startDate: t, endDate: e } = Vt(o.value);
1498
+ t !== null && e !== null && (o.value = {
1499
+ startDate: t,
1500
+ endDate: e
1501
1501
  });
1502
1502
  }
1503
- const ne = T(() => {
1503
+ const K = U(() => {
1504
1504
  var f;
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);
1505
+ const t = [...F.value].reverse().computeFirst((m) => {
1506
+ var y, A;
1507
+ const _ = (A = (y = m.skus) == null ? void 0 : y.find) == null ? void 0 : A.call(y, (z) => z.sku._id === g.sku._id);
1508
1508
  return _ == null ? void 0 : _.toCostBalances;
1509
1509
  });
1510
- return e ? {
1511
- ...e.reduce((m, _) => q.add([m, q.fromDinero(_.cost)]), {
1510
+ return t ? {
1511
+ ...t.reduce((m, _) => W.add([m, W.fromDinero(_.cost)]), {
1512
1512
  amount: 0,
1513
1513
  precision: 0
1514
1514
  }),
1515
- currency: z(((f = d.currentCountry) == null ? void 0 : f.value) ?? Ye)
1515
+ currency: Y(((f = d.currentCountry) == null ? void 0 : f.value) ?? Ye)
1516
1516
  } : "No data";
1517
1517
  });
1518
1518
  function ce() {
1519
- const { startDate: e, endDate: t } = Ct(o.value);
1520
- e !== null && t !== null && (o.value = {
1521
- startDate: e,
1522
- endDate: t
1519
+ const { startDate: t, endDate: e } = Ct(o.value);
1520
+ t !== null && e !== null && (o.value = {
1521
+ startDate: t,
1522
+ endDate: e
1523
1523
  });
1524
1524
  }
1525
- const oe = Re(h, "show");
1526
- return (e, t) => {
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");
1525
+ const oe = Re(g, "show");
1526
+ return (t, e) => {
1527
+ const f = M("FmButton"), m = M("FmField"), _ = M("FmDateRangePicker"), y = M("FmSpacer"), A = M("FmCircularProgress"), z = M("FmIcon"), X = M("FmTooltip"), me = M("FmMenuDivider"), I = M("FmCardSection"), G = M("FmCard"), J = M("FmSideSheet");
1528
1528
  return B(), O(J, {
1529
1529
  "dismiss-away": "",
1530
1530
  modelValue: v(oe),
1531
- "onUpdate:modelValue": t[4] || (t[4] = (X) => Ue(oe) ? oe.value = X : null),
1531
+ "onUpdate:modelValue": e[4] || (e[4] = (Z) => Ue(oe) ? oe.value = Z : null),
1532
1532
  "close-button": !1,
1533
1533
  "max-width": 560
1534
1534
  }, {
1535
- "side-sheet-header": C(() => [
1535
+ "side-sheet-header": D(() => [
1536
1536
  n("div", In, [
1537
- n("div", Un, b(v(i)("inventory.stock.history.title", [e.sku.name])), 1),
1537
+ n("div", Un, b(v(i)("inventory.stock.history.title", [t.sku.name])), 1),
1538
1538
  x(f, {
1539
1539
  variant: "tertiary",
1540
1540
  "prepend-icon": "close",
1541
- onClick: t[0] || (t[0] = (X) => oe.value = !1)
1541
+ onClick: e[0] || (e[0] = (Z) => oe.value = !1)
1542
1542
  })
1543
1543
  ])
1544
1544
  ]),
1545
- default: C(() => {
1546
- var X;
1545
+ default: D(() => {
1546
+ var Z;
1547
1547
  return [
1548
1548
  n("div", Pn, [
1549
1549
  n("div", Tn, [
1550
1550
  n("div", Rn, [
1551
1551
  x(_, {
1552
1552
  modelValue: o.value,
1553
- "onUpdate:modelValue": t[1] || (t[1] = (G) => o.value = G),
1553
+ "onUpdate:modelValue": e[1] || (e[1] = (q) => o.value = q),
1554
1554
  "show-predefined-range": "",
1555
1555
  "start-label": "",
1556
1556
  "end-label": "",
1557
1557
  "z-index": 50
1558
1558
  }, {
1559
- "trigger-button": C(({ opened: G }) => [
1559
+ "trigger-button": D(({ opened: q }) => [
1560
1560
  x(m, {
1561
1561
  "prepend-icon": "calendar_month",
1562
- focused: G
1562
+ focused: q
1563
1563
  }, {
1564
- default: C(() => [
1564
+ default: D(() => [
1565
1565
  ve(b(o.value.startDate) + " - " + b(o.value.endDate), 1)
1566
1566
  ]),
1567
1567
  _: 2
@@ -1572,82 +1572,82 @@ const In = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Un = {
1572
1572
  ]),
1573
1573
  x(f, {
1574
1574
  variant: "tertiary",
1575
- onClick: t[2] || (t[2] = (G) => N()),
1575
+ onClick: e[2] || (e[2] = (q) => R()),
1576
1576
  "prepend-icon": "navigate_before"
1577
1577
  }),
1578
1578
  x(f, {
1579
1579
  variant: "tertiary",
1580
- onClick: t[3] || (t[3] = (G) => ce()),
1580
+ onClick: e[3] || (e[3] = (q) => ce()),
1581
1581
  "prepend-icon": "navigate_next"
1582
1582
  })
1583
1583
  ]),
1584
1584
  k.value ? (B(), L("div", Hn, [
1585
1585
  x(y),
1586
- x(V, { size: "xl" }),
1586
+ x(A, { size: "xl" }),
1587
1587
  n("div", En, b(v(i)("inventory.stock.history.loading")), 1),
1588
1588
  x(y),
1589
1589
  x(y)
1590
- ])) : g.value && ((X = g.value) == null ? void 0 : X.length) > 0 ? (B(), L("div", Ln, [
1591
- x(Y, { variant: "outlined" }, {
1592
- default: C(() => [
1593
- x(U, { class: "flex flex-col gap-4" }, {
1594
- default: C(() => [
1590
+ ])) : h.value && ((Z = h.value) == null ? void 0 : Z.length) > 0 ? (B(), L("div", Ln, [
1591
+ x(G, { variant: "outlined" }, {
1592
+ default: D(() => [
1593
+ x(I, { class: "flex flex-col gap-4" }, {
1594
+ default: D(() => [
1595
1595
  n("div", Nn, [
1596
1596
  n("div", On, b(v(i)("inventory.stock.history.summary.title")), 1)
1597
1597
  ]),
1598
1598
  n("div", zn, [
1599
1599
  n("div", Yn, [
1600
1600
  n("div", Kn, b(v(i)("inventory.stock.history.summary.totalPurchase")), 1),
1601
- n("div", Gn, b(j.value.PURCHASE), 1)
1601
+ n("div", Gn, b(C.value.PURCHASE), 1)
1602
1602
  ]),
1603
1603
  n("div", qn, [
1604
1604
  n("div", Wn, [
1605
1605
  ve(b(v(i)("inventory.stock.history.summary.totalSales")) + "  ", 1),
1606
- I.value != null ? (B(), O(Q, {
1606
+ P.value != null ? (B(), O(X, {
1607
1607
  key: 0,
1608
1608
  variant: "plain",
1609
1609
  placement: "top",
1610
- content: `Before: ${I.value}`,
1610
+ content: `Before: ${P.value}`,
1611
1611
  "z-index": 50
1612
1612
  }, {
1613
- default: C(() => [
1614
- x(K, {
1613
+ default: D(() => [
1614
+ x(z, {
1615
1615
  name: "warning",
1616
1616
  size: "sm"
1617
1617
  })
1618
1618
  ]),
1619
1619
  _: 1
1620
- }, 8, ["content"])) : ee("", !0)
1620
+ }, 8, ["content"])) : te("", !0)
1621
1621
  ]),
1622
- n("div", Jn, b(j.value.SALES), 1)
1622
+ n("div", Jn, b(C.value.SALES), 1)
1623
1623
  ]),
1624
1624
  n("div", Qn, [
1625
1625
  n("div", Xn, b(v(i)("inventory.stock.history.summary.totalLose")), 1),
1626
- n("div", Zn, b(j.value.LOSE), 1)
1626
+ n("div", Zn, b(C.value.LOSE), 1)
1627
1627
  ]),
1628
1628
  n("div", eo, [
1629
1629
  n("div", to, b(v(i)("inventory.stock.history.summary.totalRequest")), 1),
1630
- n("div", no, b(j.value.REQUEST), 1)
1630
+ n("div", no, b(C.value.REQUEST), 1)
1631
1631
  ]),
1632
1632
  n("div", oo, [
1633
1633
  n("div", so, b(v(i)("inventory.stock.history.summary.totalReceive")), 1),
1634
- n("div", ao, b(j.value.RECEIVE), 1)
1634
+ n("div", ao, b(C.value.RECEIVE), 1)
1635
1635
  ]),
1636
1636
  n("div", ro, [
1637
1637
  n("div", lo, b(v(i)("inventory.stock.history.summary.totalConvert")), 1),
1638
- n("div", io, b(j.value.CONVERT), 1)
1638
+ n("div", io, b(C.value.CONVERT), 1)
1639
1639
  ]),
1640
1640
  n("div", uo, [
1641
1641
  n("div", co, b(v(i)("inventory.stock.history.summary.totalDamage")), 1),
1642
- n("div", mo, b(j.value.DAMAGE), 1)
1642
+ n("div", mo, b(C.value.DAMAGE), 1)
1643
1643
  ]),
1644
1644
  n("div", po, [
1645
1645
  n("div", vo, b(v(i)("inventory.stock.history.summary.openingBalance")), 1),
1646
- n("div", fo, b(E.value), 1)
1646
+ n("div", fo, b(T.value), 1)
1647
1647
  ]),
1648
1648
  n("div", yo, [
1649
1649
  n("div", _o, b(v(i)("inventory.stock.history.summary.lastStockBalance")), 1),
1650
- n("div", ko, b(W.value), 1)
1650
+ n("div", ko, b(Q.value), 1)
1651
1651
  ])
1652
1652
  ]),
1653
1653
  v(a).enableTotalCost ? (B(), L("div", ho, [
@@ -1655,17 +1655,17 @@ const In = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Un = {
1655
1655
  n("div", go, [
1656
1656
  n("div", bo, [
1657
1657
  x(Ge, { "z-index": 50 }, {
1658
- default: C(() => [
1658
+ default: D(() => [
1659
1659
  n("div", xo, [
1660
1660
  ve(b(v(i)("inventory.stock.history.estimatedValue")) + " ", 1),
1661
- x(Q, {
1661
+ x(X, {
1662
1662
  variant: "plain",
1663
1663
  placement: "top",
1664
1664
  content: v(i)("inventory.stock.history.estimatedValueTooltip"),
1665
1665
  "z-index": 50
1666
1666
  }, {
1667
- default: C(() => [
1668
- x(K, {
1667
+ default: D(() => [
1668
+ x(z, {
1669
1669
  name: "help",
1670
1670
  size: "sm"
1671
1671
  })
@@ -1676,23 +1676,23 @@ const In = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Un = {
1676
1676
  ]),
1677
1677
  _: 1
1678
1678
  }),
1679
- n("div", So, b(typeof ne.value != "string" ? v(je)(ne.value, !1, ne.value.precision) : ne.value), 1)
1679
+ n("div", So, b(typeof K.value != "string" ? v(je)(K.value, !1, K.value.precision) : K.value), 1)
1680
1680
  ]),
1681
1681
  n("div", $o, [
1682
1682
  x(Ge, { "z-index": 50 }, {
1683
- default: C(() => [
1683
+ default: D(() => [
1684
1684
  n("div", wo, [
1685
1685
  ve(b(v(i)("inventory.stock.history.costSold")) + " ", 1),
1686
- x(Q, {
1686
+ x(X, {
1687
1687
  variant: "plain",
1688
1688
  placement: "top",
1689
1689
  "z-index": 50
1690
1690
  }, {
1691
- content: C(() => [
1691
+ content: D(() => [
1692
1692
  n("div", Bo, b(v(i)("inventory.stock.history.costSoldTooltip")), 1)
1693
1693
  ]),
1694
- default: C(() => [
1695
- x(K, {
1694
+ default: D(() => [
1695
+ x(z, {
1696
1696
  name: "help",
1697
1697
  size: "sm"
1698
1698
  })
@@ -1703,26 +1703,26 @@ const In = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Un = {
1703
1703
  ]),
1704
1704
  _: 1
1705
1705
  }),
1706
- n("div", Fo, b(P.value), 1)
1706
+ n("div", Fo, b(N.value), 1)
1707
1707
  ])
1708
1708
  ])
1709
- ])) : ee("", !0)
1709
+ ])) : te("", !0)
1710
1710
  ]),
1711
1711
  _: 1
1712
1712
  })
1713
1713
  ]),
1714
1714
  _: 1
1715
1715
  }),
1716
- t[5] || (t[5] = n("div", null, null, -1)),
1717
- (B(!0), L(te, null, ae(g.value, (G) => (B(), L(te, {
1718
- key: G.date
1716
+ e[5] || (e[5] = n("div", null, null, -1)),
1717
+ (B(!0), L(ne, null, ae(h.value, (q) => (B(), L(ne, {
1718
+ key: q.date
1719
1719
  }, [
1720
- e.sku ? (B(), O(Dn, {
1720
+ t.sku ? (B(), O(Dn, {
1721
1721
  key: 0,
1722
- record: G,
1723
- sku: e.sku,
1722
+ record: q,
1723
+ sku: t.sku,
1724
1724
  bills: p.value
1725
- }, null, 8, ["record", "sku", "bills"])) : ee("", !0)
1725
+ }, null, 8, ["record", "sku", "bills"])) : te("", !0)
1726
1726
  ], 64))), 128))
1727
1727
  ])) : (B(), L("div", Ao, [
1728
1728
  x(y),
@@ -1744,15 +1744,15 @@ const In = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Un = {
1744
1744
  }, 8, ["modelValue"]);
1745
1745
  };
1746
1746
  }
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({
1747
+ }), jo = { class: "flex flex-col gap-8" }, Io = { class: "flex flex-col" }, Uo = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Po = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary line-clamp-1" }, Xo = /* @__PURE__ */ re({
1748
1748
  __name: "StockView",
1749
1749
  setup(c) {
1750
1750
  const { t: d } = le(), r = Te(), s = ue(), S = He(), l = lt(), a = at(), { columnDefs: i } = qt();
1751
1751
  s.watchLocation(u);
1752
- const h = R(!1), k = de();
1752
+ const g = H(!1), k = de();
1753
1753
  async function u() {
1754
1754
  if (s._currentLocation) {
1755
- h.value = !0;
1755
+ g.value = !0;
1756
1756
  try {
1757
1757
  await S.readStockBalance(), await S.readProductBalance(), await a.readStockEstimateBalance();
1758
1758
  } catch {
@@ -1762,101 +1762,109 @@ const In = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Un = {
1762
1762
  type: "error"
1763
1763
  });
1764
1764
  } finally {
1765
- h.value = !1;
1765
+ g.value = !1;
1766
1766
  }
1767
1767
  }
1768
1768
  }
1769
- const o = T(
1770
- () => r.skus.map(($) => {
1771
- var W, z, P;
1772
- const F = $.trackingMeasurement;
1773
- let j = (z = (W = S.stockBalance.skus) == null ? void 0 : W.find(
1774
- (N) => N.id === $._id
1775
- )) == null ? void 0 : z.balance, I = a.inventoryForecast.skus.find(
1776
- (N) => N.id === $._id
1769
+ const o = U(
1770
+ () => r.skus.map((w) => {
1771
+ var Y, N, R;
1772
+ const C = w.trackingMeasurement;
1773
+ let P = (N = (Y = S.stockBalance.skus) == null ? void 0 : Y.find(
1774
+ (K) => K.id === w._id
1775
+ )) == null ? void 0 : N.balance, T = a.inventoryForecast.skus.find(
1776
+ (K) => K.id === w._id
1777
1777
  );
1778
1778
  return {
1779
- ...$,
1780
- balance: j ?? {
1779
+ ...w,
1780
+ balance: P ?? {
1781
1781
  amount: 0,
1782
1782
  precision: 0
1783
1783
  },
1784
- day: (I == null ? void 0 : I.depletionDays) ?? void 0,
1785
- trackingUnitAbbrev: F ? ((P = $.unit.measurements.find((N) => N.id === F)) == null ? void 0 : P.abbrev) ?? "" : $.unit.abbrev
1784
+ day: (T == null ? void 0 : T.depletionDays) ?? void 0,
1785
+ trackingUnitAbbrev: C ? ((R = w.unit.measurements.find((K) => K.id === C)) == null ? void 0 : R.abbrev) ?? "" : w.unit.abbrev
1786
1786
  };
1787
1787
  })
1788
- ), w = R(""), { breakpoints: A } = jt(), g = T(() => A.value.xs || A.value.sm ? 10 : 20), p = dt(), M = T(
1788
+ ), $ = H(""), { breakpoints: F } = jt(), h = U(() => F.value.xs || F.value.sm), p = U(() => h.value ? 10 : 20), j = dt(), E = U(
1789
1789
  () => {
1790
- var $;
1791
- return (($ = s._currentLocation) == null ? void 0 : $.type) === Mt.restaurant;
1790
+ var w;
1791
+ return ((w = s._currentLocation) == null ? void 0 : w.type) === Mt.restaurant;
1792
1792
  }
1793
- ), H = T(() => {
1794
- const $ = [
1793
+ ), V = U(() => {
1794
+ const w = [
1795
1795
  { icon: "ios_share", onClick: () => zt(o.value) }
1796
1796
  ];
1797
- return M.value ? [{ icon: "refresh", onClick: u }, ...$] : $;
1797
+ return E.value ? [{ icon: "refresh", onClick: u }, ...w] : w;
1798
1798
  });
1799
- return ($, F) => {
1800
- const j = D("FmTable");
1799
+ return (w, C) => {
1800
+ const P = M("FmTable");
1801
1801
  return B(), O(mt, {
1802
1802
  title: v(d)("inventory.stock.title")
1803
1803
  }, {
1804
- default: C(() => {
1805
- var I, E, W, z;
1804
+ default: D(() => {
1805
+ var T, Q, Y, N;
1806
1806
  return [
1807
- n("div", jo, [
1807
+ n("div", {
1808
+ class: he([
1809
+ "flex flex-col gap-8 max-h-full",
1810
+ {
1811
+ "p-0": h.value,
1812
+ "px-24 ": !h.value
1813
+ }
1814
+ ])
1815
+ }, [
1808
1816
  x(pt, {
1809
1817
  searchable: "",
1810
1818
  "change-location": "",
1811
- search: w.value,
1812
- "onUpdate:search": F[0] || (F[0] = (P) => w.value = P),
1813
- actions: H.value
1819
+ search: $.value,
1820
+ "onUpdate:search": C[0] || (C[0] = (R) => $.value = R),
1821
+ actions: V.value
1814
1822
  }, null, 8, ["search", "actions"]),
1815
- (B(), O(j, {
1816
- style: Qe(v(p).tableHeight),
1823
+ (B(), O(P, {
1824
+ style: Qe(v(j).tableHeight),
1817
1825
  "column-defs": v(i),
1818
1826
  "row-data": o.value,
1819
- "search-value": w.value,
1820
- loading: h.value || !v(s)._currentLocation,
1821
- key: (I = v(s)._currentLocation) == null ? void 0 : I.dbName,
1822
- onRowClick: F[1] || (F[1] = (P) => v(l).showSkuHistory(P.original)),
1823
- "page-size": g.value
1827
+ "search-value": $.value,
1828
+ loading: g.value || !v(s)._currentLocation,
1829
+ key: (T = v(s)._currentLocation) == null ? void 0 : T.dbName,
1830
+ onRowClick: C[1] || (C[1] = (R) => v(l).showSkuHistory(R.original)),
1831
+ "page-size": p.value
1824
1832
  }, {
1825
- "list-row": C((P) => [
1833
+ "list-row": D((R) => [
1826
1834
  x(Ut, {
1827
- row: P,
1835
+ row: R,
1828
1836
  onRowClick: v(l).showSkuHistory
1829
1837
  }, {
1830
- default: C((N) => {
1831
- var ne, ce, oe, e, t, f, m, _, y, V;
1838
+ default: D((K) => {
1839
+ var ce, oe, t, e, f, m, _, y, A, z;
1832
1840
  return [
1833
- n("div", Io, [
1834
- n("div", Uo, [
1835
- n("div", Po, [
1841
+ n("div", jo, [
1842
+ n("div", Io, [
1843
+ n("div", Uo, [
1836
1844
  x(v(Ke), {
1837
- render: (oe = (ce = (ne = N.code) == null ? void 0 : ne.column) == null ? void 0 : ce.columnDef) == null ? void 0 : oe.cell,
1838
- props: (t = (e = N.code) == null ? void 0 : e.getContext) == null ? void 0 : t.call(e)
1845
+ render: (t = (oe = (ce = K.code) == null ? void 0 : ce.column) == null ? void 0 : oe.columnDef) == null ? void 0 : t.cell,
1846
+ props: (f = (e = K.code) == null ? void 0 : e.getContext) == null ? void 0 : f.call(e)
1839
1847
  }, null, 8, ["render", "props"])
1840
1848
  ]),
1841
- n("div", To, [
1849
+ n("div", Po, [
1842
1850
  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)
1851
+ render: (y = (_ = (m = K.name) == null ? void 0 : m.column) == null ? void 0 : _.columnDef) == null ? void 0 : y.cell,
1852
+ props: (z = (A = K.name) == null ? void 0 : A.getContext) == null ? void 0 : z.call(A)
1845
1853
  }, null, 8, ["render", "props"])
1846
1854
  ])
1847
1855
  ]),
1848
1856
  n("div", null, [
1849
1857
  x(Ie, {
1850
- days: P.original.day
1858
+ days: R.original.day
1851
1859
  }, null, 8, ["days"])
1852
1860
  ]),
1853
1861
  n("div", null, [
1854
1862
  x(rt, {
1855
1863
  class: "xs:w-[160px]",
1856
- unit: P.original.unit,
1857
- sku: P.original,
1858
- amount: P.original.balance,
1859
- "default-tracking-measurement": P.original.trackingMeasurement ?? void 0
1864
+ unit: R.original.unit,
1865
+ sku: R.original,
1866
+ amount: R.original.balance,
1867
+ "default-tracking-measurement": R.original.trackingMeasurement ?? void 0
1860
1868
  }, null, 8, ["unit", "sku", "amount", "default-tracking-measurement"])
1861
1869
  ])
1862
1870
  ])
@@ -1867,11 +1875,11 @@ const In = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Un = {
1867
1875
  ]),
1868
1876
  _: 1
1869
1877
  }, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"]))
1870
- ]),
1878
+ ], 2),
1871
1879
  (B(), O(ut, { to: "body" }, [
1872
- (E = v(l).stockHistoryProps) != null && E.sku ? (B(), O(Mo, $e(we({ key: 0 }, v(l).stockHistoryProps)), null, 16)) : ee("", !0),
1873
- (W = v(l).convertSkuDialogProps) != null && W.sku ? (B(), O(cn, $e(we({ key: 1 }, v(l).convertSkuDialogProps)), null, 16)) : ee("", !0),
1874
- (z = v(l).adjustSkuDialogProps) != null && z.stock ? (B(), O(hn, $e(we({ key: 2 }, v(l).adjustSkuDialogProps)), null, 16)) : ee("", !0)
1880
+ (Q = v(l).stockHistoryProps) != null && Q.sku ? (B(), O(Mo, we(Be({ key: 0 }, v(l).stockHistoryProps)), null, 16)) : te("", !0),
1881
+ (Y = v(l).convertSkuDialogProps) != null && Y.sku ? (B(), O(cn, we(Be({ key: 1 }, v(l).convertSkuDialogProps)), null, 16)) : te("", !0),
1882
+ (N = v(l).adjustSkuDialogProps) != null && N.stock ? (B(), O(hn, we(Be({ key: 2 }, v(l).adjustSkuDialogProps)), null, 16)) : te("", !0)
1875
1883
  ]))
1876
1884
  ];
1877
1885
  }),
@@ -1881,5 +1889,5 @@ const In = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Un = {
1881
1889
  }
1882
1890
  });
1883
1891
  export {
1884
- Zo as default
1892
+ Xo as default
1885
1893
  };