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

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 (40) hide show
  1. package/dist/{ApprovalView-CjDTRn_0.js → ApprovalView-vyyd-8ky.js} +6 -6
  2. package/dist/{BindingsDialog-BrmtRPs7.js → BindingsDialog-DcF-RsbY.js} +2 -2
  3. package/dist/{BindingsPicker-RF1LpUQI.js → BindingsPicker-A0B93D12.js} +2 -2
  4. package/dist/{BindingsTable-J6p4ayCr.js → BindingsTable-BfV873Gq.js} +3 -3
  5. package/dist/{ChangeLocationComponent.vue_vue_type_script_setup_true_lang-DhiBtQCZ.js → ChangeLocationComponent.vue_vue_type_script_setup_true_lang-Cpyyj0s9.js} +1 -1
  6. package/dist/{FmMultiselectDialog.vue_vue_type_script_setup_true_lang-lXG8Dt51.js → FmMultiselectDialog.vue_vue_type_script_setup_true_lang-BwZfE0mj.js} +2 -2
  7. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-D0CuYd32.js → FmUnitInput.vue_vue_type_script_setup_true_lang-DZx8ZPCG.js} +3 -3
  8. package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-BGtOiTS_.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-BkX1rDxA.js} +1 -1
  9. package/dist/{IngredientsView-Dp7VJ6y6.js → IngredientsView-Bm0qofWf.js} +6 -6
  10. package/dist/{IntegrationView-B0EqVrD6.js → IntegrationView-BSWGafuh.js} +3 -3
  11. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-DS2k0Mg0.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-FbnVqAv2.js} +6 -6
  12. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DNlqatNB.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-Z_TdnV6k.js} +1 -1
  13. package/dist/{PurchaseOrderPrintPreview-CBvso-CS.js → PurchaseOrderPrintPreview-DeMiH8-p.js} +1 -1
  14. package/dist/ReceiveRequestView-D9NJhUrh.js +1413 -0
  15. package/dist/{RecipeView-Dom09pTM.js → RecipeView-B-AMUN35.js} +106 -104
  16. package/dist/{StockView-CKzNbjdc.js → StockView-CHyjj-NE.js} +499 -511
  17. package/dist/{SupplierView-IoHcN00m.js → SupplierView-BmdDGDZX.js} +7 -7
  18. package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-i1th_271.js → TransferDetails.vue_vue_type_script_setup_true_lang-D-XuhHjH.js} +5 -5
  19. package/dist/{UnitView-DZd-hHZm.js → UnitView-DKc5Vspf.js} +6 -6
  20. package/dist/{WarehouseView-Ty1DcynD.js → WarehouseView-BNWmpyAE.js} +3 -3
  21. package/dist/{app-Cnhjho3o.js → app-CGJ9wObA.js} +3 -3
  22. package/dist/app.js +1 -1
  23. package/dist/{date2-B7iD1KxI.js → date2-hh1XMrnz.js} +1 -1
  24. package/dist/{dayjs.min-DQUng8nj.js → dayjs.min-B1c_VH7n.js} +2 -2
  25. package/dist/{decimal-q0xrbBIn.js → decimal-CYxIGsNP.js} +1 -1
  26. package/dist/extensions/array.d.ts +6 -0
  27. package/dist/{fuzzy-c-Ppr3KD.js → fuzzy-ugVwdrtM.js} +1 -1
  28. package/dist/{init-date-range-DPx7QxBp.js → init-date-range-OQt8Z7z5.js} +1 -1
  29. package/dist/{layout-CSVgzCIf.js → layout-zKoU02JL.js} +1 -1
  30. package/dist/{rules-CpJ31qIF.js → rules-7Z3VPm48.js} +1 -1
  31. package/dist/stock-estimate-DyvbTwBC.js +145 -0
  32. package/dist/style.css +1 -1
  33. package/dist/{supplier-B3SkQyN-.js → supplier-y1XBCh6p.js} +1 -1
  34. package/dist/tsconfig.app.tsbuildinfo +1 -1
  35. package/dist/{use-inventory-binding-dialog-F9I0iH7I.js → use-inventory-binding-dialog-Dq5XLo6y.js} +2 -2
  36. package/dist/views/receive-request/ReceiveRequestView.vue.d.ts +1 -0
  37. package/dist/{xlsx-BVwkQrma.js → xlsx-deTTOyZk.js} +1 -1
  38. package/package.json +3 -3
  39. package/dist/ReceiveRequestView-BepmuhAx.js +0 -1411
  40. package/dist/stock-estimate-DwKCk68D.js +0 -122
@@ -1,68 +1,68 @@
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";
1
+ import { ref as T, defineComponent as oe, computed as U, resolveComponent as $, openBlock as x, createBlock as N, withCtx as B, createElementVNode as e, normalizeClass as fe, toDisplayString as A, createVNode as b, 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 ce, 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-Cnhjho3o.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-CGJ9wObA.js";
4
4
  import { useCoreStore as Qe } from "@feedmepos/mf-common";
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";
5
+ import { useSnackbar as de, 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-zKoU02JL.js";
7
+ import { g as he } from "./decimal-CYxIGsNP.js";
8
+ import { d as pt, F as W } from "./dayjs.min-B1c_VH7n.js";
9
+ import { e as ft, _ as vt, i as Xe, u as _t } from "./stock-estimate-DyvbTwBC.js";
10
+ import { _ as yt } from "./ChangeLocationComponent.vue_vue_type_script_setup_true_lang-Cpyyj0s9.js";
11
+ import { g as Be, a as ie, b as gt, t as be, c as pe, 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-hh1XMrnz.js";
12
+ import { a as Ve, A as At, M as Vt, R as Dt } from "./rules-7Z3VPm48.js";
13
13
  import { g as tt } from "./util-CEVKTbZD.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";
14
+ import { u as Mt } from "./use-inventory-binding-dialog-Dq5XLo6y.js";
15
+ import { _ as jt } from "./FmMultiselectDialog.vue_vue_type_script_setup_true_lang-BwZfE0mj.js";
16
+ import { _ as Rt } from "./NumberPrecisionInput.vue_vue_type_script_setup_true_lang-Z_TdnV6k.js";
17
+ import { i as Ut } from "./init-date-range-OQt8Z7z5.js";
18
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, a) => {
21
- const l = ue(), s = Qe(), g = me();
22
- return a.onError(async (f) => {
23
- f.name === "SvcForbiddenError" && (g == null || g.open({
20
+ const ve = We((c, u) => {
21
+ const l = ue(), s = Qe(), S = de();
22
+ return u.onError(async (f) => {
23
+ f.name === "SvcForbiddenError" && (S == null || S.open({
24
24
  title: f.title,
25
25
  message: f.message,
26
26
  type: "error"
27
27
  }));
28
28
  }), {
29
29
  async readStockBalance() {
30
- const f = l.currentLocationDBName, i = `${u.inventoryBackendUrl}/${f}/stock-balance`;
31
- return await a.get(i);
30
+ const f = l.currentLocationDBName, r = `${c.inventoryBackendUrl}/${f}/stock-balance`;
31
+ return await u.get(r);
32
32
  },
33
33
  async readSkuBalance() {
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`);
34
+ var k;
35
+ const f = l.currentLocationDBName, r = `${c.inventoryBackendUrl}/${f}/sku/balance`;
36
+ return (((k = s.currentBusiness.value) == null ? void 0 : k.menuVersion) ?? "") === "v3" ? await u.get(r) : await u.get(`${r}?useInventoryDoc=true`);
37
37
  },
38
38
  async readSingleAdjustment(f) {
39
- const i = l.currentLocationDBName, m = `${u.inventoryBackendUrl}/${i}/adjustment`;
40
- return await a.get(`${m}?adjustmentId=${f}`);
39
+ const r = l.currentLocationDBName, m = `${c.inventoryBackendUrl}/${r}/adjustment`;
40
+ return await u.get(`${m}?adjustmentId=${f}`);
41
41
  },
42
- async readStockAdjustment(f, i, m) {
43
- const x = l.currentLocationDBName, v = `${u.inventoryBackendUrl}/${x}/sku`;
44
- return await a.get(`${v}?skuId=${f}&start=${i}&end=${m}`);
42
+ async readStockAdjustment(f, r, m) {
43
+ const k = l.currentLocationDBName, v = `${c.inventoryBackendUrl}/${k}/sku`;
44
+ return await u.get(`${v}?skuId=${f}&start=${r}&end=${m}`);
45
45
  },
46
46
  async convertSku(f) {
47
47
  var v;
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);
48
+ const r = l.currentLocationDBName, m = `${c.inventoryBackendUrl}/${r}/sku/convert`;
49
+ return (((v = s.currentBusiness.value) == null ? void 0 : v.menuVersion) ?? "") === "v3" ? await u.post(m, f) : await u.post(`${m}?useInventoryDoc=true`, f);
50
50
  },
51
51
  async adjustSku(f) {
52
52
  var v;
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);
53
+ const r = l.currentLocationDBName, m = `${c.inventoryBackendUrl}/${r}/sku/adjust`;
54
+ return (((v = s.currentBusiness.value) == null ? void 0 : v.menuVersion) ?? "") === "v3" ? await u.post(m, f) : await u.post(`${m}?useInventoryDoc=true`, f);
55
55
  },
56
56
  recalculation: {
57
57
  getRecalculateAbility() {
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);
58
+ var k;
59
+ const r = `business_${(k = s.currentBusiness.value) == null ? void 0 : k._id}`, m = `${c.inventoryBackendUrl}/${r}/stock/operations/recalculate`;
60
+ return u.get(m);
61
61
  },
62
62
  startRecalculateTask() {
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);
63
+ var k;
64
+ const r = `business_${(k = s.currentBusiness.value) == null ? void 0 : k._id}`, m = `${c.inventoryBackendUrl}/${r}/stock/operations/recalculate?refundFromPreviousAdjustment=true`;
65
+ return u.post(m);
66
66
  }
67
67
  }
68
68
  };
@@ -77,31 +77,31 @@ function Tt() {
77
77
  };
78
78
  }
79
79
  const _e = T(Tt()), Te = () => {
80
- const u = ve();
80
+ const c = ve();
81
81
  return {
82
82
  // state
83
83
  get stockBalance() {
84
84
  return _e.value.stockBalance;
85
85
  },
86
- set stockBalance(a) {
87
- _e.value.stockBalance = a;
86
+ set stockBalance(u) {
87
+ _e.value.stockBalance = u;
88
88
  },
89
89
  get productBalance() {
90
90
  return _e.value.productBalance;
91
91
  },
92
- set productBalance(a) {
93
- _e.value.productBalance = a;
92
+ set productBalance(u) {
93
+ _e.value.productBalance = u;
94
94
  },
95
95
  // actions
96
96
  async readStockBalance() {
97
- this.stockBalance = await u.readStockBalance();
97
+ this.stockBalance = await c.readStockBalance();
98
98
  },
99
99
  async readProductBalance() {
100
- this.productBalance = await u.readSkuBalance();
100
+ this.productBalance = await c.readSkuBalance();
101
101
  }
102
102
  };
103
103
  };
104
- var ye = /* @__PURE__ */ ((u) => (u.History = "History", u.Convert = "Convert", u.Adjust = "Adjust", u))(ye || {});
104
+ var ye = /* @__PURE__ */ ((c) => (c.History = "History", c.Convert = "Convert", c.Adjust = "Adjust", c))(ye || {});
105
105
  const Pt = [
106
106
  {
107
107
  label: "History",
@@ -121,7 +121,7 @@ const Pt = [
121
121
  color: "text-neutral-700"
122
122
  }
123
123
  ];
124
- async function Ht(u) {
124
+ async function Ht(c) {
125
125
  const l = `${(ue().currentLocation.name || "").replace(
126
126
  / /g,
127
127
  "_"
@@ -130,7 +130,7 @@ async function Ht(u) {
130
130
  [
131
131
  {
132
132
  name: "stock",
133
- data: u,
133
+ data: c,
134
134
  columns: [
135
135
  {
136
136
  name: "Code",
@@ -143,16 +143,16 @@ async function Ht(u) {
143
143
  {
144
144
  name: "Balance",
145
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
+ const S = ke(s, s.unit);
147
+ return S.type === "unit" ? he(s.balance, s.unit, null, !1) : he(s.balance, s.unit, S.measurement, !1);
148
148
  }
149
149
  },
150
150
  {
151
151
  name: "Unit",
152
152
  selector: (s) => {
153
153
  var f;
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
+ const S = ke(s, s.unit);
155
+ return S.type === "unit" ? s.unit.abbrev : ((f = s.unit.measurements.find((r) => r.id === S.measurement)) == null ? void 0 : f.abbrev) || "";
156
156
  }
157
157
  }
158
158
  ]
@@ -161,18 +161,18 @@ async function Ht(u) {
161
161
  l
162
162
  );
163
163
  }
164
- function ke(u, a) {
165
- const l = localStorage.getItem(`uom:${u._id}`);
166
- return l ? l === a._id ? {
164
+ function ke(c, u) {
165
+ const l = localStorage.getItem(`uom:${c._id}`);
166
+ return l ? l === u._id ? {
167
167
  type: "unit"
168
- } : a.measurements.find((s) => s.id === l) ? {
168
+ } : u.measurements.find((s) => s.id === l) ? {
169
169
  type: "measurement",
170
170
  measurement: l
171
171
  } : {
172
172
  type: "unit"
173
- } : u.trackingMeasurement && a.measurements.find((s) => s.id === u.trackingMeasurement) ? {
173
+ } : c.trackingMeasurement && u.measurements.find((s) => s.id === c.trackingMeasurement) ? {
174
174
  type: "measurement",
175
- measurement: u.trackingMeasurement
175
+ measurement: c.trackingMeasurement
176
176
  } : {
177
177
  type: "unit"
178
178
  };
@@ -185,15 +185,15 @@ const Lt = { class: "fm-typo-en-body-md-400 flex-grow" }, nt = /* @__PURE__ */ o
185
185
  amount: {},
186
186
  defaultTrackingMeasurement: {}
187
187
  },
188
- setup(u) {
189
- function a(v) {
188
+ setup(c) {
189
+ function u(v) {
190
190
  return `uom:${v._id}`;
191
191
  }
192
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
+ const o = u(s.sku);
194
+ v ? localStorage.setItem(o, v) : localStorage.setItem(o, s.unit._id), S.value = ke(s.sku, s.unit);
195
195
  }
196
- const s = u, g = T(ke(s.sku, s.unit)), f = R(() => {
196
+ const s = c, S = T(ke(s.sku, s.unit)), f = U(() => {
197
197
  const { measurements: v } = s.unit;
198
198
  return [
199
199
  {
@@ -206,42 +206,42 @@ const Lt = { class: "fm-typo-en-body-md-400 flex-grow" }, nt = /* @__PURE__ */ o
206
206
  }))
207
207
  ];
208
208
  });
209
- function i({ value: v }) {
210
- return C(g).type === "unit" ? v === null : v === C(g).measurement;
209
+ function r({ value: v }) {
210
+ return C(S).type === "unit" ? v === null : v === C(S).measurement;
211
211
  }
212
- const m = R(
212
+ const m = U(
213
213
  () => {
214
214
  var v;
215
- return ((v = f.value.find((o) => i(o))) == null ? void 0 : v.label) ?? "";
215
+ return ((v = f.value.find((o) => r(o))) == null ? void 0 : v.label) ?? "";
216
216
  }
217
- ), x = T(!1);
217
+ ), k = T(!1);
218
218
  return (v, o) => {
219
- const h = $("FmIcon"), b = $("FmMenuItem"), c = $("FmMenu");
220
- return S(), N(c, {
219
+ const g = $("FmIcon"), h = $("FmMenuItem"), i = $("FmMenu");
220
+ return x(), N(i, {
221
221
  "stop-click-propagation": "",
222
- onMenuChanged: o[0] || (o[0] = (r) => x.value = r)
222
+ onMenuChanged: o[0] || (o[0] = (a) => k.value = a)
223
223
  }, {
224
224
  "menu-button": B(() => [
225
225
  e("button", {
226
226
  type: "button",
227
- class: ce([
227
+ class: fe([
228
228
  "w-full text-left flex items-center gap-8 cursor-pointer fm-corner-radius-sm px-8 py-4 border bg-white",
229
- x.value ? "border-fm-color-primary" : "border-fm-color-neutral-gray-100"
229
+ k.value ? "border-fm-color-primary" : "border-fm-color-neutral-gray-100"
230
230
  ])
231
231
  }, [
232
232
  e("div", Lt, A(m.value), 1),
233
- k(h, {
233
+ b(g, {
234
234
  class: "text-fm-color-neutral-gray-400",
235
235
  name: "expand_more"
236
236
  })
237
237
  ], 2)
238
238
  ]),
239
239
  default: B(() => [
240
- (S(!0), j(ne, null, re(f.value, (r) => (S(), N(b, {
241
- key: r.value ?? 0,
242
- label: r.label,
243
- "model-value": i(r),
244
- onClick: (I) => l(r.value)
240
+ (x(!0), j(ne, null, re(f.value, (a) => (x(), N(h, {
241
+ key: a.value ?? 0,
242
+ label: a.label,
243
+ "model-value": r(a),
244
+ onClick: (I) => l(a.value)
245
245
  }, null, 8, ["label", "model-value", "onClick"]))), 128))
246
246
  ]),
247
247
  _: 1
@@ -263,25 +263,29 @@ const Lt = { class: "fm-typo-en-body-md-400 flex-grow" }, nt = /* @__PURE__ */ o
263
263
  props: {
264
264
  days: {}
265
265
  },
266
- setup(u) {
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, [
266
+ setup(c) {
267
+ const u = c, l = U(() => typeof u.days != "number" ? "no-info" : u.days > 14 ? "high" : u.days >= 7 && u.days <= 14 ? "mid" : "low");
268
+ return (s, S) => typeof u.days == "number" ? (x(), j("div", Nt, [
269
269
  e("div", {
270
- class: ce([g.value, "flex items-center gap-8 p-4 fm-corner-radius-md"])
270
+ class: fe([
271
+ `fm-forecast-notification-${l.value}`,
272
+ "flex items-center gap-8 p-4 fm-corner-radius-md fm-typo-en-body-md-600"
273
+ ])
271
274
  }, [
272
275
  e("div", {
273
- class: ce([l.value, "w-12 h-12 rounded-full"])
276
+ class: fe([
277
+ "fm-forecast-notification-indicator",
278
+ `fm-forecast-notification-indicator-${l.value}`
279
+ ])
274
280
  }, null, 2),
275
- e("div", {
276
- class: ce(["fm-typo-en-body-md-600", s.value])
277
- }, A(a.days) + " days", 3)
281
+ e("div", null, A(u.days) + " days", 1)
278
282
  ], 2)
279
- ])) : (S(), j("div", Ot, zt));
283
+ ])) : (x(), j("div", Ot, zt));
280
284
  }
281
285
  }), qt = /* @__PURE__ */ e("div", { class: "whitespace-nowrap" }, "Days remaining", -1), Kt = /* @__PURE__ */ oe({
282
286
  __name: "StockHeaderPreview",
283
- setup(u) {
284
- return (a, l) => (S(), N(vt, null, {
287
+ setup(c) {
288
+ return (u, l) => (x(), N(vt, null, {
285
289
  default: B(() => [
286
290
  qt
287
291
  ]),
@@ -289,22 +293,22 @@ const Lt = { class: "fm-typo-en-body-md-400 flex-grow" }, nt = /* @__PURE__ */ o
289
293
  }));
290
294
  }
291
295
  });
292
- function Gt(u) {
293
- const a = ue(), l = Te(), s = Ue(), g = T();
294
- async function f(b) {
295
- const c = {
296
- sku: b,
296
+ function Gt(c) {
297
+ const u = ue(), l = Te(), s = Ue(), S = T();
298
+ async function f(h) {
299
+ const i = {
300
+ sku: h,
297
301
  show: !0,
298
- "onUpdate:show"(r) {
299
- g.value.show = r;
302
+ "onUpdate:show"(a) {
303
+ S.value.show = a;
300
304
  }
301
305
  };
302
- g.value = c;
306
+ S.value = i;
303
307
  }
304
- const i = T();
305
- async function m(b) {
306
- var U, w, V;
307
- if (!!!((w = (U = b.convert) == null ? void 0 : U.inventoryBindings) != null && w.length)) {
308
+ const r = T();
309
+ async function m(h) {
310
+ var R, w, V;
311
+ if (!!!((w = (R = h.convert) == null ? void 0 : R.inventoryBindings) != null && w.length)) {
308
312
  s.open({
309
313
  title: "Cannot convert stock",
310
314
  message: "Stock is not convertable due to no recipe or ingredient to convert."
@@ -312,43 +316,43 @@ function Gt(u) {
312
316
  return;
313
317
  }
314
318
  const I = {
315
- maxCount: ((V = l.productBalance.find(({ id: M }) => M === b._id)) == null ? void 0 : V.count) || 0,
316
- sku: b,
319
+ maxCount: ((V = l.productBalance.find(({ id: M }) => M === h._id)) == null ? void 0 : V.count) || 0,
320
+ sku: h,
317
321
  show: !0,
318
322
  "onUpdate:show"(M) {
319
- i.value.show = M;
323
+ r.value.show = M;
320
324
  },
321
325
  onSubmitted() {
322
- u();
326
+ c();
323
327
  }
324
328
  };
325
- i.value = I;
329
+ r.value = I;
326
330
  }
327
- const x = T();
328
- async function v(b) {
329
- const c = {
330
- stock: b,
331
+ const k = T();
332
+ async function v(h) {
333
+ const i = {
334
+ stock: h,
331
335
  show: !0,
332
- "onUpdate:show"(r) {
333
- x.value.show = r;
336
+ "onUpdate:show"(a) {
337
+ k.value.show = a;
334
338
  },
335
339
  onSubmitted() {
336
- u();
340
+ c();
337
341
  }
338
342
  };
339
- x.value = c;
343
+ k.value = i;
340
344
  }
341
- function o(b, c) {
342
- const r = je(c);
343
- switch (b) {
345
+ function o(h, i) {
346
+ const a = je(i);
347
+ switch (h) {
344
348
  case ye.History:
345
- f(r);
349
+ f(a);
346
350
  return;
347
351
  case ye.Convert:
348
- m(r);
352
+ m(a);
349
353
  return;
350
354
  case ye.Adjust:
351
- v(r);
355
+ v(a);
352
356
  return;
353
357
  }
354
358
  }
@@ -369,14 +373,14 @@ function Gt(u) {
369
373
  {
370
374
  id: "UOM",
371
375
  header: "Balance",
372
- cell(b) {
373
- const c = b.row.original, r = {
374
- unit: c.unit,
375
- sku: c,
376
- amount: c.balance,
377
- defaultTrackingMeasurement: c.trackingMeasurement ?? void 0
376
+ cell(h) {
377
+ const i = h.row.original, a = {
378
+ unit: i.unit,
379
+ sku: i,
380
+ amount: i.balance,
381
+ defaultTrackingMeasurement: i.trackingMeasurement ?? void 0
378
382
  };
379
- return xe(nt, r);
383
+ return xe(nt, a);
380
384
  },
381
385
  size: 180
382
386
  },
@@ -386,21 +390,21 @@ function Gt(u) {
386
390
  header: () => xe(Kt),
387
391
  enableSorting: !0,
388
392
  sortUndefined: "last",
389
- cell(b) {
390
- const r = {
391
- days: b.row.original.day
393
+ cell(h) {
394
+ const a = {
395
+ days: h.row.original.day
392
396
  };
393
- return xe(ot, r);
397
+ return xe(ot, a);
394
398
  },
395
399
  size: 200
396
400
  },
397
401
  {
398
402
  id: "action",
399
- cell(b) {
400
- var c;
403
+ cell(h) {
404
+ var i;
401
405
  return ct(
402
- ((c = a._currentLocation) == null ? void 0 : c.type) === "restaurant" ? Pt : Et,
403
- (r) => o(r, b.row.original)
406
+ ((i = u._currentLocation) == null ? void 0 : i.type) === "restaurant" ? Pt : Et,
407
+ (a) => o(a, h.row.original)
404
408
  );
405
409
  },
406
410
  enableSorting: !1,
@@ -411,48 +415,48 @@ function Gt(u) {
411
415
  }
412
416
  }
413
417
  ],
414
- stockHistoryProps: g,
415
- convertSkuDialogProps: i,
416
- adjustSkuDialogProps: x,
418
+ stockHistoryProps: S,
419
+ convertSkuDialogProps: r,
420
+ adjustSkuDialogProps: k,
417
421
  showSkuHistory: f
418
422
  };
419
423
  }
420
424
  const Wt = {
421
425
  context: null,
422
426
  error: null,
423
- isRequired(u = "This field is required") {
424
- return `${this.context ?? ""}`.length === 0 && (this.error = u), this;
427
+ isRequired(c = "This field is required") {
428
+ return `${this.context ?? ""}`.length === 0 && (this.error = c), this;
425
429
  },
426
- isString(u = "Must be a valid string") {
427
- return this.error ? this : (typeof this.context != "string" && (this.error ?? (this.error = u)), this);
430
+ isString(c = "Must be a valid string") {
431
+ return this.error ? this : (typeof this.context != "string" && (this.error ?? (this.error = c)), this);
428
432
  },
429
433
  toInt() {
430
434
  return this.error ? this : (this.context = +this.context, this);
431
435
  },
432
- isInteger(u = "Must be an integer") {
433
- return this.error ? this : (this.toInt(), isNaN(this.context) && (this.error = u), this);
436
+ isInteger(c = "Must be an integer") {
437
+ return this.error ? this : (this.toInt(), isNaN(this.context) && (this.error = c), this);
434
438
  },
435
- min(u, a) {
439
+ min(c, u) {
436
440
  if (this.error) return this;
437
441
  try {
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";
442
+ typeof this.context == "number" ? +this.context < c && (this.error = u ?? `Must be at least ${c}`) : Object.prototype.hasOwnProperty.call(this.context, "length") ? +this.context.length < c && (this.error = u ?? `Must be at least ${c}`) : this.error = "Length cannot be determined";
439
443
  } catch {
440
444
  this.error = "Length cannot be determined";
441
445
  }
442
446
  return this;
443
447
  },
444
- max(u, a) {
448
+ max(c, u) {
445
449
  if (this.error) return this;
446
450
  try {
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";
451
+ typeof this.context == "number" ? +this.context > c && (this.error = u ?? `Must be at most ${c}`) : "length" in this.context ? +this.context.length > c && (this.error = u ?? `Must be at most ${c}`) : this.error = "Length cannot be determined";
448
452
  } catch {
449
453
  this.error = "Length cannot be determined";
450
454
  }
451
455
  return this;
452
456
  }
453
457
  };
454
- function qe(u) {
455
- return { ...Wt, context: u };
458
+ function qe(c) {
459
+ return { ...Wt, context: c };
456
460
  }
457
461
  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 = /* @__PURE__ */ e("div", { class: "fm-typo-en-body-lg-600" }, "Deduction summary", -1), 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 = /* @__PURE__ */ e("div", { class: "fm-typo-en-body-md-600 text-fm-color-typo-secondary bg-fm-color-neutral-gray-100 border-b py-12 px-16" }, " Ingredients ", -1), ln = { class: "grid grid-cols-[auto_100px_100px_48px] xs:grid-cols-[auto_80px_120px_48px] gap-8 px-8 items-center" }, rn = { class: "xs:col-span-3" }, un = { class: "flex gap-8" }, cn = /* @__PURE__ */ oe({
458
462
  __name: "ConvertSkuDialog",
@@ -462,29 +466,29 @@ const Jt = { class: "flex items-center" }, Qt = { class: "fm-typo-en-title-md-80
462
466
  show: { type: Boolean }
463
467
  },
464
468
  emits: ["update:show", "submitted"],
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(
469
+ setup(c, { expose: u, emit: l }) {
470
+ const s = c, S = l, f = Mt(), r = Re(), m = ve(), k = de(), v = T(0), o = T(null), g = U(() => r.skus), h = U(
467
471
  () => {
468
472
  var t, n;
469
473
  return (((n = (t = s.sku) == null ? void 0 : t.convert) == null ? void 0 : n.inventoryBindings) ?? []).filter(
470
474
  (p) => p.type === Le.enum.SKU
471
475
  );
472
476
  }
473
- ), c = R({
477
+ ), i = U({
474
478
  get() {
475
479
  return !!o.value;
476
480
  },
477
481
  set(t) {
478
- t ? o.value = je(b.value) : (o.value = null, v.value = Math.min(v.value, s.maxCount ?? 0));
482
+ t ? o.value = je(h.value) : (o.value = null, v.value = Math.min(v.value, s.maxCount ?? 0));
479
483
  }
480
- }), r = T(!1);
484
+ }), a = T(!1);
481
485
  ge([() => s.show], ([t]) => {
482
486
  t && (v.value = 0);
483
487
  });
484
488
  function I() {
485
489
  L(s.sku, be(v.value), o.value);
486
490
  }
487
- function U(t) {
491
+ function R(t) {
488
492
  if (o.value)
489
493
  return !0;
490
494
  const n = qe(t).isInteger().max(s.maxCount ?? 0).error ?? "";
@@ -498,7 +502,7 @@ const Jt = { class: "flex items-center" }, Qt = { class: "fm-typo-en-title-md-80
498
502
  }) ?? null : null, p = Be(s.sku.unit, n), d = ht(+t);
499
503
  return qe(d).isInteger().max(p).error ? "Precision cannot be more than " + p : !0;
500
504
  }
501
- const V = R(
505
+ const V = U(
502
506
  () => {
503
507
  var t, n;
504
508
  return (t = s.sku.convert) != null && t.measurement ? (n = s.sku.unit.measurements.find((p) => {
@@ -506,21 +510,21 @@ const Jt = { class: "flex items-center" }, Qt = { class: "fm-typo-en-title-md-80
506
510
  return p.id === ((d = s.sku.convert) == null ? void 0 : d.measurement);
507
511
  })) == null ? void 0 : n.abbrev : s.sku.unit.abbrev;
508
512
  }
509
- ), M = R(() => {
513
+ ), M = U(() => {
510
514
  var p, d, y;
511
515
  const t = (d = (p = s.sku.convert) == null ? void 0 : p.inventoryBindings) == null ? void 0 : d.filter((_) => _.type === "SKU");
512
516
  return (y = o.value ?? t) == null ? void 0 : y.map((_) => {
513
517
  var ee, G, ae, Pe, Ee;
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) => {
518
+ const F = r.skus.find((me) => me._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((me) => {
515
519
  var He;
516
- return pe.id === ((He = s.sku.convert) == null ? void 0 : He.measurement);
520
+ return me.id === ((He = s.sku.convert) == null ? void 0 : He.measurement);
517
521
  }) ?? null : null, le = Be(s.sku.unit, K), D = w(`${v.value}`) === !0 ? ie(
518
522
  gt(
519
523
  _.amount,
520
524
  be(+v.value, le)
521
525
  ),
522
526
  !1
523
- ) : "0", E = (Ee = (Pe = o.value) == null ? void 0 : Pe.find((pe) => pe.id === (F == null ? void 0 : F._id))) == null ? void 0 : Ee.amount, q = E ? ie(E, !1) : null;
527
+ ) : "0", E = (Ee = (Pe = o.value) == null ? void 0 : Pe.find((me) => me.id === (F == null ? void 0 : F._id))) == null ? void 0 : Ee.amount, q = E ? ie(E, !1) : null;
524
528
  return {
525
529
  sku: F,
526
530
  convertAmount: q ?? D,
@@ -528,7 +532,7 @@ const Jt = { class: "flex items-center" }, Qt = { class: "fm-typo-en-title-md-80
528
532
  };
529
533
  });
530
534
  }), H = T();
531
- a({
535
+ u({
532
536
  validateInputs: () => {
533
537
  var t, n;
534
538
  (n = (t = H.value) == null ? void 0 : t.validateInputs) == null || n.call(t);
@@ -544,7 +548,7 @@ const Jt = { class: "flex items-center" }, Qt = { class: "fm-typo-en-title-md-80
544
548
  });
545
549
  const P = Ie(s, "show");
546
550
  async function L(t, n, p) {
547
- r.value = !0;
551
+ a.value = !0;
548
552
  try {
549
553
  await m.convertSku({
550
554
  conversions: [
@@ -561,24 +565,24 @@ const Jt = { class: "flex items-center" }, Qt = { class: "fm-typo-en-title-md-80
561
565
  }))
562
566
  }
563
567
  ]
564
- }), g("update:show", !1), g("submitted");
568
+ }), S("update:show", !1), S("submitted");
565
569
  } catch (d) {
566
- x.open({
570
+ k.open({
567
571
  title: "Something went wrong",
568
572
  message: `Cannot convert ${t.name}. Please try again.`,
569
573
  type: "error"
570
574
  }), console.error("error at converting stock amount", t, n, d);
571
575
  } finally {
572
- r.value = !1;
576
+ a.value = !1;
573
577
  }
574
578
  }
575
579
  function z(t, n, p) {
576
580
  const d = +n;
577
581
  let y = p;
578
- n.length > 0 && isFinite(d) ? y = p.map((_) => (_.id !== t || (_.amount = fe(d)), _)) : y = p.map((_) => (_.id !== t || (_.amount = { amount: 0, precision: 0 }), _)), o.value = y;
582
+ n.length > 0 && isFinite(d) ? y = p.map((_) => (_.id !== t || (_.amount = pe(d)), _)) : y = p.map((_) => (_.id !== t || (_.amount = { amount: 0, precision: 0 }), _)), o.value = y;
579
583
  }
580
584
  function O(t) {
581
- const n = h.value.find((p) => p._id === t);
585
+ const n = g.value.find((p) => p._id === t);
582
586
  return n ? tt(n.unit, !0) : [];
583
587
  }
584
588
  function J(t, n) {
@@ -593,7 +597,7 @@ const Jt = { class: "flex items-center" }, Qt = { class: "fm-typo-en-title-md-80
593
597
  if (n === null)
594
598
  d = p.map((y) => (y.id !== t || (y.measurement = null), y)) ?? [];
595
599
  else {
596
- const y = h.value.find((_) => _._id === t);
600
+ const y = g.value.find((_) => _._id === t);
597
601
  d = p.map((_) => {
598
602
  var F, Y;
599
603
  return _.id !== t || (_.measurement = (Y = (F = y == null ? void 0 : y.unit) == null ? void 0 : F.measurements) == null ? void 0 : Y.find((K) => K.id === n)), _;
@@ -623,7 +627,7 @@ const Jt = { class: "flex items-center" }, Qt = { class: "fm-typo-en-title-md-80
623
627
  }
624
628
  ), (t, n) => {
625
629
  const p = $("FmTextField"), d = $("FmForm"), y = $("FmCard"), _ = $("FmSwitch"), F = $("FmFormGroup"), Y = $("FmSelect"), K = $("FmButton"), le = $("FmSideSheet");
626
- return S(), N(le, {
630
+ return x(), N(le, {
627
631
  "dismiss-away": "",
628
632
  modelValue: C(P),
629
633
  "onUpdate:modelValue": n[3] || (n[3] = (D) => De(P) ? P.value = D : null),
@@ -636,34 +640,34 @@ const Jt = { class: "flex items-center" }, Qt = { class: "fm-typo-en-title-md-80
636
640
  ]),
637
641
  default: B(() => [
638
642
  e("div", Xt, [
639
- k(d, {
643
+ b(d, {
640
644
  ref_key: "formRef",
641
645
  ref: H,
642
646
  onValidationSuccess: I
643
647
  }, {
644
648
  default: B(() => [
645
- k(p, {
646
- disabled: r.value,
649
+ b(p, {
650
+ disabled: a.value,
647
651
  "model-value": v.value,
648
652
  "onUpdate:modelValue": n[0] || (n[0] = (D) => v.value = D),
649
653
  label: "Amount",
650
- rules: [U, w, C(Ve)(0)],
654
+ rules: [R, w, C(Ve)(0)],
651
655
  "append-text": V.value,
652
656
  "helper-text": o.value ? void 0 : `Max ${t.maxCount} ${V.value}`
653
657
  }, null, 8, ["disabled", "model-value", "rules", "append-text", "helper-text"])
654
658
  ]),
655
659
  _: 1
656
660
  }, 512),
657
- k(y, {
661
+ b(y, {
658
662
  variant: "outlined",
659
663
  class: "p-16"
660
664
  }, {
661
665
  default: B(() => [
662
666
  e("div", Zt, [
663
667
  en,
664
- (S(!0), j(ne, null, re(M.value, (D) => {
668
+ (x(!0), j(ne, null, re(M.value, (D) => {
665
669
  var E, q;
666
- return S(), j("div", {
670
+ return x(), j("div", {
667
671
  key: (E = D.sku) == null ? void 0 : E._id,
668
672
  class: "flex items-center"
669
673
  }, [
@@ -675,30 +679,30 @@ const Jt = { class: "flex items-center" }, Qt = { class: "fm-typo-en-title-md-80
675
679
  ]),
676
680
  _: 1
677
681
  }),
678
- k(y, { variant: "outlined" }, {
682
+ b(y, { variant: "outlined" }, {
679
683
  default: B(() => [
680
684
  e("div", on, [
681
- k(_, {
685
+ b(_, {
682
686
  value: "",
683
- modelValue: c.value,
684
- "onUpdate:modelValue": n[1] || (n[1] = (D) => c.value = D),
687
+ modelValue: i.value,
688
+ "onUpdate:modelValue": n[1] || (n[1] = (D) => i.value = D),
685
689
  label: "Override deduction",
686
690
  "label-placement": "right"
687
691
  }, null, 8, ["modelValue"]),
688
- c.value ? (S(), j(ne, { key: 0 }, [
689
- k(F, {
692
+ i.value ? (x(), j(ne, { key: 0 }, [
693
+ b(F, {
690
694
  modelValue: o.value,
691
695
  rules: [C(At)(1, "Must have at least one ingredient binding")]
692
696
  }, null, 8, ["modelValue", "rules"]),
693
697
  e("div", sn, [
694
698
  an,
695
- (S(!0), j(ne, null, re(o.value, (D) => (S(), N(F, {
699
+ (x(!0), j(ne, null, re(o.value, (D) => (x(), N(F, {
696
700
  key: D.id,
697
- disabled: r.value,
701
+ disabled: a.value,
698
702
  modelValue: +C(ie)(D.amount ?? { amount: 1, precision: 0 }),
699
703
  rules: [
700
704
  C(Vt)(
701
- h.value.find((E) => E._id === D.id).unit,
705
+ g.value.find((E) => E._id === D.id).unit,
702
706
  D.measurement
703
707
  ),
704
708
  C(Ve)(0)
@@ -708,18 +712,18 @@ const Jt = { class: "flex items-center" }, Qt = { class: "fm-typo-en-title-md-80
708
712
  var q, ee, G;
709
713
  return [
710
714
  e("div", ln, [
711
- e("div", rn, A((q = h.value.find((ae) => ae._id === D.id)) == null ? void 0 : q.name), 1),
712
- k(p, {
715
+ e("div", rn, A((q = g.value.find((ae) => ae._id === D.id)) == null ? void 0 : q.name), 1),
716
+ b(p, {
713
717
  class: "xs:col-span-2",
714
- disabled: r.value,
718
+ disabled: a.value,
715
719
  modelValue: +C(ie)(
716
720
  D.amount ?? { amount: 1, precision: 0 }
717
721
  ),
718
722
  "onUpdate:modelValue": (ae) => z(D.id, ae, o.value ?? []),
719
723
  invalid: E
720
724
  }, null, 8, ["disabled", "modelValue", "onUpdate:modelValue", "invalid"]),
721
- k(Y, {
722
- disabled: r.value,
725
+ b(Y, {
726
+ disabled: a.value,
723
727
  class: "translate-y-[2px]",
724
728
  items: O(D.id),
725
729
  "model-value": (G = J(D.id, (ee = D.measurement) == null ? void 0 : ee.id)) == null ? void 0 : G.value,
@@ -729,8 +733,8 @@ const Jt = { class: "flex items-center" }, Qt = { class: "fm-typo-en-title-md-80
729
733
  "helper-text": B(() => []),
730
734
  _: 2
731
735
  }, 1032, ["disabled", "items", "model-value", "onUpdate:modelValue", "invalid"]),
732
- k(K, {
733
- disabled: r.value,
736
+ b(K, {
737
+ disabled: a.value,
734
738
  type: "button",
735
739
  variant: "tertiary",
736
740
  icon: "delete",
@@ -743,7 +747,7 @@ const Jt = { class: "flex items-center" }, Qt = { class: "fm-typo-en-title-md-80
743
747
  }, 1032, ["disabled", "modelValue", "rules"]))), 128))
744
748
  ]),
745
749
  e("div", null, [
746
- k(K, {
750
+ b(K, {
747
751
  icon: "link",
748
752
  label: "Link ingredient",
749
753
  variant: "plain",
@@ -759,8 +763,8 @@ const Jt = { class: "flex items-center" }, Qt = { class: "fm-typo-en-title-md-80
759
763
  ]),
760
764
  "side-sheet-footer": B(() => [
761
765
  e("div", un, [
762
- k(K, {
763
- loading: r.value,
766
+ b(K, {
767
+ loading: a.value,
764
768
  label: "Convert",
765
769
  onClick: n[2] || (n[2] = (D) => {
766
770
  var E, q;
@@ -774,12 +778,12 @@ const Jt = { class: "flex items-center" }, Qt = { class: "fm-typo-en-title-md-80
774
778
  };
775
779
  }
776
780
  });
777
- function Fe(u, a) {
778
- const l = be(u, a);
781
+ function Fe(c, u) {
782
+ const l = be(c, u);
779
783
  return { ...l, amount: -l.amount };
780
784
  }
781
- function Ke(u, a) {
782
- return be(Math.abs(u), a);
785
+ function Ke(c, u) {
786
+ return be(Math.abs(c), u);
783
787
  }
784
788
  const Ce = {
785
789
  [te.enum.DAMAGE]: {
@@ -809,90 +813,90 @@ const Ce = {
809
813
  disabled: { type: Boolean }
810
814
  },
811
815
  emits: ["update:modelValue", "click:delete"],
812
- setup(u, { emit: a }) {
813
- const l = u, s = a, g = R(
816
+ setup(c, { emit: u }) {
817
+ const l = c, s = u, S = U(
814
818
  () => Object.keys(Ce).map((o) => ({
815
819
  label: rt(o),
816
820
  value: o
817
821
  }))
818
- ), f = R(() => tt(l.modelValue.doc.unit, !0)), i = R({
822
+ ), f = U(() => tt(l.modelValue.doc.unit, !0)), r = U({
819
823
  get() {
820
824
  return l.modelValue.type ?? te.enum.PURCHASE;
821
825
  },
822
826
  set(o) {
823
- const h = {
827
+ const g = {
824
828
  ...l.modelValue
825
829
  };
826
- h.type = o;
827
- const b = Ye(l.modelValue.amount);
828
- h.amount = Ce[h.type].toAdjustmentAmount(
829
- +ie(b),
830
- b.precision
831
- ), s("update:modelValue", h);
830
+ g.type = o;
831
+ const h = Ye(l.modelValue.amount);
832
+ g.amount = Ce[g.type].toAdjustmentAmount(
833
+ +ie(h),
834
+ h.precision
835
+ ), s("update:modelValue", g);
832
836
  }
833
- }), m = R({
837
+ }), m = U({
834
838
  get() {
835
839
  const o = Ye(l.modelValue.amount);
836
840
  return +ie(o);
837
841
  },
838
842
  set(o) {
839
- const h = {
843
+ const g = {
840
844
  ...l.modelValue
841
- }, b = fe(o);
842
- h.amount = Ce[i.value].toAdjustmentAmount(
845
+ }, h = pe(o);
846
+ g.amount = Ce[r.value].toAdjustmentAmount(
843
847
  o,
844
- b.precision
845
- ), s("update:modelValue", h);
848
+ h.precision
849
+ ), s("update:modelValue", g);
846
850
  }
847
- }), x = R({
851
+ }), k = U({
848
852
  get() {
849
853
  var o;
850
854
  return ((o = l.modelValue.measurement) == null ? void 0 : o.id) ?? null;
851
855
  },
852
856
  set(o) {
853
- var b, c;
854
- const h = {
857
+ var h, i;
858
+ const g = {
855
859
  ...l.modelValue
856
860
  };
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);
861
+ g.measurement = ((i = (h = l.modelValue.doc.unit) == null ? void 0 : h.measurements) == null ? void 0 : i.find((a) => a.id === o)) ?? null, s("update:modelValue", g);
858
862
  }
859
- }), v = R({
863
+ }), v = U({
860
864
  get() {
861
865
  return l.modelValue.remark ?? "";
862
866
  },
863
867
  set(o) {
864
- const h = {
868
+ const g = {
865
869
  ...l.modelValue
866
870
  };
867
- h.remark = o, s("update:modelValue", h);
871
+ g.remark = o, s("update:modelValue", g);
868
872
  }
869
873
  });
870
- return (o, h) => {
871
- const b = $("FmButton"), c = $("FmSelect"), r = $("FmTextarea"), I = $("FmCard");
872
- return S(), N(I, {
874
+ return (o, g) => {
875
+ const h = $("FmButton"), i = $("FmSelect"), a = $("FmTextarea"), I = $("FmCard");
876
+ return x(), N(I, {
873
877
  variant: "outlined",
874
878
  class: "grid grid-cols-2 gap-8 p-16"
875
879
  }, {
876
880
  default: B(() => [
877
881
  e("div", dn, [
878
882
  e("div", mn, A(o.modelValue.doc.name), 1),
879
- k(b, {
883
+ b(h, {
880
884
  variant: "tertiary",
881
885
  "prepend-icon": "delete",
882
- onClick: h[0] || (h[0] = (U) => s("click:delete"))
886
+ onClick: g[0] || (g[0] = (R) => s("click:delete"))
883
887
  })
884
888
  ]),
885
- k(c, {
889
+ b(i, {
886
890
  disabled: o.disabled,
887
891
  class: "col-span-2",
888
892
  label: "Type",
889
- items: g.value,
890
- modelValue: i.value,
891
- "onUpdate:modelValue": h[1] || (h[1] = (U) => i.value = U),
893
+ items: S.value,
894
+ modelValue: r.value,
895
+ "onUpdate:modelValue": g[1] || (g[1] = (R) => r.value = R),
892
896
  rules: [C(Dt)()],
893
897
  "label-mark": "required"
894
898
  }, null, 8, ["disabled", "items", "modelValue", "rules"]),
895
- k(Rt, {
899
+ b(Rt, {
896
900
  disabled: o.disabled,
897
901
  label: "Amount",
898
902
  step: +C(ie)({
@@ -900,22 +904,22 @@ const Ce = {
900
904
  precision: C(Be)(o.modelValue.doc.unit, o.modelValue.measurement)
901
905
  }),
902
906
  modelValue: m.value,
903
- "onUpdate:modelValue": h[2] || (h[2] = (U) => m.value = U),
907
+ "onUpdate:modelValue": g[2] || (g[2] = (R) => m.value = R),
904
908
  rules: [C(Ve)(0)]
905
909
  }, null, 8, ["disabled", "step", "modelValue", "rules"]),
906
- k(c, {
910
+ b(i, {
907
911
  disabled: o.disabled,
908
912
  label: "Unit",
909
913
  items: f.value,
910
- modelValue: x.value,
911
- "onUpdate:modelValue": h[3] || (h[3] = (U) => x.value = U)
914
+ modelValue: k.value,
915
+ "onUpdate:modelValue": g[3] || (g[3] = (R) => k.value = R)
912
916
  }, null, 8, ["disabled", "items", "modelValue"]),
913
- k(r, {
917
+ b(a, {
914
918
  class: "col-span-2",
915
919
  disabled: o.disabled,
916
920
  label: "Remark",
917
921
  modelValue: v.value,
918
- "onUpdate:modelValue": h[4] || (h[4] = (U) => v.value = U),
922
+ "onUpdate:modelValue": g[4] || (g[4] = (R) => v.value = R),
919
923
  "label-mark": "optional"
920
924
  }, null, 8, ["disabled", "modelValue"])
921
925
  ]),
@@ -932,27 +936,27 @@ const Ce = {
932
936
  show: { type: Boolean }
933
937
  },
934
938
  emits: ["update:show", "submitted"],
935
- setup(u, { expose: a, emit: l }) {
936
- const s = u, g = l, f = Re(), i = Ue(), m = ve(), x = me(), v = T(!1);
939
+ setup(c, { expose: u, emit: l }) {
940
+ const s = c, S = l, f = Re(), r = Ue(), m = ve(), k = de(), v = T(!1);
937
941
  function o() {
938
- r(je(c));
942
+ a(je(i));
939
943
  }
940
- const h = T();
941
- a({
944
+ const g = T();
945
+ u({
942
946
  validateInputs: () => {
943
947
  var w, V;
944
- (V = (w = h.value) == null ? void 0 : w.validateInputs) == null || V.call(w);
948
+ (V = (w = g.value) == null ? void 0 : w.validateInputs) == null || V.call(w);
945
949
  },
946
950
  resetInputsValidation: () => {
947
951
  var w, V;
948
- (V = (w = h.value) == null ? void 0 : w.resetInputsValidation) == null || V.call(w);
952
+ (V = (w = g.value) == null ? void 0 : w.resetInputsValidation) == null || V.call(w);
949
953
  },
950
954
  resetInputs: () => {
951
955
  var w, V;
952
- (V = (w = h.value) == null ? void 0 : w.resetInputs) == null || V.call(w);
956
+ (V = (w = g.value) == null ? void 0 : w.resetInputs) == null || V.call(w);
953
957
  }
954
958
  });
955
- const b = Ie(s, "show"), c = st({
959
+ const h = Ie(s, "show"), i = st({
956
960
  remark: "",
957
961
  adjustments: [
958
962
  {
@@ -961,23 +965,23 @@ const Ce = {
961
965
  doc: s.stock,
962
966
  measurement: null,
963
967
  remark: "",
964
- amount: fe(1)
968
+ amount: pe(1)
965
969
  }
966
970
  ]
967
971
  });
968
972
  ge([() => s.show], ([w]) => {
969
- w && (c.remark = "", c.adjustments = [
973
+ w && (i.remark = "", i.adjustments = [
970
974
  {
971
975
  id: `sku_${(/* @__PURE__ */ new Date()).toISOString()}_${Math.random().toString(16).slice(2, 8)}`,
972
976
  type: te.enum.PURCHASE,
973
977
  doc: s.stock,
974
978
  measurement: null,
975
979
  remark: "",
976
- amount: fe(1)
980
+ amount: pe(1)
977
981
  }
978
982
  ]);
979
983
  });
980
- async function r(w) {
984
+ async function a(w) {
981
985
  v.value = !0;
982
986
  try {
983
987
  await m.adjustSku({
@@ -990,9 +994,9 @@ const Ce = {
990
994
  doc: V,
991
995
  type: H
992
996
  }))
993
- }), g("update:show", !1), g("submitted");
997
+ }), S("update:show", !1), S("submitted");
994
998
  } catch (V) {
995
- x.open({
999
+ k.open({
996
1000
  title: "Something went wrong",
997
1001
  message: "Cannot adjust ingredients. Please try again.",
998
1002
  type: "error"
@@ -1006,8 +1010,8 @@ const Ce = {
1006
1010
  label: M.name,
1007
1011
  sublabel: M.code,
1008
1012
  value: M._id
1009
- })), V = w.filter((M) => c.adjustments.find((H) => H.doc._id === M.value)).map((M) => M.value);
1010
- i.open({
1013
+ })), V = w.filter((M) => i.adjustments.find((H) => H.doc._id === M.value)).map((M) => M.value);
1014
+ r.open({
1011
1015
  title: "Select ingredients",
1012
1016
  contentComponent: jt,
1013
1017
  contentComponentProps: {
@@ -1027,26 +1031,26 @@ const Ce = {
1027
1031
  variant: "tertiary"
1028
1032
  }
1029
1033
  }).onPrimary((M) => {
1030
- c.adjustments = M.map(
1031
- (H) => c.adjustments.find((P) => P.doc._id === H) ?? {
1034
+ i.adjustments = M.map(
1035
+ (H) => i.adjustments.find((P) => P.doc._id === H) ?? {
1032
1036
  id: `sku_${(/* @__PURE__ */ new Date()).toISOString()}_${Math.random().toString(16).slice(2, 8)}`,
1033
1037
  type: te.enum.PURCHASE,
1034
1038
  doc: f.skus.find((P) => P._id === H),
1035
1039
  measurement: null,
1036
1040
  remark: "",
1037
- amount: fe(1)
1041
+ amount: pe(1)
1038
1042
  }
1039
1043
  );
1040
1044
  });
1041
1045
  }
1042
- function U(w) {
1043
- c.adjustments.splice(w, 1);
1046
+ function R(w) {
1047
+ i.adjustments.splice(w, 1);
1044
1048
  }
1045
1049
  return (w, V) => {
1046
1050
  const M = $("FmTextarea"), H = $("FmButton"), P = $("FmForm"), L = $("FmSideSheet");
1047
- return S(), N(L, {
1048
- modelValue: C(b),
1049
- "onUpdate:modelValue": V[2] || (V[2] = (z) => De(b) ? b.value = z : null),
1051
+ return x(), N(L, {
1052
+ modelValue: C(h),
1053
+ "onUpdate:modelValue": V[2] || (V[2] = (z) => De(h) ? h.value = z : null),
1050
1054
  "dismiss-away": "",
1051
1055
  "max-width": 500
1052
1056
  }, {
@@ -1054,32 +1058,32 @@ const Ce = {
1054
1058
  fn
1055
1059
  ]),
1056
1060
  default: B(() => [
1057
- k(P, {
1061
+ b(P, {
1058
1062
  class: "w-full flex flex-col gap-12",
1059
1063
  ref_key: "formRef",
1060
- ref: h,
1064
+ ref: g,
1061
1065
  onValidationSuccess: o
1062
1066
  }, {
1063
1067
  default: B(() => [
1064
- k(M, {
1068
+ b(M, {
1065
1069
  label: "Remark",
1066
- modelValue: c.remark,
1067
- "onUpdate:modelValue": V[0] || (V[0] = (z) => c.remark = z)
1070
+ modelValue: i.remark,
1071
+ "onUpdate:modelValue": V[0] || (V[0] = (z) => i.remark = z)
1068
1072
  }, null, 8, ["modelValue"]),
1069
1073
  e("div", vn, [
1070
1074
  _n,
1071
- k(H, {
1075
+ b(H, {
1072
1076
  "prepend-icon": "add",
1073
1077
  variant: "tertiary",
1074
1078
  size: "md",
1075
1079
  onClick: I
1076
1080
  })
1077
1081
  ]),
1078
- (S(!0), j(ne, null, re(c.adjustments, (z, O) => (S(), N(pn, {
1082
+ (x(!0), j(ne, null, re(i.adjustments, (z, O) => (x(), N(pn, {
1079
1083
  key: z.id,
1080
- modelValue: c.adjustments[O],
1081
- "onUpdate:modelValue": (J) => c.adjustments[O] = J,
1082
- "onClick:delete": (J) => U(O)
1084
+ modelValue: i.adjustments[O],
1085
+ "onUpdate:modelValue": (J) => i.adjustments[O] = J,
1086
+ "onClick:delete": (J) => R(O)
1083
1087
  }, null, 8, ["modelValue", "onUpdate:modelValue", "onClick:delete"]))), 128))
1084
1088
  ]),
1085
1089
  _: 1
@@ -1087,12 +1091,12 @@ const Ce = {
1087
1091
  ]),
1088
1092
  "side-sheet-footer": B(() => [
1089
1093
  e("div", yn, [
1090
- k(H, {
1094
+ b(H, {
1091
1095
  label: "Adjust",
1092
1096
  loading: v.value,
1093
1097
  onClick: V[1] || (V[1] = (z) => {
1094
1098
  var O, J;
1095
- return (J = (O = h.value) == null ? void 0 : O.validateInputs) == null ? void 0 : J.call(O);
1099
+ return (J = (O = g.value) == null ? void 0 : O.validateInputs) == null ? void 0 : J.call(O);
1096
1100
  })
1097
1101
  }, null, 8, ["loading"])
1098
1102
  ])
@@ -1101,22 +1105,22 @@ const Ce = {
1101
1105
  }, 8, ["modelValue"]);
1102
1106
  };
1103
1107
  }
1104
- }), hn = We((u, a) => ({
1108
+ }), hn = We((c, u) => ({
1105
1109
  // TODO: remove once latest inventory backend has been push
1106
- async findBillsByBusinessId(l, s, g) {
1107
- const f = `${u.businessesBackendUrl}/${l}/reports/find-many`, i = {
1110
+ async findBillsByBusinessId(l, s, S) {
1111
+ const f = `${c.businessesBackendUrl}/${l}/reports/find-many`, r = {
1108
1112
  // type: TYPE.bill,
1109
1113
  type: "bill",
1110
1114
  restaurantIds: s,
1111
- ids: g
1115
+ ids: S
1112
1116
  };
1113
- return await a.post(f, i);
1117
+ return await u.post(f, r);
1114
1118
  },
1115
1119
  async findBillsById(l) {
1116
- const g = ue().currentLocationDBName, f = `${u.inventoryBackendUrl}/${g}/bill/search`, i = {
1120
+ const S = ue().currentLocationDBName, f = `${c.inventoryBackendUrl}/${S}/bill/search`, r = {
1117
1121
  ids: l
1118
1122
  };
1119
- return await a.post(f, i);
1123
+ return await u.post(f, r);
1120
1124
  }
1121
1125
  })), bn = { class: "p-16" }, kn = { class: "fm-typo-en-body-md-600 flex-grow" }, xn = { class: "flex-grow text-fm-color-typo-secondary" }, Sn = {
1122
1126
  key: 0,
@@ -1134,85 +1138,85 @@ const Ce = {
1134
1138
  sku: {},
1135
1139
  bills: { default: () => [] }
1136
1140
  },
1137
- setup(u) {
1138
- const a = u, l = T(!1), s = T(), g = T(null), f = R(() => g.value === null ? "unset" : l.value ? `${g.value}px` : "0px");
1141
+ setup(c) {
1142
+ const u = c, l = T(!1), s = T(), S = T(null), f = U(() => S.value === null ? "unset" : l.value ? `${S.value}px` : "0px");
1139
1143
  Me(() => {
1140
- var x;
1141
- g.value = ((x = s.value) == null ? void 0 : x.scrollHeight) || 0;
1144
+ var k;
1145
+ S.value = ((k = s.value) == null ? void 0 : k.scrollHeight) || 0;
1142
1146
  });
1143
- const i = R(() => {
1144
- var c;
1145
- const x = a.record.adjustments, v = a.sku, o = {}, b = x.flatMap((r) => {
1147
+ const r = U(() => {
1148
+ var i;
1149
+ const k = u.record.adjustments, v = u.sku, o = {}, h = k.flatMap((a) => {
1146
1150
  var I;
1147
- return ((I = r.skus) == null ? void 0 : I.filter((U) => U.sku._id === v._id)) ?? [];
1148
- }).flatMap((r) => r.amounts);
1149
- for (const r of b) {
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]);
1151
+ return ((I = a.skus) == null ? void 0 : I.filter((R) => R.sku._id === v._id)) ?? [];
1152
+ }).flatMap((a) => a.amounts);
1153
+ for (const a of h) {
1154
+ const I = a.measurement ? bt(a.measurement.conversion, a.amount) : a.amount;
1155
+ o[i = a.type] ?? (o[i] = { amount: 0, precision: 0 }), o[a.type] = Ze(I, o[a.type]);
1152
1156
  }
1153
1157
  return Object.entries(o).reduce(
1154
- (r, [I, U]) => (r[I] = /// comment, because without it formatter makes code uglier
1158
+ (a, [I, R]) => (a[I] = /// comment, because without it formatter makes code uglier
1155
1159
  `${W.toFormatString({
1156
- value: U,
1160
+ value: R,
1157
1161
  precision: 4
1158
- })} ${v.unit.abbrev}`, r),
1162
+ })} ${v.unit.abbrev}`, a),
1159
1163
  {}
1160
1164
  );
1161
- }), m = R(() => a.record.adjustmentsByTime.map(({ date: x, adjustments: v }) => ({
1162
- time: kt(new Date(x)),
1165
+ }), m = U(() => u.record.adjustmentsByTime.map(({ date: k, adjustments: v }) => ({
1166
+ time: kt(new Date(k)),
1163
1167
  adjustments: v.flatMap(
1164
1168
  (o) => {
1165
- var h, b;
1166
- return ((b = (h = o.skus) == null ? void 0 : h.map) == null ? void 0 : b.call(h, (c) => ({
1167
- ...c,
1169
+ var g, h;
1170
+ return ((h = (g = o.skus) == null ? void 0 : g.map) == null ? void 0 : h.call(g, (i) => ({
1171
+ ...i,
1168
1172
  ref: o.ref,
1169
1173
  backdateFrom: o.effectiveAt != null ? Xe(o._id) : null
1170
1174
  }))) ?? [];
1171
1175
  }
1172
1176
  ).flatMap((o) => {
1173
- var c;
1174
- const h = (c = a.bills.find((r) => r._id === o.ref)) == null ? void 0 : c.seqNumber, b = h ? `Bill ${h}` : "";
1175
- return o.amounts.map((r) => {
1177
+ var i;
1178
+ const g = (i = u.bills.find((a) => a._id === o.ref)) == null ? void 0 : i.seqNumber, h = g ? `Bill ${g}` : "";
1179
+ return o.amounts.map((a) => {
1176
1180
  var I;
1177
1181
  return {
1178
- amount: `${W.toFormatString({ value: r.amount, precision: 4 })} ${((I = r.measurement) == null ? void 0 : I.abbrev) ?? o.sku.unit.abbrev}`,
1182
+ amount: `${W.toFormatString({ value: a.amount, precision: 4 })} ${((I = a.measurement) == null ? void 0 : I.abbrev) ?? o.sku.unit.abbrev}`,
1179
1183
  backdateFrom: o.backdateFrom,
1180
- name: r.type,
1181
- remark: r.remark || b || "",
1182
- cost: r.cost
1184
+ name: a.type,
1185
+ remark: a.remark || h || "",
1186
+ cost: a.cost
1183
1187
  };
1184
1188
  });
1185
1189
  })
1186
1190
  })));
1187
- return (x, v) => {
1188
- const o = $("FmIcon"), h = $("FmTooltip"), b = $("FmCard");
1189
- return S(), N(b, { variant: "outlined" }, {
1191
+ return (k, v) => {
1192
+ const o = $("FmIcon"), g = $("FmTooltip"), h = $("FmCard");
1193
+ return x(), N(h, { variant: "outlined" }, {
1190
1194
  default: B(() => [
1191
1195
  e("div", bn, [
1192
1196
  e("div", {
1193
1197
  class: "flex items-center cursor-pointer mb-1",
1194
- onClick: v[0] || (v[0] = (c) => l.value = !l.value)
1198
+ onClick: v[0] || (v[0] = (i) => l.value = !l.value)
1195
1199
  }, [
1196
- e("div", kn, A(x.record.date), 1),
1197
- k(o, {
1200
+ e("div", kn, A(k.record.date), 1),
1201
+ b(o, {
1198
1202
  name: l.value ? "expand_more" : "expand_less",
1199
1203
  color: "#777777",
1200
1204
  size: "md"
1201
1205
  }, null, 8, ["name"])
1202
1206
  ]),
1203
- (S(!0), j(ne, null, re(i.value, (c, r) => (S(), j("div", {
1204
- key: r,
1207
+ (x(!0), j(ne, null, re(r.value, (i, a) => (x(), j("div", {
1208
+ key: a,
1205
1209
  class: "flex flex-row py-1",
1206
1210
  style: { "font-size": "0.8rem" }
1207
1211
  }, [
1208
- e("div", xn, A(r), 1),
1212
+ e("div", xn, A(a), 1),
1209
1213
  e("div", {
1210
- class: ce({
1211
- "text-fm-color-typo-error": c.startsWith("-"),
1212
- "text-fm-color-typo-success": !c.startsWith("-"),
1214
+ class: fe({
1215
+ "text-fm-color-typo-error": i.startsWith("-"),
1216
+ "text-fm-color-typo-success": !i.startsWith("-"),
1213
1217
  "ml-auto": !0
1214
1218
  })
1215
- }, A(c), 3)
1219
+ }, A(i), 3)
1216
1220
  ]))), 128)),
1217
1221
  e("div", {
1218
1222
  ref_key: "detailRef",
@@ -1224,30 +1228,30 @@ const Ce = {
1224
1228
  transition: "max-height 0.2s ease-out"
1225
1229
  })
1226
1230
  }, [
1227
- m.value.length ? (S(), j("hr", Sn)) : Z("", !0),
1228
- (S(!0), j(ne, null, re(m.value, (c) => (S(), j("div", {
1229
- key: c.time,
1231
+ m.value.length ? (x(), j("hr", Sn)) : Z("", !0),
1232
+ (x(!0), j(ne, null, re(m.value, (i) => (x(), j("div", {
1233
+ key: i.time,
1230
1234
  class: "flex gap-1 w-full"
1231
1235
  }, [
1232
- e("div", $n, A(c.time), 1),
1236
+ e("div", $n, A(i.time), 1),
1233
1237
  e("div", wn, [
1234
- (S(!0), j(ne, null, re(c.adjustments, (r) => (S(), j("div", {
1235
- key: r.name,
1238
+ (x(!0), j(ne, null, re(i.adjustments, (a) => (x(), j("div", {
1239
+ key: a.name,
1236
1240
  class: "flex gap-1"
1237
1241
  }, [
1238
1242
  e("div", Fn, [
1239
- de(A(r.name) + " ", 1),
1240
- r.backdateFrom ? (S(), N(h, {
1243
+ ce(A(a.name) + " ", 1),
1244
+ a.backdateFrom ? (x(), N(g, {
1241
1245
  key: 0,
1242
1246
  variant: "plain",
1243
1247
  placement: "top",
1244
1248
  "z-index": 50
1245
1249
  }, {
1246
1250
  content: B(() => [
1247
- e("div", Cn, " Backdate from " + A(C(et)(new Date(r.backdateFrom))), 1)
1251
+ e("div", Cn, " Backdate from " + A(C(et)(new Date(a.backdateFrom))), 1)
1248
1252
  ]),
1249
1253
  default: B(() => [
1250
- k(o, {
1254
+ b(o, {
1251
1255
  name: "info",
1252
1256
  size: "sm",
1253
1257
  color: "primary"
@@ -1255,16 +1259,16 @@ const Ce = {
1255
1259
  ]),
1256
1260
  _: 2
1257
1261
  }, 1024)) : Z("", !0),
1258
- r.remark ? (S(), j("span", Bn, " # " + A(r.remark), 1)) : Z("", !0)
1262
+ a.remark ? (x(), j("span", Bn, " # " + A(a.remark), 1)) : Z("", !0)
1259
1263
  ]),
1260
1264
  e("div", {
1261
- class: ce({
1262
- "text-fm-color-typo-error": r.amount.startsWith("-"),
1263
- "text-fm-color-typo-success": !r.amount.startsWith("-"),
1265
+ class: fe({
1266
+ "text-fm-color-typo-error": a.amount.startsWith("-"),
1267
+ "text-fm-color-typo-success": !a.amount.startsWith("-"),
1264
1268
  "ml-auto": !0
1265
1269
  })
1266
- }, A(r.amount), 3),
1267
- r.cost ? (S(), j("div", An, " (" + A(C(Ae)(r.cost, !1, r.cost.precision)) + ") ", 1)) : Z("", !0)
1270
+ }, A(a.amount), 3),
1271
+ a.cost ? (x(), j("div", An, " (" + A(C(Ae)(a.cost, !1, a.cost.precision)) + ") ", 1)) : Z("", !0)
1268
1272
  ]))), 128))
1269
1273
  ])
1270
1274
  ]))), 128))
@@ -1276,81 +1280,65 @@ const Ce = {
1276
1280
  };
1277
1281
  }
1278
1282
  });
1279
- function Dn(u, a) {
1283
+ function Dn(c, u) {
1280
1284
  var f;
1281
1285
  const l = Object.keys(te.enum).reduce(
1282
- (i, m) => (i[m] = { amount: 0, precision: 0 }, i),
1286
+ (r, m) => (r[m] = { amount: 0, precision: 0 }, r),
1283
1287
  {}
1284
1288
  );
1285
- if (!a)
1289
+ if (!u)
1286
1290
  return Object.entries(l).reduce(
1287
- (i, [m]) => (i[m] = W.fromNumber(0), i),
1291
+ (r, [m]) => (r[m] = W.fromNumber(0), r),
1288
1292
  {}
1289
1293
  );
1290
- const g = u.flatMap((i) => {
1294
+ const S = c.flatMap((r) => {
1291
1295
  var m;
1292
- return ((m = i.skus) == null ? void 0 : m.filter((x) => x.sku._id === a._id)) ?? [];
1293
- }).flatMap((i) => i.amounts);
1294
- for (const i of g) {
1295
- const m = i.measurement ? W.multiply([i.measurement.conversion, i.amount]) : i.amount;
1296
- l[f = i.type] ?? (l[f] = { amount: 0, precision: 0 }), l[i.type] = W.add([m, l[i.type]]);
1296
+ return ((m = r.skus) == null ? void 0 : m.filter((k) => k.sku._id === u._id)) ?? [];
1297
+ }).flatMap((r) => r.amounts);
1298
+ for (const r of S) {
1299
+ const m = r.measurement ? W.multiply([r.measurement.conversion, r.amount]) : r.amount;
1300
+ l[f = r.type] ?? (l[f] = { amount: 0, precision: 0 }), l[r.type] = W.add([m, l[r.type]]);
1297
1301
  }
1298
1302
  return Object.entries(l).reduce(
1299
- (i, [m, x]) => {
1303
+ (r, [m, k]) => {
1300
1304
  const v = {
1301
- ...x,
1302
- amount: Math.abs(x.amount)
1305
+ ...k,
1306
+ amount: Math.abs(k.amount)
1303
1307
  };
1304
- return i[m] = /// comment, because without it formatter makes code uglier
1308
+ return r[m] = /// comment, because without it formatter makes code uglier
1305
1309
  `${W.toFormatString({
1306
1310
  value: v,
1307
1311
  precision: 4
1308
- })} ${a.unit.abbrev}`, i;
1312
+ })} ${u.unit.abbrev}`, r;
1309
1313
  },
1310
1314
  {}
1311
1315
  );
1312
1316
  }
1313
- function Mn(u, a) {
1314
- if (!a)
1317
+ function Mn(c, u) {
1318
+ if (!u)
1315
1319
  return null;
1316
1320
  let l = null;
1317
- const g = u.flatMap((f) => {
1318
- var i;
1319
- return ((i = f.skus) == null ? void 0 : i.filter((m) => m.sku._id === a._id)) ?? [];
1321
+ const S = c.flatMap((f) => {
1322
+ var r;
1323
+ return ((r = f.skus) == null ? void 0 : r.filter((m) => m.sku._id === u._id)) ?? [];
1320
1324
  }).flatMap((f) => {
1321
- var i;
1322
- return !f.history || ((i = f.history) == null ? void 0 : i.length) === 0 ? [] : f.history[0];
1325
+ var r;
1326
+ return !f.history || ((r = f.history) == null ? void 0 : r.length) === 0 ? [] : f.history[0];
1323
1327
  });
1324
- for (const f of g) {
1325
- const i = f.amounts;
1326
- for (const m of i) {
1328
+ for (const f of S) {
1329
+ const r = f.amounts;
1330
+ for (const m of r) {
1327
1331
  if (m.type !== te.Enum.SALES)
1328
1332
  continue;
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]);
1333
+ const k = m.measurement ? W.multiply([m.measurement.conversion, m.amount]) : m.amount;
1334
+ l ?? (l = W.fromNumber(0)), l = W.add([l, k]);
1331
1335
  }
1332
1336
  }
1333
1337
  return l != null ? (l.amount = Math.abs(l.amount), `${W.toFormatString({
1334
1338
  value: l,
1335
1339
  precision: 4
1336
- })} ${a.unit.abbrev}`) : null;
1340
+ })} ${u.unit.abbrev}`) : null;
1337
1341
  }
1338
- Array.prototype.computeFirst = function(u) {
1339
- const a = this.length;
1340
- for (let l = 0; l < a; l++) {
1341
- const s = this.at(l), g = u(s, l, this);
1342
- if (g != null)
1343
- return g;
1344
- }
1345
- };
1346
- Array.prototype.computeLast = function(u) {
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);
1350
- if (g != null)
1351
- return g;
1352
- }
1353
- };
1354
1342
  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 = {
1355
1343
  key: 0,
1356
1344
  class: "flex-1 flex flex-col items-center gap-16"
@@ -1375,10 +1363,10 @@ const jn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Rn = {
1375
1363
  show: { type: Boolean }
1376
1364
  },
1377
1365
  emits: ["update:show"],
1378
- setup(u) {
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));
1380
- async function h() {
1381
- x.value = !0;
1366
+ setup(c) {
1367
+ const u = Qe(), l = Te(), s = ve(), S = hn(), f = ue(), r = it(), m = c, k = T(!1), v = de(), o = T(Ut(0));
1368
+ async function g() {
1369
+ k.value = !0;
1382
1370
  try {
1383
1371
  await w(), await l.readStockBalance();
1384
1372
  } catch (t) {
@@ -1388,19 +1376,19 @@ const jn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Rn = {
1388
1376
  type: "error"
1389
1377
  }), console.log("failed at fetching item adjustment history", m.sku, o, t);
1390
1378
  } finally {
1391
- x.value = !1;
1379
+ k.value = !1;
1392
1380
  }
1393
1381
  }
1394
1382
  Me(() => {
1395
- h();
1383
+ g();
1396
1384
  }), ge([() => o.value, () => m.sku], () => {
1397
- h();
1385
+ g();
1398
1386
  });
1399
- const b = T([]), c = T([]), r = T(new Array());
1387
+ const h = T([]), i = T([]), a = T(new Array());
1400
1388
  function I(t, n) {
1401
1389
  return n === "day" ? Ct(t) : et(t);
1402
1390
  }
1403
- function U(t, n) {
1391
+ function R(t, n) {
1404
1392
  const p = t.reduce(
1405
1393
  (d, y) => {
1406
1394
  const _ = y.effectiveAt ?? Xe(y._id);
@@ -1422,30 +1410,30 @@ const jn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Rn = {
1422
1410
  St(new Date(o.value.startDate)).toISOString(),
1423
1411
  $t(new Date(o.value.endDate)).toISOString()
1424
1412
  );
1425
- b.value = t;
1413
+ h.value = t;
1426
1414
  const n = t.filter(({ ref: p }) => p == null ? void 0 : p.startsWith("bill_")).map(({ ref: p }) => p);
1427
- await V(n), c.value = U(t, "day").map(({ date: p, adjustments: d }) => ({
1415
+ await V(n), i.value = R(t, "day").map(({ date: p, adjustments: d }) => ({
1428
1416
  date: p,
1429
1417
  adjustments: d,
1430
- adjustmentsByTime: U(d, "minute")
1418
+ adjustmentsByTime: R(d, "minute")
1431
1419
  }));
1432
1420
  }
1433
1421
  async function V(t) {
1434
- t.length && (r.value = await g.findBillsById(t).catch((n) => {
1422
+ t.length && (a.value = await S.findBillsById(t).catch((n) => {
1435
1423
  var y;
1436
1424
  console.error("Error on using latest bill API, retrying using legacy api", n);
1437
- const p = ((y = a.currentBusiness.value) == null ? void 0 : y._id) ?? "", d = f.currentLocation.doc._id;
1438
- return g.findBillsByBusinessId(p, [d], t);
1425
+ const p = ((y = u.currentBusiness.value) == null ? void 0 : y._id) ?? "", d = f.currentLocation.doc._id;
1426
+ return S.findBillsByBusinessId(p, [d], t);
1439
1427
  }));
1440
1428
  }
1441
- const M = R(() => {
1442
- const t = b.value, n = m.sku;
1429
+ const M = U(() => {
1430
+ const t = h.value, n = m.sku;
1443
1431
  return Dn(t, n);
1444
- }), H = R(() => {
1445
- const t = b.value, n = m.sku;
1432
+ }), H = U(() => {
1433
+ const t = h.value, n = m.sku;
1446
1434
  return Mn(t, n);
1447
- }), P = R(() => {
1448
- const t = [...b.value].computeFirst((p) => {
1435
+ }), P = U(() => {
1436
+ const t = [...h.value].computeFirst((p) => {
1449
1437
  var y, _;
1450
1438
  const d = (_ = (y = p.skus) == null ? void 0 : y.find) == null ? void 0 : _.call(y, (F) => F.sku._id === m.sku._id);
1451
1439
  return d == null ? void 0 : d.fromBalance;
@@ -1457,8 +1445,8 @@ const jn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Rn = {
1457
1445
  value: t,
1458
1446
  precision: 4
1459
1447
  })} ${n.unit.abbrev}` : "";
1460
- }), L = R(() => {
1461
- const t = [...b.value].reverse().computeFirst((p) => {
1448
+ }), L = U(() => {
1449
+ const t = [...h.value].reverse().computeFirst((p) => {
1462
1450
  var y, _;
1463
1451
  const d = (_ = (y = p.skus) == null ? void 0 : y.find) == null ? void 0 : _.call(y, (F) => F.sku._id === m.sku._id);
1464
1452
  return d == null ? void 0 : d.toBalance;
@@ -1480,9 +1468,9 @@ const jn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Rn = {
1480
1468
  return "MYR";
1481
1469
  }
1482
1470
  }
1483
- const O = R(() => {
1471
+ const O = U(() => {
1484
1472
  var p;
1485
- const n = b.value.flatMap((d) => {
1473
+ const n = h.value.flatMap((d) => {
1486
1474
  var y;
1487
1475
  return ((y = d.skus) == null ? void 0 : y.flatMap((_) => _.amounts)) ?? [];
1488
1476
  }).filter((d) => d.amount.amount < 0).reduce(
@@ -1501,7 +1489,7 @@ const jn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Rn = {
1501
1489
  {
1502
1490
  amount: 0,
1503
1491
  precision: 0,
1504
- currency: z(((p = a.currentCountry) == null ? void 0 : p.value) ?? Ne)
1492
+ currency: z(((p = u.currentCountry) == null ? void 0 : p.value) ?? Ne)
1505
1493
  }
1506
1494
  );
1507
1495
  return Ae(n, !1, n.precision);
@@ -1513,9 +1501,9 @@ const jn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Rn = {
1513
1501
  endDate: n
1514
1502
  });
1515
1503
  }
1516
- const Q = R(() => {
1504
+ const Q = U(() => {
1517
1505
  var p;
1518
- const t = [...b.value].reverse().computeFirst((d) => {
1506
+ const t = [...h.value].reverse().computeFirst((d) => {
1519
1507
  var _, F;
1520
1508
  const y = (F = (_ = d.skus) == null ? void 0 : _.find) == null ? void 0 : F.call(_, (Y) => Y.sku._id === m.sku._id);
1521
1509
  return y == null ? void 0 : y.toCostBalances;
@@ -1525,7 +1513,7 @@ const jn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Rn = {
1525
1513
  amount: 0,
1526
1514
  precision: 0
1527
1515
  }),
1528
- currency: z(((p = a.currentCountry) == null ? void 0 : p.value) ?? Ne)
1516
+ currency: z(((p = u.currentCountry) == null ? void 0 : p.value) ?? Ne)
1529
1517
  } : "No data";
1530
1518
  });
1531
1519
  function se() {
@@ -1538,7 +1526,7 @@ const jn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Rn = {
1538
1526
  const X = Ie(m, "show");
1539
1527
  return (t, n) => {
1540
1528
  const p = $("FmButton"), d = $("FmField"), y = $("FmDateRangePicker"), _ = $("FmSpacer"), F = $("FmCircularProgress"), Y = $("FmIcon"), K = $("FmTooltip"), le = $("FmMenuDivider"), D = $("FmCardSection"), E = $("FmCard"), q = $("FmSideSheet");
1541
- return S(), N(q, {
1529
+ return x(), N(q, {
1542
1530
  "dismiss-away": "",
1543
1531
  modelValue: C(X),
1544
1532
  "onUpdate:modelValue": n[4] || (n[4] = (ee) => De(X) ? X.value = ee : null),
@@ -1548,7 +1536,7 @@ const jn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Rn = {
1548
1536
  "side-sheet-header": B(() => [
1549
1537
  e("div", jn, [
1550
1538
  e("div", Rn, A(t.sku.name) + " history", 1),
1551
- k(p, {
1539
+ b(p, {
1552
1540
  variant: "tertiary",
1553
1541
  "prepend-icon": "close",
1554
1542
  onClick: n[0] || (n[0] = (ee) => X.value = !1)
@@ -1561,7 +1549,7 @@ const jn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Rn = {
1561
1549
  e("div", Un, [
1562
1550
  e("div", In, [
1563
1551
  e("div", Tn, [
1564
- k(y, {
1552
+ b(y, {
1565
1553
  modelValue: o.value,
1566
1554
  "onUpdate:modelValue": n[1] || (n[1] = (G) => o.value = G),
1567
1555
  "show-predefined-range": "",
@@ -1570,12 +1558,12 @@ const jn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Rn = {
1570
1558
  "z-index": 50
1571
1559
  }, {
1572
1560
  "trigger-button": B(({ opened: G }) => [
1573
- k(d, {
1561
+ b(d, {
1574
1562
  "prepend-icon": "calendar_month",
1575
1563
  focused: G
1576
1564
  }, {
1577
1565
  default: B(() => [
1578
- de(A(o.value.startDate) + " - " + A(o.value.endDate), 1)
1566
+ ce(A(o.value.startDate) + " - " + A(o.value.endDate), 1)
1579
1567
  ]),
1580
1568
  _: 2
1581
1569
  }, 1032, ["focused"])
@@ -1583,27 +1571,27 @@ const jn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Rn = {
1583
1571
  _: 1
1584
1572
  }, 8, ["modelValue"])
1585
1573
  ]),
1586
- k(p, {
1574
+ b(p, {
1587
1575
  variant: "tertiary",
1588
1576
  onClick: n[2] || (n[2] = (G) => J()),
1589
1577
  "prepend-icon": "navigate_before"
1590
1578
  }),
1591
- k(p, {
1579
+ b(p, {
1592
1580
  variant: "tertiary",
1593
1581
  onClick: n[3] || (n[3] = (G) => se()),
1594
1582
  "prepend-icon": "navigate_next"
1595
1583
  })
1596
1584
  ]),
1597
- x.value ? (S(), j("div", Pn, [
1598
- k(_),
1599
- k(F, { size: "xl" }),
1585
+ k.value ? (x(), j("div", Pn, [
1586
+ b(_),
1587
+ b(F, { size: "xl" }),
1600
1588
  En,
1601
- k(_),
1602
- k(_)
1603
- ])) : c.value && ((ee = c.value) == null ? void 0 : ee.length) > 0 ? (S(), j("div", Hn, [
1604
- k(E, { variant: "outlined" }, {
1589
+ b(_),
1590
+ b(_)
1591
+ ])) : i.value && ((ee = i.value) == null ? void 0 : ee.length) > 0 ? (x(), j("div", Hn, [
1592
+ b(E, { variant: "outlined" }, {
1605
1593
  default: B(() => [
1606
- k(D, { class: "flex flex-col gap-4" }, {
1594
+ b(D, { class: "flex flex-col gap-4" }, {
1607
1595
  default: B(() => [
1608
1596
  Ln,
1609
1597
  e("div", Nn, [
@@ -1613,8 +1601,8 @@ const jn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Rn = {
1613
1601
  ]),
1614
1602
  e("div", qn, [
1615
1603
  e("div", Kn, [
1616
- de(" Total sales  "),
1617
- H.value != null ? (S(), N(K, {
1604
+ ce(" Total sales  "),
1605
+ H.value != null ? (x(), N(K, {
1618
1606
  key: 0,
1619
1607
  variant: "plain",
1620
1608
  placement: "top",
@@ -1622,7 +1610,7 @@ const jn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Rn = {
1622
1610
  "z-index": 50
1623
1611
  }, {
1624
1612
  default: B(() => [
1625
- k(Y, {
1613
+ b(Y, {
1626
1614
  name: "warning",
1627
1615
  size: "sm"
1628
1616
  })
@@ -1661,22 +1649,22 @@ const jn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Rn = {
1661
1649
  e("div", _o, A(L.value), 1)
1662
1650
  ])
1663
1651
  ]),
1664
- C(i).enableTotalCost ? (S(), j("div", yo, [
1665
- k(le, { class: "w-full" }),
1652
+ C(r).enableTotalCost ? (x(), j("div", yo, [
1653
+ b(le, { class: "w-full" }),
1666
1654
  e("div", go, [
1667
1655
  e("div", ho, [
1668
- k(ze, { "z-index": 50 }, {
1656
+ b(ze, { "z-index": 50 }, {
1669
1657
  default: B(() => [
1670
1658
  e("div", bo, [
1671
- de(" Estimated value "),
1672
- k(K, {
1659
+ ce(" Estimated value "),
1660
+ b(K, {
1673
1661
  variant: "plain",
1674
1662
  placement: "top",
1675
1663
  content: "Estimated value is calculated starting from last closing value.",
1676
1664
  "z-index": 50
1677
1665
  }, {
1678
1666
  default: B(() => [
1679
- k(Y, {
1667
+ b(Y, {
1680
1668
  name: "help",
1681
1669
  size: "sm"
1682
1670
  })
@@ -1690,11 +1678,11 @@ const jn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Rn = {
1690
1678
  e("div", ko, A(typeof Q.value != "string" ? C(Ae)(Q.value, !1, Q.value.precision) : Q.value), 1)
1691
1679
  ]),
1692
1680
  e("div", xo, [
1693
- k(ze, { "z-index": 50 }, {
1681
+ b(ze, { "z-index": 50 }, {
1694
1682
  default: B(() => [
1695
1683
  e("div", So, [
1696
1684
  $o,
1697
- k(K, {
1685
+ b(K, {
1698
1686
  variant: "plain",
1699
1687
  placement: "top",
1700
1688
  "z-index": 50
@@ -1703,7 +1691,7 @@ const jn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Rn = {
1703
1691
  wo
1704
1692
  ]),
1705
1693
  default: B(() => [
1706
- k(Y, {
1694
+ b(Y, {
1707
1695
  name: "help",
1708
1696
  size: "sm"
1709
1697
  })
@@ -1725,18 +1713,18 @@ const jn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Rn = {
1725
1713
  _: 1
1726
1714
  }),
1727
1715
  Co,
1728
- (S(!0), j(ne, null, re(c.value, (G) => (S(), j(ne, {
1716
+ (x(!0), j(ne, null, re(i.value, (G) => (x(), j(ne, {
1729
1717
  key: G.date
1730
1718
  }, [
1731
- t.sku ? (S(), N(Vn, {
1719
+ t.sku ? (x(), N(Vn, {
1732
1720
  key: 0,
1733
1721
  record: G,
1734
1722
  sku: t.sku,
1735
- bills: r.value
1723
+ bills: a.value
1736
1724
  }, null, 8, ["record", "sku", "bills"])) : Z("", !0)
1737
1725
  ], 64))), 128))
1738
- ])) : (S(), j("div", Bo, [
1739
- k(_),
1726
+ ])) : (x(), j("div", Bo, [
1727
+ b(_),
1740
1728
  e("div", null, [
1741
1729
  e("img", {
1742
1730
  src: C(It),
@@ -1745,8 +1733,8 @@ const jn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Rn = {
1745
1733
  ]),
1746
1734
  Vo,
1747
1735
  Do,
1748
- k(_),
1749
- k(_)
1736
+ b(_),
1737
+ b(_)
1750
1738
  ]))
1751
1739
  ])
1752
1740
  ];
@@ -1758,68 +1746,68 @@ const jn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Rn = {
1758
1746
  }), 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({
1759
1747
  __name: "StockRecalculateDialog",
1760
1748
  emits: ["close"],
1761
- setup(u, { emit: a }) {
1762
- const l = a, s = ue(), g = ve(), f = R(() => {
1763
- var c;
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);
1766
- Me(h);
1767
- async function h() {
1768
- i.value = !0;
1749
+ setup(c, { emit: u }) {
1750
+ const l = u, s = ue(), S = ve(), f = U(() => {
1751
+ var i;
1752
+ return ((i = s == null ? void 0 : s._currentLocation) == null ? void 0 : i.type) === Je.restaurant;
1753
+ }), r = T(null), m = T(!1), k = T(""), v = de(), o = T(null);
1754
+ Me(g);
1755
+ async function g() {
1756
+ r.value = !0;
1769
1757
  try {
1770
- const [c] = await Promise.all([
1771
- g.recalculation.getRecalculateAbility(),
1772
- new Promise((r) => setTimeout(r, 1e3))
1758
+ const [i] = await Promise.all([
1759
+ S.recalculation.getRecalculateAbility(),
1760
+ new Promise((a) => setTimeout(a, 1e3))
1773
1761
  ]);
1774
- m.value = c.canRecalculate, x.value = c.reason ?? "", o.value = c.lastClosing ? new Date(c.lastClosing) : null;
1762
+ m.value = i.canRecalculate, k.value = i.reason ?? "", o.value = i.lastClosing ? new Date(i.lastClosing) : null;
1775
1763
  } catch {
1776
1764
  v.open({
1777
1765
  type: "error",
1778
1766
  title: "Unable to fetch recalculate ability",
1779
1767
  message: "Please try again later."
1780
- }), x.value = "Something went wrong.";
1768
+ }), k.value = "Something went wrong.";
1781
1769
  } finally {
1782
- i.value = !1;
1770
+ r.value = !1;
1783
1771
  }
1784
1772
  }
1785
- function b() {
1773
+ function h() {
1786
1774
  l("close"), v.open({
1787
1775
  title: "Request submitted",
1788
1776
  message: "Please wait for 15 minutes for all the changes to be reflected."
1789
- }), g.recalculation.startRecalculateTask();
1777
+ }), S.recalculation.startRecalculateTask();
1790
1778
  }
1791
- return (c, r) => {
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, [
1779
+ return (i, a) => {
1780
+ const I = $("FmCircularProgress"), R = $("FmButton");
1781
+ return x(), j("div", jo, [
1782
+ f.value ? (x(), j("div", Ro, [
1783
+ r.value === null || r.value === !0 ? (x(), j("div", Uo, [
1796
1784
  e("div", Io, [
1797
1785
  e("div", null, [
1798
- k(I, { size: "lg" })
1786
+ b(I, { size: "lg" })
1799
1787
  ]),
1800
1788
  To
1801
1789
  ])
1802
- ])) : m.value ? (S(), j("div", Eo, [
1790
+ ])) : m.value ? (x(), j("div", Eo, [
1803
1791
  e("div", Ho, [
1804
1792
  e("div", Lo, [
1805
- de(" Last closing was at: "),
1793
+ ce(" Last closing was at: "),
1806
1794
  e("span", No, A(C(Bt)(o.value)), 1),
1807
- de(". You may submit a recalculation task to the backend for all adjustments after this date. ")
1795
+ ce(". You may submit a recalculation task to the backend for all adjustments after this date. ")
1808
1796
  ]),
1809
1797
  Oo
1810
1798
  ])
1811
- ])) : (S(), j("div", Po, A(x.value), 1))
1812
- ])) : (S(), j("div", Yo, "Cannot recalculate adjustment history on a non-restaurant outlet.")),
1799
+ ])) : (x(), j("div", Po, A(k.value), 1))
1800
+ ])) : (x(), j("div", Yo, "Cannot recalculate adjustment history on a non-restaurant outlet.")),
1813
1801
  e("div", zo, [
1814
- m.value ? (S(), N(U, {
1802
+ m.value ? (x(), N(R, {
1815
1803
  key: 0,
1816
1804
  label: "Submit",
1817
- onClick: b
1805
+ onClick: h
1818
1806
  })) : Z("", !0),
1819
- k(U, {
1807
+ b(R, {
1820
1808
  variant: "tertiary",
1821
1809
  label: "Close",
1822
- onClick: r[0] || (r[0] = (w) => l("close"))
1810
+ onClick: a[0] || (a[0] = (w) => l("close"))
1823
1811
  })
1824
1812
  ])
1825
1813
  ]);
@@ -1827,23 +1815,23 @@ const jn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Rn = {
1827
1815
  }
1828
1816
  }), 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({
1829
1817
  __name: "StockView",
1830
- setup(u) {
1831
- const a = Re(), l = ue(), s = Te(), g = _t(), {
1818
+ setup(c) {
1819
+ const u = Re(), l = ue(), s = Te(), S = _t(), {
1832
1820
  columnDefs: f,
1833
- stockHistoryProps: i,
1821
+ stockHistoryProps: r,
1834
1822
  convertSkuDialogProps: m,
1835
- adjustSkuDialogProps: x,
1823
+ adjustSkuDialogProps: k,
1836
1824
  showSkuHistory: v
1837
- } = Gt(c);
1838
- l.watchLocation(c);
1839
- const o = T(!1), h = me(), b = Ue();
1840
- async function c() {
1825
+ } = Gt(i);
1826
+ l.watchLocation(i);
1827
+ const o = T(!1), g = de(), h = Ue();
1828
+ async function i() {
1841
1829
  if (l._currentLocation) {
1842
1830
  o.value = !0;
1843
1831
  try {
1844
- await s.readStockBalance(), await s.readProductBalance(), await g.readStockEstimateBalance();
1832
+ await s.readStockBalance(), await s.readProductBalance(), await S.readStockEstimateBalance();
1845
1833
  } catch {
1846
- h.open({
1834
+ g.open({
1847
1835
  title: "Something went wrong",
1848
1836
  message: "Please refresh the page to retry.",
1849
1837
  type: "error"
@@ -1853,13 +1841,13 @@ const jn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Rn = {
1853
1841
  }
1854
1842
  }
1855
1843
  }
1856
- const r = R(
1857
- () => a.skus.map((P) => {
1844
+ const a = U(
1845
+ () => u.skus.map((P) => {
1858
1846
  var Q, se, X;
1859
1847
  const L = P.trackingMeasurement;
1860
1848
  let z = (se = (Q = s.stockBalance.skus) == null ? void 0 : Q.find(
1861
1849
  (t) => t.id === P._id
1862
- )) == null ? void 0 : se.balance, O = g.inventoryForecast.skus.find(
1850
+ )) == null ? void 0 : se.balance, O = S.inventoryForecast.skus.find(
1863
1851
  (t) => t.id === P._id
1864
1852
  );
1865
1853
  return {
@@ -1872,7 +1860,7 @@ const jn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Rn = {
1872
1860
  trackingUnitAbbrev: L ? ((X = P.unit.measurements.find((t) => t.id === L)) == null ? void 0 : X.abbrev) ?? "" : P.unit.abbrev
1873
1861
  };
1874
1862
  })
1875
- ), I = T(""), { breakpoints: U } = ut(), w = R(() => U.value.xs || U.value.sm ? 10 : 20), V = mt(), M = R(() => {
1863
+ ), I = T(""), { breakpoints: R } = ut(), w = U(() => R.value.xs || R.value.sm ? 10 : 20), V = mt(), M = U(() => {
1876
1864
  var L;
1877
1865
  return ((L = l._currentLocation) == null ? void 0 : L.type) === Je.restaurant ? [
1878
1866
  {
@@ -1888,12 +1876,12 @@ const jn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Rn = {
1888
1876
  ] : [];
1889
1877
  });
1890
1878
  function H() {
1891
- b.open({
1879
+ h.open({
1892
1880
  title: "Recalculate stock",
1893
1881
  contentComponent: qo,
1894
1882
  contentComponentProps: {
1895
1883
  onClose() {
1896
- b.close();
1884
+ h.close();
1897
1885
  }
1898
1886
  },
1899
1887
  overlay: !0,
@@ -1902,32 +1890,32 @@ const jn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Rn = {
1902
1890
  }
1903
1891
  return (P, L) => {
1904
1892
  const z = $("FmTableToolbar"), O = $("FmMenuDivider"), J = $("FmTable");
1905
- return S(), N(lt, { title: "Stock" }, {
1893
+ return x(), N(lt, { title: "Stock" }, {
1906
1894
  default: B(() => {
1907
1895
  var Q, se, X, t;
1908
1896
  return [
1909
1897
  e("div", Ko, [
1910
1898
  e("div", Go, [
1911
1899
  e("div", Wo, [
1912
- k(yt)
1900
+ b(yt)
1913
1901
  ]),
1914
1902
  e("div", Jo, [
1915
- k(z, {
1903
+ b(z, {
1916
1904
  searchable: "",
1917
1905
  "search-model": I.value,
1918
1906
  "onUpdate:searchModel": L[0] || (L[0] = (n) => I.value = n),
1919
1907
  actions: [{ label: "Export", icon: "ios_share", key: "export" }, ...M.value],
1920
- "onClick:actionExport": L[1] || (L[1] = (n) => C(Ht)(r.value)),
1921
- "onClick:actionRefresh": c,
1908
+ "onClick:actionExport": L[1] || (L[1] = (n) => C(Ht)(a.value)),
1909
+ "onClick:actionRefresh": i,
1922
1910
  "onClick:actionRecalculate": H
1923
1911
  }, null, 8, ["search-model", "actions"]),
1924
- k(O, { class: "hidden xs:block" })
1912
+ b(O, { class: "hidden xs:block" })
1925
1913
  ])
1926
1914
  ]),
1927
- (S(), N(J, {
1915
+ (x(), N(J, {
1928
1916
  style: Ge(C(V).tableHeight),
1929
1917
  "column-defs": C(f),
1930
- "row-data": r.value,
1918
+ "row-data": a.value,
1931
1919
  "search-value": I.value,
1932
1920
  loading: o.value || !C(l)._currentLocation,
1933
1921
  key: (Q = C(l)._currentLocation) == null ? void 0 : Q.dbName,
@@ -1935,7 +1923,7 @@ const jn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Rn = {
1935
1923
  "page-size": w.value
1936
1924
  }, {
1937
1925
  "list-row": B((n) => [
1938
- k(dt, {
1926
+ b(dt, {
1939
1927
  row: n,
1940
1928
  onRowClick: C(v)
1941
1929
  }, {
@@ -1945,25 +1933,25 @@ const jn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Rn = {
1945
1933
  e("div", Qo, [
1946
1934
  e("div", Xo, [
1947
1935
  e("div", Zo, [
1948
- k(C(Oe), {
1936
+ b(C(Oe), {
1949
1937
  render: (_ = (y = (d = p.code) == null ? void 0 : d.column) == null ? void 0 : y.columnDef) == null ? void 0 : _.cell,
1950
1938
  props: (Y = (F = p.code) == null ? void 0 : F.getContext) == null ? void 0 : Y.call(F)
1951
1939
  }, null, 8, ["render", "props"])
1952
1940
  ]),
1953
1941
  e("div", es, [
1954
- k(C(Oe), {
1942
+ b(C(Oe), {
1955
1943
  render: (D = (le = (K = p.name) == null ? void 0 : K.column) == null ? void 0 : le.columnDef) == null ? void 0 : D.cell,
1956
1944
  props: (q = (E = p.name) == null ? void 0 : E.getContext) == null ? void 0 : q.call(E)
1957
1945
  }, null, 8, ["render", "props"])
1958
1946
  ])
1959
1947
  ]),
1960
1948
  e("div", null, [
1961
- k(ot, {
1949
+ b(ot, {
1962
1950
  days: n.original.day
1963
1951
  }, null, 8, ["days"])
1964
1952
  ]),
1965
1953
  e("div", null, [
1966
- k(nt, {
1954
+ b(nt, {
1967
1955
  class: "xs:w-[160px]",
1968
1956
  unit: n.original.unit,
1969
1957
  sku: n.original,
@@ -1980,10 +1968,10 @@ const jn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Rn = {
1980
1968
  _: 1
1981
1969
  }, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"]))
1982
1970
  ]),
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)
1971
+ (x(), N(at, { to: "body" }, [
1972
+ (se = C(r)) != null && se.sku ? (x(), N(Mo, Se($e({ key: 0 }, C(r))), null, 16)) : Z("", !0),
1973
+ (X = C(m)) != null && X.sku ? (x(), N(cn, Se($e({ key: 1 }, C(m))), null, 16)) : Z("", !0),
1974
+ (t = C(k)) != null && t.stock ? (x(), N(gn, Se($e({ key: 2 }, C(k))), null, 16)) : Z("", !0)
1987
1975
  ]))
1988
1976
  ];
1989
1977
  }),