@feedmepos/mf-inventory-portal 1.2.25-dev.3 → 1.2.25-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 (47) hide show
  1. package/dist/{App-B4obttsk.js → App-DfVozmjY.js} +1 -1
  2. package/dist/{ApprovalView-DC3UGAul.js → ApprovalView-CnfqSv9x.js} +2 -2
  3. package/dist/{BindingsDialog-CquzVplj.js → BindingsDialog-kpsjxfQy.js} +2 -2
  4. package/dist/{BindingsPicker-DTuGeemT.js → BindingsPicker-C-lqbpS5.js} +1 -1
  5. package/dist/{BindingsTable-Ctgb9M_M.js → BindingsTable-C9gXT_I9.js} +1 -1
  6. package/dist/{ClosingDraftView-BxmKgtbn.js → ClosingDraftView-CIzPb1jY.js} +567 -569
  7. package/dist/{ClosingHistoryView-s_xtCr9L.js → ClosingHistoryView-tWDtp2Rs.js} +2 -2
  8. package/dist/{ClosingTemplateView-BFAk8t0U.js → ClosingTemplateView-DqS84ptv.js} +2 -2
  9. package/dist/{DeliveryOrderPrintPreview-Cxx6M-8k.js → DeliveryOrderPrintPreview-BWi8-vGu.js} +1 -1
  10. package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-DEl4CWhG.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-DbbA0bsv.js} +3 -3
  11. package/dist/{FmMultiselectDialog-BKe18tGi.js → FmMultiselectDialog-Yhn-TS1x.js} +1 -1
  12. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-B3EGJJOd.js → FmUnitInput.vue_vue_type_script_setup_true_lang-DayErKOZ.js} +1 -1
  13. package/dist/{ImportView-C_Wi1VKC.js → ImportView-DPgX-G_F.js} +2 -2
  14. package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-C10WT08O.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-D7LbFPED.js} +1 -1
  15. package/dist/{IngredientGroupView-D_upb784.js → IngredientGroupView-BfUAKH7v.js} +2 -2
  16. package/dist/{IngredientsView-Cl34PHha.js → IngredientsView-BC7nWfsQ.js} +7 -7
  17. package/dist/{IntegrationView-DVN96hm3.js → IntegrationView-BDxifTYa.js} +3 -3
  18. package/dist/{InventoryBindingForm-HrndE5uF.js → InventoryBindingForm-CotArtis.js} +1 -1
  19. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-CNTipGf7.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-D2z8Sh-E.js} +3 -3
  20. package/dist/{InventoryBindingSummary-DXD2CcUd.js → InventoryBindingSummary-B-aThygZ.js} +1 -1
  21. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-COb9i6pD.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-CZhZ5fCR.js} +1 -1
  22. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-QLsihie5.js → PremiumBadge.vue_vue_type_script_setup_true_lang-Csk9pFuQ.js} +1 -1
  23. package/dist/{PublishView-BjggzffG.js → PublishView-7DQ09qeB.js} +1 -1
  24. package/dist/{PurchaseOrderPrintPreview-CEr-__xV.js → PurchaseOrderPrintPreview-BbcvYJ8n.js} +1 -1
  25. package/dist/{ReceiveRequestView-C5TJmTy3.js → ReceiveRequestView-FDyALvGT.js} +8 -8
  26. package/dist/{RecipeView-C-JSaZdS.js → RecipeView-CEEoNYEk.js} +3 -3
  27. package/dist/{StockView-DnXqehqn.js → StockView-BCRLEQFi.js} +8 -8
  28. package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-B1KFnqFv.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-C0_t8krY.js} +1 -1
  29. package/dist/{SupplierView-D-RzNxE-.js → SupplierView-BQdQ5IKV.js} +4 -4
  30. package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-CObSzTDZ.js → TransferDetails.vue_vue_type_script_setup_true_lang-BkGXaWid.js} +5 -5
  31. package/dist/{TransferTemplateView-SE1sCscG.js → TransferTemplateView-DKQCZoDi.js} +7 -7
  32. package/dist/{UnitView-C_JVyM2z.js → UnitView-BwFWozmk.js} +3 -3
  33. package/dist/{WarehouseView-BbzM9qBo.js → WarehouseView-Bp3VfyqG.js} +1 -1
  34. package/dist/{app-zasR2ukI.js → app-DTwVjf2G.js} +26 -26
  35. package/dist/app.js +1 -1
  36. package/dist/{decimal-DWqIA11a.js → decimal-B0CqnvKJ.js} +1 -1
  37. package/dist/{format-unit-display-DIwCjuP3.js → format-unit-display-C9SRbqfx.js} +3 -3
  38. package/dist/{import-export.helper-DwC0iQdw.js → import-export.helper-ChSfbVTS.js} +1 -1
  39. package/dist/{index-CrjhdjiE.js → index-DCJZYjJp.js} +1 -1
  40. package/dist/{index-PGim0FYX.js → index-DHWgyDzu.js} +1 -1
  41. package/dist/{purchase-order-template-Bhq1FrLB.js → purchase-order-template-hnS0QDeq.js} +1 -1
  42. package/dist/{stock-BF1TE1sy.js → stock-0CVWUWpZ.js} +1 -1
  43. package/dist/{stock-lhgtE1at.js → stock-CP4PfKN1.js} +2 -2
  44. package/dist/{supplier-qYXdR1q-.js → supplier-CR1HA06A.js} +1 -1
  45. package/dist/{use-ingredient-select-dialog-DUX6jbhh.js → use-ingredient-select-dialog-CRROeO60.js} +1 -1
  46. package/dist/{use-inventory-binding-dialog-Cs9yC_C8.js → use-inventory-binding-dialog-jkt1y1SA.js} +1 -1
  47. package/package.json +3 -3
@@ -1,31 +1,31 @@
1
- import { defineComponent as He, ref as H, computed as V, onMounted as Ye, resolveComponent as U, openBlock as C, createElementBlock as L, Fragment as ee, createTextVNode as X, createBlock as se, withCtx as Y, createElementVNode as r, toDisplayString as J, unref as B, createVNode as k, createCommentVNode as de, h as F, reactive as _t, watch as Dt, isRef as rt, normalizeClass as _e, renderList as je, normalizeStyle as lt, Teleport as wt, mergeProps as St } from "vue";
2
- import { aa as Ct, u as ze, ax as z, am as ct, ay as it, r as jt, Z as Qe, n as N, t as Bt, a0 as Be, W as Ft, Y as Tt, X as $t, az as ut, aA as dt, ah as mt, aB as pe, an as Mt, ac as Ke, ab as ve, a6 as Ue, D as st, j as Re, i as Rt, f as It, a as Pt, $ as Ie, a9 as Vt, h as Ut, G as Lt, I as Et, J as Ht, K as zt, L as Pe } from "./app-zasR2ukI.js";
1
+ import { defineComponent as He, ref as H, computed as V, onMounted as Ye, resolveComponent as U, openBlock as j, createElementBlock as L, Fragment as ee, createTextVNode as X, createBlock as se, withCtx as Y, createElementVNode as r, toDisplayString as J, unref as F, createVNode as h, createCommentVNode as de, h as T, reactive as _t, watch as Dt, isRef as rt, normalizeClass as De, renderList as je, normalizeStyle as lt, Teleport as wt, mergeProps as St } from "vue";
2
+ import { aa as Ct, u as ze, ax as z, am as ct, ay as it, r as jt, Z as Qe, n as N, t as Bt, a0 as Be, W as Ft, Y as Tt, X as $t, az as ut, aA as dt, ah as mt, aB as pe, an as Mt, ac as Ke, ab as ve, a6 as Ue, D as st, j as Re, i as Rt, f as It, a as Pt, $ as Ie, a9 as Vt, h as Ut, G as Lt, I as Et, J as Ht, K as zt, L as Pe } from "./app-DTwVjf2G.js";
3
3
  import { useCoreStore as Nt, useI18n as ft } from "@feedmepos/mf-common";
4
4
  import { useSnackbar as Ge, useDialog as Ot, useProxiedModel as Kt, components as Ve, useBreakpoints as Yt } from "@feedmepos/ui-library";
5
5
  import { defineStore as pt, storeToRefs as Qt } from "pinia";
6
- import { u as vt } from "./stock-lhgtE1at.js";
7
- import { u as We } from "./stock-BF1TE1sy.js";
6
+ import { u as vt } from "./stock-CP4PfKN1.js";
7
+ import { u as We } from "./stock-0CVWUWpZ.js";
8
8
  import { E as Gt } from "./empty-placeholder-wf6-BWE8.js";
9
- const Ne = Ct((o, l) => {
9
+ const Ne = Ct((s, l) => {
10
10
  function e() {
11
11
  return ze().currentLocation.dbName;
12
12
  }
13
13
  return {
14
14
  async getDraft(m) {
15
- const v = e(), D = `${o.inventoryBackendUrl}/${v}/closing-draft/${m}`;
16
- return l.get(D);
15
+ const p = e(), _ = `${s.inventoryBackendUrl}/${p}/closing-draft/${m}`;
16
+ return l.get(_);
17
17
  },
18
18
  async readDrafts() {
19
- const m = e(), v = `${o.inventoryBackendUrl}/${m}/closing-draft`;
20
- return l.get(v);
19
+ const m = e(), p = `${s.inventoryBackendUrl}/${m}/closing-draft`;
20
+ return l.get(p);
21
21
  },
22
22
  async runOperation(m) {
23
- const v = e(), D = `${o.inventoryBackendUrl}/${v}/closing-draft/run-operation`;
24
- return l.post(D, m);
23
+ const p = e(), _ = `${s.inventoryBackendUrl}/${p}/closing-draft/run-operation`;
24
+ return l.post(_, m);
25
25
  },
26
26
  async sync(m) {
27
- const v = e(), D = `${o.inventoryBackendUrl}/${v}/closing-draft/sync`;
28
- return l.post(D, m);
27
+ const p = e(), _ = `${s.inventoryBackendUrl}/${p}/closing-draft/sync`;
28
+ return l.post(_, m);
29
29
  }
30
30
  };
31
31
  }), Wt = { class: "fm-typo-en-body-lg-400" }, qt = { class: "fm-typo-en-body-lg-600" }, Zt = {
@@ -39,8 +39,8 @@ const Ne = Ct((o, l) => {
39
39
  onCancel: { type: Function },
40
40
  onFinished: { type: Function }
41
41
  },
42
- setup(o) {
43
- const l = o, e = H(), m = Ne(), v = Ge(), D = H(!1), y = H(null), M = H(!1), w = V(() => {
42
+ setup(s) {
43
+ const l = s, e = H(), m = Ne(), p = Ge(), _ = H(!1), v = H(null), R = H(!1), S = V(() => {
44
44
  switch (l.action) {
45
45
  case z.enum.approveDraft:
46
46
  return "Approve";
@@ -50,7 +50,7 @@ const Ne = Ct((o, l) => {
50
50
  return "Mark as Failed";
51
51
  }
52
52
  throw new Error(`Unknown action: ${l.action}`);
53
- }), h = V(() => {
53
+ }), k = V(() => {
54
54
  switch (l.action) {
55
55
  case z.enum.approveDraft:
56
56
  return "primary";
@@ -63,185 +63,185 @@ const Ne = Ct((o, l) => {
63
63
  });
64
64
  Ye(() => {
65
65
  if (l.draft.effectiveAt)
66
- y.value = new Date(l.draft.effectiveAt);
66
+ v.value = new Date(l.draft.effectiveAt);
67
67
  else {
68
- const s = new Date(l.draft.createdAt);
69
- s.setHours(23, 59, 59, 999), y.value = s;
68
+ const n = new Date(l.draft.createdAt);
69
+ n.setHours(23, 59, 59, 999), v.value = n;
70
70
  }
71
- M.value = !0;
71
+ R.value = !0;
72
72
  });
73
- const T = V({
73
+ const $ = V({
74
74
  get() {
75
- return y.value === null ? "" : ct(y.value);
75
+ return v.value === null ? "" : ct(v.value);
76
76
  },
77
- set(s) {
78
- if (s) {
79
- const a = /* @__PURE__ */ new Date(`${s} ${P.value}`);
80
- a.setSeconds(59, 999), y.value = a;
77
+ set(n) {
78
+ if (n) {
79
+ const a = /* @__PURE__ */ new Date(`${n} ${P.value}`);
80
+ a.setSeconds(59, 999), v.value = a;
81
81
  } else
82
- y.value = null;
82
+ v.value = null;
83
83
  }
84
84
  }), P = V({
85
85
  get() {
86
- return y.value === null ? "" : it(y.value);
86
+ return v.value === null ? "" : it(v.value);
87
87
  },
88
- set(s) {
89
- if (s) {
90
- const a = /* @__PURE__ */ new Date(`${T.value} ${s}`);
91
- a.setSeconds(59, 999), y.value = a;
88
+ set(n) {
89
+ if (n) {
90
+ const a = /* @__PURE__ */ new Date(`${$.value} ${n}`);
91
+ a.setSeconds(59, 999), v.value = a;
92
92
  } else
93
- y.value = null;
93
+ v.value = null;
94
94
  }
95
95
  });
96
- async function R() {
97
- D.value = !0;
96
+ async function I() {
97
+ _.value = !0;
98
98
  try {
99
99
  await m.runOperation({
100
100
  _id: l.draft._id,
101
101
  _rev: l.draft._rev ?? "",
102
102
  action: l.action,
103
103
  data: {
104
- effectiveAt: y.value ? y.value.toISOString() : null,
104
+ effectiveAt: v.value ? v.value.toISOString() : null,
105
105
  remark: e.value
106
106
  }
107
- }).delayed(500), v.open({
107
+ }).delayed(500), p.open({
108
108
  title: "Success",
109
109
  message: "Action submitted",
110
110
  type: "success"
111
111
  }), l.onFinished();
112
- } catch (s) {
113
- v.open({
112
+ } catch (n) {
113
+ p.open({
114
114
  title: "Something went wrong",
115
- message: "Unable to submit action. Please try again",
115
+ message: (n == null ? void 0 : n.message) ?? "Unable to submit action. Please try again",
116
116
  type: "error"
117
- }), console.error("error on submit closing draft action", s);
117
+ }), console.error("error on submit closing draft action", n);
118
118
  } finally {
119
- D.value = !1;
119
+ _.value = !1;
120
120
  }
121
121
  }
122
- return (s, a) => {
123
- const x = U("FmLabel"), O = U("FmDatePicker"), f = U("FmTimePicker"), g = U("FmTextField"), A = U("FmButton"), _ = U("FmForm");
124
- return M.value ? (C(), se(_, {
122
+ return (n, a) => {
123
+ const D = U("FmLabel"), O = U("FmDatePicker"), f = U("FmTimePicker"), y = U("FmTextField"), A = U("FmButton"), w = U("FmForm");
124
+ return R.value ? (j(), se(w, {
125
125
  key: 1,
126
- onValidationSuccess: R,
126
+ onValidationSuccess: I,
127
127
  class: "flex flex-col gap-32",
128
- disabled: D.value
128
+ disabled: _.value
129
129
  }, {
130
130
  default: Y(() => [
131
131
  r("div", Wt, [
132
132
  a[4] || (a[4] = X(" You are about to ")),
133
- r("span", qt, J(w.value), 1),
133
+ r("span", qt, J(S.value), 1),
134
134
  a[5] || (a[5] = X(" this draft. Please provide a remark to justify this action. "))
135
135
  ]),
136
- s.action === B(z).enum.approveDraft ? (C(), L("div", Zt, [
137
- k(x, { class: "fm-typo-en-body-lg-600" }, {
136
+ n.action === F(z).enum.approveDraft ? (j(), L("div", Zt, [
137
+ h(D, { class: "fm-typo-en-body-lg-600" }, {
138
138
  default: Y(() => a[6] || (a[6] = [
139
139
  X("Closing Date")
140
140
  ])),
141
141
  _: 1
142
142
  }),
143
- k(O, {
144
- modelValue: T.value,
145
- "onUpdate:modelValue": a[0] || (a[0] = ($) => T.value = $)
143
+ h(O, {
144
+ modelValue: $.value,
145
+ "onUpdate:modelValue": a[0] || (a[0] = (M) => $.value = M)
146
146
  }, null, 8, ["modelValue"]),
147
- k(x, { class: "fm-typo-en-body-lg-600" }, {
147
+ h(D, { class: "fm-typo-en-body-lg-600" }, {
148
148
  default: Y(() => a[7] || (a[7] = [
149
149
  X("Closing Time")
150
150
  ])),
151
151
  _: 1
152
152
  }),
153
- k(f, {
153
+ h(f, {
154
154
  modelValue: P.value,
155
- "onUpdate:modelValue": a[1] || (a[1] = ($) => P.value = $)
155
+ "onUpdate:modelValue": a[1] || (a[1] = (M) => P.value = M)
156
156
  }, null, 8, ["modelValue"])
157
157
  ])) : de("", !0),
158
- k(g, {
158
+ h(y, {
159
159
  modelValue: e.value,
160
- "onUpdate:modelValue": a[2] || (a[2] = ($) => e.value = $),
160
+ "onUpdate:modelValue": a[2] || (a[2] = (M) => e.value = M),
161
161
  label: "Remark",
162
162
  "label-mark": "required",
163
- rules: [B(jt)()]
163
+ rules: [F(jt)()]
164
164
  }, null, 8, ["modelValue", "rules"]),
165
165
  r("div", Jt, [
166
- k(A, {
166
+ h(A, {
167
167
  label: "Cancel",
168
168
  variant: "tertiary",
169
- onClick: a[3] || (a[3] = ($) => s.onCancel())
169
+ onClick: a[3] || (a[3] = (M) => n.onCancel())
170
170
  }),
171
- k(A, {
172
- label: w.value,
171
+ h(A, {
172
+ label: S.value,
173
173
  type: "submit",
174
- variant: h.value,
175
- loading: D.value
174
+ variant: k.value,
175
+ loading: _.value
176
176
  }, null, 8, ["label", "variant", "loading"])
177
177
  ])
178
178
  ]),
179
179
  _: 1
180
- }, 8, ["disabled"])) : (C(), L(ee, { key: 0 }, [
180
+ }, 8, ["disabled"])) : (j(), L(ee, { key: 0 }, [
181
181
  X("Loading")
182
182
  ], 64));
183
183
  };
184
184
  }
185
185
  }), Xt = Be(0);
186
- function yt(o) {
187
- const l = o.measurementsAmounts.groupBy((m) => m.measurement.id), e = o.sku.unit.measurements.reduce((m, v) => {
188
- var M, w;
189
- const D = ((w = (M = l.get(v.id)) == null ? void 0 : M[0]) == null ? void 0 : w.amount) ?? Xt, y = Qe(v.conversion, D);
190
- return m + +N(y);
191
- }, +N(o.baseAmount));
192
- return Bt(e, o.baseAmount.precision);
186
+ function yt(s) {
187
+ const l = s.measurementsAmounts.groupBy((m) => m.measurement.id), e = s.sku.unit.measurements.reduce((m, p) => {
188
+ var R, S;
189
+ const _ = ((S = (R = l.get(p.id)) == null ? void 0 : R[0]) == null ? void 0 : S.amount) ?? Xt, v = Qe(p.conversion, _);
190
+ return m + +N(v);
191
+ }, +N(s.baseAmount));
192
+ return Bt(e, s.baseAmount.precision);
193
193
  }
194
194
  const ea = Be(0), ta = Be(100), gt = "N/A";
195
- function aa(o, l, e, m, v, D) {
196
- var _;
197
- const y = yt(o), M = m ?? y, w = ut(M, l), h = l.amount === 0 ? null : dt(w, {
195
+ function aa(s, l, e, m, p, _) {
196
+ var w;
197
+ const v = yt(s), R = m ?? v, S = ut(R, l), k = l.amount === 0 ? null : dt(S, {
198
198
  ...l,
199
199
  amount: Math.abs(l.amount)
200
- }), T = h ? Qe(h, ta) : null, P = (_ = o.sku.defaultCost) != null && _.costPerUnit ? o.sku.defaultCost.costPerUnit.amount / Math.pow(10, o.sku.defaultCost.costPerUnit.precision) : 0, R = v ? +N(v) : 0, s = +N(l), a = +N(M), x = s - a, O = x * P, f = a * P, g = s * P;
200
+ }), $ = k ? Qe(k, ta) : null, P = (w = s.sku.defaultCost) != null && w.costPerUnit ? s.sku.defaultCost.costPerUnit.amount / Math.pow(10, s.sku.defaultCost.costPerUnit.precision) : 0, I = p ? +N(p) : 0, n = +N(l), a = +N(R), D = n - a, O = D * P, f = a * P, y = n * P;
201
201
  return {
202
- code: o.sku.code,
203
- name: o.sku.name,
204
- baseUnit: o.sku.unit.abbrev,
205
- baseUnitAmount: +N(o.baseAmount),
206
- ...o.measurementsAmounts.filter(
207
- ($) => na($.measurement) && e.includes($.measurement.id)
202
+ code: s.sku.code,
203
+ name: s.sku.name,
204
+ baseUnit: s.sku.unit.abbrev,
205
+ baseUnitAmount: +N(s.baseAmount),
206
+ ...s.measurementsAmounts.filter(
207
+ (M) => na(M.measurement) && e.includes(M.measurement.id)
208
208
  ).reduce(
209
- ($, Z, q) => ($[`measurementAbbrev${q}`] = `(${Z.measurement.abbrev}) × ${N(Z.measurement.conversion)}`, $[`measurementAmount${q}`] = +N(Z.amount), $),
209
+ (M, Z, W) => (M[`measurementAbbrev${W}`] = `(${Z.measurement.abbrev}) × ${N(Z.measurement.conversion)}`, M[`measurementAmount${W}`] = +N(Z.amount), M),
210
210
  {}
211
211
  ),
212
- systemBalance: s,
212
+ systemBalance: n,
213
213
  physicalBalance: a,
214
- adjustedAmount: +N(w),
215
- adjustedDiffPercentage: T ? +N(mt(T, 2)) : null,
214
+ adjustedAmount: +N(S),
215
+ adjustedDiffPercentage: $ ? +N(mt($, 2)) : null,
216
216
  costPerUnit: P,
217
- opening: R,
218
- adjustmentTypes: D ?? gt,
219
- varianceQty: x,
217
+ opening: I,
218
+ adjustmentTypes: _ ?? gt,
219
+ varianceQty: D,
220
220
  varianceRM: O,
221
221
  stockTakeValue: f,
222
- systemValue: g
222
+ systemValue: y
223
223
  };
224
224
  }
225
- function na(o) {
226
- return !o.abbrev.toLocaleLowerCase().includes("inactive");
225
+ function na(s) {
226
+ return !s.abbrev.toLocaleLowerCase().includes("inactive");
227
227
  }
228
- function oa(o) {
229
- const l = bt(o);
230
- return o.reduce(
228
+ function oa(s) {
229
+ const l = bt(s);
230
+ return s.reduce(
231
231
  (e, m) => {
232
- var v;
233
- return Math.max(e, ((v = l == null ? void 0 : l.get(m.sku._id)) == null ? void 0 : v[0].length) ?? 0);
232
+ var p;
233
+ return Math.max(e, ((p = l == null ? void 0 : l.get(m.sku._id)) == null ? void 0 : p[0].length) ?? 0);
234
234
  },
235
235
  0
236
236
  );
237
237
  }
238
- function bt(o) {
239
- return o.groupBy(
238
+ function bt(s) {
239
+ return s.groupBy(
240
240
  (l) => l.sku._id,
241
241
  (l) => l.measurementsAmounts.filter((e) => !e.measurement.abbrev.toLocaleLowerCase().includes("inactive")).map((e) => e.measurement.id)
242
242
  );
243
243
  }
244
- function sa(o) {
244
+ function sa(s) {
245
245
  return [
246
246
  {
247
247
  id: "code",
@@ -303,7 +303,7 @@ function sa(o) {
303
303
  id: "baseUnitAmount",
304
304
  name: "Base unit amount"
305
305
  },
306
- ...Array.from({ length: o }).flatMap((e, m) => [
306
+ ...Array.from({ length: s }).flatMap((e, m) => [
307
307
  {
308
308
  id: `measurementAmount${m}`,
309
309
  name: `UOM amount ${m + 1}`
@@ -315,60 +315,60 @@ function sa(o) {
315
315
  ])
316
316
  ];
317
317
  }
318
- function ra(o, l, e) {
319
- var g, A, _, $, Z, q, re;
318
+ function ra(s, l, e) {
319
+ var y, A, w, M, Z, W, re;
320
320
  const m = l.groupBy(
321
- (j) => j.id,
322
- (j) => j.balance
323
- ), v = e.groupBy(
324
- (j) => j.id,
325
- (j) => j.balance
326
- ), D = /* @__PURE__ */ new Map();
327
- if (o.opening)
328
- for (const j of o.opening)
329
- D.set(j.skuId, j.balance);
330
- const y = /* @__PURE__ */ new Map();
331
- if (o.adjustmentSnapshot)
332
- for (const j of o.adjustmentSnapshot) {
333
- const te = Object.keys(j.adjustmentsByType).join(", ");
334
- y.set(j.skuId, te || gt);
321
+ (B) => B.id,
322
+ (B) => B.balance
323
+ ), p = e.groupBy(
324
+ (B) => B.id,
325
+ (B) => B.balance
326
+ ), _ = /* @__PURE__ */ new Map();
327
+ if (s.opening)
328
+ for (const B of s.opening)
329
+ _.set(B.skuId, B.balance);
330
+ const v = /* @__PURE__ */ new Map();
331
+ if (s.adjustmentSnapshot)
332
+ for (const B of s.adjustmentSnapshot) {
333
+ const te = Object.keys(B.adjustmentsByType).join(", ");
334
+ v.set(B.skuId, te || gt);
335
335
  }
336
- const M = [...o.items, ...o.negativeStockItems ?? []], w = bt(M), h = M.map((j) => {
336
+ const R = [...s.items, ...s.negativeStockItems ?? []], S = bt(R), k = R.map((B) => {
337
337
  var ye, ge, Q;
338
- const te = ((ye = m.get(j.sku._id)) == null ? void 0 : ye[0]) ?? ea, be = ((ge = w == null ? void 0 : w.get(j.sku._id)) == null ? void 0 : ge[0]) ?? [], ke = D.get(j.sku._id), fe = y.get(j.sku._id);
338
+ const te = ((ye = m.get(B.sku._id)) == null ? void 0 : ye[0]) ?? ea, be = ((ge = S == null ? void 0 : S.get(B.sku._id)) == null ? void 0 : ge[0]) ?? [], he = _.get(B.sku._id), fe = v.get(B.sku._id);
339
339
  return aa(
340
- j,
340
+ B,
341
341
  te,
342
342
  be,
343
- (Q = v.get(j.sku._id)) == null ? void 0 : Q[0],
344
- ke,
343
+ (Q = p.get(B.sku._id)) == null ? void 0 : Q[0],
344
+ he,
345
345
  fe
346
346
  );
347
- }), T = oa(M), R = Nt().currentBusiness.value, s = sa(T), a = [
348
- ["Business name:", R == null ? void 0 : R.name],
349
- ["Business ID:", R == null ? void 0 : R._id],
350
- ["Menu version", R == null ? void 0 : R.menuVersion],
351
- ["Created at", new Date(o.createdAt)],
352
- ["Created by", (g = o.createdBy) == null ? void 0 : g.name],
353
- ["Updated at", new Date(o.updatedAt)],
354
- ["Updated by", (A = o.updatedBy) == null ? void 0 : A.name],
355
- ["Recent action", o.approvedAt ? "Approve" : o.rejectionHistory ? "Reject" : ""],
347
+ }), $ = oa(R), I = Nt().currentBusiness.value, n = sa($), a = [
348
+ ["Business name:", I == null ? void 0 : I.name],
349
+ ["Business ID:", I == null ? void 0 : I._id],
350
+ ["Menu version", I == null ? void 0 : I.menuVersion],
351
+ ["Created at", new Date(s.createdAt)],
352
+ ["Created by", (y = s.createdBy) == null ? void 0 : y.name],
353
+ ["Updated at", new Date(s.updatedAt)],
354
+ ["Updated by", (A = s.updatedBy) == null ? void 0 : A.name],
355
+ ["Recent action", s.approvedAt ? "Approve" : s.rejectionHistory ? "Reject" : ""],
356
356
  [
357
357
  "Action by",
358
- o.approvedAt ? (_ = o.approvedBy) == null ? void 0 : _.name : o.rejectionHistory ? (Z = ($ = o.rejectionHistory[0]) == null ? void 0 : $.rejectedBy) == null ? void 0 : Z.name : ""
358
+ s.approvedAt ? (w = s.approvedBy) == null ? void 0 : w.name : s.rejectionHistory ? (Z = (M = s.rejectionHistory[0]) == null ? void 0 : M.rejectedBy) == null ? void 0 : Z.name : ""
359
359
  ],
360
360
  [
361
361
  "Action at",
362
- o.approvedAt ? new Date(o.approvedAt) : o.rejectionHistory ? new Date((q = o.rejectionHistory[0]) == null ? void 0 : q.rejectedAt) : ""
362
+ s.approvedAt ? new Date(s.approvedAt) : s.rejectionHistory ? new Date((W = s.rejectionHistory[0]) == null ? void 0 : W.rejectedAt) : ""
363
363
  ],
364
364
  [
365
365
  "Action remark",
366
- o.approvedAt ? o.approveRemark : o.rejectionHistory ? new Date((re = o.rejectionHistory[0]) == null ? void 0 : re.rejectRemark) : ""
366
+ s.approvedAt ? s.approveRemark : s.rejectionHistory ? new Date((re = s.rejectionHistory[0]) == null ? void 0 : re.rejectRemark) : ""
367
367
  ],
368
368
  [],
369
- s.map((j) => j.name),
370
- ...h.map((j) => s.map((te) => j[te.id]))
371
- ], x = s.map((j) => `system:${j.id}`), O = Ft(a, x), f = `[${R == null ? void 0 : R.name}] closing draft (${Tt(new Date(o.updatedAt))}).xlsx`;
369
+ n.map((B) => B.name),
370
+ ...k.map((B) => n.map((te) => B[te.id]))
371
+ ], D = n.map((B) => `system:${B.id}`), O = Ft(a, D), f = `[${I == null ? void 0 : I.name}] closing draft (${Tt(new Date(s.updatedAt))}).xlsx`;
372
372
  return $t(O, f), f;
373
373
  }
374
374
  const la = { class: "flex flex-col" }, ca = { class: "flex gap-12 py-8 justify-end w-full" }, ia = /* @__PURE__ */ He({
@@ -378,55 +378,55 @@ const la = { class: "flex flex-col" }, ca = { class: "flex gap-12 py-8 justify-e
378
378
  onCancel: { type: Function },
379
379
  onFinished: { type: Function }
380
380
  },
381
- setup(o) {
382
- const l = o;
381
+ setup(s) {
382
+ const l = s;
383
383
  We();
384
- const e = H(!1), m = H(null), v = H(!1);
384
+ const e = H(!1), m = H(null), p = H(!1);
385
385
  Ye(() => {
386
386
  if (l.draft.effectiveAt)
387
387
  m.value = new Date(l.draft.effectiveAt);
388
388
  else {
389
- const w = new Date(l.draft.createdAt);
390
- w.setHours(23, 59, 59, 999), m.value = w;
389
+ const S = new Date(l.draft.createdAt);
390
+ S.setHours(23, 59, 59, 999), m.value = S;
391
391
  }
392
- v.value = !0;
392
+ p.value = !0;
393
393
  });
394
- const D = V({
394
+ const _ = V({
395
395
  get() {
396
396
  return m.value === null ? "" : ct(m.value);
397
397
  },
398
- set(w) {
399
- if (w) {
400
- const h = /* @__PURE__ */ new Date(`${w} ${y.value}`);
401
- h.setSeconds(59, 999), m.value = h;
398
+ set(S) {
399
+ if (S) {
400
+ const k = /* @__PURE__ */ new Date(`${S} ${v.value}`);
401
+ k.setSeconds(59, 999), m.value = k;
402
402
  } else
403
403
  m.value = null;
404
404
  }
405
- }), y = V({
405
+ }), v = V({
406
406
  get() {
407
407
  return m.value === null ? "" : it(m.value);
408
408
  },
409
- set(w) {
410
- if (w) {
411
- const h = /* @__PURE__ */ new Date(`${D.value} ${w}`);
412
- h.setSeconds(59, 999), m.value = h;
409
+ set(S) {
410
+ if (S) {
411
+ const k = /* @__PURE__ */ new Date(`${_.value} ${S}`);
412
+ k.setSeconds(59, 999), m.value = k;
413
413
  } else
414
414
  m.value = null;
415
415
  }
416
416
  });
417
- async function M() {
417
+ async function R() {
418
418
  e.value = !0, l.onFinished(m.value.toISOString());
419
419
  }
420
- return (w, h) => {
421
- const T = U("FmLabel"), P = U("FmDatePicker"), R = U("FmTimePicker"), s = U("FmButton"), a = U("FmForm");
422
- return v.value ? (C(), se(a, {
420
+ return (S, k) => {
421
+ const $ = U("FmLabel"), P = U("FmDatePicker"), I = U("FmTimePicker"), n = U("FmButton"), a = U("FmForm");
422
+ return p.value ? (j(), se(a, {
423
423
  key: 1,
424
- onValidationSuccess: M,
424
+ onValidationSuccess: R,
425
425
  class: "flex flex-col gap-32",
426
426
  disabled: e.value
427
427
  }, {
428
428
  default: Y(() => [
429
- h[5] || (h[5] = r("div", { class: "fm-typo-en-body-lg-400" }, [
429
+ k[5] || (k[5] = r("div", { class: "fm-typo-en-body-lg-400" }, [
430
430
  r("p", null, [
431
431
  X(" Performing "),
432
432
  r("span", { class: "fm-typo-en-body-lg-600" }, '"Refresh Balance"'),
@@ -439,34 +439,34 @@ const la = { class: "flex flex-col" }, ca = { class: "flex gap-12 py-8 justify-e
439
439
  ])
440
440
  ], -1)),
441
441
  r("div", la, [
442
- k(T, { class: "fm-typo-en-body-lg-600" }, {
443
- default: Y(() => h[3] || (h[3] = [
442
+ h($, { class: "fm-typo-en-body-lg-600" }, {
443
+ default: Y(() => k[3] || (k[3] = [
444
444
  X("Closing Date")
445
445
  ])),
446
446
  _: 1
447
447
  }),
448
- k(P, {
449
- modelValue: D.value,
450
- "onUpdate:modelValue": h[0] || (h[0] = (x) => D.value = x)
448
+ h(P, {
449
+ modelValue: _.value,
450
+ "onUpdate:modelValue": k[0] || (k[0] = (D) => _.value = D)
451
451
  }, null, 8, ["modelValue"]),
452
- k(T, { class: "fm-typo-en-body-lg-600" }, {
453
- default: Y(() => h[4] || (h[4] = [
452
+ h($, { class: "fm-typo-en-body-lg-600" }, {
453
+ default: Y(() => k[4] || (k[4] = [
454
454
  X("Closing Time")
455
455
  ])),
456
456
  _: 1
457
457
  }),
458
- k(R, {
459
- modelValue: y.value,
460
- "onUpdate:modelValue": h[1] || (h[1] = (x) => y.value = x)
458
+ h(I, {
459
+ modelValue: v.value,
460
+ "onUpdate:modelValue": k[1] || (k[1] = (D) => v.value = D)
461
461
  }, null, 8, ["modelValue"])
462
462
  ]),
463
463
  r("div", ca, [
464
- k(s, {
464
+ h(n, {
465
465
  label: "Cancel",
466
466
  variant: "tertiary",
467
- onClick: h[2] || (h[2] = (x) => w.onCancel())
467
+ onClick: k[2] || (k[2] = (D) => S.onCancel())
468
468
  }),
469
- k(s, {
469
+ h(n, {
470
470
  label: "Refresh balance",
471
471
  type: "submit",
472
472
  variant: "primary",
@@ -475,7 +475,7 @@ const la = { class: "flex flex-col" }, ca = { class: "flex gap-12 py-8 justify-e
475
475
  ])
476
476
  ]),
477
477
  _: 1
478
- }, 8, ["disabled"])) : (C(), L(ee, { key: 0 }, [
478
+ }, 8, ["disabled"])) : (j(), L(ee, { key: 0 }, [
479
479
  X("Loading")
480
480
  ], 64));
481
481
  };
@@ -483,18 +483,18 @@ const la = { class: "flex flex-col" }, ca = { class: "flex gap-12 py-8 justify-e
483
483
  }), Ee = pt(
484
484
  "closingDraftActions",
485
485
  function() {
486
- const l = Ot(), e = Ge(), m = We(), v = Ne(), D = vt(), y = H(!1), M = H();
487
- function w(f) {
488
- const g = {
486
+ const l = Ot(), e = Ge(), m = We(), p = Ne(), _ = vt(), v = H(!1), R = H();
487
+ function S(f) {
488
+ const y = {
489
489
  draft: f
490
490
  };
491
- M.value = g, y.value = !0;
491
+ R.value = y, v.value = !0;
492
492
  }
493
- async function h(f) {
493
+ async function k(f) {
494
494
  var A;
495
495
  if (f.status === pe.enum.COMPLETED) {
496
- const _ = f.closingAdjustmentId;
497
- if (!_)
496
+ const w = f.closingAdjustmentId;
497
+ if (!w)
498
498
  return e.open({
499
499
  title: "Something went wrong",
500
500
  message: "Closing draft is completed but closing document cannot be found.",
@@ -502,22 +502,22 @@ const la = { class: "flex flex-col" }, ca = { class: "flex gap-12 py-8 justify-e
502
502
  }), console.error("Closing draft is completed but closing document cannot be found.", {
503
503
  draftId: f._id
504
504
  }), [];
505
- const $ = await m.readAdjustmentById(_);
506
- return (($ == null ? void 0 : $.skus) ?? []).map((q) => ({
507
- id: q.sku._id,
508
- balance: q.fromBalance,
509
- costs: q.fromCostBalances
505
+ const M = await m.readAdjustmentById(w);
506
+ return ((M == null ? void 0 : M.skus) ?? []).map((W) => ({
507
+ id: W.sku._id,
508
+ balance: W.fromBalance,
509
+ costs: W.fromCostBalances
510
510
  }));
511
511
  } else
512
- return await D.readStockBalance(), ((A = D.stockBalance) == null ? void 0 : A.skus) ?? [];
512
+ return await _.readStockBalance(), ((A = _.stockBalance) == null ? void 0 : A.skus) ?? [];
513
513
  }
514
- async function T(f, g, A) {
515
- g || (e.open({
514
+ async function $(f, y, A) {
515
+ y || (e.open({
516
516
  title: "Exporting",
517
517
  message: "Fetching data..."
518
- }), g = await h(f)), ra(f, g, A ?? []);
518
+ }), y = await k(f)), ra(f, y, A ?? []);
519
519
  }
520
- function P(f, g) {
520
+ function P(f, y) {
521
521
  l.open({
522
522
  title: "Approve draft",
523
523
  contentComponent: Oe,
@@ -525,13 +525,13 @@ const la = { class: "flex flex-col" }, ca = { class: "flex gap-12 py-8 justify-e
525
525
  draft: f,
526
526
  action: z.enum.approveDraft,
527
527
  onFinished: () => {
528
- l.close(), g == null || g();
528
+ l.close(), y == null || y();
529
529
  },
530
530
  onCancel: () => l.close()
531
531
  }
532
532
  });
533
533
  }
534
- function R(f, g) {
534
+ function I(f, y) {
535
535
  l.open({
536
536
  title: "Reject draft",
537
537
  contentComponent: Oe,
@@ -539,13 +539,13 @@ const la = { class: "flex flex-col" }, ca = { class: "flex gap-12 py-8 justify-e
539
539
  draft: f,
540
540
  action: z.enum.rejectDraft,
541
541
  onFinished: () => {
542
- l.close(), g == null || g();
542
+ l.close(), y == null || y();
543
543
  },
544
544
  onCancel: () => l.close()
545
545
  }
546
546
  });
547
547
  }
548
- function s(f, g) {
548
+ function n(f, y) {
549
549
  l.open({
550
550
  title: "Mark draft as failed",
551
551
  contentComponent: Oe,
@@ -553,14 +553,14 @@ const la = { class: "flex flex-col" }, ca = { class: "flex gap-12 py-8 justify-e
553
553
  draft: f,
554
554
  action: z.enum.markAsFailed,
555
555
  onFinished: () => {
556
- l.close(), g == null || g();
556
+ l.close(), y == null || y();
557
557
  },
558
558
  onCancel: () => l.close()
559
559
  }
560
560
  });
561
561
  }
562
- async function a(f, g) {
563
- await v.sync({
562
+ async function a(f, y) {
563
+ await p.sync({
564
564
  _id: f._id,
565
565
  _rev: f._rev ?? "",
566
566
  action: z.enum.approveDraft,
@@ -571,42 +571,42 @@ const la = { class: "flex flex-col" }, ca = { class: "flex gap-12 py-8 justify-e
571
571
  title: "Success",
572
572
  message: "Sync requested",
573
573
  type: "success"
574
- }), g == null || g();
574
+ }), y == null || y();
575
575
  }
576
- function x() {
577
- y.value = !1;
576
+ function D() {
577
+ v.value = !1;
578
578
  }
579
- async function O(f, g, A) {
579
+ async function O(f, y, A) {
580
580
  await l.open({
581
581
  title: "Refresh balance",
582
582
  contentComponent: ia,
583
583
  contentComponentProps: {
584
584
  draft: f,
585
- onFinished: (_) => {
586
- l.close(), A == null || A(_);
585
+ onFinished: (w) => {
586
+ l.close(), A == null || A(w);
587
587
  },
588
588
  onCancel: async () => {
589
- l.close(), g == null || g();
589
+ l.close(), y == null || y();
590
590
  }
591
591
  }
592
592
  });
593
593
  }
594
594
  return {
595
- viewDraft: w,
596
- closeDraftDialog: x,
595
+ viewDraft: S,
596
+ closeDraftDialog: D,
597
597
  approveDraft: P,
598
- rejectDraft: R,
599
- markAsFailed: s,
598
+ rejectDraft: I,
599
+ markAsFailed: n,
600
600
  syncDraft: a,
601
- exportDraft: T,
601
+ exportDraft: $,
602
602
  refreshBalance: O,
603
- viewClosingDraftShow: y,
604
- viewClosingDraftProps: M
603
+ viewClosingDraftShow: v,
604
+ viewClosingDraftProps: R
605
605
  };
606
606
  }
607
607
  );
608
- function Le(o) {
609
- switch (o) {
608
+ function Le(s) {
609
+ switch (s) {
610
610
  case "DRAFT":
611
611
  return "fm-status-badge-draft";
612
612
  case "PROCESSING":
@@ -620,57 +620,57 @@ function Le(o) {
620
620
  const ua = pt(
621
621
  "closingDraftTable",
622
622
  function() {
623
- const { t: l } = ft(), e = Ee(), m = H(new Array()), v = H(!1), D = ze(), y = Ne();
624
- async function M() {
625
- if (m.value = [], !!D._currentLocation) {
626
- v.value = !0;
623
+ const { t: l } = ft(), e = Ee(), m = H(new Array()), p = H(!1), _ = ze(), v = Ne();
624
+ async function R() {
625
+ if (m.value = [], !!_._currentLocation) {
626
+ p.value = !0;
627
627
  try {
628
- const [s] = await Promise.all([y.readDrafts()]).delayed(1e3);
629
- m.value = s.reverse();
630
- } catch (s) {
631
- console.log("Something went wrong when fetching drafts:", s);
628
+ const [n] = await Promise.all([v.readDrafts()]).delayed(1e3);
629
+ m.value = n.reverse();
630
+ } catch (n) {
631
+ console.log("Something went wrong when fetching drafts:", n);
632
632
  } finally {
633
- v.value = !1;
633
+ p.value = !1;
634
634
  }
635
635
  }
636
636
  }
637
- async function w(s) {
638
- if (!m.value.find((a) => a._id) && D._currentLocation) {
639
- v.value = !0;
637
+ async function S(n) {
638
+ if (!m.value.find((a) => a._id) && _._currentLocation) {
639
+ p.value = !0;
640
640
  try {
641
641
  const [a] = await Promise.all([
642
- y.getDraft(s),
643
- new Promise((x) => setTimeout(x, 1e3))
642
+ v.getDraft(n),
643
+ new Promise((D) => setTimeout(D, 1e3))
644
644
  ]);
645
645
  m.value = [a];
646
646
  } catch (a) {
647
647
  console.log("Something went wrong when fetching drafts:", a);
648
648
  } finally {
649
- v.value = !1;
649
+ p.value = !1;
650
650
  }
651
651
  }
652
652
  }
653
- function h(s) {
654
- m.value = m.value.map((a) => a._id === s._id ? {
655
- ...s,
653
+ function k(n) {
654
+ m.value = m.value.map((a) => a._id === n._id ? {
655
+ ...n,
656
656
  _rev: a._rev
657
657
  } : a);
658
658
  }
659
- function T() {
660
- e.closeDraftDialog(), M();
659
+ function $() {
660
+ e.closeDraftDialog(), R();
661
661
  }
662
- function P(s, a) {
663
- switch (a = It(a), s) {
662
+ function P(n, a) {
663
+ switch (a = It(a), n) {
664
664
  case Re.Details:
665
665
  return e.viewDraft(a);
666
666
  case Re.Export:
667
667
  return e.exportDraft(a);
668
668
  case z.enum.approveDraft:
669
- return e.approveDraft(a, T);
669
+ return e.approveDraft(a, $);
670
670
  case z.enum.rejectDraft:
671
- return e.rejectDraft(a, T);
671
+ return e.rejectDraft(a, $);
672
672
  case z.enum.markAsFailed:
673
- return e.markAsFailed(a, T);
673
+ return e.markAsFailed(a, $);
674
674
  }
675
675
  }
676
676
  return {
@@ -679,25 +679,25 @@ const ua = pt(
679
679
  id: "_id",
680
680
  accessorKey: "_id",
681
681
  header: () => l("inventory.closing.table.createdAt"),
682
- cell(s) {
683
- return Mt(`${s.getValue()}`);
682
+ cell(n) {
683
+ return Mt(`${n.getValue()}`);
684
684
  },
685
685
  enableSorting: !0
686
686
  },
687
687
  {
688
688
  accessorKey: "effectiveAt",
689
689
  header: () => "Effective at",
690
- cell(s) {
691
- const a = s.row.original;
692
- let x = s.getValue();
693
- return x || (x = Ke(a._id)), ve(x);
690
+ cell(n) {
691
+ const a = n.row.original;
692
+ let D = n.getValue();
693
+ return D || (D = Ke(a._id)), ve(D);
694
694
  },
695
695
  enableSorting: !0,
696
696
  size: 200
697
697
  },
698
698
  {
699
699
  id: "updatedAt",
700
- accessorFn: (s) => ve(s.updatedAt),
700
+ accessorFn: (n) => ve(n.updatedAt),
701
701
  header: () => "Updated at",
702
702
  enableSorting: !0,
703
703
  size: 200
@@ -711,9 +711,9 @@ const ua = pt(
711
711
  },
712
712
  {
713
713
  id: "noOfItems",
714
- accessorFn: (s) => {
714
+ accessorFn: (n) => {
715
715
  var a;
716
- return s.items.length + (((a = s.negativeStockItems) == null ? void 0 : a.length) ?? 0);
716
+ return n.items.length + (((a = n.negativeStockItems) == null ? void 0 : a.length) ?? 0);
717
717
  },
718
718
  header: () => l("inventory.closing.table.noOfItems"),
719
719
  enableSorting: !1,
@@ -724,63 +724,63 @@ const ua = pt(
724
724
  },
725
725
  {
726
726
  id: "recentRemark",
727
- accessorFn: (s) => {
727
+ accessorFn: (n) => {
728
728
  var a;
729
- return (s == null ? void 0 : s.approveRemark) ?? ((a = s == null ? void 0 : s.rejectionHistory) == null ? void 0 : a.computeFirst((x) => x.rejectRemark)) ?? s.remark;
729
+ return (n == null ? void 0 : n.approveRemark) ?? ((a = n == null ? void 0 : n.rejectionHistory) == null ? void 0 : a.computeFirst((D) => D.rejectRemark)) ?? n.remark;
730
730
  },
731
731
  header: () => "Recent remark"
732
732
  },
733
733
  {
734
734
  id: "status",
735
- accessorFn: (s) => s.status,
735
+ accessorFn: (n) => n.status,
736
736
  header: () => l("inventory.closing.table.status"),
737
737
  enableSorting: !1,
738
- cell(s) {
738
+ cell(n) {
739
739
  var A;
740
- const a = s.row.original, x = a.status, O = new Date(a.updatedAt), f = (A = a == null ? void 0 : a.rejectionHistory) == null ? void 0 : A.computeFirst((_) => _.rejectedAt), g = f ? new Date(f) : null;
741
- return x === "DRAFT" && g ? g.getTime() > O.getTime() ? F(
740
+ const a = n.row.original, D = a.status, O = new Date(a.updatedAt), f = (A = a == null ? void 0 : a.rejectionHistory) == null ? void 0 : A.computeFirst((w) => w.rejectedAt), y = f ? new Date(f) : null;
741
+ return D === "DRAFT" && y ? y.getTime() > O.getTime() ? T(
742
742
  "div",
743
743
  {
744
744
  class: "flex"
745
745
  },
746
- F(
746
+ T(
747
747
  "div",
748
748
  {
749
749
  class: ["fm-status-badge", Le("FAILED")]
750
750
  },
751
751
  "Rejected"
752
752
  )
753
- ) : F(
753
+ ) : T(
754
754
  "div",
755
755
  {
756
756
  class: "flex"
757
757
  },
758
- F(
758
+ T(
759
759
  "div",
760
760
  {
761
761
  class: ["fm-status-badge", Le("PROCESSING")]
762
762
  },
763
763
  "Updated"
764
764
  )
765
- ) : F(
765
+ ) : T(
766
766
  "div",
767
767
  {
768
768
  class: "flex"
769
769
  },
770
- F(
770
+ T(
771
771
  "div",
772
772
  {
773
- class: ["fm-status-badge", Le(x)]
773
+ class: ["fm-status-badge", Le(D)]
774
774
  },
775
- Ue(x)
775
+ Ue(D)
776
776
  )
777
777
  );
778
778
  }
779
779
  },
780
780
  {
781
781
  id: "action",
782
- cell(s) {
783
- const a = s.row.original, x = [
782
+ cell(n) {
783
+ const a = n.row.original, D = [
784
784
  st[Re.Details],
785
785
  st[Re.Export]
786
786
  ], O = [
@@ -802,7 +802,7 @@ const ua = pt(
802
802
  ];
803
803
  return Rt(
804
804
  [
805
- ...x,
805
+ ...D,
806
806
  ...a.status === pe.enum.DRAFT ? O : []
807
807
  ],
808
808
  (f) => P(f, a)
@@ -817,13 +817,13 @@ const ua = pt(
817
817
  }
818
818
  ],
819
819
  drafts: m,
820
- loading: v,
821
- fetchDrafts: M,
822
- loadDraft: w,
823
- updateDraftRef: h
820
+ loading: p,
821
+ fetchDrafts: R,
822
+ loadDraft: S,
823
+ updateDraftRef: k
824
824
  };
825
825
  }
826
- ), da = { class: "w-full flex flex-col gap-32" }, ma = { class: "flex justify-between" }, fa = { class: "flex" }, pa = { class: "grid grid-cols-[repeat(4,1fr)] xs:flex xs:flex-col sm:flex sm:flex-col gap-8" }, va = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ya = { class: "flex gap-1" }, ga = { class: "fm-typo-en-body-lg-600" }, ba = { class: "flex flex-col gap-16" }, ka = { class: "flex items-center" }, ha = {
826
+ ), da = { class: "w-full flex flex-col gap-32" }, ma = { class: "flex justify-between" }, fa = { class: "flex" }, pa = { class: "grid grid-cols-[repeat(4,1fr)] xs:flex xs:flex-col sm:flex sm:flex-col gap-8" }, va = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ya = { class: "flex gap-1" }, ga = { class: "fm-typo-en-body-lg-600" }, ba = { class: "flex flex-col gap-16" }, ha = { class: "flex items-center" }, ka = {
827
827
  key: 0,
828
828
  class: "flex gap-8"
829
829
  }, Aa = {
@@ -860,44 +860,44 @@ const ua = pt(
860
860
  draft: {}
861
861
  },
862
862
  emits: ["submitted", "refresh"],
863
- setup(o, { emit: l }) {
864
- const e = o, m = vt(), v = Ee(), D = Kt(e, "show"), y = H(!1), M = H(!1), w = H(!1), h = H(new Array()), T = H(new Array()), P = H([]), R = We(), s = Ne(), a = Ge(), x = Pt(), O = ze(), f = _t({}), g = V(() => new Set(
865
- x.skus.filter((c) => {
863
+ setup(s, { emit: l }) {
864
+ const e = s, m = vt(), p = Ee(), _ = Kt(e, "show"), v = H(!1), R = H(!1), S = H(!1), k = H(new Array()), $ = H(new Array()), P = H([]), I = We(), n = Ne(), a = Ge(), D = Pt(), O = ze(), f = _t({}), y = V(() => new Set(
865
+ D.skus.filter((c) => {
866
866
  var t;
867
867
  return f[(t = c.customAttributes) == null ? void 0 : t.tag];
868
868
  }).map((c) => c._id)
869
- )), A = l, _ = H({
869
+ )), A = l, w = H({
870
870
  templateItem: !0,
871
871
  nonTemplateItem: !0
872
- }), $ = V(() => {
872
+ }), M = V(() => {
873
873
  var t, d;
874
874
  const c = [...((t = e.draft) == null ? void 0 : t.items) ?? [], ...((d = e.draft) == null ? void 0 : d.negativeStockItems) ?? []];
875
- return g.value.size ? c.filter((i) => g.value.has(i.sku._id)) : c;
875
+ return y.value.size ? c.filter((i) => y.value.has(i.sku._id)) : c;
876
876
  }), Z = V(() => {
877
- const c = $.value.map((t) => t.sku);
877
+ const c = M.value.map((t) => t.sku);
878
878
  return c.sort((t, d) => t.code.localeCompare(d.code)), c;
879
- }), q = V(() => $.value.groupBy(
879
+ }), W = V(() => M.value.groupBy(
880
880
  (t) => t.sku._id,
881
881
  (t) => t.measurementsAmounts.filter((d) => !d.measurement.abbrev.toLocaleLowerCase().includes("inactive")).map((d) => d.measurement.id)
882
882
  ));
883
883
  Ye(te), Dt(
884
884
  () => e.show,
885
885
  (c) => {
886
- c && (le.value = xe[0], te(), _.value = {
886
+ c && (le.value = xe[0], te(), w.value = {
887
887
  templateItem: !0,
888
888
  nonTemplateItem: !0
889
889
  });
890
890
  }
891
891
  );
892
- const re = Be(0), j = Be(100);
892
+ const re = Be(0), B = Be(100);
893
893
  async function te() {
894
- var t, d, i, n;
894
+ var t, d, i, o;
895
895
  if (!O._currentLocation) return;
896
- y.value = !0;
896
+ v.value = !0;
897
897
  const c = ((t = e.draft) == null ? void 0 : t.status) === pe.enum.COMPLETED;
898
- T.value = [];
898
+ $.value = [];
899
899
  try {
900
- if (await x.init(), c) {
900
+ if (await D.init(), c) {
901
901
  const E = e.draft.closingAdjustmentId;
902
902
  if (!E) {
903
903
  a.open({
@@ -909,31 +909,31 @@ const ua = pt(
909
909
  });
910
910
  return;
911
911
  }
912
- const ae = await R.readAdjustmentById(E), ce = (ae == null ? void 0 : ae.skus) ?? [];
912
+ const ae = await I.readAdjustmentById(E), ce = (ae == null ? void 0 : ae.skus) ?? [];
913
913
  for (const ne of ce) {
914
- const Se = {
914
+ const Ce = {
915
915
  id: ne.sku._id,
916
916
  balance: ne.fromBalance,
917
917
  costs: ne.fromCostBalances
918
- }, S = {
918
+ }, C = {
919
919
  id: ne.sku._id,
920
920
  balance: ne.toBalance,
921
921
  costs: ne.toCostBalances
922
922
  };
923
- h.value.push(Se), T.value.push(S);
923
+ k.value.push(Ce), $.value.push(C);
924
924
  }
925
925
  } else
926
- h.value = ((i = e.draft) == null ? void 0 : i.stockSnapshot) ?? [];
926
+ k.value = ((i = e.draft) == null ? void 0 : i.stockSnapshot) ?? [];
927
927
  const u = /* @__PURE__ */ new Set();
928
- if ((n = e.draft) != null && n.adjustmentSnapshot)
928
+ if ((o = e.draft) != null && o.adjustmentSnapshot)
929
929
  for (const E of e.draft.adjustmentSnapshot)
930
930
  E.adjustmentsByType && Object.keys(E.adjustmentsByType).forEach((ae) => u.add(ae));
931
- const b = ["receive", "sales", "wastage"], p = [];
932
- b.forEach((E) => {
933
- u.has(E) && (p.push(E), u.delete(E));
931
+ const g = ["receive", "sales", "wastage"], x = [];
932
+ g.forEach((E) => {
933
+ u.has(E) && (x.push(E), u.delete(E));
934
934
  });
935
- const I = Array.from(u).sort();
936
- P.value = [...p, ...I];
935
+ const b = Array.from(u).sort();
936
+ P.value = [...x, ...b];
937
937
  } catch (u) {
938
938
  a.open({
939
939
  title: "Something went wrong",
@@ -941,7 +941,7 @@ const ua = pt(
941
941
  type: "error"
942
942
  }), console.error("error on fetch stock balances", u);
943
943
  } finally {
944
- y.value = !1;
944
+ v.value = !1;
945
945
  }
946
946
  }
947
947
  async function be() {
@@ -954,20 +954,20 @@ const ua = pt(
954
954
  });
955
955
  return;
956
956
  }
957
- await v.refreshBalance(
957
+ await p.refreshBalance(
958
958
  e.draft,
959
959
  () => {
960
960
  },
961
961
  async (i) => {
962
- var p;
963
- M.value = !0;
964
- const n = (p = e.draft) == null ? void 0 : p._rev, u = 30, b = 2e3;
962
+ var x;
963
+ R.value = !0;
964
+ const o = (x = e.draft) == null ? void 0 : x._rev, u = 30, g = 2e3;
965
965
  try {
966
- await R.recalculation.scheduleCalculateStockSnapshotAtDate(i, e.draft._id);
967
- let I = null;
968
- for (let E = 0; E < u && (I = await s.getDraft(e.draft._id).delayed(b), I._rev === n); E++)
966
+ await I.recalculation.scheduleCalculateStockSnapshotAtDate(i, e.draft._id);
967
+ let b = null;
968
+ for (let E = 0; E < u && (b = await n.getDraft(e.draft._id).delayed(g), b._rev === o); E++)
969
969
  ;
970
- if (!I || I._rev === n) {
970
+ if (!b || b._rev === o) {
971
971
  a.open({
972
972
  title: "Refresh failed",
973
973
  message: "Failed to refresh stock balance. Please try again.",
@@ -975,29 +975,29 @@ const ua = pt(
975
975
  }), console.error("error refreshing stock balances: there is no change in _rev");
976
976
  return;
977
977
  }
978
- A("refresh", I), h.value = I.stockSnapshot ?? [], a.open({
978
+ A("refresh", b), k.value = b.stockSnapshot ?? [], a.open({
979
979
  title: "Balance refreshed",
980
980
  message: "Stock balance has been recalculated.",
981
981
  type: "success"
982
- });
983
- } catch (I) {
982
+ }), _.value = !1;
983
+ } catch (b) {
984
984
  a.open({
985
985
  title: "Refresh failed",
986
986
  message: "Failed to refresh stock balance. Please try again.",
987
987
  type: "error"
988
- }), console.error("error refreshing stock balances", I);
988
+ }), console.error("error refreshing stock balances", b);
989
989
  } finally {
990
- M.value = !1;
990
+ R.value = !1;
991
991
  }
992
992
  }
993
993
  );
994
994
  }
995
- const ke = V(
996
- () => h.value.groupBy(
995
+ const he = V(
996
+ () => k.value.groupBy(
997
997
  (c) => c.id,
998
998
  (c) => c.balance
999
999
  )
1000
- ), fe = V(() => $.value.groupBy((c) => c.sku._id)), ye = V(() => {
1000
+ ), fe = V(() => M.value.groupBy((c) => c.sku._id)), ye = V(() => {
1001
1001
  var c;
1002
1002
  return (c = e.draft) != null && c.adjustmentSnapshot ? new Map(e.draft.adjustmentSnapshot.map((t) => [t.skuId, t.adjustmentsByType])) : /* @__PURE__ */ new Map();
1003
1003
  }), ge = V(() => {
@@ -1005,7 +1005,7 @@ const ua = pt(
1005
1005
  return (c = e.draft) != null && c.opening ? new Map(e.draft.opening.map((t) => [t.skuId, t.balance])) : /* @__PURE__ */ new Map();
1006
1006
  });
1007
1007
  function Q(c, t) {
1008
- return F(
1008
+ return T(
1009
1009
  Ve.FmTooltip,
1010
1010
  { zIndex: 51, placement: "left", class: "w-full flex justify-end" },
1011
1011
  {
@@ -1018,10 +1018,10 @@ const ua = pt(
1018
1018
  }
1019
1019
  );
1020
1020
  }
1021
- const De = V(() => {
1021
+ const we = V(() => {
1022
1022
  const c = Z.value.reduce((d, i) => {
1023
- var n, u;
1024
- return Math.max(d, ((u = (n = q.value) == null ? void 0 : n.get(i._id)) == null ? void 0 : u[0].length) ?? 0);
1023
+ var o, u;
1024
+ return Math.max(d, ((u = (o = W.value) == null ? void 0 : o.get(i._id)) == null ? void 0 : u[0].length) ?? 0);
1025
1025
  }, 0);
1026
1026
  return [
1027
1027
  {
@@ -1030,8 +1030,8 @@ const ua = pt(
1030
1030
  header: () => "Name",
1031
1031
  size: 350,
1032
1032
  cell(d) {
1033
- const i = d.row.original, n = i.adjustedDiffPercentage, u = typeof n == "number" && Math.abs(n) > 10, b = F("div", { class: "flex flex-col gap-4" }, [
1034
- F(
1033
+ const i = d.row.original, o = i.adjustedDiffPercentage, u = typeof o == "number" && Math.abs(o) > 10, g = T("div", { class: "flex flex-col gap-4" }, [
1034
+ T(
1035
1035
  "div",
1036
1036
  {
1037
1037
  class: [
@@ -1041,7 +1041,7 @@ const ua = pt(
1041
1041
  },
1042
1042
  i.name
1043
1043
  ),
1044
- F(
1044
+ T(
1045
1045
  "div",
1046
1046
  {
1047
1047
  class: [
@@ -1052,7 +1052,7 @@ const ua = pt(
1052
1052
  i.code
1053
1053
  )
1054
1054
  ]);
1055
- return F(
1055
+ return T(
1056
1056
  Ve.FmTooltip,
1057
1057
  {
1058
1058
  zIndex: 51
@@ -1062,8 +1062,8 @@ const ua = pt(
1062
1062
  return u ? "Adjustment difference is more than 10%." : `${i.code} - ${i.name}`;
1063
1063
  },
1064
1064
  default() {
1065
- return F("div", { class: "flex items-center gap-4 justify-start w-full" }, [
1066
- b
1065
+ return T("div", { class: "flex items-center gap-4 justify-start w-full" }, [
1066
+ g
1067
1067
  ]);
1068
1068
  }
1069
1069
  }
@@ -1077,7 +1077,7 @@ const ua = pt(
1077
1077
  size: 160,
1078
1078
  cell(d) {
1079
1079
  const i = d.row.original.costPerUnit;
1080
- return F("div", { class: "text-right" }, i.toFixed(2));
1080
+ return T("div", { class: "text-right" }, i.toFixed(2));
1081
1081
  },
1082
1082
  meta: {
1083
1083
  textAlign: "right"
@@ -1088,8 +1088,8 @@ const ua = pt(
1088
1088
  header: () => "UOM",
1089
1089
  size: 80,
1090
1090
  cell(d) {
1091
- const i = d.row.original.costUnit, n = d.row.original.baseUnit;
1092
- return i ?? n;
1091
+ const i = d.row.original.costUnit, o = d.row.original.baseUnit;
1092
+ return i ?? o;
1093
1093
  }
1094
1094
  },
1095
1095
  {
@@ -1099,7 +1099,7 @@ const ua = pt(
1099
1099
  size: 150,
1100
1100
  cell(d) {
1101
1101
  const i = d.row.original.opening;
1102
- return F("div", { class: "text-right" }, i.toFixed(2));
1102
+ return T("div", { class: "text-right" }, i.toFixed(2));
1103
1103
  },
1104
1104
  meta: {
1105
1105
  textAlign: "right"
@@ -1113,8 +1113,8 @@ const ua = pt(
1113
1113
  header: () => Q(Ue(d)),
1114
1114
  size: 150,
1115
1115
  cell(i) {
1116
- const n = i.row.original.adjustmentAmounts[d] ?? { amount: 0, precision: 0 };
1117
- return F("div", { class: "text-right" }, N(n));
1116
+ const o = i.row.original.adjustmentAmounts[d] ?? { amount: 0, precision: 0 };
1117
+ return T("div", { class: "text-right" }, N(o));
1118
1118
  },
1119
1119
  meta: {
1120
1120
  textAlign: "right"
@@ -1133,26 +1133,26 @@ const ua = pt(
1133
1133
  {
1134
1134
  id: "physicalBalance",
1135
1135
  accessorFn: (d) => {
1136
- var n;
1137
- const i = (n = T.value.find((u) => u.id === d.id)) == null ? void 0 : n.balance;
1136
+ var o;
1137
+ const i = (o = $.value.find((u) => u.id === d.id)) == null ? void 0 : o.balance;
1138
1138
  return i ? Ie.toFormatString({ value: i }) : d.physicalBalance;
1139
1139
  },
1140
1140
  header: () => Q("Stock Take balance", "The physical balance recorded during stock take."),
1141
1141
  cell(d) {
1142
- var I;
1143
- const i = d.row.original, n = Ie.fromNumber(i.physicalBalance);
1144
- let u = !0, b = i.physicalBalance;
1145
- const p = (I = T.value.find((E) => E.id === i.id)) == null ? void 0 : I.balance;
1146
- return p && (Ie.equals({
1147
- a: n,
1148
- b: p
1149
- }) || (u = !1, b = Number(Ie.toFormatString({ value: p })))), F("div", { class: "flex flex-col" }, [
1150
- F(
1142
+ var b;
1143
+ const i = d.row.original, o = Ie.fromNumber(i.physicalBalance);
1144
+ let u = !0, g = i.physicalBalance;
1145
+ const x = (b = $.value.find((E) => E.id === i.id)) == null ? void 0 : b.balance;
1146
+ return x && (Ie.equals({
1147
+ a: o,
1148
+ b: x
1149
+ }) || (u = !1, g = Number(Ie.toFormatString({ value: x })))), T("div", { class: "flex flex-col" }, [
1150
+ T(
1151
1151
  "span",
1152
1152
  { class: "line-clamp-1 fm-typo-en-body-lg-400 text-fm-color-typo-primary" },
1153
- b
1153
+ g
1154
1154
  ),
1155
- u ? null : F(
1155
+ u ? null : T(
1156
1156
  "span",
1157
1157
  { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" },
1158
1158
  `Draft: ${i.physicalBalance.toString()}`
@@ -1180,7 +1180,7 @@ const ua = pt(
1180
1180
  size: 150,
1181
1181
  cell(d) {
1182
1182
  const i = d.row.original.varianceRM;
1183
- return F("div", { class: "text-right" }, i.toFixed(2));
1183
+ return T("div", { class: "text-right" }, i.toFixed(2));
1184
1184
  },
1185
1185
  meta: {
1186
1186
  textAlign: "right"
@@ -1197,17 +1197,17 @@ const ua = pt(
1197
1197
  cell(d) {
1198
1198
  const i = d.row.original.adjustedDiffPercentage;
1199
1199
  if (!i) return Ya;
1200
- const n = i.toFixed(2);
1201
- if (n === "0.00")
1202
- return F("div", { class: "flex items-center gap-4 justify-end" }, ["0.00"]);
1200
+ const o = i.toFixed(2);
1201
+ if (o === "0.00")
1202
+ return T("div", { class: "flex items-center gap-4 justify-end" }, ["0.00"]);
1203
1203
  const u = i > 0;
1204
- return F("div", { class: "flex items-center gap-4 justify-end" }, [
1205
- F(Ve.FmIcon, {
1204
+ return T("div", { class: "flex items-center gap-4 justify-end" }, [
1205
+ T(Ve.FmIcon, {
1206
1206
  name: u ? "arrow_drop_up" : "arrow_drop_down",
1207
1207
  color: u ? "system-success-300" : "system-error-300",
1208
1208
  size: "md"
1209
1209
  }),
1210
- n
1210
+ o
1211
1211
  ]);
1212
1212
  },
1213
1213
  meta: {
@@ -1221,7 +1221,7 @@ const ua = pt(
1221
1221
  size: 180,
1222
1222
  cell(d) {
1223
1223
  const i = d.row.original.stockTakeValue;
1224
- return F("div", { class: "text-right" }, i.toFixed(2));
1224
+ return T("div", { class: "text-right" }, i.toFixed(2));
1225
1225
  },
1226
1226
  meta: {
1227
1227
  textAlign: "right"
@@ -1234,7 +1234,7 @@ const ua = pt(
1234
1234
  size: 180,
1235
1235
  cell(d) {
1236
1236
  const i = d.row.original.systemValue;
1237
- return F("div", { class: "text-right" }, i.toFixed(2));
1237
+ return T("div", { class: "text-right" }, i.toFixed(2));
1238
1238
  },
1239
1239
  meta: {
1240
1240
  textAlign: "right"
@@ -1245,41 +1245,41 @@ const ua = pt(
1245
1245
  header: () => "Amounts",
1246
1246
  enableSorting: !1,
1247
1247
  cell(d) {
1248
- const i = d.row.original, n = (b, p) => F(
1248
+ const i = d.row.original, o = (g, x) => T(
1249
1249
  Ve.FmTooltip,
1250
1250
  { zIndex: 50 },
1251
1251
  {
1252
1252
  default() {
1253
- return F(
1253
+ return T(
1254
1254
  "div",
1255
1255
  {
1256
1256
  class: "fm-typo-en-body-md-400 py-4 px-8 border-1 border-fm-color-typo-secondary fm-corner-radius-md line-clamp-1"
1257
1257
  },
1258
1258
  [
1259
- F("span", { class: "text-fm-color-typo-primary" }, `${b} `),
1260
- F(
1259
+ T("span", { class: "text-fm-color-typo-primary" }, `${g} `),
1260
+ T(
1261
1261
  "span",
1262
1262
  {
1263
1263
  class: "text-fm-color-typo-secondary",
1264
1264
  style: { maxWidth: "80px" }
1265
1265
  },
1266
- p
1266
+ x
1267
1267
  )
1268
1268
  ]
1269
1269
  );
1270
1270
  },
1271
1271
  content() {
1272
- return `${b} ${p}`;
1272
+ return `${g} ${x}`;
1273
1273
  }
1274
1274
  }
1275
1275
  );
1276
- let u = Array.from({ length: c }).map((b, p) => {
1277
- if (!i[`measurementAmount${p}`])
1276
+ let u = Array.from({ length: c }).map((g, x) => {
1277
+ if (!i[`measurementAmount${x}`])
1278
1278
  return null;
1279
- const I = i[`measurementAmount${p}`], E = i[`measurementAbbrev${p}`];
1280
- return n(I, E);
1281
- }).filter((b) => b);
1282
- return (i.baseUnitAmount || !u.length) && (u = [n(i.baseUnitAmount, i.baseUnit), ...u]), F(
1279
+ const b = i[`measurementAmount${x}`], E = i[`measurementAbbrev${x}`];
1280
+ return o(b, E);
1281
+ }).filter((g) => g);
1282
+ return (i.baseUnitAmount || !u.length) && (u = [o(i.baseUnitAmount, i.baseUnit), ...u]), T(
1283
1283
  "div",
1284
1284
  {
1285
1285
  class: "flex gap-8 flex-nowrap",
@@ -1292,33 +1292,33 @@ const ua = pt(
1292
1292
  }
1293
1293
  }
1294
1294
  ];
1295
- }), he = V(() => De.value.map((c) => c.size ?? 0).reduce((c, t) => c + t)), Ae = H(""), we = V(() => {
1295
+ }), ke = V(() => we.value.map((c) => c.size ?? 0).reduce((c, t) => c + t)), Ae = H(""), Se = V(() => {
1296
1296
  var d, i;
1297
1297
  const c = ((i = (d = e.draft) == null ? void 0 : d.negativeStockItems) == null ? void 0 : i.reduce(
1298
- (n, u) => (n[u.sku._id] = u, n),
1298
+ (o, u) => (o[u.sku._id] = u, o),
1299
1299
  {}
1300
1300
  )) ?? {};
1301
- return Z.value.map((n) => {
1301
+ return Z.value.map((o) => {
1302
1302
  var qe, Ze, Je, Xe, et, tt, at, nt, ot;
1303
- const u = (qe = fe.value.get(n._id)) == null ? void 0 : qe[0], b = ((Ze = ke.value.get(n._id)) == null ? void 0 : Ze[0]) ?? re, p = (Je = n.defaultCost) != null && Je.costPerUnit ? n.defaultCost.costPerUnit.amount / Math.pow(10, n.defaultCost.costPerUnit.precision) : 0, I = ge.value.get(n._id), E = I ? +N(I) : 0, ae = ye.value.get(n._id), ce = {};
1304
- if (P.value.forEach((W) => {
1305
- const oe = ce[W] ?? { amount: 0, precision: 0 }, ue = ae == null ? void 0 : ae[W];
1306
- ue && (ce[W] = Vt(oe, ue));
1303
+ const u = (qe = fe.value.get(o._id)) == null ? void 0 : qe[0], g = ((Ze = he.value.get(o._id)) == null ? void 0 : Ze[0]) ?? re, x = (Je = o.defaultCost) != null && Je.costPerUnit ? o.defaultCost.costPerUnit.amount / Math.pow(10, o.defaultCost.costPerUnit.precision) : 0, b = ge.value.get(o._id), E = b ? +N(b) : 0, ae = ye.value.get(o._id), ce = {};
1304
+ if (P.value.forEach((G) => {
1305
+ const oe = ce[G] ?? { amount: 0, precision: 0 }, ue = ae == null ? void 0 : ae[G];
1306
+ ue && (ce[G] = Vt(oe, ue));
1307
1307
  }), !u) {
1308
- const W = +N(b), oe = W - 0, ue = oe * p, Me = 0, xt = W * p;
1308
+ const G = +N(g), oe = G - 0, ue = oe * x, Me = 0, xt = G * x;
1309
1309
  return {
1310
- id: n._id,
1311
- code: n.code,
1312
- name: n.name,
1313
- costUnit: ((et = (Xe = n.defaultCost) == null ? void 0 : Xe.measurement) == null ? void 0 : et.abbrev) ?? null,
1314
- baseUnit: n.unit.abbrev,
1310
+ id: o._id,
1311
+ code: o.code,
1312
+ name: o.name,
1313
+ costUnit: ((et = (Xe = o.defaultCost) == null ? void 0 : Xe.measurement) == null ? void 0 : et.abbrev) ?? null,
1314
+ baseUnit: o.unit.abbrev,
1315
1315
  baseUnitAmount: 0,
1316
- systemBalance: W,
1316
+ systemBalance: G,
1317
1317
  physicalBalance: 0,
1318
- adjustedAmount: -W,
1318
+ adjustedAmount: -G,
1319
1319
  adjustedDiffPercentage: -100,
1320
- isTemplateItem: !c[n._id],
1321
- costPerUnit: p,
1320
+ isTemplateItem: !c[o._id],
1321
+ costPerUnit: x,
1322
1322
  opening: E,
1323
1323
  varianceQty: oe,
1324
1324
  varianceRM: ue,
@@ -1327,42 +1327,42 @@ const ua = pt(
1327
1327
  adjustmentAmounts: ce
1328
1328
  };
1329
1329
  }
1330
- const ne = yt(u), Se = (at = (tt = T.value) == null ? void 0 : tt.find(
1331
- (W) => W.id === n._id
1332
- )) == null ? void 0 : at.balance, S = ut(
1333
- Se ?? ne,
1334
- b
1335
- ), K = b.amount === 0 ? null : dt(S, {
1336
- ...b,
1337
- amount: Math.abs(b.amount)
1338
- }), G = K ? Qe(K, j) : null, ie = +N(b), Ce = +N(ne), $e = ie - Ce, kt = $e * p, ht = Ce * p, At = ie * p;
1330
+ const ne = yt(u), Ce = (at = (tt = $.value) == null ? void 0 : tt.find(
1331
+ (G) => G.id === o._id
1332
+ )) == null ? void 0 : at.balance, C = ut(
1333
+ Ce ?? ne,
1334
+ g
1335
+ ), K = g.amount === 0 ? null : dt(C, {
1336
+ ...g,
1337
+ amount: Math.abs(g.amount)
1338
+ }), q = K ? Qe(K, B) : null, ie = +N(g), _e = +N(ne), $e = ie - _e, ht = $e * x, kt = _e * x, At = ie * x;
1339
1339
  return {
1340
- id: n._id,
1341
- code: n.code,
1342
- name: n.name,
1343
- costUnit: ((ot = (nt = n.defaultCost) == null ? void 0 : nt.measurement) == null ? void 0 : ot.abbrev) ?? null,
1344
- baseUnit: n.unit.abbrev,
1340
+ id: o._id,
1341
+ code: o.code,
1342
+ name: o.name,
1343
+ costUnit: ((ot = (nt = o.defaultCost) == null ? void 0 : nt.measurement) == null ? void 0 : ot.abbrev) ?? null,
1344
+ baseUnit: o.unit.abbrev,
1345
1345
  baseUnitAmount: +N(u.baseAmount),
1346
- ...u.measurementsAmounts.filter((W) => {
1346
+ ...u.measurementsAmounts.filter((G) => {
1347
1347
  var oe, ue, Me;
1348
- return (Me = (ue = (oe = q.value) == null ? void 0 : oe.get(n._id)) == null ? void 0 : ue[0]) == null ? void 0 : Me.includes(W.measurement.id);
1349
- }).reduce((W, oe, ue) => (W[`measurementAbbrev${ue}`] = `(${oe.measurement.abbrev}) × ${N(oe.measurement.conversion)}`, W[`measurementAmount${ue}`] = +N(oe.amount), W), {}),
1348
+ return (Me = (ue = (oe = W.value) == null ? void 0 : oe.get(o._id)) == null ? void 0 : ue[0]) == null ? void 0 : Me.includes(G.measurement.id);
1349
+ }).reduce((G, oe, ue) => (G[`measurementAbbrev${ue}`] = `(${oe.measurement.abbrev}) × ${N(oe.measurement.conversion)}`, G[`measurementAmount${ue}`] = +N(oe.amount), G), {}),
1350
1350
  systemBalance: ie,
1351
- physicalBalance: Ce,
1352
- adjustedAmount: +N(S),
1353
- adjustedDiffPercentage: G ? +N(mt(G, 2)) : null,
1354
- isTemplateItem: !c[n._id],
1355
- costPerUnit: p,
1351
+ physicalBalance: _e,
1352
+ adjustedAmount: +N(C),
1353
+ adjustedDiffPercentage: q ? +N(mt(q, 2)) : null,
1354
+ isTemplateItem: !c[o._id],
1355
+ costPerUnit: x,
1356
1356
  opening: E,
1357
1357
  varianceQty: $e,
1358
- varianceRM: kt,
1359
- stockTakeValue: ht,
1358
+ varianceRM: ht,
1359
+ stockTakeValue: kt,
1360
1360
  systemValue: At,
1361
1361
  adjustmentAmounts: ce
1362
1362
  };
1363
- }).filter((n) => !!(n.isTemplateItem && _.value.templateItem || !n.isTemplateItem && _.value.nonTemplateItem));
1363
+ }).filter((o) => !!(o.isTemplateItem && w.value.templateItem || !o.isTemplateItem && w.value.nonTemplateItem));
1364
1364
  }), Fe = V(() => {
1365
- var t, d, i, n;
1365
+ var t, d, i, o;
1366
1366
  if (!e.draft) return [];
1367
1367
  const c = e.draft.approvedAt ? {
1368
1368
  action: `Approve at ${ve(e.draft.approvedAt)}`,
@@ -1410,7 +1410,7 @@ const ua = pt(
1410
1410
  } : null,
1411
1411
  c && c.actionBy ? {
1412
1412
  label: "Last action by",
1413
- value: (n = c.actionBy) == null ? void 0 : n.name
1413
+ value: (o = c.actionBy) == null ? void 0 : o.name
1414
1414
  } : null,
1415
1415
  c && c.remark ? {
1416
1416
  label: "Action remark",
@@ -1427,116 +1427,114 @@ const ua = pt(
1427
1427
  value: "history"
1428
1428
  }
1429
1429
  ], le = H(xe[0]), me = V(() => {
1430
- var i, n, u;
1431
- const c = ((i = e.draft) == null ? void 0 : i.activityLogs) ?? [], t = ((n = e.draft) == null ? void 0 : n.rejectionHistory) ?? [];
1432
- for (const b of t)
1430
+ var i, o, u;
1431
+ const c = ((i = e.draft) == null ? void 0 : i.activityLogs) ?? [], t = ((o = e.draft) == null ? void 0 : o.rejectionHistory) ?? [];
1432
+ for (const g of t)
1433
1433
  c.find(
1434
- (I) => `${I.action}_${I.performedAt}` == `${z.enum.rejectDraft}_${b.rejectedAt}`
1434
+ (b) => `${b.action}_${b.performedAt}` == `${z.enum.rejectDraft}_${g.rejectedAt}`
1435
1435
  ) || c.push({
1436
1436
  action: z.enum.rejectDraft,
1437
- performedAt: b.rejectedAt,
1438
- performedBy: b.rejectedBy,
1439
- remark: b.rejectRemark
1437
+ performedAt: g.rejectedAt,
1438
+ performedBy: g.rejectedBy,
1439
+ remark: g.rejectRemark
1440
1440
  });
1441
1441
  return (u = e.draft) != null && u.approvedAt && (c.find(
1442
- (p) => {
1443
- var I;
1444
- return `${p.action}_${p.performedAt}` == `${z.enum.approveDraft}_${(I = e.draft) == null ? void 0 : I.approvedAt}`;
1442
+ (x) => {
1443
+ var b;
1444
+ return `${x.action}_${x.performedAt}` == `${z.enum.approveDraft}_${(b = e.draft) == null ? void 0 : b.approvedAt}`;
1445
1445
  }
1446
1446
  ) || c.push({
1447
1447
  action: z.enum.approveDraft,
1448
1448
  performedAt: e.draft.approvedAt,
1449
1449
  performedBy: e.draft.approvedBy ?? { name: "Unknown", id: "unknown" },
1450
1450
  remark: e.draft.approveRemark
1451
- })), c.sort((b, p) => new Date(p.performedAt).getTime() - new Date(b.performedAt).getTime()).map(
1452
- (b) => ({
1453
- header: Ue(b.action),
1454
- date: ve(b.performedAt),
1451
+ })), c.sort((g, x) => new Date(x.performedAt).getTime() - new Date(g.performedAt).getTime()).map(
1452
+ (g) => ({
1453
+ header: Ue(g.action),
1454
+ date: ve(g.performedAt),
1455
1455
  info: [
1456
1456
  {
1457
1457
  label: "Performed by",
1458
- values: [b.performedBy.name]
1458
+ values: [g.performedBy.name]
1459
1459
  },
1460
1460
  {
1461
1461
  label: "Remark",
1462
- values: [b.remark ?? ""]
1462
+ values: [g.remark ?? ""]
1463
1463
  }
1464
1464
  ]
1465
1465
  })
1466
1466
  );
1467
1467
  }), Te = V(() => {
1468
- var n, u, b;
1469
- if (((n = e.draft) == null ? void 0 : n.status) !== pe.enum.DRAFT) return "Status is not draft.";
1470
- const c = we.value.some((p) => p.physicalBalance < 0), t = ((b = (u = m.stockBalance.skus) == null ? void 0 : u.filter((p) => p.balance.amount < 0)) == null ? void 0 : b.map((p) => p.id)) ?? [], d = new Set(Z.value.map((p) => p._id)), i = t.filter((p) => !d.has(p)).length;
1468
+ var o, u, g, x;
1469
+ if (!((o = e.draft) != null && o.stockSnapshot)) return "Stock snapshot is not available.";
1470
+ if (((u = e.draft) == null ? void 0 : u.status) !== pe.enum.DRAFT) return "Status is not draft.";
1471
+ const c = Se.value.some((b) => b.physicalBalance < 0), t = ((x = (g = m.stockBalance.skus) == null ? void 0 : g.filter((b) => b.balance.amount < 0)) == null ? void 0 : x.map((b) => b.id)) ?? [], d = new Set(Z.value.map((b) => b._id)), i = t.filter((b) => !d.has(b)).length;
1471
1472
  return [
1472
1473
  c ? "Negative total exist." : null,
1473
- i ? "Negative stock is not included in this draft. Reopen draft in POS and apply changes." : null
1474
- ].filter((p) => p).join(" ");
1474
+ i ? "Negative stock is not included in this draft. Please commit the draft to include these stocks." : null
1475
+ ].filter((b) => b).join(" ");
1475
1476
  });
1476
1477
  return (c, t) => {
1477
- const d = U("FmButtonGroup"), i = U("FmMenuDivider"), n = U("FmCard"), u = U("FmButton"), b = U("FmCircularProgress"), p = U("FmChip"), I = U("FmTextField"), E = U("FmIcon"), ae = U("FmTable"), ce = U("FmSpacer"), ne = U("FmTooltip"), Se = U("FmSideSheet");
1478
- return C(), se(Se, {
1478
+ const d = U("FmButtonGroup"), i = U("FmMenuDivider"), o = U("FmCard"), u = U("FmButton"), g = U("FmCircularProgress"), x = U("FmChip"), b = U("FmTextField"), E = U("FmIcon"), ae = U("FmTable"), ce = U("FmSpacer"), ne = U("FmTooltip"), Ce = U("FmSideSheet");
1479
+ return j(), se(Ce, {
1479
1480
  "dismiss-away": "",
1480
1481
  "max-width": 9999,
1481
- "model-value": B(D),
1482
- "onUpdate:modelValue": t[10] || (t[10] = (S) => rt(D) ? D.value = S : null),
1482
+ "model-value": F(_),
1483
+ "onUpdate:modelValue": t[10] || (t[10] = (C) => rt(_) ? _.value = C : null),
1483
1484
  header: "Closing details"
1484
1485
  }, {
1485
1486
  "side-sheet-footer": Y(() => {
1486
- var S, K;
1487
+ var C, K, q, ie;
1487
1488
  return [
1488
1489
  r("div", Ka, [
1489
- ((S = e.draft) == null ? void 0 : S.status) === B(pe).enum.DRAFT ? (C(), L(ee, { key: 0 }, [
1490
- Te.value ? (C(), se(ne, {
1490
+ ((C = e.draft) == null ? void 0 : C.status) === F(pe).enum.DRAFT ? (j(), L(ee, { key: 0 }, [
1491
+ Te.value ? (j(), se(ne, {
1491
1492
  key: 0,
1492
- "z-index": 51
1493
+ "z-index": 51,
1494
+ placement: "right"
1493
1495
  }, {
1494
1496
  content: Y(() => [
1495
1497
  X(J(Te.value), 1)
1496
1498
  ]),
1497
1499
  default: Y(() => [
1498
- k(u, {
1500
+ h(u, {
1499
1501
  disabled: "",
1500
1502
  key: "approve key",
1501
1503
  label: "Approve",
1502
- onClick: t[5] || (t[5] = () => e.draft && B(v).approveDraft(e.draft, () => A("submitted")))
1504
+ onClick: t[5] || (t[5] = () => e.draft && F(p).approveDraft(e.draft, () => A("submitted")))
1503
1505
  })
1504
1506
  ]),
1505
1507
  _: 1
1506
- })) : (C(), se(u, {
1508
+ })) : (j(), se(u, {
1507
1509
  key: "approve key",
1508
1510
  label: "Approve",
1509
- onClick: t[6] || (t[6] = () => e.draft && B(v).approveDraft(e.draft, () => A("submitted")))
1511
+ onClick: t[6] || (t[6] = () => e.draft && F(p).approveDraft(e.draft, () => A("submitted")))
1510
1512
  }))
1511
1513
  ], 64)) : de("", !0),
1512
- ((K = e.draft) == null ? void 0 : K.status) === B(pe).enum.DRAFT ? (C(), se(u, {
1514
+ ((K = e.draft) == null ? void 0 : K.status) === F(pe).enum.DRAFT ? (j(), se(u, {
1513
1515
  key: 1,
1514
1516
  label: "Reject",
1515
1517
  variant: "destructive",
1516
- onClick: t[7] || (t[7] = () => e.draft && B(v).rejectDraft(e.draft, () => A("submitted")))
1518
+ onClick: t[7] || (t[7] = () => e.draft && F(p).rejectDraft(e.draft, () => A("submitted")))
1517
1519
  })) : de("", !0),
1518
- k(Ut, null, {
1519
- default: Y(() => {
1520
- var G, ie;
1521
- return [
1522
- (G = e.draft) != null && G.approvedAt && ((ie = e.draft) == null ? void 0 : ie.status) !== B(pe).enum.COMPLETED ? (C(), se(u, {
1523
- key: 0,
1524
- label: "Sync",
1525
- loading: w.value,
1526
- onClick: t[8] || (t[8] = () => {
1527
- e.draft && (w.value = !0, B(v).syncDraft(e.draft, () => {
1528
- w.value = !1, A("submitted");
1529
- }));
1530
- })
1531
- }, null, 8, ["loading"])) : de("", !0)
1532
- ];
1533
- }),
1520
+ (q = e.draft) != null && q.approvedAt && ((ie = e.draft) == null ? void 0 : ie.status) !== F(pe).enum.COMPLETED ? (j(), se(Ut, { key: 2 }, {
1521
+ default: Y(() => [
1522
+ h(u, {
1523
+ label: "Sync",
1524
+ loading: S.value,
1525
+ onClick: t[8] || (t[8] = () => {
1526
+ e.draft && (S.value = !0, F(p).syncDraft(e.draft, () => {
1527
+ S.value = !1, A("submitted");
1528
+ }));
1529
+ })
1530
+ }, null, 8, ["loading"])
1531
+ ]),
1534
1532
  _: 1
1535
- }),
1536
- k(u, {
1533
+ })) : de("", !0),
1534
+ h(u, {
1537
1535
  label: "Close",
1538
1536
  variant: "tertiary",
1539
- onClick: t[9] || (t[9] = (G) => D.value = !1)
1537
+ onClick: t[9] || (t[9] = (_e) => _.value = !1)
1540
1538
  })
1541
1539
  ])
1542
1540
  ];
@@ -1544,38 +1542,38 @@ const ua = pt(
1544
1542
  default: Y(() => [
1545
1543
  r("div", da, [
1546
1544
  r("div", null, [
1547
- k(d, {
1545
+ h(d, {
1548
1546
  items: xe,
1549
1547
  modelValue: le.value,
1550
- "onUpdate:modelValue": t[0] || (t[0] = (S) => le.value = S)
1548
+ "onUpdate:modelValue": t[0] || (t[0] = (C) => le.value = C)
1551
1549
  }, null, 8, ["modelValue"])
1552
1550
  ]),
1553
- le.value.value === "overview" ? (C(), L(ee, { key: 0 }, [
1554
- k(n, {
1551
+ le.value.value === "overview" ? (j(), L(ee, { key: 0 }, [
1552
+ h(o, {
1555
1553
  variant: "outlined",
1556
1554
  class: "flex flex-col gap-8 px-12 py-16"
1557
1555
  }, {
1558
1556
  default: Y(() => {
1559
- var S, K;
1557
+ var C, K;
1560
1558
  return [
1561
1559
  r("div", ma, [
1562
1560
  t[11] || (t[11] = r("div", { class: "fm-typo-en-body-lg-600" }, "Closing summary", -1)),
1563
1561
  r("div", fa, [
1564
1562
  r("div", {
1565
- class: _e(["fm-status-badge", B(Le)(((S = c.draft) == null ? void 0 : S.status) ?? "DRAFT")])
1566
- }, J(B(Ue)(((K = c.draft) == null ? void 0 : K.status) ?? "")), 3)
1563
+ class: De(["fm-status-badge", F(Le)(((C = c.draft) == null ? void 0 : C.status) ?? "DRAFT")])
1564
+ }, J(F(Ue)(((K = c.draft) == null ? void 0 : K.status) ?? "")), 3)
1567
1565
  ])
1568
1566
  ]),
1569
- k(i),
1567
+ h(i),
1570
1568
  r("div", pa, [
1571
- (C(!0), L(ee, null, je(Fe.value, (G, ie) => (C(), L("div", {
1569
+ (j(!0), L(ee, null, je(Fe.value, (q, ie) => (j(), L("div", {
1572
1570
  class: "flex flex-col gap-4",
1573
1571
  key: ie
1574
1572
  }, [
1575
1573
  r("div", va, [
1576
- r("div", ya, J(G.label), 1)
1574
+ r("div", ya, J(q.label), 1)
1577
1575
  ]),
1578
- r("div", ga, J(G.value), 1)
1576
+ r("div", ga, J(q.value), 1)
1579
1577
  ]))), 128))
1580
1578
  ])
1581
1579
  ];
@@ -1583,10 +1581,10 @@ const ua = pt(
1583
1581
  _: 1
1584
1582
  }),
1585
1583
  r("div", ba, [
1586
- r("div", ka, [
1584
+ r("div", ha, [
1587
1585
  t[12] || (t[12] = r("div", { class: "flex-1 fm-typo-en-title-sm-600 text-fm-color-typo-primary" }, " Closing items ", -1)),
1588
- y.value ? de("", !0) : (C(), L("div", ha, [
1589
- c.draft && c.draft.status !== B(pe).enum.COMPLETED ? (C(), se(u, {
1586
+ v.value ? de("", !0) : (j(), L("div", ka, [
1587
+ c.draft && c.draft.status !== F(pe).enum.COMPLETED ? (j(), se(u, {
1590
1588
  key: 0,
1591
1589
  label: "Refresh balance",
1592
1590
  "prepend-icon": "refresh",
@@ -1594,88 +1592,88 @@ const ua = pt(
1594
1592
  "text-color": "primary",
1595
1593
  "bg-color": "transparent",
1596
1594
  "border-color": "primary",
1597
- loading: M.value,
1595
+ loading: R.value,
1598
1596
  onClick: be
1599
1597
  }, null, 8, ["loading"])) : de("", !0),
1600
- k(u, {
1598
+ h(u, {
1601
1599
  label: "Export data",
1602
1600
  "prepend-icon": "download",
1603
1601
  variant: "secondary",
1604
1602
  "text-color": "primary",
1605
1603
  "bg-color": "transparent",
1606
1604
  "border-color": "primary",
1607
- onClick: t[1] || (t[1] = (S) => c.draft ? B(v).exportDraft(
1605
+ onClick: t[1] || (t[1] = (C) => c.draft ? F(p).exportDraft(
1608
1606
  c.draft,
1609
- h.value,
1610
- T.value
1607
+ k.value,
1608
+ $.value
1611
1609
  ) : null)
1612
1610
  })
1613
1611
  ]))
1614
1612
  ]),
1615
- y.value ? (C(), L("div", Aa, [
1613
+ v.value ? (j(), L("div", Aa, [
1616
1614
  t[14] || (t[14] = r("div", { class: "h-80" }, null, -1)),
1617
1615
  r("div", xa, [
1618
1616
  r("div", null, [
1619
- k(b, { size: "md" })
1617
+ h(g, { size: "md" })
1620
1618
  ]),
1621
1619
  t[13] || (t[13] = r("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, " Fetching info... ", -1))
1622
1620
  ]),
1623
1621
  t[15] || (t[15] = r("div", { class: "h-80" }, null, -1))
1624
- ])) : (C(), L(ee, { key: 1 }, [
1622
+ ])) : (j(), L(ee, { key: 1 }, [
1625
1623
  r("div", _a, [
1626
1624
  r("div", Da, [
1627
- k(p, {
1625
+ h(x, {
1628
1626
  label: "Template Item(s)",
1629
- selected: _.value.templateItem,
1630
- onClick: t[2] || (t[2] = (S) => _.value.templateItem = !_.value.templateItem)
1627
+ selected: w.value.templateItem,
1628
+ onClick: t[2] || (t[2] = (C) => w.value.templateItem = !w.value.templateItem)
1631
1629
  }, null, 8, ["selected"]),
1632
- k(p, {
1630
+ h(x, {
1633
1631
  label: "Non-template Item(s)",
1634
- selected: _.value.nonTemplateItem,
1635
- onClick: t[3] || (t[3] = (S) => _.value.nonTemplateItem = !_.value.nonTemplateItem)
1632
+ selected: w.value.nonTemplateItem,
1633
+ onClick: t[3] || (t[3] = (C) => w.value.nonTemplateItem = !w.value.nonTemplateItem)
1636
1634
  }, null, 8, ["selected"])
1637
1635
  ]),
1638
- k(I, {
1636
+ h(b, {
1639
1637
  modelValue: Ae.value,
1640
- "onUpdate:modelValue": t[4] || (t[4] = (S) => Ae.value = S),
1638
+ "onUpdate:modelValue": t[4] || (t[4] = (C) => Ae.value = C),
1641
1639
  placeholder: "Filter items"
1642
1640
  }, null, 8, ["modelValue"])
1643
1641
  ]),
1644
- B(x).skuTags.size ? (C(), L("div", wa, [
1645
- (C(!0), L(ee, null, je(B(x).skuTags.keys(), (S) => (C(), se(p, {
1646
- key: `${S}`,
1647
- label: `${S}`,
1642
+ F(D).skuTags.size ? (j(), L("div", wa, [
1643
+ (j(!0), L(ee, null, je(F(D).skuTags.keys(), (C) => (j(), se(x, {
1644
+ key: `${C}`,
1645
+ label: `${C}`,
1648
1646
  selectable: "",
1649
- selected: f[`${S}`],
1650
- onClick: (K) => f[`${S}`] = !f[`${S}`]
1647
+ selected: f[`${C}`],
1648
+ onClick: (K) => f[`${C}`] = !f[`${C}`]
1651
1649
  }, {
1652
1650
  default: Y(() => [
1653
- f[`${S}`] ? (C(), se(E, {
1651
+ f[`${C}`] ? (j(), se(E, {
1654
1652
  key: 0,
1655
1653
  name: "check",
1656
1654
  class: "text-white",
1657
1655
  size: "sm"
1658
1656
  })) : de("", !0),
1659
1657
  r("span", {
1660
- class: _e([
1658
+ class: De([
1661
1659
  "",
1662
1660
  {
1663
- "text-white fm-typo-en-body-md-600": f[`${S}`],
1664
- "text-fm-color-typo-primary fm-typo-en-body-md-400": !f[`${S}`]
1661
+ "text-white fm-typo-en-body-md-600": f[`${C}`],
1662
+ "text-fm-color-typo-primary fm-typo-en-body-md-400": !f[`${C}`]
1665
1663
  }
1666
1664
  ])
1667
- }, J(S), 3)
1665
+ }, J(C), 3)
1668
1666
  ]),
1669
1667
  _: 2
1670
1668
  }, 1032, ["label", "selected", "onClick"]))), 128))
1671
1669
  ])) : de("", !0),
1672
1670
  r("div", Sa, [
1673
1671
  r("div", {
1674
- style: lt({ minWidth: `${he.value}px` })
1672
+ style: lt({ minWidth: `${ke.value}px` })
1675
1673
  }, [
1676
- k(ae, {
1677
- "column-defs": De.value,
1678
- "row-data": we.value,
1674
+ h(ae, {
1675
+ "column-defs": we.value,
1676
+ "row-data": Se.value,
1679
1677
  "search-value": Ae.value
1680
1678
  }, null, 8, ["column-defs", "row-data", "search-value"])
1681
1679
  ], 4)
@@ -1683,14 +1681,14 @@ const ua = pt(
1683
1681
  ], 64))
1684
1682
  ])
1685
1683
  ], 64)) : de("", !0),
1686
- le.value.value === "history" ? (C(), L("div", Ca, [
1687
- me.value.length ? (C(), L("div", Fa, [
1688
- (C(!0), L(ee, null, je(me.value, (S, K) => (C(), L(ee, { key: K }, [
1684
+ le.value.value === "history" ? (j(), L("div", Ca, [
1685
+ me.value.length ? (j(), L("div", Fa, [
1686
+ (j(!0), L(ee, null, je(me.value, (C, K) => (j(), L(ee, { key: K }, [
1689
1687
  r("div", Ta, [
1690
1688
  r("div", $a, [
1691
1689
  r("div", Ma, [
1692
1690
  r("div", {
1693
- class: _e([
1691
+ class: De([
1694
1692
  {
1695
1693
  "bg-fm-color-primary": K !== 0,
1696
1694
  "bg-white": K === 0
@@ -1702,7 +1700,7 @@ const ua = pt(
1702
1700
  t[18] || (t[18] = r("div", { class: "h-24 w-24 bg-fm-color-primary rounded-full" }, null, -1)),
1703
1701
  r("div", Ra, [
1704
1702
  r("div", {
1705
- class: _e([
1703
+ class: De([
1706
1704
  {
1707
1705
  "bg-fm-color-primary": K < me.value.length - 1,
1708
1706
  "bg-white": K >= me.value.length - 1
@@ -1713,15 +1711,15 @@ const ua = pt(
1713
1711
  ])
1714
1712
  ]),
1715
1713
  r("div", Ia, [
1716
- r("div", Pa, J(S.header), 1),
1717
- r("div", Va, J(S.date), 1)
1714
+ r("div", Pa, J(C.header), 1),
1715
+ r("div", Va, J(C.date), 1)
1718
1716
  ])
1719
1717
  ]),
1720
1718
  r("div", Ua, [
1721
1719
  r("div", La, [
1722
1720
  r("div", Ea, [
1723
1721
  r("div", {
1724
- class: _e([
1722
+ class: De([
1725
1723
  {
1726
1724
  "bg-fm-color-primary": K < me.value.length - 1,
1727
1725
  "bg-white": K >= me.value.length - 1
@@ -1732,22 +1730,22 @@ const ua = pt(
1732
1730
  ])
1733
1731
  ]),
1734
1732
  r("div", Ha, [
1735
- k(n, {
1733
+ h(o, {
1736
1734
  variant: "outlined",
1737
1735
  class: "py-12 px-16"
1738
1736
  }, {
1739
1737
  default: Y(() => [
1740
1738
  r("div", za, [
1741
- (C(!0), L(ee, null, je(S.info, (G, ie) => (C(), L("div", {
1739
+ (j(!0), L(ee, null, je(C.info, (q, ie) => (j(), L("div", {
1742
1740
  key: ie,
1743
1741
  class: "flex flex-col gap-4"
1744
1742
  }, [
1745
- r("div", Na, J(G == null ? void 0 : G.label), 1),
1743
+ r("div", Na, J(q == null ? void 0 : q.label), 1),
1746
1744
  r("div", Oa, [
1747
- (C(!0), L(ee, null, je(G == null ? void 0 : G.values, (Ce, $e) => (C(), L("div", {
1745
+ (j(!0), L(ee, null, je(q == null ? void 0 : q.values, (_e, $e) => (j(), L("div", {
1748
1746
  key: $e,
1749
1747
  class: "fm-typo-en-body-lg-600"
1750
- }, J(Ce), 1))), 128))
1748
+ }, J(_e), 1))), 128))
1751
1749
  ])
1752
1750
  ]))), 128))
1753
1751
  ])
@@ -1757,18 +1755,18 @@ const ua = pt(
1757
1755
  ])
1758
1756
  ])
1759
1757
  ], 64))), 128))
1760
- ])) : (C(), L("div", ja, [
1761
- k(ce),
1758
+ ])) : (j(), L("div", ja, [
1759
+ h(ce),
1762
1760
  r("div", null, [
1763
1761
  r("img", {
1764
- src: B(Gt),
1762
+ src: F(Gt),
1765
1763
  alt: "List is empty"
1766
1764
  }, null, 8, Ba)
1767
1765
  ]),
1768
1766
  t[16] || (t[16] = r("div", { class: "fm-typo-en-body-lg-600" }, J("No records found"), -1)),
1769
1767
  t[17] || (t[17] = r("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary px-16" }, J("You can track approval and rejection history here"), -1)),
1770
- k(ce),
1771
- k(ce)
1768
+ h(ce),
1769
+ h(ce)
1772
1770
  ]))
1773
1771
  ])) : de("", !0)
1774
1772
  ])
@@ -1779,20 +1777,20 @@ const ua = pt(
1779
1777
  }
1780
1778
  }), Ga = { class: "flex-1 flex flex-col gap-8" }, Wa = { class: "flex flex-col" }, qa = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Za = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, Ja = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary line-clamp-2" }, Xa = { class: "fm-typo-en-body-lg-400 line-clamp-2" }, dn = /* @__PURE__ */ He({
1781
1779
  __name: "ClosingDraftView",
1782
- setup(o) {
1783
- const { t: l } = ft(), { viewDraft: e } = Ee(), { viewClosingDraftProps: m, viewClosingDraftShow: v } = Qt(Ee()), D = ze(), y = ua(), M = Lt(), { breakpoints: w } = Yt();
1784
- D.watchLocation(y.fetchDrafts);
1785
- const h = V(() => y.loading), T = H(""), P = V(() => w.value.xs || w.value.sm), R = V(() => P.value ? 10 : 20);
1786
- function s(O) {
1780
+ setup(s) {
1781
+ const { t: l } = ft(), { viewDraft: e } = Ee(), { viewClosingDraftProps: m, viewClosingDraftShow: p } = Qt(Ee()), _ = ze(), v = ua(), R = Lt(), { breakpoints: S } = Yt();
1782
+ _.watchLocation(v.fetchDrafts);
1783
+ const k = V(() => v.loading), $ = H(""), P = V(() => S.value.xs || S.value.sm), I = V(() => P.value ? 10 : 20);
1784
+ function n(O) {
1787
1785
  switch (O) {
1788
1786
  case "refresh":
1789
- return y.fetchDrafts();
1787
+ return v.fetchDrafts();
1790
1788
  }
1791
1789
  }
1792
1790
  function a(O) {
1793
1791
  return O;
1794
1792
  }
1795
- const x = V(() => P.value ? [
1793
+ const D = V(() => P.value ? [
1796
1794
  {
1797
1795
  label: l("inventory.common.refresh"),
1798
1796
  value: "refresh",
@@ -1806,16 +1804,16 @@ const ua = pt(
1806
1804
  }
1807
1805
  ]);
1808
1806
  return (O, f) => {
1809
- const g = U("FmTable");
1810
- return C(), L(ee, null, [
1811
- k(Et, {
1812
- title: B(l)("inventory.closing.draft.title"),
1813
- actions: x.value,
1814
- "onClick:action": s
1807
+ const y = U("FmTable");
1808
+ return j(), L(ee, null, [
1809
+ h(Et, {
1810
+ title: F(l)("inventory.closing.draft.title"),
1811
+ actions: D.value,
1812
+ "onClick:action": n
1815
1813
  }, {
1816
1814
  default: Y(() => [
1817
1815
  r("div", {
1818
- class: _e([
1816
+ class: De([
1819
1817
  "flex flex-col gap-8 max-h-full",
1820
1818
  {
1821
1819
  "p-0": P.value,
@@ -1823,41 +1821,41 @@ const ua = pt(
1823
1821
  }
1824
1822
  ])
1825
1823
  }, [
1826
- k(Ht, {
1824
+ h(Ht, {
1827
1825
  "change-location": "",
1828
1826
  searchable: "",
1829
- search: T.value,
1830
- "onUpdate:search": f[0] || (f[0] = (A) => T.value = A)
1827
+ search: $.value,
1828
+ "onUpdate:search": f[0] || (f[0] = (A) => $.value = A)
1831
1829
  }, null, 8, ["search"]),
1832
- k(g, {
1833
- style: lt(B(M).tableHeight),
1834
- "column-defs": B(y).columnDefs,
1835
- "row-data": B(y).drafts,
1836
- "search-value": T.value,
1837
- loading: h.value,
1838
- onRowClick: f[1] || (f[1] = (A) => B(e)(A.original)),
1839
- "page-size": R.value
1830
+ h(y, {
1831
+ style: lt(F(R).tableHeight),
1832
+ "column-defs": F(v).columnDefs,
1833
+ "row-data": F(v).drafts,
1834
+ "search-value": $.value,
1835
+ loading: k.value,
1836
+ onRowClick: f[1] || (f[1] = (A) => F(e)(A.original)),
1837
+ "page-size": I.value
1840
1838
  }, {
1841
1839
  "list-row": Y((A) => [
1842
- k(zt, {
1840
+ h(zt, {
1843
1841
  row: A,
1844
- onRowClick: (_) => B(e)(_)
1842
+ onRowClick: (w) => F(e)(w)
1845
1843
  }, {
1846
- default: Y((_) => {
1847
- var $, Z, q, re, j, te, be, ke, fe, ye, ge, Q, De, he, Ae, we, Fe, xe, le, me;
1844
+ default: Y((w) => {
1845
+ var M, Z, W, re, B, te, be, he, fe, ye, ge, Q, we, ke, Ae, Se, Fe, xe, le, me;
1848
1846
  return [
1849
1847
  r("div", Ga, [
1850
1848
  r("div", Wa, [
1851
1849
  r("div", qa, [
1852
- k(B(Pe), {
1853
- render: (q = (Z = ($ = _._id) == null ? void 0 : $.column) == null ? void 0 : Z.columnDef) == null ? void 0 : q.cell,
1854
- props: (j = (re = _._id) == null ? void 0 : re.getContext) == null ? void 0 : j.call(re)
1850
+ h(F(Pe), {
1851
+ render: (W = (Z = (M = w._id) == null ? void 0 : M.column) == null ? void 0 : Z.columnDef) == null ? void 0 : W.cell,
1852
+ props: (B = (re = w._id) == null ? void 0 : re.getContext) == null ? void 0 : B.call(re)
1855
1853
  }, null, 8, ["render", "props"])
1856
1854
  ]),
1857
1855
  r("div", Za, [
1858
- k(B(Pe), {
1859
- render: (ke = (be = (te = _.name) == null ? void 0 : te.column) == null ? void 0 : be.columnDef) == null ? void 0 : ke.cell,
1860
- props: (ye = (fe = _.name) == null ? void 0 : fe.getContext) == null ? void 0 : ye.call(fe)
1856
+ h(F(Pe), {
1857
+ render: (he = (be = (te = w.name) == null ? void 0 : te.column) == null ? void 0 : be.columnDef) == null ? void 0 : he.cell,
1858
+ props: (ye = (fe = w.name) == null ? void 0 : fe.getContext) == null ? void 0 : ye.call(fe)
1861
1859
  }, null, 8, ["render", "props"])
1862
1860
  ]),
1863
1861
  r("div", Ja, J([
@@ -1865,16 +1863,16 @@ const ua = pt(
1865
1863
  ...A.original.items.length >= 3 ? [`and ${A.original.items.length - 3} more items`] : []
1866
1864
  ].join(", ")), 1),
1867
1865
  r("div", Xa, [
1868
- k(B(Pe), {
1869
- render: (De = (Q = (ge = _.ref) == null ? void 0 : ge.column) == null ? void 0 : Q.columnDef) == null ? void 0 : De.cell,
1870
- props: (Ae = (he = _.ref) == null ? void 0 : he.getContext) == null ? void 0 : Ae.call(he)
1866
+ h(F(Pe), {
1867
+ render: (we = (Q = (ge = w.ref) == null ? void 0 : ge.column) == null ? void 0 : Q.columnDef) == null ? void 0 : we.cell,
1868
+ props: (Ae = (ke = w.ref) == null ? void 0 : ke.getContext) == null ? void 0 : Ae.call(ke)
1871
1869
  }, null, 8, ["render", "props"])
1872
1870
  ])
1873
1871
  ]),
1874
1872
  r("div", null, [
1875
- k(B(Pe), {
1876
- render: (xe = (Fe = (we = _.status) == null ? void 0 : we.column) == null ? void 0 : Fe.columnDef) == null ? void 0 : xe.cell,
1877
- props: (me = (le = _.status) == null ? void 0 : le.getContext) == null ? void 0 : me.call(le)
1873
+ h(F(Pe), {
1874
+ render: (xe = (Fe = (Se = w.status) == null ? void 0 : Se.column) == null ? void 0 : Fe.columnDef) == null ? void 0 : xe.cell,
1875
+ props: (me = (le = w.status) == null ? void 0 : le.getContext) == null ? void 0 : me.call(le)
1878
1876
  }, null, 8, ["render", "props"])
1879
1877
  ])
1880
1878
  ])
@@ -1889,12 +1887,12 @@ const ua = pt(
1889
1887
  ]),
1890
1888
  _: 1
1891
1889
  }, 8, ["title", "actions"]),
1892
- (C(), se(wt, { to: "body" }, [
1893
- k(Qa, St(B(m), {
1894
- show: B(v),
1895
- "onUpdate:show": f[2] || (f[2] = (A) => rt(v) ? v.value = A : null),
1896
- onSubmitted: f[3] || (f[3] = () => (v.value = !1, B(y).fetchDrafts())),
1897
- onRefresh: f[4] || (f[4] = (A) => B(y).updateDraftRef(A))
1890
+ (j(), se(wt, { to: "body" }, [
1891
+ h(Qa, St(F(m), {
1892
+ show: F(p),
1893
+ "onUpdate:show": f[2] || (f[2] = (A) => rt(p) ? p.value = A : null),
1894
+ onSubmitted: f[3] || (f[3] = () => (p.value = !1, F(v).fetchDrafts())),
1895
+ onRefresh: f[4] || (f[4] = (A) => F(v).updateDraftRef(A))
1898
1896
  }), null, 16, ["show"])
1899
1897
  ]))
1900
1898
  ], 64);