@feedmepos/mf-inventory-portal 1.5.9-dev.1 → 1.5.9-dev.3

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 (83) hide show
  1. package/dist/{App-CRKhmCwm.js → App-D0rEB_hc.js} +4 -4
  2. package/dist/{ApprovalView-BdvNZ3Mi.js → ApprovalView-WJ0U3xPN.js} +7 -7
  3. package/dist/{BindingsDialog-UieCgCDS.js → BindingsDialog-BDj19giE.js} +2 -2
  4. package/dist/{BindingsPicker-Bo7xvsut.js → BindingsPicker-CFCUtXom.js} +2 -2
  5. package/dist/{BindingsTable-CUaQzSBn.js → BindingsTable-B6G_a_Xh.js} +3 -3
  6. package/dist/{ClosingDraftView-QgRaat2h.js → ClosingDraftView-B0Y-eJad.js} +1004 -997
  7. package/dist/{ClosingHistoryView-C_qw6v7h.js → ClosingHistoryView-Ccn6VT7W.js} +5 -5
  8. package/dist/{ClosingTemplateView-BAsHjB3H.js → ClosingTemplateView-DFt1U6N2.js} +14 -14
  9. package/dist/{DefaultView-CaWfkTXn.js → DefaultView-Bgxhn9_C.js} +2 -2
  10. package/dist/{DeliveryOrderPrintPreview-Dv2fXveZ.js → DeliveryOrderPrintPreview-C7YjR-lR.js} +2 -2
  11. package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-BFzPTyKA.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-DlhCmX5Q.js} +2 -2
  12. package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-Y_AhN6qb.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-CQ-fk1j9.js} +2 -2
  13. package/dist/{FmMultiselectDialog-e4dbq-bB.js → FmMultiselectDialog-BcbD6L-6.js} +2 -2
  14. package/dist/{FmMultiselectDialog-DT28lMdK.js → FmMultiselectDialog-PP-y-9ll.js} +1 -1
  15. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-CO2Uom0f.js → FmUnitInput.vue_vue_type_script_setup_true_lang--OJFkfUg.js} +5 -5
  16. package/dist/{ImportView-Brvxm1EN.js → ImportView-y-sW6YJk.js} +6 -6
  17. package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-DSqbdU3A.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-CvADA35V.js} +1 -1
  18. package/dist/{IngredientGroupView-CqqD1_5X.js → IngredientGroupView-BhF7iLsu.js} +5 -5
  19. package/dist/{IngredientsView-BmOSo8oo.js → IngredientsView-CVBBu2JY.js} +15 -15
  20. package/dist/{IntegrationExplorerView-CZH3568k.js → IntegrationExplorerView-DTBg02Bz.js} +5 -5
  21. package/dist/{IntegrationView-CJv9Ps4v.js → IntegrationView-Cydrrs74.js} +13 -13
  22. package/dist/{InventoryBindingForm-BZVAC4x1.js → InventoryBindingForm-DKQa7fnN.js} +1 -1
  23. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-BPl9weMj.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-C9LQum08.js} +5 -5
  24. package/dist/{InventoryBindingSummary-C7Xl5Fd7.js → InventoryBindingSummary-DeWzvrhq.js} +1 -1
  25. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-CyjRq3A-.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-BFVNbGxB.js} +1 -1
  26. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-DIoYx-x4.js → PremiumBadge.vue_vue_type_script_setup_true_lang-kHL5pvnT.js} +1 -1
  27. package/dist/{PublishView-DHK3MPsP.js → PublishView-Bw8BGRrk.js} +3 -3
  28. package/dist/{PurchaseOrderPrintPreview-DLg01buw.js → PurchaseOrderPrintPreview-CZ55EFid.js} +2 -2
  29. package/dist/{ReceiveRequestView-B1n42VJ5.js → ReceiveRequestView-C2jIwxqP.js} +25 -25
  30. package/dist/{RecipeView-BOEfiTuN.js → RecipeView-QFEzo1zV.js} +17 -17
  31. package/dist/{SettingsView-Bqx3woVD.js → SettingsView-xzJr3rcE.js} +4 -4
  32. package/dist/{StockView-UjWpz_eL.js → StockView-D2oGxb2R.js} +19 -19
  33. package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-BxyFAK_X.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-D_N6p0fJ.js} +1 -1
  34. package/dist/{SupplierView-_zK2xohX.js → SupplierView-BtqDtx6n.js} +12 -12
  35. package/dist/{SurchargeView-BtUebfil.js → SurchargeView-CoFwSL5Q.js} +6 -6
  36. package/dist/{SystemTrailDialog.vue_vue_type_script_setup_true_lang-DF3seGmT.js → SystemTrailDialog.vue_vue_type_script_setup_true_lang-BLLGccT0.js} +2 -2
  37. package/dist/{TemplatePublishDialog.vue_vue_type_script_setup_true_lang-Bpo1u5g2.js → TemplatePublishDialog.vue_vue_type_script_setup_true_lang-zh4NhAEI.js} +1 -1
  38. package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-B_kdNBCT.js → TransferDetails.vue_vue_type_script_setup_true_lang-DgZSc_9V.js} +20 -20
  39. package/dist/{TransferTemplateView-OlHTVdCG.js → TransferTemplateView-Dl-OyvDb.js} +18 -18
  40. package/dist/{UnitCostHistoryView-BIvYaMio.js → UnitCostHistoryView-BIw918FD.js} +4 -4
  41. package/dist/{UnitDisplayControl.vue_vue_type_script_setup_true_lang-DqTis1lE.js → UnitDisplayControl.vue_vue_type_script_setup_true_lang-CtGOQmnR.js} +4 -4
  42. package/dist/{UnitView-DAtDiu3f.js → UnitView-B_dLvYDI.js} +7 -7
  43. package/dist/{WarehouseView-B3mXQpoO.js → WarehouseView-64cnOkX7.js} +5 -5
  44. package/dist/{WastageTemplateView-BOoybeCb.js → WastageTemplateView-D5VBwUYy.js} +14 -14
  45. package/dist/{app-cwueji6m.js → app-CNNLRTCj.js} +11 -11
  46. package/dist/app.js +1 -1
  47. package/dist/{closing-template-CobmAqhD.js → closing-template-BctmJnkK.js} +1 -1
  48. package/dist/{date2-D_-j6u1x.js → date2-p0u0cTaX.js} +1 -1
  49. package/dist/{dayjs.min-iDeAwg0n.js → dayjs.min-DqTkfBNo.js} +1 -1
  50. package/dist/{decimal-DcHr_uvI.js → decimal-EZa-WCtE.js} +2 -2
  51. package/dist/{defineDeepModel-BhC1n6G-.js → defineDeepModel-DFCv7__x.js} +1 -1
  52. package/dist/{duplicate-template-Y9iggS9l.js → duplicate-template-PFPE8NVL.js} +1 -1
  53. package/dist/{export-CAHG4EbP.js → export-rK4ja3U6.js} +2 -2
  54. package/dist/{feature-BhK4XmmS.js → feature-C49Rhz57.js} +2 -2
  55. package/dist/{format-time-from-id-2IFiQNTX.js → format-time-from-id-B9l_ZpVG.js} +1 -1
  56. package/dist/{format-unit-display-CTYZvXcZ.js → format-unit-display-B-rCf09w.js} +11 -11
  57. package/dist/{import-export.helper-DtWH9atw.js → import-export.helper-jBgZqyRF.js} +6 -6
  58. package/dist/{index-iGt85nBk.js → index-C8LCuoJ5.js} +1 -1
  59. package/dist/{index-dfAAA8HA.js → index-DCYuK2RB.js} +3 -3
  60. package/dist/{index-Ckhb0CMq.js → index-DO8fSF5f.js} +1 -1
  61. package/dist/{inventory-core-dart.default-R1tOn2RS.js → inventory-core-dart.default-GR9b8uej.js} +1 -1
  62. package/dist/{lz-string-DUT6tVSg.js → lz-string-lKMFi5Fy.js} +1 -1
  63. package/dist/{netsuite-BiF6Fo7G.js → netsuite-CxsdEdoM.js} +2 -2
  64. package/dist/{number-Cqsx9s88.js → number-CTtISVh1.js} +3 -3
  65. package/dist/{predefined-templates-CHExzSjx.js → predefined-templates-zjPFiMBW.js} +1 -1
  66. package/dist/{purchase-order-template-_FfLY2u1.js → purchase-order-template-BX4kVFz2.js} +1 -1
  67. package/dist/{recalculationUtils-KdVSBljW.js → recalculationUtils-D1e0w69y.js} +1 -1
  68. package/dist/{rules-DB26S6qs.js → rules-DaMQCy7O.js} +2 -2
  69. package/dist/{stock-n6h8HkNk.js → stock-SBDQxjEi.js} +1 -1
  70. package/dist/{supplier-6K9Cbfcf.js → supplier-B3bRVYvx.js} +2 -2
  71. package/dist/{surcharge-BV03ItuR.js → surcharge-CWAUQM24.js} +1 -1
  72. package/dist/{uom-rules-CzTxRiqL.js → uom-rules-BxjfqLv1.js} +1 -1
  73. package/dist/{use-ingredient-select-dialog-Bs_4jjVy.js → use-ingredient-select-dialog-DzxVCjao.js} +2 -2
  74. package/dist/{use-inventory-binding-dialog-CgtoqJ2D.js → use-inventory-binding-dialog-Dd-ZQEt_.js} +2 -2
  75. package/dist/{use-template-enabled-locations-C6fQtFF0.js → use-template-enabled-locations-BixH3gtL.js} +2 -2
  76. package/dist/{use-transfer-locations-DI48leYd.js → use-transfer-locations-DCi3j1zt.js} +2 -2
  77. package/dist/{useHrmPermission-Co1Jgyvq.js → useHrmPermission-CNOgDieE.js} +1 -1
  78. package/dist/{useNavigationMenu-JenXwvSv.js → useNavigationMenu-BNwACcDB.js} +2 -2
  79. package/dist/{useSseClient-gIA58rTS.js → useSseClient-Bj-ZNA8d.js} +3 -3
  80. package/dist/{vue-i18n-C3I0upD3.js → vue-i18n-C6mAjZMj.js} +99 -99
  81. package/dist/{xlsx-4BYDayT5.js → xlsx-BtQUuMVO.js} +398 -398
  82. package/dist/{xlsx.util-CD_xD6ZX.js → xlsx.util-CH88y-5V.js} +3 -3
  83. package/package.json +4 -4
@@ -1,80 +1,80 @@
1
- import { defineComponent as je, ref as K, computed as M, onMounted as kt, resolveComponent as Z, openBlock as w, createElementBlock as j, Fragment as ce, createTextVNode as de, createBlock as ae, withCtx as ee, createElementVNode as a, toDisplayString as H, unref as u, createVNode as $, createCommentVNode as G, h, watch as ze, renderList as he, onUnmounted as bn, reactive as Et, isRef as _t, normalizeClass as Se, normalizeStyle as Ht, createSlots as hn, Teleport as kn, mergeProps as _n } from "vue";
2
- import { u as wn, _ as xn } from "./SingleColumnLayout.vue_vue_type_script_setup_true_lang-DGlWE5I8.js";
1
+ import { defineComponent as je, ref as W, computed as M, onMounted as kt, resolveComponent as Z, openBlock as h, createElementBlock as T, Fragment as ce, createTextVNode as de, createBlock as ae, withCtx as X, createElementVNode as o, toDisplayString as H, unref as u, createVNode as $, createCommentVNode as K, h as k, watch as ze, renderList as he, onUnmounted as hn, reactive as Et, isRef as _t, normalizeClass as Se, normalizeStyle as Ht, createSlots as kn, Teleport as _n, mergeProps as wn } from "vue";
2
+ import { u as xn, _ as Dn } from "./SingleColumnLayout.vue_vue_type_script_setup_true_lang-DGlWE5I8.js";
3
3
  import { useCoreStore as Yt, useI18n as Ye } from "@feedmepos/mf-common";
4
- import { useSnackbar as Ke, useDialog as Dn, components as pe, useProxiedModel as Kt, useBreakpoints as An } from "@feedmepos/ui-library";
5
- import { m as Cn, u as We, L as oe, w as te, q as Wt, s as Be, M as _e, B as Te, c as Sn, a as wt, j as $n } from "./app-cwueji6m.js";
4
+ import { useSnackbar as Ke, useDialog as An, components as pe, useProxiedModel as Kt, useBreakpoints as Cn } from "@feedmepos/ui-library";
5
+ import { m as Sn, u as We, L as oe, w as te, q as Wt, s as Be, M as _e, B as Te, c as $n, a as wt, j as In } from "./app-CNNLRTCj.js";
6
6
  import { defineStore as qt, storeToRefs as Fn } from "pinia";
7
- import { b as st, e as Gt, f as In, a as Ce } from "./date2-D_-j6u1x.js";
8
- import { R as Bn } from "./rules-DB26S6qs.js";
9
- import { e as rt, a as ht, t as Qt, c as He, l as Zt, m as Jt, j as Xt, k as en, o as ne } from "./number-Cqsx9s88.js";
10
- import { b as Tn, d as jn } from "./xlsx.util-CD_xD6ZX.js";
11
- import { i as tn, u as nn } from "./uom-rules-CzTxRiqL.js";
12
- import { u as Un, a as Mn } from "./useSseClient-gIA58rTS.js";
13
- import { u as it } from "./stock-n6h8HkNk.js";
7
+ import { b as rt, e as Gt, f as Bn, a as Ce } from "./date2-p0u0cTaX.js";
8
+ import { R as Tn } from "./rules-DaMQCy7O.js";
9
+ import { e as lt, a as ht, t as Qt, c as He, l as Zt, m as Jt, j as Xt, k as en, o as ne } from "./number-CTtISVh1.js";
10
+ import { b as jn, d as Mn } from "./xlsx.util-CH88y-5V.js";
11
+ import { i as tn, u as nn } from "./uom-rules-BxjfqLv1.js";
12
+ import { u as Un, a as Rn } from "./useSseClient-Bj-ZNA8d.js";
13
+ import { u as ct } from "./stock-SBDQxjEi.js";
14
14
  import { D as Lt, R as Ne } from "./row-action.enum-DQ9bJ_uv.js";
15
- import { c as Rn } from "./component-kqxARxvM.js";
16
- import { f as Pn } from "./format-time-from-id-2IFiQNTX.js";
17
- import { f as Vn } from "./recalculationUtils-KdVSBljW.js";
18
- import { _ as Nn } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-Y_AhN6qb.js";
19
- import { _ as zn } from "./empty-placeholder-B0QU467o.js";
15
+ import { c as Pn } from "./component-kqxARxvM.js";
16
+ import { f as Vn } from "./format-time-from-id-B9l_ZpVG.js";
17
+ import { f as Nn } from "./recalculationUtils-D1e0w69y.js";
18
+ import { _ as zn } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-CQ-fk1j9.js";
19
+ import { _ as En } from "./empty-placeholder-B0QU467o.js";
20
20
  import { F as gt } from "./FmAdminBadge-DjnBAgyv.js";
21
- import { u as En } from "./vue-i18n-C3I0upD3.js";
22
- import { F as Ln } from "./decimal-DcHr_uvI.js";
23
- import { r as On, u as at, w as Hn } from "./xlsx-4BYDayT5.js";
24
- import { d as Yn } from "./dayjs.min-iDeAwg0n.js";
25
- import { F as Kn } from "./FmDroppableField-J0xUsOTV.js";
26
- import { _ as Wn } from "./FmConfirmationButton.vue_vue_type_script_setup_true_lang-DLrMEGFR.js";
27
- import { _ as qn, F as nt } from "./TableActionableRow.vue_vue_type_script_setup_true_lang-Ca_eYa8-.js";
28
- const qe = Cn((n, r) => {
21
+ import { u as Ln } from "./vue-i18n-C6mAjZMj.js";
22
+ import { F as On } from "./decimal-EZa-WCtE.js";
23
+ import { r as Hn, u as ot, w as Yn } from "./xlsx-BtQUuMVO.js";
24
+ import { d as Kn } from "./dayjs.min-DqTkfBNo.js";
25
+ import { F as Wn } from "./FmDroppableField-J0xUsOTV.js";
26
+ import { _ as qn } from "./FmConfirmationButton.vue_vue_type_script_setup_true_lang-DLrMEGFR.js";
27
+ import { _ as Gn, F as at } from "./TableActionableRow.vue_vue_type_script_setup_true_lang-Ca_eYa8-.js";
28
+ const qe = Sn((n, l) => {
29
29
  function t() {
30
30
  return We().currentLocation.dbName;
31
31
  }
32
32
  return {
33
33
  getDbName: t,
34
- async getDraft(o) {
35
- const g = t(), i = `${n.inventoryBackendUrl}/${g}/closing-draft/${o}`;
36
- return r.get(i);
34
+ async getDraft(s) {
35
+ const g = t(), i = `${n.inventoryBackendUrl}/${g}/closing-draft/${s}`;
36
+ return l.get(i);
37
37
  },
38
38
  async readDrafts() {
39
- const o = t(), g = `${n.inventoryBackendUrl}/${o}/closing-draft`;
40
- return r.get(g);
39
+ const s = t(), g = `${n.inventoryBackendUrl}/${s}/closing-draft`;
40
+ return l.get(g);
41
41
  },
42
- async runOperation(o) {
42
+ async runOperation(s) {
43
43
  const g = t(), i = `${n.inventoryBackendUrl}/${g}/closing-draft/run-operation`;
44
- return r.post(i, o);
44
+ return l.post(i, s);
45
45
  },
46
- async runOperationV1(o) {
46
+ async runOperationV1(s) {
47
47
  const g = t(), i = `${n.inventoryBackendUrl}/${g}/closing-draft/v1/run-operation`;
48
- return r.post(i, o);
48
+ return l.post(i, s);
49
49
  },
50
- async sync(o) {
50
+ async sync(s) {
51
51
  const g = t(), i = `${n.inventoryBackendUrl}/${g}/closing-draft/sync`;
52
- return r.post(i, o);
52
+ return l.post(i, s);
53
53
  },
54
- async cloneDraft(o) {
55
- const g = t(), i = `${n.inventoryBackendUrl}/${g}/closing-draft/${o}/clone`;
56
- return r.post(i, {});
54
+ async cloneDraft(s) {
55
+ const g = t(), i = `${n.inventoryBackendUrl}/${g}/closing-draft/${s}/clone`;
56
+ return l.post(i, {});
57
57
  },
58
- async createQuickModeDraftWithItems(o) {
58
+ async createQuickModeDraftWithItems(s) {
59
59
  const g = t(), i = `${n.inventoryBackendUrl}/${g}/closing-draft/quick-mode/new-with-items`;
60
- return r.post(i, o);
60
+ return l.post(i, s);
61
61
  },
62
- initializeStockSnapshot(o, g) {
63
- const i = t(), s = `${n.inventoryBackendUrl}/${i}/closing-draft/${encodeURIComponent(o)}/initialize-stock-snapshot`;
64
- return r.post(s, { effectiveAt: g });
62
+ initializeStockSnapshot(s, g) {
63
+ const i = t(), r = `${n.inventoryBackendUrl}/${i}/closing-draft/${encodeURIComponent(s)}/initialize-stock-snapshot`;
64
+ return l.post(r, { effectiveAt: g });
65
65
  },
66
- async getRefreshBalanceStatus(o, g) {
67
- const i = t(), s = `${n.inventoryBackendUrl}/${i}/closing-draft/${o}/refresh-balance/status?closingDraftRevision=${encodeURIComponent(g)}`;
68
- return r.get(s);
66
+ async getRefreshBalanceStatus(s, g) {
67
+ const i = t(), r = `${n.inventoryBackendUrl}/${i}/closing-draft/${s}/refresh-balance/status?closingDraftRevision=${encodeURIComponent(g)}`;
68
+ return l.get(r);
69
69
  }
70
70
  };
71
- }), Gn = { class: "fm-typo-en-body-lg-400" }, Qn = { class: "fm-typo-en-body-lg-600" }, Zn = {
71
+ }), Qn = { class: "fm-typo-en-body-lg-400" }, Zn = { class: "fm-typo-en-body-lg-600" }, Jn = {
72
72
  key: 0,
73
73
  class: "flex flex-col"
74
- }, Jn = {
74
+ }, Xn = {
75
75
  key: 0,
76
76
  class: "fm-typo-en-body-sm-400 text-fm-color-typo-error mt-4"
77
- }, Xn = { class: "flex gap-12 py-8 justify-end w-full" }, bt = /* @__PURE__ */ je({
77
+ }, ea = { class: "flex gap-12 py-8 justify-end w-full" }, bt = /* @__PURE__ */ je({
78
78
  __name: "ClosingDraftAction",
79
79
  props: {
80
80
  draft: {},
@@ -83,8 +83,8 @@ const qe = Cn((n, r) => {
83
83
  onFinished: { type: Function }
84
84
  },
85
85
  setup(n) {
86
- const r = n, t = K(), o = qe(), g = Ke(), i = K(!1), s = K(null), c = K(!1), x = M(() => {
87
- switch (r.action) {
86
+ const l = n, t = W(), s = qe(), g = Ke(), i = W(!1), r = W(null), c = W(!1), x = M(() => {
87
+ switch (l.action) {
88
88
  case oe.enum.approveDraft:
89
89
  return "Approve";
90
90
  case oe.enum.rejectDraft:
@@ -92,9 +92,9 @@ const qe = Cn((n, r) => {
92
92
  case oe.enum.markAsFailed:
93
93
  return "Mark as Failed";
94
94
  }
95
- throw new Error(`Unknown action: ${r.action}`);
95
+ throw new Error(`Unknown action: ${l.action}`);
96
96
  }), A = M(() => {
97
- switch (r.action) {
97
+ switch (l.action) {
98
98
  case oe.enum.approveDraft:
99
99
  return "primary";
100
100
  case oe.enum.rejectDraft:
@@ -102,124 +102,124 @@ const qe = Cn((n, r) => {
102
102
  case oe.enum.markAsFailed:
103
103
  return "destructive";
104
104
  }
105
- throw new Error(`Unknown action: ${r.action}`);
105
+ throw new Error(`Unknown action: ${l.action}`);
106
106
  });
107
107
  kt(() => {
108
- if (r.draft.effectiveAt)
109
- s.value = new Date(r.draft.effectiveAt);
108
+ if (l.draft.effectiveAt)
109
+ r.value = new Date(l.draft.effectiveAt);
110
110
  else {
111
- const I = new Date(r.draft.createdAt);
112
- I.setHours(23, 59, 59, 999), s.value = I;
111
+ const F = new Date(l.draft.createdAt);
112
+ F.setHours(23, 59, 59, 999), r.value = F;
113
113
  }
114
114
  c.value = !0;
115
115
  });
116
116
  const f = M({
117
117
  get() {
118
- return s.value === null ? "" : st(s.value);
118
+ return r.value === null ? "" : rt(r.value);
119
119
  },
120
- set(I) {
121
- if (I) {
122
- const k = /* @__PURE__ */ new Date(`${I} ${B.value}`);
123
- k.setSeconds(59, 999), s.value = k;
120
+ set(F) {
121
+ if (F) {
122
+ const _ = /* @__PURE__ */ new Date(`${F} ${B.value}`);
123
+ _.setSeconds(59, 999), r.value = _;
124
124
  } else
125
- s.value = null;
125
+ r.value = null;
126
126
  }
127
127
  }), B = M({
128
128
  get() {
129
- return s.value === null ? "" : Gt(s.value);
129
+ return r.value === null ? "" : Gt(r.value);
130
130
  },
131
- set(I) {
132
- if (I) {
133
- const k = /* @__PURE__ */ new Date(`${f.value} ${I}`);
134
- k.setSeconds(59, 999), s.value = k;
131
+ set(F) {
132
+ if (F) {
133
+ const _ = /* @__PURE__ */ new Date(`${f.value} ${F}`);
134
+ _.setSeconds(59, 999), r.value = _;
135
135
  } else
136
- s.value = null;
136
+ r.value = null;
137
137
  }
138
- }), N = M(() => s.value ? s.value.getTime() > (/* @__PURE__ */ new Date()).getTime() : !1);
139
- async function E(I) {
138
+ }), N = M(() => r.value ? r.value.getTime() > (/* @__PURE__ */ new Date()).getTime() : !1);
139
+ async function E(F) {
140
140
  i.value = !0;
141
141
  try {
142
- I ? await o.runOperationV1({
143
- _id: r.draft._id,
144
- _rev: r.draft._rev ?? "",
145
- action: r.action,
142
+ F ? await s.runOperationV1({
143
+ _id: l.draft._id,
144
+ _rev: l.draft._rev ?? "",
145
+ action: l.action,
146
146
  data: {
147
- effectiveAt: s.value ? s.value.toISOString() : null,
147
+ effectiveAt: r.value ? r.value.toISOString() : null,
148
148
  remark: t.value
149
149
  }
150
- }).delayed(500) : await o.runOperation({
151
- _id: r.draft._id,
152
- _rev: r.draft._rev ?? "",
153
- action: r.action,
150
+ }).delayed(500) : await s.runOperation({
151
+ _id: l.draft._id,
152
+ _rev: l.draft._rev ?? "",
153
+ action: l.action,
154
154
  data: {
155
- effectiveAt: s.value ? s.value.toISOString() : null,
155
+ effectiveAt: r.value ? r.value.toISOString() : null,
156
156
  remark: t.value
157
157
  }
158
158
  }).delayed(500), g.open({
159
159
  title: "Success",
160
160
  message: "Action submitted",
161
161
  type: "success"
162
- }), r.onFinished();
163
- } catch (k) {
162
+ }), l.onFinished();
163
+ } catch (_) {
164
164
  g.open({
165
165
  title: "Something went wrong",
166
- message: (k == null ? void 0 : k.message) ?? "Unable to submit action. Please try again",
166
+ message: (_ == null ? void 0 : _.message) ?? "Unable to submit action. Please try again",
167
167
  type: "error"
168
- }), console.error("error on submit closing draft action", k);
168
+ }), console.error("error on submit closing draft action", _);
169
169
  } finally {
170
170
  i.value = !1;
171
171
  }
172
172
  }
173
- return (I, k) => {
173
+ return (F, _) => {
174
174
  const R = Z("FmLabel"), p = Z("FmDatePicker"), v = Z("FmTimePicker"), m = Z("FmTextField"), b = Z("FmButton"), y = Z("FmForm");
175
- return c.value ? (w(), ae(y, {
175
+ return c.value ? (h(), ae(y, {
176
176
  key: 1,
177
177
  onValidationSuccess: E,
178
178
  class: "flex flex-col gap-32",
179
179
  disabled: i.value
180
180
  }, {
181
- default: ee(() => [
182
- a("div", Gn, [
183
- k[4] || (k[4] = de(" You are about to ")),
184
- a("span", Qn, H(x.value), 1),
185
- k[5] || (k[5] = de(" this draft. Please provide a remark to justify this action. "))
181
+ default: X(() => [
182
+ o("div", Qn, [
183
+ _[4] || (_[4] = de(" You are about to ")),
184
+ o("span", Zn, H(x.value), 1),
185
+ _[5] || (_[5] = de(" this draft. Please provide a remark to justify this action. "))
186
186
  ]),
187
- I.action === u(oe).enum.approveDraft ? (w(), j("div", Zn, [
187
+ F.action === u(oe).enum.approveDraft ? (h(), T("div", Jn, [
188
188
  $(R, { class: "fm-typo-en-body-lg-600" }, {
189
- default: ee(() => k[6] || (k[6] = [
189
+ default: X(() => _[6] || (_[6] = [
190
190
  de("Closing Date")
191
191
  ])),
192
192
  _: 1
193
193
  }),
194
194
  $(p, {
195
195
  modelValue: f.value,
196
- "onUpdate:modelValue": k[0] || (k[0] = (_) => f.value = _),
197
- max: u(st)(/* @__PURE__ */ new Date())
196
+ "onUpdate:modelValue": _[0] || (_[0] = (w) => f.value = w),
197
+ max: u(rt)(/* @__PURE__ */ new Date())
198
198
  }, null, 8, ["modelValue", "max"]),
199
199
  $(R, { class: "fm-typo-en-body-lg-600" }, {
200
- default: ee(() => k[7] || (k[7] = [
200
+ default: X(() => _[7] || (_[7] = [
201
201
  de("Closing Time")
202
202
  ])),
203
203
  _: 1
204
204
  }),
205
205
  $(v, {
206
206
  modelValue: B.value,
207
- "onUpdate:modelValue": k[1] || (k[1] = (_) => B.value = _)
207
+ "onUpdate:modelValue": _[1] || (_[1] = (w) => B.value = w)
208
208
  }, null, 8, ["modelValue"]),
209
- N.value ? (w(), j("div", Jn, " Cannot select future date ")) : G("", !0)
210
- ])) : G("", !0),
209
+ N.value ? (h(), T("div", Xn, " Cannot select future date ")) : K("", !0)
210
+ ])) : K("", !0),
211
211
  $(m, {
212
212
  modelValue: t.value,
213
- "onUpdate:modelValue": k[2] || (k[2] = (_) => t.value = _),
213
+ "onUpdate:modelValue": _[2] || (_[2] = (w) => t.value = w),
214
214
  label: "Remark",
215
215
  "label-mark": "required",
216
- rules: [u(Bn)()]
216
+ rules: [u(Tn)()]
217
217
  }, null, 8, ["modelValue", "rules"]),
218
- a("div", Xn, [
218
+ o("div", ea, [
219
219
  $(b, {
220
220
  label: "Cancel",
221
221
  variant: "tertiary",
222
- onClick: k[3] || (k[3] = (_) => I.onCancel())
222
+ onClick: _[3] || (_[3] = (w) => F.onCancel())
223
223
  }),
224
224
  $(b, {
225
225
  label: x.value,
@@ -230,39 +230,39 @@ const qe = Cn((n, r) => {
230
230
  ])
231
231
  ]),
232
232
  _: 1
233
- }, 8, ["disabled"])) : (w(), j(ce, { key: 0 }, [
233
+ }, 8, ["disabled"])) : (h(), T(ce, { key: 0 }, [
234
234
  de("Loading")
235
235
  ], 64));
236
236
  };
237
237
  }
238
- }), ea = He(0);
238
+ }), ta = He(0);
239
239
  function an(n) {
240
- const r = n.measurementsAmounts.groupBy((o) => o.measurement.id), t = n.sku.unit.measurements.reduce((o, g) => {
240
+ const l = n.measurementsAmounts.groupBy((s) => s.measurement.id), t = n.sku.unit.measurements.reduce((s, g) => {
241
241
  var c, x;
242
- const i = ((x = (c = r.get(g.id)) == null ? void 0 : c[0]) == null ? void 0 : x.amount) ?? ea, s = rt(g.conversion, i);
243
- return o + +ht(s);
242
+ const i = ((x = (c = l.get(g.id)) == null ? void 0 : c[0]) == null ? void 0 : x.amount) ?? ta, r = lt(g.conversion, i);
243
+ return s + +ht(r);
244
244
  }, +ht(n.baseAmount));
245
245
  return Qt(t, n.baseAmount.precision);
246
246
  }
247
- const ta = He(0), na = He(100);
248
- function aa(n, r, t, o, g, i, s, c) {
247
+ const na = He(0), aa = He(100);
248
+ function oa(n, l, t, s, g, i, r, c) {
249
249
  var z, le, P, S, ie;
250
- const x = an(n), A = o ?? x, f = Zt(A, r), B = r.amount === 0 ? null : Jt(f, {
251
- ...r,
252
- amount: Math.abs(r.amount)
253
- }), N = B ? rt(B, na) : null, E = ((z = n.sku.defaultCost) == null ? void 0 : z.costPerUnit) ?? { amount: 0, precision: 0 }, I = Number(te.toFormatString({ value: E })), k = ((P = (le = n.sku.defaultCost) == null ? void 0 : le.measurement) == null ? void 0 : P.conversion) ?? {
250
+ const x = an(n), A = s ?? x, f = Zt(A, l), B = l.amount === 0 ? null : Jt(f, {
251
+ ...l,
252
+ amount: Math.abs(l.amount)
253
+ }), N = B ? lt(B, aa) : null, E = ((z = n.sku.defaultCost) == null ? void 0 : z.costPerUnit) ?? { amount: 0, precision: 0 }, F = Number(te.toFormatString({ value: E })), _ = ((P = (le = n.sku.defaultCost) == null ? void 0 : le.measurement) == null ? void 0 : P.conversion) ?? {
254
254
  amount: 1,
255
255
  precision: 0
256
256
  }, R = Number(
257
- te.toFormatString({ value: k })
258
- ), p = g ? Number(te.toFormatString({ value: g })) : 0, v = Number(te.toFormatString({ value: r })), m = Number(te.toFormatString({ value: A })), b = m - v, y = b * I / R, _ = m * I / R, Y = v * I / R, W = {};
259
- return s && i && s.forEach((L) => {
260
- const F = { amount: 0, precision: 0 }, Q = i[L];
257
+ te.toFormatString({ value: _ })
258
+ ), p = g ? Number(te.toFormatString({ value: g })) : 0, v = Number(te.toFormatString({ value: l })), m = Number(te.toFormatString({ value: A })), b = m - v, y = b * F / R, w = m * F / R, Y = v * F / R, q = {};
259
+ return r && i && r.forEach((L) => {
260
+ const I = { amount: 0, precision: 0 }, Q = i[L];
261
261
  if (Q) {
262
- const se = Xt(F, Q);
263
- W[`adjustment_${L}`] = ht(se);
262
+ const se = Xt(I, Q);
263
+ q[`adjustment_${L}`] = ht(se);
264
264
  } else
265
- W[`adjustment_${L}`] = "0";
265
+ q[`adjustment_${L}`] = "0";
266
266
  }), {
267
267
  code: n.sku.code,
268
268
  name: n.sku.name,
@@ -270,9 +270,9 @@ function aa(n, r, t, o, g, i, s, c) {
270
270
  costUnit: ((ie = (S = n.sku.defaultCost) == null ? void 0 : S.measurement) == null ? void 0 : ie.abbrev) ?? null,
271
271
  baseUnitAmount: Number(te.toFormatString({ value: n.baseAmount })),
272
272
  ...t.reduce(
273
- (L, F, Q) => {
274
- const se = te.toFormatString({ value: F.conversion }), we = F.orphan ? " [invalid UOM]" : F.inactive ? " [NetSuite-inactive]" : "";
275
- return L[`measurementAbbrev${Q}`] = `(${F.abbrev}) × ${se}${we}`, L[`measurementAmount${Q}`] = Number(te.toFormatString({ value: F.amount })), L;
273
+ (L, I, Q) => {
274
+ const se = te.toFormatString({ value: I.conversion }), we = I.orphan ? " [invalid UOM]" : I.inactive ? " [NetSuite-inactive]" : "";
275
+ return L[`measurementAbbrev${Q}`] = `(${I.abbrev}) × ${se}${we}`, L[`measurementAmount${Q}`] = Number(te.toFormatString({ value: I.amount })), L;
276
276
  },
277
277
  {}
278
278
  ),
@@ -284,50 +284,50 @@ function aa(n, r, t, o, g, i, s, c) {
284
284
  value: en(N, 2)
285
285
  })
286
286
  ) : null,
287
- costPerUnit: I,
287
+ costPerUnit: F,
288
288
  opening: p,
289
- ...W,
289
+ ...q,
290
290
  varianceQty: b,
291
291
  varianceInCost: y,
292
- stockTakeValue: _,
292
+ stockTakeValue: w,
293
293
  systemValue: Y,
294
294
  // Include custom attribute values
295
295
  ...(c ?? []).reduce(
296
- (L, F) => {
296
+ (L, I) => {
297
297
  var se;
298
- const Q = (se = n.sku.customAttributes) == null ? void 0 : se[F];
299
- return L[`customAttr_${F}`] = Q != null ? String(Q) : null, L;
298
+ const Q = (se = n.sku.customAttributes) == null ? void 0 : se[I];
299
+ return L[`customAttr_${I}`] = Q != null ? String(Q) : null, L;
300
300
  },
301
301
  {}
302
302
  )
303
303
  };
304
304
  }
305
- function oa(n) {
306
- let r = 0;
305
+ function sa(n) {
306
+ let l = 0;
307
307
  for (const t of n.values())
308
- t.length > r && (r = t.length);
309
- return r;
308
+ t.length > l && (l = t.length);
309
+ return l;
310
310
  }
311
- function sa(n, r) {
311
+ function ra(n, l) {
312
312
  const t = /* @__PURE__ */ new Map();
313
- for (const o of n) {
314
- if (t.has(o.sku._id)) continue;
315
- const g = new Map(o.sku.unit.measurements.map((c) => [c.id, c])), i = new Map(
316
- o.measurementsAmounts.map((c) => [c.measurement.id, c.amount])
317
- ), s = [];
318
- for (const c of o.sku.unit.measurements) {
313
+ for (const s of n) {
314
+ if (t.has(s.sku._id)) continue;
315
+ const g = new Map(s.sku.unit.measurements.map((c) => [c.id, c])), i = new Map(
316
+ s.measurementsAmounts.map((c) => [c.measurement.id, c.amount])
317
+ ), r = [];
318
+ for (const c of s.sku.unit.measurements) {
319
319
  const x = i.get(c.id);
320
- x && s.push({
320
+ x && r.push({
321
321
  id: c.id,
322
322
  abbrev: c.abbrev,
323
323
  conversion: c.conversion,
324
324
  amount: x,
325
- inactive: tn(c, r),
325
+ inactive: tn(c, l),
326
326
  orphan: !1
327
327
  });
328
328
  }
329
- for (const c of o.measurementsAmounts)
330
- g.has(c.measurement.id) || s.push({
329
+ for (const c of s.measurementsAmounts)
330
+ g.has(c.measurement.id) || r.push({
331
331
  id: c.measurement.id,
332
332
  abbrev: c.measurement.abbrev,
333
333
  conversion: c.measurement.conversion,
@@ -335,12 +335,12 @@ function sa(n, r) {
335
335
  inactive: !1,
336
336
  orphan: !0
337
337
  });
338
- t.set(o.sku._id, s);
338
+ t.set(s.sku._id, r);
339
339
  }
340
340
  return t;
341
341
  }
342
- function ra(n, r = [], t = []) {
343
- const o = Wt(), g = o === "MYR" ? "RM" : o;
342
+ function la(n, l = [], t = []) {
343
+ const s = Wt(), g = s === "MYR" ? "RM" : s;
344
344
  return [
345
345
  {
346
346
  id: "code",
@@ -367,9 +367,9 @@ function ra(n, r = [], t = []) {
367
367
  name: "Opening (B/F)"
368
368
  },
369
369
  // Dynamic adjustment type columns
370
- ...r.map((s) => ({
371
- id: `adjustment_${s}`,
372
- name: Be(s)
370
+ ...l.map((r) => ({
371
+ id: `adjustment_${r}`,
372
+ name: Be(r)
373
373
  })),
374
374
  {
375
375
  id: "systemBalance",
@@ -403,7 +403,7 @@ function ra(n, r = [], t = []) {
403
403
  id: "baseUnitAmount",
404
404
  name: "Base unit amount"
405
405
  },
406
- ...Array.from({ length: n }).flatMap((s, c) => [
406
+ ...Array.from({ length: n }).flatMap((r, c) => [
407
407
  {
408
408
  id: `measurementAmount${c}`,
409
409
  name: `UOM amount ${c + 1}`
@@ -414,46 +414,46 @@ function ra(n, r = [], t = []) {
414
414
  }
415
415
  ]),
416
416
  // Dynamic custom attribute columns
417
- ...t.map((s) => ({
418
- id: `customAttr_${s}`,
419
- name: Be(s)
417
+ ...t.map((r) => ({
418
+ id: `customAttr_${r}`,
419
+ name: Be(r)
420
420
  }))
421
421
  ];
422
422
  }
423
- function la(n, r, t, o = [], g) {
423
+ function ia(n, l, t, s = [], g) {
424
424
  var re, z, le, P, S, ie, L;
425
- const i = r.groupBy(
426
- (F) => F.id,
427
- (F) => F.balance
428
- ), s = t.groupBy(
429
- (F) => F.id,
430
- (F) => F.balance
425
+ const i = l.groupBy(
426
+ (I) => I.id,
427
+ (I) => I.balance
428
+ ), r = t.groupBy(
429
+ (I) => I.id,
430
+ (I) => I.balance
431
431
  ), c = /* @__PURE__ */ new Map();
432
432
  if (n.opening)
433
- for (const F of n.opening)
434
- c.set(F.skuId, F.balance);
433
+ for (const I of n.opening)
434
+ c.set(I.skuId, I.balance);
435
435
  const x = /* @__PURE__ */ new Set(), A = /* @__PURE__ */ new Map();
436
436
  if (n.adjustmentSnapshot)
437
- for (const F of n.adjustmentSnapshot)
438
- F.adjustmentsByType && (Object.keys(F.adjustmentsByType).forEach((Q) => x.add(Q)), A.set(F.skuId, F.adjustmentsByType));
437
+ for (const I of n.adjustmentSnapshot)
438
+ I.adjustmentsByType && (Object.keys(I.adjustmentsByType).forEach((Q) => x.add(Q)), A.set(I.skuId, I.adjustmentsByType));
439
439
  const f = ["receive", "sales", "wastage"], B = [];
440
- f.forEach((F) => {
441
- x.has(F) && (B.push(F), x.delete(F));
440
+ f.forEach((I) => {
441
+ x.has(I) && (B.push(I), x.delete(I));
442
442
  });
443
- const N = Array.from(x).sort(), E = [...B, ...N], I = [...n.items, ...n.negativeStockItems ?? []], R = Yt().currentBusiness.value, p = sa(I, g), v = I.map((F) => {
443
+ const N = Array.from(x).sort(), E = [...B, ...N], F = [...n.items, ...n.negativeStockItems ?? []], R = Yt().currentBusiness.value, p = ra(F, g), v = F.map((I) => {
444
444
  var De, $e;
445
- const Q = ((De = i.get(F.sku._id)) == null ? void 0 : De[0]) ?? ta, se = p.get(F.sku._id) ?? [], we = c.get(F.sku._id), xe = A.get(F.sku._id);
446
- return aa(
447
- F,
445
+ const Q = ((De = i.get(I.sku._id)) == null ? void 0 : De[0]) ?? na, se = p.get(I.sku._id) ?? [], we = c.get(I.sku._id), xe = A.get(I.sku._id);
446
+ return oa(
447
+ I,
448
448
  Q,
449
449
  se,
450
- ($e = s.get(F.sku._id)) == null ? void 0 : $e[0],
450
+ ($e = r.get(I.sku._id)) == null ? void 0 : $e[0],
451
451
  we,
452
452
  xe,
453
453
  E,
454
- o
454
+ s
455
455
  );
456
- }), m = oa(p), b = ra(m, E, o), y = [
456
+ }), m = sa(p), b = la(m, E, s), y = [
457
457
  ["Business name:", R == null ? void 0 : R.name],
458
458
  ["Business ID:", R == null ? void 0 : R._id],
459
459
  ["Menu version", R == null ? void 0 : R.menuVersion],
@@ -475,15 +475,15 @@ function la(n, r, t, o = [], g) {
475
475
  n.approvedAt ? n.approveRemark : n.rejectionHistory ? new Date((L = n.rejectionHistory[0]) == null ? void 0 : L.rejectRemark) : ""
476
476
  ],
477
477
  [],
478
- b.map((F) => F.name),
479
- ...v.map((F) => b.map((Q) => F[Q.id]))
480
- ], _ = b.map((F) => `system:${F.id}`), Y = Tn(y, _), W = `[${R == null ? void 0 : R.name}] closing draft (${In(new Date(n.updatedAt))}).xlsx`;
481
- return jn(Y, W), W;
478
+ b.map((I) => I.name),
479
+ ...v.map((I) => b.map((Q) => I[Q.id]))
480
+ ], w = b.map((I) => `system:${I.id}`), Y = jn(y, w), q = `[${R == null ? void 0 : R.name}] closing draft (${Bn(new Date(n.updatedAt))}).xlsx`;
481
+ return Mn(Y, q), q;
482
482
  }
483
- const ia = { class: "flex flex-col" }, ca = {
483
+ const ca = { class: "flex flex-col" }, ua = {
484
484
  key: 0,
485
485
  class: "fm-typo-en-body-sm-400 text-fm-color-typo-error mt-4"
486
- }, ua = { class: "flex gap-12 py-8 justify-end w-full" }, da = /* @__PURE__ */ je({
486
+ }, da = { class: "flex gap-12 py-8 justify-end w-full" }, ma = /* @__PURE__ */ je({
487
487
  __name: "RefreshBalanceAction",
488
488
  props: {
489
489
  draft: {},
@@ -491,68 +491,68 @@ const ia = { class: "flex flex-col" }, ca = {
491
491
  onFinished: { type: Function }
492
492
  },
493
493
  setup(n) {
494
- const r = n;
495
- it();
496
- const t = K(!1), o = K(null), g = K(!1);
494
+ const l = n;
495
+ ct();
496
+ const t = W(!1), s = W(null), g = W(!1);
497
497
  kt(() => {
498
- if (r.draft.effectiveAt)
499
- o.value = new Date(r.draft.effectiveAt);
498
+ if (l.draft.effectiveAt)
499
+ s.value = new Date(l.draft.effectiveAt);
500
500
  else {
501
- const A = new Date(r.draft.createdAt);
502
- A.setHours(23, 59, 59, 999), o.value = A;
501
+ const A = new Date(l.draft.createdAt);
502
+ A.setHours(23, 59, 59, 999), s.value = A;
503
503
  }
504
504
  g.value = !0;
505
505
  });
506
506
  const i = M({
507
507
  get() {
508
- return o.value === null ? "" : st(o.value);
508
+ return s.value === null ? "" : rt(s.value);
509
509
  },
510
510
  set(A) {
511
511
  if (A) {
512
- const f = /* @__PURE__ */ new Date(`${A} ${s.value}`);
513
- f.setSeconds(59, 999), o.value = f;
512
+ const f = /* @__PURE__ */ new Date(`${A} ${r.value}`);
513
+ f.setSeconds(59, 999), s.value = f;
514
514
  } else
515
- o.value = null;
515
+ s.value = null;
516
516
  }
517
- }), s = M({
517
+ }), r = M({
518
518
  get() {
519
- return o.value === null ? "" : Gt(o.value);
519
+ return s.value === null ? "" : Gt(s.value);
520
520
  },
521
521
  set(A) {
522
522
  if (A) {
523
523
  const f = /* @__PURE__ */ new Date(`${i.value} ${A}`);
524
- f.setSeconds(59, 999), o.value = f;
524
+ f.setSeconds(59, 999), s.value = f;
525
525
  } else
526
- o.value = null;
526
+ s.value = null;
527
527
  }
528
- }), c = M(() => o.value ? o.value.getTime() > (/* @__PURE__ */ new Date()).getTime() : !1);
528
+ }), c = M(() => s.value ? s.value.getTime() > (/* @__PURE__ */ new Date()).getTime() : !1);
529
529
  async function x() {
530
- t.value = !0, r.onFinished(o.value.toISOString());
530
+ t.value = !0, l.onFinished(s.value.toISOString());
531
531
  }
532
532
  return (A, f) => {
533
- const B = Z("FmLabel"), N = Z("FmDatePicker"), E = Z("FmTimePicker"), I = Z("FmButton"), k = Z("FmForm");
534
- return g.value ? (w(), ae(k, {
533
+ const B = Z("FmLabel"), N = Z("FmDatePicker"), E = Z("FmTimePicker"), F = Z("FmButton"), _ = Z("FmForm");
534
+ return g.value ? (h(), ae(_, {
535
535
  key: 1,
536
536
  onValidationSuccess: x,
537
537
  class: "flex flex-col gap-32",
538
538
  disabled: t.value
539
539
  }, {
540
- default: ee(() => [
541
- f[5] || (f[5] = a("div", { class: "fm-typo-en-body-lg-400" }, [
542
- a("p", null, [
540
+ default: X(() => [
541
+ f[5] || (f[5] = o("div", { class: "fm-typo-en-body-lg-400" }, [
542
+ o("p", null, [
543
543
  de(" Performing "),
544
- a("span", { class: "fm-typo-en-body-lg-600" }, '"Refresh Balance"'),
544
+ o("span", { class: "fm-typo-en-body-lg-600" }, '"Refresh Balance"'),
545
545
  de(" until closing effective date and time. ")
546
546
  ]),
547
- a("p", { class: "mt-2" }, [
547
+ o("p", { class: "mt-2" }, [
548
548
  de(" Please note that this action will "),
549
- a("b", null, "update"),
549
+ o("b", null, "update"),
550
550
  de(" the effective date and time. ")
551
551
  ])
552
552
  ], -1)),
553
- a("div", ia, [
553
+ o("div", ca, [
554
554
  $(B, { class: "fm-typo-en-body-lg-600" }, {
555
- default: ee(() => f[3] || (f[3] = [
555
+ default: X(() => f[3] || (f[3] = [
556
556
  de("Closing Date")
557
557
  ])),
558
558
  _: 1
@@ -560,27 +560,27 @@ const ia = { class: "flex flex-col" }, ca = {
560
560
  $(N, {
561
561
  modelValue: i.value,
562
562
  "onUpdate:modelValue": f[0] || (f[0] = (R) => i.value = R),
563
- max: u(st)(/* @__PURE__ */ new Date())
563
+ max: u(rt)(/* @__PURE__ */ new Date())
564
564
  }, null, 8, ["modelValue", "max"]),
565
565
  $(B, { class: "fm-typo-en-body-lg-600" }, {
566
- default: ee(() => f[4] || (f[4] = [
566
+ default: X(() => f[4] || (f[4] = [
567
567
  de("Closing Time")
568
568
  ])),
569
569
  _: 1
570
570
  }),
571
571
  $(E, {
572
- modelValue: s.value,
573
- "onUpdate:modelValue": f[1] || (f[1] = (R) => s.value = R)
572
+ modelValue: r.value,
573
+ "onUpdate:modelValue": f[1] || (f[1] = (R) => r.value = R)
574
574
  }, null, 8, ["modelValue"]),
575
- c.value ? (w(), j("div", ca, " Cannot select future date ")) : G("", !0)
575
+ c.value ? (h(), T("div", ua, " Cannot select future date ")) : K("", !0)
576
576
  ]),
577
- a("div", ua, [
578
- $(I, {
577
+ o("div", da, [
578
+ $(F, {
579
579
  label: "Cancel",
580
580
  variant: "tertiary",
581
581
  onClick: f[2] || (f[2] = (R) => A.onCancel())
582
582
  }),
583
- $(I, {
583
+ $(F, {
584
584
  label: "Refresh balance",
585
585
  type: "submit",
586
586
  variant: "primary",
@@ -590,15 +590,15 @@ const ia = { class: "flex flex-col" }, ca = {
590
590
  ])
591
591
  ]),
592
592
  _: 1
593
- }, 8, ["disabled"])) : (w(), j(ce, { key: 0 }, [
593
+ }, 8, ["disabled"])) : (h(), T(ce, { key: 0 }, [
594
594
  de("Loading")
595
595
  ], 64));
596
596
  };
597
597
  }
598
- }), lt = qt(
598
+ }), it = qt(
599
599
  "closingDraftActions",
600
600
  function() {
601
- const r = Dn(), t = Ke(), o = it(), g = qe(), i = Un(), s = nn(), c = K(!1), x = K();
601
+ const l = An(), t = Ke(), s = ct(), g = qe(), i = Un(), r = nn(), c = W(!1), x = W();
602
602
  function A(b) {
603
603
  const y = {
604
604
  draft: b
@@ -606,7 +606,7 @@ const ia = { class: "flex flex-col" }, ca = {
606
606
  x.value = y, c.value = !0;
607
607
  }
608
608
  async function f(b) {
609
- var _;
609
+ var w;
610
610
  if (b.status === _e.enum.COMPLETED) {
611
611
  const Y = b.closingAdjustmentId;
612
612
  if (!Y)
@@ -617,74 +617,74 @@ const ia = { class: "flex flex-col" }, ca = {
617
617
  }), console.error("Closing draft is completed but closing document cannot be found.", {
618
618
  draftId: b._id
619
619
  }), [];
620
- const W = await o.readAdjustmentById(Y);
621
- return ((W == null ? void 0 : W.skus) ?? []).map((z) => ({
620
+ const q = await s.readAdjustmentById(Y);
621
+ return ((q == null ? void 0 : q.skus) ?? []).map((z) => ({
622
622
  id: z.sku._id,
623
623
  balance: z.fromBalance,
624
624
  costs: z.fromCostBalances
625
625
  }));
626
626
  } else
627
- return await i.readStockBalance(), ((_ = i.stockBalance) == null ? void 0 : _.skus) ?? [];
627
+ return await i.readStockBalance(), ((w = i.stockBalance) == null ? void 0 : w.skus) ?? [];
628
628
  }
629
- async function B(b, y, _, Y) {
629
+ async function B(b, y, w, Y) {
630
630
  y || (t.open({
631
631
  title: "Exporting",
632
632
  message: "Fetching data..."
633
- }), y = await f(b)), la(
633
+ }), y = await f(b)), ia(
634
634
  b,
635
635
  y,
636
- _ ?? [],
636
+ w ?? [],
637
637
  Y ?? [],
638
- s.value
638
+ r.value
639
639
  );
640
640
  }
641
- function N(b, y, _) {
642
- r.open({
641
+ function N(b, y, w) {
642
+ l.open({
643
643
  title: "Approve draft",
644
644
  contentComponent: bt,
645
645
  contentComponentProps: {
646
646
  draft: b,
647
647
  action: oe.enum.approveDraft,
648
648
  onFinished: () => {
649
- r.close(), y == null || y();
649
+ l.close(), y == null || y();
650
650
  },
651
651
  onCancel: () => {
652
- r.close();
652
+ l.close();
653
653
  }
654
654
  }
655
655
  }).onClose(() => {
656
- _ == null || _();
656
+ w == null || w();
657
657
  });
658
658
  }
659
659
  function E(b, y) {
660
- r.open({
660
+ l.open({
661
661
  title: "Reject draft",
662
662
  contentComponent: bt,
663
663
  contentComponentProps: {
664
664
  draft: b,
665
665
  action: oe.enum.rejectDraft,
666
666
  onFinished: () => {
667
- r.close(), y == null || y();
667
+ l.close(), y == null || y();
668
668
  },
669
- onCancel: () => r.close()
669
+ onCancel: () => l.close()
670
670
  }
671
671
  });
672
672
  }
673
- function I(b, y) {
674
- r.open({
673
+ function F(b, y) {
674
+ l.open({
675
675
  title: "Mark draft as failed",
676
676
  contentComponent: bt,
677
677
  contentComponentProps: {
678
678
  draft: b,
679
679
  action: oe.enum.markAsFailed,
680
680
  onFinished: () => {
681
- r.close(), y == null || y();
681
+ l.close(), y == null || y();
682
682
  },
683
- onCancel: () => r.close()
683
+ onCancel: () => l.close()
684
684
  }
685
685
  });
686
686
  }
687
- async function k(b, y) {
687
+ async function _(b, y) {
688
688
  await g.sync({
689
689
  _id: b._id,
690
690
  _rev: b._rev ?? "",
@@ -701,29 +701,29 @@ const ia = { class: "flex flex-col" }, ca = {
701
701
  function R() {
702
702
  c.value = !1;
703
703
  }
704
- async function p(b, y, _) {
705
- await r.open({
704
+ async function p(b, y, w) {
705
+ await l.open({
706
706
  title: "Refresh balance",
707
- contentComponent: da,
707
+ contentComponent: ma,
708
708
  contentComponentProps: {
709
709
  draft: b,
710
710
  onFinished: (Y) => {
711
- r.close(), _ == null || _(Y);
711
+ l.close(), w == null || w(Y);
712
712
  },
713
713
  onCancel: async () => {
714
- r.close(), y == null || y();
714
+ l.close(), y == null || y();
715
715
  }
716
716
  }
717
717
  });
718
718
  }
719
719
  async function v(b) {
720
- await r.open({
720
+ await l.open({
721
721
  title: "Invalidate closing draft cache",
722
722
  message: "It will invalidate opening and stock movement cache for this draft.",
723
723
  primaryActions: { text: "Proceed", close: !0 },
724
724
  secondaryActions: { text: "Cancel", close: !0 }
725
725
  }).onPrimary(async () => {
726
- await o.recalculation.scheduleInvalidateClosingDraftCache([b._id]), t.open({
726
+ await s.recalculation.scheduleInvalidateClosingDraftCache([b._id]), t.open({
727
727
  title: "Success",
728
728
  message: "Invalidate cache requested",
729
729
  type: "success"
@@ -740,10 +740,10 @@ const ia = { class: "flex flex-col" }, ca = {
740
740
  message: "Draft cloned successfully",
741
741
  type: "success"
742
742
  }), y == null || y();
743
- } catch (_) {
743
+ } catch (w) {
744
744
  t.open({
745
745
  title: "Error",
746
- message: (_ == null ? void 0 : _.message) || "Failed to clone draft",
746
+ message: (w == null ? void 0 : w.message) || "Failed to clone draft",
747
747
  type: "error"
748
748
  });
749
749
  }
@@ -753,8 +753,8 @@ const ia = { class: "flex flex-col" }, ca = {
753
753
  closeDraftDialog: R,
754
754
  approveDraft: N,
755
755
  rejectDraft: E,
756
- markAsFailed: I,
757
- syncDraft: k,
756
+ markAsFailed: F,
757
+ syncDraft: _,
758
758
  exportDraft: B,
759
759
  refreshBalance: p,
760
760
  cloneDraft: m,
@@ -764,7 +764,7 @@ const ia = { class: "flex flex-col" }, ca = {
764
764
  };
765
765
  }
766
766
  );
767
- function ot(n) {
767
+ function st(n) {
768
768
  switch (n) {
769
769
  case "DRAFT":
770
770
  return "fm-status-badge-draft";
@@ -779,23 +779,23 @@ function ot(n) {
779
779
  const on = qt(
780
780
  "closingDraftTable",
781
781
  function() {
782
- const { t: r } = Ye(), t = Yt(), o = lt(), g = K(new Array()), i = K(0), s = K(!1), c = We(), x = qe();
782
+ const { t: l } = Ye(), t = Yt(), s = it(), g = W(new Array()), i = W(0), r = W(!1), c = We(), x = qe();
783
783
  async function A() {
784
784
  if (g.value = [], !!c._currentLocation) {
785
- s.value = !0;
785
+ r.value = !0;
786
786
  try {
787
787
  const [p] = await Promise.all([x.readDrafts()]).delayed(1e3);
788
788
  g.value = B(p.reverse());
789
789
  } catch (p) {
790
790
  console.log("Something went wrong when fetching drafts:", p);
791
791
  } finally {
792
- s.value = !1;
792
+ r.value = !1;
793
793
  }
794
794
  }
795
795
  }
796
796
  async function f(p) {
797
797
  if (!g.value.find((v) => v._id) && c._currentLocation) {
798
- s.value = !0;
798
+ r.value = !0;
799
799
  try {
800
800
  const [v] = await Promise.all([
801
801
  x.getDraft(p),
@@ -805,12 +805,12 @@ const on = qt(
805
805
  } catch (v) {
806
806
  console.log("Something went wrong when fetching drafts:", v);
807
807
  } finally {
808
- s.value = !1;
808
+ r.value = !1;
809
809
  }
810
810
  }
811
811
  }
812
812
  function B(p) {
813
- const v = Vn(
813
+ const v = Nn(
814
814
  p.filter((m) => !!m.closingId).map((m) => ({ closingId: m.closingId, draftCreatedAt: new Date(Te(m._id)) }))
815
815
  );
816
816
  return p.map((m) => ({
@@ -827,26 +827,26 @@ const on = qt(
827
827
  }
828
828
  function E(p) {
829
829
  var b, y;
830
- const v = p.items.length + (((b = p.negativeStockItems) == null ? void 0 : b.length) ?? 0), m = (p == null ? void 0 : p.approveRemark) ?? ((y = p == null ? void 0 : p.rejectionHistory) == null ? void 0 : y.computeFirst((_) => _.rejectRemark)) ?? p.remark ?? "";
830
+ const v = p.items.length + (((b = p.negativeStockItems) == null ? void 0 : b.length) ?? 0), m = (p == null ? void 0 : p.approveRemark) ?? ((y = p == null ? void 0 : p.rejectionHistory) == null ? void 0 : y.computeFirst((w) => w.rejectRemark)) ?? p.remark ?? "";
831
831
  return { count: v, remark: m };
832
832
  }
833
- function I() {
834
- o.closeDraftDialog(), A();
833
+ function F() {
834
+ s.closeDraftDialog(), A();
835
835
  }
836
- function k(p, v) {
837
- switch (v = Sn(v), p) {
836
+ function _(p, v) {
837
+ switch (v = $n(v), p) {
838
838
  case Ne.Details:
839
- return o.viewDraft(v);
839
+ return s.viewDraft(v);
840
840
  case Ne.Export:
841
- return o.exportDraft(v);
841
+ return s.exportDraft(v);
842
842
  case oe.enum.approveDraft:
843
- return o.approveDraft(v, I);
843
+ return s.approveDraft(v, F);
844
844
  case oe.enum.rejectDraft:
845
- return o.rejectDraft(v, I);
845
+ return s.rejectDraft(v, F);
846
846
  case oe.enum.markAsFailed:
847
- return o.markAsFailed(v, I);
847
+ return s.markAsFailed(v, F);
848
848
  case Ne.Duplicate:
849
- return o.cloneDraft(v, I);
849
+ return s.cloneDraft(v, F);
850
850
  }
851
851
  }
852
852
  return {
@@ -854,9 +854,9 @@ const on = qt(
854
854
  {
855
855
  id: "_id",
856
856
  accessorKey: "_id",
857
- header: () => r("inventory.closing.table.createdAt"),
857
+ header: () => l("inventory.closing.table.createdAt"),
858
858
  cell(p) {
859
- return Pn(`${p.getValue()}`);
859
+ return Vn(`${p.getValue()}`);
860
860
  },
861
861
  sortingFn: (p, v) => new Date(Te(p.original._id)).getTime() - new Date(Te(v.original._id)).getTime(),
862
862
  enableSorting: !0
@@ -865,7 +865,7 @@ const on = qt(
865
865
  id: "closingId",
866
866
  accessorFn: (p) => p.closingIdDisplay,
867
867
  size: 160,
868
- header: () => r("inventory.closing.draft.table.id"),
868
+ header: () => l("inventory.closing.draft.table.id"),
869
869
  cell(p) {
870
870
  return p.getValue();
871
871
  },
@@ -873,7 +873,7 @@ const on = qt(
873
873
  },
874
874
  {
875
875
  accessorKey: "effectiveAt",
876
- header: () => r("inventory.closing.draft.table.effectiveAt"),
876
+ header: () => l("inventory.closing.draft.table.effectiveAt"),
877
877
  cell(p) {
878
878
  const v = p.row.original;
879
879
  let m = p.getValue();
@@ -888,72 +888,72 @@ const on = qt(
888
888
  const { count: v, remark: m } = E(p);
889
889
  return `${v} ${m}`;
890
890
  },
891
- header: () => r("inventory.closing.draft.table.description"),
891
+ header: () => l("inventory.closing.draft.table.description"),
892
892
  enableSorting: !0,
893
893
  size: 350,
894
894
  cell(p) {
895
- const { count: v, remark: m } = E(p.row.original), b = (y, _) => h("div", { class: "flex gap-4" }, [
896
- h(
895
+ const { count: v, remark: m } = E(p.row.original), b = (y, w) => k("div", { class: "flex gap-4" }, [
896
+ k(
897
897
  "span",
898
898
  { class: "fm-typo-en-body-sm-600 text-fm-color-typo-primary" },
899
899
  `${y}:`
900
900
  ),
901
- h(
901
+ k(
902
902
  "span",
903
903
  {
904
904
  class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary",
905
905
  style: "white-space: pre-wrap; word-break: break-word;"
906
906
  },
907
- `${_}`
907
+ `${w}`
908
908
  )
909
909
  ]);
910
- return h("div", { class: "flex flex-col gap-2", style: "width: 300px;" }, [
911
- b(r("inventory.closing.draft.table.items"), v),
912
- m ? b(r("inventory.closing.draft.table.remark"), m) : null
910
+ return k("div", { class: "flex flex-col gap-2", style: "width: 300px;" }, [
911
+ b(l("inventory.closing.draft.table.items"), v),
912
+ m ? b(l("inventory.closing.draft.table.remark"), m) : null
913
913
  ]);
914
914
  }
915
915
  },
916
916
  {
917
917
  id: "status",
918
918
  accessorFn: (p) => p.status,
919
- header: () => r("inventory.closing.table.status"),
919
+ header: () => l("inventory.closing.table.status"),
920
920
  enableSorting: !1,
921
921
  cell(p) {
922
922
  var Y;
923
- const v = p.row.original, m = v.status, b = new Date(v.updatedAt), y = (Y = v == null ? void 0 : v.rejectionHistory) == null ? void 0 : Y.computeFirst((W) => W.rejectedAt), _ = y ? new Date(y) : null;
924
- return m === "DRAFT" && _ ? _.getTime() > b.getTime() ? h(
923
+ const v = p.row.original, m = v.status, b = new Date(v.updatedAt), y = (Y = v == null ? void 0 : v.rejectionHistory) == null ? void 0 : Y.computeFirst((q) => q.rejectedAt), w = y ? new Date(y) : null;
924
+ return m === "DRAFT" && w ? w.getTime() > b.getTime() ? k(
925
925
  "div",
926
926
  {
927
927
  class: "flex"
928
928
  },
929
- h(
929
+ k(
930
930
  "div",
931
931
  {
932
- class: ["fm-status-badge", ot("FAILED")]
932
+ class: ["fm-status-badge", st("FAILED")]
933
933
  },
934
934
  "Rejected"
935
935
  )
936
- ) : h(
936
+ ) : k(
937
937
  "div",
938
938
  {
939
939
  class: "flex"
940
940
  },
941
- h(
941
+ k(
942
942
  "div",
943
943
  {
944
- class: ["fm-status-badge", ot("PROCESSING")]
944
+ class: ["fm-status-badge", st("PROCESSING")]
945
945
  },
946
946
  "Updated"
947
947
  )
948
- ) : h(
948
+ ) : k(
949
949
  "div",
950
950
  {
951
951
  class: "flex"
952
952
  },
953
- h(
953
+ k(
954
954
  "div",
955
955
  {
956
- class: ["fm-status-badge", ot(m)]
956
+ class: ["fm-status-badge", st(m)]
957
957
  },
958
958
  Be(m)
959
959
  )
@@ -963,19 +963,19 @@ const on = qt(
963
963
  {
964
964
  id: "updatedAt",
965
965
  accessorFn: (p) => p.updatedAt,
966
- header: () => r("inventory.closing.draft.table.lastUpdate"),
966
+ header: () => l("inventory.closing.draft.table.lastUpdate"),
967
967
  enableSorting: !0,
968
968
  size: 200,
969
969
  cell(p) {
970
970
  var m;
971
971
  const v = p.row.original;
972
- return h("div", { class: "flex flex-col" }, [
973
- h(
972
+ return k("div", { class: "flex flex-col" }, [
973
+ k(
974
974
  "div",
975
975
  { class: "fm-typo-en-body-md-600 text-fm-color-typo-primary" },
976
976
  ((m = v.updatedBy) == null ? void 0 : m.name) ?? ""
977
977
  ),
978
- h(
978
+ k(
979
979
  "div",
980
980
  { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" },
981
981
  Ce(v.updatedAt)
@@ -1006,20 +1006,20 @@ const on = qt(
1006
1006
  color: "text-fm-color-typo-error",
1007
1007
  value: oe.enum.markAsFailed
1008
1008
  }
1009
- ], _ = m && v.status !== _e.enum.DRAFT ? [
1009
+ ], w = m && v.status !== _e.enum.DRAFT ? [
1010
1010
  {
1011
1011
  translationKey: "inventory.closing.draft.cloneDraft",
1012
1012
  color: "text-fm-color-typo-primary",
1013
1013
  value: Ne.Duplicate
1014
1014
  }
1015
1015
  ] : [];
1016
- return Rn(
1016
+ return Pn(
1017
1017
  [
1018
1018
  ...b,
1019
1019
  ...v.status === _e.enum.DRAFT ? y : []
1020
1020
  ],
1021
- (W) => k(W, v),
1022
- _
1021
+ (q) => _(q, v),
1022
+ w
1023
1023
  );
1024
1024
  },
1025
1025
  enableSorting: !1,
@@ -1031,26 +1031,26 @@ const on = qt(
1031
1031
  }
1032
1032
  ],
1033
1033
  drafts: g,
1034
- loading: s,
1034
+ loading: r,
1035
1035
  tableKey: i,
1036
1036
  fetchDrafts: A,
1037
1037
  loadDraft: f,
1038
1038
  updateDraftRef: N
1039
1039
  };
1040
1040
  }
1041
- ), ma = { class: "fm-typo-en-heading-lg-600" }, fa = { class: "py-4" }, pa = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary mb-4" }, va = { key: 0 }, ya = { class: "mt-4 flex gap-4" }, ga = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary mb-4" }, ba = { key: 0 }, ha = {
1041
+ ), fa = { class: "fm-typo-en-heading-lg-600" }, pa = { class: "py-4" }, va = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary mb-4" }, ya = { key: 0 }, ga = { class: "mt-4 flex gap-4" }, ba = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary mb-4" }, ha = { key: 0 }, ka = {
1042
1042
  key: 0,
1043
1043
  class: "mb-4"
1044
- }, ka = { class: "flex flex-col gap-1 max-h-200 overflow-auto w-full" }, _a = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, wa = {
1044
+ }, _a = { class: "flex flex-col gap-1 max-h-200 overflow-auto w-full" }, wa = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, xa = {
1045
1045
  key: 0,
1046
1046
  class: "text-fm-color-system-success-300 mr-1"
1047
- }, xa = {
1047
+ }, Da = {
1048
1048
  key: 1,
1049
1049
  class: "text-fm-color-system-error-300 mr-1"
1050
- }, Da = { class: "fm-typo-en-body-md-400" }, Aa = { class: "mt-4 flex gap-4" }, Ca = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary mb-4" }, Sa = {
1050
+ }, Aa = { class: "fm-typo-en-body-md-400" }, Ca = { class: "mt-4 flex gap-4" }, Sa = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary mb-4" }, $a = {
1051
1051
  key: 0,
1052
1052
  class: "flex gap-4"
1053
- }, $a = /* @__PURE__ */ je({
1053
+ }, Ia = /* @__PURE__ */ je({
1054
1054
  __name: "ClosingDraftApprovalDialog",
1055
1055
  props: {
1056
1056
  show: { type: Boolean },
@@ -1059,19 +1059,19 @@ const on = qt(
1059
1059
  draft: {}
1060
1060
  },
1061
1061
  emits: ["update:show", "refresh", "approve"],
1062
- setup(n, { emit: r }) {
1063
- const { FmStepper: t, FmStep: o, FmDialog: g, FmButton: i } = pe, { t: s } = En(), c = wt(), x = n, A = r, f = M(
1062
+ setup(n, { emit: l }) {
1063
+ const { FmStepper: t, FmStep: s, FmDialog: g, FmButton: i } = pe, { t: r } = Ln(), c = wt(), x = n, A = l, f = M(
1064
1064
  () => {
1065
1065
  var P, S;
1066
1066
  return ((P = x.draft) == null ? void 0 : P.stockSnapshot) && ((S = x.draft) == null ? void 0 : S.stockSnapshot) !== void 0;
1067
1067
  }
1068
1068
  ), B = M(() => {
1069
- var ie, L, F;
1069
+ var ie, L, I;
1070
1070
  const P = ((ie = x.draft) == null ? void 0 : ie.items.map((Q) => ({
1071
1071
  id: Q.sku._id,
1072
1072
  code: Q.sku.code,
1073
1073
  name: Q.sku.name
1074
- }))) ?? [], S = ((F = (L = x.draft) == null ? void 0 : L.negativeStockItems) == null ? void 0 : F.map((Q) => ({
1074
+ }))) ?? [], S = ((I = (L = x.draft) == null ? void 0 : L.negativeStockItems) == null ? void 0 : I.map((Q) => ({
1075
1075
  id: Q.sku._id,
1076
1076
  code: Q.sku.code,
1077
1077
  name: Q.sku.name
@@ -1084,21 +1084,21 @@ const on = qt(
1084
1084
  () => {
1085
1085
  var P, S, ie;
1086
1086
  return (((ie = (S = (P = x.draft) == null ? void 0 : P.stockSnapshot) == null ? void 0 : S.filter((L) => L.balance.amount < 0)) == null ? void 0 : ie.map((L) => {
1087
- const F = c.skuById[L.id];
1088
- return F ? {
1089
- id: F._id,
1090
- code: F.code,
1091
- name: F.name
1087
+ const I = c.skuById[L.id];
1088
+ return I ? {
1089
+ id: I._id,
1090
+ code: I.code,
1091
+ name: I.name
1092
1092
  } : null;
1093
1093
  })) ?? []).filter((L) => L !== null);
1094
1094
  }
1095
1095
  ), E = M(() => {
1096
1096
  var P;
1097
1097
  return f.value ? ((P = N.value) == null ? void 0 : P.filter((S) => !B.value[S.id]).map((S) => S.id)) ?? [] : [];
1098
- }), I = M({
1098
+ }), F = M({
1099
1099
  get: () => x.show,
1100
1100
  set: (P) => A("update:show", P)
1101
- }), k = K(1), R = () => k.value > 1, p = () => k.value > 2, v = () => !1;
1101
+ }), _ = W(1), R = () => _.value > 1, p = () => _.value > 2, v = () => !1;
1102
1102
  function m(P) {
1103
1103
  return P === 1 ? f.value : P === 2 ? E.value.length == 0 : !1;
1104
1104
  }
@@ -1108,7 +1108,7 @@ const on = qt(
1108
1108
  for (; S <= 3 && m(S); ) S++;
1109
1109
  return S > 3 ? 3 : S;
1110
1110
  }
1111
- function _(P) {
1111
+ function w(P) {
1112
1112
  let S = P - 1;
1113
1113
  for (; S >= 1 && m(S); ) S--;
1114
1114
  return S < 1 ? 1 : S;
@@ -1119,99 +1119,99 @@ const on = qt(
1119
1119
  ze(
1120
1120
  () => x.show,
1121
1121
  (P) => {
1122
- P && (k.value = Y());
1122
+ P && (_.value = Y());
1123
1123
  }
1124
1124
  ), ze(
1125
1125
  () => f.value,
1126
1126
  (P) => {
1127
- P && k.value === 1 && (k.value = y(1));
1127
+ P && _.value === 1 && (_.value = y(1));
1128
1128
  }
1129
1129
  ), ze(
1130
1130
  () => E.value.length,
1131
1131
  (P) => {
1132
- P === 0 && k.value === 2 && (k.value = y(2));
1132
+ P === 0 && _.value === 2 && (_.value = y(2));
1133
1133
  }
1134
1134
  );
1135
- function W() {
1135
+ function q() {
1136
1136
  A("refresh");
1137
1137
  }
1138
1138
  function re() {
1139
- k.value < 3 && (k.value = y(k.value));
1139
+ _.value < 3 && (_.value = y(_.value));
1140
1140
  }
1141
1141
  function z() {
1142
- k.value > 1 && (k.value = _(k.value));
1142
+ _.value > 1 && (_.value = w(_.value));
1143
1143
  }
1144
1144
  function le() {
1145
1145
  A("approve");
1146
1146
  }
1147
1147
  return (P, S) => {
1148
1148
  const ie = Z("FmIcon");
1149
- return w(), ae(u(g), {
1150
- modelValue: I.value,
1151
- "onUpdate:modelValue": S[1] || (S[1] = (L) => I.value = L),
1149
+ return h(), ae(u(g), {
1150
+ modelValue: F.value,
1151
+ "onUpdate:modelValue": S[1] || (S[1] = (L) => F.value = L),
1152
1152
  "max-width": 600
1153
1153
  }, {
1154
- "dialog-header": ee(() => [
1155
- a("div", ma, H(u(s)("inventory.closing.approval.title")), 1)
1154
+ "dialog-header": X(() => [
1155
+ o("div", fa, H(u(r)("inventory.closing.approval.title")), 1)
1156
1156
  ]),
1157
- default: ee(() => [
1158
- a("div", fa, [
1157
+ default: X(() => [
1158
+ o("div", pa, [
1159
1159
  $(u(t), {
1160
- modelValue: k.value,
1161
- "onUpdate:modelValue": S[0] || (S[0] = (L) => k.value = L),
1160
+ modelValue: _.value,
1161
+ "onUpdate:modelValue": S[0] || (S[0] = (L) => _.value = L),
1162
1162
  orientation: "vertical"
1163
1163
  }, {
1164
- default: ee(() => [
1165
- $(u(o), {
1164
+ default: X(() => [
1165
+ $(u(s), {
1166
1166
  value: 1,
1167
- title: u(s)("inventory.closing.approval.step.generateReport.title"),
1167
+ title: u(r)("inventory.closing.approval.step.generateReport.title"),
1168
1168
  complete: R
1169
1169
  }, {
1170
- default: ee(() => [
1171
- a("div", pa, H(u(s)("inventory.closing.approval.step.generateReport.description")), 1),
1172
- k.value === 1 ? (w(), j("div", va, [
1170
+ default: X(() => [
1171
+ o("div", va, H(u(r)("inventory.closing.approval.step.generateReport.description")), 1),
1172
+ _.value === 1 ? (h(), T("div", ya, [
1173
1173
  $(u(i), {
1174
- label: u(s)("inventory.stock.stock_balance.refreshBalance"),
1174
+ label: u(r)("inventory.stock.stock_balance.refreshBalance"),
1175
1175
  "prepend-icon": "refresh",
1176
1176
  variant: "secondary",
1177
1177
  loading: P.refreshing,
1178
1178
  disabled: P.refreshing,
1179
- onClick: W
1179
+ onClick: q
1180
1180
  }, null, 8, ["label", "loading", "disabled"]),
1181
- a("div", ya, [
1181
+ o("div", ga, [
1182
1182
  $(u(i), {
1183
- label: u(s)("inventory.common.continue"),
1183
+ label: u(r)("inventory.common.continue"),
1184
1184
  disabled: !f.value,
1185
1185
  onClick: re
1186
1186
  }, null, 8, ["label", "disabled"])
1187
1187
  ])
1188
- ])) : G("", !0)
1188
+ ])) : K("", !0)
1189
1189
  ]),
1190
1190
  _: 1
1191
1191
  }, 8, ["title"]),
1192
- $(u(o), {
1192
+ $(u(s), {
1193
1193
  value: 2,
1194
- title: u(s)("inventory.closing.approval.step.negativeItems.title"),
1194
+ title: u(r)("inventory.closing.approval.step.negativeItems.title"),
1195
1195
  disabled: () => !f.value,
1196
1196
  complete: p
1197
1197
  }, {
1198
- default: ee(() => [
1199
- a("div", ga, H(N.value.length > 0 ? `${u(s)("inventory.closing.approval.step.negativeItems.resolveMessage")} [${u(s)("inventory.closing.approval.step.negativeItems.itemsHeader")} (${E.value.length})]` : u(s)("inventory.closing.approval.step.negativeItems.noItemsMessage")), 1),
1200
- k.value === 2 ? (w(), j("div", ba, [
1201
- N.value.length > 0 ? (w(), j("div", ha, [
1202
- S[2] || (S[2] = a("div", { class: "fm-typo-en-body-md-600 mb-2" }, null, -1)),
1203
- a("div", ka, [
1204
- (w(!0), j(ce, null, he(N.value, (L) => (w(), j("div", {
1198
+ default: X(() => [
1199
+ o("div", ba, H(N.value.length > 0 ? `${u(r)("inventory.closing.approval.step.negativeItems.resolveMessage")} [${u(r)("inventory.closing.approval.step.negativeItems.itemsHeader")} (${E.value.length})]` : u(r)("inventory.closing.approval.step.negativeItems.noItemsMessage")), 1),
1200
+ _.value === 2 ? (h(), T("div", ha, [
1201
+ N.value.length > 0 ? (h(), T("div", ka, [
1202
+ S[2] || (S[2] = o("div", { class: "fm-typo-en-body-md-600 mb-2" }, null, -1)),
1203
+ o("div", _a, [
1204
+ (h(!0), T(ce, null, he(N.value, (L) => (h(), T("div", {
1205
1205
  key: L.id,
1206
1206
  class: "flex gap-8"
1207
1207
  }, [
1208
- a("div", _a, [
1209
- B.value[L.id] ? (w(), j("span", wa, [
1208
+ o("div", wa, [
1209
+ B.value[L.id] ? (h(), T("span", xa, [
1210
1210
  $(ie, {
1211
1211
  name: "check_circle",
1212
1212
  size: "sm"
1213
1213
  })
1214
- ])) : (w(), j("span", xa, [
1214
+ ])) : (h(), T("span", Da, [
1215
1215
  $(ie, {
1216
1216
  name: "error",
1217
1217
  size: "sm"
@@ -1219,48 +1219,48 @@ const on = qt(
1219
1219
  ])),
1220
1220
  de(" " + H(L.code), 1)
1221
1221
  ]),
1222
- a("div", Da, H(L.name), 1)
1222
+ o("div", Aa, H(L.name), 1)
1223
1223
  ]))), 128))
1224
1224
  ])
1225
- ])) : G("", !0),
1226
- a("div", Aa, [
1225
+ ])) : K("", !0),
1226
+ o("div", Ca, [
1227
1227
  $(u(i), {
1228
- label: u(s)("inventory.common.back"),
1228
+ label: u(r)("inventory.common.back"),
1229
1229
  variant: "secondary",
1230
1230
  onClick: z
1231
1231
  }, null, 8, ["label"]),
1232
1232
  $(u(i), {
1233
- label: u(s)("inventory.common.continue"),
1233
+ label: u(r)("inventory.common.continue"),
1234
1234
  disabled: b.value,
1235
1235
  onClick: re
1236
1236
  }, null, 8, ["label", "disabled"])
1237
1237
  ])
1238
- ])) : G("", !0)
1238
+ ])) : K("", !0)
1239
1239
  ]),
1240
1240
  _: 1
1241
1241
  }, 8, ["title", "disabled"]),
1242
- $(u(o), {
1242
+ $(u(s), {
1243
1243
  value: 3,
1244
- title: u(s)("inventory.closing.approval.step.approval.title"),
1244
+ title: u(r)("inventory.closing.approval.step.approval.title"),
1245
1245
  disabled: () => b.value,
1246
1246
  complete: v
1247
1247
  }, {
1248
- default: ee(() => [
1249
- a("div", Ca, H(u(s)("inventory.closing.approval.step.approval.warning")), 1),
1250
- k.value === 3 ? (w(), j("div", Sa, [
1248
+ default: X(() => [
1249
+ o("div", Sa, H(u(r)("inventory.closing.approval.step.approval.warning")), 1),
1250
+ _.value === 3 ? (h(), T("div", $a, [
1251
1251
  $(u(i), {
1252
- label: u(s)("inventory.common.back"),
1252
+ label: u(r)("inventory.common.back"),
1253
1253
  variant: "secondary",
1254
1254
  onClick: z
1255
1255
  }, null, 8, ["label"]),
1256
1256
  $(u(i), {
1257
- label: u(s)("inventory.common.approve"),
1257
+ label: u(r)("inventory.common.approve"),
1258
1258
  variant: "destructive",
1259
1259
  disabled: b.value,
1260
1260
  loading: P.approving,
1261
1261
  onClick: le
1262
1262
  }, null, 8, ["label", "disabled", "loading"])
1263
- ])) : G("", !0)
1263
+ ])) : K("", !0)
1264
1264
  ]),
1265
1265
  _: 1
1266
1266
  }, 8, ["title", "disabled"])
@@ -1275,7 +1275,7 @@ const on = qt(
1275
1275
  }
1276
1276
  });
1277
1277
  function Fa(n) {
1278
- const r = qe(), t = Mn(), o = Ke(), { t: g } = Ye(), i = K(!1), s = K(null);
1278
+ const l = qe(), t = Rn(), s = Ke(), { t: g } = Ye(), i = W(!1), r = W(null);
1279
1279
  let c = !1, x = null, A = !1, f = !1;
1280
1280
  function B() {
1281
1281
  R();
@@ -1287,14 +1287,14 @@ function Fa(n) {
1287
1287
  type: "closing-draft",
1288
1288
  params: {
1289
1289
  draftId: m,
1290
- locationId: r.getDbName(),
1290
+ locationId: l.getDbName(),
1291
1291
  closingDraftRevision: b
1292
1292
  }
1293
- }, { unsubscribe: _, initialState: Y } = t.subscribe(y, E);
1294
- x = _, Y.then((W) => {
1295
- W != null && W.initialState && E(W.initialState);
1296
- }).catch((W) => {
1297
- console.error("Failed to fetch initial state", W);
1293
+ }, { unsubscribe: w, initialState: Y } = t.subscribe(y, E);
1294
+ x = w, Y.then((q) => {
1295
+ q != null && q.initialState && E(q.initialState);
1296
+ }).catch((q) => {
1297
+ console.error("Failed to fetch initial state", q);
1298
1298
  });
1299
1299
  }
1300
1300
  function N() {
@@ -1303,11 +1303,11 @@ function Fa(n) {
1303
1303
  async function E(m) {
1304
1304
  var b;
1305
1305
  if (c || !m) {
1306
- s.value = m, i.value = !1;
1306
+ r.value = m, i.value = !1;
1307
1307
  return;
1308
1308
  }
1309
1309
  if (!(m.closingDraftId && m.closingDraftId !== n.closingDraftId.value)) {
1310
- if (s.value = m, m.message === "processing" || !m.completedAt && !m.message) {
1310
+ if (r.value = m, m.message === "processing" || !m.completedAt && !m.message) {
1311
1311
  A = !0, i.value = !0;
1312
1312
  return;
1313
1313
  }
@@ -1316,40 +1316,40 @@ function Fa(n) {
1316
1316
  i.value = !1;
1317
1317
  return;
1318
1318
  }
1319
- A = !1, await I();
1319
+ A = !1, await F();
1320
1320
  return;
1321
1321
  }
1322
- A = !1, i.value = !1, o.open({
1322
+ A = !1, i.value = !1, s.open({
1323
1323
  title: g("inventory.common.refreshFailed"),
1324
1324
  message: g("inventory.stock.stock_balance.refreshBalanceError"),
1325
1325
  type: "error"
1326
1326
  }), (b = n.onError) == null || b.call(n, m.message ?? "Unknown error");
1327
1327
  }
1328
1328
  }
1329
- async function I() {
1329
+ async function F() {
1330
1330
  const m = n.closingDraftId.value;
1331
1331
  if (!m) {
1332
1332
  i.value = !1;
1333
1333
  return;
1334
1334
  }
1335
1335
  try {
1336
- const b = await r.getDraft(m);
1337
- i.value = !1, n.onCompleted(b), o.open({
1336
+ const b = await l.getDraft(m);
1337
+ i.value = !1, n.onCompleted(b), s.open({
1338
1338
  title: "Balance refreshed",
1339
1339
  message: "Stock balance has been recalculated.",
1340
1340
  type: "success"
1341
1341
  });
1342
1342
  } catch {
1343
- i.value = !1, o.open({
1343
+ i.value = !1, s.open({
1344
1344
  title: "Refresh completed",
1345
1345
  message: "Balance was refreshed but failed to load updated data. Please reload.",
1346
1346
  type: "warning"
1347
1347
  });
1348
1348
  }
1349
1349
  }
1350
- async function k(m) {
1350
+ async function _(m) {
1351
1351
  if (!(!n.closingDraftId.value || i.value || A)) {
1352
- i.value = !0, A = !0, s.value = {
1352
+ i.value = !0, A = !0, r.value = {
1353
1353
  requestId: "",
1354
1354
  closingDraftId: n.closingDraftId.value,
1355
1355
  closingDraftRevision: n.currentRev.value ?? "",
@@ -1357,9 +1357,9 @@ function Fa(n) {
1357
1357
  startedAt: (/* @__PURE__ */ new Date()).toISOString()
1358
1358
  };
1359
1359
  try {
1360
- await r.initializeStockSnapshot(n.closingDraftId.value, m);
1360
+ await l.initializeStockSnapshot(n.closingDraftId.value, m);
1361
1361
  } catch (b) {
1362
- A = !1, i.value = !1, o.open({
1362
+ A = !1, i.value = !1, s.open({
1363
1363
  title: g("inventory.common.refreshFailed"),
1364
1364
  message: g("inventory.stock.stock_balance.refreshBalanceError"),
1365
1365
  type: "error"
@@ -1371,157 +1371,157 @@ function Fa(n) {
1371
1371
  c = !1, x && (x(), x = null);
1372
1372
  }
1373
1373
  function p() {
1374
- R(), c = !0, i.value = !1, A = !1, s.value = null;
1374
+ R(), c = !0, i.value = !1, A = !1, r.value = null;
1375
1375
  }
1376
1376
  function v() {
1377
1377
  f = !1, p();
1378
1378
  }
1379
1379
  return ze(
1380
1380
  [n.closingDraftId, n.currentRev],
1381
- ([m, b], [y, _]) => {
1382
- f && (m === y && b === _ || B());
1381
+ ([m, b], [y, w]) => {
1382
+ f && (m === y && b === w || B());
1383
1383
  }
1384
- ), bn(() => {
1384
+ ), hn(() => {
1385
1385
  v();
1386
1386
  }), {
1387
1387
  refreshing: i,
1388
- refreshStatus: s,
1388
+ refreshStatus: r,
1389
1389
  startListening: N,
1390
- startRefresh: k,
1390
+ startRefresh: _,
1391
1391
  cleanup: v
1392
1392
  };
1393
1393
  }
1394
- const Ia = { class: "w-full flex flex-col gap-32" }, Ba = { class: "flex flex-col gap-4" }, Ta = { class: "flex justify-between" }, ja = { class: "flex" }, Ua = { class: "grid grid-cols-[repeat(4,1fr)] xs:flex xs:flex-col sm:flex sm:flex-col gap-8" }, Ma = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ra = { class: "flex gap-1" }, Pa = {
1394
+ const Ba = { class: "w-full flex flex-col gap-32" }, Ta = { class: "flex flex-col gap-4" }, ja = { class: "flex justify-between" }, Ma = { class: "flex" }, Ua = { class: "grid grid-cols-[repeat(4,1fr)] xs:flex xs:flex-col sm:flex sm:flex-col gap-8" }, Ra = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Pa = { class: "flex gap-1" }, Va = {
1395
1395
  class: "fm-typo-en-body-lg-600",
1396
1396
  style: { "white-space": "pre-wrap", "word-break": "break-word" }
1397
- }, Va = {
1397
+ }, Na = {
1398
1398
  key: 0,
1399
- class: "flex items-start gap-8 p-12 fm-corner-radius-md border-1 border-purple-500 bg-purple-50 text-purple-700"
1400
- }, Na = { class: "flex flex-col gap-16" }, za = { class: "flex items-center" }, Ea = {
1399
+ class: "flex items-start gap-8 p-12 fm-corner-radius-md border-1 border-yellow-500 bg-yellow-50 text-yellow-700"
1400
+ }, za = { class: "flex flex-col gap-2" }, Ea = { class: "fm-typo-en-body-sm-400 list-disc pl-16" }, La = { key: 0 }, Oa = { key: 1 }, Ha = { class: "flex flex-col gap-16" }, Ya = { class: "flex items-center" }, Ka = {
1401
1401
  key: 0,
1402
1402
  class: "flex gap-8"
1403
- }, La = {
1403
+ }, Wa = {
1404
1404
  key: 0,
1405
1405
  class: "w-full flex flex-col items-center"
1406
- }, Oa = { class: "flex items-center gap-8" }, Ha = { class: "flex flex-col gap-8" }, Ya = { class: "flex gap-8" }, Ka = {
1406
+ }, qa = { class: "flex items-center gap-8" }, Ga = { class: "flex flex-col gap-8" }, Qa = { class: "flex gap-8" }, Za = {
1407
1407
  key: 0,
1408
1408
  class: "flex gap-8"
1409
- }, Wa = {
1409
+ }, Ja = {
1410
1410
  key: 1,
1411
1411
  class: "flex gap-8 flex-wrap"
1412
- }, qa = { class: "overflow-x-auto" }, Ga = {
1412
+ }, Xa = { class: "overflow-x-auto" }, eo = {
1413
1413
  key: 1,
1414
1414
  class: "flex-1 xs:w-screen xs:max-w-full"
1415
- }, Qa = {
1415
+ }, to = {
1416
1416
  key: 0,
1417
1417
  class: "flex flex-col items-center gap-8 h-full"
1418
- }, Za = ["src"], Ja = {
1418
+ }, no = ["src"], ao = {
1419
1419
  key: 1,
1420
1420
  class: "px-4 flex flex-col"
1421
- }, Xa = { class: "flex gap-12 content-stretch" }, eo = {
1421
+ }, oo = { class: "flex gap-12 content-stretch" }, so = {
1422
1422
  class: "flex flex-col w-24",
1423
1423
  name: "circles"
1424
- }, to = { class: "flex-1 flex flex-col items-center" }, no = { class: "flex-1 flex flex-col items-center" }, ao = {
1424
+ }, ro = { class: "flex-1 flex flex-col items-center" }, lo = { class: "flex-1 flex flex-col items-center" }, io = {
1425
1425
  class: "py-12 flex flex-col gap-4",
1426
1426
  name: "received-at header"
1427
- }, oo = { class: "fm-typo-en-body-lg-400" }, so = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, ro = { class: "flex gap-12 content-stretch" }, lo = {
1427
+ }, co = { class: "fm-typo-en-body-lg-400" }, uo = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, mo = { class: "flex gap-12 content-stretch" }, fo = {
1428
1428
  class: "flex flex-col w-24",
1429
1429
  name: "circles"
1430
- }, io = { class: "flex-1 flex flex-col items-center" }, co = {
1430
+ }, po = { class: "flex-1 flex flex-col items-center" }, vo = {
1431
1431
  class: "py-12 flex flex-col gap-4 flex-1",
1432
1432
  name: "delivery details"
1433
- }, uo = { class: "flex flex-col gap-8" }, mo = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, fo = { class: "flex flex-col gap-4" }, po = { class: "flex items-center justify-between gap-8 w-full" }, vo = { class: "flex items-center gap-8" }, yo = { class: "flex flex-col items-end" }, go = { class: "text-2xl font-semibold" }, Ot = "N/A", bo = /* @__PURE__ */ je({
1433
+ }, yo = { class: "flex flex-col gap-8" }, go = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, bo = { class: "flex flex-col gap-4" }, ho = { class: "flex items-center justify-between gap-8 w-full" }, ko = { class: "flex items-center gap-8" }, _o = { class: "flex flex-col items-end" }, wo = { class: "text-2xl font-semibold" }, Ot = "N/A", xo = /* @__PURE__ */ je({
1434
1434
  __name: "ClosingDraftDialog",
1435
1435
  props: {
1436
1436
  show: { type: Boolean },
1437
1437
  draft: {}
1438
1438
  },
1439
1439
  emits: ["submitted", "refresh"],
1440
- setup(n, { emit: r }) {
1441
- const t = n, o = M(() => {
1442
- const l = Wt();
1443
- return l === "MYR" ? "RM" : l;
1440
+ setup(n, { emit: l }) {
1441
+ const t = n, s = M(() => {
1442
+ const a = Wt();
1443
+ return a === "MYR" ? "RM" : a;
1444
1444
  }), g = on(), i = M(() => {
1445
- var l, e;
1446
- return (l = t.draft) != null && l.closingId ? ((e = g.drafts.find((d) => d._id === t.draft._id)) == null ? void 0 : e.closingIdDisplay) ?? null : null;
1447
- }), s = lt(), c = Kt(t, "show"), x = K(!1), A = K(!1), f = K(new Array()), B = K(new Array()), N = K([]), E = it(), I = Ke(), k = wt(), R = We(), p = Et({}), v = M(() => new Set(
1448
- k.skus.filter((l) => {
1445
+ var a, e;
1446
+ return (a = t.draft) != null && a.closingId ? ((e = g.drafts.find((d) => d._id === t.draft._id)) == null ? void 0 : e.closingIdDisplay) ?? null : null;
1447
+ }), r = it(), c = Kt(t, "show"), x = W(!1), A = W(!1), f = W(new Array()), B = W(new Array()), N = W([]), E = ct(), F = Ke(), _ = wt(), R = We(), p = Et({}), v = M(() => new Set(
1448
+ _.skus.filter((a) => {
1449
1449
  var e;
1450
- return p[(e = l.customAttributes) == null ? void 0 : e.tag];
1451
- }).map((l) => l._id)
1452
- )), m = r, b = M(() => {
1453
- var l;
1454
- return (l = t.draft) == null ? void 0 : l._id;
1450
+ return p[(e = a.customAttributes) == null ? void 0 : e.tag];
1451
+ }).map((a) => a._id)
1452
+ )), m = l, b = M(() => {
1453
+ var a;
1454
+ return (a = t.draft) == null ? void 0 : a._id;
1455
1455
  }), y = M(() => {
1456
- var l;
1457
- return (l = t.draft) == null ? void 0 : l._rev;
1456
+ var a;
1457
+ return (a = t.draft) == null ? void 0 : a._rev;
1458
1458
  }), {
1459
- refreshing: _,
1459
+ refreshing: w,
1460
1460
  startListening: Y,
1461
- startRefresh: W,
1461
+ startRefresh: q,
1462
1462
  cleanup: re
1463
1463
  } = Fa({
1464
1464
  closingDraftId: b,
1465
1465
  currentRev: y,
1466
- onCompleted: (l) => {
1467
- m("refresh", l), f.value = l.stockSnapshot ?? [], c.value = !1;
1466
+ onCompleted: (a) => {
1467
+ m("refresh", a), f.value = a.stockSnapshot ?? [], c.value = !1;
1468
1468
  }
1469
- }), z = K({
1469
+ }), z = W({
1470
1470
  templateItem: !0,
1471
1471
  nonTemplateItem: !0
1472
- }), le = K(null);
1473
- function P(l, e) {
1474
- le.value = e ? l : le.value === l ? null : le.value;
1472
+ }), le = W(null);
1473
+ function P(a, e) {
1474
+ le.value = e ? a : le.value === a ? null : le.value;
1475
1475
  }
1476
- const S = (l) => ne(l, { minPrecision: 0, maxPrecision: 3 });
1477
- function ie(l, e) {
1478
- return e ? "text-fm-color-system-error-300" : l ? "text-purple-500" : "";
1476
+ const S = (a) => ne(a, { minPrecision: 0, maxPrecision: 3 });
1477
+ function ie(a, e) {
1478
+ return e ? "text-fm-color-system-error-300" : a ? "text-purple-500" : "";
1479
1479
  }
1480
- function L(l, e) {
1481
- return e ? h(pe.FmIcon, { name: "warning", size: "sm", color: "system-error-300" }) : l ? h(pe.FmIcon, { name: "rule", size: "sm" }) : null;
1480
+ function L(a, e) {
1481
+ return e ? k(pe.FmIcon, { name: "warning", size: "sm", color: "system-error-300" }) : a ? k(pe.FmIcon, { name: "rule", size: "sm" }) : null;
1482
1482
  }
1483
- function F(l) {
1484
- return h(
1483
+ function I(a) {
1484
+ return k(
1485
1485
  "div",
1486
1486
  {
1487
1487
  class: "p-12 flex flex-col gap-4 fm-typo-en-body-md-400 min-w-[280px] max-w-[420px]"
1488
1488
  },
1489
1489
  [
1490
- h("div", { class: "fm-typo-en-body-sm-600 text-fm-color-typo-secondary mb-4" }, "Breakdown"),
1491
- ...l.breakdown.map(
1492
- (e) => h("div", { class: "flex justify-between gap-12" }, [
1493
- h(
1490
+ k("div", { class: "fm-typo-en-body-sm-600 text-fm-color-typo-secondary mb-4" }, "Breakdown"),
1491
+ ...a.breakdown.map(
1492
+ (e) => k("div", { class: "flex justify-between gap-12" }, [
1493
+ k(
1494
1494
  "div",
1495
1495
  { class: ["flex items-center gap-4", ie(e.inactive, e.orphan)] },
1496
- [L(e.inactive, e.orphan), h("span", e.label)]
1496
+ [L(e.inactive, e.orphan), k("span", e.label)]
1497
1497
  ),
1498
- h(
1498
+ k(
1499
1499
  "div",
1500
1500
  { class: e.counted ? "" : "line-through text-fm-color-typo-tertiary" },
1501
- e.orphan ? `${S(e.amount)} ${e.abbrev} (no valid conversion)` : e.counted ? `${S(e.subtotal)} ${l.baseUnit}` : `${S(e.subtotal)} ${l.baseUnit} (ignored)`
1501
+ e.orphan ? `${S(e.amount)} ${e.abbrev} (no valid conversion)` : e.counted ? `${S(e.subtotal)} ${a.baseUnit}` : `${S(e.subtotal)} ${a.baseUnit} (ignored)`
1502
1502
  )
1503
1503
  ])
1504
1504
  ),
1505
- h("hr", { class: "border-fm-color-typo-secondary my-4" }),
1506
- h("div", { class: "flex justify-between fm-typo-en-body-lg-600" }, [
1507
- h("span", "Total"),
1508
- h("span", `${S(l.physicalBalance)} ${l.baseUnit}`)
1505
+ k("hr", { class: "border-fm-color-typo-secondary my-4" }),
1506
+ k("div", { class: "flex justify-between fm-typo-en-body-lg-600" }, [
1507
+ k("span", "Total"),
1508
+ k("span", `${S(a.physicalBalance)} ${a.baseUnit}`)
1509
1509
  ])
1510
1510
  ]
1511
1511
  );
1512
1512
  }
1513
1513
  const Q = M(() => {
1514
1514
  var e, d;
1515
- const l = [...((e = t.draft) == null ? void 0 : e.items) ?? [], ...((d = t.draft) == null ? void 0 : d.negativeStockItems) ?? []];
1516
- return v.value.size ? l.filter((T) => v.value.has(T.sku._id)) : l;
1515
+ const a = [...((e = t.draft) == null ? void 0 : e.items) ?? [], ...((d = t.draft) == null ? void 0 : d.negativeStockItems) ?? []];
1516
+ return v.value.size ? a.filter((j) => v.value.has(j.sku._id)) : a;
1517
1517
  }), se = M(() => {
1518
- const l = Q.value.map((e) => e.sku);
1519
- return l.sort((e, d) => e.code.localeCompare(d.code)), l;
1518
+ const a = Q.value.map((e) => e.sku);
1519
+ return a.sort((e, d) => e.code.localeCompare(d.code)), a;
1520
1520
  }), we = nn();
1521
1521
  kt(Ee), ze(
1522
1522
  () => t.show,
1523
- async (l) => {
1524
- if (!l) {
1523
+ async (a) => {
1524
+ if (!a) {
1525
1525
  re();
1526
1526
  return;
1527
1527
  }
@@ -1532,18 +1532,18 @@ const Ia = { class: "w-full flex flex-col gap-32" }, Ba = { class: "flex flex-co
1532
1532
  },
1533
1533
  { immediate: !0 }
1534
1534
  );
1535
- const xe = M(() => dt.value.reduce((l, e) => l + Number(e.stockTakeValue), 0)), De = He(0), $e = He(100);
1535
+ const xe = M(() => Qe.value.reduce((a, e) => a + Number(e.stockTakeValue), 0)), De = He(0), $e = He(100);
1536
1536
  async function Ee() {
1537
- var e, d, T, D;
1537
+ var e, d, j, D;
1538
1538
  if (!R._currentLocation) return;
1539
1539
  x.value = !0;
1540
- const l = ((e = t.draft) == null ? void 0 : e.status) === _e.enum.COMPLETED;
1540
+ const a = ((e = t.draft) == null ? void 0 : e.status) === _e.enum.COMPLETED;
1541
1541
  B.value = [];
1542
1542
  try {
1543
- if (await k.init(), l) {
1544
- const q = t.draft.closingAdjustmentId;
1545
- if (!q) {
1546
- I.open({
1543
+ if (await _.init(), a) {
1544
+ const G = t.draft.closingAdjustmentId;
1545
+ if (!G) {
1546
+ F.open({
1547
1547
  title: "Something went wrong",
1548
1548
  message: "Closing draft is completed but closing document cannot be found.",
1549
1549
  type: "error"
@@ -1552,9 +1552,9 @@ const Ia = { class: "w-full flex flex-col gap-32" }, Ba = { class: "flex flex-co
1552
1552
  });
1553
1553
  return;
1554
1554
  }
1555
- const me = await E.readAdjustmentById(q), Ae = (me == null ? void 0 : me.skus) ?? [];
1555
+ const me = await E.readAdjustmentById(G), Ae = (me == null ? void 0 : me.skus) ?? [];
1556
1556
  for (const ge of Ae) {
1557
- const Fe = {
1557
+ const Ie = {
1558
1558
  id: ge.sku._id,
1559
1559
  balance: ge.fromBalance,
1560
1560
  costs: ge.fromCostBalances
@@ -1563,24 +1563,24 @@ const Ia = { class: "w-full flex flex-col gap-32" }, Ba = { class: "flex flex-co
1563
1563
  balance: ge.toBalance,
1564
1564
  costs: ge.toCostBalances
1565
1565
  };
1566
- f.value.push(Fe), B.value.push(U);
1566
+ f.value.push(Ie), B.value.push(U);
1567
1567
  }
1568
1568
  } else
1569
- f.value = ((T = t.draft) == null ? void 0 : T.stockSnapshot) ?? [];
1569
+ f.value = ((j = t.draft) == null ? void 0 : j.stockSnapshot) ?? [];
1570
1570
  const V = /* @__PURE__ */ new Set();
1571
1571
  if ((D = t.draft) != null && D.adjustmentSnapshot)
1572
- for (const q of t.draft.adjustmentSnapshot)
1573
- q.adjustmentsByType && Object.keys(q.adjustmentsByType).forEach((me) => {
1572
+ for (const G of t.draft.adjustmentSnapshot)
1573
+ G.adjustmentsByType && Object.keys(G.adjustmentsByType).forEach((me) => {
1574
1574
  V.add(me);
1575
1575
  });
1576
1576
  const C = ["receive", "sales", "wastage"], J = [];
1577
- C.forEach((q) => {
1578
- V.has(q) && (J.push(q), V.delete(q));
1577
+ C.forEach((G) => {
1578
+ V.has(G) && (J.push(G), V.delete(G));
1579
1579
  });
1580
1580
  const O = Array.from(V).sort();
1581
1581
  N.value = [...J, ...O];
1582
1582
  } catch (V) {
1583
- I.open({
1583
+ F.open({
1584
1584
  title: "Something went wrong",
1585
1585
  message: "Something went wrong when fetching info. Please try again.",
1586
1586
  type: "error"
@@ -1591,59 +1591,59 @@ const Ia = { class: "w-full flex flex-col gap-32" }, Ba = { class: "flex flex-co
1591
1591
  }
1592
1592
  async function Le() {
1593
1593
  var e, d;
1594
- if (_.value)
1594
+ if (w.value)
1595
1595
  return;
1596
1596
  if (!(((e = t.draft) == null ? void 0 : e.effectiveAt) ?? (t.draft ? Te((d = t.draft) == null ? void 0 : d._id) : null))) {
1597
- I.open({
1597
+ F.open({
1598
1598
  title: "Cannot refresh",
1599
1599
  message: "Effective date is not available for this draft.",
1600
1600
  type: "error"
1601
1601
  });
1602
1602
  return;
1603
1603
  }
1604
- await s.refreshBalance(
1604
+ await r.refreshBalance(
1605
1605
  t.draft,
1606
1606
  () => {
1607
1607
  },
1608
- async (T) => {
1609
- await W(T);
1608
+ async (j) => {
1609
+ await q(j);
1610
1610
  }
1611
1611
  );
1612
1612
  }
1613
- async function Ue() {
1613
+ async function Me() {
1614
1614
  var e, d;
1615
1615
  if (!(((e = t.draft) == null ? void 0 : e.effectiveAt) ?? (t.draft ? Te((d = t.draft) == null ? void 0 : d._id) : null))) {
1616
- I.open({
1616
+ F.open({
1617
1617
  title: "Cannot refresh",
1618
1618
  message: "Effective date is not available for this draft.",
1619
1619
  type: "error"
1620
1620
  });
1621
1621
  return;
1622
1622
  }
1623
- await s.invalidateDraftCache(t.draft);
1623
+ await r.invalidateDraftCache(t.draft);
1624
1624
  }
1625
1625
  const Ge = M(
1626
1626
  () => f.value.groupBy(
1627
- (l) => l.id,
1628
- (l) => l.balance
1627
+ (a) => a.id,
1628
+ (a) => a.balance
1629
1629
  )
1630
- ), ct = M(() => Q.value.groupBy((l) => l.sku._id)), sn = M(() => {
1631
- var l;
1632
- return (l = t.draft) != null && l.adjustmentSnapshot ? new Map(t.draft.adjustmentSnapshot.map((e) => [e.skuId, e.adjustmentsByType])) : /* @__PURE__ */ new Map();
1630
+ ), ut = M(() => Q.value.groupBy((a) => a.sku._id)), sn = M(() => {
1631
+ var a;
1632
+ return (a = t.draft) != null && a.adjustmentSnapshot ? new Map(t.draft.adjustmentSnapshot.map((e) => [e.skuId, e.adjustmentsByType])) : /* @__PURE__ */ new Map();
1633
1633
  }), rn = M(() => {
1634
- var l;
1635
- return (l = t.draft) != null && l.opening ? new Map(t.draft.opening.map((e) => [e.skuId, e.balance])) : /* @__PURE__ */ new Map();
1634
+ var a;
1635
+ return (a = t.draft) != null && a.opening ? new Map(t.draft.opening.map((e) => [e.skuId, e.balance])) : /* @__PURE__ */ new Map();
1636
1636
  });
1637
- function ye(l, e) {
1638
- return h(
1637
+ function ye(a, e) {
1638
+ return k(
1639
1639
  pe.FmTooltip,
1640
1640
  { zIndex: 51, placement: "left", class: "w-full flex justify-end" },
1641
1641
  {
1642
1642
  default() {
1643
- return l;
1643
+ return a;
1644
1644
  },
1645
1645
  content() {
1646
- return e || l;
1646
+ return e || a;
1647
1647
  }
1648
1648
  }
1649
1649
  );
@@ -1655,8 +1655,8 @@ const Ia = { class: "w-full flex flex-col gap-32" }, Ba = { class: "flex flex-co
1655
1655
  header: () => "Name",
1656
1656
  size: 350,
1657
1657
  cell(e) {
1658
- const d = e.row.original, T = d.adjustedDiffPercentage, D = typeof T == "number" && Math.abs(T) > 10, V = h("div", { class: "flex flex-col gap-4" }, [
1659
- h(
1658
+ const d = e.row.original, j = d.adjustedDiffPercentage, D = typeof j == "number" && Math.abs(j) > 10, V = k("div", { class: "flex flex-col gap-4" }, [
1659
+ k(
1660
1660
  "div",
1661
1661
  {
1662
1662
  class: [
@@ -1666,7 +1666,7 @@ const Ia = { class: "w-full flex flex-col gap-32" }, Ba = { class: "flex flex-co
1666
1666
  },
1667
1667
  d.name
1668
1668
  ),
1669
- h(
1669
+ k(
1670
1670
  "div",
1671
1671
  {
1672
1672
  class: [
@@ -1677,7 +1677,7 @@ const Ia = { class: "w-full flex flex-col gap-32" }, Ba = { class: "flex flex-co
1677
1677
  d.code
1678
1678
  )
1679
1679
  ]);
1680
- return h(
1680
+ return k(
1681
1681
  pe.FmTooltip,
1682
1682
  {
1683
1683
  zIndex: 51
@@ -1687,7 +1687,7 @@ const Ia = { class: "w-full flex flex-col gap-32" }, Ba = { class: "flex flex-co
1687
1687
  return D ? "Adjustment difference is more than 10%." : `${d.code} - ${d.name}`;
1688
1688
  },
1689
1689
  default() {
1690
- return h("div", { class: "flex items-center gap-4 justify-start w-full" }, [
1690
+ return k("div", { class: "flex items-center gap-4 justify-start w-full" }, [
1691
1691
  V
1692
1692
  ]);
1693
1693
  }
@@ -1696,15 +1696,15 @@ const Ia = { class: "w-full flex flex-col gap-32" }, Ba = { class: "flex flex-co
1696
1696
  }
1697
1697
  },
1698
1698
  // Dynamic custom attribute columns (toggled by user)
1699
- ...Dt.value.map(
1699
+ ...Ct.value.map(
1700
1700
  (e) => ({
1701
1701
  id: `customAttr_${e}`,
1702
1702
  accessorFn: (d) => d.customAttributeValues[e],
1703
1703
  header: () => ye(Be(e)),
1704
1704
  size: 160,
1705
1705
  cell(d) {
1706
- const T = d.row.original.customAttributeValues[e];
1707
- return T == null ? "N/A" : typeof T == "number" ? h("div", { class: "text-right fm-typo-en-body-lg-400" }, ne(T)) : h("div", { class: "text-right fm-typo-en-body-lg-400" }, String(T));
1706
+ const j = d.row.original.customAttributeValues[e];
1707
+ return j == null ? "N/A" : typeof j == "number" ? k("div", { class: "text-right fm-typo-en-body-lg-400" }, ne(j)) : k("div", { class: "text-right fm-typo-en-body-lg-400" }, String(j));
1708
1708
  },
1709
1709
  meta: {
1710
1710
  textAlign: "right"
@@ -1718,7 +1718,7 @@ const Ia = { class: "w-full flex flex-col gap-32" }, Ba = { class: "flex flex-co
1718
1718
  size: 160,
1719
1719
  cell(e) {
1720
1720
  const d = e.row.original.costPerUnit;
1721
- return h("div", { class: "text-right fm-typo-en-body-lg-400" }, ne(d));
1721
+ return k("div", { class: "text-right fm-typo-en-body-lg-400" }, ne(d));
1722
1722
  },
1723
1723
  meta: {
1724
1724
  textAlign: "right"
@@ -1730,22 +1730,22 @@ const Ia = { class: "w-full flex flex-col gap-32" }, Ba = { class: "flex flex-co
1730
1730
  size: 120,
1731
1731
  cell(e) {
1732
1732
  var C;
1733
- const d = e.row.original, T = d.costUnit, D = d.baseUnit, V = T ?? D;
1734
- if (T && T !== D) {
1735
- const J = se.value.find((q) => q._id === d.id), O = (C = J == null ? void 0 : J.defaultCost) == null ? void 0 : C.measurement;
1733
+ const d = e.row.original, j = d.costUnit, D = d.baseUnit, V = j ?? D;
1734
+ if (j && j !== D) {
1735
+ const J = se.value.find((G) => G._id === d.id), O = (C = J == null ? void 0 : J.defaultCost) == null ? void 0 : C.measurement;
1736
1736
  if (O) {
1737
- const q = O.conversion.amount / Math.pow(10, O.conversion.precision);
1738
- return h("div", { class: "flex flex-col" }, [
1739
- h(
1737
+ const G = O.conversion.amount / Math.pow(10, O.conversion.precision);
1738
+ return k("div", { class: "flex flex-col" }, [
1739
+ k(
1740
1740
  "span",
1741
1741
  { class: "fm-typo-en-body-lg-400 text-fm-color-typo-primary" },
1742
1742
  V
1743
1743
  ),
1744
- h("span", { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, [
1744
+ k("span", { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, [
1745
1745
  "1 ",
1746
- h("span", { class: "fm-typo-en-body-sm-600" }, T),
1747
- ` = ${q} `,
1748
- h("span", { class: "fm-typo-en-body-sm-600" }, D)
1746
+ k("span", { class: "fm-typo-en-body-sm-600" }, j),
1747
+ ` = ${G} `,
1748
+ k("span", { class: "fm-typo-en-body-sm-600" }, D)
1749
1749
  ])
1750
1750
  ]);
1751
1751
  }
@@ -1760,7 +1760,7 @@ const Ia = { class: "w-full flex flex-col gap-32" }, Ba = { class: "flex flex-co
1760
1760
  size: 150,
1761
1761
  cell(e) {
1762
1762
  const d = e.row.original.opening;
1763
- return h("div", { class: "text-right fm-typo-en-body-lg-400" }, ne(d));
1763
+ return k("div", { class: "text-right fm-typo-en-body-lg-400" }, ne(d));
1764
1764
  },
1765
1765
  meta: {
1766
1766
  textAlign: "right"
@@ -1774,8 +1774,8 @@ const Ia = { class: "w-full flex flex-col gap-32" }, Ba = { class: "flex flex-co
1774
1774
  header: () => ye(Be(e)),
1775
1775
  size: 150,
1776
1776
  cell(d) {
1777
- const T = d.row.original.adjustmentAmounts[e] ?? { amount: 0, precision: 0 };
1778
- return h("div", { class: "text-right fm-typo-en-body-lg-400" }, ne(T));
1777
+ const j = d.row.original.adjustmentAmounts[e] ?? { amount: 0, precision: 0 };
1778
+ return k("div", { class: "text-right fm-typo-en-body-lg-400" }, ne(j));
1779
1779
  },
1780
1780
  meta: {
1781
1781
  textAlign: "right"
@@ -1789,7 +1789,7 @@ const Ia = { class: "w-full flex flex-col gap-32" }, Ba = { class: "flex flex-co
1789
1789
  size: 200,
1790
1790
  cell(e) {
1791
1791
  const d = e.row.original.systemBalance;
1792
- return h("div", { class: "text-right fm-typo-en-body-lg-400" }, ne(d));
1792
+ return k("div", { class: "text-right fm-typo-en-body-lg-400" }, ne(d));
1793
1793
  },
1794
1794
  meta: {
1795
1795
  textAlign: "right"
@@ -1798,40 +1798,40 @@ const Ia = { class: "w-full flex flex-col gap-32" }, Ba = { class: "flex flex-co
1798
1798
  {
1799
1799
  id: "physicalBalance",
1800
1800
  accessorFn: (e) => {
1801
- var T;
1802
- const d = (T = B.value.find((D) => D.id === e.id)) == null ? void 0 : T.balance;
1803
- return d ? Ln.toDouble(d) : e.physicalBalance;
1801
+ var j;
1802
+ const d = (j = B.value.find((D) => D.id === e.id)) == null ? void 0 : j.balance;
1803
+ return d ? On.toDouble(d) : e.physicalBalance;
1804
1804
  },
1805
1805
  header: () => ye("Stock Take balance", "The physical balance recorded during stock take."),
1806
1806
  cell(e) {
1807
1807
  var O;
1808
- const d = e.row.original, T = te.fromNumber(d.physicalBalance);
1808
+ const d = e.row.original, j = te.fromNumber(d.physicalBalance);
1809
1809
  let D = !0;
1810
- const V = (O = B.value.find((q) => q.id === d.id)) == null ? void 0 : O.balance;
1810
+ const V = (O = B.value.find((G) => G.id === d.id)) == null ? void 0 : O.balance;
1811
1811
  let C;
1812
- V && !te.equals({ a: T, b: V }) ? (D = !1, C = ne(V)) : C = ne(d.physicalBalance);
1813
- const J = h("div", { class: "flex flex-col items-end" }, [
1814
- h(
1812
+ V && !te.equals({ a: j, b: V }) ? (D = !1, C = ne(V)) : C = ne(d.physicalBalance);
1813
+ const J = k("div", { class: "flex flex-col items-end" }, [
1814
+ k(
1815
1815
  "span",
1816
1816
  { class: "line-clamp-1 fm-typo-en-body-lg-400 text-fm-color-typo-primary" },
1817
1817
  C
1818
1818
  ),
1819
- D ? null : h(
1819
+ D ? null : k(
1820
1820
  "span",
1821
1821
  { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" },
1822
1822
  `Draft: ${ne(d.physicalBalance)}`
1823
1823
  )
1824
1824
  ]);
1825
- return d.breakdown.length ? h(
1825
+ return d.breakdown.length ? k(
1826
1826
  pe.FmPopover,
1827
1827
  {
1828
1828
  showPopover: le.value === d.id,
1829
1829
  placement: "bottom-end",
1830
1830
  zIndex: 9999,
1831
- "onPopover-changed": (q) => P(d.id, q)
1831
+ "onPopover-changed": (G) => P(d.id, G)
1832
1832
  },
1833
1833
  {
1834
- "popover-button": () => h(
1834
+ "popover-button": () => k(
1835
1835
  "button",
1836
1836
  {
1837
1837
  type: "button",
@@ -1839,10 +1839,10 @@ const Ia = { class: "w-full flex flex-col gap-32" }, Ba = { class: "flex flex-co
1839
1839
  },
1840
1840
  [
1841
1841
  J,
1842
- h(pe.FmIcon, { name: "info", size: "sm", outline: !0 })
1842
+ k(pe.FmIcon, { name: "info", size: "sm", outline: !0 })
1843
1843
  ]
1844
1844
  ),
1845
- default: () => F(d)
1845
+ default: () => I(d)
1846
1846
  }
1847
1847
  ) : J;
1848
1848
  },
@@ -1858,7 +1858,7 @@ const Ia = { class: "w-full flex flex-col gap-32" }, Ba = { class: "flex flex-co
1858
1858
  size: 200,
1859
1859
  cell(e) {
1860
1860
  const d = e.row.original.adjustedAmount;
1861
- return h("div", { class: "text-right fm-typo-en-body-lg-400" }, ne(d));
1861
+ return k("div", { class: "text-right fm-typo-en-body-lg-400" }, ne(d));
1862
1862
  },
1863
1863
  meta: {
1864
1864
  textAlign: "right"
@@ -1867,11 +1867,11 @@ const Ia = { class: "w-full flex flex-col gap-32" }, Ba = { class: "flex flex-co
1867
1867
  {
1868
1868
  id: "varianceInCost",
1869
1869
  accessorKey: "varianceInCost",
1870
- header: () => ye(`Variance (${o.value})`),
1870
+ header: () => ye(`Variance (${s.value})`),
1871
1871
  size: 150,
1872
1872
  cell(e) {
1873
1873
  const d = e.row.original.varianceInCost;
1874
- return h("div", { class: "text-right fm-typo-en-body-lg-400" }, ne(d));
1874
+ return k("div", { class: "text-right fm-typo-en-body-lg-400" }, ne(d));
1875
1875
  },
1876
1876
  meta: {
1877
1877
  textAlign: "right"
@@ -1888,24 +1888,24 @@ const Ia = { class: "w-full flex flex-col gap-32" }, Ba = { class: "flex flex-co
1888
1888
  cell(e) {
1889
1889
  const d = e.row.original.adjustedDiffPercentage;
1890
1890
  if (d == null)
1891
- return h(
1891
+ return k(
1892
1892
  "div",
1893
1893
  { class: "flex items-center gap-4 justify-end fm-typo-en-body-lg-400" },
1894
1894
  Ot
1895
1895
  );
1896
- const T = ne(d);
1896
+ const j = ne(d);
1897
1897
  if (d === 0)
1898
- return h("div", { class: "flex items-center gap-4 justify-end fm-typo-en-body-lg-400" }, [
1898
+ return k("div", { class: "flex items-center gap-4 justify-end fm-typo-en-body-lg-400" }, [
1899
1899
  ne(0)
1900
1900
  ]);
1901
1901
  const D = d > 0;
1902
- return h("div", { class: "flex items-center gap-4 justify-end fm-typo-en-body-lg-400" }, [
1903
- h(pe.FmIcon, {
1902
+ return k("div", { class: "flex items-center gap-4 justify-end fm-typo-en-body-lg-400" }, [
1903
+ k(pe.FmIcon, {
1904
1904
  name: D ? "arrow_drop_up" : "arrow_drop_down",
1905
1905
  color: D ? "system-success-300" : "system-error-300",
1906
1906
  size: "md"
1907
1907
  }),
1908
- T
1908
+ j
1909
1909
  ]);
1910
1910
  },
1911
1911
  meta: {
@@ -1915,14 +1915,14 @@ const Ia = { class: "w-full flex flex-col gap-32" }, Ba = { class: "flex flex-co
1915
1915
  {
1916
1916
  id: "stockTakeValue",
1917
1917
  accessorKey: "stockTakeValue",
1918
- header: () => ye(`Stock take value (${o.value})`),
1918
+ header: () => ye(`Stock take value (${s.value})`),
1919
1919
  size: 180,
1920
1920
  cell(e) {
1921
1921
  var O;
1922
- const d = e.row.original, T = d.stockTakeValue, D = se.value.find((q) => q._id === d.id), V = (O = D == null ? void 0 : D.defaultCost) == null ? void 0 : O.measurement, C = d.physicalBalance, J = d.costPerUnit;
1922
+ const d = e.row.original, j = d.stockTakeValue, D = se.value.find((G) => G._id === d.id), V = (O = D == null ? void 0 : D.defaultCost) == null ? void 0 : O.measurement, C = d.physicalBalance, J = d.costPerUnit;
1923
1923
  if (V) {
1924
- const q = te.toFormatString({ value: V.conversion }), me = `${ne(C, { minPrecision: 2, maxPrecision: 4 })} ${d.baseUnit} ÷ ${q} × ${J} ${o.value}`;
1925
- return h(
1924
+ const G = te.toFormatString({ value: V.conversion }), me = `${ne(C, { minPrecision: 2, maxPrecision: 4 })} ${d.baseUnit} ÷ ${G} × ${J} ${s.value}`;
1925
+ return k(
1926
1926
  pe.FmTooltip,
1927
1927
  { zIndex: 51 },
1928
1928
  {
@@ -1930,28 +1930,28 @@ const Ia = { class: "w-full flex flex-col gap-32" }, Ba = { class: "flex flex-co
1930
1930
  return me;
1931
1931
  },
1932
1932
  default() {
1933
- return h(
1933
+ return k(
1934
1934
  "div",
1935
1935
  { class: "text-right w-full fm-typo-en-body-lg-400" },
1936
- ne(T)
1936
+ ne(j)
1937
1937
  );
1938
1938
  }
1939
1939
  }
1940
1940
  );
1941
1941
  } else {
1942
- const q = `${ne(C, { minPrecision: 2, maxPrecision: 4 })} ${d.baseUnit} × ${J} ${o.value}`;
1943
- return h(
1942
+ const G = `${ne(C, { minPrecision: 2, maxPrecision: 4 })} ${d.baseUnit} × ${J} ${s.value}`;
1943
+ return k(
1944
1944
  pe.FmTooltip,
1945
1945
  { zIndex: 51 },
1946
1946
  {
1947
1947
  content() {
1948
- return q;
1948
+ return G;
1949
1949
  },
1950
1950
  default() {
1951
- return h(
1951
+ return k(
1952
1952
  "div",
1953
1953
  { class: "text-right w-full fm-typo-en-body-lg-400" },
1954
- ne(T)
1954
+ ne(j)
1955
1955
  );
1956
1956
  }
1957
1957
  }
@@ -1965,14 +1965,14 @@ const Ia = { class: "w-full flex flex-col gap-32" }, Ba = { class: "flex flex-co
1965
1965
  {
1966
1966
  id: "systemValue",
1967
1967
  accessorKey: "systemValue",
1968
- header: () => ye(`System value (${o.value})`),
1968
+ header: () => ye(`System value (${s.value})`),
1969
1969
  size: 180,
1970
1970
  cell(e) {
1971
1971
  var O;
1972
- const d = e.row.original, T = d.systemValue, D = se.value.find((q) => q._id === d.id), V = (O = D == null ? void 0 : D.defaultCost) == null ? void 0 : O.measurement, C = d.systemBalance, J = d.costPerUnit;
1972
+ const d = e.row.original, j = d.systemValue, D = se.value.find((G) => G._id === d.id), V = (O = D == null ? void 0 : D.defaultCost) == null ? void 0 : O.measurement, C = d.systemBalance, J = d.costPerUnit;
1973
1973
  if (V) {
1974
- const q = te.toFormatString({ value: V.conversion }), me = `${ne(C, { minPrecision: 2, maxPrecision: 4 })} ${d.baseUnit} ÷ ${q} × ${J} ${o.value}`;
1975
- return h(
1974
+ const G = te.toFormatString({ value: V.conversion }), me = `${ne(C, { minPrecision: 2, maxPrecision: 4 })} ${d.baseUnit} ÷ ${G} × ${J} ${s.value}`;
1975
+ return k(
1976
1976
  pe.FmTooltip,
1977
1977
  { zIndex: 51 },
1978
1978
  {
@@ -1980,28 +1980,28 @@ const Ia = { class: "w-full flex flex-col gap-32" }, Ba = { class: "flex flex-co
1980
1980
  return me;
1981
1981
  },
1982
1982
  default() {
1983
- return h(
1983
+ return k(
1984
1984
  "div",
1985
1985
  { class: "text-right fm-typo-en-body-lg-400" },
1986
- ne(T)
1986
+ ne(j)
1987
1987
  );
1988
1988
  }
1989
1989
  }
1990
1990
  );
1991
1991
  } else {
1992
- const q = `${ne(C, { minPrecision: 2, maxPrecision: 4 })} ${d.baseUnit} × ${J} ${o.value}`;
1993
- return h(
1992
+ const G = `${ne(C, { minPrecision: 2, maxPrecision: 4 })} ${d.baseUnit} × ${J} ${s.value}`;
1993
+ return k(
1994
1994
  pe.FmTooltip,
1995
1995
  { zIndex: 51 },
1996
1996
  {
1997
1997
  content() {
1998
- return q;
1998
+ return G;
1999
1999
  },
2000
2000
  default() {
2001
- return h(
2001
+ return k(
2002
2002
  "div",
2003
2003
  { class: "text-right fm-typo-en-body-lg-400" },
2004
- ne(T)
2004
+ ne(j)
2005
2005
  );
2006
2006
  }
2007
2007
  }
@@ -2017,12 +2017,12 @@ const Ia = { class: "w-full flex flex-col gap-32" }, Ba = { class: "flex flex-co
2017
2017
  header: () => "Amounts",
2018
2018
  enableSorting: !1,
2019
2019
  cell(e) {
2020
- const d = e.row.original, T = (C, J, O = "normal") => h(
2020
+ const d = e.row.original, j = (C, J, O = "normal") => k(
2021
2021
  pe.FmTooltip,
2022
2022
  { zIndex: 50 },
2023
2023
  {
2024
2024
  default() {
2025
- return h(
2025
+ return k(
2026
2026
  "div",
2027
2027
  {
2028
2028
  class: [
@@ -2031,8 +2031,8 @@ const Ia = { class: "w-full flex flex-col gap-32" }, Ba = { class: "flex flex-co
2031
2031
  ]
2032
2032
  },
2033
2033
  [
2034
- h("span", { class: "text-fm-color-typo-primary" }, `${C} `),
2035
- h(
2034
+ k("span", { class: "text-fm-color-typo-primary" }, `${C} `),
2035
+ k(
2036
2036
  "span",
2037
2037
  {
2038
2038
  class: "text-fm-color-typo-secondary",
@@ -2047,8 +2047,8 @@ const Ia = { class: "w-full flex flex-col gap-32" }, Ba = { class: "flex flex-co
2047
2047
  return O === "orphan" ? `${C} ${J} (invalid UOM — not on SKU)` : O === "inactive" ? `${C} ${J} (NetSuite-inactive UOM)` : `${C} ${J}`;
2048
2048
  }
2049
2049
  }
2050
- ), D = d.measurements.filter((C) => !!C.amount).map((C) => T(C.amount, C.abbrev, C.variant)), V = d.baseUnitAmount || !D.length ? [T(d.baseUnitAmount, d.baseUnit), ...D] : D;
2051
- return h(
2050
+ ), D = d.measurements.filter((C) => !!C.amount).map((C) => j(C.amount, C.abbrev, C.variant)), V = d.baseUnitAmount || !D.length ? [j(d.baseUnitAmount, d.baseUnit), ...D] : D;
2051
+ return k(
2052
2052
  "div",
2053
2053
  {
2054
2054
  class: "flex gap-8 flex-nowrap",
@@ -2058,42 +2058,44 @@ const Ia = { class: "w-full flex flex-col gap-32" }, Ba = { class: "flex flex-co
2058
2058
  );
2059
2059
  }
2060
2060
  }
2061
- ]), ln = M(() => xt.value.map((l) => l.size ?? 0).reduce((l, e) => l + e)), ut = K(""), dt = M(() => {
2062
- var d, T;
2063
- const l = ((T = (d = t.draft) == null ? void 0 : d.negativeStockItems) == null ? void 0 : T.reduce(
2061
+ ]), ln = M(() => xt.value.map((a) => a.size ?? 0).reduce((a, e) => a + e)), dt = W(""), cn = M(() => {
2062
+ var d, j;
2063
+ const a = ((j = (d = t.draft) == null ? void 0 : d.negativeStockItems) == null ? void 0 : j.reduce(
2064
2064
  (D, V) => (D[V.sku._id] = V, D),
2065
2065
  {}
2066
- )) ?? {};
2066
+ )) ?? {}, e = new Map(
2067
+ B.value.map((D) => [D.id, D.balance])
2068
+ );
2067
2069
  return se.value.map((D) => {
2068
- var Ft, It, Bt, Tt, jt, Ut, Mt, Rt, Pt, Vt, Nt;
2069
- const V = (Ft = ct.value.get(D._id)) == null ? void 0 : Ft[0], C = ((It = Ge.value.get(D._id)) == null ? void 0 : It[0]) ?? De, J = ((Bt = D.defaultCost) == null ? void 0 : Bt.costPerUnit) ?? De, O = Number(te.toFormatString({ value: J })), q = ((jt = (Tt = D.defaultCost) == null ? void 0 : Tt.measurement) == null ? void 0 : jt.conversion) ?? {
2070
+ var Bt, Tt, jt, Mt, Ut, Rt, Pt, Vt, Nt;
2071
+ const V = (Bt = ut.value.get(D._id)) == null ? void 0 : Bt[0], C = ((Tt = Ge.value.get(D._id)) == null ? void 0 : Tt[0]) ?? De, J = ((jt = D.defaultCost) == null ? void 0 : jt.costPerUnit) ?? De, O = Number(te.toFormatString({ value: J })), G = ((Ut = (Mt = D.defaultCost) == null ? void 0 : Mt.measurement) == null ? void 0 : Ut.conversion) ?? {
2070
2072
  amount: 1,
2071
2073
  precision: 0
2072
2074
  }, me = Number(
2073
- te.toFormatString({ value: q })
2074
- ), Ae = rn.value.get(D._id), ge = Ae ? Number(te.toFormatString({ value: Ae })) : 0, Fe = sn.value.get(D._id), U = {};
2075
- if (N.value.forEach((X) => {
2076
- const be = U[X] ?? { amount: 0, precision: 0 }, Ie = Fe == null ? void 0 : Fe[X];
2077
- Ie && (U[X] = Xt(be, Ie));
2075
+ te.toFormatString({ value: G })
2076
+ ), Ae = rn.value.get(D._id), ge = Ae ? Number(te.toFormatString({ value: Ae })) : 0, Ie = sn.value.get(D._id), U = {};
2077
+ if (N.value.forEach((ee) => {
2078
+ const be = U[ee] ?? { amount: 0, precision: 0 }, Fe = Ie == null ? void 0 : Ie[ee];
2079
+ Fe && (U[ee] = Xt(be, Fe));
2078
2080
  }), !V) {
2079
- const X = Number(te.toFormatString({ value: C })), be = 0 - X, Ie = be * O / me, tt = 0, Pe = X * O / me;
2081
+ const ee = Number(te.toFormatString({ value: C })), be = 0 - ee, Fe = be * O / me, nt = 0, Pe = ee * O / me;
2080
2082
  return {
2081
2083
  id: D._id,
2082
2084
  code: D.code,
2083
2085
  name: D.name,
2084
- costUnit: ((Mt = (Ut = D.defaultCost) == null ? void 0 : Ut.measurement) == null ? void 0 : Mt.abbrev) ?? null,
2086
+ costUnit: ((Pt = (Rt = D.defaultCost) == null ? void 0 : Rt.measurement) == null ? void 0 : Pt.abbrev) ?? null,
2085
2087
  baseUnit: D.unit.abbrev,
2086
2088
  baseUnitAmount: 0,
2087
- systemBalance: X,
2089
+ systemBalance: ee,
2088
2090
  physicalBalance: 0,
2089
- adjustedAmount: -X,
2091
+ adjustedAmount: -ee,
2090
2092
  adjustedDiffPercentage: -100,
2091
- isTemplateItem: !l[D._id],
2093
+ isTemplateItem: !a[D._id],
2092
2094
  costPerUnit: O,
2093
2095
  opening: ge,
2094
2096
  varianceQty: be,
2095
- varianceInCost: Ie,
2096
- stockTakeValue: tt,
2097
+ varianceInCost: Fe,
2098
+ stockTakeValue: nt,
2097
2099
  systemValue: Pe,
2098
2100
  adjustmentAmounts: U,
2099
2101
  customAttributeValues: D.customAttributes ?? {},
@@ -2101,95 +2103,97 @@ const Ia = { class: "w-full flex flex-col gap-32" }, Ba = { class: "flex flex-co
2101
2103
  breakdown: []
2102
2104
  };
2103
2105
  }
2104
- const ue = an(V), fe = (Pt = (Rt = B.value) == null ? void 0 : Rt.find(
2105
- (X) => X.id === D._id
2106
- )) == null ? void 0 : Pt.balance, ke = Zt(
2106
+ const ue = an(V), fe = e.get(D._id), ke = Zt(
2107
2107
  fe ?? ue,
2108
2108
  C
2109
2109
  ), Re = C.amount === 0 ? null : Jt(ke, {
2110
2110
  ...C,
2111
2111
  amount: Math.abs(C.amount)
2112
- }), Xe = Re ? rt(Re, $e) : null, pt = Number(te.toFormatString({ value: C })), vt = Number(te.toFormatString({ value: ue })), Ct = vt - pt, mn = Ct * O / me, fn = vt * O / me, pn = pt * O / me, et = Number(te.toFormatString({ value: V.baseAmount })), St = [], yt = [];
2113
- et && yt.push({
2112
+ }), et = Re ? lt(Re, $e) : null, pt = Number(te.toFormatString({ value: C })), vt = Number(te.toFormatString({ value: ue })), $t = vt - pt, fn = $t * O / me, pn = vt * O / me, vn = pt * O / me, tt = Number(te.toFormatString({ value: V.baseAmount })), It = [], yt = [];
2113
+ tt && yt.push({
2114
2114
  label: "Base",
2115
- amount: et,
2115
+ amount: tt,
2116
2116
  abbrev: D.unit.abbrev,
2117
- subtotal: et,
2117
+ subtotal: tt,
2118
2118
  inactive: !1,
2119
2119
  orphan: !1,
2120
2120
  counted: !0
2121
2121
  });
2122
- const vn = new Map(
2123
- V.measurementsAmounts.map((X) => [X.measurement.id, X.amount])
2124
- ), yn = new Set(D.unit.measurements.map((X) => X.id)), $t = (X, be, Ie, tt, Pe) => {
2125
- const Ve = Number(te.toFormatString({ value: Ie })), zt = te.toFormatString({ value: be });
2126
- if (St.push({
2127
- abbrev: `(${X}) × ${zt}`,
2122
+ const yn = new Map(
2123
+ V.measurementsAmounts.map((ee) => [ee.measurement.id, ee.amount])
2124
+ ), gn = new Set(D.unit.measurements.map((ee) => ee.id)), Ft = (ee, be, Fe, nt, Pe) => {
2125
+ const Ve = Number(te.toFormatString({ value: Fe })), zt = te.toFormatString({ value: be });
2126
+ if (It.push({
2127
+ abbrev: `(${ee}) × ${zt}`,
2128
2128
  amount: Ve,
2129
- variant: Pe ? "orphan" : tt ? "inactive" : "normal"
2129
+ variant: Pe ? "orphan" : nt ? "inactive" : "normal"
2130
2130
  }), !Ve) return;
2131
- const gn = Number(
2132
- te.toFormatString({ value: rt(Ie, be) })
2131
+ const bn = Number(
2132
+ te.toFormatString({ value: lt(Fe, be) })
2133
2133
  );
2134
2134
  yt.push({
2135
- label: Pe ? `${Ve} ${X}` : `${Ve} ${X} × ${zt} ${D.unit.abbrev}`,
2135
+ label: Pe ? `${Ve} ${ee}` : `${Ve} ${ee} × ${zt} ${D.unit.abbrev}`,
2136
2136
  amount: Ve,
2137
- abbrev: X,
2138
- subtotal: gn,
2139
- inactive: tt,
2137
+ abbrev: ee,
2138
+ subtotal: bn,
2139
+ inactive: nt,
2140
2140
  orphan: Pe,
2141
2141
  counted: !Pe
2142
2142
  });
2143
2143
  };
2144
- for (const X of D.unit.measurements) {
2145
- const be = vn.get(X.id);
2146
- be && $t(X.abbrev, X.conversion, be, tn(X, we.value), !1);
2144
+ for (const ee of D.unit.measurements) {
2145
+ const be = yn.get(ee.id);
2146
+ be && Ft(ee.abbrev, ee.conversion, be, tn(ee, we.value), !1);
2147
2147
  }
2148
- for (const X of V.measurementsAmounts)
2149
- yn.has(X.measurement.id) || $t(X.measurement.abbrev, X.measurement.conversion, X.amount, !1, !0);
2148
+ for (const ee of V.measurementsAmounts)
2149
+ gn.has(ee.measurement.id) || Ft(ee.measurement.abbrev, ee.measurement.conversion, ee.amount, !1, !0);
2150
2150
  return {
2151
2151
  id: D._id,
2152
2152
  code: D.code,
2153
2153
  name: D.name,
2154
2154
  costUnit: ((Nt = (Vt = D.defaultCost) == null ? void 0 : Vt.measurement) == null ? void 0 : Nt.abbrev) ?? null,
2155
2155
  baseUnit: D.unit.abbrev,
2156
- baseUnitAmount: et,
2157
- measurements: St,
2156
+ baseUnitAmount: tt,
2157
+ measurements: It,
2158
2158
  breakdown: yt,
2159
2159
  systemBalance: pt,
2160
2160
  physicalBalance: vt,
2161
2161
  adjustedAmount: Number(te.toFormatString({ value: ke })),
2162
- adjustedDiffPercentage: Xe ? Number(
2162
+ adjustedDiffPercentage: et ? Number(
2163
2163
  te.toFormatString({
2164
- value: en(Xe, 2)
2164
+ value: en(et, 2)
2165
2165
  })
2166
2166
  ) : null,
2167
- isTemplateItem: !l[D._id],
2167
+ isTemplateItem: !a[D._id],
2168
2168
  costPerUnit: O,
2169
2169
  opening: ge,
2170
- varianceQty: Ct,
2171
- varianceInCost: mn,
2172
- stockTakeValue: fn,
2173
- systemValue: pn,
2170
+ varianceQty: $t,
2171
+ varianceInCost: fn,
2172
+ stockTakeValue: pn,
2173
+ systemValue: vn,
2174
2174
  adjustmentAmounts: U,
2175
2175
  customAttributeValues: D.customAttributes ?? {}
2176
2176
  };
2177
- }).filter((D) => !!(D.isTemplateItem && z.value.templateItem || !D.isTemplateItem && z.value.nonTemplateItem));
2178
- }), cn = M(
2179
- () => dt.value.some((l) => l.measurements.some((e) => e.variant !== "normal"))
2177
+ });
2178
+ }), Qe = M(() => cn.value.filter((a) => !!(a.isTemplateItem && z.value.templateItem || !a.isTemplateItem && z.value.nonTemplateItem))), Dt = M(
2179
+ () => Qe.value.some((a) => a.measurements.some((e) => e.variant === "inactive"))
2180
+ ), At = M(
2181
+ () => Qe.value.some((a) => a.measurements.some((e) => e.variant === "orphan"))
2182
+ ), un = M(
2183
+ () => Dt.value || At.value
2180
2184
  ), mt = M(() => {
2181
- const l = /* @__PURE__ */ new Set();
2185
+ const a = /* @__PURE__ */ new Set();
2182
2186
  for (const e of se.value)
2183
2187
  if (e.customAttributes)
2184
2188
  for (const d of Object.keys(e.customAttributes))
2185
- d !== "tag" && l.add(d);
2186
- return Array.from(l).sort();
2187
- }), Qe = Et({}), Dt = M(
2188
- () => mt.value.filter((l) => Qe[l])
2189
- ), un = M(() => {
2190
- var e, d, T, D, V;
2189
+ d !== "tag" && a.add(d);
2190
+ return Array.from(a).sort();
2191
+ }), Ze = Et({}), Ct = M(
2192
+ () => mt.value.filter((a) => Ze[a])
2193
+ ), dn = M(() => {
2194
+ var e, d, j, D, V;
2191
2195
  if (!t.draft) return [];
2192
- const l = t.draft.approvedAt ? {
2196
+ const a = t.draft.approvedAt ? {
2193
2197
  action: `Approve at ${Ce(t.draft.approvedAt)}`,
2194
2198
  // actionAt: props.draft.approvedAt,
2195
2199
  actionBy: t.draft.approvedBy,
@@ -2227,7 +2231,7 @@ const Ia = { class: "w-full flex flex-col gap-32" }, Ba = { class: "flex flex-co
2227
2231
  },
2228
2232
  {
2229
2233
  label: "Effective at",
2230
- value: Ce(t.draft.effectiveAt ?? Te((T = t.draft) == null ? void 0 : T._id))
2234
+ value: Ce(t.draft.effectiveAt ?? Te((j = t.draft) == null ? void 0 : j._id))
2231
2235
  },
2232
2236
  {
2233
2237
  label: "Using template",
@@ -2237,17 +2241,17 @@ const Ia = { class: "w-full flex flex-col gap-32" }, Ba = { class: "flex flex-co
2237
2241
  label: "Remark",
2238
2242
  value: t.draft.remark
2239
2243
  } : null,
2240
- l ? {
2244
+ a ? {
2241
2245
  label: "Last action",
2242
- value: l.action
2246
+ value: a.action
2243
2247
  } : null,
2244
- l && l.actionBy ? {
2248
+ a && a.actionBy ? {
2245
2249
  label: "Last action by",
2246
- value: (V = l.actionBy) == null ? void 0 : V.name
2250
+ value: (V = a.actionBy) == null ? void 0 : V.name
2247
2251
  } : null,
2248
- l && l.remark ? {
2252
+ a && a.remark ? {
2249
2253
  label: "Action remark",
2250
- value: l.remark
2254
+ value: a.remark
2251
2255
  } : null
2252
2256
  ].filter((C) => C).map((C) => C);
2253
2257
  }), ft = [
@@ -2259,29 +2263,29 @@ const Ia = { class: "w-full flex flex-col gap-32" }, Ba = { class: "flex flex-co
2259
2263
  label: "Action history",
2260
2264
  value: "history"
2261
2265
  }
2262
- ], Oe = K(ft[0]), Me = M(() => {
2263
- var T, D, V;
2264
- const l = ((T = t.draft) == null ? void 0 : T.activityLogs) ?? [], e = ((D = t.draft) == null ? void 0 : D.rejectionHistory) ?? [];
2266
+ ], Oe = W(ft[0]), Ue = M(() => {
2267
+ var j, D, V;
2268
+ const a = ((j = t.draft) == null ? void 0 : j.activityLogs) ?? [], e = ((D = t.draft) == null ? void 0 : D.rejectionHistory) ?? [];
2265
2269
  for (const C of e)
2266
- l.find(
2270
+ a.find(
2267
2271
  (O) => `${O.action}_${O.performedAt}` == `${oe.enum.rejectDraft}_${C.rejectedAt}`
2268
- ) || l.push({
2272
+ ) || a.push({
2269
2273
  action: oe.enum.rejectDraft,
2270
2274
  performedAt: C.rejectedAt,
2271
2275
  performedBy: C.rejectedBy,
2272
2276
  remark: C.rejectRemark
2273
2277
  });
2274
- return (V = t.draft) != null && V.approvedAt && (l.find(
2278
+ return (V = t.draft) != null && V.approvedAt && (a.find(
2275
2279
  (J) => {
2276
2280
  var O;
2277
2281
  return `${J.action}_${J.performedAt}` == `${oe.enum.approveDraft}_${(O = t.draft) == null ? void 0 : O.approvedAt}`;
2278
2282
  }
2279
- ) || l.push({
2283
+ ) || a.push({
2280
2284
  action: oe.enum.approveDraft,
2281
2285
  performedAt: t.draft.approvedAt,
2282
2286
  performedBy: t.draft.approvedBy ?? { name: "Unknown", id: "unknown" },
2283
2287
  remark: t.draft.approveRemark
2284
- })), l.sort((C, J) => new Date(J.performedAt).getTime() - new Date(C.performedAt).getTime()).map(
2288
+ })), a.sort((C, J) => new Date(J.performedAt).getTime() - new Date(C.performedAt).getTime()).map(
2285
2289
  (C) => ({
2286
2290
  header: Be(C.action),
2287
2291
  date: Ce(C.performedAt),
@@ -2297,46 +2301,46 @@ const Ia = { class: "w-full flex flex-col gap-32" }, Ba = { class: "flex flex-co
2297
2301
  ]
2298
2302
  })
2299
2303
  );
2300
- }), Ze = K(!1), Je = K(!1), At = M(() => {
2301
- var l;
2302
- return ((l = t.draft) == null ? void 0 : l.status) !== _e.enum.DRAFT ? "Status is not draft." : null;
2304
+ }), Je = W(!1), Xe = W(!1), St = M(() => {
2305
+ var a;
2306
+ return ((a = t.draft) == null ? void 0 : a.status) !== _e.enum.DRAFT ? "Status is not draft." : null;
2303
2307
  });
2304
- function dn() {
2305
- t.draft && (Je.value = !0, s.approveDraft(
2308
+ function mn() {
2309
+ t.draft && (Xe.value = !0, r.approveDraft(
2306
2310
  t.draft,
2307
2311
  () => {
2308
- Je.value = !1, Ze.value = !1, m("submitted");
2312
+ Xe.value = !1, Je.value = !1, m("submitted");
2309
2313
  },
2310
2314
  () => {
2311
- Je.value = !1;
2315
+ Xe.value = !1;
2312
2316
  }
2313
2317
  ));
2314
2318
  }
2315
- return (l, e) => {
2316
- const d = Z("FmButtonGroup"), T = Z("FmMenuDivider"), D = Z("FmCard"), V = Z("FmIcon"), C = Z("FmButton"), J = Z("FmCircularProgress"), O = Z("FmChip"), q = Z("FmTextField"), me = Z("FmTable"), Ae = Z("FmSpacer"), ge = Z("FmTooltip"), Fe = Z("FmSideSheet");
2317
- return w(), j(ce, null, [
2318
- $(Fe, {
2319
+ return (a, e) => {
2320
+ const d = Z("FmButtonGroup"), j = Z("FmMenuDivider"), D = Z("FmCard"), V = Z("FmIcon"), C = Z("FmButton"), J = Z("FmCircularProgress"), O = Z("FmChip"), G = Z("FmTextField"), me = Z("FmTable"), Ae = Z("FmSpacer"), ge = Z("FmTooltip"), Ie = Z("FmSideSheet");
2321
+ return h(), T(ce, null, [
2322
+ $(Ie, {
2319
2323
  "dismiss-away": "",
2320
2324
  "max-width": 9999,
2321
2325
  "model-value": u(c),
2322
2326
  "onUpdate:modelValue": e[9] || (e[9] = (U) => _t(c) ? c.value = U : null),
2323
2327
  header: "Closing details"
2324
2328
  }, {
2325
- "side-sheet-footer": ee(() => {
2329
+ "side-sheet-footer": X(() => {
2326
2330
  var U, ue, fe, ke;
2327
2331
  return [
2328
- a("div", po, [
2329
- a("div", vo, [
2330
- ((U = t.draft) == null ? void 0 : U.status) === u(_e).enum.DRAFT ? (w(), j(ce, { key: 0 }, [
2331
- At.value ? (w(), ae(ge, {
2332
+ o("div", ho, [
2333
+ o("div", ko, [
2334
+ ((U = t.draft) == null ? void 0 : U.status) === u(_e).enum.DRAFT ? (h(), T(ce, { key: 0 }, [
2335
+ St.value ? (h(), ae(ge, {
2332
2336
  key: 0,
2333
2337
  "z-index": 51,
2334
2338
  placement: "right"
2335
2339
  }, {
2336
- content: ee(() => [
2337
- de(H(At.value), 1)
2340
+ content: X(() => [
2341
+ de(H(St.value), 1)
2338
2342
  ]),
2339
- default: ee(() => [
2343
+ default: X(() => [
2340
2344
  $(C, {
2341
2345
  disabled: "",
2342
2346
  key: "approve key",
@@ -2344,64 +2348,64 @@ const Ia = { class: "w-full flex flex-col gap-32" }, Ba = { class: "flex flex-co
2344
2348
  })
2345
2349
  ]),
2346
2350
  _: 1
2347
- })) : (w(), ae(C, {
2351
+ })) : (h(), ae(C, {
2348
2352
  key: "approve key",
2349
2353
  label: "Approve",
2350
- onClick: e[5] || (e[5] = (Re) => Ze.value = !0)
2354
+ onClick: e[5] || (e[5] = (Re) => Je.value = !0)
2351
2355
  }))
2352
- ], 64)) : G("", !0),
2353
- ((ue = t.draft) == null ? void 0 : ue.status) === u(_e).enum.DRAFT ? (w(), ae(C, {
2356
+ ], 64)) : K("", !0),
2357
+ ((ue = t.draft) == null ? void 0 : ue.status) === u(_e).enum.DRAFT ? (h(), ae(C, {
2354
2358
  key: 1,
2355
2359
  label: "Reject",
2356
2360
  variant: "destructive",
2357
- onClick: e[6] || (e[6] = () => t.draft && u(s).rejectDraft(t.draft, () => m("submitted")))
2358
- })) : G("", !0),
2361
+ onClick: e[6] || (e[6] = () => t.draft && u(r).rejectDraft(t.draft, () => m("submitted")))
2362
+ })) : K("", !0),
2359
2363
  $(C, {
2360
2364
  label: "Close",
2361
2365
  variant: "tertiary",
2362
2366
  onClick: e[7] || (e[7] = (Re) => c.value = !1)
2363
2367
  }),
2364
- (fe = t.draft) != null && fe.approvedAt && ((ke = t.draft) == null ? void 0 : ke.status) !== u(_e).enum.COMPLETED ? (w(), ae(gt, { key: 2 }, {
2365
- default: ee(() => [
2368
+ (fe = t.draft) != null && fe.approvedAt && ((ke = t.draft) == null ? void 0 : ke.status) !== u(_e).enum.COMPLETED ? (h(), ae(gt, { key: 2 }, {
2369
+ default: X(() => [
2366
2370
  $(C, {
2367
2371
  label: "Sync",
2368
2372
  loading: A.value,
2369
2373
  onClick: e[8] || (e[8] = () => {
2370
- t.draft && (A.value = !0, u(s).syncDraft(t.draft, () => {
2374
+ t.draft && (A.value = !0, u(r).syncDraft(t.draft, () => {
2371
2375
  A.value = !1, m("submitted");
2372
2376
  }));
2373
2377
  })
2374
2378
  }, null, 8, ["loading"])
2375
2379
  ]),
2376
2380
  _: 1
2377
- })) : G("", !0)
2381
+ })) : K("", !0)
2378
2382
  ]),
2379
- a("div", yo, [
2380
- e[22] || (e[22] = a("div", { class: "text-xs text-gray-500 uppercase tracking-wide" }, "Total stock take value", -1)),
2381
- a("div", go, H(o.value) + " " + H(xe.value.toFixed(2)), 1)
2383
+ o("div", _o, [
2384
+ e[23] || (e[23] = o("div", { class: "text-xs text-gray-500 uppercase tracking-wide" }, "Total stock take value", -1)),
2385
+ o("div", wo, H(s.value) + " " + H(xe.value.toFixed(2)), 1)
2382
2386
  ])
2383
2387
  ])
2384
2388
  ];
2385
2389
  }),
2386
- default: ee(() => [
2387
- a("div", Ia, [
2388
- a("div", null, [
2390
+ default: X(() => [
2391
+ o("div", Ba, [
2392
+ o("div", null, [
2389
2393
  $(d, {
2390
2394
  items: ft,
2391
2395
  modelValue: Oe.value,
2392
2396
  "onUpdate:modelValue": e[0] || (e[0] = (U) => Oe.value = U)
2393
2397
  }, null, 8, ["modelValue"])
2394
2398
  ]),
2395
- Oe.value.value === "overview" ? (w(), j(ce, { key: 0 }, [
2399
+ Oe.value.value === "overview" ? (h(), T(ce, { key: 0 }, [
2396
2400
  $(gt, { selectable: "" }, {
2397
- default: ee(() => {
2401
+ default: X(() => {
2398
2402
  var U;
2399
2403
  return [
2400
- a("div", Ba, [
2401
- e[11] || (e[11] = a("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, [
2402
- a("div", { class: "flex gap-1" }, "Draft ID")
2404
+ o("div", Ta, [
2405
+ e[11] || (e[11] = o("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, [
2406
+ o("div", { class: "flex gap-1" }, "Draft ID")
2403
2407
  ], -1)),
2404
- de(" " + H((U = l.draft) == null ? void 0 : U._id), 1)
2408
+ de(" " + H((U = a.draft) == null ? void 0 : U._id), 1)
2405
2409
  ])
2406
2410
  ];
2407
2411
  }),
@@ -2411,52 +2415,55 @@ const Ia = { class: "w-full flex flex-col gap-32" }, Ba = { class: "flex flex-co
2411
2415
  variant: "outlined",
2412
2416
  class: "flex flex-col gap-8 px-12 py-16"
2413
2417
  }, {
2414
- default: ee(() => {
2418
+ default: X(() => {
2415
2419
  var U, ue;
2416
2420
  return [
2417
- a("div", Ta, [
2418
- e[12] || (e[12] = a("div", { class: "fm-typo-en-body-lg-600" }, "Closing summary", -1)),
2419
- a("div", ja, [
2420
- a("div", {
2421
- class: Se(["fm-status-badge", u(ot)(((U = l.draft) == null ? void 0 : U.status) ?? "DRAFT")])
2422
- }, H(u(Be)(((ue = l.draft) == null ? void 0 : ue.status) ?? "")), 3)
2421
+ o("div", ja, [
2422
+ e[12] || (e[12] = o("div", { class: "fm-typo-en-body-lg-600" }, "Closing summary", -1)),
2423
+ o("div", Ma, [
2424
+ o("div", {
2425
+ class: Se(["fm-status-badge", u(st)(((U = a.draft) == null ? void 0 : U.status) ?? "DRAFT")])
2426
+ }, H(u(Be)(((ue = a.draft) == null ? void 0 : ue.status) ?? "")), 3)
2423
2427
  ])
2424
2428
  ]),
2425
- $(T),
2426
- a("div", Ua, [
2427
- (w(!0), j(ce, null, he(un.value, (fe, ke) => (w(), j("div", {
2429
+ $(j),
2430
+ o("div", Ua, [
2431
+ (h(!0), T(ce, null, he(dn.value, (fe, ke) => (h(), T("div", {
2428
2432
  class: "flex flex-col gap-4",
2429
2433
  key: ke
2430
2434
  }, [
2431
- a("div", Ma, [
2432
- a("div", Ra, H(fe.label), 1)
2435
+ o("div", Ra, [
2436
+ o("div", Pa, H(fe.label), 1)
2433
2437
  ]),
2434
- a("div", Pa, H(fe.value), 1)
2438
+ o("div", Va, H(fe.value), 1)
2435
2439
  ]))), 128))
2436
2440
  ])
2437
2441
  ];
2438
2442
  }),
2439
2443
  _: 1
2440
2444
  }),
2441
- cn.value ? (w(), j("div", Va, [
2445
+ un.value ? (h(), T("div", Na, [
2442
2446
  $(V, {
2443
2447
  name: "rule",
2444
2448
  size: "sm"
2445
2449
  }),
2446
- e[13] || (e[13] = a("div", { class: "flex flex-col gap-2" }, [
2447
- a("div", { class: "fm-typo-en-body-md-600" }, "UOM notes"),
2448
- a("div", { class: "fm-typo-en-body-sm-400" }, [
2449
- de(" Measurements highlighted in "),
2450
- a("span", { class: "font-bold" }, "purple"),
2451
- de(" are NetSuite-inactive UOMs (surfaced for audit; their amounts are part of the base total). Red highlights are UOMs not on the SKU (ignored). ")
2450
+ o("div", za, [
2451
+ e[14] || (e[14] = o("div", { class: "fm-typo-en-body-md-600" }, "UOM notes", -1)),
2452
+ o("ul", Ea, [
2453
+ Dt.value ? (h(), T("li", La, e[13] || (e[13] = [
2454
+ de(" Measurements highlighted in "),
2455
+ o("span", { class: "font-bold" }, "purple", -1),
2456
+ de(" are NetSuite-inactive UOMs (surfaced for audit; their amounts are part of the base total). ")
2457
+ ]))) : K("", !0),
2458
+ At.value ? (h(), T("li", Oa, " Red highlights are UOMs not on the SKU (ignored). ")) : K("", !0)
2452
2459
  ])
2453
- ], -1))
2454
- ])) : G("", !0),
2455
- a("div", Na, [
2456
- a("div", za, [
2457
- e[14] || (e[14] = a("div", { class: "flex-1 fm-typo-en-title-sm-600 text-fm-color-typo-primary" }, " Closing items ", -1)),
2458
- x.value ? G("", !0) : (w(), j("div", Ea, [
2459
- l.draft && l.draft.status !== u(_e).enum.COMPLETED ? (w(), ae(C, {
2460
+ ])
2461
+ ])) : K("", !0),
2462
+ o("div", Ha, [
2463
+ o("div", Ya, [
2464
+ e[15] || (e[15] = o("div", { class: "flex-1 fm-typo-en-title-sm-600 text-fm-color-typo-primary" }, " Closing items ", -1)),
2465
+ x.value ? K("", !0) : (h(), T("div", Ka, [
2466
+ a.draft && a.draft.status !== u(_e).enum.COMPLETED ? (h(), ae(C, {
2460
2467
  key: 0,
2461
2468
  label: "Refresh balance",
2462
2469
  "prepend-icon": "refresh",
@@ -2464,12 +2471,12 @@ const Ia = { class: "w-full flex flex-col gap-32" }, Ba = { class: "flex flex-co
2464
2471
  "text-color": "primary",
2465
2472
  "bg-color": "transparent",
2466
2473
  "border-color": "primary",
2467
- loading: u(_),
2468
- disabled: u(_),
2474
+ loading: u(w),
2475
+ disabled: u(w),
2469
2476
  onClick: Le
2470
- }, null, 8, ["loading", "disabled"])) : G("", !0),
2477
+ }, null, 8, ["loading", "disabled"])) : K("", !0),
2471
2478
  $(gt, null, {
2472
- default: ee(() => [
2479
+ default: X(() => [
2473
2480
  $(C, {
2474
2481
  label: "Invalidate Draft Cache",
2475
2482
  "prepend-icon": "refresh",
@@ -2477,8 +2484,8 @@ const Ia = { class: "w-full flex flex-col gap-32" }, Ba = { class: "flex flex-co
2477
2484
  "text-color": "primary",
2478
2485
  "bg-color": "transparent",
2479
2486
  "border-color": "primary",
2480
- loading: u(_),
2481
- onClick: Ue
2487
+ loading: u(w),
2488
+ onClick: Me
2482
2489
  }, null, 8, ["loading"])
2483
2490
  ]),
2484
2491
  _: 1
@@ -2490,27 +2497,27 @@ const Ia = { class: "w-full flex flex-col gap-32" }, Ba = { class: "flex flex-co
2490
2497
  "text-color": "primary",
2491
2498
  "bg-color": "transparent",
2492
2499
  "border-color": "primary",
2493
- onClick: e[1] || (e[1] = (U) => l.draft ? u(s).exportDraft(
2494
- l.draft,
2500
+ onClick: e[1] || (e[1] = (U) => a.draft ? u(r).exportDraft(
2501
+ a.draft,
2495
2502
  f.value,
2496
2503
  B.value,
2497
- Dt.value
2504
+ Ct.value
2498
2505
  ) : null)
2499
2506
  })
2500
2507
  ]))
2501
2508
  ]),
2502
- x.value ? (w(), j("div", La, [
2503
- e[16] || (e[16] = a("div", { class: "h-80" }, null, -1)),
2504
- a("div", Oa, [
2505
- a("div", null, [
2509
+ x.value ? (h(), T("div", Wa, [
2510
+ e[17] || (e[17] = o("div", { class: "h-80" }, null, -1)),
2511
+ o("div", qa, [
2512
+ o("div", null, [
2506
2513
  $(J, { size: "md" })
2507
2514
  ]),
2508
- e[15] || (e[15] = a("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, " Fetching info... ", -1))
2515
+ e[16] || (e[16] = o("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, " Fetching info... ", -1))
2509
2516
  ]),
2510
- e[17] || (e[17] = a("div", { class: "h-80" }, null, -1))
2511
- ])) : (w(), j(ce, { key: 1 }, [
2512
- a("div", Ha, [
2513
- a("div", Ya, [
2517
+ e[18] || (e[18] = o("div", { class: "h-80" }, null, -1))
2518
+ ])) : (h(), T(ce, { key: 1 }, [
2519
+ o("div", Ga, [
2520
+ o("div", Qa, [
2514
2521
  $(O, {
2515
2522
  label: "Template Item(s)",
2516
2523
  selected: z.value.templateItem,
@@ -2522,28 +2529,28 @@ const Ia = { class: "w-full flex flex-col gap-32" }, Ba = { class: "flex flex-co
2522
2529
  onClick: e[3] || (e[3] = (U) => z.value.nonTemplateItem = !z.value.nonTemplateItem)
2523
2530
  }, null, 8, ["selected"])
2524
2531
  ]),
2525
- $(q, {
2526
- modelValue: ut.value,
2527
- "onUpdate:modelValue": e[4] || (e[4] = (U) => ut.value = U),
2532
+ $(G, {
2533
+ modelValue: dt.value,
2534
+ "onUpdate:modelValue": e[4] || (e[4] = (U) => dt.value = U),
2528
2535
  placeholder: "Filter items"
2529
2536
  }, null, 8, ["modelValue"])
2530
2537
  ]),
2531
- u(k).skuTags.size ? (w(), j("div", Ka, [
2532
- (w(!0), j(ce, null, he(u(k).skuTags.keys(), (U) => (w(), ae(O, {
2538
+ u(_).skuTags.size ? (h(), T("div", Za, [
2539
+ (h(!0), T(ce, null, he(u(_).skuTags.keys(), (U) => (h(), ae(O, {
2533
2540
  key: `${U}`,
2534
2541
  label: `${U}`,
2535
2542
  selectable: "",
2536
2543
  selected: p[`${U}`],
2537
2544
  onClick: (ue) => p[`${U}`] = !p[`${U}`]
2538
2545
  }, {
2539
- default: ee(() => [
2540
- p[`${U}`] ? (w(), ae(V, {
2546
+ default: X(() => [
2547
+ p[`${U}`] ? (h(), ae(V, {
2541
2548
  key: 0,
2542
2549
  name: "check",
2543
2550
  class: "text-white",
2544
2551
  size: "sm"
2545
- })) : G("", !0),
2546
- a("span", {
2552
+ })) : K("", !0),
2553
+ o("span", {
2547
2554
  class: Se([
2548
2555
  "",
2549
2556
  {
@@ -2555,38 +2562,38 @@ const Ia = { class: "w-full flex flex-col gap-32" }, Ba = { class: "flex flex-co
2555
2562
  ]),
2556
2563
  _: 2
2557
2564
  }, 1032, ["label", "selected", "onClick"]))), 128))
2558
- ])) : G("", !0),
2559
- mt.value.length ? (w(), j("div", Wa, [
2560
- e[18] || (e[18] = a("span", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary self-center" }, "Extra columns:", -1)),
2561
- (w(!0), j(ce, null, he(mt.value, (U) => (w(), ae(O, {
2565
+ ])) : K("", !0),
2566
+ mt.value.length ? (h(), T("div", Ja, [
2567
+ e[19] || (e[19] = o("span", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary self-center" }, "Extra columns:", -1)),
2568
+ (h(!0), T(ce, null, he(mt.value, (U) => (h(), ae(O, {
2562
2569
  key: U,
2563
2570
  label: U,
2564
2571
  selectable: "",
2565
- selected: Qe[U],
2566
- onClick: (ue) => Qe[U] = !Qe[U]
2572
+ selected: Ze[U],
2573
+ onClick: (ue) => Ze[U] = !Ze[U]
2567
2574
  }, null, 8, ["label", "selected", "onClick"]))), 128))
2568
- ])) : G("", !0),
2569
- a("div", qa, [
2570
- a("div", {
2575
+ ])) : K("", !0),
2576
+ o("div", Xa, [
2577
+ o("div", {
2571
2578
  style: Ht({ height: "600px", minWidth: `${ln.value}px` })
2572
2579
  }, [
2573
2580
  $(me, {
2574
2581
  "column-defs": xt.value,
2575
- "row-data": dt.value,
2576
- "search-value": ut.value
2582
+ "row-data": Qe.value,
2583
+ "search-value": dt.value
2577
2584
  }, null, 8, ["column-defs", "row-data", "search-value"])
2578
2585
  ], 4)
2579
2586
  ])
2580
2587
  ], 64))
2581
2588
  ])
2582
- ], 64)) : G("", !0),
2583
- Oe.value.value === "history" ? (w(), j("div", Ga, [
2584
- Me.value.length ? (w(), j("div", Ja, [
2585
- (w(!0), j(ce, null, he(Me.value, (U, ue) => (w(), j(ce, { key: ue }, [
2586
- a("div", Xa, [
2587
- a("div", eo, [
2588
- a("div", to, [
2589
- a("div", {
2589
+ ], 64)) : K("", !0),
2590
+ Oe.value.value === "history" ? (h(), T("div", eo, [
2591
+ Ue.value.length ? (h(), T("div", ao, [
2592
+ (h(!0), T(ce, null, he(Ue.value, (U, ue) => (h(), T(ce, { key: ue }, [
2593
+ o("div", oo, [
2594
+ o("div", so, [
2595
+ o("div", ro, [
2596
+ o("div", {
2590
2597
  class: Se([
2591
2598
  {
2592
2599
  "bg-fm-color-primary": ue !== 0,
@@ -2596,53 +2603,53 @@ const Ia = { class: "w-full flex flex-col gap-32" }, Ba = { class: "flex flex-co
2596
2603
  ])
2597
2604
  }, null, 2)
2598
2605
  ]),
2599
- e[21] || (e[21] = a("div", { class: "h-24 w-24 bg-fm-color-primary rounded-full" }, null, -1)),
2600
- a("div", no, [
2601
- a("div", {
2606
+ e[22] || (e[22] = o("div", { class: "h-24 w-24 bg-fm-color-primary rounded-full" }, null, -1)),
2607
+ o("div", lo, [
2608
+ o("div", {
2602
2609
  class: Se([
2603
2610
  {
2604
- "bg-fm-color-primary": ue < Me.value.length - 1,
2605
- "bg-white": ue >= Me.value.length - 1
2611
+ "bg-fm-color-primary": ue < Ue.value.length - 1,
2612
+ "bg-white": ue >= Ue.value.length - 1
2606
2613
  },
2607
2614
  "w-[2px] h-full"
2608
2615
  ])
2609
2616
  }, null, 2)
2610
2617
  ])
2611
2618
  ]),
2612
- a("div", ao, [
2613
- a("div", oo, H(U.header), 1),
2614
- a("div", so, H(U.date), 1)
2619
+ o("div", io, [
2620
+ o("div", co, H(U.header), 1),
2621
+ o("div", uo, H(U.date), 1)
2615
2622
  ])
2616
2623
  ]),
2617
- a("div", ro, [
2618
- a("div", lo, [
2619
- a("div", io, [
2620
- a("div", {
2624
+ o("div", mo, [
2625
+ o("div", fo, [
2626
+ o("div", po, [
2627
+ o("div", {
2621
2628
  class: Se([
2622
2629
  {
2623
- "bg-fm-color-primary": ue < Me.value.length - 1,
2624
- "bg-white": ue >= Me.value.length - 1
2630
+ "bg-fm-color-primary": ue < Ue.value.length - 1,
2631
+ "bg-white": ue >= Ue.value.length - 1
2625
2632
  },
2626
2633
  "w-[2px] h-full"
2627
2634
  ])
2628
2635
  }, null, 2)
2629
2636
  ])
2630
2637
  ]),
2631
- a("div", co, [
2638
+ o("div", vo, [
2632
2639
  $(D, {
2633
2640
  variant: "outlined",
2634
2641
  class: "py-12 px-16"
2635
2642
  }, {
2636
- default: ee(() => [
2637
- a("div", uo, [
2638
- (w(!0), j(ce, null, he(U.info, (fe, ke) => (w(), j("div", {
2643
+ default: X(() => [
2644
+ o("div", yo, [
2645
+ (h(!0), T(ce, null, he(U.info, (fe, ke) => (h(), T("div", {
2639
2646
  key: ke,
2640
2647
  class: "flex flex-col gap-4"
2641
2648
  }, [
2642
- a("div", mo, H(fe == null ? void 0 : fe.label), 1),
2643
- a("div", fo, [
2644
- (w(!0), j(ce, null, he(fe == null ? void 0 : fe.values, (Re, Xe) => (w(), j("div", {
2645
- key: Xe,
2649
+ o("div", go, H(fe == null ? void 0 : fe.label), 1),
2650
+ o("div", bo, [
2651
+ (h(!0), T(ce, null, he(fe == null ? void 0 : fe.values, (Re, et) => (h(), T("div", {
2652
+ key: et,
2646
2653
  class: "fm-typo-en-body-lg-600"
2647
2654
  }, H(Re), 1))), 128))
2648
2655
  ])
@@ -2654,93 +2661,93 @@ const Ia = { class: "w-full flex flex-col gap-32" }, Ba = { class: "flex flex-co
2654
2661
  ])
2655
2662
  ])
2656
2663
  ], 64))), 128))
2657
- ])) : (w(), j("div", Qa, [
2664
+ ])) : (h(), T("div", to, [
2658
2665
  $(Ae),
2659
- a("div", null, [
2660
- a("img", {
2661
- src: u(zn),
2666
+ o("div", null, [
2667
+ o("img", {
2668
+ src: u(En),
2662
2669
  alt: "List is empty"
2663
- }, null, 8, Za)
2670
+ }, null, 8, no)
2664
2671
  ]),
2665
- e[19] || (e[19] = a("div", { class: "fm-typo-en-body-lg-600" }, H("No records found"), -1)),
2666
- e[20] || (e[20] = a("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary px-16" }, H("You can track approval and rejection history here"), -1)),
2672
+ e[20] || (e[20] = o("div", { class: "fm-typo-en-body-lg-600" }, H("No records found"), -1)),
2673
+ e[21] || (e[21] = o("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary px-16" }, H("You can track approval and rejection history here"), -1)),
2667
2674
  $(Ae),
2668
2675
  $(Ae)
2669
2676
  ]))
2670
- ])) : G("", !0)
2677
+ ])) : K("", !0)
2671
2678
  ])
2672
2679
  ]),
2673
2680
  _: 1
2674
2681
  }, 8, ["model-value"]),
2675
- u(c) && t.draft ? (w(), ae($a, {
2682
+ u(c) && t.draft ? (h(), ae(Ia, {
2676
2683
  key: 0,
2677
- show: Ze.value,
2678
- "onUpdate:show": e[10] || (e[10] = (U) => Ze.value = U),
2679
- refreshing: u(_),
2680
- approving: Je.value,
2684
+ show: Je.value,
2685
+ "onUpdate:show": e[10] || (e[10] = (U) => Je.value = U),
2686
+ refreshing: u(w),
2687
+ approving: Xe.value,
2681
2688
  draft: t.draft,
2682
2689
  onRefresh: Le,
2683
- onApprove: dn
2684
- }, null, 8, ["show", "refreshing", "approving", "draft"])) : G("", !0)
2690
+ onApprove: mn
2691
+ }, null, 8, ["show", "refreshing", "approving", "draft"])) : K("", !0)
2685
2692
  ], 64);
2686
2693
  };
2687
2694
  }
2688
2695
  });
2689
2696
  var ve = /* @__PURE__ */ ((n) => (n.ready = "ready", n.negative = "negative", n.systemNegative = "systemNegative", n))(ve || {});
2690
- async function ho(n) {
2691
- return new Promise((r, t) => {
2692
- const o = new FileReader();
2693
- o.onload = (g) => {
2697
+ async function Do(n) {
2698
+ return new Promise((l, t) => {
2699
+ const s = new FileReader();
2700
+ s.onload = (g) => {
2694
2701
  var i;
2695
2702
  try {
2696
- const s = (i = g.target) == null ? void 0 : i.result, c = On(s, { type: "array" }), x = c.SheetNames[0], A = c.Sheets[x], f = at.sheet_to_json(A, {
2703
+ const r = (i = g.target) == null ? void 0 : i.result, c = Hn(r, { type: "array" }), x = c.SheetNames[0], A = c.Sheets[x], f = ot.sheet_to_json(A, {
2697
2704
  header: 1,
2698
2705
  defval: ""
2699
2706
  }), B = (v) => String(v).trim().toLowerCase().replace(/^\uFEFF/, ""), N = f.findIndex(
2700
2707
  (v) => v.some((m) => B(m) === "code")
2701
2708
  );
2702
2709
  if (N === -1) {
2703
- r([]);
2710
+ l([]);
2704
2711
  return;
2705
2712
  }
2706
- const E = f[N], I = E.findIndex((v) => B(v) === "code"), k = E.findIndex((v) => B(v) === "balance");
2707
- if (I === -1 || k === -1) {
2713
+ const E = f[N], F = E.findIndex((v) => B(v) === "code"), _ = E.findIndex((v) => B(v) === "balance");
2714
+ if (F === -1 || _ === -1) {
2708
2715
  t(
2709
2716
  new Error(
2710
- `Missing required columns: ${I === -1 ? '"Code" ' : ""}${k === -1 ? '"Balance"' : ""}.`.trim()
2717
+ `Missing required columns: ${F === -1 ? '"Code" ' : ""}${_ === -1 ? '"Balance"' : ""}.`.trim()
2711
2718
  )
2712
2719
  );
2713
2720
  return;
2714
2721
  }
2715
- const p = f.slice(N + 1).filter((v) => String(v[I]).trim()).map((v) => ({
2716
- itemCode: String(v[I]).trim(),
2717
- quantity: Number(v[k]) || 0
2722
+ const p = f.slice(N + 1).filter((v) => String(v[F]).trim()).map((v) => ({
2723
+ itemCode: String(v[F]).trim(),
2724
+ quantity: Number(v[_]) || 0
2718
2725
  }));
2719
- r(p);
2720
- } catch (s) {
2721
- t(s);
2726
+ l(p);
2727
+ } catch (r) {
2728
+ t(r);
2722
2729
  }
2723
- }, o.onerror = t, o.readAsArrayBuffer(n);
2730
+ }, s.onerror = t, s.readAsArrayBuffer(n);
2724
2731
  });
2725
2732
  }
2726
- function ko(n) {
2727
- const r = /* @__PURE__ */ new Map();
2733
+ function Ao(n) {
2734
+ const l = /* @__PURE__ */ new Map();
2728
2735
  return n.forEach((t) => {
2729
- const o = r.get(t.itemCode) || 0;
2730
- r.set(t.itemCode, o + t.quantity);
2731
- }), r;
2736
+ const s = l.get(t.itemCode) || 0;
2737
+ l.set(t.itemCode, s + t.quantity);
2738
+ }), l;
2732
2739
  }
2733
- function _o(n, r) {
2734
- const t = [], o = [];
2735
- for (const [g, i] of r.entries()) {
2736
- const s = n[g];
2737
- if (!s) {
2738
- o.push(g);
2740
+ function Co(n, l) {
2741
+ const t = [], s = [];
2742
+ for (const [g, i] of l.entries()) {
2743
+ const r = n[g];
2744
+ if (!r) {
2745
+ s.push(g);
2739
2746
  continue;
2740
2747
  }
2741
2748
  const c = i < 0 ? "negative" : "ready";
2742
2749
  t.push({
2743
- sku: s,
2750
+ sku: r,
2744
2751
  physicalCount: i,
2745
2752
  // Note: filled by composable after readStockBalance()
2746
2753
  systemBalance: { amount: 0, precision: 0 },
@@ -2748,23 +2755,23 @@ function _o(n, r) {
2748
2755
  status: c
2749
2756
  });
2750
2757
  }
2751
- return { mergedItems: t, unrecognisedItemCodes: o };
2758
+ return { mergedItems: t, unrecognisedItemCodes: s };
2752
2759
  }
2753
- function wo(n, r) {
2754
- const t = n.filter((x) => !x.isInactive), o = Yn().format("YYYY-MM-DD"), g = `${r} - ${o}.csv`, i = [
2760
+ function So(n, l) {
2761
+ const t = n.filter((x) => !x.isInactive), s = Kn().format("YYYY-MM-DD"), g = `${l} - ${s}.csv`, i = [
2755
2762
  ["Code", "Name", "Balance"],
2756
2763
  ...t.map((x) => [x.code, x.name, ""])
2757
- ], s = at.aoa_to_sheet(i), c = at.book_new();
2758
- at.book_append_sheet(c, s, "Template"), Hn(c, g, { bookType: "csv" });
2764
+ ], r = ot.aoa_to_sheet(i), c = ot.book_new();
2765
+ ot.book_append_sheet(c, r, "Template"), Yn(c, g, { bookType: "csv" });
2759
2766
  }
2760
- function xo() {
2761
- const n = K([]), r = K([]), t = K(!1), o = wt(), g = We(), i = it(), s = M(
2767
+ function $o() {
2768
+ const n = W([]), l = W([]), t = W(!1), s = wt(), g = We(), i = ct(), r = M(
2762
2769
  () => n.value.some((f) => f.status === ve.negative)
2763
2770
  );
2764
2771
  async function c(f) {
2765
- n.value = [], r.value = [], t.value = !0;
2772
+ n.value = [], l.value = [], t.value = !0;
2766
2773
  try {
2767
- const B = await ho(f), N = ko(B), E = o.skuByCode, { mergedItems: I, unrecognisedItemCodes: k } = _o(
2774
+ const B = await Do(f), N = Ao(B), E = s.skuByCode, { mergedItems: F, unrecognisedItemCodes: _ } = Co(
2768
2775
  E,
2769
2776
  N
2770
2777
  ), R = await i.readStockBalance(), p = R.skus ?? [];
@@ -2776,27 +2783,27 @@ function xo() {
2776
2783
  );
2777
2784
  const v = new Map(
2778
2785
  p.map((b) => [b.id, b.balance])
2779
- ), m = new Set(I.map((b) => b.sku._id));
2780
- n.value = I.map((b) => {
2781
- const y = v.get(b.sku._id) ?? { amount: 0, precision: 0 }, _ = y.amount / Math.pow(10, y.precision);
2782
- return { ...b, systemBalance: y, variance: b.physicalCount - _ };
2786
+ ), m = new Set(F.map((b) => b.sku._id));
2787
+ n.value = F.map((b) => {
2788
+ const y = v.get(b.sku._id) ?? { amount: 0, precision: 0 }, w = y.amount / Math.pow(10, y.precision);
2789
+ return { ...b, systemBalance: y, variance: b.physicalCount - w };
2783
2790
  });
2784
- for (const b of Object.values(o.skuByCode)) {
2791
+ for (const b of Object.values(s.skuByCode)) {
2785
2792
  if (m.has(b._id)) continue;
2786
2793
  const y = v.get(b._id);
2787
2794
  if (!y) continue;
2788
- const _ = y.amount / Math.pow(10, y.precision);
2789
- _ >= 0 || n.value.push({
2795
+ const w = y.amount / Math.pow(10, y.precision);
2796
+ w >= 0 || n.value.push({
2790
2797
  sku: b,
2791
2798
  physicalCount: 0,
2792
2799
  systemBalance: y,
2793
- variance: 0 - _,
2800
+ variance: 0 - w,
2794
2801
  status: ve.systemNegative
2795
2802
  });
2796
2803
  }
2797
- r.value = k;
2804
+ l.value = _;
2798
2805
  } catch (B) {
2799
- n.value = [], r.value = [], console.error("Error processing uploaded file", { error: B });
2806
+ n.value = [], l.value = [], console.error("Error processing uploaded file", { error: B });
2800
2807
  } finally {
2801
2808
  t.value = !1;
2802
2809
  }
@@ -2813,34 +2820,34 @@ function xo() {
2813
2820
  },
2814
2821
  baseAmount: Qt(p.physicalCount, p.sku.unit.precision),
2815
2822
  measurementsAmounts: []
2816
- }), I = B.map(E), k = N.map(E), R = {
2823
+ }), F = B.map(E), _ = N.map(E), R = {
2817
2824
  effectiveAt: (/* @__PURE__ */ new Date()).toISOString(),
2818
- items: I,
2819
- negativeStockItems: k
2825
+ items: F,
2826
+ negativeStockItems: _
2820
2827
  };
2821
2828
  return await f.createQuickModeDraftWithItems(R);
2822
2829
  }
2823
2830
  function A() {
2824
2831
  var B;
2825
2832
  const f = ((B = g.currentLocation) == null ? void 0 : B.name) ?? "template";
2826
- wo(o.skus, f);
2833
+ So(s.skus, f);
2827
2834
  }
2828
- return { mergedItems: n, unrecognisedItemCodes: r, hasBlockingErrors: s, isLoading: t, onFileUpload: c, submit: x, downloadTemplate: A };
2835
+ return { mergedItems: n, unrecognisedItemCodes: l, hasBlockingErrors: r, isLoading: t, onFileUpload: c, submit: x, downloadTemplate: A };
2829
2836
  }
2830
- const Do = { class: "flex flex-col gap-16" }, Ao = {
2837
+ const Io = { class: "flex flex-col gap-16" }, Fo = {
2831
2838
  key: 0,
2832
2839
  class: "px-16 py-12 rounded-8 bg-fm-color-danger-weak text-fm-color-danger-default"
2833
- }, Co = { key: 1 }, So = { class: "fm-typo-en-label-md-400 cursor-pointer" }, $o = { class: "mt-8 flex flex-col gap-4" }, Fo = { key: 2 }, Io = { class: "fm-typo-en-label-md-400 cursor-pointer" }, Bo = { class: "mt-8 flex flex-col gap-4" }, To = /* @__PURE__ */ je({
2840
+ }, Bo = { key: 1 }, To = { class: "fm-typo-en-label-md-400 cursor-pointer" }, jo = { class: "mt-8 flex flex-col gap-4" }, Mo = { key: 2 }, Uo = { class: "fm-typo-en-label-md-400 cursor-pointer" }, Ro = { class: "mt-8 flex flex-col gap-4" }, Po = /* @__PURE__ */ je({
2834
2841
  __name: "ClosingDraftCreatePreviewTable",
2835
2842
  props: {
2836
2843
  items: {},
2837
2844
  unrecognisedItemCodes: {}
2838
2845
  },
2839
2846
  setup(n) {
2840
- const r = n, { t } = Ye(), o = M(
2841
- () => r.items.filter((c) => c.status === ve.negative)
2847
+ const l = n, { t } = Ye(), s = M(
2848
+ () => l.items.filter((c) => c.status === ve.negative)
2842
2849
  ), g = M(
2843
- () => r.items.filter((c) => c.status === ve.systemNegative)
2850
+ () => l.items.filter((c) => c.status === ve.systemNegative)
2844
2851
  ), i = M(() => ({
2845
2852
  [ve.negative]: {
2846
2853
  bgColor: "bg-fm-color-danger-weak",
@@ -2854,7 +2861,7 @@ const Do = { class: "flex flex-col gap-16" }, Ao = {
2854
2861
  icon: "⚠️",
2855
2862
  label: t("inventory.closing.draft.createDraft.previewTable.status.systemNegative")
2856
2863
  }
2857
- })), s = [
2864
+ })), r = [
2858
2865
  {
2859
2866
  id: "name",
2860
2867
  header: () => t("inventory.ingredient.name"),
@@ -2872,7 +2879,7 @@ const Do = { class: "flex flex-col gap-16" }, Ao = {
2872
2879
  size: 180,
2873
2880
  cell: (c) => {
2874
2881
  const x = c.row.original;
2875
- return h("div", ne(x.systemBalance));
2882
+ return k("div", ne(x.systemBalance));
2876
2883
  }
2877
2884
  },
2878
2885
  {
@@ -2880,7 +2887,7 @@ const Do = { class: "flex flex-col gap-16" }, Ao = {
2880
2887
  header: () => t("inventory.closing.draft.createDraft.previewTable.stockTakeBalance"),
2881
2888
  cell: (c) => {
2882
2889
  const x = c.row.original;
2883
- return h("div", ne(x.physicalCount));
2890
+ return k("div", ne(x.physicalCount));
2884
2891
  }
2885
2892
  },
2886
2893
  {
@@ -2888,7 +2895,7 @@ const Do = { class: "flex flex-col gap-16" }, Ao = {
2888
2895
  header: () => t("inventory.closing.draft.createDraft.previewTable.variance"),
2889
2896
  cell: (c) => {
2890
2897
  const A = c.row.original.variance, f = A < 0 ? "text-fm-color-danger-default" : A > 0 ? "text-fm-color-success-default" : "";
2891
- return h("span", { class: f }, ne(A));
2898
+ return k("span", { class: f }, ne(A));
2892
2899
  }
2893
2900
  },
2894
2901
  {
@@ -2901,21 +2908,21 @@ const Do = { class: "flex flex-col gap-16" }, Ao = {
2901
2908
  Math.min(100, Math.round(x.variance / Math.abs(A) * 1e4) / 100)
2902
2909
  );
2903
2910
  if (f === null)
2904
- return h(
2911
+ return k(
2905
2912
  "div",
2906
2913
  { class: "flex items-center gap-4 justify-end fm-typo-en-body-md-400" },
2907
2914
  t("inventory.closing.draft.createDraft.previewTable.notApplicable")
2908
2915
  );
2909
2916
  const B = `${ne(f)}`;
2910
2917
  if (f === 0)
2911
- return h(
2918
+ return k(
2912
2919
  "div",
2913
2920
  { class: "flex items-center gap-4 justify-end fm-typo-en-body-md-400" },
2914
2921
  B
2915
2922
  );
2916
2923
  const N = f > 0;
2917
- return h("div", { class: "flex items-center gap-4 justify-end fm-typo-en-body-md-400" }, [
2918
- h(pe.FmIcon, {
2924
+ return k("div", { class: "flex items-center gap-4 justify-end fm-typo-en-body-md-400" }, [
2925
+ k(pe.FmIcon, {
2919
2926
  name: N ? "arrow_drop_up" : "arrow_drop_down",
2920
2927
  color: N ? "system-success-300" : "system-error-300",
2921
2928
  size: "md"
@@ -2929,7 +2936,7 @@ const Do = { class: "flex flex-col gap-16" }, Ao = {
2929
2936
  header: () => t("inventory.common.status"),
2930
2937
  cell: (c) => {
2931
2938
  const x = c.row.original.status, A = i.value[x];
2932
- return A ? h(
2939
+ return A ? k(
2933
2940
  "span",
2934
2941
  {
2935
2942
  class: `px-8 py-2 rounded-4 ${A.bgColor} ${A.textColor} fm-typo-en-label-sm-400`
@@ -2941,63 +2948,63 @@ const Do = { class: "flex flex-col gap-16" }, Ao = {
2941
2948
  ];
2942
2949
  return (c, x) => {
2943
2950
  const A = Z("FmTable");
2944
- return w(), j("div", Do, [
2945
- o.value.length > 0 ? (w(), j("div", Ao, [
2951
+ return h(), T("div", Io, [
2952
+ s.value.length > 0 ? (h(), T("div", Fo, [
2946
2953
  de(H(u(t)("inventory.closing.draft.createDraft.previewTable.cannotSubmitNegative")) + " ", 1),
2947
- a("strong", null, H(o.value.map((f) => f.sku.code).join(", ")), 1)
2948
- ])) : G("", !0),
2949
- g.value.length > 0 ? (w(), j("details", Co, [
2950
- a("summary", So, H(u(t)("inventory.closing.draft.createDraft.previewTable.systemNegativeNote", [g.value.length])), 1),
2951
- a("ul", $o, [
2952
- (w(!0), j(ce, null, he(g.value, (f) => (w(), j("li", {
2954
+ o("strong", null, H(s.value.map((f) => f.sku.code).join(", ")), 1)
2955
+ ])) : K("", !0),
2956
+ g.value.length > 0 ? (h(), T("details", Bo, [
2957
+ o("summary", To, H(u(t)("inventory.closing.draft.createDraft.previewTable.systemNegativeNote", [g.value.length])), 1),
2958
+ o("ul", jo, [
2959
+ (h(!0), T(ce, null, he(g.value, (f) => (h(), T("li", {
2953
2960
  key: f.sku._id,
2954
2961
  class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary"
2955
2962
  }, H(f.sku.code), 1))), 128))
2956
2963
  ])
2957
- ])) : G("", !0),
2958
- c.unrecognisedItemCodes.length > 0 ? (w(), j("details", Fo, [
2959
- a("summary", Io, H(u(t)("inventory.closing.draft.createDraft.previewTable.unrecognisedNote", [c.unrecognisedItemCodes.length])), 1),
2960
- a("ul", Bo, [
2961
- (w(!0), j(ce, null, he(c.unrecognisedItemCodes, (f) => (w(), j("li", {
2964
+ ])) : K("", !0),
2965
+ c.unrecognisedItemCodes.length > 0 ? (h(), T("details", Mo, [
2966
+ o("summary", Uo, H(u(t)("inventory.closing.draft.createDraft.previewTable.unrecognisedNote", [c.unrecognisedItemCodes.length])), 1),
2967
+ o("ul", Ro, [
2968
+ (h(!0), T(ce, null, he(c.unrecognisedItemCodes, (f) => (h(), T("li", {
2962
2969
  key: f,
2963
2970
  class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary"
2964
2971
  }, H(f), 1))), 128))
2965
2972
  ])
2966
- ])) : G("", !0),
2973
+ ])) : K("", !0),
2967
2974
  $(A, {
2968
- "row-data": r.items,
2969
- "column-defs": s,
2975
+ "row-data": l.items,
2976
+ "column-defs": r,
2970
2977
  pagination: { pageSize: 20 }
2971
2978
  }, null, 8, ["row-data"])
2972
2979
  ]);
2973
2980
  };
2974
2981
  }
2975
- }), jo = { class: "flex flex-col gap-16" }, Uo = { class: "flex flex-col gap-8" }, Mo = { class: "fm-typo-en-body-lg-600" }, Ro = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Po = { class: "fm-corner-radius-md p-16 flex items-center gap-16 border border-fm-color-border-default" }, Vo = { class: "flex flex-col flex-1 gap-4" }, No = { class: "fm-typo-en-body-md-600" }, zo = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Eo = {
2982
+ }), Vo = { class: "flex flex-col gap-16" }, No = { class: "flex flex-col gap-8" }, zo = { class: "fm-typo-en-body-lg-600" }, Eo = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Lo = { class: "fm-corner-radius-md p-16 flex items-center gap-16 border border-fm-color-border-default" }, Oo = { class: "flex flex-col flex-1 gap-4" }, Ho = { class: "fm-typo-en-body-md-600" }, Yo = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Ko = {
2976
2983
  key: 0,
2977
2984
  class: "flex flex-col gap-8"
2978
- }, Lo = { class: "fm-typo-en-body-lg-600" }, Oo = {
2985
+ }, Wo = { class: "fm-typo-en-body-lg-600" }, qo = {
2979
2986
  key: 0,
2980
2987
  class: "fm-typo-en-body-sm-400 text-fm-color-system-error-300 flex items-center gap-8"
2981
- }, Ho = { class: "grid grid-cols-[repeat(3,1fr)] gap-12" }, Yo = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary flex items-center gap-4" }, Ko = { class: "flex items-center gap-8 w-full" }, Wo = /* @__PURE__ */ je({
2988
+ }, Go = { class: "grid grid-cols-[repeat(3,1fr)] gap-12" }, Qo = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary flex items-center gap-4" }, Zo = { class: "flex items-center gap-8 w-full" }, Jo = /* @__PURE__ */ je({
2982
2989
  __name: "ClosingDraftCreateSideSheet",
2983
2990
  props: {
2984
2991
  show: { type: Boolean }
2985
2992
  },
2986
2993
  emits: ["update:show", "submitted"],
2987
- setup(n, { emit: r }) {
2988
- const t = n, o = r, g = Kt(t, "show"), { t: i } = Ye(), s = Ke(), c = K("upload"), x = K(null), A = K(!1), { mergedItems: f, unrecognisedItemCodes: B, hasBlockingErrors: N, isLoading: E, onFileUpload: I, submit: k, downloadTemplate: R } = xo(), p = M(
2994
+ setup(n, { emit: l }) {
2995
+ const t = n, s = l, g = Kt(t, "show"), { t: i } = Ye(), r = Ke(), c = W("upload"), x = W(null), A = W(!1), { mergedItems: f, unrecognisedItemCodes: B, hasBlockingErrors: N, isLoading: E, onFileUpload: F, submit: _, downloadTemplate: R } = $o(), p = M(
2989
2996
  () => x.value && !E.value && f.value.length > 0
2990
2997
  ), v = M(() => {
2991
- const _ = f.value.filter(
2998
+ const w = f.value.filter(
2992
2999
  (z) => z.status === ve.ready
2993
3000
  ).length, Y = f.value.filter(
2994
3001
  (z) => z.status === ve.negative
2995
- ).length, W = f.value.filter(
3002
+ ).length, q = f.value.filter(
2996
3003
  (z) => z.status === ve.systemNegative
2997
3004
  ).length, re = f.value.filter((z) => z.variance !== 0).length;
2998
3005
  return [
2999
3006
  { label: i("inventory.closing.draft.createDraft.summary.totalItems"), value: f.value.length },
3000
- { label: i("inventory.closing.draft.createDraft.summary.itemsWithCount"), value: _ },
3007
+ { label: i("inventory.closing.draft.createDraft.summary.itemsWithCount"), value: w },
3001
3008
  {
3002
3009
  label: i("inventory.closing.draft.createDraft.summary.unrecognisedItems"),
3003
3010
  value: B.value.length,
@@ -3007,24 +3014,24 @@ const Do = { class: "flex flex-col gap-16" }, Ao = {
3007
3014
  { label: i("inventory.closing.draft.createDraft.summary.negativeCounts"), value: Y, isError: Y > 0 },
3008
3015
  {
3009
3016
  label: i("inventory.closing.draft.createDraft.summary.systemNegative"),
3010
- value: W,
3011
- isWarning: W > 0
3017
+ value: q,
3018
+ isWarning: q > 0
3012
3019
  }
3013
3020
  ];
3014
3021
  });
3015
- async function m(_) {
3016
- x.value = _, await I(_);
3022
+ async function m(w) {
3023
+ x.value = w, await F(w);
3017
3024
  }
3018
3025
  async function b() {
3019
3026
  A.value = !0;
3020
3027
  try {
3021
- await k(), y(), o("submitted"), s.open({
3028
+ await _(), y(), s("submitted"), r.open({
3022
3029
  title: "Success",
3023
3030
  message: "Closing draft created successfully",
3024
3031
  type: "success"
3025
3032
  });
3026
- } catch (_) {
3027
- console.error("Failed to create closing draft", { error: _ }), s.open({
3033
+ } catch (w) {
3034
+ console.error("Failed to create closing draft", { error: w }), r.open({
3028
3035
  title: "Something went wrong",
3029
3036
  message: "Failed to create closing draft. Please try again",
3030
3037
  type: "error"
@@ -3033,52 +3040,52 @@ const Do = { class: "flex flex-col gap-16" }, Ao = {
3033
3040
  A.value = !1;
3034
3041
  }
3035
3042
  }
3036
- ze(g, (_) => {
3037
- _ || (c.value = "upload", x.value = null);
3043
+ ze(g, (w) => {
3044
+ w || (c.value = "upload", x.value = null);
3038
3045
  });
3039
3046
  function y() {
3040
3047
  g.value = !1;
3041
3048
  }
3042
- return (_, Y) => {
3043
- const W = Z("FmCircularProgress"), re = Z("FmIcon"), z = Z("FmButton"), le = Z("FmCard"), P = Z("FmSideSheet");
3044
- return w(), ae(P, {
3049
+ return (w, Y) => {
3050
+ const q = Z("FmCircularProgress"), re = Z("FmIcon"), z = Z("FmButton"), le = Z("FmCard"), P = Z("FmSideSheet");
3051
+ return h(), ae(P, {
3045
3052
  "dismiss-away": "",
3046
3053
  "max-width": 9999,
3047
3054
  "model-value": u(g),
3048
3055
  "onUpdate:modelValue": Y[2] || (Y[2] = (S) => _t(g) ? g.value = S : null),
3049
3056
  header: u(i)("inventory.closing.draft.createDraft.title")
3050
3057
  }, {
3051
- default: ee(() => [
3052
- a("div", jo, [
3053
- c.value === "upload" ? (w(), j(ce, { key: 0 }, [
3054
- a("div", Uo, [
3055
- a("div", Mo, H(u(i)("inventory.closing.draft.createDraft.importCsv")), 1),
3056
- a("div", Ro, H(u(i)("inventory.closing.draft.createDraft.uploadDescription")), 1),
3057
- $(Kn, {
3058
+ default: X(() => [
3059
+ o("div", Vo, [
3060
+ c.value === "upload" ? (h(), T(ce, { key: 0 }, [
3061
+ o("div", No, [
3062
+ o("div", zo, H(u(i)("inventory.closing.draft.createDraft.importCsv")), 1),
3063
+ o("div", Eo, H(u(i)("inventory.closing.draft.createDraft.uploadDescription")), 1),
3064
+ $(Wn, {
3058
3065
  class: Se({ "h-[200px]": !x.value }),
3059
3066
  accept: ".csv",
3060
3067
  disabled: u(E),
3061
3068
  onFileUpload: m
3062
- }, hn({ _: 2 }, [
3069
+ }, kn({ _: 2 }, [
3063
3070
  x.value ? {
3064
3071
  name: "default",
3065
- fn: ee(({ openFileDialog: S }) => [
3066
- a("div", Po, [
3067
- u(E) ? (w(), ae(W, {
3072
+ fn: X(({ openFileDialog: S }) => [
3073
+ o("div", Lo, [
3074
+ u(E) ? (h(), ae(q, {
3068
3075
  key: 0,
3069
3076
  size: "md",
3070
3077
  color: "neutral-gray-200"
3071
- })) : (w(), ae(re, {
3078
+ })) : (h(), ae(re, {
3072
3079
  key: 1,
3073
3080
  name: "check_circle",
3074
3081
  color: "system-success-400",
3075
3082
  size: "lg"
3076
3083
  })),
3077
- a("div", Vo, [
3078
- a("div", No, H(x.value.name), 1),
3079
- a("div", zo, H(u(E) ? u(i)("inventory.closing.draft.createDraft.processing") : u(i)("inventory.closing.draft.createDraft.itemsLoaded", [u(f).length])), 1)
3084
+ o("div", Oo, [
3085
+ o("div", Ho, H(x.value.name), 1),
3086
+ o("div", Yo, H(u(E) ? u(i)("inventory.closing.draft.createDraft.processing") : u(i)("inventory.closing.draft.createDraft.itemsLoaded", [u(f).length])), 1)
3080
3087
  ]),
3081
- u(E) ? G("", !0) : (w(), ae(z, {
3088
+ u(E) ? K("", !0) : (h(), ae(z, {
3082
3089
  key: 2,
3083
3090
  label: u(i)("inventory.closing.draft.createDraft.replaceFile"),
3084
3091
  variant: "secondary",
@@ -3091,42 +3098,42 @@ const Do = { class: "flex flex-col gap-16" }, Ao = {
3091
3098
  } : void 0
3092
3099
  ]), 1032, ["class", "disabled"])
3093
3100
  ]),
3094
- p.value ? (w(), j("div", Eo, [
3095
- a("div", Lo, H(u(i)("inventory.closing.draft.createDraft.importSummary")), 1),
3096
- u(N) ? (w(), j("div", Oo, [
3101
+ p.value ? (h(), T("div", Ko, [
3102
+ o("div", Wo, H(u(i)("inventory.closing.draft.createDraft.importSummary")), 1),
3103
+ u(N) ? (h(), T("div", qo, [
3097
3104
  $(re, {
3098
3105
  name: "error",
3099
3106
  size: "sm",
3100
3107
  color: "system-error-300"
3101
3108
  }),
3102
- a("span", null, H(u(i)("inventory.closing.draft.createDraft.reviewIssues")), 1)
3103
- ])) : G("", !0),
3109
+ o("span", null, H(u(i)("inventory.closing.draft.createDraft.reviewIssues")), 1)
3110
+ ])) : K("", !0),
3104
3111
  $(le, {
3105
3112
  variant: "outlined",
3106
3113
  class: "flex flex-col gap-12 px-16 py-12"
3107
3114
  }, {
3108
- default: ee(() => [
3109
- a("div", Ho, [
3110
- (w(!0), j(ce, null, he(v.value, (S) => (w(), j("div", {
3115
+ default: X(() => [
3116
+ o("div", Go, [
3117
+ (h(!0), T(ce, null, he(v.value, (S) => (h(), T("div", {
3111
3118
  key: S.label,
3112
3119
  class: "flex flex-col gap-4"
3113
3120
  }, [
3114
- a("div", Yo, [
3115
- S.isError ? (w(), ae(re, {
3121
+ o("div", Qo, [
3122
+ S.isError ? (h(), ae(re, {
3116
3123
  key: 0,
3117
3124
  name: "error",
3118
3125
  size: "sm",
3119
3126
  color: "system-error-300"
3120
- })) : G("", !0),
3121
- S.isWarning && !S.isError ? (w(), ae(re, {
3127
+ })) : K("", !0),
3128
+ S.isWarning && !S.isError ? (h(), ae(re, {
3122
3129
  key: 1,
3123
3130
  name: "warning",
3124
3131
  size: "sm",
3125
3132
  color: "system-warning-300"
3126
- })) : G("", !0),
3127
- a("span", null, H(S.label), 1)
3133
+ })) : K("", !0),
3134
+ o("span", null, H(S.label), 1)
3128
3135
  ]),
3129
- a("div", {
3136
+ o("div", {
3130
3137
  class: Se([
3131
3138
  "fm-typo-en-body-lg-600",
3132
3139
  {
@@ -3140,32 +3147,32 @@ const Do = { class: "flex flex-col gap-16" }, Ao = {
3140
3147
  ]),
3141
3148
  _: 1
3142
3149
  })
3143
- ])) : G("", !0)
3144
- ], 64)) : G("", !0),
3145
- c.value === "preview" ? (w(), ae(To, {
3150
+ ])) : K("", !0)
3151
+ ], 64)) : K("", !0),
3152
+ c.value === "preview" ? (h(), ae(Po, {
3146
3153
  key: 1,
3147
3154
  items: u(f),
3148
3155
  "unrecognised-item-codes": u(B)
3149
- }, null, 8, ["items", "unrecognised-item-codes"])) : G("", !0)
3156
+ }, null, 8, ["items", "unrecognised-item-codes"])) : K("", !0)
3150
3157
  ])
3151
3158
  ]),
3152
- "side-sheet-footer": ee(() => [
3153
- a("div", Ko, [
3154
- c.value === "preview" ? (w(), ae(z, {
3159
+ "side-sheet-footer": X(() => [
3160
+ o("div", Zo, [
3161
+ c.value === "preview" ? (h(), ae(z, {
3155
3162
  key: 0,
3156
3163
  variant: "secondary",
3157
3164
  label: u(i)("inventory.common.back"),
3158
3165
  "prepend-icon": "arrow_back",
3159
3166
  onClick: Y[0] || (Y[0] = (S) => c.value = "upload")
3160
- }, null, 8, ["label"])) : G("", !0),
3161
- c.value === "upload" ? (w(), ae(z, {
3167
+ }, null, 8, ["label"])) : K("", !0),
3168
+ c.value === "upload" ? (h(), ae(z, {
3162
3169
  key: 1,
3163
3170
  variant: "primary",
3164
3171
  label: u(i)("inventory.common.next"),
3165
3172
  disabled: !x.value || u(E),
3166
3173
  onClick: Y[1] || (Y[1] = (S) => c.value = "preview")
3167
- }, null, 8, ["label", "disabled"])) : G("", !0),
3168
- c.value === "preview" ? (w(), ae(Wn, {
3174
+ }, null, 8, ["label", "disabled"])) : K("", !0),
3175
+ c.value === "preview" ? (h(), ae(qn, {
3169
3176
  key: 2,
3170
3177
  label: u(i)("inventory.closing.draft.createDraft.submit"),
3171
3178
  disabled: u(N) || u(f).length === 0 || A.value,
@@ -3173,43 +3180,43 @@ const Do = { class: "flex flex-col gap-16" }, Ao = {
3173
3180
  "confirm-title": u(i)("inventory.closing.draft.createDraft.confirmTitle"),
3174
3181
  "confirm-message": u(i)("inventory.closing.draft.createDraft.confirmMessage"),
3175
3182
  onConfirm: b
3176
- }, null, 8, ["label", "disabled", "loading", "confirm-title", "confirm-message"])) : G("", !0),
3183
+ }, null, 8, ["label", "disabled", "loading", "confirm-title", "confirm-message"])) : K("", !0),
3177
3184
  $(z, {
3178
3185
  variant: "tertiary",
3179
3186
  label: u(i)("inventory.common.close"),
3180
3187
  onClick: y
3181
3188
  }, null, 8, ["label"]),
3182
- c.value === "upload" ? (w(), ae(z, {
3189
+ c.value === "upload" ? (h(), ae(z, {
3183
3190
  key: 3,
3184
3191
  class: "ml-auto",
3185
3192
  variant: "secondary",
3186
3193
  label: u(i)("inventory.closing.draft.createDraft.downloadTemplate"),
3187
3194
  "prepend-icon": "download",
3188
3195
  onClick: u(R)
3189
- }, null, 8, ["label", "onClick"])) : G("", !0)
3196
+ }, null, 8, ["label", "onClick"])) : K("", !0)
3190
3197
  ])
3191
3198
  ]),
3192
3199
  _: 1
3193
3200
  }, 8, ["model-value", "header"]);
3194
3201
  };
3195
3202
  }
3196
- }), qo = { class: "flex-1 flex flex-col gap-8" }, Go = { class: "flex flex-col" }, Qo = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Zo = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, Jo = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary line-clamp-2" }, Xo = { class: "fm-typo-en-body-lg-400 line-clamp-2" }, $s = /* @__PURE__ */ je({
3203
+ }), Xo = { class: "flex-1 flex flex-col gap-8" }, es = { class: "flex flex-col" }, ts = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ns = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, as = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary line-clamp-2" }, os = { class: "fm-typo-en-body-lg-400 line-clamp-2" }, js = /* @__PURE__ */ je({
3197
3204
  __name: "ClosingDraftView",
3198
3205
  setup(n) {
3199
- const { t: r } = Ye(), { viewDraft: t } = lt(), { viewClosingDraftProps: o, viewClosingDraftShow: g } = Fn(lt()), i = We(), s = on(), c = wn(), { breakpoints: x } = An();
3200
- i.watchLocation(s.fetchDrafts);
3201
- const A = M(() => s.loading), f = K(""), B = K(!1), N = M(() => x.value.xs || x.value.sm), E = M(() => N.value ? 10 : 20), I = M(
3206
+ const { t: l } = Ye(), { viewDraft: t } = it(), { viewClosingDraftProps: s, viewClosingDraftShow: g } = Fn(it()), i = We(), r = on(), c = xn(), { breakpoints: x } = Cn();
3207
+ i.watchLocation(r.fetchDrafts);
3208
+ const A = M(() => r.loading), f = W(""), B = W(!1), N = M(() => x.value.xs || x.value.sm), E = M(() => N.value ? 10 : 20), F = M(
3202
3209
  () => {
3203
3210
  var v;
3204
- return ((v = i.currentLocation) == null ? void 0 : v.type) === $n.enum.warehouse;
3211
+ return ((v = i.currentLocation) == null ? void 0 : v.type) === In.enum.warehouse;
3205
3212
  }
3206
3213
  );
3207
- function k(v) {
3214
+ function _(v) {
3208
3215
  switch (v) {
3209
3216
  case "add":
3210
3217
  return B.value = !0;
3211
3218
  case "refresh":
3212
- return s.fetchDrafts();
3219
+ return r.fetchDrafts();
3213
3220
  }
3214
3221
  }
3215
3222
  function R(v) {
@@ -3217,27 +3224,27 @@ const Do = { class: "flex flex-col gap-16" }, Ao = {
3217
3224
  }
3218
3225
  const p = M(() => {
3219
3226
  const v = {
3220
- label: r("inventory.closing.draft.createDraft.title"),
3227
+ label: l("inventory.closing.draft.createDraft.title"),
3221
3228
  value: "add",
3222
3229
  isPrimary: !0,
3223
3230
  prependIcon: "add"
3224
3231
  }, m = {
3225
- label: r("inventory.common.refresh"),
3232
+ label: l("inventory.common.refresh"),
3226
3233
  value: "refresh",
3227
3234
  isPrimary: !1
3228
3235
  };
3229
- return [...I.value ? [v] : [], m];
3236
+ return [...F.value ? [v] : [], m];
3230
3237
  });
3231
3238
  return (v, m) => {
3232
3239
  const b = Z("FmTable");
3233
- return w(), j(ce, null, [
3234
- $(xn, {
3235
- title: u(r)("inventory.closing.draft.title"),
3240
+ return h(), T(ce, null, [
3241
+ $(Dn, {
3242
+ title: u(l)("inventory.closing.draft.title"),
3236
3243
  actions: p.value,
3237
- "onClick:action": k
3244
+ "onClick:action": _
3238
3245
  }, {
3239
- default: ee(() => [
3240
- a("div", {
3246
+ default: X(() => [
3247
+ o("div", {
3241
3248
  class: Se([
3242
3249
  "flex flex-col gap-8 max-h-full",
3243
3250
  {
@@ -3246,59 +3253,59 @@ const Do = { class: "flex flex-col gap-16" }, Ao = {
3246
3253
  }
3247
3254
  ])
3248
3255
  }, [
3249
- $(Nn, {
3256
+ $(zn, {
3250
3257
  "change-location": "",
3251
3258
  searchable: "",
3252
3259
  search: f.value,
3253
3260
  "onUpdate:search": m[0] || (m[0] = (y) => f.value = y)
3254
3261
  }, null, 8, ["search"]),
3255
- (w(), ae(b, {
3256
- key: u(s).tableKey,
3262
+ (h(), ae(b, {
3263
+ key: u(r).tableKey,
3257
3264
  style: Ht(u(c).tableHeight),
3258
- "column-defs": u(s).columnDefs,
3259
- "row-data": u(s).drafts,
3265
+ "column-defs": u(r).columnDefs,
3266
+ "row-data": u(r).drafts,
3260
3267
  "search-value": f.value,
3261
3268
  loading: A.value,
3262
3269
  onRowClick: m[1] || (m[1] = (y) => u(t)(y.original)),
3263
3270
  "page-size": E.value
3264
3271
  }, {
3265
- "list-row": ee((y) => [
3266
- $(qn, {
3272
+ "list-row": X((y) => [
3273
+ $(Gn, {
3267
3274
  row: y,
3268
- onRowClick: (_) => u(t)(_)
3275
+ onRowClick: (w) => u(t)(w)
3269
3276
  }, {
3270
- default: ee((_) => {
3271
- var Y, W, re, z, le, P, S, ie, L, F, Q, se, we, xe, De, $e, Ee, Le, Ue, Ge;
3277
+ default: X((w) => {
3278
+ var Y, q, re, z, le, P, S, ie, L, I, Q, se, we, xe, De, $e, Ee, Le, Me, Ge;
3272
3279
  return [
3273
- a("div", qo, [
3274
- a("div", Go, [
3275
- a("div", Qo, [
3276
- $(u(nt), {
3277
- render: (re = (W = (Y = _._id) == null ? void 0 : Y.column) == null ? void 0 : W.columnDef) == null ? void 0 : re.cell,
3278
- props: (le = (z = _._id) == null ? void 0 : z.getContext) == null ? void 0 : le.call(z)
3280
+ o("div", Xo, [
3281
+ o("div", es, [
3282
+ o("div", ts, [
3283
+ $(u(at), {
3284
+ render: (re = (q = (Y = w._id) == null ? void 0 : Y.column) == null ? void 0 : q.columnDef) == null ? void 0 : re.cell,
3285
+ props: (le = (z = w._id) == null ? void 0 : z.getContext) == null ? void 0 : le.call(z)
3279
3286
  }, null, 8, ["render", "props"])
3280
3287
  ]),
3281
- a("div", Zo, [
3282
- $(u(nt), {
3283
- render: (ie = (S = (P = _.name) == null ? void 0 : P.column) == null ? void 0 : S.columnDef) == null ? void 0 : ie.cell,
3284
- props: (F = (L = _.name) == null ? void 0 : L.getContext) == null ? void 0 : F.call(L)
3288
+ o("div", ns, [
3289
+ $(u(at), {
3290
+ render: (ie = (S = (P = w.name) == null ? void 0 : P.column) == null ? void 0 : S.columnDef) == null ? void 0 : ie.cell,
3291
+ props: (I = (L = w.name) == null ? void 0 : L.getContext) == null ? void 0 : I.call(L)
3285
3292
  }, null, 8, ["render", "props"])
3286
3293
  ]),
3287
- a("div", Jo, H([
3288
- ...y.original.items.slice(0, 3).map((ct) => ct.sku.name),
3294
+ o("div", as, H([
3295
+ ...y.original.items.slice(0, 3).map((ut) => ut.sku.name),
3289
3296
  ...y.original.items.length >= 3 ? [`and ${y.original.items.length - 3} more items`] : []
3290
3297
  ].join(", ")), 1),
3291
- a("div", Xo, [
3292
- $(u(nt), {
3293
- render: (we = (se = (Q = _.ref) == null ? void 0 : Q.column) == null ? void 0 : se.columnDef) == null ? void 0 : we.cell,
3294
- props: (De = (xe = _.ref) == null ? void 0 : xe.getContext) == null ? void 0 : De.call(xe)
3298
+ o("div", os, [
3299
+ $(u(at), {
3300
+ render: (we = (se = (Q = w.ref) == null ? void 0 : Q.column) == null ? void 0 : se.columnDef) == null ? void 0 : we.cell,
3301
+ props: (De = (xe = w.ref) == null ? void 0 : xe.getContext) == null ? void 0 : De.call(xe)
3295
3302
  }, null, 8, ["render", "props"])
3296
3303
  ])
3297
3304
  ]),
3298
- a("div", null, [
3299
- $(u(nt), {
3300
- render: (Le = (Ee = ($e = _.status) == null ? void 0 : $e.column) == null ? void 0 : Ee.columnDef) == null ? void 0 : Le.cell,
3301
- props: (Ge = (Ue = _.status) == null ? void 0 : Ue.getContext) == null ? void 0 : Ge.call(Ue)
3305
+ o("div", null, [
3306
+ $(u(at), {
3307
+ render: (Le = (Ee = ($e = w.status) == null ? void 0 : $e.column) == null ? void 0 : Ee.columnDef) == null ? void 0 : Le.cell,
3308
+ props: (Ge = (Me = w.status) == null ? void 0 : Me.getContext) == null ? void 0 : Ge.call(Me)
3302
3309
  }, null, 8, ["render", "props"])
3303
3310
  ])
3304
3311
  ])
@@ -3313,17 +3320,17 @@ const Do = { class: "flex flex-col gap-16" }, Ao = {
3313
3320
  ]),
3314
3321
  _: 1
3315
3322
  }, 8, ["title", "actions"]),
3316
- $(Wo, {
3323
+ $(Jo, {
3317
3324
  show: B.value,
3318
3325
  "onUpdate:show": m[2] || (m[2] = (y) => B.value = y),
3319
- onSubmitted: u(s).fetchDrafts
3326
+ onSubmitted: u(r).fetchDrafts
3320
3327
  }, null, 8, ["show", "onSubmitted"]),
3321
- (w(), ae(kn, { to: "body" }, [
3322
- $(bo, _n(u(o), {
3328
+ (h(), ae(_n, { to: "body" }, [
3329
+ $(xo, wn(u(s), {
3323
3330
  show: u(g),
3324
3331
  "onUpdate:show": m[3] || (m[3] = (y) => _t(g) ? g.value = y : null),
3325
- onSubmitted: m[4] || (m[4] = () => (g.value = !1, u(s).fetchDrafts())),
3326
- onRefresh: m[5] || (m[5] = (y) => u(s).updateDraftRef(y))
3332
+ onSubmitted: m[4] || (m[4] = () => (g.value = !1, u(r).fetchDrafts())),
3333
+ onRefresh: m[5] || (m[5] = (y) => u(r).updateDraftRef(y))
3327
3334
  }), null, 16, ["show"])
3328
3335
  ]))
3329
3336
  ], 64);
@@ -3331,5 +3338,5 @@ const Do = { class: "flex flex-col gap-16" }, Ao = {
3331
3338
  }
3332
3339
  });
3333
3340
  export {
3334
- $s as default
3341
+ js as default
3335
3342
  };