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

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 (114) hide show
  1. package/dist/{App-Dlnr4iYC.js → App-KmP0TzgM.js} +3 -3
  2. package/dist/{ApprovalView-Txmz-hCz.js → ApprovalView-BfXRpwMD.js} +5 -5
  3. package/dist/{BindingsDialog-BXnuWCaK.js → BindingsDialog-DNYn8rOv.js} +5 -5
  4. package/dist/{BindingsPicker-CO2_vfjx.js → BindingsPicker-C_BwhQ6B.js} +3 -3
  5. package/dist/{BindingsTable-amypZb8r.js → BindingsTable-BUNvU001.js} +5 -5
  6. package/dist/{ClosingDraftView-Kegm5V38.js → ClosingDraftView-D7eJrwDC.js} +139 -139
  7. package/dist/{ClosingHistoryView-D9VXx7c6.js → ClosingHistoryView-LPBqAMLm.js} +36 -36
  8. package/dist/{ClosingTemplateView-PYKa8KDQ.js → ClosingTemplateView-GvF2Tvny.js} +14 -14
  9. package/dist/{DeliveryOrderPrintPreview-BBUliD2T.js → DeliveryOrderPrintPreview-CFEuEOxp.js} +7 -7
  10. package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-DhJjC8RN.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-BWq4rWaC.js} +17 -17
  11. package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-D0z-41dr.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-uIJ2INOr.js} +2 -2
  12. package/dist/{FmMultiselectDialog-DTYS42tQ.js → FmMultiselectDialog-B7UPOXEa.js} +1 -1
  13. package/dist/{FmMultiselectDialog-CswtC1AP.js → FmMultiselectDialog-CdBuD2tB.js} +16 -16
  14. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-DXkTWOFj.js → FmUnitInput.vue_vue_type_script_setup_true_lang-DZPqBIno.js} +11 -11
  15. package/dist/{ImportView-DvECDSkN.js → ImportView-DABcONRX.js} +6 -6
  16. package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-Dg0gQJFw.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-Bgs6kzxt.js} +1 -1
  17. package/dist/{IngredientGroupView-PYLW-jdb.js → IngredientGroupView-Dyw0SWa2.js} +5 -5
  18. package/dist/{IngredientsView-fzMFu5Kd.js → IngredientsView-3svDZ3pM.js} +14 -14
  19. package/dist/{IntegrationView-BJraR9yF.js → IntegrationView-B5Ql6B4Z.js} +12 -12
  20. package/dist/{InventoryBindingForm-BCLg-OVi.js → InventoryBindingForm-BnbjaC3n.js} +1 -1
  21. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-BAoFz9Xy.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-CU0p8OtH.js} +14 -14
  22. package/dist/{InventoryBindingSummary-BaihKVNj.js → InventoryBindingSummary-BWYqDQFW.js} +1 -1
  23. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-sxY8hdeR.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DO47als9.js} +1 -1
  24. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-BhOwDBiq.js → PremiumBadge.vue_vue_type_script_setup_true_lang-B6jIGOQk.js} +2 -2
  25. package/dist/{PublishView-BMmcC0Vq.js → PublishView-X78B9ips.js} +8 -8
  26. package/dist/{PurchaseOrderPrintPreview-BWl9FIys.js → PurchaseOrderPrintPreview-BcBjpdKk.js} +11 -11
  27. package/dist/{ReceiveRequestView-Cn5w0cDy.js → ReceiveRequestView-jCXmQuZN.js} +19 -19
  28. package/dist/RecipeView-BQN7W4_n.js +646 -0
  29. package/dist/{StockView-oxOQh8eg.js → StockView-DBI_vEFM.js} +881 -860
  30. package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-JGzokQMQ.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-BowCyYAA.js} +1 -1
  31. package/dist/{SupplierView-TSbv1g43.js → SupplierView-2OV8kRmK.js} +11 -11
  32. package/dist/{SurchargeView-CZDaMAk2.js → SurchargeView-B_FvfxFV.js} +6 -6
  33. package/dist/{SystemTrailDialog.vue_vue_type_script_setup_true_lang-BH90OuDB.js → SystemTrailDialog.vue_vue_type_script_setup_true_lang-B-yk6Tpp.js} +2 -2
  34. package/dist/{TemplatePublishDialog.vue_vue_type_script_setup_true_lang-D0geyvW9.js → TemplatePublishDialog.vue_vue_type_script_setup_true_lang-BN52gPS6.js} +1 -1
  35. package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-Dxm9e7s0.js → TransferDetails.vue_vue_type_script_setup_true_lang-CJeTHWlX.js} +72 -72
  36. package/dist/{TransferTemplateView-Ds4UfF6z.js → TransferTemplateView-CTZzJO_r.js} +15 -15
  37. package/dist/{UnitView-DNfslwNA.js → UnitView-D4L2o3mi.js} +6 -6
  38. package/dist/{WarehouseView-DkcPy1mF.js → WarehouseView-D0YRCoO-.js} +5 -5
  39. package/dist/{WastageTemplateView-CP_sQsdU.js → WastageTemplateView-BnO927Yb.js} +60 -60
  40. package/dist/api/inventory.d.ts +36 -126
  41. package/dist/api/netsuite.d.ts +1 -8
  42. package/dist/{app-Do7d9F2j.js → app-DDU7NeKU.js} +6379 -7340
  43. package/dist/app.d.ts +0 -200
  44. package/dist/app.js +1 -1
  45. package/dist/{closing-template-BidraMN0.js → closing-template-Cbj_owJh.js} +1 -1
  46. package/dist/components/inventory-binding/InventoryBinding.vue.d.ts +1 -37
  47. package/dist/components/shell/inventory/binding-dialog.vue.d.ts +0 -14
  48. package/dist/components/shell/inventory/binding-ui.vue.d.ts +1 -16
  49. package/dist/{date2-xmQqiCBU.js → date2-CdIVvJMO.js} +1 -1
  50. package/dist/{dayjs.min-C2InbamH.js → dayjs.min-x0l3YFuh.js} +16 -16
  51. package/dist/{decimal-BHD_uD50.js → decimal-BmI-vHdY.js} +2 -2
  52. package/dist/{defineDeepModel-CoBQILOz.js → defineDeepModel-DVq8J3K0.js} +1 -1
  53. package/dist/{duplicate-template-BfJ6g_ux.js → duplicate-template-6sxuQt7G.js} +1 -1
  54. package/dist/{feature-BsP8KV0O.js → feature-CBAV6rwn.js} +89 -94
  55. package/dist/{format-time-from-id-CLLM4KoK.js → format-time-from-id-gonrB7zJ.js} +1 -1
  56. package/dist/{format-unit-display-BLtS1XcY.js → format-unit-display-UX-3QtOQ.js} +10 -10
  57. package/dist/{import-export.helper-DQvkoWnj.js → import-export.helper-D3XtnI5X.js} +7 -7
  58. package/dist/{index-p8EMSeUp.js → index-Bbs6bv6_.js} +3 -3
  59. package/dist/{index-CUm44l1O.js → index-DYB4AFCJ.js} +1 -1
  60. package/dist/{index-CrS7Yig1.js → index-VxOfv9io.js} +1412 -1471
  61. package/dist/{lodash-BNImU2Ov.js → lodash-xDP15O6H.js} +1 -1
  62. package/dist/{netsuite-DpB7HK5Q.js → netsuite-04rSEWQB.js} +60 -60
  63. package/dist/{purchase-order-template-DgbM99CO.js → purchase-order-template-Cc3-mrLi.js} +1 -1
  64. package/dist/{rules-CmGXcEkE.js → rules-CttmEqBJ.js} +18 -18
  65. package/dist/{stock-C1-SWNBT.js → stock-DJB96pzi.js} +1 -1
  66. package/dist/{stock-CUjopFIE.js → stock-VzLu7DTu.js} +3 -3
  67. package/dist/stores/feature.d.ts +0 -2
  68. package/dist/stores/integration/netsuite.d.ts +1 -8
  69. package/dist/stores/inventory.d.ts +30 -119
  70. package/dist/{supplier-BLGyTOqT.js → supplier-xpNYUwPV.js} +2 -2
  71. package/dist/{surcharge-BA-bc8RT.js → surcharge-CjnXVWpE.js} +1 -1
  72. package/dist/tsconfig.app.tsbuildinfo +1 -1
  73. package/dist/{use-ingredient-select-dialog-BDMeEnJC.js → use-ingredient-select-dialog-RroJA5ty.js} +2 -2
  74. package/dist/{use-inventory-binding-dialog-CmAOk0d6.js → use-inventory-binding-dialog-kecoeAsI.js} +2 -2
  75. package/dist/{use-template-enabled-locations-2-DSQY7vNB.js → use-template-enabled-locations-2-BKrIbHc5.js} +2 -2
  76. package/dist/views/closing-draft/components/closing-draft-dialog/ClosingDraftDialog.vue.d.ts +8 -64
  77. package/dist/views/closing-draft/composables/use-closing-draft-table.d.ts +24 -192
  78. package/dist/views/closing-template/components/closing-template-form/composables/use-closing-template-items.d.ts +1 -8
  79. package/dist/views/closing-template/composables/use-closing-template-actions.d.ts +12 -96
  80. package/dist/views/closing-template/composables/use-closing-template-table.d.ts +12 -96
  81. package/dist/views/ingredient-group/composables/use-ingredient-group-table.d.ts +18 -18
  82. package/dist/views/ingredients/components/convert/ConvertForm.vue.d.ts +0 -14
  83. package/dist/views/ingredients/components/ingredient-form/IngredientForm.vue.d.ts +4 -32
  84. package/dist/views/ingredients/components/inventory-binding/InventoryBindingForm.vue.d.ts +0 -28
  85. package/dist/views/ingredients/composables/use-ingredient-table.d.ts +1 -8
  86. package/dist/views/integration/components/netsuite/InventoryTransferIngredientTable.vue.d.ts +2 -16
  87. package/dist/views/receive-request/components/transfer-form/TransferFormWithController.vue.d.ts +5 -33
  88. package/dist/views/receive-request/components/transfer-form/components/ForecastStock.vue.d.ts +2 -16
  89. package/dist/views/receive-request/components/transfer-form/components/TransferItemTable.vue.d.ts +4 -32
  90. package/dist/views/receive-request/components/transfer-form/composables/use-transfer-items.d.ts +1 -8
  91. package/dist/views/receive-request/composables/use-process-purchase-order.d.ts +6 -41
  92. package/dist/views/receive-request/composables/use-receive-request-form.d.ts +36 -246
  93. package/dist/views/receive-request/composables/use-receive-request-table.d.ts +42 -287
  94. package/dist/views/recipe/components/recipe-form/RecipeForm.vue.d.ts +0 -16
  95. package/dist/views/stock/components/dialog/AdjustedItemForm.vue.d.ts +2 -16
  96. package/dist/views/transfer-template/components/transfer-template-dialog/TransferTemplateDialog.vue.d.ts +2 -16
  97. package/dist/views/transfer-template/components/transfer-template-form/components/NetSuiteCustomCodeSelection.vue.d.ts +2 -16
  98. package/dist/views/transfer-template/components/transfer-template-form/components/TransferTemplateItemTable.vue.d.ts +2 -16
  99. package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-template-items.d.ts +1 -8
  100. package/dist/views/transfer-template/composables/use-netsuite-custom-field.d.ts +3 -24
  101. package/dist/views/transfer-template/composables/use-transfer-template-actions.d.ts +12 -96
  102. package/dist/views/transfer-template/composables/use-transfer-template-table.d.ts +12 -96
  103. package/dist/{vue-i18n-CIhYwCeG.js → vue-i18n-DsZSVX8N.js} +328 -328
  104. package/dist/{xlsx-BcQjo8NU.js → xlsx-7KX7f3af.js} +1 -1
  105. package/dist/{xlsx.util-GOcrvAJZ.js → xlsx.util-MseAEQJ5.js} +1 -1
  106. package/package.json +3 -3
  107. package/dist/RecipeView-BW5KCmkx.js +0 -1557
  108. package/dist/views/ingredients/components/inventory-binding/v2/InventoryBindingFormV2.vue.d.ts +0 -169
  109. package/dist/views/ingredients/components/inventory-binding/v2/components/InventoryBindingAlternative.vue.d.ts +0 -43
  110. package/dist/views/ingredients/components/inventory-binding/v2/components/InventoryBindingRule.vue.d.ts +0 -25
  111. package/dist/views/ingredients/components/inventory-binding/v2/components/InventoryRecipeBindingV2Field.vue.d.ts +0 -125
  112. package/dist/views/ingredients/components/inventory-binding/v2/components/InventorySkuBindingV2Field.vue.d.ts +0 -129
  113. package/dist/views/ingredients/components/inventory-binding/v2/composables/use-inventory-binding-alternative-table.d.ts +0 -30
  114. package/dist/views/ingredients/components/inventory-binding/v2/composables/use-inventory-binding-dialog.d.ts +0 -4
@@ -1,29 +1,29 @@
1
- import { defineComponent as me, ref as L, computed as N, resolveComponent as T, openBlock as j, createBlock as q, withCtx as H, createElementVNode as e, normalizeClass as he, toDisplayString as v, createVNode as y, createElementBlock as W, Fragment as le, renderList as ce, unref as a, h as _e, watch as Ae, isRef as Ue, createCommentVNode as se, reactive as ut, mergeModels as Qe, useModel as bt, onMounted as qe, createTextVNode as pe, normalizeStyle as ct, Teleport as xt, normalizeProps as Ne, mergeProps as Ye } from "vue";
1
+ import { defineComponent as me, ref as z, computed as Y, resolveComponent as H, openBlock as D, createBlock as X, withCtx as U, createElementVNode as e, normalizeClass as ge, toDisplayString as p, createVNode as y, createElementBlock as W, Fragment as le, renderList as ce, unref as a, h as ke, watch as $e, isRef as Ee, createCommentVNode as se, reactive as ut, mergeModels as Qe, useModel as bt, onMounted as qe, createTextVNode as ve, normalizeStyle as ct, Teleport as xt, normalizeProps as Le, mergeProps as ze } from "vue";
2
2
  import { F as Xe, u as St, _ as wt } from "./SingleColumnLayout.vue_vue_type_script_setup_true_lang-CWZkVCAj.js";
3
- import { u as be, c as He, a as Ee, F as Ze, w as Ft, G as ae, v as At, o as $t, D as Vt, y as Q, h as Ve, i as et, e as tt, J as ke } from "./app-Do7d9F2j.js";
4
- import { u as Pe } from "./stock-CUjopFIE.js";
3
+ import { u as xe, c as Pe, a as Re, F as Ze, H as Ft, D as ae, v as At, o as $t, B as Vt, w as Q, h as De, i as et, e as tt, I as he } from "./app-DDU7NeKU.js";
4
+ import { u as Oe } from "./stock-VzLu7DTu.js";
5
5
  import { c as Ct } from "./component-DpCUABT3.js";
6
- import { g as $e } from "./decimal-BHD_uD50.js";
7
- import { d as ve } from "./dayjs.min-C2InbamH.js";
8
- import { e as jt, u as dt, i as Me, _ as nt } from "./PremiumBadge.vue_vue_type_script_setup_true_lang-BhOwDBiq.js";
9
- import { _ as We, S as Le, g as mt, a as Dt } from "./SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-JGzokQMQ.js";
6
+ import { g as Ve } from "./decimal-BmI-vHdY.js";
7
+ import { d as ye } from "./dayjs.min-x0l3YFuh.js";
8
+ import { e as Dt, u as dt, i as Ie, _ as nt } from "./PremiumBadge.vue_vue_type_script_setup_true_lang-B6jIGOQk.js";
9
+ import { _ as Ke, S as Ge, g as mt, a as jt } from "./SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-BowCyYAA.js";
10
10
  import { _ as Mt } from "./PreviewBadge.vue_vue_type_script_setup_true_lang-CRZiQHjx.js";
11
11
  import { useI18n as fe, useCoreStore as ft } from "@feedmepos/mf-common";
12
- import { useSnackbar as xe, useDialog as Re, useProxiedModel as Oe, useBreakpoints as Bt } from "@feedmepos/ui-library";
12
+ import { useSnackbar as Se, useDialog as Ne, useProxiedModel as Ye, useBreakpoints as Bt } from "@feedmepos/ui-library";
13
13
  import { defineStore as It } from "pinia";
14
- import { g as Ke, a as ye, i as Tt, t as Be, h as Ie, A as Ut, M as Ht, d as ge, j as Et, k as ot, l as pt, m as Je, R as Pt, e as je, o as Rt } from "./rules-CmGXcEkE.js";
15
- import { u as Se } from "./stock-C1-SWNBT.js";
16
- import { u as Ot } from "./use-inventory-binding-dialog-CmAOk0d6.js";
17
- import { a as vt } from "./FmMultiselectDialog-CswtC1AP.js";
18
- import { _ as Nt } from "./NumberPrecisionInput.vue_vue_type_script_setup_true_lang-sxY8hdeR.js";
19
- import { a as Yt, b as Lt, f as yt, t as st, c as at, p as zt, n as Gt, d as Wt } from "./date2-xmQqiCBU.js";
20
- import { i as Kt, _ as qt } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-D0z-41dr.js";
14
+ import { g as Ce, a as _e, f as Tt, t as Te, h as He, A as Ht, M as Ut, d as be, i as Et, j as ot, k as vt, l as Je, R as Pt, e as Me, m as Rt } from "./rules-CttmEqBJ.js";
15
+ import { u as we } from "./stock-DJB96pzi.js";
16
+ import { u as Ot } from "./use-inventory-binding-dialog-kecoeAsI.js";
17
+ import { a as pt } from "./FmMultiselectDialog-CdBuD2tB.js";
18
+ import { _ as Nt } from "./NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DO47als9.js";
19
+ import { a as Yt, b as Lt, f as yt, t as st, c as at, p as zt, n as Gt, d as Wt } from "./date2-CdIVvJMO.js";
20
+ import { i as Kt, _ as qt } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-uIJ2INOr.js";
21
21
  import { E as Xt } from "./empty-placeholder-wf6-BWE8.js";
22
- import { F as ze, u as Jt } from "./feature-BsP8KV0O.js";
22
+ import { F as pe, u as Jt } from "./feature-CBAV6rwn.js";
23
23
  import { _ as Qt, F as lt } from "./TableActionableRow.vue_vue_type_script_setup_true_lang-Ca_eYa8-.js";
24
- import { u as Zt } from "./netsuite-DpB7HK5Q.js";
24
+ import { u as Zt } from "./netsuite-04rSEWQB.js";
25
25
  import { P as en, J as tn } from "./app-DiX-EfV6.js";
26
- var De = /* @__PURE__ */ ((k) => (k.History = "History", k.Convert = "Convert", k.Adjust = "Adjust", k))(De || {});
26
+ var Be = /* @__PURE__ */ ((k) => (k.History = "History", k.Convert = "Convert", k.Adjust = "Adjust", k))(Be || {});
27
27
  const nn = [
28
28
  {
29
29
  translationKey: "inventory.stock.action.history",
@@ -52,11 +52,11 @@ const nn = [
52
52
  }
53
53
  ];
54
54
  async function sn(k) {
55
- const d = `${(be().currentLocation.name || "").replace(
55
+ const d = `${(xe().currentLocation.name || "").replace(
56
56
  / /g,
57
57
  "_"
58
- )}_${ve().format("DD_MM_YYYY_HHmm")}.xlsx`;
59
- await jt(
58
+ )}_${ye().format("DD_MM_YYYY_HHmm")}.xlsx`;
59
+ await Dt(
60
60
  [
61
61
  {
62
62
  name: "stock",
@@ -73,16 +73,16 @@ async function sn(k) {
73
73
  {
74
74
  name: "Balance",
75
75
  selector: (s) => {
76
- const D = Te(s, s.unit);
77
- return D.type === "unit" ? $e(s.balance, s.unit, null, !1) : $e(s.balance, s.unit, D.measurement, !1);
76
+ const j = Ue(s, s.unit);
77
+ return j.type === "unit" ? Ve(s.balance, s.unit, null, !1) : Ve(s.balance, s.unit, j.measurement, !1);
78
78
  }
79
79
  },
80
80
  {
81
81
  name: "Unit",
82
82
  selector: (s) => {
83
- var F;
84
- const D = Te(s, s.unit);
85
- return D.type === "unit" ? s.unit.abbrev : ((F = s.unit.measurements.find((c) => c.id === D.measurement)) == null ? void 0 : F.abbrev) || "";
83
+ var w;
84
+ const j = Ue(s, s.unit);
85
+ return j.type === "unit" ? s.unit.abbrev : ((w = s.unit.measurements.find((c) => c.id === j.measurement)) == null ? void 0 : w.abbrev) || "";
86
86
  }
87
87
  }
88
88
  ]
@@ -91,7 +91,7 @@ async function sn(k) {
91
91
  d
92
92
  );
93
93
  }
94
- function Te(k, m) {
94
+ function Ue(k, m) {
95
95
  const d = localStorage.getItem(`uom:${k._id}`);
96
96
  return d ? d === m._id ? {
97
97
  type: "unit"
@@ -120,58 +120,58 @@ const an = { class: "fm-typo-en-body-md-400 flex-grow" }, _t = /* @__PURE__ */ m
120
120
  return `uom:${B._id}`;
121
121
  }
122
122
  function d(B) {
123
- const S = m(s.sku);
124
- B ? localStorage.setItem(S, B) : localStorage.setItem(S, s.unit._id), D.value = Te(s.sku, s.unit);
123
+ const b = m(s.sku);
124
+ B ? localStorage.setItem(b, B) : localStorage.setItem(b, s.unit._id), j.value = Ue(s.sku, s.unit);
125
125
  }
126
- const s = k, D = L(Te(s.sku, s.unit)), F = N(() => {
126
+ const s = k, j = z(Ue(s.sku, s.unit)), w = Y(() => {
127
127
  const { measurements: B } = s.unit;
128
128
  return [
129
129
  {
130
- label: `${$e(s.amount, s.unit)}`,
130
+ label: `${Ve(s.amount, s.unit)}`,
131
131
  value: null
132
132
  },
133
- ...B.map(({ id: S }) => ({
134
- label: `${$e(s.amount, s.unit, S)}`,
135
- value: S
133
+ ...B.map(({ id: b }) => ({
134
+ label: `${Ve(s.amount, s.unit, b)}`,
135
+ value: b
136
136
  }))
137
137
  ];
138
138
  });
139
139
  function c({ value: B }) {
140
- return a(D).type === "unit" ? B === null : B === a(D).measurement;
140
+ return a(j).type === "unit" ? B === null : B === a(j).measurement;
141
141
  }
142
- const l = N(
142
+ const l = Y(
143
143
  () => {
144
144
  var B;
145
- return ((B = F.value.find((S) => c(S))) == null ? void 0 : B.label) ?? "";
145
+ return ((B = w.value.find((b) => c(b))) == null ? void 0 : B.label) ?? "";
146
146
  }
147
- ), h = L(!1);
148
- return (B, S) => {
149
- const i = T("FmIcon"), f = T("FmMenuItem"), I = T("FmMenu");
150
- return j(), q(I, {
147
+ ), h = z(!1);
148
+ return (B, b) => {
149
+ const i = H("FmIcon"), f = H("FmMenuItem"), T = H("FmMenu");
150
+ return D(), X(T, {
151
151
  "stop-click-propagation": "",
152
- onMenuChanged: S[0] || (S[0] = (b) => h.value = b)
152
+ onMenuChanged: b[0] || (b[0] = (g) => h.value = g)
153
153
  }, {
154
- "menu-button": H(() => [
154
+ "menu-button": U(() => [
155
155
  e("button", {
156
156
  type: "button",
157
- class: he([
157
+ class: ge([
158
158
  "w-full text-left flex items-center gap-8 cursor-pointer fm-corner-radius-sm px-8 py-4 border bg-white",
159
159
  h.value ? "border-fm-color-primary" : "border-fm-color-neutral-gray-100"
160
160
  ])
161
161
  }, [
162
- e("div", an, v(l.value), 1),
162
+ e("div", an, p(l.value), 1),
163
163
  y(i, {
164
164
  class: "text-fm-color-neutral-gray-400",
165
165
  name: "expand_more"
166
166
  })
167
167
  ], 2)
168
168
  ]),
169
- default: H(() => [
170
- (j(!0), W(le, null, ce(F.value, (b) => (j(), q(f, {
171
- key: b.value ?? 0,
172
- label: b.label,
173
- "model-value": c(b),
174
- onClick: (w) => d(b.value)
169
+ default: U(() => [
170
+ (D(!0), W(le, null, ce(w.value, (g) => (D(), X(f, {
171
+ key: g.value ?? 0,
172
+ label: g.label,
173
+ "model-value": c(g),
174
+ onClick: (x) => d(g.value)
175
175
  }, null, 8, ["label", "model-value", "onClick"]))), 128))
176
176
  ]),
177
177
  _: 1
@@ -182,22 +182,22 @@ const an = { class: "fm-typo-en-body-md-400 flex-grow" }, _t = /* @__PURE__ */ m
182
182
  __name: "StockHeaderPreview",
183
183
  setup(k) {
184
184
  const { t: m } = fe();
185
- return (d, s) => (j(), q(Mt, null, {
186
- default: H(() => [
187
- e("div", ln, v(a(m)("inventory.stock.prediction.daysRemaining")), 1)
185
+ return (d, s) => (D(), X(Mt, null, {
186
+ default: U(() => [
187
+ e("div", ln, p(a(m)("inventory.stock.prediction.daysRemaining")), 1)
188
188
  ]),
189
189
  _: 1
190
190
  }));
191
191
  }
192
192
  }), kt = It("stockActions", () => {
193
- const k = L(!1), m = be(), d = Pe(), s = dt(), D = xe(), F = Re(), { t: c } = fe();
193
+ const k = z(!1), m = xe(), d = Oe(), s = dt(), j = Se(), w = Ne(), { t: c } = fe();
194
194
  async function l() {
195
195
  if (m._currentLocation) {
196
196
  k.value = !0;
197
197
  try {
198
198
  await d.readStockBalance(), await d.readProductBalance(), await s.readStockEstimateBalance();
199
199
  } catch {
200
- D.open({
200
+ j.open({
201
201
  title: c("inventory.stock.error.title"),
202
202
  message: c("inventory.stock.error.message"),
203
203
  type: "error"
@@ -207,80 +207,80 @@ const an = { class: "fm-typo-en-body-md-400 flex-grow" }, _t = /* @__PURE__ */ m
207
207
  }
208
208
  }
209
209
  }
210
- const h = L();
211
- async function B(w) {
212
- var g, x, C;
213
- if (!!!((x = (g = w.convert) == null ? void 0 : g.inventoryBindings) != null && x.length)) {
214
- F.open({
210
+ const h = z();
211
+ async function B(x) {
212
+ var S, C, A;
213
+ if (!!!((C = (S = x.convert) == null ? void 0 : S.inventoryBindings) != null && C.length)) {
214
+ w.open({
215
215
  title: c("inventory.stock.error.convert.title"),
216
216
  message: c("inventory.stock.error.convert.message")
217
217
  });
218
218
  return;
219
219
  }
220
- const o = {
221
- maxCount: ((C = d.productBalance.find(({ id: U }) => U === w._id)) == null ? void 0 : C.count) || 0,
222
- sku: w,
220
+ const n = {
221
+ maxCount: ((A = d.productBalance.find(({ id: I }) => I === x._id)) == null ? void 0 : A.count) || 0,
222
+ sku: x,
223
223
  show: !0,
224
- "onUpdate:show"(U) {
225
- h.value.show = U;
224
+ "onUpdate:show"(I) {
225
+ h.value.show = I;
226
226
  },
227
227
  onSubmitted() {
228
228
  l();
229
229
  }
230
230
  };
231
- h.value = o;
231
+ h.value = n;
232
232
  }
233
- const S = L();
234
- async function i(w) {
235
- const n = {
236
- stock: w,
233
+ const b = z();
234
+ async function i(x) {
235
+ const o = {
236
+ stock: x,
237
237
  show: !0,
238
238
  "onUpdate:show"(t) {
239
- S.value.show = t;
239
+ b.value.show = t;
240
240
  },
241
241
  onSubmitted() {
242
242
  l();
243
243
  }
244
244
  };
245
- S.value = n;
245
+ b.value = o;
246
246
  }
247
- const f = L();
248
- async function I(w) {
249
- const n = {
250
- sku: w,
247
+ const f = z();
248
+ async function T(x) {
249
+ const o = {
250
+ sku: x,
251
251
  show: !0,
252
252
  "onUpdate:show"(t) {
253
253
  f.value.show = t;
254
254
  }
255
255
  };
256
- f.value = n;
256
+ f.value = o;
257
257
  }
258
- function b(w, n) {
259
- const t = He(n);
260
- switch (w) {
261
- case De.History:
262
- I(t);
258
+ function g(x, o) {
259
+ const t = Pe(o);
260
+ switch (x) {
261
+ case Be.History:
262
+ T(t);
263
263
  return;
264
- case De.Convert:
264
+ case Be.Convert:
265
265
  B(t);
266
266
  return;
267
- case De.Adjust:
267
+ case Be.Adjust:
268
268
  i(t);
269
269
  return;
270
270
  }
271
271
  }
272
272
  return {
273
273
  fetchStockBalance: l,
274
- onActionMenu: b,
274
+ onActionMenu: g,
275
275
  stockHistoryProps: f,
276
- showSkuHistory: I,
276
+ showSkuHistory: T,
277
277
  convertSkuDialogProps: h,
278
- adjustSkuDialogProps: S
278
+ adjustSkuDialogProps: b
279
279
  };
280
280
  });
281
281
  function un() {
282
- var F;
283
- const k = be(), m = kt(), d = ft(), { t: s } = fe();
282
+ var w;
283
+ const k = xe(), m = kt(), d = ft(), { t: s } = fe();
284
284
  return {
285
285
  columnDefs: [
286
286
  {
@@ -305,17 +305,17 @@ function un() {
305
305
  amount: l.balance,
306
306
  defaultTrackingMeasurement: l.trackingMeasurement ?? void 0
307
307
  };
308
- return _e(_t, h);
308
+ return ke(_t, h);
309
309
  },
310
310
  size: 180
311
311
  },
312
- ...(F = d.sessionUser.value) != null && F.role.isAdmin ? [
312
+ ...(w = d.sessionUser.value) != null && w.role.isAdmin ? [
313
313
  {
314
314
  accessorKey: "isInactive",
315
- header: () => _e(Xe, {}, () => `${s("inventory.ingredient.status.title")}`),
315
+ header: () => ke(Xe, {}, () => `${s("inventory.ingredient.status.title")}`),
316
316
  cell(c) {
317
317
  const l = c.row.original.isInactive;
318
- return _e(
318
+ return ke(
319
319
  "span",
320
320
  {
321
321
  class: [
@@ -332,20 +332,20 @@ function un() {
332
332
  {
333
333
  accessorKey: "day",
334
334
  id: "expireDate",
335
- header: () => _e(rn),
335
+ header: () => ke(rn),
336
336
  enableSorting: !0,
337
337
  sortUndefined: "last",
338
338
  cell(c) {
339
- var f, I;
340
- const l = c.row.original.day, h = (f = c.row.original.thresholds) == null ? void 0 : f.low, B = (I = c.row.original.thresholds) == null ? void 0 : I.mid;
339
+ var f, T;
340
+ const l = c.row.original.day, h = (f = c.row.original.thresholds) == null ? void 0 : f.low, B = (T = c.row.original.thresholds) == null ? void 0 : T.mid;
341
341
  if (typeof l != "number" || typeof h != "number" || typeof B != "number")
342
- return _e(We, {
342
+ return ke(Ke, {
343
343
  days: l
344
344
  });
345
- const S = l <= h ? Le.low : l <= B ? Le.mid : Le.high;
346
- return _e(We, {
345
+ const b = l <= h ? Ge.low : l <= B ? Ge.mid : Ge.high;
346
+ return ke(Ke, {
347
347
  days: l,
348
- level: S
348
+ level: b
349
349
  });
350
350
  },
351
351
  size: 200
@@ -406,7 +406,7 @@ const cn = {
406
406
  function rt(k) {
407
407
  return { ...cn, context: k };
408
408
  }
409
- const dn = { class: "flex items-center" }, mn = { class: "fm-typo-en-title-md-800" }, fn = { class: "flex flex-col gap-24 w-full" }, pn = { class: "flex flex-col gap-8" }, vn = { class: "fm-typo-en-body-lg-600" }, yn = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary flex-grow" }, _n = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-error" }, kn = { class: "flex flex-col p-16 gap-8" }, hn = { class: "flex flex-col gap-4" }, gn = { class: "fm-typo-en-body-md-600 text-fm-color-typo-secondary bg-fm-color-neutral-gray-100 border-b py-12 px-16" }, bn = { class: "grid grid-cols-[auto_100px_100px_48px] xs:grid-cols-[auto_80px_120px_48px] gap-8 px-8 items-center" }, xn = { class: "xs:col-span-3" }, Sn = { class: "flex gap-8" }, wn = /* @__PURE__ */ me({
409
+ const dn = { class: "flex items-center" }, mn = { class: "fm-typo-en-title-md-800" }, fn = { class: "flex flex-col gap-24 w-full" }, vn = { class: "flex flex-col gap-8" }, pn = { class: "fm-typo-en-body-lg-600" }, yn = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary flex-grow" }, _n = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-error" }, kn = { class: "flex flex-col p-16 gap-8" }, hn = { class: "flex flex-col gap-4" }, gn = { class: "fm-typo-en-body-md-600 text-fm-color-typo-secondary bg-fm-color-neutral-gray-100 border-b py-12 px-16" }, bn = { class: "grid grid-cols-[auto_100px_100px_48px] xs:grid-cols-[auto_80px_120px_48px] gap-8 px-8 items-center" }, xn = { class: "xs:col-span-3" }, Sn = { class: "flex gap-8" }, wn = /* @__PURE__ */ me({
410
410
  __name: "ConvertSkuDialog",
411
411
  props: {
412
412
  sku: {},
@@ -415,98 +415,98 @@ const dn = { class: "flex items-center" }, mn = { class: "fm-typo-en-title-md-80
415
415
  },
416
416
  emits: ["update:show", "submitted"],
417
417
  setup(k, { expose: m, emit: d }) {
418
- const s = k, D = d, F = Ot(), c = Ee(), l = Se(), h = xe(), { t: B } = fe(), S = L(0), i = L(null), f = N(() => c.skus), I = N(
418
+ const s = k, j = d, w = Ot(), c = Re(), l = we(), h = Se(), { t: B } = fe(), b = z(0), i = z(null), f = Y(() => c.skus), T = Y(
419
419
  () => {
420
- var p, $;
421
- return ((($ = (p = s.sku) == null ? void 0 : p.convert) == null ? void 0 : $.inventoryBindings) ?? []).filter(
420
+ var v, $;
421
+ return ((($ = (v = s.sku) == null ? void 0 : v.convert) == null ? void 0 : $.inventoryBindings) ?? []).filter(
422
422
  (G) => G.type === Ze.enum.SKU
423
423
  );
424
424
  }
425
- ), b = N({
425
+ ), g = Y({
426
426
  get() {
427
427
  return !!i.value;
428
428
  },
429
- set(p) {
430
- p ? i.value = He(I.value) : (i.value = null, S.value = Math.min(S.value, s.maxCount ?? 0));
429
+ set(v) {
430
+ v ? i.value = Pe(T.value) : (i.value = null, b.value = Math.min(b.value, s.maxCount ?? 0));
431
431
  }
432
- }), w = L(!1);
433
- Ae([() => s.show], ([p]) => {
434
- p && (S.value = 0);
432
+ }), x = z(!1);
433
+ $e([() => s.show], ([v]) => {
434
+ v && (b.value = 0);
435
435
  });
436
- function n() {
437
- O(s.sku, Be(S.value), i.value);
436
+ function o() {
437
+ R(s.sku, Te(b.value), i.value);
438
438
  }
439
- function t(p) {
439
+ function t(v) {
440
440
  if (i.value)
441
441
  return !0;
442
- const $ = rt(p).isInteger().max(s.maxCount ?? 0).error ?? "";
442
+ const $ = rt(v).isInteger().max(s.maxCount ?? 0).error ?? "";
443
443
  return $ || !0;
444
444
  }
445
- function o(p) {
445
+ function n(v) {
446
446
  var E;
447
447
  const $ = (E = s.sku.convert) != null && E.measurement ? s.sku.unit.measurements.find((_) => {
448
448
  var r;
449
449
  return _.id === ((r = s.sku.convert) == null ? void 0 : r.measurement);
450
- }) ?? null : null, G = Ke(s.sku.unit, $), P = Et(+p);
450
+ }) ?? null : null, G = Ce(s.sku.unit, $), P = Et(+v);
451
451
  return rt(P).isInteger().max(G).error ? "Precision cannot be more than " + G : !0;
452
452
  }
453
- const g = N(
453
+ const S = Y(
454
454
  () => {
455
- var p, $;
456
- return (p = s.sku.convert) != null && p.measurement ? ($ = s.sku.unit.measurements.find((G) => {
455
+ var v, $;
456
+ return (v = s.sku.convert) != null && v.measurement ? ($ = s.sku.unit.measurements.find((G) => {
457
457
  var P;
458
458
  return G.id === ((P = s.sku.convert) == null ? void 0 : P.measurement);
459
459
  })) == null ? void 0 : $.abbrev : s.sku.unit.abbrev;
460
460
  }
461
- ), x = N(() => {
462
- var P, Y;
461
+ ), C = Y(() => {
462
+ var P, L;
463
463
  const $ = Ft({
464
464
  bindings: ((P = s.sku.convert) == null ? void 0 : P.inventoryBindings) ?? [],
465
465
  skus: c.skus,
466
466
  skuGroups: c.skuGroups,
467
467
  recipes: c.recipes
468
468
  }).inventoryBindings.filter((E) => "success" in E && E.success).map((E) => E).map((E) => E.binding);
469
- return (Y = i.value ?? $) == null ? void 0 : Y.map((E) => {
469
+ return (L = i.value ?? $) == null ? void 0 : L.map((E) => {
470
470
  var ne, re, J, te, oe;
471
471
  const _ = c.skus.find((ie) => ie._id === E.id), r = ((ne = E.measurement) == null ? void 0 : ne.abbrev) ?? ((re = _ == null ? void 0 : _.unit) == null ? void 0 : re.abbrev), M = (J = s.sku.convert) != null && J.measurement ? s.sku.unit.measurements.find((ie) => {
472
- var we;
473
- return ie.id === ((we = s.sku.convert) == null ? void 0 : we.measurement);
474
- }) ?? null : null, V = Ke(s.sku.unit, M), u = o(`${S.value}`) === !0 ? ye(
472
+ var Fe;
473
+ return ie.id === ((Fe = s.sku.convert) == null ? void 0 : Fe.measurement);
474
+ }) ?? null : null, V = Ce(s.sku.unit, M), u = n(`${b.value}`) === !0 ? _e(
475
475
  Tt(
476
476
  E.amount,
477
- Be(+S.value, V)
477
+ Te(+b.value, V)
478
478
  ),
479
479
  !1
480
- ) : "0", A = (oe = (te = i.value) == null ? void 0 : te.find((ie) => ie.id === (_ == null ? void 0 : _._id))) == null ? void 0 : oe.amount, R = A ? ye(A, !1) : null;
480
+ ) : "0", F = (oe = (te = i.value) == null ? void 0 : te.find((ie) => ie.id === (_ == null ? void 0 : _._id))) == null ? void 0 : oe.amount, N = F ? _e(F, !1) : null;
481
481
  return {
482
482
  sku: _,
483
- convertAmount: R ?? u,
483
+ convertAmount: N ?? u,
484
484
  abbrev: r
485
485
  };
486
486
  });
487
- }), C = L();
487
+ }), A = z();
488
488
  m({
489
489
  validateInputs: () => {
490
- var p, $;
491
- ($ = (p = C.value) == null ? void 0 : p.validateInputs) == null || $.call(p);
490
+ var v, $;
491
+ ($ = (v = A.value) == null ? void 0 : v.validateInputs) == null || $.call(v);
492
492
  },
493
493
  resetInputsValidation: () => {
494
- var p, $;
495
- ($ = (p = C.value) == null ? void 0 : p.resetInputsValidation) == null || $.call(p);
494
+ var v, $;
495
+ ($ = (v = A.value) == null ? void 0 : v.resetInputsValidation) == null || $.call(v);
496
496
  },
497
497
  resetInputs: () => {
498
- var p, $;
499
- ($ = (p = C.value) == null ? void 0 : p.resetInputs) == null || $.call(p);
498
+ var v, $;
499
+ ($ = (v = A.value) == null ? void 0 : v.resetInputs) == null || $.call(v);
500
500
  }
501
501
  });
502
- const U = Oe(s, "show");
503
- async function O(p, $, G) {
504
- w.value = !0;
502
+ const I = Ye(s, "show");
503
+ async function R(v, $, G) {
504
+ x.value = !0;
505
505
  try {
506
506
  await l.convertSku({
507
507
  conversions: [
508
508
  {
509
- doc: p,
509
+ doc: v,
510
510
  amount: $,
511
511
  overrides: G == null ? void 0 : G.map((P) => ({
512
512
  ...P,
@@ -518,176 +518,176 @@ const dn = { class: "flex items-center" }, mn = { class: "fm-typo-en-title-md-80
518
518
  }))
519
519
  }
520
520
  ]
521
- }), D("update:show", !1), D("submitted");
521
+ }), j("update:show", !1), j("submitted");
522
522
  } catch (P) {
523
523
  h.open({
524
524
  title: "Something went wrong",
525
- message: `Cannot convert ${p.name}. Please try again.`,
525
+ message: `Cannot convert ${v.name}. Please try again.`,
526
526
  type: "error"
527
- }), console.error("error at converting stock amount", p, $, P);
527
+ }), console.error("error at converting stock amount", v, $, P);
528
528
  } finally {
529
- w.value = !1;
529
+ x.value = !1;
530
530
  }
531
531
  }
532
- function X(p, $, G) {
532
+ function K(v, $, G) {
533
533
  const P = +$;
534
- let Y = G;
535
- $.length > 0 && isFinite(P) ? Y = G.map((E) => (E.id !== p || (E.amount = ge(P)), E)) : Y = G.map((E) => (E.id !== p || (E.amount = { amount: 0, precision: 0 }), E)), i.value = Y;
534
+ let L = G;
535
+ $.length > 0 && isFinite(P) ? L = G.map((E) => (E.id !== v || (E.amount = be(P)), E)) : L = G.map((E) => (E.id !== v || (E.amount = { amount: 0, precision: 0 }), E)), i.value = L;
536
536
  }
537
- function z(p) {
538
- const $ = f.value.find((G) => G._id === p);
537
+ function O(v) {
538
+ const $ = f.value.find((G) => G._id === v);
539
539
  return $ ? mt($.unit, !0) : [];
540
540
  }
541
- function Z(p, $) {
542
- const G = z(p), P = G.find((Y) => Y.value === $) ?? G.find((Y) => Y.value === null);
541
+ function Z(v, $) {
542
+ const G = O(v), P = G.find((L) => L.value === $) ?? G.find((L) => L.value === null);
543
543
  return P ? {
544
544
  ...P,
545
545
  label: P.abbrev
546
546
  } : null;
547
547
  }
548
- function K(p, $, G) {
548
+ function q(v, $, G) {
549
549
  let P;
550
550
  if ($ === null)
551
- P = G.map((Y) => (Y.id !== p || (Y.measurement = null), Y)) ?? [];
551
+ P = G.map((L) => (L.id !== v || (L.measurement = null), L)) ?? [];
552
552
  else {
553
- const Y = f.value.find((E) => E._id === p);
553
+ const L = f.value.find((E) => E._id === v);
554
554
  P = G.map((E) => {
555
555
  var _, r;
556
- return E.id !== p || (E.measurement = (r = (_ = Y == null ? void 0 : Y.unit) == null ? void 0 : _.measurements) == null ? void 0 : r.find((M) => M.id === $)), E;
556
+ return E.id !== v || (E.measurement = (r = (_ = L == null ? void 0 : L.unit) == null ? void 0 : _.measurements) == null ? void 0 : r.find((M) => M.id === $)), E;
557
557
  }) ?? [];
558
558
  }
559
559
  i.value = P;
560
560
  }
561
- function ue(p, $) {
562
- const G = $.filter((P) => P.id !== p);
561
+ function ue(v, $) {
562
+ const G = $.filter((P) => P.id !== v);
563
563
  i.value = G;
564
564
  }
565
565
  function ee() {
566
- const p = (i.value ?? []).map(($) => ({
566
+ const v = (i.value ?? []).map(($) => ({
567
567
  ...$,
568
568
  type: Ze.enum.SKU
569
569
  }));
570
- F.promptIngredientsBinding(
571
- p,
570
+ w.promptIngredientsBinding(
571
+ v,
572
572
  ($) => i.value = $,
573
573
  s.sku._id
574
574
  );
575
575
  }
576
- return Ae(
576
+ return $e(
577
577
  () => s.show,
578
- (p) => {
579
- p || (i.value = null, S.value = 0);
578
+ (v) => {
579
+ v || (i.value = null, b.value = 0);
580
580
  }
581
- ), (p, $) => {
582
- const G = T("FmTextField"), P = T("FmForm"), Y = T("FmCard"), E = T("FmSwitch"), _ = T("FmFormGroup"), r = T("FmSelect"), M = T("FmButton"), V = T("FmSideSheet");
583
- return j(), q(V, {
581
+ ), (v, $) => {
582
+ const G = H("FmTextField"), P = H("FmForm"), L = H("FmCard"), E = H("FmSwitch"), _ = H("FmFormGroup"), r = H("FmSelect"), M = H("FmButton"), V = H("FmSideSheet");
583
+ return D(), X(V, {
584
584
  "dismiss-away": "",
585
- modelValue: a(U),
586
- "onUpdate:modelValue": $[3] || ($[3] = (u) => Ue(U) ? U.value = u : null),
585
+ modelValue: a(I),
586
+ "onUpdate:modelValue": $[3] || ($[3] = (u) => Ee(I) ? I.value = u : null),
587
587
  "max-width": 500
588
588
  }, {
589
- "side-sheet-header": H(() => [
589
+ "side-sheet-header": U(() => [
590
590
  e("div", dn, [
591
- e("div", mn, v(a(B)("inventory.stock.convert.title", { name: p.sku.name })), 1)
591
+ e("div", mn, p(a(B)("inventory.stock.convert.title", { name: v.sku.name })), 1)
592
592
  ])
593
593
  ]),
594
- default: H(() => [
594
+ default: U(() => [
595
595
  e("div", fn, [
596
596
  y(P, {
597
597
  ref_key: "formRef",
598
- ref: C,
599
- onValidationSuccess: n
598
+ ref: A,
599
+ onValidationSuccess: o
600
600
  }, {
601
- default: H(() => [
601
+ default: U(() => [
602
602
  y(G, {
603
- disabled: w.value,
604
- "model-value": S.value,
605
- "onUpdate:modelValue": $[0] || ($[0] = (u) => S.value = u),
603
+ disabled: x.value,
604
+ "model-value": b.value,
605
+ "onUpdate:modelValue": $[0] || ($[0] = (u) => b.value = u),
606
606
  label: a(B)("inventory.stock.convert.amount"),
607
- rules: [t, o, a(Ie)(0)],
608
- "append-text": g.value,
609
- "helper-text": i.value ? void 0 : `Max ${p.maxCount} ${g.value}`
607
+ rules: [t, n, a(He)(0)],
608
+ "append-text": S.value,
609
+ "helper-text": i.value ? void 0 : `Max ${v.maxCount} ${S.value}`
610
610
  }, null, 8, ["disabled", "model-value", "label", "rules", "append-text", "helper-text"])
611
611
  ]),
612
612
  _: 1
613
613
  }, 512),
614
- y(Y, {
614
+ y(L, {
615
615
  variant: "outlined",
616
616
  class: "p-16"
617
617
  }, {
618
- default: H(() => [
619
- e("div", pn, [
620
- e("div", vn, v(a(B)("inventory.stock.convert.deductionSummary")), 1),
621
- (j(!0), W(le, null, ce(x.value, (u) => {
622
- var A, R;
623
- return j(), W("div", {
624
- key: (A = u.sku) == null ? void 0 : A._id,
618
+ default: U(() => [
619
+ e("div", vn, [
620
+ e("div", pn, p(a(B)("inventory.stock.convert.deductionSummary")), 1),
621
+ (D(!0), W(le, null, ce(C.value, (u) => {
622
+ var F, N;
623
+ return D(), W("div", {
624
+ key: (F = u.sku) == null ? void 0 : F._id,
625
625
  class: "flex items-center"
626
626
  }, [
627
- e("div", yn, v((R = u.sku) == null ? void 0 : R.name), 1),
628
- e("div", _n, " -" + v(u.convertAmount) + " " + v(u.abbrev), 1)
627
+ e("div", yn, p((N = u.sku) == null ? void 0 : N.name), 1),
628
+ e("div", _n, " -" + p(u.convertAmount) + " " + p(u.abbrev), 1)
629
629
  ]);
630
630
  }), 128))
631
631
  ])
632
632
  ]),
633
633
  _: 1
634
634
  }),
635
- y(Y, { variant: "outlined" }, {
636
- default: H(() => [
635
+ y(L, { variant: "outlined" }, {
636
+ default: U(() => [
637
637
  e("div", kn, [
638
638
  y(E, {
639
639
  value: "",
640
- modelValue: b.value,
641
- "onUpdate:modelValue": $[1] || ($[1] = (u) => b.value = u),
640
+ modelValue: g.value,
641
+ "onUpdate:modelValue": $[1] || ($[1] = (u) => g.value = u),
642
642
  label: a(B)("inventory.stock.convert.overrideDeduction"),
643
643
  "label-placement": "right"
644
644
  }, null, 8, ["modelValue", "label"]),
645
- b.value ? (j(), W(le, { key: 0 }, [
645
+ g.value ? (D(), W(le, { key: 0 }, [
646
646
  y(_, {
647
647
  modelValue: i.value,
648
- rules: [a(Ut)(1, "Must have at least one ingredient binding")]
648
+ rules: [a(Ht)(1, "Must have at least one ingredient binding")]
649
649
  }, null, 8, ["modelValue", "rules"]),
650
650
  e("div", hn, [
651
- e("div", gn, v(a(B)("inventory.stock.convert.ingredients")), 1),
652
- (j(!0), W(le, null, ce(i.value, (u) => (j(), q(_, {
651
+ e("div", gn, p(a(B)("inventory.stock.convert.ingredients")), 1),
652
+ (D(!0), W(le, null, ce(i.value, (u) => (D(), X(_, {
653
653
  key: u.id,
654
- disabled: w.value,
655
- modelValue: +a(ye)(u.amount ?? { amount: 1, precision: 0 }),
654
+ disabled: x.value,
655
+ modelValue: +a(_e)(u.amount ?? { amount: 1, precision: 0 }),
656
656
  rules: [
657
- a(Ht)(
658
- f.value.find((A) => A._id === u.id).unit,
657
+ a(Ut)(
658
+ f.value.find((F) => F._id === u.id).unit,
659
659
  u.measurement
660
660
  ),
661
- a(Ie)(0)
661
+ a(He)(0)
662
662
  ]
663
663
  }, {
664
- default: H(({ invalid: A }) => {
665
- var R, ne, re;
664
+ default: U(({ invalid: F }) => {
665
+ var N, ne, re;
666
666
  return [
667
667
  e("div", bn, [
668
- e("div", xn, v((R = f.value.find((J) => J._id === u.id)) == null ? void 0 : R.name), 1),
668
+ e("div", xn, p((N = f.value.find((J) => J._id === u.id)) == null ? void 0 : N.name), 1),
669
669
  y(G, {
670
670
  class: "xs:col-span-2",
671
- disabled: w.value,
672
- modelValue: +a(ye)(
671
+ disabled: x.value,
672
+ modelValue: +a(_e)(
673
673
  u.amount ?? { amount: 1, precision: 0 }
674
674
  ),
675
- "onUpdate:modelValue": (J) => X(u.id, J, i.value ?? []),
676
- invalid: A
675
+ "onUpdate:modelValue": (J) => K(u.id, J, i.value ?? []),
676
+ invalid: F
677
677
  }, null, 8, ["disabled", "modelValue", "onUpdate:modelValue", "invalid"]),
678
678
  y(r, {
679
- disabled: w.value,
679
+ disabled: x.value,
680
680
  class: "translate-y-[2px]",
681
- items: z(u.id),
681
+ items: O(u.id),
682
682
  "model-value": (re = Z(u.id, (ne = u.measurement) == null ? void 0 : ne.id)) == null ? void 0 : re.value,
683
- "onUpdate:modelValue": (J) => K(u.id, J, i.value ?? []),
684
- invalid: A
683
+ "onUpdate:modelValue": (J) => q(u.id, J, i.value ?? []),
684
+ invalid: F
685
685
  }, {
686
- "helper-text": H(() => $[4] || ($[4] = [])),
686
+ "helper-text": U(() => $[4] || ($[4] = [])),
687
687
  _: 2
688
688
  }, 1032, ["disabled", "items", "model-value", "onUpdate:modelValue", "invalid"]),
689
689
  y(M, {
690
- disabled: w.value,
690
+ disabled: x.value,
691
691
  type: "button",
692
692
  variant: "tertiary",
693
693
  icon: "delete",
@@ -714,14 +714,14 @@ const dn = { class: "flex items-center" }, mn = { class: "fm-typo-en-title-md-80
714
714
  })
715
715
  ])
716
716
  ]),
717
- "side-sheet-footer": H(() => [
717
+ "side-sheet-footer": U(() => [
718
718
  e("div", Sn, [
719
719
  y(M, {
720
- loading: w.value,
720
+ loading: x.value,
721
721
  label: a(B)("inventory.stock.convert.convertButton"),
722
722
  onClick: $[2] || ($[2] = (u) => {
723
- var A, R;
724
- return (R = (A = C.value) == null ? void 0 : A.validateInputs) == null ? void 0 : R.call(A);
723
+ var F, N;
724
+ return (N = (F = A.value) == null ? void 0 : F.validateInputs) == null ? void 0 : N.call(F);
725
725
  })
726
726
  }, null, 8, ["loading", "label"])
727
727
  ])
@@ -731,29 +731,29 @@ const dn = { class: "flex items-center" }, mn = { class: "fm-typo-en-title-md-80
731
731
  };
732
732
  }
733
733
  });
734
- function Ce(k, m) {
735
- const d = Be(k, m);
734
+ function je(k, m) {
735
+ const d = Te(k, m);
736
736
  return { ...d, amount: -d.amount };
737
737
  }
738
738
  function it(k, m) {
739
- return Be(Math.abs(k), m);
739
+ return Te(Math.abs(k), m);
740
740
  }
741
- const Ge = {
741
+ const We = {
742
742
  [ae.enum.DAMAGE]: {
743
743
  label: "Damage",
744
- toAdjustmentAmount: Ce
744
+ toAdjustmentAmount: je
745
745
  },
746
746
  [ae.enum.WASTAGE]: {
747
747
  label: "Wastage",
748
- toAdjustmentAmount: Ce
748
+ toAdjustmentAmount: je
749
749
  },
750
750
  [ae.enum.THEFT]: {
751
751
  label: "Theft",
752
- toAdjustmentAmount: Ce
752
+ toAdjustmentAmount: je
753
753
  },
754
754
  [ae.enum.LOSE]: {
755
755
  label: "Lose",
756
- toAdjustmentAmount: Ce
756
+ toAdjustmentAmount: je
757
757
  },
758
758
  [ae.enum.EXTRA]: {
759
759
  label: "Extra",
@@ -763,7 +763,7 @@ const Ge = {
763
763
  label: "Purchase",
764
764
  toAdjustmentAmount: it
765
765
  }
766
- }, Fn = { class: "col-span-2 flex" }, An = { class: "flex-1" }, $n = { class: "fm-typo-en-body-lg-600" }, Vn = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Cn = { class: "col-span-2 flex flex-col gap-4" }, jn = { class: "flex gap-4 text-fm-color-typo-primary fm-typo-en-body-lg-600" }, ht = /* @__PURE__ */ me({
766
+ }, Fn = { class: "col-span-2 flex" }, An = { class: "flex-1" }, $n = { class: "fm-typo-en-body-lg-600" }, Vn = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Cn = { class: "col-span-2 flex flex-col gap-4" }, Dn = { class: "flex gap-4 text-fm-color-typo-primary fm-typo-en-body-lg-600" }, ht = /* @__PURE__ */ me({
767
767
  __name: "AdjustedItemForm",
768
768
  props: {
769
769
  modelValue: {},
@@ -771,140 +771,140 @@ const Ge = {
771
771
  },
772
772
  emits: ["update:modelValue", "click:delete"],
773
773
  setup(k, { emit: m }) {
774
- const d = k, s = m, { t: D } = fe(), F = Pe(), c = N(
775
- () => Object.keys(Ge).map((t) => ({
774
+ const d = k, s = m, { t: j } = fe(), w = Oe(), c = Y(
775
+ () => Object.keys(We).map((t) => ({
776
776
  label: At(t),
777
777
  value: t
778
778
  }))
779
- ), l = N(() => mt(d.modelValue.doc.unit, !0)), h = N({
779
+ ), l = Y(() => mt(d.modelValue.doc.unit, !0)), h = Y({
780
780
  get() {
781
781
  return d.modelValue.type ?? ae.enum.PURCHASE;
782
782
  },
783
783
  set(t) {
784
- const o = {
784
+ const n = {
785
785
  ...d.modelValue
786
786
  };
787
- o.type = t;
788
- const g = ot(d.modelValue.amount);
789
- o.amount = Ge[o.type].toAdjustmentAmount(
790
- +ye(g),
791
- g.precision
792
- ), s("update:modelValue", o);
787
+ n.type = t;
788
+ const S = ot(d.modelValue.amount);
789
+ n.amount = We[n.type].toAdjustmentAmount(
790
+ +_e(S),
791
+ S.precision
792
+ ), s("update:modelValue", n);
793
793
  }
794
- }), B = N({
794
+ }), B = Y({
795
795
  get() {
796
796
  const t = ot(d.modelValue.amount);
797
- return +ye(t);
797
+ return +_e(t);
798
798
  },
799
799
  set(t) {
800
- const o = {
800
+ const n = {
801
801
  ...d.modelValue
802
- }, g = ge(t);
803
- o.amount = Ge[h.value].toAdjustmentAmount(
802
+ }, S = be(t);
803
+ n.amount = We[h.value].toAdjustmentAmount(
804
804
  t,
805
- g.precision
806
- ), s("update:modelValue", o);
805
+ S.precision
806
+ ), s("update:modelValue", n);
807
807
  }
808
- }), S = N({
808
+ }), b = Y({
809
809
  get() {
810
810
  var t;
811
811
  return ((t = d.modelValue.measurement) == null ? void 0 : t.id) ?? null;
812
812
  },
813
813
  set(t) {
814
- var g, x;
815
- const o = {
814
+ var S, C;
815
+ const n = {
816
816
  ...d.modelValue
817
817
  };
818
- o.measurement = ((x = (g = d.modelValue.doc.unit) == null ? void 0 : g.measurements) == null ? void 0 : x.find((C) => C.id === t)) ?? null, s("update:modelValue", o);
818
+ n.measurement = ((C = (S = d.modelValue.doc.unit) == null ? void 0 : S.measurements) == null ? void 0 : C.find((A) => A.id === t)) ?? null, s("update:modelValue", n);
819
819
  }
820
- }), i = N({
820
+ }), i = Y({
821
821
  get() {
822
822
  return d.modelValue.remark ?? "";
823
823
  },
824
824
  set(t) {
825
- const o = {
825
+ const n = {
826
826
  ...d.modelValue
827
827
  };
828
- o.remark = t, s("update:modelValue", o);
828
+ n.remark = t, s("update:modelValue", n);
829
829
  }
830
- }), f = N(() => {
831
- var o;
832
- const t = (o = F.stockBalance.skus) == null ? void 0 : o.find((g) => g.id === d.modelValue.doc._id);
830
+ }), f = Y(() => {
831
+ var n;
832
+ const t = (n = w.stockBalance.skus) == null ? void 0 : n.find((S) => S.id === d.modelValue.doc._id);
833
833
  return (t == null ? void 0 : t.balance) ?? { amount: 0, precision: 0 };
834
- }), I = N(() => {
835
- const t = d.modelValue.amount, o = d.modelValue.measurement;
836
- return o ? pt(t, o.conversion) : t;
837
- }), b = N(
838
- () => Je(f.value, I.value)
839
- ), w = N(
840
- () => $e(b.value, d.modelValue.doc.unit)
841
- ), n = N(() => I.value.amount < 0);
842
- return (t, o) => {
843
- const g = T("FmButton"), x = T("FmSelect"), C = T("FmTextarea"), U = T("FmCard");
844
- return j(), q(U, {
834
+ }), T = Y(() => {
835
+ const t = d.modelValue.amount, n = d.modelValue.measurement;
836
+ return n ? vt(t, n.conversion) : t;
837
+ }), g = Y(
838
+ () => Je(f.value, T.value)
839
+ ), x = Y(
840
+ () => Ve(g.value, d.modelValue.doc.unit)
841
+ ), o = Y(() => T.value.amount < 0);
842
+ return (t, n) => {
843
+ const S = H("FmButton"), C = H("FmSelect"), A = H("FmTextarea"), I = H("FmCard");
844
+ return D(), X(I, {
845
845
  variant: "outlined",
846
846
  class: "grid grid-cols-2 gap-8 p-16"
847
847
  }, {
848
- default: H(() => [
848
+ default: U(() => [
849
849
  e("div", Fn, [
850
850
  e("div", An, [
851
- e("div", $n, v(t.modelValue.doc.name), 1),
852
- e("div", Vn, v(t.modelValue.doc.code), 1)
851
+ e("div", $n, p(t.modelValue.doc.name), 1),
852
+ e("div", Vn, p(t.modelValue.doc.code), 1)
853
853
  ]),
854
- y(g, {
854
+ y(S, {
855
855
  variant: "tertiary",
856
856
  "prepend-icon": "delete",
857
- onClick: o[0] || (o[0] = (O) => s("click:delete"))
857
+ onClick: n[0] || (n[0] = (R) => s("click:delete"))
858
858
  })
859
859
  ]),
860
- y(x, {
860
+ y(C, {
861
861
  disabled: t.disabled,
862
862
  class: "col-span-2",
863
863
  label: "Type",
864
864
  items: c.value,
865
865
  modelValue: h.value,
866
- "onUpdate:modelValue": o[1] || (o[1] = (O) => h.value = O),
866
+ "onUpdate:modelValue": n[1] || (n[1] = (R) => h.value = R),
867
867
  rules: [a(Pt)()],
868
868
  "label-mark": "required"
869
869
  }, null, 8, ["disabled", "items", "modelValue", "rules"]),
870
870
  y(Nt, {
871
871
  disabled: t.disabled,
872
872
  label: "Amount",
873
- step: +a(ye)({
873
+ step: +a(_e)({
874
874
  amount: 1,
875
- precision: a(Ke)(t.modelValue.doc.unit, t.modelValue.measurement)
875
+ precision: a(Ce)(t.modelValue.doc.unit, t.modelValue.measurement)
876
876
  }),
877
877
  modelValue: B.value,
878
- "onUpdate:modelValue": o[2] || (o[2] = (O) => B.value = O),
879
- rules: [a(Ie)(0)]
878
+ "onUpdate:modelValue": n[2] || (n[2] = (R) => B.value = R),
879
+ rules: [a(He)(0)]
880
880
  }, null, 8, ["disabled", "step", "modelValue", "rules"]),
881
- y(x, {
881
+ y(C, {
882
882
  disabled: t.disabled,
883
883
  label: "Unit",
884
884
  items: l.value,
885
- modelValue: S.value,
886
- "onUpdate:modelValue": o[3] || (o[3] = (O) => S.value = O)
885
+ modelValue: b.value,
886
+ "onUpdate:modelValue": n[3] || (n[3] = (R) => b.value = R)
887
887
  }, null, 8, ["disabled", "items", "modelValue"]),
888
- y(C, {
888
+ y(A, {
889
889
  class: "col-span-2",
890
890
  disabled: t.disabled,
891
891
  label: "Remark",
892
892
  modelValue: i.value,
893
- "onUpdate:modelValue": o[4] || (o[4] = (O) => i.value = O),
893
+ "onUpdate:modelValue": n[4] || (n[4] = (R) => i.value = R),
894
894
  "label-mark": "optional"
895
895
  }, null, 8, ["disabled", "modelValue"]),
896
896
  e("div", Cn, [
897
- e("div", jn, v(a(D)("inventory.stock.stock_adjustment.stockAfter")), 1),
897
+ e("div", Dn, p(a(j)("inventory.stock.stock_adjustment.stockAfter")), 1),
898
898
  e("div", {
899
- class: he(["fm-typo-en-body-lg-600", n.value ? "text-red-700" : "text-green-700"])
900
- }, v(w.value), 3)
899
+ class: ge(["fm-typo-en-body-lg-600", o.value ? "text-red-700" : "text-green-700"])
900
+ }, p(x.value), 3)
901
901
  ])
902
902
  ]),
903
903
  _: 1
904
904
  });
905
905
  };
906
906
  }
907
- }), Dn = { class: "flex items-center" }, Mn = { class: "fm-typo-en-title-md-800" }, Bn = { class: "flex items-center" }, In = { class: "fm-typo-en-title-sm-800 flex-1" }, Tn = { class: "flex gap-8" }, Un = /* @__PURE__ */ me({
907
+ }), jn = { class: "flex items-center" }, Mn = { class: "fm-typo-en-title-md-800" }, Bn = { class: "flex items-center" }, In = { class: "fm-typo-en-title-sm-800 flex-1" }, Tn = { class: "flex gap-8" }, Hn = /* @__PURE__ */ me({
908
908
  __name: "AdjustSkuDialog",
909
909
  props: {
910
910
  stock: {},
@@ -912,26 +912,26 @@ const Ge = {
912
912
  },
913
913
  emits: ["update:show", "submitted"],
914
914
  setup(k, { expose: m, emit: d }) {
915
- const s = k, D = d, F = Ee(), c = Re(), l = Se(), h = xe(), B = L(!1), { t: S } = fe();
915
+ const s = k, j = d, w = Re(), c = Ne(), l = we(), h = Se(), B = z(!1), { t: b } = fe();
916
916
  function i() {
917
- w(He(b));
917
+ x(Pe(g));
918
918
  }
919
- const f = L();
919
+ const f = z();
920
920
  m({
921
921
  validateInputs: () => {
922
- var o, g;
923
- (g = (o = f.value) == null ? void 0 : o.validateInputs) == null || g.call(o);
922
+ var n, S;
923
+ (S = (n = f.value) == null ? void 0 : n.validateInputs) == null || S.call(n);
924
924
  },
925
925
  resetInputsValidation: () => {
926
- var o, g;
927
- (g = (o = f.value) == null ? void 0 : o.resetInputsValidation) == null || g.call(o);
926
+ var n, S;
927
+ (S = (n = f.value) == null ? void 0 : n.resetInputsValidation) == null || S.call(n);
928
928
  },
929
929
  resetInputs: () => {
930
- var o, g;
931
- (g = (o = f.value) == null ? void 0 : o.resetInputs) == null || g.call(o);
930
+ var n, S;
931
+ (S = (n = f.value) == null ? void 0 : n.resetInputs) == null || S.call(n);
932
932
  }
933
933
  });
934
- const I = Oe(s, "show"), b = ut({
934
+ const T = Ye(s, "show"), g = ut({
935
935
  remark: "",
936
936
  adjustments: [
937
937
  {
@@ -940,58 +940,58 @@ const Ge = {
940
940
  doc: s.stock,
941
941
  measurement: null,
942
942
  remark: "",
943
- amount: ge(1)
943
+ amount: be(1)
944
944
  }
945
945
  ]
946
946
  });
947
- Ae([() => s.show], ([o]) => {
948
- o && (b.remark = "", b.adjustments = [
947
+ $e([() => s.show], ([n]) => {
948
+ n && (g.remark = "", g.adjustments = [
949
949
  {
950
950
  id: `sku_${(/* @__PURE__ */ new Date()).toISOString()}_${Math.random().toString(16).slice(2, 8)}`,
951
951
  type: ae.enum.PURCHASE,
952
952
  doc: s.stock,
953
953
  measurement: null,
954
954
  remark: "",
955
- amount: ge(1)
955
+ amount: be(1)
956
956
  }
957
957
  ]);
958
958
  });
959
- async function w(o) {
959
+ async function x(n) {
960
960
  B.value = !0;
961
961
  try {
962
962
  await l.adjustSku({
963
- remark: o.remark,
964
- adjustments: o.adjustments.map(({ doc: g, remark: x, type: C, amount: U, measurement: O }) => ({
965
- id: g._id,
966
- amount: U,
967
- measurement: O,
968
- remark: x,
969
- doc: g,
970
- type: C
963
+ remark: n.remark,
964
+ adjustments: n.adjustments.map(({ doc: S, remark: C, type: A, amount: I, measurement: R }) => ({
965
+ id: S._id,
966
+ amount: I,
967
+ measurement: R,
968
+ remark: C,
969
+ doc: S,
970
+ type: A
971
971
  }))
972
- }), D("update:show", !1), D("submitted");
973
- } catch (g) {
972
+ }), j("update:show", !1), j("submitted");
973
+ } catch (S) {
974
974
  h.open({
975
- title: S("inventory.stock.adjust.error.title"),
976
- message: S("inventory.stock.adjust.error.message"),
975
+ title: b("inventory.stock.adjust.error.title"),
976
+ message: b("inventory.stock.adjust.error.message"),
977
977
  type: "error"
978
- }), console.log("error on adjust ingredients", o, g);
978
+ }), console.log("error on adjust ingredients", n, S);
979
979
  } finally {
980
980
  B.value = !1;
981
981
  }
982
982
  }
983
- function n() {
984
- const o = F.skus.map((x) => ({
985
- label: x.name,
986
- sublabel: x.code,
987
- value: x._id
988
- })), g = o.filter((x) => b.adjustments.find((C) => C.doc._id === x.value)).map((x) => x.value);
983
+ function o() {
984
+ const n = w.skus.map((C) => ({
985
+ label: C.name,
986
+ sublabel: C.code,
987
+ value: C._id
988
+ })), S = n.filter((C) => g.adjustments.find((A) => A.doc._id === C.value)).map((C) => C.value);
989
989
  c.open({
990
990
  title: "Select ingredients",
991
- contentComponent: vt,
991
+ contentComponent: pt,
992
992
  contentComponentProps: {
993
- items: o,
994
- modelValue: g
993
+ items: n,
994
+ modelValue: S
995
995
  },
996
996
  overlay: !0,
997
997
  closeButton: !0,
@@ -1005,75 +1005,75 @@ const Ge = {
1005
1005
  close: !0,
1006
1006
  variant: "tertiary"
1007
1007
  }
1008
- }).onPrimary((x) => {
1009
- b.adjustments = x.map(
1010
- (C) => b.adjustments.find((U) => U.doc._id === C) ?? {
1008
+ }).onPrimary((C) => {
1009
+ g.adjustments = C.map(
1010
+ (A) => g.adjustments.find((I) => I.doc._id === A) ?? {
1011
1011
  id: `sku_${(/* @__PURE__ */ new Date()).toISOString()}_${Math.random().toString(16).slice(2, 8)}`,
1012
1012
  type: ae.enum.PURCHASE,
1013
- doc: F.skus.find((U) => U._id === C),
1013
+ doc: w.skus.find((I) => I._id === A),
1014
1014
  measurement: null,
1015
1015
  remark: "",
1016
- amount: ge(1)
1016
+ amount: be(1)
1017
1017
  }
1018
1018
  );
1019
1019
  });
1020
1020
  }
1021
- function t(o) {
1022
- b.adjustments.splice(o, 1);
1021
+ function t(n) {
1022
+ g.adjustments.splice(n, 1);
1023
1023
  }
1024
- return (o, g) => {
1025
- const x = T("FmTextarea"), C = T("FmButton"), U = T("FmForm"), O = T("FmSideSheet");
1026
- return j(), q(O, {
1027
- modelValue: a(I),
1028
- "onUpdate:modelValue": g[2] || (g[2] = (X) => Ue(I) ? I.value = X : null),
1024
+ return (n, S) => {
1025
+ const C = H("FmTextarea"), A = H("FmButton"), I = H("FmForm"), R = H("FmSideSheet");
1026
+ return D(), X(R, {
1027
+ modelValue: a(T),
1028
+ "onUpdate:modelValue": S[2] || (S[2] = (K) => Ee(T) ? T.value = K : null),
1029
1029
  "dismiss-away": "",
1030
1030
  "max-width": 500
1031
1031
  }, {
1032
- "side-sheet-header": H(() => [
1033
- e("div", Dn, [
1034
- e("div", Mn, v(a(S)("inventory.stock.adjust.title")), 1)
1032
+ "side-sheet-header": U(() => [
1033
+ e("div", jn, [
1034
+ e("div", Mn, p(a(b)("inventory.stock.adjust.title")), 1)
1035
1035
  ])
1036
1036
  ]),
1037
- default: H(() => [
1038
- y(U, {
1037
+ default: U(() => [
1038
+ y(I, {
1039
1039
  class: "w-full flex flex-col gap-12",
1040
1040
  ref_key: "formRef",
1041
1041
  ref: f,
1042
1042
  onValidationSuccess: i
1043
1043
  }, {
1044
- default: H(() => [
1045
- y(x, {
1046
- label: a(S)("inventory.stock.adjust.remark"),
1047
- modelValue: b.remark,
1048
- "onUpdate:modelValue": g[0] || (g[0] = (X) => b.remark = X)
1044
+ default: U(() => [
1045
+ y(C, {
1046
+ label: a(b)("inventory.stock.adjust.remark"),
1047
+ modelValue: g.remark,
1048
+ "onUpdate:modelValue": S[0] || (S[0] = (K) => g.remark = K)
1049
1049
  }, null, 8, ["label", "modelValue"]),
1050
1050
  e("div", Bn, [
1051
- e("div", In, v(a(S)("inventory.stock.adjust.adjustedItems")), 1),
1052
- y(C, {
1051
+ e("div", In, p(a(b)("inventory.stock.adjust.adjustedItems")), 1),
1052
+ y(A, {
1053
1053
  "prepend-icon": "add",
1054
1054
  variant: "tertiary",
1055
1055
  size: "md",
1056
- onClick: n
1056
+ onClick: o
1057
1057
  })
1058
1058
  ]),
1059
- (j(!0), W(le, null, ce(b.adjustments, (X, z) => (j(), q(ht, {
1060
- key: X.id,
1061
- modelValue: b.adjustments[z],
1062
- "onUpdate:modelValue": (Z) => b.adjustments[z] = Z,
1063
- "onClick:delete": (Z) => t(z)
1059
+ (D(!0), W(le, null, ce(g.adjustments, (K, O) => (D(), X(ht, {
1060
+ key: K.id,
1061
+ modelValue: g.adjustments[O],
1062
+ "onUpdate:modelValue": (Z) => g.adjustments[O] = Z,
1063
+ "onClick:delete": (Z) => t(O)
1064
1064
  }, null, 8, ["modelValue", "onUpdate:modelValue", "onClick:delete"]))), 128))
1065
1065
  ]),
1066
1066
  _: 1
1067
1067
  }, 512)
1068
1068
  ]),
1069
- "side-sheet-footer": H(() => [
1069
+ "side-sheet-footer": U(() => [
1070
1070
  e("div", Tn, [
1071
- y(C, {
1072
- label: a(S)("inventory.stock.adjust.adjustButton"),
1071
+ y(A, {
1072
+ label: a(b)("inventory.stock.adjust.adjustButton"),
1073
1073
  loading: B.value,
1074
- onClick: g[1] || (g[1] = (X) => {
1075
- var z, Z;
1076
- return (Z = (z = f.value) == null ? void 0 : z.validateInputs) == null ? void 0 : Z.call(z);
1074
+ onClick: S[1] || (S[1] = (K) => {
1075
+ var O, Z;
1076
+ return (Z = (O = f.value) == null ? void 0 : O.validateInputs) == null ? void 0 : Z.call(O);
1077
1077
  })
1078
1078
  }, null, 8, ["label", "loading"])
1079
1079
  ])
@@ -1082,190 +1082,190 @@ const Ge = {
1082
1082
  }, 8, ["modelValue"]);
1083
1083
  };
1084
1084
  }
1085
- }), Hn = { class: "flex items-center w-full gap-8" }, En = { class: "fm-typo-en-title-md-800 flex-1" }, Pn = { class: "flex flex-col gap-16" }, Rn = { class: "flex flex-col gap-4" }, On = { class: "fm-typo-en-body-md-600" }, Nn = { class: "flex gap-8 items-start" }, Yn = { class: "flex-1 min-w-0" }, Ln = { class: "flex-1 min-w-0" }, zn = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Gn = { class: "flex items-center" }, Wn = { class: "fm-typo-en-title-sm-800 flex-1" }, Kn = { class: "flex gap-8" }, qn = /* @__PURE__ */ me({
1085
+ }), Un = { class: "flex items-center w-full gap-8" }, En = { class: "fm-typo-en-title-md-800 flex-1" }, Pn = { class: "flex flex-col gap-16" }, Rn = { class: "flex flex-col gap-4" }, On = { class: "fm-typo-en-body-md-600" }, Nn = { class: "flex gap-8 items-start" }, Yn = { class: "flex-1 min-w-0" }, Ln = { class: "flex-1 min-w-0" }, zn = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Gn = { class: "flex items-center" }, Wn = { class: "fm-typo-en-title-sm-800 flex-1" }, Kn = { class: "flex gap-8" }, qn = /* @__PURE__ */ me({
1086
1086
  __name: "StockAdjustmentSideSheet",
1087
1087
  props: {
1088
1088
  show: { type: Boolean }
1089
1089
  },
1090
1090
  emits: ["update:show", "submitted"],
1091
1091
  setup(k, { emit: m }) {
1092
- const d = k, s = m, { t: D } = fe(), F = Ee(), c = Se(), l = Re(), h = xe(), B = Oe(d, "show"), S = L(!1), i = ut({
1092
+ const d = k, s = m, { t: j } = fe(), w = Re(), c = we(), l = Ne(), h = Se(), B = Ye(d, "show"), b = z(!1), i = ut({
1093
1093
  remark: "",
1094
1094
  effectiveAt: /* @__PURE__ */ new Date(),
1095
1095
  adjustments: []
1096
- }), f = L(ve().format("YYYY-MM-DD")), I = L(ve().format("HH:mm"));
1097
- Ae([f, I], () => {
1098
- if (f.value && I.value) {
1099
- const x = ve(`${f.value} ${I.value}`, "YYYY-MM-DD HH:mm");
1100
- if (x.isValid()) {
1101
- const C = ve();
1102
- x.isAfter(C) ? i.effectiveAt = C.toDate() : i.effectiveAt = x.toDate();
1096
+ }), f = z(ye().format("YYYY-MM-DD")), T = z(ye().format("HH:mm"));
1097
+ $e([f, T], () => {
1098
+ if (f.value && T.value) {
1099
+ const C = ye(`${f.value} ${T.value}`, "YYYY-MM-DD HH:mm");
1100
+ if (C.isValid()) {
1101
+ const A = ye();
1102
+ C.isAfter(A) ? i.effectiveAt = A.toDate() : i.effectiveAt = C.toDate();
1103
1103
  }
1104
1104
  }
1105
1105
  });
1106
- function b() {
1107
- i.remark = "", i.effectiveAt = /* @__PURE__ */ new Date(), i.adjustments = [], f.value = ve(i.effectiveAt).format("YYYY-MM-DD"), I.value = ve(i.effectiveAt).format("HH:mm");
1106
+ function g() {
1107
+ i.remark = "", i.effectiveAt = /* @__PURE__ */ new Date(), i.adjustments = [], f.value = ye(i.effectiveAt).format("YYYY-MM-DD"), T.value = ye(i.effectiveAt).format("HH:mm");
1108
1108
  }
1109
- function w() {
1110
- b();
1109
+ function x() {
1110
+ g();
1111
1111
  }
1112
- const n = N(() => {
1113
- const x = {};
1114
- return F.skus.forEach((C) => {
1115
- x[C._id] = C;
1116
- }), x;
1112
+ const o = Y(() => {
1113
+ const C = {};
1114
+ return w.skus.forEach((A) => {
1115
+ C[A._id] = A;
1116
+ }), C;
1117
1117
  });
1118
1118
  function t() {
1119
- const x = F.skus.map((U) => ({
1120
- label: U.name,
1121
- sublabel: U.code,
1122
- value: U._id
1123
- })), C = i.adjustments.map((U) => U.doc._id);
1119
+ const C = w.skus.map((I) => ({
1120
+ label: I.name,
1121
+ sublabel: I.code,
1122
+ value: I._id
1123
+ })), A = i.adjustments.map((I) => I.doc._id);
1124
1124
  l.open({
1125
- title: D("inventory.stock.adjust.selectIngredients"),
1126
- contentComponent: vt,
1125
+ title: j("inventory.stock.adjust.selectIngredients"),
1126
+ contentComponent: pt,
1127
1127
  contentComponentProps: {
1128
- items: x,
1129
- modelValue: C,
1128
+ items: C,
1129
+ modelValue: A,
1130
1130
  virtualScroll: !0
1131
1131
  },
1132
1132
  overlay: !0,
1133
1133
  closeButton: !0,
1134
1134
  dismissAway: !0,
1135
1135
  primaryActions: {
1136
- text: D("common.confirm"),
1136
+ text: j("common.confirm"),
1137
1137
  close: !0
1138
1138
  },
1139
1139
  secondaryActions: {
1140
- text: D("common.close"),
1140
+ text: j("common.close"),
1141
1141
  close: !0,
1142
1142
  variant: "tertiary"
1143
1143
  }
1144
- }).onPrimary((U) => {
1145
- i.adjustments = U.map(
1146
- (O) => i.adjustments.find((X) => X.doc._id === O) ?? {
1144
+ }).onPrimary((I) => {
1145
+ i.adjustments = I.map(
1146
+ (R) => i.adjustments.find((K) => K.doc._id === R) ?? {
1147
1147
  id: "",
1148
1148
  type: ae.enum.PURCHASE,
1149
- doc: n.value[O],
1149
+ doc: o.value[R],
1150
1150
  measurement: null,
1151
1151
  remark: "",
1152
- amount: ge(1)
1152
+ amount: be(1)
1153
1153
  }
1154
1154
  );
1155
1155
  });
1156
1156
  }
1157
- function o(x) {
1158
- i.adjustments.splice(x, 1);
1157
+ function n(C) {
1158
+ i.adjustments.splice(C, 1);
1159
1159
  }
1160
- async function g() {
1160
+ async function S() {
1161
1161
  if (i.adjustments.length === 0) {
1162
1162
  h.open({
1163
- title: D("inventory.stock.error.title"),
1164
- message: D("inventory.stock.stock_adjustment.noAdjustments"),
1163
+ title: j("inventory.stock.error.title"),
1164
+ message: j("inventory.stock.stock_adjustment.noAdjustments"),
1165
1165
  type: "warning"
1166
1166
  });
1167
1167
  return;
1168
1168
  }
1169
- S.value = !0;
1169
+ b.value = !0;
1170
1170
  try {
1171
- const x = i.adjustments.map(
1172
- ({ doc: U, remark: O, type: X, amount: z, measurement: Z }) => ({
1173
- id: U._id,
1174
- amount: z,
1171
+ const C = i.adjustments.map(
1172
+ ({ doc: I, remark: R, type: K, amount: O, measurement: Z }) => ({
1173
+ id: I._id,
1174
+ amount: O,
1175
1175
  measurement: Z,
1176
- remark: O,
1177
- doc: U,
1178
- type: X
1176
+ remark: R,
1177
+ doc: I,
1178
+ type: K
1179
1179
  })
1180
- ), C = {
1180
+ ), A = {
1181
1181
  remark: i.remark,
1182
- adjustments: x,
1182
+ adjustments: C,
1183
1183
  effectiveAt: i.effectiveAt.toISOString()
1184
1184
  };
1185
- await c.adjustSku(He(C)), s("submitted"), s("update:show", !1);
1186
- } catch (x) {
1185
+ await c.adjustSku(Pe(A)), s("submitted"), s("update:show", !1);
1186
+ } catch (C) {
1187
1187
  h.open({
1188
- title: D("inventory.stock.adjust.error.title"),
1189
- message: D("inventory.stock.adjust.error.message"),
1188
+ title: j("inventory.stock.adjust.error.title"),
1189
+ message: j("inventory.stock.adjust.error.message"),
1190
1190
  type: "error"
1191
- }), console.error("error on stock adjustment", x);
1191
+ }), console.error("error on stock adjustment", C);
1192
1192
  } finally {
1193
- S.value = !1;
1193
+ b.value = !1;
1194
1194
  }
1195
1195
  }
1196
- return (x, C) => {
1197
- const U = T("FmTextarea"), O = T("FmDatePicker"), X = T("FmTimePicker"), z = T("FmButton"), Z = T("FmSideSheet");
1198
- return j(), q(Z, {
1196
+ return (C, A) => {
1197
+ const I = H("FmTextarea"), R = H("FmDatePicker"), K = H("FmTimePicker"), O = H("FmButton"), Z = H("FmSideSheet");
1198
+ return D(), X(Z, {
1199
1199
  modelValue: a(B),
1200
- "onUpdate:modelValue": C[4] || (C[4] = (K) => Ue(B) ? B.value = K : null),
1200
+ "onUpdate:modelValue": A[4] || (A[4] = (q) => Ee(B) ? B.value = q : null),
1201
1201
  "dismiss-away": "",
1202
1202
  "max-width": 560,
1203
- onAfterEnter: w
1203
+ onAfterEnter: x
1204
1204
  }, {
1205
- "side-sheet-header": H(() => [
1206
- e("div", Hn, [
1207
- e("div", En, v(a(D)("inventory.stock.stock_adjustment.title")), 1)
1205
+ "side-sheet-header": U(() => [
1206
+ e("div", Un, [
1207
+ e("div", En, p(a(j)("inventory.stock.stock_adjustment.title")), 1)
1208
1208
  ])
1209
1209
  ]),
1210
- default: H(() => [
1210
+ default: U(() => [
1211
1211
  e("div", Pn, [
1212
- y(U, {
1213
- label: a(D)("inventory.stock.adjust.remark"),
1212
+ y(I, {
1213
+ label: a(j)("inventory.stock.adjust.remark"),
1214
1214
  modelValue: i.remark,
1215
- "onUpdate:modelValue": C[0] || (C[0] = (K) => i.remark = K),
1215
+ "onUpdate:modelValue": A[0] || (A[0] = (q) => i.remark = q),
1216
1216
  "label-mark": "optional"
1217
1217
  }, null, 8, ["label", "modelValue"]),
1218
1218
  e("div", Rn, [
1219
- e("label", On, v(a(D)("inventory.stock.stock_adjustment.effectiveAt")), 1),
1219
+ e("label", On, p(a(j)("inventory.stock.stock_adjustment.effectiveAt")), 1),
1220
1220
  e("div", Nn, [
1221
1221
  e("div", Yn, [
1222
- y(O, {
1222
+ y(R, {
1223
1223
  class: "w-full",
1224
1224
  modelValue: f.value,
1225
- "onUpdate:modelValue": C[1] || (C[1] = (K) => f.value = K),
1225
+ "onUpdate:modelValue": A[1] || (A[1] = (q) => f.value = q),
1226
1226
  clearable: !1,
1227
- max: a(ve)().format("YYYY-MM-DD")
1227
+ max: a(ye)().format("YYYY-MM-DD")
1228
1228
  }, null, 8, ["modelValue", "max"])
1229
1229
  ]),
1230
1230
  e("div", Ln, [
1231
- y(X, {
1231
+ y(K, {
1232
1232
  class: "w-full",
1233
- modelValue: I.value,
1234
- "onUpdate:modelValue": C[2] || (C[2] = (K) => I.value = K),
1233
+ modelValue: T.value,
1234
+ "onUpdate:modelValue": A[2] || (A[2] = (q) => T.value = q),
1235
1235
  format: "HH:mm"
1236
1236
  }, null, 8, ["modelValue"])
1237
1237
  ])
1238
1238
  ]),
1239
- e("div", zn, v(a(D)("inventory.stock.stock_adjustment.immediateHint")), 1)
1239
+ e("div", zn, p(a(j)("inventory.stock.stock_adjustment.immediateHint")), 1)
1240
1240
  ]),
1241
1241
  e("div", Gn, [
1242
- e("div", Wn, v(a(D)("inventory.stock.adjust.adjustedItems")), 1),
1243
- y(z, {
1242
+ e("div", Wn, p(a(j)("inventory.stock.adjust.adjustedItems")), 1),
1243
+ y(O, {
1244
1244
  "prepend-icon": "add",
1245
1245
  variant: "tertiary",
1246
1246
  size: "md",
1247
1247
  onClick: t
1248
1248
  })
1249
1249
  ]),
1250
- (j(!0), W(le, null, ce(i.adjustments, (K, ue) => (j(), q(ht, {
1251
- key: K.id,
1250
+ (D(!0), W(le, null, ce(i.adjustments, (q, ue) => (D(), X(ht, {
1251
+ key: q.id,
1252
1252
  modelValue: i.adjustments[ue],
1253
1253
  "onUpdate:modelValue": (ee) => i.adjustments[ue] = ee,
1254
- "onClick:delete": (ee) => o(ue)
1254
+ "onClick:delete": (ee) => n(ue)
1255
1255
  }, null, 8, ["modelValue", "onUpdate:modelValue", "onClick:delete"]))), 128))
1256
1256
  ])
1257
1257
  ]),
1258
- "side-sheet-footer": H(() => [
1258
+ "side-sheet-footer": U(() => [
1259
1259
  e("div", Kn, [
1260
- y(z, {
1261
- label: a(D)("common.confirm"),
1262
- loading: S.value,
1263
- onClick: g
1260
+ y(O, {
1261
+ label: a(j)("common.confirm"),
1262
+ loading: b.value,
1263
+ onClick: S
1264
1264
  }, null, 8, ["label", "loading"]),
1265
- y(z, {
1266
- label: a(D)("common.close"),
1265
+ y(O, {
1266
+ label: a(j)("common.close"),
1267
1267
  variant: "tertiary",
1268
- onClick: C[3] || (C[3] = (K) => s("update:show", !1))
1268
+ onClick: A[3] || (A[3] = (q) => s("update:show", !1))
1269
1269
  }, null, 8, ["label"])
1270
1270
  ])
1271
1271
  ]),
@@ -1275,20 +1275,20 @@ const Ge = {
1275
1275
  }
1276
1276
  }), Xn = $t((k, m) => ({
1277
1277
  // TODO: remove once latest inventory backend has been push
1278
- async findBillsByBusinessId(d, s, D) {
1279
- const F = `${k.businessesBackendUrl}/${d}/reports/find-many`, c = {
1278
+ async findBillsByBusinessId(d, s, j) {
1279
+ const w = `${k.businessesBackendUrl}/${d}/reports/find-many`, c = {
1280
1280
  // type: TYPE.bill,
1281
1281
  type: "bill",
1282
1282
  restaurantIds: s,
1283
- ids: D
1283
+ ids: j
1284
1284
  };
1285
- return await m.post(F, c);
1285
+ return await m.post(w, c);
1286
1286
  },
1287
1287
  async findBillsById(d) {
1288
- const D = be().currentLocationDBName, F = `${k.inventoryBackendUrl}/${D}/bill/search`, c = {
1288
+ const j = xe().currentLocationDBName, w = `${k.inventoryBackendUrl}/${j}/bill/search`, c = {
1289
1289
  ids: d
1290
1290
  };
1291
- return await m.post(F, c);
1291
+ return await m.post(w, c);
1292
1292
  }
1293
1293
  })), Jn = {
1294
1294
  key: 0,
@@ -1303,75 +1303,81 @@ const Ge = {
1303
1303
  }),
1304
1304
  emits: /* @__PURE__ */ Qe(["refreshHistory"], ["update:modelValue"]),
1305
1305
  setup(k, { emit: m }) {
1306
- const d = k, s = m, D = Se(), F = bt(k, "modelValue"), c = L(!1), l = L(!1), h = L(!1), B = L({
1306
+ const d = k, s = m, j = we(), w = bt(k, "modelValue"), c = z(!1), l = z(!1), h = z(!1), B = z({
1307
1307
  _id: `inventoryAdjustment_${(/* @__PURE__ */ new Date()).toISOString()}_XXXXX`,
1308
1308
  skus: []
1309
- }), S = L();
1309
+ }), b = z();
1310
1310
  qe(async () => {
1311
1311
  c.value = !0;
1312
- const n = await D.readSingleAdjustment(d.adjustmentId);
1313
- if (!n) throw new Error("Adjustment not found");
1314
- B.value = n, c.value = !1;
1312
+ const o = await j.readSingleAdjustment(d.adjustmentId);
1313
+ if (!o) throw new Error("Adjustment not found");
1314
+ B.value = o, c.value = !1;
1315
1315
  });
1316
1316
  async function i() {
1317
- var t, o;
1318
- if ((o = (t = S == null ? void 0 : S.value) == null ? void 0 : t.validateInputs) == null || o.call(t), !l.value) return;
1319
- const n = {};
1320
- Object.keys(F.value || {}).forEach((g) => {
1321
- var x;
1322
- Object.keys(((x = F.value) == null ? void 0 : x[g]) || {}).forEach((C) => {
1323
- var O, X;
1324
- const U = (X = (O = F.value) == null ? void 0 : O[g]) == null ? void 0 : X[Number(C)];
1325
- U && I(U.amount) > 0 && (n[g] || (n[g] = []), n[g].push(U));
1317
+ var t, n;
1318
+ if ((n = (t = b == null ? void 0 : b.value) == null ? void 0 : t.validateInputs) == null || n.call(t), !l.value) return;
1319
+ const o = {};
1320
+ Object.keys(w.value || {}).forEach((S) => {
1321
+ var C;
1322
+ Object.keys(((C = w.value) == null ? void 0 : C[S]) || {}).forEach((A) => {
1323
+ var R, K;
1324
+ const I = (K = (R = w.value) == null ? void 0 : R[S]) == null ? void 0 : K[Number(A)];
1325
+ I && T(I.amount) > 0 && (o[S] || (o[S] = []), o[S].push(I));
1326
1326
  });
1327
- }), await D.revertWastageAdjustment({
1327
+ }), await j.revertWastageAdjustment({
1328
1328
  targetWastageAdjustmentId: d.adjustmentId,
1329
- amountsGoingToAdjust: n
1330
- }), s("refreshHistory"), h.value = !1, F.value = {};
1329
+ amountsGoingToAdjust: o
1330
+ }), s("refreshHistory"), h.value = !1, w.value = {};
1331
1331
  }
1332
- function f(n, t, o) {
1333
- return N({
1332
+ function f(o) {
1333
+ const { skuId: t, idx: n, unit: S, measurement: C } = o;
1334
+ return Y({
1334
1335
  get: () => {
1335
- var x, C, U;
1336
- const g = (U = (C = (x = F.value) == null ? void 0 : x[n]) == null ? void 0 : C[t]) == null ? void 0 : U.amount;
1337
- return g ? I(g, !0) : 0;
1336
+ var R, K, O;
1337
+ const A = (O = (K = (R = w.value) == null ? void 0 : R[t]) == null ? void 0 : K[n]) == null ? void 0 : O.amount;
1338
+ return A ? Number(pe.toFormatString({ value: A })) : 0;
1338
1339
  },
1339
- set: (g) => {
1340
- F.value || (F.value = {});
1341
- const x = { ...F.value };
1342
- x[n] || (x[n] = {}), x[n][t] = {
1343
- amount: ze.fromNumber(g),
1340
+ set: (A) => {
1341
+ w.value || (w.value = {});
1342
+ const I = { ...w.value };
1343
+ I[t] || (I[t] = {}), I[t][n] = {
1344
+ amount: pe.convertPrecision({
1345
+ value: pe.fromNumber(A),
1346
+ precision: Ce(S)
1347
+ }),
1344
1348
  type: ae.Enum.WASTAGE,
1345
- measurement: o
1346
- }, F.value = x;
1349
+ measurement: C
1350
+ }, w.value = I;
1347
1351
  }
1348
1352
  });
1349
1353
  }
1350
- function I(n, t = !0) {
1351
- const o = Number(ze.toFormatString({ value: n }));
1352
- return t ? Math.abs(o) : o;
1354
+ function T(o, t = !0) {
1355
+ const n = Number(pe.toFormatString({ value: o }));
1356
+ return t ? Math.abs(n) : n;
1353
1357
  }
1354
- function b(n, t) {
1355
- return t.measurement ? t.measurement.abbrev : n.sku.unit.abbrev;
1358
+ function g(o, t) {
1359
+ return t.measurement ? t.measurement.abbrev : o.sku.unit.abbrev;
1356
1360
  }
1357
- function w(n, t) {
1358
- return t === 0 ? "N/A" : (n + t).toString();
1361
+ function x(o, t) {
1362
+ if (t.amount === 0) return "N/A";
1363
+ const n = pe.add([o, t]);
1364
+ return n ? pe.toFormatString({ value: n }) : "N/A";
1359
1365
  }
1360
- return (n, t) => {
1361
- const o = T("FmIcon"), g = T("FmStepperField"), x = T("FmCard"), C = T("FmForm"), U = T("FmSpacer"), O = T("FmButton"), X = T("FmDialog");
1362
- return j(), q(X, {
1366
+ return (o, t) => {
1367
+ const n = H("FmIcon"), S = H("FmStepperField"), C = H("FmCard"), A = H("FmForm"), I = H("FmSpacer"), R = H("FmButton"), K = H("FmDialog");
1368
+ return D(), X(K, {
1363
1369
  modelValue: h.value,
1364
- "onUpdate:modelValue": t[4] || (t[4] = (z) => h.value = z),
1370
+ "onUpdate:modelValue": t[4] || (t[4] = (O) => h.value = O),
1365
1371
  overlay: !0
1366
1372
  }, {
1367
- "dialog-button": H(() => [
1373
+ "dialog-button": U(() => [
1368
1374
  y(Xe, null, {
1369
- default: H(() => [
1375
+ default: U(() => [
1370
1376
  e("button", {
1371
- onClick: t[0] || (t[0] = (z) => h.value = !0),
1377
+ onClick: t[0] || (t[0] = (O) => h.value = !0),
1372
1378
  class: "rounded-md hover:bg-gray-100 transition-colors"
1373
1379
  }, [
1374
- y(o, {
1380
+ y(n, {
1375
1381
  name: "edit",
1376
1382
  size: "sm"
1377
1383
  })
@@ -1380,22 +1386,22 @@ const Ge = {
1380
1386
  _: 1
1381
1387
  })
1382
1388
  ]),
1383
- "dialog-header": H(() => t[5] || (t[5] = [
1389
+ "dialog-header": U(() => t[5] || (t[5] = [
1384
1390
  e("div", null, "Amend Adjustment", -1)
1385
1391
  ])),
1386
- "dialog-footer": H(() => [
1392
+ "dialog-footer": U(() => [
1387
1393
  e("div", ao, [
1388
1394
  t[13] || (t[13] = e("span", { class: "text-fm-color-system-warning-400 fm-typo-en-body-sm-400" }, "1. New adjustment EXTRA will be created for each reversal", -1)),
1389
1395
  e("div", lo, [
1390
- y(U),
1391
- y(O, {
1396
+ y(I),
1397
+ y(R, {
1392
1398
  class: "sm:w-full xs:w-full",
1393
1399
  label: "Close",
1394
1400
  size: "md",
1395
1401
  variant: "tertiary",
1396
- onClick: t[3] || (t[3] = (z) => h.value = !1)
1402
+ onClick: t[3] || (t[3] = (O) => h.value = !1)
1397
1403
  }),
1398
- y(O, {
1404
+ y(R, {
1399
1405
  class: "sm:w-full xs:w-full",
1400
1406
  label: "Submit",
1401
1407
  size: "md",
@@ -1405,11 +1411,11 @@ const Ge = {
1405
1411
  ])
1406
1412
  ])
1407
1413
  ]),
1408
- default: H(() => [
1409
- c.value ? (j(), W("div", Jn)) : (j(), q(C, {
1414
+ default: U(() => [
1415
+ c.value ? (D(), W("div", Jn)) : (D(), X(A, {
1410
1416
  key: 1,
1411
1417
  ref_key: "formRef",
1412
- ref: S,
1418
+ ref: b,
1413
1419
  onValidationFailed: t[1] || (t[1] = () => {
1414
1420
  l.value = !1;
1415
1421
  }),
@@ -1418,52 +1424,67 @@ const Ge = {
1418
1424
  }),
1419
1425
  blameFormChildOnValidationFailed: ""
1420
1426
  }, {
1421
- default: H(() => [
1427
+ default: U(() => [
1422
1428
  e("p", Qn, [
1423
1429
  t[6] || (t[6] = e("b", null, "Date:", -1)),
1424
1430
  t[7] || (t[7] = e("br", null, null, -1)),
1425
- pe(" " + v(a(Yt)(a(Vt)(B.value._id))), 1)
1431
+ ve(" " + p(a(Yt)(a(Vt)(B.value._id))), 1)
1426
1432
  ]),
1427
1433
  e("div", Zn, [
1428
- (j(!0), W(le, null, ce(B.value.skus, (z, Z) => (j(), W(le, { key: Z }, [
1429
- (j(!0), W(le, null, ce(z.amounts, (K, ue) => (j(), q(x, {
1434
+ (D(!0), W(le, null, ce(B.value.skus, (O, Z) => (D(), W(le, { key: Z }, [
1435
+ (D(!0), W(le, null, ce(O.amounts, (q, ue) => (D(), X(C, {
1430
1436
  key: ue,
1431
1437
  variant: "outlined",
1432
1438
  class: "p-2"
1433
1439
  }, {
1434
- default: H(() => [
1440
+ default: U(() => [
1435
1441
  e("div", eo, [
1436
- e("span", to, v(z.sku.code), 1),
1437
- e("span", null, v(z.sku.name), 1)
1442
+ e("span", to, p(O.sku.code), 1),
1443
+ e("span", null, p(O.sku.name), 1)
1438
1444
  ]),
1439
1445
  t[12] || (t[12] = e("hr", { class: "m-2" }, null, -1)),
1440
1446
  e("div", no, [
1441
1447
  t[8] || (t[8] = e("span", { class: "fm-typo-en-body-lg-600" }, "Adjustment type:", -1)),
1442
- e("span", null, v(K.type), 1)
1448
+ e("span", null, p(q.type), 1)
1443
1449
  ]),
1444
1450
  e("div", oo, [
1445
1451
  t[9] || (t[9] = e("span", { class: "fm-typo-en-body-lg-600" }, "Current amount:", -1)),
1446
- e("span", null, v(a(ze).toFormatString({ value: K.amount })) + " " + v(b(z, K)), 1)
1452
+ e("span", null, p(a(pe).toFormatString({ value: q.amount })) + " " + p(g(O, q)), 1)
1447
1453
  ]),
1448
- y(g, {
1449
- "model-value": f(z.sku._id, ue).value,
1450
- "onUpdate:modelValue": (ee) => f(z.sku._id, ue).value = ee,
1454
+ y(S, {
1455
+ "max-fraction-digits": a(Ce)(O.sku.unit),
1456
+ "model-value": f({
1457
+ skuId: O.sku._id,
1458
+ idx: ue,
1459
+ unit: O.sku.unit
1460
+ }).value,
1461
+ "onUpdate:modelValue": (ee) => f({
1462
+ skuId: O.sku._id,
1463
+ idx: ue,
1464
+ unit: O.sku.unit
1465
+ }).value = ee,
1451
1466
  class: "mb-3",
1452
1467
  label: "Adjust Amount (Leave 0 to skip)",
1453
- "helper-text": `Max: ${I(K.amount)}`,
1454
- "append-text": b(z, K),
1468
+ "helper-text": `Max: ${T(q.amount)}`,
1469
+ "append-text": g(O, q),
1455
1470
  rules: [
1456
- (ee) => ee <= I(K.amount) || `Cannot be more than ${I(K.amount)}`,
1457
- a(Ie)(-1)
1471
+ (ee) => ee <= T(q.amount) || `Cannot be more than ${T(q.amount)}`,
1472
+ a(He)(-1)
1458
1473
  ]
1459
- }, null, 8, ["model-value", "onUpdate:modelValue", "helper-text", "append-text", "rules"]),
1474
+ }, null, 8, ["max-fraction-digits", "model-value", "onUpdate:modelValue", "helper-text", "append-text", "rules"]),
1460
1475
  e("div", so, [
1461
1476
  t[10] || (t[10] = e("span", { class: "fm-typo-en-body-lg-600" }, "Amount after amend:", -1)),
1462
1477
  t[11] || (t[11] = e("span", { class: "text-fm-color-system-warning-400 fm-typo-en-body-sm-400" }, "* It's an estimate for your reference, as it didn't include all the reversals related to this adjustment", -1)),
1463
- pe(" " + v(w(
1464
- I(K.amount, !1),
1465
- f(z.sku._id, ue).value
1466
- )) + " " + v(b(z, K)), 1)
1478
+ ve(" " + p(x(
1479
+ q.amount,
1480
+ a(pe).fromNumber(
1481
+ f({
1482
+ skuId: O.sku._id,
1483
+ idx: ue,
1484
+ unit: O.sku.unit
1485
+ }).value
1486
+ )
1487
+ )) + " " + p(g(O, q)), 1)
1467
1488
  ])
1468
1489
  ]),
1469
1490
  _: 2
@@ -1481,7 +1502,7 @@ const Ge = {
1481
1502
  }), io = { class: "p-16" }, uo = { class: "fm-typo-en-body-md-600 flex-grow" }, co = { class: "flex-grow text-fm-color-typo-secondary" }, mo = {
1482
1503
  key: 0,
1483
1504
  class: "my-5"
1484
- }, fo = { class: "text-neutral-400" }, po = { class: "flex-grow" }, vo = { class: "flex gap-1" }, yo = { class: "flex flex-col gap-1" }, _o = {
1505
+ }, fo = { class: "text-neutral-400" }, vo = { class: "flex-grow" }, po = { class: "flex gap-1" }, yo = { class: "flex flex-col gap-1" }, _o = {
1485
1506
  key: 1,
1486
1507
  class: "t-system text-fsecondary"
1487
1508
  }, ko = {
@@ -1501,81 +1522,81 @@ const Ge = {
1501
1522
  },
1502
1523
  setup(k) {
1503
1524
  const m = k;
1504
- function d(S, i) {
1525
+ function d(b, i) {
1505
1526
  if (m.costMechanism === "adjustment")
1506
1527
  return null;
1507
1528
  const f = m.unitCostHistory.filter(
1508
- (w) => w.mechanism === m.costMechanism && w.skuId === m.sku._id
1529
+ (x) => x.mechanism === m.costMechanism && x.skuId === m.sku._id
1509
1530
  );
1510
1531
  if (f.length === 0) return null;
1511
- const I = f.find((w) => {
1512
- const n = w.meta;
1513
- return (n == null ? void 0 : n.adjustmentId) === S;
1532
+ const T = f.find((x) => {
1533
+ const o = x.meta;
1534
+ return (o == null ? void 0 : o.adjustmentId) === b;
1514
1535
  });
1515
- if (I) return I.cost;
1516
- const b = [...f].filter((w) => new Date(w.snapshotAt) <= new Date(i)).sort((w, n) => new Date(n.snapshotAt).getTime() - new Date(w.snapshotAt).getTime());
1517
- return b.length > 0 ? b[0].cost : null;
1536
+ if (T) return T.cost;
1537
+ const g = [...f].filter((x) => new Date(x.snapshotAt) <= new Date(i)).sort((x, o) => new Date(o.snapshotAt).getTime() - new Date(x.snapshotAt).getTime());
1538
+ return g.length > 0 ? g[0].cost : null;
1518
1539
  }
1519
- const s = L(!1), D = L(), F = L(null), c = N(() => F.value === null ? "unset" : s.value ? `${F.value}px` : "0px");
1540
+ const s = z(!1), j = z(), w = z(null), c = Y(() => w.value === null ? "unset" : s.value ? `${w.value}px` : "0px");
1520
1541
  qe(() => {
1521
- var S;
1522
- F.value = ((S = D.value) == null ? void 0 : S.scrollHeight) || 0;
1542
+ var b;
1543
+ w.value = ((b = j.value) == null ? void 0 : b.scrollHeight) || 0;
1523
1544
  });
1524
- const l = N(() => {
1525
- var w;
1526
- const S = m.record.adjustments, i = m.sku, f = {}, b = S.flatMap((n) => {
1545
+ const l = Y(() => {
1546
+ var x;
1547
+ const b = m.record.adjustments, i = m.sku, f = {}, g = b.flatMap((o) => {
1527
1548
  var t;
1528
- return ((t = n.skus) == null ? void 0 : t.filter((o) => o.sku._id === i._id)) ?? [];
1529
- }).flatMap((n) => n.amounts);
1530
- for (const n of b) {
1531
- const t = n.measurement ? pt(n.measurement.conversion, n.amount) : n.amount;
1532
- f[w = n.type] ?? (f[w] = { amount: 0, precision: 0 }), f[n.type] = Je(t, f[n.type]);
1549
+ return ((t = o.skus) == null ? void 0 : t.filter((n) => n.sku._id === i._id)) ?? [];
1550
+ }).flatMap((o) => o.amounts);
1551
+ for (const o of g) {
1552
+ const t = o.measurement ? vt(o.measurement.conversion, o.amount) : o.amount;
1553
+ f[x = o.type] ?? (f[x] = { amount: 0, precision: 0 }), f[o.type] = Je(t, f[o.type]);
1533
1554
  }
1534
1555
  return Object.entries(f).reduce(
1535
- (n, [t, o]) => (n[t] = /// comment, because without it formatter makes code uglier
1556
+ (o, [t, n]) => (o[t] = /// comment, because without it formatter makes code uglier
1536
1557
  `${Q.toFormatString({
1537
- value: o,
1558
+ value: n,
1538
1559
  precision: 4
1539
- })} ${i.unit.abbrev}`, n),
1560
+ })} ${i.unit.abbrev}`, o),
1540
1561
  {}
1541
1562
  );
1542
- }), { t: h } = fe(), B = N(() => m.record.adjustmentsByTime.map(({ date: S, adjustments: i }) => ({
1543
- time: Lt(new Date(S)),
1563
+ }), { t: h } = fe(), B = Y(() => m.record.adjustmentsByTime.map(({ date: b, adjustments: i }) => ({
1564
+ time: Lt(new Date(b)),
1544
1565
  adjustments: i.flatMap(
1545
1566
  (f) => {
1546
- var I, b;
1547
- return ((b = (I = f.skus) == null ? void 0 : I.map) == null ? void 0 : b.call(I, (w) => {
1548
- var n, t;
1567
+ var T, g;
1568
+ return ((g = (T = f.skus) == null ? void 0 : T.map) == null ? void 0 : g.call(T, (x) => {
1569
+ var o, t;
1549
1570
  return {
1550
- ...w,
1571
+ ...x,
1551
1572
  ref: f.ref,
1552
- backdateFrom: f.effectiveAt != null ? Me(f._id) : null,
1553
- toBalance: (t = (n = f.skus) == null ? void 0 : n[0]) == null ? void 0 : t.toBalance,
1573
+ backdateFrom: f.effectiveAt != null ? Ie(f._id) : null,
1574
+ toBalance: (t = (o = f.skus) == null ? void 0 : o[0]) == null ? void 0 : t.toBalance,
1554
1575
  adjustmentId: f._id,
1555
- adjustmentTime: f.effectiveAt ?? Me(f._id)
1576
+ adjustmentTime: f.effectiveAt ?? Ie(f._id)
1556
1577
  };
1557
1578
  })) ?? [];
1558
1579
  }
1559
1580
  ).flatMap((f) => {
1560
1581
  var t;
1561
- const I = (t = m.bills.find((o) => o._id === f.ref)) == null ? void 0 : t.seqNumber, b = I ? h("inventory.stock.record.bill", [I]) : "", w = f.adjustmentTime ?? (/* @__PURE__ */ new Date()).toISOString(), n = d(f.adjustmentId, w);
1562
- return f.amounts.map((o) => {
1563
- var x;
1564
- let g = o.cost;
1565
- if (n) {
1566
- const C = Q.fromDinero(n), U = o.amount, O = o.measurement ? Q.multiply([U, o.measurement.conversion]) : U;
1567
- g = {
1568
- ...Q.multiply([C, O]),
1569
- currency: n.currency
1582
+ const T = (t = m.bills.find((n) => n._id === f.ref)) == null ? void 0 : t.seqNumber, g = T ? h("inventory.stock.record.bill", [T]) : "", x = f.adjustmentTime ?? (/* @__PURE__ */ new Date()).toISOString(), o = d(f.adjustmentId, x);
1583
+ return f.amounts.map((n) => {
1584
+ var C;
1585
+ let S = n.cost;
1586
+ if (o) {
1587
+ const A = Q.fromDinero(o), I = n.amount, R = n.measurement ? Q.multiply([I, n.measurement.conversion]) : I;
1588
+ S = {
1589
+ ...Q.multiply([A, R]),
1590
+ currency: o.currency
1570
1591
  };
1571
1592
  }
1572
1593
  return {
1573
- amount: `${Q.toFormatString({ value: o.amount, precision: 4 })} ${((x = o.measurement) == null ? void 0 : x.abbrev) ?? f.sku.unit.abbrev}`,
1594
+ amount: `${Q.toFormatString({ value: n.amount, precision: 4 })} ${((C = n.measurement) == null ? void 0 : C.abbrev) ?? f.sku.unit.abbrev}`,
1574
1595
  backdateFrom: f.backdateFrom,
1575
- name: o.type,
1576
- billRemark: b,
1577
- remark: o.remark || "",
1578
- cost: g,
1596
+ name: n.type,
1597
+ billRemark: g,
1598
+ remark: n.remark || "",
1599
+ cost: S,
1579
1600
  toBalance: Q.toFormatString({
1580
1601
  value: f.toBalance ?? Q.fromNumber(0),
1581
1602
  precision: 4
@@ -1586,39 +1607,39 @@ const Ge = {
1586
1607
  });
1587
1608
  })
1588
1609
  })));
1589
- return (S, i) => {
1590
- const f = T("FmIcon"), I = T("FmTooltip"), b = T("FmCard");
1591
- return j(), q(b, { variant: "outlined" }, {
1592
- default: H(() => [
1610
+ return (b, i) => {
1611
+ const f = H("FmIcon"), T = H("FmTooltip"), g = H("FmCard");
1612
+ return D(), X(g, { variant: "outlined" }, {
1613
+ default: U(() => [
1593
1614
  e("div", io, [
1594
1615
  e("div", {
1595
1616
  class: "flex items-center cursor-pointer mb-1",
1596
- onClick: i[0] || (i[0] = (w) => s.value = !s.value)
1617
+ onClick: i[0] || (i[0] = (x) => s.value = !s.value)
1597
1618
  }, [
1598
- e("div", uo, v(S.record.date), 1),
1619
+ e("div", uo, p(b.record.date), 1),
1599
1620
  y(f, {
1600
1621
  name: s.value ? "expand_more" : "expand_less",
1601
1622
  color: "#777777",
1602
1623
  size: "md"
1603
1624
  }, null, 8, ["name"])
1604
1625
  ]),
1605
- (j(!0), W(le, null, ce(l.value, (w, n) => (j(), W("div", {
1606
- key: n,
1626
+ (D(!0), W(le, null, ce(l.value, (x, o) => (D(), W("div", {
1627
+ key: o,
1607
1628
  class: "flex flex-row py-1",
1608
1629
  style: { "font-size": "0.8rem" }
1609
1630
  }, [
1610
- e("div", co, v(a(h)(`inventory.inventoryAdjustment.type.${n}`)), 1),
1631
+ e("div", co, p(a(h)(`inventory.inventoryAdjustment.type.${o}`)), 1),
1611
1632
  e("div", {
1612
- class: he({
1613
- "text-fm-color-typo-error": w.startsWith("-"),
1614
- "text-fm-color-typo-success": !w.startsWith("-"),
1633
+ class: ge({
1634
+ "text-fm-color-typo-error": x.startsWith("-"),
1635
+ "text-fm-color-typo-success": !x.startsWith("-"),
1615
1636
  "ml-auto": !0
1616
1637
  })
1617
- }, v(w), 3)
1638
+ }, p(x), 3)
1618
1639
  ]))), 128)),
1619
1640
  e("div", {
1620
1641
  ref_key: "detailRef",
1621
- ref: D,
1642
+ ref: j,
1622
1643
  style: ct({
1623
1644
  fontSize: "0.8rem",
1624
1645
  maxHeight: c.value,
@@ -1626,31 +1647,31 @@ const Ge = {
1626
1647
  transition: "max-height 0.2s ease-out"
1627
1648
  })
1628
1649
  }, [
1629
- B.value.length ? (j(), W("hr", mo)) : se("", !0),
1630
- (j(!0), W(le, null, ce(B.value, (w) => (j(), W("div", {
1631
- key: w.time,
1650
+ B.value.length ? (D(), W("hr", mo)) : se("", !0),
1651
+ (D(!0), W(le, null, ce(B.value, (x) => (D(), W("div", {
1652
+ key: x.time,
1632
1653
  class: "flex gap-1 w-full"
1633
1654
  }, [
1634
- e("div", fo, v(w.time), 1),
1635
- e("div", po, [
1636
- (j(!0), W(le, null, ce(w.adjustments, (n) => (j(), W("div", {
1637
- key: n.name,
1655
+ e("div", fo, p(x.time), 1),
1656
+ e("div", vo, [
1657
+ (D(!0), W(le, null, ce(x.adjustments, (o) => (D(), W("div", {
1658
+ key: o.name,
1638
1659
  class: "flex gap-1"
1639
1660
  }, [
1640
- e("div", vo, [
1641
- pe(v(a(h)(`inventory.inventoryAdjustment.type.${n.name}`)) + " ", 1),
1642
- n.backdateFrom ? (j(), q(I, {
1661
+ e("div", po, [
1662
+ ve(p(a(h)(`inventory.inventoryAdjustment.type.${o.name}`)) + " ", 1),
1663
+ o.backdateFrom ? (D(), X(T, {
1643
1664
  key: 0,
1644
1665
  variant: "plain",
1645
1666
  placement: "top",
1646
1667
  "z-index": 50
1647
1668
  }, {
1648
- content: H(() => [
1649
- e("div", yo, v(a(h)("inventory.stock.record.backdate", [
1650
- a(yt)(new Date(n.backdateFrom))
1669
+ content: U(() => [
1670
+ e("div", yo, p(a(h)("inventory.stock.record.backdate", [
1671
+ a(yt)(new Date(o.backdateFrom))
1651
1672
  ])), 1)
1652
1673
  ]),
1653
- default: H(() => [
1674
+ default: U(() => [
1654
1675
  y(f, {
1655
1676
  name: "info",
1656
1677
  size: "sm",
@@ -1659,26 +1680,26 @@ const Ge = {
1659
1680
  ]),
1660
1681
  _: 2
1661
1682
  }, 1024)) : se("", !0),
1662
- n.billRemark ? (j(), W("span", _o, " # " + v(n.billRemark), 1)) : se("", !0),
1663
- n.remark ? (j(), W("span", {
1683
+ o.billRemark ? (D(), W("span", _o, " # " + p(o.billRemark), 1)) : se("", !0),
1684
+ o.remark ? (D(), W("span", {
1664
1685
  key: 2,
1665
- class: he(n.billRemark ? "text-xs text-gray-400" : "")
1666
- }, v(n.billRemark ? `(${n.remark})` : `# ${n.remark}`), 3)) : se("", !0),
1667
- n.name === a(ae).Enum.CLOSING ? (j(), W("span", ko, " Actual Balance: " + v(n.toBalance) + " " + v(n.baseUnit), 1)) : se("", !0)
1686
+ class: ge(o.billRemark ? "text-xs text-gray-400" : "")
1687
+ }, p(o.billRemark ? `(${o.remark})` : `# ${o.remark}`), 3)) : se("", !0),
1688
+ o.name === a(ae).Enum.CLOSING ? (D(), W("span", ko, " Actual Balance: " + p(o.toBalance) + " " + p(o.baseUnit), 1)) : se("", !0)
1668
1689
  ]),
1669
1690
  e("div", {
1670
- class: he({
1671
- "text-fm-color-typo-error": n.amount.startsWith("-"),
1672
- "text-fm-color-typo-success": !n.amount.startsWith("-"),
1691
+ class: ge({
1692
+ "text-fm-color-typo-error": o.amount.startsWith("-"),
1693
+ "text-fm-color-typo-success": !o.amount.startsWith("-"),
1673
1694
  "ml-auto": !0
1674
1695
  })
1675
- }, v(n.amount), 3),
1676
- n.name === a(ae).Enum.WASTAGE ? (j(), q(ro, {
1696
+ }, p(o.amount), 3),
1697
+ o.name === a(ae).Enum.WASTAGE ? (D(), X(ro, {
1677
1698
  key: 0,
1678
- adjustmentId: n.adjustmentId,
1679
- onRefreshHistory: i[1] || (i[1] = (t) => S.$emit("refreshHistory"))
1699
+ adjustmentId: o.adjustmentId,
1700
+ onRefreshHistory: i[1] || (i[1] = (t) => b.$emit("refreshHistory"))
1680
1701
  }, null, 8, ["adjustmentId"])) : se("", !0),
1681
- n.cost ? (j(), W("div", ho, " (" + v(a(je)(n.cost, !1, n.cost.precision)) + ") ", 1)) : se("", !0)
1702
+ o.cost ? (D(), W("div", ho, " (" + p(a(Me)(o.cost, !1, o.cost.precision)) + ") ", 1)) : se("", !0)
1682
1703
  ]))), 128))
1683
1704
  ])
1684
1705
  ]))), 128))
@@ -1691,7 +1712,7 @@ const Ge = {
1691
1712
  }
1692
1713
  });
1693
1714
  function bo(k, m) {
1694
- var F;
1715
+ var w;
1695
1716
  const d = Object.keys(ae.enum).reduce(
1696
1717
  (c, l) => (c[l] = { amount: 0, precision: 0 }, c),
1697
1718
  {}
@@ -1701,13 +1722,13 @@ function bo(k, m) {
1701
1722
  (c, [l]) => (c[l] = Q.fromNumber(0), c),
1702
1723
  {}
1703
1724
  );
1704
- const D = k.flatMap((c) => {
1725
+ const j = k.flatMap((c) => {
1705
1726
  var l;
1706
1727
  return ((l = c.skus) == null ? void 0 : l.filter((h) => h.sku._id === m._id)) ?? [];
1707
1728
  }).flatMap((c) => c.amounts);
1708
- for (const c of D) {
1729
+ for (const c of j) {
1709
1730
  const l = c.measurement ? Q.multiply([c.measurement.conversion, c.amount]) : c.amount;
1710
- d[F = c.type] ?? (d[F] = { amount: 0, precision: 0 }), d[c.type] = Q.add([l, d[c.type]]);
1731
+ d[w = c.type] ?? (d[w] = { amount: 0, precision: 0 }), d[c.type] = Q.add([l, d[c.type]]);
1711
1732
  }
1712
1733
  return Object.entries(d).reduce(
1713
1734
  (c, [l, h]) => {
@@ -1728,15 +1749,15 @@ function xo(k, m) {
1728
1749
  if (!m)
1729
1750
  return null;
1730
1751
  let d = null;
1731
- const D = k.flatMap((F) => {
1752
+ const j = k.flatMap((w) => {
1732
1753
  var c;
1733
- return ((c = F.skus) == null ? void 0 : c.filter((l) => l.sku._id === m._id)) ?? [];
1734
- }).flatMap((F) => {
1754
+ return ((c = w.skus) == null ? void 0 : c.filter((l) => l.sku._id === m._id)) ?? [];
1755
+ }).flatMap((w) => {
1735
1756
  var c;
1736
- return !F.history || ((c = F.history) == null ? void 0 : c.length) === 0 ? [] : F.history[0];
1757
+ return !w.history || ((c = w.history) == null ? void 0 : c.length) === 0 ? [] : w.history[0];
1737
1758
  });
1738
- for (const F of D) {
1739
- const c = F.amounts;
1759
+ for (const w of j) {
1760
+ const c = w.amounts;
1740
1761
  for (const l of c) {
1741
1762
  if (l.type !== ae.Enum.SALES)
1742
1763
  continue;
@@ -1752,16 +1773,16 @@ function xo(k, m) {
1752
1773
  const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = { class: "flex-1 line-clamp-2" }, Fo = { class: "flex flex-col gap-32 w-full h-full" }, Ao = { class: "flex items-center relative gap-4" }, $o = { class: "flex-1" }, Vo = {
1753
1774
  key: 0,
1754
1775
  class: "flex-1 flex flex-col items-center gap-16"
1755
- }, Co = { class: "fm-typo-en-body-lg-400 translate-x-4" }, jo = {
1776
+ }, Co = { class: "fm-typo-en-body-lg-400 translate-x-4" }, Do = {
1756
1777
  key: 1,
1757
1778
  class: "flex flex-col gap-12"
1758
- }, Do = { class: "pb-16" }, Mo = { class: "fm-typo-cn-body-lg-600" }, Bo = {
1779
+ }, jo = { class: "pb-16" }, Mo = { class: "fm-typo-cn-body-lg-600" }, Bo = {
1759
1780
  class: "grid gap-12 fm-typo-en-body-md-400",
1760
1781
  style: { "grid-template-columns": "auto auto auto", "grid-auto-rows": "1fr" }
1761
- }, Io = { class: "flex flex-col gap-1" }, To = { class: "text-fm-color-typo-secondary" }, Uo = { class: "font-bold" }, Ho = { class: "flex flex-col gap-1" }, Eo = { class: "text-fm-color-typo-secondary flex" }, Po = { class: "font-bold" }, Ro = { class: "flex flex-col gap-1" }, Oo = { class: "text-fm-color-typo-secondary" }, No = { class: "font-bold" }, Yo = { class: "flex flex-col gap-1" }, Lo = { class: "text-fm-color-typo-secondary" }, zo = { class: "font-bold" }, Go = { class: "flex flex-col gap-1" }, Wo = { class: "text-fm-color-typo-secondary" }, Ko = { class: "font-bold" }, qo = { class: "flex flex-col gap-1" }, Xo = { class: "text-fm-color-typo-secondary" }, Jo = { class: "font-bold" }, Qo = { class: "flex flex-col gap-1" }, Zo = { class: "text-fm-color-typo-secondary" }, es = { class: "font-bold" }, ts = { class: "flex flex-col gap-1" }, ns = { class: "text-fm-color-typo-secondary" }, os = { class: "font-bold" }, ss = { class: "flex flex-col gap-1" }, as = { class: "text-fm-color-typo-secondary" }, ls = { class: "font-bold" }, rs = {
1782
+ }, Io = { class: "flex flex-col gap-1" }, To = { class: "text-fm-color-typo-secondary" }, Ho = { class: "font-bold" }, Uo = { class: "flex flex-col gap-1" }, Eo = { class: "text-fm-color-typo-secondary flex" }, Po = { class: "font-bold" }, Ro = { class: "flex flex-col gap-1" }, Oo = { class: "text-fm-color-typo-secondary" }, No = { class: "font-bold" }, Yo = { class: "flex flex-col gap-1" }, Lo = { class: "text-fm-color-typo-secondary" }, zo = { class: "font-bold" }, Go = { class: "flex flex-col gap-1" }, Wo = { class: "text-fm-color-typo-secondary" }, Ko = { class: "font-bold" }, qo = { class: "flex flex-col gap-1" }, Xo = { class: "text-fm-color-typo-secondary" }, Jo = { class: "font-bold" }, Qo = { class: "flex flex-col gap-1" }, Zo = { class: "text-fm-color-typo-secondary" }, es = { class: "font-bold" }, ts = { class: "flex flex-col gap-1" }, ns = { class: "text-fm-color-typo-secondary" }, os = { class: "font-bold" }, ss = { class: "flex flex-col gap-1" }, as = { class: "text-fm-color-typo-secondary" }, ls = { class: "font-bold" }, rs = {
1762
1783
  key: 0,
1763
1784
  class: "flex flex-col gap-8"
1764
- }, is = { class: "flex" }, us = { class: "flex-1 flex flex-col gap-1" }, cs = { class: "flex gap-1 items-center text-fm-color-typo-secondary" }, ds = { class: "font-bold" }, ms = { class: "flex-1 flex flex-col gap-1" }, fs = { class: "flex gap-1 items-center text-fm-color-typo-secondary" }, ps = { class: "flex flex-col gap-1" }, vs = { class: "font-bold" }, ys = {
1785
+ }, is = { class: "flex" }, us = { class: "flex-1 flex flex-col gap-1" }, cs = { class: "flex gap-1 items-center text-fm-color-typo-secondary" }, ds = { class: "font-bold" }, ms = { class: "flex-1 flex flex-col gap-1" }, fs = { class: "flex gap-1 items-center text-fm-color-typo-secondary" }, vs = { class: "flex flex-col gap-1" }, ps = { class: "font-bold" }, ys = {
1765
1786
  key: 2,
1766
1787
  class: "flex-1 flex flex-col items-center gap-8"
1767
1788
  }, _s = ["src"], ks = { class: "font-bold text-lg" }, hs = { class: "text-xs text-neutral-400 text-center" }, gs = /* @__PURE__ */ me({
@@ -1772,40 +1793,40 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
1772
1793
  },
1773
1794
  emits: ["update:show"],
1774
1795
  setup(k) {
1775
- const m = ft(), d = Pe(), s = Se(), D = Xn(), F = be(), c = Jt(), { t: l } = fe(), h = k, B = L(!1), S = xe(), i = L("adjustment"), f = L([
1796
+ const m = ft(), d = Oe(), s = we(), j = Xn(), w = xe(), c = Jt(), { t: l } = fe(), h = k, B = z(!1), b = Se(), i = z("adjustment"), f = z([
1776
1797
  { label: "Adjustment (Default)", value: "adjustment" }
1777
- ]), I = L([]), b = L(Kt(0));
1778
- async function w() {
1798
+ ]), T = z([]), g = z(Kt(0));
1799
+ async function x() {
1779
1800
  B.value = !0;
1780
1801
  try {
1781
- await C(), await d.readStockBalance();
1802
+ await A(), await d.readStockBalance();
1782
1803
  } catch (_) {
1783
- S.open({
1804
+ b.open({
1784
1805
  title: "Something went wrong",
1785
1806
  message: "Cannot fetch stock history. Please try again.",
1786
1807
  type: "error"
1787
- }), console.log("failed at fetching item adjustment history", h.sku, b, _);
1808
+ }), console.log("failed at fetching item adjustment history", h.sku, g, _);
1788
1809
  } finally {
1789
1810
  B.value = !1;
1790
1811
  }
1791
1812
  }
1792
1813
  qe(() => {
1793
- w();
1794
- }), Ae([() => b.value, () => h.sku], () => {
1795
- w();
1814
+ x();
1815
+ }), $e([() => g.value, () => h.sku], () => {
1816
+ x();
1796
1817
  });
1797
- const n = L([]), t = L([]), o = L(new Array());
1798
- function g(_, r) {
1818
+ const o = z([]), t = z([]), n = z(new Array());
1819
+ function S(_, r) {
1799
1820
  return r === "day" ? Wt(_) : yt(_);
1800
1821
  }
1801
- function x(_, r) {
1822
+ function C(_, r) {
1802
1823
  const M = _.reduce(
1803
1824
  (V, u) => {
1804
- const A = u.effectiveAt ?? Me(u._id);
1805
- if (!A)
1825
+ const F = u.effectiveAt ?? Ie(u._id);
1826
+ if (!F)
1806
1827
  return V;
1807
- const R = g(new Date(A), r);
1808
- return V[R] ?? (V[R] = []), V[R].push(u), V;
1828
+ const N = S(new Date(F), r);
1829
+ return V[N] ?? (V[N] = []), V[N].push(u), V;
1809
1830
  },
1810
1831
  {}
1811
1832
  );
@@ -1814,60 +1835,60 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
1814
1835
  adjustments: M[V]
1815
1836
  }));
1816
1837
  }
1817
- async function C() {
1838
+ async function A() {
1818
1839
  let _ = await s.readStockAdjustment(
1819
1840
  h.sku._id,
1820
- st(new Date(b.value.startDate)).toISOString(),
1821
- at(new Date(b.value.endDate)).toISOString()
1841
+ st(new Date(g.value.startDate)).toISOString(),
1842
+ at(new Date(g.value.endDate)).toISOString()
1822
1843
  );
1823
- n.value = _;
1844
+ o.value = _;
1824
1845
  const r = _.filter(({ ref: M }) => M == null ? void 0 : M.startsWith("bill_")).map(({ ref: M }) => M);
1825
- await U(r), t.value = x(_, "day").map(({ date: M, adjustments: V }) => ({
1846
+ await I(r), t.value = C(_, "day").map(({ date: M, adjustments: V }) => ({
1826
1847
  date: M,
1827
1848
  adjustments: V,
1828
- adjustmentsByTime: x(V, "minute")
1849
+ adjustmentsByTime: C(V, "minute")
1829
1850
  }));
1830
1851
  try {
1831
1852
  const M = await s.readUnitCostHistory(
1832
1853
  h.sku._id,
1833
- st(new Date(b.value.startDate)).toISOString(),
1834
- at(new Date(b.value.endDate)).toISOString()
1854
+ st(new Date(g.value.startDate)).toISOString(),
1855
+ at(new Date(g.value.endDate)).toISOString()
1835
1856
  );
1836
- I.value = M;
1857
+ T.value = M;
1837
1858
  const V = /* @__PURE__ */ new Set();
1838
- M.forEach((A) => {
1839
- V.add(A.mechanism);
1859
+ M.forEach((F) => {
1860
+ V.add(F.mechanism);
1840
1861
  });
1841
1862
  const u = [{ label: "Default", value: "adjustment" }];
1842
- V.has(ke.Enum.weightedAverage) && u.push({
1863
+ V.has(he.Enum.weightedAverage) && u.push({
1843
1864
  label: "Weighted Average (Beta)",
1844
- value: ke.Enum.weightedAverage
1845
- }), V.has(ke.Enum.netsuite) && u.push({ label: "NetSuite (Beta)", value: ke.Enum.netsuite }), V.has(ke.Enum["netsuite-average"]) && u.push({
1865
+ value: he.Enum.weightedAverage
1866
+ }), V.has(he.Enum.netsuite) && u.push({ label: "NetSuite (Beta)", value: he.Enum.netsuite }), V.has(he.Enum["netsuite-average"]) && u.push({
1846
1867
  label: "NetSuite Average (Beta)",
1847
- value: ke.Enum["netsuite-average"]
1868
+ value: he.Enum["netsuite-average"]
1848
1869
  }), f.value = u, !V.has(i.value) && i.value !== "adjustment" && (i.value = "adjustment");
1849
1870
  } catch (M) {
1850
1871
  console.error("Failed to fetch unit cost history:", M);
1851
1872
  }
1852
1873
  }
1853
- async function U(_) {
1854
- _.length && (o.value = await D.findBillsById(_).catch((r) => {
1874
+ async function I(_) {
1875
+ _.length && (n.value = await j.findBillsById(_).catch((r) => {
1855
1876
  var u;
1856
1877
  console.error("Error on using latest bill API, retrying using legacy api", r);
1857
- const M = ((u = m.currentBusiness.value) == null ? void 0 : u._id) ?? "", V = F.currentLocation.doc._id;
1858
- return D.findBillsByBusinessId(M, [V], _);
1878
+ const M = ((u = m.currentBusiness.value) == null ? void 0 : u._id) ?? "", V = w.currentLocation.doc._id;
1879
+ return j.findBillsByBusinessId(M, [V], _);
1859
1880
  }));
1860
1881
  }
1861
- const O = N(() => {
1862
- const _ = n.value, r = h.sku;
1882
+ const R = Y(() => {
1883
+ const _ = o.value, r = h.sku;
1863
1884
  return bo(_, r);
1864
- }), X = N(() => {
1865
- const _ = n.value, r = h.sku;
1885
+ }), K = Y(() => {
1886
+ const _ = o.value, r = h.sku;
1866
1887
  return xo(_, r);
1867
- }), z = N(() => {
1868
- const _ = [...n.value].computeFirst((M) => {
1869
- var u, A;
1870
- const V = (A = (u = M.skus) == null ? void 0 : u.find) == null ? void 0 : A.call(u, (R) => R.sku._id === h.sku._id);
1888
+ }), O = Y(() => {
1889
+ const _ = [...o.value].computeFirst((M) => {
1890
+ var u, F;
1891
+ const V = (F = (u = M.skus) == null ? void 0 : u.find) == null ? void 0 : F.call(u, (N) => N.sku._id === h.sku._id);
1871
1892
  return V == null ? void 0 : V.fromBalance;
1872
1893
  }) ?? {
1873
1894
  amount: 0,
@@ -1877,68 +1898,68 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
1877
1898
  value: _,
1878
1899
  precision: 4
1879
1900
  })} ${r.unit.abbrev}` : "";
1880
- }), Z = N(() => {
1881
- const _ = [...n.value].reverse().computeFirst((M) => {
1882
- var u, A;
1883
- const V = (A = (u = M.skus) == null ? void 0 : u.find) == null ? void 0 : A.call(u, (R) => R.sku._id === h.sku._id);
1901
+ }), Z = Y(() => {
1902
+ const _ = [...o.value].reverse().computeFirst((M) => {
1903
+ var u, F;
1904
+ const V = (F = (u = M.skus) == null ? void 0 : u.find) == null ? void 0 : F.call(u, (N) => N.sku._id === h.sku._id);
1884
1905
  return V == null ? void 0 : V.toBalance;
1885
1906
  }) ?? {
1886
1907
  amount: 0,
1887
1908
  precision: 0
1888
1909
  }, r = h.sku;
1889
1910
  return r ? `${Q.toFormatString({ value: _, precision: 4 })} ${r.unit.abbrev}` : "";
1890
- }), K = N(() => {
1911
+ }), q = Y(() => {
1891
1912
  var M;
1892
- const r = n.value.flatMap((V) => {
1913
+ const r = o.value.flatMap((V) => {
1893
1914
  var u;
1894
- return ((u = V.skus) == null ? void 0 : u.flatMap((A) => A.amounts)) ?? [];
1915
+ return ((u = V.skus) == null ? void 0 : u.flatMap((F) => F.amounts)) ?? [];
1895
1916
  }).filter((V) => V.amount.amount < 0).reduce(
1896
1917
  (V, u) => {
1897
- const A = u.cost;
1898
- if (!A) return V;
1899
- const R = {
1900
- ...Rt(V, Math.max(V.precision, A.precision)),
1901
- currency: A.currency
1918
+ const F = u.cost;
1919
+ if (!F) return V;
1920
+ const N = {
1921
+ ...Rt(V, Math.max(V.precision, F.precision)),
1922
+ currency: F.currency
1902
1923
  };
1903
1924
  return {
1904
- ...Je(R, A),
1925
+ ...Je(N, F),
1905
1926
  currency: V.currency
1906
1927
  };
1907
1928
  },
1908
1929
  {
1909
1930
  amount: 0,
1910
1931
  precision: 0,
1911
- currency: Ve((M = m.currentCountry) == null ? void 0 : M.value)
1932
+ currency: De((M = m.currentCountry) == null ? void 0 : M.value)
1912
1933
  }
1913
1934
  );
1914
- return je(r, !1, r.precision);
1935
+ return Me(r, !1, r.precision);
1915
1936
  });
1916
1937
  function ue() {
1917
- const { startDate: _, endDate: r } = zt(b.value);
1918
- _ !== null && r !== null && (b.value = {
1938
+ const { startDate: _, endDate: r } = zt(g.value);
1939
+ _ !== null && r !== null && (g.value = {
1919
1940
  startDate: _,
1920
1941
  endDate: r
1921
1942
  });
1922
1943
  }
1923
- const ee = N(() => l("inventory.ingredient.valuationMethod.WAVG"));
1924
- function p(_, r) {
1944
+ const ee = Y(() => l("inventory.ingredient.valuationMethod.WAVG"));
1945
+ function v(_, r) {
1925
1946
  if (i.value === "adjustment")
1926
1947
  return null;
1927
- const M = I.value.filter(
1928
- (A) => A.mechanism === i.value && A.skuId === h.sku._id
1948
+ const M = T.value.filter(
1949
+ (F) => F.mechanism === i.value && F.skuId === h.sku._id
1929
1950
  );
1930
1951
  if (M.length === 0) return null;
1931
- const V = M.find((A) => {
1932
- const R = A.meta;
1933
- return (R == null ? void 0 : R.adjustmentId) === _;
1952
+ const V = M.find((F) => {
1953
+ const N = F.meta;
1954
+ return (N == null ? void 0 : N.adjustmentId) === _;
1934
1955
  });
1935
1956
  if (V) return V.cost;
1936
- const u = [...M].filter((A) => new Date(A.snapshotAt) <= new Date(r)).sort((A, R) => new Date(R.snapshotAt).getTime() - new Date(A.snapshotAt).getTime());
1957
+ const u = [...M].filter((F) => new Date(F.snapshotAt) <= new Date(r)).sort((F, N) => new Date(N.snapshotAt).getTime() - new Date(F.snapshotAt).getTime());
1937
1958
  return u.length > 0 ? u[0].cost : null;
1938
1959
  }
1939
- const $ = N(() => {
1940
- var V, u, A, R, ne, re;
1941
- const _ = [...n.value].reverse().find((J) => {
1960
+ const $ = Y(() => {
1961
+ var V, u, F, N, ne, re;
1962
+ const _ = [...o.value].reverse().find((J) => {
1942
1963
  var te, oe;
1943
1964
  return (oe = (te = J.skus) == null ? void 0 : te.find) == null ? void 0 : oe.call(te, (ie) => ie.sku._id === h.sku._id);
1944
1965
  });
@@ -1949,14 +1970,14 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
1949
1970
  if (i.value === "adjustment") {
1950
1971
  const J = [...r.amounts].reverse()[0], te = {
1951
1972
  amount: ((u = J.cost) == null ? void 0 : u.amount) ?? 0,
1952
- precision: ((A = J.cost) == null ? void 0 : A.precision) ?? 0
1973
+ precision: ((F = J.cost) == null ? void 0 : F.precision) ?? 0
1953
1974
  }, oe = J.amount, ie = oe.amount == 0 ? Q.fromNumber(0) : Q.divide([te, oe]);
1954
1975
  return {
1955
1976
  ...Q.multiply([ie, M]),
1956
- currency: ((R = J.cost) == null ? void 0 : R.currency) || Ve(((ne = m.currentCountry) == null ? void 0 : ne.value) ?? et)
1977
+ currency: ((N = J.cost) == null ? void 0 : N.currency) || De(((ne = m.currentCountry) == null ? void 0 : ne.value) ?? et)
1957
1978
  };
1958
1979
  } else {
1959
- const J = _.effectiveAt ?? Me(_._id), te = p(
1980
+ const J = _.effectiveAt ?? Ie(_._id), te = v(
1960
1981
  _._id,
1961
1982
  J ?? (/* @__PURE__ */ new Date()).toISOString()
1962
1983
  );
@@ -1964,14 +1985,14 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
1964
1985
  const oe = Q.fromDinero(te);
1965
1986
  return {
1966
1987
  ...Q.multiply([oe, M]),
1967
- currency: te.currency || Ve(((re = m.currentCountry) == null ? void 0 : re.value) ?? et)
1988
+ currency: te.currency || De(((re = m.currentCountry) == null ? void 0 : re.value) ?? et)
1968
1989
  };
1969
1990
  }
1970
- }), G = N(() => {
1991
+ }), G = Y(() => {
1971
1992
  var M;
1972
- const _ = [...n.value].reverse().computeFirst((V) => {
1973
- var A, R;
1974
- const u = (R = (A = V.skus) == null ? void 0 : A.find) == null ? void 0 : R.call(A, (ne) => ne.sku._id === h.sku._id);
1993
+ const _ = [...o.value].reverse().computeFirst((V) => {
1994
+ var F, N;
1995
+ const u = (N = (F = V.skus) == null ? void 0 : F.find) == null ? void 0 : N.call(F, (ne) => ne.sku._id === h.sku._id);
1975
1996
  return u == null ? void 0 : u.toCostBalances;
1976
1997
  });
1977
1998
  return _ ? {
@@ -1979,57 +2000,57 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
1979
2000
  amount: 0,
1980
2001
  precision: 0
1981
2002
  }),
1982
- currency: Ve((M = m.currentCountry) == null ? void 0 : M.value)
2003
+ currency: De((M = m.currentCountry) == null ? void 0 : M.value)
1983
2004
  } : "No data";
1984
- }), P = N(() => h.sku.valuation === tt.Enum.FIFO ? G.value : $.value);
1985
- function Y() {
1986
- const { startDate: _, endDate: r } = Gt(b.value);
1987
- _ !== null && r !== null && (b.value = {
2005
+ }), P = Y(() => h.sku.valuation === tt.Enum.FIFO ? G.value : $.value);
2006
+ function L() {
2007
+ const { startDate: _, endDate: r } = Gt(g.value);
2008
+ _ !== null && r !== null && (g.value = {
1988
2009
  startDate: _,
1989
2010
  endDate: r
1990
2011
  });
1991
2012
  }
1992
- const E = Oe(h, "show");
2013
+ const E = Ye(h, "show");
1993
2014
  return (_, r) => {
1994
- const M = T("FmButton"), V = T("FmField"), u = T("FmDateRangePicker"), A = T("FmSpacer"), R = T("FmCircularProgress"), ne = T("FmIcon"), re = T("FmTooltip"), J = T("FmMenuDivider"), te = T("FmChip"), oe = T("FmSelect"), ie = T("FmCardSection"), we = T("FmCard"), gt = T("FmSideSheet");
1995
- return j(), q(gt, {
2015
+ const M = H("FmButton"), V = H("FmField"), u = H("FmDateRangePicker"), F = H("FmSpacer"), N = H("FmCircularProgress"), ne = H("FmIcon"), re = H("FmTooltip"), J = H("FmMenuDivider"), te = H("FmChip"), oe = H("FmSelect"), ie = H("FmCardSection"), Fe = H("FmCard"), gt = H("FmSideSheet");
2016
+ return D(), X(gt, {
1996
2017
  "dismiss-away": "",
1997
2018
  modelValue: a(E),
1998
- "onUpdate:modelValue": r[5] || (r[5] = (Fe) => Ue(E) ? E.value = Fe : null),
2019
+ "onUpdate:modelValue": r[5] || (r[5] = (Ae) => Ee(E) ? E.value = Ae : null),
1999
2020
  "close-button": !1,
2000
2021
  "max-width": 560
2001
2022
  }, {
2002
- "side-sheet-header": H(() => [
2023
+ "side-sheet-header": U(() => [
2003
2024
  e("div", So, [
2004
- e("div", wo, v(a(l)("inventory.stock.history.title", [_.sku.name])), 1),
2025
+ e("div", wo, p(a(l)("inventory.stock.history.title", [_.sku.name])), 1),
2005
2026
  y(M, {
2006
2027
  variant: "tertiary",
2007
2028
  "prepend-icon": "close",
2008
- onClick: r[0] || (r[0] = (Fe) => E.value = !1)
2029
+ onClick: r[0] || (r[0] = (Ae) => E.value = !1)
2009
2030
  })
2010
2031
  ])
2011
2032
  ]),
2012
- default: H(() => {
2013
- var Fe;
2033
+ default: U(() => {
2034
+ var Ae;
2014
2035
  return [
2015
2036
  e("div", Fo, [
2016
2037
  e("div", Ao, [
2017
2038
  e("div", $o, [
2018
2039
  y(u, {
2019
- modelValue: b.value,
2020
- "onUpdate:modelValue": r[1] || (r[1] = (de) => b.value = de),
2040
+ modelValue: g.value,
2041
+ "onUpdate:modelValue": r[1] || (r[1] = (de) => g.value = de),
2021
2042
  "show-predefined-range": "",
2022
2043
  "start-label": "",
2023
2044
  "end-label": "",
2024
2045
  "z-index": 50
2025
2046
  }, {
2026
- "trigger-button": H(({ opened: de }) => [
2047
+ "trigger-button": U(({ opened: de }) => [
2027
2048
  y(V, {
2028
2049
  "prepend-icon": "calendar_month",
2029
2050
  focused: de
2030
2051
  }, {
2031
- default: H(() => [
2032
- pe(v(b.value.startDate) + " - " + v(b.value.endDate), 1)
2052
+ default: U(() => [
2053
+ ve(p(g.value.startDate) + " - " + p(g.value.endDate), 1)
2033
2054
  ]),
2034
2055
  _: 2
2035
2056
  }, 1032, ["focused"])
@@ -2044,40 +2065,40 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
2044
2065
  }),
2045
2066
  y(M, {
2046
2067
  variant: "tertiary",
2047
- onClick: r[3] || (r[3] = (de) => Y()),
2068
+ onClick: r[3] || (r[3] = (de) => L()),
2048
2069
  "prepend-icon": "navigate_next"
2049
2070
  })
2050
2071
  ]),
2051
- B.value ? (j(), W("div", Vo, [
2052
- y(A),
2053
- y(R, { size: "xl" }),
2054
- e("div", Co, v(a(l)("inventory.stock.history.loading")), 1),
2055
- y(A),
2056
- y(A)
2057
- ])) : t.value && ((Fe = t.value) == null ? void 0 : Fe.length) > 0 ? (j(), W("div", jo, [
2058
- y(we, { variant: "outlined" }, {
2059
- default: H(() => [
2072
+ B.value ? (D(), W("div", Vo, [
2073
+ y(F),
2074
+ y(N, { size: "xl" }),
2075
+ e("div", Co, p(a(l)("inventory.stock.history.loading")), 1),
2076
+ y(F),
2077
+ y(F)
2078
+ ])) : t.value && ((Ae = t.value) == null ? void 0 : Ae.length) > 0 ? (D(), W("div", Do, [
2079
+ y(Fe, { variant: "outlined" }, {
2080
+ default: U(() => [
2060
2081
  y(ie, { class: "flex flex-col gap-4" }, {
2061
- default: H(() => [
2062
- e("div", Do, [
2063
- e("div", Mo, v(a(l)("inventory.stock.history.summary.title")), 1)
2082
+ default: U(() => [
2083
+ e("div", jo, [
2084
+ e("div", Mo, p(a(l)("inventory.stock.history.summary.title")), 1)
2064
2085
  ]),
2065
2086
  e("div", Bo, [
2066
2087
  e("div", Io, [
2067
- e("div", To, v(a(l)("inventory.stock.history.summary.totalPurchase")), 1),
2068
- e("div", Uo, v(O.value.PURCHASE), 1)
2088
+ e("div", To, p(a(l)("inventory.stock.history.summary.totalPurchase")), 1),
2089
+ e("div", Ho, p(R.value.PURCHASE), 1)
2069
2090
  ]),
2070
- e("div", Ho, [
2091
+ e("div", Uo, [
2071
2092
  e("div", Eo, [
2072
- pe(v(a(l)("inventory.stock.history.summary.totalSales")) + "  ", 1),
2073
- X.value != null ? (j(), q(re, {
2093
+ ve(p(a(l)("inventory.stock.history.summary.totalSales")) + "  ", 1),
2094
+ K.value != null ? (D(), X(re, {
2074
2095
  key: 0,
2075
2096
  variant: "plain",
2076
2097
  placement: "top",
2077
- content: `Before: ${X.value}`,
2098
+ content: `Before: ${K.value}`,
2078
2099
  "z-index": 50
2079
2100
  }, {
2080
- default: H(() => [
2101
+ default: U(() => [
2081
2102
  y(ne, {
2082
2103
  name: "warning",
2083
2104
  size: "sm"
@@ -2086,52 +2107,52 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
2086
2107
  _: 1
2087
2108
  }, 8, ["content"])) : se("", !0)
2088
2109
  ]),
2089
- e("div", Po, v(O.value.SALES), 1)
2110
+ e("div", Po, p(R.value.SALES), 1)
2090
2111
  ]),
2091
2112
  e("div", Ro, [
2092
- e("div", Oo, v(a(l)("inventory.stock.history.summary.totalLose")), 1),
2093
- e("div", No, v(O.value.LOSE), 1)
2113
+ e("div", Oo, p(a(l)("inventory.stock.history.summary.totalLose")), 1),
2114
+ e("div", No, p(R.value.LOSE), 1)
2094
2115
  ]),
2095
2116
  e("div", Yo, [
2096
- e("div", Lo, v(a(l)("inventory.stock.history.summary.totalRequest")), 1),
2097
- e("div", zo, v(O.value.REQUEST), 1)
2117
+ e("div", Lo, p(a(l)("inventory.stock.history.summary.totalRequest")), 1),
2118
+ e("div", zo, p(R.value.REQUEST), 1)
2098
2119
  ]),
2099
2120
  e("div", Go, [
2100
- e("div", Wo, v(a(l)("inventory.stock.history.summary.totalReceive")), 1),
2101
- e("div", Ko, v(O.value.RECEIVE), 1)
2121
+ e("div", Wo, p(a(l)("inventory.stock.history.summary.totalReceive")), 1),
2122
+ e("div", Ko, p(R.value.RECEIVE), 1)
2102
2123
  ]),
2103
2124
  e("div", qo, [
2104
- e("div", Xo, v(a(l)("inventory.stock.history.summary.totalConvert")), 1),
2105
- e("div", Jo, v(O.value.CONVERT), 1)
2125
+ e("div", Xo, p(a(l)("inventory.stock.history.summary.totalConvert")), 1),
2126
+ e("div", Jo, p(R.value.CONVERT), 1)
2106
2127
  ]),
2107
2128
  e("div", Qo, [
2108
- e("div", Zo, v(a(l)("inventory.stock.history.summary.totalDamage")), 1),
2109
- e("div", es, v(O.value.DAMAGE), 1)
2129
+ e("div", Zo, p(a(l)("inventory.stock.history.summary.totalDamage")), 1),
2130
+ e("div", es, p(R.value.DAMAGE), 1)
2110
2131
  ]),
2111
2132
  e("div", ts, [
2112
- e("div", ns, v(a(l)("inventory.stock.history.summary.openingBalance")), 1),
2113
- e("div", os, v(z.value), 1)
2133
+ e("div", ns, p(a(l)("inventory.stock.history.summary.openingBalance")), 1),
2134
+ e("div", os, p(O.value), 1)
2114
2135
  ]),
2115
2136
  e("div", ss, [
2116
- e("div", as, v(a(l)("inventory.stock.history.summary.lastStockBalance")), 1),
2117
- e("div", ls, v(Z.value), 1)
2137
+ e("div", as, p(a(l)("inventory.stock.history.summary.lastStockBalance")), 1),
2138
+ e("div", ls, p(Z.value), 1)
2118
2139
  ])
2119
2140
  ]),
2120
- a(c).enableTotalCost ? (j(), W("div", rs, [
2141
+ a(c).enableTotalCost ? (D(), W("div", rs, [
2121
2142
  y(J, { class: "w-full" }),
2122
2143
  e("div", is, [
2123
2144
  e("div", us, [
2124
2145
  y(nt, { "z-index": 50 }, {
2125
- default: H(() => [
2146
+ default: U(() => [
2126
2147
  e("div", cs, [
2127
- pe(v(a(l)("inventory.stock.history.estimatedValue")) + " ", 1),
2148
+ ve(p(a(l)("inventory.stock.history.estimatedValue")) + " ", 1),
2128
2149
  y(re, {
2129
2150
  variant: "plain",
2130
2151
  placement: "top",
2131
2152
  content: `[${ee.value}] ${a(l)("inventory.stock.history.estimatedValueTooltip")}`,
2132
2153
  "z-index": 50
2133
2154
  }, {
2134
- default: H(() => [
2155
+ default: U(() => [
2135
2156
  y(ne, {
2136
2157
  name: "help",
2137
2158
  size: "sm"
@@ -2144,18 +2165,18 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
2144
2165
  _: 1
2145
2166
  }),
2146
2167
  e("div", ds, [
2147
- _.sku.valuation === a(tt).Enum.FIFO ? (j(), W(le, { key: 0 }, [
2168
+ _.sku.valuation === a(tt).Enum.FIFO ? (D(), W(le, { key: 0 }, [
2148
2169
  y(te, {
2149
2170
  label: "FIFO",
2150
2171
  compact: ""
2151
2172
  }),
2152
- pe(" " + v(typeof P.value != "string" ? a(je)(
2173
+ ve(" " + p(typeof P.value != "string" ? a(Me)(
2153
2174
  P.value,
2154
2175
  !1,
2155
2176
  P.value.precision
2156
2177
  ) : P.value), 1)
2157
- ], 64)) : (j(), W(le, { key: 1 }, [
2158
- pe(v(typeof P.value != "string" ? a(je)(
2178
+ ], 64)) : (D(), W(le, { key: 1 }, [
2179
+ ve(p(typeof P.value != "string" ? a(Me)(
2159
2180
  P.value,
2160
2181
  !1,
2161
2182
  P.value.precision
@@ -2173,18 +2194,18 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
2173
2194
  ]),
2174
2195
  e("div", ms, [
2175
2196
  y(nt, { "z-index": 50 }, {
2176
- default: H(() => [
2197
+ default: U(() => [
2177
2198
  e("div", fs, [
2178
- pe(v(a(l)("inventory.stock.history.costSold")) + " ", 1),
2199
+ ve(p(a(l)("inventory.stock.history.costSold")) + " ", 1),
2179
2200
  y(re, {
2180
2201
  variant: "plain",
2181
2202
  placement: "top",
2182
2203
  "z-index": 50
2183
2204
  }, {
2184
- content: H(() => [
2185
- e("div", ps, v(a(l)("inventory.stock.history.costSoldTooltip")), 1)
2205
+ content: U(() => [
2206
+ e("div", vs, p(a(l)("inventory.stock.history.costSoldTooltip")), 1)
2186
2207
  ]),
2187
- default: H(() => [
2208
+ default: U(() => [
2188
2209
  y(ne, {
2189
2210
  name: "help",
2190
2211
  size: "sm"
@@ -2196,7 +2217,7 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
2196
2217
  ]),
2197
2218
  _: 1
2198
2219
  }),
2199
- e("div", vs, v(K.value), 1)
2220
+ e("div", ps, p(q.value), 1)
2200
2221
  ])
2201
2222
  ])
2202
2223
  ])) : se("", !0)
@@ -2207,31 +2228,31 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
2207
2228
  _: 1
2208
2229
  }),
2209
2230
  r[6] || (r[6] = e("div", null, null, -1)),
2210
- (j(!0), W(le, null, ce(t.value, (de) => (j(), W(le, {
2231
+ (D(!0), W(le, null, ce(t.value, (de) => (D(), W(le, {
2211
2232
  key: de.date
2212
2233
  }, [
2213
- _.sku ? (j(), q(go, {
2234
+ _.sku ? (D(), X(go, {
2214
2235
  key: 0,
2215
2236
  record: de,
2216
2237
  sku: _.sku,
2217
- bills: o.value,
2218
- "unit-cost-history": I.value,
2238
+ bills: n.value,
2239
+ "unit-cost-history": T.value,
2219
2240
  "cost-mechanism": i.value,
2220
- onRefreshHistory: w
2241
+ onRefreshHistory: x
2221
2242
  }, null, 8, ["record", "sku", "bills", "unit-cost-history", "cost-mechanism"])) : se("", !0)
2222
2243
  ], 64))), 128))
2223
- ])) : (j(), W("div", ys, [
2224
- y(A),
2244
+ ])) : (D(), W("div", ys, [
2245
+ y(F),
2225
2246
  e("div", null, [
2226
2247
  e("img", {
2227
2248
  src: a(Xt),
2228
2249
  alt: "List is empty"
2229
2250
  }, null, 8, _s)
2230
2251
  ]),
2231
- e("div", ks, v(a(l)("inventory.stock.history.noRecords")), 1),
2232
- e("div", hs, v(a(l)("inventory.stock.history.changeDateRange")), 1),
2233
- y(A),
2234
- y(A)
2252
+ e("div", ks, p(a(l)("inventory.stock.history.noRecords")), 1),
2253
+ e("div", hs, p(a(l)("inventory.stock.history.changeDateRange")), 1),
2254
+ y(F),
2255
+ y(F)
2235
2256
  ]))
2236
2257
  ])
2237
2258
  ];
@@ -2246,13 +2267,13 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
2246
2267
  }, xs = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ss = { class: "flex flex-col gap-8" }, ws = { class: "flex flex-col" }, Fs = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, As = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary line-clamp-1" }, Qs = /* @__PURE__ */ me({
2247
2268
  __name: "StockView",
2248
2269
  setup(k) {
2249
- const { t: m } = fe(), d = Ee(), s = be(), D = Pe(), F = kt(), c = Se(), l = dt(), h = Zt(), { columnDefs: B } = un(), S = Re(), i = xe();
2250
- s.watchLocation(w);
2251
- const f = N(
2270
+ const { t: m } = fe(), d = Re(), s = xe(), j = Oe(), w = kt(), c = we(), l = dt(), h = Zt(), { columnDefs: B } = un(), b = Ne(), i = Se();
2271
+ s.watchLocation(x);
2272
+ const f = Y(
2252
2273
  () => new Set(h.getAvailableItems(h.businessSubsidiaryId))
2253
- ), I = L(!1);
2254
- async function b() {
2255
- S.open({
2274
+ ), T = z(!1);
2275
+ async function g() {
2276
+ b.open({
2256
2277
  title: m("inventory.stock.stock_balance.refreshBalance"),
2257
2278
  message: m("inventory.stock.stock_balance.refreshBalanceDescription"),
2258
2279
  closeButton: !0,
@@ -2273,11 +2294,11 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
2273
2294
  });
2274
2295
  });
2275
2296
  }
2276
- async function w() {
2297
+ async function x() {
2277
2298
  if (s._currentLocation) {
2278
- I.value = !0;
2299
+ T.value = !0;
2279
2300
  try {
2280
- await D.readStockBalance(), await D.readProductBalance(), await l.readStockEstimateBalance();
2301
+ await j.readStockBalance(), await j.readProductBalance(), await l.readStockEstimateBalance();
2281
2302
  } catch (ee) {
2282
2303
  i.open({
2283
2304
  title: m("inventory.stock.error.title"),
@@ -2285,18 +2306,18 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
2285
2306
  type: "error"
2286
2307
  }), console.error("error on fetch stock balance", ee);
2287
2308
  } finally {
2288
- I.value = !1;
2309
+ T.value = !1;
2289
2310
  }
2290
2311
  }
2291
2312
  }
2292
- const n = N(() => [
2313
+ const o = Y(() => [
2293
2314
  {
2294
2315
  type: "string",
2295
2316
  key: "status",
2296
2317
  entity: "sku",
2297
2318
  values: ["Active", "Inactive"]
2298
2319
  }
2299
- ]), t = L({
2320
+ ]), t = z({
2300
2321
  logic: "AND",
2301
2322
  rules: [
2302
2323
  {
@@ -2306,37 +2327,37 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
2306
2327
  type: "string"
2307
2328
  }
2308
2329
  ]
2309
- }), o = N(() => {
2330
+ }), n = Y(() => {
2310
2331
  var $, G, P;
2311
- const ee = t.value ? en.build(t.value) : null, p = [];
2312
- for (const Y of d.skus) {
2332
+ const ee = t.value ? en.build(t.value) : null, v = [];
2333
+ for (const L of d.skus) {
2313
2334
  let E = !0;
2314
- if (h.isEnabled && x.value && f.value && E && (E = f.value.has(Y._id)), ee && E && (E = tn(
2335
+ if (h.isEnabled && C.value && f.value && E && (E = f.value.has(L._id)), ee && E && (E = tn(
2315
2336
  {
2316
- status: Y.isInactive ? "Inactive" : "Active"
2337
+ status: L.isInactive ? "Inactive" : "Active"
2317
2338
  },
2318
2339
  ee
2319
2340
  )), E) {
2320
- const _ = Y.trackingMeasurement;
2321
- let r = (G = ($ = D.stockBalance.skus) == null ? void 0 : $.find(
2322
- (u) => u.id === Y._id
2341
+ const _ = L.trackingMeasurement;
2342
+ let r = (G = ($ = j.stockBalance.skus) == null ? void 0 : $.find(
2343
+ (u) => u.id === L._id
2323
2344
  )) == null ? void 0 : G.balance, M = l.inventoryForecast.skus.find(
2324
- (u) => u.id === Y._id
2345
+ (u) => u.id === L._id
2325
2346
  );
2326
2347
  const V = {
2327
- ...Y,
2348
+ ...L,
2328
2349
  balance: r ?? {
2329
2350
  amount: 0,
2330
2351
  precision: 0
2331
2352
  },
2332
2353
  day: (M == null ? void 0 : M.depletionDays) ?? void 0,
2333
- trackingUnitAbbrev: _ ? ((P = Y.unit.measurements.find((u) => u.id === _)) == null ? void 0 : P.abbrev) ?? "" : Y.unit.abbrev
2354
+ trackingUnitAbbrev: _ ? ((P = L.unit.measurements.find((u) => u.id === _)) == null ? void 0 : P.abbrev) ?? "" : L.unit.abbrev
2334
2355
  };
2335
- p.push(V);
2356
+ v.push(V);
2336
2357
  }
2337
2358
  }
2338
- return p;
2339
- }), g = L(""), x = L(!0), { breakpoints: C } = Bt(), U = N(() => C.value.xs || C.value.sm), O = N(() => U.value ? 10 : 20), X = St(), z = N(() => [
2359
+ return v;
2360
+ }), S = z(""), C = z(!0), { breakpoints: A } = Bt(), I = Y(() => A.value.xs || A.value.sm), R = Y(() => I.value ? 10 : 20), K = St(), O = Y(() => [
2340
2361
  {
2341
2362
  label: m("inventory.stock.stock_balance.refreshBalance"),
2342
2363
  value: "refresh-balance",
@@ -2356,61 +2377,61 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
2356
2377
  value: "stockAdjustment",
2357
2378
  isAdminOnly: !0
2358
2379
  }
2359
- ]), Z = L(!1);
2360
- function K() {
2380
+ ]), Z = z(!1);
2381
+ function q() {
2361
2382
  Z.value = !0;
2362
2383
  }
2363
2384
  function ue(ee) {
2364
2385
  switch (ee) {
2365
2386
  case "refresh-balance":
2366
- return b();
2387
+ return g();
2367
2388
  case "refresh":
2368
- return w();
2389
+ return x();
2369
2390
  case "export":
2370
- return sn(o.value);
2391
+ return sn(n.value);
2371
2392
  case "stockAdjustment":
2372
- return K();
2393
+ return q();
2373
2394
  }
2374
2395
  }
2375
- return (ee, p) => {
2376
- const $ = T("FmSwitch"), G = T("FmTable");
2377
- return j(), q(wt, {
2396
+ return (ee, v) => {
2397
+ const $ = H("FmSwitch"), G = H("FmTable");
2398
+ return D(), X(wt, {
2378
2399
  title: a(m)("inventory.stock.title"),
2379
- actions: z.value,
2400
+ actions: O.value,
2380
2401
  "onClick:action": ue
2381
2402
  }, {
2382
- default: H(() => {
2383
- var P, Y, E, _;
2403
+ default: U(() => {
2404
+ var P, L, E, _;
2384
2405
  return [
2385
2406
  e("div", {
2386
- class: he([
2407
+ class: ge([
2387
2408
  "flex flex-col gap-8 max-h-full",
2388
2409
  {
2389
- "p-0": U.value,
2390
- "px-24 ": !U.value
2410
+ "p-0": I.value,
2411
+ "px-24 ": !I.value
2391
2412
  }
2392
2413
  ])
2393
2414
  }, [
2394
2415
  y(qt, {
2395
2416
  searchable: "",
2396
2417
  "change-location": "",
2397
- search: g.value,
2398
- "onUpdate:search": p[1] || (p[1] = (r) => g.value = r),
2418
+ search: S.value,
2419
+ "onUpdate:search": v[1] || (v[1] = (r) => S.value = r),
2399
2420
  "hide-filter-options": !0,
2400
2421
  filterable: "",
2401
- "filter-attributes": n.value,
2422
+ "filter-attributes": o.value,
2402
2423
  filter: t.value,
2403
- "onUpdate:filter": p[2] || (p[2] = (r) => t.value = r)
2424
+ "onUpdate:filter": v[2] || (v[2] = (r) => t.value = r)
2404
2425
  }, {
2405
- default: H(() => [
2406
- a(h).isEnabled ? (j(), W("div", bs, [
2407
- e("span", xs, v(a(m)("inventory.integration.netsuite.subsidiaryHierarchy.filtering")), 1),
2408
- y(Dt),
2426
+ default: U(() => [
2427
+ a(h).isEnabled ? (D(), W("div", bs, [
2428
+ e("span", xs, p(a(m)("inventory.integration.netsuite.subsidiaryHierarchy.filtering")), 1),
2429
+ y(jt),
2409
2430
  y(Xe, null, {
2410
- default: H(() => [
2431
+ default: U(() => [
2411
2432
  y($, {
2412
- modelValue: x.value,
2413
- "onUpdate:modelValue": p[0] || (p[0] = (r) => x.value = r)
2433
+ modelValue: C.value,
2434
+ "onUpdate:modelValue": v[0] || (v[0] = (r) => C.value = r)
2414
2435
  }, null, 8, ["modelValue"])
2415
2436
  ]),
2416
2437
  _: 1
@@ -2419,30 +2440,30 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
2419
2440
  ]),
2420
2441
  _: 1
2421
2442
  }, 8, ["search", "filter-attributes", "filter"]),
2422
- (j(), q(G, {
2423
- style: ct(a(X).tableHeight),
2443
+ (D(), X(G, {
2444
+ style: ct(a(K).tableHeight),
2424
2445
  "column-defs": a(B),
2425
- "row-data": o.value,
2426
- "search-value": g.value,
2427
- loading: I.value || !a(s)._currentLocation,
2446
+ "row-data": n.value,
2447
+ "search-value": S.value,
2448
+ loading: T.value || !a(s)._currentLocation,
2428
2449
  key: (P = a(s)._currentLocation) == null ? void 0 : P.dbName,
2429
- onRowClick: p[3] || (p[3] = (r) => a(F).showSkuHistory(r.original)),
2430
- "page-size": O.value
2450
+ onRowClick: v[3] || (v[3] = (r) => a(w).showSkuHistory(r.original)),
2451
+ "page-size": R.value
2431
2452
  }, {
2432
- "list-row": H((r) => [
2453
+ "list-row": U((r) => [
2433
2454
  y(Qt, {
2434
2455
  row: r,
2435
- onRowClick: a(F).showSkuHistory
2456
+ onRowClick: a(w).showSkuHistory
2436
2457
  }, {
2437
- default: H((M) => {
2438
- var V, u, A, R, ne, re, J, te, oe, ie;
2458
+ default: U((M) => {
2459
+ var V, u, F, N, ne, re, J, te, oe, ie;
2439
2460
  return [
2440
2461
  e("div", Ss, [
2441
2462
  e("div", ws, [
2442
2463
  e("div", Fs, [
2443
2464
  y(a(lt), {
2444
- render: (A = (u = (V = M.code) == null ? void 0 : V.column) == null ? void 0 : u.columnDef) == null ? void 0 : A.cell,
2445
- props: (ne = (R = M.code) == null ? void 0 : R.getContext) == null ? void 0 : ne.call(R)
2465
+ render: (F = (u = (V = M.code) == null ? void 0 : V.column) == null ? void 0 : u.columnDef) == null ? void 0 : F.cell,
2466
+ props: (ne = (N = M.code) == null ? void 0 : N.getContext) == null ? void 0 : ne.call(N)
2446
2467
  }, null, 8, ["render", "props"])
2447
2468
  ]),
2448
2469
  e("div", As, [
@@ -2453,7 +2474,7 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
2453
2474
  ])
2454
2475
  ]),
2455
2476
  e("div", null, [
2456
- y(We, {
2477
+ y(Ke, {
2457
2478
  days: r.original.day
2458
2479
  }, null, 8, ["days"])
2459
2480
  ]),
@@ -2475,15 +2496,15 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
2475
2496
  _: 1
2476
2497
  }, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"]))
2477
2498
  ], 2),
2478
- (j(), q(xt, { to: "body" }, [
2479
- (Y = a(F).stockHistoryProps) != null && Y.sku ? (j(), q(gs, Ne(Ye({ key: 0 }, a(F).stockHistoryProps)), null, 16)) : se("", !0),
2480
- (E = a(F).convertSkuDialogProps) != null && E.sku ? (j(), q(wn, Ne(Ye({ key: 1 }, a(F).convertSkuDialogProps)), null, 16)) : se("", !0),
2481
- (_ = a(F).adjustSkuDialogProps) != null && _.stock ? (j(), q(Un, Ne(Ye({ key: 2 }, a(F).adjustSkuDialogProps)), null, 16)) : se("", !0),
2482
- Z.value ? (j(), q(qn, {
2499
+ (D(), X(xt, { to: "body" }, [
2500
+ (L = a(w).stockHistoryProps) != null && L.sku ? (D(), X(gs, Le(ze({ key: 0 }, a(w).stockHistoryProps)), null, 16)) : se("", !0),
2501
+ (E = a(w).convertSkuDialogProps) != null && E.sku ? (D(), X(wn, Le(ze({ key: 1 }, a(w).convertSkuDialogProps)), null, 16)) : se("", !0),
2502
+ (_ = a(w).adjustSkuDialogProps) != null && _.stock ? (D(), X(Hn, Le(ze({ key: 2 }, a(w).adjustSkuDialogProps)), null, 16)) : se("", !0),
2503
+ Z.value ? (D(), X(qn, {
2483
2504
  key: 3,
2484
2505
  show: Z.value,
2485
- "onUpdate:show": p[4] || (p[4] = (r) => Z.value = r),
2486
- onSubmitted: p[5] || (p[5] = (r) => w())
2506
+ "onUpdate:show": v[4] || (v[4] = (r) => Z.value = r),
2507
+ onSubmitted: v[5] || (v[5] = (r) => x())
2487
2508
  }, null, 8, ["show"])) : se("", !0)
2488
2509
  ]))
2489
2510
  ];