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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (131) hide show
  1. package/dist/{App-Nwc0Ha2r.js → App-B_yr-6yL.js} +82 -78
  2. package/dist/{ApprovalView-Y5f915s3.js → ApprovalView-DoYBBuSD.js} +5 -5
  3. package/dist/{BindingsDialog-5N7R_u4c.js → BindingsDialog-DG7HOy6J.js} +5 -5
  4. package/dist/{BindingsPicker-BJwvLu2s.js → BindingsPicker-DVCYpyrR.js} +3 -3
  5. package/dist/{BindingsTable-B8sq-qXH.js → BindingsTable-CCel2b_W.js} +5 -5
  6. package/dist/{ClosingDraftView-BsyYOZsz.js → ClosingDraftView-CfM7gNBX.js} +891 -893
  7. package/dist/{ClosingHistoryView-BNpsMNy1.js → ClosingHistoryView-DWH4bFgg.js} +36 -36
  8. package/dist/{ClosingTemplateView-BBqbq07d.js → ClosingTemplateView-JYnnvm7L.js} +14 -14
  9. package/dist/{DeliveryOrderPrintPreview-CmOO7wuE.js → DeliveryOrderPrintPreview-BihBTJGj.js} +7 -7
  10. package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-BXlY-Gu1.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-CWjtQajS.js} +17 -17
  11. package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-CAMkZRFI.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-CUIrR73y.js} +2 -2
  12. package/dist/{FmMultiselectDialog-CwJUv9tG.js → FmMultiselectDialog-CxDviJZM.js} +16 -16
  13. package/dist/{FmMultiselectDialog-LagHyTQP.js → FmMultiselectDialog-D51nW6yj.js} +1 -1
  14. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-BmHFIkt1.js → FmUnitInput.vue_vue_type_script_setup_true_lang-DLqUnROc.js} +16 -15
  15. package/dist/{ImportView-wQ_bNesb.js → ImportView-C52rZFib.js} +6 -6
  16. package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-DtMrJIVs.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-CjZmd-Sa.js} +1 -1
  17. package/dist/{IngredientGroupView-DsGMhdwu.js → IngredientGroupView-DTHpZP2L.js} +5 -5
  18. package/dist/{IngredientsView-JdjcLdOx.js → IngredientsView-CrCW6heJ.js} +25 -24
  19. package/dist/{IntegrationView-CMmSIRUk.js → IntegrationView--DZANrHj.js} +18 -17
  20. package/dist/{InventoryBindingForm-UL-UKtYW.js → InventoryBindingForm-DLTpv-zQ.js} +1 -1
  21. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-r875PDKP.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-hkIg4Rbp.js} +17 -16
  22. package/dist/{InventoryBindingSummary-BDAuT62b.js → InventoryBindingSummary-D9ptV8Cw.js} +1 -1
  23. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-C5zOYiqR.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-CdPxhkg0.js} +5 -5
  24. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-B2zppgqk.js → PremiumBadge.vue_vue_type_script_setup_true_lang-Ci3esisT.js} +2 -2
  25. package/dist/{PublishView-CSoZCSHT.js → PublishView-DxzL_D61.js} +8 -8
  26. package/dist/{PurchaseOrderPrintPreview-D5Qw44xo.js → PurchaseOrderPrintPreview-D0tg-2TC.js} +11 -11
  27. package/dist/{ReceiveRequestView-Chntp08E.js → ReceiveRequestView-2U534J1_.js} +251 -250
  28. package/dist/RecipeView-VZRyX3Mm.js +1558 -0
  29. package/dist/{StockView-CuCK7tD2.js → StockView-CvWbnYGz.js} +653 -651
  30. package/dist/SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-CxjceLuZ.js +183 -0
  31. package/dist/{SupplierView-CA17Tz02.js → SupplierView-DMIunLvv.js} +20 -19
  32. package/dist/{SurchargeView-EIftjMCa.js → SurchargeView-jteWYvQz.js} +6 -6
  33. package/dist/{SystemTrailDialog.vue_vue_type_script_setup_true_lang-CqA6RmPy.js → SystemTrailDialog.vue_vue_type_script_setup_true_lang-CyoUVoDH.js} +2 -2
  34. package/dist/{TemplatePublishDialog.vue_vue_type_script_setup_true_lang-CYXsAP0i.js → TemplatePublishDialog.vue_vue_type_script_setup_true_lang-DAkKiy0Z.js} +1 -1
  35. package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-BbbAEIcW.js → TransferDetails.vue_vue_type_script_setup_true_lang-CEXA3vvS.js} +77 -78
  36. package/dist/{TransferTemplateView-CYfbm9aS.js → TransferTemplateView-DMQ1WIij.js} +22 -21
  37. package/dist/UnitCostHistoryView-DQ3sXVAQ.js +651 -0
  38. package/dist/{UnitView-6s5CsGEQ.js → UnitView-p6eZ8G2C.js} +9 -9
  39. package/dist/{WarehouseView-BXDQOyFZ.js → WarehouseView-BIShkEPs.js} +5 -5
  40. package/dist/{WastageTemplateView-Cq92TiRs.js → WastageTemplateView-DCbczB_0.js} +14 -14
  41. package/dist/api/inventory.d.ts +126 -36
  42. package/dist/api/netsuite.d.ts +8 -1
  43. package/dist/api/stock-estimate.d.ts +2 -0
  44. package/dist/api/unit-cost-history.d.ts +28 -0
  45. package/dist/{app-DJuq_faF.js → app-BAVBNKKH.js} +7461 -6448
  46. package/dist/app.d.ts +236 -0
  47. package/dist/app.js +1 -1
  48. package/dist/{closing-template-D_zbp5V1.js → closing-template-DqxA750a.js} +1 -1
  49. package/dist/components/StockForecastProps.d.ts +6 -0
  50. package/dist/components/inventory-binding/InventoryBinding.vue.d.ts +37 -1
  51. package/dist/components/shell/inventory/binding-dialog.vue.d.ts +14 -0
  52. package/dist/components/shell/inventory/binding-ui.vue.d.ts +16 -1
  53. package/dist/{date2-4vrHarNG.js → date2-CgwRU403.js} +1 -1
  54. package/dist/{dayjs.min-Dwp8614O.js → dayjs.min-CjWVK_Fe.js} +16 -16
  55. package/dist/{defineDeepModel-DVt2Wz9r.js → defineDeepModel-B1j_kSRA.js} +1 -1
  56. package/dist/{duplicate-template-CkYWeFtL.js → duplicate-template-iHtqE_uw.js} +1 -1
  57. package/dist/{feature-Beh-qc03.js → feature-DEryk-Cv.js} +94 -89
  58. package/dist/{format-time-from-id-84iLSxVu.js → format-time-from-id-C-mbWMLS.js} +1 -1
  59. package/dist/{format-unit-display-DfeNpWk4.js → format-unit-display-C8Hzskg0.js} +16 -15
  60. package/dist/helper/number.d.ts +2 -0
  61. package/dist/helper/type.d.ts +5 -0
  62. package/dist/{import-export.helper-fAVzQM2q.js → import-export.helper-DGg16RXI.js} +17 -16
  63. package/dist/{index-CoEqhZLm.js → index-BAkoTUB0.js} +1 -1
  64. package/dist/{index-B2_16R5E.js → index-BLowSL6G.js} +1471 -1412
  65. package/dist/{index-Chogzhcq.js → index-CLr4DPan.js} +3 -3
  66. package/dist/{lodash-Cx8BU1GH.js → lodash-D1_0uR01.js} +1 -1
  67. package/dist/{netsuite-C1bml-v1.js → netsuite-Bbxz8tiD.js} +60 -60
  68. package/dist/number-Cof88Fjz.js +232 -0
  69. package/dist/{purchase-order-template-BqFnJ-6B.js → purchase-order-template-B-sXEbRE.js} +1 -1
  70. package/dist/router/name.d.ts +1 -0
  71. package/dist/rules-CzPUVxD_.js +98 -0
  72. package/dist/{stock-KxT4JbNf.js → stock-BYPFH5a_.js} +1 -1
  73. package/dist/stock-D9E1uFb1.js +75 -0
  74. package/dist/stores/feature.d.ts +2 -0
  75. package/dist/stores/integration/netsuite.d.ts +8 -1
  76. package/dist/stores/inventory.d.ts +119 -30
  77. package/dist/{supplier-C7wUB1zT.js → supplier-wQYh275s.js} +2 -2
  78. package/dist/{surcharge-CjB_Qtbv.js → surcharge-Bi21qFa0.js} +1 -1
  79. package/dist/tsconfig.app.tsbuildinfo +1 -1
  80. package/dist/{use-ingredient-select-dialog-D5KSqA4Z.js → use-ingredient-select-dialog-DH-mXl8H.js} +2 -2
  81. package/dist/{use-inventory-binding-dialog-eGOvztV3.js → use-inventory-binding-dialog-i8E2CNuV.js} +2 -2
  82. package/dist/{use-template-enabled-locations-2-3kcVWPQm.js → use-template-enabled-locations-2-DRk9TskI.js} +2 -2
  83. package/dist/views/closing-draft/components/closing-draft-dialog/ClosingDraftDialog.vue.d.ts +64 -8
  84. package/dist/views/closing-draft/composables/use-closing-draft-table.d.ts +192 -24
  85. package/dist/views/closing-template/components/closing-template-form/composables/use-closing-template-items.d.ts +8 -1
  86. package/dist/views/closing-template/composables/use-closing-template-actions.d.ts +96 -12
  87. package/dist/views/closing-template/composables/use-closing-template-table.d.ts +96 -12
  88. package/dist/views/ingredient-group/composables/use-ingredient-group-table.d.ts +18 -18
  89. package/dist/views/ingredients/components/convert/ConvertForm.vue.d.ts +14 -0
  90. package/dist/views/ingredients/components/ingredient-form/IngredientForm.vue.d.ts +32 -4
  91. package/dist/views/ingredients/components/inventory-binding/InventoryBindingForm.vue.d.ts +28 -0
  92. package/dist/views/ingredients/components/inventory-binding/v2/InventoryBindingFormV2.vue.d.ts +169 -0
  93. package/dist/views/ingredients/components/inventory-binding/v2/components/InventoryBindingAlternative.vue.d.ts +43 -0
  94. package/dist/views/ingredients/components/inventory-binding/v2/components/InventoryBindingRule.vue.d.ts +25 -0
  95. package/dist/views/ingredients/components/inventory-binding/v2/components/InventoryRecipeBindingV2Field.vue.d.ts +125 -0
  96. package/dist/views/ingredients/components/inventory-binding/v2/components/InventorySkuBindingV2Field.vue.d.ts +129 -0
  97. package/dist/views/ingredients/components/inventory-binding/v2/composables/use-inventory-binding-alternative-table.d.ts +30 -0
  98. package/dist/views/ingredients/components/inventory-binding/v2/composables/use-inventory-binding-dialog.d.ts +4 -0
  99. package/dist/views/ingredients/composables/use-ingredient-table.d.ts +8 -1
  100. package/dist/views/integration/components/netsuite/InventoryTransferIngredientTable.vue.d.ts +16 -2
  101. package/dist/views/receive-request/components/transfer-form/TransferFormWithController.vue.d.ts +33 -5
  102. package/dist/views/receive-request/components/transfer-form/components/ForecastStock.vue.d.ts +16 -2
  103. package/dist/views/receive-request/components/transfer-form/components/TransferItemTable.vue.d.ts +32 -4
  104. package/dist/views/receive-request/components/transfer-form/composables/use-transfer-items.d.ts +8 -1
  105. package/dist/views/receive-request/composables/use-process-purchase-order.d.ts +41 -6
  106. package/dist/views/receive-request/composables/use-receive-request-form.d.ts +246 -36
  107. package/dist/views/receive-request/composables/use-receive-request-table.d.ts +287 -42
  108. package/dist/views/recipe/components/recipe-form/RecipeForm.vue.d.ts +16 -0
  109. package/dist/views/stock/components/StockRecordCard.vue.d.ts +1 -0
  110. package/dist/views/stock/components/dialog/AdjustedItemForm.vue.d.ts +16 -2
  111. package/dist/views/stock/type.d.ts +2 -0
  112. package/dist/views/transfer-template/components/transfer-template-dialog/TransferTemplateDialog.vue.d.ts +16 -2
  113. package/dist/views/transfer-template/components/transfer-template-form/components/NetSuiteCustomCodeSelection.vue.d.ts +16 -2
  114. package/dist/views/transfer-template/components/transfer-template-form/components/TransferTemplateItemTable.vue.d.ts +16 -2
  115. package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-template-items.d.ts +8 -1
  116. package/dist/views/transfer-template/composables/use-netsuite-custom-field.d.ts +24 -3
  117. package/dist/views/transfer-template/composables/use-transfer-template-actions.d.ts +96 -12
  118. package/dist/views/transfer-template/composables/use-transfer-template-table.d.ts +96 -12
  119. package/dist/views/unit-cost-history/UnitCostHistoryView.vue.d.ts +2 -0
  120. package/dist/views/unit-cost-history/components/UnitCostDetailsSideSheet.vue.d.ts +19 -0
  121. package/dist/views/unit-cost-history/components/UnitCostRecalculationDialog.vue.d.ts +11 -0
  122. package/dist/views/unit-cost-history/composables/use-unit-cost-history.d.ts +65 -0
  123. package/dist/{vue-i18n-C6XNfngV.js → vue-i18n-Cf9iDkfk.js} +398 -398
  124. package/dist/{xlsx-BwNUbN_O.js → xlsx-lp5RXzSw.js} +398 -398
  125. package/dist/{xlsx.util-B_DE3inS.js → xlsx.util-BxpZNkEZ.js} +1 -1
  126. package/package.json +2 -2
  127. package/dist/RecipeView-Ck3Pa4fg.js +0 -646
  128. package/dist/SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-fMji2qKG.js +0 -172
  129. package/dist/decimal-Bf6AG_d3.js +0 -99
  130. package/dist/rules-y2OYGOro.js +0 -201
  131. package/dist/stock-BWUzlDTa.js +0 -75
@@ -1,29 +1,29 @@
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";
1
+ import { defineComponent as me, ref as z, computed as Y, resolveComponent as U, openBlock as j, createBlock as X, withCtx as H, 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 pe, 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 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-DJuq_faF.js";
4
- import { u as Oe } from "./stock-BWUzlDTa.js";
3
+ import { u as xe, c as Pe, a as Re, F as Ze, w as Ft, G as ae, v as At, o as $t, D as Vt, y as Q, h as De, i as et, e as tt, J as he } from "./app-BAVBNKKH.js";
4
+ import { u as Oe } from "./stock-D9E1uFb1.js";
5
5
  import { c as Ct } from "./component-DpCUABT3.js";
6
- import { g as Ve } from "./decimal-Bf6AG_d3.js";
7
- import { d as ye } from "./dayjs.min-Dwp8614O.js";
8
- import { e as Dt, u as dt, i as Ie, _ as nt } from "./PremiumBadge.vue_vue_type_script_setup_true_lang-B2zppgqk.js";
9
- import { _ as Ke, S as Ge, g as mt, a as jt } from "./SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-fMji2qKG.js";
10
- import { _ as Mt } from "./PreviewBadge.vue_vue_type_script_setup_true_lang-CRZiQHjx.js";
11
- import { useI18n as fe, useCoreStore as ft } from "@feedmepos/mf-common";
12
- import { useSnackbar as Se, useDialog as Ne, useProxiedModel as Ye, useBreakpoints as Bt } from "@feedmepos/ui-library";
13
- import { defineStore as It } from "pinia";
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-y2OYGOro.js";
15
- import { u as we } from "./stock-KxT4JbNf.js";
16
- import { u as Ot } from "./use-inventory-binding-dialog-eGOvztV3.js";
17
- import { a as pt } from "./FmMultiselectDialog-CwJUv9tG.js";
18
- import { _ as Nt } from "./NumberPrecisionInput.vue_vue_type_script_setup_true_lang-C5zOYiqR.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-4vrHarNG.js";
20
- import { i as Kt, _ as qt } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-CAMkZRFI.js";
6
+ import { f as Ve, g as Ce, a as _e, e as Dt, t as Ie, c as be, h as jt, i as nt, j as dt, k as Je, d as Me, l as Mt } from "./number-Cof88Fjz.js";
7
+ import { d as ye } from "./dayjs.min-CjWVK_Fe.js";
8
+ import { e as Bt, u as mt, i as Te, _ as ot } from "./PremiumBadge.vue_vue_type_script_setup_true_lang-Ci3esisT.js";
9
+ import { _ as Ke, S as Ge, g as ft, a as It } from "./SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-CxjceLuZ.js";
10
+ import { _ as Tt } from "./PreviewBadge.vue_vue_type_script_setup_true_lang-CRZiQHjx.js";
11
+ import { useI18n as fe, useCoreStore as pt } from "@feedmepos/mf-common";
12
+ import { useSnackbar as Se, useDialog as Ne, useProxiedModel as Ye, useBreakpoints as Ut } from "@feedmepos/ui-library";
13
+ import { defineStore as Ht } from "pinia";
14
+ import { u as we } from "./stock-BYPFH5a_.js";
15
+ import { c as Ue, A as Et, M as Pt, R as Rt } from "./rules-CzPUVxD_.js";
16
+ import { u as Ot } from "./use-inventory-binding-dialog-i8E2CNuV.js";
17
+ import { a as vt } from "./FmMultiselectDialog-CxDviJZM.js";
18
+ import { _ as Nt } from "./NumberPrecisionInput.vue_vue_type_script_setup_true_lang-CdPxhkg0.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-CgwRU403.js";
20
+ import { i as Kt, _ as qt } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-CUIrR73y.js";
21
21
  import { E as Xt } from "./empty-placeholder-wf6-BWE8.js";
22
- import { F as pe, u as Jt } from "./feature-Beh-qc03.js";
22
+ import { F as ve, u as Jt } from "./feature-DEryk-Cv.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-C1bml-v1.js";
24
+ import { u as Zt } from "./netsuite-Bbxz8tiD.js";
25
25
  import { P as en, J as tn } from "./app-DiX-EfV6.js";
26
- var Be = /* @__PURE__ */ ((k) => (k.History = "History", k.Convert = "Convert", k.Adjust = "Adjust", k))(Be || {});
26
+ var Be = /* @__PURE__ */ ((h) => (h.History = "History", h.Convert = "Convert", h.Adjust = "Adjust", h))(Be || {});
27
27
  const nn = [
28
28
  {
29
29
  translationKey: "inventory.stock.action.history",
@@ -51,16 +51,16 @@ const nn = [
51
51
  /* Adjust */
52
52
  }
53
53
  ];
54
- async function sn(k) {
54
+ async function sn(h) {
55
55
  const d = `${(xe().currentLocation.name || "").replace(
56
56
  / /g,
57
57
  "_"
58
58
  )}_${ye().format("DD_MM_YYYY_HHmm")}.xlsx`;
59
- await Dt(
59
+ await Bt(
60
60
  [
61
61
  {
62
62
  name: "stock",
63
- data: k,
63
+ data: h,
64
64
  columns: [
65
65
  {
66
66
  name: "Code",
@@ -73,16 +73,16 @@ async function sn(k) {
73
73
  {
74
74
  name: "Balance",
75
75
  selector: (s) => {
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);
76
+ const M = He(s, s.unit);
77
+ return M.type === "unit" ? Ve(s.balance, s.unit, null, !1) : Ve(s.balance, s.unit, M.measurement, !1);
78
78
  }
79
79
  },
80
80
  {
81
81
  name: "Unit",
82
82
  selector: (s) => {
83
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) || "";
84
+ const M = He(s, s.unit);
85
+ return M.type === "unit" ? s.unit.abbrev : ((w = s.unit.measurements.find((c) => c.id === M.measurement)) == null ? void 0 : w.abbrev) || "";
86
86
  }
87
87
  }
88
88
  ]
@@ -91,8 +91,8 @@ async function sn(k) {
91
91
  d
92
92
  );
93
93
  }
94
- function Ue(k, m) {
95
- const d = localStorage.getItem(`uom:${k._id}`);
94
+ function He(h, m) {
95
+ const d = localStorage.getItem(`uom:${h._id}`);
96
96
  return d ? d === m._id ? {
97
97
  type: "unit"
98
98
  } : m.measurements.find((s) => s.id === d) ? {
@@ -100,9 +100,9 @@ function Ue(k, m) {
100
100
  measurement: d
101
101
  } : {
102
102
  type: "unit"
103
- } : k.trackingMeasurement && m.measurements.find((s) => s.id === k.trackingMeasurement) ? {
103
+ } : h.trackingMeasurement && m.measurements.find((s) => s.id === h.trackingMeasurement) ? {
104
104
  type: "measurement",
105
- measurement: k.trackingMeasurement
105
+ measurement: h.trackingMeasurement
106
106
  } : {
107
107
  type: "unit"
108
108
  };
@@ -115,15 +115,15 @@ const an = { class: "fm-typo-en-body-md-400 flex-grow" }, _t = /* @__PURE__ */ m
115
115
  amount: {},
116
116
  defaultTrackingMeasurement: {}
117
117
  },
118
- setup(k) {
118
+ setup(h) {
119
119
  function m(B) {
120
120
  return `uom:${B._id}`;
121
121
  }
122
122
  function d(B) {
123
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);
124
+ B ? localStorage.setItem(b, B) : localStorage.setItem(b, s.unit._id), M.value = He(s.sku, s.unit);
125
125
  }
126
- const s = k, j = z(Ue(s.sku, s.unit)), w = Y(() => {
126
+ const s = h, M = z(He(s.sku, s.unit)), w = Y(() => {
127
127
  const { measurements: B } = s.unit;
128
128
  return [
129
129
  {
@@ -137,41 +137,41 @@ const an = { class: "fm-typo-en-body-md-400 flex-grow" }, _t = /* @__PURE__ */ m
137
137
  ];
138
138
  });
139
139
  function c({ value: B }) {
140
- return a(j).type === "unit" ? B === null : B === a(j).measurement;
140
+ return a(M).type === "unit" ? B === null : B === a(M).measurement;
141
141
  }
142
142
  const l = Y(
143
143
  () => {
144
144
  var B;
145
145
  return ((B = w.value.find((b) => c(b))) == null ? void 0 : B.label) ?? "";
146
146
  }
147
- ), h = z(!1);
147
+ ), g = z(!1);
148
148
  return (B, b) => {
149
- const i = H("FmIcon"), f = H("FmMenuItem"), T = H("FmMenu");
150
- return D(), X(T, {
149
+ const r = U("FmIcon"), v = U("FmMenuItem"), T = U("FmMenu");
150
+ return j(), X(T, {
151
151
  "stop-click-propagation": "",
152
- onMenuChanged: b[0] || (b[0] = (g) => h.value = g)
152
+ onMenuChanged: b[0] || (b[0] = (k) => g.value = k)
153
153
  }, {
154
- "menu-button": U(() => [
154
+ "menu-button": H(() => [
155
155
  e("button", {
156
156
  type: "button",
157
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
- h.value ? "border-fm-color-primary" : "border-fm-color-neutral-gray-100"
159
+ g.value ? "border-fm-color-primary" : "border-fm-color-neutral-gray-100"
160
160
  ])
161
161
  }, [
162
162
  e("div", an, p(l.value), 1),
163
- y(i, {
163
+ y(r, {
164
164
  class: "text-fm-color-neutral-gray-400",
165
165
  name: "expand_more"
166
166
  })
167
167
  ], 2)
168
168
  ]),
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)
169
+ default: H(() => [
170
+ (j(!0), W(le, null, ce(w.value, (k) => (j(), X(v, {
171
+ key: k.value ?? 0,
172
+ label: k.label,
173
+ "model-value": c(k),
174
+ onClick: (x) => d(k.value)
175
175
  }, null, 8, ["label", "model-value", "onClick"]))), 128))
176
176
  ]),
177
177
  _: 1
@@ -180,37 +180,37 @@ const an = { class: "fm-typo-en-body-md-400 flex-grow" }, _t = /* @__PURE__ */ m
180
180
  }
181
181
  }), ln = { class: "whitespace-nowrap" }, rn = /* @__PURE__ */ me({
182
182
  __name: "StockHeaderPreview",
183
- setup(k) {
183
+ setup(h) {
184
184
  const { t: m } = fe();
185
- return (d, s) => (D(), X(Mt, null, {
186
- default: U(() => [
185
+ return (d, s) => (j(), X(Tt, null, {
186
+ default: H(() => [
187
187
  e("div", ln, p(a(m)("inventory.stock.prediction.daysRemaining")), 1)
188
188
  ]),
189
189
  _: 1
190
190
  }));
191
191
  }
192
- }), kt = It("stockActions", () => {
193
- const k = z(!1), m = xe(), d = Oe(), s = dt(), j = Se(), w = Ne(), { t: c } = fe();
192
+ }), kt = Ht("stockActions", () => {
193
+ const h = z(!1), m = xe(), d = Oe(), s = mt(), M = Se(), w = Ne(), { t: c } = fe();
194
194
  async function l() {
195
195
  if (m._currentLocation) {
196
- k.value = !0;
196
+ h.value = !0;
197
197
  try {
198
198
  await d.readStockBalance(), await d.readProductBalance(), await s.readStockEstimateBalance();
199
199
  } catch {
200
- j.open({
200
+ M.open({
201
201
  title: c("inventory.stock.error.title"),
202
202
  message: c("inventory.stock.error.message"),
203
203
  type: "error"
204
204
  });
205
205
  } finally {
206
- k.value = !1;
206
+ h.value = !1;
207
207
  }
208
208
  }
209
209
  }
210
- const h = z();
210
+ const g = z();
211
211
  async function B(x) {
212
- var S, C, A;
213
- if (!!!((C = (S = x.convert) == null ? void 0 : S.inventoryBindings) != null && C.length)) {
212
+ var S, D, A;
213
+ if (!!!((D = (S = x.convert) == null ? void 0 : S.inventoryBindings) != null && D.length)) {
214
214
  w.open({
215
215
  title: c("inventory.stock.error.convert.title"),
216
216
  message: c("inventory.stock.error.convert.message")
@@ -222,16 +222,16 @@ const an = { class: "fm-typo-en-body-md-400 flex-grow" }, _t = /* @__PURE__ */ m
222
222
  sku: x,
223
223
  show: !0,
224
224
  "onUpdate:show"(I) {
225
- h.value.show = I;
225
+ g.value.show = I;
226
226
  },
227
227
  onSubmitted() {
228
228
  l();
229
229
  }
230
230
  };
231
- h.value = n;
231
+ g.value = n;
232
232
  }
233
233
  const b = z();
234
- async function i(x) {
234
+ async function r(x) {
235
235
  const o = {
236
236
  stock: x,
237
237
  show: !0,
@@ -244,18 +244,18 @@ const an = { class: "fm-typo-en-body-md-400 flex-grow" }, _t = /* @__PURE__ */ m
244
244
  };
245
245
  b.value = o;
246
246
  }
247
- const f = z();
247
+ const v = z();
248
248
  async function T(x) {
249
249
  const o = {
250
250
  sku: x,
251
251
  show: !0,
252
252
  "onUpdate:show"(t) {
253
- f.value.show = t;
253
+ v.value.show = t;
254
254
  }
255
255
  };
256
- f.value = o;
256
+ v.value = o;
257
257
  }
258
- function g(x, o) {
258
+ function k(x, o) {
259
259
  const t = Pe(o);
260
260
  switch (x) {
261
261
  case Be.History:
@@ -265,22 +265,22 @@ const an = { class: "fm-typo-en-body-md-400 flex-grow" }, _t = /* @__PURE__ */ m
265
265
  B(t);
266
266
  return;
267
267
  case Be.Adjust:
268
- i(t);
268
+ r(t);
269
269
  return;
270
270
  }
271
271
  }
272
272
  return {
273
273
  fetchStockBalance: l,
274
- onActionMenu: g,
275
- stockHistoryProps: f,
274
+ onActionMenu: k,
275
+ stockHistoryProps: v,
276
276
  showSkuHistory: T,
277
- convertSkuDialogProps: h,
277
+ convertSkuDialogProps: g,
278
278
  adjustSkuDialogProps: b
279
279
  };
280
280
  });
281
281
  function un() {
282
282
  var w;
283
- const k = xe(), m = kt(), d = ft(), { t: s } = fe();
283
+ const h = xe(), m = kt(), d = pt(), { t: s } = fe();
284
284
  return {
285
285
  columnDefs: [
286
286
  {
@@ -299,13 +299,13 @@ function un() {
299
299
  id: "UOM",
300
300
  header: () => s("inventory.stock.balance"),
301
301
  cell(c) {
302
- const l = c.row.original, h = {
302
+ const l = c.row.original, g = {
303
303
  unit: l.unit,
304
304
  sku: l,
305
305
  amount: l.balance,
306
306
  defaultTrackingMeasurement: l.trackingMeasurement ?? void 0
307
307
  };
308
- return ke(_t, h);
308
+ return ke(_t, g);
309
309
  },
310
310
  size: 180
311
311
  },
@@ -336,16 +336,17 @@ function un() {
336
336
  enableSorting: !0,
337
337
  sortUndefined: "last",
338
338
  cell(c) {
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
- if (typeof l != "number" || typeof h != "number" || typeof B != "number")
339
+ var T, k;
340
+ const l = c.row.original.day, g = c.row.original.operator, B = (T = c.row.original.thresholds) == null ? void 0 : T.low, b = (k = c.row.original.thresholds) == null ? void 0 : k.mid;
341
+ if (typeof l != "number" || typeof B != "number" || typeof b != "number")
342
342
  return ke(Ke, {
343
- days: l
343
+ days: l,
344
+ operator: g
344
345
  });
345
- const b = l <= h ? Ge.low : l <= B ? Ge.mid : Ge.high;
346
+ const r = l <= B ? Ge.low : l <= b ? Ge.mid : Ge.high;
346
347
  return ke(Ke, {
347
348
  days: l,
348
- level: b
349
+ level: r
349
350
  });
350
351
  },
351
352
  size: 200
@@ -355,8 +356,8 @@ function un() {
355
356
  cell(c) {
356
357
  var l;
357
358
  return Ct(
358
- ((l = k._currentLocation) == null ? void 0 : l.type) === "restaurant" ? nn : on,
359
- (h) => m.onActionMenu(h, c.row.original)
359
+ ((l = h._currentLocation) == null ? void 0 : l.type) === "restaurant" ? nn : on,
360
+ (g) => m.onActionMenu(g, c.row.original)
360
361
  );
361
362
  },
362
363
  enableSorting: !1,
@@ -372,41 +373,41 @@ function un() {
372
373
  const cn = {
373
374
  context: null,
374
375
  error: null,
375
- isRequired(k = "This field is required") {
376
- return `${this.context ?? ""}`.length === 0 && (this.error = k), this;
376
+ isRequired(h = "This field is required") {
377
+ return `${this.context ?? ""}`.length === 0 && (this.error = h), this;
377
378
  },
378
- isString(k = "Must be a valid string") {
379
- return this.error ? this : (typeof this.context != "string" && (this.error ?? (this.error = k)), this);
379
+ isString(h = "Must be a valid string") {
380
+ return this.error ? this : (typeof this.context != "string" && (this.error ?? (this.error = h)), this);
380
381
  },
381
382
  toInt() {
382
383
  return this.error ? this : (this.context = +this.context, this);
383
384
  },
384
- isInteger(k = "Must be an integer") {
385
- return this.error ? this : (this.toInt(), isNaN(this.context) && (this.error = k), this);
385
+ isInteger(h = "Must be an integer") {
386
+ return this.error ? this : (this.toInt(), isNaN(this.context) && (this.error = h), this);
386
387
  },
387
- min(k, m) {
388
+ min(h, m) {
388
389
  if (this.error) return this;
389
390
  try {
390
- typeof this.context == "number" ? +this.context < k && (this.error = m ?? `Must be at least ${k}`) : Object.prototype.hasOwnProperty.call(this.context, "length") ? +this.context.length < k && (this.error = m ?? `Must be at least ${k}`) : this.error = "Length cannot be determined";
391
+ typeof this.context == "number" ? +this.context < h && (this.error = m ?? `Must be at least ${h}`) : Object.prototype.hasOwnProperty.call(this.context, "length") ? +this.context.length < h && (this.error = m ?? `Must be at least ${h}`) : this.error = "Length cannot be determined";
391
392
  } catch {
392
393
  this.error = "Length cannot be determined";
393
394
  }
394
395
  return this;
395
396
  },
396
- max(k, m) {
397
+ max(h, m) {
397
398
  if (this.error) return this;
398
399
  try {
399
- typeof this.context == "number" ? +this.context > k && (this.error = m ?? `Must be at most ${k}`) : "length" in this.context ? +this.context.length > k && (this.error = m ?? `Must be at most ${k}`) : this.error = "Length cannot be determined";
400
+ typeof this.context == "number" ? +this.context > h && (this.error = m ?? `Must be at most ${h}`) : "length" in this.context ? +this.context.length > h && (this.error = m ?? `Must be at most ${h}`) : this.error = "Length cannot be determined";
400
401
  } catch {
401
402
  this.error = "Length cannot be determined";
402
403
  }
403
404
  return this;
404
405
  }
405
406
  };
406
- function rt(k) {
407
- return { ...cn, context: k };
407
+ function rt(h) {
408
+ return { ...cn, context: h };
408
409
  }
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
+ 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({
410
411
  __name: "ConvertSkuDialog",
411
412
  props: {
412
413
  sku: {},
@@ -414,51 +415,51 @@ const dn = { class: "flex items-center" }, mn = { class: "fm-typo-en-title-md-80
414
415
  show: { type: Boolean }
415
416
  },
416
417
  emits: ["update:show", "submitted"],
417
- setup(k, { expose: m, emit: d }) {
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(
418
+ setup(h, { expose: m, emit: d }) {
419
+ const s = h, M = d, w = Ot(), c = Re(), l = we(), g = Se(), { t: B } = fe(), b = z(0), r = z(null), v = Y(() => c.skus), T = Y(
419
420
  () => {
420
- var v, $;
421
- return ((($ = (v = s.sku) == null ? void 0 : v.convert) == null ? void 0 : $.inventoryBindings) ?? []).filter(
421
+ var f, $;
422
+ return ((($ = (f = s.sku) == null ? void 0 : f.convert) == null ? void 0 : $.inventoryBindings) ?? []).filter(
422
423
  (G) => G.type === Ze.enum.SKU
423
424
  );
424
425
  }
425
- ), g = Y({
426
+ ), k = Y({
426
427
  get() {
427
- return !!i.value;
428
+ return !!r.value;
428
429
  },
429
- set(v) {
430
- v ? i.value = Pe(T.value) : (i.value = null, b.value = Math.min(b.value, s.maxCount ?? 0));
430
+ set(f) {
431
+ f ? r.value = Pe(T.value) : (r.value = null, b.value = Math.min(b.value, s.maxCount ?? 0));
431
432
  }
432
433
  }), x = z(!1);
433
- $e([() => s.show], ([v]) => {
434
- v && (b.value = 0);
434
+ $e([() => s.show], ([f]) => {
435
+ f && (b.value = 0);
435
436
  });
436
437
  function o() {
437
- R(s.sku, Te(b.value), i.value);
438
+ R(s.sku, Ie(b.value), r.value);
438
439
  }
439
- function t(v) {
440
- if (i.value)
440
+ function t(f) {
441
+ if (r.value)
441
442
  return !0;
442
- const $ = rt(v).isInteger().max(s.maxCount ?? 0).error ?? "";
443
+ const $ = rt(f).isInteger().max(s.maxCount ?? 0).error ?? "";
443
444
  return $ || !0;
444
445
  }
445
- function n(v) {
446
+ function n(f) {
446
447
  var E;
447
448
  const $ = (E = s.sku.convert) != null && E.measurement ? s.sku.unit.measurements.find((_) => {
448
- var r;
449
- return _.id === ((r = s.sku.convert) == null ? void 0 : r.measurement);
450
- }) ?? null : null, G = Ce(s.sku.unit, $), P = Et(+v);
449
+ var i;
450
+ return _.id === ((i = s.sku.convert) == null ? void 0 : i.measurement);
451
+ }) ?? null : null, G = Ce(s.sku.unit, $), P = jt(+f);
451
452
  return rt(P).isInteger().max(G).error ? "Precision cannot be more than " + G : !0;
452
453
  }
453
454
  const S = Y(
454
455
  () => {
455
- var v, $;
456
- return (v = s.sku.convert) != null && v.measurement ? ($ = s.sku.unit.measurements.find((G) => {
456
+ var f, $;
457
+ return (f = s.sku.convert) != null && f.measurement ? ($ = s.sku.unit.measurements.find((G) => {
457
458
  var P;
458
459
  return G.id === ((P = s.sku.convert) == null ? void 0 : P.measurement);
459
460
  })) == null ? void 0 : $.abbrev : s.sku.unit.abbrev;
460
461
  }
461
- ), C = Y(() => {
462
+ ), D = Y(() => {
462
463
  var P, L;
463
464
  const $ = Ft({
464
465
  bindings: ((P = s.sku.convert) == null ? void 0 : P.inventoryBindings) ?? [],
@@ -466,47 +467,47 @@ const dn = { class: "flex items-center" }, mn = { class: "fm-typo-en-title-md-80
466
467
  skuGroups: c.skuGroups,
467
468
  recipes: c.recipes
468
469
  }).inventoryBindings.filter((E) => "success" in E && E.success).map((E) => E).map((E) => E.binding);
469
- return (L = i.value ?? $) == null ? void 0 : L.map((E) => {
470
+ return (L = r.value ?? $) == null ? void 0 : L.map((E) => {
470
471
  var ne, re, J, te, oe;
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
+ const _ = c.skus.find((ie) => ie._id === E.id), i = ((ne = E.measurement) == null ? void 0 : ne.abbrev) ?? ((re = _ == null ? void 0 : _.unit) == null ? void 0 : re.abbrev), V = (J = s.sku.convert) != null && J.measurement ? s.sku.unit.measurements.find((ie) => {
472
473
  var Fe;
473
474
  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
- Tt(
475
+ }) ?? null : null, C = Ce(s.sku.unit, V), u = n(`${b.value}`) === !0 ? _e(
476
+ Dt(
476
477
  E.amount,
477
- Te(+b.value, V)
478
+ Ie(+b.value, C)
478
479
  ),
479
480
  !1
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
+ ) : "0", F = (oe = (te = r.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
482
  return {
482
483
  sku: _,
483
484
  convertAmount: N ?? u,
484
- abbrev: r
485
+ abbrev: i
485
486
  };
486
487
  });
487
488
  }), A = z();
488
489
  m({
489
490
  validateInputs: () => {
490
- var v, $;
491
- ($ = (v = A.value) == null ? void 0 : v.validateInputs) == null || $.call(v);
491
+ var f, $;
492
+ ($ = (f = A.value) == null ? void 0 : f.validateInputs) == null || $.call(f);
492
493
  },
493
494
  resetInputsValidation: () => {
494
- var v, $;
495
- ($ = (v = A.value) == null ? void 0 : v.resetInputsValidation) == null || $.call(v);
495
+ var f, $;
496
+ ($ = (f = A.value) == null ? void 0 : f.resetInputsValidation) == null || $.call(f);
496
497
  },
497
498
  resetInputs: () => {
498
- var v, $;
499
- ($ = (v = A.value) == null ? void 0 : v.resetInputs) == null || $.call(v);
499
+ var f, $;
500
+ ($ = (f = A.value) == null ? void 0 : f.resetInputs) == null || $.call(f);
500
501
  }
501
502
  });
502
503
  const I = Ye(s, "show");
503
- async function R(v, $, G) {
504
+ async function R(f, $, G) {
504
505
  x.value = !0;
505
506
  try {
506
507
  await l.convertSku({
507
508
  conversions: [
508
509
  {
509
- doc: v,
510
+ doc: f,
510
511
  amount: $,
511
512
  overrides: G == null ? void 0 : G.map((P) => ({
512
513
  ...P,
@@ -518,95 +519,95 @@ const dn = { class: "flex items-center" }, mn = { class: "fm-typo-en-title-md-80
518
519
  }))
519
520
  }
520
521
  ]
521
- }), j("update:show", !1), j("submitted");
522
+ }), M("update:show", !1), M("submitted");
522
523
  } catch (P) {
523
- h.open({
524
+ g.open({
524
525
  title: "Something went wrong",
525
- message: `Cannot convert ${v.name}. Please try again.`,
526
+ message: `Cannot convert ${f.name}. Please try again.`,
526
527
  type: "error"
527
- }), console.error("error at converting stock amount", v, $, P);
528
+ }), console.error("error at converting stock amount", f, $, P);
528
529
  } finally {
529
530
  x.value = !1;
530
531
  }
531
532
  }
532
- function K(v, $, G) {
533
+ function K(f, $, G) {
533
534
  const P = +$;
534
535
  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
+ $.length > 0 && isFinite(P) ? L = G.map((E) => (E.id !== f || (E.amount = be(P)), E)) : L = G.map((E) => (E.id !== f || (E.amount = { amount: 0, precision: 0 }), E)), r.value = L;
536
537
  }
537
- function O(v) {
538
- const $ = f.value.find((G) => G._id === v);
539
- return $ ? mt($.unit, !0) : [];
538
+ function O(f) {
539
+ const $ = v.value.find((G) => G._id === f);
540
+ return $ ? ft($.unit, !0) : [];
540
541
  }
541
- function Z(v, $) {
542
- const G = O(v), P = G.find((L) => L.value === $) ?? G.find((L) => L.value === null);
542
+ function Z(f, $) {
543
+ const G = O(f), P = G.find((L) => L.value === $) ?? G.find((L) => L.value === null);
543
544
  return P ? {
544
545
  ...P,
545
546
  label: P.abbrev
546
547
  } : null;
547
548
  }
548
- function q(v, $, G) {
549
+ function q(f, $, G) {
549
550
  let P;
550
551
  if ($ === null)
551
- P = G.map((L) => (L.id !== v || (L.measurement = null), L)) ?? [];
552
+ P = G.map((L) => (L.id !== f || (L.measurement = null), L)) ?? [];
552
553
  else {
553
- const L = f.value.find((E) => E._id === v);
554
+ const L = v.value.find((E) => E._id === f);
554
555
  P = G.map((E) => {
555
- var _, r;
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;
556
+ var _, i;
557
+ return E.id !== f || (E.measurement = (i = (_ = L == null ? void 0 : L.unit) == null ? void 0 : _.measurements) == null ? void 0 : i.find((V) => V.id === $)), E;
557
558
  }) ?? [];
558
559
  }
559
- i.value = P;
560
+ r.value = P;
560
561
  }
561
- function ue(v, $) {
562
- const G = $.filter((P) => P.id !== v);
563
- i.value = G;
562
+ function ue(f, $) {
563
+ const G = $.filter((P) => P.id !== f);
564
+ r.value = G;
564
565
  }
565
566
  function ee() {
566
- const v = (i.value ?? []).map(($) => ({
567
+ const f = (r.value ?? []).map(($) => ({
567
568
  ...$,
568
569
  type: Ze.enum.SKU
569
570
  }));
570
571
  w.promptIngredientsBinding(
571
- v,
572
- ($) => i.value = $,
572
+ f,
573
+ ($) => r.value = $,
573
574
  s.sku._id
574
575
  );
575
576
  }
576
577
  return $e(
577
578
  () => s.show,
578
- (v) => {
579
- v || (i.value = null, b.value = 0);
579
+ (f) => {
580
+ f || (r.value = null, b.value = 0);
580
581
  }
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, {
582
+ ), (f, $) => {
583
+ const G = U("FmTextField"), P = U("FmForm"), L = U("FmCard"), E = U("FmSwitch"), _ = U("FmFormGroup"), i = U("FmSelect"), V = U("FmButton"), C = U("FmSideSheet");
584
+ return j(), X(C, {
584
585
  "dismiss-away": "",
585
586
  modelValue: a(I),
586
587
  "onUpdate:modelValue": $[3] || ($[3] = (u) => Ee(I) ? I.value = u : null),
587
588
  "max-width": 500
588
589
  }, {
589
- "side-sheet-header": U(() => [
590
+ "side-sheet-header": H(() => [
590
591
  e("div", dn, [
591
- e("div", mn, p(a(B)("inventory.stock.convert.title", { name: v.sku.name })), 1)
592
+ e("div", mn, p(a(B)("inventory.stock.convert.title", { name: f.sku.name })), 1)
592
593
  ])
593
594
  ]),
594
- default: U(() => [
595
+ default: H(() => [
595
596
  e("div", fn, [
596
597
  y(P, {
597
598
  ref_key: "formRef",
598
599
  ref: A,
599
600
  onValidationSuccess: o
600
601
  }, {
601
- default: U(() => [
602
+ default: H(() => [
602
603
  y(G, {
603
604
  disabled: x.value,
604
605
  "model-value": b.value,
605
606
  "onUpdate:modelValue": $[0] || ($[0] = (u) => b.value = u),
606
607
  label: a(B)("inventory.stock.convert.amount"),
607
- rules: [t, n, a(He)(0)],
608
+ rules: [t, n, a(Ue)(0)],
608
609
  "append-text": S.value,
609
- "helper-text": i.value ? void 0 : `Max ${v.maxCount} ${S.value}`
610
+ "helper-text": r.value ? void 0 : `Max ${f.maxCount} ${S.value}`
610
611
  }, null, 8, ["disabled", "model-value", "label", "rules", "append-text", "helper-text"])
611
612
  ]),
612
613
  _: 1
@@ -615,12 +616,12 @@ const dn = { class: "flex items-center" }, mn = { class: "fm-typo-en-title-md-80
615
616
  variant: "outlined",
616
617
  class: "p-16"
617
618
  }, {
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) => {
619
+ default: H(() => [
620
+ e("div", pn, [
621
+ e("div", vn, p(a(B)("inventory.stock.convert.deductionSummary")), 1),
622
+ (j(!0), W(le, null, ce(D.value, (u) => {
622
623
  var F, N;
623
- return D(), W("div", {
624
+ return j(), W("div", {
624
625
  key: (F = u.sku) == null ? void 0 : F._id,
625
626
  class: "flex items-center"
626
627
  }, [
@@ -633,65 +634,65 @@ const dn = { class: "flex items-center" }, mn = { class: "fm-typo-en-title-md-80
633
634
  _: 1
634
635
  }),
635
636
  y(L, { variant: "outlined" }, {
636
- default: U(() => [
637
+ default: H(() => [
637
638
  e("div", kn, [
638
639
  y(E, {
639
640
  value: "",
640
- modelValue: g.value,
641
- "onUpdate:modelValue": $[1] || ($[1] = (u) => g.value = u),
641
+ modelValue: k.value,
642
+ "onUpdate:modelValue": $[1] || ($[1] = (u) => k.value = u),
642
643
  label: a(B)("inventory.stock.convert.overrideDeduction"),
643
644
  "label-placement": "right"
644
645
  }, null, 8, ["modelValue", "label"]),
645
- g.value ? (D(), W(le, { key: 0 }, [
646
+ k.value ? (j(), W(le, { key: 0 }, [
646
647
  y(_, {
647
- modelValue: i.value,
648
- rules: [a(Ht)(1, "Must have at least one ingredient binding")]
648
+ modelValue: r.value,
649
+ rules: [a(Et)(1, "Must have at least one ingredient binding")]
649
650
  }, null, 8, ["modelValue", "rules"]),
650
651
  e("div", hn, [
651
652
  e("div", gn, p(a(B)("inventory.stock.convert.ingredients")), 1),
652
- (D(!0), W(le, null, ce(i.value, (u) => (D(), X(_, {
653
+ (j(!0), W(le, null, ce(r.value, (u) => (j(), X(_, {
653
654
  key: u.id,
654
655
  disabled: x.value,
655
656
  modelValue: +a(_e)(u.amount ?? { amount: 1, precision: 0 }),
656
657
  rules: [
657
- a(Ut)(
658
- f.value.find((F) => F._id === u.id).unit,
658
+ a(Pt)(
659
+ v.value.find((F) => F._id === u.id).unit,
659
660
  u.measurement
660
661
  ),
661
- a(He)(0)
662
+ a(Ue)(0)
662
663
  ]
663
664
  }, {
664
- default: U(({ invalid: F }) => {
665
+ default: H(({ invalid: F }) => {
665
666
  var N, ne, re;
666
667
  return [
667
668
  e("div", bn, [
668
- e("div", xn, p((N = f.value.find((J) => J._id === u.id)) == null ? void 0 : N.name), 1),
669
+ e("div", xn, p((N = v.value.find((J) => J._id === u.id)) == null ? void 0 : N.name), 1),
669
670
  y(G, {
670
671
  class: "xs:col-span-2",
671
672
  disabled: x.value,
672
673
  modelValue: +a(_e)(
673
674
  u.amount ?? { amount: 1, precision: 0 }
674
675
  ),
675
- "onUpdate:modelValue": (J) => K(u.id, J, i.value ?? []),
676
+ "onUpdate:modelValue": (J) => K(u.id, J, r.value ?? []),
676
677
  invalid: F
677
678
  }, null, 8, ["disabled", "modelValue", "onUpdate:modelValue", "invalid"]),
678
- y(r, {
679
+ y(i, {
679
680
  disabled: x.value,
680
681
  class: "translate-y-[2px]",
681
682
  items: O(u.id),
682
683
  "model-value": (re = Z(u.id, (ne = u.measurement) == null ? void 0 : ne.id)) == null ? void 0 : re.value,
683
- "onUpdate:modelValue": (J) => q(u.id, J, i.value ?? []),
684
+ "onUpdate:modelValue": (J) => q(u.id, J, r.value ?? []),
684
685
  invalid: F
685
686
  }, {
686
- "helper-text": U(() => $[4] || ($[4] = [])),
687
+ "helper-text": H(() => $[4] || ($[4] = [])),
687
688
  _: 2
688
689
  }, 1032, ["disabled", "items", "model-value", "onUpdate:modelValue", "invalid"]),
689
- y(M, {
690
+ y(V, {
690
691
  disabled: x.value,
691
692
  type: "button",
692
693
  variant: "tertiary",
693
694
  icon: "delete",
694
- onClick: (J) => ue(u.id, i.value ?? [])
695
+ onClick: (J) => ue(u.id, r.value ?? [])
695
696
  }, null, 8, ["disabled", "onClick"])
696
697
  ])
697
698
  ];
@@ -700,7 +701,7 @@ const dn = { class: "flex items-center" }, mn = { class: "fm-typo-en-title-md-80
700
701
  }, 1032, ["disabled", "modelValue", "rules"]))), 128))
701
702
  ]),
702
703
  e("div", null, [
703
- y(M, {
704
+ y(V, {
704
705
  icon: "link",
705
706
  label: a(B)("inventory.stock.convert.linkIngredient"),
706
707
  variant: "plain",
@@ -714,9 +715,9 @@ const dn = { class: "flex items-center" }, mn = { class: "fm-typo-en-title-md-80
714
715
  })
715
716
  ])
716
717
  ]),
717
- "side-sheet-footer": U(() => [
718
+ "side-sheet-footer": H(() => [
718
719
  e("div", Sn, [
719
- y(M, {
720
+ y(V, {
720
721
  loading: x.value,
721
722
  label: a(B)("inventory.stock.convert.convertButton"),
722
723
  onClick: $[2] || ($[2] = (u) => {
@@ -731,12 +732,12 @@ const dn = { class: "flex items-center" }, mn = { class: "fm-typo-en-title-md-80
731
732
  };
732
733
  }
733
734
  });
734
- function je(k, m) {
735
- const d = Te(k, m);
735
+ function je(h, m) {
736
+ const d = Ie(h, m);
736
737
  return { ...d, amount: -d.amount };
737
738
  }
738
- function it(k, m) {
739
- return Te(Math.abs(k), m);
739
+ function it(h, m) {
740
+ return Ie(Math.abs(h), m);
740
741
  }
741
742
  const We = {
742
743
  [ae.enum.DAMAGE]: {
@@ -770,13 +771,13 @@ const We = {
770
771
  disabled: { type: Boolean }
771
772
  },
772
773
  emits: ["update:modelValue", "click:delete"],
773
- setup(k, { emit: m }) {
774
- const d = k, s = m, { t: j } = fe(), w = Oe(), c = Y(
774
+ setup(h, { emit: m }) {
775
+ const d = h, s = m, { t: M } = fe(), w = Oe(), c = Y(
775
776
  () => Object.keys(We).map((t) => ({
776
777
  label: At(t),
777
778
  value: t
778
779
  }))
779
- ), l = Y(() => mt(d.modelValue.doc.unit, !0)), h = Y({
780
+ ), l = Y(() => ft(d.modelValue.doc.unit, !0)), g = Y({
780
781
  get() {
781
782
  return d.modelValue.type ?? ae.enum.PURCHASE;
782
783
  },
@@ -785,7 +786,7 @@ const We = {
785
786
  ...d.modelValue
786
787
  };
787
788
  n.type = t;
788
- const S = ot(d.modelValue.amount);
789
+ const S = nt(d.modelValue.amount);
789
790
  n.amount = We[n.type].toAdjustmentAmount(
790
791
  +_e(S),
791
792
  S.precision
@@ -793,14 +794,14 @@ const We = {
793
794
  }
794
795
  }), B = Y({
795
796
  get() {
796
- const t = ot(d.modelValue.amount);
797
+ const t = nt(d.modelValue.amount);
797
798
  return +_e(t);
798
799
  },
799
800
  set(t) {
800
801
  const n = {
801
802
  ...d.modelValue
802
803
  }, S = be(t);
803
- n.amount = We[h.value].toAdjustmentAmount(
804
+ n.amount = We[g.value].toAdjustmentAmount(
804
805
  t,
805
806
  S.precision
806
807
  ), s("update:modelValue", n);
@@ -811,13 +812,13 @@ const We = {
811
812
  return ((t = d.modelValue.measurement) == null ? void 0 : t.id) ?? null;
812
813
  },
813
814
  set(t) {
814
- var S, C;
815
+ var S, D;
815
816
  const n = {
816
817
  ...d.modelValue
817
818
  };
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
+ n.measurement = ((D = (S = d.modelValue.doc.unit) == null ? void 0 : S.measurements) == null ? void 0 : D.find((A) => A.id === t)) ?? null, s("update:modelValue", n);
819
820
  }
820
- }), i = Y({
821
+ }), r = Y({
821
822
  get() {
822
823
  return d.modelValue.remark ?? "";
823
824
  },
@@ -827,25 +828,25 @@ const We = {
827
828
  };
828
829
  n.remark = t, s("update:modelValue", n);
829
830
  }
830
- }), f = Y(() => {
831
+ }), v = Y(() => {
831
832
  var n;
832
833
  const t = (n = w.stockBalance.skus) == null ? void 0 : n.find((S) => S.id === d.modelValue.doc._id);
833
834
  return (t == null ? void 0 : t.balance) ?? { amount: 0, precision: 0 };
834
835
  }), T = Y(() => {
835
836
  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)
837
+ return n ? dt(t, n.conversion) : t;
838
+ }), k = Y(
839
+ () => Je(v.value, T.value)
839
840
  ), x = Y(
840
- () => Ve(g.value, d.modelValue.doc.unit)
841
+ () => Ve(k.value, d.modelValue.doc.unit)
841
842
  ), o = Y(() => T.value.amount < 0);
842
843
  return (t, n) => {
843
- const S = H("FmButton"), C = H("FmSelect"), A = H("FmTextarea"), I = H("FmCard");
844
- return D(), X(I, {
844
+ const S = U("FmButton"), D = U("FmSelect"), A = U("FmTextarea"), I = U("FmCard");
845
+ return j(), X(I, {
845
846
  variant: "outlined",
846
847
  class: "grid grid-cols-2 gap-8 p-16"
847
848
  }, {
848
- default: U(() => [
849
+ default: H(() => [
849
850
  e("div", Fn, [
850
851
  e("div", An, [
851
852
  e("div", $n, p(t.modelValue.doc.name), 1),
@@ -857,14 +858,14 @@ const We = {
857
858
  onClick: n[0] || (n[0] = (R) => s("click:delete"))
858
859
  })
859
860
  ]),
860
- y(C, {
861
+ y(D, {
861
862
  disabled: t.disabled,
862
863
  class: "col-span-2",
863
864
  label: "Type",
864
865
  items: c.value,
865
- modelValue: h.value,
866
- "onUpdate:modelValue": n[1] || (n[1] = (R) => h.value = R),
867
- rules: [a(Pt)()],
866
+ modelValue: g.value,
867
+ "onUpdate:modelValue": n[1] || (n[1] = (R) => g.value = R),
868
+ rules: [a(Rt)()],
868
869
  "label-mark": "required"
869
870
  }, null, 8, ["disabled", "items", "modelValue", "rules"]),
870
871
  y(Nt, {
@@ -876,9 +877,9 @@ const We = {
876
877
  }),
877
878
  modelValue: B.value,
878
879
  "onUpdate:modelValue": n[2] || (n[2] = (R) => B.value = R),
879
- rules: [a(He)(0)]
880
+ rules: [a(Ue)(0)]
880
881
  }, null, 8, ["disabled", "step", "modelValue", "rules"]),
881
- y(C, {
882
+ y(D, {
882
883
  disabled: t.disabled,
883
884
  label: "Unit",
884
885
  items: l.value,
@@ -889,12 +890,12 @@ const We = {
889
890
  class: "col-span-2",
890
891
  disabled: t.disabled,
891
892
  label: "Remark",
892
- modelValue: i.value,
893
- "onUpdate:modelValue": n[4] || (n[4] = (R) => i.value = R),
893
+ modelValue: r.value,
894
+ "onUpdate:modelValue": n[4] || (n[4] = (R) => r.value = R),
894
895
  "label-mark": "optional"
895
896
  }, null, 8, ["disabled", "modelValue"]),
896
897
  e("div", Cn, [
897
- e("div", Dn, p(a(j)("inventory.stock.stock_adjustment.stockAfter")), 1),
898
+ e("div", Dn, p(a(M)("inventory.stock.stock_adjustment.stockAfter")), 1),
898
899
  e("div", {
899
900
  class: ge(["fm-typo-en-body-lg-600", o.value ? "text-red-700" : "text-green-700"])
900
901
  }, p(x.value), 3)
@@ -904,34 +905,34 @@ const We = {
904
905
  });
905
906
  };
906
907
  }
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
+ }), 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" }, Un = /* @__PURE__ */ me({
908
909
  __name: "AdjustSkuDialog",
909
910
  props: {
910
911
  stock: {},
911
912
  show: { type: Boolean }
912
913
  },
913
914
  emits: ["update:show", "submitted"],
914
- setup(k, { expose: m, emit: d }) {
915
- const s = k, j = d, w = Re(), c = Ne(), l = we(), h = Se(), B = z(!1), { t: b } = fe();
916
- function i() {
917
- x(Pe(g));
915
+ setup(h, { expose: m, emit: d }) {
916
+ const s = h, M = d, w = Re(), c = Ne(), l = we(), g = Se(), B = z(!1), { t: b } = fe();
917
+ function r() {
918
+ x(Pe(k));
918
919
  }
919
- const f = z();
920
+ const v = z();
920
921
  m({
921
922
  validateInputs: () => {
922
923
  var n, S;
923
- (S = (n = f.value) == null ? void 0 : n.validateInputs) == null || S.call(n);
924
+ (S = (n = v.value) == null ? void 0 : n.validateInputs) == null || S.call(n);
924
925
  },
925
926
  resetInputsValidation: () => {
926
927
  var n, S;
927
- (S = (n = f.value) == null ? void 0 : n.resetInputsValidation) == null || S.call(n);
928
+ (S = (n = v.value) == null ? void 0 : n.resetInputsValidation) == null || S.call(n);
928
929
  },
929
930
  resetInputs: () => {
930
931
  var n, S;
931
- (S = (n = f.value) == null ? void 0 : n.resetInputs) == null || S.call(n);
932
+ (S = (n = v.value) == null ? void 0 : n.resetInputs) == null || S.call(n);
932
933
  }
933
934
  });
934
- const T = Ye(s, "show"), g = ut({
935
+ const T = Ye(s, "show"), k = ut({
935
936
  remark: "",
936
937
  adjustments: [
937
938
  {
@@ -945,7 +946,7 @@ const We = {
945
946
  ]
946
947
  });
947
948
  $e([() => s.show], ([n]) => {
948
- n && (g.remark = "", g.adjustments = [
949
+ n && (k.remark = "", k.adjustments = [
949
950
  {
950
951
  id: `sku_${(/* @__PURE__ */ new Date()).toISOString()}_${Math.random().toString(16).slice(2, 8)}`,
951
952
  type: ae.enum.PURCHASE,
@@ -961,17 +962,17 @@ const We = {
961
962
  try {
962
963
  await l.adjustSku({
963
964
  remark: n.remark,
964
- adjustments: n.adjustments.map(({ doc: S, remark: C, type: A, amount: I, measurement: R }) => ({
965
+ adjustments: n.adjustments.map(({ doc: S, remark: D, type: A, amount: I, measurement: R }) => ({
965
966
  id: S._id,
966
967
  amount: I,
967
968
  measurement: R,
968
- remark: C,
969
+ remark: D,
969
970
  doc: S,
970
971
  type: A
971
972
  }))
972
- }), j("update:show", !1), j("submitted");
973
+ }), M("update:show", !1), M("submitted");
973
974
  } catch (S) {
974
- h.open({
975
+ g.open({
975
976
  title: b("inventory.stock.adjust.error.title"),
976
977
  message: b("inventory.stock.adjust.error.message"),
977
978
  type: "error"
@@ -981,14 +982,14 @@ const We = {
981
982
  }
982
983
  }
983
984
  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);
985
+ const n = w.skus.map((D) => ({
986
+ label: D.name,
987
+ sublabel: D.code,
988
+ value: D._id
989
+ })), S = n.filter((D) => k.adjustments.find((A) => A.doc._id === D.value)).map((D) => D.value);
989
990
  c.open({
990
991
  title: "Select ingredients",
991
- contentComponent: pt,
992
+ contentComponent: vt,
992
993
  contentComponentProps: {
993
994
  items: n,
994
995
  modelValue: S
@@ -1005,9 +1006,9 @@ const We = {
1005
1006
  close: !0,
1006
1007
  variant: "tertiary"
1007
1008
  }
1008
- }).onPrimary((C) => {
1009
- g.adjustments = C.map(
1010
- (A) => g.adjustments.find((I) => I.doc._id === A) ?? {
1009
+ }).onPrimary((D) => {
1010
+ k.adjustments = D.map(
1011
+ (A) => k.adjustments.find((I) => I.doc._id === A) ?? {
1011
1012
  id: `sku_${(/* @__PURE__ */ new Date()).toISOString()}_${Math.random().toString(16).slice(2, 8)}`,
1012
1013
  type: ae.enum.PURCHASE,
1013
1014
  doc: w.skus.find((I) => I._id === A),
@@ -1019,33 +1020,33 @@ const We = {
1019
1020
  });
1020
1021
  }
1021
1022
  function t(n) {
1022
- g.adjustments.splice(n, 1);
1023
+ k.adjustments.splice(n, 1);
1023
1024
  }
1024
1025
  return (n, S) => {
1025
- const C = H("FmTextarea"), A = H("FmButton"), I = H("FmForm"), R = H("FmSideSheet");
1026
- return D(), X(R, {
1026
+ const D = U("FmTextarea"), A = U("FmButton"), I = U("FmForm"), R = U("FmSideSheet");
1027
+ return j(), X(R, {
1027
1028
  modelValue: a(T),
1028
1029
  "onUpdate:modelValue": S[2] || (S[2] = (K) => Ee(T) ? T.value = K : null),
1029
1030
  "dismiss-away": "",
1030
1031
  "max-width": 500
1031
1032
  }, {
1032
- "side-sheet-header": U(() => [
1033
+ "side-sheet-header": H(() => [
1033
1034
  e("div", jn, [
1034
1035
  e("div", Mn, p(a(b)("inventory.stock.adjust.title")), 1)
1035
1036
  ])
1036
1037
  ]),
1037
- default: U(() => [
1038
+ default: H(() => [
1038
1039
  y(I, {
1039
1040
  class: "w-full flex flex-col gap-12",
1040
1041
  ref_key: "formRef",
1041
- ref: f,
1042
- onValidationSuccess: i
1042
+ ref: v,
1043
+ onValidationSuccess: r
1043
1044
  }, {
1044
- default: U(() => [
1045
- y(C, {
1045
+ default: H(() => [
1046
+ y(D, {
1046
1047
  label: a(b)("inventory.stock.adjust.remark"),
1047
- modelValue: g.remark,
1048
- "onUpdate:modelValue": S[0] || (S[0] = (K) => g.remark = K)
1048
+ modelValue: k.remark,
1049
+ "onUpdate:modelValue": S[0] || (S[0] = (K) => k.remark = K)
1049
1050
  }, null, 8, ["label", "modelValue"]),
1050
1051
  e("div", Bn, [
1051
1052
  e("div", In, p(a(b)("inventory.stock.adjust.adjustedItems")), 1),
@@ -1056,24 +1057,24 @@ const We = {
1056
1057
  onClick: o
1057
1058
  })
1058
1059
  ]),
1059
- (D(!0), W(le, null, ce(g.adjustments, (K, O) => (D(), X(ht, {
1060
+ (j(!0), W(le, null, ce(k.adjustments, (K, O) => (j(), X(ht, {
1060
1061
  key: K.id,
1061
- modelValue: g.adjustments[O],
1062
- "onUpdate:modelValue": (Z) => g.adjustments[O] = Z,
1062
+ modelValue: k.adjustments[O],
1063
+ "onUpdate:modelValue": (Z) => k.adjustments[O] = Z,
1063
1064
  "onClick:delete": (Z) => t(O)
1064
1065
  }, null, 8, ["modelValue", "onUpdate:modelValue", "onClick:delete"]))), 128))
1065
1066
  ]),
1066
1067
  _: 1
1067
1068
  }, 512)
1068
1069
  ]),
1069
- "side-sheet-footer": U(() => [
1070
+ "side-sheet-footer": H(() => [
1070
1071
  e("div", Tn, [
1071
1072
  y(A, {
1072
1073
  label: a(b)("inventory.stock.adjust.adjustButton"),
1073
1074
  loading: B.value,
1074
1075
  onClick: S[1] || (S[1] = (K) => {
1075
1076
  var O, Z;
1076
- return (Z = (O = f.value) == null ? void 0 : O.validateInputs) == null ? void 0 : Z.call(O);
1077
+ return (Z = (O = v.value) == null ? void 0 : O.validateInputs) == null ? void 0 : Z.call(O);
1077
1078
  })
1078
1079
  }, null, 8, ["label", "loading"])
1079
1080
  ])
@@ -1082,50 +1083,50 @@ const We = {
1082
1083
  }, 8, ["modelValue"]);
1083
1084
  };
1084
1085
  }
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
+ }), 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({
1086
1087
  __name: "StockAdjustmentSideSheet",
1087
1088
  props: {
1088
1089
  show: { type: Boolean }
1089
1090
  },
1090
1091
  emits: ["update:show", "submitted"],
1091
- setup(k, { emit: m }) {
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({
1092
+ setup(h, { emit: m }) {
1093
+ const d = h, s = m, { t: M } = fe(), w = Re(), c = we(), l = Ne(), g = Se(), B = Ye(d, "show"), b = z(!1), r = ut({
1093
1094
  remark: "",
1094
1095
  effectiveAt: /* @__PURE__ */ new Date(),
1095
1096
  adjustments: []
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()) {
1097
+ }), v = z(ye().format("YYYY-MM-DD")), T = z(ye().format("HH:mm"));
1098
+ $e([v, T], () => {
1099
+ if (v.value && T.value) {
1100
+ const D = ye(`${v.value} ${T.value}`, "YYYY-MM-DD HH:mm");
1101
+ if (D.isValid()) {
1101
1102
  const A = ye();
1102
- C.isAfter(A) ? i.effectiveAt = A.toDate() : i.effectiveAt = C.toDate();
1103
+ D.isAfter(A) ? r.effectiveAt = A.toDate() : r.effectiveAt = D.toDate();
1103
1104
  }
1104
1105
  }
1105
1106
  });
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");
1107
+ function k() {
1108
+ r.remark = "", r.effectiveAt = /* @__PURE__ */ new Date(), r.adjustments = [], v.value = ye(r.effectiveAt).format("YYYY-MM-DD"), T.value = ye(r.effectiveAt).format("HH:mm");
1108
1109
  }
1109
1110
  function x() {
1110
- g();
1111
+ k();
1111
1112
  }
1112
1113
  const o = Y(() => {
1113
- const C = {};
1114
+ const D = {};
1114
1115
  return w.skus.forEach((A) => {
1115
- C[A._id] = A;
1116
- }), C;
1116
+ D[A._id] = A;
1117
+ }), D;
1117
1118
  });
1118
1119
  function t() {
1119
- const C = w.skus.map((I) => ({
1120
+ const D = w.skus.map((I) => ({
1120
1121
  label: I.name,
1121
1122
  sublabel: I.code,
1122
1123
  value: I._id
1123
- })), A = i.adjustments.map((I) => I.doc._id);
1124
+ })), A = r.adjustments.map((I) => I.doc._id);
1124
1125
  l.open({
1125
- title: j("inventory.stock.adjust.selectIngredients"),
1126
- contentComponent: pt,
1126
+ title: M("inventory.stock.adjust.selectIngredients"),
1127
+ contentComponent: vt,
1127
1128
  contentComponentProps: {
1128
- items: C,
1129
+ items: D,
1129
1130
  modelValue: A,
1130
1131
  virtualScroll: !0
1131
1132
  },
@@ -1133,17 +1134,17 @@ const We = {
1133
1134
  closeButton: !0,
1134
1135
  dismissAway: !0,
1135
1136
  primaryActions: {
1136
- text: j("common.confirm"),
1137
+ text: M("common.confirm"),
1137
1138
  close: !0
1138
1139
  },
1139
1140
  secondaryActions: {
1140
- text: j("common.close"),
1141
+ text: M("common.close"),
1141
1142
  close: !0,
1142
1143
  variant: "tertiary"
1143
1144
  }
1144
1145
  }).onPrimary((I) => {
1145
- i.adjustments = I.map(
1146
- (R) => i.adjustments.find((K) => K.doc._id === R) ?? {
1146
+ r.adjustments = I.map(
1147
+ (R) => r.adjustments.find((K) => K.doc._id === R) ?? {
1147
1148
  id: "",
1148
1149
  type: ae.enum.PURCHASE,
1149
1150
  doc: o.value[R],
@@ -1154,21 +1155,21 @@ const We = {
1154
1155
  );
1155
1156
  });
1156
1157
  }
1157
- function n(C) {
1158
- i.adjustments.splice(C, 1);
1158
+ function n(D) {
1159
+ r.adjustments.splice(D, 1);
1159
1160
  }
1160
1161
  async function S() {
1161
- if (i.adjustments.length === 0) {
1162
- h.open({
1163
- title: j("inventory.stock.error.title"),
1164
- message: j("inventory.stock.stock_adjustment.noAdjustments"),
1162
+ if (r.adjustments.length === 0) {
1163
+ g.open({
1164
+ title: M("inventory.stock.error.title"),
1165
+ message: M("inventory.stock.stock_adjustment.noAdjustments"),
1165
1166
  type: "warning"
1166
1167
  });
1167
1168
  return;
1168
1169
  }
1169
1170
  b.value = !0;
1170
1171
  try {
1171
- const C = i.adjustments.map(
1172
+ const D = r.adjustments.map(
1172
1173
  ({ doc: I, remark: R, type: K, amount: O, measurement: Z }) => ({
1173
1174
  id: I._id,
1174
1175
  amount: O,
@@ -1178,51 +1179,51 @@ const We = {
1178
1179
  type: K
1179
1180
  })
1180
1181
  ), A = {
1181
- remark: i.remark,
1182
- adjustments: C,
1183
- effectiveAt: i.effectiveAt.toISOString()
1182
+ remark: r.remark,
1183
+ adjustments: D,
1184
+ effectiveAt: r.effectiveAt.toISOString()
1184
1185
  };
1185
1186
  await c.adjustSku(Pe(A)), s("submitted"), s("update:show", !1);
1186
- } catch (C) {
1187
- h.open({
1188
- title: j("inventory.stock.adjust.error.title"),
1189
- message: j("inventory.stock.adjust.error.message"),
1187
+ } catch (D) {
1188
+ g.open({
1189
+ title: M("inventory.stock.adjust.error.title"),
1190
+ message: M("inventory.stock.adjust.error.message"),
1190
1191
  type: "error"
1191
- }), console.error("error on stock adjustment", C);
1192
+ }), console.error("error on stock adjustment", D);
1192
1193
  } finally {
1193
1194
  b.value = !1;
1194
1195
  }
1195
1196
  }
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, {
1197
+ return (D, A) => {
1198
+ const I = U("FmTextarea"), R = U("FmDatePicker"), K = U("FmTimePicker"), O = U("FmButton"), Z = U("FmSideSheet");
1199
+ return j(), X(Z, {
1199
1200
  modelValue: a(B),
1200
1201
  "onUpdate:modelValue": A[4] || (A[4] = (q) => Ee(B) ? B.value = q : null),
1201
1202
  "dismiss-away": "",
1202
1203
  "max-width": 560,
1203
1204
  onAfterEnter: x
1204
1205
  }, {
1205
- "side-sheet-header": U(() => [
1206
- e("div", Un, [
1207
- e("div", En, p(a(j)("inventory.stock.stock_adjustment.title")), 1)
1206
+ "side-sheet-header": H(() => [
1207
+ e("div", Hn, [
1208
+ e("div", En, p(a(M)("inventory.stock.stock_adjustment.title")), 1)
1208
1209
  ])
1209
1210
  ]),
1210
- default: U(() => [
1211
+ default: H(() => [
1211
1212
  e("div", Pn, [
1212
1213
  y(I, {
1213
- label: a(j)("inventory.stock.adjust.remark"),
1214
- modelValue: i.remark,
1215
- "onUpdate:modelValue": A[0] || (A[0] = (q) => i.remark = q),
1214
+ label: a(M)("inventory.stock.adjust.remark"),
1215
+ modelValue: r.remark,
1216
+ "onUpdate:modelValue": A[0] || (A[0] = (q) => r.remark = q),
1216
1217
  "label-mark": "optional"
1217
1218
  }, null, 8, ["label", "modelValue"]),
1218
1219
  e("div", Rn, [
1219
- e("label", On, p(a(j)("inventory.stock.stock_adjustment.effectiveAt")), 1),
1220
+ e("label", On, p(a(M)("inventory.stock.stock_adjustment.effectiveAt")), 1),
1220
1221
  e("div", Nn, [
1221
1222
  e("div", Yn, [
1222
1223
  y(R, {
1223
1224
  class: "w-full",
1224
- modelValue: f.value,
1225
- "onUpdate:modelValue": A[1] || (A[1] = (q) => f.value = q),
1225
+ modelValue: v.value,
1226
+ "onUpdate:modelValue": A[1] || (A[1] = (q) => v.value = q),
1226
1227
  clearable: !1,
1227
1228
  max: a(ye)().format("YYYY-MM-DD")
1228
1229
  }, null, 8, ["modelValue", "max"])
@@ -1236,10 +1237,10 @@ const We = {
1236
1237
  }, null, 8, ["modelValue"])
1237
1238
  ])
1238
1239
  ]),
1239
- e("div", zn, p(a(j)("inventory.stock.stock_adjustment.immediateHint")), 1)
1240
+ e("div", zn, p(a(M)("inventory.stock.stock_adjustment.immediateHint")), 1)
1240
1241
  ]),
1241
1242
  e("div", Gn, [
1242
- e("div", Wn, p(a(j)("inventory.stock.adjust.adjustedItems")), 1),
1243
+ e("div", Wn, p(a(M)("inventory.stock.adjust.adjustedItems")), 1),
1243
1244
  y(O, {
1244
1245
  "prepend-icon": "add",
1245
1246
  variant: "tertiary",
@@ -1247,23 +1248,23 @@ const We = {
1247
1248
  onClick: t
1248
1249
  })
1249
1250
  ]),
1250
- (D(!0), W(le, null, ce(i.adjustments, (q, ue) => (D(), X(ht, {
1251
+ (j(!0), W(le, null, ce(r.adjustments, (q, ue) => (j(), X(ht, {
1251
1252
  key: q.id,
1252
- modelValue: i.adjustments[ue],
1253
- "onUpdate:modelValue": (ee) => i.adjustments[ue] = ee,
1253
+ modelValue: r.adjustments[ue],
1254
+ "onUpdate:modelValue": (ee) => r.adjustments[ue] = ee,
1254
1255
  "onClick:delete": (ee) => n(ue)
1255
1256
  }, null, 8, ["modelValue", "onUpdate:modelValue", "onClick:delete"]))), 128))
1256
1257
  ])
1257
1258
  ]),
1258
- "side-sheet-footer": U(() => [
1259
+ "side-sheet-footer": H(() => [
1259
1260
  e("div", Kn, [
1260
1261
  y(O, {
1261
- label: a(j)("common.confirm"),
1262
+ label: a(M)("common.confirm"),
1262
1263
  loading: b.value,
1263
1264
  onClick: S
1264
1265
  }, null, 8, ["label", "loading"]),
1265
1266
  y(O, {
1266
- label: a(j)("common.close"),
1267
+ label: a(M)("common.close"),
1267
1268
  variant: "tertiary",
1268
1269
  onClick: A[3] || (A[3] = (q) => s("update:show", !1))
1269
1270
  }, null, 8, ["label"])
@@ -1273,19 +1274,19 @@ const We = {
1273
1274
  }, 8, ["modelValue"]);
1274
1275
  };
1275
1276
  }
1276
- }), Xn = $t((k, m) => ({
1277
+ }), Xn = $t((h, m) => ({
1277
1278
  // TODO: remove once latest inventory backend has been push
1278
- async findBillsByBusinessId(d, s, j) {
1279
- const w = `${k.businessesBackendUrl}/${d}/reports/find-many`, c = {
1279
+ async findBillsByBusinessId(d, s, M) {
1280
+ const w = `${h.businessesBackendUrl}/${d}/reports/find-many`, c = {
1280
1281
  // type: TYPE.bill,
1281
1282
  type: "bill",
1282
1283
  restaurantIds: s,
1283
- ids: j
1284
+ ids: M
1284
1285
  };
1285
1286
  return await m.post(w, c);
1286
1287
  },
1287
1288
  async findBillsById(d) {
1288
- const j = xe().currentLocationDBName, w = `${k.inventoryBackendUrl}/${j}/bill/search`, c = {
1289
+ const M = xe().currentLocationDBName, w = `${h.inventoryBackendUrl}/${M}/bill/search`, c = {
1289
1290
  ids: d
1290
1291
  };
1291
1292
  return await m.post(w, c);
@@ -1302,79 +1303,79 @@ const We = {
1302
1303
  modelModifiers: {}
1303
1304
  }),
1304
1305
  emits: /* @__PURE__ */ Qe(["refreshHistory"], ["update:modelValue"]),
1305
- setup(k, { emit: m }) {
1306
- const d = k, s = m, j = we(), w = bt(k, "modelValue"), c = z(!1), l = z(!1), h = z(!1), B = z({
1306
+ setup(h, { emit: m }) {
1307
+ const d = h, s = m, M = we(), w = bt(h, "modelValue"), c = z(!1), l = z(!1), g = z(!1), B = z({
1307
1308
  _id: `inventoryAdjustment_${(/* @__PURE__ */ new Date()).toISOString()}_XXXXX`,
1308
1309
  skus: []
1309
1310
  }), b = z();
1310
1311
  qe(async () => {
1311
1312
  c.value = !0;
1312
- const o = await j.readSingleAdjustment(d.adjustmentId);
1313
+ const o = await M.readSingleAdjustment(d.adjustmentId);
1313
1314
  if (!o) throw new Error("Adjustment not found");
1314
1315
  B.value = o, c.value = !1;
1315
1316
  });
1316
- async function i() {
1317
+ async function r() {
1317
1318
  var t, n;
1318
1319
  if ((n = (t = b == null ? void 0 : b.value) == null ? void 0 : t.validateInputs) == null || n.call(t), !l.value) return;
1319
1320
  const o = {};
1320
1321
  Object.keys(w.value || {}).forEach((S) => {
1321
- var C;
1322
- Object.keys(((C = w.value) == null ? void 0 : C[S]) || {}).forEach((A) => {
1322
+ var D;
1323
+ Object.keys(((D = w.value) == null ? void 0 : D[S]) || {}).forEach((A) => {
1323
1324
  var R, K;
1324
1325
  const I = (K = (R = w.value) == null ? void 0 : R[S]) == null ? void 0 : K[Number(A)];
1325
1326
  I && T(I.amount) > 0 && (o[S] || (o[S] = []), o[S].push(I));
1326
1327
  });
1327
- }), await j.revertWastageAdjustment({
1328
+ }), await M.revertWastageAdjustment({
1328
1329
  targetWastageAdjustmentId: d.adjustmentId,
1329
1330
  amountsGoingToAdjust: o
1330
- }), s("refreshHistory"), h.value = !1, w.value = {};
1331
+ }), s("refreshHistory"), g.value = !1, w.value = {};
1331
1332
  }
1332
- function f(o) {
1333
- const { skuId: t, idx: n, unit: S, measurement: C } = o;
1333
+ function v(o) {
1334
+ const { skuId: t, idx: n, unit: S, measurement: D } = o;
1334
1335
  return Y({
1335
1336
  get: () => {
1336
1337
  var R, K, O;
1337
1338
  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;
1339
+ return A ? Number(ve.toFormatString({ value: A })) : 0;
1339
1340
  },
1340
1341
  set: (A) => {
1341
1342
  w.value || (w.value = {});
1342
1343
  const I = { ...w.value };
1343
1344
  I[t] || (I[t] = {}), I[t][n] = {
1344
- amount: pe.convertPrecision({
1345
- value: pe.fromNumber(A),
1345
+ amount: ve.convertPrecision({
1346
+ value: ve.fromNumber(A),
1346
1347
  precision: Ce(S)
1347
1348
  }),
1348
1349
  type: ae.Enum.WASTAGE,
1349
- measurement: C
1350
+ measurement: D
1350
1351
  }, w.value = I;
1351
1352
  }
1352
1353
  });
1353
1354
  }
1354
1355
  function T(o, t = !0) {
1355
- const n = Number(pe.toFormatString({ value: o }));
1356
+ const n = Number(ve.toFormatString({ value: o }));
1356
1357
  return t ? Math.abs(n) : n;
1357
1358
  }
1358
- function g(o, t) {
1359
+ function k(o, t) {
1359
1360
  return t.measurement ? t.measurement.abbrev : o.sku.unit.abbrev;
1360
1361
  }
1361
1362
  function x(o, t) {
1362
1363
  if (t.amount === 0) return "N/A";
1363
- const n = pe.add([o, t]);
1364
- return n ? pe.toFormatString({ value: n }) : "N/A";
1364
+ const n = ve.add([o, t]);
1365
+ return n ? ve.toFormatString({ value: n }) : "N/A";
1365
1366
  }
1366
1367
  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, {
1369
- modelValue: h.value,
1370
- "onUpdate:modelValue": t[4] || (t[4] = (O) => h.value = O),
1368
+ const n = U("FmIcon"), S = U("FmStepperField"), D = U("FmCard"), A = U("FmForm"), I = U("FmSpacer"), R = U("FmButton"), K = U("FmDialog");
1369
+ return j(), X(K, {
1370
+ modelValue: g.value,
1371
+ "onUpdate:modelValue": t[4] || (t[4] = (O) => g.value = O),
1371
1372
  overlay: !0
1372
1373
  }, {
1373
- "dialog-button": U(() => [
1374
+ "dialog-button": H(() => [
1374
1375
  y(Xe, null, {
1375
- default: U(() => [
1376
+ default: H(() => [
1376
1377
  e("button", {
1377
- onClick: t[0] || (t[0] = (O) => h.value = !0),
1378
+ onClick: t[0] || (t[0] = (O) => g.value = !0),
1378
1379
  class: "rounded-md hover:bg-gray-100 transition-colors"
1379
1380
  }, [
1380
1381
  y(n, {
@@ -1386,10 +1387,10 @@ const We = {
1386
1387
  _: 1
1387
1388
  })
1388
1389
  ]),
1389
- "dialog-header": U(() => t[5] || (t[5] = [
1390
+ "dialog-header": H(() => t[5] || (t[5] = [
1390
1391
  e("div", null, "Amend Adjustment", -1)
1391
1392
  ])),
1392
- "dialog-footer": U(() => [
1393
+ "dialog-footer": H(() => [
1393
1394
  e("div", ao, [
1394
1395
  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)),
1395
1396
  e("div", lo, [
@@ -1399,20 +1400,20 @@ const We = {
1399
1400
  label: "Close",
1400
1401
  size: "md",
1401
1402
  variant: "tertiary",
1402
- onClick: t[3] || (t[3] = (O) => h.value = !1)
1403
+ onClick: t[3] || (t[3] = (O) => g.value = !1)
1403
1404
  }),
1404
1405
  y(R, {
1405
1406
  class: "sm:w-full xs:w-full",
1406
1407
  label: "Submit",
1407
1408
  size: "md",
1408
1409
  variant: "primary",
1409
- onClick: i
1410
+ onClick: r
1410
1411
  })
1411
1412
  ])
1412
1413
  ])
1413
1414
  ]),
1414
- default: U(() => [
1415
- c.value ? (D(), W("div", Jn)) : (D(), X(A, {
1415
+ default: H(() => [
1416
+ c.value ? (j(), W("div", Jn)) : (j(), X(A, {
1416
1417
  key: 1,
1417
1418
  ref_key: "formRef",
1418
1419
  ref: b,
@@ -1424,20 +1425,20 @@ const We = {
1424
1425
  }),
1425
1426
  blameFormChildOnValidationFailed: ""
1426
1427
  }, {
1427
- default: U(() => [
1428
+ default: H(() => [
1428
1429
  e("p", Qn, [
1429
1430
  t[6] || (t[6] = e("b", null, "Date:", -1)),
1430
1431
  t[7] || (t[7] = e("br", null, null, -1)),
1431
- ve(" " + p(a(Yt)(a(Vt)(B.value._id))), 1)
1432
+ pe(" " + p(a(Yt)(a(Vt)(B.value._id))), 1)
1432
1433
  ]),
1433
1434
  e("div", Zn, [
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, {
1435
+ (j(!0), W(le, null, ce(B.value.skus, (O, Z) => (j(), W(le, { key: Z }, [
1436
+ (j(!0), W(le, null, ce(O.amounts, (q, ue) => (j(), X(D, {
1436
1437
  key: ue,
1437
1438
  variant: "outlined",
1438
1439
  class: "p-2"
1439
1440
  }, {
1440
- default: U(() => [
1441
+ default: H(() => [
1441
1442
  e("div", eo, [
1442
1443
  e("span", to, p(O.sku.code), 1),
1443
1444
  e("span", null, p(O.sku.name), 1)
@@ -1449,16 +1450,16 @@ const We = {
1449
1450
  ]),
1450
1451
  e("div", oo, [
1451
1452
  t[9] || (t[9] = e("span", { class: "fm-typo-en-body-lg-600" }, "Current amount:", -1)),
1452
- e("span", null, p(a(pe).toFormatString({ value: q.amount })) + " " + p(g(O, q)), 1)
1453
+ e("span", null, p(a(ve).toFormatString({ value: q.amount })) + " " + p(k(O, q)), 1)
1453
1454
  ]),
1454
1455
  y(S, {
1455
1456
  "max-fraction-digits": a(Ce)(O.sku.unit),
1456
- "model-value": f({
1457
+ "model-value": v({
1457
1458
  skuId: O.sku._id,
1458
1459
  idx: ue,
1459
1460
  unit: O.sku.unit
1460
1461
  }).value,
1461
- "onUpdate:modelValue": (ee) => f({
1462
+ "onUpdate:modelValue": (ee) => v({
1462
1463
  skuId: O.sku._id,
1463
1464
  idx: ue,
1464
1465
  unit: O.sku.unit
@@ -1466,25 +1467,25 @@ const We = {
1466
1467
  class: "mb-3",
1467
1468
  label: "Adjust Amount (Leave 0 to skip)",
1468
1469
  "helper-text": `Max: ${T(q.amount)}`,
1469
- "append-text": g(O, q),
1470
+ "append-text": k(O, q),
1470
1471
  rules: [
1471
1472
  (ee) => ee <= T(q.amount) || `Cannot be more than ${T(q.amount)}`,
1472
- a(He)(-1)
1473
+ a(Ue)(-1)
1473
1474
  ]
1474
1475
  }, null, 8, ["max-fraction-digits", "model-value", "onUpdate:modelValue", "helper-text", "append-text", "rules"]),
1475
1476
  e("div", so, [
1476
1477
  t[10] || (t[10] = e("span", { class: "fm-typo-en-body-lg-600" }, "Amount after amend:", -1)),
1477
1478
  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)),
1478
- ve(" " + p(x(
1479
+ pe(" " + p(x(
1479
1480
  q.amount,
1480
- a(pe).fromNumber(
1481
- f({
1481
+ a(ve).fromNumber(
1482
+ v({
1482
1483
  skuId: O.sku._id,
1483
1484
  idx: ue,
1484
1485
  unit: O.sku.unit
1485
1486
  }).value
1486
1487
  )
1487
- )) + " " + p(g(O, q)), 1)
1488
+ )) + " " + p(k(O, q)), 1)
1488
1489
  ])
1489
1490
  ]),
1490
1491
  _: 2
@@ -1502,7 +1503,7 @@ const We = {
1502
1503
  }), io = { class: "p-16" }, uo = { class: "fm-typo-en-body-md-600 flex-grow" }, co = { class: "flex-grow text-fm-color-typo-secondary" }, mo = {
1503
1504
  key: 0,
1504
1505
  class: "my-5"
1505
- }, fo = { class: "text-neutral-400" }, vo = { class: "flex-grow" }, po = { class: "flex gap-1" }, yo = { class: "flex flex-col gap-1" }, _o = {
1506
+ }, fo = { class: "text-neutral-400" }, po = { class: "flex-grow" }, vo = { class: "flex gap-1" }, yo = { class: "flex flex-col gap-1" }, _o = {
1506
1507
  key: 1,
1507
1508
  class: "t-system text-fsecondary"
1508
1509
  }, ko = {
@@ -1520,68 +1521,68 @@ const We = {
1520
1521
  unitCostHistory: { default: () => [] },
1521
1522
  costMechanism: { default: "adjustment" }
1522
1523
  },
1523
- setup(k) {
1524
- const m = k;
1525
- function d(b, i) {
1524
+ setup(h) {
1525
+ const m = h;
1526
+ function d(b, r) {
1526
1527
  if (m.costMechanism === "adjustment")
1527
1528
  return null;
1528
- const f = m.unitCostHistory.filter(
1529
+ const v = m.unitCostHistory.filter(
1529
1530
  (x) => x.mechanism === m.costMechanism && x.skuId === m.sku._id
1530
1531
  );
1531
- if (f.length === 0) return null;
1532
- const T = f.find((x) => {
1532
+ if (v.length === 0) return null;
1533
+ const T = v.find((x) => {
1533
1534
  const o = x.meta;
1534
1535
  return (o == null ? void 0 : o.adjustmentId) === b;
1535
1536
  });
1536
1537
  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;
1538
+ const k = [...v].filter((x) => new Date(x.snapshotAt) <= new Date(r)).sort((x, o) => new Date(o.snapshotAt).getTime() - new Date(x.snapshotAt).getTime());
1539
+ return k.length > 0 ? k[0].cost : null;
1539
1540
  }
1540
- const s = z(!1), j = z(), w = z(null), c = Y(() => w.value === null ? "unset" : s.value ? `${w.value}px` : "0px");
1541
+ const s = z(!1), M = z(), w = z(null), c = Y(() => w.value === null ? "unset" : s.value ? `${w.value}px` : "0px");
1541
1542
  qe(() => {
1542
1543
  var b;
1543
- w.value = ((b = j.value) == null ? void 0 : b.scrollHeight) || 0;
1544
+ w.value = ((b = M.value) == null ? void 0 : b.scrollHeight) || 0;
1544
1545
  });
1545
1546
  const l = Y(() => {
1546
1547
  var x;
1547
- const b = m.record.adjustments, i = m.sku, f = {}, g = b.flatMap((o) => {
1548
+ const b = m.record.adjustments, r = m.sku, v = {}, k = b.flatMap((o) => {
1548
1549
  var t;
1549
- return ((t = o.skus) == null ? void 0 : t.filter((n) => n.sku._id === i._id)) ?? [];
1550
+ return ((t = o.skus) == null ? void 0 : t.filter((n) => n.sku._id === r._id)) ?? [];
1550
1551
  }).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]);
1552
+ for (const o of k) {
1553
+ const t = o.measurement ? dt(o.measurement.conversion, o.amount) : o.amount;
1554
+ v[x = o.type] ?? (v[x] = { amount: 0, precision: 0 }), v[o.type] = Je(t, v[o.type]);
1554
1555
  }
1555
- return Object.entries(f).reduce(
1556
+ return Object.entries(v).reduce(
1556
1557
  (o, [t, n]) => (o[t] = /// comment, because without it formatter makes code uglier
1557
1558
  `${Q.toFormatString({
1558
1559
  value: n,
1559
1560
  precision: 4
1560
- })} ${i.unit.abbrev}`, o),
1561
+ })} ${r.unit.abbrev}`, o),
1561
1562
  {}
1562
1563
  );
1563
- }), { t: h } = fe(), B = Y(() => m.record.adjustmentsByTime.map(({ date: b, adjustments: i }) => ({
1564
+ }), { t: g } = fe(), B = Y(() => m.record.adjustmentsByTime.map(({ date: b, adjustments: r }) => ({
1564
1565
  time: Lt(new Date(b)),
1565
- adjustments: i.flatMap(
1566
- (f) => {
1567
- var T, g;
1568
- return ((g = (T = f.skus) == null ? void 0 : T.map) == null ? void 0 : g.call(T, (x) => {
1566
+ adjustments: r.flatMap(
1567
+ (v) => {
1568
+ var T, k;
1569
+ return ((k = (T = v.skus) == null ? void 0 : T.map) == null ? void 0 : k.call(T, (x) => {
1569
1570
  var o, t;
1570
1571
  return {
1571
1572
  ...x,
1572
- ref: f.ref,
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,
1575
- adjustmentId: f._id,
1576
- adjustmentTime: f.effectiveAt ?? Ie(f._id)
1573
+ ref: v.ref,
1574
+ backdateFrom: v.effectiveAt != null ? Te(v._id) : null,
1575
+ toBalance: (t = (o = v.skus) == null ? void 0 : o[0]) == null ? void 0 : t.toBalance,
1576
+ adjustmentId: v._id,
1577
+ adjustmentTime: v.effectiveAt ?? Te(v._id)
1577
1578
  };
1578
1579
  })) ?? [];
1579
1580
  }
1580
- ).flatMap((f) => {
1581
+ ).flatMap((v) => {
1581
1582
  var t;
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;
1583
+ const T = (t = m.bills.find((n) => n._id === v.ref)) == null ? void 0 : t.seqNumber, k = T ? g("inventory.stock.record.bill", [T]) : "", x = v.adjustmentTime ?? (/* @__PURE__ */ new Date()).toISOString(), o = d(v.adjustmentId, x);
1584
+ return v.amounts.map((n) => {
1585
+ var D;
1585
1586
  let S = n.cost;
1586
1587
  if (o) {
1587
1588
  const A = Q.fromDinero(o), I = n.amount, R = n.measurement ? Q.multiply([I, n.measurement.conversion]) : I;
@@ -1591,44 +1592,44 @@ const We = {
1591
1592
  };
1592
1593
  }
1593
1594
  return {
1594
- amount: `${Q.toFormatString({ value: n.amount, precision: 4 })} ${((C = n.measurement) == null ? void 0 : C.abbrev) ?? f.sku.unit.abbrev}`,
1595
- backdateFrom: f.backdateFrom,
1595
+ amount: `${Q.toFormatString({ value: n.amount, precision: 4 })} ${((D = n.measurement) == null ? void 0 : D.abbrev) ?? v.sku.unit.abbrev}`,
1596
+ backdateFrom: v.backdateFrom,
1596
1597
  name: n.type,
1597
- billRemark: g,
1598
+ billRemark: k,
1598
1599
  remark: n.remark || "",
1599
1600
  cost: S,
1600
1601
  toBalance: Q.toFormatString({
1601
- value: f.toBalance ?? Q.fromNumber(0),
1602
+ value: v.toBalance ?? Q.fromNumber(0),
1602
1603
  precision: 4
1603
1604
  }),
1604
- baseUnit: f.sku.unit.abbrev,
1605
- adjustmentId: f.adjustmentId
1605
+ baseUnit: v.sku.unit.abbrev,
1606
+ adjustmentId: v.adjustmentId
1606
1607
  };
1607
1608
  });
1608
1609
  })
1609
1610
  })));
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(() => [
1611
+ return (b, r) => {
1612
+ const v = U("FmIcon"), T = U("FmTooltip"), k = U("FmCard");
1613
+ return j(), X(k, { variant: "outlined" }, {
1614
+ default: H(() => [
1614
1615
  e("div", io, [
1615
1616
  e("div", {
1616
1617
  class: "flex items-center cursor-pointer mb-1",
1617
- onClick: i[0] || (i[0] = (x) => s.value = !s.value)
1618
+ onClick: r[0] || (r[0] = (x) => s.value = !s.value)
1618
1619
  }, [
1619
1620
  e("div", uo, p(b.record.date), 1),
1620
- y(f, {
1621
+ y(v, {
1621
1622
  name: s.value ? "expand_more" : "expand_less",
1622
1623
  color: "#777777",
1623
1624
  size: "md"
1624
1625
  }, null, 8, ["name"])
1625
1626
  ]),
1626
- (D(!0), W(le, null, ce(l.value, (x, o) => (D(), W("div", {
1627
+ (j(!0), W(le, null, ce(l.value, (x, o) => (j(), W("div", {
1627
1628
  key: o,
1628
1629
  class: "flex flex-row py-1",
1629
1630
  style: { "font-size": "0.8rem" }
1630
1631
  }, [
1631
- e("div", co, p(a(h)(`inventory.inventoryAdjustment.type.${o}`)), 1),
1632
+ e("div", co, p(a(g)(`inventory.inventoryAdjustment.type.${o}`)), 1),
1632
1633
  e("div", {
1633
1634
  class: ge({
1634
1635
  "text-fm-color-typo-error": x.startsWith("-"),
@@ -1639,7 +1640,7 @@ const We = {
1639
1640
  ]))), 128)),
1640
1641
  e("div", {
1641
1642
  ref_key: "detailRef",
1642
- ref: j,
1643
+ ref: M,
1643
1644
  style: ct({
1644
1645
  fontSize: "0.8rem",
1645
1646
  maxHeight: c.value,
@@ -1647,32 +1648,32 @@ const We = {
1647
1648
  transition: "max-height 0.2s ease-out"
1648
1649
  })
1649
1650
  }, [
1650
- B.value.length ? (D(), W("hr", mo)) : se("", !0),
1651
- (D(!0), W(le, null, ce(B.value, (x) => (D(), W("div", {
1651
+ B.value.length ? (j(), W("hr", mo)) : se("", !0),
1652
+ (j(!0), W(le, null, ce(B.value, (x) => (j(), W("div", {
1652
1653
  key: x.time,
1653
1654
  class: "flex gap-1 w-full"
1654
1655
  }, [
1655
1656
  e("div", fo, p(x.time), 1),
1656
- e("div", vo, [
1657
- (D(!0), W(le, null, ce(x.adjustments, (o) => (D(), W("div", {
1657
+ e("div", po, [
1658
+ (j(!0), W(le, null, ce(x.adjustments, (o) => (j(), W("div", {
1658
1659
  key: o.name,
1659
1660
  class: "flex gap-1"
1660
1661
  }, [
1661
- e("div", po, [
1662
- ve(p(a(h)(`inventory.inventoryAdjustment.type.${o.name}`)) + " ", 1),
1663
- o.backdateFrom ? (D(), X(T, {
1662
+ e("div", vo, [
1663
+ pe(p(a(g)(`inventory.inventoryAdjustment.type.${o.name}`)) + " ", 1),
1664
+ o.backdateFrom ? (j(), X(T, {
1664
1665
  key: 0,
1665
1666
  variant: "plain",
1666
1667
  placement: "top",
1667
1668
  "z-index": 50
1668
1669
  }, {
1669
- content: U(() => [
1670
- e("div", yo, p(a(h)("inventory.stock.record.backdate", [
1670
+ content: H(() => [
1671
+ e("div", yo, p(a(g)("inventory.stock.record.backdate", [
1671
1672
  a(yt)(new Date(o.backdateFrom))
1672
1673
  ])), 1)
1673
1674
  ]),
1674
- default: U(() => [
1675
- y(f, {
1675
+ default: H(() => [
1676
+ y(v, {
1676
1677
  name: "info",
1677
1678
  size: "sm",
1678
1679
  color: "primary"
@@ -1680,12 +1681,12 @@ const We = {
1680
1681
  ]),
1681
1682
  _: 2
1682
1683
  }, 1024)) : se("", !0),
1683
- o.billRemark ? (D(), W("span", _o, " # " + p(o.billRemark), 1)) : se("", !0),
1684
- o.remark ? (D(), W("span", {
1684
+ o.billRemark ? (j(), W("span", _o, " # " + p(o.billRemark), 1)) : se("", !0),
1685
+ o.remark ? (j(), W("span", {
1685
1686
  key: 2,
1686
1687
  class: ge(o.billRemark ? "text-xs text-gray-400" : "")
1687
1688
  }, 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)
1689
+ o.name === a(ae).Enum.CLOSING ? (j(), W("span", ko, " Actual Balance: " + p(o.toBalance) + " " + p(o.baseUnit), 1)) : se("", !0)
1689
1690
  ]),
1690
1691
  e("div", {
1691
1692
  class: ge({
@@ -1694,12 +1695,12 @@ const We = {
1694
1695
  "ml-auto": !0
1695
1696
  })
1696
1697
  }, p(o.amount), 3),
1697
- o.name === a(ae).Enum.WASTAGE ? (D(), X(ro, {
1698
+ o.name === a(ae).Enum.WASTAGE ? (j(), X(ro, {
1698
1699
  key: 0,
1699
1700
  adjustmentId: o.adjustmentId,
1700
- onRefreshHistory: i[1] || (i[1] = (t) => b.$emit("refreshHistory"))
1701
+ onRefreshHistory: r[1] || (r[1] = (t) => b.$emit("refreshHistory"))
1701
1702
  }, null, 8, ["adjustmentId"])) : se("", !0),
1702
- o.cost ? (D(), W("div", ho, " (" + p(a(Me)(o.cost, !1, o.cost.precision)) + ") ", 1)) : se("", !0)
1703
+ o.cost ? (j(), W("div", ho, " (" + p(a(Me)(o.cost, !1, o.cost.precision)) + ") ", 1)) : se("", !0)
1703
1704
  ]))), 128))
1704
1705
  ])
1705
1706
  ]))), 128))
@@ -1711,7 +1712,7 @@ const We = {
1711
1712
  };
1712
1713
  }
1713
1714
  });
1714
- function bo(k, m) {
1715
+ function bo(h, m) {
1715
1716
  var w;
1716
1717
  const d = Object.keys(ae.enum).reduce(
1717
1718
  (c, l) => (c[l] = { amount: 0, precision: 0 }, c),
@@ -1722,19 +1723,19 @@ function bo(k, m) {
1722
1723
  (c, [l]) => (c[l] = Q.fromNumber(0), c),
1723
1724
  {}
1724
1725
  );
1725
- const j = k.flatMap((c) => {
1726
+ const M = h.flatMap((c) => {
1726
1727
  var l;
1727
- return ((l = c.skus) == null ? void 0 : l.filter((h) => h.sku._id === m._id)) ?? [];
1728
+ return ((l = c.skus) == null ? void 0 : l.filter((g) => g.sku._id === m._id)) ?? [];
1728
1729
  }).flatMap((c) => c.amounts);
1729
- for (const c of j) {
1730
+ for (const c of M) {
1730
1731
  const l = c.measurement ? Q.multiply([c.measurement.conversion, c.amount]) : c.amount;
1731
1732
  d[w = c.type] ?? (d[w] = { amount: 0, precision: 0 }), d[c.type] = Q.add([l, d[c.type]]);
1732
1733
  }
1733
1734
  return Object.entries(d).reduce(
1734
- (c, [l, h]) => {
1735
+ (c, [l, g]) => {
1735
1736
  const B = {
1736
- ...h,
1737
- amount: Math.abs(h.amount)
1737
+ ...g,
1738
+ amount: Math.abs(g.amount)
1738
1739
  };
1739
1740
  return c[l] = /// comment, because without it formatter makes code uglier
1740
1741
  `${Q.toFormatString({
@@ -1745,24 +1746,24 @@ function bo(k, m) {
1745
1746
  {}
1746
1747
  );
1747
1748
  }
1748
- function xo(k, m) {
1749
+ function xo(h, m) {
1749
1750
  if (!m)
1750
1751
  return null;
1751
1752
  let d = null;
1752
- const j = k.flatMap((w) => {
1753
+ const M = h.flatMap((w) => {
1753
1754
  var c;
1754
1755
  return ((c = w.skus) == null ? void 0 : c.filter((l) => l.sku._id === m._id)) ?? [];
1755
1756
  }).flatMap((w) => {
1756
1757
  var c;
1757
1758
  return !w.history || ((c = w.history) == null ? void 0 : c.length) === 0 ? [] : w.history[0];
1758
1759
  });
1759
- for (const w of j) {
1760
+ for (const w of M) {
1760
1761
  const c = w.amounts;
1761
1762
  for (const l of c) {
1762
1763
  if (l.type !== ae.Enum.SALES)
1763
1764
  continue;
1764
- const h = l.measurement ? Q.multiply([l.measurement.conversion, l.amount]) : l.amount;
1765
- d ?? (d = Q.fromNumber(0)), d = Q.add([d, h]);
1765
+ const g = l.measurement ? Q.multiply([l.measurement.conversion, l.amount]) : l.amount;
1766
+ d ?? (d = Q.fromNumber(0)), d = Q.add([d, g]);
1766
1767
  }
1767
1768
  }
1768
1769
  return d != null ? (d.amount = Math.abs(d.amount), `${Q.toFormatString({
@@ -1779,10 +1780,10 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
1779
1780
  }, jo = { class: "pb-16" }, Mo = { class: "fm-typo-cn-body-lg-600" }, Bo = {
1780
1781
  class: "grid gap-12 fm-typo-en-body-md-400",
1781
1782
  style: { "grid-template-columns": "auto auto auto", "grid-auto-rows": "1fr" }
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 = {
1783
+ }, 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 = {
1783
1784
  key: 0,
1784
1785
  class: "flex flex-col gap-8"
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 = {
1786
+ }, 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 = {
1786
1787
  key: 2,
1787
1788
  class: "flex-1 flex flex-col items-center gap-8"
1788
1789
  }, _s = ["src"], ks = { class: "font-bold text-lg" }, hs = { class: "text-xs text-neutral-400 text-center" }, gs = /* @__PURE__ */ me({
@@ -1792,10 +1793,10 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
1792
1793
  show: { type: Boolean }
1793
1794
  },
1794
1795
  emits: ["update:show"],
1795
- setup(k) {
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([
1796
+ setup(h) {
1797
+ const m = pt(), d = Oe(), s = we(), M = Xn(), w = xe(), c = Jt(), { t: l } = fe(), g = h, B = z(!1), b = Se(), r = z("adjustment"), v = z([
1797
1798
  { label: "Adjustment (Default)", value: "adjustment" }
1798
- ]), T = z([]), g = z(Kt(0));
1799
+ ]), T = z([]), k = z(Kt(0));
1799
1800
  async function x() {
1800
1801
  B.value = !0;
1801
1802
  try {
@@ -1805,252 +1806,252 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
1805
1806
  title: "Something went wrong",
1806
1807
  message: "Cannot fetch stock history. Please try again.",
1807
1808
  type: "error"
1808
- }), console.log("failed at fetching item adjustment history", h.sku, g, _);
1809
+ }), console.log("failed at fetching item adjustment history", g.sku, k, _);
1809
1810
  } finally {
1810
1811
  B.value = !1;
1811
1812
  }
1812
1813
  }
1813
1814
  qe(() => {
1814
1815
  x();
1815
- }), $e([() => g.value, () => h.sku], () => {
1816
+ }), $e([() => k.value, () => g.sku], () => {
1816
1817
  x();
1817
1818
  });
1818
1819
  const o = z([]), t = z([]), n = z(new Array());
1819
- function S(_, r) {
1820
- return r === "day" ? Wt(_) : yt(_);
1820
+ function S(_, i) {
1821
+ return i === "day" ? Wt(_) : yt(_);
1821
1822
  }
1822
- function C(_, r) {
1823
- const M = _.reduce(
1824
- (V, u) => {
1825
- const F = u.effectiveAt ?? Ie(u._id);
1823
+ function D(_, i) {
1824
+ const V = _.reduce(
1825
+ (C, u) => {
1826
+ const F = u.effectiveAt ?? Te(u._id);
1826
1827
  if (!F)
1827
- return V;
1828
- const N = S(new Date(F), r);
1829
- return V[N] ?? (V[N] = []), V[N].push(u), V;
1828
+ return C;
1829
+ const N = S(new Date(F), i);
1830
+ return C[N] ?? (C[N] = []), C[N].push(u), C;
1830
1831
  },
1831
1832
  {}
1832
1833
  );
1833
- return Object.keys(M).map((V) => ({
1834
- date: V,
1835
- adjustments: M[V]
1834
+ return Object.keys(V).map((C) => ({
1835
+ date: C,
1836
+ adjustments: V[C]
1836
1837
  }));
1837
1838
  }
1838
1839
  async function A() {
1839
1840
  let _ = await s.readStockAdjustment(
1840
- h.sku._id,
1841
- st(new Date(g.value.startDate)).toISOString(),
1842
- at(new Date(g.value.endDate)).toISOString()
1841
+ g.sku._id,
1842
+ st(new Date(k.value.startDate)).toISOString(),
1843
+ at(new Date(k.value.endDate)).toISOString()
1843
1844
  );
1844
1845
  o.value = _;
1845
- const r = _.filter(({ ref: M }) => M == null ? void 0 : M.startsWith("bill_")).map(({ ref: M }) => M);
1846
- await I(r), t.value = C(_, "day").map(({ date: M, adjustments: V }) => ({
1847
- date: M,
1848
- adjustments: V,
1849
- adjustmentsByTime: C(V, "minute")
1846
+ const i = _.filter(({ ref: V }) => V == null ? void 0 : V.startsWith("bill_")).map(({ ref: V }) => V);
1847
+ await I(i), t.value = D(_, "day").map(({ date: V, adjustments: C }) => ({
1848
+ date: V,
1849
+ adjustments: C,
1850
+ adjustmentsByTime: D(C, "minute")
1850
1851
  }));
1851
1852
  try {
1852
- const M = await s.readUnitCostHistory(
1853
- h.sku._id,
1854
- st(new Date(g.value.startDate)).toISOString(),
1855
- at(new Date(g.value.endDate)).toISOString()
1853
+ const V = await s.readUnitCostHistory(
1854
+ g.sku._id,
1855
+ st(new Date(k.value.startDate)).toISOString(),
1856
+ at(new Date(k.value.endDate)).toISOString()
1856
1857
  );
1857
- T.value = M;
1858
- const V = /* @__PURE__ */ new Set();
1859
- M.forEach((F) => {
1860
- V.add(F.mechanism);
1858
+ T.value = V;
1859
+ const C = /* @__PURE__ */ new Set();
1860
+ V.forEach((F) => {
1861
+ C.add(F.mechanism);
1861
1862
  });
1862
1863
  const u = [{ label: "Default", value: "adjustment" }];
1863
- V.has(he.Enum.weightedAverage) && u.push({
1864
+ C.has(he.Enum.weightedAverage) && u.push({
1864
1865
  label: "Weighted Average (Beta)",
1865
1866
  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({
1867
+ }), C.has(he.Enum.netsuite) && u.push({ label: "NetSuite (Beta)", value: he.Enum.netsuite }), C.has(he.Enum["netsuite-average"]) && u.push({
1867
1868
  label: "NetSuite Average (Beta)",
1868
1869
  value: he.Enum["netsuite-average"]
1869
- }), f.value = u, !V.has(i.value) && i.value !== "adjustment" && (i.value = "adjustment");
1870
- } catch (M) {
1871
- console.error("Failed to fetch unit cost history:", M);
1870
+ }), v.value = u, !C.has(r.value) && r.value !== "adjustment" && (r.value = "adjustment");
1871
+ } catch (V) {
1872
+ console.error("Failed to fetch unit cost history:", V);
1872
1873
  }
1873
1874
  }
1874
1875
  async function I(_) {
1875
- _.length && (n.value = await j.findBillsById(_).catch((r) => {
1876
+ _.length && (n.value = await M.findBillsById(_).catch((i) => {
1876
1877
  var u;
1877
- console.error("Error on using latest bill API, retrying using legacy api", r);
1878
- const M = ((u = m.currentBusiness.value) == null ? void 0 : u._id) ?? "", V = w.currentLocation.doc._id;
1879
- return j.findBillsByBusinessId(M, [V], _);
1878
+ console.error("Error on using latest bill API, retrying using legacy api", i);
1879
+ const V = ((u = m.currentBusiness.value) == null ? void 0 : u._id) ?? "", C = w.currentLocation.doc._id;
1880
+ return M.findBillsByBusinessId(V, [C], _);
1880
1881
  }));
1881
1882
  }
1882
1883
  const R = Y(() => {
1883
- const _ = o.value, r = h.sku;
1884
- return bo(_, r);
1884
+ const _ = o.value, i = g.sku;
1885
+ return bo(_, i);
1885
1886
  }), K = Y(() => {
1886
- const _ = o.value, r = h.sku;
1887
- return xo(_, r);
1887
+ const _ = o.value, i = g.sku;
1888
+ return xo(_, i);
1888
1889
  }), O = Y(() => {
1889
- const _ = [...o.value].computeFirst((M) => {
1890
+ const _ = [...o.value].computeFirst((V) => {
1890
1891
  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);
1892
- return V == null ? void 0 : V.fromBalance;
1892
+ const C = (F = (u = V.skus) == null ? void 0 : u.find) == null ? void 0 : F.call(u, (N) => N.sku._id === g.sku._id);
1893
+ return C == null ? void 0 : C.fromBalance;
1893
1894
  }) ?? {
1894
1895
  amount: 0,
1895
1896
  precision: 0
1896
- }, r = h.sku;
1897
- return r ? `${Q.toFormatString({
1897
+ }, i = g.sku;
1898
+ return i ? `${Q.toFormatString({
1898
1899
  value: _,
1899
1900
  precision: 4
1900
- })} ${r.unit.abbrev}` : "";
1901
+ })} ${i.unit.abbrev}` : "";
1901
1902
  }), Z = Y(() => {
1902
- const _ = [...o.value].reverse().computeFirst((M) => {
1903
+ const _ = [...o.value].reverse().computeFirst((V) => {
1903
1904
  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);
1905
- return V == null ? void 0 : V.toBalance;
1905
+ const C = (F = (u = V.skus) == null ? void 0 : u.find) == null ? void 0 : F.call(u, (N) => N.sku._id === g.sku._id);
1906
+ return C == null ? void 0 : C.toBalance;
1906
1907
  }) ?? {
1907
1908
  amount: 0,
1908
1909
  precision: 0
1909
- }, r = h.sku;
1910
- return r ? `${Q.toFormatString({ value: _, precision: 4 })} ${r.unit.abbrev}` : "";
1910
+ }, i = g.sku;
1911
+ return i ? `${Q.toFormatString({ value: _, precision: 4 })} ${i.unit.abbrev}` : "";
1911
1912
  }), q = Y(() => {
1912
- var M;
1913
- const r = o.value.flatMap((V) => {
1913
+ var V;
1914
+ const i = o.value.flatMap((C) => {
1914
1915
  var u;
1915
- return ((u = V.skus) == null ? void 0 : u.flatMap((F) => F.amounts)) ?? [];
1916
- }).filter((V) => V.amount.amount < 0).reduce(
1917
- (V, u) => {
1916
+ return ((u = C.skus) == null ? void 0 : u.flatMap((F) => F.amounts)) ?? [];
1917
+ }).filter((C) => C.amount.amount < 0).reduce(
1918
+ (C, u) => {
1918
1919
  const F = u.cost;
1919
- if (!F) return V;
1920
+ if (!F) return C;
1920
1921
  const N = {
1921
- ...Rt(V, Math.max(V.precision, F.precision)),
1922
+ ...Mt(C, Math.max(C.precision, F.precision)),
1922
1923
  currency: F.currency
1923
1924
  };
1924
1925
  return {
1925
1926
  ...Je(N, F),
1926
- currency: V.currency
1927
+ currency: C.currency
1927
1928
  };
1928
1929
  },
1929
1930
  {
1930
1931
  amount: 0,
1931
1932
  precision: 0,
1932
- currency: De((M = m.currentCountry) == null ? void 0 : M.value)
1933
+ currency: De((V = m.currentCountry) == null ? void 0 : V.value)
1933
1934
  }
1934
1935
  );
1935
- return Me(r, !1, r.precision);
1936
+ return Me(i, !1, i.precision);
1936
1937
  });
1937
1938
  function ue() {
1938
- const { startDate: _, endDate: r } = zt(g.value);
1939
- _ !== null && r !== null && (g.value = {
1939
+ const { startDate: _, endDate: i } = zt(k.value);
1940
+ _ !== null && i !== null && (k.value = {
1940
1941
  startDate: _,
1941
- endDate: r
1942
+ endDate: i
1942
1943
  });
1943
1944
  }
1944
1945
  const ee = Y(() => l("inventory.ingredient.valuationMethod.WAVG"));
1945
- function v(_, r) {
1946
- if (i.value === "adjustment")
1946
+ function f(_, i) {
1947
+ if (r.value === "adjustment")
1947
1948
  return null;
1948
- const M = T.value.filter(
1949
- (F) => F.mechanism === i.value && F.skuId === h.sku._id
1949
+ const V = T.value.filter(
1950
+ (F) => F.mechanism === r.value && F.skuId === g.sku._id
1950
1951
  );
1951
- if (M.length === 0) return null;
1952
- const V = M.find((F) => {
1952
+ if (V.length === 0) return null;
1953
+ const C = V.find((F) => {
1953
1954
  const N = F.meta;
1954
1955
  return (N == null ? void 0 : N.adjustmentId) === _;
1955
1956
  });
1956
- if (V) return V.cost;
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());
1957
+ if (C) return C.cost;
1958
+ const u = [...V].filter((F) => new Date(F.snapshotAt) <= new Date(i)).sort((F, N) => new Date(N.snapshotAt).getTime() - new Date(F.snapshotAt).getTime());
1958
1959
  return u.length > 0 ? u[0].cost : null;
1959
1960
  }
1960
1961
  const $ = Y(() => {
1961
- var V, u, F, N, ne, re;
1962
+ var C, u, F, N, ne, re;
1962
1963
  const _ = [...o.value].reverse().find((J) => {
1963
1964
  var te, oe;
1964
- return (oe = (te = J.skus) == null ? void 0 : te.find) == null ? void 0 : oe.call(te, (ie) => ie.sku._id === h.sku._id);
1965
+ return (oe = (te = J.skus) == null ? void 0 : te.find) == null ? void 0 : oe.call(te, (ie) => ie.sku._id === g.sku._id);
1965
1966
  });
1966
1967
  if (!_) return "No data";
1967
- const r = (V = _.skus) == null ? void 0 : V.find((J) => J.sku._id === h.sku._id);
1968
- if (!r) return "No data";
1969
- const M = r.toBalance;
1970
- if (i.value === "adjustment") {
1971
- const J = [...r.amounts].reverse()[0], te = {
1968
+ const i = (C = _.skus) == null ? void 0 : C.find((J) => J.sku._id === g.sku._id);
1969
+ if (!i) return "No data";
1970
+ const V = i.toBalance;
1971
+ if (r.value === "adjustment") {
1972
+ const J = [...i.amounts].reverse()[0], te = {
1972
1973
  amount: ((u = J.cost) == null ? void 0 : u.amount) ?? 0,
1973
1974
  precision: ((F = J.cost) == null ? void 0 : F.precision) ?? 0
1974
1975
  }, oe = J.amount, ie = oe.amount == 0 ? Q.fromNumber(0) : Q.divide([te, oe]);
1975
1976
  return {
1976
- ...Q.multiply([ie, M]),
1977
+ ...Q.multiply([ie, V]),
1977
1978
  currency: ((N = J.cost) == null ? void 0 : N.currency) || De(((ne = m.currentCountry) == null ? void 0 : ne.value) ?? et)
1978
1979
  };
1979
1980
  } else {
1980
- const J = _.effectiveAt ?? Ie(_._id), te = v(
1981
+ const J = _.effectiveAt ?? Te(_._id), te = f(
1981
1982
  _._id,
1982
1983
  J ?? (/* @__PURE__ */ new Date()).toISOString()
1983
1984
  );
1984
1985
  if (!te) return "No data";
1985
1986
  const oe = Q.fromDinero(te);
1986
1987
  return {
1987
- ...Q.multiply([oe, M]),
1988
+ ...Q.multiply([oe, V]),
1988
1989
  currency: te.currency || De(((re = m.currentCountry) == null ? void 0 : re.value) ?? et)
1989
1990
  };
1990
1991
  }
1991
1992
  }), G = Y(() => {
1992
- var M;
1993
- const _ = [...o.value].reverse().computeFirst((V) => {
1993
+ var V;
1994
+ const _ = [...o.value].reverse().computeFirst((C) => {
1994
1995
  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);
1996
+ const u = (N = (F = C.skus) == null ? void 0 : F.find) == null ? void 0 : N.call(F, (ne) => ne.sku._id === g.sku._id);
1996
1997
  return u == null ? void 0 : u.toCostBalances;
1997
1998
  });
1998
1999
  return _ ? {
1999
- ..._.reduce((V, u) => Q.add([V, Q.fromDinero(u.cost)]), {
2000
+ ..._.reduce((C, u) => Q.add([C, Q.fromDinero(u.cost)]), {
2000
2001
  amount: 0,
2001
2002
  precision: 0
2002
2003
  }),
2003
- currency: De((M = m.currentCountry) == null ? void 0 : M.value)
2004
+ currency: De((V = m.currentCountry) == null ? void 0 : V.value)
2004
2005
  } : "No data";
2005
- }), P = Y(() => h.sku.valuation === tt.Enum.FIFO ? G.value : $.value);
2006
+ }), P = Y(() => g.sku.valuation === tt.Enum.FIFO ? G.value : $.value);
2006
2007
  function L() {
2007
- const { startDate: _, endDate: r } = Gt(g.value);
2008
- _ !== null && r !== null && (g.value = {
2008
+ const { startDate: _, endDate: i } = Gt(k.value);
2009
+ _ !== null && i !== null && (k.value = {
2009
2010
  startDate: _,
2010
- endDate: r
2011
+ endDate: i
2011
2012
  });
2012
2013
  }
2013
- const E = Ye(h, "show");
2014
- return (_, r) => {
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, {
2014
+ const E = Ye(g, "show");
2015
+ return (_, i) => {
2016
+ const V = U("FmButton"), C = U("FmField"), u = U("FmDateRangePicker"), F = U("FmSpacer"), N = U("FmCircularProgress"), ne = U("FmIcon"), re = U("FmTooltip"), J = U("FmMenuDivider"), te = U("FmChip"), oe = U("FmSelect"), ie = U("FmCardSection"), Fe = U("FmCard"), gt = U("FmSideSheet");
2017
+ return j(), X(gt, {
2017
2018
  "dismiss-away": "",
2018
2019
  modelValue: a(E),
2019
- "onUpdate:modelValue": r[5] || (r[5] = (Ae) => Ee(E) ? E.value = Ae : null),
2020
+ "onUpdate:modelValue": i[5] || (i[5] = (Ae) => Ee(E) ? E.value = Ae : null),
2020
2021
  "close-button": !1,
2021
2022
  "max-width": 560
2022
2023
  }, {
2023
- "side-sheet-header": U(() => [
2024
+ "side-sheet-header": H(() => [
2024
2025
  e("div", So, [
2025
2026
  e("div", wo, p(a(l)("inventory.stock.history.title", [_.sku.name])), 1),
2026
- y(M, {
2027
+ y(V, {
2027
2028
  variant: "tertiary",
2028
2029
  "prepend-icon": "close",
2029
- onClick: r[0] || (r[0] = (Ae) => E.value = !1)
2030
+ onClick: i[0] || (i[0] = (Ae) => E.value = !1)
2030
2031
  })
2031
2032
  ])
2032
2033
  ]),
2033
- default: U(() => {
2034
+ default: H(() => {
2034
2035
  var Ae;
2035
2036
  return [
2036
2037
  e("div", Fo, [
2037
2038
  e("div", Ao, [
2038
2039
  e("div", $o, [
2039
2040
  y(u, {
2040
- modelValue: g.value,
2041
- "onUpdate:modelValue": r[1] || (r[1] = (de) => g.value = de),
2041
+ modelValue: k.value,
2042
+ "onUpdate:modelValue": i[1] || (i[1] = (de) => k.value = de),
2042
2043
  "show-predefined-range": "",
2043
2044
  "start-label": "",
2044
2045
  "end-label": "",
2045
2046
  "z-index": 50
2046
2047
  }, {
2047
- "trigger-button": U(({ opened: de }) => [
2048
- y(V, {
2048
+ "trigger-button": H(({ opened: de }) => [
2049
+ y(C, {
2049
2050
  "prepend-icon": "calendar_month",
2050
2051
  focused: de
2051
2052
  }, {
2052
- default: U(() => [
2053
- ve(p(g.value.startDate) + " - " + p(g.value.endDate), 1)
2053
+ default: H(() => [
2054
+ pe(p(k.value.startDate) + " - " + p(k.value.endDate), 1)
2054
2055
  ]),
2055
2056
  _: 2
2056
2057
  }, 1032, ["focused"])
@@ -2058,47 +2059,47 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
2058
2059
  _: 1
2059
2060
  }, 8, ["modelValue"])
2060
2061
  ]),
2061
- y(M, {
2062
+ y(V, {
2062
2063
  variant: "tertiary",
2063
- onClick: r[2] || (r[2] = (de) => ue()),
2064
+ onClick: i[2] || (i[2] = (de) => ue()),
2064
2065
  "prepend-icon": "navigate_before"
2065
2066
  }),
2066
- y(M, {
2067
+ y(V, {
2067
2068
  variant: "tertiary",
2068
- onClick: r[3] || (r[3] = (de) => L()),
2069
+ onClick: i[3] || (i[3] = (de) => L()),
2069
2070
  "prepend-icon": "navigate_next"
2070
2071
  })
2071
2072
  ]),
2072
- B.value ? (D(), W("div", Vo, [
2073
+ B.value ? (j(), W("div", Vo, [
2073
2074
  y(F),
2074
2075
  y(N, { size: "xl" }),
2075
2076
  e("div", Co, p(a(l)("inventory.stock.history.loading")), 1),
2076
2077
  y(F),
2077
2078
  y(F)
2078
- ])) : t.value && ((Ae = t.value) == null ? void 0 : Ae.length) > 0 ? (D(), W("div", Do, [
2079
+ ])) : t.value && ((Ae = t.value) == null ? void 0 : Ae.length) > 0 ? (j(), W("div", Do, [
2079
2080
  y(Fe, { variant: "outlined" }, {
2080
- default: U(() => [
2081
+ default: H(() => [
2081
2082
  y(ie, { class: "flex flex-col gap-4" }, {
2082
- default: U(() => [
2083
+ default: H(() => [
2083
2084
  e("div", jo, [
2084
2085
  e("div", Mo, p(a(l)("inventory.stock.history.summary.title")), 1)
2085
2086
  ]),
2086
2087
  e("div", Bo, [
2087
2088
  e("div", Io, [
2088
2089
  e("div", To, p(a(l)("inventory.stock.history.summary.totalPurchase")), 1),
2089
- e("div", Ho, p(R.value.PURCHASE), 1)
2090
+ e("div", Uo, p(R.value.PURCHASE), 1)
2090
2091
  ]),
2091
- e("div", Uo, [
2092
+ e("div", Ho, [
2092
2093
  e("div", Eo, [
2093
- ve(p(a(l)("inventory.stock.history.summary.totalSales")) + "  ", 1),
2094
- K.value != null ? (D(), X(re, {
2094
+ pe(p(a(l)("inventory.stock.history.summary.totalSales")) + "  ", 1),
2095
+ K.value != null ? (j(), X(re, {
2095
2096
  key: 0,
2096
2097
  variant: "plain",
2097
2098
  placement: "top",
2098
2099
  content: `Before: ${K.value}`,
2099
2100
  "z-index": 50
2100
2101
  }, {
2101
- default: U(() => [
2102
+ default: H(() => [
2102
2103
  y(ne, {
2103
2104
  name: "warning",
2104
2105
  size: "sm"
@@ -2138,21 +2139,21 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
2138
2139
  e("div", ls, p(Z.value), 1)
2139
2140
  ])
2140
2141
  ]),
2141
- a(c).enableTotalCost ? (D(), W("div", rs, [
2142
+ a(c).enableTotalCost ? (j(), W("div", rs, [
2142
2143
  y(J, { class: "w-full" }),
2143
2144
  e("div", is, [
2144
2145
  e("div", us, [
2145
- y(nt, { "z-index": 50 }, {
2146
- default: U(() => [
2146
+ y(ot, { "z-index": 50 }, {
2147
+ default: H(() => [
2147
2148
  e("div", cs, [
2148
- ve(p(a(l)("inventory.stock.history.estimatedValue")) + " ", 1),
2149
+ pe(p(a(l)("inventory.stock.history.estimatedValue")) + " ", 1),
2149
2150
  y(re, {
2150
2151
  variant: "plain",
2151
2152
  placement: "top",
2152
2153
  content: `[${ee.value}] ${a(l)("inventory.stock.history.estimatedValueTooltip")}`,
2153
2154
  "z-index": 50
2154
2155
  }, {
2155
- default: U(() => [
2156
+ default: H(() => [
2156
2157
  y(ne, {
2157
2158
  name: "help",
2158
2159
  size: "sm"
@@ -2165,18 +2166,18 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
2165
2166
  _: 1
2166
2167
  }),
2167
2168
  e("div", ds, [
2168
- _.sku.valuation === a(tt).Enum.FIFO ? (D(), W(le, { key: 0 }, [
2169
+ _.sku.valuation === a(tt).Enum.FIFO ? (j(), W(le, { key: 0 }, [
2169
2170
  y(te, {
2170
2171
  label: "FIFO",
2171
2172
  compact: ""
2172
2173
  }),
2173
- ve(" " + p(typeof P.value != "string" ? a(Me)(
2174
+ pe(" " + p(typeof P.value != "string" ? a(Me)(
2174
2175
  P.value,
2175
2176
  !1,
2176
2177
  P.value.precision
2177
2178
  ) : P.value), 1)
2178
- ], 64)) : (D(), W(le, { key: 1 }, [
2179
- ve(p(typeof P.value != "string" ? a(Me)(
2179
+ ], 64)) : (j(), W(le, { key: 1 }, [
2180
+ pe(p(typeof P.value != "string" ? a(Me)(
2180
2181
  P.value,
2181
2182
  !1,
2182
2183
  P.value.precision
@@ -2184,28 +2185,28 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
2184
2185
  ], 64))
2185
2186
  ]),
2186
2187
  y(oe, {
2187
- modelValue: i.value,
2188
- "onUpdate:modelValue": r[4] || (r[4] = (de) => i.value = de),
2189
- items: f.value,
2188
+ modelValue: r.value,
2189
+ "onUpdate:modelValue": i[4] || (i[4] = (de) => r.value = de),
2190
+ items: v.value,
2190
2191
  compact: "",
2191
2192
  size: "sm",
2192
2193
  style: { width: "200px" }
2193
2194
  }, null, 8, ["modelValue", "items"])
2194
2195
  ]),
2195
2196
  e("div", ms, [
2196
- y(nt, { "z-index": 50 }, {
2197
- default: U(() => [
2197
+ y(ot, { "z-index": 50 }, {
2198
+ default: H(() => [
2198
2199
  e("div", fs, [
2199
- ve(p(a(l)("inventory.stock.history.costSold")) + " ", 1),
2200
+ pe(p(a(l)("inventory.stock.history.costSold")) + " ", 1),
2200
2201
  y(re, {
2201
2202
  variant: "plain",
2202
2203
  placement: "top",
2203
2204
  "z-index": 50
2204
2205
  }, {
2205
- content: U(() => [
2206
- e("div", vs, p(a(l)("inventory.stock.history.costSoldTooltip")), 1)
2206
+ content: H(() => [
2207
+ e("div", ps, p(a(l)("inventory.stock.history.costSoldTooltip")), 1)
2207
2208
  ]),
2208
- default: U(() => [
2209
+ default: H(() => [
2209
2210
  y(ne, {
2210
2211
  name: "help",
2211
2212
  size: "sm"
@@ -2217,7 +2218,7 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
2217
2218
  ]),
2218
2219
  _: 1
2219
2220
  }),
2220
- e("div", ps, p(q.value), 1)
2221
+ e("div", vs, p(q.value), 1)
2221
2222
  ])
2222
2223
  ])
2223
2224
  ])) : se("", !0)
@@ -2227,21 +2228,21 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
2227
2228
  ]),
2228
2229
  _: 1
2229
2230
  }),
2230
- r[6] || (r[6] = e("div", null, null, -1)),
2231
- (D(!0), W(le, null, ce(t.value, (de) => (D(), W(le, {
2231
+ i[6] || (i[6] = e("div", null, null, -1)),
2232
+ (j(!0), W(le, null, ce(t.value, (de) => (j(), W(le, {
2232
2233
  key: de.date
2233
2234
  }, [
2234
- _.sku ? (D(), X(go, {
2235
+ _.sku ? (j(), X(go, {
2235
2236
  key: 0,
2236
2237
  record: de,
2237
2238
  sku: _.sku,
2238
2239
  bills: n.value,
2239
2240
  "unit-cost-history": T.value,
2240
- "cost-mechanism": i.value,
2241
+ "cost-mechanism": r.value,
2241
2242
  onRefreshHistory: x
2242
2243
  }, null, 8, ["record", "sku", "bills", "unit-cost-history", "cost-mechanism"])) : se("", !0)
2243
2244
  ], 64))), 128))
2244
- ])) : (D(), W("div", ys, [
2245
+ ])) : (j(), W("div", ys, [
2245
2246
  y(F),
2246
2247
  e("div", null, [
2247
2248
  e("img", {
@@ -2266,13 +2267,13 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
2266
2267
  class: "flex items-center gap-1"
2267
2268
  }, 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({
2268
2269
  __name: "StockView",
2269
- setup(k) {
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();
2270
+ setup(h) {
2271
+ const { t: m } = fe(), d = Re(), s = xe(), M = Oe(), w = kt(), c = we(), l = mt(), g = Zt(), { columnDefs: B } = un(), b = Ne(), r = Se();
2271
2272
  s.watchLocation(x);
2272
- const f = Y(
2273
- () => new Set(h.getAvailableItems(h.businessSubsidiaryId))
2273
+ const v = Y(
2274
+ () => new Set(g.getAvailableItems(g.businessSubsidiaryId))
2274
2275
  ), T = z(!1);
2275
- async function g() {
2276
+ async function k() {
2276
2277
  b.open({
2277
2278
  title: m("inventory.stock.stock_balance.refreshBalance"),
2278
2279
  message: m("inventory.stock.stock_balance.refreshBalanceDescription"),
@@ -2287,7 +2288,7 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
2287
2288
  variant: "tertiary"
2288
2289
  }
2289
2290
  }).onPrimary(async () => {
2290
- await c.recalculation.refreshCurrentBalances(), i.open({
2291
+ await c.recalculation.refreshCurrentBalances(), r.open({
2291
2292
  title: "Refresh Stock Balance",
2292
2293
  message: "Stock balance refresh has been queued. This may take a moment to complete.",
2293
2294
  type: "success"
@@ -2298,9 +2299,9 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
2298
2299
  if (s._currentLocation) {
2299
2300
  T.value = !0;
2300
2301
  try {
2301
- await j.readStockBalance(), await j.readProductBalance(), await l.readStockEstimateBalance();
2302
+ await M.readStockBalance(), await M.readProductBalance(), await l.readStockEstimateBalance();
2302
2303
  } catch (ee) {
2303
- i.open({
2304
+ r.open({
2304
2305
  title: m("inventory.stock.error.title"),
2305
2306
  message: m("inventory.stock.error.message"),
2306
2307
  type: "error"
@@ -2329,35 +2330,36 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
2329
2330
  ]
2330
2331
  }), n = Y(() => {
2331
2332
  var $, G, P;
2332
- const ee = t.value ? en.build(t.value) : null, v = [];
2333
+ const ee = t.value ? en.build(t.value) : null, f = [];
2333
2334
  for (const L of d.skus) {
2334
2335
  let E = !0;
2335
- if (h.isEnabled && C.value && f.value && E && (E = f.value.has(L._id)), ee && E && (E = tn(
2336
+ if (g.isEnabled && D.value && v.value && E && (E = v.value.has(L._id)), ee && E && (E = tn(
2336
2337
  {
2337
2338
  status: L.isInactive ? "Inactive" : "Active"
2338
2339
  },
2339
2340
  ee
2340
2341
  )), E) {
2341
2342
  const _ = L.trackingMeasurement;
2342
- let r = (G = ($ = j.stockBalance.skus) == null ? void 0 : $.find(
2343
+ let i = (G = ($ = M.stockBalance.skus) == null ? void 0 : $.find(
2343
2344
  (u) => u.id === L._id
2344
- )) == null ? void 0 : G.balance, M = l.inventoryForecast.skus.find(
2345
+ )) == null ? void 0 : G.balance, V = l.inventoryForecast.skus.find(
2345
2346
  (u) => u.id === L._id
2346
2347
  );
2347
- const V = {
2348
+ const C = {
2348
2349
  ...L,
2349
- balance: r ?? {
2350
+ balance: i ?? {
2350
2351
  amount: 0,
2351
2352
  precision: 0
2352
2353
  },
2353
- day: (M == null ? void 0 : M.depletionDays) ?? void 0,
2354
+ operator: V == null ? void 0 : V.operator,
2355
+ day: (V == null ? void 0 : V.depletionDays) ?? void 0,
2354
2356
  trackingUnitAbbrev: _ ? ((P = L.unit.measurements.find((u) => u.id === _)) == null ? void 0 : P.abbrev) ?? "" : L.unit.abbrev
2355
2357
  };
2356
- v.push(V);
2358
+ f.push(C);
2357
2359
  }
2358
2360
  }
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(() => [
2361
+ return f;
2362
+ }), S = z(""), D = z(!0), { breakpoints: A } = Ut(), I = Y(() => A.value.xs || A.value.sm), R = Y(() => I.value ? 10 : 20), K = St(), O = Y(() => [
2361
2363
  {
2362
2364
  label: m("inventory.stock.stock_balance.refreshBalance"),
2363
2365
  value: "refresh-balance",
@@ -2384,7 +2386,7 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
2384
2386
  function ue(ee) {
2385
2387
  switch (ee) {
2386
2388
  case "refresh-balance":
2387
- return g();
2389
+ return k();
2388
2390
  case "refresh":
2389
2391
  return x();
2390
2392
  case "export":
@@ -2393,14 +2395,14 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
2393
2395
  return q();
2394
2396
  }
2395
2397
  }
2396
- return (ee, v) => {
2397
- const $ = H("FmSwitch"), G = H("FmTable");
2398
- return D(), X(wt, {
2398
+ return (ee, f) => {
2399
+ const $ = U("FmSwitch"), G = U("FmTable");
2400
+ return j(), X(wt, {
2399
2401
  title: a(m)("inventory.stock.title"),
2400
2402
  actions: O.value,
2401
2403
  "onClick:action": ue
2402
2404
  }, {
2403
- default: U(() => {
2405
+ default: H(() => {
2404
2406
  var P, L, E, _;
2405
2407
  return [
2406
2408
  e("div", {
@@ -2416,22 +2418,22 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
2416
2418
  searchable: "",
2417
2419
  "change-location": "",
2418
2420
  search: S.value,
2419
- "onUpdate:search": v[1] || (v[1] = (r) => S.value = r),
2421
+ "onUpdate:search": f[1] || (f[1] = (i) => S.value = i),
2420
2422
  "hide-filter-options": !0,
2421
2423
  filterable: "",
2422
2424
  "filter-attributes": o.value,
2423
2425
  filter: t.value,
2424
- "onUpdate:filter": v[2] || (v[2] = (r) => t.value = r)
2426
+ "onUpdate:filter": f[2] || (f[2] = (i) => t.value = i)
2425
2427
  }, {
2426
- default: U(() => [
2427
- a(h).isEnabled ? (D(), W("div", bs, [
2428
+ default: H(() => [
2429
+ a(g).isEnabled ? (j(), W("div", bs, [
2428
2430
  e("span", xs, p(a(m)("inventory.integration.netsuite.subsidiaryHierarchy.filtering")), 1),
2429
- y(jt),
2431
+ y(It),
2430
2432
  y(Xe, null, {
2431
- default: U(() => [
2433
+ default: H(() => [
2432
2434
  y($, {
2433
- modelValue: C.value,
2434
- "onUpdate:modelValue": v[0] || (v[0] = (r) => C.value = r)
2435
+ modelValue: D.value,
2436
+ "onUpdate:modelValue": f[0] || (f[0] = (i) => D.value = i)
2435
2437
  }, null, 8, ["modelValue"])
2436
2438
  ]),
2437
2439
  _: 1
@@ -2440,51 +2442,51 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
2440
2442
  ]),
2441
2443
  _: 1
2442
2444
  }, 8, ["search", "filter-attributes", "filter"]),
2443
- (D(), X(G, {
2445
+ (j(), X(G, {
2444
2446
  style: ct(a(K).tableHeight),
2445
2447
  "column-defs": a(B),
2446
2448
  "row-data": n.value,
2447
2449
  "search-value": S.value,
2448
2450
  loading: T.value || !a(s)._currentLocation,
2449
2451
  key: (P = a(s)._currentLocation) == null ? void 0 : P.dbName,
2450
- onRowClick: v[3] || (v[3] = (r) => a(w).showSkuHistory(r.original)),
2452
+ onRowClick: f[3] || (f[3] = (i) => a(w).showSkuHistory(i.original)),
2451
2453
  "page-size": R.value
2452
2454
  }, {
2453
- "list-row": U((r) => [
2455
+ "list-row": H((i) => [
2454
2456
  y(Qt, {
2455
- row: r,
2457
+ row: i,
2456
2458
  onRowClick: a(w).showSkuHistory
2457
2459
  }, {
2458
- default: U((M) => {
2459
- var V, u, F, N, ne, re, J, te, oe, ie;
2460
+ default: H((V) => {
2461
+ var C, u, F, N, ne, re, J, te, oe, ie;
2460
2462
  return [
2461
2463
  e("div", Ss, [
2462
2464
  e("div", ws, [
2463
2465
  e("div", Fs, [
2464
2466
  y(a(lt), {
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)
2467
+ render: (F = (u = (C = V.code) == null ? void 0 : C.column) == null ? void 0 : u.columnDef) == null ? void 0 : F.cell,
2468
+ props: (ne = (N = V.code) == null ? void 0 : N.getContext) == null ? void 0 : ne.call(N)
2467
2469
  }, null, 8, ["render", "props"])
2468
2470
  ]),
2469
2471
  e("div", As, [
2470
2472
  y(a(lt), {
2471
- render: (te = (J = (re = M.name) == null ? void 0 : re.column) == null ? void 0 : J.columnDef) == null ? void 0 : te.cell,
2472
- props: (ie = (oe = M.name) == null ? void 0 : oe.getContext) == null ? void 0 : ie.call(oe)
2473
+ render: (te = (J = (re = V.name) == null ? void 0 : re.column) == null ? void 0 : J.columnDef) == null ? void 0 : te.cell,
2474
+ props: (ie = (oe = V.name) == null ? void 0 : oe.getContext) == null ? void 0 : ie.call(oe)
2473
2475
  }, null, 8, ["render", "props"])
2474
2476
  ])
2475
2477
  ]),
2476
2478
  e("div", null, [
2477
2479
  y(Ke, {
2478
- days: r.original.day
2480
+ days: i.original.day
2479
2481
  }, null, 8, ["days"])
2480
2482
  ]),
2481
2483
  e("div", null, [
2482
2484
  y(_t, {
2483
2485
  class: "xs:w-[160px]",
2484
- unit: r.original.unit,
2485
- sku: r.original,
2486
- amount: r.original.balance,
2487
- "default-tracking-measurement": r.original.trackingMeasurement ?? void 0
2486
+ unit: i.original.unit,
2487
+ sku: i.original,
2488
+ amount: i.original.balance,
2489
+ "default-tracking-measurement": i.original.trackingMeasurement ?? void 0
2488
2490
  }, null, 8, ["unit", "sku", "amount", "default-tracking-measurement"])
2489
2491
  ])
2490
2492
  ])
@@ -2496,15 +2498,15 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
2496
2498
  _: 1
2497
2499
  }, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"]))
2498
2500
  ], 2),
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, {
2501
+ (j(), X(xt, { to: "body" }, [
2502
+ (L = a(w).stockHistoryProps) != null && L.sku ? (j(), X(gs, Le(ze({ key: 0 }, a(w).stockHistoryProps)), null, 16)) : se("", !0),
2503
+ (E = a(w).convertSkuDialogProps) != null && E.sku ? (j(), X(wn, Le(ze({ key: 1 }, a(w).convertSkuDialogProps)), null, 16)) : se("", !0),
2504
+ (_ = a(w).adjustSkuDialogProps) != null && _.stock ? (j(), X(Un, Le(ze({ key: 2 }, a(w).adjustSkuDialogProps)), null, 16)) : se("", !0),
2505
+ Z.value ? (j(), X(qn, {
2504
2506
  key: 3,
2505
2507
  show: Z.value,
2506
- "onUpdate:show": v[4] || (v[4] = (r) => Z.value = r),
2507
- onSubmitted: v[5] || (v[5] = (r) => x())
2508
+ "onUpdate:show": f[4] || (f[4] = (i) => Z.value = i),
2509
+ onSubmitted: f[5] || (f[5] = (i) => x())
2508
2510
  }, null, 8, ["show"])) : se("", !0)
2509
2511
  ]))
2510
2512
  ];