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

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