@feedmepos/mf-inventory-portal 1.2.25-dev.6 → 1.2.26

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 (48) hide show
  1. package/dist/{App-XTZXPNvj.js → App-DPWPePDs.js} +1 -1
  2. package/dist/{ApprovalView-BxSSI22z.js → ApprovalView-B11j1iq7.js} +2 -2
  3. package/dist/{BindingsDialog-DNc9hLdV.js → BindingsDialog-C5MYJ3Jv.js} +2 -2
  4. package/dist/{BindingsPicker-CxXxfj9T.js → BindingsPicker-2Urvd2_k.js} +1 -1
  5. package/dist/{BindingsTable-Btb348tg.js → BindingsTable-CsoxQAtZ.js} +1 -1
  6. package/dist/{ClosingDraftView-CSTykijP.js → ClosingDraftView-BqZkAqFU.js} +521 -502
  7. package/dist/{ClosingHistoryView-BYiVhWxC.js → ClosingHistoryView-AHTYxrq8.js} +2 -2
  8. package/dist/{ClosingTemplateView-C4cqNEH9.js → ClosingTemplateView-293Z2vbh.js} +2 -2
  9. package/dist/{DeliveryOrderPrintPreview-DOA_kGIs.js → DeliveryOrderPrintPreview-C1XFdLH4.js} +1 -1
  10. package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-C_HE38Gy.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-twX7qUdT.js} +3 -3
  11. package/dist/{FmMultiselectDialog-B-6gCWkR.js → FmMultiselectDialog-CZ7XTZls.js} +1 -1
  12. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-DIJtb6kQ.js → FmUnitInput.vue_vue_type_script_setup_true_lang-ezKgTjVr.js} +1 -1
  13. package/dist/{ImportView-CZotI5Z3.js → ImportView-C5rAMFpn.js} +2 -2
  14. package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-uXnVeBfZ.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-BpOZHYxx.js} +1 -1
  15. package/dist/{IngredientGroupView-CwaEyLWd.js → IngredientGroupView-Dpdiv-Bm.js} +2 -2
  16. package/dist/{IngredientsView-DYGTSluF.js → IngredientsView-ByaSyrOC.js} +7 -7
  17. package/dist/{IntegrationView-BsC8Tso0.js → IntegrationView-DtK_QcIr.js} +3 -3
  18. package/dist/{InventoryBindingForm-BBeR76cI.js → InventoryBindingForm-Dz_Zd3-I.js} +1 -1
  19. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-qt9zx8EX.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-BekOkiyz.js} +3 -3
  20. package/dist/{InventoryBindingSummary-fFpbPy3o.js → InventoryBindingSummary-C6NPyThG.js} +1 -1
  21. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-CGEHcEXf.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DqtwxjUK.js} +1 -1
  22. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-DN_Tg3Ag.js → PremiumBadge.vue_vue_type_script_setup_true_lang-BuSgeMSz.js} +1 -1
  23. package/dist/{PublishView-COp7msuu.js → PublishView-C_n1VAQZ.js} +1 -1
  24. package/dist/{PurchaseOrderPrintPreview-DlOMlnor.js → PurchaseOrderPrintPreview-CbCxKLFR.js} +1 -1
  25. package/dist/{ReceiveRequestView-Dg7TOM7K.js → ReceiveRequestView-RZtPnFRM.js} +8 -8
  26. package/dist/{RecipeView-D5Fg8pPh.js → RecipeView-CG1EDuM2.js} +3 -3
  27. package/dist/{StockView-dx_7MrQr.js → StockView-DocheY2H.js} +8 -8
  28. package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-Cv7LwHDM.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-B_G1Xn3r.js} +1 -1
  29. package/dist/{SupplierView-DqgHDC29.js → SupplierView-Cc7Yk3Bg.js} +4 -4
  30. package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-BIay4c9Z.js → TransferDetails.vue_vue_type_script_setup_true_lang-DgwAEHYe.js} +5 -5
  31. package/dist/{TransferTemplateView-B9v54c3c.js → TransferTemplateView-CFxajiqU.js} +7 -7
  32. package/dist/{UnitView-fifkCRuV.js → UnitView-CVF1SjRM.js} +3 -3
  33. package/dist/{WarehouseView-CPirimyL.js → WarehouseView-C7Cd8yoz.js} +1 -1
  34. package/dist/api/closing-draft.d.ts +1 -0
  35. package/dist/{app-CD9h20sX.js → app-B6xEJFwV.js} +211 -209
  36. package/dist/app.js +1 -1
  37. package/dist/{decimal-DYcANN4D.js → decimal--zX3YISg.js} +1 -1
  38. package/dist/{format-unit-display-CX8se_cM.js → format-unit-display-BsHrCcqV.js} +3 -3
  39. package/dist/{import-export.helper-Cj-Qxxkr.js → import-export.helper-DVlYpCKN.js} +1 -1
  40. package/dist/{index-BywPZS7F.js → index-DwWvp8DJ.js} +1 -1
  41. package/dist/{index-BIzKuGTx.js → index-v6xO2bR0.js} +1 -1
  42. package/dist/{purchase-order-template-C7bNpwRs.js → purchase-order-template-B6Lnanis.js} +1 -1
  43. package/dist/{stock-C5k9qQNO.js → stock-cbSPPFhq.js} +2 -2
  44. package/dist/{stock-B2clWpa9.js → stock-kk7c27VO.js} +1 -1
  45. package/dist/{supplier-GOu1-ydl.js → supplier-Bxwn_Txs.js} +1 -1
  46. package/dist/{use-ingredient-select-dialog-BKChxIvw.js → use-ingredient-select-dialog-Bhvgmzhv.js} +1 -1
  47. package/dist/{use-inventory-binding-dialog-CLhMKqSz.js → use-inventory-binding-dialog-BSgySUNp.js} +1 -1
  48. package/package.json +1 -1
@@ -1,31 +1,35 @@
1
- import { defineComponent as Ne, ref as O, computed as L, onMounted as Ge, resolveComponent as E, openBlock as $, createElementBlock as H, Fragment as se, createTextVNode as ae, createBlock as ce, withCtx as G, createElementVNode as u, toDisplayString as te, unref as B, createVNode as D, createCommentVNode as fe, h as x, reactive as Bt, watch as jt, isRef as dt, normalizeClass as Se, renderList as $e, normalizeStyle as ft, Teleport as Tt, mergeProps as It } from "vue";
2
- import { aa as Ut, u as Ee, ax as Y, am as pt, ay as vt, r as Pt, Z as We, n as Ke, t as Mt, a0 as Be, W as Rt, Y as Vt, X as Lt, az as gt, aA as yt, $ as V, ah as bt, aB as ht, aC as he, an as Nt, ac as Qe, ab as ke, a6 as Re, D as mt, j as Pe, i as Et, f as zt, a as Ht, a9 as Ot, h as Yt, G as Kt, I as Qt, J as Gt, K as Wt, L as Me } from "./app-CD9h20sX.js";
1
+ import { defineComponent as Ne, ref as H, computed as L, onMounted as Ge, resolveComponent as E, openBlock as $, createElementBlock as O, Fragment as se, createTextVNode as ae, createBlock as ce, withCtx as G, createElementVNode as u, toDisplayString as te, unref as j, createVNode as A, createCommentVNode as fe, h as x, reactive as Bt, watch as jt, isRef as dt, normalizeClass as Se, renderList as $e, normalizeStyle as ft, Teleport as Tt, mergeProps as It } from "vue";
2
+ import { aa as Ut, u as Ee, ax as Y, am as pt, ay as vt, r as Pt, Z as We, n as Ke, t as Mt, a0 as Be, W as Rt, Y as Vt, X as Lt, az as gt, aA as yt, $ as V, ah as bt, aB as ht, aC as he, an as Nt, ac as Qe, ab as ke, a6 as Re, D as mt, j as Pe, i as Et, f as zt, a as Ot, a9 as Ht, h as Yt, G as Kt, I as Qt, J as Gt, K as Wt, L as Me } from "./app-B6xEJFwV.js";
3
3
  import { useCoreStore as qt, useI18n as kt } from "@feedmepos/mf-common";
4
4
  import { useSnackbar as qe, useDialog as Zt, useProxiedModel as Jt, components as be, useBreakpoints as Xt } from "@feedmepos/ui-library";
5
5
  import { defineStore as xt, storeToRefs as ea } from "pinia";
6
- import { u as Dt } from "./stock-C5k9qQNO.js";
7
- import { u as Ze } from "./stock-B2clWpa9.js";
6
+ import { u as At } from "./stock-cbSPPFhq.js";
7
+ import { u as Ze } from "./stock-kk7c27VO.js";
8
8
  import { E as ta } from "./empty-placeholder-wf6-BWE8.js";
9
- const ze = Ut((i, c) => {
9
+ const ze = Ut((l, r) => {
10
10
  function e() {
11
11
  return Ee().currentLocation.dbName;
12
12
  }
13
13
  return {
14
14
  async getDraft(d) {
15
- const h = e(), b = `${i.inventoryBackendUrl}/${h}/closing-draft/${d}`;
16
- return c.get(b);
15
+ const h = e(), b = `${l.inventoryBackendUrl}/${h}/closing-draft/${d}`;
16
+ return r.get(b);
17
17
  },
18
18
  async readDrafts() {
19
- const d = e(), h = `${i.inventoryBackendUrl}/${d}/closing-draft`;
20
- return c.get(h);
19
+ const d = e(), h = `${l.inventoryBackendUrl}/${d}/closing-draft`;
20
+ return r.get(h);
21
21
  },
22
22
  async runOperation(d) {
23
- const h = e(), b = `${i.inventoryBackendUrl}/${h}/closing-draft/run-operation`;
24
- return c.post(b, d);
23
+ const h = e(), b = `${l.inventoryBackendUrl}/${h}/closing-draft/run-operation`;
24
+ return r.post(b, d);
25
+ },
26
+ async runOperationV1(d) {
27
+ const h = e(), b = `${l.inventoryBackendUrl}/${h}/closing-draft/v1/run-operation`;
28
+ return r.post(b, d);
25
29
  },
26
30
  async sync(d) {
27
- const h = e(), b = `${i.inventoryBackendUrl}/${h}/closing-draft/sync`;
28
- return c.post(b, d);
31
+ const h = e(), b = `${l.inventoryBackendUrl}/${h}/closing-draft/sync`;
32
+ return r.post(b, d);
29
33
  }
30
34
  };
31
35
  }), aa = { class: "fm-typo-en-body-lg-400" }, na = { class: "fm-typo-en-body-lg-600" }, oa = {
@@ -39,9 +43,9 @@ const ze = Ut((i, c) => {
39
43
  onCancel: { type: Function },
40
44
  onFinished: { type: Function }
41
45
  },
42
- setup(i) {
43
- const c = i, e = O(), d = ze(), h = qe(), b = O(!1), y = O(null), M = O(!1), C = L(() => {
44
- switch (c.action) {
46
+ setup(l) {
47
+ const r = l, e = H(), d = ze(), h = qe(), b = H(!1), y = H(null), M = H(!1), C = L(() => {
48
+ switch (r.action) {
45
49
  case Y.enum.approveDraft:
46
50
  return "Approve";
47
51
  case Y.enum.rejectDraft:
@@ -49,9 +53,9 @@ const ze = Ut((i, c) => {
49
53
  case Y.enum.markAsFailed:
50
54
  return "Mark as Failed";
51
55
  }
52
- throw new Error(`Unknown action: ${c.action}`);
53
- }), _ = L(() => {
54
- switch (c.action) {
56
+ throw new Error(`Unknown action: ${r.action}`);
57
+ }), D = L(() => {
58
+ switch (r.action) {
55
59
  case Y.enum.approveDraft:
56
60
  return "primary";
57
61
  case Y.enum.rejectDraft:
@@ -59,14 +63,14 @@ const ze = Ut((i, c) => {
59
63
  case Y.enum.markAsFailed:
60
64
  return "destructive";
61
65
  }
62
- throw new Error(`Unknown action: ${c.action}`);
66
+ throw new Error(`Unknown action: ${r.action}`);
63
67
  });
64
68
  Ge(() => {
65
- if (c.draft.effectiveAt)
66
- y.value = new Date(c.draft.effectiveAt);
69
+ if (r.draft.effectiveAt)
70
+ y.value = new Date(r.draft.effectiveAt);
67
71
  else {
68
- const r = new Date(c.draft.createdAt);
69
- r.setHours(23, 59, 59, 999), y.value = r;
72
+ const c = new Date(r.draft.createdAt);
73
+ c.setHours(23, 59, 59, 999), y.value = c;
70
74
  }
71
75
  M.value = !0;
72
76
  });
@@ -74,10 +78,10 @@ const ze = Ut((i, c) => {
74
78
  get() {
75
79
  return y.value === null ? "" : pt(y.value);
76
80
  },
77
- set(r) {
78
- if (r) {
79
- const s = /* @__PURE__ */ new Date(`${r} ${N.value}`);
80
- s.setSeconds(59, 999), y.value = s;
81
+ set(c) {
82
+ if (c) {
83
+ const a = /* @__PURE__ */ new Date(`${c} ${N.value}`);
84
+ a.setSeconds(59, 999), y.value = a;
81
85
  } else
82
86
  y.value = null;
83
87
  }
@@ -85,21 +89,29 @@ const ze = Ut((i, c) => {
85
89
  get() {
86
90
  return y.value === null ? "" : vt(y.value);
87
91
  },
88
- set(r) {
89
- if (r) {
90
- const s = /* @__PURE__ */ new Date(`${R.value} ${r}`);
91
- s.setSeconds(59, 999), y.value = s;
92
+ set(c) {
93
+ if (c) {
94
+ const a = /* @__PURE__ */ new Date(`${R.value} ${c}`);
95
+ a.setSeconds(59, 999), y.value = a;
92
96
  } else
93
97
  y.value = null;
94
98
  }
95
99
  });
96
- async function j() {
100
+ async function B(c) {
97
101
  b.value = !0;
98
102
  try {
99
- await d.runOperation({
100
- _id: c.draft._id,
101
- _rev: c.draft._rev ?? "",
102
- action: c.action,
103
+ c ? await d.runOperation({
104
+ _id: r.draft._id,
105
+ _rev: r.draft._rev ?? "",
106
+ action: r.action,
107
+ data: {
108
+ effectiveAt: y.value ? y.value.toISOString() : null,
109
+ remark: e.value
110
+ }
111
+ }).delayed(500) : await d.runOperationV1({
112
+ _id: r.draft._id,
113
+ _rev: r.draft._rev ?? "",
114
+ action: r.action,
103
115
  data: {
104
116
  effectiveAt: y.value ? y.value.toISOString() : null,
105
117
  remark: e.value
@@ -108,108 +120,115 @@ const ze = Ut((i, c) => {
108
120
  title: "Success",
109
121
  message: "Action submitted",
110
122
  type: "success"
111
- }), c.onFinished();
112
- } catch (r) {
123
+ }), r.onFinished();
124
+ } catch (a) {
113
125
  h.open({
114
126
  title: "Something went wrong",
115
- message: (r == null ? void 0 : r.message) ?? "Unable to submit action. Please try again",
127
+ message: (a == null ? void 0 : a.message) ?? "Unable to submit action. Please try again",
116
128
  type: "error"
117
- }), console.error("error on submit closing draft action", r);
129
+ }), console.error("error on submit closing draft action", a);
118
130
  } finally {
119
131
  b.value = !1;
120
132
  }
121
133
  }
122
- return (r, s) => {
123
- const A = E("FmLabel"), z = E("FmDatePicker"), v = E("FmTimePicker"), g = E("FmTextField"), w = E("FmButton"), T = E("FmForm");
134
+ return (c, a) => {
135
+ const _ = E("FmLabel"), z = E("FmDatePicker"), v = E("FmTimePicker"), g = E("FmTextField"), w = E("FmButton"), T = E("FmForm");
124
136
  return M.value ? ($(), ce(T, {
125
137
  key: 1,
126
- onValidationSuccess: j,
138
+ onValidationSuccess: B,
127
139
  class: "flex flex-col gap-32",
128
140
  disabled: b.value
129
141
  }, {
130
142
  default: G(() => [
131
143
  u("div", aa, [
132
- s[4] || (s[4] = ae(" You are about to ")),
144
+ a[5] || (a[5] = ae(" You are about to ")),
133
145
  u("span", na, te(C.value), 1),
134
- s[5] || (s[5] = ae(" this draft. Please provide a remark to justify this action. "))
146
+ a[6] || (a[6] = ae(" this draft. Please provide a remark to justify this action. "))
135
147
  ]),
136
- r.action === B(Y).enum.approveDraft ? ($(), H("div", oa, [
137
- D(A, { class: "fm-typo-en-body-lg-600" }, {
138
- default: G(() => s[6] || (s[6] = [
148
+ c.action === j(Y).enum.approveDraft ? ($(), O("div", oa, [
149
+ A(_, { class: "fm-typo-en-body-lg-600" }, {
150
+ default: G(() => a[7] || (a[7] = [
139
151
  ae("Closing Date")
140
152
  ])),
141
153
  _: 1
142
154
  }),
143
- D(z, {
155
+ A(z, {
144
156
  modelValue: R.value,
145
- "onUpdate:modelValue": s[0] || (s[0] = (P) => R.value = P)
157
+ "onUpdate:modelValue": a[0] || (a[0] = (U) => R.value = U)
146
158
  }, null, 8, ["modelValue"]),
147
- D(A, { class: "fm-typo-en-body-lg-600" }, {
148
- default: G(() => s[7] || (s[7] = [
159
+ A(_, { class: "fm-typo-en-body-lg-600" }, {
160
+ default: G(() => a[8] || (a[8] = [
149
161
  ae("Closing Time")
150
162
  ])),
151
163
  _: 1
152
164
  }),
153
- D(v, {
165
+ A(v, {
154
166
  modelValue: N.value,
155
- "onUpdate:modelValue": s[1] || (s[1] = (P) => N.value = P)
167
+ "onUpdate:modelValue": a[1] || (a[1] = (U) => N.value = U)
156
168
  }, null, 8, ["modelValue"])
157
169
  ])) : fe("", !0),
158
- D(g, {
170
+ A(g, {
159
171
  modelValue: e.value,
160
- "onUpdate:modelValue": s[2] || (s[2] = (P) => e.value = P),
172
+ "onUpdate:modelValue": a[2] || (a[2] = (U) => e.value = U),
161
173
  label: "Remark",
162
174
  "label-mark": "required",
163
- rules: [B(Pt)()]
175
+ rules: [j(Pt)()]
164
176
  }, null, 8, ["modelValue", "rules"]),
165
177
  u("div", sa, [
166
- D(w, {
178
+ A(w, {
167
179
  label: "Cancel",
168
180
  variant: "tertiary",
169
- onClick: s[3] || (s[3] = (P) => r.onCancel())
181
+ onClick: a[3] || (a[3] = (U) => c.onCancel())
170
182
  }),
171
- D(w, {
183
+ A(w, {
172
184
  label: C.value,
173
185
  type: "submit",
174
- variant: _.value,
186
+ variant: D.value,
187
+ loading: b.value
188
+ }, null, 8, ["label", "variant", "loading"]),
189
+ A(w, {
190
+ label: "Online Approve (Beta)",
191
+ type: "button",
192
+ onClick: a[4] || (a[4] = (U) => B(!0)),
193
+ variant: D.value,
175
194
  loading: b.value
176
- }, null, 8, ["label", "variant", "loading"])
195
+ }, null, 8, ["variant", "loading"])
177
196
  ])
178
197
  ]),
179
198
  _: 1
180
- }, 8, ["disabled"])) : ($(), H(se, { key: 0 }, [
199
+ }, 8, ["disabled"])) : ($(), O(se, { key: 0 }, [
181
200
  ae("Loading")
182
201
  ], 64));
183
202
  };
184
203
  }
185
204
  }), ra = Be(0);
186
- function At(i) {
187
- const c = i.measurementsAmounts.groupBy((d) => d.measurement.id), e = i.sku.unit.measurements.reduce((d, h) => {
205
+ function Dt(l) {
206
+ const r = l.measurementsAmounts.groupBy((d) => d.measurement.id), e = l.sku.unit.measurements.reduce((d, h) => {
188
207
  var M, C;
189
- const b = ((C = (M = c.get(h.id)) == null ? void 0 : M[0]) == null ? void 0 : C.amount) ?? ra, y = We(h.conversion, b);
208
+ const b = ((C = (M = r.get(h.id)) == null ? void 0 : M[0]) == null ? void 0 : C.amount) ?? ra, y = We(h.conversion, b);
190
209
  return d + +Ke(y);
191
- }, +Ke(i.baseAmount));
192
- return Mt(e, i.baseAmount.precision);
210
+ }, +Ke(l.baseAmount));
211
+ return Mt(e, l.baseAmount.precision);
193
212
  }
194
213
  const la = Be(0), ia = Be(100), _t = "N/A";
195
- function ca(i, c, e, d, h, b) {
214
+ function ca(l, r, e, d, h, b) {
196
215
  var K, q, S, J, ue;
197
- const y = At(i), M = d ?? y, C = gt(M, c), _ = c.amount === 0 ? null : yt(C, {
198
- ...c,
199
- amount: Math.abs(c.amount)
200
- }), R = _ ? We(_, ia) : null, N = ((K = i.sku.defaultCost) == null ? void 0 : K.costPerUnit) ?? { amount: 0, precision: 0 }, j = Number(V.toFormatString({ value: N })), r = ((S = (q = i.sku.defaultCost) == null ? void 0 : q.measurement) == null ? void 0 : S.conversion) ?? {
216
+ const y = Dt(l), M = d ?? y, C = gt(M, r), D = r.amount === 0 ? null : yt(C, {
217
+ ...r,
218
+ amount: Math.abs(r.amount)
219
+ }), R = D ? We(D, ia) : null, N = ((K = l.sku.defaultCost) == null ? void 0 : K.costPerUnit) ?? { amount: 0, precision: 0 }, B = Number(V.toFormatString({ value: N })), c = ((S = (q = l.sku.defaultCost) == null ? void 0 : q.measurement) == null ? void 0 : S.conversion) ?? {
201
220
  amount: 1,
202
221
  precision: 0
203
- }, s = Number(
204
- V.toFormatString({ value: r })
205
- ), A = h ? Number(V.toFormatString({ value: h })) : 0, z = Number(V.toFormatString({ value: c })), v = Number(V.toFormatString({ value: M })), g = z - v, w = g * j / s, T = v * j / s, P = z * j / s;
222
+ }, a = Number(
223
+ V.toFormatString({ value: c })
224
+ ), _ = h ? Number(V.toFormatString({ value: h })) : 0, z = Number(V.toFormatString({ value: r })), v = Number(V.toFormatString({ value: M })), g = z - v, w = g * B / a, T = v * B / a, U = z * B / a;
206
225
  return {
207
- code: i.sku.code,
208
- name: i.sku.name,
209
- baseUnit: i.sku.unit.abbrev,
210
- costUnit: ((ue = (J = i.sku.defaultCost) == null ? void 0 : J.measurement) == null ? void 0 : ue.abbrev) ?? null,
211
- baseUnitAmount: Number(V.toFormatString({ value: i.baseAmount })),
212
- ...i.measurementsAmounts.filter(
226
+ code: l.sku.code,
227
+ name: l.sku.name,
228
+ baseUnit: l.sku.unit.abbrev,
229
+ costUnit: ((ue = (J = l.sku.defaultCost) == null ? void 0 : J.measurement) == null ? void 0 : ue.abbrev) ?? null,
230
+ baseUnitAmount: Number(V.toFormatString({ value: l.baseAmount })),
231
+ ...l.measurementsAmounts.filter(
213
232
  (X) => ua(X.measurement) && e.includes(X.measurement.id)
214
233
  ).reduce(
215
234
  (X, ne, me) => (X[`measurementAbbrev${me}`] = `(${ne.measurement.abbrev}) × ${V.toFormatString({ value: ne.measurement.conversion })}`, X[`measurementAmount${me}`] = Number(V.toFormatString({ value: ne.amount })), X),
@@ -223,36 +242,36 @@ function ca(i, c, e, d, h, b) {
223
242
  value: bt(R, 2)
224
243
  })
225
244
  ) : null,
226
- costPerUnit: j,
227
- opening: A,
245
+ costPerUnit: B,
246
+ opening: _,
228
247
  adjustmentTypes: b ?? _t,
229
248
  varianceQty: g,
230
249
  varianceInCost: w,
231
250
  stockTakeValue: T,
232
- systemValue: P
251
+ systemValue: U
233
252
  };
234
253
  }
235
- function ua(i) {
236
- return !i.abbrev.toLocaleLowerCase().includes("inactive");
254
+ function ua(l) {
255
+ return !l.abbrev.toLocaleLowerCase().includes("inactive");
237
256
  }
238
- function ma(i) {
239
- const c = wt(i);
240
- return i.reduce(
257
+ function ma(l) {
258
+ const r = wt(l);
259
+ return l.reduce(
241
260
  (e, d) => {
242
261
  var h;
243
- return Math.max(e, ((h = c == null ? void 0 : c.get(d.sku._id)) == null ? void 0 : h[0].length) ?? 0);
262
+ return Math.max(e, ((h = r == null ? void 0 : r.get(d.sku._id)) == null ? void 0 : h[0].length) ?? 0);
244
263
  },
245
264
  0
246
265
  );
247
266
  }
248
- function wt(i) {
249
- return i.groupBy(
250
- (c) => c.sku._id,
251
- (c) => c.measurementsAmounts.filter((e) => !e.measurement.abbrev.toLocaleLowerCase().includes("inactive")).map((e) => e.measurement.id)
267
+ function wt(l) {
268
+ return l.groupBy(
269
+ (r) => r.sku._id,
270
+ (r) => r.measurementsAmounts.filter((e) => !e.measurement.abbrev.toLocaleLowerCase().includes("inactive")).map((e) => e.measurement.id)
252
271
  );
253
272
  }
254
- function da(i) {
255
- const c = ht(), e = c === "MYR" ? "RM" : c;
273
+ function da(l) {
274
+ const r = ht(), e = r === "MYR" ? "RM" : r;
256
275
  return [
257
276
  {
258
277
  id: "code",
@@ -318,7 +337,7 @@ function da(i) {
318
337
  id: "baseUnitAmount",
319
338
  name: "Base unit amount"
320
339
  },
321
- ...Array.from({ length: i }).flatMap((h, b) => [
340
+ ...Array.from({ length: l }).flatMap((h, b) => [
322
341
  {
323
342
  id: `measurementAmount${b}`,
324
343
  name: `UOM amount ${b + 1}`
@@ -330,60 +349,60 @@ function da(i) {
330
349
  ])
331
350
  ];
332
351
  }
333
- function fa(i, c, e) {
334
- var g, w, T, P, re, K, q;
335
- const d = c.groupBy(
352
+ function fa(l, r, e) {
353
+ var g, w, T, U, re, K, q;
354
+ const d = r.groupBy(
336
355
  (S) => S.id,
337
356
  (S) => S.balance
338
357
  ), h = e.groupBy(
339
358
  (S) => S.id,
340
359
  (S) => S.balance
341
360
  ), b = /* @__PURE__ */ new Map();
342
- if (i.opening)
343
- for (const S of i.opening)
361
+ if (l.opening)
362
+ for (const S of l.opening)
344
363
  b.set(S.skuId, S.balance);
345
364
  const y = /* @__PURE__ */ new Map();
346
- if (i.adjustmentSnapshot)
347
- for (const S of i.adjustmentSnapshot) {
365
+ if (l.adjustmentSnapshot)
366
+ for (const S of l.adjustmentSnapshot) {
348
367
  const J = Object.keys(S.adjustmentsByType).join(", ");
349
368
  y.set(S.skuId, J || _t);
350
369
  }
351
- const M = [...i.items, ...i.negativeStockItems ?? []], C = wt(M), _ = M.map((S) => {
352
- var me, xe, De;
370
+ const M = [...l.items, ...l.negativeStockItems ?? []], C = wt(M), D = M.map((S) => {
371
+ var me, xe, Ae;
353
372
  const J = ((me = d.get(S.sku._id)) == null ? void 0 : me[0]) ?? la, ue = ((xe = C == null ? void 0 : C.get(S.sku._id)) == null ? void 0 : xe[0]) ?? [], X = b.get(S.sku._id), ne = y.get(S.sku._id);
354
373
  return ca(
355
374
  S,
356
375
  J,
357
376
  ue,
358
- (De = h.get(S.sku._id)) == null ? void 0 : De[0],
377
+ (Ae = h.get(S.sku._id)) == null ? void 0 : Ae[0],
359
378
  X,
360
379
  ne
361
380
  );
362
- }), R = ma(M), j = qt().currentBusiness.value, r = da(R), s = [
363
- ["Business name:", j == null ? void 0 : j.name],
364
- ["Business ID:", j == null ? void 0 : j._id],
365
- ["Menu version", j == null ? void 0 : j.menuVersion],
366
- ["Created at", new Date(i.createdAt)],
367
- ["Created by", (g = i.createdBy) == null ? void 0 : g.name],
368
- ["Updated at", new Date(i.updatedAt)],
369
- ["Updated by", (w = i.updatedBy) == null ? void 0 : w.name],
370
- ["Recent action", i.approvedAt ? "Approve" : i.rejectionHistory ? "Reject" : ""],
381
+ }), R = ma(M), B = qt().currentBusiness.value, c = da(R), a = [
382
+ ["Business name:", B == null ? void 0 : B.name],
383
+ ["Business ID:", B == null ? void 0 : B._id],
384
+ ["Menu version", B == null ? void 0 : B.menuVersion],
385
+ ["Created at", new Date(l.createdAt)],
386
+ ["Created by", (g = l.createdBy) == null ? void 0 : g.name],
387
+ ["Updated at", new Date(l.updatedAt)],
388
+ ["Updated by", (w = l.updatedBy) == null ? void 0 : w.name],
389
+ ["Recent action", l.approvedAt ? "Approve" : l.rejectionHistory ? "Reject" : ""],
371
390
  [
372
391
  "Action by",
373
- i.approvedAt ? (T = i.approvedBy) == null ? void 0 : T.name : i.rejectionHistory ? (re = (P = i.rejectionHistory[0]) == null ? void 0 : P.rejectedBy) == null ? void 0 : re.name : ""
392
+ l.approvedAt ? (T = l.approvedBy) == null ? void 0 : T.name : l.rejectionHistory ? (re = (U = l.rejectionHistory[0]) == null ? void 0 : U.rejectedBy) == null ? void 0 : re.name : ""
374
393
  ],
375
394
  [
376
395
  "Action at",
377
- i.approvedAt ? new Date(i.approvedAt) : i.rejectionHistory ? new Date((K = i.rejectionHistory[0]) == null ? void 0 : K.rejectedAt) : ""
396
+ l.approvedAt ? new Date(l.approvedAt) : l.rejectionHistory ? new Date((K = l.rejectionHistory[0]) == null ? void 0 : K.rejectedAt) : ""
378
397
  ],
379
398
  [
380
399
  "Action remark",
381
- i.approvedAt ? i.approveRemark : i.rejectionHistory ? new Date((q = i.rejectionHistory[0]) == null ? void 0 : q.rejectRemark) : ""
400
+ l.approvedAt ? l.approveRemark : l.rejectionHistory ? new Date((q = l.rejectionHistory[0]) == null ? void 0 : q.rejectRemark) : ""
382
401
  ],
383
402
  [],
384
- r.map((S) => S.name),
385
- ..._.map((S) => r.map((J) => S[J.id]))
386
- ], A = r.map((S) => `system:${S.id}`), z = Rt(s, A), v = `[${j == null ? void 0 : j.name}] closing draft (${Vt(new Date(i.updatedAt))}).xlsx`;
403
+ c.map((S) => S.name),
404
+ ...D.map((S) => c.map((J) => S[J.id]))
405
+ ], _ = c.map((S) => `system:${S.id}`), z = Rt(a, _), v = `[${B == null ? void 0 : B.name}] closing draft (${Vt(new Date(l.updatedAt))}).xlsx`;
387
406
  return Lt(z, v), v;
388
407
  }
389
408
  const pa = { class: "flex flex-col" }, va = { class: "flex gap-12 py-8 justify-end w-full" }, ga = /* @__PURE__ */ Ne({
@@ -393,15 +412,15 @@ const pa = { class: "flex flex-col" }, va = { class: "flex gap-12 py-8 justify-e
393
412
  onCancel: { type: Function },
394
413
  onFinished: { type: Function }
395
414
  },
396
- setup(i) {
397
- const c = i;
415
+ setup(l) {
416
+ const r = l;
398
417
  Ze();
399
- const e = O(!1), d = O(null), h = O(!1);
418
+ const e = H(!1), d = H(null), h = H(!1);
400
419
  Ge(() => {
401
- if (c.draft.effectiveAt)
402
- d.value = new Date(c.draft.effectiveAt);
420
+ if (r.draft.effectiveAt)
421
+ d.value = new Date(r.draft.effectiveAt);
403
422
  else {
404
- const C = new Date(c.draft.createdAt);
423
+ const C = new Date(r.draft.createdAt);
405
424
  C.setHours(23, 59, 59, 999), d.value = C;
406
425
  }
407
426
  h.value = !0;
@@ -412,8 +431,8 @@ const pa = { class: "flex flex-col" }, va = { class: "flex gap-12 py-8 justify-e
412
431
  },
413
432
  set(C) {
414
433
  if (C) {
415
- const _ = /* @__PURE__ */ new Date(`${C} ${y.value}`);
416
- _.setSeconds(59, 999), d.value = _;
434
+ const D = /* @__PURE__ */ new Date(`${C} ${y.value}`);
435
+ D.setSeconds(59, 999), d.value = D;
417
436
  } else
418
437
  d.value = null;
419
438
  }
@@ -423,25 +442,25 @@ const pa = { class: "flex flex-col" }, va = { class: "flex gap-12 py-8 justify-e
423
442
  },
424
443
  set(C) {
425
444
  if (C) {
426
- const _ = /* @__PURE__ */ new Date(`${b.value} ${C}`);
427
- _.setSeconds(59, 999), d.value = _;
445
+ const D = /* @__PURE__ */ new Date(`${b.value} ${C}`);
446
+ D.setSeconds(59, 999), d.value = D;
428
447
  } else
429
448
  d.value = null;
430
449
  }
431
450
  });
432
451
  async function M() {
433
- e.value = !0, c.onFinished(d.value.toISOString());
452
+ e.value = !0, r.onFinished(d.value.toISOString());
434
453
  }
435
- return (C, _) => {
436
- const R = E("FmLabel"), N = E("FmDatePicker"), j = E("FmTimePicker"), r = E("FmButton"), s = E("FmForm");
437
- return h.value ? ($(), ce(s, {
454
+ return (C, D) => {
455
+ const R = E("FmLabel"), N = E("FmDatePicker"), B = E("FmTimePicker"), c = E("FmButton"), a = E("FmForm");
456
+ return h.value ? ($(), ce(a, {
438
457
  key: 1,
439
458
  onValidationSuccess: M,
440
459
  class: "flex flex-col gap-32",
441
460
  disabled: e.value
442
461
  }, {
443
462
  default: G(() => [
444
- _[5] || (_[5] = u("div", { class: "fm-typo-en-body-lg-400" }, [
463
+ D[5] || (D[5] = u("div", { class: "fm-typo-en-body-lg-400" }, [
445
464
  u("p", null, [
446
465
  ae(" Performing "),
447
466
  u("span", { class: "fm-typo-en-body-lg-600" }, '"Refresh Balance"'),
@@ -454,34 +473,34 @@ const pa = { class: "flex flex-col" }, va = { class: "flex gap-12 py-8 justify-e
454
473
  ])
455
474
  ], -1)),
456
475
  u("div", pa, [
457
- D(R, { class: "fm-typo-en-body-lg-600" }, {
458
- default: G(() => _[3] || (_[3] = [
476
+ A(R, { class: "fm-typo-en-body-lg-600" }, {
477
+ default: G(() => D[3] || (D[3] = [
459
478
  ae("Closing Date")
460
479
  ])),
461
480
  _: 1
462
481
  }),
463
- D(N, {
482
+ A(N, {
464
483
  modelValue: b.value,
465
- "onUpdate:modelValue": _[0] || (_[0] = (A) => b.value = A)
484
+ "onUpdate:modelValue": D[0] || (D[0] = (_) => b.value = _)
466
485
  }, null, 8, ["modelValue"]),
467
- D(R, { class: "fm-typo-en-body-lg-600" }, {
468
- default: G(() => _[4] || (_[4] = [
486
+ A(R, { class: "fm-typo-en-body-lg-600" }, {
487
+ default: G(() => D[4] || (D[4] = [
469
488
  ae("Closing Time")
470
489
  ])),
471
490
  _: 1
472
491
  }),
473
- D(j, {
492
+ A(B, {
474
493
  modelValue: y.value,
475
- "onUpdate:modelValue": _[1] || (_[1] = (A) => y.value = A)
494
+ "onUpdate:modelValue": D[1] || (D[1] = (_) => y.value = _)
476
495
  }, null, 8, ["modelValue"])
477
496
  ]),
478
497
  u("div", va, [
479
- D(r, {
498
+ A(c, {
480
499
  label: "Cancel",
481
500
  variant: "tertiary",
482
- onClick: _[2] || (_[2] = (A) => C.onCancel())
501
+ onClick: D[2] || (D[2] = (_) => C.onCancel())
483
502
  }),
484
- D(r, {
503
+ A(c, {
485
504
  label: "Refresh balance",
486
505
  type: "submit",
487
506
  variant: "primary",
@@ -490,7 +509,7 @@ const pa = { class: "flex flex-col" }, va = { class: "flex gap-12 py-8 justify-e
490
509
  ])
491
510
  ]),
492
511
  _: 1
493
- }, 8, ["disabled"])) : ($(), H(se, { key: 0 }, [
512
+ }, 8, ["disabled"])) : ($(), O(se, { key: 0 }, [
494
513
  ae("Loading")
495
514
  ], 64));
496
515
  };
@@ -498,14 +517,14 @@ const pa = { class: "flex flex-col" }, va = { class: "flex gap-12 py-8 justify-e
498
517
  }), Le = xt(
499
518
  "closingDraftActions",
500
519
  function() {
501
- const c = Zt(), e = qe(), d = Ze(), h = ze(), b = Dt(), y = O(!1), M = O();
520
+ const r = Zt(), e = qe(), d = Ze(), h = ze(), b = At(), y = H(!1), M = H();
502
521
  function C(v) {
503
522
  const g = {
504
523
  draft: v
505
524
  };
506
525
  M.value = g, y.value = !0;
507
526
  }
508
- async function _(v) {
527
+ async function D(v) {
509
528
  var w;
510
529
  if (v.status === he.enum.COMPLETED) {
511
530
  const T = v.closingAdjustmentId;
@@ -517,8 +536,8 @@ const pa = { class: "flex flex-col" }, va = { class: "flex gap-12 py-8 justify-e
517
536
  }), console.error("Closing draft is completed but closing document cannot be found.", {
518
537
  draftId: v._id
519
538
  }), [];
520
- const P = await d.readAdjustmentById(T);
521
- return ((P == null ? void 0 : P.skus) ?? []).map((K) => ({
539
+ const U = await d.readAdjustmentById(T);
540
+ return ((U == null ? void 0 : U.skus) ?? []).map((K) => ({
522
541
  id: K.sku._id,
523
542
  balance: K.fromBalance,
524
543
  costs: K.fromCostBalances
@@ -530,51 +549,51 @@ const pa = { class: "flex flex-col" }, va = { class: "flex gap-12 py-8 justify-e
530
549
  g || (e.open({
531
550
  title: "Exporting",
532
551
  message: "Fetching data..."
533
- }), g = await _(v)), fa(v, g, w ?? []);
552
+ }), g = await D(v)), fa(v, g, w ?? []);
534
553
  }
535
554
  function N(v, g) {
536
- c.open({
555
+ r.open({
537
556
  title: "Approve draft",
538
557
  contentComponent: Ye,
539
558
  contentComponentProps: {
540
559
  draft: v,
541
560
  action: Y.enum.approveDraft,
542
561
  onFinished: () => {
543
- c.close(), g == null || g();
562
+ r.close(), g == null || g();
544
563
  },
545
- onCancel: () => c.close()
564
+ onCancel: () => r.close()
546
565
  }
547
566
  });
548
567
  }
549
- function j(v, g) {
550
- c.open({
568
+ function B(v, g) {
569
+ r.open({
551
570
  title: "Reject draft",
552
571
  contentComponent: Ye,
553
572
  contentComponentProps: {
554
573
  draft: v,
555
574
  action: Y.enum.rejectDraft,
556
575
  onFinished: () => {
557
- c.close(), g == null || g();
576
+ r.close(), g == null || g();
558
577
  },
559
- onCancel: () => c.close()
578
+ onCancel: () => r.close()
560
579
  }
561
580
  });
562
581
  }
563
- function r(v, g) {
564
- c.open({
582
+ function c(v, g) {
583
+ r.open({
565
584
  title: "Mark draft as failed",
566
585
  contentComponent: Ye,
567
586
  contentComponentProps: {
568
587
  draft: v,
569
588
  action: Y.enum.markAsFailed,
570
589
  onFinished: () => {
571
- c.close(), g == null || g();
590
+ r.close(), g == null || g();
572
591
  },
573
- onCancel: () => c.close()
592
+ onCancel: () => r.close()
574
593
  }
575
594
  });
576
595
  }
577
- async function s(v, g) {
596
+ async function a(v, g) {
578
597
  await h.sync({
579
598
  _id: v._id,
580
599
  _rev: v._rev ?? "",
@@ -588,31 +607,31 @@ const pa = { class: "flex flex-col" }, va = { class: "flex gap-12 py-8 justify-e
588
607
  type: "success"
589
608
  }), g == null || g();
590
609
  }
591
- function A() {
610
+ function _() {
592
611
  y.value = !1;
593
612
  }
594
613
  async function z(v, g, w) {
595
- await c.open({
614
+ await r.open({
596
615
  title: "Refresh balance",
597
616
  contentComponent: ga,
598
617
  contentComponentProps: {
599
618
  draft: v,
600
619
  onFinished: (T) => {
601
- c.close(), w == null || w(T);
620
+ r.close(), w == null || w(T);
602
621
  },
603
622
  onCancel: async () => {
604
- c.close(), g == null || g();
623
+ r.close(), g == null || g();
605
624
  }
606
625
  }
607
626
  });
608
627
  }
609
628
  return {
610
629
  viewDraft: C,
611
- closeDraftDialog: A,
630
+ closeDraftDialog: _,
612
631
  approveDraft: N,
613
- rejectDraft: j,
614
- markAsFailed: r,
615
- syncDraft: s,
632
+ rejectDraft: B,
633
+ markAsFailed: c,
634
+ syncDraft: a,
616
635
  exportDraft: R,
617
636
  refreshBalance: z,
618
637
  viewClosingDraftShow: y,
@@ -620,8 +639,8 @@ const pa = { class: "flex flex-col" }, va = { class: "flex gap-12 py-8 justify-e
620
639
  };
621
640
  }
622
641
  );
623
- function Ve(i) {
624
- switch (i) {
642
+ function Ve(l) {
643
+ switch (l) {
625
644
  case "DRAFT":
626
645
  return "fm-status-badge-draft";
627
646
  case "PROCESSING":
@@ -635,57 +654,57 @@ function Ve(i) {
635
654
  const ya = xt(
636
655
  "closingDraftTable",
637
656
  function() {
638
- const { t: c } = kt(), e = Le(), d = O(new Array()), h = O(!1), b = Ee(), y = ze();
657
+ const { t: r } = kt(), e = Le(), d = H(new Array()), h = H(!1), b = Ee(), y = ze();
639
658
  async function M() {
640
659
  if (d.value = [], !!b._currentLocation) {
641
660
  h.value = !0;
642
661
  try {
643
- const [r] = await Promise.all([y.readDrafts()]).delayed(1e3);
644
- d.value = r.reverse();
645
- } catch (r) {
646
- console.log("Something went wrong when fetching drafts:", r);
662
+ const [c] = await Promise.all([y.readDrafts()]).delayed(1e3);
663
+ d.value = c.reverse();
664
+ } catch (c) {
665
+ console.log("Something went wrong when fetching drafts:", c);
647
666
  } finally {
648
667
  h.value = !1;
649
668
  }
650
669
  }
651
670
  }
652
- async function C(r) {
653
- if (!d.value.find((s) => s._id) && b._currentLocation) {
671
+ async function C(c) {
672
+ if (!d.value.find((a) => a._id) && b._currentLocation) {
654
673
  h.value = !0;
655
674
  try {
656
- const [s] = await Promise.all([
657
- y.getDraft(r),
658
- new Promise((A) => setTimeout(A, 1e3))
675
+ const [a] = await Promise.all([
676
+ y.getDraft(c),
677
+ new Promise((_) => setTimeout(_, 1e3))
659
678
  ]);
660
- d.value = [s];
661
- } catch (s) {
662
- console.log("Something went wrong when fetching drafts:", s);
679
+ d.value = [a];
680
+ } catch (a) {
681
+ console.log("Something went wrong when fetching drafts:", a);
663
682
  } finally {
664
683
  h.value = !1;
665
684
  }
666
685
  }
667
686
  }
668
- function _(r) {
669
- d.value = d.value.map((s) => s._id === r._id ? {
670
- ...r,
671
- _rev: s._rev
672
- } : s);
687
+ function D(c) {
688
+ d.value = d.value.map((a) => a._id === c._id ? {
689
+ ...c,
690
+ _rev: a._rev
691
+ } : a);
673
692
  }
674
693
  function R() {
675
694
  e.closeDraftDialog(), M();
676
695
  }
677
- function N(r, s) {
678
- switch (s = zt(s), r) {
696
+ function N(c, a) {
697
+ switch (a = zt(a), c) {
679
698
  case Pe.Details:
680
- return e.viewDraft(s);
699
+ return e.viewDraft(a);
681
700
  case Pe.Export:
682
- return e.exportDraft(s);
701
+ return e.exportDraft(a);
683
702
  case Y.enum.approveDraft:
684
- return e.approveDraft(s, R);
703
+ return e.approveDraft(a, R);
685
704
  case Y.enum.rejectDraft:
686
- return e.rejectDraft(s, R);
705
+ return e.rejectDraft(a, R);
687
706
  case Y.enum.markAsFailed:
688
- return e.markAsFailed(s, R);
707
+ return e.markAsFailed(a, R);
689
708
  }
690
709
  }
691
710
  return {
@@ -693,26 +712,26 @@ const ya = xt(
693
712
  {
694
713
  id: "_id",
695
714
  accessorKey: "_id",
696
- header: () => c("inventory.closing.table.createdAt"),
697
- cell(r) {
698
- return Nt(`${r.getValue()}`);
715
+ header: () => r("inventory.closing.table.createdAt"),
716
+ cell(c) {
717
+ return Nt(`${c.getValue()}`);
699
718
  },
700
719
  enableSorting: !0
701
720
  },
702
721
  {
703
722
  accessorKey: "effectiveAt",
704
723
  header: () => "Effective at",
705
- cell(r) {
706
- const s = r.row.original;
707
- let A = r.getValue();
708
- return A || (A = Qe(s._id)), ke(A);
724
+ cell(c) {
725
+ const a = c.row.original;
726
+ let _ = c.getValue();
727
+ return _ || (_ = Qe(a._id)), ke(_);
709
728
  },
710
729
  enableSorting: !0,
711
730
  size: 200
712
731
  },
713
732
  {
714
733
  id: "updatedAt",
715
- accessorFn: (r) => ke(r.updatedAt),
734
+ accessorFn: (c) => ke(c.updatedAt),
716
735
  header: () => "Updated at",
717
736
  enableSorting: !0,
718
737
  size: 200
@@ -726,11 +745,11 @@ const ya = xt(
726
745
  },
727
746
  {
728
747
  id: "noOfItems",
729
- accessorFn: (r) => {
730
- var s;
731
- return r.items.length + (((s = r.negativeStockItems) == null ? void 0 : s.length) ?? 0);
748
+ accessorFn: (c) => {
749
+ var a;
750
+ return c.items.length + (((a = c.negativeStockItems) == null ? void 0 : a.length) ?? 0);
732
751
  },
733
- header: () => c("inventory.closing.table.noOfItems"),
752
+ header: () => r("inventory.closing.table.noOfItems"),
734
753
  enableSorting: !1,
735
754
  meta: {
736
755
  width: "10rem",
@@ -739,21 +758,21 @@ const ya = xt(
739
758
  },
740
759
  {
741
760
  id: "recentRemark",
742
- accessorFn: (r) => {
743
- var s;
744
- return (r == null ? void 0 : r.approveRemark) ?? ((s = r == null ? void 0 : r.rejectionHistory) == null ? void 0 : s.computeFirst((A) => A.rejectRemark)) ?? r.remark;
761
+ accessorFn: (c) => {
762
+ var a;
763
+ return (c == null ? void 0 : c.approveRemark) ?? ((a = c == null ? void 0 : c.rejectionHistory) == null ? void 0 : a.computeFirst((_) => _.rejectRemark)) ?? c.remark;
745
764
  },
746
765
  header: () => "Recent remark"
747
766
  },
748
767
  {
749
768
  id: "status",
750
- accessorFn: (r) => r.status,
751
- header: () => c("inventory.closing.table.status"),
769
+ accessorFn: (c) => c.status,
770
+ header: () => r("inventory.closing.table.status"),
752
771
  enableSorting: !1,
753
- cell(r) {
772
+ cell(c) {
754
773
  var w;
755
- const s = r.row.original, A = s.status, z = new Date(s.updatedAt), v = (w = s == null ? void 0 : s.rejectionHistory) == null ? void 0 : w.computeFirst((T) => T.rejectedAt), g = v ? new Date(v) : null;
756
- return A === "DRAFT" && g ? g.getTime() > z.getTime() ? x(
774
+ const a = c.row.original, _ = a.status, z = new Date(a.updatedAt), v = (w = a == null ? void 0 : a.rejectionHistory) == null ? void 0 : w.computeFirst((T) => T.rejectedAt), g = v ? new Date(v) : null;
775
+ return _ === "DRAFT" && g ? g.getTime() > z.getTime() ? x(
757
776
  "div",
758
777
  {
759
778
  class: "flex"
@@ -785,17 +804,17 @@ const ya = xt(
785
804
  x(
786
805
  "div",
787
806
  {
788
- class: ["fm-status-badge", Ve(A)]
807
+ class: ["fm-status-badge", Ve(_)]
789
808
  },
790
- Re(A)
809
+ Re(_)
791
810
  )
792
811
  );
793
812
  }
794
813
  },
795
814
  {
796
815
  id: "action",
797
- cell(r) {
798
- const s = r.row.original, A = [
816
+ cell(c) {
817
+ const a = c.row.original, _ = [
799
818
  mt[Pe.Details],
800
819
  mt[Pe.Export]
801
820
  ], z = [
@@ -817,10 +836,10 @@ const ya = xt(
817
836
  ];
818
837
  return Et(
819
838
  [
820
- ...A,
821
- ...s.status === he.enum.DRAFT ? z : []
839
+ ..._,
840
+ ...a.status === he.enum.DRAFT ? z : []
822
841
  ],
823
- (v) => N(v, s)
842
+ (v) => N(v, a)
824
843
  );
825
844
  },
826
845
  enableSorting: !1,
@@ -835,10 +854,10 @@ const ya = xt(
835
854
  loading: h,
836
855
  fetchDrafts: M,
837
856
  loadDraft: C,
838
- updateDraftRef: _
857
+ updateDraftRef: D
839
858
  };
840
859
  }
841
- ), ba = { class: "w-full flex flex-col gap-32" }, ha = { class: "flex justify-between" }, ka = { class: "flex" }, xa = { class: "grid grid-cols-[repeat(4,1fr)] xs:flex xs:flex-col sm:flex sm:flex-col gap-8" }, Da = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Aa = { class: "flex gap-1" }, _a = { class: "fm-typo-en-body-lg-600" }, wa = { class: "flex flex-col gap-16" }, Sa = { class: "flex items-center" }, Fa = {
860
+ ), ba = { class: "w-full flex flex-col gap-32" }, ha = { class: "flex justify-between" }, ka = { class: "flex" }, xa = { class: "grid grid-cols-[repeat(4,1fr)] xs:flex xs:flex-col sm:flex sm:flex-col gap-8" }, Aa = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Da = { class: "flex gap-1" }, _a = { class: "fm-typo-en-body-lg-600" }, wa = { class: "flex flex-col gap-16" }, Sa = { class: "flex items-center" }, Fa = {
842
861
  key: 0,
843
862
  class: "flex gap-8"
844
863
  }, Ca = {
@@ -862,7 +881,7 @@ const ya = xt(
862
881
  }, Na = { class: "flex-1 flex flex-col items-center" }, Ea = { class: "flex-1 flex flex-col items-center" }, za = {
863
882
  class: "py-12 flex flex-col gap-4",
864
883
  name: "received-at header"
865
- }, Ha = { class: "fm-typo-en-body-lg-400" }, Oa = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, Ya = { class: "flex gap-12 content-stretch" }, Ka = {
884
+ }, Oa = { class: "fm-typo-en-body-lg-400" }, Ha = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, Ya = { class: "flex gap-12 content-stretch" }, Ka = {
866
885
  class: "flex flex-col w-24",
867
886
  name: "circles"
868
887
  }, Qa = { class: "flex-1 flex flex-col items-center" }, Ga = {
@@ -875,33 +894,33 @@ const ya = xt(
875
894
  draft: {}
876
895
  },
877
896
  emits: ["submitted", "refresh"],
878
- setup(i, { emit: c }) {
879
- const e = i, d = L(() => {
880
- const l = ht();
881
- return l === "MYR" ? "RM" : l;
882
- }), h = Dt(), b = Le(), y = Jt(e, "show"), M = O(!1), C = O(!1), _ = O(!1), R = O(new Array()), N = O(new Array()), j = O([]), r = Ze(), s = ze(), A = qe(), z = Ht(), v = Ee(), g = Bt({}), w = L(() => new Set(
883
- z.skus.filter((l) => {
897
+ setup(l, { emit: r }) {
898
+ const e = l, d = L(() => {
899
+ const i = ht();
900
+ return i === "MYR" ? "RM" : i;
901
+ }), h = At(), b = Le(), y = Jt(e, "show"), M = H(!1), C = H(!1), D = H(!1), R = H(new Array()), N = H(new Array()), B = H([]), c = Ze(), a = ze(), _ = qe(), z = Ot(), v = Ee(), g = Bt({}), w = L(() => new Set(
902
+ z.skus.filter((i) => {
884
903
  var t;
885
- return g[(t = l.customAttributes) == null ? void 0 : t.tag];
886
- }).map((l) => l._id)
887
- )), T = c, P = O({
904
+ return g[(t = i.customAttributes) == null ? void 0 : t.tag];
905
+ }).map((i) => i._id)
906
+ )), T = r, U = H({
888
907
  templateItem: !0,
889
908
  nonTemplateItem: !0
890
909
  }), re = L(() => {
891
910
  var t, m;
892
- const l = [...((t = e.draft) == null ? void 0 : t.items) ?? [], ...((m = e.draft) == null ? void 0 : m.negativeStockItems) ?? []];
893
- return w.value.size ? l.filter((a) => w.value.has(a.sku._id)) : l;
911
+ const i = [...((t = e.draft) == null ? void 0 : t.items) ?? [], ...((m = e.draft) == null ? void 0 : m.negativeStockItems) ?? []];
912
+ return w.value.size ? i.filter((n) => w.value.has(n.sku._id)) : i;
894
913
  }), K = L(() => {
895
- const l = re.value.map((t) => t.sku);
896
- return l.sort((t, m) => t.code.localeCompare(m.code)), l;
914
+ const i = re.value.map((t) => t.sku);
915
+ return i.sort((t, m) => t.code.localeCompare(m.code)), i;
897
916
  }), q = L(() => re.value.groupBy(
898
917
  (t) => t.sku._id,
899
918
  (t) => t.measurementsAmounts.filter((m) => !m.measurement.abbrev.toLocaleLowerCase().includes("inactive")).map((m) => m.measurement.id)
900
919
  ));
901
920
  Ge(ue), jt(
902
921
  () => e.show,
903
- (l) => {
904
- l && (ge.value = ve[0], ue(), P.value = {
922
+ (i) => {
923
+ i && (ge.value = ve[0], ue(), U.value = {
905
924
  templateItem: !0,
906
925
  nonTemplateItem: !0
907
926
  });
@@ -909,16 +928,16 @@ const ya = xt(
909
928
  );
910
929
  const S = Be(0), J = Be(100);
911
930
  async function ue() {
912
- var t, m, a, n;
931
+ var t, m, n, o;
913
932
  if (!v._currentLocation) return;
914
933
  M.value = !0;
915
- const l = ((t = e.draft) == null ? void 0 : t.status) === he.enum.COMPLETED;
934
+ const i = ((t = e.draft) == null ? void 0 : t.status) === he.enum.COMPLETED;
916
935
  N.value = [];
917
936
  try {
918
- if (await z.init(), l) {
937
+ if (await z.init(), i) {
919
938
  const I = e.draft.closingAdjustmentId;
920
939
  if (!I) {
921
- A.open({
940
+ _.open({
922
941
  title: "Something went wrong",
923
942
  message: "Closing draft is completed but closing document cannot be found.",
924
943
  type: "error"
@@ -927,7 +946,7 @@ const ya = xt(
927
946
  });
928
947
  return;
929
948
  }
930
- const U = await r.readAdjustmentById(I), oe = (U == null ? void 0 : U.skus) ?? [];
949
+ const P = await c.readAdjustmentById(I), oe = (P == null ? void 0 : P.skus) ?? [];
931
950
  for (const le of oe) {
932
951
  const _e = {
933
952
  id: le.sku._id,
@@ -941,23 +960,23 @@ const ya = xt(
941
960
  R.value.push(_e), N.value.push(F);
942
961
  }
943
962
  } else
944
- R.value = ((a = e.draft) == null ? void 0 : a.stockSnapshot) ?? [];
945
- const o = /* @__PURE__ */ new Set();
946
- if ((n = e.draft) != null && n.adjustmentSnapshot)
963
+ R.value = ((n = e.draft) == null ? void 0 : n.stockSnapshot) ?? [];
964
+ const s = /* @__PURE__ */ new Set();
965
+ if ((o = e.draft) != null && o.adjustmentSnapshot)
947
966
  for (const I of e.draft.adjustmentSnapshot)
948
- I.adjustmentsByType && Object.keys(I.adjustmentsByType).forEach((U) => o.add(U));
967
+ I.adjustmentsByType && Object.keys(I.adjustmentsByType).forEach((P) => s.add(P));
949
968
  const p = ["receive", "sales", "wastage"], k = [];
950
969
  p.forEach((I) => {
951
- o.has(I) && (k.push(I), o.delete(I));
970
+ s.has(I) && (k.push(I), s.delete(I));
952
971
  });
953
- const f = Array.from(o).sort();
954
- j.value = [...k, ...f];
955
- } catch (o) {
956
- A.open({
972
+ const f = Array.from(s).sort();
973
+ B.value = [...k, ...f];
974
+ } catch (s) {
975
+ _.open({
957
976
  title: "Something went wrong",
958
977
  message: "Something went wrong when fetching info. Please try again.",
959
978
  type: "error"
960
- }), console.error("error on fetch stock balances", o);
979
+ }), console.error("error on fetch stock balances", s);
961
980
  } finally {
962
981
  M.value = !1;
963
982
  }
@@ -965,7 +984,7 @@ const ya = xt(
965
984
  async function X() {
966
985
  var t, m;
967
986
  if (!(((t = e.draft) == null ? void 0 : t.effectiveAt) ?? (e.draft ? Qe((m = e.draft) == null ? void 0 : m._id) : null))) {
968
- A.open({
987
+ _.open({
969
988
  title: "Cannot refresh",
970
989
  message: "Effective date is not available for this draft.",
971
990
  type: "error"
@@ -976,30 +995,30 @@ const ya = xt(
976
995
  e.draft,
977
996
  () => {
978
997
  },
979
- async (a) => {
998
+ async (n) => {
980
999
  var k;
981
1000
  C.value = !0;
982
- const n = (k = e.draft) == null ? void 0 : k._rev, o = 30, p = 2e3;
1001
+ const o = (k = e.draft) == null ? void 0 : k._rev, s = 30, p = 2e3;
983
1002
  try {
984
- await r.recalculation.scheduleCalculateStockSnapshotAtDate(a, e.draft._id);
1003
+ await c.recalculation.scheduleCalculateStockSnapshotAtDate(n, e.draft._id);
985
1004
  let f = null;
986
- for (let I = 0; I < o && (f = await s.getDraft(e.draft._id).delayed(p), f._rev === n); I++)
1005
+ for (let I = 0; I < s && (f = await a.getDraft(e.draft._id).delayed(p), f._rev === o); I++)
987
1006
  ;
988
- if (!f || f._rev === n) {
989
- A.open({
1007
+ if (!f || f._rev === o) {
1008
+ _.open({
990
1009
  title: "Refresh failed",
991
1010
  message: "Failed to refresh stock balance. Please try again.",
992
1011
  type: "error"
993
1012
  }), console.error("error refreshing stock balances: there is no change in _rev");
994
1013
  return;
995
1014
  }
996
- T("refresh", f), R.value = f.stockSnapshot ?? [], A.open({
1015
+ T("refresh", f), R.value = f.stockSnapshot ?? [], _.open({
997
1016
  title: "Balance refreshed",
998
1017
  message: "Stock balance has been recalculated.",
999
1018
  type: "success"
1000
1019
  }), y.value = !1;
1001
1020
  } catch (f) {
1002
- A.open({
1021
+ _.open({
1003
1022
  title: "Refresh failed",
1004
1023
  message: "Failed to refresh stock balance. Please try again.",
1005
1024
  type: "error"
@@ -1012,34 +1031,34 @@ const ya = xt(
1012
1031
  }
1013
1032
  const ne = L(
1014
1033
  () => R.value.groupBy(
1015
- (l) => l.id,
1016
- (l) => l.balance
1034
+ (i) => i.id,
1035
+ (i) => i.balance
1017
1036
  )
1018
- ), me = L(() => re.value.groupBy((l) => l.sku._id)), xe = L(() => {
1019
- var l;
1020
- return (l = e.draft) != null && l.adjustmentSnapshot ? new Map(e.draft.adjustmentSnapshot.map((t) => [t.skuId, t.adjustmentsByType])) : /* @__PURE__ */ new Map();
1021
- }), De = L(() => {
1022
- var l;
1023
- return (l = e.draft) != null && l.opening ? new Map(e.draft.opening.map((t) => [t.skuId, t.balance])) : /* @__PURE__ */ new Map();
1037
+ ), me = L(() => re.value.groupBy((i) => i.sku._id)), xe = L(() => {
1038
+ var i;
1039
+ return (i = e.draft) != null && i.adjustmentSnapshot ? new Map(e.draft.adjustmentSnapshot.map((t) => [t.skuId, t.adjustmentsByType])) : /* @__PURE__ */ new Map();
1040
+ }), Ae = L(() => {
1041
+ var i;
1042
+ return (i = e.draft) != null && i.opening ? new Map(e.draft.opening.map((t) => [t.skuId, t.balance])) : /* @__PURE__ */ new Map();
1024
1043
  });
1025
- function ee(l, t) {
1044
+ function ee(i, t) {
1026
1045
  return x(
1027
1046
  be.FmTooltip,
1028
1047
  { zIndex: 51, placement: "left", class: "w-full flex justify-end" },
1029
1048
  {
1030
1049
  default() {
1031
- return l;
1050
+ return i;
1032
1051
  },
1033
1052
  content() {
1034
- return t || l;
1053
+ return t || i;
1035
1054
  }
1036
1055
  }
1037
1056
  );
1038
1057
  }
1039
- const Ae = L(() => {
1040
- const l = K.value.reduce((m, a) => {
1041
- var n, o;
1042
- return Math.max(m, ((o = (n = q.value) == null ? void 0 : n.get(a._id)) == null ? void 0 : o[0].length) ?? 0);
1058
+ const De = L(() => {
1059
+ const i = K.value.reduce((m, n) => {
1060
+ var o, s;
1061
+ return Math.max(m, ((s = (o = q.value) == null ? void 0 : o.get(n._id)) == null ? void 0 : s[0].length) ?? 0);
1043
1062
  }, 0);
1044
1063
  return [
1045
1064
  {
@@ -1048,26 +1067,26 @@ const ya = xt(
1048
1067
  header: () => "Name",
1049
1068
  size: 350,
1050
1069
  cell(m) {
1051
- const a = m.row.original, n = a.adjustedDiffPercentage, o = typeof n == "number" && Math.abs(n) > 10, p = x("div", { class: "flex flex-col gap-4" }, [
1070
+ const n = m.row.original, o = n.adjustedDiffPercentage, s = typeof o == "number" && Math.abs(o) > 10, p = x("div", { class: "flex flex-col gap-4" }, [
1052
1071
  x(
1053
1072
  "div",
1054
1073
  {
1055
1074
  class: [
1056
1075
  "line-clamp-1 fm-typo-en-body-lg-400",
1057
- o ? " text-fm-color-system-error-300" : "text-fm-color-typo-primary"
1076
+ s ? " text-fm-color-system-error-300" : "text-fm-color-typo-primary"
1058
1077
  ]
1059
1078
  },
1060
- a.name
1079
+ n.name
1061
1080
  ),
1062
1081
  x(
1063
1082
  "div",
1064
1083
  {
1065
1084
  class: [
1066
1085
  "line-clamp-1 fm-typo-en-body-md-400",
1067
- o ? " text-fm-color-system-error-300" : "text-fm-color-typo-secondary"
1086
+ s ? " text-fm-color-system-error-300" : "text-fm-color-typo-secondary"
1068
1087
  ]
1069
1088
  },
1070
- a.code
1089
+ n.code
1071
1090
  )
1072
1091
  ]);
1073
1092
  return x(
@@ -1077,7 +1096,7 @@ const ya = xt(
1077
1096
  },
1078
1097
  {
1079
1098
  content() {
1080
- return o ? "Adjustment difference is more than 10%." : `${a.code} - ${a.name}`;
1099
+ return s ? "Adjustment difference is more than 10%." : `${n.code} - ${n.name}`;
1081
1100
  },
1082
1101
  default() {
1083
1102
  return x("div", { class: "flex items-center gap-4 justify-start w-full" }, [
@@ -1094,8 +1113,8 @@ const ya = xt(
1094
1113
  header: () => ee("Cost per unit"),
1095
1114
  size: 160,
1096
1115
  cell(m) {
1097
- const a = m.row.original.costPerUnit;
1098
- return x("div", { class: "text-right" }, a.toFixed(2));
1116
+ const n = m.row.original.costPerUnit;
1117
+ return x("div", { class: "text-right" }, n.toFixed(2));
1099
1118
  },
1100
1119
  meta: {
1101
1120
  textAlign: "right"
@@ -1107,11 +1126,11 @@ const ya = xt(
1107
1126
  size: 120,
1108
1127
  cell(m) {
1109
1128
  var k;
1110
- const a = m.row.original, n = a.costUnit, o = a.baseUnit, p = n ?? o;
1111
- if (n && n !== o) {
1112
- const f = K.value.find((U) => U._id === a.id), I = (k = f == null ? void 0 : f.defaultCost) == null ? void 0 : k.measurement;
1129
+ const n = m.row.original, o = n.costUnit, s = n.baseUnit, p = o ?? s;
1130
+ if (o && o !== s) {
1131
+ const f = K.value.find((P) => P._id === n.id), I = (k = f == null ? void 0 : f.defaultCost) == null ? void 0 : k.measurement;
1113
1132
  if (I) {
1114
- const U = I.conversion.amount / Math.pow(10, I.conversion.precision);
1133
+ const P = I.conversion.amount / Math.pow(10, I.conversion.precision);
1115
1134
  return x("div", { class: "flex flex-col" }, [
1116
1135
  x(
1117
1136
  "span",
@@ -1120,9 +1139,9 @@ const ya = xt(
1120
1139
  ),
1121
1140
  x("span", { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, [
1122
1141
  "1 ",
1123
- x("span", { class: "fm-typo-en-body-sm-600" }, n),
1124
- ` = ${U} `,
1125
- x("span", { class: "fm-typo-en-body-sm-600" }, o)
1142
+ x("span", { class: "fm-typo-en-body-sm-600" }, o),
1143
+ ` = ${P} `,
1144
+ x("span", { class: "fm-typo-en-body-sm-600" }, s)
1126
1145
  ])
1127
1146
  ]);
1128
1147
  }
@@ -1136,23 +1155,23 @@ const ya = xt(
1136
1155
  header: () => ee("Opening (B/F)", "The opening balance brought forward from previous period."),
1137
1156
  size: 150,
1138
1157
  cell(m) {
1139
- const a = m.row.original.opening;
1140
- return x("div", { class: "text-right" }, a.toFixed(2));
1158
+ const n = m.row.original.opening;
1159
+ return x("div", { class: "text-right" }, n.toFixed(2));
1141
1160
  },
1142
1161
  meta: {
1143
1162
  textAlign: "right"
1144
1163
  }
1145
1164
  },
1146
1165
  // Dynamic adjustment type columns
1147
- ...j.value.map(
1166
+ ...B.value.map(
1148
1167
  (m) => ({
1149
1168
  id: `adjustment_${m}`,
1150
- accessorFn: (a) => a.adjustmentAmounts[m] ?? { amount: 0, precision: 0 },
1169
+ accessorFn: (n) => n.adjustmentAmounts[m] ?? { amount: 0, precision: 0 },
1151
1170
  header: () => ee(Re(m)),
1152
1171
  size: 150,
1153
- cell(a) {
1154
- const n = a.row.original.adjustmentAmounts[m] ?? { amount: 0, precision: 0 };
1155
- return x("div", { class: "text-right" }, Ke(n));
1172
+ cell(n) {
1173
+ const o = n.row.original.adjustmentAmounts[m] ?? { amount: 0, precision: 0 };
1174
+ return x("div", { class: "text-right" }, Ke(o));
1156
1175
  },
1157
1176
  meta: {
1158
1177
  textAlign: "right"
@@ -1171,29 +1190,29 @@ const ya = xt(
1171
1190
  {
1172
1191
  id: "physicalBalance",
1173
1192
  accessorFn: (m) => {
1174
- var n;
1175
- const a = (n = N.value.find((o) => o.id === m.id)) == null ? void 0 : n.balance;
1176
- return a ? V.toFormatString({ value: a }) : m.physicalBalance;
1193
+ var o;
1194
+ const n = (o = N.value.find((s) => s.id === m.id)) == null ? void 0 : o.balance;
1195
+ return n ? V.toFormatString({ value: n }) : m.physicalBalance;
1177
1196
  },
1178
1197
  header: () => ee("Stock Take balance", "The physical balance recorded during stock take."),
1179
1198
  cell(m) {
1180
1199
  var f;
1181
- const a = m.row.original, n = V.fromNumber(a.physicalBalance);
1182
- let o = !0, p = a.physicalBalance;
1183
- const k = (f = N.value.find((I) => I.id === a.id)) == null ? void 0 : f.balance;
1200
+ const n = m.row.original, o = V.fromNumber(n.physicalBalance);
1201
+ let s = !0, p = n.physicalBalance;
1202
+ const k = (f = N.value.find((I) => I.id === n.id)) == null ? void 0 : f.balance;
1184
1203
  return k && (V.equals({
1185
- a: n,
1204
+ a: o,
1186
1205
  b: k
1187
- }) || (o = !1, p = Number(V.toFormatString({ value: k })))), x("div", { class: "flex flex-col" }, [
1206
+ }) || (s = !1, p = Number(V.toFormatString({ value: k })))), x("div", { class: "flex flex-col" }, [
1188
1207
  x(
1189
1208
  "span",
1190
1209
  { class: "line-clamp-1 fm-typo-en-body-lg-400 text-fm-color-typo-primary" },
1191
1210
  p
1192
1211
  ),
1193
- o ? null : x(
1212
+ s ? null : x(
1194
1213
  "span",
1195
1214
  { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" },
1196
- `Draft: ${a.physicalBalance.toString()}`
1215
+ `Draft: ${n.physicalBalance.toString()}`
1197
1216
  )
1198
1217
  ]);
1199
1218
  },
@@ -1217,11 +1236,11 @@ const ya = xt(
1217
1236
  header: () => ee(`Variance (${d.value})`),
1218
1237
  size: 150,
1219
1238
  cell(m) {
1220
- const a = m.row.original.varianceInCost;
1239
+ const n = m.row.original.varianceInCost;
1221
1240
  return x(
1222
1241
  "div",
1223
1242
  { class: "text-right" },
1224
- a.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 4 })
1243
+ n.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 4 })
1225
1244
  );
1226
1245
  },
1227
1246
  meta: {
@@ -1237,19 +1256,19 @@ const ya = xt(
1237
1256
  ),
1238
1257
  size: 200,
1239
1258
  cell(m) {
1240
- const a = m.row.original.adjustedDiffPercentage;
1241
- if (!a) return Xa;
1242
- const n = a.toFixed(2);
1243
- if (n === "0.00")
1259
+ const n = m.row.original.adjustedDiffPercentage;
1260
+ if (!n) return Xa;
1261
+ const o = n.toFixed(2);
1262
+ if (o === "0.00")
1244
1263
  return x("div", { class: "flex items-center gap-4 justify-end" }, ["0.00"]);
1245
- const o = a > 0;
1264
+ const s = n > 0;
1246
1265
  return x("div", { class: "flex items-center gap-4 justify-end" }, [
1247
1266
  x(be.FmIcon, {
1248
- name: o ? "arrow_drop_up" : "arrow_drop_down",
1249
- color: o ? "system-success-300" : "system-error-300",
1267
+ name: s ? "arrow_drop_up" : "arrow_drop_down",
1268
+ color: s ? "system-success-300" : "system-error-300",
1250
1269
  size: "md"
1251
1270
  }),
1252
- n
1271
+ o
1253
1272
  ]);
1254
1273
  },
1255
1274
  meta: {
@@ -1263,9 +1282,9 @@ const ya = xt(
1263
1282
  size: 180,
1264
1283
  cell(m) {
1265
1284
  var I;
1266
- const a = m.row.original, n = a.stockTakeValue, o = K.value.find((U) => U._id === a.id), p = (I = o == null ? void 0 : o.defaultCost) == null ? void 0 : I.measurement, k = a.physicalBalance, f = a.costPerUnit;
1285
+ const n = m.row.original, o = n.stockTakeValue, s = K.value.find((P) => P._id === n.id), p = (I = s == null ? void 0 : s.defaultCost) == null ? void 0 : I.measurement, k = n.physicalBalance, f = n.costPerUnit;
1267
1286
  if (p) {
1268
- const U = V.toFormatString({ value: p.conversion }), oe = `${k.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 })} ${a.baseUnit} ÷ ${U} × ${f} ${d.value}`;
1287
+ const P = V.toFormatString({ value: p.conversion }), oe = `${k.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 })} ${n.baseUnit} ÷ ${P} × ${f} ${d.value}`;
1269
1288
  return x(
1270
1289
  be.FmTooltip,
1271
1290
  { zIndex: 51 },
@@ -1277,7 +1296,7 @@ const ya = xt(
1277
1296
  return x(
1278
1297
  "div",
1279
1298
  { class: "text-right" },
1280
- n.toLocaleString("en-US", {
1299
+ o.toLocaleString("en-US", {
1281
1300
  minimumFractionDigits: 2,
1282
1301
  maximumFractionDigits: 4
1283
1302
  })
@@ -1286,19 +1305,19 @@ const ya = xt(
1286
1305
  }
1287
1306
  );
1288
1307
  } else {
1289
- const U = `${k.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 })} ${a.baseUnit} × ${f} ${d.value}`;
1308
+ const P = `${k.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 })} ${n.baseUnit} × ${f} ${d.value}`;
1290
1309
  return x(
1291
1310
  be.FmTooltip,
1292
1311
  { zIndex: 51 },
1293
1312
  {
1294
1313
  content() {
1295
- return U;
1314
+ return P;
1296
1315
  },
1297
1316
  default() {
1298
1317
  return x(
1299
1318
  "div",
1300
1319
  { class: "text-right" },
1301
- n.toLocaleString("en-US", {
1320
+ o.toLocaleString("en-US", {
1302
1321
  minimumFractionDigits: 2,
1303
1322
  maximumFractionDigits: 4
1304
1323
  })
@@ -1319,9 +1338,9 @@ const ya = xt(
1319
1338
  size: 180,
1320
1339
  cell(m) {
1321
1340
  var I;
1322
- const a = m.row.original, n = a.systemValue, o = K.value.find((U) => U._id === a.id), p = (I = o == null ? void 0 : o.defaultCost) == null ? void 0 : I.measurement, k = a.systemBalance, f = a.costPerUnit;
1341
+ const n = m.row.original, o = n.systemValue, s = K.value.find((P) => P._id === n.id), p = (I = s == null ? void 0 : s.defaultCost) == null ? void 0 : I.measurement, k = n.systemBalance, f = n.costPerUnit;
1323
1342
  if (p) {
1324
- const U = V.toFormatString({ value: p.conversion }), oe = `${k.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 4 })} ${a.baseUnit} ÷ ${U} × ${f} ${d.value}`;
1343
+ const P = V.toFormatString({ value: p.conversion }), oe = `${k.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 4 })} ${n.baseUnit} ÷ ${P} × ${f} ${d.value}`;
1325
1344
  return x(
1326
1345
  be.FmTooltip,
1327
1346
  { zIndex: 51 },
@@ -1333,7 +1352,7 @@ const ya = xt(
1333
1352
  return x(
1334
1353
  "div",
1335
1354
  { class: "text-right" },
1336
- n.toLocaleString("en-US", {
1355
+ o.toLocaleString("en-US", {
1337
1356
  minimumFractionDigits: 2,
1338
1357
  maximumFractionDigits: 4
1339
1358
  })
@@ -1342,19 +1361,19 @@ const ya = xt(
1342
1361
  }
1343
1362
  );
1344
1363
  } else {
1345
- const U = `${k.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 4 })} ${a.baseUnit} × ${f} ${d.value}`;
1364
+ const P = `${k.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 4 })} ${n.baseUnit} × ${f} ${d.value}`;
1346
1365
  return x(
1347
1366
  be.FmTooltip,
1348
1367
  { zIndex: 51 },
1349
1368
  {
1350
1369
  content() {
1351
- return U;
1370
+ return P;
1352
1371
  },
1353
1372
  default() {
1354
1373
  return x(
1355
1374
  "div",
1356
1375
  { class: "text-right" },
1357
- n.toLocaleString("en-US", {
1376
+ o.toLocaleString("en-US", {
1358
1377
  minimumFractionDigits: 2,
1359
1378
  maximumFractionDigits: 4
1360
1379
  })
@@ -1373,7 +1392,7 @@ const ya = xt(
1373
1392
  header: () => "Amounts",
1374
1393
  enableSorting: !1,
1375
1394
  cell(m) {
1376
- const a = m.row.original, n = (p, k) => x(
1395
+ const n = m.row.original, o = (p, k) => x(
1377
1396
  be.FmTooltip,
1378
1397
  { zIndex: 50 },
1379
1398
  {
@@ -1401,56 +1420,56 @@ const ya = xt(
1401
1420
  }
1402
1421
  }
1403
1422
  );
1404
- let o = Array.from({ length: l }).map((p, k) => {
1405
- if (!a[`measurementAmount${k}`])
1423
+ let s = Array.from({ length: i }).map((p, k) => {
1424
+ if (!n[`measurementAmount${k}`])
1406
1425
  return null;
1407
- const f = a[`measurementAmount${k}`], I = a[`measurementAbbrev${k}`];
1408
- return n(f, I);
1426
+ const f = n[`measurementAmount${k}`], I = n[`measurementAbbrev${k}`];
1427
+ return o(f, I);
1409
1428
  }).filter((p) => p);
1410
- return (a.baseUnitAmount || !o.length) && (o = [n(a.baseUnitAmount, a.baseUnit), ...o]), x(
1429
+ return (n.baseUnitAmount || !s.length) && (s = [o(n.baseUnitAmount, n.baseUnit), ...s]), x(
1411
1430
  "div",
1412
1431
  {
1413
1432
  class: "flex gap-8 flex-nowrap",
1414
1433
  style: {
1415
- minWidth: `${120 * o.length}px`
1434
+ minWidth: `${120 * s.length}px`
1416
1435
  }
1417
1436
  },
1418
- o
1437
+ s
1419
1438
  );
1420
1439
  }
1421
1440
  }
1422
1441
  ];
1423
- }), je = L(() => Ae.value.map((l) => l.size ?? 0).reduce((l, t) => l + t)), we = O(""), Fe = L(() => {
1424
- var m, a;
1425
- const l = ((a = (m = e.draft) == null ? void 0 : m.negativeStockItems) == null ? void 0 : a.reduce(
1426
- (n, o) => (n[o.sku._id] = o, n),
1442
+ }), je = L(() => De.value.map((i) => i.size ?? 0).reduce((i, t) => i + t)), we = H(""), Fe = L(() => {
1443
+ var m, n;
1444
+ const i = ((n = (m = e.draft) == null ? void 0 : m.negativeStockItems) == null ? void 0 : n.reduce(
1445
+ (o, s) => (o[s.sku._id] = s, o),
1427
1446
  {}
1428
1447
  )) ?? {};
1429
- return K.value.map((n) => {
1448
+ return K.value.map((o) => {
1430
1449
  var et, tt, at, nt, ot, st, rt, lt, it, ct, ut;
1431
- const o = (et = me.value.get(n._id)) == null ? void 0 : et[0], p = ((tt = ne.value.get(n._id)) == null ? void 0 : tt[0]) ?? S, k = ((at = n.defaultCost) == null ? void 0 : at.costPerUnit) ?? S, f = Number(V.toFormatString({ value: k })), I = ((ot = (nt = n.defaultCost) == null ? void 0 : nt.measurement) == null ? void 0 : ot.conversion) ?? {
1450
+ const s = (et = me.value.get(o._id)) == null ? void 0 : et[0], p = ((tt = ne.value.get(o._id)) == null ? void 0 : tt[0]) ?? S, k = ((at = o.defaultCost) == null ? void 0 : at.costPerUnit) ?? S, f = Number(V.toFormatString({ value: k })), I = ((ot = (nt = o.defaultCost) == null ? void 0 : nt.measurement) == null ? void 0 : ot.conversion) ?? {
1432
1451
  amount: 1,
1433
1452
  precision: 0
1434
- }, U = Number(
1453
+ }, P = Number(
1435
1454
  V.toFormatString({ value: I })
1436
- ), oe = De.value.get(n._id), le = oe ? Number(V.toFormatString({ value: oe })) : 0, _e = xe.value.get(n._id), F = {};
1437
- if (j.value.forEach((W) => {
1455
+ ), oe = Ae.value.get(o._id), le = oe ? Number(V.toFormatString({ value: oe })) : 0, _e = xe.value.get(o._id), F = {};
1456
+ if (B.value.forEach((W) => {
1438
1457
  const ie = F[W] ?? { amount: 0, precision: 0 }, de = _e == null ? void 0 : _e[W];
1439
- de && (F[W] = Ot(ie, de));
1440
- }), !o) {
1441
- const W = Number(V.toFormatString({ value: p })), ie = W - 0, de = ie * f / U, Ue = 0, $t = W * f / U;
1458
+ de && (F[W] = Ht(ie, de));
1459
+ }), !s) {
1460
+ const W = Number(V.toFormatString({ value: p })), ie = W - 0, de = ie * f / P, Ue = 0, $t = W * f / P;
1442
1461
  return {
1443
- id: n._id,
1444
- code: n.code,
1445
- name: n.name,
1446
- costUnit: ((rt = (st = n.defaultCost) == null ? void 0 : st.measurement) == null ? void 0 : rt.abbrev) ?? null,
1447
- baseUnit: n.unit.abbrev,
1462
+ id: o._id,
1463
+ code: o.code,
1464
+ name: o.name,
1465
+ costUnit: ((rt = (st = o.defaultCost) == null ? void 0 : st.measurement) == null ? void 0 : rt.abbrev) ?? null,
1466
+ baseUnit: o.unit.abbrev,
1448
1467
  baseUnitAmount: 0,
1449
1468
  systemBalance: W,
1450
1469
  physicalBalance: 0,
1451
1470
  adjustedAmount: -W,
1452
1471
  adjustedDiffPercentage: -100,
1453
- isTemplateItem: !l[n._id],
1472
+ isTemplateItem: !i[o._id],
1454
1473
  costPerUnit: f,
1455
1474
  opening: le,
1456
1475
  varianceQty: ie,
@@ -1460,35 +1479,35 @@ const ya = xt(
1460
1479
  adjustmentAmounts: F
1461
1480
  };
1462
1481
  }
1463
- const Q = At(o), Z = (it = (lt = N.value) == null ? void 0 : lt.find(
1464
- (W) => W.id === n._id
1482
+ const Q = Dt(s), Z = (it = (lt = N.value) == null ? void 0 : lt.find(
1483
+ (W) => W.id === o._id
1465
1484
  )) == null ? void 0 : it.balance, pe = gt(
1466
1485
  Z ?? Q,
1467
1486
  p
1468
1487
  ), Ce = p.amount === 0 ? null : yt(pe, {
1469
1488
  ...p,
1470
1489
  amount: Math.abs(p.amount)
1471
- }), Ie = Ce ? We(Ce, J) : null, He = Number(V.toFormatString({ value: p })), Oe = Number(V.toFormatString({ value: Q })), Xe = He - Oe, St = Xe * f / U, Ft = Oe * f / U, Ct = He * f / U;
1490
+ }), Ie = Ce ? We(Ce, J) : null, Oe = Number(V.toFormatString({ value: p })), He = Number(V.toFormatString({ value: Q })), Xe = Oe - He, St = Xe * f / P, Ft = He * f / P, Ct = Oe * f / P;
1472
1491
  return {
1473
- id: n._id,
1474
- code: n.code,
1475
- name: n.name,
1476
- costUnit: ((ut = (ct = n.defaultCost) == null ? void 0 : ct.measurement) == null ? void 0 : ut.abbrev) ?? null,
1477
- baseUnit: n.unit.abbrev,
1478
- baseUnitAmount: Number(V.toFormatString({ value: o.baseAmount })),
1479
- ...o.measurementsAmounts.filter((W) => {
1492
+ id: o._id,
1493
+ code: o.code,
1494
+ name: o.name,
1495
+ costUnit: ((ut = (ct = o.defaultCost) == null ? void 0 : ct.measurement) == null ? void 0 : ut.abbrev) ?? null,
1496
+ baseUnit: o.unit.abbrev,
1497
+ baseUnitAmount: Number(V.toFormatString({ value: s.baseAmount })),
1498
+ ...s.measurementsAmounts.filter((W) => {
1480
1499
  var ie, de, Ue;
1481
- return (Ue = (de = (ie = q.value) == null ? void 0 : ie.get(n._id)) == null ? void 0 : de[0]) == null ? void 0 : Ue.includes(W.measurement.id);
1500
+ return (Ue = (de = (ie = q.value) == null ? void 0 : ie.get(o._id)) == null ? void 0 : de[0]) == null ? void 0 : Ue.includes(W.measurement.id);
1482
1501
  }).reduce((W, ie, de) => (W[`measurementAbbrev${de}`] = `(${ie.measurement.abbrev}) × ${V.toFormatString({ value: ie.measurement.conversion })}`, W[`measurementAmount${de}`] = Number(V.toFormatString({ value: ie.amount })), W), {}),
1483
- systemBalance: He,
1484
- physicalBalance: Oe,
1502
+ systemBalance: Oe,
1503
+ physicalBalance: He,
1485
1504
  adjustedAmount: Number(V.toFormatString({ value: pe })),
1486
1505
  adjustedDiffPercentage: Ie ? Number(
1487
1506
  V.toFormatString({
1488
1507
  value: bt(Ie, 2)
1489
1508
  })
1490
1509
  ) : null,
1491
- isTemplateItem: !l[n._id],
1510
+ isTemplateItem: !i[o._id],
1492
1511
  costPerUnit: f,
1493
1512
  opening: le,
1494
1513
  varianceQty: Xe,
@@ -1497,20 +1516,20 @@ const ya = xt(
1497
1516
  systemValue: Ct,
1498
1517
  adjustmentAmounts: F
1499
1518
  };
1500
- }).filter((n) => !!(n.isTemplateItem && P.value.templateItem || !n.isTemplateItem && P.value.nonTemplateItem));
1519
+ }).filter((o) => !!(o.isTemplateItem && U.value.templateItem || !o.isTemplateItem && U.value.nonTemplateItem));
1501
1520
  }), Te = L(() => {
1502
- var t, m, a, n;
1521
+ var t, m, n, o;
1503
1522
  if (!e.draft) return [];
1504
- const l = e.draft.approvedAt ? {
1523
+ const i = e.draft.approvedAt ? {
1505
1524
  action: `Approve at ${ke(e.draft.approvedAt)}`,
1506
1525
  // actionAt: props.draft.approvedAt,
1507
1526
  actionBy: e.draft.approvedBy,
1508
1527
  remark: e.draft.approveRemark
1509
- } : (t = e.draft.rejectionHistory) == null ? void 0 : t.computeFirst((o) => ({
1510
- action: `Reject at ${ke(o.rejectedAt)}`,
1528
+ } : (t = e.draft.rejectionHistory) == null ? void 0 : t.computeFirst((s) => ({
1529
+ action: `Reject at ${ke(s.rejectedAt)}`,
1511
1530
  // actionAt: e.rejectedAt,
1512
- actionBy: o.rejectedBy,
1513
- remark: o.rejectRemark
1531
+ actionBy: s.rejectedBy,
1532
+ remark: s.rejectRemark
1514
1533
  }));
1515
1534
  return [
1516
1535
  {
@@ -1535,25 +1554,25 @@ const ya = xt(
1535
1554
  },
1536
1555
  {
1537
1556
  label: "Using template",
1538
- value: ((a = e.draft.usingTemplates.find((o) => o)) == null ? void 0 : a.name) ?? "None"
1557
+ value: ((n = e.draft.usingTemplates.find((s) => s)) == null ? void 0 : n.name) ?? "None"
1539
1558
  },
1540
1559
  e.draft.remark ? {
1541
1560
  label: "Remark",
1542
1561
  value: e.draft.remark
1543
1562
  } : null,
1544
- l ? {
1563
+ i ? {
1545
1564
  label: "Last action",
1546
- value: l.action
1565
+ value: i.action
1547
1566
  } : null,
1548
- l && l.actionBy ? {
1567
+ i && i.actionBy ? {
1549
1568
  label: "Last action by",
1550
- value: (n = l.actionBy) == null ? void 0 : n.name
1569
+ value: (o = i.actionBy) == null ? void 0 : o.name
1551
1570
  } : null,
1552
- l && l.remark ? {
1571
+ i && i.remark ? {
1553
1572
  label: "Action remark",
1554
- value: l.remark
1573
+ value: i.remark
1555
1574
  } : null
1556
- ].filter((o) => o).map((o) => o);
1575
+ ].filter((s) => s).map((s) => s);
1557
1576
  }), ve = [
1558
1577
  {
1559
1578
  label: "Overview",
@@ -1563,29 +1582,29 @@ const ya = xt(
1563
1582
  label: "Action history",
1564
1583
  value: "history"
1565
1584
  }
1566
- ], ge = O(ve[0]), ye = L(() => {
1567
- var a, n, o;
1568
- const l = ((a = e.draft) == null ? void 0 : a.activityLogs) ?? [], t = ((n = e.draft) == null ? void 0 : n.rejectionHistory) ?? [];
1585
+ ], ge = H(ve[0]), ye = L(() => {
1586
+ var n, o, s;
1587
+ const i = ((n = e.draft) == null ? void 0 : n.activityLogs) ?? [], t = ((o = e.draft) == null ? void 0 : o.rejectionHistory) ?? [];
1569
1588
  for (const p of t)
1570
- l.find(
1589
+ i.find(
1571
1590
  (f) => `${f.action}_${f.performedAt}` == `${Y.enum.rejectDraft}_${p.rejectedAt}`
1572
- ) || l.push({
1591
+ ) || i.push({
1573
1592
  action: Y.enum.rejectDraft,
1574
1593
  performedAt: p.rejectedAt,
1575
1594
  performedBy: p.rejectedBy,
1576
1595
  remark: p.rejectRemark
1577
1596
  });
1578
- return (o = e.draft) != null && o.approvedAt && (l.find(
1597
+ return (s = e.draft) != null && s.approvedAt && (i.find(
1579
1598
  (k) => {
1580
1599
  var f;
1581
1600
  return `${k.action}_${k.performedAt}` == `${Y.enum.approveDraft}_${(f = e.draft) == null ? void 0 : f.approvedAt}`;
1582
1601
  }
1583
- ) || l.push({
1602
+ ) || i.push({
1584
1603
  action: Y.enum.approveDraft,
1585
1604
  performedAt: e.draft.approvedAt,
1586
1605
  performedBy: e.draft.approvedBy ?? { name: "Unknown", id: "unknown" },
1587
1606
  remark: e.draft.approveRemark
1588
- })), l.sort((p, k) => new Date(k.performedAt).getTime() - new Date(p.performedAt).getTime()).map(
1607
+ })), i.sort((p, k) => new Date(k.performedAt).getTime() - new Date(p.performedAt).getTime()).map(
1589
1608
  (p) => ({
1590
1609
  header: Re(p.action),
1591
1610
  date: ke(p.performedAt),
@@ -1602,21 +1621,21 @@ const ya = xt(
1602
1621
  })
1603
1622
  );
1604
1623
  }), Je = L(() => {
1605
- var n, o, p, k;
1606
- if (!((n = e.draft) != null && n.stockSnapshot)) return "Stock snapshot is not available.";
1607
- if (((o = e.draft) == null ? void 0 : o.status) !== he.enum.DRAFT) return "Status is not draft.";
1608
- const l = Fe.value.some((f) => f.physicalBalance < 0), t = ((k = (p = h.stockBalance.skus) == null ? void 0 : p.filter((f) => f.balance.amount < 0)) == null ? void 0 : k.map((f) => f.id)) ?? [], m = new Set(K.value.map((f) => f._id)), a = t.filter((f) => !m.has(f)).length;
1624
+ var o, s, p, k;
1625
+ if (!((o = e.draft) != null && o.stockSnapshot)) return "Stock snapshot is not available.";
1626
+ if (((s = e.draft) == null ? void 0 : s.status) !== he.enum.DRAFT) return "Status is not draft.";
1627
+ const i = Fe.value.some((f) => f.physicalBalance < 0), t = ((k = (p = h.stockBalance.skus) == null ? void 0 : p.filter((f) => f.balance.amount < 0)) == null ? void 0 : k.map((f) => f.id)) ?? [], m = new Set(K.value.map((f) => f._id)), n = t.filter((f) => !m.has(f)).length;
1609
1628
  return [
1610
- l ? "Negative total exist." : null,
1611
- a ? "Negative stock is not included in this draft. Please commit the draft to include these stocks." : null
1629
+ i ? "Negative total exist." : null,
1630
+ n ? "Negative stock is not included in this draft. Please commit the draft to include these stocks." : null
1612
1631
  ].filter((f) => f).join(" ");
1613
1632
  });
1614
- return (l, t) => {
1615
- const m = E("FmButtonGroup"), a = E("FmMenuDivider"), n = E("FmCard"), o = E("FmButton"), p = E("FmCircularProgress"), k = E("FmChip"), f = E("FmTextField"), I = E("FmIcon"), U = E("FmTable"), oe = E("FmSpacer"), le = E("FmTooltip"), _e = E("FmSideSheet");
1633
+ return (i, t) => {
1634
+ const m = E("FmButtonGroup"), n = E("FmMenuDivider"), o = E("FmCard"), s = E("FmButton"), p = E("FmCircularProgress"), k = E("FmChip"), f = E("FmTextField"), I = E("FmIcon"), P = E("FmTable"), oe = E("FmSpacer"), le = E("FmTooltip"), _e = E("FmSideSheet");
1616
1635
  return $(), ce(_e, {
1617
1636
  "dismiss-away": "",
1618
1637
  "max-width": 9999,
1619
- "model-value": B(y),
1638
+ "model-value": j(y),
1620
1639
  "onUpdate:modelValue": t[10] || (t[10] = (F) => dt(y) ? y.value = F : null),
1621
1640
  header: "Closing details"
1622
1641
  }, {
@@ -1624,7 +1643,7 @@ const ya = xt(
1624
1643
  var F, Q, Z, pe;
1625
1644
  return [
1626
1645
  u("div", Ja, [
1627
- ((F = e.draft) == null ? void 0 : F.status) === B(he).enum.DRAFT ? ($(), H(se, { key: 0 }, [
1646
+ ((F = e.draft) == null ? void 0 : F.status) === j(he).enum.DRAFT ? ($(), O(se, { key: 0 }, [
1628
1647
  Je.value ? ($(), ce(le, {
1629
1648
  key: 0,
1630
1649
  "z-index": 51,
@@ -1634,41 +1653,41 @@ const ya = xt(
1634
1653
  ae(te(Je.value), 1)
1635
1654
  ]),
1636
1655
  default: G(() => [
1637
- D(o, {
1656
+ A(s, {
1638
1657
  disabled: "",
1639
1658
  key: "approve key",
1640
1659
  label: "Approve",
1641
- onClick: t[5] || (t[5] = () => e.draft && B(b).approveDraft(e.draft, () => T("submitted")))
1660
+ onClick: t[5] || (t[5] = () => e.draft && j(b).approveDraft(e.draft, () => T("submitted")))
1642
1661
  })
1643
1662
  ]),
1644
1663
  _: 1
1645
- })) : ($(), ce(o, {
1664
+ })) : ($(), ce(s, {
1646
1665
  key: "approve key",
1647
1666
  label: "Approve",
1648
- onClick: t[6] || (t[6] = () => e.draft && B(b).approveDraft(e.draft, () => T("submitted")))
1667
+ onClick: t[6] || (t[6] = () => e.draft && j(b).approveDraft(e.draft, () => T("submitted")))
1649
1668
  }))
1650
1669
  ], 64)) : fe("", !0),
1651
- ((Q = e.draft) == null ? void 0 : Q.status) === B(he).enum.DRAFT ? ($(), ce(o, {
1670
+ ((Q = e.draft) == null ? void 0 : Q.status) === j(he).enum.DRAFT ? ($(), ce(s, {
1652
1671
  key: 1,
1653
1672
  label: "Reject",
1654
1673
  variant: "destructive",
1655
- onClick: t[7] || (t[7] = () => e.draft && B(b).rejectDraft(e.draft, () => T("submitted")))
1674
+ onClick: t[7] || (t[7] = () => e.draft && j(b).rejectDraft(e.draft, () => T("submitted")))
1656
1675
  })) : fe("", !0),
1657
- (Z = e.draft) != null && Z.approvedAt && ((pe = e.draft) == null ? void 0 : pe.status) !== B(he).enum.COMPLETED ? ($(), ce(Yt, { key: 2 }, {
1676
+ (Z = e.draft) != null && Z.approvedAt && ((pe = e.draft) == null ? void 0 : pe.status) !== j(he).enum.COMPLETED ? ($(), ce(Yt, { key: 2 }, {
1658
1677
  default: G(() => [
1659
- D(o, {
1678
+ A(s, {
1660
1679
  label: "Sync",
1661
- loading: _.value,
1680
+ loading: D.value,
1662
1681
  onClick: t[8] || (t[8] = () => {
1663
- e.draft && (_.value = !0, B(b).syncDraft(e.draft, () => {
1664
- _.value = !1, T("submitted");
1682
+ e.draft && (D.value = !0, j(b).syncDraft(e.draft, () => {
1683
+ D.value = !1, T("submitted");
1665
1684
  }));
1666
1685
  })
1667
1686
  }, null, 8, ["loading"])
1668
1687
  ]),
1669
1688
  _: 1
1670
1689
  })) : fe("", !0),
1671
- D(o, {
1690
+ A(s, {
1672
1691
  label: "Close",
1673
1692
  variant: "tertiary",
1674
1693
  onClick: t[9] || (t[9] = (Ce) => y.value = !1)
@@ -1679,14 +1698,14 @@ const ya = xt(
1679
1698
  default: G(() => [
1680
1699
  u("div", ba, [
1681
1700
  u("div", null, [
1682
- D(m, {
1701
+ A(m, {
1683
1702
  items: ve,
1684
1703
  modelValue: ge.value,
1685
1704
  "onUpdate:modelValue": t[0] || (t[0] = (F) => ge.value = F)
1686
1705
  }, null, 8, ["modelValue"])
1687
1706
  ]),
1688
- ge.value.value === "overview" ? ($(), H(se, { key: 0 }, [
1689
- D(n, {
1707
+ ge.value.value === "overview" ? ($(), O(se, { key: 0 }, [
1708
+ A(o, {
1690
1709
  variant: "outlined",
1691
1710
  class: "flex flex-col gap-8 px-12 py-16"
1692
1711
  }, {
@@ -1697,18 +1716,18 @@ const ya = xt(
1697
1716
  t[11] || (t[11] = u("div", { class: "fm-typo-en-body-lg-600" }, "Closing summary", -1)),
1698
1717
  u("div", ka, [
1699
1718
  u("div", {
1700
- class: Se(["fm-status-badge", B(Ve)(((F = l.draft) == null ? void 0 : F.status) ?? "DRAFT")])
1701
- }, te(B(Re)(((Q = l.draft) == null ? void 0 : Q.status) ?? "")), 3)
1719
+ class: Se(["fm-status-badge", j(Ve)(((F = i.draft) == null ? void 0 : F.status) ?? "DRAFT")])
1720
+ }, te(j(Re)(((Q = i.draft) == null ? void 0 : Q.status) ?? "")), 3)
1702
1721
  ])
1703
1722
  ]),
1704
- D(a),
1723
+ A(n),
1705
1724
  u("div", xa, [
1706
- ($(!0), H(se, null, $e(Te.value, (Z, pe) => ($(), H("div", {
1725
+ ($(!0), O(se, null, $e(Te.value, (Z, pe) => ($(), O("div", {
1707
1726
  class: "flex flex-col gap-4",
1708
1727
  key: pe
1709
1728
  }, [
1710
- u("div", Da, [
1711
- u("div", Aa, te(Z.label), 1)
1729
+ u("div", Aa, [
1730
+ u("div", Da, te(Z.label), 1)
1712
1731
  ]),
1713
1732
  u("div", _a, te(Z.value), 1)
1714
1733
  ]))), 128))
@@ -1720,8 +1739,8 @@ const ya = xt(
1720
1739
  u("div", wa, [
1721
1740
  u("div", Sa, [
1722
1741
  t[12] || (t[12] = u("div", { class: "flex-1 fm-typo-en-title-sm-600 text-fm-color-typo-primary" }, " Closing items ", -1)),
1723
- M.value ? fe("", !0) : ($(), H("div", Fa, [
1724
- l.draft && l.draft.status !== B(he).enum.COMPLETED ? ($(), ce(o, {
1742
+ M.value ? fe("", !0) : ($(), O("div", Fa, [
1743
+ i.draft && i.draft.status !== j(he).enum.COMPLETED ? ($(), ce(s, {
1725
1744
  key: 0,
1726
1745
  label: "Refresh balance",
1727
1746
  "prepend-icon": "refresh",
@@ -1732,52 +1751,52 @@ const ya = xt(
1732
1751
  loading: C.value,
1733
1752
  onClick: X
1734
1753
  }, null, 8, ["loading"])) : fe("", !0),
1735
- D(o, {
1754
+ A(s, {
1736
1755
  label: "Export data",
1737
1756
  "prepend-icon": "download",
1738
1757
  variant: "secondary",
1739
1758
  "text-color": "primary",
1740
1759
  "bg-color": "transparent",
1741
1760
  "border-color": "primary",
1742
- onClick: t[1] || (t[1] = (F) => l.draft ? B(b).exportDraft(
1743
- l.draft,
1761
+ onClick: t[1] || (t[1] = (F) => i.draft ? j(b).exportDraft(
1762
+ i.draft,
1744
1763
  R.value,
1745
1764
  N.value
1746
1765
  ) : null)
1747
1766
  })
1748
1767
  ]))
1749
1768
  ]),
1750
- M.value ? ($(), H("div", Ca, [
1769
+ M.value ? ($(), O("div", Ca, [
1751
1770
  t[14] || (t[14] = u("div", { class: "h-80" }, null, -1)),
1752
1771
  u("div", $a, [
1753
1772
  u("div", null, [
1754
- D(p, { size: "md" })
1773
+ A(p, { size: "md" })
1755
1774
  ]),
1756
1775
  t[13] || (t[13] = u("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, " Fetching info... ", -1))
1757
1776
  ]),
1758
1777
  t[15] || (t[15] = u("div", { class: "h-80" }, null, -1))
1759
- ])) : ($(), H(se, { key: 1 }, [
1778
+ ])) : ($(), O(se, { key: 1 }, [
1760
1779
  u("div", Ba, [
1761
1780
  u("div", ja, [
1762
- D(k, {
1781
+ A(k, {
1763
1782
  label: "Template Item(s)",
1764
- selected: P.value.templateItem,
1765
- onClick: t[2] || (t[2] = (F) => P.value.templateItem = !P.value.templateItem)
1783
+ selected: U.value.templateItem,
1784
+ onClick: t[2] || (t[2] = (F) => U.value.templateItem = !U.value.templateItem)
1766
1785
  }, null, 8, ["selected"]),
1767
- D(k, {
1786
+ A(k, {
1768
1787
  label: "Non-template Item(s)",
1769
- selected: P.value.nonTemplateItem,
1770
- onClick: t[3] || (t[3] = (F) => P.value.nonTemplateItem = !P.value.nonTemplateItem)
1788
+ selected: U.value.nonTemplateItem,
1789
+ onClick: t[3] || (t[3] = (F) => U.value.nonTemplateItem = !U.value.nonTemplateItem)
1771
1790
  }, null, 8, ["selected"])
1772
1791
  ]),
1773
- D(f, {
1792
+ A(f, {
1774
1793
  modelValue: we.value,
1775
1794
  "onUpdate:modelValue": t[4] || (t[4] = (F) => we.value = F),
1776
1795
  placeholder: "Filter items"
1777
1796
  }, null, 8, ["modelValue"])
1778
1797
  ]),
1779
- B(z).skuTags.size ? ($(), H("div", Ta, [
1780
- ($(!0), H(se, null, $e(B(z).skuTags.keys(), (F) => ($(), ce(k, {
1798
+ j(z).skuTags.size ? ($(), O("div", Ta, [
1799
+ ($(!0), O(se, null, $e(j(z).skuTags.keys(), (F) => ($(), ce(k, {
1781
1800
  key: `${F}`,
1782
1801
  label: `${F}`,
1783
1802
  selectable: "",
@@ -1808,8 +1827,8 @@ const ya = xt(
1808
1827
  u("div", {
1809
1828
  style: ft({ minWidth: `${je.value}px` })
1810
1829
  }, [
1811
- D(U, {
1812
- "column-defs": Ae.value,
1830
+ A(P, {
1831
+ "column-defs": De.value,
1813
1832
  "row-data": Fe.value,
1814
1833
  "search-value": we.value
1815
1834
  }, null, 8, ["column-defs", "row-data", "search-value"])
@@ -1818,9 +1837,9 @@ const ya = xt(
1818
1837
  ], 64))
1819
1838
  ])
1820
1839
  ], 64)) : fe("", !0),
1821
- ge.value.value === "history" ? ($(), H("div", Ua, [
1822
- ye.value.length ? ($(), H("div", Ra, [
1823
- ($(!0), H(se, null, $e(ye.value, (F, Q) => ($(), H(se, { key: Q }, [
1840
+ ge.value.value === "history" ? ($(), O("div", Ua, [
1841
+ ye.value.length ? ($(), O("div", Ra, [
1842
+ ($(!0), O(se, null, $e(ye.value, (F, Q) => ($(), O(se, { key: Q }, [
1824
1843
  u("div", Va, [
1825
1844
  u("div", La, [
1826
1845
  u("div", Na, [
@@ -1848,8 +1867,8 @@ const ya = xt(
1848
1867
  ])
1849
1868
  ]),
1850
1869
  u("div", za, [
1851
- u("div", Ha, te(F.header), 1),
1852
- u("div", Oa, te(F.date), 1)
1870
+ u("div", Oa, te(F.header), 1),
1871
+ u("div", Ha, te(F.date), 1)
1853
1872
  ])
1854
1873
  ]),
1855
1874
  u("div", Ya, [
@@ -1867,19 +1886,19 @@ const ya = xt(
1867
1886
  ])
1868
1887
  ]),
1869
1888
  u("div", Ga, [
1870
- D(n, {
1889
+ A(o, {
1871
1890
  variant: "outlined",
1872
1891
  class: "py-12 px-16"
1873
1892
  }, {
1874
1893
  default: G(() => [
1875
1894
  u("div", Wa, [
1876
- ($(!0), H(se, null, $e(F.info, (Z, pe) => ($(), H("div", {
1895
+ ($(!0), O(se, null, $e(F.info, (Z, pe) => ($(), O("div", {
1877
1896
  key: pe,
1878
1897
  class: "flex flex-col gap-4"
1879
1898
  }, [
1880
1899
  u("div", qa, te(Z == null ? void 0 : Z.label), 1),
1881
1900
  u("div", Za, [
1882
- ($(!0), H(se, null, $e(Z == null ? void 0 : Z.values, (Ce, Ie) => ($(), H("div", {
1901
+ ($(!0), O(se, null, $e(Z == null ? void 0 : Z.values, (Ce, Ie) => ($(), O("div", {
1883
1902
  key: Ie,
1884
1903
  class: "fm-typo-en-body-lg-600"
1885
1904
  }, te(Ce), 1))), 128))
@@ -1892,18 +1911,18 @@ const ya = xt(
1892
1911
  ])
1893
1912
  ])
1894
1913
  ], 64))), 128))
1895
- ])) : ($(), H("div", Pa, [
1896
- D(oe),
1914
+ ])) : ($(), O("div", Pa, [
1915
+ A(oe),
1897
1916
  u("div", null, [
1898
1917
  u("img", {
1899
- src: B(ta),
1918
+ src: j(ta),
1900
1919
  alt: "List is empty"
1901
1920
  }, null, 8, Ma)
1902
1921
  ]),
1903
1922
  t[16] || (t[16] = u("div", { class: "fm-typo-en-body-lg-600" }, te("No records found"), -1)),
1904
1923
  t[17] || (t[17] = u("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary px-16" }, te("You can track approval and rejection history here"), -1)),
1905
- D(oe),
1906
- D(oe)
1924
+ A(oe),
1925
+ A(oe)
1907
1926
  ]))
1908
1927
  ])) : fe("", !0)
1909
1928
  ])
@@ -1914,39 +1933,39 @@ const ya = xt(
1914
1933
  }
1915
1934
  }), tn = { class: "flex-1 flex flex-col gap-8" }, an = { class: "flex flex-col" }, nn = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, on = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, sn = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary line-clamp-2" }, rn = { class: "fm-typo-en-body-lg-400 line-clamp-2" }, bn = /* @__PURE__ */ Ne({
1916
1935
  __name: "ClosingDraftView",
1917
- setup(i) {
1918
- const { t: c } = kt(), { viewDraft: e } = Le(), { viewClosingDraftProps: d, viewClosingDraftShow: h } = ea(Le()), b = Ee(), y = ya(), M = Kt(), { breakpoints: C } = Xt();
1936
+ setup(l) {
1937
+ const { t: r } = kt(), { viewDraft: e } = Le(), { viewClosingDraftProps: d, viewClosingDraftShow: h } = ea(Le()), b = Ee(), y = ya(), M = Kt(), { breakpoints: C } = Xt();
1919
1938
  b.watchLocation(y.fetchDrafts);
1920
- const _ = L(() => y.loading), R = O(""), N = L(() => C.value.xs || C.value.sm), j = L(() => N.value ? 10 : 20);
1921
- function r(z) {
1939
+ const D = L(() => y.loading), R = H(""), N = L(() => C.value.xs || C.value.sm), B = L(() => N.value ? 10 : 20);
1940
+ function c(z) {
1922
1941
  switch (z) {
1923
1942
  case "refresh":
1924
1943
  return y.fetchDrafts();
1925
1944
  }
1926
1945
  }
1927
- function s(z) {
1946
+ function a(z) {
1928
1947
  return z;
1929
1948
  }
1930
- const A = L(() => N.value ? [
1949
+ const _ = L(() => N.value ? [
1931
1950
  {
1932
- label: c("inventory.common.refresh"),
1951
+ label: r("inventory.common.refresh"),
1933
1952
  value: "refresh",
1934
1953
  isPrimary: !1
1935
1954
  }
1936
1955
  ] : [
1937
1956
  {
1938
- label: c("inventory.common.refresh"),
1957
+ label: r("inventory.common.refresh"),
1939
1958
  value: "refresh",
1940
1959
  isPrimary: !1
1941
1960
  }
1942
1961
  ]);
1943
1962
  return (z, v) => {
1944
1963
  const g = E("FmTable");
1945
- return $(), H(se, null, [
1946
- D(Qt, {
1947
- title: B(c)("inventory.closing.draft.title"),
1948
- actions: A.value,
1949
- "onClick:action": r
1964
+ return $(), O(se, null, [
1965
+ A(Qt, {
1966
+ title: j(r)("inventory.closing.draft.title"),
1967
+ actions: _.value,
1968
+ "onClick:action": c
1950
1969
  }, {
1951
1970
  default: G(() => [
1952
1971
  u("div", {
@@ -1958,39 +1977,39 @@ const ya = xt(
1958
1977
  }
1959
1978
  ])
1960
1979
  }, [
1961
- D(Gt, {
1980
+ A(Gt, {
1962
1981
  "change-location": "",
1963
1982
  searchable: "",
1964
1983
  search: R.value,
1965
1984
  "onUpdate:search": v[0] || (v[0] = (w) => R.value = w)
1966
1985
  }, null, 8, ["search"]),
1967
- D(g, {
1968
- style: ft(B(M).tableHeight),
1969
- "column-defs": B(y).columnDefs,
1970
- "row-data": B(y).drafts,
1986
+ A(g, {
1987
+ style: ft(j(M).tableHeight),
1988
+ "column-defs": j(y).columnDefs,
1989
+ "row-data": j(y).drafts,
1971
1990
  "search-value": R.value,
1972
- loading: _.value,
1973
- onRowClick: v[1] || (v[1] = (w) => B(e)(w.original)),
1974
- "page-size": j.value
1991
+ loading: D.value,
1992
+ onRowClick: v[1] || (v[1] = (w) => j(e)(w.original)),
1993
+ "page-size": B.value
1975
1994
  }, {
1976
1995
  "list-row": G((w) => [
1977
- D(Wt, {
1996
+ A(Wt, {
1978
1997
  row: w,
1979
- onRowClick: (T) => B(e)(T)
1998
+ onRowClick: (T) => j(e)(T)
1980
1999
  }, {
1981
2000
  default: G((T) => {
1982
- var P, re, K, q, S, J, ue, X, ne, me, xe, De, ee, Ae, je, we, Fe, Te, ve, ge;
2001
+ var U, re, K, q, S, J, ue, X, ne, me, xe, Ae, ee, De, je, we, Fe, Te, ve, ge;
1983
2002
  return [
1984
2003
  u("div", tn, [
1985
2004
  u("div", an, [
1986
2005
  u("div", nn, [
1987
- D(B(Me), {
1988
- render: (K = (re = (P = T._id) == null ? void 0 : P.column) == null ? void 0 : re.columnDef) == null ? void 0 : K.cell,
2006
+ A(j(Me), {
2007
+ render: (K = (re = (U = T._id) == null ? void 0 : U.column) == null ? void 0 : re.columnDef) == null ? void 0 : K.cell,
1989
2008
  props: (S = (q = T._id) == null ? void 0 : q.getContext) == null ? void 0 : S.call(q)
1990
2009
  }, null, 8, ["render", "props"])
1991
2010
  ]),
1992
2011
  u("div", on, [
1993
- D(B(Me), {
2012
+ A(j(Me), {
1994
2013
  render: (X = (ue = (J = T.name) == null ? void 0 : J.column) == null ? void 0 : ue.columnDef) == null ? void 0 : X.cell,
1995
2014
  props: (me = (ne = T.name) == null ? void 0 : ne.getContext) == null ? void 0 : me.call(ne)
1996
2015
  }, null, 8, ["render", "props"])
@@ -2000,14 +2019,14 @@ const ya = xt(
2000
2019
  ...w.original.items.length >= 3 ? [`and ${w.original.items.length - 3} more items`] : []
2001
2020
  ].join(", ")), 1),
2002
2021
  u("div", rn, [
2003
- D(B(Me), {
2004
- render: (ee = (De = (xe = T.ref) == null ? void 0 : xe.column) == null ? void 0 : De.columnDef) == null ? void 0 : ee.cell,
2005
- props: (je = (Ae = T.ref) == null ? void 0 : Ae.getContext) == null ? void 0 : je.call(Ae)
2022
+ A(j(Me), {
2023
+ render: (ee = (Ae = (xe = T.ref) == null ? void 0 : xe.column) == null ? void 0 : Ae.columnDef) == null ? void 0 : ee.cell,
2024
+ props: (je = (De = T.ref) == null ? void 0 : De.getContext) == null ? void 0 : je.call(De)
2006
2025
  }, null, 8, ["render", "props"])
2007
2026
  ])
2008
2027
  ]),
2009
2028
  u("div", null, [
2010
- D(B(Me), {
2029
+ A(j(Me), {
2011
2030
  render: (Te = (Fe = (we = T.status) == null ? void 0 : we.column) == null ? void 0 : Fe.columnDef) == null ? void 0 : Te.cell,
2012
2031
  props: (ge = (ve = T.status) == null ? void 0 : ve.getContext) == null ? void 0 : ge.call(ve)
2013
2032
  }, null, 8, ["render", "props"])
@@ -2025,11 +2044,11 @@ const ya = xt(
2025
2044
  _: 1
2026
2045
  }, 8, ["title", "actions"]),
2027
2046
  ($(), ce(Tt, { to: "body" }, [
2028
- D(en, It(B(d), {
2029
- show: B(h),
2047
+ A(en, It(j(d), {
2048
+ show: j(h),
2030
2049
  "onUpdate:show": v[2] || (v[2] = (w) => dt(h) ? h.value = w : null),
2031
- onSubmitted: v[3] || (v[3] = () => (h.value = !1, B(y).fetchDrafts())),
2032
- onRefresh: v[4] || (v[4] = (w) => B(y).updateDraftRef(w))
2050
+ onSubmitted: v[3] || (v[3] = () => (h.value = !1, j(y).fetchDrafts())),
2051
+ onRefresh: v[4] || (v[4] = (w) => j(y).updateDraftRef(w))
2033
2052
  }), null, 16, ["show"])
2034
2053
  ]))
2035
2054
  ], 64);