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