@feedmepos/mf-inventory-portal 1.2.10-dev.3 → 1.2.10-dev.4

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 (52) hide show
  1. package/dist/{App-D9otYMgh.js → App-DE0rygXX.js} +1 -1
  2. package/dist/{ApprovalView-Bue46U6e.js → ApprovalView-9H9G2OWv.js} +17 -17
  3. package/dist/{BindingsDialog-Xleskmvg.js → BindingsDialog-BjXHdsGH.js} +2 -2
  4. package/dist/{BindingsPicker-BeNF1NcZ.js → BindingsPicker-BijILjQH.js} +4 -4
  5. package/dist/{BindingsTable-ecWz3SHk.js → BindingsTable-DlSpPTRi.js} +1 -1
  6. package/dist/{ClosingDraftView-DkxOW9Ns.js → ClosingDraftView-BaDkJuyF.js} +123 -123
  7. package/dist/{ClosingTemplateView-BbnpVNYF.js → ClosingTemplateView-CdESDzwA.js} +26 -26
  8. package/dist/{DeliveryOrderPrintPreview-CH-IzSM9.js → DeliveryOrderPrintPreview-Bwrd33F_.js} +9 -9
  9. package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-DOR_Iu0w.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-QlB_K9Yi.js} +16 -16
  10. package/dist/{FmMultiselectDialog-DBgk0_mV.js → FmMultiselectDialog-CLxZbi3l.js} +4 -4
  11. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-DdxSlJRz.js → FmUnitInput.vue_vue_type_script_setup_true_lang-B6TbIvQI.js} +43 -43
  12. package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-C22gncaQ.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-CtLFZtQZ.js} +7 -7
  13. package/dist/{IngredientGroupView-CrNLRll8.js → IngredientGroupView-DXQ2TKjI.js} +13 -13
  14. package/dist/IngredientsView-FLCGHbsn.js +2467 -0
  15. package/dist/{IntegrationView-DRwnqCf9.js → IntegrationView-BKI0tf68.js} +24 -25
  16. package/dist/{InventoryBindingForm-DU6B0J0B.js → InventoryBindingForm-BGov_1MJ.js} +1 -1
  17. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-CLCDb25h.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-4IM7dQuV.js} +12 -12
  18. package/dist/{InventoryBindingSummary-BH2bWICt.js → InventoryBindingSummary-BQA0Sm_K.js} +1 -1
  19. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-BD2hneTA.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-Bc5diF2E.js} +1 -1
  20. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-GabOf_-7.js → PremiumBadge.vue_vue_type_script_setup_true_lang-s529wQrr.js} +1 -1
  21. package/dist/{PublishView-B510iDYx.js → PublishView-DhZ5eMg0.js} +19 -19
  22. package/dist/{PurchaseOrderPrintPreview-Cbsl8gcZ.js → PurchaseOrderPrintPreview-cMNE8VTL.js} +7 -7
  23. package/dist/{ReceiveRequestView-rKyNjRbk.js → ReceiveRequestView-Cv-Cgi_o.js} +80 -80
  24. package/dist/{RecipeView-C9dw-1_E.js → RecipeView-ipT51Tbl.js} +39 -39
  25. package/dist/{StockView-scnHVHGB.js → StockView-CKok9_oG.js} +833 -830
  26. package/dist/SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-BnAwlQE1.js +172 -0
  27. package/dist/{SupplierView-to6stKYV.js → SupplierView-cGpKVDGP.js} +4 -4
  28. package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-laVp-HrL.js → TransferDetails.vue_vue_type_script_setup_true_lang-0ule7sK7.js} +11 -12
  29. package/dist/{TransferTemplateView-VOgIhPGW.js → TransferTemplateView-DrlLa0ed.js} +109 -109
  30. package/dist/{UnitView-sr5QkKex.js → UnitView-YFAtJ0CL.js} +16 -16
  31. package/dist/{WarehouseView-CB3luO1P.js → WarehouseView-CV5pg-4p.js} +16 -16
  32. package/dist/{app-BpyxIAaY.js → app-CUMtg_U0.js} +8610 -8548
  33. package/dist/app.js +1 -1
  34. package/dist/{closing-template-CEJaVQKn.js → closing-template-Cyva214n.js} +1 -1
  35. package/dist/components/FmInventoryTableToolbar.vue.d.ts +7 -0
  36. package/dist/components/netsuite/ItemSubsidiaryTreeDialog.vue.d.ts +16 -0
  37. package/dist/{decimal-Dqff6QMJ.js → decimal-117ZlAfM.js} +1 -1
  38. package/dist/{format-unit-display-DcORb0K7.js → format-unit-display-BXHj4DAV.js} +3 -3
  39. package/dist/{index-CFfIlNHC.js → index-Da1f9OoS.js} +1 -1
  40. package/dist/{index-rTyWq-0n.js → index-PWnt_za9.js} +1 -1
  41. package/dist/{purchase-order-template-BFPrzfeR.js → purchase-order-template-AWsxLxPR.js} +1 -1
  42. package/dist/{stock-CkgmiPOr.js → stock-D7EiEqJe.js} +1 -1
  43. package/dist/stores/integration/netsuite.d.ts +25 -3
  44. package/dist/style.css +1 -1
  45. package/dist/{supplier-Db_-hKgm.js → supplier-DQmyhp0R.js} +1 -1
  46. package/dist/tsconfig.app.tsbuildinfo +1 -1
  47. package/dist/{use-ingredient-select-dialog-CEEFJa9x.js → use-ingredient-select-dialog-C37DLY6c.js} +4 -4
  48. package/dist/{use-inventory-binding-dialog-C6Ev4777.js → use-inventory-binding-dialog-CmZereh8.js} +1 -1
  49. package/package.json +2 -2
  50. package/dist/FmAdminBadge-D4rqYlKu.js +0 -44
  51. package/dist/IngredientsView-DLK0Seww.js +0 -2319
  52. package/dist/SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-Dt1S8tTH.js +0 -158
@@ -1,27 +1,26 @@
1
- import { defineComponent as ce, ref as N, computed as H, resolveComponent as I, openBlock as F, createBlock as K, withCtx as j, createElementVNode as e, normalizeClass as he, toDisplayString as b, createVNode as g, createElementBlock as O, Fragment as Z, renderList as ie, unref as u, h as fe, watch as xe, isRef as Ue, createCommentVNode as te, reactive as ut, mergeModels as Ye, useModel as ct, onMounted as Ee, createTextVNode as ue, normalizeStyle as Ze, Teleport as dt, normalizeProps as Ae, mergeProps as Ve } from "vue";
2
- import { u as pe, a1 as mt, f as He, h as pt, a as Pe, F as Ke, a2 as vt, w as je, k as me, Y as ft, t as Se, a0 as Fe, A as yt, M as _t, $ as ye, a3 as bt, a4 as ne, a5 as kt, a6 as Ge, o as gt, s as ht, a7 as xt, a8 as St, a9 as Ft, aa as Ce, ab as wt, ac as et, Z as X, ad as $t, z as tt, ae as ke, af as At, ag as Vt, q as Me, n as We, r as Ct, c as Mt, ah as Bt, ai as Dt, aj as It, ak as jt, al as Tt, b as Ut, N as Et, J as Ht, K as Pt, L as Rt, O as Ot, P as Nt, Q as qe } from "./app-BpyxIAaY.js";
3
- import { u as Re, a as _e } from "./stock-CkgmiPOr.js";
4
- import { g as we } from "./decimal-Dqff6QMJ.js";
5
- import { e as Lt, u as nt, i as ot, _ as Xe } from "./PremiumBadge.vue_vue_type_script_setup_true_lang-GabOf_-7.js";
6
- import { _ as Te, S as Be, g as st, a as zt } from "./SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-Dt1S8tTH.js";
1
+ import { defineComponent as ce, ref as N, computed as H, resolveComponent as D, openBlock as F, createBlock as K, withCtx as I, createElementVNode as e, normalizeClass as he, toDisplayString as _, createVNode as k, createElementBlock as O, Fragment as Z, renderList as ie, unref as u, h as pe, watch as xe, isRef as Ue, createCommentVNode as te, reactive as ut, mergeModels as Ge, useModel as ct, onMounted as Ee, createTextVNode as ue, normalizeStyle as tt, Teleport as dt, normalizeProps as Ae, mergeProps as Ve } from "vue";
2
+ import { u as ve, a2 as mt, f as He, h as Pe, i as pt, a as Re, F as We, a3 as vt, x as je, l as me, Z as ft, t as Se, a1 as Fe, A as yt, M as _t, a0 as ye, a4 as bt, a5 as ne, a6 as kt, a7 as qe, p as gt, v as ht, a8 as xt, a9 as St, aa as Ft, ab as Ce, ac as wt, ad as nt, $ as X, ae as $t, B as ot, af as ke, ag as At, ah as Vt, r as Be, o as Xe, s as Ct, c as Bt, ai as Mt, aj as Dt, ak as It, al as jt, am as Tt, b as Ut, N as Et, K as Ht, L as Pt, O as Rt, P as Ot, Q as Nt, T as Qe } from "./app-CUMtg_U0.js";
3
+ import { u as Oe, a as _e } from "./stock-D7EiEqJe.js";
4
+ import { g as we } from "./decimal-117ZlAfM.js";
5
+ import { e as Lt, u as st, i as at, _ as Je } from "./PremiumBadge.vue_vue_type_script_setup_true_lang-s529wQrr.js";
6
+ import { _ as Te, S as Me, g as lt, a as zt } from "./SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-BnAwlQE1.js";
7
7
  import { _ as Yt } from "./PreviewBadge.vue_vue_type_script_setup_true_lang-CRZiQHjx.js";
8
- import { useI18n as de, useCoreStore as at } from "@feedmepos/mf-common";
9
- import { useSnackbar as be, useDialog as Oe, useProxiedModel as Ne, useBreakpoints as Kt } from "@feedmepos/ui-library";
8
+ import { useI18n as de, useCoreStore as Ne } from "@feedmepos/mf-common";
9
+ import { useSnackbar as be, useDialog as Le, useProxiedModel as ze, useBreakpoints as Kt } from "@feedmepos/ui-library";
10
10
  import { defineStore as Gt } from "pinia";
11
- import { u as Wt } from "./use-inventory-binding-dialog-C6Ev4777.js";
12
- import { _ as qt } from "./NumberPrecisionInput.vue_vue_type_script_setup_true_lang-BD2hneTA.js";
11
+ import { u as Wt } from "./use-inventory-binding-dialog-CmZereh8.js";
12
+ import { _ as qt } from "./NumberPrecisionInput.vue_vue_type_script_setup_true_lang-Bc5diF2E.js";
13
13
  import { E as Xt } from "./empty-placeholder-wf6-BWE8.js";
14
- import { F as lt } from "./FmAdminBadge-D4rqYlKu.js";
15
14
  import "./array-Ca8T3f_G.js";
16
- var ge = /* @__PURE__ */ ((k) => (k.History = "History", k.Convert = "Convert", k.Adjust = "Adjust", k))(ge || {});
17
- const Jt = [
15
+ var ge = /* @__PURE__ */ ((b) => (b.History = "History", b.Convert = "Convert", b.Adjust = "Adjust", b))(ge || {});
16
+ const Qt = [
18
17
  {
19
18
  translationKey: "inventory.stock.action.history",
20
19
  color: "text-neutral-700",
21
20
  value: "History"
22
21
  /* History */
23
22
  }
24
- ], Qt = [
23
+ ], Jt = [
25
24
  {
26
25
  translationKey: "inventory.stock.action.history",
27
26
  color: "text-neutral-700",
@@ -41,8 +40,8 @@ const Jt = [
41
40
  /* Adjust */
42
41
  }
43
42
  ];
44
- async function Zt(k) {
45
- const c = `${(pe().currentLocation.name || "").replace(
43
+ async function Zt(b) {
44
+ const p = `${(ve().currentLocation.name || "").replace(
46
45
  / /g,
47
46
  "_"
48
47
  )}_${mt().format("DD_MM_YYYY_HHmm")}.xlsx`;
@@ -50,7 +49,7 @@ async function Zt(k) {
50
49
  [
51
50
  {
52
51
  name: "stock",
53
- data: k,
52
+ data: b,
54
53
  columns: [
55
54
  {
56
55
  name: "Code",
@@ -62,37 +61,37 @@ async function Zt(k) {
62
61
  },
63
62
  {
64
63
  name: "Balance",
65
- selector: (s) => {
66
- const $ = $e(s, s.unit);
67
- return $.type === "unit" ? we(s.balance, s.unit, null, !1) : we(s.balance, s.unit, $.measurement, !1);
64
+ selector: (o) => {
65
+ const j = $e(o, o.unit);
66
+ return j.type === "unit" ? we(o.balance, o.unit, null, !1) : we(o.balance, o.unit, j.measurement, !1);
68
67
  }
69
68
  },
70
69
  {
71
70
  name: "Unit",
72
- selector: (s) => {
73
- var d;
74
- const $ = $e(s, s.unit);
75
- return $.type === "unit" ? s.unit.abbrev : ((d = s.unit.measurements.find((m) => m.id === $.measurement)) == null ? void 0 : d.abbrev) || "";
71
+ selector: (o) => {
72
+ var h;
73
+ const j = $e(o, o.unit);
74
+ return j.type === "unit" ? o.unit.abbrev : ((h = o.unit.measurements.find((d) => d.id === j.measurement)) == null ? void 0 : h.abbrev) || "";
76
75
  }
77
76
  }
78
77
  ]
79
78
  }
80
79
  ],
81
- c
80
+ p
82
81
  );
83
82
  }
84
- function $e(k, h) {
85
- const c = localStorage.getItem(`uom:${k._id}`);
86
- return c ? c === h._id ? {
83
+ function $e(b, g) {
84
+ const p = localStorage.getItem(`uom:${b._id}`);
85
+ return p ? p === g._id ? {
87
86
  type: "unit"
88
- } : h.measurements.find((s) => s.id === c) ? {
87
+ } : g.measurements.find((o) => o.id === p) ? {
89
88
  type: "measurement",
90
- measurement: c
89
+ measurement: p
91
90
  } : {
92
91
  type: "unit"
93
- } : k.trackingMeasurement && h.measurements.find((s) => s.id === k.trackingMeasurement) ? {
92
+ } : b.trackingMeasurement && g.measurements.find((o) => o.id === b.trackingMeasurement) ? {
94
93
  type: "measurement",
95
- measurement: k.trackingMeasurement
94
+ measurement: b.trackingMeasurement
96
95
  } : {
97
96
  type: "unit"
98
97
  };
@@ -105,63 +104,63 @@ const en = { class: "fm-typo-en-body-md-400 flex-grow" }, rt = /* @__PURE__ */ c
105
104
  amount: {},
106
105
  defaultTrackingMeasurement: {}
107
106
  },
108
- setup(k) {
109
- function h(B) {
110
- return `uom:${B._id}`;
107
+ setup(b) {
108
+ function g(C) {
109
+ return `uom:${C._id}`;
111
110
  }
112
- function c(B) {
113
- const i = h(s.sku);
114
- B ? localStorage.setItem(i, B) : localStorage.setItem(i, s.unit._id), $.value = $e(s.sku, s.unit);
111
+ function p(C) {
112
+ const c = g(o.sku);
113
+ C ? localStorage.setItem(c, C) : localStorage.setItem(c, o.unit._id), j.value = $e(o.sku, o.unit);
115
114
  }
116
- const s = k, $ = N($e(s.sku, s.unit)), d = H(() => {
117
- const { measurements: B } = s.unit;
115
+ const o = b, j = N($e(o.sku, o.unit)), h = H(() => {
116
+ const { measurements: C } = o.unit;
118
117
  return [
119
118
  {
120
- label: `${we(s.amount, s.unit)}`,
119
+ label: `${we(o.amount, o.unit)}`,
121
120
  value: null
122
121
  },
123
- ...B.map(({ id: i }) => ({
124
- label: `${we(s.amount, s.unit, i)}`,
125
- value: i
122
+ ...C.map(({ id: c }) => ({
123
+ label: `${we(o.amount, o.unit, c)}`,
124
+ value: c
126
125
  }))
127
126
  ];
128
127
  });
129
- function m({ value: B }) {
130
- return u($).type === "unit" ? B === null : B === u($).measurement;
128
+ function d({ value: C }) {
129
+ return u(j).type === "unit" ? C === null : C === u(j).measurement;
131
130
  }
132
- const v = H(
131
+ const i = H(
133
132
  () => {
134
- var B;
135
- return ((B = d.value.find((i) => m(i))) == null ? void 0 : B.label) ?? "";
133
+ var C;
134
+ return ((C = h.value.find((c) => d(c))) == null ? void 0 : C.label) ?? "";
136
135
  }
137
- ), S = N(!1);
138
- return (B, i) => {
139
- const l = I("FmIcon"), y = I("FmMenuItem"), C = I("FmMenu");
140
- return F(), K(C, {
136
+ ), x = N(!1);
137
+ return (C, c) => {
138
+ const l = D("FmIcon"), v = D("FmMenuItem"), $ = D("FmMenu");
139
+ return F(), K($, {
141
140
  "stop-click-propagation": "",
142
- onMenuChanged: i[0] || (i[0] = (A) => S.value = A)
141
+ onMenuChanged: c[0] || (c[0] = (A) => x.value = A)
143
142
  }, {
144
- "menu-button": j(() => [
143
+ "menu-button": I(() => [
145
144
  e("button", {
146
145
  type: "button",
147
146
  class: he([
148
147
  "w-full text-left flex items-center gap-8 cursor-pointer fm-corner-radius-sm px-8 py-4 border bg-white",
149
- S.value ? "border-fm-color-primary" : "border-fm-color-neutral-gray-100"
148
+ x.value ? "border-fm-color-primary" : "border-fm-color-neutral-gray-100"
150
149
  ])
151
150
  }, [
152
- e("div", en, b(v.value), 1),
153
- g(l, {
151
+ e("div", en, _(i.value), 1),
152
+ k(l, {
154
153
  class: "text-fm-color-neutral-gray-400",
155
154
  name: "expand_more"
156
155
  })
157
156
  ], 2)
158
157
  ]),
159
- default: j(() => [
160
- (F(!0), O(Z, null, ie(d.value, (A) => (F(), K(y, {
158
+ default: I(() => [
159
+ (F(!0), O(Z, null, ie(h.value, (A) => (F(), K(v, {
161
160
  key: A.value ?? 0,
162
161
  label: A.label,
163
- "model-value": m(A),
164
- onClick: (V) => c(A.value)
162
+ "model-value": d(A),
163
+ onClick: (V) => p(A.value)
165
164
  }, null, 8, ["label", "model-value", "onClick"]))), 128))
166
165
  ]),
167
166
  _: 1
@@ -170,89 +169,89 @@ const en = { class: "fm-typo-en-body-md-400 flex-grow" }, rt = /* @__PURE__ */ c
170
169
  }
171
170
  }), tn = { class: "whitespace-nowrap" }, nn = /* @__PURE__ */ ce({
172
171
  __name: "StockHeaderPreview",
173
- setup(k) {
174
- const { t: h } = de();
175
- return (c, s) => (F(), K(Yt, null, {
176
- default: j(() => [
177
- e("div", tn, b(u(h)("inventory.stock.prediction.daysRemaining")), 1)
172
+ setup(b) {
173
+ const { t: g } = de();
174
+ return (p, o) => (F(), K(Yt, null, {
175
+ default: I(() => [
176
+ e("div", tn, _(u(g)("inventory.stock.prediction.daysRemaining")), 1)
178
177
  ]),
179
178
  _: 1
180
179
  }));
181
180
  }
182
181
  }), it = Gt("stockActions", () => {
183
- const k = N(!1), h = pe(), c = Re(), s = nt(), $ = be(), d = Oe(), { t: m } = de();
184
- async function v() {
185
- if (h._currentLocation) {
186
- k.value = !0;
182
+ const b = N(!1), g = ve(), p = Oe(), o = st(), j = be(), h = Le(), { t: d } = de();
183
+ async function i() {
184
+ if (g._currentLocation) {
185
+ b.value = !0;
187
186
  try {
188
- await c.readStockBalance(), await c.readProductBalance(), await s.readStockEstimateBalance();
187
+ await p.readStockBalance(), await p.readProductBalance(), await o.readStockEstimateBalance();
189
188
  } catch {
190
- $.open({
191
- title: m("inventory.stock.error.title"),
192
- message: m("inventory.stock.error.message"),
189
+ j.open({
190
+ title: d("inventory.stock.error.title"),
191
+ message: d("inventory.stock.error.message"),
193
192
  type: "error"
194
193
  });
195
194
  } finally {
196
- k.value = !1;
195
+ b.value = !1;
197
196
  }
198
197
  }
199
198
  }
200
- const S = N();
201
- async function B(V) {
202
- var M, D, E;
203
- if (!!!((D = (M = V.convert) == null ? void 0 : M.inventoryBindings) != null && D.length)) {
204
- d.open({
205
- title: m("inventory.stock.error.convert.title"),
206
- message: m("inventory.stock.error.convert.message")
199
+ const x = N();
200
+ async function C(V) {
201
+ var B, M, E;
202
+ if (!!!((M = (B = V.convert) == null ? void 0 : B.inventoryBindings) != null && M.length)) {
203
+ h.open({
204
+ title: d("inventory.stock.error.convert.title"),
205
+ message: d("inventory.stock.error.convert.message")
207
206
  });
208
207
  return;
209
208
  }
210
209
  const w = {
211
- maxCount: ((E = c.productBalance.find(({ id: P }) => P === V._id)) == null ? void 0 : E.count) || 0,
210
+ maxCount: ((E = p.productBalance.find(({ id: P }) => P === V._id)) == null ? void 0 : E.count) || 0,
212
211
  sku: V,
213
212
  show: !0,
214
213
  "onUpdate:show"(P) {
215
- S.value.show = P;
214
+ x.value.show = P;
216
215
  },
217
216
  onSubmitted() {
218
- v();
217
+ i();
219
218
  }
220
219
  };
221
- S.value = w;
220
+ x.value = w;
222
221
  }
223
- const i = N();
222
+ const c = N();
224
223
  async function l(V) {
225
224
  const n = {
226
225
  stock: V,
227
226
  show: !0,
228
227
  "onUpdate:show"(r) {
229
- i.value.show = r;
228
+ c.value.show = r;
230
229
  },
231
230
  onSubmitted() {
232
- v();
231
+ i();
233
232
  }
234
233
  };
235
- i.value = n;
234
+ c.value = n;
236
235
  }
237
- const y = N();
238
- async function C(V) {
236
+ const v = N();
237
+ async function $(V) {
239
238
  const n = {
240
239
  sku: V,
241
240
  show: !0,
242
241
  "onUpdate:show"(r) {
243
- y.value.show = r;
242
+ v.value.show = r;
244
243
  }
245
244
  };
246
- y.value = n;
245
+ v.value = n;
247
246
  }
248
247
  function A(V, n) {
249
248
  const r = He(n);
250
249
  switch (V) {
251
250
  case ge.History:
252
- C(r);
251
+ $(r);
253
252
  return;
254
253
  case ge.Convert:
255
- B(r);
254
+ C(r);
256
255
  return;
257
256
  case ge.Adjust:
258
257
  l(r);
@@ -260,90 +259,93 @@ const en = { class: "fm-typo-en-body-md-400 flex-grow" }, rt = /* @__PURE__ */ c
260
259
  }
261
260
  }
262
261
  return {
263
- fetchStockBalance: v,
262
+ fetchStockBalance: i,
264
263
  onActionMenu: A,
265
- stockHistoryProps: y,
266
- showSkuHistory: C,
267
- convertSkuDialogProps: S,
268
- adjustSkuDialogProps: i
264
+ stockHistoryProps: v,
265
+ showSkuHistory: $,
266
+ convertSkuDialogProps: x,
267
+ adjustSkuDialogProps: c
269
268
  };
270
269
  });
271
270
  function on() {
272
- const k = pe(), h = it(), { t: c } = de();
271
+ var h;
272
+ const b = ve(), g = it(), p = Ne(), { t: o } = de();
273
273
  return {
274
274
  columnDefs: [
275
275
  {
276
276
  accessorKey: "code",
277
- header: () => c("inventory.stock.code"),
277
+ header: () => o("inventory.stock.code"),
278
278
  enableSorting: !0,
279
279
  size: 300
280
280
  },
281
281
  {
282
282
  accessorKey: "name",
283
- header: () => c("inventory.stock.product"),
283
+ header: () => o("inventory.stock.product"),
284
284
  enableSorting: !0,
285
285
  size: "auto"
286
286
  },
287
287
  {
288
288
  id: "UOM",
289
- header: () => c("inventory.stock.balance"),
290
- cell($) {
291
- const d = $.row.original, m = {
292
- unit: d.unit,
293
- sku: d,
294
- amount: d.balance,
295
- defaultTrackingMeasurement: d.trackingMeasurement ?? void 0
289
+ header: () => o("inventory.stock.balance"),
290
+ cell(d) {
291
+ const i = d.row.original, x = {
292
+ unit: i.unit,
293
+ sku: i,
294
+ amount: i.balance,
295
+ defaultTrackingMeasurement: i.trackingMeasurement ?? void 0
296
296
  };
297
- return fe(rt, m);
297
+ return pe(rt, x);
298
298
  },
299
299
  size: 180
300
300
  },
301
- {
302
- accessorKey: "isInactive",
303
- header: () => c("inventory.ingredient.status.title"),
304
- cell($) {
305
- const d = $.row.original.isInactive;
306
- return fe(
307
- "span",
308
- {
309
- class: [
310
- "inline-block px-3 py-1 rounded-full text-xs font-semibold",
311
- d ? "bg-red-100 text-red-700" : "bg-green-100 text-green-700"
312
- ].join(" ")
313
- },
314
- c(d ? "inventory.ingredient.status.inactive" : "inventory.ingredient.status.active")
315
- );
316
- },
317
- enableSorting: !0
318
- },
301
+ ...(h = p.sessionUser.value) != null && h.role.isAdmin ? [
302
+ {
303
+ accessorKey: "isInactive",
304
+ header: () => pe(Pe, {}, () => `${o("inventory.ingredient.status.title")}`),
305
+ cell(d) {
306
+ const i = d.row.original.isInactive;
307
+ return pe(
308
+ "span",
309
+ {
310
+ class: [
311
+ "inline-block px-3 py-1 rounded-full text-xs font-semibold",
312
+ i ? "bg-red-100 text-red-700" : "bg-green-100 text-green-700"
313
+ ].join(" ")
314
+ },
315
+ o(i ? "inventory.ingredient.status.inactive" : "inventory.ingredient.status.active")
316
+ );
317
+ },
318
+ enableSorting: !0
319
+ }
320
+ ] : [],
319
321
  {
320
322
  accessorKey: "day",
321
323
  id: "expireDate",
322
- header: () => fe(nn),
324
+ header: () => pe(nn),
323
325
  enableSorting: !0,
324
326
  sortUndefined: "last",
325
- cell($) {
326
- var i, l;
327
- const d = $.row.original.day, m = (i = $.row.original.thresholds) == null ? void 0 : i.low, v = (l = $.row.original.thresholds) == null ? void 0 : l.mid;
328
- if (typeof d != "number" || typeof m != "number" || typeof v != "number")
329
- return fe(Te, {
330
- days: d
327
+ cell(d) {
328
+ var v, $;
329
+ const i = d.row.original.day, x = (v = d.row.original.thresholds) == null ? void 0 : v.low, C = ($ = d.row.original.thresholds) == null ? void 0 : $.mid;
330
+ if (typeof i != "number" || typeof x != "number" || typeof C != "number")
331
+ return pe(Te, {
332
+ days: i
331
333
  });
332
- const S = d <= m ? Be.low : d <= v ? Be.mid : Be.high;
333
- return fe(Te, {
334
- days: d,
335
- level: S
334
+ const c = i <= x ? Me.low : i <= C ? Me.mid : Me.high;
335
+ return pe(Te, {
336
+ days: i,
337
+ level: c
336
338
  });
337
339
  },
338
340
  size: 200
339
341
  },
340
342
  {
341
343
  id: "action",
342
- cell($) {
343
- var d;
344
+ cell(d) {
345
+ var i;
344
346
  return pt(
345
- ((d = k._currentLocation) == null ? void 0 : d.type) === "restaurant" ? Jt : Qt,
346
- (m) => h.onActionMenu(m, $.row.original)
347
+ ((i = b._currentLocation) == null ? void 0 : i.type) === "restaurant" ? Qt : Jt,
348
+ (x) => g.onActionMenu(x, d.row.original)
347
349
  );
348
350
  },
349
351
  enableSorting: !1,
@@ -359,39 +361,39 @@ function on() {
359
361
  const sn = {
360
362
  context: null,
361
363
  error: null,
362
- isRequired(k = "This field is required") {
363
- return `${this.context ?? ""}`.length === 0 && (this.error = k), this;
364
+ isRequired(b = "This field is required") {
365
+ return `${this.context ?? ""}`.length === 0 && (this.error = b), this;
364
366
  },
365
- isString(k = "Must be a valid string") {
366
- return this.error ? this : (typeof this.context != "string" && (this.error ?? (this.error = k)), this);
367
+ isString(b = "Must be a valid string") {
368
+ return this.error ? this : (typeof this.context != "string" && (this.error ?? (this.error = b)), this);
367
369
  },
368
370
  toInt() {
369
371
  return this.error ? this : (this.context = +this.context, this);
370
372
  },
371
- isInteger(k = "Must be an integer") {
372
- return this.error ? this : (this.toInt(), isNaN(this.context) && (this.error = k), this);
373
+ isInteger(b = "Must be an integer") {
374
+ return this.error ? this : (this.toInt(), isNaN(this.context) && (this.error = b), this);
373
375
  },
374
- min(k, h) {
376
+ min(b, g) {
375
377
  if (this.error) return this;
376
378
  try {
377
- typeof this.context == "number" ? +this.context < k && (this.error = h ?? `Must be at least ${k}`) : Object.prototype.hasOwnProperty.call(this.context, "length") ? +this.context.length < k && (this.error = h ?? `Must be at least ${k}`) : this.error = "Length cannot be determined";
379
+ typeof this.context == "number" ? +this.context < b && (this.error = g ?? `Must be at least ${b}`) : Object.prototype.hasOwnProperty.call(this.context, "length") ? +this.context.length < b && (this.error = g ?? `Must be at least ${b}`) : this.error = "Length cannot be determined";
378
380
  } catch {
379
381
  this.error = "Length cannot be determined";
380
382
  }
381
383
  return this;
382
384
  },
383
- max(k, h) {
385
+ max(b, g) {
384
386
  if (this.error) return this;
385
387
  try {
386
- typeof this.context == "number" ? +this.context > k && (this.error = h ?? `Must be at most ${k}`) : "length" in this.context ? +this.context.length > k && (this.error = h ?? `Must be at most ${k}`) : this.error = "Length cannot be determined";
388
+ typeof this.context == "number" ? +this.context > b && (this.error = g ?? `Must be at most ${b}`) : "length" in this.context ? +this.context.length > b && (this.error = g ?? `Must be at most ${b}`) : this.error = "Length cannot be determined";
387
389
  } catch {
388
390
  this.error = "Length cannot be determined";
389
391
  }
390
392
  return this;
391
393
  }
392
394
  };
393
- function Je(k) {
394
- return { ...sn, context: k };
395
+ function Ze(b) {
396
+ return { ...sn, context: b };
395
397
  }
396
398
  const an = { class: "flex items-center" }, ln = { class: "fm-typo-en-title-md-800" }, rn = { class: "flex flex-col gap-24 w-full" }, un = { class: "flex flex-col gap-8" }, cn = { class: "fm-typo-en-body-lg-600" }, dn = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary flex-grow" }, mn = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-error" }, pn = { class: "flex flex-col p-16 gap-8" }, vn = { class: "flex flex-col gap-4" }, fn = { class: "fm-typo-en-body-md-600 text-fm-color-typo-secondary bg-fm-color-neutral-gray-100 border-b py-12 px-16" }, yn = { class: "grid grid-cols-[auto_100px_100px_48px] xs:grid-cols-[auto_80px_120px_48px] gap-8 px-8 items-center" }, _n = { class: "xs:col-span-3" }, bn = { class: "flex gap-8" }, kn = /* @__PURE__ */ ce({
397
399
  __name: "ConvertSkuDialog",
@@ -401,101 +403,101 @@ const an = { class: "flex items-center" }, ln = { class: "fm-typo-en-title-md-80
401
403
  show: { type: Boolean }
402
404
  },
403
405
  emits: ["update:show", "submitted"],
404
- setup(k, { expose: h, emit: c }) {
405
- const s = k, $ = c, d = Wt(), m = Pe(), v = _e(), S = be(), { t: B } = de(), i = N(0), l = N(null), y = H(() => m.skus), C = H(
406
+ setup(b, { expose: g, emit: p }) {
407
+ const o = b, j = p, h = Wt(), d = Re(), i = _e(), x = be(), { t: C } = de(), c = N(0), l = N(null), v = H(() => d.skus), $ = H(
406
408
  () => {
407
- var _, t;
408
- return (((t = (_ = s.sku) == null ? void 0 : _.convert) == null ? void 0 : t.inventoryBindings) ?? []).filter(
409
- (o) => o.type === Ke.enum.SKU
409
+ var y, t;
410
+ return (((t = (y = o.sku) == null ? void 0 : y.convert) == null ? void 0 : t.inventoryBindings) ?? []).filter(
411
+ (s) => s.type === We.enum.SKU
410
412
  );
411
413
  }
412
414
  ), A = H({
413
415
  get() {
414
416
  return !!l.value;
415
417
  },
416
- set(_) {
417
- _ ? l.value = He(C.value) : (l.value = null, i.value = Math.min(i.value, s.maxCount ?? 0));
418
+ set(y) {
419
+ y ? l.value = He($.value) : (l.value = null, c.value = Math.min(c.value, o.maxCount ?? 0));
418
420
  }
419
421
  }), V = N(!1);
420
- xe([() => s.show], ([_]) => {
421
- _ && (i.value = 0);
422
+ xe([() => o.show], ([y]) => {
423
+ y && (c.value = 0);
422
424
  });
423
425
  function n() {
424
- Q(s.sku, Se(i.value), l.value);
426
+ J(o.sku, Se(c.value), l.value);
425
427
  }
426
- function r(_) {
428
+ function r(y) {
427
429
  if (l.value)
428
430
  return !0;
429
- const t = Je(_).isInteger().max(s.maxCount ?? 0).error ?? "";
431
+ const t = Ze(y).isInteger().max(o.maxCount ?? 0).error ?? "";
430
432
  return t || !0;
431
433
  }
432
- function w(_) {
434
+ function w(y) {
433
435
  var a;
434
- const t = (a = s.sku.convert) != null && a.measurement ? s.sku.unit.measurements.find((x) => {
436
+ const t = (a = o.sku.convert) != null && a.measurement ? o.sku.unit.measurements.find((S) => {
435
437
  var U;
436
- return x.id === ((U = s.sku.convert) == null ? void 0 : U.measurement);
437
- }) ?? null : null, o = je(s.sku.unit, t), f = bt(+_);
438
- return Je(f).isInteger().max(o).error ? "Precision cannot be more than " + o : !0;
438
+ return S.id === ((U = o.sku.convert) == null ? void 0 : U.measurement);
439
+ }) ?? null : null, s = je(o.sku.unit, t), f = bt(+y);
440
+ return Ze(f).isInteger().max(s).error ? "Precision cannot be more than " + s : !0;
439
441
  }
440
- const M = H(
442
+ const B = H(
441
443
  () => {
442
- var _, t;
443
- return (_ = s.sku.convert) != null && _.measurement ? (t = s.sku.unit.measurements.find((o) => {
444
+ var y, t;
445
+ return (y = o.sku.convert) != null && y.measurement ? (t = o.sku.unit.measurements.find((s) => {
444
446
  var f;
445
- return o.id === ((f = s.sku.convert) == null ? void 0 : f.measurement);
446
- })) == null ? void 0 : t.abbrev : s.sku.unit.abbrev;
447
+ return s.id === ((f = o.sku.convert) == null ? void 0 : f.measurement);
448
+ })) == null ? void 0 : t.abbrev : o.sku.unit.abbrev;
447
449
  }
448
- ), D = H(() => {
449
- var f, p;
450
+ ), M = H(() => {
451
+ var f, m;
450
452
  const t = vt({
451
- bindings: ((f = s.sku.convert) == null ? void 0 : f.inventoryBindings) ?? [],
452
- skus: m.skus,
453
- skuGroups: m.skuGroups,
454
- recipes: m.recipes
453
+ bindings: ((f = o.sku.convert) == null ? void 0 : f.inventoryBindings) ?? [],
454
+ skus: d.skus,
455
+ skuGroups: d.skuGroups,
456
+ recipes: d.recipes
455
457
  }).inventoryBindings.filter((a) => "success" in a && a.success).map((a) => a).map((a) => a.binding);
456
- return (p = l.value ?? t) == null ? void 0 : p.map((a) => {
457
- var ae, re, q, ee, Le;
458
- const x = m.skus.find((ve) => ve._id === a.id), U = ((ae = a.measurement) == null ? void 0 : ae.abbrev) ?? ((re = x == null ? void 0 : x.unit) == null ? void 0 : re.abbrev), z = (q = s.sku.convert) != null && q.measurement ? s.sku.unit.measurements.find((ve) => {
459
- var ze;
460
- return ve.id === ((ze = s.sku.convert) == null ? void 0 : ze.measurement);
461
- }) ?? null : null, se = je(s.sku.unit, z), T = w(`${i.value}`) === !0 ? me(
458
+ return (m = l.value ?? t) == null ? void 0 : m.map((a) => {
459
+ var ae, re, q, ee, Ye;
460
+ const S = d.skus.find((fe) => fe._id === a.id), U = ((ae = a.measurement) == null ? void 0 : ae.abbrev) ?? ((re = S == null ? void 0 : S.unit) == null ? void 0 : re.abbrev), z = (q = o.sku.convert) != null && q.measurement ? o.sku.unit.measurements.find((fe) => {
461
+ var Ke;
462
+ return fe.id === ((Ke = o.sku.convert) == null ? void 0 : Ke.measurement);
463
+ }) ?? null : null, se = je(o.sku.unit, z), T = w(`${c.value}`) === !0 ? me(
462
464
  ft(
463
465
  a.amount,
464
- Se(+i.value, se)
466
+ Se(+c.value, se)
465
467
  ),
466
468
  !1
467
- ) : "0", G = (Le = (ee = l.value) == null ? void 0 : ee.find((ve) => ve.id === (x == null ? void 0 : x._id))) == null ? void 0 : Le.amount, W = G ? me(G, !1) : null;
469
+ ) : "0", G = (Ye = (ee = l.value) == null ? void 0 : ee.find((fe) => fe.id === (S == null ? void 0 : S._id))) == null ? void 0 : Ye.amount, W = G ? me(G, !1) : null;
468
470
  return {
469
- sku: x,
471
+ sku: S,
470
472
  convertAmount: W ?? T,
471
473
  abbrev: U
472
474
  };
473
475
  });
474
476
  }), E = N();
475
- h({
477
+ g({
476
478
  validateInputs: () => {
477
- var _, t;
478
- (t = (_ = E.value) == null ? void 0 : _.validateInputs) == null || t.call(_);
479
+ var y, t;
480
+ (t = (y = E.value) == null ? void 0 : y.validateInputs) == null || t.call(y);
479
481
  },
480
482
  resetInputsValidation: () => {
481
- var _, t;
482
- (t = (_ = E.value) == null ? void 0 : _.resetInputsValidation) == null || t.call(_);
483
+ var y, t;
484
+ (t = (y = E.value) == null ? void 0 : y.resetInputsValidation) == null || t.call(y);
483
485
  },
484
486
  resetInputs: () => {
485
- var _, t;
486
- (t = (_ = E.value) == null ? void 0 : _.resetInputs) == null || t.call(_);
487
+ var y, t;
488
+ (t = (y = E.value) == null ? void 0 : y.resetInputs) == null || t.call(y);
487
489
  }
488
490
  });
489
- const P = Ne(s, "show");
490
- async function Q(_, t, o) {
491
+ const P = ze(o, "show");
492
+ async function J(y, t, s) {
491
493
  V.value = !0;
492
494
  try {
493
- await v.convertSku({
495
+ await i.convertSku({
494
496
  conversions: [
495
497
  {
496
- doc: _,
498
+ doc: y,
497
499
  amount: t,
498
- overrides: o == null ? void 0 : o.map((f) => ({
500
+ overrides: s == null ? void 0 : s.map((f) => ({
499
501
  ...f,
500
502
  amount: {
501
503
  ...f.amount,
@@ -505,164 +507,164 @@ const an = { class: "flex items-center" }, ln = { class: "fm-typo-en-title-md-80
505
507
  }))
506
508
  }
507
509
  ]
508
- }), $("update:show", !1), $("submitted");
510
+ }), j("update:show", !1), j("submitted");
509
511
  } catch (f) {
510
- S.open({
512
+ x.open({
511
513
  title: "Something went wrong",
512
- message: `Cannot convert ${_.name}. Please try again.`,
514
+ message: `Cannot convert ${y.name}. Please try again.`,
513
515
  type: "error"
514
- }), console.error("error at converting stock amount", _, t, f);
516
+ }), console.error("error at converting stock amount", y, t, f);
515
517
  } finally {
516
518
  V.value = !1;
517
519
  }
518
520
  }
519
- function J(_, t, o) {
521
+ function Q(y, t, s) {
520
522
  const f = +t;
521
- let p = o;
522
- t.length > 0 && isFinite(f) ? p = o.map((a) => (a.id !== _ || (a.amount = ye(f)), a)) : p = o.map((a) => (a.id !== _ || (a.amount = { amount: 0, precision: 0 }), a)), l.value = p;
523
+ let m = s;
524
+ t.length > 0 && isFinite(f) ? m = s.map((a) => (a.id !== y || (a.amount = ye(f)), a)) : m = s.map((a) => (a.id !== y || (a.amount = { amount: 0, precision: 0 }), a)), l.value = m;
523
525
  }
524
- function R(_) {
525
- const t = y.value.find((o) => o._id === _);
526
- return t ? st(t.unit, !0) : [];
526
+ function R(y) {
527
+ const t = v.value.find((s) => s._id === y);
528
+ return t ? lt(t.unit, !0) : [];
527
529
  }
528
- function oe(_, t) {
529
- const o = R(_), f = o.find((p) => p.value === t) ?? o.find((p) => p.value === null);
530
+ function oe(y, t) {
531
+ const s = R(y), f = s.find((m) => m.value === t) ?? s.find((m) => m.value === null);
530
532
  return f ? {
531
533
  ...f,
532
534
  label: f.abbrev
533
535
  } : null;
534
536
  }
535
- function L(_, t, o) {
537
+ function L(y, t, s) {
536
538
  let f;
537
539
  if (t === null)
538
- f = o.map((p) => (p.id !== _ || (p.measurement = null), p)) ?? [];
540
+ f = s.map((m) => (m.id !== y || (m.measurement = null), m)) ?? [];
539
541
  else {
540
- const p = y.value.find((a) => a._id === _);
541
- f = o.map((a) => {
542
- var x, U;
543
- return a.id !== _ || (a.measurement = (U = (x = p == null ? void 0 : p.unit) == null ? void 0 : x.measurements) == null ? void 0 : U.find((z) => z.id === t)), a;
542
+ const m = v.value.find((a) => a._id === y);
543
+ f = s.map((a) => {
544
+ var S, U;
545
+ return a.id !== y || (a.measurement = (U = (S = m == null ? void 0 : m.unit) == null ? void 0 : S.measurements) == null ? void 0 : U.find((z) => z.id === t)), a;
544
546
  }) ?? [];
545
547
  }
546
548
  l.value = f;
547
549
  }
548
- function Y(_, t) {
549
- const o = t.filter((f) => f.id !== _);
550
- l.value = o;
550
+ function Y(y, t) {
551
+ const s = t.filter((f) => f.id !== y);
552
+ l.value = s;
551
553
  }
552
554
  function le() {
553
- const _ = (l.value ?? []).map((t) => ({
555
+ const y = (l.value ?? []).map((t) => ({
554
556
  ...t,
555
- type: Ke.enum.SKU
557
+ type: We.enum.SKU
556
558
  }));
557
- d.promptIngredientsBinding(
558
- _,
559
+ h.promptIngredientsBinding(
560
+ y,
559
561
  (t) => l.value = t,
560
- s.sku._id
562
+ o.sku._id
561
563
  );
562
564
  }
563
565
  return xe(
564
- () => s.show,
565
- (_) => {
566
- _ || (l.value = null, i.value = 0);
566
+ () => o.show,
567
+ (y) => {
568
+ y || (l.value = null, c.value = 0);
567
569
  }
568
- ), (_, t) => {
569
- const o = I("FmTextField"), f = I("FmForm"), p = I("FmCard"), a = I("FmSwitch"), x = I("FmFormGroup"), U = I("FmSelect"), z = I("FmButton"), se = I("FmSideSheet");
570
+ ), (y, t) => {
571
+ const s = D("FmTextField"), f = D("FmForm"), m = D("FmCard"), a = D("FmSwitch"), S = D("FmFormGroup"), U = D("FmSelect"), z = D("FmButton"), se = D("FmSideSheet");
570
572
  return F(), K(se, {
571
573
  "dismiss-away": "",
572
574
  modelValue: u(P),
573
575
  "onUpdate:modelValue": t[3] || (t[3] = (T) => Ue(P) ? P.value = T : null),
574
576
  "max-width": 500
575
577
  }, {
576
- "side-sheet-header": j(() => [
578
+ "side-sheet-header": I(() => [
577
579
  e("div", an, [
578
- e("div", ln, b(u(B)("inventory.stock.convert.title", { name: _.sku.name })), 1)
580
+ e("div", ln, _(u(C)("inventory.stock.convert.title", { name: y.sku.name })), 1)
579
581
  ])
580
582
  ]),
581
- default: j(() => [
583
+ default: I(() => [
582
584
  e("div", rn, [
583
- g(f, {
585
+ k(f, {
584
586
  ref_key: "formRef",
585
587
  ref: E,
586
588
  onValidationSuccess: n
587
589
  }, {
588
- default: j(() => [
589
- g(o, {
590
+ default: I(() => [
591
+ k(s, {
590
592
  disabled: V.value,
591
- "model-value": i.value,
592
- "onUpdate:modelValue": t[0] || (t[0] = (T) => i.value = T),
593
- label: u(B)("inventory.stock.convert.amount"),
593
+ "model-value": c.value,
594
+ "onUpdate:modelValue": t[0] || (t[0] = (T) => c.value = T),
595
+ label: u(C)("inventory.stock.convert.amount"),
594
596
  rules: [r, w, u(Fe)(0)],
595
- "append-text": M.value,
596
- "helper-text": l.value ? void 0 : `Max ${_.maxCount} ${M.value}`
597
+ "append-text": B.value,
598
+ "helper-text": l.value ? void 0 : `Max ${y.maxCount} ${B.value}`
597
599
  }, null, 8, ["disabled", "model-value", "label", "rules", "append-text", "helper-text"])
598
600
  ]),
599
601
  _: 1
600
602
  }, 512),
601
- g(p, {
603
+ k(m, {
602
604
  variant: "outlined",
603
605
  class: "p-16"
604
606
  }, {
605
- default: j(() => [
607
+ default: I(() => [
606
608
  e("div", un, [
607
- e("div", cn, b(u(B)("inventory.stock.convert.deductionSummary")), 1),
608
- (F(!0), O(Z, null, ie(D.value, (T) => {
609
+ e("div", cn, _(u(C)("inventory.stock.convert.deductionSummary")), 1),
610
+ (F(!0), O(Z, null, ie(M.value, (T) => {
609
611
  var G, W;
610
612
  return F(), O("div", {
611
613
  key: (G = T.sku) == null ? void 0 : G._id,
612
614
  class: "flex items-center"
613
615
  }, [
614
- e("div", dn, b((W = T.sku) == null ? void 0 : W.name), 1),
615
- e("div", mn, " -" + b(T.convertAmount) + " " + b(T.abbrev), 1)
616
+ e("div", dn, _((W = T.sku) == null ? void 0 : W.name), 1),
617
+ e("div", mn, " -" + _(T.convertAmount) + " " + _(T.abbrev), 1)
616
618
  ]);
617
619
  }), 128))
618
620
  ])
619
621
  ]),
620
622
  _: 1
621
623
  }),
622
- g(p, { variant: "outlined" }, {
623
- default: j(() => [
624
+ k(m, { variant: "outlined" }, {
625
+ default: I(() => [
624
626
  e("div", pn, [
625
- g(a, {
627
+ k(a, {
626
628
  value: "",
627
629
  modelValue: A.value,
628
630
  "onUpdate:modelValue": t[1] || (t[1] = (T) => A.value = T),
629
- label: u(B)("inventory.stock.convert.overrideDeduction"),
631
+ label: u(C)("inventory.stock.convert.overrideDeduction"),
630
632
  "label-placement": "right"
631
633
  }, null, 8, ["modelValue", "label"]),
632
634
  A.value ? (F(), O(Z, { key: 0 }, [
633
- g(x, {
635
+ k(S, {
634
636
  modelValue: l.value,
635
637
  rules: [u(yt)(1, "Must have at least one ingredient binding")]
636
638
  }, null, 8, ["modelValue", "rules"]),
637
639
  e("div", vn, [
638
- e("div", fn, b(u(B)("inventory.stock.convert.ingredients")), 1),
639
- (F(!0), O(Z, null, ie(l.value, (T) => (F(), K(x, {
640
+ e("div", fn, _(u(C)("inventory.stock.convert.ingredients")), 1),
641
+ (F(!0), O(Z, null, ie(l.value, (T) => (F(), K(S, {
640
642
  key: T.id,
641
643
  disabled: V.value,
642
644
  modelValue: +u(me)(T.amount ?? { amount: 1, precision: 0 }),
643
645
  rules: [
644
646
  u(_t)(
645
- y.value.find((G) => G._id === T.id).unit,
647
+ v.value.find((G) => G._id === T.id).unit,
646
648
  T.measurement
647
649
  ),
648
650
  u(Fe)(0)
649
651
  ]
650
652
  }, {
651
- default: j(({ invalid: G }) => {
653
+ default: I(({ invalid: G }) => {
652
654
  var W, ae, re;
653
655
  return [
654
656
  e("div", yn, [
655
- e("div", _n, b((W = y.value.find((q) => q._id === T.id)) == null ? void 0 : W.name), 1),
656
- g(o, {
657
+ e("div", _n, _((W = v.value.find((q) => q._id === T.id)) == null ? void 0 : W.name), 1),
658
+ k(s, {
657
659
  class: "xs:col-span-2",
658
660
  disabled: V.value,
659
661
  modelValue: +u(me)(
660
662
  T.amount ?? { amount: 1, precision: 0 }
661
663
  ),
662
- "onUpdate:modelValue": (q) => J(T.id, q, l.value ?? []),
664
+ "onUpdate:modelValue": (q) => Q(T.id, q, l.value ?? []),
663
665
  invalid: G
664
666
  }, null, 8, ["disabled", "modelValue", "onUpdate:modelValue", "invalid"]),
665
- g(U, {
667
+ k(U, {
666
668
  disabled: V.value,
667
669
  class: "translate-y-[2px]",
668
670
  items: R(T.id),
@@ -670,10 +672,10 @@ const an = { class: "flex items-center" }, ln = { class: "fm-typo-en-title-md-80
670
672
  "onUpdate:modelValue": (q) => L(T.id, q, l.value ?? []),
671
673
  invalid: G
672
674
  }, {
673
- "helper-text": j(() => t[4] || (t[4] = [])),
675
+ "helper-text": I(() => t[4] || (t[4] = [])),
674
676
  _: 2
675
677
  }, 1032, ["disabled", "items", "model-value", "onUpdate:modelValue", "invalid"]),
676
- g(z, {
678
+ k(z, {
677
679
  disabled: V.value,
678
680
  type: "button",
679
681
  variant: "tertiary",
@@ -687,9 +689,9 @@ const an = { class: "flex items-center" }, ln = { class: "fm-typo-en-title-md-80
687
689
  }, 1032, ["disabled", "modelValue", "rules"]))), 128))
688
690
  ]),
689
691
  e("div", null, [
690
- g(z, {
692
+ k(z, {
691
693
  icon: "link",
692
- label: u(B)("inventory.stock.convert.linkIngredient"),
694
+ label: u(C)("inventory.stock.convert.linkIngredient"),
693
695
  variant: "plain",
694
696
  onClick: le
695
697
  }, null, 8, ["label"])
@@ -701,11 +703,11 @@ const an = { class: "flex items-center" }, ln = { class: "fm-typo-en-title-md-80
701
703
  })
702
704
  ])
703
705
  ]),
704
- "side-sheet-footer": j(() => [
706
+ "side-sheet-footer": I(() => [
705
707
  e("div", bn, [
706
- g(z, {
708
+ k(z, {
707
709
  loading: V.value,
708
- label: u(B)("inventory.stock.convert.convertButton"),
710
+ label: u(C)("inventory.stock.convert.convertButton"),
709
711
  onClick: t[2] || (t[2] = (T) => {
710
712
  var G, W;
711
713
  return (W = (G = E.value) == null ? void 0 : G.validateInputs) == null ? void 0 : W.call(G);
@@ -718,12 +720,12 @@ const an = { class: "flex items-center" }, ln = { class: "fm-typo-en-title-md-80
718
720
  };
719
721
  }
720
722
  });
721
- function De(k, h) {
722
- const c = Se(k, h);
723
- return { ...c, amount: -c.amount };
723
+ function De(b, g) {
724
+ const p = Se(b, g);
725
+ return { ...p, amount: -p.amount };
724
726
  }
725
- function Qe(k, h) {
726
- return Se(Math.abs(k), h);
727
+ function et(b, g) {
728
+ return Se(Math.abs(b), g);
727
729
  }
728
730
  const Ie = {
729
731
  [ne.enum.DAMAGE]: {
@@ -740,11 +742,11 @@ const Ie = {
740
742
  },
741
743
  [ne.enum.EXTRA]: {
742
744
  label: "Extra",
743
- toAdjustmentAmount: Qe
745
+ toAdjustmentAmount: et
744
746
  },
745
747
  [ne.enum.PURCHASE]: {
746
748
  label: "Purchase",
747
- toAdjustmentAmount: Qe
749
+ toAdjustmentAmount: et
748
750
  }
749
751
  }, gn = { class: "col-span-2 flex" }, hn = { class: "fm-typo-en-body-lg-600 flex-1" }, xn = /* @__PURE__ */ ce({
750
752
  __name: "AdjustedItemForm",
@@ -753,113 +755,113 @@ const Ie = {
753
755
  disabled: { type: Boolean }
754
756
  },
755
757
  emits: ["update:modelValue", "click:delete"],
756
- setup(k, { emit: h }) {
757
- const c = k, s = h, $ = H(
758
- () => Object.keys(Ie).map((i) => ({
759
- label: kt(i),
760
- value: i
758
+ setup(b, { emit: g }) {
759
+ const p = b, o = g, j = H(
760
+ () => Object.keys(Ie).map((c) => ({
761
+ label: kt(c),
762
+ value: c
761
763
  }))
762
- ), d = H(() => st(c.modelValue.doc.unit, !0)), m = H({
764
+ ), h = H(() => lt(p.modelValue.doc.unit, !0)), d = H({
763
765
  get() {
764
- return c.modelValue.type ?? ne.enum.PURCHASE;
766
+ return p.modelValue.type ?? ne.enum.PURCHASE;
765
767
  },
766
- set(i) {
768
+ set(c) {
767
769
  const l = {
768
- ...c.modelValue
770
+ ...p.modelValue
769
771
  };
770
- l.type = i;
771
- const y = Ge(c.modelValue.amount);
772
+ l.type = c;
773
+ const v = qe(p.modelValue.amount);
772
774
  l.amount = Ie[l.type].toAdjustmentAmount(
773
- +me(y),
774
- y.precision
775
- ), s("update:modelValue", l);
775
+ +me(v),
776
+ v.precision
777
+ ), o("update:modelValue", l);
776
778
  }
777
- }), v = H({
779
+ }), i = H({
778
780
  get() {
779
- const i = Ge(c.modelValue.amount);
780
- return +me(i);
781
+ const c = qe(p.modelValue.amount);
782
+ return +me(c);
781
783
  },
782
- set(i) {
784
+ set(c) {
783
785
  const l = {
784
- ...c.modelValue
785
- }, y = ye(i);
786
- l.amount = Ie[m.value].toAdjustmentAmount(
787
- i,
788
- y.precision
789
- ), s("update:modelValue", l);
786
+ ...p.modelValue
787
+ }, v = ye(c);
788
+ l.amount = Ie[d.value].toAdjustmentAmount(
789
+ c,
790
+ v.precision
791
+ ), o("update:modelValue", l);
790
792
  }
791
- }), S = H({
793
+ }), x = H({
792
794
  get() {
793
- var i;
794
- return ((i = c.modelValue.measurement) == null ? void 0 : i.id) ?? null;
795
+ var c;
796
+ return ((c = p.modelValue.measurement) == null ? void 0 : c.id) ?? null;
795
797
  },
796
- set(i) {
797
- var y, C;
798
+ set(c) {
799
+ var v, $;
798
800
  const l = {
799
- ...c.modelValue
801
+ ...p.modelValue
800
802
  };
801
- l.measurement = ((C = (y = c.modelValue.doc.unit) == null ? void 0 : y.measurements) == null ? void 0 : C.find((A) => A.id === i)) ?? null, s("update:modelValue", l);
803
+ l.measurement = (($ = (v = p.modelValue.doc.unit) == null ? void 0 : v.measurements) == null ? void 0 : $.find((A) => A.id === c)) ?? null, o("update:modelValue", l);
802
804
  }
803
- }), B = H({
805
+ }), C = H({
804
806
  get() {
805
- return c.modelValue.remark ?? "";
807
+ return p.modelValue.remark ?? "";
806
808
  },
807
- set(i) {
809
+ set(c) {
808
810
  const l = {
809
- ...c.modelValue
811
+ ...p.modelValue
810
812
  };
811
- l.remark = i, s("update:modelValue", l);
813
+ l.remark = c, o("update:modelValue", l);
812
814
  }
813
815
  });
814
- return (i, l) => {
815
- const y = I("FmButton"), C = I("FmSelect"), A = I("FmTextarea"), V = I("FmCard");
816
+ return (c, l) => {
817
+ const v = D("FmButton"), $ = D("FmSelect"), A = D("FmTextarea"), V = D("FmCard");
816
818
  return F(), K(V, {
817
819
  variant: "outlined",
818
820
  class: "grid grid-cols-2 gap-8 p-16"
819
821
  }, {
820
- default: j(() => [
822
+ default: I(() => [
821
823
  e("div", gn, [
822
- e("div", hn, b(i.modelValue.doc.name), 1),
823
- g(y, {
824
+ e("div", hn, _(c.modelValue.doc.name), 1),
825
+ k(v, {
824
826
  variant: "tertiary",
825
827
  "prepend-icon": "delete",
826
- onClick: l[0] || (l[0] = (n) => s("click:delete"))
828
+ onClick: l[0] || (l[0] = (n) => o("click:delete"))
827
829
  })
828
830
  ]),
829
- g(C, {
830
- disabled: i.disabled,
831
+ k($, {
832
+ disabled: c.disabled,
831
833
  class: "col-span-2",
832
834
  label: "Type",
833
- items: $.value,
834
- modelValue: m.value,
835
- "onUpdate:modelValue": l[1] || (l[1] = (n) => m.value = n),
835
+ items: j.value,
836
+ modelValue: d.value,
837
+ "onUpdate:modelValue": l[1] || (l[1] = (n) => d.value = n),
836
838
  rules: [u(gt)()],
837
839
  "label-mark": "required"
838
840
  }, null, 8, ["disabled", "items", "modelValue", "rules"]),
839
- g(qt, {
840
- disabled: i.disabled,
841
+ k(qt, {
842
+ disabled: c.disabled,
841
843
  label: "Amount",
842
844
  step: +u(me)({
843
845
  amount: 1,
844
- precision: u(je)(i.modelValue.doc.unit, i.modelValue.measurement)
846
+ precision: u(je)(c.modelValue.doc.unit, c.modelValue.measurement)
845
847
  }),
846
- modelValue: v.value,
847
- "onUpdate:modelValue": l[2] || (l[2] = (n) => v.value = n),
848
+ modelValue: i.value,
849
+ "onUpdate:modelValue": l[2] || (l[2] = (n) => i.value = n),
848
850
  rules: [u(Fe)(0)]
849
851
  }, null, 8, ["disabled", "step", "modelValue", "rules"]),
850
- g(C, {
851
- disabled: i.disabled,
852
+ k($, {
853
+ disabled: c.disabled,
852
854
  label: "Unit",
853
- items: d.value,
854
- modelValue: S.value,
855
- "onUpdate:modelValue": l[3] || (l[3] = (n) => S.value = n)
855
+ items: h.value,
856
+ modelValue: x.value,
857
+ "onUpdate:modelValue": l[3] || (l[3] = (n) => x.value = n)
856
858
  }, null, 8, ["disabled", "items", "modelValue"]),
857
- g(A, {
859
+ k(A, {
858
860
  class: "col-span-2",
859
- disabled: i.disabled,
861
+ disabled: c.disabled,
860
862
  label: "Remark",
861
- modelValue: B.value,
862
- "onUpdate:modelValue": l[4] || (l[4] = (n) => B.value = n),
863
+ modelValue: C.value,
864
+ "onUpdate:modelValue": l[4] || (l[4] = (n) => C.value = n),
863
865
  "label-mark": "optional"
864
866
  }, null, 8, ["disabled", "modelValue"])
865
867
  ]),
@@ -874,45 +876,45 @@ const Ie = {
874
876
  show: { type: Boolean }
875
877
  },
876
878
  emits: ["update:show", "submitted"],
877
- setup(k, { expose: h, emit: c }) {
878
- const s = k, $ = c, d = Pe(), m = Oe(), v = _e(), S = be(), B = N(!1), { t: i } = de();
879
+ setup(b, { expose: g, emit: p }) {
880
+ const o = b, j = p, h = Re(), d = Le(), i = _e(), x = be(), C = N(!1), { t: c } = de();
879
881
  function l() {
880
882
  V(He(A));
881
883
  }
882
- const y = N();
883
- h({
884
+ const v = N();
885
+ g({
884
886
  validateInputs: () => {
885
- var w, M;
886
- (M = (w = y.value) == null ? void 0 : w.validateInputs) == null || M.call(w);
887
+ var w, B;
888
+ (B = (w = v.value) == null ? void 0 : w.validateInputs) == null || B.call(w);
887
889
  },
888
890
  resetInputsValidation: () => {
889
- var w, M;
890
- (M = (w = y.value) == null ? void 0 : w.resetInputsValidation) == null || M.call(w);
891
+ var w, B;
892
+ (B = (w = v.value) == null ? void 0 : w.resetInputsValidation) == null || B.call(w);
891
893
  },
892
894
  resetInputs: () => {
893
- var w, M;
894
- (M = (w = y.value) == null ? void 0 : w.resetInputs) == null || M.call(w);
895
+ var w, B;
896
+ (B = (w = v.value) == null ? void 0 : w.resetInputs) == null || B.call(w);
895
897
  }
896
898
  });
897
- const C = Ne(s, "show"), A = ut({
899
+ const $ = ze(o, "show"), A = ut({
898
900
  remark: "",
899
901
  adjustments: [
900
902
  {
901
903
  id: `sku_${(/* @__PURE__ */ new Date()).toISOString()}_${Math.random().toString(16).slice(2, 8)}`,
902
904
  type: ne.enum.PURCHASE,
903
- doc: s.stock,
905
+ doc: o.stock,
904
906
  measurement: null,
905
907
  remark: "",
906
908
  amount: ye(1)
907
909
  }
908
910
  ]
909
911
  });
910
- xe([() => s.show], ([w]) => {
912
+ xe([() => o.show], ([w]) => {
911
913
  w && (A.remark = "", A.adjustments = [
912
914
  {
913
915
  id: `sku_${(/* @__PURE__ */ new Date()).toISOString()}_${Math.random().toString(16).slice(2, 8)}`,
914
916
  type: ne.enum.PURCHASE,
915
- doc: s.stock,
917
+ doc: o.stock,
916
918
  measurement: null,
917
919
  remark: "",
918
920
  amount: ye(1)
@@ -920,41 +922,41 @@ const Ie = {
920
922
  ]);
921
923
  });
922
924
  async function V(w) {
923
- B.value = !0;
925
+ C.value = !0;
924
926
  try {
925
- await v.adjustSku({
927
+ await i.adjustSku({
926
928
  remark: w.remark,
927
- adjustments: w.adjustments.map(({ doc: M, remark: D, type: E, amount: P, measurement: Q }) => ({
928
- id: M._id,
929
+ adjustments: w.adjustments.map(({ doc: B, remark: M, type: E, amount: P, measurement: J }) => ({
930
+ id: B._id,
929
931
  amount: P,
930
- measurement: Q,
931
- remark: D,
932
- doc: M,
932
+ measurement: J,
933
+ remark: M,
934
+ doc: B,
933
935
  type: E
934
936
  }))
935
- }), $("update:show", !1), $("submitted");
936
- } catch (M) {
937
- S.open({
938
- title: i("inventory.stock.adjust.error.title"),
939
- message: i("inventory.stock.adjust.error.message"),
937
+ }), j("update:show", !1), j("submitted");
938
+ } catch (B) {
939
+ x.open({
940
+ title: c("inventory.stock.adjust.error.title"),
941
+ message: c("inventory.stock.adjust.error.message"),
940
942
  type: "error"
941
- }), console.log("error on adjust ingredients", w, M);
943
+ }), console.log("error on adjust ingredients", w, B);
942
944
  } finally {
943
- B.value = !1;
945
+ C.value = !1;
944
946
  }
945
947
  }
946
948
  function n() {
947
- const w = d.skus.map((D) => ({
948
- label: D.name,
949
- sublabel: D.code,
950
- value: D._id
951
- })), M = w.filter((D) => A.adjustments.find((E) => E.doc._id === D.value)).map((D) => D.value);
952
- m.open({
949
+ const w = h.skus.map((M) => ({
950
+ label: M.name,
951
+ sublabel: M.code,
952
+ value: M._id
953
+ })), B = w.filter((M) => A.adjustments.find((E) => E.doc._id === M.value)).map((M) => M.value);
954
+ d.open({
953
955
  title: "Select ingredients",
954
956
  contentComponent: ht,
955
957
  contentComponentProps: {
956
958
  items: w,
957
- modelValue: M
959
+ modelValue: B
958
960
  },
959
961
  overlay: !0,
960
962
  closeButton: !0,
@@ -968,12 +970,12 @@ const Ie = {
968
970
  close: !0,
969
971
  variant: "tertiary"
970
972
  }
971
- }).onPrimary((D) => {
972
- A.adjustments = D.map(
973
+ }).onPrimary((M) => {
974
+ A.adjustments = M.map(
973
975
  (E) => A.adjustments.find((P) => P.doc._id === E) ?? {
974
976
  id: `sku_${(/* @__PURE__ */ new Date()).toISOString()}_${Math.random().toString(16).slice(2, 8)}`,
975
977
  type: ne.enum.PURCHASE,
976
- doc: d.skus.find((P) => P._id === E),
978
+ doc: h.skus.find((P) => P._id === E),
977
979
  measurement: null,
978
980
  remark: "",
979
981
  amount: ye(1)
@@ -984,43 +986,43 @@ const Ie = {
984
986
  function r(w) {
985
987
  A.adjustments.splice(w, 1);
986
988
  }
987
- return (w, M) => {
988
- const D = I("FmTextarea"), E = I("FmButton"), P = I("FmForm"), Q = I("FmSideSheet");
989
- return F(), K(Q, {
990
- modelValue: u(C),
991
- "onUpdate:modelValue": M[2] || (M[2] = (J) => Ue(C) ? C.value = J : null),
989
+ return (w, B) => {
990
+ const M = D("FmTextarea"), E = D("FmButton"), P = D("FmForm"), J = D("FmSideSheet");
991
+ return F(), K(J, {
992
+ modelValue: u($),
993
+ "onUpdate:modelValue": B[2] || (B[2] = (Q) => Ue($) ? $.value = Q : null),
992
994
  "dismiss-away": "",
993
995
  "max-width": 500
994
996
  }, {
995
- "side-sheet-header": j(() => [
997
+ "side-sheet-header": I(() => [
996
998
  e("div", Sn, [
997
- e("div", Fn, b(u(i)("inventory.stock.adjust.title")), 1)
999
+ e("div", Fn, _(u(c)("inventory.stock.adjust.title")), 1)
998
1000
  ])
999
1001
  ]),
1000
- default: j(() => [
1001
- g(P, {
1002
+ default: I(() => [
1003
+ k(P, {
1002
1004
  class: "w-full flex flex-col gap-12",
1003
1005
  ref_key: "formRef",
1004
- ref: y,
1006
+ ref: v,
1005
1007
  onValidationSuccess: l
1006
1008
  }, {
1007
- default: j(() => [
1008
- g(D, {
1009
- label: u(i)("inventory.stock.adjust.remark"),
1009
+ default: I(() => [
1010
+ k(M, {
1011
+ label: u(c)("inventory.stock.adjust.remark"),
1010
1012
  modelValue: A.remark,
1011
- "onUpdate:modelValue": M[0] || (M[0] = (J) => A.remark = J)
1013
+ "onUpdate:modelValue": B[0] || (B[0] = (Q) => A.remark = Q)
1012
1014
  }, null, 8, ["label", "modelValue"]),
1013
1015
  e("div", wn, [
1014
- e("div", $n, b(u(i)("inventory.stock.adjust.adjustedItems")), 1),
1015
- g(E, {
1016
+ e("div", $n, _(u(c)("inventory.stock.adjust.adjustedItems")), 1),
1017
+ k(E, {
1016
1018
  "prepend-icon": "add",
1017
1019
  variant: "tertiary",
1018
1020
  size: "md",
1019
1021
  onClick: n
1020
1022
  })
1021
1023
  ]),
1022
- (F(!0), O(Z, null, ie(A.adjustments, (J, R) => (F(), K(xn, {
1023
- key: J.id,
1024
+ (F(!0), O(Z, null, ie(A.adjustments, (Q, R) => (F(), K(xn, {
1025
+ key: Q.id,
1024
1026
  modelValue: A.adjustments[R],
1025
1027
  "onUpdate:modelValue": (oe) => A.adjustments[R] = oe,
1026
1028
  "onClick:delete": (oe) => r(R)
@@ -1029,14 +1031,14 @@ const Ie = {
1029
1031
  _: 1
1030
1032
  }, 512)
1031
1033
  ]),
1032
- "side-sheet-footer": j(() => [
1034
+ "side-sheet-footer": I(() => [
1033
1035
  e("div", An, [
1034
- g(E, {
1035
- label: u(i)("inventory.stock.adjust.adjustButton"),
1036
- loading: B.value,
1037
- onClick: M[1] || (M[1] = (J) => {
1036
+ k(E, {
1037
+ label: u(c)("inventory.stock.adjust.adjustButton"),
1038
+ loading: C.value,
1039
+ onClick: B[1] || (B[1] = (Q) => {
1038
1040
  var R, oe;
1039
- return (oe = (R = y.value) == null ? void 0 : R.validateInputs) == null ? void 0 : oe.call(R);
1041
+ return (oe = (R = v.value) == null ? void 0 : R.validateInputs) == null ? void 0 : oe.call(R);
1040
1042
  })
1041
1043
  }, null, 8, ["label", "loading"])
1042
1044
  ])
@@ -1045,81 +1047,81 @@ const Ie = {
1045
1047
  }, 8, ["modelValue"]);
1046
1048
  };
1047
1049
  }
1048
- }), Cn = xt((k, h) => ({
1050
+ }), Cn = xt((b, g) => ({
1049
1051
  // TODO: remove once latest inventory backend has been push
1050
- async findBillsByBusinessId(c, s, $) {
1051
- const d = `${k.businessesBackendUrl}/${c}/reports/find-many`, m = {
1052
+ async findBillsByBusinessId(p, o, j) {
1053
+ const h = `${b.businessesBackendUrl}/${p}/reports/find-many`, d = {
1052
1054
  // type: TYPE.bill,
1053
1055
  type: "bill",
1054
- restaurantIds: s,
1055
- ids: $
1056
+ restaurantIds: o,
1057
+ ids: j
1056
1058
  };
1057
- return await h.post(d, m);
1059
+ return await g.post(h, d);
1058
1060
  },
1059
- async findBillsById(c) {
1060
- const $ = pe().currentLocationDBName, d = `${k.inventoryBackendUrl}/${$}/bill/search`, m = {
1061
- ids: c
1061
+ async findBillsById(p) {
1062
+ const j = ve().currentLocationDBName, h = `${b.inventoryBackendUrl}/${j}/bill/search`, d = {
1063
+ ids: p
1062
1064
  };
1063
- return await h.post(d, m);
1065
+ return await g.post(h, d);
1064
1066
  }
1065
- })), Mn = {
1067
+ })), Bn = {
1066
1068
  key: 0,
1067
1069
  class: "flex justify-center items-center h-32"
1068
- }, Bn = { class: "mb-3" }, Dn = { class: "flex flex-col gap-8" }, In = { class: "flex flex-col text-fm-color-typo-primary mb-3 text-center" }, jn = { class: "text-fm-color-neutral-gray-400 fm-typo-en-body-sm-600" }, Tn = { class: "flex flex-col gap-4 text-fm-color-typo-primary mb-3" }, Un = { class: "flex flex-col gap-4 text-fm-color-typo-primary mb-3" }, En = { class: "flex flex-col gap-4 text-fm-color-typo-primary mb-3" }, Hn = { class: "flex flex-col w-full px-2" }, Pn = { class: "flex gap-2" }, Rn = /* @__PURE__ */ ce({
1070
+ }, Mn = { class: "mb-3" }, Dn = { class: "flex flex-col gap-8" }, In = { class: "flex flex-col text-fm-color-typo-primary mb-3 text-center" }, jn = { class: "text-fm-color-neutral-gray-400 fm-typo-en-body-sm-600" }, Tn = { class: "flex flex-col gap-4 text-fm-color-typo-primary mb-3" }, Un = { class: "flex flex-col gap-4 text-fm-color-typo-primary mb-3" }, En = { class: "flex flex-col gap-4 text-fm-color-typo-primary mb-3" }, Hn = { class: "flex flex-col w-full px-2" }, Pn = { class: "flex gap-2" }, Rn = /* @__PURE__ */ ce({
1069
1071
  __name: "AmendAdjustmentForm",
1070
- props: /* @__PURE__ */ Ye({
1072
+ props: /* @__PURE__ */ Ge({
1071
1073
  adjustmentId: {}
1072
1074
  }, {
1073
1075
  modelValue: {},
1074
1076
  modelModifiers: {}
1075
1077
  }),
1076
- emits: /* @__PURE__ */ Ye(["refreshHistory"], ["update:modelValue"]),
1077
- setup(k, { emit: h }) {
1078
- const c = k, s = h, $ = _e(), d = ct(k, "modelValue"), m = N(!1), v = N(!1), S = N(!1), B = N({
1078
+ emits: /* @__PURE__ */ Ge(["refreshHistory"], ["update:modelValue"]),
1079
+ setup(b, { emit: g }) {
1080
+ const p = b, o = g, j = _e(), h = ct(b, "modelValue"), d = N(!1), i = N(!1), x = N(!1), C = N({
1079
1081
  _id: `inventoryAdjustment_${(/* @__PURE__ */ new Date()).toISOString()}_XXXXX`,
1080
1082
  skus: []
1081
- }), i = N();
1083
+ }), c = N();
1082
1084
  Ee(async () => {
1083
- m.value = !0;
1084
- const n = await $.readSingleAdjustment(c.adjustmentId);
1085
+ d.value = !0;
1086
+ const n = await j.readSingleAdjustment(p.adjustmentId);
1085
1087
  if (!n) throw new Error("Adjustment not found");
1086
- B.value = n, m.value = !1;
1088
+ C.value = n, d.value = !1;
1087
1089
  });
1088
1090
  async function l() {
1089
1091
  var r, w;
1090
- if ((w = (r = i == null ? void 0 : i.value) == null ? void 0 : r.validateInputs) == null || w.call(r), !v.value) return;
1092
+ if ((w = (r = c == null ? void 0 : c.value) == null ? void 0 : r.validateInputs) == null || w.call(r), !i.value) return;
1091
1093
  const n = {};
1092
- Object.keys(d.value || {}).forEach((M) => {
1093
- var D;
1094
- Object.keys(((D = d.value) == null ? void 0 : D[M]) || {}).forEach((E) => {
1095
- var Q, J;
1096
- const P = (J = (Q = d.value) == null ? void 0 : Q[M]) == null ? void 0 : J[Number(E)];
1097
- P && C(P.amount) > 0 && (n[M] || (n[M] = []), n[M].push(P));
1094
+ Object.keys(h.value || {}).forEach((B) => {
1095
+ var M;
1096
+ Object.keys(((M = h.value) == null ? void 0 : M[B]) || {}).forEach((E) => {
1097
+ var J, Q;
1098
+ const P = (Q = (J = h.value) == null ? void 0 : J[B]) == null ? void 0 : Q[Number(E)];
1099
+ P && $(P.amount) > 0 && (n[B] || (n[B] = []), n[B].push(P));
1098
1100
  });
1099
- }), await $.revertWastageAdjustment({
1100
- targetWastageAdjustmentId: c.adjustmentId,
1101
+ }), await j.revertWastageAdjustment({
1102
+ targetWastageAdjustmentId: p.adjustmentId,
1101
1103
  amountsGoingToAdjust: n
1102
- }), s("refreshHistory"), S.value = !1, d.value = {};
1104
+ }), o("refreshHistory"), x.value = !1, h.value = {};
1103
1105
  }
1104
- function y(n, r, w) {
1106
+ function v(n, r, w) {
1105
1107
  return H({
1106
1108
  get: () => {
1107
- var D, E, P;
1108
- const M = (P = (E = (D = d.value) == null ? void 0 : D[n]) == null ? void 0 : E[r]) == null ? void 0 : P.amount;
1109
- return M ? C(M, !0) : 0;
1109
+ var M, E, P;
1110
+ const B = (P = (E = (M = h.value) == null ? void 0 : M[n]) == null ? void 0 : E[r]) == null ? void 0 : P.amount;
1111
+ return B ? $(B, !0) : 0;
1110
1112
  },
1111
- set: (M) => {
1112
- d.value || (d.value = {});
1113
- const D = { ...d.value };
1114
- D[n] || (D[n] = {}), D[n][r] = {
1115
- amount: Ce.fromNumber(M),
1113
+ set: (B) => {
1114
+ h.value || (h.value = {});
1115
+ const M = { ...h.value };
1116
+ M[n] || (M[n] = {}), M[n][r] = {
1117
+ amount: Ce.fromNumber(B),
1116
1118
  type: ne.Enum.WASTAGE,
1117
1119
  measurement: w
1118
- }, d.value = D;
1120
+ }, h.value = M;
1119
1121
  }
1120
1122
  });
1121
1123
  }
1122
- function C(n, r = !0) {
1124
+ function $(n, r = !0) {
1123
1125
  const w = Number(Ce.toFormatString({ value: n }));
1124
1126
  return r ? Math.abs(w) : w;
1125
1127
  }
@@ -1130,20 +1132,20 @@ const Ie = {
1130
1132
  return r === 0 ? "N/A" : (n + r).toString();
1131
1133
  }
1132
1134
  return (n, r) => {
1133
- const w = I("FmIcon"), M = I("FmStepperField"), D = I("FmCard"), E = I("FmForm"), P = I("FmSpacer"), Q = I("FmButton"), J = I("FmDialog");
1134
- return F(), K(J, {
1135
- modelValue: S.value,
1136
- "onUpdate:modelValue": r[4] || (r[4] = (R) => S.value = R),
1135
+ const w = D("FmIcon"), B = D("FmStepperField"), M = D("FmCard"), E = D("FmForm"), P = D("FmSpacer"), J = D("FmButton"), Q = D("FmDialog");
1136
+ return F(), K(Q, {
1137
+ modelValue: x.value,
1138
+ "onUpdate:modelValue": r[4] || (r[4] = (R) => x.value = R),
1137
1139
  overlay: !0
1138
1140
  }, {
1139
- "dialog-button": j(() => [
1140
- g(lt, null, {
1141
- default: j(() => [
1141
+ "dialog-button": I(() => [
1142
+ k(Pe, null, {
1143
+ default: I(() => [
1142
1144
  e("button", {
1143
- onClick: r[0] || (r[0] = (R) => S.value = !0),
1145
+ onClick: r[0] || (r[0] = (R) => x.value = !0),
1144
1146
  class: "rounded-md hover:bg-gray-100 transition-colors"
1145
1147
  }, [
1146
- g(w, {
1148
+ k(w, {
1147
1149
  name: "edit",
1148
1150
  size: "sm"
1149
1151
  })
@@ -1152,22 +1154,22 @@ const Ie = {
1152
1154
  _: 1
1153
1155
  })
1154
1156
  ]),
1155
- "dialog-header": j(() => r[5] || (r[5] = [
1157
+ "dialog-header": I(() => r[5] || (r[5] = [
1156
1158
  e("div", null, "Amend Adjustment", -1)
1157
1159
  ])),
1158
- "dialog-footer": j(() => [
1160
+ "dialog-footer": I(() => [
1159
1161
  e("div", Hn, [
1160
1162
  r[13] || (r[13] = e("span", { class: "text-fm-color-system-warning-400 fm-typo-en-body-sm-400" }, "1. New adjustment EXTRA will be created for each reversal", -1)),
1161
1163
  e("div", Pn, [
1162
- g(P),
1163
- g(Q, {
1164
+ k(P),
1165
+ k(J, {
1164
1166
  class: "sm:w-full xs:w-full",
1165
1167
  label: "Close",
1166
1168
  size: "md",
1167
1169
  variant: "tertiary",
1168
- onClick: r[3] || (r[3] = (R) => S.value = !1)
1170
+ onClick: r[3] || (r[3] = (R) => x.value = !1)
1169
1171
  }),
1170
- g(Q, {
1172
+ k(J, {
1171
1173
  class: "sm:w-full xs:w-full",
1172
1174
  label: "Submit",
1173
1175
  size: "md",
@@ -1177,65 +1179,65 @@ const Ie = {
1177
1179
  ])
1178
1180
  ])
1179
1181
  ]),
1180
- default: j(() => [
1181
- m.value ? (F(), O("div", Mn)) : (F(), K(E, {
1182
+ default: I(() => [
1183
+ d.value ? (F(), O("div", Bn)) : (F(), K(E, {
1182
1184
  key: 1,
1183
1185
  ref_key: "formRef",
1184
- ref: i,
1186
+ ref: c,
1185
1187
  onValidationFailed: r[1] || (r[1] = () => {
1186
- v.value = !1;
1188
+ i.value = !1;
1187
1189
  }),
1188
1190
  onValidationSuccess: r[2] || (r[2] = () => {
1189
- v.value = !0;
1191
+ i.value = !0;
1190
1192
  }),
1191
1193
  blameFormChildOnValidationFailed: ""
1192
1194
  }, {
1193
- default: j(() => [
1194
- e("p", Bn, [
1195
+ default: I(() => [
1196
+ e("p", Mn, [
1195
1197
  r[6] || (r[6] = e("b", null, "Date:", -1)),
1196
1198
  r[7] || (r[7] = e("br", null, null, -1)),
1197
- ue(" " + b(u(St)(u(Ft)(B.value._id))), 1)
1199
+ ue(" " + _(u(St)(u(Ft)(C.value._id))), 1)
1198
1200
  ]),
1199
1201
  e("div", Dn, [
1200
- (F(!0), O(Z, null, ie(B.value.skus, (R, oe) => (F(), O(Z, { key: oe }, [
1201
- (F(!0), O(Z, null, ie(R.amounts, (L, Y) => (F(), K(D, {
1202
+ (F(!0), O(Z, null, ie(C.value.skus, (R, oe) => (F(), O(Z, { key: oe }, [
1203
+ (F(!0), O(Z, null, ie(R.amounts, (L, Y) => (F(), K(M, {
1202
1204
  key: Y,
1203
1205
  variant: "outlined",
1204
1206
  class: "p-2"
1205
1207
  }, {
1206
- default: j(() => [
1208
+ default: I(() => [
1207
1209
  e("div", In, [
1208
- e("span", jn, b(R.sku.code), 1),
1209
- e("span", null, b(R.sku.name), 1)
1210
+ e("span", jn, _(R.sku.code), 1),
1211
+ e("span", null, _(R.sku.name), 1)
1210
1212
  ]),
1211
1213
  r[12] || (r[12] = e("hr", { class: "m-2" }, null, -1)),
1212
1214
  e("div", Tn, [
1213
1215
  r[8] || (r[8] = e("span", { class: "fm-typo-en-body-lg-600" }, "Adjustment type:", -1)),
1214
- e("span", null, b(L.type), 1)
1216
+ e("span", null, _(L.type), 1)
1215
1217
  ]),
1216
1218
  e("div", Un, [
1217
1219
  r[9] || (r[9] = e("span", { class: "fm-typo-en-body-lg-600" }, "Current amount:", -1)),
1218
- e("span", null, b(u(Ce).toFormatString({ value: L.amount })) + " " + b(A(R, L)), 1)
1220
+ e("span", null, _(u(Ce).toFormatString({ value: L.amount })) + " " + _(A(R, L)), 1)
1219
1221
  ]),
1220
- g(M, {
1221
- "model-value": y(R.sku._id, Y).value,
1222
- "onUpdate:modelValue": (le) => y(R.sku._id, Y).value = le,
1222
+ k(B, {
1223
+ "model-value": v(R.sku._id, Y).value,
1224
+ "onUpdate:modelValue": (le) => v(R.sku._id, Y).value = le,
1223
1225
  class: "mb-3",
1224
1226
  label: "Adjust Amount (Leave 0 to skip)",
1225
- "helper-text": `Max: ${C(L.amount)}`,
1227
+ "helper-text": `Max: ${$(L.amount)}`,
1226
1228
  "append-text": A(R, L),
1227
1229
  rules: [
1228
- (le) => le <= C(L.amount) || `Cannot be more than ${C(L.amount)}`,
1230
+ (le) => le <= $(L.amount) || `Cannot be more than ${$(L.amount)}`,
1229
1231
  u(Fe)(-1)
1230
1232
  ]
1231
1233
  }, null, 8, ["model-value", "onUpdate:modelValue", "helper-text", "append-text", "rules"]),
1232
1234
  e("div", En, [
1233
1235
  r[10] || (r[10] = e("span", { class: "fm-typo-en-body-lg-600" }, "Amount after amend:", -1)),
1234
1236
  r[11] || (r[11] = e("span", { class: "text-fm-color-system-warning-400 fm-typo-en-body-sm-400" }, "* It's an estimate for your reference, as it didn't include all the reversals related to this adjustment", -1)),
1235
- ue(" " + b(V(
1236
- C(L.amount, !1),
1237
- y(R.sku._id, Y).value
1238
- )) + " " + b(A(R, L)), 1)
1237
+ ue(" " + _(V(
1238
+ $(L.amount, !1),
1239
+ v(R.sku._id, Y).value
1240
+ )) + " " + _(A(R, L)), 1)
1239
1241
  ])
1240
1242
  ]),
1241
1243
  _: 2
@@ -1259,10 +1261,10 @@ const Ie = {
1259
1261
  }, Xn = {
1260
1262
  key: 2,
1261
1263
  class: "inline-flex items-center rounded-md bg-yellow-400/10 px-2 text-xs font-medium text-yellow-500 inset-ring inset-ring-yellow-400/20"
1262
- }, Jn = {
1264
+ }, Qn = {
1263
1265
  key: 1,
1264
1266
  class: "shrink-0 text-fm-color-typo-secondary"
1265
- }, Qn = /* @__PURE__ */ ce({
1267
+ }, Jn = /* @__PURE__ */ ce({
1266
1268
  __name: "StockRecordCard",
1267
1269
  props: {
1268
1270
  record: {},
@@ -1270,25 +1272,25 @@ const Ie = {
1270
1272
  bills: { default: () => [] }
1271
1273
  },
1272
1274
  emits: ["refreshHistory"],
1273
- setup(k, { emit: h }) {
1274
- const c = k, s = N(!1);
1275
- at();
1276
- const $ = N(), d = N(null), m = H(() => d.value === null ? "unset" : s.value ? `${d.value}px` : "0px");
1275
+ setup(b, { emit: g }) {
1276
+ const p = b, o = N(!1);
1277
+ Ne();
1278
+ const j = N(), h = N(null), d = H(() => h.value === null ? "unset" : o.value ? `${h.value}px` : "0px");
1277
1279
  Ee(() => {
1278
- var i;
1279
- d.value = ((i = $.value) == null ? void 0 : i.scrollHeight) || 0;
1280
+ var c;
1281
+ h.value = ((c = j.value) == null ? void 0 : c.scrollHeight) || 0;
1280
1282
  });
1281
- const v = H(() => {
1283
+ const i = H(() => {
1282
1284
  var V;
1283
- const i = c.record.adjustments, l = c.sku, y = {}, A = i.flatMap((n) => {
1285
+ const c = p.record.adjustments, l = p.sku, v = {}, A = c.flatMap((n) => {
1284
1286
  var r;
1285
1287
  return ((r = n.skus) == null ? void 0 : r.filter((w) => w.sku._id === l._id)) ?? [];
1286
1288
  }).flatMap((n) => n.amounts);
1287
1289
  for (const n of A) {
1288
1290
  const r = n.measurement ? wt(n.measurement.conversion, n.amount) : n.amount;
1289
- y[V = n.type] ?? (y[V] = { amount: 0, precision: 0 }), y[n.type] = et(r, y[n.type]);
1291
+ v[V = n.type] ?? (v[V] = { amount: 0, precision: 0 }), v[n.type] = nt(r, v[n.type]);
1290
1292
  }
1291
- return Object.entries(y).reduce(
1293
+ return Object.entries(v).reduce(
1292
1294
  (n, [r, w]) => (n[r] = /// comment, because without it formatter makes code uglier
1293
1295
  `${X.toFormatString({
1294
1296
  value: w,
@@ -1296,109 +1298,109 @@ const Ie = {
1296
1298
  })} ${l.unit.abbrev}`, n),
1297
1299
  {}
1298
1300
  );
1299
- }), { t: S } = de(), B = H(() => c.record.adjustmentsByTime.map(({ date: i, adjustments: l }) => ({
1300
- time: $t(new Date(i)),
1301
+ }), { t: x } = de(), C = H(() => p.record.adjustmentsByTime.map(({ date: c, adjustments: l }) => ({
1302
+ time: $t(new Date(c)),
1301
1303
  adjustments: l.flatMap(
1302
- (y) => {
1303
- var C, A;
1304
- return ((A = (C = y.skus) == null ? void 0 : C.map) == null ? void 0 : A.call(C, (V) => {
1304
+ (v) => {
1305
+ var $, A;
1306
+ return ((A = ($ = v.skus) == null ? void 0 : $.map) == null ? void 0 : A.call($, (V) => {
1305
1307
  var n, r;
1306
1308
  return {
1307
1309
  ...V,
1308
- ref: y.ref,
1309
- backdateFrom: y.effectiveAt != null ? ot(y._id) : null,
1310
- toBalance: (r = (n = y.skus) == null ? void 0 : n[0]) == null ? void 0 : r.toBalance,
1311
- adjustmentId: y._id
1310
+ ref: v.ref,
1311
+ backdateFrom: v.effectiveAt != null ? at(v._id) : null,
1312
+ toBalance: (r = (n = v.skus) == null ? void 0 : n[0]) == null ? void 0 : r.toBalance,
1313
+ adjustmentId: v._id
1312
1314
  };
1313
1315
  })) ?? [];
1314
1316
  }
1315
- ).flatMap((y) => {
1317
+ ).flatMap((v) => {
1316
1318
  var V;
1317
- const C = (V = c.bills.find((n) => n._id === y.ref)) == null ? void 0 : V.seqNumber, A = C ? S("inventory.stock.record.bill", [C]) : "";
1318
- return y.amounts.map((n) => {
1319
+ const $ = (V = p.bills.find((n) => n._id === v.ref)) == null ? void 0 : V.seqNumber, A = $ ? x("inventory.stock.record.bill", [$]) : "";
1320
+ return v.amounts.map((n) => {
1319
1321
  var r;
1320
1322
  return {
1321
- amount: `${X.toFormatString({ value: n.amount, precision: 4 })} ${((r = n.measurement) == null ? void 0 : r.abbrev) ?? y.sku.unit.abbrev}`,
1322
- backdateFrom: y.backdateFrom,
1323
+ amount: `${X.toFormatString({ value: n.amount, precision: 4 })} ${((r = n.measurement) == null ? void 0 : r.abbrev) ?? v.sku.unit.abbrev}`,
1324
+ backdateFrom: v.backdateFrom,
1323
1325
  name: n.type,
1324
1326
  remark: n.remark || A || "",
1325
1327
  cost: n.cost,
1326
1328
  toBalance: X.toFormatString({
1327
- value: y.toBalance ?? X.fromNumber(0),
1329
+ value: v.toBalance ?? X.fromNumber(0),
1328
1330
  precision: 4
1329
1331
  }),
1330
- baseUnit: y.sku.unit.abbrev,
1331
- adjustmentId: y.adjustmentId
1332
+ baseUnit: v.sku.unit.abbrev,
1333
+ adjustmentId: v.adjustmentId
1332
1334
  };
1333
1335
  });
1334
1336
  })
1335
1337
  })));
1336
- return (i, l) => {
1337
- const y = I("FmIcon"), C = I("FmTooltip"), A = I("FmCard");
1338
+ return (c, l) => {
1339
+ const v = D("FmIcon"), $ = D("FmTooltip"), A = D("FmCard");
1338
1340
  return F(), K(A, { variant: "outlined" }, {
1339
- default: j(() => [
1341
+ default: I(() => [
1340
1342
  e("div", On, [
1341
1343
  e("div", {
1342
1344
  class: "flex items-center cursor-pointer mb-1",
1343
- onClick: l[0] || (l[0] = (V) => s.value = !s.value)
1345
+ onClick: l[0] || (l[0] = (V) => o.value = !o.value)
1344
1346
  }, [
1345
- e("div", Nn, b(i.record.date), 1),
1346
- g(y, {
1347
- name: s.value ? "expand_more" : "expand_less",
1347
+ e("div", Nn, _(c.record.date), 1),
1348
+ k(v, {
1349
+ name: o.value ? "expand_more" : "expand_less",
1348
1350
  color: "#777777",
1349
1351
  size: "md"
1350
1352
  }, null, 8, ["name"])
1351
1353
  ]),
1352
- (F(!0), O(Z, null, ie(v.value, (V, n) => (F(), O("div", {
1354
+ (F(!0), O(Z, null, ie(i.value, (V, n) => (F(), O("div", {
1353
1355
  key: n,
1354
1356
  class: "flex flex-row py-1",
1355
1357
  style: { "font-size": "0.8rem" }
1356
1358
  }, [
1357
- e("div", Ln, b(u(S)(`inventory.inventoryAdjustment.type.${n}`)), 1),
1359
+ e("div", Ln, _(u(x)(`inventory.inventoryAdjustment.type.${n}`)), 1),
1358
1360
  e("div", {
1359
1361
  class: he({
1360
1362
  "text-fm-color-typo-error": V.startsWith("-"),
1361
1363
  "text-fm-color-typo-success": !V.startsWith("-"),
1362
1364
  "ml-auto": !0
1363
1365
  })
1364
- }, b(V), 3)
1366
+ }, _(V), 3)
1365
1367
  ]))), 128)),
1366
1368
  e("div", {
1367
1369
  ref_key: "detailRef",
1368
- ref: $,
1369
- style: Ze({
1370
+ ref: j,
1371
+ style: tt({
1370
1372
  fontSize: "0.8rem",
1371
- maxHeight: m.value,
1373
+ maxHeight: d.value,
1372
1374
  overflow: "hidden",
1373
1375
  transition: "max-height 0.2s ease-out"
1374
1376
  })
1375
1377
  }, [
1376
- B.value.length ? (F(), O("hr", zn)) : te("", !0),
1377
- (F(!0), O(Z, null, ie(B.value, (V) => (F(), O("div", {
1378
+ C.value.length ? (F(), O("hr", zn)) : te("", !0),
1379
+ (F(!0), O(Z, null, ie(C.value, (V) => (F(), O("div", {
1378
1380
  key: V.time,
1379
1381
  class: "flex gap-1 w-full"
1380
1382
  }, [
1381
- e("div", Yn, b(V.time), 1),
1383
+ e("div", Yn, _(V.time), 1),
1382
1384
  e("div", Kn, [
1383
1385
  (F(!0), O(Z, null, ie(V.adjustments, (n) => (F(), O("div", {
1384
1386
  key: n.name,
1385
1387
  class: "flex gap-1"
1386
1388
  }, [
1387
1389
  e("div", Gn, [
1388
- ue(b(u(S)(`inventory.inventoryAdjustment.type.${n.name}`)) + " ", 1),
1389
- n.backdateFrom ? (F(), K(C, {
1390
+ ue(_(u(x)(`inventory.inventoryAdjustment.type.${n.name}`)) + " ", 1),
1391
+ n.backdateFrom ? (F(), K($, {
1390
1392
  key: 0,
1391
1393
  variant: "plain",
1392
1394
  placement: "top",
1393
1395
  "z-index": 50
1394
1396
  }, {
1395
- content: j(() => [
1396
- e("div", Wn, b(u(S)("inventory.stock.record.backdate", [
1397
- u(tt)(new Date(n.backdateFrom))
1397
+ content: I(() => [
1398
+ e("div", Wn, _(u(x)("inventory.stock.record.backdate", [
1399
+ u(ot)(new Date(n.backdateFrom))
1398
1400
  ])), 1)
1399
1401
  ]),
1400
- default: j(() => [
1401
- g(y, {
1402
+ default: I(() => [
1403
+ k(v, {
1402
1404
  name: "info",
1403
1405
  size: "sm",
1404
1406
  color: "primary"
@@ -1406,8 +1408,8 @@ const Ie = {
1406
1408
  ]),
1407
1409
  _: 2
1408
1410
  }, 1024)) : te("", !0),
1409
- n.remark ? (F(), O("span", qn, " # " + b(n.remark), 1)) : te("", !0),
1410
- n.name === u(ne).Enum.CLOSING ? (F(), O("span", Xn, " Actual Balance: " + b(n.toBalance) + " " + b(n.baseUnit), 1)) : te("", !0)
1411
+ n.remark ? (F(), O("span", qn, " # " + _(n.remark), 1)) : te("", !0),
1412
+ n.name === u(ne).Enum.CLOSING ? (F(), O("span", Xn, " Actual Balance: " + _(n.toBalance) + " " + _(n.baseUnit), 1)) : te("", !0)
1411
1413
  ]),
1412
1414
  e("div", {
1413
1415
  class: he({
@@ -1415,13 +1417,13 @@ const Ie = {
1415
1417
  "text-fm-color-typo-success": !n.amount.startsWith("-"),
1416
1418
  "ml-auto": !0
1417
1419
  })
1418
- }, b(n.amount), 3),
1420
+ }, _(n.amount), 3),
1419
1421
  n.name === u(ne).Enum.WASTAGE ? (F(), K(Rn, {
1420
1422
  key: 0,
1421
1423
  adjustmentId: n.adjustmentId,
1422
- onRefreshHistory: l[1] || (l[1] = (r) => i.$emit("refreshHistory"))
1424
+ onRefreshHistory: l[1] || (l[1] = (r) => c.$emit("refreshHistory"))
1423
1425
  }, null, 8, ["adjustmentId"])) : te("", !0),
1424
- n.cost ? (F(), O("div", Jn, " (" + b(u(ke)(n.cost, !1, n.cost.precision)) + ") ", 1)) : te("", !0)
1426
+ n.cost ? (F(), O("div", Qn, " (" + _(u(ke)(n.cost, !1, n.cost.precision)) + ") ", 1)) : te("", !0)
1425
1427
  ]))), 128))
1426
1428
  ])
1427
1429
  ]))), 128))
@@ -1433,64 +1435,64 @@ const Ie = {
1433
1435
  };
1434
1436
  }
1435
1437
  });
1436
- function Zn(k, h) {
1437
- var d;
1438
- const c = Object.keys(ne.enum).reduce(
1439
- (m, v) => (m[v] = { amount: 0, precision: 0 }, m),
1438
+ function Zn(b, g) {
1439
+ var h;
1440
+ const p = Object.keys(ne.enum).reduce(
1441
+ (d, i) => (d[i] = { amount: 0, precision: 0 }, d),
1440
1442
  {}
1441
1443
  );
1442
- if (!h)
1443
- return Object.entries(c).reduce(
1444
- (m, [v]) => (m[v] = X.fromNumber(0), m),
1444
+ if (!g)
1445
+ return Object.entries(p).reduce(
1446
+ (d, [i]) => (d[i] = X.fromNumber(0), d),
1445
1447
  {}
1446
1448
  );
1447
- const $ = k.flatMap((m) => {
1448
- var v;
1449
- return ((v = m.skus) == null ? void 0 : v.filter((S) => S.sku._id === h._id)) ?? [];
1450
- }).flatMap((m) => m.amounts);
1451
- for (const m of $) {
1452
- const v = m.measurement ? X.multiply([m.measurement.conversion, m.amount]) : m.amount;
1453
- c[d = m.type] ?? (c[d] = { amount: 0, precision: 0 }), c[m.type] = X.add([v, c[m.type]]);
1449
+ const j = b.flatMap((d) => {
1450
+ var i;
1451
+ return ((i = d.skus) == null ? void 0 : i.filter((x) => x.sku._id === g._id)) ?? [];
1452
+ }).flatMap((d) => d.amounts);
1453
+ for (const d of j) {
1454
+ const i = d.measurement ? X.multiply([d.measurement.conversion, d.amount]) : d.amount;
1455
+ p[h = d.type] ?? (p[h] = { amount: 0, precision: 0 }), p[d.type] = X.add([i, p[d.type]]);
1454
1456
  }
1455
- return Object.entries(c).reduce(
1456
- (m, [v, S]) => {
1457
- const B = {
1458
- ...S,
1459
- amount: Math.abs(S.amount)
1457
+ return Object.entries(p).reduce(
1458
+ (d, [i, x]) => {
1459
+ const C = {
1460
+ ...x,
1461
+ amount: Math.abs(x.amount)
1460
1462
  };
1461
- return m[v] = /// comment, because without it formatter makes code uglier
1463
+ return d[i] = /// comment, because without it formatter makes code uglier
1462
1464
  `${X.toFormatString({
1463
- value: B,
1465
+ value: C,
1464
1466
  precision: 4
1465
- })} ${h.unit.abbrev}`, m;
1467
+ })} ${g.unit.abbrev}`, d;
1466
1468
  },
1467
1469
  {}
1468
1470
  );
1469
1471
  }
1470
- function eo(k, h) {
1471
- if (!h)
1472
+ function eo(b, g) {
1473
+ if (!g)
1472
1474
  return null;
1473
- let c = null;
1474
- const $ = k.flatMap((d) => {
1475
- var m;
1476
- return ((m = d.skus) == null ? void 0 : m.filter((v) => v.sku._id === h._id)) ?? [];
1477
- }).flatMap((d) => {
1478
- var m;
1479
- return !d.history || ((m = d.history) == null ? void 0 : m.length) === 0 ? [] : d.history[0];
1475
+ let p = null;
1476
+ const j = b.flatMap((h) => {
1477
+ var d;
1478
+ return ((d = h.skus) == null ? void 0 : d.filter((i) => i.sku._id === g._id)) ?? [];
1479
+ }).flatMap((h) => {
1480
+ var d;
1481
+ return !h.history || ((d = h.history) == null ? void 0 : d.length) === 0 ? [] : h.history[0];
1480
1482
  });
1481
- for (const d of $) {
1482
- const m = d.amounts;
1483
- for (const v of m) {
1484
- if (v.type !== ne.Enum.SALES)
1483
+ for (const h of j) {
1484
+ const d = h.amounts;
1485
+ for (const i of d) {
1486
+ if (i.type !== ne.Enum.SALES)
1485
1487
  continue;
1486
- const S = v.measurement ? X.multiply([v.measurement.conversion, v.amount]) : v.amount;
1487
- c ?? (c = X.fromNumber(0)), c = X.add([c, S]);
1488
+ const x = i.measurement ? X.multiply([i.measurement.conversion, i.amount]) : i.amount;
1489
+ p ?? (p = X.fromNumber(0)), p = X.add([p, x]);
1488
1490
  }
1489
1491
  }
1490
- return c != null ? (c.amount = Math.abs(c.amount), `${X.toFormatString({
1491
- value: c,
1492
+ return p != null ? (p.amount = Math.abs(p.amount), `${X.toFormatString({
1493
+ value: p,
1492
1494
  precision: 4
1493
- })} ${h.unit.abbrev}`) : null;
1495
+ })} ${g.unit.abbrev}`) : null;
1494
1496
  }
1495
1497
  const to = { class: "flex items-center w-full fm-typo-en-title-md-800" }, no = { class: "flex-1 line-clamp-2" }, oo = { class: "flex flex-col gap-32 w-full h-full" }, so = { class: "flex items-center relative gap-4" }, ao = { class: "flex-1" }, lo = {
1496
1498
  key: 0,
@@ -1501,222 +1503,222 @@ const to = { class: "flex items-center w-full fm-typo-en-title-md-800" }, no = {
1501
1503
  }, uo = { class: "pb-16" }, co = { class: "fm-typo-cn-body-lg-600" }, mo = {
1502
1504
  class: "grid gap-12 fm-typo-en-body-md-400",
1503
1505
  style: { "grid-template-columns": "auto auto auto", "grid-auto-rows": "1fr" }
1504
- }, po = { class: "flex flex-col gap-1" }, vo = { class: "text-fm-color-typo-secondary" }, fo = { class: "font-bold" }, yo = { class: "flex flex-col gap-1" }, _o = { class: "text-fm-color-typo-secondary flex" }, bo = { class: "font-bold" }, ko = { class: "flex flex-col gap-1" }, go = { class: "text-fm-color-typo-secondary" }, ho = { class: "font-bold" }, xo = { class: "flex flex-col gap-1" }, So = { class: "text-fm-color-typo-secondary" }, Fo = { class: "font-bold" }, wo = { class: "flex flex-col gap-1" }, $o = { class: "text-fm-color-typo-secondary" }, Ao = { class: "font-bold" }, Vo = { class: "flex flex-col gap-1" }, Co = { class: "text-fm-color-typo-secondary" }, Mo = { class: "font-bold" }, Bo = { class: "flex flex-col gap-1" }, Do = { class: "text-fm-color-typo-secondary" }, Io = { class: "font-bold" }, jo = { class: "flex flex-col gap-1" }, To = { class: "text-fm-color-typo-secondary" }, Uo = { class: "font-bold" }, Eo = { class: "flex flex-col gap-1" }, Ho = { class: "text-fm-color-typo-secondary" }, Po = { class: "font-bold" }, Ro = {
1506
+ }, po = { class: "flex flex-col gap-1" }, vo = { class: "text-fm-color-typo-secondary" }, fo = { class: "font-bold" }, yo = { class: "flex flex-col gap-1" }, _o = { class: "text-fm-color-typo-secondary flex" }, bo = { class: "font-bold" }, ko = { class: "flex flex-col gap-1" }, go = { class: "text-fm-color-typo-secondary" }, ho = { class: "font-bold" }, xo = { class: "flex flex-col gap-1" }, So = { class: "text-fm-color-typo-secondary" }, Fo = { class: "font-bold" }, wo = { class: "flex flex-col gap-1" }, $o = { class: "text-fm-color-typo-secondary" }, Ao = { class: "font-bold" }, Vo = { class: "flex flex-col gap-1" }, Co = { class: "text-fm-color-typo-secondary" }, Bo = { class: "font-bold" }, Mo = { class: "flex flex-col gap-1" }, Do = { class: "text-fm-color-typo-secondary" }, Io = { class: "font-bold" }, jo = { class: "flex flex-col gap-1" }, To = { class: "text-fm-color-typo-secondary" }, Uo = { class: "font-bold" }, Eo = { class: "flex flex-col gap-1" }, Ho = { class: "text-fm-color-typo-secondary" }, Po = { class: "font-bold" }, Ro = {
1505
1507
  key: 0,
1506
1508
  class: "flex flex-col gap-8"
1507
1509
  }, Oo = { class: "flex" }, No = { class: "flex-1 flex flex-col gap-1" }, Lo = { class: "flex gap-1 items-center text-fm-color-typo-secondary" }, zo = { class: "font-bold" }, Yo = { class: "flex-1 flex flex-col gap-1" }, Ko = { class: "flex gap-1 items-center text-fm-color-typo-secondary" }, Go = { class: "flex flex-col gap-1" }, Wo = { class: "font-bold" }, qo = {
1508
1510
  key: 2,
1509
1511
  class: "flex-1 flex flex-col items-center gap-8"
1510
- }, Xo = ["src"], Jo = { class: "font-bold text-lg" }, Qo = { class: "text-xs text-neutral-400 text-center" }, Zo = /* @__PURE__ */ ce({
1512
+ }, Xo = ["src"], Qo = { class: "font-bold text-lg" }, Jo = { class: "text-xs text-neutral-400 text-center" }, Zo = /* @__PURE__ */ ce({
1511
1513
  __name: "StockHistory",
1512
1514
  props: {
1513
1515
  sku: {},
1514
1516
  show: { type: Boolean }
1515
1517
  },
1516
1518
  emits: ["update:show"],
1517
- setup(k) {
1518
- const h = at(), c = Re(), s = _e(), $ = Cn(), d = pe(), m = Mt(), { t: v } = de(), S = k, B = N(!1), i = be(), l = N(At(0));
1519
- async function y() {
1520
- B.value = !0;
1519
+ setup(b) {
1520
+ const g = Ne(), p = Oe(), o = _e(), j = Cn(), h = ve(), d = Bt(), { t: i } = de(), x = b, C = N(!1), c = be(), l = N(At(0));
1521
+ async function v() {
1522
+ C.value = !0;
1521
1523
  try {
1522
- await w(), await c.readStockBalance();
1524
+ await w(), await p.readStockBalance();
1523
1525
  } catch (t) {
1524
- i.open({
1526
+ c.open({
1525
1527
  title: "Something went wrong",
1526
1528
  message: "Cannot fetch stock history. Please try again.",
1527
1529
  type: "error"
1528
- }), console.log("failed at fetching item adjustment history", S.sku, l, t);
1530
+ }), console.log("failed at fetching item adjustment history", x.sku, l, t);
1529
1531
  } finally {
1530
- B.value = !1;
1532
+ C.value = !1;
1531
1533
  }
1532
1534
  }
1533
1535
  Ee(() => {
1534
- y();
1535
- }), xe([() => l.value, () => S.sku], () => {
1536
- y();
1536
+ v();
1537
+ }), xe([() => l.value, () => x.sku], () => {
1538
+ v();
1537
1539
  });
1538
- const C = N([]), A = N([]), V = N(new Array());
1539
- function n(t, o) {
1540
- return o === "day" ? Tt(t) : tt(t);
1540
+ const $ = N([]), A = N([]), V = N(new Array());
1541
+ function n(t, s) {
1542
+ return s === "day" ? Tt(t) : ot(t);
1541
1543
  }
1542
- function r(t, o) {
1544
+ function r(t, s) {
1543
1545
  const f = t.reduce(
1544
- (p, a) => {
1545
- const x = a.effectiveAt ?? ot(a._id);
1546
- if (!x)
1547
- return p;
1548
- const U = n(new Date(x), o);
1549
- return p[U] ?? (p[U] = []), p[U].push(a), p;
1546
+ (m, a) => {
1547
+ const S = a.effectiveAt ?? at(a._id);
1548
+ if (!S)
1549
+ return m;
1550
+ const U = n(new Date(S), s);
1551
+ return m[U] ?? (m[U] = []), m[U].push(a), m;
1550
1552
  },
1551
1553
  {}
1552
1554
  );
1553
- return Object.keys(f).map((p) => ({
1554
- date: p,
1555
- adjustments: f[p]
1555
+ return Object.keys(f).map((m) => ({
1556
+ date: m,
1557
+ adjustments: f[m]
1556
1558
  }));
1557
1559
  }
1558
1560
  async function w() {
1559
- let t = await s.readStockAdjustment(
1560
- S.sku._id,
1561
- Bt(new Date(l.value.startDate)).toISOString(),
1561
+ let t = await o.readStockAdjustment(
1562
+ x.sku._id,
1563
+ Mt(new Date(l.value.startDate)).toISOString(),
1562
1564
  Dt(new Date(l.value.endDate)).toISOString()
1563
1565
  );
1564
- C.value = t;
1565
- const o = t.filter(({ ref: f }) => f == null ? void 0 : f.startsWith("bill_")).map(({ ref: f }) => f);
1566
- await M(o), A.value = r(t, "day").map(({ date: f, adjustments: p }) => ({
1566
+ $.value = t;
1567
+ const s = t.filter(({ ref: f }) => f == null ? void 0 : f.startsWith("bill_")).map(({ ref: f }) => f);
1568
+ await B(s), A.value = r(t, "day").map(({ date: f, adjustments: m }) => ({
1567
1569
  date: f,
1568
- adjustments: p,
1569
- adjustmentsByTime: r(p, "minute")
1570
+ adjustments: m,
1571
+ adjustmentsByTime: r(m, "minute")
1570
1572
  }));
1571
1573
  }
1572
- async function M(t) {
1573
- t.length && (V.value = await $.findBillsById(t).catch((o) => {
1574
+ async function B(t) {
1575
+ t.length && (V.value = await j.findBillsById(t).catch((s) => {
1574
1576
  var a;
1575
- console.error("Error on using latest bill API, retrying using legacy api", o);
1576
- const f = ((a = h.currentBusiness.value) == null ? void 0 : a._id) ?? "", p = d.currentLocation.doc._id;
1577
- return $.findBillsByBusinessId(f, [p], t);
1577
+ console.error("Error on using latest bill API, retrying using legacy api", s);
1578
+ const f = ((a = g.currentBusiness.value) == null ? void 0 : a._id) ?? "", m = h.currentLocation.doc._id;
1579
+ return j.findBillsByBusinessId(f, [m], t);
1578
1580
  }));
1579
1581
  }
1580
- const D = H(() => {
1581
- const t = C.value, o = S.sku;
1582
- return Zn(t, o);
1582
+ const M = H(() => {
1583
+ const t = $.value, s = x.sku;
1584
+ return Zn(t, s);
1583
1585
  }), E = H(() => {
1584
- const t = C.value, o = S.sku;
1585
- return eo(t, o);
1586
+ const t = $.value, s = x.sku;
1587
+ return eo(t, s);
1586
1588
  }), P = H(() => {
1587
- const t = [...C.value].computeFirst((f) => {
1588
- var a, x;
1589
- const p = (x = (a = f.skus) == null ? void 0 : a.find) == null ? void 0 : x.call(a, (U) => U.sku._id === S.sku._id);
1590
- return p == null ? void 0 : p.fromBalance;
1589
+ const t = [...$.value].computeFirst((f) => {
1590
+ var a, S;
1591
+ const m = (S = (a = f.skus) == null ? void 0 : a.find) == null ? void 0 : S.call(a, (U) => U.sku._id === x.sku._id);
1592
+ return m == null ? void 0 : m.fromBalance;
1591
1593
  }) ?? {
1592
1594
  amount: 0,
1593
1595
  precision: 0
1594
- }, o = S.sku;
1595
- return o ? `${X.toFormatString({
1596
+ }, s = x.sku;
1597
+ return s ? `${X.toFormatString({
1596
1598
  value: t,
1597
1599
  precision: 4
1598
- })} ${o.unit.abbrev}` : "";
1599
- }), Q = H(() => {
1600
- const t = [...C.value].reverse().computeFirst((f) => {
1601
- var a, x;
1602
- const p = (x = (a = f.skus) == null ? void 0 : a.find) == null ? void 0 : x.call(a, (U) => U.sku._id === S.sku._id);
1603
- return p == null ? void 0 : p.toBalance;
1600
+ })} ${s.unit.abbrev}` : "";
1601
+ }), J = H(() => {
1602
+ const t = [...$.value].reverse().computeFirst((f) => {
1603
+ var a, S;
1604
+ const m = (S = (a = f.skus) == null ? void 0 : a.find) == null ? void 0 : S.call(a, (U) => U.sku._id === x.sku._id);
1605
+ return m == null ? void 0 : m.toBalance;
1604
1606
  }) ?? {
1605
1607
  amount: 0,
1606
1608
  precision: 0
1607
- }, o = S.sku;
1608
- return o ? `${X.toFormatString({ value: t, precision: 4 })} ${o.unit.abbrev}` : "";
1609
- }), J = H(() => {
1609
+ }, s = x.sku;
1610
+ return s ? `${X.toFormatString({ value: t, precision: 4 })} ${s.unit.abbrev}` : "";
1611
+ }), Q = H(() => {
1610
1612
  var f;
1611
- const o = C.value.flatMap((p) => {
1613
+ const s = $.value.flatMap((m) => {
1612
1614
  var a;
1613
- return ((a = p.skus) == null ? void 0 : a.flatMap((x) => x.amounts)) ?? [];
1614
- }).filter((p) => p.amount.amount < 0).reduce(
1615
- (p, a) => {
1616
- const x = a.cost;
1617
- if (!x) return p;
1615
+ return ((a = m.skus) == null ? void 0 : a.flatMap((S) => S.amounts)) ?? [];
1616
+ }).filter((m) => m.amount.amount < 0).reduce(
1617
+ (m, a) => {
1618
+ const S = a.cost;
1619
+ if (!S) return m;
1618
1620
  const U = {
1619
- ...Vt(p, Math.max(p.precision, x.precision)),
1620
- currency: x.currency
1621
+ ...Vt(m, Math.max(m.precision, S.precision)),
1622
+ currency: S.currency
1621
1623
  };
1622
1624
  return {
1623
- ...et(U, x),
1624
- currency: p.currency
1625
+ ...nt(U, S),
1626
+ currency: m.currency
1625
1627
  };
1626
1628
  },
1627
1629
  {
1628
1630
  amount: 0,
1629
1631
  precision: 0,
1630
- currency: Me((f = h.currentCountry) == null ? void 0 : f.value)
1632
+ currency: Be((f = g.currentCountry) == null ? void 0 : f.value)
1631
1633
  }
1632
1634
  );
1633
- return ke(o, !1, o.precision);
1635
+ return ke(s, !1, s.precision);
1634
1636
  });
1635
1637
  function R() {
1636
- const { startDate: t, endDate: o } = It(l.value);
1637
- t !== null && o !== null && (l.value = {
1638
+ const { startDate: t, endDate: s } = It(l.value);
1639
+ t !== null && s !== null && (l.value = {
1638
1640
  startDate: t,
1639
- endDate: o
1641
+ endDate: s
1640
1642
  });
1641
1643
  }
1642
- const oe = H(() => S.sku.valuation === We.Enum.FIFO ? v("inventory.ingredient.valuationMethod.FIFO") : v("inventory.ingredient.valuationMethod.WAVG")), L = H(() => {
1644
+ const oe = H(() => x.sku.valuation === Xe.Enum.FIFO ? i("inventory.ingredient.valuationMethod.FIFO") : i("inventory.ingredient.valuationMethod.WAVG")), L = H(() => {
1643
1645
  var U, z, se, T;
1644
- const t = [...C.value].reverse().computeFirst((G) => {
1646
+ const t = [...$.value].reverse().computeFirst((G) => {
1645
1647
  var W, ae;
1646
- return (ae = (W = G.skus) == null ? void 0 : W.find) == null ? void 0 : ae.call(W, (re) => re.sku._id === S.sku._id);
1648
+ return (ae = (W = G.skus) == null ? void 0 : W.find) == null ? void 0 : ae.call(W, (re) => re.sku._id === x.sku._id);
1647
1649
  });
1648
1650
  if (!t) return "No data";
1649
- const o = [...t.amounts].reverse()[0], f = {
1650
- amount: ((U = o.cost) == null ? void 0 : U.amount) ?? 0,
1651
- precision: ((z = o.cost) == null ? void 0 : z.precision) ?? 0
1652
- }, p = o.amount, a = p.amount == 0 ? X.fromNumber(0) : X.divide([f, p]);
1651
+ const s = [...t.amounts].reverse()[0], f = {
1652
+ amount: ((U = s.cost) == null ? void 0 : U.amount) ?? 0,
1653
+ precision: ((z = s.cost) == null ? void 0 : z.precision) ?? 0
1654
+ }, m = s.amount, a = m.amount == 0 ? X.fromNumber(0) : X.divide([f, m]);
1653
1655
  return {
1654
- ...X.multiply([a, p]),
1655
- currency: ((se = o.cost) == null ? void 0 : se.currency) || Me(((T = h.currentCountry) == null ? void 0 : T.value) ?? Ct)
1656
+ ...X.multiply([a, m]),
1657
+ currency: ((se = s.cost) == null ? void 0 : se.currency) || Be(((T = g.currentCountry) == null ? void 0 : T.value) ?? Ct)
1656
1658
  };
1657
1659
  }), Y = H(() => {
1658
1660
  var f;
1659
- const t = [...C.value].reverse().computeFirst((p) => {
1660
- var x, U;
1661
- const a = (U = (x = p.skus) == null ? void 0 : x.find) == null ? void 0 : U.call(x, (z) => z.sku._id === S.sku._id);
1661
+ const t = [...$.value].reverse().computeFirst((m) => {
1662
+ var S, U;
1663
+ const a = (U = (S = m.skus) == null ? void 0 : S.find) == null ? void 0 : U.call(S, (z) => z.sku._id === x.sku._id);
1662
1664
  return a == null ? void 0 : a.toCostBalances;
1663
1665
  });
1664
1666
  return t ? {
1665
- ...t.reduce((p, a) => X.add([p, X.fromDinero(a.cost)]), {
1667
+ ...t.reduce((m, a) => X.add([m, X.fromDinero(a.cost)]), {
1666
1668
  amount: 0,
1667
1669
  precision: 0
1668
1670
  }),
1669
- currency: Me((f = h.currentCountry) == null ? void 0 : f.value)
1671
+ currency: Be((f = g.currentCountry) == null ? void 0 : f.value)
1670
1672
  } : "No data";
1671
1673
  });
1672
1674
  function le() {
1673
- const { startDate: t, endDate: o } = jt(l.value);
1674
- t !== null && o !== null && (l.value = {
1675
+ const { startDate: t, endDate: s } = jt(l.value);
1676
+ t !== null && s !== null && (l.value = {
1675
1677
  startDate: t,
1676
- endDate: o
1678
+ endDate: s
1677
1679
  });
1678
1680
  }
1679
- const _ = Ne(S, "show");
1680
- return (t, o) => {
1681
- const f = I("FmButton"), p = I("FmField"), a = I("FmDateRangePicker"), x = I("FmSpacer"), U = I("FmCircularProgress"), z = I("FmIcon"), se = I("FmTooltip"), T = I("FmMenuDivider"), G = I("FmChip"), W = I("FmCardSection"), ae = I("FmCard"), re = I("FmSideSheet");
1681
+ const y = ze(x, "show");
1682
+ return (t, s) => {
1683
+ const f = D("FmButton"), m = D("FmField"), a = D("FmDateRangePicker"), S = D("FmSpacer"), U = D("FmCircularProgress"), z = D("FmIcon"), se = D("FmTooltip"), T = D("FmMenuDivider"), G = D("FmChip"), W = D("FmCardSection"), ae = D("FmCard"), re = D("FmSideSheet");
1682
1684
  return F(), K(re, {
1683
1685
  "dismiss-away": "",
1684
- modelValue: u(_),
1685
- "onUpdate:modelValue": o[4] || (o[4] = (q) => Ue(_) ? _.value = q : null),
1686
+ modelValue: u(y),
1687
+ "onUpdate:modelValue": s[4] || (s[4] = (q) => Ue(y) ? y.value = q : null),
1686
1688
  "close-button": !1,
1687
1689
  "max-width": 560
1688
1690
  }, {
1689
- "side-sheet-header": j(() => [
1691
+ "side-sheet-header": I(() => [
1690
1692
  e("div", to, [
1691
- e("div", no, b(u(v)("inventory.stock.history.title", [t.sku.name])), 1),
1692
- g(f, {
1693
+ e("div", no, _(u(i)("inventory.stock.history.title", [t.sku.name])), 1),
1694
+ k(f, {
1693
1695
  variant: "tertiary",
1694
1696
  "prepend-icon": "close",
1695
- onClick: o[0] || (o[0] = (q) => _.value = !1)
1697
+ onClick: s[0] || (s[0] = (q) => y.value = !1)
1696
1698
  })
1697
1699
  ])
1698
1700
  ]),
1699
- default: j(() => {
1701
+ default: I(() => {
1700
1702
  var q;
1701
1703
  return [
1702
1704
  e("div", oo, [
1703
1705
  e("div", so, [
1704
1706
  e("div", ao, [
1705
- g(a, {
1707
+ k(a, {
1706
1708
  modelValue: l.value,
1707
- "onUpdate:modelValue": o[1] || (o[1] = (ee) => l.value = ee),
1709
+ "onUpdate:modelValue": s[1] || (s[1] = (ee) => l.value = ee),
1708
1710
  "show-predefined-range": "",
1709
1711
  "start-label": "",
1710
1712
  "end-label": "",
1711
1713
  "z-index": 50
1712
1714
  }, {
1713
- "trigger-button": j(({ opened: ee }) => [
1714
- g(p, {
1715
+ "trigger-button": I(({ opened: ee }) => [
1716
+ k(m, {
1715
1717
  "prepend-icon": "calendar_month",
1716
1718
  focused: ee
1717
1719
  }, {
1718
- default: j(() => [
1719
- ue(b(l.value.startDate) + " - " + b(l.value.endDate), 1)
1720
+ default: I(() => [
1721
+ ue(_(l.value.startDate) + " - " + _(l.value.endDate), 1)
1720
1722
  ]),
1721
1723
  _: 2
1722
1724
  }, 1032, ["focused"])
@@ -1724,39 +1726,39 @@ const to = { class: "flex items-center w-full fm-typo-en-title-md-800" }, no = {
1724
1726
  _: 1
1725
1727
  }, 8, ["modelValue"])
1726
1728
  ]),
1727
- g(f, {
1729
+ k(f, {
1728
1730
  variant: "tertiary",
1729
- onClick: o[2] || (o[2] = (ee) => R()),
1731
+ onClick: s[2] || (s[2] = (ee) => R()),
1730
1732
  "prepend-icon": "navigate_before"
1731
1733
  }),
1732
- g(f, {
1734
+ k(f, {
1733
1735
  variant: "tertiary",
1734
- onClick: o[3] || (o[3] = (ee) => le()),
1736
+ onClick: s[3] || (s[3] = (ee) => le()),
1735
1737
  "prepend-icon": "navigate_next"
1736
1738
  })
1737
1739
  ]),
1738
- B.value ? (F(), O("div", lo, [
1739
- g(x),
1740
- g(U, { size: "xl" }),
1741
- e("div", ro, b(u(v)("inventory.stock.history.loading")), 1),
1742
- g(x),
1743
- g(x)
1740
+ C.value ? (F(), O("div", lo, [
1741
+ k(S),
1742
+ k(U, { size: "xl" }),
1743
+ e("div", ro, _(u(i)("inventory.stock.history.loading")), 1),
1744
+ k(S),
1745
+ k(S)
1744
1746
  ])) : A.value && ((q = A.value) == null ? void 0 : q.length) > 0 ? (F(), O("div", io, [
1745
- g(ae, { variant: "outlined" }, {
1746
- default: j(() => [
1747
- g(W, { class: "flex flex-col gap-4" }, {
1748
- default: j(() => [
1747
+ k(ae, { variant: "outlined" }, {
1748
+ default: I(() => [
1749
+ k(W, { class: "flex flex-col gap-4" }, {
1750
+ default: I(() => [
1749
1751
  e("div", uo, [
1750
- e("div", co, b(u(v)("inventory.stock.history.summary.title")), 1)
1752
+ e("div", co, _(u(i)("inventory.stock.history.summary.title")), 1)
1751
1753
  ]),
1752
1754
  e("div", mo, [
1753
1755
  e("div", po, [
1754
- e("div", vo, b(u(v)("inventory.stock.history.summary.totalPurchase")), 1),
1755
- e("div", fo, b(D.value.PURCHASE), 1)
1756
+ e("div", vo, _(u(i)("inventory.stock.history.summary.totalPurchase")), 1),
1757
+ e("div", fo, _(M.value.PURCHASE), 1)
1756
1758
  ]),
1757
1759
  e("div", yo, [
1758
1760
  e("div", _o, [
1759
- ue(b(u(v)("inventory.stock.history.summary.totalSales")) + "  ", 1),
1761
+ ue(_(u(i)("inventory.stock.history.summary.totalSales")) + "  ", 1),
1760
1762
  E.value != null ? (F(), K(se, {
1761
1763
  key: 0,
1762
1764
  variant: "plain",
@@ -1764,8 +1766,8 @@ const to = { class: "flex items-center w-full fm-typo-en-title-md-800" }, no = {
1764
1766
  content: `Before: ${E.value}`,
1765
1767
  "z-index": 50
1766
1768
  }, {
1767
- default: j(() => [
1768
- g(z, {
1769
+ default: I(() => [
1770
+ k(z, {
1769
1771
  name: "warning",
1770
1772
  size: "sm"
1771
1773
  })
@@ -1773,53 +1775,53 @@ const to = { class: "flex items-center w-full fm-typo-en-title-md-800" }, no = {
1773
1775
  _: 1
1774
1776
  }, 8, ["content"])) : te("", !0)
1775
1777
  ]),
1776
- e("div", bo, b(D.value.SALES), 1)
1778
+ e("div", bo, _(M.value.SALES), 1)
1777
1779
  ]),
1778
1780
  e("div", ko, [
1779
- e("div", go, b(u(v)("inventory.stock.history.summary.totalLose")), 1),
1780
- e("div", ho, b(D.value.LOSE), 1)
1781
+ e("div", go, _(u(i)("inventory.stock.history.summary.totalLose")), 1),
1782
+ e("div", ho, _(M.value.LOSE), 1)
1781
1783
  ]),
1782
1784
  e("div", xo, [
1783
- e("div", So, b(u(v)("inventory.stock.history.summary.totalRequest")), 1),
1784
- e("div", Fo, b(D.value.REQUEST), 1)
1785
+ e("div", So, _(u(i)("inventory.stock.history.summary.totalRequest")), 1),
1786
+ e("div", Fo, _(M.value.REQUEST), 1)
1785
1787
  ]),
1786
1788
  e("div", wo, [
1787
- e("div", $o, b(u(v)("inventory.stock.history.summary.totalReceive")), 1),
1788
- e("div", Ao, b(D.value.RECEIVE), 1)
1789
+ e("div", $o, _(u(i)("inventory.stock.history.summary.totalReceive")), 1),
1790
+ e("div", Ao, _(M.value.RECEIVE), 1)
1789
1791
  ]),
1790
1792
  e("div", Vo, [
1791
- e("div", Co, b(u(v)("inventory.stock.history.summary.totalConvert")), 1),
1792
- e("div", Mo, b(D.value.CONVERT), 1)
1793
+ e("div", Co, _(u(i)("inventory.stock.history.summary.totalConvert")), 1),
1794
+ e("div", Bo, _(M.value.CONVERT), 1)
1793
1795
  ]),
1794
- e("div", Bo, [
1795
- e("div", Do, b(u(v)("inventory.stock.history.summary.totalDamage")), 1),
1796
- e("div", Io, b(D.value.DAMAGE), 1)
1796
+ e("div", Mo, [
1797
+ e("div", Do, _(u(i)("inventory.stock.history.summary.totalDamage")), 1),
1798
+ e("div", Io, _(M.value.DAMAGE), 1)
1797
1799
  ]),
1798
1800
  e("div", jo, [
1799
- e("div", To, b(u(v)("inventory.stock.history.summary.openingBalance")), 1),
1800
- e("div", Uo, b(P.value), 1)
1801
+ e("div", To, _(u(i)("inventory.stock.history.summary.openingBalance")), 1),
1802
+ e("div", Uo, _(P.value), 1)
1801
1803
  ]),
1802
1804
  e("div", Eo, [
1803
- e("div", Ho, b(u(v)("inventory.stock.history.summary.lastStockBalance")), 1),
1804
- e("div", Po, b(Q.value), 1)
1805
+ e("div", Ho, _(u(i)("inventory.stock.history.summary.lastStockBalance")), 1),
1806
+ e("div", Po, _(J.value), 1)
1805
1807
  ])
1806
1808
  ]),
1807
- u(m).enableTotalCost ? (F(), O("div", Ro, [
1808
- g(T, { class: "w-full" }),
1809
+ u(d).enableTotalCost ? (F(), O("div", Ro, [
1810
+ k(T, { class: "w-full" }),
1809
1811
  e("div", Oo, [
1810
1812
  e("div", No, [
1811
- g(Xe, { "z-index": 50 }, {
1812
- default: j(() => [
1813
+ k(Je, { "z-index": 50 }, {
1814
+ default: I(() => [
1813
1815
  e("div", Lo, [
1814
- ue(b(u(v)("inventory.stock.history.estimatedValue")) + " ", 1),
1815
- g(se, {
1816
+ ue(_(u(i)("inventory.stock.history.estimatedValue")) + " ", 1),
1817
+ k(se, {
1816
1818
  variant: "plain",
1817
1819
  placement: "top",
1818
- content: `[${oe.value}] ${u(v)("inventory.stock.history.estimatedValueTooltip")}`,
1820
+ content: `[${oe.value}] ${u(i)("inventory.stock.history.estimatedValueTooltip")}`,
1819
1821
  "z-index": 50
1820
1822
  }, {
1821
- default: j(() => [
1822
- g(z, {
1823
+ default: I(() => [
1824
+ k(z, {
1823
1825
  name: "help",
1824
1826
  size: "sm"
1825
1827
  })
@@ -1831,18 +1833,18 @@ const to = { class: "flex items-center w-full fm-typo-en-title-md-800" }, no = {
1831
1833
  _: 1
1832
1834
  }),
1833
1835
  e("div", zo, [
1834
- t.sku.valuation === u(We).Enum.FIFO ? (F(), O(Z, { key: 0 }, [
1835
- g(G, {
1836
+ t.sku.valuation === u(Xe).Enum.FIFO ? (F(), O(Z, { key: 0 }, [
1837
+ k(G, {
1836
1838
  label: "FIFO",
1837
1839
  compact: ""
1838
1840
  }),
1839
- ue(" " + b(typeof Y.value != "string" ? u(ke)(
1841
+ ue(" " + _(typeof Y.value != "string" ? u(ke)(
1840
1842
  Y.value,
1841
1843
  !1,
1842
1844
  Y.value.precision
1843
1845
  ) : Y.value), 1)
1844
1846
  ], 64)) : (F(), O(Z, { key: 1 }, [
1845
- ue(b(typeof L.value != "string" ? u(ke)(
1847
+ ue(_(typeof L.value != "string" ? u(ke)(
1846
1848
  L.value,
1847
1849
  !1,
1848
1850
  L.value.precision
@@ -1851,20 +1853,20 @@ const to = { class: "flex items-center w-full fm-typo-en-title-md-800" }, no = {
1851
1853
  ])
1852
1854
  ]),
1853
1855
  e("div", Yo, [
1854
- g(Xe, { "z-index": 50 }, {
1855
- default: j(() => [
1856
+ k(Je, { "z-index": 50 }, {
1857
+ default: I(() => [
1856
1858
  e("div", Ko, [
1857
- ue(b(u(v)("inventory.stock.history.costSold")) + " ", 1),
1858
- g(se, {
1859
+ ue(_(u(i)("inventory.stock.history.costSold")) + " ", 1),
1860
+ k(se, {
1859
1861
  variant: "plain",
1860
1862
  placement: "top",
1861
1863
  "z-index": 50
1862
1864
  }, {
1863
- content: j(() => [
1864
- e("div", Go, b(u(v)("inventory.stock.history.costSoldTooltip")), 1)
1865
+ content: I(() => [
1866
+ e("div", Go, _(u(i)("inventory.stock.history.costSoldTooltip")), 1)
1865
1867
  ]),
1866
- default: j(() => [
1867
- g(z, {
1868
+ default: I(() => [
1869
+ k(z, {
1868
1870
  name: "help",
1869
1871
  size: "sm"
1870
1872
  })
@@ -1875,7 +1877,7 @@ const to = { class: "flex items-center w-full fm-typo-en-title-md-800" }, no = {
1875
1877
  ]),
1876
1878
  _: 1
1877
1879
  }),
1878
- e("div", Wo, b(J.value), 1)
1880
+ e("div", Wo, _(Q.value), 1)
1879
1881
  ])
1880
1882
  ])
1881
1883
  ])) : te("", !0)
@@ -1885,30 +1887,30 @@ const to = { class: "flex items-center w-full fm-typo-en-title-md-800" }, no = {
1885
1887
  ]),
1886
1888
  _: 1
1887
1889
  }),
1888
- o[5] || (o[5] = e("div", null, null, -1)),
1890
+ s[5] || (s[5] = e("div", null, null, -1)),
1889
1891
  (F(!0), O(Z, null, ie(A.value, (ee) => (F(), O(Z, {
1890
1892
  key: ee.date
1891
1893
  }, [
1892
- t.sku ? (F(), K(Qn, {
1894
+ t.sku ? (F(), K(Jn, {
1893
1895
  key: 0,
1894
1896
  record: ee,
1895
1897
  sku: t.sku,
1896
1898
  bills: V.value,
1897
- onRefreshHistory: y
1899
+ onRefreshHistory: v
1898
1900
  }, null, 8, ["record", "sku", "bills"])) : te("", !0)
1899
1901
  ], 64))), 128))
1900
1902
  ])) : (F(), O("div", qo, [
1901
- g(x),
1903
+ k(S),
1902
1904
  e("div", null, [
1903
1905
  e("img", {
1904
1906
  src: u(Xt),
1905
1907
  alt: "List is empty"
1906
1908
  }, null, 8, Xo)
1907
1909
  ]),
1908
- e("div", Jo, b(u(v)("inventory.stock.history.noRecords")), 1),
1909
- e("div", Qo, b(u(v)("inventory.stock.history.changeDateRange")), 1),
1910
- g(x),
1911
- g(x)
1910
+ e("div", Qo, _(u(i)("inventory.stock.history.noRecords")), 1),
1911
+ e("div", Jo, _(u(i)("inventory.stock.history.changeDateRange")), 1),
1912
+ k(S),
1913
+ k(S)
1912
1914
  ]))
1913
1915
  ])
1914
1916
  ];
@@ -1920,30 +1922,30 @@ const to = { class: "flex items-center w-full fm-typo-en-title-md-800" }, no = {
1920
1922
  }), es = {
1921
1923
  key: 0,
1922
1924
  class: "flex items-center gap-1"
1923
- }, ts = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ns = { class: "flex flex-col gap-8" }, os = { class: "flex flex-col" }, ss = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, as = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary line-clamp-1" }, hs = /* @__PURE__ */ ce({
1925
+ }, ts = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ns = { class: "flex flex-col gap-8" }, os = { class: "flex flex-col" }, ss = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, as = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary line-clamp-1" }, gs = /* @__PURE__ */ ce({
1924
1926
  __name: "StockView",
1925
- setup(k) {
1926
- const { t: h } = de(), c = Pe(), s = pe(), $ = Re(), d = it(), m = _e(), v = nt(), S = Ut(), { columnDefs: B } = on(), i = Oe(), l = be();
1927
- s.watchLocation(V);
1928
- const y = H(
1929
- () => new Set(S.getAvailableItems(S.businessSubsidiaryId))
1930
- ), C = N(!1);
1927
+ setup(b) {
1928
+ const { t: g } = de(), p = Re(), o = ve(), j = Oe(), h = it(), d = _e(), i = st(), x = Ut(), { columnDefs: C } = on(), c = Le(), l = be();
1929
+ o.watchLocation(V);
1930
+ const v = H(
1931
+ () => new Set(x.getAvailableItems(x.businessSubsidiaryId))
1932
+ ), $ = N(!1);
1931
1933
  async function A() {
1932
- i.open({
1933
- title: h("inventory.stock.stock_balance.refreshBalance"),
1934
- message: h("inventory.stock.stock_balance.refreshBalanceDescription"),
1934
+ c.open({
1935
+ title: g("inventory.stock.stock_balance.refreshBalance"),
1936
+ message: g("inventory.stock.stock_balance.refreshBalanceDescription"),
1935
1937
  closeButton: !0,
1936
1938
  primaryActions: {
1937
- text: h("common.confirm"),
1939
+ text: g("common.confirm"),
1938
1940
  close: !0
1939
1941
  },
1940
1942
  secondaryActions: {
1941
- text: h("common.close"),
1943
+ text: g("common.close"),
1942
1944
  close: !0,
1943
1945
  variant: "tertiary"
1944
1946
  }
1945
1947
  }).onPrimary(async () => {
1946
- await m.recalculation.refreshCurrentBalances(), l.open({
1948
+ await d.recalculation.refreshCurrentBalances(), l.open({
1947
1949
  title: "Refresh Stock Balance",
1948
1950
  message: "Stock balance refresh has been queued. This may take a moment to complete.",
1949
1951
  type: "success"
@@ -1951,18 +1953,18 @@ const to = { class: "flex items-center w-full fm-typo-en-title-md-800" }, no = {
1951
1953
  });
1952
1954
  }
1953
1955
  async function V() {
1954
- if (s._currentLocation) {
1955
- C.value = !0;
1956
+ if (o._currentLocation) {
1957
+ $.value = !0;
1956
1958
  try {
1957
- await $.readStockBalance(), await $.readProductBalance(), await v.readStockEstimateBalance();
1959
+ await j.readStockBalance(), await j.readProductBalance(), await i.readStockEstimateBalance();
1958
1960
  } catch (L) {
1959
1961
  l.open({
1960
- title: h("inventory.stock.error.title"),
1961
- message: h("inventory.stock.error.message"),
1962
+ title: g("inventory.stock.error.title"),
1963
+ message: g("inventory.stock.error.message"),
1962
1964
  type: "error"
1963
1965
  }), console.error("error on fetch stock balance", L);
1964
1966
  } finally {
1965
- C.value = !1;
1967
+ $.value = !1;
1966
1968
  }
1967
1969
  }
1968
1970
  }
@@ -1984,48 +1986,48 @@ const to = { class: "flex items-center w-full fm-typo-en-title-md-800" }, no = {
1984
1986
  }
1985
1987
  ]
1986
1988
  }), w = H(() => {
1987
- var le, _, t;
1989
+ var le, y, t;
1988
1990
  const L = r.value ? Et.build(r.value) : null, Y = [];
1989
- for (const o of c.skus) {
1991
+ for (const s of p.skus) {
1990
1992
  let f = !0;
1991
- if (S.isEnabled && D.value && y.value && f && (f = y.value.has(o._id)), L && f && (f = Ht(
1993
+ if (x.isEnabled && M.value && v.value && f && (f = v.value.has(s._id)), L && f && (f = Ht(
1992
1994
  {
1993
- status: o.isInactive ? "Inactive" : "Active"
1995
+ status: s.isInactive ? "Inactive" : "Active"
1994
1996
  },
1995
1997
  L
1996
1998
  )), f) {
1997
- const p = o.trackingMeasurement;
1998
- let a = (_ = (le = $.stockBalance.skus) == null ? void 0 : le.find(
1999
- (z) => z.id === o._id
2000
- )) == null ? void 0 : _.balance, x = v.inventoryForecast.skus.find(
2001
- (z) => z.id === o._id
1999
+ const m = s.trackingMeasurement;
2000
+ let a = (y = (le = j.stockBalance.skus) == null ? void 0 : le.find(
2001
+ (z) => z.id === s._id
2002
+ )) == null ? void 0 : y.balance, S = i.inventoryForecast.skus.find(
2003
+ (z) => z.id === s._id
2002
2004
  );
2003
2005
  const U = {
2004
- ...o,
2006
+ ...s,
2005
2007
  balance: a ?? {
2006
2008
  amount: 0,
2007
2009
  precision: 0
2008
2010
  },
2009
- day: (x == null ? void 0 : x.depletionDays) ?? void 0,
2010
- trackingUnitAbbrev: p ? ((t = o.unit.measurements.find((z) => z.id === p)) == null ? void 0 : t.abbrev) ?? "" : o.unit.abbrev
2011
+ day: (S == null ? void 0 : S.depletionDays) ?? void 0,
2012
+ trackingUnitAbbrev: m ? ((t = s.unit.measurements.find((z) => z.id === m)) == null ? void 0 : t.abbrev) ?? "" : s.unit.abbrev
2011
2013
  };
2012
2014
  Y.push(U);
2013
2015
  }
2014
2016
  }
2015
2017
  return Y;
2016
- }), M = N(""), D = N(!0), { breakpoints: E } = Kt(), P = H(() => E.value.xs || E.value.sm), Q = H(() => P.value ? 10 : 20), J = Pt(), R = H(() => [
2018
+ }), B = N(""), M = N(!0), { breakpoints: E } = Kt(), P = H(() => E.value.xs || E.value.sm), J = H(() => P.value ? 10 : 20), Q = Pt(), R = H(() => [
2017
2019
  {
2018
- label: h("inventory.stock.stock_balance.refreshBalance"),
2020
+ label: g("inventory.stock.stock_balance.refreshBalance"),
2019
2021
  value: "refresh-balance",
2020
2022
  isPrimary: !0,
2021
2023
  prependIcon: "calculate"
2022
2024
  },
2023
2025
  {
2024
- label: h("inventory.common.refresh"),
2026
+ label: g("inventory.common.refresh"),
2025
2027
  value: "refresh"
2026
2028
  },
2027
2029
  {
2028
- label: h("inventory.common.export"),
2030
+ label: g("inventory.common.export"),
2029
2031
  value: "export"
2030
2032
  }
2031
2033
  ]);
@@ -2040,14 +2042,14 @@ const to = { class: "flex items-center w-full fm-typo-en-title-md-800" }, no = {
2040
2042
  }
2041
2043
  }
2042
2044
  return (L, Y) => {
2043
- const le = I("FmSwitch"), _ = I("FmTable");
2045
+ const le = D("FmSwitch"), y = D("FmTable");
2044
2046
  return F(), K(Rt, {
2045
- title: u(h)("inventory.stock.title"),
2047
+ title: u(g)("inventory.stock.title"),
2046
2048
  actions: R.value,
2047
2049
  "onClick:action": oe
2048
2050
  }, {
2049
- default: j(() => {
2050
- var t, o, f, p;
2051
+ default: I(() => {
2052
+ var t, s, f, m;
2051
2053
  return [
2052
2054
  e("div", {
2053
2055
  class: he([
@@ -2058,25 +2060,26 @@ const to = { class: "flex items-center w-full fm-typo-en-title-md-800" }, no = {
2058
2060
  }
2059
2061
  ])
2060
2062
  }, [
2061
- g(Ot, {
2063
+ k(Ot, {
2062
2064
  searchable: "",
2063
2065
  "change-location": "",
2064
- search: M.value,
2065
- "onUpdate:search": Y[1] || (Y[1] = (a) => M.value = a),
2066
+ search: B.value,
2067
+ "onUpdate:search": Y[1] || (Y[1] = (a) => B.value = a),
2068
+ "hide-filter-options": !0,
2066
2069
  filterable: "",
2067
2070
  "filter-attributes": n.value,
2068
2071
  filter: r.value,
2069
2072
  "onUpdate:filter": Y[2] || (Y[2] = (a) => r.value = a)
2070
2073
  }, {
2071
- default: j(() => [
2072
- u(S).isEnabled ? (F(), O("div", es, [
2073
- e("span", ts, b(u(h)("inventory.integration.netsuite.subsidiaryHierarchy.filtering")), 1),
2074
- g(zt),
2075
- g(lt, null, {
2076
- default: j(() => [
2077
- g(le, {
2078
- modelValue: D.value,
2079
- "onUpdate:modelValue": Y[0] || (Y[0] = (a) => D.value = a)
2074
+ default: I(() => [
2075
+ u(x).isEnabled ? (F(), O("div", es, [
2076
+ e("span", ts, _(u(g)("inventory.integration.netsuite.subsidiaryHierarchy.filtering")), 1),
2077
+ k(zt),
2078
+ k(Pe, null, {
2079
+ default: I(() => [
2080
+ k(le, {
2081
+ modelValue: M.value,
2082
+ "onUpdate:modelValue": Y[0] || (Y[0] = (a) => M.value = a)
2080
2083
  }, null, 8, ["modelValue"])
2081
2084
  ]),
2082
2085
  _: 1
@@ -2085,46 +2088,46 @@ const to = { class: "flex items-center w-full fm-typo-en-title-md-800" }, no = {
2085
2088
  ]),
2086
2089
  _: 1
2087
2090
  }, 8, ["search", "filter-attributes", "filter"]),
2088
- (F(), K(_, {
2089
- style: Ze(u(J).tableHeight),
2090
- "column-defs": u(B),
2091
+ (F(), K(y, {
2092
+ style: tt(u(Q).tableHeight),
2093
+ "column-defs": u(C),
2091
2094
  "row-data": w.value,
2092
- "search-value": M.value,
2093
- loading: C.value || !u(s)._currentLocation,
2094
- key: (t = u(s)._currentLocation) == null ? void 0 : t.dbName,
2095
- onRowClick: Y[3] || (Y[3] = (a) => u(d).showSkuHistory(a.original)),
2096
- "page-size": Q.value
2095
+ "search-value": B.value,
2096
+ loading: $.value || !u(o)._currentLocation,
2097
+ key: (t = u(o)._currentLocation) == null ? void 0 : t.dbName,
2098
+ onRowClick: Y[3] || (Y[3] = (a) => u(h).showSkuHistory(a.original)),
2099
+ "page-size": J.value
2097
2100
  }, {
2098
- "list-row": j((a) => [
2099
- g(Nt, {
2101
+ "list-row": I((a) => [
2102
+ k(Nt, {
2100
2103
  row: a,
2101
- onRowClick: u(d).showSkuHistory
2104
+ onRowClick: u(h).showSkuHistory
2102
2105
  }, {
2103
- default: j((x) => {
2106
+ default: I((S) => {
2104
2107
  var U, z, se, T, G, W, ae, re, q, ee;
2105
2108
  return [
2106
2109
  e("div", ns, [
2107
2110
  e("div", os, [
2108
2111
  e("div", ss, [
2109
- g(u(qe), {
2110
- render: (se = (z = (U = x.code) == null ? void 0 : U.column) == null ? void 0 : z.columnDef) == null ? void 0 : se.cell,
2111
- props: (G = (T = x.code) == null ? void 0 : T.getContext) == null ? void 0 : G.call(T)
2112
+ k(u(Qe), {
2113
+ render: (se = (z = (U = S.code) == null ? void 0 : U.column) == null ? void 0 : z.columnDef) == null ? void 0 : se.cell,
2114
+ props: (G = (T = S.code) == null ? void 0 : T.getContext) == null ? void 0 : G.call(T)
2112
2115
  }, null, 8, ["render", "props"])
2113
2116
  ]),
2114
2117
  e("div", as, [
2115
- g(u(qe), {
2116
- render: (re = (ae = (W = x.name) == null ? void 0 : W.column) == null ? void 0 : ae.columnDef) == null ? void 0 : re.cell,
2117
- props: (ee = (q = x.name) == null ? void 0 : q.getContext) == null ? void 0 : ee.call(q)
2118
+ k(u(Qe), {
2119
+ render: (re = (ae = (W = S.name) == null ? void 0 : W.column) == null ? void 0 : ae.columnDef) == null ? void 0 : re.cell,
2120
+ props: (ee = (q = S.name) == null ? void 0 : q.getContext) == null ? void 0 : ee.call(q)
2118
2121
  }, null, 8, ["render", "props"])
2119
2122
  ])
2120
2123
  ]),
2121
2124
  e("div", null, [
2122
- g(Te, {
2125
+ k(Te, {
2123
2126
  days: a.original.day
2124
2127
  }, null, 8, ["days"])
2125
2128
  ]),
2126
2129
  e("div", null, [
2127
- g(rt, {
2130
+ k(rt, {
2128
2131
  class: "xs:w-[160px]",
2129
2132
  unit: a.original.unit,
2130
2133
  sku: a.original,
@@ -2142,9 +2145,9 @@ const to = { class: "flex items-center w-full fm-typo-en-title-md-800" }, no = {
2142
2145
  }, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"]))
2143
2146
  ], 2),
2144
2147
  (F(), K(dt, { to: "body" }, [
2145
- (o = u(d).stockHistoryProps) != null && o.sku ? (F(), K(Zo, Ae(Ve({ key: 0 }, u(d).stockHistoryProps)), null, 16)) : te("", !0),
2146
- (f = u(d).convertSkuDialogProps) != null && f.sku ? (F(), K(kn, Ae(Ve({ key: 1 }, u(d).convertSkuDialogProps)), null, 16)) : te("", !0),
2147
- (p = u(d).adjustSkuDialogProps) != null && p.stock ? (F(), K(Vn, Ae(Ve({ key: 2 }, u(d).adjustSkuDialogProps)), null, 16)) : te("", !0)
2148
+ (s = u(h).stockHistoryProps) != null && s.sku ? (F(), K(Zo, Ae(Ve({ key: 0 }, u(h).stockHistoryProps)), null, 16)) : te("", !0),
2149
+ (f = u(h).convertSkuDialogProps) != null && f.sku ? (F(), K(kn, Ae(Ve({ key: 1 }, u(h).convertSkuDialogProps)), null, 16)) : te("", !0),
2150
+ (m = u(h).adjustSkuDialogProps) != null && m.stock ? (F(), K(Vn, Ae(Ve({ key: 2 }, u(h).adjustSkuDialogProps)), null, 16)) : te("", !0)
2148
2151
  ]))
2149
2152
  ];
2150
2153
  }),
@@ -2154,5 +2157,5 @@ const to = { class: "flex items-center w-full fm-typo-en-title-md-800" }, no = {
2154
2157
  }
2155
2158
  });
2156
2159
  export {
2157
- hs as default
2160
+ gs as default
2158
2161
  };