@feedmepos/mf-inventory-portal 1.1.8-dev.1 → 1.1.8-dev.3
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-veHf70us.js → App-DdY-tL6d.js} +1 -1
- package/dist/{ApprovalView-BHmFwrSI.js → ApprovalView-D1apNSin.js} +2 -2
- package/dist/{BindingsDialog-BtsPrnkN.js → BindingsDialog-NYYC7EMS.js} +2 -2
- package/dist/{BindingsPicker-BZLdo3j7.js → BindingsPicker-DJ3sTg_e.js} +1 -1
- package/dist/{BindingsTable-Cl_202xc.js → BindingsTable-B5FasJWs.js} +1 -1
- package/dist/{ClosingDraftView-BmYBBxXF.js → ClosingDraftView-BKu_losH.js} +2 -2
- package/dist/{ClosingTemplateView-D_q5Cqh0.js → ClosingTemplateView--1VxQU7U.js} +2 -2
- package/dist/{DeliveryOrderPrintPreview-OpO2cRqM.js → DeliveryOrderPrintPreview-DmVmPHIL.js} +1 -1
- package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-DnD-9Xlp.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-BRG0Rfbm.js} +3 -3
- package/dist/{FmMultiselectDialog-BAXYhHXd.js → FmMultiselectDialog-Cz_Dmt91.js} +1 -1
- package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-BhNXYuvq.js → FmUnitInput.vue_vue_type_script_setup_true_lang-DXB6plH-.js} +1 -1
- package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-C7SW2nNO.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-llPqmeTt.js} +1 -1
- package/dist/{IngredientGroupView-D0h1YsbP.js → IngredientGroupView-Cl24Ekok.js} +2 -2
- package/dist/{IngredientsView-C_3wyh5v.js → IngredientsView-BQsC-7Fw.js} +4 -4
- package/dist/{IntegrationView-QqGcH-dN.js → IntegrationView-C9gSyaTU.js} +3 -3
- package/dist/{InventoryBindingForm-z8_qpiTO.js → InventoryBindingForm-YxAIUhiw.js} +1 -1
- package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-Lx9VL2I6.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-BFvVKi21.js} +3 -3
- package/dist/{InventoryBindingSummary-Bsl4Gv9C.js → InventoryBindingSummary-5uoBPt2b.js} +1 -1
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-BxHFH1_k.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-CvBN72EI.js} +1 -1
- package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-D5oYHtLv.js → PremiumBadge.vue_vue_type_script_setup_true_lang-By0rf6sh.js} +1 -1
- package/dist/{PublishView-D4MSi6ZU.js → PublishView-BkEiBVqj.js} +1 -1
- package/dist/{PurchaseOrderPrintPreview-BfIw_wm3.js → PurchaseOrderPrintPreview-EyMcD2XW.js} +1 -1
- package/dist/{ReceiveRequestView-BLN4uh1f.js → ReceiveRequestView-Dc09tWcz.js} +8 -8
- package/dist/{RecipeView-BYrXdWYU.js → RecipeView-CdqrhnMz.js} +3 -3
- package/dist/{StockView-BkOpMBkI.js → StockView-BvBAtCrX.js} +733 -704
- package/dist/{SupplierView-DCes9XEn.js → SupplierView-EsdZPvdM.js} +3 -3
- package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-DdmVEYUZ.js → TransferDetails.vue_vue_type_script_setup_true_lang-KPBQ3gpI.js} +254 -253
- package/dist/{TransferTemplateView-CSQWhzL3.js → TransferTemplateView-Ba5-1Ewp.js} +6 -6
- package/dist/{UnitView-BR8h1-Fg.js → UnitView-B84IPbML.js} +3 -3
- package/dist/{WarehouseView-C0owHwI6.js → WarehouseView-d-ecUPlf.js} +1 -1
- package/dist/api/stock.d.ts +1 -0
- package/dist/{app-CsCsQ8Wq.js → app-BhhwuRBL.js} +21 -17
- package/dist/app.d.ts +3 -0
- package/dist/app.js +1 -1
- package/dist/{decimal-CCcb_ZM5.js → decimal-DS1ycjoO.js} +1 -1
- package/dist/{format-unit-display-LULBvgMu.js → format-unit-display-CWtXsCmx.js} +2 -2
- package/dist/{index-GxCc62xJ.js → index-DgOQJh8U.js} +1 -1
- package/dist/{index-CcJb5oyS.js → index-ueQSTssg.js} +1 -1
- package/dist/{stock-DYOew5RJ.js → stock-BnEVp_Jj.js} +32 -28
- package/dist/{supplier-CeQJLRf5.js → supplier-DWViUySA.js} +1 -1
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{use-ingredient-select-dialog-DjZg2Cco.js → use-ingredient-select-dialog-FetvENOi.js} +1 -1
- package/dist/{use-inventory-binding-dialog-CBXOv0gD.js → use-inventory-binding-dialog-DWuCe_pt.js} +1 -1
- package/package.json +3 -3
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { u as pe, W as lt, f as
|
|
3
|
-
import { u as
|
|
4
|
-
import { g as Se } from "./decimal-
|
|
5
|
-
import { e as jt, u as
|
|
6
|
-
import { _ as
|
|
1
|
+
import { defineComponent as ue, ref as O, computed as P, resolveComponent as B, openBlock as w, createBlock as K, withCtx as D, createElementVNode as n, normalizeClass as be, toDisplayString as h, createVNode as b, createElementBlock as E, Fragment as se, renderList as ie, unref as l, h as _e, watch as ge, isRef as Te, createCommentVNode as ne, reactive as at, onMounted as Qe, normalizeStyle as Xe, createTextVNode as de, Teleport as rt, normalizeProps as Ae, mergeProps as $e } from "vue";
|
|
2
|
+
import { u as pe, W as lt, f as Ue, h as it, a as Pe, F as Ne, X as ut, Y as De, j as me, P as ct, t as xe, V as je, A as dt, M as mt, T as fe, Z as pt, $ as oe, a0 as vt, a1 as ze, m as ft, a2 as yt, a3 as _t, a4 as kt, a5 as Je, Q as Y, a6 as ht, s as Ze, a7 as ke, a8 as bt, a9 as gt, o as Ce, l as Ye, p as xt, c as St, aa as Ft, ab as wt, ac as At, ad as $t, ae as Ct, B as Vt, _ as Bt, C as Mt, E as Dt, G as Ke } from "./app-BhhwuRBL.js";
|
|
3
|
+
import { u as Ee, a as we } from "./stock-BnEVp_Jj.js";
|
|
4
|
+
import { g as Se } from "./decimal-DS1ycjoO.js";
|
|
5
|
+
import { e as jt, u as et, i as tt, _ as Ge } from "./PremiumBadge.vue_vue_type_script_setup_true_lang-By0rf6sh.js";
|
|
6
|
+
import { _ as Ie, S as Ve, g as nt } from "./StockForecast.vue_vue_type_style_index_0_lang-KLXSWvo5.js";
|
|
7
7
|
import { _ as It } from "./PreviewBadge.vue_vue_type_script_setup_true_lang-CRZiQHjx.js";
|
|
8
|
-
import { useI18n as
|
|
9
|
-
import { useSnackbar as ye, useDialog as
|
|
8
|
+
import { useI18n as ce, useCoreStore as Tt } from "@feedmepos/mf-common";
|
|
9
|
+
import { useSnackbar as ye, useDialog as He, useProxiedModel as Re, useBreakpoints as Ut } from "@feedmepos/ui-library";
|
|
10
10
|
import { defineStore as Pt } from "pinia";
|
|
11
|
-
import { u as Et } from "./use-inventory-binding-dialog-
|
|
12
|
-
import { _ as Ht } from "./NumberPrecisionInput.vue_vue_type_script_setup_true_lang-
|
|
11
|
+
import { u as Et } from "./use-inventory-binding-dialog-DWuCe_pt.js";
|
|
12
|
+
import { _ as Ht } from "./NumberPrecisionInput.vue_vue_type_script_setup_true_lang-CvBN72EI.js";
|
|
13
13
|
import { E as Rt } from "./empty-placeholder-wf6-BWE8.js";
|
|
14
14
|
import "./array-Ca8T3f_G.js";
|
|
15
15
|
var he = /* @__PURE__ */ ((f) => (f.History = "History", f.Convert = "Convert", f.Adjust = "Adjust", f))(he || {});
|
|
@@ -41,7 +41,7 @@ const Ot = [
|
|
|
41
41
|
}
|
|
42
42
|
];
|
|
43
43
|
async function Nt(f) {
|
|
44
|
-
const
|
|
44
|
+
const u = `${(pe().currentLocation.name || "").replace(
|
|
45
45
|
/ /g,
|
|
46
46
|
"_"
|
|
47
47
|
)}_${lt().format("DD_MM_YYYY_HHmm")}.xlsx`;
|
|
@@ -71,22 +71,22 @@ async function Nt(f) {
|
|
|
71
71
|
selector: (o) => {
|
|
72
72
|
var _;
|
|
73
73
|
const S = Fe(o, o.unit);
|
|
74
|
-
return S.type === "unit" ? o.unit.abbrev : ((_ = o.unit.measurements.find((
|
|
74
|
+
return S.type === "unit" ? o.unit.abbrev : ((_ = o.unit.measurements.find((m) => m.id === S.measurement)) == null ? void 0 : _.abbrev) || "";
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
77
|
]
|
|
78
78
|
}
|
|
79
79
|
],
|
|
80
|
-
|
|
80
|
+
u
|
|
81
81
|
);
|
|
82
82
|
}
|
|
83
83
|
function Fe(f, y) {
|
|
84
|
-
const
|
|
85
|
-
return
|
|
84
|
+
const u = localStorage.getItem(`uom:${f._id}`);
|
|
85
|
+
return u ? u === y._id ? {
|
|
86
86
|
type: "unit"
|
|
87
|
-
} : y.measurements.find((o) => o.id ===
|
|
87
|
+
} : y.measurements.find((o) => o.id === u) ? {
|
|
88
88
|
type: "measurement",
|
|
89
|
-
measurement:
|
|
89
|
+
measurement: u
|
|
90
90
|
} : {
|
|
91
91
|
type: "unit"
|
|
92
92
|
} : f.trackingMeasurement && y.measurements.find((o) => o.id === f.trackingMeasurement) ? {
|
|
@@ -96,7 +96,7 @@ function Fe(f, y) {
|
|
|
96
96
|
type: "unit"
|
|
97
97
|
};
|
|
98
98
|
}
|
|
99
|
-
const zt = { class: "fm-typo-en-body-md-400 flex-grow" }, ot = /* @__PURE__ */
|
|
99
|
+
const zt = { class: "fm-typo-en-body-md-400 flex-grow" }, ot = /* @__PURE__ */ ue({
|
|
100
100
|
__name: "UnitDisplayControl",
|
|
101
101
|
props: {
|
|
102
102
|
unit: {},
|
|
@@ -105,90 +105,90 @@ const zt = { class: "fm-typo-en-body-md-400 flex-grow" }, ot = /* @__PURE__ */ i
|
|
|
105
105
|
defaultTrackingMeasurement: {}
|
|
106
106
|
},
|
|
107
107
|
setup(f) {
|
|
108
|
-
function y(
|
|
109
|
-
return `uom:${
|
|
108
|
+
function y(g) {
|
|
109
|
+
return `uom:${g._id}`;
|
|
110
110
|
}
|
|
111
|
-
function
|
|
111
|
+
function u(g) {
|
|
112
112
|
const r = y(o.sku);
|
|
113
|
-
|
|
113
|
+
g ? localStorage.setItem(r, g) : localStorage.setItem(r, o.unit._id), S.value = Fe(o.sku, o.unit);
|
|
114
114
|
}
|
|
115
|
-
const o = f, S = O(Fe(o.sku, o.unit)), _ =
|
|
116
|
-
const { measurements:
|
|
115
|
+
const o = f, S = O(Fe(o.sku, o.unit)), _ = P(() => {
|
|
116
|
+
const { measurements: g } = o.unit;
|
|
117
117
|
return [
|
|
118
118
|
{
|
|
119
119
|
label: `${Se(o.amount, o.unit)}`,
|
|
120
120
|
value: null
|
|
121
121
|
},
|
|
122
|
-
...
|
|
122
|
+
...g.map(({ id: r }) => ({
|
|
123
123
|
label: `${Se(o.amount, o.unit, r)}`,
|
|
124
124
|
value: r
|
|
125
125
|
}))
|
|
126
126
|
];
|
|
127
127
|
});
|
|
128
|
-
function
|
|
129
|
-
return l(S).type === "unit" ?
|
|
128
|
+
function m({ value: g }) {
|
|
129
|
+
return l(S).type === "unit" ? g === null : g === l(S).measurement;
|
|
130
130
|
}
|
|
131
|
-
const
|
|
131
|
+
const p = P(
|
|
132
132
|
() => {
|
|
133
|
-
var
|
|
134
|
-
return ((
|
|
133
|
+
var g;
|
|
134
|
+
return ((g = _.value.find((r) => m(r))) == null ? void 0 : g.label) ?? "";
|
|
135
135
|
}
|
|
136
|
-
),
|
|
137
|
-
return (
|
|
138
|
-
const t =
|
|
139
|
-
return
|
|
136
|
+
), A = O(!1);
|
|
137
|
+
return (g, r) => {
|
|
138
|
+
const t = B("FmIcon"), F = B("FmMenuItem"), $ = B("FmMenu");
|
|
139
|
+
return w(), K($, {
|
|
140
140
|
"stop-click-propagation": "",
|
|
141
|
-
onMenuChanged: r[0] || (r[0] = (k) =>
|
|
141
|
+
onMenuChanged: r[0] || (r[0] = (k) => A.value = k)
|
|
142
142
|
}, {
|
|
143
|
-
"menu-button":
|
|
143
|
+
"menu-button": D(() => [
|
|
144
144
|
n("button", {
|
|
145
145
|
type: "button",
|
|
146
|
-
class:
|
|
146
|
+
class: be([
|
|
147
147
|
"w-full text-left flex items-center gap-8 cursor-pointer fm-corner-radius-sm px-8 py-4 border bg-white",
|
|
148
|
-
|
|
148
|
+
A.value ? "border-fm-color-primary" : "border-fm-color-neutral-gray-100"
|
|
149
149
|
])
|
|
150
150
|
}, [
|
|
151
|
-
n("div", zt, h(
|
|
152
|
-
|
|
151
|
+
n("div", zt, h(p.value), 1),
|
|
152
|
+
b(t, {
|
|
153
153
|
class: "text-fm-color-neutral-gray-400",
|
|
154
154
|
name: "expand_more"
|
|
155
155
|
})
|
|
156
156
|
], 2)
|
|
157
157
|
]),
|
|
158
|
-
default:
|
|
159
|
-
(
|
|
158
|
+
default: D(() => [
|
|
159
|
+
(w(!0), E(se, null, ie(_.value, (k) => (w(), K(F, {
|
|
160
160
|
key: k.value ?? 0,
|
|
161
161
|
label: k.label,
|
|
162
|
-
"model-value":
|
|
163
|
-
onClick: (a) =>
|
|
162
|
+
"model-value": m(k),
|
|
163
|
+
onClick: (a) => u(k.value)
|
|
164
164
|
}, null, 8, ["label", "model-value", "onClick"]))), 128))
|
|
165
165
|
]),
|
|
166
166
|
_: 1
|
|
167
167
|
});
|
|
168
168
|
};
|
|
169
169
|
}
|
|
170
|
-
}), Yt = { class: "whitespace-nowrap" }, Kt = /* @__PURE__ */
|
|
170
|
+
}), Yt = { class: "whitespace-nowrap" }, Kt = /* @__PURE__ */ ue({
|
|
171
171
|
__name: "StockHeaderPreview",
|
|
172
172
|
setup(f) {
|
|
173
|
-
const { t: y } =
|
|
174
|
-
return (
|
|
175
|
-
default:
|
|
173
|
+
const { t: y } = ce();
|
|
174
|
+
return (u, o) => (w(), K(It, null, {
|
|
175
|
+
default: D(() => [
|
|
176
176
|
n("div", Yt, h(l(y)("inventory.stock.prediction.daysRemaining")), 1)
|
|
177
177
|
]),
|
|
178
178
|
_: 1
|
|
179
179
|
}));
|
|
180
180
|
}
|
|
181
181
|
}), st = Pt("stockActions", () => {
|
|
182
|
-
const f = O(!1), y = pe(),
|
|
183
|
-
async function
|
|
182
|
+
const f = O(!1), y = pe(), u = Ee(), o = et(), S = ye(), _ = He(), { t: m } = ce();
|
|
183
|
+
async function p() {
|
|
184
184
|
if (y._currentLocation) {
|
|
185
185
|
f.value = !0;
|
|
186
186
|
try {
|
|
187
|
-
await
|
|
187
|
+
await u.readStockBalance(), await u.readProductBalance(), await o.readStockEstimateBalance();
|
|
188
188
|
} catch {
|
|
189
189
|
S.open({
|
|
190
|
-
title:
|
|
191
|
-
message:
|
|
190
|
+
title: m("inventory.stock.error.title"),
|
|
191
|
+
message: m("inventory.stock.error.message"),
|
|
192
192
|
type: "error"
|
|
193
193
|
});
|
|
194
194
|
} finally {
|
|
@@ -196,104 +196,104 @@ const zt = { class: "fm-typo-en-body-md-400 flex-grow" }, ot = /* @__PURE__ */ i
|
|
|
196
196
|
}
|
|
197
197
|
}
|
|
198
198
|
}
|
|
199
|
-
const
|
|
200
|
-
async function
|
|
201
|
-
var
|
|
202
|
-
if (!!!((
|
|
199
|
+
const A = O();
|
|
200
|
+
async function g(a) {
|
|
201
|
+
var j, U, R;
|
|
202
|
+
if (!!!((U = (j = a.convert) == null ? void 0 : j.inventoryBindings) != null && U.length)) {
|
|
203
203
|
_.open({
|
|
204
|
-
title:
|
|
205
|
-
message:
|
|
204
|
+
title: m("inventory.stock.error.convert.title"),
|
|
205
|
+
message: m("inventory.stock.error.convert.message")
|
|
206
206
|
});
|
|
207
207
|
return;
|
|
208
208
|
}
|
|
209
|
-
const
|
|
210
|
-
maxCount: ((
|
|
209
|
+
const V = {
|
|
210
|
+
maxCount: ((R = u.productBalance.find(({ id: T }) => T === a._id)) == null ? void 0 : R.count) || 0,
|
|
211
211
|
sku: a,
|
|
212
212
|
show: !0,
|
|
213
|
-
"onUpdate:show"(
|
|
214
|
-
|
|
213
|
+
"onUpdate:show"(T) {
|
|
214
|
+
A.value.show = T;
|
|
215
215
|
},
|
|
216
216
|
onSubmitted() {
|
|
217
|
-
|
|
217
|
+
p();
|
|
218
218
|
}
|
|
219
219
|
};
|
|
220
|
-
|
|
220
|
+
A.value = V;
|
|
221
221
|
}
|
|
222
222
|
const r = O();
|
|
223
223
|
async function t(a) {
|
|
224
|
-
const
|
|
224
|
+
const C = {
|
|
225
225
|
stock: a,
|
|
226
226
|
show: !0,
|
|
227
|
-
"onUpdate:show"(
|
|
228
|
-
r.value.show =
|
|
227
|
+
"onUpdate:show"(H) {
|
|
228
|
+
r.value.show = H;
|
|
229
229
|
},
|
|
230
230
|
onSubmitted() {
|
|
231
|
-
|
|
231
|
+
p();
|
|
232
232
|
}
|
|
233
233
|
};
|
|
234
|
-
r.value =
|
|
234
|
+
r.value = C;
|
|
235
235
|
}
|
|
236
236
|
const F = O();
|
|
237
|
-
async function
|
|
238
|
-
const
|
|
237
|
+
async function $(a) {
|
|
238
|
+
const C = {
|
|
239
239
|
sku: a,
|
|
240
240
|
show: !0,
|
|
241
|
-
"onUpdate:show"(
|
|
242
|
-
F.value.show =
|
|
241
|
+
"onUpdate:show"(H) {
|
|
242
|
+
F.value.show = H;
|
|
243
243
|
}
|
|
244
244
|
};
|
|
245
|
-
F.value =
|
|
245
|
+
F.value = C;
|
|
246
246
|
}
|
|
247
|
-
function k(a,
|
|
248
|
-
const
|
|
247
|
+
function k(a, C) {
|
|
248
|
+
const H = Ue(C);
|
|
249
249
|
switch (a) {
|
|
250
250
|
case he.History:
|
|
251
|
-
|
|
251
|
+
$(H);
|
|
252
252
|
return;
|
|
253
253
|
case he.Convert:
|
|
254
|
-
|
|
254
|
+
g(H);
|
|
255
255
|
return;
|
|
256
256
|
case he.Adjust:
|
|
257
|
-
t(
|
|
257
|
+
t(H);
|
|
258
258
|
return;
|
|
259
259
|
}
|
|
260
260
|
}
|
|
261
261
|
return {
|
|
262
|
-
fetchStockBalance:
|
|
262
|
+
fetchStockBalance: p,
|
|
263
263
|
onActionMenu: k,
|
|
264
264
|
stockHistoryProps: F,
|
|
265
|
-
showSkuHistory:
|
|
266
|
-
convertSkuDialogProps:
|
|
265
|
+
showSkuHistory: $,
|
|
266
|
+
convertSkuDialogProps: A,
|
|
267
267
|
adjustSkuDialogProps: r
|
|
268
268
|
};
|
|
269
269
|
});
|
|
270
270
|
function Gt() {
|
|
271
|
-
const f = pe(), y = st(), { t:
|
|
271
|
+
const f = pe(), y = st(), { t: u } = ce();
|
|
272
272
|
return {
|
|
273
273
|
columnDefs: [
|
|
274
274
|
{
|
|
275
275
|
accessorKey: "code",
|
|
276
|
-
header: () =>
|
|
276
|
+
header: () => u("inventory.stock.code"),
|
|
277
277
|
enableSorting: !0,
|
|
278
278
|
size: 300
|
|
279
279
|
},
|
|
280
280
|
{
|
|
281
281
|
accessorKey: "name",
|
|
282
|
-
header: () =>
|
|
282
|
+
header: () => u("inventory.stock.product"),
|
|
283
283
|
enableSorting: !0,
|
|
284
284
|
size: "auto"
|
|
285
285
|
},
|
|
286
286
|
{
|
|
287
287
|
id: "UOM",
|
|
288
|
-
header: () =>
|
|
288
|
+
header: () => u("inventory.stock.balance"),
|
|
289
289
|
cell(S) {
|
|
290
|
-
const _ = S.row.original,
|
|
290
|
+
const _ = S.row.original, m = {
|
|
291
291
|
unit: _.unit,
|
|
292
292
|
sku: _,
|
|
293
293
|
amount: _.balance,
|
|
294
294
|
defaultTrackingMeasurement: _.trackingMeasurement ?? void 0
|
|
295
295
|
};
|
|
296
|
-
return _e(ot,
|
|
296
|
+
return _e(ot, m);
|
|
297
297
|
},
|
|
298
298
|
size: 180
|
|
299
299
|
},
|
|
@@ -305,15 +305,15 @@ function Gt() {
|
|
|
305
305
|
sortUndefined: "last",
|
|
306
306
|
cell(S) {
|
|
307
307
|
var r, t;
|
|
308
|
-
const _ = S.row.original.day,
|
|
309
|
-
if (typeof _ != "number" || typeof
|
|
310
|
-
return _e(
|
|
308
|
+
const _ = S.row.original.day, m = (r = S.row.original.thresholds) == null ? void 0 : r.low, p = (t = S.row.original.thresholds) == null ? void 0 : t.mid;
|
|
309
|
+
if (typeof _ != "number" || typeof m != "number" || typeof p != "number")
|
|
310
|
+
return _e(Ie, {
|
|
311
311
|
days: _
|
|
312
312
|
});
|
|
313
|
-
const
|
|
314
|
-
return _e(
|
|
313
|
+
const A = _ <= m ? Ve.low : _ <= p ? Ve.mid : Ve.high;
|
|
314
|
+
return _e(Ie, {
|
|
315
315
|
days: _,
|
|
316
|
-
level:
|
|
316
|
+
level: A
|
|
317
317
|
});
|
|
318
318
|
},
|
|
319
319
|
size: 200
|
|
@@ -324,7 +324,7 @@ function Gt() {
|
|
|
324
324
|
var _;
|
|
325
325
|
return it(
|
|
326
326
|
((_ = f._currentLocation) == null ? void 0 : _.type) === "restaurant" ? Ot : Lt,
|
|
327
|
-
(
|
|
327
|
+
(m) => y.onActionMenu(m, S.row.original)
|
|
328
328
|
);
|
|
329
329
|
},
|
|
330
330
|
enableSorting: !1,
|
|
@@ -371,10 +371,10 @@ const Wt = {
|
|
|
371
371
|
return this;
|
|
372
372
|
}
|
|
373
373
|
};
|
|
374
|
-
function
|
|
374
|
+
function We(f) {
|
|
375
375
|
return { ...Wt, context: f };
|
|
376
376
|
}
|
|
377
|
-
const qt = { class: "flex items-center" }, Qt = { class: "fm-typo-en-title-md-800" }, Xt = { class: "flex flex-col gap-24 w-full" }, Jt = { class: "flex flex-col gap-8" }, Zt = { class: "fm-typo-en-body-lg-600" }, en = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary flex-grow" }, tn = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-error" }, nn = { class: "flex flex-col p-16 gap-8" }, on = { class: "flex flex-col gap-4" }, sn = { class: "fm-typo-en-body-md-600 text-fm-color-typo-secondary bg-fm-color-neutral-gray-100 border-b py-12 px-16" }, an = { class: "grid grid-cols-[auto_100px_100px_48px] xs:grid-cols-[auto_80px_120px_48px] gap-8 px-8 items-center" }, rn = { class: "xs:col-span-3" }, ln = { class: "flex gap-8" }, un = /* @__PURE__ */
|
|
377
|
+
const qt = { class: "flex items-center" }, Qt = { class: "fm-typo-en-title-md-800" }, Xt = { class: "flex flex-col gap-24 w-full" }, Jt = { class: "flex flex-col gap-8" }, Zt = { class: "fm-typo-en-body-lg-600" }, en = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary flex-grow" }, tn = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-error" }, nn = { class: "flex flex-col p-16 gap-8" }, on = { class: "flex flex-col gap-4" }, sn = { class: "fm-typo-en-body-md-600 text-fm-color-typo-secondary bg-fm-color-neutral-gray-100 border-b py-12 px-16" }, an = { class: "grid grid-cols-[auto_100px_100px_48px] xs:grid-cols-[auto_80px_120px_48px] gap-8 px-8 items-center" }, rn = { class: "xs:col-span-3" }, ln = { class: "flex gap-8" }, un = /* @__PURE__ */ ue({
|
|
378
378
|
__name: "ConvertSkuDialog",
|
|
379
379
|
props: {
|
|
380
380
|
sku: {},
|
|
@@ -382,99 +382,99 @@ const qt = { class: "flex items-center" }, Qt = { class: "fm-typo-en-title-md-80
|
|
|
382
382
|
show: { type: Boolean }
|
|
383
383
|
},
|
|
384
384
|
emits: ["update:show", "submitted"],
|
|
385
|
-
setup(f, { expose: y, emit:
|
|
386
|
-
const o = f, S =
|
|
385
|
+
setup(f, { expose: y, emit: u }) {
|
|
386
|
+
const o = f, S = u, _ = Et(), m = Pe(), p = we(), A = ye(), { t: g } = ce(), r = O(0), t = O(null), F = P(() => m.skus), $ = P(
|
|
387
387
|
() => {
|
|
388
|
-
var
|
|
389
|
-
return (((e = (
|
|
390
|
-
(s) => s.type ===
|
|
388
|
+
var c, e;
|
|
389
|
+
return (((e = (c = o.sku) == null ? void 0 : c.convert) == null ? void 0 : e.inventoryBindings) ?? []).filter(
|
|
390
|
+
(s) => s.type === Ne.enum.SKU
|
|
391
391
|
);
|
|
392
392
|
}
|
|
393
|
-
), k =
|
|
393
|
+
), k = P({
|
|
394
394
|
get() {
|
|
395
395
|
return !!t.value;
|
|
396
396
|
},
|
|
397
|
-
set(
|
|
398
|
-
|
|
397
|
+
set(c) {
|
|
398
|
+
c ? t.value = Ue($.value) : (t.value = null, r.value = Math.min(r.value, o.maxCount ?? 0));
|
|
399
399
|
}
|
|
400
400
|
}), a = O(!1);
|
|
401
|
-
|
|
402
|
-
|
|
401
|
+
ge([() => o.show], ([c]) => {
|
|
402
|
+
c && (r.value = 0);
|
|
403
403
|
});
|
|
404
|
-
function
|
|
405
|
-
|
|
404
|
+
function C() {
|
|
405
|
+
q(o.sku, xe(r.value), t.value);
|
|
406
406
|
}
|
|
407
|
-
function
|
|
407
|
+
function H(c) {
|
|
408
408
|
if (t.value)
|
|
409
409
|
return !0;
|
|
410
|
-
const e =
|
|
410
|
+
const e = We(c).isInteger().max(o.maxCount ?? 0).error ?? "";
|
|
411
411
|
return e || !0;
|
|
412
412
|
}
|
|
413
|
-
function
|
|
413
|
+
function V(c) {
|
|
414
414
|
var d;
|
|
415
|
-
const e = (d = o.sku.convert) != null && d.measurement ? o.sku.unit.measurements.find((
|
|
415
|
+
const e = (d = o.sku.convert) != null && d.measurement ? o.sku.unit.measurements.find((x) => {
|
|
416
416
|
var I;
|
|
417
|
-
return
|
|
418
|
-
}) ?? null : null, s =
|
|
419
|
-
return
|
|
417
|
+
return x.id === ((I = o.sku.convert) == null ? void 0 : I.measurement);
|
|
418
|
+
}) ?? null : null, s = De(o.sku.unit, e), v = pt(+c);
|
|
419
|
+
return We(v).isInteger().max(s).error ? "Precision cannot be more than " + s : !0;
|
|
420
420
|
}
|
|
421
|
-
const
|
|
421
|
+
const j = P(
|
|
422
422
|
() => {
|
|
423
|
-
var
|
|
424
|
-
return (
|
|
423
|
+
var c, e;
|
|
424
|
+
return (c = o.sku.convert) != null && c.measurement ? (e = o.sku.unit.measurements.find((s) => {
|
|
425
425
|
var v;
|
|
426
426
|
return s.id === ((v = o.sku.convert) == null ? void 0 : v.measurement);
|
|
427
427
|
})) == null ? void 0 : e.abbrev : o.sku.unit.abbrev;
|
|
428
428
|
}
|
|
429
|
-
),
|
|
430
|
-
var v,
|
|
429
|
+
), U = P(() => {
|
|
430
|
+
var v, i;
|
|
431
431
|
const e = ut({
|
|
432
432
|
bindings: ((v = o.sku.convert) == null ? void 0 : v.inventoryBindings) ?? [],
|
|
433
|
-
skus:
|
|
434
|
-
skuGroups:
|
|
435
|
-
recipes:
|
|
433
|
+
skus: m.skus,
|
|
434
|
+
skuGroups: m.skuGroups,
|
|
435
|
+
recipes: m.recipes
|
|
436
436
|
}).inventoryBindings.filter((d) => "success" in d && d.success).map((d) => d).map((d) => d.binding);
|
|
437
|
-
return (
|
|
438
|
-
var
|
|
439
|
-
const
|
|
440
|
-
var
|
|
441
|
-
return ve.id === ((
|
|
442
|
-
}) ?? null : null,
|
|
437
|
+
return (i = t.value ?? e) == null ? void 0 : i.map((d) => {
|
|
438
|
+
var re, le, X, ae, Oe;
|
|
439
|
+
const x = m.skus.find((ve) => ve._id === d.id), I = ((re = d.measurement) == null ? void 0 : re.abbrev) ?? ((le = x == null ? void 0 : x.unit) == null ? void 0 : le.abbrev), N = (X = o.sku.convert) != null && X.measurement ? o.sku.unit.measurements.find((ve) => {
|
|
440
|
+
var Le;
|
|
441
|
+
return ve.id === ((Le = o.sku.convert) == null ? void 0 : Le.measurement);
|
|
442
|
+
}) ?? null : null, Q = De(o.sku.unit, N), M = V(`${r.value}`) === !0 ? me(
|
|
443
443
|
ct(
|
|
444
444
|
d.amount,
|
|
445
|
-
xe(+r.value,
|
|
445
|
+
xe(+r.value, Q)
|
|
446
446
|
),
|
|
447
447
|
!1
|
|
448
|
-
) : "0", z = (
|
|
448
|
+
) : "0", z = (Oe = (ae = t.value) == null ? void 0 : ae.find((ve) => ve.id === (x == null ? void 0 : x._id))) == null ? void 0 : Oe.amount, W = z ? me(z, !1) : null;
|
|
449
449
|
return {
|
|
450
|
-
sku:
|
|
451
|
-
convertAmount: W ??
|
|
450
|
+
sku: x,
|
|
451
|
+
convertAmount: W ?? M,
|
|
452
452
|
abbrev: I
|
|
453
453
|
};
|
|
454
454
|
});
|
|
455
|
-
}),
|
|
455
|
+
}), R = O();
|
|
456
456
|
y({
|
|
457
457
|
validateInputs: () => {
|
|
458
|
-
var
|
|
459
|
-
(e = (
|
|
458
|
+
var c, e;
|
|
459
|
+
(e = (c = R.value) == null ? void 0 : c.validateInputs) == null || e.call(c);
|
|
460
460
|
},
|
|
461
461
|
resetInputsValidation: () => {
|
|
462
|
-
var
|
|
463
|
-
(e = (
|
|
462
|
+
var c, e;
|
|
463
|
+
(e = (c = R.value) == null ? void 0 : c.resetInputsValidation) == null || e.call(c);
|
|
464
464
|
},
|
|
465
465
|
resetInputs: () => {
|
|
466
|
-
var
|
|
467
|
-
(e = (
|
|
466
|
+
var c, e;
|
|
467
|
+
(e = (c = R.value) == null ? void 0 : c.resetInputs) == null || e.call(c);
|
|
468
468
|
}
|
|
469
469
|
});
|
|
470
|
-
const
|
|
471
|
-
async function
|
|
470
|
+
const T = Re(o, "show");
|
|
471
|
+
async function q(c, e, s) {
|
|
472
472
|
a.value = !0;
|
|
473
473
|
try {
|
|
474
|
-
await
|
|
474
|
+
await p.convertSku({
|
|
475
475
|
conversions: [
|
|
476
476
|
{
|
|
477
|
-
doc:
|
|
477
|
+
doc: c,
|
|
478
478
|
amount: e,
|
|
479
479
|
overrides: s == null ? void 0 : s.map((v) => ({
|
|
480
480
|
...v,
|
|
@@ -488,178 +488,178 @@ const qt = { class: "flex items-center" }, Qt = { class: "fm-typo-en-title-md-80
|
|
|
488
488
|
]
|
|
489
489
|
}), S("update:show", !1), S("submitted");
|
|
490
490
|
} catch (v) {
|
|
491
|
-
|
|
491
|
+
A.open({
|
|
492
492
|
title: "Something went wrong",
|
|
493
|
-
message: `Cannot convert ${
|
|
493
|
+
message: `Cannot convert ${c.name}. Please try again.`,
|
|
494
494
|
type: "error"
|
|
495
|
-
}), console.error("error at converting stock amount",
|
|
495
|
+
}), console.error("error at converting stock amount", c, e, v);
|
|
496
496
|
} finally {
|
|
497
497
|
a.value = !1;
|
|
498
498
|
}
|
|
499
499
|
}
|
|
500
|
-
function
|
|
500
|
+
function J(c, e, s) {
|
|
501
501
|
const v = +e;
|
|
502
|
-
let
|
|
503
|
-
e.length > 0 && isFinite(v) ?
|
|
502
|
+
let i = s;
|
|
503
|
+
e.length > 0 && isFinite(v) ? i = s.map((d) => (d.id !== c || (d.amount = fe(v)), d)) : i = s.map((d) => (d.id !== c || (d.amount = { amount: 0, precision: 0 }), d)), t.value = i;
|
|
504
504
|
}
|
|
505
|
-
function
|
|
506
|
-
const e = F.value.find((s) => s._id ===
|
|
507
|
-
return e ?
|
|
505
|
+
function L(c) {
|
|
506
|
+
const e = F.value.find((s) => s._id === c);
|
|
507
|
+
return e ? nt(e.unit, !0) : [];
|
|
508
508
|
}
|
|
509
|
-
function
|
|
510
|
-
const s =
|
|
509
|
+
function Z(c, e) {
|
|
510
|
+
const s = L(c), v = s.find((i) => i.value === e) ?? s.find((i) => i.value === null);
|
|
511
511
|
return v ? {
|
|
512
512
|
...v,
|
|
513
513
|
label: v.abbrev
|
|
514
514
|
} : null;
|
|
515
515
|
}
|
|
516
|
-
function
|
|
516
|
+
function ee(c, e, s) {
|
|
517
517
|
let v;
|
|
518
518
|
if (e === null)
|
|
519
|
-
v = s.map((
|
|
519
|
+
v = s.map((i) => (i.id !== c || (i.measurement = null), i)) ?? [];
|
|
520
520
|
else {
|
|
521
|
-
const
|
|
521
|
+
const i = F.value.find((d) => d._id === c);
|
|
522
522
|
v = s.map((d) => {
|
|
523
|
-
var
|
|
524
|
-
return d.id !==
|
|
523
|
+
var x, I;
|
|
524
|
+
return d.id !== c || (d.measurement = (I = (x = i == null ? void 0 : i.unit) == null ? void 0 : x.measurements) == null ? void 0 : I.find((N) => N.id === e)), d;
|
|
525
525
|
}) ?? [];
|
|
526
526
|
}
|
|
527
527
|
t.value = v;
|
|
528
528
|
}
|
|
529
|
-
function
|
|
530
|
-
const s = e.filter((v) => v.id !==
|
|
529
|
+
function te(c, e) {
|
|
530
|
+
const s = e.filter((v) => v.id !== c);
|
|
531
531
|
t.value = s;
|
|
532
532
|
}
|
|
533
|
-
function
|
|
534
|
-
const
|
|
533
|
+
function G() {
|
|
534
|
+
const c = (t.value ?? []).map((e) => ({
|
|
535
535
|
...e,
|
|
536
|
-
type:
|
|
536
|
+
type: Ne.enum.SKU
|
|
537
537
|
}));
|
|
538
538
|
_.promptIngredientsBinding(
|
|
539
|
-
|
|
539
|
+
c,
|
|
540
540
|
(e) => t.value = e,
|
|
541
541
|
o.sku._id
|
|
542
542
|
);
|
|
543
543
|
}
|
|
544
|
-
return
|
|
544
|
+
return ge(
|
|
545
545
|
() => o.show,
|
|
546
|
-
(
|
|
547
|
-
|
|
546
|
+
(c) => {
|
|
547
|
+
c || (t.value = null, r.value = 0);
|
|
548
548
|
}
|
|
549
|
-
), (
|
|
550
|
-
const s =
|
|
551
|
-
return
|
|
549
|
+
), (c, e) => {
|
|
550
|
+
const s = B("FmTextField"), v = B("FmForm"), i = B("FmCard"), d = B("FmSwitch"), x = B("FmFormGroup"), I = B("FmSelect"), N = B("FmButton"), Q = B("FmSideSheet");
|
|
551
|
+
return w(), K(Q, {
|
|
552
552
|
"dismiss-away": "",
|
|
553
|
-
modelValue: l(
|
|
554
|
-
"onUpdate:modelValue": e[3] || (e[3] = (
|
|
553
|
+
modelValue: l(T),
|
|
554
|
+
"onUpdate:modelValue": e[3] || (e[3] = (M) => Te(T) ? T.value = M : null),
|
|
555
555
|
"max-width": 500
|
|
556
556
|
}, {
|
|
557
|
-
"side-sheet-header":
|
|
557
|
+
"side-sheet-header": D(() => [
|
|
558
558
|
n("div", qt, [
|
|
559
|
-
n("div", Qt, h(l(
|
|
559
|
+
n("div", Qt, h(l(g)("inventory.stock.convert.title", { name: c.sku.name })), 1)
|
|
560
560
|
])
|
|
561
561
|
]),
|
|
562
|
-
default:
|
|
562
|
+
default: D(() => [
|
|
563
563
|
n("div", Xt, [
|
|
564
|
-
|
|
564
|
+
b(v, {
|
|
565
565
|
ref_key: "formRef",
|
|
566
|
-
ref:
|
|
567
|
-
onValidationSuccess:
|
|
566
|
+
ref: R,
|
|
567
|
+
onValidationSuccess: C
|
|
568
568
|
}, {
|
|
569
|
-
default:
|
|
570
|
-
|
|
569
|
+
default: D(() => [
|
|
570
|
+
b(s, {
|
|
571
571
|
disabled: a.value,
|
|
572
572
|
"model-value": r.value,
|
|
573
|
-
"onUpdate:modelValue": e[0] || (e[0] = (
|
|
574
|
-
label: l(
|
|
575
|
-
rules: [
|
|
576
|
-
"append-text":
|
|
577
|
-
"helper-text": t.value ? void 0 : `Max ${
|
|
573
|
+
"onUpdate:modelValue": e[0] || (e[0] = (M) => r.value = M),
|
|
574
|
+
label: l(g)("inventory.stock.convert.amount"),
|
|
575
|
+
rules: [H, V, l(je)(0)],
|
|
576
|
+
"append-text": j.value,
|
|
577
|
+
"helper-text": t.value ? void 0 : `Max ${c.maxCount} ${j.value}`
|
|
578
578
|
}, null, 8, ["disabled", "model-value", "label", "rules", "append-text", "helper-text"])
|
|
579
579
|
]),
|
|
580
580
|
_: 1
|
|
581
581
|
}, 512),
|
|
582
|
-
|
|
582
|
+
b(i, {
|
|
583
583
|
variant: "outlined",
|
|
584
584
|
class: "p-16"
|
|
585
585
|
}, {
|
|
586
|
-
default:
|
|
586
|
+
default: D(() => [
|
|
587
587
|
n("div", Jt, [
|
|
588
|
-
n("div", Zt, h(l(
|
|
589
|
-
(
|
|
588
|
+
n("div", Zt, h(l(g)("inventory.stock.convert.deductionSummary")), 1),
|
|
589
|
+
(w(!0), E(se, null, ie(U.value, (M) => {
|
|
590
590
|
var z, W;
|
|
591
|
-
return
|
|
592
|
-
key: (z =
|
|
591
|
+
return w(), E("div", {
|
|
592
|
+
key: (z = M.sku) == null ? void 0 : z._id,
|
|
593
593
|
class: "flex items-center"
|
|
594
594
|
}, [
|
|
595
|
-
n("div", en, h((W =
|
|
596
|
-
n("div", tn, " -" + h(
|
|
595
|
+
n("div", en, h((W = M.sku) == null ? void 0 : W.name), 1),
|
|
596
|
+
n("div", tn, " -" + h(M.convertAmount) + " " + h(M.abbrev), 1)
|
|
597
597
|
]);
|
|
598
598
|
}), 128))
|
|
599
599
|
])
|
|
600
600
|
]),
|
|
601
601
|
_: 1
|
|
602
602
|
}),
|
|
603
|
-
|
|
604
|
-
default:
|
|
603
|
+
b(i, { variant: "outlined" }, {
|
|
604
|
+
default: D(() => [
|
|
605
605
|
n("div", nn, [
|
|
606
|
-
|
|
606
|
+
b(d, {
|
|
607
607
|
value: "",
|
|
608
608
|
modelValue: k.value,
|
|
609
|
-
"onUpdate:modelValue": e[1] || (e[1] = (
|
|
610
|
-
label: l(
|
|
609
|
+
"onUpdate:modelValue": e[1] || (e[1] = (M) => k.value = M),
|
|
610
|
+
label: l(g)("inventory.stock.convert.overrideDeduction"),
|
|
611
611
|
"label-placement": "right"
|
|
612
612
|
}, null, 8, ["modelValue", "label"]),
|
|
613
|
-
k.value ? (
|
|
614
|
-
|
|
613
|
+
k.value ? (w(), E(se, { key: 0 }, [
|
|
614
|
+
b(x, {
|
|
615
615
|
modelValue: t.value,
|
|
616
616
|
rules: [l(dt)(1, "Must have at least one ingredient binding")]
|
|
617
617
|
}, null, 8, ["modelValue", "rules"]),
|
|
618
618
|
n("div", on, [
|
|
619
|
-
n("div", sn, h(l(
|
|
620
|
-
(
|
|
621
|
-
key:
|
|
619
|
+
n("div", sn, h(l(g)("inventory.stock.convert.ingredients")), 1),
|
|
620
|
+
(w(!0), E(se, null, ie(t.value, (M) => (w(), K(x, {
|
|
621
|
+
key: M.id,
|
|
622
622
|
disabled: a.value,
|
|
623
|
-
modelValue: +l(
|
|
623
|
+
modelValue: +l(me)(M.amount ?? { amount: 1, precision: 0 }),
|
|
624
624
|
rules: [
|
|
625
625
|
l(mt)(
|
|
626
|
-
F.value.find((z) => z._id ===
|
|
627
|
-
|
|
626
|
+
F.value.find((z) => z._id === M.id).unit,
|
|
627
|
+
M.measurement
|
|
628
628
|
),
|
|
629
|
-
l(
|
|
629
|
+
l(je)(0)
|
|
630
630
|
]
|
|
631
631
|
}, {
|
|
632
|
-
default:
|
|
633
|
-
var W,
|
|
632
|
+
default: D(({ invalid: z }) => {
|
|
633
|
+
var W, re, le;
|
|
634
634
|
return [
|
|
635
635
|
n("div", an, [
|
|
636
|
-
n("div", rn, h((W = F.value.find((X) => X._id ===
|
|
637
|
-
|
|
636
|
+
n("div", rn, h((W = F.value.find((X) => X._id === M.id)) == null ? void 0 : W.name), 1),
|
|
637
|
+
b(s, {
|
|
638
638
|
class: "xs:col-span-2",
|
|
639
639
|
disabled: a.value,
|
|
640
|
-
modelValue: +l(
|
|
641
|
-
|
|
640
|
+
modelValue: +l(me)(
|
|
641
|
+
M.amount ?? { amount: 1, precision: 0 }
|
|
642
642
|
),
|
|
643
|
-
"onUpdate:modelValue": (X) =>
|
|
643
|
+
"onUpdate:modelValue": (X) => J(M.id, X, t.value ?? []),
|
|
644
644
|
invalid: z
|
|
645
645
|
}, null, 8, ["disabled", "modelValue", "onUpdate:modelValue", "invalid"]),
|
|
646
|
-
|
|
646
|
+
b(I, {
|
|
647
647
|
disabled: a.value,
|
|
648
648
|
class: "translate-y-[2px]",
|
|
649
|
-
items:
|
|
650
|
-
"model-value": (
|
|
651
|
-
"onUpdate:modelValue": (X) =>
|
|
649
|
+
items: L(M.id),
|
|
650
|
+
"model-value": (le = Z(M.id, (re = M.measurement) == null ? void 0 : re.id)) == null ? void 0 : le.value,
|
|
651
|
+
"onUpdate:modelValue": (X) => ee(M.id, X, t.value ?? []),
|
|
652
652
|
invalid: z
|
|
653
653
|
}, {
|
|
654
|
-
"helper-text":
|
|
654
|
+
"helper-text": D(() => e[4] || (e[4] = [])),
|
|
655
655
|
_: 2
|
|
656
656
|
}, 1032, ["disabled", "items", "model-value", "onUpdate:modelValue", "invalid"]),
|
|
657
|
-
|
|
657
|
+
b(N, {
|
|
658
658
|
disabled: a.value,
|
|
659
659
|
type: "button",
|
|
660
660
|
variant: "tertiary",
|
|
661
661
|
icon: "delete",
|
|
662
|
-
onClick: (X) =>
|
|
662
|
+
onClick: (X) => te(M.id, t.value ?? [])
|
|
663
663
|
}, null, 8, ["disabled", "onClick"])
|
|
664
664
|
])
|
|
665
665
|
];
|
|
@@ -668,28 +668,28 @@ const qt = { class: "flex items-center" }, Qt = { class: "fm-typo-en-title-md-80
|
|
|
668
668
|
}, 1032, ["disabled", "modelValue", "rules"]))), 128))
|
|
669
669
|
]),
|
|
670
670
|
n("div", null, [
|
|
671
|
-
|
|
671
|
+
b(N, {
|
|
672
672
|
icon: "link",
|
|
673
|
-
label: l(
|
|
673
|
+
label: l(g)("inventory.stock.convert.linkIngredient"),
|
|
674
674
|
variant: "plain",
|
|
675
|
-
onClick:
|
|
675
|
+
onClick: G
|
|
676
676
|
}, null, 8, ["label"])
|
|
677
677
|
])
|
|
678
|
-
], 64)) :
|
|
678
|
+
], 64)) : ne("", !0)
|
|
679
679
|
])
|
|
680
680
|
]),
|
|
681
681
|
_: 1
|
|
682
682
|
})
|
|
683
683
|
])
|
|
684
684
|
]),
|
|
685
|
-
"side-sheet-footer":
|
|
685
|
+
"side-sheet-footer": D(() => [
|
|
686
686
|
n("div", ln, [
|
|
687
|
-
|
|
687
|
+
b(N, {
|
|
688
688
|
loading: a.value,
|
|
689
|
-
label: l(
|
|
690
|
-
onClick: e[2] || (e[2] = (
|
|
689
|
+
label: l(g)("inventory.stock.convert.convertButton"),
|
|
690
|
+
onClick: e[2] || (e[2] = (M) => {
|
|
691
691
|
var z, W;
|
|
692
|
-
return (W = (z =
|
|
692
|
+
return (W = (z = R.value) == null ? void 0 : z.validateInputs) == null ? void 0 : W.call(z);
|
|
693
693
|
})
|
|
694
694
|
}, null, 8, ["loading", "label"])
|
|
695
695
|
])
|
|
@@ -699,35 +699,35 @@ const qt = { class: "flex items-center" }, Qt = { class: "fm-typo-en-title-md-80
|
|
|
699
699
|
};
|
|
700
700
|
}
|
|
701
701
|
});
|
|
702
|
-
function
|
|
703
|
-
const
|
|
704
|
-
return { ...
|
|
702
|
+
function Be(f, y) {
|
|
703
|
+
const u = xe(f, y);
|
|
704
|
+
return { ...u, amount: -u.amount };
|
|
705
705
|
}
|
|
706
|
-
function
|
|
706
|
+
function qe(f, y) {
|
|
707
707
|
return xe(Math.abs(f), y);
|
|
708
708
|
}
|
|
709
|
-
const
|
|
710
|
-
[
|
|
709
|
+
const Me = {
|
|
710
|
+
[oe.enum.DAMAGE]: {
|
|
711
711
|
label: "Waste",
|
|
712
|
-
toAdjustmentAmount:
|
|
712
|
+
toAdjustmentAmount: Be
|
|
713
713
|
},
|
|
714
|
-
[
|
|
714
|
+
[oe.enum.THEFT]: {
|
|
715
715
|
label: "Theft",
|
|
716
|
-
toAdjustmentAmount:
|
|
716
|
+
toAdjustmentAmount: Be
|
|
717
717
|
},
|
|
718
|
-
[
|
|
718
|
+
[oe.enum.LOSE]: {
|
|
719
719
|
label: "Lose",
|
|
720
|
-
toAdjustmentAmount:
|
|
720
|
+
toAdjustmentAmount: Be
|
|
721
721
|
},
|
|
722
|
-
[
|
|
722
|
+
[oe.enum.EXTRA]: {
|
|
723
723
|
label: "Extra",
|
|
724
|
-
toAdjustmentAmount:
|
|
724
|
+
toAdjustmentAmount: qe
|
|
725
725
|
},
|
|
726
|
-
[
|
|
726
|
+
[oe.enum.PURCHASE]: {
|
|
727
727
|
label: "Purchase",
|
|
728
|
-
toAdjustmentAmount:
|
|
728
|
+
toAdjustmentAmount: qe
|
|
729
729
|
}
|
|
730
|
-
}, cn = { class: "col-span-2 flex" }, dn = { class: "fm-typo-en-body-lg-600 flex-1" }, mn = /* @__PURE__ */
|
|
730
|
+
}, cn = { class: "col-span-2 flex" }, dn = { class: "fm-typo-en-body-lg-600 flex-1" }, mn = /* @__PURE__ */ ue({
|
|
731
731
|
__name: "AdjustedItemForm",
|
|
732
732
|
props: {
|
|
733
733
|
modelValue: {},
|
|
@@ -735,112 +735,112 @@ const Be = {
|
|
|
735
735
|
},
|
|
736
736
|
emits: ["update:modelValue", "click:delete"],
|
|
737
737
|
setup(f, { emit: y }) {
|
|
738
|
-
const
|
|
739
|
-
() => Object.keys(
|
|
738
|
+
const u = f, o = y, S = P(
|
|
739
|
+
() => Object.keys(Me).map((r) => ({
|
|
740
740
|
label: vt(r),
|
|
741
741
|
value: r
|
|
742
742
|
}))
|
|
743
|
-
), _ =
|
|
743
|
+
), _ = P(() => nt(u.modelValue.doc.unit, !0)), m = P({
|
|
744
744
|
get() {
|
|
745
|
-
return
|
|
745
|
+
return u.modelValue.type ?? oe.enum.PURCHASE;
|
|
746
746
|
},
|
|
747
747
|
set(r) {
|
|
748
748
|
const t = {
|
|
749
|
-
...
|
|
749
|
+
...u.modelValue
|
|
750
750
|
};
|
|
751
751
|
t.type = r;
|
|
752
|
-
const F =
|
|
753
|
-
t.amount =
|
|
754
|
-
+
|
|
752
|
+
const F = ze(u.modelValue.amount);
|
|
753
|
+
t.amount = Me[t.type].toAdjustmentAmount(
|
|
754
|
+
+me(F),
|
|
755
755
|
F.precision
|
|
756
756
|
), o("update:modelValue", t);
|
|
757
757
|
}
|
|
758
|
-
}),
|
|
758
|
+
}), p = P({
|
|
759
759
|
get() {
|
|
760
|
-
const r =
|
|
761
|
-
return +
|
|
760
|
+
const r = ze(u.modelValue.amount);
|
|
761
|
+
return +me(r);
|
|
762
762
|
},
|
|
763
763
|
set(r) {
|
|
764
764
|
const t = {
|
|
765
|
-
...
|
|
765
|
+
...u.modelValue
|
|
766
766
|
}, F = fe(r);
|
|
767
|
-
t.amount =
|
|
767
|
+
t.amount = Me[m.value].toAdjustmentAmount(
|
|
768
768
|
r,
|
|
769
769
|
F.precision
|
|
770
770
|
), o("update:modelValue", t);
|
|
771
771
|
}
|
|
772
|
-
}),
|
|
772
|
+
}), A = P({
|
|
773
773
|
get() {
|
|
774
774
|
var r;
|
|
775
|
-
return ((r =
|
|
775
|
+
return ((r = u.modelValue.measurement) == null ? void 0 : r.id) ?? null;
|
|
776
776
|
},
|
|
777
777
|
set(r) {
|
|
778
|
-
var F,
|
|
778
|
+
var F, $;
|
|
779
779
|
const t = {
|
|
780
|
-
...
|
|
780
|
+
...u.modelValue
|
|
781
781
|
};
|
|
782
|
-
t.measurement = ((
|
|
782
|
+
t.measurement = (($ = (F = u.modelValue.doc.unit) == null ? void 0 : F.measurements) == null ? void 0 : $.find((k) => k.id === r)) ?? null, o("update:modelValue", t);
|
|
783
783
|
}
|
|
784
|
-
}),
|
|
784
|
+
}), g = P({
|
|
785
785
|
get() {
|
|
786
|
-
return
|
|
786
|
+
return u.modelValue.remark ?? "";
|
|
787
787
|
},
|
|
788
788
|
set(r) {
|
|
789
789
|
const t = {
|
|
790
|
-
...
|
|
790
|
+
...u.modelValue
|
|
791
791
|
};
|
|
792
792
|
t.remark = r, o("update:modelValue", t);
|
|
793
793
|
}
|
|
794
794
|
});
|
|
795
795
|
return (r, t) => {
|
|
796
|
-
const F =
|
|
797
|
-
return
|
|
796
|
+
const F = B("FmButton"), $ = B("FmSelect"), k = B("FmTextarea"), a = B("FmCard");
|
|
797
|
+
return w(), K(a, {
|
|
798
798
|
variant: "outlined",
|
|
799
799
|
class: "grid grid-cols-2 gap-8 p-16"
|
|
800
800
|
}, {
|
|
801
|
-
default:
|
|
801
|
+
default: D(() => [
|
|
802
802
|
n("div", cn, [
|
|
803
803
|
n("div", dn, h(r.modelValue.doc.name), 1),
|
|
804
|
-
|
|
804
|
+
b(F, {
|
|
805
805
|
variant: "tertiary",
|
|
806
806
|
"prepend-icon": "delete",
|
|
807
|
-
onClick: t[0] || (t[0] = (
|
|
807
|
+
onClick: t[0] || (t[0] = (C) => o("click:delete"))
|
|
808
808
|
})
|
|
809
809
|
]),
|
|
810
|
-
|
|
810
|
+
b($, {
|
|
811
811
|
disabled: r.disabled,
|
|
812
812
|
class: "col-span-2",
|
|
813
813
|
label: "Type",
|
|
814
814
|
items: S.value,
|
|
815
|
-
modelValue:
|
|
816
|
-
"onUpdate:modelValue": t[1] || (t[1] = (
|
|
815
|
+
modelValue: m.value,
|
|
816
|
+
"onUpdate:modelValue": t[1] || (t[1] = (C) => m.value = C),
|
|
817
817
|
rules: [l(ft)()],
|
|
818
818
|
"label-mark": "required"
|
|
819
819
|
}, null, 8, ["disabled", "items", "modelValue", "rules"]),
|
|
820
|
-
|
|
820
|
+
b(Ht, {
|
|
821
821
|
disabled: r.disabled,
|
|
822
822
|
label: "Amount",
|
|
823
|
-
step: +l(
|
|
823
|
+
step: +l(me)({
|
|
824
824
|
amount: 1,
|
|
825
|
-
precision: l(
|
|
825
|
+
precision: l(De)(r.modelValue.doc.unit, r.modelValue.measurement)
|
|
826
826
|
}),
|
|
827
|
-
modelValue:
|
|
828
|
-
"onUpdate:modelValue": t[2] || (t[2] = (
|
|
829
|
-
rules: [l(
|
|
827
|
+
modelValue: p.value,
|
|
828
|
+
"onUpdate:modelValue": t[2] || (t[2] = (C) => p.value = C),
|
|
829
|
+
rules: [l(je)(0)]
|
|
830
830
|
}, null, 8, ["disabled", "step", "modelValue", "rules"]),
|
|
831
|
-
|
|
831
|
+
b($, {
|
|
832
832
|
disabled: r.disabled,
|
|
833
833
|
label: "Unit",
|
|
834
834
|
items: _.value,
|
|
835
|
-
modelValue:
|
|
836
|
-
"onUpdate:modelValue": t[3] || (t[3] = (
|
|
835
|
+
modelValue: A.value,
|
|
836
|
+
"onUpdate:modelValue": t[3] || (t[3] = (C) => A.value = C)
|
|
837
837
|
}, null, 8, ["disabled", "items", "modelValue"]),
|
|
838
|
-
|
|
838
|
+
b(k, {
|
|
839
839
|
class: "col-span-2",
|
|
840
840
|
disabled: r.disabled,
|
|
841
841
|
label: "Remark",
|
|
842
|
-
modelValue:
|
|
843
|
-
"onUpdate:modelValue": t[4] || (t[4] = (
|
|
842
|
+
modelValue: g.value,
|
|
843
|
+
"onUpdate:modelValue": t[4] || (t[4] = (C) => g.value = C),
|
|
844
844
|
"label-mark": "optional"
|
|
845
845
|
}, null, 8, ["disabled", "modelValue"])
|
|
846
846
|
]),
|
|
@@ -848,39 +848,39 @@ const Be = {
|
|
|
848
848
|
});
|
|
849
849
|
};
|
|
850
850
|
}
|
|
851
|
-
}), pn = { class: "flex items-center" }, vn = { class: "fm-typo-en-title-md-800" }, fn = { class: "flex items-center" }, yn = { class: "fm-typo-en-title-sm-800 flex-1" }, _n = { class: "flex gap-8" }, kn = /* @__PURE__ */
|
|
851
|
+
}), pn = { class: "flex items-center" }, vn = { class: "fm-typo-en-title-md-800" }, fn = { class: "flex items-center" }, yn = { class: "fm-typo-en-title-sm-800 flex-1" }, _n = { class: "flex gap-8" }, kn = /* @__PURE__ */ ue({
|
|
852
852
|
__name: "AdjustSkuDialog",
|
|
853
853
|
props: {
|
|
854
854
|
stock: {},
|
|
855
855
|
show: { type: Boolean }
|
|
856
856
|
},
|
|
857
857
|
emits: ["update:show", "submitted"],
|
|
858
|
-
setup(f, { expose: y, emit:
|
|
859
|
-
const o = f, S =
|
|
858
|
+
setup(f, { expose: y, emit: u }) {
|
|
859
|
+
const o = f, S = u, _ = Pe(), m = He(), p = we(), A = ye(), g = O(!1), { t: r } = ce();
|
|
860
860
|
function t() {
|
|
861
|
-
a(
|
|
861
|
+
a(Ue(k));
|
|
862
862
|
}
|
|
863
863
|
const F = O();
|
|
864
864
|
y({
|
|
865
865
|
validateInputs: () => {
|
|
866
|
-
var
|
|
867
|
-
(
|
|
866
|
+
var V, j;
|
|
867
|
+
(j = (V = F.value) == null ? void 0 : V.validateInputs) == null || j.call(V);
|
|
868
868
|
},
|
|
869
869
|
resetInputsValidation: () => {
|
|
870
|
-
var
|
|
871
|
-
(
|
|
870
|
+
var V, j;
|
|
871
|
+
(j = (V = F.value) == null ? void 0 : V.resetInputsValidation) == null || j.call(V);
|
|
872
872
|
},
|
|
873
873
|
resetInputs: () => {
|
|
874
|
-
var
|
|
875
|
-
(
|
|
874
|
+
var V, j;
|
|
875
|
+
(j = (V = F.value) == null ? void 0 : V.resetInputs) == null || j.call(V);
|
|
876
876
|
}
|
|
877
877
|
});
|
|
878
|
-
const
|
|
878
|
+
const $ = Re(o, "show"), k = at({
|
|
879
879
|
remark: "",
|
|
880
880
|
adjustments: [
|
|
881
881
|
{
|
|
882
882
|
id: `sku_${(/* @__PURE__ */ new Date()).toISOString()}_${Math.random().toString(16).slice(2, 8)}`,
|
|
883
|
-
type:
|
|
883
|
+
type: oe.enum.PURCHASE,
|
|
884
884
|
doc: o.stock,
|
|
885
885
|
measurement: null,
|
|
886
886
|
remark: "",
|
|
@@ -888,11 +888,11 @@ const Be = {
|
|
|
888
888
|
}
|
|
889
889
|
]
|
|
890
890
|
});
|
|
891
|
-
|
|
892
|
-
|
|
891
|
+
ge([() => o.show], ([V]) => {
|
|
892
|
+
V && (k.remark = "", k.adjustments = [
|
|
893
893
|
{
|
|
894
894
|
id: `sku_${(/* @__PURE__ */ new Date()).toISOString()}_${Math.random().toString(16).slice(2, 8)}`,
|
|
895
|
-
type:
|
|
895
|
+
type: oe.enum.PURCHASE,
|
|
896
896
|
doc: o.stock,
|
|
897
897
|
measurement: null,
|
|
898
898
|
remark: "",
|
|
@@ -900,42 +900,42 @@ const Be = {
|
|
|
900
900
|
}
|
|
901
901
|
]);
|
|
902
902
|
});
|
|
903
|
-
async function a(
|
|
904
|
-
|
|
903
|
+
async function a(V) {
|
|
904
|
+
g.value = !0;
|
|
905
905
|
try {
|
|
906
|
-
await
|
|
907
|
-
remark:
|
|
908
|
-
adjustments:
|
|
909
|
-
id:
|
|
910
|
-
amount:
|
|
911
|
-
measurement:
|
|
912
|
-
remark:
|
|
913
|
-
doc:
|
|
914
|
-
type:
|
|
906
|
+
await p.adjustSku({
|
|
907
|
+
remark: V.remark,
|
|
908
|
+
adjustments: V.adjustments.map(({ doc: j, remark: U, type: R, amount: T, measurement: q }) => ({
|
|
909
|
+
id: j._id,
|
|
910
|
+
amount: T,
|
|
911
|
+
measurement: q,
|
|
912
|
+
remark: U,
|
|
913
|
+
doc: j,
|
|
914
|
+
type: R
|
|
915
915
|
}))
|
|
916
916
|
}), S("update:show", !1), S("submitted");
|
|
917
|
-
} catch (
|
|
918
|
-
|
|
917
|
+
} catch (j) {
|
|
918
|
+
A.open({
|
|
919
919
|
title: r("inventory.stock.adjust.error.title"),
|
|
920
920
|
message: r("inventory.stock.adjust.error.message"),
|
|
921
921
|
type: "error"
|
|
922
|
-
}), console.log("error on adjust ingredients",
|
|
922
|
+
}), console.log("error on adjust ingredients", V, j);
|
|
923
923
|
} finally {
|
|
924
|
-
|
|
924
|
+
g.value = !1;
|
|
925
925
|
}
|
|
926
926
|
}
|
|
927
|
-
function
|
|
928
|
-
const
|
|
929
|
-
label:
|
|
930
|
-
sublabel:
|
|
931
|
-
value:
|
|
932
|
-
})),
|
|
933
|
-
|
|
927
|
+
function C() {
|
|
928
|
+
const V = _.skus.map((U) => ({
|
|
929
|
+
label: U.name,
|
|
930
|
+
sublabel: U.code,
|
|
931
|
+
value: U._id
|
|
932
|
+
})), j = V.filter((U) => k.adjustments.find((R) => R.doc._id === U.value)).map((U) => U.value);
|
|
933
|
+
m.open({
|
|
934
934
|
title: "Select ingredients",
|
|
935
935
|
contentComponent: yt,
|
|
936
936
|
contentComponentProps: {
|
|
937
|
-
items:
|
|
938
|
-
modelValue:
|
|
937
|
+
items: V,
|
|
938
|
+
modelValue: j
|
|
939
939
|
},
|
|
940
940
|
overlay: !0,
|
|
941
941
|
closeButton: !0,
|
|
@@ -949,12 +949,12 @@ const Be = {
|
|
|
949
949
|
close: !0,
|
|
950
950
|
variant: "tertiary"
|
|
951
951
|
}
|
|
952
|
-
}).onPrimary((
|
|
953
|
-
k.adjustments =
|
|
954
|
-
(
|
|
952
|
+
}).onPrimary((U) => {
|
|
953
|
+
k.adjustments = U.map(
|
|
954
|
+
(R) => k.adjustments.find((T) => T.doc._id === R) ?? {
|
|
955
955
|
id: `sku_${(/* @__PURE__ */ new Date()).toISOString()}_${Math.random().toString(16).slice(2, 8)}`,
|
|
956
|
-
type:
|
|
957
|
-
doc: _.skus.find((
|
|
956
|
+
type: oe.enum.PURCHASE,
|
|
957
|
+
doc: _.skus.find((T) => T._id === R),
|
|
958
958
|
measurement: null,
|
|
959
959
|
remark: "",
|
|
960
960
|
amount: fe(1)
|
|
@@ -962,62 +962,62 @@ const Be = {
|
|
|
962
962
|
);
|
|
963
963
|
});
|
|
964
964
|
}
|
|
965
|
-
function
|
|
966
|
-
k.adjustments.splice(
|
|
965
|
+
function H(V) {
|
|
966
|
+
k.adjustments.splice(V, 1);
|
|
967
967
|
}
|
|
968
|
-
return (
|
|
969
|
-
const
|
|
970
|
-
return
|
|
971
|
-
modelValue: l(
|
|
972
|
-
"onUpdate:modelValue":
|
|
968
|
+
return (V, j) => {
|
|
969
|
+
const U = B("FmTextarea"), R = B("FmButton"), T = B("FmForm"), q = B("FmSideSheet");
|
|
970
|
+
return w(), K(q, {
|
|
971
|
+
modelValue: l($),
|
|
972
|
+
"onUpdate:modelValue": j[2] || (j[2] = (J) => Te($) ? $.value = J : null),
|
|
973
973
|
"dismiss-away": "",
|
|
974
974
|
"max-width": 500
|
|
975
975
|
}, {
|
|
976
|
-
"side-sheet-header":
|
|
976
|
+
"side-sheet-header": D(() => [
|
|
977
977
|
n("div", pn, [
|
|
978
978
|
n("div", vn, h(l(r)("inventory.stock.adjust.title")), 1)
|
|
979
979
|
])
|
|
980
980
|
]),
|
|
981
|
-
default:
|
|
982
|
-
|
|
981
|
+
default: D(() => [
|
|
982
|
+
b(T, {
|
|
983
983
|
class: "w-full flex flex-col gap-12",
|
|
984
984
|
ref_key: "formRef",
|
|
985
985
|
ref: F,
|
|
986
986
|
onValidationSuccess: t
|
|
987
987
|
}, {
|
|
988
|
-
default:
|
|
989
|
-
|
|
988
|
+
default: D(() => [
|
|
989
|
+
b(U, {
|
|
990
990
|
label: l(r)("inventory.stock.adjust.remark"),
|
|
991
991
|
modelValue: k.remark,
|
|
992
|
-
"onUpdate:modelValue":
|
|
992
|
+
"onUpdate:modelValue": j[0] || (j[0] = (J) => k.remark = J)
|
|
993
993
|
}, null, 8, ["label", "modelValue"]),
|
|
994
994
|
n("div", fn, [
|
|
995
995
|
n("div", yn, h(l(r)("inventory.stock.adjust.adjustedItems")), 1),
|
|
996
|
-
|
|
996
|
+
b(R, {
|
|
997
997
|
"prepend-icon": "add",
|
|
998
998
|
variant: "tertiary",
|
|
999
999
|
size: "md",
|
|
1000
|
-
onClick:
|
|
1000
|
+
onClick: C
|
|
1001
1001
|
})
|
|
1002
1002
|
]),
|
|
1003
|
-
(
|
|
1004
|
-
key:
|
|
1005
|
-
modelValue: k.adjustments[
|
|
1006
|
-
"onUpdate:modelValue": (
|
|
1007
|
-
"onClick:delete": (
|
|
1003
|
+
(w(!0), E(se, null, ie(k.adjustments, (J, L) => (w(), K(mn, {
|
|
1004
|
+
key: J.id,
|
|
1005
|
+
modelValue: k.adjustments[L],
|
|
1006
|
+
"onUpdate:modelValue": (Z) => k.adjustments[L] = Z,
|
|
1007
|
+
"onClick:delete": (Z) => H(L)
|
|
1008
1008
|
}, null, 8, ["modelValue", "onUpdate:modelValue", "onClick:delete"]))), 128))
|
|
1009
1009
|
]),
|
|
1010
1010
|
_: 1
|
|
1011
1011
|
}, 512)
|
|
1012
1012
|
]),
|
|
1013
|
-
"side-sheet-footer":
|
|
1013
|
+
"side-sheet-footer": D(() => [
|
|
1014
1014
|
n("div", _n, [
|
|
1015
|
-
|
|
1015
|
+
b(R, {
|
|
1016
1016
|
label: l(r)("inventory.stock.adjust.adjustButton"),
|
|
1017
|
-
loading:
|
|
1018
|
-
onClick:
|
|
1019
|
-
var
|
|
1020
|
-
return (
|
|
1017
|
+
loading: g.value,
|
|
1018
|
+
onClick: j[1] || (j[1] = (J) => {
|
|
1019
|
+
var L, Z;
|
|
1020
|
+
return (Z = (L = F.value) == null ? void 0 : L.validateInputs) == null ? void 0 : Z.call(L);
|
|
1021
1021
|
})
|
|
1022
1022
|
}, null, 8, ["label", "loading"])
|
|
1023
1023
|
])
|
|
@@ -1028,25 +1028,25 @@ const Be = {
|
|
|
1028
1028
|
}
|
|
1029
1029
|
}), hn = _t((f, y) => ({
|
|
1030
1030
|
// TODO: remove once latest inventory backend has been push
|
|
1031
|
-
async findBillsByBusinessId(
|
|
1032
|
-
const _ = `${f.businessesBackendUrl}/${
|
|
1031
|
+
async findBillsByBusinessId(u, o, S) {
|
|
1032
|
+
const _ = `${f.businessesBackendUrl}/${u}/reports/find-many`, m = {
|
|
1033
1033
|
// type: TYPE.bill,
|
|
1034
1034
|
type: "bill",
|
|
1035
1035
|
restaurantIds: o,
|
|
1036
1036
|
ids: S
|
|
1037
1037
|
};
|
|
1038
|
-
return await y.post(_,
|
|
1038
|
+
return await y.post(_, m);
|
|
1039
1039
|
},
|
|
1040
|
-
async findBillsById(
|
|
1041
|
-
const S = pe().currentLocationDBName, _ = `${f.inventoryBackendUrl}/${S}/bill/search`,
|
|
1042
|
-
ids:
|
|
1040
|
+
async findBillsById(u) {
|
|
1041
|
+
const S = pe().currentLocationDBName, _ = `${f.inventoryBackendUrl}/${S}/bill/search`, m = {
|
|
1042
|
+
ids: u
|
|
1043
1043
|
};
|
|
1044
|
-
return await y.post(_,
|
|
1044
|
+
return await y.post(_, m);
|
|
1045
1045
|
}
|
|
1046
|
-
})),
|
|
1046
|
+
})), bn = { class: "p-16" }, gn = { class: "fm-typo-en-body-md-600 flex-grow" }, xn = { class: "flex-grow text-fm-color-typo-secondary" }, Sn = {
|
|
1047
1047
|
key: 0,
|
|
1048
1048
|
class: "my-5"
|
|
1049
|
-
}, Fn = { class: "text-neutral-400" }, wn = { class: "flex-grow" },
|
|
1049
|
+
}, Fn = { class: "text-neutral-400" }, wn = { class: "flex-grow" }, An = { class: "flex gap-1" }, $n = { class: "flex flex-col gap-1" }, Cn = {
|
|
1050
1050
|
key: 1,
|
|
1051
1051
|
class: "t-system text-fsecondary"
|
|
1052
1052
|
}, Vn = {
|
|
@@ -1055,7 +1055,7 @@ const Be = {
|
|
|
1055
1055
|
}, Bn = {
|
|
1056
1056
|
key: 0,
|
|
1057
1057
|
class: "shrink-0 text-fm-color-typo-secondary"
|
|
1058
|
-
}, Mn = /* @__PURE__ */
|
|
1058
|
+
}, Mn = /* @__PURE__ */ ue({
|
|
1059
1059
|
__name: "StockRecordCard",
|
|
1060
1060
|
props: {
|
|
1061
1061
|
record: {},
|
|
@@ -1063,54 +1063,54 @@ const Be = {
|
|
|
1063
1063
|
bills: { default: () => [] }
|
|
1064
1064
|
},
|
|
1065
1065
|
setup(f) {
|
|
1066
|
-
const y = f,
|
|
1067
|
-
|
|
1068
|
-
var
|
|
1069
|
-
S.value = ((
|
|
1066
|
+
const y = f, u = O(!1), o = O(), S = O(null), _ = P(() => S.value === null ? "unset" : u.value ? `${S.value}px` : "0px");
|
|
1067
|
+
Qe(() => {
|
|
1068
|
+
var g;
|
|
1069
|
+
S.value = ((g = o.value) == null ? void 0 : g.scrollHeight) || 0;
|
|
1070
1070
|
});
|
|
1071
|
-
const
|
|
1071
|
+
const m = P(() => {
|
|
1072
1072
|
var k;
|
|
1073
|
-
const
|
|
1074
|
-
var
|
|
1075
|
-
return ((
|
|
1073
|
+
const g = y.record.adjustments, r = y.sku, t = {}, $ = g.flatMap((a) => {
|
|
1074
|
+
var C;
|
|
1075
|
+
return ((C = a.skus) == null ? void 0 : C.filter((H) => H.sku._id === r._id)) ?? [];
|
|
1076
1076
|
}).flatMap((a) => a.amounts);
|
|
1077
|
-
for (const a of
|
|
1078
|
-
const
|
|
1079
|
-
t[k = a.type] ?? (t[k] = { amount: 0, precision: 0 }), t[a.type] =
|
|
1077
|
+
for (const a of $) {
|
|
1078
|
+
const C = a.measurement ? kt(a.measurement.conversion, a.amount) : a.amount;
|
|
1079
|
+
t[k = a.type] ?? (t[k] = { amount: 0, precision: 0 }), t[a.type] = Je(C, t[a.type]);
|
|
1080
1080
|
}
|
|
1081
1081
|
return Object.entries(t).reduce(
|
|
1082
|
-
(a, [
|
|
1082
|
+
(a, [C, H]) => (a[C] = /// comment, because without it formatter makes code uglier
|
|
1083
1083
|
`${Y.toFormatString({
|
|
1084
|
-
value:
|
|
1084
|
+
value: H,
|
|
1085
1085
|
precision: 4
|
|
1086
1086
|
})} ${r.unit.abbrev}`, a),
|
|
1087
1087
|
{}
|
|
1088
1088
|
);
|
|
1089
|
-
}), { t:
|
|
1090
|
-
time: ht(new Date(
|
|
1089
|
+
}), { t: p } = ce(), A = P(() => y.record.adjustmentsByTime.map(({ date: g, adjustments: r }) => ({
|
|
1090
|
+
time: ht(new Date(g)),
|
|
1091
1091
|
adjustments: r.flatMap(
|
|
1092
1092
|
(t) => {
|
|
1093
|
-
var F,
|
|
1094
|
-
return ((
|
|
1095
|
-
var a,
|
|
1093
|
+
var F, $;
|
|
1094
|
+
return (($ = (F = t.skus) == null ? void 0 : F.map) == null ? void 0 : $.call(F, (k) => {
|
|
1095
|
+
var a, C;
|
|
1096
1096
|
return {
|
|
1097
1097
|
...k,
|
|
1098
1098
|
ref: t.ref,
|
|
1099
|
-
backdateFrom: t.effectiveAt != null ?
|
|
1100
|
-
toBalance: (
|
|
1099
|
+
backdateFrom: t.effectiveAt != null ? tt(t._id) : null,
|
|
1100
|
+
toBalance: (C = (a = t.skus) == null ? void 0 : a[0]) == null ? void 0 : C.toBalance
|
|
1101
1101
|
};
|
|
1102
1102
|
})) ?? [];
|
|
1103
1103
|
}
|
|
1104
1104
|
).flatMap((t) => {
|
|
1105
1105
|
var k;
|
|
1106
|
-
const F = (k = y.bills.find((a) => a._id === t.ref)) == null ? void 0 : k.seqNumber,
|
|
1106
|
+
const F = (k = y.bills.find((a) => a._id === t.ref)) == null ? void 0 : k.seqNumber, $ = F ? p("inventory.stock.record.bill", [F]) : "";
|
|
1107
1107
|
return t.amounts.map((a) => {
|
|
1108
|
-
var
|
|
1108
|
+
var C;
|
|
1109
1109
|
return {
|
|
1110
|
-
amount: `${Y.toFormatString({ value: a.amount, precision: 4 })} ${((
|
|
1110
|
+
amount: `${Y.toFormatString({ value: a.amount, precision: 4 })} ${((C = a.measurement) == null ? void 0 : C.abbrev) ?? t.sku.unit.abbrev}`,
|
|
1111
1111
|
backdateFrom: t.backdateFrom,
|
|
1112
1112
|
name: a.type,
|
|
1113
|
-
remark: a.remark ||
|
|
1113
|
+
remark: a.remark || $ || "",
|
|
1114
1114
|
cost: a.cost,
|
|
1115
1115
|
toBalance: Y.toFormatString({
|
|
1116
1116
|
value: t.toBalance ?? Y.fromNumber(0),
|
|
@@ -1121,30 +1121,30 @@ const Be = {
|
|
|
1121
1121
|
});
|
|
1122
1122
|
})
|
|
1123
1123
|
})));
|
|
1124
|
-
return (
|
|
1125
|
-
const t =
|
|
1126
|
-
return
|
|
1127
|
-
default:
|
|
1128
|
-
n("div",
|
|
1124
|
+
return (g, r) => {
|
|
1125
|
+
const t = B("FmIcon"), F = B("FmTooltip"), $ = B("FmCard");
|
|
1126
|
+
return w(), K($, { variant: "outlined" }, {
|
|
1127
|
+
default: D(() => [
|
|
1128
|
+
n("div", bn, [
|
|
1129
1129
|
n("div", {
|
|
1130
1130
|
class: "flex items-center cursor-pointer mb-1",
|
|
1131
|
-
onClick: r[0] || (r[0] = (k) =>
|
|
1131
|
+
onClick: r[0] || (r[0] = (k) => u.value = !u.value)
|
|
1132
1132
|
}, [
|
|
1133
|
-
n("div",
|
|
1134
|
-
|
|
1135
|
-
name:
|
|
1133
|
+
n("div", gn, h(g.record.date), 1),
|
|
1134
|
+
b(t, {
|
|
1135
|
+
name: u.value ? "expand_more" : "expand_less",
|
|
1136
1136
|
color: "#777777",
|
|
1137
1137
|
size: "md"
|
|
1138
1138
|
}, null, 8, ["name"])
|
|
1139
1139
|
]),
|
|
1140
|
-
(
|
|
1140
|
+
(w(!0), E(se, null, ie(m.value, (k, a) => (w(), E("div", {
|
|
1141
1141
|
key: a,
|
|
1142
1142
|
class: "flex flex-row py-1",
|
|
1143
1143
|
style: { "font-size": "0.8rem" }
|
|
1144
1144
|
}, [
|
|
1145
|
-
n("div", xn, h(l(
|
|
1145
|
+
n("div", xn, h(l(p)(`inventory.inventoryAdjustment.type.${a}`)), 1),
|
|
1146
1146
|
n("div", {
|
|
1147
|
-
class:
|
|
1147
|
+
class: be({
|
|
1148
1148
|
"text-fm-color-typo-error": k.startsWith("-"),
|
|
1149
1149
|
"text-fm-color-typo-success": !k.startsWith("-"),
|
|
1150
1150
|
"ml-auto": !0
|
|
@@ -1154,57 +1154,57 @@ const Be = {
|
|
|
1154
1154
|
n("div", {
|
|
1155
1155
|
ref_key: "detailRef",
|
|
1156
1156
|
ref: o,
|
|
1157
|
-
style:
|
|
1157
|
+
style: Xe({
|
|
1158
1158
|
fontSize: "0.8rem",
|
|
1159
1159
|
maxHeight: _.value,
|
|
1160
1160
|
overflow: "hidden",
|
|
1161
1161
|
transition: "max-height 0.2s ease-out"
|
|
1162
1162
|
})
|
|
1163
1163
|
}, [
|
|
1164
|
-
|
|
1165
|
-
(
|
|
1164
|
+
A.value.length ? (w(), E("hr", Sn)) : ne("", !0),
|
|
1165
|
+
(w(!0), E(se, null, ie(A.value, (k) => (w(), E("div", {
|
|
1166
1166
|
key: k.time,
|
|
1167
1167
|
class: "flex gap-1 w-full"
|
|
1168
1168
|
}, [
|
|
1169
1169
|
n("div", Fn, h(k.time), 1),
|
|
1170
1170
|
n("div", wn, [
|
|
1171
|
-
(
|
|
1171
|
+
(w(!0), E(se, null, ie(k.adjustments, (a) => (w(), E("div", {
|
|
1172
1172
|
key: a.name,
|
|
1173
1173
|
class: "flex gap-1"
|
|
1174
1174
|
}, [
|
|
1175
|
-
n("div",
|
|
1176
|
-
|
|
1177
|
-
a.backdateFrom ? (
|
|
1175
|
+
n("div", An, [
|
|
1176
|
+
de(h(l(p)(`inventory.inventoryAdjustment.type.${a.name}`)) + " ", 1),
|
|
1177
|
+
a.backdateFrom ? (w(), K(F, {
|
|
1178
1178
|
key: 0,
|
|
1179
1179
|
variant: "plain",
|
|
1180
1180
|
placement: "top",
|
|
1181
1181
|
"z-index": 50
|
|
1182
1182
|
}, {
|
|
1183
|
-
content:
|
|
1184
|
-
n("div",
|
|
1185
|
-
l(
|
|
1183
|
+
content: D(() => [
|
|
1184
|
+
n("div", $n, h(l(p)("inventory.stock.record.backdate", [
|
|
1185
|
+
l(Ze)(new Date(a.backdateFrom))
|
|
1186
1186
|
])), 1)
|
|
1187
1187
|
]),
|
|
1188
|
-
default:
|
|
1189
|
-
|
|
1188
|
+
default: D(() => [
|
|
1189
|
+
b(t, {
|
|
1190
1190
|
name: "info",
|
|
1191
1191
|
size: "sm",
|
|
1192
1192
|
color: "primary"
|
|
1193
1193
|
})
|
|
1194
1194
|
]),
|
|
1195
1195
|
_: 2
|
|
1196
|
-
}, 1024)) :
|
|
1197
|
-
a.remark ? (
|
|
1198
|
-
a.name === l(
|
|
1196
|
+
}, 1024)) : ne("", !0),
|
|
1197
|
+
a.remark ? (w(), E("span", Cn, " # " + h(a.remark), 1)) : ne("", !0),
|
|
1198
|
+
a.name === l(oe).Enum.CLOSING ? (w(), E("span", Vn, " Actual Balance: " + h(a.toBalance) + " " + h(a.baseUnit), 1)) : ne("", !0)
|
|
1199
1199
|
]),
|
|
1200
1200
|
n("div", {
|
|
1201
|
-
class:
|
|
1201
|
+
class: be({
|
|
1202
1202
|
"text-fm-color-typo-error": a.amount.startsWith("-"),
|
|
1203
1203
|
"text-fm-color-typo-success": !a.amount.startsWith("-"),
|
|
1204
1204
|
"ml-auto": !0
|
|
1205
1205
|
})
|
|
1206
1206
|
}, h(a.amount), 3),
|
|
1207
|
-
a.cost ? (
|
|
1207
|
+
a.cost ? (w(), E("div", Bn, " (" + h(l(ke)(a.cost, !1, a.cost.precision)) + ") ", 1)) : ne("", !0)
|
|
1208
1208
|
]))), 128))
|
|
1209
1209
|
])
|
|
1210
1210
|
]))), 128))
|
|
@@ -1218,34 +1218,34 @@ const Be = {
|
|
|
1218
1218
|
});
|
|
1219
1219
|
function Dn(f, y) {
|
|
1220
1220
|
var _;
|
|
1221
|
-
const
|
|
1222
|
-
(
|
|
1221
|
+
const u = Object.keys(oe.enum).reduce(
|
|
1222
|
+
(m, p) => (m[p] = { amount: 0, precision: 0 }, m),
|
|
1223
1223
|
{}
|
|
1224
1224
|
);
|
|
1225
1225
|
if (!y)
|
|
1226
|
-
return Object.entries(
|
|
1227
|
-
(
|
|
1226
|
+
return Object.entries(u).reduce(
|
|
1227
|
+
(m, [p]) => (m[p] = Y.fromNumber(0), m),
|
|
1228
1228
|
{}
|
|
1229
1229
|
);
|
|
1230
|
-
const S = f.flatMap((
|
|
1231
|
-
var
|
|
1232
|
-
return ((
|
|
1233
|
-
}).flatMap((
|
|
1234
|
-
for (const
|
|
1235
|
-
const
|
|
1236
|
-
|
|
1230
|
+
const S = f.flatMap((m) => {
|
|
1231
|
+
var p;
|
|
1232
|
+
return ((p = m.skus) == null ? void 0 : p.filter((A) => A.sku._id === y._id)) ?? [];
|
|
1233
|
+
}).flatMap((m) => m.amounts);
|
|
1234
|
+
for (const m of S) {
|
|
1235
|
+
const p = m.measurement ? Y.multiply([m.measurement.conversion, m.amount]) : m.amount;
|
|
1236
|
+
u[_ = m.type] ?? (u[_] = { amount: 0, precision: 0 }), u[m.type] = Y.add([p, u[m.type]]);
|
|
1237
1237
|
}
|
|
1238
|
-
return Object.entries(
|
|
1239
|
-
(
|
|
1240
|
-
const
|
|
1241
|
-
...
|
|
1242
|
-
amount: Math.abs(
|
|
1238
|
+
return Object.entries(u).reduce(
|
|
1239
|
+
(m, [p, A]) => {
|
|
1240
|
+
const g = {
|
|
1241
|
+
...A,
|
|
1242
|
+
amount: Math.abs(A.amount)
|
|
1243
1243
|
};
|
|
1244
|
-
return
|
|
1244
|
+
return m[p] = /// comment, because without it formatter makes code uglier
|
|
1245
1245
|
`${Y.toFormatString({
|
|
1246
|
-
value:
|
|
1246
|
+
value: g,
|
|
1247
1247
|
precision: 4
|
|
1248
|
-
})} ${y.unit.abbrev}`,
|
|
1248
|
+
})} ${y.unit.abbrev}`, m;
|
|
1249
1249
|
},
|
|
1250
1250
|
{}
|
|
1251
1251
|
);
|
|
@@ -1253,25 +1253,25 @@ function Dn(f, y) {
|
|
|
1253
1253
|
function jn(f, y) {
|
|
1254
1254
|
if (!y)
|
|
1255
1255
|
return null;
|
|
1256
|
-
let
|
|
1256
|
+
let u = null;
|
|
1257
1257
|
const S = f.flatMap((_) => {
|
|
1258
|
-
var
|
|
1259
|
-
return ((
|
|
1258
|
+
var m;
|
|
1259
|
+
return ((m = _.skus) == null ? void 0 : m.filter((p) => p.sku._id === y._id)) ?? [];
|
|
1260
1260
|
}).flatMap((_) => {
|
|
1261
|
-
var
|
|
1262
|
-
return !_.history || ((
|
|
1261
|
+
var m;
|
|
1262
|
+
return !_.history || ((m = _.history) == null ? void 0 : m.length) === 0 ? [] : _.history[0];
|
|
1263
1263
|
});
|
|
1264
1264
|
for (const _ of S) {
|
|
1265
|
-
const
|
|
1266
|
-
for (const
|
|
1267
|
-
if (
|
|
1265
|
+
const m = _.amounts;
|
|
1266
|
+
for (const p of m) {
|
|
1267
|
+
if (p.type !== oe.Enum.SALES)
|
|
1268
1268
|
continue;
|
|
1269
|
-
const
|
|
1270
|
-
|
|
1269
|
+
const A = p.measurement ? Y.multiply([p.measurement.conversion, p.amount]) : p.amount;
|
|
1270
|
+
u ?? (u = Y.fromNumber(0)), u = Y.add([u, A]);
|
|
1271
1271
|
}
|
|
1272
1272
|
}
|
|
1273
|
-
return
|
|
1274
|
-
value:
|
|
1273
|
+
return u != null ? (u.amount = Math.abs(u.amount), `${Y.toFormatString({
|
|
1274
|
+
value: u,
|
|
1275
1275
|
precision: 4
|
|
1276
1276
|
})} ${y.unit.abbrev}`) : null;
|
|
1277
1277
|
}
|
|
@@ -1287,10 +1287,10 @@ const In = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Tn = {
|
|
|
1287
1287
|
}, Yn = { class: "flex flex-col gap-1" }, Kn = { class: "text-fm-color-typo-secondary" }, Gn = { class: "font-bold" }, Wn = { class: "flex flex-col gap-1" }, qn = { class: "text-fm-color-typo-secondary flex" }, Qn = { class: "font-bold" }, Xn = { class: "flex flex-col gap-1" }, Jn = { class: "text-fm-color-typo-secondary" }, Zn = { class: "font-bold" }, eo = { class: "flex flex-col gap-1" }, to = { class: "text-fm-color-typo-secondary" }, no = { class: "font-bold" }, oo = { class: "flex flex-col gap-1" }, so = { class: "text-fm-color-typo-secondary" }, ao = { class: "font-bold" }, ro = { class: "flex flex-col gap-1" }, lo = { class: "text-fm-color-typo-secondary" }, io = { class: "font-bold" }, uo = { class: "flex flex-col gap-1" }, co = { class: "text-fm-color-typo-secondary" }, mo = { class: "font-bold" }, po = { class: "flex flex-col gap-1" }, vo = { class: "text-fm-color-typo-secondary" }, fo = { class: "font-bold" }, yo = { class: "flex flex-col gap-1" }, _o = { class: "text-fm-color-typo-secondary" }, ko = { class: "font-bold" }, ho = {
|
|
1288
1288
|
key: 0,
|
|
1289
1289
|
class: "flex flex-col gap-8"
|
|
1290
|
-
},
|
|
1290
|
+
}, bo = { class: "flex" }, go = { class: "flex-1 flex flex-col gap-1" }, xo = { class: "flex gap-1 items-center text-fm-color-typo-secondary" }, So = { class: "font-bold" }, Fo = { class: "flex-1 flex flex-col gap-1" }, wo = { class: "flex gap-1 items-center text-fm-color-typo-secondary" }, Ao = { class: "flex flex-col gap-1" }, $o = { class: "font-bold" }, Co = {
|
|
1291
1291
|
key: 2,
|
|
1292
1292
|
class: "flex-1 flex flex-col items-center gap-8"
|
|
1293
|
-
}, Vo = ["src"], Bo = { class: "font-bold text-lg" }, Mo = { class: "text-xs text-neutral-400 text-center" }, Do = /* @__PURE__ */
|
|
1293
|
+
}, Vo = ["src"], Bo = { class: "font-bold text-lg" }, Mo = { class: "text-xs text-neutral-400 text-center" }, Do = /* @__PURE__ */ ue({
|
|
1294
1294
|
__name: "StockHistory",
|
|
1295
1295
|
props: {
|
|
1296
1296
|
sku: {},
|
|
@@ -1298,208 +1298,208 @@ const In = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Tn = {
|
|
|
1298
1298
|
},
|
|
1299
1299
|
emits: ["update:show"],
|
|
1300
1300
|
setup(f) {
|
|
1301
|
-
const y = Tt(),
|
|
1301
|
+
const y = Tt(), u = Ee(), o = we(), S = hn(), _ = pe(), m = St(), { t: p } = ce(), A = f, g = O(!1), r = ye(), t = O(bt(0));
|
|
1302
1302
|
async function F() {
|
|
1303
|
-
|
|
1303
|
+
g.value = !0;
|
|
1304
1304
|
try {
|
|
1305
|
-
await
|
|
1305
|
+
await V(), await u.readStockBalance();
|
|
1306
1306
|
} catch (e) {
|
|
1307
1307
|
r.open({
|
|
1308
1308
|
title: "Something went wrong",
|
|
1309
1309
|
message: "Cannot fetch stock history. Please try again.",
|
|
1310
1310
|
type: "error"
|
|
1311
|
-
}), console.log("failed at fetching item adjustment history",
|
|
1311
|
+
}), console.log("failed at fetching item adjustment history", A.sku, t, e);
|
|
1312
1312
|
} finally {
|
|
1313
|
-
|
|
1313
|
+
g.value = !1;
|
|
1314
1314
|
}
|
|
1315
1315
|
}
|
|
1316
|
-
|
|
1316
|
+
Qe(() => {
|
|
1317
1317
|
F();
|
|
1318
|
-
}),
|
|
1318
|
+
}), ge([() => t.value, () => A.sku], () => {
|
|
1319
1319
|
F();
|
|
1320
1320
|
});
|
|
1321
|
-
const
|
|
1322
|
-
function
|
|
1323
|
-
return s === "day" ? Ct(e) :
|
|
1321
|
+
const $ = O([]), k = O([]), a = O(new Array());
|
|
1322
|
+
function C(e, s) {
|
|
1323
|
+
return s === "day" ? Ct(e) : Ze(e);
|
|
1324
1324
|
}
|
|
1325
|
-
function
|
|
1325
|
+
function H(e, s) {
|
|
1326
1326
|
const v = e.reduce(
|
|
1327
|
-
(
|
|
1328
|
-
const
|
|
1329
|
-
if (!
|
|
1330
|
-
return
|
|
1331
|
-
const I =
|
|
1332
|
-
return
|
|
1327
|
+
(i, d) => {
|
|
1328
|
+
const x = d.effectiveAt ?? tt(d._id);
|
|
1329
|
+
if (!x)
|
|
1330
|
+
return i;
|
|
1331
|
+
const I = C(new Date(x), s);
|
|
1332
|
+
return i[I] ?? (i[I] = []), i[I].push(d), i;
|
|
1333
1333
|
},
|
|
1334
1334
|
{}
|
|
1335
1335
|
);
|
|
1336
|
-
return Object.keys(v).map((
|
|
1337
|
-
date:
|
|
1338
|
-
adjustments: v[
|
|
1336
|
+
return Object.keys(v).map((i) => ({
|
|
1337
|
+
date: i,
|
|
1338
|
+
adjustments: v[i]
|
|
1339
1339
|
}));
|
|
1340
1340
|
}
|
|
1341
|
-
async function
|
|
1341
|
+
async function V() {
|
|
1342
1342
|
let e = await o.readStockAdjustment(
|
|
1343
|
-
|
|
1343
|
+
A.sku._id,
|
|
1344
1344
|
Ft(new Date(t.value.startDate)).toISOString(),
|
|
1345
1345
|
wt(new Date(t.value.endDate)).toISOString()
|
|
1346
1346
|
);
|
|
1347
|
-
|
|
1347
|
+
$.value = e;
|
|
1348
1348
|
const s = e.filter(({ ref: v }) => v == null ? void 0 : v.startsWith("bill_")).map(({ ref: v }) => v);
|
|
1349
|
-
await
|
|
1349
|
+
await j(s), k.value = H(e, "day").map(({ date: v, adjustments: i }) => ({
|
|
1350
1350
|
date: v,
|
|
1351
|
-
adjustments:
|
|
1352
|
-
adjustmentsByTime:
|
|
1351
|
+
adjustments: i,
|
|
1352
|
+
adjustmentsByTime: H(i, "minute")
|
|
1353
1353
|
}));
|
|
1354
1354
|
}
|
|
1355
|
-
async function
|
|
1355
|
+
async function j(e) {
|
|
1356
1356
|
e.length && (a.value = await S.findBillsById(e).catch((s) => {
|
|
1357
1357
|
var d;
|
|
1358
1358
|
console.error("Error on using latest bill API, retrying using legacy api", s);
|
|
1359
|
-
const v = ((d = y.currentBusiness.value) == null ? void 0 : d._id) ?? "",
|
|
1360
|
-
return S.findBillsByBusinessId(v, [
|
|
1359
|
+
const v = ((d = y.currentBusiness.value) == null ? void 0 : d._id) ?? "", i = _.currentLocation.doc._id;
|
|
1360
|
+
return S.findBillsByBusinessId(v, [i], e);
|
|
1361
1361
|
}));
|
|
1362
1362
|
}
|
|
1363
|
-
const
|
|
1364
|
-
const e =
|
|
1363
|
+
const U = P(() => {
|
|
1364
|
+
const e = $.value, s = A.sku;
|
|
1365
1365
|
return Dn(e, s);
|
|
1366
|
-
}),
|
|
1367
|
-
const e =
|
|
1366
|
+
}), R = P(() => {
|
|
1367
|
+
const e = $.value, s = A.sku;
|
|
1368
1368
|
return jn(e, s);
|
|
1369
|
-
}),
|
|
1370
|
-
const e = [
|
|
1371
|
-
var d,
|
|
1372
|
-
const
|
|
1373
|
-
return
|
|
1369
|
+
}), T = P(() => {
|
|
1370
|
+
const e = [...$.value].computeFirst((v) => {
|
|
1371
|
+
var d, x;
|
|
1372
|
+
const i = (x = (d = v.skus) == null ? void 0 : d.find) == null ? void 0 : x.call(d, (I) => I.sku._id === A.sku._id);
|
|
1373
|
+
return i == null ? void 0 : i.fromBalance;
|
|
1374
1374
|
}) ?? {
|
|
1375
1375
|
amount: 0,
|
|
1376
1376
|
precision: 0
|
|
1377
|
-
}, s =
|
|
1377
|
+
}, s = A.sku;
|
|
1378
1378
|
return s ? `${Y.toFormatString({
|
|
1379
1379
|
value: e,
|
|
1380
1380
|
precision: 4
|
|
1381
1381
|
})} ${s.unit.abbrev}` : "";
|
|
1382
|
-
}),
|
|
1383
|
-
const e = [
|
|
1384
|
-
var d,
|
|
1385
|
-
const
|
|
1386
|
-
return
|
|
1382
|
+
}), q = P(() => {
|
|
1383
|
+
const e = [...$.value].reverse().computeFirst((v) => {
|
|
1384
|
+
var d, x;
|
|
1385
|
+
const i = (x = (d = v.skus) == null ? void 0 : d.find) == null ? void 0 : x.call(d, (I) => I.sku._id === A.sku._id);
|
|
1386
|
+
return i == null ? void 0 : i.toBalance;
|
|
1387
1387
|
}) ?? {
|
|
1388
1388
|
amount: 0,
|
|
1389
1389
|
precision: 0
|
|
1390
|
-
}, s =
|
|
1390
|
+
}, s = A.sku;
|
|
1391
1391
|
return s ? `${Y.toFormatString({ value: e, precision: 4 })} ${s.unit.abbrev}` : "";
|
|
1392
|
-
}),
|
|
1392
|
+
}), J = P(() => {
|
|
1393
1393
|
var v;
|
|
1394
|
-
const s =
|
|
1394
|
+
const s = $.value.flatMap((i) => {
|
|
1395
1395
|
var d;
|
|
1396
|
-
return ((d =
|
|
1397
|
-
}).filter((
|
|
1398
|
-
(
|
|
1399
|
-
const
|
|
1400
|
-
if (!
|
|
1396
|
+
return ((d = i.skus) == null ? void 0 : d.flatMap((x) => x.amounts)) ?? [];
|
|
1397
|
+
}).filter((i) => i.amount.amount < 0).reduce(
|
|
1398
|
+
(i, d) => {
|
|
1399
|
+
const x = d.cost;
|
|
1400
|
+
if (!x) return i;
|
|
1401
1401
|
const I = {
|
|
1402
|
-
...
|
|
1403
|
-
currency:
|
|
1402
|
+
...gt(i, Math.max(i.precision, x.precision)),
|
|
1403
|
+
currency: x.currency
|
|
1404
1404
|
};
|
|
1405
1405
|
return {
|
|
1406
|
-
...
|
|
1407
|
-
currency:
|
|
1406
|
+
...Je(I, x),
|
|
1407
|
+
currency: i.currency
|
|
1408
1408
|
};
|
|
1409
1409
|
},
|
|
1410
1410
|
{
|
|
1411
1411
|
amount: 0,
|
|
1412
1412
|
precision: 0,
|
|
1413
|
-
currency:
|
|
1413
|
+
currency: Ce((v = y.currentCountry) == null ? void 0 : v.value)
|
|
1414
1414
|
}
|
|
1415
1415
|
);
|
|
1416
1416
|
return ke(s, !1, s.precision);
|
|
1417
1417
|
});
|
|
1418
|
-
function
|
|
1419
|
-
const { startDate: e, endDate: s } =
|
|
1418
|
+
function L() {
|
|
1419
|
+
const { startDate: e, endDate: s } = At(t.value);
|
|
1420
1420
|
e !== null && s !== null && (t.value = {
|
|
1421
1421
|
startDate: e,
|
|
1422
1422
|
endDate: s
|
|
1423
1423
|
});
|
|
1424
1424
|
}
|
|
1425
|
-
const
|
|
1426
|
-
var I,
|
|
1427
|
-
const e = [
|
|
1428
|
-
var W,
|
|
1429
|
-
return (
|
|
1425
|
+
const Z = P(() => A.sku.valuation === Ye.Enum.FIFO ? p("inventory.ingredient.valuationMethod.FIFO") : p("inventory.ingredient.valuationMethod.WAVG")), ee = P(() => {
|
|
1426
|
+
var I, N, Q, M;
|
|
1427
|
+
const e = [...$.value].reverse().computeFirst((z) => {
|
|
1428
|
+
var W, re;
|
|
1429
|
+
return (re = (W = z.skus) == null ? void 0 : W.find) == null ? void 0 : re.call(W, (le) => le.sku._id === A.sku._id);
|
|
1430
1430
|
});
|
|
1431
1431
|
if (!e) return "No data";
|
|
1432
1432
|
const s = [...e.amounts].reverse()[0], v = {
|
|
1433
1433
|
amount: ((I = s.cost) == null ? void 0 : I.amount) ?? 0,
|
|
1434
|
-
precision: ((
|
|
1435
|
-
},
|
|
1434
|
+
precision: ((N = s.cost) == null ? void 0 : N.precision) ?? 0
|
|
1435
|
+
}, i = s.amount, d = i.amount == 0 ? Y.fromNumber(0) : Y.divide([v, i]);
|
|
1436
1436
|
return {
|
|
1437
|
-
...Y.multiply([d,
|
|
1438
|
-
currency: ((
|
|
1437
|
+
...Y.multiply([d, i]),
|
|
1438
|
+
currency: ((Q = s.cost) == null ? void 0 : Q.currency) || Ce(((M = y.currentCountry) == null ? void 0 : M.value) ?? xt)
|
|
1439
1439
|
};
|
|
1440
|
-
}),
|
|
1440
|
+
}), te = P(() => {
|
|
1441
1441
|
var v;
|
|
1442
|
-
const e = [
|
|
1443
|
-
var
|
|
1444
|
-
const d = (I = (
|
|
1442
|
+
const e = [...$.value].reverse().computeFirst((i) => {
|
|
1443
|
+
var x, I;
|
|
1444
|
+
const d = (I = (x = i.skus) == null ? void 0 : x.find) == null ? void 0 : I.call(x, (N) => N.sku._id === A.sku._id);
|
|
1445
1445
|
return d == null ? void 0 : d.toCostBalances;
|
|
1446
1446
|
});
|
|
1447
1447
|
return e ? {
|
|
1448
|
-
...e.reduce((
|
|
1448
|
+
...e.reduce((i, d) => Y.add([i, Y.fromDinero(d.cost)]), {
|
|
1449
1449
|
amount: 0,
|
|
1450
1450
|
precision: 0
|
|
1451
1451
|
}),
|
|
1452
|
-
currency:
|
|
1452
|
+
currency: Ce((v = y.currentCountry) == null ? void 0 : v.value)
|
|
1453
1453
|
} : "No data";
|
|
1454
1454
|
});
|
|
1455
|
-
function
|
|
1456
|
-
const { startDate: e, endDate: s } =
|
|
1455
|
+
function G() {
|
|
1456
|
+
const { startDate: e, endDate: s } = $t(t.value);
|
|
1457
1457
|
e !== null && s !== null && (t.value = {
|
|
1458
1458
|
startDate: e,
|
|
1459
1459
|
endDate: s
|
|
1460
1460
|
});
|
|
1461
1461
|
}
|
|
1462
|
-
const
|
|
1462
|
+
const c = Re(A, "show");
|
|
1463
1463
|
return (e, s) => {
|
|
1464
|
-
const v =
|
|
1465
|
-
return
|
|
1464
|
+
const v = B("FmButton"), i = B("FmField"), d = B("FmDateRangePicker"), x = B("FmSpacer"), I = B("FmCircularProgress"), N = B("FmIcon"), Q = B("FmTooltip"), M = B("FmMenuDivider"), z = B("FmChip"), W = B("FmCardSection"), re = B("FmCard"), le = B("FmSideSheet");
|
|
1465
|
+
return w(), K(le, {
|
|
1466
1466
|
"dismiss-away": "",
|
|
1467
|
-
modelValue: l(
|
|
1468
|
-
"onUpdate:modelValue": s[4] || (s[4] = (X) =>
|
|
1467
|
+
modelValue: l(c),
|
|
1468
|
+
"onUpdate:modelValue": s[4] || (s[4] = (X) => Te(c) ? c.value = X : null),
|
|
1469
1469
|
"close-button": !1,
|
|
1470
1470
|
"max-width": 560
|
|
1471
1471
|
}, {
|
|
1472
|
-
"side-sheet-header":
|
|
1472
|
+
"side-sheet-header": D(() => [
|
|
1473
1473
|
n("div", In, [
|
|
1474
|
-
n("div", Tn, h(l(
|
|
1475
|
-
|
|
1474
|
+
n("div", Tn, h(l(p)("inventory.stock.history.title", [e.sku.name])), 1),
|
|
1475
|
+
b(v, {
|
|
1476
1476
|
variant: "tertiary",
|
|
1477
1477
|
"prepend-icon": "close",
|
|
1478
|
-
onClick: s[0] || (s[0] = (X) =>
|
|
1478
|
+
onClick: s[0] || (s[0] = (X) => c.value = !1)
|
|
1479
1479
|
})
|
|
1480
1480
|
])
|
|
1481
1481
|
]),
|
|
1482
|
-
default:
|
|
1482
|
+
default: D(() => {
|
|
1483
1483
|
var X;
|
|
1484
1484
|
return [
|
|
1485
1485
|
n("div", Un, [
|
|
1486
1486
|
n("div", Pn, [
|
|
1487
1487
|
n("div", En, [
|
|
1488
|
-
|
|
1488
|
+
b(d, {
|
|
1489
1489
|
modelValue: t.value,
|
|
1490
|
-
"onUpdate:modelValue": s[1] || (s[1] = (
|
|
1490
|
+
"onUpdate:modelValue": s[1] || (s[1] = (ae) => t.value = ae),
|
|
1491
1491
|
"show-predefined-range": "",
|
|
1492
1492
|
"start-label": "",
|
|
1493
1493
|
"end-label": "",
|
|
1494
1494
|
"z-index": 50
|
|
1495
1495
|
}, {
|
|
1496
|
-
"trigger-button":
|
|
1497
|
-
|
|
1496
|
+
"trigger-button": D(({ opened: ae }) => [
|
|
1497
|
+
b(i, {
|
|
1498
1498
|
"prepend-icon": "calendar_month",
|
|
1499
|
-
focused:
|
|
1499
|
+
focused: ae
|
|
1500
1500
|
}, {
|
|
1501
|
-
default:
|
|
1502
|
-
|
|
1501
|
+
default: D(() => [
|
|
1502
|
+
de(h(t.value.startDate) + " - " + h(t.value.endDate), 1)
|
|
1503
1503
|
]),
|
|
1504
1504
|
_: 2
|
|
1505
1505
|
}, 1032, ["focused"])
|
|
@@ -1507,102 +1507,102 @@ const In = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Tn = {
|
|
|
1507
1507
|
_: 1
|
|
1508
1508
|
}, 8, ["modelValue"])
|
|
1509
1509
|
]),
|
|
1510
|
-
|
|
1510
|
+
b(v, {
|
|
1511
1511
|
variant: "tertiary",
|
|
1512
|
-
onClick: s[2] || (s[2] = (
|
|
1512
|
+
onClick: s[2] || (s[2] = (ae) => L()),
|
|
1513
1513
|
"prepend-icon": "navigate_before"
|
|
1514
1514
|
}),
|
|
1515
|
-
|
|
1515
|
+
b(v, {
|
|
1516
1516
|
variant: "tertiary",
|
|
1517
|
-
onClick: s[3] || (s[3] = (
|
|
1517
|
+
onClick: s[3] || (s[3] = (ae) => G()),
|
|
1518
1518
|
"prepend-icon": "navigate_next"
|
|
1519
1519
|
})
|
|
1520
1520
|
]),
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
n("div", Rn, h(l(
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
])) : k.value && ((X = k.value) == null ? void 0 : X.length) > 0 ? (
|
|
1528
|
-
|
|
1529
|
-
default:
|
|
1530
|
-
|
|
1531
|
-
default:
|
|
1521
|
+
g.value ? (w(), E("div", Hn, [
|
|
1522
|
+
b(x),
|
|
1523
|
+
b(I, { size: "xl" }),
|
|
1524
|
+
n("div", Rn, h(l(p)("inventory.stock.history.loading")), 1),
|
|
1525
|
+
b(x),
|
|
1526
|
+
b(x)
|
|
1527
|
+
])) : k.value && ((X = k.value) == null ? void 0 : X.length) > 0 ? (w(), E("div", On, [
|
|
1528
|
+
b(re, { variant: "outlined" }, {
|
|
1529
|
+
default: D(() => [
|
|
1530
|
+
b(W, { class: "flex flex-col gap-4" }, {
|
|
1531
|
+
default: D(() => [
|
|
1532
1532
|
n("div", Ln, [
|
|
1533
|
-
n("div", Nn, h(l(
|
|
1533
|
+
n("div", Nn, h(l(p)("inventory.stock.history.summary.title")), 1)
|
|
1534
1534
|
]),
|
|
1535
1535
|
n("div", zn, [
|
|
1536
1536
|
n("div", Yn, [
|
|
1537
|
-
n("div", Kn, h(l(
|
|
1538
|
-
n("div", Gn, h(
|
|
1537
|
+
n("div", Kn, h(l(p)("inventory.stock.history.summary.totalPurchase")), 1),
|
|
1538
|
+
n("div", Gn, h(U.value.PURCHASE), 1)
|
|
1539
1539
|
]),
|
|
1540
1540
|
n("div", Wn, [
|
|
1541
1541
|
n("div", qn, [
|
|
1542
|
-
|
|
1543
|
-
|
|
1542
|
+
de(h(l(p)("inventory.stock.history.summary.totalSales")) + " ", 1),
|
|
1543
|
+
R.value != null ? (w(), K(Q, {
|
|
1544
1544
|
key: 0,
|
|
1545
1545
|
variant: "plain",
|
|
1546
1546
|
placement: "top",
|
|
1547
|
-
content: `Before: ${
|
|
1547
|
+
content: `Before: ${R.value}`,
|
|
1548
1548
|
"z-index": 50
|
|
1549
1549
|
}, {
|
|
1550
|
-
default:
|
|
1551
|
-
|
|
1550
|
+
default: D(() => [
|
|
1551
|
+
b(N, {
|
|
1552
1552
|
name: "warning",
|
|
1553
1553
|
size: "sm"
|
|
1554
1554
|
})
|
|
1555
1555
|
]),
|
|
1556
1556
|
_: 1
|
|
1557
|
-
}, 8, ["content"])) :
|
|
1557
|
+
}, 8, ["content"])) : ne("", !0)
|
|
1558
1558
|
]),
|
|
1559
|
-
n("div", Qn, h(
|
|
1559
|
+
n("div", Qn, h(U.value.SALES), 1)
|
|
1560
1560
|
]),
|
|
1561
1561
|
n("div", Xn, [
|
|
1562
|
-
n("div", Jn, h(l(
|
|
1563
|
-
n("div", Zn, h(
|
|
1562
|
+
n("div", Jn, h(l(p)("inventory.stock.history.summary.totalLose")), 1),
|
|
1563
|
+
n("div", Zn, h(U.value.LOSE), 1)
|
|
1564
1564
|
]),
|
|
1565
1565
|
n("div", eo, [
|
|
1566
|
-
n("div", to, h(l(
|
|
1567
|
-
n("div", no, h(
|
|
1566
|
+
n("div", to, h(l(p)("inventory.stock.history.summary.totalRequest")), 1),
|
|
1567
|
+
n("div", no, h(U.value.REQUEST), 1)
|
|
1568
1568
|
]),
|
|
1569
1569
|
n("div", oo, [
|
|
1570
|
-
n("div", so, h(l(
|
|
1571
|
-
n("div", ao, h(
|
|
1570
|
+
n("div", so, h(l(p)("inventory.stock.history.summary.totalReceive")), 1),
|
|
1571
|
+
n("div", ao, h(U.value.RECEIVE), 1)
|
|
1572
1572
|
]),
|
|
1573
1573
|
n("div", ro, [
|
|
1574
|
-
n("div", lo, h(l(
|
|
1575
|
-
n("div", io, h(
|
|
1574
|
+
n("div", lo, h(l(p)("inventory.stock.history.summary.totalConvert")), 1),
|
|
1575
|
+
n("div", io, h(U.value.CONVERT), 1)
|
|
1576
1576
|
]),
|
|
1577
1577
|
n("div", uo, [
|
|
1578
|
-
n("div", co, h(l(
|
|
1579
|
-
n("div", mo, h(
|
|
1578
|
+
n("div", co, h(l(p)("inventory.stock.history.summary.totalDamage")), 1),
|
|
1579
|
+
n("div", mo, h(U.value.DAMAGE), 1)
|
|
1580
1580
|
]),
|
|
1581
1581
|
n("div", po, [
|
|
1582
|
-
n("div", vo, h(l(
|
|
1583
|
-
n("div", fo, h(
|
|
1582
|
+
n("div", vo, h(l(p)("inventory.stock.history.summary.openingBalance")), 1),
|
|
1583
|
+
n("div", fo, h(T.value), 1)
|
|
1584
1584
|
]),
|
|
1585
1585
|
n("div", yo, [
|
|
1586
|
-
n("div", _o, h(l(
|
|
1587
|
-
n("div", ko, h(
|
|
1586
|
+
n("div", _o, h(l(p)("inventory.stock.history.summary.lastStockBalance")), 1),
|
|
1587
|
+
n("div", ko, h(q.value), 1)
|
|
1588
1588
|
])
|
|
1589
1589
|
]),
|
|
1590
|
-
l(
|
|
1591
|
-
|
|
1592
|
-
n("div",
|
|
1593
|
-
n("div",
|
|
1594
|
-
|
|
1595
|
-
default:
|
|
1590
|
+
l(m).enableTotalCost ? (w(), E("div", ho, [
|
|
1591
|
+
b(M, { class: "w-full" }),
|
|
1592
|
+
n("div", bo, [
|
|
1593
|
+
n("div", go, [
|
|
1594
|
+
b(Ge, { "z-index": 50 }, {
|
|
1595
|
+
default: D(() => [
|
|
1596
1596
|
n("div", xo, [
|
|
1597
|
-
|
|
1598
|
-
|
|
1597
|
+
de(h(l(p)("inventory.stock.history.estimatedValue")) + " ", 1),
|
|
1598
|
+
b(Q, {
|
|
1599
1599
|
variant: "plain",
|
|
1600
1600
|
placement: "top",
|
|
1601
|
-
content: `[${
|
|
1601
|
+
content: `[${Z.value}] ${l(p)("inventory.stock.history.estimatedValueTooltip")}`,
|
|
1602
1602
|
"z-index": 50
|
|
1603
1603
|
}, {
|
|
1604
|
-
default:
|
|
1605
|
-
|
|
1604
|
+
default: D(() => [
|
|
1605
|
+
b(N, {
|
|
1606
1606
|
name: "help",
|
|
1607
1607
|
size: "sm"
|
|
1608
1608
|
})
|
|
@@ -1614,40 +1614,40 @@ const In = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Tn = {
|
|
|
1614
1614
|
_: 1
|
|
1615
1615
|
}),
|
|
1616
1616
|
n("div", So, [
|
|
1617
|
-
e.sku.valuation === l(
|
|
1618
|
-
|
|
1617
|
+
e.sku.valuation === l(Ye).Enum.FIFO ? (w(), E(se, { key: 0 }, [
|
|
1618
|
+
b(z, {
|
|
1619
1619
|
label: "FIFO",
|
|
1620
1620
|
compact: ""
|
|
1621
1621
|
}),
|
|
1622
|
-
|
|
1623
|
-
|
|
1622
|
+
de(" " + h(typeof te.value != "string" ? l(ke)(
|
|
1623
|
+
te.value,
|
|
1624
1624
|
!1,
|
|
1625
|
-
|
|
1626
|
-
) :
|
|
1627
|
-
], 64)) : (
|
|
1628
|
-
|
|
1629
|
-
|
|
1625
|
+
te.value.precision
|
|
1626
|
+
) : te.value), 1)
|
|
1627
|
+
], 64)) : (w(), E(se, { key: 1 }, [
|
|
1628
|
+
de(h(typeof ee.value != "string" ? l(ke)(
|
|
1629
|
+
ee.value,
|
|
1630
1630
|
!1,
|
|
1631
|
-
|
|
1632
|
-
) :
|
|
1631
|
+
ee.value.precision
|
|
1632
|
+
) : ee.value), 1)
|
|
1633
1633
|
], 64))
|
|
1634
1634
|
])
|
|
1635
1635
|
]),
|
|
1636
1636
|
n("div", Fo, [
|
|
1637
|
-
|
|
1638
|
-
default:
|
|
1637
|
+
b(Ge, { "z-index": 50 }, {
|
|
1638
|
+
default: D(() => [
|
|
1639
1639
|
n("div", wo, [
|
|
1640
|
-
|
|
1641
|
-
|
|
1640
|
+
de(h(l(p)("inventory.stock.history.costSold")) + " ", 1),
|
|
1641
|
+
b(Q, {
|
|
1642
1642
|
variant: "plain",
|
|
1643
1643
|
placement: "top",
|
|
1644
1644
|
"z-index": 50
|
|
1645
1645
|
}, {
|
|
1646
|
-
content:
|
|
1647
|
-
n("div",
|
|
1646
|
+
content: D(() => [
|
|
1647
|
+
n("div", Ao, h(l(p)("inventory.stock.history.costSoldTooltip")), 1)
|
|
1648
1648
|
]),
|
|
1649
|
-
default:
|
|
1650
|
-
|
|
1649
|
+
default: D(() => [
|
|
1650
|
+
b(N, {
|
|
1651
1651
|
name: "help",
|
|
1652
1652
|
size: "sm"
|
|
1653
1653
|
})
|
|
@@ -1658,10 +1658,10 @@ const In = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Tn = {
|
|
|
1658
1658
|
]),
|
|
1659
1659
|
_: 1
|
|
1660
1660
|
}),
|
|
1661
|
-
n("div",
|
|
1661
|
+
n("div", $o, h(J.value), 1)
|
|
1662
1662
|
])
|
|
1663
1663
|
])
|
|
1664
|
-
])) :
|
|
1664
|
+
])) : ne("", !0)
|
|
1665
1665
|
]),
|
|
1666
1666
|
_: 1
|
|
1667
1667
|
})
|
|
@@ -1669,28 +1669,28 @@ const In = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Tn = {
|
|
|
1669
1669
|
_: 1
|
|
1670
1670
|
}),
|
|
1671
1671
|
s[5] || (s[5] = n("div", null, null, -1)),
|
|
1672
|
-
(
|
|
1673
|
-
key:
|
|
1672
|
+
(w(!0), E(se, null, ie(k.value, (ae) => (w(), E(se, {
|
|
1673
|
+
key: ae.date
|
|
1674
1674
|
}, [
|
|
1675
|
-
e.sku ? (
|
|
1675
|
+
e.sku ? (w(), K(Mn, {
|
|
1676
1676
|
key: 0,
|
|
1677
|
-
record:
|
|
1677
|
+
record: ae,
|
|
1678
1678
|
sku: e.sku,
|
|
1679
1679
|
bills: a.value
|
|
1680
|
-
}, null, 8, ["record", "sku", "bills"])) :
|
|
1680
|
+
}, null, 8, ["record", "sku", "bills"])) : ne("", !0)
|
|
1681
1681
|
], 64))), 128))
|
|
1682
|
-
])) : (
|
|
1683
|
-
|
|
1682
|
+
])) : (w(), E("div", Co, [
|
|
1683
|
+
b(x),
|
|
1684
1684
|
n("div", null, [
|
|
1685
1685
|
n("img", {
|
|
1686
1686
|
src: l(Rt),
|
|
1687
1687
|
alt: "List is empty"
|
|
1688
1688
|
}, null, 8, Vo)
|
|
1689
1689
|
]),
|
|
1690
|
-
n("div", Bo, h(l(
|
|
1691
|
-
n("div", Mo, h(l(
|
|
1692
|
-
|
|
1693
|
-
|
|
1690
|
+
n("div", Bo, h(l(p)("inventory.stock.history.noRecords")), 1),
|
|
1691
|
+
n("div", Mo, h(l(p)("inventory.stock.history.changeDateRange")), 1),
|
|
1692
|
+
b(x),
|
|
1693
|
+
b(x)
|
|
1694
1694
|
]))
|
|
1695
1695
|
])
|
|
1696
1696
|
];
|
|
@@ -1699,48 +1699,75 @@ const In = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Tn = {
|
|
|
1699
1699
|
}, 8, ["modelValue"]);
|
|
1700
1700
|
};
|
|
1701
1701
|
}
|
|
1702
|
-
}), jo = { class: "flex flex-col gap-8" }, Io = { class: "flex flex-col" }, To = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Uo = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary line-clamp-1" }, Xo = /* @__PURE__ */
|
|
1702
|
+
}), jo = { class: "flex flex-col gap-8" }, Io = { class: "flex flex-col" }, To = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Uo = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary line-clamp-1" }, Xo = /* @__PURE__ */ ue({
|
|
1703
1703
|
__name: "StockView",
|
|
1704
1704
|
setup(f) {
|
|
1705
|
-
const { t: y } =
|
|
1706
|
-
o.watchLocation(
|
|
1707
|
-
const
|
|
1708
|
-
async function
|
|
1705
|
+
const { t: y } = ce(), u = Pe(), o = pe(), S = Ee(), _ = st(), m = we(), p = et(), { columnDefs: A } = Gt(), g = He();
|
|
1706
|
+
o.watchLocation($);
|
|
1707
|
+
const r = O(!1), t = ye();
|
|
1708
|
+
async function F() {
|
|
1709
|
+
g.open({
|
|
1710
|
+
title: "Are you sure you want to refresh the stock balance?",
|
|
1711
|
+
closeButton: !0,
|
|
1712
|
+
primaryActions: {
|
|
1713
|
+
text: y("common.confirm"),
|
|
1714
|
+
close: !0
|
|
1715
|
+
},
|
|
1716
|
+
secondaryActions: {
|
|
1717
|
+
text: y("common.close"),
|
|
1718
|
+
close: !0,
|
|
1719
|
+
variant: "tertiary"
|
|
1720
|
+
}
|
|
1721
|
+
}).onPrimary(async () => {
|
|
1722
|
+
await m.recalculation.refreshCurrentBalances(), t.open({
|
|
1723
|
+
title: "Refresh Stock Balance",
|
|
1724
|
+
message: "Stock balance refresh has been queued. This may take a moment to complete.",
|
|
1725
|
+
type: "success"
|
|
1726
|
+
});
|
|
1727
|
+
});
|
|
1728
|
+
}
|
|
1729
|
+
async function $() {
|
|
1709
1730
|
if (o._currentLocation) {
|
|
1710
|
-
|
|
1731
|
+
r.value = !0;
|
|
1711
1732
|
try {
|
|
1712
|
-
await S.readStockBalance(), await S.readProductBalance(), await
|
|
1713
|
-
} catch (
|
|
1714
|
-
|
|
1733
|
+
await S.readStockBalance(), await S.readProductBalance(), await p.readStockEstimateBalance();
|
|
1734
|
+
} catch (T) {
|
|
1735
|
+
t.open({
|
|
1715
1736
|
title: y("inventory.stock.error.title"),
|
|
1716
1737
|
message: y("inventory.stock.error.message"),
|
|
1717
1738
|
type: "error"
|
|
1718
|
-
}), console.error("error on fetch stock balance",
|
|
1739
|
+
}), console.error("error on fetch stock balance", T);
|
|
1719
1740
|
} finally {
|
|
1720
|
-
|
|
1741
|
+
r.value = !1;
|
|
1721
1742
|
}
|
|
1722
1743
|
}
|
|
1723
1744
|
}
|
|
1724
|
-
const
|
|
1725
|
-
() =>
|
|
1726
|
-
var
|
|
1727
|
-
const
|
|
1728
|
-
let
|
|
1729
|
-
(
|
|
1730
|
-
)) == null ? void 0 :
|
|
1731
|
-
(
|
|
1745
|
+
const k = P(
|
|
1746
|
+
() => u.skus.map((T) => {
|
|
1747
|
+
var ee, te, G;
|
|
1748
|
+
const q = T.trackingMeasurement;
|
|
1749
|
+
let J = (te = (ee = S.stockBalance.skus) == null ? void 0 : ee.find(
|
|
1750
|
+
(c) => c.id === T._id
|
|
1751
|
+
)) == null ? void 0 : te.balance, L = p.inventoryForecast.skus.find(
|
|
1752
|
+
(c) => c.id === T._id
|
|
1732
1753
|
);
|
|
1733
1754
|
return {
|
|
1734
|
-
...
|
|
1735
|
-
balance:
|
|
1755
|
+
...T,
|
|
1756
|
+
balance: J ?? {
|
|
1736
1757
|
amount: 0,
|
|
1737
1758
|
precision: 0
|
|
1738
1759
|
},
|
|
1739
|
-
day: (
|
|
1740
|
-
trackingUnitAbbrev:
|
|
1760
|
+
day: (L == null ? void 0 : L.depletionDays) ?? void 0,
|
|
1761
|
+
trackingUnitAbbrev: q ? ((G = T.unit.measurements.find((c) => c.id === q)) == null ? void 0 : G.abbrev) ?? "" : T.unit.abbrev
|
|
1741
1762
|
};
|
|
1742
1763
|
})
|
|
1743
|
-
),
|
|
1764
|
+
), a = O(""), { breakpoints: C } = Ut(), H = P(() => C.value.xs || C.value.sm), V = P(() => H.value ? 10 : 20), j = Vt(), U = P(() => [
|
|
1765
|
+
{
|
|
1766
|
+
label: y("inventory.stock.stock_balance.refreshBalance"),
|
|
1767
|
+
value: "refresh-balance",
|
|
1768
|
+
isPrimary: !0,
|
|
1769
|
+
prependIcon: "calculate"
|
|
1770
|
+
},
|
|
1744
1771
|
{
|
|
1745
1772
|
label: y("inventory.common.refresh"),
|
|
1746
1773
|
value: "refresh"
|
|
@@ -1750,84 +1777,86 @@ const In = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Tn = {
|
|
|
1750
1777
|
value: "export"
|
|
1751
1778
|
}
|
|
1752
1779
|
]);
|
|
1753
|
-
function
|
|
1754
|
-
switch (
|
|
1780
|
+
function R(T) {
|
|
1781
|
+
switch (T) {
|
|
1782
|
+
case "refresh-balance":
|
|
1783
|
+
return F();
|
|
1755
1784
|
case "refresh":
|
|
1756
|
-
return
|
|
1785
|
+
return $();
|
|
1757
1786
|
case "export":
|
|
1758
|
-
return Nt(
|
|
1787
|
+
return Nt(k.value);
|
|
1759
1788
|
}
|
|
1760
1789
|
}
|
|
1761
|
-
return (
|
|
1762
|
-
const
|
|
1763
|
-
return
|
|
1790
|
+
return (T, q) => {
|
|
1791
|
+
const J = B("FmTable");
|
|
1792
|
+
return w(), K(Bt, {
|
|
1764
1793
|
title: l(y)("inventory.stock.title"),
|
|
1765
|
-
actions:
|
|
1766
|
-
"onClick:action":
|
|
1794
|
+
actions: U.value,
|
|
1795
|
+
"onClick:action": R
|
|
1767
1796
|
}, {
|
|
1768
|
-
default:
|
|
1769
|
-
var
|
|
1797
|
+
default: D(() => {
|
|
1798
|
+
var L, Z, ee, te;
|
|
1770
1799
|
return [
|
|
1771
1800
|
n("div", {
|
|
1772
|
-
class:
|
|
1801
|
+
class: be([
|
|
1773
1802
|
"flex flex-col gap-8 max-h-full",
|
|
1774
1803
|
{
|
|
1775
|
-
"p-0":
|
|
1776
|
-
"px-24 ": !
|
|
1804
|
+
"p-0": H.value,
|
|
1805
|
+
"px-24 ": !H.value
|
|
1777
1806
|
}
|
|
1778
1807
|
])
|
|
1779
1808
|
}, [
|
|
1780
|
-
|
|
1809
|
+
b(Mt, {
|
|
1781
1810
|
searchable: "",
|
|
1782
1811
|
"change-location": "",
|
|
1783
|
-
search:
|
|
1784
|
-
"onUpdate:search":
|
|
1812
|
+
search: a.value,
|
|
1813
|
+
"onUpdate:search": q[0] || (q[0] = (G) => a.value = G)
|
|
1785
1814
|
}, null, 8, ["search"]),
|
|
1786
|
-
(
|
|
1787
|
-
style:
|
|
1788
|
-
"column-defs": l(
|
|
1789
|
-
"row-data":
|
|
1790
|
-
"search-value":
|
|
1791
|
-
loading:
|
|
1792
|
-
key: (
|
|
1793
|
-
onRowClick:
|
|
1794
|
-
"page-size":
|
|
1815
|
+
(w(), K(J, {
|
|
1816
|
+
style: Xe(l(j).tableHeight),
|
|
1817
|
+
"column-defs": l(A),
|
|
1818
|
+
"row-data": k.value,
|
|
1819
|
+
"search-value": a.value,
|
|
1820
|
+
loading: r.value || !l(o)._currentLocation,
|
|
1821
|
+
key: (L = l(o)._currentLocation) == null ? void 0 : L.dbName,
|
|
1822
|
+
onRowClick: q[1] || (q[1] = (G) => l(_).showSkuHistory(G.original)),
|
|
1823
|
+
"page-size": V.value
|
|
1795
1824
|
}, {
|
|
1796
|
-
"list-row":
|
|
1797
|
-
|
|
1798
|
-
row:
|
|
1825
|
+
"list-row": D((G) => [
|
|
1826
|
+
b(Dt, {
|
|
1827
|
+
row: G,
|
|
1799
1828
|
onRowClick: l(_).showSkuHistory
|
|
1800
1829
|
}, {
|
|
1801
|
-
default:
|
|
1802
|
-
var
|
|
1830
|
+
default: D((c) => {
|
|
1831
|
+
var e, s, v, i, d, x, I, N, Q, M;
|
|
1803
1832
|
return [
|
|
1804
1833
|
n("div", jo, [
|
|
1805
1834
|
n("div", Io, [
|
|
1806
1835
|
n("div", To, [
|
|
1807
|
-
|
|
1808
|
-
render: (
|
|
1809
|
-
props: (
|
|
1836
|
+
b(l(Ke), {
|
|
1837
|
+
render: (v = (s = (e = c.code) == null ? void 0 : e.column) == null ? void 0 : s.columnDef) == null ? void 0 : v.cell,
|
|
1838
|
+
props: (d = (i = c.code) == null ? void 0 : i.getContext) == null ? void 0 : d.call(i)
|
|
1810
1839
|
}, null, 8, ["render", "props"])
|
|
1811
1840
|
]),
|
|
1812
1841
|
n("div", Uo, [
|
|
1813
|
-
|
|
1814
|
-
render: (
|
|
1815
|
-
props: (
|
|
1842
|
+
b(l(Ke), {
|
|
1843
|
+
render: (N = (I = (x = c.name) == null ? void 0 : x.column) == null ? void 0 : I.columnDef) == null ? void 0 : N.cell,
|
|
1844
|
+
props: (M = (Q = c.name) == null ? void 0 : Q.getContext) == null ? void 0 : M.call(Q)
|
|
1816
1845
|
}, null, 8, ["render", "props"])
|
|
1817
1846
|
])
|
|
1818
1847
|
]),
|
|
1819
1848
|
n("div", null, [
|
|
1820
|
-
|
|
1821
|
-
days:
|
|
1849
|
+
b(Ie, {
|
|
1850
|
+
days: G.original.day
|
|
1822
1851
|
}, null, 8, ["days"])
|
|
1823
1852
|
]),
|
|
1824
1853
|
n("div", null, [
|
|
1825
|
-
|
|
1854
|
+
b(ot, {
|
|
1826
1855
|
class: "xs:w-[160px]",
|
|
1827
|
-
unit:
|
|
1828
|
-
sku:
|
|
1829
|
-
amount:
|
|
1830
|
-
"default-tracking-measurement":
|
|
1856
|
+
unit: G.original.unit,
|
|
1857
|
+
sku: G.original,
|
|
1858
|
+
amount: G.original.balance,
|
|
1859
|
+
"default-tracking-measurement": G.original.trackingMeasurement ?? void 0
|
|
1831
1860
|
}, null, 8, ["unit", "sku", "amount", "default-tracking-measurement"])
|
|
1832
1861
|
])
|
|
1833
1862
|
])
|
|
@@ -1839,10 +1868,10 @@ const In = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Tn = {
|
|
|
1839
1868
|
_: 1
|
|
1840
1869
|
}, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"]))
|
|
1841
1870
|
], 2),
|
|
1842
|
-
(
|
|
1843
|
-
(
|
|
1844
|
-
(
|
|
1845
|
-
(
|
|
1871
|
+
(w(), K(rt, { to: "body" }, [
|
|
1872
|
+
(Z = l(_).stockHistoryProps) != null && Z.sku ? (w(), K(Do, Ae($e({ key: 0 }, l(_).stockHistoryProps)), null, 16)) : ne("", !0),
|
|
1873
|
+
(ee = l(_).convertSkuDialogProps) != null && ee.sku ? (w(), K(un, Ae($e({ key: 1 }, l(_).convertSkuDialogProps)), null, 16)) : ne("", !0),
|
|
1874
|
+
(te = l(_).adjustSkuDialogProps) != null && te.stock ? (w(), K(kn, Ae($e({ key: 2 }, l(_).adjustSkuDialogProps)), null, 16)) : ne("", !0)
|
|
1846
1875
|
]))
|
|
1847
1876
|
];
|
|
1848
1877
|
}),
|