@feedmepos/mf-inventory-portal 0.0.21-dev.4 → 0.0.21-dev.5
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-BHoJzHuo.js +129 -0
- package/dist/{BindingsDialog-BFLeun5L.js → BindingsDialog-sUZjZtSl.js} +1 -1
- package/dist/{BindingsPicker-CnjJZH9t.js → BindingsPicker-CqzSUVc_.js} +1 -1
- package/dist/{BindingsTable-C3VTa0YL.js → BindingsTable-C1o5EgLy.js} +1 -1
- package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DYBTXD_J.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-CpN5Kn8b.js} +1 -1
- package/dist/{IngredientsView-CQYJfAze.js → IngredientsView-CrXPIQme.js} +99 -91
- package/dist/IntegrationView-BJT-KMVp.js +1141 -0
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-Wv8RvXJL.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DH0CcGmX.js} +1 -1
- package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-DsOGlAb7.js → PremiumBadge.vue_vue_type_script_setup_true_lang-kJKVCH40.js} +1 -1
- package/dist/{PurchaseOrderPrintPreview-B0hDduXB.js → PurchaseOrderPrintPreview-k26o__vy.js} +1 -1
- package/dist/ReceiveRequestView-ysOzzBTW.js +216 -0
- package/dist/{RecipeView-DYKhSgtw.js → RecipeView-DAH8YIzY.js} +182 -174
- package/dist/{StockView-BIGGG87A.js → StockView-BlCpuSLe.js} +547 -539
- package/dist/{SupplierView-DQzopnzt.js → SupplierView-Bwknjcke.js} +263 -255
- package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-D8-sMRGm.js → TransferDetails.vue_vue_type_script_setup_true_lang-LCNiBfi7.js} +3 -3
- package/dist/{TransferDialog.vue_vue_type_script_setup_true_lang-CSUnXAyq.js → TransferDialog.vue_vue_type_script_setup_true_lang-BDvtif2q.js} +4 -4
- package/dist/{TransferTemplateView-DWF54okN.js → TransferTemplateView-DcMdNiH6.js} +372 -364
- package/dist/{UnitView-Cdw8xxzV.js → UnitView-BVMr4KlR.js} +186 -178
- package/dist/{WarehouseView-DOelxuIh.js → WarehouseView-Dd-e-IlG.js} +388 -380
- package/dist/{app-SBnQEeEV.js → app-S6iG6Hux.js} +4 -4
- package/dist/app.js +1 -1
- package/dist/{decimal-BlEB2PrM.js → decimal-nOOdFIFP.js} +1 -1
- package/dist/{id-to-date-Y6berpHs.js → id-to-date-CKQ0n3Qi.js} +1 -1
- package/dist/{purchase-order-transaction-type-Dp0wsGal.js → purchase-order-transaction-type-CQ-RpJ0h.js} +2 -2
- package/dist/{supplier-I_rYvljH.js → supplier-DQsAfn3q.js} +1 -1
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{xlsx-DGwG2ekM.js → xlsx-Dgjf-KvE.js} +1 -1
- package/dist/{xlsx.util-Dsf-EgrG.js → xlsx.util-CODYzgF8.js} +2 -2
- package/package.json +3 -3
- package/dist/ApprovalView-BS4jzhAR.js +0 -121
- package/dist/IntegrationView-9V2OcyP_.js +0 -1172
- package/dist/ReceiveRequestView-3boFHkOO.js +0 -208
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { ref as
|
|
2
|
-
import { i as ct, u as dt, _ as mt, a as pt } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-
|
|
3
|
-
import { n as Xe, j as ue, o as vt, c as Pe, p as ft, u as Te, q as Oe, r as De, a as ie, k as yt, t as
|
|
1
|
+
import { ref as H, defineComponent as re, computed as U, resolveComponent as M, openBlock as B, createBlock as O, withCtx as D, createElementVNode as n, normalizeClass as he, toDisplayString as b, createVNode as x, createElementBlock as L, Fragment as ne, renderList as ae, unref as v, h as ye, watch as ge, isRef as Ue, createCommentVNode as te, reactive as it, onMounted as Je, normalizeStyle as Qe, createTextVNode as ve, Teleport as ut, normalizeProps as we, mergeProps as Be } from "vue";
|
|
2
|
+
import { i as ct, u as dt, _ as mt, a as pt } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-CpN5Kn8b.js";
|
|
3
|
+
import { n as Xe, j as ue, o as vt, c as Pe, p as ft, u as Te, q as Oe, r as De, a as ie, k as yt, t as be, m as Me, A as _t, M as kt, l as fe, s as ht, v as ee, w as gt, x as ze, R as bt, y as xt, z as St, B as Ze, D as W, E as $t, f as et, G as je, H as wt, d as Ye, b as Bt, J as Ft, K as At, C as Fe, L as Vt, N as Ct, O as Dt, P as Mt } from "./app-S6iG6Hux.js";
|
|
4
4
|
import { useCoreStore as tt, useI18n as le } from "@feedmepos/mf-common";
|
|
5
5
|
import { useSnackbar as de, useDialog as nt, useProxiedModel as Re, useBreakpoints as jt } from "@feedmepos/ui-library";
|
|
6
6
|
import { c as It, _ as Ut, F as Ke } from "./TableActionableRow.vue_vue_type_script_setup_true_lang-DlNJ6kRg.js";
|
|
7
|
-
import { g as
|
|
8
|
-
import { e as Pt, i as ot } from "./id-to-date-
|
|
9
|
-
import { _ as Ie, S as
|
|
7
|
+
import { g as xe } from "./decimal-nOOdFIFP.js";
|
|
8
|
+
import { e as Pt, i as ot } from "./id-to-date-CKQ0n3Qi.js";
|
|
9
|
+
import { _ as Ie, S as Ae, g as st } from "./StockForecast.vue_vue_type_style_index_0_lang-KLXSWvo5.js";
|
|
10
10
|
import { _ as Tt } from "./PreviewBadge.vue_vue_type_script_setup_true_lang-CRZiQHjx.js";
|
|
11
|
-
import { u as at, _ as Ge } from "./PremiumBadge.vue_vue_type_script_setup_true_lang-
|
|
11
|
+
import { u as at, _ as Ge } from "./PremiumBadge.vue_vue_type_script_setup_true_lang-kJKVCH40.js";
|
|
12
12
|
import { defineStore as Rt } from "pinia";
|
|
13
|
-
import { _ as Ht } from "./NumberPrecisionInput.vue_vue_type_script_setup_true_lang-
|
|
13
|
+
import { _ as Ht } from "./NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DH0CcGmX.js";
|
|
14
14
|
import { E as Et } from "./empty-placeholder-wf6-BWE8.js";
|
|
15
15
|
import "./array-ClJzD_Lt.js";
|
|
16
|
-
const
|
|
16
|
+
const $e = Xe((c, d) => {
|
|
17
17
|
const r = ue(), s = tt(), S = de();
|
|
18
18
|
return d.onError(async (l) => {
|
|
19
19
|
l.name === "SvcForbiddenError" && (S == null || S.open({
|
|
@@ -27,16 +27,16 @@ const Se = Xe((c, d) => {
|
|
|
27
27
|
return await d.get(a);
|
|
28
28
|
},
|
|
29
29
|
async readSkuBalance() {
|
|
30
|
-
var
|
|
30
|
+
var g;
|
|
31
31
|
const l = r.currentLocationDBName, a = `${c.inventoryBackendUrl}/${l}/sku/balance`;
|
|
32
|
-
return (((
|
|
32
|
+
return (((g = s.currentBusiness.value) == null ? void 0 : g.menuVersion) ?? "") === "v3" ? await d.get(a) : await d.get(`${a}?useInventoryDoc=true`);
|
|
33
33
|
},
|
|
34
34
|
async readSingleAdjustment(l) {
|
|
35
35
|
const a = r.currentLocationDBName, i = `${c.inventoryBackendUrl}/${a}/adjustment`;
|
|
36
36
|
return await d.get(`${i}?adjustmentId=${l}`);
|
|
37
37
|
},
|
|
38
38
|
async readStockAdjustment(l, a, i) {
|
|
39
|
-
const
|
|
39
|
+
const g = r.currentLocationDBName, k = `${c.inventoryBackendUrl}/${g}/sku`;
|
|
40
40
|
return await d.get(`${k}?skuId=${l}&start=${a}&end=${i}`);
|
|
41
41
|
},
|
|
42
42
|
async convertSku(l) {
|
|
@@ -51,13 +51,13 @@ const Se = Xe((c, d) => {
|
|
|
51
51
|
},
|
|
52
52
|
recalculation: {
|
|
53
53
|
getRecalculateAbility() {
|
|
54
|
-
var
|
|
55
|
-
const a = `business_${(
|
|
54
|
+
var g;
|
|
55
|
+
const a = `business_${(g = s.currentBusiness.value) == null ? void 0 : g._id}`, i = `${c.inventoryBackendUrl}/${a}/stock/operations/recalculate`;
|
|
56
56
|
return d.get(i);
|
|
57
57
|
},
|
|
58
58
|
startRecalculateTask() {
|
|
59
|
-
var
|
|
60
|
-
const a = `business_${(
|
|
59
|
+
var g;
|
|
60
|
+
const a = `business_${(g = s.currentBusiness.value) == null ? void 0 : g._id}`, i = `${c.inventoryBackendUrl}/${a}/stock/operations/recalculate?refundFromPreviousAdjustment=true`;
|
|
61
61
|
return d.post(i);
|
|
62
62
|
}
|
|
63
63
|
}
|
|
@@ -72,8 +72,8 @@ function Lt() {
|
|
|
72
72
|
productBalance: []
|
|
73
73
|
};
|
|
74
74
|
}
|
|
75
|
-
const _e =
|
|
76
|
-
const c =
|
|
75
|
+
const _e = H(Lt()), He = () => {
|
|
76
|
+
const c = $e();
|
|
77
77
|
return {
|
|
78
78
|
// state
|
|
79
79
|
get stockBalance() {
|
|
@@ -147,15 +147,15 @@ async function zt(c) {
|
|
|
147
147
|
{
|
|
148
148
|
name: "Balance",
|
|
149
149
|
selector: (s) => {
|
|
150
|
-
const S =
|
|
151
|
-
return S.type === "unit" ?
|
|
150
|
+
const S = Se(s, s.unit);
|
|
151
|
+
return S.type === "unit" ? xe(s.balance, s.unit, null, !1) : xe(s.balance, s.unit, S.measurement, !1);
|
|
152
152
|
}
|
|
153
153
|
},
|
|
154
154
|
{
|
|
155
155
|
name: "Unit",
|
|
156
156
|
selector: (s) => {
|
|
157
157
|
var l;
|
|
158
|
-
const S =
|
|
158
|
+
const S = Se(s, s.unit);
|
|
159
159
|
return S.type === "unit" ? s.unit.abbrev : ((l = s.unit.measurements.find((a) => a.id === S.measurement)) == null ? void 0 : l.abbrev) || "";
|
|
160
160
|
}
|
|
161
161
|
}
|
|
@@ -165,7 +165,7 @@ async function zt(c) {
|
|
|
165
165
|
r
|
|
166
166
|
);
|
|
167
167
|
}
|
|
168
|
-
function
|
|
168
|
+
function Se(c, d) {
|
|
169
169
|
const r = localStorage.getItem(`uom:${c._id}`);
|
|
170
170
|
return r ? r === d._id ? {
|
|
171
171
|
type: "unit"
|
|
@@ -195,17 +195,17 @@ const Yt = { class: "fm-typo-en-body-md-400 flex-grow" }, rt = /* @__PURE__ */ r
|
|
|
195
195
|
}
|
|
196
196
|
function r(k) {
|
|
197
197
|
const u = d(s.sku);
|
|
198
|
-
k ? localStorage.setItem(u, k) : localStorage.setItem(u, s.unit._id), S.value =
|
|
198
|
+
k ? localStorage.setItem(u, k) : localStorage.setItem(u, s.unit._id), S.value = Se(s.sku, s.unit);
|
|
199
199
|
}
|
|
200
|
-
const s = c, S =
|
|
200
|
+
const s = c, S = H(Se(s.sku, s.unit)), l = U(() => {
|
|
201
201
|
const { measurements: k } = s.unit;
|
|
202
202
|
return [
|
|
203
203
|
{
|
|
204
|
-
label: `${
|
|
204
|
+
label: `${xe(s.amount, s.unit)}`,
|
|
205
205
|
value: null
|
|
206
206
|
},
|
|
207
207
|
...k.map(({ id: u }) => ({
|
|
208
|
-
label: `${
|
|
208
|
+
label: `${xe(s.amount, s.unit, u)}`,
|
|
209
209
|
value: u
|
|
210
210
|
}))
|
|
211
211
|
];
|
|
@@ -213,24 +213,24 @@ const Yt = { class: "fm-typo-en-body-md-400 flex-grow" }, rt = /* @__PURE__ */ r
|
|
|
213
213
|
function a({ value: k }) {
|
|
214
214
|
return v(S).type === "unit" ? k === null : k === v(S).measurement;
|
|
215
215
|
}
|
|
216
|
-
const i =
|
|
216
|
+
const i = U(
|
|
217
217
|
() => {
|
|
218
218
|
var k;
|
|
219
219
|
return ((k = l.value.find((u) => a(u))) == null ? void 0 : k.label) ?? "";
|
|
220
220
|
}
|
|
221
|
-
),
|
|
221
|
+
), g = H(!1);
|
|
222
222
|
return (k, u) => {
|
|
223
|
-
const o =
|
|
224
|
-
return B(), O(
|
|
223
|
+
const o = M("FmIcon"), $ = M("FmMenuItem"), F = M("FmMenu");
|
|
224
|
+
return B(), O(F, {
|
|
225
225
|
"stop-click-propagation": "",
|
|
226
|
-
onMenuChanged: u[0] || (u[0] = (
|
|
226
|
+
onMenuChanged: u[0] || (u[0] = (h) => g.value = h)
|
|
227
227
|
}, {
|
|
228
|
-
"menu-button":
|
|
228
|
+
"menu-button": D(() => [
|
|
229
229
|
n("button", {
|
|
230
230
|
type: "button",
|
|
231
|
-
class:
|
|
231
|
+
class: he([
|
|
232
232
|
"w-full text-left flex items-center gap-8 cursor-pointer fm-corner-radius-sm px-8 py-4 border bg-white",
|
|
233
|
-
|
|
233
|
+
g.value ? "border-fm-color-primary" : "border-fm-color-neutral-gray-100"
|
|
234
234
|
])
|
|
235
235
|
}, [
|
|
236
236
|
n("div", Yt, b(i.value), 1),
|
|
@@ -240,12 +240,12 @@ const Yt = { class: "fm-typo-en-body-md-400 flex-grow" }, rt = /* @__PURE__ */ r
|
|
|
240
240
|
})
|
|
241
241
|
], 2)
|
|
242
242
|
]),
|
|
243
|
-
default:
|
|
244
|
-
(B(!0), L(
|
|
245
|
-
key:
|
|
246
|
-
label:
|
|
247
|
-
"model-value": a(
|
|
248
|
-
onClick: (p) => r(
|
|
243
|
+
default: D(() => [
|
|
244
|
+
(B(!0), L(ne, null, ae(l.value, (h) => (B(), O($, {
|
|
245
|
+
key: h.value ?? 0,
|
|
246
|
+
label: h.label,
|
|
247
|
+
"model-value": a(h),
|
|
248
|
+
onClick: (p) => r(h.value)
|
|
249
249
|
}, null, 8, ["label", "model-value", "onClick"]))), 128))
|
|
250
250
|
]),
|
|
251
251
|
_: 1
|
|
@@ -257,14 +257,14 @@ const Yt = { class: "fm-typo-en-body-md-400 flex-grow" }, rt = /* @__PURE__ */ r
|
|
|
257
257
|
setup(c) {
|
|
258
258
|
const { t: d } = le();
|
|
259
259
|
return (r, s) => (B(), O(Tt, null, {
|
|
260
|
-
default:
|
|
260
|
+
default: D(() => [
|
|
261
261
|
n("div", Kt, b(v(d)("inventory.stock.prediction.daysRemaining")), 1)
|
|
262
262
|
]),
|
|
263
263
|
_: 1
|
|
264
264
|
}));
|
|
265
265
|
}
|
|
266
266
|
}), lt = Rt("stockActions", () => {
|
|
267
|
-
const c =
|
|
267
|
+
const c = H(!1), d = ue(), r = He(), s = at(), S = de(), l = nt(), { t: a } = le();
|
|
268
268
|
async function i() {
|
|
269
269
|
if (d._currentLocation) {
|
|
270
270
|
c.value = !0;
|
|
@@ -281,74 +281,74 @@ const Yt = { class: "fm-typo-en-body-md-400 flex-grow" }, rt = /* @__PURE__ */ r
|
|
|
281
281
|
}
|
|
282
282
|
}
|
|
283
283
|
}
|
|
284
|
-
const
|
|
284
|
+
const g = H();
|
|
285
285
|
async function k(p) {
|
|
286
|
-
var
|
|
287
|
-
if (!!!((
|
|
286
|
+
var w, C, P;
|
|
287
|
+
if (!!!((C = (w = p.convert) == null ? void 0 : w.inventoryBindings) != null && C.length)) {
|
|
288
288
|
l.open({
|
|
289
289
|
title: a("inventory.stock.error.convert.title"),
|
|
290
290
|
message: a("inventory.stock.error.convert.message")
|
|
291
291
|
});
|
|
292
292
|
return;
|
|
293
293
|
}
|
|
294
|
-
const
|
|
295
|
-
maxCount: ((
|
|
294
|
+
const V = {
|
|
295
|
+
maxCount: ((P = r.productBalance.find(({ id: T }) => T === p._id)) == null ? void 0 : P.count) || 0,
|
|
296
296
|
sku: p,
|
|
297
297
|
show: !0,
|
|
298
|
-
"onUpdate:show"(
|
|
299
|
-
|
|
298
|
+
"onUpdate:show"(T) {
|
|
299
|
+
g.value.show = T;
|
|
300
300
|
},
|
|
301
301
|
onSubmitted() {
|
|
302
302
|
i();
|
|
303
303
|
}
|
|
304
304
|
};
|
|
305
|
-
|
|
305
|
+
g.value = V;
|
|
306
306
|
}
|
|
307
|
-
const u =
|
|
307
|
+
const u = H();
|
|
308
308
|
async function o(p) {
|
|
309
|
-
const
|
|
309
|
+
const j = {
|
|
310
310
|
stock: p,
|
|
311
311
|
show: !0,
|
|
312
|
-
"onUpdate:show"(
|
|
313
|
-
u.value.show =
|
|
312
|
+
"onUpdate:show"(E) {
|
|
313
|
+
u.value.show = E;
|
|
314
314
|
},
|
|
315
315
|
onSubmitted() {
|
|
316
316
|
i();
|
|
317
317
|
}
|
|
318
318
|
};
|
|
319
|
-
u.value =
|
|
319
|
+
u.value = j;
|
|
320
320
|
}
|
|
321
|
-
const
|
|
322
|
-
async function
|
|
323
|
-
const
|
|
321
|
+
const $ = H();
|
|
322
|
+
async function F(p) {
|
|
323
|
+
const j = {
|
|
324
324
|
sku: p,
|
|
325
325
|
show: !0,
|
|
326
|
-
"onUpdate:show"(
|
|
327
|
-
|
|
326
|
+
"onUpdate:show"(E) {
|
|
327
|
+
$.value.show = E;
|
|
328
328
|
}
|
|
329
329
|
};
|
|
330
|
-
|
|
330
|
+
$.value = j;
|
|
331
331
|
}
|
|
332
|
-
function
|
|
333
|
-
const
|
|
332
|
+
function h(p, j) {
|
|
333
|
+
const E = Pe(j);
|
|
334
334
|
switch (p) {
|
|
335
335
|
case ke.History:
|
|
336
|
-
|
|
336
|
+
F(E);
|
|
337
337
|
return;
|
|
338
338
|
case ke.Convert:
|
|
339
|
-
k(
|
|
339
|
+
k(E);
|
|
340
340
|
return;
|
|
341
341
|
case ke.Adjust:
|
|
342
|
-
o(
|
|
342
|
+
o(E);
|
|
343
343
|
return;
|
|
344
344
|
}
|
|
345
345
|
}
|
|
346
346
|
return {
|
|
347
347
|
fetchStockBalance: i,
|
|
348
|
-
onActionMenu:
|
|
349
|
-
stockHistoryProps:
|
|
350
|
-
showSkuHistory:
|
|
351
|
-
convertSkuDialogProps:
|
|
348
|
+
onActionMenu: h,
|
|
349
|
+
stockHistoryProps: $,
|
|
350
|
+
showSkuHistory: F,
|
|
351
|
+
convertSkuDialogProps: g,
|
|
352
352
|
adjustSkuDialogProps: u
|
|
353
353
|
};
|
|
354
354
|
});
|
|
@@ -395,10 +395,10 @@ function qt() {
|
|
|
395
395
|
return ye(Ie, {
|
|
396
396
|
days: l
|
|
397
397
|
});
|
|
398
|
-
const
|
|
398
|
+
const g = l <= a ? Ae.low : l <= i ? Ae.mid : Ae.high;
|
|
399
399
|
return ye(Ie, {
|
|
400
400
|
days: l,
|
|
401
|
-
level:
|
|
401
|
+
level: g
|
|
402
402
|
});
|
|
403
403
|
},
|
|
404
404
|
size: 200
|
|
@@ -468,94 +468,94 @@ const Jt = { class: "flex items-center" }, Qt = { class: "fm-typo-en-title-md-80
|
|
|
468
468
|
},
|
|
469
469
|
emits: ["update:show", "submitted"],
|
|
470
470
|
setup(c, { expose: d, emit: r }) {
|
|
471
|
-
const s = c, S = r, l = ft(), a = Te(), i =
|
|
471
|
+
const s = c, S = r, l = ft(), a = Te(), i = $e(), g = de(), { t: k } = le(), u = H(0), o = H(null), $ = U(() => a.skus), F = U(
|
|
472
472
|
() => {
|
|
473
|
-
var
|
|
474
|
-
return (((
|
|
473
|
+
var t, e;
|
|
474
|
+
return (((e = (t = s.sku) == null ? void 0 : t.convert) == null ? void 0 : e.inventoryBindings) ?? []).filter(
|
|
475
475
|
(f) => f.type === Oe.enum.SKU
|
|
476
476
|
);
|
|
477
477
|
}
|
|
478
|
-
),
|
|
478
|
+
), h = U({
|
|
479
479
|
get() {
|
|
480
480
|
return !!o.value;
|
|
481
481
|
},
|
|
482
|
-
set(
|
|
483
|
-
|
|
482
|
+
set(t) {
|
|
483
|
+
t ? o.value = Pe(F.value) : (o.value = null, u.value = Math.min(u.value, s.maxCount ?? 0));
|
|
484
484
|
}
|
|
485
|
-
}), p =
|
|
486
|
-
|
|
487
|
-
|
|
485
|
+
}), p = H(!1);
|
|
486
|
+
ge([() => s.show], ([t]) => {
|
|
487
|
+
t && (u.value = 0);
|
|
488
488
|
});
|
|
489
|
-
function
|
|
490
|
-
|
|
489
|
+
function j() {
|
|
490
|
+
Q(s.sku, be(u.value), o.value);
|
|
491
491
|
}
|
|
492
|
-
function
|
|
492
|
+
function E(t) {
|
|
493
493
|
if (o.value)
|
|
494
494
|
return !0;
|
|
495
|
-
const
|
|
496
|
-
return
|
|
495
|
+
const e = qe(t).isInteger().max(s.maxCount ?? 0).error ?? "";
|
|
496
|
+
return e || !0;
|
|
497
497
|
}
|
|
498
|
-
function
|
|
498
|
+
function V(t) {
|
|
499
499
|
var y;
|
|
500
|
-
const
|
|
501
|
-
var
|
|
502
|
-
return
|
|
503
|
-
}) ?? null : null, f = De(s.sku.unit,
|
|
500
|
+
const e = (y = s.sku.convert) != null && y.measurement ? s.sku.unit.measurements.find((A) => {
|
|
501
|
+
var z;
|
|
502
|
+
return A.id === ((z = s.sku.convert) == null ? void 0 : z.measurement);
|
|
503
|
+
}) ?? null : null, f = De(s.sku.unit, e), m = ht(+t);
|
|
504
504
|
return qe(m).isInteger().max(f).error ? "Precision cannot be more than " + f : !0;
|
|
505
505
|
}
|
|
506
|
-
const
|
|
506
|
+
const w = U(
|
|
507
507
|
() => {
|
|
508
|
-
var
|
|
509
|
-
return (
|
|
508
|
+
var t, e;
|
|
509
|
+
return (t = s.sku.convert) != null && t.measurement ? (e = s.sku.unit.measurements.find((f) => {
|
|
510
510
|
var m;
|
|
511
511
|
return f.id === ((m = s.sku.convert) == null ? void 0 : m.measurement);
|
|
512
|
-
})) == null ? void 0 :
|
|
512
|
+
})) == null ? void 0 : e.abbrev : s.sku.unit.abbrev;
|
|
513
513
|
}
|
|
514
|
-
),
|
|
514
|
+
), C = U(() => {
|
|
515
515
|
var f, m, _;
|
|
516
|
-
const
|
|
517
|
-
return (_ = o.value ??
|
|
518
|
-
var
|
|
519
|
-
const
|
|
516
|
+
const t = (m = (f = s.sku.convert) == null ? void 0 : f.inventoryBindings) == null ? void 0 : m.filter((y) => y.type === "SKU");
|
|
517
|
+
return (_ = o.value ?? t) == null ? void 0 : _.map((y) => {
|
|
518
|
+
var Z, q, se, Ee, Le;
|
|
519
|
+
const A = a.skus.find((pe) => pe._id === y.id), z = ((Z = y.measurement) == null ? void 0 : Z.abbrev) ?? ((q = A == null ? void 0 : A.unit) == null ? void 0 : q.abbrev), X = (se = s.sku.convert) != null && se.measurement ? s.sku.unit.measurements.find((pe) => {
|
|
520
520
|
var Ne;
|
|
521
521
|
return pe.id === ((Ne = s.sku.convert) == null ? void 0 : Ne.measurement);
|
|
522
|
-
}) ?? null : null, me = De(s.sku.unit,
|
|
522
|
+
}) ?? null : null, me = De(s.sku.unit, X), I = V(`${u.value}`) === !0 ? ie(
|
|
523
523
|
yt(
|
|
524
524
|
y.amount,
|
|
525
|
-
|
|
525
|
+
be(+u.value, me)
|
|
526
526
|
),
|
|
527
527
|
!1
|
|
528
|
-
) : "0",
|
|
528
|
+
) : "0", G = (Le = (Ee = o.value) == null ? void 0 : Ee.find((pe) => pe.id === (A == null ? void 0 : A._id))) == null ? void 0 : Le.amount, J = G ? ie(G, !1) : null;
|
|
529
529
|
return {
|
|
530
|
-
sku:
|
|
531
|
-
convertAmount: J ??
|
|
532
|
-
abbrev:
|
|
530
|
+
sku: A,
|
|
531
|
+
convertAmount: J ?? I,
|
|
532
|
+
abbrev: z
|
|
533
533
|
};
|
|
534
534
|
});
|
|
535
|
-
}),
|
|
535
|
+
}), P = H();
|
|
536
536
|
d({
|
|
537
537
|
validateInputs: () => {
|
|
538
|
-
var
|
|
539
|
-
(
|
|
538
|
+
var t, e;
|
|
539
|
+
(e = (t = P.value) == null ? void 0 : t.validateInputs) == null || e.call(t);
|
|
540
540
|
},
|
|
541
541
|
resetInputsValidation: () => {
|
|
542
|
-
var
|
|
543
|
-
(
|
|
542
|
+
var t, e;
|
|
543
|
+
(e = (t = P.value) == null ? void 0 : t.resetInputsValidation) == null || e.call(t);
|
|
544
544
|
},
|
|
545
545
|
resetInputs: () => {
|
|
546
|
-
var
|
|
547
|
-
(
|
|
546
|
+
var t, e;
|
|
547
|
+
(e = (t = P.value) == null ? void 0 : t.resetInputs) == null || e.call(t);
|
|
548
548
|
}
|
|
549
549
|
});
|
|
550
|
-
const
|
|
551
|
-
async function
|
|
550
|
+
const T = Re(s, "show");
|
|
551
|
+
async function Q(t, e, f) {
|
|
552
552
|
p.value = !0;
|
|
553
553
|
try {
|
|
554
554
|
await i.convertSku({
|
|
555
555
|
conversions: [
|
|
556
556
|
{
|
|
557
|
-
doc:
|
|
558
|
-
amount:
|
|
557
|
+
doc: t,
|
|
558
|
+
amount: e,
|
|
559
559
|
overrides: f == null ? void 0 : f.map((m) => ({
|
|
560
560
|
...m,
|
|
561
561
|
amount: {
|
|
@@ -568,93 +568,93 @@ const Jt = { class: "flex items-center" }, Qt = { class: "fm-typo-en-title-md-80
|
|
|
568
568
|
]
|
|
569
569
|
}), S("update:show", !1), S("submitted");
|
|
570
570
|
} catch (m) {
|
|
571
|
-
|
|
571
|
+
g.open({
|
|
572
572
|
title: "Something went wrong",
|
|
573
|
-
message: `Cannot convert ${
|
|
573
|
+
message: `Cannot convert ${t.name}. Please try again.`,
|
|
574
574
|
type: "error"
|
|
575
|
-
}), console.error("error at converting stock amount",
|
|
575
|
+
}), console.error("error at converting stock amount", t, e, m);
|
|
576
576
|
} finally {
|
|
577
577
|
p.value = !1;
|
|
578
578
|
}
|
|
579
579
|
}
|
|
580
|
-
function
|
|
581
|
-
const m = +
|
|
580
|
+
function Y(t, e, f) {
|
|
581
|
+
const m = +e;
|
|
582
582
|
let _ = f;
|
|
583
|
-
|
|
583
|
+
e.length > 0 && isFinite(m) ? _ = f.map((y) => (y.id !== t || (y.amount = fe(m)), y)) : _ = f.map((y) => (y.id !== t || (y.amount = { amount: 0, precision: 0 }), y)), o.value = _;
|
|
584
584
|
}
|
|
585
|
-
function
|
|
586
|
-
const
|
|
587
|
-
return
|
|
585
|
+
function N(t) {
|
|
586
|
+
const e = $.value.find((f) => f._id === t);
|
|
587
|
+
return e ? st(e.unit, !0) : [];
|
|
588
588
|
}
|
|
589
|
-
function
|
|
590
|
-
const f =
|
|
589
|
+
function R(t, e) {
|
|
590
|
+
const f = N(t), m = f.find((_) => _.value === e) ?? f.find((_) => _.value === null);
|
|
591
591
|
return m ? {
|
|
592
592
|
...m,
|
|
593
593
|
label: m.abbrev
|
|
594
594
|
} : null;
|
|
595
595
|
}
|
|
596
|
-
function
|
|
596
|
+
function K(t, e, f) {
|
|
597
597
|
let m;
|
|
598
|
-
if (
|
|
599
|
-
m = f.map((_) => (_.id !==
|
|
598
|
+
if (e === null)
|
|
599
|
+
m = f.map((_) => (_.id !== t || (_.measurement = null), _)) ?? [];
|
|
600
600
|
else {
|
|
601
|
-
const _ =
|
|
601
|
+
const _ = $.value.find((y) => y._id === t);
|
|
602
602
|
m = f.map((y) => {
|
|
603
|
-
var
|
|
604
|
-
return y.id !==
|
|
603
|
+
var A, z;
|
|
604
|
+
return y.id !== t || (y.measurement = (z = (A = _ == null ? void 0 : _.unit) == null ? void 0 : A.measurements) == null ? void 0 : z.find((X) => X.id === e)), y;
|
|
605
605
|
}) ?? [];
|
|
606
606
|
}
|
|
607
607
|
o.value = m;
|
|
608
608
|
}
|
|
609
|
-
function ce(
|
|
610
|
-
const f =
|
|
609
|
+
function ce(t, e) {
|
|
610
|
+
const f = e.filter((m) => m.id !== t);
|
|
611
611
|
o.value = f;
|
|
612
612
|
}
|
|
613
613
|
function oe() {
|
|
614
|
-
const
|
|
615
|
-
...
|
|
614
|
+
const t = (o.value ?? []).map((e) => ({
|
|
615
|
+
...e,
|
|
616
616
|
type: Oe.enum.SKU
|
|
617
617
|
}));
|
|
618
618
|
l.promptIngredientsBinding(
|
|
619
|
-
|
|
620
|
-
(
|
|
619
|
+
t,
|
|
620
|
+
(e) => o.value = e,
|
|
621
621
|
s.sku._id
|
|
622
622
|
);
|
|
623
623
|
}
|
|
624
|
-
return
|
|
624
|
+
return ge(
|
|
625
625
|
() => s.show,
|
|
626
|
-
(
|
|
627
|
-
|
|
626
|
+
(t) => {
|
|
627
|
+
t || (o.value = null, u.value = 0);
|
|
628
628
|
}
|
|
629
|
-
), (
|
|
630
|
-
const f =
|
|
629
|
+
), (t, e) => {
|
|
630
|
+
const f = M("FmTextField"), m = M("FmForm"), _ = M("FmCard"), y = M("FmSwitch"), A = M("FmFormGroup"), z = M("FmSelect"), X = M("FmButton"), me = M("FmSideSheet");
|
|
631
631
|
return B(), O(me, {
|
|
632
632
|
"dismiss-away": "",
|
|
633
|
-
modelValue: v(
|
|
634
|
-
"onUpdate:modelValue":
|
|
633
|
+
modelValue: v(T),
|
|
634
|
+
"onUpdate:modelValue": e[3] || (e[3] = (I) => Ue(T) ? T.value = I : null),
|
|
635
635
|
"max-width": 500
|
|
636
636
|
}, {
|
|
637
|
-
"side-sheet-header":
|
|
637
|
+
"side-sheet-header": D(() => [
|
|
638
638
|
n("div", Jt, [
|
|
639
|
-
n("div", Qt, b(v(k)("inventory.stock.convert.title", { name:
|
|
639
|
+
n("div", Qt, b(v(k)("inventory.stock.convert.title", { name: t.sku.name })), 1)
|
|
640
640
|
])
|
|
641
641
|
]),
|
|
642
|
-
default:
|
|
642
|
+
default: D(() => [
|
|
643
643
|
n("div", Xt, [
|
|
644
644
|
x(m, {
|
|
645
645
|
ref_key: "formRef",
|
|
646
|
-
ref:
|
|
647
|
-
onValidationSuccess:
|
|
646
|
+
ref: P,
|
|
647
|
+
onValidationSuccess: j
|
|
648
648
|
}, {
|
|
649
|
-
default:
|
|
649
|
+
default: D(() => [
|
|
650
650
|
x(f, {
|
|
651
651
|
disabled: p.value,
|
|
652
652
|
"model-value": u.value,
|
|
653
|
-
"onUpdate:modelValue":
|
|
653
|
+
"onUpdate:modelValue": e[0] || (e[0] = (I) => u.value = I),
|
|
654
654
|
label: v(k)("inventory.stock.convert.amount"),
|
|
655
|
-
rules: [
|
|
656
|
-
"append-text":
|
|
657
|
-
"helper-text": o.value ? void 0 : `Max ${
|
|
655
|
+
rules: [E, V, v(Me)(0)],
|
|
656
|
+
"append-text": w.value,
|
|
657
|
+
"helper-text": o.value ? void 0 : `Max ${t.maxCount} ${w.value}`
|
|
658
658
|
}, null, 8, ["disabled", "model-value", "label", "rules", "append-text", "helper-text"])
|
|
659
659
|
]),
|
|
660
660
|
_: 1
|
|
@@ -663,17 +663,17 @@ const Jt = { class: "flex items-center" }, Qt = { class: "fm-typo-en-title-md-80
|
|
|
663
663
|
variant: "outlined",
|
|
664
664
|
class: "p-16"
|
|
665
665
|
}, {
|
|
666
|
-
default:
|
|
666
|
+
default: D(() => [
|
|
667
667
|
n("div", Zt, [
|
|
668
668
|
n("div", en, b(v(k)("inventory.stock.convert.deductionSummary")), 1),
|
|
669
|
-
(B(!0), L(
|
|
670
|
-
var
|
|
669
|
+
(B(!0), L(ne, null, ae(C.value, (I) => {
|
|
670
|
+
var G, J;
|
|
671
671
|
return B(), L("div", {
|
|
672
|
-
key: (
|
|
672
|
+
key: (G = I.sku) == null ? void 0 : G._id,
|
|
673
673
|
class: "flex items-center"
|
|
674
674
|
}, [
|
|
675
|
-
n("div", tn, b((J =
|
|
676
|
-
n("div", nn, " -" + b(
|
|
675
|
+
n("div", tn, b((J = I.sku) == null ? void 0 : J.name), 1),
|
|
676
|
+
n("div", nn, " -" + b(I.convertAmount) + " " + b(I.abbrev), 1)
|
|
677
677
|
]);
|
|
678
678
|
}), 128))
|
|
679
679
|
])
|
|
@@ -681,65 +681,65 @@ const Jt = { class: "flex items-center" }, Qt = { class: "fm-typo-en-title-md-80
|
|
|
681
681
|
_: 1
|
|
682
682
|
}),
|
|
683
683
|
x(_, { variant: "outlined" }, {
|
|
684
|
-
default:
|
|
684
|
+
default: D(() => [
|
|
685
685
|
n("div", on, [
|
|
686
686
|
x(y, {
|
|
687
687
|
value: "",
|
|
688
|
-
modelValue:
|
|
689
|
-
"onUpdate:modelValue":
|
|
688
|
+
modelValue: h.value,
|
|
689
|
+
"onUpdate:modelValue": e[1] || (e[1] = (I) => h.value = I),
|
|
690
690
|
label: v(k)("inventory.stock.convert.overrideDeduction"),
|
|
691
691
|
"label-placement": "right"
|
|
692
692
|
}, null, 8, ["modelValue", "label"]),
|
|
693
|
-
|
|
694
|
-
x(
|
|
693
|
+
h.value ? (B(), L(ne, { key: 0 }, [
|
|
694
|
+
x(A, {
|
|
695
695
|
modelValue: o.value,
|
|
696
696
|
rules: [v(_t)(1, "Must have at least one ingredient binding")]
|
|
697
697
|
}, null, 8, ["modelValue", "rules"]),
|
|
698
698
|
n("div", sn, [
|
|
699
699
|
n("div", an, b(v(k)("inventory.stock.convert.ingredients")), 1),
|
|
700
|
-
(B(!0), L(
|
|
701
|
-
key:
|
|
700
|
+
(B(!0), L(ne, null, ae(o.value, (I) => (B(), O(A, {
|
|
701
|
+
key: I.id,
|
|
702
702
|
disabled: p.value,
|
|
703
|
-
modelValue: +v(ie)(
|
|
703
|
+
modelValue: +v(ie)(I.amount ?? { amount: 1, precision: 0 }),
|
|
704
704
|
rules: [
|
|
705
705
|
v(kt)(
|
|
706
|
-
|
|
707
|
-
|
|
706
|
+
$.value.find((G) => G._id === I.id).unit,
|
|
707
|
+
I.measurement
|
|
708
708
|
),
|
|
709
709
|
v(Me)(0)
|
|
710
710
|
]
|
|
711
711
|
}, {
|
|
712
|
-
default:
|
|
713
|
-
var J,
|
|
712
|
+
default: D(({ invalid: G }) => {
|
|
713
|
+
var J, Z, q;
|
|
714
714
|
return [
|
|
715
715
|
n("div", rn, [
|
|
716
|
-
n("div", ln, b((J =
|
|
716
|
+
n("div", ln, b((J = $.value.find((se) => se._id === I.id)) == null ? void 0 : J.name), 1),
|
|
717
717
|
x(f, {
|
|
718
718
|
class: "xs:col-span-2",
|
|
719
719
|
disabled: p.value,
|
|
720
720
|
modelValue: +v(ie)(
|
|
721
|
-
|
|
721
|
+
I.amount ?? { amount: 1, precision: 0 }
|
|
722
722
|
),
|
|
723
|
-
"onUpdate:modelValue": (se) =>
|
|
724
|
-
invalid:
|
|
723
|
+
"onUpdate:modelValue": (se) => Y(I.id, se, o.value ?? []),
|
|
724
|
+
invalid: G
|
|
725
725
|
}, null, 8, ["disabled", "modelValue", "onUpdate:modelValue", "invalid"]),
|
|
726
|
-
x(
|
|
726
|
+
x(z, {
|
|
727
727
|
disabled: p.value,
|
|
728
728
|
class: "translate-y-[2px]",
|
|
729
|
-
items:
|
|
730
|
-
"model-value": (
|
|
731
|
-
"onUpdate:modelValue": (se) =>
|
|
732
|
-
invalid:
|
|
729
|
+
items: N(I.id),
|
|
730
|
+
"model-value": (q = R(I.id, (Z = I.measurement) == null ? void 0 : Z.id)) == null ? void 0 : q.value,
|
|
731
|
+
"onUpdate:modelValue": (se) => K(I.id, se, o.value ?? []),
|
|
732
|
+
invalid: G
|
|
733
733
|
}, {
|
|
734
|
-
"helper-text":
|
|
734
|
+
"helper-text": D(() => e[4] || (e[4] = [])),
|
|
735
735
|
_: 2
|
|
736
736
|
}, 1032, ["disabled", "items", "model-value", "onUpdate:modelValue", "invalid"]),
|
|
737
|
-
x(
|
|
737
|
+
x(X, {
|
|
738
738
|
disabled: p.value,
|
|
739
739
|
type: "button",
|
|
740
740
|
variant: "tertiary",
|
|
741
741
|
icon: "delete",
|
|
742
|
-
onClick: (se) => ce(
|
|
742
|
+
onClick: (se) => ce(I.id, o.value ?? [])
|
|
743
743
|
}, null, 8, ["disabled", "onClick"])
|
|
744
744
|
])
|
|
745
745
|
];
|
|
@@ -748,28 +748,28 @@ const Jt = { class: "flex items-center" }, Qt = { class: "fm-typo-en-title-md-80
|
|
|
748
748
|
}, 1032, ["disabled", "modelValue", "rules"]))), 128))
|
|
749
749
|
]),
|
|
750
750
|
n("div", null, [
|
|
751
|
-
x(
|
|
751
|
+
x(X, {
|
|
752
752
|
icon: "link",
|
|
753
753
|
label: v(k)("inventory.stock.convert.linkIngredient"),
|
|
754
754
|
variant: "plain",
|
|
755
755
|
onClick: oe
|
|
756
756
|
}, null, 8, ["label"])
|
|
757
757
|
])
|
|
758
|
-
], 64)) :
|
|
758
|
+
], 64)) : te("", !0)
|
|
759
759
|
])
|
|
760
760
|
]),
|
|
761
761
|
_: 1
|
|
762
762
|
})
|
|
763
763
|
])
|
|
764
764
|
]),
|
|
765
|
-
"side-sheet-footer":
|
|
765
|
+
"side-sheet-footer": D(() => [
|
|
766
766
|
n("div", un, [
|
|
767
|
-
x(
|
|
767
|
+
x(X, {
|
|
768
768
|
loading: p.value,
|
|
769
769
|
label: v(k)("inventory.stock.convert.convertButton"),
|
|
770
|
-
onClick:
|
|
771
|
-
var
|
|
772
|
-
return (J = (
|
|
770
|
+
onClick: e[2] || (e[2] = (I) => {
|
|
771
|
+
var G, J;
|
|
772
|
+
return (J = (G = P.value) == null ? void 0 : G.validateInputs) == null ? void 0 : J.call(G);
|
|
773
773
|
})
|
|
774
774
|
}, null, 8, ["loading", "label"])
|
|
775
775
|
])
|
|
@@ -779,31 +779,31 @@ const Jt = { class: "flex items-center" }, Qt = { class: "fm-typo-en-title-md-80
|
|
|
779
779
|
};
|
|
780
780
|
}
|
|
781
781
|
});
|
|
782
|
-
function
|
|
783
|
-
const r =
|
|
782
|
+
function Ve(c, d) {
|
|
783
|
+
const r = be(c, d);
|
|
784
784
|
return { ...r, amount: -r.amount };
|
|
785
785
|
}
|
|
786
786
|
function We(c, d) {
|
|
787
|
-
return
|
|
787
|
+
return be(Math.abs(c), d);
|
|
788
788
|
}
|
|
789
|
-
const
|
|
790
|
-
[
|
|
789
|
+
const Ce = {
|
|
790
|
+
[ee.enum.DAMAGE]: {
|
|
791
791
|
label: "Waste",
|
|
792
|
-
toAdjustmentAmount:
|
|
792
|
+
toAdjustmentAmount: Ve
|
|
793
793
|
},
|
|
794
|
-
[
|
|
794
|
+
[ee.enum.THEFT]: {
|
|
795
795
|
label: "Theft",
|
|
796
|
-
toAdjustmentAmount:
|
|
796
|
+
toAdjustmentAmount: Ve
|
|
797
797
|
},
|
|
798
|
-
[
|
|
798
|
+
[ee.enum.LOSE]: {
|
|
799
799
|
label: "Lose",
|
|
800
|
-
toAdjustmentAmount:
|
|
800
|
+
toAdjustmentAmount: Ve
|
|
801
801
|
},
|
|
802
|
-
[
|
|
802
|
+
[ee.enum.EXTRA]: {
|
|
803
803
|
label: "Extra",
|
|
804
804
|
toAdjustmentAmount: We
|
|
805
805
|
},
|
|
806
|
-
[
|
|
806
|
+
[ee.enum.PURCHASE]: {
|
|
807
807
|
label: "Purchase",
|
|
808
808
|
toAdjustmentAmount: We
|
|
809
809
|
}
|
|
@@ -815,27 +815,27 @@ const Ve = {
|
|
|
815
815
|
},
|
|
816
816
|
emits: ["update:modelValue", "click:delete"],
|
|
817
817
|
setup(c, { emit: d }) {
|
|
818
|
-
const r = c, s = d, S =
|
|
819
|
-
() => Object.keys(
|
|
818
|
+
const r = c, s = d, S = U(
|
|
819
|
+
() => Object.keys(Ce).map((u) => ({
|
|
820
820
|
label: gt(u),
|
|
821
821
|
value: u
|
|
822
822
|
}))
|
|
823
|
-
), l =
|
|
823
|
+
), l = U(() => st(r.modelValue.doc.unit, !0)), a = U({
|
|
824
824
|
get() {
|
|
825
|
-
return r.modelValue.type ??
|
|
825
|
+
return r.modelValue.type ?? ee.enum.PURCHASE;
|
|
826
826
|
},
|
|
827
827
|
set(u) {
|
|
828
828
|
const o = {
|
|
829
829
|
...r.modelValue
|
|
830
830
|
};
|
|
831
831
|
o.type = u;
|
|
832
|
-
const
|
|
833
|
-
o.amount =
|
|
834
|
-
+ie(
|
|
835
|
-
|
|
832
|
+
const $ = ze(r.modelValue.amount);
|
|
833
|
+
o.amount = Ce[o.type].toAdjustmentAmount(
|
|
834
|
+
+ie($),
|
|
835
|
+
$.precision
|
|
836
836
|
), s("update:modelValue", o);
|
|
837
837
|
}
|
|
838
|
-
}), i =
|
|
838
|
+
}), i = U({
|
|
839
839
|
get() {
|
|
840
840
|
const u = ze(r.modelValue.amount);
|
|
841
841
|
return +ie(u);
|
|
@@ -843,25 +843,25 @@ const Ve = {
|
|
|
843
843
|
set(u) {
|
|
844
844
|
const o = {
|
|
845
845
|
...r.modelValue
|
|
846
|
-
},
|
|
847
|
-
o.amount =
|
|
846
|
+
}, $ = fe(u);
|
|
847
|
+
o.amount = Ce[a.value].toAdjustmentAmount(
|
|
848
848
|
u,
|
|
849
|
-
|
|
849
|
+
$.precision
|
|
850
850
|
), s("update:modelValue", o);
|
|
851
851
|
}
|
|
852
|
-
}),
|
|
852
|
+
}), g = U({
|
|
853
853
|
get() {
|
|
854
854
|
var u;
|
|
855
855
|
return ((u = r.modelValue.measurement) == null ? void 0 : u.id) ?? null;
|
|
856
856
|
},
|
|
857
857
|
set(u) {
|
|
858
|
-
var
|
|
858
|
+
var $, F;
|
|
859
859
|
const o = {
|
|
860
860
|
...r.modelValue
|
|
861
861
|
};
|
|
862
|
-
o.measurement = ((
|
|
862
|
+
o.measurement = ((F = ($ = r.modelValue.doc.unit) == null ? void 0 : $.measurements) == null ? void 0 : F.find((h) => h.id === u)) ?? null, s("update:modelValue", o);
|
|
863
863
|
}
|
|
864
|
-
}), k =
|
|
864
|
+
}), k = U({
|
|
865
865
|
get() {
|
|
866
866
|
return r.modelValue.remark ?? "";
|
|
867
867
|
},
|
|
@@ -873,27 +873,27 @@ const Ve = {
|
|
|
873
873
|
}
|
|
874
874
|
});
|
|
875
875
|
return (u, o) => {
|
|
876
|
-
const
|
|
876
|
+
const $ = M("FmButton"), F = M("FmSelect"), h = M("FmTextarea"), p = M("FmCard");
|
|
877
877
|
return B(), O(p, {
|
|
878
878
|
variant: "outlined",
|
|
879
879
|
class: "grid grid-cols-2 gap-8 p-16"
|
|
880
880
|
}, {
|
|
881
|
-
default:
|
|
881
|
+
default: D(() => [
|
|
882
882
|
n("div", dn, [
|
|
883
883
|
n("div", mn, b(u.modelValue.doc.name), 1),
|
|
884
|
-
x(
|
|
884
|
+
x($, {
|
|
885
885
|
variant: "tertiary",
|
|
886
886
|
"prepend-icon": "delete",
|
|
887
|
-
onClick: o[0] || (o[0] = (
|
|
887
|
+
onClick: o[0] || (o[0] = (j) => s("click:delete"))
|
|
888
888
|
})
|
|
889
889
|
]),
|
|
890
|
-
x(
|
|
890
|
+
x(F, {
|
|
891
891
|
disabled: u.disabled,
|
|
892
892
|
class: "col-span-2",
|
|
893
893
|
label: "Type",
|
|
894
894
|
items: S.value,
|
|
895
895
|
modelValue: a.value,
|
|
896
|
-
"onUpdate:modelValue": o[1] || (o[1] = (
|
|
896
|
+
"onUpdate:modelValue": o[1] || (o[1] = (j) => a.value = j),
|
|
897
897
|
rules: [v(bt)()],
|
|
898
898
|
"label-mark": "required"
|
|
899
899
|
}, null, 8, ["disabled", "items", "modelValue", "rules"]),
|
|
@@ -905,22 +905,22 @@ const Ve = {
|
|
|
905
905
|
precision: v(De)(u.modelValue.doc.unit, u.modelValue.measurement)
|
|
906
906
|
}),
|
|
907
907
|
modelValue: i.value,
|
|
908
|
-
"onUpdate:modelValue": o[2] || (o[2] = (
|
|
908
|
+
"onUpdate:modelValue": o[2] || (o[2] = (j) => i.value = j),
|
|
909
909
|
rules: [v(Me)(0)]
|
|
910
910
|
}, null, 8, ["disabled", "step", "modelValue", "rules"]),
|
|
911
|
-
x(
|
|
911
|
+
x(F, {
|
|
912
912
|
disabled: u.disabled,
|
|
913
913
|
label: "Unit",
|
|
914
914
|
items: l.value,
|
|
915
|
-
modelValue:
|
|
916
|
-
"onUpdate:modelValue": o[3] || (o[3] = (
|
|
915
|
+
modelValue: g.value,
|
|
916
|
+
"onUpdate:modelValue": o[3] || (o[3] = (j) => g.value = j)
|
|
917
917
|
}, null, 8, ["disabled", "items", "modelValue"]),
|
|
918
|
-
x(
|
|
918
|
+
x(h, {
|
|
919
919
|
class: "col-span-2",
|
|
920
920
|
disabled: u.disabled,
|
|
921
921
|
label: "Remark",
|
|
922
922
|
modelValue: k.value,
|
|
923
|
-
"onUpdate:modelValue": o[4] || (o[4] = (
|
|
923
|
+
"onUpdate:modelValue": o[4] || (o[4] = (j) => k.value = j),
|
|
924
924
|
"label-mark": "optional"
|
|
925
925
|
}, null, 8, ["disabled", "modelValue"])
|
|
926
926
|
]),
|
|
@@ -936,31 +936,31 @@ const Ve = {
|
|
|
936
936
|
},
|
|
937
937
|
emits: ["update:show", "submitted"],
|
|
938
938
|
setup(c, { expose: d, emit: r }) {
|
|
939
|
-
const s = c, S = r, l = Te(), a = nt(), i =
|
|
939
|
+
const s = c, S = r, l = Te(), a = nt(), i = $e(), g = de(), k = H(!1), { t: u } = le();
|
|
940
940
|
function o() {
|
|
941
|
-
p(Pe(
|
|
941
|
+
p(Pe(h));
|
|
942
942
|
}
|
|
943
|
-
const
|
|
943
|
+
const $ = H();
|
|
944
944
|
d({
|
|
945
945
|
validateInputs: () => {
|
|
946
|
-
var
|
|
947
|
-
(
|
|
946
|
+
var V, w;
|
|
947
|
+
(w = (V = $.value) == null ? void 0 : V.validateInputs) == null || w.call(V);
|
|
948
948
|
},
|
|
949
949
|
resetInputsValidation: () => {
|
|
950
|
-
var
|
|
951
|
-
(
|
|
950
|
+
var V, w;
|
|
951
|
+
(w = (V = $.value) == null ? void 0 : V.resetInputsValidation) == null || w.call(V);
|
|
952
952
|
},
|
|
953
953
|
resetInputs: () => {
|
|
954
|
-
var
|
|
955
|
-
(
|
|
954
|
+
var V, w;
|
|
955
|
+
(w = (V = $.value) == null ? void 0 : V.resetInputs) == null || w.call(V);
|
|
956
956
|
}
|
|
957
957
|
});
|
|
958
|
-
const
|
|
958
|
+
const F = Re(s, "show"), h = it({
|
|
959
959
|
remark: "",
|
|
960
960
|
adjustments: [
|
|
961
961
|
{
|
|
962
962
|
id: `sku_${(/* @__PURE__ */ new Date()).toISOString()}_${Math.random().toString(16).slice(2, 8)}`,
|
|
963
|
-
type:
|
|
963
|
+
type: ee.enum.PURCHASE,
|
|
964
964
|
doc: s.stock,
|
|
965
965
|
measurement: null,
|
|
966
966
|
remark: "",
|
|
@@ -968,11 +968,11 @@ const Ve = {
|
|
|
968
968
|
}
|
|
969
969
|
]
|
|
970
970
|
});
|
|
971
|
-
|
|
972
|
-
|
|
971
|
+
ge([() => s.show], ([V]) => {
|
|
972
|
+
V && (h.remark = "", h.adjustments = [
|
|
973
973
|
{
|
|
974
974
|
id: `sku_${(/* @__PURE__ */ new Date()).toISOString()}_${Math.random().toString(16).slice(2, 8)}`,
|
|
975
|
-
type:
|
|
975
|
+
type: ee.enum.PURCHASE,
|
|
976
976
|
doc: s.stock,
|
|
977
977
|
measurement: null,
|
|
978
978
|
remark: "",
|
|
@@ -980,42 +980,42 @@ const Ve = {
|
|
|
980
980
|
}
|
|
981
981
|
]);
|
|
982
982
|
});
|
|
983
|
-
async function p(
|
|
983
|
+
async function p(V) {
|
|
984
984
|
k.value = !0;
|
|
985
985
|
try {
|
|
986
986
|
await i.adjustSku({
|
|
987
|
-
remark:
|
|
988
|
-
adjustments:
|
|
989
|
-
id:
|
|
990
|
-
amount:
|
|
991
|
-
measurement:
|
|
992
|
-
remark:
|
|
993
|
-
doc:
|
|
994
|
-
type:
|
|
987
|
+
remark: V.remark,
|
|
988
|
+
adjustments: V.adjustments.map(({ doc: w, remark: C, type: P, amount: T, measurement: Q }) => ({
|
|
989
|
+
id: w._id,
|
|
990
|
+
amount: T,
|
|
991
|
+
measurement: Q,
|
|
992
|
+
remark: C,
|
|
993
|
+
doc: w,
|
|
994
|
+
type: P
|
|
995
995
|
}))
|
|
996
996
|
}), S("update:show", !1), S("submitted");
|
|
997
|
-
} catch (
|
|
998
|
-
|
|
997
|
+
} catch (w) {
|
|
998
|
+
g.open({
|
|
999
999
|
title: u("inventory.stock.adjust.error.title"),
|
|
1000
1000
|
message: u("inventory.stock.adjust.error.message"),
|
|
1001
1001
|
type: "error"
|
|
1002
|
-
}), console.log("error on adjust ingredients",
|
|
1002
|
+
}), console.log("error on adjust ingredients", V, w);
|
|
1003
1003
|
} finally {
|
|
1004
1004
|
k.value = !1;
|
|
1005
1005
|
}
|
|
1006
1006
|
}
|
|
1007
|
-
function
|
|
1008
|
-
const
|
|
1009
|
-
label:
|
|
1010
|
-
sublabel:
|
|
1011
|
-
value:
|
|
1012
|
-
})),
|
|
1007
|
+
function j() {
|
|
1008
|
+
const V = l.skus.map((C) => ({
|
|
1009
|
+
label: C.name,
|
|
1010
|
+
sublabel: C.code,
|
|
1011
|
+
value: C._id
|
|
1012
|
+
})), w = V.filter((C) => h.adjustments.find((P) => P.doc._id === C.value)).map((C) => C.value);
|
|
1013
1013
|
a.open({
|
|
1014
1014
|
title: "Select ingredients",
|
|
1015
1015
|
contentComponent: xt,
|
|
1016
1016
|
contentComponentProps: {
|
|
1017
|
-
items:
|
|
1018
|
-
modelValue:
|
|
1017
|
+
items: V,
|
|
1018
|
+
modelValue: w
|
|
1019
1019
|
},
|
|
1020
1020
|
overlay: !0,
|
|
1021
1021
|
closeButton: !0,
|
|
@@ -1029,12 +1029,12 @@ const Ve = {
|
|
|
1029
1029
|
close: !0,
|
|
1030
1030
|
variant: "tertiary"
|
|
1031
1031
|
}
|
|
1032
|
-
}).onPrimary((
|
|
1033
|
-
|
|
1034
|
-
(
|
|
1032
|
+
}).onPrimary((C) => {
|
|
1033
|
+
h.adjustments = C.map(
|
|
1034
|
+
(P) => h.adjustments.find((T) => T.doc._id === P) ?? {
|
|
1035
1035
|
id: `sku_${(/* @__PURE__ */ new Date()).toISOString()}_${Math.random().toString(16).slice(2, 8)}`,
|
|
1036
|
-
type:
|
|
1037
|
-
doc: l.skus.find((
|
|
1036
|
+
type: ee.enum.PURCHASE,
|
|
1037
|
+
doc: l.skus.find((T) => T._id === P),
|
|
1038
1038
|
measurement: null,
|
|
1039
1039
|
remark: "",
|
|
1040
1040
|
amount: fe(1)
|
|
@@ -1042,62 +1042,62 @@ const Ve = {
|
|
|
1042
1042
|
);
|
|
1043
1043
|
});
|
|
1044
1044
|
}
|
|
1045
|
-
function
|
|
1046
|
-
|
|
1045
|
+
function E(V) {
|
|
1046
|
+
h.adjustments.splice(V, 1);
|
|
1047
1047
|
}
|
|
1048
|
-
return (
|
|
1049
|
-
const
|
|
1050
|
-
return B(), O(
|
|
1051
|
-
modelValue: v(
|
|
1052
|
-
"onUpdate:modelValue":
|
|
1048
|
+
return (V, w) => {
|
|
1049
|
+
const C = M("FmTextarea"), P = M("FmButton"), T = M("FmForm"), Q = M("FmSideSheet");
|
|
1050
|
+
return B(), O(Q, {
|
|
1051
|
+
modelValue: v(F),
|
|
1052
|
+
"onUpdate:modelValue": w[2] || (w[2] = (Y) => Ue(F) ? F.value = Y : null),
|
|
1053
1053
|
"dismiss-away": "",
|
|
1054
1054
|
"max-width": 500
|
|
1055
1055
|
}, {
|
|
1056
|
-
"side-sheet-header":
|
|
1056
|
+
"side-sheet-header": D(() => [
|
|
1057
1057
|
n("div", vn, [
|
|
1058
1058
|
n("div", fn, b(v(u)("inventory.stock.adjust.title")), 1)
|
|
1059
1059
|
])
|
|
1060
1060
|
]),
|
|
1061
|
-
default:
|
|
1062
|
-
x(
|
|
1061
|
+
default: D(() => [
|
|
1062
|
+
x(T, {
|
|
1063
1063
|
class: "w-full flex flex-col gap-12",
|
|
1064
1064
|
ref_key: "formRef",
|
|
1065
|
-
ref:
|
|
1065
|
+
ref: $,
|
|
1066
1066
|
onValidationSuccess: o
|
|
1067
1067
|
}, {
|
|
1068
|
-
default:
|
|
1069
|
-
x(
|
|
1068
|
+
default: D(() => [
|
|
1069
|
+
x(C, {
|
|
1070
1070
|
label: v(u)("inventory.stock.adjust.remark"),
|
|
1071
|
-
modelValue:
|
|
1072
|
-
"onUpdate:modelValue":
|
|
1071
|
+
modelValue: h.remark,
|
|
1072
|
+
"onUpdate:modelValue": w[0] || (w[0] = (Y) => h.remark = Y)
|
|
1073
1073
|
}, null, 8, ["label", "modelValue"]),
|
|
1074
1074
|
n("div", yn, [
|
|
1075
1075
|
n("div", _n, b(v(u)("inventory.stock.adjust.adjustedItems")), 1),
|
|
1076
|
-
x(
|
|
1076
|
+
x(P, {
|
|
1077
1077
|
"prepend-icon": "add",
|
|
1078
1078
|
variant: "tertiary",
|
|
1079
1079
|
size: "md",
|
|
1080
|
-
onClick:
|
|
1080
|
+
onClick: j
|
|
1081
1081
|
})
|
|
1082
1082
|
]),
|
|
1083
|
-
(B(!0), L(
|
|
1084
|
-
key:
|
|
1085
|
-
modelValue:
|
|
1086
|
-
"onUpdate:modelValue": (
|
|
1087
|
-
"onClick:delete": (
|
|
1083
|
+
(B(!0), L(ne, null, ae(h.adjustments, (Y, N) => (B(), O(pn, {
|
|
1084
|
+
key: Y.id,
|
|
1085
|
+
modelValue: h.adjustments[N],
|
|
1086
|
+
"onUpdate:modelValue": (R) => h.adjustments[N] = R,
|
|
1087
|
+
"onClick:delete": (R) => E(N)
|
|
1088
1088
|
}, null, 8, ["modelValue", "onUpdate:modelValue", "onClick:delete"]))), 128))
|
|
1089
1089
|
]),
|
|
1090
1090
|
_: 1
|
|
1091
1091
|
}, 512)
|
|
1092
1092
|
]),
|
|
1093
|
-
"side-sheet-footer":
|
|
1093
|
+
"side-sheet-footer": D(() => [
|
|
1094
1094
|
n("div", kn, [
|
|
1095
|
-
x(
|
|
1095
|
+
x(P, {
|
|
1096
1096
|
label: v(u)("inventory.stock.adjust.adjustButton"),
|
|
1097
1097
|
loading: k.value,
|
|
1098
|
-
onClick:
|
|
1099
|
-
var
|
|
1100
|
-
return (
|
|
1098
|
+
onClick: w[1] || (w[1] = (Y) => {
|
|
1099
|
+
var N, R;
|
|
1100
|
+
return (R = (N = $.value) == null ? void 0 : N.validateInputs) == null ? void 0 : R.call(N);
|
|
1101
1101
|
})
|
|
1102
1102
|
}, null, 8, ["label", "loading"])
|
|
1103
1103
|
])
|
|
@@ -1140,63 +1140,63 @@ const Ve = {
|
|
|
1140
1140
|
bills: { default: () => [] }
|
|
1141
1141
|
},
|
|
1142
1142
|
setup(c) {
|
|
1143
|
-
const d = c, r =
|
|
1143
|
+
const d = c, r = H(!1), s = H(), S = H(null), l = U(() => S.value === null ? "unset" : r.value ? `${S.value}px` : "0px");
|
|
1144
1144
|
Je(() => {
|
|
1145
1145
|
var k;
|
|
1146
1146
|
S.value = ((k = s.value) == null ? void 0 : k.scrollHeight) || 0;
|
|
1147
1147
|
});
|
|
1148
|
-
const a =
|
|
1149
|
-
var
|
|
1150
|
-
const k = d.record.adjustments, u = d.sku, o = {},
|
|
1151
|
-
var
|
|
1152
|
-
return ((
|
|
1148
|
+
const a = U(() => {
|
|
1149
|
+
var h;
|
|
1150
|
+
const k = d.record.adjustments, u = d.sku, o = {}, F = k.flatMap((p) => {
|
|
1151
|
+
var j;
|
|
1152
|
+
return ((j = p.skus) == null ? void 0 : j.filter((E) => E.sku._id === u._id)) ?? [];
|
|
1153
1153
|
}).flatMap((p) => p.amounts);
|
|
1154
|
-
for (const p of
|
|
1155
|
-
const
|
|
1156
|
-
o[
|
|
1154
|
+
for (const p of F) {
|
|
1155
|
+
const j = p.measurement ? St(p.measurement.conversion, p.amount) : p.amount;
|
|
1156
|
+
o[h = p.type] ?? (o[h] = { amount: 0, precision: 0 }), o[p.type] = Ze(j, o[p.type]);
|
|
1157
1157
|
}
|
|
1158
1158
|
return Object.entries(o).reduce(
|
|
1159
|
-
(p, [
|
|
1160
|
-
`${
|
|
1161
|
-
value:
|
|
1159
|
+
(p, [j, E]) => (p[j] = /// comment, because without it formatter makes code uglier
|
|
1160
|
+
`${W.toFormatString({
|
|
1161
|
+
value: E,
|
|
1162
1162
|
precision: 4
|
|
1163
1163
|
})} ${u.unit.abbrev}`, p),
|
|
1164
1164
|
{}
|
|
1165
1165
|
);
|
|
1166
|
-
}), { t: i } = le(),
|
|
1166
|
+
}), { t: i } = le(), g = U(() => d.record.adjustmentsByTime.map(({ date: k, adjustments: u }) => ({
|
|
1167
1167
|
time: $t(new Date(k)),
|
|
1168
1168
|
adjustments: u.flatMap(
|
|
1169
1169
|
(o) => {
|
|
1170
|
-
var
|
|
1171
|
-
return ((
|
|
1172
|
-
...
|
|
1170
|
+
var $, F;
|
|
1171
|
+
return ((F = ($ = o.skus) == null ? void 0 : $.map) == null ? void 0 : F.call($, (h) => ({
|
|
1172
|
+
...h,
|
|
1173
1173
|
ref: o.ref,
|
|
1174
1174
|
backdateFrom: o.effectiveAt != null ? ot(o._id) : null
|
|
1175
1175
|
}))) ?? [];
|
|
1176
1176
|
}
|
|
1177
1177
|
).flatMap((o) => {
|
|
1178
|
-
var
|
|
1179
|
-
const
|
|
1178
|
+
var h;
|
|
1179
|
+
const $ = (h = d.bills.find((p) => p._id === o.ref)) == null ? void 0 : h.seqNumber, F = $ ? i("inventory.stock.record.bill", [$]) : "";
|
|
1180
1180
|
return o.amounts.map((p) => {
|
|
1181
|
-
var
|
|
1181
|
+
var j;
|
|
1182
1182
|
return {
|
|
1183
|
-
amount: `${
|
|
1183
|
+
amount: `${W.toFormatString({ value: p.amount, precision: 4 })} ${((j = p.measurement) == null ? void 0 : j.abbrev) ?? o.sku.unit.abbrev}`,
|
|
1184
1184
|
backdateFrom: o.backdateFrom,
|
|
1185
1185
|
name: p.type,
|
|
1186
|
-
remark: p.remark ||
|
|
1186
|
+
remark: p.remark || F || "",
|
|
1187
1187
|
cost: p.cost
|
|
1188
1188
|
};
|
|
1189
1189
|
});
|
|
1190
1190
|
})
|
|
1191
1191
|
})));
|
|
1192
1192
|
return (k, u) => {
|
|
1193
|
-
const o =
|
|
1194
|
-
return B(), O(
|
|
1195
|
-
default:
|
|
1193
|
+
const o = M("FmIcon"), $ = M("FmTooltip"), F = M("FmCard");
|
|
1194
|
+
return B(), O(F, { variant: "outlined" }, {
|
|
1195
|
+
default: D(() => [
|
|
1196
1196
|
n("div", bn, [
|
|
1197
1197
|
n("div", {
|
|
1198
1198
|
class: "flex items-center cursor-pointer mb-1",
|
|
1199
|
-
onClick: u[0] || (u[0] = (
|
|
1199
|
+
onClick: u[0] || (u[0] = (h) => r.value = !r.value)
|
|
1200
1200
|
}, [
|
|
1201
1201
|
n("div", xn, b(k.record.date), 1),
|
|
1202
1202
|
x(o, {
|
|
@@ -1205,19 +1205,19 @@ const Ve = {
|
|
|
1205
1205
|
size: "md"
|
|
1206
1206
|
}, null, 8, ["name"])
|
|
1207
1207
|
]),
|
|
1208
|
-
(B(!0), L(
|
|
1208
|
+
(B(!0), L(ne, null, ae(a.value, (h, p) => (B(), L("div", {
|
|
1209
1209
|
key: p,
|
|
1210
1210
|
class: "flex flex-row py-1",
|
|
1211
1211
|
style: { "font-size": "0.8rem" }
|
|
1212
1212
|
}, [
|
|
1213
1213
|
n("div", Sn, b(v(i)(`inventory.inventoryAdjustment.type.${p}`)), 1),
|
|
1214
1214
|
n("div", {
|
|
1215
|
-
class:
|
|
1216
|
-
"text-fm-color-typo-error":
|
|
1217
|
-
"text-fm-color-typo-success": !
|
|
1215
|
+
class: he({
|
|
1216
|
+
"text-fm-color-typo-error": h.startsWith("-"),
|
|
1217
|
+
"text-fm-color-typo-success": !h.startsWith("-"),
|
|
1218
1218
|
"ml-auto": !0
|
|
1219
1219
|
})
|
|
1220
|
-
}, b(
|
|
1220
|
+
}, b(h), 3)
|
|
1221
1221
|
]))), 128)),
|
|
1222
1222
|
n("div", {
|
|
1223
1223
|
ref_key: "detailRef",
|
|
@@ -1229,29 +1229,29 @@ const Ve = {
|
|
|
1229
1229
|
transition: "max-height 0.2s ease-out"
|
|
1230
1230
|
})
|
|
1231
1231
|
}, [
|
|
1232
|
-
|
|
1233
|
-
(B(!0), L(
|
|
1234
|
-
key:
|
|
1232
|
+
g.value.length ? (B(), L("hr", $n)) : te("", !0),
|
|
1233
|
+
(B(!0), L(ne, null, ae(g.value, (h) => (B(), L("div", {
|
|
1234
|
+
key: h.time,
|
|
1235
1235
|
class: "flex gap-1 w-full"
|
|
1236
1236
|
}, [
|
|
1237
|
-
n("div", wn, b(
|
|
1237
|
+
n("div", wn, b(h.time), 1),
|
|
1238
1238
|
n("div", Bn, [
|
|
1239
|
-
(B(!0), L(
|
|
1239
|
+
(B(!0), L(ne, null, ae(h.adjustments, (p) => (B(), L("div", {
|
|
1240
1240
|
key: p.name,
|
|
1241
1241
|
class: "flex gap-1"
|
|
1242
1242
|
}, [
|
|
1243
1243
|
n("div", Fn, [
|
|
1244
1244
|
ve(b(v(i)(`inventory.inventoryAdjustment.type.${p.name}`)) + " ", 1),
|
|
1245
|
-
p.backdateFrom ? (B(), O(
|
|
1245
|
+
p.backdateFrom ? (B(), O($, {
|
|
1246
1246
|
key: 0,
|
|
1247
1247
|
variant: "plain",
|
|
1248
1248
|
placement: "top",
|
|
1249
1249
|
"z-index": 50
|
|
1250
1250
|
}, {
|
|
1251
|
-
content:
|
|
1251
|
+
content: D(() => [
|
|
1252
1252
|
n("div", An, b(v(i)("inventory.stock.record.backdate", [v(et)(new Date(p.backdateFrom))])), 1)
|
|
1253
1253
|
]),
|
|
1254
|
-
default:
|
|
1254
|
+
default: D(() => [
|
|
1255
1255
|
x(o, {
|
|
1256
1256
|
name: "info",
|
|
1257
1257
|
size: "sm",
|
|
@@ -1259,17 +1259,17 @@ const Ve = {
|
|
|
1259
1259
|
})
|
|
1260
1260
|
]),
|
|
1261
1261
|
_: 2
|
|
1262
|
-
}, 1024)) :
|
|
1263
|
-
p.remark ? (B(), L("span", Vn, " # " + b(p.remark), 1)) :
|
|
1262
|
+
}, 1024)) : te("", !0),
|
|
1263
|
+
p.remark ? (B(), L("span", Vn, " # " + b(p.remark), 1)) : te("", !0)
|
|
1264
1264
|
]),
|
|
1265
1265
|
n("div", {
|
|
1266
|
-
class:
|
|
1266
|
+
class: he({
|
|
1267
1267
|
"text-fm-color-typo-error": p.amount.startsWith("-"),
|
|
1268
1268
|
"text-fm-color-typo-success": !p.amount.startsWith("-"),
|
|
1269
1269
|
"ml-auto": !0
|
|
1270
1270
|
})
|
|
1271
1271
|
}, b(p.amount), 3),
|
|
1272
|
-
p.cost ? (B(), L("div", Cn, " (" + b(v(je)(p.cost, !1, p.cost.precision)) + ") ", 1)) :
|
|
1272
|
+
p.cost ? (B(), L("div", Cn, " (" + b(v(je)(p.cost, !1, p.cost.precision)) + ") ", 1)) : te("", !0)
|
|
1273
1273
|
]))), 128))
|
|
1274
1274
|
])
|
|
1275
1275
|
]))), 128))
|
|
@@ -1283,31 +1283,31 @@ const Ve = {
|
|
|
1283
1283
|
});
|
|
1284
1284
|
function Mn(c, d) {
|
|
1285
1285
|
var l;
|
|
1286
|
-
const r = Object.keys(
|
|
1286
|
+
const r = Object.keys(ee.enum).reduce(
|
|
1287
1287
|
(a, i) => (a[i] = { amount: 0, precision: 0 }, a),
|
|
1288
1288
|
{}
|
|
1289
1289
|
);
|
|
1290
1290
|
if (!d)
|
|
1291
1291
|
return Object.entries(r).reduce(
|
|
1292
|
-
(a, [i]) => (a[i] =
|
|
1292
|
+
(a, [i]) => (a[i] = W.fromNumber(0), a),
|
|
1293
1293
|
{}
|
|
1294
1294
|
);
|
|
1295
1295
|
const S = c.flatMap((a) => {
|
|
1296
1296
|
var i;
|
|
1297
|
-
return ((i = a.skus) == null ? void 0 : i.filter((
|
|
1297
|
+
return ((i = a.skus) == null ? void 0 : i.filter((g) => g.sku._id === d._id)) ?? [];
|
|
1298
1298
|
}).flatMap((a) => a.amounts);
|
|
1299
1299
|
for (const a of S) {
|
|
1300
|
-
const i = a.measurement ?
|
|
1301
|
-
r[l = a.type] ?? (r[l] = { amount: 0, precision: 0 }), r[a.type] =
|
|
1300
|
+
const i = a.measurement ? W.multiply([a.measurement.conversion, a.amount]) : a.amount;
|
|
1301
|
+
r[l = a.type] ?? (r[l] = { amount: 0, precision: 0 }), r[a.type] = W.add([i, r[a.type]]);
|
|
1302
1302
|
}
|
|
1303
1303
|
return Object.entries(r).reduce(
|
|
1304
|
-
(a, [i,
|
|
1304
|
+
(a, [i, g]) => {
|
|
1305
1305
|
const k = {
|
|
1306
|
-
...
|
|
1307
|
-
amount: Math.abs(
|
|
1306
|
+
...g,
|
|
1307
|
+
amount: Math.abs(g.amount)
|
|
1308
1308
|
};
|
|
1309
1309
|
return a[i] = /// comment, because without it formatter makes code uglier
|
|
1310
|
-
`${
|
|
1310
|
+
`${W.toFormatString({
|
|
1311
1311
|
value: k,
|
|
1312
1312
|
precision: 4
|
|
1313
1313
|
})} ${d.unit.abbrev}`, a;
|
|
@@ -1329,13 +1329,13 @@ function jn(c, d) {
|
|
|
1329
1329
|
for (const l of S) {
|
|
1330
1330
|
const a = l.amounts;
|
|
1331
1331
|
for (const i of a) {
|
|
1332
|
-
if (i.type !==
|
|
1332
|
+
if (i.type !== ee.Enum.SALES)
|
|
1333
1333
|
continue;
|
|
1334
|
-
const
|
|
1335
|
-
r ?? (r =
|
|
1334
|
+
const g = i.measurement ? W.multiply([i.measurement.conversion, i.amount]) : i.amount;
|
|
1335
|
+
r ?? (r = W.fromNumber(0)), r = W.add([r, g]);
|
|
1336
1336
|
}
|
|
1337
1337
|
}
|
|
1338
|
-
return r != null ? (r.amount = Math.abs(r.amount), `${
|
|
1338
|
+
return r != null ? (r.amount = Math.abs(r.amount), `${W.toFormatString({
|
|
1339
1339
|
value: r,
|
|
1340
1340
|
precision: 4
|
|
1341
1341
|
})} ${d.unit.abbrev}`) : null;
|
|
@@ -1363,38 +1363,38 @@ const In = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Un = {
|
|
|
1363
1363
|
},
|
|
1364
1364
|
emits: ["update:show"],
|
|
1365
1365
|
setup(c) {
|
|
1366
|
-
const d = tt(), r = He(), s =
|
|
1367
|
-
async function
|
|
1366
|
+
const d = tt(), r = He(), s = $e(), S = gn(), l = ue(), a = Bt(), { t: i } = le(), g = c, k = H(!1), u = de(), o = H(ct(0));
|
|
1367
|
+
async function $() {
|
|
1368
1368
|
k.value = !0;
|
|
1369
1369
|
try {
|
|
1370
|
-
await
|
|
1371
|
-
} catch (
|
|
1370
|
+
await V(), await r.readStockBalance();
|
|
1371
|
+
} catch (t) {
|
|
1372
1372
|
u.open({
|
|
1373
1373
|
title: "Something went wrong",
|
|
1374
1374
|
message: "Cannot fetch stock history. Please try again.",
|
|
1375
1375
|
type: "error"
|
|
1376
|
-
}), console.log("failed at fetching item adjustment history",
|
|
1376
|
+
}), console.log("failed at fetching item adjustment history", g.sku, o, t);
|
|
1377
1377
|
} finally {
|
|
1378
1378
|
k.value = !1;
|
|
1379
1379
|
}
|
|
1380
1380
|
}
|
|
1381
1381
|
Je(() => {
|
|
1382
|
-
|
|
1383
|
-
}),
|
|
1384
|
-
|
|
1382
|
+
$();
|
|
1383
|
+
}), ge([() => o.value, () => g.sku], () => {
|
|
1384
|
+
$();
|
|
1385
1385
|
});
|
|
1386
|
-
const
|
|
1387
|
-
function
|
|
1388
|
-
return
|
|
1386
|
+
const F = H([]), h = H([]), p = H(new Array());
|
|
1387
|
+
function j(t, e) {
|
|
1388
|
+
return e === "day" ? Dt(t) : et(t);
|
|
1389
1389
|
}
|
|
1390
|
-
function
|
|
1391
|
-
const f =
|
|
1390
|
+
function E(t, e) {
|
|
1391
|
+
const f = t.reduce(
|
|
1392
1392
|
(m, _) => {
|
|
1393
1393
|
const y = _.effectiveAt ?? ot(_._id);
|
|
1394
1394
|
if (!y)
|
|
1395
1395
|
return m;
|
|
1396
|
-
const
|
|
1397
|
-
return m[
|
|
1396
|
+
const A = j(new Date(y), e);
|
|
1397
|
+
return m[A] ?? (m[A] = []), m[A].push(_), m;
|
|
1398
1398
|
},
|
|
1399
1399
|
{}
|
|
1400
1400
|
);
|
|
@@ -1403,165 +1403,165 @@ const In = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Un = {
|
|
|
1403
1403
|
adjustments: f[m]
|
|
1404
1404
|
}));
|
|
1405
1405
|
}
|
|
1406
|
-
async function
|
|
1407
|
-
let
|
|
1408
|
-
|
|
1406
|
+
async function V() {
|
|
1407
|
+
let t = await s.readStockAdjustment(
|
|
1408
|
+
g.sku._id,
|
|
1409
1409
|
Ft(new Date(o.value.startDate)).toISOString(),
|
|
1410
1410
|
At(new Date(o.value.endDate)).toISOString()
|
|
1411
1411
|
);
|
|
1412
|
-
|
|
1413
|
-
const
|
|
1414
|
-
await
|
|
1412
|
+
F.value = t;
|
|
1413
|
+
const e = t.filter(({ ref: f }) => f == null ? void 0 : f.startsWith("bill_")).map(({ ref: f }) => f);
|
|
1414
|
+
await w(e), h.value = E(t, "day").map(({ date: f, adjustments: m }) => ({
|
|
1415
1415
|
date: f,
|
|
1416
1416
|
adjustments: m,
|
|
1417
|
-
adjustmentsByTime:
|
|
1417
|
+
adjustmentsByTime: E(m, "minute")
|
|
1418
1418
|
}));
|
|
1419
1419
|
}
|
|
1420
|
-
async function
|
|
1421
|
-
|
|
1420
|
+
async function w(t) {
|
|
1421
|
+
t.length && (p.value = await S.findBillsById(t).catch((e) => {
|
|
1422
1422
|
var _;
|
|
1423
|
-
console.error("Error on using latest bill API, retrying using legacy api",
|
|
1423
|
+
console.error("Error on using latest bill API, retrying using legacy api", e);
|
|
1424
1424
|
const f = ((_ = d.currentBusiness.value) == null ? void 0 : _._id) ?? "", m = l.currentLocation.doc._id;
|
|
1425
|
-
return S.findBillsByBusinessId(f, [m],
|
|
1425
|
+
return S.findBillsByBusinessId(f, [m], t);
|
|
1426
1426
|
}));
|
|
1427
1427
|
}
|
|
1428
|
-
const
|
|
1429
|
-
const
|
|
1430
|
-
return Mn(
|
|
1431
|
-
}),
|
|
1432
|
-
const
|
|
1433
|
-
return jn(
|
|
1434
|
-
}),
|
|
1435
|
-
const
|
|
1428
|
+
const C = U(() => {
|
|
1429
|
+
const t = F.value, e = g.sku;
|
|
1430
|
+
return Mn(t, e);
|
|
1431
|
+
}), P = U(() => {
|
|
1432
|
+
const t = F.value, e = g.sku;
|
|
1433
|
+
return jn(t, e);
|
|
1434
|
+
}), T = U(() => {
|
|
1435
|
+
const t = [...F.value].computeFirst((f) => {
|
|
1436
1436
|
var _, y;
|
|
1437
|
-
const m = (y = (_ = f.skus) == null ? void 0 : _.find) == null ? void 0 : y.call(_, (
|
|
1437
|
+
const m = (y = (_ = f.skus) == null ? void 0 : _.find) == null ? void 0 : y.call(_, (A) => A.sku._id === g.sku._id);
|
|
1438
1438
|
return m == null ? void 0 : m.fromBalance;
|
|
1439
1439
|
}) ?? {
|
|
1440
1440
|
amount: 0,
|
|
1441
1441
|
precision: 0
|
|
1442
|
-
},
|
|
1443
|
-
return
|
|
1444
|
-
value:
|
|
1442
|
+
}, e = g.sku;
|
|
1443
|
+
return e ? `${W.toFormatString({
|
|
1444
|
+
value: t,
|
|
1445
1445
|
precision: 4
|
|
1446
|
-
})} ${
|
|
1447
|
-
}),
|
|
1448
|
-
const
|
|
1446
|
+
})} ${e.unit.abbrev}` : "";
|
|
1447
|
+
}), Q = U(() => {
|
|
1448
|
+
const t = [...F.value].reverse().computeFirst((f) => {
|
|
1449
1449
|
var _, y;
|
|
1450
|
-
const m = (y = (_ = f.skus) == null ? void 0 : _.find) == null ? void 0 : y.call(_, (
|
|
1450
|
+
const m = (y = (_ = f.skus) == null ? void 0 : _.find) == null ? void 0 : y.call(_, (A) => A.sku._id === g.sku._id);
|
|
1451
1451
|
return m == null ? void 0 : m.toBalance;
|
|
1452
1452
|
}) ?? {
|
|
1453
1453
|
amount: 0,
|
|
1454
1454
|
precision: 0
|
|
1455
|
-
},
|
|
1456
|
-
return
|
|
1455
|
+
}, e = g.sku;
|
|
1456
|
+
return e ? `${W.toFormatString({ value: t, precision: 4 })} ${e.unit.abbrev}` : "";
|
|
1457
1457
|
});
|
|
1458
|
-
function
|
|
1459
|
-
switch (
|
|
1460
|
-
case
|
|
1458
|
+
function Y(t) {
|
|
1459
|
+
switch (t) {
|
|
1460
|
+
case Fe.MY:
|
|
1461
1461
|
return "MYR";
|
|
1462
|
-
case
|
|
1462
|
+
case Fe.SG:
|
|
1463
1463
|
return "SGD";
|
|
1464
|
-
case
|
|
1464
|
+
case Fe.ID:
|
|
1465
1465
|
return "IDR";
|
|
1466
1466
|
default:
|
|
1467
1467
|
return "MYR";
|
|
1468
1468
|
}
|
|
1469
1469
|
}
|
|
1470
|
-
const
|
|
1470
|
+
const N = U(() => {
|
|
1471
1471
|
var f;
|
|
1472
|
-
const
|
|
1472
|
+
const e = F.value.flatMap((m) => {
|
|
1473
1473
|
var _;
|
|
1474
1474
|
return ((_ = m.skus) == null ? void 0 : _.flatMap((y) => y.amounts)) ?? [];
|
|
1475
1475
|
}).filter((m) => m.amount.amount < 0).reduce(
|
|
1476
1476
|
(m, _) => {
|
|
1477
1477
|
const y = _.cost;
|
|
1478
1478
|
if (!y) return m;
|
|
1479
|
-
const
|
|
1479
|
+
const A = {
|
|
1480
1480
|
...wt(m, Math.max(m.precision, y.precision)),
|
|
1481
1481
|
currency: y.currency
|
|
1482
1482
|
};
|
|
1483
1483
|
return {
|
|
1484
|
-
...Ze(
|
|
1484
|
+
...Ze(A, y),
|
|
1485
1485
|
currency: m.currency
|
|
1486
1486
|
};
|
|
1487
1487
|
},
|
|
1488
1488
|
{
|
|
1489
1489
|
amount: 0,
|
|
1490
1490
|
precision: 0,
|
|
1491
|
-
currency:
|
|
1491
|
+
currency: Y(((f = d.currentCountry) == null ? void 0 : f.value) ?? Ye)
|
|
1492
1492
|
}
|
|
1493
1493
|
);
|
|
1494
|
-
return je(
|
|
1494
|
+
return je(e, !1, e.precision);
|
|
1495
1495
|
});
|
|
1496
|
-
function
|
|
1497
|
-
const { startDate:
|
|
1498
|
-
|
|
1499
|
-
startDate:
|
|
1500
|
-
endDate:
|
|
1496
|
+
function R() {
|
|
1497
|
+
const { startDate: t, endDate: e } = Vt(o.value);
|
|
1498
|
+
t !== null && e !== null && (o.value = {
|
|
1499
|
+
startDate: t,
|
|
1500
|
+
endDate: e
|
|
1501
1501
|
});
|
|
1502
1502
|
}
|
|
1503
|
-
const
|
|
1503
|
+
const K = U(() => {
|
|
1504
1504
|
var f;
|
|
1505
|
-
const
|
|
1506
|
-
var y,
|
|
1507
|
-
const _ = (
|
|
1505
|
+
const t = [...F.value].reverse().computeFirst((m) => {
|
|
1506
|
+
var y, A;
|
|
1507
|
+
const _ = (A = (y = m.skus) == null ? void 0 : y.find) == null ? void 0 : A.call(y, (z) => z.sku._id === g.sku._id);
|
|
1508
1508
|
return _ == null ? void 0 : _.toCostBalances;
|
|
1509
1509
|
});
|
|
1510
|
-
return
|
|
1511
|
-
...
|
|
1510
|
+
return t ? {
|
|
1511
|
+
...t.reduce((m, _) => W.add([m, W.fromDinero(_.cost)]), {
|
|
1512
1512
|
amount: 0,
|
|
1513
1513
|
precision: 0
|
|
1514
1514
|
}),
|
|
1515
|
-
currency:
|
|
1515
|
+
currency: Y(((f = d.currentCountry) == null ? void 0 : f.value) ?? Ye)
|
|
1516
1516
|
} : "No data";
|
|
1517
1517
|
});
|
|
1518
1518
|
function ce() {
|
|
1519
|
-
const { startDate:
|
|
1520
|
-
|
|
1521
|
-
startDate:
|
|
1522
|
-
endDate:
|
|
1519
|
+
const { startDate: t, endDate: e } = Ct(o.value);
|
|
1520
|
+
t !== null && e !== null && (o.value = {
|
|
1521
|
+
startDate: t,
|
|
1522
|
+
endDate: e
|
|
1523
1523
|
});
|
|
1524
1524
|
}
|
|
1525
|
-
const oe = Re(
|
|
1526
|
-
return (
|
|
1527
|
-
const f =
|
|
1525
|
+
const oe = Re(g, "show");
|
|
1526
|
+
return (t, e) => {
|
|
1527
|
+
const f = M("FmButton"), m = M("FmField"), _ = M("FmDateRangePicker"), y = M("FmSpacer"), A = M("FmCircularProgress"), z = M("FmIcon"), X = M("FmTooltip"), me = M("FmMenuDivider"), I = M("FmCardSection"), G = M("FmCard"), J = M("FmSideSheet");
|
|
1528
1528
|
return B(), O(J, {
|
|
1529
1529
|
"dismiss-away": "",
|
|
1530
1530
|
modelValue: v(oe),
|
|
1531
|
-
"onUpdate:modelValue":
|
|
1531
|
+
"onUpdate:modelValue": e[4] || (e[4] = (Z) => Ue(oe) ? oe.value = Z : null),
|
|
1532
1532
|
"close-button": !1,
|
|
1533
1533
|
"max-width": 560
|
|
1534
1534
|
}, {
|
|
1535
|
-
"side-sheet-header":
|
|
1535
|
+
"side-sheet-header": D(() => [
|
|
1536
1536
|
n("div", In, [
|
|
1537
|
-
n("div", Un, b(v(i)("inventory.stock.history.title", [
|
|
1537
|
+
n("div", Un, b(v(i)("inventory.stock.history.title", [t.sku.name])), 1),
|
|
1538
1538
|
x(f, {
|
|
1539
1539
|
variant: "tertiary",
|
|
1540
1540
|
"prepend-icon": "close",
|
|
1541
|
-
onClick:
|
|
1541
|
+
onClick: e[0] || (e[0] = (Z) => oe.value = !1)
|
|
1542
1542
|
})
|
|
1543
1543
|
])
|
|
1544
1544
|
]),
|
|
1545
|
-
default:
|
|
1546
|
-
var
|
|
1545
|
+
default: D(() => {
|
|
1546
|
+
var Z;
|
|
1547
1547
|
return [
|
|
1548
1548
|
n("div", Pn, [
|
|
1549
1549
|
n("div", Tn, [
|
|
1550
1550
|
n("div", Rn, [
|
|
1551
1551
|
x(_, {
|
|
1552
1552
|
modelValue: o.value,
|
|
1553
|
-
"onUpdate:modelValue":
|
|
1553
|
+
"onUpdate:modelValue": e[1] || (e[1] = (q) => o.value = q),
|
|
1554
1554
|
"show-predefined-range": "",
|
|
1555
1555
|
"start-label": "",
|
|
1556
1556
|
"end-label": "",
|
|
1557
1557
|
"z-index": 50
|
|
1558
1558
|
}, {
|
|
1559
|
-
"trigger-button":
|
|
1559
|
+
"trigger-button": D(({ opened: q }) => [
|
|
1560
1560
|
x(m, {
|
|
1561
1561
|
"prepend-icon": "calendar_month",
|
|
1562
|
-
focused:
|
|
1562
|
+
focused: q
|
|
1563
1563
|
}, {
|
|
1564
|
-
default:
|
|
1564
|
+
default: D(() => [
|
|
1565
1565
|
ve(b(o.value.startDate) + " - " + b(o.value.endDate), 1)
|
|
1566
1566
|
]),
|
|
1567
1567
|
_: 2
|
|
@@ -1572,82 +1572,82 @@ const In = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Un = {
|
|
|
1572
1572
|
]),
|
|
1573
1573
|
x(f, {
|
|
1574
1574
|
variant: "tertiary",
|
|
1575
|
-
onClick:
|
|
1575
|
+
onClick: e[2] || (e[2] = (q) => R()),
|
|
1576
1576
|
"prepend-icon": "navigate_before"
|
|
1577
1577
|
}),
|
|
1578
1578
|
x(f, {
|
|
1579
1579
|
variant: "tertiary",
|
|
1580
|
-
onClick:
|
|
1580
|
+
onClick: e[3] || (e[3] = (q) => ce()),
|
|
1581
1581
|
"prepend-icon": "navigate_next"
|
|
1582
1582
|
})
|
|
1583
1583
|
]),
|
|
1584
1584
|
k.value ? (B(), L("div", Hn, [
|
|
1585
1585
|
x(y),
|
|
1586
|
-
x(
|
|
1586
|
+
x(A, { size: "xl" }),
|
|
1587
1587
|
n("div", En, b(v(i)("inventory.stock.history.loading")), 1),
|
|
1588
1588
|
x(y),
|
|
1589
1589
|
x(y)
|
|
1590
|
-
])) :
|
|
1591
|
-
x(
|
|
1592
|
-
default:
|
|
1593
|
-
x(
|
|
1594
|
-
default:
|
|
1590
|
+
])) : h.value && ((Z = h.value) == null ? void 0 : Z.length) > 0 ? (B(), L("div", Ln, [
|
|
1591
|
+
x(G, { variant: "outlined" }, {
|
|
1592
|
+
default: D(() => [
|
|
1593
|
+
x(I, { class: "flex flex-col gap-4" }, {
|
|
1594
|
+
default: D(() => [
|
|
1595
1595
|
n("div", Nn, [
|
|
1596
1596
|
n("div", On, b(v(i)("inventory.stock.history.summary.title")), 1)
|
|
1597
1597
|
]),
|
|
1598
1598
|
n("div", zn, [
|
|
1599
1599
|
n("div", Yn, [
|
|
1600
1600
|
n("div", Kn, b(v(i)("inventory.stock.history.summary.totalPurchase")), 1),
|
|
1601
|
-
n("div", Gn, b(
|
|
1601
|
+
n("div", Gn, b(C.value.PURCHASE), 1)
|
|
1602
1602
|
]),
|
|
1603
1603
|
n("div", qn, [
|
|
1604
1604
|
n("div", Wn, [
|
|
1605
1605
|
ve(b(v(i)("inventory.stock.history.summary.totalSales")) + " ", 1),
|
|
1606
|
-
|
|
1606
|
+
P.value != null ? (B(), O(X, {
|
|
1607
1607
|
key: 0,
|
|
1608
1608
|
variant: "plain",
|
|
1609
1609
|
placement: "top",
|
|
1610
|
-
content: `Before: ${
|
|
1610
|
+
content: `Before: ${P.value}`,
|
|
1611
1611
|
"z-index": 50
|
|
1612
1612
|
}, {
|
|
1613
|
-
default:
|
|
1614
|
-
x(
|
|
1613
|
+
default: D(() => [
|
|
1614
|
+
x(z, {
|
|
1615
1615
|
name: "warning",
|
|
1616
1616
|
size: "sm"
|
|
1617
1617
|
})
|
|
1618
1618
|
]),
|
|
1619
1619
|
_: 1
|
|
1620
|
-
}, 8, ["content"])) :
|
|
1620
|
+
}, 8, ["content"])) : te("", !0)
|
|
1621
1621
|
]),
|
|
1622
|
-
n("div", Jn, b(
|
|
1622
|
+
n("div", Jn, b(C.value.SALES), 1)
|
|
1623
1623
|
]),
|
|
1624
1624
|
n("div", Qn, [
|
|
1625
1625
|
n("div", Xn, b(v(i)("inventory.stock.history.summary.totalLose")), 1),
|
|
1626
|
-
n("div", Zn, b(
|
|
1626
|
+
n("div", Zn, b(C.value.LOSE), 1)
|
|
1627
1627
|
]),
|
|
1628
1628
|
n("div", eo, [
|
|
1629
1629
|
n("div", to, b(v(i)("inventory.stock.history.summary.totalRequest")), 1),
|
|
1630
|
-
n("div", no, b(
|
|
1630
|
+
n("div", no, b(C.value.REQUEST), 1)
|
|
1631
1631
|
]),
|
|
1632
1632
|
n("div", oo, [
|
|
1633
1633
|
n("div", so, b(v(i)("inventory.stock.history.summary.totalReceive")), 1),
|
|
1634
|
-
n("div", ao, b(
|
|
1634
|
+
n("div", ao, b(C.value.RECEIVE), 1)
|
|
1635
1635
|
]),
|
|
1636
1636
|
n("div", ro, [
|
|
1637
1637
|
n("div", lo, b(v(i)("inventory.stock.history.summary.totalConvert")), 1),
|
|
1638
|
-
n("div", io, b(
|
|
1638
|
+
n("div", io, b(C.value.CONVERT), 1)
|
|
1639
1639
|
]),
|
|
1640
1640
|
n("div", uo, [
|
|
1641
1641
|
n("div", co, b(v(i)("inventory.stock.history.summary.totalDamage")), 1),
|
|
1642
|
-
n("div", mo, b(
|
|
1642
|
+
n("div", mo, b(C.value.DAMAGE), 1)
|
|
1643
1643
|
]),
|
|
1644
1644
|
n("div", po, [
|
|
1645
1645
|
n("div", vo, b(v(i)("inventory.stock.history.summary.openingBalance")), 1),
|
|
1646
|
-
n("div", fo, b(
|
|
1646
|
+
n("div", fo, b(T.value), 1)
|
|
1647
1647
|
]),
|
|
1648
1648
|
n("div", yo, [
|
|
1649
1649
|
n("div", _o, b(v(i)("inventory.stock.history.summary.lastStockBalance")), 1),
|
|
1650
|
-
n("div", ko, b(
|
|
1650
|
+
n("div", ko, b(Q.value), 1)
|
|
1651
1651
|
])
|
|
1652
1652
|
]),
|
|
1653
1653
|
v(a).enableTotalCost ? (B(), L("div", ho, [
|
|
@@ -1655,17 +1655,17 @@ const In = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Un = {
|
|
|
1655
1655
|
n("div", go, [
|
|
1656
1656
|
n("div", bo, [
|
|
1657
1657
|
x(Ge, { "z-index": 50 }, {
|
|
1658
|
-
default:
|
|
1658
|
+
default: D(() => [
|
|
1659
1659
|
n("div", xo, [
|
|
1660
1660
|
ve(b(v(i)("inventory.stock.history.estimatedValue")) + " ", 1),
|
|
1661
|
-
x(
|
|
1661
|
+
x(X, {
|
|
1662
1662
|
variant: "plain",
|
|
1663
1663
|
placement: "top",
|
|
1664
1664
|
content: v(i)("inventory.stock.history.estimatedValueTooltip"),
|
|
1665
1665
|
"z-index": 50
|
|
1666
1666
|
}, {
|
|
1667
|
-
default:
|
|
1668
|
-
x(
|
|
1667
|
+
default: D(() => [
|
|
1668
|
+
x(z, {
|
|
1669
1669
|
name: "help",
|
|
1670
1670
|
size: "sm"
|
|
1671
1671
|
})
|
|
@@ -1676,23 +1676,23 @@ const In = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Un = {
|
|
|
1676
1676
|
]),
|
|
1677
1677
|
_: 1
|
|
1678
1678
|
}),
|
|
1679
|
-
n("div", So, b(typeof
|
|
1679
|
+
n("div", So, b(typeof K.value != "string" ? v(je)(K.value, !1, K.value.precision) : K.value), 1)
|
|
1680
1680
|
]),
|
|
1681
1681
|
n("div", $o, [
|
|
1682
1682
|
x(Ge, { "z-index": 50 }, {
|
|
1683
|
-
default:
|
|
1683
|
+
default: D(() => [
|
|
1684
1684
|
n("div", wo, [
|
|
1685
1685
|
ve(b(v(i)("inventory.stock.history.costSold")) + " ", 1),
|
|
1686
|
-
x(
|
|
1686
|
+
x(X, {
|
|
1687
1687
|
variant: "plain",
|
|
1688
1688
|
placement: "top",
|
|
1689
1689
|
"z-index": 50
|
|
1690
1690
|
}, {
|
|
1691
|
-
content:
|
|
1691
|
+
content: D(() => [
|
|
1692
1692
|
n("div", Bo, b(v(i)("inventory.stock.history.costSoldTooltip")), 1)
|
|
1693
1693
|
]),
|
|
1694
|
-
default:
|
|
1695
|
-
x(
|
|
1694
|
+
default: D(() => [
|
|
1695
|
+
x(z, {
|
|
1696
1696
|
name: "help",
|
|
1697
1697
|
size: "sm"
|
|
1698
1698
|
})
|
|
@@ -1703,26 +1703,26 @@ const In = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Un = {
|
|
|
1703
1703
|
]),
|
|
1704
1704
|
_: 1
|
|
1705
1705
|
}),
|
|
1706
|
-
n("div", Fo, b(
|
|
1706
|
+
n("div", Fo, b(N.value), 1)
|
|
1707
1707
|
])
|
|
1708
1708
|
])
|
|
1709
|
-
])) :
|
|
1709
|
+
])) : te("", !0)
|
|
1710
1710
|
]),
|
|
1711
1711
|
_: 1
|
|
1712
1712
|
})
|
|
1713
1713
|
]),
|
|
1714
1714
|
_: 1
|
|
1715
1715
|
}),
|
|
1716
|
-
|
|
1717
|
-
(B(!0), L(
|
|
1718
|
-
key:
|
|
1716
|
+
e[5] || (e[5] = n("div", null, null, -1)),
|
|
1717
|
+
(B(!0), L(ne, null, ae(h.value, (q) => (B(), L(ne, {
|
|
1718
|
+
key: q.date
|
|
1719
1719
|
}, [
|
|
1720
|
-
|
|
1720
|
+
t.sku ? (B(), O(Dn, {
|
|
1721
1721
|
key: 0,
|
|
1722
|
-
record:
|
|
1723
|
-
sku:
|
|
1722
|
+
record: q,
|
|
1723
|
+
sku: t.sku,
|
|
1724
1724
|
bills: p.value
|
|
1725
|
-
}, null, 8, ["record", "sku", "bills"])) :
|
|
1725
|
+
}, null, 8, ["record", "sku", "bills"])) : te("", !0)
|
|
1726
1726
|
], 64))), 128))
|
|
1727
1727
|
])) : (B(), L("div", Ao, [
|
|
1728
1728
|
x(y),
|
|
@@ -1744,15 +1744,15 @@ const In = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Un = {
|
|
|
1744
1744
|
}, 8, ["modelValue"]);
|
|
1745
1745
|
};
|
|
1746
1746
|
}
|
|
1747
|
-
}), jo = { class: "
|
|
1747
|
+
}), jo = { class: "flex flex-col gap-8" }, Io = { class: "flex flex-col" }, Uo = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Po = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary line-clamp-1" }, Xo = /* @__PURE__ */ re({
|
|
1748
1748
|
__name: "StockView",
|
|
1749
1749
|
setup(c) {
|
|
1750
1750
|
const { t: d } = le(), r = Te(), s = ue(), S = He(), l = lt(), a = at(), { columnDefs: i } = qt();
|
|
1751
1751
|
s.watchLocation(u);
|
|
1752
|
-
const
|
|
1752
|
+
const g = H(!1), k = de();
|
|
1753
1753
|
async function u() {
|
|
1754
1754
|
if (s._currentLocation) {
|
|
1755
|
-
|
|
1755
|
+
g.value = !0;
|
|
1756
1756
|
try {
|
|
1757
1757
|
await S.readStockBalance(), await S.readProductBalance(), await a.readStockEstimateBalance();
|
|
1758
1758
|
} catch {
|
|
@@ -1762,101 +1762,109 @@ const In = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Un = {
|
|
|
1762
1762
|
type: "error"
|
|
1763
1763
|
});
|
|
1764
1764
|
} finally {
|
|
1765
|
-
|
|
1765
|
+
g.value = !1;
|
|
1766
1766
|
}
|
|
1767
1767
|
}
|
|
1768
1768
|
}
|
|
1769
|
-
const o =
|
|
1770
|
-
() => r.skus.map((
|
|
1771
|
-
var
|
|
1772
|
-
const
|
|
1773
|
-
let
|
|
1774
|
-
(
|
|
1775
|
-
)) == null ? void 0 :
|
|
1776
|
-
(
|
|
1769
|
+
const o = U(
|
|
1770
|
+
() => r.skus.map((w) => {
|
|
1771
|
+
var Y, N, R;
|
|
1772
|
+
const C = w.trackingMeasurement;
|
|
1773
|
+
let P = (N = (Y = S.stockBalance.skus) == null ? void 0 : Y.find(
|
|
1774
|
+
(K) => K.id === w._id
|
|
1775
|
+
)) == null ? void 0 : N.balance, T = a.inventoryForecast.skus.find(
|
|
1776
|
+
(K) => K.id === w._id
|
|
1777
1777
|
);
|
|
1778
1778
|
return {
|
|
1779
|
-
|
|
1780
|
-
balance:
|
|
1779
|
+
...w,
|
|
1780
|
+
balance: P ?? {
|
|
1781
1781
|
amount: 0,
|
|
1782
1782
|
precision: 0
|
|
1783
1783
|
},
|
|
1784
|
-
day: (
|
|
1785
|
-
trackingUnitAbbrev:
|
|
1784
|
+
day: (T == null ? void 0 : T.depletionDays) ?? void 0,
|
|
1785
|
+
trackingUnitAbbrev: C ? ((R = w.unit.measurements.find((K) => K.id === C)) == null ? void 0 : R.abbrev) ?? "" : w.unit.abbrev
|
|
1786
1786
|
};
|
|
1787
1787
|
})
|
|
1788
|
-
),
|
|
1788
|
+
), $ = H(""), { breakpoints: F } = jt(), h = U(() => F.value.xs || F.value.sm), p = U(() => h.value ? 10 : 20), j = dt(), E = U(
|
|
1789
1789
|
() => {
|
|
1790
|
-
var
|
|
1791
|
-
return ((
|
|
1790
|
+
var w;
|
|
1791
|
+
return ((w = s._currentLocation) == null ? void 0 : w.type) === Mt.restaurant;
|
|
1792
1792
|
}
|
|
1793
|
-
),
|
|
1794
|
-
const
|
|
1793
|
+
), V = U(() => {
|
|
1794
|
+
const w = [
|
|
1795
1795
|
{ icon: "ios_share", onClick: () => zt(o.value) }
|
|
1796
1796
|
];
|
|
1797
|
-
return
|
|
1797
|
+
return E.value ? [{ icon: "refresh", onClick: u }, ...w] : w;
|
|
1798
1798
|
});
|
|
1799
|
-
return (
|
|
1800
|
-
const
|
|
1799
|
+
return (w, C) => {
|
|
1800
|
+
const P = M("FmTable");
|
|
1801
1801
|
return B(), O(mt, {
|
|
1802
1802
|
title: v(d)("inventory.stock.title")
|
|
1803
1803
|
}, {
|
|
1804
|
-
default:
|
|
1805
|
-
var
|
|
1804
|
+
default: D(() => {
|
|
1805
|
+
var T, Q, Y, N;
|
|
1806
1806
|
return [
|
|
1807
|
-
n("div",
|
|
1807
|
+
n("div", {
|
|
1808
|
+
class: he([
|
|
1809
|
+
"flex flex-col gap-8 max-h-full",
|
|
1810
|
+
{
|
|
1811
|
+
"p-0": h.value,
|
|
1812
|
+
"px-24 ": !h.value
|
|
1813
|
+
}
|
|
1814
|
+
])
|
|
1815
|
+
}, [
|
|
1808
1816
|
x(pt, {
|
|
1809
1817
|
searchable: "",
|
|
1810
1818
|
"change-location": "",
|
|
1811
|
-
search:
|
|
1812
|
-
"onUpdate:search":
|
|
1813
|
-
actions:
|
|
1819
|
+
search: $.value,
|
|
1820
|
+
"onUpdate:search": C[0] || (C[0] = (R) => $.value = R),
|
|
1821
|
+
actions: V.value
|
|
1814
1822
|
}, null, 8, ["search", "actions"]),
|
|
1815
|
-
(B(), O(
|
|
1816
|
-
style: Qe(v(
|
|
1823
|
+
(B(), O(P, {
|
|
1824
|
+
style: Qe(v(j).tableHeight),
|
|
1817
1825
|
"column-defs": v(i),
|
|
1818
1826
|
"row-data": o.value,
|
|
1819
|
-
"search-value":
|
|
1820
|
-
loading:
|
|
1821
|
-
key: (
|
|
1822
|
-
onRowClick:
|
|
1823
|
-
"page-size":
|
|
1827
|
+
"search-value": $.value,
|
|
1828
|
+
loading: g.value || !v(s)._currentLocation,
|
|
1829
|
+
key: (T = v(s)._currentLocation) == null ? void 0 : T.dbName,
|
|
1830
|
+
onRowClick: C[1] || (C[1] = (R) => v(l).showSkuHistory(R.original)),
|
|
1831
|
+
"page-size": p.value
|
|
1824
1832
|
}, {
|
|
1825
|
-
"list-row":
|
|
1833
|
+
"list-row": D((R) => [
|
|
1826
1834
|
x(Ut, {
|
|
1827
|
-
row:
|
|
1835
|
+
row: R,
|
|
1828
1836
|
onRowClick: v(l).showSkuHistory
|
|
1829
1837
|
}, {
|
|
1830
|
-
default:
|
|
1831
|
-
var
|
|
1838
|
+
default: D((K) => {
|
|
1839
|
+
var ce, oe, t, e, f, m, _, y, A, z;
|
|
1832
1840
|
return [
|
|
1833
|
-
n("div",
|
|
1834
|
-
n("div",
|
|
1835
|
-
n("div",
|
|
1841
|
+
n("div", jo, [
|
|
1842
|
+
n("div", Io, [
|
|
1843
|
+
n("div", Uo, [
|
|
1836
1844
|
x(v(Ke), {
|
|
1837
|
-
render: (
|
|
1838
|
-
props: (
|
|
1845
|
+
render: (t = (oe = (ce = K.code) == null ? void 0 : ce.column) == null ? void 0 : oe.columnDef) == null ? void 0 : t.cell,
|
|
1846
|
+
props: (f = (e = K.code) == null ? void 0 : e.getContext) == null ? void 0 : f.call(e)
|
|
1839
1847
|
}, null, 8, ["render", "props"])
|
|
1840
1848
|
]),
|
|
1841
|
-
n("div",
|
|
1849
|
+
n("div", Po, [
|
|
1842
1850
|
x(v(Ke), {
|
|
1843
|
-
render: (
|
|
1844
|
-
props: (
|
|
1851
|
+
render: (y = (_ = (m = K.name) == null ? void 0 : m.column) == null ? void 0 : _.columnDef) == null ? void 0 : y.cell,
|
|
1852
|
+
props: (z = (A = K.name) == null ? void 0 : A.getContext) == null ? void 0 : z.call(A)
|
|
1845
1853
|
}, null, 8, ["render", "props"])
|
|
1846
1854
|
])
|
|
1847
1855
|
]),
|
|
1848
1856
|
n("div", null, [
|
|
1849
1857
|
x(Ie, {
|
|
1850
|
-
days:
|
|
1858
|
+
days: R.original.day
|
|
1851
1859
|
}, null, 8, ["days"])
|
|
1852
1860
|
]),
|
|
1853
1861
|
n("div", null, [
|
|
1854
1862
|
x(rt, {
|
|
1855
1863
|
class: "xs:w-[160px]",
|
|
1856
|
-
unit:
|
|
1857
|
-
sku:
|
|
1858
|
-
amount:
|
|
1859
|
-
"default-tracking-measurement":
|
|
1864
|
+
unit: R.original.unit,
|
|
1865
|
+
sku: R.original,
|
|
1866
|
+
amount: R.original.balance,
|
|
1867
|
+
"default-tracking-measurement": R.original.trackingMeasurement ?? void 0
|
|
1860
1868
|
}, null, 8, ["unit", "sku", "amount", "default-tracking-measurement"])
|
|
1861
1869
|
])
|
|
1862
1870
|
])
|
|
@@ -1867,11 +1875,11 @@ const In = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Un = {
|
|
|
1867
1875
|
]),
|
|
1868
1876
|
_: 1
|
|
1869
1877
|
}, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"]))
|
|
1870
|
-
]),
|
|
1878
|
+
], 2),
|
|
1871
1879
|
(B(), O(ut, { to: "body" }, [
|
|
1872
|
-
(
|
|
1873
|
-
(
|
|
1874
|
-
(
|
|
1880
|
+
(Q = v(l).stockHistoryProps) != null && Q.sku ? (B(), O(Mo, we(Be({ key: 0 }, v(l).stockHistoryProps)), null, 16)) : te("", !0),
|
|
1881
|
+
(Y = v(l).convertSkuDialogProps) != null && Y.sku ? (B(), O(cn, we(Be({ key: 1 }, v(l).convertSkuDialogProps)), null, 16)) : te("", !0),
|
|
1882
|
+
(N = v(l).adjustSkuDialogProps) != null && N.stock ? (B(), O(hn, we(Be({ key: 2 }, v(l).adjustSkuDialogProps)), null, 16)) : te("", !0)
|
|
1875
1883
|
]))
|
|
1876
1884
|
];
|
|
1877
1885
|
}),
|
|
@@ -1881,5 +1889,5 @@ const In = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Un = {
|
|
|
1881
1889
|
}
|
|
1882
1890
|
});
|
|
1883
1891
|
export {
|
|
1884
|
-
|
|
1892
|
+
Xo as default
|
|
1885
1893
|
};
|