@feedmepos/mf-inventory-portal 0.0.13 → 0.0.14-dev.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/dist/{ApprovalView-DLjXlfow.js → ApprovalView-CjDTRn_0.js} +6 -6
  2. package/dist/{BindingsDialog-CnIs3cmk.js → BindingsDialog-BrmtRPs7.js} +2 -2
  3. package/dist/{BindingsPicker-DuBt8qnk.js → BindingsPicker-RF1LpUQI.js} +2 -2
  4. package/dist/{BindingsTable-B6hEmwQa.js → BindingsTable-J6p4ayCr.js} +3 -3
  5. package/dist/{ChangeLocationComponent.vue_vue_type_script_setup_true_lang-tztl7vrE.js → ChangeLocationComponent.vue_vue_type_script_setup_true_lang-DhiBtQCZ.js} +1 -1
  6. package/dist/{FmMultiselectDialog.vue_vue_type_script_setup_true_lang-CQa3cFsy.js → FmMultiselectDialog.vue_vue_type_script_setup_true_lang-lXG8Dt51.js} +2 -2
  7. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-Ow5808OK.js → FmUnitInput.vue_vue_type_script_setup_true_lang-D0CuYd32.js} +3 -3
  8. package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-fFkvXmGW.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-BGtOiTS_.js} +1 -1
  9. package/dist/{IngredientsView-DMlke0JW.js → IngredientsView-Dp7VJ6y6.js} +6 -6
  10. package/dist/{IntegrationView-Bzl51B93.js → IntegrationView-B0EqVrD6.js} +3 -3
  11. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-a34h9DoV.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-DS2k0Mg0.js} +6 -6
  12. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-CavE2MEL.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DNlqatNB.js} +1 -1
  13. package/dist/{PurchaseOrderPrintPreview-D2mgXtfR.js → PurchaseOrderPrintPreview-CBvso-CS.js} +1 -1
  14. package/dist/{ReceiveRequestView-JCBh5F1Y.js → ReceiveRequestView-BepmuhAx.js} +12 -12
  15. package/dist/{RecipeView-D0xkBYFD.js → RecipeView-Dom09pTM.js} +7 -7
  16. package/dist/{StockView-Dckt5hb4.js → StockView-CKzNbjdc.js} +290 -288
  17. package/dist/{SupplierView-DktUGCdL.js → SupplierView-IoHcN00m.js} +7 -7
  18. package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-BgD5yGYC.js → TransferDetails.vue_vue_type_script_setup_true_lang-i1th_271.js} +5 -5
  19. package/dist/{UnitView-A6RKcw7X.js → UnitView-DZd-hHZm.js} +6 -6
  20. package/dist/{WarehouseView-mkT2e_0g.js → WarehouseView-Ty1DcynD.js} +3 -3
  21. package/dist/{app-DfqE4AvV.js → app-Cnhjho3o.js} +3 -3
  22. package/dist/app.js +1 -1
  23. package/dist/{date2-CX3RjG53.js → date2-B7iD1KxI.js} +1 -1
  24. package/dist/{dayjs.min-0VeWE9zr.js → dayjs.min-DQUng8nj.js} +2 -2
  25. package/dist/{decimal-DJHERS0j.js → decimal-q0xrbBIn.js} +1 -1
  26. package/dist/{fuzzy-xbig_3gR.js → fuzzy-c-Ppr3KD.js} +1 -1
  27. package/dist/{init-date-range-CafUxJtw.js → init-date-range-DPx7QxBp.js} +1 -1
  28. package/dist/{layout-xLQgiO2G.js → layout-CSVgzCIf.js} +1 -1
  29. package/dist/{rules-BTeY2ggR.js → rules-CpJ31qIF.js} +1 -1
  30. package/dist/{stock-estimate-iDVd6Z0l.js → stock-estimate-DwKCk68D.js} +2 -2
  31. package/dist/{supplier-Dvf6jiXm.js → supplier-B3SkQyN-.js} +1 -1
  32. package/dist/{use-inventory-binding-dialog-B84NLR0e.js → use-inventory-binding-dialog-F9I0iH7I.js} +2 -2
  33. package/dist/{xlsx-Dp5yQYnz.js → xlsx-BVwkQrma.js} +1 -1
  34. package/package.json +3 -3
@@ -1,25 +1,25 @@
1
- import { ref as I, defineComponent as oe, computed as R, resolveComponent as $, openBlock as x, createBlock as N, withCtx as B, createElementVNode as e, normalizeClass as ce, toDisplayString as A, createVNode as k, createElementBlock as j, Fragment as ne, renderList as re, unref as C, h as xe, watch as ge, isRef as De, createCommentVNode as Z, reactive as st, onMounted as Me, normalizeStyle as Ge, createTextVNode as de, Teleport as at, normalizeProps as Se, mergeProps as $e } from "vue";
1
+ import { ref as T, defineComponent as oe, computed as R, resolveComponent as $, openBlock as S, createBlock as N, withCtx as B, createElementVNode as e, normalizeClass as ce, toDisplayString as A, createVNode as k, createElementBlock as j, Fragment as ne, renderList as re, unref as C, h as xe, watch as ge, isRef as De, createCommentVNode as Z, reactive as st, onMounted as Me, normalizeStyle as Ge, createTextVNode as de, Teleport as at, normalizeProps as Se, mergeProps as $e } from "vue";
2
2
  import { _ as lt } from "./SingleColumnLayout.vue_vue_type_script_setup_true_lang-CFjO4TPG.js";
3
- import { f as We, e as ue, c as je, u as Re, h as Le, i as te, s as rt, d as Ne, a as it, C as we, I as Je } from "./app-DfqE4AvV.js";
3
+ import { f as We, e as ue, c as je, u as Re, h as Le, i as te, s as rt, d as Ne, a as it, C as we, I as Je } from "./app-Cnhjho3o.js";
4
4
  import { useCoreStore as Qe } from "@feedmepos/mf-common";
5
- import { useSnackbar as me, useDialog as Ue, useProxiedModel as Te, useBreakpoints as ut } from "@feedmepos/ui-library";
6
- import { c as ct, _ as dt, F as Oe, u as mt } from "./layout-xLQgiO2G.js";
7
- import { g as he } from "./decimal-DJHERS0j.js";
8
- import { d as pt, F as W } from "./dayjs.min-0VeWE9zr.js";
9
- import { e as ft, _ as vt, i as Xe, u as _t } from "./stock-estimate-iDVd6Z0l.js";
10
- import { _ as yt } from "./ChangeLocationComponent.vue_vue_type_script_setup_true_lang-tztl7vrE.js";
11
- import { g as Be, a as ie, b as gt, t as be, c as fe, d as ht, e as Ye, h as bt, i as Ze, j as kt, f as et, k as Ae, l as xt, m as St, n as $t, p as wt, o as Ft, q as Ct, r as Bt } from "./date2-CX3RjG53.js";
12
- import { a as Ve, A as At, M as Vt, R as Dt } from "./rules-BTeY2ggR.js";
5
+ import { useSnackbar as me, useDialog as Ue, useProxiedModel as Ie, useBreakpoints as ut } from "@feedmepos/ui-library";
6
+ import { c as ct, _ as dt, F as Oe, u as mt } from "./layout-CSVgzCIf.js";
7
+ import { g as he } from "./decimal-q0xrbBIn.js";
8
+ import { d as pt, F as W } from "./dayjs.min-DQUng8nj.js";
9
+ import { e as ft, _ as vt, i as Xe, u as _t } from "./stock-estimate-DwKCk68D.js";
10
+ import { _ as yt } from "./ChangeLocationComponent.vue_vue_type_script_setup_true_lang-DhiBtQCZ.js";
11
+ import { g as Be, a as ie, b as gt, t as be, c as fe, d as ht, e as Ye, h as bt, i as Ze, j as kt, f as et, k as Ae, l as xt, m as St, n as $t, p as wt, o as Ft, q as Ct, r as Bt } from "./date2-B7iD1KxI.js";
12
+ import { a as Ve, A as At, M as Vt, R as Dt } from "./rules-CpJ31qIF.js";
13
13
  import { g as tt } from "./util-CEVKTbZD.js";
14
- import { u as Mt } from "./use-inventory-binding-dialog-B84NLR0e.js";
15
- import { _ as jt } from "./FmMultiselectDialog.vue_vue_type_script_setup_true_lang-CQa3cFsy.js";
16
- import { _ as Rt } from "./NumberPrecisionInput.vue_vue_type_script_setup_true_lang-CavE2MEL.js";
17
- import { i as Ut } from "./init-date-range-CafUxJtw.js";
18
- import { E as Tt } from "./empty-placeholder-wf6-BWE8.js";
14
+ import { u as Mt } from "./use-inventory-binding-dialog-F9I0iH7I.js";
15
+ import { _ as jt } from "./FmMultiselectDialog.vue_vue_type_script_setup_true_lang-lXG8Dt51.js";
16
+ import { _ as Rt } from "./NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DNlqatNB.js";
17
+ import { i as Ut } from "./init-date-range-DPx7QxBp.js";
18
+ import { E as It } from "./empty-placeholder-wf6-BWE8.js";
19
19
  import { _ as ze } from "./PreviewBadge.vue_vue_type_script_setup_true_lang-BvadeWUz.js";
20
- const ve = We((u, l) => {
21
- const s = ue(), a = Qe(), g = me();
22
- return l.onError(async (f) => {
20
+ const ve = We((u, a) => {
21
+ const l = ue(), s = Qe(), g = me();
22
+ return a.onError(async (f) => {
23
23
  f.name === "SvcForbiddenError" && (g == null || g.open({
24
24
  title: f.title,
25
25
  message: f.message,
@@ -27,45 +27,47 @@ const ve = We((u, l) => {
27
27
  }));
28
28
  }), {
29
29
  async readStockBalance() {
30
- const f = s.currentLocationDBName, i = `${u.inventoryBackendUrl}/${f}/stock-balance`;
31
- return await l.get(i);
30
+ const f = l.currentLocationDBName, i = `${u.inventoryBackendUrl}/${f}/stock-balance`;
31
+ return await a.get(i);
32
32
  },
33
33
  async readSkuBalance() {
34
- var S;
35
- const f = s.currentLocationDBName, i = `${u.inventoryBackendUrl}/${f}/sku/balance`;
36
- return (((S = a.currentBusiness.value) == null ? void 0 : S.menuVersion) ?? "") === "v3" ? await l.get(i) : await l.get(`${i}?useInventoryDoc=true`);
34
+ var x;
35
+ const f = l.currentLocationDBName, i = `${u.inventoryBackendUrl}/${f}/sku/balance`;
36
+ return (((x = s.currentBusiness.value) == null ? void 0 : x.menuVersion) ?? "") === "v3" ? await a.get(i) : await a.get(`${i}?useInventoryDoc=true`);
37
37
  },
38
38
  async readSingleAdjustment(f) {
39
- const i = s.currentLocationDBName, m = `${u.inventoryBackendUrl}/${i}/adjustment`;
40
- return await l.get(`${m}?adjustmentId=${f}`);
39
+ const i = l.currentLocationDBName, m = `${u.inventoryBackendUrl}/${i}/adjustment`;
40
+ return await a.get(`${m}?adjustmentId=${f}`);
41
41
  },
42
42
  async readStockAdjustment(f, i, m) {
43
- const S = s.currentLocationDBName, v = `${u.inventoryBackendUrl}/${S}/sku`;
44
- return await l.get(`${v}?skuId=${f}&start=${i}&end=${m}`);
43
+ const x = l.currentLocationDBName, v = `${u.inventoryBackendUrl}/${x}/sku`;
44
+ return await a.get(`${v}?skuId=${f}&start=${i}&end=${m}`);
45
45
  },
46
46
  async convertSku(f) {
47
47
  var v;
48
- const i = s.currentLocationDBName, m = `${u.inventoryBackendUrl}/${i}/sku/convert`;
49
- return (((v = a.currentBusiness.value) == null ? void 0 : v.menuVersion) ?? "") === "v3" ? await l.post(m, f) : await l.post(`${m}?useInventoryDoc=true`, f);
48
+ const i = l.currentLocationDBName, m = `${u.inventoryBackendUrl}/${i}/sku/convert`;
49
+ return (((v = s.currentBusiness.value) == null ? void 0 : v.menuVersion) ?? "") === "v3" ? await a.post(m, f) : await a.post(`${m}?useInventoryDoc=true`, f);
50
50
  },
51
51
  async adjustSku(f) {
52
52
  var v;
53
- const i = s.currentLocationDBName, m = `${u.inventoryBackendUrl}/${i}/sku/adjust`;
54
- return (((v = a.currentBusiness.value) == null ? void 0 : v.menuVersion) ?? "") === "v3" ? await l.post(m, f) : await l.post(`${m}?useInventoryDoc=true`, f);
53
+ const i = l.currentLocationDBName, m = `${u.inventoryBackendUrl}/${i}/sku/adjust`;
54
+ return (((v = s.currentBusiness.value) == null ? void 0 : v.menuVersion) ?? "") === "v3" ? await a.post(m, f) : await a.post(`${m}?useInventoryDoc=true`, f);
55
55
  },
56
56
  recalculation: {
57
57
  getRecalculateAbility() {
58
- const f = s.currentLocationDBName, i = `${u.inventoryBackendUrl}/${f}/stock/operations/recalculate`;
59
- return l.get(i);
58
+ var x;
59
+ const i = `business_${(x = s.currentBusiness.value) == null ? void 0 : x._id}`, m = `${u.inventoryBackendUrl}/${i}/stock/operations/recalculate`;
60
+ return a.get(m);
60
61
  },
61
62
  startRecalculateTask() {
62
- const f = s.currentLocationDBName, i = `${u.inventoryBackendUrl}/${f}/stock/operations/recalculate?refundFromPreviousAdjustment=true`;
63
- return l.post(i);
63
+ var x;
64
+ const i = `business_${(x = s.currentBusiness.value) == null ? void 0 : x._id}`, m = `${u.inventoryBackendUrl}/${i}/stock/operations/recalculate?refundFromPreviousAdjustment=true`;
65
+ return a.post(m);
64
66
  }
65
67
  }
66
68
  };
67
69
  });
68
- function It() {
70
+ function Tt() {
69
71
  return {
70
72
  stockBalance: {
71
73
  _id: "",
@@ -74,21 +76,21 @@ function It() {
74
76
  productBalance: []
75
77
  };
76
78
  }
77
- const _e = I(It()), Ie = () => {
79
+ const _e = T(Tt()), Te = () => {
78
80
  const u = ve();
79
81
  return {
80
82
  // state
81
83
  get stockBalance() {
82
84
  return _e.value.stockBalance;
83
85
  },
84
- set stockBalance(l) {
85
- _e.value.stockBalance = l;
86
+ set stockBalance(a) {
87
+ _e.value.stockBalance = a;
86
88
  },
87
89
  get productBalance() {
88
90
  return _e.value.productBalance;
89
91
  },
90
- set productBalance(l) {
91
- _e.value.productBalance = l;
92
+ set productBalance(a) {
93
+ _e.value.productBalance = a;
92
94
  },
93
95
  // actions
94
96
  async readStockBalance() {
@@ -120,7 +122,7 @@ const Pt = [
120
122
  }
121
123
  ];
122
124
  async function Ht(u) {
123
- const s = `${(ue().currentLocation.name || "").replace(
125
+ const l = `${(ue().currentLocation.name || "").replace(
124
126
  / /g,
125
127
  "_"
126
128
  )}_${pt().format("DD_MM_YYYY_HHmm")}.xlsx`;
@@ -140,35 +142,35 @@ async function Ht(u) {
140
142
  },
141
143
  {
142
144
  name: "Balance",
143
- selector: (a) => {
144
- const g = ke(a, a.unit);
145
- return g.type === "unit" ? he(a.balance, a.unit, null, !1) : he(a.balance, a.unit, g.measurement, !1);
145
+ selector: (s) => {
146
+ const g = ke(s, s.unit);
147
+ return g.type === "unit" ? he(s.balance, s.unit, null, !1) : he(s.balance, s.unit, g.measurement, !1);
146
148
  }
147
149
  },
148
150
  {
149
151
  name: "Unit",
150
- selector: (a) => {
152
+ selector: (s) => {
151
153
  var f;
152
- const g = ke(a, a.unit);
153
- return g.type === "unit" ? a.unit.abbrev : ((f = a.unit.measurements.find((i) => i.id === g.measurement)) == null ? void 0 : f.abbrev) || "";
154
+ const g = ke(s, s.unit);
155
+ return g.type === "unit" ? s.unit.abbrev : ((f = s.unit.measurements.find((i) => i.id === g.measurement)) == null ? void 0 : f.abbrev) || "";
154
156
  }
155
157
  }
156
158
  ]
157
159
  }
158
160
  ],
159
- s
161
+ l
160
162
  );
161
163
  }
162
- function ke(u, l) {
163
- const s = localStorage.getItem(`uom:${u._id}`);
164
- return s ? s === l._id ? {
164
+ function ke(u, a) {
165
+ const l = localStorage.getItem(`uom:${u._id}`);
166
+ return l ? l === a._id ? {
165
167
  type: "unit"
166
- } : l.measurements.find((a) => a.id === s) ? {
168
+ } : a.measurements.find((s) => s.id === l) ? {
167
169
  type: "measurement",
168
- measurement: s
170
+ measurement: l
169
171
  } : {
170
172
  type: "unit"
171
- } : u.trackingMeasurement && l.measurements.find((a) => a.id === u.trackingMeasurement) ? {
173
+ } : u.trackingMeasurement && a.measurements.find((s) => s.id === u.trackingMeasurement) ? {
172
174
  type: "measurement",
173
175
  measurement: u.trackingMeasurement
174
176
  } : {
@@ -184,22 +186,22 @@ const Lt = { class: "fm-typo-en-body-md-400 flex-grow" }, nt = /* @__PURE__ */ o
184
186
  defaultTrackingMeasurement: {}
185
187
  },
186
188
  setup(u) {
187
- function l(v) {
189
+ function a(v) {
188
190
  return `uom:${v._id}`;
189
191
  }
190
- function s(v) {
191
- const o = l(a.sku);
192
- v ? localStorage.setItem(o, v) : localStorage.setItem(o, a.unit._id), g.value = ke(a.sku, a.unit);
192
+ function l(v) {
193
+ const o = a(s.sku);
194
+ v ? localStorage.setItem(o, v) : localStorage.setItem(o, s.unit._id), g.value = ke(s.sku, s.unit);
193
195
  }
194
- const a = u, g = I(ke(a.sku, a.unit)), f = R(() => {
195
- const { measurements: v } = a.unit;
196
+ const s = u, g = T(ke(s.sku, s.unit)), f = R(() => {
197
+ const { measurements: v } = s.unit;
196
198
  return [
197
199
  {
198
- label: `${he(a.amount, a.unit)}`,
200
+ label: `${he(s.amount, s.unit)}`,
199
201
  value: null
200
202
  },
201
203
  ...v.map(({ id: o }) => ({
202
- label: `${he(a.amount, a.unit, o)}`,
204
+ label: `${he(s.amount, s.unit, o)}`,
203
205
  value: o
204
206
  }))
205
207
  ];
@@ -212,19 +214,19 @@ const Lt = { class: "fm-typo-en-body-md-400 flex-grow" }, nt = /* @__PURE__ */ o
212
214
  var v;
213
215
  return ((v = f.value.find((o) => i(o))) == null ? void 0 : v.label) ?? "";
214
216
  }
215
- ), S = I(!1);
217
+ ), x = T(!1);
216
218
  return (v, o) => {
217
219
  const h = $("FmIcon"), b = $("FmMenuItem"), c = $("FmMenu");
218
- return x(), N(c, {
220
+ return S(), N(c, {
219
221
  "stop-click-propagation": "",
220
- onMenuChanged: o[0] || (o[0] = (r) => S.value = r)
222
+ onMenuChanged: o[0] || (o[0] = (r) => x.value = r)
221
223
  }, {
222
224
  "menu-button": B(() => [
223
225
  e("button", {
224
226
  type: "button",
225
227
  class: ce([
226
228
  "w-full text-left flex items-center gap-8 cursor-pointer fm-corner-radius-sm px-8 py-4 border bg-white",
227
- S.value ? "border-fm-color-primary" : "border-fm-color-neutral-gray-100"
229
+ x.value ? "border-fm-color-primary" : "border-fm-color-neutral-gray-100"
228
230
  ])
229
231
  }, [
230
232
  e("div", Lt, A(m.value), 1),
@@ -235,11 +237,11 @@ const Lt = { class: "fm-typo-en-body-md-400 flex-grow" }, nt = /* @__PURE__ */ o
235
237
  ], 2)
236
238
  ]),
237
239
  default: B(() => [
238
- (x(!0), j(ne, null, re(f.value, (r) => (x(), N(b, {
240
+ (S(!0), j(ne, null, re(f.value, (r) => (S(), N(b, {
239
241
  key: r.value ?? 0,
240
242
  label: r.label,
241
243
  "model-value": i(r),
242
- onClick: (T) => s(r.value)
244
+ onClick: (I) => l(r.value)
243
245
  }, null, 8, ["label", "model-value", "onClick"]))), 128))
244
246
  ]),
245
247
  _: 1
@@ -262,24 +264,24 @@ const Lt = { class: "fm-typo-en-body-md-400 flex-grow" }, nt = /* @__PURE__ */ o
262
264
  days: {}
263
265
  },
264
266
  setup(u) {
265
- const l = u, s = R(() => !l.days && l.days !== 0 ? "bg-fm-color-neutral-white" : l.days > 14 ? "bg-fm-color-system-success-400" : l.days >= 7 && l.days <= 14 ? "bg-fm-color-system-warning-400" : "bg-fm-color-system-error-400"), a = R(() => !l.days && l.days !== 0 ? "text-fm-color-neutral-white" : l.days > 14 ? "text-fm-color-system-success-400" : l.days >= 7 && l.days <= 14 ? "text-fm-color-system-warning-400" : "text-fm-color-system-error-400"), g = R(() => !l.days && l.days !== 0 ? "bg-fm-color-neutral-white" : l.days > 14 ? "bg-fm-color-system-success-100" : l.days >= 7 && l.days <= 14 ? "bg-fm-color-system-warning-100" : "bg-fm-color-system-error-100");
266
- return (f, i) => typeof l.days == "number" ? (x(), j("div", Nt, [
267
+ const a = u, l = R(() => !a.days && a.days !== 0 ? "bg-fm-color-neutral-white" : a.days > 14 ? "bg-fm-color-system-success-400" : a.days >= 7 && a.days <= 14 ? "bg-fm-color-system-warning-400" : "bg-fm-color-system-error-400"), s = R(() => !a.days && a.days !== 0 ? "text-fm-color-neutral-white" : a.days > 14 ? "text-fm-color-system-success-400" : a.days >= 7 && a.days <= 14 ? "text-fm-color-system-warning-400" : "text-fm-color-system-error-400"), g = R(() => !a.days && a.days !== 0 ? "bg-fm-color-neutral-white" : a.days > 14 ? "bg-fm-color-system-success-100" : a.days >= 7 && a.days <= 14 ? "bg-fm-color-system-warning-100" : "bg-fm-color-system-error-100");
268
+ return (f, i) => typeof a.days == "number" ? (S(), j("div", Nt, [
267
269
  e("div", {
268
270
  class: ce([g.value, "flex items-center gap-8 p-4 fm-corner-radius-md"])
269
271
  }, [
270
272
  e("div", {
271
- class: ce([s.value, "w-12 h-12 rounded-full"])
273
+ class: ce([l.value, "w-12 h-12 rounded-full"])
272
274
  }, null, 2),
273
275
  e("div", {
274
- class: ce(["fm-typo-en-body-md-600", a.value])
275
- }, A(l.days) + " days", 3)
276
+ class: ce(["fm-typo-en-body-md-600", s.value])
277
+ }, A(a.days) + " days", 3)
276
278
  ], 2)
277
- ])) : (x(), j("div", Ot, zt));
279
+ ])) : (S(), j("div", Ot, zt));
278
280
  }
279
281
  }), qt = /* @__PURE__ */ e("div", { class: "whitespace-nowrap" }, "Days remaining", -1), Kt = /* @__PURE__ */ oe({
280
282
  __name: "StockHeaderPreview",
281
283
  setup(u) {
282
- return (l, s) => (x(), N(vt, null, {
284
+ return (a, l) => (S(), N(vt, null, {
283
285
  default: B(() => [
284
286
  qt
285
287
  ]),
@@ -288,7 +290,7 @@ const Lt = { class: "fm-typo-en-body-md-400 flex-grow" }, nt = /* @__PURE__ */ o
288
290
  }
289
291
  });
290
292
  function Gt(u) {
291
- const l = ue(), s = Ie(), a = Ue(), g = I();
293
+ const a = ue(), l = Te(), s = Ue(), g = T();
292
294
  async function f(b) {
293
295
  const c = {
294
296
  sku: b,
@@ -299,18 +301,18 @@ function Gt(u) {
299
301
  };
300
302
  g.value = c;
301
303
  }
302
- const i = I();
304
+ const i = T();
303
305
  async function m(b) {
304
306
  var U, w, V;
305
307
  if (!!!((w = (U = b.convert) == null ? void 0 : U.inventoryBindings) != null && w.length)) {
306
- a.open({
308
+ s.open({
307
309
  title: "Cannot convert stock",
308
310
  message: "Stock is not convertable due to no recipe or ingredient to convert."
309
311
  });
310
312
  return;
311
313
  }
312
- const T = {
313
- maxCount: ((V = s.productBalance.find(({ id: M }) => M === b._id)) == null ? void 0 : V.count) || 0,
314
+ const I = {
315
+ maxCount: ((V = l.productBalance.find(({ id: M }) => M === b._id)) == null ? void 0 : V.count) || 0,
314
316
  sku: b,
315
317
  show: !0,
316
318
  "onUpdate:show"(M) {
@@ -320,21 +322,21 @@ function Gt(u) {
320
322
  u();
321
323
  }
322
324
  };
323
- i.value = T;
325
+ i.value = I;
324
326
  }
325
- const S = I();
327
+ const x = T();
326
328
  async function v(b) {
327
329
  const c = {
328
330
  stock: b,
329
331
  show: !0,
330
332
  "onUpdate:show"(r) {
331
- S.value.show = r;
333
+ x.value.show = r;
332
334
  },
333
335
  onSubmitted() {
334
336
  u();
335
337
  }
336
338
  };
337
- S.value = c;
339
+ x.value = c;
338
340
  }
339
341
  function o(b, c) {
340
342
  const r = je(c);
@@ -397,7 +399,7 @@ function Gt(u) {
397
399
  cell(b) {
398
400
  var c;
399
401
  return ct(
400
- ((c = l._currentLocation) == null ? void 0 : c.type) === "restaurant" ? Pt : Et,
402
+ ((c = a._currentLocation) == null ? void 0 : c.type) === "restaurant" ? Pt : Et,
401
403
  (r) => o(r, b.row.original)
402
404
  );
403
405
  },
@@ -411,7 +413,7 @@ function Gt(u) {
411
413
  ],
412
414
  stockHistoryProps: g,
413
415
  convertSkuDialogProps: i,
414
- adjustSkuDialogProps: S,
416
+ adjustSkuDialogProps: x,
415
417
  showSkuHistory: f
416
418
  };
417
419
  }
@@ -430,19 +432,19 @@ const Wt = {
430
432
  isInteger(u = "Must be an integer") {
431
433
  return this.error ? this : (this.toInt(), isNaN(this.context) && (this.error = u), this);
432
434
  },
433
- min(u, l) {
435
+ min(u, a) {
434
436
  if (this.error) return this;
435
437
  try {
436
- typeof this.context == "number" ? +this.context < u && (this.error = l ?? `Must be at least ${u}`) : Object.prototype.hasOwnProperty.call(this.context, "length") ? +this.context.length < u && (this.error = l ?? `Must be at least ${u}`) : this.error = "Length cannot be determined";
438
+ typeof this.context == "number" ? +this.context < u && (this.error = a ?? `Must be at least ${u}`) : Object.prototype.hasOwnProperty.call(this.context, "length") ? +this.context.length < u && (this.error = a ?? `Must be at least ${u}`) : this.error = "Length cannot be determined";
437
439
  } catch {
438
440
  this.error = "Length cannot be determined";
439
441
  }
440
442
  return this;
441
443
  },
442
- max(u, l) {
444
+ max(u, a) {
443
445
  if (this.error) return this;
444
446
  try {
445
- typeof this.context == "number" ? +this.context > u && (this.error = l ?? `Must be at most ${u}`) : "length" in this.context ? +this.context.length > u && (this.error = l ?? `Must be at most ${u}`) : this.error = "Length cannot be determined";
447
+ typeof this.context == "number" ? +this.context > u && (this.error = a ?? `Must be at most ${u}`) : "length" in this.context ? +this.context.length > u && (this.error = a ?? `Must be at most ${u}`) : this.error = "Length cannot be determined";
446
448
  } catch {
447
449
  this.error = "Length cannot be determined";
448
450
  }
@@ -460,11 +462,11 @@ const Jt = { class: "flex items-center" }, Qt = { class: "fm-typo-en-title-md-80
460
462
  show: { type: Boolean }
461
463
  },
462
464
  emits: ["update:show", "submitted"],
463
- setup(u, { expose: l, emit: s }) {
464
- const a = u, g = s, f = Mt(), i = Re(), m = ve(), S = me(), v = I(0), o = I(null), h = R(() => i.skus), b = R(
465
+ setup(u, { expose: a, emit: l }) {
466
+ const s = u, g = l, f = Mt(), i = Re(), m = ve(), x = me(), v = T(0), o = T(null), h = R(() => i.skus), b = R(
465
467
  () => {
466
468
  var t, n;
467
- return (((n = (t = a.sku) == null ? void 0 : t.convert) == null ? void 0 : n.inventoryBindings) ?? []).filter(
469
+ return (((n = (t = s.sku) == null ? void 0 : t.convert) == null ? void 0 : n.inventoryBindings) ?? []).filter(
468
470
  (p) => p.type === Le.enum.SKU
469
471
  );
470
472
  }
@@ -473,46 +475,46 @@ const Jt = { class: "flex items-center" }, Qt = { class: "fm-typo-en-title-md-80
473
475
  return !!o.value;
474
476
  },
475
477
  set(t) {
476
- t ? o.value = je(b.value) : (o.value = null, v.value = Math.min(v.value, a.maxCount ?? 0));
478
+ t ? o.value = je(b.value) : (o.value = null, v.value = Math.min(v.value, s.maxCount ?? 0));
477
479
  }
478
- }), r = I(!1);
479
- ge([() => a.show], ([t]) => {
480
+ }), r = T(!1);
481
+ ge([() => s.show], ([t]) => {
480
482
  t && (v.value = 0);
481
483
  });
482
- function T() {
483
- L(a.sku, be(v.value), o.value);
484
+ function I() {
485
+ L(s.sku, be(v.value), o.value);
484
486
  }
485
487
  function U(t) {
486
488
  if (o.value)
487
489
  return !0;
488
- const n = qe(t).isInteger().max(a.maxCount ?? 0).error ?? "";
490
+ const n = qe(t).isInteger().max(s.maxCount ?? 0).error ?? "";
489
491
  return n || !0;
490
492
  }
491
493
  function w(t) {
492
494
  var _;
493
- const n = (_ = a.sku.convert) != null && _.measurement ? a.sku.unit.measurements.find((F) => {
495
+ const n = (_ = s.sku.convert) != null && _.measurement ? s.sku.unit.measurements.find((F) => {
494
496
  var Y;
495
- return F.id === ((Y = a.sku.convert) == null ? void 0 : Y.measurement);
496
- }) ?? null : null, p = Be(a.sku.unit, n), d = ht(+t);
497
+ return F.id === ((Y = s.sku.convert) == null ? void 0 : Y.measurement);
498
+ }) ?? null : null, p = Be(s.sku.unit, n), d = ht(+t);
497
499
  return qe(d).isInteger().max(p).error ? "Precision cannot be more than " + p : !0;
498
500
  }
499
501
  const V = R(
500
502
  () => {
501
503
  var t, n;
502
- return (t = a.sku.convert) != null && t.measurement ? (n = a.sku.unit.measurements.find((p) => {
504
+ return (t = s.sku.convert) != null && t.measurement ? (n = s.sku.unit.measurements.find((p) => {
503
505
  var d;
504
- return p.id === ((d = a.sku.convert) == null ? void 0 : d.measurement);
505
- })) == null ? void 0 : n.abbrev : a.sku.unit.abbrev;
506
+ return p.id === ((d = s.sku.convert) == null ? void 0 : d.measurement);
507
+ })) == null ? void 0 : n.abbrev : s.sku.unit.abbrev;
506
508
  }
507
509
  ), M = R(() => {
508
510
  var p, d, y;
509
- const t = (d = (p = a.sku.convert) == null ? void 0 : p.inventoryBindings) == null ? void 0 : d.filter((_) => _.type === "SKU");
511
+ const t = (d = (p = s.sku.convert) == null ? void 0 : p.inventoryBindings) == null ? void 0 : d.filter((_) => _.type === "SKU");
510
512
  return (y = o.value ?? t) == null ? void 0 : y.map((_) => {
511
513
  var ee, G, ae, Pe, Ee;
512
- const F = i.skus.find((pe) => pe._id === _.id), Y = ((ee = _.measurement) == null ? void 0 : ee.abbrev) ?? ((G = F == null ? void 0 : F.unit) == null ? void 0 : G.abbrev), K = (ae = a.sku.convert) != null && ae.measurement ? a.sku.unit.measurements.find((pe) => {
514
+ const F = i.skus.find((pe) => pe._id === _.id), Y = ((ee = _.measurement) == null ? void 0 : ee.abbrev) ?? ((G = F == null ? void 0 : F.unit) == null ? void 0 : G.abbrev), K = (ae = s.sku.convert) != null && ae.measurement ? s.sku.unit.measurements.find((pe) => {
513
515
  var He;
514
- return pe.id === ((He = a.sku.convert) == null ? void 0 : He.measurement);
515
- }) ?? null : null, le = Be(a.sku.unit, K), D = w(`${v.value}`) === !0 ? ie(
516
+ return pe.id === ((He = s.sku.convert) == null ? void 0 : He.measurement);
517
+ }) ?? null : null, le = Be(s.sku.unit, K), D = w(`${v.value}`) === !0 ? ie(
516
518
  gt(
517
519
  _.amount,
518
520
  be(+v.value, le)
@@ -525,8 +527,8 @@ const Jt = { class: "flex items-center" }, Qt = { class: "fm-typo-en-title-md-80
525
527
  abbrev: Y
526
528
  };
527
529
  });
528
- }), H = I();
529
- l({
530
+ }), H = T();
531
+ a({
530
532
  validateInputs: () => {
531
533
  var t, n;
532
534
  (n = (t = H.value) == null ? void 0 : t.validateInputs) == null || n.call(t);
@@ -540,7 +542,7 @@ const Jt = { class: "flex items-center" }, Qt = { class: "fm-typo-en-title-md-80
540
542
  (n = (t = H.value) == null ? void 0 : t.resetInputs) == null || n.call(t);
541
543
  }
542
544
  });
543
- const P = Te(a, "show");
545
+ const P = Ie(s, "show");
544
546
  async function L(t, n, p) {
545
547
  r.value = !0;
546
548
  try {
@@ -561,7 +563,7 @@ const Jt = { class: "flex items-center" }, Qt = { class: "fm-typo-en-title-md-80
561
563
  ]
562
564
  }), g("update:show", !1), g("submitted");
563
565
  } catch (d) {
564
- S.open({
566
+ x.open({
565
567
  title: "Something went wrong",
566
568
  message: `Cannot convert ${t.name}. Please try again.`,
567
569
  type: "error"
@@ -611,17 +613,17 @@ const Jt = { class: "flex items-center" }, Qt = { class: "fm-typo-en-title-md-80
611
613
  f.promptIngredientsBinding(
612
614
  t,
613
615
  (n) => o.value = n,
614
- a.sku._id
616
+ s.sku._id
615
617
  );
616
618
  }
617
619
  return ge(
618
- () => a.show,
620
+ () => s.show,
619
621
  (t) => {
620
622
  t || (o.value = null, v.value = 0);
621
623
  }
622
624
  ), (t, n) => {
623
625
  const p = $("FmTextField"), d = $("FmForm"), y = $("FmCard"), _ = $("FmSwitch"), F = $("FmFormGroup"), Y = $("FmSelect"), K = $("FmButton"), le = $("FmSideSheet");
624
- return x(), N(le, {
626
+ return S(), N(le, {
625
627
  "dismiss-away": "",
626
628
  modelValue: C(P),
627
629
  "onUpdate:modelValue": n[3] || (n[3] = (D) => De(P) ? P.value = D : null),
@@ -637,7 +639,7 @@ const Jt = { class: "flex items-center" }, Qt = { class: "fm-typo-en-title-md-80
637
639
  k(d, {
638
640
  ref_key: "formRef",
639
641
  ref: H,
640
- onValidationSuccess: T
642
+ onValidationSuccess: I
641
643
  }, {
642
644
  default: B(() => [
643
645
  k(p, {
@@ -659,9 +661,9 @@ const Jt = { class: "flex items-center" }, Qt = { class: "fm-typo-en-title-md-80
659
661
  default: B(() => [
660
662
  e("div", Zt, [
661
663
  en,
662
- (x(!0), j(ne, null, re(M.value, (D) => {
664
+ (S(!0), j(ne, null, re(M.value, (D) => {
663
665
  var E, q;
664
- return x(), j("div", {
666
+ return S(), j("div", {
665
667
  key: (E = D.sku) == null ? void 0 : E._id,
666
668
  class: "flex items-center"
667
669
  }, [
@@ -683,14 +685,14 @@ const Jt = { class: "flex items-center" }, Qt = { class: "fm-typo-en-title-md-80
683
685
  label: "Override deduction",
684
686
  "label-placement": "right"
685
687
  }, null, 8, ["modelValue"]),
686
- c.value ? (x(), j(ne, { key: 0 }, [
688
+ c.value ? (S(), j(ne, { key: 0 }, [
687
689
  k(F, {
688
690
  modelValue: o.value,
689
691
  rules: [C(At)(1, "Must have at least one ingredient binding")]
690
692
  }, null, 8, ["modelValue", "rules"]),
691
693
  e("div", sn, [
692
694
  an,
693
- (x(!0), j(ne, null, re(o.value, (D) => (x(), N(F, {
695
+ (S(!0), j(ne, null, re(o.value, (D) => (S(), N(F, {
694
696
  key: D.id,
695
697
  disabled: r.value,
696
698
  modelValue: +C(ie)(D.amount ?? { amount: 1, precision: 0 }),
@@ -772,12 +774,12 @@ const Jt = { class: "flex items-center" }, Qt = { class: "fm-typo-en-title-md-80
772
774
  };
773
775
  }
774
776
  });
775
- function Fe(u, l) {
776
- const s = be(u, l);
777
- return { ...s, amount: -s.amount };
777
+ function Fe(u, a) {
778
+ const l = be(u, a);
779
+ return { ...l, amount: -l.amount };
778
780
  }
779
- function Ke(u, l) {
780
- return be(Math.abs(u), l);
781
+ function Ke(u, a) {
782
+ return be(Math.abs(u), a);
781
783
  }
782
784
  const Ce = {
783
785
  [te.enum.DAMAGE]: {
@@ -807,67 +809,67 @@ const Ce = {
807
809
  disabled: { type: Boolean }
808
810
  },
809
811
  emits: ["update:modelValue", "click:delete"],
810
- setup(u, { emit: l }) {
811
- const s = u, a = l, g = R(
812
+ setup(u, { emit: a }) {
813
+ const l = u, s = a, g = R(
812
814
  () => Object.keys(Ce).map((o) => ({
813
815
  label: rt(o),
814
816
  value: o
815
817
  }))
816
- ), f = R(() => tt(s.modelValue.doc.unit, !0)), i = R({
818
+ ), f = R(() => tt(l.modelValue.doc.unit, !0)), i = R({
817
819
  get() {
818
- return s.modelValue.type ?? te.enum.PURCHASE;
820
+ return l.modelValue.type ?? te.enum.PURCHASE;
819
821
  },
820
822
  set(o) {
821
823
  const h = {
822
- ...s.modelValue
824
+ ...l.modelValue
823
825
  };
824
826
  h.type = o;
825
- const b = Ye(s.modelValue.amount);
827
+ const b = Ye(l.modelValue.amount);
826
828
  h.amount = Ce[h.type].toAdjustmentAmount(
827
829
  +ie(b),
828
830
  b.precision
829
- ), a("update:modelValue", h);
831
+ ), s("update:modelValue", h);
830
832
  }
831
833
  }), m = R({
832
834
  get() {
833
- const o = Ye(s.modelValue.amount);
835
+ const o = Ye(l.modelValue.amount);
834
836
  return +ie(o);
835
837
  },
836
838
  set(o) {
837
839
  const h = {
838
- ...s.modelValue
840
+ ...l.modelValue
839
841
  }, b = fe(o);
840
842
  h.amount = Ce[i.value].toAdjustmentAmount(
841
843
  o,
842
844
  b.precision
843
- ), a("update:modelValue", h);
845
+ ), s("update:modelValue", h);
844
846
  }
845
- }), S = R({
847
+ }), x = R({
846
848
  get() {
847
849
  var o;
848
- return ((o = s.modelValue.measurement) == null ? void 0 : o.id) ?? null;
850
+ return ((o = l.modelValue.measurement) == null ? void 0 : o.id) ?? null;
849
851
  },
850
852
  set(o) {
851
853
  var b, c;
852
854
  const h = {
853
- ...s.modelValue
855
+ ...l.modelValue
854
856
  };
855
- h.measurement = ((c = (b = s.modelValue.doc.unit) == null ? void 0 : b.measurements) == null ? void 0 : c.find((r) => r.id === o)) ?? null, a("update:modelValue", h);
857
+ h.measurement = ((c = (b = l.modelValue.doc.unit) == null ? void 0 : b.measurements) == null ? void 0 : c.find((r) => r.id === o)) ?? null, s("update:modelValue", h);
856
858
  }
857
859
  }), v = R({
858
860
  get() {
859
- return s.modelValue.remark ?? "";
861
+ return l.modelValue.remark ?? "";
860
862
  },
861
863
  set(o) {
862
864
  const h = {
863
- ...s.modelValue
865
+ ...l.modelValue
864
866
  };
865
- h.remark = o, a("update:modelValue", h);
867
+ h.remark = o, s("update:modelValue", h);
866
868
  }
867
869
  });
868
870
  return (o, h) => {
869
- const b = $("FmButton"), c = $("FmSelect"), r = $("FmTextarea"), T = $("FmCard");
870
- return x(), N(T, {
871
+ const b = $("FmButton"), c = $("FmSelect"), r = $("FmTextarea"), I = $("FmCard");
872
+ return S(), N(I, {
871
873
  variant: "outlined",
872
874
  class: "grid grid-cols-2 gap-8 p-16"
873
875
  }, {
@@ -877,7 +879,7 @@ const Ce = {
877
879
  k(b, {
878
880
  variant: "tertiary",
879
881
  "prepend-icon": "delete",
880
- onClick: h[0] || (h[0] = (U) => a("click:delete"))
882
+ onClick: h[0] || (h[0] = (U) => s("click:delete"))
881
883
  })
882
884
  ]),
883
885
  k(c, {
@@ -905,8 +907,8 @@ const Ce = {
905
907
  disabled: o.disabled,
906
908
  label: "Unit",
907
909
  items: f.value,
908
- modelValue: S.value,
909
- "onUpdate:modelValue": h[3] || (h[3] = (U) => S.value = U)
910
+ modelValue: x.value,
911
+ "onUpdate:modelValue": h[3] || (h[3] = (U) => x.value = U)
910
912
  }, null, 8, ["disabled", "items", "modelValue"]),
911
913
  k(r, {
912
914
  class: "col-span-2",
@@ -930,13 +932,13 @@ const Ce = {
930
932
  show: { type: Boolean }
931
933
  },
932
934
  emits: ["update:show", "submitted"],
933
- setup(u, { expose: l, emit: s }) {
934
- const a = u, g = s, f = Re(), i = Ue(), m = ve(), S = me(), v = I(!1);
935
+ setup(u, { expose: a, emit: l }) {
936
+ const s = u, g = l, f = Re(), i = Ue(), m = ve(), x = me(), v = T(!1);
935
937
  function o() {
936
938
  r(je(c));
937
939
  }
938
- const h = I();
939
- l({
940
+ const h = T();
941
+ a({
940
942
  validateInputs: () => {
941
943
  var w, V;
942
944
  (V = (w = h.value) == null ? void 0 : w.validateInputs) == null || V.call(w);
@@ -950,25 +952,25 @@ const Ce = {
950
952
  (V = (w = h.value) == null ? void 0 : w.resetInputs) == null || V.call(w);
951
953
  }
952
954
  });
953
- const b = Te(a, "show"), c = st({
955
+ const b = Ie(s, "show"), c = st({
954
956
  remark: "",
955
957
  adjustments: [
956
958
  {
957
959
  id: `sku_${(/* @__PURE__ */ new Date()).toISOString()}_${Math.random().toString(16).slice(2, 8)}`,
958
960
  type: te.enum.PURCHASE,
959
- doc: a.stock,
961
+ doc: s.stock,
960
962
  measurement: null,
961
963
  remark: "",
962
964
  amount: fe(1)
963
965
  }
964
966
  ]
965
967
  });
966
- ge([() => a.show], ([w]) => {
968
+ ge([() => s.show], ([w]) => {
967
969
  w && (c.remark = "", c.adjustments = [
968
970
  {
969
971
  id: `sku_${(/* @__PURE__ */ new Date()).toISOString()}_${Math.random().toString(16).slice(2, 8)}`,
970
972
  type: te.enum.PURCHASE,
971
- doc: a.stock,
973
+ doc: s.stock,
972
974
  measurement: null,
973
975
  remark: "",
974
976
  amount: fe(1)
@@ -990,7 +992,7 @@ const Ce = {
990
992
  }))
991
993
  }), g("update:show", !1), g("submitted");
992
994
  } catch (V) {
993
- S.open({
995
+ x.open({
994
996
  title: "Something went wrong",
995
997
  message: "Cannot adjust ingredients. Please try again.",
996
998
  type: "error"
@@ -999,7 +1001,7 @@ const Ce = {
999
1001
  v.value = !1;
1000
1002
  }
1001
1003
  }
1002
- function T() {
1004
+ function I() {
1003
1005
  const w = f.skus.map((M) => ({
1004
1006
  label: M.name,
1005
1007
  sublabel: M.code,
@@ -1042,7 +1044,7 @@ const Ce = {
1042
1044
  }
1043
1045
  return (w, V) => {
1044
1046
  const M = $("FmTextarea"), H = $("FmButton"), P = $("FmForm"), L = $("FmSideSheet");
1045
- return x(), N(L, {
1047
+ return S(), N(L, {
1046
1048
  modelValue: C(b),
1047
1049
  "onUpdate:modelValue": V[2] || (V[2] = (z) => De(b) ? b.value = z : null),
1048
1050
  "dismiss-away": "",
@@ -1070,10 +1072,10 @@ const Ce = {
1070
1072
  "prepend-icon": "add",
1071
1073
  variant: "tertiary",
1072
1074
  size: "md",
1073
- onClick: T
1075
+ onClick: I
1074
1076
  })
1075
1077
  ]),
1076
- (x(!0), j(ne, null, re(c.adjustments, (z, O) => (x(), N(pn, {
1078
+ (S(!0), j(ne, null, re(c.adjustments, (z, O) => (S(), N(pn, {
1077
1079
  key: z.id,
1078
1080
  modelValue: c.adjustments[O],
1079
1081
  "onUpdate:modelValue": (J) => c.adjustments[O] = J,
@@ -1099,22 +1101,22 @@ const Ce = {
1099
1101
  }, 8, ["modelValue"]);
1100
1102
  };
1101
1103
  }
1102
- }), hn = We((u, l) => ({
1104
+ }), hn = We((u, a) => ({
1103
1105
  // TODO: remove once latest inventory backend has been push
1104
- async findBillsByBusinessId(s, a, g) {
1105
- const f = `${u.businessesBackendUrl}/${s}/reports/find-many`, i = {
1106
+ async findBillsByBusinessId(l, s, g) {
1107
+ const f = `${u.businessesBackendUrl}/${l}/reports/find-many`, i = {
1106
1108
  // type: TYPE.bill,
1107
1109
  type: "bill",
1108
- restaurantIds: a,
1110
+ restaurantIds: s,
1109
1111
  ids: g
1110
1112
  };
1111
- return await l.post(f, i);
1113
+ return await a.post(f, i);
1112
1114
  },
1113
- async findBillsById(s) {
1115
+ async findBillsById(l) {
1114
1116
  const g = ue().currentLocationDBName, f = `${u.inventoryBackendUrl}/${g}/bill/search`, i = {
1115
- ids: s
1117
+ ids: l
1116
1118
  };
1117
- return await l.post(f, i);
1119
+ return await a.post(f, i);
1118
1120
  }
1119
1121
  })), bn = { class: "p-16" }, kn = { class: "fm-typo-en-body-md-600 flex-grow" }, xn = { class: "flex-grow text-fm-color-typo-secondary" }, Sn = {
1120
1122
  key: 0,
@@ -1133,31 +1135,31 @@ const Ce = {
1133
1135
  bills: { default: () => [] }
1134
1136
  },
1135
1137
  setup(u) {
1136
- const l = u, s = I(!1), a = I(), g = I(null), f = R(() => g.value === null ? "unset" : s.value ? `${g.value}px` : "0px");
1138
+ const a = u, l = T(!1), s = T(), g = T(null), f = R(() => g.value === null ? "unset" : l.value ? `${g.value}px` : "0px");
1137
1139
  Me(() => {
1138
- var S;
1139
- g.value = ((S = a.value) == null ? void 0 : S.scrollHeight) || 0;
1140
+ var x;
1141
+ g.value = ((x = s.value) == null ? void 0 : x.scrollHeight) || 0;
1140
1142
  });
1141
1143
  const i = R(() => {
1142
1144
  var c;
1143
- const S = l.record.adjustments, v = l.sku, o = {}, b = S.flatMap((r) => {
1144
- var T;
1145
- return ((T = r.skus) == null ? void 0 : T.filter((U) => U.sku._id === v._id)) ?? [];
1145
+ const x = a.record.adjustments, v = a.sku, o = {}, b = x.flatMap((r) => {
1146
+ var I;
1147
+ return ((I = r.skus) == null ? void 0 : I.filter((U) => U.sku._id === v._id)) ?? [];
1146
1148
  }).flatMap((r) => r.amounts);
1147
1149
  for (const r of b) {
1148
- const T = r.measurement ? bt(r.measurement.conversion, r.amount) : r.amount;
1149
- o[c = r.type] ?? (o[c] = { amount: 0, precision: 0 }), o[r.type] = Ze(T, o[r.type]);
1150
+ const I = r.measurement ? bt(r.measurement.conversion, r.amount) : r.amount;
1151
+ o[c = r.type] ?? (o[c] = { amount: 0, precision: 0 }), o[r.type] = Ze(I, o[r.type]);
1150
1152
  }
1151
1153
  return Object.entries(o).reduce(
1152
- (r, [T, U]) => (r[T] = /// comment, because without it formatter makes code uglier
1154
+ (r, [I, U]) => (r[I] = /// comment, because without it formatter makes code uglier
1153
1155
  `${W.toFormatString({
1154
1156
  value: U,
1155
1157
  precision: 4
1156
1158
  })} ${v.unit.abbrev}`, r),
1157
1159
  {}
1158
1160
  );
1159
- }), m = R(() => l.record.adjustmentsByTime.map(({ date: S, adjustments: v }) => ({
1160
- time: kt(new Date(S)),
1161
+ }), m = R(() => a.record.adjustmentsByTime.map(({ date: x, adjustments: v }) => ({
1162
+ time: kt(new Date(x)),
1161
1163
  adjustments: v.flatMap(
1162
1164
  (o) => {
1163
1165
  var h, b;
@@ -1169,11 +1171,11 @@ const Ce = {
1169
1171
  }
1170
1172
  ).flatMap((o) => {
1171
1173
  var c;
1172
- const h = (c = l.bills.find((r) => r._id === o.ref)) == null ? void 0 : c.seqNumber, b = h ? `Bill ${h}` : "";
1174
+ const h = (c = a.bills.find((r) => r._id === o.ref)) == null ? void 0 : c.seqNumber, b = h ? `Bill ${h}` : "";
1173
1175
  return o.amounts.map((r) => {
1174
- var T;
1176
+ var I;
1175
1177
  return {
1176
- amount: `${W.toFormatString({ value: r.amount, precision: 4 })} ${((T = r.measurement) == null ? void 0 : T.abbrev) ?? o.sku.unit.abbrev}`,
1178
+ amount: `${W.toFormatString({ value: r.amount, precision: 4 })} ${((I = r.measurement) == null ? void 0 : I.abbrev) ?? o.sku.unit.abbrev}`,
1177
1179
  backdateFrom: o.backdateFrom,
1178
1180
  name: r.type,
1179
1181
  remark: r.remark || b || "",
@@ -1182,23 +1184,23 @@ const Ce = {
1182
1184
  });
1183
1185
  })
1184
1186
  })));
1185
- return (S, v) => {
1187
+ return (x, v) => {
1186
1188
  const o = $("FmIcon"), h = $("FmTooltip"), b = $("FmCard");
1187
- return x(), N(b, { variant: "outlined" }, {
1189
+ return S(), N(b, { variant: "outlined" }, {
1188
1190
  default: B(() => [
1189
1191
  e("div", bn, [
1190
1192
  e("div", {
1191
1193
  class: "flex items-center cursor-pointer mb-1",
1192
- onClick: v[0] || (v[0] = (c) => s.value = !s.value)
1194
+ onClick: v[0] || (v[0] = (c) => l.value = !l.value)
1193
1195
  }, [
1194
- e("div", kn, A(S.record.date), 1),
1196
+ e("div", kn, A(x.record.date), 1),
1195
1197
  k(o, {
1196
- name: s.value ? "expand_more" : "expand_less",
1198
+ name: l.value ? "expand_more" : "expand_less",
1197
1199
  color: "#777777",
1198
1200
  size: "md"
1199
1201
  }, null, 8, ["name"])
1200
1202
  ]),
1201
- (x(!0), j(ne, null, re(i.value, (c, r) => (x(), j("div", {
1203
+ (S(!0), j(ne, null, re(i.value, (c, r) => (S(), j("div", {
1202
1204
  key: r,
1203
1205
  class: "flex flex-row py-1",
1204
1206
  style: { "font-size": "0.8rem" }
@@ -1214,7 +1216,7 @@ const Ce = {
1214
1216
  ]))), 128)),
1215
1217
  e("div", {
1216
1218
  ref_key: "detailRef",
1217
- ref: a,
1219
+ ref: s,
1218
1220
  style: Ge({
1219
1221
  fontSize: "0.8rem",
1220
1222
  maxHeight: f.value,
@@ -1222,20 +1224,20 @@ const Ce = {
1222
1224
  transition: "max-height 0.2s ease-out"
1223
1225
  })
1224
1226
  }, [
1225
- m.value.length ? (x(), j("hr", Sn)) : Z("", !0),
1226
- (x(!0), j(ne, null, re(m.value, (c) => (x(), j("div", {
1227
+ m.value.length ? (S(), j("hr", Sn)) : Z("", !0),
1228
+ (S(!0), j(ne, null, re(m.value, (c) => (S(), j("div", {
1227
1229
  key: c.time,
1228
1230
  class: "flex gap-1 w-full"
1229
1231
  }, [
1230
1232
  e("div", $n, A(c.time), 1),
1231
1233
  e("div", wn, [
1232
- (x(!0), j(ne, null, re(c.adjustments, (r) => (x(), j("div", {
1234
+ (S(!0), j(ne, null, re(c.adjustments, (r) => (S(), j("div", {
1233
1235
  key: r.name,
1234
1236
  class: "flex gap-1"
1235
1237
  }, [
1236
1238
  e("div", Fn, [
1237
1239
  de(A(r.name) + " ", 1),
1238
- r.backdateFrom ? (x(), N(h, {
1240
+ r.backdateFrom ? (S(), N(h, {
1239
1241
  key: 0,
1240
1242
  variant: "plain",
1241
1243
  placement: "top",
@@ -1253,7 +1255,7 @@ const Ce = {
1253
1255
  ]),
1254
1256
  _: 2
1255
1257
  }, 1024)) : Z("", !0),
1256
- r.remark ? (x(), j("span", Bn, " # " + A(r.remark), 1)) : Z("", !0)
1258
+ r.remark ? (S(), j("span", Bn, " # " + A(r.remark), 1)) : Z("", !0)
1257
1259
  ]),
1258
1260
  e("div", {
1259
1261
  class: ce({
@@ -1262,7 +1264,7 @@ const Ce = {
1262
1264
  "ml-auto": !0
1263
1265
  })
1264
1266
  }, A(r.amount), 3),
1265
- r.cost ? (x(), j("div", An, " (" + A(C(Ae)(r.cost, !1, r.cost.precision)) + ") ", 1)) : Z("", !0)
1267
+ r.cost ? (S(), j("div", An, " (" + A(C(Ae)(r.cost, !1, r.cost.precision)) + ") ", 1)) : Z("", !0)
1266
1268
  ]))), 128))
1267
1269
  ])
1268
1270
  ]))), 128))
@@ -1274,47 +1276,47 @@ const Ce = {
1274
1276
  };
1275
1277
  }
1276
1278
  });
1277
- function Dn(u, l) {
1279
+ function Dn(u, a) {
1278
1280
  var f;
1279
- const s = Object.keys(te.enum).reduce(
1281
+ const l = Object.keys(te.enum).reduce(
1280
1282
  (i, m) => (i[m] = { amount: 0, precision: 0 }, i),
1281
1283
  {}
1282
1284
  );
1283
- if (!l)
1284
- return Object.entries(s).reduce(
1285
+ if (!a)
1286
+ return Object.entries(l).reduce(
1285
1287
  (i, [m]) => (i[m] = W.fromNumber(0), i),
1286
1288
  {}
1287
1289
  );
1288
1290
  const g = u.flatMap((i) => {
1289
1291
  var m;
1290
- return ((m = i.skus) == null ? void 0 : m.filter((S) => S.sku._id === l._id)) ?? [];
1292
+ return ((m = i.skus) == null ? void 0 : m.filter((x) => x.sku._id === a._id)) ?? [];
1291
1293
  }).flatMap((i) => i.amounts);
1292
1294
  for (const i of g) {
1293
1295
  const m = i.measurement ? W.multiply([i.measurement.conversion, i.amount]) : i.amount;
1294
- s[f = i.type] ?? (s[f] = { amount: 0, precision: 0 }), s[i.type] = W.add([m, s[i.type]]);
1296
+ l[f = i.type] ?? (l[f] = { amount: 0, precision: 0 }), l[i.type] = W.add([m, l[i.type]]);
1295
1297
  }
1296
- return Object.entries(s).reduce(
1297
- (i, [m, S]) => {
1298
+ return Object.entries(l).reduce(
1299
+ (i, [m, x]) => {
1298
1300
  const v = {
1299
- ...S,
1300
- amount: Math.abs(S.amount)
1301
+ ...x,
1302
+ amount: Math.abs(x.amount)
1301
1303
  };
1302
1304
  return i[m] = /// comment, because without it formatter makes code uglier
1303
1305
  `${W.toFormatString({
1304
1306
  value: v,
1305
1307
  precision: 4
1306
- })} ${l.unit.abbrev}`, i;
1308
+ })} ${a.unit.abbrev}`, i;
1307
1309
  },
1308
1310
  {}
1309
1311
  );
1310
1312
  }
1311
- function Mn(u, l) {
1312
- if (!l)
1313
+ function Mn(u, a) {
1314
+ if (!a)
1313
1315
  return null;
1314
- let s = null;
1316
+ let l = null;
1315
1317
  const g = u.flatMap((f) => {
1316
1318
  var i;
1317
- return ((i = f.skus) == null ? void 0 : i.filter((m) => m.sku._id === l._id)) ?? [];
1319
+ return ((i = f.skus) == null ? void 0 : i.filter((m) => m.sku._id === a._id)) ?? [];
1318
1320
  }).flatMap((f) => {
1319
1321
  var i;
1320
1322
  return !f.history || ((i = f.history) == null ? void 0 : i.length) === 0 ? [] : f.history[0];
@@ -1324,32 +1326,32 @@ function Mn(u, l) {
1324
1326
  for (const m of i) {
1325
1327
  if (m.type !== te.Enum.SALES)
1326
1328
  continue;
1327
- const S = m.measurement ? W.multiply([m.measurement.conversion, m.amount]) : m.amount;
1328
- s ?? (s = W.fromNumber(0)), s = W.add([s, S]);
1329
+ const x = m.measurement ? W.multiply([m.measurement.conversion, m.amount]) : m.amount;
1330
+ l ?? (l = W.fromNumber(0)), l = W.add([l, x]);
1329
1331
  }
1330
1332
  }
1331
- return s != null ? (s.amount = Math.abs(s.amount), `${W.toFormatString({
1332
- value: s,
1333
+ return l != null ? (l.amount = Math.abs(l.amount), `${W.toFormatString({
1334
+ value: l,
1333
1335
  precision: 4
1334
- })} ${l.unit.abbrev}`) : null;
1336
+ })} ${a.unit.abbrev}`) : null;
1335
1337
  }
1336
1338
  Array.prototype.computeFirst = function(u) {
1337
- const l = this.length;
1338
- for (let s = 0; s < l; s++) {
1339
- const a = this.at(s), g = u(a, s, this);
1339
+ const a = this.length;
1340
+ for (let l = 0; l < a; l++) {
1341
+ const s = this.at(l), g = u(s, l, this);
1340
1342
  if (g != null)
1341
1343
  return g;
1342
1344
  }
1343
1345
  };
1344
1346
  Array.prototype.computeLast = function(u) {
1345
- const l = this.length - 1;
1346
- for (let s = l; s >= 0; s--) {
1347
- const a = this.at(s), g = u(a, s, this);
1347
+ const a = this.length - 1;
1348
+ for (let l = a; l >= 0; l--) {
1349
+ const s = this.at(l), g = u(s, l, this);
1348
1350
  if (g != null)
1349
1351
  return g;
1350
1352
  }
1351
1353
  };
1352
- const jn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Rn = { class: "flex-1 line-clamp-2" }, Un = { class: "flex flex-col gap-32 w-full h-full" }, Tn = { class: "flex items-center relative gap-4" }, In = { class: "flex-1" }, Pn = {
1354
+ const jn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Rn = { class: "flex-1 line-clamp-2" }, Un = { class: "flex flex-col gap-32 w-full h-full" }, In = { class: "flex items-center relative gap-4" }, Tn = { class: "flex-1" }, Pn = {
1353
1355
  key: 0,
1354
1356
  class: "flex-1 flex flex-col items-center gap-16"
1355
1357
  }, En = /* @__PURE__ */ e("div", { class: "fm-typo-en-body-lg-400 translate-x-4" }, "Loading...", -1), Hn = {
@@ -1374,11 +1376,11 @@ const jn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Rn = {
1374
1376
  },
1375
1377
  emits: ["update:show"],
1376
1378
  setup(u) {
1377
- const l = Qe(), s = Ie(), a = ve(), g = hn(), f = ue(), i = it(), m = u, S = I(!1), v = me(), o = I(Ut(0));
1379
+ const a = Qe(), l = Te(), s = ve(), g = hn(), f = ue(), i = it(), m = u, x = T(!1), v = me(), o = T(Ut(0));
1378
1380
  async function h() {
1379
- S.value = !0;
1381
+ x.value = !0;
1380
1382
  try {
1381
- await w(), await s.readStockBalance();
1383
+ await w(), await l.readStockBalance();
1382
1384
  } catch (t) {
1383
1385
  v.open({
1384
1386
  title: "Something went wrong",
@@ -1386,7 +1388,7 @@ const jn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Rn = {
1386
1388
  type: "error"
1387
1389
  }), console.log("failed at fetching item adjustment history", m.sku, o, t);
1388
1390
  } finally {
1389
- S.value = !1;
1391
+ x.value = !1;
1390
1392
  }
1391
1393
  }
1392
1394
  Me(() => {
@@ -1394,8 +1396,8 @@ const jn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Rn = {
1394
1396
  }), ge([() => o.value, () => m.sku], () => {
1395
1397
  h();
1396
1398
  });
1397
- const b = I([]), c = I([]), r = I(new Array());
1398
- function T(t, n) {
1399
+ const b = T([]), c = T([]), r = T(new Array());
1400
+ function I(t, n) {
1399
1401
  return n === "day" ? Ct(t) : et(t);
1400
1402
  }
1401
1403
  function U(t, n) {
@@ -1404,7 +1406,7 @@ const jn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Rn = {
1404
1406
  const _ = y.effectiveAt ?? Xe(y._id);
1405
1407
  if (!_)
1406
1408
  return d;
1407
- const F = T(new Date(_), n);
1409
+ const F = I(new Date(_), n);
1408
1410
  return d[F] ?? (d[F] = []), d[F].push(y), d;
1409
1411
  },
1410
1412
  {}
@@ -1415,7 +1417,7 @@ const jn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Rn = {
1415
1417
  }));
1416
1418
  }
1417
1419
  async function w() {
1418
- let t = await a.readStockAdjustment(
1420
+ let t = await s.readStockAdjustment(
1419
1421
  m.sku._id,
1420
1422
  St(new Date(o.value.startDate)).toISOString(),
1421
1423
  $t(new Date(o.value.endDate)).toISOString()
@@ -1432,7 +1434,7 @@ const jn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Rn = {
1432
1434
  t.length && (r.value = await g.findBillsById(t).catch((n) => {
1433
1435
  var y;
1434
1436
  console.error("Error on using latest bill API, retrying using legacy api", n);
1435
- const p = ((y = l.currentBusiness.value) == null ? void 0 : y._id) ?? "", d = f.currentLocation.doc._id;
1437
+ const p = ((y = a.currentBusiness.value) == null ? void 0 : y._id) ?? "", d = f.currentLocation.doc._id;
1436
1438
  return g.findBillsByBusinessId(p, [d], t);
1437
1439
  }));
1438
1440
  }
@@ -1499,7 +1501,7 @@ const jn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Rn = {
1499
1501
  {
1500
1502
  amount: 0,
1501
1503
  precision: 0,
1502
- currency: z(((p = l.currentCountry) == null ? void 0 : p.value) ?? Ne)
1504
+ currency: z(((p = a.currentCountry) == null ? void 0 : p.value) ?? Ne)
1503
1505
  }
1504
1506
  );
1505
1507
  return Ae(n, !1, n.precision);
@@ -1523,7 +1525,7 @@ const jn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Rn = {
1523
1525
  amount: 0,
1524
1526
  precision: 0
1525
1527
  }),
1526
- currency: z(((p = l.currentCountry) == null ? void 0 : p.value) ?? Ne)
1528
+ currency: z(((p = a.currentCountry) == null ? void 0 : p.value) ?? Ne)
1527
1529
  } : "No data";
1528
1530
  });
1529
1531
  function se() {
@@ -1533,10 +1535,10 @@ const jn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Rn = {
1533
1535
  endDate: n
1534
1536
  });
1535
1537
  }
1536
- const X = Te(m, "show");
1538
+ const X = Ie(m, "show");
1537
1539
  return (t, n) => {
1538
1540
  const p = $("FmButton"), d = $("FmField"), y = $("FmDateRangePicker"), _ = $("FmSpacer"), F = $("FmCircularProgress"), Y = $("FmIcon"), K = $("FmTooltip"), le = $("FmMenuDivider"), D = $("FmCardSection"), E = $("FmCard"), q = $("FmSideSheet");
1539
- return x(), N(q, {
1541
+ return S(), N(q, {
1540
1542
  "dismiss-away": "",
1541
1543
  modelValue: C(X),
1542
1544
  "onUpdate:modelValue": n[4] || (n[4] = (ee) => De(X) ? X.value = ee : null),
@@ -1557,8 +1559,8 @@ const jn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Rn = {
1557
1559
  var ee;
1558
1560
  return [
1559
1561
  e("div", Un, [
1560
- e("div", Tn, [
1561
- e("div", In, [
1562
+ e("div", In, [
1563
+ e("div", Tn, [
1562
1564
  k(y, {
1563
1565
  modelValue: o.value,
1564
1566
  "onUpdate:modelValue": n[1] || (n[1] = (G) => o.value = G),
@@ -1592,13 +1594,13 @@ const jn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Rn = {
1592
1594
  "prepend-icon": "navigate_next"
1593
1595
  })
1594
1596
  ]),
1595
- S.value ? (x(), j("div", Pn, [
1597
+ x.value ? (S(), j("div", Pn, [
1596
1598
  k(_),
1597
1599
  k(F, { size: "xl" }),
1598
1600
  En,
1599
1601
  k(_),
1600
1602
  k(_)
1601
- ])) : c.value && ((ee = c.value) == null ? void 0 : ee.length) > 0 ? (x(), j("div", Hn, [
1603
+ ])) : c.value && ((ee = c.value) == null ? void 0 : ee.length) > 0 ? (S(), j("div", Hn, [
1602
1604
  k(E, { variant: "outlined" }, {
1603
1605
  default: B(() => [
1604
1606
  k(D, { class: "flex flex-col gap-4" }, {
@@ -1612,7 +1614,7 @@ const jn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Rn = {
1612
1614
  e("div", qn, [
1613
1615
  e("div", Kn, [
1614
1616
  de(" Total sales  "),
1615
- H.value != null ? (x(), N(K, {
1617
+ H.value != null ? (S(), N(K, {
1616
1618
  key: 0,
1617
1619
  variant: "plain",
1618
1620
  placement: "top",
@@ -1659,7 +1661,7 @@ const jn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Rn = {
1659
1661
  e("div", _o, A(L.value), 1)
1660
1662
  ])
1661
1663
  ]),
1662
- C(i).enableTotalCost ? (x(), j("div", yo, [
1664
+ C(i).enableTotalCost ? (S(), j("div", yo, [
1663
1665
  k(le, { class: "w-full" }),
1664
1666
  e("div", go, [
1665
1667
  e("div", ho, [
@@ -1723,21 +1725,21 @@ const jn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Rn = {
1723
1725
  _: 1
1724
1726
  }),
1725
1727
  Co,
1726
- (x(!0), j(ne, null, re(c.value, (G) => (x(), j(ne, {
1728
+ (S(!0), j(ne, null, re(c.value, (G) => (S(), j(ne, {
1727
1729
  key: G.date
1728
1730
  }, [
1729
- t.sku ? (x(), N(Vn, {
1731
+ t.sku ? (S(), N(Vn, {
1730
1732
  key: 0,
1731
1733
  record: G,
1732
1734
  sku: t.sku,
1733
1735
  bills: r.value
1734
1736
  }, null, 8, ["record", "sku", "bills"])) : Z("", !0)
1735
1737
  ], 64))), 128))
1736
- ])) : (x(), j("div", Bo, [
1738
+ ])) : (S(), j("div", Bo, [
1737
1739
  k(_),
1738
1740
  e("div", null, [
1739
1741
  e("img", {
1740
- src: C(Tt),
1742
+ src: C(It),
1741
1743
  alt: "List is empty"
1742
1744
  }, null, 8, Ao)
1743
1745
  ]),
@@ -1753,14 +1755,14 @@ const jn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Rn = {
1753
1755
  }, 8, ["modelValue"]);
1754
1756
  };
1755
1757
  }
1756
- }), jo = { class: "flex flex-col gap-24" }, Ro = { key: 0 }, Uo = { key: 0 }, To = { class: "flex items-center gap-8" }, Io = /* @__PURE__ */ e("div", { class: "flex-1" }, "Fetching info...", -1), Po = { key: 1 }, Eo = { key: 2 }, Ho = { class: "flex flex-col w-full gap-24" }, Lo = { class: "fm-typo-en-body-lg-400" }, No = { class: "fm-typo-en-body-lg-600" }, Oo = /* @__PURE__ */ e("div", { class: "fm-typo-en-body-lg-400" }, "Proceed?", -1), Yo = { key: 1 }, zo = { class: "flex gap-8 justify-end" }, qo = /* @__PURE__ */ oe({
1758
+ }), jo = { class: "flex flex-col gap-24" }, Ro = { key: 0 }, Uo = { key: 0 }, Io = { class: "flex items-center gap-8" }, To = /* @__PURE__ */ e("div", { class: "flex-1" }, "Fetching info...", -1), Po = { key: 1 }, Eo = { key: 2 }, Ho = { class: "flex flex-col w-full gap-24" }, Lo = { class: "fm-typo-en-body-lg-400" }, No = { class: "fm-typo-en-body-lg-600" }, Oo = /* @__PURE__ */ e("div", { class: "fm-typo-en-body-lg-400" }, "Proceed?", -1), Yo = { key: 1 }, zo = { class: "flex gap-8 justify-end" }, qo = /* @__PURE__ */ oe({
1757
1759
  __name: "StockRecalculateDialog",
1758
1760
  emits: ["close"],
1759
- setup(u, { emit: l }) {
1760
- const s = l, a = ue(), g = ve(), f = R(() => {
1761
+ setup(u, { emit: a }) {
1762
+ const l = a, s = ue(), g = ve(), f = R(() => {
1761
1763
  var c;
1762
- return ((c = a == null ? void 0 : a._currentLocation) == null ? void 0 : c.type) === Je.restaurant;
1763
- }), i = I(null), m = I(!1), S = I(""), v = me(), o = I(null);
1764
+ return ((c = s == null ? void 0 : s._currentLocation) == null ? void 0 : c.type) === Je.restaurant;
1765
+ }), i = T(null), m = T(!1), x = T(""), v = me(), o = T(null);
1764
1766
  Me(h);
1765
1767
  async function h() {
1766
1768
  i.value = !0;
@@ -1769,35 +1771,35 @@ const jn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Rn = {
1769
1771
  g.recalculation.getRecalculateAbility(),
1770
1772
  new Promise((r) => setTimeout(r, 1e3))
1771
1773
  ]);
1772
- m.value = c.canRecalculate, S.value = c.reason ?? "", o.value = c.lastClosing ? new Date(c.lastClosing) : null;
1774
+ m.value = c.canRecalculate, x.value = c.reason ?? "", o.value = c.lastClosing ? new Date(c.lastClosing) : null;
1773
1775
  } catch {
1774
1776
  v.open({
1775
1777
  type: "error",
1776
1778
  title: "Unable to fetch recalculate ability",
1777
1779
  message: "Please try again later."
1778
- }), S.value = "Something went wrong.";
1780
+ }), x.value = "Something went wrong.";
1779
1781
  } finally {
1780
1782
  i.value = !1;
1781
1783
  }
1782
1784
  }
1783
1785
  function b() {
1784
- s("close"), v.open({
1786
+ l("close"), v.open({
1785
1787
  title: "Request submitted",
1786
1788
  message: "Please wait for 15 minutes for all the changes to be reflected."
1787
1789
  }), g.recalculation.startRecalculateTask();
1788
1790
  }
1789
1791
  return (c, r) => {
1790
- const T = $("FmCircularProgress"), U = $("FmButton");
1791
- return x(), j("div", jo, [
1792
- f.value ? (x(), j("div", Ro, [
1793
- i.value === null || i.value === !0 ? (x(), j("div", Uo, [
1794
- e("div", To, [
1792
+ const I = $("FmCircularProgress"), U = $("FmButton");
1793
+ return S(), j("div", jo, [
1794
+ f.value ? (S(), j("div", Ro, [
1795
+ i.value === null || i.value === !0 ? (S(), j("div", Uo, [
1796
+ e("div", Io, [
1795
1797
  e("div", null, [
1796
- k(T, { size: "lg" })
1798
+ k(I, { size: "lg" })
1797
1799
  ]),
1798
- Io
1800
+ To
1799
1801
  ])
1800
- ])) : m.value ? (x(), j("div", Eo, [
1802
+ ])) : m.value ? (S(), j("div", Eo, [
1801
1803
  e("div", Ho, [
1802
1804
  e("div", Lo, [
1803
1805
  de(" Last closing was at: "),
@@ -1806,10 +1808,10 @@ const jn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Rn = {
1806
1808
  ]),
1807
1809
  Oo
1808
1810
  ])
1809
- ])) : (x(), j("div", Po, A(S.value), 1))
1810
- ])) : (x(), j("div", Yo, "Cannot recalculate adjustment history on a non-restaurant outlet.")),
1811
+ ])) : (S(), j("div", Po, A(x.value), 1))
1812
+ ])) : (S(), j("div", Yo, "Cannot recalculate adjustment history on a non-restaurant outlet.")),
1811
1813
  e("div", zo, [
1812
- m.value ? (x(), N(U, {
1814
+ m.value ? (S(), N(U, {
1813
1815
  key: 0,
1814
1816
  label: "Submit",
1815
1817
  onClick: b
@@ -1817,7 +1819,7 @@ const jn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Rn = {
1817
1819
  k(U, {
1818
1820
  variant: "tertiary",
1819
1821
  label: "Close",
1820
- onClick: r[0] || (r[0] = (w) => s("close"))
1822
+ onClick: r[0] || (r[0] = (w) => l("close"))
1821
1823
  })
1822
1824
  ])
1823
1825
  ]);
@@ -1826,20 +1828,20 @@ const jn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Rn = {
1826
1828
  }), Ko = { class: "px-24 xs:p-0 sm:p-0 flex flex-col gap-8 h-full" }, Go = { class: "px-8 flex gap-8 items-center xs:gap-0 xs:flex-col-reverse sm:gap-0 sm:flex-col-reverse h-48" }, Wo = { class: "xs:w-full sm:w-full flex gap-8 items-center overflow-x-auto no-scrollbar py-8" }, Jo = { class: "flex-1 w-full" }, Qo = { class: "flex flex-col gap-8" }, Xo = { class: "flex flex-col" }, Zo = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, es = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary line-clamp-1" }, bs = /* @__PURE__ */ oe({
1827
1829
  __name: "StockView",
1828
1830
  setup(u) {
1829
- const l = Re(), s = ue(), a = Ie(), g = _t(), {
1831
+ const a = Re(), l = ue(), s = Te(), g = _t(), {
1830
1832
  columnDefs: f,
1831
1833
  stockHistoryProps: i,
1832
1834
  convertSkuDialogProps: m,
1833
- adjustSkuDialogProps: S,
1835
+ adjustSkuDialogProps: x,
1834
1836
  showSkuHistory: v
1835
1837
  } = Gt(c);
1836
- s.watchLocation(c);
1837
- const o = I(!1), h = me(), b = Ue();
1838
+ l.watchLocation(c);
1839
+ const o = T(!1), h = me(), b = Ue();
1838
1840
  async function c() {
1839
- if (s._currentLocation) {
1841
+ if (l._currentLocation) {
1840
1842
  o.value = !0;
1841
1843
  try {
1842
- await a.readStockBalance(), await a.readProductBalance(), await g.readStockEstimateBalance();
1844
+ await s.readStockBalance(), await s.readProductBalance(), await g.readStockEstimateBalance();
1843
1845
  } catch {
1844
1846
  h.open({
1845
1847
  title: "Something went wrong",
@@ -1852,10 +1854,10 @@ const jn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Rn = {
1852
1854
  }
1853
1855
  }
1854
1856
  const r = R(
1855
- () => l.skus.map((P) => {
1857
+ () => a.skus.map((P) => {
1856
1858
  var Q, se, X;
1857
1859
  const L = P.trackingMeasurement;
1858
- let z = (se = (Q = a.stockBalance.skus) == null ? void 0 : Q.find(
1860
+ let z = (se = (Q = s.stockBalance.skus) == null ? void 0 : Q.find(
1859
1861
  (t) => t.id === P._id
1860
1862
  )) == null ? void 0 : se.balance, O = g.inventoryForecast.skus.find(
1861
1863
  (t) => t.id === P._id
@@ -1870,9 +1872,9 @@ const jn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Rn = {
1870
1872
  trackingUnitAbbrev: L ? ((X = P.unit.measurements.find((t) => t.id === L)) == null ? void 0 : X.abbrev) ?? "" : P.unit.abbrev
1871
1873
  };
1872
1874
  })
1873
- ), T = I(""), { breakpoints: U } = ut(), w = R(() => U.value.xs || U.value.sm ? 10 : 20), V = mt(), M = R(() => {
1875
+ ), I = T(""), { breakpoints: U } = ut(), w = R(() => U.value.xs || U.value.sm ? 10 : 20), V = mt(), M = R(() => {
1874
1876
  var L;
1875
- return ((L = s._currentLocation) == null ? void 0 : L.type) === Je.restaurant ? [
1877
+ return ((L = l._currentLocation) == null ? void 0 : L.type) === Je.restaurant ? [
1876
1878
  {
1877
1879
  label: "Refresh",
1878
1880
  icon: "refresh",
@@ -1900,7 +1902,7 @@ const jn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Rn = {
1900
1902
  }
1901
1903
  return (P, L) => {
1902
1904
  const z = $("FmTableToolbar"), O = $("FmMenuDivider"), J = $("FmTable");
1903
- return x(), N(lt, { title: "Stock" }, {
1905
+ return S(), N(lt, { title: "Stock" }, {
1904
1906
  default: B(() => {
1905
1907
  var Q, se, X, t;
1906
1908
  return [
@@ -1912,8 +1914,8 @@ const jn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Rn = {
1912
1914
  e("div", Jo, [
1913
1915
  k(z, {
1914
1916
  searchable: "",
1915
- "search-model": T.value,
1916
- "onUpdate:searchModel": L[0] || (L[0] = (n) => T.value = n),
1917
+ "search-model": I.value,
1918
+ "onUpdate:searchModel": L[0] || (L[0] = (n) => I.value = n),
1917
1919
  actions: [{ label: "Export", icon: "ios_share", key: "export" }, ...M.value],
1918
1920
  "onClick:actionExport": L[1] || (L[1] = (n) => C(Ht)(r.value)),
1919
1921
  "onClick:actionRefresh": c,
@@ -1922,13 +1924,13 @@ const jn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Rn = {
1922
1924
  k(O, { class: "hidden xs:block" })
1923
1925
  ])
1924
1926
  ]),
1925
- (x(), N(J, {
1927
+ (S(), N(J, {
1926
1928
  style: Ge(C(V).tableHeight),
1927
1929
  "column-defs": C(f),
1928
1930
  "row-data": r.value,
1929
- "search-value": T.value,
1930
- loading: o.value || !C(s)._currentLocation,
1931
- key: (Q = C(s)._currentLocation) == null ? void 0 : Q.dbName,
1931
+ "search-value": I.value,
1932
+ loading: o.value || !C(l)._currentLocation,
1933
+ key: (Q = C(l)._currentLocation) == null ? void 0 : Q.dbName,
1932
1934
  onRowClick: L[2] || (L[2] = (n) => C(v)(n.original)),
1933
1935
  "page-size": w.value
1934
1936
  }, {
@@ -1978,10 +1980,10 @@ const jn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Rn = {
1978
1980
  _: 1
1979
1981
  }, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"]))
1980
1982
  ]),
1981
- (x(), N(at, { to: "body" }, [
1982
- (se = C(i)) != null && se.sku ? (x(), N(Mo, Se($e({ key: 0 }, C(i))), null, 16)) : Z("", !0),
1983
- (X = C(m)) != null && X.sku ? (x(), N(cn, Se($e({ key: 1 }, C(m))), null, 16)) : Z("", !0),
1984
- (t = C(S)) != null && t.stock ? (x(), N(gn, Se($e({ key: 2 }, C(S))), null, 16)) : Z("", !0)
1983
+ (S(), N(at, { to: "body" }, [
1984
+ (se = C(i)) != null && se.sku ? (S(), N(Mo, Se($e({ key: 0 }, C(i))), null, 16)) : Z("", !0),
1985
+ (X = C(m)) != null && X.sku ? (S(), N(cn, Se($e({ key: 1 }, C(m))), null, 16)) : Z("", !0),
1986
+ (t = C(x)) != null && t.stock ? (S(), N(gn, Se($e({ key: 2 }, C(x))), null, 16)) : Z("", !0)
1985
1987
  ]))
1986
1988
  ];
1987
1989
  }),