@feedmepos/mf-inventory-portal 1.2.22 → 1.2.23

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 (45) hide show
  1. package/dist/{App-mZcmqjve.js → App-CzxvakHO.js} +1 -1
  2. package/dist/{ApprovalView-C1rmHMzO.js → ApprovalView-C15FSJQX.js} +2 -2
  3. package/dist/{BindingsDialog-KUGktvXf.js → BindingsDialog-DyEAwfOs.js} +2 -2
  4. package/dist/{BindingsPicker-CQrJKn2H.js → BindingsPicker-BwkIrvXh.js} +1 -1
  5. package/dist/{BindingsTable-Cz0I-88V.js → BindingsTable-DbSRsazC.js} +1 -1
  6. package/dist/{ClosingDraftView-CFtoPAOq.js → ClosingDraftView-DkT7ssTD.js} +490 -480
  7. package/dist/{ClosingTemplateView-BFI1sv7b.js → ClosingTemplateView-pdiWLX1d.js} +2 -2
  8. package/dist/{DeliveryOrderPrintPreview-CuY6b_EJ.js → DeliveryOrderPrintPreview-B_bL2AV7.js} +1 -1
  9. package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-BAHjIY4R.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-Dl4NAEX2.js} +3 -3
  10. package/dist/{FmMultiselectDialog-CoM3kloO.js → FmMultiselectDialog-CzoBlXFC.js} +1 -1
  11. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-B8P-enAG.js → FmUnitInput.vue_vue_type_script_setup_true_lang-FLXqyc8j.js} +1 -1
  12. package/dist/{ImportView-lUXYcuDK.js → ImportView-BkW7pYIh.js} +2 -2
  13. package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-Cc38AXDG.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-DgQwpfVr.js} +1 -1
  14. package/dist/{IngredientGroupView-CTakvHk-.js → IngredientGroupView-BHUq8eUh.js} +2 -2
  15. package/dist/{IngredientsView-CrtPJFey.js → IngredientsView-DIVZSAFN.js} +7 -7
  16. package/dist/{IntegrationView-C4Sn2lcv.js → IntegrationView-2flRWenk.js} +3 -3
  17. package/dist/{InventoryBindingForm-BYvzPscq.js → InventoryBindingForm-CF9Szzug.js} +1 -1
  18. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-C2a9HLt-.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-YxSxYZcR.js} +3 -3
  19. package/dist/{InventoryBindingSummary-Bw4zqjO2.js → InventoryBindingSummary-c6MF5Yb4.js} +1 -1
  20. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-B6qrFdT_.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-NEHvo5li.js} +1 -1
  21. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-JaUZNTlU.js → PremiumBadge.vue_vue_type_script_setup_true_lang-CJMpmYyw.js} +1 -1
  22. package/dist/{PublishView-BjGxTNJp.js → PublishView-C7Xdnzlh.js} +1 -1
  23. package/dist/{PurchaseOrderPrintPreview-Brp1BwmH.js → PurchaseOrderPrintPreview-5MhPoeTI.js} +1 -1
  24. package/dist/{ReceiveRequestView-CZ-J2av-.js → ReceiveRequestView-CN9BtJeF.js} +8 -8
  25. package/dist/{RecipeView-G5-mLmd5.js → RecipeView-ClwA5F7r.js} +3 -3
  26. package/dist/{StockView-BrR5YQud.js → StockView-CQu_GA9L.js} +7 -7
  27. package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-Dj1mapP6.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-BzuVCffs.js} +1 -1
  28. package/dist/{SupplierView-Cpswmhcx.js → SupplierView-ChW6ZEn_.js} +4 -4
  29. package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-CTNLNyPF.js → TransferDetails.vue_vue_type_script_setup_true_lang-CVoLy3lQ.js} +5 -5
  30. package/dist/{TransferTemplateView-DSoQHXYp.js → TransferTemplateView-BXcUq5zc.js} +7 -7
  31. package/dist/{UnitView-v9QN7QhZ.js → UnitView-C5cjS8t2.js} +3 -3
  32. package/dist/{WarehouseView-CVMxi83r.js → WarehouseView-YRF4ujMe.js} +1 -1
  33. package/dist/{app-Cjjc1O8D.js → app-90sUA0QM.js} +219 -219
  34. package/dist/app.js +1 -1
  35. package/dist/{decimal-E9NtcpDf.js → decimal-wb2UYLZY.js} +1 -1
  36. package/dist/{format-unit-display-CGFEID8l.js → format-unit-display-H61kNrbU.js} +3 -3
  37. package/dist/{import-export.helper-ssvJ7CNR.js → import-export.helper-CvJtTj6v.js} +1 -1
  38. package/dist/{index-BnXP1p39.js → index-4YIXJDBZ.js} +1 -1
  39. package/dist/{index-D9cEpOB_.js → index-Cpl4tL8O.js} +1 -1
  40. package/dist/{purchase-order-template-Bbj0kZjF.js → purchase-order-template-DJTIqx45.js} +1 -1
  41. package/dist/{stock-DQyM4uEY.js → stock-Cg3h8ddl.js} +1 -1
  42. package/dist/{supplier-CyVARmz-.js → supplier-CezSNyT3.js} +1 -1
  43. package/dist/{use-ingredient-select-dialog-BuHEa-B-.js → use-ingredient-select-dialog-BSTgdhQt.js} +1 -1
  44. package/dist/{use-inventory-binding-dialog-BBDefbwk.js → use-inventory-binding-dialog-nVuvOIzy.js} +1 -1
  45. package/package.json +3 -3
@@ -1,36 +1,36 @@
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 G, createElementVNode as s, toDisplayString as J, unref as F, createVNode as x, createCommentVNode as de, h as T, reactive as kt, watch as ht, isRef as at, normalizeClass as De, renderList as Ce, normalizeStyle as nt, Teleport as At, mergeProps as xt } from "vue";
2
- import { aa as _t, u as ze, ax as z, am as ot, ay as st, r as Dt, Z as Qe, n as N, t as wt, a0 as Be, W as St, Y as jt, X as Ct, az as rt, aA as lt, ah as ct, aB as pe, an as Bt, ac as Ke, ab as ve, a6 as Ue, D as tt, j as Re, i as Ft, f as Tt, a as $t, $ as Ie, a9 as Mt, G as Rt, I as It, J as Pt, K as Vt, L as Pe } from "./app-Cjjc1O8D.js";
3
- import { useCoreStore as Ut, useI18n as it } from "@feedmepos/mf-common";
4
- import { useSnackbar as Ge, useDialog as Lt, useProxiedModel as Et, components as Ve, useBreakpoints as Ht } from "@feedmepos/ui-library";
5
- import { defineStore as ut, storeToRefs as zt } from "pinia";
6
- import { a as We, u as dt } from "./stock-DQyM4uEY.js";
7
- import { E as Nt } from "./empty-placeholder-wf6-BWE8.js";
8
- const Ne = _t((n, r) => {
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-90sUA0QM.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 { a as We, u as vt } from "./stock-Cg3h8ddl.js";
7
+ import { E as Qt } from "./empty-placeholder-wf6-BWE8.js";
8
+ const Ne = Ct((o, l) => {
9
9
  function e() {
10
10
  return ze().currentLocation.dbName;
11
11
  }
12
12
  return {
13
13
  async getDraft(m) {
14
- const p = e(), w = `${n.inventoryBackendUrl}/${p}/closing-draft/${m}`;
15
- return r.get(w);
14
+ const p = e(), w = `${o.inventoryBackendUrl}/${p}/closing-draft/${m}`;
15
+ return l.get(w);
16
16
  },
17
17
  async readDrafts() {
18
- const m = e(), p = `${n.inventoryBackendUrl}/${m}/closing-draft`;
19
- return r.get(p);
18
+ const m = e(), p = `${o.inventoryBackendUrl}/${m}/closing-draft`;
19
+ return l.get(p);
20
20
  },
21
21
  async runOperation(m) {
22
- const p = e(), w = `${n.inventoryBackendUrl}/${p}/closing-draft/run-operation`;
23
- return r.post(w, m);
22
+ const p = e(), w = `${o.inventoryBackendUrl}/${p}/closing-draft/run-operation`;
23
+ return l.post(w, m);
24
24
  },
25
25
  async sync(m) {
26
- const p = e(), w = `${n.inventoryBackendUrl}/${p}/closing-draft/sync`;
27
- return r.post(w, m);
26
+ const p = e(), w = `${o.inventoryBackendUrl}/${p}/closing-draft/sync`;
27
+ return l.post(w, m);
28
28
  }
29
29
  };
30
- }), Ot = { class: "fm-typo-en-body-lg-400" }, Kt = { class: "fm-typo-en-body-lg-600" }, Yt = {
30
+ }), Gt = { class: "fm-typo-en-body-lg-400" }, Wt = { class: "fm-typo-en-body-lg-600" }, qt = {
31
31
  key: 0,
32
32
  class: "flex flex-col"
33
- }, Qt = { class: "flex gap-12 py-8 justify-end w-full" }, Oe = /* @__PURE__ */ He({
33
+ }, Zt = { class: "flex gap-12 py-8 justify-end w-full" }, Oe = /* @__PURE__ */ He({
34
34
  __name: "ClosingDraftAction",
35
35
  props: {
36
36
  draft: {},
@@ -38,9 +38,9 @@ const Ne = _t((n, r) => {
38
38
  onCancel: { type: Function },
39
39
  onFinished: { type: Function }
40
40
  },
41
- setup(n) {
42
- const r = n, e = H(), m = Ne(), p = Ge(), w = H(!1), v = H(null), R = H(!1), S = V(() => {
43
- switch (r.action) {
41
+ setup(o) {
42
+ const l = o, e = H(), m = Ne(), p = Ge(), w = H(!1), v = H(null), R = H(!1), S = V(() => {
43
+ switch (l.action) {
44
44
  case z.enum.approveDraft:
45
45
  return "Approve";
46
46
  case z.enum.rejectDraft:
@@ -48,9 +48,9 @@ const Ne = _t((n, r) => {
48
48
  case z.enum.markAsFailed:
49
49
  return "Mark as Failed";
50
50
  }
51
- throw new Error(`Unknown action: ${r.action}`);
51
+ throw new Error(`Unknown action: ${l.action}`);
52
52
  }), k = V(() => {
53
- switch (r.action) {
53
+ switch (l.action) {
54
54
  case z.enum.approveDraft:
55
55
  return "primary";
56
56
  case z.enum.rejectDraft:
@@ -58,35 +58,35 @@ const Ne = _t((n, r) => {
58
58
  case z.enum.markAsFailed:
59
59
  return "destructive";
60
60
  }
61
- throw new Error(`Unknown action: ${r.action}`);
61
+ throw new Error(`Unknown action: ${l.action}`);
62
62
  });
63
63
  Ye(() => {
64
- if (r.draft.effectiveAt)
65
- v.value = new Date(r.draft.effectiveAt);
64
+ if (l.draft.effectiveAt)
65
+ v.value = new Date(l.draft.effectiveAt);
66
66
  else {
67
- const o = new Date(r.draft.createdAt);
68
- o.setHours(23, 59, 59, 999), v.value = o;
67
+ const s = new Date(l.draft.createdAt);
68
+ s.setHours(23, 59, 59, 999), v.value = s;
69
69
  }
70
70
  R.value = !0;
71
71
  });
72
72
  const $ = V({
73
73
  get() {
74
- return v.value === null ? "" : ot(v.value);
74
+ return v.value === null ? "" : ct(v.value);
75
75
  },
76
- set(o) {
77
- if (o) {
78
- const a = /* @__PURE__ */ new Date(`${o} ${P.value}`);
76
+ set(s) {
77
+ if (s) {
78
+ const a = /* @__PURE__ */ new Date(`${s} ${P.value}`);
79
79
  a.setSeconds(59, 999), v.value = a;
80
80
  } else
81
81
  v.value = null;
82
82
  }
83
83
  }), P = V({
84
84
  get() {
85
- return v.value === null ? "" : st(v.value);
85
+ return v.value === null ? "" : it(v.value);
86
86
  },
87
- set(o) {
88
- if (o) {
89
- const a = /* @__PURE__ */ new Date(`${$.value} ${o}`);
87
+ set(s) {
88
+ if (s) {
89
+ const a = /* @__PURE__ */ new Date(`${$.value} ${s}`);
90
90
  a.setSeconds(59, 999), v.value = a;
91
91
  } else
92
92
  v.value = null;
@@ -96,9 +96,9 @@ const Ne = _t((n, r) => {
96
96
  w.value = !0;
97
97
  try {
98
98
  await m.runOperation({
99
- _id: r.draft._id,
100
- _rev: r.draft._rev ?? "",
101
- action: r.action,
99
+ _id: l.draft._id,
100
+ _rev: l.draft._rev ?? "",
101
+ action: l.action,
102
102
  data: {
103
103
  effectiveAt: v.value ? v.value.toISOString() : null,
104
104
  remark: e.value
@@ -107,32 +107,32 @@ const Ne = _t((n, r) => {
107
107
  title: "Success",
108
108
  message: "Action submitted",
109
109
  type: "success"
110
- }), r.onFinished();
111
- } catch (o) {
110
+ }), l.onFinished();
111
+ } catch (s) {
112
112
  p.open({
113
113
  title: "Something went wrong",
114
114
  message: "Unable to submit action. Please try again",
115
115
  type: "error"
116
- }), console.error("error on submit closing draft action", o);
116
+ }), console.error("error on submit closing draft action", s);
117
117
  } finally {
118
118
  w.value = !1;
119
119
  }
120
120
  }
121
- return (o, a) => {
121
+ return (s, a) => {
122
122
  const _ = U("FmLabel"), O = U("FmDatePicker"), f = U("FmTimePicker"), y = U("FmTextField"), h = U("FmButton"), D = U("FmForm");
123
- return R.value ? (C(), se(D, {
123
+ return R.value ? (j(), se(D, {
124
124
  key: 1,
125
125
  onValidationSuccess: I,
126
126
  class: "flex flex-col gap-32",
127
127
  disabled: w.value
128
128
  }, {
129
129
  default: G(() => [
130
- s("div", Ot, [
130
+ r("div", Gt, [
131
131
  a[4] || (a[4] = X(" You are about to ")),
132
- s("span", Kt, J(S.value), 1),
132
+ r("span", Wt, J(S.value), 1),
133
133
  a[5] || (a[5] = X(" this draft. Please provide a remark to justify this action. "))
134
134
  ]),
135
- o.action === F(z).enum.approveDraft ? (C(), L("div", Yt, [
135
+ s.action === F(z).enum.approveDraft ? (j(), L("div", qt, [
136
136
  x(_, { class: "fm-typo-en-body-lg-600" }, {
137
137
  default: G(() => a[6] || (a[6] = [
138
138
  X("Closing Date")
@@ -159,13 +159,13 @@ const Ne = _t((n, r) => {
159
159
  "onUpdate:modelValue": a[2] || (a[2] = (M) => e.value = M),
160
160
  label: "Remark",
161
161
  "label-mark": "required",
162
- rules: [F(Dt)()]
162
+ rules: [F(jt)()]
163
163
  }, null, 8, ["modelValue", "rules"]),
164
- s("div", Qt, [
164
+ r("div", Zt, [
165
165
  x(h, {
166
166
  label: "Cancel",
167
167
  variant: "tertiary",
168
- onClick: a[3] || (a[3] = (M) => o.onCancel())
168
+ onClick: a[3] || (a[3] = (M) => s.onCancel())
169
169
  }),
170
170
  x(h, {
171
171
  label: S.value,
@@ -176,71 +176,71 @@ const Ne = _t((n, r) => {
176
176
  ])
177
177
  ]),
178
178
  _: 1
179
- }, 8, ["disabled"])) : (C(), L(ee, { key: 0 }, [
179
+ }, 8, ["disabled"])) : (j(), L(ee, { key: 0 }, [
180
180
  X("Loading")
181
181
  ], 64));
182
182
  };
183
183
  }
184
- }), Gt = Be(0);
185
- function mt(n) {
186
- const r = n.measurementsAmounts.groupBy((m) => m.measurement.id), e = n.sku.unit.measurements.reduce((m, p) => {
184
+ }), Jt = Be(0);
185
+ function yt(o) {
186
+ const l = o.measurementsAmounts.groupBy((m) => m.measurement.id), e = o.sku.unit.measurements.reduce((m, p) => {
187
187
  var R, S;
188
- const w = ((S = (R = r.get(p.id)) == null ? void 0 : R[0]) == null ? void 0 : S.amount) ?? Gt, v = Qe(p.conversion, w);
188
+ const w = ((S = (R = l.get(p.id)) == null ? void 0 : R[0]) == null ? void 0 : S.amount) ?? Jt, v = Qe(p.conversion, w);
189
189
  return m + +N(v);
190
- }, +N(n.baseAmount));
191
- return wt(e, n.baseAmount.precision);
190
+ }, +N(o.baseAmount));
191
+ return Bt(e, o.baseAmount.precision);
192
192
  }
193
- const Wt = Be(0), qt = Be(100), ft = "N/A";
194
- function Zt(n, r, e, m, p, w) {
193
+ const Xt = Be(0), ea = Be(100), gt = "N/A";
194
+ function ta(o, l, e, m, p, w) {
195
195
  var D;
196
- const v = mt(n), R = m ?? v, S = rt(R, r), k = r.amount === 0 ? null : lt(S, {
197
- ...r,
198
- amount: Math.abs(r.amount)
199
- }), $ = k ? Qe(k, qt) : null, P = (D = n.sku.defaultCost) != null && D.costPerUnit ? n.sku.defaultCost.costPerUnit.amount / Math.pow(10, n.sku.defaultCost.costPerUnit.precision) : 0, I = p ? +N(p) : 0, o = +N(r), a = +N(R), _ = o - a, O = _ * P, f = a * P, y = o * P;
196
+ const v = yt(o), R = m ?? v, S = ut(R, l), k = l.amount === 0 ? null : dt(S, {
197
+ ...l,
198
+ amount: Math.abs(l.amount)
199
+ }), $ = 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
200
  return {
201
- code: n.sku.code,
202
- name: n.sku.name,
203
- baseUnit: n.sku.unit.abbrev,
204
- baseUnitAmount: +N(n.baseAmount),
205
- ...n.measurementsAmounts.filter(
206
- (M) => Jt(M.measurement) && e.includes(M.measurement.id)
201
+ code: o.sku.code,
202
+ name: o.sku.name,
203
+ baseUnit: o.sku.unit.abbrev,
204
+ baseUnitAmount: +N(o.baseAmount),
205
+ ...o.measurementsAmounts.filter(
206
+ (M) => aa(M.measurement) && e.includes(M.measurement.id)
207
207
  ).reduce(
208
208
  (M, Z, W) => (M[`measurementAbbrev${W}`] = `(${Z.measurement.abbrev}) × ${N(Z.measurement.conversion)}`, M[`measurementAmount${W}`] = +N(Z.amount), M),
209
209
  {}
210
210
  ),
211
- systemBalance: o,
211
+ systemBalance: s,
212
212
  physicalBalance: a,
213
213
  adjustedAmount: +N(S),
214
- adjustedDiffPercentage: $ ? +N(ct($, 2)) : null,
214
+ adjustedDiffPercentage: $ ? +N(mt($, 2)) : null,
215
215
  costPerUnit: P,
216
216
  opening: I,
217
- adjustmentTypes: w ?? ft,
217
+ adjustmentTypes: w ?? gt,
218
218
  varianceQty: _,
219
219
  varianceRM: O,
220
220
  stockTakeValue: f,
221
221
  systemValue: y
222
222
  };
223
223
  }
224
- function Jt(n) {
225
- return !n.abbrev.toLocaleLowerCase().includes("inactive");
224
+ function aa(o) {
225
+ return !o.abbrev.toLocaleLowerCase().includes("inactive");
226
226
  }
227
- function Xt(n) {
228
- const r = pt(n);
229
- return n.reduce(
227
+ function na(o) {
228
+ const l = bt(o);
229
+ return o.reduce(
230
230
  (e, m) => {
231
231
  var p;
232
- return Math.max(e, ((p = r == null ? void 0 : r.get(m.sku._id)) == null ? void 0 : p[0].length) ?? 0);
232
+ return Math.max(e, ((p = l == null ? void 0 : l.get(m.sku._id)) == null ? void 0 : p[0].length) ?? 0);
233
233
  },
234
234
  0
235
235
  );
236
236
  }
237
- function pt(n) {
238
- return n.groupBy(
239
- (r) => r.sku._id,
240
- (r) => r.measurementsAmounts.filter((e) => !e.measurement.abbrev.toLocaleLowerCase().includes("inactive")).map((e) => e.measurement.id)
237
+ function bt(o) {
238
+ return o.groupBy(
239
+ (l) => l.sku._id,
240
+ (l) => l.measurementsAmounts.filter((e) => !e.measurement.abbrev.toLocaleLowerCase().includes("inactive")).map((e) => e.measurement.id)
241
241
  );
242
242
  }
243
- function ea(n) {
243
+ function oa(o) {
244
244
  return [
245
245
  {
246
246
  id: "code",
@@ -302,7 +302,7 @@ function ea(n) {
302
302
  id: "baseUnitAmount",
303
303
  name: "Base unit amount"
304
304
  },
305
- ...Array.from({ length: n }).flatMap((e, m) => [
305
+ ...Array.from({ length: o }).flatMap((e, m) => [
306
306
  {
307
307
  id: `measurementAmount${m}`,
308
308
  name: `UOM amount ${m + 1}`
@@ -314,28 +314,28 @@ function ea(n) {
314
314
  ])
315
315
  ];
316
316
  }
317
- function ta(n, r, e) {
317
+ function sa(o, l, e) {
318
318
  var y, h, D, M, Z, W, re;
319
- const m = r.groupBy(
319
+ const m = l.groupBy(
320
320
  (B) => B.id,
321
321
  (B) => B.balance
322
322
  ), p = e.groupBy(
323
323
  (B) => B.id,
324
324
  (B) => B.balance
325
325
  ), w = /* @__PURE__ */ new Map();
326
- if (n.opening)
327
- for (const B of n.opening)
326
+ if (o.opening)
327
+ for (const B of o.opening)
328
328
  w.set(B.skuId, B.balance);
329
329
  const v = /* @__PURE__ */ new Map();
330
- if (n.adjustmentSnapshot)
331
- for (const B of n.adjustmentSnapshot) {
330
+ if (o.adjustmentSnapshot)
331
+ for (const B of o.adjustmentSnapshot) {
332
332
  const te = Object.keys(B.adjustmentsByType).join(", ");
333
- v.set(B.skuId, te || ft);
333
+ v.set(B.skuId, te || gt);
334
334
  }
335
- const R = [...n.items, ...n.negativeStockItems ?? []], S = pt(R), k = R.map((B) => {
335
+ const R = [...o.items, ...o.negativeStockItems ?? []], S = bt(R), k = R.map((B) => {
336
336
  var ye, ge, Y;
337
- const te = ((ye = m.get(B.sku._id)) == null ? void 0 : ye[0]) ?? Wt, 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);
338
- return Zt(
337
+ 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);
338
+ return ta(
339
339
  B,
340
340
  te,
341
341
  be,
@@ -343,56 +343,56 @@ function ta(n, r, e) {
343
343
  ke,
344
344
  fe
345
345
  );
346
- }), $ = Xt(R), I = Ut().currentBusiness.value, o = ea($), a = [
346
+ }), $ = na(R), I = zt().currentBusiness.value, s = oa($), a = [
347
347
  ["Business name:", I == null ? void 0 : I.name],
348
348
  ["Business ID:", I == null ? void 0 : I._id],
349
349
  ["Menu version", I == null ? void 0 : I.menuVersion],
350
- ["Created at", new Date(n.createdAt)],
351
- ["Created by", (y = n.createdBy) == null ? void 0 : y.name],
352
- ["Updated at", new Date(n.updatedAt)],
353
- ["Updated by", (h = n.updatedBy) == null ? void 0 : h.name],
354
- ["Recent action", n.approvedAt ? "Approve" : n.rejectionHistory ? "Reject" : ""],
350
+ ["Created at", new Date(o.createdAt)],
351
+ ["Created by", (y = o.createdBy) == null ? void 0 : y.name],
352
+ ["Updated at", new Date(o.updatedAt)],
353
+ ["Updated by", (h = o.updatedBy) == null ? void 0 : h.name],
354
+ ["Recent action", o.approvedAt ? "Approve" : o.rejectionHistory ? "Reject" : ""],
355
355
  [
356
356
  "Action by",
357
- n.approvedAt ? (D = n.approvedBy) == null ? void 0 : D.name : n.rejectionHistory ? (Z = (M = n.rejectionHistory[0]) == null ? void 0 : M.rejectedBy) == null ? void 0 : Z.name : ""
357
+ 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
358
  ],
359
359
  [
360
360
  "Action at",
361
- n.approvedAt ? new Date(n.approvedAt) : n.rejectionHistory ? new Date((W = n.rejectionHistory[0]) == null ? void 0 : W.rejectedAt) : ""
361
+ o.approvedAt ? new Date(o.approvedAt) : o.rejectionHistory ? new Date((W = o.rejectionHistory[0]) == null ? void 0 : W.rejectedAt) : ""
362
362
  ],
363
363
  [
364
364
  "Action remark",
365
- n.approvedAt ? n.approveRemark : n.rejectionHistory ? new Date((re = n.rejectionHistory[0]) == null ? void 0 : re.rejectRemark) : ""
365
+ o.approvedAt ? o.approveRemark : o.rejectionHistory ? new Date((re = o.rejectionHistory[0]) == null ? void 0 : re.rejectRemark) : ""
366
366
  ],
367
367
  [],
368
- o.map((B) => B.name),
369
- ...k.map((B) => o.map((te) => B[te.id]))
370
- ], _ = o.map((B) => `system:${B.id}`), O = St(a, _), f = `[${I == null ? void 0 : I.name}] closing draft (${jt(new Date(n.updatedAt))}).xlsx`;
371
- return Ct(O, f), f;
368
+ s.map((B) => B.name),
369
+ ...k.map((B) => s.map((te) => B[te.id]))
370
+ ], _ = s.map((B) => `system:${B.id}`), O = Ft(a, _), f = `[${I == null ? void 0 : I.name}] closing draft (${Tt(new Date(o.updatedAt))}).xlsx`;
371
+ return $t(O, f), f;
372
372
  }
373
- const aa = { class: "flex flex-col" }, na = { class: "flex gap-12 py-8 justify-end w-full" }, oa = /* @__PURE__ */ He({
373
+ const ra = { class: "flex flex-col" }, la = { class: "flex gap-12 py-8 justify-end w-full" }, ca = /* @__PURE__ */ He({
374
374
  __name: "RefreshBalanceAction",
375
375
  props: {
376
376
  draft: {},
377
377
  onCancel: { type: Function },
378
378
  onFinished: { type: Function }
379
379
  },
380
- setup(n) {
381
- const r = n;
380
+ setup(o) {
381
+ const l = o;
382
382
  We();
383
383
  const e = H(!1), m = H(null), p = H(!1);
384
384
  Ye(() => {
385
- if (r.draft.effectiveAt)
386
- m.value = new Date(r.draft.effectiveAt);
385
+ if (l.draft.effectiveAt)
386
+ m.value = new Date(l.draft.effectiveAt);
387
387
  else {
388
- const S = new Date(r.draft.createdAt);
388
+ const S = new Date(l.draft.createdAt);
389
389
  S.setHours(23, 59, 59, 999), m.value = S;
390
390
  }
391
391
  p.value = !0;
392
392
  });
393
393
  const w = V({
394
394
  get() {
395
- return m.value === null ? "" : ot(m.value);
395
+ return m.value === null ? "" : ct(m.value);
396
396
  },
397
397
  set(S) {
398
398
  if (S) {
@@ -403,7 +403,7 @@ const aa = { class: "flex flex-col" }, na = { class: "flex gap-12 py-8 justify-e
403
403
  }
404
404
  }), v = V({
405
405
  get() {
406
- return m.value === null ? "" : st(m.value);
406
+ return m.value === null ? "" : it(m.value);
407
407
  },
408
408
  set(S) {
409
409
  if (S) {
@@ -414,30 +414,30 @@ const aa = { class: "flex flex-col" }, na = { class: "flex gap-12 py-8 justify-e
414
414
  }
415
415
  });
416
416
  async function R() {
417
- e.value = !0, r.onFinished(m.value.toISOString());
417
+ e.value = !0, l.onFinished(m.value.toISOString());
418
418
  }
419
419
  return (S, k) => {
420
- const $ = U("FmLabel"), P = U("FmDatePicker"), I = U("FmTimePicker"), o = U("FmButton"), a = U("FmForm");
421
- return p.value ? (C(), se(a, {
420
+ const $ = U("FmLabel"), P = U("FmDatePicker"), I = U("FmTimePicker"), s = U("FmButton"), a = U("FmForm");
421
+ return p.value ? (j(), se(a, {
422
422
  key: 1,
423
423
  onValidationSuccess: R,
424
424
  class: "flex flex-col gap-32",
425
425
  disabled: e.value
426
426
  }, {
427
427
  default: G(() => [
428
- k[5] || (k[5] = s("div", { class: "fm-typo-en-body-lg-400" }, [
429
- s("p", null, [
428
+ k[5] || (k[5] = r("div", { class: "fm-typo-en-body-lg-400" }, [
429
+ r("p", null, [
430
430
  X(" Performing "),
431
- s("span", { class: "fm-typo-en-body-lg-600" }, '"Refresh Balance"'),
431
+ r("span", { class: "fm-typo-en-body-lg-600" }, '"Refresh Balance"'),
432
432
  X(" until closing effective date and time. ")
433
433
  ]),
434
- s("p", { class: "mt-2" }, [
434
+ r("p", { class: "mt-2" }, [
435
435
  X(" Please note that this action will "),
436
- s("b", null, "update"),
436
+ r("b", null, "update"),
437
437
  X(" the effective date and time. ")
438
438
  ])
439
439
  ], -1)),
440
- s("div", aa, [
440
+ r("div", ra, [
441
441
  x($, { class: "fm-typo-en-body-lg-600" }, {
442
442
  default: G(() => k[3] || (k[3] = [
443
443
  X("Closing Date")
@@ -459,13 +459,13 @@ const aa = { class: "flex flex-col" }, na = { class: "flex gap-12 py-8 justify-e
459
459
  "onUpdate:modelValue": k[1] || (k[1] = (_) => v.value = _)
460
460
  }, null, 8, ["modelValue"])
461
461
  ]),
462
- s("div", na, [
463
- x(o, {
462
+ r("div", la, [
463
+ x(s, {
464
464
  label: "Cancel",
465
465
  variant: "tertiary",
466
466
  onClick: k[2] || (k[2] = (_) => S.onCancel())
467
467
  }),
468
- x(o, {
468
+ x(s, {
469
469
  label: "Refresh balance",
470
470
  type: "submit",
471
471
  variant: "primary",
@@ -474,15 +474,15 @@ const aa = { class: "flex flex-col" }, na = { class: "flex gap-12 py-8 justify-e
474
474
  ])
475
475
  ]),
476
476
  _: 1
477
- }, 8, ["disabled"])) : (C(), L(ee, { key: 0 }, [
477
+ }, 8, ["disabled"])) : (j(), L(ee, { key: 0 }, [
478
478
  X("Loading")
479
479
  ], 64));
480
480
  };
481
481
  }
482
- }), Ee = ut(
482
+ }), Ee = pt(
483
483
  "closingDraftActions",
484
484
  function() {
485
- const r = Lt(), e = Ge(), m = We(), p = Ne(), w = dt(), v = H(!1), R = H();
485
+ const l = Nt(), e = Ge(), m = We(), p = Ne(), w = vt(), v = H(!1), R = H();
486
486
  function S(f) {
487
487
  const y = {
488
488
  draft: f
@@ -514,47 +514,47 @@ const aa = { class: "flex flex-col" }, na = { class: "flex gap-12 py-8 justify-e
514
514
  y || (e.open({
515
515
  title: "Exporting",
516
516
  message: "Fetching data..."
517
- }), y = await k(f)), ta(f, y, h ?? []);
517
+ }), y = await k(f)), sa(f, y, h ?? []);
518
518
  }
519
519
  function P(f, y) {
520
- r.open({
520
+ l.open({
521
521
  title: "Approve draft",
522
522
  contentComponent: Oe,
523
523
  contentComponentProps: {
524
524
  draft: f,
525
525
  action: z.enum.approveDraft,
526
526
  onFinished: () => {
527
- r.close(), y == null || y();
527
+ l.close(), y == null || y();
528
528
  },
529
- onCancel: () => r.close()
529
+ onCancel: () => l.close()
530
530
  }
531
531
  });
532
532
  }
533
533
  function I(f, y) {
534
- r.open({
534
+ l.open({
535
535
  title: "Reject draft",
536
536
  contentComponent: Oe,
537
537
  contentComponentProps: {
538
538
  draft: f,
539
539
  action: z.enum.rejectDraft,
540
540
  onFinished: () => {
541
- r.close(), y == null || y();
541
+ l.close(), y == null || y();
542
542
  },
543
- onCancel: () => r.close()
543
+ onCancel: () => l.close()
544
544
  }
545
545
  });
546
546
  }
547
- function o(f, y) {
548
- r.open({
547
+ function s(f, y) {
548
+ l.open({
549
549
  title: "Mark draft as failed",
550
550
  contentComponent: Oe,
551
551
  contentComponentProps: {
552
552
  draft: f,
553
553
  action: z.enum.markAsFailed,
554
554
  onFinished: () => {
555
- r.close(), y == null || y();
555
+ l.close(), y == null || y();
556
556
  },
557
- onCancel: () => r.close()
557
+ onCancel: () => l.close()
558
558
  }
559
559
  });
560
560
  }
@@ -576,16 +576,16 @@ const aa = { class: "flex flex-col" }, na = { class: "flex gap-12 py-8 justify-e
576
576
  v.value = !1;
577
577
  }
578
578
  async function O(f, y, h) {
579
- await r.open({
579
+ await l.open({
580
580
  title: "Refresh balance",
581
- contentComponent: oa,
581
+ contentComponent: ca,
582
582
  contentComponentProps: {
583
583
  draft: f,
584
584
  onFinished: (D) => {
585
- r.close(), h == null || h(D);
585
+ l.close(), h == null || h(D);
586
586
  },
587
587
  onCancel: async () => {
588
- r.close(), y == null || y();
588
+ l.close(), y == null || y();
589
589
  }
590
590
  }
591
591
  });
@@ -595,7 +595,7 @@ const aa = { class: "flex flex-col" }, na = { class: "flex gap-12 py-8 justify-e
595
595
  closeDraftDialog: _,
596
596
  approveDraft: P,
597
597
  rejectDraft: I,
598
- markAsFailed: o,
598
+ markAsFailed: s,
599
599
  syncDraft: a,
600
600
  exportDraft: $,
601
601
  refreshBalance: O,
@@ -604,8 +604,8 @@ const aa = { class: "flex flex-col" }, na = { class: "flex gap-12 py-8 justify-e
604
604
  };
605
605
  }
606
606
  );
607
- function Le(n) {
608
- switch (n) {
607
+ function Le(o) {
608
+ switch (o) {
609
609
  case "DRAFT":
610
610
  return "fm-status-badge-draft";
611
611
  case "PROCESSING":
@@ -616,29 +616,29 @@ function Le(n) {
616
616
  return "fm-status-badge-complete";
617
617
  }
618
618
  }
619
- const sa = ut(
619
+ const ia = pt(
620
620
  "closingDraftTable",
621
621
  function() {
622
- const { t: r } = it(), e = Ee(), m = H(new Array()), p = H(!1), w = ze(), v = Ne();
622
+ const { t: l } = ft(), e = Ee(), m = H(new Array()), p = H(!1), w = ze(), v = Ne();
623
623
  async function R() {
624
624
  if (m.value = [], !!w._currentLocation) {
625
625
  p.value = !0;
626
626
  try {
627
- const [o] = await Promise.all([v.readDrafts()]).delayed(1e3);
628
- m.value = o.reverse();
629
- } catch (o) {
630
- console.log("Something went wrong when fetching drafts:", o);
627
+ const [s] = await Promise.all([v.readDrafts()]).delayed(1e3);
628
+ m.value = s.reverse();
629
+ } catch (s) {
630
+ console.log("Something went wrong when fetching drafts:", s);
631
631
  } finally {
632
632
  p.value = !1;
633
633
  }
634
634
  }
635
635
  }
636
- async function S(o) {
636
+ async function S(s) {
637
637
  if (!m.value.find((a) => a._id) && w._currentLocation) {
638
638
  p.value = !0;
639
639
  try {
640
640
  const [a] = await Promise.all([
641
- v.getDraft(o),
641
+ v.getDraft(s),
642
642
  new Promise((_) => setTimeout(_, 1e3))
643
643
  ]);
644
644
  m.value = [a];
@@ -649,17 +649,17 @@ const sa = ut(
649
649
  }
650
650
  }
651
651
  }
652
- function k(o) {
653
- m.value = m.value.map((a) => a._id === o._id ? {
654
- ...o,
652
+ function k(s) {
653
+ m.value = m.value.map((a) => a._id === s._id ? {
654
+ ...s,
655
655
  _rev: a._rev
656
656
  } : a);
657
657
  }
658
658
  function $() {
659
659
  e.closeDraftDialog(), R();
660
660
  }
661
- function P(o, a) {
662
- switch (a = Tt(a), o) {
661
+ function P(s, a) {
662
+ switch (a = It(a), s) {
663
663
  case Re.Details:
664
664
  return e.viewDraft(a);
665
665
  case Re.Export:
@@ -677,18 +677,18 @@ const sa = ut(
677
677
  {
678
678
  id: "_id",
679
679
  accessorKey: "_id",
680
- header: () => r("inventory.closing.table.createdAt"),
681
- cell(o) {
682
- return Bt(`${o.getValue()}`);
680
+ header: () => l("inventory.closing.table.createdAt"),
681
+ cell(s) {
682
+ return Mt(`${s.getValue()}`);
683
683
  },
684
684
  enableSorting: !0
685
685
  },
686
686
  {
687
687
  accessorKey: "effectiveAt",
688
688
  header: () => "Effective at",
689
- cell(o) {
690
- const a = o.row.original;
691
- let _ = o.getValue();
689
+ cell(s) {
690
+ const a = s.row.original;
691
+ let _ = s.getValue();
692
692
  return _ || (_ = Ke(a._id)), ve(_);
693
693
  },
694
694
  enableSorting: !0,
@@ -696,7 +696,7 @@ const sa = ut(
696
696
  },
697
697
  {
698
698
  id: "updatedAt",
699
- accessorFn: (o) => ve(o.updatedAt),
699
+ accessorFn: (s) => ve(s.updatedAt),
700
700
  header: () => "Updated at",
701
701
  enableSorting: !0,
702
702
  size: 200
@@ -710,11 +710,11 @@ const sa = ut(
710
710
  },
711
711
  {
712
712
  id: "noOfItems",
713
- accessorFn: (o) => {
713
+ accessorFn: (s) => {
714
714
  var a;
715
- return o.items.length + (((a = o.negativeStockItems) == null ? void 0 : a.length) ?? 0);
715
+ return s.items.length + (((a = s.negativeStockItems) == null ? void 0 : a.length) ?? 0);
716
716
  },
717
- header: () => r("inventory.closing.table.noOfItems"),
717
+ header: () => l("inventory.closing.table.noOfItems"),
718
718
  enableSorting: !1,
719
719
  meta: {
720
720
  width: "10rem",
@@ -723,20 +723,20 @@ const sa = ut(
723
723
  },
724
724
  {
725
725
  id: "recentRemark",
726
- accessorFn: (o) => {
726
+ accessorFn: (s) => {
727
727
  var a;
728
- return (o == null ? void 0 : o.approveRemark) ?? ((a = o == null ? void 0 : o.rejectionHistory) == null ? void 0 : a.computeFirst((_) => _.rejectRemark)) ?? o.remark;
728
+ return (s == null ? void 0 : s.approveRemark) ?? ((a = s == null ? void 0 : s.rejectionHistory) == null ? void 0 : a.computeFirst((_) => _.rejectRemark)) ?? s.remark;
729
729
  },
730
730
  header: () => "Recent remark"
731
731
  },
732
732
  {
733
733
  id: "status",
734
- accessorFn: (o) => o.status,
735
- header: () => r("inventory.closing.table.status"),
734
+ accessorFn: (s) => s.status,
735
+ header: () => l("inventory.closing.table.status"),
736
736
  enableSorting: !1,
737
- cell(o) {
737
+ cell(s) {
738
738
  var h;
739
- const a = o.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;
739
+ 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;
740
740
  return _ === "DRAFT" && y ? y.getTime() > O.getTime() ? T(
741
741
  "div",
742
742
  {
@@ -778,10 +778,10 @@ const sa = ut(
778
778
  },
779
779
  {
780
780
  id: "action",
781
- cell(o) {
782
- const a = o.row.original, _ = [
783
- tt[Re.Details],
784
- tt[Re.Export]
781
+ cell(s) {
782
+ const a = s.row.original, _ = [
783
+ st[Re.Details],
784
+ st[Re.Export]
785
785
  ], O = [
786
786
  {
787
787
  translationKey: "inventory.closing.draft.approveDraft",
@@ -799,7 +799,7 @@ const sa = ut(
799
799
  value: z.enum.markAsFailed
800
800
  }
801
801
  ];
802
- return Ft(
802
+ return Rt(
803
803
  [
804
804
  ..._,
805
805
  ...a.status === pe.enum.DRAFT ? O : []
@@ -822,67 +822,67 @@ const sa = ut(
822
822
  updateDraftRef: k
823
823
  };
824
824
  }
825
- ), ra = { class: "w-full flex flex-col gap-32" }, la = { class: "flex justify-between" }, ca = { class: "flex" }, ia = { class: "grid grid-cols-[repeat(4,1fr)] xs:flex xs:flex-col sm:flex sm:flex-col gap-8" }, ua = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, da = { class: "flex gap-1" }, ma = { class: "fm-typo-en-body-lg-600" }, fa = { class: "flex flex-col gap-16" }, pa = { class: "flex items-center" }, va = {
825
+ ), 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
826
  key: 0,
827
827
  class: "flex gap-8"
828
- }, ya = {
828
+ }, ha = {
829
829
  key: 0,
830
830
  class: "w-full flex flex-col items-center"
831
- }, ga = { class: "flex items-center gap-8" }, ba = { class: "flex flex-col gap-8" }, ka = { class: "flex gap-8" }, ha = {
831
+ }, Aa = { class: "flex items-center gap-8" }, xa = { class: "flex flex-col gap-8" }, _a = { class: "flex gap-8" }, Da = {
832
832
  key: 0,
833
833
  class: "flex gap-8"
834
- }, Aa = { class: "overflow-x-auto" }, xa = {
834
+ }, wa = { class: "overflow-x-auto" }, Sa = {
835
835
  key: 1,
836
836
  class: "flex-1 xs:w-screen xs:max-w-full"
837
- }, _a = {
837
+ }, Ca = {
838
838
  key: 0,
839
839
  class: "flex flex-col items-center gap-8 h-full"
840
- }, Da = ["src"], wa = {
840
+ }, ja = ["src"], Ba = {
841
841
  key: 1,
842
842
  class: "px-4 flex flex-col"
843
- }, Sa = { class: "flex gap-12 content-stretch" }, ja = {
843
+ }, Fa = { class: "flex gap-12 content-stretch" }, Ta = {
844
844
  class: "flex flex-col w-24",
845
845
  name: "circles"
846
- }, Ca = { class: "flex-1 flex flex-col items-center" }, Ba = { class: "flex-1 flex flex-col items-center" }, Fa = {
846
+ }, $a = { class: "flex-1 flex flex-col items-center" }, Ma = { class: "flex-1 flex flex-col items-center" }, Ra = {
847
847
  class: "py-12 flex flex-col gap-4",
848
848
  name: "received-at header"
849
- }, Ta = { class: "fm-typo-en-body-lg-400" }, $a = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, Ma = { class: "flex gap-12 content-stretch" }, Ra = {
849
+ }, 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
850
  class: "flex flex-col w-24",
851
851
  name: "circles"
852
- }, Ia = { class: "flex-1 flex flex-col items-center" }, Pa = {
852
+ }, La = { class: "flex-1 flex flex-col items-center" }, Ea = {
853
853
  class: "py-12 flex flex-col gap-4 flex-1",
854
854
  name: "delivery details"
855
- }, Va = { class: "flex flex-col gap-8" }, Ua = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, La = { class: "flex flex-col gap-4" }, Ea = { class: "flex gap-8" }, Ha = "N/A", za = /* @__PURE__ */ He({
855
+ }, 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
856
  __name: "ClosingDraftDialog",
857
857
  props: {
858
858
  show: { type: Boolean },
859
859
  draft: {}
860
860
  },
861
861
  emits: ["submitted", "refresh"],
862
- setup(n, { emit: r }) {
863
- const e = n, m = dt(), p = Ee(), w = Et(e, "show"), v = H(!1), R = H(!1), S = H(!1), k = H(new Array()), $ = H(new Array()), P = H([]), I = We(), o = Ne(), a = Ge(), _ = $t(), O = ze(), f = kt({}), y = V(() => new Set(
864
- _.skus.filter((l) => {
862
+ setup(o, { emit: l }) {
863
+ 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(
864
+ _.skus.filter((c) => {
865
865
  var t;
866
- return f[(t = l.customAttributes) == null ? void 0 : t.tag];
867
- }).map((l) => l._id)
868
- )), h = r, D = H({
866
+ return f[(t = c.customAttributes) == null ? void 0 : t.tag];
867
+ }).map((c) => c._id)
868
+ )), h = l, D = H({
869
869
  templateItem: !0,
870
870
  nonTemplateItem: !0
871
871
  }), M = V(() => {
872
872
  var t, d;
873
- const l = [...((t = e.draft) == null ? void 0 : t.items) ?? [], ...((d = e.draft) == null ? void 0 : d.negativeStockItems) ?? []];
874
- return y.value.size ? l.filter((u) => y.value.has(u.sku._id)) : l;
873
+ const c = [...((t = e.draft) == null ? void 0 : t.items) ?? [], ...((d = e.draft) == null ? void 0 : d.negativeStockItems) ?? []];
874
+ return y.value.size ? c.filter((i) => y.value.has(i.sku._id)) : c;
875
875
  }), Z = V(() => {
876
- const l = M.value.map((t) => t.sku);
877
- return l.sort((t, d) => t.code.localeCompare(d.code)), l;
876
+ const c = M.value.map((t) => t.sku);
877
+ return c.sort((t, d) => t.code.localeCompare(d.code)), c;
878
878
  }), W = V(() => M.value.groupBy(
879
879
  (t) => t.sku._id,
880
880
  (t) => t.measurementsAmounts.filter((d) => !d.measurement.abbrev.toLocaleLowerCase().includes("inactive")).map((d) => d.measurement.id)
881
881
  ));
882
- Ye(te), ht(
882
+ Ye(te), Dt(
883
883
  () => e.show,
884
- (l) => {
885
- l && (le.value = xe[0], te(), D.value = {
884
+ (c) => {
885
+ c && (le.value = xe[0], te(), D.value = {
886
886
  templateItem: !0,
887
887
  nonTemplateItem: !0
888
888
  });
@@ -890,13 +890,13 @@ const sa = ut(
890
890
  );
891
891
  const re = Be(0), B = Be(100);
892
892
  async function te() {
893
- var t, d, u, c;
893
+ var t, d, i, n;
894
894
  if (!O._currentLocation) return;
895
895
  v.value = !0;
896
- const l = ((t = e.draft) == null ? void 0 : t.status) === pe.enum.COMPLETED;
896
+ const c = ((t = e.draft) == null ? void 0 : t.status) === pe.enum.COMPLETED;
897
897
  $.value = [];
898
898
  try {
899
- if (await _.init(), l) {
899
+ if (await _.init(), c) {
900
900
  const E = e.draft.closingAdjustmentId;
901
901
  if (!E) {
902
902
  a.open({
@@ -910,35 +910,35 @@ const sa = ut(
910
910
  }
911
911
  const ae = await I.readAdjustmentById(E), ce = (ae == null ? void 0 : ae.skus) ?? [];
912
912
  for (const ne of ce) {
913
- const je = {
913
+ const Ce = {
914
914
  id: ne.sku._id,
915
915
  balance: ne.fromBalance,
916
916
  costs: ne.fromCostBalances
917
- }, j = {
917
+ }, C = {
918
918
  id: ne.sku._id,
919
919
  balance: ne.toBalance,
920
920
  costs: ne.toCostBalances
921
921
  };
922
- k.value.push(je), $.value.push(j);
922
+ k.value.push(Ce), $.value.push(C);
923
923
  }
924
924
  } else
925
- k.value = ((u = e.draft) == null ? void 0 : u.stockSnapshot) ?? [];
926
- const i = /* @__PURE__ */ new Set();
927
- if ((c = e.draft) != null && c.adjustmentSnapshot)
925
+ k.value = ((i = e.draft) == null ? void 0 : i.stockSnapshot) ?? [];
926
+ const u = /* @__PURE__ */ new Set();
927
+ if ((n = e.draft) != null && n.adjustmentSnapshot)
928
928
  for (const E of e.draft.adjustmentSnapshot)
929
- E.adjustmentsByType && Object.keys(E.adjustmentsByType).forEach((ae) => i.add(ae));
929
+ E.adjustmentsByType && Object.keys(E.adjustmentsByType).forEach((ae) => u.add(ae));
930
930
  const g = ["receive", "sales", "wastage"], A = [];
931
931
  g.forEach((E) => {
932
- i.has(E) && (A.push(E), i.delete(E));
932
+ u.has(E) && (A.push(E), u.delete(E));
933
933
  });
934
- const b = Array.from(i).sort();
934
+ const b = Array.from(u).sort();
935
935
  P.value = [...A, ...b];
936
- } catch (i) {
936
+ } catch (u) {
937
937
  a.open({
938
938
  title: "Something went wrong",
939
939
  message: "Something went wrong when fetching info. Please try again.",
940
940
  type: "error"
941
- }), console.error("error on fetch stock balances", i);
941
+ }), console.error("error on fetch stock balances", u);
942
942
  } finally {
943
943
  v.value = !1;
944
944
  }
@@ -957,16 +957,16 @@ const sa = ut(
957
957
  e.draft,
958
958
  () => {
959
959
  },
960
- async (u) => {
960
+ async (i) => {
961
961
  var A;
962
962
  R.value = !0;
963
- const c = (A = e.draft) == null ? void 0 : A._rev, i = 30, g = 2e3;
963
+ const n = (A = e.draft) == null ? void 0 : A._rev, u = 30, g = 2e3;
964
964
  try {
965
- await I.recalculation.scheduleCalculateStockSnapshotAtDate(u, e.draft._id);
965
+ await I.recalculation.scheduleCalculateStockSnapshotAtDate(i, e.draft._id);
966
966
  let b = null;
967
- for (let E = 0; E < i && (b = await o.getDraft(e.draft._id).delayed(g), b._rev === c); E++)
967
+ for (let E = 0; E < u && (b = await s.getDraft(e.draft._id).delayed(g), b._rev === n); E++)
968
968
  ;
969
- if (!b || b._rev === c) {
969
+ if (!b || b._rev === n) {
970
970
  a.open({
971
971
  title: "Refresh failed",
972
972
  message: "Failed to refresh stock balance. Please try again.",
@@ -993,34 +993,34 @@ const sa = ut(
993
993
  }
994
994
  const ke = V(
995
995
  () => k.value.groupBy(
996
- (l) => l.id,
997
- (l) => l.balance
996
+ (c) => c.id,
997
+ (c) => c.balance
998
998
  )
999
- ), fe = V(() => M.value.groupBy((l) => l.sku._id)), ye = V(() => {
1000
- var l;
1001
- return (l = e.draft) != null && l.adjustmentSnapshot ? new Map(e.draft.adjustmentSnapshot.map((t) => [t.skuId, t.adjustmentsByType])) : /* @__PURE__ */ new Map();
999
+ ), fe = V(() => M.value.groupBy((c) => c.sku._id)), ye = V(() => {
1000
+ var c;
1001
+ return (c = e.draft) != null && c.adjustmentSnapshot ? new Map(e.draft.adjustmentSnapshot.map((t) => [t.skuId, t.adjustmentsByType])) : /* @__PURE__ */ new Map();
1002
1002
  }), ge = V(() => {
1003
- var l;
1004
- return (l = e.draft) != null && l.opening ? new Map(e.draft.opening.map((t) => [t.skuId, t.balance])) : /* @__PURE__ */ new Map();
1003
+ var c;
1004
+ return (c = e.draft) != null && c.opening ? new Map(e.draft.opening.map((t) => [t.skuId, t.balance])) : /* @__PURE__ */ new Map();
1005
1005
  });
1006
- function Y(l, t) {
1006
+ function Y(c, t) {
1007
1007
  return T(
1008
1008
  Ve.FmTooltip,
1009
1009
  { zIndex: 51, placement: "left", class: "w-full flex justify-end" },
1010
1010
  {
1011
1011
  default() {
1012
- return l;
1012
+ return c;
1013
1013
  },
1014
1014
  content() {
1015
- return t || l;
1015
+ return t || c;
1016
1016
  }
1017
1017
  }
1018
1018
  );
1019
1019
  }
1020
1020
  const we = V(() => {
1021
- const l = Z.value.reduce((d, u) => {
1022
- var c, i;
1023
- return Math.max(d, ((i = (c = W.value) == null ? void 0 : c.get(u._id)) == null ? void 0 : i[0].length) ?? 0);
1021
+ const c = Z.value.reduce((d, i) => {
1022
+ var n, u;
1023
+ return Math.max(d, ((u = (n = W.value) == null ? void 0 : n.get(i._id)) == null ? void 0 : u[0].length) ?? 0);
1024
1024
  }, 0);
1025
1025
  return [
1026
1026
  {
@@ -1029,26 +1029,26 @@ const sa = ut(
1029
1029
  header: () => "Name",
1030
1030
  size: 350,
1031
1031
  cell(d) {
1032
- const u = d.row.original, c = u.adjustedDiffPercentage, i = typeof c == "number" && Math.abs(c) > 10, g = T("div", { class: "flex flex-col gap-4" }, [
1032
+ 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" }, [
1033
1033
  T(
1034
1034
  "div",
1035
1035
  {
1036
1036
  class: [
1037
1037
  "line-clamp-1 fm-typo-en-body-lg-400",
1038
- i ? " text-fm-color-system-error-300" : "text-fm-color-typo-primary"
1038
+ u ? " text-fm-color-system-error-300" : "text-fm-color-typo-primary"
1039
1039
  ]
1040
1040
  },
1041
- u.name
1041
+ i.name
1042
1042
  ),
1043
1043
  T(
1044
1044
  "div",
1045
1045
  {
1046
1046
  class: [
1047
1047
  "line-clamp-1 fm-typo-en-body-md-400",
1048
- i ? " text-fm-color-system-error-300" : "text-fm-color-typo-secondary"
1048
+ u ? " text-fm-color-system-error-300" : "text-fm-color-typo-secondary"
1049
1049
  ]
1050
1050
  },
1051
- u.code
1051
+ i.code
1052
1052
  )
1053
1053
  ]);
1054
1054
  return T(
@@ -1058,7 +1058,7 @@ const sa = ut(
1058
1058
  },
1059
1059
  {
1060
1060
  content() {
1061
- return i ? "Adjustment difference is more than 10%." : `${u.code} - ${u.name}`;
1061
+ return u ? "Adjustment difference is more than 10%." : `${i.code} - ${i.name}`;
1062
1062
  },
1063
1063
  default() {
1064
1064
  return T("div", { class: "flex items-center gap-4 justify-start w-full" }, [
@@ -1075,18 +1075,21 @@ const sa = ut(
1075
1075
  header: () => Y("Cost per unit"),
1076
1076
  size: 160,
1077
1077
  cell(d) {
1078
- const u = d.row.original.costPerUnit;
1079
- return T("div", { class: "text-right" }, u.toFixed(2));
1078
+ const i = d.row.original.costPerUnit;
1079
+ return T("div", { class: "text-right" }, i.toFixed(2));
1080
1080
  },
1081
1081
  meta: {
1082
1082
  textAlign: "right"
1083
1083
  }
1084
1084
  },
1085
1085
  {
1086
- id: "baseUnit",
1086
+ id: "costUnit",
1087
1087
  header: () => "UOM",
1088
1088
  size: 80,
1089
- accessorKey: "baseUnit"
1089
+ cell(d) {
1090
+ const i = d.row.original.costUnit, n = d.row.original.baseUnit;
1091
+ return i ?? n;
1092
+ }
1090
1093
  },
1091
1094
  {
1092
1095
  id: "opening",
@@ -1094,27 +1097,29 @@ const sa = ut(
1094
1097
  header: () => Y("Opening (B/F)", "The opening balance brought forward from previous period."),
1095
1098
  size: 150,
1096
1099
  cell(d) {
1097
- const u = d.row.original.opening;
1098
- return T("div", { class: "text-right" }, u.toFixed(2));
1100
+ const i = d.row.original.opening;
1101
+ return T("div", { class: "text-right" }, i.toFixed(2));
1099
1102
  },
1100
1103
  meta: {
1101
1104
  textAlign: "right"
1102
1105
  }
1103
1106
  },
1104
1107
  // Dynamic adjustment type columns
1105
- ...P.value.map((d) => ({
1106
- id: `adjustment_${d}`,
1107
- accessorFn: (u) => u.adjustmentAmounts[d] ?? { amount: 0, precision: 0 },
1108
- header: () => Y(Ue(d)),
1109
- size: 150,
1110
- cell(u) {
1111
- const c = u.row.original.adjustmentAmounts[d] ?? { amount: 0, precision: 0 };
1112
- return T("div", { class: "text-right" }, N(c));
1113
- },
1114
- meta: {
1115
- textAlign: "right"
1116
- }
1117
- })),
1108
+ ...P.value.map(
1109
+ (d) => ({
1110
+ id: `adjustment_${d}`,
1111
+ accessorFn: (i) => i.adjustmentAmounts[d] ?? { amount: 0, precision: 0 },
1112
+ header: () => Y(Ue(d)),
1113
+ size: 150,
1114
+ cell(i) {
1115
+ const n = i.row.original.adjustmentAmounts[d] ?? { amount: 0, precision: 0 };
1116
+ return T("div", { class: "text-right" }, N(n));
1117
+ },
1118
+ meta: {
1119
+ textAlign: "right"
1120
+ }
1121
+ })
1122
+ ),
1118
1123
  {
1119
1124
  id: "systemBalance",
1120
1125
  accessorKey: "systemBalance",
@@ -1127,29 +1132,29 @@ const sa = ut(
1127
1132
  {
1128
1133
  id: "physicalBalance",
1129
1134
  accessorFn: (d) => {
1130
- var c;
1131
- const u = (c = $.value.find((i) => i.id === d.id)) == null ? void 0 : c.balance;
1132
- return u ? Ie.toFormatString({ value: u }) : d.physicalBalance;
1135
+ var n;
1136
+ const i = (n = $.value.find((u) => u.id === d.id)) == null ? void 0 : n.balance;
1137
+ return i ? Ie.toFormatString({ value: i }) : d.physicalBalance;
1133
1138
  },
1134
1139
  header: () => Y("Stock Take balance", "The physical balance recorded during stock take."),
1135
1140
  cell(d) {
1136
1141
  var b;
1137
- const u = d.row.original, c = Ie.fromNumber(u.physicalBalance);
1138
- let i = !0, g = u.physicalBalance;
1139
- const A = (b = $.value.find((E) => E.id === u.id)) == null ? void 0 : b.balance;
1142
+ const i = d.row.original, n = Ie.fromNumber(i.physicalBalance);
1143
+ let u = !0, g = i.physicalBalance;
1144
+ const A = (b = $.value.find((E) => E.id === i.id)) == null ? void 0 : b.balance;
1140
1145
  return A && (Ie.equals({
1141
- a: c,
1146
+ a: n,
1142
1147
  b: A
1143
- }) || (i = !1, g = Number(Ie.toFormatString({ value: A })))), T("div", { class: "flex flex-col" }, [
1148
+ }) || (u = !1, g = Number(Ie.toFormatString({ value: A })))), T("div", { class: "flex flex-col" }, [
1144
1149
  T(
1145
1150
  "span",
1146
1151
  { class: "line-clamp-1 fm-typo-en-body-lg-400 text-fm-color-typo-primary" },
1147
1152
  g
1148
1153
  ),
1149
- i ? null : T(
1154
+ u ? null : T(
1150
1155
  "span",
1151
1156
  { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" },
1152
- `Draft: ${u.physicalBalance.toString()}`
1157
+ `Draft: ${i.physicalBalance.toString()}`
1153
1158
  )
1154
1159
  ]);
1155
1160
  },
@@ -1173,8 +1178,8 @@ const sa = ut(
1173
1178
  header: () => Y("Variance (RM)"),
1174
1179
  size: 150,
1175
1180
  cell(d) {
1176
- const u = d.row.original.varianceRM;
1177
- return T("div", { class: "text-right" }, u.toFixed(2));
1181
+ const i = d.row.original.varianceRM;
1182
+ return T("div", { class: "text-right" }, i.toFixed(2));
1178
1183
  },
1179
1184
  meta: {
1180
1185
  textAlign: "right"
@@ -1183,22 +1188,25 @@ const sa = ut(
1183
1188
  {
1184
1189
  id: "adjustedDiffPercentage",
1185
1190
  accessorKey: "adjustedDiffPercentage",
1186
- header: () => Y("Variance (%)", "Difference between Stock Take balance and System Balance in percentage."),
1191
+ header: () => Y(
1192
+ "Variance (%)",
1193
+ "Difference between Stock Take balance and System Balance in percentage."
1194
+ ),
1187
1195
  size: 200,
1188
1196
  cell(d) {
1189
- const u = d.row.original.adjustedDiffPercentage;
1190
- if (!u) return Ha;
1191
- const c = u.toFixed(2);
1192
- if (c === "0.00")
1197
+ const i = d.row.original.adjustedDiffPercentage;
1198
+ if (!i) return Ka;
1199
+ const n = i.toFixed(2);
1200
+ if (n === "0.00")
1193
1201
  return T("div", { class: "flex items-center gap-4 justify-end" }, ["0.00"]);
1194
- const i = u > 0;
1202
+ const u = i > 0;
1195
1203
  return T("div", { class: "flex items-center gap-4 justify-end" }, [
1196
1204
  T(Ve.FmIcon, {
1197
- name: i ? "arrow_drop_up" : "arrow_drop_down",
1198
- color: i ? "system-success-300" : "system-error-300",
1205
+ name: u ? "arrow_drop_up" : "arrow_drop_down",
1206
+ color: u ? "system-success-300" : "system-error-300",
1199
1207
  size: "md"
1200
1208
  }),
1201
- c
1209
+ n
1202
1210
  ]);
1203
1211
  },
1204
1212
  meta: {
@@ -1211,8 +1219,8 @@ const sa = ut(
1211
1219
  header: () => Y("Stock take value (RM)"),
1212
1220
  size: 180,
1213
1221
  cell(d) {
1214
- const u = d.row.original.stockTakeValue;
1215
- return T("div", { class: "text-right" }, u.toFixed(2));
1222
+ const i = d.row.original.stockTakeValue;
1223
+ return T("div", { class: "text-right" }, i.toFixed(2));
1216
1224
  },
1217
1225
  meta: {
1218
1226
  textAlign: "right"
@@ -1224,8 +1232,8 @@ const sa = ut(
1224
1232
  header: () => Y("System value (RM)"),
1225
1233
  size: 180,
1226
1234
  cell(d) {
1227
- const u = d.row.original.systemValue;
1228
- return T("div", { class: "text-right" }, u.toFixed(2));
1235
+ const i = d.row.original.systemValue;
1236
+ return T("div", { class: "text-right" }, i.toFixed(2));
1229
1237
  },
1230
1238
  meta: {
1231
1239
  textAlign: "right"
@@ -1236,7 +1244,7 @@ const sa = ut(
1236
1244
  header: () => "Amounts",
1237
1245
  enableSorting: !1,
1238
1246
  cell(d) {
1239
- const u = d.row.original, c = (g, A) => T(
1247
+ const i = d.row.original, n = (g, A) => T(
1240
1248
  Ve.FmTooltip,
1241
1249
  { zIndex: 50 },
1242
1250
  {
@@ -1264,105 +1272,107 @@ const sa = ut(
1264
1272
  }
1265
1273
  }
1266
1274
  );
1267
- let i = Array.from({ length: l }).map((g, A) => {
1268
- if (!u[`measurementAmount${A}`])
1275
+ let u = Array.from({ length: c }).map((g, A) => {
1276
+ if (!i[`measurementAmount${A}`])
1269
1277
  return null;
1270
- const b = u[`measurementAmount${A}`], E = u[`measurementAbbrev${A}`];
1271
- return c(b, E);
1278
+ const b = i[`measurementAmount${A}`], E = i[`measurementAbbrev${A}`];
1279
+ return n(b, E);
1272
1280
  }).filter((g) => g);
1273
- return (u.baseUnitAmount || !i.length) && (i = [c(u.baseUnitAmount, u.baseUnit), ...i]), T(
1281
+ return (i.baseUnitAmount || !u.length) && (u = [n(i.baseUnitAmount, i.baseUnit), ...u]), T(
1274
1282
  "div",
1275
1283
  {
1276
1284
  class: "flex gap-8 flex-nowrap",
1277
1285
  style: {
1278
- minWidth: `${120 * i.length}px`
1286
+ minWidth: `${120 * u.length}px`
1279
1287
  }
1280
1288
  },
1281
- i
1289
+ u
1282
1290
  );
1283
1291
  }
1284
1292
  }
1285
1293
  ];
1286
- }), he = V(() => we.value.map((l) => l.size ?? 0).reduce((l, t) => l + t)), Ae = H(""), Se = V(() => {
1287
- var d, u;
1288
- const l = ((u = (d = e.draft) == null ? void 0 : d.negativeStockItems) == null ? void 0 : u.reduce(
1289
- (c, i) => (c[i.sku._id] = i, c),
1294
+ }), he = V(() => we.value.map((c) => c.size ?? 0).reduce((c, t) => c + t)), Ae = H(""), Se = V(() => {
1295
+ var d, i;
1296
+ const c = ((i = (d = e.draft) == null ? void 0 : d.negativeStockItems) == null ? void 0 : i.reduce(
1297
+ (n, u) => (n[u.sku._id] = u, n),
1290
1298
  {}
1291
1299
  )) ?? {};
1292
- return Z.value.map((c) => {
1293
- var qe, Ze, Je, Xe, et;
1294
- const i = (qe = fe.value.get(c._id)) == null ? void 0 : qe[0], g = ((Ze = ke.value.get(c._id)) == null ? void 0 : Ze[0]) ?? re, A = (Je = c.defaultCost) != null && Je.costPerUnit ? c.defaultCost.costPerUnit.amount / Math.pow(10, c.defaultCost.costPerUnit.precision) : 0, b = ge.value.get(c._id), E = b ? +N(b) : 0, ae = ye.value.get(c._id), ce = {};
1300
+ return Z.value.map((n) => {
1301
+ var qe, Ze, Je, Xe, et, tt, at, nt, ot;
1302
+ 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 = {};
1295
1303
  if (P.value.forEach((Q) => {
1296
1304
  const oe = ce[Q] ?? { amount: 0, precision: 0 }, ue = ae == null ? void 0 : ae[Q];
1297
- ue && (ce[Q] = Mt(oe, ue));
1298
- }), !i) {
1299
- const Q = +N(g), oe = Q - 0, ue = oe * A, Me = 0, bt = Q * A;
1305
+ ue && (ce[Q] = Vt(oe, ue));
1306
+ }), !u) {
1307
+ const Q = +N(g), oe = Q - 0, ue = oe * A, Me = 0, xt = Q * A;
1300
1308
  return {
1301
- id: c._id,
1302
- code: c.code,
1303
- name: c.name,
1304
- baseUnit: c.unit.abbrev,
1309
+ id: n._id,
1310
+ code: n.code,
1311
+ name: n.name,
1312
+ costUnit: ((et = (Xe = n.defaultCost) == null ? void 0 : Xe.measurement) == null ? void 0 : et.abbrev) ?? null,
1313
+ baseUnit: n.unit.abbrev,
1305
1314
  baseUnitAmount: 0,
1306
1315
  systemBalance: Q,
1307
1316
  physicalBalance: 0,
1308
1317
  adjustedAmount: -Q,
1309
1318
  adjustedDiffPercentage: -100,
1310
- isTemplateItem: !l[c._id],
1319
+ isTemplateItem: !c[n._id],
1311
1320
  costPerUnit: A,
1312
1321
  opening: E,
1313
1322
  varianceQty: oe,
1314
1323
  varianceRM: ue,
1315
1324
  stockTakeValue: Me,
1316
- systemValue: bt,
1325
+ systemValue: xt,
1317
1326
  adjustmentAmounts: ce
1318
1327
  };
1319
1328
  }
1320
- const ne = mt(i), je = (et = (Xe = $.value) == null ? void 0 : Xe.find(
1321
- (Q) => Q.id === c._id
1322
- )) == null ? void 0 : et.balance, j = rt(
1323
- je ?? ne,
1329
+ const ne = yt(u), Ce = (at = (tt = $.value) == null ? void 0 : tt.find(
1330
+ (Q) => Q.id === n._id
1331
+ )) == null ? void 0 : at.balance, C = ut(
1332
+ Ce ?? ne,
1324
1333
  g
1325
- ), K = g.amount === 0 ? null : lt(j, {
1334
+ ), K = g.amount === 0 ? null : dt(C, {
1326
1335
  ...g,
1327
1336
  amount: Math.abs(g.amount)
1328
- }), q = K ? Qe(K, B) : null, ie = +N(g), _e = +N(ne), $e = ie - _e, vt = $e * A, yt = _e * A, gt = ie * A;
1337
+ }), q = K ? Qe(K, B) : null, ie = +N(g), _e = +N(ne), $e = ie - _e, kt = $e * A, ht = _e * A, At = ie * A;
1329
1338
  return {
1330
- id: c._id,
1331
- code: c.code,
1332
- name: c.name,
1333
- baseUnit: c.unit.abbrev,
1334
- baseUnitAmount: +N(i.baseAmount),
1335
- ...i.measurementsAmounts.filter((Q) => {
1339
+ id: n._id,
1340
+ code: n.code,
1341
+ name: n.name,
1342
+ costUnit: ((ot = (nt = n.defaultCost) == null ? void 0 : nt.measurement) == null ? void 0 : ot.abbrev) ?? null,
1343
+ baseUnit: n.unit.abbrev,
1344
+ baseUnitAmount: +N(u.baseAmount),
1345
+ ...u.measurementsAmounts.filter((Q) => {
1336
1346
  var oe, ue, Me;
1337
- return (Me = (ue = (oe = W.value) == null ? void 0 : oe.get(c._id)) == null ? void 0 : ue[0]) == null ? void 0 : Me.includes(Q.measurement.id);
1347
+ 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);
1338
1348
  }).reduce((Q, oe, ue) => (Q[`measurementAbbrev${ue}`] = `(${oe.measurement.abbrev}) × ${N(oe.measurement.conversion)}`, Q[`measurementAmount${ue}`] = +N(oe.amount), Q), {}),
1339
1349
  systemBalance: ie,
1340
1350
  physicalBalance: _e,
1341
- adjustedAmount: +N(j),
1342
- adjustedDiffPercentage: q ? +N(ct(q, 2)) : null,
1343
- isTemplateItem: !l[c._id],
1351
+ adjustedAmount: +N(C),
1352
+ adjustedDiffPercentage: q ? +N(mt(q, 2)) : null,
1353
+ isTemplateItem: !c[n._id],
1344
1354
  costPerUnit: A,
1345
1355
  opening: E,
1346
1356
  varianceQty: $e,
1347
- varianceRM: vt,
1348
- stockTakeValue: yt,
1349
- systemValue: gt,
1357
+ varianceRM: kt,
1358
+ stockTakeValue: ht,
1359
+ systemValue: At,
1350
1360
  adjustmentAmounts: ce
1351
1361
  };
1352
- }).filter((c) => !!(c.isTemplateItem && D.value.templateItem || !c.isTemplateItem && D.value.nonTemplateItem));
1362
+ }).filter((n) => !!(n.isTemplateItem && D.value.templateItem || !n.isTemplateItem && D.value.nonTemplateItem));
1353
1363
  }), Fe = V(() => {
1354
- var t, d, u, c;
1364
+ var t, d, i, n;
1355
1365
  if (!e.draft) return [];
1356
- const l = e.draft.approvedAt ? {
1366
+ const c = e.draft.approvedAt ? {
1357
1367
  action: `Approve at ${ve(e.draft.approvedAt)}`,
1358
1368
  // actionAt: props.draft.approvedAt,
1359
1369
  actionBy: e.draft.approvedBy,
1360
1370
  remark: e.draft.approveRemark
1361
- } : (t = e.draft.rejectionHistory) == null ? void 0 : t.computeFirst((i) => ({
1362
- action: `Reject at ${ve(i.rejectedAt)}`,
1371
+ } : (t = e.draft.rejectionHistory) == null ? void 0 : t.computeFirst((u) => ({
1372
+ action: `Reject at ${ve(u.rejectedAt)}`,
1363
1373
  // actionAt: e.rejectedAt,
1364
- actionBy: i.rejectedBy,
1365
- remark: i.rejectRemark
1374
+ actionBy: u.rejectedBy,
1375
+ remark: u.rejectRemark
1366
1376
  }));
1367
1377
  return [
1368
1378
  {
@@ -1387,25 +1397,25 @@ const sa = ut(
1387
1397
  },
1388
1398
  {
1389
1399
  label: "Using template",
1390
- value: ((u = e.draft.usingTemplates.find((i) => i)) == null ? void 0 : u.name) ?? "None"
1400
+ value: ((i = e.draft.usingTemplates.find((u) => u)) == null ? void 0 : i.name) ?? "None"
1391
1401
  },
1392
1402
  e.draft.remark ? {
1393
1403
  label: "Remark",
1394
1404
  value: e.draft.remark
1395
1405
  } : null,
1396
- l ? {
1406
+ c ? {
1397
1407
  label: "Last action",
1398
- value: l.action
1408
+ value: c.action
1399
1409
  } : null,
1400
- l && l.actionBy ? {
1410
+ c && c.actionBy ? {
1401
1411
  label: "Last action by",
1402
- value: (c = l.actionBy) == null ? void 0 : c.name
1412
+ value: (n = c.actionBy) == null ? void 0 : n.name
1403
1413
  } : null,
1404
- l && l.remark ? {
1414
+ c && c.remark ? {
1405
1415
  label: "Action remark",
1406
- value: l.remark
1416
+ value: c.remark
1407
1417
  } : null
1408
- ].filter((i) => i).map((i) => i);
1418
+ ].filter((u) => u).map((u) => u);
1409
1419
  }), xe = [
1410
1420
  {
1411
1421
  label: "Overview",
@@ -1416,28 +1426,28 @@ const sa = ut(
1416
1426
  value: "history"
1417
1427
  }
1418
1428
  ], le = H(xe[0]), me = V(() => {
1419
- var u, c, i;
1420
- const l = ((u = e.draft) == null ? void 0 : u.activityLogs) ?? [], t = ((c = e.draft) == null ? void 0 : c.rejectionHistory) ?? [];
1429
+ var i, n, u;
1430
+ const c = ((i = e.draft) == null ? void 0 : i.activityLogs) ?? [], t = ((n = e.draft) == null ? void 0 : n.rejectionHistory) ?? [];
1421
1431
  for (const g of t)
1422
- l.find(
1432
+ c.find(
1423
1433
  (b) => `${b.action}_${b.performedAt}` == `${z.enum.rejectDraft}_${g.rejectedAt}`
1424
- ) || l.push({
1434
+ ) || c.push({
1425
1435
  action: z.enum.rejectDraft,
1426
1436
  performedAt: g.rejectedAt,
1427
1437
  performedBy: g.rejectedBy,
1428
1438
  remark: g.rejectRemark
1429
1439
  });
1430
- return (i = e.draft) != null && i.approvedAt && (l.find(
1440
+ return (u = e.draft) != null && u.approvedAt && (c.find(
1431
1441
  (A) => {
1432
1442
  var b;
1433
1443
  return `${A.action}_${A.performedAt}` == `${z.enum.approveDraft}_${(b = e.draft) == null ? void 0 : b.approvedAt}`;
1434
1444
  }
1435
- ) || l.push({
1445
+ ) || c.push({
1436
1446
  action: z.enum.approveDraft,
1437
1447
  performedAt: e.draft.approvedAt,
1438
1448
  performedBy: e.draft.approvedBy ?? { name: "Unknown", id: "unknown" },
1439
1449
  remark: e.draft.approveRemark
1440
- })), l.sort((g, A) => new Date(A.performedAt).getTime() - new Date(g.performedAt).getTime()).map(
1450
+ })), c.sort((g, A) => new Date(A.performedAt).getTime() - new Date(g.performedAt).getTime()).map(
1441
1451
  (g) => ({
1442
1452
  header: Ue(g.action),
1443
1453
  date: ve(g.performedAt),
@@ -1454,30 +1464,30 @@ const sa = ut(
1454
1464
  })
1455
1465
  );
1456
1466
  }), Te = V(() => {
1457
- var c, i, g, A;
1458
- if ((c = e == null ? void 0 : e.draft) != null && c.approvedAt) return "Draft is already approved.";
1459
- if (((i = e.draft) == null ? void 0 : i.status) !== pe.enum.DRAFT) return "Status is not draft.";
1460
- const l = 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)), u = t.filter((b) => !d.has(b)).length;
1467
+ var n, u, g, A;
1468
+ if ((n = e == null ? void 0 : e.draft) != null && n.approvedAt) return "Draft is already approved.";
1469
+ if (((u = e.draft) == null ? void 0 : u.status) !== pe.enum.DRAFT) return "Status is not draft.";
1470
+ 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;
1461
1471
  return [
1462
- l ? "Negative total exist." : null,
1463
- u ? "Negative stock is not included in this draft. Reopen draft in POS and apply changes." : null
1472
+ c ? "Negative total exist." : null,
1473
+ i ? "Negative stock is not included in this draft. Reopen draft in POS and apply changes." : null
1464
1474
  ].filter((b) => b).join(" ");
1465
1475
  });
1466
- return (l, t) => {
1467
- const d = U("FmButtonGroup"), u = U("FmMenuDivider"), c = U("FmCard"), i = U("FmButton"), g = U("FmCircularProgress"), A = U("FmChip"), b = U("FmTextField"), E = U("FmIcon"), ae = U("FmTable"), ce = U("FmSpacer"), ne = U("FmTooltip"), je = U("FmSideSheet");
1468
- return C(), se(je, {
1476
+ return (c, t) => {
1477
+ 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");
1478
+ return j(), se(Ce, {
1469
1479
  "dismiss-away": "",
1470
1480
  "max-width": 9999,
1471
1481
  "model-value": F(w),
1472
- "onUpdate:modelValue": t[10] || (t[10] = (j) => at(w) ? w.value = j : null),
1482
+ "onUpdate:modelValue": t[10] || (t[10] = (C) => rt(w) ? w.value = C : null),
1473
1483
  header: "Closing details"
1474
1484
  }, {
1475
1485
  "side-sheet-footer": G(() => {
1476
- var j, K, q, ie;
1486
+ var C, K, q, ie;
1477
1487
  return [
1478
- s("div", Ea, [
1479
- ((j = e.draft) == null ? void 0 : j.status) === F(pe).enum.DRAFT ? (C(), L(ee, { key: 0 }, [
1480
- Te.value ? (C(), se(ne, {
1488
+ r("div", Oa, [
1489
+ ((C = e.draft) == null ? void 0 : C.status) === F(pe).enum.DRAFT ? (j(), L(ee, { key: 0 }, [
1490
+ Te.value ? (j(), se(ne, {
1481
1491
  key: 0,
1482
1492
  "z-index": 51
1483
1493
  }, {
@@ -1485,7 +1495,7 @@ const sa = ut(
1485
1495
  X(J(Te.value), 1)
1486
1496
  ]),
1487
1497
  default: G(() => [
1488
- x(i, {
1498
+ x(u, {
1489
1499
  disabled: "",
1490
1500
  key: "approve key",
1491
1501
  label: "Approve",
@@ -1493,19 +1503,19 @@ const sa = ut(
1493
1503
  })
1494
1504
  ]),
1495
1505
  _: 1
1496
- })) : (C(), se(i, {
1506
+ })) : (j(), se(u, {
1497
1507
  key: "approve key",
1498
1508
  label: "Approve",
1499
1509
  onClick: t[6] || (t[6] = () => e.draft && F(p).approveDraft(e.draft, () => h("submitted")))
1500
1510
  }))
1501
1511
  ], 64)) : de("", !0),
1502
- ((K = e.draft) == null ? void 0 : K.status) === F(pe).enum.DRAFT ? (C(), se(i, {
1512
+ ((K = e.draft) == null ? void 0 : K.status) === F(pe).enum.DRAFT ? (j(), se(u, {
1503
1513
  key: 1,
1504
1514
  label: "Reject",
1505
1515
  variant: "destructive",
1506
1516
  onClick: t[7] || (t[7] = () => e.draft && F(p).rejectDraft(e.draft, () => h("submitted")))
1507
1517
  })) : de("", !0),
1508
- (q = e.draft) != null && q.approvedAt && ((ie = e.draft) == null ? void 0 : ie.status) !== F(pe).enum.COMPLETED ? (C(), se(i, {
1518
+ (q = e.draft) != null && q.approvedAt && ((ie = e.draft) == null ? void 0 : ie.status) !== F(pe).enum.COMPLETED ? (j(), se(u, {
1509
1519
  key: 2,
1510
1520
  label: "Sync",
1511
1521
  loading: S.value,
@@ -1515,7 +1525,7 @@ const sa = ut(
1515
1525
  }));
1516
1526
  })
1517
1527
  }, null, 8, ["loading"])) : de("", !0),
1518
- x(i, {
1528
+ x(u, {
1519
1529
  label: "Close",
1520
1530
  variant: "tertiary",
1521
1531
  onClick: t[9] || (t[9] = (_e) => w.value = !1)
@@ -1524,51 +1534,51 @@ const sa = ut(
1524
1534
  ];
1525
1535
  }),
1526
1536
  default: G(() => [
1527
- s("div", ra, [
1528
- s("div", null, [
1537
+ r("div", ua, [
1538
+ r("div", null, [
1529
1539
  x(d, {
1530
1540
  items: xe,
1531
1541
  modelValue: le.value,
1532
- "onUpdate:modelValue": t[0] || (t[0] = (j) => le.value = j)
1542
+ "onUpdate:modelValue": t[0] || (t[0] = (C) => le.value = C)
1533
1543
  }, null, 8, ["modelValue"])
1534
1544
  ]),
1535
- le.value.value === "overview" ? (C(), L(ee, { key: 0 }, [
1536
- x(c, {
1545
+ le.value.value === "overview" ? (j(), L(ee, { key: 0 }, [
1546
+ x(n, {
1537
1547
  variant: "outlined",
1538
1548
  class: "flex flex-col gap-8 px-12 py-16"
1539
1549
  }, {
1540
1550
  default: G(() => {
1541
- var j, K;
1551
+ var C, K;
1542
1552
  return [
1543
- s("div", la, [
1544
- t[11] || (t[11] = s("div", { class: "fm-typo-en-body-lg-600" }, "Closing summary", -1)),
1545
- s("div", ca, [
1546
- s("div", {
1547
- class: De(["fm-status-badge", F(Le)(((j = l.draft) == null ? void 0 : j.status) ?? "DRAFT")])
1548
- }, J(F(Ue)(((K = l.draft) == null ? void 0 : K.status) ?? "")), 3)
1553
+ r("div", da, [
1554
+ t[11] || (t[11] = r("div", { class: "fm-typo-en-body-lg-600" }, "Closing summary", -1)),
1555
+ r("div", ma, [
1556
+ r("div", {
1557
+ class: De(["fm-status-badge", F(Le)(((C = c.draft) == null ? void 0 : C.status) ?? "DRAFT")])
1558
+ }, J(F(Ue)(((K = c.draft) == null ? void 0 : K.status) ?? "")), 3)
1549
1559
  ])
1550
1560
  ]),
1551
- x(u),
1552
- s("div", ia, [
1553
- (C(!0), L(ee, null, Ce(Fe.value, (q, ie) => (C(), L("div", {
1561
+ x(i),
1562
+ r("div", fa, [
1563
+ (j(!0), L(ee, null, je(Fe.value, (q, ie) => (j(), L("div", {
1554
1564
  class: "flex flex-col gap-4",
1555
1565
  key: ie
1556
1566
  }, [
1557
- s("div", ua, [
1558
- s("div", da, J(q.label), 1)
1567
+ r("div", pa, [
1568
+ r("div", va, J(q.label), 1)
1559
1569
  ]),
1560
- s("div", ma, J(q.value), 1)
1570
+ r("div", ya, J(q.value), 1)
1561
1571
  ]))), 128))
1562
1572
  ])
1563
1573
  ];
1564
1574
  }),
1565
1575
  _: 1
1566
1576
  }),
1567
- s("div", fa, [
1568
- s("div", pa, [
1569
- t[12] || (t[12] = s("div", { class: "flex-1 fm-typo-en-title-sm-600 text-fm-color-typo-primary" }, " Closing items ", -1)),
1570
- v.value ? de("", !0) : (C(), L("div", va, [
1571
- l.draft && l.draft.status !== F(pe).enum.COMPLETED ? (C(), se(i, {
1577
+ r("div", ga, [
1578
+ r("div", ba, [
1579
+ t[12] || (t[12] = r("div", { class: "flex-1 fm-typo-en-title-sm-600 text-fm-color-typo-primary" }, " Closing items ", -1)),
1580
+ v.value ? de("", !0) : (j(), L("div", ka, [
1581
+ c.draft && c.draft.status !== F(pe).enum.COMPLETED ? (j(), se(u, {
1572
1582
  key: 0,
1573
1583
  label: "Refresh balance",
1574
1584
  "prepend-icon": "refresh",
@@ -1579,81 +1589,81 @@ const sa = ut(
1579
1589
  loading: R.value,
1580
1590
  onClick: be
1581
1591
  }, null, 8, ["loading"])) : de("", !0),
1582
- x(i, {
1592
+ x(u, {
1583
1593
  label: "Export data",
1584
1594
  "prepend-icon": "download",
1585
1595
  variant: "secondary",
1586
1596
  "text-color": "primary",
1587
1597
  "bg-color": "transparent",
1588
1598
  "border-color": "primary",
1589
- onClick: t[1] || (t[1] = (j) => l.draft ? F(p).exportDraft(
1590
- l.draft,
1599
+ onClick: t[1] || (t[1] = (C) => c.draft ? F(p).exportDraft(
1600
+ c.draft,
1591
1601
  k.value,
1592
1602
  $.value
1593
1603
  ) : null)
1594
1604
  })
1595
1605
  ]))
1596
1606
  ]),
1597
- v.value ? (C(), L("div", ya, [
1598
- t[14] || (t[14] = s("div", { class: "h-80" }, null, -1)),
1599
- s("div", ga, [
1600
- s("div", null, [
1607
+ v.value ? (j(), L("div", ha, [
1608
+ t[14] || (t[14] = r("div", { class: "h-80" }, null, -1)),
1609
+ r("div", Aa, [
1610
+ r("div", null, [
1601
1611
  x(g, { size: "md" })
1602
1612
  ]),
1603
- t[13] || (t[13] = s("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, " Fetching info... ", -1))
1613
+ t[13] || (t[13] = r("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, " Fetching info... ", -1))
1604
1614
  ]),
1605
- t[15] || (t[15] = s("div", { class: "h-80" }, null, -1))
1606
- ])) : (C(), L(ee, { key: 1 }, [
1607
- s("div", ba, [
1608
- s("div", ka, [
1615
+ t[15] || (t[15] = r("div", { class: "h-80" }, null, -1))
1616
+ ])) : (j(), L(ee, { key: 1 }, [
1617
+ r("div", xa, [
1618
+ r("div", _a, [
1609
1619
  x(A, {
1610
1620
  label: "Template Item(s)",
1611
1621
  selected: D.value.templateItem,
1612
- onClick: t[2] || (t[2] = (j) => D.value.templateItem = !D.value.templateItem)
1622
+ onClick: t[2] || (t[2] = (C) => D.value.templateItem = !D.value.templateItem)
1613
1623
  }, null, 8, ["selected"]),
1614
1624
  x(A, {
1615
1625
  label: "Non-template Item(s)",
1616
1626
  selected: D.value.nonTemplateItem,
1617
- onClick: t[3] || (t[3] = (j) => D.value.nonTemplateItem = !D.value.nonTemplateItem)
1627
+ onClick: t[3] || (t[3] = (C) => D.value.nonTemplateItem = !D.value.nonTemplateItem)
1618
1628
  }, null, 8, ["selected"])
1619
1629
  ]),
1620
1630
  x(b, {
1621
1631
  modelValue: Ae.value,
1622
- "onUpdate:modelValue": t[4] || (t[4] = (j) => Ae.value = j),
1632
+ "onUpdate:modelValue": t[4] || (t[4] = (C) => Ae.value = C),
1623
1633
  placeholder: "Filter items"
1624
1634
  }, null, 8, ["modelValue"])
1625
1635
  ]),
1626
- F(_).skuTags.size ? (C(), L("div", ha, [
1627
- (C(!0), L(ee, null, Ce(F(_).skuTags.keys(), (j) => (C(), se(A, {
1628
- key: `${j}`,
1629
- label: `${j}`,
1636
+ F(_).skuTags.size ? (j(), L("div", Da, [
1637
+ (j(!0), L(ee, null, je(F(_).skuTags.keys(), (C) => (j(), se(A, {
1638
+ key: `${C}`,
1639
+ label: `${C}`,
1630
1640
  selectable: "",
1631
- selected: f[`${j}`],
1632
- onClick: (K) => f[`${j}`] = !f[`${j}`]
1641
+ selected: f[`${C}`],
1642
+ onClick: (K) => f[`${C}`] = !f[`${C}`]
1633
1643
  }, {
1634
1644
  default: G(() => [
1635
- f[`${j}`] ? (C(), se(E, {
1645
+ f[`${C}`] ? (j(), se(E, {
1636
1646
  key: 0,
1637
1647
  name: "check",
1638
1648
  class: "text-white",
1639
1649
  size: "sm"
1640
1650
  })) : de("", !0),
1641
- s("span", {
1651
+ r("span", {
1642
1652
  class: De([
1643
1653
  "",
1644
1654
  {
1645
- "text-white fm-typo-en-body-md-600": f[`${j}`],
1646
- "text-fm-color-typo-primary fm-typo-en-body-md-400": !f[`${j}`]
1655
+ "text-white fm-typo-en-body-md-600": f[`${C}`],
1656
+ "text-fm-color-typo-primary fm-typo-en-body-md-400": !f[`${C}`]
1647
1657
  }
1648
1658
  ])
1649
- }, J(j), 3)
1659
+ }, J(C), 3)
1650
1660
  ]),
1651
1661
  _: 2
1652
1662
  }, 1032, ["label", "selected", "onClick"]))), 128))
1653
1663
  ])) : de("", !0),
1654
- s("div", Aa, [
1655
- s("div", {
1656
- style: nt({ minWidth: `${he.value}px` })
1664
+ r("div", wa, [
1665
+ r("div", {
1666
+ style: lt({ minWidth: `${he.value}px` })
1657
1667
  }, [
1658
1668
  x(ae, {
1659
1669
  "column-defs": we.value,
@@ -1665,13 +1675,13 @@ const sa = ut(
1665
1675
  ], 64))
1666
1676
  ])
1667
1677
  ], 64)) : de("", !0),
1668
- le.value.value === "history" ? (C(), L("div", xa, [
1669
- me.value.length ? (C(), L("div", wa, [
1670
- (C(!0), L(ee, null, Ce(me.value, (j, K) => (C(), L(ee, { key: K }, [
1671
- s("div", Sa, [
1672
- s("div", ja, [
1673
- s("div", Ca, [
1674
- s("div", {
1678
+ le.value.value === "history" ? (j(), L("div", Sa, [
1679
+ me.value.length ? (j(), L("div", Ba, [
1680
+ (j(!0), L(ee, null, je(me.value, (C, K) => (j(), L(ee, { key: K }, [
1681
+ r("div", Fa, [
1682
+ r("div", Ta, [
1683
+ r("div", $a, [
1684
+ r("div", {
1675
1685
  class: De([
1676
1686
  {
1677
1687
  "bg-fm-color-primary": K !== 0,
@@ -1681,9 +1691,9 @@ const sa = ut(
1681
1691
  ])
1682
1692
  }, null, 2)
1683
1693
  ]),
1684
- t[18] || (t[18] = s("div", { class: "h-24 w-24 bg-fm-color-primary rounded-full" }, null, -1)),
1685
- s("div", Ba, [
1686
- s("div", {
1694
+ t[18] || (t[18] = r("div", { class: "h-24 w-24 bg-fm-color-primary rounded-full" }, null, -1)),
1695
+ r("div", Ma, [
1696
+ r("div", {
1687
1697
  class: De([
1688
1698
  {
1689
1699
  "bg-fm-color-primary": K < me.value.length - 1,
@@ -1694,15 +1704,15 @@ const sa = ut(
1694
1704
  }, null, 2)
1695
1705
  ])
1696
1706
  ]),
1697
- s("div", Fa, [
1698
- s("div", Ta, J(j.header), 1),
1699
- s("div", $a, J(j.date), 1)
1707
+ r("div", Ra, [
1708
+ r("div", Ia, J(C.header), 1),
1709
+ r("div", Pa, J(C.date), 1)
1700
1710
  ])
1701
1711
  ]),
1702
- s("div", Ma, [
1703
- s("div", Ra, [
1704
- s("div", Ia, [
1705
- s("div", {
1712
+ r("div", Va, [
1713
+ r("div", Ua, [
1714
+ r("div", La, [
1715
+ r("div", {
1706
1716
  class: De([
1707
1717
  {
1708
1718
  "bg-fm-color-primary": K < me.value.length - 1,
@@ -1713,20 +1723,20 @@ const sa = ut(
1713
1723
  }, null, 2)
1714
1724
  ])
1715
1725
  ]),
1716
- s("div", Pa, [
1717
- x(c, {
1726
+ r("div", Ea, [
1727
+ x(n, {
1718
1728
  variant: "outlined",
1719
1729
  class: "py-12 px-16"
1720
1730
  }, {
1721
1731
  default: G(() => [
1722
- s("div", Va, [
1723
- (C(!0), L(ee, null, Ce(j.info, (q, ie) => (C(), L("div", {
1732
+ r("div", Ha, [
1733
+ (j(!0), L(ee, null, je(C.info, (q, ie) => (j(), L("div", {
1724
1734
  key: ie,
1725
1735
  class: "flex flex-col gap-4"
1726
1736
  }, [
1727
- s("div", Ua, J(q == null ? void 0 : q.label), 1),
1728
- s("div", La, [
1729
- (C(!0), L(ee, null, Ce(q == null ? void 0 : q.values, (_e, $e) => (C(), L("div", {
1737
+ r("div", za, J(q == null ? void 0 : q.label), 1),
1738
+ r("div", Na, [
1739
+ (j(!0), L(ee, null, je(q == null ? void 0 : q.values, (_e, $e) => (j(), L("div", {
1730
1740
  key: $e,
1731
1741
  class: "fm-typo-en-body-lg-600"
1732
1742
  }, J(_e), 1))), 128))
@@ -1739,16 +1749,16 @@ const sa = ut(
1739
1749
  ])
1740
1750
  ])
1741
1751
  ], 64))), 128))
1742
- ])) : (C(), L("div", _a, [
1752
+ ])) : (j(), L("div", Ca, [
1743
1753
  x(ce),
1744
- s("div", null, [
1745
- s("img", {
1746
- src: F(Nt),
1754
+ r("div", null, [
1755
+ r("img", {
1756
+ src: F(Qt),
1747
1757
  alt: "List is empty"
1748
- }, null, 8, Da)
1758
+ }, null, 8, ja)
1749
1759
  ]),
1750
- t[16] || (t[16] = s("div", { class: "fm-typo-en-body-lg-600" }, J("No records found"), -1)),
1751
- t[17] || (t[17] = s("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)),
1760
+ t[16] || (t[16] = r("div", { class: "fm-typo-en-body-lg-600" }, J("No records found"), -1)),
1761
+ 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)),
1752
1762
  x(ce),
1753
1763
  x(ce)
1754
1764
  ]))
@@ -1759,13 +1769,13 @@ const sa = ut(
1759
1769
  }, 8, ["model-value"]);
1760
1770
  };
1761
1771
  }
1762
- }), Na = { class: "flex-1 flex flex-col gap-8" }, Oa = { class: "flex flex-col" }, Ka = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ya = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, Qa = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary line-clamp-2" }, Ga = { class: "fm-typo-en-body-lg-400 line-clamp-2" }, on = /* @__PURE__ */ He({
1772
+ }), 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" }, cn = /* @__PURE__ */ He({
1763
1773
  __name: "ClosingDraftView",
1764
- setup(n) {
1765
- const { t: r } = it(), { viewDraft: e } = Ee(), { viewClosingDraftProps: m, viewClosingDraftShow: p } = zt(Ee()), w = ze(), v = sa(), R = Rt(), { breakpoints: S } = Ht();
1774
+ setup(o) {
1775
+ const { t: l } = ft(), { viewDraft: e } = Ee(), { viewClosingDraftProps: m, viewClosingDraftShow: p } = Yt(Ee()), w = ze(), v = ia(), R = Ut(), { breakpoints: S } = Kt();
1766
1776
  w.watchLocation(v.fetchDrafts);
1767
1777
  const k = V(() => v.loading), $ = H(""), P = V(() => S.value.xs || S.value.sm), I = V(() => P.value ? 10 : 20);
1768
- function o(O) {
1778
+ function s(O) {
1769
1779
  switch (O) {
1770
1780
  case "refresh":
1771
1781
  return v.fetchDrafts();
@@ -1776,27 +1786,27 @@ const sa = ut(
1776
1786
  }
1777
1787
  const _ = V(() => P.value ? [
1778
1788
  {
1779
- label: r("inventory.common.refresh"),
1789
+ label: l("inventory.common.refresh"),
1780
1790
  value: "refresh",
1781
1791
  isPrimary: !1
1782
1792
  }
1783
1793
  ] : [
1784
1794
  {
1785
- label: r("inventory.common.refresh"),
1795
+ label: l("inventory.common.refresh"),
1786
1796
  value: "refresh",
1787
1797
  isPrimary: !1
1788
1798
  }
1789
1799
  ]);
1790
1800
  return (O, f) => {
1791
1801
  const y = U("FmTable");
1792
- return C(), L(ee, null, [
1793
- x(It, {
1794
- title: F(r)("inventory.closing.draft.title"),
1802
+ return j(), L(ee, null, [
1803
+ x(Lt, {
1804
+ title: F(l)("inventory.closing.draft.title"),
1795
1805
  actions: _.value,
1796
- "onClick:action": o
1806
+ "onClick:action": s
1797
1807
  }, {
1798
1808
  default: G(() => [
1799
- s("div", {
1809
+ r("div", {
1800
1810
  class: De([
1801
1811
  "flex flex-col gap-8 max-h-full",
1802
1812
  {
@@ -1805,14 +1815,14 @@ const sa = ut(
1805
1815
  }
1806
1816
  ])
1807
1817
  }, [
1808
- x(Pt, {
1818
+ x(Et, {
1809
1819
  "change-location": "",
1810
1820
  searchable: "",
1811
1821
  search: $.value,
1812
1822
  "onUpdate:search": f[0] || (f[0] = (h) => $.value = h)
1813
1823
  }, null, 8, ["search"]),
1814
1824
  x(y, {
1815
- style: nt(F(R).tableHeight),
1825
+ style: lt(F(R).tableHeight),
1816
1826
  "column-defs": F(v).columnDefs,
1817
1827
  "row-data": F(v).drafts,
1818
1828
  "search-value": $.value,
@@ -1821,39 +1831,39 @@ const sa = ut(
1821
1831
  "page-size": I.value
1822
1832
  }, {
1823
1833
  "list-row": G((h) => [
1824
- x(Vt, {
1834
+ x(Ht, {
1825
1835
  row: h,
1826
1836
  onRowClick: (D) => F(e)(D)
1827
1837
  }, {
1828
1838
  default: G((D) => {
1829
1839
  var M, Z, W, re, B, te, be, ke, fe, ye, ge, Y, we, he, Ae, Se, Fe, xe, le, me;
1830
1840
  return [
1831
- s("div", Na, [
1832
- s("div", Oa, [
1833
- s("div", Ka, [
1841
+ r("div", Qa, [
1842
+ r("div", Ga, [
1843
+ r("div", Wa, [
1834
1844
  x(F(Pe), {
1835
1845
  render: (W = (Z = (M = D._id) == null ? void 0 : M.column) == null ? void 0 : Z.columnDef) == null ? void 0 : W.cell,
1836
1846
  props: (B = (re = D._id) == null ? void 0 : re.getContext) == null ? void 0 : B.call(re)
1837
1847
  }, null, 8, ["render", "props"])
1838
1848
  ]),
1839
- s("div", Ya, [
1849
+ r("div", qa, [
1840
1850
  x(F(Pe), {
1841
1851
  render: (ke = (be = (te = D.name) == null ? void 0 : te.column) == null ? void 0 : be.columnDef) == null ? void 0 : ke.cell,
1842
1852
  props: (ye = (fe = D.name) == null ? void 0 : fe.getContext) == null ? void 0 : ye.call(fe)
1843
1853
  }, null, 8, ["render", "props"])
1844
1854
  ]),
1845
- s("div", Qa, J([
1855
+ r("div", Za, J([
1846
1856
  ...h.original.items.slice(0, 3).map((Te) => Te.sku.name),
1847
1857
  ...h.original.items.length >= 3 ? [`and ${h.original.items.length - 3} more items`] : []
1848
1858
  ].join(", ")), 1),
1849
- s("div", Ga, [
1859
+ r("div", Ja, [
1850
1860
  x(F(Pe), {
1851
1861
  render: (we = (Y = (ge = D.ref) == null ? void 0 : ge.column) == null ? void 0 : Y.columnDef) == null ? void 0 : we.cell,
1852
1862
  props: (Ae = (he = D.ref) == null ? void 0 : he.getContext) == null ? void 0 : Ae.call(he)
1853
1863
  }, null, 8, ["render", "props"])
1854
1864
  ])
1855
1865
  ]),
1856
- s("div", null, [
1866
+ r("div", null, [
1857
1867
  x(F(Pe), {
1858
1868
  render: (xe = (Fe = (Se = D.status) == null ? void 0 : Se.column) == null ? void 0 : Fe.columnDef) == null ? void 0 : xe.cell,
1859
1869
  props: (me = (le = D.status) == null ? void 0 : le.getContext) == null ? void 0 : me.call(le)
@@ -1871,10 +1881,10 @@ const sa = ut(
1871
1881
  ]),
1872
1882
  _: 1
1873
1883
  }, 8, ["title", "actions"]),
1874
- (C(), se(At, { to: "body" }, [
1875
- x(za, xt(F(m), {
1884
+ (j(), se(wt, { to: "body" }, [
1885
+ x(Ya, St(F(m), {
1876
1886
  show: F(p),
1877
- "onUpdate:show": f[2] || (f[2] = (h) => at(p) ? p.value = h : null),
1887
+ "onUpdate:show": f[2] || (f[2] = (h) => rt(p) ? p.value = h : null),
1878
1888
  onSubmitted: f[3] || (f[3] = () => (p.value = !1, F(v).fetchDrafts())),
1879
1889
  onRefresh: f[4] || (f[4] = (h) => F(v).updateDraftRef(h))
1880
1890
  }), null, 16, ["show"])
@@ -1884,5 +1894,5 @@ const sa = ut(
1884
1894
  }
1885
1895
  });
1886
1896
  export {
1887
- on as default
1897
+ cn as default
1888
1898
  };