@feedmepos/mf-inventory-portal 1.2.47 → 1.2.48

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 (67) hide show
  1. package/dist/{App-JsgP9iMu.js → App-DPGaFV4B.js} +3 -3
  2. package/dist/{ApprovalView-Co6sACH5.js → ApprovalView-833HS5kH.js} +5 -5
  3. package/dist/{BindingsDialog-B73QXq1j.js → BindingsDialog-ChODu5A1.js} +2 -2
  4. package/dist/{BindingsPicker-DuMTRelf.js → BindingsPicker-DvX4GyKv.js} +2 -2
  5. package/dist/{BindingsTable-CcYQN1_L.js → BindingsTable-DNAiQ3jC.js} +3 -3
  6. package/dist/{ClosingDraftView-D3INnwT_.js → ClosingDraftView-BNmLpJEn.js} +376 -365
  7. package/dist/{ClosingHistoryView-CSjxazA8.js → ClosingHistoryView-BWCsFzL4.js} +3 -3
  8. package/dist/{ClosingTemplateView-Ct0GFJ7D.js → ClosingTemplateView-oZwROzRq.js} +14 -14
  9. package/dist/{DeliveryOrderPrintPreview-BS50CpKI.js → DeliveryOrderPrintPreview-CgF6Ah_t.js} +1 -1
  10. package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-Bi9iqGTu.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-COu3S25S.js} +4 -4
  11. package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-CRUsPKK3.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-Br-AzVal.js} +2 -2
  12. package/dist/{FmMultiselectDialog-B_aNaPp3.js → FmMultiselectDialog-BcnuMvBx.js} +2 -2
  13. package/dist/{FmMultiselectDialog-CaUUBqDA.js → FmMultiselectDialog-nOXJfHcT.js} +1 -1
  14. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-CQqGUFIx.js → FmUnitInput.vue_vue_type_script_setup_true_lang-B0TLNBD_.js} +3 -3
  15. package/dist/{ImportView-KjHa3RPH.js → ImportView-DiCAaSmP.js} +6 -6
  16. package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-BBaVY_DM.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-CjzJ3O5a.js} +1 -1
  17. package/dist/{IngredientGroupView-DPM9zcrM.js → IngredientGroupView-DJ_gq48z.js} +5 -5
  18. package/dist/{IngredientsView-DJGeVNXg.js → IngredientsView-B2tdcbaR.js} +14 -14
  19. package/dist/{IntegrationView-C1-xqYQI.js → IntegrationView-siGNamS4.js} +12 -12
  20. package/dist/{InventoryBindingForm-B57y7_jC.js → InventoryBindingForm-CMH2losI.js} +1 -1
  21. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-CHTnMNKl.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-D68w7k0f.js} +4 -4
  22. package/dist/{InventoryBindingSummary-Df70IKSg.js → InventoryBindingSummary-DAGsx_Mo.js} +1 -1
  23. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DWe54YRe.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-Cyl5cUO6.js} +1 -1
  24. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-BgCCrM-_.js → PremiumBadge.vue_vue_type_script_setup_true_lang-CNze8ZJ7.js} +2 -2
  25. package/dist/{PublishView-C5YHhPwg.js → PublishView-D1AKbuKs.js} +3 -3
  26. package/dist/{PurchaseOrderPrintPreview-BjopVTxs.js → PurchaseOrderPrintPreview-BzGcJK1f.js} +1 -1
  27. package/dist/{ReceiveRequestView-huk0yTuo.js → ReceiveRequestView-hvDCU729.js} +18 -18
  28. package/dist/{RecipeView-B2jYchFP.js → RecipeView-BcnjGf_a.js} +8 -8
  29. package/dist/{StockView-BhttACCV.js → StockView-DdgYT4_P.js} +15 -15
  30. package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-DvviBt_n.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-DRPzgTm4.js} +1 -1
  31. package/dist/{SupplierView-6Vxxq9GN.js → SupplierView-LRNOgWQk.js} +11 -11
  32. package/dist/{SystemTrailDialog.vue_vue_type_script_setup_true_lang-C_nItuSz.js → SystemTrailDialog.vue_vue_type_script_setup_true_lang-CQJJ3XRC.js} +2 -2
  33. package/dist/{TemplatePublishDialog.vue_vue_type_script_setup_true_lang-Den4pUf9.js → TemplatePublishDialog.vue_vue_type_script_setup_true_lang-KBs8Dq8C.js} +1 -1
  34. package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-CmI0k0v2.js → TransferDetails.vue_vue_type_script_setup_true_lang-bP-1-mLN.js} +14 -14
  35. package/dist/{TransferTemplateView-_WTnebCR.js → TransferTemplateView-Dp2W2doS.js} +15 -15
  36. package/dist/{UnitView-BeP9MpmK.js → UnitView-N5l93VfY.js} +6 -6
  37. package/dist/{WarehouseView-pdM7HFYr.js → WarehouseView-D7FGBKUP.js} +5 -5
  38. package/dist/{WastageTemplateView-a4twoJLB.js → WastageTemplateView-BmSNPRPI.js} +14 -14
  39. package/dist/{app-D-WXtKYn.js → app-CfCaSzjl.js} +7 -7
  40. package/dist/app.js +1 -1
  41. package/dist/{closing-template-O7lUhol7.js → closing-template-CJ4VCKvB.js} +1 -1
  42. package/dist/{date2-DkEAKP8N.js → date2-BcmOfaME.js} +1 -1
  43. package/dist/{dayjs.min-DF1VUh0Q.js → dayjs.min-CiFpY16f.js} +1 -1
  44. package/dist/{decimal-CL_qgPqL.js → decimal-DtLL5qsA.js} +2 -2
  45. package/dist/{defineDeepModel-xcAkDmDA.js → defineDeepModel-DBV1M6fx.js} +1 -1
  46. package/dist/{duplicate-template-TY54cIdK.js → duplicate-template-DjhY01M8.js} +1 -1
  47. package/dist/{feature-Dw3PJCX9.js → feature-0OR7WTHu.js} +2 -2
  48. package/dist/{format-time-from-id-Ceptcl3U.js → format-time-from-id-DATUhiz_.js} +1 -1
  49. package/dist/{format-unit-display-GRZQIgFD.js → format-unit-display-9qQdeD4R.js} +10 -10
  50. package/dist/{import-export.helper-Bl-r_RxV.js → import-export.helper-isWO7OKw.js} +5 -5
  51. package/dist/{index-D-_4dS91.js → index-BvtrCC8o.js} +1 -1
  52. package/dist/{index-CEbidibW.js → index-CG0HXAUt.js} +3 -3
  53. package/dist/{index-Dgk8_4hY.js → index-YLMXpUuG.js} +1 -1
  54. package/dist/{lodash-efdnV3n2.js → lodash-D1GaTimh.js} +1 -1
  55. package/dist/{netsuite-D4yOOSrW.js → netsuite-C3C6Uju7.js} +3 -3
  56. package/dist/{purchase-order-template-Dvs3YVVH.js → purchase-order-template-C8k-zHLA.js} +1 -1
  57. package/dist/{rules-BsrasJ6a.js → rules-DCfupVMX.js} +3 -3
  58. package/dist/{stock-BITU59fq.js → stock-AXiQCAeU.js} +3 -3
  59. package/dist/{stock-D0WV9zWp.js → stock-BwYeYuFG.js} +1 -1
  60. package/dist/{supplier-DSUvpEyd.js → supplier-p9r9OqFz.js} +2 -2
  61. package/dist/{use-ingredient-select-dialog-CNpU0tfI.js → use-ingredient-select-dialog-Cpmsu92V.js} +2 -2
  62. package/dist/{use-inventory-binding-dialog-D7s2C-xQ.js → use-inventory-binding-dialog-BPm1TXkw.js} +2 -2
  63. package/dist/{use-template-enabled-locations-2-bflR8fp7.js → use-template-enabled-locations-2-Batk5Jq7.js} +2 -2
  64. package/dist/{vue-i18n-j0rHGXSn.js → vue-i18n-Xu3ISvbS.js} +430 -430
  65. package/dist/{xlsx-CgB84NXq.js → xlsx-DTdVIUTe.js} +398 -398
  66. package/dist/{xlsx.util-DeZhqfVV.js → xlsx.util-twnxgS4l.js} +1 -1
  67. package/package.json +1 -1
@@ -1,48 +1,48 @@
1
- import { defineComponent as Te, ref as q, computed as P, onMounted as Xe, resolveComponent as K, openBlock as x, createElementBlock as V, Fragment as ie, createTextVNode as ce, createBlock as de, withCtx as Y, createElementVNode as n, toDisplayString as X, unref as v, createVNode as k, createCommentVNode as ne, h as F, watch as Ne, renderList as Ce, reactive as Pt, isRef as yt, normalizeClass as $e, normalizeStyle as bt, Teleport as Mt, mergeProps as Lt } from "vue";
1
+ import { defineComponent as Te, ref as q, computed as V, onMounted as Xe, resolveComponent as K, openBlock as x, createElementBlock as P, Fragment as ie, createTextVNode as ce, createBlock as ue, withCtx as Y, createElementVNode as n, toDisplayString as X, unref as v, createVNode as k, createCommentVNode as te, h as F, watch as Ne, renderList as Ce, reactive as Vt, isRef as gt, normalizeClass as $e, normalizeStyle as bt, Teleport as Mt, mergeProps as Lt } from "vue";
2
2
  import { F as Ze, u as Nt, _ as Et } from "./SingleColumnLayout.vue_vue_type_script_setup_true_lang-CWZkVCAj.js";
3
3
  import { useCoreStore as ht, useI18n as kt } from "@feedmepos/mf-common";
4
4
  import { useSnackbar as et, useDialog as zt, components as be, useProxiedModel as Ht, useBreakpoints as Ot } from "@feedmepos/ui-library";
5
- import { o as Kt, u as Ye, I as W, s as H, J as _t, K as De, A as Ee, v as ze, c as Yt, a as xt } from "./app-D-WXtKYn.js";
5
+ import { o as Kt, u as Ye, I as W, s as H, J as _t, K as he, A as Ee, v as ze, c as Yt, a as xt } from "./app-CfCaSzjl.js";
6
6
  import { defineStore as Dt, storeToRefs as Qt } from "pinia";
7
- import { d as Oe, e as At, f as qt, a as xe } from "./date2-DkEAKP8N.js";
8
- import { R as Gt, f as tt, a as Je, t as Wt, d as Be, o as wt, p as St, m as Ft, l as Zt } from "./rules-BsrasJ6a.js";
9
- import { b as Jt, d as Xt } from "./xlsx.util-DeZhqfVV.js";
10
- import { u as Ct } from "./stock-BITU59fq.js";
11
- import { u as at } from "./stock-D0WV9zWp.js";
12
- import { D as gt, R as Fe } from "./row-action.enum-BcW_L_nE.js";
7
+ import { d as Oe, e as At, f as qt, a as De } from "./date2-BcmOfaME.js";
8
+ import { R as Gt, f as tt, a as Je, t as Wt, d as Be, o as wt, p as St, m as Ft, l as Zt } from "./rules-DCfupVMX.js";
9
+ import { b as Jt, d as Xt } from "./xlsx.util-twnxgS4l.js";
10
+ import { u as Ct } from "./stock-AXiQCAeU.js";
11
+ import { u as at } from "./stock-BwYeYuFG.js";
12
+ import { D as yt, R as Fe } from "./row-action.enum-BcW_L_nE.js";
13
13
  import { c as ea, _ as ta, F as Le } from "./TableActionableRow.vue_vue_type_script_setup_true_lang-cfFHDIwQ.js";
14
- import { f as aa } from "./format-time-from-id-Ceptcl3U.js";
15
- import { _ as na } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-CRUsPKK3.js";
14
+ import { f as aa } from "./format-time-from-id-DATUhiz_.js";
15
+ import { _ as na } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-Br-AzVal.js";
16
16
  import { E as oa } from "./empty-placeholder-wf6-BWE8.js";
17
- import { u as sa } from "./vue-i18n-j0rHGXSn.js";
17
+ import { u as sa } from "./vue-i18n-Xu3ISvbS.js";
18
18
  const Qe = Kt((c, o) => {
19
19
  function e() {
20
20
  return Ye().currentLocation.dbName;
21
21
  }
22
22
  return {
23
23
  async getDraft(d) {
24
- const h = e(), y = `${c.inventoryBackendUrl}/${h}/closing-draft/${d}`;
25
- return o.get(y);
24
+ const h = e(), g = `${c.inventoryBackendUrl}/${h}/closing-draft/${d}`;
25
+ return o.get(g);
26
26
  },
27
27
  async readDrafts() {
28
28
  const d = e(), h = `${c.inventoryBackendUrl}/${d}/closing-draft`;
29
29
  return o.get(h);
30
30
  },
31
31
  async runOperation(d) {
32
- const h = e(), y = `${c.inventoryBackendUrl}/${h}/closing-draft/run-operation`;
33
- return o.post(y, d);
32
+ const h = e(), g = `${c.inventoryBackendUrl}/${h}/closing-draft/run-operation`;
33
+ return o.post(g, d);
34
34
  },
35
35
  async runOperationV1(d) {
36
- const h = e(), y = `${c.inventoryBackendUrl}/${h}/closing-draft/v1/run-operation`;
37
- return o.post(y, d);
36
+ const h = e(), g = `${c.inventoryBackendUrl}/${h}/closing-draft/v1/run-operation`;
37
+ return o.post(g, d);
38
38
  },
39
39
  async sync(d) {
40
- const h = e(), y = `${c.inventoryBackendUrl}/${h}/closing-draft/sync`;
41
- return o.post(y, d);
40
+ const h = e(), g = `${c.inventoryBackendUrl}/${h}/closing-draft/sync`;
41
+ return o.post(g, d);
42
42
  },
43
43
  async cloneDraft(d) {
44
- const h = e(), y = `${c.inventoryBackendUrl}/${h}/closing-draft/${d}/clone`;
45
- return o.post(y, {});
44
+ const h = e(), g = `${c.inventoryBackendUrl}/${h}/closing-draft/${d}/clone`;
45
+ return o.post(g, {});
46
46
  }
47
47
  };
48
48
  }), ra = { class: "fm-typo-en-body-lg-400" }, la = { class: "fm-typo-en-body-lg-600" }, ia = {
@@ -60,7 +60,7 @@ const Qe = Kt((c, o) => {
60
60
  onFinished: { type: Function }
61
61
  },
62
62
  setup(c) {
63
- const o = c, e = q(), d = Qe(), h = et(), y = q(!1), m = q(null), M = q(!1), U = P(() => {
63
+ const o = c, e = q(), d = Qe(), h = et(), g = q(!1), f = q(null), M = q(!1), U = V(() => {
64
64
  switch (o.action) {
65
65
  case W.enum.approveDraft:
66
66
  return "Approve";
@@ -70,7 +70,7 @@ const Qe = Kt((c, o) => {
70
70
  return "Mark as Failed";
71
71
  }
72
72
  throw new Error(`Unknown action: ${o.action}`);
73
- }), R = P(() => {
73
+ }), R = V(() => {
74
74
  switch (o.action) {
75
75
  case W.enum.approveDraft:
76
76
  return "primary";
@@ -83,45 +83,45 @@ const Qe = Kt((c, o) => {
83
83
  });
84
84
  Xe(() => {
85
85
  if (o.draft.effectiveAt)
86
- m.value = new Date(o.draft.effectiveAt);
86
+ f.value = new Date(o.draft.effectiveAt);
87
87
  else {
88
88
  const s = new Date(o.draft.createdAt);
89
- s.setHours(23, 59, 59, 999), m.value = s;
89
+ s.setHours(23, 59, 59, 999), f.value = s;
90
90
  }
91
91
  M.value = !0;
92
92
  });
93
- const _ = P({
93
+ const _ = V({
94
94
  get() {
95
- return m.value === null ? "" : Oe(m.value);
95
+ return f.value === null ? "" : Oe(f.value);
96
96
  },
97
97
  set(s) {
98
98
  if (s) {
99
99
  const t = /* @__PURE__ */ new Date(`${s} ${E.value}`);
100
- t.setSeconds(59, 999), m.value = t;
100
+ t.setSeconds(59, 999), f.value = t;
101
101
  } else
102
- m.value = null;
102
+ f.value = null;
103
103
  }
104
- }), E = P({
104
+ }), E = V({
105
105
  get() {
106
- return m.value === null ? "" : At(m.value);
106
+ return f.value === null ? "" : At(f.value);
107
107
  },
108
108
  set(s) {
109
109
  if (s) {
110
110
  const t = /* @__PURE__ */ new Date(`${_.value} ${s}`);
111
- t.setSeconds(59, 999), m.value = t;
111
+ t.setSeconds(59, 999), f.value = t;
112
112
  } else
113
- m.value = null;
113
+ f.value = null;
114
114
  }
115
- }), j = P(() => m.value ? m.value.getTime() > (/* @__PURE__ */ new Date()).getTime() : !1);
115
+ }), j = V(() => f.value ? f.value.getTime() > (/* @__PURE__ */ new Date()).getTime() : !1);
116
116
  async function G(s) {
117
- y.value = !0;
117
+ g.value = !0;
118
118
  try {
119
119
  s ? await d.runOperationV1({
120
120
  _id: o.draft._id,
121
121
  _rev: o.draft._rev ?? "",
122
122
  action: o.action,
123
123
  data: {
124
- effectiveAt: m.value ? m.value.toISOString() : null,
124
+ effectiveAt: f.value ? f.value.toISOString() : null,
125
125
  remark: e.value
126
126
  }
127
127
  }).delayed(500) : await d.runOperation({
@@ -129,7 +129,7 @@ const Qe = Kt((c, o) => {
129
129
  _rev: o.draft._rev ?? "",
130
130
  action: o.action,
131
131
  data: {
132
- effectiveAt: m.value ? m.value.toISOString() : null,
132
+ effectiveAt: f.value ? f.value.toISOString() : null,
133
133
  remark: e.value
134
134
  }
135
135
  }).delayed(500), h.open({
@@ -144,16 +144,16 @@ const Qe = Kt((c, o) => {
144
144
  type: "error"
145
145
  }), console.error("error on submit closing draft action", t);
146
146
  } finally {
147
- y.value = !1;
147
+ g.value = !1;
148
148
  }
149
149
  }
150
150
  return (s, t) => {
151
- const C = K("FmLabel"), I = K("FmDatePicker"), Z = K("FmTimePicker"), g = K("FmTextField"), l = K("FmButton"), $ = K("FmForm");
152
- return M.value ? (x(), de($, {
151
+ const C = K("FmLabel"), I = K("FmDatePicker"), Z = K("FmTimePicker"), y = K("FmTextField"), l = K("FmButton"), $ = K("FmForm");
152
+ return M.value ? (x(), ue($, {
153
153
  key: 1,
154
154
  onValidationSuccess: G,
155
155
  class: "flex flex-col gap-32",
156
- disabled: y.value
156
+ disabled: g.value
157
157
  }, {
158
158
  default: Y(() => [
159
159
  n("div", ra, [
@@ -161,7 +161,7 @@ const Qe = Kt((c, o) => {
161
161
  n("span", la, X(U.value), 1),
162
162
  t[6] || (t[6] = ce(" this draft. Please provide a remark to justify this action. "))
163
163
  ]),
164
- s.action === v(W).enum.approveDraft ? (x(), V("div", ia, [
164
+ s.action === v(W).enum.approveDraft ? (x(), P("div", ia, [
165
165
  k(C, { class: "fm-typo-en-body-lg-600" }, {
166
166
  default: Y(() => t[7] || (t[7] = [
167
167
  ce("Closing Date")
@@ -183,9 +183,9 @@ const Qe = Kt((c, o) => {
183
183
  modelValue: E.value,
184
184
  "onUpdate:modelValue": t[1] || (t[1] = (z) => E.value = z)
185
185
  }, null, 8, ["modelValue"]),
186
- j.value ? (x(), V("div", ca, " Cannot select future date ")) : ne("", !0)
187
- ])) : ne("", !0),
188
- k(g, {
186
+ j.value ? (x(), P("div", ca, " Cannot select future date ")) : te("", !0)
187
+ ])) : te("", !0),
188
+ k(y, {
189
189
  modelValue: e.value,
190
190
  "onUpdate:modelValue": t[2] || (t[2] = (z) => e.value = z),
191
191
  label: "Remark",
@@ -198,29 +198,29 @@ const Qe = Kt((c, o) => {
198
198
  variant: "tertiary",
199
199
  onClick: t[3] || (t[3] = (z) => s.onCancel())
200
200
  }),
201
- s.action === v(W).enum.approveDraft ? (x(), de(Ze, { key: 0 }, {
201
+ s.action === v(W).enum.approveDraft ? (x(), ue(Ze, { key: 0 }, {
202
202
  default: Y(() => [
203
203
  k(l, {
204
204
  label: "Approve (Legacy)",
205
205
  type: "button",
206
206
  onClick: t[4] || (t[4] = (z) => G(!0)),
207
207
  variant: R.value,
208
- loading: y.value,
208
+ loading: g.value,
209
209
  disabled: j.value
210
210
  }, null, 8, ["variant", "loading", "disabled"])
211
211
  ]),
212
212
  _: 1
213
- })) : ne("", !0),
213
+ })) : te("", !0),
214
214
  k(l, {
215
215
  label: U.value,
216
216
  type: "submit",
217
217
  variant: R.value,
218
- loading: y.value
218
+ loading: g.value
219
219
  }, null, 8, ["label", "variant", "loading"])
220
220
  ])
221
221
  ]),
222
222
  _: 1
223
- }, 8, ["disabled"])) : (x(), V(ie, { key: 0 }, [
223
+ }, 8, ["disabled"])) : (x(), P(ie, { key: 0 }, [
224
224
  ce("Loading")
225
225
  ], 64));
226
226
  };
@@ -229,28 +229,28 @@ const Qe = Kt((c, o) => {
229
229
  function $t(c) {
230
230
  const o = c.measurementsAmounts.groupBy((d) => d.measurement.id), e = c.sku.unit.measurements.reduce((d, h) => {
231
231
  var M, U;
232
- const y = ((U = (M = o.get(h.id)) == null ? void 0 : M[0]) == null ? void 0 : U.amount) ?? da, m = tt(h.conversion, y);
233
- return d + +Je(m);
232
+ const g = ((U = (M = o.get(h.id)) == null ? void 0 : M[0]) == null ? void 0 : U.amount) ?? da, f = tt(h.conversion, g);
233
+ return d + +Je(f);
234
234
  }, +Je(c.baseAmount));
235
235
  return Wt(e, c.baseAmount.precision);
236
236
  }
237
237
  const ma = Be(0), fa = Be(100), Bt = "N/A";
238
- function pa(c, o, e, d, h, y) {
239
- var te, oe, w, ee, me;
240
- const m = $t(c), M = d ?? m, U = wt(M, o), R = o.amount === 0 ? null : St(U, {
238
+ function pa(c, o, e, d, h, g) {
239
+ var ae, oe, w, ee, de;
240
+ const f = $t(c), M = d ?? f, U = wt(M, o), R = o.amount === 0 ? null : St(U, {
241
241
  ...o,
242
242
  amount: Math.abs(o.amount)
243
- }), _ = R ? tt(R, fa) : null, E = ((te = c.sku.defaultCost) == null ? void 0 : te.costPerUnit) ?? { amount: 0, precision: 0 }, j = Number(H.toFormatString({ value: E })), G = ((w = (oe = c.sku.defaultCost) == null ? void 0 : oe.measurement) == null ? void 0 : w.conversion) ?? {
243
+ }), _ = R ? tt(R, fa) : null, E = ((ae = c.sku.defaultCost) == null ? void 0 : ae.costPerUnit) ?? { amount: 0, precision: 0 }, j = Number(H.toFormatString({ value: E })), G = ((w = (oe = c.sku.defaultCost) == null ? void 0 : oe.measurement) == null ? void 0 : w.conversion) ?? {
244
244
  amount: 1,
245
245
  precision: 0
246
246
  }, s = Number(
247
247
  H.toFormatString({ value: G })
248
- ), t = h ? Number(H.toFormatString({ value: h })) : 0, C = Number(H.toFormatString({ value: o })), I = Number(H.toFormatString({ value: M })), Z = C - I, g = Z * j / s, l = I * j / s, $ = C * j / s;
248
+ ), t = h ? Number(H.toFormatString({ value: h })) : 0, C = Number(H.toFormatString({ value: o })), I = Number(H.toFormatString({ value: M })), Z = C - I, y = Z * j / s, l = I * j / s, $ = C * j / s;
249
249
  return {
250
250
  code: c.sku.code,
251
251
  name: c.sku.name,
252
252
  baseUnit: c.sku.unit.abbrev,
253
- costUnit: ((me = (ee = c.sku.defaultCost) == null ? void 0 : ee.measurement) == null ? void 0 : me.abbrev) ?? null,
253
+ costUnit: ((de = (ee = c.sku.defaultCost) == null ? void 0 : ee.measurement) == null ? void 0 : de.abbrev) ?? null,
254
254
  baseUnitAmount: Number(H.toFormatString({ value: c.baseAmount })),
255
255
  ...c.measurementsAmounts.filter(
256
256
  (A) => va(A.measurement) && e.includes(A.measurement.id)
@@ -268,9 +268,9 @@ function pa(c, o, e, d, h, y) {
268
268
  ) : null,
269
269
  costPerUnit: j,
270
270
  opening: t,
271
- adjustmentTypes: y ?? Bt,
271
+ adjustmentTypes: g ?? Bt,
272
272
  varianceQty: Z,
273
- varianceInCost: g,
273
+ varianceInCost: y,
274
274
  stockTakeValue: l,
275
275
  systemValue: $
276
276
  };
@@ -278,7 +278,7 @@ function pa(c, o, e, d, h, y) {
278
278
  function va(c) {
279
279
  return !c.abbrev.toLocaleLowerCase().includes("inactive");
280
280
  }
281
- function ga(c) {
281
+ function ya(c) {
282
282
  const o = Tt(c);
283
283
  return c.reduce(
284
284
  (e, d) => {
@@ -294,7 +294,7 @@ function Tt(c) {
294
294
  (o) => o.measurementsAmounts.filter((e) => !e.measurement.abbrev.toLocaleLowerCase().includes("inactive")).map((e) => e.measurement.id)
295
295
  );
296
296
  }
297
- function ya(c) {
297
+ function ga(c) {
298
298
  const o = _t(), e = o === "MYR" ? "RM" : o;
299
299
  return [
300
300
  {
@@ -361,55 +361,55 @@ function ya(c) {
361
361
  id: "baseUnitAmount",
362
362
  name: "Base unit amount"
363
363
  },
364
- ...Array.from({ length: c }).flatMap((h, y) => [
364
+ ...Array.from({ length: c }).flatMap((h, g) => [
365
365
  {
366
- id: `measurementAmount${y}`,
367
- name: `UOM amount ${y + 1}`
366
+ id: `measurementAmount${g}`,
367
+ name: `UOM amount ${g + 1}`
368
368
  },
369
369
  {
370
- id: `measurementAbbrev${y}`,
371
- name: `UOM ${y + 1}`
370
+ id: `measurementAbbrev${g}`,
371
+ name: `UOM ${g + 1}`
372
372
  }
373
373
  ])
374
374
  ];
375
375
  }
376
376
  function ba(c, o, e) {
377
- var Z, g, l, $, z, te, oe;
377
+ var Z, y, l, $, z, ae, oe;
378
378
  const d = o.groupBy(
379
379
  (w) => w.id,
380
380
  (w) => w.balance
381
381
  ), h = e.groupBy(
382
382
  (w) => w.id,
383
383
  (w) => w.balance
384
- ), y = /* @__PURE__ */ new Map();
384
+ ), g = /* @__PURE__ */ new Map();
385
385
  if (c.opening)
386
386
  for (const w of c.opening)
387
- y.set(w.skuId, w.balance);
388
- const m = /* @__PURE__ */ new Map();
387
+ g.set(w.skuId, w.balance);
388
+ const f = /* @__PURE__ */ new Map();
389
389
  if (c.adjustmentSnapshot)
390
390
  for (const w of c.adjustmentSnapshot) {
391
391
  const ee = Object.keys(w.adjustmentsByType).join(", ");
392
- m.set(w.skuId, ee || Bt);
392
+ f.set(w.skuId, ee || Bt);
393
393
  }
394
394
  const M = [...c.items, ...c.negativeStockItems ?? []], U = Tt(M), R = M.map((w) => {
395
395
  var J, O, re;
396
- const ee = ((J = d.get(w.sku._id)) == null ? void 0 : J[0]) ?? ma, me = ((O = U == null ? void 0 : U.get(w.sku._id)) == null ? void 0 : O[0]) ?? [], A = y.get(w.sku._id), D = m.get(w.sku._id);
396
+ const ee = ((J = d.get(w.sku._id)) == null ? void 0 : J[0]) ?? ma, de = ((O = U == null ? void 0 : U.get(w.sku._id)) == null ? void 0 : O[0]) ?? [], A = g.get(w.sku._id), D = f.get(w.sku._id);
397
397
  return pa(
398
398
  w,
399
399
  ee,
400
- me,
400
+ de,
401
401
  (re = h.get(w.sku._id)) == null ? void 0 : re[0],
402
402
  A,
403
403
  D
404
404
  );
405
- }), _ = ga(M), j = ht().currentBusiness.value, G = ya(_), s = [
405
+ }), _ = ya(M), j = ht().currentBusiness.value, G = ga(_), s = [
406
406
  ["Business name:", j == null ? void 0 : j.name],
407
407
  ["Business ID:", j == null ? void 0 : j._id],
408
408
  ["Menu version", j == null ? void 0 : j.menuVersion],
409
409
  ["Created at", new Date(c.createdAt)],
410
410
  ["Created by", (Z = c.createdBy) == null ? void 0 : Z.name],
411
411
  ["Updated at", new Date(c.updatedAt)],
412
- ["Updated by", (g = c.updatedBy) == null ? void 0 : g.name],
412
+ ["Updated by", (y = c.updatedBy) == null ? void 0 : y.name],
413
413
  ["Recent action", c.approvedAt ? "Approve" : c.rejectionHistory ? "Reject" : ""],
414
414
  [
415
415
  "Action by",
@@ -417,7 +417,7 @@ function ba(c, o, e) {
417
417
  ],
418
418
  [
419
419
  "Action at",
420
- c.approvedAt ? new Date(c.approvedAt) : c.rejectionHistory ? new Date((te = c.rejectionHistory[0]) == null ? void 0 : te.rejectedAt) : ""
420
+ c.approvedAt ? new Date(c.approvedAt) : c.rejectionHistory ? new Date((ae = c.rejectionHistory[0]) == null ? void 0 : ae.rejectedAt) : ""
421
421
  ],
422
422
  [
423
423
  "Action remark",
@@ -452,35 +452,35 @@ const ha = { class: "flex flex-col" }, ka = {
452
452
  }
453
453
  h.value = !0;
454
454
  });
455
- const y = P({
455
+ const g = V({
456
456
  get() {
457
457
  return d.value === null ? "" : Oe(d.value);
458
458
  },
459
459
  set(R) {
460
460
  if (R) {
461
- const _ = /* @__PURE__ */ new Date(`${R} ${m.value}`);
461
+ const _ = /* @__PURE__ */ new Date(`${R} ${f.value}`);
462
462
  _.setSeconds(59, 999), d.value = _;
463
463
  } else
464
464
  d.value = null;
465
465
  }
466
- }), m = P({
466
+ }), f = V({
467
467
  get() {
468
468
  return d.value === null ? "" : At(d.value);
469
469
  },
470
470
  set(R) {
471
471
  if (R) {
472
- const _ = /* @__PURE__ */ new Date(`${y.value} ${R}`);
472
+ const _ = /* @__PURE__ */ new Date(`${g.value} ${R}`);
473
473
  _.setSeconds(59, 999), d.value = _;
474
474
  } else
475
475
  d.value = null;
476
476
  }
477
- }), M = P(() => d.value ? d.value.getTime() > (/* @__PURE__ */ new Date()).getTime() : !1);
477
+ }), M = V(() => d.value ? d.value.getTime() > (/* @__PURE__ */ new Date()).getTime() : !1);
478
478
  async function U() {
479
479
  e.value = !0, o.onFinished(d.value.toISOString());
480
480
  }
481
481
  return (R, _) => {
482
482
  const E = K("FmLabel"), j = K("FmDatePicker"), G = K("FmTimePicker"), s = K("FmButton"), t = K("FmForm");
483
- return h.value ? (x(), de(t, {
483
+ return h.value ? (x(), ue(t, {
484
484
  key: 1,
485
485
  onValidationSuccess: U,
486
486
  class: "flex flex-col gap-32",
@@ -507,8 +507,8 @@ const ha = { class: "flex flex-col" }, ka = {
507
507
  _: 1
508
508
  }),
509
509
  k(j, {
510
- modelValue: y.value,
511
- "onUpdate:modelValue": _[0] || (_[0] = (C) => y.value = C),
510
+ modelValue: g.value,
511
+ "onUpdate:modelValue": _[0] || (_[0] = (C) => g.value = C),
512
512
  max: v(Oe)(/* @__PURE__ */ new Date())
513
513
  }, null, 8, ["modelValue", "max"]),
514
514
  k(E, { class: "fm-typo-en-body-lg-600" }, {
@@ -518,10 +518,10 @@ const ha = { class: "flex flex-col" }, ka = {
518
518
  _: 1
519
519
  }),
520
520
  k(G, {
521
- modelValue: m.value,
522
- "onUpdate:modelValue": _[1] || (_[1] = (C) => m.value = C)
521
+ modelValue: f.value,
522
+ "onUpdate:modelValue": _[1] || (_[1] = (C) => f.value = C)
523
523
  }, null, 8, ["modelValue"]),
524
- M.value ? (x(), V("div", ka, " Cannot select future date ")) : ne("", !0)
524
+ M.value ? (x(), P("div", ka, " Cannot select future date ")) : te("", !0)
525
525
  ]),
526
526
  n("div", _a, [
527
527
  k(s, {
@@ -539,7 +539,7 @@ const ha = { class: "flex flex-col" }, ka = {
539
539
  ])
540
540
  ]),
541
541
  _: 1
542
- }, 8, ["disabled"])) : (x(), V(ie, { key: 0 }, [
542
+ }, 8, ["disabled"])) : (x(), P(ie, { key: 0 }, [
543
543
  ce("Loading")
544
544
  ], 64));
545
545
  };
@@ -547,46 +547,46 @@ const ha = { class: "flex flex-col" }, ka = {
547
547
  }), Ke = Dt(
548
548
  "closingDraftActions",
549
549
  function() {
550
- const o = zt(), e = et(), d = at(), h = Qe(), y = Ct(), m = q(!1), M = q();
551
- function U(g) {
550
+ const o = zt(), e = et(), d = at(), h = Qe(), g = Ct(), f = q(!1), M = q();
551
+ function U(y) {
552
552
  const l = {
553
- draft: g
553
+ draft: y
554
554
  };
555
- M.value = l, m.value = !0;
555
+ M.value = l, f.value = !0;
556
556
  }
557
- async function R(g) {
557
+ async function R(y) {
558
558
  var $;
559
- if (g.status === De.enum.COMPLETED) {
560
- const z = g.closingAdjustmentId;
559
+ if (y.status === he.enum.COMPLETED) {
560
+ const z = y.closingAdjustmentId;
561
561
  if (!z)
562
562
  return e.open({
563
563
  title: "Something went wrong",
564
564
  message: "Closing draft is completed but closing document cannot be found.",
565
565
  type: "error"
566
566
  }), console.error("Closing draft is completed but closing document cannot be found.", {
567
- draftId: g._id
567
+ draftId: y._id
568
568
  }), [];
569
- const te = await d.readAdjustmentById(z);
570
- return ((te == null ? void 0 : te.skus) ?? []).map((w) => ({
569
+ const ae = await d.readAdjustmentById(z);
570
+ return ((ae == null ? void 0 : ae.skus) ?? []).map((w) => ({
571
571
  id: w.sku._id,
572
572
  balance: w.fromBalance,
573
573
  costs: w.fromCostBalances
574
574
  }));
575
575
  } else
576
- return await y.readStockBalance(), (($ = y.stockBalance) == null ? void 0 : $.skus) ?? [];
576
+ return await g.readStockBalance(), (($ = g.stockBalance) == null ? void 0 : $.skus) ?? [];
577
577
  }
578
- async function _(g, l, $) {
578
+ async function _(y, l, $) {
579
579
  l || (e.open({
580
580
  title: "Exporting",
581
581
  message: "Fetching data..."
582
- }), l = await R(g)), ba(g, l, $ ?? []);
582
+ }), l = await R(y)), ba(y, l, $ ?? []);
583
583
  }
584
- function E(g, l, $) {
584
+ function E(y, l, $) {
585
585
  o.open({
586
586
  title: "Approve draft",
587
587
  contentComponent: We,
588
588
  contentComponentProps: {
589
- draft: g,
589
+ draft: y,
590
590
  action: W.enum.approveDraft,
591
591
  onFinished: () => {
592
592
  o.close(), l == null || l();
@@ -599,12 +599,12 @@ const ha = { class: "flex flex-col" }, ka = {
599
599
  $ == null || $();
600
600
  });
601
601
  }
602
- function j(g, l) {
602
+ function j(y, l) {
603
603
  o.open({
604
604
  title: "Reject draft",
605
605
  contentComponent: We,
606
606
  contentComponentProps: {
607
- draft: g,
607
+ draft: y,
608
608
  action: W.enum.rejectDraft,
609
609
  onFinished: () => {
610
610
  o.close(), l == null || l();
@@ -613,12 +613,12 @@ const ha = { class: "flex flex-col" }, ka = {
613
613
  }
614
614
  });
615
615
  }
616
- function G(g, l) {
616
+ function G(y, l) {
617
617
  o.open({
618
618
  title: "Mark draft as failed",
619
619
  contentComponent: We,
620
620
  contentComponentProps: {
621
- draft: g,
621
+ draft: y,
622
622
  action: W.enum.markAsFailed,
623
623
  onFinished: () => {
624
624
  o.close(), l == null || l();
@@ -627,13 +627,13 @@ const ha = { class: "flex flex-col" }, ka = {
627
627
  }
628
628
  });
629
629
  }
630
- async function s(g, l) {
630
+ async function s(y, l) {
631
631
  await h.sync({
632
- _id: g._id,
633
- _rev: g._rev ?? "",
632
+ _id: y._id,
633
+ _rev: y._rev ?? "",
634
634
  action: W.enum.approveDraft,
635
635
  data: {
636
- remark: g.remark ?? ""
636
+ remark: y.remark ?? ""
637
637
  }
638
638
  }).delayed(500), e.open({
639
639
  title: "Success",
@@ -642,14 +642,14 @@ const ha = { class: "flex flex-col" }, ka = {
642
642
  }), l == null || l();
643
643
  }
644
644
  function t() {
645
- m.value = !1;
645
+ f.value = !1;
646
646
  }
647
- async function C(g, l, $) {
647
+ async function C(y, l, $) {
648
648
  await o.open({
649
649
  title: "Refresh balance",
650
650
  contentComponent: xa,
651
651
  contentComponentProps: {
652
- draft: g,
652
+ draft: y,
653
653
  onFinished: (z) => {
654
654
  o.close(), $ == null || $(z);
655
655
  },
@@ -659,26 +659,26 @@ const ha = { class: "flex flex-col" }, ka = {
659
659
  }
660
660
  });
661
661
  }
662
- async function I(g) {
662
+ async function I(y) {
663
663
  await o.open({
664
664
  title: "Invalidate closing draft cache",
665
665
  message: "It will invalidate opening and stock movement cache for this draft.",
666
666
  primaryActions: { text: "Proceed", close: !0 },
667
667
  secondaryActions: { text: "Cancel", close: !0 }
668
668
  }).onPrimary(async () => {
669
- await d.recalculation.scheduleInvalidateClosingDraftCache([g._id]), e.open({
669
+ await d.recalculation.scheduleInvalidateClosingDraftCache([y._id]), e.open({
670
670
  title: "Success",
671
671
  message: "Invalidate cache requested",
672
672
  type: "success"
673
673
  });
674
674
  });
675
675
  }
676
- async function Z(g, l) {
676
+ async function Z(y, l) {
677
677
  try {
678
678
  e.open({
679
679
  title: "Cloning",
680
680
  message: "Creating a copy of the draft..."
681
- }), await h.cloneDraft(g._id), e.open({
681
+ }), await h.cloneDraft(y._id), e.open({
682
682
  title: "Success",
683
683
  message: "Draft cloned successfully",
684
684
  type: "success"
@@ -701,7 +701,7 @@ const ha = { class: "flex flex-col" }, ka = {
701
701
  exportDraft: _,
702
702
  refreshBalance: C,
703
703
  cloneDraft: Z,
704
- viewClosingDraftShow: m,
704
+ viewClosingDraftShow: f,
705
705
  viewClosingDraftProps: M,
706
706
  invalidateDraftCache: I
707
707
  };
@@ -722,23 +722,23 @@ function He(c) {
722
722
  const Da = Dt(
723
723
  "closingDraftTable",
724
724
  function() {
725
- const { t: o } = kt(), e = ht(), d = Ke(), h = q(new Array()), y = q(!1), m = Ye(), M = Qe();
725
+ const { t: o } = kt(), e = ht(), d = Ke(), h = q(new Array()), g = q(!1), f = Ye(), M = Qe();
726
726
  async function U() {
727
- if (h.value = [], !!m._currentLocation) {
728
- y.value = !0;
727
+ if (h.value = [], !!f._currentLocation) {
728
+ g.value = !0;
729
729
  try {
730
730
  const [s] = await Promise.all([M.readDrafts()]).delayed(1e3);
731
731
  h.value = s.reverse();
732
732
  } catch (s) {
733
733
  console.log("Something went wrong when fetching drafts:", s);
734
734
  } finally {
735
- y.value = !1;
735
+ g.value = !1;
736
736
  }
737
737
  }
738
738
  }
739
739
  async function R(s) {
740
- if (!h.value.find((t) => t._id) && m._currentLocation) {
741
- y.value = !0;
740
+ if (!h.value.find((t) => t._id) && f._currentLocation) {
741
+ g.value = !0;
742
742
  try {
743
743
  const [t] = await Promise.all([
744
744
  M.getDraft(s),
@@ -748,7 +748,7 @@ const Da = Dt(
748
748
  } catch (t) {
749
749
  console.log("Something went wrong when fetching drafts:", t);
750
750
  } finally {
751
- y.value = !1;
751
+ g.value = !1;
752
752
  }
753
753
  }
754
754
  }
@@ -794,14 +794,14 @@ const Da = Dt(
794
794
  cell(s) {
795
795
  const t = s.row.original;
796
796
  let C = s.getValue();
797
- return C || (C = Ee(t._id)), xe(C);
797
+ return C || (C = Ee(t._id)), De(C);
798
798
  },
799
799
  enableSorting: !0,
800
800
  size: 200
801
801
  },
802
802
  {
803
803
  id: "updatedAt",
804
- accessorFn: (s) => xe(s.updatedAt),
804
+ accessorFn: (s) => De(s.updatedAt),
805
805
  header: () => "Updated at",
806
806
  enableSorting: !0,
807
807
  size: 200
@@ -841,8 +841,8 @@ const Da = Dt(
841
841
  enableSorting: !1,
842
842
  cell(s) {
843
843
  var l;
844
- const t = s.row.original, C = t.status, I = new Date(t.updatedAt), Z = (l = t == null ? void 0 : t.rejectionHistory) == null ? void 0 : l.computeFirst(($) => $.rejectedAt), g = Z ? new Date(Z) : null;
845
- return C === "DRAFT" && g ? g.getTime() > I.getTime() ? F(
844
+ const t = s.row.original, C = t.status, I = new Date(t.updatedAt), Z = (l = t == null ? void 0 : t.rejectionHistory) == null ? void 0 : l.computeFirst(($) => $.rejectedAt), y = Z ? new Date(Z) : null;
845
+ return C === "DRAFT" && y ? y.getTime() > I.getTime() ? F(
846
846
  "div",
847
847
  {
848
848
  class: "flex"
@@ -886,8 +886,8 @@ const Da = Dt(
886
886
  cell(s) {
887
887
  var l;
888
888
  const t = s.row.original, C = ((l = e.sessionUser.value) == null ? void 0 : l.role.isAdmin) ?? !1, I = [
889
- gt[Fe.Details],
890
- gt[Fe.Export]
889
+ yt[Fe.Details],
890
+ yt[Fe.Export]
891
891
  ], Z = [
892
892
  {
893
893
  translationKey: "inventory.closing.draft.approveDraft",
@@ -904,7 +904,7 @@ const Da = Dt(
904
904
  color: "text-fm-color-typo-error",
905
905
  value: W.enum.markAsFailed
906
906
  }
907
- ], g = C && t.status !== De.enum.DRAFT ? [
907
+ ], y = C && t.status !== he.enum.DRAFT ? [
908
908
  {
909
909
  translationKey: "inventory.closing.draft.cloneDraft",
910
910
  color: "text-fm-color-typo-primary",
@@ -914,10 +914,10 @@ const Da = Dt(
914
914
  return ea(
915
915
  [
916
916
  ...I,
917
- ...t.status === De.enum.DRAFT ? Z : []
917
+ ...t.status === he.enum.DRAFT ? Z : []
918
918
  ],
919
919
  ($) => j($, t),
920
- g
920
+ y
921
921
  );
922
922
  },
923
923
  enableSorting: !1,
@@ -929,7 +929,7 @@ const Da = Dt(
929
929
  }
930
930
  ],
931
931
  drafts: h,
932
- loading: y,
932
+ loading: g,
933
933
  fetchDrafts: U,
934
934
  loadDraft: R,
935
935
  updateDraftRef: _
@@ -944,7 +944,7 @@ const Da = Dt(
944
944
  }, Ra = {
945
945
  key: 1,
946
946
  class: "text-fm-color-system-error-300 mr-1"
947
- }, Va = { class: "fm-typo-en-body-md-400" }, Pa = { class: "mt-4 flex gap-4" }, Ma = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary mb-4" }, La = {
947
+ }, Pa = { class: "fm-typo-en-body-md-400" }, Va = { class: "mt-4 flex gap-4" }, Ma = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary mb-4" }, La = {
948
948
  key: 0,
949
949
  class: "flex gap-4"
950
950
  }, Na = /* @__PURE__ */ Te({
@@ -957,12 +957,12 @@ const Da = Dt(
957
957
  },
958
958
  emits: ["update:show", "refresh", "approve"],
959
959
  setup(c, { emit: o }) {
960
- const { FmStepper: e, FmStep: d, FmDialog: h, FmButton: y } = be, { t: m } = sa(), M = xt(), U = c, R = o, _ = P(
960
+ const { FmStepper: e, FmStep: d, FmDialog: h, FmButton: g } = be, { t: f } = sa(), M = xt(), U = c, R = o, _ = V(
961
961
  () => {
962
962
  var A, D;
963
963
  return ((A = U.draft) == null ? void 0 : A.stockSnapshot) && ((D = U.draft) == null ? void 0 : D.stockSnapshot) !== void 0;
964
964
  }
965
- ), E = P(() => {
965
+ ), E = V(() => {
966
966
  var J, O, re;
967
967
  const A = ((J = U.draft) == null ? void 0 : J.items.map((Q) => ({
968
968
  id: Q.sku._id,
@@ -977,7 +977,7 @@ const Da = Dt(
977
977
  (Q, ve) => (Q[ve.id] = ve, Q),
978
978
  {}
979
979
  );
980
- }), j = P(
980
+ }), j = V(
981
981
  () => {
982
982
  var A, D, J;
983
983
  return (((J = (D = (A = U.draft) == null ? void 0 : A.stockSnapshot) == null ? void 0 : D.filter((O) => O.balance.amount < 0)) == null ? void 0 : J.map((O) => {
@@ -989,34 +989,34 @@ const Da = Dt(
989
989
  } : null;
990
990
  })) ?? []).filter((O) => O !== null);
991
991
  }
992
- ), G = P(() => {
992
+ ), G = V(() => {
993
993
  var A;
994
994
  return _.value ? ((A = j.value) == null ? void 0 : A.filter((D) => !E.value[D.id]).map((D) => D.id)) ?? [] : [];
995
- }), s = P({
995
+ }), s = V({
996
996
  get: () => U.show,
997
997
  set: (A) => R("update:show", A)
998
998
  }), t = q(1), C = () => t.value > 1, I = () => t.value > 2, Z = () => !1;
999
- function g(A) {
999
+ function y(A) {
1000
1000
  return A === 1 ? _.value : A === 2 ? G.value.length == 0 : !1;
1001
1001
  }
1002
- const l = P(() => !_.value || G.value.length > 0);
1002
+ const l = V(() => !_.value || G.value.length > 0);
1003
1003
  function $(A) {
1004
1004
  let D = A + 1;
1005
- for (; D <= 3 && g(D); ) D++;
1005
+ for (; D <= 3 && y(D); ) D++;
1006
1006
  return D > 3 ? 3 : D;
1007
1007
  }
1008
1008
  function z(A) {
1009
1009
  let D = A - 1;
1010
- for (; D >= 1 && g(D); ) D--;
1010
+ for (; D >= 1 && y(D); ) D--;
1011
1011
  return D < 1 ? 1 : D;
1012
1012
  }
1013
- function te() {
1013
+ function ae() {
1014
1014
  return _.value ? l.value ? 3 : 2 : 1;
1015
1015
  }
1016
1016
  Ne(
1017
1017
  () => U.show,
1018
1018
  (A) => {
1019
- A && (t.value = te());
1019
+ A && (t.value = ae());
1020
1020
  }
1021
1021
  ), Ne(
1022
1022
  () => _.value,
@@ -1038,18 +1038,18 @@ const Da = Dt(
1038
1038
  function ee() {
1039
1039
  t.value > 1 && (t.value = z(t.value));
1040
1040
  }
1041
- function me() {
1041
+ function de() {
1042
1042
  R("approve");
1043
1043
  }
1044
1044
  return (A, D) => {
1045
1045
  const J = K("FmIcon");
1046
- return x(), de(v(h), {
1046
+ return x(), ue(v(h), {
1047
1047
  modelValue: s.value,
1048
1048
  "onUpdate:modelValue": D[1] || (D[1] = (O) => s.value = O),
1049
1049
  "max-width": 600
1050
1050
  }, {
1051
1051
  "dialog-header": Y(() => [
1052
- n("div", Aa, X(v(m)("inventory.closing.approval.title")), 1)
1052
+ n("div", Aa, X(v(f)("inventory.closing.approval.title")), 1)
1053
1053
  ]),
1054
1054
  default: Y(() => [
1055
1055
  n("div", wa, [
@@ -1061,53 +1061,53 @@ const Da = Dt(
1061
1061
  default: Y(() => [
1062
1062
  k(v(d), {
1063
1063
  value: 1,
1064
- title: v(m)("inventory.closing.approval.step.generateReport.title"),
1064
+ title: v(f)("inventory.closing.approval.step.generateReport.title"),
1065
1065
  complete: C
1066
1066
  }, {
1067
1067
  default: Y(() => [
1068
- n("div", Sa, X(v(m)("inventory.closing.approval.step.generateReport.description")), 1),
1069
- t.value === 1 ? (x(), V("div", Fa, [
1070
- k(v(y), {
1071
- label: v(m)("inventory.stock.stock_balance.refreshBalance"),
1068
+ n("div", Sa, X(v(f)("inventory.closing.approval.step.generateReport.description")), 1),
1069
+ t.value === 1 ? (x(), P("div", Fa, [
1070
+ k(v(g), {
1071
+ label: v(f)("inventory.stock.stock_balance.refreshBalance"),
1072
1072
  "prepend-icon": "refresh",
1073
1073
  variant: "secondary",
1074
1074
  loading: A.refreshing,
1075
1075
  onClick: oe
1076
1076
  }, null, 8, ["label", "loading"]),
1077
1077
  n("div", Ca, [
1078
- k(v(y), {
1079
- label: v(m)("inventory.common.continue"),
1078
+ k(v(g), {
1079
+ label: v(f)("inventory.common.continue"),
1080
1080
  disabled: !_.value,
1081
1081
  onClick: w
1082
1082
  }, null, 8, ["label", "disabled"])
1083
1083
  ])
1084
- ])) : ne("", !0)
1084
+ ])) : te("", !0)
1085
1085
  ]),
1086
1086
  _: 1
1087
1087
  }, 8, ["title"]),
1088
1088
  k(v(d), {
1089
1089
  value: 2,
1090
- title: v(m)("inventory.closing.approval.step.negativeItems.title"),
1090
+ title: v(f)("inventory.closing.approval.step.negativeItems.title"),
1091
1091
  disabled: () => !_.value,
1092
1092
  complete: I
1093
1093
  }, {
1094
1094
  default: Y(() => [
1095
- n("div", $a, X(j.value.length > 0 ? `${v(m)("inventory.closing.approval.step.negativeItems.resolveMessage")} [${v(m)("inventory.closing.approval.step.negativeItems.itemsHeader")} (${G.value.length})]` : v(m)("inventory.closing.approval.step.negativeItems.noItemsMessage")), 1),
1096
- t.value === 2 ? (x(), V("div", Ba, [
1097
- j.value.length > 0 ? (x(), V("div", Ta, [
1095
+ n("div", $a, X(j.value.length > 0 ? `${v(f)("inventory.closing.approval.step.negativeItems.resolveMessage")} [${v(f)("inventory.closing.approval.step.negativeItems.itemsHeader")} (${G.value.length})]` : v(f)("inventory.closing.approval.step.negativeItems.noItemsMessage")), 1),
1096
+ t.value === 2 ? (x(), P("div", Ba, [
1097
+ j.value.length > 0 ? (x(), P("div", Ta, [
1098
1098
  D[2] || (D[2] = n("div", { class: "fm-typo-en-body-md-600 mb-2" }, null, -1)),
1099
1099
  n("div", ja, [
1100
- (x(!0), V(ie, null, Ce(j.value, (O) => (x(), V("div", {
1100
+ (x(!0), P(ie, null, Ce(j.value, (O) => (x(), P("div", {
1101
1101
  key: O.id,
1102
1102
  class: "flex gap-8"
1103
1103
  }, [
1104
1104
  n("div", Ia, [
1105
- E.value[O.id] ? (x(), V("span", Ua, [
1105
+ E.value[O.id] ? (x(), P("span", Ua, [
1106
1106
  k(J, {
1107
1107
  name: "check_circle",
1108
1108
  size: "sm"
1109
1109
  })
1110
- ])) : (x(), V("span", Ra, [
1110
+ ])) : (x(), P("span", Ra, [
1111
1111
  k(J, {
1112
1112
  name: "error",
1113
1113
  size: "sm"
@@ -1115,48 +1115,48 @@ const Da = Dt(
1115
1115
  ])),
1116
1116
  ce(" " + X(O.code), 1)
1117
1117
  ]),
1118
- n("div", Va, X(O.name), 1)
1118
+ n("div", Pa, X(O.name), 1)
1119
1119
  ]))), 128))
1120
1120
  ])
1121
- ])) : ne("", !0),
1122
- n("div", Pa, [
1123
- k(v(y), {
1124
- label: v(m)("inventory.common.back"),
1121
+ ])) : te("", !0),
1122
+ n("div", Va, [
1123
+ k(v(g), {
1124
+ label: v(f)("inventory.common.back"),
1125
1125
  variant: "secondary",
1126
1126
  onClick: ee
1127
1127
  }, null, 8, ["label"]),
1128
- k(v(y), {
1129
- label: v(m)("inventory.common.continue"),
1128
+ k(v(g), {
1129
+ label: v(f)("inventory.common.continue"),
1130
1130
  disabled: l.value,
1131
1131
  onClick: w
1132
1132
  }, null, 8, ["label", "disabled"])
1133
1133
  ])
1134
- ])) : ne("", !0)
1134
+ ])) : te("", !0)
1135
1135
  ]),
1136
1136
  _: 1
1137
1137
  }, 8, ["title", "disabled"]),
1138
1138
  k(v(d), {
1139
1139
  value: 3,
1140
- title: v(m)("inventory.closing.approval.step.approval.title"),
1140
+ title: v(f)("inventory.closing.approval.step.approval.title"),
1141
1141
  disabled: () => l.value,
1142
1142
  complete: Z
1143
1143
  }, {
1144
1144
  default: Y(() => [
1145
- n("div", Ma, X(v(m)("inventory.closing.approval.step.approval.warning")), 1),
1146
- t.value === 3 ? (x(), V("div", La, [
1147
- k(v(y), {
1148
- label: v(m)("inventory.common.back"),
1145
+ n("div", Ma, X(v(f)("inventory.closing.approval.step.approval.warning")), 1),
1146
+ t.value === 3 ? (x(), P("div", La, [
1147
+ k(v(g), {
1148
+ label: v(f)("inventory.common.back"),
1149
1149
  variant: "secondary",
1150
1150
  onClick: ee
1151
1151
  }, null, 8, ["label"]),
1152
- k(v(y), {
1153
- label: v(m)("inventory.common.approve"),
1152
+ k(v(g), {
1153
+ label: v(f)("inventory.common.approve"),
1154
1154
  variant: "destructive",
1155
1155
  disabled: l.value,
1156
1156
  loading: A.approving,
1157
- onClick: me
1157
+ onClick: de
1158
1158
  }, null, 8, ["label", "disabled", "loading"])
1159
- ])) : ne("", !0)
1159
+ ])) : te("", !0)
1160
1160
  ]),
1161
1161
  _: 1
1162
1162
  }, 8, ["title", "disabled"])
@@ -1193,10 +1193,10 @@ const Da = Dt(
1193
1193
  }, un = { class: "flex-1 flex flex-col items-center" }, dn = { class: "flex-1 flex flex-col items-center" }, mn = {
1194
1194
  class: "py-12 flex flex-col gap-4",
1195
1195
  name: "received-at header"
1196
- }, fn = { class: "fm-typo-en-body-lg-400" }, pn = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, vn = { class: "flex gap-12 content-stretch" }, gn = {
1196
+ }, fn = { class: "fm-typo-en-body-lg-400" }, pn = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, vn = { class: "flex gap-12 content-stretch" }, yn = {
1197
1197
  class: "flex flex-col w-24",
1198
1198
  name: "circles"
1199
- }, yn = { class: "flex-1 flex flex-col items-center" }, bn = {
1199
+ }, gn = { class: "flex-1 flex flex-col items-center" }, bn = {
1200
1200
  class: "py-12 flex flex-col gap-4 flex-1",
1201
1201
  name: "delivery details"
1202
1202
  }, hn = { class: "flex flex-col gap-8" }, kn = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, _n = { class: "flex flex-col gap-4" }, xn = { class: "flex gap-8" }, Dn = "N/A", An = /* @__PURE__ */ Te({
@@ -1207,34 +1207,34 @@ const Da = Dt(
1207
1207
  },
1208
1208
  emits: ["submitted", "refresh"],
1209
1209
  setup(c, { emit: o }) {
1210
- const e = c, d = P(() => {
1210
+ const e = c, d = V(() => {
1211
1211
  const u = _t();
1212
1212
  return u === "MYR" ? "RM" : u;
1213
1213
  });
1214
1214
  Ct();
1215
- const h = Ke(), y = Ht(e, "show"), m = q(!1), M = q(!1), U = q(!1), R = q(new Array()), _ = q(new Array()), E = q([]), j = at(), G = Qe(), s = et(), t = xt(), C = Ye(), I = Pt({}), Z = P(() => new Set(
1215
+ const h = Ke(), g = Ht(e, "show"), f = q(!1), M = q(!1), U = q(!1), R = q(new Array()), _ = q(new Array()), E = q([]), j = at(), G = Qe(), s = et(), t = xt(), C = Ye(), I = Vt({}), Z = V(() => new Set(
1216
1216
  t.skus.filter((u) => {
1217
1217
  var a;
1218
1218
  return I[(a = u.customAttributes) == null ? void 0 : a.tag];
1219
1219
  }).map((u) => u._id)
1220
- )), g = o, l = q({
1220
+ )), y = o, l = q({
1221
1221
  templateItem: !0,
1222
1222
  nonTemplateItem: !0
1223
- }), $ = P(() => {
1223
+ }), $ = V(() => {
1224
1224
  var a, p;
1225
1225
  const u = [...((a = e.draft) == null ? void 0 : a.items) ?? [], ...((p = e.draft) == null ? void 0 : p.negativeStockItems) ?? []];
1226
1226
  return Z.value.size ? u.filter((r) => Z.value.has(r.sku._id)) : u;
1227
- }), z = P(() => {
1227
+ }), z = V(() => {
1228
1228
  const u = $.value.map((a) => a.sku);
1229
1229
  return u.sort((a, p) => a.code.localeCompare(p.code)), u;
1230
- }), te = P(() => $.value.groupBy(
1230
+ }), ae = V(() => $.value.groupBy(
1231
1231
  (a) => a.sku._id,
1232
1232
  (a) => a.measurementsAmounts.filter((p) => !p.measurement.abbrev.toLocaleLowerCase().includes("inactive")).map((p) => p.measurement.id)
1233
1233
  ));
1234
1234
  Xe(ee), Ne(
1235
1235
  () => e.show,
1236
1236
  (u) => {
1237
- u && (ke.value = he[0], ee(), l.value = {
1237
+ u && (_e.value = ke[0], ee(), l.value = {
1238
1238
  templateItem: !0,
1239
1239
  nonTemplateItem: !0
1240
1240
  });
@@ -1244,8 +1244,8 @@ const Da = Dt(
1244
1244
  async function ee() {
1245
1245
  var a, p, r, i;
1246
1246
  if (!C._currentLocation) return;
1247
- m.value = !0;
1248
- const u = ((a = e.draft) == null ? void 0 : a.status) === De.enum.COMPLETED;
1247
+ f.value = !0;
1248
+ const u = ((a = e.draft) == null ? void 0 : a.status) === he.enum.COMPLETED;
1249
1249
  _.value = [];
1250
1250
  try {
1251
1251
  if (await t.init(), u) {
@@ -1260,8 +1260,8 @@ const Da = Dt(
1260
1260
  });
1261
1261
  return;
1262
1262
  }
1263
- const N = await j.readAdjustmentById(L), ue = (N == null ? void 0 : N.skus) ?? [];
1264
- for (const fe of ue) {
1263
+ const N = await j.readAdjustmentById(L), me = (N == null ? void 0 : N.skus) ?? [];
1264
+ for (const fe of me) {
1265
1265
  const Ae = {
1266
1266
  id: fe.sku._id,
1267
1267
  balance: fe.fromBalance,
@@ -1275,27 +1275,27 @@ const Da = Dt(
1275
1275
  }
1276
1276
  } else
1277
1277
  R.value = ((r = e.draft) == null ? void 0 : r.stockSnapshot) ?? [];
1278
- const f = /* @__PURE__ */ new Set();
1278
+ const m = /* @__PURE__ */ new Set();
1279
1279
  if ((i = e.draft) != null && i.adjustmentSnapshot)
1280
1280
  for (const L of e.draft.adjustmentSnapshot)
1281
- L.adjustmentsByType && Object.keys(L.adjustmentsByType).forEach((N) => f.add(N));
1281
+ L.adjustmentsByType && Object.keys(L.adjustmentsByType).forEach((N) => m.add(N));
1282
1282
  const b = ["receive", "sales", "wastage"], B = [];
1283
1283
  b.forEach((L) => {
1284
- f.has(L) && (B.push(L), f.delete(L));
1284
+ m.has(L) && (B.push(L), m.delete(L));
1285
1285
  });
1286
- const S = Array.from(f).sort();
1286
+ const S = Array.from(m).sort();
1287
1287
  E.value = [...B, ...S];
1288
- } catch (f) {
1288
+ } catch (m) {
1289
1289
  s.open({
1290
1290
  title: "Something went wrong",
1291
1291
  message: "Something went wrong when fetching info. Please try again.",
1292
1292
  type: "error"
1293
- }), console.error("error on fetch stock balances", f);
1293
+ }), console.error("error on fetch stock balances", m);
1294
1294
  } finally {
1295
- m.value = !1;
1295
+ f.value = !1;
1296
1296
  }
1297
1297
  }
1298
- async function me() {
1298
+ async function de() {
1299
1299
  var a, p;
1300
1300
  if (!(((a = e.draft) == null ? void 0 : a.effectiveAt) ?? (e.draft ? Ee((p = e.draft) == null ? void 0 : p._id) : null))) {
1301
1301
  s.open({
@@ -1312,11 +1312,11 @@ const Da = Dt(
1312
1312
  async (r) => {
1313
1313
  var B;
1314
1314
  M.value = !0;
1315
- const i = (B = e.draft) == null ? void 0 : B._rev, f = 30, b = 2e3;
1315
+ const i = (B = e.draft) == null ? void 0 : B._rev, m = 30, b = 2e3;
1316
1316
  try {
1317
1317
  await j.recalculation.scheduleCalculateStockSnapshotAtDate(r, e.draft._id);
1318
1318
  let S = null;
1319
- for (let L = 0; L < f && (S = await G.getDraft(e.draft._id).delayed(b), S._rev === i); L++)
1319
+ for (let L = 0; L < m && (S = await G.getDraft(e.draft._id).delayed(b), S._rev === i); L++)
1320
1320
  ;
1321
1321
  if (!S || S._rev === i) {
1322
1322
  s.open({
@@ -1326,11 +1326,11 @@ const Da = Dt(
1326
1326
  }), console.error("error refreshing stock balances: there is no change in _rev");
1327
1327
  return;
1328
1328
  }
1329
- g("refresh", S), R.value = S.stockSnapshot ?? [], s.open({
1329
+ y("refresh", S), R.value = S.stockSnapshot ?? [], s.open({
1330
1330
  title: "Balance refreshed",
1331
1331
  message: "Stock balance has been recalculated.",
1332
1332
  type: "success"
1333
- }), y.value = !1;
1333
+ }), g.value = !1;
1334
1334
  } catch (S) {
1335
1335
  s.open({
1336
1336
  title: "Refresh failed",
@@ -1355,15 +1355,15 @@ const Da = Dt(
1355
1355
  }
1356
1356
  await h.invalidateDraftCache(e.draft);
1357
1357
  }
1358
- const D = P(
1358
+ const D = V(
1359
1359
  () => R.value.groupBy(
1360
1360
  (u) => u.id,
1361
1361
  (u) => u.balance
1362
1362
  )
1363
- ), J = P(() => $.value.groupBy((u) => u.sku._id)), O = P(() => {
1363
+ ), J = V(() => $.value.groupBy((u) => u.sku._id)), O = V(() => {
1364
1364
  var u;
1365
1365
  return (u = e.draft) != null && u.adjustmentSnapshot ? new Map(e.draft.adjustmentSnapshot.map((a) => [a.skuId, a.adjustmentsByType])) : /* @__PURE__ */ new Map();
1366
- }), re = P(() => {
1366
+ }), re = V(() => {
1367
1367
  var u;
1368
1368
  return (u = e.draft) != null && u.opening ? new Map(e.draft.opening.map((a) => [a.skuId, a.balance])) : /* @__PURE__ */ new Map();
1369
1369
  });
@@ -1381,10 +1381,10 @@ const Da = Dt(
1381
1381
  }
1382
1382
  );
1383
1383
  }
1384
- const ve = P(() => {
1384
+ const ve = V(() => {
1385
1385
  const u = z.value.reduce((p, r) => {
1386
- var i, f;
1387
- return Math.max(p, ((f = (i = te.value) == null ? void 0 : i.get(r._id)) == null ? void 0 : f[0].length) ?? 0);
1386
+ var i, m;
1387
+ return Math.max(p, ((m = (i = ae.value) == null ? void 0 : i.get(r._id)) == null ? void 0 : m[0].length) ?? 0);
1388
1388
  }, 0);
1389
1389
  return [
1390
1390
  {
@@ -1393,13 +1393,13 @@ const Da = Dt(
1393
1393
  header: () => "Name",
1394
1394
  size: 350,
1395
1395
  cell(p) {
1396
- const r = p.row.original, i = r.adjustedDiffPercentage, f = typeof i == "number" && Math.abs(i) > 10, b = F("div", { class: "flex flex-col gap-4" }, [
1396
+ const r = p.row.original, i = r.adjustedDiffPercentage, m = typeof i == "number" && Math.abs(i) > 10, b = F("div", { class: "flex flex-col gap-4" }, [
1397
1397
  F(
1398
1398
  "div",
1399
1399
  {
1400
1400
  class: [
1401
1401
  "line-clamp-1 fm-typo-en-body-lg-400",
1402
- f ? " text-fm-color-system-error-300" : "text-fm-color-typo-primary"
1402
+ m ? " text-fm-color-system-error-300" : "text-fm-color-typo-primary"
1403
1403
  ]
1404
1404
  },
1405
1405
  r.name
@@ -1409,7 +1409,7 @@ const Da = Dt(
1409
1409
  {
1410
1410
  class: [
1411
1411
  "line-clamp-1 fm-typo-en-body-md-400",
1412
- f ? " text-fm-color-system-error-300" : "text-fm-color-typo-secondary"
1412
+ m ? " text-fm-color-system-error-300" : "text-fm-color-typo-secondary"
1413
1413
  ]
1414
1414
  },
1415
1415
  r.code
@@ -1422,7 +1422,7 @@ const Da = Dt(
1422
1422
  },
1423
1423
  {
1424
1424
  content() {
1425
- return f ? "Adjustment difference is more than 10%." : `${r.code} - ${r.name}`;
1425
+ return m ? "Adjustment difference is more than 10%." : `${r.code} - ${r.name}`;
1426
1426
  },
1427
1427
  default() {
1428
1428
  return F("div", { class: "flex items-center gap-4 justify-start w-full" }, [
@@ -1452,8 +1452,8 @@ const Da = Dt(
1452
1452
  size: 120,
1453
1453
  cell(p) {
1454
1454
  var B;
1455
- const r = p.row.original, i = r.costUnit, f = r.baseUnit, b = i ?? f;
1456
- if (i && i !== f) {
1455
+ const r = p.row.original, i = r.costUnit, m = r.baseUnit, b = i ?? m;
1456
+ if (i && i !== m) {
1457
1457
  const S = z.value.find((N) => N._id === r.id), L = (B = S == null ? void 0 : S.defaultCost) == null ? void 0 : B.measurement;
1458
1458
  if (L) {
1459
1459
  const N = L.conversion.amount / Math.pow(10, L.conversion.precision);
@@ -1467,7 +1467,7 @@ const Da = Dt(
1467
1467
  "1 ",
1468
1468
  F("span", { class: "fm-typo-en-body-sm-600" }, i),
1469
1469
  ` = ${N} `,
1470
- F("span", { class: "fm-typo-en-body-sm-600" }, f)
1470
+ F("span", { class: "fm-typo-en-body-sm-600" }, m)
1471
1471
  ])
1472
1472
  ]);
1473
1473
  }
@@ -1517,25 +1517,25 @@ const Da = Dt(
1517
1517
  id: "physicalBalance",
1518
1518
  accessorFn: (p) => {
1519
1519
  var i;
1520
- const r = (i = _.value.find((f) => f.id === p.id)) == null ? void 0 : i.balance;
1520
+ const r = (i = _.value.find((m) => m.id === p.id)) == null ? void 0 : i.balance;
1521
1521
  return r ? H.toFormatString({ value: r }) : p.physicalBalance;
1522
1522
  },
1523
1523
  header: () => Q("Stock Take balance", "The physical balance recorded during stock take."),
1524
1524
  cell(p) {
1525
1525
  var S;
1526
1526
  const r = p.row.original, i = H.fromNumber(r.physicalBalance);
1527
- let f = !0, b = r.physicalBalance;
1527
+ let m = !0, b = r.physicalBalance;
1528
1528
  const B = (S = _.value.find((L) => L.id === r.id)) == null ? void 0 : S.balance;
1529
1529
  return B && (H.equals({
1530
1530
  a: i,
1531
1531
  b: B
1532
- }) || (f = !1, b = Number(H.toFormatString({ value: B })))), F("div", { class: "flex flex-col" }, [
1532
+ }) || (m = !1, b = Number(H.toFormatString({ value: B })))), F("div", { class: "flex flex-col" }, [
1533
1533
  F(
1534
1534
  "span",
1535
1535
  { class: "line-clamp-1 fm-typo-en-body-lg-400 text-fm-color-typo-primary" },
1536
1536
  b
1537
1537
  ),
1538
- f ? null : F(
1538
+ m ? null : F(
1539
1539
  "span",
1540
1540
  { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" },
1541
1541
  `Draft: ${r.physicalBalance.toString()}`
@@ -1587,11 +1587,11 @@ const Da = Dt(
1587
1587
  const i = r.toFixed(2);
1588
1588
  if (i === "0.00")
1589
1589
  return F("div", { class: "flex items-center gap-4 justify-end" }, ["0.00"]);
1590
- const f = r > 0;
1590
+ const m = r > 0;
1591
1591
  return F("div", { class: "flex items-center gap-4 justify-end" }, [
1592
1592
  F(be.FmIcon, {
1593
- name: f ? "arrow_drop_up" : "arrow_drop_down",
1594
- color: f ? "system-success-300" : "system-error-300",
1593
+ name: m ? "arrow_drop_up" : "arrow_drop_down",
1594
+ color: m ? "system-success-300" : "system-error-300",
1595
1595
  size: "md"
1596
1596
  }),
1597
1597
  i
@@ -1608,15 +1608,15 @@ const Da = Dt(
1608
1608
  size: 180,
1609
1609
  cell(p) {
1610
1610
  var L;
1611
- const r = p.row.original, i = r.stockTakeValue, f = z.value.find((N) => N._id === r.id), b = (L = f == null ? void 0 : f.defaultCost) == null ? void 0 : L.measurement, B = r.physicalBalance, S = r.costPerUnit;
1611
+ const r = p.row.original, i = r.stockTakeValue, m = z.value.find((N) => N._id === r.id), b = (L = m == null ? void 0 : m.defaultCost) == null ? void 0 : L.measurement, B = r.physicalBalance, S = r.costPerUnit;
1612
1612
  if (b) {
1613
- const N = H.toFormatString({ value: b.conversion }), ue = `${B.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 })} ${r.baseUnit} ÷ ${N} × ${S} ${d.value}`;
1613
+ const N = H.toFormatString({ value: b.conversion }), me = `${B.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 })} ${r.baseUnit} ÷ ${N} × ${S} ${d.value}`;
1614
1614
  return F(
1615
1615
  be.FmTooltip,
1616
1616
  { zIndex: 51 },
1617
1617
  {
1618
1618
  content() {
1619
- return ue;
1619
+ return me;
1620
1620
  },
1621
1621
  default() {
1622
1622
  return F(
@@ -1664,15 +1664,15 @@ const Da = Dt(
1664
1664
  size: 180,
1665
1665
  cell(p) {
1666
1666
  var L;
1667
- const r = p.row.original, i = r.systemValue, f = z.value.find((N) => N._id === r.id), b = (L = f == null ? void 0 : f.defaultCost) == null ? void 0 : L.measurement, B = r.systemBalance, S = r.costPerUnit;
1667
+ const r = p.row.original, i = r.systemValue, m = z.value.find((N) => N._id === r.id), b = (L = m == null ? void 0 : m.defaultCost) == null ? void 0 : L.measurement, B = r.systemBalance, S = r.costPerUnit;
1668
1668
  if (b) {
1669
- const N = H.toFormatString({ value: b.conversion }), ue = `${B.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 4 })} ${r.baseUnit} ÷ ${N} × ${S} ${d.value}`;
1669
+ const N = H.toFormatString({ value: b.conversion }), me = `${B.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 4 })} ${r.baseUnit} ÷ ${N} × ${S} ${d.value}`;
1670
1670
  return F(
1671
1671
  be.FmTooltip,
1672
1672
  { zIndex: 51 },
1673
1673
  {
1674
1674
  content() {
1675
- return ue;
1675
+ return me;
1676
1676
  },
1677
1677
  default() {
1678
1678
  return F(
@@ -1746,44 +1746,44 @@ const Da = Dt(
1746
1746
  }
1747
1747
  }
1748
1748
  );
1749
- let f = Array.from({ length: u }).map((b, B) => {
1749
+ let m = Array.from({ length: u }).map((b, B) => {
1750
1750
  if (!r[`measurementAmount${B}`])
1751
1751
  return null;
1752
1752
  const S = r[`measurementAmount${B}`], L = r[`measurementAbbrev${B}`];
1753
1753
  return i(S, L);
1754
1754
  }).filter((b) => b);
1755
- return (r.baseUnitAmount || !f.length) && (f = [i(r.baseUnitAmount, r.baseUnit), ...f]), F(
1755
+ return (r.baseUnitAmount || !m.length) && (m = [i(r.baseUnitAmount, r.baseUnit), ...m]), F(
1756
1756
  "div",
1757
1757
  {
1758
1758
  class: "flex gap-8 flex-nowrap",
1759
1759
  style: {
1760
- minWidth: `${120 * f.length}px`
1760
+ minWidth: `${120 * m.length}px`
1761
1761
  }
1762
1762
  },
1763
- f
1763
+ m
1764
1764
  );
1765
1765
  }
1766
1766
  }
1767
1767
  ];
1768
- }), je = P(() => ve.value.map((u) => u.size ?? 0).reduce((u, a) => u + a)), we = q(""), Ie = P(() => {
1768
+ }), je = V(() => ve.value.map((u) => u.size ?? 0).reduce((u, a) => u + a)), we = q(""), Ie = V(() => {
1769
1769
  var p, r;
1770
1770
  const u = ((r = (p = e.draft) == null ? void 0 : p.negativeStockItems) == null ? void 0 : r.reduce(
1771
- (i, f) => (i[f.sku._id] = f, i),
1771
+ (i, m) => (i[m.sku._id] = m, i),
1772
1772
  {}
1773
1773
  )) ?? {};
1774
1774
  return z.value.map((i) => {
1775
1775
  var st, rt, lt, it, ct, ut, dt, mt, ft, pt, vt;
1776
- const f = (st = J.value.get(i._id)) == null ? void 0 : st[0], b = ((rt = D.value.get(i._id)) == null ? void 0 : rt[0]) ?? oe, B = ((lt = i.defaultCost) == null ? void 0 : lt.costPerUnit) ?? oe, S = Number(H.toFormatString({ value: B })), L = ((ct = (it = i.defaultCost) == null ? void 0 : it.measurement) == null ? void 0 : ct.conversion) ?? {
1776
+ const m = (st = J.value.get(i._id)) == null ? void 0 : st[0], b = ((rt = D.value.get(i._id)) == null ? void 0 : rt[0]) ?? oe, B = ((lt = i.defaultCost) == null ? void 0 : lt.costPerUnit) ?? oe, S = Number(H.toFormatString({ value: B })), L = ((ct = (it = i.defaultCost) == null ? void 0 : it.measurement) == null ? void 0 : ct.conversion) ?? {
1777
1777
  amount: 1,
1778
1778
  precision: 0
1779
1779
  }, N = Number(
1780
1780
  H.toFormatString({ value: L })
1781
- ), ue = re.value.get(i._id), fe = ue ? Number(H.toFormatString({ value: ue })) : 0, Ae = O.value.get(i._id), T = {};
1781
+ ), me = re.value.get(i._id), fe = me ? Number(H.toFormatString({ value: me })) : 0, Ae = O.value.get(i._id), T = {};
1782
1782
  if (E.value.forEach((se) => {
1783
- const pe = T[se] ?? { amount: 0, precision: 0 }, ge = Ae == null ? void 0 : Ae[se];
1784
- ge && (T[se] = Zt(pe, ge));
1785
- }), !f) {
1786
- const se = Number(H.toFormatString({ value: b })), pe = se - 0, ge = pe * S / N, Me = 0, Vt = se * S / N;
1783
+ const pe = T[se] ?? { amount: 0, precision: 0 }, ye = Ae == null ? void 0 : Ae[se];
1784
+ ye && (T[se] = Zt(pe, ye));
1785
+ }), !m) {
1786
+ const se = Number(H.toFormatString({ value: b })), pe = se - 0, ye = pe * S / N, Me = 0, Pt = se * S / N;
1787
1787
  return {
1788
1788
  id: i._id,
1789
1789
  code: i.code,
@@ -1799,38 +1799,38 @@ const Da = Dt(
1799
1799
  costPerUnit: S,
1800
1800
  opening: fe,
1801
1801
  varianceQty: pe,
1802
- varianceInCost: ge,
1802
+ varianceInCost: ye,
1803
1803
  stockTakeValue: Me,
1804
- systemValue: Vt,
1804
+ systemValue: Pt,
1805
1805
  adjustmentAmounts: T
1806
1806
  };
1807
1807
  }
1808
- const ae = $t(f), le = (ft = (mt = _.value) == null ? void 0 : mt.find(
1808
+ const ne = $t(m), le = (ft = (mt = _.value) == null ? void 0 : mt.find(
1809
1809
  (se) => se.id === i._id
1810
- )) == null ? void 0 : ft.balance, ye = wt(
1811
- le ?? ae,
1810
+ )) == null ? void 0 : ft.balance, ge = wt(
1811
+ le ?? ne,
1812
1812
  b
1813
- ), Se = b.amount === 0 ? null : St(ye, {
1813
+ ), Se = b.amount === 0 ? null : St(ge, {
1814
1814
  ...b,
1815
1815
  amount: Math.abs(b.amount)
1816
- }), Pe = Se ? tt(Se, w) : null, qe = Number(H.toFormatString({ value: b })), Ge = Number(H.toFormatString({ value: ae })), ot = qe - Ge, It = ot * S / N, Ut = Ge * S / N, Rt = qe * S / N;
1816
+ }), Ve = Se ? tt(Se, w) : null, qe = Number(H.toFormatString({ value: b })), Ge = Number(H.toFormatString({ value: ne })), ot = qe - Ge, It = ot * S / N, Ut = Ge * S / N, Rt = qe * S / N;
1817
1817
  return {
1818
1818
  id: i._id,
1819
1819
  code: i.code,
1820
1820
  name: i.name,
1821
1821
  costUnit: ((vt = (pt = i.defaultCost) == null ? void 0 : pt.measurement) == null ? void 0 : vt.abbrev) ?? null,
1822
1822
  baseUnit: i.unit.abbrev,
1823
- baseUnitAmount: Number(H.toFormatString({ value: f.baseAmount })),
1824
- ...f.measurementsAmounts.filter((se) => {
1825
- var pe, ge, Me;
1826
- return (Me = (ge = (pe = te.value) == null ? void 0 : pe.get(i._id)) == null ? void 0 : ge[0]) == null ? void 0 : Me.includes(se.measurement.id);
1827
- }).reduce((se, pe, ge) => (se[`measurementAbbrev${ge}`] = `(${pe.measurement.abbrev}) × ${H.toFormatString({ value: pe.measurement.conversion })}`, se[`measurementAmount${ge}`] = Number(H.toFormatString({ value: pe.amount })), se), {}),
1823
+ baseUnitAmount: Number(H.toFormatString({ value: m.baseAmount })),
1824
+ ...m.measurementsAmounts.filter((se) => {
1825
+ var pe, ye, Me;
1826
+ return (Me = (ye = (pe = ae.value) == null ? void 0 : pe.get(i._id)) == null ? void 0 : ye[0]) == null ? void 0 : Me.includes(se.measurement.id);
1827
+ }).reduce((se, pe, ye) => (se[`measurementAbbrev${ye}`] = `(${pe.measurement.abbrev}) × ${H.toFormatString({ value: pe.measurement.conversion })}`, se[`measurementAmount${ye}`] = Number(H.toFormatString({ value: pe.amount })), se), {}),
1828
1828
  systemBalance: qe,
1829
1829
  physicalBalance: Ge,
1830
- adjustedAmount: Number(H.toFormatString({ value: ye })),
1831
- adjustedDiffPercentage: Pe ? Number(
1830
+ adjustedAmount: Number(H.toFormatString({ value: ge })),
1831
+ adjustedDiffPercentage: Ve ? Number(
1832
1832
  H.toFormatString({
1833
- value: Ft(Pe, 2)
1833
+ value: Ft(Ve, 2)
1834
1834
  })
1835
1835
  ) : null,
1836
1836
  isTemplateItem: !u[i._id],
@@ -1843,16 +1843,16 @@ const Da = Dt(
1843
1843
  adjustmentAmounts: T
1844
1844
  };
1845
1845
  }).filter((i) => !!(i.isTemplateItem && l.value.templateItem || !i.isTemplateItem && l.value.nonTemplateItem));
1846
- }), Ue = P(() => {
1847
- var a, p, r, i, f;
1846
+ }), Ue = V(() => {
1847
+ var a, p, r, i, m;
1848
1848
  if (!e.draft) return [];
1849
1849
  const u = e.draft.approvedAt ? {
1850
- action: `Approve at ${xe(e.draft.approvedAt)}`,
1850
+ action: `Approve at ${De(e.draft.approvedAt)}`,
1851
1851
  // actionAt: props.draft.approvedAt,
1852
1852
  actionBy: e.draft.approvedBy,
1853
1853
  remark: e.draft.approveRemark
1854
1854
  } : (a = e.draft.rejectionHistory) == null ? void 0 : a.computeFirst((b) => ({
1855
- action: `Reject at ${xe(b.rejectedAt)}`,
1855
+ action: `Reject at ${De(b.rejectedAt)}`,
1856
1856
  // actionAt: e.rejectedAt,
1857
1857
  actionBy: b.rejectedBy,
1858
1858
  remark: b.rejectRemark
@@ -1864,7 +1864,7 @@ const Da = Dt(
1864
1864
  },
1865
1865
  {
1866
1866
  label: "Created at",
1867
- value: xe(e.draft.createdAt)
1867
+ value: De(e.draft.createdAt)
1868
1868
  },
1869
1869
  {
1870
1870
  label: "Created by",
@@ -1872,7 +1872,7 @@ const Da = Dt(
1872
1872
  },
1873
1873
  {
1874
1874
  label: "Updated at",
1875
- value: xe(e.draft.updatedAt)
1875
+ value: De(e.draft.updatedAt)
1876
1876
  },
1877
1877
  {
1878
1878
  label: "Updated by",
@@ -1880,7 +1880,7 @@ const Da = Dt(
1880
1880
  },
1881
1881
  {
1882
1882
  label: "Effective at",
1883
- value: xe(e.draft.effectiveAt ?? Ee((r = e.draft) == null ? void 0 : r._id))
1883
+ value: De(e.draft.effectiveAt ?? Ee((r = e.draft) == null ? void 0 : r._id))
1884
1884
  },
1885
1885
  {
1886
1886
  label: "Using template",
@@ -1896,14 +1896,14 @@ const Da = Dt(
1896
1896
  } : null,
1897
1897
  u && u.actionBy ? {
1898
1898
  label: "Last action by",
1899
- value: (f = u.actionBy) == null ? void 0 : f.name
1899
+ value: (m = u.actionBy) == null ? void 0 : m.name
1900
1900
  } : null,
1901
1901
  u && u.remark ? {
1902
1902
  label: "Action remark",
1903
1903
  value: u.remark
1904
1904
  } : null
1905
1905
  ].filter((b) => b).map((b) => b);
1906
- }), he = [
1906
+ }), ke = [
1907
1907
  {
1908
1908
  label: "Overview",
1909
1909
  value: "overview"
@@ -1912,8 +1912,8 @@ const Da = Dt(
1912
1912
  label: "Action history",
1913
1913
  value: "history"
1914
1914
  }
1915
- ], ke = q(he[0]), _e = P(() => {
1916
- var r, i, f;
1915
+ ], _e = q(ke[0]), xe = V(() => {
1916
+ var r, i, m;
1917
1917
  const u = ((r = e.draft) == null ? void 0 : r.activityLogs) ?? [], a = ((i = e.draft) == null ? void 0 : i.rejectionHistory) ?? [];
1918
1918
  for (const b of a)
1919
1919
  u.find(
@@ -1924,7 +1924,7 @@ const Da = Dt(
1924
1924
  performedBy: b.rejectedBy,
1925
1925
  remark: b.rejectRemark
1926
1926
  });
1927
- return (f = e.draft) != null && f.approvedAt && (u.find(
1927
+ return (m = e.draft) != null && m.approvedAt && (u.find(
1928
1928
  (B) => {
1929
1929
  var S;
1930
1930
  return `${B.action}_${B.performedAt}` == `${W.enum.approveDraft}_${(S = e.draft) == null ? void 0 : S.approvedAt}`;
@@ -1937,7 +1937,7 @@ const Da = Dt(
1937
1937
  })), u.sort((b, B) => new Date(B.performedAt).getTime() - new Date(b.performedAt).getTime()).map(
1938
1938
  (b) => ({
1939
1939
  header: ze(b.action),
1940
- date: xe(b.performedAt),
1940
+ date: De(b.performedAt),
1941
1941
  info: [
1942
1942
  {
1943
1943
  label: "Performed by",
@@ -1950,37 +1950,37 @@ const Da = Dt(
1950
1950
  ]
1951
1951
  })
1952
1952
  );
1953
- }), Re = q(!1), Ve = q(!1), nt = P(() => {
1953
+ }), Re = q(!1), Pe = q(!1), nt = V(() => {
1954
1954
  var u;
1955
- return ((u = e.draft) == null ? void 0 : u.status) !== De.enum.DRAFT ? "Status is not draft." : null;
1955
+ return ((u = e.draft) == null ? void 0 : u.status) !== he.enum.DRAFT ? "Status is not draft." : null;
1956
1956
  });
1957
1957
  function jt() {
1958
- e.draft && (Ve.value = !0, h.approveDraft(
1958
+ e.draft && (Pe.value = !0, h.approveDraft(
1959
1959
  e.draft,
1960
1960
  () => {
1961
- Ve.value = !1, Re.value = !1, g("submitted");
1961
+ Pe.value = !1, Re.value = !1, y("submitted");
1962
1962
  },
1963
1963
  () => {
1964
- Ve.value = !1;
1964
+ Pe.value = !1;
1965
1965
  }
1966
1966
  ));
1967
1967
  }
1968
1968
  return (u, a) => {
1969
- const p = K("FmButtonGroup"), r = K("FmMenuDivider"), i = K("FmCard"), f = K("FmButton"), b = K("FmCircularProgress"), B = K("FmChip"), S = K("FmTextField"), L = K("FmIcon"), N = K("FmTable"), ue = K("FmSpacer"), fe = K("FmTooltip"), Ae = K("FmSideSheet");
1970
- return x(), V(ie, null, [
1969
+ const p = K("FmButtonGroup"), r = K("FmMenuDivider"), i = K("FmCard"), m = K("FmButton"), b = K("FmCircularProgress"), B = K("FmChip"), S = K("FmTextField"), L = K("FmIcon"), N = K("FmTable"), me = K("FmSpacer"), fe = K("FmTooltip"), Ae = K("FmSideSheet");
1970
+ return x(), P(ie, null, [
1971
1971
  k(Ae, {
1972
1972
  "dismiss-away": "",
1973
1973
  "max-width": 9999,
1974
- "model-value": v(y),
1975
- "onUpdate:modelValue": a[9] || (a[9] = (T) => yt(y) ? y.value = T : null),
1974
+ "model-value": v(g),
1975
+ "onUpdate:modelValue": a[9] || (a[9] = (T) => gt(g) ? g.value = T : null),
1976
1976
  header: "Closing details"
1977
1977
  }, {
1978
1978
  "side-sheet-footer": Y(() => {
1979
- var T, ae, le, ye;
1979
+ var T, ne, le, ge;
1980
1980
  return [
1981
1981
  n("div", xn, [
1982
- ((T = e.draft) == null ? void 0 : T.status) === v(De).enum.DRAFT ? (x(), V(ie, { key: 0 }, [
1983
- nt.value ? (x(), de(fe, {
1982
+ ((T = e.draft) == null ? void 0 : T.status) === v(he).enum.DRAFT ? (x(), P(ie, { key: 0 }, [
1983
+ nt.value ? (x(), ue(fe, {
1984
1984
  key: 0,
1985
1985
  "z-index": 51,
1986
1986
  placement: "right"
@@ -1989,43 +1989,43 @@ const Da = Dt(
1989
1989
  ce(X(nt.value), 1)
1990
1990
  ]),
1991
1991
  default: Y(() => [
1992
- k(f, {
1992
+ k(m, {
1993
1993
  disabled: "",
1994
1994
  key: "approve key",
1995
1995
  label: "Approve"
1996
1996
  })
1997
1997
  ]),
1998
1998
  _: 1
1999
- })) : (x(), de(f, {
1999
+ })) : (x(), ue(m, {
2000
2000
  key: "approve key",
2001
2001
  label: "Approve",
2002
2002
  onClick: a[5] || (a[5] = (Se) => Re.value = !0)
2003
2003
  }))
2004
- ], 64)) : ne("", !0),
2005
- ((ae = e.draft) == null ? void 0 : ae.status) === v(De).enum.DRAFT ? (x(), de(f, {
2004
+ ], 64)) : te("", !0),
2005
+ ((ne = e.draft) == null ? void 0 : ne.status) === v(he).enum.DRAFT ? (x(), ue(m, {
2006
2006
  key: 1,
2007
2007
  label: "Reject",
2008
2008
  variant: "destructive",
2009
- onClick: a[6] || (a[6] = () => e.draft && v(h).rejectDraft(e.draft, () => g("submitted")))
2010
- })) : ne("", !0),
2011
- (le = e.draft) != null && le.approvedAt && ((ye = e.draft) == null ? void 0 : ye.status) !== v(De).enum.COMPLETED ? (x(), de(Ze, { key: 2 }, {
2009
+ onClick: a[6] || (a[6] = () => e.draft && v(h).rejectDraft(e.draft, () => y("submitted")))
2010
+ })) : te("", !0),
2011
+ (le = e.draft) != null && le.approvedAt && ((ge = e.draft) == null ? void 0 : ge.status) !== v(he).enum.COMPLETED ? (x(), ue(Ze, { key: 2 }, {
2012
2012
  default: Y(() => [
2013
- k(f, {
2013
+ k(m, {
2014
2014
  label: "Sync",
2015
2015
  loading: U.value,
2016
2016
  onClick: a[7] || (a[7] = () => {
2017
2017
  e.draft && (U.value = !0, v(h).syncDraft(e.draft, () => {
2018
- U.value = !1, g("submitted");
2018
+ U.value = !1, y("submitted");
2019
2019
  }));
2020
2020
  })
2021
2021
  }, null, 8, ["loading"])
2022
2022
  ]),
2023
2023
  _: 1
2024
- })) : ne("", !0),
2025
- k(f, {
2024
+ })) : te("", !0),
2025
+ k(m, {
2026
2026
  label: "Close",
2027
2027
  variant: "tertiary",
2028
- onClick: a[8] || (a[8] = (Se) => y.value = !1)
2028
+ onClick: a[8] || (a[8] = (Se) => g.value = !1)
2029
2029
  })
2030
2030
  ])
2031
2031
  ];
@@ -2034,32 +2034,32 @@ const Da = Dt(
2034
2034
  n("div", Ea, [
2035
2035
  n("div", null, [
2036
2036
  k(p, {
2037
- items: he,
2038
- modelValue: ke.value,
2039
- "onUpdate:modelValue": a[0] || (a[0] = (T) => ke.value = T)
2037
+ items: ke,
2038
+ modelValue: _e.value,
2039
+ "onUpdate:modelValue": a[0] || (a[0] = (T) => _e.value = T)
2040
2040
  }, null, 8, ["modelValue"])
2041
2041
  ]),
2042
- ke.value.value === "overview" ? (x(), V(ie, { key: 0 }, [
2042
+ _e.value.value === "overview" ? (x(), P(ie, { key: 0 }, [
2043
2043
  k(i, {
2044
2044
  variant: "outlined",
2045
2045
  class: "flex flex-col gap-8 px-12 py-16"
2046
2046
  }, {
2047
2047
  default: Y(() => {
2048
- var T, ae;
2048
+ var T, ne;
2049
2049
  return [
2050
2050
  n("div", za, [
2051
2051
  a[11] || (a[11] = n("div", { class: "fm-typo-en-body-lg-600" }, "Closing summary", -1)),
2052
2052
  n("div", Ha, [
2053
2053
  n("div", {
2054
2054
  class: $e(["fm-status-badge", v(He)(((T = u.draft) == null ? void 0 : T.status) ?? "DRAFT")])
2055
- }, X(v(ze)(((ae = u.draft) == null ? void 0 : ae.status) ?? "")), 3)
2055
+ }, X(v(ze)(((ne = u.draft) == null ? void 0 : ne.status) ?? "")), 3)
2056
2056
  ])
2057
2057
  ]),
2058
2058
  k(r),
2059
2059
  n("div", Oa, [
2060
- (x(!0), V(ie, null, Ce(Ue.value, (le, ye) => (x(), V("div", {
2060
+ (x(!0), P(ie, null, Ce(Ue.value, (le, ge) => (x(), P("div", {
2061
2061
  class: "flex flex-col gap-4",
2062
- key: ye
2062
+ key: ge
2063
2063
  }, [
2064
2064
  n("div", Ka, [
2065
2065
  n("div", Ya, X(le.label), 1)
@@ -2074,10 +2074,21 @@ const Da = Dt(
2074
2074
  n("div", qa, [
2075
2075
  n("div", Ga, [
2076
2076
  a[12] || (a[12] = n("div", { class: "flex-1 fm-typo-en-title-sm-600 text-fm-color-typo-primary" }, " Closing items ", -1)),
2077
- m.value ? ne("", !0) : (x(), V("div", Wa, [
2077
+ f.value ? te("", !0) : (x(), P("div", Wa, [
2078
+ u.draft && u.draft.status !== v(he).enum.COMPLETED ? (x(), ue(m, {
2079
+ key: 0,
2080
+ label: "Refresh balance",
2081
+ "prepend-icon": "refresh",
2082
+ variant: "secondary",
2083
+ "text-color": "primary",
2084
+ "bg-color": "transparent",
2085
+ "border-color": "primary",
2086
+ loading: M.value,
2087
+ onClick: de
2088
+ }, null, 8, ["loading"])) : te("", !0),
2078
2089
  k(Ze, null, {
2079
2090
  default: Y(() => [
2080
- k(f, {
2091
+ k(m, {
2081
2092
  label: "Invalidate Draft Cache",
2082
2093
  "prepend-icon": "refresh",
2083
2094
  variant: "secondary",
@@ -2090,7 +2101,7 @@ const Da = Dt(
2090
2101
  ]),
2091
2102
  _: 1
2092
2103
  }),
2093
- k(f, {
2104
+ k(m, {
2094
2105
  label: "Export data",
2095
2106
  "prepend-icon": "download",
2096
2107
  variant: "secondary",
@@ -2105,7 +2116,7 @@ const Da = Dt(
2105
2116
  })
2106
2117
  ]))
2107
2118
  ]),
2108
- m.value ? (x(), V("div", Za, [
2119
+ f.value ? (x(), P("div", Za, [
2109
2120
  a[14] || (a[14] = n("div", { class: "h-80" }, null, -1)),
2110
2121
  n("div", Ja, [
2111
2122
  n("div", null, [
@@ -2114,7 +2125,7 @@ const Da = Dt(
2114
2125
  a[13] || (a[13] = n("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, " Fetching info... ", -1))
2115
2126
  ]),
2116
2127
  a[15] || (a[15] = n("div", { class: "h-80" }, null, -1))
2117
- ])) : (x(), V(ie, { key: 1 }, [
2128
+ ])) : (x(), P(ie, { key: 1 }, [
2118
2129
  n("div", Xa, [
2119
2130
  n("div", en, [
2120
2131
  k(B, {
@@ -2134,21 +2145,21 @@ const Da = Dt(
2134
2145
  placeholder: "Filter items"
2135
2146
  }, null, 8, ["modelValue"])
2136
2147
  ]),
2137
- v(t).skuTags.size ? (x(), V("div", tn, [
2138
- (x(!0), V(ie, null, Ce(v(t).skuTags.keys(), (T) => (x(), de(B, {
2148
+ v(t).skuTags.size ? (x(), P("div", tn, [
2149
+ (x(!0), P(ie, null, Ce(v(t).skuTags.keys(), (T) => (x(), ue(B, {
2139
2150
  key: `${T}`,
2140
2151
  label: `${T}`,
2141
2152
  selectable: "",
2142
2153
  selected: I[`${T}`],
2143
- onClick: (ae) => I[`${T}`] = !I[`${T}`]
2154
+ onClick: (ne) => I[`${T}`] = !I[`${T}`]
2144
2155
  }, {
2145
2156
  default: Y(() => [
2146
- I[`${T}`] ? (x(), de(L, {
2157
+ I[`${T}`] ? (x(), ue(L, {
2147
2158
  key: 0,
2148
2159
  name: "check",
2149
2160
  class: "text-white",
2150
2161
  size: "sm"
2151
- })) : ne("", !0),
2162
+ })) : te("", !0),
2152
2163
  n("span", {
2153
2164
  class: $e([
2154
2165
  "",
@@ -2161,7 +2172,7 @@ const Da = Dt(
2161
2172
  ]),
2162
2173
  _: 2
2163
2174
  }, 1032, ["label", "selected", "onClick"]))), 128))
2164
- ])) : ne("", !0),
2175
+ ])) : te("", !0),
2165
2176
  n("div", an, [
2166
2177
  n("div", {
2167
2178
  style: bt({ height: "600px", minWidth: `${je.value}px` })
@@ -2175,18 +2186,18 @@ const Da = Dt(
2175
2186
  ])
2176
2187
  ], 64))
2177
2188
  ])
2178
- ], 64)) : ne("", !0),
2179
- ke.value.value === "history" ? (x(), V("div", nn, [
2180
- _e.value.length ? (x(), V("div", rn, [
2181
- (x(!0), V(ie, null, Ce(_e.value, (T, ae) => (x(), V(ie, { key: ae }, [
2189
+ ], 64)) : te("", !0),
2190
+ _e.value.value === "history" ? (x(), P("div", nn, [
2191
+ xe.value.length ? (x(), P("div", rn, [
2192
+ (x(!0), P(ie, null, Ce(xe.value, (T, ne) => (x(), P(ie, { key: ne }, [
2182
2193
  n("div", ln, [
2183
2194
  n("div", cn, [
2184
2195
  n("div", un, [
2185
2196
  n("div", {
2186
2197
  class: $e([
2187
2198
  {
2188
- "bg-fm-color-primary": ae !== 0,
2189
- "bg-white": ae === 0
2199
+ "bg-fm-color-primary": ne !== 0,
2200
+ "bg-white": ne === 0
2190
2201
  },
2191
2202
  "w-[2px] h-full"
2192
2203
  ])
@@ -2197,8 +2208,8 @@ const Da = Dt(
2197
2208
  n("div", {
2198
2209
  class: $e([
2199
2210
  {
2200
- "bg-fm-color-primary": ae < _e.value.length - 1,
2201
- "bg-white": ae >= _e.value.length - 1
2211
+ "bg-fm-color-primary": ne < xe.value.length - 1,
2212
+ "bg-white": ne >= xe.value.length - 1
2202
2213
  },
2203
2214
  "w-[2px] h-full"
2204
2215
  ])
@@ -2211,13 +2222,13 @@ const Da = Dt(
2211
2222
  ])
2212
2223
  ]),
2213
2224
  n("div", vn, [
2214
- n("div", gn, [
2215
- n("div", yn, [
2225
+ n("div", yn, [
2226
+ n("div", gn, [
2216
2227
  n("div", {
2217
2228
  class: $e([
2218
2229
  {
2219
- "bg-fm-color-primary": ae < _e.value.length - 1,
2220
- "bg-white": ae >= _e.value.length - 1
2230
+ "bg-fm-color-primary": ne < xe.value.length - 1,
2231
+ "bg-white": ne >= xe.value.length - 1
2221
2232
  },
2222
2233
  "w-[2px] h-full"
2223
2234
  ])
@@ -2231,14 +2242,14 @@ const Da = Dt(
2231
2242
  }, {
2232
2243
  default: Y(() => [
2233
2244
  n("div", hn, [
2234
- (x(!0), V(ie, null, Ce(T.info, (le, ye) => (x(), V("div", {
2235
- key: ye,
2245
+ (x(!0), P(ie, null, Ce(T.info, (le, ge) => (x(), P("div", {
2246
+ key: ge,
2236
2247
  class: "flex flex-col gap-4"
2237
2248
  }, [
2238
2249
  n("div", kn, X(le == null ? void 0 : le.label), 1),
2239
2250
  n("div", _n, [
2240
- (x(!0), V(ie, null, Ce(le == null ? void 0 : le.values, (Se, Pe) => (x(), V("div", {
2241
- key: Pe,
2251
+ (x(!0), P(ie, null, Ce(le == null ? void 0 : le.values, (Se, Ve) => (x(), P("div", {
2252
+ key: Ve,
2242
2253
  class: "fm-typo-en-body-lg-600"
2243
2254
  }, X(Se), 1))), 128))
2244
2255
  ])
@@ -2250,8 +2261,8 @@ const Da = Dt(
2250
2261
  ])
2251
2262
  ])
2252
2263
  ], 64))), 128))
2253
- ])) : (x(), V("div", on, [
2254
- k(ue),
2264
+ ])) : (x(), P("div", on, [
2265
+ k(me),
2255
2266
  n("div", null, [
2256
2267
  n("img", {
2257
2268
  src: v(oa),
@@ -2260,43 +2271,43 @@ const Da = Dt(
2260
2271
  ]),
2261
2272
  a[16] || (a[16] = n("div", { class: "fm-typo-en-body-lg-600" }, X("No records found"), -1)),
2262
2273
  a[17] || (a[17] = n("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary px-16" }, X("You can track approval and rejection history here"), -1)),
2263
- k(ue),
2264
- k(ue)
2274
+ k(me),
2275
+ k(me)
2265
2276
  ]))
2266
- ])) : ne("", !0)
2277
+ ])) : te("", !0)
2267
2278
  ])
2268
2279
  ]),
2269
2280
  _: 1
2270
2281
  }, 8, ["model-value"]),
2271
- v(y) && e.draft ? (x(), de(Na, {
2282
+ v(g) && e.draft ? (x(), ue(Na, {
2272
2283
  key: 0,
2273
2284
  show: Re.value,
2274
2285
  "onUpdate:show": a[10] || (a[10] = (T) => Re.value = T),
2275
2286
  refreshing: M.value,
2276
- approving: Ve.value,
2287
+ approving: Pe.value,
2277
2288
  draft: e.draft,
2278
- onRefresh: me,
2289
+ onRefresh: de,
2279
2290
  onApprove: jt
2280
- }, null, 8, ["show", "refreshing", "approving", "draft"])) : ne("", !0)
2291
+ }, null, 8, ["show", "refreshing", "approving", "draft"])) : te("", !0)
2281
2292
  ], 64);
2282
2293
  };
2283
2294
  }
2284
2295
  }), wn = { class: "flex-1 flex flex-col gap-8" }, Sn = { class: "flex flex-col" }, Fn = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Cn = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, $n = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary line-clamp-2" }, Bn = { class: "fm-typo-en-body-lg-400 line-clamp-2" }, Wn = /* @__PURE__ */ Te({
2285
2296
  __name: "ClosingDraftView",
2286
2297
  setup(c) {
2287
- const { t: o } = kt(), { viewDraft: e } = Ke(), { viewClosingDraftProps: d, viewClosingDraftShow: h } = Qt(Ke()), y = Ye(), m = Da(), M = Nt(), { breakpoints: U } = Ot();
2288
- y.watchLocation(m.fetchDrafts);
2289
- const R = P(() => m.loading), _ = q(""), E = P(() => U.value.xs || U.value.sm), j = P(() => E.value ? 10 : 20);
2298
+ const { t: o } = kt(), { viewDraft: e } = Ke(), { viewClosingDraftProps: d, viewClosingDraftShow: h } = Qt(Ke()), g = Ye(), f = Da(), M = Nt(), { breakpoints: U } = Ot();
2299
+ g.watchLocation(f.fetchDrafts);
2300
+ const R = V(() => f.loading), _ = q(""), E = V(() => U.value.xs || U.value.sm), j = V(() => E.value ? 10 : 20);
2290
2301
  function G(C) {
2291
2302
  switch (C) {
2292
2303
  case "refresh":
2293
- return m.fetchDrafts();
2304
+ return f.fetchDrafts();
2294
2305
  }
2295
2306
  }
2296
2307
  function s(C) {
2297
2308
  return C;
2298
2309
  }
2299
- const t = P(() => E.value ? [
2310
+ const t = V(() => E.value ? [
2300
2311
  {
2301
2312
  label: o("inventory.common.refresh"),
2302
2313
  value: "refresh",
@@ -2311,7 +2322,7 @@ const Da = Dt(
2311
2322
  ]);
2312
2323
  return (C, I) => {
2313
2324
  const Z = K("FmTable");
2314
- return x(), V(ie, null, [
2325
+ return x(), P(ie, null, [
2315
2326
  k(Et, {
2316
2327
  title: v(o)("inventory.closing.draft.title"),
2317
2328
  actions: t.value,
@@ -2331,42 +2342,42 @@ const Da = Dt(
2331
2342
  "change-location": "",
2332
2343
  searchable: "",
2333
2344
  search: _.value,
2334
- "onUpdate:search": I[0] || (I[0] = (g) => _.value = g)
2345
+ "onUpdate:search": I[0] || (I[0] = (y) => _.value = y)
2335
2346
  }, null, 8, ["search"]),
2336
2347
  k(Z, {
2337
2348
  style: bt(v(M).tableHeight),
2338
- "column-defs": v(m).columnDefs,
2339
- "row-data": v(m).drafts,
2349
+ "column-defs": v(f).columnDefs,
2350
+ "row-data": v(f).drafts,
2340
2351
  "search-value": _.value,
2341
2352
  loading: R.value,
2342
- onRowClick: I[1] || (I[1] = (g) => v(e)(g.original)),
2353
+ onRowClick: I[1] || (I[1] = (y) => v(e)(y.original)),
2343
2354
  "page-size": j.value
2344
2355
  }, {
2345
- "list-row": Y((g) => [
2356
+ "list-row": Y((y) => [
2346
2357
  k(ta, {
2347
- row: g,
2358
+ row: y,
2348
2359
  onRowClick: (l) => v(e)(l)
2349
2360
  }, {
2350
2361
  default: Y((l) => {
2351
- var $, z, te, oe, w, ee, me, A, D, J, O, re, Q, ve, je, we, Ie, Ue, he, ke;
2362
+ var $, z, ae, oe, w, ee, de, A, D, J, O, re, Q, ve, je, we, Ie, Ue, ke, _e;
2352
2363
  return [
2353
2364
  n("div", wn, [
2354
2365
  n("div", Sn, [
2355
2366
  n("div", Fn, [
2356
2367
  k(v(Le), {
2357
- render: (te = (z = ($ = l._id) == null ? void 0 : $.column) == null ? void 0 : z.columnDef) == null ? void 0 : te.cell,
2368
+ render: (ae = (z = ($ = l._id) == null ? void 0 : $.column) == null ? void 0 : z.columnDef) == null ? void 0 : ae.cell,
2358
2369
  props: (w = (oe = l._id) == null ? void 0 : oe.getContext) == null ? void 0 : w.call(oe)
2359
2370
  }, null, 8, ["render", "props"])
2360
2371
  ]),
2361
2372
  n("div", Cn, [
2362
2373
  k(v(Le), {
2363
- render: (A = (me = (ee = l.name) == null ? void 0 : ee.column) == null ? void 0 : me.columnDef) == null ? void 0 : A.cell,
2374
+ render: (A = (de = (ee = l.name) == null ? void 0 : ee.column) == null ? void 0 : de.columnDef) == null ? void 0 : A.cell,
2364
2375
  props: (J = (D = l.name) == null ? void 0 : D.getContext) == null ? void 0 : J.call(D)
2365
2376
  }, null, 8, ["render", "props"])
2366
2377
  ]),
2367
2378
  n("div", $n, X([
2368
- ...g.original.items.slice(0, 3).map((_e) => _e.sku.name),
2369
- ...g.original.items.length >= 3 ? [`and ${g.original.items.length - 3} more items`] : []
2379
+ ...y.original.items.slice(0, 3).map((xe) => xe.sku.name),
2380
+ ...y.original.items.length >= 3 ? [`and ${y.original.items.length - 3} more items`] : []
2370
2381
  ].join(", ")), 1),
2371
2382
  n("div", Bn, [
2372
2383
  k(v(Le), {
@@ -2378,7 +2389,7 @@ const Da = Dt(
2378
2389
  n("div", null, [
2379
2390
  k(v(Le), {
2380
2391
  render: (Ue = (Ie = (we = l.status) == null ? void 0 : we.column) == null ? void 0 : Ie.columnDef) == null ? void 0 : Ue.cell,
2381
- props: (ke = (he = l.status) == null ? void 0 : he.getContext) == null ? void 0 : ke.call(he)
2392
+ props: (_e = (ke = l.status) == null ? void 0 : ke.getContext) == null ? void 0 : _e.call(ke)
2382
2393
  }, null, 8, ["render", "props"])
2383
2394
  ])
2384
2395
  ])
@@ -2393,12 +2404,12 @@ const Da = Dt(
2393
2404
  ]),
2394
2405
  _: 1
2395
2406
  }, 8, ["title", "actions"]),
2396
- (x(), de(Mt, { to: "body" }, [
2407
+ (x(), ue(Mt, { to: "body" }, [
2397
2408
  k(An, Lt(v(d), {
2398
2409
  show: v(h),
2399
- "onUpdate:show": I[2] || (I[2] = (g) => yt(h) ? h.value = g : null),
2400
- onSubmitted: I[3] || (I[3] = () => (h.value = !1, v(m).fetchDrafts())),
2401
- onRefresh: I[4] || (I[4] = (g) => v(m).updateDraftRef(g))
2410
+ "onUpdate:show": I[2] || (I[2] = (y) => gt(h) ? h.value = y : null),
2411
+ onSubmitted: I[3] || (I[3] = () => (h.value = !1, v(f).fetchDrafts())),
2412
+ onRefresh: I[4] || (I[4] = (y) => v(f).updateDraftRef(y))
2402
2413
  }), null, 16, ["show"])
2403
2414
  ]))
2404
2415
  ], 64);