@feedmepos/mf-inventory-portal 0.0.22-dev.2 → 0.0.22-dev.21

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