@feedmepos/mf-inventory-portal 1.2.25-dev.5 → 1.2.25-dev.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{App-BLvRYbP3.js → App-XTZXPNvj.js} +1 -1
- package/dist/{ApprovalView-C02mF_AP.js → ApprovalView-BxSSI22z.js} +2 -2
- package/dist/{BindingsDialog-Cts3vxna.js → BindingsDialog-DNc9hLdV.js} +2 -2
- package/dist/{BindingsPicker-Ue6ejF_K.js → BindingsPicker-CxXxfj9T.js} +1 -1
- package/dist/{BindingsTable-DXQCzZjn.js → BindingsTable-Btb348tg.js} +1 -1
- package/dist/{ClosingDraftView-CvjGUHZO.js → ClosingDraftView-CSTykijP.js} +3 -3
- package/dist/{ClosingHistoryView-DyFH9xwT.js → ClosingHistoryView-BYiVhWxC.js} +2 -2
- package/dist/{ClosingTemplateView-BnIW4oJG.js → ClosingTemplateView-C4cqNEH9.js} +2 -2
- package/dist/{DeliveryOrderPrintPreview-CoKYYK_r.js → DeliveryOrderPrintPreview-DOA_kGIs.js} +1 -1
- package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-DeQqb7gF.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-C_HE38Gy.js} +3 -3
- package/dist/{FmMultiselectDialog-D68-NrC2.js → FmMultiselectDialog-B-6gCWkR.js} +1 -1
- package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-DKT4XbVH.js → FmUnitInput.vue_vue_type_script_setup_true_lang-DIJtb6kQ.js} +1 -1
- package/dist/{ImportView-CRauRe2S.js → ImportView-CZotI5Z3.js} +2 -2
- package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-1NIZ2a81.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-uXnVeBfZ.js} +1 -1
- package/dist/{IngredientGroupView-DCAZ4pU9.js → IngredientGroupView-CwaEyLWd.js} +2 -2
- package/dist/{IngredientsView-CyoMUisE.js → IngredientsView-DYGTSluF.js} +7 -7
- package/dist/{IntegrationView-B_dcI4mj.js → IntegrationView-BsC8Tso0.js} +3 -3
- package/dist/{InventoryBindingForm-C1ZJEtE7.js → InventoryBindingForm-BBeR76cI.js} +1 -1
- package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-BQbLoI2W.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-qt9zx8EX.js} +3 -3
- package/dist/{InventoryBindingSummary-CcOjBRRR.js → InventoryBindingSummary-fFpbPy3o.js} +1 -1
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-iO-mDVWY.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-CGEHcEXf.js} +1 -1
- package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-7efFCZb6.js → PremiumBadge.vue_vue_type_script_setup_true_lang-DN_Tg3Ag.js} +1 -1
- package/dist/{PublishView-DXZmnDAP.js → PublishView-COp7msuu.js} +1 -1
- package/dist/{PurchaseOrderPrintPreview-KH-w25KF.js → PurchaseOrderPrintPreview-DlOMlnor.js} +1 -1
- package/dist/{ReceiveRequestView-DsubIIkm.js → ReceiveRequestView-Dg7TOM7K.js} +8 -8
- package/dist/{RecipeView-U0BLGGFZ.js → RecipeView-D5Fg8pPh.js} +3 -3
- package/dist/{StockView-CYRaxuO7.js → StockView-dx_7MrQr.js} +343 -339
- package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-xwC-kmA0.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-Cv7LwHDM.js} +1 -1
- package/dist/{SupplierView-CX9ereMH.js → SupplierView-DqgHDC29.js} +4 -4
- package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-CIlBtyao.js → TransferDetails.vue_vue_type_script_setup_true_lang-BIay4c9Z.js} +5 -5
- package/dist/{TransferTemplateView-DOypXNz7.js → TransferTemplateView-B9v54c3c.js} +7 -7
- package/dist/{UnitView-uDFW81Gc.js → UnitView-fifkCRuV.js} +3 -3
- package/dist/{WarehouseView-BwZQivPr.js → WarehouseView-CPirimyL.js} +1 -1
- package/dist/{app-j0mQzil3.js → app-CD9h20sX.js} +201 -201
- package/dist/app.js +1 -1
- package/dist/{decimal-7LM2H0k9.js → decimal-DYcANN4D.js} +1 -1
- package/dist/{format-unit-display-Cctgmmj2.js → format-unit-display-CX8se_cM.js} +3 -3
- package/dist/{import-export.helper-BsdiAEzw.js → import-export.helper-Cj-Qxxkr.js} +1 -1
- package/dist/{index-CnHIy-jP.js → index-BIzKuGTx.js} +1 -1
- package/dist/{index-UOzWzM0n.js → index-BywPZS7F.js} +1 -1
- package/dist/{purchase-order-template-i8LJbyPI.js → purchase-order-template-C7bNpwRs.js} +1 -1
- package/dist/{stock-COYoMTox.js → stock-B2clWpa9.js} +1 -1
- package/dist/{stock-Bo1L-891.js → stock-C5k9qQNO.js} +2 -2
- package/dist/{supplier-Zks-8WbJ.js → supplier-GOu1-ydl.js} +1 -1
- package/dist/{use-ingredient-select-dialog-DdRFcZ8T.js → use-ingredient-select-dialog-BKChxIvw.js} +1 -1
- package/dist/{use-inventory-binding-dialog-DB1OGLHG.js → use-inventory-binding-dialog-CLhMKqSz.js} +1 -1
- package/package.json +1 -1
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { defineComponent as ue, ref as O, computed as P, resolveComponent as U, openBlock as
|
|
2
|
-
import { u as ke, a2 as
|
|
3
|
-
import { u as Me } from "./stock-
|
|
4
|
-
import { g as Se } from "./decimal-
|
|
5
|
-
import { e as Lt, u as rt, i as it, _ as Ze } from "./PremiumBadge.vue_vue_type_script_setup_true_lang-
|
|
6
|
-
import { _ as Ye, S as Re, g as ut, a as zt } from "./SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-
|
|
1
|
+
import { defineComponent as ue, ref as O, computed as P, resolveComponent as U, openBlock as V, createBlock as z, withCtx as T, createElementVNode as e, normalizeClass as he, toDisplayString as v, createVNode as y, createElementBlock as Y, Fragment as ne, renderList as ie, unref as s, h as ye, watch as xe, isRef as je, createCommentVNode as se, reactive as nt, mergeModels as qe, useModel as pt, onMounted as Le, createTextVNode as de, normalizeStyle as ot, Teleport as ft, normalizeProps as Te, mergeProps as He } from "vue";
|
|
2
|
+
import { u as ke, a2 as pe, f as De, h as ze, i as vt, a as Be, F as Xe, a3 as yt, z as Ne, n as ve, Z as _t, t as Ae, a1 as Ve, A as kt, M as bt, a0 as _e, a4 as gt, a5 as te, a6 as ht, a7 as Je, a8 as st, a9 as Ge, r as xt, x as at, aa as St, ab as wt, ac as Ft, ad as Ee, $ as Q, ae as $t, Y as lt, af as Fe, ag as At, ah as Vt, v as Pe, w as Ct, q as jt, c as Dt, ai as Bt, aj as Mt, ak as It, al as Ut, am as Tt, b as Ht, N as Et, H as Pt, G as Rt, I as Ot, J as Nt, K as Yt, L as Qe } from "./app-CD9h20sX.js";
|
|
3
|
+
import { u as Me } from "./stock-C5k9qQNO.js";
|
|
4
|
+
import { g as Se } from "./decimal-DYcANN4D.js";
|
|
5
|
+
import { e as Lt, u as rt, i as it, _ as Ze } from "./PremiumBadge.vue_vue_type_script_setup_true_lang-DN_Tg3Ag.js";
|
|
6
|
+
import { _ as Ye, S as Re, g as ut, a as zt } from "./SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-Cv7LwHDM.js";
|
|
7
7
|
import { _ as Gt } from "./PreviewBadge.vue_vue_type_script_setup_true_lang-CRZiQHjx.js";
|
|
8
8
|
import { useI18n as ce, useCoreStore as Ke } from "@feedmepos/mf-common";
|
|
9
9
|
import { useSnackbar as be, useDialog as Ie, useProxiedModel as Ue, useBreakpoints as Kt } from "@feedmepos/ui-library";
|
|
10
10
|
import { defineStore as Wt } from "pinia";
|
|
11
|
-
import { u as ge } from "./stock-
|
|
12
|
-
import { u as qt } from "./use-inventory-binding-dialog-
|
|
13
|
-
import { _ as Xt } from "./NumberPrecisionInput.vue_vue_type_script_setup_true_lang-
|
|
11
|
+
import { u as ge } from "./stock-B2clWpa9.js";
|
|
12
|
+
import { u as qt } from "./use-inventory-binding-dialog-CLhMKqSz.js";
|
|
13
|
+
import { _ as Xt } from "./NumberPrecisionInput.vue_vue_type_script_setup_true_lang-CGEHcEXf.js";
|
|
14
14
|
import { E as Jt } from "./empty-placeholder-wf6-BWE8.js";
|
|
15
|
-
var $e = /* @__PURE__ */ ((
|
|
15
|
+
var $e = /* @__PURE__ */ ((k) => (k.History = "History", k.Convert = "Convert", k.Adjust = "Adjust", k))($e || {});
|
|
16
16
|
const Qt = [
|
|
17
17
|
{
|
|
18
18
|
translationKey: "inventory.stock.action.history",
|
|
@@ -40,16 +40,16 @@ const Qt = [
|
|
|
40
40
|
/* Adjust */
|
|
41
41
|
}
|
|
42
42
|
];
|
|
43
|
-
async function en(
|
|
43
|
+
async function en(k) {
|
|
44
44
|
const d = `${(ke().currentLocation.name || "").replace(
|
|
45
45
|
/ /g,
|
|
46
46
|
"_"
|
|
47
|
-
)}_${
|
|
47
|
+
)}_${pe().format("DD_MM_YYYY_HHmm")}.xlsx`;
|
|
48
48
|
await Lt(
|
|
49
49
|
[
|
|
50
50
|
{
|
|
51
51
|
name: "stock",
|
|
52
|
-
data:
|
|
52
|
+
data: k,
|
|
53
53
|
columns: [
|
|
54
54
|
{
|
|
55
55
|
name: "Code",
|
|
@@ -80,8 +80,8 @@ async function en(_) {
|
|
|
80
80
|
d
|
|
81
81
|
);
|
|
82
82
|
}
|
|
83
|
-
function Ce(
|
|
84
|
-
const d = localStorage.getItem(`uom:${
|
|
83
|
+
function Ce(k, g) {
|
|
84
|
+
const d = localStorage.getItem(`uom:${k._id}`);
|
|
85
85
|
return d ? d === g._id ? {
|
|
86
86
|
type: "unit"
|
|
87
87
|
} : g.measurements.find((o) => o.id === d) ? {
|
|
@@ -89,9 +89,9 @@ function Ce(_, g) {
|
|
|
89
89
|
measurement: d
|
|
90
90
|
} : {
|
|
91
91
|
type: "unit"
|
|
92
|
-
} :
|
|
92
|
+
} : k.trackingMeasurement && g.measurements.find((o) => o.id === k.trackingMeasurement) ? {
|
|
93
93
|
type: "measurement",
|
|
94
|
-
measurement:
|
|
94
|
+
measurement: k.trackingMeasurement
|
|
95
95
|
} : {
|
|
96
96
|
type: "unit"
|
|
97
97
|
};
|
|
@@ -104,7 +104,7 @@ const tn = { class: "fm-typo-en-body-md-400 flex-grow" }, ct = /* @__PURE__ */ u
|
|
|
104
104
|
amount: {},
|
|
105
105
|
defaultTrackingMeasurement: {}
|
|
106
106
|
},
|
|
107
|
-
setup(
|
|
107
|
+
setup(k) {
|
|
108
108
|
function g(j) {
|
|
109
109
|
return `uom:${j._id}`;
|
|
110
110
|
}
|
|
@@ -112,7 +112,7 @@ const tn = { class: "fm-typo-en-body-md-400 flex-grow" }, ct = /* @__PURE__ */ u
|
|
|
112
112
|
const F = g(o.sku);
|
|
113
113
|
j ? localStorage.setItem(F, j) : localStorage.setItem(F, o.unit._id), $.value = Ce(o.sku, o.unit);
|
|
114
114
|
}
|
|
115
|
-
const o =
|
|
115
|
+
const o = k, $ = O(Ce(o.sku, o.unit)), S = P(() => {
|
|
116
116
|
const { measurements: j } = o.unit;
|
|
117
117
|
return [
|
|
118
118
|
{
|
|
@@ -135,8 +135,8 @@ const tn = { class: "fm-typo-en-body-md-400 flex-grow" }, ct = /* @__PURE__ */ u
|
|
|
135
135
|
}
|
|
136
136
|
), w = O(!1);
|
|
137
137
|
return (j, F) => {
|
|
138
|
-
const u = U("FmIcon"),
|
|
139
|
-
return
|
|
138
|
+
const u = U("FmIcon"), b = U("FmMenuItem"), C = U("FmMenu");
|
|
139
|
+
return V(), z(C, {
|
|
140
140
|
"stop-click-propagation": "",
|
|
141
141
|
onMenuChanged: F[0] || (F[0] = (B) => w.value = B)
|
|
142
142
|
}, {
|
|
@@ -156,7 +156,7 @@ const tn = { class: "fm-typo-en-body-md-400 flex-grow" }, ct = /* @__PURE__ */ u
|
|
|
156
156
|
], 2)
|
|
157
157
|
]),
|
|
158
158
|
default: T(() => [
|
|
159
|
-
(
|
|
159
|
+
(V(!0), Y(ne, null, ie(S.value, (B) => (V(), z(b, {
|
|
160
160
|
key: B.value ?? 0,
|
|
161
161
|
label: B.label,
|
|
162
162
|
"model-value": m(B),
|
|
@@ -169,9 +169,9 @@ const tn = { class: "fm-typo-en-body-md-400 flex-grow" }, ct = /* @__PURE__ */ u
|
|
|
169
169
|
}
|
|
170
170
|
}), nn = { class: "whitespace-nowrap" }, on = /* @__PURE__ */ ue({
|
|
171
171
|
__name: "StockHeaderPreview",
|
|
172
|
-
setup(
|
|
172
|
+
setup(k) {
|
|
173
173
|
const { t: g } = ce();
|
|
174
|
-
return (d, o) => (
|
|
174
|
+
return (d, o) => (V(), z(Gt, null, {
|
|
175
175
|
default: T(() => [
|
|
176
176
|
e("div", nn, v(s(g)("inventory.stock.prediction.daysRemaining")), 1)
|
|
177
177
|
]),
|
|
@@ -179,10 +179,10 @@ const tn = { class: "fm-typo-en-body-md-400 flex-grow" }, ct = /* @__PURE__ */ u
|
|
|
179
179
|
}));
|
|
180
180
|
}
|
|
181
181
|
}), dt = Wt("stockActions", () => {
|
|
182
|
-
const
|
|
182
|
+
const k = O(!1), g = ke(), d = Me(), o = rt(), $ = be(), S = Ie(), { t: m } = ce();
|
|
183
183
|
async function i() {
|
|
184
184
|
if (g._currentLocation) {
|
|
185
|
-
|
|
185
|
+
k.value = !0;
|
|
186
186
|
try {
|
|
187
187
|
await d.readStockBalance(), await d.readProductBalance(), await o.readStockEstimateBalance();
|
|
188
188
|
} catch {
|
|
@@ -192,14 +192,14 @@ const tn = { class: "fm-typo-en-body-md-400 flex-grow" }, ct = /* @__PURE__ */ u
|
|
|
192
192
|
type: "error"
|
|
193
193
|
});
|
|
194
194
|
} finally {
|
|
195
|
-
|
|
195
|
+
k.value = !1;
|
|
196
196
|
}
|
|
197
197
|
}
|
|
198
198
|
}
|
|
199
199
|
const w = O();
|
|
200
200
|
async function j(D) {
|
|
201
|
-
var x,
|
|
202
|
-
if (!!!((
|
|
201
|
+
var x, _, A;
|
|
202
|
+
if (!!!((_ = (x = D.convert) == null ? void 0 : x.inventoryBindings) != null && _.length)) {
|
|
203
203
|
S.open({
|
|
204
204
|
title: m("inventory.stock.error.convert.title"),
|
|
205
205
|
message: m("inventory.stock.error.convert.message")
|
|
@@ -207,7 +207,7 @@ const tn = { class: "fm-typo-en-body-md-400 flex-grow" }, ct = /* @__PURE__ */ u
|
|
|
207
207
|
return;
|
|
208
208
|
}
|
|
209
209
|
const l = {
|
|
210
|
-
maxCount: ((
|
|
210
|
+
maxCount: ((A = d.productBalance.find(({ id: H }) => H === D._id)) == null ? void 0 : A.count) || 0,
|
|
211
211
|
sku: D,
|
|
212
212
|
show: !0,
|
|
213
213
|
"onUpdate:show"(H) {
|
|
@@ -233,22 +233,22 @@ const tn = { class: "fm-typo-en-body-md-400 flex-grow" }, ct = /* @__PURE__ */ u
|
|
|
233
233
|
};
|
|
234
234
|
F.value = a;
|
|
235
235
|
}
|
|
236
|
-
const
|
|
237
|
-
async function
|
|
236
|
+
const b = O();
|
|
237
|
+
async function C(D) {
|
|
238
238
|
const a = {
|
|
239
239
|
sku: D,
|
|
240
240
|
show: !0,
|
|
241
241
|
"onUpdate:show"(t) {
|
|
242
|
-
|
|
242
|
+
b.value.show = t;
|
|
243
243
|
}
|
|
244
244
|
};
|
|
245
|
-
|
|
245
|
+
b.value = a;
|
|
246
246
|
}
|
|
247
247
|
function B(D, a) {
|
|
248
248
|
const t = De(a);
|
|
249
249
|
switch (D) {
|
|
250
250
|
case $e.History:
|
|
251
|
-
|
|
251
|
+
C(t);
|
|
252
252
|
return;
|
|
253
253
|
case $e.Convert:
|
|
254
254
|
j(t);
|
|
@@ -261,15 +261,15 @@ const tn = { class: "fm-typo-en-body-md-400 flex-grow" }, ct = /* @__PURE__ */ u
|
|
|
261
261
|
return {
|
|
262
262
|
fetchStockBalance: i,
|
|
263
263
|
onActionMenu: B,
|
|
264
|
-
stockHistoryProps:
|
|
265
|
-
showSkuHistory:
|
|
264
|
+
stockHistoryProps: b,
|
|
265
|
+
showSkuHistory: C,
|
|
266
266
|
convertSkuDialogProps: w,
|
|
267
267
|
adjustSkuDialogProps: F
|
|
268
268
|
};
|
|
269
269
|
});
|
|
270
270
|
function sn() {
|
|
271
271
|
var S;
|
|
272
|
-
const
|
|
272
|
+
const k = ke(), g = dt(), d = Ke(), { t: o } = ce();
|
|
273
273
|
return {
|
|
274
274
|
columnDefs: [
|
|
275
275
|
{
|
|
@@ -325,8 +325,8 @@ function sn() {
|
|
|
325
325
|
enableSorting: !0,
|
|
326
326
|
sortUndefined: "last",
|
|
327
327
|
cell(m) {
|
|
328
|
-
var
|
|
329
|
-
const i = m.row.original.day, w = (
|
|
328
|
+
var b, C;
|
|
329
|
+
const i = m.row.original.day, w = (b = m.row.original.thresholds) == null ? void 0 : b.low, j = (C = m.row.original.thresholds) == null ? void 0 : C.mid;
|
|
330
330
|
if (typeof i != "number" || typeof w != "number" || typeof j != "number")
|
|
331
331
|
return ye(Ye, {
|
|
332
332
|
days: i
|
|
@@ -344,7 +344,7 @@ function sn() {
|
|
|
344
344
|
cell(m) {
|
|
345
345
|
var i;
|
|
346
346
|
return vt(
|
|
347
|
-
((i =
|
|
347
|
+
((i = k._currentLocation) == null ? void 0 : i.type) === "restaurant" ? Qt : Zt,
|
|
348
348
|
(w) => g.onActionMenu(w, m.row.original)
|
|
349
349
|
);
|
|
350
350
|
},
|
|
@@ -361,39 +361,39 @@ function sn() {
|
|
|
361
361
|
const an = {
|
|
362
362
|
context: null,
|
|
363
363
|
error: null,
|
|
364
|
-
isRequired(
|
|
365
|
-
return `${this.context ?? ""}`.length === 0 && (this.error =
|
|
364
|
+
isRequired(k = "This field is required") {
|
|
365
|
+
return `${this.context ?? ""}`.length === 0 && (this.error = k), this;
|
|
366
366
|
},
|
|
367
|
-
isString(
|
|
368
|
-
return this.error ? this : (typeof this.context != "string" && (this.error ?? (this.error =
|
|
367
|
+
isString(k = "Must be a valid string") {
|
|
368
|
+
return this.error ? this : (typeof this.context != "string" && (this.error ?? (this.error = k)), this);
|
|
369
369
|
},
|
|
370
370
|
toInt() {
|
|
371
371
|
return this.error ? this : (this.context = +this.context, this);
|
|
372
372
|
},
|
|
373
|
-
isInteger(
|
|
374
|
-
return this.error ? this : (this.toInt(), isNaN(this.context) && (this.error =
|
|
373
|
+
isInteger(k = "Must be an integer") {
|
|
374
|
+
return this.error ? this : (this.toInt(), isNaN(this.context) && (this.error = k), this);
|
|
375
375
|
},
|
|
376
|
-
min(
|
|
376
|
+
min(k, g) {
|
|
377
377
|
if (this.error) return this;
|
|
378
378
|
try {
|
|
379
|
-
typeof this.context == "number" ? +this.context <
|
|
379
|
+
typeof this.context == "number" ? +this.context < k && (this.error = g ?? `Must be at least ${k}`) : Object.prototype.hasOwnProperty.call(this.context, "length") ? +this.context.length < k && (this.error = g ?? `Must be at least ${k}`) : this.error = "Length cannot be determined";
|
|
380
380
|
} catch {
|
|
381
381
|
this.error = "Length cannot be determined";
|
|
382
382
|
}
|
|
383
383
|
return this;
|
|
384
384
|
},
|
|
385
|
-
max(
|
|
385
|
+
max(k, g) {
|
|
386
386
|
if (this.error) return this;
|
|
387
387
|
try {
|
|
388
|
-
typeof this.context == "number" ? +this.context >
|
|
388
|
+
typeof this.context == "number" ? +this.context > k && (this.error = g ?? `Must be at most ${k}`) : "length" in this.context ? +this.context.length > k && (this.error = g ?? `Must be at most ${k}`) : this.error = "Length cannot be determined";
|
|
389
389
|
} catch {
|
|
390
390
|
this.error = "Length cannot be determined";
|
|
391
391
|
}
|
|
392
392
|
return this;
|
|
393
393
|
}
|
|
394
394
|
};
|
|
395
|
-
function et(
|
|
396
|
-
return { ...an, context:
|
|
395
|
+
function et(k) {
|
|
396
|
+
return { ...an, context: k };
|
|
397
397
|
}
|
|
398
398
|
const ln = { class: "flex items-center" }, rn = { class: "fm-typo-en-title-md-800" }, un = { class: "flex flex-col gap-24 w-full" }, cn = { class: "flex flex-col gap-8" }, dn = { class: "fm-typo-en-body-lg-600" }, mn = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary flex-grow" }, pn = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-error" }, fn = { class: "flex flex-col p-16 gap-8" }, vn = { class: "flex flex-col gap-4" }, yn = { class: "fm-typo-en-body-md-600 text-fm-color-typo-secondary bg-fm-color-neutral-gray-100 border-b py-12 px-16" }, _n = { class: "grid grid-cols-[auto_100px_100px_48px] xs:grid-cols-[auto_80px_120px_48px] gap-8 px-8 items-center" }, kn = { class: "xs:col-span-3" }, bn = { class: "flex gap-8" }, gn = /* @__PURE__ */ ue({
|
|
399
399
|
__name: "ConvertSkuDialog",
|
|
@@ -403,8 +403,8 @@ const ln = { class: "flex items-center" }, rn = { class: "fm-typo-en-title-md-80
|
|
|
403
403
|
show: { type: Boolean }
|
|
404
404
|
},
|
|
405
405
|
emits: ["update:show", "submitted"],
|
|
406
|
-
setup(
|
|
407
|
-
const o =
|
|
406
|
+
setup(k, { expose: g, emit: d }) {
|
|
407
|
+
const o = k, $ = d, S = qt(), m = Be(), i = ge(), w = be(), { t: j } = ce(), F = O(0), u = O(null), b = P(() => m.skus), C = P(
|
|
408
408
|
() => {
|
|
409
409
|
var p, n;
|
|
410
410
|
return (((n = (p = o.sku) == null ? void 0 : p.convert) == null ? void 0 : n.inventoryBindings) ?? []).filter(
|
|
@@ -416,7 +416,7 @@ const ln = { class: "flex items-center" }, rn = { class: "fm-typo-en-title-md-80
|
|
|
416
416
|
return !!u.value;
|
|
417
417
|
},
|
|
418
418
|
set(p) {
|
|
419
|
-
p ? u.value = De(
|
|
419
|
+
p ? u.value = De(C.value) : (u.value = null, F.value = Math.min(F.value, o.maxCount ?? 0));
|
|
420
420
|
}
|
|
421
421
|
}), D = O(!1);
|
|
422
422
|
xe([() => o.show], ([p]) => {
|
|
@@ -447,7 +447,7 @@ const ln = { class: "flex items-center" }, rn = { class: "fm-typo-en-title-md-80
|
|
|
447
447
|
return r.id === ((h = o.sku.convert) == null ? void 0 : h.measurement);
|
|
448
448
|
})) == null ? void 0 : n.abbrev : o.sku.unit.abbrev;
|
|
449
449
|
}
|
|
450
|
-
),
|
|
450
|
+
), _ = P(() => {
|
|
451
451
|
var h, c;
|
|
452
452
|
const n = yt({
|
|
453
453
|
bindings: ((h = o.sku.convert) == null ? void 0 : h.inventoryBindings) ?? [],
|
|
@@ -456,8 +456,8 @@ const ln = { class: "flex items-center" }, rn = { class: "fm-typo-en-title-md-80
|
|
|
456
456
|
recipes: m.recipes
|
|
457
457
|
}).inventoryBindings.filter((f) => "success" in f && f.success).map((f) => f).map((f) => f.binding);
|
|
458
458
|
return (c = u.value ?? n) == null ? void 0 : c.map((f) => {
|
|
459
|
-
var le, re,
|
|
460
|
-
const M = m.skus.find((me) => me._id === f.id), I = ((le = f.measurement) == null ? void 0 : le.abbrev) ?? ((re = M == null ? void 0 : M.unit) == null ? void 0 : re.abbrev), G = (
|
|
459
|
+
var le, re, Z, ae, fe;
|
|
460
|
+
const M = m.skus.find((me) => me._id === f.id), I = ((le = f.measurement) == null ? void 0 : le.abbrev) ?? ((re = M == null ? void 0 : M.unit) == null ? void 0 : re.abbrev), G = (Z = o.sku.convert) != null && Z.measurement ? o.sku.unit.measurements.find((me) => {
|
|
461
461
|
var We;
|
|
462
462
|
return me.id === ((We = o.sku.convert) == null ? void 0 : We.measurement);
|
|
463
463
|
}) ?? null : null, oe = Ne(o.sku.unit, G), E = l(`${F.value}`) === !0 ? ve(
|
|
@@ -466,26 +466,26 @@ const ln = { class: "flex items-center" }, rn = { class: "fm-typo-en-title-md-80
|
|
|
466
466
|
Ae(+F.value, oe)
|
|
467
467
|
),
|
|
468
468
|
!1
|
|
469
|
-
) : "0", W = (
|
|
469
|
+
) : "0", W = (fe = (ae = u.value) == null ? void 0 : ae.find((me) => me.id === (M == null ? void 0 : M._id))) == null ? void 0 : fe.amount, q = W ? ve(W, !1) : null;
|
|
470
470
|
return {
|
|
471
471
|
sku: M,
|
|
472
472
|
convertAmount: q ?? E,
|
|
473
473
|
abbrev: I
|
|
474
474
|
};
|
|
475
475
|
});
|
|
476
|
-
}),
|
|
476
|
+
}), A = O();
|
|
477
477
|
g({
|
|
478
478
|
validateInputs: () => {
|
|
479
479
|
var p, n;
|
|
480
|
-
(n = (p =
|
|
480
|
+
(n = (p = A.value) == null ? void 0 : p.validateInputs) == null || n.call(p);
|
|
481
481
|
},
|
|
482
482
|
resetInputsValidation: () => {
|
|
483
483
|
var p, n;
|
|
484
|
-
(n = (p =
|
|
484
|
+
(n = (p = A.value) == null ? void 0 : p.resetInputsValidation) == null || n.call(p);
|
|
485
485
|
},
|
|
486
486
|
resetInputs: () => {
|
|
487
487
|
var p, n;
|
|
488
|
-
(n = (p =
|
|
488
|
+
(n = (p = A.value) == null ? void 0 : p.resetInputs) == null || n.call(p);
|
|
489
489
|
}
|
|
490
490
|
});
|
|
491
491
|
const H = Ue(o, "show");
|
|
@@ -524,7 +524,7 @@ const ln = { class: "flex items-center" }, rn = { class: "fm-typo-en-title-md-80
|
|
|
524
524
|
n.length > 0 && isFinite(h) ? c = r.map((f) => (f.id !== p || (f.amount = _e(h)), f)) : c = r.map((f) => (f.id !== p || (f.amount = { amount: 0, precision: 0 }), f)), u.value = c;
|
|
525
525
|
}
|
|
526
526
|
function R(p) {
|
|
527
|
-
const n =
|
|
527
|
+
const n = b.value.find((r) => r._id === p);
|
|
528
528
|
return n ? ut(n.unit, !0) : [];
|
|
529
529
|
}
|
|
530
530
|
function X(p, n) {
|
|
@@ -534,12 +534,12 @@ const ln = { class: "flex items-center" }, rn = { class: "fm-typo-en-title-md-80
|
|
|
534
534
|
label: h.abbrev
|
|
535
535
|
} : null;
|
|
536
536
|
}
|
|
537
|
-
function
|
|
537
|
+
function L(p, n, r) {
|
|
538
538
|
let h;
|
|
539
539
|
if (n === null)
|
|
540
540
|
h = r.map((c) => (c.id !== p || (c.measurement = null), c)) ?? [];
|
|
541
541
|
else {
|
|
542
|
-
const c =
|
|
542
|
+
const c = b.value.find((f) => f._id === p);
|
|
543
543
|
h = r.map((f) => {
|
|
544
544
|
var M, I;
|
|
545
545
|
return f.id !== p || (f.measurement = (I = (M = c == null ? void 0 : c.unit) == null ? void 0 : M.measurements) == null ? void 0 : I.find((G) => G.id === n)), f;
|
|
@@ -547,11 +547,11 @@ const ln = { class: "flex items-center" }, rn = { class: "fm-typo-en-title-md-80
|
|
|
547
547
|
}
|
|
548
548
|
u.value = h;
|
|
549
549
|
}
|
|
550
|
-
function
|
|
550
|
+
function ee(p, n) {
|
|
551
551
|
const r = n.filter((h) => h.id !== p);
|
|
552
552
|
u.value = r;
|
|
553
553
|
}
|
|
554
|
-
function
|
|
554
|
+
function J() {
|
|
555
555
|
const p = (u.value ?? []).map((n) => ({
|
|
556
556
|
...n,
|
|
557
557
|
type: Xe.enum.SKU
|
|
@@ -569,7 +569,7 @@ const ln = { class: "flex items-center" }, rn = { class: "fm-typo-en-title-md-80
|
|
|
569
569
|
}
|
|
570
570
|
), (p, n) => {
|
|
571
571
|
const r = U("FmTextField"), h = U("FmForm"), c = U("FmCard"), f = U("FmSwitch"), M = U("FmFormGroup"), I = U("FmSelect"), G = U("FmButton"), oe = U("FmSideSheet");
|
|
572
|
-
return
|
|
572
|
+
return V(), z(oe, {
|
|
573
573
|
"dismiss-away": "",
|
|
574
574
|
modelValue: s(H),
|
|
575
575
|
"onUpdate:modelValue": n[3] || (n[3] = (E) => je(H) ? H.value = E : null),
|
|
@@ -584,7 +584,7 @@ const ln = { class: "flex items-center" }, rn = { class: "fm-typo-en-title-md-80
|
|
|
584
584
|
e("div", un, [
|
|
585
585
|
y(h, {
|
|
586
586
|
ref_key: "formRef",
|
|
587
|
-
ref:
|
|
587
|
+
ref: A,
|
|
588
588
|
onValidationSuccess: a
|
|
589
589
|
}, {
|
|
590
590
|
default: T(() => [
|
|
@@ -607,9 +607,9 @@ const ln = { class: "flex items-center" }, rn = { class: "fm-typo-en-title-md-80
|
|
|
607
607
|
default: T(() => [
|
|
608
608
|
e("div", cn, [
|
|
609
609
|
e("div", dn, v(s(j)("inventory.stock.convert.deductionSummary")), 1),
|
|
610
|
-
(
|
|
610
|
+
(V(!0), Y(ne, null, ie(_.value, (E) => {
|
|
611
611
|
var W, q;
|
|
612
|
-
return
|
|
612
|
+
return V(), Y("div", {
|
|
613
613
|
key: (W = E.sku) == null ? void 0 : W._id,
|
|
614
614
|
class: "flex items-center"
|
|
615
615
|
}, [
|
|
@@ -631,20 +631,20 @@ const ln = { class: "flex items-center" }, rn = { class: "fm-typo-en-title-md-80
|
|
|
631
631
|
label: s(j)("inventory.stock.convert.overrideDeduction"),
|
|
632
632
|
"label-placement": "right"
|
|
633
633
|
}, null, 8, ["modelValue", "label"]),
|
|
634
|
-
B.value ? (
|
|
634
|
+
B.value ? (V(), Y(ne, { key: 0 }, [
|
|
635
635
|
y(M, {
|
|
636
636
|
modelValue: u.value,
|
|
637
637
|
rules: [s(kt)(1, "Must have at least one ingredient binding")]
|
|
638
638
|
}, null, 8, ["modelValue", "rules"]),
|
|
639
639
|
e("div", vn, [
|
|
640
640
|
e("div", yn, v(s(j)("inventory.stock.convert.ingredients")), 1),
|
|
641
|
-
(
|
|
641
|
+
(V(!0), Y(ne, null, ie(u.value, (E) => (V(), z(M, {
|
|
642
642
|
key: E.id,
|
|
643
643
|
disabled: D.value,
|
|
644
644
|
modelValue: +s(ve)(E.amount ?? { amount: 1, precision: 0 }),
|
|
645
645
|
rules: [
|
|
646
646
|
s(bt)(
|
|
647
|
-
|
|
647
|
+
b.value.find((W) => W._id === E.id).unit,
|
|
648
648
|
E.measurement
|
|
649
649
|
),
|
|
650
650
|
s(Ve)(0)
|
|
@@ -654,14 +654,14 @@ const ln = { class: "flex items-center" }, rn = { class: "fm-typo-en-title-md-80
|
|
|
654
654
|
var q, le, re;
|
|
655
655
|
return [
|
|
656
656
|
e("div", _n, [
|
|
657
|
-
e("div", kn, v((q =
|
|
657
|
+
e("div", kn, v((q = b.value.find((Z) => Z._id === E.id)) == null ? void 0 : q.name), 1),
|
|
658
658
|
y(r, {
|
|
659
659
|
class: "xs:col-span-2",
|
|
660
660
|
disabled: D.value,
|
|
661
661
|
modelValue: +s(ve)(
|
|
662
662
|
E.amount ?? { amount: 1, precision: 0 }
|
|
663
663
|
),
|
|
664
|
-
"onUpdate:modelValue": (
|
|
664
|
+
"onUpdate:modelValue": (Z) => K(E.id, Z, u.value ?? []),
|
|
665
665
|
invalid: W
|
|
666
666
|
}, null, 8, ["disabled", "modelValue", "onUpdate:modelValue", "invalid"]),
|
|
667
667
|
y(I, {
|
|
@@ -669,7 +669,7 @@ const ln = { class: "flex items-center" }, rn = { class: "fm-typo-en-title-md-80
|
|
|
669
669
|
class: "translate-y-[2px]",
|
|
670
670
|
items: R(E.id),
|
|
671
671
|
"model-value": (re = X(E.id, (le = E.measurement) == null ? void 0 : le.id)) == null ? void 0 : re.value,
|
|
672
|
-
"onUpdate:modelValue": (
|
|
672
|
+
"onUpdate:modelValue": (Z) => L(E.id, Z, u.value ?? []),
|
|
673
673
|
invalid: W
|
|
674
674
|
}, {
|
|
675
675
|
"helper-text": T(() => n[4] || (n[4] = [])),
|
|
@@ -680,7 +680,7 @@ const ln = { class: "flex items-center" }, rn = { class: "fm-typo-en-title-md-80
|
|
|
680
680
|
type: "button",
|
|
681
681
|
variant: "tertiary",
|
|
682
682
|
icon: "delete",
|
|
683
|
-
onClick: (
|
|
683
|
+
onClick: (Z) => ee(E.id, u.value ?? [])
|
|
684
684
|
}, null, 8, ["disabled", "onClick"])
|
|
685
685
|
])
|
|
686
686
|
];
|
|
@@ -693,7 +693,7 @@ const ln = { class: "flex items-center" }, rn = { class: "fm-typo-en-title-md-80
|
|
|
693
693
|
icon: "link",
|
|
694
694
|
label: s(j)("inventory.stock.convert.linkIngredient"),
|
|
695
695
|
variant: "plain",
|
|
696
|
-
onClick:
|
|
696
|
+
onClick: J
|
|
697
697
|
}, null, 8, ["label"])
|
|
698
698
|
])
|
|
699
699
|
], 64)) : se("", !0)
|
|
@@ -710,7 +710,7 @@ const ln = { class: "flex items-center" }, rn = { class: "fm-typo-en-title-md-80
|
|
|
710
710
|
label: s(j)("inventory.stock.convert.convertButton"),
|
|
711
711
|
onClick: n[2] || (n[2] = (E) => {
|
|
712
712
|
var W, q;
|
|
713
|
-
return (q = (W =
|
|
713
|
+
return (q = (W = A.value) == null ? void 0 : W.validateInputs) == null ? void 0 : q.call(W);
|
|
714
714
|
})
|
|
715
715
|
}, null, 8, ["loading", "label"])
|
|
716
716
|
])
|
|
@@ -720,12 +720,12 @@ const ln = { class: "flex items-center" }, rn = { class: "fm-typo-en-title-md-80
|
|
|
720
720
|
};
|
|
721
721
|
}
|
|
722
722
|
});
|
|
723
|
-
function we(
|
|
724
|
-
const d = Ae(
|
|
723
|
+
function we(k, g) {
|
|
724
|
+
const d = Ae(k, g);
|
|
725
725
|
return { ...d, amount: -d.amount };
|
|
726
726
|
}
|
|
727
|
-
function tt(
|
|
728
|
-
return Ae(Math.abs(
|
|
727
|
+
function tt(k, g) {
|
|
728
|
+
return Ae(Math.abs(k), g);
|
|
729
729
|
}
|
|
730
730
|
const Oe = {
|
|
731
731
|
[te.enum.DAMAGE]: {
|
|
@@ -759,8 +759,8 @@ const Oe = {
|
|
|
759
759
|
disabled: { type: Boolean }
|
|
760
760
|
},
|
|
761
761
|
emits: ["update:modelValue", "click:delete"],
|
|
762
|
-
setup(
|
|
763
|
-
const d =
|
|
762
|
+
setup(k, { emit: g }) {
|
|
763
|
+
const d = k, o = g, { t: $ } = ce(), S = Me(), m = P(
|
|
764
764
|
() => Object.keys(Oe).map((t) => ({
|
|
765
765
|
label: ht(t),
|
|
766
766
|
value: t
|
|
@@ -800,11 +800,11 @@ const Oe = {
|
|
|
800
800
|
return ((t = d.modelValue.measurement) == null ? void 0 : t.id) ?? null;
|
|
801
801
|
},
|
|
802
802
|
set(t) {
|
|
803
|
-
var x,
|
|
803
|
+
var x, _;
|
|
804
804
|
const l = {
|
|
805
805
|
...d.modelValue
|
|
806
806
|
};
|
|
807
|
-
l.measurement = ((
|
|
807
|
+
l.measurement = ((_ = (x = d.modelValue.doc.unit) == null ? void 0 : x.measurements) == null ? void 0 : _.find((A) => A.id === t)) ?? null, o("update:modelValue", l);
|
|
808
808
|
}
|
|
809
809
|
}), u = P({
|
|
810
810
|
get() {
|
|
@@ -816,21 +816,21 @@ const Oe = {
|
|
|
816
816
|
};
|
|
817
817
|
l.remark = t, o("update:modelValue", l);
|
|
818
818
|
}
|
|
819
|
-
}),
|
|
819
|
+
}), b = P(() => {
|
|
820
820
|
var l;
|
|
821
821
|
const t = (l = S.stockBalance.skus) == null ? void 0 : l.find((x) => x.id === d.modelValue.doc._id);
|
|
822
822
|
return (t == null ? void 0 : t.balance) ?? { amount: 0, precision: 0 };
|
|
823
|
-
}),
|
|
823
|
+
}), C = P(() => {
|
|
824
824
|
const t = d.modelValue.amount, l = d.modelValue.measurement;
|
|
825
825
|
return l ? st(t, l.conversion) : t;
|
|
826
826
|
}), B = P(
|
|
827
|
-
() => Ge(
|
|
827
|
+
() => Ge(b.value, C.value)
|
|
828
828
|
), D = P(
|
|
829
829
|
() => Se(B.value, d.modelValue.doc.unit)
|
|
830
|
-
), a = P(() =>
|
|
830
|
+
), a = P(() => C.value.amount < 0);
|
|
831
831
|
return (t, l) => {
|
|
832
|
-
const x = U("FmButton"),
|
|
833
|
-
return
|
|
832
|
+
const x = U("FmButton"), _ = U("FmSelect"), A = U("FmTextarea"), H = U("FmCard");
|
|
833
|
+
return V(), z(H, {
|
|
834
834
|
variant: "outlined",
|
|
835
835
|
class: "grid grid-cols-2 gap-8 p-16"
|
|
836
836
|
}, {
|
|
@@ -843,7 +843,7 @@ const Oe = {
|
|
|
843
843
|
onClick: l[0] || (l[0] = (N) => o("click:delete"))
|
|
844
844
|
})
|
|
845
845
|
]),
|
|
846
|
-
y(
|
|
846
|
+
y(_, {
|
|
847
847
|
disabled: t.disabled,
|
|
848
848
|
class: "col-span-2",
|
|
849
849
|
label: "Type",
|
|
@@ -864,14 +864,14 @@ const Oe = {
|
|
|
864
864
|
"onUpdate:modelValue": l[2] || (l[2] = (N) => j.value = N),
|
|
865
865
|
rules: [s(Ve)(0)]
|
|
866
866
|
}, null, 8, ["disabled", "step", "modelValue", "rules"]),
|
|
867
|
-
y(
|
|
867
|
+
y(_, {
|
|
868
868
|
disabled: t.disabled,
|
|
869
869
|
label: "Unit",
|
|
870
870
|
items: i.value,
|
|
871
871
|
modelValue: F.value,
|
|
872
872
|
"onUpdate:modelValue": l[3] || (l[3] = (N) => F.value = N)
|
|
873
873
|
}, null, 8, ["disabled", "items", "modelValue"]),
|
|
874
|
-
y(
|
|
874
|
+
y(A, {
|
|
875
875
|
class: "col-span-2",
|
|
876
876
|
disabled: t.disabled,
|
|
877
877
|
label: "Remark",
|
|
@@ -897,27 +897,27 @@ const Oe = {
|
|
|
897
897
|
show: { type: Boolean }
|
|
898
898
|
},
|
|
899
899
|
emits: ["update:show", "submitted"],
|
|
900
|
-
setup(
|
|
901
|
-
const o =
|
|
900
|
+
setup(k, { expose: g, emit: d }) {
|
|
901
|
+
const o = k, $ = d, S = Be(), m = Ie(), i = ge(), w = be(), j = O(!1), { t: F } = ce();
|
|
902
902
|
function u() {
|
|
903
903
|
D(De(B));
|
|
904
904
|
}
|
|
905
|
-
const
|
|
905
|
+
const b = O();
|
|
906
906
|
g({
|
|
907
907
|
validateInputs: () => {
|
|
908
908
|
var l, x;
|
|
909
|
-
(x = (l =
|
|
909
|
+
(x = (l = b.value) == null ? void 0 : l.validateInputs) == null || x.call(l);
|
|
910
910
|
},
|
|
911
911
|
resetInputsValidation: () => {
|
|
912
912
|
var l, x;
|
|
913
|
-
(x = (l =
|
|
913
|
+
(x = (l = b.value) == null ? void 0 : l.resetInputsValidation) == null || x.call(l);
|
|
914
914
|
},
|
|
915
915
|
resetInputs: () => {
|
|
916
916
|
var l, x;
|
|
917
|
-
(x = (l =
|
|
917
|
+
(x = (l = b.value) == null ? void 0 : l.resetInputs) == null || x.call(l);
|
|
918
918
|
}
|
|
919
919
|
});
|
|
920
|
-
const
|
|
920
|
+
const C = Ue(o, "show"), B = nt({
|
|
921
921
|
remark: "",
|
|
922
922
|
adjustments: [
|
|
923
923
|
{
|
|
@@ -947,13 +947,13 @@ const Oe = {
|
|
|
947
947
|
try {
|
|
948
948
|
await i.adjustSku({
|
|
949
949
|
remark: l.remark,
|
|
950
|
-
adjustments: l.adjustments.map(({ doc: x, remark:
|
|
950
|
+
adjustments: l.adjustments.map(({ doc: x, remark: _, type: A, amount: H, measurement: N }) => ({
|
|
951
951
|
id: x._id,
|
|
952
952
|
amount: H,
|
|
953
953
|
measurement: N,
|
|
954
|
-
remark:
|
|
954
|
+
remark: _,
|
|
955
955
|
doc: x,
|
|
956
|
-
type:
|
|
956
|
+
type: A
|
|
957
957
|
}))
|
|
958
958
|
}), $("update:show", !1), $("submitted");
|
|
959
959
|
} catch (x) {
|
|
@@ -967,11 +967,11 @@ const Oe = {
|
|
|
967
967
|
}
|
|
968
968
|
}
|
|
969
969
|
function a() {
|
|
970
|
-
const l = S.skus.map((
|
|
971
|
-
label:
|
|
972
|
-
sublabel:
|
|
973
|
-
value:
|
|
974
|
-
})), x = l.filter((
|
|
970
|
+
const l = S.skus.map((_) => ({
|
|
971
|
+
label: _.name,
|
|
972
|
+
sublabel: _.code,
|
|
973
|
+
value: _._id
|
|
974
|
+
})), x = l.filter((_) => B.adjustments.find((A) => A.doc._id === _.value)).map((_) => _.value);
|
|
975
975
|
m.open({
|
|
976
976
|
title: "Select ingredients",
|
|
977
977
|
contentComponent: at,
|
|
@@ -991,12 +991,12 @@ const Oe = {
|
|
|
991
991
|
close: !0,
|
|
992
992
|
variant: "tertiary"
|
|
993
993
|
}
|
|
994
|
-
}).onPrimary((
|
|
995
|
-
B.adjustments =
|
|
996
|
-
(
|
|
994
|
+
}).onPrimary((_) => {
|
|
995
|
+
B.adjustments = _.map(
|
|
996
|
+
(A) => B.adjustments.find((H) => H.doc._id === A) ?? {
|
|
997
997
|
id: `sku_${(/* @__PURE__ */ new Date()).toISOString()}_${Math.random().toString(16).slice(2, 8)}`,
|
|
998
998
|
type: te.enum.PURCHASE,
|
|
999
|
-
doc: S.skus.find((H) => H._id ===
|
|
999
|
+
doc: S.skus.find((H) => H._id === A),
|
|
1000
1000
|
measurement: null,
|
|
1001
1001
|
remark: "",
|
|
1002
1002
|
amount: _e(1)
|
|
@@ -1008,10 +1008,10 @@ const Oe = {
|
|
|
1008
1008
|
B.adjustments.splice(l, 1);
|
|
1009
1009
|
}
|
|
1010
1010
|
return (l, x) => {
|
|
1011
|
-
const
|
|
1012
|
-
return
|
|
1013
|
-
modelValue: s(
|
|
1014
|
-
"onUpdate:modelValue": x[2] || (x[2] = (K) => je(
|
|
1011
|
+
const _ = U("FmTextarea"), A = U("FmButton"), H = U("FmForm"), N = U("FmSideSheet");
|
|
1012
|
+
return V(), z(N, {
|
|
1013
|
+
modelValue: s(C),
|
|
1014
|
+
"onUpdate:modelValue": x[2] || (x[2] = (K) => je(C) ? C.value = K : null),
|
|
1015
1015
|
"dismiss-away": "",
|
|
1016
1016
|
"max-width": 500
|
|
1017
1017
|
}, {
|
|
@@ -1024,25 +1024,25 @@ const Oe = {
|
|
|
1024
1024
|
y(H, {
|
|
1025
1025
|
class: "w-full flex flex-col gap-12",
|
|
1026
1026
|
ref_key: "formRef",
|
|
1027
|
-
ref:
|
|
1027
|
+
ref: b,
|
|
1028
1028
|
onValidationSuccess: u
|
|
1029
1029
|
}, {
|
|
1030
1030
|
default: T(() => [
|
|
1031
|
-
y(
|
|
1031
|
+
y(_, {
|
|
1032
1032
|
label: s(F)("inventory.stock.adjust.remark"),
|
|
1033
1033
|
modelValue: B.remark,
|
|
1034
1034
|
"onUpdate:modelValue": x[0] || (x[0] = (K) => B.remark = K)
|
|
1035
1035
|
}, null, 8, ["label", "modelValue"]),
|
|
1036
1036
|
e("div", An, [
|
|
1037
1037
|
e("div", Vn, v(s(F)("inventory.stock.adjust.adjustedItems")), 1),
|
|
1038
|
-
y(
|
|
1038
|
+
y(A, {
|
|
1039
1039
|
"prepend-icon": "add",
|
|
1040
1040
|
variant: "tertiary",
|
|
1041
1041
|
size: "md",
|
|
1042
1042
|
onClick: a
|
|
1043
1043
|
})
|
|
1044
1044
|
]),
|
|
1045
|
-
(
|
|
1045
|
+
(V(!0), Y(ne, null, ie(B.adjustments, (K, R) => (V(), z(mt, {
|
|
1046
1046
|
key: K.id,
|
|
1047
1047
|
modelValue: B.adjustments[R],
|
|
1048
1048
|
"onUpdate:modelValue": (X) => B.adjustments[R] = X,
|
|
@@ -1054,12 +1054,12 @@ const Oe = {
|
|
|
1054
1054
|
]),
|
|
1055
1055
|
"side-sheet-footer": T(() => [
|
|
1056
1056
|
e("div", Cn, [
|
|
1057
|
-
y(
|
|
1057
|
+
y(A, {
|
|
1058
1058
|
label: s(F)("inventory.stock.adjust.adjustButton"),
|
|
1059
1059
|
loading: j.value,
|
|
1060
1060
|
onClick: x[1] || (x[1] = (K) => {
|
|
1061
1061
|
var R, X;
|
|
1062
|
-
return (X = (R =
|
|
1062
|
+
return (X = (R = b.value) == null ? void 0 : R.validateInputs) == null ? void 0 : X.call(R);
|
|
1063
1063
|
})
|
|
1064
1064
|
}, null, 8, ["label", "loading"])
|
|
1065
1065
|
])
|
|
@@ -1074,42 +1074,45 @@ const Oe = {
|
|
|
1074
1074
|
show: { type: Boolean }
|
|
1075
1075
|
},
|
|
1076
1076
|
emits: ["update:show", "submitted"],
|
|
1077
|
-
setup(
|
|
1078
|
-
const d =
|
|
1077
|
+
setup(k, { emit: g }) {
|
|
1078
|
+
const d = k, o = g, { t: $ } = ce(), S = Be(), m = ge(), i = Ie(), w = be(), j = Ue(d, "show"), F = O(!1), u = nt({
|
|
1079
1079
|
remark: "",
|
|
1080
1080
|
effectiveAt: /* @__PURE__ */ new Date(),
|
|
1081
1081
|
adjustments: []
|
|
1082
|
-
}),
|
|
1083
|
-
xe([
|
|
1084
|
-
if (
|
|
1085
|
-
const
|
|
1086
|
-
|
|
1082
|
+
}), b = O(pe().format("YYYY-MM-DD")), C = O(pe().format("HH:mm"));
|
|
1083
|
+
xe([b, C], () => {
|
|
1084
|
+
if (b.value && C.value) {
|
|
1085
|
+
const _ = pe(`${b.value} ${C.value}`, "YYYY-MM-DD HH:mm");
|
|
1086
|
+
if (_.isValid()) {
|
|
1087
|
+
const A = pe();
|
|
1088
|
+
_.isAfter(A) ? u.effectiveAt = A.toDate() : u.effectiveAt = _.toDate();
|
|
1089
|
+
}
|
|
1087
1090
|
}
|
|
1088
1091
|
});
|
|
1089
1092
|
function B() {
|
|
1090
|
-
u.remark = "", u.effectiveAt = /* @__PURE__ */ new Date(), u.adjustments = [],
|
|
1093
|
+
u.remark = "", u.effectiveAt = /* @__PURE__ */ new Date(), u.adjustments = [], b.value = pe(u.effectiveAt).format("YYYY-MM-DD"), C.value = pe(u.effectiveAt).format("HH:mm");
|
|
1091
1094
|
}
|
|
1092
1095
|
function D() {
|
|
1093
1096
|
B();
|
|
1094
1097
|
}
|
|
1095
1098
|
const a = P(() => {
|
|
1096
|
-
const
|
|
1097
|
-
return S.skus.forEach((
|
|
1098
|
-
|
|
1099
|
-
}),
|
|
1099
|
+
const _ = {};
|
|
1100
|
+
return S.skus.forEach((A) => {
|
|
1101
|
+
_[A._id] = A;
|
|
1102
|
+
}), _;
|
|
1100
1103
|
});
|
|
1101
1104
|
function t() {
|
|
1102
|
-
const
|
|
1105
|
+
const _ = S.skus.map((H) => ({
|
|
1103
1106
|
label: H.name,
|
|
1104
1107
|
sublabel: H.code,
|
|
1105
1108
|
value: H._id
|
|
1106
|
-
})),
|
|
1109
|
+
})), A = u.adjustments.map((H) => H.doc._id);
|
|
1107
1110
|
i.open({
|
|
1108
1111
|
title: $("inventory.stock.adjust.selectIngredients"),
|
|
1109
1112
|
contentComponent: at,
|
|
1110
1113
|
contentComponentProps: {
|
|
1111
|
-
items:
|
|
1112
|
-
modelValue:
|
|
1114
|
+
items: _,
|
|
1115
|
+
modelValue: A,
|
|
1113
1116
|
virtualScroll: !0
|
|
1114
1117
|
},
|
|
1115
1118
|
overlay: !0,
|
|
@@ -1137,8 +1140,8 @@ const Oe = {
|
|
|
1137
1140
|
);
|
|
1138
1141
|
});
|
|
1139
1142
|
}
|
|
1140
|
-
function l(
|
|
1141
|
-
u.adjustments.splice(
|
|
1143
|
+
function l(_) {
|
|
1144
|
+
u.adjustments.splice(_, 1);
|
|
1142
1145
|
}
|
|
1143
1146
|
async function x() {
|
|
1144
1147
|
if (u.adjustments.length === 0) {
|
|
@@ -1151,35 +1154,36 @@ const Oe = {
|
|
|
1151
1154
|
}
|
|
1152
1155
|
F.value = !0;
|
|
1153
1156
|
try {
|
|
1154
|
-
const
|
|
1155
|
-
({ doc:
|
|
1156
|
-
id:
|
|
1157
|
-
amount:
|
|
1158
|
-
measurement:
|
|
1159
|
-
remark:
|
|
1160
|
-
doc:
|
|
1161
|
-
type:
|
|
1157
|
+
const _ = u.adjustments.map(
|
|
1158
|
+
({ doc: H, remark: N, type: K, amount: R, measurement: X }) => ({
|
|
1159
|
+
id: H._id,
|
|
1160
|
+
amount: R,
|
|
1161
|
+
measurement: X,
|
|
1162
|
+
remark: N,
|
|
1163
|
+
doc: H,
|
|
1164
|
+
type: K
|
|
1162
1165
|
})
|
|
1163
|
-
),
|
|
1166
|
+
), A = {
|
|
1164
1167
|
remark: u.remark,
|
|
1165
|
-
adjustments:
|
|
1168
|
+
adjustments: _,
|
|
1169
|
+
effectiveAt: u.effectiveAt.toISOString()
|
|
1166
1170
|
};
|
|
1167
|
-
|
|
1168
|
-
} catch (
|
|
1171
|
+
await m.adjustSku(De(A)), o("submitted"), o("update:show", !1);
|
|
1172
|
+
} catch (_) {
|
|
1169
1173
|
w.open({
|
|
1170
1174
|
title: $("inventory.stock.adjust.error.title"),
|
|
1171
1175
|
message: $("inventory.stock.adjust.error.message"),
|
|
1172
1176
|
type: "error"
|
|
1173
|
-
}), console.error("error on stock adjustment",
|
|
1177
|
+
}), console.error("error on stock adjustment", _);
|
|
1174
1178
|
} finally {
|
|
1175
1179
|
F.value = !1;
|
|
1176
1180
|
}
|
|
1177
1181
|
}
|
|
1178
|
-
return (
|
|
1182
|
+
return (_, A) => {
|
|
1179
1183
|
const H = U("FmTextarea"), N = U("FmDatePicker"), K = U("FmTimePicker"), R = U("FmButton"), X = U("FmSideSheet");
|
|
1180
|
-
return
|
|
1184
|
+
return V(), z(X, {
|
|
1181
1185
|
modelValue: s(j),
|
|
1182
|
-
"onUpdate:modelValue":
|
|
1186
|
+
"onUpdate:modelValue": A[4] || (A[4] = (L) => je(j) ? j.value = L : null),
|
|
1183
1187
|
"dismiss-away": "",
|
|
1184
1188
|
"max-width": 560,
|
|
1185
1189
|
onAfterEnter: D
|
|
@@ -1194,7 +1198,7 @@ const Oe = {
|
|
|
1194
1198
|
y(H, {
|
|
1195
1199
|
label: s($)("inventory.stock.adjust.remark"),
|
|
1196
1200
|
modelValue: u.remark,
|
|
1197
|
-
"onUpdate:modelValue":
|
|
1201
|
+
"onUpdate:modelValue": A[0] || (A[0] = (L) => u.remark = L),
|
|
1198
1202
|
"label-mark": "optional"
|
|
1199
1203
|
}, null, 8, ["label", "modelValue"]),
|
|
1200
1204
|
e("div", In, [
|
|
@@ -1203,17 +1207,17 @@ const Oe = {
|
|
|
1203
1207
|
e("div", Hn, [
|
|
1204
1208
|
y(N, {
|
|
1205
1209
|
class: "w-full",
|
|
1206
|
-
modelValue:
|
|
1207
|
-
"onUpdate:modelValue":
|
|
1210
|
+
modelValue: b.value,
|
|
1211
|
+
"onUpdate:modelValue": A[1] || (A[1] = (L) => b.value = L),
|
|
1208
1212
|
clearable: !1,
|
|
1209
|
-
max: s(
|
|
1213
|
+
max: s(pe)().format("YYYY-MM-DD")
|
|
1210
1214
|
}, null, 8, ["modelValue", "max"])
|
|
1211
1215
|
]),
|
|
1212
1216
|
e("div", En, [
|
|
1213
1217
|
y(K, {
|
|
1214
1218
|
class: "w-full",
|
|
1215
|
-
modelValue:
|
|
1216
|
-
"onUpdate:modelValue":
|
|
1219
|
+
modelValue: C.value,
|
|
1220
|
+
"onUpdate:modelValue": A[2] || (A[2] = (L) => C.value = L),
|
|
1217
1221
|
format: "HH:mm"
|
|
1218
1222
|
}, null, 8, ["modelValue"])
|
|
1219
1223
|
])
|
|
@@ -1229,11 +1233,11 @@ const Oe = {
|
|
|
1229
1233
|
onClick: t
|
|
1230
1234
|
})
|
|
1231
1235
|
]),
|
|
1232
|
-
(
|
|
1233
|
-
key:
|
|
1234
|
-
modelValue: u.adjustments[
|
|
1235
|
-
"onUpdate:modelValue": (
|
|
1236
|
-
"onClick:delete": (
|
|
1236
|
+
(V(!0), Y(ne, null, ie(u.adjustments, (L, ee) => (V(), z(mt, {
|
|
1237
|
+
key: L.id,
|
|
1238
|
+
modelValue: u.adjustments[ee],
|
|
1239
|
+
"onUpdate:modelValue": (J) => u.adjustments[ee] = J,
|
|
1240
|
+
"onClick:delete": (J) => l(ee)
|
|
1237
1241
|
}, null, 8, ["modelValue", "onUpdate:modelValue", "onClick:delete"]))), 128))
|
|
1238
1242
|
])
|
|
1239
1243
|
]),
|
|
@@ -1247,7 +1251,7 @@ const Oe = {
|
|
|
1247
1251
|
y(R, {
|
|
1248
1252
|
label: s($)("common.close"),
|
|
1249
1253
|
variant: "tertiary",
|
|
1250
|
-
onClick:
|
|
1254
|
+
onClick: A[3] || (A[3] = (L) => o("update:show", !1))
|
|
1251
1255
|
}, null, 8, ["label"])
|
|
1252
1256
|
])
|
|
1253
1257
|
]),
|
|
@@ -1255,10 +1259,10 @@ const Oe = {
|
|
|
1255
1259
|
}, 8, ["modelValue"]);
|
|
1256
1260
|
};
|
|
1257
1261
|
}
|
|
1258
|
-
}), Ln = St((
|
|
1262
|
+
}), Ln = St((k, g) => ({
|
|
1259
1263
|
// TODO: remove once latest inventory backend has been push
|
|
1260
1264
|
async findBillsByBusinessId(d, o, $) {
|
|
1261
|
-
const S = `${
|
|
1265
|
+
const S = `${k.businessesBackendUrl}/${d}/reports/find-many`, m = {
|
|
1262
1266
|
// type: TYPE.bill,
|
|
1263
1267
|
type: "bill",
|
|
1264
1268
|
restaurantIds: o,
|
|
@@ -1267,7 +1271,7 @@ const Oe = {
|
|
|
1267
1271
|
return await g.post(S, m);
|
|
1268
1272
|
},
|
|
1269
1273
|
async findBillsById(d) {
|
|
1270
|
-
const $ = ke().currentLocationDBName, S = `${
|
|
1274
|
+
const $ = ke().currentLocationDBName, S = `${k.inventoryBackendUrl}/${$}/bill/search`, m = {
|
|
1271
1275
|
ids: d
|
|
1272
1276
|
};
|
|
1273
1277
|
return await g.post(S, m);
|
|
@@ -1284,8 +1288,8 @@ const Oe = {
|
|
|
1284
1288
|
modelModifiers: {}
|
|
1285
1289
|
}),
|
|
1286
1290
|
emits: /* @__PURE__ */ qe(["refreshHistory"], ["update:modelValue"]),
|
|
1287
|
-
setup(
|
|
1288
|
-
const d =
|
|
1291
|
+
setup(k, { emit: g }) {
|
|
1292
|
+
const d = k, o = g, $ = ge(), S = pt(k, "modelValue"), m = O(!1), i = O(!1), w = O(!1), j = O({
|
|
1289
1293
|
_id: `inventoryAdjustment_${(/* @__PURE__ */ new Date()).toISOString()}_XXXXX`,
|
|
1290
1294
|
skus: []
|
|
1291
1295
|
}), F = O();
|
|
@@ -1300,36 +1304,36 @@ const Oe = {
|
|
|
1300
1304
|
if ((l = (t = F == null ? void 0 : F.value) == null ? void 0 : t.validateInputs) == null || l.call(t), !i.value) return;
|
|
1301
1305
|
const a = {};
|
|
1302
1306
|
Object.keys(S.value || {}).forEach((x) => {
|
|
1303
|
-
var
|
|
1304
|
-
Object.keys(((
|
|
1307
|
+
var _;
|
|
1308
|
+
Object.keys(((_ = S.value) == null ? void 0 : _[x]) || {}).forEach((A) => {
|
|
1305
1309
|
var N, K;
|
|
1306
|
-
const H = (K = (N = S.value) == null ? void 0 : N[x]) == null ? void 0 : K[Number(
|
|
1307
|
-
H &&
|
|
1310
|
+
const H = (K = (N = S.value) == null ? void 0 : N[x]) == null ? void 0 : K[Number(A)];
|
|
1311
|
+
H && C(H.amount) > 0 && (a[x] || (a[x] = []), a[x].push(H));
|
|
1308
1312
|
});
|
|
1309
1313
|
}), await $.revertWastageAdjustment({
|
|
1310
1314
|
targetWastageAdjustmentId: d.adjustmentId,
|
|
1311
1315
|
amountsGoingToAdjust: a
|
|
1312
1316
|
}), o("refreshHistory"), w.value = !1, S.value = {};
|
|
1313
1317
|
}
|
|
1314
|
-
function
|
|
1318
|
+
function b(a, t, l) {
|
|
1315
1319
|
return P({
|
|
1316
1320
|
get: () => {
|
|
1317
|
-
var
|
|
1318
|
-
const x = (H = (
|
|
1319
|
-
return x ?
|
|
1321
|
+
var _, A, H;
|
|
1322
|
+
const x = (H = (A = (_ = S.value) == null ? void 0 : _[a]) == null ? void 0 : A[t]) == null ? void 0 : H.amount;
|
|
1323
|
+
return x ? C(x, !0) : 0;
|
|
1320
1324
|
},
|
|
1321
1325
|
set: (x) => {
|
|
1322
1326
|
S.value || (S.value = {});
|
|
1323
|
-
const
|
|
1324
|
-
|
|
1327
|
+
const _ = { ...S.value };
|
|
1328
|
+
_[a] || (_[a] = {}), _[a][t] = {
|
|
1325
1329
|
amount: Ee.fromNumber(x),
|
|
1326
1330
|
type: te.Enum.WASTAGE,
|
|
1327
1331
|
measurement: l
|
|
1328
|
-
}, S.value =
|
|
1332
|
+
}, S.value = _;
|
|
1329
1333
|
}
|
|
1330
1334
|
});
|
|
1331
1335
|
}
|
|
1332
|
-
function
|
|
1336
|
+
function C(a, t = !0) {
|
|
1333
1337
|
const l = Number(Ee.toFormatString({ value: a }));
|
|
1334
1338
|
return t ? Math.abs(l) : l;
|
|
1335
1339
|
}
|
|
@@ -1340,8 +1344,8 @@ const Oe = {
|
|
|
1340
1344
|
return t === 0 ? "N/A" : (a + t).toString();
|
|
1341
1345
|
}
|
|
1342
1346
|
return (a, t) => {
|
|
1343
|
-
const l = U("FmIcon"), x = U("FmStepperField"),
|
|
1344
|
-
return
|
|
1347
|
+
const l = U("FmIcon"), x = U("FmStepperField"), _ = U("FmCard"), A = U("FmForm"), H = U("FmSpacer"), N = U("FmButton"), K = U("FmDialog");
|
|
1348
|
+
return V(), z(K, {
|
|
1345
1349
|
modelValue: w.value,
|
|
1346
1350
|
"onUpdate:modelValue": t[4] || (t[4] = (R) => w.value = R),
|
|
1347
1351
|
overlay: !0
|
|
@@ -1388,7 +1392,7 @@ const Oe = {
|
|
|
1388
1392
|
])
|
|
1389
1393
|
]),
|
|
1390
1394
|
default: T(() => [
|
|
1391
|
-
m.value ? (
|
|
1395
|
+
m.value ? (V(), Y("div", zn)) : (V(), z(A, {
|
|
1392
1396
|
key: 1,
|
|
1393
1397
|
ref_key: "formRef",
|
|
1394
1398
|
ref: F,
|
|
@@ -1407,9 +1411,9 @@ const Oe = {
|
|
|
1407
1411
|
de(" " + v(s(wt)(s(Ft)(j.value._id))), 1)
|
|
1408
1412
|
]),
|
|
1409
1413
|
e("div", Kn, [
|
|
1410
|
-
(
|
|
1411
|
-
(
|
|
1412
|
-
key:
|
|
1414
|
+
(V(!0), Y(ne, null, ie(j.value.skus, (R, X) => (V(), Y(ne, { key: X }, [
|
|
1415
|
+
(V(!0), Y(ne, null, ie(R.amounts, (L, ee) => (V(), z(_, {
|
|
1416
|
+
key: ee,
|
|
1413
1417
|
variant: "outlined",
|
|
1414
1418
|
class: "p-2"
|
|
1415
1419
|
}, {
|
|
@@ -1421,21 +1425,21 @@ const Oe = {
|
|
|
1421
1425
|
t[12] || (t[12] = e("hr", { class: "m-2" }, null, -1)),
|
|
1422
1426
|
e("div", Xn, [
|
|
1423
1427
|
t[8] || (t[8] = e("span", { class: "fm-typo-en-body-lg-600" }, "Adjustment type:", -1)),
|
|
1424
|
-
e("span", null, v(
|
|
1428
|
+
e("span", null, v(L.type), 1)
|
|
1425
1429
|
]),
|
|
1426
1430
|
e("div", Jn, [
|
|
1427
1431
|
t[9] || (t[9] = e("span", { class: "fm-typo-en-body-lg-600" }, "Current amount:", -1)),
|
|
1428
|
-
e("span", null, v(s(Ee).toFormatString({ value:
|
|
1432
|
+
e("span", null, v(s(Ee).toFormatString({ value: L.amount })) + " " + v(B(R, L)), 1)
|
|
1429
1433
|
]),
|
|
1430
1434
|
y(x, {
|
|
1431
|
-
"model-value":
|
|
1432
|
-
"onUpdate:modelValue": (
|
|
1435
|
+
"model-value": b(R.sku._id, ee).value,
|
|
1436
|
+
"onUpdate:modelValue": (J) => b(R.sku._id, ee).value = J,
|
|
1433
1437
|
class: "mb-3",
|
|
1434
1438
|
label: "Adjust Amount (Leave 0 to skip)",
|
|
1435
|
-
"helper-text": `Max: ${
|
|
1436
|
-
"append-text": B(R,
|
|
1439
|
+
"helper-text": `Max: ${C(L.amount)}`,
|
|
1440
|
+
"append-text": B(R, L),
|
|
1437
1441
|
rules: [
|
|
1438
|
-
(
|
|
1442
|
+
(J) => J <= C(L.amount) || `Cannot be more than ${C(L.amount)}`,
|
|
1439
1443
|
s(Ve)(-1)
|
|
1440
1444
|
]
|
|
1441
1445
|
}, null, 8, ["model-value", "onUpdate:modelValue", "helper-text", "append-text", "rules"]),
|
|
@@ -1443,9 +1447,9 @@ const Oe = {
|
|
|
1443
1447
|
t[10] || (t[10] = e("span", { class: "fm-typo-en-body-lg-600" }, "Amount after amend:", -1)),
|
|
1444
1448
|
t[11] || (t[11] = e("span", { class: "text-fm-color-system-warning-400 fm-typo-en-body-sm-400" }, "* It's an estimate for your reference, as it didn't include all the reversals related to this adjustment", -1)),
|
|
1445
1449
|
de(" " + v(D(
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
)) + " " + v(B(R,
|
|
1450
|
+
C(L.amount, !1),
|
|
1451
|
+
b(R.sku._id, ee).value
|
|
1452
|
+
)) + " " + v(B(R, L)), 1)
|
|
1449
1453
|
])
|
|
1450
1454
|
]),
|
|
1451
1455
|
_: 2
|
|
@@ -1480,8 +1484,8 @@ const Oe = {
|
|
|
1480
1484
|
bills: { default: () => [] }
|
|
1481
1485
|
},
|
|
1482
1486
|
emits: ["refreshHistory"],
|
|
1483
|
-
setup(
|
|
1484
|
-
const d =
|
|
1487
|
+
setup(k, { emit: g }) {
|
|
1488
|
+
const d = k, o = O(!1);
|
|
1485
1489
|
Ke();
|
|
1486
1490
|
const $ = O(), S = O(null), m = P(() => S.value === null ? "unset" : o.value ? `${S.value}px` : "0px");
|
|
1487
1491
|
Le(() => {
|
|
@@ -1490,17 +1494,17 @@ const Oe = {
|
|
|
1490
1494
|
});
|
|
1491
1495
|
const i = P(() => {
|
|
1492
1496
|
var D;
|
|
1493
|
-
const F = d.record.adjustments, u = d.sku,
|
|
1497
|
+
const F = d.record.adjustments, u = d.sku, b = {}, B = F.flatMap((a) => {
|
|
1494
1498
|
var t;
|
|
1495
1499
|
return ((t = a.skus) == null ? void 0 : t.filter((l) => l.sku._id === u._id)) ?? [];
|
|
1496
1500
|
}).flatMap((a) => a.amounts);
|
|
1497
1501
|
for (const a of B) {
|
|
1498
1502
|
const t = a.measurement ? st(a.measurement.conversion, a.amount) : a.amount;
|
|
1499
|
-
|
|
1503
|
+
b[D = a.type] ?? (b[D] = { amount: 0, precision: 0 }), b[a.type] = Ge(t, b[a.type]);
|
|
1500
1504
|
}
|
|
1501
|
-
return Object.entries(
|
|
1505
|
+
return Object.entries(b).reduce(
|
|
1502
1506
|
(a, [t, l]) => (a[t] = /// comment, because without it formatter makes code uglier
|
|
1503
|
-
`${
|
|
1507
|
+
`${Q.toFormatString({
|
|
1504
1508
|
value: l,
|
|
1505
1509
|
precision: 4
|
|
1506
1510
|
})} ${u.unit.abbrev}`, a),
|
|
@@ -1509,43 +1513,43 @@ const Oe = {
|
|
|
1509
1513
|
}), { t: w } = ce(), j = P(() => d.record.adjustmentsByTime.map(({ date: F, adjustments: u }) => ({
|
|
1510
1514
|
time: $t(new Date(F)),
|
|
1511
1515
|
adjustments: u.flatMap(
|
|
1512
|
-
(
|
|
1513
|
-
var
|
|
1514
|
-
return ((B = (
|
|
1516
|
+
(b) => {
|
|
1517
|
+
var C, B;
|
|
1518
|
+
return ((B = (C = b.skus) == null ? void 0 : C.map) == null ? void 0 : B.call(C, (D) => {
|
|
1515
1519
|
var a, t;
|
|
1516
1520
|
return {
|
|
1517
1521
|
...D,
|
|
1518
|
-
ref:
|
|
1519
|
-
backdateFrom:
|
|
1520
|
-
toBalance: (t = (a =
|
|
1521
|
-
adjustmentId:
|
|
1522
|
+
ref: b.ref,
|
|
1523
|
+
backdateFrom: b.effectiveAt != null ? it(b._id) : null,
|
|
1524
|
+
toBalance: (t = (a = b.skus) == null ? void 0 : a[0]) == null ? void 0 : t.toBalance,
|
|
1525
|
+
adjustmentId: b._id
|
|
1522
1526
|
};
|
|
1523
1527
|
})) ?? [];
|
|
1524
1528
|
}
|
|
1525
|
-
).flatMap((
|
|
1529
|
+
).flatMap((b) => {
|
|
1526
1530
|
var D;
|
|
1527
|
-
const
|
|
1528
|
-
return
|
|
1531
|
+
const C = (D = d.bills.find((a) => a._id === b.ref)) == null ? void 0 : D.seqNumber, B = C ? w("inventory.stock.record.bill", [C]) : "";
|
|
1532
|
+
return b.amounts.map((a) => {
|
|
1529
1533
|
var t;
|
|
1530
1534
|
return {
|
|
1531
|
-
amount: `${
|
|
1532
|
-
backdateFrom:
|
|
1535
|
+
amount: `${Q.toFormatString({ value: a.amount, precision: 4 })} ${((t = a.measurement) == null ? void 0 : t.abbrev) ?? b.sku.unit.abbrev}`,
|
|
1536
|
+
backdateFrom: b.backdateFrom,
|
|
1533
1537
|
name: a.type,
|
|
1534
1538
|
remark: a.remark || B || "",
|
|
1535
1539
|
cost: a.cost,
|
|
1536
|
-
toBalance:
|
|
1537
|
-
value:
|
|
1540
|
+
toBalance: Q.toFormatString({
|
|
1541
|
+
value: b.toBalance ?? Q.fromNumber(0),
|
|
1538
1542
|
precision: 4
|
|
1539
1543
|
}),
|
|
1540
|
-
baseUnit:
|
|
1541
|
-
adjustmentId:
|
|
1544
|
+
baseUnit: b.sku.unit.abbrev,
|
|
1545
|
+
adjustmentId: b.adjustmentId
|
|
1542
1546
|
};
|
|
1543
1547
|
});
|
|
1544
1548
|
})
|
|
1545
1549
|
})));
|
|
1546
1550
|
return (F, u) => {
|
|
1547
|
-
const
|
|
1548
|
-
return
|
|
1551
|
+
const b = U("FmIcon"), C = U("FmTooltip"), B = U("FmCard");
|
|
1552
|
+
return V(), z(B, { variant: "outlined" }, {
|
|
1549
1553
|
default: T(() => [
|
|
1550
1554
|
e("div", no, [
|
|
1551
1555
|
e("div", {
|
|
@@ -1553,13 +1557,13 @@ const Oe = {
|
|
|
1553
1557
|
onClick: u[0] || (u[0] = (D) => o.value = !o.value)
|
|
1554
1558
|
}, [
|
|
1555
1559
|
e("div", oo, v(F.record.date), 1),
|
|
1556
|
-
y(
|
|
1560
|
+
y(b, {
|
|
1557
1561
|
name: o.value ? "expand_more" : "expand_less",
|
|
1558
1562
|
color: "#777777",
|
|
1559
1563
|
size: "md"
|
|
1560
1564
|
}, null, 8, ["name"])
|
|
1561
1565
|
]),
|
|
1562
|
-
(
|
|
1566
|
+
(V(!0), Y(ne, null, ie(i.value, (D, a) => (V(), Y("div", {
|
|
1563
1567
|
key: a,
|
|
1564
1568
|
class: "flex flex-row py-1",
|
|
1565
1569
|
style: { "font-size": "0.8rem" }
|
|
@@ -1583,20 +1587,20 @@ const Oe = {
|
|
|
1583
1587
|
transition: "max-height 0.2s ease-out"
|
|
1584
1588
|
})
|
|
1585
1589
|
}, [
|
|
1586
|
-
j.value.length ? (
|
|
1587
|
-
(
|
|
1590
|
+
j.value.length ? (V(), Y("hr", ao)) : se("", !0),
|
|
1591
|
+
(V(!0), Y(ne, null, ie(j.value, (D) => (V(), Y("div", {
|
|
1588
1592
|
key: D.time,
|
|
1589
1593
|
class: "flex gap-1 w-full"
|
|
1590
1594
|
}, [
|
|
1591
1595
|
e("div", lo, v(D.time), 1),
|
|
1592
1596
|
e("div", ro, [
|
|
1593
|
-
(
|
|
1597
|
+
(V(!0), Y(ne, null, ie(D.adjustments, (a) => (V(), Y("div", {
|
|
1594
1598
|
key: a.name,
|
|
1595
1599
|
class: "flex gap-1"
|
|
1596
1600
|
}, [
|
|
1597
1601
|
e("div", io, [
|
|
1598
1602
|
de(v(s(w)(`inventory.inventoryAdjustment.type.${a.name}`)) + " ", 1),
|
|
1599
|
-
a.backdateFrom ? (
|
|
1603
|
+
a.backdateFrom ? (V(), z(C, {
|
|
1600
1604
|
key: 0,
|
|
1601
1605
|
variant: "plain",
|
|
1602
1606
|
placement: "top",
|
|
@@ -1608,7 +1612,7 @@ const Oe = {
|
|
|
1608
1612
|
])), 1)
|
|
1609
1613
|
]),
|
|
1610
1614
|
default: T(() => [
|
|
1611
|
-
y(
|
|
1615
|
+
y(b, {
|
|
1612
1616
|
name: "info",
|
|
1613
1617
|
size: "sm",
|
|
1614
1618
|
color: "primary"
|
|
@@ -1616,8 +1620,8 @@ const Oe = {
|
|
|
1616
1620
|
]),
|
|
1617
1621
|
_: 2
|
|
1618
1622
|
}, 1024)) : se("", !0),
|
|
1619
|
-
a.remark ? (
|
|
1620
|
-
a.name === s(te).Enum.CLOSING ? (
|
|
1623
|
+
a.remark ? (V(), Y("span", co, " # " + v(a.remark), 1)) : se("", !0),
|
|
1624
|
+
a.name === s(te).Enum.CLOSING ? (V(), Y("span", mo, " Actual Balance: " + v(a.toBalance) + " " + v(a.baseUnit), 1)) : se("", !0)
|
|
1621
1625
|
]),
|
|
1622
1626
|
e("div", {
|
|
1623
1627
|
class: he({
|
|
@@ -1626,12 +1630,12 @@ const Oe = {
|
|
|
1626
1630
|
"ml-auto": !0
|
|
1627
1631
|
})
|
|
1628
1632
|
}, v(a.amount), 3),
|
|
1629
|
-
a.name === s(te).Enum.WASTAGE ? (
|
|
1633
|
+
a.name === s(te).Enum.WASTAGE ? (V(), z(to, {
|
|
1630
1634
|
key: 0,
|
|
1631
1635
|
adjustmentId: a.adjustmentId,
|
|
1632
1636
|
onRefreshHistory: u[1] || (u[1] = (t) => F.$emit("refreshHistory"))
|
|
1633
1637
|
}, null, 8, ["adjustmentId"])) : se("", !0),
|
|
1634
|
-
a.cost ? (
|
|
1638
|
+
a.cost ? (V(), Y("div", po, " (" + v(s(Fe)(a.cost, !1, a.cost.precision)) + ") ", 1)) : se("", !0)
|
|
1635
1639
|
]))), 128))
|
|
1636
1640
|
])
|
|
1637
1641
|
]))), 128))
|
|
@@ -1643,7 +1647,7 @@ const Oe = {
|
|
|
1643
1647
|
};
|
|
1644
1648
|
}
|
|
1645
1649
|
});
|
|
1646
|
-
function vo(
|
|
1650
|
+
function vo(k, g) {
|
|
1647
1651
|
var S;
|
|
1648
1652
|
const d = Object.keys(te.enum).reduce(
|
|
1649
1653
|
(m, i) => (m[i] = { amount: 0, precision: 0 }, m),
|
|
@@ -1651,16 +1655,16 @@ function vo(_, g) {
|
|
|
1651
1655
|
);
|
|
1652
1656
|
if (!g)
|
|
1653
1657
|
return Object.entries(d).reduce(
|
|
1654
|
-
(m, [i]) => (m[i] =
|
|
1658
|
+
(m, [i]) => (m[i] = Q.fromNumber(0), m),
|
|
1655
1659
|
{}
|
|
1656
1660
|
);
|
|
1657
|
-
const $ =
|
|
1661
|
+
const $ = k.flatMap((m) => {
|
|
1658
1662
|
var i;
|
|
1659
1663
|
return ((i = m.skus) == null ? void 0 : i.filter((w) => w.sku._id === g._id)) ?? [];
|
|
1660
1664
|
}).flatMap((m) => m.amounts);
|
|
1661
1665
|
for (const m of $) {
|
|
1662
|
-
const i = m.measurement ?
|
|
1663
|
-
d[S = m.type] ?? (d[S] = { amount: 0, precision: 0 }), d[m.type] =
|
|
1666
|
+
const i = m.measurement ? Q.multiply([m.measurement.conversion, m.amount]) : m.amount;
|
|
1667
|
+
d[S = m.type] ?? (d[S] = { amount: 0, precision: 0 }), d[m.type] = Q.add([i, d[m.type]]);
|
|
1664
1668
|
}
|
|
1665
1669
|
return Object.entries(d).reduce(
|
|
1666
1670
|
(m, [i, w]) => {
|
|
@@ -1669,7 +1673,7 @@ function vo(_, g) {
|
|
|
1669
1673
|
amount: Math.abs(w.amount)
|
|
1670
1674
|
};
|
|
1671
1675
|
return m[i] = /// comment, because without it formatter makes code uglier
|
|
1672
|
-
`${
|
|
1676
|
+
`${Q.toFormatString({
|
|
1673
1677
|
value: j,
|
|
1674
1678
|
precision: 4
|
|
1675
1679
|
})} ${g.unit.abbrev}`, m;
|
|
@@ -1677,11 +1681,11 @@ function vo(_, g) {
|
|
|
1677
1681
|
{}
|
|
1678
1682
|
);
|
|
1679
1683
|
}
|
|
1680
|
-
function yo(
|
|
1684
|
+
function yo(k, g) {
|
|
1681
1685
|
if (!g)
|
|
1682
1686
|
return null;
|
|
1683
1687
|
let d = null;
|
|
1684
|
-
const $ =
|
|
1688
|
+
const $ = k.flatMap((S) => {
|
|
1685
1689
|
var m;
|
|
1686
1690
|
return ((m = S.skus) == null ? void 0 : m.filter((i) => i.sku._id === g._id)) ?? [];
|
|
1687
1691
|
}).flatMap((S) => {
|
|
@@ -1693,11 +1697,11 @@ function yo(_, g) {
|
|
|
1693
1697
|
for (const i of m) {
|
|
1694
1698
|
if (i.type !== te.Enum.SALES)
|
|
1695
1699
|
continue;
|
|
1696
|
-
const w = i.measurement ?
|
|
1697
|
-
d ?? (d =
|
|
1700
|
+
const w = i.measurement ? Q.multiply([i.measurement.conversion, i.amount]) : i.amount;
|
|
1701
|
+
d ?? (d = Q.fromNumber(0)), d = Q.add([d, w]);
|
|
1698
1702
|
}
|
|
1699
1703
|
}
|
|
1700
|
-
return d != null ? (d.amount = Math.abs(d.amount), `${
|
|
1704
|
+
return d != null ? (d.amount = Math.abs(d.amount), `${Q.toFormatString({
|
|
1701
1705
|
value: d,
|
|
1702
1706
|
precision: 4
|
|
1703
1707
|
})} ${g.unit.abbrev}`) : null;
|
|
@@ -1724,9 +1728,9 @@ const _o = { class: "flex items-center w-full fm-typo-en-title-md-800" }, ko = {
|
|
|
1724
1728
|
show: { type: Boolean }
|
|
1725
1729
|
},
|
|
1726
1730
|
emits: ["update:show"],
|
|
1727
|
-
setup(
|
|
1728
|
-
const g = Ke(), d = Me(), o = ge(), $ = Ln(), S = ke(), m = Dt(), { t: i } = ce(), w =
|
|
1729
|
-
async function
|
|
1731
|
+
setup(k) {
|
|
1732
|
+
const g = Ke(), d = Me(), o = ge(), $ = Ln(), S = ke(), m = Dt(), { t: i } = ce(), w = k, j = O(!1), F = be(), u = O(At(0));
|
|
1733
|
+
async function b() {
|
|
1730
1734
|
j.value = !0;
|
|
1731
1735
|
try {
|
|
1732
1736
|
await l(), await d.readStockBalance();
|
|
@@ -1741,11 +1745,11 @@ const _o = { class: "flex items-center w-full fm-typo-en-title-md-800" }, ko = {
|
|
|
1741
1745
|
}
|
|
1742
1746
|
}
|
|
1743
1747
|
Le(() => {
|
|
1744
|
-
|
|
1748
|
+
b();
|
|
1745
1749
|
}), xe([() => u.value, () => w.sku], () => {
|
|
1746
|
-
|
|
1750
|
+
b();
|
|
1747
1751
|
});
|
|
1748
|
-
const
|
|
1752
|
+
const C = O([]), B = O([]), D = O(new Array());
|
|
1749
1753
|
function a(n, r) {
|
|
1750
1754
|
return r === "day" ? Tt(n) : lt(n);
|
|
1751
1755
|
}
|
|
@@ -1771,7 +1775,7 @@ const _o = { class: "flex items-center w-full fm-typo-en-title-md-800" }, ko = {
|
|
|
1771
1775
|
Bt(new Date(u.value.startDate)).toISOString(),
|
|
1772
1776
|
Mt(new Date(u.value.endDate)).toISOString()
|
|
1773
1777
|
);
|
|
1774
|
-
|
|
1778
|
+
C.value = n;
|
|
1775
1779
|
const r = n.filter(({ ref: h }) => h == null ? void 0 : h.startsWith("bill_")).map(({ ref: h }) => h);
|
|
1776
1780
|
await x(r), B.value = t(n, "day").map(({ date: h, adjustments: c }) => ({
|
|
1777
1781
|
date: h,
|
|
@@ -1787,14 +1791,14 @@ const _o = { class: "flex items-center w-full fm-typo-en-title-md-800" }, ko = {
|
|
|
1787
1791
|
return $.findBillsByBusinessId(h, [c], n);
|
|
1788
1792
|
}));
|
|
1789
1793
|
}
|
|
1790
|
-
const
|
|
1791
|
-
const n =
|
|
1794
|
+
const _ = P(() => {
|
|
1795
|
+
const n = C.value, r = w.sku;
|
|
1792
1796
|
return vo(n, r);
|
|
1793
|
-
}),
|
|
1794
|
-
const n =
|
|
1797
|
+
}), A = P(() => {
|
|
1798
|
+
const n = C.value, r = w.sku;
|
|
1795
1799
|
return yo(n, r);
|
|
1796
1800
|
}), H = P(() => {
|
|
1797
|
-
const n = [...
|
|
1801
|
+
const n = [...C.value].computeFirst((h) => {
|
|
1798
1802
|
var f, M;
|
|
1799
1803
|
const c = (M = (f = h.skus) == null ? void 0 : f.find) == null ? void 0 : M.call(f, (I) => I.sku._id === w.sku._id);
|
|
1800
1804
|
return c == null ? void 0 : c.fromBalance;
|
|
@@ -1802,12 +1806,12 @@ const _o = { class: "flex items-center w-full fm-typo-en-title-md-800" }, ko = {
|
|
|
1802
1806
|
amount: 0,
|
|
1803
1807
|
precision: 0
|
|
1804
1808
|
}, r = w.sku;
|
|
1805
|
-
return r ? `${
|
|
1809
|
+
return r ? `${Q.toFormatString({
|
|
1806
1810
|
value: n,
|
|
1807
1811
|
precision: 4
|
|
1808
1812
|
})} ${r.unit.abbrev}` : "";
|
|
1809
1813
|
}), N = P(() => {
|
|
1810
|
-
const n = [...
|
|
1814
|
+
const n = [...C.value].reverse().computeFirst((h) => {
|
|
1811
1815
|
var f, M;
|
|
1812
1816
|
const c = (M = (f = h.skus) == null ? void 0 : f.find) == null ? void 0 : M.call(f, (I) => I.sku._id === w.sku._id);
|
|
1813
1817
|
return c == null ? void 0 : c.toBalance;
|
|
@@ -1815,10 +1819,10 @@ const _o = { class: "flex items-center w-full fm-typo-en-title-md-800" }, ko = {
|
|
|
1815
1819
|
amount: 0,
|
|
1816
1820
|
precision: 0
|
|
1817
1821
|
}, r = w.sku;
|
|
1818
|
-
return r ? `${
|
|
1822
|
+
return r ? `${Q.toFormatString({ value: n, precision: 4 })} ${r.unit.abbrev}` : "";
|
|
1819
1823
|
}), K = P(() => {
|
|
1820
1824
|
var h;
|
|
1821
|
-
const r =
|
|
1825
|
+
const r = C.value.flatMap((c) => {
|
|
1822
1826
|
var f;
|
|
1823
1827
|
return ((f = c.skus) == null ? void 0 : f.flatMap((M) => M.amounts)) ?? [];
|
|
1824
1828
|
}).filter((c) => c.amount.amount < 0).reduce(
|
|
@@ -1849,9 +1853,9 @@ const _o = { class: "flex items-center w-full fm-typo-en-title-md-800" }, ko = {
|
|
|
1849
1853
|
endDate: r
|
|
1850
1854
|
});
|
|
1851
1855
|
}
|
|
1852
|
-
const X = P(() => i("inventory.ingredient.valuationMethod.WAVG")),
|
|
1856
|
+
const X = P(() => i("inventory.ingredient.valuationMethod.WAVG")), L = P(() => {
|
|
1853
1857
|
var I, G, oe, E;
|
|
1854
|
-
const n = [...
|
|
1858
|
+
const n = [...C.value].reverse().computeFirst((W) => {
|
|
1855
1859
|
var q, le;
|
|
1856
1860
|
return (le = (q = W.skus) == null ? void 0 : q.find) == null ? void 0 : le.call(q, (re) => re.sku._id === w.sku._id);
|
|
1857
1861
|
});
|
|
@@ -1859,27 +1863,27 @@ const _o = { class: "flex items-center w-full fm-typo-en-title-md-800" }, ko = {
|
|
|
1859
1863
|
const r = [...n.amounts].reverse()[0], h = {
|
|
1860
1864
|
amount: ((I = r.cost) == null ? void 0 : I.amount) ?? 0,
|
|
1861
1865
|
precision: ((G = r.cost) == null ? void 0 : G.precision) ?? 0
|
|
1862
|
-
}, c = r.amount, f = c.amount == 0 ?
|
|
1866
|
+
}, c = r.amount, f = c.amount == 0 ? Q.fromNumber(0) : Q.divide([h, c]);
|
|
1863
1867
|
return {
|
|
1864
|
-
...
|
|
1868
|
+
...Q.multiply([f, c]),
|
|
1865
1869
|
currency: ((oe = r.cost) == null ? void 0 : oe.currency) || Pe(((E = g.currentCountry) == null ? void 0 : E.value) ?? Ct)
|
|
1866
1870
|
};
|
|
1867
|
-
}),
|
|
1871
|
+
}), ee = P(() => {
|
|
1868
1872
|
var h;
|
|
1869
|
-
const n = [...
|
|
1873
|
+
const n = [...C.value].reverse().computeFirst((c) => {
|
|
1870
1874
|
var M, I;
|
|
1871
1875
|
const f = (I = (M = c.skus) == null ? void 0 : M.find) == null ? void 0 : I.call(M, (G) => G.sku._id === w.sku._id);
|
|
1872
1876
|
return f == null ? void 0 : f.toCostBalances;
|
|
1873
1877
|
});
|
|
1874
1878
|
return n ? {
|
|
1875
|
-
...n.reduce((c, f) =>
|
|
1879
|
+
...n.reduce((c, f) => Q.add([c, Q.fromDinero(f.cost)]), {
|
|
1876
1880
|
amount: 0,
|
|
1877
1881
|
precision: 0
|
|
1878
1882
|
}),
|
|
1879
1883
|
currency: Pe((h = g.currentCountry) == null ? void 0 : h.value)
|
|
1880
1884
|
} : "No data";
|
|
1881
1885
|
});
|
|
1882
|
-
function
|
|
1886
|
+
function J() {
|
|
1883
1887
|
const { startDate: n, endDate: r } = Ut(u.value);
|
|
1884
1888
|
n !== null && r !== null && (u.value = {
|
|
1885
1889
|
startDate: n,
|
|
@@ -1889,10 +1893,10 @@ const _o = { class: "flex items-center w-full fm-typo-en-title-md-800" }, ko = {
|
|
|
1889
1893
|
const p = Ue(w, "show");
|
|
1890
1894
|
return (n, r) => {
|
|
1891
1895
|
const h = U("FmButton"), c = U("FmField"), f = U("FmDateRangePicker"), M = U("FmSpacer"), I = U("FmCircularProgress"), G = U("FmIcon"), oe = U("FmTooltip"), E = U("FmMenuDivider"), W = U("FmChip"), q = U("FmCardSection"), le = U("FmCard"), re = U("FmSideSheet");
|
|
1892
|
-
return
|
|
1896
|
+
return V(), z(re, {
|
|
1893
1897
|
"dismiss-away": "",
|
|
1894
1898
|
modelValue: s(p),
|
|
1895
|
-
"onUpdate:modelValue": r[4] || (r[4] = (
|
|
1899
|
+
"onUpdate:modelValue": r[4] || (r[4] = (Z) => je(p) ? p.value = Z : null),
|
|
1896
1900
|
"close-button": !1,
|
|
1897
1901
|
"max-width": 560
|
|
1898
1902
|
}, {
|
|
@@ -1902,12 +1906,12 @@ const _o = { class: "flex items-center w-full fm-typo-en-title-md-800" }, ko = {
|
|
|
1902
1906
|
y(h, {
|
|
1903
1907
|
variant: "tertiary",
|
|
1904
1908
|
"prepend-icon": "close",
|
|
1905
|
-
onClick: r[0] || (r[0] = (
|
|
1909
|
+
onClick: r[0] || (r[0] = (Z) => p.value = !1)
|
|
1906
1910
|
})
|
|
1907
1911
|
])
|
|
1908
1912
|
]),
|
|
1909
1913
|
default: T(() => {
|
|
1910
|
-
var
|
|
1914
|
+
var Z;
|
|
1911
1915
|
return [
|
|
1912
1916
|
e("div", bo, [
|
|
1913
1917
|
e("div", go, [
|
|
@@ -1941,17 +1945,17 @@ const _o = { class: "flex items-center w-full fm-typo-en-title-md-800" }, ko = {
|
|
|
1941
1945
|
}),
|
|
1942
1946
|
y(h, {
|
|
1943
1947
|
variant: "tertiary",
|
|
1944
|
-
onClick: r[3] || (r[3] = (ae) =>
|
|
1948
|
+
onClick: r[3] || (r[3] = (ae) => J()),
|
|
1945
1949
|
"prepend-icon": "navigate_next"
|
|
1946
1950
|
})
|
|
1947
1951
|
]),
|
|
1948
|
-
j.value ? (
|
|
1952
|
+
j.value ? (V(), Y("div", xo, [
|
|
1949
1953
|
y(M),
|
|
1950
1954
|
y(I, { size: "xl" }),
|
|
1951
1955
|
e("div", So, v(s(i)("inventory.stock.history.loading")), 1),
|
|
1952
1956
|
y(M),
|
|
1953
1957
|
y(M)
|
|
1954
|
-
])) : B.value && ((
|
|
1958
|
+
])) : B.value && ((Z = B.value) == null ? void 0 : Z.length) > 0 ? (V(), Y("div", wo, [
|
|
1955
1959
|
y(le, { variant: "outlined" }, {
|
|
1956
1960
|
default: T(() => [
|
|
1957
1961
|
y(q, { class: "flex flex-col gap-4" }, {
|
|
@@ -1962,16 +1966,16 @@ const _o = { class: "flex items-center w-full fm-typo-en-title-md-800" }, ko = {
|
|
|
1962
1966
|
e("div", Ao, [
|
|
1963
1967
|
e("div", Vo, [
|
|
1964
1968
|
e("div", Co, v(s(i)("inventory.stock.history.summary.totalPurchase")), 1),
|
|
1965
|
-
e("div", jo, v(
|
|
1969
|
+
e("div", jo, v(_.value.PURCHASE), 1)
|
|
1966
1970
|
]),
|
|
1967
1971
|
e("div", Do, [
|
|
1968
1972
|
e("div", Bo, [
|
|
1969
1973
|
de(v(s(i)("inventory.stock.history.summary.totalSales")) + " ", 1),
|
|
1970
|
-
|
|
1974
|
+
A.value != null ? (V(), z(oe, {
|
|
1971
1975
|
key: 0,
|
|
1972
1976
|
variant: "plain",
|
|
1973
1977
|
placement: "top",
|
|
1974
|
-
content: `Before: ${
|
|
1978
|
+
content: `Before: ${A.value}`,
|
|
1975
1979
|
"z-index": 50
|
|
1976
1980
|
}, {
|
|
1977
1981
|
default: T(() => [
|
|
@@ -1983,27 +1987,27 @@ const _o = { class: "flex items-center w-full fm-typo-en-title-md-800" }, ko = {
|
|
|
1983
1987
|
_: 1
|
|
1984
1988
|
}, 8, ["content"])) : se("", !0)
|
|
1985
1989
|
]),
|
|
1986
|
-
e("div", Mo, v(
|
|
1990
|
+
e("div", Mo, v(_.value.SALES), 1)
|
|
1987
1991
|
]),
|
|
1988
1992
|
e("div", Io, [
|
|
1989
1993
|
e("div", Uo, v(s(i)("inventory.stock.history.summary.totalLose")), 1),
|
|
1990
|
-
e("div", To, v(
|
|
1994
|
+
e("div", To, v(_.value.LOSE), 1)
|
|
1991
1995
|
]),
|
|
1992
1996
|
e("div", Ho, [
|
|
1993
1997
|
e("div", Eo, v(s(i)("inventory.stock.history.summary.totalRequest")), 1),
|
|
1994
|
-
e("div", Po, v(
|
|
1998
|
+
e("div", Po, v(_.value.REQUEST), 1)
|
|
1995
1999
|
]),
|
|
1996
2000
|
e("div", Ro, [
|
|
1997
2001
|
e("div", Oo, v(s(i)("inventory.stock.history.summary.totalReceive")), 1),
|
|
1998
|
-
e("div", No, v(
|
|
2002
|
+
e("div", No, v(_.value.RECEIVE), 1)
|
|
1999
2003
|
]),
|
|
2000
2004
|
e("div", Yo, [
|
|
2001
2005
|
e("div", Lo, v(s(i)("inventory.stock.history.summary.totalConvert")), 1),
|
|
2002
|
-
e("div", zo, v(
|
|
2006
|
+
e("div", zo, v(_.value.CONVERT), 1)
|
|
2003
2007
|
]),
|
|
2004
2008
|
e("div", Go, [
|
|
2005
2009
|
e("div", Ko, v(s(i)("inventory.stock.history.summary.totalDamage")), 1),
|
|
2006
|
-
e("div", Wo, v(
|
|
2010
|
+
e("div", Wo, v(_.value.DAMAGE), 1)
|
|
2007
2011
|
]),
|
|
2008
2012
|
e("div", qo, [
|
|
2009
2013
|
e("div", Xo, v(s(i)("inventory.stock.history.summary.openingBalance")), 1),
|
|
@@ -2014,7 +2018,7 @@ const _o = { class: "flex items-center w-full fm-typo-en-title-md-800" }, ko = {
|
|
|
2014
2018
|
e("div", es, v(N.value), 1)
|
|
2015
2019
|
])
|
|
2016
2020
|
]),
|
|
2017
|
-
s(m).enableTotalCost ? (
|
|
2021
|
+
s(m).enableTotalCost ? (V(), Y("div", ts, [
|
|
2018
2022
|
y(E, { class: "w-full" }),
|
|
2019
2023
|
e("div", ns, [
|
|
2020
2024
|
e("div", os, [
|
|
@@ -2041,22 +2045,22 @@ const _o = { class: "flex items-center w-full fm-typo-en-title-md-800" }, ko = {
|
|
|
2041
2045
|
_: 1
|
|
2042
2046
|
}),
|
|
2043
2047
|
e("div", as, [
|
|
2044
|
-
n.sku.valuation === s(jt).Enum.FIFO ? (
|
|
2048
|
+
n.sku.valuation === s(jt).Enum.FIFO ? (V(), Y(ne, { key: 0 }, [
|
|
2045
2049
|
y(W, {
|
|
2046
2050
|
label: "FIFO",
|
|
2047
2051
|
compact: ""
|
|
2048
2052
|
}),
|
|
2049
|
-
de(" " + v(typeof
|
|
2050
|
-
|
|
2053
|
+
de(" " + v(typeof ee.value != "string" ? s(Fe)(
|
|
2054
|
+
ee.value,
|
|
2051
2055
|
!1,
|
|
2052
|
-
|
|
2053
|
-
) :
|
|
2054
|
-
], 64)) : (
|
|
2055
|
-
de(v(typeof
|
|
2056
|
-
|
|
2056
|
+
ee.value.precision
|
|
2057
|
+
) : ee.value), 1)
|
|
2058
|
+
], 64)) : (V(), Y(ne, { key: 1 }, [
|
|
2059
|
+
de(v(typeof L.value != "string" ? s(Fe)(
|
|
2060
|
+
L.value,
|
|
2057
2061
|
!1,
|
|
2058
|
-
|
|
2059
|
-
) :
|
|
2062
|
+
L.value.precision
|
|
2063
|
+
) : L.value), 1)
|
|
2060
2064
|
], 64))
|
|
2061
2065
|
])
|
|
2062
2066
|
]),
|
|
@@ -2096,18 +2100,18 @@ const _o = { class: "flex items-center w-full fm-typo-en-title-md-800" }, ko = {
|
|
|
2096
2100
|
_: 1
|
|
2097
2101
|
}),
|
|
2098
2102
|
r[5] || (r[5] = e("div", null, null, -1)),
|
|
2099
|
-
(
|
|
2103
|
+
(V(!0), Y(ne, null, ie(B.value, (ae) => (V(), Y(ne, {
|
|
2100
2104
|
key: ae.date
|
|
2101
2105
|
}, [
|
|
2102
|
-
n.sku ? (
|
|
2106
|
+
n.sku ? (V(), z(fo, {
|
|
2103
2107
|
key: 0,
|
|
2104
2108
|
record: ae,
|
|
2105
2109
|
sku: n.sku,
|
|
2106
2110
|
bills: D.value,
|
|
2107
|
-
onRefreshHistory:
|
|
2111
|
+
onRefreshHistory: b
|
|
2108
2112
|
}, null, 8, ["record", "sku", "bills"])) : se("", !0)
|
|
2109
2113
|
], 64))), 128))
|
|
2110
|
-
])) : (
|
|
2114
|
+
])) : (V(), Y("div", cs, [
|
|
2111
2115
|
y(M),
|
|
2112
2116
|
e("div", null, [
|
|
2113
2117
|
e("img", {
|
|
@@ -2132,12 +2136,12 @@ const _o = { class: "flex items-center w-full fm-typo-en-title-md-800" }, ko = {
|
|
|
2132
2136
|
class: "flex items-center gap-1"
|
|
2133
2137
|
}, ys = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, _s = { class: "flex flex-col gap-8" }, ks = { class: "flex flex-col" }, bs = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, gs = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary line-clamp-1" }, Us = /* @__PURE__ */ ue({
|
|
2134
2138
|
__name: "StockView",
|
|
2135
|
-
setup(
|
|
2139
|
+
setup(k) {
|
|
2136
2140
|
const { t: g } = ce(), d = Be(), o = ke(), $ = Me(), S = dt(), m = ge(), i = rt(), w = Ht(), { columnDefs: j } = sn(), F = Ie(), u = be();
|
|
2137
2141
|
o.watchLocation(D);
|
|
2138
|
-
const
|
|
2142
|
+
const b = P(
|
|
2139
2143
|
() => new Set(w.getAvailableItems(w.businessSubsidiaryId))
|
|
2140
|
-
),
|
|
2144
|
+
), C = O(!1);
|
|
2141
2145
|
async function B() {
|
|
2142
2146
|
F.open({
|
|
2143
2147
|
title: g("inventory.stock.stock_balance.refreshBalance"),
|
|
@@ -2162,17 +2166,17 @@ const _o = { class: "flex items-center w-full fm-typo-en-title-md-800" }, ko = {
|
|
|
2162
2166
|
}
|
|
2163
2167
|
async function D() {
|
|
2164
2168
|
if (o._currentLocation) {
|
|
2165
|
-
|
|
2169
|
+
C.value = !0;
|
|
2166
2170
|
try {
|
|
2167
2171
|
await $.readStockBalance(), await $.readProductBalance(), await i.readStockEstimateBalance();
|
|
2168
|
-
} catch (
|
|
2172
|
+
} catch (J) {
|
|
2169
2173
|
u.open({
|
|
2170
2174
|
title: g("inventory.stock.error.title"),
|
|
2171
2175
|
message: g("inventory.stock.error.message"),
|
|
2172
2176
|
type: "error"
|
|
2173
|
-
}), console.error("error on fetch stock balance",
|
|
2177
|
+
}), console.error("error on fetch stock balance", J);
|
|
2174
2178
|
} finally {
|
|
2175
|
-
|
|
2179
|
+
C.value = !1;
|
|
2176
2180
|
}
|
|
2177
2181
|
}
|
|
2178
2182
|
}
|
|
@@ -2195,14 +2199,14 @@ const _o = { class: "flex items-center w-full fm-typo-en-title-md-800" }, ko = {
|
|
|
2195
2199
|
]
|
|
2196
2200
|
}), l = P(() => {
|
|
2197
2201
|
var n, r, h;
|
|
2198
|
-
const
|
|
2202
|
+
const J = t.value ? Et.build(t.value) : null, p = [];
|
|
2199
2203
|
for (const c of d.skus) {
|
|
2200
2204
|
let f = !0;
|
|
2201
|
-
if (w.isEnabled &&
|
|
2205
|
+
if (w.isEnabled && _.value && b.value && f && (f = b.value.has(c._id)), J && f && (f = Pt(
|
|
2202
2206
|
{
|
|
2203
2207
|
status: c.isInactive ? "Inactive" : "Active"
|
|
2204
2208
|
},
|
|
2205
|
-
|
|
2209
|
+
J
|
|
2206
2210
|
)), f) {
|
|
2207
2211
|
const M = c.trackingMeasurement;
|
|
2208
2212
|
let I = (r = (n = $.stockBalance.skus) == null ? void 0 : n.find(
|
|
@@ -2223,7 +2227,7 @@ const _o = { class: "flex items-center w-full fm-typo-en-title-md-800" }, ko = {
|
|
|
2223
2227
|
}
|
|
2224
2228
|
}
|
|
2225
2229
|
return p;
|
|
2226
|
-
}), x = O(""),
|
|
2230
|
+
}), x = O(""), _ = O(!0), { breakpoints: A } = Kt(), H = P(() => A.value.xs || A.value.sm), N = P(() => H.value ? 10 : 20), K = Rt(), R = P(() => [
|
|
2227
2231
|
{
|
|
2228
2232
|
label: g("inventory.stock.stock_balance.refreshBalance"),
|
|
2229
2233
|
value: "refresh-balance",
|
|
@@ -2244,11 +2248,11 @@ const _o = { class: "flex items-center w-full fm-typo-en-title-md-800" }, ko = {
|
|
|
2244
2248
|
isAdminOnly: !0
|
|
2245
2249
|
}
|
|
2246
2250
|
]), X = O(!1);
|
|
2247
|
-
function
|
|
2251
|
+
function L() {
|
|
2248
2252
|
X.value = !0;
|
|
2249
2253
|
}
|
|
2250
|
-
function J
|
|
2251
|
-
switch (
|
|
2254
|
+
function ee(J) {
|
|
2255
|
+
switch (J) {
|
|
2252
2256
|
case "refresh-balance":
|
|
2253
2257
|
return B();
|
|
2254
2258
|
case "refresh":
|
|
@@ -2256,15 +2260,15 @@ const _o = { class: "flex items-center w-full fm-typo-en-title-md-800" }, ko = {
|
|
|
2256
2260
|
case "export":
|
|
2257
2261
|
return en(l.value);
|
|
2258
2262
|
case "stockAdjustment":
|
|
2259
|
-
return
|
|
2263
|
+
return L();
|
|
2260
2264
|
}
|
|
2261
2265
|
}
|
|
2262
|
-
return (
|
|
2266
|
+
return (J, p) => {
|
|
2263
2267
|
const n = U("FmSwitch"), r = U("FmTable");
|
|
2264
|
-
return
|
|
2268
|
+
return V(), z(Ot, {
|
|
2265
2269
|
title: s(g)("inventory.stock.title"),
|
|
2266
2270
|
actions: R.value,
|
|
2267
|
-
"onClick:action":
|
|
2271
|
+
"onClick:action": ee
|
|
2268
2272
|
}, {
|
|
2269
2273
|
default: T(() => {
|
|
2270
2274
|
var h, c, f, M;
|
|
@@ -2290,14 +2294,14 @@ const _o = { class: "flex items-center w-full fm-typo-en-title-md-800" }, ko = {
|
|
|
2290
2294
|
"onUpdate:filter": p[2] || (p[2] = (I) => t.value = I)
|
|
2291
2295
|
}, {
|
|
2292
2296
|
default: T(() => [
|
|
2293
|
-
s(w).isEnabled ? (
|
|
2297
|
+
s(w).isEnabled ? (V(), Y("div", vs, [
|
|
2294
2298
|
e("span", ys, v(s(g)("inventory.integration.netsuite.subsidiaryHierarchy.filtering")), 1),
|
|
2295
2299
|
y(zt),
|
|
2296
2300
|
y(ze, null, {
|
|
2297
2301
|
default: T(() => [
|
|
2298
2302
|
y(n, {
|
|
2299
|
-
modelValue:
|
|
2300
|
-
"onUpdate:modelValue": p[0] || (p[0] = (I) =>
|
|
2303
|
+
modelValue: _.value,
|
|
2304
|
+
"onUpdate:modelValue": p[0] || (p[0] = (I) => _.value = I)
|
|
2301
2305
|
}, null, 8, ["modelValue"])
|
|
2302
2306
|
]),
|
|
2303
2307
|
_: 1
|
|
@@ -2306,12 +2310,12 @@ const _o = { class: "flex items-center w-full fm-typo-en-title-md-800" }, ko = {
|
|
|
2306
2310
|
]),
|
|
2307
2311
|
_: 1
|
|
2308
2312
|
}, 8, ["search", "filter-attributes", "filter"]),
|
|
2309
|
-
(
|
|
2313
|
+
(V(), z(r, {
|
|
2310
2314
|
style: ot(s(K).tableHeight),
|
|
2311
2315
|
"column-defs": s(j),
|
|
2312
2316
|
"row-data": l.value,
|
|
2313
2317
|
"search-value": x.value,
|
|
2314
|
-
loading:
|
|
2318
|
+
loading: C.value || !s(o)._currentLocation,
|
|
2315
2319
|
key: (h = s(o)._currentLocation) == null ? void 0 : h.dbName,
|
|
2316
2320
|
onRowClick: p[3] || (p[3] = (I) => s(S).showSkuHistory(I.original)),
|
|
2317
2321
|
"page-size": N.value
|
|
@@ -2322,7 +2326,7 @@ const _o = { class: "flex items-center w-full fm-typo-en-title-md-800" }, ko = {
|
|
|
2322
2326
|
onRowClick: s(S).showSkuHistory
|
|
2323
2327
|
}, {
|
|
2324
2328
|
default: T((G) => {
|
|
2325
|
-
var oe, E, W, q, le, re,
|
|
2329
|
+
var oe, E, W, q, le, re, Z, ae, fe, me;
|
|
2326
2330
|
return [
|
|
2327
2331
|
e("div", _s, [
|
|
2328
2332
|
e("div", ks, [
|
|
@@ -2334,8 +2338,8 @@ const _o = { class: "flex items-center w-full fm-typo-en-title-md-800" }, ko = {
|
|
|
2334
2338
|
]),
|
|
2335
2339
|
e("div", gs, [
|
|
2336
2340
|
y(s(Qe), {
|
|
2337
|
-
render: (ae = (
|
|
2338
|
-
props: (me = (
|
|
2341
|
+
render: (ae = (Z = (re = G.name) == null ? void 0 : re.column) == null ? void 0 : Z.columnDef) == null ? void 0 : ae.cell,
|
|
2342
|
+
props: (me = (fe = G.name) == null ? void 0 : fe.getContext) == null ? void 0 : me.call(fe)
|
|
2339
2343
|
}, null, 8, ["render", "props"])
|
|
2340
2344
|
])
|
|
2341
2345
|
]),
|
|
@@ -2362,11 +2366,11 @@ const _o = { class: "flex items-center w-full fm-typo-en-title-md-800" }, ko = {
|
|
|
2362
2366
|
_: 1
|
|
2363
2367
|
}, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"]))
|
|
2364
2368
|
], 2),
|
|
2365
|
-
(
|
|
2366
|
-
(c = s(S).stockHistoryProps) != null && c.sku ? (
|
|
2367
|
-
(f = s(S).convertSkuDialogProps) != null && f.sku ? (
|
|
2368
|
-
(M = s(S).adjustSkuDialogProps) != null && M.stock ? (
|
|
2369
|
-
X.value ? (
|
|
2369
|
+
(V(), z(ft, { to: "body" }, [
|
|
2370
|
+
(c = s(S).stockHistoryProps) != null && c.sku ? (V(), z(fs, Te(He({ key: 0 }, s(S).stockHistoryProps)), null, 16)) : se("", !0),
|
|
2371
|
+
(f = s(S).convertSkuDialogProps) != null && f.sku ? (V(), z(gn, Te(He({ key: 1 }, s(S).convertSkuDialogProps)), null, 16)) : se("", !0),
|
|
2372
|
+
(M = s(S).adjustSkuDialogProps) != null && M.stock ? (V(), z(jn, Te(He({ key: 2 }, s(S).adjustSkuDialogProps)), null, 16)) : se("", !0),
|
|
2373
|
+
X.value ? (V(), z(Yn, {
|
|
2370
2374
|
key: 3,
|
|
2371
2375
|
show: X.value,
|
|
2372
2376
|
"onUpdate:show": p[4] || (p[4] = (I) => X.value = I),
|