@feedmepos/mf-inventory-portal 1.2.10-dev.3 → 1.2.10
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-D9otYMgh.js → App-DYqxMYB9.js} +1 -1
- package/dist/{ApprovalView-Bue46U6e.js → ApprovalView-DGwyBskr.js} +17 -17
- package/dist/{BindingsDialog-Xleskmvg.js → BindingsDialog-DPTaXP5d.js} +2 -2
- package/dist/{BindingsPicker-BeNF1NcZ.js → BindingsPicker-Bf0njj4d.js} +4 -4
- package/dist/{BindingsTable-ecWz3SHk.js → BindingsTable-BPe63ZWt.js} +1 -1
- package/dist/{ClosingDraftView-DkxOW9Ns.js → ClosingDraftView-ChH3hzk5.js} +123 -123
- package/dist/{ClosingTemplateView-BbnpVNYF.js → ClosingTemplateView-Ck92tjyp.js} +26 -26
- package/dist/{DeliveryOrderPrintPreview-CH-IzSM9.js → DeliveryOrderPrintPreview-DH6Zb9fP.js} +9 -9
- package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-DOR_Iu0w.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-cSUU8S9I.js} +16 -16
- package/dist/{FmMultiselectDialog-DBgk0_mV.js → FmMultiselectDialog-BTYol2SU.js} +4 -4
- package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-DdxSlJRz.js → FmUnitInput.vue_vue_type_script_setup_true_lang-YbBghEyh.js} +43 -43
- package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-C22gncaQ.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-Dnme2biR.js} +7 -7
- package/dist/{IngredientGroupView-CrNLRll8.js → IngredientGroupView--T3MBGwZ.js} +13 -13
- package/dist/IngredientsView-DZyx9OC9.js +2467 -0
- package/dist/{IntegrationView-DRwnqCf9.js → IntegrationView-evwSnY6R.js} +24 -25
- package/dist/{InventoryBindingForm-DU6B0J0B.js → InventoryBindingForm-PaQ8Cq5r.js} +1 -1
- package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-CLCDb25h.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-Ah0DptUu.js} +12 -12
- package/dist/{InventoryBindingSummary-BH2bWICt.js → InventoryBindingSummary-CrI4xTEO.js} +1 -1
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-BD2hneTA.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DxTP40bM.js} +1 -1
- package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-GabOf_-7.js → PremiumBadge.vue_vue_type_script_setup_true_lang-B-ttqDcQ.js} +1 -1
- package/dist/{PublishView-B510iDYx.js → PublishView-D2WXGfZr.js} +19 -19
- package/dist/{PurchaseOrderPrintPreview-Cbsl8gcZ.js → PurchaseOrderPrintPreview-B1QrfsNt.js} +7 -7
- package/dist/{ReceiveRequestView-rKyNjRbk.js → ReceiveRequestView-BtdOm43O.js} +80 -80
- package/dist/{RecipeView-C9dw-1_E.js → RecipeView-okupvj-0.js} +39 -39
- package/dist/{StockView-scnHVHGB.js → StockView-Bb9AQQlK.js} +833 -830
- package/dist/SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-BOJrQc5Z.js +172 -0
- package/dist/{SupplierView-to6stKYV.js → SupplierView-CPG7eyiI.js} +4 -4
- package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-laVp-HrL.js → TransferDetails.vue_vue_type_script_setup_true_lang-DuaXDXxy.js} +11 -12
- package/dist/{TransferTemplateView-VOgIhPGW.js → TransferTemplateView-BLVlhF0T.js} +109 -109
- package/dist/{UnitView-sr5QkKex.js → UnitView-BIoDigC1.js} +16 -16
- package/dist/{WarehouseView-CB3luO1P.js → WarehouseView-C5SVRgJG.js} +16 -16
- package/dist/{app-BpyxIAaY.js → app-BpzSrMFG.js} +8610 -8548
- package/dist/app.js +1 -1
- package/dist/{closing-template-CEJaVQKn.js → closing-template-DgyNw_vj.js} +1 -1
- package/dist/components/FmInventoryTableToolbar.vue.d.ts +7 -0
- package/dist/components/netsuite/ItemSubsidiaryTreeDialog.vue.d.ts +16 -0
- package/dist/{decimal-Dqff6QMJ.js → decimal-CvU6JXwM.js} +1 -1
- package/dist/{format-unit-display-DcORb0K7.js → format-unit-display-ChcvhEq_.js} +3 -3
- package/dist/{index-rTyWq-0n.js → index-L2DfU-le.js} +1 -1
- package/dist/{index-CFfIlNHC.js → index-UnM6VgqL.js} +1 -1
- package/dist/{purchase-order-template-BFPrzfeR.js → purchase-order-template-BGNA5mhv.js} +1 -1
- package/dist/{stock-CkgmiPOr.js → stock-BzHLD7VH.js} +1 -1
- package/dist/stores/integration/netsuite.d.ts +25 -3
- package/dist/style.css +1 -1
- package/dist/{supplier-Db_-hKgm.js → supplier-DjmGXRXx.js} +1 -1
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{use-ingredient-select-dialog-CEEFJa9x.js → use-ingredient-select-dialog-DEtTZkz4.js} +4 -4
- package/dist/{use-inventory-binding-dialog-C6Ev4777.js → use-inventory-binding-dialog-DUVVkJpV.js} +1 -1
- package/package.json +2 -2
- package/dist/FmAdminBadge-D4rqYlKu.js +0 -44
- package/dist/IngredientsView-DLK0Seww.js +0 -2319
- package/dist/SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-Dt1S8tTH.js +0 -158
|
@@ -1,27 +1,26 @@
|
|
|
1
|
-
import { defineComponent as ce, ref as N, computed as H, resolveComponent as
|
|
2
|
-
import { u as
|
|
3
|
-
import { u as
|
|
4
|
-
import { g as we } from "./decimal-
|
|
5
|
-
import { e as Lt, u as
|
|
6
|
-
import { _ as Te, S as
|
|
1
|
+
import { defineComponent as ce, ref as N, computed as H, resolveComponent as D, openBlock as F, createBlock as K, withCtx as I, createElementVNode as e, normalizeClass as he, toDisplayString as _, createVNode as k, createElementBlock as O, Fragment as Z, renderList as ie, unref as u, h as pe, watch as xe, isRef as Ue, createCommentVNode as te, reactive as ut, mergeModels as Ge, useModel as ct, onMounted as Ee, createTextVNode as ue, normalizeStyle as tt, Teleport as dt, normalizeProps as Ae, mergeProps as Ve } from "vue";
|
|
2
|
+
import { u as ve, a2 as mt, f as He, h as Pe, i as pt, a as Re, F as We, a3 as vt, x as je, l as me, Z as ft, t as Se, a1 as Fe, A as yt, M as _t, a0 as ye, a4 as bt, a5 as ne, a6 as kt, a7 as qe, p as gt, v as ht, a8 as xt, a9 as St, aa as Ft, ab as Ce, ac as wt, ad as nt, $ as X, ae as $t, B as ot, af as ke, ag as At, ah as Vt, r as Be, o as Xe, s as Ct, c as Bt, ai as Mt, aj as Dt, ak as It, al as jt, am as Tt, b as Ut, N as Et, K as Ht, L as Pt, O as Rt, P as Ot, Q as Nt, T as Qe } from "./app-BpzSrMFG.js";
|
|
3
|
+
import { u as Oe, a as _e } from "./stock-BzHLD7VH.js";
|
|
4
|
+
import { g as we } from "./decimal-CvU6JXwM.js";
|
|
5
|
+
import { e as Lt, u as st, i as at, _ as Je } from "./PremiumBadge.vue_vue_type_script_setup_true_lang-B-ttqDcQ.js";
|
|
6
|
+
import { _ as Te, S as Me, g as lt, a as zt } from "./SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-BOJrQc5Z.js";
|
|
7
7
|
import { _ as Yt } from "./PreviewBadge.vue_vue_type_script_setup_true_lang-CRZiQHjx.js";
|
|
8
|
-
import { useI18n as de, useCoreStore as
|
|
9
|
-
import { useSnackbar as be, useDialog as
|
|
8
|
+
import { useI18n as de, useCoreStore as Ne } from "@feedmepos/mf-common";
|
|
9
|
+
import { useSnackbar as be, useDialog as Le, useProxiedModel as ze, useBreakpoints as Kt } from "@feedmepos/ui-library";
|
|
10
10
|
import { defineStore as Gt } from "pinia";
|
|
11
|
-
import { u as Wt } from "./use-inventory-binding-dialog-
|
|
12
|
-
import { _ as qt } from "./NumberPrecisionInput.vue_vue_type_script_setup_true_lang-
|
|
11
|
+
import { u as Wt } from "./use-inventory-binding-dialog-DUVVkJpV.js";
|
|
12
|
+
import { _ as qt } from "./NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DxTP40bM.js";
|
|
13
13
|
import { E as Xt } from "./empty-placeholder-wf6-BWE8.js";
|
|
14
|
-
import { F as lt } from "./FmAdminBadge-D4rqYlKu.js";
|
|
15
14
|
import "./array-Ca8T3f_G.js";
|
|
16
|
-
var ge = /* @__PURE__ */ ((
|
|
17
|
-
const
|
|
15
|
+
var ge = /* @__PURE__ */ ((b) => (b.History = "History", b.Convert = "Convert", b.Adjust = "Adjust", b))(ge || {});
|
|
16
|
+
const Qt = [
|
|
18
17
|
{
|
|
19
18
|
translationKey: "inventory.stock.action.history",
|
|
20
19
|
color: "text-neutral-700",
|
|
21
20
|
value: "History"
|
|
22
21
|
/* History */
|
|
23
22
|
}
|
|
24
|
-
],
|
|
23
|
+
], Jt = [
|
|
25
24
|
{
|
|
26
25
|
translationKey: "inventory.stock.action.history",
|
|
27
26
|
color: "text-neutral-700",
|
|
@@ -41,8 +40,8 @@ const Jt = [
|
|
|
41
40
|
/* Adjust */
|
|
42
41
|
}
|
|
43
42
|
];
|
|
44
|
-
async function Zt(
|
|
45
|
-
const
|
|
43
|
+
async function Zt(b) {
|
|
44
|
+
const p = `${(ve().currentLocation.name || "").replace(
|
|
46
45
|
/ /g,
|
|
47
46
|
"_"
|
|
48
47
|
)}_${mt().format("DD_MM_YYYY_HHmm")}.xlsx`;
|
|
@@ -50,7 +49,7 @@ async function Zt(k) {
|
|
|
50
49
|
[
|
|
51
50
|
{
|
|
52
51
|
name: "stock",
|
|
53
|
-
data:
|
|
52
|
+
data: b,
|
|
54
53
|
columns: [
|
|
55
54
|
{
|
|
56
55
|
name: "Code",
|
|
@@ -62,37 +61,37 @@ async function Zt(k) {
|
|
|
62
61
|
},
|
|
63
62
|
{
|
|
64
63
|
name: "Balance",
|
|
65
|
-
selector: (
|
|
66
|
-
const
|
|
67
|
-
return
|
|
64
|
+
selector: (o) => {
|
|
65
|
+
const j = $e(o, o.unit);
|
|
66
|
+
return j.type === "unit" ? we(o.balance, o.unit, null, !1) : we(o.balance, o.unit, j.measurement, !1);
|
|
68
67
|
}
|
|
69
68
|
},
|
|
70
69
|
{
|
|
71
70
|
name: "Unit",
|
|
72
|
-
selector: (
|
|
73
|
-
var
|
|
74
|
-
const
|
|
75
|
-
return
|
|
71
|
+
selector: (o) => {
|
|
72
|
+
var h;
|
|
73
|
+
const j = $e(o, o.unit);
|
|
74
|
+
return j.type === "unit" ? o.unit.abbrev : ((h = o.unit.measurements.find((d) => d.id === j.measurement)) == null ? void 0 : h.abbrev) || "";
|
|
76
75
|
}
|
|
77
76
|
}
|
|
78
77
|
]
|
|
79
78
|
}
|
|
80
79
|
],
|
|
81
|
-
|
|
80
|
+
p
|
|
82
81
|
);
|
|
83
82
|
}
|
|
84
|
-
function $e(
|
|
85
|
-
const
|
|
86
|
-
return
|
|
83
|
+
function $e(b, g) {
|
|
84
|
+
const p = localStorage.getItem(`uom:${b._id}`);
|
|
85
|
+
return p ? p === g._id ? {
|
|
87
86
|
type: "unit"
|
|
88
|
-
} :
|
|
87
|
+
} : g.measurements.find((o) => o.id === p) ? {
|
|
89
88
|
type: "measurement",
|
|
90
|
-
measurement:
|
|
89
|
+
measurement: p
|
|
91
90
|
} : {
|
|
92
91
|
type: "unit"
|
|
93
|
-
} :
|
|
92
|
+
} : b.trackingMeasurement && g.measurements.find((o) => o.id === b.trackingMeasurement) ? {
|
|
94
93
|
type: "measurement",
|
|
95
|
-
measurement:
|
|
94
|
+
measurement: b.trackingMeasurement
|
|
96
95
|
} : {
|
|
97
96
|
type: "unit"
|
|
98
97
|
};
|
|
@@ -105,63 +104,63 @@ const en = { class: "fm-typo-en-body-md-400 flex-grow" }, rt = /* @__PURE__ */ c
|
|
|
105
104
|
amount: {},
|
|
106
105
|
defaultTrackingMeasurement: {}
|
|
107
106
|
},
|
|
108
|
-
setup(
|
|
109
|
-
function
|
|
110
|
-
return `uom:${
|
|
107
|
+
setup(b) {
|
|
108
|
+
function g(C) {
|
|
109
|
+
return `uom:${C._id}`;
|
|
111
110
|
}
|
|
112
|
-
function
|
|
113
|
-
const
|
|
114
|
-
|
|
111
|
+
function p(C) {
|
|
112
|
+
const c = g(o.sku);
|
|
113
|
+
C ? localStorage.setItem(c, C) : localStorage.setItem(c, o.unit._id), j.value = $e(o.sku, o.unit);
|
|
115
114
|
}
|
|
116
|
-
const
|
|
117
|
-
const { measurements:
|
|
115
|
+
const o = b, j = N($e(o.sku, o.unit)), h = H(() => {
|
|
116
|
+
const { measurements: C } = o.unit;
|
|
118
117
|
return [
|
|
119
118
|
{
|
|
120
|
-
label: `${we(
|
|
119
|
+
label: `${we(o.amount, o.unit)}`,
|
|
121
120
|
value: null
|
|
122
121
|
},
|
|
123
|
-
...
|
|
124
|
-
label: `${we(
|
|
125
|
-
value:
|
|
122
|
+
...C.map(({ id: c }) => ({
|
|
123
|
+
label: `${we(o.amount, o.unit, c)}`,
|
|
124
|
+
value: c
|
|
126
125
|
}))
|
|
127
126
|
];
|
|
128
127
|
});
|
|
129
|
-
function
|
|
130
|
-
return u(
|
|
128
|
+
function d({ value: C }) {
|
|
129
|
+
return u(j).type === "unit" ? C === null : C === u(j).measurement;
|
|
131
130
|
}
|
|
132
|
-
const
|
|
131
|
+
const i = H(
|
|
133
132
|
() => {
|
|
134
|
-
var
|
|
135
|
-
return ((
|
|
133
|
+
var C;
|
|
134
|
+
return ((C = h.value.find((c) => d(c))) == null ? void 0 : C.label) ?? "";
|
|
136
135
|
}
|
|
137
|
-
),
|
|
138
|
-
return (
|
|
139
|
-
const l =
|
|
140
|
-
return F(), K(
|
|
136
|
+
), x = N(!1);
|
|
137
|
+
return (C, c) => {
|
|
138
|
+
const l = D("FmIcon"), v = D("FmMenuItem"), $ = D("FmMenu");
|
|
139
|
+
return F(), K($, {
|
|
141
140
|
"stop-click-propagation": "",
|
|
142
|
-
onMenuChanged:
|
|
141
|
+
onMenuChanged: c[0] || (c[0] = (A) => x.value = A)
|
|
143
142
|
}, {
|
|
144
|
-
"menu-button":
|
|
143
|
+
"menu-button": I(() => [
|
|
145
144
|
e("button", {
|
|
146
145
|
type: "button",
|
|
147
146
|
class: he([
|
|
148
147
|
"w-full text-left flex items-center gap-8 cursor-pointer fm-corner-radius-sm px-8 py-4 border bg-white",
|
|
149
|
-
|
|
148
|
+
x.value ? "border-fm-color-primary" : "border-fm-color-neutral-gray-100"
|
|
150
149
|
])
|
|
151
150
|
}, [
|
|
152
|
-
e("div", en,
|
|
153
|
-
|
|
151
|
+
e("div", en, _(i.value), 1),
|
|
152
|
+
k(l, {
|
|
154
153
|
class: "text-fm-color-neutral-gray-400",
|
|
155
154
|
name: "expand_more"
|
|
156
155
|
})
|
|
157
156
|
], 2)
|
|
158
157
|
]),
|
|
159
|
-
default:
|
|
160
|
-
(F(!0), O(Z, null, ie(
|
|
158
|
+
default: I(() => [
|
|
159
|
+
(F(!0), O(Z, null, ie(h.value, (A) => (F(), K(v, {
|
|
161
160
|
key: A.value ?? 0,
|
|
162
161
|
label: A.label,
|
|
163
|
-
"model-value":
|
|
164
|
-
onClick: (V) =>
|
|
162
|
+
"model-value": d(A),
|
|
163
|
+
onClick: (V) => p(A.value)
|
|
165
164
|
}, null, 8, ["label", "model-value", "onClick"]))), 128))
|
|
166
165
|
]),
|
|
167
166
|
_: 1
|
|
@@ -170,89 +169,89 @@ const en = { class: "fm-typo-en-body-md-400 flex-grow" }, rt = /* @__PURE__ */ c
|
|
|
170
169
|
}
|
|
171
170
|
}), tn = { class: "whitespace-nowrap" }, nn = /* @__PURE__ */ ce({
|
|
172
171
|
__name: "StockHeaderPreview",
|
|
173
|
-
setup(
|
|
174
|
-
const { t:
|
|
175
|
-
return (
|
|
176
|
-
default:
|
|
177
|
-
e("div", tn,
|
|
172
|
+
setup(b) {
|
|
173
|
+
const { t: g } = de();
|
|
174
|
+
return (p, o) => (F(), K(Yt, null, {
|
|
175
|
+
default: I(() => [
|
|
176
|
+
e("div", tn, _(u(g)("inventory.stock.prediction.daysRemaining")), 1)
|
|
178
177
|
]),
|
|
179
178
|
_: 1
|
|
180
179
|
}));
|
|
181
180
|
}
|
|
182
181
|
}), it = Gt("stockActions", () => {
|
|
183
|
-
const
|
|
184
|
-
async function
|
|
185
|
-
if (
|
|
186
|
-
|
|
182
|
+
const b = N(!1), g = ve(), p = Oe(), o = st(), j = be(), h = Le(), { t: d } = de();
|
|
183
|
+
async function i() {
|
|
184
|
+
if (g._currentLocation) {
|
|
185
|
+
b.value = !0;
|
|
187
186
|
try {
|
|
188
|
-
await
|
|
187
|
+
await p.readStockBalance(), await p.readProductBalance(), await o.readStockEstimateBalance();
|
|
189
188
|
} catch {
|
|
190
|
-
|
|
191
|
-
title:
|
|
192
|
-
message:
|
|
189
|
+
j.open({
|
|
190
|
+
title: d("inventory.stock.error.title"),
|
|
191
|
+
message: d("inventory.stock.error.message"),
|
|
193
192
|
type: "error"
|
|
194
193
|
});
|
|
195
194
|
} finally {
|
|
196
|
-
|
|
195
|
+
b.value = !1;
|
|
197
196
|
}
|
|
198
197
|
}
|
|
199
198
|
}
|
|
200
|
-
const
|
|
201
|
-
async function
|
|
202
|
-
var
|
|
203
|
-
if (!!!((
|
|
204
|
-
|
|
205
|
-
title:
|
|
206
|
-
message:
|
|
199
|
+
const x = N();
|
|
200
|
+
async function C(V) {
|
|
201
|
+
var B, M, E;
|
|
202
|
+
if (!!!((M = (B = V.convert) == null ? void 0 : B.inventoryBindings) != null && M.length)) {
|
|
203
|
+
h.open({
|
|
204
|
+
title: d("inventory.stock.error.convert.title"),
|
|
205
|
+
message: d("inventory.stock.error.convert.message")
|
|
207
206
|
});
|
|
208
207
|
return;
|
|
209
208
|
}
|
|
210
209
|
const w = {
|
|
211
|
-
maxCount: ((E =
|
|
210
|
+
maxCount: ((E = p.productBalance.find(({ id: P }) => P === V._id)) == null ? void 0 : E.count) || 0,
|
|
212
211
|
sku: V,
|
|
213
212
|
show: !0,
|
|
214
213
|
"onUpdate:show"(P) {
|
|
215
|
-
|
|
214
|
+
x.value.show = P;
|
|
216
215
|
},
|
|
217
216
|
onSubmitted() {
|
|
218
|
-
|
|
217
|
+
i();
|
|
219
218
|
}
|
|
220
219
|
};
|
|
221
|
-
|
|
220
|
+
x.value = w;
|
|
222
221
|
}
|
|
223
|
-
const
|
|
222
|
+
const c = N();
|
|
224
223
|
async function l(V) {
|
|
225
224
|
const n = {
|
|
226
225
|
stock: V,
|
|
227
226
|
show: !0,
|
|
228
227
|
"onUpdate:show"(r) {
|
|
229
|
-
|
|
228
|
+
c.value.show = r;
|
|
230
229
|
},
|
|
231
230
|
onSubmitted() {
|
|
232
|
-
|
|
231
|
+
i();
|
|
233
232
|
}
|
|
234
233
|
};
|
|
235
|
-
|
|
234
|
+
c.value = n;
|
|
236
235
|
}
|
|
237
|
-
const
|
|
238
|
-
async function
|
|
236
|
+
const v = N();
|
|
237
|
+
async function $(V) {
|
|
239
238
|
const n = {
|
|
240
239
|
sku: V,
|
|
241
240
|
show: !0,
|
|
242
241
|
"onUpdate:show"(r) {
|
|
243
|
-
|
|
242
|
+
v.value.show = r;
|
|
244
243
|
}
|
|
245
244
|
};
|
|
246
|
-
|
|
245
|
+
v.value = n;
|
|
247
246
|
}
|
|
248
247
|
function A(V, n) {
|
|
249
248
|
const r = He(n);
|
|
250
249
|
switch (V) {
|
|
251
250
|
case ge.History:
|
|
252
|
-
|
|
251
|
+
$(r);
|
|
253
252
|
return;
|
|
254
253
|
case ge.Convert:
|
|
255
|
-
|
|
254
|
+
C(r);
|
|
256
255
|
return;
|
|
257
256
|
case ge.Adjust:
|
|
258
257
|
l(r);
|
|
@@ -260,90 +259,93 @@ const en = { class: "fm-typo-en-body-md-400 flex-grow" }, rt = /* @__PURE__ */ c
|
|
|
260
259
|
}
|
|
261
260
|
}
|
|
262
261
|
return {
|
|
263
|
-
fetchStockBalance:
|
|
262
|
+
fetchStockBalance: i,
|
|
264
263
|
onActionMenu: A,
|
|
265
|
-
stockHistoryProps:
|
|
266
|
-
showSkuHistory:
|
|
267
|
-
convertSkuDialogProps:
|
|
268
|
-
adjustSkuDialogProps:
|
|
264
|
+
stockHistoryProps: v,
|
|
265
|
+
showSkuHistory: $,
|
|
266
|
+
convertSkuDialogProps: x,
|
|
267
|
+
adjustSkuDialogProps: c
|
|
269
268
|
};
|
|
270
269
|
});
|
|
271
270
|
function on() {
|
|
272
|
-
|
|
271
|
+
var h;
|
|
272
|
+
const b = ve(), g = it(), p = Ne(), { t: o } = de();
|
|
273
273
|
return {
|
|
274
274
|
columnDefs: [
|
|
275
275
|
{
|
|
276
276
|
accessorKey: "code",
|
|
277
|
-
header: () =>
|
|
277
|
+
header: () => o("inventory.stock.code"),
|
|
278
278
|
enableSorting: !0,
|
|
279
279
|
size: 300
|
|
280
280
|
},
|
|
281
281
|
{
|
|
282
282
|
accessorKey: "name",
|
|
283
|
-
header: () =>
|
|
283
|
+
header: () => o("inventory.stock.product"),
|
|
284
284
|
enableSorting: !0,
|
|
285
285
|
size: "auto"
|
|
286
286
|
},
|
|
287
287
|
{
|
|
288
288
|
id: "UOM",
|
|
289
|
-
header: () =>
|
|
290
|
-
cell(
|
|
291
|
-
const
|
|
292
|
-
unit:
|
|
293
|
-
sku:
|
|
294
|
-
amount:
|
|
295
|
-
defaultTrackingMeasurement:
|
|
289
|
+
header: () => o("inventory.stock.balance"),
|
|
290
|
+
cell(d) {
|
|
291
|
+
const i = d.row.original, x = {
|
|
292
|
+
unit: i.unit,
|
|
293
|
+
sku: i,
|
|
294
|
+
amount: i.balance,
|
|
295
|
+
defaultTrackingMeasurement: i.trackingMeasurement ?? void 0
|
|
296
296
|
};
|
|
297
|
-
return
|
|
297
|
+
return pe(rt, x);
|
|
298
298
|
},
|
|
299
299
|
size: 180
|
|
300
300
|
},
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
301
|
+
...(h = p.sessionUser.value) != null && h.role.isAdmin ? [
|
|
302
|
+
{
|
|
303
|
+
accessorKey: "isInactive",
|
|
304
|
+
header: () => pe(Pe, {}, () => `${o("inventory.ingredient.status.title")}`),
|
|
305
|
+
cell(d) {
|
|
306
|
+
const i = d.row.original.isInactive;
|
|
307
|
+
return pe(
|
|
308
|
+
"span",
|
|
309
|
+
{
|
|
310
|
+
class: [
|
|
311
|
+
"inline-block px-3 py-1 rounded-full text-xs font-semibold",
|
|
312
|
+
i ? "bg-red-100 text-red-700" : "bg-green-100 text-green-700"
|
|
313
|
+
].join(" ")
|
|
314
|
+
},
|
|
315
|
+
o(i ? "inventory.ingredient.status.inactive" : "inventory.ingredient.status.active")
|
|
316
|
+
);
|
|
317
|
+
},
|
|
318
|
+
enableSorting: !0
|
|
319
|
+
}
|
|
320
|
+
] : [],
|
|
319
321
|
{
|
|
320
322
|
accessorKey: "day",
|
|
321
323
|
id: "expireDate",
|
|
322
|
-
header: () =>
|
|
324
|
+
header: () => pe(nn),
|
|
323
325
|
enableSorting: !0,
|
|
324
326
|
sortUndefined: "last",
|
|
325
|
-
cell(
|
|
326
|
-
var
|
|
327
|
-
const
|
|
328
|
-
if (typeof
|
|
329
|
-
return
|
|
330
|
-
days:
|
|
327
|
+
cell(d) {
|
|
328
|
+
var v, $;
|
|
329
|
+
const i = d.row.original.day, x = (v = d.row.original.thresholds) == null ? void 0 : v.low, C = ($ = d.row.original.thresholds) == null ? void 0 : $.mid;
|
|
330
|
+
if (typeof i != "number" || typeof x != "number" || typeof C != "number")
|
|
331
|
+
return pe(Te, {
|
|
332
|
+
days: i
|
|
331
333
|
});
|
|
332
|
-
const
|
|
333
|
-
return
|
|
334
|
-
days:
|
|
335
|
-
level:
|
|
334
|
+
const c = i <= x ? Me.low : i <= C ? Me.mid : Me.high;
|
|
335
|
+
return pe(Te, {
|
|
336
|
+
days: i,
|
|
337
|
+
level: c
|
|
336
338
|
});
|
|
337
339
|
},
|
|
338
340
|
size: 200
|
|
339
341
|
},
|
|
340
342
|
{
|
|
341
343
|
id: "action",
|
|
342
|
-
cell(
|
|
343
|
-
var
|
|
344
|
+
cell(d) {
|
|
345
|
+
var i;
|
|
344
346
|
return pt(
|
|
345
|
-
((
|
|
346
|
-
(
|
|
347
|
+
((i = b._currentLocation) == null ? void 0 : i.type) === "restaurant" ? Qt : Jt,
|
|
348
|
+
(x) => g.onActionMenu(x, d.row.original)
|
|
347
349
|
);
|
|
348
350
|
},
|
|
349
351
|
enableSorting: !1,
|
|
@@ -359,39 +361,39 @@ function on() {
|
|
|
359
361
|
const sn = {
|
|
360
362
|
context: null,
|
|
361
363
|
error: null,
|
|
362
|
-
isRequired(
|
|
363
|
-
return `${this.context ?? ""}`.length === 0 && (this.error =
|
|
364
|
+
isRequired(b = "This field is required") {
|
|
365
|
+
return `${this.context ?? ""}`.length === 0 && (this.error = b), this;
|
|
364
366
|
},
|
|
365
|
-
isString(
|
|
366
|
-
return this.error ? this : (typeof this.context != "string" && (this.error ?? (this.error =
|
|
367
|
+
isString(b = "Must be a valid string") {
|
|
368
|
+
return this.error ? this : (typeof this.context != "string" && (this.error ?? (this.error = b)), this);
|
|
367
369
|
},
|
|
368
370
|
toInt() {
|
|
369
371
|
return this.error ? this : (this.context = +this.context, this);
|
|
370
372
|
},
|
|
371
|
-
isInteger(
|
|
372
|
-
return this.error ? this : (this.toInt(), isNaN(this.context) && (this.error =
|
|
373
|
+
isInteger(b = "Must be an integer") {
|
|
374
|
+
return this.error ? this : (this.toInt(), isNaN(this.context) && (this.error = b), this);
|
|
373
375
|
},
|
|
374
|
-
min(
|
|
376
|
+
min(b, g) {
|
|
375
377
|
if (this.error) return this;
|
|
376
378
|
try {
|
|
377
|
-
typeof this.context == "number" ? +this.context <
|
|
379
|
+
typeof this.context == "number" ? +this.context < b && (this.error = g ?? `Must be at least ${b}`) : Object.prototype.hasOwnProperty.call(this.context, "length") ? +this.context.length < b && (this.error = g ?? `Must be at least ${b}`) : this.error = "Length cannot be determined";
|
|
378
380
|
} catch {
|
|
379
381
|
this.error = "Length cannot be determined";
|
|
380
382
|
}
|
|
381
383
|
return this;
|
|
382
384
|
},
|
|
383
|
-
max(
|
|
385
|
+
max(b, g) {
|
|
384
386
|
if (this.error) return this;
|
|
385
387
|
try {
|
|
386
|
-
typeof this.context == "number" ? +this.context >
|
|
388
|
+
typeof this.context == "number" ? +this.context > b && (this.error = g ?? `Must be at most ${b}`) : "length" in this.context ? +this.context.length > b && (this.error = g ?? `Must be at most ${b}`) : this.error = "Length cannot be determined";
|
|
387
389
|
} catch {
|
|
388
390
|
this.error = "Length cannot be determined";
|
|
389
391
|
}
|
|
390
392
|
return this;
|
|
391
393
|
}
|
|
392
394
|
};
|
|
393
|
-
function
|
|
394
|
-
return { ...sn, context:
|
|
395
|
+
function Ze(b) {
|
|
396
|
+
return { ...sn, context: b };
|
|
395
397
|
}
|
|
396
398
|
const an = { class: "flex items-center" }, ln = { class: "fm-typo-en-title-md-800" }, rn = { class: "flex flex-col gap-24 w-full" }, un = { class: "flex flex-col gap-8" }, cn = { class: "fm-typo-en-body-lg-600" }, dn = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary flex-grow" }, mn = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-error" }, pn = { class: "flex flex-col p-16 gap-8" }, vn = { class: "flex flex-col gap-4" }, fn = { class: "fm-typo-en-body-md-600 text-fm-color-typo-secondary bg-fm-color-neutral-gray-100 border-b py-12 px-16" }, yn = { class: "grid grid-cols-[auto_100px_100px_48px] xs:grid-cols-[auto_80px_120px_48px] gap-8 px-8 items-center" }, _n = { class: "xs:col-span-3" }, bn = { class: "flex gap-8" }, kn = /* @__PURE__ */ ce({
|
|
397
399
|
__name: "ConvertSkuDialog",
|
|
@@ -401,101 +403,101 @@ const an = { class: "flex items-center" }, ln = { class: "fm-typo-en-title-md-80
|
|
|
401
403
|
show: { type: Boolean }
|
|
402
404
|
},
|
|
403
405
|
emits: ["update:show", "submitted"],
|
|
404
|
-
setup(
|
|
405
|
-
const
|
|
406
|
+
setup(b, { expose: g, emit: p }) {
|
|
407
|
+
const o = b, j = p, h = Wt(), d = Re(), i = _e(), x = be(), { t: C } = de(), c = N(0), l = N(null), v = H(() => d.skus), $ = H(
|
|
406
408
|
() => {
|
|
407
|
-
var
|
|
408
|
-
return (((t = (
|
|
409
|
-
(
|
|
409
|
+
var y, t;
|
|
410
|
+
return (((t = (y = o.sku) == null ? void 0 : y.convert) == null ? void 0 : t.inventoryBindings) ?? []).filter(
|
|
411
|
+
(s) => s.type === We.enum.SKU
|
|
410
412
|
);
|
|
411
413
|
}
|
|
412
414
|
), A = H({
|
|
413
415
|
get() {
|
|
414
416
|
return !!l.value;
|
|
415
417
|
},
|
|
416
|
-
set(
|
|
417
|
-
|
|
418
|
+
set(y) {
|
|
419
|
+
y ? l.value = He($.value) : (l.value = null, c.value = Math.min(c.value, o.maxCount ?? 0));
|
|
418
420
|
}
|
|
419
421
|
}), V = N(!1);
|
|
420
|
-
xe([() =>
|
|
421
|
-
|
|
422
|
+
xe([() => o.show], ([y]) => {
|
|
423
|
+
y && (c.value = 0);
|
|
422
424
|
});
|
|
423
425
|
function n() {
|
|
424
|
-
|
|
426
|
+
J(o.sku, Se(c.value), l.value);
|
|
425
427
|
}
|
|
426
|
-
function r(
|
|
428
|
+
function r(y) {
|
|
427
429
|
if (l.value)
|
|
428
430
|
return !0;
|
|
429
|
-
const t =
|
|
431
|
+
const t = Ze(y).isInteger().max(o.maxCount ?? 0).error ?? "";
|
|
430
432
|
return t || !0;
|
|
431
433
|
}
|
|
432
|
-
function w(
|
|
434
|
+
function w(y) {
|
|
433
435
|
var a;
|
|
434
|
-
const t = (a =
|
|
436
|
+
const t = (a = o.sku.convert) != null && a.measurement ? o.sku.unit.measurements.find((S) => {
|
|
435
437
|
var U;
|
|
436
|
-
return
|
|
437
|
-
}) ?? null : null,
|
|
438
|
-
return
|
|
438
|
+
return S.id === ((U = o.sku.convert) == null ? void 0 : U.measurement);
|
|
439
|
+
}) ?? null : null, s = je(o.sku.unit, t), f = bt(+y);
|
|
440
|
+
return Ze(f).isInteger().max(s).error ? "Precision cannot be more than " + s : !0;
|
|
439
441
|
}
|
|
440
|
-
const
|
|
442
|
+
const B = H(
|
|
441
443
|
() => {
|
|
442
|
-
var
|
|
443
|
-
return (
|
|
444
|
+
var y, t;
|
|
445
|
+
return (y = o.sku.convert) != null && y.measurement ? (t = o.sku.unit.measurements.find((s) => {
|
|
444
446
|
var f;
|
|
445
|
-
return
|
|
446
|
-
})) == null ? void 0 : t.abbrev :
|
|
447
|
+
return s.id === ((f = o.sku.convert) == null ? void 0 : f.measurement);
|
|
448
|
+
})) == null ? void 0 : t.abbrev : o.sku.unit.abbrev;
|
|
447
449
|
}
|
|
448
|
-
),
|
|
449
|
-
var f,
|
|
450
|
+
), M = H(() => {
|
|
451
|
+
var f, m;
|
|
450
452
|
const t = vt({
|
|
451
|
-
bindings: ((f =
|
|
452
|
-
skus:
|
|
453
|
-
skuGroups:
|
|
454
|
-
recipes:
|
|
453
|
+
bindings: ((f = o.sku.convert) == null ? void 0 : f.inventoryBindings) ?? [],
|
|
454
|
+
skus: d.skus,
|
|
455
|
+
skuGroups: d.skuGroups,
|
|
456
|
+
recipes: d.recipes
|
|
455
457
|
}).inventoryBindings.filter((a) => "success" in a && a.success).map((a) => a).map((a) => a.binding);
|
|
456
|
-
return (
|
|
457
|
-
var ae, re, q, ee,
|
|
458
|
-
const
|
|
459
|
-
var
|
|
460
|
-
return
|
|
461
|
-
}) ?? null : null, se = je(
|
|
458
|
+
return (m = l.value ?? t) == null ? void 0 : m.map((a) => {
|
|
459
|
+
var ae, re, q, ee, Ye;
|
|
460
|
+
const S = d.skus.find((fe) => fe._id === a.id), U = ((ae = a.measurement) == null ? void 0 : ae.abbrev) ?? ((re = S == null ? void 0 : S.unit) == null ? void 0 : re.abbrev), z = (q = o.sku.convert) != null && q.measurement ? o.sku.unit.measurements.find((fe) => {
|
|
461
|
+
var Ke;
|
|
462
|
+
return fe.id === ((Ke = o.sku.convert) == null ? void 0 : Ke.measurement);
|
|
463
|
+
}) ?? null : null, se = je(o.sku.unit, z), T = w(`${c.value}`) === !0 ? me(
|
|
462
464
|
ft(
|
|
463
465
|
a.amount,
|
|
464
|
-
Se(+
|
|
466
|
+
Se(+c.value, se)
|
|
465
467
|
),
|
|
466
468
|
!1
|
|
467
|
-
) : "0", G = (
|
|
469
|
+
) : "0", G = (Ye = (ee = l.value) == null ? void 0 : ee.find((fe) => fe.id === (S == null ? void 0 : S._id))) == null ? void 0 : Ye.amount, W = G ? me(G, !1) : null;
|
|
468
470
|
return {
|
|
469
|
-
sku:
|
|
471
|
+
sku: S,
|
|
470
472
|
convertAmount: W ?? T,
|
|
471
473
|
abbrev: U
|
|
472
474
|
};
|
|
473
475
|
});
|
|
474
476
|
}), E = N();
|
|
475
|
-
|
|
477
|
+
g({
|
|
476
478
|
validateInputs: () => {
|
|
477
|
-
var
|
|
478
|
-
(t = (
|
|
479
|
+
var y, t;
|
|
480
|
+
(t = (y = E.value) == null ? void 0 : y.validateInputs) == null || t.call(y);
|
|
479
481
|
},
|
|
480
482
|
resetInputsValidation: () => {
|
|
481
|
-
var
|
|
482
|
-
(t = (
|
|
483
|
+
var y, t;
|
|
484
|
+
(t = (y = E.value) == null ? void 0 : y.resetInputsValidation) == null || t.call(y);
|
|
483
485
|
},
|
|
484
486
|
resetInputs: () => {
|
|
485
|
-
var
|
|
486
|
-
(t = (
|
|
487
|
+
var y, t;
|
|
488
|
+
(t = (y = E.value) == null ? void 0 : y.resetInputs) == null || t.call(y);
|
|
487
489
|
}
|
|
488
490
|
});
|
|
489
|
-
const P =
|
|
490
|
-
async function
|
|
491
|
+
const P = ze(o, "show");
|
|
492
|
+
async function J(y, t, s) {
|
|
491
493
|
V.value = !0;
|
|
492
494
|
try {
|
|
493
|
-
await
|
|
495
|
+
await i.convertSku({
|
|
494
496
|
conversions: [
|
|
495
497
|
{
|
|
496
|
-
doc:
|
|
498
|
+
doc: y,
|
|
497
499
|
amount: t,
|
|
498
|
-
overrides:
|
|
500
|
+
overrides: s == null ? void 0 : s.map((f) => ({
|
|
499
501
|
...f,
|
|
500
502
|
amount: {
|
|
501
503
|
...f.amount,
|
|
@@ -505,164 +507,164 @@ const an = { class: "flex items-center" }, ln = { class: "fm-typo-en-title-md-80
|
|
|
505
507
|
}))
|
|
506
508
|
}
|
|
507
509
|
]
|
|
508
|
-
}),
|
|
510
|
+
}), j("update:show", !1), j("submitted");
|
|
509
511
|
} catch (f) {
|
|
510
|
-
|
|
512
|
+
x.open({
|
|
511
513
|
title: "Something went wrong",
|
|
512
|
-
message: `Cannot convert ${
|
|
514
|
+
message: `Cannot convert ${y.name}. Please try again.`,
|
|
513
515
|
type: "error"
|
|
514
|
-
}), console.error("error at converting stock amount",
|
|
516
|
+
}), console.error("error at converting stock amount", y, t, f);
|
|
515
517
|
} finally {
|
|
516
518
|
V.value = !1;
|
|
517
519
|
}
|
|
518
520
|
}
|
|
519
|
-
function
|
|
521
|
+
function Q(y, t, s) {
|
|
520
522
|
const f = +t;
|
|
521
|
-
let
|
|
522
|
-
t.length > 0 && isFinite(f) ?
|
|
523
|
+
let m = s;
|
|
524
|
+
t.length > 0 && isFinite(f) ? m = s.map((a) => (a.id !== y || (a.amount = ye(f)), a)) : m = s.map((a) => (a.id !== y || (a.amount = { amount: 0, precision: 0 }), a)), l.value = m;
|
|
523
525
|
}
|
|
524
|
-
function R(
|
|
525
|
-
const t =
|
|
526
|
-
return t ?
|
|
526
|
+
function R(y) {
|
|
527
|
+
const t = v.value.find((s) => s._id === y);
|
|
528
|
+
return t ? lt(t.unit, !0) : [];
|
|
527
529
|
}
|
|
528
|
-
function oe(
|
|
529
|
-
const
|
|
530
|
+
function oe(y, t) {
|
|
531
|
+
const s = R(y), f = s.find((m) => m.value === t) ?? s.find((m) => m.value === null);
|
|
530
532
|
return f ? {
|
|
531
533
|
...f,
|
|
532
534
|
label: f.abbrev
|
|
533
535
|
} : null;
|
|
534
536
|
}
|
|
535
|
-
function L(
|
|
537
|
+
function L(y, t, s) {
|
|
536
538
|
let f;
|
|
537
539
|
if (t === null)
|
|
538
|
-
f =
|
|
540
|
+
f = s.map((m) => (m.id !== y || (m.measurement = null), m)) ?? [];
|
|
539
541
|
else {
|
|
540
|
-
const
|
|
541
|
-
f =
|
|
542
|
-
var
|
|
543
|
-
return a.id !==
|
|
542
|
+
const m = v.value.find((a) => a._id === y);
|
|
543
|
+
f = s.map((a) => {
|
|
544
|
+
var S, U;
|
|
545
|
+
return a.id !== y || (a.measurement = (U = (S = m == null ? void 0 : m.unit) == null ? void 0 : S.measurements) == null ? void 0 : U.find((z) => z.id === t)), a;
|
|
544
546
|
}) ?? [];
|
|
545
547
|
}
|
|
546
548
|
l.value = f;
|
|
547
549
|
}
|
|
548
|
-
function Y(
|
|
549
|
-
const
|
|
550
|
-
l.value =
|
|
550
|
+
function Y(y, t) {
|
|
551
|
+
const s = t.filter((f) => f.id !== y);
|
|
552
|
+
l.value = s;
|
|
551
553
|
}
|
|
552
554
|
function le() {
|
|
553
|
-
const
|
|
555
|
+
const y = (l.value ?? []).map((t) => ({
|
|
554
556
|
...t,
|
|
555
|
-
type:
|
|
557
|
+
type: We.enum.SKU
|
|
556
558
|
}));
|
|
557
|
-
|
|
558
|
-
|
|
559
|
+
h.promptIngredientsBinding(
|
|
560
|
+
y,
|
|
559
561
|
(t) => l.value = t,
|
|
560
|
-
|
|
562
|
+
o.sku._id
|
|
561
563
|
);
|
|
562
564
|
}
|
|
563
565
|
return xe(
|
|
564
|
-
() =>
|
|
565
|
-
(
|
|
566
|
-
|
|
566
|
+
() => o.show,
|
|
567
|
+
(y) => {
|
|
568
|
+
y || (l.value = null, c.value = 0);
|
|
567
569
|
}
|
|
568
|
-
), (
|
|
569
|
-
const
|
|
570
|
+
), (y, t) => {
|
|
571
|
+
const s = D("FmTextField"), f = D("FmForm"), m = D("FmCard"), a = D("FmSwitch"), S = D("FmFormGroup"), U = D("FmSelect"), z = D("FmButton"), se = D("FmSideSheet");
|
|
570
572
|
return F(), K(se, {
|
|
571
573
|
"dismiss-away": "",
|
|
572
574
|
modelValue: u(P),
|
|
573
575
|
"onUpdate:modelValue": t[3] || (t[3] = (T) => Ue(P) ? P.value = T : null),
|
|
574
576
|
"max-width": 500
|
|
575
577
|
}, {
|
|
576
|
-
"side-sheet-header":
|
|
578
|
+
"side-sheet-header": I(() => [
|
|
577
579
|
e("div", an, [
|
|
578
|
-
e("div", ln,
|
|
580
|
+
e("div", ln, _(u(C)("inventory.stock.convert.title", { name: y.sku.name })), 1)
|
|
579
581
|
])
|
|
580
582
|
]),
|
|
581
|
-
default:
|
|
583
|
+
default: I(() => [
|
|
582
584
|
e("div", rn, [
|
|
583
|
-
|
|
585
|
+
k(f, {
|
|
584
586
|
ref_key: "formRef",
|
|
585
587
|
ref: E,
|
|
586
588
|
onValidationSuccess: n
|
|
587
589
|
}, {
|
|
588
|
-
default:
|
|
589
|
-
|
|
590
|
+
default: I(() => [
|
|
591
|
+
k(s, {
|
|
590
592
|
disabled: V.value,
|
|
591
|
-
"model-value":
|
|
592
|
-
"onUpdate:modelValue": t[0] || (t[0] = (T) =>
|
|
593
|
-
label: u(
|
|
593
|
+
"model-value": c.value,
|
|
594
|
+
"onUpdate:modelValue": t[0] || (t[0] = (T) => c.value = T),
|
|
595
|
+
label: u(C)("inventory.stock.convert.amount"),
|
|
594
596
|
rules: [r, w, u(Fe)(0)],
|
|
595
|
-
"append-text":
|
|
596
|
-
"helper-text": l.value ? void 0 : `Max ${
|
|
597
|
+
"append-text": B.value,
|
|
598
|
+
"helper-text": l.value ? void 0 : `Max ${y.maxCount} ${B.value}`
|
|
597
599
|
}, null, 8, ["disabled", "model-value", "label", "rules", "append-text", "helper-text"])
|
|
598
600
|
]),
|
|
599
601
|
_: 1
|
|
600
602
|
}, 512),
|
|
601
|
-
|
|
603
|
+
k(m, {
|
|
602
604
|
variant: "outlined",
|
|
603
605
|
class: "p-16"
|
|
604
606
|
}, {
|
|
605
|
-
default:
|
|
607
|
+
default: I(() => [
|
|
606
608
|
e("div", un, [
|
|
607
|
-
e("div", cn,
|
|
608
|
-
(F(!0), O(Z, null, ie(
|
|
609
|
+
e("div", cn, _(u(C)("inventory.stock.convert.deductionSummary")), 1),
|
|
610
|
+
(F(!0), O(Z, null, ie(M.value, (T) => {
|
|
609
611
|
var G, W;
|
|
610
612
|
return F(), O("div", {
|
|
611
613
|
key: (G = T.sku) == null ? void 0 : G._id,
|
|
612
614
|
class: "flex items-center"
|
|
613
615
|
}, [
|
|
614
|
-
e("div", dn,
|
|
615
|
-
e("div", mn, " -" +
|
|
616
|
+
e("div", dn, _((W = T.sku) == null ? void 0 : W.name), 1),
|
|
617
|
+
e("div", mn, " -" + _(T.convertAmount) + " " + _(T.abbrev), 1)
|
|
616
618
|
]);
|
|
617
619
|
}), 128))
|
|
618
620
|
])
|
|
619
621
|
]),
|
|
620
622
|
_: 1
|
|
621
623
|
}),
|
|
622
|
-
|
|
623
|
-
default:
|
|
624
|
+
k(m, { variant: "outlined" }, {
|
|
625
|
+
default: I(() => [
|
|
624
626
|
e("div", pn, [
|
|
625
|
-
|
|
627
|
+
k(a, {
|
|
626
628
|
value: "",
|
|
627
629
|
modelValue: A.value,
|
|
628
630
|
"onUpdate:modelValue": t[1] || (t[1] = (T) => A.value = T),
|
|
629
|
-
label: u(
|
|
631
|
+
label: u(C)("inventory.stock.convert.overrideDeduction"),
|
|
630
632
|
"label-placement": "right"
|
|
631
633
|
}, null, 8, ["modelValue", "label"]),
|
|
632
634
|
A.value ? (F(), O(Z, { key: 0 }, [
|
|
633
|
-
|
|
635
|
+
k(S, {
|
|
634
636
|
modelValue: l.value,
|
|
635
637
|
rules: [u(yt)(1, "Must have at least one ingredient binding")]
|
|
636
638
|
}, null, 8, ["modelValue", "rules"]),
|
|
637
639
|
e("div", vn, [
|
|
638
|
-
e("div", fn,
|
|
639
|
-
(F(!0), O(Z, null, ie(l.value, (T) => (F(), K(
|
|
640
|
+
e("div", fn, _(u(C)("inventory.stock.convert.ingredients")), 1),
|
|
641
|
+
(F(!0), O(Z, null, ie(l.value, (T) => (F(), K(S, {
|
|
640
642
|
key: T.id,
|
|
641
643
|
disabled: V.value,
|
|
642
644
|
modelValue: +u(me)(T.amount ?? { amount: 1, precision: 0 }),
|
|
643
645
|
rules: [
|
|
644
646
|
u(_t)(
|
|
645
|
-
|
|
647
|
+
v.value.find((G) => G._id === T.id).unit,
|
|
646
648
|
T.measurement
|
|
647
649
|
),
|
|
648
650
|
u(Fe)(0)
|
|
649
651
|
]
|
|
650
652
|
}, {
|
|
651
|
-
default:
|
|
653
|
+
default: I(({ invalid: G }) => {
|
|
652
654
|
var W, ae, re;
|
|
653
655
|
return [
|
|
654
656
|
e("div", yn, [
|
|
655
|
-
e("div", _n,
|
|
656
|
-
|
|
657
|
+
e("div", _n, _((W = v.value.find((q) => q._id === T.id)) == null ? void 0 : W.name), 1),
|
|
658
|
+
k(s, {
|
|
657
659
|
class: "xs:col-span-2",
|
|
658
660
|
disabled: V.value,
|
|
659
661
|
modelValue: +u(me)(
|
|
660
662
|
T.amount ?? { amount: 1, precision: 0 }
|
|
661
663
|
),
|
|
662
|
-
"onUpdate:modelValue": (q) =>
|
|
664
|
+
"onUpdate:modelValue": (q) => Q(T.id, q, l.value ?? []),
|
|
663
665
|
invalid: G
|
|
664
666
|
}, null, 8, ["disabled", "modelValue", "onUpdate:modelValue", "invalid"]),
|
|
665
|
-
|
|
667
|
+
k(U, {
|
|
666
668
|
disabled: V.value,
|
|
667
669
|
class: "translate-y-[2px]",
|
|
668
670
|
items: R(T.id),
|
|
@@ -670,10 +672,10 @@ const an = { class: "flex items-center" }, ln = { class: "fm-typo-en-title-md-80
|
|
|
670
672
|
"onUpdate:modelValue": (q) => L(T.id, q, l.value ?? []),
|
|
671
673
|
invalid: G
|
|
672
674
|
}, {
|
|
673
|
-
"helper-text":
|
|
675
|
+
"helper-text": I(() => t[4] || (t[4] = [])),
|
|
674
676
|
_: 2
|
|
675
677
|
}, 1032, ["disabled", "items", "model-value", "onUpdate:modelValue", "invalid"]),
|
|
676
|
-
|
|
678
|
+
k(z, {
|
|
677
679
|
disabled: V.value,
|
|
678
680
|
type: "button",
|
|
679
681
|
variant: "tertiary",
|
|
@@ -687,9 +689,9 @@ const an = { class: "flex items-center" }, ln = { class: "fm-typo-en-title-md-80
|
|
|
687
689
|
}, 1032, ["disabled", "modelValue", "rules"]))), 128))
|
|
688
690
|
]),
|
|
689
691
|
e("div", null, [
|
|
690
|
-
|
|
692
|
+
k(z, {
|
|
691
693
|
icon: "link",
|
|
692
|
-
label: u(
|
|
694
|
+
label: u(C)("inventory.stock.convert.linkIngredient"),
|
|
693
695
|
variant: "plain",
|
|
694
696
|
onClick: le
|
|
695
697
|
}, null, 8, ["label"])
|
|
@@ -701,11 +703,11 @@ const an = { class: "flex items-center" }, ln = { class: "fm-typo-en-title-md-80
|
|
|
701
703
|
})
|
|
702
704
|
])
|
|
703
705
|
]),
|
|
704
|
-
"side-sheet-footer":
|
|
706
|
+
"side-sheet-footer": I(() => [
|
|
705
707
|
e("div", bn, [
|
|
706
|
-
|
|
708
|
+
k(z, {
|
|
707
709
|
loading: V.value,
|
|
708
|
-
label: u(
|
|
710
|
+
label: u(C)("inventory.stock.convert.convertButton"),
|
|
709
711
|
onClick: t[2] || (t[2] = (T) => {
|
|
710
712
|
var G, W;
|
|
711
713
|
return (W = (G = E.value) == null ? void 0 : G.validateInputs) == null ? void 0 : W.call(G);
|
|
@@ -718,12 +720,12 @@ const an = { class: "flex items-center" }, ln = { class: "fm-typo-en-title-md-80
|
|
|
718
720
|
};
|
|
719
721
|
}
|
|
720
722
|
});
|
|
721
|
-
function De(
|
|
722
|
-
const
|
|
723
|
-
return { ...
|
|
723
|
+
function De(b, g) {
|
|
724
|
+
const p = Se(b, g);
|
|
725
|
+
return { ...p, amount: -p.amount };
|
|
724
726
|
}
|
|
725
|
-
function
|
|
726
|
-
return Se(Math.abs(
|
|
727
|
+
function et(b, g) {
|
|
728
|
+
return Se(Math.abs(b), g);
|
|
727
729
|
}
|
|
728
730
|
const Ie = {
|
|
729
731
|
[ne.enum.DAMAGE]: {
|
|
@@ -740,11 +742,11 @@ const Ie = {
|
|
|
740
742
|
},
|
|
741
743
|
[ne.enum.EXTRA]: {
|
|
742
744
|
label: "Extra",
|
|
743
|
-
toAdjustmentAmount:
|
|
745
|
+
toAdjustmentAmount: et
|
|
744
746
|
},
|
|
745
747
|
[ne.enum.PURCHASE]: {
|
|
746
748
|
label: "Purchase",
|
|
747
|
-
toAdjustmentAmount:
|
|
749
|
+
toAdjustmentAmount: et
|
|
748
750
|
}
|
|
749
751
|
}, gn = { class: "col-span-2 flex" }, hn = { class: "fm-typo-en-body-lg-600 flex-1" }, xn = /* @__PURE__ */ ce({
|
|
750
752
|
__name: "AdjustedItemForm",
|
|
@@ -753,113 +755,113 @@ const Ie = {
|
|
|
753
755
|
disabled: { type: Boolean }
|
|
754
756
|
},
|
|
755
757
|
emits: ["update:modelValue", "click:delete"],
|
|
756
|
-
setup(
|
|
757
|
-
const
|
|
758
|
-
() => Object.keys(Ie).map((
|
|
759
|
-
label: kt(
|
|
760
|
-
value:
|
|
758
|
+
setup(b, { emit: g }) {
|
|
759
|
+
const p = b, o = g, j = H(
|
|
760
|
+
() => Object.keys(Ie).map((c) => ({
|
|
761
|
+
label: kt(c),
|
|
762
|
+
value: c
|
|
761
763
|
}))
|
|
762
|
-
),
|
|
764
|
+
), h = H(() => lt(p.modelValue.doc.unit, !0)), d = H({
|
|
763
765
|
get() {
|
|
764
|
-
return
|
|
766
|
+
return p.modelValue.type ?? ne.enum.PURCHASE;
|
|
765
767
|
},
|
|
766
|
-
set(
|
|
768
|
+
set(c) {
|
|
767
769
|
const l = {
|
|
768
|
-
...
|
|
770
|
+
...p.modelValue
|
|
769
771
|
};
|
|
770
|
-
l.type =
|
|
771
|
-
const
|
|
772
|
+
l.type = c;
|
|
773
|
+
const v = qe(p.modelValue.amount);
|
|
772
774
|
l.amount = Ie[l.type].toAdjustmentAmount(
|
|
773
|
-
+me(
|
|
774
|
-
|
|
775
|
-
),
|
|
775
|
+
+me(v),
|
|
776
|
+
v.precision
|
|
777
|
+
), o("update:modelValue", l);
|
|
776
778
|
}
|
|
777
|
-
}),
|
|
779
|
+
}), i = H({
|
|
778
780
|
get() {
|
|
779
|
-
const
|
|
780
|
-
return +me(
|
|
781
|
+
const c = qe(p.modelValue.amount);
|
|
782
|
+
return +me(c);
|
|
781
783
|
},
|
|
782
|
-
set(
|
|
784
|
+
set(c) {
|
|
783
785
|
const l = {
|
|
784
|
-
...
|
|
785
|
-
},
|
|
786
|
-
l.amount = Ie[
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
),
|
|
786
|
+
...p.modelValue
|
|
787
|
+
}, v = ye(c);
|
|
788
|
+
l.amount = Ie[d.value].toAdjustmentAmount(
|
|
789
|
+
c,
|
|
790
|
+
v.precision
|
|
791
|
+
), o("update:modelValue", l);
|
|
790
792
|
}
|
|
791
|
-
}),
|
|
793
|
+
}), x = H({
|
|
792
794
|
get() {
|
|
793
|
-
var
|
|
794
|
-
return ((
|
|
795
|
+
var c;
|
|
796
|
+
return ((c = p.modelValue.measurement) == null ? void 0 : c.id) ?? null;
|
|
795
797
|
},
|
|
796
|
-
set(
|
|
797
|
-
var
|
|
798
|
+
set(c) {
|
|
799
|
+
var v, $;
|
|
798
800
|
const l = {
|
|
799
|
-
...
|
|
801
|
+
...p.modelValue
|
|
800
802
|
};
|
|
801
|
-
l.measurement = ((
|
|
803
|
+
l.measurement = (($ = (v = p.modelValue.doc.unit) == null ? void 0 : v.measurements) == null ? void 0 : $.find((A) => A.id === c)) ?? null, o("update:modelValue", l);
|
|
802
804
|
}
|
|
803
|
-
}),
|
|
805
|
+
}), C = H({
|
|
804
806
|
get() {
|
|
805
|
-
return
|
|
807
|
+
return p.modelValue.remark ?? "";
|
|
806
808
|
},
|
|
807
|
-
set(
|
|
809
|
+
set(c) {
|
|
808
810
|
const l = {
|
|
809
|
-
...
|
|
811
|
+
...p.modelValue
|
|
810
812
|
};
|
|
811
|
-
l.remark =
|
|
813
|
+
l.remark = c, o("update:modelValue", l);
|
|
812
814
|
}
|
|
813
815
|
});
|
|
814
|
-
return (
|
|
815
|
-
const
|
|
816
|
+
return (c, l) => {
|
|
817
|
+
const v = D("FmButton"), $ = D("FmSelect"), A = D("FmTextarea"), V = D("FmCard");
|
|
816
818
|
return F(), K(V, {
|
|
817
819
|
variant: "outlined",
|
|
818
820
|
class: "grid grid-cols-2 gap-8 p-16"
|
|
819
821
|
}, {
|
|
820
|
-
default:
|
|
822
|
+
default: I(() => [
|
|
821
823
|
e("div", gn, [
|
|
822
|
-
e("div", hn,
|
|
823
|
-
|
|
824
|
+
e("div", hn, _(c.modelValue.doc.name), 1),
|
|
825
|
+
k(v, {
|
|
824
826
|
variant: "tertiary",
|
|
825
827
|
"prepend-icon": "delete",
|
|
826
|
-
onClick: l[0] || (l[0] = (n) =>
|
|
828
|
+
onClick: l[0] || (l[0] = (n) => o("click:delete"))
|
|
827
829
|
})
|
|
828
830
|
]),
|
|
829
|
-
|
|
830
|
-
disabled:
|
|
831
|
+
k($, {
|
|
832
|
+
disabled: c.disabled,
|
|
831
833
|
class: "col-span-2",
|
|
832
834
|
label: "Type",
|
|
833
|
-
items:
|
|
834
|
-
modelValue:
|
|
835
|
-
"onUpdate:modelValue": l[1] || (l[1] = (n) =>
|
|
835
|
+
items: j.value,
|
|
836
|
+
modelValue: d.value,
|
|
837
|
+
"onUpdate:modelValue": l[1] || (l[1] = (n) => d.value = n),
|
|
836
838
|
rules: [u(gt)()],
|
|
837
839
|
"label-mark": "required"
|
|
838
840
|
}, null, 8, ["disabled", "items", "modelValue", "rules"]),
|
|
839
|
-
|
|
840
|
-
disabled:
|
|
841
|
+
k(qt, {
|
|
842
|
+
disabled: c.disabled,
|
|
841
843
|
label: "Amount",
|
|
842
844
|
step: +u(me)({
|
|
843
845
|
amount: 1,
|
|
844
|
-
precision: u(je)(
|
|
846
|
+
precision: u(je)(c.modelValue.doc.unit, c.modelValue.measurement)
|
|
845
847
|
}),
|
|
846
|
-
modelValue:
|
|
847
|
-
"onUpdate:modelValue": l[2] || (l[2] = (n) =>
|
|
848
|
+
modelValue: i.value,
|
|
849
|
+
"onUpdate:modelValue": l[2] || (l[2] = (n) => i.value = n),
|
|
848
850
|
rules: [u(Fe)(0)]
|
|
849
851
|
}, null, 8, ["disabled", "step", "modelValue", "rules"]),
|
|
850
|
-
|
|
851
|
-
disabled:
|
|
852
|
+
k($, {
|
|
853
|
+
disabled: c.disabled,
|
|
852
854
|
label: "Unit",
|
|
853
|
-
items:
|
|
854
|
-
modelValue:
|
|
855
|
-
"onUpdate:modelValue": l[3] || (l[3] = (n) =>
|
|
855
|
+
items: h.value,
|
|
856
|
+
modelValue: x.value,
|
|
857
|
+
"onUpdate:modelValue": l[3] || (l[3] = (n) => x.value = n)
|
|
856
858
|
}, null, 8, ["disabled", "items", "modelValue"]),
|
|
857
|
-
|
|
859
|
+
k(A, {
|
|
858
860
|
class: "col-span-2",
|
|
859
|
-
disabled:
|
|
861
|
+
disabled: c.disabled,
|
|
860
862
|
label: "Remark",
|
|
861
|
-
modelValue:
|
|
862
|
-
"onUpdate:modelValue": l[4] || (l[4] = (n) =>
|
|
863
|
+
modelValue: C.value,
|
|
864
|
+
"onUpdate:modelValue": l[4] || (l[4] = (n) => C.value = n),
|
|
863
865
|
"label-mark": "optional"
|
|
864
866
|
}, null, 8, ["disabled", "modelValue"])
|
|
865
867
|
]),
|
|
@@ -874,45 +876,45 @@ const Ie = {
|
|
|
874
876
|
show: { type: Boolean }
|
|
875
877
|
},
|
|
876
878
|
emits: ["update:show", "submitted"],
|
|
877
|
-
setup(
|
|
878
|
-
const
|
|
879
|
+
setup(b, { expose: g, emit: p }) {
|
|
880
|
+
const o = b, j = p, h = Re(), d = Le(), i = _e(), x = be(), C = N(!1), { t: c } = de();
|
|
879
881
|
function l() {
|
|
880
882
|
V(He(A));
|
|
881
883
|
}
|
|
882
|
-
const
|
|
883
|
-
|
|
884
|
+
const v = N();
|
|
885
|
+
g({
|
|
884
886
|
validateInputs: () => {
|
|
885
|
-
var w,
|
|
886
|
-
(
|
|
887
|
+
var w, B;
|
|
888
|
+
(B = (w = v.value) == null ? void 0 : w.validateInputs) == null || B.call(w);
|
|
887
889
|
},
|
|
888
890
|
resetInputsValidation: () => {
|
|
889
|
-
var w,
|
|
890
|
-
(
|
|
891
|
+
var w, B;
|
|
892
|
+
(B = (w = v.value) == null ? void 0 : w.resetInputsValidation) == null || B.call(w);
|
|
891
893
|
},
|
|
892
894
|
resetInputs: () => {
|
|
893
|
-
var w,
|
|
894
|
-
(
|
|
895
|
+
var w, B;
|
|
896
|
+
(B = (w = v.value) == null ? void 0 : w.resetInputs) == null || B.call(w);
|
|
895
897
|
}
|
|
896
898
|
});
|
|
897
|
-
const
|
|
899
|
+
const $ = ze(o, "show"), A = ut({
|
|
898
900
|
remark: "",
|
|
899
901
|
adjustments: [
|
|
900
902
|
{
|
|
901
903
|
id: `sku_${(/* @__PURE__ */ new Date()).toISOString()}_${Math.random().toString(16).slice(2, 8)}`,
|
|
902
904
|
type: ne.enum.PURCHASE,
|
|
903
|
-
doc:
|
|
905
|
+
doc: o.stock,
|
|
904
906
|
measurement: null,
|
|
905
907
|
remark: "",
|
|
906
908
|
amount: ye(1)
|
|
907
909
|
}
|
|
908
910
|
]
|
|
909
911
|
});
|
|
910
|
-
xe([() =>
|
|
912
|
+
xe([() => o.show], ([w]) => {
|
|
911
913
|
w && (A.remark = "", A.adjustments = [
|
|
912
914
|
{
|
|
913
915
|
id: `sku_${(/* @__PURE__ */ new Date()).toISOString()}_${Math.random().toString(16).slice(2, 8)}`,
|
|
914
916
|
type: ne.enum.PURCHASE,
|
|
915
|
-
doc:
|
|
917
|
+
doc: o.stock,
|
|
916
918
|
measurement: null,
|
|
917
919
|
remark: "",
|
|
918
920
|
amount: ye(1)
|
|
@@ -920,41 +922,41 @@ const Ie = {
|
|
|
920
922
|
]);
|
|
921
923
|
});
|
|
922
924
|
async function V(w) {
|
|
923
|
-
|
|
925
|
+
C.value = !0;
|
|
924
926
|
try {
|
|
925
|
-
await
|
|
927
|
+
await i.adjustSku({
|
|
926
928
|
remark: w.remark,
|
|
927
|
-
adjustments: w.adjustments.map(({ doc:
|
|
928
|
-
id:
|
|
929
|
+
adjustments: w.adjustments.map(({ doc: B, remark: M, type: E, amount: P, measurement: J }) => ({
|
|
930
|
+
id: B._id,
|
|
929
931
|
amount: P,
|
|
930
|
-
measurement:
|
|
931
|
-
remark:
|
|
932
|
-
doc:
|
|
932
|
+
measurement: J,
|
|
933
|
+
remark: M,
|
|
934
|
+
doc: B,
|
|
933
935
|
type: E
|
|
934
936
|
}))
|
|
935
|
-
}),
|
|
936
|
-
} catch (
|
|
937
|
-
|
|
938
|
-
title:
|
|
939
|
-
message:
|
|
937
|
+
}), j("update:show", !1), j("submitted");
|
|
938
|
+
} catch (B) {
|
|
939
|
+
x.open({
|
|
940
|
+
title: c("inventory.stock.adjust.error.title"),
|
|
941
|
+
message: c("inventory.stock.adjust.error.message"),
|
|
940
942
|
type: "error"
|
|
941
|
-
}), console.log("error on adjust ingredients", w,
|
|
943
|
+
}), console.log("error on adjust ingredients", w, B);
|
|
942
944
|
} finally {
|
|
943
|
-
|
|
945
|
+
C.value = !1;
|
|
944
946
|
}
|
|
945
947
|
}
|
|
946
948
|
function n() {
|
|
947
|
-
const w =
|
|
948
|
-
label:
|
|
949
|
-
sublabel:
|
|
950
|
-
value:
|
|
951
|
-
})),
|
|
952
|
-
|
|
949
|
+
const w = h.skus.map((M) => ({
|
|
950
|
+
label: M.name,
|
|
951
|
+
sublabel: M.code,
|
|
952
|
+
value: M._id
|
|
953
|
+
})), B = w.filter((M) => A.adjustments.find((E) => E.doc._id === M.value)).map((M) => M.value);
|
|
954
|
+
d.open({
|
|
953
955
|
title: "Select ingredients",
|
|
954
956
|
contentComponent: ht,
|
|
955
957
|
contentComponentProps: {
|
|
956
958
|
items: w,
|
|
957
|
-
modelValue:
|
|
959
|
+
modelValue: B
|
|
958
960
|
},
|
|
959
961
|
overlay: !0,
|
|
960
962
|
closeButton: !0,
|
|
@@ -968,12 +970,12 @@ const Ie = {
|
|
|
968
970
|
close: !0,
|
|
969
971
|
variant: "tertiary"
|
|
970
972
|
}
|
|
971
|
-
}).onPrimary((
|
|
972
|
-
A.adjustments =
|
|
973
|
+
}).onPrimary((M) => {
|
|
974
|
+
A.adjustments = M.map(
|
|
973
975
|
(E) => A.adjustments.find((P) => P.doc._id === E) ?? {
|
|
974
976
|
id: `sku_${(/* @__PURE__ */ new Date()).toISOString()}_${Math.random().toString(16).slice(2, 8)}`,
|
|
975
977
|
type: ne.enum.PURCHASE,
|
|
976
|
-
doc:
|
|
978
|
+
doc: h.skus.find((P) => P._id === E),
|
|
977
979
|
measurement: null,
|
|
978
980
|
remark: "",
|
|
979
981
|
amount: ye(1)
|
|
@@ -984,43 +986,43 @@ const Ie = {
|
|
|
984
986
|
function r(w) {
|
|
985
987
|
A.adjustments.splice(w, 1);
|
|
986
988
|
}
|
|
987
|
-
return (w,
|
|
988
|
-
const
|
|
989
|
-
return F(), K(
|
|
990
|
-
modelValue: u(
|
|
991
|
-
"onUpdate:modelValue":
|
|
989
|
+
return (w, B) => {
|
|
990
|
+
const M = D("FmTextarea"), E = D("FmButton"), P = D("FmForm"), J = D("FmSideSheet");
|
|
991
|
+
return F(), K(J, {
|
|
992
|
+
modelValue: u($),
|
|
993
|
+
"onUpdate:modelValue": B[2] || (B[2] = (Q) => Ue($) ? $.value = Q : null),
|
|
992
994
|
"dismiss-away": "",
|
|
993
995
|
"max-width": 500
|
|
994
996
|
}, {
|
|
995
|
-
"side-sheet-header":
|
|
997
|
+
"side-sheet-header": I(() => [
|
|
996
998
|
e("div", Sn, [
|
|
997
|
-
e("div", Fn,
|
|
999
|
+
e("div", Fn, _(u(c)("inventory.stock.adjust.title")), 1)
|
|
998
1000
|
])
|
|
999
1001
|
]),
|
|
1000
|
-
default:
|
|
1001
|
-
|
|
1002
|
+
default: I(() => [
|
|
1003
|
+
k(P, {
|
|
1002
1004
|
class: "w-full flex flex-col gap-12",
|
|
1003
1005
|
ref_key: "formRef",
|
|
1004
|
-
ref:
|
|
1006
|
+
ref: v,
|
|
1005
1007
|
onValidationSuccess: l
|
|
1006
1008
|
}, {
|
|
1007
|
-
default:
|
|
1008
|
-
|
|
1009
|
-
label: u(
|
|
1009
|
+
default: I(() => [
|
|
1010
|
+
k(M, {
|
|
1011
|
+
label: u(c)("inventory.stock.adjust.remark"),
|
|
1010
1012
|
modelValue: A.remark,
|
|
1011
|
-
"onUpdate:modelValue":
|
|
1013
|
+
"onUpdate:modelValue": B[0] || (B[0] = (Q) => A.remark = Q)
|
|
1012
1014
|
}, null, 8, ["label", "modelValue"]),
|
|
1013
1015
|
e("div", wn, [
|
|
1014
|
-
e("div", $n,
|
|
1015
|
-
|
|
1016
|
+
e("div", $n, _(u(c)("inventory.stock.adjust.adjustedItems")), 1),
|
|
1017
|
+
k(E, {
|
|
1016
1018
|
"prepend-icon": "add",
|
|
1017
1019
|
variant: "tertiary",
|
|
1018
1020
|
size: "md",
|
|
1019
1021
|
onClick: n
|
|
1020
1022
|
})
|
|
1021
1023
|
]),
|
|
1022
|
-
(F(!0), O(Z, null, ie(A.adjustments, (
|
|
1023
|
-
key:
|
|
1024
|
+
(F(!0), O(Z, null, ie(A.adjustments, (Q, R) => (F(), K(xn, {
|
|
1025
|
+
key: Q.id,
|
|
1024
1026
|
modelValue: A.adjustments[R],
|
|
1025
1027
|
"onUpdate:modelValue": (oe) => A.adjustments[R] = oe,
|
|
1026
1028
|
"onClick:delete": (oe) => r(R)
|
|
@@ -1029,14 +1031,14 @@ const Ie = {
|
|
|
1029
1031
|
_: 1
|
|
1030
1032
|
}, 512)
|
|
1031
1033
|
]),
|
|
1032
|
-
"side-sheet-footer":
|
|
1034
|
+
"side-sheet-footer": I(() => [
|
|
1033
1035
|
e("div", An, [
|
|
1034
|
-
|
|
1035
|
-
label: u(
|
|
1036
|
-
loading:
|
|
1037
|
-
onClick:
|
|
1036
|
+
k(E, {
|
|
1037
|
+
label: u(c)("inventory.stock.adjust.adjustButton"),
|
|
1038
|
+
loading: C.value,
|
|
1039
|
+
onClick: B[1] || (B[1] = (Q) => {
|
|
1038
1040
|
var R, oe;
|
|
1039
|
-
return (oe = (R =
|
|
1041
|
+
return (oe = (R = v.value) == null ? void 0 : R.validateInputs) == null ? void 0 : oe.call(R);
|
|
1040
1042
|
})
|
|
1041
1043
|
}, null, 8, ["label", "loading"])
|
|
1042
1044
|
])
|
|
@@ -1045,81 +1047,81 @@ const Ie = {
|
|
|
1045
1047
|
}, 8, ["modelValue"]);
|
|
1046
1048
|
};
|
|
1047
1049
|
}
|
|
1048
|
-
}), Cn = xt((
|
|
1050
|
+
}), Cn = xt((b, g) => ({
|
|
1049
1051
|
// TODO: remove once latest inventory backend has been push
|
|
1050
|
-
async findBillsByBusinessId(
|
|
1051
|
-
const
|
|
1052
|
+
async findBillsByBusinessId(p, o, j) {
|
|
1053
|
+
const h = `${b.businessesBackendUrl}/${p}/reports/find-many`, d = {
|
|
1052
1054
|
// type: TYPE.bill,
|
|
1053
1055
|
type: "bill",
|
|
1054
|
-
restaurantIds:
|
|
1055
|
-
ids:
|
|
1056
|
+
restaurantIds: o,
|
|
1057
|
+
ids: j
|
|
1056
1058
|
};
|
|
1057
|
-
return await
|
|
1059
|
+
return await g.post(h, d);
|
|
1058
1060
|
},
|
|
1059
|
-
async findBillsById(
|
|
1060
|
-
const
|
|
1061
|
-
ids:
|
|
1061
|
+
async findBillsById(p) {
|
|
1062
|
+
const j = ve().currentLocationDBName, h = `${b.inventoryBackendUrl}/${j}/bill/search`, d = {
|
|
1063
|
+
ids: p
|
|
1062
1064
|
};
|
|
1063
|
-
return await
|
|
1065
|
+
return await g.post(h, d);
|
|
1064
1066
|
}
|
|
1065
|
-
})),
|
|
1067
|
+
})), Bn = {
|
|
1066
1068
|
key: 0,
|
|
1067
1069
|
class: "flex justify-center items-center h-32"
|
|
1068
|
-
},
|
|
1070
|
+
}, Mn = { class: "mb-3" }, Dn = { class: "flex flex-col gap-8" }, In = { class: "flex flex-col text-fm-color-typo-primary mb-3 text-center" }, jn = { class: "text-fm-color-neutral-gray-400 fm-typo-en-body-sm-600" }, Tn = { class: "flex flex-col gap-4 text-fm-color-typo-primary mb-3" }, Un = { class: "flex flex-col gap-4 text-fm-color-typo-primary mb-3" }, En = { class: "flex flex-col gap-4 text-fm-color-typo-primary mb-3" }, Hn = { class: "flex flex-col w-full px-2" }, Pn = { class: "flex gap-2" }, Rn = /* @__PURE__ */ ce({
|
|
1069
1071
|
__name: "AmendAdjustmentForm",
|
|
1070
|
-
props: /* @__PURE__ */
|
|
1072
|
+
props: /* @__PURE__ */ Ge({
|
|
1071
1073
|
adjustmentId: {}
|
|
1072
1074
|
}, {
|
|
1073
1075
|
modelValue: {},
|
|
1074
1076
|
modelModifiers: {}
|
|
1075
1077
|
}),
|
|
1076
|
-
emits: /* @__PURE__ */
|
|
1077
|
-
setup(
|
|
1078
|
-
const
|
|
1078
|
+
emits: /* @__PURE__ */ Ge(["refreshHistory"], ["update:modelValue"]),
|
|
1079
|
+
setup(b, { emit: g }) {
|
|
1080
|
+
const p = b, o = g, j = _e(), h = ct(b, "modelValue"), d = N(!1), i = N(!1), x = N(!1), C = N({
|
|
1079
1081
|
_id: `inventoryAdjustment_${(/* @__PURE__ */ new Date()).toISOString()}_XXXXX`,
|
|
1080
1082
|
skus: []
|
|
1081
|
-
}),
|
|
1083
|
+
}), c = N();
|
|
1082
1084
|
Ee(async () => {
|
|
1083
|
-
|
|
1084
|
-
const n = await
|
|
1085
|
+
d.value = !0;
|
|
1086
|
+
const n = await j.readSingleAdjustment(p.adjustmentId);
|
|
1085
1087
|
if (!n) throw new Error("Adjustment not found");
|
|
1086
|
-
|
|
1088
|
+
C.value = n, d.value = !1;
|
|
1087
1089
|
});
|
|
1088
1090
|
async function l() {
|
|
1089
1091
|
var r, w;
|
|
1090
|
-
if ((w = (r =
|
|
1092
|
+
if ((w = (r = c == null ? void 0 : c.value) == null ? void 0 : r.validateInputs) == null || w.call(r), !i.value) return;
|
|
1091
1093
|
const n = {};
|
|
1092
|
-
Object.keys(
|
|
1093
|
-
var
|
|
1094
|
-
Object.keys(((
|
|
1095
|
-
var
|
|
1096
|
-
const P = (
|
|
1097
|
-
P &&
|
|
1094
|
+
Object.keys(h.value || {}).forEach((B) => {
|
|
1095
|
+
var M;
|
|
1096
|
+
Object.keys(((M = h.value) == null ? void 0 : M[B]) || {}).forEach((E) => {
|
|
1097
|
+
var J, Q;
|
|
1098
|
+
const P = (Q = (J = h.value) == null ? void 0 : J[B]) == null ? void 0 : Q[Number(E)];
|
|
1099
|
+
P && $(P.amount) > 0 && (n[B] || (n[B] = []), n[B].push(P));
|
|
1098
1100
|
});
|
|
1099
|
-
}), await
|
|
1100
|
-
targetWastageAdjustmentId:
|
|
1101
|
+
}), await j.revertWastageAdjustment({
|
|
1102
|
+
targetWastageAdjustmentId: p.adjustmentId,
|
|
1101
1103
|
amountsGoingToAdjust: n
|
|
1102
|
-
}),
|
|
1104
|
+
}), o("refreshHistory"), x.value = !1, h.value = {};
|
|
1103
1105
|
}
|
|
1104
|
-
function
|
|
1106
|
+
function v(n, r, w) {
|
|
1105
1107
|
return H({
|
|
1106
1108
|
get: () => {
|
|
1107
|
-
var
|
|
1108
|
-
const
|
|
1109
|
-
return
|
|
1109
|
+
var M, E, P;
|
|
1110
|
+
const B = (P = (E = (M = h.value) == null ? void 0 : M[n]) == null ? void 0 : E[r]) == null ? void 0 : P.amount;
|
|
1111
|
+
return B ? $(B, !0) : 0;
|
|
1110
1112
|
},
|
|
1111
|
-
set: (
|
|
1112
|
-
|
|
1113
|
-
const
|
|
1114
|
-
|
|
1115
|
-
amount: Ce.fromNumber(
|
|
1113
|
+
set: (B) => {
|
|
1114
|
+
h.value || (h.value = {});
|
|
1115
|
+
const M = { ...h.value };
|
|
1116
|
+
M[n] || (M[n] = {}), M[n][r] = {
|
|
1117
|
+
amount: Ce.fromNumber(B),
|
|
1116
1118
|
type: ne.Enum.WASTAGE,
|
|
1117
1119
|
measurement: w
|
|
1118
|
-
},
|
|
1120
|
+
}, h.value = M;
|
|
1119
1121
|
}
|
|
1120
1122
|
});
|
|
1121
1123
|
}
|
|
1122
|
-
function
|
|
1124
|
+
function $(n, r = !0) {
|
|
1123
1125
|
const w = Number(Ce.toFormatString({ value: n }));
|
|
1124
1126
|
return r ? Math.abs(w) : w;
|
|
1125
1127
|
}
|
|
@@ -1130,20 +1132,20 @@ const Ie = {
|
|
|
1130
1132
|
return r === 0 ? "N/A" : (n + r).toString();
|
|
1131
1133
|
}
|
|
1132
1134
|
return (n, r) => {
|
|
1133
|
-
const w =
|
|
1134
|
-
return F(), K(
|
|
1135
|
-
modelValue:
|
|
1136
|
-
"onUpdate:modelValue": r[4] || (r[4] = (R) =>
|
|
1135
|
+
const w = D("FmIcon"), B = D("FmStepperField"), M = D("FmCard"), E = D("FmForm"), P = D("FmSpacer"), J = D("FmButton"), Q = D("FmDialog");
|
|
1136
|
+
return F(), K(Q, {
|
|
1137
|
+
modelValue: x.value,
|
|
1138
|
+
"onUpdate:modelValue": r[4] || (r[4] = (R) => x.value = R),
|
|
1137
1139
|
overlay: !0
|
|
1138
1140
|
}, {
|
|
1139
|
-
"dialog-button":
|
|
1140
|
-
|
|
1141
|
-
default:
|
|
1141
|
+
"dialog-button": I(() => [
|
|
1142
|
+
k(Pe, null, {
|
|
1143
|
+
default: I(() => [
|
|
1142
1144
|
e("button", {
|
|
1143
|
-
onClick: r[0] || (r[0] = (R) =>
|
|
1145
|
+
onClick: r[0] || (r[0] = (R) => x.value = !0),
|
|
1144
1146
|
class: "rounded-md hover:bg-gray-100 transition-colors"
|
|
1145
1147
|
}, [
|
|
1146
|
-
|
|
1148
|
+
k(w, {
|
|
1147
1149
|
name: "edit",
|
|
1148
1150
|
size: "sm"
|
|
1149
1151
|
})
|
|
@@ -1152,22 +1154,22 @@ const Ie = {
|
|
|
1152
1154
|
_: 1
|
|
1153
1155
|
})
|
|
1154
1156
|
]),
|
|
1155
|
-
"dialog-header":
|
|
1157
|
+
"dialog-header": I(() => r[5] || (r[5] = [
|
|
1156
1158
|
e("div", null, "Amend Adjustment", -1)
|
|
1157
1159
|
])),
|
|
1158
|
-
"dialog-footer":
|
|
1160
|
+
"dialog-footer": I(() => [
|
|
1159
1161
|
e("div", Hn, [
|
|
1160
1162
|
r[13] || (r[13] = e("span", { class: "text-fm-color-system-warning-400 fm-typo-en-body-sm-400" }, "1. New adjustment EXTRA will be created for each reversal", -1)),
|
|
1161
1163
|
e("div", Pn, [
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
+
k(P),
|
|
1165
|
+
k(J, {
|
|
1164
1166
|
class: "sm:w-full xs:w-full",
|
|
1165
1167
|
label: "Close",
|
|
1166
1168
|
size: "md",
|
|
1167
1169
|
variant: "tertiary",
|
|
1168
|
-
onClick: r[3] || (r[3] = (R) =>
|
|
1170
|
+
onClick: r[3] || (r[3] = (R) => x.value = !1)
|
|
1169
1171
|
}),
|
|
1170
|
-
|
|
1172
|
+
k(J, {
|
|
1171
1173
|
class: "sm:w-full xs:w-full",
|
|
1172
1174
|
label: "Submit",
|
|
1173
1175
|
size: "md",
|
|
@@ -1177,65 +1179,65 @@ const Ie = {
|
|
|
1177
1179
|
])
|
|
1178
1180
|
])
|
|
1179
1181
|
]),
|
|
1180
|
-
default:
|
|
1181
|
-
|
|
1182
|
+
default: I(() => [
|
|
1183
|
+
d.value ? (F(), O("div", Bn)) : (F(), K(E, {
|
|
1182
1184
|
key: 1,
|
|
1183
1185
|
ref_key: "formRef",
|
|
1184
|
-
ref:
|
|
1186
|
+
ref: c,
|
|
1185
1187
|
onValidationFailed: r[1] || (r[1] = () => {
|
|
1186
|
-
|
|
1188
|
+
i.value = !1;
|
|
1187
1189
|
}),
|
|
1188
1190
|
onValidationSuccess: r[2] || (r[2] = () => {
|
|
1189
|
-
|
|
1191
|
+
i.value = !0;
|
|
1190
1192
|
}),
|
|
1191
1193
|
blameFormChildOnValidationFailed: ""
|
|
1192
1194
|
}, {
|
|
1193
|
-
default:
|
|
1194
|
-
e("p",
|
|
1195
|
+
default: I(() => [
|
|
1196
|
+
e("p", Mn, [
|
|
1195
1197
|
r[6] || (r[6] = e("b", null, "Date:", -1)),
|
|
1196
1198
|
r[7] || (r[7] = e("br", null, null, -1)),
|
|
1197
|
-
ue(" " +
|
|
1199
|
+
ue(" " + _(u(St)(u(Ft)(C.value._id))), 1)
|
|
1198
1200
|
]),
|
|
1199
1201
|
e("div", Dn, [
|
|
1200
|
-
(F(!0), O(Z, null, ie(
|
|
1201
|
-
(F(!0), O(Z, null, ie(R.amounts, (L, Y) => (F(), K(
|
|
1202
|
+
(F(!0), O(Z, null, ie(C.value.skus, (R, oe) => (F(), O(Z, { key: oe }, [
|
|
1203
|
+
(F(!0), O(Z, null, ie(R.amounts, (L, Y) => (F(), K(M, {
|
|
1202
1204
|
key: Y,
|
|
1203
1205
|
variant: "outlined",
|
|
1204
1206
|
class: "p-2"
|
|
1205
1207
|
}, {
|
|
1206
|
-
default:
|
|
1208
|
+
default: I(() => [
|
|
1207
1209
|
e("div", In, [
|
|
1208
|
-
e("span", jn,
|
|
1209
|
-
e("span", null,
|
|
1210
|
+
e("span", jn, _(R.sku.code), 1),
|
|
1211
|
+
e("span", null, _(R.sku.name), 1)
|
|
1210
1212
|
]),
|
|
1211
1213
|
r[12] || (r[12] = e("hr", { class: "m-2" }, null, -1)),
|
|
1212
1214
|
e("div", Tn, [
|
|
1213
1215
|
r[8] || (r[8] = e("span", { class: "fm-typo-en-body-lg-600" }, "Adjustment type:", -1)),
|
|
1214
|
-
e("span", null,
|
|
1216
|
+
e("span", null, _(L.type), 1)
|
|
1215
1217
|
]),
|
|
1216
1218
|
e("div", Un, [
|
|
1217
1219
|
r[9] || (r[9] = e("span", { class: "fm-typo-en-body-lg-600" }, "Current amount:", -1)),
|
|
1218
|
-
e("span", null,
|
|
1220
|
+
e("span", null, _(u(Ce).toFormatString({ value: L.amount })) + " " + _(A(R, L)), 1)
|
|
1219
1221
|
]),
|
|
1220
|
-
|
|
1221
|
-
"model-value":
|
|
1222
|
-
"onUpdate:modelValue": (le) =>
|
|
1222
|
+
k(B, {
|
|
1223
|
+
"model-value": v(R.sku._id, Y).value,
|
|
1224
|
+
"onUpdate:modelValue": (le) => v(R.sku._id, Y).value = le,
|
|
1223
1225
|
class: "mb-3",
|
|
1224
1226
|
label: "Adjust Amount (Leave 0 to skip)",
|
|
1225
|
-
"helper-text": `Max: ${
|
|
1227
|
+
"helper-text": `Max: ${$(L.amount)}`,
|
|
1226
1228
|
"append-text": A(R, L),
|
|
1227
1229
|
rules: [
|
|
1228
|
-
(le) => le <=
|
|
1230
|
+
(le) => le <= $(L.amount) || `Cannot be more than ${$(L.amount)}`,
|
|
1229
1231
|
u(Fe)(-1)
|
|
1230
1232
|
]
|
|
1231
1233
|
}, null, 8, ["model-value", "onUpdate:modelValue", "helper-text", "append-text", "rules"]),
|
|
1232
1234
|
e("div", En, [
|
|
1233
1235
|
r[10] || (r[10] = e("span", { class: "fm-typo-en-body-lg-600" }, "Amount after amend:", -1)),
|
|
1234
1236
|
r[11] || (r[11] = e("span", { class: "text-fm-color-system-warning-400 fm-typo-en-body-sm-400" }, "* It's an estimate for your reference, as it didn't include all the reversals related to this adjustment", -1)),
|
|
1235
|
-
ue(" " +
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
)) + " " +
|
|
1237
|
+
ue(" " + _(V(
|
|
1238
|
+
$(L.amount, !1),
|
|
1239
|
+
v(R.sku._id, Y).value
|
|
1240
|
+
)) + " " + _(A(R, L)), 1)
|
|
1239
1241
|
])
|
|
1240
1242
|
]),
|
|
1241
1243
|
_: 2
|
|
@@ -1259,10 +1261,10 @@ const Ie = {
|
|
|
1259
1261
|
}, Xn = {
|
|
1260
1262
|
key: 2,
|
|
1261
1263
|
class: "inline-flex items-center rounded-md bg-yellow-400/10 px-2 text-xs font-medium text-yellow-500 inset-ring inset-ring-yellow-400/20"
|
|
1262
|
-
},
|
|
1264
|
+
}, Qn = {
|
|
1263
1265
|
key: 1,
|
|
1264
1266
|
class: "shrink-0 text-fm-color-typo-secondary"
|
|
1265
|
-
},
|
|
1267
|
+
}, Jn = /* @__PURE__ */ ce({
|
|
1266
1268
|
__name: "StockRecordCard",
|
|
1267
1269
|
props: {
|
|
1268
1270
|
record: {},
|
|
@@ -1270,25 +1272,25 @@ const Ie = {
|
|
|
1270
1272
|
bills: { default: () => [] }
|
|
1271
1273
|
},
|
|
1272
1274
|
emits: ["refreshHistory"],
|
|
1273
|
-
setup(
|
|
1274
|
-
const
|
|
1275
|
-
|
|
1276
|
-
const
|
|
1275
|
+
setup(b, { emit: g }) {
|
|
1276
|
+
const p = b, o = N(!1);
|
|
1277
|
+
Ne();
|
|
1278
|
+
const j = N(), h = N(null), d = H(() => h.value === null ? "unset" : o.value ? `${h.value}px` : "0px");
|
|
1277
1279
|
Ee(() => {
|
|
1278
|
-
var
|
|
1279
|
-
|
|
1280
|
+
var c;
|
|
1281
|
+
h.value = ((c = j.value) == null ? void 0 : c.scrollHeight) || 0;
|
|
1280
1282
|
});
|
|
1281
|
-
const
|
|
1283
|
+
const i = H(() => {
|
|
1282
1284
|
var V;
|
|
1283
|
-
const
|
|
1285
|
+
const c = p.record.adjustments, l = p.sku, v = {}, A = c.flatMap((n) => {
|
|
1284
1286
|
var r;
|
|
1285
1287
|
return ((r = n.skus) == null ? void 0 : r.filter((w) => w.sku._id === l._id)) ?? [];
|
|
1286
1288
|
}).flatMap((n) => n.amounts);
|
|
1287
1289
|
for (const n of A) {
|
|
1288
1290
|
const r = n.measurement ? wt(n.measurement.conversion, n.amount) : n.amount;
|
|
1289
|
-
|
|
1291
|
+
v[V = n.type] ?? (v[V] = { amount: 0, precision: 0 }), v[n.type] = nt(r, v[n.type]);
|
|
1290
1292
|
}
|
|
1291
|
-
return Object.entries(
|
|
1293
|
+
return Object.entries(v).reduce(
|
|
1292
1294
|
(n, [r, w]) => (n[r] = /// comment, because without it formatter makes code uglier
|
|
1293
1295
|
`${X.toFormatString({
|
|
1294
1296
|
value: w,
|
|
@@ -1296,109 +1298,109 @@ const Ie = {
|
|
|
1296
1298
|
})} ${l.unit.abbrev}`, n),
|
|
1297
1299
|
{}
|
|
1298
1300
|
);
|
|
1299
|
-
}), { t:
|
|
1300
|
-
time: $t(new Date(
|
|
1301
|
+
}), { t: x } = de(), C = H(() => p.record.adjustmentsByTime.map(({ date: c, adjustments: l }) => ({
|
|
1302
|
+
time: $t(new Date(c)),
|
|
1301
1303
|
adjustments: l.flatMap(
|
|
1302
|
-
(
|
|
1303
|
-
var
|
|
1304
|
-
return ((A = (
|
|
1304
|
+
(v) => {
|
|
1305
|
+
var $, A;
|
|
1306
|
+
return ((A = ($ = v.skus) == null ? void 0 : $.map) == null ? void 0 : A.call($, (V) => {
|
|
1305
1307
|
var n, r;
|
|
1306
1308
|
return {
|
|
1307
1309
|
...V,
|
|
1308
|
-
ref:
|
|
1309
|
-
backdateFrom:
|
|
1310
|
-
toBalance: (r = (n =
|
|
1311
|
-
adjustmentId:
|
|
1310
|
+
ref: v.ref,
|
|
1311
|
+
backdateFrom: v.effectiveAt != null ? at(v._id) : null,
|
|
1312
|
+
toBalance: (r = (n = v.skus) == null ? void 0 : n[0]) == null ? void 0 : r.toBalance,
|
|
1313
|
+
adjustmentId: v._id
|
|
1312
1314
|
};
|
|
1313
1315
|
})) ?? [];
|
|
1314
1316
|
}
|
|
1315
|
-
).flatMap((
|
|
1317
|
+
).flatMap((v) => {
|
|
1316
1318
|
var V;
|
|
1317
|
-
const
|
|
1318
|
-
return
|
|
1319
|
+
const $ = (V = p.bills.find((n) => n._id === v.ref)) == null ? void 0 : V.seqNumber, A = $ ? x("inventory.stock.record.bill", [$]) : "";
|
|
1320
|
+
return v.amounts.map((n) => {
|
|
1319
1321
|
var r;
|
|
1320
1322
|
return {
|
|
1321
|
-
amount: `${X.toFormatString({ value: n.amount, precision: 4 })} ${((r = n.measurement) == null ? void 0 : r.abbrev) ??
|
|
1322
|
-
backdateFrom:
|
|
1323
|
+
amount: `${X.toFormatString({ value: n.amount, precision: 4 })} ${((r = n.measurement) == null ? void 0 : r.abbrev) ?? v.sku.unit.abbrev}`,
|
|
1324
|
+
backdateFrom: v.backdateFrom,
|
|
1323
1325
|
name: n.type,
|
|
1324
1326
|
remark: n.remark || A || "",
|
|
1325
1327
|
cost: n.cost,
|
|
1326
1328
|
toBalance: X.toFormatString({
|
|
1327
|
-
value:
|
|
1329
|
+
value: v.toBalance ?? X.fromNumber(0),
|
|
1328
1330
|
precision: 4
|
|
1329
1331
|
}),
|
|
1330
|
-
baseUnit:
|
|
1331
|
-
adjustmentId:
|
|
1332
|
+
baseUnit: v.sku.unit.abbrev,
|
|
1333
|
+
adjustmentId: v.adjustmentId
|
|
1332
1334
|
};
|
|
1333
1335
|
});
|
|
1334
1336
|
})
|
|
1335
1337
|
})));
|
|
1336
|
-
return (
|
|
1337
|
-
const
|
|
1338
|
+
return (c, l) => {
|
|
1339
|
+
const v = D("FmIcon"), $ = D("FmTooltip"), A = D("FmCard");
|
|
1338
1340
|
return F(), K(A, { variant: "outlined" }, {
|
|
1339
|
-
default:
|
|
1341
|
+
default: I(() => [
|
|
1340
1342
|
e("div", On, [
|
|
1341
1343
|
e("div", {
|
|
1342
1344
|
class: "flex items-center cursor-pointer mb-1",
|
|
1343
|
-
onClick: l[0] || (l[0] = (V) =>
|
|
1345
|
+
onClick: l[0] || (l[0] = (V) => o.value = !o.value)
|
|
1344
1346
|
}, [
|
|
1345
|
-
e("div", Nn,
|
|
1346
|
-
|
|
1347
|
-
name:
|
|
1347
|
+
e("div", Nn, _(c.record.date), 1),
|
|
1348
|
+
k(v, {
|
|
1349
|
+
name: o.value ? "expand_more" : "expand_less",
|
|
1348
1350
|
color: "#777777",
|
|
1349
1351
|
size: "md"
|
|
1350
1352
|
}, null, 8, ["name"])
|
|
1351
1353
|
]),
|
|
1352
|
-
(F(!0), O(Z, null, ie(
|
|
1354
|
+
(F(!0), O(Z, null, ie(i.value, (V, n) => (F(), O("div", {
|
|
1353
1355
|
key: n,
|
|
1354
1356
|
class: "flex flex-row py-1",
|
|
1355
1357
|
style: { "font-size": "0.8rem" }
|
|
1356
1358
|
}, [
|
|
1357
|
-
e("div", Ln,
|
|
1359
|
+
e("div", Ln, _(u(x)(`inventory.inventoryAdjustment.type.${n}`)), 1),
|
|
1358
1360
|
e("div", {
|
|
1359
1361
|
class: he({
|
|
1360
1362
|
"text-fm-color-typo-error": V.startsWith("-"),
|
|
1361
1363
|
"text-fm-color-typo-success": !V.startsWith("-"),
|
|
1362
1364
|
"ml-auto": !0
|
|
1363
1365
|
})
|
|
1364
|
-
},
|
|
1366
|
+
}, _(V), 3)
|
|
1365
1367
|
]))), 128)),
|
|
1366
1368
|
e("div", {
|
|
1367
1369
|
ref_key: "detailRef",
|
|
1368
|
-
ref:
|
|
1369
|
-
style:
|
|
1370
|
+
ref: j,
|
|
1371
|
+
style: tt({
|
|
1370
1372
|
fontSize: "0.8rem",
|
|
1371
|
-
maxHeight:
|
|
1373
|
+
maxHeight: d.value,
|
|
1372
1374
|
overflow: "hidden",
|
|
1373
1375
|
transition: "max-height 0.2s ease-out"
|
|
1374
1376
|
})
|
|
1375
1377
|
}, [
|
|
1376
|
-
|
|
1377
|
-
(F(!0), O(Z, null, ie(
|
|
1378
|
+
C.value.length ? (F(), O("hr", zn)) : te("", !0),
|
|
1379
|
+
(F(!0), O(Z, null, ie(C.value, (V) => (F(), O("div", {
|
|
1378
1380
|
key: V.time,
|
|
1379
1381
|
class: "flex gap-1 w-full"
|
|
1380
1382
|
}, [
|
|
1381
|
-
e("div", Yn,
|
|
1383
|
+
e("div", Yn, _(V.time), 1),
|
|
1382
1384
|
e("div", Kn, [
|
|
1383
1385
|
(F(!0), O(Z, null, ie(V.adjustments, (n) => (F(), O("div", {
|
|
1384
1386
|
key: n.name,
|
|
1385
1387
|
class: "flex gap-1"
|
|
1386
1388
|
}, [
|
|
1387
1389
|
e("div", Gn, [
|
|
1388
|
-
ue(
|
|
1389
|
-
n.backdateFrom ? (F(), K(
|
|
1390
|
+
ue(_(u(x)(`inventory.inventoryAdjustment.type.${n.name}`)) + " ", 1),
|
|
1391
|
+
n.backdateFrom ? (F(), K($, {
|
|
1390
1392
|
key: 0,
|
|
1391
1393
|
variant: "plain",
|
|
1392
1394
|
placement: "top",
|
|
1393
1395
|
"z-index": 50
|
|
1394
1396
|
}, {
|
|
1395
|
-
content:
|
|
1396
|
-
e("div", Wn,
|
|
1397
|
-
u(
|
|
1397
|
+
content: I(() => [
|
|
1398
|
+
e("div", Wn, _(u(x)("inventory.stock.record.backdate", [
|
|
1399
|
+
u(ot)(new Date(n.backdateFrom))
|
|
1398
1400
|
])), 1)
|
|
1399
1401
|
]),
|
|
1400
|
-
default:
|
|
1401
|
-
|
|
1402
|
+
default: I(() => [
|
|
1403
|
+
k(v, {
|
|
1402
1404
|
name: "info",
|
|
1403
1405
|
size: "sm",
|
|
1404
1406
|
color: "primary"
|
|
@@ -1406,8 +1408,8 @@ const Ie = {
|
|
|
1406
1408
|
]),
|
|
1407
1409
|
_: 2
|
|
1408
1410
|
}, 1024)) : te("", !0),
|
|
1409
|
-
n.remark ? (F(), O("span", qn, " # " +
|
|
1410
|
-
n.name === u(ne).Enum.CLOSING ? (F(), O("span", Xn, " Actual Balance: " +
|
|
1411
|
+
n.remark ? (F(), O("span", qn, " # " + _(n.remark), 1)) : te("", !0),
|
|
1412
|
+
n.name === u(ne).Enum.CLOSING ? (F(), O("span", Xn, " Actual Balance: " + _(n.toBalance) + " " + _(n.baseUnit), 1)) : te("", !0)
|
|
1411
1413
|
]),
|
|
1412
1414
|
e("div", {
|
|
1413
1415
|
class: he({
|
|
@@ -1415,13 +1417,13 @@ const Ie = {
|
|
|
1415
1417
|
"text-fm-color-typo-success": !n.amount.startsWith("-"),
|
|
1416
1418
|
"ml-auto": !0
|
|
1417
1419
|
})
|
|
1418
|
-
},
|
|
1420
|
+
}, _(n.amount), 3),
|
|
1419
1421
|
n.name === u(ne).Enum.WASTAGE ? (F(), K(Rn, {
|
|
1420
1422
|
key: 0,
|
|
1421
1423
|
adjustmentId: n.adjustmentId,
|
|
1422
|
-
onRefreshHistory: l[1] || (l[1] = (r) =>
|
|
1424
|
+
onRefreshHistory: l[1] || (l[1] = (r) => c.$emit("refreshHistory"))
|
|
1423
1425
|
}, null, 8, ["adjustmentId"])) : te("", !0),
|
|
1424
|
-
n.cost ? (F(), O("div",
|
|
1426
|
+
n.cost ? (F(), O("div", Qn, " (" + _(u(ke)(n.cost, !1, n.cost.precision)) + ") ", 1)) : te("", !0)
|
|
1425
1427
|
]))), 128))
|
|
1426
1428
|
])
|
|
1427
1429
|
]))), 128))
|
|
@@ -1433,64 +1435,64 @@ const Ie = {
|
|
|
1433
1435
|
};
|
|
1434
1436
|
}
|
|
1435
1437
|
});
|
|
1436
|
-
function Zn(
|
|
1437
|
-
var
|
|
1438
|
-
const
|
|
1439
|
-
(
|
|
1438
|
+
function Zn(b, g) {
|
|
1439
|
+
var h;
|
|
1440
|
+
const p = Object.keys(ne.enum).reduce(
|
|
1441
|
+
(d, i) => (d[i] = { amount: 0, precision: 0 }, d),
|
|
1440
1442
|
{}
|
|
1441
1443
|
);
|
|
1442
|
-
if (!
|
|
1443
|
-
return Object.entries(
|
|
1444
|
-
(
|
|
1444
|
+
if (!g)
|
|
1445
|
+
return Object.entries(p).reduce(
|
|
1446
|
+
(d, [i]) => (d[i] = X.fromNumber(0), d),
|
|
1445
1447
|
{}
|
|
1446
1448
|
);
|
|
1447
|
-
const
|
|
1448
|
-
var
|
|
1449
|
-
return ((
|
|
1450
|
-
}).flatMap((
|
|
1451
|
-
for (const
|
|
1452
|
-
const
|
|
1453
|
-
|
|
1449
|
+
const j = b.flatMap((d) => {
|
|
1450
|
+
var i;
|
|
1451
|
+
return ((i = d.skus) == null ? void 0 : i.filter((x) => x.sku._id === g._id)) ?? [];
|
|
1452
|
+
}).flatMap((d) => d.amounts);
|
|
1453
|
+
for (const d of j) {
|
|
1454
|
+
const i = d.measurement ? X.multiply([d.measurement.conversion, d.amount]) : d.amount;
|
|
1455
|
+
p[h = d.type] ?? (p[h] = { amount: 0, precision: 0 }), p[d.type] = X.add([i, p[d.type]]);
|
|
1454
1456
|
}
|
|
1455
|
-
return Object.entries(
|
|
1456
|
-
(
|
|
1457
|
-
const
|
|
1458
|
-
...
|
|
1459
|
-
amount: Math.abs(
|
|
1457
|
+
return Object.entries(p).reduce(
|
|
1458
|
+
(d, [i, x]) => {
|
|
1459
|
+
const C = {
|
|
1460
|
+
...x,
|
|
1461
|
+
amount: Math.abs(x.amount)
|
|
1460
1462
|
};
|
|
1461
|
-
return
|
|
1463
|
+
return d[i] = /// comment, because without it formatter makes code uglier
|
|
1462
1464
|
`${X.toFormatString({
|
|
1463
|
-
value:
|
|
1465
|
+
value: C,
|
|
1464
1466
|
precision: 4
|
|
1465
|
-
})} ${
|
|
1467
|
+
})} ${g.unit.abbrev}`, d;
|
|
1466
1468
|
},
|
|
1467
1469
|
{}
|
|
1468
1470
|
);
|
|
1469
1471
|
}
|
|
1470
|
-
function eo(
|
|
1471
|
-
if (!
|
|
1472
|
+
function eo(b, g) {
|
|
1473
|
+
if (!g)
|
|
1472
1474
|
return null;
|
|
1473
|
-
let
|
|
1474
|
-
const
|
|
1475
|
-
var
|
|
1476
|
-
return ((
|
|
1477
|
-
}).flatMap((
|
|
1478
|
-
var
|
|
1479
|
-
return !
|
|
1475
|
+
let p = null;
|
|
1476
|
+
const j = b.flatMap((h) => {
|
|
1477
|
+
var d;
|
|
1478
|
+
return ((d = h.skus) == null ? void 0 : d.filter((i) => i.sku._id === g._id)) ?? [];
|
|
1479
|
+
}).flatMap((h) => {
|
|
1480
|
+
var d;
|
|
1481
|
+
return !h.history || ((d = h.history) == null ? void 0 : d.length) === 0 ? [] : h.history[0];
|
|
1480
1482
|
});
|
|
1481
|
-
for (const
|
|
1482
|
-
const
|
|
1483
|
-
for (const
|
|
1484
|
-
if (
|
|
1483
|
+
for (const h of j) {
|
|
1484
|
+
const d = h.amounts;
|
|
1485
|
+
for (const i of d) {
|
|
1486
|
+
if (i.type !== ne.Enum.SALES)
|
|
1485
1487
|
continue;
|
|
1486
|
-
const
|
|
1487
|
-
|
|
1488
|
+
const x = i.measurement ? X.multiply([i.measurement.conversion, i.amount]) : i.amount;
|
|
1489
|
+
p ?? (p = X.fromNumber(0)), p = X.add([p, x]);
|
|
1488
1490
|
}
|
|
1489
1491
|
}
|
|
1490
|
-
return
|
|
1491
|
-
value:
|
|
1492
|
+
return p != null ? (p.amount = Math.abs(p.amount), `${X.toFormatString({
|
|
1493
|
+
value: p,
|
|
1492
1494
|
precision: 4
|
|
1493
|
-
})} ${
|
|
1495
|
+
})} ${g.unit.abbrev}`) : null;
|
|
1494
1496
|
}
|
|
1495
1497
|
const to = { class: "flex items-center w-full fm-typo-en-title-md-800" }, no = { class: "flex-1 line-clamp-2" }, oo = { class: "flex flex-col gap-32 w-full h-full" }, so = { class: "flex items-center relative gap-4" }, ao = { class: "flex-1" }, lo = {
|
|
1496
1498
|
key: 0,
|
|
@@ -1501,222 +1503,222 @@ const to = { class: "flex items-center w-full fm-typo-en-title-md-800" }, no = {
|
|
|
1501
1503
|
}, uo = { class: "pb-16" }, co = { class: "fm-typo-cn-body-lg-600" }, mo = {
|
|
1502
1504
|
class: "grid gap-12 fm-typo-en-body-md-400",
|
|
1503
1505
|
style: { "grid-template-columns": "auto auto auto", "grid-auto-rows": "1fr" }
|
|
1504
|
-
}, po = { class: "flex flex-col gap-1" }, vo = { class: "text-fm-color-typo-secondary" }, fo = { class: "font-bold" }, yo = { class: "flex flex-col gap-1" }, _o = { class: "text-fm-color-typo-secondary flex" }, bo = { class: "font-bold" }, ko = { class: "flex flex-col gap-1" }, go = { class: "text-fm-color-typo-secondary" }, ho = { class: "font-bold" }, xo = { class: "flex flex-col gap-1" }, So = { class: "text-fm-color-typo-secondary" }, Fo = { class: "font-bold" }, wo = { class: "flex flex-col gap-1" }, $o = { class: "text-fm-color-typo-secondary" }, Ao = { class: "font-bold" }, Vo = { class: "flex flex-col gap-1" }, Co = { class: "text-fm-color-typo-secondary" },
|
|
1506
|
+
}, po = { class: "flex flex-col gap-1" }, vo = { class: "text-fm-color-typo-secondary" }, fo = { class: "font-bold" }, yo = { class: "flex flex-col gap-1" }, _o = { class: "text-fm-color-typo-secondary flex" }, bo = { class: "font-bold" }, ko = { class: "flex flex-col gap-1" }, go = { class: "text-fm-color-typo-secondary" }, ho = { class: "font-bold" }, xo = { class: "flex flex-col gap-1" }, So = { class: "text-fm-color-typo-secondary" }, Fo = { class: "font-bold" }, wo = { class: "flex flex-col gap-1" }, $o = { class: "text-fm-color-typo-secondary" }, Ao = { class: "font-bold" }, Vo = { class: "flex flex-col gap-1" }, Co = { class: "text-fm-color-typo-secondary" }, Bo = { class: "font-bold" }, Mo = { class: "flex flex-col gap-1" }, Do = { class: "text-fm-color-typo-secondary" }, Io = { class: "font-bold" }, jo = { class: "flex flex-col gap-1" }, To = { class: "text-fm-color-typo-secondary" }, Uo = { class: "font-bold" }, Eo = { class: "flex flex-col gap-1" }, Ho = { class: "text-fm-color-typo-secondary" }, Po = { class: "font-bold" }, Ro = {
|
|
1505
1507
|
key: 0,
|
|
1506
1508
|
class: "flex flex-col gap-8"
|
|
1507
1509
|
}, Oo = { class: "flex" }, No = { class: "flex-1 flex flex-col gap-1" }, Lo = { class: "flex gap-1 items-center text-fm-color-typo-secondary" }, zo = { class: "font-bold" }, Yo = { class: "flex-1 flex flex-col gap-1" }, Ko = { class: "flex gap-1 items-center text-fm-color-typo-secondary" }, Go = { class: "flex flex-col gap-1" }, Wo = { class: "font-bold" }, qo = {
|
|
1508
1510
|
key: 2,
|
|
1509
1511
|
class: "flex-1 flex flex-col items-center gap-8"
|
|
1510
|
-
}, Xo = ["src"],
|
|
1512
|
+
}, Xo = ["src"], Qo = { class: "font-bold text-lg" }, Jo = { class: "text-xs text-neutral-400 text-center" }, Zo = /* @__PURE__ */ ce({
|
|
1511
1513
|
__name: "StockHistory",
|
|
1512
1514
|
props: {
|
|
1513
1515
|
sku: {},
|
|
1514
1516
|
show: { type: Boolean }
|
|
1515
1517
|
},
|
|
1516
1518
|
emits: ["update:show"],
|
|
1517
|
-
setup(
|
|
1518
|
-
const
|
|
1519
|
-
async function
|
|
1520
|
-
|
|
1519
|
+
setup(b) {
|
|
1520
|
+
const g = Ne(), p = Oe(), o = _e(), j = Cn(), h = ve(), d = Bt(), { t: i } = de(), x = b, C = N(!1), c = be(), l = N(At(0));
|
|
1521
|
+
async function v() {
|
|
1522
|
+
C.value = !0;
|
|
1521
1523
|
try {
|
|
1522
|
-
await w(), await
|
|
1524
|
+
await w(), await p.readStockBalance();
|
|
1523
1525
|
} catch (t) {
|
|
1524
|
-
|
|
1526
|
+
c.open({
|
|
1525
1527
|
title: "Something went wrong",
|
|
1526
1528
|
message: "Cannot fetch stock history. Please try again.",
|
|
1527
1529
|
type: "error"
|
|
1528
|
-
}), console.log("failed at fetching item adjustment history",
|
|
1530
|
+
}), console.log("failed at fetching item adjustment history", x.sku, l, t);
|
|
1529
1531
|
} finally {
|
|
1530
|
-
|
|
1532
|
+
C.value = !1;
|
|
1531
1533
|
}
|
|
1532
1534
|
}
|
|
1533
1535
|
Ee(() => {
|
|
1534
|
-
|
|
1535
|
-
}), xe([() => l.value, () =>
|
|
1536
|
-
|
|
1536
|
+
v();
|
|
1537
|
+
}), xe([() => l.value, () => x.sku], () => {
|
|
1538
|
+
v();
|
|
1537
1539
|
});
|
|
1538
|
-
const
|
|
1539
|
-
function n(t,
|
|
1540
|
-
return
|
|
1540
|
+
const $ = N([]), A = N([]), V = N(new Array());
|
|
1541
|
+
function n(t, s) {
|
|
1542
|
+
return s === "day" ? Tt(t) : ot(t);
|
|
1541
1543
|
}
|
|
1542
|
-
function r(t,
|
|
1544
|
+
function r(t, s) {
|
|
1543
1545
|
const f = t.reduce(
|
|
1544
|
-
(
|
|
1545
|
-
const
|
|
1546
|
-
if (!
|
|
1547
|
-
return
|
|
1548
|
-
const U = n(new Date(
|
|
1549
|
-
return
|
|
1546
|
+
(m, a) => {
|
|
1547
|
+
const S = a.effectiveAt ?? at(a._id);
|
|
1548
|
+
if (!S)
|
|
1549
|
+
return m;
|
|
1550
|
+
const U = n(new Date(S), s);
|
|
1551
|
+
return m[U] ?? (m[U] = []), m[U].push(a), m;
|
|
1550
1552
|
},
|
|
1551
1553
|
{}
|
|
1552
1554
|
);
|
|
1553
|
-
return Object.keys(f).map((
|
|
1554
|
-
date:
|
|
1555
|
-
adjustments: f[
|
|
1555
|
+
return Object.keys(f).map((m) => ({
|
|
1556
|
+
date: m,
|
|
1557
|
+
adjustments: f[m]
|
|
1556
1558
|
}));
|
|
1557
1559
|
}
|
|
1558
1560
|
async function w() {
|
|
1559
|
-
let t = await
|
|
1560
|
-
|
|
1561
|
-
|
|
1561
|
+
let t = await o.readStockAdjustment(
|
|
1562
|
+
x.sku._id,
|
|
1563
|
+
Mt(new Date(l.value.startDate)).toISOString(),
|
|
1562
1564
|
Dt(new Date(l.value.endDate)).toISOString()
|
|
1563
1565
|
);
|
|
1564
|
-
|
|
1565
|
-
const
|
|
1566
|
-
await
|
|
1566
|
+
$.value = t;
|
|
1567
|
+
const s = t.filter(({ ref: f }) => f == null ? void 0 : f.startsWith("bill_")).map(({ ref: f }) => f);
|
|
1568
|
+
await B(s), A.value = r(t, "day").map(({ date: f, adjustments: m }) => ({
|
|
1567
1569
|
date: f,
|
|
1568
|
-
adjustments:
|
|
1569
|
-
adjustmentsByTime: r(
|
|
1570
|
+
adjustments: m,
|
|
1571
|
+
adjustmentsByTime: r(m, "minute")
|
|
1570
1572
|
}));
|
|
1571
1573
|
}
|
|
1572
|
-
async function
|
|
1573
|
-
t.length && (V.value = await
|
|
1574
|
+
async function B(t) {
|
|
1575
|
+
t.length && (V.value = await j.findBillsById(t).catch((s) => {
|
|
1574
1576
|
var a;
|
|
1575
|
-
console.error("Error on using latest bill API, retrying using legacy api",
|
|
1576
|
-
const f = ((a =
|
|
1577
|
-
return
|
|
1577
|
+
console.error("Error on using latest bill API, retrying using legacy api", s);
|
|
1578
|
+
const f = ((a = g.currentBusiness.value) == null ? void 0 : a._id) ?? "", m = h.currentLocation.doc._id;
|
|
1579
|
+
return j.findBillsByBusinessId(f, [m], t);
|
|
1578
1580
|
}));
|
|
1579
1581
|
}
|
|
1580
|
-
const
|
|
1581
|
-
const t =
|
|
1582
|
-
return Zn(t,
|
|
1582
|
+
const M = H(() => {
|
|
1583
|
+
const t = $.value, s = x.sku;
|
|
1584
|
+
return Zn(t, s);
|
|
1583
1585
|
}), E = H(() => {
|
|
1584
|
-
const t =
|
|
1585
|
-
return eo(t,
|
|
1586
|
+
const t = $.value, s = x.sku;
|
|
1587
|
+
return eo(t, s);
|
|
1586
1588
|
}), P = H(() => {
|
|
1587
|
-
const t = [
|
|
1588
|
-
var a,
|
|
1589
|
-
const
|
|
1590
|
-
return
|
|
1589
|
+
const t = [...$.value].computeFirst((f) => {
|
|
1590
|
+
var a, S;
|
|
1591
|
+
const m = (S = (a = f.skus) == null ? void 0 : a.find) == null ? void 0 : S.call(a, (U) => U.sku._id === x.sku._id);
|
|
1592
|
+
return m == null ? void 0 : m.fromBalance;
|
|
1591
1593
|
}) ?? {
|
|
1592
1594
|
amount: 0,
|
|
1593
1595
|
precision: 0
|
|
1594
|
-
},
|
|
1595
|
-
return
|
|
1596
|
+
}, s = x.sku;
|
|
1597
|
+
return s ? `${X.toFormatString({
|
|
1596
1598
|
value: t,
|
|
1597
1599
|
precision: 4
|
|
1598
|
-
})} ${
|
|
1599
|
-
}),
|
|
1600
|
-
const t = [
|
|
1601
|
-
var a,
|
|
1602
|
-
const
|
|
1603
|
-
return
|
|
1600
|
+
})} ${s.unit.abbrev}` : "";
|
|
1601
|
+
}), J = H(() => {
|
|
1602
|
+
const t = [...$.value].reverse().computeFirst((f) => {
|
|
1603
|
+
var a, S;
|
|
1604
|
+
const m = (S = (a = f.skus) == null ? void 0 : a.find) == null ? void 0 : S.call(a, (U) => U.sku._id === x.sku._id);
|
|
1605
|
+
return m == null ? void 0 : m.toBalance;
|
|
1604
1606
|
}) ?? {
|
|
1605
1607
|
amount: 0,
|
|
1606
1608
|
precision: 0
|
|
1607
|
-
},
|
|
1608
|
-
return
|
|
1609
|
-
}),
|
|
1609
|
+
}, s = x.sku;
|
|
1610
|
+
return s ? `${X.toFormatString({ value: t, precision: 4 })} ${s.unit.abbrev}` : "";
|
|
1611
|
+
}), Q = H(() => {
|
|
1610
1612
|
var f;
|
|
1611
|
-
const
|
|
1613
|
+
const s = $.value.flatMap((m) => {
|
|
1612
1614
|
var a;
|
|
1613
|
-
return ((a =
|
|
1614
|
-
}).filter((
|
|
1615
|
-
(
|
|
1616
|
-
const
|
|
1617
|
-
if (!
|
|
1615
|
+
return ((a = m.skus) == null ? void 0 : a.flatMap((S) => S.amounts)) ?? [];
|
|
1616
|
+
}).filter((m) => m.amount.amount < 0).reduce(
|
|
1617
|
+
(m, a) => {
|
|
1618
|
+
const S = a.cost;
|
|
1619
|
+
if (!S) return m;
|
|
1618
1620
|
const U = {
|
|
1619
|
-
...Vt(
|
|
1620
|
-
currency:
|
|
1621
|
+
...Vt(m, Math.max(m.precision, S.precision)),
|
|
1622
|
+
currency: S.currency
|
|
1621
1623
|
};
|
|
1622
1624
|
return {
|
|
1623
|
-
...
|
|
1624
|
-
currency:
|
|
1625
|
+
...nt(U, S),
|
|
1626
|
+
currency: m.currency
|
|
1625
1627
|
};
|
|
1626
1628
|
},
|
|
1627
1629
|
{
|
|
1628
1630
|
amount: 0,
|
|
1629
1631
|
precision: 0,
|
|
1630
|
-
currency:
|
|
1632
|
+
currency: Be((f = g.currentCountry) == null ? void 0 : f.value)
|
|
1631
1633
|
}
|
|
1632
1634
|
);
|
|
1633
|
-
return ke(
|
|
1635
|
+
return ke(s, !1, s.precision);
|
|
1634
1636
|
});
|
|
1635
1637
|
function R() {
|
|
1636
|
-
const { startDate: t, endDate:
|
|
1637
|
-
t !== null &&
|
|
1638
|
+
const { startDate: t, endDate: s } = It(l.value);
|
|
1639
|
+
t !== null && s !== null && (l.value = {
|
|
1638
1640
|
startDate: t,
|
|
1639
|
-
endDate:
|
|
1641
|
+
endDate: s
|
|
1640
1642
|
});
|
|
1641
1643
|
}
|
|
1642
|
-
const oe = H(() =>
|
|
1644
|
+
const oe = H(() => x.sku.valuation === Xe.Enum.FIFO ? i("inventory.ingredient.valuationMethod.FIFO") : i("inventory.ingredient.valuationMethod.WAVG")), L = H(() => {
|
|
1643
1645
|
var U, z, se, T;
|
|
1644
|
-
const t = [
|
|
1646
|
+
const t = [...$.value].reverse().computeFirst((G) => {
|
|
1645
1647
|
var W, ae;
|
|
1646
|
-
return (ae = (W = G.skus) == null ? void 0 : W.find) == null ? void 0 : ae.call(W, (re) => re.sku._id ===
|
|
1648
|
+
return (ae = (W = G.skus) == null ? void 0 : W.find) == null ? void 0 : ae.call(W, (re) => re.sku._id === x.sku._id);
|
|
1647
1649
|
});
|
|
1648
1650
|
if (!t) return "No data";
|
|
1649
|
-
const
|
|
1650
|
-
amount: ((U =
|
|
1651
|
-
precision: ((z =
|
|
1652
|
-
},
|
|
1651
|
+
const s = [...t.amounts].reverse()[0], f = {
|
|
1652
|
+
amount: ((U = s.cost) == null ? void 0 : U.amount) ?? 0,
|
|
1653
|
+
precision: ((z = s.cost) == null ? void 0 : z.precision) ?? 0
|
|
1654
|
+
}, m = s.amount, a = m.amount == 0 ? X.fromNumber(0) : X.divide([f, m]);
|
|
1653
1655
|
return {
|
|
1654
|
-
...X.multiply([a,
|
|
1655
|
-
currency: ((se =
|
|
1656
|
+
...X.multiply([a, m]),
|
|
1657
|
+
currency: ((se = s.cost) == null ? void 0 : se.currency) || Be(((T = g.currentCountry) == null ? void 0 : T.value) ?? Ct)
|
|
1656
1658
|
};
|
|
1657
1659
|
}), Y = H(() => {
|
|
1658
1660
|
var f;
|
|
1659
|
-
const t = [
|
|
1660
|
-
var
|
|
1661
|
-
const a = (U = (
|
|
1661
|
+
const t = [...$.value].reverse().computeFirst((m) => {
|
|
1662
|
+
var S, U;
|
|
1663
|
+
const a = (U = (S = m.skus) == null ? void 0 : S.find) == null ? void 0 : U.call(S, (z) => z.sku._id === x.sku._id);
|
|
1662
1664
|
return a == null ? void 0 : a.toCostBalances;
|
|
1663
1665
|
});
|
|
1664
1666
|
return t ? {
|
|
1665
|
-
...t.reduce((
|
|
1667
|
+
...t.reduce((m, a) => X.add([m, X.fromDinero(a.cost)]), {
|
|
1666
1668
|
amount: 0,
|
|
1667
1669
|
precision: 0
|
|
1668
1670
|
}),
|
|
1669
|
-
currency:
|
|
1671
|
+
currency: Be((f = g.currentCountry) == null ? void 0 : f.value)
|
|
1670
1672
|
} : "No data";
|
|
1671
1673
|
});
|
|
1672
1674
|
function le() {
|
|
1673
|
-
const { startDate: t, endDate:
|
|
1674
|
-
t !== null &&
|
|
1675
|
+
const { startDate: t, endDate: s } = jt(l.value);
|
|
1676
|
+
t !== null && s !== null && (l.value = {
|
|
1675
1677
|
startDate: t,
|
|
1676
|
-
endDate:
|
|
1678
|
+
endDate: s
|
|
1677
1679
|
});
|
|
1678
1680
|
}
|
|
1679
|
-
const
|
|
1680
|
-
return (t,
|
|
1681
|
-
const f =
|
|
1681
|
+
const y = ze(x, "show");
|
|
1682
|
+
return (t, s) => {
|
|
1683
|
+
const f = D("FmButton"), m = D("FmField"), a = D("FmDateRangePicker"), S = D("FmSpacer"), U = D("FmCircularProgress"), z = D("FmIcon"), se = D("FmTooltip"), T = D("FmMenuDivider"), G = D("FmChip"), W = D("FmCardSection"), ae = D("FmCard"), re = D("FmSideSheet");
|
|
1682
1684
|
return F(), K(re, {
|
|
1683
1685
|
"dismiss-away": "",
|
|
1684
|
-
modelValue: u(
|
|
1685
|
-
"onUpdate:modelValue":
|
|
1686
|
+
modelValue: u(y),
|
|
1687
|
+
"onUpdate:modelValue": s[4] || (s[4] = (q) => Ue(y) ? y.value = q : null),
|
|
1686
1688
|
"close-button": !1,
|
|
1687
1689
|
"max-width": 560
|
|
1688
1690
|
}, {
|
|
1689
|
-
"side-sheet-header":
|
|
1691
|
+
"side-sheet-header": I(() => [
|
|
1690
1692
|
e("div", to, [
|
|
1691
|
-
e("div", no,
|
|
1692
|
-
|
|
1693
|
+
e("div", no, _(u(i)("inventory.stock.history.title", [t.sku.name])), 1),
|
|
1694
|
+
k(f, {
|
|
1693
1695
|
variant: "tertiary",
|
|
1694
1696
|
"prepend-icon": "close",
|
|
1695
|
-
onClick:
|
|
1697
|
+
onClick: s[0] || (s[0] = (q) => y.value = !1)
|
|
1696
1698
|
})
|
|
1697
1699
|
])
|
|
1698
1700
|
]),
|
|
1699
|
-
default:
|
|
1701
|
+
default: I(() => {
|
|
1700
1702
|
var q;
|
|
1701
1703
|
return [
|
|
1702
1704
|
e("div", oo, [
|
|
1703
1705
|
e("div", so, [
|
|
1704
1706
|
e("div", ao, [
|
|
1705
|
-
|
|
1707
|
+
k(a, {
|
|
1706
1708
|
modelValue: l.value,
|
|
1707
|
-
"onUpdate:modelValue":
|
|
1709
|
+
"onUpdate:modelValue": s[1] || (s[1] = (ee) => l.value = ee),
|
|
1708
1710
|
"show-predefined-range": "",
|
|
1709
1711
|
"start-label": "",
|
|
1710
1712
|
"end-label": "",
|
|
1711
1713
|
"z-index": 50
|
|
1712
1714
|
}, {
|
|
1713
|
-
"trigger-button":
|
|
1714
|
-
|
|
1715
|
+
"trigger-button": I(({ opened: ee }) => [
|
|
1716
|
+
k(m, {
|
|
1715
1717
|
"prepend-icon": "calendar_month",
|
|
1716
1718
|
focused: ee
|
|
1717
1719
|
}, {
|
|
1718
|
-
default:
|
|
1719
|
-
ue(
|
|
1720
|
+
default: I(() => [
|
|
1721
|
+
ue(_(l.value.startDate) + " - " + _(l.value.endDate), 1)
|
|
1720
1722
|
]),
|
|
1721
1723
|
_: 2
|
|
1722
1724
|
}, 1032, ["focused"])
|
|
@@ -1724,39 +1726,39 @@ const to = { class: "flex items-center w-full fm-typo-en-title-md-800" }, no = {
|
|
|
1724
1726
|
_: 1
|
|
1725
1727
|
}, 8, ["modelValue"])
|
|
1726
1728
|
]),
|
|
1727
|
-
|
|
1729
|
+
k(f, {
|
|
1728
1730
|
variant: "tertiary",
|
|
1729
|
-
onClick:
|
|
1731
|
+
onClick: s[2] || (s[2] = (ee) => R()),
|
|
1730
1732
|
"prepend-icon": "navigate_before"
|
|
1731
1733
|
}),
|
|
1732
|
-
|
|
1734
|
+
k(f, {
|
|
1733
1735
|
variant: "tertiary",
|
|
1734
|
-
onClick:
|
|
1736
|
+
onClick: s[3] || (s[3] = (ee) => le()),
|
|
1735
1737
|
"prepend-icon": "navigate_next"
|
|
1736
1738
|
})
|
|
1737
1739
|
]),
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
e("div", ro,
|
|
1742
|
-
|
|
1743
|
-
|
|
1740
|
+
C.value ? (F(), O("div", lo, [
|
|
1741
|
+
k(S),
|
|
1742
|
+
k(U, { size: "xl" }),
|
|
1743
|
+
e("div", ro, _(u(i)("inventory.stock.history.loading")), 1),
|
|
1744
|
+
k(S),
|
|
1745
|
+
k(S)
|
|
1744
1746
|
])) : A.value && ((q = A.value) == null ? void 0 : q.length) > 0 ? (F(), O("div", io, [
|
|
1745
|
-
|
|
1746
|
-
default:
|
|
1747
|
-
|
|
1748
|
-
default:
|
|
1747
|
+
k(ae, { variant: "outlined" }, {
|
|
1748
|
+
default: I(() => [
|
|
1749
|
+
k(W, { class: "flex flex-col gap-4" }, {
|
|
1750
|
+
default: I(() => [
|
|
1749
1751
|
e("div", uo, [
|
|
1750
|
-
e("div", co,
|
|
1752
|
+
e("div", co, _(u(i)("inventory.stock.history.summary.title")), 1)
|
|
1751
1753
|
]),
|
|
1752
1754
|
e("div", mo, [
|
|
1753
1755
|
e("div", po, [
|
|
1754
|
-
e("div", vo,
|
|
1755
|
-
e("div", fo,
|
|
1756
|
+
e("div", vo, _(u(i)("inventory.stock.history.summary.totalPurchase")), 1),
|
|
1757
|
+
e("div", fo, _(M.value.PURCHASE), 1)
|
|
1756
1758
|
]),
|
|
1757
1759
|
e("div", yo, [
|
|
1758
1760
|
e("div", _o, [
|
|
1759
|
-
ue(
|
|
1761
|
+
ue(_(u(i)("inventory.stock.history.summary.totalSales")) + " ", 1),
|
|
1760
1762
|
E.value != null ? (F(), K(se, {
|
|
1761
1763
|
key: 0,
|
|
1762
1764
|
variant: "plain",
|
|
@@ -1764,8 +1766,8 @@ const to = { class: "flex items-center w-full fm-typo-en-title-md-800" }, no = {
|
|
|
1764
1766
|
content: `Before: ${E.value}`,
|
|
1765
1767
|
"z-index": 50
|
|
1766
1768
|
}, {
|
|
1767
|
-
default:
|
|
1768
|
-
|
|
1769
|
+
default: I(() => [
|
|
1770
|
+
k(z, {
|
|
1769
1771
|
name: "warning",
|
|
1770
1772
|
size: "sm"
|
|
1771
1773
|
})
|
|
@@ -1773,53 +1775,53 @@ const to = { class: "flex items-center w-full fm-typo-en-title-md-800" }, no = {
|
|
|
1773
1775
|
_: 1
|
|
1774
1776
|
}, 8, ["content"])) : te("", !0)
|
|
1775
1777
|
]),
|
|
1776
|
-
e("div", bo,
|
|
1778
|
+
e("div", bo, _(M.value.SALES), 1)
|
|
1777
1779
|
]),
|
|
1778
1780
|
e("div", ko, [
|
|
1779
|
-
e("div", go,
|
|
1780
|
-
e("div", ho,
|
|
1781
|
+
e("div", go, _(u(i)("inventory.stock.history.summary.totalLose")), 1),
|
|
1782
|
+
e("div", ho, _(M.value.LOSE), 1)
|
|
1781
1783
|
]),
|
|
1782
1784
|
e("div", xo, [
|
|
1783
|
-
e("div", So,
|
|
1784
|
-
e("div", Fo,
|
|
1785
|
+
e("div", So, _(u(i)("inventory.stock.history.summary.totalRequest")), 1),
|
|
1786
|
+
e("div", Fo, _(M.value.REQUEST), 1)
|
|
1785
1787
|
]),
|
|
1786
1788
|
e("div", wo, [
|
|
1787
|
-
e("div", $o,
|
|
1788
|
-
e("div", Ao,
|
|
1789
|
+
e("div", $o, _(u(i)("inventory.stock.history.summary.totalReceive")), 1),
|
|
1790
|
+
e("div", Ao, _(M.value.RECEIVE), 1)
|
|
1789
1791
|
]),
|
|
1790
1792
|
e("div", Vo, [
|
|
1791
|
-
e("div", Co,
|
|
1792
|
-
e("div",
|
|
1793
|
+
e("div", Co, _(u(i)("inventory.stock.history.summary.totalConvert")), 1),
|
|
1794
|
+
e("div", Bo, _(M.value.CONVERT), 1)
|
|
1793
1795
|
]),
|
|
1794
|
-
e("div",
|
|
1795
|
-
e("div", Do,
|
|
1796
|
-
e("div", Io,
|
|
1796
|
+
e("div", Mo, [
|
|
1797
|
+
e("div", Do, _(u(i)("inventory.stock.history.summary.totalDamage")), 1),
|
|
1798
|
+
e("div", Io, _(M.value.DAMAGE), 1)
|
|
1797
1799
|
]),
|
|
1798
1800
|
e("div", jo, [
|
|
1799
|
-
e("div", To,
|
|
1800
|
-
e("div", Uo,
|
|
1801
|
+
e("div", To, _(u(i)("inventory.stock.history.summary.openingBalance")), 1),
|
|
1802
|
+
e("div", Uo, _(P.value), 1)
|
|
1801
1803
|
]),
|
|
1802
1804
|
e("div", Eo, [
|
|
1803
|
-
e("div", Ho,
|
|
1804
|
-
e("div", Po,
|
|
1805
|
+
e("div", Ho, _(u(i)("inventory.stock.history.summary.lastStockBalance")), 1),
|
|
1806
|
+
e("div", Po, _(J.value), 1)
|
|
1805
1807
|
])
|
|
1806
1808
|
]),
|
|
1807
|
-
u(
|
|
1808
|
-
|
|
1809
|
+
u(d).enableTotalCost ? (F(), O("div", Ro, [
|
|
1810
|
+
k(T, { class: "w-full" }),
|
|
1809
1811
|
e("div", Oo, [
|
|
1810
1812
|
e("div", No, [
|
|
1811
|
-
|
|
1812
|
-
default:
|
|
1813
|
+
k(Je, { "z-index": 50 }, {
|
|
1814
|
+
default: I(() => [
|
|
1813
1815
|
e("div", Lo, [
|
|
1814
|
-
ue(
|
|
1815
|
-
|
|
1816
|
+
ue(_(u(i)("inventory.stock.history.estimatedValue")) + " ", 1),
|
|
1817
|
+
k(se, {
|
|
1816
1818
|
variant: "plain",
|
|
1817
1819
|
placement: "top",
|
|
1818
|
-
content: `[${oe.value}] ${u(
|
|
1820
|
+
content: `[${oe.value}] ${u(i)("inventory.stock.history.estimatedValueTooltip")}`,
|
|
1819
1821
|
"z-index": 50
|
|
1820
1822
|
}, {
|
|
1821
|
-
default:
|
|
1822
|
-
|
|
1823
|
+
default: I(() => [
|
|
1824
|
+
k(z, {
|
|
1823
1825
|
name: "help",
|
|
1824
1826
|
size: "sm"
|
|
1825
1827
|
})
|
|
@@ -1831,18 +1833,18 @@ const to = { class: "flex items-center w-full fm-typo-en-title-md-800" }, no = {
|
|
|
1831
1833
|
_: 1
|
|
1832
1834
|
}),
|
|
1833
1835
|
e("div", zo, [
|
|
1834
|
-
t.sku.valuation === u(
|
|
1835
|
-
|
|
1836
|
+
t.sku.valuation === u(Xe).Enum.FIFO ? (F(), O(Z, { key: 0 }, [
|
|
1837
|
+
k(G, {
|
|
1836
1838
|
label: "FIFO",
|
|
1837
1839
|
compact: ""
|
|
1838
1840
|
}),
|
|
1839
|
-
ue(" " +
|
|
1841
|
+
ue(" " + _(typeof Y.value != "string" ? u(ke)(
|
|
1840
1842
|
Y.value,
|
|
1841
1843
|
!1,
|
|
1842
1844
|
Y.value.precision
|
|
1843
1845
|
) : Y.value), 1)
|
|
1844
1846
|
], 64)) : (F(), O(Z, { key: 1 }, [
|
|
1845
|
-
ue(
|
|
1847
|
+
ue(_(typeof L.value != "string" ? u(ke)(
|
|
1846
1848
|
L.value,
|
|
1847
1849
|
!1,
|
|
1848
1850
|
L.value.precision
|
|
@@ -1851,20 +1853,20 @@ const to = { class: "flex items-center w-full fm-typo-en-title-md-800" }, no = {
|
|
|
1851
1853
|
])
|
|
1852
1854
|
]),
|
|
1853
1855
|
e("div", Yo, [
|
|
1854
|
-
|
|
1855
|
-
default:
|
|
1856
|
+
k(Je, { "z-index": 50 }, {
|
|
1857
|
+
default: I(() => [
|
|
1856
1858
|
e("div", Ko, [
|
|
1857
|
-
ue(
|
|
1858
|
-
|
|
1859
|
+
ue(_(u(i)("inventory.stock.history.costSold")) + " ", 1),
|
|
1860
|
+
k(se, {
|
|
1859
1861
|
variant: "plain",
|
|
1860
1862
|
placement: "top",
|
|
1861
1863
|
"z-index": 50
|
|
1862
1864
|
}, {
|
|
1863
|
-
content:
|
|
1864
|
-
e("div", Go,
|
|
1865
|
+
content: I(() => [
|
|
1866
|
+
e("div", Go, _(u(i)("inventory.stock.history.costSoldTooltip")), 1)
|
|
1865
1867
|
]),
|
|
1866
|
-
default:
|
|
1867
|
-
|
|
1868
|
+
default: I(() => [
|
|
1869
|
+
k(z, {
|
|
1868
1870
|
name: "help",
|
|
1869
1871
|
size: "sm"
|
|
1870
1872
|
})
|
|
@@ -1875,7 +1877,7 @@ const to = { class: "flex items-center w-full fm-typo-en-title-md-800" }, no = {
|
|
|
1875
1877
|
]),
|
|
1876
1878
|
_: 1
|
|
1877
1879
|
}),
|
|
1878
|
-
e("div", Wo,
|
|
1880
|
+
e("div", Wo, _(Q.value), 1)
|
|
1879
1881
|
])
|
|
1880
1882
|
])
|
|
1881
1883
|
])) : te("", !0)
|
|
@@ -1885,30 +1887,30 @@ const to = { class: "flex items-center w-full fm-typo-en-title-md-800" }, no = {
|
|
|
1885
1887
|
]),
|
|
1886
1888
|
_: 1
|
|
1887
1889
|
}),
|
|
1888
|
-
|
|
1890
|
+
s[5] || (s[5] = e("div", null, null, -1)),
|
|
1889
1891
|
(F(!0), O(Z, null, ie(A.value, (ee) => (F(), O(Z, {
|
|
1890
1892
|
key: ee.date
|
|
1891
1893
|
}, [
|
|
1892
|
-
t.sku ? (F(), K(
|
|
1894
|
+
t.sku ? (F(), K(Jn, {
|
|
1893
1895
|
key: 0,
|
|
1894
1896
|
record: ee,
|
|
1895
1897
|
sku: t.sku,
|
|
1896
1898
|
bills: V.value,
|
|
1897
|
-
onRefreshHistory:
|
|
1899
|
+
onRefreshHistory: v
|
|
1898
1900
|
}, null, 8, ["record", "sku", "bills"])) : te("", !0)
|
|
1899
1901
|
], 64))), 128))
|
|
1900
1902
|
])) : (F(), O("div", qo, [
|
|
1901
|
-
|
|
1903
|
+
k(S),
|
|
1902
1904
|
e("div", null, [
|
|
1903
1905
|
e("img", {
|
|
1904
1906
|
src: u(Xt),
|
|
1905
1907
|
alt: "List is empty"
|
|
1906
1908
|
}, null, 8, Xo)
|
|
1907
1909
|
]),
|
|
1908
|
-
e("div",
|
|
1909
|
-
e("div",
|
|
1910
|
-
|
|
1911
|
-
|
|
1910
|
+
e("div", Qo, _(u(i)("inventory.stock.history.noRecords")), 1),
|
|
1911
|
+
e("div", Jo, _(u(i)("inventory.stock.history.changeDateRange")), 1),
|
|
1912
|
+
k(S),
|
|
1913
|
+
k(S)
|
|
1912
1914
|
]))
|
|
1913
1915
|
])
|
|
1914
1916
|
];
|
|
@@ -1920,30 +1922,30 @@ const to = { class: "flex items-center w-full fm-typo-en-title-md-800" }, no = {
|
|
|
1920
1922
|
}), es = {
|
|
1921
1923
|
key: 0,
|
|
1922
1924
|
class: "flex items-center gap-1"
|
|
1923
|
-
}, ts = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ns = { class: "flex flex-col gap-8" }, os = { class: "flex flex-col" }, ss = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, as = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary line-clamp-1" },
|
|
1925
|
+
}, ts = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ns = { class: "flex flex-col gap-8" }, os = { class: "flex flex-col" }, ss = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, as = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary line-clamp-1" }, gs = /* @__PURE__ */ ce({
|
|
1924
1926
|
__name: "StockView",
|
|
1925
|
-
setup(
|
|
1926
|
-
const { t:
|
|
1927
|
-
|
|
1928
|
-
const
|
|
1929
|
-
() => new Set(
|
|
1930
|
-
),
|
|
1927
|
+
setup(b) {
|
|
1928
|
+
const { t: g } = de(), p = Re(), o = ve(), j = Oe(), h = it(), d = _e(), i = st(), x = Ut(), { columnDefs: C } = on(), c = Le(), l = be();
|
|
1929
|
+
o.watchLocation(V);
|
|
1930
|
+
const v = H(
|
|
1931
|
+
() => new Set(x.getAvailableItems(x.businessSubsidiaryId))
|
|
1932
|
+
), $ = N(!1);
|
|
1931
1933
|
async function A() {
|
|
1932
|
-
|
|
1933
|
-
title:
|
|
1934
|
-
message:
|
|
1934
|
+
c.open({
|
|
1935
|
+
title: g("inventory.stock.stock_balance.refreshBalance"),
|
|
1936
|
+
message: g("inventory.stock.stock_balance.refreshBalanceDescription"),
|
|
1935
1937
|
closeButton: !0,
|
|
1936
1938
|
primaryActions: {
|
|
1937
|
-
text:
|
|
1939
|
+
text: g("common.confirm"),
|
|
1938
1940
|
close: !0
|
|
1939
1941
|
},
|
|
1940
1942
|
secondaryActions: {
|
|
1941
|
-
text:
|
|
1943
|
+
text: g("common.close"),
|
|
1942
1944
|
close: !0,
|
|
1943
1945
|
variant: "tertiary"
|
|
1944
1946
|
}
|
|
1945
1947
|
}).onPrimary(async () => {
|
|
1946
|
-
await
|
|
1948
|
+
await d.recalculation.refreshCurrentBalances(), l.open({
|
|
1947
1949
|
title: "Refresh Stock Balance",
|
|
1948
1950
|
message: "Stock balance refresh has been queued. This may take a moment to complete.",
|
|
1949
1951
|
type: "success"
|
|
@@ -1951,18 +1953,18 @@ const to = { class: "flex items-center w-full fm-typo-en-title-md-800" }, no = {
|
|
|
1951
1953
|
});
|
|
1952
1954
|
}
|
|
1953
1955
|
async function V() {
|
|
1954
|
-
if (
|
|
1955
|
-
|
|
1956
|
+
if (o._currentLocation) {
|
|
1957
|
+
$.value = !0;
|
|
1956
1958
|
try {
|
|
1957
|
-
await
|
|
1959
|
+
await j.readStockBalance(), await j.readProductBalance(), await i.readStockEstimateBalance();
|
|
1958
1960
|
} catch (L) {
|
|
1959
1961
|
l.open({
|
|
1960
|
-
title:
|
|
1961
|
-
message:
|
|
1962
|
+
title: g("inventory.stock.error.title"),
|
|
1963
|
+
message: g("inventory.stock.error.message"),
|
|
1962
1964
|
type: "error"
|
|
1963
1965
|
}), console.error("error on fetch stock balance", L);
|
|
1964
1966
|
} finally {
|
|
1965
|
-
|
|
1967
|
+
$.value = !1;
|
|
1966
1968
|
}
|
|
1967
1969
|
}
|
|
1968
1970
|
}
|
|
@@ -1984,48 +1986,48 @@ const to = { class: "flex items-center w-full fm-typo-en-title-md-800" }, no = {
|
|
|
1984
1986
|
}
|
|
1985
1987
|
]
|
|
1986
1988
|
}), w = H(() => {
|
|
1987
|
-
var le,
|
|
1989
|
+
var le, y, t;
|
|
1988
1990
|
const L = r.value ? Et.build(r.value) : null, Y = [];
|
|
1989
|
-
for (const
|
|
1991
|
+
for (const s of p.skus) {
|
|
1990
1992
|
let f = !0;
|
|
1991
|
-
if (
|
|
1993
|
+
if (x.isEnabled && M.value && v.value && f && (f = v.value.has(s._id)), L && f && (f = Ht(
|
|
1992
1994
|
{
|
|
1993
|
-
status:
|
|
1995
|
+
status: s.isInactive ? "Inactive" : "Active"
|
|
1994
1996
|
},
|
|
1995
1997
|
L
|
|
1996
1998
|
)), f) {
|
|
1997
|
-
const
|
|
1998
|
-
let a = (
|
|
1999
|
-
(z) => z.id ===
|
|
2000
|
-
)) == null ? void 0 :
|
|
2001
|
-
(z) => z.id ===
|
|
1999
|
+
const m = s.trackingMeasurement;
|
|
2000
|
+
let a = (y = (le = j.stockBalance.skus) == null ? void 0 : le.find(
|
|
2001
|
+
(z) => z.id === s._id
|
|
2002
|
+
)) == null ? void 0 : y.balance, S = i.inventoryForecast.skus.find(
|
|
2003
|
+
(z) => z.id === s._id
|
|
2002
2004
|
);
|
|
2003
2005
|
const U = {
|
|
2004
|
-
...
|
|
2006
|
+
...s,
|
|
2005
2007
|
balance: a ?? {
|
|
2006
2008
|
amount: 0,
|
|
2007
2009
|
precision: 0
|
|
2008
2010
|
},
|
|
2009
|
-
day: (
|
|
2010
|
-
trackingUnitAbbrev:
|
|
2011
|
+
day: (S == null ? void 0 : S.depletionDays) ?? void 0,
|
|
2012
|
+
trackingUnitAbbrev: m ? ((t = s.unit.measurements.find((z) => z.id === m)) == null ? void 0 : t.abbrev) ?? "" : s.unit.abbrev
|
|
2011
2013
|
};
|
|
2012
2014
|
Y.push(U);
|
|
2013
2015
|
}
|
|
2014
2016
|
}
|
|
2015
2017
|
return Y;
|
|
2016
|
-
}),
|
|
2018
|
+
}), B = N(""), M = N(!0), { breakpoints: E } = Kt(), P = H(() => E.value.xs || E.value.sm), J = H(() => P.value ? 10 : 20), Q = Pt(), R = H(() => [
|
|
2017
2019
|
{
|
|
2018
|
-
label:
|
|
2020
|
+
label: g("inventory.stock.stock_balance.refreshBalance"),
|
|
2019
2021
|
value: "refresh-balance",
|
|
2020
2022
|
isPrimary: !0,
|
|
2021
2023
|
prependIcon: "calculate"
|
|
2022
2024
|
},
|
|
2023
2025
|
{
|
|
2024
|
-
label:
|
|
2026
|
+
label: g("inventory.common.refresh"),
|
|
2025
2027
|
value: "refresh"
|
|
2026
2028
|
},
|
|
2027
2029
|
{
|
|
2028
|
-
label:
|
|
2030
|
+
label: g("inventory.common.export"),
|
|
2029
2031
|
value: "export"
|
|
2030
2032
|
}
|
|
2031
2033
|
]);
|
|
@@ -2040,14 +2042,14 @@ const to = { class: "flex items-center w-full fm-typo-en-title-md-800" }, no = {
|
|
|
2040
2042
|
}
|
|
2041
2043
|
}
|
|
2042
2044
|
return (L, Y) => {
|
|
2043
|
-
const le =
|
|
2045
|
+
const le = D("FmSwitch"), y = D("FmTable");
|
|
2044
2046
|
return F(), K(Rt, {
|
|
2045
|
-
title: u(
|
|
2047
|
+
title: u(g)("inventory.stock.title"),
|
|
2046
2048
|
actions: R.value,
|
|
2047
2049
|
"onClick:action": oe
|
|
2048
2050
|
}, {
|
|
2049
|
-
default:
|
|
2050
|
-
var t,
|
|
2051
|
+
default: I(() => {
|
|
2052
|
+
var t, s, f, m;
|
|
2051
2053
|
return [
|
|
2052
2054
|
e("div", {
|
|
2053
2055
|
class: he([
|
|
@@ -2058,25 +2060,26 @@ const to = { class: "flex items-center w-full fm-typo-en-title-md-800" }, no = {
|
|
|
2058
2060
|
}
|
|
2059
2061
|
])
|
|
2060
2062
|
}, [
|
|
2061
|
-
|
|
2063
|
+
k(Ot, {
|
|
2062
2064
|
searchable: "",
|
|
2063
2065
|
"change-location": "",
|
|
2064
|
-
search:
|
|
2065
|
-
"onUpdate:search": Y[1] || (Y[1] = (a) =>
|
|
2066
|
+
search: B.value,
|
|
2067
|
+
"onUpdate:search": Y[1] || (Y[1] = (a) => B.value = a),
|
|
2068
|
+
"hide-filter-options": !0,
|
|
2066
2069
|
filterable: "",
|
|
2067
2070
|
"filter-attributes": n.value,
|
|
2068
2071
|
filter: r.value,
|
|
2069
2072
|
"onUpdate:filter": Y[2] || (Y[2] = (a) => r.value = a)
|
|
2070
2073
|
}, {
|
|
2071
|
-
default:
|
|
2072
|
-
u(
|
|
2073
|
-
e("span", ts,
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
default:
|
|
2077
|
-
|
|
2078
|
-
modelValue:
|
|
2079
|
-
"onUpdate:modelValue": Y[0] || (Y[0] = (a) =>
|
|
2074
|
+
default: I(() => [
|
|
2075
|
+
u(x).isEnabled ? (F(), O("div", es, [
|
|
2076
|
+
e("span", ts, _(u(g)("inventory.integration.netsuite.subsidiaryHierarchy.filtering")), 1),
|
|
2077
|
+
k(zt),
|
|
2078
|
+
k(Pe, null, {
|
|
2079
|
+
default: I(() => [
|
|
2080
|
+
k(le, {
|
|
2081
|
+
modelValue: M.value,
|
|
2082
|
+
"onUpdate:modelValue": Y[0] || (Y[0] = (a) => M.value = a)
|
|
2080
2083
|
}, null, 8, ["modelValue"])
|
|
2081
2084
|
]),
|
|
2082
2085
|
_: 1
|
|
@@ -2085,46 +2088,46 @@ const to = { class: "flex items-center w-full fm-typo-en-title-md-800" }, no = {
|
|
|
2085
2088
|
]),
|
|
2086
2089
|
_: 1
|
|
2087
2090
|
}, 8, ["search", "filter-attributes", "filter"]),
|
|
2088
|
-
(F(), K(
|
|
2089
|
-
style:
|
|
2090
|
-
"column-defs": u(
|
|
2091
|
+
(F(), K(y, {
|
|
2092
|
+
style: tt(u(Q).tableHeight),
|
|
2093
|
+
"column-defs": u(C),
|
|
2091
2094
|
"row-data": w.value,
|
|
2092
|
-
"search-value":
|
|
2093
|
-
loading:
|
|
2094
|
-
key: (t = u(
|
|
2095
|
-
onRowClick: Y[3] || (Y[3] = (a) => u(
|
|
2096
|
-
"page-size":
|
|
2095
|
+
"search-value": B.value,
|
|
2096
|
+
loading: $.value || !u(o)._currentLocation,
|
|
2097
|
+
key: (t = u(o)._currentLocation) == null ? void 0 : t.dbName,
|
|
2098
|
+
onRowClick: Y[3] || (Y[3] = (a) => u(h).showSkuHistory(a.original)),
|
|
2099
|
+
"page-size": J.value
|
|
2097
2100
|
}, {
|
|
2098
|
-
"list-row":
|
|
2099
|
-
|
|
2101
|
+
"list-row": I((a) => [
|
|
2102
|
+
k(Nt, {
|
|
2100
2103
|
row: a,
|
|
2101
|
-
onRowClick: u(
|
|
2104
|
+
onRowClick: u(h).showSkuHistory
|
|
2102
2105
|
}, {
|
|
2103
|
-
default:
|
|
2106
|
+
default: I((S) => {
|
|
2104
2107
|
var U, z, se, T, G, W, ae, re, q, ee;
|
|
2105
2108
|
return [
|
|
2106
2109
|
e("div", ns, [
|
|
2107
2110
|
e("div", os, [
|
|
2108
2111
|
e("div", ss, [
|
|
2109
|
-
|
|
2110
|
-
render: (se = (z = (U =
|
|
2111
|
-
props: (G = (T =
|
|
2112
|
+
k(u(Qe), {
|
|
2113
|
+
render: (se = (z = (U = S.code) == null ? void 0 : U.column) == null ? void 0 : z.columnDef) == null ? void 0 : se.cell,
|
|
2114
|
+
props: (G = (T = S.code) == null ? void 0 : T.getContext) == null ? void 0 : G.call(T)
|
|
2112
2115
|
}, null, 8, ["render", "props"])
|
|
2113
2116
|
]),
|
|
2114
2117
|
e("div", as, [
|
|
2115
|
-
|
|
2116
|
-
render: (re = (ae = (W =
|
|
2117
|
-
props: (ee = (q =
|
|
2118
|
+
k(u(Qe), {
|
|
2119
|
+
render: (re = (ae = (W = S.name) == null ? void 0 : W.column) == null ? void 0 : ae.columnDef) == null ? void 0 : re.cell,
|
|
2120
|
+
props: (ee = (q = S.name) == null ? void 0 : q.getContext) == null ? void 0 : ee.call(q)
|
|
2118
2121
|
}, null, 8, ["render", "props"])
|
|
2119
2122
|
])
|
|
2120
2123
|
]),
|
|
2121
2124
|
e("div", null, [
|
|
2122
|
-
|
|
2125
|
+
k(Te, {
|
|
2123
2126
|
days: a.original.day
|
|
2124
2127
|
}, null, 8, ["days"])
|
|
2125
2128
|
]),
|
|
2126
2129
|
e("div", null, [
|
|
2127
|
-
|
|
2130
|
+
k(rt, {
|
|
2128
2131
|
class: "xs:w-[160px]",
|
|
2129
2132
|
unit: a.original.unit,
|
|
2130
2133
|
sku: a.original,
|
|
@@ -2142,9 +2145,9 @@ const to = { class: "flex items-center w-full fm-typo-en-title-md-800" }, no = {
|
|
|
2142
2145
|
}, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"]))
|
|
2143
2146
|
], 2),
|
|
2144
2147
|
(F(), K(dt, { to: "body" }, [
|
|
2145
|
-
(
|
|
2146
|
-
(f = u(
|
|
2147
|
-
(
|
|
2148
|
+
(s = u(h).stockHistoryProps) != null && s.sku ? (F(), K(Zo, Ae(Ve({ key: 0 }, u(h).stockHistoryProps)), null, 16)) : te("", !0),
|
|
2149
|
+
(f = u(h).convertSkuDialogProps) != null && f.sku ? (F(), K(kn, Ae(Ve({ key: 1 }, u(h).convertSkuDialogProps)), null, 16)) : te("", !0),
|
|
2150
|
+
(m = u(h).adjustSkuDialogProps) != null && m.stock ? (F(), K(Vn, Ae(Ve({ key: 2 }, u(h).adjustSkuDialogProps)), null, 16)) : te("", !0)
|
|
2148
2151
|
]))
|
|
2149
2152
|
];
|
|
2150
2153
|
}),
|
|
@@ -2154,5 +2157,5 @@ const to = { class: "flex items-center w-full fm-typo-en-title-md-800" }, no = {
|
|
|
2154
2157
|
}
|
|
2155
2158
|
});
|
|
2156
2159
|
export {
|
|
2157
|
-
|
|
2160
|
+
gs as default
|
|
2158
2161
|
};
|