@feedmepos/mf-inventory-portal 1.2.24 → 1.2.25-dev.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/dist/App-pG3igEbR.js +297 -0
  2. package/dist/{ApprovalView-D8SozxgZ.js → ApprovalView-JoTq2Bdf.js} +13 -13
  3. package/dist/{BindingsDialog-DpD-srnA.js → BindingsDialog-D44lDz_m.js} +2 -2
  4. package/dist/{BindingsPicker-TraPSRn0.js → BindingsPicker-BwaLwmiz.js} +1 -1
  5. package/dist/{BindingsTable-geCwbXg4.js → BindingsTable-C5y3yr5d.js} +1 -1
  6. package/dist/{ClosingDraftView-DsYJZvGk.js → ClosingDraftView-BxBEDZ8r.js} +5 -4
  7. package/dist/ClosingHistoryView-DU0Dv4IW.js +363 -0
  8. package/dist/{ClosingTemplateView-CHkzO1Nu.js → ClosingTemplateView-tigOzz56.js} +2 -2
  9. package/dist/{DeliveryOrderPrintPreview-skDykYOJ.js → DeliveryOrderPrintPreview-BSxjnk3a.js} +9 -9
  10. package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-BgSCX-LL.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-eUMrmGD4.js} +21 -21
  11. package/dist/{FmMultiselectDialog-CDbPF9Jh.js → FmMultiselectDialog-s0EntbOX.js} +1 -1
  12. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-CqDOpQBo.js → FmUnitInput.vue_vue_type_script_setup_true_lang-DQuvByaf.js} +1 -1
  13. package/dist/{ImportView-CskoJZ8f.js → ImportView-D6c6oNby.js} +4 -6
  14. package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-IrrYBFeM.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-Ko8B7MYK.js} +1 -1
  15. package/dist/{IngredientGroupView-RledP9Ba.js → IngredientGroupView-oCZpkxZO.js} +2 -2
  16. package/dist/{IngredientsView-C3AXdYSs.js → IngredientsView-C8WzhNAH.js} +7 -7
  17. package/dist/{IntegrationView-B_mGrVu5.js → IntegrationView-DD1QWlE3.js} +141 -141
  18. package/dist/{InventoryBindingForm-CAqsJlFM.js → InventoryBindingForm-ChoO3SrA.js} +1 -1
  19. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-C3hmrMQB.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-DXe0VwF9.js} +3 -3
  20. package/dist/{InventoryBindingSummary-CX05dIVw.js → InventoryBindingSummary-BGmUNPfu.js} +1 -1
  21. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-wWuCVuRM.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DDXfvqWA.js} +1 -1
  22. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-BU0Npweo.js → PremiumBadge.vue_vue_type_script_setup_true_lang-BwW92Whg.js} +1 -1
  23. package/dist/{PublishView-CfVJ65by.js → PublishView-CzS06kO-.js} +4 -4
  24. package/dist/{PurchaseOrderPrintPreview-DTsz2K_J.js → PurchaseOrderPrintPreview-YCg4lu_a.js} +10 -10
  25. package/dist/{ReceiveRequestView-CgJZis38.js → ReceiveRequestView-WjbYB-a0.js} +8 -8
  26. package/dist/{RecipeView-CLipp4YX.js → RecipeView-Cl4_vFBE.js} +3 -3
  27. package/dist/{StockView-BwZ2pl_P.js → StockView-dyF-JQbP.js} +18 -17
  28. package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-jmEYs9QV.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-B-fQRg6q.js} +1 -1
  29. package/dist/{SupplierView-BpwchJuw.js → SupplierView-BN_pPxS7.js} +4 -4
  30. package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-CkkFDzSi.js → TransferDetails.vue_vue_type_script_setup_true_lang-DR9qQoBL.js} +174 -174
  31. package/dist/{TransferTemplateView-BoVhRHqn.js → TransferTemplateView-CSA2wNJR.js} +7 -7
  32. package/dist/{UnitView-DvOXmefs.js → UnitView-C69iwndm.js} +3 -3
  33. package/dist/{WarehouseView-CuSv-A_N.js → WarehouseView-BkSvBJg_.js} +1 -1
  34. package/dist/api/closing.d.ts +1 -0
  35. package/dist/api/stock.d.ts +2 -44
  36. package/dist/{app-Cl-v2EjQ.js → app-NmiyG_NE.js} +6561 -6389
  37. package/dist/app.d.ts +108 -0
  38. package/dist/app.js +1 -1
  39. package/dist/{decimal-Cd_xkdIL.js → decimal-B-SPLtwh.js} +1 -1
  40. package/dist/{format-unit-display-UAp-LCyp.js → format-unit-display-jXD4D_J4.js} +20 -20
  41. package/dist/{import-export.helper-0uVecFKH.js → import-export.helper-BOFJJxVC.js} +1 -1
  42. package/dist/{index-BO1KynNa.js → index-BvtleP-f.js} +1 -1
  43. package/dist/{index-CL9QvjgU.js → index-DY1lwU0l.js} +1 -1
  44. package/dist/{purchase-order-template-D7DZ6S2H.js → purchase-order-template-BNtdgrTt.js} +1 -1
  45. package/dist/router/name.d.ts +1 -0
  46. package/dist/stock-Basa-Xi7.js +74 -0
  47. package/dist/stock-F2A8gqHx.js +83 -0
  48. package/dist/stores/inventory.d.ts +1 -0
  49. package/dist/{supplier-D49_CDEa.js → supplier-CBUmza-i.js} +1 -1
  50. package/dist/tsconfig.app.tsbuildinfo +1 -1
  51. package/dist/{use-ingredient-select-dialog-CCLEsRrk.js → use-ingredient-select-dialog-ogRof947.js} +1 -1
  52. package/dist/{use-inventory-binding-dialog-CvRGlhsk.js → use-inventory-binding-dialog-D9P4uH3I.js} +1 -1
  53. package/dist/views/closing-history/ClosingHistoryView.vue.d.ts +2 -0
  54. package/dist/views/stock/components/dialog/RecalculationDialog.vue.d.ts +11 -0
  55. package/dist/views/stock/components/dialog/RecalculationDialogProps.d.ts +3 -0
  56. package/package.json +4 -4
  57. package/dist/App-hvbk1R9p.js +0 -286
  58. package/dist/stock-DJ9usOfe.js +0 -146
@@ -1,5 +1,5 @@
1
1
  import { defineStore as y } from "pinia";
2
- import { a as S, x as b } from "./app-Cl-v2EjQ.js";
2
+ import { a as S, x as b } from "./app-NmiyG_NE.js";
3
3
  import { useDialog as A } from "@feedmepos/ui-library";
4
4
  import { useI18n as I } from "@feedmepos/mf-common";
5
5
  const h = y(
@@ -1,4 +1,4 @@
1
- import { a as P, x as g } from "./app-Cl-v2EjQ.js";
1
+ import { a as P, x as g } from "./app-NmiyG_NE.js";
2
2
  import { useDialog as E } from "@feedmepos/ui-library";
3
3
  function B() {
4
4
  const u = P(), _ = E();
@@ -0,0 +1,2 @@
1
+ declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
+ export default _default;
@@ -0,0 +1,11 @@
1
+ declare function open(): Promise<void>;
2
+ declare function close(): void;
3
+ declare const _default: import("vue").DefineComponent<{}, {
4
+ open: typeof open;
5
+ close: typeof close;
6
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
7
+ submitted: () => void;
8
+ }, string, import("vue").PublicProps, Readonly<{}> & Readonly<{
9
+ onSubmitted?: (() => any) | undefined;
10
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
11
+ export default _default;
@@ -0,0 +1,3 @@
1
+ export interface RecalculationDialogEvents {
2
+ (e: 'submitted'): void;
3
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@feedmepos/mf-inventory-portal",
3
- "version": "1.2.24",
3
+ "version": "1.2.25-dev.2",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"
@@ -44,11 +44,11 @@
44
44
  "vue-router": "^4.4.0",
45
45
  "xlsx": "^0.18.5",
46
46
  "@feedmepos/inventory-core": "^1.0.1-dev.2",
47
+ "@feedmepos/inventory-core-2": "^2.0.0",
47
48
  "@feedmepos/inventory-core-dart": "^1.0.0",
48
- "@feedmepos/inventory-core-js": "^1.0.1",
49
49
  "@feedmepos/netsuite-core": "^1.0.0",
50
- "@feedmepos/zod-inventory": "^1.0.12",
51
- "@feedmepos/inventory-core-2": "^2.0.0"
50
+ "@feedmepos/inventory-core-js": "^1.0.1",
51
+ "@feedmepos/zod-inventory": "^1.0.12"
52
52
  },
53
53
  "devDependencies": {
54
54
  "@rushstack/eslint-patch": "^1.10.3",
@@ -1,286 +0,0 @@
1
- import { ref as B, onUnmounted as k, defineComponent as w, watch as L, onMounted as O, computed as h, resolveComponent as P, openBlock as I, createElementBlock as A, unref as T, createVNode as g, createElementVNode as v, toDisplayString as x, createBlock as M, createCommentVNode as H } from "vue";
2
- import { u as D, a as W, b as K, R as e, c as F, m as _, g as a, d as $ } from "./app-Cl-v2EjQ.js";
3
- import { useCoreStore as G, useI18n as V } from "@feedmepos/mf-common";
4
- import { useRouter as U, useRoute as j } from "vue-router";
5
- import { u as z } from "./useTabStorage-BkIVScW_.js";
6
- import { u as Q } from "./googlemap-Dm8ERVai.js";
7
- function q() {
8
- return {
9
- loadingHookInstalled: !1,
10
- isLoading: !1
11
- };
12
- }
13
- const b = B(q());
14
- function J() {
15
- const c = U();
16
- if (!b.value.loadingHookInstalled) {
17
- b.value.loadingHookInstalled = !0;
18
- const r = c.beforeEach(() => {
19
- b.value.isLoading = !0;
20
- }), d = c.afterEach(() => {
21
- b.value.isLoading = !1;
22
- });
23
- k(() => {
24
- b.value.loadingHookInstalled = !1, r(), d();
25
- });
26
- }
27
- return {
28
- get isLoading() {
29
- return b.value.isLoading;
30
- }
31
- };
32
- }
33
- const X = {
34
- key: 0,
35
- class: "flex flex-col items-center w-full h-full gap-24"
36
- }, Y = {
37
- key: 1,
38
- class: "flex flex-col pt-[200px] gap-32 items-center"
39
- }, Z = { class: "flex flex-col gap-12 items-center text-center px-24 max-w-[1000px]" }, ee = { class: "fm-typo-en-title-lg-600" }, te = { class: "text-fm-color-typo-secondary fm-typo-en-body-md-400" }, oe = { class: "flex gap-16" }, ne = { href: "https://feedme.ai/product/inventory/features?tab=plans_%26_prices" }, re = { href: "https://feedme.ai/form" }, ae = /* @__PURE__ */ w({
40
- __name: "InventoryView",
41
- setup(c) {
42
- const r = D(), d = W(), f = K(), s = G(), l = U(), m = J(), o = F(), { t: E } = V();
43
- L(
44
- [() => s.sessionUser.value, () => s.currentBusiness.value],
45
- ([i, u]) => {
46
- R(i, u);
47
- }
48
- ), O(async () => {
49
- await o.init(), await s.readBusinesses();
50
- const i = s.sessionUser.value, u = s.currentBusiness.value;
51
- R(i, u);
52
- });
53
- function R(i, u) {
54
- !i || !u || C();
55
- }
56
- async function C() {
57
- return await r.init(), await f.readSetting().catch((i) => {
58
- console.error("[all] error on reading netsuite store", i);
59
- }), await d.init();
60
- }
61
- const y = h(() => l.currentRoute.value.name === e.TRANSFER_TEMPLATE ? o.enablePoTemplate : l.currentRoute.value.name === e.INGREDIENT_GROUP ? o.enableIngredientGroup : !0);
62
- return (i, u) => {
63
- const N = P("FmSpacer"), n = P("FmCircularProgress"), t = P("FmButton"), p = P("RouterView");
64
- return I(), A("div", null, [
65
- T(m).isLoading ? (I(), A("div", X, [
66
- g(N),
67
- v("div", null, [
68
- g(n, { size: "xl" })
69
- ]),
70
- u[0] || (u[0] = v("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary pl-8" }, "Loading page...", -1)),
71
- g(N)
72
- ])) : y.value ? T(s).sessionUser.value ? (I(), M(p, { key: 2 })) : H("", !0) : (I(), A("div", Y, [
73
- v("div", Z, [
74
- v("div", ee, x(T(E)("inventory.common.proPlan.title")), 1),
75
- v("div", te, x(T(E)("inventory.common.proPlan.subtitle")), 1)
76
- ]),
77
- v("div", oe, [
78
- v("a", ne, [
79
- g(t, {
80
- label: T(E)("inventory.common.proPlan.comparePlans"),
81
- variant: "secondary"
82
- }, null, 8, ["label"])
83
- ]),
84
- v("a", re, [
85
- g(t, {
86
- label: T(E)("inventory.common.proPlan.callUs"),
87
- "prepend-icon": "call"
88
- }, null, 8, ["label"])
89
- ])
90
- ])
91
- ]))
92
- ]);
93
- };
94
- }
95
- }), se = { class: "h-full flex flex-col overflow-auto py-16" }, le = /* @__PURE__ */ w({
96
- __name: "NavigationTab",
97
- setup(c) {
98
- const r = _.object({
99
- label: _.string(),
100
- value: _.string().optional(),
101
- icon: _.string().optional(),
102
- hide: _.boolean().optional(),
103
- children: _.array(_.lazy(() => r)).optional()
104
- }), d = j(), f = U(), s = G(), l = F(), m = z(), { t: o } = V();
105
- L([() => s.currentBusiness.value, () => d.name], ([n, t]) => {
106
- (n == null ? void 0 : n.menuVersion) === "v3" && (t === e.INGREDIENTS || t === e.RECIPE || t === e.UNIT) && f.push({ name: e.STOCK });
107
- });
108
- const E = (n) => n.filter((t) => !t.hide).map((t) => t.children ? { ...t, children: E(t.children) } : t), R = (n) => n.map((t) => {
109
- delete t.hide;
110
- const p = t;
111
- return t.children && (p.children = R(t.children)), p;
112
- }), C = h(() => {
113
- var p;
114
- const n = [
115
- {
116
- label: a(e.STOCK, o),
117
- // icon: 'inventory_2',
118
- children: [
119
- {
120
- label: o("inventory.stock.stock_balance.title"),
121
- value: e.STOCK
122
- },
123
- {
124
- label: a(e.WASTAGE_TEMPLATE, o),
125
- value: e.WASTAGE_TEMPLATE,
126
- hide: !l.enableWastageTemplate
127
- }
128
- ]
129
- },
130
- {
131
- label: "Closing",
132
- hide: !l.enableClosingTemplate,
133
- children: [
134
- {
135
- label: a(e.CLOSING_TEMPLATE, o),
136
- value: e.CLOSING_TEMPLATE
137
- },
138
- {
139
- label: a(e.CLOSING_DRAFT, o),
140
- value: e.CLOSING_DRAFT
141
- }
142
- ]
143
- },
144
- {
145
- label: a(e.INGREDIENTS, o),
146
- // icon: 'grocery',
147
- value: e.INGREDIENTS
148
- },
149
- {
150
- label: a(e.INGREDIENT_GROUP, o),
151
- // icon: 'grocery',
152
- value: e.INGREDIENT_GROUP,
153
- hide: !l.enableIngredientGroup
154
- },
155
- {
156
- label: a(e.RECIPE, o),
157
- // icon: 'weight',
158
- value: e.RECIPE
159
- },
160
- {
161
- label: a(e.UNIT, o),
162
- // icon: 'fastfood',
163
- value: e.UNIT
164
- },
165
- {
166
- label: o("inventory.transfer.title"),
167
- // icon: 'swap_horiz',
168
- children: [
169
- {
170
- label: a(e.RECEIVE_REQUEST, o),
171
- value: e.RECEIVE_REQUEST
172
- },
173
- {
174
- label: a(e.APPROVAL, o),
175
- value: e.APPROVAL
176
- },
177
- {
178
- label: a(e.TRANSFER_TEMPLATE, o),
179
- value: e.TRANSFER_TEMPLATE,
180
- hide: !l.enablePoTemplate
181
- }
182
- ]
183
- },
184
- {
185
- label: a(e.SUPPLIER, o),
186
- // icon: 'group',
187
- value: e.SUPPLIER
188
- },
189
- {
190
- label: a(e.WAREHOUSE, o),
191
- // icon: 'warehouse',
192
- value: e.WAREHOUSE
193
- },
194
- {
195
- label: a(e.PUBLISH, o),
196
- value: e.PUBLISH
197
- },
198
- {
199
- label: a(e.IMPORT, o),
200
- value: e.IMPORT,
201
- hide: !l.enableBulkImport
202
- },
203
- {
204
- label: a(e.INTEGRATION, o),
205
- // icon: 'integration_instructions',
206
- value: e.INTEGRATION
207
- }
208
- ], t = R(E(n));
209
- return ((p = s.currentBusiness.value) == null ? void 0 : p.menuVersion) === "v3" ? t.filter(
210
- (S) => S.value !== e.INGREDIENTS && S.value !== e.RECIPE && S.value !== e.UNIT && S.value !== e.PUBLISH
211
- ) : t;
212
- }), y = h({
213
- get() {
214
- if (d.name)
215
- return String(d.name);
216
- },
217
- set(n) {
218
- n && f.push({ name: n });
219
- }
220
- }), i = h(
221
- () => {
222
- var n;
223
- return `NavigationTab.${(n = s.currentBusiness.value) == null ? void 0 : n._id}`;
224
- }
225
- ), u = B(!1), N = h({
226
- get() {
227
- return u.value;
228
- },
229
- set(n) {
230
- u.value = n, n || m.setItem(i.value, "true");
231
- }
232
- });
233
- return L([() => i.value], () => {
234
- u.value = !1, setTimeout(() => {
235
- N.value = !m.getItem(i.value);
236
- }, 2e3);
237
- }), (n, t) => {
238
- const p = P("FmCollapsibleTabs");
239
- return I(), A("div", se, [
240
- g(p, {
241
- modelValue: y.value,
242
- "onUpdate:modelValue": t[0] || (t[0] = (S) => y.value = S),
243
- items: C.value
244
- }, null, 8, ["modelValue", "items"])
245
- ]);
246
- };
247
- }
248
- });
249
- typeof Promise.withResolvers > "u" && (Promise.withResolvers = () => {
250
- let c, r;
251
- return { promise: new Promise((f, s) => {
252
- c = f, r = s;
253
- }), resolve: c, reject: r };
254
- });
255
- typeof Promise.prototype.delayed > "u" && (Promise.prototype.delayed = async function(c) {
256
- return await new Promise((r) => setTimeout(r, c)), Promise.resolve(this);
257
- });
258
- const fe = /* @__PURE__ */ w({
259
- __name: "App",
260
- setup(c) {
261
- const r = G(), d = Q(), f = $();
262
- O(() => {
263
- if (window.location.href.includes("print-preview")) {
264
- r.setEmbedded(!0), document.body.classList.add("print-mode");
265
- return;
266
- }
267
- r.registerSidebarComponent(le), d.initGoogleMap(f.appApi.googleMap).catch(() => {
268
- console.error("Google map cannot be loaded");
269
- });
270
- }), L([() => r.currentCountry.value], () => {
271
- s();
272
- });
273
- async function s() {
274
- var l;
275
- try {
276
- await r.readBusinesses(), r.currentBusiness.value = (l = r.businesses.value) == null ? void 0 : l.find((m) => m);
277
- } catch (m) {
278
- console.error("error when trying to reset businesses:", m);
279
- }
280
- }
281
- return (l, m) => (I(), M(ae));
282
- }
283
- });
284
- export {
285
- fe as default
286
- };
@@ -1,146 +0,0 @@
1
- import { aa as m, u as k, a as l, aC as B, a0 as p } from "./app-Cl-v2EjQ.js";
2
- import { useCoreStore as v } from "@feedmepos/mf-common";
3
- import { useSnackbar as $ } from "@feedmepos/ui-library";
4
- import { ref as y, computed as b } from "vue";
5
- const g = m((s, a) => {
6
- const c = k(), o = v(), u = $();
7
- return a.onError(async (t) => {
8
- t.name === "SvcForbiddenError" && (u == null || u.open({
9
- title: t.title,
10
- message: t.message,
11
- type: "error"
12
- }));
13
- }), {
14
- async readStockBalance() {
15
- const t = c.currentLocationDBName, e = `${s.inventoryBackendUrl}/${t}/stock-balance`;
16
- return await a.get(e);
17
- },
18
- async readSkuBalance() {
19
- var r;
20
- const t = c.currentLocationDBName, e = `${s.inventoryBackendUrl}/${t}/sku/balance`;
21
- return (((r = o.currentBusiness.value) == null ? void 0 : r.menuVersion) ?? "") === "v3" ? await a.get(e) : await a.get(`${e}?useInventoryDoc=true`);
22
- },
23
- async readSingleAdjustment(t) {
24
- const e = c.currentLocationDBName, n = `${s.inventoryBackendUrl}/${e}/adjustment`;
25
- return await a.get(`${n}?adjustmentId=${t}`);
26
- },
27
- async readStockAdjustment(t, e, n) {
28
- const r = c.currentLocationDBName, i = `${s.inventoryBackendUrl}/${r}/sku`;
29
- return await a.get(`${i}?skuId=${t}&start=${e}&end=${n}`);
30
- },
31
- async readAdjustmentById(t) {
32
- const e = c.currentLocationDBName, n = `${s.inventoryBackendUrl}/${e}/adjustment`;
33
- return await a.get(`${n}?adjustmentId=${t}`);
34
- },
35
- async convertSku(t) {
36
- var i;
37
- const e = c.currentLocationDBName, n = `${s.inventoryBackendUrl}/${e}/sku/convert`;
38
- return (((i = o.currentBusiness.value) == null ? void 0 : i.menuVersion) ?? "") === "v3" ? await a.post(n, t) : await a.post(`${n}?useInventoryDoc=true`, t);
39
- },
40
- async adjustSku(t) {
41
- var i;
42
- const e = c.currentLocationDBName, n = `${s.inventoryBackendUrl}/${e}/sku/adjust`;
43
- return (((i = o.currentBusiness.value) == null ? void 0 : i.menuVersion) ?? "") === "v3" ? await a.post(n, t) : await a.post(`${n}?useInventoryDoc=true`, t);
44
- },
45
- async revertWastageAdjustment(t) {
46
- const e = c.currentLocationDBName, n = `${s.inventoryBackendUrl}/${e}/sku/revert-wastage-adjustment`;
47
- return await a.post(n, t);
48
- },
49
- recalculation: {
50
- getRecalculateAbility() {
51
- var r;
52
- const e = `business_${(r = o.currentBusiness.value) == null ? void 0 : r._id}`, n = `${s.inventoryBackendUrl}/${e}/stock/operations/recalculate`;
53
- return a.get(n);
54
- },
55
- startRecalculateTask() {
56
- var r;
57
- const e = `business_${(r = o.currentBusiness.value) == null ? void 0 : r._id}`, n = `${s.inventoryBackendUrl}/${e}/stock/operations/recalculate?refundFromPreviousAdjustment=true`;
58
- return a.post(n);
59
- },
60
- refreshCurrentBalances() {
61
- const t = c.currentLocationDBName, e = `${s.inventoryBackendUrl}/${t}/stock/operations/recalculate/refresh-current-balances`;
62
- return a.post(e);
63
- },
64
- calculateStockSnapshotAtDate(t, e) {
65
- const n = c.currentLocationDBName, r = `${s.inventoryBackendUrl}/${n}/stock/operations/recalculate/calculate-at-date?effectiveAt=${encodeURIComponent(t)}&closingDraftId=${encodeURIComponent(e)}`;
66
- return a.get(r);
67
- },
68
- scheduleCalculateStockSnapshotAtDate(t, e) {
69
- const n = c.currentLocationDBName, r = `${s.inventoryBackendUrl}/${n}/stock/operations/recalculate/schedule/calculate-at-date?effectiveAt=${encodeURIComponent(t)}&closingDraftId=${encodeURIComponent(e)}`;
70
- return a.get(r);
71
- }
72
- }
73
- };
74
- });
75
- function S() {
76
- return {
77
- stockBalance: {
78
- _id: "",
79
- items: []
80
- },
81
- productBalance: []
82
- };
83
- }
84
- const f = p(0), N = {
85
- id: "",
86
- balance: f,
87
- closing: null,
88
- costs: null
89
- }, d = y(S()), A = () => {
90
- const s = l(), a = b(() => {
91
- var t;
92
- const o = (t = d.value.stockBalance.skus) == null ? void 0 : t.groupBy((e) => e.id), u = (e) => {
93
- var n;
94
- return ((n = o == null ? void 0 : o.get(e)) == null ? void 0 : n[0]) ?? { ...N, id: e };
95
- };
96
- return s.skus.map((e) => u(e._id));
97
- }), c = g();
98
- return {
99
- // state
100
- get stockBalance() {
101
- return {
102
- ...d.value.stockBalance,
103
- skus: a.value
104
- };
105
- },
106
- set stockBalance(o) {
107
- d.value.stockBalance = o;
108
- },
109
- get productBalance() {
110
- return d.value.productBalance;
111
- },
112
- set productBalance(o) {
113
- d.value.productBalance = o;
114
- },
115
- // actions
116
- async readStockBalance() {
117
- this.stockBalance = await c.readStockBalance();
118
- },
119
- async readProductBalance() {
120
- this.productBalance = [];
121
- const o = l(), u = B({
122
- recipes: o.recipes,
123
- skus: o.skus,
124
- skuGroups: o.skuGroups,
125
- inventoryBindingMapping: {},
126
- stockBalance: this.stockBalance
127
- // silent: true
128
- });
129
- function t(e, n) {
130
- return Object.prototype.hasOwnProperty.call(e, n);
131
- }
132
- for (const e in u.convertCountdown)
133
- if (t(u.convertCountdown, e)) {
134
- const n = u.convertCountdown[e];
135
- this.productBalance.push({
136
- id: e,
137
- count: n
138
- });
139
- }
140
- }
141
- };
142
- };
143
- export {
144
- g as a,
145
- A as u
146
- };