@feedmepos/mf-inventory-portal 1.6.0-dev.4 → 1.6.0-dev.6

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 (85) hide show
  1. package/dist/{App-xiS9XCUg.js → App-Di8cQoKT.js} +4 -4
  2. package/dist/{ApprovalView-Co4xloBe.js → ApprovalView-qM9i8hVq.js} +7 -7
  3. package/dist/{BindingsDialog-Ch1xgZ7D.js → BindingsDialog-BZAGYZXv.js} +2 -2
  4. package/dist/{BindingsPicker-BSNOsgIa.js → BindingsPicker-Dxv8-E41.js} +2 -2
  5. package/dist/{BindingsTable-CvoKDM69.js → BindingsTable-Av0a-FDQ.js} +3 -3
  6. package/dist/{ClosingDraftView-Chy_R-c9.js → ClosingDraftView-BFJ4IBqb.js} +15 -15
  7. package/dist/{ClosingHistoryView-DQUYXIe5.js → ClosingHistoryView-BT-VDKmv.js} +5 -5
  8. package/dist/{ClosingTemplateView-yi3O0zya.js → ClosingTemplateView-DdE94MR4.js} +14 -14
  9. package/dist/{DefaultView-w0Bc0QUo.js → DefaultView-BgoUI3tD.js} +2 -2
  10. package/dist/{DeliveryOrderPrintPreview-BzO9UcbC.js → DeliveryOrderPrintPreview-BdTL2m9C.js} +2 -2
  11. package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-DYzIZpMo.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-DYB-uCRa.js} +2 -2
  12. package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-C1-Z8zpZ.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DcM6xetz.js} +2 -2
  13. package/dist/{FmMultiselectDialog-8k_CySos.js → FmMultiselectDialog-BND4jAye.js} +1 -1
  14. package/dist/{FmMultiselectDialog-C6MHEYsa.js → FmMultiselectDialog-Ejv58jEW.js} +2 -2
  15. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-cf1asT1H.js → FmUnitInput.vue_vue_type_script_setup_true_lang-DHy5OLee.js} +5 -5
  16. package/dist/{ImportView-Z8N8eFi0.js → ImportView-B53g06tS.js} +6 -6
  17. package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-BabrzvVA.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-D1RFIkGm.js} +1 -1
  18. package/dist/{IngredientGroupView-CNl676Lh.js → IngredientGroupView-DlVQL7q9.js} +5 -5
  19. package/dist/{IngredientsView-6zB8OUXt.js → IngredientsView-CnlcPJOS.js} +15 -15
  20. package/dist/{IntegrationExplorerView-C27IyImO.js → IntegrationExplorerView-isFlGe0Z.js} +5 -5
  21. package/dist/{IntegrationView-pDisxkqH.js → IntegrationView-jLnGwPAe.js} +13 -13
  22. package/dist/{InventoryBindingForm-cJUY8472.js → InventoryBindingForm-Bz1iNKVE.js} +1 -1
  23. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-_mIak9Y4.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-usQ8ZPbn.js} +5 -5
  24. package/dist/{InventoryBindingSummary-DiOokH9o.js → InventoryBindingSummary-DZyoeLau.js} +1 -1
  25. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-CXBvvJc9.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-NkzVPQq_.js} +1 -1
  26. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-D1JFU868.js → PremiumBadge.vue_vue_type_script_setup_true_lang-DAXEWYd4.js} +1 -1
  27. package/dist/{PublishView-CthOIZV3.js → PublishView-DDK-PSH_.js} +3 -3
  28. package/dist/{PurchaseOrderPrintPreview-CR8pm2bB.js → PurchaseOrderPrintPreview-CUby20Ms.js} +2 -2
  29. package/dist/{ReceiveRequestView-DgqABsfx.js → ReceiveRequestView-830tKUWt.js} +26 -26
  30. package/dist/{RecipeView-062Vcx0q.js → RecipeView-CMKwkmte.js} +17 -17
  31. package/dist/{SettingsView-B36YQEUM.js → SettingsView-DttG-rgv.js} +4 -4
  32. package/dist/{StockView-8orJpsPH.js → StockView-BSLKtOO-.js} +600 -574
  33. package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-Bw-GxZr8.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-Cn967MK-.js} +1 -1
  34. package/dist/{SupplierView-CQi9bh5A.js → SupplierView-C0ZwULLi.js} +12 -12
  35. package/dist/{SurchargeView-BgxF6xyH.js → SurchargeView-LWasGLSm.js} +6 -6
  36. package/dist/{SystemTrailDialog.vue_vue_type_script_setup_true_lang-BbY1p0bB.js → SystemTrailDialog.vue_vue_type_script_setup_true_lang-BrK8u3nO.js} +2 -2
  37. package/dist/{TemplatePublishDialog.vue_vue_type_script_setup_true_lang-BiMvxm3x.js → TemplatePublishDialog.vue_vue_type_script_setup_true_lang-DvVDeHjR.js} +1 -1
  38. package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-DtCPS8FC.js → TransferDetails.vue_vue_type_script_setup_true_lang-DcllUuxg.js} +20 -20
  39. package/dist/{TransferTemplateView-92Xn4mWr.js → TransferTemplateView-CCVrzVkT.js} +20 -20
  40. package/dist/{UnitCostHistoryView-cTI5jhBt.js → UnitCostHistoryView-DFJJ2u8P.js} +4 -4
  41. package/dist/{UnitDisplayControl.vue_vue_type_script_setup_true_lang-bjr08iok.js → UnitDisplayControl.vue_vue_type_script_setup_true_lang-DdzpfKGK.js} +5 -5
  42. package/dist/{UnitView-BqXvkdiR.js → UnitView-BcYQKL84.js} +7 -7
  43. package/dist/{WarehouseView-_2zJPaTf.js → WarehouseView-kNgPHyAP.js} +5 -5
  44. package/dist/{WastageTemplateView-DYW58rtZ.js → WastageTemplateView-e0F6dinm.js} +14 -14
  45. package/dist/api/netsuite.d.ts +20 -0
  46. package/dist/{app-B790gOK1.js → app-DK2wDdRG.js} +1206 -1179
  47. package/dist/app.d.ts +4 -0
  48. package/dist/app.js +1 -1
  49. package/dist/{closing-template-0jLV_s0d.js → closing-template-C1Ag3g2s.js} +1 -1
  50. package/dist/{date2-BEmmexd8.js → date2-DdWkOefy.js} +1 -1
  51. package/dist/{dayjs.min-e4Xq09pW.js → dayjs.min-DKWqZGj8.js} +1 -1
  52. package/dist/{decimal-Lptt-Wz-.js → decimal-jEQmohI0.js} +2 -2
  53. package/dist/{defineDeepModel-emCSlL_h.js → defineDeepModel-DEeVL0NT.js} +1 -1
  54. package/dist/{duplicate-template-CShJdJ8d.js → duplicate-template-B0a9h4uA.js} +1 -1
  55. package/dist/{feature-BFFJbkBm.js → feature-DujhKQag.js} +2 -2
  56. package/dist/{format-time-from-id-Dj-j01eE.js → format-time-from-id-BpRp_X3u.js} +1 -1
  57. package/dist/{format-unit-display-CJw32VBR.js → format-unit-display-Da8nKxPz.js} +12 -12
  58. package/dist/{import-export.helper-C07viLOs.js → import-export.helper-CYJq22cJ.js} +6 -6
  59. package/dist/{index-DJZQrFf7.js → index-B31v4NEs.js} +1 -1
  60. package/dist/{index-B0mYVcHF.js → index-Bs2DT0wF.js} +1 -1
  61. package/dist/{index-TBsXDgch.js → index-D15BT7xz.js} +3 -3
  62. package/dist/{inventory-core-dart.default-BieljiaS.js → inventory-core-dart.default-D4osjzlQ.js} +1 -1
  63. package/dist/{lz-string-Co3f7xQi.js → lz-string-BT82cfCK.js} +1 -1
  64. package/dist/{netsuite-BMQZw2dt.js → netsuite-ZHiikF8a.js} +2 -2
  65. package/dist/{number-Czc4vu4K.js → number-C6NSIT1m.js} +3 -3
  66. package/dist/{predefined-templates-BVHsFJHC.js → predefined-templates-DT6cIOQR.js} +1 -1
  67. package/dist/{purchase-order-template-CMDl8eio.js → purchase-order-template-D50dAJ8R.js} +1 -1
  68. package/dist/{recalculationUtils-BZoPTIoG.js → recalculationUtils-7X6ayoRM.js} +1 -1
  69. package/dist/{rules-DuDYwy_d.js → rules-Z9cYF33Y.js} +2 -2
  70. package/dist/{stock-DkLzKOLk.js → stock-DW2d568F.js} +1 -1
  71. package/dist/stores/integration/netsuite.d.ts +4 -0
  72. package/dist/{supplier-Dk3xHNeA.js → supplier-suSJz_Tj.js} +2 -2
  73. package/dist/{surcharge-CUNMAeS3.js → surcharge-CmFdExzO.js} +1 -1
  74. package/dist/{uom-rules-DtG5eCqQ.js → uom-rules-C_FGDepb.js} +1 -1
  75. package/dist/{use-ingredient-select-dialog-CkNu7fD6.js → use-ingredient-select-dialog-DDPAb2_X.js} +2 -2
  76. package/dist/{use-inventory-binding-dialog-Cnc65VQI.js → use-inventory-binding-dialog-BNwhsOA9.js} +2 -2
  77. package/dist/{use-template-enabled-locations-CRF0AM-M.js → use-template-enabled-locations-Dm14AOSo.js} +2 -2
  78. package/dist/{use-transfer-locations-cX4FfzNZ.js → use-transfer-locations-BzLayMl_.js} +2 -2
  79. package/dist/{useHrmPermission-CmJd4Bup.js → useHrmPermission-DG3KUc2c.js} +1 -1
  80. package/dist/{useNavigationMenu-BQZghwYI.js → useNavigationMenu-Dp-MvtBY.js} +2 -2
  81. package/dist/{useSseClient-C3PTrM-h.js → useSseClient-IEGNBVKr.js} +3 -3
  82. package/dist/{vue-i18n-1noprZJM.js → vue-i18n-DsC8R5FR.js} +120 -120
  83. package/dist/{xlsx-i55Kt0AR.js → xlsx-QxeFuAXt.js} +1 -1
  84. package/dist/{xlsx.util-jC5etKar.js → xlsx.util-CarycIPW.js} +3 -3
  85. package/package.json +3 -3
@@ -1,32 +1,32 @@
1
- import { defineComponent as ve, openBlock as V, createBlock as ne, withCtx as M, createElementVNode as e, toDisplayString as p, unref as s, ref as Y, h as be, computed as T, watch as Fe, resolveComponent as B, isRef as Pe, createVNode as _, createElementBlock as q, Fragment as ue, renderList as fe, createCommentVNode as se, normalizeClass as He, reactive as _t, mergeModels as nt, useModel as jt, onMounted as qe, createTextVNode as ye, normalizeStyle as kt, watchEffect as Vt, renderSlot as st, onUnmounted as Ct, Teleport as Dt, normalizeProps as at, mergeProps as ze } from "vue";
2
- import { u as Bt, _ as Mt } from "./SingleColumnLayout.vue_vue_type_script_setup_true_lang-DGlWE5I8.js";
3
- import { u as Se, c as Re, a as Ne, F as rt, t as It, D as ie, s as Ht, m as Tt, B as Et, w as oe, f as Ce, h as lt, d as it, K as ge, L as De } from "./app-B790gOK1.js";
4
- import { u as Oe, a as Ut } from "./useSseClient-C3PTrM-h.js";
1
+ import { defineComponent as pe, openBlock as j, createBlock as te, withCtx as M, createElementVNode as e, toDisplayString as m, unref as s, ref as Y, h as be, computed as T, watch as Fe, resolveComponent as D, isRef as Pe, createVNode as _, createElementBlock as q, Fragment as ue, renderList as ve, createCommentVNode as se, normalizeClass as He, reactive as _t, mergeModels as nt, useModel as jt, onMounted as qe, createTextVNode as me, normalizeStyle as kt, watchEffect as Vt, renderSlot as st, onUnmounted as Ct, Teleport as Bt, normalizeProps as at, mergeProps as ze } from "vue";
2
+ import { u as Dt, _ as Mt } from "./SingleColumnLayout.vue_vue_type_script_setup_true_lang-DGlWE5I8.js";
3
+ import { u as Se, c as Re, a as Ne, F as rt, t as It, D as ie, s as Ht, m as Tt, B as Et, w as ne, f as Ce, h as lt, d as it, K as ge, L as Be } from "./app-DK2wDdRG.js";
4
+ import { u as Oe, a as Ut } from "./useSseClient-IEGNBVKr.js";
5
5
  import { c as Pt } from "./component-kqxARxvM.js";
6
- import { _ as ht, o as Rt } from "./UnitDisplayControl.vue_vue_type_script_setup_true_lang-bjr08iok.js";
7
- import { _ as Ke, S as Ge, g as bt, a as Nt } from "./SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-Bw-GxZr8.js";
6
+ import { _ as ht, o as Rt } from "./UnitDisplayControl.vue_vue_type_script_setup_true_lang-DdzpfKGK.js";
7
+ import { _ as Ke, S as Ge, g as bt, a as Nt } from "./SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-Cn967MK-.js";
8
8
  import { _ as Ot } from "./PreviewBadge.vue_vue_type_script_setup_true_lang-CRZiQHjx.js";
9
- import { useI18n as pe, useCoreStore as Xe } from "@feedmepos/mf-common";
10
- import { u as gt, i as Te, _ as ut } from "./PremiumBadge.vue_vue_type_script_setup_true_lang-D1JFU868.js";
9
+ import { useI18n as ye, useCoreStore as Xe } from "@feedmepos/mf-common";
10
+ import { u as gt, i as Te, _ as ut } from "./PremiumBadge.vue_vue_type_script_setup_true_lang-DAXEWYd4.js";
11
11
  import { useSnackbar as we, useDialog as Le, useProxiedModel as Ye, useBreakpoints as Lt } from "@feedmepos/ui-library";
12
12
  import { defineStore as Yt } from "pinia";
13
13
  import { F as Je } from "./FmAdminBadge-DjnBAgyv.js";
14
- import { g as $e, a as he, e as zt, t as Ee, c as xe, f as Gt, h as ct, i as xt, j as Qe, d as Me, k as Wt } from "./number-Czc4vu4K.js";
15
- import { u as Ae } from "./stock-DkLzKOLk.js";
16
- import { c as Ue, A as Kt, M as qt, R as Xt } from "./rules-DuDYwy_d.js";
17
- import { u as Jt } from "./use-inventory-binding-dialog-Cnc65VQI.js";
18
- import { a as St } from "./FmMultiselectDialog-C6MHEYsa.js";
19
- import { d as ke } from "./dayjs.min-e4Xq09pW.js";
20
- import { _ as Qt } from "./NumberPrecisionInput.vue_vue_type_script_setup_true_lang-CXBvvJc9.js";
21
- import { g as Zt } from "./decimal-Lptt-Wz-.js";
22
- import { a as eo, c as to, f as wt, t as dt, d as mt, p as oo, n as no, b as so } from "./date2-BEmmexd8.js";
23
- import { i as ao, _ as ro } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-C1-Z8zpZ.js";
14
+ import { g as $e, a as he, e as zt, t as Ee, c as xe, f as Gt, h as ct, i as xt, j as Qe, d as Me, k as Wt } from "./number-C6NSIT1m.js";
15
+ import { u as Ae } from "./stock-DW2d568F.js";
16
+ import { c as Ue, A as Kt, M as qt, R as Xt } from "./rules-Z9cYF33Y.js";
17
+ import { u as Jt } from "./use-inventory-binding-dialog-BNwhsOA9.js";
18
+ import { a as St } from "./FmMultiselectDialog-Ejv58jEW.js";
19
+ import { d as ke } from "./dayjs.min-DKWqZGj8.js";
20
+ import { _ as Qt } from "./NumberPrecisionInput.vue_vue_type_script_setup_true_lang-NkzVPQq_.js";
21
+ import { g as Zt } from "./decimal-jEQmohI0.js";
22
+ import { a as eo, c as to, f as wt, t as dt, d as mt, p as oo, n as no, b as so } from "./date2-DdWkOefy.js";
23
+ import { i as ao, _ as ro } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DcM6xetz.js";
24
24
  import { _ as lo } from "./empty-placeholder-B0QU467o.js";
25
- import { F as _e } from "./inventory-core-dart.default-BieljiaS.js";
26
- import { u as io } from "./feature-BFFJbkBm.js";
27
- import { u as At } from "./useHrmPermission-CmJd4Bup.js";
25
+ import { F as _e } from "./inventory-core-dart.default-D4osjzlQ.js";
26
+ import { u as io } from "./feature-DujhKQag.js";
27
+ import { u as At } from "./useHrmPermission-DG3KUc2c.js";
28
28
  import { _ as uo, F as ft } from "./TableActionableRow.vue_vue_type_script_setup_true_lang-Ca_eYa8-.js";
29
- import { u as co } from "./netsuite-BMQZw2dt.js";
29
+ import { u as co } from "./netsuite-ZHiikF8a.js";
30
30
  import { P as mo, J as fo } from "./app-DiX-EfV6.js";
31
31
  var Ie = /* @__PURE__ */ ((A) => (A.History = "History", A.Convert = "Convert", A.Adjust = "Adjust", A))(Ie || {});
32
32
  const vo = [
@@ -55,19 +55,19 @@ const vo = [
55
55
  value: "Adjust"
56
56
  /* Adjust */
57
57
  }
58
- ], yo = { class: "whitespace-nowrap" }, _o = /* @__PURE__ */ ve({
58
+ ], yo = { class: "whitespace-nowrap" }, _o = /* @__PURE__ */ pe({
59
59
  __name: "StockHeaderPreview",
60
60
  setup(A) {
61
- const { t: u } = pe();
62
- return (k, y) => (V(), ne(Ot, null, {
61
+ const { t: u } = ye();
62
+ return (k, y) => (j(), te(Ot, null, {
63
63
  default: M(() => [
64
- e("div", yo, p(s(u)("inventory.stock.prediction.daysRemaining")), 1)
64
+ e("div", yo, m(s(u)("inventory.stock.prediction.daysRemaining")), 1)
65
65
  ]),
66
66
  _: 1
67
67
  }));
68
68
  }
69
69
  }), Ft = Yt("stockActions", () => {
70
- const A = Y(!1), u = Se(), k = Oe(), y = gt(), w = we(), j = Le(), { t: d } = pe();
70
+ const A = Y(!1), u = Se(), k = Oe(), y = gt(), w = we(), V = Le(), { t: d } = ye();
71
71
  async function r() {
72
72
  if (u._currentLocation) {
73
73
  A.value = !0;
@@ -84,33 +84,33 @@ const vo = [
84
84
  }
85
85
  }
86
86
  }
87
- const g = Y();
88
- async function R(b) {
87
+ const b = Y();
88
+ async function R(g) {
89
89
  var $, E, N;
90
- if (!!!((E = ($ = b.convert) == null ? void 0 : $.inventoryBindings) != null && E.length)) {
91
- j.open({
90
+ if (!!!((E = ($ = g.convert) == null ? void 0 : $.inventoryBindings) != null && E.length)) {
91
+ V.open({
92
92
  title: d("inventory.stock.error.convert.title"),
93
93
  message: d("inventory.stock.error.convert.message")
94
94
  });
95
95
  return;
96
96
  }
97
97
  const n = {
98
- maxCount: ((N = k.productBalance.find(({ id: O }) => O === b._id)) == null ? void 0 : N.count) || 0,
99
- sku: b,
98
+ maxCount: ((N = k.productBalance.find(({ id: O }) => O === g._id)) == null ? void 0 : N.count) || 0,
99
+ sku: g,
100
100
  show: !0,
101
101
  "onUpdate:show"(O) {
102
- g.value.show = O;
102
+ b.value.show = O;
103
103
  },
104
104
  onSubmitted() {
105
105
  r();
106
106
  }
107
107
  };
108
- g.value = n;
108
+ b.value = n;
109
109
  }
110
110
  const C = Y();
111
- async function l(b) {
111
+ async function l(g) {
112
112
  const o = {
113
- stock: b,
113
+ stock: g,
114
114
  show: !0,
115
115
  "onUpdate:show"(t) {
116
116
  C.value.show = t;
@@ -122,9 +122,9 @@ const vo = [
122
122
  C.value = o;
123
123
  }
124
124
  const a = Y();
125
- async function D(b) {
125
+ async function B(g) {
126
126
  const o = {
127
- sku: b,
127
+ sku: g,
128
128
  show: !0,
129
129
  "onUpdate:show"(t) {
130
130
  a.value.show = t;
@@ -132,11 +132,11 @@ const vo = [
132
132
  };
133
133
  a.value = o;
134
134
  }
135
- function m(b, o) {
135
+ function f(g, o) {
136
136
  const t = Re(o);
137
- switch (b) {
137
+ switch (g) {
138
138
  case Ie.History:
139
- D(t);
139
+ B(t);
140
140
  return;
141
141
  case Ie.Convert:
142
142
  R(t);
@@ -148,16 +148,16 @@ const vo = [
148
148
  }
149
149
  return {
150
150
  fetchStockBalance: r,
151
- onActionMenu: m,
151
+ onActionMenu: f,
152
152
  stockHistoryProps: a,
153
- showSkuHistory: D,
154
- convertSkuDialogProps: g,
153
+ showSkuHistory: B,
154
+ convertSkuDialogProps: b,
155
155
  adjustSkuDialogProps: C
156
156
  };
157
157
  });
158
158
  function ko() {
159
- var j;
160
- const A = Se(), u = Ft(), k = Xe(), { t: y } = pe();
159
+ var V;
160
+ const A = Se(), u = Ft(), k = Xe(), { t: y } = ye();
161
161
  return {
162
162
  columnDefs: [
163
163
  {
@@ -176,17 +176,17 @@ function ko() {
176
176
  id: "UOM",
177
177
  header: () => y("inventory.stock.balance"),
178
178
  cell(d) {
179
- const r = d.row.original, g = {
179
+ const r = d.row.original, b = {
180
180
  unit: r.unit,
181
181
  sku: r,
182
182
  amount: r.balance,
183
183
  defaultTrackingMeasurement: r.trackingMeasurement ?? void 0
184
184
  };
185
- return be(ht, g);
185
+ return be(ht, b);
186
186
  },
187
187
  size: 180
188
188
  },
189
- ...(j = k.sessionUser.value) != null && j.role.isAdmin ? [
189
+ ...(V = k.sessionUser.value) != null && V.role.isAdmin ? [
190
190
  {
191
191
  accessorKey: "isInactive",
192
192
  header: () => be(Je, {}, () => `${y("inventory.ingredient.status.title")}`),
@@ -213,12 +213,12 @@ function ko() {
213
213
  enableSorting: !0,
214
214
  sortUndefined: "last",
215
215
  cell(d) {
216
- var D, m;
217
- const r = d.row.original.day, g = d.row.original.operator, R = (D = d.row.original.thresholds) == null ? void 0 : D.low, C = (m = d.row.original.thresholds) == null ? void 0 : m.mid;
216
+ var B, f;
217
+ const r = d.row.original.day, b = d.row.original.operator, R = (B = d.row.original.thresholds) == null ? void 0 : B.low, C = (f = d.row.original.thresholds) == null ? void 0 : f.mid;
218
218
  if (typeof r != "number" || typeof R != "number" || typeof C != "number")
219
219
  return be(Ke, {
220
220
  days: r,
221
- operator: g
221
+ operator: b
222
222
  });
223
223
  const l = r <= R ? Ge.low : r <= C ? Ge.mid : Ge.high;
224
224
  return be(Ke, {
@@ -234,7 +234,7 @@ function ko() {
234
234
  var r;
235
235
  return Pt(
236
236
  ((r = A._currentLocation) == null ? void 0 : r.type) === "restaurant" ? vo : po,
237
- (g) => u.onActionMenu(g, d.row.original)
237
+ (b) => u.onActionMenu(b, d.row.original)
238
238
  );
239
239
  },
240
240
  enableSorting: !1,
@@ -284,7 +284,7 @@ const ho = {
284
284
  function vt(A) {
285
285
  return { ...ho, context: A };
286
286
  }
287
- const bo = { class: "flex items-center" }, go = { class: "fm-typo-en-title-md-800" }, xo = { class: "flex flex-col gap-24 w-full" }, So = { class: "flex flex-col gap-8" }, wo = { class: "fm-typo-en-body-lg-600" }, Ao = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary flex-grow" }, Fo = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-error" }, $o = { class: "flex flex-col p-16 gap-8" }, jo = { class: "flex flex-col gap-4" }, Vo = { class: "fm-typo-en-body-md-600 text-fm-color-typo-secondary bg-fm-color-neutral-gray-100 border-b py-12 px-16" }, Co = { class: "grid grid-cols-[auto_100px_100px_48px] xs:grid-cols-[auto_80px_120px_48px] gap-8 px-8 items-center" }, Do = { class: "xs:col-span-3" }, Bo = { class: "flex gap-8" }, Mo = /* @__PURE__ */ ve({
287
+ const bo = { class: "flex items-center" }, go = { class: "fm-typo-en-title-md-800" }, xo = { class: "flex flex-col gap-24 w-full" }, So = { class: "flex flex-col gap-8" }, wo = { class: "fm-typo-en-body-lg-600" }, Ao = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary flex-grow" }, Fo = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-error" }, $o = { class: "flex flex-col p-16 gap-8" }, jo = { class: "flex flex-col gap-4" }, Vo = { class: "fm-typo-en-body-md-600 text-fm-color-typo-secondary bg-fm-color-neutral-gray-100 border-b py-12 px-16" }, Co = { class: "grid grid-cols-[auto_100px_100px_48px] xs:grid-cols-[auto_80px_120px_48px] gap-8 px-8 items-center" }, Bo = { class: "xs:col-span-3" }, Do = { class: "flex gap-8" }, Mo = /* @__PURE__ */ pe({
288
288
  __name: "ConvertSkuDialog",
289
289
  props: {
290
290
  sku: {},
@@ -293,21 +293,21 @@ const bo = { class: "flex items-center" }, go = { class: "fm-typo-en-title-md-80
293
293
  },
294
294
  emits: ["update:show", "submitted"],
295
295
  setup(A, { expose: u, emit: k }) {
296
- const y = A, w = k, j = Jt(), d = Ne(), r = Ae(), g = we(), { t: R } = pe(), C = Y(0), l = Y(null), a = T(() => d.skus), D = T(
296
+ const y = A, w = k, V = Jt(), d = Ne(), r = Ae(), b = we(), { t: R } = ye(), C = Y(0), l = Y(null), a = T(() => d.skus), B = T(
297
297
  () => {
298
298
  var x, F;
299
299
  return (((F = (x = y.sku) == null ? void 0 : x.convert) == null ? void 0 : F.inventoryBindings) ?? []).filter(
300
300
  (G) => G.type === rt.enum.SKU
301
301
  );
302
302
  }
303
- ), m = T({
303
+ ), f = T({
304
304
  get() {
305
305
  return !!l.value;
306
306
  },
307
307
  set(x) {
308
- x ? l.value = Re(D.value) : (l.value = null, C.value = Math.min(C.value, y.maxCount ?? 0));
308
+ x ? l.value = Re(B.value) : (l.value = null, C.value = Math.min(C.value, y.maxCount ?? 0));
309
309
  }
310
- }), b = Y(!1);
310
+ }), g = Y(!1);
311
311
  Fe([() => y.show], ([x]) => {
312
312
  x && (C.value = 0);
313
313
  });
@@ -345,17 +345,17 @@ const bo = { class: "flex items-center" }, go = { class: "fm-typo-en-title-md-80
345
345
  recipes: d.recipes
346
346
  }).inventoryBindings.filter((I) => "success" in I && I.success).map((I) => I).map((I) => I.binding);
347
347
  return (J = l.value ?? F) == null ? void 0 : J.map((I) => {
348
- var ee, ae, Q, W, te;
349
- const c = d.skus.find((le) => le._id === I.id), h = ((ee = I.measurement) == null ? void 0 : ee.abbrev) ?? ((ae = c == null ? void 0 : c.unit) == null ? void 0 : ae.abbrev), f = (Q = y.sku.convert) != null && Q.measurement ? y.sku.unit.measurements.find((le) => {
348
+ var ee, ae, Q, W, oe;
349
+ const c = d.skus.find((le) => le._id === I.id), h = ((ee = I.measurement) == null ? void 0 : ee.abbrev) ?? ((ae = c == null ? void 0 : c.unit) == null ? void 0 : ae.abbrev), v = (Q = y.sku.convert) != null && Q.measurement ? y.sku.unit.measurements.find((le) => {
350
350
  var ce;
351
351
  return le.id === ((ce = y.sku.convert) == null ? void 0 : ce.measurement);
352
- }) ?? null : null, v = $e(y.sku.unit, f), i = n(`${C.value}`) === !0 ? he(
352
+ }) ?? null : null, p = $e(y.sku.unit, v), i = n(`${C.value}`) === !0 ? he(
353
353
  zt(
354
354
  I.amount,
355
- Ee(+C.value, v)
355
+ Ee(+C.value, p)
356
356
  ),
357
357
  !1
358
- ) : "0", S = (te = (W = l.value) == null ? void 0 : W.find((le) => le.id === (c == null ? void 0 : c._id))) == null ? void 0 : te.amount, P = S ? he(S, !1) : null;
358
+ ) : "0", S = (oe = (W = l.value) == null ? void 0 : W.find((le) => le.id === (c == null ? void 0 : c._id))) == null ? void 0 : oe.amount, P = S ? he(S, !1) : null;
359
359
  return {
360
360
  sku: c,
361
361
  convertAmount: P ?? i,
@@ -379,7 +379,7 @@ const bo = { class: "flex items-center" }, go = { class: "fm-typo-en-title-md-80
379
379
  });
380
380
  const O = Ye(y, "show");
381
381
  async function L(x, F, G) {
382
- b.value = !0;
382
+ g.value = !0;
383
383
  try {
384
384
  await r.convertSku({
385
385
  conversions: [
@@ -398,13 +398,13 @@ const bo = { class: "flex items-center" }, go = { class: "fm-typo-en-title-md-80
398
398
  ]
399
399
  }), w("update:show", !1), w("submitted");
400
400
  } catch (H) {
401
- g.open({
401
+ b.open({
402
402
  title: "Something went wrong",
403
403
  message: `Cannot convert ${x.name}. Please try again.`,
404
404
  type: "error"
405
405
  }), console.error("error at converting stock amount", x, F, H);
406
406
  } finally {
407
- b.value = !1;
407
+ g.value = !1;
408
408
  }
409
409
  }
410
410
  function X(x, F, G) {
@@ -431,7 +431,7 @@ const bo = { class: "flex items-center" }, go = { class: "fm-typo-en-title-md-80
431
431
  const J = a.value.find((I) => I._id === x);
432
432
  H = G.map((I) => {
433
433
  var c, h;
434
- return I.id !== x || (I.measurement = (h = (c = J == null ? void 0 : J.unit) == null ? void 0 : c.measurements) == null ? void 0 : h.find((f) => f.id === F)), I;
434
+ return I.id !== x || (I.measurement = (h = (c = J == null ? void 0 : J.unit) == null ? void 0 : c.measurements) == null ? void 0 : h.find((v) => v.id === F)), I;
435
435
  }) ?? [];
436
436
  }
437
437
  l.value = H;
@@ -445,7 +445,7 @@ const bo = { class: "flex items-center" }, go = { class: "fm-typo-en-title-md-80
445
445
  ...F,
446
446
  type: rt.enum.SKU
447
447
  }));
448
- j.promptIngredientsBinding(
448
+ V.promptIngredientsBinding(
449
449
  x,
450
450
  (F) => l.value = F,
451
451
  y.sku._id
@@ -457,8 +457,8 @@ const bo = { class: "flex items-center" }, go = { class: "fm-typo-en-title-md-80
457
457
  x || (l.value = null, C.value = 0);
458
458
  }
459
459
  ), (x, F) => {
460
- const G = B("FmTextField"), H = B("FmForm"), J = B("FmCard"), I = B("FmSwitch"), c = B("FmFormGroup"), h = B("FmSelect"), f = B("FmButton"), v = B("FmSideSheet");
461
- return V(), ne(v, {
460
+ const G = D("FmTextField"), H = D("FmForm"), J = D("FmCard"), I = D("FmSwitch"), c = D("FmFormGroup"), h = D("FmSelect"), v = D("FmButton"), p = D("FmSideSheet");
461
+ return j(), te(p, {
462
462
  "dismiss-away": "",
463
463
  modelValue: s(O),
464
464
  "onUpdate:modelValue": F[3] || (F[3] = (i) => Pe(O) ? O.value = i : null),
@@ -466,7 +466,7 @@ const bo = { class: "flex items-center" }, go = { class: "fm-typo-en-title-md-80
466
466
  }, {
467
467
  "side-sheet-header": M(() => [
468
468
  e("div", bo, [
469
- e("div", go, p(s(R)("inventory.stock.convert.title", { name: x.sku.name })), 1)
469
+ e("div", go, m(s(R)("inventory.stock.convert.title", { name: x.sku.name })), 1)
470
470
  ])
471
471
  ]),
472
472
  default: M(() => [
@@ -478,7 +478,7 @@ const bo = { class: "flex items-center" }, go = { class: "fm-typo-en-title-md-80
478
478
  }, {
479
479
  default: M(() => [
480
480
  _(G, {
481
- disabled: b.value,
481
+ disabled: g.value,
482
482
  "model-value": C.value,
483
483
  "onUpdate:modelValue": F[0] || (F[0] = (i) => C.value = i),
484
484
  label: s(R)("inventory.stock.convert.amount"),
@@ -495,15 +495,15 @@ const bo = { class: "flex items-center" }, go = { class: "fm-typo-en-title-md-80
495
495
  }, {
496
496
  default: M(() => [
497
497
  e("div", So, [
498
- e("div", wo, p(s(R)("inventory.stock.convert.deductionSummary")), 1),
499
- (V(!0), q(ue, null, fe(E.value, (i) => {
498
+ e("div", wo, m(s(R)("inventory.stock.convert.deductionSummary")), 1),
499
+ (j(!0), q(ue, null, ve(E.value, (i) => {
500
500
  var S, P;
501
- return V(), q("div", {
501
+ return j(), q("div", {
502
502
  key: (S = i.sku) == null ? void 0 : S._id,
503
503
  class: "flex items-center"
504
504
  }, [
505
- e("div", Ao, p((P = i.sku) == null ? void 0 : P.name), 1),
506
- e("div", Fo, " -" + p(i.convertAmount) + " " + p(i.abbrev), 1)
505
+ e("div", Ao, m((P = i.sku) == null ? void 0 : P.name), 1),
506
+ e("div", Fo, " -" + m(i.convertAmount) + " " + m(i.abbrev), 1)
507
507
  ]);
508
508
  }), 128))
509
509
  ])
@@ -515,21 +515,21 @@ const bo = { class: "flex items-center" }, go = { class: "fm-typo-en-title-md-80
515
515
  e("div", $o, [
516
516
  _(I, {
517
517
  value: "",
518
- modelValue: m.value,
519
- "onUpdate:modelValue": F[1] || (F[1] = (i) => m.value = i),
518
+ modelValue: f.value,
519
+ "onUpdate:modelValue": F[1] || (F[1] = (i) => f.value = i),
520
520
  label: s(R)("inventory.stock.convert.overrideDeduction"),
521
521
  "label-placement": "right"
522
522
  }, null, 8, ["modelValue", "label"]),
523
- m.value ? (V(), q(ue, { key: 0 }, [
523
+ f.value ? (j(), q(ue, { key: 0 }, [
524
524
  _(c, {
525
525
  modelValue: l.value,
526
526
  rules: [s(Kt)(1, "Must have at least one ingredient binding")]
527
527
  }, null, 8, ["modelValue", "rules"]),
528
528
  e("div", jo, [
529
- e("div", Vo, p(s(R)("inventory.stock.convert.ingredients")), 1),
530
- (V(!0), q(ue, null, fe(l.value, (i) => (V(), ne(c, {
529
+ e("div", Vo, m(s(R)("inventory.stock.convert.ingredients")), 1),
530
+ (j(!0), q(ue, null, ve(l.value, (i) => (j(), te(c, {
531
531
  key: i.id,
532
- disabled: b.value,
532
+ disabled: g.value,
533
533
  modelValue: +s(he)(i.amount ?? { amount: 1, precision: 0 }),
534
534
  rules: [
535
535
  s(qt)(
@@ -543,10 +543,10 @@ const bo = { class: "flex items-center" }, go = { class: "fm-typo-en-title-md-80
543
543
  var P, ee, ae;
544
544
  return [
545
545
  e("div", Co, [
546
- e("div", Do, p((P = a.value.find((Q) => Q._id === i.id)) == null ? void 0 : P.name), 1),
546
+ e("div", Bo, m((P = a.value.find((Q) => Q._id === i.id)) == null ? void 0 : P.name), 1),
547
547
  _(G, {
548
548
  class: "xs:col-span-2",
549
- disabled: b.value,
549
+ disabled: g.value,
550
550
  modelValue: +s(he)(
551
551
  i.amount ?? { amount: 1, precision: 0 }
552
552
  ),
@@ -554,7 +554,7 @@ const bo = { class: "flex items-center" }, go = { class: "fm-typo-en-title-md-80
554
554
  invalid: S
555
555
  }, null, 8, ["disabled", "modelValue", "onUpdate:modelValue", "invalid"]),
556
556
  _(h, {
557
- disabled: b.value,
557
+ disabled: g.value,
558
558
  class: "translate-y-[2px]",
559
559
  items: z(i.id),
560
560
  "model-value": (ae = K(i.id, (ee = i.measurement) == null ? void 0 : ee.id)) == null ? void 0 : ae.value,
@@ -564,8 +564,8 @@ const bo = { class: "flex items-center" }, go = { class: "fm-typo-en-title-md-80
564
564
  "helper-text": M(() => F[4] || (F[4] = [])),
565
565
  _: 2
566
566
  }, 1032, ["disabled", "items", "model-value", "onUpdate:modelValue", "invalid"]),
567
- _(f, {
568
- disabled: b.value,
567
+ _(v, {
568
+ disabled: g.value,
569
569
  type: "button",
570
570
  variant: "tertiary",
571
571
  icon: "delete",
@@ -578,7 +578,7 @@ const bo = { class: "flex items-center" }, go = { class: "fm-typo-en-title-md-80
578
578
  }, 1032, ["disabled", "modelValue", "rules"]))), 128))
579
579
  ]),
580
580
  e("div", null, [
581
- _(f, {
581
+ _(v, {
582
582
  icon: "link",
583
583
  label: s(R)("inventory.stock.convert.linkIngredient"),
584
584
  variant: "plain",
@@ -593,9 +593,9 @@ const bo = { class: "flex items-center" }, go = { class: "fm-typo-en-title-md-80
593
593
  ])
594
594
  ]),
595
595
  "side-sheet-footer": M(() => [
596
- e("div", Bo, [
597
- _(f, {
598
- loading: b.value,
596
+ e("div", Do, [
597
+ _(v, {
598
+ loading: g.value,
599
599
  label: s(R)("inventory.stock.convert.convertButton"),
600
600
  onClick: F[2] || (F[2] = (i) => {
601
601
  var S, P;
@@ -609,7 +609,7 @@ const bo = { class: "flex items-center" }, go = { class: "fm-typo-en-title-md-80
609
609
  };
610
610
  }
611
611
  });
612
- function Be(A, u) {
612
+ function De(A, u) {
613
613
  const k = Ee(A, u);
614
614
  return { ...k, amount: -k.amount };
615
615
  }
@@ -619,19 +619,19 @@ function pt(A, u) {
619
619
  const We = {
620
620
  [ie.enum.DAMAGE]: {
621
621
  label: "Damage",
622
- toAdjustmentAmount: Be
622
+ toAdjustmentAmount: De
623
623
  },
624
624
  [ie.enum.WASTAGE]: {
625
625
  label: "Wastage",
626
- toAdjustmentAmount: Be
626
+ toAdjustmentAmount: De
627
627
  },
628
628
  [ie.enum.THEFT]: {
629
629
  label: "Theft",
630
- toAdjustmentAmount: Be
630
+ toAdjustmentAmount: De
631
631
  },
632
632
  [ie.enum.LOSE]: {
633
633
  label: "Lose",
634
- toAdjustmentAmount: Be
634
+ toAdjustmentAmount: De
635
635
  },
636
636
  [ie.enum.EXTRA]: {
637
637
  label: "Extra",
@@ -644,7 +644,7 @@ const We = {
644
644
  }, Io = { class: "col-span-2 flex" }, Ho = { class: "flex-1" }, To = { class: "fm-typo-en-body-lg-600" }, Eo = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Uo = { class: "col-span-2 flex flex-col gap-4" }, Po = { class: "flex gap-4 text-fm-color-typo-primary fm-typo-en-body-lg-600" }, Ro = {
645
645
  key: 0,
646
646
  class: "fm-typo-en-body-md-400 text-fm-color-typo-warning"
647
- }, $t = /* @__PURE__ */ ve({
647
+ }, $t = /* @__PURE__ */ pe({
648
648
  __name: "AdjustedItemForm",
649
649
  props: {
650
650
  modelValue: {},
@@ -653,12 +653,12 @@ const We = {
653
653
  },
654
654
  emits: ["update:modelValue", "click:delete"],
655
655
  setup(A, { emit: u }) {
656
- const k = A, y = u, { t: w } = pe(), j = Oe(), d = T(
656
+ const k = A, y = u, { t: w } = ye(), V = Oe(), d = T(
657
657
  () => Object.keys(We).map((t) => ({
658
658
  label: Ht(t),
659
659
  value: t
660
660
  }))
661
- ), r = T(() => bt(k.modelValue.doc.unit, !0)), g = T({
661
+ ), r = T(() => bt(k.modelValue.doc.unit, !0)), b = T({
662
662
  get() {
663
663
  return k.modelValue.type ?? ie.enum.PURCHASE;
664
664
  },
@@ -682,7 +682,7 @@ const We = {
682
682
  const n = {
683
683
  ...k.modelValue
684
684
  }, $ = xe(t);
685
- n.amount = We[g.value].toAdjustmentAmount(
685
+ n.amount = We[b.value].toAdjustmentAmount(
686
686
  t,
687
687
  $.precision
688
688
  ), y("update:modelValue", n);
@@ -711,29 +711,29 @@ const We = {
711
711
  }
712
712
  }), a = T(() => {
713
713
  var n;
714
- const t = (n = j.stockBalance.skus) == null ? void 0 : n.find(($) => $.id === k.modelValue.doc._id);
714
+ const t = (n = V.stockBalance.skus) == null ? void 0 : n.find(($) => $.id === k.modelValue.doc._id);
715
715
  return (t == null ? void 0 : t.balance) ?? { amount: 0, precision: 0 };
716
- }), D = T(() => {
716
+ }), B = T(() => {
717
717
  const t = k.modelValue.amount, n = k.modelValue.measurement;
718
718
  return n ? xt(t, n.conversion) : t;
719
- }), m = T(
720
- () => k.isBackdate ? a.value : Qe(a.value, D.value)
721
- ), b = T(
722
- () => Zt(m.value, k.modelValue.doc.unit)
719
+ }), f = T(
720
+ () => k.isBackdate ? a.value : Qe(a.value, B.value)
721
+ ), g = T(
722
+ () => Zt(f.value, k.modelValue.doc.unit)
723
723
  ), o = T(
724
- () => !k.isBackdate && D.value.amount < 0
724
+ () => !k.isBackdate && B.value.amount < 0
725
725
  );
726
726
  return (t, n) => {
727
- const $ = B("FmButton"), E = B("FmSelect"), N = B("FmTextarea"), O = B("FmCard");
728
- return V(), ne(O, {
727
+ const $ = D("FmButton"), E = D("FmSelect"), N = D("FmTextarea"), O = D("FmCard");
728
+ return j(), te(O, {
729
729
  variant: "outlined",
730
730
  class: "grid grid-cols-2 gap-8 p-16"
731
731
  }, {
732
732
  default: M(() => [
733
733
  e("div", Io, [
734
734
  e("div", Ho, [
735
- e("div", To, p(t.modelValue.doc.name), 1),
736
- e("div", Eo, p(t.modelValue.doc.code), 1)
735
+ e("div", To, m(t.modelValue.doc.name), 1),
736
+ e("div", Eo, m(t.modelValue.doc.code), 1)
737
737
  ]),
738
738
  _($, {
739
739
  variant: "tertiary",
@@ -746,8 +746,8 @@ const We = {
746
746
  class: "col-span-2",
747
747
  label: "Type",
748
748
  items: d.value,
749
- modelValue: g.value,
750
- "onUpdate:modelValue": n[1] || (n[1] = (L) => g.value = L),
749
+ modelValue: b.value,
750
+ "onUpdate:modelValue": n[1] || (n[1] = (L) => b.value = L),
751
751
  rules: [s(Xt)()],
752
752
  "label-mark": "required"
753
753
  }, null, 8, ["disabled", "items", "modelValue", "rules"]),
@@ -778,18 +778,18 @@ const We = {
778
778
  "label-mark": "optional"
779
779
  }, null, 8, ["disabled", "modelValue"]),
780
780
  e("div", Uo, [
781
- e("div", Po, p(s(w)("inventory.stock.stock_adjustment.stockAfter")), 1),
781
+ e("div", Po, m(s(w)("inventory.stock.stock_adjustment.stockAfter")), 1),
782
782
  e("div", {
783
783
  class: He(["fm-typo-en-body-lg-600", o.value ? "text-red-700" : "text-green-700"])
784
- }, p(b.value), 3),
785
- t.isBackdate ? (V(), q("div", Ro, p(s(w)("inventory.stock.stock_adjustment.backdatePreviewWarning")), 1)) : se("", !0)
784
+ }, m(g.value), 3),
785
+ t.isBackdate ? (j(), q("div", Ro, m(s(w)("inventory.stock.stock_adjustment.backdatePreviewWarning")), 1)) : se("", !0)
786
786
  ])
787
787
  ]),
788
788
  _: 1
789
789
  });
790
790
  };
791
791
  }
792
- }), No = { class: "flex items-center" }, Oo = { class: "fm-typo-en-title-md-800" }, Lo = { class: "flex items-center" }, Yo = { class: "fm-typo-en-title-sm-800 flex-1" }, zo = { class: "flex gap-8" }, Go = /* @__PURE__ */ ve({
792
+ }), No = { class: "flex items-center" }, Oo = { class: "fm-typo-en-title-md-800" }, Lo = { class: "flex items-center" }, Yo = { class: "fm-typo-en-title-sm-800 flex-1" }, zo = { class: "flex gap-8" }, Go = /* @__PURE__ */ pe({
793
793
  __name: "AdjustSkuDialog",
794
794
  props: {
795
795
  stock: {},
@@ -797,9 +797,9 @@ const We = {
797
797
  },
798
798
  emits: ["update:show", "submitted"],
799
799
  setup(A, { expose: u, emit: k }) {
800
- const y = A, w = k, j = Ne(), d = Le(), r = Ae(), g = we(), R = Y(!1), { t: C } = pe();
800
+ const y = A, w = k, V = Ne(), d = Le(), r = Ae(), b = we(), R = Y(!1), { t: C } = ye();
801
801
  function l() {
802
- b(Re(m));
802
+ g(Re(f));
803
803
  }
804
804
  const a = Y();
805
805
  u({
@@ -816,7 +816,7 @@ const We = {
816
816
  ($ = (n = a.value) == null ? void 0 : n.resetInputs) == null || $.call(n);
817
817
  }
818
818
  });
819
- const D = Ye(y, "show"), m = _t({
819
+ const B = Ye(y, "show"), f = _t({
820
820
  remark: "",
821
821
  adjustments: [
822
822
  {
@@ -830,7 +830,7 @@ const We = {
830
830
  ]
831
831
  });
832
832
  Fe([() => y.show], ([n]) => {
833
- n && (m.remark = "", m.adjustments = [
833
+ n && (f.remark = "", f.adjustments = [
834
834
  {
835
835
  id: `sku_${(/* @__PURE__ */ new Date()).toISOString()}_${Math.random().toString(16).slice(2, 8)}`,
836
836
  type: ie.enum.PURCHASE,
@@ -841,7 +841,7 @@ const We = {
841
841
  }
842
842
  ]);
843
843
  });
844
- async function b(n) {
844
+ async function g(n) {
845
845
  R.value = !0;
846
846
  try {
847
847
  await r.adjustSku({
@@ -856,7 +856,7 @@ const We = {
856
856
  }))
857
857
  }), w("update:show", !1), w("submitted");
858
858
  } catch ($) {
859
- g.open({
859
+ b.open({
860
860
  title: C("inventory.stock.adjust.error.title"),
861
861
  message: C("inventory.stock.adjust.error.message"),
862
862
  type: "error"
@@ -866,11 +866,11 @@ const We = {
866
866
  }
867
867
  }
868
868
  function o() {
869
- const n = j.skus.map((E) => ({
869
+ const n = V.skus.map((E) => ({
870
870
  label: E.name,
871
871
  sublabel: E.code,
872
872
  value: E._id
873
- })), $ = n.filter((E) => m.adjustments.find((N) => N.doc._id === E.value)).map((E) => E.value);
873
+ })), $ = n.filter((E) => f.adjustments.find((N) => N.doc._id === E.value)).map((E) => E.value);
874
874
  d.open({
875
875
  title: "Select ingredients",
876
876
  contentComponent: St,
@@ -891,11 +891,11 @@ const We = {
891
891
  variant: "tertiary"
892
892
  }
893
893
  }).onPrimary((E) => {
894
- m.adjustments = E.map(
895
- (N) => m.adjustments.find((O) => O.doc._id === N) ?? {
894
+ f.adjustments = E.map(
895
+ (N) => f.adjustments.find((O) => O.doc._id === N) ?? {
896
896
  id: `sku_${(/* @__PURE__ */ new Date()).toISOString()}_${Math.random().toString(16).slice(2, 8)}`,
897
897
  type: ie.enum.PURCHASE,
898
- doc: j.skus.find((O) => O._id === N),
898
+ doc: V.skus.find((O) => O._id === N),
899
899
  measurement: null,
900
900
  remark: "",
901
901
  amount: xe(1)
@@ -904,19 +904,19 @@ const We = {
904
904
  });
905
905
  }
906
906
  function t(n) {
907
- m.adjustments.splice(n, 1);
907
+ f.adjustments.splice(n, 1);
908
908
  }
909
909
  return (n, $) => {
910
- const E = B("FmTextarea"), N = B("FmButton"), O = B("FmForm"), L = B("FmSideSheet");
911
- return V(), ne(L, {
912
- modelValue: s(D),
913
- "onUpdate:modelValue": $[2] || ($[2] = (X) => Pe(D) ? D.value = X : null),
910
+ const E = D("FmTextarea"), N = D("FmButton"), O = D("FmForm"), L = D("FmSideSheet");
911
+ return j(), te(L, {
912
+ modelValue: s(B),
913
+ "onUpdate:modelValue": $[2] || ($[2] = (X) => Pe(B) ? B.value = X : null),
914
914
  "dismiss-away": "",
915
915
  "max-width": 500
916
916
  }, {
917
917
  "side-sheet-header": M(() => [
918
918
  e("div", No, [
919
- e("div", Oo, p(s(C)("inventory.stock.adjust.title")), 1)
919
+ e("div", Oo, m(s(C)("inventory.stock.adjust.title")), 1)
920
920
  ])
921
921
  ]),
922
922
  default: M(() => [
@@ -929,11 +929,11 @@ const We = {
929
929
  default: M(() => [
930
930
  _(E, {
931
931
  label: s(C)("inventory.stock.adjust.remark"),
932
- modelValue: m.remark,
933
- "onUpdate:modelValue": $[0] || ($[0] = (X) => m.remark = X)
932
+ modelValue: f.remark,
933
+ "onUpdate:modelValue": $[0] || ($[0] = (X) => f.remark = X)
934
934
  }, null, 8, ["label", "modelValue"]),
935
935
  e("div", Lo, [
936
- e("div", Yo, p(s(C)("inventory.stock.adjust.adjustedItems")), 1),
936
+ e("div", Yo, m(s(C)("inventory.stock.adjust.adjustedItems")), 1),
937
937
  _(N, {
938
938
  "prepend-icon": "add",
939
939
  variant: "tertiary",
@@ -941,10 +941,10 @@ const We = {
941
941
  onClick: o
942
942
  })
943
943
  ]),
944
- (V(!0), q(ue, null, fe(m.adjustments, (X, z) => (V(), ne($t, {
944
+ (j(!0), q(ue, null, ve(f.adjustments, (X, z) => (j(), te($t, {
945
945
  key: X.id,
946
- modelValue: m.adjustments[z],
947
- "onUpdate:modelValue": (K) => m.adjustments[z] = K,
946
+ modelValue: f.adjustments[z],
947
+ "onUpdate:modelValue": (K) => f.adjustments[z] = K,
948
948
  "onClick:delete": (K) => t(z)
949
949
  }, null, 8, ["modelValue", "onUpdate:modelValue", "onClick:delete"]))), 128))
950
950
  ]),
@@ -970,28 +970,28 @@ const We = {
970
970
  }), Wo = { class: "flex items-center w-full gap-8" }, Ko = { class: "fm-typo-en-title-md-800 flex-1" }, qo = {
971
971
  key: 0,
972
972
  class: "flex flex-col gap-4"
973
- }, Xo = { class: "fm-typo-en-body-md-600" }, Jo = { class: "flex gap-8 items-start" }, Qo = { class: "flex-1 min-w-0" }, Zo = { class: "flex-1 min-w-0" }, en = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, tn = { class: "flex items-center" }, on = { class: "fm-typo-en-title-sm-800 flex-1" }, nn = { class: "flex gap-8" }, yt = 14, sn = /* @__PURE__ */ ve({
973
+ }, Xo = { class: "fm-typo-en-body-md-600" }, Jo = { class: "flex gap-8 items-start" }, Qo = { class: "flex-1 min-w-0" }, Zo = { class: "flex-1 min-w-0" }, en = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, tn = { class: "flex items-center" }, on = { class: "fm-typo-en-title-sm-800 flex-1" }, nn = { class: "flex gap-8" }, yt = 14, sn = /* @__PURE__ */ pe({
974
974
  __name: "StockAdjustmentSideSheet",
975
975
  props: {
976
976
  show: { type: Boolean }
977
977
  },
978
978
  emits: ["update:show", "submitted"],
979
979
  setup(A, { emit: u }) {
980
- const k = A, y = u, { t: w } = pe(), j = Ne(), d = Ae(), r = Le(), g = we(), R = Ye(k, "show"), C = Y(!1), l = _t({
980
+ const k = A, y = u, { t: w } = ye(), V = Ne(), d = Ae(), r = Le(), b = we(), R = Ye(k, "show"), C = Y(!1), l = _t({
981
981
  remark: "",
982
982
  effectiveAt: /* @__PURE__ */ new Date(),
983
983
  adjustments: []
984
- }), a = Y(!1), D = Y(ke().format("YYYY-MM-DD")), m = Y(ke().format("HH:mm")), b = Y();
985
- Fe([D, m], () => {
986
- if (D.value && m.value) {
987
- const K = ke(`${D.value} ${m.value}`, "YYYY-MM-DD HH:mm");
984
+ }), a = Y(!1), B = Y(ke().format("YYYY-MM-DD")), f = Y(ke().format("HH:mm")), g = Y();
985
+ Fe([B, f], () => {
986
+ if (B.value && f.value) {
987
+ const K = ke(`${B.value} ${f.value}`, "YYYY-MM-DD HH:mm");
988
988
  K.isValid() && (l.effectiveAt = K.toDate());
989
989
  }
990
990
  });
991
- const o = T(() => `${D.value} ${m.value}`);
991
+ const o = T(() => `${B.value} ${f.value}`);
992
992
  function t() {
993
993
  if (!a.value) return !0;
994
- const K = ke(`${D.value} ${m.value}`, "YYYY-MM-DD HH:mm");
994
+ const K = ke(`${B.value} ${f.value}`, "YYYY-MM-DD HH:mm");
995
995
  if (!K.isValid()) return w("inventory.stock.stock_adjustment.invalidDateTime");
996
996
  const U = ke();
997
997
  if (K.isAfter(U))
@@ -1001,19 +1001,19 @@ const We = {
1001
1001
  }
1002
1002
  const n = T(() => [() => t()]), $ = T(() => l.adjustments.length === 0 || t() !== !0);
1003
1003
  function E() {
1004
- l.remark = "", l.effectiveAt = /* @__PURE__ */ new Date(), l.adjustments = [], a.value = !1, D.value = ke(l.effectiveAt).format("YYYY-MM-DD"), m.value = ke(l.effectiveAt).format("HH:mm");
1004
+ l.remark = "", l.effectiveAt = /* @__PURE__ */ new Date(), l.adjustments = [], a.value = !1, B.value = ke(l.effectiveAt).format("YYYY-MM-DD"), f.value = ke(l.effectiveAt).format("HH:mm");
1005
1005
  }
1006
1006
  function N() {
1007
1007
  E();
1008
1008
  }
1009
1009
  const O = T(() => {
1010
1010
  const K = {};
1011
- return j.skus.forEach((U) => {
1011
+ return V.skus.forEach((U) => {
1012
1012
  K[U._id] = U;
1013
1013
  }), K;
1014
1014
  });
1015
1015
  function L() {
1016
- const K = j.skus.map((Z) => ({
1016
+ const K = V.skus.map((Z) => ({
1017
1017
  label: Z.name,
1018
1018
  sublabel: Z.code,
1019
1019
  value: Z._id
@@ -1056,7 +1056,7 @@ const We = {
1056
1056
  }
1057
1057
  async function z() {
1058
1058
  if (l.adjustments.length === 0) {
1059
- g.open({
1059
+ b.open({
1060
1060
  title: w("inventory.stock.error.title"),
1061
1061
  message: w("inventory.stock.stock_adjustment.noAdjustments"),
1062
1062
  type: "warning"
@@ -1081,7 +1081,7 @@ const We = {
1081
1081
  };
1082
1082
  await d.adjustSku(Re(U)), y("submitted"), y("update:show", !1);
1083
1083
  } catch (K) {
1084
- g.open({
1084
+ b.open({
1085
1085
  title: w("inventory.stock.adjust.error.title"),
1086
1086
  message: w("inventory.stock.adjust.error.message"),
1087
1087
  type: "error"
@@ -1091,8 +1091,8 @@ const We = {
1091
1091
  }
1092
1092
  }
1093
1093
  return (K, U) => {
1094
- const Z = B("FmTextarea"), re = B("FmSwitch"), x = B("FmDatePicker"), F = B("FmTimePicker"), G = B("FmFormGroup"), H = B("FmButton"), J = B("FmForm"), I = B("FmSideSheet");
1095
- return V(), ne(I, {
1094
+ const Z = D("FmTextarea"), re = D("FmSwitch"), x = D("FmDatePicker"), F = D("FmTimePicker"), G = D("FmFormGroup"), H = D("FmButton"), J = D("FmForm"), I = D("FmSideSheet");
1095
+ return j(), te(I, {
1096
1096
  modelValue: s(R),
1097
1097
  "onUpdate:modelValue": U[6] || (U[6] = (c) => Pe(R) ? R.value = c : null),
1098
1098
  "dismiss-away": "",
@@ -1101,14 +1101,14 @@ const We = {
1101
1101
  }, {
1102
1102
  "side-sheet-header": M(() => [
1103
1103
  e("div", Wo, [
1104
- e("div", Ko, p(s(w)("inventory.stock.stock_adjustment.title")), 1)
1104
+ e("div", Ko, m(s(w)("inventory.stock.stock_adjustment.title")), 1)
1105
1105
  ])
1106
1106
  ]),
1107
1107
  default: M(() => [
1108
1108
  _(J, {
1109
1109
  class: "flex flex-col gap-16",
1110
1110
  ref_key: "formRef",
1111
- ref: b,
1111
+ ref: g,
1112
1112
  onValidationSuccess: z
1113
1113
  }, {
1114
1114
  default: M(() => [
@@ -1126,22 +1126,22 @@ const We = {
1126
1126
  sublabel: s(w)("inventory.stock.stock_adjustment.backdateSublabel"),
1127
1127
  labelPlacement: "right"
1128
1128
  }, null, 8, ["model-value", "label", "sublabel"]),
1129
- a.value ? (V(), q("div", qo, [
1130
- e("label", Xo, p(s(w)("inventory.stock.stock_adjustment.effectiveAt")), 1),
1129
+ a.value ? (j(), q("div", qo, [
1130
+ e("label", Xo, m(s(w)("inventory.stock.stock_adjustment.effectiveAt")), 1),
1131
1131
  e("div", Jo, [
1132
1132
  e("div", Qo, [
1133
1133
  _(x, {
1134
1134
  class: "w-full",
1135
- modelValue: D.value,
1136
- "onUpdate:modelValue": U[2] || (U[2] = (c) => D.value = c),
1135
+ modelValue: B.value,
1136
+ "onUpdate:modelValue": U[2] || (U[2] = (c) => B.value = c),
1137
1137
  clearable: !1
1138
1138
  }, null, 8, ["modelValue"])
1139
1139
  ]),
1140
1140
  e("div", Zo, [
1141
1141
  _(F, {
1142
1142
  class: "w-full",
1143
- modelValue: m.value,
1144
- "onUpdate:modelValue": U[3] || (U[3] = (c) => m.value = c),
1143
+ modelValue: f.value,
1144
+ "onUpdate:modelValue": U[3] || (U[3] = (c) => f.value = c),
1145
1145
  format: "HH:mm"
1146
1146
  }, null, 8, ["modelValue"])
1147
1147
  ])
@@ -1150,10 +1150,10 @@ const We = {
1150
1150
  "model-value": o.value,
1151
1151
  rules: n.value
1152
1152
  }, null, 8, ["model-value", "rules"]),
1153
- e("div", en, p(s(w)("inventory.stock.stock_adjustment.immediateHint")), 1)
1153
+ e("div", en, m(s(w)("inventory.stock.stock_adjustment.immediateHint")), 1)
1154
1154
  ])) : se("", !0),
1155
1155
  e("div", tn, [
1156
- e("div", on, p(s(w)("inventory.stock.adjust.adjustedItems")), 1),
1156
+ e("div", on, m(s(w)("inventory.stock.adjust.adjustedItems")), 1),
1157
1157
  _(H, {
1158
1158
  "prepend-icon": "add",
1159
1159
  variant: "tertiary",
@@ -1161,12 +1161,12 @@ const We = {
1161
1161
  onClick: L
1162
1162
  })
1163
1163
  ]),
1164
- (V(!0), q(ue, null, fe(l.adjustments, (c, h) => (V(), ne($t, {
1164
+ (j(!0), q(ue, null, ve(l.adjustments, (c, h) => (j(), te($t, {
1165
1165
  key: c.doc._id,
1166
1166
  modelValue: l.adjustments[h],
1167
- "onUpdate:modelValue": (f) => l.adjustments[h] = f,
1167
+ "onUpdate:modelValue": (v) => l.adjustments[h] = v,
1168
1168
  "is-backdate": a.value,
1169
- "onClick:delete": (f) => X(h)
1169
+ "onClick:delete": (v) => X(h)
1170
1170
  }, null, 8, ["modelValue", "onUpdate:modelValue", "is-backdate", "onClick:delete"]))), 128))
1171
1171
  ]),
1172
1172
  _: 1
@@ -1179,8 +1179,8 @@ const We = {
1179
1179
  loading: C.value,
1180
1180
  disabled: $.value,
1181
1181
  onClick: U[4] || (U[4] = (c) => {
1182
- var h, f;
1183
- return (f = (h = b.value) == null ? void 0 : h.validateInputs) == null ? void 0 : f.call(h);
1182
+ var h, v;
1183
+ return (v = (h = g.value) == null ? void 0 : h.validateInputs) == null ? void 0 : v.call(h);
1184
1184
  })
1185
1185
  }, null, 8, ["label", "loading", "disabled"]),
1186
1186
  _(H, {
@@ -1197,24 +1197,24 @@ const We = {
1197
1197
  }), an = Tt((A, u) => ({
1198
1198
  // TODO: remove once latest inventory backend has been push
1199
1199
  async findBillsByBusinessId(k, y, w) {
1200
- const j = `${A.businessesBackendUrl}/${k}/reports/find-many`, d = {
1200
+ const V = `${A.businessesBackendUrl}/${k}/reports/find-many`, d = {
1201
1201
  // type: TYPE.bill,
1202
1202
  type: "bill",
1203
1203
  restaurantIds: y,
1204
1204
  ids: w
1205
1205
  };
1206
- return await u.post(j, d);
1206
+ return await u.post(V, d);
1207
1207
  },
1208
1208
  async findBillsById(k) {
1209
- const w = Se().currentLocationDBName, j = `${A.inventoryBackendUrl}/${w}/bill/search`, d = {
1209
+ const w = Se().currentLocationDBName, V = `${A.inventoryBackendUrl}/${w}/bill/search`, d = {
1210
1210
  ids: k
1211
1211
  };
1212
- return await u.post(j, d);
1212
+ return await u.post(V, d);
1213
1213
  }
1214
1214
  })), rn = {
1215
1215
  key: 0,
1216
1216
  class: "flex justify-center items-center h-32"
1217
- }, ln = { class: "mb-3" }, un = { class: "flex flex-col gap-8" }, cn = { class: "flex flex-col text-fm-color-typo-primary mb-3 text-center" }, dn = { class: "text-fm-color-neutral-gray-400 fm-typo-en-body-sm-600" }, mn = { class: "flex flex-col gap-4 text-fm-color-typo-primary mb-3" }, fn = { class: "flex flex-col gap-4 text-fm-color-typo-primary mb-3" }, vn = { class: "flex flex-col gap-4 text-fm-color-typo-primary mb-3" }, pn = { class: "flex flex-col w-full px-2" }, yn = { class: "flex gap-2" }, _n = /* @__PURE__ */ ve({
1217
+ }, ln = { class: "mb-3" }, un = { class: "flex flex-col gap-8" }, cn = { class: "flex flex-col text-fm-color-typo-primary mb-3 text-center" }, dn = { class: "text-fm-color-neutral-gray-400 fm-typo-en-body-sm-600" }, mn = { class: "flex flex-col gap-4 text-fm-color-typo-primary mb-3" }, fn = { class: "flex flex-col gap-4 text-fm-color-typo-primary mb-3" }, vn = { class: "flex flex-col gap-4 text-fm-color-typo-primary mb-3" }, pn = { class: "flex flex-col w-full px-2" }, yn = { class: "flex gap-2" }, _n = /* @__PURE__ */ pe({
1218
1218
  __name: "AmendAdjustmentForm",
1219
1219
  props: /* @__PURE__ */ nt({
1220
1220
  adjustmentId: {}
@@ -1224,7 +1224,7 @@ const We = {
1224
1224
  }),
1225
1225
  emits: /* @__PURE__ */ nt(["refreshHistory"], ["update:modelValue"]),
1226
1226
  setup(A, { emit: u }) {
1227
- const k = A, y = u, w = Ae(), j = jt(A, "modelValue"), d = Y(!1), r = Y(!1), g = Y(!1), R = Y({
1227
+ const k = A, y = u, w = Ae(), V = jt(A, "modelValue"), d = Y(!1), r = Y(!1), b = Y(!1), R = Y({
1228
1228
  _id: `inventoryAdjustment_${(/* @__PURE__ */ new Date()).toISOString()}_XXXXX`,
1229
1229
  skus: []
1230
1230
  }), C = Y();
@@ -1238,29 +1238,29 @@ const We = {
1238
1238
  var t, n;
1239
1239
  if ((n = (t = C == null ? void 0 : C.value) == null ? void 0 : t.validateInputs) == null || n.call(t), !r.value) return;
1240
1240
  const o = {};
1241
- Object.keys(j.value || {}).forEach(($) => {
1241
+ Object.keys(V.value || {}).forEach(($) => {
1242
1242
  var E;
1243
- Object.keys(((E = j.value) == null ? void 0 : E[$]) || {}).forEach((N) => {
1243
+ Object.keys(((E = V.value) == null ? void 0 : E[$]) || {}).forEach((N) => {
1244
1244
  var L, X;
1245
- const O = (X = (L = j.value) == null ? void 0 : L[$]) == null ? void 0 : X[Number(N)];
1246
- O && D(O.amount) > 0 && (o[$] || (o[$] = []), o[$].push(O));
1245
+ const O = (X = (L = V.value) == null ? void 0 : L[$]) == null ? void 0 : X[Number(N)];
1246
+ O && B(O.amount) > 0 && (o[$] || (o[$] = []), o[$].push(O));
1247
1247
  });
1248
1248
  }), await w.revertWastageAdjustment({
1249
1249
  targetWastageAdjustmentId: k.adjustmentId,
1250
1250
  amountsGoingToAdjust: o
1251
- }), y("refreshHistory"), g.value = !1, j.value = {};
1251
+ }), y("refreshHistory"), b.value = !1, V.value = {};
1252
1252
  }
1253
1253
  function a(o) {
1254
1254
  const { skuId: t, idx: n, unit: $, measurement: E } = o;
1255
1255
  return T({
1256
1256
  get: () => {
1257
1257
  var L, X, z;
1258
- const N = (z = (X = (L = j.value) == null ? void 0 : L[t]) == null ? void 0 : X[n]) == null ? void 0 : z.amount;
1258
+ const N = (z = (X = (L = V.value) == null ? void 0 : L[t]) == null ? void 0 : X[n]) == null ? void 0 : z.amount;
1259
1259
  return N ? Number(_e.toFormatString({ value: N })) : 0;
1260
1260
  },
1261
1261
  set: (N) => {
1262
- j.value || (j.value = {});
1263
- const O = { ...j.value };
1262
+ V.value || (V.value = {});
1263
+ const O = { ...V.value };
1264
1264
  O[t] || (O[t] = {}), O[t][n] = {
1265
1265
  amount: _e.convertPrecision({
1266
1266
  value: _e.fromNumber(N),
@@ -1268,34 +1268,34 @@ const We = {
1268
1268
  }),
1269
1269
  type: ie.Enum.WASTAGE,
1270
1270
  measurement: E
1271
- }, j.value = O;
1271
+ }, V.value = O;
1272
1272
  }
1273
1273
  });
1274
1274
  }
1275
- function D(o, t = !0) {
1275
+ function B(o, t = !0) {
1276
1276
  const n = Number(_e.toFormatString({ value: o }));
1277
1277
  return t ? Math.abs(n) : n;
1278
1278
  }
1279
- function m(o, t) {
1279
+ function f(o, t) {
1280
1280
  return t.measurement ? t.measurement.abbrev : o.sku.unit.abbrev;
1281
1281
  }
1282
- function b(o, t) {
1282
+ function g(o, t) {
1283
1283
  if (t.amount === 0) return "N/A";
1284
1284
  const n = _e.add([o, t]);
1285
1285
  return n ? _e.toFormatString({ value: n }) : "N/A";
1286
1286
  }
1287
1287
  return (o, t) => {
1288
- const n = B("FmIcon"), $ = B("FmStepperField"), E = B("FmCard"), N = B("FmForm"), O = B("FmSpacer"), L = B("FmButton"), X = B("FmDialog");
1289
- return V(), ne(X, {
1290
- modelValue: g.value,
1291
- "onUpdate:modelValue": t[4] || (t[4] = (z) => g.value = z),
1288
+ const n = D("FmIcon"), $ = D("FmStepperField"), E = D("FmCard"), N = D("FmForm"), O = D("FmSpacer"), L = D("FmButton"), X = D("FmDialog");
1289
+ return j(), te(X, {
1290
+ modelValue: b.value,
1291
+ "onUpdate:modelValue": t[4] || (t[4] = (z) => b.value = z),
1292
1292
  overlay: !0
1293
1293
  }, {
1294
1294
  "dialog-button": M(() => [
1295
1295
  _(Je, null, {
1296
1296
  default: M(() => [
1297
1297
  e("button", {
1298
- onClick: t[0] || (t[0] = (z) => g.value = !0),
1298
+ onClick: t[0] || (t[0] = (z) => b.value = !0),
1299
1299
  class: "rounded-md hover:bg-gray-100 transition-colors"
1300
1300
  }, [
1301
1301
  _(n, {
@@ -1320,7 +1320,7 @@ const We = {
1320
1320
  label: "Close",
1321
1321
  size: "md",
1322
1322
  variant: "tertiary",
1323
- onClick: t[3] || (t[3] = (z) => g.value = !1)
1323
+ onClick: t[3] || (t[3] = (z) => b.value = !1)
1324
1324
  }),
1325
1325
  _(L, {
1326
1326
  class: "sm:w-full xs:w-full",
@@ -1333,7 +1333,7 @@ const We = {
1333
1333
  ])
1334
1334
  ]),
1335
1335
  default: M(() => [
1336
- d.value ? (V(), q("div", rn)) : (V(), ne(N, {
1336
+ d.value ? (j(), q("div", rn)) : (j(), te(N, {
1337
1337
  key: 1,
1338
1338
  ref_key: "formRef",
1339
1339
  ref: C,
@@ -1349,28 +1349,28 @@ const We = {
1349
1349
  e("p", ln, [
1350
1350
  t[6] || (t[6] = e("b", null, "Date:", -1)),
1351
1351
  t[7] || (t[7] = e("br", null, null, -1)),
1352
- ye(" " + p(s(eo)(s(Et)(R.value._id))), 1)
1352
+ me(" " + m(s(eo)(s(Et)(R.value._id))), 1)
1353
1353
  ]),
1354
1354
  e("div", un, [
1355
- (V(!0), q(ue, null, fe(R.value.skus, (z, K) => (V(), q(ue, { key: K }, [
1356
- (V(!0), q(ue, null, fe(z.amounts, (U, Z) => (V(), ne(E, {
1355
+ (j(!0), q(ue, null, ve(R.value.skus, (z, K) => (j(), q(ue, { key: K }, [
1356
+ (j(!0), q(ue, null, ve(z.amounts, (U, Z) => (j(), te(E, {
1357
1357
  key: Z,
1358
1358
  variant: "outlined",
1359
1359
  class: "p-2"
1360
1360
  }, {
1361
1361
  default: M(() => [
1362
1362
  e("div", cn, [
1363
- e("span", dn, p(z.sku.code), 1),
1364
- e("span", null, p(z.sku.name), 1)
1363
+ e("span", dn, m(z.sku.code), 1),
1364
+ e("span", null, m(z.sku.name), 1)
1365
1365
  ]),
1366
1366
  t[12] || (t[12] = e("hr", { class: "m-2" }, null, -1)),
1367
1367
  e("div", mn, [
1368
1368
  t[8] || (t[8] = e("span", { class: "fm-typo-en-body-lg-600" }, "Adjustment type:", -1)),
1369
- e("span", null, p(U.type), 1)
1369
+ e("span", null, m(U.type), 1)
1370
1370
  ]),
1371
1371
  e("div", fn, [
1372
1372
  t[9] || (t[9] = e("span", { class: "fm-typo-en-body-lg-600" }, "Current amount:", -1)),
1373
- e("span", null, p(s(_e).toFormatString({ value: U.amount })) + " " + p(m(z, U)), 1)
1373
+ e("span", null, m(s(_e).toFormatString({ value: U.amount })) + " " + m(f(z, U)), 1)
1374
1374
  ]),
1375
1375
  _($, {
1376
1376
  "max-fraction-digits": s($e)(z.sku.unit),
@@ -1386,17 +1386,17 @@ const We = {
1386
1386
  }).value = re,
1387
1387
  class: "mb-3",
1388
1388
  label: "Adjust Amount (Leave 0 to skip)",
1389
- "helper-text": `Max: ${D(U.amount)}`,
1390
- "append-text": m(z, U),
1389
+ "helper-text": `Max: ${B(U.amount)}`,
1390
+ "append-text": f(z, U),
1391
1391
  rules: [
1392
- (re) => re <= D(U.amount) || `Cannot be more than ${D(U.amount)}`,
1392
+ (re) => re <= B(U.amount) || `Cannot be more than ${B(U.amount)}`,
1393
1393
  s(Ue)(-1)
1394
1394
  ]
1395
1395
  }, null, 8, ["max-fraction-digits", "model-value", "onUpdate:modelValue", "helper-text", "append-text", "rules"]),
1396
1396
  e("div", vn, [
1397
1397
  t[10] || (t[10] = e("span", { class: "fm-typo-en-body-lg-600" }, "Amount after amend:", -1)),
1398
1398
  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)),
1399
- ye(" " + p(b(
1399
+ me(" " + m(g(
1400
1400
  U.amount,
1401
1401
  s(_e).fromNumber(
1402
1402
  a({
@@ -1405,7 +1405,7 @@ const We = {
1405
1405
  unit: z.sku.unit
1406
1406
  }).value
1407
1407
  )
1408
- )) + " " + p(m(z, U)), 1)
1408
+ )) + " " + m(f(z, U)), 1)
1409
1409
  ])
1410
1410
  ]),
1411
1411
  _: 2
@@ -1429,13 +1429,13 @@ const We = {
1429
1429
  }, $n = {
1430
1430
  key: 2,
1431
1431
  class: "text-xs text-gray-400"
1432
- }, jn = { key: 3 }, Vn = { key: 4 }, Cn = {
1433
- key: 5,
1432
+ }, jn = { key: 3 }, Vn = { key: 4 }, Cn = { class: "inline-flex items-center gap-0.5 text-fm-color-typo-secondary" }, Bn = {
1433
+ key: 6,
1434
1434
  class: "inline-flex items-center rounded-md bg-yellow-400/10 px-2 text-xs font-medium text-yellow-500 inset-ring inset-ring-yellow-400/20"
1435
1435
  }, Dn = {
1436
1436
  key: 1,
1437
1437
  class: "shrink-0 text-fm-color-typo-secondary"
1438
- }, Bn = /* @__PURE__ */ ve({
1438
+ }, Mn = /* @__PURE__ */ pe({
1439
1439
  __name: "StockRecordCard",
1440
1440
  props: {
1441
1441
  record: {},
@@ -1450,69 +1450,70 @@ const We = {
1450
1450
  if (u.costMechanism === "adjustment")
1451
1451
  return null;
1452
1452
  const a = u.unitCostHistory.filter(
1453
- (b) => b.mechanism === u.costMechanism && b.skuId === u.sku._id
1453
+ (g) => g.mechanism === u.costMechanism && g.skuId === u.sku._id
1454
1454
  );
1455
1455
  if (a.length === 0) return null;
1456
- const D = a.find((b) => {
1457
- const o = b.meta;
1456
+ const B = a.find((g) => {
1457
+ const o = g.meta;
1458
1458
  return (o == null ? void 0 : o.adjustmentId) === C;
1459
1459
  });
1460
- if (D) return D.cost;
1461
- const m = [...a].filter((b) => new Date(b.snapshotAt) <= new Date(l)).sort((b, o) => new Date(o.snapshotAt).getTime() - new Date(b.snapshotAt).getTime());
1462
- return m.length > 0 ? m[0].cost : null;
1460
+ if (B) return B.cost;
1461
+ const f = [...a].filter((g) => new Date(g.snapshotAt) <= new Date(l)).sort((g, o) => new Date(o.snapshotAt).getTime() - new Date(g.snapshotAt).getTime());
1462
+ return f.length > 0 ? f[0].cost : null;
1463
1463
  }
1464
- const y = Y(!1), w = Y(), j = Y(null), d = T(() => j.value === null ? "unset" : y.value ? `${j.value}px` : "0px");
1464
+ const y = Y(!1), w = Y(), V = Y(null), d = T(() => V.value === null ? "unset" : y.value ? `${V.value}px` : "0px");
1465
1465
  qe(() => {
1466
1466
  var C;
1467
- j.value = ((C = w.value) == null ? void 0 : C.scrollHeight) || 0;
1467
+ V.value = ((C = w.value) == null ? void 0 : C.scrollHeight) || 0;
1468
1468
  });
1469
1469
  const r = T(() => {
1470
- var b;
1471
- const C = u.record.adjustments, l = u.sku, a = {}, m = C.flatMap((o) => {
1470
+ var g;
1471
+ const C = u.record.adjustments, l = u.sku, a = {}, f = C.flatMap((o) => {
1472
1472
  var t;
1473
1473
  return ((t = o.skus) == null ? void 0 : t.filter((n) => n.sku._id === l._id)) ?? [];
1474
1474
  }).flatMap((o) => o.amounts);
1475
- for (const o of m) {
1475
+ for (const o of f) {
1476
1476
  const t = o.measurement ? xt(o.measurement.conversion, o.amount) : o.amount;
1477
- a[b = o.type] ?? (a[b] = { amount: 0, precision: 0 }), a[o.type] = Qe(t, a[o.type]);
1477
+ a[g = o.type] ?? (a[g] = { amount: 0, precision: 0 }), a[o.type] = Qe(t, a[o.type]);
1478
1478
  }
1479
1479
  return Object.entries(a).reduce(
1480
1480
  (o, [t, n]) => (o[t] = /// comment, because without it formatter makes code uglier
1481
- `${oe.toFormatString({
1481
+ `${ne.toFormatString({
1482
1482
  value: n,
1483
1483
  precision: 4
1484
1484
  })} ${l.unit.abbrev}`, o),
1485
1485
  {}
1486
1486
  );
1487
- }), { t: g } = pe(), R = T(() => u.record.adjustmentsByTime.map(({ date: C, adjustments: l }) => ({
1487
+ }), { t: b } = ye(), R = T(() => u.record.adjustmentsByTime.map(({ date: C, adjustments: l }) => ({
1488
1488
  time: to(new Date(C)),
1489
1489
  adjustments: l.flatMap(
1490
1490
  (a) => {
1491
- var D, m;
1492
- return ((m = (D = a.skus) == null ? void 0 : D.map) == null ? void 0 : m.call(D, (b) => {
1491
+ var B, f;
1492
+ return ((f = (B = a.skus) == null ? void 0 : B.map) == null ? void 0 : f.call(B, (g) => {
1493
1493
  var o, t;
1494
1494
  return {
1495
- ...b,
1495
+ ...g,
1496
1496
  ref: a.ref,
1497
1497
  reason: a.reason,
1498
1498
  adjustmentRemark: a.remark,
1499
1499
  backdateFrom: a.effectiveAt != null ? Te(a._id) : null,
1500
1500
  toBalance: (t = (o = a.skus) == null ? void 0 : o[0]) == null ? void 0 : t.toBalance,
1501
1501
  adjustmentId: a._id,
1502
- adjustmentTime: a.effectiveAt ?? Te(a._id)
1502
+ adjustmentTime: a.effectiveAt ?? Te(a._id),
1503
+ createdBy: a.createdBy
1503
1504
  };
1504
1505
  })) ?? [];
1505
1506
  }
1506
1507
  ).flatMap((a) => {
1507
1508
  var t;
1508
- const D = (t = u.bills.find((n) => n._id === a.ref)) == null ? void 0 : t.seqNumber, m = D ? g("inventory.stock.record.bill", [D]) : "", b = a.adjustmentTime ?? (/* @__PURE__ */ new Date()).toISOString(), o = k(a.adjustmentId, b);
1509
+ const B = (t = u.bills.find((n) => n._id === a.ref)) == null ? void 0 : t.seqNumber, f = B ? b("inventory.stock.record.bill", [B]) : "", g = a.adjustmentTime ?? (/* @__PURE__ */ new Date()).toISOString(), o = k(a.adjustmentId, g);
1509
1510
  return (a.amounts || []).filter((n) => n != null).map((n) => {
1510
1511
  var N;
1511
1512
  let $ = n.cost;
1512
1513
  if (o) {
1513
- const O = oe.fromDinero(o), L = n.amount, X = n.measurement ? oe.multiply([L, n.measurement.conversion]) : L;
1514
+ const O = ne.fromDinero(o), L = n.amount, X = n.measurement ? ne.multiply([L, n.measurement.conversion]) : L;
1514
1515
  $ = {
1515
- ...oe.multiply([
1516
+ ...ne.multiply([
1516
1517
  O,
1517
1518
  X
1518
1519
  ]),
@@ -1520,53 +1521,54 @@ const We = {
1520
1521
  };
1521
1522
  }
1522
1523
  let E = "";
1523
- return m ? E = n.remark || "" : E = [a.adjustmentRemark, n.remark].filter((L) => L).join("/"), {
1524
- amount: `${oe.toFormatString({ value: n.amount, precision: 4 })} ${((N = n.measurement) == null ? void 0 : N.abbrev) ?? a.sku.unit.abbrev}`,
1524
+ return f ? E = n.remark || "" : E = [a.adjustmentRemark, n.remark].filter((L) => L).join("/"), {
1525
+ amount: `${ne.toFormatString({ value: n.amount, precision: 4 })} ${((N = n.measurement) == null ? void 0 : N.abbrev) ?? a.sku.unit.abbrev}`,
1525
1526
  backdateFrom: a.backdateFrom,
1526
1527
  name: n.type,
1527
- billRemark: m,
1528
+ billRemark: f,
1528
1529
  remark: E,
1529
1530
  reason: a.reason || "",
1530
1531
  cost: $,
1531
- toBalance: oe.toFormatString({
1532
- value: a.toBalance ?? oe.fromNumber(0),
1532
+ toBalance: ne.toFormatString({
1533
+ value: a.toBalance ?? ne.fromNumber(0),
1533
1534
  precision: 4
1534
1535
  }),
1535
1536
  baseUnit: a.sku.unit.abbrev,
1536
- adjustmentId: a.adjustmentId
1537
+ adjustmentId: a.adjustmentId,
1538
+ createdBy: a.createdBy
1537
1539
  };
1538
1540
  });
1539
1541
  })
1540
1542
  })));
1541
1543
  return (C, l) => {
1542
- const a = B("FmIcon"), D = B("FmTooltip"), m = B("FmCard");
1543
- return V(), ne(m, { variant: "outlined" }, {
1544
+ const a = D("FmIcon"), B = D("FmTooltip"), f = D("FmCard");
1545
+ return j(), te(f, { variant: "outlined" }, {
1544
1546
  default: M(() => [
1545
1547
  e("div", kn, [
1546
1548
  e("div", {
1547
1549
  class: "flex items-center cursor-pointer mb-1",
1548
- onClick: l[0] || (l[0] = (b) => y.value = !y.value)
1550
+ onClick: l[0] || (l[0] = (g) => y.value = !y.value)
1549
1551
  }, [
1550
- e("div", hn, p(C.record.date), 1),
1552
+ e("div", hn, m(C.record.date), 1),
1551
1553
  _(a, {
1552
1554
  name: y.value ? "expand_more" : "expand_less",
1553
1555
  color: "#777777",
1554
1556
  size: "md"
1555
1557
  }, null, 8, ["name"])
1556
1558
  ]),
1557
- (V(!0), q(ue, null, fe(r.value, (b, o) => (V(), q("div", {
1559
+ (j(!0), q(ue, null, ve(r.value, (g, o) => (j(), q("div", {
1558
1560
  key: o,
1559
1561
  class: "flex flex-row py-1",
1560
1562
  style: { "font-size": "0.8rem" }
1561
1563
  }, [
1562
- e("div", bn, p(s(g)(`inventory.inventoryAdjustment.type.${o}`)), 1),
1564
+ e("div", bn, m(s(b)(`inventory.inventoryAdjustment.type.${o}`)), 1),
1563
1565
  e("div", {
1564
1566
  class: He({
1565
- "text-fm-color-typo-error": b.startsWith("-"),
1566
- "text-fm-color-typo-success": !b.startsWith("-"),
1567
+ "text-fm-color-typo-error": g.startsWith("-"),
1568
+ "text-fm-color-typo-success": !g.startsWith("-"),
1567
1569
  "ml-auto": !0
1568
1570
  })
1569
- }, p(b), 3)
1571
+ }, m(g), 3)
1570
1572
  ]))), 128)),
1571
1573
  e("div", {
1572
1574
  ref_key: "detailRef",
@@ -1578,59 +1580,83 @@ const We = {
1578
1580
  transition: "max-height 0.2s ease-out"
1579
1581
  })
1580
1582
  }, [
1581
- R.value.length ? (V(), q("hr", gn)) : se("", !0),
1582
- (V(!0), q(ue, null, fe(R.value, (b) => (V(), q("div", {
1583
- key: b.time,
1583
+ R.value.length ? (j(), q("hr", gn)) : se("", !0),
1584
+ (j(!0), q(ue, null, ve(R.value, (g) => (j(), q("div", {
1585
+ key: g.time,
1584
1586
  class: "flex gap-1 w-full"
1585
1587
  }, [
1586
- e("div", xn, p(b.time), 1),
1588
+ e("div", xn, m(g.time), 1),
1587
1589
  e("div", Sn, [
1588
- (V(!0), q(ue, null, fe(b.adjustments, (o) => (V(), q("div", {
1589
- key: o.name,
1590
- class: "flex gap-1"
1591
- }, [
1592
- e("div", wn, [
1593
- ye(p(s(g)(`inventory.inventoryAdjustment.type.${o.name}`)) + " ", 1),
1594
- o.backdateFrom ? (V(), ne(D, {
1590
+ (j(!0), q(ue, null, ve(g.adjustments, (o) => {
1591
+ var t;
1592
+ return j(), q("div", {
1593
+ key: o.name,
1594
+ class: "flex gap-1"
1595
+ }, [
1596
+ e("div", wn, [
1597
+ me(m(s(b)(`inventory.inventoryAdjustment.type.${o.name}`)) + " ", 1),
1598
+ o.backdateFrom ? (j(), te(B, {
1599
+ key: 0,
1600
+ variant: "plain",
1601
+ placement: "top",
1602
+ "z-index": 50
1603
+ }, {
1604
+ content: M(() => [
1605
+ e("div", An, m(s(b)("inventory.stock.record.backdate", [
1606
+ s(wt)(new Date(o.backdateFrom))
1607
+ ])), 1)
1608
+ ]),
1609
+ default: M(() => [
1610
+ _(a, {
1611
+ name: "info",
1612
+ size: "sm",
1613
+ color: "primary"
1614
+ })
1615
+ ]),
1616
+ _: 2
1617
+ }, 1024)) : se("", !0),
1618
+ o.billRemark ? (j(), q("span", Fn, " # " + m(o.billRemark), 1)) : se("", !0),
1619
+ o.billRemark && o.remark ? (j(), q("span", $n, " (" + m(o.remark) + ") ", 1)) : se("", !0),
1620
+ !o.billRemark && o.reason ? (j(), q("span", jn, " (" + m(o.reason) + ") ", 1)) : se("", !0),
1621
+ !o.billRemark && o.remark ? (j(), q("span", Vn, " # " + m(o.remark), 1)) : se("", !0),
1622
+ (t = o.createdBy) != null && t.name ? (j(), te(B, {
1623
+ key: 5,
1624
+ variant: "plain",
1625
+ placement: "top",
1626
+ "z-index": 50
1627
+ }, {
1628
+ content: M(() => [
1629
+ me(m(s(b)("inventory.stock.record.createdBy", [o.createdBy.name])), 1)
1630
+ ]),
1631
+ default: M(() => [
1632
+ e("span", Cn, [
1633
+ _(a, {
1634
+ name: "person",
1635
+ size: "sm",
1636
+ color: "primary"
1637
+ }),
1638
+ me(" " + m(o.createdBy.name), 1)
1639
+ ])
1640
+ ]),
1641
+ _: 2
1642
+ }, 1024)) : se("", !0),
1643
+ o.name === s(ie).Enum.CLOSING ? (j(), q("span", Bn, " Actual Balance: " + m(o.toBalance) + " " + m(o.baseUnit), 1)) : se("", !0)
1644
+ ]),
1645
+ e("div", {
1646
+ class: He({
1647
+ "text-fm-color-typo-error": o.amount.startsWith("-"),
1648
+ "text-fm-color-typo-success": !o.amount.startsWith("-"),
1649
+ "ml-auto": !0
1650
+ })
1651
+ }, m(o.amount), 3),
1652
+ o.name === s(ie).Enum.WASTAGE ? (j(), te(_n, {
1595
1653
  key: 0,
1596
- variant: "plain",
1597
- placement: "top",
1598
- "z-index": 50
1599
- }, {
1600
- content: M(() => [
1601
- e("div", An, p(s(g)("inventory.stock.record.backdate", [
1602
- s(wt)(new Date(o.backdateFrom))
1603
- ])), 1)
1604
- ]),
1605
- default: M(() => [
1606
- _(a, {
1607
- name: "info",
1608
- size: "sm",
1609
- color: "primary"
1610
- })
1611
- ]),
1612
- _: 2
1613
- }, 1024)) : se("", !0),
1614
- o.billRemark ? (V(), q("span", Fn, " # " + p(o.billRemark), 1)) : se("", !0),
1615
- o.billRemark && o.remark ? (V(), q("span", $n, " (" + p(o.remark) + ") ", 1)) : se("", !0),
1616
- !o.billRemark && o.reason ? (V(), q("span", jn, " (" + p(o.reason) + ") ", 1)) : se("", !0),
1617
- !o.billRemark && o.remark ? (V(), q("span", Vn, " # " + p(o.remark), 1)) : se("", !0),
1618
- o.name === s(ie).Enum.CLOSING ? (V(), q("span", Cn, " Actual Balance: " + p(o.toBalance) + " " + p(o.baseUnit), 1)) : se("", !0)
1619
- ]),
1620
- e("div", {
1621
- class: He({
1622
- "text-fm-color-typo-error": o.amount.startsWith("-"),
1623
- "text-fm-color-typo-success": !o.amount.startsWith("-"),
1624
- "ml-auto": !0
1625
- })
1626
- }, p(o.amount), 3),
1627
- o.name === s(ie).Enum.WASTAGE ? (V(), ne(_n, {
1628
- key: 0,
1629
- adjustmentId: o.adjustmentId,
1630
- onRefreshHistory: l[1] || (l[1] = (t) => C.$emit("refreshHistory"))
1631
- }, null, 8, ["adjustmentId"])) : se("", !0),
1632
- o.cost ? (V(), q("div", Dn, " (" + p(s(Me)(o.cost, !1, o.cost.precision)) + ") ", 1)) : se("", !0)
1633
- ]))), 128))
1654
+ adjustmentId: o.adjustmentId,
1655
+ onRefreshHistory: l[1] || (l[1] = (n) => C.$emit("refreshHistory"))
1656
+ }, null, 8, ["adjustmentId"])) : se("", !0),
1657
+ o.cost ? (j(), q("div", Dn, " (" + m(s(Me)(o.cost, !1, o.cost.precision)) + ") ", 1)) : se("", !0)
1658
+ ]);
1659
+ }), 128))
1634
1660
  ])
1635
1661
  ]))), 128))
1636
1662
  ], 4)
@@ -1641,33 +1667,33 @@ const We = {
1641
1667
  };
1642
1668
  }
1643
1669
  });
1644
- function Mn(A, u) {
1645
- var j;
1670
+ function In(A, u) {
1671
+ var V;
1646
1672
  const k = Object.keys(ie.enum).reduce(
1647
1673
  (d, r) => (d[r] = { amount: 0, precision: 0 }, d),
1648
1674
  {}
1649
1675
  );
1650
1676
  if (!u)
1651
1677
  return Object.entries(k).reduce(
1652
- (d, [r]) => (d[r] = oe.fromNumber(0), d),
1678
+ (d, [r]) => (d[r] = ne.fromNumber(0), d),
1653
1679
  {}
1654
1680
  );
1655
1681
  const w = A.flatMap((d) => {
1656
1682
  var r;
1657
- return ((r = d.skus) == null ? void 0 : r.filter((g) => g.sku._id === u._id)) ?? [];
1683
+ return ((r = d.skus) == null ? void 0 : r.filter((b) => b.sku._id === u._id)) ?? [];
1658
1684
  }).flatMap((d) => d.amounts);
1659
1685
  for (const d of w) {
1660
- const r = d.measurement ? oe.multiply([d.measurement.conversion, d.amount]) : d.amount;
1661
- k[j = d.type] ?? (k[j] = { amount: 0, precision: 0 }), k[d.type] = oe.add([r, k[d.type]]);
1686
+ const r = d.measurement ? ne.multiply([d.measurement.conversion, d.amount]) : d.amount;
1687
+ k[V = d.type] ?? (k[V] = { amount: 0, precision: 0 }), k[d.type] = ne.add([r, k[d.type]]);
1662
1688
  }
1663
1689
  return Object.entries(k).reduce(
1664
- (d, [r, g]) => {
1690
+ (d, [r, b]) => {
1665
1691
  const R = {
1666
- ...g,
1667
- amount: Math.abs(g.amount)
1692
+ ...b,
1693
+ amount: Math.abs(b.amount)
1668
1694
  };
1669
1695
  return d[r] = /// comment, because without it formatter makes code uglier
1670
- `${oe.toFormatString({
1696
+ `${ne.toFormatString({
1671
1697
  value: R,
1672
1698
  precision: 4
1673
1699
  })} ${u.unit.abbrev}`, d;
@@ -1675,47 +1701,47 @@ function Mn(A, u) {
1675
1701
  {}
1676
1702
  );
1677
1703
  }
1678
- function In(A, u) {
1704
+ function Hn(A, u) {
1679
1705
  if (!u)
1680
1706
  return null;
1681
1707
  let k = null;
1682
- const w = A.flatMap((j) => {
1708
+ const w = A.flatMap((V) => {
1683
1709
  var d;
1684
- return ((d = j.skus) == null ? void 0 : d.filter((r) => r.sku._id === u._id)) ?? [];
1685
- }).flatMap((j) => {
1710
+ return ((d = V.skus) == null ? void 0 : d.filter((r) => r.sku._id === u._id)) ?? [];
1711
+ }).flatMap((V) => {
1686
1712
  var d;
1687
- return !j.history || ((d = j.history) == null ? void 0 : d.length) === 0 ? [] : j.history[0];
1713
+ return !V.history || ((d = V.history) == null ? void 0 : d.length) === 0 ? [] : V.history[0];
1688
1714
  });
1689
- for (const j of w) {
1690
- const d = j.amounts;
1715
+ for (const V of w) {
1716
+ const d = V.amounts;
1691
1717
  for (const r of d) {
1692
1718
  if (r.type !== ie.Enum.SALES)
1693
1719
  continue;
1694
- const g = r.measurement ? oe.multiply([r.measurement.conversion, r.amount]) : r.amount;
1695
- k ?? (k = oe.fromNumber(0)), k = oe.add([k, g]);
1720
+ const b = r.measurement ? ne.multiply([r.measurement.conversion, r.amount]) : r.amount;
1721
+ k ?? (k = ne.fromNumber(0)), k = ne.add([k, b]);
1696
1722
  }
1697
1723
  }
1698
- return k != null ? (k.amount = Math.abs(k.amount), `${oe.toFormatString({
1724
+ return k != null ? (k.amount = Math.abs(k.amount), `${ne.toFormatString({
1699
1725
  value: k,
1700
1726
  precision: 4
1701
1727
  })} ${u.unit.abbrev}`) : null;
1702
1728
  }
1703
- const Hn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Tn = { class: "flex-1 line-clamp-2" }, En = { class: "flex flex-col gap-32 w-full h-full" }, Un = { class: "flex items-center relative gap-4" }, Pn = { class: "flex-1" }, Rn = {
1729
+ const Tn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, En = { class: "flex-1 line-clamp-2" }, Un = { class: "flex flex-col gap-32 w-full h-full" }, Pn = { class: "flex items-center relative gap-4" }, Rn = { class: "flex-1" }, Nn = {
1704
1730
  key: 0,
1705
1731
  class: "flex-1 flex flex-col items-center gap-16"
1706
- }, Nn = { class: "fm-typo-en-body-lg-400 translate-x-4" }, On = {
1732
+ }, On = { class: "fm-typo-en-body-lg-400 translate-x-4" }, Ln = {
1707
1733
  key: 1,
1708
1734
  class: "flex flex-col gap-12"
1709
- }, Ln = { class: "pb-16" }, Yn = { class: "fm-typo-cn-body-lg-600" }, zn = {
1735
+ }, Yn = { class: "pb-16" }, zn = { class: "fm-typo-cn-body-lg-600" }, Gn = {
1710
1736
  class: "grid gap-12 fm-typo-en-body-md-400",
1711
1737
  style: { "grid-template-columns": "auto auto auto", "grid-auto-rows": "1fr" }
1712
- }, Gn = { class: "flex flex-col gap-1" }, Wn = { class: "text-fm-color-typo-secondary" }, Kn = { class: "font-bold" }, qn = { class: "flex flex-col gap-1" }, Xn = { class: "text-fm-color-typo-secondary flex" }, Jn = { class: "font-bold" }, Qn = { class: "flex flex-col gap-1" }, Zn = { class: "text-fm-color-typo-secondary" }, es = { class: "font-bold" }, ts = { class: "flex flex-col gap-1" }, os = { class: "text-fm-color-typo-secondary" }, ns = { class: "font-bold" }, ss = { class: "flex flex-col gap-1" }, as = { class: "text-fm-color-typo-secondary" }, rs = { class: "font-bold" }, ls = { class: "flex flex-col gap-1" }, is = { class: "text-fm-color-typo-secondary" }, us = { class: "font-bold" }, cs = { class: "flex flex-col gap-1" }, ds = { class: "text-fm-color-typo-secondary" }, ms = { class: "font-bold" }, fs = { class: "flex flex-col gap-1" }, vs = { class: "text-fm-color-typo-secondary" }, ps = { class: "font-bold" }, ys = { class: "flex flex-col gap-1" }, _s = { class: "text-fm-color-typo-secondary" }, ks = { class: "font-bold" }, hs = {
1738
+ }, Wn = { class: "flex flex-col gap-1" }, Kn = { class: "text-fm-color-typo-secondary" }, qn = { class: "font-bold" }, Xn = { class: "flex flex-col gap-1" }, Jn = { class: "text-fm-color-typo-secondary flex" }, Qn = { class: "font-bold" }, Zn = { class: "flex flex-col gap-1" }, es = { class: "text-fm-color-typo-secondary" }, ts = { class: "font-bold" }, os = { class: "flex flex-col gap-1" }, ns = { class: "text-fm-color-typo-secondary" }, ss = { class: "font-bold" }, as = { class: "flex flex-col gap-1" }, rs = { class: "text-fm-color-typo-secondary" }, ls = { class: "font-bold" }, is = { class: "flex flex-col gap-1" }, us = { class: "text-fm-color-typo-secondary" }, cs = { class: "font-bold" }, ds = { class: "flex flex-col gap-1" }, ms = { class: "text-fm-color-typo-secondary" }, fs = { class: "font-bold" }, vs = { class: "flex flex-col gap-1" }, ps = { class: "text-fm-color-typo-secondary" }, ys = { class: "font-bold" }, _s = { class: "flex flex-col gap-1" }, ks = { class: "text-fm-color-typo-secondary" }, hs = { class: "font-bold" }, bs = {
1713
1739
  key: 0,
1714
1740
  class: "flex flex-col gap-8"
1715
- }, bs = { class: "flex" }, gs = { class: "flex-1 flex flex-col gap-1" }, xs = { class: "flex gap-1 items-center text-fm-color-typo-secondary" }, Ss = { class: "font-bold" }, ws = { class: "flex-1 flex flex-col gap-1" }, As = { class: "flex gap-1 items-center text-fm-color-typo-secondary" }, Fs = { class: "flex flex-col gap-1" }, $s = { class: "font-bold" }, js = {
1741
+ }, gs = { class: "flex" }, xs = { class: "flex-1 flex flex-col gap-1" }, Ss = { class: "flex gap-1 items-center text-fm-color-typo-secondary" }, ws = { class: "font-bold" }, As = { class: "flex-1 flex flex-col gap-1" }, Fs = { class: "flex gap-1 items-center text-fm-color-typo-secondary" }, $s = { class: "flex flex-col gap-1" }, js = { class: "font-bold" }, Vs = {
1716
1742
  key: 2,
1717
1743
  class: "flex-1 flex flex-col items-center gap-8"
1718
- }, Vs = ["src"], Cs = { class: "font-bold text-lg" }, Ds = { class: "text-xs text-neutral-400 text-center" }, Bs = /* @__PURE__ */ ve({
1744
+ }, Cs = ["src"], Bs = { class: "font-bold text-lg" }, Ds = { class: "text-xs text-neutral-400 text-center" }, Ms = /* @__PURE__ */ pe({
1719
1745
  __name: "StockHistory",
1720
1746
  props: {
1721
1747
  sku: {},
@@ -1723,10 +1749,10 @@ const Hn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Tn = {
1723
1749
  },
1724
1750
  emits: ["update:show"],
1725
1751
  setup(A) {
1726
- const u = Xe(), k = Oe(), y = Ae(), w = an(), j = Se(), d = io(), { t: r } = pe(), g = A, R = Y(!1), C = we(), l = Y("adjustment"), a = Y([
1752
+ const u = Xe(), k = Oe(), y = Ae(), w = an(), V = Se(), d = io(), { t: r } = ye(), b = A, R = Y(!1), C = we(), l = Y("adjustment"), a = Y([
1727
1753
  { label: "Adjustment (Default)", value: "adjustment" }
1728
- ]), D = Y([]), m = Y(ao(0));
1729
- async function b() {
1754
+ ]), B = Y([]), f = Y(ao(0));
1755
+ async function g() {
1730
1756
  R.value = !0;
1731
1757
  try {
1732
1758
  await N(), await k.readStockBalance();
@@ -1735,138 +1761,138 @@ const Hn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Tn = {
1735
1761
  title: "Something went wrong",
1736
1762
  message: "Cannot fetch stock history. Please try again.",
1737
1763
  type: "error"
1738
- }), console.log("failed at fetching item adjustment history", g.sku, m, c);
1764
+ }), console.log("failed at fetching item adjustment history", b.sku, f, c);
1739
1765
  } finally {
1740
1766
  R.value = !1;
1741
1767
  }
1742
1768
  }
1743
1769
  qe(() => {
1744
- b();
1745
- }), Fe([() => m.value, () => g.sku], () => {
1746
- b();
1770
+ g();
1771
+ }), Fe([() => f.value, () => b.sku], () => {
1772
+ g();
1747
1773
  });
1748
1774
  const o = Y([]), t = Y([]), n = Y(new Array());
1749
1775
  function $(c, h) {
1750
1776
  return h === "day" ? so(c) : wt(c);
1751
1777
  }
1752
1778
  function E(c, h) {
1753
- const f = c.reduce(
1754
- (v, i) => {
1779
+ const v = c.reduce(
1780
+ (p, i) => {
1755
1781
  const S = i.effectiveAt ?? Te(i._id);
1756
1782
  if (!S)
1757
- return v;
1783
+ return p;
1758
1784
  const P = $(new Date(S), h);
1759
- return v[P] ?? (v[P] = []), v[P].push(i), v;
1785
+ return p[P] ?? (p[P] = []), p[P].push(i), p;
1760
1786
  },
1761
1787
  {}
1762
1788
  );
1763
- return Object.keys(f).map((v) => ({
1764
- date: v,
1765
- adjustments: f[v]
1789
+ return Object.keys(v).map((p) => ({
1790
+ date: p,
1791
+ adjustments: v[p]
1766
1792
  }));
1767
1793
  }
1768
1794
  async function N() {
1769
1795
  let c = await y.readStockAdjustment(
1770
- g.sku._id,
1771
- dt(new Date(m.value.startDate)).toISOString(),
1772
- mt(new Date(m.value.endDate)).toISOString()
1796
+ b.sku._id,
1797
+ dt(new Date(f.value.startDate)).toISOString(),
1798
+ mt(new Date(f.value.endDate)).toISOString()
1773
1799
  );
1774
1800
  o.value = c;
1775
- const h = c.filter(({ ref: f }) => f == null ? void 0 : f.startsWith("bill_")).map(({ ref: f }) => f);
1776
- await O(h), t.value = E(c, "day").map(({ date: f, adjustments: v }) => ({
1777
- date: f,
1778
- adjustments: v,
1779
- adjustmentsByTime: E(v, "minute")
1801
+ const h = c.filter(({ ref: v }) => v == null ? void 0 : v.startsWith("bill_")).map(({ ref: v }) => v);
1802
+ await O(h), t.value = E(c, "day").map(({ date: v, adjustments: p }) => ({
1803
+ date: v,
1804
+ adjustments: p,
1805
+ adjustmentsByTime: E(p, "minute")
1780
1806
  }));
1781
1807
  try {
1782
- const f = await y.readUnitCostHistory(
1783
- g.sku._id,
1784
- dt(new Date(m.value.startDate)).toISOString(),
1785
- mt(new Date(m.value.endDate)).toISOString()
1808
+ const v = await y.readUnitCostHistory(
1809
+ b.sku._id,
1810
+ dt(new Date(f.value.startDate)).toISOString(),
1811
+ mt(new Date(f.value.endDate)).toISOString()
1786
1812
  );
1787
- D.value = f;
1788
- const v = /* @__PURE__ */ new Set();
1789
- f.forEach((S) => {
1790
- v.add(S.mechanism);
1813
+ B.value = v;
1814
+ const p = /* @__PURE__ */ new Set();
1815
+ v.forEach((S) => {
1816
+ p.add(S.mechanism);
1791
1817
  });
1792
1818
  const i = [{ label: "Default", value: "adjustment" }];
1793
- v.has(ge.Enum.weightedAverage) && i.push({
1819
+ p.has(ge.Enum.weightedAverage) && i.push({
1794
1820
  label: "Weighted Average (Beta)",
1795
1821
  value: ge.Enum.weightedAverage
1796
- }), v.has(ge.Enum.netsuite) && i.push({ label: "NetSuite (Beta)", value: ge.Enum.netsuite }), v.has(ge.Enum["netsuite-average"]) && i.push({
1822
+ }), p.has(ge.Enum.netsuite) && i.push({ label: "NetSuite (Beta)", value: ge.Enum.netsuite }), p.has(ge.Enum["netsuite-average"]) && i.push({
1797
1823
  label: "NetSuite Average (Beta)",
1798
1824
  value: ge.Enum["netsuite-average"]
1799
- }), a.value = i, !v.has(l.value) && l.value !== "adjustment" && (l.value = "adjustment");
1800
- } catch (f) {
1801
- console.error("Failed to fetch unit cost history:", f);
1825
+ }), a.value = i, !p.has(l.value) && l.value !== "adjustment" && (l.value = "adjustment");
1826
+ } catch (v) {
1827
+ console.error("Failed to fetch unit cost history:", v);
1802
1828
  }
1803
1829
  }
1804
1830
  async function O(c) {
1805
1831
  c.length && (n.value = await w.findBillsById(c).catch((h) => {
1806
1832
  var i;
1807
1833
  console.error("Error on using latest bill API, retrying using legacy api", h);
1808
- const f = ((i = u.currentBusiness.value) == null ? void 0 : i._id) ?? "", v = j.currentLocation.doc._id;
1809
- return w.findBillsByBusinessId(f, [v], c);
1834
+ const v = ((i = u.currentBusiness.value) == null ? void 0 : i._id) ?? "", p = V.currentLocation.doc._id;
1835
+ return w.findBillsByBusinessId(v, [p], c);
1810
1836
  }));
1811
1837
  }
1812
1838
  const L = T(() => {
1813
- const c = o.value, h = g.sku;
1814
- return Mn(c, h);
1815
- }), X = T(() => {
1816
- const c = o.value, h = g.sku;
1839
+ const c = o.value, h = b.sku;
1817
1840
  return In(c, h);
1841
+ }), X = T(() => {
1842
+ const c = o.value, h = b.sku;
1843
+ return Hn(c, h);
1818
1844
  }), z = T(() => {
1819
- const c = [...o.value].computeFirst((f) => {
1845
+ const c = [...o.value].computeFirst((v) => {
1820
1846
  var i, S;
1821
- const v = (S = (i = f.skus) == null ? void 0 : i.find) == null ? void 0 : S.call(i, (P) => P.sku._id === g.sku._id);
1822
- return v == null ? void 0 : v.fromBalance;
1847
+ const p = (S = (i = v.skus) == null ? void 0 : i.find) == null ? void 0 : S.call(i, (P) => P.sku._id === b.sku._id);
1848
+ return p == null ? void 0 : p.fromBalance;
1823
1849
  }) ?? {
1824
1850
  amount: 0,
1825
1851
  precision: 0
1826
- }, h = g.sku;
1827
- return h ? `${oe.toFormatString({
1852
+ }, h = b.sku;
1853
+ return h ? `${ne.toFormatString({
1828
1854
  value: c,
1829
1855
  precision: 4
1830
1856
  })} ${h.unit.abbrev}` : "";
1831
1857
  }), K = T(() => {
1832
- const c = [...o.value].reverse().computeFirst((f) => {
1858
+ const c = [...o.value].reverse().computeFirst((v) => {
1833
1859
  var i, S;
1834
- const v = (S = (i = f.skus) == null ? void 0 : i.find) == null ? void 0 : S.call(i, (P) => P.sku._id === g.sku._id);
1835
- return v == null ? void 0 : v.toBalance;
1860
+ const p = (S = (i = v.skus) == null ? void 0 : i.find) == null ? void 0 : S.call(i, (P) => P.sku._id === b.sku._id);
1861
+ return p == null ? void 0 : p.toBalance;
1836
1862
  }) ?? {
1837
1863
  amount: 0,
1838
1864
  precision: 0
1839
- }, h = g.sku;
1840
- return h ? `${oe.toFormatString({ value: c, precision: 4 })} ${h.unit.abbrev}` : "";
1865
+ }, h = b.sku;
1866
+ return h ? `${ne.toFormatString({ value: c, precision: 4 })} ${h.unit.abbrev}` : "";
1841
1867
  }), U = T(() => {
1842
- var f;
1843
- const h = o.value.flatMap((v) => {
1868
+ var v;
1869
+ const h = o.value.flatMap((p) => {
1844
1870
  var i;
1845
- return ((i = v.skus) == null ? void 0 : i.flatMap((S) => S.amounts)) ?? [];
1846
- }).filter((v) => v.amount.amount < 0).reduce(
1847
- (v, i) => {
1871
+ return ((i = p.skus) == null ? void 0 : i.flatMap((S) => S.amounts)) ?? [];
1872
+ }).filter((p) => p.amount.amount < 0).reduce(
1873
+ (p, i) => {
1848
1874
  const S = i.cost;
1849
- if (!S) return v;
1875
+ if (!S) return p;
1850
1876
  const P = {
1851
- ...Wt(v, Math.max(v.precision, S.precision)),
1877
+ ...Wt(p, Math.max(p.precision, S.precision)),
1852
1878
  currency: S.currency
1853
1879
  };
1854
1880
  return {
1855
1881
  ...Qe(P, S),
1856
- currency: v.currency
1882
+ currency: p.currency
1857
1883
  };
1858
1884
  },
1859
1885
  {
1860
1886
  amount: 0,
1861
1887
  precision: 0,
1862
- currency: Ce((f = u.currentCountry) == null ? void 0 : f.value)
1888
+ currency: Ce((v = u.currentCountry) == null ? void 0 : v.value)
1863
1889
  }
1864
1890
  );
1865
1891
  return Me(h, !1, h.precision);
1866
1892
  });
1867
1893
  function Z() {
1868
- const { startDate: c, endDate: h } = oo(m.value);
1869
- c !== null && h !== null && (m.value = {
1894
+ const { startDate: c, endDate: h } = oo(f.value);
1895
+ c !== null && h !== null && (f.value = {
1870
1896
  startDate: c,
1871
1897
  endDate: h
1872
1898
  });
@@ -1875,35 +1901,35 @@ const Hn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Tn = {
1875
1901
  function x(c, h) {
1876
1902
  if (l.value === "adjustment")
1877
1903
  return null;
1878
- const f = D.value.filter(
1879
- (S) => S.mechanism === l.value && S.skuId === g.sku._id
1904
+ const v = B.value.filter(
1905
+ (S) => S.mechanism === l.value && S.skuId === b.sku._id
1880
1906
  );
1881
- if (f.length === 0) return null;
1882
- const v = f.find((S) => {
1907
+ if (v.length === 0) return null;
1908
+ const p = v.find((S) => {
1883
1909
  const P = S.meta;
1884
1910
  return (P == null ? void 0 : P.adjustmentId) === c;
1885
1911
  });
1886
- if (v) return v.cost;
1887
- const i = [...f].filter((S) => new Date(S.snapshotAt) <= new Date(h)).sort((S, P) => new Date(P.snapshotAt).getTime() - new Date(S.snapshotAt).getTime());
1912
+ if (p) return p.cost;
1913
+ const i = [...v].filter((S) => new Date(S.snapshotAt) <= new Date(h)).sort((S, P) => new Date(P.snapshotAt).getTime() - new Date(S.snapshotAt).getTime());
1888
1914
  return i.length > 0 ? i[0].cost : null;
1889
1915
  }
1890
1916
  const F = T(() => {
1891
- var v, i, S, P, ee, ae;
1917
+ var p, i, S, P, ee, ae;
1892
1918
  const c = [...o.value].reverse().find((Q) => {
1893
- var W, te;
1894
- return (te = (W = Q.skus) == null ? void 0 : W.find) == null ? void 0 : te.call(W, (le) => le.sku._id === g.sku._id);
1919
+ var W, oe;
1920
+ return (oe = (W = Q.skus) == null ? void 0 : W.find) == null ? void 0 : oe.call(W, (le) => le.sku._id === b.sku._id);
1895
1921
  });
1896
1922
  if (!c) return "No data";
1897
- const h = (v = c.skus) == null ? void 0 : v.find((Q) => Q.sku._id === g.sku._id);
1923
+ const h = (p = c.skus) == null ? void 0 : p.find((Q) => Q.sku._id === b.sku._id);
1898
1924
  if (!h) return "No data";
1899
- const f = h.toBalance;
1925
+ const v = h.toBalance;
1900
1926
  if (l.value === "adjustment") {
1901
1927
  const Q = [...h.amounts].reverse()[0], W = {
1902
1928
  amount: ((i = Q.cost) == null ? void 0 : i.amount) ?? 0,
1903
1929
  precision: ((S = Q.cost) == null ? void 0 : S.precision) ?? 0
1904
- }, te = Q.amount, le = te.amount == 0 ? oe.fromNumber(0) : oe.divide([W, te]);
1930
+ }, oe = Q.amount, le = oe.amount == 0 ? ne.fromNumber(0) : ne.divide([W, oe]);
1905
1931
  return {
1906
- ...oe.multiply([le, f]),
1932
+ ...ne.multiply([le, v]),
1907
1933
  currency: ((P = Q.cost) == null ? void 0 : P.currency) || Ce(((ee = u.currentCountry) == null ? void 0 : ee.value) ?? lt)
1908
1934
  };
1909
1935
  } else {
@@ -1912,75 +1938,75 @@ const Hn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Tn = {
1912
1938
  Q ?? (/* @__PURE__ */ new Date()).toISOString()
1913
1939
  );
1914
1940
  if (!W) return "No data";
1915
- const te = oe.fromDinero(W);
1941
+ const oe = ne.fromDinero(W);
1916
1942
  return {
1917
- ...oe.multiply([te, f]),
1943
+ ...ne.multiply([oe, v]),
1918
1944
  currency: W.currency || Ce(((ae = u.currentCountry) == null ? void 0 : ae.value) ?? lt)
1919
1945
  };
1920
1946
  }
1921
1947
  }), G = T(() => {
1922
- var f;
1923
- const c = [...o.value].reverse().computeFirst((v) => {
1948
+ var v;
1949
+ const c = [...o.value].reverse().computeFirst((p) => {
1924
1950
  var S, P;
1925
- const i = (P = (S = v.skus) == null ? void 0 : S.find) == null ? void 0 : P.call(S, (ee) => ee.sku._id === g.sku._id);
1951
+ const i = (P = (S = p.skus) == null ? void 0 : S.find) == null ? void 0 : P.call(S, (ee) => ee.sku._id === b.sku._id);
1926
1952
  return i == null ? void 0 : i.toCostBalances;
1927
1953
  });
1928
1954
  return c ? {
1929
- ...c.reduce((v, i) => oe.add([v, oe.fromDinero(i.cost)]), {
1955
+ ...c.reduce((p, i) => ne.add([p, ne.fromDinero(i.cost)]), {
1930
1956
  amount: 0,
1931
1957
  precision: 0
1932
1958
  }),
1933
- currency: Ce((f = u.currentCountry) == null ? void 0 : f.value)
1959
+ currency: Ce((v = u.currentCountry) == null ? void 0 : v.value)
1934
1960
  } : "No data";
1935
- }), H = T(() => g.sku.valuation === it.Enum.FIFO ? G.value : F.value);
1961
+ }), H = T(() => b.sku.valuation === it.Enum.FIFO ? G.value : F.value);
1936
1962
  function J() {
1937
- const { startDate: c, endDate: h } = no(m.value);
1938
- c !== null && h !== null && (m.value = {
1963
+ const { startDate: c, endDate: h } = no(f.value);
1964
+ c !== null && h !== null && (f.value = {
1939
1965
  startDate: c,
1940
1966
  endDate: h
1941
1967
  });
1942
1968
  }
1943
- const I = Ye(g, "show");
1969
+ const I = Ye(b, "show");
1944
1970
  return (c, h) => {
1945
- const f = B("FmButton"), v = B("FmField"), i = B("FmDateRangePicker"), S = B("FmSpacer"), P = B("FmCircularProgress"), ee = B("FmIcon"), ae = B("FmTooltip"), Q = B("FmMenuDivider"), W = B("FmChip"), te = B("FmSelect"), le = B("FmCardSection"), ce = B("FmCard"), je = B("FmSideSheet");
1946
- return V(), ne(je, {
1971
+ const v = D("FmButton"), p = D("FmField"), i = D("FmDateRangePicker"), S = D("FmSpacer"), P = D("FmCircularProgress"), ee = D("FmIcon"), ae = D("FmTooltip"), Q = D("FmMenuDivider"), W = D("FmChip"), oe = D("FmSelect"), le = D("FmCardSection"), ce = D("FmCard"), je = D("FmSideSheet");
1972
+ return j(), te(je, {
1947
1973
  "dismiss-away": "",
1948
1974
  modelValue: s(I),
1949
- "onUpdate:modelValue": h[5] || (h[5] = (me) => Pe(I) ? I.value = me : null),
1975
+ "onUpdate:modelValue": h[5] || (h[5] = (fe) => Pe(I) ? I.value = fe : null),
1950
1976
  "close-button": !1,
1951
1977
  "max-width": 560
1952
1978
  }, {
1953
1979
  "side-sheet-header": M(() => [
1954
- e("div", Hn, [
1955
- e("div", Tn, p(s(r)("inventory.stock.history.title", [c.sku.name])), 1),
1956
- _(f, {
1980
+ e("div", Tn, [
1981
+ e("div", En, m(s(r)("inventory.stock.history.title", [c.sku.name])), 1),
1982
+ _(v, {
1957
1983
  variant: "tertiary",
1958
1984
  "prepend-icon": "close",
1959
- onClick: h[0] || (h[0] = (me) => I.value = !1)
1985
+ onClick: h[0] || (h[0] = (fe) => I.value = !1)
1960
1986
  })
1961
1987
  ])
1962
1988
  ]),
1963
1989
  default: M(() => {
1964
- var me;
1990
+ var fe;
1965
1991
  return [
1966
- e("div", En, [
1967
- e("div", Un, [
1968
- e("div", Pn, [
1992
+ e("div", Un, [
1993
+ e("div", Pn, [
1994
+ e("div", Rn, [
1969
1995
  _(i, {
1970
- modelValue: m.value,
1971
- "onUpdate:modelValue": h[1] || (h[1] = (de) => m.value = de),
1996
+ modelValue: f.value,
1997
+ "onUpdate:modelValue": h[1] || (h[1] = (de) => f.value = de),
1972
1998
  "show-predefined-range": "",
1973
1999
  "start-label": "",
1974
2000
  "end-label": "",
1975
2001
  "z-index": 50
1976
2002
  }, {
1977
2003
  "trigger-button": M(({ opened: de }) => [
1978
- _(v, {
2004
+ _(p, {
1979
2005
  "prepend-icon": "calendar_month",
1980
2006
  focused: de
1981
2007
  }, {
1982
2008
  default: M(() => [
1983
- ye(p(m.value.startDate) + " - " + p(m.value.endDate), 1)
2009
+ me(m(f.value.startDate) + " - " + m(f.value.endDate), 1)
1984
2010
  ]),
1985
2011
  _: 2
1986
2012
  }, 1032, ["focused"])
@@ -1988,40 +2014,40 @@ const Hn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Tn = {
1988
2014
  _: 1
1989
2015
  }, 8, ["modelValue"])
1990
2016
  ]),
1991
- _(f, {
2017
+ _(v, {
1992
2018
  variant: "tertiary",
1993
2019
  onClick: h[2] || (h[2] = (de) => Z()),
1994
2020
  "prepend-icon": "navigate_before"
1995
2021
  }),
1996
- _(f, {
2022
+ _(v, {
1997
2023
  variant: "tertiary",
1998
2024
  onClick: h[3] || (h[3] = (de) => J()),
1999
2025
  "prepend-icon": "navigate_next"
2000
2026
  })
2001
2027
  ]),
2002
- R.value ? (V(), q("div", Rn, [
2028
+ R.value ? (j(), q("div", Nn, [
2003
2029
  _(S),
2004
2030
  _(P, { size: "xl" }),
2005
- e("div", Nn, p(s(r)("inventory.stock.history.loading")), 1),
2031
+ e("div", On, m(s(r)("inventory.stock.history.loading")), 1),
2006
2032
  _(S),
2007
2033
  _(S)
2008
- ])) : t.value && ((me = t.value) == null ? void 0 : me.length) > 0 ? (V(), q("div", On, [
2034
+ ])) : t.value && ((fe = t.value) == null ? void 0 : fe.length) > 0 ? (j(), q("div", Ln, [
2009
2035
  _(ce, { variant: "outlined" }, {
2010
2036
  default: M(() => [
2011
2037
  _(le, { class: "flex flex-col gap-4" }, {
2012
2038
  default: M(() => [
2013
- e("div", Ln, [
2014
- e("div", Yn, p(s(r)("inventory.stock.history.summary.title")), 1)
2039
+ e("div", Yn, [
2040
+ e("div", zn, m(s(r)("inventory.stock.history.summary.title")), 1)
2015
2041
  ]),
2016
- e("div", zn, [
2017
- e("div", Gn, [
2018
- e("div", Wn, p(s(r)("inventory.stock.history.summary.totalPurchase")), 1),
2019
- e("div", Kn, p(L.value.PURCHASE), 1)
2042
+ e("div", Gn, [
2043
+ e("div", Wn, [
2044
+ e("div", Kn, m(s(r)("inventory.stock.history.summary.totalPurchase")), 1),
2045
+ e("div", qn, m(L.value.PURCHASE), 1)
2020
2046
  ]),
2021
- e("div", qn, [
2022
- e("div", Xn, [
2023
- ye(p(s(r)("inventory.stock.history.summary.totalSales")) + "  ", 1),
2024
- X.value != null ? (V(), ne(ae, {
2047
+ e("div", Xn, [
2048
+ e("div", Jn, [
2049
+ me(m(s(r)("inventory.stock.history.summary.totalSales")) + "  ", 1),
2050
+ X.value != null ? (j(), te(ae, {
2025
2051
  key: 0,
2026
2052
  variant: "plain",
2027
2053
  placement: "top",
@@ -2037,45 +2063,45 @@ const Hn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Tn = {
2037
2063
  _: 1
2038
2064
  }, 8, ["content"])) : se("", !0)
2039
2065
  ]),
2040
- e("div", Jn, p(L.value.SALES), 1)
2066
+ e("div", Qn, m(L.value.SALES), 1)
2041
2067
  ]),
2042
- e("div", Qn, [
2043
- e("div", Zn, p(s(r)("inventory.stock.history.summary.totalLose")), 1),
2044
- e("div", es, p(L.value.LOSE), 1)
2068
+ e("div", Zn, [
2069
+ e("div", es, m(s(r)("inventory.stock.history.summary.totalLose")), 1),
2070
+ e("div", ts, m(L.value.LOSE), 1)
2045
2071
  ]),
2046
- e("div", ts, [
2047
- e("div", os, p(s(r)("inventory.stock.history.summary.totalRequest")), 1),
2048
- e("div", ns, p(L.value.REQUEST), 1)
2072
+ e("div", os, [
2073
+ e("div", ns, m(s(r)("inventory.stock.history.summary.totalRequest")), 1),
2074
+ e("div", ss, m(L.value.REQUEST), 1)
2049
2075
  ]),
2050
- e("div", ss, [
2051
- e("div", as, p(s(r)("inventory.stock.history.summary.totalReceive")), 1),
2052
- e("div", rs, p(L.value.RECEIVE), 1)
2076
+ e("div", as, [
2077
+ e("div", rs, m(s(r)("inventory.stock.history.summary.totalReceive")), 1),
2078
+ e("div", ls, m(L.value.RECEIVE), 1)
2053
2079
  ]),
2054
- e("div", ls, [
2055
- e("div", is, p(s(r)("inventory.stock.history.summary.totalConvert")), 1),
2056
- e("div", us, p(L.value.CONVERT), 1)
2080
+ e("div", is, [
2081
+ e("div", us, m(s(r)("inventory.stock.history.summary.totalConvert")), 1),
2082
+ e("div", cs, m(L.value.CONVERT), 1)
2057
2083
  ]),
2058
- e("div", cs, [
2059
- e("div", ds, p(s(r)("inventory.stock.history.summary.totalDamage")), 1),
2060
- e("div", ms, p(L.value.DAMAGE), 1)
2084
+ e("div", ds, [
2085
+ e("div", ms, m(s(r)("inventory.stock.history.summary.totalDamage")), 1),
2086
+ e("div", fs, m(L.value.DAMAGE), 1)
2061
2087
  ]),
2062
- e("div", fs, [
2063
- e("div", vs, p(s(r)("inventory.stock.history.summary.openingBalance")), 1),
2064
- e("div", ps, p(z.value), 1)
2088
+ e("div", vs, [
2089
+ e("div", ps, m(s(r)("inventory.stock.history.summary.openingBalance")), 1),
2090
+ e("div", ys, m(z.value), 1)
2065
2091
  ]),
2066
- e("div", ys, [
2067
- e("div", _s, p(s(r)("inventory.stock.history.summary.lastStockBalance")), 1),
2068
- e("div", ks, p(K.value), 1)
2092
+ e("div", _s, [
2093
+ e("div", ks, m(s(r)("inventory.stock.history.summary.lastStockBalance")), 1),
2094
+ e("div", hs, m(K.value), 1)
2069
2095
  ])
2070
2096
  ]),
2071
- s(d).enableTotalCost ? (V(), q("div", hs, [
2097
+ s(d).enableTotalCost ? (j(), q("div", bs, [
2072
2098
  _(Q, { class: "w-full" }),
2073
- e("div", bs, [
2074
- e("div", gs, [
2099
+ e("div", gs, [
2100
+ e("div", xs, [
2075
2101
  _(ut, { "z-index": 50 }, {
2076
2102
  default: M(() => [
2077
- e("div", xs, [
2078
- ye(p(s(r)("inventory.stock.history.estimatedValue")) + " ", 1),
2103
+ e("div", Ss, [
2104
+ me(m(s(r)("inventory.stock.history.estimatedValue")) + " ", 1),
2079
2105
  _(ae, {
2080
2106
  variant: "plain",
2081
2107
  placement: "top",
@@ -2094,26 +2120,26 @@ const Hn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Tn = {
2094
2120
  ]),
2095
2121
  _: 1
2096
2122
  }),
2097
- e("div", Ss, [
2098
- c.sku.valuation === s(it).Enum.FIFO ? (V(), q(ue, { key: 0 }, [
2123
+ e("div", ws, [
2124
+ c.sku.valuation === s(it).Enum.FIFO ? (j(), q(ue, { key: 0 }, [
2099
2125
  _(W, {
2100
2126
  label: "FIFO",
2101
2127
  compact: ""
2102
2128
  }),
2103
- ye(" " + p(typeof H.value != "string" ? s(Me)(
2129
+ me(" " + m(typeof H.value != "string" ? s(Me)(
2104
2130
  H.value,
2105
2131
  !1,
2106
2132
  H.value.precision
2107
2133
  ) : H.value), 1)
2108
- ], 64)) : (V(), q(ue, { key: 1 }, [
2109
- ye(p(typeof H.value != "string" ? s(Me)(
2134
+ ], 64)) : (j(), q(ue, { key: 1 }, [
2135
+ me(m(typeof H.value != "string" ? s(Me)(
2110
2136
  H.value,
2111
2137
  !1,
2112
2138
  H.value.precision
2113
2139
  ) : H.value), 1)
2114
2140
  ], 64))
2115
2141
  ]),
2116
- _(te, {
2142
+ _(oe, {
2117
2143
  modelValue: l.value,
2118
2144
  "onUpdate:modelValue": h[4] || (h[4] = (de) => l.value = de),
2119
2145
  items: a.value,
@@ -2122,18 +2148,18 @@ const Hn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Tn = {
2122
2148
  style: { width: "200px" }
2123
2149
  }, null, 8, ["modelValue", "items"])
2124
2150
  ]),
2125
- e("div", ws, [
2151
+ e("div", As, [
2126
2152
  _(ut, { "z-index": 50 }, {
2127
2153
  default: M(() => [
2128
- e("div", As, [
2129
- ye(p(s(r)("inventory.stock.history.costSold")) + " ", 1),
2154
+ e("div", Fs, [
2155
+ me(m(s(r)("inventory.stock.history.costSold")) + " ", 1),
2130
2156
  _(ae, {
2131
2157
  variant: "plain",
2132
2158
  placement: "top",
2133
2159
  "z-index": 50
2134
2160
  }, {
2135
2161
  content: M(() => [
2136
- e("div", Fs, p(s(r)("inventory.stock.history.costSoldTooltip")), 1)
2162
+ e("div", $s, m(s(r)("inventory.stock.history.costSoldTooltip")), 1)
2137
2163
  ]),
2138
2164
  default: M(() => [
2139
2165
  _(ee, {
@@ -2147,7 +2173,7 @@ const Hn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Tn = {
2147
2173
  ]),
2148
2174
  _: 1
2149
2175
  }),
2150
- e("div", $s, p(U.value), 1)
2176
+ e("div", js, m(U.value), 1)
2151
2177
  ])
2152
2178
  ])
2153
2179
  ])) : se("", !0)
@@ -2158,29 +2184,29 @@ const Hn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Tn = {
2158
2184
  _: 1
2159
2185
  }),
2160
2186
  h[6] || (h[6] = e("div", null, null, -1)),
2161
- (V(!0), q(ue, null, fe(t.value, (de) => (V(), q(ue, {
2187
+ (j(!0), q(ue, null, ve(t.value, (de) => (j(), q(ue, {
2162
2188
  key: de.date
2163
2189
  }, [
2164
- c.sku ? (V(), ne(Bn, {
2190
+ c.sku ? (j(), te(Mn, {
2165
2191
  key: 0,
2166
2192
  record: de,
2167
2193
  sku: c.sku,
2168
2194
  bills: n.value,
2169
- "unit-cost-history": D.value,
2195
+ "unit-cost-history": B.value,
2170
2196
  "cost-mechanism": l.value,
2171
- onRefreshHistory: b
2197
+ onRefreshHistory: g
2172
2198
  }, null, 8, ["record", "sku", "bills", "unit-cost-history", "cost-mechanism"])) : se("", !0)
2173
2199
  ], 64))), 128))
2174
- ])) : (V(), q("div", js, [
2200
+ ])) : (j(), q("div", Vs, [
2175
2201
  _(S),
2176
2202
  e("div", null, [
2177
2203
  e("img", {
2178
2204
  src: s(lo),
2179
2205
  alt: "List is empty"
2180
- }, null, 8, Vs)
2206
+ }, null, 8, Cs)
2181
2207
  ]),
2182
- e("div", Cs, p(s(r)("inventory.stock.history.noRecords")), 1),
2183
- e("div", Ds, p(s(r)("inventory.stock.history.changeDateRange")), 1),
2208
+ e("div", Bs, m(s(r)("inventory.stock.history.noRecords")), 1),
2209
+ e("div", Ds, m(s(r)("inventory.stock.history.changeDateRange")), 1),
2184
2210
  _(S),
2185
2211
  _(S)
2186
2212
  ]))
@@ -2191,7 +2217,7 @@ const Hn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Tn = {
2191
2217
  }, 8, ["modelValue"]);
2192
2218
  };
2193
2219
  }
2194
- }), Ms = /* @__PURE__ */ ve({
2220
+ }), Is = /* @__PURE__ */ pe({
2195
2221
  __name: "HrmPermissionGuard",
2196
2222
  props: {
2197
2223
  permission: { default: void 0 },
@@ -2206,34 +2232,34 @@ const Hn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Tn = {
2206
2232
  Vt(() => {
2207
2233
  });
2208
2234
  const { hasPermission: y } = At(k, () => u.mode);
2209
- return (w, j) => s(y) ? st(w.$slots, "default", { key: 0 }) : st(w.$slots, "fallback", { key: 1 });
2235
+ return (w, V) => s(y) ? st(w.$slots, "default", { key: 0 }) : st(w.$slots, "fallback", { key: 1 });
2210
2236
  }
2211
2237
  });
2212
- function Is(A) {
2213
- const u = Ut(), k = Se(), y = Y(!1), w = Y(null), j = Y(null);
2214
- let d = null, r = !1, g = !1;
2238
+ function Hs(A) {
2239
+ const u = Ut(), k = Se(), y = Y(!1), w = Y(null), V = Y(null);
2240
+ let d = null, r = !1, b = !1;
2215
2241
  function R() {
2216
- if (g) return;
2242
+ if (b) return;
2217
2243
  const a = k.currentLocationDBName;
2218
2244
  if (!a) return;
2219
- g = !0;
2220
- const D = {
2245
+ b = !0;
2246
+ const B = {
2221
2247
  type: "refresh-balance",
2222
2248
  params: { locationId: a }
2223
- }, { unsubscribe: m, initialState: b } = u.subscribe(
2224
- D,
2249
+ }, { unsubscribe: f, initialState: g } = u.subscribe(
2250
+ B,
2225
2251
  C
2226
2252
  );
2227
- d = m, b.then((o) => {
2253
+ d = f, g.then((o) => {
2228
2254
  o != null && o.initialState && C(o.initialState);
2229
2255
  }).catch((o) => {
2230
2256
  console.error("Failed to fetch refresh-balance initial state", o);
2231
2257
  });
2232
2258
  }
2233
2259
  async function C(a) {
2234
- var D, m, b;
2235
- if (!(!g || !a)) {
2236
- if (w.value = a, a.completedAt && (j.value = a.completedAt), a.message === "processing" || !a.completedAt && !a.message) {
2260
+ var B, f, g;
2261
+ if (!(!b || !a)) {
2262
+ if (w.value = a, a.completedAt && (V.value = a.completedAt), a.message === "processing" || !a.completedAt && !a.message) {
2237
2263
  r = !0, y.value = !0;
2238
2264
  return;
2239
2265
  }
@@ -2247,72 +2273,72 @@ function Is(A) {
2247
2273
  }
2248
2274
  return;
2249
2275
  }
2250
- if (a.message === "error" || (D = a.message) != null && D.startsWith("error:")) {
2276
+ if (a.message === "error" || (B = a.message) != null && B.startsWith("error:")) {
2251
2277
  console.log("Stock balance refresh error:", a.message);
2252
- const o = (m = a.message) != null && m.startsWith("error:") ? a.message.slice(6).trim() : "Failed to refresh stock balance.";
2253
- l(), await ((b = A.onError) == null ? void 0 : b.call(A, o));
2278
+ const o = (f = a.message) != null && f.startsWith("error:") ? a.message.slice(6).trim() : "Failed to refresh stock balance.";
2279
+ l(), await ((g = A.onError) == null ? void 0 : g.call(A, o));
2254
2280
  }
2255
2281
  }
2256
2282
  }
2257
2283
  function l() {
2258
- d && (d(), d = null), g = !1, r = !1, y.value = !1, w.value = null;
2284
+ d && (d(), d = null), b = !1, r = !1, y.value = !1, w.value = null;
2259
2285
  }
2260
2286
  return Ct(() => {
2261
2287
  l();
2262
2288
  }), {
2263
2289
  refreshing: y,
2264
2290
  refreshStatus: w,
2265
- lastCompletedAt: j,
2291
+ lastCompletedAt: V,
2266
2292
  startListening: R,
2267
2293
  stopListening: l
2268
2294
  };
2269
2295
  }
2270
- const Hs = {
2296
+ const Ts = {
2271
2297
  key: 0,
2272
2298
  class: "flex items-center gap-1"
2273
- }, Ts = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Es = { class: "flex flex-col gap-8" }, Us = { class: "flex flex-col" }, Ps = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Rs = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary line-clamp-1" }, _a = /* @__PURE__ */ ve({
2299
+ }, Es = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Us = { class: "flex flex-col gap-8" }, Ps = { class: "flex flex-col" }, Rs = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ns = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary line-clamp-1" }, ka = /* @__PURE__ */ pe({
2274
2300
  __name: "StockView",
2275
2301
  setup(A) {
2276
- const { t: u } = pe(), k = Ne(), y = Se(), w = Oe(), j = Ft(), d = Ae(), r = gt(), g = co(), { columnDefs: R } = ko(), C = Xe(), { hasPermission: l } = At(
2302
+ const { t: u } = ye(), k = Ne(), y = Se(), w = Oe(), V = Ft(), d = Ae(), r = gt(), b = co(), { columnDefs: R } = ko(), C = Xe(), { hasPermission: l } = At(
2277
2303
  T(() => [
2278
2304
  {
2279
- action: De.Action.manage,
2280
- subject: De.Subject.Business.inventory_stockAdjustment
2305
+ action: Be.Action.manage,
2306
+ subject: Be.Subject.Business.inventory_stockAdjustment
2281
2307
  }
2282
2308
  ])
2283
2309
  ), a = T(
2284
2310
  () => {
2285
- var f;
2286
- return l.value || ((f = C.sessionUser.value) == null ? void 0 : f.role.isAdmin);
2311
+ var v;
2312
+ return l.value || ((v = C.sessionUser.value) == null ? void 0 : v.role.isAdmin);
2287
2313
  }
2288
- ), D = Le(), m = we();
2314
+ ), B = Le(), f = we();
2289
2315
  y.watchLocation(X);
2290
- const b = T(
2291
- () => new Set(g.getAvailableItems(g.businessSubsidiaryId))
2292
- ), o = Y(!1), t = Y(!1), { refreshing: n, lastCompletedAt: $, startListening: E, stopListening: N } = Is({
2316
+ const g = T(
2317
+ () => new Set(b.getAvailableItems(b.businessSubsidiaryId))
2318
+ ), o = Y(!1), t = Y(!1), { refreshing: n, lastCompletedAt: $, startListening: E, stopListening: N } = Hs({
2293
2319
  onCompleted: async () => {
2294
- await X(), t.value = !1, m.open({
2320
+ await X(), t.value = !1, f.open({
2295
2321
  title: "Balance refreshed",
2296
2322
  message: "Stock balance has been recalculated.",
2297
2323
  type: "success"
2298
2324
  });
2299
2325
  },
2300
- onError: (f) => {
2301
- t.value = !1, console.log("Error refreshing stock balance", f), m.open({
2326
+ onError: (v) => {
2327
+ t.value = !1, console.log("Error refreshing stock balance", v), f.open({
2302
2328
  title: u("inventory.common.refreshFailed"),
2303
- message: f || u("inventory.stock.stock_balance.refreshBalanceError"),
2329
+ message: v || u("inventory.stock.stock_balance.refreshBalanceError"),
2304
2330
  type: "error"
2305
2331
  });
2306
2332
  }
2307
2333
  }), O = T(() => n.value || t.value);
2308
2334
  async function L() {
2309
2335
  E();
2310
- const f = u("inventory.stock.stock_balance.refreshBalanceDescription"), v = $.value ? `${f}
2336
+ const v = u("inventory.stock.stock_balance.refreshBalanceDescription"), p = $.value ? `${v}
2311
2337
 
2312
- Last refreshed: ${new Date($.value).toLocaleString()}` : f;
2313
- D.open({
2338
+ Last refreshed: ${new Date($.value).toLocaleString()}` : v;
2339
+ B.open({
2314
2340
  title: u("inventory.stock.stock_balance.refreshBalance"),
2315
- message: v,
2341
+ message: p,
2316
2342
  closeButton: !0,
2317
2343
  primaryActions: {
2318
2344
  text: u("common.confirm"),
@@ -2334,7 +2360,7 @@ Last refreshed: ${new Date($.value).toLocaleString()}` : f;
2334
2360
  } catch (i) {
2335
2361
  console.log("Failed to queue refresh balan22ce", typeof i);
2336
2362
  const S = typeof i == "object" ? JSON.stringify(i) : String(i);
2337
- console.log("Error details:", S), t.value = !1, m.open({
2363
+ console.log("Error details:", S), t.value = !1, f.open({
2338
2364
  title: u("inventory.common.refreshFailed"),
2339
2365
  message: (i instanceof Error ? i.message : null) ?? u("inventory.stock.stock_balance.refreshBalanceError"),
2340
2366
  type: "error"
@@ -2350,12 +2376,12 @@ Last refreshed: ${new Date($.value).toLocaleString()}` : f;
2350
2376
  o.value = !0;
2351
2377
  try {
2352
2378
  await w.readStockBalance(), await w.readProductBalance(), await r.readStockEstimateBalance();
2353
- } catch (f) {
2354
- m.open({
2379
+ } catch (v) {
2380
+ f.open({
2355
2381
  title: u("inventory.stock.error.title"),
2356
2382
  message: u("inventory.stock.error.message"),
2357
2383
  type: "error"
2358
- }), console.error("error on fetch stock balance", f);
2384
+ }), console.error("error on fetch stock balance", v);
2359
2385
  } finally {
2360
2386
  o.value = !1;
2361
2387
  }
@@ -2380,19 +2406,19 @@ Last refreshed: ${new Date($.value).toLocaleString()}` : f;
2380
2406
  ]
2381
2407
  }), U = T(() => {
2382
2408
  var i, S, P;
2383
- const f = K.value ? mo.build(K.value) : null, v = [];
2409
+ const v = K.value ? mo.build(K.value) : null, p = [];
2384
2410
  for (const ee of k.skus) {
2385
2411
  let ae = !0;
2386
- if (g.isEnabled && re.value && b.value && ae && (ae = b.value.has(ee._id)), f && ae && (ae = fo(
2412
+ if (b.isEnabled && re.value && g.value && ae && (ae = g.value.has(ee._id)), v && ae && (ae = fo(
2387
2413
  {
2388
2414
  status: ee.isInactive ? "Inactive" : "Active"
2389
2415
  },
2390
- f
2416
+ v
2391
2417
  )), ae) {
2392
2418
  const Q = ee.trackingMeasurement;
2393
2419
  let W = (S = (i = w.stockBalance.skus) == null ? void 0 : i.find(
2394
2420
  (ce) => ce.id === ee._id
2395
- )) == null ? void 0 : S.balance, te = r.inventoryForecast.skus.find(
2421
+ )) == null ? void 0 : S.balance, oe = r.inventoryForecast.skus.find(
2396
2422
  (ce) => ce.id === ee._id
2397
2423
  );
2398
2424
  const le = {
@@ -2401,16 +2427,16 @@ Last refreshed: ${new Date($.value).toLocaleString()}` : f;
2401
2427
  amount: 0,
2402
2428
  precision: 0
2403
2429
  },
2404
- operator: te == null ? void 0 : te.operator,
2405
- day: (te == null ? void 0 : te.depletionDays) ?? void 0,
2430
+ operator: oe == null ? void 0 : oe.operator,
2431
+ day: (oe == null ? void 0 : oe.depletionDays) ?? void 0,
2406
2432
  trackingUnitAbbrev: Q ? ((P = ee.unit.measurements.find((ce) => ce.id === Q)) == null ? void 0 : P.abbrev) ?? "" : ee.unit.abbrev
2407
2433
  };
2408
- v.push(le);
2434
+ p.push(le);
2409
2435
  }
2410
2436
  }
2411
- return v;
2412
- }), Z = Y(""), re = Y(!0), { breakpoints: x } = Lt(), F = T(() => x.value.xs || x.value.sm), G = T(() => F.value ? 10 : 20), H = Bt(), J = T(() => {
2413
- const f = [
2437
+ return p;
2438
+ }), Z = Y(""), re = Y(!0), { breakpoints: x } = Lt(), F = T(() => x.value.xs || x.value.sm), G = T(() => F.value ? 10 : 20), H = Dt(), J = T(() => {
2439
+ const v = [
2414
2440
  {
2415
2441
  label: u("inventory.stock.stock_balance.refreshBalance"),
2416
2442
  value: "refresh-balance",
@@ -2426,16 +2452,16 @@ Last refreshed: ${new Date($.value).toLocaleString()}` : f;
2426
2452
  value: "export"
2427
2453
  }
2428
2454
  ];
2429
- return a.value && f.push({
2455
+ return a.value && v.push({
2430
2456
  label: u("inventory.stock.stock_adjustment.title"),
2431
2457
  value: "stockAdjustment"
2432
- }), f;
2458
+ }), v;
2433
2459
  }), I = Y(!1);
2434
2460
  function c() {
2435
2461
  I.value = !0;
2436
2462
  }
2437
- function h(f) {
2438
- switch (f) {
2463
+ function h(v) {
2464
+ switch (v) {
2439
2465
  case "refresh-balance":
2440
2466
  return L();
2441
2467
  case "refresh":
@@ -2446,9 +2472,9 @@ Last refreshed: ${new Date($.value).toLocaleString()}` : f;
2446
2472
  return c();
2447
2473
  }
2448
2474
  }
2449
- return (f, v) => {
2450
- const i = B("FmSwitch"), S = B("FmTable");
2451
- return V(), ne(Mt, {
2475
+ return (v, p) => {
2476
+ const i = D("FmSwitch"), S = D("FmTable");
2477
+ return j(), te(Mt, {
2452
2478
  title: s(u)("inventory.stock.title"),
2453
2479
  actions: J.value,
2454
2480
  "onClick:action": h
@@ -2469,22 +2495,22 @@ Last refreshed: ${new Date($.value).toLocaleString()}` : f;
2469
2495
  searchable: "",
2470
2496
  "change-location": "",
2471
2497
  search: Z.value,
2472
- "onUpdate:search": v[1] || (v[1] = (W) => Z.value = W),
2498
+ "onUpdate:search": p[1] || (p[1] = (W) => Z.value = W),
2473
2499
  "hide-filter-options": !0,
2474
2500
  filterable: "",
2475
2501
  "filter-attributes": z.value,
2476
2502
  filter: K.value,
2477
- "onUpdate:filter": v[2] || (v[2] = (W) => K.value = W)
2503
+ "onUpdate:filter": p[2] || (p[2] = (W) => K.value = W)
2478
2504
  }, {
2479
2505
  default: M(() => [
2480
- s(g).isEnabled ? (V(), q("div", Hs, [
2481
- e("span", Ts, p(s(u)("inventory.integration.netsuite.subsidiaryHierarchy.filtering")), 1),
2506
+ s(b).isEnabled ? (j(), q("div", Ts, [
2507
+ e("span", Es, m(s(u)("inventory.integration.netsuite.subsidiaryHierarchy.filtering")), 1),
2482
2508
  _(Nt),
2483
2509
  _(Je, null, {
2484
2510
  default: M(() => [
2485
2511
  _(i, {
2486
2512
  modelValue: re.value,
2487
- "onUpdate:modelValue": v[0] || (v[0] = (W) => re.value = W)
2513
+ "onUpdate:modelValue": p[0] || (p[0] = (W) => re.value = W)
2488
2514
  }, null, 8, ["modelValue"])
2489
2515
  ]),
2490
2516
  _: 1
@@ -2493,36 +2519,36 @@ Last refreshed: ${new Date($.value).toLocaleString()}` : f;
2493
2519
  ]),
2494
2520
  _: 1
2495
2521
  }, 8, ["search", "filter-attributes", "filter"]),
2496
- (V(), ne(S, {
2522
+ (j(), te(S, {
2497
2523
  style: kt(s(H).tableHeight),
2498
2524
  "column-defs": s(R),
2499
2525
  "row-data": U.value,
2500
2526
  "search-value": Z.value,
2501
2527
  loading: o.value || s(n) || !s(y)._currentLocation,
2502
2528
  key: (P = s(y)._currentLocation) == null ? void 0 : P.dbName,
2503
- onRowClick: v[3] || (v[3] = (W) => s(j).showSkuHistory(W.original)),
2529
+ onRowClick: p[3] || (p[3] = (W) => s(V).showSkuHistory(W.original)),
2504
2530
  "page-size": G.value
2505
2531
  }, {
2506
2532
  "list-row": M((W) => [
2507
2533
  _(uo, {
2508
2534
  row: W,
2509
- onRowClick: s(j).showSkuHistory
2535
+ onRowClick: s(V).showSkuHistory
2510
2536
  }, {
2511
- default: M((te) => {
2512
- var le, ce, je, me, de, Ze, et, tt, Ve, ot;
2537
+ default: M((oe) => {
2538
+ var le, ce, je, fe, de, Ze, et, tt, Ve, ot;
2513
2539
  return [
2514
- e("div", Es, [
2515
- e("div", Us, [
2516
- e("div", Ps, [
2540
+ e("div", Us, [
2541
+ e("div", Ps, [
2542
+ e("div", Rs, [
2517
2543
  _(s(ft), {
2518
- render: (je = (ce = (le = te.code) == null ? void 0 : le.column) == null ? void 0 : ce.columnDef) == null ? void 0 : je.cell,
2519
- props: (de = (me = te.code) == null ? void 0 : me.getContext) == null ? void 0 : de.call(me)
2544
+ render: (je = (ce = (le = oe.code) == null ? void 0 : le.column) == null ? void 0 : ce.columnDef) == null ? void 0 : je.cell,
2545
+ props: (de = (fe = oe.code) == null ? void 0 : fe.getContext) == null ? void 0 : de.call(fe)
2520
2546
  }, null, 8, ["render", "props"])
2521
2547
  ]),
2522
- e("div", Rs, [
2548
+ e("div", Ns, [
2523
2549
  _(s(ft), {
2524
- render: (tt = (et = (Ze = te.name) == null ? void 0 : Ze.column) == null ? void 0 : et.columnDef) == null ? void 0 : tt.cell,
2525
- props: (ot = (Ve = te.name) == null ? void 0 : Ve.getContext) == null ? void 0 : ot.call(Ve)
2550
+ render: (tt = (et = (Ze = oe.name) == null ? void 0 : Ze.column) == null ? void 0 : et.columnDef) == null ? void 0 : tt.cell,
2551
+ props: (ot = (Ve = oe.name) == null ? void 0 : Ve.getContext) == null ? void 0 : ot.call(Ve)
2526
2552
  }, null, 8, ["render", "props"])
2527
2553
  ])
2528
2554
  ]),
@@ -2549,24 +2575,24 @@ Last refreshed: ${new Date($.value).toLocaleString()}` : f;
2549
2575
  _: 1
2550
2576
  }, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"]))
2551
2577
  ], 2),
2552
- (V(), ne(Dt, { to: "body" }, [
2553
- (ee = s(j).stockHistoryProps) != null && ee.sku ? (V(), ne(Bs, at(ze({ key: 0 }, s(j).stockHistoryProps)), null, 16)) : se("", !0),
2554
- (ae = s(j).convertSkuDialogProps) != null && ae.sku ? (V(), ne(Mo, at(ze({ key: 1 }, s(j).convertSkuDialogProps)), null, 16)) : se("", !0),
2555
- (Q = s(j).adjustSkuDialogProps) != null && Q.stock ? (V(), ne(Go, ze({ key: 2 }, s(j).adjustSkuDialogProps, {
2556
- onSubmitted: v[4] || (v[4] = (W) => X())
2578
+ (j(), te(Bt, { to: "body" }, [
2579
+ (ee = s(V).stockHistoryProps) != null && ee.sku ? (j(), te(Ms, at(ze({ key: 0 }, s(V).stockHistoryProps)), null, 16)) : se("", !0),
2580
+ (ae = s(V).convertSkuDialogProps) != null && ae.sku ? (j(), te(Mo, at(ze({ key: 1 }, s(V).convertSkuDialogProps)), null, 16)) : se("", !0),
2581
+ (Q = s(V).adjustSkuDialogProps) != null && Q.stock ? (j(), te(Go, ze({ key: 2 }, s(V).adjustSkuDialogProps, {
2582
+ onSubmitted: p[4] || (p[4] = (W) => X())
2557
2583
  }), null, 16)) : se("", !0),
2558
- _(Ms, {
2584
+ _(Is, {
2559
2585
  permission: {
2560
- action: s(De).Action.manage,
2561
- subject: s(De).Subject.Business.inventory_stockAdjustment
2586
+ action: s(Be).Action.manage,
2587
+ subject: s(Be).Subject.Business.inventory_stockAdjustment
2562
2588
  }
2563
2589
  }, {
2564
2590
  default: M(() => [
2565
- I.value ? (V(), ne(sn, {
2591
+ I.value ? (j(), te(sn, {
2566
2592
  key: 0,
2567
2593
  show: I.value,
2568
- "onUpdate:show": v[5] || (v[5] = (W) => I.value = W),
2569
- onSubmitted: v[6] || (v[6] = (W) => X())
2594
+ "onUpdate:show": p[5] || (p[5] = (W) => I.value = W),
2595
+ onSubmitted: p[6] || (p[6] = (W) => X())
2570
2596
  }, null, 8, ["show"])) : se("", !0)
2571
2597
  ]),
2572
2598
  _: 1
@@ -2580,5 +2606,5 @@ Last refreshed: ${new Date($.value).toLocaleString()}` : f;
2580
2606
  }
2581
2607
  });
2582
2608
  export {
2583
- _a as default
2609
+ ka as default
2584
2610
  };