@feedmepos/mf-inventory-portal 1.2.59 → 1.2.60-dev.2

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 (131) hide show
  1. package/dist/{App-Nwc0Ha2r.js → App-B_yr-6yL.js} +82 -78
  2. package/dist/{ApprovalView-Y5f915s3.js → ApprovalView-DoYBBuSD.js} +5 -5
  3. package/dist/{BindingsDialog-5N7R_u4c.js → BindingsDialog-DG7HOy6J.js} +5 -5
  4. package/dist/{BindingsPicker-BJwvLu2s.js → BindingsPicker-DVCYpyrR.js} +3 -3
  5. package/dist/{BindingsTable-B8sq-qXH.js → BindingsTable-CCel2b_W.js} +5 -5
  6. package/dist/{ClosingDraftView-BsyYOZsz.js → ClosingDraftView-CfM7gNBX.js} +891 -893
  7. package/dist/{ClosingHistoryView-BNpsMNy1.js → ClosingHistoryView-DWH4bFgg.js} +36 -36
  8. package/dist/{ClosingTemplateView-BBqbq07d.js → ClosingTemplateView-JYnnvm7L.js} +14 -14
  9. package/dist/{DeliveryOrderPrintPreview-CmOO7wuE.js → DeliveryOrderPrintPreview-BihBTJGj.js} +7 -7
  10. package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-BXlY-Gu1.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-CWjtQajS.js} +17 -17
  11. package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-CAMkZRFI.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-CUIrR73y.js} +2 -2
  12. package/dist/{FmMultiselectDialog-CwJUv9tG.js → FmMultiselectDialog-CxDviJZM.js} +16 -16
  13. package/dist/{FmMultiselectDialog-LagHyTQP.js → FmMultiselectDialog-D51nW6yj.js} +1 -1
  14. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-BmHFIkt1.js → FmUnitInput.vue_vue_type_script_setup_true_lang-DLqUnROc.js} +16 -15
  15. package/dist/{ImportView-wQ_bNesb.js → ImportView-C52rZFib.js} +6 -6
  16. package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-DtMrJIVs.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-CjZmd-Sa.js} +1 -1
  17. package/dist/{IngredientGroupView-DsGMhdwu.js → IngredientGroupView-DTHpZP2L.js} +5 -5
  18. package/dist/{IngredientsView-JdjcLdOx.js → IngredientsView-CrCW6heJ.js} +25 -24
  19. package/dist/{IntegrationView-CMmSIRUk.js → IntegrationView--DZANrHj.js} +18 -17
  20. package/dist/{InventoryBindingForm-UL-UKtYW.js → InventoryBindingForm-DLTpv-zQ.js} +1 -1
  21. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-r875PDKP.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-hkIg4Rbp.js} +17 -16
  22. package/dist/{InventoryBindingSummary-BDAuT62b.js → InventoryBindingSummary-D9ptV8Cw.js} +1 -1
  23. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-C5zOYiqR.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-CdPxhkg0.js} +5 -5
  24. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-B2zppgqk.js → PremiumBadge.vue_vue_type_script_setup_true_lang-Ci3esisT.js} +2 -2
  25. package/dist/{PublishView-CSoZCSHT.js → PublishView-DxzL_D61.js} +8 -8
  26. package/dist/{PurchaseOrderPrintPreview-D5Qw44xo.js → PurchaseOrderPrintPreview-D0tg-2TC.js} +11 -11
  27. package/dist/{ReceiveRequestView-Chntp08E.js → ReceiveRequestView-2U534J1_.js} +251 -250
  28. package/dist/RecipeView-VZRyX3Mm.js +1558 -0
  29. package/dist/{StockView-CuCK7tD2.js → StockView-CvWbnYGz.js} +653 -651
  30. package/dist/SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-CxjceLuZ.js +183 -0
  31. package/dist/{SupplierView-CA17Tz02.js → SupplierView-DMIunLvv.js} +20 -19
  32. package/dist/{SurchargeView-EIftjMCa.js → SurchargeView-jteWYvQz.js} +6 -6
  33. package/dist/{SystemTrailDialog.vue_vue_type_script_setup_true_lang-CqA6RmPy.js → SystemTrailDialog.vue_vue_type_script_setup_true_lang-CyoUVoDH.js} +2 -2
  34. package/dist/{TemplatePublishDialog.vue_vue_type_script_setup_true_lang-CYXsAP0i.js → TemplatePublishDialog.vue_vue_type_script_setup_true_lang-DAkKiy0Z.js} +1 -1
  35. package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-BbbAEIcW.js → TransferDetails.vue_vue_type_script_setup_true_lang-CEXA3vvS.js} +77 -78
  36. package/dist/{TransferTemplateView-CYfbm9aS.js → TransferTemplateView-DMQ1WIij.js} +22 -21
  37. package/dist/UnitCostHistoryView-DQ3sXVAQ.js +651 -0
  38. package/dist/{UnitView-6s5CsGEQ.js → UnitView-p6eZ8G2C.js} +9 -9
  39. package/dist/{WarehouseView-BXDQOyFZ.js → WarehouseView-BIShkEPs.js} +5 -5
  40. package/dist/{WastageTemplateView-Cq92TiRs.js → WastageTemplateView-DCbczB_0.js} +14 -14
  41. package/dist/api/inventory.d.ts +126 -36
  42. package/dist/api/netsuite.d.ts +8 -1
  43. package/dist/api/stock-estimate.d.ts +2 -0
  44. package/dist/api/unit-cost-history.d.ts +28 -0
  45. package/dist/{app-DJuq_faF.js → app-BAVBNKKH.js} +7461 -6448
  46. package/dist/app.d.ts +236 -0
  47. package/dist/app.js +1 -1
  48. package/dist/{closing-template-D_zbp5V1.js → closing-template-DqxA750a.js} +1 -1
  49. package/dist/components/StockForecastProps.d.ts +6 -0
  50. package/dist/components/inventory-binding/InventoryBinding.vue.d.ts +37 -1
  51. package/dist/components/shell/inventory/binding-dialog.vue.d.ts +14 -0
  52. package/dist/components/shell/inventory/binding-ui.vue.d.ts +16 -1
  53. package/dist/{date2-4vrHarNG.js → date2-CgwRU403.js} +1 -1
  54. package/dist/{dayjs.min-Dwp8614O.js → dayjs.min-CjWVK_Fe.js} +16 -16
  55. package/dist/{defineDeepModel-DVt2Wz9r.js → defineDeepModel-B1j_kSRA.js} +1 -1
  56. package/dist/{duplicate-template-CkYWeFtL.js → duplicate-template-iHtqE_uw.js} +1 -1
  57. package/dist/{feature-Beh-qc03.js → feature-DEryk-Cv.js} +94 -89
  58. package/dist/{format-time-from-id-84iLSxVu.js → format-time-from-id-C-mbWMLS.js} +1 -1
  59. package/dist/{format-unit-display-DfeNpWk4.js → format-unit-display-C8Hzskg0.js} +16 -15
  60. package/dist/helper/number.d.ts +2 -0
  61. package/dist/helper/type.d.ts +5 -0
  62. package/dist/{import-export.helper-fAVzQM2q.js → import-export.helper-DGg16RXI.js} +17 -16
  63. package/dist/{index-CoEqhZLm.js → index-BAkoTUB0.js} +1 -1
  64. package/dist/{index-B2_16R5E.js → index-BLowSL6G.js} +1471 -1412
  65. package/dist/{index-Chogzhcq.js → index-CLr4DPan.js} +3 -3
  66. package/dist/{lodash-Cx8BU1GH.js → lodash-D1_0uR01.js} +1 -1
  67. package/dist/{netsuite-C1bml-v1.js → netsuite-Bbxz8tiD.js} +60 -60
  68. package/dist/number-Cof88Fjz.js +232 -0
  69. package/dist/{purchase-order-template-BqFnJ-6B.js → purchase-order-template-B-sXEbRE.js} +1 -1
  70. package/dist/router/name.d.ts +1 -0
  71. package/dist/rules-CzPUVxD_.js +98 -0
  72. package/dist/{stock-KxT4JbNf.js → stock-BYPFH5a_.js} +1 -1
  73. package/dist/stock-D9E1uFb1.js +75 -0
  74. package/dist/stores/feature.d.ts +2 -0
  75. package/dist/stores/integration/netsuite.d.ts +8 -1
  76. package/dist/stores/inventory.d.ts +119 -30
  77. package/dist/{supplier-C7wUB1zT.js → supplier-wQYh275s.js} +2 -2
  78. package/dist/{surcharge-CjB_Qtbv.js → surcharge-Bi21qFa0.js} +1 -1
  79. package/dist/tsconfig.app.tsbuildinfo +1 -1
  80. package/dist/{use-ingredient-select-dialog-D5KSqA4Z.js → use-ingredient-select-dialog-DH-mXl8H.js} +2 -2
  81. package/dist/{use-inventory-binding-dialog-eGOvztV3.js → use-inventory-binding-dialog-i8E2CNuV.js} +2 -2
  82. package/dist/{use-template-enabled-locations-2-3kcVWPQm.js → use-template-enabled-locations-2-DRk9TskI.js} +2 -2
  83. package/dist/views/closing-draft/components/closing-draft-dialog/ClosingDraftDialog.vue.d.ts +64 -8
  84. package/dist/views/closing-draft/composables/use-closing-draft-table.d.ts +192 -24
  85. package/dist/views/closing-template/components/closing-template-form/composables/use-closing-template-items.d.ts +8 -1
  86. package/dist/views/closing-template/composables/use-closing-template-actions.d.ts +96 -12
  87. package/dist/views/closing-template/composables/use-closing-template-table.d.ts +96 -12
  88. package/dist/views/ingredient-group/composables/use-ingredient-group-table.d.ts +18 -18
  89. package/dist/views/ingredients/components/convert/ConvertForm.vue.d.ts +14 -0
  90. package/dist/views/ingredients/components/ingredient-form/IngredientForm.vue.d.ts +32 -4
  91. package/dist/views/ingredients/components/inventory-binding/InventoryBindingForm.vue.d.ts +28 -0
  92. package/dist/views/ingredients/components/inventory-binding/v2/InventoryBindingFormV2.vue.d.ts +169 -0
  93. package/dist/views/ingredients/components/inventory-binding/v2/components/InventoryBindingAlternative.vue.d.ts +43 -0
  94. package/dist/views/ingredients/components/inventory-binding/v2/components/InventoryBindingRule.vue.d.ts +25 -0
  95. package/dist/views/ingredients/components/inventory-binding/v2/components/InventoryRecipeBindingV2Field.vue.d.ts +125 -0
  96. package/dist/views/ingredients/components/inventory-binding/v2/components/InventorySkuBindingV2Field.vue.d.ts +129 -0
  97. package/dist/views/ingredients/components/inventory-binding/v2/composables/use-inventory-binding-alternative-table.d.ts +30 -0
  98. package/dist/views/ingredients/components/inventory-binding/v2/composables/use-inventory-binding-dialog.d.ts +4 -0
  99. package/dist/views/ingredients/composables/use-ingredient-table.d.ts +8 -1
  100. package/dist/views/integration/components/netsuite/InventoryTransferIngredientTable.vue.d.ts +16 -2
  101. package/dist/views/receive-request/components/transfer-form/TransferFormWithController.vue.d.ts +33 -5
  102. package/dist/views/receive-request/components/transfer-form/components/ForecastStock.vue.d.ts +16 -2
  103. package/dist/views/receive-request/components/transfer-form/components/TransferItemTable.vue.d.ts +32 -4
  104. package/dist/views/receive-request/components/transfer-form/composables/use-transfer-items.d.ts +8 -1
  105. package/dist/views/receive-request/composables/use-process-purchase-order.d.ts +41 -6
  106. package/dist/views/receive-request/composables/use-receive-request-form.d.ts +246 -36
  107. package/dist/views/receive-request/composables/use-receive-request-table.d.ts +287 -42
  108. package/dist/views/recipe/components/recipe-form/RecipeForm.vue.d.ts +16 -0
  109. package/dist/views/stock/components/StockRecordCard.vue.d.ts +1 -0
  110. package/dist/views/stock/components/dialog/AdjustedItemForm.vue.d.ts +16 -2
  111. package/dist/views/stock/type.d.ts +2 -0
  112. package/dist/views/transfer-template/components/transfer-template-dialog/TransferTemplateDialog.vue.d.ts +16 -2
  113. package/dist/views/transfer-template/components/transfer-template-form/components/NetSuiteCustomCodeSelection.vue.d.ts +16 -2
  114. package/dist/views/transfer-template/components/transfer-template-form/components/TransferTemplateItemTable.vue.d.ts +16 -2
  115. package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-template-items.d.ts +8 -1
  116. package/dist/views/transfer-template/composables/use-netsuite-custom-field.d.ts +24 -3
  117. package/dist/views/transfer-template/composables/use-transfer-template-actions.d.ts +96 -12
  118. package/dist/views/transfer-template/composables/use-transfer-template-table.d.ts +96 -12
  119. package/dist/views/unit-cost-history/UnitCostHistoryView.vue.d.ts +2 -0
  120. package/dist/views/unit-cost-history/components/UnitCostDetailsSideSheet.vue.d.ts +19 -0
  121. package/dist/views/unit-cost-history/components/UnitCostRecalculationDialog.vue.d.ts +11 -0
  122. package/dist/views/unit-cost-history/composables/use-unit-cost-history.d.ts +65 -0
  123. package/dist/{vue-i18n-C6XNfngV.js → vue-i18n-Cf9iDkfk.js} +398 -398
  124. package/dist/{xlsx-BwNUbN_O.js → xlsx-lp5RXzSw.js} +398 -398
  125. package/dist/{xlsx.util-B_DE3inS.js → xlsx.util-BxpZNkEZ.js} +1 -1
  126. package/package.json +2 -2
  127. package/dist/RecipeView-Ck3Pa4fg.js +0 -646
  128. package/dist/SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-fMji2qKG.js +0 -172
  129. package/dist/decimal-Bf6AG_d3.js +0 -99
  130. package/dist/rules-y2OYGOro.js +0 -201
  131. package/dist/stock-BWUzlDTa.js +0 -75
@@ -1,58 +1,59 @@
1
- import { defineComponent as Ve, ref as Y, computed as R, onMounted as Xe, resolveComponent as O, openBlock as A, createElementBlock as V, Fragment as ie, createTextVNode as ce, createBlock as fe, withCtx as q, createElementVNode as n, toDisplayString as W, unref as v, createVNode as k, createCommentVNode as oe, h as C, watch as ze, renderList as Te, reactive as Mt, isRef as ht, normalizeClass as je, normalizeStyle as _t, Teleport as Lt, mergeProps as Nt } from "vue";
2
- import { F as yt, u as Et, _ as zt } from "./SingleColumnLayout.vue_vue_type_script_setup_true_lang-CWZkVCAj.js";
3
- import { useCoreStore as kt, useI18n as et } from "@feedmepos/mf-common";
4
- import { useSnackbar as tt, useDialog as Ht, components as he, useProxiedModel as Ot, useBreakpoints as Kt } from "@feedmepos/ui-library";
5
- import { o as Yt, u as Ge, J as Z, w as H, s as xt, v as Ue, K as _e, B as He, c as qt, a as Dt } from "./app-DJuq_faF.js";
6
- import { defineStore as At, storeToRefs as Gt } from "pinia";
7
- import { d as Ke, e as wt, f as Qt, a as xe } from "./date2-4vrHarNG.js";
8
- import { R as Wt, f as at, a as Ye, t as Zt, d as Re, o as St, p as Ft, l as Ct, m as $t } from "./rules-y2OYGOro.js";
9
- import { b as Jt, d as Xt } from "./xlsx.util-B_DE3inS.js";
10
- import { u as Bt } from "./stock-BWUzlDTa.js";
11
- import { u as nt } from "./stock-KxT4JbNf.js";
12
- import { D as bt, R as Be } from "./row-action.enum-BcW_L_nE.js";
13
- import { c as ea } from "./component-DpCUABT3.js";
14
- import { f as ta } from "./format-time-from-id-84iLSxVu.js";
15
- import { _ as aa } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-CAMkZRFI.js";
16
- import { E as na } from "./empty-placeholder-wf6-BWE8.js";
17
- import { u as oa } from "./vue-i18n-C6XNfngV.js";
18
- import { _ as sa, F as Ee } from "./TableActionableRow.vue_vue_type_script_setup_true_lang-Ca_eYa8-.js";
19
- const Qe = Yt((c, o) => {
1
+ import { defineComponent as Ve, ref as Y, computed as U, onMounted as et, resolveComponent as O, openBlock as A, createElementBlock as R, Fragment as ce, createTextVNode as ue, createBlock as pe, withCtx as q, createElementVNode as n, toDisplayString as W, unref as v, createVNode as _, createCommentVNode as se, h as S, watch as He, renderList as je, reactive as Lt, isRef as _t, normalizeClass as Ie, normalizeStyle as xt, Teleport as Et, mergeProps as zt } from "vue";
2
+ import { F as bt, u as Ht, _ as Ot } from "./SingleColumnLayout.vue_vue_type_script_setup_true_lang-CWZkVCAj.js";
3
+ import { useCoreStore as Dt, useI18n as tt } from "@feedmepos/mf-common";
4
+ import { useSnackbar as at, useDialog as Kt, components as ke, useProxiedModel as Yt, useBreakpoints as qt } from "@feedmepos/ui-library";
5
+ import { o as Gt, u as Ge, K as Z, y as H, s as At, v as Ue, L as _e, D as Oe, c as Qt, a as wt } from "./app-BAVBNKKH.js";
6
+ import { defineStore as St, storeToRefs as Wt } from "pinia";
7
+ import { d as Ye, e as Ct, f as Zt, a as De } from "./date2-CgwRU403.js";
8
+ import { R as Jt } from "./rules-CzPUVxD_.js";
9
+ import { e as nt, a as Xe, t as Xt, c as Re, m as $t, o as Ft, k as Bt, l as Tt, p as te, F as ea } from "./number-Cof88Fjz.js";
10
+ import { b as ta, d as aa } from "./xlsx.util-BxpZNkEZ.js";
11
+ import { u as jt } from "./stock-D9E1uFb1.js";
12
+ import { u as ot } from "./stock-BYPFH5a_.js";
13
+ import { D as ht, R as Te } from "./row-action.enum-BcW_L_nE.js";
14
+ import { c as na } from "./component-DpCUABT3.js";
15
+ import { f as oa } from "./format-time-from-id-C-mbWMLS.js";
16
+ import { _ as sa } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-CUIrR73y.js";
17
+ import { E as ra } from "./empty-placeholder-wf6-BWE8.js";
18
+ import { u as la } from "./vue-i18n-Cf9iDkfk.js";
19
+ import { _ as ia, F as ze } from "./TableActionableRow.vue_vue_type_script_setup_true_lang-Ca_eYa8-.js";
20
+ const Qe = Gt((c, s) => {
20
21
  function e() {
21
22
  return Ge().currentLocation.dbName;
22
23
  }
23
24
  return {
24
25
  async getDraft(u) {
25
- const _ = e(), b = `${c.inventoryBackendUrl}/${_}/closing-draft/${u}`;
26
- return o.get(b);
26
+ const k = e(), h = `${c.inventoryBackendUrl}/${k}/closing-draft/${u}`;
27
+ return s.get(h);
27
28
  },
28
29
  async readDrafts() {
29
- const u = e(), _ = `${c.inventoryBackendUrl}/${u}/closing-draft`;
30
- return o.get(_);
30
+ const u = e(), k = `${c.inventoryBackendUrl}/${u}/closing-draft`;
31
+ return s.get(k);
31
32
  },
32
33
  async runOperation(u) {
33
- const _ = e(), b = `${c.inventoryBackendUrl}/${_}/closing-draft/run-operation`;
34
- return o.post(b, u);
34
+ const k = e(), h = `${c.inventoryBackendUrl}/${k}/closing-draft/run-operation`;
35
+ return s.post(h, u);
35
36
  },
36
37
  async runOperationV1(u) {
37
- const _ = e(), b = `${c.inventoryBackendUrl}/${_}/closing-draft/v1/run-operation`;
38
- return o.post(b, u);
38
+ const k = e(), h = `${c.inventoryBackendUrl}/${k}/closing-draft/v1/run-operation`;
39
+ return s.post(h, u);
39
40
  },
40
41
  async sync(u) {
41
- const _ = e(), b = `${c.inventoryBackendUrl}/${_}/closing-draft/sync`;
42
- return o.post(b, u);
42
+ const k = e(), h = `${c.inventoryBackendUrl}/${k}/closing-draft/sync`;
43
+ return s.post(h, u);
43
44
  },
44
45
  async cloneDraft(u) {
45
- const _ = e(), b = `${c.inventoryBackendUrl}/${_}/closing-draft/${u}/clone`;
46
- return o.post(b, {});
46
+ const k = e(), h = `${c.inventoryBackendUrl}/${k}/closing-draft/${u}/clone`;
47
+ return s.post(h, {});
47
48
  }
48
49
  };
49
- }), ra = { class: "fm-typo-en-body-lg-400" }, la = { class: "fm-typo-en-body-lg-600" }, ia = {
50
+ }), ca = { class: "fm-typo-en-body-lg-400" }, ua = { class: "fm-typo-en-body-lg-600" }, da = {
50
51
  key: 0,
51
52
  class: "flex flex-col"
52
- }, ca = {
53
+ }, ma = {
53
54
  key: 0,
54
55
  class: "fm-typo-en-body-sm-400 text-fm-color-typo-error mt-4"
55
- }, ua = { class: "flex gap-12 py-8 justify-end w-full" }, Je = /* @__PURE__ */ Ve({
56
+ }, fa = { class: "flex gap-12 py-8 justify-end w-full" }, Je = /* @__PURE__ */ Ve({
56
57
  __name: "ClosingDraftAction",
57
58
  props: {
58
59
  draft: {},
@@ -61,8 +62,8 @@ const Qe = Yt((c, o) => {
61
62
  onFinished: { type: Function }
62
63
  },
63
64
  setup(c) {
64
- const o = c, e = Y(), u = Qe(), _ = tt(), b = Y(!1), r = Y(null), N = Y(!1), P = R(() => {
65
- switch (o.action) {
65
+ const s = c, e = Y(), u = Qe(), k = at(), h = Y(!1), r = Y(null), L = Y(!1), V = U(() => {
66
+ switch (s.action) {
66
67
  case Z.enum.approveDraft:
67
68
  return "Approve";
68
69
  case Z.enum.rejectDraft:
@@ -70,9 +71,9 @@ const Qe = Yt((c, o) => {
70
71
  case Z.enum.markAsFailed:
71
72
  return "Mark as Failed";
72
73
  }
73
- throw new Error(`Unknown action: ${o.action}`);
74
- }), I = R(() => {
75
- switch (o.action) {
74
+ throw new Error(`Unknown action: ${s.action}`);
75
+ }), I = U(() => {
76
+ switch (s.action) {
76
77
  case Z.enum.approveDraft:
77
78
  return "primary";
78
79
  case Z.enum.rejectDraft:
@@ -80,20 +81,20 @@ const Qe = Yt((c, o) => {
80
81
  case Z.enum.markAsFailed:
81
82
  return "destructive";
82
83
  }
83
- throw new Error(`Unknown action: ${o.action}`);
84
+ throw new Error(`Unknown action: ${s.action}`);
84
85
  });
85
- Xe(() => {
86
- if (o.draft.effectiveAt)
87
- r.value = new Date(o.draft.effectiveAt);
86
+ et(() => {
87
+ if (s.draft.effectiveAt)
88
+ r.value = new Date(s.draft.effectiveAt);
88
89
  else {
89
- const d = new Date(o.draft.createdAt);
90
+ const d = new Date(s.draft.createdAt);
90
91
  d.setHours(23, 59, 59, 999), r.value = d;
91
92
  }
92
- N.value = !0;
93
+ L.value = !0;
93
94
  });
94
- const x = R({
95
+ const x = U({
95
96
  get() {
96
- return r.value === null ? "" : Ke(r.value);
97
+ return r.value === null ? "" : Ye(r.value);
97
98
  },
98
99
  set(d) {
99
100
  if (d) {
@@ -102,9 +103,9 @@ const Qe = Yt((c, o) => {
102
103
  } else
103
104
  r.value = null;
104
105
  }
105
- }), M = R({
106
+ }), M = U({
106
107
  get() {
107
- return r.value === null ? "" : wt(r.value);
108
+ return r.value === null ? "" : Ct(r.value);
108
109
  },
109
110
  set(d) {
110
111
  if (d) {
@@ -113,144 +114,144 @@ const Qe = Yt((c, o) => {
113
114
  } else
114
115
  r.value = null;
115
116
  }
116
- }), G = R(() => r.value ? r.value.getTime() > (/* @__PURE__ */ new Date()).getTime() : !1);
117
+ }), G = U(() => r.value ? r.value.getTime() > (/* @__PURE__ */ new Date()).getTime() : !1);
117
118
  async function K(d) {
118
- b.value = !0;
119
+ h.value = !0;
119
120
  try {
120
121
  d ? await u.runOperationV1({
121
- _id: o.draft._id,
122
- _rev: o.draft._rev ?? "",
123
- action: o.action,
122
+ _id: s.draft._id,
123
+ _rev: s.draft._rev ?? "",
124
+ action: s.action,
124
125
  data: {
125
126
  effectiveAt: r.value ? r.value.toISOString() : null,
126
127
  remark: e.value
127
128
  }
128
129
  }).delayed(500) : await u.runOperation({
129
- _id: o.draft._id,
130
- _rev: o.draft._rev ?? "",
131
- action: o.action,
130
+ _id: s.draft._id,
131
+ _rev: s.draft._rev ?? "",
132
+ action: s.action,
132
133
  data: {
133
134
  effectiveAt: r.value ? r.value.toISOString() : null,
134
135
  remark: e.value
135
136
  }
136
- }).delayed(500), _.open({
137
+ }).delayed(500), k.open({
137
138
  title: "Success",
138
139
  message: "Action submitted",
139
140
  type: "success"
140
- }), o.onFinished();
141
+ }), s.onFinished();
141
142
  } catch (t) {
142
- _.open({
143
+ k.open({
143
144
  title: "Something went wrong",
144
145
  message: (t == null ? void 0 : t.message) ?? "Unable to submit action. Please try again",
145
146
  type: "error"
146
147
  }), console.error("error on submit closing draft action", t);
147
148
  } finally {
148
- b.value = !1;
149
+ h.value = !1;
149
150
  }
150
151
  }
151
152
  return (d, t) => {
152
- const j = O("FmLabel"), D = O("FmDatePicker"), Q = O("FmTimePicker"), g = O("FmTextField"), m = O("FmButton"), $ = O("FmForm");
153
- return N.value ? (A(), fe($, {
153
+ const j = O("FmLabel"), D = O("FmDatePicker"), Q = O("FmTimePicker"), y = O("FmTextField"), m = O("FmButton"), F = O("FmForm");
154
+ return L.value ? (A(), pe(F, {
154
155
  key: 1,
155
156
  onValidationSuccess: K,
156
157
  class: "flex flex-col gap-32",
157
- disabled: b.value
158
+ disabled: h.value
158
159
  }, {
159
160
  default: q(() => [
160
- n("div", ra, [
161
- t[4] || (t[4] = ce(" You are about to ")),
162
- n("span", la, W(P.value), 1),
163
- t[5] || (t[5] = ce(" this draft. Please provide a remark to justify this action. "))
161
+ n("div", ca, [
162
+ t[4] || (t[4] = ue(" You are about to ")),
163
+ n("span", ua, W(V.value), 1),
164
+ t[5] || (t[5] = ue(" this draft. Please provide a remark to justify this action. "))
164
165
  ]),
165
- d.action === v(Z).enum.approveDraft ? (A(), V("div", ia, [
166
- k(j, { class: "fm-typo-en-body-lg-600" }, {
166
+ d.action === v(Z).enum.approveDraft ? (A(), R("div", da, [
167
+ _(j, { class: "fm-typo-en-body-lg-600" }, {
167
168
  default: q(() => t[6] || (t[6] = [
168
- ce("Closing Date")
169
+ ue("Closing Date")
169
170
  ])),
170
171
  _: 1
171
172
  }),
172
- k(D, {
173
+ _(D, {
173
174
  modelValue: x.value,
174
175
  "onUpdate:modelValue": t[0] || (t[0] = (z) => x.value = z),
175
- max: v(Ke)(/* @__PURE__ */ new Date())
176
+ max: v(Ye)(/* @__PURE__ */ new Date())
176
177
  }, null, 8, ["modelValue", "max"]),
177
- k(j, { class: "fm-typo-en-body-lg-600" }, {
178
+ _(j, { class: "fm-typo-en-body-lg-600" }, {
178
179
  default: q(() => t[7] || (t[7] = [
179
- ce("Closing Time")
180
+ ue("Closing Time")
180
181
  ])),
181
182
  _: 1
182
183
  }),
183
- k(Q, {
184
+ _(Q, {
184
185
  modelValue: M.value,
185
186
  "onUpdate:modelValue": t[1] || (t[1] = (z) => M.value = z)
186
187
  }, null, 8, ["modelValue"]),
187
- G.value ? (A(), V("div", ca, " Cannot select future date ")) : oe("", !0)
188
- ])) : oe("", !0),
189
- k(g, {
188
+ G.value ? (A(), R("div", ma, " Cannot select future date ")) : se("", !0)
189
+ ])) : se("", !0),
190
+ _(y, {
190
191
  modelValue: e.value,
191
192
  "onUpdate:modelValue": t[2] || (t[2] = (z) => e.value = z),
192
193
  label: "Remark",
193
194
  "label-mark": "required",
194
- rules: [v(Wt)()]
195
+ rules: [v(Jt)()]
195
196
  }, null, 8, ["modelValue", "rules"]),
196
- n("div", ua, [
197
- k(m, {
197
+ n("div", fa, [
198
+ _(m, {
198
199
  label: "Cancel",
199
200
  variant: "tertiary",
200
201
  onClick: t[3] || (t[3] = (z) => d.onCancel())
201
202
  }),
202
- k(m, {
203
- label: P.value,
203
+ _(m, {
204
+ label: V.value,
204
205
  type: "submit",
205
206
  variant: I.value,
206
- loading: b.value
207
+ loading: h.value
207
208
  }, null, 8, ["label", "variant", "loading"])
208
209
  ])
209
210
  ]),
210
211
  _: 1
211
- }, 8, ["disabled"])) : (A(), V(ie, { key: 0 }, [
212
- ce("Loading")
212
+ }, 8, ["disabled"])) : (A(), R(ce, { key: 0 }, [
213
+ ue("Loading")
213
214
  ], 64));
214
215
  };
215
216
  }
216
- }), da = Re(0);
217
- function Tt(c) {
218
- const o = c.measurementsAmounts.groupBy((u) => u.measurement.id), e = c.sku.unit.measurements.reduce((u, _) => {
219
- var N, P;
220
- const b = ((P = (N = o.get(_.id)) == null ? void 0 : N[0]) == null ? void 0 : P.amount) ?? da, r = at(_.conversion, b);
221
- return u + +Ye(r);
222
- }, +Ye(c.baseAmount));
223
- return Zt(e, c.baseAmount.precision);
217
+ }), pa = Re(0);
218
+ function It(c) {
219
+ const s = c.measurementsAmounts.groupBy((u) => u.measurement.id), e = c.sku.unit.measurements.reduce((u, k) => {
220
+ var L, V;
221
+ const h = ((V = (L = s.get(k.id)) == null ? void 0 : L[0]) == null ? void 0 : V.amount) ?? pa, r = nt(k.conversion, h);
222
+ return u + +Xe(r);
223
+ }, +Xe(c.baseAmount));
224
+ return Xt(e, c.baseAmount.precision);
224
225
  }
225
- const ma = Re(0), fa = Re(100);
226
- function pa(c, o, e, u, _, b, r) {
227
- var ae, re, de, F, w;
228
- const N = Tt(c), P = u ?? N, I = St(P, o), x = o.amount === 0 ? null : Ft(I, {
229
- ...o,
230
- amount: Math.abs(o.amount)
231
- }), M = x ? at(x, fa) : null, G = ((ae = c.sku.defaultCost) == null ? void 0 : ae.costPerUnit) ?? { amount: 0, precision: 0 }, K = Number(H.toFormatString({ value: G })), d = ((de = (re = c.sku.defaultCost) == null ? void 0 : re.measurement) == null ? void 0 : de.conversion) ?? {
226
+ const va = Re(0), ya = Re(100);
227
+ function ga(c, s, e, u, k, h, r) {
228
+ var ne, le, me, $, w;
229
+ const L = It(c), V = u ?? L, I = $t(V, s), x = s.amount === 0 ? null : Ft(I, {
230
+ ...s,
231
+ amount: Math.abs(s.amount)
232
+ }), M = x ? nt(x, ya) : null, G = ((ne = c.sku.defaultCost) == null ? void 0 : ne.costPerUnit) ?? { amount: 0, precision: 0 }, K = Number(H.toFormatString({ value: G })), d = ((me = (le = c.sku.defaultCost) == null ? void 0 : le.measurement) == null ? void 0 : me.conversion) ?? {
232
233
  amount: 1,
233
234
  precision: 0
234
235
  }, t = Number(
235
236
  H.toFormatString({ value: d })
236
- ), j = _ ? Number(H.toFormatString({ value: _ })) : 0, D = Number(H.toFormatString({ value: o })), Q = Number(H.toFormatString({ value: P })), g = Q - D, m = g * K / t, $ = Q * K / t, z = D * K / t, te = {};
237
- return r && b && r.forEach((y) => {
238
- const U = { amount: 0, precision: 0 }, J = b[y];
237
+ ), j = k ? Number(H.toFormatString({ value: k })) : 0, D = Number(H.toFormatString({ value: s })), Q = Number(H.toFormatString({ value: V })), y = Q - D, m = y * K / t, F = Q * K / t, z = D * K / t, ae = {};
238
+ return r && h && r.forEach((g) => {
239
+ const P = { amount: 0, precision: 0 }, J = h[g];
239
240
  if (J) {
240
- const ee = Ct(U, J);
241
- te[`adjustment_${y}`] = Ye(ee);
241
+ const ee = Bt(P, J);
242
+ ae[`adjustment_${g}`] = Xe(ee);
242
243
  } else
243
- te[`adjustment_${y}`] = "0";
244
+ ae[`adjustment_${g}`] = "0";
244
245
  }), {
245
246
  code: c.sku.code,
246
247
  name: c.sku.name,
247
248
  baseUnit: c.sku.unit.abbrev,
248
- costUnit: ((w = (F = c.sku.defaultCost) == null ? void 0 : F.measurement) == null ? void 0 : w.abbrev) ?? null,
249
+ costUnit: ((w = ($ = c.sku.defaultCost) == null ? void 0 : $.measurement) == null ? void 0 : w.abbrev) ?? null,
249
250
  baseUnitAmount: Number(H.toFormatString({ value: c.baseAmount })),
250
251
  ...c.measurementsAmounts.filter(
251
- (y) => va(y.measurement) && e.includes(y.measurement.id)
252
+ (g) => ba(g.measurement) && e.includes(g.measurement.id)
252
253
  ).reduce(
253
- (y, U, J) => (y[`measurementAbbrev${J}`] = `(${U.measurement.abbrev}) × ${H.toFormatString({ value: U.measurement.conversion })}`, y[`measurementAmount${J}`] = Number(H.toFormatString({ value: U.amount })), y),
254
+ (g, P, J) => (g[`measurementAbbrev${J}`] = `(${P.measurement.abbrev}) × ${H.toFormatString({ value: P.measurement.conversion })}`, g[`measurementAmount${J}`] = Number(H.toFormatString({ value: P.amount })), g),
254
255
  {}
255
256
  ),
256
257
  systemBalance: D,
@@ -258,39 +259,39 @@ function pa(c, o, e, u, _, b, r) {
258
259
  adjustedAmount: Number(H.toFormatString({ value: I })),
259
260
  adjustedDiffPercentage: M ? Number(
260
261
  H.toFormatString({
261
- value: $t(M, 2)
262
+ value: Tt(M, 2)
262
263
  })
263
264
  ) : null,
264
265
  costPerUnit: K,
265
266
  opening: j,
266
- ...te,
267
- varianceQty: g,
267
+ ...ae,
268
+ varianceQty: y,
268
269
  varianceInCost: m,
269
- stockTakeValue: $,
270
+ stockTakeValue: F,
270
271
  systemValue: z
271
272
  };
272
273
  }
273
- function va(c) {
274
+ function ba(c) {
274
275
  return !c.abbrev.toLocaleLowerCase().includes("inactive");
275
276
  }
276
- function ga(c) {
277
- const o = jt(c);
277
+ function ha(c) {
278
+ const s = Pt(c);
278
279
  return c.reduce(
279
280
  (e, u) => {
280
- var _;
281
- return Math.max(e, ((_ = o == null ? void 0 : o.get(u.sku._id)) == null ? void 0 : _[0].length) ?? 0);
281
+ var k;
282
+ return Math.max(e, ((k = s == null ? void 0 : s.get(u.sku._id)) == null ? void 0 : k[0].length) ?? 0);
282
283
  },
283
284
  0
284
285
  );
285
286
  }
286
- function jt(c) {
287
+ function Pt(c) {
287
288
  return c.groupBy(
288
- (o) => o.sku._id,
289
- (o) => o.measurementsAmounts.filter((e) => !e.measurement.abbrev.toLocaleLowerCase().includes("inactive")).map((e) => e.measurement.id)
289
+ (s) => s.sku._id,
290
+ (s) => s.measurementsAmounts.filter((e) => !e.measurement.abbrev.toLocaleLowerCase().includes("inactive")).map((e) => e.measurement.id)
290
291
  );
291
292
  }
292
- function ya(c, o = []) {
293
- const e = xt(), u = e === "MYR" ? "RM" : e;
293
+ function ka(c, s = []) {
294
+ const e = At(), u = e === "MYR" ? "RM" : e;
294
295
  return [
295
296
  {
296
297
  id: "code",
@@ -317,9 +318,9 @@ function ya(c, o = []) {
317
318
  name: "Opening (B/F)"
318
319
  },
319
320
  // Dynamic adjustment type columns
320
- ...o.map((b) => ({
321
- id: `adjustment_${b}`,
322
- name: Ue(b)
321
+ ...s.map((h) => ({
322
+ id: `adjustment_${h}`,
323
+ name: Ue(h)
323
324
  })),
324
325
  {
325
326
  id: "systemBalance",
@@ -353,7 +354,7 @@ function ya(c, o = []) {
353
354
  id: "baseUnitAmount",
354
355
  name: "Base unit amount"
355
356
  },
356
- ...Array.from({ length: c }).flatMap((b, r) => [
357
+ ...Array.from({ length: c }).flatMap((h, r) => [
357
358
  {
358
359
  id: `measurementAmount${r}`,
359
360
  name: `UOM amount ${r + 1}`
@@ -365,69 +366,69 @@ function ya(c, o = []) {
365
366
  ])
366
367
  ];
367
368
  }
368
- function ba(c, o, e) {
369
- var te, ue, ae, re, de, F, w;
370
- const u = o.groupBy(
371
- (y) => y.id,
372
- (y) => y.balance
373
- ), _ = e.groupBy(
374
- (y) => y.id,
375
- (y) => y.balance
376
- ), b = /* @__PURE__ */ new Map();
369
+ function _a(c, s, e) {
370
+ var ae, de, ne, le, me, $, w;
371
+ const u = s.groupBy(
372
+ (g) => g.id,
373
+ (g) => g.balance
374
+ ), k = e.groupBy(
375
+ (g) => g.id,
376
+ (g) => g.balance
377
+ ), h = /* @__PURE__ */ new Map();
377
378
  if (c.opening)
378
- for (const y of c.opening)
379
- b.set(y.skuId, y.balance);
380
- const r = /* @__PURE__ */ new Set(), N = /* @__PURE__ */ new Map();
379
+ for (const g of c.opening)
380
+ h.set(g.skuId, g.balance);
381
+ const r = /* @__PURE__ */ new Set(), L = /* @__PURE__ */ new Map();
381
382
  if (c.adjustmentSnapshot)
382
- for (const y of c.adjustmentSnapshot)
383
- y.adjustmentsByType && (Object.keys(y.adjustmentsByType).forEach((U) => r.add(U)), N.set(y.skuId, y.adjustmentsByType));
384
- const P = ["receive", "sales", "wastage"], I = [];
385
- P.forEach((y) => {
386
- r.has(y) && (I.push(y), r.delete(y));
383
+ for (const g of c.adjustmentSnapshot)
384
+ g.adjustmentsByType && (Object.keys(g.adjustmentsByType).forEach((P) => r.add(P)), L.set(g.skuId, g.adjustmentsByType));
385
+ const V = ["receive", "sales", "wastage"], I = [];
386
+ V.forEach((g) => {
387
+ r.has(g) && (I.push(g), r.delete(g));
387
388
  });
388
- const x = Array.from(r).sort(), M = [...I, ...x], G = [...c.items, ...c.negativeStockItems ?? []], K = jt(G), d = G.map((y) => {
389
- var ke, De, ye;
390
- const U = ((ke = u.get(y.sku._id)) == null ? void 0 : ke[0]) ?? ma, J = ((De = K == null ? void 0 : K.get(y.sku._id)) == null ? void 0 : De[0]) ?? [], ee = b.get(y.sku._id), X = N.get(y.sku._id);
391
- return pa(
392
- y,
393
- U,
389
+ const x = Array.from(r).sort(), M = [...I, ...x], G = [...c.items, ...c.negativeStockItems ?? []], K = Pt(G), d = G.map((g) => {
390
+ var xe, Ae, be;
391
+ const P = ((xe = u.get(g.sku._id)) == null ? void 0 : xe[0]) ?? va, J = ((Ae = K == null ? void 0 : K.get(g.sku._id)) == null ? void 0 : Ae[0]) ?? [], ee = h.get(g.sku._id), X = L.get(g.sku._id);
392
+ return ga(
393
+ g,
394
+ P,
394
395
  J,
395
- (ye = _.get(y.sku._id)) == null ? void 0 : ye[0],
396
+ (be = k.get(g.sku._id)) == null ? void 0 : be[0],
396
397
  ee,
397
398
  X,
398
399
  M
399
400
  );
400
- }), t = ga(G), D = kt().currentBusiness.value, Q = ya(t, M), g = [
401
+ }), t = ha(G), D = Dt().currentBusiness.value, Q = ka(t, M), y = [
401
402
  ["Business name:", D == null ? void 0 : D.name],
402
403
  ["Business ID:", D == null ? void 0 : D._id],
403
404
  ["Menu version", D == null ? void 0 : D.menuVersion],
404
405
  ["Created at", new Date(c.createdAt)],
405
- ["Created by", (te = c.createdBy) == null ? void 0 : te.name],
406
+ ["Created by", (ae = c.createdBy) == null ? void 0 : ae.name],
406
407
  ["Updated at", new Date(c.updatedAt)],
407
- ["Updated by", (ue = c.updatedBy) == null ? void 0 : ue.name],
408
+ ["Updated by", (de = c.updatedBy) == null ? void 0 : de.name],
408
409
  ["Recent action", c.approvedAt ? "Approve" : c.rejectionHistory ? "Reject" : ""],
409
410
  [
410
411
  "Action by",
411
- c.approvedAt ? (ae = c.approvedBy) == null ? void 0 : ae.name : c.rejectionHistory ? (de = (re = c.rejectionHistory[0]) == null ? void 0 : re.rejectedBy) == null ? void 0 : de.name : ""
412
+ c.approvedAt ? (ne = c.approvedBy) == null ? void 0 : ne.name : c.rejectionHistory ? (me = (le = c.rejectionHistory[0]) == null ? void 0 : le.rejectedBy) == null ? void 0 : me.name : ""
412
413
  ],
413
414
  [
414
415
  "Action at",
415
- c.approvedAt ? new Date(c.approvedAt) : c.rejectionHistory ? new Date((F = c.rejectionHistory[0]) == null ? void 0 : F.rejectedAt) : ""
416
+ c.approvedAt ? new Date(c.approvedAt) : c.rejectionHistory ? new Date(($ = c.rejectionHistory[0]) == null ? void 0 : $.rejectedAt) : ""
416
417
  ],
417
418
  [
418
419
  "Action remark",
419
420
  c.approvedAt ? c.approveRemark : c.rejectionHistory ? new Date((w = c.rejectionHistory[0]) == null ? void 0 : w.rejectRemark) : ""
420
421
  ],
421
422
  [],
422
- Q.map((y) => y.name),
423
- ...d.map((y) => Q.map((U) => y[U.id]))
424
- ], m = Q.map((y) => `system:${y.id}`), $ = Jt(g, m), z = `[${D == null ? void 0 : D.name}] closing draft (${Qt(new Date(c.updatedAt))}).xlsx`;
425
- return Xt($, z), z;
423
+ Q.map((g) => g.name),
424
+ ...d.map((g) => Q.map((P) => g[P.id]))
425
+ ], m = Q.map((g) => `system:${g.id}`), F = ta(y, m), z = `[${D == null ? void 0 : D.name}] closing draft (${Zt(new Date(c.updatedAt))}).xlsx`;
426
+ return aa(F, z), z;
426
427
  }
427
- const ha = { class: "flex flex-col" }, _a = {
428
+ const xa = { class: "flex flex-col" }, Da = {
428
429
  key: 0,
429
430
  class: "fm-typo-en-body-sm-400 text-fm-color-typo-error mt-4"
430
- }, ka = { class: "flex gap-12 py-8 justify-end w-full" }, xa = /* @__PURE__ */ Ve({
431
+ }, Aa = { class: "flex gap-12 py-8 justify-end w-full" }, wa = /* @__PURE__ */ Ve({
431
432
  __name: "RefreshBalanceAction",
432
433
  props: {
433
434
  draft: {},
@@ -435,21 +436,21 @@ const ha = { class: "flex flex-col" }, _a = {
435
436
  onFinished: { type: Function }
436
437
  },
437
438
  setup(c) {
438
- const o = c;
439
- nt();
440
- const e = Y(!1), u = Y(null), _ = Y(!1);
441
- Xe(() => {
442
- if (o.draft.effectiveAt)
443
- u.value = new Date(o.draft.effectiveAt);
439
+ const s = c;
440
+ ot();
441
+ const e = Y(!1), u = Y(null), k = Y(!1);
442
+ et(() => {
443
+ if (s.draft.effectiveAt)
444
+ u.value = new Date(s.draft.effectiveAt);
444
445
  else {
445
- const I = new Date(o.draft.createdAt);
446
+ const I = new Date(s.draft.createdAt);
446
447
  I.setHours(23, 59, 59, 999), u.value = I;
447
448
  }
448
- _.value = !0;
449
+ k.value = !0;
449
450
  });
450
- const b = R({
451
+ const h = U({
451
452
  get() {
452
- return u.value === null ? "" : Ke(u.value);
453
+ return u.value === null ? "" : Ye(u.value);
453
454
  },
454
455
  set(I) {
455
456
  if (I) {
@@ -458,177 +459,177 @@ const ha = { class: "flex flex-col" }, _a = {
458
459
  } else
459
460
  u.value = null;
460
461
  }
461
- }), r = R({
462
+ }), r = U({
462
463
  get() {
463
- return u.value === null ? "" : wt(u.value);
464
+ return u.value === null ? "" : Ct(u.value);
464
465
  },
465
466
  set(I) {
466
467
  if (I) {
467
- const x = /* @__PURE__ */ new Date(`${b.value} ${I}`);
468
+ const x = /* @__PURE__ */ new Date(`${h.value} ${I}`);
468
469
  x.setSeconds(59, 999), u.value = x;
469
470
  } else
470
471
  u.value = null;
471
472
  }
472
- }), N = R(() => u.value ? u.value.getTime() > (/* @__PURE__ */ new Date()).getTime() : !1);
473
- async function P() {
474
- e.value = !0, o.onFinished(u.value.toISOString());
473
+ }), L = U(() => u.value ? u.value.getTime() > (/* @__PURE__ */ new Date()).getTime() : !1);
474
+ async function V() {
475
+ e.value = !0, s.onFinished(u.value.toISOString());
475
476
  }
476
477
  return (I, x) => {
477
478
  const M = O("FmLabel"), G = O("FmDatePicker"), K = O("FmTimePicker"), d = O("FmButton"), t = O("FmForm");
478
- return _.value ? (A(), fe(t, {
479
+ return k.value ? (A(), pe(t, {
479
480
  key: 1,
480
- onValidationSuccess: P,
481
+ onValidationSuccess: V,
481
482
  class: "flex flex-col gap-32",
482
483
  disabled: e.value
483
484
  }, {
484
485
  default: q(() => [
485
486
  x[5] || (x[5] = n("div", { class: "fm-typo-en-body-lg-400" }, [
486
487
  n("p", null, [
487
- ce(" Performing "),
488
+ ue(" Performing "),
488
489
  n("span", { class: "fm-typo-en-body-lg-600" }, '"Refresh Balance"'),
489
- ce(" until closing effective date and time. ")
490
+ ue(" until closing effective date and time. ")
490
491
  ]),
491
492
  n("p", { class: "mt-2" }, [
492
- ce(" Please note that this action will "),
493
+ ue(" Please note that this action will "),
493
494
  n("b", null, "update"),
494
- ce(" the effective date and time. ")
495
+ ue(" the effective date and time. ")
495
496
  ])
496
497
  ], -1)),
497
- n("div", ha, [
498
- k(M, { class: "fm-typo-en-body-lg-600" }, {
498
+ n("div", xa, [
499
+ _(M, { class: "fm-typo-en-body-lg-600" }, {
499
500
  default: q(() => x[3] || (x[3] = [
500
- ce("Closing Date")
501
+ ue("Closing Date")
501
502
  ])),
502
503
  _: 1
503
504
  }),
504
- k(G, {
505
- modelValue: b.value,
506
- "onUpdate:modelValue": x[0] || (x[0] = (j) => b.value = j),
507
- max: v(Ke)(/* @__PURE__ */ new Date())
505
+ _(G, {
506
+ modelValue: h.value,
507
+ "onUpdate:modelValue": x[0] || (x[0] = (j) => h.value = j),
508
+ max: v(Ye)(/* @__PURE__ */ new Date())
508
509
  }, null, 8, ["modelValue", "max"]),
509
- k(M, { class: "fm-typo-en-body-lg-600" }, {
510
+ _(M, { class: "fm-typo-en-body-lg-600" }, {
510
511
  default: q(() => x[4] || (x[4] = [
511
- ce("Closing Time")
512
+ ue("Closing Time")
512
513
  ])),
513
514
  _: 1
514
515
  }),
515
- k(K, {
516
+ _(K, {
516
517
  modelValue: r.value,
517
518
  "onUpdate:modelValue": x[1] || (x[1] = (j) => r.value = j)
518
519
  }, null, 8, ["modelValue"]),
519
- N.value ? (A(), V("div", _a, " Cannot select future date ")) : oe("", !0)
520
+ L.value ? (A(), R("div", Da, " Cannot select future date ")) : se("", !0)
520
521
  ]),
521
- n("div", ka, [
522
- k(d, {
522
+ n("div", Aa, [
523
+ _(d, {
523
524
  label: "Cancel",
524
525
  variant: "tertiary",
525
526
  onClick: x[2] || (x[2] = (j) => I.onCancel())
526
527
  }),
527
- k(d, {
528
+ _(d, {
528
529
  label: "Refresh balance",
529
530
  type: "submit",
530
531
  variant: "primary",
531
532
  loading: e.value,
532
- disabled: N.value
533
+ disabled: L.value
533
534
  }, null, 8, ["loading", "disabled"])
534
535
  ])
535
536
  ]),
536
537
  _: 1
537
- }, 8, ["disabled"])) : (A(), V(ie, { key: 0 }, [
538
- ce("Loading")
538
+ }, 8, ["disabled"])) : (A(), R(ce, { key: 0 }, [
539
+ ue("Loading")
539
540
  ], 64));
540
541
  };
541
542
  }
542
- }), qe = At(
543
+ }), qe = St(
543
544
  "closingDraftActions",
544
545
  function() {
545
- const o = Ht(), e = tt(), u = nt(), _ = Qe(), b = Bt(), r = Y(!1), N = Y();
546
- function P(g) {
546
+ const s = Kt(), e = at(), u = ot(), k = Qe(), h = jt(), r = Y(!1), L = Y();
547
+ function V(y) {
547
548
  const m = {
548
- draft: g
549
+ draft: y
549
550
  };
550
- N.value = m, r.value = !0;
551
+ L.value = m, r.value = !0;
551
552
  }
552
- async function I(g) {
553
- var $;
554
- if (g.status === _e.enum.COMPLETED) {
555
- const z = g.closingAdjustmentId;
553
+ async function I(y) {
554
+ var F;
555
+ if (y.status === _e.enum.COMPLETED) {
556
+ const z = y.closingAdjustmentId;
556
557
  if (!z)
557
558
  return e.open({
558
559
  title: "Something went wrong",
559
560
  message: "Closing draft is completed but closing document cannot be found.",
560
561
  type: "error"
561
562
  }), console.error("Closing draft is completed but closing document cannot be found.", {
562
- draftId: g._id
563
+ draftId: y._id
563
564
  }), [];
564
- const te = await u.readAdjustmentById(z);
565
- return ((te == null ? void 0 : te.skus) ?? []).map((ae) => ({
566
- id: ae.sku._id,
567
- balance: ae.fromBalance,
568
- costs: ae.fromCostBalances
565
+ const ae = await u.readAdjustmentById(z);
566
+ return ((ae == null ? void 0 : ae.skus) ?? []).map((ne) => ({
567
+ id: ne.sku._id,
568
+ balance: ne.fromBalance,
569
+ costs: ne.fromCostBalances
569
570
  }));
570
571
  } else
571
- return await b.readStockBalance(), (($ = b.stockBalance) == null ? void 0 : $.skus) ?? [];
572
+ return await h.readStockBalance(), ((F = h.stockBalance) == null ? void 0 : F.skus) ?? [];
572
573
  }
573
- async function x(g, m, $) {
574
+ async function x(y, m, F) {
574
575
  m || (e.open({
575
576
  title: "Exporting",
576
577
  message: "Fetching data..."
577
- }), m = await I(g)), ba(g, m, $ ?? []);
578
+ }), m = await I(y)), _a(y, m, F ?? []);
578
579
  }
579
- function M(g, m, $) {
580
- o.open({
580
+ function M(y, m, F) {
581
+ s.open({
581
582
  title: "Approve draft",
582
583
  contentComponent: Je,
583
584
  contentComponentProps: {
584
- draft: g,
585
+ draft: y,
585
586
  action: Z.enum.approveDraft,
586
587
  onFinished: () => {
587
- o.close(), m == null || m();
588
+ s.close(), m == null || m();
588
589
  },
589
590
  onCancel: () => {
590
- o.close();
591
+ s.close();
591
592
  }
592
593
  }
593
594
  }).onClose(() => {
594
- $ == null || $();
595
+ F == null || F();
595
596
  });
596
597
  }
597
- function G(g, m) {
598
- o.open({
598
+ function G(y, m) {
599
+ s.open({
599
600
  title: "Reject draft",
600
601
  contentComponent: Je,
601
602
  contentComponentProps: {
602
- draft: g,
603
+ draft: y,
603
604
  action: Z.enum.rejectDraft,
604
605
  onFinished: () => {
605
- o.close(), m == null || m();
606
+ s.close(), m == null || m();
606
607
  },
607
- onCancel: () => o.close()
608
+ onCancel: () => s.close()
608
609
  }
609
610
  });
610
611
  }
611
- function K(g, m) {
612
- o.open({
612
+ function K(y, m) {
613
+ s.open({
613
614
  title: "Mark draft as failed",
614
615
  contentComponent: Je,
615
616
  contentComponentProps: {
616
- draft: g,
617
+ draft: y,
617
618
  action: Z.enum.markAsFailed,
618
619
  onFinished: () => {
619
- o.close(), m == null || m();
620
+ s.close(), m == null || m();
620
621
  },
621
- onCancel: () => o.close()
622
+ onCancel: () => s.close()
622
623
  }
623
624
  });
624
625
  }
625
- async function d(g, m) {
626
- await _.sync({
627
- _id: g._id,
628
- _rev: g._rev ?? "",
626
+ async function d(y, m) {
627
+ await k.sync({
628
+ _id: y._id,
629
+ _rev: y._rev ?? "",
629
630
  action: Z.enum.approveDraft,
630
631
  data: {
631
- remark: g.remark ?? ""
632
+ remark: y.remark ?? ""
632
633
  }
633
634
  }).delayed(500), e.open({
634
635
  title: "Success",
@@ -639,55 +640,55 @@ const ha = { class: "flex flex-col" }, _a = {
639
640
  function t() {
640
641
  r.value = !1;
641
642
  }
642
- async function j(g, m, $) {
643
- await o.open({
643
+ async function j(y, m, F) {
644
+ await s.open({
644
645
  title: "Refresh balance",
645
- contentComponent: xa,
646
+ contentComponent: wa,
646
647
  contentComponentProps: {
647
- draft: g,
648
+ draft: y,
648
649
  onFinished: (z) => {
649
- o.close(), $ == null || $(z);
650
+ s.close(), F == null || F(z);
650
651
  },
651
652
  onCancel: async () => {
652
- o.close(), m == null || m();
653
+ s.close(), m == null || m();
653
654
  }
654
655
  }
655
656
  });
656
657
  }
657
- async function D(g) {
658
- await o.open({
658
+ async function D(y) {
659
+ await s.open({
659
660
  title: "Invalidate closing draft cache",
660
661
  message: "It will invalidate opening and stock movement cache for this draft.",
661
662
  primaryActions: { text: "Proceed", close: !0 },
662
663
  secondaryActions: { text: "Cancel", close: !0 }
663
664
  }).onPrimary(async () => {
664
- await u.recalculation.scheduleInvalidateClosingDraftCache([g._id]), e.open({
665
+ await u.recalculation.scheduleInvalidateClosingDraftCache([y._id]), e.open({
665
666
  title: "Success",
666
667
  message: "Invalidate cache requested",
667
668
  type: "success"
668
669
  });
669
670
  });
670
671
  }
671
- async function Q(g, m) {
672
+ async function Q(y, m) {
672
673
  try {
673
674
  e.open({
674
675
  title: "Cloning",
675
676
  message: "Creating a copy of the draft..."
676
- }), await _.cloneDraft(g._id), e.open({
677
+ }), await k.cloneDraft(y._id), e.open({
677
678
  title: "Success",
678
679
  message: "Draft cloned successfully",
679
680
  type: "success"
680
681
  }), m == null || m();
681
- } catch ($) {
682
+ } catch (F) {
682
683
  e.open({
683
684
  title: "Error",
684
- message: ($ == null ? void 0 : $.message) || "Failed to clone draft",
685
+ message: (F == null ? void 0 : F.message) || "Failed to clone draft",
685
686
  type: "error"
686
687
  });
687
688
  }
688
689
  }
689
690
  return {
690
- viewDraft: P,
691
+ viewDraft: V,
691
692
  closeDraftDialog: t,
692
693
  approveDraft: M,
693
694
  rejectDraft: G,
@@ -697,12 +698,12 @@ const ha = { class: "flex flex-col" }, _a = {
697
698
  refreshBalance: j,
698
699
  cloneDraft: Q,
699
700
  viewClosingDraftShow: r,
700
- viewClosingDraftProps: N,
701
+ viewClosingDraftProps: L,
701
702
  invalidateDraftCache: D
702
703
  };
703
704
  }
704
705
  );
705
- function Oe(c) {
706
+ function Ke(c) {
706
707
  switch (c) {
707
708
  case "DRAFT":
708
709
  return "fm-status-badge-draft";
@@ -714,53 +715,53 @@ function Oe(c) {
714
715
  return "fm-status-badge-complete";
715
716
  }
716
717
  }
717
- const Da = At(
718
+ const Sa = St(
718
719
  "closingDraftTable",
719
720
  function() {
720
- const { t: o } = et(), e = kt(), u = qe(), _ = Y(new Array()), b = Y(!1), r = Ge(), N = Qe();
721
- async function P() {
722
- if (_.value = [], !!r._currentLocation) {
723
- b.value = !0;
721
+ const { t: s } = tt(), e = Dt(), u = qe(), k = Y(new Array()), h = Y(!1), r = Ge(), L = Qe();
722
+ async function V() {
723
+ if (k.value = [], !!r._currentLocation) {
724
+ h.value = !0;
724
725
  try {
725
- const [d] = await Promise.all([N.readDrafts()]).delayed(1e3);
726
- _.value = d.reverse();
726
+ const [d] = await Promise.all([L.readDrafts()]).delayed(1e3);
727
+ k.value = d.reverse();
727
728
  } catch (d) {
728
729
  console.log("Something went wrong when fetching drafts:", d);
729
730
  } finally {
730
- b.value = !1;
731
+ h.value = !1;
731
732
  }
732
733
  }
733
734
  }
734
735
  async function I(d) {
735
- if (!_.value.find((t) => t._id) && r._currentLocation) {
736
- b.value = !0;
736
+ if (!k.value.find((t) => t._id) && r._currentLocation) {
737
+ h.value = !0;
737
738
  try {
738
739
  const [t] = await Promise.all([
739
- N.getDraft(d),
740
+ L.getDraft(d),
740
741
  new Promise((j) => setTimeout(j, 1e3))
741
742
  ]);
742
- _.value = [t];
743
+ k.value = [t];
743
744
  } catch (t) {
744
745
  console.log("Something went wrong when fetching drafts:", t);
745
746
  } finally {
746
- b.value = !1;
747
+ h.value = !1;
747
748
  }
748
749
  }
749
750
  }
750
751
  function x(d) {
751
- _.value = _.value.map((t) => t._id === d._id ? {
752
+ k.value = k.value.map((t) => t._id === d._id ? {
752
753
  ...d,
753
754
  _rev: t._rev
754
755
  } : t);
755
756
  }
756
757
  function M() {
757
- u.closeDraftDialog(), P();
758
+ u.closeDraftDialog(), V();
758
759
  }
759
760
  function G(d, t) {
760
- switch (t = qt(t), d) {
761
- case Be.Details:
761
+ switch (t = Qt(t), d) {
762
+ case Te.Details:
762
763
  return u.viewDraft(t);
763
- case Be.Export:
764
+ case Te.Export:
764
765
  return u.exportDraft(t);
765
766
  case Z.enum.approveDraft:
766
767
  return u.approveDraft(t, M);
@@ -768,7 +769,7 @@ const Da = At(
768
769
  return u.rejectDraft(t, M);
769
770
  case Z.enum.markAsFailed:
770
771
  return u.markAsFailed(t, M);
771
- case Be.Duplicate:
772
+ case Te.Duplicate:
772
773
  return u.cloneDraft(t, M);
773
774
  }
774
775
  }
@@ -777,9 +778,9 @@ const Da = At(
777
778
  {
778
779
  id: "_id",
779
780
  accessorKey: "_id",
780
- header: () => o("inventory.closing.table.createdAt"),
781
+ header: () => s("inventory.closing.table.createdAt"),
781
782
  cell(d) {
782
- return ta(`${d.getValue()}`);
783
+ return oa(`${d.getValue()}`);
783
784
  },
784
785
  enableSorting: !0
785
786
  },
@@ -789,14 +790,14 @@ const Da = At(
789
790
  cell(d) {
790
791
  const t = d.row.original;
791
792
  let j = d.getValue();
792
- return j || (j = He(t._id)), xe(j);
793
+ return j || (j = Oe(t._id)), De(j);
793
794
  },
794
795
  enableSorting: !0,
795
796
  size: 200
796
797
  },
797
798
  {
798
799
  id: "updatedAt",
799
- accessorFn: (d) => xe(d.updatedAt),
800
+ accessorFn: (d) => De(d.updatedAt),
800
801
  header: () => "Updated at",
801
802
  enableSorting: !0,
802
803
  size: 200
@@ -814,7 +815,7 @@ const Da = At(
814
815
  var t;
815
816
  return d.items.length + (((t = d.negativeStockItems) == null ? void 0 : t.length) ?? 0);
816
817
  },
817
- header: () => o("inventory.closing.table.noOfItems"),
818
+ header: () => s("inventory.closing.table.noOfItems"),
818
819
  enableSorting: !1,
819
820
  meta: {
820
821
  width: "10rem",
@@ -832,44 +833,44 @@ const Da = At(
832
833
  {
833
834
  id: "status",
834
835
  accessorFn: (d) => d.status,
835
- header: () => o("inventory.closing.table.status"),
836
+ header: () => s("inventory.closing.table.status"),
836
837
  enableSorting: !1,
837
838
  cell(d) {
838
839
  var m;
839
- const t = d.row.original, j = t.status, D = new Date(t.updatedAt), Q = (m = t == null ? void 0 : t.rejectionHistory) == null ? void 0 : m.computeFirst(($) => $.rejectedAt), g = Q ? new Date(Q) : null;
840
- return j === "DRAFT" && g ? g.getTime() > D.getTime() ? C(
840
+ const t = d.row.original, j = t.status, D = new Date(t.updatedAt), Q = (m = t == null ? void 0 : t.rejectionHistory) == null ? void 0 : m.computeFirst((F) => F.rejectedAt), y = Q ? new Date(Q) : null;
841
+ return j === "DRAFT" && y ? y.getTime() > D.getTime() ? S(
841
842
  "div",
842
843
  {
843
844
  class: "flex"
844
845
  },
845
- C(
846
+ S(
846
847
  "div",
847
848
  {
848
- class: ["fm-status-badge", Oe("FAILED")]
849
+ class: ["fm-status-badge", Ke("FAILED")]
849
850
  },
850
851
  "Rejected"
851
852
  )
852
- ) : C(
853
+ ) : S(
853
854
  "div",
854
855
  {
855
856
  class: "flex"
856
857
  },
857
- C(
858
+ S(
858
859
  "div",
859
860
  {
860
- class: ["fm-status-badge", Oe("PROCESSING")]
861
+ class: ["fm-status-badge", Ke("PROCESSING")]
861
862
  },
862
863
  "Updated"
863
864
  )
864
- ) : C(
865
+ ) : S(
865
866
  "div",
866
867
  {
867
868
  class: "flex"
868
869
  },
869
- C(
870
+ S(
870
871
  "div",
871
872
  {
872
- class: ["fm-status-badge", Oe(j)]
873
+ class: ["fm-status-badge", Ke(j)]
873
874
  },
874
875
  Ue(j)
875
876
  )
@@ -881,8 +882,8 @@ const Da = At(
881
882
  cell(d) {
882
883
  var m;
883
884
  const t = d.row.original, j = ((m = e.sessionUser.value) == null ? void 0 : m.role.isAdmin) ?? !1, D = [
884
- bt[Be.Details],
885
- bt[Be.Export]
885
+ ht[Te.Details],
886
+ ht[Te.Export]
886
887
  ], Q = [
887
888
  {
888
889
  translationKey: "inventory.closing.draft.approveDraft",
@@ -899,20 +900,20 @@ const Da = At(
899
900
  color: "text-fm-color-typo-error",
900
901
  value: Z.enum.markAsFailed
901
902
  }
902
- ], g = j && t.status !== _e.enum.DRAFT ? [
903
+ ], y = j && t.status !== _e.enum.DRAFT ? [
903
904
  {
904
905
  translationKey: "inventory.closing.draft.cloneDraft",
905
906
  color: "text-fm-color-typo-primary",
906
- value: Be.Duplicate
907
+ value: Te.Duplicate
907
908
  }
908
909
  ] : [];
909
- return ea(
910
+ return na(
910
911
  [
911
912
  ...D,
912
913
  ...t.status === _e.enum.DRAFT ? Q : []
913
914
  ],
914
- ($) => G($, t),
915
- g
915
+ (F) => G(F, t),
916
+ y
916
917
  );
917
918
  },
918
919
  enableSorting: !1,
@@ -923,26 +924,26 @@ const Da = At(
923
924
  }
924
925
  }
925
926
  ],
926
- drafts: _,
927
- loading: b,
928
- fetchDrafts: P,
927
+ drafts: k,
928
+ loading: h,
929
+ fetchDrafts: V,
929
930
  loadDraft: I,
930
931
  updateDraftRef: x
931
932
  };
932
933
  }
933
- ), Aa = { class: "fm-typo-en-heading-lg-600" }, wa = { class: "py-4" }, Sa = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary mb-4" }, Fa = { key: 0 }, Ca = { class: "mt-4 flex gap-4" }, $a = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary mb-4" }, Ba = { key: 0 }, Ta = {
934
+ ), Ca = { class: "fm-typo-en-heading-lg-600" }, $a = { class: "py-4" }, Fa = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary mb-4" }, Ba = { key: 0 }, Ta = { class: "mt-4 flex gap-4" }, ja = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary mb-4" }, Ia = { key: 0 }, Pa = {
934
935
  key: 0,
935
936
  class: "mb-4"
936
- }, ja = { class: "flex flex-col gap-1 max-h-200 overflow-auto w-full" }, Ia = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ua = {
937
+ }, Ua = { class: "flex flex-col gap-1 max-h-200 overflow-auto w-full" }, Ra = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Va = {
937
938
  key: 0,
938
939
  class: "text-fm-color-system-success-300 mr-1"
939
- }, Ra = {
940
+ }, Ma = {
940
941
  key: 1,
941
942
  class: "text-fm-color-system-error-300 mr-1"
942
- }, Va = { class: "fm-typo-en-body-md-400" }, Pa = { class: "mt-4 flex gap-4" }, Ma = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary mb-4" }, La = {
943
+ }, Na = { class: "fm-typo-en-body-md-400" }, La = { class: "mt-4 flex gap-4" }, Ea = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary mb-4" }, za = {
943
944
  key: 0,
944
945
  class: "flex gap-4"
945
- }, Na = /* @__PURE__ */ Ve({
946
+ }, Ha = /* @__PURE__ */ Ve({
946
947
  __name: "ClosingDraftApprovalDialog",
947
948
  props: {
948
949
  show: { type: Boolean },
@@ -951,207 +952,207 @@ const Da = At(
951
952
  draft: {}
952
953
  },
953
954
  emits: ["update:show", "refresh", "approve"],
954
- setup(c, { emit: o }) {
955
- const { FmStepper: e, FmStep: u, FmDialog: _, FmButton: b } = he, { t: r } = oa(), N = Dt(), P = c, I = o, x = R(
955
+ setup(c, { emit: s }) {
956
+ const { FmStepper: e, FmStep: u, FmDialog: k, FmButton: h } = ke, { t: r } = la(), L = wt(), V = c, I = s, x = U(
956
957
  () => {
957
- var F, w;
958
- return ((F = P.draft) == null ? void 0 : F.stockSnapshot) && ((w = P.draft) == null ? void 0 : w.stockSnapshot) !== void 0;
958
+ var $, w;
959
+ return (($ = V.draft) == null ? void 0 : $.stockSnapshot) && ((w = V.draft) == null ? void 0 : w.stockSnapshot) !== void 0;
959
960
  }
960
- ), M = R(() => {
961
- var y, U, J;
962
- const F = ((y = P.draft) == null ? void 0 : y.items.map((ee) => ({
961
+ ), M = U(() => {
962
+ var g, P, J;
963
+ const $ = ((g = V.draft) == null ? void 0 : g.items.map((ee) => ({
963
964
  id: ee.sku._id,
964
965
  code: ee.sku.code,
965
966
  name: ee.sku.name
966
- }))) ?? [], w = ((J = (U = P.draft) == null ? void 0 : U.negativeStockItems) == null ? void 0 : J.map((ee) => ({
967
+ }))) ?? [], w = ((J = (P = V.draft) == null ? void 0 : P.negativeStockItems) == null ? void 0 : J.map((ee) => ({
967
968
  id: ee.sku._id,
968
969
  code: ee.sku.code,
969
970
  name: ee.sku.name
970
971
  }))) ?? [];
971
- return [...F, ...w].reduce(
972
+ return [...$, ...w].reduce(
972
973
  (ee, X) => (ee[X.id] = X, ee),
973
974
  {}
974
975
  );
975
- }), G = R(
976
+ }), G = U(
976
977
  () => {
977
- var F, w, y;
978
- return (((y = (w = (F = P.draft) == null ? void 0 : F.stockSnapshot) == null ? void 0 : w.filter((U) => U.balance.amount < 0)) == null ? void 0 : y.map((U) => {
979
- const J = N.skuById[U.id];
978
+ var $, w, g;
979
+ return (((g = (w = ($ = V.draft) == null ? void 0 : $.stockSnapshot) == null ? void 0 : w.filter((P) => P.balance.amount < 0)) == null ? void 0 : g.map((P) => {
980
+ const J = L.skuById[P.id];
980
981
  return J ? {
981
982
  id: J._id,
982
983
  code: J.code,
983
984
  name: J.name
984
985
  } : null;
985
- })) ?? []).filter((U) => U !== null);
986
+ })) ?? []).filter((P) => P !== null);
986
987
  }
987
- ), K = R(() => {
988
- var F;
989
- return x.value ? ((F = G.value) == null ? void 0 : F.filter((w) => !M.value[w.id]).map((w) => w.id)) ?? [] : [];
990
- }), d = R({
991
- get: () => P.show,
992
- set: (F) => I("update:show", F)
988
+ ), K = U(() => {
989
+ var $;
990
+ return x.value ? (($ = G.value) == null ? void 0 : $.filter((w) => !M.value[w.id]).map((w) => w.id)) ?? [] : [];
991
+ }), d = U({
992
+ get: () => V.show,
993
+ set: ($) => I("update:show", $)
993
994
  }), t = Y(1), j = () => t.value > 1, D = () => t.value > 2, Q = () => !1;
994
- function g(F) {
995
- return F === 1 ? x.value : F === 2 ? K.value.length == 0 : !1;
995
+ function y($) {
996
+ return $ === 1 ? x.value : $ === 2 ? K.value.length == 0 : !1;
996
997
  }
997
- const m = R(() => !x.value || K.value.length > 0);
998
- function $(F) {
999
- let w = F + 1;
1000
- for (; w <= 3 && g(w); ) w++;
998
+ const m = U(() => !x.value || K.value.length > 0);
999
+ function F($) {
1000
+ let w = $ + 1;
1001
+ for (; w <= 3 && y(w); ) w++;
1001
1002
  return w > 3 ? 3 : w;
1002
1003
  }
1003
- function z(F) {
1004
- let w = F - 1;
1005
- for (; w >= 1 && g(w); ) w--;
1004
+ function z($) {
1005
+ let w = $ - 1;
1006
+ for (; w >= 1 && y(w); ) w--;
1006
1007
  return w < 1 ? 1 : w;
1007
1008
  }
1008
- function te() {
1009
+ function ae() {
1009
1010
  return x.value ? m.value ? 3 : 2 : 1;
1010
1011
  }
1011
- ze(
1012
- () => P.show,
1013
- (F) => {
1014
- F && (t.value = te());
1012
+ He(
1013
+ () => V.show,
1014
+ ($) => {
1015
+ $ && (t.value = ae());
1015
1016
  }
1016
- ), ze(
1017
+ ), He(
1017
1018
  () => x.value,
1018
- (F) => {
1019
- F && t.value === 1 && (t.value = $(1));
1019
+ ($) => {
1020
+ $ && t.value === 1 && (t.value = F(1));
1020
1021
  }
1021
- ), ze(
1022
+ ), He(
1022
1023
  () => K.value.length,
1023
- (F) => {
1024
- F === 0 && t.value === 2 && (t.value = $(2));
1024
+ ($) => {
1025
+ $ === 0 && t.value === 2 && (t.value = F(2));
1025
1026
  }
1026
1027
  );
1027
- function ue() {
1028
+ function de() {
1028
1029
  I("refresh");
1029
1030
  }
1030
- function ae() {
1031
- t.value < 3 && (t.value = $(t.value));
1031
+ function ne() {
1032
+ t.value < 3 && (t.value = F(t.value));
1032
1033
  }
1033
- function re() {
1034
+ function le() {
1034
1035
  t.value > 1 && (t.value = z(t.value));
1035
1036
  }
1036
- function de() {
1037
+ function me() {
1037
1038
  I("approve");
1038
1039
  }
1039
- return (F, w) => {
1040
- const y = O("FmIcon");
1041
- return A(), fe(v(_), {
1040
+ return ($, w) => {
1041
+ const g = O("FmIcon");
1042
+ return A(), pe(v(k), {
1042
1043
  modelValue: d.value,
1043
- "onUpdate:modelValue": w[1] || (w[1] = (U) => d.value = U),
1044
+ "onUpdate:modelValue": w[1] || (w[1] = (P) => d.value = P),
1044
1045
  "max-width": 600
1045
1046
  }, {
1046
1047
  "dialog-header": q(() => [
1047
- n("div", Aa, W(v(r)("inventory.closing.approval.title")), 1)
1048
+ n("div", Ca, W(v(r)("inventory.closing.approval.title")), 1)
1048
1049
  ]),
1049
1050
  default: q(() => [
1050
- n("div", wa, [
1051
- k(v(e), {
1051
+ n("div", $a, [
1052
+ _(v(e), {
1052
1053
  modelValue: t.value,
1053
- "onUpdate:modelValue": w[0] || (w[0] = (U) => t.value = U),
1054
+ "onUpdate:modelValue": w[0] || (w[0] = (P) => t.value = P),
1054
1055
  orientation: "vertical"
1055
1056
  }, {
1056
1057
  default: q(() => [
1057
- k(v(u), {
1058
+ _(v(u), {
1058
1059
  value: 1,
1059
1060
  title: v(r)("inventory.closing.approval.step.generateReport.title"),
1060
1061
  complete: j
1061
1062
  }, {
1062
1063
  default: q(() => [
1063
- n("div", Sa, W(v(r)("inventory.closing.approval.step.generateReport.description")), 1),
1064
- t.value === 1 ? (A(), V("div", Fa, [
1065
- k(v(b), {
1064
+ n("div", Fa, W(v(r)("inventory.closing.approval.step.generateReport.description")), 1),
1065
+ t.value === 1 ? (A(), R("div", Ba, [
1066
+ _(v(h), {
1066
1067
  label: v(r)("inventory.stock.stock_balance.refreshBalance"),
1067
1068
  "prepend-icon": "refresh",
1068
1069
  variant: "secondary",
1069
- loading: F.refreshing,
1070
- onClick: ue
1070
+ loading: $.refreshing,
1071
+ onClick: de
1071
1072
  }, null, 8, ["label", "loading"]),
1072
- n("div", Ca, [
1073
- k(v(b), {
1073
+ n("div", Ta, [
1074
+ _(v(h), {
1074
1075
  label: v(r)("inventory.common.continue"),
1075
1076
  disabled: !x.value,
1076
- onClick: ae
1077
+ onClick: ne
1077
1078
  }, null, 8, ["label", "disabled"])
1078
1079
  ])
1079
- ])) : oe("", !0)
1080
+ ])) : se("", !0)
1080
1081
  ]),
1081
1082
  _: 1
1082
1083
  }, 8, ["title"]),
1083
- k(v(u), {
1084
+ _(v(u), {
1084
1085
  value: 2,
1085
1086
  title: v(r)("inventory.closing.approval.step.negativeItems.title"),
1086
1087
  disabled: () => !x.value,
1087
1088
  complete: D
1088
1089
  }, {
1089
1090
  default: q(() => [
1090
- n("div", $a, W(G.value.length > 0 ? `${v(r)("inventory.closing.approval.step.negativeItems.resolveMessage")} [${v(r)("inventory.closing.approval.step.negativeItems.itemsHeader")} (${K.value.length})]` : v(r)("inventory.closing.approval.step.negativeItems.noItemsMessage")), 1),
1091
- t.value === 2 ? (A(), V("div", Ba, [
1092
- G.value.length > 0 ? (A(), V("div", Ta, [
1091
+ n("div", ja, W(G.value.length > 0 ? `${v(r)("inventory.closing.approval.step.negativeItems.resolveMessage")} [${v(r)("inventory.closing.approval.step.negativeItems.itemsHeader")} (${K.value.length})]` : v(r)("inventory.closing.approval.step.negativeItems.noItemsMessage")), 1),
1092
+ t.value === 2 ? (A(), R("div", Ia, [
1093
+ G.value.length > 0 ? (A(), R("div", Pa, [
1093
1094
  w[2] || (w[2] = n("div", { class: "fm-typo-en-body-md-600 mb-2" }, null, -1)),
1094
- n("div", ja, [
1095
- (A(!0), V(ie, null, Te(G.value, (U) => (A(), V("div", {
1096
- key: U.id,
1095
+ n("div", Ua, [
1096
+ (A(!0), R(ce, null, je(G.value, (P) => (A(), R("div", {
1097
+ key: P.id,
1097
1098
  class: "flex gap-8"
1098
1099
  }, [
1099
- n("div", Ia, [
1100
- M.value[U.id] ? (A(), V("span", Ua, [
1101
- k(y, {
1100
+ n("div", Ra, [
1101
+ M.value[P.id] ? (A(), R("span", Va, [
1102
+ _(g, {
1102
1103
  name: "check_circle",
1103
1104
  size: "sm"
1104
1105
  })
1105
- ])) : (A(), V("span", Ra, [
1106
- k(y, {
1106
+ ])) : (A(), R("span", Ma, [
1107
+ _(g, {
1107
1108
  name: "error",
1108
1109
  size: "sm"
1109
1110
  })
1110
1111
  ])),
1111
- ce(" " + W(U.code), 1)
1112
+ ue(" " + W(P.code), 1)
1112
1113
  ]),
1113
- n("div", Va, W(U.name), 1)
1114
+ n("div", Na, W(P.name), 1)
1114
1115
  ]))), 128))
1115
1116
  ])
1116
- ])) : oe("", !0),
1117
- n("div", Pa, [
1118
- k(v(b), {
1117
+ ])) : se("", !0),
1118
+ n("div", La, [
1119
+ _(v(h), {
1119
1120
  label: v(r)("inventory.common.back"),
1120
1121
  variant: "secondary",
1121
- onClick: re
1122
+ onClick: le
1122
1123
  }, null, 8, ["label"]),
1123
- k(v(b), {
1124
+ _(v(h), {
1124
1125
  label: v(r)("inventory.common.continue"),
1125
1126
  disabled: m.value,
1126
- onClick: ae
1127
+ onClick: ne
1127
1128
  }, null, 8, ["label", "disabled"])
1128
1129
  ])
1129
- ])) : oe("", !0)
1130
+ ])) : se("", !0)
1130
1131
  ]),
1131
1132
  _: 1
1132
1133
  }, 8, ["title", "disabled"]),
1133
- k(v(u), {
1134
+ _(v(u), {
1134
1135
  value: 3,
1135
1136
  title: v(r)("inventory.closing.approval.step.approval.title"),
1136
1137
  disabled: () => m.value,
1137
1138
  complete: Q
1138
1139
  }, {
1139
1140
  default: q(() => [
1140
- n("div", Ma, W(v(r)("inventory.closing.approval.step.approval.warning")), 1),
1141
- t.value === 3 ? (A(), V("div", La, [
1142
- k(v(b), {
1141
+ n("div", Ea, W(v(r)("inventory.closing.approval.step.approval.warning")), 1),
1142
+ t.value === 3 ? (A(), R("div", za, [
1143
+ _(v(h), {
1143
1144
  label: v(r)("inventory.common.back"),
1144
1145
  variant: "secondary",
1145
- onClick: re
1146
+ onClick: le
1146
1147
  }, null, 8, ["label"]),
1147
- k(v(b), {
1148
+ _(v(h), {
1148
1149
  label: v(r)("inventory.common.approve"),
1149
1150
  variant: "destructive",
1150
1151
  disabled: m.value,
1151
- loading: F.approving,
1152
- onClick: de
1152
+ loading: $.approving,
1153
+ onClick: me
1153
1154
  }, null, 8, ["label", "disabled", "loading"])
1154
- ])) : oe("", !0)
1155
+ ])) : se("", !0)
1155
1156
  ]),
1156
1157
  _: 1
1157
1158
  }, 8, ["title", "disabled"])
@@ -1164,89 +1165,89 @@ const Da = At(
1164
1165
  }, 8, ["modelValue"]);
1165
1166
  };
1166
1167
  }
1167
- }), Ea = { class: "w-full flex flex-col gap-32" }, za = { class: "flex justify-between" }, Ha = { class: "flex" }, Oa = { class: "grid grid-cols-[repeat(4,1fr)] xs:flex xs:flex-col sm:flex sm:flex-col gap-8" }, Ka = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ya = { class: "flex gap-1" }, qa = { class: "fm-typo-en-body-lg-600" }, Ga = { class: "flex flex-col gap-16" }, Qa = { class: "flex items-center" }, Wa = {
1168
+ }), Oa = { class: "w-full flex flex-col gap-32" }, Ka = { class: "flex justify-between" }, Ya = { class: "flex" }, qa = { class: "grid grid-cols-[repeat(4,1fr)] xs:flex xs:flex-col sm:flex sm:flex-col gap-8" }, Ga = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Qa = { class: "flex gap-1" }, Wa = { class: "fm-typo-en-body-lg-600" }, Za = { class: "flex flex-col gap-16" }, Ja = { class: "flex items-center" }, Xa = {
1168
1169
  key: 0,
1169
1170
  class: "flex gap-8"
1170
- }, Za = {
1171
+ }, en = {
1171
1172
  key: 0,
1172
1173
  class: "w-full flex flex-col items-center"
1173
- }, Ja = { class: "flex items-center gap-8" }, Xa = { class: "flex flex-col gap-8" }, en = { class: "flex gap-8" }, tn = {
1174
+ }, tn = { class: "flex items-center gap-8" }, an = { class: "flex flex-col gap-8" }, nn = { class: "flex gap-8" }, on = {
1174
1175
  key: 0,
1175
1176
  class: "flex gap-8"
1176
- }, an = { class: "overflow-x-auto" }, nn = {
1177
+ }, sn = { class: "overflow-x-auto" }, rn = {
1177
1178
  key: 1,
1178
1179
  class: "flex-1 xs:w-screen xs:max-w-full"
1179
- }, on = {
1180
+ }, ln = {
1180
1181
  key: 0,
1181
1182
  class: "flex flex-col items-center gap-8 h-full"
1182
- }, sn = ["src"], rn = {
1183
+ }, cn = ["src"], un = {
1183
1184
  key: 1,
1184
1185
  class: "px-4 flex flex-col"
1185
- }, ln = { class: "flex gap-12 content-stretch" }, cn = {
1186
+ }, dn = { class: "flex gap-12 content-stretch" }, mn = {
1186
1187
  class: "flex flex-col w-24",
1187
1188
  name: "circles"
1188
- }, un = { class: "flex-1 flex flex-col items-center" }, dn = { class: "flex-1 flex flex-col items-center" }, mn = {
1189
+ }, fn = { class: "flex-1 flex flex-col items-center" }, pn = { class: "flex-1 flex flex-col items-center" }, vn = {
1189
1190
  class: "py-12 flex flex-col gap-4",
1190
1191
  name: "received-at header"
1191
- }, fn = { class: "fm-typo-en-body-lg-400" }, pn = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, vn = { class: "flex gap-12 content-stretch" }, gn = {
1192
+ }, yn = { class: "fm-typo-en-body-lg-400" }, gn = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, bn = { class: "flex gap-12 content-stretch" }, hn = {
1192
1193
  class: "flex flex-col w-24",
1193
1194
  name: "circles"
1194
- }, yn = { class: "flex-1 flex flex-col items-center" }, bn = {
1195
+ }, kn = { class: "flex-1 flex flex-col items-center" }, _n = {
1195
1196
  class: "py-12 flex flex-col gap-4 flex-1",
1196
1197
  name: "delivery details"
1197
- }, hn = { class: "flex flex-col gap-8" }, _n = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, kn = { class: "flex flex-col gap-4" }, xn = { class: "flex items-center justify-between gap-8 w-full" }, Dn = { class: "flex items-center gap-8" }, An = { class: "flex flex-col items-end" }, wn = { class: "text-2xl font-semibold" }, Sn = "N/A", Fn = /* @__PURE__ */ Ve({
1198
+ }, xn = { class: "flex flex-col gap-8" }, Dn = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, An = { class: "flex flex-col gap-4" }, wn = { class: "flex items-center justify-between gap-8 w-full" }, Sn = { class: "flex items-center gap-8" }, Cn = { class: "flex flex-col items-end" }, $n = { class: "text-2xl font-semibold" }, kt = "N/A", Fn = /* @__PURE__ */ Ve({
1198
1199
  __name: "ClosingDraftDialog",
1199
1200
  props: {
1200
1201
  show: { type: Boolean },
1201
1202
  draft: {}
1202
1203
  },
1203
1204
  emits: ["submitted", "refresh"],
1204
- setup(c, { emit: o }) {
1205
- et();
1206
- const e = c, u = R(() => {
1207
- const i = xt();
1208
- return i === "MYR" ? "RM" : i;
1205
+ setup(c, { emit: s }) {
1206
+ tt();
1207
+ const e = c, u = U(() => {
1208
+ const l = At();
1209
+ return l === "MYR" ? "RM" : l;
1209
1210
  });
1210
- Bt();
1211
- const _ = qe(), b = Ot(e, "show"), r = Y(!1), N = Y(!1), P = Y(!1), I = Y(new Array()), x = Y(new Array()), M = Y([]), G = nt(), K = Qe(), d = tt(), t = Dt(), j = Ge(), D = Mt({}), Q = R(() => new Set(
1212
- t.skus.filter((i) => {
1211
+ jt();
1212
+ const k = qe(), h = Yt(e, "show"), r = Y(!1), L = Y(!1), V = Y(!1), I = Y(new Array()), x = Y(new Array()), M = Y([]), G = ot(), K = Qe(), d = at(), t = wt(), j = Ge(), D = Lt({}), Q = U(() => new Set(
1213
+ t.skus.filter((l) => {
1213
1214
  var a;
1214
- return D[(a = i.customAttributes) == null ? void 0 : a.tag];
1215
- }).map((i) => i._id)
1216
- )), g = o, m = Y({
1215
+ return D[(a = l.customAttributes) == null ? void 0 : a.tag];
1216
+ }).map((l) => l._id)
1217
+ )), y = s, m = Y({
1217
1218
  templateItem: !0,
1218
1219
  nonTemplateItem: !0
1219
- }), $ = R(() => {
1220
+ }), F = U(() => {
1220
1221
  var a, p;
1221
- const i = [...((a = e.draft) == null ? void 0 : a.items) ?? [], ...((p = e.draft) == null ? void 0 : p.negativeStockItems) ?? []];
1222
- return Q.value.size ? i.filter((s) => Q.value.has(s.sku._id)) : i;
1223
- }), z = R(() => {
1224
- const i = $.value.map((a) => a.sku);
1225
- return i.sort((a, p) => a.code.localeCompare(p.code)), i;
1226
- }), te = R(() => $.value.groupBy(
1222
+ const l = [...((a = e.draft) == null ? void 0 : a.items) ?? [], ...((p = e.draft) == null ? void 0 : p.negativeStockItems) ?? []];
1223
+ return Q.value.size ? l.filter((o) => Q.value.has(o.sku._id)) : l;
1224
+ }), z = U(() => {
1225
+ const l = F.value.map((a) => a.sku);
1226
+ return l.sort((a, p) => a.code.localeCompare(p.code)), l;
1227
+ }), ae = U(() => F.value.groupBy(
1227
1228
  (a) => a.sku._id,
1228
1229
  (a) => a.measurementsAmounts.filter((p) => !p.measurement.abbrev.toLocaleLowerCase().includes("inactive")).map((p) => p.measurement.id)
1229
1230
  ));
1230
- Xe(de), ze(
1231
+ et(me), He(
1231
1232
  () => e.show,
1232
- (i) => {
1233
- i && (Ae.value = Fe[0], de(), m.value = {
1233
+ (l) => {
1234
+ l && (we.value = $e[0], me(), m.value = {
1234
1235
  templateItem: !0,
1235
1236
  nonTemplateItem: !0
1236
1237
  });
1237
1238
  }
1238
1239
  );
1239
- const ue = R(() => Ie.value.reduce((i, a) => i + Number(a.stockTakeValue), 0)), ae = Re(0), re = Re(100);
1240
- async function de() {
1241
- var a, p, s, l;
1240
+ const de = U(() => Pe.value.reduce((l, a) => l + Number(a.stockTakeValue), 0)), ne = Re(0), le = Re(100);
1241
+ async function me() {
1242
+ var a, p, o, i;
1242
1243
  if (!j._currentLocation) return;
1243
1244
  r.value = !0;
1244
- const i = ((a = e.draft) == null ? void 0 : a.status) === _e.enum.COMPLETED;
1245
+ const l = ((a = e.draft) == null ? void 0 : a.status) === _e.enum.COMPLETED;
1245
1246
  x.value = [];
1246
1247
  try {
1247
- if (await t.init(), i) {
1248
- const L = e.draft.closingAdjustmentId;
1249
- if (!L) {
1248
+ if (await t.init(), l) {
1249
+ const N = e.draft.closingAdjustmentId;
1250
+ if (!N) {
1250
1251
  d.open({
1251
1252
  title: "Something went wrong",
1252
1253
  message: "Closing draft is completed but closing document cannot be found.",
@@ -1256,31 +1257,31 @@ const Da = At(
1256
1257
  });
1257
1258
  return;
1258
1259
  }
1259
- const E = await G.readAdjustmentById(L), me = (E == null ? void 0 : E.skus) ?? [];
1260
- for (const pe of me) {
1261
- const we = {
1262
- id: pe.sku._id,
1263
- balance: pe.fromBalance,
1264
- costs: pe.fromCostBalances
1260
+ const E = await G.readAdjustmentById(N), fe = (E == null ? void 0 : E.skus) ?? [];
1261
+ for (const ve of fe) {
1262
+ const Se = {
1263
+ id: ve.sku._id,
1264
+ balance: ve.fromBalance,
1265
+ costs: ve.fromCostBalances
1265
1266
  }, T = {
1266
- id: pe.sku._id,
1267
- balance: pe.toBalance,
1268
- costs: pe.toCostBalances
1267
+ id: ve.sku._id,
1268
+ balance: ve.toBalance,
1269
+ costs: ve.toCostBalances
1269
1270
  };
1270
- I.value.push(we), x.value.push(T);
1271
+ I.value.push(Se), x.value.push(T);
1271
1272
  }
1272
1273
  } else
1273
- I.value = ((s = e.draft) == null ? void 0 : s.stockSnapshot) ?? [];
1274
+ I.value = ((o = e.draft) == null ? void 0 : o.stockSnapshot) ?? [];
1274
1275
  const f = /* @__PURE__ */ new Set();
1275
- if ((l = e.draft) != null && l.adjustmentSnapshot)
1276
- for (const L of e.draft.adjustmentSnapshot)
1277
- L.adjustmentsByType && Object.keys(L.adjustmentsByType).forEach((E) => f.add(E));
1278
- const h = ["receive", "sales", "wastage"], B = [];
1279
- h.forEach((L) => {
1280
- f.has(L) && (B.push(L), f.delete(L));
1276
+ if ((i = e.draft) != null && i.adjustmentSnapshot)
1277
+ for (const N of e.draft.adjustmentSnapshot)
1278
+ N.adjustmentsByType && Object.keys(N.adjustmentsByType).forEach((E) => f.add(E));
1279
+ const b = ["receive", "sales", "wastage"], B = [];
1280
+ b.forEach((N) => {
1281
+ f.has(N) && (B.push(N), f.delete(N));
1281
1282
  });
1282
- const S = Array.from(f).sort();
1283
- M.value = [...B, ...S];
1283
+ const C = Array.from(f).sort();
1284
+ M.value = [...B, ...C];
1284
1285
  } catch (f) {
1285
1286
  d.open({
1286
1287
  title: "Something went wrong",
@@ -1291,9 +1292,9 @@ const Da = At(
1291
1292
  r.value = !1;
1292
1293
  }
1293
1294
  }
1294
- async function F() {
1295
+ async function $() {
1295
1296
  var a, p;
1296
- if (!(((a = e.draft) == null ? void 0 : a.effectiveAt) ?? (e.draft ? He((p = e.draft) == null ? void 0 : p._id) : null))) {
1297
+ if (!(((a = e.draft) == null ? void 0 : a.effectiveAt) ?? (e.draft ? Oe((p = e.draft) == null ? void 0 : p._id) : null))) {
1297
1298
  d.open({
1298
1299
  title: "Cannot refresh",
1299
1300
  message: "Effective date is not available for this draft.",
@@ -1301,20 +1302,20 @@ const Da = At(
1301
1302
  });
1302
1303
  return;
1303
1304
  }
1304
- await _.refreshBalance(
1305
+ await k.refreshBalance(
1305
1306
  e.draft,
1306
1307
  () => {
1307
1308
  },
1308
- async (s) => {
1309
+ async (o) => {
1309
1310
  var B;
1310
- N.value = !0;
1311
- const l = (B = e.draft) == null ? void 0 : B._rev, f = 30, h = 2e3;
1311
+ L.value = !0;
1312
+ const i = (B = e.draft) == null ? void 0 : B._rev, f = 30, b = 2e3;
1312
1313
  try {
1313
- await G.recalculation.scheduleCalculateStockSnapshotAtDate(s, e.draft._id);
1314
- let S = null;
1315
- for (let L = 0; L < f && (S = await K.getDraft(e.draft._id).delayed(h), S._rev === l); L++)
1314
+ await G.recalculation.scheduleCalculateStockSnapshotAtDate(o, e.draft._id);
1315
+ let C = null;
1316
+ for (let N = 0; N < f && (C = await K.getDraft(e.draft._id).delayed(b), C._rev === i); N++)
1316
1317
  ;
1317
- if (!S || S._rev === l) {
1318
+ if (!C || C._rev === i) {
1318
1319
  d.open({
1319
1320
  title: "Refresh failed",
1320
1321
  message: "Failed to refresh stock balance. Please try again.",
@@ -1322,26 +1323,26 @@ const Da = At(
1322
1323
  }), console.error("error refreshing stock balances: there is no change in _rev");
1323
1324
  return;
1324
1325
  }
1325
- g("refresh", S), I.value = S.stockSnapshot ?? [], d.open({
1326
+ y("refresh", C), I.value = C.stockSnapshot ?? [], d.open({
1326
1327
  title: "Balance refreshed",
1327
1328
  message: "Stock balance has been recalculated.",
1328
1329
  type: "success"
1329
- }), b.value = !1;
1330
- } catch (S) {
1330
+ }), h.value = !1;
1331
+ } catch (C) {
1331
1332
  d.open({
1332
1333
  title: "Refresh failed",
1333
1334
  message: "Failed to refresh stock balance. Please try again.",
1334
1335
  type: "error"
1335
- }), console.error("error refreshing stock balances", S);
1336
+ }), console.error("error refreshing stock balances", C);
1336
1337
  } finally {
1337
- N.value = !1;
1338
+ L.value = !1;
1338
1339
  }
1339
1340
  }
1340
1341
  );
1341
1342
  }
1342
1343
  async function w() {
1343
1344
  var a, p;
1344
- if (!(((a = e.draft) == null ? void 0 : a.effectiveAt) ?? (e.draft ? He((p = e.draft) == null ? void 0 : p._id) : null))) {
1345
+ if (!(((a = e.draft) == null ? void 0 : a.effectiveAt) ?? (e.draft ? Oe((p = e.draft) == null ? void 0 : p._id) : null))) {
1345
1346
  d.open({
1346
1347
  title: "Cannot refresh",
1347
1348
  message: "Effective date is not available for this draft.",
@@ -1349,38 +1350,38 @@ const Da = At(
1349
1350
  });
1350
1351
  return;
1351
1352
  }
1352
- await _.invalidateDraftCache(e.draft);
1353
+ await k.invalidateDraftCache(e.draft);
1353
1354
  }
1354
- const y = R(
1355
+ const g = U(
1355
1356
  () => I.value.groupBy(
1356
- (i) => i.id,
1357
- (i) => i.balance
1357
+ (l) => l.id,
1358
+ (l) => l.balance
1358
1359
  )
1359
- ), U = R(() => $.value.groupBy((i) => i.sku._id)), J = R(() => {
1360
- var i;
1361
- return (i = e.draft) != null && i.adjustmentSnapshot ? new Map(e.draft.adjustmentSnapshot.map((a) => [a.skuId, a.adjustmentsByType])) : /* @__PURE__ */ new Map();
1362
- }), ee = R(() => {
1363
- var i;
1364
- return (i = e.draft) != null && i.opening ? new Map(e.draft.opening.map((a) => [a.skuId, a.balance])) : /* @__PURE__ */ new Map();
1360
+ ), P = U(() => F.value.groupBy((l) => l.sku._id)), J = U(() => {
1361
+ var l;
1362
+ return (l = e.draft) != null && l.adjustmentSnapshot ? new Map(e.draft.adjustmentSnapshot.map((a) => [a.skuId, a.adjustmentsByType])) : /* @__PURE__ */ new Map();
1363
+ }), ee = U(() => {
1364
+ var l;
1365
+ return (l = e.draft) != null && l.opening ? new Map(e.draft.opening.map((a) => [a.skuId, a.balance])) : /* @__PURE__ */ new Map();
1365
1366
  });
1366
- function X(i, a) {
1367
- return C(
1368
- he.FmTooltip,
1367
+ function X(l, a) {
1368
+ return S(
1369
+ ke.FmTooltip,
1369
1370
  { zIndex: 51, placement: "left", class: "w-full flex justify-end" },
1370
1371
  {
1371
1372
  default() {
1372
- return i;
1373
+ return l;
1373
1374
  },
1374
1375
  content() {
1375
- return a || i;
1376
+ return a || l;
1376
1377
  }
1377
1378
  }
1378
1379
  );
1379
1380
  }
1380
- const ke = R(() => {
1381
- const i = z.value.reduce((p, s) => {
1382
- var l, f;
1383
- return Math.max(p, ((f = (l = te.value) == null ? void 0 : l.get(s._id)) == null ? void 0 : f[0].length) ?? 0);
1381
+ const xe = U(() => {
1382
+ const l = z.value.reduce((p, o) => {
1383
+ var i, f;
1384
+ return Math.max(p, ((f = (i = ae.value) == null ? void 0 : i.get(o._id)) == null ? void 0 : f[0].length) ?? 0);
1384
1385
  }, 0);
1385
1386
  return [
1386
1387
  {
@@ -1389,8 +1390,8 @@ const Da = At(
1389
1390
  header: () => "Name",
1390
1391
  size: 350,
1391
1392
  cell(p) {
1392
- const s = p.row.original, l = s.adjustedDiffPercentage, f = typeof l == "number" && Math.abs(l) > 10, h = C("div", { class: "flex flex-col gap-4" }, [
1393
- C(
1393
+ const o = p.row.original, i = o.adjustedDiffPercentage, f = typeof i == "number" && Math.abs(i) > 10, b = S("div", { class: "flex flex-col gap-4" }, [
1394
+ S(
1394
1395
  "div",
1395
1396
  {
1396
1397
  class: [
@@ -1398,9 +1399,9 @@ const Da = At(
1398
1399
  f ? " text-fm-color-system-error-300" : "text-fm-color-typo-primary"
1399
1400
  ]
1400
1401
  },
1401
- s.name
1402
+ o.name
1402
1403
  ),
1403
- C(
1404
+ S(
1404
1405
  "div",
1405
1406
  {
1406
1407
  class: [
@@ -1408,21 +1409,21 @@ const Da = At(
1408
1409
  f ? " text-fm-color-system-error-300" : "text-fm-color-typo-secondary"
1409
1410
  ]
1410
1411
  },
1411
- s.code
1412
+ o.code
1412
1413
  )
1413
1414
  ]);
1414
- return C(
1415
- he.FmTooltip,
1415
+ return S(
1416
+ ke.FmTooltip,
1416
1417
  {
1417
1418
  zIndex: 51
1418
1419
  },
1419
1420
  {
1420
1421
  content() {
1421
- return f ? "Adjustment difference is more than 10%." : `${s.code} - ${s.name}`;
1422
+ return f ? "Adjustment difference is more than 10%." : `${o.code} - ${o.name}`;
1422
1423
  },
1423
1424
  default() {
1424
- return C("div", { class: "flex items-center gap-4 justify-start w-full" }, [
1425
- h
1425
+ return S("div", { class: "flex items-center gap-4 justify-start w-full" }, [
1426
+ b
1426
1427
  ]);
1427
1428
  }
1428
1429
  }
@@ -1435,8 +1436,8 @@ const Da = At(
1435
1436
  header: () => X("Cost per unit"),
1436
1437
  size: 160,
1437
1438
  cell(p) {
1438
- const s = p.row.original.costPerUnit;
1439
- return C("div", { class: "text-right" }, s.toFixed(2));
1439
+ const o = p.row.original.costPerUnit;
1440
+ return S("div", { class: "text-right fm-typo-en-body-lg-400" }, te(o));
1440
1441
  },
1441
1442
  meta: {
1442
1443
  textAlign: "right"
@@ -1448,27 +1449,27 @@ const Da = At(
1448
1449
  size: 120,
1449
1450
  cell(p) {
1450
1451
  var B;
1451
- const s = p.row.original, l = s.costUnit, f = s.baseUnit, h = l ?? f;
1452
- if (l && l !== f) {
1453
- const S = z.value.find((E) => E._id === s.id), L = (B = S == null ? void 0 : S.defaultCost) == null ? void 0 : B.measurement;
1454
- if (L) {
1455
- const E = L.conversion.amount / Math.pow(10, L.conversion.precision);
1456
- return C("div", { class: "flex flex-col" }, [
1457
- C(
1452
+ const o = p.row.original, i = o.costUnit, f = o.baseUnit, b = i ?? f;
1453
+ if (i && i !== f) {
1454
+ const C = z.value.find((E) => E._id === o.id), N = (B = C == null ? void 0 : C.defaultCost) == null ? void 0 : B.measurement;
1455
+ if (N) {
1456
+ const E = N.conversion.amount / Math.pow(10, N.conversion.precision);
1457
+ return S("div", { class: "flex flex-col" }, [
1458
+ S(
1458
1459
  "span",
1459
1460
  { class: "fm-typo-en-body-lg-400 text-fm-color-typo-primary" },
1460
- h
1461
+ b
1461
1462
  ),
1462
- C("span", { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, [
1463
+ S("span", { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, [
1463
1464
  "1 ",
1464
- C("span", { class: "fm-typo-en-body-sm-600" }, l),
1465
+ S("span", { class: "fm-typo-en-body-sm-600" }, i),
1465
1466
  ` = ${E} `,
1466
- C("span", { class: "fm-typo-en-body-sm-600" }, f)
1467
+ S("span", { class: "fm-typo-en-body-sm-600" }, f)
1467
1468
  ])
1468
1469
  ]);
1469
1470
  }
1470
1471
  }
1471
- return h;
1472
+ return b;
1472
1473
  }
1473
1474
  },
1474
1475
  {
@@ -1477,8 +1478,8 @@ const Da = At(
1477
1478
  header: () => X("Opening (B/F)", "The opening balance brought forward from previous period."),
1478
1479
  size: 150,
1479
1480
  cell(p) {
1480
- const s = p.row.original.opening;
1481
- return C("div", { class: "text-right" }, s.toFixed(2));
1481
+ const o = p.row.original.opening;
1482
+ return S("div", { class: "text-right fm-typo-en-body-lg-400" }, te(o));
1482
1483
  },
1483
1484
  meta: {
1484
1485
  textAlign: "right"
@@ -1488,12 +1489,12 @@ const Da = At(
1488
1489
  ...M.value.map(
1489
1490
  (p) => ({
1490
1491
  id: `adjustment_${p}`,
1491
- accessorFn: (s) => s.adjustmentAmounts[p] ?? { amount: 0, precision: 0 },
1492
+ accessorFn: (o) => o.adjustmentAmounts[p] ?? { amount: 0, precision: 0 },
1492
1493
  header: () => X(Ue(p)),
1493
1494
  size: 150,
1494
- cell(s) {
1495
- const l = s.row.original.adjustmentAmounts[p] ?? { amount: 0, precision: 0 };
1496
- return C("div", { class: "text-right" }, Ye(l));
1495
+ cell(o) {
1496
+ const i = o.row.original.adjustmentAmounts[p] ?? { amount: 0, precision: 0 };
1497
+ return S("div", { class: "text-right fm-typo-en-body-lg-400" }, te(i));
1497
1498
  },
1498
1499
  meta: {
1499
1500
  textAlign: "right"
@@ -1505,6 +1506,10 @@ const Da = At(
1505
1506
  accessorKey: "systemBalance",
1506
1507
  header: () => X("System Balance", "The system calculated balance before stock take."),
1507
1508
  size: 200,
1509
+ cell(p) {
1510
+ const o = p.row.original.systemBalance;
1511
+ return S("div", { class: "text-right fm-typo-en-body-lg-400" }, te(o));
1512
+ },
1508
1513
  meta: {
1509
1514
  textAlign: "right"
1510
1515
  }
@@ -1512,29 +1517,27 @@ const Da = At(
1512
1517
  {
1513
1518
  id: "physicalBalance",
1514
1519
  accessorFn: (p) => {
1515
- var l;
1516
- const s = (l = x.value.find((f) => f.id === p.id)) == null ? void 0 : l.balance;
1517
- return s ? H.toFormatString({ value: s }) : p.physicalBalance;
1520
+ var i;
1521
+ const o = (i = x.value.find((f) => f.id === p.id)) == null ? void 0 : i.balance;
1522
+ return o ? ea.toDouble(o) : p.physicalBalance;
1518
1523
  },
1519
1524
  header: () => X("Stock Take balance", "The physical balance recorded during stock take."),
1520
1525
  cell(p) {
1521
- var S;
1522
- const s = p.row.original, l = H.fromNumber(s.physicalBalance);
1523
- let f = !0, h = s.physicalBalance;
1524
- const B = (S = x.value.find((L) => L.id === s.id)) == null ? void 0 : S.balance;
1525
- return B && (H.equals({
1526
- a: l,
1527
- b: B
1528
- }) || (f = !1, h = Number(H.toFormatString({ value: B })))), C("div", { class: "flex flex-col" }, [
1529
- C(
1526
+ var C;
1527
+ const o = p.row.original, i = H.fromNumber(o.physicalBalance);
1528
+ let f = !0;
1529
+ const b = (C = x.value.find((N) => N.id === o.id)) == null ? void 0 : C.balance;
1530
+ let B;
1531
+ return b && !H.equals({ a: i, b }) ? (f = !1, B = te(b)) : B = te(o.physicalBalance), S("div", { class: "flex flex-col" }, [
1532
+ S(
1530
1533
  "span",
1531
1534
  { class: "line-clamp-1 fm-typo-en-body-lg-400 text-fm-color-typo-primary" },
1532
- h
1535
+ B
1533
1536
  ),
1534
- f ? null : C(
1537
+ f ? null : S(
1535
1538
  "span",
1536
- { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" },
1537
- `Draft: ${s.physicalBalance.toString()}`
1539
+ { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" },
1540
+ `Draft: ${te(o.physicalBalance)}`
1538
1541
  )
1539
1542
  ]);
1540
1543
  },
@@ -1548,6 +1551,10 @@ const Da = At(
1548
1551
  accessorKey: "adjustedAmount",
1549
1552
  header: () => X("Variance", "The difference between Stock Take balance and System Balance."),
1550
1553
  size: 200,
1554
+ cell(p) {
1555
+ const o = p.row.original.adjustedAmount;
1556
+ return S("div", { class: "text-right fm-typo-en-body-lg-400" }, te(o));
1557
+ },
1551
1558
  meta: {
1552
1559
  textAlign: "right"
1553
1560
  }
@@ -1558,12 +1565,8 @@ const Da = At(
1558
1565
  header: () => X(`Variance (${u.value})`),
1559
1566
  size: 150,
1560
1567
  cell(p) {
1561
- const s = p.row.original.varianceInCost;
1562
- return C(
1563
- "div",
1564
- { class: "text-right" },
1565
- s.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 4 })
1566
- );
1568
+ const o = p.row.original.varianceInCost;
1569
+ return S("div", { class: "text-right fm-typo-en-body-lg-400" }, te(o));
1567
1570
  },
1568
1571
  meta: {
1569
1572
  textAlign: "right"
@@ -1578,19 +1581,26 @@ const Da = At(
1578
1581
  ),
1579
1582
  size: 200,
1580
1583
  cell(p) {
1581
- const s = p.row.original.adjustedDiffPercentage;
1582
- if (!s) return Sn;
1583
- const l = s.toFixed(2);
1584
- if (l === "0.00")
1585
- return C("div", { class: "flex items-center gap-4 justify-end" }, ["0.00"]);
1586
- const f = s > 0;
1587
- return C("div", { class: "flex items-center gap-4 justify-end" }, [
1588
- C(he.FmIcon, {
1584
+ const o = p.row.original.adjustedDiffPercentage;
1585
+ if (o == null)
1586
+ return S(
1587
+ "div",
1588
+ { class: "flex items-center gap-4 justify-end fm-typo-en-body-lg-400" },
1589
+ kt
1590
+ );
1591
+ const i = te(o);
1592
+ if (o === 0)
1593
+ return S("div", { class: "flex items-center gap-4 justify-end fm-typo-en-body-lg-400" }, [
1594
+ te(0)
1595
+ ]);
1596
+ const f = o > 0;
1597
+ return S("div", { class: "flex items-center gap-4 justify-end fm-typo-en-body-lg-400" }, [
1598
+ S(ke.FmIcon, {
1589
1599
  name: f ? "arrow_drop_up" : "arrow_drop_down",
1590
1600
  color: f ? "system-success-300" : "system-error-300",
1591
1601
  size: "md"
1592
1602
  }),
1593
- l
1603
+ i
1594
1604
  ]);
1595
1605
  },
1596
1606
  meta: {
@@ -1603,46 +1613,40 @@ const Da = At(
1603
1613
  header: () => X(`Stock take value (${u.value})`),
1604
1614
  size: 180,
1605
1615
  cell(p) {
1606
- var L;
1607
- const s = p.row.original, l = s.stockTakeValue, f = z.value.find((E) => E._id === s.id), h = (L = f == null ? void 0 : f.defaultCost) == null ? void 0 : L.measurement, B = s.physicalBalance, S = s.costPerUnit;
1608
- if (h) {
1609
- const E = H.toFormatString({ value: h.conversion }), me = `${B.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 })} ${s.baseUnit} ÷ ${E} × ${S} ${u.value}`;
1610
- return C(
1611
- he.FmTooltip,
1616
+ var N;
1617
+ const o = p.row.original, i = o.stockTakeValue, f = z.value.find((E) => E._id === o.id), b = (N = f == null ? void 0 : f.defaultCost) == null ? void 0 : N.measurement, B = o.physicalBalance, C = o.costPerUnit;
1618
+ if (b) {
1619
+ const E = H.toFormatString({ value: b.conversion }), fe = `${te(B, { minPrecision: 2, maxPrecision: 4 })} ${o.baseUnit} ÷ ${E} × ${C} ${u.value}`;
1620
+ return S(
1621
+ ke.FmTooltip,
1612
1622
  { zIndex: 51 },
1613
1623
  {
1614
1624
  content() {
1615
- return me;
1625
+ return fe;
1616
1626
  },
1617
1627
  default() {
1618
- return C(
1628
+ return S(
1619
1629
  "div",
1620
- { class: "text-right" },
1621
- l.toLocaleString("en-US", {
1622
- minimumFractionDigits: 2,
1623
- maximumFractionDigits: 4
1624
- })
1630
+ { class: "text-right w-full fm-typo-en-body-lg-400" },
1631
+ te(i)
1625
1632
  );
1626
1633
  }
1627
1634
  }
1628
1635
  );
1629
1636
  } else {
1630
- const E = `${B.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 })} ${s.baseUnit} × ${S} ${u.value}`;
1631
- return C(
1632
- he.FmTooltip,
1637
+ const E = `${te(B, { minPrecision: 2, maxPrecision: 4 })} ${o.baseUnit} × ${C} ${u.value}`;
1638
+ return S(
1639
+ ke.FmTooltip,
1633
1640
  { zIndex: 51 },
1634
1641
  {
1635
1642
  content() {
1636
1643
  return E;
1637
1644
  },
1638
1645
  default() {
1639
- return C(
1646
+ return S(
1640
1647
  "div",
1641
- { class: "text-right" },
1642
- l.toLocaleString("en-US", {
1643
- minimumFractionDigits: 2,
1644
- maximumFractionDigits: 4
1645
- })
1648
+ { class: "text-right w-full fm-typo-en-body-lg-400" },
1649
+ te(i)
1646
1650
  );
1647
1651
  }
1648
1652
  }
@@ -1659,46 +1663,40 @@ const Da = At(
1659
1663
  header: () => X(`System value (${u.value})`),
1660
1664
  size: 180,
1661
1665
  cell(p) {
1662
- var L;
1663
- const s = p.row.original, l = s.systemValue, f = z.value.find((E) => E._id === s.id), h = (L = f == null ? void 0 : f.defaultCost) == null ? void 0 : L.measurement, B = s.systemBalance, S = s.costPerUnit;
1664
- if (h) {
1665
- const E = H.toFormatString({ value: h.conversion }), me = `${B.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 4 })} ${s.baseUnit} ÷ ${E} × ${S} ${u.value}`;
1666
- return C(
1667
- he.FmTooltip,
1666
+ var N;
1667
+ const o = p.row.original, i = o.systemValue, f = z.value.find((E) => E._id === o.id), b = (N = f == null ? void 0 : f.defaultCost) == null ? void 0 : N.measurement, B = o.systemBalance, C = o.costPerUnit;
1668
+ if (b) {
1669
+ const E = H.toFormatString({ value: b.conversion }), fe = `${te(B, { minPrecision: 2, maxPrecision: 4 })} ${o.baseUnit} ÷ ${E} × ${C} ${u.value}`;
1670
+ return S(
1671
+ ke.FmTooltip,
1668
1672
  { zIndex: 51 },
1669
1673
  {
1670
1674
  content() {
1671
- return me;
1675
+ return fe;
1672
1676
  },
1673
1677
  default() {
1674
- return C(
1678
+ return S(
1675
1679
  "div",
1676
- { class: "text-right" },
1677
- l.toLocaleString("en-US", {
1678
- minimumFractionDigits: 2,
1679
- maximumFractionDigits: 4
1680
- })
1680
+ { class: "text-right fm-typo-en-body-lg-400" },
1681
+ te(i)
1681
1682
  );
1682
1683
  }
1683
1684
  }
1684
1685
  );
1685
1686
  } else {
1686
- const E = `${B.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 4 })} ${s.baseUnit} × ${S} ${u.value}`;
1687
- return C(
1688
- he.FmTooltip,
1687
+ const E = `${te(B, { minPrecision: 2, maxPrecision: 4 })} ${o.baseUnit} × ${C} ${u.value}`;
1688
+ return S(
1689
+ ke.FmTooltip,
1689
1690
  { zIndex: 51 },
1690
1691
  {
1691
1692
  content() {
1692
1693
  return E;
1693
1694
  },
1694
1695
  default() {
1695
- return C(
1696
+ return S(
1696
1697
  "div",
1697
- { class: "text-right" },
1698
- l.toLocaleString("en-US", {
1699
- minimumFractionDigits: 2,
1700
- maximumFractionDigits: 4
1701
- })
1698
+ { class: "text-right fm-typo-en-body-lg-400" },
1699
+ te(i)
1702
1700
  );
1703
1701
  }
1704
1702
  }
@@ -1714,19 +1712,19 @@ const Da = At(
1714
1712
  header: () => "Amounts",
1715
1713
  enableSorting: !1,
1716
1714
  cell(p) {
1717
- const s = p.row.original, l = (h, B) => C(
1718
- he.FmTooltip,
1715
+ const o = p.row.original, i = (b, B) => S(
1716
+ ke.FmTooltip,
1719
1717
  { zIndex: 50 },
1720
1718
  {
1721
1719
  default() {
1722
- return C(
1720
+ return S(
1723
1721
  "div",
1724
1722
  {
1725
- class: "fm-typo-en-body-md-400 py-4 px-8 border-1 border-fm-color-typo-secondary fm-corner-radius-md line-clamp-1"
1723
+ class: "fm-typo-en-body-lg-400 py-4 px-8 border-1 border-fm-color-typo-secondary fm-corner-radius-md line-clamp-1"
1726
1724
  },
1727
1725
  [
1728
- C("span", { class: "text-fm-color-typo-primary" }, `${h} `),
1729
- C(
1726
+ S("span", { class: "text-fm-color-typo-primary" }, `${b} `),
1727
+ S(
1730
1728
  "span",
1731
1729
  {
1732
1730
  class: "text-fm-color-typo-secondary",
@@ -1738,17 +1736,17 @@ const Da = At(
1738
1736
  );
1739
1737
  },
1740
1738
  content() {
1741
- return `${h} ${B}`;
1739
+ return `${b} ${B}`;
1742
1740
  }
1743
1741
  }
1744
1742
  );
1745
- let f = Array.from({ length: i }).map((h, B) => {
1746
- if (!s[`measurementAmount${B}`])
1743
+ let f = Array.from({ length: l }).map((b, B) => {
1744
+ if (!o[`measurementAmount${B}`])
1747
1745
  return null;
1748
- const S = s[`measurementAmount${B}`], L = s[`measurementAbbrev${B}`];
1749
- return l(S, L);
1750
- }).filter((h) => h);
1751
- return (s.baseUnitAmount || !f.length) && (f = [l(s.baseUnitAmount, s.baseUnit), ...f]), C(
1746
+ const C = o[`measurementAmount${B}`], N = o[`measurementAbbrev${B}`];
1747
+ return i(C, N);
1748
+ }).filter((b) => b);
1749
+ return (o.baseUnitAmount || !f.length) && (f = [i(o.baseUnitAmount, o.baseUnit), ...f]), S(
1752
1750
  "div",
1753
1751
  {
1754
1752
  class: "flex gap-8 flex-nowrap",
@@ -1761,106 +1759,106 @@ const Da = At(
1761
1759
  }
1762
1760
  }
1763
1761
  ];
1764
- }), De = R(() => ke.value.map((i) => i.size ?? 0).reduce((i, a) => i + a)), ye = Y(""), Ie = R(() => {
1765
- var p, s;
1766
- const i = ((s = (p = e.draft) == null ? void 0 : p.negativeStockItems) == null ? void 0 : s.reduce(
1767
- (l, f) => (l[f.sku._id] = f, l),
1762
+ }), Ae = U(() => xe.value.map((l) => l.size ?? 0).reduce((l, a) => l + a)), be = Y(""), Pe = U(() => {
1763
+ var p, o;
1764
+ const l = ((o = (p = e.draft) == null ? void 0 : p.negativeStockItems) == null ? void 0 : o.reduce(
1765
+ (i, f) => (i[f.sku._id] = f, i),
1768
1766
  {}
1769
1767
  )) ?? {};
1770
- return z.value.map((l) => {
1771
- var rt, lt, it, ct, ut, dt, mt, ft, pt, vt, gt;
1772
- const f = (rt = U.value.get(l._id)) == null ? void 0 : rt[0], h = ((lt = y.value.get(l._id)) == null ? void 0 : lt[0]) ?? ae, B = ((it = l.defaultCost) == null ? void 0 : it.costPerUnit) ?? ae, S = Number(H.toFormatString({ value: B })), L = ((ut = (ct = l.defaultCost) == null ? void 0 : ct.measurement) == null ? void 0 : ut.conversion) ?? {
1768
+ return z.value.map((i) => {
1769
+ var lt, it, ct, ut, dt, mt, ft, pt, vt, yt, gt;
1770
+ const f = (lt = P.value.get(i._id)) == null ? void 0 : lt[0], b = ((it = g.value.get(i._id)) == null ? void 0 : it[0]) ?? ne, B = ((ct = i.defaultCost) == null ? void 0 : ct.costPerUnit) ?? ne, C = Number(H.toFormatString({ value: B })), N = ((dt = (ut = i.defaultCost) == null ? void 0 : ut.measurement) == null ? void 0 : dt.conversion) ?? {
1773
1771
  amount: 1,
1774
1772
  precision: 0
1775
1773
  }, E = Number(
1776
- H.toFormatString({ value: L })
1777
- ), me = ee.value.get(l._id), pe = me ? Number(H.toFormatString({ value: me })) : 0, we = J.value.get(l._id), T = {};
1778
- if (M.value.forEach((se) => {
1779
- const ve = T[se] ?? { amount: 0, precision: 0 }, ge = we == null ? void 0 : we[se];
1780
- ge && (T[se] = Ct(ve, ge));
1774
+ H.toFormatString({ value: N })
1775
+ ), fe = ee.value.get(i._id), ve = fe ? Number(H.toFormatString({ value: fe })) : 0, Se = J.value.get(i._id), T = {};
1776
+ if (M.value.forEach((re) => {
1777
+ const ye = T[re] ?? { amount: 0, precision: 0 }, ge = Se == null ? void 0 : Se[re];
1778
+ ge && (T[re] = Bt(ye, ge));
1781
1779
  }), !f) {
1782
- const se = Number(H.toFormatString({ value: h })), ve = 0 - se, ge = ve * S / E, Ne = 0, Pt = se * S / E;
1780
+ const re = Number(H.toFormatString({ value: b })), ye = 0 - re, ge = ye * C / E, Ee = 0, Nt = re * C / E;
1783
1781
  return {
1784
- id: l._id,
1785
- code: l.code,
1786
- name: l.name,
1787
- costUnit: ((mt = (dt = l.defaultCost) == null ? void 0 : dt.measurement) == null ? void 0 : mt.abbrev) ?? null,
1788
- baseUnit: l.unit.abbrev,
1782
+ id: i._id,
1783
+ code: i.code,
1784
+ name: i.name,
1785
+ costUnit: ((ft = (mt = i.defaultCost) == null ? void 0 : mt.measurement) == null ? void 0 : ft.abbrev) ?? null,
1786
+ baseUnit: i.unit.abbrev,
1789
1787
  baseUnitAmount: 0,
1790
- systemBalance: se,
1788
+ systemBalance: re,
1791
1789
  physicalBalance: 0,
1792
- adjustedAmount: -se,
1790
+ adjustedAmount: -re,
1793
1791
  adjustedDiffPercentage: -100,
1794
- isTemplateItem: !i[l._id],
1795
- costPerUnit: S,
1796
- opening: pe,
1797
- varianceQty: ve,
1792
+ isTemplateItem: !l[i._id],
1793
+ costPerUnit: C,
1794
+ opening: ve,
1795
+ varianceQty: ye,
1798
1796
  varianceInCost: ge,
1799
- stockTakeValue: Ne,
1800
- systemValue: Pt,
1797
+ stockTakeValue: Ee,
1798
+ systemValue: Nt,
1801
1799
  adjustmentAmounts: T
1802
1800
  };
1803
1801
  }
1804
- const ne = Tt(f), le = (pt = (ft = x.value) == null ? void 0 : ft.find(
1805
- (se) => se.id === l._id
1806
- )) == null ? void 0 : pt.balance, be = St(
1807
- le ?? ne,
1808
- h
1809
- ), $e = h.amount === 0 ? null : Ft(be, {
1810
- ...h,
1811
- amount: Math.abs(h.amount)
1812
- }), Le = $e ? at($e, re) : null, We = Number(H.toFormatString({ value: h })), Ze = Number(H.toFormatString({ value: ne })), st = Ze - We, Ut = st * S / E, Rt = Ze * S / E, Vt = We * S / E;
1802
+ const oe = It(f), ie = (vt = (pt = x.value) == null ? void 0 : pt.find(
1803
+ (re) => re.id === i._id
1804
+ )) == null ? void 0 : vt.balance, he = $t(
1805
+ ie ?? oe,
1806
+ b
1807
+ ), Be = b.amount === 0 ? null : Ft(he, {
1808
+ ...b,
1809
+ amount: Math.abs(b.amount)
1810
+ }), Le = Be ? nt(Be, le) : null, We = Number(H.toFormatString({ value: b })), Ze = Number(H.toFormatString({ value: oe })), rt = Ze - We, Rt = rt * C / E, Vt = Ze * C / E, Mt = We * C / E;
1813
1811
  return {
1814
- id: l._id,
1815
- code: l.code,
1816
- name: l.name,
1817
- costUnit: ((gt = (vt = l.defaultCost) == null ? void 0 : vt.measurement) == null ? void 0 : gt.abbrev) ?? null,
1818
- baseUnit: l.unit.abbrev,
1812
+ id: i._id,
1813
+ code: i.code,
1814
+ name: i.name,
1815
+ costUnit: ((gt = (yt = i.defaultCost) == null ? void 0 : yt.measurement) == null ? void 0 : gt.abbrev) ?? null,
1816
+ baseUnit: i.unit.abbrev,
1819
1817
  baseUnitAmount: Number(H.toFormatString({ value: f.baseAmount })),
1820
- ...f.measurementsAmounts.filter((se) => {
1821
- var ve, ge, Ne;
1822
- return (Ne = (ge = (ve = te.value) == null ? void 0 : ve.get(l._id)) == null ? void 0 : ge[0]) == null ? void 0 : Ne.includes(se.measurement.id);
1823
- }).reduce((se, ve, ge) => (se[`measurementAbbrev${ge}`] = `(${ve.measurement.abbrev}) × ${H.toFormatString({ value: ve.measurement.conversion })}`, se[`measurementAmount${ge}`] = Number(H.toFormatString({ value: ve.amount })), se), {}),
1818
+ ...f.measurementsAmounts.filter((re) => {
1819
+ var ye, ge, Ee;
1820
+ return (Ee = (ge = (ye = ae.value) == null ? void 0 : ye.get(i._id)) == null ? void 0 : ge[0]) == null ? void 0 : Ee.includes(re.measurement.id);
1821
+ }).reduce((re, ye, ge) => (re[`measurementAbbrev${ge}`] = `(${ye.measurement.abbrev}) × ${H.toFormatString({ value: ye.measurement.conversion })}`, re[`measurementAmount${ge}`] = Number(H.toFormatString({ value: ye.amount })), re), {}),
1824
1822
  systemBalance: We,
1825
1823
  physicalBalance: Ze,
1826
- adjustedAmount: Number(H.toFormatString({ value: be })),
1824
+ adjustedAmount: Number(H.toFormatString({ value: he })),
1827
1825
  adjustedDiffPercentage: Le ? Number(
1828
1826
  H.toFormatString({
1829
- value: $t(Le, 2)
1827
+ value: Tt(Le, 2)
1830
1828
  })
1831
1829
  ) : null,
1832
- isTemplateItem: !i[l._id],
1833
- costPerUnit: S,
1834
- opening: pe,
1835
- varianceQty: st,
1836
- varianceInCost: Ut,
1837
- stockTakeValue: Rt,
1838
- systemValue: Vt,
1830
+ isTemplateItem: !l[i._id],
1831
+ costPerUnit: C,
1832
+ opening: ve,
1833
+ varianceQty: rt,
1834
+ varianceInCost: Rt,
1835
+ stockTakeValue: Vt,
1836
+ systemValue: Mt,
1839
1837
  adjustmentAmounts: T
1840
1838
  };
1841
- }).filter((l) => !!(l.isTemplateItem && m.value.templateItem || !l.isTemplateItem && m.value.nonTemplateItem));
1842
- }), Se = R(() => {
1843
- var a, p, s, l, f;
1839
+ }).filter((i) => !!(i.isTemplateItem && m.value.templateItem || !i.isTemplateItem && m.value.nonTemplateItem));
1840
+ }), Ce = U(() => {
1841
+ var a, p, o, i, f;
1844
1842
  if (!e.draft) return [];
1845
- const i = e.draft.approvedAt ? {
1846
- action: `Approve at ${xe(e.draft.approvedAt)}`,
1843
+ const l = e.draft.approvedAt ? {
1844
+ action: `Approve at ${De(e.draft.approvedAt)}`,
1847
1845
  // actionAt: props.draft.approvedAt,
1848
1846
  actionBy: e.draft.approvedBy,
1849
1847
  remark: e.draft.approveRemark
1850
- } : (a = e.draft.rejectionHistory) == null ? void 0 : a.computeFirst((h) => ({
1851
- action: `Reject at ${xe(h.rejectedAt)}`,
1848
+ } : (a = e.draft.rejectionHistory) == null ? void 0 : a.computeFirst((b) => ({
1849
+ action: `Reject at ${De(b.rejectedAt)}`,
1852
1850
  // actionAt: e.rejectedAt,
1853
- actionBy: h.rejectedBy,
1854
- remark: h.rejectRemark
1851
+ actionBy: b.rejectedBy,
1852
+ remark: b.rejectRemark
1855
1853
  }));
1856
1854
  return [
1857
1855
  {
1858
1856
  label: "Location",
1859
- value: ((p = j._currentLocation) == null ? void 0 : p.name) ?? "N/A"
1857
+ value: ((p = j._currentLocation) == null ? void 0 : p.name) ?? kt
1860
1858
  },
1861
1859
  {
1862
1860
  label: "Created at",
1863
- value: xe(e.draft.createdAt)
1861
+ value: De(e.draft.createdAt)
1864
1862
  },
1865
1863
  {
1866
1864
  label: "Created by",
@@ -1868,7 +1866,7 @@ const Da = At(
1868
1866
  },
1869
1867
  {
1870
1868
  label: "Updated at",
1871
- value: xe(e.draft.updatedAt)
1869
+ value: De(e.draft.updatedAt)
1872
1870
  },
1873
1871
  {
1874
1872
  label: "Updated by",
@@ -1876,30 +1874,30 @@ const Da = At(
1876
1874
  },
1877
1875
  {
1878
1876
  label: "Effective at",
1879
- value: xe(e.draft.effectiveAt ?? He((s = e.draft) == null ? void 0 : s._id))
1877
+ value: De(e.draft.effectiveAt ?? Oe((o = e.draft) == null ? void 0 : o._id))
1880
1878
  },
1881
1879
  {
1882
1880
  label: "Using template",
1883
- value: ((l = e.draft.usingTemplates.find((h) => h)) == null ? void 0 : l.name) ?? "None"
1881
+ value: ((i = e.draft.usingTemplates.find((b) => b)) == null ? void 0 : i.name) ?? "None"
1884
1882
  },
1885
1883
  e.draft.remark ? {
1886
1884
  label: "Remark",
1887
1885
  value: e.draft.remark
1888
1886
  } : null,
1889
- i ? {
1887
+ l ? {
1890
1888
  label: "Last action",
1891
- value: i.action
1889
+ value: l.action
1892
1890
  } : null,
1893
- i && i.actionBy ? {
1891
+ l && l.actionBy ? {
1894
1892
  label: "Last action by",
1895
- value: (f = i.actionBy) == null ? void 0 : f.name
1893
+ value: (f = l.actionBy) == null ? void 0 : f.name
1896
1894
  } : null,
1897
- i && i.remark ? {
1895
+ l && l.remark ? {
1898
1896
  label: "Action remark",
1899
- value: i.remark
1897
+ value: l.remark
1900
1898
  } : null
1901
- ].filter((h) => h).map((h) => h);
1902
- }), Fe = [
1899
+ ].filter((b) => b).map((b) => b);
1900
+ }), $e = [
1903
1901
  {
1904
1902
  label: "Overview",
1905
1903
  value: "overview"
@@ -1908,176 +1906,176 @@ const Da = At(
1908
1906
  label: "Action history",
1909
1907
  value: "history"
1910
1908
  }
1911
- ], Ae = Y(Fe[0]), Ce = R(() => {
1912
- var s, l, f;
1913
- const i = ((s = e.draft) == null ? void 0 : s.activityLogs) ?? [], a = ((l = e.draft) == null ? void 0 : l.rejectionHistory) ?? [];
1914
- for (const h of a)
1915
- i.find(
1916
- (S) => `${S.action}_${S.performedAt}` == `${Z.enum.rejectDraft}_${h.rejectedAt}`
1917
- ) || i.push({
1909
+ ], we = Y($e[0]), Fe = U(() => {
1910
+ var o, i, f;
1911
+ const l = ((o = e.draft) == null ? void 0 : o.activityLogs) ?? [], a = ((i = e.draft) == null ? void 0 : i.rejectionHistory) ?? [];
1912
+ for (const b of a)
1913
+ l.find(
1914
+ (C) => `${C.action}_${C.performedAt}` == `${Z.enum.rejectDraft}_${b.rejectedAt}`
1915
+ ) || l.push({
1918
1916
  action: Z.enum.rejectDraft,
1919
- performedAt: h.rejectedAt,
1920
- performedBy: h.rejectedBy,
1921
- remark: h.rejectRemark
1917
+ performedAt: b.rejectedAt,
1918
+ performedBy: b.rejectedBy,
1919
+ remark: b.rejectRemark
1922
1920
  });
1923
- return (f = e.draft) != null && f.approvedAt && (i.find(
1921
+ return (f = e.draft) != null && f.approvedAt && (l.find(
1924
1922
  (B) => {
1925
- var S;
1926
- return `${B.action}_${B.performedAt}` == `${Z.enum.approveDraft}_${(S = e.draft) == null ? void 0 : S.approvedAt}`;
1923
+ var C;
1924
+ return `${B.action}_${B.performedAt}` == `${Z.enum.approveDraft}_${(C = e.draft) == null ? void 0 : C.approvedAt}`;
1927
1925
  }
1928
- ) || i.push({
1926
+ ) || l.push({
1929
1927
  action: Z.enum.approveDraft,
1930
1928
  performedAt: e.draft.approvedAt,
1931
1929
  performedBy: e.draft.approvedBy ?? { name: "Unknown", id: "unknown" },
1932
1930
  remark: e.draft.approveRemark
1933
- })), i.sort((h, B) => new Date(B.performedAt).getTime() - new Date(h.performedAt).getTime()).map(
1934
- (h) => ({
1935
- header: Ue(h.action),
1936
- date: xe(h.performedAt),
1931
+ })), l.sort((b, B) => new Date(B.performedAt).getTime() - new Date(b.performedAt).getTime()).map(
1932
+ (b) => ({
1933
+ header: Ue(b.action),
1934
+ date: De(b.performedAt),
1937
1935
  info: [
1938
1936
  {
1939
1937
  label: "Performed by",
1940
- values: [h.performedBy.name]
1938
+ values: [b.performedBy.name]
1941
1939
  },
1942
1940
  {
1943
1941
  label: "Remark",
1944
- values: [h.remark ?? ""]
1942
+ values: [b.remark ?? ""]
1945
1943
  }
1946
1944
  ]
1947
1945
  })
1948
1946
  );
1949
- }), Pe = Y(!1), Me = Y(!1), ot = R(() => {
1950
- var i;
1951
- return ((i = e.draft) == null ? void 0 : i.status) !== _e.enum.DRAFT ? "Status is not draft." : null;
1947
+ }), Me = Y(!1), Ne = Y(!1), st = U(() => {
1948
+ var l;
1949
+ return ((l = e.draft) == null ? void 0 : l.status) !== _e.enum.DRAFT ? "Status is not draft." : null;
1952
1950
  });
1953
- function It() {
1954
- e.draft && (Me.value = !0, _.approveDraft(
1951
+ function Ut() {
1952
+ e.draft && (Ne.value = !0, k.approveDraft(
1955
1953
  e.draft,
1956
1954
  () => {
1957
- Me.value = !1, Pe.value = !1, g("submitted");
1955
+ Ne.value = !1, Me.value = !1, y("submitted");
1958
1956
  },
1959
1957
  () => {
1960
- Me.value = !1;
1958
+ Ne.value = !1;
1961
1959
  }
1962
1960
  ));
1963
1961
  }
1964
- return (i, a) => {
1965
- const p = O("FmButtonGroup"), s = O("FmMenuDivider"), l = O("FmCard"), f = O("FmButton"), h = O("FmCircularProgress"), B = O("FmChip"), S = O("FmTextField"), L = O("FmIcon"), E = O("FmTable"), me = O("FmSpacer"), pe = O("FmTooltip"), we = O("FmSideSheet");
1966
- return A(), V(ie, null, [
1967
- k(we, {
1962
+ return (l, a) => {
1963
+ const p = O("FmButtonGroup"), o = O("FmMenuDivider"), i = O("FmCard"), f = O("FmButton"), b = O("FmCircularProgress"), B = O("FmChip"), C = O("FmTextField"), N = O("FmIcon"), E = O("FmTable"), fe = O("FmSpacer"), ve = O("FmTooltip"), Se = O("FmSideSheet");
1964
+ return A(), R(ce, null, [
1965
+ _(Se, {
1968
1966
  "dismiss-away": "",
1969
1967
  "max-width": 9999,
1970
- "model-value": v(b),
1971
- "onUpdate:modelValue": a[9] || (a[9] = (T) => ht(b) ? b.value = T : null),
1968
+ "model-value": v(h),
1969
+ "onUpdate:modelValue": a[9] || (a[9] = (T) => _t(h) ? h.value = T : null),
1972
1970
  header: "Closing details"
1973
1971
  }, {
1974
1972
  "side-sheet-footer": q(() => {
1975
- var T, ne, le, be;
1973
+ var T, oe, ie, he;
1976
1974
  return [
1977
- n("div", xn, [
1978
- n("div", Dn, [
1979
- ((T = e.draft) == null ? void 0 : T.status) === v(_e).enum.DRAFT ? (A(), V(ie, { key: 0 }, [
1980
- ot.value ? (A(), fe(pe, {
1975
+ n("div", wn, [
1976
+ n("div", Sn, [
1977
+ ((T = e.draft) == null ? void 0 : T.status) === v(_e).enum.DRAFT ? (A(), R(ce, { key: 0 }, [
1978
+ st.value ? (A(), pe(ve, {
1981
1979
  key: 0,
1982
1980
  "z-index": 51,
1983
1981
  placement: "right"
1984
1982
  }, {
1985
1983
  content: q(() => [
1986
- ce(W(ot.value), 1)
1984
+ ue(W(st.value), 1)
1987
1985
  ]),
1988
1986
  default: q(() => [
1989
- k(f, {
1987
+ _(f, {
1990
1988
  disabled: "",
1991
1989
  key: "approve key",
1992
1990
  label: "Approve"
1993
1991
  })
1994
1992
  ]),
1995
1993
  _: 1
1996
- })) : (A(), fe(f, {
1994
+ })) : (A(), pe(f, {
1997
1995
  key: "approve key",
1998
1996
  label: "Approve",
1999
- onClick: a[5] || (a[5] = ($e) => Pe.value = !0)
1997
+ onClick: a[5] || (a[5] = (Be) => Me.value = !0)
2000
1998
  }))
2001
- ], 64)) : oe("", !0),
2002
- ((ne = e.draft) == null ? void 0 : ne.status) === v(_e).enum.DRAFT ? (A(), fe(f, {
1999
+ ], 64)) : se("", !0),
2000
+ ((oe = e.draft) == null ? void 0 : oe.status) === v(_e).enum.DRAFT ? (A(), pe(f, {
2003
2001
  key: 1,
2004
2002
  label: "Reject",
2005
2003
  variant: "destructive",
2006
- onClick: a[6] || (a[6] = () => e.draft && v(_).rejectDraft(e.draft, () => g("submitted")))
2007
- })) : oe("", !0),
2008
- k(f, {
2004
+ onClick: a[6] || (a[6] = () => e.draft && v(k).rejectDraft(e.draft, () => y("submitted")))
2005
+ })) : se("", !0),
2006
+ _(f, {
2009
2007
  label: "Close",
2010
2008
  variant: "tertiary",
2011
- onClick: a[7] || (a[7] = ($e) => b.value = !1)
2009
+ onClick: a[7] || (a[7] = (Be) => h.value = !1)
2012
2010
  }),
2013
- (le = e.draft) != null && le.approvedAt && ((be = e.draft) == null ? void 0 : be.status) !== v(_e).enum.COMPLETED ? (A(), fe(yt, { key: 2 }, {
2011
+ (ie = e.draft) != null && ie.approvedAt && ((he = e.draft) == null ? void 0 : he.status) !== v(_e).enum.COMPLETED ? (A(), pe(bt, { key: 2 }, {
2014
2012
  default: q(() => [
2015
- k(f, {
2013
+ _(f, {
2016
2014
  label: "Sync",
2017
- loading: P.value,
2015
+ loading: V.value,
2018
2016
  onClick: a[8] || (a[8] = () => {
2019
- e.draft && (P.value = !0, v(_).syncDraft(e.draft, () => {
2020
- P.value = !1, g("submitted");
2017
+ e.draft && (V.value = !0, v(k).syncDraft(e.draft, () => {
2018
+ V.value = !1, y("submitted");
2021
2019
  }));
2022
2020
  })
2023
2021
  }, null, 8, ["loading"])
2024
2022
  ]),
2025
2023
  _: 1
2026
- })) : oe("", !0)
2024
+ })) : se("", !0)
2027
2025
  ]),
2028
- n("div", An, [
2026
+ n("div", Cn, [
2029
2027
  a[19] || (a[19] = n("div", { class: "text-xs text-gray-500 uppercase tracking-wide" }, " Total stock take value ", -1)),
2030
- n("div", wn, W(u.value) + " " + W(ue.value.toFixed(2)), 1)
2028
+ n("div", $n, W(u.value) + " " + W(de.value.toFixed(2)), 1)
2031
2029
  ])
2032
2030
  ])
2033
2031
  ];
2034
2032
  }),
2035
2033
  default: q(() => [
2036
- n("div", Ea, [
2034
+ n("div", Oa, [
2037
2035
  n("div", null, [
2038
- k(p, {
2039
- items: Fe,
2040
- modelValue: Ae.value,
2041
- "onUpdate:modelValue": a[0] || (a[0] = (T) => Ae.value = T)
2036
+ _(p, {
2037
+ items: $e,
2038
+ modelValue: we.value,
2039
+ "onUpdate:modelValue": a[0] || (a[0] = (T) => we.value = T)
2042
2040
  }, null, 8, ["modelValue"])
2043
2041
  ]),
2044
- Ae.value.value === "overview" ? (A(), V(ie, { key: 0 }, [
2045
- k(l, {
2042
+ we.value.value === "overview" ? (A(), R(ce, { key: 0 }, [
2043
+ _(i, {
2046
2044
  variant: "outlined",
2047
2045
  class: "flex flex-col gap-8 px-12 py-16"
2048
2046
  }, {
2049
2047
  default: q(() => {
2050
- var T, ne;
2048
+ var T, oe;
2051
2049
  return [
2052
- n("div", za, [
2050
+ n("div", Ka, [
2053
2051
  a[11] || (a[11] = n("div", { class: "fm-typo-en-body-lg-600" }, "Closing summary", -1)),
2054
- n("div", Ha, [
2052
+ n("div", Ya, [
2055
2053
  n("div", {
2056
- class: je(["fm-status-badge", v(Oe)(((T = i.draft) == null ? void 0 : T.status) ?? "DRAFT")])
2057
- }, W(v(Ue)(((ne = i.draft) == null ? void 0 : ne.status) ?? "")), 3)
2054
+ class: Ie(["fm-status-badge", v(Ke)(((T = l.draft) == null ? void 0 : T.status) ?? "DRAFT")])
2055
+ }, W(v(Ue)(((oe = l.draft) == null ? void 0 : oe.status) ?? "")), 3)
2058
2056
  ])
2059
2057
  ]),
2060
- k(s),
2061
- n("div", Oa, [
2062
- (A(!0), V(ie, null, Te(Se.value, (le, be) => (A(), V("div", {
2058
+ _(o),
2059
+ n("div", qa, [
2060
+ (A(!0), R(ce, null, je(Ce.value, (ie, he) => (A(), R("div", {
2063
2061
  class: "flex flex-col gap-4",
2064
- key: be
2062
+ key: he
2065
2063
  }, [
2066
- n("div", Ka, [
2067
- n("div", Ya, W(le.label), 1)
2064
+ n("div", Ga, [
2065
+ n("div", Qa, W(ie.label), 1)
2068
2066
  ]),
2069
- n("div", qa, W(le.value), 1)
2067
+ n("div", Wa, W(ie.value), 1)
2070
2068
  ]))), 128))
2071
2069
  ])
2072
2070
  ];
2073
2071
  }),
2074
2072
  _: 1
2075
2073
  }),
2076
- n("div", Ga, [
2077
- n("div", Qa, [
2074
+ n("div", Za, [
2075
+ n("div", Ja, [
2078
2076
  a[12] || (a[12] = n("div", { class: "flex-1 fm-typo-en-title-sm-600 text-fm-color-typo-primary" }, " Closing items ", -1)),
2079
- r.value ? oe("", !0) : (A(), V("div", Wa, [
2080
- i.draft && i.draft.status !== v(_e).enum.COMPLETED ? (A(), fe(f, {
2077
+ r.value ? se("", !0) : (A(), R("div", Xa, [
2078
+ l.draft && l.draft.status !== v(_e).enum.COMPLETED ? (A(), pe(f, {
2081
2079
  key: 0,
2082
2080
  label: "Refresh balance",
2083
2081
  "prepend-icon": "refresh",
@@ -2085,85 +2083,85 @@ const Da = At(
2085
2083
  "text-color": "primary",
2086
2084
  "bg-color": "transparent",
2087
2085
  "border-color": "primary",
2088
- loading: N.value,
2089
- onClick: F
2090
- }, null, 8, ["loading"])) : oe("", !0),
2091
- k(yt, null, {
2086
+ loading: L.value,
2087
+ onClick: $
2088
+ }, null, 8, ["loading"])) : se("", !0),
2089
+ _(bt, null, {
2092
2090
  default: q(() => [
2093
- k(f, {
2091
+ _(f, {
2094
2092
  label: "Invalidate Draft Cache",
2095
2093
  "prepend-icon": "refresh",
2096
2094
  variant: "secondary",
2097
2095
  "text-color": "primary",
2098
2096
  "bg-color": "transparent",
2099
2097
  "border-color": "primary",
2100
- loading: N.value,
2098
+ loading: L.value,
2101
2099
  onClick: w
2102
2100
  }, null, 8, ["loading"])
2103
2101
  ]),
2104
2102
  _: 1
2105
2103
  }),
2106
- k(f, {
2104
+ _(f, {
2107
2105
  label: "Export data",
2108
2106
  "prepend-icon": "download",
2109
2107
  variant: "secondary",
2110
2108
  "text-color": "primary",
2111
2109
  "bg-color": "transparent",
2112
2110
  "border-color": "primary",
2113
- onClick: a[1] || (a[1] = (T) => i.draft ? v(_).exportDraft(
2114
- i.draft,
2111
+ onClick: a[1] || (a[1] = (T) => l.draft ? v(k).exportDraft(
2112
+ l.draft,
2115
2113
  I.value,
2116
2114
  x.value
2117
2115
  ) : null)
2118
2116
  })
2119
2117
  ]))
2120
2118
  ]),
2121
- r.value ? (A(), V("div", Za, [
2119
+ r.value ? (A(), R("div", en, [
2122
2120
  a[14] || (a[14] = n("div", { class: "h-80" }, null, -1)),
2123
- n("div", Ja, [
2121
+ n("div", tn, [
2124
2122
  n("div", null, [
2125
- k(h, { size: "md" })
2123
+ _(b, { size: "md" })
2126
2124
  ]),
2127
2125
  a[13] || (a[13] = n("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, " Fetching info... ", -1))
2128
2126
  ]),
2129
2127
  a[15] || (a[15] = n("div", { class: "h-80" }, null, -1))
2130
- ])) : (A(), V(ie, { key: 1 }, [
2131
- n("div", Xa, [
2132
- n("div", en, [
2133
- k(B, {
2128
+ ])) : (A(), R(ce, { key: 1 }, [
2129
+ n("div", an, [
2130
+ n("div", nn, [
2131
+ _(B, {
2134
2132
  label: "Template Item(s)",
2135
2133
  selected: m.value.templateItem,
2136
2134
  onClick: a[2] || (a[2] = (T) => m.value.templateItem = !m.value.templateItem)
2137
2135
  }, null, 8, ["selected"]),
2138
- k(B, {
2136
+ _(B, {
2139
2137
  label: "Non-template Item(s)",
2140
2138
  selected: m.value.nonTemplateItem,
2141
2139
  onClick: a[3] || (a[3] = (T) => m.value.nonTemplateItem = !m.value.nonTemplateItem)
2142
2140
  }, null, 8, ["selected"])
2143
2141
  ]),
2144
- k(S, {
2145
- modelValue: ye.value,
2146
- "onUpdate:modelValue": a[4] || (a[4] = (T) => ye.value = T),
2142
+ _(C, {
2143
+ modelValue: be.value,
2144
+ "onUpdate:modelValue": a[4] || (a[4] = (T) => be.value = T),
2147
2145
  placeholder: "Filter items"
2148
2146
  }, null, 8, ["modelValue"])
2149
2147
  ]),
2150
- v(t).skuTags.size ? (A(), V("div", tn, [
2151
- (A(!0), V(ie, null, Te(v(t).skuTags.keys(), (T) => (A(), fe(B, {
2148
+ v(t).skuTags.size ? (A(), R("div", on, [
2149
+ (A(!0), R(ce, null, je(v(t).skuTags.keys(), (T) => (A(), pe(B, {
2152
2150
  key: `${T}`,
2153
2151
  label: `${T}`,
2154
2152
  selectable: "",
2155
2153
  selected: D[`${T}`],
2156
- onClick: (ne) => D[`${T}`] = !D[`${T}`]
2154
+ onClick: (oe) => D[`${T}`] = !D[`${T}`]
2157
2155
  }, {
2158
2156
  default: q(() => [
2159
- D[`${T}`] ? (A(), fe(L, {
2157
+ D[`${T}`] ? (A(), pe(N, {
2160
2158
  key: 0,
2161
2159
  name: "check",
2162
2160
  class: "text-white",
2163
2161
  size: "sm"
2164
- })) : oe("", !0),
2162
+ })) : se("", !0),
2165
2163
  n("span", {
2166
- class: je([
2164
+ class: Ie([
2167
2165
  "",
2168
2166
  {
2169
2167
  "text-white fm-typo-en-body-md-600": D[`${T}`],
@@ -2174,86 +2172,86 @@ const Da = At(
2174
2172
  ]),
2175
2173
  _: 2
2176
2174
  }, 1032, ["label", "selected", "onClick"]))), 128))
2177
- ])) : oe("", !0),
2178
- n("div", an, [
2175
+ ])) : se("", !0),
2176
+ n("div", sn, [
2179
2177
  n("div", {
2180
- style: _t({ height: "600px", minWidth: `${De.value}px` })
2178
+ style: xt({ height: "600px", minWidth: `${Ae.value}px` })
2181
2179
  }, [
2182
- k(E, {
2183
- "column-defs": ke.value,
2184
- "row-data": Ie.value,
2185
- "search-value": ye.value
2180
+ _(E, {
2181
+ "column-defs": xe.value,
2182
+ "row-data": Pe.value,
2183
+ "search-value": be.value
2186
2184
  }, null, 8, ["column-defs", "row-data", "search-value"])
2187
2185
  ], 4)
2188
2186
  ])
2189
2187
  ], 64))
2190
2188
  ])
2191
- ], 64)) : oe("", !0),
2192
- Ae.value.value === "history" ? (A(), V("div", nn, [
2193
- Ce.value.length ? (A(), V("div", rn, [
2194
- (A(!0), V(ie, null, Te(Ce.value, (T, ne) => (A(), V(ie, { key: ne }, [
2195
- n("div", ln, [
2196
- n("div", cn, [
2197
- n("div", un, [
2189
+ ], 64)) : se("", !0),
2190
+ we.value.value === "history" ? (A(), R("div", rn, [
2191
+ Fe.value.length ? (A(), R("div", un, [
2192
+ (A(!0), R(ce, null, je(Fe.value, (T, oe) => (A(), R(ce, { key: oe }, [
2193
+ n("div", dn, [
2194
+ n("div", mn, [
2195
+ n("div", fn, [
2198
2196
  n("div", {
2199
- class: je([
2197
+ class: Ie([
2200
2198
  {
2201
- "bg-fm-color-primary": ne !== 0,
2202
- "bg-white": ne === 0
2199
+ "bg-fm-color-primary": oe !== 0,
2200
+ "bg-white": oe === 0
2203
2201
  },
2204
2202
  "w-[2px] h-full"
2205
2203
  ])
2206
2204
  }, null, 2)
2207
2205
  ]),
2208
2206
  a[18] || (a[18] = n("div", { class: "h-24 w-24 bg-fm-color-primary rounded-full" }, null, -1)),
2209
- n("div", dn, [
2207
+ n("div", pn, [
2210
2208
  n("div", {
2211
- class: je([
2209
+ class: Ie([
2212
2210
  {
2213
- "bg-fm-color-primary": ne < Ce.value.length - 1,
2214
- "bg-white": ne >= Ce.value.length - 1
2211
+ "bg-fm-color-primary": oe < Fe.value.length - 1,
2212
+ "bg-white": oe >= Fe.value.length - 1
2215
2213
  },
2216
2214
  "w-[2px] h-full"
2217
2215
  ])
2218
2216
  }, null, 2)
2219
2217
  ])
2220
2218
  ]),
2221
- n("div", mn, [
2222
- n("div", fn, W(T.header), 1),
2223
- n("div", pn, W(T.date), 1)
2219
+ n("div", vn, [
2220
+ n("div", yn, W(T.header), 1),
2221
+ n("div", gn, W(T.date), 1)
2224
2222
  ])
2225
2223
  ]),
2226
- n("div", vn, [
2227
- n("div", gn, [
2228
- n("div", yn, [
2224
+ n("div", bn, [
2225
+ n("div", hn, [
2226
+ n("div", kn, [
2229
2227
  n("div", {
2230
- class: je([
2228
+ class: Ie([
2231
2229
  {
2232
- "bg-fm-color-primary": ne < Ce.value.length - 1,
2233
- "bg-white": ne >= Ce.value.length - 1
2230
+ "bg-fm-color-primary": oe < Fe.value.length - 1,
2231
+ "bg-white": oe >= Fe.value.length - 1
2234
2232
  },
2235
2233
  "w-[2px] h-full"
2236
2234
  ])
2237
2235
  }, null, 2)
2238
2236
  ])
2239
2237
  ]),
2240
- n("div", bn, [
2241
- k(l, {
2238
+ n("div", _n, [
2239
+ _(i, {
2242
2240
  variant: "outlined",
2243
2241
  class: "py-12 px-16"
2244
2242
  }, {
2245
2243
  default: q(() => [
2246
- n("div", hn, [
2247
- (A(!0), V(ie, null, Te(T.info, (le, be) => (A(), V("div", {
2248
- key: be,
2244
+ n("div", xn, [
2245
+ (A(!0), R(ce, null, je(T.info, (ie, he) => (A(), R("div", {
2246
+ key: he,
2249
2247
  class: "flex flex-col gap-4"
2250
2248
  }, [
2251
- n("div", _n, W(le == null ? void 0 : le.label), 1),
2252
- n("div", kn, [
2253
- (A(!0), V(ie, null, Te(le == null ? void 0 : le.values, ($e, Le) => (A(), V("div", {
2249
+ n("div", Dn, W(ie == null ? void 0 : ie.label), 1),
2250
+ n("div", An, [
2251
+ (A(!0), R(ce, null, je(ie == null ? void 0 : ie.values, (Be, Le) => (A(), R("div", {
2254
2252
  key: Le,
2255
2253
  class: "fm-typo-en-body-lg-600"
2256
- }, W($e), 1))), 128))
2254
+ }, W(Be), 1))), 128))
2257
2255
  ])
2258
2256
  ]))), 128))
2259
2257
  ])
@@ -2263,43 +2261,43 @@ const Da = At(
2263
2261
  ])
2264
2262
  ])
2265
2263
  ], 64))), 128))
2266
- ])) : (A(), V("div", on, [
2267
- k(me),
2264
+ ])) : (A(), R("div", ln, [
2265
+ _(fe),
2268
2266
  n("div", null, [
2269
2267
  n("img", {
2270
- src: v(na),
2268
+ src: v(ra),
2271
2269
  alt: "List is empty"
2272
- }, null, 8, sn)
2270
+ }, null, 8, cn)
2273
2271
  ]),
2274
2272
  a[16] || (a[16] = n("div", { class: "fm-typo-en-body-lg-600" }, W("No records found"), -1)),
2275
2273
  a[17] || (a[17] = n("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary px-16" }, W("You can track approval and rejection history here"), -1)),
2276
- k(me),
2277
- k(me)
2274
+ _(fe),
2275
+ _(fe)
2278
2276
  ]))
2279
- ])) : oe("", !0)
2277
+ ])) : se("", !0)
2280
2278
  ])
2281
2279
  ]),
2282
2280
  _: 1
2283
2281
  }, 8, ["model-value"]),
2284
- v(b) && e.draft ? (A(), fe(Na, {
2282
+ v(h) && e.draft ? (A(), pe(Ha, {
2285
2283
  key: 0,
2286
- show: Pe.value,
2287
- "onUpdate:show": a[10] || (a[10] = (T) => Pe.value = T),
2288
- refreshing: N.value,
2289
- approving: Me.value,
2284
+ show: Me.value,
2285
+ "onUpdate:show": a[10] || (a[10] = (T) => Me.value = T),
2286
+ refreshing: L.value,
2287
+ approving: Ne.value,
2290
2288
  draft: e.draft,
2291
- onRefresh: F,
2292
- onApprove: It
2293
- }, null, 8, ["show", "refreshing", "approving", "draft"])) : oe("", !0)
2289
+ onRefresh: $,
2290
+ onApprove: Ut
2291
+ }, null, 8, ["show", "refreshing", "approving", "draft"])) : se("", !0)
2294
2292
  ], 64);
2295
2293
  };
2296
2294
  }
2297
- }), Cn = { class: "flex-1 flex flex-col gap-8" }, $n = { class: "flex flex-col" }, Bn = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Tn = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, jn = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary line-clamp-2" }, In = { class: "fm-typo-en-body-lg-400 line-clamp-2" }, eo = /* @__PURE__ */ Ve({
2295
+ }), Bn = { class: "flex-1 flex flex-col gap-8" }, Tn = { class: "flex flex-col" }, jn = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, In = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, Pn = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary line-clamp-2" }, Un = { class: "fm-typo-en-body-lg-400 line-clamp-2" }, no = /* @__PURE__ */ Ve({
2298
2296
  __name: "ClosingDraftView",
2299
2297
  setup(c) {
2300
- const { t: o } = et(), { viewDraft: e } = qe(), { viewClosingDraftProps: u, viewClosingDraftShow: _ } = Gt(qe()), b = Ge(), r = Da(), N = Et(), { breakpoints: P } = Kt();
2301
- b.watchLocation(r.fetchDrafts);
2302
- const I = R(() => r.loading), x = Y(""), M = R(() => P.value.xs || P.value.sm), G = R(() => M.value ? 10 : 20);
2298
+ const { t: s } = tt(), { viewDraft: e } = qe(), { viewClosingDraftProps: u, viewClosingDraftShow: k } = Wt(qe()), h = Ge(), r = Sa(), L = Ht(), { breakpoints: V } = qt();
2299
+ h.watchLocation(r.fetchDrafts);
2300
+ const I = U(() => r.loading), x = Y(""), M = U(() => V.value.xs || V.value.sm), G = U(() => M.value ? 10 : 20);
2303
2301
  function K(j) {
2304
2302
  switch (j) {
2305
2303
  case "refresh":
@@ -2309,30 +2307,30 @@ const Da = At(
2309
2307
  function d(j) {
2310
2308
  return j;
2311
2309
  }
2312
- const t = R(() => M.value ? [
2310
+ const t = U(() => M.value ? [
2313
2311
  {
2314
- label: o("inventory.common.refresh"),
2312
+ label: s("inventory.common.refresh"),
2315
2313
  value: "refresh",
2316
2314
  isPrimary: !1
2317
2315
  }
2318
2316
  ] : [
2319
2317
  {
2320
- label: o("inventory.common.refresh"),
2318
+ label: s("inventory.common.refresh"),
2321
2319
  value: "refresh",
2322
2320
  isPrimary: !1
2323
2321
  }
2324
2322
  ]);
2325
2323
  return (j, D) => {
2326
2324
  const Q = O("FmTable");
2327
- return A(), V(ie, null, [
2328
- k(zt, {
2329
- title: v(o)("inventory.closing.draft.title"),
2325
+ return A(), R(ce, null, [
2326
+ _(Ot, {
2327
+ title: v(s)("inventory.closing.draft.title"),
2330
2328
  actions: t.value,
2331
2329
  "onClick:action": K
2332
2330
  }, {
2333
2331
  default: q(() => [
2334
2332
  n("div", {
2335
- class: je([
2333
+ class: Ie([
2336
2334
  "flex flex-col gap-8 max-h-full",
2337
2335
  {
2338
2336
  "p-0": M.value,
@@ -2340,58 +2338,58 @@ const Da = At(
2340
2338
  }
2341
2339
  ])
2342
2340
  }, [
2343
- k(aa, {
2341
+ _(sa, {
2344
2342
  "change-location": "",
2345
2343
  searchable: "",
2346
2344
  search: x.value,
2347
- "onUpdate:search": D[0] || (D[0] = (g) => x.value = g)
2345
+ "onUpdate:search": D[0] || (D[0] = (y) => x.value = y)
2348
2346
  }, null, 8, ["search"]),
2349
- k(Q, {
2350
- style: _t(v(N).tableHeight),
2347
+ _(Q, {
2348
+ style: xt(v(L).tableHeight),
2351
2349
  "column-defs": v(r).columnDefs,
2352
2350
  "row-data": v(r).drafts,
2353
2351
  "search-value": x.value,
2354
2352
  loading: I.value,
2355
- onRowClick: D[1] || (D[1] = (g) => v(e)(g.original)),
2353
+ onRowClick: D[1] || (D[1] = (y) => v(e)(y.original)),
2356
2354
  "page-size": G.value
2357
2355
  }, {
2358
- "list-row": q((g) => [
2359
- k(sa, {
2360
- row: g,
2356
+ "list-row": q((y) => [
2357
+ _(ia, {
2358
+ row: y,
2361
2359
  onRowClick: (m) => v(e)(m)
2362
2360
  }, {
2363
2361
  default: q((m) => {
2364
- var $, z, te, ue, ae, re, de, F, w, y, U, J, ee, X, ke, De, ye, Ie, Se, Fe;
2362
+ var F, z, ae, de, ne, le, me, $, w, g, P, J, ee, X, xe, Ae, be, Pe, Ce, $e;
2365
2363
  return [
2366
- n("div", Cn, [
2367
- n("div", $n, [
2368
- n("div", Bn, [
2369
- k(v(Ee), {
2370
- render: (te = (z = ($ = m._id) == null ? void 0 : $.column) == null ? void 0 : z.columnDef) == null ? void 0 : te.cell,
2371
- props: (ae = (ue = m._id) == null ? void 0 : ue.getContext) == null ? void 0 : ae.call(ue)
2364
+ n("div", Bn, [
2365
+ n("div", Tn, [
2366
+ n("div", jn, [
2367
+ _(v(ze), {
2368
+ render: (ae = (z = (F = m._id) == null ? void 0 : F.column) == null ? void 0 : z.columnDef) == null ? void 0 : ae.cell,
2369
+ props: (ne = (de = m._id) == null ? void 0 : de.getContext) == null ? void 0 : ne.call(de)
2372
2370
  }, null, 8, ["render", "props"])
2373
2371
  ]),
2374
- n("div", Tn, [
2375
- k(v(Ee), {
2376
- render: (F = (de = (re = m.name) == null ? void 0 : re.column) == null ? void 0 : de.columnDef) == null ? void 0 : F.cell,
2377
- props: (y = (w = m.name) == null ? void 0 : w.getContext) == null ? void 0 : y.call(w)
2372
+ n("div", In, [
2373
+ _(v(ze), {
2374
+ render: ($ = (me = (le = m.name) == null ? void 0 : le.column) == null ? void 0 : me.columnDef) == null ? void 0 : $.cell,
2375
+ props: (g = (w = m.name) == null ? void 0 : w.getContext) == null ? void 0 : g.call(w)
2378
2376
  }, null, 8, ["render", "props"])
2379
2377
  ]),
2380
- n("div", jn, W([
2381
- ...g.original.items.slice(0, 3).map((Ae) => Ae.sku.name),
2382
- ...g.original.items.length >= 3 ? [`and ${g.original.items.length - 3} more items`] : []
2378
+ n("div", Pn, W([
2379
+ ...y.original.items.slice(0, 3).map((we) => we.sku.name),
2380
+ ...y.original.items.length >= 3 ? [`and ${y.original.items.length - 3} more items`] : []
2383
2381
  ].join(", ")), 1),
2384
- n("div", In, [
2385
- k(v(Ee), {
2386
- render: (ee = (J = (U = m.ref) == null ? void 0 : U.column) == null ? void 0 : J.columnDef) == null ? void 0 : ee.cell,
2387
- props: (ke = (X = m.ref) == null ? void 0 : X.getContext) == null ? void 0 : ke.call(X)
2382
+ n("div", Un, [
2383
+ _(v(ze), {
2384
+ render: (ee = (J = (P = m.ref) == null ? void 0 : P.column) == null ? void 0 : J.columnDef) == null ? void 0 : ee.cell,
2385
+ props: (xe = (X = m.ref) == null ? void 0 : X.getContext) == null ? void 0 : xe.call(X)
2388
2386
  }, null, 8, ["render", "props"])
2389
2387
  ])
2390
2388
  ]),
2391
2389
  n("div", null, [
2392
- k(v(Ee), {
2393
- render: (Ie = (ye = (De = m.status) == null ? void 0 : De.column) == null ? void 0 : ye.columnDef) == null ? void 0 : Ie.cell,
2394
- props: (Fe = (Se = m.status) == null ? void 0 : Se.getContext) == null ? void 0 : Fe.call(Se)
2390
+ _(v(ze), {
2391
+ render: (Pe = (be = (Ae = m.status) == null ? void 0 : Ae.column) == null ? void 0 : be.columnDef) == null ? void 0 : Pe.cell,
2392
+ props: ($e = (Ce = m.status) == null ? void 0 : Ce.getContext) == null ? void 0 : $e.call(Ce)
2395
2393
  }, null, 8, ["render", "props"])
2396
2394
  ])
2397
2395
  ])
@@ -2406,12 +2404,12 @@ const Da = At(
2406
2404
  ]),
2407
2405
  _: 1
2408
2406
  }, 8, ["title", "actions"]),
2409
- (A(), fe(Lt, { to: "body" }, [
2410
- k(Fn, Nt(v(u), {
2411
- show: v(_),
2412
- "onUpdate:show": D[2] || (D[2] = (g) => ht(_) ? _.value = g : null),
2413
- onSubmitted: D[3] || (D[3] = () => (_.value = !1, v(r).fetchDrafts())),
2414
- onRefresh: D[4] || (D[4] = (g) => v(r).updateDraftRef(g))
2407
+ (A(), pe(Et, { to: "body" }, [
2408
+ _(Fn, zt(v(u), {
2409
+ show: v(k),
2410
+ "onUpdate:show": D[2] || (D[2] = (y) => _t(k) ? k.value = y : null),
2411
+ onSubmitted: D[3] || (D[3] = () => (k.value = !1, v(r).fetchDrafts())),
2412
+ onRefresh: D[4] || (D[4] = (y) => v(r).updateDraftRef(y))
2415
2413
  }), null, 16, ["show"])
2416
2414
  ]))
2417
2415
  ], 64);
@@ -2419,5 +2417,5 @@ const Da = At(
2419
2417
  }
2420
2418
  });
2421
2419
  export {
2422
- eo as default
2420
+ no as default
2423
2421
  };