@feedmepos/mf-inventory-portal 1.2.51-dev.1 → 1.2.51

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 (96) hide show
  1. package/dist/{App-bY_YcLwH.js → App-BJ_vKOR1.js} +70 -75
  2. package/dist/{ApprovalView-vzIiBqt2.js → ApprovalView-B_prTTtl.js} +34 -34
  3. package/dist/{BindingsDialog-DCh2ORem.js → BindingsDialog-BPuKgJIk.js} +2 -2
  4. package/dist/{BindingsPicker-DcNG03p-.js → BindingsPicker-Dv_cmEil.js} +2 -2
  5. package/dist/{BindingsTable-B_Yaq-z3.js → BindingsTable-BNSfYRfq.js} +4 -4
  6. package/dist/{ClosingDraftView-C0T8cWEB.js → ClosingDraftView-C78tcaJ3.js} +399 -413
  7. package/dist/{ClosingHistoryView-DkKAjh7T.js → ClosingHistoryView-DY8liEk3.js} +27 -27
  8. package/dist/{ClosingTemplateView-DpH1EyW5.js → ClosingTemplateView-pJXEcrjO.js} +17 -18
  9. package/dist/{DeliveryOrderPrintPreview-B2ecLaLu.js → DeliveryOrderPrintPreview-Bu_l-kxu.js} +1 -1
  10. package/dist/FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-Dgibb-Fh.js +231 -0
  11. package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-kVpsL4cx.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DHe5G3kX.js} +12 -12
  12. package/dist/{FmMultiselectDialog-DGUwruxs.js → FmMultiselectDialog-C3iCMK5I.js} +1 -1
  13. package/dist/FmMultiselectDialog-CDONDKxE.js +598 -0
  14. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-CRTG3VFo.js → FmUnitInput.vue_vue_type_script_setup_true_lang-CefvebOx.js} +3 -3
  15. package/dist/{ImportView-Bk4Z7nGh.js → ImportView-JrenRgiI.js} +7 -7
  16. package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-BEJ19Uej.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-CSdxodp6.js} +1 -1
  17. package/dist/{IngredientGroupView-8GHMMOux.js → IngredientGroupView-aDFq_ZDh.js} +107 -108
  18. package/dist/{IngredientsView-DbmODx-v.js → IngredientsView-DSh3UqDg.js} +125 -126
  19. package/dist/{IntegrationView-DC0O_Lk4.js → IntegrationView-KhZ78uxM.js} +80 -80
  20. package/dist/{InventoryBindingForm-ln0q25n_.js → InventoryBindingForm-DZu0CZYh.js} +1 -1
  21. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-CFgk9rSe.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-YuCn0irA.js} +21 -21
  22. package/dist/{InventoryBindingSummary-BlNXhS4v.js → InventoryBindingSummary-DZxLhZ_-.js} +1 -1
  23. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-BY_mXqPr.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DAwpZY3n.js} +1 -1
  24. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-BhNjwE3X.js → PremiumBadge.vue_vue_type_script_setup_true_lang-CPDxwz-V.js} +2 -2
  25. package/dist/{PublishView-5GkTzxbi.js → PublishView-CLnQ7NBN.js} +3 -3
  26. package/dist/{PurchaseOrderPrintPreview-Dj5lJ5Ou.js → PurchaseOrderPrintPreview-DiBztBma.js} +1 -1
  27. package/dist/ReceiveRequestView-_TOSnDGJ.js +2913 -0
  28. package/dist/{RecipeView-OLPRwnVx.js → RecipeView-BPIMvoTw.js} +82 -83
  29. package/dist/{StockView-TcA5zJqr.js → StockView-CI8MUJay.js} +112 -113
  30. package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-DZ6TDkKR.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-DEBHEMkh.js} +1 -1
  31. package/dist/{SupplierView-77qI9YCg.js → SupplierView-COihDMNY.js} +27 -28
  32. package/dist/{SystemTrailDialog.vue_vue_type_script_setup_true_lang-_8YeihNH.js → SystemTrailDialog.vue_vue_type_script_setup_true_lang-D-c0Ayis.js} +2 -2
  33. package/dist/TableActionableRow.vue_vue_type_script_setup_true_lang-cfFHDIwQ.js +162 -0
  34. package/dist/{TemplatePublishDialog.vue_vue_type_script_setup_true_lang-ByPIjcED.js → TemplatePublishDialog.vue_vue_type_script_setup_true_lang-D8vbPlie.js} +13 -13
  35. package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-7BoFD5wV.js → TransferDetails.vue_vue_type_script_setup_true_lang-BVuuw11z.js} +659 -658
  36. package/dist/{TransferTemplateView-CI0U36Tr.js → TransferTemplateView-B2NNfrEq.js} +81 -82
  37. package/dist/{UnitView-fNFFUNlb.js → UnitView-ZsbM07hw.js} +19 -20
  38. package/dist/{WarehouseView-BAXgnZnO.js → WarehouseView-Cd5RFu5v.js} +20 -21
  39. package/dist/{WastageTemplateView-C5qCXWqZ.js → WastageTemplateView-DpikyyZW.js} +164 -165
  40. package/dist/api/netsuite.d.ts +0 -8
  41. package/dist/{app-CddcvygU.js → app-CySQTQxj.js} +4410 -4513
  42. package/dist/app-uBuHtW8m.js +8127 -0
  43. package/dist/app.d.ts +0 -52
  44. package/dist/app.js +1 -1
  45. package/dist/{closing-template-DxdLqlb1.js → closing-template-DXGjC5AG.js} +1 -1
  46. package/dist/components/FmInventoryTableToolbar.vue.d.ts +0 -8
  47. package/dist/components/FmMultiselectDialogProps.d.ts +0 -5
  48. package/dist/cypress/component/receive-request/KDI-15-total-price-currency.cy.d.ts +2 -0
  49. package/dist/{date2-CVZy20Q_.js → date2-BWoUn1K_.js} +1 -1
  50. package/dist/{dayjs.min-NrRtjg32.js → dayjs.min-cMW8olEu.js} +26 -26
  51. package/dist/{decimal-Du3Grkk9.js → decimal-8BRzZQU6.js} +2 -2
  52. package/dist/{defineDeepModel-DgRoiQBp.js → defineDeepModel-AsUZ-DyW.js} +1 -1
  53. package/dist/{duplicate-template-DvnZ4BW6.js → duplicate-template-CyHfZR3S.js} +1 -1
  54. package/dist/{feature-CTA18HlL.js → feature-Dm0FnWf9.js} +6178 -8906
  55. package/dist/{format-time-from-id-6kt1RMWs.js → format-time-from-id-C9lmv5BP.js} +1 -1
  56. package/dist/{format-unit-display-mVJ-nuJe.js → format-unit-display-BV8pJisO.js} +11 -11
  57. package/dist/{import-export.helper-DWwlJy7N.js → import-export.helper-Djxw_H5S.js} +5 -5
  58. package/dist/{index-By-jyWOP.js → index-8hCa5_Gb.js} +1 -1
  59. package/dist/{index-BfcdagSF.js → index-D6u3kywf.js} +1 -1
  60. package/dist/{index-BEcj1jGd.js → index-DidYtgNc.js} +3 -3
  61. package/dist/{lodash-D0COOw3m.js → lodash-CW_Ea6mA.js} +1 -1
  62. package/dist/netsuite-BEto-z0v.js +5131 -0
  63. package/dist/{purchase-order-template-CJCmABzP.js → purchase-order-template-BTzjcgrO.js} +1 -1
  64. package/dist/router/name.d.ts +0 -1
  65. package/dist/{rules-hQBVd1Mn.js → rules-DkVWS5mF.js} +9 -9
  66. package/dist/{stock-4xGaezEy.js → stock-CHw8pI8V.js} +3 -3
  67. package/dist/{stock-B6QW-S14.js → stock-D8hLHgeN.js} +1 -1
  68. package/dist/stores/feature.d.ts +2 -4
  69. package/dist/stores/integration/netsuite.d.ts +0 -5
  70. package/dist/style.css +1 -1
  71. package/dist/{supplier-C-dmFnqw.js → supplier-Dv83IfQr.js} +2 -2
  72. package/dist/tsconfig.app.tsbuildinfo +1 -1
  73. package/dist/{use-ingredient-select-dialog-DgYSZDN8.js → use-ingredient-select-dialog-CJjd4g-6.js} +2 -2
  74. package/dist/{use-inventory-binding-dialog-CnYcA_Fo.js → use-inventory-binding-dialog-D4g79p5S.js} +2 -2
  75. package/dist/{use-template-enabled-locations-2-B_aZrMUU.js → use-template-enabled-locations-2-Cg2iqQdq.js} +2 -2
  76. package/dist/views/ingredients/helper/calculate-default-cost.d.ts +9 -0
  77. package/dist/views/receive-request/components/transfer-form/TransferForm2.vue.d.ts +22 -0
  78. package/dist/views/receive-request/components/transfer-form/TransferFormWithController.vue.d.ts +0 -714
  79. package/dist/views/receive-request/components/transfer-form/composables/use-transfer-items.d.ts +1 -8
  80. package/dist/views/stock/components/StockRecordCard.vue.d.ts +1 -1
  81. package/dist/{vue-i18n-BCEDBY4T.js → vue-i18n-kUcLfpvT.js} +563 -563
  82. package/dist/{xlsx-CJsXiiEq.js → xlsx-BjeMbhDF.js} +398 -398
  83. package/dist/{xlsx.util-CSudzOii.js → xlsx.util-9eMlJfd9.js} +1 -1
  84. package/package.json +5 -5
  85. package/dist/FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-CI4z5XYQ.js +0 -188
  86. package/dist/FmMultiselectDialog-BviFuAM5.js +0 -618
  87. package/dist/ReceiveRequestView-BAYczSpW.js +0 -2913
  88. package/dist/SurchargeView-CxW2ZZ8a.js +0 -460
  89. package/dist/TableActionableRow.vue_vue_type_script_setup_true_lang-Ca_eYa8-.js +0 -84
  90. package/dist/api/surcharge.d.ts +0 -31
  91. package/dist/app-DiX-EfV6.js +0 -8167
  92. package/dist/component-DpCUABT3.js +0 -82
  93. package/dist/netsuite-3LgQ5ztL.js +0 -5402
  94. package/dist/stores/surcharge.d.ts +0 -18
  95. package/dist/surcharge-Db4IiSEQ.js +0 -71
  96. package/dist/views/surcharge/SurchargeView.vue.d.ts +0 -2
@@ -1,21 +1,20 @@
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
- import { F as Ze, u as Nt, _ as Et } from "./SingleColumnLayout.vue_vue_type_script_setup_true_lang-CWZkVCAj.js";
1
+ import { defineComponent as Te, ref as Q, computed as V, onMounted as Je, resolveComponent as K, openBlock as x, createElementBlock as P, Fragment as ie, createTextVNode as ce, createBlock as me, withCtx as q, 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 Vt, isRef as gt, normalizeClass as $e, normalizeStyle as bt, Teleport as Mt, mergeProps as Lt } from "vue";
2
+ import { F as vt, 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
- 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, J as W, w as H, s as _t, K as he, B as Ee, v as ze, c as Yt, a as xt } from "./app-CddcvygU.js";
4
+ import { useSnackbar as Xe, 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 Z, s as z, J as _t, K as he, A as Ee, v as ze, c as Yt, a as xt } from "./app-CySQTQxj.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 De } from "./date2-CVZy20Q_.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-hQBVd1Mn.js";
9
- import { b as Jt, d as Xt } from "./xlsx.util-CSudzOii.js";
10
- import { u as Ct } from "./stock-4xGaezEy.js";
11
- import { u as at } from "./stock-B6QW-S14.js";
7
+ import { d as Oe, e as At, f as qt, a as De } from "./date2-BWoUn1K_.js";
8
+ import { R as Gt, f as et, a as Ze, t as Wt, d as Be, o as wt, p as St, m as Ft, l as Zt } from "./rules-DkVWS5mF.js";
9
+ import { b as Jt, d as Xt } from "./xlsx.util-9eMlJfd9.js";
10
+ import { u as Ct } from "./stock-CHw8pI8V.js";
11
+ import { u as tt } from "./stock-D8hLHgeN.js";
12
12
  import { D as yt, R as Fe } from "./row-action.enum-BcW_L_nE.js";
13
- import { c as ea } from "./component-DpCUABT3.js";
14
- import { f as ta } from "./format-time-from-id-6kt1RMWs.js";
15
- import { _ as aa } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-kVpsL4cx.js";
16
- import { E as na } from "./empty-placeholder-wf6-BWE8.js";
17
- import { u as oa } from "./vue-i18n-BCEDBY4T.js";
18
- import { _ as sa, F as Le } from "./TableActionableRow.vue_vue_type_script_setup_true_lang-Ca_eYa8-.js";
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-C9lmv5BP.js";
15
+ import { _ as na } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DHe5G3kX.js";
16
+ import { E as oa } from "./empty-placeholder-wf6-BWE8.js";
17
+ import { u as sa } from "./vue-i18n-kUcLfpvT.js";
19
18
  const Qe = Kt((c, o) => {
20
19
  function e() {
21
20
  return Ye().currentLocation.dbName;
@@ -61,33 +60,33 @@ const Qe = Kt((c, o) => {
61
60
  onFinished: { type: Function }
62
61
  },
63
62
  setup(c) {
64
- const o = c, e = q(), d = Qe(), h = et(), g = q(!1), f = q(null), M = q(!1), U = V(() => {
63
+ const o = c, e = Q(), d = Qe(), h = Xe(), g = Q(!1), f = Q(null), M = Q(!1), U = V(() => {
65
64
  switch (o.action) {
66
- case W.enum.approveDraft:
65
+ case Z.enum.approveDraft:
67
66
  return "Approve";
68
- case W.enum.rejectDraft:
67
+ case Z.enum.rejectDraft:
69
68
  return "Reject";
70
- case W.enum.markAsFailed:
69
+ case Z.enum.markAsFailed:
71
70
  return "Mark as Failed";
72
71
  }
73
72
  throw new Error(`Unknown action: ${o.action}`);
74
73
  }), R = V(() => {
75
74
  switch (o.action) {
76
- case W.enum.approveDraft:
75
+ case Z.enum.approveDraft:
77
76
  return "primary";
78
- case W.enum.rejectDraft:
77
+ case Z.enum.rejectDraft:
79
78
  return "destructive";
80
- case W.enum.markAsFailed:
79
+ case Z.enum.markAsFailed:
81
80
  return "destructive";
82
81
  }
83
82
  throw new Error(`Unknown action: ${o.action}`);
84
83
  });
85
- Xe(() => {
84
+ Je(() => {
86
85
  if (o.draft.effectiveAt)
87
86
  f.value = new Date(o.draft.effectiveAt);
88
87
  else {
89
- const s = new Date(o.draft.createdAt);
90
- s.setHours(23, 59, 59, 999), f.value = s;
88
+ const r = new Date(o.draft.createdAt);
89
+ r.setHours(23, 59, 59, 999), f.value = r;
91
90
  }
92
91
  M.value = !0;
93
92
  });
@@ -95,9 +94,9 @@ const Qe = Kt((c, o) => {
95
94
  get() {
96
95
  return f.value === null ? "" : Oe(f.value);
97
96
  },
98
- set(s) {
99
- if (s) {
100
- const t = /* @__PURE__ */ new Date(`${s} ${E.value}`);
97
+ set(r) {
98
+ if (r) {
99
+ const t = /* @__PURE__ */ new Date(`${r} ${E.value}`);
101
100
  t.setSeconds(59, 999), f.value = t;
102
101
  } else
103
102
  f.value = null;
@@ -106,18 +105,18 @@ const Qe = Kt((c, o) => {
106
105
  get() {
107
106
  return f.value === null ? "" : At(f.value);
108
107
  },
109
- set(s) {
110
- if (s) {
111
- const t = /* @__PURE__ */ new Date(`${_.value} ${s}`);
108
+ set(r) {
109
+ if (r) {
110
+ const t = /* @__PURE__ */ new Date(`${_.value} ${r}`);
112
111
  t.setSeconds(59, 999), f.value = t;
113
112
  } else
114
113
  f.value = null;
115
114
  }
116
115
  }), j = V(() => f.value ? f.value.getTime() > (/* @__PURE__ */ new Date()).getTime() : !1);
117
- async function G(s) {
116
+ async function G(r) {
118
117
  g.value = !0;
119
118
  try {
120
- s ? await d.runOperationV1({
119
+ r ? await d.runOperationV1({
121
120
  _id: o.draft._id,
122
121
  _rev: o.draft._rev ?? "",
123
122
  action: o.action,
@@ -148,71 +147,58 @@ const Qe = Kt((c, o) => {
148
147
  g.value = !1;
149
148
  }
150
149
  }
151
- return (s, t) => {
152
- const C = K("FmLabel"), I = K("FmDatePicker"), Z = K("FmTimePicker"), y = K("FmTextField"), l = K("FmButton"), $ = K("FmForm");
153
- return M.value ? (x(), ue($, {
150
+ return (r, t) => {
151
+ const C = K("FmLabel"), I = K("FmDatePicker"), W = K("FmTimePicker"), y = K("FmTextField"), i = K("FmButton"), $ = K("FmForm");
152
+ return M.value ? (x(), me($, {
154
153
  key: 1,
155
154
  onValidationSuccess: G,
156
155
  class: "flex flex-col gap-32",
157
156
  disabled: g.value
158
157
  }, {
159
- default: Y(() => [
158
+ default: q(() => [
160
159
  n("div", ra, [
161
- t[5] || (t[5] = ce(" You are about to ")),
160
+ t[4] || (t[4] = ce(" You are about to ")),
162
161
  n("span", la, X(U.value), 1),
163
- t[6] || (t[6] = ce(" this draft. Please provide a remark to justify this action. "))
162
+ t[5] || (t[5] = ce(" this draft. Please provide a remark to justify this action. "))
164
163
  ]),
165
- s.action === v(W).enum.approveDraft ? (x(), P("div", ia, [
164
+ r.action === v(Z).enum.approveDraft ? (x(), P("div", ia, [
166
165
  k(C, { class: "fm-typo-en-body-lg-600" }, {
167
- default: Y(() => t[7] || (t[7] = [
166
+ default: q(() => t[6] || (t[6] = [
168
167
  ce("Closing Date")
169
168
  ])),
170
169
  _: 1
171
170
  }),
172
171
  k(I, {
173
172
  modelValue: _.value,
174
- "onUpdate:modelValue": t[0] || (t[0] = (z) => _.value = z),
173
+ "onUpdate:modelValue": t[0] || (t[0] = (H) => _.value = H),
175
174
  max: v(Oe)(/* @__PURE__ */ new Date())
176
175
  }, null, 8, ["modelValue", "max"]),
177
176
  k(C, { class: "fm-typo-en-body-lg-600" }, {
178
- default: Y(() => t[8] || (t[8] = [
177
+ default: q(() => t[7] || (t[7] = [
179
178
  ce("Closing Time")
180
179
  ])),
181
180
  _: 1
182
181
  }),
183
- k(Z, {
182
+ k(W, {
184
183
  modelValue: E.value,
185
- "onUpdate:modelValue": t[1] || (t[1] = (z) => E.value = z)
184
+ "onUpdate:modelValue": t[1] || (t[1] = (H) => E.value = H)
186
185
  }, null, 8, ["modelValue"]),
187
- j.value ? (x(), P("div", ca, " Cannot select future date ")) : te("", !0)
188
- ])) : te("", !0),
186
+ j.value ? (x(), P("div", ca, " Cannot select future date ")) : ne("", !0)
187
+ ])) : ne("", !0),
189
188
  k(y, {
190
189
  modelValue: e.value,
191
- "onUpdate:modelValue": t[2] || (t[2] = (z) => e.value = z),
190
+ "onUpdate:modelValue": t[2] || (t[2] = (H) => e.value = H),
192
191
  label: "Remark",
193
192
  "label-mark": "required",
194
193
  rules: [v(Gt)()]
195
194
  }, null, 8, ["modelValue", "rules"]),
196
195
  n("div", ua, [
197
- k(l, {
196
+ k(i, {
198
197
  label: "Cancel",
199
198
  variant: "tertiary",
200
- onClick: t[3] || (t[3] = (z) => s.onCancel())
199
+ onClick: t[3] || (t[3] = (H) => r.onCancel())
201
200
  }),
202
- s.action === v(W).enum.approveDraft ? (x(), ue(Ze, { key: 0 }, {
203
- default: Y(() => [
204
- k(l, {
205
- label: "Approve (Legacy)",
206
- type: "button",
207
- onClick: t[4] || (t[4] = (z) => G(!0)),
208
- variant: R.value,
209
- loading: g.value,
210
- disabled: j.value
211
- }, null, 8, ["variant", "loading", "disabled"])
212
- ]),
213
- _: 1
214
- })) : te("", !0),
215
- k(l, {
201
+ k(i, {
216
202
  label: U.value,
217
203
  type: "submit",
218
204
  variant: R.value,
@@ -230,49 +216,49 @@ const Qe = Kt((c, o) => {
230
216
  function $t(c) {
231
217
  const o = c.measurementsAmounts.groupBy((d) => d.measurement.id), e = c.sku.unit.measurements.reduce((d, h) => {
232
218
  var M, U;
233
- const g = ((U = (M = o.get(h.id)) == null ? void 0 : M[0]) == null ? void 0 : U.amount) ?? da, f = tt(h.conversion, g);
234
- return d + +Je(f);
235
- }, +Je(c.baseAmount));
219
+ const g = ((U = (M = o.get(h.id)) == null ? void 0 : M[0]) == null ? void 0 : U.amount) ?? da, f = et(h.conversion, g);
220
+ return d + +Ze(f);
221
+ }, +Ze(c.baseAmount));
236
222
  return Wt(e, c.baseAmount.precision);
237
223
  }
238
224
  const ma = Be(0), fa = Be(100), Bt = "N/A";
239
225
  function pa(c, o, e, d, h, g) {
240
- var ae, oe, w, ee, de;
226
+ var te, oe, w, ee, ue;
241
227
  const f = $t(c), M = d ?? f, U = wt(M, o), R = o.amount === 0 ? null : St(U, {
242
228
  ...o,
243
229
  amount: Math.abs(o.amount)
244
- }), _ = 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) ?? {
230
+ }), _ = R ? et(R, fa) : null, E = ((te = c.sku.defaultCost) == null ? void 0 : te.costPerUnit) ?? { amount: 0, precision: 0 }, j = Number(z.toFormatString({ value: E })), G = ((w = (oe = c.sku.defaultCost) == null ? void 0 : oe.measurement) == null ? void 0 : w.conversion) ?? {
245
231
  amount: 1,
246
232
  precision: 0
247
- }, s = Number(
248
- H.toFormatString({ value: G })
249
- ), 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;
233
+ }, r = Number(
234
+ z.toFormatString({ value: G })
235
+ ), t = h ? Number(z.toFormatString({ value: h })) : 0, C = Number(z.toFormatString({ value: o })), I = Number(z.toFormatString({ value: M })), W = C - I, y = W * j / r, i = I * j / r, $ = C * j / r;
250
236
  return {
251
237
  code: c.sku.code,
252
238
  name: c.sku.name,
253
239
  baseUnit: c.sku.unit.abbrev,
254
- costUnit: ((de = (ee = c.sku.defaultCost) == null ? void 0 : ee.measurement) == null ? void 0 : de.abbrev) ?? null,
255
- baseUnitAmount: Number(H.toFormatString({ value: c.baseAmount })),
240
+ costUnit: ((ue = (ee = c.sku.defaultCost) == null ? void 0 : ee.measurement) == null ? void 0 : ue.abbrev) ?? null,
241
+ baseUnitAmount: Number(z.toFormatString({ value: c.baseAmount })),
256
242
  ...c.measurementsAmounts.filter(
257
243
  (A) => va(A.measurement) && e.includes(A.measurement.id)
258
244
  ).reduce(
259
- (A, D, J) => (A[`measurementAbbrev${J}`] = `(${D.measurement.abbrev}) × ${H.toFormatString({ value: D.measurement.conversion })}`, A[`measurementAmount${J}`] = Number(H.toFormatString({ value: D.amount })), A),
245
+ (A, D, J) => (A[`measurementAbbrev${J}`] = `(${D.measurement.abbrev}) × ${z.toFormatString({ value: D.measurement.conversion })}`, A[`measurementAmount${J}`] = Number(z.toFormatString({ value: D.amount })), A),
260
246
  {}
261
247
  ),
262
248
  systemBalance: C,
263
249
  physicalBalance: I,
264
- adjustedAmount: Number(H.toFormatString({ value: U })),
250
+ adjustedAmount: Number(z.toFormatString({ value: U })),
265
251
  adjustedDiffPercentage: _ ? Number(
266
- H.toFormatString({
252
+ z.toFormatString({
267
253
  value: Ft(_, 2)
268
254
  })
269
255
  ) : null,
270
256
  costPerUnit: j,
271
257
  opening: t,
272
258
  adjustmentTypes: g ?? Bt,
273
- varianceQty: Z,
259
+ varianceQty: W,
274
260
  varianceInCost: y,
275
- stockTakeValue: l,
261
+ stockTakeValue: i,
276
262
  systemValue: $
277
263
  };
278
264
  }
@@ -375,7 +361,7 @@ function ga(c) {
375
361
  ];
376
362
  }
377
363
  function ba(c, o, e) {
378
- var Z, y, l, $, z, ae, oe;
364
+ var W, y, i, $, H, te, oe;
379
365
  const d = o.groupBy(
380
366
  (w) => w.id,
381
367
  (w) => w.balance
@@ -394,31 +380,31 @@ function ba(c, o, e) {
394
380
  }
395
381
  const M = [...c.items, ...c.negativeStockItems ?? []], U = Tt(M), R = M.map((w) => {
396
382
  var J, O, re;
397
- 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);
383
+ const ee = ((J = d.get(w.sku._id)) == null ? void 0 : J[0]) ?? ma, ue = ((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);
398
384
  return pa(
399
385
  w,
400
386
  ee,
401
- de,
387
+ ue,
402
388
  (re = h.get(w.sku._id)) == null ? void 0 : re[0],
403
389
  A,
404
390
  D
405
391
  );
406
- }), _ = ya(M), j = ht().currentBusiness.value, G = ga(_), s = [
392
+ }), _ = ya(M), j = ht().currentBusiness.value, G = ga(_), r = [
407
393
  ["Business name:", j == null ? void 0 : j.name],
408
394
  ["Business ID:", j == null ? void 0 : j._id],
409
395
  ["Menu version", j == null ? void 0 : j.menuVersion],
410
396
  ["Created at", new Date(c.createdAt)],
411
- ["Created by", (Z = c.createdBy) == null ? void 0 : Z.name],
397
+ ["Created by", (W = c.createdBy) == null ? void 0 : W.name],
412
398
  ["Updated at", new Date(c.updatedAt)],
413
399
  ["Updated by", (y = c.updatedBy) == null ? void 0 : y.name],
414
400
  ["Recent action", c.approvedAt ? "Approve" : c.rejectionHistory ? "Reject" : ""],
415
401
  [
416
402
  "Action by",
417
- c.approvedAt ? (l = c.approvedBy) == null ? void 0 : l.name : c.rejectionHistory ? (z = ($ = c.rejectionHistory[0]) == null ? void 0 : $.rejectedBy) == null ? void 0 : z.name : ""
403
+ c.approvedAt ? (i = c.approvedBy) == null ? void 0 : i.name : c.rejectionHistory ? (H = ($ = c.rejectionHistory[0]) == null ? void 0 : $.rejectedBy) == null ? void 0 : H.name : ""
418
404
  ],
419
405
  [
420
406
  "Action at",
421
- c.approvedAt ? new Date(c.approvedAt) : c.rejectionHistory ? new Date((ae = c.rejectionHistory[0]) == null ? void 0 : ae.rejectedAt) : ""
407
+ c.approvedAt ? new Date(c.approvedAt) : c.rejectionHistory ? new Date((te = c.rejectionHistory[0]) == null ? void 0 : te.rejectedAt) : ""
422
408
  ],
423
409
  [
424
410
  "Action remark",
@@ -427,7 +413,7 @@ function ba(c, o, e) {
427
413
  [],
428
414
  G.map((w) => w.name),
429
415
  ...R.map((w) => G.map((ee) => w[ee.id]))
430
- ], t = G.map((w) => `system:${w.id}`), C = Jt(s, t), I = `[${j == null ? void 0 : j.name}] closing draft (${qt(new Date(c.updatedAt))}).xlsx`;
416
+ ], t = G.map((w) => `system:${w.id}`), C = Jt(r, t), I = `[${j == null ? void 0 : j.name}] closing draft (${qt(new Date(c.updatedAt))}).xlsx`;
431
417
  return Xt(C, I), I;
432
418
  }
433
419
  const ha = { class: "flex flex-col" }, ka = {
@@ -442,9 +428,9 @@ const ha = { class: "flex flex-col" }, ka = {
442
428
  },
443
429
  setup(c) {
444
430
  const o = c;
445
- at();
446
- const e = q(!1), d = q(null), h = q(!1);
447
- Xe(() => {
431
+ tt();
432
+ const e = Q(!1), d = Q(null), h = Q(!1);
433
+ Je(() => {
448
434
  if (o.draft.effectiveAt)
449
435
  d.value = new Date(o.draft.effectiveAt);
450
436
  else {
@@ -480,14 +466,14 @@ const ha = { class: "flex flex-col" }, ka = {
480
466
  e.value = !0, o.onFinished(d.value.toISOString());
481
467
  }
482
468
  return (R, _) => {
483
- const E = K("FmLabel"), j = K("FmDatePicker"), G = K("FmTimePicker"), s = K("FmButton"), t = K("FmForm");
484
- return h.value ? (x(), ue(t, {
469
+ const E = K("FmLabel"), j = K("FmDatePicker"), G = K("FmTimePicker"), r = K("FmButton"), t = K("FmForm");
470
+ return h.value ? (x(), me(t, {
485
471
  key: 1,
486
472
  onValidationSuccess: U,
487
473
  class: "flex flex-col gap-32",
488
474
  disabled: e.value
489
475
  }, {
490
- default: Y(() => [
476
+ default: q(() => [
491
477
  _[5] || (_[5] = n("div", { class: "fm-typo-en-body-lg-400" }, [
492
478
  n("p", null, [
493
479
  ce(" Performing "),
@@ -502,7 +488,7 @@ const ha = { class: "flex flex-col" }, ka = {
502
488
  ], -1)),
503
489
  n("div", ha, [
504
490
  k(E, { class: "fm-typo-en-body-lg-600" }, {
505
- default: Y(() => _[3] || (_[3] = [
491
+ default: q(() => _[3] || (_[3] = [
506
492
  ce("Closing Date")
507
493
  ])),
508
494
  _: 1
@@ -513,7 +499,7 @@ const ha = { class: "flex flex-col" }, ka = {
513
499
  max: v(Oe)(/* @__PURE__ */ new Date())
514
500
  }, null, 8, ["modelValue", "max"]),
515
501
  k(E, { class: "fm-typo-en-body-lg-600" }, {
516
- default: Y(() => _[4] || (_[4] = [
502
+ default: q(() => _[4] || (_[4] = [
517
503
  ce("Closing Time")
518
504
  ])),
519
505
  _: 1
@@ -522,15 +508,15 @@ const ha = { class: "flex flex-col" }, ka = {
522
508
  modelValue: f.value,
523
509
  "onUpdate:modelValue": _[1] || (_[1] = (C) => f.value = C)
524
510
  }, null, 8, ["modelValue"]),
525
- M.value ? (x(), P("div", ka, " Cannot select future date ")) : te("", !0)
511
+ M.value ? (x(), P("div", ka, " Cannot select future date ")) : ne("", !0)
526
512
  ]),
527
513
  n("div", _a, [
528
- k(s, {
514
+ k(r, {
529
515
  label: "Cancel",
530
516
  variant: "tertiary",
531
517
  onClick: _[2] || (_[2] = (C) => R.onCancel())
532
518
  }),
533
- k(s, {
519
+ k(r, {
534
520
  label: "Refresh balance",
535
521
  type: "submit",
536
522
  variant: "primary",
@@ -548,18 +534,18 @@ const ha = { class: "flex flex-col" }, ka = {
548
534
  }), Ke = Dt(
549
535
  "closingDraftActions",
550
536
  function() {
551
- const o = zt(), e = et(), d = at(), h = Qe(), g = Ct(), f = q(!1), M = q();
537
+ const o = zt(), e = Xe(), d = tt(), h = Qe(), g = Ct(), f = Q(!1), M = Q();
552
538
  function U(y) {
553
- const l = {
539
+ const i = {
554
540
  draft: y
555
541
  };
556
- M.value = l, f.value = !0;
542
+ M.value = i, f.value = !0;
557
543
  }
558
544
  async function R(y) {
559
545
  var $;
560
546
  if (y.status === he.enum.COMPLETED) {
561
- const z = y.closingAdjustmentId;
562
- if (!z)
547
+ const H = y.closingAdjustmentId;
548
+ if (!H)
563
549
  return e.open({
564
550
  title: "Something went wrong",
565
551
  message: "Closing draft is completed but closing document cannot be found.",
@@ -567,8 +553,8 @@ const ha = { class: "flex flex-col" }, ka = {
567
553
  }), console.error("Closing draft is completed but closing document cannot be found.", {
568
554
  draftId: y._id
569
555
  }), [];
570
- const ae = await d.readAdjustmentById(z);
571
- return ((ae == null ? void 0 : ae.skus) ?? []).map((w) => ({
556
+ const te = await d.readAdjustmentById(H);
557
+ return ((te == null ? void 0 : te.skus) ?? []).map((w) => ({
572
558
  id: w.sku._id,
573
559
  balance: w.fromBalance,
574
560
  costs: w.fromCostBalances
@@ -576,21 +562,21 @@ const ha = { class: "flex flex-col" }, ka = {
576
562
  } else
577
563
  return await g.readStockBalance(), (($ = g.stockBalance) == null ? void 0 : $.skus) ?? [];
578
564
  }
579
- async function _(y, l, $) {
580
- l || (e.open({
565
+ async function _(y, i, $) {
566
+ i || (e.open({
581
567
  title: "Exporting",
582
568
  message: "Fetching data..."
583
- }), l = await R(y)), ba(y, l, $ ?? []);
569
+ }), i = await R(y)), ba(y, i, $ ?? []);
584
570
  }
585
- function E(y, l, $) {
571
+ function E(y, i, $) {
586
572
  o.open({
587
573
  title: "Approve draft",
588
574
  contentComponent: We,
589
575
  contentComponentProps: {
590
576
  draft: y,
591
- action: W.enum.approveDraft,
577
+ action: Z.enum.approveDraft,
592
578
  onFinished: () => {
593
- o.close(), l == null || l();
579
+ o.close(), i == null || i();
594
580
  },
595
581
  onCancel: () => {
596
582
  o.close();
@@ -600,39 +586,39 @@ const ha = { class: "flex flex-col" }, ka = {
600
586
  $ == null || $();
601
587
  });
602
588
  }
603
- function j(y, l) {
589
+ function j(y, i) {
604
590
  o.open({
605
591
  title: "Reject draft",
606
592
  contentComponent: We,
607
593
  contentComponentProps: {
608
594
  draft: y,
609
- action: W.enum.rejectDraft,
595
+ action: Z.enum.rejectDraft,
610
596
  onFinished: () => {
611
- o.close(), l == null || l();
597
+ o.close(), i == null || i();
612
598
  },
613
599
  onCancel: () => o.close()
614
600
  }
615
601
  });
616
602
  }
617
- function G(y, l) {
603
+ function G(y, i) {
618
604
  o.open({
619
605
  title: "Mark draft as failed",
620
606
  contentComponent: We,
621
607
  contentComponentProps: {
622
608
  draft: y,
623
- action: W.enum.markAsFailed,
609
+ action: Z.enum.markAsFailed,
624
610
  onFinished: () => {
625
- o.close(), l == null || l();
611
+ o.close(), i == null || i();
626
612
  },
627
613
  onCancel: () => o.close()
628
614
  }
629
615
  });
630
616
  }
631
- async function s(y, l) {
617
+ async function r(y, i) {
632
618
  await h.sync({
633
619
  _id: y._id,
634
620
  _rev: y._rev ?? "",
635
- action: W.enum.approveDraft,
621
+ action: Z.enum.approveDraft,
636
622
  data: {
637
623
  remark: y.remark ?? ""
638
624
  }
@@ -640,22 +626,22 @@ const ha = { class: "flex flex-col" }, ka = {
640
626
  title: "Success",
641
627
  message: "Sync requested",
642
628
  type: "success"
643
- }), l == null || l();
629
+ }), i == null || i();
644
630
  }
645
631
  function t() {
646
632
  f.value = !1;
647
633
  }
648
- async function C(y, l, $) {
634
+ async function C(y, i, $) {
649
635
  await o.open({
650
636
  title: "Refresh balance",
651
637
  contentComponent: xa,
652
638
  contentComponentProps: {
653
639
  draft: y,
654
- onFinished: (z) => {
655
- o.close(), $ == null || $(z);
640
+ onFinished: (H) => {
641
+ o.close(), $ == null || $(H);
656
642
  },
657
643
  onCancel: async () => {
658
- o.close(), l == null || l();
644
+ o.close(), i == null || i();
659
645
  }
660
646
  }
661
647
  });
@@ -674,7 +660,7 @@ const ha = { class: "flex flex-col" }, ka = {
674
660
  });
675
661
  });
676
662
  }
677
- async function Z(y, l) {
663
+ async function W(y, i) {
678
664
  try {
679
665
  e.open({
680
666
  title: "Cloning",
@@ -683,7 +669,7 @@ const ha = { class: "flex flex-col" }, ka = {
683
669
  title: "Success",
684
670
  message: "Draft cloned successfully",
685
671
  type: "success"
686
- }), l == null || l();
672
+ }), i == null || i();
687
673
  } catch ($) {
688
674
  e.open({
689
675
  title: "Error",
@@ -698,10 +684,10 @@ const ha = { class: "flex flex-col" }, ka = {
698
684
  approveDraft: E,
699
685
  rejectDraft: j,
700
686
  markAsFailed: G,
701
- syncDraft: s,
687
+ syncDraft: r,
702
688
  exportDraft: _,
703
689
  refreshBalance: C,
704
- cloneDraft: Z,
690
+ cloneDraft: W,
705
691
  viewClosingDraftShow: f,
706
692
  viewClosingDraftProps: M,
707
693
  invalidateDraftCache: I
@@ -723,26 +709,26 @@ function He(c) {
723
709
  const Da = Dt(
724
710
  "closingDraftTable",
725
711
  function() {
726
- const { t: o } = kt(), e = ht(), d = Ke(), h = q(new Array()), g = q(!1), f = Ye(), M = Qe();
712
+ const { t: o } = kt(), e = ht(), d = Ke(), h = Q(new Array()), g = Q(!1), f = Ye(), M = Qe();
727
713
  async function U() {
728
714
  if (h.value = [], !!f._currentLocation) {
729
715
  g.value = !0;
730
716
  try {
731
- const [s] = await Promise.all([M.readDrafts()]).delayed(1e3);
732
- h.value = s.reverse();
733
- } catch (s) {
734
- console.log("Something went wrong when fetching drafts:", s);
717
+ const [r] = await Promise.all([M.readDrafts()]).delayed(1e3);
718
+ h.value = r.reverse();
719
+ } catch (r) {
720
+ console.log("Something went wrong when fetching drafts:", r);
735
721
  } finally {
736
722
  g.value = !1;
737
723
  }
738
724
  }
739
725
  }
740
- async function R(s) {
726
+ async function R(r) {
741
727
  if (!h.value.find((t) => t._id) && f._currentLocation) {
742
728
  g.value = !0;
743
729
  try {
744
730
  const [t] = await Promise.all([
745
- M.getDraft(s),
731
+ M.getDraft(r),
746
732
  new Promise((C) => setTimeout(C, 1e3))
747
733
  ]);
748
734
  h.value = [t];
@@ -753,26 +739,26 @@ const Da = Dt(
753
739
  }
754
740
  }
755
741
  }
756
- function _(s) {
757
- h.value = h.value.map((t) => t._id === s._id ? {
758
- ...s,
742
+ function _(r) {
743
+ h.value = h.value.map((t) => t._id === r._id ? {
744
+ ...r,
759
745
  _rev: t._rev
760
746
  } : t);
761
747
  }
762
748
  function E() {
763
749
  d.closeDraftDialog(), U();
764
750
  }
765
- function j(s, t) {
766
- switch (t = Yt(t), s) {
751
+ function j(r, t) {
752
+ switch (t = Yt(t), r) {
767
753
  case Fe.Details:
768
754
  return d.viewDraft(t);
769
755
  case Fe.Export:
770
756
  return d.exportDraft(t);
771
- case W.enum.approveDraft:
757
+ case Z.enum.approveDraft:
772
758
  return d.approveDraft(t, E);
773
- case W.enum.rejectDraft:
759
+ case Z.enum.rejectDraft:
774
760
  return d.rejectDraft(t, E);
775
- case W.enum.markAsFailed:
761
+ case Z.enum.markAsFailed:
776
762
  return d.markAsFailed(t, E);
777
763
  case Fe.Duplicate:
778
764
  return d.cloneDraft(t, E);
@@ -784,17 +770,17 @@ const Da = Dt(
784
770
  id: "_id",
785
771
  accessorKey: "_id",
786
772
  header: () => o("inventory.closing.table.createdAt"),
787
- cell(s) {
788
- return ta(`${s.getValue()}`);
773
+ cell(r) {
774
+ return aa(`${r.getValue()}`);
789
775
  },
790
776
  enableSorting: !0
791
777
  },
792
778
  {
793
779
  accessorKey: "effectiveAt",
794
780
  header: () => "Effective at",
795
- cell(s) {
796
- const t = s.row.original;
797
- let C = s.getValue();
781
+ cell(r) {
782
+ const t = r.row.original;
783
+ let C = r.getValue();
798
784
  return C || (C = Ee(t._id)), De(C);
799
785
  },
800
786
  enableSorting: !0,
@@ -802,7 +788,7 @@ const Da = Dt(
802
788
  },
803
789
  {
804
790
  id: "updatedAt",
805
- accessorFn: (s) => De(s.updatedAt),
791
+ accessorFn: (r) => De(r.updatedAt),
806
792
  header: () => "Updated at",
807
793
  enableSorting: !0,
808
794
  size: 200
@@ -816,9 +802,9 @@ const Da = Dt(
816
802
  },
817
803
  {
818
804
  id: "noOfItems",
819
- accessorFn: (s) => {
805
+ accessorFn: (r) => {
820
806
  var t;
821
- return s.items.length + (((t = s.negativeStockItems) == null ? void 0 : t.length) ?? 0);
807
+ return r.items.length + (((t = r.negativeStockItems) == null ? void 0 : t.length) ?? 0);
822
808
  },
823
809
  header: () => o("inventory.closing.table.noOfItems"),
824
810
  enableSorting: !1,
@@ -829,20 +815,20 @@ const Da = Dt(
829
815
  },
830
816
  {
831
817
  id: "recentRemark",
832
- accessorFn: (s) => {
818
+ accessorFn: (r) => {
833
819
  var t;
834
- return (s == null ? void 0 : s.approveRemark) ?? ((t = s == null ? void 0 : s.rejectionHistory) == null ? void 0 : t.computeFirst((C) => C.rejectRemark)) ?? s.remark;
820
+ return (r == null ? void 0 : r.approveRemark) ?? ((t = r == null ? void 0 : r.rejectionHistory) == null ? void 0 : t.computeFirst((C) => C.rejectRemark)) ?? r.remark;
835
821
  },
836
822
  header: () => "Recent remark"
837
823
  },
838
824
  {
839
825
  id: "status",
840
- accessorFn: (s) => s.status,
826
+ accessorFn: (r) => r.status,
841
827
  header: () => o("inventory.closing.table.status"),
842
828
  enableSorting: !1,
843
- cell(s) {
844
- var l;
845
- 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;
829
+ cell(r) {
830
+ var i;
831
+ const t = r.row.original, C = t.status, I = new Date(t.updatedAt), W = (i = t == null ? void 0 : t.rejectionHistory) == null ? void 0 : i.computeFirst(($) => $.rejectedAt), y = W ? new Date(W) : null;
846
832
  return C === "DRAFT" && y ? y.getTime() > I.getTime() ? F(
847
833
  "div",
848
834
  {
@@ -884,26 +870,26 @@ const Da = Dt(
884
870
  },
885
871
  {
886
872
  id: "action",
887
- cell(s) {
888
- var l;
889
- const t = s.row.original, C = ((l = e.sessionUser.value) == null ? void 0 : l.role.isAdmin) ?? !1, I = [
873
+ cell(r) {
874
+ var i;
875
+ const t = r.row.original, C = ((i = e.sessionUser.value) == null ? void 0 : i.role.isAdmin) ?? !1, I = [
890
876
  yt[Fe.Details],
891
877
  yt[Fe.Export]
892
- ], Z = [
878
+ ], W = [
893
879
  {
894
880
  translationKey: "inventory.closing.draft.approveDraft",
895
881
  color: "text-fm-color-typo-primary",
896
- value: W.enum.approveDraft
882
+ value: Z.enum.approveDraft
897
883
  },
898
884
  {
899
885
  translationKey: "inventory.closing.draft.rejectDraft",
900
886
  color: "text-fm-color-typo-error",
901
- value: W.enum.rejectDraft
887
+ value: Z.enum.rejectDraft
902
888
  },
903
889
  {
904
890
  translationKey: "inventory.closing.draft.markAsFailed",
905
891
  color: "text-fm-color-typo-error",
906
- value: W.enum.markAsFailed
892
+ value: Z.enum.markAsFailed
907
893
  }
908
894
  ], y = C && t.status !== he.enum.DRAFT ? [
909
895
  {
@@ -915,7 +901,7 @@ const Da = Dt(
915
901
  return ea(
916
902
  [
917
903
  ...I,
918
- ...t.status === he.enum.DRAFT ? Z : []
904
+ ...t.status === he.enum.DRAFT ? W : []
919
905
  ],
920
906
  ($) => j($, t),
921
907
  y
@@ -958,24 +944,24 @@ const Da = Dt(
958
944
  },
959
945
  emits: ["update:show", "refresh", "approve"],
960
946
  setup(c, { emit: o }) {
961
- const { FmStepper: e, FmStep: d, FmDialog: h, FmButton: g } = be, { t: f } = oa(), M = xt(), U = c, R = o, _ = V(
947
+ const { FmStepper: e, FmStep: d, FmDialog: h, FmButton: g } = be, { t: f } = sa(), M = xt(), U = c, R = o, _ = V(
962
948
  () => {
963
949
  var A, D;
964
950
  return ((A = U.draft) == null ? void 0 : A.stockSnapshot) && ((D = U.draft) == null ? void 0 : D.stockSnapshot) !== void 0;
965
951
  }
966
952
  ), E = V(() => {
967
953
  var J, O, re;
968
- const A = ((J = U.draft) == null ? void 0 : J.items.map((Q) => ({
969
- id: Q.sku._id,
970
- code: Q.sku.code,
971
- name: Q.sku.name
972
- }))) ?? [], D = ((re = (O = U.draft) == null ? void 0 : O.negativeStockItems) == null ? void 0 : re.map((Q) => ({
973
- id: Q.sku._id,
974
- code: Q.sku.code,
975
- name: Q.sku.name
954
+ const A = ((J = U.draft) == null ? void 0 : J.items.map((Y) => ({
955
+ id: Y.sku._id,
956
+ code: Y.sku.code,
957
+ name: Y.sku.name
958
+ }))) ?? [], D = ((re = (O = U.draft) == null ? void 0 : O.negativeStockItems) == null ? void 0 : re.map((Y) => ({
959
+ id: Y.sku._id,
960
+ code: Y.sku.code,
961
+ name: Y.sku.name
976
962
  }))) ?? [];
977
963
  return [...A, ...D].reduce(
978
- (Q, ve) => (Q[ve.id] = ve, Q),
964
+ (Y, ve) => (Y[ve.id] = ve, Y),
979
965
  {}
980
966
  );
981
967
  }), j = V(
@@ -993,31 +979,31 @@ const Da = Dt(
993
979
  ), G = V(() => {
994
980
  var A;
995
981
  return _.value ? ((A = j.value) == null ? void 0 : A.filter((D) => !E.value[D.id]).map((D) => D.id)) ?? [] : [];
996
- }), s = V({
982
+ }), r = V({
997
983
  get: () => U.show,
998
984
  set: (A) => R("update:show", A)
999
- }), t = q(1), C = () => t.value > 1, I = () => t.value > 2, Z = () => !1;
985
+ }), t = Q(1), C = () => t.value > 1, I = () => t.value > 2, W = () => !1;
1000
986
  function y(A) {
1001
987
  return A === 1 ? _.value : A === 2 ? G.value.length == 0 : !1;
1002
988
  }
1003
- const l = V(() => !_.value || G.value.length > 0);
989
+ const i = V(() => !_.value || G.value.length > 0);
1004
990
  function $(A) {
1005
991
  let D = A + 1;
1006
992
  for (; D <= 3 && y(D); ) D++;
1007
993
  return D > 3 ? 3 : D;
1008
994
  }
1009
- function z(A) {
995
+ function H(A) {
1010
996
  let D = A - 1;
1011
997
  for (; D >= 1 && y(D); ) D--;
1012
998
  return D < 1 ? 1 : D;
1013
999
  }
1014
- function ae() {
1015
- return _.value ? l.value ? 3 : 2 : 1;
1000
+ function te() {
1001
+ return _.value ? i.value ? 3 : 2 : 1;
1016
1002
  }
1017
1003
  Ne(
1018
1004
  () => U.show,
1019
1005
  (A) => {
1020
- A && (t.value = ae());
1006
+ A && (t.value = te());
1021
1007
  }
1022
1008
  ), Ne(
1023
1009
  () => _.value,
@@ -1037,35 +1023,35 @@ const Da = Dt(
1037
1023
  t.value < 3 && (t.value = $(t.value));
1038
1024
  }
1039
1025
  function ee() {
1040
- t.value > 1 && (t.value = z(t.value));
1026
+ t.value > 1 && (t.value = H(t.value));
1041
1027
  }
1042
- function de() {
1028
+ function ue() {
1043
1029
  R("approve");
1044
1030
  }
1045
1031
  return (A, D) => {
1046
1032
  const J = K("FmIcon");
1047
- return x(), ue(v(h), {
1048
- modelValue: s.value,
1049
- "onUpdate:modelValue": D[1] || (D[1] = (O) => s.value = O),
1033
+ return x(), me(v(h), {
1034
+ modelValue: r.value,
1035
+ "onUpdate:modelValue": D[1] || (D[1] = (O) => r.value = O),
1050
1036
  "max-width": 600
1051
1037
  }, {
1052
- "dialog-header": Y(() => [
1038
+ "dialog-header": q(() => [
1053
1039
  n("div", Aa, X(v(f)("inventory.closing.approval.title")), 1)
1054
1040
  ]),
1055
- default: Y(() => [
1041
+ default: q(() => [
1056
1042
  n("div", wa, [
1057
1043
  k(v(e), {
1058
1044
  modelValue: t.value,
1059
1045
  "onUpdate:modelValue": D[0] || (D[0] = (O) => t.value = O),
1060
1046
  orientation: "vertical"
1061
1047
  }, {
1062
- default: Y(() => [
1048
+ default: q(() => [
1063
1049
  k(v(d), {
1064
1050
  value: 1,
1065
1051
  title: v(f)("inventory.closing.approval.step.generateReport.title"),
1066
1052
  complete: C
1067
1053
  }, {
1068
- default: Y(() => [
1054
+ default: q(() => [
1069
1055
  n("div", Sa, X(v(f)("inventory.closing.approval.step.generateReport.description")), 1),
1070
1056
  t.value === 1 ? (x(), P("div", Fa, [
1071
1057
  k(v(g), {
@@ -1082,7 +1068,7 @@ const Da = Dt(
1082
1068
  onClick: w
1083
1069
  }, null, 8, ["label", "disabled"])
1084
1070
  ])
1085
- ])) : te("", !0)
1071
+ ])) : ne("", !0)
1086
1072
  ]),
1087
1073
  _: 1
1088
1074
  }, 8, ["title"]),
@@ -1092,7 +1078,7 @@ const Da = Dt(
1092
1078
  disabled: () => !_.value,
1093
1079
  complete: I
1094
1080
  }, {
1095
- default: Y(() => [
1081
+ default: q(() => [
1096
1082
  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),
1097
1083
  t.value === 2 ? (x(), P("div", Ba, [
1098
1084
  j.value.length > 0 ? (x(), P("div", Ta, [
@@ -1119,7 +1105,7 @@ const Da = Dt(
1119
1105
  n("div", Pa, X(O.name), 1)
1120
1106
  ]))), 128))
1121
1107
  ])
1122
- ])) : te("", !0),
1108
+ ])) : ne("", !0),
1123
1109
  n("div", Va, [
1124
1110
  k(v(g), {
1125
1111
  label: v(f)("inventory.common.back"),
@@ -1128,21 +1114,21 @@ const Da = Dt(
1128
1114
  }, null, 8, ["label"]),
1129
1115
  k(v(g), {
1130
1116
  label: v(f)("inventory.common.continue"),
1131
- disabled: l.value,
1117
+ disabled: i.value,
1132
1118
  onClick: w
1133
1119
  }, null, 8, ["label", "disabled"])
1134
1120
  ])
1135
- ])) : te("", !0)
1121
+ ])) : ne("", !0)
1136
1122
  ]),
1137
1123
  _: 1
1138
1124
  }, 8, ["title", "disabled"]),
1139
1125
  k(v(d), {
1140
1126
  value: 3,
1141
1127
  title: v(f)("inventory.closing.approval.step.approval.title"),
1142
- disabled: () => l.value,
1143
- complete: Z
1128
+ disabled: () => i.value,
1129
+ complete: W
1144
1130
  }, {
1145
- default: Y(() => [
1131
+ default: q(() => [
1146
1132
  n("div", Ma, X(v(f)("inventory.closing.approval.step.approval.warning")), 1),
1147
1133
  t.value === 3 ? (x(), P("div", La, [
1148
1134
  k(v(g), {
@@ -1153,11 +1139,11 @@ const Da = Dt(
1153
1139
  k(v(g), {
1154
1140
  label: v(f)("inventory.common.approve"),
1155
1141
  variant: "destructive",
1156
- disabled: l.value,
1142
+ disabled: i.value,
1157
1143
  loading: A.approving,
1158
- onClick: de
1144
+ onClick: ue
1159
1145
  }, null, 8, ["label", "disabled", "loading"])
1160
- ])) : te("", !0)
1146
+ ])) : ne("", !0)
1161
1147
  ]),
1162
1148
  _: 1
1163
1149
  }, 8, ["title", "disabled"])
@@ -1213,29 +1199,29 @@ const Da = Dt(
1213
1199
  return u === "MYR" ? "RM" : u;
1214
1200
  });
1215
1201
  Ct();
1216
- 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(
1202
+ 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 = tt(), G = Qe(), r = Xe(), t = xt(), C = Ye(), I = Vt({}), W = V(() => new Set(
1217
1203
  t.skus.filter((u) => {
1218
1204
  var a;
1219
1205
  return I[(a = u.customAttributes) == null ? void 0 : a.tag];
1220
1206
  }).map((u) => u._id)
1221
- )), y = o, l = q({
1207
+ )), y = o, i = Q({
1222
1208
  templateItem: !0,
1223
1209
  nonTemplateItem: !0
1224
1210
  }), $ = V(() => {
1225
1211
  var a, p;
1226
1212
  const u = [...((a = e.draft) == null ? void 0 : a.items) ?? [], ...((p = e.draft) == null ? void 0 : p.negativeStockItems) ?? []];
1227
- return Z.value.size ? u.filter((r) => Z.value.has(r.sku._id)) : u;
1228
- }), z = V(() => {
1213
+ return W.value.size ? u.filter((s) => W.value.has(s.sku._id)) : u;
1214
+ }), H = V(() => {
1229
1215
  const u = $.value.map((a) => a.sku);
1230
1216
  return u.sort((a, p) => a.code.localeCompare(p.code)), u;
1231
- }), ae = V(() => $.value.groupBy(
1217
+ }), te = V(() => $.value.groupBy(
1232
1218
  (a) => a.sku._id,
1233
1219
  (a) => a.measurementsAmounts.filter((p) => !p.measurement.abbrev.toLocaleLowerCase().includes("inactive")).map((p) => p.measurement.id)
1234
1220
  ));
1235
- Xe(ee), Ne(
1221
+ Je(ee), Ne(
1236
1222
  () => e.show,
1237
1223
  (u) => {
1238
- u && (_e.value = ke[0], ee(), l.value = {
1224
+ u && (_e.value = ke[0], ee(), i.value = {
1239
1225
  templateItem: !0,
1240
1226
  nonTemplateItem: !0
1241
1227
  });
@@ -1243,7 +1229,7 @@ const Da = Dt(
1243
1229
  );
1244
1230
  const oe = Be(0), w = Be(100);
1245
1231
  async function ee() {
1246
- var a, p, r, i;
1232
+ var a, p, s, l;
1247
1233
  if (!C._currentLocation) return;
1248
1234
  f.value = !0;
1249
1235
  const u = ((a = e.draft) == null ? void 0 : a.status) === he.enum.COMPLETED;
@@ -1252,7 +1238,7 @@ const Da = Dt(
1252
1238
  if (await t.init(), u) {
1253
1239
  const L = e.draft.closingAdjustmentId;
1254
1240
  if (!L) {
1255
- s.open({
1241
+ r.open({
1256
1242
  title: "Something went wrong",
1257
1243
  message: "Closing draft is completed but closing document cannot be found.",
1258
1244
  type: "error"
@@ -1261,8 +1247,8 @@ const Da = Dt(
1261
1247
  });
1262
1248
  return;
1263
1249
  }
1264
- const N = await j.readAdjustmentById(L), me = (N == null ? void 0 : N.skus) ?? [];
1265
- for (const fe of me) {
1250
+ const N = await j.readAdjustmentById(L), de = (N == null ? void 0 : N.skus) ?? [];
1251
+ for (const fe of de) {
1266
1252
  const Ae = {
1267
1253
  id: fe.sku._id,
1268
1254
  balance: fe.fromBalance,
@@ -1275,9 +1261,9 @@ const Da = Dt(
1275
1261
  R.value.push(Ae), _.value.push(T);
1276
1262
  }
1277
1263
  } else
1278
- R.value = ((r = e.draft) == null ? void 0 : r.stockSnapshot) ?? [];
1264
+ R.value = ((s = e.draft) == null ? void 0 : s.stockSnapshot) ?? [];
1279
1265
  const m = /* @__PURE__ */ new Set();
1280
- if ((i = e.draft) != null && i.adjustmentSnapshot)
1266
+ if ((l = e.draft) != null && l.adjustmentSnapshot)
1281
1267
  for (const L of e.draft.adjustmentSnapshot)
1282
1268
  L.adjustmentsByType && Object.keys(L.adjustmentsByType).forEach((N) => m.add(N));
1283
1269
  const b = ["receive", "sales", "wastage"], B = [];
@@ -1287,7 +1273,7 @@ const Da = Dt(
1287
1273
  const S = Array.from(m).sort();
1288
1274
  E.value = [...B, ...S];
1289
1275
  } catch (m) {
1290
- s.open({
1276
+ r.open({
1291
1277
  title: "Something went wrong",
1292
1278
  message: "Something went wrong when fetching info. Please try again.",
1293
1279
  type: "error"
@@ -1296,10 +1282,10 @@ const Da = Dt(
1296
1282
  f.value = !1;
1297
1283
  }
1298
1284
  }
1299
- async function de() {
1285
+ async function ue() {
1300
1286
  var a, p;
1301
1287
  if (!(((a = e.draft) == null ? void 0 : a.effectiveAt) ?? (e.draft ? Ee((p = e.draft) == null ? void 0 : p._id) : null))) {
1302
- s.open({
1288
+ r.open({
1303
1289
  title: "Cannot refresh",
1304
1290
  message: "Effective date is not available for this draft.",
1305
1291
  type: "error"
@@ -1310,30 +1296,30 @@ const Da = Dt(
1310
1296
  e.draft,
1311
1297
  () => {
1312
1298
  },
1313
- async (r) => {
1299
+ async (s) => {
1314
1300
  var B;
1315
1301
  M.value = !0;
1316
- const i = (B = e.draft) == null ? void 0 : B._rev, m = 30, b = 2e3;
1302
+ const l = (B = e.draft) == null ? void 0 : B._rev, m = 30, b = 2e3;
1317
1303
  try {
1318
- await j.recalculation.scheduleCalculateStockSnapshotAtDate(r, e.draft._id);
1304
+ await j.recalculation.scheduleCalculateStockSnapshotAtDate(s, e.draft._id);
1319
1305
  let S = null;
1320
- for (let L = 0; L < m && (S = await G.getDraft(e.draft._id).delayed(b), S._rev === i); L++)
1306
+ for (let L = 0; L < m && (S = await G.getDraft(e.draft._id).delayed(b), S._rev === l); L++)
1321
1307
  ;
1322
- if (!S || S._rev === i) {
1323
- s.open({
1308
+ if (!S || S._rev === l) {
1309
+ r.open({
1324
1310
  title: "Refresh failed",
1325
1311
  message: "Failed to refresh stock balance. Please try again.",
1326
1312
  type: "error"
1327
1313
  }), console.error("error refreshing stock balances: there is no change in _rev");
1328
1314
  return;
1329
1315
  }
1330
- y("refresh", S), R.value = S.stockSnapshot ?? [], s.open({
1316
+ y("refresh", S), R.value = S.stockSnapshot ?? [], r.open({
1331
1317
  title: "Balance refreshed",
1332
1318
  message: "Stock balance has been recalculated.",
1333
1319
  type: "success"
1334
1320
  }), g.value = !1;
1335
1321
  } catch (S) {
1336
- s.open({
1322
+ r.open({
1337
1323
  title: "Refresh failed",
1338
1324
  message: "Failed to refresh stock balance. Please try again.",
1339
1325
  type: "error"
@@ -1347,7 +1333,7 @@ const Da = Dt(
1347
1333
  async function A() {
1348
1334
  var a, p;
1349
1335
  if (!(((a = e.draft) == null ? void 0 : a.effectiveAt) ?? (e.draft ? Ee((p = e.draft) == null ? void 0 : p._id) : null))) {
1350
- s.open({
1336
+ r.open({
1351
1337
  title: "Cannot refresh",
1352
1338
  message: "Effective date is not available for this draft.",
1353
1339
  type: "error"
@@ -1368,7 +1354,7 @@ const Da = Dt(
1368
1354
  var u;
1369
1355
  return (u = e.draft) != null && u.opening ? new Map(e.draft.opening.map((a) => [a.skuId, a.balance])) : /* @__PURE__ */ new Map();
1370
1356
  });
1371
- function Q(u, a) {
1357
+ function Y(u, a) {
1372
1358
  return F(
1373
1359
  be.FmTooltip,
1374
1360
  { zIndex: 51, placement: "left", class: "w-full flex justify-end" },
@@ -1383,9 +1369,9 @@ const Da = Dt(
1383
1369
  );
1384
1370
  }
1385
1371
  const ve = V(() => {
1386
- const u = z.value.reduce((p, r) => {
1387
- var i, m;
1388
- return Math.max(p, ((m = (i = ae.value) == null ? void 0 : i.get(r._id)) == null ? void 0 : m[0].length) ?? 0);
1372
+ const u = H.value.reduce((p, s) => {
1373
+ var l, m;
1374
+ return Math.max(p, ((m = (l = te.value) == null ? void 0 : l.get(s._id)) == null ? void 0 : m[0].length) ?? 0);
1389
1375
  }, 0);
1390
1376
  return [
1391
1377
  {
@@ -1394,7 +1380,7 @@ const Da = Dt(
1394
1380
  header: () => "Name",
1395
1381
  size: 350,
1396
1382
  cell(p) {
1397
- 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" }, [
1383
+ const s = p.row.original, l = s.adjustedDiffPercentage, m = typeof l == "number" && Math.abs(l) > 10, b = F("div", { class: "flex flex-col gap-4" }, [
1398
1384
  F(
1399
1385
  "div",
1400
1386
  {
@@ -1403,7 +1389,7 @@ const Da = Dt(
1403
1389
  m ? " text-fm-color-system-error-300" : "text-fm-color-typo-primary"
1404
1390
  ]
1405
1391
  },
1406
- r.name
1392
+ s.name
1407
1393
  ),
1408
1394
  F(
1409
1395
  "div",
@@ -1413,7 +1399,7 @@ const Da = Dt(
1413
1399
  m ? " text-fm-color-system-error-300" : "text-fm-color-typo-secondary"
1414
1400
  ]
1415
1401
  },
1416
- r.code
1402
+ s.code
1417
1403
  )
1418
1404
  ]);
1419
1405
  return F(
@@ -1423,7 +1409,7 @@ const Da = Dt(
1423
1409
  },
1424
1410
  {
1425
1411
  content() {
1426
- return m ? "Adjustment difference is more than 10%." : `${r.code} - ${r.name}`;
1412
+ return m ? "Adjustment difference is more than 10%." : `${s.code} - ${s.name}`;
1427
1413
  },
1428
1414
  default() {
1429
1415
  return F("div", { class: "flex items-center gap-4 justify-start w-full" }, [
@@ -1437,11 +1423,11 @@ const Da = Dt(
1437
1423
  {
1438
1424
  id: "costPerUnit",
1439
1425
  accessorKey: "costPerUnit",
1440
- header: () => Q("Cost per unit"),
1426
+ header: () => Y("Cost per unit"),
1441
1427
  size: 160,
1442
1428
  cell(p) {
1443
- const r = p.row.original.costPerUnit;
1444
- return F("div", { class: "text-right" }, r.toFixed(2));
1429
+ const s = p.row.original.costPerUnit;
1430
+ return F("div", { class: "text-right" }, s.toFixed(2));
1445
1431
  },
1446
1432
  meta: {
1447
1433
  textAlign: "right"
@@ -1453,9 +1439,9 @@ const Da = Dt(
1453
1439
  size: 120,
1454
1440
  cell(p) {
1455
1441
  var B;
1456
- const r = p.row.original, i = r.costUnit, m = r.baseUnit, b = i ?? m;
1457
- if (i && i !== m) {
1458
- const S = z.value.find((N) => N._id === r.id), L = (B = S == null ? void 0 : S.defaultCost) == null ? void 0 : B.measurement;
1442
+ const s = p.row.original, l = s.costUnit, m = s.baseUnit, b = l ?? m;
1443
+ if (l && l !== m) {
1444
+ const S = H.value.find((N) => N._id === s.id), L = (B = S == null ? void 0 : S.defaultCost) == null ? void 0 : B.measurement;
1459
1445
  if (L) {
1460
1446
  const N = L.conversion.amount / Math.pow(10, L.conversion.precision);
1461
1447
  return F("div", { class: "flex flex-col" }, [
@@ -1466,7 +1452,7 @@ const Da = Dt(
1466
1452
  ),
1467
1453
  F("span", { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, [
1468
1454
  "1 ",
1469
- F("span", { class: "fm-typo-en-body-sm-600" }, i),
1455
+ F("span", { class: "fm-typo-en-body-sm-600" }, l),
1470
1456
  ` = ${N} `,
1471
1457
  F("span", { class: "fm-typo-en-body-sm-600" }, m)
1472
1458
  ])
@@ -1479,11 +1465,11 @@ const Da = Dt(
1479
1465
  {
1480
1466
  id: "opening",
1481
1467
  accessorKey: "opening",
1482
- header: () => Q("Opening (B/F)", "The opening balance brought forward from previous period."),
1468
+ header: () => Y("Opening (B/F)", "The opening balance brought forward from previous period."),
1483
1469
  size: 150,
1484
1470
  cell(p) {
1485
- const r = p.row.original.opening;
1486
- return F("div", { class: "text-right" }, r.toFixed(2));
1471
+ const s = p.row.original.opening;
1472
+ return F("div", { class: "text-right" }, s.toFixed(2));
1487
1473
  },
1488
1474
  meta: {
1489
1475
  textAlign: "right"
@@ -1493,12 +1479,12 @@ const Da = Dt(
1493
1479
  ...E.value.map(
1494
1480
  (p) => ({
1495
1481
  id: `adjustment_${p}`,
1496
- accessorFn: (r) => r.adjustmentAmounts[p] ?? { amount: 0, precision: 0 },
1497
- header: () => Q(ze(p)),
1482
+ accessorFn: (s) => s.adjustmentAmounts[p] ?? { amount: 0, precision: 0 },
1483
+ header: () => Y(ze(p)),
1498
1484
  size: 150,
1499
- cell(r) {
1500
- const i = r.row.original.adjustmentAmounts[p] ?? { amount: 0, precision: 0 };
1501
- return F("div", { class: "text-right" }, Je(i));
1485
+ cell(s) {
1486
+ const l = s.row.original.adjustmentAmounts[p] ?? { amount: 0, precision: 0 };
1487
+ return F("div", { class: "text-right" }, Ze(l));
1502
1488
  },
1503
1489
  meta: {
1504
1490
  textAlign: "right"
@@ -1508,7 +1494,7 @@ const Da = Dt(
1508
1494
  {
1509
1495
  id: "systemBalance",
1510
1496
  accessorKey: "systemBalance",
1511
- header: () => Q("System Balance", "The system calculated balance before stock take."),
1497
+ header: () => Y("System Balance", "The system calculated balance before stock take."),
1512
1498
  size: 200,
1513
1499
  meta: {
1514
1500
  textAlign: "right"
@@ -1517,20 +1503,20 @@ const Da = Dt(
1517
1503
  {
1518
1504
  id: "physicalBalance",
1519
1505
  accessorFn: (p) => {
1520
- var i;
1521
- const r = (i = _.value.find((m) => m.id === p.id)) == null ? void 0 : i.balance;
1522
- return r ? H.toFormatString({ value: r }) : p.physicalBalance;
1506
+ var l;
1507
+ const s = (l = _.value.find((m) => m.id === p.id)) == null ? void 0 : l.balance;
1508
+ return s ? z.toFormatString({ value: s }) : p.physicalBalance;
1523
1509
  },
1524
- header: () => Q("Stock Take balance", "The physical balance recorded during stock take."),
1510
+ header: () => Y("Stock Take balance", "The physical balance recorded during stock take."),
1525
1511
  cell(p) {
1526
1512
  var S;
1527
- const r = p.row.original, i = H.fromNumber(r.physicalBalance);
1528
- let m = !0, b = r.physicalBalance;
1529
- const B = (S = _.value.find((L) => L.id === r.id)) == null ? void 0 : S.balance;
1530
- return B && (H.equals({
1531
- a: i,
1513
+ const s = p.row.original, l = z.fromNumber(s.physicalBalance);
1514
+ let m = !0, b = s.physicalBalance;
1515
+ const B = (S = _.value.find((L) => L.id === s.id)) == null ? void 0 : S.balance;
1516
+ return B && (z.equals({
1517
+ a: l,
1532
1518
  b: B
1533
- }) || (m = !1, b = Number(H.toFormatString({ value: B })))), F("div", { class: "flex flex-col" }, [
1519
+ }) || (m = !1, b = Number(z.toFormatString({ value: B })))), F("div", { class: "flex flex-col" }, [
1534
1520
  F(
1535
1521
  "span",
1536
1522
  { class: "line-clamp-1 fm-typo-en-body-lg-400 text-fm-color-typo-primary" },
@@ -1539,7 +1525,7 @@ const Da = Dt(
1539
1525
  m ? null : F(
1540
1526
  "span",
1541
1527
  { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" },
1542
- `Draft: ${r.physicalBalance.toString()}`
1528
+ `Draft: ${s.physicalBalance.toString()}`
1543
1529
  )
1544
1530
  ]);
1545
1531
  },
@@ -1551,7 +1537,7 @@ const Da = Dt(
1551
1537
  {
1552
1538
  id: "adjustedAmount",
1553
1539
  accessorKey: "adjustedAmount",
1554
- header: () => Q("Variance", "The difference between Stock Take balance and System Balance."),
1540
+ header: () => Y("Variance", "The difference between Stock Take balance and System Balance."),
1555
1541
  size: 200,
1556
1542
  meta: {
1557
1543
  textAlign: "right"
@@ -1560,14 +1546,14 @@ const Da = Dt(
1560
1546
  {
1561
1547
  id: "varianceInCost",
1562
1548
  accessorKey: "varianceInCost",
1563
- header: () => Q(`Variance (${d.value})`),
1549
+ header: () => Y(`Variance (${d.value})`),
1564
1550
  size: 150,
1565
1551
  cell(p) {
1566
- const r = p.row.original.varianceInCost;
1552
+ const s = p.row.original.varianceInCost;
1567
1553
  return F(
1568
1554
  "div",
1569
1555
  { class: "text-right" },
1570
- r.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 4 })
1556
+ s.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 4 })
1571
1557
  );
1572
1558
  },
1573
1559
  meta: {
@@ -1577,25 +1563,25 @@ const Da = Dt(
1577
1563
  {
1578
1564
  id: "adjustedDiffPercentage",
1579
1565
  accessorKey: "adjustedDiffPercentage",
1580
- header: () => Q(
1566
+ header: () => Y(
1581
1567
  "Variance (%)",
1582
1568
  "Difference between Stock Take balance and System Balance in percentage."
1583
1569
  ),
1584
1570
  size: 200,
1585
1571
  cell(p) {
1586
- const r = p.row.original.adjustedDiffPercentage;
1587
- if (!r) return Dn;
1588
- const i = r.toFixed(2);
1589
- if (i === "0.00")
1572
+ const s = p.row.original.adjustedDiffPercentage;
1573
+ if (!s) return Dn;
1574
+ const l = s.toFixed(2);
1575
+ if (l === "0.00")
1590
1576
  return F("div", { class: "flex items-center gap-4 justify-end" }, ["0.00"]);
1591
- const m = r > 0;
1577
+ const m = s > 0;
1592
1578
  return F("div", { class: "flex items-center gap-4 justify-end" }, [
1593
1579
  F(be.FmIcon, {
1594
1580
  name: m ? "arrow_drop_up" : "arrow_drop_down",
1595
1581
  color: m ? "system-success-300" : "system-error-300",
1596
1582
  size: "md"
1597
1583
  }),
1598
- i
1584
+ l
1599
1585
  ]);
1600
1586
  },
1601
1587
  meta: {
@@ -1605,25 +1591,25 @@ const Da = Dt(
1605
1591
  {
1606
1592
  id: "stockTakeValue",
1607
1593
  accessorKey: "stockTakeValue",
1608
- header: () => Q(`Stock take value (${d.value})`),
1594
+ header: () => Y(`Stock take value (${d.value})`),
1609
1595
  size: 180,
1610
1596
  cell(p) {
1611
1597
  var L;
1612
- 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;
1598
+ const s = p.row.original, l = s.stockTakeValue, m = H.value.find((N) => N._id === s.id), b = (L = m == null ? void 0 : m.defaultCost) == null ? void 0 : L.measurement, B = s.physicalBalance, S = s.costPerUnit;
1613
1599
  if (b) {
1614
- const N = H.toFormatString({ value: b.conversion }), me = `${B.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 })} ${r.baseUnit} ÷ ${N} × ${S} ${d.value}`;
1600
+ const N = z.toFormatString({ value: b.conversion }), de = `${B.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 })} ${s.baseUnit} ÷ ${N} × ${S} ${d.value}`;
1615
1601
  return F(
1616
1602
  be.FmTooltip,
1617
1603
  { zIndex: 51 },
1618
1604
  {
1619
1605
  content() {
1620
- return me;
1606
+ return de;
1621
1607
  },
1622
1608
  default() {
1623
1609
  return F(
1624
1610
  "div",
1625
1611
  { class: "text-right" },
1626
- i.toLocaleString("en-US", {
1612
+ l.toLocaleString("en-US", {
1627
1613
  minimumFractionDigits: 2,
1628
1614
  maximumFractionDigits: 4
1629
1615
  })
@@ -1632,7 +1618,7 @@ const Da = Dt(
1632
1618
  }
1633
1619
  );
1634
1620
  } else {
1635
- const N = `${B.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 })} ${r.baseUnit} × ${S} ${d.value}`;
1621
+ const N = `${B.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 })} ${s.baseUnit} × ${S} ${d.value}`;
1636
1622
  return F(
1637
1623
  be.FmTooltip,
1638
1624
  { zIndex: 51 },
@@ -1644,7 +1630,7 @@ const Da = Dt(
1644
1630
  return F(
1645
1631
  "div",
1646
1632
  { class: "text-right" },
1647
- i.toLocaleString("en-US", {
1633
+ l.toLocaleString("en-US", {
1648
1634
  minimumFractionDigits: 2,
1649
1635
  maximumFractionDigits: 4
1650
1636
  })
@@ -1661,25 +1647,25 @@ const Da = Dt(
1661
1647
  {
1662
1648
  id: "systemValue",
1663
1649
  accessorKey: "systemValue",
1664
- header: () => Q(`System value (${d.value})`),
1650
+ header: () => Y(`System value (${d.value})`),
1665
1651
  size: 180,
1666
1652
  cell(p) {
1667
1653
  var L;
1668
- 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;
1654
+ const s = p.row.original, l = s.systemValue, m = H.value.find((N) => N._id === s.id), b = (L = m == null ? void 0 : m.defaultCost) == null ? void 0 : L.measurement, B = s.systemBalance, S = s.costPerUnit;
1669
1655
  if (b) {
1670
- const N = H.toFormatString({ value: b.conversion }), me = `${B.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 4 })} ${r.baseUnit} ÷ ${N} × ${S} ${d.value}`;
1656
+ const N = z.toFormatString({ value: b.conversion }), de = `${B.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 4 })} ${s.baseUnit} ÷ ${N} × ${S} ${d.value}`;
1671
1657
  return F(
1672
1658
  be.FmTooltip,
1673
1659
  { zIndex: 51 },
1674
1660
  {
1675
1661
  content() {
1676
- return me;
1662
+ return de;
1677
1663
  },
1678
1664
  default() {
1679
1665
  return F(
1680
1666
  "div",
1681
1667
  { class: "text-right" },
1682
- i.toLocaleString("en-US", {
1668
+ l.toLocaleString("en-US", {
1683
1669
  minimumFractionDigits: 2,
1684
1670
  maximumFractionDigits: 4
1685
1671
  })
@@ -1688,7 +1674,7 @@ const Da = Dt(
1688
1674
  }
1689
1675
  );
1690
1676
  } else {
1691
- const N = `${B.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 4 })} ${r.baseUnit} × ${S} ${d.value}`;
1677
+ const N = `${B.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 4 })} ${s.baseUnit} × ${S} ${d.value}`;
1692
1678
  return F(
1693
1679
  be.FmTooltip,
1694
1680
  { zIndex: 51 },
@@ -1700,7 +1686,7 @@ const Da = Dt(
1700
1686
  return F(
1701
1687
  "div",
1702
1688
  { class: "text-right" },
1703
- i.toLocaleString("en-US", {
1689
+ l.toLocaleString("en-US", {
1704
1690
  minimumFractionDigits: 2,
1705
1691
  maximumFractionDigits: 4
1706
1692
  })
@@ -1719,7 +1705,7 @@ const Da = Dt(
1719
1705
  header: () => "Amounts",
1720
1706
  enableSorting: !1,
1721
1707
  cell(p) {
1722
- const r = p.row.original, i = (b, B) => F(
1708
+ const s = p.row.original, l = (b, B) => F(
1723
1709
  be.FmTooltip,
1724
1710
  { zIndex: 50 },
1725
1711
  {
@@ -1748,12 +1734,12 @@ const Da = Dt(
1748
1734
  }
1749
1735
  );
1750
1736
  let m = Array.from({ length: u }).map((b, B) => {
1751
- if (!r[`measurementAmount${B}`])
1737
+ if (!s[`measurementAmount${B}`])
1752
1738
  return null;
1753
- const S = r[`measurementAmount${B}`], L = r[`measurementAbbrev${B}`];
1754
- return i(S, L);
1739
+ const S = s[`measurementAmount${B}`], L = s[`measurementAbbrev${B}`];
1740
+ return l(S, L);
1755
1741
  }).filter((b) => b);
1756
- return (r.baseUnitAmount || !m.length) && (m = [i(r.baseUnitAmount, r.baseUnit), ...m]), F(
1742
+ return (s.baseUnitAmount || !m.length) && (m = [l(s.baseUnitAmount, s.baseUnit), ...m]), F(
1757
1743
  "div",
1758
1744
  {
1759
1745
  class: "flex gap-8 flex-nowrap",
@@ -1766,37 +1752,37 @@ const Da = Dt(
1766
1752
  }
1767
1753
  }
1768
1754
  ];
1769
- }), je = V(() => ve.value.map((u) => u.size ?? 0).reduce((u, a) => u + a)), we = q(""), Ie = V(() => {
1770
- var p, r;
1771
- const u = ((r = (p = e.draft) == null ? void 0 : p.negativeStockItems) == null ? void 0 : r.reduce(
1772
- (i, m) => (i[m.sku._id] = m, i),
1755
+ }), je = V(() => ve.value.map((u) => u.size ?? 0).reduce((u, a) => u + a)), we = Q(""), Ie = V(() => {
1756
+ var p, s;
1757
+ const u = ((s = (p = e.draft) == null ? void 0 : p.negativeStockItems) == null ? void 0 : s.reduce(
1758
+ (l, m) => (l[m.sku._id] = m, l),
1773
1759
  {}
1774
1760
  )) ?? {};
1775
- return z.value.map((i) => {
1776
- var st, rt, lt, it, ct, ut, dt, mt, ft, pt, vt;
1777
- 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) ?? {
1761
+ return H.value.map((l) => {
1762
+ var ot, st, rt, lt, it, ct, ut, dt, mt, ft, pt;
1763
+ const m = (ot = J.value.get(l._id)) == null ? void 0 : ot[0], b = ((st = D.value.get(l._id)) == null ? void 0 : st[0]) ?? oe, B = ((rt = l.defaultCost) == null ? void 0 : rt.costPerUnit) ?? oe, S = Number(z.toFormatString({ value: B })), L = ((it = (lt = l.defaultCost) == null ? void 0 : lt.measurement) == null ? void 0 : it.conversion) ?? {
1778
1764
  amount: 1,
1779
1765
  precision: 0
1780
1766
  }, N = Number(
1781
- H.toFormatString({ value: L })
1782
- ), me = re.value.get(i._id), fe = me ? Number(H.toFormatString({ value: me })) : 0, Ae = O.value.get(i._id), T = {};
1767
+ z.toFormatString({ value: L })
1768
+ ), de = re.value.get(l._id), fe = de ? Number(z.toFormatString({ value: de })) : 0, Ae = O.value.get(l._id), T = {};
1783
1769
  if (E.value.forEach((se) => {
1784
1770
  const pe = T[se] ?? { amount: 0, precision: 0 }, ye = Ae == null ? void 0 : Ae[se];
1785
1771
  ye && (T[se] = Zt(pe, ye));
1786
1772
  }), !m) {
1787
- const se = Number(H.toFormatString({ value: b })), pe = se - 0, ye = pe * S / N, Me = 0, Pt = se * S / N;
1773
+ const se = Number(z.toFormatString({ value: b })), pe = se - 0, ye = pe * S / N, Me = 0, Pt = se * S / N;
1788
1774
  return {
1789
- id: i._id,
1790
- code: i.code,
1791
- name: i.name,
1792
- costUnit: ((dt = (ut = i.defaultCost) == null ? void 0 : ut.measurement) == null ? void 0 : dt.abbrev) ?? null,
1793
- baseUnit: i.unit.abbrev,
1775
+ id: l._id,
1776
+ code: l.code,
1777
+ name: l.name,
1778
+ costUnit: ((ut = (ct = l.defaultCost) == null ? void 0 : ct.measurement) == null ? void 0 : ut.abbrev) ?? null,
1779
+ baseUnit: l.unit.abbrev,
1794
1780
  baseUnitAmount: 0,
1795
1781
  systemBalance: se,
1796
1782
  physicalBalance: 0,
1797
1783
  adjustedAmount: -se,
1798
1784
  adjustedDiffPercentage: -100,
1799
- isTemplateItem: !u[i._id],
1785
+ isTemplateItem: !u[l._id],
1800
1786
  costPerUnit: S,
1801
1787
  opening: fe,
1802
1788
  varianceQty: pe,
@@ -1806,46 +1792,46 @@ const Da = Dt(
1806
1792
  adjustmentAmounts: T
1807
1793
  };
1808
1794
  }
1809
- const ne = $t(m), le = (ft = (mt = _.value) == null ? void 0 : mt.find(
1810
- (se) => se.id === i._id
1811
- )) == null ? void 0 : ft.balance, ge = wt(
1812
- le ?? ne,
1795
+ const ae = $t(m), le = (mt = (dt = _.value) == null ? void 0 : dt.find(
1796
+ (se) => se.id === l._id
1797
+ )) == null ? void 0 : mt.balance, ge = wt(
1798
+ le ?? ae,
1813
1799
  b
1814
1800
  ), Se = b.amount === 0 ? null : St(ge, {
1815
1801
  ...b,
1816
1802
  amount: Math.abs(b.amount)
1817
- }), 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;
1803
+ }), Ve = Se ? et(Se, w) : null, qe = Number(z.toFormatString({ value: b })), Ge = Number(z.toFormatString({ value: ae })), nt = qe - Ge, It = nt * S / N, Ut = Ge * S / N, Rt = qe * S / N;
1818
1804
  return {
1819
- id: i._id,
1820
- code: i.code,
1821
- name: i.name,
1822
- costUnit: ((vt = (pt = i.defaultCost) == null ? void 0 : pt.measurement) == null ? void 0 : vt.abbrev) ?? null,
1823
- baseUnit: i.unit.abbrev,
1824
- baseUnitAmount: Number(H.toFormatString({ value: m.baseAmount })),
1805
+ id: l._id,
1806
+ code: l.code,
1807
+ name: l.name,
1808
+ costUnit: ((pt = (ft = l.defaultCost) == null ? void 0 : ft.measurement) == null ? void 0 : pt.abbrev) ?? null,
1809
+ baseUnit: l.unit.abbrev,
1810
+ baseUnitAmount: Number(z.toFormatString({ value: m.baseAmount })),
1825
1811
  ...m.measurementsAmounts.filter((se) => {
1826
1812
  var pe, ye, Me;
1827
- 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);
1828
- }).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), {}),
1813
+ return (Me = (ye = (pe = te.value) == null ? void 0 : pe.get(l._id)) == null ? void 0 : ye[0]) == null ? void 0 : Me.includes(se.measurement.id);
1814
+ }).reduce((se, pe, ye) => (se[`measurementAbbrev${ye}`] = `(${pe.measurement.abbrev}) × ${z.toFormatString({ value: pe.measurement.conversion })}`, se[`measurementAmount${ye}`] = Number(z.toFormatString({ value: pe.amount })), se), {}),
1829
1815
  systemBalance: qe,
1830
1816
  physicalBalance: Ge,
1831
- adjustedAmount: Number(H.toFormatString({ value: ge })),
1817
+ adjustedAmount: Number(z.toFormatString({ value: ge })),
1832
1818
  adjustedDiffPercentage: Ve ? Number(
1833
- H.toFormatString({
1819
+ z.toFormatString({
1834
1820
  value: Ft(Ve, 2)
1835
1821
  })
1836
1822
  ) : null,
1837
- isTemplateItem: !u[i._id],
1823
+ isTemplateItem: !u[l._id],
1838
1824
  costPerUnit: S,
1839
1825
  opening: fe,
1840
- varianceQty: ot,
1826
+ varianceQty: nt,
1841
1827
  varianceInCost: It,
1842
1828
  stockTakeValue: Ut,
1843
1829
  systemValue: Rt,
1844
1830
  adjustmentAmounts: T
1845
1831
  };
1846
- }).filter((i) => !!(i.isTemplateItem && l.value.templateItem || !i.isTemplateItem && l.value.nonTemplateItem));
1832
+ }).filter((l) => !!(l.isTemplateItem && i.value.templateItem || !l.isTemplateItem && i.value.nonTemplateItem));
1847
1833
  }), Ue = V(() => {
1848
- var a, p, r, i, m;
1834
+ var a, p, s, l, m;
1849
1835
  if (!e.draft) return [];
1850
1836
  const u = e.draft.approvedAt ? {
1851
1837
  action: `Approve at ${De(e.draft.approvedAt)}`,
@@ -1881,11 +1867,11 @@ const Da = Dt(
1881
1867
  },
1882
1868
  {
1883
1869
  label: "Effective at",
1884
- value: De(e.draft.effectiveAt ?? Ee((r = e.draft) == null ? void 0 : r._id))
1870
+ value: De(e.draft.effectiveAt ?? Ee((s = e.draft) == null ? void 0 : s._id))
1885
1871
  },
1886
1872
  {
1887
1873
  label: "Using template",
1888
- value: ((i = e.draft.usingTemplates.find((b) => b)) == null ? void 0 : i.name) ?? "None"
1874
+ value: ((l = e.draft.usingTemplates.find((b) => b)) == null ? void 0 : l.name) ?? "None"
1889
1875
  },
1890
1876
  e.draft.remark ? {
1891
1877
  label: "Remark",
@@ -1913,14 +1899,14 @@ const Da = Dt(
1913
1899
  label: "Action history",
1914
1900
  value: "history"
1915
1901
  }
1916
- ], _e = q(ke[0]), xe = V(() => {
1917
- var r, i, m;
1918
- const u = ((r = e.draft) == null ? void 0 : r.activityLogs) ?? [], a = ((i = e.draft) == null ? void 0 : i.rejectionHistory) ?? [];
1902
+ ], _e = Q(ke[0]), xe = V(() => {
1903
+ var s, l, m;
1904
+ const u = ((s = e.draft) == null ? void 0 : s.activityLogs) ?? [], a = ((l = e.draft) == null ? void 0 : l.rejectionHistory) ?? [];
1919
1905
  for (const b of a)
1920
1906
  u.find(
1921
- (S) => `${S.action}_${S.performedAt}` == `${W.enum.rejectDraft}_${b.rejectedAt}`
1907
+ (S) => `${S.action}_${S.performedAt}` == `${Z.enum.rejectDraft}_${b.rejectedAt}`
1922
1908
  ) || u.push({
1923
- action: W.enum.rejectDraft,
1909
+ action: Z.enum.rejectDraft,
1924
1910
  performedAt: b.rejectedAt,
1925
1911
  performedBy: b.rejectedBy,
1926
1912
  remark: b.rejectRemark
@@ -1928,10 +1914,10 @@ const Da = Dt(
1928
1914
  return (m = e.draft) != null && m.approvedAt && (u.find(
1929
1915
  (B) => {
1930
1916
  var S;
1931
- return `${B.action}_${B.performedAt}` == `${W.enum.approveDraft}_${(S = e.draft) == null ? void 0 : S.approvedAt}`;
1917
+ return `${B.action}_${B.performedAt}` == `${Z.enum.approveDraft}_${(S = e.draft) == null ? void 0 : S.approvedAt}`;
1932
1918
  }
1933
1919
  ) || u.push({
1934
- action: W.enum.approveDraft,
1920
+ action: Z.enum.approveDraft,
1935
1921
  performedAt: e.draft.approvedAt,
1936
1922
  performedBy: e.draft.approvedBy ?? { name: "Unknown", id: "unknown" },
1937
1923
  remark: e.draft.approveRemark
@@ -1951,7 +1937,7 @@ const Da = Dt(
1951
1937
  ]
1952
1938
  })
1953
1939
  );
1954
- }), Re = q(!1), Pe = q(!1), nt = V(() => {
1940
+ }), Re = Q(!1), Pe = Q(!1), at = V(() => {
1955
1941
  var u;
1956
1942
  return ((u = e.draft) == null ? void 0 : u.status) !== he.enum.DRAFT ? "Status is not draft." : null;
1957
1943
  });
@@ -1967,7 +1953,7 @@ const Da = Dt(
1967
1953
  ));
1968
1954
  }
1969
1955
  return (u, a) => {
1970
- 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");
1956
+ const p = K("FmButtonGroup"), s = K("FmMenuDivider"), l = K("FmCard"), m = K("FmButton"), b = K("FmCircularProgress"), B = K("FmChip"), S = K("FmTextField"), L = K("FmIcon"), N = K("FmTable"), de = K("FmSpacer"), fe = K("FmTooltip"), Ae = K("FmSideSheet");
1971
1957
  return x(), P(ie, null, [
1972
1958
  k(Ae, {
1973
1959
  "dismiss-away": "",
@@ -1976,20 +1962,20 @@ const Da = Dt(
1976
1962
  "onUpdate:modelValue": a[9] || (a[9] = (T) => gt(g) ? g.value = T : null),
1977
1963
  header: "Closing details"
1978
1964
  }, {
1979
- "side-sheet-footer": Y(() => {
1980
- var T, ne, le, ge;
1965
+ "side-sheet-footer": q(() => {
1966
+ var T, ae, le, ge;
1981
1967
  return [
1982
1968
  n("div", xn, [
1983
1969
  ((T = e.draft) == null ? void 0 : T.status) === v(he).enum.DRAFT ? (x(), P(ie, { key: 0 }, [
1984
- nt.value ? (x(), ue(fe, {
1970
+ at.value ? (x(), me(fe, {
1985
1971
  key: 0,
1986
1972
  "z-index": 51,
1987
1973
  placement: "right"
1988
1974
  }, {
1989
- content: Y(() => [
1990
- ce(X(nt.value), 1)
1975
+ content: q(() => [
1976
+ ce(X(at.value), 1)
1991
1977
  ]),
1992
- default: Y(() => [
1978
+ default: q(() => [
1993
1979
  k(m, {
1994
1980
  disabled: "",
1995
1981
  key: "approve key",
@@ -1997,20 +1983,20 @@ const Da = Dt(
1997
1983
  })
1998
1984
  ]),
1999
1985
  _: 1
2000
- })) : (x(), ue(m, {
1986
+ })) : (x(), me(m, {
2001
1987
  key: "approve key",
2002
1988
  label: "Approve",
2003
1989
  onClick: a[5] || (a[5] = (Se) => Re.value = !0)
2004
1990
  }))
2005
- ], 64)) : te("", !0),
2006
- ((ne = e.draft) == null ? void 0 : ne.status) === v(he).enum.DRAFT ? (x(), ue(m, {
1991
+ ], 64)) : ne("", !0),
1992
+ ((ae = e.draft) == null ? void 0 : ae.status) === v(he).enum.DRAFT ? (x(), me(m, {
2007
1993
  key: 1,
2008
1994
  label: "Reject",
2009
1995
  variant: "destructive",
2010
1996
  onClick: a[6] || (a[6] = () => e.draft && v(h).rejectDraft(e.draft, () => y("submitted")))
2011
- })) : te("", !0),
2012
- (le = e.draft) != null && le.approvedAt && ((ge = e.draft) == null ? void 0 : ge.status) !== v(he).enum.COMPLETED ? (x(), ue(Ze, { key: 2 }, {
2013
- default: Y(() => [
1997
+ })) : ne("", !0),
1998
+ (le = e.draft) != null && le.approvedAt && ((ge = e.draft) == null ? void 0 : ge.status) !== v(he).enum.COMPLETED ? (x(), me(vt, { key: 2 }, {
1999
+ default: q(() => [
2014
2000
  k(m, {
2015
2001
  label: "Sync",
2016
2002
  loading: U.value,
@@ -2022,7 +2008,7 @@ const Da = Dt(
2022
2008
  }, null, 8, ["loading"])
2023
2009
  ]),
2024
2010
  _: 1
2025
- })) : te("", !0),
2011
+ })) : ne("", !0),
2026
2012
  k(m, {
2027
2013
  label: "Close",
2028
2014
  variant: "tertiary",
@@ -2031,7 +2017,7 @@ const Da = Dt(
2031
2017
  ])
2032
2018
  ];
2033
2019
  }),
2034
- default: Y(() => [
2020
+ default: q(() => [
2035
2021
  n("div", Ea, [
2036
2022
  n("div", null, [
2037
2023
  k(p, {
@@ -2041,22 +2027,22 @@ const Da = Dt(
2041
2027
  }, null, 8, ["modelValue"])
2042
2028
  ]),
2043
2029
  _e.value.value === "overview" ? (x(), P(ie, { key: 0 }, [
2044
- k(i, {
2030
+ k(l, {
2045
2031
  variant: "outlined",
2046
2032
  class: "flex flex-col gap-8 px-12 py-16"
2047
2033
  }, {
2048
- default: Y(() => {
2049
- var T, ne;
2034
+ default: q(() => {
2035
+ var T, ae;
2050
2036
  return [
2051
2037
  n("div", za, [
2052
2038
  a[11] || (a[11] = n("div", { class: "fm-typo-en-body-lg-600" }, "Closing summary", -1)),
2053
2039
  n("div", Ha, [
2054
2040
  n("div", {
2055
2041
  class: $e(["fm-status-badge", v(He)(((T = u.draft) == null ? void 0 : T.status) ?? "DRAFT")])
2056
- }, X(v(ze)(((ne = u.draft) == null ? void 0 : ne.status) ?? "")), 3)
2042
+ }, X(v(ze)(((ae = u.draft) == null ? void 0 : ae.status) ?? "")), 3)
2057
2043
  ])
2058
2044
  ]),
2059
- k(r),
2045
+ k(s),
2060
2046
  n("div", Oa, [
2061
2047
  (x(!0), P(ie, null, Ce(Ue.value, (le, ge) => (x(), P("div", {
2062
2048
  class: "flex flex-col gap-4",
@@ -2075,8 +2061,8 @@ const Da = Dt(
2075
2061
  n("div", qa, [
2076
2062
  n("div", Ga, [
2077
2063
  a[12] || (a[12] = n("div", { class: "flex-1 fm-typo-en-title-sm-600 text-fm-color-typo-primary" }, " Closing items ", -1)),
2078
- f.value ? te("", !0) : (x(), P("div", Wa, [
2079
- u.draft && u.draft.status !== v(he).enum.COMPLETED ? (x(), ue(m, {
2064
+ f.value ? ne("", !0) : (x(), P("div", Wa, [
2065
+ u.draft && u.draft.status !== v(he).enum.COMPLETED ? (x(), me(m, {
2080
2066
  key: 0,
2081
2067
  label: "Refresh balance",
2082
2068
  "prepend-icon": "refresh",
@@ -2085,10 +2071,10 @@ const Da = Dt(
2085
2071
  "bg-color": "transparent",
2086
2072
  "border-color": "primary",
2087
2073
  loading: M.value,
2088
- onClick: de
2089
- }, null, 8, ["loading"])) : te("", !0),
2090
- k(Ze, null, {
2091
- default: Y(() => [
2074
+ onClick: ue
2075
+ }, null, 8, ["loading"])) : ne("", !0),
2076
+ k(vt, null, {
2077
+ default: q(() => [
2092
2078
  k(m, {
2093
2079
  label: "Invalidate Draft Cache",
2094
2080
  "prepend-icon": "refresh",
@@ -2131,13 +2117,13 @@ const Da = Dt(
2131
2117
  n("div", en, [
2132
2118
  k(B, {
2133
2119
  label: "Template Item(s)",
2134
- selected: l.value.templateItem,
2135
- onClick: a[2] || (a[2] = (T) => l.value.templateItem = !l.value.templateItem)
2120
+ selected: i.value.templateItem,
2121
+ onClick: a[2] || (a[2] = (T) => i.value.templateItem = !i.value.templateItem)
2136
2122
  }, null, 8, ["selected"]),
2137
2123
  k(B, {
2138
2124
  label: "Non-template Item(s)",
2139
- selected: l.value.nonTemplateItem,
2140
- onClick: a[3] || (a[3] = (T) => l.value.nonTemplateItem = !l.value.nonTemplateItem)
2125
+ selected: i.value.nonTemplateItem,
2126
+ onClick: a[3] || (a[3] = (T) => i.value.nonTemplateItem = !i.value.nonTemplateItem)
2141
2127
  }, null, 8, ["selected"])
2142
2128
  ]),
2143
2129
  k(S, {
@@ -2147,20 +2133,20 @@ const Da = Dt(
2147
2133
  }, null, 8, ["modelValue"])
2148
2134
  ]),
2149
2135
  v(t).skuTags.size ? (x(), P("div", tn, [
2150
- (x(!0), P(ie, null, Ce(v(t).skuTags.keys(), (T) => (x(), ue(B, {
2136
+ (x(!0), P(ie, null, Ce(v(t).skuTags.keys(), (T) => (x(), me(B, {
2151
2137
  key: `${T}`,
2152
2138
  label: `${T}`,
2153
2139
  selectable: "",
2154
2140
  selected: I[`${T}`],
2155
- onClick: (ne) => I[`${T}`] = !I[`${T}`]
2141
+ onClick: (ae) => I[`${T}`] = !I[`${T}`]
2156
2142
  }, {
2157
- default: Y(() => [
2158
- I[`${T}`] ? (x(), ue(L, {
2143
+ default: q(() => [
2144
+ I[`${T}`] ? (x(), me(L, {
2159
2145
  key: 0,
2160
2146
  name: "check",
2161
2147
  class: "text-white",
2162
2148
  size: "sm"
2163
- })) : te("", !0),
2149
+ })) : ne("", !0),
2164
2150
  n("span", {
2165
2151
  class: $e([
2166
2152
  "",
@@ -2173,7 +2159,7 @@ const Da = Dt(
2173
2159
  ]),
2174
2160
  _: 2
2175
2161
  }, 1032, ["label", "selected", "onClick"]))), 128))
2176
- ])) : te("", !0),
2162
+ ])) : ne("", !0),
2177
2163
  n("div", an, [
2178
2164
  n("div", {
2179
2165
  style: bt({ height: "600px", minWidth: `${je.value}px` })
@@ -2187,18 +2173,18 @@ const Da = Dt(
2187
2173
  ])
2188
2174
  ], 64))
2189
2175
  ])
2190
- ], 64)) : te("", !0),
2176
+ ], 64)) : ne("", !0),
2191
2177
  _e.value.value === "history" ? (x(), P("div", nn, [
2192
2178
  xe.value.length ? (x(), P("div", rn, [
2193
- (x(!0), P(ie, null, Ce(xe.value, (T, ne) => (x(), P(ie, { key: ne }, [
2179
+ (x(!0), P(ie, null, Ce(xe.value, (T, ae) => (x(), P(ie, { key: ae }, [
2194
2180
  n("div", ln, [
2195
2181
  n("div", cn, [
2196
2182
  n("div", un, [
2197
2183
  n("div", {
2198
2184
  class: $e([
2199
2185
  {
2200
- "bg-fm-color-primary": ne !== 0,
2201
- "bg-white": ne === 0
2186
+ "bg-fm-color-primary": ae !== 0,
2187
+ "bg-white": ae === 0
2202
2188
  },
2203
2189
  "w-[2px] h-full"
2204
2190
  ])
@@ -2209,8 +2195,8 @@ const Da = Dt(
2209
2195
  n("div", {
2210
2196
  class: $e([
2211
2197
  {
2212
- "bg-fm-color-primary": ne < xe.value.length - 1,
2213
- "bg-white": ne >= xe.value.length - 1
2198
+ "bg-fm-color-primary": ae < xe.value.length - 1,
2199
+ "bg-white": ae >= xe.value.length - 1
2214
2200
  },
2215
2201
  "w-[2px] h-full"
2216
2202
  ])
@@ -2228,8 +2214,8 @@ const Da = Dt(
2228
2214
  n("div", {
2229
2215
  class: $e([
2230
2216
  {
2231
- "bg-fm-color-primary": ne < xe.value.length - 1,
2232
- "bg-white": ne >= xe.value.length - 1
2217
+ "bg-fm-color-primary": ae < xe.value.length - 1,
2218
+ "bg-white": ae >= xe.value.length - 1
2233
2219
  },
2234
2220
  "w-[2px] h-full"
2235
2221
  ])
@@ -2237,11 +2223,11 @@ const Da = Dt(
2237
2223
  ])
2238
2224
  ]),
2239
2225
  n("div", bn, [
2240
- k(i, {
2226
+ k(l, {
2241
2227
  variant: "outlined",
2242
2228
  class: "py-12 px-16"
2243
2229
  }, {
2244
- default: Y(() => [
2230
+ default: q(() => [
2245
2231
  n("div", hn, [
2246
2232
  (x(!0), P(ie, null, Ce(T.info, (le, ge) => (x(), P("div", {
2247
2233
  key: ge,
@@ -2263,49 +2249,49 @@ const Da = Dt(
2263
2249
  ])
2264
2250
  ], 64))), 128))
2265
2251
  ])) : (x(), P("div", on, [
2266
- k(me),
2252
+ k(de),
2267
2253
  n("div", null, [
2268
2254
  n("img", {
2269
- src: v(na),
2255
+ src: v(oa),
2270
2256
  alt: "List is empty"
2271
2257
  }, null, 8, sn)
2272
2258
  ]),
2273
2259
  a[16] || (a[16] = n("div", { class: "fm-typo-en-body-lg-600" }, X("No records found"), -1)),
2274
2260
  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)),
2275
- k(me),
2276
- k(me)
2261
+ k(de),
2262
+ k(de)
2277
2263
  ]))
2278
- ])) : te("", !0)
2264
+ ])) : ne("", !0)
2279
2265
  ])
2280
2266
  ]),
2281
2267
  _: 1
2282
2268
  }, 8, ["model-value"]),
2283
- v(g) && e.draft ? (x(), ue(Na, {
2269
+ v(g) && e.draft ? (x(), me(Na, {
2284
2270
  key: 0,
2285
2271
  show: Re.value,
2286
2272
  "onUpdate:show": a[10] || (a[10] = (T) => Re.value = T),
2287
2273
  refreshing: M.value,
2288
2274
  approving: Pe.value,
2289
2275
  draft: e.draft,
2290
- onRefresh: de,
2276
+ onRefresh: ue,
2291
2277
  onApprove: jt
2292
- }, null, 8, ["show", "refreshing", "approving", "draft"])) : te("", !0)
2278
+ }, null, 8, ["show", "refreshing", "approving", "draft"])) : ne("", !0)
2293
2279
  ], 64);
2294
2280
  };
2295
2281
  }
2296
- }), 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" }, Zn = /* @__PURE__ */ Te({
2282
+ }), 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({
2297
2283
  __name: "ClosingDraftView",
2298
2284
  setup(c) {
2299
2285
  const { t: o } = kt(), { viewDraft: e } = Ke(), { viewClosingDraftProps: d, viewClosingDraftShow: h } = Qt(Ke()), g = Ye(), f = Da(), M = Nt(), { breakpoints: U } = Ot();
2300
2286
  g.watchLocation(f.fetchDrafts);
2301
- const R = V(() => f.loading), _ = q(""), E = V(() => U.value.xs || U.value.sm), j = V(() => E.value ? 10 : 20);
2287
+ const R = V(() => f.loading), _ = Q(""), E = V(() => U.value.xs || U.value.sm), j = V(() => E.value ? 10 : 20);
2302
2288
  function G(C) {
2303
2289
  switch (C) {
2304
2290
  case "refresh":
2305
2291
  return f.fetchDrafts();
2306
2292
  }
2307
2293
  }
2308
- function s(C) {
2294
+ function r(C) {
2309
2295
  return C;
2310
2296
  }
2311
2297
  const t = V(() => E.value ? [
@@ -2322,14 +2308,14 @@ const Da = Dt(
2322
2308
  }
2323
2309
  ]);
2324
2310
  return (C, I) => {
2325
- const Z = K("FmTable");
2311
+ const W = K("FmTable");
2326
2312
  return x(), P(ie, null, [
2327
2313
  k(Et, {
2328
2314
  title: v(o)("inventory.closing.draft.title"),
2329
2315
  actions: t.value,
2330
2316
  "onClick:action": G
2331
2317
  }, {
2332
- default: Y(() => [
2318
+ default: q(() => [
2333
2319
  n("div", {
2334
2320
  class: $e([
2335
2321
  "flex flex-col gap-8 max-h-full",
@@ -2339,13 +2325,13 @@ const Da = Dt(
2339
2325
  }
2340
2326
  ])
2341
2327
  }, [
2342
- k(aa, {
2328
+ k(na, {
2343
2329
  "change-location": "",
2344
2330
  searchable: "",
2345
2331
  search: _.value,
2346
2332
  "onUpdate:search": I[0] || (I[0] = (y) => _.value = y)
2347
2333
  }, null, 8, ["search"]),
2348
- k(Z, {
2334
+ k(W, {
2349
2335
  style: bt(v(M).tableHeight),
2350
2336
  "column-defs": v(f).columnDefs,
2351
2337
  "row-data": v(f).drafts,
@@ -2354,26 +2340,26 @@ const Da = Dt(
2354
2340
  onRowClick: I[1] || (I[1] = (y) => v(e)(y.original)),
2355
2341
  "page-size": j.value
2356
2342
  }, {
2357
- "list-row": Y((y) => [
2358
- k(sa, {
2343
+ "list-row": q((y) => [
2344
+ k(ta, {
2359
2345
  row: y,
2360
- onRowClick: (l) => v(e)(l)
2346
+ onRowClick: (i) => v(e)(i)
2361
2347
  }, {
2362
- default: Y((l) => {
2363
- var $, z, ae, oe, w, ee, de, A, D, J, O, re, Q, ve, je, we, Ie, Ue, ke, _e;
2348
+ default: q((i) => {
2349
+ var $, H, te, oe, w, ee, ue, A, D, J, O, re, Y, ve, je, we, Ie, Ue, ke, _e;
2364
2350
  return [
2365
2351
  n("div", wn, [
2366
2352
  n("div", Sn, [
2367
2353
  n("div", Fn, [
2368
2354
  k(v(Le), {
2369
- render: (ae = (z = ($ = l._id) == null ? void 0 : $.column) == null ? void 0 : z.columnDef) == null ? void 0 : ae.cell,
2370
- props: (w = (oe = l._id) == null ? void 0 : oe.getContext) == null ? void 0 : w.call(oe)
2355
+ render: (te = (H = ($ = i._id) == null ? void 0 : $.column) == null ? void 0 : H.columnDef) == null ? void 0 : te.cell,
2356
+ props: (w = (oe = i._id) == null ? void 0 : oe.getContext) == null ? void 0 : w.call(oe)
2371
2357
  }, null, 8, ["render", "props"])
2372
2358
  ]),
2373
2359
  n("div", Cn, [
2374
2360
  k(v(Le), {
2375
- render: (A = (de = (ee = l.name) == null ? void 0 : ee.column) == null ? void 0 : de.columnDef) == null ? void 0 : A.cell,
2376
- props: (J = (D = l.name) == null ? void 0 : D.getContext) == null ? void 0 : J.call(D)
2361
+ render: (A = (ue = (ee = i.name) == null ? void 0 : ee.column) == null ? void 0 : ue.columnDef) == null ? void 0 : A.cell,
2362
+ props: (J = (D = i.name) == null ? void 0 : D.getContext) == null ? void 0 : J.call(D)
2377
2363
  }, null, 8, ["render", "props"])
2378
2364
  ]),
2379
2365
  n("div", $n, X([
@@ -2382,15 +2368,15 @@ const Da = Dt(
2382
2368
  ].join(", ")), 1),
2383
2369
  n("div", Bn, [
2384
2370
  k(v(Le), {
2385
- render: (Q = (re = (O = l.ref) == null ? void 0 : O.column) == null ? void 0 : re.columnDef) == null ? void 0 : Q.cell,
2386
- props: (je = (ve = l.ref) == null ? void 0 : ve.getContext) == null ? void 0 : je.call(ve)
2371
+ render: (Y = (re = (O = i.ref) == null ? void 0 : O.column) == null ? void 0 : re.columnDef) == null ? void 0 : Y.cell,
2372
+ props: (je = (ve = i.ref) == null ? void 0 : ve.getContext) == null ? void 0 : je.call(ve)
2387
2373
  }, null, 8, ["render", "props"])
2388
2374
  ])
2389
2375
  ]),
2390
2376
  n("div", null, [
2391
2377
  k(v(Le), {
2392
- render: (Ue = (Ie = (we = l.status) == null ? void 0 : we.column) == null ? void 0 : Ie.columnDef) == null ? void 0 : Ue.cell,
2393
- props: (_e = (ke = l.status) == null ? void 0 : ke.getContext) == null ? void 0 : _e.call(ke)
2378
+ render: (Ue = (Ie = (we = i.status) == null ? void 0 : we.column) == null ? void 0 : Ie.columnDef) == null ? void 0 : Ue.cell,
2379
+ props: (_e = (ke = i.status) == null ? void 0 : ke.getContext) == null ? void 0 : _e.call(ke)
2394
2380
  }, null, 8, ["render", "props"])
2395
2381
  ])
2396
2382
  ])
@@ -2405,7 +2391,7 @@ const Da = Dt(
2405
2391
  ]),
2406
2392
  _: 1
2407
2393
  }, 8, ["title", "actions"]),
2408
- (x(), ue(Mt, { to: "body" }, [
2394
+ (x(), me(Mt, { to: "body" }, [
2409
2395
  k(An, Lt(v(d), {
2410
2396
  show: v(h),
2411
2397
  "onUpdate:show": I[2] || (I[2] = (y) => gt(h) ? h.value = y : null),
@@ -2418,5 +2404,5 @@ const Da = Dt(
2418
2404
  }
2419
2405
  });
2420
2406
  export {
2421
- Zn as default
2407
+ Wn as default
2422
2408
  };