@feedmepos/mf-inventory-portal 1.2.30-dev.1 → 1.2.30
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-kX4bqoEe.js → App-CZJre5y8.js} +57 -55
- package/dist/{ApprovalView-DCNKqVE2.js → ApprovalView-CnxHxojY.js} +34 -28
- package/dist/{BindingsDialog-d7f1f8gf.js → BindingsDialog-C6lCOPNs.js} +2 -2
- package/dist/{BindingsPicker-2HJOx0QW.js → BindingsPicker-DZtFKLQ5.js} +6 -5
- package/dist/{BindingsTable-CPAjxOZG.js → BindingsTable-BmQGLuJ4.js} +28 -24
- package/dist/{ClosingDraftView-CUng41eo.js → ClosingDraftView-KLtlh31f.js} +183 -175
- package/dist/{ClosingHistoryView-CcGc2NwU.js → ClosingHistoryView-Rf1yMhMj.js} +43 -41
- package/dist/ClosingTemplateView-C_IiKnGx.js +2019 -0
- package/dist/{DeliveryOrderPrintPreview-BsM-CCc5.js → DeliveryOrderPrintPreview-UF7V005U.js} +15 -14
- package/dist/FmDroppableField-J0xUsOTV.js +154 -0
- package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-cuggJ5Xd.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-BcMvEdc0.js} +74 -72
- package/dist/FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-CqAeF0wL.js +279 -0
- package/dist/{FmMultiselectDialog-BGbrqXUF.js → FmMultiselectDialog-B0aKuf2o.js} +1 -1
- package/dist/FmMultiselectDialog-BasrjBFA.js +597 -0
- package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-isogcN1O.js → FmUnitInput.vue_vue_type_script_setup_true_lang-CaYJJkXz.js} +51 -49
- package/dist/{ImportView-wAVrMEwL.js → ImportView-DRSoz0uM.js} +81 -74
- package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-DVUF4I2Q.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-DA8SlWPy.js} +5 -5
- package/dist/{IngredientGroupView-BZczeXdL.js → IngredientGroupView-D5Laak2-.js} +73 -65
- package/dist/{IngredientsView-D5N5Y1ZY.js → IngredientsView-TG3fPQhR.js} +358 -345
- package/dist/{IntegrationView-Hrslmuc1.js → IntegrationView-CElpjyo7.js} +219 -209
- package/dist/{InventoryBindingForm-DH6wgxOG.js → InventoryBindingForm-CBgxRYBd.js} +1 -1
- package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-Drr5vD6f.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-Ys5GBHoQ.js} +41 -40
- package/dist/{InventoryBindingSummary-BU1ehpQZ.js → InventoryBindingSummary-OK3vNWhi.js} +1 -1
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-1ueC4GfZ.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-9QRntUlk.js} +5 -5
- package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-FHcU1zZt.js → PremiumBadge.vue_vue_type_script_setup_true_lang-Bc01NoOn.js} +22 -21
- package/dist/{PublishView-CQtj0f31.js → PublishView-CLMfiLjP.js} +26 -23
- package/dist/{PurchaseOrderPrintPreview-BQyXtHST.js → PurchaseOrderPrintPreview-Dy77yWDC.js} +10 -9
- package/dist/{ReceiveRequestView-Dm-h_SrY.js → ReceiveRequestView-BhD-NaHE.js} +478 -462
- package/dist/{RecipeView-DNNRvr1w.js → RecipeView-RWaO94w_.js} +73 -64
- package/dist/SingleColumnLayout.vue_vue_type_script_setup_true_lang-DY7TaxPK.js +251 -0
- package/dist/{StockView-CaOm5BCx.js → StockView-D5t8OxaG.js} +292 -282
- package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-Z91XRszD.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-3Asf1TGd.js} +1 -1
- package/dist/{SupplierView-JSII9qwL.js → SupplierView-DiospFKq.js} +92 -80
- package/dist/SystemTrailDialog.vue_vue_type_script_setup_true_lang-DfCHteOF.js +177 -0
- package/dist/TableActionableRow.vue_vue_type_script_setup_true_lang-DlNJ6kRg.js +135 -0
- package/dist/TemplatePublishDialog.vue_vue_type_script_setup_true_lang-CNtvx-LA.js +123 -0
- package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-Mehd4lGs.js → TransferDetails.vue_vue_type_script_setup_true_lang-p959Op4k.js} +318 -305
- package/dist/{TransferTemplateView-DyCpNKJd.js → TransferTemplateView-ePZFdZ0p.js} +228 -216
- package/dist/{UnitView-CqN7mlJ2.js → UnitView-Banlxw7y.js} +70 -63
- package/dist/{WarehouseView-gFWD-m8e.js → WarehouseView-BL-p5hbi.js} +123 -114
- package/dist/WastageTemplateView-B1pmSuW0.js +2288 -0
- package/dist/_plugin-vue_export-helper-CHgC5LLL.js +9 -0
- package/dist/app-EpEEb8EO.js +64040 -0
- package/dist/app-rgirz_52.js +8024 -0
- package/dist/app.d.ts +0 -21
- package/dist/app.js +6 -6
- package/dist/closing-template-zIjwO1_E.js +117 -0
- package/dist/date2-Dnc8Y81g.js +116 -0
- package/dist/dayjs.min-TdUgzmww.js +282 -0
- package/dist/{decimal-DfF_g5rc.js → decimal-C6s3GvGb.js} +4 -3
- package/dist/defineDeepModel-BSaaXVBF.js +19 -0
- package/dist/duplicate-template-Bw0H416G.js +34 -0
- package/dist/feature-C95Hao53.js +20162 -0
- package/dist/form-mode.enum-BKiNVH6A.js +4 -0
- package/dist/format-time-from-id-DlbHo6kY.js +15 -0
- package/dist/{format-unit-display-ivAljvlo.js → format-unit-display-QBS54q0R.js} +308 -297
- package/dist/{import-export.helper-B2MWv9v7.js → import-export.helper-CUKCKtP7.js} +56 -52
- package/dist/index-CFn_9RMm.js +45 -0
- package/dist/{index-DZaT0ZaL.js → index-S9Ak__QC.js} +1 -1
- package/dist/{index-BbhuWHyh.js → index-goD-WGVb.js} +16 -14
- package/dist/lodash-gq8IrP4j.js +3678 -0
- package/dist/netsuite-CnhAKyAO.js +4316 -0
- package/dist/{purchase-order-template-DdybMC_P.js → purchase-order-template-CBIpWdEW.js} +1 -1
- package/dist/router/shared.spec.d.ts +1 -0
- package/dist/row-action.enum-BcW_L_nE.js +67 -0
- package/dist/rules-DKklsaS1.js +201 -0
- package/dist/{stock-BYagIdsj.js → stock-3K93Mif9.js} +1 -1
- package/dist/{stock-V4ciPiBe.js → stock-BW8fen3H.js} +11 -10
- package/dist/style.css +1 -1
- package/dist/{supplier-CgtB1I9I.js → supplier-CObCSfot.js} +27 -26
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{use-ingredient-select-dialog-BIQovyZX.js → use-ingredient-select-dialog-DwvQiaVW.js} +4 -3
- package/dist/{use-inventory-binding-dialog-DyjicXgc.js → use-inventory-binding-dialog-CuLEHLDM.js} +4 -3
- package/dist/use-template-enabled-locations-2-DkUJeppb.js +111 -0
- package/dist/views/adjustment-template/wastage-template/table.d.ts +1 -1
- package/dist/views/closing-template/components/closing-template-form/composables/use-closing-template-items.d.ts +0 -1
- package/dist/views/closing-template/composables/use-closing-template-actions.d.ts +1 -13
- package/dist/views/closing-template/composables/use-closing-template-table.d.ts +0 -12
- package/dist/vue-i18n-CUznvVzc.js +2365 -0
- package/dist/xlsx-bT1p3YVR.js +24004 -0
- package/dist/xlsx.util-Cr9DpDFb.js +78 -0
- package/package.json +5 -5
- package/dist/ClosingTemplateView-D8IAdhDb.js +0 -2041
- package/dist/app-CnQ49Lyb.js +0 -131483
|
@@ -1,18 +1,28 @@
|
|
|
1
1
|
import { defineComponent as ue, ref as O, computed as P, resolveComponent as U, openBlock as V, createBlock as z, withCtx as T, createElementVNode as e, normalizeClass as he, toDisplayString as v, createVNode as y, createElementBlock as Y, Fragment as ne, renderList as ie, unref as s, h as ye, watch as xe, isRef as je, createCommentVNode as se, reactive as nt, mergeModels as qe, useModel as pt, onMounted as Le, createTextVNode as de, normalizeStyle as ot, Teleport as ft, normalizeProps as Te, mergeProps as He } from "vue";
|
|
2
|
-
import {
|
|
3
|
-
import { u as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
|
|
2
|
+
import { F as ze, u as vt, _ as yt } from "./SingleColumnLayout.vue_vue_type_script_setup_true_lang-DY7TaxPK.js";
|
|
3
|
+
import { u as ke, c as De, a as Be, F as Xe, D as _t, A as te, t as kt, o as bt, z as gt, s as Q, h as Ee, i as ht, e as xt } from "./app-EpEEb8EO.js";
|
|
4
|
+
import { u as Me } from "./stock-BW8fen3H.js";
|
|
5
|
+
import { c as St, _ as Ft, F as Je } from "./TableActionableRow.vue_vue_type_script_setup_true_lang-DlNJ6kRg.js";
|
|
6
|
+
import { g as Se } from "./decimal-C6s3GvGb.js";
|
|
7
|
+
import { d as pe } from "./dayjs.min-TdUgzmww.js";
|
|
8
|
+
import { e as wt, u as st, i as at, _ as Qe } from "./PremiumBadge.vue_vue_type_script_setup_true_lang-Bc01NoOn.js";
|
|
9
|
+
import { _ as Ne, S as Pe, g as lt, a as At } from "./SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-3Asf1TGd.js";
|
|
10
|
+
import { _ as $t } from "./PreviewBadge.vue_vue_type_script_setup_true_lang-CRZiQHjx.js";
|
|
11
|
+
import { useI18n as ce, useCoreStore as Ge } from "@feedmepos/mf-common";
|
|
12
|
+
import { useSnackbar as be, useDialog as Ie, useProxiedModel as Ue, useBreakpoints as Vt } from "@feedmepos/ui-library";
|
|
13
|
+
import { defineStore as Ct } from "pinia";
|
|
14
|
+
import { g as Ye, a as ve, f as jt, t as $e, h as Ve, A as Dt, M as Bt, d as _e, i as Mt, j as Ze, k as rt, l as Ke, R as It, e as we, m as Ut } from "./rules-DKklsaS1.js";
|
|
15
|
+
import { u as ge } from "./stock-3K93Mif9.js";
|
|
16
|
+
import { u as Tt } from "./use-inventory-binding-dialog-CuLEHLDM.js";
|
|
17
|
+
import { a as it } from "./FmMultiselectDialog-BasrjBFA.js";
|
|
18
|
+
import { _ as Ht } from "./NumberPrecisionInput.vue_vue_type_script_setup_true_lang-9QRntUlk.js";
|
|
19
|
+
import { a as Et, b as Pt, f as ut, t as Rt, c as Ot, p as Nt, n as Yt, d as Lt } from "./date2-Dnc8Y81g.js";
|
|
20
|
+
import { i as zt, _ as Gt } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-CqAeF0wL.js";
|
|
21
|
+
import { E as Kt } from "./empty-placeholder-wf6-BWE8.js";
|
|
22
|
+
import { F as Re, u as Wt } from "./feature-C95Hao53.js";
|
|
23
|
+
import { u as qt } from "./netsuite-CnhAKyAO.js";
|
|
24
|
+
import { N as Xt, H as Jt } from "./app-rgirz_52.js";
|
|
25
|
+
var Ae = /* @__PURE__ */ ((k) => (k.History = "History", k.Convert = "Convert", k.Adjust = "Adjust", k))(Ae || {});
|
|
16
26
|
const Qt = [
|
|
17
27
|
{
|
|
18
28
|
translationKey: "inventory.stock.action.history",
|
|
@@ -45,7 +55,7 @@ async function en(k) {
|
|
|
45
55
|
/ /g,
|
|
46
56
|
"_"
|
|
47
57
|
)}_${pe().format("DD_MM_YYYY_HHmm")}.xlsx`;
|
|
48
|
-
await
|
|
58
|
+
await wt(
|
|
49
59
|
[
|
|
50
60
|
{
|
|
51
61
|
name: "stock",
|
|
@@ -62,16 +72,16 @@ async function en(k) {
|
|
|
62
72
|
{
|
|
63
73
|
name: "Balance",
|
|
64
74
|
selector: (o) => {
|
|
65
|
-
const
|
|
66
|
-
return
|
|
75
|
+
const A = Ce(o, o.unit);
|
|
76
|
+
return A.type === "unit" ? Se(o.balance, o.unit, null, !1) : Se(o.balance, o.unit, A.measurement, !1);
|
|
67
77
|
}
|
|
68
78
|
},
|
|
69
79
|
{
|
|
70
80
|
name: "Unit",
|
|
71
81
|
selector: (o) => {
|
|
72
82
|
var S;
|
|
73
|
-
const
|
|
74
|
-
return
|
|
83
|
+
const A = Ce(o, o.unit);
|
|
84
|
+
return A.type === "unit" ? o.unit.abbrev : ((S = o.unit.measurements.find((m) => m.id === A.measurement)) == null ? void 0 : S.abbrev) || "";
|
|
75
85
|
}
|
|
76
86
|
}
|
|
77
87
|
]
|
|
@@ -109,43 +119,43 @@ const tn = { class: "fm-typo-en-body-md-400 flex-grow" }, ct = /* @__PURE__ */ u
|
|
|
109
119
|
return `uom:${j._id}`;
|
|
110
120
|
}
|
|
111
121
|
function d(j) {
|
|
112
|
-
const
|
|
113
|
-
j ? localStorage.setItem(
|
|
122
|
+
const w = g(o.sku);
|
|
123
|
+
j ? localStorage.setItem(w, j) : localStorage.setItem(w, o.unit._id), A.value = Ce(o.sku, o.unit);
|
|
114
124
|
}
|
|
115
|
-
const o = k,
|
|
125
|
+
const o = k, A = O(Ce(o.sku, o.unit)), S = P(() => {
|
|
116
126
|
const { measurements: j } = o.unit;
|
|
117
127
|
return [
|
|
118
128
|
{
|
|
119
129
|
label: `${Se(o.amount, o.unit)}`,
|
|
120
130
|
value: null
|
|
121
131
|
},
|
|
122
|
-
...j.map(({ id:
|
|
123
|
-
label: `${Se(o.amount, o.unit,
|
|
124
|
-
value:
|
|
132
|
+
...j.map(({ id: w }) => ({
|
|
133
|
+
label: `${Se(o.amount, o.unit, w)}`,
|
|
134
|
+
value: w
|
|
125
135
|
}))
|
|
126
136
|
];
|
|
127
137
|
});
|
|
128
138
|
function m({ value: j }) {
|
|
129
|
-
return s(
|
|
139
|
+
return s(A).type === "unit" ? j === null : j === s(A).measurement;
|
|
130
140
|
}
|
|
131
141
|
const i = P(
|
|
132
142
|
() => {
|
|
133
143
|
var j;
|
|
134
|
-
return ((j = S.value.find((
|
|
144
|
+
return ((j = S.value.find((w) => m(w))) == null ? void 0 : j.label) ?? "";
|
|
135
145
|
}
|
|
136
|
-
),
|
|
137
|
-
return (j,
|
|
146
|
+
), F = O(!1);
|
|
147
|
+
return (j, w) => {
|
|
138
148
|
const u = U("FmIcon"), b = U("FmMenuItem"), C = U("FmMenu");
|
|
139
149
|
return V(), z(C, {
|
|
140
150
|
"stop-click-propagation": "",
|
|
141
|
-
onMenuChanged:
|
|
151
|
+
onMenuChanged: w[0] || (w[0] = (B) => F.value = B)
|
|
142
152
|
}, {
|
|
143
153
|
"menu-button": T(() => [
|
|
144
154
|
e("button", {
|
|
145
155
|
type: "button",
|
|
146
156
|
class: he([
|
|
147
157
|
"w-full text-left flex items-center gap-8 cursor-pointer fm-corner-radius-sm px-8 py-4 border bg-white",
|
|
148
|
-
|
|
158
|
+
F.value ? "border-fm-color-primary" : "border-fm-color-neutral-gray-100"
|
|
149
159
|
])
|
|
150
160
|
}, [
|
|
151
161
|
e("div", tn, v(i.value), 1),
|
|
@@ -171,22 +181,22 @@ const tn = { class: "fm-typo-en-body-md-400 flex-grow" }, ct = /* @__PURE__ */ u
|
|
|
171
181
|
__name: "StockHeaderPreview",
|
|
172
182
|
setup(k) {
|
|
173
183
|
const { t: g } = ce();
|
|
174
|
-
return (d, o) => (V(), z(
|
|
184
|
+
return (d, o) => (V(), z($t, null, {
|
|
175
185
|
default: T(() => [
|
|
176
186
|
e("div", nn, v(s(g)("inventory.stock.prediction.daysRemaining")), 1)
|
|
177
187
|
]),
|
|
178
188
|
_: 1
|
|
179
189
|
}));
|
|
180
190
|
}
|
|
181
|
-
}), dt =
|
|
182
|
-
const k = O(!1), g = ke(), d = Me(), o =
|
|
191
|
+
}), dt = Ct("stockActions", () => {
|
|
192
|
+
const k = O(!1), g = ke(), d = Me(), o = st(), A = be(), S = Ie(), { t: m } = ce();
|
|
183
193
|
async function i() {
|
|
184
194
|
if (g._currentLocation) {
|
|
185
195
|
k.value = !0;
|
|
186
196
|
try {
|
|
187
197
|
await d.readStockBalance(), await d.readProductBalance(), await o.readStockEstimateBalance();
|
|
188
198
|
} catch {
|
|
189
|
-
|
|
199
|
+
A.open({
|
|
190
200
|
title: m("inventory.stock.error.title"),
|
|
191
201
|
message: m("inventory.stock.error.message"),
|
|
192
202
|
type: "error"
|
|
@@ -196,9 +206,9 @@ const tn = { class: "fm-typo-en-body-md-400 flex-grow" }, ct = /* @__PURE__ */ u
|
|
|
196
206
|
}
|
|
197
207
|
}
|
|
198
208
|
}
|
|
199
|
-
const
|
|
209
|
+
const F = O();
|
|
200
210
|
async function j(D) {
|
|
201
|
-
var x, _,
|
|
211
|
+
var x, _, $;
|
|
202
212
|
if (!!!((_ = (x = D.convert) == null ? void 0 : x.inventoryBindings) != null && _.length)) {
|
|
203
213
|
S.open({
|
|
204
214
|
title: m("inventory.stock.error.convert.title"),
|
|
@@ -207,31 +217,31 @@ const tn = { class: "fm-typo-en-body-md-400 flex-grow" }, ct = /* @__PURE__ */ u
|
|
|
207
217
|
return;
|
|
208
218
|
}
|
|
209
219
|
const l = {
|
|
210
|
-
maxCount: ((
|
|
220
|
+
maxCount: (($ = d.productBalance.find(({ id: H }) => H === D._id)) == null ? void 0 : $.count) || 0,
|
|
211
221
|
sku: D,
|
|
212
222
|
show: !0,
|
|
213
223
|
"onUpdate:show"(H) {
|
|
214
|
-
|
|
224
|
+
F.value.show = H;
|
|
215
225
|
},
|
|
216
226
|
onSubmitted() {
|
|
217
227
|
i();
|
|
218
228
|
}
|
|
219
229
|
};
|
|
220
|
-
|
|
230
|
+
F.value = l;
|
|
221
231
|
}
|
|
222
|
-
const
|
|
232
|
+
const w = O();
|
|
223
233
|
async function u(D) {
|
|
224
234
|
const a = {
|
|
225
235
|
stock: D,
|
|
226
236
|
show: !0,
|
|
227
237
|
"onUpdate:show"(t) {
|
|
228
|
-
|
|
238
|
+
w.value.show = t;
|
|
229
239
|
},
|
|
230
240
|
onSubmitted() {
|
|
231
241
|
i();
|
|
232
242
|
}
|
|
233
243
|
};
|
|
234
|
-
|
|
244
|
+
w.value = a;
|
|
235
245
|
}
|
|
236
246
|
const b = O();
|
|
237
247
|
async function C(D) {
|
|
@@ -247,13 +257,13 @@ const tn = { class: "fm-typo-en-body-md-400 flex-grow" }, ct = /* @__PURE__ */ u
|
|
|
247
257
|
function B(D, a) {
|
|
248
258
|
const t = De(a);
|
|
249
259
|
switch (D) {
|
|
250
|
-
case
|
|
260
|
+
case Ae.History:
|
|
251
261
|
C(t);
|
|
252
262
|
return;
|
|
253
|
-
case
|
|
263
|
+
case Ae.Convert:
|
|
254
264
|
j(t);
|
|
255
265
|
return;
|
|
256
|
-
case
|
|
266
|
+
case Ae.Adjust:
|
|
257
267
|
u(t);
|
|
258
268
|
return;
|
|
259
269
|
}
|
|
@@ -263,13 +273,13 @@ const tn = { class: "fm-typo-en-body-md-400 flex-grow" }, ct = /* @__PURE__ */ u
|
|
|
263
273
|
onActionMenu: B,
|
|
264
274
|
stockHistoryProps: b,
|
|
265
275
|
showSkuHistory: C,
|
|
266
|
-
convertSkuDialogProps:
|
|
267
|
-
adjustSkuDialogProps:
|
|
276
|
+
convertSkuDialogProps: F,
|
|
277
|
+
adjustSkuDialogProps: w
|
|
268
278
|
};
|
|
269
279
|
});
|
|
270
280
|
function sn() {
|
|
271
281
|
var S;
|
|
272
|
-
const k = ke(), g = dt(), d =
|
|
282
|
+
const k = ke(), g = dt(), d = Ge(), { t: o } = ce();
|
|
273
283
|
return {
|
|
274
284
|
columnDefs: [
|
|
275
285
|
{
|
|
@@ -288,13 +298,13 @@ function sn() {
|
|
|
288
298
|
id: "UOM",
|
|
289
299
|
header: () => o("inventory.stock.balance"),
|
|
290
300
|
cell(m) {
|
|
291
|
-
const i = m.row.original,
|
|
301
|
+
const i = m.row.original, F = {
|
|
292
302
|
unit: i.unit,
|
|
293
303
|
sku: i,
|
|
294
304
|
amount: i.balance,
|
|
295
305
|
defaultTrackingMeasurement: i.trackingMeasurement ?? void 0
|
|
296
306
|
};
|
|
297
|
-
return ye(ct,
|
|
307
|
+
return ye(ct, F);
|
|
298
308
|
},
|
|
299
309
|
size: 180
|
|
300
310
|
},
|
|
@@ -326,15 +336,15 @@ function sn() {
|
|
|
326
336
|
sortUndefined: "last",
|
|
327
337
|
cell(m) {
|
|
328
338
|
var b, C;
|
|
329
|
-
const i = m.row.original.day,
|
|
330
|
-
if (typeof i != "number" || typeof
|
|
331
|
-
return ye(
|
|
339
|
+
const i = m.row.original.day, F = (b = m.row.original.thresholds) == null ? void 0 : b.low, j = (C = m.row.original.thresholds) == null ? void 0 : C.mid;
|
|
340
|
+
if (typeof i != "number" || typeof F != "number" || typeof j != "number")
|
|
341
|
+
return ye(Ne, {
|
|
332
342
|
days: i
|
|
333
343
|
});
|
|
334
|
-
const
|
|
335
|
-
return ye(
|
|
344
|
+
const w = i <= F ? Pe.low : i <= j ? Pe.mid : Pe.high;
|
|
345
|
+
return ye(Ne, {
|
|
336
346
|
days: i,
|
|
337
|
-
level:
|
|
347
|
+
level: w
|
|
338
348
|
});
|
|
339
349
|
},
|
|
340
350
|
size: 200
|
|
@@ -343,9 +353,9 @@ function sn() {
|
|
|
343
353
|
id: "action",
|
|
344
354
|
cell(m) {
|
|
345
355
|
var i;
|
|
346
|
-
return
|
|
356
|
+
return St(
|
|
347
357
|
((i = k._currentLocation) == null ? void 0 : i.type) === "restaurant" ? Qt : Zt,
|
|
348
|
-
(
|
|
358
|
+
(F) => g.onActionMenu(F, m.row.original)
|
|
349
359
|
);
|
|
350
360
|
},
|
|
351
361
|
enableSorting: !1,
|
|
@@ -404,7 +414,7 @@ const ln = { class: "flex items-center" }, rn = { class: "fm-typo-en-title-md-80
|
|
|
404
414
|
},
|
|
405
415
|
emits: ["update:show", "submitted"],
|
|
406
416
|
setup(k, { expose: g, emit: d }) {
|
|
407
|
-
const o = k,
|
|
417
|
+
const o = k, A = d, S = Tt(), m = Be(), i = ge(), F = be(), { t: j } = ce(), w = O(0), u = O(null), b = P(() => m.skus), C = P(
|
|
408
418
|
() => {
|
|
409
419
|
var p, n;
|
|
410
420
|
return (((n = (p = o.sku) == null ? void 0 : p.convert) == null ? void 0 : n.inventoryBindings) ?? []).filter(
|
|
@@ -416,14 +426,14 @@ const ln = { class: "flex items-center" }, rn = { class: "fm-typo-en-title-md-80
|
|
|
416
426
|
return !!u.value;
|
|
417
427
|
},
|
|
418
428
|
set(p) {
|
|
419
|
-
p ? u.value = De(C.value) : (u.value = null,
|
|
429
|
+
p ? u.value = De(C.value) : (u.value = null, w.value = Math.min(w.value, o.maxCount ?? 0));
|
|
420
430
|
}
|
|
421
431
|
}), D = O(!1);
|
|
422
432
|
xe([() => o.show], ([p]) => {
|
|
423
|
-
p && (
|
|
433
|
+
p && (w.value = 0);
|
|
424
434
|
});
|
|
425
435
|
function a() {
|
|
426
|
-
N(o.sku,
|
|
436
|
+
N(o.sku, $e(w.value), u.value);
|
|
427
437
|
}
|
|
428
438
|
function t(p) {
|
|
429
439
|
if (u.value)
|
|
@@ -436,7 +446,7 @@ const ln = { class: "flex items-center" }, rn = { class: "fm-typo-en-title-md-80
|
|
|
436
446
|
const n = (f = o.sku.convert) != null && f.measurement ? o.sku.unit.measurements.find((M) => {
|
|
437
447
|
var I;
|
|
438
448
|
return M.id === ((I = o.sku.convert) == null ? void 0 : I.measurement);
|
|
439
|
-
}) ?? null : null, r =
|
|
449
|
+
}) ?? null : null, r = Ye(o.sku.unit, n), h = Mt(+p);
|
|
440
450
|
return et(h).isInteger().max(r).error ? "Precision cannot be more than " + r : !0;
|
|
441
451
|
}
|
|
442
452
|
const x = P(
|
|
@@ -449,7 +459,7 @@ const ln = { class: "flex items-center" }, rn = { class: "fm-typo-en-title-md-80
|
|
|
449
459
|
}
|
|
450
460
|
), _ = P(() => {
|
|
451
461
|
var h, c;
|
|
452
|
-
const n =
|
|
462
|
+
const n = _t({
|
|
453
463
|
bindings: ((h = o.sku.convert) == null ? void 0 : h.inventoryBindings) ?? [],
|
|
454
464
|
skus: m.skus,
|
|
455
465
|
skuGroups: m.skuGroups,
|
|
@@ -460,10 +470,10 @@ const ln = { class: "flex items-center" }, rn = { class: "fm-typo-en-title-md-80
|
|
|
460
470
|
const M = m.skus.find((me) => me._id === f.id), I = ((le = f.measurement) == null ? void 0 : le.abbrev) ?? ((re = M == null ? void 0 : M.unit) == null ? void 0 : re.abbrev), G = (Z = o.sku.convert) != null && Z.measurement ? o.sku.unit.measurements.find((me) => {
|
|
461
471
|
var We;
|
|
462
472
|
return me.id === ((We = o.sku.convert) == null ? void 0 : We.measurement);
|
|
463
|
-
}) ?? null : null, oe =
|
|
464
|
-
|
|
473
|
+
}) ?? null : null, oe = Ye(o.sku.unit, G), E = l(`${w.value}`) === !0 ? ve(
|
|
474
|
+
jt(
|
|
465
475
|
f.amount,
|
|
466
|
-
|
|
476
|
+
$e(+w.value, oe)
|
|
467
477
|
),
|
|
468
478
|
!1
|
|
469
479
|
) : "0", W = (fe = (ae = u.value) == null ? void 0 : ae.find((me) => me.id === (M == null ? void 0 : M._id))) == null ? void 0 : fe.amount, q = W ? ve(W, !1) : null;
|
|
@@ -473,19 +483,19 @@ const ln = { class: "flex items-center" }, rn = { class: "fm-typo-en-title-md-80
|
|
|
473
483
|
abbrev: I
|
|
474
484
|
};
|
|
475
485
|
});
|
|
476
|
-
}),
|
|
486
|
+
}), $ = O();
|
|
477
487
|
g({
|
|
478
488
|
validateInputs: () => {
|
|
479
489
|
var p, n;
|
|
480
|
-
(n = (p =
|
|
490
|
+
(n = (p = $.value) == null ? void 0 : p.validateInputs) == null || n.call(p);
|
|
481
491
|
},
|
|
482
492
|
resetInputsValidation: () => {
|
|
483
493
|
var p, n;
|
|
484
|
-
(n = (p =
|
|
494
|
+
(n = (p = $.value) == null ? void 0 : p.resetInputsValidation) == null || n.call(p);
|
|
485
495
|
},
|
|
486
496
|
resetInputs: () => {
|
|
487
497
|
var p, n;
|
|
488
|
-
(n = (p =
|
|
498
|
+
(n = (p = $.value) == null ? void 0 : p.resetInputs) == null || n.call(p);
|
|
489
499
|
}
|
|
490
500
|
});
|
|
491
501
|
const H = Ue(o, "show");
|
|
@@ -507,9 +517,9 @@ const ln = { class: "flex items-center" }, rn = { class: "fm-typo-en-title-md-80
|
|
|
507
517
|
}))
|
|
508
518
|
}
|
|
509
519
|
]
|
|
510
|
-
}),
|
|
520
|
+
}), A("update:show", !1), A("submitted");
|
|
511
521
|
} catch (h) {
|
|
512
|
-
|
|
522
|
+
F.open({
|
|
513
523
|
title: "Something went wrong",
|
|
514
524
|
message: `Cannot convert ${p.name}. Please try again.`,
|
|
515
525
|
type: "error"
|
|
@@ -525,7 +535,7 @@ const ln = { class: "flex items-center" }, rn = { class: "fm-typo-en-title-md-80
|
|
|
525
535
|
}
|
|
526
536
|
function R(p) {
|
|
527
537
|
const n = b.value.find((r) => r._id === p);
|
|
528
|
-
return n ?
|
|
538
|
+
return n ? lt(n.unit, !0) : [];
|
|
529
539
|
}
|
|
530
540
|
function X(p, n) {
|
|
531
541
|
const r = R(p), h = r.find((c) => c.value === n) ?? r.find((c) => c.value === null);
|
|
@@ -565,7 +575,7 @@ const ln = { class: "flex items-center" }, rn = { class: "fm-typo-en-title-md-80
|
|
|
565
575
|
return xe(
|
|
566
576
|
() => o.show,
|
|
567
577
|
(p) => {
|
|
568
|
-
p || (u.value = null,
|
|
578
|
+
p || (u.value = null, w.value = 0);
|
|
569
579
|
}
|
|
570
580
|
), (p, n) => {
|
|
571
581
|
const r = U("FmTextField"), h = U("FmForm"), c = U("FmCard"), f = U("FmSwitch"), M = U("FmFormGroup"), I = U("FmSelect"), G = U("FmButton"), oe = U("FmSideSheet");
|
|
@@ -584,14 +594,14 @@ const ln = { class: "flex items-center" }, rn = { class: "fm-typo-en-title-md-80
|
|
|
584
594
|
e("div", un, [
|
|
585
595
|
y(h, {
|
|
586
596
|
ref_key: "formRef",
|
|
587
|
-
ref:
|
|
597
|
+
ref: $,
|
|
588
598
|
onValidationSuccess: a
|
|
589
599
|
}, {
|
|
590
600
|
default: T(() => [
|
|
591
601
|
y(r, {
|
|
592
602
|
disabled: D.value,
|
|
593
|
-
"model-value":
|
|
594
|
-
"onUpdate:modelValue": n[0] || (n[0] = (E) =>
|
|
603
|
+
"model-value": w.value,
|
|
604
|
+
"onUpdate:modelValue": n[0] || (n[0] = (E) => w.value = E),
|
|
595
605
|
label: s(j)("inventory.stock.convert.amount"),
|
|
596
606
|
rules: [t, l, s(Ve)(0)],
|
|
597
607
|
"append-text": x.value,
|
|
@@ -634,7 +644,7 @@ const ln = { class: "flex items-center" }, rn = { class: "fm-typo-en-title-md-80
|
|
|
634
644
|
B.value ? (V(), Y(ne, { key: 0 }, [
|
|
635
645
|
y(M, {
|
|
636
646
|
modelValue: u.value,
|
|
637
|
-
rules: [s(
|
|
647
|
+
rules: [s(Dt)(1, "Must have at least one ingredient binding")]
|
|
638
648
|
}, null, 8, ["modelValue", "rules"]),
|
|
639
649
|
e("div", vn, [
|
|
640
650
|
e("div", yn, v(s(j)("inventory.stock.convert.ingredients")), 1),
|
|
@@ -643,7 +653,7 @@ const ln = { class: "flex items-center" }, rn = { class: "fm-typo-en-title-md-80
|
|
|
643
653
|
disabled: D.value,
|
|
644
654
|
modelValue: +s(ve)(E.amount ?? { amount: 1, precision: 0 }),
|
|
645
655
|
rules: [
|
|
646
|
-
s(
|
|
656
|
+
s(Bt)(
|
|
647
657
|
b.value.find((W) => W._id === E.id).unit,
|
|
648
658
|
E.measurement
|
|
649
659
|
),
|
|
@@ -710,7 +720,7 @@ const ln = { class: "flex items-center" }, rn = { class: "fm-typo-en-title-md-80
|
|
|
710
720
|
label: s(j)("inventory.stock.convert.convertButton"),
|
|
711
721
|
onClick: n[2] || (n[2] = (E) => {
|
|
712
722
|
var W, q;
|
|
713
|
-
return (q = (W =
|
|
723
|
+
return (q = (W = $.value) == null ? void 0 : W.validateInputs) == null ? void 0 : q.call(W);
|
|
714
724
|
})
|
|
715
725
|
}, null, 8, ["loading", "label"])
|
|
716
726
|
])
|
|
@@ -720,29 +730,29 @@ const ln = { class: "flex items-center" }, rn = { class: "fm-typo-en-title-md-80
|
|
|
720
730
|
};
|
|
721
731
|
}
|
|
722
732
|
});
|
|
723
|
-
function
|
|
724
|
-
const d =
|
|
733
|
+
function Fe(k, g) {
|
|
734
|
+
const d = $e(k, g);
|
|
725
735
|
return { ...d, amount: -d.amount };
|
|
726
736
|
}
|
|
727
737
|
function tt(k, g) {
|
|
728
|
-
return
|
|
738
|
+
return $e(Math.abs(k), g);
|
|
729
739
|
}
|
|
730
740
|
const Oe = {
|
|
731
741
|
[te.enum.DAMAGE]: {
|
|
732
742
|
label: "Damage",
|
|
733
|
-
toAdjustmentAmount:
|
|
743
|
+
toAdjustmentAmount: Fe
|
|
734
744
|
},
|
|
735
745
|
[te.enum.WASTAGE]: {
|
|
736
746
|
label: "Wastage",
|
|
737
|
-
toAdjustmentAmount:
|
|
747
|
+
toAdjustmentAmount: Fe
|
|
738
748
|
},
|
|
739
749
|
[te.enum.THEFT]: {
|
|
740
750
|
label: "Theft",
|
|
741
|
-
toAdjustmentAmount:
|
|
751
|
+
toAdjustmentAmount: Fe
|
|
742
752
|
},
|
|
743
753
|
[te.enum.LOSE]: {
|
|
744
754
|
label: "Lose",
|
|
745
|
-
toAdjustmentAmount:
|
|
755
|
+
toAdjustmentAmount: Fe
|
|
746
756
|
},
|
|
747
757
|
[te.enum.EXTRA]: {
|
|
748
758
|
label: "Extra",
|
|
@@ -752,7 +762,7 @@ const Oe = {
|
|
|
752
762
|
label: "Purchase",
|
|
753
763
|
toAdjustmentAmount: tt
|
|
754
764
|
}
|
|
755
|
-
}, hn = { class: "col-span-2 flex" }, xn = { class: "fm-typo-en-body-lg-600 flex-1" }, Sn = { class: "col-span-2 flex flex-col gap-4" },
|
|
765
|
+
}, hn = { class: "col-span-2 flex" }, xn = { class: "fm-typo-en-body-lg-600 flex-1" }, Sn = { class: "col-span-2 flex flex-col gap-4" }, Fn = { class: "flex gap-4 text-fm-color-typo-primary fm-typo-en-body-lg-600" }, mt = /* @__PURE__ */ ue({
|
|
756
766
|
__name: "AdjustedItemForm",
|
|
757
767
|
props: {
|
|
758
768
|
modelValue: {},
|
|
@@ -760,12 +770,12 @@ const Oe = {
|
|
|
760
770
|
},
|
|
761
771
|
emits: ["update:modelValue", "click:delete"],
|
|
762
772
|
setup(k, { emit: g }) {
|
|
763
|
-
const d = k, o = g, { t:
|
|
773
|
+
const d = k, o = g, { t: A } = ce(), S = Me(), m = P(
|
|
764
774
|
() => Object.keys(Oe).map((t) => ({
|
|
765
|
-
label:
|
|
775
|
+
label: kt(t),
|
|
766
776
|
value: t
|
|
767
777
|
}))
|
|
768
|
-
), i = P(() =>
|
|
778
|
+
), i = P(() => lt(d.modelValue.doc.unit, !0)), F = P({
|
|
769
779
|
get() {
|
|
770
780
|
return d.modelValue.type ?? te.enum.PURCHASE;
|
|
771
781
|
},
|
|
@@ -774,7 +784,7 @@ const Oe = {
|
|
|
774
784
|
...d.modelValue
|
|
775
785
|
};
|
|
776
786
|
l.type = t;
|
|
777
|
-
const x =
|
|
787
|
+
const x = Ze(d.modelValue.amount);
|
|
778
788
|
l.amount = Oe[l.type].toAdjustmentAmount(
|
|
779
789
|
+ve(x),
|
|
780
790
|
x.precision
|
|
@@ -782,19 +792,19 @@ const Oe = {
|
|
|
782
792
|
}
|
|
783
793
|
}), j = P({
|
|
784
794
|
get() {
|
|
785
|
-
const t =
|
|
795
|
+
const t = Ze(d.modelValue.amount);
|
|
786
796
|
return +ve(t);
|
|
787
797
|
},
|
|
788
798
|
set(t) {
|
|
789
799
|
const l = {
|
|
790
800
|
...d.modelValue
|
|
791
801
|
}, x = _e(t);
|
|
792
|
-
l.amount = Oe[
|
|
802
|
+
l.amount = Oe[F.value].toAdjustmentAmount(
|
|
793
803
|
t,
|
|
794
804
|
x.precision
|
|
795
805
|
), o("update:modelValue", l);
|
|
796
806
|
}
|
|
797
|
-
}),
|
|
807
|
+
}), w = P({
|
|
798
808
|
get() {
|
|
799
809
|
var t;
|
|
800
810
|
return ((t = d.modelValue.measurement) == null ? void 0 : t.id) ?? null;
|
|
@@ -804,7 +814,7 @@ const Oe = {
|
|
|
804
814
|
const l = {
|
|
805
815
|
...d.modelValue
|
|
806
816
|
};
|
|
807
|
-
l.measurement = ((_ = (x = d.modelValue.doc.unit) == null ? void 0 : x.measurements) == null ? void 0 : _.find((
|
|
817
|
+
l.measurement = ((_ = (x = d.modelValue.doc.unit) == null ? void 0 : x.measurements) == null ? void 0 : _.find(($) => $.id === t)) ?? null, o("update:modelValue", l);
|
|
808
818
|
}
|
|
809
819
|
}), u = P({
|
|
810
820
|
get() {
|
|
@@ -822,14 +832,14 @@ const Oe = {
|
|
|
822
832
|
return (t == null ? void 0 : t.balance) ?? { amount: 0, precision: 0 };
|
|
823
833
|
}), C = P(() => {
|
|
824
834
|
const t = d.modelValue.amount, l = d.modelValue.measurement;
|
|
825
|
-
return l ?
|
|
835
|
+
return l ? rt(t, l.conversion) : t;
|
|
826
836
|
}), B = P(
|
|
827
|
-
() =>
|
|
837
|
+
() => Ke(b.value, C.value)
|
|
828
838
|
), D = P(
|
|
829
839
|
() => Se(B.value, d.modelValue.doc.unit)
|
|
830
840
|
), a = P(() => C.value.amount < 0);
|
|
831
841
|
return (t, l) => {
|
|
832
|
-
const x = U("FmButton"), _ = U("FmSelect"),
|
|
842
|
+
const x = U("FmButton"), _ = U("FmSelect"), $ = U("FmTextarea"), H = U("FmCard");
|
|
833
843
|
return V(), z(H, {
|
|
834
844
|
variant: "outlined",
|
|
835
845
|
class: "grid grid-cols-2 gap-8 p-16"
|
|
@@ -848,17 +858,17 @@ const Oe = {
|
|
|
848
858
|
class: "col-span-2",
|
|
849
859
|
label: "Type",
|
|
850
860
|
items: m.value,
|
|
851
|
-
modelValue:
|
|
852
|
-
"onUpdate:modelValue": l[1] || (l[1] = (N) =>
|
|
853
|
-
rules: [s(
|
|
861
|
+
modelValue: F.value,
|
|
862
|
+
"onUpdate:modelValue": l[1] || (l[1] = (N) => F.value = N),
|
|
863
|
+
rules: [s(It)()],
|
|
854
864
|
"label-mark": "required"
|
|
855
865
|
}, null, 8, ["disabled", "items", "modelValue", "rules"]),
|
|
856
|
-
y(
|
|
866
|
+
y(Ht, {
|
|
857
867
|
disabled: t.disabled,
|
|
858
868
|
label: "Amount",
|
|
859
869
|
step: +s(ve)({
|
|
860
870
|
amount: 1,
|
|
861
|
-
precision: s(
|
|
871
|
+
precision: s(Ye)(t.modelValue.doc.unit, t.modelValue.measurement)
|
|
862
872
|
}),
|
|
863
873
|
modelValue: j.value,
|
|
864
874
|
"onUpdate:modelValue": l[2] || (l[2] = (N) => j.value = N),
|
|
@@ -868,10 +878,10 @@ const Oe = {
|
|
|
868
878
|
disabled: t.disabled,
|
|
869
879
|
label: "Unit",
|
|
870
880
|
items: i.value,
|
|
871
|
-
modelValue:
|
|
872
|
-
"onUpdate:modelValue": l[3] || (l[3] = (N) =>
|
|
881
|
+
modelValue: w.value,
|
|
882
|
+
"onUpdate:modelValue": l[3] || (l[3] = (N) => w.value = N)
|
|
873
883
|
}, null, 8, ["disabled", "items", "modelValue"]),
|
|
874
|
-
y(
|
|
884
|
+
y($, {
|
|
875
885
|
class: "col-span-2",
|
|
876
886
|
disabled: t.disabled,
|
|
877
887
|
label: "Remark",
|
|
@@ -880,7 +890,7 @@ const Oe = {
|
|
|
880
890
|
"label-mark": "optional"
|
|
881
891
|
}, null, 8, ["disabled", "modelValue"]),
|
|
882
892
|
e("div", Sn, [
|
|
883
|
-
e("div",
|
|
893
|
+
e("div", Fn, v(s(A)("inventory.stock.stock_adjustment.stockAfter")), 1),
|
|
884
894
|
e("div", {
|
|
885
895
|
class: he(["fm-typo-en-body-lg-600", a.value ? "text-red-700" : "text-green-700"])
|
|
886
896
|
}, v(D.value), 3)
|
|
@@ -890,7 +900,7 @@ const Oe = {
|
|
|
890
900
|
});
|
|
891
901
|
};
|
|
892
902
|
}
|
|
893
|
-
}),
|
|
903
|
+
}), wn = { class: "flex items-center" }, An = { class: "fm-typo-en-title-md-800" }, $n = { class: "flex items-center" }, Vn = { class: "fm-typo-en-title-sm-800 flex-1" }, Cn = { class: "flex gap-8" }, jn = /* @__PURE__ */ ue({
|
|
894
904
|
__name: "AdjustSkuDialog",
|
|
895
905
|
props: {
|
|
896
906
|
stock: {},
|
|
@@ -898,7 +908,7 @@ const Oe = {
|
|
|
898
908
|
},
|
|
899
909
|
emits: ["update:show", "submitted"],
|
|
900
910
|
setup(k, { expose: g, emit: d }) {
|
|
901
|
-
const o = k,
|
|
911
|
+
const o = k, A = d, S = Be(), m = Ie(), i = ge(), F = be(), j = O(!1), { t: w } = ce();
|
|
902
912
|
function u() {
|
|
903
913
|
D(De(B));
|
|
904
914
|
}
|
|
@@ -947,19 +957,19 @@ const Oe = {
|
|
|
947
957
|
try {
|
|
948
958
|
await i.adjustSku({
|
|
949
959
|
remark: l.remark,
|
|
950
|
-
adjustments: l.adjustments.map(({ doc: x, remark: _, type:
|
|
960
|
+
adjustments: l.adjustments.map(({ doc: x, remark: _, type: $, amount: H, measurement: N }) => ({
|
|
951
961
|
id: x._id,
|
|
952
962
|
amount: H,
|
|
953
963
|
measurement: N,
|
|
954
964
|
remark: _,
|
|
955
965
|
doc: x,
|
|
956
|
-
type:
|
|
966
|
+
type: $
|
|
957
967
|
}))
|
|
958
|
-
}),
|
|
968
|
+
}), A("update:show", !1), A("submitted");
|
|
959
969
|
} catch (x) {
|
|
960
|
-
|
|
961
|
-
title:
|
|
962
|
-
message:
|
|
970
|
+
F.open({
|
|
971
|
+
title: w("inventory.stock.adjust.error.title"),
|
|
972
|
+
message: w("inventory.stock.adjust.error.message"),
|
|
963
973
|
type: "error"
|
|
964
974
|
}), console.log("error on adjust ingredients", l, x);
|
|
965
975
|
} finally {
|
|
@@ -971,10 +981,10 @@ const Oe = {
|
|
|
971
981
|
label: _.name,
|
|
972
982
|
sublabel: _.code,
|
|
973
983
|
value: _._id
|
|
974
|
-
})), x = l.filter((_) => B.adjustments.find((
|
|
984
|
+
})), x = l.filter((_) => B.adjustments.find(($) => $.doc._id === _.value)).map((_) => _.value);
|
|
975
985
|
m.open({
|
|
976
986
|
title: "Select ingredients",
|
|
977
|
-
contentComponent:
|
|
987
|
+
contentComponent: it,
|
|
978
988
|
contentComponentProps: {
|
|
979
989
|
items: l,
|
|
980
990
|
modelValue: x
|
|
@@ -993,10 +1003,10 @@ const Oe = {
|
|
|
993
1003
|
}
|
|
994
1004
|
}).onPrimary((_) => {
|
|
995
1005
|
B.adjustments = _.map(
|
|
996
|
-
(
|
|
1006
|
+
($) => B.adjustments.find((H) => H.doc._id === $) ?? {
|
|
997
1007
|
id: `sku_${(/* @__PURE__ */ new Date()).toISOString()}_${Math.random().toString(16).slice(2, 8)}`,
|
|
998
1008
|
type: te.enum.PURCHASE,
|
|
999
|
-
doc: S.skus.find((H) => H._id ===
|
|
1009
|
+
doc: S.skus.find((H) => H._id === $),
|
|
1000
1010
|
measurement: null,
|
|
1001
1011
|
remark: "",
|
|
1002
1012
|
amount: _e(1)
|
|
@@ -1008,7 +1018,7 @@ const Oe = {
|
|
|
1008
1018
|
B.adjustments.splice(l, 1);
|
|
1009
1019
|
}
|
|
1010
1020
|
return (l, x) => {
|
|
1011
|
-
const _ = U("FmTextarea"),
|
|
1021
|
+
const _ = U("FmTextarea"), $ = U("FmButton"), H = U("FmForm"), N = U("FmSideSheet");
|
|
1012
1022
|
return V(), z(N, {
|
|
1013
1023
|
modelValue: s(C),
|
|
1014
1024
|
"onUpdate:modelValue": x[2] || (x[2] = (K) => je(C) ? C.value = K : null),
|
|
@@ -1016,8 +1026,8 @@ const Oe = {
|
|
|
1016
1026
|
"max-width": 500
|
|
1017
1027
|
}, {
|
|
1018
1028
|
"side-sheet-header": T(() => [
|
|
1019
|
-
e("div",
|
|
1020
|
-
e("div",
|
|
1029
|
+
e("div", wn, [
|
|
1030
|
+
e("div", An, v(s(w)("inventory.stock.adjust.title")), 1)
|
|
1021
1031
|
])
|
|
1022
1032
|
]),
|
|
1023
1033
|
default: T(() => [
|
|
@@ -1029,13 +1039,13 @@ const Oe = {
|
|
|
1029
1039
|
}, {
|
|
1030
1040
|
default: T(() => [
|
|
1031
1041
|
y(_, {
|
|
1032
|
-
label: s(
|
|
1042
|
+
label: s(w)("inventory.stock.adjust.remark"),
|
|
1033
1043
|
modelValue: B.remark,
|
|
1034
1044
|
"onUpdate:modelValue": x[0] || (x[0] = (K) => B.remark = K)
|
|
1035
1045
|
}, null, 8, ["label", "modelValue"]),
|
|
1036
|
-
e("div",
|
|
1037
|
-
e("div", Vn, v(s(
|
|
1038
|
-
y(
|
|
1046
|
+
e("div", $n, [
|
|
1047
|
+
e("div", Vn, v(s(w)("inventory.stock.adjust.adjustedItems")), 1),
|
|
1048
|
+
y($, {
|
|
1039
1049
|
"prepend-icon": "add",
|
|
1040
1050
|
variant: "tertiary",
|
|
1041
1051
|
size: "md",
|
|
@@ -1054,8 +1064,8 @@ const Oe = {
|
|
|
1054
1064
|
]),
|
|
1055
1065
|
"side-sheet-footer": T(() => [
|
|
1056
1066
|
e("div", Cn, [
|
|
1057
|
-
y(
|
|
1058
|
-
label: s(
|
|
1067
|
+
y($, {
|
|
1068
|
+
label: s(w)("inventory.stock.adjust.adjustButton"),
|
|
1059
1069
|
loading: j.value,
|
|
1060
1070
|
onClick: x[1] || (x[1] = (K) => {
|
|
1061
1071
|
var R, X;
|
|
@@ -1075,7 +1085,7 @@ const Oe = {
|
|
|
1075
1085
|
},
|
|
1076
1086
|
emits: ["update:show", "submitted"],
|
|
1077
1087
|
setup(k, { emit: g }) {
|
|
1078
|
-
const d = k, o = g, { t:
|
|
1088
|
+
const d = k, o = g, { t: A } = ce(), S = Be(), m = ge(), i = Ie(), F = be(), j = Ue(d, "show"), w = O(!1), u = nt({
|
|
1079
1089
|
remark: "",
|
|
1080
1090
|
effectiveAt: /* @__PURE__ */ new Date(),
|
|
1081
1091
|
adjustments: []
|
|
@@ -1084,8 +1094,8 @@ const Oe = {
|
|
|
1084
1094
|
if (b.value && C.value) {
|
|
1085
1095
|
const _ = pe(`${b.value} ${C.value}`, "YYYY-MM-DD HH:mm");
|
|
1086
1096
|
if (_.isValid()) {
|
|
1087
|
-
const
|
|
1088
|
-
_.isAfter(
|
|
1097
|
+
const $ = pe();
|
|
1098
|
+
_.isAfter($) ? u.effectiveAt = $.toDate() : u.effectiveAt = _.toDate();
|
|
1089
1099
|
}
|
|
1090
1100
|
}
|
|
1091
1101
|
});
|
|
@@ -1097,8 +1107,8 @@ const Oe = {
|
|
|
1097
1107
|
}
|
|
1098
1108
|
const a = P(() => {
|
|
1099
1109
|
const _ = {};
|
|
1100
|
-
return S.skus.forEach((
|
|
1101
|
-
_[
|
|
1110
|
+
return S.skus.forEach(($) => {
|
|
1111
|
+
_[$._id] = $;
|
|
1102
1112
|
}), _;
|
|
1103
1113
|
});
|
|
1104
1114
|
function t() {
|
|
@@ -1106,24 +1116,24 @@ const Oe = {
|
|
|
1106
1116
|
label: H.name,
|
|
1107
1117
|
sublabel: H.code,
|
|
1108
1118
|
value: H._id
|
|
1109
|
-
})),
|
|
1119
|
+
})), $ = u.adjustments.map((H) => H.doc._id);
|
|
1110
1120
|
i.open({
|
|
1111
|
-
title:
|
|
1112
|
-
contentComponent:
|
|
1121
|
+
title: A("inventory.stock.adjust.selectIngredients"),
|
|
1122
|
+
contentComponent: it,
|
|
1113
1123
|
contentComponentProps: {
|
|
1114
1124
|
items: _,
|
|
1115
|
-
modelValue:
|
|
1125
|
+
modelValue: $,
|
|
1116
1126
|
virtualScroll: !0
|
|
1117
1127
|
},
|
|
1118
1128
|
overlay: !0,
|
|
1119
1129
|
closeButton: !0,
|
|
1120
1130
|
dismissAway: !0,
|
|
1121
1131
|
primaryActions: {
|
|
1122
|
-
text:
|
|
1132
|
+
text: A("common.confirm"),
|
|
1123
1133
|
close: !0
|
|
1124
1134
|
},
|
|
1125
1135
|
secondaryActions: {
|
|
1126
|
-
text:
|
|
1136
|
+
text: A("common.close"),
|
|
1127
1137
|
close: !0,
|
|
1128
1138
|
variant: "tertiary"
|
|
1129
1139
|
}
|
|
@@ -1145,14 +1155,14 @@ const Oe = {
|
|
|
1145
1155
|
}
|
|
1146
1156
|
async function x() {
|
|
1147
1157
|
if (u.adjustments.length === 0) {
|
|
1148
|
-
|
|
1149
|
-
title:
|
|
1150
|
-
message:
|
|
1158
|
+
F.open({
|
|
1159
|
+
title: A("inventory.stock.error.title"),
|
|
1160
|
+
message: A("inventory.stock.stock_adjustment.noAdjustments"),
|
|
1151
1161
|
type: "warning"
|
|
1152
1162
|
});
|
|
1153
1163
|
return;
|
|
1154
1164
|
}
|
|
1155
|
-
|
|
1165
|
+
w.value = !0;
|
|
1156
1166
|
try {
|
|
1157
1167
|
const _ = u.adjustments.map(
|
|
1158
1168
|
({ doc: H, remark: N, type: K, amount: R, measurement: X }) => ({
|
|
@@ -1163,52 +1173,52 @@ const Oe = {
|
|
|
1163
1173
|
doc: H,
|
|
1164
1174
|
type: K
|
|
1165
1175
|
})
|
|
1166
|
-
),
|
|
1176
|
+
), $ = {
|
|
1167
1177
|
remark: u.remark,
|
|
1168
1178
|
adjustments: _,
|
|
1169
1179
|
effectiveAt: u.effectiveAt.toISOString()
|
|
1170
1180
|
};
|
|
1171
|
-
await m.adjustSku(De(
|
|
1181
|
+
await m.adjustSku(De($)), o("submitted"), o("update:show", !1);
|
|
1172
1182
|
} catch (_) {
|
|
1173
|
-
|
|
1174
|
-
title:
|
|
1175
|
-
message:
|
|
1183
|
+
F.open({
|
|
1184
|
+
title: A("inventory.stock.adjust.error.title"),
|
|
1185
|
+
message: A("inventory.stock.adjust.error.message"),
|
|
1176
1186
|
type: "error"
|
|
1177
1187
|
}), console.error("error on stock adjustment", _);
|
|
1178
1188
|
} finally {
|
|
1179
|
-
|
|
1189
|
+
w.value = !1;
|
|
1180
1190
|
}
|
|
1181
1191
|
}
|
|
1182
|
-
return (_,
|
|
1192
|
+
return (_, $) => {
|
|
1183
1193
|
const H = U("FmTextarea"), N = U("FmDatePicker"), K = U("FmTimePicker"), R = U("FmButton"), X = U("FmSideSheet");
|
|
1184
1194
|
return V(), z(X, {
|
|
1185
1195
|
modelValue: s(j),
|
|
1186
|
-
"onUpdate:modelValue":
|
|
1196
|
+
"onUpdate:modelValue": $[4] || ($[4] = (L) => je(j) ? j.value = L : null),
|
|
1187
1197
|
"dismiss-away": "",
|
|
1188
1198
|
"max-width": 560,
|
|
1189
1199
|
onAfterEnter: D
|
|
1190
1200
|
}, {
|
|
1191
1201
|
"side-sheet-header": T(() => [
|
|
1192
1202
|
e("div", Dn, [
|
|
1193
|
-
e("div", Bn, v(s(
|
|
1203
|
+
e("div", Bn, v(s(A)("inventory.stock.stock_adjustment.title")), 1)
|
|
1194
1204
|
])
|
|
1195
1205
|
]),
|
|
1196
1206
|
default: T(() => [
|
|
1197
1207
|
e("div", Mn, [
|
|
1198
1208
|
y(H, {
|
|
1199
|
-
label: s(
|
|
1209
|
+
label: s(A)("inventory.stock.adjust.remark"),
|
|
1200
1210
|
modelValue: u.remark,
|
|
1201
|
-
"onUpdate:modelValue":
|
|
1211
|
+
"onUpdate:modelValue": $[0] || ($[0] = (L) => u.remark = L),
|
|
1202
1212
|
"label-mark": "optional"
|
|
1203
1213
|
}, null, 8, ["label", "modelValue"]),
|
|
1204
1214
|
e("div", In, [
|
|
1205
|
-
e("label", Un, v(s(
|
|
1215
|
+
e("label", Un, v(s(A)("inventory.stock.stock_adjustment.effectiveAt")), 1),
|
|
1206
1216
|
e("div", Tn, [
|
|
1207
1217
|
e("div", Hn, [
|
|
1208
1218
|
y(N, {
|
|
1209
1219
|
class: "w-full",
|
|
1210
1220
|
modelValue: b.value,
|
|
1211
|
-
"onUpdate:modelValue":
|
|
1221
|
+
"onUpdate:modelValue": $[1] || ($[1] = (L) => b.value = L),
|
|
1212
1222
|
clearable: !1,
|
|
1213
1223
|
max: s(pe)().format("YYYY-MM-DD")
|
|
1214
1224
|
}, null, 8, ["modelValue", "max"])
|
|
@@ -1217,15 +1227,15 @@ const Oe = {
|
|
|
1217
1227
|
y(K, {
|
|
1218
1228
|
class: "w-full",
|
|
1219
1229
|
modelValue: C.value,
|
|
1220
|
-
"onUpdate:modelValue":
|
|
1230
|
+
"onUpdate:modelValue": $[2] || ($[2] = (L) => C.value = L),
|
|
1221
1231
|
format: "HH:mm"
|
|
1222
1232
|
}, null, 8, ["modelValue"])
|
|
1223
1233
|
])
|
|
1224
1234
|
]),
|
|
1225
|
-
e("div", Pn, v(s(
|
|
1235
|
+
e("div", Pn, v(s(A)("inventory.stock.stock_adjustment.immediateHint")), 1)
|
|
1226
1236
|
]),
|
|
1227
1237
|
e("div", Rn, [
|
|
1228
|
-
e("div", On, v(s(
|
|
1238
|
+
e("div", On, v(s(A)("inventory.stock.adjust.adjustedItems")), 1),
|
|
1229
1239
|
y(R, {
|
|
1230
1240
|
"prepend-icon": "add",
|
|
1231
1241
|
variant: "tertiary",
|
|
@@ -1244,14 +1254,14 @@ const Oe = {
|
|
|
1244
1254
|
"side-sheet-footer": T(() => [
|
|
1245
1255
|
e("div", Nn, [
|
|
1246
1256
|
y(R, {
|
|
1247
|
-
label: s(
|
|
1248
|
-
loading:
|
|
1257
|
+
label: s(A)("common.confirm"),
|
|
1258
|
+
loading: w.value,
|
|
1249
1259
|
onClick: x
|
|
1250
1260
|
}, null, 8, ["label", "loading"]),
|
|
1251
1261
|
y(R, {
|
|
1252
|
-
label: s(
|
|
1262
|
+
label: s(A)("common.close"),
|
|
1253
1263
|
variant: "tertiary",
|
|
1254
|
-
onClick:
|
|
1264
|
+
onClick: $[3] || ($[3] = (L) => o("update:show", !1))
|
|
1255
1265
|
}, null, 8, ["label"])
|
|
1256
1266
|
])
|
|
1257
1267
|
]),
|
|
@@ -1259,19 +1269,19 @@ const Oe = {
|
|
|
1259
1269
|
}, 8, ["modelValue"]);
|
|
1260
1270
|
};
|
|
1261
1271
|
}
|
|
1262
|
-
}), Ln =
|
|
1272
|
+
}), Ln = bt((k, g) => ({
|
|
1263
1273
|
// TODO: remove once latest inventory backend has been push
|
|
1264
|
-
async findBillsByBusinessId(d, o,
|
|
1274
|
+
async findBillsByBusinessId(d, o, A) {
|
|
1265
1275
|
const S = `${k.businessesBackendUrl}/${d}/reports/find-many`, m = {
|
|
1266
1276
|
// type: TYPE.bill,
|
|
1267
1277
|
type: "bill",
|
|
1268
1278
|
restaurantIds: o,
|
|
1269
|
-
ids:
|
|
1279
|
+
ids: A
|
|
1270
1280
|
};
|
|
1271
1281
|
return await g.post(S, m);
|
|
1272
1282
|
},
|
|
1273
1283
|
async findBillsById(d) {
|
|
1274
|
-
const
|
|
1284
|
+
const A = ke().currentLocationDBName, S = `${k.inventoryBackendUrl}/${A}/bill/search`, m = {
|
|
1275
1285
|
ids: d
|
|
1276
1286
|
};
|
|
1277
1287
|
return await g.post(S, m);
|
|
@@ -1289,44 +1299,44 @@ const Oe = {
|
|
|
1289
1299
|
}),
|
|
1290
1300
|
emits: /* @__PURE__ */ qe(["refreshHistory"], ["update:modelValue"]),
|
|
1291
1301
|
setup(k, { emit: g }) {
|
|
1292
|
-
const d = k, o = g,
|
|
1302
|
+
const d = k, o = g, A = ge(), S = pt(k, "modelValue"), m = O(!1), i = O(!1), F = O(!1), j = O({
|
|
1293
1303
|
_id: `inventoryAdjustment_${(/* @__PURE__ */ new Date()).toISOString()}_XXXXX`,
|
|
1294
1304
|
skus: []
|
|
1295
|
-
}),
|
|
1305
|
+
}), w = O();
|
|
1296
1306
|
Le(async () => {
|
|
1297
1307
|
m.value = !0;
|
|
1298
|
-
const a = await
|
|
1308
|
+
const a = await A.readSingleAdjustment(d.adjustmentId);
|
|
1299
1309
|
if (!a) throw new Error("Adjustment not found");
|
|
1300
1310
|
j.value = a, m.value = !1;
|
|
1301
1311
|
});
|
|
1302
1312
|
async function u() {
|
|
1303
1313
|
var t, l;
|
|
1304
|
-
if ((l = (t =
|
|
1314
|
+
if ((l = (t = w == null ? void 0 : w.value) == null ? void 0 : t.validateInputs) == null || l.call(t), !i.value) return;
|
|
1305
1315
|
const a = {};
|
|
1306
1316
|
Object.keys(S.value || {}).forEach((x) => {
|
|
1307
1317
|
var _;
|
|
1308
|
-
Object.keys(((_ = S.value) == null ? void 0 : _[x]) || {}).forEach((
|
|
1318
|
+
Object.keys(((_ = S.value) == null ? void 0 : _[x]) || {}).forEach(($) => {
|
|
1309
1319
|
var N, K;
|
|
1310
|
-
const H = (K = (N = S.value) == null ? void 0 : N[x]) == null ? void 0 : K[Number(
|
|
1320
|
+
const H = (K = (N = S.value) == null ? void 0 : N[x]) == null ? void 0 : K[Number($)];
|
|
1311
1321
|
H && C(H.amount) > 0 && (a[x] || (a[x] = []), a[x].push(H));
|
|
1312
1322
|
});
|
|
1313
|
-
}), await
|
|
1323
|
+
}), await A.revertWastageAdjustment({
|
|
1314
1324
|
targetWastageAdjustmentId: d.adjustmentId,
|
|
1315
1325
|
amountsGoingToAdjust: a
|
|
1316
|
-
}), o("refreshHistory"),
|
|
1326
|
+
}), o("refreshHistory"), F.value = !1, S.value = {};
|
|
1317
1327
|
}
|
|
1318
1328
|
function b(a, t, l) {
|
|
1319
1329
|
return P({
|
|
1320
1330
|
get: () => {
|
|
1321
|
-
var _,
|
|
1322
|
-
const x = (H = (
|
|
1331
|
+
var _, $, H;
|
|
1332
|
+
const x = (H = ($ = (_ = S.value) == null ? void 0 : _[a]) == null ? void 0 : $[t]) == null ? void 0 : H.amount;
|
|
1323
1333
|
return x ? C(x, !0) : 0;
|
|
1324
1334
|
},
|
|
1325
1335
|
set: (x) => {
|
|
1326
1336
|
S.value || (S.value = {});
|
|
1327
1337
|
const _ = { ...S.value };
|
|
1328
1338
|
_[a] || (_[a] = {}), _[a][t] = {
|
|
1329
|
-
amount:
|
|
1339
|
+
amount: Re.fromNumber(x),
|
|
1330
1340
|
type: te.Enum.WASTAGE,
|
|
1331
1341
|
measurement: l
|
|
1332
1342
|
}, S.value = _;
|
|
@@ -1334,7 +1344,7 @@ const Oe = {
|
|
|
1334
1344
|
});
|
|
1335
1345
|
}
|
|
1336
1346
|
function C(a, t = !0) {
|
|
1337
|
-
const l = Number(
|
|
1347
|
+
const l = Number(Re.toFormatString({ value: a }));
|
|
1338
1348
|
return t ? Math.abs(l) : l;
|
|
1339
1349
|
}
|
|
1340
1350
|
function B(a, t) {
|
|
@@ -1344,17 +1354,17 @@ const Oe = {
|
|
|
1344
1354
|
return t === 0 ? "N/A" : (a + t).toString();
|
|
1345
1355
|
}
|
|
1346
1356
|
return (a, t) => {
|
|
1347
|
-
const l = U("FmIcon"), x = U("FmStepperField"), _ = U("FmCard"),
|
|
1357
|
+
const l = U("FmIcon"), x = U("FmStepperField"), _ = U("FmCard"), $ = U("FmForm"), H = U("FmSpacer"), N = U("FmButton"), K = U("FmDialog");
|
|
1348
1358
|
return V(), z(K, {
|
|
1349
|
-
modelValue:
|
|
1350
|
-
"onUpdate:modelValue": t[4] || (t[4] = (R) =>
|
|
1359
|
+
modelValue: F.value,
|
|
1360
|
+
"onUpdate:modelValue": t[4] || (t[4] = (R) => F.value = R),
|
|
1351
1361
|
overlay: !0
|
|
1352
1362
|
}, {
|
|
1353
1363
|
"dialog-button": T(() => [
|
|
1354
1364
|
y(ze, null, {
|
|
1355
1365
|
default: T(() => [
|
|
1356
1366
|
e("button", {
|
|
1357
|
-
onClick: t[0] || (t[0] = (R) =>
|
|
1367
|
+
onClick: t[0] || (t[0] = (R) => F.value = !0),
|
|
1358
1368
|
class: "rounded-md hover:bg-gray-100 transition-colors"
|
|
1359
1369
|
}, [
|
|
1360
1370
|
y(l, {
|
|
@@ -1379,7 +1389,7 @@ const Oe = {
|
|
|
1379
1389
|
label: "Close",
|
|
1380
1390
|
size: "md",
|
|
1381
1391
|
variant: "tertiary",
|
|
1382
|
-
onClick: t[3] || (t[3] = (R) =>
|
|
1392
|
+
onClick: t[3] || (t[3] = (R) => F.value = !1)
|
|
1383
1393
|
}),
|
|
1384
1394
|
y(N, {
|
|
1385
1395
|
class: "sm:w-full xs:w-full",
|
|
@@ -1392,10 +1402,10 @@ const Oe = {
|
|
|
1392
1402
|
])
|
|
1393
1403
|
]),
|
|
1394
1404
|
default: T(() => [
|
|
1395
|
-
m.value ? (V(), Y("div", zn)) : (V(), z(
|
|
1405
|
+
m.value ? (V(), Y("div", zn)) : (V(), z($, {
|
|
1396
1406
|
key: 1,
|
|
1397
1407
|
ref_key: "formRef",
|
|
1398
|
-
ref:
|
|
1408
|
+
ref: w,
|
|
1399
1409
|
onValidationFailed: t[1] || (t[1] = () => {
|
|
1400
1410
|
i.value = !1;
|
|
1401
1411
|
}),
|
|
@@ -1408,7 +1418,7 @@ const Oe = {
|
|
|
1408
1418
|
e("p", Gn, [
|
|
1409
1419
|
t[6] || (t[6] = e("b", null, "Date:", -1)),
|
|
1410
1420
|
t[7] || (t[7] = e("br", null, null, -1)),
|
|
1411
|
-
de(" " + v(s(
|
|
1421
|
+
de(" " + v(s(Et)(s(gt)(j.value._id))), 1)
|
|
1412
1422
|
]),
|
|
1413
1423
|
e("div", Kn, [
|
|
1414
1424
|
(V(!0), Y(ne, null, ie(j.value.skus, (R, X) => (V(), Y(ne, { key: X }, [
|
|
@@ -1429,7 +1439,7 @@ const Oe = {
|
|
|
1429
1439
|
]),
|
|
1430
1440
|
e("div", Jn, [
|
|
1431
1441
|
t[9] || (t[9] = e("span", { class: "fm-typo-en-body-lg-600" }, "Current amount:", -1)),
|
|
1432
|
-
e("span", null, v(s(
|
|
1442
|
+
e("span", null, v(s(Re).toFormatString({ value: L.amount })) + " " + v(B(R, L)), 1)
|
|
1433
1443
|
]),
|
|
1434
1444
|
y(x, {
|
|
1435
1445
|
"model-value": b(R.sku._id, ee).value,
|
|
@@ -1486,21 +1496,21 @@ const Oe = {
|
|
|
1486
1496
|
emits: ["refreshHistory"],
|
|
1487
1497
|
setup(k, { emit: g }) {
|
|
1488
1498
|
const d = k, o = O(!1);
|
|
1489
|
-
|
|
1490
|
-
const
|
|
1499
|
+
Ge();
|
|
1500
|
+
const A = O(), S = O(null), m = P(() => S.value === null ? "unset" : o.value ? `${S.value}px` : "0px");
|
|
1491
1501
|
Le(() => {
|
|
1492
|
-
var
|
|
1493
|
-
S.value = ((
|
|
1502
|
+
var w;
|
|
1503
|
+
S.value = ((w = A.value) == null ? void 0 : w.scrollHeight) || 0;
|
|
1494
1504
|
});
|
|
1495
1505
|
const i = P(() => {
|
|
1496
1506
|
var D;
|
|
1497
|
-
const
|
|
1507
|
+
const w = d.record.adjustments, u = d.sku, b = {}, B = w.flatMap((a) => {
|
|
1498
1508
|
var t;
|
|
1499
1509
|
return ((t = a.skus) == null ? void 0 : t.filter((l) => l.sku._id === u._id)) ?? [];
|
|
1500
1510
|
}).flatMap((a) => a.amounts);
|
|
1501
1511
|
for (const a of B) {
|
|
1502
|
-
const t = a.measurement ?
|
|
1503
|
-
b[D = a.type] ?? (b[D] = { amount: 0, precision: 0 }), b[a.type] =
|
|
1512
|
+
const t = a.measurement ? rt(a.measurement.conversion, a.amount) : a.amount;
|
|
1513
|
+
b[D = a.type] ?? (b[D] = { amount: 0, precision: 0 }), b[a.type] = Ke(t, b[a.type]);
|
|
1504
1514
|
}
|
|
1505
1515
|
return Object.entries(b).reduce(
|
|
1506
1516
|
(a, [t, l]) => (a[t] = /// comment, because without it formatter makes code uglier
|
|
@@ -1510,8 +1520,8 @@ const Oe = {
|
|
|
1510
1520
|
})} ${u.unit.abbrev}`, a),
|
|
1511
1521
|
{}
|
|
1512
1522
|
);
|
|
1513
|
-
}), { t:
|
|
1514
|
-
time:
|
|
1523
|
+
}), { t: F } = ce(), j = P(() => d.record.adjustmentsByTime.map(({ date: w, adjustments: u }) => ({
|
|
1524
|
+
time: Pt(new Date(w)),
|
|
1515
1525
|
adjustments: u.flatMap(
|
|
1516
1526
|
(b) => {
|
|
1517
1527
|
var C, B;
|
|
@@ -1520,7 +1530,7 @@ const Oe = {
|
|
|
1520
1530
|
return {
|
|
1521
1531
|
...D,
|
|
1522
1532
|
ref: b.ref,
|
|
1523
|
-
backdateFrom: b.effectiveAt != null ?
|
|
1533
|
+
backdateFrom: b.effectiveAt != null ? at(b._id) : null,
|
|
1524
1534
|
toBalance: (t = (a = b.skus) == null ? void 0 : a[0]) == null ? void 0 : t.toBalance,
|
|
1525
1535
|
adjustmentId: b._id
|
|
1526
1536
|
};
|
|
@@ -1528,7 +1538,7 @@ const Oe = {
|
|
|
1528
1538
|
}
|
|
1529
1539
|
).flatMap((b) => {
|
|
1530
1540
|
var D;
|
|
1531
|
-
const C = (D = d.bills.find((a) => a._id === b.ref)) == null ? void 0 : D.seqNumber, B = C ?
|
|
1541
|
+
const C = (D = d.bills.find((a) => a._id === b.ref)) == null ? void 0 : D.seqNumber, B = C ? F("inventory.stock.record.bill", [C]) : "";
|
|
1532
1542
|
return b.amounts.map((a) => {
|
|
1533
1543
|
var t;
|
|
1534
1544
|
return {
|
|
@@ -1547,7 +1557,7 @@ const Oe = {
|
|
|
1547
1557
|
});
|
|
1548
1558
|
})
|
|
1549
1559
|
})));
|
|
1550
|
-
return (
|
|
1560
|
+
return (w, u) => {
|
|
1551
1561
|
const b = U("FmIcon"), C = U("FmTooltip"), B = U("FmCard");
|
|
1552
1562
|
return V(), z(B, { variant: "outlined" }, {
|
|
1553
1563
|
default: T(() => [
|
|
@@ -1556,7 +1566,7 @@ const Oe = {
|
|
|
1556
1566
|
class: "flex items-center cursor-pointer mb-1",
|
|
1557
1567
|
onClick: u[0] || (u[0] = (D) => o.value = !o.value)
|
|
1558
1568
|
}, [
|
|
1559
|
-
e("div", oo, v(
|
|
1569
|
+
e("div", oo, v(w.record.date), 1),
|
|
1560
1570
|
y(b, {
|
|
1561
1571
|
name: o.value ? "expand_more" : "expand_less",
|
|
1562
1572
|
color: "#777777",
|
|
@@ -1568,7 +1578,7 @@ const Oe = {
|
|
|
1568
1578
|
class: "flex flex-row py-1",
|
|
1569
1579
|
style: { "font-size": "0.8rem" }
|
|
1570
1580
|
}, [
|
|
1571
|
-
e("div", so, v(s(
|
|
1581
|
+
e("div", so, v(s(F)(`inventory.inventoryAdjustment.type.${a}`)), 1),
|
|
1572
1582
|
e("div", {
|
|
1573
1583
|
class: he({
|
|
1574
1584
|
"text-fm-color-typo-error": D.startsWith("-"),
|
|
@@ -1579,7 +1589,7 @@ const Oe = {
|
|
|
1579
1589
|
]))), 128)),
|
|
1580
1590
|
e("div", {
|
|
1581
1591
|
ref_key: "detailRef",
|
|
1582
|
-
ref:
|
|
1592
|
+
ref: A,
|
|
1583
1593
|
style: ot({
|
|
1584
1594
|
fontSize: "0.8rem",
|
|
1585
1595
|
maxHeight: m.value,
|
|
@@ -1599,7 +1609,7 @@ const Oe = {
|
|
|
1599
1609
|
class: "flex gap-1"
|
|
1600
1610
|
}, [
|
|
1601
1611
|
e("div", io, [
|
|
1602
|
-
de(v(s(
|
|
1612
|
+
de(v(s(F)(`inventory.inventoryAdjustment.type.${a.name}`)) + " ", 1),
|
|
1603
1613
|
a.backdateFrom ? (V(), z(C, {
|
|
1604
1614
|
key: 0,
|
|
1605
1615
|
variant: "plain",
|
|
@@ -1607,8 +1617,8 @@ const Oe = {
|
|
|
1607
1617
|
"z-index": 50
|
|
1608
1618
|
}, {
|
|
1609
1619
|
content: T(() => [
|
|
1610
|
-
e("div", uo, v(s(
|
|
1611
|
-
s(
|
|
1620
|
+
e("div", uo, v(s(F)("inventory.stock.record.backdate", [
|
|
1621
|
+
s(ut)(new Date(a.backdateFrom))
|
|
1612
1622
|
])), 1)
|
|
1613
1623
|
]),
|
|
1614
1624
|
default: T(() => [
|
|
@@ -1633,9 +1643,9 @@ const Oe = {
|
|
|
1633
1643
|
a.name === s(te).Enum.WASTAGE ? (V(), z(to, {
|
|
1634
1644
|
key: 0,
|
|
1635
1645
|
adjustmentId: a.adjustmentId,
|
|
1636
|
-
onRefreshHistory: u[1] || (u[1] = (t) =>
|
|
1646
|
+
onRefreshHistory: u[1] || (u[1] = (t) => w.$emit("refreshHistory"))
|
|
1637
1647
|
}, null, 8, ["adjustmentId"])) : se("", !0),
|
|
1638
|
-
a.cost ? (V(), Y("div", po, " (" + v(s(
|
|
1648
|
+
a.cost ? (V(), Y("div", po, " (" + v(s(we)(a.cost, !1, a.cost.precision)) + ") ", 1)) : se("", !0)
|
|
1639
1649
|
]))), 128))
|
|
1640
1650
|
])
|
|
1641
1651
|
]))), 128))
|
|
@@ -1658,19 +1668,19 @@ function vo(k, g) {
|
|
|
1658
1668
|
(m, [i]) => (m[i] = Q.fromNumber(0), m),
|
|
1659
1669
|
{}
|
|
1660
1670
|
);
|
|
1661
|
-
const
|
|
1671
|
+
const A = k.flatMap((m) => {
|
|
1662
1672
|
var i;
|
|
1663
|
-
return ((i = m.skus) == null ? void 0 : i.filter((
|
|
1673
|
+
return ((i = m.skus) == null ? void 0 : i.filter((F) => F.sku._id === g._id)) ?? [];
|
|
1664
1674
|
}).flatMap((m) => m.amounts);
|
|
1665
|
-
for (const m of
|
|
1675
|
+
for (const m of A) {
|
|
1666
1676
|
const i = m.measurement ? Q.multiply([m.measurement.conversion, m.amount]) : m.amount;
|
|
1667
1677
|
d[S = m.type] ?? (d[S] = { amount: 0, precision: 0 }), d[m.type] = Q.add([i, d[m.type]]);
|
|
1668
1678
|
}
|
|
1669
1679
|
return Object.entries(d).reduce(
|
|
1670
|
-
(m, [i,
|
|
1680
|
+
(m, [i, F]) => {
|
|
1671
1681
|
const j = {
|
|
1672
|
-
...
|
|
1673
|
-
amount: Math.abs(
|
|
1682
|
+
...F,
|
|
1683
|
+
amount: Math.abs(F.amount)
|
|
1674
1684
|
};
|
|
1675
1685
|
return m[i] = /// comment, because without it formatter makes code uglier
|
|
1676
1686
|
`${Q.toFormatString({
|
|
@@ -1685,20 +1695,20 @@ function yo(k, g) {
|
|
|
1685
1695
|
if (!g)
|
|
1686
1696
|
return null;
|
|
1687
1697
|
let d = null;
|
|
1688
|
-
const
|
|
1698
|
+
const A = k.flatMap((S) => {
|
|
1689
1699
|
var m;
|
|
1690
1700
|
return ((m = S.skus) == null ? void 0 : m.filter((i) => i.sku._id === g._id)) ?? [];
|
|
1691
1701
|
}).flatMap((S) => {
|
|
1692
1702
|
var m;
|
|
1693
1703
|
return !S.history || ((m = S.history) == null ? void 0 : m.length) === 0 ? [] : S.history[0];
|
|
1694
1704
|
});
|
|
1695
|
-
for (const S of
|
|
1705
|
+
for (const S of A) {
|
|
1696
1706
|
const m = S.amounts;
|
|
1697
1707
|
for (const i of m) {
|
|
1698
1708
|
if (i.type !== te.Enum.SALES)
|
|
1699
1709
|
continue;
|
|
1700
|
-
const
|
|
1701
|
-
d ?? (d = Q.fromNumber(0)), d = Q.add([d,
|
|
1710
|
+
const F = i.measurement ? Q.multiply([i.measurement.conversion, i.amount]) : i.amount;
|
|
1711
|
+
d ?? (d = Q.fromNumber(0)), d = Q.add([d, F]);
|
|
1702
1712
|
}
|
|
1703
1713
|
}
|
|
1704
1714
|
return d != null ? (d.amount = Math.abs(d.amount), `${Q.toFormatString({
|
|
@@ -1709,10 +1719,10 @@ function yo(k, g) {
|
|
|
1709
1719
|
const _o = { class: "flex items-center w-full fm-typo-en-title-md-800" }, ko = { class: "flex-1 line-clamp-2" }, bo = { class: "flex flex-col gap-32 w-full h-full" }, go = { class: "flex items-center relative gap-4" }, ho = { class: "flex-1" }, xo = {
|
|
1710
1720
|
key: 0,
|
|
1711
1721
|
class: "flex-1 flex flex-col items-center gap-16"
|
|
1712
|
-
}, So = { class: "fm-typo-en-body-lg-400 translate-x-4" },
|
|
1722
|
+
}, So = { class: "fm-typo-en-body-lg-400 translate-x-4" }, Fo = {
|
|
1713
1723
|
key: 1,
|
|
1714
1724
|
class: "flex flex-col gap-12"
|
|
1715
|
-
},
|
|
1725
|
+
}, wo = { class: "pb-16" }, Ao = { class: "fm-typo-cn-body-lg-600" }, $o = {
|
|
1716
1726
|
class: "grid gap-12 fm-typo-en-body-md-400",
|
|
1717
1727
|
style: { "grid-template-columns": "auto auto auto", "grid-auto-rows": "1fr" }
|
|
1718
1728
|
}, Vo = { class: "flex flex-col gap-1" }, Co = { class: "text-fm-color-typo-secondary" }, jo = { class: "font-bold" }, Do = { class: "flex flex-col gap-1" }, Bo = { class: "text-fm-color-typo-secondary flex" }, Mo = { class: "font-bold" }, Io = { class: "flex flex-col gap-1" }, Uo = { class: "text-fm-color-typo-secondary" }, To = { class: "font-bold" }, Ho = { class: "flex flex-col gap-1" }, Eo = { class: "text-fm-color-typo-secondary" }, Po = { class: "font-bold" }, Ro = { class: "flex flex-col gap-1" }, Oo = { class: "text-fm-color-typo-secondary" }, No = { class: "font-bold" }, Yo = { class: "flex flex-col gap-1" }, Lo = { class: "text-fm-color-typo-secondary" }, zo = { class: "font-bold" }, Go = { class: "flex flex-col gap-1" }, Ko = { class: "text-fm-color-typo-secondary" }, Wo = { class: "font-bold" }, qo = { class: "flex flex-col gap-1" }, Xo = { class: "text-fm-color-typo-secondary" }, Jo = { class: "font-bold" }, Qo = { class: "flex flex-col gap-1" }, Zo = { class: "text-fm-color-typo-secondary" }, es = { class: "font-bold" }, ts = {
|
|
@@ -1729,34 +1739,34 @@ const _o = { class: "flex items-center w-full fm-typo-en-title-md-800" }, ko = {
|
|
|
1729
1739
|
},
|
|
1730
1740
|
emits: ["update:show"],
|
|
1731
1741
|
setup(k) {
|
|
1732
|
-
const g =
|
|
1742
|
+
const g = Ge(), d = Me(), o = ge(), A = Ln(), S = ke(), m = Wt(), { t: i } = ce(), F = k, j = O(!1), w = be(), u = O(zt(0));
|
|
1733
1743
|
async function b() {
|
|
1734
1744
|
j.value = !0;
|
|
1735
1745
|
try {
|
|
1736
1746
|
await l(), await d.readStockBalance();
|
|
1737
1747
|
} catch (n) {
|
|
1738
|
-
|
|
1748
|
+
w.open({
|
|
1739
1749
|
title: "Something went wrong",
|
|
1740
1750
|
message: "Cannot fetch stock history. Please try again.",
|
|
1741
1751
|
type: "error"
|
|
1742
|
-
}), console.log("failed at fetching item adjustment history",
|
|
1752
|
+
}), console.log("failed at fetching item adjustment history", F.sku, u, n);
|
|
1743
1753
|
} finally {
|
|
1744
1754
|
j.value = !1;
|
|
1745
1755
|
}
|
|
1746
1756
|
}
|
|
1747
1757
|
Le(() => {
|
|
1748
1758
|
b();
|
|
1749
|
-
}), xe([() => u.value, () =>
|
|
1759
|
+
}), xe([() => u.value, () => F.sku], () => {
|
|
1750
1760
|
b();
|
|
1751
1761
|
});
|
|
1752
1762
|
const C = O([]), B = O([]), D = O(new Array());
|
|
1753
1763
|
function a(n, r) {
|
|
1754
|
-
return r === "day" ?
|
|
1764
|
+
return r === "day" ? Lt(n) : ut(n);
|
|
1755
1765
|
}
|
|
1756
1766
|
function t(n, r) {
|
|
1757
1767
|
const h = n.reduce(
|
|
1758
1768
|
(c, f) => {
|
|
1759
|
-
const M = f.effectiveAt ??
|
|
1769
|
+
const M = f.effectiveAt ?? at(f._id);
|
|
1760
1770
|
if (!M)
|
|
1761
1771
|
return c;
|
|
1762
1772
|
const I = a(new Date(M), r);
|
|
@@ -1771,9 +1781,9 @@ const _o = { class: "flex items-center w-full fm-typo-en-title-md-800" }, ko = {
|
|
|
1771
1781
|
}
|
|
1772
1782
|
async function l() {
|
|
1773
1783
|
let n = await o.readStockAdjustment(
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1784
|
+
F.sku._id,
|
|
1785
|
+
Rt(new Date(u.value.startDate)).toISOString(),
|
|
1786
|
+
Ot(new Date(u.value.endDate)).toISOString()
|
|
1777
1787
|
);
|
|
1778
1788
|
C.value = n;
|
|
1779
1789
|
const r = n.filter(({ ref: h }) => h == null ? void 0 : h.startsWith("bill_")).map(({ ref: h }) => h);
|
|
@@ -1784,28 +1794,28 @@ const _o = { class: "flex items-center w-full fm-typo-en-title-md-800" }, ko = {
|
|
|
1784
1794
|
}));
|
|
1785
1795
|
}
|
|
1786
1796
|
async function x(n) {
|
|
1787
|
-
n.length && (D.value = await
|
|
1797
|
+
n.length && (D.value = await A.findBillsById(n).catch((r) => {
|
|
1788
1798
|
var f;
|
|
1789
1799
|
console.error("Error on using latest bill API, retrying using legacy api", r);
|
|
1790
1800
|
const h = ((f = g.currentBusiness.value) == null ? void 0 : f._id) ?? "", c = S.currentLocation.doc._id;
|
|
1791
|
-
return
|
|
1801
|
+
return A.findBillsByBusinessId(h, [c], n);
|
|
1792
1802
|
}));
|
|
1793
1803
|
}
|
|
1794
1804
|
const _ = P(() => {
|
|
1795
|
-
const n = C.value, r =
|
|
1805
|
+
const n = C.value, r = F.sku;
|
|
1796
1806
|
return vo(n, r);
|
|
1797
|
-
}),
|
|
1798
|
-
const n = C.value, r =
|
|
1807
|
+
}), $ = P(() => {
|
|
1808
|
+
const n = C.value, r = F.sku;
|
|
1799
1809
|
return yo(n, r);
|
|
1800
1810
|
}), H = P(() => {
|
|
1801
1811
|
const n = [...C.value].computeFirst((h) => {
|
|
1802
1812
|
var f, M;
|
|
1803
|
-
const c = (M = (f = h.skus) == null ? void 0 : f.find) == null ? void 0 : M.call(f, (I) => I.sku._id ===
|
|
1813
|
+
const c = (M = (f = h.skus) == null ? void 0 : f.find) == null ? void 0 : M.call(f, (I) => I.sku._id === F.sku._id);
|
|
1804
1814
|
return c == null ? void 0 : c.fromBalance;
|
|
1805
1815
|
}) ?? {
|
|
1806
1816
|
amount: 0,
|
|
1807
1817
|
precision: 0
|
|
1808
|
-
}, r =
|
|
1818
|
+
}, r = F.sku;
|
|
1809
1819
|
return r ? `${Q.toFormatString({
|
|
1810
1820
|
value: n,
|
|
1811
1821
|
precision: 4
|
|
@@ -1813,12 +1823,12 @@ const _o = { class: "flex items-center w-full fm-typo-en-title-md-800" }, ko = {
|
|
|
1813
1823
|
}), N = P(() => {
|
|
1814
1824
|
const n = [...C.value].reverse().computeFirst((h) => {
|
|
1815
1825
|
var f, M;
|
|
1816
|
-
const c = (M = (f = h.skus) == null ? void 0 : f.find) == null ? void 0 : M.call(f, (I) => I.sku._id ===
|
|
1826
|
+
const c = (M = (f = h.skus) == null ? void 0 : f.find) == null ? void 0 : M.call(f, (I) => I.sku._id === F.sku._id);
|
|
1817
1827
|
return c == null ? void 0 : c.toBalance;
|
|
1818
1828
|
}) ?? {
|
|
1819
1829
|
amount: 0,
|
|
1820
1830
|
precision: 0
|
|
1821
|
-
}, r =
|
|
1831
|
+
}, r = F.sku;
|
|
1822
1832
|
return r ? `${Q.toFormatString({ value: n, precision: 4 })} ${r.unit.abbrev}` : "";
|
|
1823
1833
|
}), K = P(() => {
|
|
1824
1834
|
var h;
|
|
@@ -1830,24 +1840,24 @@ const _o = { class: "flex items-center w-full fm-typo-en-title-md-800" }, ko = {
|
|
|
1830
1840
|
const M = f.cost;
|
|
1831
1841
|
if (!M) return c;
|
|
1832
1842
|
const I = {
|
|
1833
|
-
...
|
|
1843
|
+
...Ut(c, Math.max(c.precision, M.precision)),
|
|
1834
1844
|
currency: M.currency
|
|
1835
1845
|
};
|
|
1836
1846
|
return {
|
|
1837
|
-
...
|
|
1847
|
+
...Ke(I, M),
|
|
1838
1848
|
currency: c.currency
|
|
1839
1849
|
};
|
|
1840
1850
|
},
|
|
1841
1851
|
{
|
|
1842
1852
|
amount: 0,
|
|
1843
1853
|
precision: 0,
|
|
1844
|
-
currency:
|
|
1854
|
+
currency: Ee((h = g.currentCountry) == null ? void 0 : h.value)
|
|
1845
1855
|
}
|
|
1846
1856
|
);
|
|
1847
|
-
return
|
|
1857
|
+
return we(r, !1, r.precision);
|
|
1848
1858
|
});
|
|
1849
1859
|
function R() {
|
|
1850
|
-
const { startDate: n, endDate: r } =
|
|
1860
|
+
const { startDate: n, endDate: r } = Nt(u.value);
|
|
1851
1861
|
n !== null && r !== null && (u.value = {
|
|
1852
1862
|
startDate: n,
|
|
1853
1863
|
endDate: r
|
|
@@ -1857,7 +1867,7 @@ const _o = { class: "flex items-center w-full fm-typo-en-title-md-800" }, ko = {
|
|
|
1857
1867
|
var I, G, oe, E;
|
|
1858
1868
|
const n = [...C.value].reverse().computeFirst((W) => {
|
|
1859
1869
|
var q, le;
|
|
1860
|
-
return (le = (q = W.skus) == null ? void 0 : q.find) == null ? void 0 : le.call(q, (re) => re.sku._id ===
|
|
1870
|
+
return (le = (q = W.skus) == null ? void 0 : q.find) == null ? void 0 : le.call(q, (re) => re.sku._id === F.sku._id);
|
|
1861
1871
|
});
|
|
1862
1872
|
if (!n) return "No data";
|
|
1863
1873
|
const r = [...n.amounts].reverse()[0], h = {
|
|
@@ -1866,13 +1876,13 @@ const _o = { class: "flex items-center w-full fm-typo-en-title-md-800" }, ko = {
|
|
|
1866
1876
|
}, c = r.amount, f = c.amount == 0 ? Q.fromNumber(0) : Q.divide([h, c]);
|
|
1867
1877
|
return {
|
|
1868
1878
|
...Q.multiply([f, c]),
|
|
1869
|
-
currency: ((oe = r.cost) == null ? void 0 : oe.currency) ||
|
|
1879
|
+
currency: ((oe = r.cost) == null ? void 0 : oe.currency) || Ee(((E = g.currentCountry) == null ? void 0 : E.value) ?? ht)
|
|
1870
1880
|
};
|
|
1871
1881
|
}), ee = P(() => {
|
|
1872
1882
|
var h;
|
|
1873
1883
|
const n = [...C.value].reverse().computeFirst((c) => {
|
|
1874
1884
|
var M, I;
|
|
1875
|
-
const f = (I = (M = c.skus) == null ? void 0 : M.find) == null ? void 0 : I.call(M, (G) => G.sku._id ===
|
|
1885
|
+
const f = (I = (M = c.skus) == null ? void 0 : M.find) == null ? void 0 : I.call(M, (G) => G.sku._id === F.sku._id);
|
|
1876
1886
|
return f == null ? void 0 : f.toCostBalances;
|
|
1877
1887
|
});
|
|
1878
1888
|
return n ? {
|
|
@@ -1880,17 +1890,17 @@ const _o = { class: "flex items-center w-full fm-typo-en-title-md-800" }, ko = {
|
|
|
1880
1890
|
amount: 0,
|
|
1881
1891
|
precision: 0
|
|
1882
1892
|
}),
|
|
1883
|
-
currency:
|
|
1893
|
+
currency: Ee((h = g.currentCountry) == null ? void 0 : h.value)
|
|
1884
1894
|
} : "No data";
|
|
1885
1895
|
});
|
|
1886
1896
|
function J() {
|
|
1887
|
-
const { startDate: n, endDate: r } =
|
|
1897
|
+
const { startDate: n, endDate: r } = Yt(u.value);
|
|
1888
1898
|
n !== null && r !== null && (u.value = {
|
|
1889
1899
|
startDate: n,
|
|
1890
1900
|
endDate: r
|
|
1891
1901
|
});
|
|
1892
1902
|
}
|
|
1893
|
-
const p = Ue(
|
|
1903
|
+
const p = Ue(F, "show");
|
|
1894
1904
|
return (n, r) => {
|
|
1895
1905
|
const h = U("FmButton"), c = U("FmField"), f = U("FmDateRangePicker"), M = U("FmSpacer"), I = U("FmCircularProgress"), G = U("FmIcon"), oe = U("FmTooltip"), E = U("FmMenuDivider"), W = U("FmChip"), q = U("FmCardSection"), le = U("FmCard"), re = U("FmSideSheet");
|
|
1896
1906
|
return V(), z(re, {
|
|
@@ -1955,15 +1965,15 @@ const _o = { class: "flex items-center w-full fm-typo-en-title-md-800" }, ko = {
|
|
|
1955
1965
|
e("div", So, v(s(i)("inventory.stock.history.loading")), 1),
|
|
1956
1966
|
y(M),
|
|
1957
1967
|
y(M)
|
|
1958
|
-
])) : B.value && ((Z = B.value) == null ? void 0 : Z.length) > 0 ? (V(), Y("div",
|
|
1968
|
+
])) : B.value && ((Z = B.value) == null ? void 0 : Z.length) > 0 ? (V(), Y("div", Fo, [
|
|
1959
1969
|
y(le, { variant: "outlined" }, {
|
|
1960
1970
|
default: T(() => [
|
|
1961
1971
|
y(q, { class: "flex flex-col gap-4" }, {
|
|
1962
1972
|
default: T(() => [
|
|
1963
|
-
e("div",
|
|
1964
|
-
e("div",
|
|
1973
|
+
e("div", wo, [
|
|
1974
|
+
e("div", Ao, v(s(i)("inventory.stock.history.summary.title")), 1)
|
|
1965
1975
|
]),
|
|
1966
|
-
e("div",
|
|
1976
|
+
e("div", $o, [
|
|
1967
1977
|
e("div", Vo, [
|
|
1968
1978
|
e("div", Co, v(s(i)("inventory.stock.history.summary.totalPurchase")), 1),
|
|
1969
1979
|
e("div", jo, v(_.value.PURCHASE), 1)
|
|
@@ -1971,11 +1981,11 @@ const _o = { class: "flex items-center w-full fm-typo-en-title-md-800" }, ko = {
|
|
|
1971
1981
|
e("div", Do, [
|
|
1972
1982
|
e("div", Bo, [
|
|
1973
1983
|
de(v(s(i)("inventory.stock.history.summary.totalSales")) + " ", 1),
|
|
1974
|
-
|
|
1984
|
+
$.value != null ? (V(), z(oe, {
|
|
1975
1985
|
key: 0,
|
|
1976
1986
|
variant: "plain",
|
|
1977
1987
|
placement: "top",
|
|
1978
|
-
content: `Before: ${
|
|
1988
|
+
content: `Before: ${$.value}`,
|
|
1979
1989
|
"z-index": 50
|
|
1980
1990
|
}, {
|
|
1981
1991
|
default: T(() => [
|
|
@@ -2022,7 +2032,7 @@ const _o = { class: "flex items-center w-full fm-typo-en-title-md-800" }, ko = {
|
|
|
2022
2032
|
y(E, { class: "w-full" }),
|
|
2023
2033
|
e("div", ns, [
|
|
2024
2034
|
e("div", os, [
|
|
2025
|
-
y(
|
|
2035
|
+
y(Qe, { "z-index": 50 }, {
|
|
2026
2036
|
default: T(() => [
|
|
2027
2037
|
e("div", ss, [
|
|
2028
2038
|
de(v(s(i)("inventory.stock.history.estimatedValue")) + " ", 1),
|
|
@@ -2045,18 +2055,18 @@ const _o = { class: "flex items-center w-full fm-typo-en-title-md-800" }, ko = {
|
|
|
2045
2055
|
_: 1
|
|
2046
2056
|
}),
|
|
2047
2057
|
e("div", as, [
|
|
2048
|
-
n.sku.valuation === s(
|
|
2058
|
+
n.sku.valuation === s(xt).Enum.FIFO ? (V(), Y(ne, { key: 0 }, [
|
|
2049
2059
|
y(W, {
|
|
2050
2060
|
label: "FIFO",
|
|
2051
2061
|
compact: ""
|
|
2052
2062
|
}),
|
|
2053
|
-
de(" " + v(typeof ee.value != "string" ? s(
|
|
2063
|
+
de(" " + v(typeof ee.value != "string" ? s(we)(
|
|
2054
2064
|
ee.value,
|
|
2055
2065
|
!1,
|
|
2056
2066
|
ee.value.precision
|
|
2057
2067
|
) : ee.value), 1)
|
|
2058
2068
|
], 64)) : (V(), Y(ne, { key: 1 }, [
|
|
2059
|
-
de(v(typeof L.value != "string" ? s(
|
|
2069
|
+
de(v(typeof L.value != "string" ? s(we)(
|
|
2060
2070
|
L.value,
|
|
2061
2071
|
!1,
|
|
2062
2072
|
L.value.precision
|
|
@@ -2065,7 +2075,7 @@ const _o = { class: "flex items-center w-full fm-typo-en-title-md-800" }, ko = {
|
|
|
2065
2075
|
])
|
|
2066
2076
|
]),
|
|
2067
2077
|
e("div", ls, [
|
|
2068
|
-
y(
|
|
2078
|
+
y(Qe, { "z-index": 50 }, {
|
|
2069
2079
|
default: T(() => [
|
|
2070
2080
|
e("div", rs, [
|
|
2071
2081
|
de(v(s(i)("inventory.stock.history.costSold")) + " ", 1),
|
|
@@ -2115,7 +2125,7 @@ const _o = { class: "flex items-center w-full fm-typo-en-title-md-800" }, ko = {
|
|
|
2115
2125
|
y(M),
|
|
2116
2126
|
e("div", null, [
|
|
2117
2127
|
e("img", {
|
|
2118
|
-
src: s(
|
|
2128
|
+
src: s(Kt),
|
|
2119
2129
|
alt: "List is empty"
|
|
2120
2130
|
}, null, 8, ds)
|
|
2121
2131
|
]),
|
|
@@ -2134,16 +2144,16 @@ const _o = { class: "flex items-center w-full fm-typo-en-title-md-800" }, ko = {
|
|
|
2134
2144
|
}), vs = {
|
|
2135
2145
|
key: 0,
|
|
2136
2146
|
class: "flex items-center gap-1"
|
|
2137
|
-
}, ys = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, _s = { class: "flex flex-col gap-8" }, ks = { class: "flex flex-col" }, bs = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, gs = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary line-clamp-1" },
|
|
2147
|
+
}, ys = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, _s = { class: "flex flex-col gap-8" }, ks = { class: "flex flex-col" }, bs = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, gs = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary line-clamp-1" }, zs = /* @__PURE__ */ ue({
|
|
2138
2148
|
__name: "StockView",
|
|
2139
2149
|
setup(k) {
|
|
2140
|
-
const { t: g } = ce(), d = Be(), o = ke(),
|
|
2150
|
+
const { t: g } = ce(), d = Be(), o = ke(), A = Me(), S = dt(), m = ge(), i = st(), F = qt(), { columnDefs: j } = sn(), w = Ie(), u = be();
|
|
2141
2151
|
o.watchLocation(D);
|
|
2142
2152
|
const b = P(
|
|
2143
|
-
() => new Set(
|
|
2153
|
+
() => new Set(F.getAvailableItems(F.businessSubsidiaryId))
|
|
2144
2154
|
), C = O(!1);
|
|
2145
2155
|
async function B() {
|
|
2146
|
-
|
|
2156
|
+
w.open({
|
|
2147
2157
|
title: g("inventory.stock.stock_balance.refreshBalance"),
|
|
2148
2158
|
message: g("inventory.stock.stock_balance.refreshBalanceDescription"),
|
|
2149
2159
|
closeButton: !0,
|
|
@@ -2168,7 +2178,7 @@ const _o = { class: "flex items-center w-full fm-typo-en-title-md-800" }, ko = {
|
|
|
2168
2178
|
if (o._currentLocation) {
|
|
2169
2179
|
C.value = !0;
|
|
2170
2180
|
try {
|
|
2171
|
-
await
|
|
2181
|
+
await A.readStockBalance(), await A.readProductBalance(), await i.readStockEstimateBalance();
|
|
2172
2182
|
} catch (J) {
|
|
2173
2183
|
u.open({
|
|
2174
2184
|
title: g("inventory.stock.error.title"),
|
|
@@ -2199,17 +2209,17 @@ const _o = { class: "flex items-center w-full fm-typo-en-title-md-800" }, ko = {
|
|
|
2199
2209
|
]
|
|
2200
2210
|
}), l = P(() => {
|
|
2201
2211
|
var n, r, h;
|
|
2202
|
-
const J = t.value ?
|
|
2212
|
+
const J = t.value ? Xt.build(t.value) : null, p = [];
|
|
2203
2213
|
for (const c of d.skus) {
|
|
2204
2214
|
let f = !0;
|
|
2205
|
-
if (
|
|
2215
|
+
if (F.isEnabled && _.value && b.value && f && (f = b.value.has(c._id)), J && f && (f = Jt(
|
|
2206
2216
|
{
|
|
2207
2217
|
status: c.isInactive ? "Inactive" : "Active"
|
|
2208
2218
|
},
|
|
2209
2219
|
J
|
|
2210
2220
|
)), f) {
|
|
2211
2221
|
const M = c.trackingMeasurement;
|
|
2212
|
-
let I = (r = (n =
|
|
2222
|
+
let I = (r = (n = A.stockBalance.skus) == null ? void 0 : n.find(
|
|
2213
2223
|
(E) => E.id === c._id
|
|
2214
2224
|
)) == null ? void 0 : r.balance, G = i.inventoryForecast.skus.find(
|
|
2215
2225
|
(E) => E.id === c._id
|
|
@@ -2227,7 +2237,7 @@ const _o = { class: "flex items-center w-full fm-typo-en-title-md-800" }, ko = {
|
|
|
2227
2237
|
}
|
|
2228
2238
|
}
|
|
2229
2239
|
return p;
|
|
2230
|
-
}), x = O(""), _ = O(!0), { breakpoints:
|
|
2240
|
+
}), x = O(""), _ = O(!0), { breakpoints: $ } = Vt(), H = P(() => $.value.xs || $.value.sm), N = P(() => H.value ? 10 : 20), K = vt(), R = P(() => [
|
|
2231
2241
|
{
|
|
2232
2242
|
label: g("inventory.stock.stock_balance.refreshBalance"),
|
|
2233
2243
|
value: "refresh-balance",
|
|
@@ -2265,7 +2275,7 @@ const _o = { class: "flex items-center w-full fm-typo-en-title-md-800" }, ko = {
|
|
|
2265
2275
|
}
|
|
2266
2276
|
return (J, p) => {
|
|
2267
2277
|
const n = U("FmSwitch"), r = U("FmTable");
|
|
2268
|
-
return V(), z(
|
|
2278
|
+
return V(), z(yt, {
|
|
2269
2279
|
title: s(g)("inventory.stock.title"),
|
|
2270
2280
|
actions: R.value,
|
|
2271
2281
|
"onClick:action": ee
|
|
@@ -2282,7 +2292,7 @@ const _o = { class: "flex items-center w-full fm-typo-en-title-md-800" }, ko = {
|
|
|
2282
2292
|
}
|
|
2283
2293
|
])
|
|
2284
2294
|
}, [
|
|
2285
|
-
y(
|
|
2295
|
+
y(Gt, {
|
|
2286
2296
|
searchable: "",
|
|
2287
2297
|
"change-location": "",
|
|
2288
2298
|
search: x.value,
|
|
@@ -2294,9 +2304,9 @@ const _o = { class: "flex items-center w-full fm-typo-en-title-md-800" }, ko = {
|
|
|
2294
2304
|
"onUpdate:filter": p[2] || (p[2] = (I) => t.value = I)
|
|
2295
2305
|
}, {
|
|
2296
2306
|
default: T(() => [
|
|
2297
|
-
s(
|
|
2307
|
+
s(F).isEnabled ? (V(), Y("div", vs, [
|
|
2298
2308
|
e("span", ys, v(s(g)("inventory.integration.netsuite.subsidiaryHierarchy.filtering")), 1),
|
|
2299
|
-
y(
|
|
2309
|
+
y(At),
|
|
2300
2310
|
y(ze, null, {
|
|
2301
2311
|
default: T(() => [
|
|
2302
2312
|
y(n, {
|
|
@@ -2321,7 +2331,7 @@ const _o = { class: "flex items-center w-full fm-typo-en-title-md-800" }, ko = {
|
|
|
2321
2331
|
"page-size": N.value
|
|
2322
2332
|
}, {
|
|
2323
2333
|
"list-row": T((I) => [
|
|
2324
|
-
y(
|
|
2334
|
+
y(Ft, {
|
|
2325
2335
|
row: I,
|
|
2326
2336
|
onRowClick: s(S).showSkuHistory
|
|
2327
2337
|
}, {
|
|
@@ -2331,20 +2341,20 @@ const _o = { class: "flex items-center w-full fm-typo-en-title-md-800" }, ko = {
|
|
|
2331
2341
|
e("div", _s, [
|
|
2332
2342
|
e("div", ks, [
|
|
2333
2343
|
e("div", bs, [
|
|
2334
|
-
y(s(
|
|
2344
|
+
y(s(Je), {
|
|
2335
2345
|
render: (W = (E = (oe = G.code) == null ? void 0 : oe.column) == null ? void 0 : E.columnDef) == null ? void 0 : W.cell,
|
|
2336
2346
|
props: (le = (q = G.code) == null ? void 0 : q.getContext) == null ? void 0 : le.call(q)
|
|
2337
2347
|
}, null, 8, ["render", "props"])
|
|
2338
2348
|
]),
|
|
2339
2349
|
e("div", gs, [
|
|
2340
|
-
y(s(
|
|
2350
|
+
y(s(Je), {
|
|
2341
2351
|
render: (ae = (Z = (re = G.name) == null ? void 0 : re.column) == null ? void 0 : Z.columnDef) == null ? void 0 : ae.cell,
|
|
2342
2352
|
props: (me = (fe = G.name) == null ? void 0 : fe.getContext) == null ? void 0 : me.call(fe)
|
|
2343
2353
|
}, null, 8, ["render", "props"])
|
|
2344
2354
|
])
|
|
2345
2355
|
]),
|
|
2346
2356
|
e("div", null, [
|
|
2347
|
-
y(
|
|
2357
|
+
y(Ne, {
|
|
2348
2358
|
days: I.original.day
|
|
2349
2359
|
}, null, 8, ["days"])
|
|
2350
2360
|
]),
|
|
@@ -2385,5 +2395,5 @@ const _o = { class: "flex items-center w-full fm-typo-en-title-md-800" }, ko = {
|
|
|
2385
2395
|
}
|
|
2386
2396
|
});
|
|
2387
2397
|
export {
|
|
2388
|
-
|
|
2398
|
+
zs as default
|
|
2389
2399
|
};
|