@feedmepos/mf-inventory-portal 0.0.6 → 0.0.7-dev.1
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.
- package/dist/{ApprovalView-7XAT5-7o.js → ApprovalView-BYZcvkso.js} +6 -6
- package/dist/{BindingsDialog-DgHuffxZ.js → BindingsDialog-pdS86VDU.js} +2 -2
- package/dist/{BindingsPicker-CdG1FKt3.js → BindingsPicker-D891Cfzu.js} +2 -2
- package/dist/{BindingsTable-DnhyMeyT.js → BindingsTable-tmr6QwLk.js} +3 -3
- package/dist/{ChangeLocationComponent.vue_vue_type_script_setup_true_lang-aicACi6T.js → ChangeLocationComponent.vue_vue_type_script_setup_true_lang-Bss0q2Zt.js} +1 -1
- package/dist/{FmMultiselectDialog.vue_vue_type_script_setup_true_lang-BeCBc3ie.js → FmMultiselectDialog.vue_vue_type_script_setup_true_lang-BHcLUkdm.js} +2 -2
- package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-DS9A38-m.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-BIww2Noe.js} +1 -1
- package/dist/{IngredientsView-CC2M-Oxt.js → IngredientsView-BH6G7830.js} +69 -69
- package/dist/{IntegrationView-C0eXkb_X.js → IntegrationView-CfJn6Fzn.js} +3 -3
- package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-BqkpGRQG.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-39U8Iavr.js} +5 -5
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DZshbzqT.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-nDxqau1g.js} +1 -1
- package/dist/{PurchaseOrderPrintPreview-BChxLASs.js → PurchaseOrderPrintPreview-Db2U_IQL.js} +1 -1
- package/dist/{ReceiveRequestView-B2T-K9on.js → ReceiveRequestView-CgVfcS8C.js} +11 -11
- package/dist/{RecipeView-DGS0-kll.js → RecipeView-C9_Y_A9b.js} +58 -58
- package/dist/{StockView-Byeg5Lmo.js → StockView-CoUI3Faj.js} +226 -229
- package/dist/{SupplierView-C-qEfLPr.js → SupplierView-CNq6wVfN.js} +7 -7
- package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-BQvyTSZC.js → TransferDetails.vue_vue_type_script_setup_true_lang-Cmajrg-9.js} +5 -5
- package/dist/{UnitView-zTo6Jwgy.js → UnitView-Buyp4Gnc.js} +190 -177
- package/dist/{WarehouseView-h92-OZ8y.js → WarehouseView-DbUib0PR.js} +3 -3
- package/dist/{app-D_R27XfK.js → app-DM4Thqjw.js} +10314 -10308
- package/dist/app.js +1 -1
- package/dist/core.d.ts +3 -3
- package/dist/{date2-CsVyh2xw.js → date2-DpU4LDaP.js} +1 -1
- package/dist/{dayjs.min-DJF3Prun.js → dayjs.min-D4Q_pHH9.js} +145 -145
- package/dist/{decimal-esXdd4p7.js → decimal-M4vjE6Br.js} +1 -1
- package/dist/{fuzzy-5drv5SZI.js → fuzzy-fD_FTJWH.js} +1 -1
- package/dist/{init-date-range-BWVT2UgA.js → init-date-range-DJ1Nl5TB.js} +1 -1
- package/dist/{layout-Cf3iZuvk.js → layout-kY567oHX.js} +1 -1
- package/dist/{rules-QzzL5oLu.js → rules-CVxh5XVG.js} +1 -1
- package/dist/{stock-estimate-DqJKQ1Jf.js → stock-estimate-lkaYlz7I.js} +2 -2
- package/dist/style.css +1 -1
- package/dist/{supplier-Df899fpy.js → supplier-evd71Y1H.js} +1 -1
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{use-inventory-binding-dialog-CYQrVeOf.js → use-inventory-binding-dialog-CGuXojFC.js} +2 -2
- package/dist/{xlsx-DqpZNivg.js → xlsx-DpBw8KA4.js} +636 -636
- package/package.json +8 -3
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { ref as P, defineComponent as oe, computed as R, resolveComponent as F, openBlock as k, createBlock as z, withCtx as D, createElementVNode as n, normalizeClass as re, toDisplayString as V, createVNode as b, createElementBlock as M, Fragment as ee, renderList as ae, unref as C, h as Le, watch as _e, isRef as Ae, createCommentVNode as Q, reactive as st, onMounted as Ve, normalizeStyle as Ge, createTextVNode as pe, Teleport as at, normalizeProps as ke, mergeProps as xe } from "vue";
|
|
2
2
|
import { _ as lt } from "./SingleColumnLayout.vue_vue_type_script_setup_true_lang-CFjO4TPG.js";
|
|
3
|
-
import { f as We, e as le, c as De, u as Me, h as He, i as
|
|
4
|
-
import { useCoreStore as
|
|
3
|
+
import { f as We, e as le, c as De, u as Me, h as He, i as Z, s as rt, d as Ne, a as it, C as Se, I as Je } from "./app-DM4Thqjw.js";
|
|
4
|
+
import { useCoreStore as Qe } from "@feedmepos/mf-common";
|
|
5
5
|
import { useSnackbar as ie, useDialog as je, useProxiedModel as Re, useBreakpoints as ut } from "@feedmepos/ui-library";
|
|
6
|
-
import { c as ct, _ as dt, F as Oe, u as mt } from "./layout-
|
|
7
|
-
import { g as ge } from "./decimal-
|
|
8
|
-
import { d as pt, F as Ye } from "./dayjs.min-
|
|
9
|
-
import { e as ft, i as
|
|
10
|
-
import { _ as yt } from "./ChangeLocationComponent.vue_vue_type_script_setup_true_lang-
|
|
11
|
-
import { g as Ce, a as
|
|
12
|
-
import { a as Be, A as Ft, M as Bt, R as At } from "./rules-
|
|
13
|
-
import { u as Vt, g as tt } from "./use-inventory-binding-dialog-
|
|
14
|
-
import { _ as Dt } from "./FmMultiselectDialog.vue_vue_type_script_setup_true_lang-
|
|
15
|
-
import { _ as Mt } from "./NumberPrecisionInput.vue_vue_type_script_setup_true_lang-
|
|
16
|
-
import { i as jt } from "./init-date-range-
|
|
6
|
+
import { c as ct, _ as dt, F as Oe, u as mt } from "./layout-kY567oHX.js";
|
|
7
|
+
import { g as ge } from "./decimal-M4vjE6Br.js";
|
|
8
|
+
import { d as pt, F as Ye } from "./dayjs.min-D4Q_pHH9.js";
|
|
9
|
+
import { e as ft, i as Xe, u as vt } from "./stock-estimate-lkaYlz7I.js";
|
|
10
|
+
import { _ as yt } from "./ChangeLocationComponent.vue_vue_type_script_setup_true_lang-Bss0q2Zt.js";
|
|
11
|
+
import { g as Ce, a as X, b as _t, t as he, c as me, d as gt, e as ze, h as Ze, i as Ue, j as ht, f as et, k as Fe, l as bt, m as kt, n as xt, p as St, o as $t, q as wt, r as Ct } from "./date2-DpU4LDaP.js";
|
|
12
|
+
import { a as Be, A as Ft, M as Bt, R as At } from "./rules-CVxh5XVG.js";
|
|
13
|
+
import { u as Vt, g as tt } from "./use-inventory-binding-dialog-CGuXojFC.js";
|
|
14
|
+
import { _ as Dt } from "./FmMultiselectDialog.vue_vue_type_script_setup_true_lang-BHcLUkdm.js";
|
|
15
|
+
import { _ as Mt } from "./NumberPrecisionInput.vue_vue_type_script_setup_true_lang-nDxqau1g.js";
|
|
16
|
+
import { i as jt } from "./init-date-range-DJ1Nl5TB.js";
|
|
17
17
|
import { E as Rt } from "./empty-placeholder-wf6-BWE8.js";
|
|
18
|
-
const fe = We((
|
|
19
|
-
const r = le(), o =
|
|
18
|
+
const fe = We((u, l) => {
|
|
19
|
+
const r = le(), o = Qe(), v = ie();
|
|
20
20
|
return l.onError(async (g) => {
|
|
21
21
|
g.name === "SvcForbiddenError" && (v == null || v.open({
|
|
22
22
|
title: g.title,
|
|
@@ -25,40 +25,40 @@ const fe = We((c, l) => {
|
|
|
25
25
|
}));
|
|
26
26
|
}), {
|
|
27
27
|
async readStockBalance() {
|
|
28
|
-
const g = r.currentLocationDBName,
|
|
29
|
-
return await l.get(
|
|
28
|
+
const g = r.currentLocationDBName, c = `${u.inventoryBackendUrl}/${g}/stock-balance`;
|
|
29
|
+
return await l.get(c);
|
|
30
30
|
},
|
|
31
31
|
async readSkuBalance() {
|
|
32
32
|
var S;
|
|
33
|
-
const g = r.currentLocationDBName,
|
|
34
|
-
return (((S = o.currentBusiness.value) == null ? void 0 : S.menuVersion) ?? "") === "v3" ? await l.get(
|
|
33
|
+
const g = r.currentLocationDBName, c = `${u.inventoryBackendUrl}/${g}/sku/balance`;
|
|
34
|
+
return (((S = o.currentBusiness.value) == null ? void 0 : S.menuVersion) ?? "") === "v3" ? await l.get(c) : await l.get(`${c}?useInventoryDoc=true`);
|
|
35
35
|
},
|
|
36
36
|
async readSingleAdjustment(g) {
|
|
37
|
-
const
|
|
37
|
+
const c = r.currentLocationDBName, h = `${u.inventoryBackendUrl}/${c}/adjustment`;
|
|
38
38
|
return await l.get(`${h}?adjustmentId=${g}`);
|
|
39
39
|
},
|
|
40
|
-
async readStockAdjustment(g,
|
|
41
|
-
const S = r.currentLocationDBName, p = `${
|
|
42
|
-
return await l.get(`${p}?skuId=${g}&start=${
|
|
40
|
+
async readStockAdjustment(g, c, h) {
|
|
41
|
+
const S = r.currentLocationDBName, p = `${u.inventoryBackendUrl}/${S}/sku`;
|
|
42
|
+
return await l.get(`${p}?skuId=${g}&start=${c}&end=${h}`);
|
|
43
43
|
},
|
|
44
44
|
async convertSku(g) {
|
|
45
45
|
var p;
|
|
46
|
-
const
|
|
46
|
+
const c = r.currentLocationDBName, h = `${u.inventoryBackendUrl}/${c}/sku/convert`;
|
|
47
47
|
return (((p = o.currentBusiness.value) == null ? void 0 : p.menuVersion) ?? "") === "v3" ? await l.post(h, g) : await l.post(`${h}?useInventoryDoc=true`, g);
|
|
48
48
|
},
|
|
49
49
|
async adjustSku(g) {
|
|
50
50
|
var p;
|
|
51
|
-
const
|
|
51
|
+
const c = r.currentLocationDBName, h = `${u.inventoryBackendUrl}/${c}/sku/adjust`;
|
|
52
52
|
return (((p = o.currentBusiness.value) == null ? void 0 : p.menuVersion) ?? "") === "v3" ? await l.post(h, g) : await l.post(`${h}?useInventoryDoc=true`, g);
|
|
53
53
|
},
|
|
54
54
|
recalculation: {
|
|
55
55
|
getRecalculateAbility() {
|
|
56
|
-
const g = r.currentLocationDBName,
|
|
57
|
-
return l.get(
|
|
56
|
+
const g = r.currentLocationDBName, c = `${u.inventoryBackendUrl}/${g}/stock/operations/recalculate`;
|
|
57
|
+
return l.get(c);
|
|
58
58
|
},
|
|
59
59
|
startRecalculateTask() {
|
|
60
|
-
const g = r.currentLocationDBName,
|
|
61
|
-
return l.post(
|
|
60
|
+
const g = r.currentLocationDBName, c = `${u.inventoryBackendUrl}/${g}/stock/operations/recalculate?refundFromPreviousAdjustment=true`;
|
|
61
|
+
return l.post(c);
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
};
|
|
@@ -73,7 +73,7 @@ function Ut() {
|
|
|
73
73
|
};
|
|
74
74
|
}
|
|
75
75
|
const ve = P(Ut()), Ie = () => {
|
|
76
|
-
const
|
|
76
|
+
const u = fe();
|
|
77
77
|
return {
|
|
78
78
|
// state
|
|
79
79
|
get stockBalance() {
|
|
@@ -90,14 +90,14 @@ const ve = P(Ut()), Ie = () => {
|
|
|
90
90
|
},
|
|
91
91
|
// actions
|
|
92
92
|
async readStockBalance() {
|
|
93
|
-
this.stockBalance = await
|
|
93
|
+
this.stockBalance = await u.readStockBalance();
|
|
94
94
|
},
|
|
95
95
|
async readProductBalance() {
|
|
96
|
-
this.productBalance = await
|
|
96
|
+
this.productBalance = await u.readSkuBalance();
|
|
97
97
|
}
|
|
98
98
|
};
|
|
99
99
|
};
|
|
100
|
-
var ye = /* @__PURE__ */ ((
|
|
100
|
+
var ye = /* @__PURE__ */ ((u) => (u.History = "History", u.Convert = "Convert", u.Adjust = "Adjust", u))(ye || {});
|
|
101
101
|
const It = [
|
|
102
102
|
{
|
|
103
103
|
label: "History",
|
|
@@ -117,7 +117,7 @@ const It = [
|
|
|
117
117
|
color: "text-neutral-700"
|
|
118
118
|
}
|
|
119
119
|
];
|
|
120
|
-
async function Pt(
|
|
120
|
+
async function Pt(u) {
|
|
121
121
|
const r = `${(le().currentLocation.name || "").replace(
|
|
122
122
|
/ /g,
|
|
123
123
|
"_"
|
|
@@ -126,7 +126,7 @@ async function Pt(c) {
|
|
|
126
126
|
[
|
|
127
127
|
{
|
|
128
128
|
name: "stock",
|
|
129
|
-
data:
|
|
129
|
+
data: u,
|
|
130
130
|
columns: [
|
|
131
131
|
{
|
|
132
132
|
name: "Code",
|
|
@@ -148,7 +148,7 @@ async function Pt(c) {
|
|
|
148
148
|
selector: (o) => {
|
|
149
149
|
var g;
|
|
150
150
|
const v = be(o, o.unit);
|
|
151
|
-
return v.type === "unit" ? o.unit.abbrev : ((g = o.unit.measurements.find((
|
|
151
|
+
return v.type === "unit" ? o.unit.abbrev : ((g = o.unit.measurements.find((c) => c.id === v.measurement)) == null ? void 0 : g.abbrev) || "";
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
154
|
]
|
|
@@ -157,8 +157,8 @@ async function Pt(c) {
|
|
|
157
157
|
r
|
|
158
158
|
);
|
|
159
159
|
}
|
|
160
|
-
function be(
|
|
161
|
-
const r = localStorage.getItem(`uom:${
|
|
160
|
+
function be(u, l) {
|
|
161
|
+
const r = localStorage.getItem(`uom:${u._id}`);
|
|
162
162
|
return r ? r === l._id ? {
|
|
163
163
|
type: "unit"
|
|
164
164
|
} : l.measurements.find((o) => o.id === r) ? {
|
|
@@ -166,9 +166,9 @@ function be(c, l) {
|
|
|
166
166
|
measurement: r
|
|
167
167
|
} : {
|
|
168
168
|
type: "unit"
|
|
169
|
-
} :
|
|
169
|
+
} : u.trackingMeasurement && l.measurements.find((o) => o.id === u.trackingMeasurement) ? {
|
|
170
170
|
type: "measurement",
|
|
171
|
-
measurement:
|
|
171
|
+
measurement: u.trackingMeasurement
|
|
172
172
|
} : {
|
|
173
173
|
type: "unit"
|
|
174
174
|
};
|
|
@@ -181,7 +181,7 @@ const Et = { class: "fm-typo-en-body-md-400 flex-grow" }, nt = /* @__PURE__ */ o
|
|
|
181
181
|
amount: {},
|
|
182
182
|
defaultTrackingMeasurement: {}
|
|
183
183
|
},
|
|
184
|
-
setup(
|
|
184
|
+
setup(u) {
|
|
185
185
|
function l(p) {
|
|
186
186
|
return `uom:${p._id}`;
|
|
187
187
|
}
|
|
@@ -189,7 +189,7 @@ const Et = { class: "fm-typo-en-body-md-400 flex-grow" }, nt = /* @__PURE__ */ o
|
|
|
189
189
|
const t = l(o.sku);
|
|
190
190
|
p ? localStorage.setItem(t, p) : localStorage.setItem(t, o.unit._id), v.value = be(o.sku, o.unit);
|
|
191
191
|
}
|
|
192
|
-
const o =
|
|
192
|
+
const o = u, v = P(be(o.sku, o.unit)), g = R(() => {
|
|
193
193
|
const { measurements: p } = o.unit;
|
|
194
194
|
return [
|
|
195
195
|
{
|
|
@@ -202,13 +202,13 @@ const Et = { class: "fm-typo-en-body-md-400 flex-grow" }, nt = /* @__PURE__ */ o
|
|
|
202
202
|
}))
|
|
203
203
|
];
|
|
204
204
|
});
|
|
205
|
-
function
|
|
205
|
+
function c({ value: p }) {
|
|
206
206
|
return C(v).type === "unit" ? p === null : p === C(v).measurement;
|
|
207
207
|
}
|
|
208
208
|
const h = R(
|
|
209
209
|
() => {
|
|
210
210
|
var p;
|
|
211
|
-
return ((p = g.value.find((t) =>
|
|
211
|
+
return ((p = g.value.find((t) => c(t))) == null ? void 0 : p.label) ?? "";
|
|
212
212
|
}
|
|
213
213
|
), S = P(!1);
|
|
214
214
|
return (p, t) => {
|
|
@@ -236,7 +236,7 @@ const Et = { class: "fm-typo-en-body-md-400 flex-grow" }, nt = /* @__PURE__ */ o
|
|
|
236
236
|
(k(!0), M(ee, null, ae(g.value, (a) => (k(), z(y, {
|
|
237
237
|
key: a.value ?? 0,
|
|
238
238
|
label: a.label,
|
|
239
|
-
"model-value":
|
|
239
|
+
"model-value": c(a),
|
|
240
240
|
onClick: (I) => r(a.value)
|
|
241
241
|
}, null, 8, ["label", "model-value", "onClick"]))), 128))
|
|
242
242
|
]),
|
|
@@ -259,9 +259,9 @@ const Et = { class: "fm-typo-en-body-md-400 flex-grow" }, nt = /* @__PURE__ */ o
|
|
|
259
259
|
props: {
|
|
260
260
|
days: {}
|
|
261
261
|
},
|
|
262
|
-
setup(
|
|
263
|
-
const l =
|
|
264
|
-
return (g,
|
|
262
|
+
setup(u) {
|
|
263
|
+
const l = u, r = R(() => !l.days && l.days !== 0 ? "bg-fm-color-neutral-white" : l.days > 14 ? "bg-fm-color-system-success-400" : l.days >= 7 && l.days <= 14 ? "bg-fm-color-system-warning-400" : "bg-fm-color-system-error-400"), o = R(() => !l.days && l.days !== 0 ? "text-fm-color-neutral-white" : l.days > 14 ? "text-fm-color-system-success-400" : l.days >= 7 && l.days <= 14 ? "text-fm-color-system-warning-400" : "text-fm-color-system-error-400"), v = R(() => !l.days && l.days !== 0 ? "bg-fm-color-neutral-white" : l.days > 14 ? "bg-fm-color-system-success-100" : l.days >= 7 && l.days <= 14 ? "bg-fm-color-system-warning-100" : "bg-fm-color-system-error-100");
|
|
264
|
+
return (g, c) => typeof l.days == "number" ? (k(), M("div", Lt, [
|
|
265
265
|
n("div", {
|
|
266
266
|
class: re([v.value, "flex items-center gap-8 p-4 fm-corner-radius-md"])
|
|
267
267
|
}, [
|
|
@@ -275,7 +275,7 @@ const Et = { class: "fm-typo-en-body-md-400 flex-grow" }, nt = /* @__PURE__ */ o
|
|
|
275
275
|
])) : (k(), M("div", Ht, Ot));
|
|
276
276
|
}
|
|
277
277
|
});
|
|
278
|
-
function Yt(
|
|
278
|
+
function Yt(u) {
|
|
279
279
|
const l = le(), r = Ie(), o = je(), v = P();
|
|
280
280
|
async function g(y) {
|
|
281
281
|
const i = {
|
|
@@ -287,7 +287,7 @@ function Yt(c) {
|
|
|
287
287
|
};
|
|
288
288
|
v.value = i;
|
|
289
289
|
}
|
|
290
|
-
const
|
|
290
|
+
const c = P();
|
|
291
291
|
async function h(y) {
|
|
292
292
|
var j, w, B;
|
|
293
293
|
if (!!!((w = (j = y.convert) == null ? void 0 : j.inventoryBindings) != null && w.length)) {
|
|
@@ -302,13 +302,13 @@ function Yt(c) {
|
|
|
302
302
|
sku: y,
|
|
303
303
|
show: !0,
|
|
304
304
|
"onUpdate:show"(U) {
|
|
305
|
-
|
|
305
|
+
c.value.show = U;
|
|
306
306
|
},
|
|
307
307
|
onSubmitted() {
|
|
308
|
-
|
|
308
|
+
u();
|
|
309
309
|
}
|
|
310
310
|
};
|
|
311
|
-
|
|
311
|
+
c.value = I;
|
|
312
312
|
}
|
|
313
313
|
const S = P();
|
|
314
314
|
async function p(y) {
|
|
@@ -319,7 +319,7 @@ function Yt(c) {
|
|
|
319
319
|
S.value.show = a;
|
|
320
320
|
},
|
|
321
321
|
onSubmitted() {
|
|
322
|
-
|
|
322
|
+
u();
|
|
323
323
|
}
|
|
324
324
|
};
|
|
325
325
|
S.value = i;
|
|
@@ -398,7 +398,7 @@ function Yt(c) {
|
|
|
398
398
|
}
|
|
399
399
|
],
|
|
400
400
|
stockHistoryProps: v,
|
|
401
|
-
convertSkuDialogProps:
|
|
401
|
+
convertSkuDialogProps: c,
|
|
402
402
|
adjustSkuDialogProps: S,
|
|
403
403
|
showSkuHistory: g
|
|
404
404
|
};
|
|
@@ -406,41 +406,41 @@ function Yt(c) {
|
|
|
406
406
|
const zt = {
|
|
407
407
|
context: null,
|
|
408
408
|
error: null,
|
|
409
|
-
isRequired(
|
|
410
|
-
return `${this.context ?? ""}`.length === 0 && (this.error =
|
|
409
|
+
isRequired(u = "This field is required") {
|
|
410
|
+
return `${this.context ?? ""}`.length === 0 && (this.error = u), this;
|
|
411
411
|
},
|
|
412
|
-
isString(
|
|
413
|
-
return this.error ? this : (typeof this.context != "string" && (this.error ?? (this.error =
|
|
412
|
+
isString(u = "Must be a valid string") {
|
|
413
|
+
return this.error ? this : (typeof this.context != "string" && (this.error ?? (this.error = u)), this);
|
|
414
414
|
},
|
|
415
415
|
toInt() {
|
|
416
416
|
return this.error ? this : (this.context = +this.context, this);
|
|
417
417
|
},
|
|
418
|
-
isInteger(
|
|
419
|
-
return this.error ? this : (this.toInt(), isNaN(this.context) && (this.error =
|
|
418
|
+
isInteger(u = "Must be an integer") {
|
|
419
|
+
return this.error ? this : (this.toInt(), isNaN(this.context) && (this.error = u), this);
|
|
420
420
|
},
|
|
421
|
-
min(
|
|
421
|
+
min(u, l) {
|
|
422
422
|
if (this.error) return this;
|
|
423
423
|
try {
|
|
424
|
-
typeof this.context == "number" ? +this.context <
|
|
424
|
+
typeof this.context == "number" ? +this.context < u && (this.error = l ?? `Must be at least ${u}`) : Object.prototype.hasOwnProperty.call(this.context, "length") ? +this.context.length < u && (this.error = l ?? `Must be at least ${u}`) : this.error = "Length cannot be determined";
|
|
425
425
|
} catch {
|
|
426
426
|
this.error = "Length cannot be determined";
|
|
427
427
|
}
|
|
428
428
|
return this;
|
|
429
429
|
},
|
|
430
|
-
max(
|
|
430
|
+
max(u, l) {
|
|
431
431
|
if (this.error) return this;
|
|
432
432
|
try {
|
|
433
|
-
typeof this.context == "number" ? +this.context >
|
|
433
|
+
typeof this.context == "number" ? +this.context > u && (this.error = l ?? `Must be at most ${u}`) : "length" in this.context ? +this.context.length > u && (this.error = l ?? `Must be at most ${u}`) : this.error = "Length cannot be determined";
|
|
434
434
|
} catch {
|
|
435
435
|
this.error = "Length cannot be determined";
|
|
436
436
|
}
|
|
437
437
|
return this;
|
|
438
438
|
}
|
|
439
439
|
};
|
|
440
|
-
function qe(
|
|
441
|
-
return { ...zt, context:
|
|
440
|
+
function qe(u) {
|
|
441
|
+
return { ...zt, context: u };
|
|
442
442
|
}
|
|
443
|
-
const qt = { class: "flex items-center" }, Kt = { class: "fm-typo-en-title-md-800" }, Gt = { class: "flex flex-col gap-24 w-full" }, Wt = { class: "flex flex-col gap-8" },
|
|
443
|
+
const qt = { class: "flex items-center" }, Kt = { class: "fm-typo-en-title-md-800" }, Gt = { class: "flex flex-col gap-24 w-full" }, Wt = { class: "flex flex-col gap-8" }, Jt = /* @__PURE__ */ n("div", { class: "fm-typo-en-body-lg-600" }, "Deduction summary", -1), Qt = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary flex-grow" }, Xt = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-error" }, Zt = { class: "flex flex-col p-16 gap-8" }, en = { class: "flex flex-col gap-4" }, tn = /* @__PURE__ */ n("div", { class: "fm-typo-en-body-md-600 text-fm-color-typo-secondary bg-fm-color-neutral-gray-100 border-b py-12 px-16" }, " Ingredients ", -1), nn = { class: "grid grid-cols-[auto_100px_100px_48px] xs:grid-cols-[auto_80px_120px_48px] gap-8 px-8 items-center" }, on = { class: "xs:col-span-3" }, sn = { class: "flex gap-8" }, an = /* @__PURE__ */ oe({
|
|
444
444
|
__name: "ConvertSkuDialog",
|
|
445
445
|
props: {
|
|
446
446
|
sku: {},
|
|
@@ -448,12 +448,12 @@ const qt = { class: "flex items-center" }, Kt = { class: "fm-typo-en-title-md-80
|
|
|
448
448
|
show: { type: Boolean }
|
|
449
449
|
},
|
|
450
450
|
emits: ["update:show", "submitted"],
|
|
451
|
-
setup(
|
|
452
|
-
const o =
|
|
451
|
+
setup(u, { expose: l, emit: r }) {
|
|
452
|
+
const o = u, v = r, g = Vt(), c = Me(), h = fe(), S = ie(), p = P(0), t = P(null), f = R(() => c.skus), y = R(
|
|
453
453
|
() => {
|
|
454
454
|
var e, s;
|
|
455
455
|
return (((s = (e = o.sku) == null ? void 0 : e.convert) == null ? void 0 : s.inventoryBindings) ?? []).filter(
|
|
456
|
-
(
|
|
456
|
+
(d) => d.type === He.enum.SKU
|
|
457
457
|
);
|
|
458
458
|
}
|
|
459
459
|
), i = R({
|
|
@@ -481,32 +481,32 @@ const qt = { class: "flex items-center" }, Kt = { class: "fm-typo-en-title-md-80
|
|
|
481
481
|
const s = (x = o.sku.convert) != null && x.measurement ? o.sku.unit.measurements.find((E) => {
|
|
482
482
|
var K;
|
|
483
483
|
return E.id === ((K = o.sku.convert) == null ? void 0 : K.measurement);
|
|
484
|
-
}) ?? null : null,
|
|
485
|
-
return qe(m).isInteger().max(
|
|
484
|
+
}) ?? null : null, d = Ce(o.sku.unit, s), m = gt(+e);
|
|
485
|
+
return qe(m).isInteger().max(d).error ? "Precision cannot be more than " + d : !0;
|
|
486
486
|
}
|
|
487
487
|
const B = R(
|
|
488
488
|
() => {
|
|
489
489
|
var e, s;
|
|
490
|
-
return (e = o.sku.convert) != null && e.measurement ? (s = o.sku.unit.measurements.find((
|
|
490
|
+
return (e = o.sku.convert) != null && e.measurement ? (s = o.sku.unit.measurements.find((d) => {
|
|
491
491
|
var m;
|
|
492
|
-
return
|
|
492
|
+
return d.id === ((m = o.sku.convert) == null ? void 0 : m.measurement);
|
|
493
493
|
})) == null ? void 0 : s.abbrev : o.sku.unit.abbrev;
|
|
494
494
|
}
|
|
495
495
|
), U = R(() => {
|
|
496
|
-
var
|
|
497
|
-
const e = (m = (
|
|
496
|
+
var d, m, _;
|
|
497
|
+
const e = (m = (d = o.sku.convert) == null ? void 0 : d.inventoryBindings) == null ? void 0 : m.filter((x) => x.type === "SKU");
|
|
498
498
|
return (_ = t.value ?? e) == null ? void 0 : _.map((x) => {
|
|
499
499
|
var ue, ce, ne, Te, Pe;
|
|
500
|
-
const E =
|
|
500
|
+
const E = c.skus.find((de) => de._id === x.id), K = ((ue = x.measurement) == null ? void 0 : ue.abbrev) ?? ((ce = E == null ? void 0 : E.unit) == null ? void 0 : ce.abbrev), J = (ne = o.sku.convert) != null && ne.measurement ? o.sku.unit.measurements.find((de) => {
|
|
501
501
|
var Ee;
|
|
502
502
|
return de.id === ((Ee = o.sku.convert) == null ? void 0 : Ee.measurement);
|
|
503
|
-
}) ?? null : null, se = Ce(o.sku.unit, J), A = w(`${p.value}`) === !0 ?
|
|
503
|
+
}) ?? null : null, se = Ce(o.sku.unit, J), A = w(`${p.value}`) === !0 ? X(
|
|
504
504
|
_t(
|
|
505
505
|
x.amount,
|
|
506
506
|
he(+p.value, se)
|
|
507
507
|
),
|
|
508
508
|
!1
|
|
509
|
-
) : "0", T = (Pe = (Te = t.value) == null ? void 0 : Te.find((de) => de.id === (E == null ? void 0 : E._id))) == null ? void 0 : Pe.amount, H = T ?
|
|
509
|
+
) : "0", T = (Pe = (Te = t.value) == null ? void 0 : Te.find((de) => de.id === (E == null ? void 0 : E._id))) == null ? void 0 : Pe.amount, H = T ? X(T, !1) : null;
|
|
510
510
|
return {
|
|
511
511
|
sku: E,
|
|
512
512
|
convertAmount: H ?? A,
|
|
@@ -529,7 +529,7 @@ const qt = { class: "flex items-center" }, Kt = { class: "fm-typo-en-title-md-80
|
|
|
529
529
|
}
|
|
530
530
|
});
|
|
531
531
|
const L = Re(o, "show");
|
|
532
|
-
async function N(e, s,
|
|
532
|
+
async function N(e, s, d) {
|
|
533
533
|
a.value = !0;
|
|
534
534
|
try {
|
|
535
535
|
await h.convertSku({
|
|
@@ -537,7 +537,7 @@ const qt = { class: "flex items-center" }, Kt = { class: "fm-typo-en-title-md-80
|
|
|
537
537
|
{
|
|
538
538
|
doc: e,
|
|
539
539
|
amount: s,
|
|
540
|
-
overrides:
|
|
540
|
+
overrides: d == null ? void 0 : d.map((m) => ({
|
|
541
541
|
...m,
|
|
542
542
|
amount: {
|
|
543
543
|
...m.amount,
|
|
@@ -558,38 +558,38 @@ const qt = { class: "flex items-center" }, Kt = { class: "fm-typo-en-title-md-80
|
|
|
558
558
|
a.value = !1;
|
|
559
559
|
}
|
|
560
560
|
}
|
|
561
|
-
function G(e, s,
|
|
561
|
+
function G(e, s, d) {
|
|
562
562
|
const m = +s;
|
|
563
|
-
let _ =
|
|
564
|
-
s.length > 0 && isFinite(m) ? _ =
|
|
563
|
+
let _ = d;
|
|
564
|
+
s.length > 0 && isFinite(m) ? _ = d.map((x) => (x.id !== e || (x.amount = me(m)), x)) : _ = d.map((x) => (x.id !== e || (x.amount = { amount: 0, precision: 0 }), x)), t.value = _;
|
|
565
565
|
}
|
|
566
566
|
function Y(e) {
|
|
567
|
-
const s = f.value.find((
|
|
567
|
+
const s = f.value.find((d) => d._id === e);
|
|
568
568
|
return s ? tt(s.unit, !0) : [];
|
|
569
569
|
}
|
|
570
570
|
function q(e, s) {
|
|
571
|
-
const
|
|
571
|
+
const d = Y(e), m = d.find((_) => _.value === s) ?? d.find((_) => _.value === null);
|
|
572
572
|
return m ? {
|
|
573
573
|
...m,
|
|
574
574
|
label: m.abbrev
|
|
575
575
|
} : null;
|
|
576
576
|
}
|
|
577
|
-
function te(e, s,
|
|
577
|
+
function te(e, s, d) {
|
|
578
578
|
let m;
|
|
579
579
|
if (s === null)
|
|
580
|
-
m =
|
|
580
|
+
m = d.map((_) => (_.id !== e || (_.measurement = null), _)) ?? [];
|
|
581
581
|
else {
|
|
582
582
|
const _ = f.value.find((x) => x._id === e);
|
|
583
|
-
m =
|
|
583
|
+
m = d.map((x) => {
|
|
584
584
|
var E, K;
|
|
585
585
|
return x.id !== e || (x.measurement = (K = (E = _ == null ? void 0 : _.unit) == null ? void 0 : E.measurements) == null ? void 0 : K.find((J) => J.id === s)), x;
|
|
586
586
|
}) ?? [];
|
|
587
587
|
}
|
|
588
588
|
t.value = m;
|
|
589
589
|
}
|
|
590
|
-
function
|
|
591
|
-
const
|
|
592
|
-
t.value =
|
|
590
|
+
function W(e, s) {
|
|
591
|
+
const d = s.filter((m) => m.id !== e);
|
|
592
|
+
t.value = d;
|
|
593
593
|
}
|
|
594
594
|
function $() {
|
|
595
595
|
const e = (t.value ?? []).map((s) => ({
|
|
@@ -608,7 +608,7 @@ const qt = { class: "flex items-center" }, Kt = { class: "fm-typo-en-title-md-80
|
|
|
608
608
|
e || (t.value = null, p.value = 0);
|
|
609
609
|
}
|
|
610
610
|
), (e, s) => {
|
|
611
|
-
const
|
|
611
|
+
const d = F("FmTextField"), m = F("FmForm"), _ = F("FmCard"), x = F("FmSwitch"), E = F("FmFormGroup"), K = F("FmSelect"), J = F("FmButton"), se = F("FmSideSheet");
|
|
612
612
|
return k(), z(se, {
|
|
613
613
|
"dismiss-away": "",
|
|
614
614
|
modelValue: C(L),
|
|
@@ -628,7 +628,7 @@ const qt = { class: "flex items-center" }, Kt = { class: "fm-typo-en-title-md-80
|
|
|
628
628
|
onValidationSuccess: I
|
|
629
629
|
}, {
|
|
630
630
|
default: D(() => [
|
|
631
|
-
b(
|
|
631
|
+
b(d, {
|
|
632
632
|
disabled: a.value,
|
|
633
633
|
"model-value": p.value,
|
|
634
634
|
"onUpdate:modelValue": s[0] || (s[0] = (A) => p.value = A),
|
|
@@ -646,15 +646,15 @@ const qt = { class: "flex items-center" }, Kt = { class: "fm-typo-en-title-md-80
|
|
|
646
646
|
}, {
|
|
647
647
|
default: D(() => [
|
|
648
648
|
n("div", Wt, [
|
|
649
|
-
|
|
649
|
+
Jt,
|
|
650
650
|
(k(!0), M(ee, null, ae(U.value, (A) => {
|
|
651
651
|
var T, H;
|
|
652
652
|
return k(), M("div", {
|
|
653
653
|
key: (T = A.sku) == null ? void 0 : T._id,
|
|
654
654
|
class: "flex items-center"
|
|
655
655
|
}, [
|
|
656
|
-
n("div",
|
|
657
|
-
n("div",
|
|
656
|
+
n("div", Qt, V((H = A.sku) == null ? void 0 : H.name), 1),
|
|
657
|
+
n("div", Xt, " -" + V(A.convertAmount) + " " + V(A.abbrev), 1)
|
|
658
658
|
]);
|
|
659
659
|
}), 128))
|
|
660
660
|
])
|
|
@@ -681,7 +681,7 @@ const qt = { class: "flex items-center" }, Kt = { class: "fm-typo-en-title-md-80
|
|
|
681
681
|
(k(!0), M(ee, null, ae(t.value, (A) => (k(), z(E, {
|
|
682
682
|
key: A.id,
|
|
683
683
|
disabled: a.value,
|
|
684
|
-
modelValue: +C(
|
|
684
|
+
modelValue: +C(X)(A.amount ?? { amount: 1, precision: 0 }),
|
|
685
685
|
rules: [
|
|
686
686
|
C(Bt)(
|
|
687
687
|
f.value.find((T) => T._id === A.id).unit,
|
|
@@ -695,10 +695,10 @@ const qt = { class: "flex items-center" }, Kt = { class: "fm-typo-en-title-md-80
|
|
|
695
695
|
return [
|
|
696
696
|
n("div", nn, [
|
|
697
697
|
n("div", on, V((H = f.value.find((ne) => ne._id === A.id)) == null ? void 0 : H.name), 1),
|
|
698
|
-
b(
|
|
698
|
+
b(d, {
|
|
699
699
|
class: "xs:col-span-2",
|
|
700
700
|
disabled: a.value,
|
|
701
|
-
modelValue: +C(
|
|
701
|
+
modelValue: +C(X)(
|
|
702
702
|
A.amount ?? { amount: 1, precision: 0 }
|
|
703
703
|
),
|
|
704
704
|
"onUpdate:modelValue": (ne) => G(A.id, ne, t.value ?? []),
|
|
@@ -720,7 +720,7 @@ const qt = { class: "flex items-center" }, Kt = { class: "fm-typo-en-title-md-80
|
|
|
720
720
|
type: "button",
|
|
721
721
|
variant: "tertiary",
|
|
722
722
|
icon: "delete",
|
|
723
|
-
onClick: (ne) =>
|
|
723
|
+
onClick: (ne) => W(A.id, t.value ?? [])
|
|
724
724
|
}, null, 8, ["disabled", "onClick"])
|
|
725
725
|
])
|
|
726
726
|
];
|
|
@@ -760,31 +760,31 @@ const qt = { class: "flex items-center" }, Kt = { class: "fm-typo-en-title-md-80
|
|
|
760
760
|
};
|
|
761
761
|
}
|
|
762
762
|
});
|
|
763
|
-
function $e(
|
|
764
|
-
const r = he(
|
|
763
|
+
function $e(u, l) {
|
|
764
|
+
const r = he(u, l);
|
|
765
765
|
return { ...r, amount: -r.amount };
|
|
766
766
|
}
|
|
767
|
-
function Ke(
|
|
768
|
-
return he(Math.abs(
|
|
767
|
+
function Ke(u, l) {
|
|
768
|
+
return he(Math.abs(u), l);
|
|
769
769
|
}
|
|
770
770
|
const we = {
|
|
771
|
-
[
|
|
771
|
+
[Z.enum.DAMAGE]: {
|
|
772
772
|
label: "Waste",
|
|
773
773
|
toAdjustmentAmount: $e
|
|
774
774
|
},
|
|
775
|
-
[
|
|
775
|
+
[Z.enum.THEFT]: {
|
|
776
776
|
label: "Theft",
|
|
777
777
|
toAdjustmentAmount: $e
|
|
778
778
|
},
|
|
779
|
-
[
|
|
779
|
+
[Z.enum.LOSE]: {
|
|
780
780
|
label: "Lose",
|
|
781
781
|
toAdjustmentAmount: $e
|
|
782
782
|
},
|
|
783
|
-
[
|
|
783
|
+
[Z.enum.EXTRA]: {
|
|
784
784
|
label: "Extra",
|
|
785
785
|
toAdjustmentAmount: Ke
|
|
786
786
|
},
|
|
787
|
-
[
|
|
787
|
+
[Z.enum.PURCHASE]: {
|
|
788
788
|
label: "Purchase",
|
|
789
789
|
toAdjustmentAmount: Ke
|
|
790
790
|
}
|
|
@@ -795,15 +795,15 @@ const we = {
|
|
|
795
795
|
disabled: { type: Boolean }
|
|
796
796
|
},
|
|
797
797
|
emits: ["update:modelValue", "click:delete"],
|
|
798
|
-
setup(
|
|
799
|
-
const r =
|
|
798
|
+
setup(u, { emit: l }) {
|
|
799
|
+
const r = u, o = l, v = R(
|
|
800
800
|
() => Object.keys(we).map((t) => ({
|
|
801
801
|
label: rt(t),
|
|
802
802
|
value: t
|
|
803
803
|
}))
|
|
804
|
-
), g = R(() => tt(r.modelValue.doc.unit, !0)),
|
|
804
|
+
), g = R(() => tt(r.modelValue.doc.unit, !0)), c = R({
|
|
805
805
|
get() {
|
|
806
|
-
return r.modelValue.type ??
|
|
806
|
+
return r.modelValue.type ?? Z.enum.PURCHASE;
|
|
807
807
|
},
|
|
808
808
|
set(t) {
|
|
809
809
|
const f = {
|
|
@@ -812,20 +812,20 @@ const we = {
|
|
|
812
812
|
f.type = t;
|
|
813
813
|
const y = ze(r.modelValue.amount);
|
|
814
814
|
f.amount = we[f.type].toAdjustmentAmount(
|
|
815
|
-
+
|
|
815
|
+
+X(y),
|
|
816
816
|
y.precision
|
|
817
817
|
), o("update:modelValue", f);
|
|
818
818
|
}
|
|
819
819
|
}), h = R({
|
|
820
820
|
get() {
|
|
821
821
|
const t = ze(r.modelValue.amount);
|
|
822
|
-
return +
|
|
822
|
+
return +X(t);
|
|
823
823
|
},
|
|
824
824
|
set(t) {
|
|
825
825
|
const f = {
|
|
826
826
|
...r.modelValue
|
|
827
827
|
}, y = me(t);
|
|
828
|
-
f.amount = we[
|
|
828
|
+
f.amount = we[c.value].toAdjustmentAmount(
|
|
829
829
|
t,
|
|
830
830
|
y.precision
|
|
831
831
|
), o("update:modelValue", f);
|
|
@@ -873,15 +873,15 @@ const we = {
|
|
|
873
873
|
class: "col-span-2",
|
|
874
874
|
label: "Type",
|
|
875
875
|
items: v.value,
|
|
876
|
-
modelValue:
|
|
877
|
-
"onUpdate:modelValue": f[1] || (f[1] = (j) =>
|
|
876
|
+
modelValue: c.value,
|
|
877
|
+
"onUpdate:modelValue": f[1] || (f[1] = (j) => c.value = j),
|
|
878
878
|
rules: [C(At)()],
|
|
879
879
|
"label-mark": "required"
|
|
880
880
|
}, null, 8, ["disabled", "items", "modelValue", "rules"]),
|
|
881
881
|
b(Mt, {
|
|
882
882
|
disabled: t.disabled,
|
|
883
883
|
label: "Amount",
|
|
884
|
-
step: +C(
|
|
884
|
+
step: +C(X)({
|
|
885
885
|
amount: 1,
|
|
886
886
|
precision: C(Ce)(t.modelValue.doc.unit, t.modelValue.measurement)
|
|
887
887
|
}),
|
|
@@ -918,8 +918,8 @@ const we = {
|
|
|
918
918
|
show: { type: Boolean }
|
|
919
919
|
},
|
|
920
920
|
emits: ["update:show", "submitted"],
|
|
921
|
-
setup(
|
|
922
|
-
const o =
|
|
921
|
+
setup(u, { expose: l, emit: r }) {
|
|
922
|
+
const o = u, v = r, g = Me(), c = je(), h = fe(), S = ie(), p = P(!1);
|
|
923
923
|
function t() {
|
|
924
924
|
a(De(i));
|
|
925
925
|
}
|
|
@@ -943,7 +943,7 @@ const we = {
|
|
|
943
943
|
adjustments: [
|
|
944
944
|
{
|
|
945
945
|
id: `sku_${(/* @__PURE__ */ new Date()).toISOString()}_${Math.random().toString(16).slice(2, 8)}`,
|
|
946
|
-
type:
|
|
946
|
+
type: Z.enum.PURCHASE,
|
|
947
947
|
doc: o.stock,
|
|
948
948
|
measurement: null,
|
|
949
949
|
remark: "",
|
|
@@ -955,7 +955,7 @@ const we = {
|
|
|
955
955
|
w && (i.remark = "", i.adjustments = [
|
|
956
956
|
{
|
|
957
957
|
id: `sku_${(/* @__PURE__ */ new Date()).toISOString()}_${Math.random().toString(16).slice(2, 8)}`,
|
|
958
|
-
type:
|
|
958
|
+
type: Z.enum.PURCHASE,
|
|
959
959
|
doc: o.stock,
|
|
960
960
|
measurement: null,
|
|
961
961
|
remark: "",
|
|
@@ -993,7 +993,7 @@ const we = {
|
|
|
993
993
|
sublabel: U.code,
|
|
994
994
|
value: U._id
|
|
995
995
|
})), B = w.filter((U) => i.adjustments.find((O) => O.doc._id === U.value)).map((U) => U.value);
|
|
996
|
-
|
|
996
|
+
c.open({
|
|
997
997
|
title: "Select ingredients",
|
|
998
998
|
contentComponent: Dt,
|
|
999
999
|
contentComponentProps: {
|
|
@@ -1016,7 +1016,7 @@ const we = {
|
|
|
1016
1016
|
i.adjustments = U.map(
|
|
1017
1017
|
(O) => i.adjustments.find((L) => L.doc._id === O) ?? {
|
|
1018
1018
|
id: `sku_${(/* @__PURE__ */ new Date()).toISOString()}_${Math.random().toString(16).slice(2, 8)}`,
|
|
1019
|
-
type:
|
|
1019
|
+
type: Z.enum.PURCHASE,
|
|
1020
1020
|
doc: g.skus.find((L) => L._id === O),
|
|
1021
1021
|
measurement: null,
|
|
1022
1022
|
remark: "",
|
|
@@ -1087,22 +1087,22 @@ const we = {
|
|
|
1087
1087
|
}, 8, ["modelValue"]);
|
|
1088
1088
|
};
|
|
1089
1089
|
}
|
|
1090
|
-
}), vn = We((
|
|
1090
|
+
}), vn = We((u, l) => ({
|
|
1091
1091
|
// TODO: remove once latest inventory backend has been push
|
|
1092
1092
|
async findBillsByBusinessId(r, o, v) {
|
|
1093
|
-
const g = `${
|
|
1093
|
+
const g = `${u.businessesBackendUrl}/${r}/reports/find-many`, c = {
|
|
1094
1094
|
// type: TYPE.bill,
|
|
1095
1095
|
type: "bill",
|
|
1096
1096
|
restaurantIds: o,
|
|
1097
1097
|
ids: v
|
|
1098
1098
|
};
|
|
1099
|
-
return await l.post(g,
|
|
1099
|
+
return await l.post(g, c);
|
|
1100
1100
|
},
|
|
1101
1101
|
async findBillsById(r) {
|
|
1102
|
-
const v = le().currentLocationDBName, g = `${
|
|
1102
|
+
const v = le().currentLocationDBName, g = `${u.inventoryBackendUrl}/${v}/bill/search`, c = {
|
|
1103
1103
|
ids: r
|
|
1104
1104
|
};
|
|
1105
|
-
return await l.post(g,
|
|
1105
|
+
return await l.post(g, c);
|
|
1106
1106
|
}
|
|
1107
1107
|
})), yn = { class: "p-16" }, _n = { class: "fm-typo-en-body-md-600 flex-grow" }, gn = { class: "flex-grow text-fm-color-typo-secondary" }, hn = {
|
|
1108
1108
|
key: 0,
|
|
@@ -1120,13 +1120,13 @@ const we = {
|
|
|
1120
1120
|
sku: {},
|
|
1121
1121
|
bills: { default: () => [] }
|
|
1122
1122
|
},
|
|
1123
|
-
setup(
|
|
1124
|
-
const l =
|
|
1123
|
+
setup(u) {
|
|
1124
|
+
const l = u, r = P(!1), o = P(), v = P(null), g = R(() => v.value === null ? "unset" : r.value ? `${v.value}px` : "0px");
|
|
1125
1125
|
Ve(() => {
|
|
1126
1126
|
var S;
|
|
1127
1127
|
v.value = ((S = o.value) == null ? void 0 : S.scrollHeight) || 0;
|
|
1128
1128
|
});
|
|
1129
|
-
const
|
|
1129
|
+
const c = R(() => {
|
|
1130
1130
|
var i;
|
|
1131
1131
|
const S = l.record.adjustments, p = l.sku, t = {}, y = S.flatMap((a) => {
|
|
1132
1132
|
var I;
|
|
@@ -1138,7 +1138,7 @@ const we = {
|
|
|
1138
1138
|
}
|
|
1139
1139
|
return Object.entries(t).reduce(
|
|
1140
1140
|
(a, [I, j]) => (a[I] = /// comment, because without it formatter makes code uglier
|
|
1141
|
-
`${
|
|
1141
|
+
`${X(j, !1)} ${p.unit.abbrev}`, a),
|
|
1142
1142
|
{}
|
|
1143
1143
|
);
|
|
1144
1144
|
}), h = R(() => l.record.adjustmentsByTime.map(({ date: S, adjustments: p }) => ({
|
|
@@ -1149,7 +1149,7 @@ const we = {
|
|
|
1149
1149
|
return ((y = (f = t.skus) == null ? void 0 : f.map) == null ? void 0 : y.call(f, (i) => ({
|
|
1150
1150
|
...i,
|
|
1151
1151
|
ref: t.ref,
|
|
1152
|
-
backdateFrom: t.effectiveAt != null ?
|
|
1152
|
+
backdateFrom: t.effectiveAt != null ? Xe(t._id) : null
|
|
1153
1153
|
}))) ?? [];
|
|
1154
1154
|
}
|
|
1155
1155
|
).flatMap((t) => {
|
|
@@ -1158,7 +1158,7 @@ const we = {
|
|
|
1158
1158
|
return t.amounts.map((a) => {
|
|
1159
1159
|
var I;
|
|
1160
1160
|
return {
|
|
1161
|
-
amount: `${
|
|
1161
|
+
amount: `${X(a.amount, !1)} ${((I = a.measurement) == null ? void 0 : I.abbrev) ?? t.sku.unit.abbrev}`,
|
|
1162
1162
|
backdateFrom: t.backdateFrom,
|
|
1163
1163
|
name: a.type,
|
|
1164
1164
|
remark: a.remark || y || "",
|
|
@@ -1183,7 +1183,7 @@ const we = {
|
|
|
1183
1183
|
size: "md"
|
|
1184
1184
|
}, null, 8, ["name"])
|
|
1185
1185
|
]),
|
|
1186
|
-
(k(!0), M(ee, null, ae(
|
|
1186
|
+
(k(!0), M(ee, null, ae(c.value, (i, a) => (k(), M("div", {
|
|
1187
1187
|
key: a,
|
|
1188
1188
|
class: "flex flex-row py-1",
|
|
1189
1189
|
style: { "font-size": "0.8rem" }
|
|
@@ -1259,49 +1259,49 @@ const we = {
|
|
|
1259
1259
|
};
|
|
1260
1260
|
}
|
|
1261
1261
|
});
|
|
1262
|
-
function Fn(
|
|
1262
|
+
function Fn(u, l) {
|
|
1263
1263
|
var g;
|
|
1264
|
-
const r = Object.keys(
|
|
1265
|
-
(
|
|
1264
|
+
const r = Object.keys(Z.enum).reduce(
|
|
1265
|
+
(c, h) => (c[h] = { amount: 0, precision: 0 }, c),
|
|
1266
1266
|
{}
|
|
1267
1267
|
);
|
|
1268
1268
|
if (!l)
|
|
1269
1269
|
return Object.entries(r).reduce(
|
|
1270
|
-
(
|
|
1270
|
+
(c, [h]) => (c[h] = "", c),
|
|
1271
1271
|
{}
|
|
1272
1272
|
);
|
|
1273
|
-
const v =
|
|
1273
|
+
const v = u.flatMap((c) => {
|
|
1274
1274
|
var h;
|
|
1275
|
-
return ((h =
|
|
1276
|
-
}).flatMap((
|
|
1277
|
-
for (const
|
|
1278
|
-
const h =
|
|
1279
|
-
r[g =
|
|
1275
|
+
return ((h = c.skus) == null ? void 0 : h.filter((S) => S.sku._id === l._id)) ?? [];
|
|
1276
|
+
}).flatMap((c) => c.amounts);
|
|
1277
|
+
for (const c of v) {
|
|
1278
|
+
const h = c.measurement ? Ze(c.measurement.conversion, c.amount) : c.amount;
|
|
1279
|
+
r[g = c.type] ?? (r[g] = { amount: 0, precision: 0 }), r[c.type] = Ue(h, r[c.type]);
|
|
1280
1280
|
}
|
|
1281
1281
|
return Object.entries(r).reduce(
|
|
1282
|
-
(
|
|
1282
|
+
(c, [h, S]) => {
|
|
1283
1283
|
const p = {
|
|
1284
1284
|
...S,
|
|
1285
1285
|
amount: Math.abs(S.amount)
|
|
1286
1286
|
};
|
|
1287
|
-
return
|
|
1288
|
-
`${
|
|
1287
|
+
return c[h] = /// comment, because without it formatter makes code uglier
|
|
1288
|
+
`${X(p, !1)} ${l.unit.abbrev}`, c;
|
|
1289
1289
|
},
|
|
1290
1290
|
{}
|
|
1291
1291
|
);
|
|
1292
1292
|
}
|
|
1293
|
-
Array.prototype.computeFirst = function(
|
|
1293
|
+
Array.prototype.computeFirst = function(u) {
|
|
1294
1294
|
const l = this.length;
|
|
1295
1295
|
for (let r = 0; r < l; r++) {
|
|
1296
|
-
const o = this.at(r), v =
|
|
1296
|
+
const o = this.at(r), v = u(o, r, this);
|
|
1297
1297
|
if (v != null)
|
|
1298
1298
|
return v;
|
|
1299
1299
|
}
|
|
1300
1300
|
};
|
|
1301
|
-
Array.prototype.computeLast = function(
|
|
1301
|
+
Array.prototype.computeLast = function(u) {
|
|
1302
1302
|
const l = this.length - 1;
|
|
1303
1303
|
for (let r = l; r >= 0; r--) {
|
|
1304
|
-
const o = this.at(r), v =
|
|
1304
|
+
const o = this.at(r), v = u(o, r, this);
|
|
1305
1305
|
if (v != null)
|
|
1306
1306
|
return v;
|
|
1307
1307
|
}
|
|
@@ -1317,10 +1317,10 @@ const Bn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, An = {
|
|
|
1317
1317
|
], -1), Tn = {
|
|
1318
1318
|
class: "grid gap-12 fm-typo-en-body-md-400",
|
|
1319
1319
|
style: { "grid-template-columns": "auto auto auto", "grid-auto-rows": "1fr" }
|
|
1320
|
-
}, Pn = { class: "flex flex-col gap-1" }, En = /* @__PURE__ */ n("div", { class: "text-fm-color-typo-secondary" }, "Total purchase", -1), Ln = { class: "font-bold" }, Hn = { class: "flex flex-col gap-1" }, Nn = /* @__PURE__ */ n("div", { class: "text-fm-color-typo-secondary" }, "Total sales", -1), On = { class: "font-bold" }, Yn = { class: "flex flex-col gap-1" }, zn = /* @__PURE__ */ n("div", { class: "text-fm-color-typo-secondary" }, "Total lose", -1), qn = { class: "font-bold" }, Kn = { class: "flex flex-col gap-1" }, Gn = /* @__PURE__ */ n("div", { class: "text-fm-color-typo-secondary" }, "Total request", -1), Wn = { class: "font-bold" },
|
|
1320
|
+
}, Pn = { class: "flex flex-col gap-1" }, En = /* @__PURE__ */ n("div", { class: "text-fm-color-typo-secondary" }, "Total purchase", -1), Ln = { class: "font-bold" }, Hn = { class: "flex flex-col gap-1" }, Nn = /* @__PURE__ */ n("div", { class: "text-fm-color-typo-secondary" }, "Total sales", -1), On = { class: "font-bold" }, Yn = { class: "flex flex-col gap-1" }, zn = /* @__PURE__ */ n("div", { class: "text-fm-color-typo-secondary" }, "Total lose", -1), qn = { class: "font-bold" }, Kn = { class: "flex flex-col gap-1" }, Gn = /* @__PURE__ */ n("div", { class: "text-fm-color-typo-secondary" }, "Total request", -1), Wn = { class: "font-bold" }, Jn = {
|
|
1321
1321
|
class: "flex flex-col gap-1",
|
|
1322
1322
|
style: { "grid-column-end": "span 2" }
|
|
1323
|
-
},
|
|
1323
|
+
}, Qn = /* @__PURE__ */ n("div", { class: "text-fm-color-typo-secondary" }, "Total receive", -1), Xn = { class: "font-bold" }, Zn = { class: "flex flex-col gap-1" }, eo = /* @__PURE__ */ n("div", { class: "text-fm-color-typo-secondary" }, "Opening balance", -1), to = { class: "font-bold" }, no = {
|
|
1324
1324
|
class: "flex flex-col gap-1",
|
|
1325
1325
|
style: { "grid-column-end": "span 2" }
|
|
1326
1326
|
}, oo = /* @__PURE__ */ n("div", { class: "text-fm-color-typo-secondary" }, "Last stock balance", -1), so = { class: "font-bold" }, ao = {
|
|
@@ -1340,8 +1340,8 @@ const Bn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, An = {
|
|
|
1340
1340
|
show: { type: Boolean }
|
|
1341
1341
|
},
|
|
1342
1342
|
emits: ["update:show"],
|
|
1343
|
-
setup(
|
|
1344
|
-
const l =
|
|
1343
|
+
setup(u) {
|
|
1344
|
+
const l = Qe(), r = Ie(), o = fe(), v = vn(), g = le(), c = it(), h = u, S = P(!1), p = ie(), t = P(jt(0));
|
|
1345
1345
|
async function f() {
|
|
1346
1346
|
S.value = !0;
|
|
1347
1347
|
try {
|
|
@@ -1367,18 +1367,18 @@ const Bn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, An = {
|
|
|
1367
1367
|
}
|
|
1368
1368
|
function j($, e) {
|
|
1369
1369
|
const s = $.reduce(
|
|
1370
|
-
(
|
|
1371
|
-
const _ = m.effectiveAt ??
|
|
1370
|
+
(d, m) => {
|
|
1371
|
+
const _ = m.effectiveAt ?? Xe(m._id);
|
|
1372
1372
|
if (!_)
|
|
1373
|
-
return
|
|
1373
|
+
return d;
|
|
1374
1374
|
const x = I(new Date(_), e);
|
|
1375
|
-
return
|
|
1375
|
+
return d[x] ?? (d[x] = []), d[x].push(m), d;
|
|
1376
1376
|
},
|
|
1377
1377
|
{}
|
|
1378
1378
|
);
|
|
1379
|
-
return Object.keys(s).map((
|
|
1380
|
-
date:
|
|
1381
|
-
adjustments: s[
|
|
1379
|
+
return Object.keys(s).map((d) => ({
|
|
1380
|
+
date: d,
|
|
1381
|
+
adjustments: s[d]
|
|
1382
1382
|
}));
|
|
1383
1383
|
}
|
|
1384
1384
|
async function w() {
|
|
@@ -1389,18 +1389,18 @@ const Bn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, An = {
|
|
|
1389
1389
|
);
|
|
1390
1390
|
y.value = $;
|
|
1391
1391
|
const e = $.filter(({ ref: s }) => s == null ? void 0 : s.startsWith("bill_")).map(({ ref: s }) => s);
|
|
1392
|
-
await B(e), i.value = j($, "day").map(({ date: s, adjustments:
|
|
1392
|
+
await B(e), i.value = j($, "day").map(({ date: s, adjustments: d }) => ({
|
|
1393
1393
|
date: s,
|
|
1394
|
-
adjustments:
|
|
1395
|
-
adjustmentsByTime: j(
|
|
1394
|
+
adjustments: d,
|
|
1395
|
+
adjustmentsByTime: j(d, "minute")
|
|
1396
1396
|
}));
|
|
1397
1397
|
}
|
|
1398
1398
|
async function B($) {
|
|
1399
1399
|
$.length && (a.value = await v.findBillsById($).catch((e) => {
|
|
1400
1400
|
var m;
|
|
1401
1401
|
console.error("Error on using latest bill API, retrying using legacy api", e);
|
|
1402
|
-
const s = ((m = l.currentBusiness.value) == null ? void 0 : m._id) ?? "",
|
|
1403
|
-
return v.findBillsByBusinessId(s, [
|
|
1402
|
+
const s = ((m = l.currentBusiness.value) == null ? void 0 : m._id) ?? "", d = g.currentLocation.doc._id;
|
|
1403
|
+
return v.findBillsByBusinessId(s, [d], $);
|
|
1404
1404
|
}));
|
|
1405
1405
|
}
|
|
1406
1406
|
const U = R(() => {
|
|
@@ -1409,23 +1409,23 @@ const Bn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, An = {
|
|
|
1409
1409
|
}), O = R(() => {
|
|
1410
1410
|
const $ = [...y.value].computeFirst((s) => {
|
|
1411
1411
|
var m, _;
|
|
1412
|
-
const
|
|
1413
|
-
return
|
|
1412
|
+
const d = (_ = (m = s.skus) == null ? void 0 : m.find) == null ? void 0 : _.call(m, (x) => x.sku._id === h.sku._id);
|
|
1413
|
+
return d == null ? void 0 : d.fromBalance;
|
|
1414
1414
|
}) ?? {
|
|
1415
1415
|
amount: 0,
|
|
1416
1416
|
precision: 0
|
|
1417
1417
|
}, e = h.sku;
|
|
1418
|
-
return e ? `${
|
|
1418
|
+
return e ? `${X($, !1)} ${e.unit.abbrev}` : "";
|
|
1419
1419
|
}), L = R(() => {
|
|
1420
1420
|
const $ = [...y.value].reverse().computeFirst((s) => {
|
|
1421
1421
|
var m, _;
|
|
1422
|
-
const
|
|
1423
|
-
return
|
|
1422
|
+
const d = (_ = (m = s.skus) == null ? void 0 : m.find) == null ? void 0 : _.call(m, (x) => x.sku._id === h.sku._id);
|
|
1423
|
+
return d == null ? void 0 : d.toBalance;
|
|
1424
1424
|
}) ?? {
|
|
1425
1425
|
amount: 0,
|
|
1426
1426
|
precision: 0
|
|
1427
1427
|
}, e = h.sku;
|
|
1428
|
-
return e ? `${
|
|
1428
|
+
return e ? `${X($, !1)} ${e.unit.abbrev}` : "";
|
|
1429
1429
|
});
|
|
1430
1430
|
function N($) {
|
|
1431
1431
|
switch ($) {
|
|
@@ -1441,22 +1441,20 @@ const Bn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, An = {
|
|
|
1441
1441
|
}
|
|
1442
1442
|
const G = R(() => {
|
|
1443
1443
|
var s;
|
|
1444
|
-
const e = y.value.flatMap((
|
|
1444
|
+
const e = y.value.flatMap((d) => {
|
|
1445
1445
|
var m;
|
|
1446
|
-
return ((m =
|
|
1447
|
-
}).filter(
|
|
1448
|
-
(
|
|
1449
|
-
).reduce(
|
|
1450
|
-
(u, m) => {
|
|
1446
|
+
return ((m = d.skus) == null ? void 0 : m.flatMap((_) => _.amounts)) ?? [];
|
|
1447
|
+
}).filter((d) => d.amount.amount < 0).reduce(
|
|
1448
|
+
(d, m) => {
|
|
1451
1449
|
const _ = m.cost;
|
|
1452
|
-
if (!_) return
|
|
1450
|
+
if (!_) return d;
|
|
1453
1451
|
const x = {
|
|
1454
|
-
...bt(
|
|
1452
|
+
...bt(d, Math.max(d.precision, _.precision)),
|
|
1455
1453
|
currency: _.currency
|
|
1456
1454
|
};
|
|
1457
1455
|
return {
|
|
1458
1456
|
...Ue(x, _),
|
|
1459
|
-
currency:
|
|
1457
|
+
currency: d.currency
|
|
1460
1458
|
};
|
|
1461
1459
|
},
|
|
1462
1460
|
{
|
|
@@ -1476,16 +1474,18 @@ const Bn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, An = {
|
|
|
1476
1474
|
}
|
|
1477
1475
|
const q = R(() => {
|
|
1478
1476
|
var s;
|
|
1479
|
-
const $ = [...y.value].reverse().computeFirst((
|
|
1477
|
+
const $ = [...y.value].reverse().computeFirst((d) => {
|
|
1480
1478
|
var _, x;
|
|
1481
|
-
const m = (x = (_ =
|
|
1479
|
+
const m = (x = (_ = d.skus) == null ? void 0 : _.find) == null ? void 0 : x.call(_, (E) => E.sku._id === h.sku._id);
|
|
1482
1480
|
return m == null ? void 0 : m.toCostBalances;
|
|
1483
1481
|
});
|
|
1484
|
-
return $ ?
|
|
1485
|
-
|
|
1486
|
-
|
|
1482
|
+
return $ ? {
|
|
1483
|
+
...$.reduce((d, m) => Ye.add([d, Ye.fromDinero(m.cost)]), {
|
|
1484
|
+
amount: 0,
|
|
1485
|
+
precision: 0
|
|
1486
|
+
}),
|
|
1487
1487
|
currency: N(((s = l.currentCountry) == null ? void 0 : s.value) ?? Ne)
|
|
1488
|
-
}
|
|
1488
|
+
} : "No data";
|
|
1489
1489
|
});
|
|
1490
1490
|
function te() {
|
|
1491
1491
|
const { startDate: $, endDate: e } = $t(t.value);
|
|
@@ -1494,13 +1494,13 @@ const Bn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, An = {
|
|
|
1494
1494
|
endDate: e
|
|
1495
1495
|
});
|
|
1496
1496
|
}
|
|
1497
|
-
const
|
|
1497
|
+
const W = Re(h, "show");
|
|
1498
1498
|
return ($, e) => {
|
|
1499
|
-
const s = F("FmButton"),
|
|
1499
|
+
const s = F("FmButton"), d = F("FmField"), m = F("FmDateRangePicker"), _ = F("FmSpacer"), x = F("FmCircularProgress"), E = F("FmIcon"), K = F("FmTooltip"), J = F("FmCardSection"), se = F("FmCard"), A = F("FmSideSheet");
|
|
1500
1500
|
return k(), z(A, {
|
|
1501
1501
|
"dismiss-away": "",
|
|
1502
|
-
modelValue: C(
|
|
1503
|
-
"onUpdate:modelValue": e[4] || (e[4] = (T) => Ae(
|
|
1502
|
+
modelValue: C(W),
|
|
1503
|
+
"onUpdate:modelValue": e[4] || (e[4] = (T) => Ae(W) ? W.value = T : null),
|
|
1504
1504
|
"close-button": !1,
|
|
1505
1505
|
"max-width": 500
|
|
1506
1506
|
}, {
|
|
@@ -1510,7 +1510,7 @@ const Bn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, An = {
|
|
|
1510
1510
|
b(s, {
|
|
1511
1511
|
variant: "tertiary",
|
|
1512
1512
|
"prepend-icon": "close",
|
|
1513
|
-
onClick: e[0] || (e[0] = (T) =>
|
|
1513
|
+
onClick: e[0] || (e[0] = (T) => W.value = !1)
|
|
1514
1514
|
})
|
|
1515
1515
|
])
|
|
1516
1516
|
]),
|
|
@@ -1525,10 +1525,11 @@ const Bn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, An = {
|
|
|
1525
1525
|
"onUpdate:modelValue": e[1] || (e[1] = (H) => t.value = H),
|
|
1526
1526
|
"show-predefined-range": "",
|
|
1527
1527
|
"start-label": "",
|
|
1528
|
-
"end-label": ""
|
|
1528
|
+
"end-label": "",
|
|
1529
|
+
"z-index": 50
|
|
1529
1530
|
}, {
|
|
1530
1531
|
"trigger-button": D(({ opened: H }) => [
|
|
1531
|
-
b(
|
|
1532
|
+
b(d, {
|
|
1532
1533
|
"prepend-icon": "calendar_month",
|
|
1533
1534
|
focused: H
|
|
1534
1535
|
}, {
|
|
@@ -1581,9 +1582,9 @@ const Bn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, An = {
|
|
|
1581
1582
|
Gn,
|
|
1582
1583
|
n("div", Wn, V(U.value.REQUEST), 1)
|
|
1583
1584
|
]),
|
|
1584
|
-
n("div",
|
|
1585
|
-
|
|
1586
|
-
n("div",
|
|
1585
|
+
n("div", Jn, [
|
|
1586
|
+
Qn,
|
|
1587
|
+
n("div", Xn, V(U.value.RECEIVE), 1)
|
|
1587
1588
|
]),
|
|
1588
1589
|
n("div", Zn, [
|
|
1589
1590
|
eo,
|
|
@@ -1593,7 +1594,7 @@ const Bn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, An = {
|
|
|
1593
1594
|
oo,
|
|
1594
1595
|
n("div", so, V(L.value), 1)
|
|
1595
1596
|
]),
|
|
1596
|
-
C(
|
|
1597
|
+
C(c).enableTotalCost ? (k(), M("div", ao, [
|
|
1597
1598
|
n("div", lo, [
|
|
1598
1599
|
pe(" Estimated value "),
|
|
1599
1600
|
b(K, {
|
|
@@ -1611,13 +1612,9 @@ const Bn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, An = {
|
|
|
1611
1612
|
_: 1
|
|
1612
1613
|
})
|
|
1613
1614
|
]),
|
|
1614
|
-
n("div", ro, V(typeof q.value != "string" ? C(Fe)(
|
|
1615
|
-
q.value,
|
|
1616
|
-
!1,
|
|
1617
|
-
q.value.precision
|
|
1618
|
-
) : q.value), 1)
|
|
1615
|
+
n("div", ro, V(typeof q.value != "string" ? C(Fe)(q.value, !1, q.value.precision) : q.value), 1)
|
|
1619
1616
|
])) : Q("", !0),
|
|
1620
|
-
C(
|
|
1617
|
+
C(c).enableTotalCost ? (k(), M("div", io, [
|
|
1621
1618
|
n("div", uo, [
|
|
1622
1619
|
co,
|
|
1623
1620
|
b(K, {
|
|
@@ -1680,14 +1677,14 @@ const Bn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, An = {
|
|
|
1680
1677
|
}), bo = { class: "flex flex-col gap-24" }, ko = { key: 0 }, xo = { key: 0 }, So = { class: "flex items-center gap-8" }, $o = /* @__PURE__ */ n("div", { class: "flex-1" }, "Fetching info...", -1), wo = { key: 1 }, Co = { key: 2 }, Fo = { class: "flex flex-col w-full gap-24" }, Bo = { class: "fm-typo-en-body-lg-400" }, Ao = { class: "fm-typo-en-body-lg-600" }, Vo = /* @__PURE__ */ n("div", { class: "fm-typo-en-body-lg-400" }, "Proceed?", -1), Do = { key: 1 }, Mo = { class: "flex gap-8 justify-end" }, jo = /* @__PURE__ */ oe({
|
|
1681
1678
|
__name: "StockRecalculateDialog",
|
|
1682
1679
|
emits: ["close"],
|
|
1683
|
-
setup(
|
|
1680
|
+
setup(u, { emit: l }) {
|
|
1684
1681
|
const r = l, o = le(), v = fe(), g = R(() => {
|
|
1685
1682
|
var i;
|
|
1686
|
-
return ((i = o == null ? void 0 : o._currentLocation) == null ? void 0 : i.type) ===
|
|
1687
|
-
}),
|
|
1683
|
+
return ((i = o == null ? void 0 : o._currentLocation) == null ? void 0 : i.type) === Je.restaurant;
|
|
1684
|
+
}), c = P(null), h = P(!1), S = P(""), p = ie(), t = P(null);
|
|
1688
1685
|
Ve(f);
|
|
1689
1686
|
async function f() {
|
|
1690
|
-
|
|
1687
|
+
c.value = !0;
|
|
1691
1688
|
try {
|
|
1692
1689
|
const [i] = await Promise.all([
|
|
1693
1690
|
v.recalculation.getRecalculateAbility(),
|
|
@@ -1701,7 +1698,7 @@ const Bn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, An = {
|
|
|
1701
1698
|
message: "Please try again later."
|
|
1702
1699
|
}), S.value = "Something went wrong.";
|
|
1703
1700
|
} finally {
|
|
1704
|
-
|
|
1701
|
+
c.value = !1;
|
|
1705
1702
|
}
|
|
1706
1703
|
}
|
|
1707
1704
|
function y() {
|
|
@@ -1714,7 +1711,7 @@ const Bn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, An = {
|
|
|
1714
1711
|
const I = F("FmCircularProgress"), j = F("FmButton");
|
|
1715
1712
|
return k(), M("div", bo, [
|
|
1716
1713
|
g.value ? (k(), M("div", ko, [
|
|
1717
|
-
|
|
1714
|
+
c.value === null || c.value === !0 ? (k(), M("div", xo, [
|
|
1718
1715
|
n("div", So, [
|
|
1719
1716
|
n("div", null, [
|
|
1720
1717
|
b(I, { size: "lg" })
|
|
@@ -1749,10 +1746,10 @@ const Bn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, An = {
|
|
|
1749
1746
|
}
|
|
1750
1747
|
}), Ro = { class: "px-24 xs:p-0 sm:p-0 flex flex-col gap-8 h-full" }, Uo = { class: "px-8 flex gap-8 items-center xs:gap-0 xs:flex-col-reverse sm:gap-0 sm:flex-col-reverse h-48" }, Io = { class: "xs:w-full sm:w-full flex gap-8 items-center overflow-x-auto no-scrollbar py-8" }, To = { class: "flex-1 w-full" }, Po = { class: "flex flex-col gap-8" }, Eo = { class: "flex flex-col" }, Lo = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ho = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary line-clamp-1" }, as = /* @__PURE__ */ oe({
|
|
1751
1748
|
__name: "StockView",
|
|
1752
|
-
setup(
|
|
1749
|
+
setup(u) {
|
|
1753
1750
|
const l = Me(), r = le(), o = Ie(), v = vt(), {
|
|
1754
1751
|
columnDefs: g,
|
|
1755
|
-
stockHistoryProps:
|
|
1752
|
+
stockHistoryProps: c,
|
|
1756
1753
|
convertSkuDialogProps: h,
|
|
1757
1754
|
adjustSkuDialogProps: S,
|
|
1758
1755
|
showSkuHistory: p
|
|
@@ -1777,11 +1774,11 @@ const Bn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, An = {
|
|
|
1777
1774
|
}
|
|
1778
1775
|
const a = R(
|
|
1779
1776
|
() => l.skus.map((L) => {
|
|
1780
|
-
var te,
|
|
1777
|
+
var te, W, $;
|
|
1781
1778
|
const N = L.trackingMeasurement;
|
|
1782
|
-
let G = (
|
|
1779
|
+
let G = (W = (te = o.stockBalance.skus) == null ? void 0 : te.find(
|
|
1783
1780
|
(e) => e.id === L._id
|
|
1784
|
-
)) == null ? void 0 :
|
|
1781
|
+
)) == null ? void 0 : W.balance, Y = v.inventoryForecast.skus.find(
|
|
1785
1782
|
(e) => e.id === L._id
|
|
1786
1783
|
);
|
|
1787
1784
|
return {
|
|
@@ -1796,7 +1793,7 @@ const Bn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, An = {
|
|
|
1796
1793
|
})
|
|
1797
1794
|
), I = P(""), { breakpoints: j } = ut(), w = R(() => j.value.xs || j.value.sm ? 10 : 20), B = mt(), U = R(() => {
|
|
1798
1795
|
var N;
|
|
1799
|
-
return ((N = r._currentLocation) == null ? void 0 : N.type) ===
|
|
1796
|
+
return ((N = r._currentLocation) == null ? void 0 : N.type) === Je.restaurant ? [
|
|
1800
1797
|
{
|
|
1801
1798
|
label: "Refresh",
|
|
1802
1799
|
icon: "refresh",
|
|
@@ -1826,7 +1823,7 @@ const Bn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, An = {
|
|
|
1826
1823
|
const G = F("FmTableToolbar"), Y = F("FmMenuDivider"), q = F("FmTable");
|
|
1827
1824
|
return k(), z(lt, { title: "Stock" }, {
|
|
1828
1825
|
default: D(() => {
|
|
1829
|
-
var te,
|
|
1826
|
+
var te, W, $, e;
|
|
1830
1827
|
return [
|
|
1831
1828
|
n("div", Ro, [
|
|
1832
1829
|
n("div", Uo, [
|
|
@@ -1861,21 +1858,21 @@ const Bn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, An = {
|
|
|
1861
1858
|
row: s,
|
|
1862
1859
|
onRowClick: C(p)
|
|
1863
1860
|
}, {
|
|
1864
|
-
default: D((
|
|
1861
|
+
default: D((d) => {
|
|
1865
1862
|
var m, _, x, E, K, J, se, A, T, H;
|
|
1866
1863
|
return [
|
|
1867
1864
|
n("div", Po, [
|
|
1868
1865
|
n("div", Eo, [
|
|
1869
1866
|
n("div", Lo, [
|
|
1870
1867
|
b(C(Oe), {
|
|
1871
|
-
render: (x = (_ = (m =
|
|
1872
|
-
props: (K = (E =
|
|
1868
|
+
render: (x = (_ = (m = d.code) == null ? void 0 : m.column) == null ? void 0 : _.columnDef) == null ? void 0 : x.cell,
|
|
1869
|
+
props: (K = (E = d.code) == null ? void 0 : E.getContext) == null ? void 0 : K.call(E)
|
|
1873
1870
|
}, null, 8, ["render", "props"])
|
|
1874
1871
|
]),
|
|
1875
1872
|
n("div", Ho, [
|
|
1876
1873
|
b(C(Oe), {
|
|
1877
|
-
render: (A = (se = (J =
|
|
1878
|
-
props: (H = (T =
|
|
1874
|
+
render: (A = (se = (J = d.name) == null ? void 0 : J.column) == null ? void 0 : se.columnDef) == null ? void 0 : A.cell,
|
|
1875
|
+
props: (H = (T = d.name) == null ? void 0 : T.getContext) == null ? void 0 : H.call(T)
|
|
1879
1876
|
}, null, 8, ["render", "props"])
|
|
1880
1877
|
])
|
|
1881
1878
|
]),
|
|
@@ -1903,7 +1900,7 @@ const Bn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, An = {
|
|
|
1903
1900
|
}, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"]))
|
|
1904
1901
|
]),
|
|
1905
1902
|
(k(), z(at, { to: "body" }, [
|
|
1906
|
-
(
|
|
1903
|
+
(W = C(c)) != null && W.sku ? (k(), z(ho, ke(xe({ key: 0 }, C(c))), null, 16)) : Q("", !0),
|
|
1907
1904
|
($ = C(h)) != null && $.sku ? (k(), z(an, ke(xe({ key: 1 }, C(h))), null, 16)) : Q("", !0),
|
|
1908
1905
|
(e = C(S)) != null && e.stock ? (k(), z(fn, ke(xe({ key: 2 }, C(S))), null, 16)) : Q("", !0)
|
|
1909
1906
|
]))
|