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

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 (70) hide show
  1. package/dist/{App-Dr4bSbWV.js → App-pElNw5pB.js} +3 -3
  2. package/dist/{ApprovalView-BrUi6das.js → ApprovalView-B4TSRWMy.js} +5 -5
  3. package/dist/{BindingsDialog-DtsEDaFx.js → BindingsDialog-DyxWNBG1.js} +2 -2
  4. package/dist/{BindingsPicker-BDSimsxV.js → BindingsPicker-D7UkLDlk.js} +2 -2
  5. package/dist/{BindingsTable-ArpmNkQm.js → BindingsTable-Dc8pJO-n.js} +3 -3
  6. package/dist/{ClosingDraftView-D7qz1YGt.js → ClosingDraftView-CSR72RnD.js} +694 -687
  7. package/dist/{ClosingHistoryView-ND9smQRb.js → ClosingHistoryView-DvFKOvsZ.js} +3 -3
  8. package/dist/{ClosingTemplateView--1tzOPIu.js → ClosingTemplateView-CYnVhBqP.js} +14 -14
  9. package/dist/{DeliveryOrderPrintPreview-Ctv1Qp_a.js → DeliveryOrderPrintPreview-Dwgt-cEo.js} +1 -1
  10. package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-lA-iPoWZ.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-D3H1RQaf.js} +3 -3
  11. package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-UJewH4Il.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-CF-BSx4K.js} +2 -2
  12. package/dist/{FmMultiselectDialog-BrJlUxMZ.js → FmMultiselectDialog-C1tRdXUe.js} +1 -1
  13. package/dist/{FmMultiselectDialog-Br5_D-b5.js → FmMultiselectDialog-CqBo_5R3.js} +2 -2
  14. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-BvIdnKjl.js → FmUnitInput.vue_vue_type_script_setup_true_lang-CM6QPPoa.js} +3 -3
  15. package/dist/{ImportView-fEnHrPWZ.js → ImportView-Y-yzGfLi.js} +6 -6
  16. package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-DVELkyVY.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-BpvivxRy.js} +1 -1
  17. package/dist/{IngredientGroupView-B1owkM3C.js → IngredientGroupView-Bdw32H_9.js} +5 -5
  18. package/dist/{IngredientsView-BTKXnnw5.js → IngredientsView-C9xBCLKU.js} +14 -14
  19. package/dist/{IntegrationView-C2jarXxh.js → IntegrationView-BmZmgOrT.js} +12 -12
  20. package/dist/{InventoryBindingForm-Gq8XfKbC.js → InventoryBindingForm-DB68Fqx5.js} +1 -1
  21. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-BVkTXQvA.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-CGI1smUx.js} +4 -4
  22. package/dist/{InventoryBindingSummary-CqQu65hi.js → InventoryBindingSummary-B9mGdrM6.js} +1 -1
  23. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DIukT297.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-C7gllFiR.js} +1 -1
  24. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-D2aU4Ij2.js → PremiumBadge.vue_vue_type_script_setup_true_lang-DAX2Rm45.js} +2 -2
  25. package/dist/{PublishView-CBYg-KST.js → PublishView-hsMNcVGC.js} +3 -3
  26. package/dist/{PurchaseOrderPrintPreview-C_jrGksW.js → PurchaseOrderPrintPreview-B3O2mDR7.js} +1 -1
  27. package/dist/{ReceiveRequestView-iawt5dnN.js → ReceiveRequestView-CCZ_ZTKk.js} +19 -19
  28. package/dist/{RecipeView-Dv5BTxLT.js → RecipeView-CWzRUSTy.js} +8 -8
  29. package/dist/{StockView-oSkKCORB.js → StockView-lVtSv6e5.js} +15 -15
  30. package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-BJ3gnpTq.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-Cx2Wdpp9.js} +1 -1
  31. package/dist/{SupplierView-tipIYgX7.js → SupplierView-Bn6K86cD.js} +11 -11
  32. package/dist/{SurchargeView-CW1lsyEC.js → SurchargeView-C5u_CWxK.js} +6 -6
  33. package/dist/{SystemTrailDialog.vue_vue_type_script_setup_true_lang-B3FZqxjr.js → SystemTrailDialog.vue_vue_type_script_setup_true_lang-C2boqsh0.js} +2 -2
  34. package/dist/{TemplatePublishDialog.vue_vue_type_script_setup_true_lang-D86rTw7c.js → TemplatePublishDialog.vue_vue_type_script_setup_true_lang-B0Z-WupJ.js} +1 -1
  35. package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-cGzs-dHw.js → TransferDetails.vue_vue_type_script_setup_true_lang-BpiFp1cK.js} +14 -14
  36. package/dist/{TransferTemplateView-dSJSgnil.js → TransferTemplateView-CMfA9CeA.js} +15 -15
  37. package/dist/{UnitView-VHi5WMrF.js → UnitView-BwBCxwBg.js} +6 -6
  38. package/dist/{WarehouseView-DLZaux-w.js → WarehouseView-d-i7QZ91.js} +5 -5
  39. package/dist/{WastageTemplateView-KyvwCkdu.js → WastageTemplateView-CTN9FvAU.js} +14 -14
  40. package/dist/{app-Cq2T5z21.js → app-BanOUWeW.js} +9 -9
  41. package/dist/app.js +1 -1
  42. package/dist/{closing-template-TwdeC6qT.js → closing-template-rJXi1N62.js} +1 -1
  43. package/dist/{date2-Dunl1OWI.js → date2-DrFFpmvm.js} +1 -1
  44. package/dist/{dayjs.min-D_81k3gd.js → dayjs.min-BUn7FVfa.js} +1 -1
  45. package/dist/{decimal-B9DLzi9Y.js → decimal-Iv5cW8Fk.js} +2 -2
  46. package/dist/{defineDeepModel-B15nBS96.js → defineDeepModel-B0BLK0AX.js} +1 -1
  47. package/dist/{duplicate-template-BSxFsv2u.js → duplicate-template-CS5JxzRU.js} +1 -1
  48. package/dist/{feature-KwyjpPTq.js → feature-BE1entk_.js} +2 -2
  49. package/dist/{format-time-from-id-BfL9V23H.js → format-time-from-id-Zk8nyA3X.js} +1 -1
  50. package/dist/{format-unit-display-BfSLhflE.js → format-unit-display-DTfb4FQh.js} +10 -10
  51. package/dist/{import-export.helper-TUsgMxew.js → import-export.helper-eysNTnLw.js} +5 -5
  52. package/dist/{index-DTnKa-sF.js → index-BBVzJMx-.js} +1 -1
  53. package/dist/{index-C2H5HeFF.js → index-BSGrS1Uy.js} +1 -1
  54. package/dist/{index-CXtJlhZZ.js → index-CMCmigUe.js} +3 -3
  55. package/dist/{lodash-DRR2nS2T.js → lodash-Bo5fWIzQ.js} +1 -1
  56. package/dist/{netsuite-CAFiEoX5.js → netsuite-DARuwqPK.js} +3 -3
  57. package/dist/{purchase-order-template-CSJXceBK.js → purchase-order-template-DMhr8Uo1.js} +1 -1
  58. package/dist/{rules-BdFLL1aa.js → rules-15LhIexr.js} +3 -3
  59. package/dist/{stock-CgsgvX9b.js → stock-DPWppSPR.js} +3 -3
  60. package/dist/{stock-B80FaSS2.js → stock-DtaMiLiO.js} +1 -1
  61. package/dist/{supplier-BsycjnD1.js → supplier-C5BpCM5Y.js} +2 -2
  62. package/dist/{surcharge-BH6kETCu.js → surcharge-C105g1nX.js} +1 -1
  63. package/dist/tsconfig.app.tsbuildinfo +1 -1
  64. package/dist/{use-ingredient-select-dialog-B2cFOc3t.js → use-ingredient-select-dialog-wgqteN3b.js} +2 -2
  65. package/dist/{use-inventory-binding-dialog-CKUtJDHW.js → use-inventory-binding-dialog-CKmfTceT.js} +2 -2
  66. package/dist/{use-template-enabled-locations-2-tPL4lEZ_.js → use-template-enabled-locations-2-Dy3GQZqT.js} +2 -2
  67. package/dist/{vue-i18n-BhCaMx-9.js → vue-i18n-CtTdNLQE.js} +487 -487
  68. package/dist/{xlsx-DJaY2xSF.js → xlsx-rlGBAsJO.js} +398 -398
  69. package/dist/{xlsx.util-CZq_uKdw.js → xlsx.util-CyG8PI8e.js} +1 -1
  70. package/package.json +1 -1
@@ -1,58 +1,58 @@
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
- import { useCoreStore as ht, useI18n as kt } from "@feedmepos/mf-common";
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, J as Z, w as z, s as _t, K as he, B as Ee, v as ze, c as Yt, a as xt } from "./app-Cq2T5z21.js";
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-Dunl1OWI.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-BdFLL1aa.js";
9
- import { b as Jt, d as Xt } from "./xlsx.util-CZq_uKdw.js";
10
- import { u as Ct } from "./stock-CgsgvX9b.js";
11
- import { u as tt } from "./stock-B80FaSS2.js";
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-BfL9V23H.js";
15
- import { _ as aa } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-UJewH4Il.js";
16
- import { E as na } from "./empty-placeholder-wf6-BWE8.js";
17
- import { u as oa } from "./vue-i18n-BhCaMx-9.js";
18
- import { _ as sa, F as Le } from "./TableActionableRow.vue_vue_type_script_setup_true_lang-Ca_eYa8-.js";
19
- const Qe = Kt((c, o) => {
1
+ import { defineComponent as Ue, ref as Y, computed as R, onMounted as Xe, resolveComponent as K, openBlock as x, createElementBlock as P, Fragment as ce, createTextVNode as ue, createBlock as fe, withCtx as Q, createElementVNode as n, toDisplayString as W, unref as v, createVNode as k, createCommentVNode as ne, h as F, watch as Ee, renderList as $e, reactive as Mt, isRef as ht, normalizeClass as Be, normalizeStyle as kt, Teleport as Lt, mergeProps as Nt } from "vue";
2
+ import { F as yt, u as Et, _ as zt } from "./SingleColumnLayout.vue_vue_type_script_setup_true_lang-CWZkVCAj.js";
3
+ import { useCoreStore as _t, useI18n as et } from "@feedmepos/mf-common";
4
+ import { useSnackbar as tt, useDialog as Ht, components as be, useProxiedModel as Ot, useBreakpoints as Kt } from "@feedmepos/ui-library";
5
+ import { o as Yt, u as Qe, J as Z, w as z, s as xt, K as he, B as ze, v as He, c as Qt, a as Dt } from "./app-BanOUWeW.js";
6
+ import { defineStore as At, storeToRefs as qt } from "pinia";
7
+ import { d as Ke, e as wt, f as Gt, a as ke } from "./date2-DrFFpmvm.js";
8
+ import { R as Wt, f as at, a as Je, t as Zt, d as Ie, o as St, p as Ft, m as Ct, l as Jt } from "./rules-15LhIexr.js";
9
+ import { b as Xt, d as ea } from "./xlsx.util-CyG8PI8e.js";
10
+ import { u as $t } from "./stock-DPWppSPR.js";
11
+ import { u as nt } from "./stock-DtaMiLiO.js";
12
+ import { D as bt, R as Ce } from "./row-action.enum-BcW_L_nE.js";
13
+ import { c as ta } from "./component-DpCUABT3.js";
14
+ import { f as aa } from "./format-time-from-id-Zk8nyA3X.js";
15
+ import { _ as na } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-CF-BSx4K.js";
16
+ import { E as oa } from "./empty-placeholder-wf6-BWE8.js";
17
+ import { u as sa } from "./vue-i18n-CtTdNLQE.js";
18
+ import { _ as ra, F as Ne } from "./TableActionableRow.vue_vue_type_script_setup_true_lang-Ca_eYa8-.js";
19
+ const qe = Yt((u, o) => {
20
20
  function e() {
21
- return Ye().currentLocation.dbName;
21
+ return Qe().currentLocation.dbName;
22
22
  }
23
23
  return {
24
24
  async getDraft(d) {
25
- const h = e(), g = `${c.inventoryBackendUrl}/${h}/closing-draft/${d}`;
26
- return o.get(g);
25
+ const h = e(), y = `${u.inventoryBackendUrl}/${h}/closing-draft/${d}`;
26
+ return o.get(y);
27
27
  },
28
28
  async readDrafts() {
29
- const d = e(), h = `${c.inventoryBackendUrl}/${d}/closing-draft`;
29
+ const d = e(), h = `${u.inventoryBackendUrl}/${d}/closing-draft`;
30
30
  return o.get(h);
31
31
  },
32
32
  async runOperation(d) {
33
- const h = e(), g = `${c.inventoryBackendUrl}/${h}/closing-draft/run-operation`;
34
- return o.post(g, d);
33
+ const h = e(), y = `${u.inventoryBackendUrl}/${h}/closing-draft/run-operation`;
34
+ return o.post(y, d);
35
35
  },
36
36
  async runOperationV1(d) {
37
- const h = e(), g = `${c.inventoryBackendUrl}/${h}/closing-draft/v1/run-operation`;
38
- return o.post(g, d);
37
+ const h = e(), y = `${u.inventoryBackendUrl}/${h}/closing-draft/v1/run-operation`;
38
+ return o.post(y, d);
39
39
  },
40
40
  async sync(d) {
41
- const h = e(), g = `${c.inventoryBackendUrl}/${h}/closing-draft/sync`;
42
- return o.post(g, d);
41
+ const h = e(), y = `${u.inventoryBackendUrl}/${h}/closing-draft/sync`;
42
+ return o.post(y, d);
43
43
  },
44
44
  async cloneDraft(d) {
45
- const h = e(), g = `${c.inventoryBackendUrl}/${h}/closing-draft/${d}/clone`;
46
- return o.post(g, {});
45
+ const h = e(), y = `${u.inventoryBackendUrl}/${h}/closing-draft/${d}/clone`;
46
+ return o.post(y, {});
47
47
  }
48
48
  };
49
- }), ra = { class: "fm-typo-en-body-lg-400" }, la = { class: "fm-typo-en-body-lg-600" }, ia = {
49
+ }), la = { class: "fm-typo-en-body-lg-400" }, ia = { class: "fm-typo-en-body-lg-600" }, ca = {
50
50
  key: 0,
51
51
  class: "flex flex-col"
52
- }, ca = {
52
+ }, ua = {
53
53
  key: 0,
54
54
  class: "fm-typo-en-body-sm-400 text-fm-color-typo-error mt-4"
55
- }, ua = { class: "flex gap-12 py-8 justify-end w-full" }, We = /* @__PURE__ */ Te({
55
+ }, da = { class: "flex gap-12 py-8 justify-end w-full" }, Ze = /* @__PURE__ */ Ue({
56
56
  __name: "ClosingDraftAction",
57
57
  props: {
58
58
  draft: {},
@@ -60,8 +60,8 @@ const Qe = Kt((c, o) => {
60
60
  onCancel: { type: Function },
61
61
  onFinished: { type: Function }
62
62
  },
63
- setup(c) {
64
- const o = c, e = Q(), d = Qe(), h = Xe(), g = Q(!1), f = Q(null), M = Q(!1), U = V(() => {
63
+ setup(u) {
64
+ const o = u, e = Y(), d = qe(), h = tt(), y = Y(!1), f = Y(null), M = Y(!1), U = R(() => {
65
65
  switch (o.action) {
66
66
  case Z.enum.approveDraft:
67
67
  return "Approve";
@@ -71,7 +71,7 @@ const Qe = Kt((c, o) => {
71
71
  return "Mark as Failed";
72
72
  }
73
73
  throw new Error(`Unknown action: ${o.action}`);
74
- }), R = V(() => {
74
+ }), V = R(() => {
75
75
  switch (o.action) {
76
76
  case Z.enum.approveDraft:
77
77
  return "primary";
@@ -82,7 +82,7 @@ const Qe = Kt((c, o) => {
82
82
  }
83
83
  throw new Error(`Unknown action: ${o.action}`);
84
84
  });
85
- Je(() => {
85
+ Xe(() => {
86
86
  if (o.draft.effectiveAt)
87
87
  f.value = new Date(o.draft.effectiveAt);
88
88
  else {
@@ -91,9 +91,9 @@ const Qe = Kt((c, o) => {
91
91
  }
92
92
  M.value = !0;
93
93
  });
94
- const _ = V({
94
+ const _ = R({
95
95
  get() {
96
- return f.value === null ? "" : Oe(f.value);
96
+ return f.value === null ? "" : Ke(f.value);
97
97
  },
98
98
  set(r) {
99
99
  if (r) {
@@ -102,9 +102,9 @@ const Qe = Kt((c, o) => {
102
102
  } else
103
103
  f.value = null;
104
104
  }
105
- }), E = V({
105
+ }), E = R({
106
106
  get() {
107
- return f.value === null ? "" : At(f.value);
107
+ return f.value === null ? "" : wt(f.value);
108
108
  },
109
109
  set(r) {
110
110
  if (r) {
@@ -113,9 +113,9 @@ const Qe = Kt((c, o) => {
113
113
  } else
114
114
  f.value = null;
115
115
  }
116
- }), j = V(() => f.value ? f.value.getTime() > (/* @__PURE__ */ new Date()).getTime() : !1);
117
- async function G(r) {
118
- g.value = !0;
116
+ }), j = R(() => f.value ? f.value.getTime() > (/* @__PURE__ */ new Date()).getTime() : !1);
117
+ async function q(r) {
118
+ y.value = !0;
119
119
  try {
120
120
  r ? await d.runOperationV1({
121
121
  _id: o.draft._id,
@@ -145,55 +145,55 @@ const Qe = Kt((c, o) => {
145
145
  type: "error"
146
146
  }), console.error("error on submit closing draft action", t);
147
147
  } finally {
148
- g.value = !1;
148
+ y.value = !1;
149
149
  }
150
150
  }
151
151
  return (r, t) => {
152
- const C = K("FmLabel"), I = K("FmDatePicker"), W = K("FmTimePicker"), y = K("FmTextField"), i = K("FmButton"), $ = K("FmForm");
153
- return M.value ? (x(), me($, {
152
+ const C = K("FmLabel"), I = K("FmDatePicker"), G = K("FmTimePicker"), g = K("FmTextField"), i = K("FmButton"), $ = K("FmForm");
153
+ return M.value ? (x(), fe($, {
154
154
  key: 1,
155
- onValidationSuccess: G,
155
+ onValidationSuccess: q,
156
156
  class: "flex flex-col gap-32",
157
- disabled: g.value
157
+ disabled: y.value
158
158
  }, {
159
- default: q(() => [
160
- n("div", ra, [
161
- t[4] || (t[4] = ce(" You are about to ")),
162
- n("span", la, X(U.value), 1),
163
- t[5] || (t[5] = ce(" this draft. Please provide a remark to justify this action. "))
159
+ default: Q(() => [
160
+ n("div", la, [
161
+ t[4] || (t[4] = ue(" You are about to ")),
162
+ n("span", ia, W(U.value), 1),
163
+ t[5] || (t[5] = ue(" this draft. Please provide a remark to justify this action. "))
164
164
  ]),
165
- r.action === v(Z).enum.approveDraft ? (x(), P("div", ia, [
165
+ r.action === v(Z).enum.approveDraft ? (x(), P("div", ca, [
166
166
  k(C, { class: "fm-typo-en-body-lg-600" }, {
167
- default: q(() => t[6] || (t[6] = [
168
- ce("Closing Date")
167
+ default: Q(() => t[6] || (t[6] = [
168
+ ue("Closing Date")
169
169
  ])),
170
170
  _: 1
171
171
  }),
172
172
  k(I, {
173
173
  modelValue: _.value,
174
174
  "onUpdate:modelValue": t[0] || (t[0] = (H) => _.value = H),
175
- max: v(Oe)(/* @__PURE__ */ new Date())
175
+ max: v(Ke)(/* @__PURE__ */ new Date())
176
176
  }, null, 8, ["modelValue", "max"]),
177
177
  k(C, { class: "fm-typo-en-body-lg-600" }, {
178
- default: q(() => t[7] || (t[7] = [
179
- ce("Closing Time")
178
+ default: Q(() => t[7] || (t[7] = [
179
+ ue("Closing Time")
180
180
  ])),
181
181
  _: 1
182
182
  }),
183
- k(W, {
183
+ k(G, {
184
184
  modelValue: E.value,
185
185
  "onUpdate:modelValue": t[1] || (t[1] = (H) => E.value = H)
186
186
  }, null, 8, ["modelValue"]),
187
- j.value ? (x(), P("div", ca, " Cannot select future date ")) : ne("", !0)
187
+ j.value ? (x(), P("div", ua, " Cannot select future date ")) : ne("", !0)
188
188
  ])) : ne("", !0),
189
- k(y, {
189
+ k(g, {
190
190
  modelValue: e.value,
191
191
  "onUpdate:modelValue": t[2] || (t[2] = (H) => e.value = H),
192
192
  label: "Remark",
193
193
  "label-mark": "required",
194
- rules: [v(Gt)()]
194
+ rules: [v(Wt)()]
195
195
  }, null, 8, ["modelValue", "rules"]),
196
- n("div", ua, [
196
+ n("div", da, [
197
197
  k(i, {
198
198
  label: "Cancel",
199
199
  variant: "tertiary",
@@ -202,48 +202,48 @@ const Qe = Kt((c, o) => {
202
202
  k(i, {
203
203
  label: U.value,
204
204
  type: "submit",
205
- variant: R.value,
206
- loading: g.value
205
+ variant: V.value,
206
+ loading: y.value
207
207
  }, null, 8, ["label", "variant", "loading"])
208
208
  ])
209
209
  ]),
210
210
  _: 1
211
- }, 8, ["disabled"])) : (x(), P(ie, { key: 0 }, [
212
- ce("Loading")
211
+ }, 8, ["disabled"])) : (x(), P(ce, { key: 0 }, [
212
+ ue("Loading")
213
213
  ], 64));
214
214
  };
215
215
  }
216
- }), da = Be(0);
217
- function $t(c) {
218
- const o = c.measurementsAmounts.groupBy((d) => d.measurement.id), e = c.sku.unit.measurements.reduce((d, h) => {
216
+ }), ma = Ie(0);
217
+ function Bt(u) {
218
+ const o = u.measurementsAmounts.groupBy((d) => d.measurement.id), e = u.sku.unit.measurements.reduce((d, h) => {
219
219
  var M, U;
220
- const g = ((U = (M = o.get(h.id)) == null ? void 0 : M[0]) == null ? void 0 : U.amount) ?? da, f = et(h.conversion, g);
221
- return d + +Ze(f);
222
- }, +Ze(c.baseAmount));
223
- return Wt(e, c.baseAmount.precision);
220
+ const y = ((U = (M = o.get(h.id)) == null ? void 0 : M[0]) == null ? void 0 : U.amount) ?? ma, f = at(h.conversion, y);
221
+ return d + +Je(f);
222
+ }, +Je(u.baseAmount));
223
+ return Zt(e, u.baseAmount.precision);
224
224
  }
225
- const ma = Be(0), fa = Be(100), Bt = "N/A";
226
- function pa(c, o, e, d, h, g) {
227
- var te, oe, w, ee, ue;
228
- const f = $t(c), M = d ?? f, U = wt(M, o), R = o.amount === 0 ? null : St(U, {
225
+ const fa = Ie(0), pa = Ie(100), Tt = "N/A";
226
+ function va(u, o, e, d, h, y) {
227
+ var ee, se, w, te, de;
228
+ const f = Bt(u), M = d ?? f, U = St(M, o), V = o.amount === 0 ? null : Ft(U, {
229
229
  ...o,
230
230
  amount: Math.abs(o.amount)
231
- }), _ = 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) ?? {
231
+ }), _ = V ? at(V, pa) : null, E = ((ee = u.sku.defaultCost) == null ? void 0 : ee.costPerUnit) ?? { amount: 0, precision: 0 }, j = Number(z.toFormatString({ value: E })), q = ((w = (se = u.sku.defaultCost) == null ? void 0 : se.measurement) == null ? void 0 : w.conversion) ?? {
232
232
  amount: 1,
233
233
  precision: 0
234
234
  }, r = Number(
235
- z.toFormatString({ value: G })
236
- ), 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;
235
+ z.toFormatString({ value: q })
236
+ ), t = h ? Number(z.toFormatString({ value: h })) : 0, C = Number(z.toFormatString({ value: o })), I = Number(z.toFormatString({ value: M })), G = C - I, g = G * j / r, i = I * j / r, $ = C * j / r;
237
237
  return {
238
- code: c.sku.code,
239
- name: c.sku.name,
240
- baseUnit: c.sku.unit.abbrev,
241
- costUnit: ((ue = (ee = c.sku.defaultCost) == null ? void 0 : ee.measurement) == null ? void 0 : ue.abbrev) ?? null,
242
- baseUnitAmount: Number(z.toFormatString({ value: c.baseAmount })),
243
- ...c.measurementsAmounts.filter(
244
- (A) => va(A.measurement) && e.includes(A.measurement.id)
238
+ code: u.sku.code,
239
+ name: u.sku.name,
240
+ baseUnit: u.sku.unit.abbrev,
241
+ costUnit: ((de = (te = u.sku.defaultCost) == null ? void 0 : te.measurement) == null ? void 0 : de.abbrev) ?? null,
242
+ baseUnitAmount: Number(z.toFormatString({ value: u.baseAmount })),
243
+ ...u.measurementsAmounts.filter(
244
+ (D) => ga(D.measurement) && e.includes(D.measurement.id)
245
245
  ).reduce(
246
- (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),
246
+ (D, A, J) => (D[`measurementAbbrev${J}`] = `(${A.measurement.abbrev}) × ${z.toFormatString({ value: A.measurement.conversion })}`, D[`measurementAmount${J}`] = Number(z.toFormatString({ value: A.amount })), D),
247
247
  {}
248
248
  ),
249
249
  systemBalance: C,
@@ -251,24 +251,24 @@ function pa(c, o, e, d, h, g) {
251
251
  adjustedAmount: Number(z.toFormatString({ value: U })),
252
252
  adjustedDiffPercentage: _ ? Number(
253
253
  z.toFormatString({
254
- value: Ft(_, 2)
254
+ value: Ct(_, 2)
255
255
  })
256
256
  ) : null,
257
257
  costPerUnit: j,
258
258
  opening: t,
259
- adjustmentTypes: g ?? Bt,
260
- varianceQty: W,
261
- varianceInCost: y,
259
+ adjustmentTypes: y ?? Tt,
260
+ varianceQty: G,
261
+ varianceInCost: g,
262
262
  stockTakeValue: i,
263
263
  systemValue: $
264
264
  };
265
265
  }
266
- function va(c) {
267
- return !c.abbrev.toLocaleLowerCase().includes("inactive");
266
+ function ga(u) {
267
+ return !u.abbrev.toLocaleLowerCase().includes("inactive");
268
268
  }
269
- function ya(c) {
270
- const o = Tt(c);
271
- return c.reduce(
269
+ function ya(u) {
270
+ const o = jt(u);
271
+ return u.reduce(
272
272
  (e, d) => {
273
273
  var h;
274
274
  return Math.max(e, ((h = o == null ? void 0 : o.get(d.sku._id)) == null ? void 0 : h[0].length) ?? 0);
@@ -276,14 +276,14 @@ function ya(c) {
276
276
  0
277
277
  );
278
278
  }
279
- function Tt(c) {
280
- return c.groupBy(
279
+ function jt(u) {
280
+ return u.groupBy(
281
281
  (o) => o.sku._id,
282
282
  (o) => o.measurementsAmounts.filter((e) => !e.measurement.abbrev.toLocaleLowerCase().includes("inactive")).map((e) => e.measurement.id)
283
283
  );
284
284
  }
285
- function ga(c) {
286
- const o = _t(), e = o === "MYR" ? "RM" : o;
285
+ function ba(u) {
286
+ const o = xt(), e = o === "MYR" ? "RM" : o;
287
287
  return [
288
288
  {
289
289
  id: "code",
@@ -349,173 +349,173 @@ function ga(c) {
349
349
  id: "baseUnitAmount",
350
350
  name: "Base unit amount"
351
351
  },
352
- ...Array.from({ length: c }).flatMap((h, g) => [
352
+ ...Array.from({ length: u }).flatMap((h, y) => [
353
353
  {
354
- id: `measurementAmount${g}`,
355
- name: `UOM amount ${g + 1}`
354
+ id: `measurementAmount${y}`,
355
+ name: `UOM amount ${y + 1}`
356
356
  },
357
357
  {
358
- id: `measurementAbbrev${g}`,
359
- name: `UOM ${g + 1}`
358
+ id: `measurementAbbrev${y}`,
359
+ name: `UOM ${y + 1}`
360
360
  }
361
361
  ])
362
362
  ];
363
363
  }
364
- function ba(c, o, e) {
365
- var W, y, i, $, H, te, oe;
364
+ function ha(u, o, e) {
365
+ var G, g, i, $, H, ee, se;
366
366
  const d = o.groupBy(
367
367
  (w) => w.id,
368
368
  (w) => w.balance
369
369
  ), h = e.groupBy(
370
370
  (w) => w.id,
371
371
  (w) => w.balance
372
- ), g = /* @__PURE__ */ new Map();
373
- if (c.opening)
374
- for (const w of c.opening)
375
- g.set(w.skuId, w.balance);
372
+ ), y = /* @__PURE__ */ new Map();
373
+ if (u.opening)
374
+ for (const w of u.opening)
375
+ y.set(w.skuId, w.balance);
376
376
  const f = /* @__PURE__ */ new Map();
377
- if (c.adjustmentSnapshot)
378
- for (const w of c.adjustmentSnapshot) {
379
- const ee = Object.keys(w.adjustmentsByType).join(", ");
380
- f.set(w.skuId, ee || Bt);
377
+ if (u.adjustmentSnapshot)
378
+ for (const w of u.adjustmentSnapshot) {
379
+ const te = Object.keys(w.adjustmentsByType).join(", ");
380
+ f.set(w.skuId, te || Tt);
381
381
  }
382
- const M = [...c.items, ...c.negativeStockItems ?? []], U = Tt(M), R = M.map((w) => {
382
+ const M = [...u.items, ...u.negativeStockItems ?? []], U = jt(M), V = M.map((w) => {
383
383
  var J, O, re;
384
- 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);
385
- return pa(
384
+ const te = ((J = d.get(w.sku._id)) == null ? void 0 : J[0]) ?? fa, de = ((O = U == null ? void 0 : U.get(w.sku._id)) == null ? void 0 : O[0]) ?? [], D = y.get(w.sku._id), A = f.get(w.sku._id);
385
+ return va(
386
386
  w,
387
- ee,
388
- ue,
387
+ te,
388
+ de,
389
389
  (re = h.get(w.sku._id)) == null ? void 0 : re[0],
390
- A,
391
- D
390
+ D,
391
+ A
392
392
  );
393
- }), _ = ya(M), j = ht().currentBusiness.value, G = ga(_), r = [
393
+ }), _ = ya(M), j = _t().currentBusiness.value, q = ba(_), r = [
394
394
  ["Business name:", j == null ? void 0 : j.name],
395
395
  ["Business ID:", j == null ? void 0 : j._id],
396
396
  ["Menu version", j == null ? void 0 : j.menuVersion],
397
- ["Created at", new Date(c.createdAt)],
398
- ["Created by", (W = c.createdBy) == null ? void 0 : W.name],
399
- ["Updated at", new Date(c.updatedAt)],
400
- ["Updated by", (y = c.updatedBy) == null ? void 0 : y.name],
401
- ["Recent action", c.approvedAt ? "Approve" : c.rejectionHistory ? "Reject" : ""],
397
+ ["Created at", new Date(u.createdAt)],
398
+ ["Created by", (G = u.createdBy) == null ? void 0 : G.name],
399
+ ["Updated at", new Date(u.updatedAt)],
400
+ ["Updated by", (g = u.updatedBy) == null ? void 0 : g.name],
401
+ ["Recent action", u.approvedAt ? "Approve" : u.rejectionHistory ? "Reject" : ""],
402
402
  [
403
403
  "Action by",
404
- 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 : ""
404
+ u.approvedAt ? (i = u.approvedBy) == null ? void 0 : i.name : u.rejectionHistory ? (H = ($ = u.rejectionHistory[0]) == null ? void 0 : $.rejectedBy) == null ? void 0 : H.name : ""
405
405
  ],
406
406
  [
407
407
  "Action at",
408
- c.approvedAt ? new Date(c.approvedAt) : c.rejectionHistory ? new Date((te = c.rejectionHistory[0]) == null ? void 0 : te.rejectedAt) : ""
408
+ u.approvedAt ? new Date(u.approvedAt) : u.rejectionHistory ? new Date((ee = u.rejectionHistory[0]) == null ? void 0 : ee.rejectedAt) : ""
409
409
  ],
410
410
  [
411
411
  "Action remark",
412
- c.approvedAt ? c.approveRemark : c.rejectionHistory ? new Date((oe = c.rejectionHistory[0]) == null ? void 0 : oe.rejectRemark) : ""
412
+ u.approvedAt ? u.approveRemark : u.rejectionHistory ? new Date((se = u.rejectionHistory[0]) == null ? void 0 : se.rejectRemark) : ""
413
413
  ],
414
414
  [],
415
- G.map((w) => w.name),
416
- ...R.map((w) => G.map((ee) => w[ee.id]))
417
- ], 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`;
418
- return Xt(C, I), I;
415
+ q.map((w) => w.name),
416
+ ...V.map((w) => q.map((te) => w[te.id]))
417
+ ], t = q.map((w) => `system:${w.id}`), C = Xt(r, t), I = `[${j == null ? void 0 : j.name}] closing draft (${Gt(new Date(u.updatedAt))}).xlsx`;
418
+ return ea(C, I), I;
419
419
  }
420
- const ha = { class: "flex flex-col" }, ka = {
420
+ const ka = { class: "flex flex-col" }, _a = {
421
421
  key: 0,
422
422
  class: "fm-typo-en-body-sm-400 text-fm-color-typo-error mt-4"
423
- }, _a = { class: "flex gap-12 py-8 justify-end w-full" }, xa = /* @__PURE__ */ Te({
423
+ }, xa = { class: "flex gap-12 py-8 justify-end w-full" }, Da = /* @__PURE__ */ Ue({
424
424
  __name: "RefreshBalanceAction",
425
425
  props: {
426
426
  draft: {},
427
427
  onCancel: { type: Function },
428
428
  onFinished: { type: Function }
429
429
  },
430
- setup(c) {
431
- const o = c;
432
- tt();
433
- const e = Q(!1), d = Q(null), h = Q(!1);
434
- Je(() => {
430
+ setup(u) {
431
+ const o = u;
432
+ nt();
433
+ const e = Y(!1), d = Y(null), h = Y(!1);
434
+ Xe(() => {
435
435
  if (o.draft.effectiveAt)
436
436
  d.value = new Date(o.draft.effectiveAt);
437
437
  else {
438
- const R = new Date(o.draft.createdAt);
439
- R.setHours(23, 59, 59, 999), d.value = R;
438
+ const V = new Date(o.draft.createdAt);
439
+ V.setHours(23, 59, 59, 999), d.value = V;
440
440
  }
441
441
  h.value = !0;
442
442
  });
443
- const g = V({
443
+ const y = R({
444
444
  get() {
445
- return d.value === null ? "" : Oe(d.value);
445
+ return d.value === null ? "" : Ke(d.value);
446
446
  },
447
- set(R) {
448
- if (R) {
449
- const _ = /* @__PURE__ */ new Date(`${R} ${f.value}`);
447
+ set(V) {
448
+ if (V) {
449
+ const _ = /* @__PURE__ */ new Date(`${V} ${f.value}`);
450
450
  _.setSeconds(59, 999), d.value = _;
451
451
  } else
452
452
  d.value = null;
453
453
  }
454
- }), f = V({
454
+ }), f = R({
455
455
  get() {
456
- return d.value === null ? "" : At(d.value);
456
+ return d.value === null ? "" : wt(d.value);
457
457
  },
458
- set(R) {
459
- if (R) {
460
- const _ = /* @__PURE__ */ new Date(`${g.value} ${R}`);
458
+ set(V) {
459
+ if (V) {
460
+ const _ = /* @__PURE__ */ new Date(`${y.value} ${V}`);
461
461
  _.setSeconds(59, 999), d.value = _;
462
462
  } else
463
463
  d.value = null;
464
464
  }
465
- }), M = V(() => d.value ? d.value.getTime() > (/* @__PURE__ */ new Date()).getTime() : !1);
465
+ }), M = R(() => d.value ? d.value.getTime() > (/* @__PURE__ */ new Date()).getTime() : !1);
466
466
  async function U() {
467
467
  e.value = !0, o.onFinished(d.value.toISOString());
468
468
  }
469
- return (R, _) => {
470
- const E = K("FmLabel"), j = K("FmDatePicker"), G = K("FmTimePicker"), r = K("FmButton"), t = K("FmForm");
471
- return h.value ? (x(), me(t, {
469
+ return (V, _) => {
470
+ const E = K("FmLabel"), j = K("FmDatePicker"), q = K("FmTimePicker"), r = K("FmButton"), t = K("FmForm");
471
+ return h.value ? (x(), fe(t, {
472
472
  key: 1,
473
473
  onValidationSuccess: U,
474
474
  class: "flex flex-col gap-32",
475
475
  disabled: e.value
476
476
  }, {
477
- default: q(() => [
477
+ default: Q(() => [
478
478
  _[5] || (_[5] = n("div", { class: "fm-typo-en-body-lg-400" }, [
479
479
  n("p", null, [
480
- ce(" Performing "),
480
+ ue(" Performing "),
481
481
  n("span", { class: "fm-typo-en-body-lg-600" }, '"Refresh Balance"'),
482
- ce(" until closing effective date and time. ")
482
+ ue(" until closing effective date and time. ")
483
483
  ]),
484
484
  n("p", { class: "mt-2" }, [
485
- ce(" Please note that this action will "),
485
+ ue(" Please note that this action will "),
486
486
  n("b", null, "update"),
487
- ce(" the effective date and time. ")
487
+ ue(" the effective date and time. ")
488
488
  ])
489
489
  ], -1)),
490
- n("div", ha, [
490
+ n("div", ka, [
491
491
  k(E, { class: "fm-typo-en-body-lg-600" }, {
492
- default: q(() => _[3] || (_[3] = [
493
- ce("Closing Date")
492
+ default: Q(() => _[3] || (_[3] = [
493
+ ue("Closing Date")
494
494
  ])),
495
495
  _: 1
496
496
  }),
497
497
  k(j, {
498
- modelValue: g.value,
499
- "onUpdate:modelValue": _[0] || (_[0] = (C) => g.value = C),
500
- max: v(Oe)(/* @__PURE__ */ new Date())
498
+ modelValue: y.value,
499
+ "onUpdate:modelValue": _[0] || (_[0] = (C) => y.value = C),
500
+ max: v(Ke)(/* @__PURE__ */ new Date())
501
501
  }, null, 8, ["modelValue", "max"]),
502
502
  k(E, { class: "fm-typo-en-body-lg-600" }, {
503
- default: q(() => _[4] || (_[4] = [
504
- ce("Closing Time")
503
+ default: Q(() => _[4] || (_[4] = [
504
+ ue("Closing Time")
505
505
  ])),
506
506
  _: 1
507
507
  }),
508
- k(G, {
508
+ k(q, {
509
509
  modelValue: f.value,
510
510
  "onUpdate:modelValue": _[1] || (_[1] = (C) => f.value = C)
511
511
  }, null, 8, ["modelValue"]),
512
- M.value ? (x(), P("div", ka, " Cannot select future date ")) : ne("", !0)
512
+ M.value ? (x(), P("div", _a, " Cannot select future date ")) : ne("", !0)
513
513
  ]),
514
- n("div", _a, [
514
+ n("div", xa, [
515
515
  k(r, {
516
516
  label: "Cancel",
517
517
  variant: "tertiary",
518
- onClick: _[2] || (_[2] = (C) => R.onCancel())
518
+ onClick: _[2] || (_[2] = (C) => V.onCancel())
519
519
  }),
520
520
  k(r, {
521
521
  label: "Refresh balance",
@@ -527,54 +527,54 @@ const ha = { class: "flex flex-col" }, ka = {
527
527
  ])
528
528
  ]),
529
529
  _: 1
530
- }, 8, ["disabled"])) : (x(), P(ie, { key: 0 }, [
531
- ce("Loading")
530
+ }, 8, ["disabled"])) : (x(), P(ce, { key: 0 }, [
531
+ ue("Loading")
532
532
  ], 64));
533
533
  };
534
534
  }
535
- }), Ke = Dt(
535
+ }), Ye = At(
536
536
  "closingDraftActions",
537
537
  function() {
538
- const o = zt(), e = Xe(), d = tt(), h = Qe(), g = Ct(), f = Q(!1), M = Q();
539
- function U(y) {
538
+ const o = Ht(), e = tt(), d = nt(), h = qe(), y = $t(), f = Y(!1), M = Y();
539
+ function U(g) {
540
540
  const i = {
541
- draft: y
541
+ draft: g
542
542
  };
543
543
  M.value = i, f.value = !0;
544
544
  }
545
- async function R(y) {
545
+ async function V(g) {
546
546
  var $;
547
- if (y.status === he.enum.COMPLETED) {
548
- const H = y.closingAdjustmentId;
547
+ if (g.status === he.enum.COMPLETED) {
548
+ const H = g.closingAdjustmentId;
549
549
  if (!H)
550
550
  return e.open({
551
551
  title: "Something went wrong",
552
552
  message: "Closing draft is completed but closing document cannot be found.",
553
553
  type: "error"
554
554
  }), console.error("Closing draft is completed but closing document cannot be found.", {
555
- draftId: y._id
555
+ draftId: g._id
556
556
  }), [];
557
- const te = await d.readAdjustmentById(H);
558
- return ((te == null ? void 0 : te.skus) ?? []).map((w) => ({
557
+ const ee = await d.readAdjustmentById(H);
558
+ return ((ee == null ? void 0 : ee.skus) ?? []).map((w) => ({
559
559
  id: w.sku._id,
560
560
  balance: w.fromBalance,
561
561
  costs: w.fromCostBalances
562
562
  }));
563
563
  } else
564
- return await g.readStockBalance(), (($ = g.stockBalance) == null ? void 0 : $.skus) ?? [];
564
+ return await y.readStockBalance(), (($ = y.stockBalance) == null ? void 0 : $.skus) ?? [];
565
565
  }
566
- async function _(y, i, $) {
566
+ async function _(g, i, $) {
567
567
  i || (e.open({
568
568
  title: "Exporting",
569
569
  message: "Fetching data..."
570
- }), i = await R(y)), ba(y, i, $ ?? []);
570
+ }), i = await V(g)), ha(g, i, $ ?? []);
571
571
  }
572
- function E(y, i, $) {
572
+ function E(g, i, $) {
573
573
  o.open({
574
574
  title: "Approve draft",
575
- contentComponent: We,
575
+ contentComponent: Ze,
576
576
  contentComponentProps: {
577
- draft: y,
577
+ draft: g,
578
578
  action: Z.enum.approveDraft,
579
579
  onFinished: () => {
580
580
  o.close(), i == null || i();
@@ -587,12 +587,12 @@ const ha = { class: "flex flex-col" }, ka = {
587
587
  $ == null || $();
588
588
  });
589
589
  }
590
- function j(y, i) {
590
+ function j(g, i) {
591
591
  o.open({
592
592
  title: "Reject draft",
593
- contentComponent: We,
593
+ contentComponent: Ze,
594
594
  contentComponentProps: {
595
- draft: y,
595
+ draft: g,
596
596
  action: Z.enum.rejectDraft,
597
597
  onFinished: () => {
598
598
  o.close(), i == null || i();
@@ -601,12 +601,12 @@ const ha = { class: "flex flex-col" }, ka = {
601
601
  }
602
602
  });
603
603
  }
604
- function G(y, i) {
604
+ function q(g, i) {
605
605
  o.open({
606
606
  title: "Mark draft as failed",
607
- contentComponent: We,
607
+ contentComponent: Ze,
608
608
  contentComponentProps: {
609
- draft: y,
609
+ draft: g,
610
610
  action: Z.enum.markAsFailed,
611
611
  onFinished: () => {
612
612
  o.close(), i == null || i();
@@ -615,13 +615,13 @@ const ha = { class: "flex flex-col" }, ka = {
615
615
  }
616
616
  });
617
617
  }
618
- async function r(y, i) {
618
+ async function r(g, i) {
619
619
  await h.sync({
620
- _id: y._id,
621
- _rev: y._rev ?? "",
620
+ _id: g._id,
621
+ _rev: g._rev ?? "",
622
622
  action: Z.enum.approveDraft,
623
623
  data: {
624
- remark: y.remark ?? ""
624
+ remark: g.remark ?? ""
625
625
  }
626
626
  }).delayed(500), e.open({
627
627
  title: "Success",
@@ -632,12 +632,12 @@ const ha = { class: "flex flex-col" }, ka = {
632
632
  function t() {
633
633
  f.value = !1;
634
634
  }
635
- async function C(y, i, $) {
635
+ async function C(g, i, $) {
636
636
  await o.open({
637
637
  title: "Refresh balance",
638
- contentComponent: xa,
638
+ contentComponent: Da,
639
639
  contentComponentProps: {
640
- draft: y,
640
+ draft: g,
641
641
  onFinished: (H) => {
642
642
  o.close(), $ == null || $(H);
643
643
  },
@@ -647,26 +647,26 @@ const ha = { class: "flex flex-col" }, ka = {
647
647
  }
648
648
  });
649
649
  }
650
- async function I(y) {
650
+ async function I(g) {
651
651
  await o.open({
652
652
  title: "Invalidate closing draft cache",
653
653
  message: "It will invalidate opening and stock movement cache for this draft.",
654
654
  primaryActions: { text: "Proceed", close: !0 },
655
655
  secondaryActions: { text: "Cancel", close: !0 }
656
656
  }).onPrimary(async () => {
657
- await d.recalculation.scheduleInvalidateClosingDraftCache([y._id]), e.open({
657
+ await d.recalculation.scheduleInvalidateClosingDraftCache([g._id]), e.open({
658
658
  title: "Success",
659
659
  message: "Invalidate cache requested",
660
660
  type: "success"
661
661
  });
662
662
  });
663
663
  }
664
- async function W(y, i) {
664
+ async function G(g, i) {
665
665
  try {
666
666
  e.open({
667
667
  title: "Cloning",
668
668
  message: "Creating a copy of the draft..."
669
- }), await h.cloneDraft(y._id), e.open({
669
+ }), await h.cloneDraft(g._id), e.open({
670
670
  title: "Success",
671
671
  message: "Draft cloned successfully",
672
672
  type: "success"
@@ -684,19 +684,19 @@ const ha = { class: "flex flex-col" }, ka = {
684
684
  closeDraftDialog: t,
685
685
  approveDraft: E,
686
686
  rejectDraft: j,
687
- markAsFailed: G,
687
+ markAsFailed: q,
688
688
  syncDraft: r,
689
689
  exportDraft: _,
690
690
  refreshBalance: C,
691
- cloneDraft: W,
691
+ cloneDraft: G,
692
692
  viewClosingDraftShow: f,
693
693
  viewClosingDraftProps: M,
694
694
  invalidateDraftCache: I
695
695
  };
696
696
  }
697
697
  );
698
- function He(c) {
699
- switch (c) {
698
+ function Oe(u) {
699
+ switch (u) {
700
700
  case "DRAFT":
701
701
  return "fm-status-badge-draft";
702
702
  case "PROCESSING":
@@ -707,26 +707,26 @@ function He(c) {
707
707
  return "fm-status-badge-complete";
708
708
  }
709
709
  }
710
- const Da = Dt(
710
+ const Aa = At(
711
711
  "closingDraftTable",
712
712
  function() {
713
- const { t: o } = kt(), e = ht(), d = Ke(), h = Q(new Array()), g = Q(!1), f = Ye(), M = Qe();
713
+ const { t: o } = et(), e = _t(), d = Ye(), h = Y(new Array()), y = Y(!1), f = Qe(), M = qe();
714
714
  async function U() {
715
715
  if (h.value = [], !!f._currentLocation) {
716
- g.value = !0;
716
+ y.value = !0;
717
717
  try {
718
718
  const [r] = await Promise.all([M.readDrafts()]).delayed(1e3);
719
719
  h.value = r.reverse();
720
720
  } catch (r) {
721
721
  console.log("Something went wrong when fetching drafts:", r);
722
722
  } finally {
723
- g.value = !1;
723
+ y.value = !1;
724
724
  }
725
725
  }
726
726
  }
727
- async function R(r) {
727
+ async function V(r) {
728
728
  if (!h.value.find((t) => t._id) && f._currentLocation) {
729
- g.value = !0;
729
+ y.value = !0;
730
730
  try {
731
731
  const [t] = await Promise.all([
732
732
  M.getDraft(r),
@@ -736,7 +736,7 @@ const Da = Dt(
736
736
  } catch (t) {
737
737
  console.log("Something went wrong when fetching drafts:", t);
738
738
  } finally {
739
- g.value = !1;
739
+ y.value = !1;
740
740
  }
741
741
  }
742
742
  }
@@ -750,10 +750,10 @@ const Da = Dt(
750
750
  d.closeDraftDialog(), U();
751
751
  }
752
752
  function j(r, t) {
753
- switch (t = Yt(t), r) {
754
- case Fe.Details:
753
+ switch (t = Qt(t), r) {
754
+ case Ce.Details:
755
755
  return d.viewDraft(t);
756
- case Fe.Export:
756
+ case Ce.Export:
757
757
  return d.exportDraft(t);
758
758
  case Z.enum.approveDraft:
759
759
  return d.approveDraft(t, E);
@@ -761,7 +761,7 @@ const Da = Dt(
761
761
  return d.rejectDraft(t, E);
762
762
  case Z.enum.markAsFailed:
763
763
  return d.markAsFailed(t, E);
764
- case Fe.Duplicate:
764
+ case Ce.Duplicate:
765
765
  return d.cloneDraft(t, E);
766
766
  }
767
767
  }
@@ -772,7 +772,7 @@ const Da = Dt(
772
772
  accessorKey: "_id",
773
773
  header: () => o("inventory.closing.table.createdAt"),
774
774
  cell(r) {
775
- return ta(`${r.getValue()}`);
775
+ return aa(`${r.getValue()}`);
776
776
  },
777
777
  enableSorting: !0
778
778
  },
@@ -782,14 +782,14 @@ const Da = Dt(
782
782
  cell(r) {
783
783
  const t = r.row.original;
784
784
  let C = r.getValue();
785
- return C || (C = Ee(t._id)), De(C);
785
+ return C || (C = ze(t._id)), ke(C);
786
786
  },
787
787
  enableSorting: !0,
788
788
  size: 200
789
789
  },
790
790
  {
791
791
  id: "updatedAt",
792
- accessorFn: (r) => De(r.updatedAt),
792
+ accessorFn: (r) => ke(r.updatedAt),
793
793
  header: () => "Updated at",
794
794
  enableSorting: !0,
795
795
  size: 200
@@ -829,8 +829,8 @@ const Da = Dt(
829
829
  enableSorting: !1,
830
830
  cell(r) {
831
831
  var i;
832
- 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;
833
- return C === "DRAFT" && y ? y.getTime() > I.getTime() ? F(
832
+ const t = r.row.original, C = t.status, I = new Date(t.updatedAt), G = (i = t == null ? void 0 : t.rejectionHistory) == null ? void 0 : i.computeFirst(($) => $.rejectedAt), g = G ? new Date(G) : null;
833
+ return C === "DRAFT" && g ? g.getTime() > I.getTime() ? F(
834
834
  "div",
835
835
  {
836
836
  class: "flex"
@@ -838,7 +838,7 @@ const Da = Dt(
838
838
  F(
839
839
  "div",
840
840
  {
841
- class: ["fm-status-badge", He("FAILED")]
841
+ class: ["fm-status-badge", Oe("FAILED")]
842
842
  },
843
843
  "Rejected"
844
844
  )
@@ -850,7 +850,7 @@ const Da = Dt(
850
850
  F(
851
851
  "div",
852
852
  {
853
- class: ["fm-status-badge", He("PROCESSING")]
853
+ class: ["fm-status-badge", Oe("PROCESSING")]
854
854
  },
855
855
  "Updated"
856
856
  )
@@ -862,9 +862,9 @@ const Da = Dt(
862
862
  F(
863
863
  "div",
864
864
  {
865
- class: ["fm-status-badge", He(C)]
865
+ class: ["fm-status-badge", Oe(C)]
866
866
  },
867
- ze(C)
867
+ He(C)
868
868
  )
869
869
  );
870
870
  }
@@ -874,9 +874,9 @@ const Da = Dt(
874
874
  cell(r) {
875
875
  var i;
876
876
  const t = r.row.original, C = ((i = e.sessionUser.value) == null ? void 0 : i.role.isAdmin) ?? !1, I = [
877
- yt[Fe.Details],
878
- yt[Fe.Export]
879
- ], W = [
877
+ bt[Ce.Details],
878
+ bt[Ce.Export]
879
+ ], G = [
880
880
  {
881
881
  translationKey: "inventory.closing.draft.approveDraft",
882
882
  color: "text-fm-color-typo-primary",
@@ -892,20 +892,20 @@ const Da = Dt(
892
892
  color: "text-fm-color-typo-error",
893
893
  value: Z.enum.markAsFailed
894
894
  }
895
- ], y = C && t.status !== he.enum.DRAFT ? [
895
+ ], g = C && t.status !== he.enum.DRAFT ? [
896
896
  {
897
897
  translationKey: "inventory.closing.draft.cloneDraft",
898
898
  color: "text-fm-color-typo-primary",
899
- value: Fe.Duplicate
899
+ value: Ce.Duplicate
900
900
  }
901
901
  ] : [];
902
- return ea(
902
+ return ta(
903
903
  [
904
904
  ...I,
905
- ...t.status === he.enum.DRAFT ? W : []
905
+ ...t.status === he.enum.DRAFT ? G : []
906
906
  ],
907
907
  ($) => j($, t),
908
- y
908
+ g
909
909
  );
910
910
  },
911
911
  enableSorting: !1,
@@ -917,25 +917,25 @@ const Da = Dt(
917
917
  }
918
918
  ],
919
919
  drafts: h,
920
- loading: g,
920
+ loading: y,
921
921
  fetchDrafts: U,
922
- loadDraft: R,
922
+ loadDraft: V,
923
923
  updateDraftRef: _
924
924
  };
925
925
  }
926
- ), Aa = { class: "fm-typo-en-heading-lg-600" }, wa = { class: "py-4" }, Sa = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary mb-4" }, Fa = { key: 0 }, Ca = { class: "mt-4 flex gap-4" }, $a = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary mb-4" }, Ba = { key: 0 }, Ta = {
926
+ ), wa = { class: "fm-typo-en-heading-lg-600" }, Sa = { class: "py-4" }, Fa = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary mb-4" }, Ca = { key: 0 }, $a = { class: "mt-4 flex gap-4" }, Ba = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary mb-4" }, Ta = { key: 0 }, ja = {
927
927
  key: 0,
928
928
  class: "mb-4"
929
- }, ja = { class: "flex flex-col gap-1 max-h-200 overflow-auto w-full" }, Ia = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ua = {
929
+ }, Ia = { class: "flex flex-col gap-1 max-h-200 overflow-auto w-full" }, Ua = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ra = {
930
930
  key: 0,
931
931
  class: "text-fm-color-system-success-300 mr-1"
932
- }, Ra = {
932
+ }, Va = {
933
933
  key: 1,
934
934
  class: "text-fm-color-system-error-300 mr-1"
935
- }, Pa = { class: "fm-typo-en-body-md-400" }, Va = { class: "mt-4 flex gap-4" }, Ma = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary mb-4" }, La = {
935
+ }, Pa = { class: "fm-typo-en-body-md-400" }, Ma = { class: "mt-4 flex gap-4" }, La = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary mb-4" }, Na = {
936
936
  key: 0,
937
937
  class: "flex gap-4"
938
- }, Na = /* @__PURE__ */ Te({
938
+ }, Ea = /* @__PURE__ */ Ue({
939
939
  __name: "ClosingDraftApprovalDialog",
940
940
  props: {
941
941
  show: { type: Boolean },
@@ -944,31 +944,31 @@ const Da = Dt(
944
944
  draft: {}
945
945
  },
946
946
  emits: ["update:show", "refresh", "approve"],
947
- setup(c, { emit: o }) {
948
- const { FmStepper: e, FmStep: d, FmDialog: h, FmButton: g } = be, { t: f } = oa(), M = xt(), U = c, R = o, _ = V(
947
+ setup(u, { emit: o }) {
948
+ const { FmStepper: e, FmStep: d, FmDialog: h, FmButton: y } = be, { t: f } = sa(), M = Dt(), U = u, V = o, _ = R(
949
949
  () => {
950
- var A, D;
951
- return ((A = U.draft) == null ? void 0 : A.stockSnapshot) && ((D = U.draft) == null ? void 0 : D.stockSnapshot) !== void 0;
950
+ var D, A;
951
+ return ((D = U.draft) == null ? void 0 : D.stockSnapshot) && ((A = U.draft) == null ? void 0 : A.stockSnapshot) !== void 0;
952
952
  }
953
- ), E = V(() => {
953
+ ), E = R(() => {
954
954
  var J, O, re;
955
- const A = ((J = U.draft) == null ? void 0 : J.items.map((Y) => ({
956
- id: Y.sku._id,
957
- code: Y.sku.code,
958
- name: Y.sku.name
959
- }))) ?? [], D = ((re = (O = U.draft) == null ? void 0 : O.negativeStockItems) == null ? void 0 : re.map((Y) => ({
960
- id: Y.sku._id,
961
- code: Y.sku.code,
962
- name: Y.sku.name
955
+ const D = ((J = U.draft) == null ? void 0 : J.items.map((le) => ({
956
+ id: le.sku._id,
957
+ code: le.sku.code,
958
+ name: le.sku.name
959
+ }))) ?? [], A = ((re = (O = U.draft) == null ? void 0 : O.negativeStockItems) == null ? void 0 : re.map((le) => ({
960
+ id: le.sku._id,
961
+ code: le.sku.code,
962
+ name: le.sku.name
963
963
  }))) ?? [];
964
- return [...A, ...D].reduce(
965
- (Y, ve) => (Y[ve.id] = ve, Y),
964
+ return [...D, ...A].reduce(
965
+ (le, X) => (le[X.id] = X, le),
966
966
  {}
967
967
  );
968
- }), j = V(
968
+ }), j = R(
969
969
  () => {
970
- var A, D, J;
971
- return (((J = (D = (A = U.draft) == null ? void 0 : A.stockSnapshot) == null ? void 0 : D.filter((O) => O.balance.amount < 0)) == null ? void 0 : J.map((O) => {
970
+ var D, A, J;
971
+ return (((J = (A = (D = U.draft) == null ? void 0 : D.stockSnapshot) == null ? void 0 : A.filter((O) => O.balance.amount < 0)) == null ? void 0 : J.map((O) => {
972
972
  const re = M.skuById[O.id];
973
973
  return re ? {
974
974
  id: re._id,
@@ -977,93 +977,93 @@ const Da = Dt(
977
977
  } : null;
978
978
  })) ?? []).filter((O) => O !== null);
979
979
  }
980
- ), G = V(() => {
981
- var A;
982
- return _.value ? ((A = j.value) == null ? void 0 : A.filter((D) => !E.value[D.id]).map((D) => D.id)) ?? [] : [];
983
- }), r = V({
980
+ ), q = R(() => {
981
+ var D;
982
+ return _.value ? ((D = j.value) == null ? void 0 : D.filter((A) => !E.value[A.id]).map((A) => A.id)) ?? [] : [];
983
+ }), r = R({
984
984
  get: () => U.show,
985
- set: (A) => R("update:show", A)
986
- }), t = Q(1), C = () => t.value > 1, I = () => t.value > 2, W = () => !1;
987
- function y(A) {
988
- return A === 1 ? _.value : A === 2 ? G.value.length == 0 : !1;
985
+ set: (D) => V("update:show", D)
986
+ }), t = Y(1), C = () => t.value > 1, I = () => t.value > 2, G = () => !1;
987
+ function g(D) {
988
+ return D === 1 ? _.value : D === 2 ? q.value.length == 0 : !1;
989
989
  }
990
- const i = V(() => !_.value || G.value.length > 0);
991
- function $(A) {
992
- let D = A + 1;
993
- for (; D <= 3 && y(D); ) D++;
994
- return D > 3 ? 3 : D;
990
+ const i = R(() => !_.value || q.value.length > 0);
991
+ function $(D) {
992
+ let A = D + 1;
993
+ for (; A <= 3 && g(A); ) A++;
994
+ return A > 3 ? 3 : A;
995
995
  }
996
- function H(A) {
997
- let D = A - 1;
998
- for (; D >= 1 && y(D); ) D--;
999
- return D < 1 ? 1 : D;
996
+ function H(D) {
997
+ let A = D - 1;
998
+ for (; A >= 1 && g(A); ) A--;
999
+ return A < 1 ? 1 : A;
1000
1000
  }
1001
- function te() {
1001
+ function ee() {
1002
1002
  return _.value ? i.value ? 3 : 2 : 1;
1003
1003
  }
1004
- Ne(
1004
+ Ee(
1005
1005
  () => U.show,
1006
- (A) => {
1007
- A && (t.value = te());
1006
+ (D) => {
1007
+ D && (t.value = ee());
1008
1008
  }
1009
- ), Ne(
1009
+ ), Ee(
1010
1010
  () => _.value,
1011
- (A) => {
1012
- A && t.value === 1 && (t.value = $(1));
1011
+ (D) => {
1012
+ D && t.value === 1 && (t.value = $(1));
1013
1013
  }
1014
- ), Ne(
1015
- () => G.value.length,
1016
- (A) => {
1017
- A === 0 && t.value === 2 && (t.value = $(2));
1014
+ ), Ee(
1015
+ () => q.value.length,
1016
+ (D) => {
1017
+ D === 0 && t.value === 2 && (t.value = $(2));
1018
1018
  }
1019
1019
  );
1020
- function oe() {
1021
- R("refresh");
1020
+ function se() {
1021
+ V("refresh");
1022
1022
  }
1023
1023
  function w() {
1024
1024
  t.value < 3 && (t.value = $(t.value));
1025
1025
  }
1026
- function ee() {
1026
+ function te() {
1027
1027
  t.value > 1 && (t.value = H(t.value));
1028
1028
  }
1029
- function ue() {
1030
- R("approve");
1029
+ function de() {
1030
+ V("approve");
1031
1031
  }
1032
- return (A, D) => {
1032
+ return (D, A) => {
1033
1033
  const J = K("FmIcon");
1034
- return x(), me(v(h), {
1034
+ return x(), fe(v(h), {
1035
1035
  modelValue: r.value,
1036
- "onUpdate:modelValue": D[1] || (D[1] = (O) => r.value = O),
1036
+ "onUpdate:modelValue": A[1] || (A[1] = (O) => r.value = O),
1037
1037
  "max-width": 600
1038
1038
  }, {
1039
- "dialog-header": q(() => [
1040
- n("div", Aa, X(v(f)("inventory.closing.approval.title")), 1)
1039
+ "dialog-header": Q(() => [
1040
+ n("div", wa, W(v(f)("inventory.closing.approval.title")), 1)
1041
1041
  ]),
1042
- default: q(() => [
1043
- n("div", wa, [
1042
+ default: Q(() => [
1043
+ n("div", Sa, [
1044
1044
  k(v(e), {
1045
1045
  modelValue: t.value,
1046
- "onUpdate:modelValue": D[0] || (D[0] = (O) => t.value = O),
1046
+ "onUpdate:modelValue": A[0] || (A[0] = (O) => t.value = O),
1047
1047
  orientation: "vertical"
1048
1048
  }, {
1049
- default: q(() => [
1049
+ default: Q(() => [
1050
1050
  k(v(d), {
1051
1051
  value: 1,
1052
1052
  title: v(f)("inventory.closing.approval.step.generateReport.title"),
1053
1053
  complete: C
1054
1054
  }, {
1055
- default: q(() => [
1056
- n("div", Sa, X(v(f)("inventory.closing.approval.step.generateReport.description")), 1),
1057
- t.value === 1 ? (x(), P("div", Fa, [
1058
- k(v(g), {
1055
+ default: Q(() => [
1056
+ n("div", Fa, W(v(f)("inventory.closing.approval.step.generateReport.description")), 1),
1057
+ t.value === 1 ? (x(), P("div", Ca, [
1058
+ k(v(y), {
1059
1059
  label: v(f)("inventory.stock.stock_balance.refreshBalance"),
1060
1060
  "prepend-icon": "refresh",
1061
1061
  variant: "secondary",
1062
- loading: A.refreshing,
1063
- onClick: oe
1062
+ loading: D.refreshing,
1063
+ onClick: se
1064
1064
  }, null, 8, ["label", "loading"]),
1065
- n("div", Ca, [
1066
- k(v(g), {
1065
+ n("div", $a, [
1066
+ k(v(y), {
1067
1067
  label: v(f)("inventory.common.continue"),
1068
1068
  disabled: !_.value,
1069
1069
  onClick: w
@@ -1079,41 +1079,41 @@ const Da = Dt(
1079
1079
  disabled: () => !_.value,
1080
1080
  complete: I
1081
1081
  }, {
1082
- default: q(() => [
1083
- 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),
1084
- t.value === 2 ? (x(), P("div", Ba, [
1085
- j.value.length > 0 ? (x(), P("div", Ta, [
1086
- D[2] || (D[2] = n("div", { class: "fm-typo-en-body-md-600 mb-2" }, null, -1)),
1087
- n("div", ja, [
1088
- (x(!0), P(ie, null, Ce(j.value, (O) => (x(), P("div", {
1082
+ default: Q(() => [
1083
+ n("div", Ba, W(j.value.length > 0 ? `${v(f)("inventory.closing.approval.step.negativeItems.resolveMessage")} [${v(f)("inventory.closing.approval.step.negativeItems.itemsHeader")} (${q.value.length})]` : v(f)("inventory.closing.approval.step.negativeItems.noItemsMessage")), 1),
1084
+ t.value === 2 ? (x(), P("div", Ta, [
1085
+ j.value.length > 0 ? (x(), P("div", ja, [
1086
+ A[2] || (A[2] = n("div", { class: "fm-typo-en-body-md-600 mb-2" }, null, -1)),
1087
+ n("div", Ia, [
1088
+ (x(!0), P(ce, null, $e(j.value, (O) => (x(), P("div", {
1089
1089
  key: O.id,
1090
1090
  class: "flex gap-8"
1091
1091
  }, [
1092
- n("div", Ia, [
1093
- E.value[O.id] ? (x(), P("span", Ua, [
1092
+ n("div", Ua, [
1093
+ E.value[O.id] ? (x(), P("span", Ra, [
1094
1094
  k(J, {
1095
1095
  name: "check_circle",
1096
1096
  size: "sm"
1097
1097
  })
1098
- ])) : (x(), P("span", Ra, [
1098
+ ])) : (x(), P("span", Va, [
1099
1099
  k(J, {
1100
1100
  name: "error",
1101
1101
  size: "sm"
1102
1102
  })
1103
1103
  ])),
1104
- ce(" " + X(O.code), 1)
1104
+ ue(" " + W(O.code), 1)
1105
1105
  ]),
1106
- n("div", Pa, X(O.name), 1)
1106
+ n("div", Pa, W(O.name), 1)
1107
1107
  ]))), 128))
1108
1108
  ])
1109
1109
  ])) : ne("", !0),
1110
- n("div", Va, [
1111
- k(v(g), {
1110
+ n("div", Ma, [
1111
+ k(v(y), {
1112
1112
  label: v(f)("inventory.common.back"),
1113
1113
  variant: "secondary",
1114
- onClick: ee
1114
+ onClick: te
1115
1115
  }, null, 8, ["label"]),
1116
- k(v(g), {
1116
+ k(v(y), {
1117
1117
  label: v(f)("inventory.common.continue"),
1118
1118
  disabled: i.value,
1119
1119
  onClick: w
@@ -1127,22 +1127,22 @@ const Da = Dt(
1127
1127
  value: 3,
1128
1128
  title: v(f)("inventory.closing.approval.step.approval.title"),
1129
1129
  disabled: () => i.value,
1130
- complete: W
1130
+ complete: G
1131
1131
  }, {
1132
- default: q(() => [
1133
- n("div", Ma, X(v(f)("inventory.closing.approval.step.approval.warning")), 1),
1134
- t.value === 3 ? (x(), P("div", La, [
1135
- k(v(g), {
1132
+ default: Q(() => [
1133
+ n("div", La, W(v(f)("inventory.closing.approval.step.approval.warning")), 1),
1134
+ t.value === 3 ? (x(), P("div", Na, [
1135
+ k(v(y), {
1136
1136
  label: v(f)("inventory.common.back"),
1137
1137
  variant: "secondary",
1138
- onClick: ee
1138
+ onClick: te
1139
1139
  }, null, 8, ["label"]),
1140
- k(v(g), {
1140
+ k(v(y), {
1141
1141
  label: v(f)("inventory.common.approve"),
1142
1142
  variant: "destructive",
1143
1143
  disabled: i.value,
1144
- loading: A.approving,
1145
- onClick: ue
1144
+ loading: D.approving,
1145
+ onClick: de
1146
1146
  }, null, 8, ["label", "disabled", "loading"])
1147
1147
  ])) : ne("", !0)
1148
1148
  ]),
@@ -1157,86 +1157,87 @@ const Da = Dt(
1157
1157
  }, 8, ["modelValue"]);
1158
1158
  };
1159
1159
  }
1160
- }), Ea = { class: "w-full flex flex-col gap-32" }, za = { class: "flex justify-between" }, Ha = { class: "flex" }, Oa = { class: "grid grid-cols-[repeat(4,1fr)] xs:flex xs:flex-col sm:flex sm:flex-col gap-8" }, Ka = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ya = { class: "flex gap-1" }, Qa = { class: "fm-typo-en-body-lg-600" }, qa = { class: "flex flex-col gap-16" }, Ga = { class: "flex items-center" }, Wa = {
1160
+ }), za = { class: "w-full flex flex-col gap-32" }, Ha = { class: "flex justify-between" }, Oa = { class: "flex" }, Ka = { class: "grid grid-cols-[repeat(4,1fr)] xs:flex xs:flex-col sm:flex sm:flex-col gap-8" }, Ya = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Qa = { class: "flex gap-1" }, qa = { class: "fm-typo-en-body-lg-600" }, Ga = { class: "flex flex-col gap-16" }, Wa = { class: "flex items-center" }, Za = {
1161
1161
  key: 0,
1162
1162
  class: "flex gap-8"
1163
- }, Za = {
1163
+ }, Ja = {
1164
1164
  key: 0,
1165
1165
  class: "w-full flex flex-col items-center"
1166
- }, Ja = { class: "flex items-center gap-8" }, Xa = { class: "flex flex-col gap-8" }, en = { class: "flex gap-8" }, tn = {
1166
+ }, Xa = { class: "flex items-center gap-8" }, en = { class: "flex flex-col gap-8" }, tn = { class: "flex gap-8" }, an = {
1167
1167
  key: 0,
1168
1168
  class: "flex gap-8"
1169
- }, an = { class: "overflow-x-auto" }, nn = {
1169
+ }, nn = { class: "overflow-x-auto" }, on = {
1170
1170
  key: 1,
1171
1171
  class: "flex-1 xs:w-screen xs:max-w-full"
1172
- }, on = {
1172
+ }, sn = {
1173
1173
  key: 0,
1174
1174
  class: "flex flex-col items-center gap-8 h-full"
1175
- }, sn = ["src"], rn = {
1175
+ }, rn = ["src"], ln = {
1176
1176
  key: 1,
1177
1177
  class: "px-4 flex flex-col"
1178
- }, ln = { class: "flex gap-12 content-stretch" }, cn = {
1178
+ }, cn = { class: "flex gap-12 content-stretch" }, un = {
1179
1179
  class: "flex flex-col w-24",
1180
1180
  name: "circles"
1181
- }, un = { class: "flex-1 flex flex-col items-center" }, dn = { class: "flex-1 flex flex-col items-center" }, mn = {
1181
+ }, dn = { class: "flex-1 flex flex-col items-center" }, mn = { class: "flex-1 flex flex-col items-center" }, fn = {
1182
1182
  class: "py-12 flex flex-col gap-4",
1183
1183
  name: "received-at header"
1184
- }, fn = { class: "fm-typo-en-body-lg-400" }, pn = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, vn = { class: "flex gap-12 content-stretch" }, yn = {
1184
+ }, pn = { class: "fm-typo-en-body-lg-400" }, vn = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, gn = { class: "flex gap-12 content-stretch" }, yn = {
1185
1185
  class: "flex flex-col w-24",
1186
1186
  name: "circles"
1187
- }, gn = { class: "flex-1 flex flex-col items-center" }, bn = {
1187
+ }, bn = { class: "flex-1 flex flex-col items-center" }, hn = {
1188
1188
  class: "py-12 flex flex-col gap-4 flex-1",
1189
1189
  name: "delivery details"
1190
- }, hn = { class: "flex flex-col gap-8" }, kn = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, _n = { class: "flex flex-col gap-4" }, xn = { class: "flex gap-8" }, Dn = "N/A", An = /* @__PURE__ */ Te({
1190
+ }, kn = { class: "flex flex-col gap-8" }, _n = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, xn = { class: "flex flex-col gap-4" }, Dn = { class: "flex items-center justify-between gap-8 w-full" }, An = { class: "flex items-center gap-8" }, wn = { class: "flex flex-col items-end" }, Sn = { class: "text-2xl font-semibold" }, Fn = "N/A", Cn = /* @__PURE__ */ Ue({
1191
1191
  __name: "ClosingDraftDialog",
1192
1192
  props: {
1193
1193
  show: { type: Boolean },
1194
1194
  draft: {}
1195
1195
  },
1196
1196
  emits: ["submitted", "refresh"],
1197
- setup(c, { emit: o }) {
1198
- const e = c, d = V(() => {
1199
- const u = _t();
1200
- return u === "MYR" ? "RM" : u;
1197
+ setup(u, { emit: o }) {
1198
+ et();
1199
+ const e = u, d = R(() => {
1200
+ const c = xt();
1201
+ return c === "MYR" ? "RM" : c;
1201
1202
  });
1202
- Ct();
1203
- 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(
1204
- t.skus.filter((u) => {
1203
+ $t();
1204
+ const h = Ye(), y = Ot(e, "show"), f = Y(!1), M = Y(!1), U = Y(!1), V = Y(new Array()), _ = Y(new Array()), E = Y([]), j = nt(), q = qe(), r = tt(), t = Dt(), C = Qe(), I = Mt({}), G = R(() => new Set(
1205
+ t.skus.filter((c) => {
1205
1206
  var a;
1206
- return I[(a = u.customAttributes) == null ? void 0 : a.tag];
1207
- }).map((u) => u._id)
1208
- )), y = o, i = Q({
1207
+ return I[(a = c.customAttributes) == null ? void 0 : a.tag];
1208
+ }).map((c) => c._id)
1209
+ )), g = o, i = Y({
1209
1210
  templateItem: !0,
1210
1211
  nonTemplateItem: !0
1211
- }), $ = V(() => {
1212
+ }), $ = R(() => {
1212
1213
  var a, p;
1213
- const u = [...((a = e.draft) == null ? void 0 : a.items) ?? [], ...((p = e.draft) == null ? void 0 : p.negativeStockItems) ?? []];
1214
- return W.value.size ? u.filter((s) => W.value.has(s.sku._id)) : u;
1215
- }), H = V(() => {
1216
- const u = $.value.map((a) => a.sku);
1217
- return u.sort((a, p) => a.code.localeCompare(p.code)), u;
1218
- }), te = V(() => $.value.groupBy(
1214
+ const c = [...((a = e.draft) == null ? void 0 : a.items) ?? [], ...((p = e.draft) == null ? void 0 : p.negativeStockItems) ?? []];
1215
+ return G.value.size ? c.filter((s) => G.value.has(s.sku._id)) : c;
1216
+ }), H = R(() => {
1217
+ const c = $.value.map((a) => a.sku);
1218
+ return c.sort((a, p) => a.code.localeCompare(p.code)), c;
1219
+ }), ee = R(() => $.value.groupBy(
1219
1220
  (a) => a.sku._id,
1220
1221
  (a) => a.measurementsAmounts.filter((p) => !p.measurement.abbrev.toLocaleLowerCase().includes("inactive")).map((p) => p.measurement.id)
1221
1222
  ));
1222
- Je(ee), Ne(
1223
+ Xe(de), Ee(
1223
1224
  () => e.show,
1224
- (u) => {
1225
- u && (_e.value = ke[0], ee(), i.value = {
1225
+ (c) => {
1226
+ c && (_e.value = we[0], de(), i.value = {
1226
1227
  templateItem: !0,
1227
1228
  nonTemplateItem: !0
1228
1229
  });
1229
1230
  }
1230
1231
  );
1231
- const oe = Be(0), w = Be(100);
1232
- async function ee() {
1232
+ const se = R(() => je.value.reduce((c, a) => c + Number(a.stockTakeValue), 0)), w = Ie(0), te = Ie(100);
1233
+ async function de() {
1233
1234
  var a, p, s, l;
1234
1235
  if (!C._currentLocation) return;
1235
1236
  f.value = !0;
1236
- const u = ((a = e.draft) == null ? void 0 : a.status) === he.enum.COMPLETED;
1237
+ const c = ((a = e.draft) == null ? void 0 : a.status) === he.enum.COMPLETED;
1237
1238
  _.value = [];
1238
1239
  try {
1239
- if (await t.init(), u) {
1240
+ if (await t.init(), c) {
1240
1241
  const L = e.draft.closingAdjustmentId;
1241
1242
  if (!L) {
1242
1243
  r.open({
@@ -1248,21 +1249,21 @@ const Da = Dt(
1248
1249
  });
1249
1250
  return;
1250
1251
  }
1251
- const N = await j.readAdjustmentById(L), de = (N == null ? void 0 : N.skus) ?? [];
1252
- for (const fe of de) {
1253
- const Ae = {
1254
- id: fe.sku._id,
1255
- balance: fe.fromBalance,
1256
- costs: fe.fromCostBalances
1252
+ const N = await j.readAdjustmentById(L), me = (N == null ? void 0 : N.skus) ?? [];
1253
+ for (const pe of me) {
1254
+ const xe = {
1255
+ id: pe.sku._id,
1256
+ balance: pe.fromBalance,
1257
+ costs: pe.fromCostBalances
1257
1258
  }, T = {
1258
- id: fe.sku._id,
1259
- balance: fe.toBalance,
1260
- costs: fe.toCostBalances
1259
+ id: pe.sku._id,
1260
+ balance: pe.toBalance,
1261
+ costs: pe.toCostBalances
1261
1262
  };
1262
- R.value.push(Ae), _.value.push(T);
1263
+ V.value.push(xe), _.value.push(T);
1263
1264
  }
1264
1265
  } else
1265
- R.value = ((s = e.draft) == null ? void 0 : s.stockSnapshot) ?? [];
1266
+ V.value = ((s = e.draft) == null ? void 0 : s.stockSnapshot) ?? [];
1266
1267
  const m = /* @__PURE__ */ new Set();
1267
1268
  if ((l = e.draft) != null && l.adjustmentSnapshot)
1268
1269
  for (const L of e.draft.adjustmentSnapshot)
@@ -1283,9 +1284,9 @@ const Da = Dt(
1283
1284
  f.value = !1;
1284
1285
  }
1285
1286
  }
1286
- async function ue() {
1287
+ async function D() {
1287
1288
  var a, p;
1288
- if (!(((a = e.draft) == null ? void 0 : a.effectiveAt) ?? (e.draft ? Ee((p = e.draft) == null ? void 0 : p._id) : null))) {
1289
+ if (!(((a = e.draft) == null ? void 0 : a.effectiveAt) ?? (e.draft ? ze((p = e.draft) == null ? void 0 : p._id) : null))) {
1289
1290
  r.open({
1290
1291
  title: "Cannot refresh",
1291
1292
  message: "Effective date is not available for this draft.",
@@ -1304,7 +1305,7 @@ const Da = Dt(
1304
1305
  try {
1305
1306
  await j.recalculation.scheduleCalculateStockSnapshotAtDate(s, e.draft._id);
1306
1307
  let S = null;
1307
- for (let L = 0; L < m && (S = await G.getDraft(e.draft._id).delayed(b), S._rev === l); L++)
1308
+ for (let L = 0; L < m && (S = await q.getDraft(e.draft._id).delayed(b), S._rev === l); L++)
1308
1309
  ;
1309
1310
  if (!S || S._rev === l) {
1310
1311
  r.open({
@@ -1314,11 +1315,11 @@ const Da = Dt(
1314
1315
  }), console.error("error refreshing stock balances: there is no change in _rev");
1315
1316
  return;
1316
1317
  }
1317
- y("refresh", S), R.value = S.stockSnapshot ?? [], r.open({
1318
+ g("refresh", S), V.value = S.stockSnapshot ?? [], r.open({
1318
1319
  title: "Balance refreshed",
1319
1320
  message: "Stock balance has been recalculated.",
1320
1321
  type: "success"
1321
- }), g.value = !1;
1322
+ }), y.value = !1;
1322
1323
  } catch (S) {
1323
1324
  r.open({
1324
1325
  title: "Refresh failed",
@@ -1333,7 +1334,7 @@ const Da = Dt(
1333
1334
  }
1334
1335
  async function A() {
1335
1336
  var a, p;
1336
- if (!(((a = e.draft) == null ? void 0 : a.effectiveAt) ?? (e.draft ? Ee((p = e.draft) == null ? void 0 : p._id) : null))) {
1337
+ if (!(((a = e.draft) == null ? void 0 : a.effectiveAt) ?? (e.draft ? ze((p = e.draft) == null ? void 0 : p._id) : null))) {
1337
1338
  r.open({
1338
1339
  title: "Cannot refresh",
1339
1340
  message: "Effective date is not available for this draft.",
@@ -1343,36 +1344,36 @@ const Da = Dt(
1343
1344
  }
1344
1345
  await h.invalidateDraftCache(e.draft);
1345
1346
  }
1346
- const D = V(
1347
- () => R.value.groupBy(
1348
- (u) => u.id,
1349
- (u) => u.balance
1347
+ const J = R(
1348
+ () => V.value.groupBy(
1349
+ (c) => c.id,
1350
+ (c) => c.balance
1350
1351
  )
1351
- ), J = V(() => $.value.groupBy((u) => u.sku._id)), O = V(() => {
1352
- var u;
1353
- return (u = e.draft) != null && u.adjustmentSnapshot ? new Map(e.draft.adjustmentSnapshot.map((a) => [a.skuId, a.adjustmentsByType])) : /* @__PURE__ */ new Map();
1354
- }), re = V(() => {
1355
- var u;
1356
- return (u = e.draft) != null && u.opening ? new Map(e.draft.opening.map((a) => [a.skuId, a.balance])) : /* @__PURE__ */ new Map();
1352
+ ), O = R(() => $.value.groupBy((c) => c.sku._id)), re = R(() => {
1353
+ var c;
1354
+ return (c = e.draft) != null && c.adjustmentSnapshot ? new Map(e.draft.adjustmentSnapshot.map((a) => [a.skuId, a.adjustmentsByType])) : /* @__PURE__ */ new Map();
1355
+ }), le = R(() => {
1356
+ var c;
1357
+ return (c = e.draft) != null && c.opening ? new Map(e.draft.opening.map((a) => [a.skuId, a.balance])) : /* @__PURE__ */ new Map();
1357
1358
  });
1358
- function Y(u, a) {
1359
+ function X(c, a) {
1359
1360
  return F(
1360
1361
  be.FmTooltip,
1361
1362
  { zIndex: 51, placement: "left", class: "w-full flex justify-end" },
1362
1363
  {
1363
1364
  default() {
1364
- return u;
1365
+ return c;
1365
1366
  },
1366
1367
  content() {
1367
- return a || u;
1368
+ return a || c;
1368
1369
  }
1369
1370
  }
1370
1371
  );
1371
1372
  }
1372
- const ve = V(() => {
1373
- const u = H.value.reduce((p, s) => {
1373
+ const Te = R(() => {
1374
+ const c = H.value.reduce((p, s) => {
1374
1375
  var l, m;
1375
- return Math.max(p, ((m = (l = te.value) == null ? void 0 : l.get(s._id)) == null ? void 0 : m[0].length) ?? 0);
1376
+ return Math.max(p, ((m = (l = ee.value) == null ? void 0 : l.get(s._id)) == null ? void 0 : m[0].length) ?? 0);
1376
1377
  }, 0);
1377
1378
  return [
1378
1379
  {
@@ -1424,7 +1425,7 @@ const Da = Dt(
1424
1425
  {
1425
1426
  id: "costPerUnit",
1426
1427
  accessorKey: "costPerUnit",
1427
- header: () => Y("Cost per unit"),
1428
+ header: () => X("Cost per unit"),
1428
1429
  size: 160,
1429
1430
  cell(p) {
1430
1431
  const s = p.row.original.costPerUnit;
@@ -1466,7 +1467,7 @@ const Da = Dt(
1466
1467
  {
1467
1468
  id: "opening",
1468
1469
  accessorKey: "opening",
1469
- header: () => Y("Opening (B/F)", "The opening balance brought forward from previous period."),
1470
+ header: () => X("Opening (B/F)", "The opening balance brought forward from previous period."),
1470
1471
  size: 150,
1471
1472
  cell(p) {
1472
1473
  const s = p.row.original.opening;
@@ -1481,11 +1482,11 @@ const Da = Dt(
1481
1482
  (p) => ({
1482
1483
  id: `adjustment_${p}`,
1483
1484
  accessorFn: (s) => s.adjustmentAmounts[p] ?? { amount: 0, precision: 0 },
1484
- header: () => Y(ze(p)),
1485
+ header: () => X(He(p)),
1485
1486
  size: 150,
1486
1487
  cell(s) {
1487
1488
  const l = s.row.original.adjustmentAmounts[p] ?? { amount: 0, precision: 0 };
1488
- return F("div", { class: "text-right" }, Ze(l));
1489
+ return F("div", { class: "text-right" }, Je(l));
1489
1490
  },
1490
1491
  meta: {
1491
1492
  textAlign: "right"
@@ -1495,7 +1496,7 @@ const Da = Dt(
1495
1496
  {
1496
1497
  id: "systemBalance",
1497
1498
  accessorKey: "systemBalance",
1498
- header: () => Y("System Balance", "The system calculated balance before stock take."),
1499
+ header: () => X("System Balance", "The system calculated balance before stock take."),
1499
1500
  size: 200,
1500
1501
  meta: {
1501
1502
  textAlign: "right"
@@ -1508,7 +1509,7 @@ const Da = Dt(
1508
1509
  const s = (l = _.value.find((m) => m.id === p.id)) == null ? void 0 : l.balance;
1509
1510
  return s ? z.toFormatString({ value: s }) : p.physicalBalance;
1510
1511
  },
1511
- header: () => Y("Stock Take balance", "The physical balance recorded during stock take."),
1512
+ header: () => X("Stock Take balance", "The physical balance recorded during stock take."),
1512
1513
  cell(p) {
1513
1514
  var S;
1514
1515
  const s = p.row.original, l = z.fromNumber(s.physicalBalance);
@@ -1538,7 +1539,7 @@ const Da = Dt(
1538
1539
  {
1539
1540
  id: "adjustedAmount",
1540
1541
  accessorKey: "adjustedAmount",
1541
- header: () => Y("Variance", "The difference between Stock Take balance and System Balance."),
1542
+ header: () => X("Variance", "The difference between Stock Take balance and System Balance."),
1542
1543
  size: 200,
1543
1544
  meta: {
1544
1545
  textAlign: "right"
@@ -1547,7 +1548,7 @@ const Da = Dt(
1547
1548
  {
1548
1549
  id: "varianceInCost",
1549
1550
  accessorKey: "varianceInCost",
1550
- header: () => Y(`Variance (${d.value})`),
1551
+ header: () => X(`Variance (${d.value})`),
1551
1552
  size: 150,
1552
1553
  cell(p) {
1553
1554
  const s = p.row.original.varianceInCost;
@@ -1564,14 +1565,14 @@ const Da = Dt(
1564
1565
  {
1565
1566
  id: "adjustedDiffPercentage",
1566
1567
  accessorKey: "adjustedDiffPercentage",
1567
- header: () => Y(
1568
+ header: () => X(
1568
1569
  "Variance (%)",
1569
1570
  "Difference between Stock Take balance and System Balance in percentage."
1570
1571
  ),
1571
1572
  size: 200,
1572
1573
  cell(p) {
1573
1574
  const s = p.row.original.adjustedDiffPercentage;
1574
- if (!s) return Dn;
1575
+ if (!s) return Fn;
1575
1576
  const l = s.toFixed(2);
1576
1577
  if (l === "0.00")
1577
1578
  return F("div", { class: "flex items-center gap-4 justify-end" }, ["0.00"]);
@@ -1592,19 +1593,19 @@ const Da = Dt(
1592
1593
  {
1593
1594
  id: "stockTakeValue",
1594
1595
  accessorKey: "stockTakeValue",
1595
- header: () => Y(`Stock take value (${d.value})`),
1596
+ header: () => X(`Stock take value (${d.value})`),
1596
1597
  size: 180,
1597
1598
  cell(p) {
1598
1599
  var L;
1599
1600
  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;
1600
1601
  if (b) {
1601
- const N = z.toFormatString({ value: b.conversion }), de = `${B.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 })} ${s.baseUnit} ÷ ${N} × ${S} ${d.value}`;
1602
+ const N = z.toFormatString({ value: b.conversion }), me = `${B.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 })} ${s.baseUnit} ÷ ${N} × ${S} ${d.value}`;
1602
1603
  return F(
1603
1604
  be.FmTooltip,
1604
1605
  { zIndex: 51 },
1605
1606
  {
1606
1607
  content() {
1607
- return de;
1608
+ return me;
1608
1609
  },
1609
1610
  default() {
1610
1611
  return F(
@@ -1648,19 +1649,19 @@ const Da = Dt(
1648
1649
  {
1649
1650
  id: "systemValue",
1650
1651
  accessorKey: "systemValue",
1651
- header: () => Y(`System value (${d.value})`),
1652
+ header: () => X(`System value (${d.value})`),
1652
1653
  size: 180,
1653
1654
  cell(p) {
1654
1655
  var L;
1655
1656
  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;
1656
1657
  if (b) {
1657
- const N = z.toFormatString({ value: b.conversion }), de = `${B.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 4 })} ${s.baseUnit} ÷ ${N} × ${S} ${d.value}`;
1658
+ const N = z.toFormatString({ value: b.conversion }), me = `${B.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 4 })} ${s.baseUnit} ÷ ${N} × ${S} ${d.value}`;
1658
1659
  return F(
1659
1660
  be.FmTooltip,
1660
1661
  { zIndex: 51 },
1661
1662
  {
1662
1663
  content() {
1663
- return de;
1664
+ return me;
1664
1665
  },
1665
1666
  default() {
1666
1667
  return F(
@@ -1734,7 +1735,7 @@ const Da = Dt(
1734
1735
  }
1735
1736
  }
1736
1737
  );
1737
- let m = Array.from({ length: u }).map((b, B) => {
1738
+ let m = Array.from({ length: c }).map((b, B) => {
1738
1739
  if (!s[`measurementAmount${B}`])
1739
1740
  return null;
1740
1741
  const S = s[`measurementAmount${B}`], L = s[`measurementAbbrev${B}`];
@@ -1753,94 +1754,94 @@ const Da = Dt(
1753
1754
  }
1754
1755
  }
1755
1756
  ];
1756
- }), je = V(() => ve.value.map((u) => u.size ?? 0).reduce((u, a) => u + a)), we = Q(""), Ie = V(() => {
1757
+ }), Re = R(() => Te.value.map((c) => c.size ?? 0).reduce((c, a) => c + a)), De = Y(""), je = R(() => {
1757
1758
  var p, s;
1758
- const u = ((s = (p = e.draft) == null ? void 0 : p.negativeStockItems) == null ? void 0 : s.reduce(
1759
+ const c = ((s = (p = e.draft) == null ? void 0 : p.negativeStockItems) == null ? void 0 : s.reduce(
1759
1760
  (l, m) => (l[m.sku._id] = m, l),
1760
1761
  {}
1761
1762
  )) ?? {};
1762
1763
  return H.value.map((l) => {
1763
- var ot, st, rt, lt, it, ct, ut, dt, mt, ft, pt;
1764
- 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) ?? {
1764
+ var rt, lt, it, ct, ut, dt, mt, ft, pt, vt, gt;
1765
+ const m = (rt = O.value.get(l._id)) == null ? void 0 : rt[0], b = ((lt = J.value.get(l._id)) == null ? void 0 : lt[0]) ?? w, B = ((it = l.defaultCost) == null ? void 0 : it.costPerUnit) ?? w, S = Number(z.toFormatString({ value: B })), L = ((ut = (ct = l.defaultCost) == null ? void 0 : ct.measurement) == null ? void 0 : ut.conversion) ?? {
1765
1766
  amount: 1,
1766
1767
  precision: 0
1767
1768
  }, N = Number(
1768
1769
  z.toFormatString({ value: L })
1769
- ), de = re.value.get(l._id), fe = de ? Number(z.toFormatString({ value: de })) : 0, Ae = O.value.get(l._id), T = {};
1770
- if (E.value.forEach((se) => {
1771
- const pe = T[se] ?? { amount: 0, precision: 0 }, ye = Ae == null ? void 0 : Ae[se];
1772
- ye && (T[se] = Zt(pe, ye));
1770
+ ), me = le.value.get(l._id), pe = me ? Number(z.toFormatString({ value: me })) : 0, xe = re.value.get(l._id), T = {};
1771
+ if (E.value.forEach((oe) => {
1772
+ const ve = T[oe] ?? { amount: 0, precision: 0 }, ge = xe == null ? void 0 : xe[oe];
1773
+ ge && (T[oe] = Jt(ve, ge));
1773
1774
  }), !m) {
1774
- const se = Number(z.toFormatString({ value: b })), pe = se - 0, ye = pe * S / N, Me = 0, Pt = se * S / N;
1775
+ const oe = Number(z.toFormatString({ value: b })), ve = oe - 0, ge = ve * S / N, Le = 0, Pt = oe * S / N;
1775
1776
  return {
1776
1777
  id: l._id,
1777
1778
  code: l.code,
1778
1779
  name: l.name,
1779
- costUnit: ((ut = (ct = l.defaultCost) == null ? void 0 : ct.measurement) == null ? void 0 : ut.abbrev) ?? null,
1780
+ costUnit: ((mt = (dt = l.defaultCost) == null ? void 0 : dt.measurement) == null ? void 0 : mt.abbrev) ?? null,
1780
1781
  baseUnit: l.unit.abbrev,
1781
1782
  baseUnitAmount: 0,
1782
- systemBalance: se,
1783
+ systemBalance: oe,
1783
1784
  physicalBalance: 0,
1784
- adjustedAmount: -se,
1785
+ adjustedAmount: -oe,
1785
1786
  adjustedDiffPercentage: -100,
1786
- isTemplateItem: !u[l._id],
1787
+ isTemplateItem: !c[l._id],
1787
1788
  costPerUnit: S,
1788
- opening: fe,
1789
- varianceQty: pe,
1790
- varianceInCost: ye,
1791
- stockTakeValue: Me,
1789
+ opening: pe,
1790
+ varianceQty: ve,
1791
+ varianceInCost: ge,
1792
+ stockTakeValue: Le,
1792
1793
  systemValue: Pt,
1793
1794
  adjustmentAmounts: T
1794
1795
  };
1795
1796
  }
1796
- const ae = $t(m), le = (mt = (dt = _.value) == null ? void 0 : dt.find(
1797
- (se) => se.id === l._id
1798
- )) == null ? void 0 : mt.balance, ge = wt(
1799
- le ?? ae,
1797
+ const ae = Bt(m), ie = (pt = (ft = _.value) == null ? void 0 : ft.find(
1798
+ (oe) => oe.id === l._id
1799
+ )) == null ? void 0 : pt.balance, ye = St(
1800
+ ie ?? ae,
1800
1801
  b
1801
- ), Se = b.amount === 0 ? null : St(ge, {
1802
+ ), Fe = b.amount === 0 ? null : Ft(ye, {
1802
1803
  ...b,
1803
1804
  amount: Math.abs(b.amount)
1804
- }), 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;
1805
+ }), Me = Fe ? at(Fe, te) : null, Ge = Number(z.toFormatString({ value: b })), We = Number(z.toFormatString({ value: ae })), st = Ge - We, Ut = st * S / N, Rt = We * S / N, Vt = Ge * S / N;
1805
1806
  return {
1806
1807
  id: l._id,
1807
1808
  code: l.code,
1808
1809
  name: l.name,
1809
- costUnit: ((pt = (ft = l.defaultCost) == null ? void 0 : ft.measurement) == null ? void 0 : pt.abbrev) ?? null,
1810
+ costUnit: ((gt = (vt = l.defaultCost) == null ? void 0 : vt.measurement) == null ? void 0 : gt.abbrev) ?? null,
1810
1811
  baseUnit: l.unit.abbrev,
1811
1812
  baseUnitAmount: Number(z.toFormatString({ value: m.baseAmount })),
1812
- ...m.measurementsAmounts.filter((se) => {
1813
- var pe, ye, Me;
1814
- 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);
1815
- }).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), {}),
1816
- systemBalance: qe,
1817
- physicalBalance: Ge,
1818
- adjustedAmount: Number(z.toFormatString({ value: ge })),
1819
- adjustedDiffPercentage: Ve ? Number(
1813
+ ...m.measurementsAmounts.filter((oe) => {
1814
+ var ve, ge, Le;
1815
+ return (Le = (ge = (ve = ee.value) == null ? void 0 : ve.get(l._id)) == null ? void 0 : ge[0]) == null ? void 0 : Le.includes(oe.measurement.id);
1816
+ }).reduce((oe, ve, ge) => (oe[`measurementAbbrev${ge}`] = `(${ve.measurement.abbrev}) × ${z.toFormatString({ value: ve.measurement.conversion })}`, oe[`measurementAmount${ge}`] = Number(z.toFormatString({ value: ve.amount })), oe), {}),
1817
+ systemBalance: Ge,
1818
+ physicalBalance: We,
1819
+ adjustedAmount: Number(z.toFormatString({ value: ye })),
1820
+ adjustedDiffPercentage: Me ? Number(
1820
1821
  z.toFormatString({
1821
- value: Ft(Ve, 2)
1822
+ value: Ct(Me, 2)
1822
1823
  })
1823
1824
  ) : null,
1824
- isTemplateItem: !u[l._id],
1825
+ isTemplateItem: !c[l._id],
1825
1826
  costPerUnit: S,
1826
- opening: fe,
1827
- varianceQty: nt,
1828
- varianceInCost: It,
1829
- stockTakeValue: Ut,
1830
- systemValue: Rt,
1827
+ opening: pe,
1828
+ varianceQty: st,
1829
+ varianceInCost: Ut,
1830
+ stockTakeValue: Rt,
1831
+ systemValue: Vt,
1831
1832
  adjustmentAmounts: T
1832
1833
  };
1833
1834
  }).filter((l) => !!(l.isTemplateItem && i.value.templateItem || !l.isTemplateItem && i.value.nonTemplateItem));
1834
- }), Ue = V(() => {
1835
+ }), Ae = R(() => {
1835
1836
  var a, p, s, l, m;
1836
1837
  if (!e.draft) return [];
1837
- const u = e.draft.approvedAt ? {
1838
- action: `Approve at ${De(e.draft.approvedAt)}`,
1838
+ const c = e.draft.approvedAt ? {
1839
+ action: `Approve at ${ke(e.draft.approvedAt)}`,
1839
1840
  // actionAt: props.draft.approvedAt,
1840
1841
  actionBy: e.draft.approvedBy,
1841
1842
  remark: e.draft.approveRemark
1842
1843
  } : (a = e.draft.rejectionHistory) == null ? void 0 : a.computeFirst((b) => ({
1843
- action: `Reject at ${De(b.rejectedAt)}`,
1844
+ action: `Reject at ${ke(b.rejectedAt)}`,
1844
1845
  // actionAt: e.rejectedAt,
1845
1846
  actionBy: b.rejectedBy,
1846
1847
  remark: b.rejectRemark
@@ -1852,7 +1853,7 @@ const Da = Dt(
1852
1853
  },
1853
1854
  {
1854
1855
  label: "Created at",
1855
- value: De(e.draft.createdAt)
1856
+ value: ke(e.draft.createdAt)
1856
1857
  },
1857
1858
  {
1858
1859
  label: "Created by",
@@ -1860,7 +1861,7 @@ const Da = Dt(
1860
1861
  },
1861
1862
  {
1862
1863
  label: "Updated at",
1863
- value: De(e.draft.updatedAt)
1864
+ value: ke(e.draft.updatedAt)
1864
1865
  },
1865
1866
  {
1866
1867
  label: "Updated by",
@@ -1868,7 +1869,7 @@ const Da = Dt(
1868
1869
  },
1869
1870
  {
1870
1871
  label: "Effective at",
1871
- value: De(e.draft.effectiveAt ?? Ee((s = e.draft) == null ? void 0 : s._id))
1872
+ value: ke(e.draft.effectiveAt ?? ze((s = e.draft) == null ? void 0 : s._id))
1872
1873
  },
1873
1874
  {
1874
1875
  label: "Using template",
@@ -1878,20 +1879,20 @@ const Da = Dt(
1878
1879
  label: "Remark",
1879
1880
  value: e.draft.remark
1880
1881
  } : null,
1881
- u ? {
1882
+ c ? {
1882
1883
  label: "Last action",
1883
- value: u.action
1884
+ value: c.action
1884
1885
  } : null,
1885
- u && u.actionBy ? {
1886
+ c && c.actionBy ? {
1886
1887
  label: "Last action by",
1887
- value: (m = u.actionBy) == null ? void 0 : m.name
1888
+ value: (m = c.actionBy) == null ? void 0 : m.name
1888
1889
  } : null,
1889
- u && u.remark ? {
1890
+ c && c.remark ? {
1890
1891
  label: "Action remark",
1891
- value: u.remark
1892
+ value: c.remark
1892
1893
  } : null
1893
1894
  ].filter((b) => b).map((b) => b);
1894
- }), ke = [
1895
+ }), we = [
1895
1896
  {
1896
1897
  label: "Overview",
1897
1898
  value: "overview"
@@ -1900,32 +1901,32 @@ const Da = Dt(
1900
1901
  label: "Action history",
1901
1902
  value: "history"
1902
1903
  }
1903
- ], _e = Q(ke[0]), xe = V(() => {
1904
+ ], _e = Y(we[0]), Se = R(() => {
1904
1905
  var s, l, m;
1905
- const u = ((s = e.draft) == null ? void 0 : s.activityLogs) ?? [], a = ((l = e.draft) == null ? void 0 : l.rejectionHistory) ?? [];
1906
+ const c = ((s = e.draft) == null ? void 0 : s.activityLogs) ?? [], a = ((l = e.draft) == null ? void 0 : l.rejectionHistory) ?? [];
1906
1907
  for (const b of a)
1907
- u.find(
1908
+ c.find(
1908
1909
  (S) => `${S.action}_${S.performedAt}` == `${Z.enum.rejectDraft}_${b.rejectedAt}`
1909
- ) || u.push({
1910
+ ) || c.push({
1910
1911
  action: Z.enum.rejectDraft,
1911
1912
  performedAt: b.rejectedAt,
1912
1913
  performedBy: b.rejectedBy,
1913
1914
  remark: b.rejectRemark
1914
1915
  });
1915
- return (m = e.draft) != null && m.approvedAt && (u.find(
1916
+ return (m = e.draft) != null && m.approvedAt && (c.find(
1916
1917
  (B) => {
1917
1918
  var S;
1918
1919
  return `${B.action}_${B.performedAt}` == `${Z.enum.approveDraft}_${(S = e.draft) == null ? void 0 : S.approvedAt}`;
1919
1920
  }
1920
- ) || u.push({
1921
+ ) || c.push({
1921
1922
  action: Z.enum.approveDraft,
1922
1923
  performedAt: e.draft.approvedAt,
1923
1924
  performedBy: e.draft.approvedBy ?? { name: "Unknown", id: "unknown" },
1924
1925
  remark: e.draft.approveRemark
1925
- })), u.sort((b, B) => new Date(B.performedAt).getTime() - new Date(b.performedAt).getTime()).map(
1926
+ })), c.sort((b, B) => new Date(B.performedAt).getTime() - new Date(b.performedAt).getTime()).map(
1926
1927
  (b) => ({
1927
- header: ze(b.action),
1928
- date: De(b.performedAt),
1928
+ header: He(b.action),
1929
+ date: ke(b.performedAt),
1929
1930
  info: [
1930
1931
  {
1931
1932
  label: "Performed by",
@@ -1938,132 +1939,138 @@ const Da = Dt(
1938
1939
  ]
1939
1940
  })
1940
1941
  );
1941
- }), Re = Q(!1), Pe = Q(!1), at = V(() => {
1942
- var u;
1943
- return ((u = e.draft) == null ? void 0 : u.status) !== he.enum.DRAFT ? "Status is not draft." : null;
1942
+ }), Ve = Y(!1), Pe = Y(!1), ot = R(() => {
1943
+ var c;
1944
+ return ((c = e.draft) == null ? void 0 : c.status) !== he.enum.DRAFT ? "Status is not draft." : null;
1944
1945
  });
1945
- function jt() {
1946
+ function It() {
1946
1947
  e.draft && (Pe.value = !0, h.approveDraft(
1947
1948
  e.draft,
1948
1949
  () => {
1949
- Pe.value = !1, Re.value = !1, y("submitted");
1950
+ Pe.value = !1, Ve.value = !1, g("submitted");
1950
1951
  },
1951
1952
  () => {
1952
1953
  Pe.value = !1;
1953
1954
  }
1954
1955
  ));
1955
1956
  }
1956
- return (u, a) => {
1957
- 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");
1958
- return x(), P(ie, null, [
1959
- k(Ae, {
1957
+ return (c, a) => {
1958
+ 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"), me = K("FmSpacer"), pe = K("FmTooltip"), xe = K("FmSideSheet");
1959
+ return x(), P(ce, null, [
1960
+ k(xe, {
1960
1961
  "dismiss-away": "",
1961
1962
  "max-width": 9999,
1962
- "model-value": v(g),
1963
- "onUpdate:modelValue": a[9] || (a[9] = (T) => gt(g) ? g.value = T : null),
1963
+ "model-value": v(y),
1964
+ "onUpdate:modelValue": a[9] || (a[9] = (T) => ht(y) ? y.value = T : null),
1964
1965
  header: "Closing details"
1965
1966
  }, {
1966
- "side-sheet-footer": q(() => {
1967
- var T, ae, le, ge;
1967
+ "side-sheet-footer": Q(() => {
1968
+ var T, ae, ie, ye;
1968
1969
  return [
1969
- n("div", xn, [
1970
- ((T = e.draft) == null ? void 0 : T.status) === v(he).enum.DRAFT ? (x(), P(ie, { key: 0 }, [
1971
- at.value ? (x(), me(fe, {
1972
- key: 0,
1973
- "z-index": 51,
1974
- placement: "right"
1975
- }, {
1976
- content: q(() => [
1977
- ce(X(at.value), 1)
1978
- ]),
1979
- default: q(() => [
1970
+ n("div", Dn, [
1971
+ n("div", An, [
1972
+ ((T = e.draft) == null ? void 0 : T.status) === v(he).enum.DRAFT ? (x(), P(ce, { key: 0 }, [
1973
+ ot.value ? (x(), fe(pe, {
1974
+ key: 0,
1975
+ "z-index": 51,
1976
+ placement: "right"
1977
+ }, {
1978
+ content: Q(() => [
1979
+ ue(W(ot.value), 1)
1980
+ ]),
1981
+ default: Q(() => [
1982
+ k(m, {
1983
+ disabled: "",
1984
+ key: "approve key",
1985
+ label: "Approve"
1986
+ })
1987
+ ]),
1988
+ _: 1
1989
+ })) : (x(), fe(m, {
1990
+ key: "approve key",
1991
+ label: "Approve",
1992
+ onClick: a[5] || (a[5] = (Fe) => Ve.value = !0)
1993
+ }))
1994
+ ], 64)) : ne("", !0),
1995
+ ((ae = e.draft) == null ? void 0 : ae.status) === v(he).enum.DRAFT ? (x(), fe(m, {
1996
+ key: 1,
1997
+ label: "Reject",
1998
+ variant: "destructive",
1999
+ onClick: a[6] || (a[6] = () => e.draft && v(h).rejectDraft(e.draft, () => g("submitted")))
2000
+ })) : ne("", !0),
2001
+ k(m, {
2002
+ label: "Close",
2003
+ variant: "tertiary",
2004
+ onClick: a[7] || (a[7] = (Fe) => y.value = !1)
2005
+ }),
2006
+ (ie = e.draft) != null && ie.approvedAt && ((ye = e.draft) == null ? void 0 : ye.status) !== v(he).enum.COMPLETED ? (x(), fe(yt, { key: 2 }, {
2007
+ default: Q(() => [
1980
2008
  k(m, {
1981
- disabled: "",
1982
- key: "approve key",
1983
- label: "Approve"
1984
- })
2009
+ label: "Sync",
2010
+ loading: U.value,
2011
+ onClick: a[8] || (a[8] = () => {
2012
+ e.draft && (U.value = !0, v(h).syncDraft(e.draft, () => {
2013
+ U.value = !1, g("submitted");
2014
+ }));
2015
+ })
2016
+ }, null, 8, ["loading"])
1985
2017
  ]),
1986
2018
  _: 1
1987
- })) : (x(), me(m, {
1988
- key: "approve key",
1989
- label: "Approve",
1990
- onClick: a[5] || (a[5] = (Se) => Re.value = !0)
1991
- }))
1992
- ], 64)) : ne("", !0),
1993
- ((ae = e.draft) == null ? void 0 : ae.status) === v(he).enum.DRAFT ? (x(), me(m, {
1994
- key: 1,
1995
- label: "Reject",
1996
- variant: "destructive",
1997
- onClick: a[6] || (a[6] = () => e.draft && v(h).rejectDraft(e.draft, () => y("submitted")))
1998
- })) : ne("", !0),
1999
- (le = e.draft) != null && le.approvedAt && ((ge = e.draft) == null ? void 0 : ge.status) !== v(he).enum.COMPLETED ? (x(), me(vt, { key: 2 }, {
2000
- default: q(() => [
2001
- k(m, {
2002
- label: "Sync",
2003
- loading: U.value,
2004
- onClick: a[7] || (a[7] = () => {
2005
- e.draft && (U.value = !0, v(h).syncDraft(e.draft, () => {
2006
- U.value = !1, y("submitted");
2007
- }));
2008
- })
2009
- }, null, 8, ["loading"])
2010
- ]),
2011
- _: 1
2012
- })) : ne("", !0),
2013
- k(m, {
2014
- label: "Close",
2015
- variant: "tertiary",
2016
- onClick: a[8] || (a[8] = (Se) => g.value = !1)
2017
- })
2019
+ })) : ne("", !0)
2020
+ ]),
2021
+ n("div", wn, [
2022
+ a[19] || (a[19] = n("div", { class: "text-xs text-gray-500 uppercase tracking-wide" }, " Total stock take value ", -1)),
2023
+ n("div", Sn, W(d.value) + " " + W(se.value.toFixed(2)), 1)
2024
+ ])
2018
2025
  ])
2019
2026
  ];
2020
2027
  }),
2021
- default: q(() => [
2022
- n("div", Ea, [
2028
+ default: Q(() => [
2029
+ n("div", za, [
2023
2030
  n("div", null, [
2024
2031
  k(p, {
2025
- items: ke,
2032
+ items: we,
2026
2033
  modelValue: _e.value,
2027
2034
  "onUpdate:modelValue": a[0] || (a[0] = (T) => _e.value = T)
2028
2035
  }, null, 8, ["modelValue"])
2029
2036
  ]),
2030
- _e.value.value === "overview" ? (x(), P(ie, { key: 0 }, [
2037
+ _e.value.value === "overview" ? (x(), P(ce, { key: 0 }, [
2031
2038
  k(l, {
2032
2039
  variant: "outlined",
2033
2040
  class: "flex flex-col gap-8 px-12 py-16"
2034
2041
  }, {
2035
- default: q(() => {
2042
+ default: Q(() => {
2036
2043
  var T, ae;
2037
2044
  return [
2038
- n("div", za, [
2045
+ n("div", Ha, [
2039
2046
  a[11] || (a[11] = n("div", { class: "fm-typo-en-body-lg-600" }, "Closing summary", -1)),
2040
- n("div", Ha, [
2047
+ n("div", Oa, [
2041
2048
  n("div", {
2042
- class: $e(["fm-status-badge", v(He)(((T = u.draft) == null ? void 0 : T.status) ?? "DRAFT")])
2043
- }, X(v(ze)(((ae = u.draft) == null ? void 0 : ae.status) ?? "")), 3)
2049
+ class: Be(["fm-status-badge", v(Oe)(((T = c.draft) == null ? void 0 : T.status) ?? "DRAFT")])
2050
+ }, W(v(He)(((ae = c.draft) == null ? void 0 : ae.status) ?? "")), 3)
2044
2051
  ])
2045
2052
  ]),
2046
2053
  k(s),
2047
- n("div", Oa, [
2048
- (x(!0), P(ie, null, Ce(Ue.value, (le, ge) => (x(), P("div", {
2054
+ n("div", Ka, [
2055
+ (x(!0), P(ce, null, $e(Ae.value, (ie, ye) => (x(), P("div", {
2049
2056
  class: "flex flex-col gap-4",
2050
- key: ge
2057
+ key: ye
2051
2058
  }, [
2052
- n("div", Ka, [
2053
- n("div", Ya, X(le.label), 1)
2059
+ n("div", Ya, [
2060
+ n("div", Qa, W(ie.label), 1)
2054
2061
  ]),
2055
- n("div", Qa, X(le.value), 1)
2062
+ n("div", qa, W(ie.value), 1)
2056
2063
  ]))), 128))
2057
2064
  ])
2058
2065
  ];
2059
2066
  }),
2060
2067
  _: 1
2061
2068
  }),
2062
- n("div", qa, [
2063
- n("div", Ga, [
2069
+ n("div", Ga, [
2070
+ n("div", Wa, [
2064
2071
  a[12] || (a[12] = n("div", { class: "flex-1 fm-typo-en-title-sm-600 text-fm-color-typo-primary" }, " Closing items ", -1)),
2065
- f.value ? ne("", !0) : (x(), P("div", Wa, [
2066
- u.draft && u.draft.status !== v(he).enum.COMPLETED ? (x(), me(m, {
2072
+ f.value ? ne("", !0) : (x(), P("div", Za, [
2073
+ c.draft && c.draft.status !== v(he).enum.COMPLETED ? (x(), fe(m, {
2067
2074
  key: 0,
2068
2075
  label: "Refresh balance",
2069
2076
  "prepend-icon": "refresh",
@@ -2072,10 +2079,10 @@ const Da = Dt(
2072
2079
  "bg-color": "transparent",
2073
2080
  "border-color": "primary",
2074
2081
  loading: M.value,
2075
- onClick: ue
2082
+ onClick: D
2076
2083
  }, null, 8, ["loading"])) : ne("", !0),
2077
- k(vt, null, {
2078
- default: q(() => [
2084
+ k(yt, null, {
2085
+ default: Q(() => [
2079
2086
  k(m, {
2080
2087
  label: "Invalidate Draft Cache",
2081
2088
  "prepend-icon": "refresh",
@@ -2096,26 +2103,26 @@ const Da = Dt(
2096
2103
  "text-color": "primary",
2097
2104
  "bg-color": "transparent",
2098
2105
  "border-color": "primary",
2099
- onClick: a[1] || (a[1] = (T) => u.draft ? v(h).exportDraft(
2100
- u.draft,
2101
- R.value,
2106
+ onClick: a[1] || (a[1] = (T) => c.draft ? v(h).exportDraft(
2107
+ c.draft,
2108
+ V.value,
2102
2109
  _.value
2103
2110
  ) : null)
2104
2111
  })
2105
2112
  ]))
2106
2113
  ]),
2107
- f.value ? (x(), P("div", Za, [
2114
+ f.value ? (x(), P("div", Ja, [
2108
2115
  a[14] || (a[14] = n("div", { class: "h-80" }, null, -1)),
2109
- n("div", Ja, [
2116
+ n("div", Xa, [
2110
2117
  n("div", null, [
2111
2118
  k(b, { size: "md" })
2112
2119
  ]),
2113
2120
  a[13] || (a[13] = n("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, " Fetching info... ", -1))
2114
2121
  ]),
2115
2122
  a[15] || (a[15] = n("div", { class: "h-80" }, null, -1))
2116
- ])) : (x(), P(ie, { key: 1 }, [
2117
- n("div", Xa, [
2118
- n("div", en, [
2123
+ ])) : (x(), P(ce, { key: 1 }, [
2124
+ n("div", en, [
2125
+ n("div", tn, [
2119
2126
  k(B, {
2120
2127
  label: "Template Item(s)",
2121
2128
  selected: i.value.templateItem,
@@ -2128,61 +2135,61 @@ const Da = Dt(
2128
2135
  }, null, 8, ["selected"])
2129
2136
  ]),
2130
2137
  k(S, {
2131
- modelValue: we.value,
2132
- "onUpdate:modelValue": a[4] || (a[4] = (T) => we.value = T),
2138
+ modelValue: De.value,
2139
+ "onUpdate:modelValue": a[4] || (a[4] = (T) => De.value = T),
2133
2140
  placeholder: "Filter items"
2134
2141
  }, null, 8, ["modelValue"])
2135
2142
  ]),
2136
- v(t).skuTags.size ? (x(), P("div", tn, [
2137
- (x(!0), P(ie, null, Ce(v(t).skuTags.keys(), (T) => (x(), me(B, {
2143
+ v(t).skuTags.size ? (x(), P("div", an, [
2144
+ (x(!0), P(ce, null, $e(v(t).skuTags.keys(), (T) => (x(), fe(B, {
2138
2145
  key: `${T}`,
2139
2146
  label: `${T}`,
2140
2147
  selectable: "",
2141
2148
  selected: I[`${T}`],
2142
2149
  onClick: (ae) => I[`${T}`] = !I[`${T}`]
2143
2150
  }, {
2144
- default: q(() => [
2145
- I[`${T}`] ? (x(), me(L, {
2151
+ default: Q(() => [
2152
+ I[`${T}`] ? (x(), fe(L, {
2146
2153
  key: 0,
2147
2154
  name: "check",
2148
2155
  class: "text-white",
2149
2156
  size: "sm"
2150
2157
  })) : ne("", !0),
2151
2158
  n("span", {
2152
- class: $e([
2159
+ class: Be([
2153
2160
  "",
2154
2161
  {
2155
2162
  "text-white fm-typo-en-body-md-600": I[`${T}`],
2156
2163
  "text-fm-color-typo-primary fm-typo-en-body-md-400": !I[`${T}`]
2157
2164
  }
2158
2165
  ])
2159
- }, X(T), 3)
2166
+ }, W(T), 3)
2160
2167
  ]),
2161
2168
  _: 2
2162
2169
  }, 1032, ["label", "selected", "onClick"]))), 128))
2163
2170
  ])) : ne("", !0),
2164
- n("div", an, [
2171
+ n("div", nn, [
2165
2172
  n("div", {
2166
- style: bt({ height: "600px", minWidth: `${je.value}px` })
2173
+ style: kt({ height: "600px", minWidth: `${Re.value}px` })
2167
2174
  }, [
2168
2175
  k(N, {
2169
- "column-defs": ve.value,
2170
- "row-data": Ie.value,
2171
- "search-value": we.value
2176
+ "column-defs": Te.value,
2177
+ "row-data": je.value,
2178
+ "search-value": De.value
2172
2179
  }, null, 8, ["column-defs", "row-data", "search-value"])
2173
2180
  ], 4)
2174
2181
  ])
2175
2182
  ], 64))
2176
2183
  ])
2177
2184
  ], 64)) : ne("", !0),
2178
- _e.value.value === "history" ? (x(), P("div", nn, [
2179
- xe.value.length ? (x(), P("div", rn, [
2180
- (x(!0), P(ie, null, Ce(xe.value, (T, ae) => (x(), P(ie, { key: ae }, [
2181
- n("div", ln, [
2182
- n("div", cn, [
2183
- n("div", un, [
2185
+ _e.value.value === "history" ? (x(), P("div", on, [
2186
+ Se.value.length ? (x(), P("div", ln, [
2187
+ (x(!0), P(ce, null, $e(Se.value, (T, ae) => (x(), P(ce, { key: ae }, [
2188
+ n("div", cn, [
2189
+ n("div", un, [
2190
+ n("div", dn, [
2184
2191
  n("div", {
2185
- class: $e([
2192
+ class: Be([
2186
2193
  {
2187
2194
  "bg-fm-color-primary": ae !== 0,
2188
2195
  "bg-white": ae === 0
@@ -2192,54 +2199,54 @@ const Da = Dt(
2192
2199
  }, null, 2)
2193
2200
  ]),
2194
2201
  a[18] || (a[18] = n("div", { class: "h-24 w-24 bg-fm-color-primary rounded-full" }, null, -1)),
2195
- n("div", dn, [
2202
+ n("div", mn, [
2196
2203
  n("div", {
2197
- class: $e([
2204
+ class: Be([
2198
2205
  {
2199
- "bg-fm-color-primary": ae < xe.value.length - 1,
2200
- "bg-white": ae >= xe.value.length - 1
2206
+ "bg-fm-color-primary": ae < Se.value.length - 1,
2207
+ "bg-white": ae >= Se.value.length - 1
2201
2208
  },
2202
2209
  "w-[2px] h-full"
2203
2210
  ])
2204
2211
  }, null, 2)
2205
2212
  ])
2206
2213
  ]),
2207
- n("div", mn, [
2208
- n("div", fn, X(T.header), 1),
2209
- n("div", pn, X(T.date), 1)
2214
+ n("div", fn, [
2215
+ n("div", pn, W(T.header), 1),
2216
+ n("div", vn, W(T.date), 1)
2210
2217
  ])
2211
2218
  ]),
2212
- n("div", vn, [
2219
+ n("div", gn, [
2213
2220
  n("div", yn, [
2214
- n("div", gn, [
2221
+ n("div", bn, [
2215
2222
  n("div", {
2216
- class: $e([
2223
+ class: Be([
2217
2224
  {
2218
- "bg-fm-color-primary": ae < xe.value.length - 1,
2219
- "bg-white": ae >= xe.value.length - 1
2225
+ "bg-fm-color-primary": ae < Se.value.length - 1,
2226
+ "bg-white": ae >= Se.value.length - 1
2220
2227
  },
2221
2228
  "w-[2px] h-full"
2222
2229
  ])
2223
2230
  }, null, 2)
2224
2231
  ])
2225
2232
  ]),
2226
- n("div", bn, [
2233
+ n("div", hn, [
2227
2234
  k(l, {
2228
2235
  variant: "outlined",
2229
2236
  class: "py-12 px-16"
2230
2237
  }, {
2231
- default: q(() => [
2232
- n("div", hn, [
2233
- (x(!0), P(ie, null, Ce(T.info, (le, ge) => (x(), P("div", {
2234
- key: ge,
2238
+ default: Q(() => [
2239
+ n("div", kn, [
2240
+ (x(!0), P(ce, null, $e(T.info, (ie, ye) => (x(), P("div", {
2241
+ key: ye,
2235
2242
  class: "flex flex-col gap-4"
2236
2243
  }, [
2237
- n("div", kn, X(le == null ? void 0 : le.label), 1),
2238
- n("div", _n, [
2239
- (x(!0), P(ie, null, Ce(le == null ? void 0 : le.values, (Se, Ve) => (x(), P("div", {
2240
- key: Ve,
2244
+ n("div", _n, W(ie == null ? void 0 : ie.label), 1),
2245
+ n("div", xn, [
2246
+ (x(!0), P(ce, null, $e(ie == null ? void 0 : ie.values, (Fe, Me) => (x(), P("div", {
2247
+ key: Me,
2241
2248
  class: "fm-typo-en-body-lg-600"
2242
- }, X(Se), 1))), 128))
2249
+ }, W(Fe), 1))), 128))
2243
2250
  ])
2244
2251
  ]))), 128))
2245
2252
  ])
@@ -2249,44 +2256,44 @@ const Da = Dt(
2249
2256
  ])
2250
2257
  ])
2251
2258
  ], 64))), 128))
2252
- ])) : (x(), P("div", on, [
2253
- k(de),
2259
+ ])) : (x(), P("div", sn, [
2260
+ k(me),
2254
2261
  n("div", null, [
2255
2262
  n("img", {
2256
- src: v(na),
2263
+ src: v(oa),
2257
2264
  alt: "List is empty"
2258
- }, null, 8, sn)
2265
+ }, null, 8, rn)
2259
2266
  ]),
2260
- a[16] || (a[16] = n("div", { class: "fm-typo-en-body-lg-600" }, X("No records found"), -1)),
2261
- 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)),
2262
- k(de),
2263
- k(de)
2267
+ a[16] || (a[16] = n("div", { class: "fm-typo-en-body-lg-600" }, W("No records found"), -1)),
2268
+ a[17] || (a[17] = n("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary px-16" }, W("You can track approval and rejection history here"), -1)),
2269
+ k(me),
2270
+ k(me)
2264
2271
  ]))
2265
2272
  ])) : ne("", !0)
2266
2273
  ])
2267
2274
  ]),
2268
2275
  _: 1
2269
2276
  }, 8, ["model-value"]),
2270
- v(g) && e.draft ? (x(), me(Na, {
2277
+ v(y) && e.draft ? (x(), fe(Ea, {
2271
2278
  key: 0,
2272
- show: Re.value,
2273
- "onUpdate:show": a[10] || (a[10] = (T) => Re.value = T),
2279
+ show: Ve.value,
2280
+ "onUpdate:show": a[10] || (a[10] = (T) => Ve.value = T),
2274
2281
  refreshing: M.value,
2275
2282
  approving: Pe.value,
2276
2283
  draft: e.draft,
2277
- onRefresh: ue,
2278
- onApprove: jt
2284
+ onRefresh: D,
2285
+ onApprove: It
2279
2286
  }, null, 8, ["show", "refreshing", "approving", "draft"])) : ne("", !0)
2280
2287
  ], 64);
2281
2288
  };
2282
2289
  }
2283
- }), 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({
2290
+ }), $n = { class: "flex-1 flex flex-col gap-8" }, Bn = { class: "flex flex-col" }, Tn = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, jn = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, In = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary line-clamp-2" }, Un = { class: "fm-typo-en-body-lg-400 line-clamp-2" }, to = /* @__PURE__ */ Ue({
2284
2291
  __name: "ClosingDraftView",
2285
- setup(c) {
2286
- const { t: o } = kt(), { viewDraft: e } = Ke(), { viewClosingDraftProps: d, viewClosingDraftShow: h } = Qt(Ke()), g = Ye(), f = Da(), M = Nt(), { breakpoints: U } = Ot();
2287
- g.watchLocation(f.fetchDrafts);
2288
- const R = V(() => f.loading), _ = Q(""), E = V(() => U.value.xs || U.value.sm), j = V(() => E.value ? 10 : 20);
2289
- function G(C) {
2292
+ setup(u) {
2293
+ const { t: o } = et(), { viewDraft: e } = Ye(), { viewClosingDraftProps: d, viewClosingDraftShow: h } = qt(Ye()), y = Qe(), f = Aa(), M = Et(), { breakpoints: U } = Kt();
2294
+ y.watchLocation(f.fetchDrafts);
2295
+ const V = R(() => f.loading), _ = Y(""), E = R(() => U.value.xs || U.value.sm), j = R(() => E.value ? 10 : 20);
2296
+ function q(C) {
2290
2297
  switch (C) {
2291
2298
  case "refresh":
2292
2299
  return f.fetchDrafts();
@@ -2295,7 +2302,7 @@ const Da = Dt(
2295
2302
  function r(C) {
2296
2303
  return C;
2297
2304
  }
2298
- const t = V(() => E.value ? [
2305
+ const t = R(() => E.value ? [
2299
2306
  {
2300
2307
  label: o("inventory.common.refresh"),
2301
2308
  value: "refresh",
@@ -2309,16 +2316,16 @@ const Da = Dt(
2309
2316
  }
2310
2317
  ]);
2311
2318
  return (C, I) => {
2312
- const W = K("FmTable");
2313
- return x(), P(ie, null, [
2314
- k(Et, {
2319
+ const G = K("FmTable");
2320
+ return x(), P(ce, null, [
2321
+ k(zt, {
2315
2322
  title: v(o)("inventory.closing.draft.title"),
2316
2323
  actions: t.value,
2317
- "onClick:action": G
2324
+ "onClick:action": q
2318
2325
  }, {
2319
- default: q(() => [
2326
+ default: Q(() => [
2320
2327
  n("div", {
2321
- class: $e([
2328
+ class: Be([
2322
2329
  "flex flex-col gap-8 max-h-full",
2323
2330
  {
2324
2331
  "p-0": E.value,
@@ -2326,58 +2333,58 @@ const Da = Dt(
2326
2333
  }
2327
2334
  ])
2328
2335
  }, [
2329
- k(aa, {
2336
+ k(na, {
2330
2337
  "change-location": "",
2331
2338
  searchable: "",
2332
2339
  search: _.value,
2333
- "onUpdate:search": I[0] || (I[0] = (y) => _.value = y)
2340
+ "onUpdate:search": I[0] || (I[0] = (g) => _.value = g)
2334
2341
  }, null, 8, ["search"]),
2335
- k(W, {
2336
- style: bt(v(M).tableHeight),
2342
+ k(G, {
2343
+ style: kt(v(M).tableHeight),
2337
2344
  "column-defs": v(f).columnDefs,
2338
2345
  "row-data": v(f).drafts,
2339
2346
  "search-value": _.value,
2340
- loading: R.value,
2341
- onRowClick: I[1] || (I[1] = (y) => v(e)(y.original)),
2347
+ loading: V.value,
2348
+ onRowClick: I[1] || (I[1] = (g) => v(e)(g.original)),
2342
2349
  "page-size": j.value
2343
2350
  }, {
2344
- "list-row": q((y) => [
2345
- k(sa, {
2346
- row: y,
2351
+ "list-row": Q((g) => [
2352
+ k(ra, {
2353
+ row: g,
2347
2354
  onRowClick: (i) => v(e)(i)
2348
2355
  }, {
2349
- default: q((i) => {
2350
- var $, H, te, oe, w, ee, ue, A, D, J, O, re, Y, ve, je, we, Ie, Ue, ke, _e;
2356
+ default: Q((i) => {
2357
+ var $, H, ee, se, w, te, de, D, A, J, O, re, le, X, Te, Re, De, je, Ae, we;
2351
2358
  return [
2352
- n("div", wn, [
2353
- n("div", Sn, [
2354
- n("div", Fn, [
2355
- k(v(Le), {
2356
- render: (te = (H = ($ = i._id) == null ? void 0 : $.column) == null ? void 0 : H.columnDef) == null ? void 0 : te.cell,
2357
- props: (w = (oe = i._id) == null ? void 0 : oe.getContext) == null ? void 0 : w.call(oe)
2359
+ n("div", $n, [
2360
+ n("div", Bn, [
2361
+ n("div", Tn, [
2362
+ k(v(Ne), {
2363
+ render: (ee = (H = ($ = i._id) == null ? void 0 : $.column) == null ? void 0 : H.columnDef) == null ? void 0 : ee.cell,
2364
+ props: (w = (se = i._id) == null ? void 0 : se.getContext) == null ? void 0 : w.call(se)
2358
2365
  }, null, 8, ["render", "props"])
2359
2366
  ]),
2360
- n("div", Cn, [
2361
- k(v(Le), {
2362
- render: (A = (ue = (ee = i.name) == null ? void 0 : ee.column) == null ? void 0 : ue.columnDef) == null ? void 0 : A.cell,
2363
- props: (J = (D = i.name) == null ? void 0 : D.getContext) == null ? void 0 : J.call(D)
2367
+ n("div", jn, [
2368
+ k(v(Ne), {
2369
+ render: (D = (de = (te = i.name) == null ? void 0 : te.column) == null ? void 0 : de.columnDef) == null ? void 0 : D.cell,
2370
+ props: (J = (A = i.name) == null ? void 0 : A.getContext) == null ? void 0 : J.call(A)
2364
2371
  }, null, 8, ["render", "props"])
2365
2372
  ]),
2366
- n("div", $n, X([
2367
- ...y.original.items.slice(0, 3).map((xe) => xe.sku.name),
2368
- ...y.original.items.length >= 3 ? [`and ${y.original.items.length - 3} more items`] : []
2373
+ n("div", In, W([
2374
+ ...g.original.items.slice(0, 3).map((_e) => _e.sku.name),
2375
+ ...g.original.items.length >= 3 ? [`and ${g.original.items.length - 3} more items`] : []
2369
2376
  ].join(", ")), 1),
2370
- n("div", Bn, [
2371
- k(v(Le), {
2372
- render: (Y = (re = (O = i.ref) == null ? void 0 : O.column) == null ? void 0 : re.columnDef) == null ? void 0 : Y.cell,
2373
- props: (je = (ve = i.ref) == null ? void 0 : ve.getContext) == null ? void 0 : je.call(ve)
2377
+ n("div", Un, [
2378
+ k(v(Ne), {
2379
+ render: (le = (re = (O = i.ref) == null ? void 0 : O.column) == null ? void 0 : re.columnDef) == null ? void 0 : le.cell,
2380
+ props: (Te = (X = i.ref) == null ? void 0 : X.getContext) == null ? void 0 : Te.call(X)
2374
2381
  }, null, 8, ["render", "props"])
2375
2382
  ])
2376
2383
  ]),
2377
2384
  n("div", null, [
2378
- k(v(Le), {
2379
- render: (Ue = (Ie = (we = i.status) == null ? void 0 : we.column) == null ? void 0 : Ie.columnDef) == null ? void 0 : Ue.cell,
2380
- props: (_e = (ke = i.status) == null ? void 0 : ke.getContext) == null ? void 0 : _e.call(ke)
2385
+ k(v(Ne), {
2386
+ render: (je = (De = (Re = i.status) == null ? void 0 : Re.column) == null ? void 0 : De.columnDef) == null ? void 0 : je.cell,
2387
+ props: (we = (Ae = i.status) == null ? void 0 : Ae.getContext) == null ? void 0 : we.call(Ae)
2381
2388
  }, null, 8, ["render", "props"])
2382
2389
  ])
2383
2390
  ])
@@ -2392,12 +2399,12 @@ const Da = Dt(
2392
2399
  ]),
2393
2400
  _: 1
2394
2401
  }, 8, ["title", "actions"]),
2395
- (x(), me(Mt, { to: "body" }, [
2396
- k(An, Lt(v(d), {
2402
+ (x(), fe(Lt, { to: "body" }, [
2403
+ k(Cn, Nt(v(d), {
2397
2404
  show: v(h),
2398
- "onUpdate:show": I[2] || (I[2] = (y) => gt(h) ? h.value = y : null),
2405
+ "onUpdate:show": I[2] || (I[2] = (g) => ht(h) ? h.value = g : null),
2399
2406
  onSubmitted: I[3] || (I[3] = () => (h.value = !1, v(f).fetchDrafts())),
2400
- onRefresh: I[4] || (I[4] = (y) => v(f).updateDraftRef(y))
2407
+ onRefresh: I[4] || (I[4] = (g) => v(f).updateDraftRef(g))
2401
2408
  }), null, 16, ["show"])
2402
2409
  ]))
2403
2410
  ], 64);
@@ -2405,5 +2412,5 @@ const Da = Dt(
2405
2412
  }
2406
2413
  });
2407
2414
  export {
2408
- Zn as default
2415
+ to as default
2409
2416
  };