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