@feedmepos/mf-inventory-portal 0.0.23-dev.1 → 0.0.23-dev.10

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 (93) hide show
  1. package/dist/{App-Y3Ez8Rjf.js → App-DDxwfi6I.js} +36 -31
  2. package/dist/{ApprovalView-BUU1G4Q2.js → ApprovalView-7rpIigm0.js} +4 -4
  3. package/dist/{BindingsDialog-8wc4Q0JQ.js → BindingsDialog-DbyzX6mw.js} +2 -2
  4. package/dist/{BindingsPicker-DGWN1LQc.js → BindingsPicker-FZfhZr5O.js} +2 -2
  5. package/dist/{BindingsTable-7NJP2jT6.js → BindingsTable-Bk2770OV.js} +6 -6
  6. package/dist/ClosingDraftView-D9CnCwak.js +772 -0
  7. package/dist/{ClosingTemplateView-9s7vmwaT.js → ClosingTemplateView-DkpHmTtx.js} +32 -31
  8. package/dist/FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-DjBiov5r.js +283 -0
  9. package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-5DINn0ZB.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-CBC214tP.js} +2 -2
  10. package/dist/{FmMultiselectDialog-7hok9sJP.js → FmMultiselectDialog-CK6xwOeG.js} +128 -124
  11. package/dist/FmUnitInput.vue_vue_type_script_setup_true_lang-IFTMUhET.js +329 -0
  12. package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-FQ0HjuL3.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-D0otwOX8.js} +1 -1
  13. package/dist/{IngredientGroupView-C3maHTCg.js → IngredientGroupView-D5XtVfIQ.js} +12 -11
  14. package/dist/IngredientsView-c7WnQiTv.js +1666 -0
  15. package/dist/{IntegrationView-gO4h89Wj.js → IntegrationView-CHkhMxVM.js} +50 -50
  16. package/dist/{InventoryBindingForm-dh3GeyG-.js → InventoryBindingForm-BUZ9MS5V.js} +1 -1
  17. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-CJuo3i7W.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-YIRre_Km.js} +13 -13
  18. package/dist/{InventoryBindingSummary-BPoPcEoe.js → InventoryBindingSummary-BUi0mjeC.js} +1 -1
  19. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-olm8sZKt.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-CpYtHPFH.js} +1 -1
  20. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-BezTV43V.js → PremiumBadge.vue_vue_type_script_setup_true_lang-D8IH1X1o.js} +2 -2
  21. package/dist/{PurchaseOrderPrintPreview-Dix_fIoo.js → PurchaseOrderPrintPreview-BLuoVz5N.js} +1 -1
  22. package/dist/ReceiveRequestView-BNM5JdQO.js +4165 -0
  23. package/dist/{RecipeView-C4-a4IEW.js → RecipeView-DxRumcLY.js} +11 -10
  24. package/dist/{StockView-Du2txrIP.js → StockView-CZyeg3sX.js} +1356 -1457
  25. package/dist/{SupplierView-D_09FbQh.js → SupplierView-C2XLbf27.js} +2352 -783
  26. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-BQG6UzUU.js +1229 -0
  27. package/dist/{TransferTemplateView-j3CRy6Lc.js → TransferTemplateView-BCxZCU0i.js} +307 -307
  28. package/dist/{UnitView-BXw2Vwq1.js → UnitView-uGpE4txg.js} +81 -80
  29. package/dist/{WarehouseView-CKamiETC.js → WarehouseView-DvQVmixr.js} +25 -24
  30. package/dist/api/bill.d.ts +2 -2
  31. package/dist/api/closing-draft.d.ts +6 -0
  32. package/dist/api/closing.d.ts +1 -0
  33. package/dist/api/netsuite.d.ts +70 -0
  34. package/dist/{app-GUbzqEtW.js → app-BaOENyRY.js} +3425 -3343
  35. package/dist/app.d.ts +3 -0
  36. package/dist/app.js +1 -1
  37. package/dist/components/FmMinMaxInputRules.d.ts +4 -1
  38. package/dist/components/row-action.enum.d.ts +1 -0
  39. package/dist/{date2-CLE9fB2R.js → date2-CfGU3sHq.js} +1 -1
  40. package/dist/{dayjs.min-CY1d38w7.js → dayjs.min-BMk-E1IO.js} +17 -17
  41. package/dist/{decimal-SIjO6Mjw.js → decimal-BkLhxOFS.js} +1 -1
  42. package/dist/{defineDeepModel-l40rX7kr.js → defineDeepModel-Cy-_HBnw.js} +1 -1
  43. package/dist/{feature-BXruKUhX.js → feature-GoxrdjJJ.js} +23 -9
  44. package/dist/form-mode.enum-BKiNVH6A.js +4 -0
  45. package/dist/{format-time-from-id-CcFsBXmk.js → format-time-from-id-96hwVl9P.js} +1 -1
  46. package/dist/format-unit-display-Cp0DBbM8.js +1217 -0
  47. package/dist/{fuzzy-CVOV9zJc.js → fuzzy-CBGiL1wK.js} +1 -1
  48. package/dist/index-0HEhOwKT.js +12087 -0
  49. package/dist/{index-BX5KZXhI.js → index-CoL8wxbn.js} +126 -122
  50. package/dist/{index-m9e9nYfl.js → index-S7yfliEo.js} +1 -1
  51. package/dist/netsuite-D3VPLW8O.js +225 -0
  52. package/dist/router/name.d.ts +1 -0
  53. package/dist/{row-action.enum-PMKMRrZR.js → row-action.enum-7rGLGZ5v.js} +10 -5
  54. package/dist/{rules-DlnN8IP3.js → rules-DxLLla7a.js} +40 -35
  55. package/dist/stock-BbFKtx1y.js +111 -0
  56. package/dist/stores/feature.d.ts +2 -0
  57. package/dist/stores/integration/netsuite.d.ts +81 -0
  58. package/dist/stores/inventory.d.ts +1 -4
  59. package/dist/style.css +1 -1
  60. package/dist/{supplier-B21WlSAM.js → supplier-gGovyyjr.js} +22 -22
  61. package/dist/tsconfig.app.tsbuildinfo +1 -1
  62. package/dist/{use-inventory-binding-dialog-D3x6xj2O.js → use-inventory-binding-dialog-DIBMf_9-.js} +2 -2
  63. package/dist/{use-template-enabled-locations-2-z-b-UXef.js → use-template-enabled-locations-2-Bof9JMYI.js} +2 -2
  64. package/dist/views/closing-draft/ClosingDraftView.vue.d.ts +2 -0
  65. package/dist/views/closing-draft/components/closing-draft-action/ClosingDraftAction.vue.d.ts +22 -0
  66. package/dist/views/closing-draft/components/closing-draft-dialog/ClosingDraftDialog.vue.d.ts +447 -0
  67. package/dist/views/closing-draft/composables/use-closing-draft-actions.d.ts +22 -0
  68. package/dist/views/closing-draft/composables/use-closing-draft-table.d.ts +2601 -0
  69. package/dist/views/closing-draft/helpers/draft-status-to-class-name.helper.d.ts +1 -0
  70. package/dist/views/closing-template/composables/use-closing-template-actions.d.ts +24 -192
  71. package/dist/views/closing-template/composables/use-closing-template-table.d.ts +24 -192
  72. package/dist/views/receive-request/components/transfer-form/NetSuiteField.vue.d.ts +2 -2
  73. package/dist/views/receive-request/components/transfer-form/TransferForm.vue.d.ts +40 -40
  74. package/dist/views/receive-request/components/transfer-form/composables/use-transfer-items.d.ts +1 -0
  75. package/dist/views/receive-request/composables/use-receive-request-form.d.ts +63 -63
  76. package/dist/views/receive-request/composables/use-receive-request-table.d.ts +63 -63
  77. package/dist/views/receive-request/helper/check-netsuite-subsidiary.helper.d.ts +1 -0
  78. package/dist/views/stock/components/StockRecordCard.vue.d.ts +1 -1
  79. package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-template-items.d.ts +8 -8
  80. package/dist/views/transfer-template/composables/use-transfer-template-actions.d.ts +96 -96
  81. package/dist/views/transfer-template/composables/use-transfer-template-table.d.ts +96 -96
  82. package/dist/{xlsx-6mM1eNiL.js → xlsx-DOnDmayp.js} +1 -1
  83. package/dist/{xlsx.util-BLftcF4q.js → xlsx.util-BqsQd9YP.js} +1 -1
  84. package/package.json +3 -3
  85. package/dist/FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-B4DDh9-a.js +0 -267
  86. package/dist/FmUnitInput.vue_vue_type_script_setup_true_lang-CxR1FCft.js +0 -326
  87. package/dist/IngredientsView-DCR3IBkR.js +0 -1613
  88. package/dist/ReceiveRequestView-DdPiYb2P.js +0 -4082
  89. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-C9MOos--.js +0 -1144
  90. package/dist/format-unit-display-DEKg8cJm.js +0 -1198
  91. package/dist/index-CVsyOEb1.js +0 -10545
  92. package/dist/netsuite-DAKRv7zr.js +0 -146
  93. package/dist/normalizeArguments-DP7Hrren.js +0 -1552
@@ -1,4 +1,4 @@
1
- import { J as h } from "./app-GUbzqEtW.js";
1
+ import { L as h } from "./app-BaOENyRY.js";
2
2
  var a = { exports: {} };
3
3
  function x(r, s = 100, u = {}) {
4
4
  if (typeof r != "function")
@@ -0,0 +1,225 @@
1
+ import { k as N, h as B, a as L, u as I } from "./app-BaOENyRY.js";
2
+ import { useCoreStore as $ } from "@feedmepos/mf-common";
3
+ import { useSnackbar as T } from "@feedmepos/ui-library";
4
+ import { ref as M, computed as p } from "vue";
5
+ const b = N((f, c) => {
6
+ const g = $(), l = T();
7
+ return c.onError(async (d) => {
8
+ if (d instanceof B)
9
+ throw l == null || l.open({
10
+ title: d.title,
11
+ message: d.message,
12
+ type: "error"
13
+ }), d;
14
+ }), {
15
+ async readSetting() {
16
+ var e;
17
+ const d = ((e = g.currentBusiness.value) == null ? void 0 : e._id) ?? "", m = `${f.netSuiteBackendUrl}/${d}/settings`;
18
+ return await c.get(m);
19
+ },
20
+ async syncTransferOrder(d, m, e) {
21
+ var t;
22
+ const i = ((t = g.currentBusiness.value) == null ? void 0 : t._id) ?? "", n = `${f.netSuiteBackendUrl}/${i}/sync/transfer-order`;
23
+ return await c.post(n, {
24
+ type: d,
25
+ id: m,
26
+ locationId: e
27
+ });
28
+ },
29
+ urls: f
30
+ };
31
+ });
32
+ function h() {
33
+ return {
34
+ setting: {
35
+ _id: "",
36
+ items: [],
37
+ childItems: [],
38
+ units: [],
39
+ locations: [],
40
+ subsidiaries: [],
41
+ vendors: [],
42
+ enable: !1,
43
+ syncedAt: null
44
+ },
45
+ vendorSubsidiary: {},
46
+ isReady: !1
47
+ };
48
+ }
49
+ const a = M(h());
50
+ function A() {
51
+ const f = L(), c = p(() => a.value.setting.items.groupBy("netSuiteId", (e) => e.id)), g = p(() => a.value.setting.units.flatMap((e) => e.measurements).groupBy("netSuiteId", (e) => e.id)), l = p(() => a.value.setting.items.groupBy((e) => e.id)), d = p(
52
+ () => a.value.setting.units.groupBy(
53
+ (e) => e.netSuiteId,
54
+ (e) => f.unitById[e.id]
55
+ )
56
+ ), m = p(
57
+ () => a.value.setting.units.flatMap(
58
+ (e) => e.measurements.map((i) => {
59
+ var n;
60
+ return {
61
+ unit: (n = d.value.get(e.netSuiteId)) == null ? void 0 : n[0],
62
+ measurement: i
63
+ };
64
+ })
65
+ ).groupBy(
66
+ (e) => e.measurement.netSuiteId,
67
+ (e) => {
68
+ var i;
69
+ return (i = e.unit) == null ? void 0 : i.measurements.find((n) => n.id === e.measurement.id);
70
+ }
71
+ )
72
+ );
73
+ return {
74
+ // state
75
+ get isReady() {
76
+ return a.value.isReady;
77
+ },
78
+ get isEnabled() {
79
+ return a.value.setting.enable;
80
+ },
81
+ get isBusinessLocation() {
82
+ return I().businessLevel;
83
+ },
84
+ get state() {
85
+ return a.value;
86
+ },
87
+ get netSuiteItemIdToSkuId() {
88
+ return c.value;
89
+ },
90
+ get netSuiteMeasurementIdToMeasurementId() {
91
+ return g.value;
92
+ },
93
+ get netSuiteItemBySkuId() {
94
+ return l.value;
95
+ },
96
+ get unitByNetsuiteId() {
97
+ return d.value;
98
+ },
99
+ get measurementByNetsuiteId() {
100
+ return m.value;
101
+ },
102
+ getNetSuiteVendor(e) {
103
+ return a.value.setting.vendors.find((i) => i.id === e);
104
+ },
105
+ getNetSuiteLocation(e) {
106
+ const [i, n] = e.split("_");
107
+ return a.value.setting.locations.find((r) => r.id == n && r.type == i);
108
+ },
109
+ getLocationSubsidiary(e) {
110
+ var r;
111
+ if (!e)
112
+ return {
113
+ id: void 0,
114
+ name: "",
115
+ fullName: ""
116
+ };
117
+ const i = ((r = a.value.setting.locations.find((s) => s.netSuiteId === e)) == null ? void 0 : r.subsidiaryId) ?? null, { flat: n } = y(a.value.setting.subsidiaries), t = n.find((s) => s.id === i);
118
+ return {
119
+ id: t == null ? void 0 : t.id,
120
+ name: (t == null ? void 0 : t.name) || "",
121
+ fullName: `${(t == null ? void 0 : t.fullName) ?? ""}`
122
+ };
123
+ },
124
+ currentLocationSubsidiary() {
125
+ var o;
126
+ const e = I(), i = e.currentLocation.doc._id, n = e.currentLocation.type, t = ((o = a.value.setting.locations.find(
127
+ (u) => u.id === i && u.type == n
128
+ )) == null ? void 0 : o.subsidiaryId) ?? null, { flat: r } = y(a.value.setting.subsidiaries), s = r.find((u) => u.id === t);
129
+ return {
130
+ id: s == null ? void 0 : s.id,
131
+ name: (s == null ? void 0 : s.name) || "",
132
+ fullName: `${(s == null ? void 0 : s.fullName) ?? ""}`
133
+ };
134
+ },
135
+ currentVendorSubsidiary(e) {
136
+ var r;
137
+ const i = ((r = a.value.setting.vendors.find((s) => s.id === e)) == null ? void 0 : r.subsidiaryId) ?? null, { flat: n } = y(a.value.setting.subsidiaries), t = n.find((s) => s.id === i);
138
+ return {
139
+ id: t == null ? void 0 : t.id,
140
+ name: (t == null ? void 0 : t.name) || "",
141
+ fullName: `${(t == null ? void 0 : t.fullName) ?? ""}`
142
+ };
143
+ },
144
+ get subsidiaryOptions() {
145
+ const { flat: e } = y(a.value.setting.subsidiaries);
146
+ return e.map((i) => ({
147
+ label: `${"   ".repeat(i.depth)}${i.name}`,
148
+ value: {
149
+ id: i.id,
150
+ name: i.name
151
+ }
152
+ }));
153
+ },
154
+ getAvailableItems(e) {
155
+ const { available: i } = y(a.value.setting.subsidiaries, e);
156
+ return a.value.setting.items.filter((n) => n.subsidiaryIds.some((t) => i.includes(t))).map((n) => n.id);
157
+ },
158
+ getAvailableMeasurements(e, i) {
159
+ const n = a.value.setting.items.find((u) => u.id === e);
160
+ if (!n)
161
+ return [];
162
+ const { available: t, flatMapping: r } = y(
163
+ a.value.setting.subsidiaries,
164
+ i
165
+ ), o = a.value.setting.childItems.filter((u) => {
166
+ let v = u.subsidiaryIds;
167
+ if (u.includeChildren == !0)
168
+ for (const S of u.subsidiaryIds)
169
+ v = v.concat(r[S]);
170
+ return v = [...new Set(v)], u.parentNetSuiteId === n.netSuiteId && v.some((S) => t.includes(S));
171
+ }).flatMap((u) => u.unitTypeId);
172
+ return a.value.setting.units.filter((u) => o.includes(u.netSuiteId)).flatMap((u) => u.measurements).map((u) => u.id);
173
+ },
174
+ async readSetting() {
175
+ console.log("netsuite init");
176
+ const i = await b().readSetting();
177
+ if (i) {
178
+ this.state.setting = i;
179
+ const { flat: n } = y(a.value.setting.subsidiaries);
180
+ for (const t of i.vendors) {
181
+ const r = n.find((s) => s.id === t.subsidiaryId);
182
+ this.state.vendorSubsidiary[t.id] = (r == null ? void 0 : r.fullName) || "";
183
+ }
184
+ }
185
+ this.state.isReady = !0;
186
+ },
187
+ getVendorSubsidiaryName(e) {
188
+ return this.state.vendorSubsidiary[e] || "";
189
+ },
190
+ async syncTransferOrder(e, i) {
191
+ const n = b(), t = I(), r = t.currentLocation.doc._id, s = t.currentLocation.type;
192
+ await n.syncTransferOrder(e, i, `${s}_${r}`);
193
+ }
194
+ };
195
+ }
196
+ function y(f, c) {
197
+ const g = [], l = [];
198
+ function d(n, t, r = !1) {
199
+ return f.filter((o) => o.parentId === t).map((o) => ((r || o.id === c || !c) && g.push(o.id), {
200
+ id: o.id,
201
+ name: o.name,
202
+ country: o.country,
203
+ currency: o.currency,
204
+ parentId: o.parentId,
205
+ depth: n,
206
+ children: d(n + 1, o.id, r || o.id === c)
207
+ }));
208
+ }
209
+ const m = d(0, null), e = {};
210
+ function i(n, t = "") {
211
+ const r = n.fullName || n.name, s = t ? `${t} : ${r}` : r;
212
+ l.push({ ...n, fullName: s }), e[n.id] = [n.id];
213
+ for (const o of n.children)
214
+ i(o, s), e[n.id].push(...e[o.id]);
215
+ }
216
+ return m.forEach((n) => i(n)), {
217
+ tree: m,
218
+ available: g,
219
+ flat: l,
220
+ flatMapping: e
221
+ };
222
+ }
223
+ export {
224
+ A as u
225
+ };
@@ -5,6 +5,7 @@ export declare enum RouteName {
5
5
  UNIT = "UNIT",
6
6
  STOCK = "STOCK",
7
7
  CLOSING_TEMPLATE = "CLOSING_TEMPLATE",
8
+ CLOSING_DRAFT = "CLOSING_DRAFT",
8
9
  WAREHOUSE = "WAREHOUSE",
9
10
  RECEIVE_REQUEST = "RECEIVE_REQUEST",
10
11
  TRANSFER_TEMPLATE = "TRANSFER_TEMPLATE",
@@ -1,5 +1,5 @@
1
- var e = /* @__PURE__ */ ((t) => (t.READ = "READ", t.UPDATE = "UPDATE", t.CREATE = "CREATE", t))(e || {}), r = /* @__PURE__ */ ((t) => (t.Add = "Add", t.Create = "Create", t.Print = "Print", t.Update = "Update", t.Details = "Details", t.Edit = "Edit", t.Delete = "Delete", t))(r || {});
2
- const a = {
1
+ var e = /* @__PURE__ */ ((t) => (t.Add = "Add", t.Create = "Create", t.Print = "Print", t.Export = "Export", t.Update = "Update", t.Details = "Details", t.Edit = "Edit", t.Delete = "Delete", t))(e || {});
2
+ const o = {
3
3
  Add: {
4
4
  translationKey: "common.add",
5
5
  color: "text-fm-color-typo-primary",
@@ -30,6 +30,12 @@ const a = {
30
30
  value: "Print"
31
31
  /* Print */
32
32
  },
33
+ Export: {
34
+ translationKey: "common.export",
35
+ color: "text-fm-color-typo-primary",
36
+ value: "Export"
37
+ /* Export */
38
+ },
33
39
  Edit: {
34
40
  translationKey: "common.edit",
35
41
  color: "text-fm-color-typo-primary",
@@ -44,7 +50,6 @@ const a = {
44
50
  }
45
51
  };
46
52
  export {
47
- a as D,
48
- e as F,
49
- r as R
53
+ o as D,
54
+ e as R
50
55
  };
@@ -1,18 +1,21 @@
1
- import { F as s } from "./index-BX5KZXhI.js";
2
- import { c as d, a as b } from "./date2-CLE9fB2R.js";
3
- function P(t, n) {
1
+ import { F as s } from "./index-CoL8wxbn.js";
2
+ import { c as d, a as b } from "./date2-CfGU3sHq.js";
3
+ function j(t, n) {
4
4
  return s.convertPrecision({
5
5
  value: t,
6
6
  precision: n
7
7
  });
8
8
  }
9
+ function P(t, n) {
10
+ return s.subtract([t, n]);
11
+ }
9
12
  function $(t, n) {
10
13
  return s.add([t, n]);
11
14
  }
12
- function j(t, n) {
15
+ function N(t, n) {
13
16
  return s.multiply([t, n]);
14
17
  }
15
- function N(t, n) {
18
+ function D(t, n) {
16
19
  const r = Math.floor(t.amount * n.amount), i = r === 0 ? 0 : t.precision + n.precision, e = a(r), o = Math.min(i, e);
17
20
  return {
18
21
  amount: r / Math.pow(10, o),
@@ -23,32 +26,33 @@ function l(t, n) {
23
26
  const r = +u(t), i = +u(n);
24
27
  return r / i;
25
28
  }
26
- function D(t, n) {
29
+ function F(t, n) {
27
30
  const r = l(t, n);
28
31
  return c(r);
29
32
  }
30
- function F(t, n) {
33
+ function T(t, n) {
31
34
  return t.precision >= n ? t : s.convertPrecision({ value: t, precision: n });
32
35
  }
33
36
  function h(t) {
37
+ if (t.amount === 0) return c(0);
34
38
  const n = a(t.amount), r = t.precision - n;
35
39
  return s.convertPrecision({ value: t, precision: Math.max(0, r) });
36
40
  }
37
41
  function u(t, n = !0) {
38
42
  return n ? Number(t.amount / Math.pow(10, t.precision)).toFixed(t.precision) : Number(t.amount / Math.pow(10, t.precision)).toString();
39
43
  }
40
- function T(t, n) {
44
+ function x(t, n) {
41
45
  n = n ?? M(t);
42
46
  const r = n, i = t.toFixed(r), e = i.includes(".") ? i.replace(/0+$/, "") : i;
43
47
  return e.endsWith(".") ? e.slice(0, e.length - 1) : e;
44
48
  }
45
- function x(t, n = !1, r = 2) {
49
+ function w(t, n = !1, r = 2) {
46
50
  const i = Number(t.amount / Math.pow(10, t.precision)), e = i.toFixed(
47
51
  Number.isInteger(i) ? 2 : Math.min(4, Math.max(2, r))
48
52
  );
49
53
  return n ? `${e} ${t.currency}` : t.currency === "MYR" ? `RM ${e}` : `${t.currency} ${e}`;
50
54
  }
51
- function w(t) {
55
+ function O(t) {
52
56
  return {
53
57
  ...t,
54
58
  amount: Math.abs(t.amount)
@@ -68,7 +72,7 @@ function c(t) {
68
72
  amount: t * 10 ** n
69
73
  };
70
74
  }
71
- function O(t, n = 0, r = !1) {
75
+ function B(t, n = 0, r = !1) {
72
76
  let i = 0;
73
77
  return Number.isNaN(Number(t)) || (r || Number(t) >= 0) && (i = Number(t)), {
74
78
  amount: Number((i * 10 ** n).toFixed(0)),
@@ -85,7 +89,7 @@ function y(t, n) {
85
89
  const r = a(n.conversion.amount);
86
90
  return t.precision - n.conversion.precision + r;
87
91
  }
88
- function B() {
92
+ function R() {
89
93
  return function(n) {
90
94
  return !!n || "Required";
91
95
  };
@@ -93,7 +97,7 @@ function B() {
93
97
  function m(t) {
94
98
  return t && typeof t == "object" && Object.prototype.hasOwnProperty.call(t, "amount") && Object.prototype.hasOwnProperty.call(t, "precision");
95
99
  }
96
- function R(t, n) {
100
+ function q(t, n) {
97
101
  const r = typeof t == "object" ? +u(t) : t;
98
102
  function i(e) {
99
103
  return Object.prototype.hasOwnProperty.call(e, "length");
@@ -111,7 +115,7 @@ function L(t) {
111
115
  return m(e) && (e = +u(e)), r(e) ? e.length > n ? !0 : typeof o == "function" ? o(e.length) : o ?? `Must be more than ${n}` : typeof e == "number" ? e > n ? !0 : typeof o == "function" ? o(e) : o ?? `Must be more than ${n}` : `Cannot validate more than ${n}`;
112
116
  };
113
117
  }
114
- function q(t, n) {
118
+ function C(t, n) {
115
119
  return t instanceof Date && n instanceof Date ? function(i) {
116
120
  const e = new Date(i);
117
121
  return isNaN(e.getTime()) ? "Invalid date" : e.getTime() < t.getTime() ? `Date must be at least ${d(t)} ${b(t)}` : e.getTime() >= n.getTime() ? `Date must be less than ${d(n)} ${b(n)}` : !0;
@@ -130,7 +134,7 @@ function f() {
130
134
  return isFinite(n) || "Must be a number";
131
135
  };
132
136
  }
133
- function C(t, n) {
137
+ function V(t, n) {
134
138
  return typeof t == "number" ? function(i) {
135
139
  const e = f()(i);
136
140
  return typeof e == "string" ? e : c(+i).precision > t ? `Precision cannot be more than ${t} decimal point.` : !0;
@@ -142,7 +146,7 @@ function C(t, n) {
142
146
  return c(+i).precision > o ? `Precision cannot be more than ${o} decimal point.` : !0;
143
147
  };
144
148
  }
145
- function V(t, n) {
149
+ function Y(t, n) {
146
150
  return function(i) {
147
151
  const e = f()(i);
148
152
  if (typeof e == "string")
@@ -151,14 +155,14 @@ function V(t, n) {
151
155
  return o.precision > t ? typeof n == "function" ? n(o.precision) : n ?? `Precision cannot be more than ${t}` : !0;
152
156
  };
153
157
  }
154
- function Y(t, n, r) {
158
+ function Z(t, n, r) {
155
159
  return function(e) {
156
160
  if (e === n) return !0;
157
161
  const o = t.find((p) => p.value === e);
158
162
  return o ? r ? r(o) : `Already used in ${o.label}` : !0;
159
163
  };
160
164
  }
161
- function Z(t) {
165
+ function S(t) {
162
166
  let n = typeof t == "number" ? c(t) : t;
163
167
  n = h(n);
164
168
  const r = u(n);
@@ -171,28 +175,29 @@ function Z(t) {
171
175
  };
172
176
  }
173
177
  export {
174
- R as A,
175
- q as B,
178
+ q as A,
179
+ C as B,
176
180
  f as I,
177
- C as M,
178
- B as R,
179
- Y as U,
181
+ V as M,
182
+ R,
183
+ Z as U,
180
184
  u as a,
181
- N as b,
185
+ D as b,
182
186
  c,
183
187
  L as d,
184
188
  M as e,
185
- w as f,
189
+ O as f,
186
190
  y as g,
187
- j as h,
191
+ N as h,
188
192
  $ as i,
189
- x as j,
190
- P as k,
191
- h as l,
192
- Z as m,
193
- T as n,
194
- V as o,
195
- D as p,
196
- O as t,
197
- F as u
193
+ w as j,
194
+ j as k,
195
+ P as l,
196
+ F as m,
197
+ h as n,
198
+ x as o,
199
+ S as p,
200
+ Y as q,
201
+ B as t,
202
+ T as u
198
203
  };
@@ -0,0 +1,111 @@
1
+ import { k as l, u as m, a as B } from "./app-BaOENyRY.js";
2
+ import { useCoreStore as k } from "@feedmepos/mf-common";
3
+ import { useSnackbar as p } from "@feedmepos/ui-library";
4
+ import { g as v } from "./index-CoL8wxbn.js";
5
+ import { ref as y } from "vue";
6
+ const $ = l((o, t) => {
7
+ const s = m(), u = k(), c = p();
8
+ return t.onError(async (e) => {
9
+ e.name === "SvcForbiddenError" && (c == null || c.open({
10
+ title: e.title,
11
+ message: e.message,
12
+ type: "error"
13
+ }));
14
+ }), {
15
+ async readStockBalance() {
16
+ const e = s.currentLocationDBName, n = `${o.inventoryBackendUrl}/${e}/stock-balance`;
17
+ return await t.get(n);
18
+ },
19
+ async readSkuBalance() {
20
+ var r;
21
+ const e = s.currentLocationDBName, n = `${o.inventoryBackendUrl}/${e}/sku/balance`;
22
+ return (((r = u.currentBusiness.value) == null ? void 0 : r.menuVersion) ?? "") === "v3" ? await t.get(n) : await t.get(`${n}?useInventoryDoc=true`);
23
+ },
24
+ async readSingleAdjustment(e) {
25
+ const n = s.currentLocationDBName, a = `${o.inventoryBackendUrl}/${n}/adjustment`;
26
+ return await t.get(`${a}?adjustmentId=${e}`);
27
+ },
28
+ async readStockAdjustment(e, n, a) {
29
+ const r = s.currentLocationDBName, i = `${o.inventoryBackendUrl}/${r}/sku`;
30
+ return await t.get(`${i}?skuId=${e}&start=${n}&end=${a}`);
31
+ },
32
+ async convertSku(e) {
33
+ var i;
34
+ const n = s.currentLocationDBName, a = `${o.inventoryBackendUrl}/${n}/sku/convert`;
35
+ return (((i = u.currentBusiness.value) == null ? void 0 : i.menuVersion) ?? "") === "v3" ? await t.post(a, e) : await t.post(`${a}?useInventoryDoc=true`, e);
36
+ },
37
+ async adjustSku(e) {
38
+ var i;
39
+ const n = s.currentLocationDBName, a = `${o.inventoryBackendUrl}/${n}/sku/adjust`;
40
+ return (((i = u.currentBusiness.value) == null ? void 0 : i.menuVersion) ?? "") === "v3" ? await t.post(a, e) : await t.post(`${a}?useInventoryDoc=true`, e);
41
+ },
42
+ recalculation: {
43
+ getRecalculateAbility() {
44
+ var r;
45
+ const n = `business_${(r = u.currentBusiness.value) == null ? void 0 : r._id}`, a = `${o.inventoryBackendUrl}/${n}/stock/operations/recalculate`;
46
+ return t.get(a);
47
+ },
48
+ startRecalculateTask() {
49
+ var r;
50
+ const n = `business_${(r = u.currentBusiness.value) == null ? void 0 : r._id}`, a = `${o.inventoryBackendUrl}/${n}/stock/operations/recalculate?refundFromPreviousAdjustment=true`;
51
+ return t.post(a);
52
+ }
53
+ }
54
+ };
55
+ });
56
+ function S() {
57
+ return {
58
+ stockBalance: {
59
+ _id: "",
60
+ items: []
61
+ },
62
+ productBalance: []
63
+ };
64
+ }
65
+ const d = y(S()), I = () => {
66
+ const o = $();
67
+ return {
68
+ // state
69
+ get stockBalance() {
70
+ return d.value.stockBalance;
71
+ },
72
+ set stockBalance(t) {
73
+ d.value.stockBalance = t;
74
+ },
75
+ get productBalance() {
76
+ return d.value.productBalance;
77
+ },
78
+ set productBalance(t) {
79
+ d.value.productBalance = t;
80
+ },
81
+ // actions
82
+ async readStockBalance() {
83
+ this.stockBalance = await o.readStockBalance();
84
+ },
85
+ async readProductBalance() {
86
+ this.productBalance = [];
87
+ const t = B(), s = v({
88
+ recipes: t.recipes,
89
+ skus: t.skus,
90
+ inventoryBindingMapping: {},
91
+ stockBalance: this.stockBalance
92
+ // silent: true
93
+ });
94
+ function u(c, e) {
95
+ return Object.prototype.hasOwnProperty.call(c, e);
96
+ }
97
+ for (const c in s.convertCountdown)
98
+ if (u(s.convertCountdown, c)) {
99
+ const e = s.convertCountdown[c];
100
+ this.productBalance.push({
101
+ id: c,
102
+ count: e
103
+ });
104
+ }
105
+ }
106
+ };
107
+ };
108
+ export {
109
+ $ as a,
110
+ I as u
111
+ };
@@ -9,4 +9,6 @@ export declare const useFeatureStore: () => {
9
9
  readonly enablePoTemplate: boolean;
10
10
  readonly enableSupplierMasterList: boolean;
11
11
  readonly mustUsePoTemplate: boolean;
12
+ readonly mustUseDefaultCost: boolean;
13
+ readonly businessSupplierOnly: boolean;
12
14
  };