@feedmepos/mf-inventory-portal 1.5.9-dev.3 → 1.5.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-D0rEB_hc.js → App-erqZSd0c.js} +4 -4
- package/dist/{ApprovalView-WJ0U3xPN.js → ApprovalView-C2CGthqi.js} +7 -7
- package/dist/{BindingsDialog-BDj19giE.js → BindingsDialog-Cw6MdCbI.js} +2 -2
- package/dist/{BindingsPicker-CFCUtXom.js → BindingsPicker-CcSrxhUo.js} +2 -2
- package/dist/{BindingsTable-B6G_a_Xh.js → BindingsTable-C5nMju9L.js} +3 -3
- package/dist/{ClosingDraftView-B0Y-eJad.js → ClosingDraftView-C_Loim5S.js} +159 -158
- package/dist/{ClosingHistoryView-Ccn6VT7W.js → ClosingHistoryView-7TcMNjKb.js} +5 -5
- package/dist/{ClosingTemplateView-DFt1U6N2.js → ClosingTemplateView-PQdTcIFY.js} +14 -14
- package/dist/{DefaultView-Bgxhn9_C.js → DefaultView-BIlFmXaB.js} +2 -2
- package/dist/{DeliveryOrderPrintPreview-C7YjR-lR.js → DeliveryOrderPrintPreview-BhT1YxRZ.js} +2 -2
- package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-DlhCmX5Q.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-DO7xvy5V.js} +2 -2
- package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-CQ-fk1j9.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-Bf6RHJdQ.js} +2 -2
- package/dist/{FmMultiselectDialog-PP-y-9ll.js → FmMultiselectDialog-B-X6WQXu.js} +1 -1
- package/dist/{FmMultiselectDialog-BcbD6L-6.js → FmMultiselectDialog-cXV6Jo4B.js} +2 -2
- package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang--OJFkfUg.js → FmUnitInput.vue_vue_type_script_setup_true_lang-BHazP1jS.js} +5 -5
- package/dist/{ImportView-y-sW6YJk.js → ImportView-B3jO8aU8.js} +6 -6
- package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-CvADA35V.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-GPVWrmed.js} +1 -1
- package/dist/{IngredientGroupView-BhF7iLsu.js → IngredientGroupView-BuUoHLDb.js} +5 -5
- package/dist/{IngredientsView-CVBBu2JY.js → IngredientsView-Dq_YrtQ5.js} +15 -15
- package/dist/{IntegrationExplorerView-DTBg02Bz.js → IntegrationExplorerView-Dh5ZPJK-.js} +5 -5
- package/dist/{IntegrationView-Cydrrs74.js → IntegrationView-DWbHZdc4.js} +13 -13
- package/dist/{InventoryBindingForm-DKQa7fnN.js → InventoryBindingForm-D-EN8Tpz.js} +1 -1
- package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-C9LQum08.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-CI4hutH2.js} +5 -5
- package/dist/{InventoryBindingSummary-DeWzvrhq.js → InventoryBindingSummary-BTagfxn1.js} +1 -1
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-BFVNbGxB.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-BUBHDMNn.js} +1 -1
- package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-kHL5pvnT.js → PremiumBadge.vue_vue_type_script_setup_true_lang-D2B20Qv0.js} +1 -1
- package/dist/{PublishView-Bw8BGRrk.js → PublishView-CpiWv2n6.js} +3 -3
- package/dist/{PurchaseOrderPrintPreview-CZ55EFid.js → PurchaseOrderPrintPreview-Czi5Aip0.js} +2 -2
- package/dist/{ReceiveRequestView-C2jIwxqP.js → ReceiveRequestView-BVEU4j9p.js} +25 -25
- package/dist/{RecipeView-QFEzo1zV.js → RecipeView-OVmWTAt-.js} +17 -17
- package/dist/{SettingsView-xzJr3rcE.js → SettingsView-CMQLojRr.js} +4 -4
- package/dist/{StockView-D2oGxb2R.js → StockView-DZeeZlJq.js} +279 -278
- package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-D_N6p0fJ.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-Bf1b1rJK.js} +1 -1
- package/dist/{SupplierView-BtqDtx6n.js → SupplierView-BcmkfFvI.js} +12 -12
- package/dist/{SurchargeView-CoFwSL5Q.js → SurchargeView-DhcatJUO.js} +6 -6
- package/dist/{SystemTrailDialog.vue_vue_type_script_setup_true_lang-BLLGccT0.js → SystemTrailDialog.vue_vue_type_script_setup_true_lang-D6bwhx8Z.js} +2 -2
- package/dist/{TemplatePublishDialog.vue_vue_type_script_setup_true_lang-zh4NhAEI.js → TemplatePublishDialog.vue_vue_type_script_setup_true_lang-4Ti9w_wf.js} +1 -1
- package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-DgZSc_9V.js → TransferDetails.vue_vue_type_script_setup_true_lang-Dw1TIZVj.js} +20 -20
- package/dist/{TransferTemplateView-Dl-OyvDb.js → TransferTemplateView-CRPvLRHd.js} +18 -18
- package/dist/{UnitCostHistoryView-BIw918FD.js → UnitCostHistoryView-B4pAplGT.js} +4 -4
- package/dist/{UnitDisplayControl.vue_vue_type_script_setup_true_lang-CtGOQmnR.js → UnitDisplayControl.vue_vue_type_script_setup_true_lang-D3OGljNP.js} +4 -4
- package/dist/{UnitView-B_dLvYDI.js → UnitView-95-cARn9.js} +7 -7
- package/dist/{WarehouseView-64cnOkX7.js → WarehouseView-o1FxslRs.js} +5 -5
- package/dist/{WastageTemplateView-D5VBwUYy.js → WastageTemplateView-D3hu-bq0.js} +14 -14
- package/dist/{app-CNNLRTCj.js → app-BEJm79K1.js} +11 -11
- package/dist/app.js +1 -1
- package/dist/{closing-template-BctmJnkK.js → closing-template-BotB3jos.js} +1 -1
- package/dist/{date2-p0u0cTaX.js → date2-CnEklTL8.js} +1 -1
- package/dist/{dayjs.min-DqTkfBNo.js → dayjs.min-CUR65wqq.js} +1 -1
- package/dist/{decimal-EZa-WCtE.js → decimal-CV_OL7iL.js} +2 -2
- package/dist/{defineDeepModel-DFCv7__x.js → defineDeepModel-D7NJvnaz.js} +1 -1
- package/dist/{duplicate-template-PFPE8NVL.js → duplicate-template-DCaAVNSG.js} +1 -1
- package/dist/{export-rK4ja3U6.js → export-HmzdllkU.js} +2 -2
- package/dist/{feature-C49Rhz57.js → feature-BpZTiO4W.js} +2 -2
- package/dist/{format-time-from-id-B9l_ZpVG.js → format-time-from-id-Awu23hHz.js} +1 -1
- package/dist/{format-unit-display-B-rCf09w.js → format-unit-display-B2_RGXzk.js} +11 -11
- package/dist/{import-export.helper-jBgZqyRF.js → import-export.helper-BuNDvFsc.js} +6 -6
- package/dist/{index-C8LCuoJ5.js → index-BBqEhoS9.js} +1 -1
- package/dist/{index-DCYuK2RB.js → index-BK75WSFH.js} +3 -3
- package/dist/{index-DO8fSF5f.js → index-D_u-AkFp.js} +1 -1
- package/dist/{inventory-core-dart.default-GR9b8uej.js → inventory-core-dart.default-D_hfcDPc.js} +1 -1
- package/dist/{lz-string-lKMFi5Fy.js → lz-string-K7l_8Og1.js} +1 -1
- package/dist/{netsuite-CxsdEdoM.js → netsuite-CPUKn7UQ.js} +2 -2
- package/dist/{number-CTtISVh1.js → number-DoYjk_zN.js} +3 -3
- package/dist/{predefined-templates-zjPFiMBW.js → predefined-templates-CEDkdeWc.js} +1 -1
- package/dist/{purchase-order-template-BX4kVFz2.js → purchase-order-template-ChZyiCwx.js} +1 -1
- package/dist/{recalculationUtils-D1e0w69y.js → recalculationUtils-CEkm9-mp.js} +1 -1
- package/dist/{rules-DaMQCy7O.js → rules-DDjcQi_O.js} +2 -2
- package/dist/{stock-SBDQxjEi.js → stock-Voq2gMuS.js} +1 -1
- package/dist/{supplier-B3bRVYvx.js → supplier-DFopX4OU.js} +2 -2
- package/dist/{surcharge-CWAUQM24.js → surcharge-CjwbPJQi.js} +1 -1
- package/dist/{uom-rules-BxjfqLv1.js → uom-rules-CHnn3ILl.js} +1 -1
- package/dist/{use-ingredient-select-dialog-DzxVCjao.js → use-ingredient-select-dialog-DS6__LXy.js} +2 -2
- package/dist/{use-inventory-binding-dialog-Dd-ZQEt_.js → use-inventory-binding-dialog-DcJJo3Lr.js} +2 -2
- package/dist/{use-template-enabled-locations-BixH3gtL.js → use-template-enabled-locations-BVs_0JOA.js} +2 -2
- package/dist/{use-transfer-locations-DCi3j1zt.js → use-transfer-locations-Dzp5fj3Z.js} +2 -2
- package/dist/{useHrmPermission-CNOgDieE.js → useHrmPermission-DQQ5MYsL.js} +1 -1
- package/dist/{useNavigationMenu-BNwACcDB.js → useNavigationMenu-msCIV-Ux.js} +2 -2
- package/dist/{useSseClient-Bj-ZNA8d.js → useSseClient-cer6d2VA.js} +3 -3
- package/dist/{vue-i18n-C6mAjZMj.js → vue-i18n-BiedKAFs.js} +518 -518
- package/dist/{xlsx-BtQUuMVO.js → xlsx-DGn-BAF9.js} +398 -398
- package/dist/{xlsx.util-CH88y-5V.js → xlsx.util-DXnaPoeW.js} +3 -3
- package/package.json +4 -4
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
import { defineComponent as ve, openBlock as V, createBlock as ne, withCtx as M, createElementVNode as e, toDisplayString as p, unref as s, ref as Y, h as be, computed as T, watch as Fe, resolveComponent as B, isRef as Pe, createVNode as _, createElementBlock as q, Fragment as ue, renderList as fe, createCommentVNode as se, normalizeClass as He, reactive as _t, mergeModels as nt, useModel as jt, onMounted as qe, createTextVNode as ye, normalizeStyle as kt, watchEffect as Vt, renderSlot as st, onUnmounted as Ct, Teleport as Dt, normalizeProps as at, mergeProps as ze } from "vue";
|
|
2
2
|
import { u as Bt, _ as Mt } from "./SingleColumnLayout.vue_vue_type_script_setup_true_lang-DGlWE5I8.js";
|
|
3
|
-
import { u as Se, c as Re, a as Ne, F as rt, t as It, D as ie, s as Ht, m as Tt, B as Et, w as oe, f as Ce, h as lt, d as it, J as ge, K as De } from "./app-
|
|
4
|
-
import { u as Oe, a as Ut } from "./useSseClient-
|
|
3
|
+
import { u as Se, c as Re, a as Ne, F as rt, t as It, D as ie, s as Ht, m as Tt, B as Et, w as oe, f as Ce, h as lt, d as it, J as ge, K as De } from "./app-BEJm79K1.js";
|
|
4
|
+
import { u as Oe, a as Ut } from "./useSseClient-cer6d2VA.js";
|
|
5
5
|
import { c as Pt } from "./component-kqxARxvM.js";
|
|
6
|
-
import { _ as ht, o as Rt } from "./UnitDisplayControl.vue_vue_type_script_setup_true_lang-
|
|
7
|
-
import { _ as Ke, S as Ge, g as bt, a as Nt } from "./SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-
|
|
6
|
+
import { _ as ht, o as Rt } from "./UnitDisplayControl.vue_vue_type_script_setup_true_lang-D3OGljNP.js";
|
|
7
|
+
import { _ as Ke, S as Ge, g as bt, a as Nt } from "./SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-Bf1b1rJK.js";
|
|
8
8
|
import { _ as Ot } from "./PreviewBadge.vue_vue_type_script_setup_true_lang-CRZiQHjx.js";
|
|
9
9
|
import { useI18n as pe, useCoreStore as Xe } from "@feedmepos/mf-common";
|
|
10
|
-
import { u as gt, i as Te, _ as ut } from "./PremiumBadge.vue_vue_type_script_setup_true_lang-
|
|
10
|
+
import { u as gt, i as Te, _ as ut } from "./PremiumBadge.vue_vue_type_script_setup_true_lang-D2B20Qv0.js";
|
|
11
11
|
import { useSnackbar as we, useDialog as Le, useProxiedModel as Ye, useBreakpoints as Lt } from "@feedmepos/ui-library";
|
|
12
12
|
import { defineStore as Yt } from "pinia";
|
|
13
13
|
import { F as Je } from "./FmAdminBadge-DjnBAgyv.js";
|
|
14
|
-
import { g as $e, a as he, e as zt, t as Ee, c as xe, f as Gt, h as ct, i as xt, j as Qe, d as Me, k as Wt } from "./number-
|
|
15
|
-
import { u as Ae } from "./stock-
|
|
16
|
-
import { c as Ue, A as Kt, M as qt, R as Xt } from "./rules-
|
|
17
|
-
import { u as Jt } from "./use-inventory-binding-dialog-
|
|
18
|
-
import { a as St } from "./FmMultiselectDialog-
|
|
19
|
-
import { d as ke } from "./dayjs.min-
|
|
20
|
-
import { _ as Qt } from "./NumberPrecisionInput.vue_vue_type_script_setup_true_lang-
|
|
21
|
-
import { g as Zt } from "./decimal-
|
|
22
|
-
import { a as eo, c as to, f as wt, t as dt, d as mt, p as oo, n as no, b as so } from "./date2-
|
|
23
|
-
import { i as ao, _ as ro } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-
|
|
14
|
+
import { g as $e, a as he, e as zt, t as Ee, c as xe, f as Gt, h as ct, i as xt, j as Qe, d as Me, k as Wt } from "./number-DoYjk_zN.js";
|
|
15
|
+
import { u as Ae } from "./stock-Voq2gMuS.js";
|
|
16
|
+
import { c as Ue, A as Kt, M as qt, R as Xt } from "./rules-DDjcQi_O.js";
|
|
17
|
+
import { u as Jt } from "./use-inventory-binding-dialog-DcJJo3Lr.js";
|
|
18
|
+
import { a as St } from "./FmMultiselectDialog-cXV6Jo4B.js";
|
|
19
|
+
import { d as ke } from "./dayjs.min-CUR65wqq.js";
|
|
20
|
+
import { _ as Qt } from "./NumberPrecisionInput.vue_vue_type_script_setup_true_lang-BUBHDMNn.js";
|
|
21
|
+
import { g as Zt } from "./decimal-CV_OL7iL.js";
|
|
22
|
+
import { a as eo, c as to, f as wt, t as dt, d as mt, p as oo, n as no, b as so } from "./date2-CnEklTL8.js";
|
|
23
|
+
import { i as ao, _ as ro } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-Bf6RHJdQ.js";
|
|
24
24
|
import { _ as lo } from "./empty-placeholder-B0QU467o.js";
|
|
25
|
-
import { F as _e } from "./inventory-core-dart.default-
|
|
26
|
-
import { u as io } from "./feature-
|
|
27
|
-
import { u as At } from "./useHrmPermission-
|
|
25
|
+
import { F as _e } from "./inventory-core-dart.default-D_hfcDPc.js";
|
|
26
|
+
import { u as io } from "./feature-BpZTiO4W.js";
|
|
27
|
+
import { u as At } from "./useHrmPermission-DQQ5MYsL.js";
|
|
28
28
|
import { _ as uo, F as ft } from "./TableActionableRow.vue_vue_type_script_setup_true_lang-Ca_eYa8-.js";
|
|
29
|
-
import { u as co } from "./netsuite-
|
|
29
|
+
import { u as co } from "./netsuite-CPUKn7UQ.js";
|
|
30
30
|
import { P as mo, J as fo } from "./app-DiX-EfV6.js";
|
|
31
31
|
var Ie = /* @__PURE__ */ ((A) => (A.History = "History", A.Convert = "Convert", A.Adjust = "Adjust", A))(Ie || {});
|
|
32
32
|
const vo = [
|
|
@@ -67,14 +67,14 @@ const vo = [
|
|
|
67
67
|
}));
|
|
68
68
|
}
|
|
69
69
|
}), Ft = Yt("stockActions", () => {
|
|
70
|
-
const A = Y(!1), u = Se(), k = Oe(), y = gt(),
|
|
70
|
+
const A = Y(!1), u = Se(), k = Oe(), y = gt(), w = we(), j = Le(), { t: d } = pe();
|
|
71
71
|
async function r() {
|
|
72
72
|
if (u._currentLocation) {
|
|
73
73
|
A.value = !0;
|
|
74
74
|
try {
|
|
75
75
|
await k.readStockBalance(), await k.readProductBalance(), await y.readStockEstimateBalance();
|
|
76
76
|
} catch {
|
|
77
|
-
|
|
77
|
+
w.open({
|
|
78
78
|
title: d("inventory.stock.error.title"),
|
|
79
79
|
message: d("inventory.stock.error.message"),
|
|
80
80
|
type: "error"
|
|
@@ -84,10 +84,10 @@ const vo = [
|
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
|
-
const
|
|
88
|
-
async function R(
|
|
87
|
+
const g = Y();
|
|
88
|
+
async function R(b) {
|
|
89
89
|
var $, E, N;
|
|
90
|
-
if (!!!((E = ($ =
|
|
90
|
+
if (!!!((E = ($ = b.convert) == null ? void 0 : $.inventoryBindings) != null && E.length)) {
|
|
91
91
|
j.open({
|
|
92
92
|
title: d("inventory.stock.error.convert.title"),
|
|
93
93
|
message: d("inventory.stock.error.convert.message")
|
|
@@ -95,22 +95,22 @@ const vo = [
|
|
|
95
95
|
return;
|
|
96
96
|
}
|
|
97
97
|
const n = {
|
|
98
|
-
maxCount: ((N = k.productBalance.find(({ id: O }) => O ===
|
|
99
|
-
sku:
|
|
98
|
+
maxCount: ((N = k.productBalance.find(({ id: O }) => O === b._id)) == null ? void 0 : N.count) || 0,
|
|
99
|
+
sku: b,
|
|
100
100
|
show: !0,
|
|
101
101
|
"onUpdate:show"(O) {
|
|
102
|
-
|
|
102
|
+
g.value.show = O;
|
|
103
103
|
},
|
|
104
104
|
onSubmitted() {
|
|
105
105
|
r();
|
|
106
106
|
}
|
|
107
107
|
};
|
|
108
|
-
|
|
108
|
+
g.value = n;
|
|
109
109
|
}
|
|
110
110
|
const C = Y();
|
|
111
|
-
async function l(
|
|
111
|
+
async function l(b) {
|
|
112
112
|
const o = {
|
|
113
|
-
stock:
|
|
113
|
+
stock: b,
|
|
114
114
|
show: !0,
|
|
115
115
|
"onUpdate:show"(t) {
|
|
116
116
|
C.value.show = t;
|
|
@@ -122,9 +122,9 @@ const vo = [
|
|
|
122
122
|
C.value = o;
|
|
123
123
|
}
|
|
124
124
|
const a = Y();
|
|
125
|
-
async function D(
|
|
125
|
+
async function D(b) {
|
|
126
126
|
const o = {
|
|
127
|
-
sku:
|
|
127
|
+
sku: b,
|
|
128
128
|
show: !0,
|
|
129
129
|
"onUpdate:show"(t) {
|
|
130
130
|
a.value.show = t;
|
|
@@ -132,9 +132,9 @@ const vo = [
|
|
|
132
132
|
};
|
|
133
133
|
a.value = o;
|
|
134
134
|
}
|
|
135
|
-
function m(
|
|
135
|
+
function m(b, o) {
|
|
136
136
|
const t = Re(o);
|
|
137
|
-
switch (
|
|
137
|
+
switch (b) {
|
|
138
138
|
case Ie.History:
|
|
139
139
|
D(t);
|
|
140
140
|
return;
|
|
@@ -151,7 +151,7 @@ const vo = [
|
|
|
151
151
|
onActionMenu: m,
|
|
152
152
|
stockHistoryProps: a,
|
|
153
153
|
showSkuHistory: D,
|
|
154
|
-
convertSkuDialogProps:
|
|
154
|
+
convertSkuDialogProps: g,
|
|
155
155
|
adjustSkuDialogProps: C
|
|
156
156
|
};
|
|
157
157
|
});
|
|
@@ -176,13 +176,13 @@ function ko() {
|
|
|
176
176
|
id: "UOM",
|
|
177
177
|
header: () => y("inventory.stock.balance"),
|
|
178
178
|
cell(d) {
|
|
179
|
-
const r = d.row.original,
|
|
179
|
+
const r = d.row.original, g = {
|
|
180
180
|
unit: r.unit,
|
|
181
181
|
sku: r,
|
|
182
182
|
amount: r.balance,
|
|
183
183
|
defaultTrackingMeasurement: r.trackingMeasurement ?? void 0
|
|
184
184
|
};
|
|
185
|
-
return be(ht,
|
|
185
|
+
return be(ht, g);
|
|
186
186
|
},
|
|
187
187
|
size: 180
|
|
188
188
|
},
|
|
@@ -214,11 +214,11 @@ function ko() {
|
|
|
214
214
|
sortUndefined: "last",
|
|
215
215
|
cell(d) {
|
|
216
216
|
var D, m;
|
|
217
|
-
const r = d.row.original.day,
|
|
217
|
+
const r = d.row.original.day, g = d.row.original.operator, R = (D = d.row.original.thresholds) == null ? void 0 : D.low, C = (m = d.row.original.thresholds) == null ? void 0 : m.mid;
|
|
218
218
|
if (typeof r != "number" || typeof R != "number" || typeof C != "number")
|
|
219
219
|
return be(Ke, {
|
|
220
220
|
days: r,
|
|
221
|
-
operator:
|
|
221
|
+
operator: g
|
|
222
222
|
});
|
|
223
223
|
const l = r <= R ? Ge.low : r <= C ? Ge.mid : Ge.high;
|
|
224
224
|
return be(Ke, {
|
|
@@ -234,7 +234,7 @@ function ko() {
|
|
|
234
234
|
var r;
|
|
235
235
|
return Pt(
|
|
236
236
|
((r = A._currentLocation) == null ? void 0 : r.type) === "restaurant" ? vo : po,
|
|
237
|
-
(
|
|
237
|
+
(g) => u.onActionMenu(g, d.row.original)
|
|
238
238
|
);
|
|
239
239
|
},
|
|
240
240
|
enableSorting: !1,
|
|
@@ -293,10 +293,10 @@ const bo = { class: "flex items-center" }, go = { class: "fm-typo-en-title-md-80
|
|
|
293
293
|
},
|
|
294
294
|
emits: ["update:show", "submitted"],
|
|
295
295
|
setup(A, { expose: u, emit: k }) {
|
|
296
|
-
const y = A,
|
|
296
|
+
const y = A, w = k, j = Jt(), d = Ne(), r = Ae(), g = we(), { t: R } = pe(), C = Y(0), l = Y(null), a = T(() => d.skus), D = T(
|
|
297
297
|
() => {
|
|
298
|
-
var
|
|
299
|
-
return (((F = (
|
|
298
|
+
var x, F;
|
|
299
|
+
return (((F = (x = y.sku) == null ? void 0 : x.convert) == null ? void 0 : F.inventoryBindings) ?? []).filter(
|
|
300
300
|
(G) => G.type === rt.enum.SKU
|
|
301
301
|
);
|
|
302
302
|
}
|
|
@@ -304,34 +304,34 @@ const bo = { class: "flex items-center" }, go = { class: "fm-typo-en-title-md-80
|
|
|
304
304
|
get() {
|
|
305
305
|
return !!l.value;
|
|
306
306
|
},
|
|
307
|
-
set(
|
|
308
|
-
|
|
307
|
+
set(x) {
|
|
308
|
+
x ? l.value = Re(D.value) : (l.value = null, C.value = Math.min(C.value, y.maxCount ?? 0));
|
|
309
309
|
}
|
|
310
|
-
}),
|
|
311
|
-
Fe([() => y.show], ([
|
|
312
|
-
|
|
310
|
+
}), b = Y(!1);
|
|
311
|
+
Fe([() => y.show], ([x]) => {
|
|
312
|
+
x && (C.value = 0);
|
|
313
313
|
});
|
|
314
314
|
function o() {
|
|
315
315
|
L(y.sku, Ee(C.value), l.value);
|
|
316
316
|
}
|
|
317
|
-
function t(
|
|
317
|
+
function t(x) {
|
|
318
318
|
if (l.value)
|
|
319
319
|
return !0;
|
|
320
|
-
const F = vt(
|
|
320
|
+
const F = vt(x).isInteger().max(y.maxCount ?? 0).error ?? "";
|
|
321
321
|
return F || !0;
|
|
322
322
|
}
|
|
323
|
-
function n(
|
|
323
|
+
function n(x) {
|
|
324
324
|
var I;
|
|
325
325
|
const F = (I = y.sku.convert) != null && I.measurement ? y.sku.unit.measurements.find((c) => {
|
|
326
326
|
var h;
|
|
327
327
|
return c.id === ((h = y.sku.convert) == null ? void 0 : h.measurement);
|
|
328
|
-
}) ?? null : null, G = $e(y.sku.unit, F), H = Gt(+
|
|
328
|
+
}) ?? null : null, G = $e(y.sku.unit, F), H = Gt(+x);
|
|
329
329
|
return vt(H).isInteger().max(G).error ? "Precision cannot be more than " + G : !0;
|
|
330
330
|
}
|
|
331
331
|
const $ = T(
|
|
332
332
|
() => {
|
|
333
|
-
var
|
|
334
|
-
return (
|
|
333
|
+
var x, F;
|
|
334
|
+
return (x = y.sku.convert) != null && x.measurement ? (F = y.sku.unit.measurements.find((G) => {
|
|
335
335
|
var H;
|
|
336
336
|
return G.id === ((H = y.sku.convert) == null ? void 0 : H.measurement);
|
|
337
337
|
})) == null ? void 0 : F.abbrev : y.sku.unit.abbrev;
|
|
@@ -355,7 +355,7 @@ const bo = { class: "flex items-center" }, go = { class: "fm-typo-en-title-md-80
|
|
|
355
355
|
Ee(+C.value, v)
|
|
356
356
|
),
|
|
357
357
|
!1
|
|
358
|
-
) : "0",
|
|
358
|
+
) : "0", S = (te = (W = l.value) == null ? void 0 : W.find((le) => le.id === (c == null ? void 0 : c._id))) == null ? void 0 : te.amount, P = S ? he(S, !1) : null;
|
|
359
359
|
return {
|
|
360
360
|
sku: c,
|
|
361
361
|
convertAmount: P ?? i,
|
|
@@ -365,26 +365,26 @@ const bo = { class: "flex items-center" }, go = { class: "fm-typo-en-title-md-80
|
|
|
365
365
|
}), N = Y();
|
|
366
366
|
u({
|
|
367
367
|
validateInputs: () => {
|
|
368
|
-
var
|
|
369
|
-
(F = (
|
|
368
|
+
var x, F;
|
|
369
|
+
(F = (x = N.value) == null ? void 0 : x.validateInputs) == null || F.call(x);
|
|
370
370
|
},
|
|
371
371
|
resetInputsValidation: () => {
|
|
372
|
-
var
|
|
373
|
-
(F = (
|
|
372
|
+
var x, F;
|
|
373
|
+
(F = (x = N.value) == null ? void 0 : x.resetInputsValidation) == null || F.call(x);
|
|
374
374
|
},
|
|
375
375
|
resetInputs: () => {
|
|
376
|
-
var
|
|
377
|
-
(F = (
|
|
376
|
+
var x, F;
|
|
377
|
+
(F = (x = N.value) == null ? void 0 : x.resetInputs) == null || F.call(x);
|
|
378
378
|
}
|
|
379
379
|
});
|
|
380
380
|
const O = Ye(y, "show");
|
|
381
|
-
async function L(
|
|
382
|
-
|
|
381
|
+
async function L(x, F, G) {
|
|
382
|
+
b.value = !0;
|
|
383
383
|
try {
|
|
384
384
|
await r.convertSku({
|
|
385
385
|
conversions: [
|
|
386
386
|
{
|
|
387
|
-
doc:
|
|
387
|
+
doc: x,
|
|
388
388
|
amount: F,
|
|
389
389
|
overrides: G == null ? void 0 : G.map((H) => ({
|
|
390
390
|
...H,
|
|
@@ -396,67 +396,67 @@ const bo = { class: "flex items-center" }, go = { class: "fm-typo-en-title-md-80
|
|
|
396
396
|
}))
|
|
397
397
|
}
|
|
398
398
|
]
|
|
399
|
-
}),
|
|
399
|
+
}), w("update:show", !1), w("submitted");
|
|
400
400
|
} catch (H) {
|
|
401
|
-
|
|
401
|
+
g.open({
|
|
402
402
|
title: "Something went wrong",
|
|
403
|
-
message: `Cannot convert ${
|
|
403
|
+
message: `Cannot convert ${x.name}. Please try again.`,
|
|
404
404
|
type: "error"
|
|
405
|
-
}), console.error("error at converting stock amount",
|
|
405
|
+
}), console.error("error at converting stock amount", x, F, H);
|
|
406
406
|
} finally {
|
|
407
|
-
|
|
407
|
+
b.value = !1;
|
|
408
408
|
}
|
|
409
409
|
}
|
|
410
|
-
function X(
|
|
410
|
+
function X(x, F, G) {
|
|
411
411
|
const H = +F;
|
|
412
412
|
let J = G;
|
|
413
|
-
F.length > 0 && isFinite(H) ? J = G.map((I) => (I.id !==
|
|
413
|
+
F.length > 0 && isFinite(H) ? J = G.map((I) => (I.id !== x || (I.amount = xe(H)), I)) : J = G.map((I) => (I.id !== x || (I.amount = { amount: 0, precision: 0 }), I)), l.value = J;
|
|
414
414
|
}
|
|
415
|
-
function z(
|
|
416
|
-
const F = a.value.find((G) => G._id ===
|
|
415
|
+
function z(x) {
|
|
416
|
+
const F = a.value.find((G) => G._id === x);
|
|
417
417
|
return F ? bt(F.unit, !0) : [];
|
|
418
418
|
}
|
|
419
|
-
function K(
|
|
420
|
-
const G = z(
|
|
419
|
+
function K(x, F) {
|
|
420
|
+
const G = z(x), H = G.find((J) => J.value === F) ?? G.find((J) => J.value === null);
|
|
421
421
|
return H ? {
|
|
422
422
|
...H,
|
|
423
423
|
label: H.abbrev
|
|
424
424
|
} : null;
|
|
425
425
|
}
|
|
426
|
-
function U(
|
|
426
|
+
function U(x, F, G) {
|
|
427
427
|
let H;
|
|
428
428
|
if (F === null)
|
|
429
|
-
H = G.map((J) => (J.id !==
|
|
429
|
+
H = G.map((J) => (J.id !== x || (J.measurement = null), J)) ?? [];
|
|
430
430
|
else {
|
|
431
|
-
const J = a.value.find((I) => I._id ===
|
|
431
|
+
const J = a.value.find((I) => I._id === x);
|
|
432
432
|
H = G.map((I) => {
|
|
433
433
|
var c, h;
|
|
434
|
-
return I.id !==
|
|
434
|
+
return I.id !== x || (I.measurement = (h = (c = J == null ? void 0 : J.unit) == null ? void 0 : c.measurements) == null ? void 0 : h.find((f) => f.id === F)), I;
|
|
435
435
|
}) ?? [];
|
|
436
436
|
}
|
|
437
437
|
l.value = H;
|
|
438
438
|
}
|
|
439
|
-
function Z(
|
|
440
|
-
const G = F.filter((H) => H.id !==
|
|
439
|
+
function Z(x, F) {
|
|
440
|
+
const G = F.filter((H) => H.id !== x);
|
|
441
441
|
l.value = G;
|
|
442
442
|
}
|
|
443
443
|
function re() {
|
|
444
|
-
const
|
|
444
|
+
const x = (l.value ?? []).map((F) => ({
|
|
445
445
|
...F,
|
|
446
446
|
type: rt.enum.SKU
|
|
447
447
|
}));
|
|
448
448
|
j.promptIngredientsBinding(
|
|
449
|
-
|
|
449
|
+
x,
|
|
450
450
|
(F) => l.value = F,
|
|
451
451
|
y.sku._id
|
|
452
452
|
);
|
|
453
453
|
}
|
|
454
454
|
return Fe(
|
|
455
455
|
() => y.show,
|
|
456
|
-
(
|
|
457
|
-
|
|
456
|
+
(x) => {
|
|
457
|
+
x || (l.value = null, C.value = 0);
|
|
458
458
|
}
|
|
459
|
-
), (
|
|
459
|
+
), (x, F) => {
|
|
460
460
|
const G = B("FmTextField"), H = B("FmForm"), J = B("FmCard"), I = B("FmSwitch"), c = B("FmFormGroup"), h = B("FmSelect"), f = B("FmButton"), v = B("FmSideSheet");
|
|
461
461
|
return V(), ne(v, {
|
|
462
462
|
"dismiss-away": "",
|
|
@@ -466,7 +466,7 @@ const bo = { class: "flex items-center" }, go = { class: "fm-typo-en-title-md-80
|
|
|
466
466
|
}, {
|
|
467
467
|
"side-sheet-header": M(() => [
|
|
468
468
|
e("div", bo, [
|
|
469
|
-
e("div", go, p(s(R)("inventory.stock.convert.title", { name:
|
|
469
|
+
e("div", go, p(s(R)("inventory.stock.convert.title", { name: x.sku.name })), 1)
|
|
470
470
|
])
|
|
471
471
|
]),
|
|
472
472
|
default: M(() => [
|
|
@@ -478,13 +478,13 @@ const bo = { class: "flex items-center" }, go = { class: "fm-typo-en-title-md-80
|
|
|
478
478
|
}, {
|
|
479
479
|
default: M(() => [
|
|
480
480
|
_(G, {
|
|
481
|
-
disabled:
|
|
481
|
+
disabled: b.value,
|
|
482
482
|
"model-value": C.value,
|
|
483
483
|
"onUpdate:modelValue": F[0] || (F[0] = (i) => C.value = i),
|
|
484
484
|
label: s(R)("inventory.stock.convert.amount"),
|
|
485
485
|
rules: [t, n, s(Ue)(0)],
|
|
486
486
|
"append-text": $.value,
|
|
487
|
-
"helper-text": l.value ? void 0 : `Max ${
|
|
487
|
+
"helper-text": l.value ? void 0 : `Max ${x.maxCount} ${$.value}`
|
|
488
488
|
}, null, 8, ["disabled", "model-value", "label", "rules", "append-text", "helper-text"])
|
|
489
489
|
]),
|
|
490
490
|
_: 1
|
|
@@ -497,9 +497,9 @@ const bo = { class: "flex items-center" }, go = { class: "fm-typo-en-title-md-80
|
|
|
497
497
|
e("div", So, [
|
|
498
498
|
e("div", wo, p(s(R)("inventory.stock.convert.deductionSummary")), 1),
|
|
499
499
|
(V(!0), q(ue, null, fe(E.value, (i) => {
|
|
500
|
-
var
|
|
500
|
+
var S, P;
|
|
501
501
|
return V(), q("div", {
|
|
502
|
-
key: (
|
|
502
|
+
key: (S = i.sku) == null ? void 0 : S._id,
|
|
503
503
|
class: "flex items-center"
|
|
504
504
|
}, [
|
|
505
505
|
e("div", Ao, p((P = i.sku) == null ? void 0 : P.name), 1),
|
|
@@ -529,43 +529,43 @@ const bo = { class: "flex items-center" }, go = { class: "fm-typo-en-title-md-80
|
|
|
529
529
|
e("div", Vo, p(s(R)("inventory.stock.convert.ingredients")), 1),
|
|
530
530
|
(V(!0), q(ue, null, fe(l.value, (i) => (V(), ne(c, {
|
|
531
531
|
key: i.id,
|
|
532
|
-
disabled:
|
|
532
|
+
disabled: b.value,
|
|
533
533
|
modelValue: +s(he)(i.amount ?? { amount: 1, precision: 0 }),
|
|
534
534
|
rules: [
|
|
535
535
|
s(qt)(
|
|
536
|
-
a.value.find((
|
|
536
|
+
a.value.find((S) => S._id === i.id).unit,
|
|
537
537
|
i.measurement
|
|
538
538
|
),
|
|
539
539
|
s(Ue)(0)
|
|
540
540
|
]
|
|
541
541
|
}, {
|
|
542
|
-
default: M(({ invalid:
|
|
542
|
+
default: M(({ invalid: S }) => {
|
|
543
543
|
var P, ee, ae;
|
|
544
544
|
return [
|
|
545
545
|
e("div", Co, [
|
|
546
546
|
e("div", Do, p((P = a.value.find((Q) => Q._id === i.id)) == null ? void 0 : P.name), 1),
|
|
547
547
|
_(G, {
|
|
548
548
|
class: "xs:col-span-2",
|
|
549
|
-
disabled:
|
|
549
|
+
disabled: b.value,
|
|
550
550
|
modelValue: +s(he)(
|
|
551
551
|
i.amount ?? { amount: 1, precision: 0 }
|
|
552
552
|
),
|
|
553
553
|
"onUpdate:modelValue": (Q) => X(i.id, Q, l.value ?? []),
|
|
554
|
-
invalid:
|
|
554
|
+
invalid: S
|
|
555
555
|
}, null, 8, ["disabled", "modelValue", "onUpdate:modelValue", "invalid"]),
|
|
556
556
|
_(h, {
|
|
557
|
-
disabled:
|
|
557
|
+
disabled: b.value,
|
|
558
558
|
class: "translate-y-[2px]",
|
|
559
559
|
items: z(i.id),
|
|
560
560
|
"model-value": (ae = K(i.id, (ee = i.measurement) == null ? void 0 : ee.id)) == null ? void 0 : ae.value,
|
|
561
561
|
"onUpdate:modelValue": (Q) => U(i.id, Q, l.value ?? []),
|
|
562
|
-
invalid:
|
|
562
|
+
invalid: S
|
|
563
563
|
}, {
|
|
564
564
|
"helper-text": M(() => F[4] || (F[4] = [])),
|
|
565
565
|
_: 2
|
|
566
566
|
}, 1032, ["disabled", "items", "model-value", "onUpdate:modelValue", "invalid"]),
|
|
567
567
|
_(f, {
|
|
568
|
-
disabled:
|
|
568
|
+
disabled: b.value,
|
|
569
569
|
type: "button",
|
|
570
570
|
variant: "tertiary",
|
|
571
571
|
icon: "delete",
|
|
@@ -595,11 +595,11 @@ const bo = { class: "flex items-center" }, go = { class: "fm-typo-en-title-md-80
|
|
|
595
595
|
"side-sheet-footer": M(() => [
|
|
596
596
|
e("div", Bo, [
|
|
597
597
|
_(f, {
|
|
598
|
-
loading:
|
|
598
|
+
loading: b.value,
|
|
599
599
|
label: s(R)("inventory.stock.convert.convertButton"),
|
|
600
600
|
onClick: F[2] || (F[2] = (i) => {
|
|
601
|
-
var
|
|
602
|
-
return (P = (
|
|
601
|
+
var S, P;
|
|
602
|
+
return (P = (S = N.value) == null ? void 0 : S.validateInputs) == null ? void 0 : P.call(S);
|
|
603
603
|
})
|
|
604
604
|
}, null, 8, ["loading", "label"])
|
|
605
605
|
])
|
|
@@ -653,12 +653,12 @@ const We = {
|
|
|
653
653
|
},
|
|
654
654
|
emits: ["update:modelValue", "click:delete"],
|
|
655
655
|
setup(A, { emit: u }) {
|
|
656
|
-
const k = A, y = u, { t:
|
|
656
|
+
const k = A, y = u, { t: w } = pe(), j = Oe(), d = T(
|
|
657
657
|
() => Object.keys(We).map((t) => ({
|
|
658
658
|
label: Ht(t),
|
|
659
659
|
value: t
|
|
660
660
|
}))
|
|
661
|
-
), r = T(() => bt(k.modelValue.doc.unit, !0)),
|
|
661
|
+
), r = T(() => bt(k.modelValue.doc.unit, !0)), g = T({
|
|
662
662
|
get() {
|
|
663
663
|
return k.modelValue.type ?? ie.enum.PURCHASE;
|
|
664
664
|
},
|
|
@@ -682,7 +682,7 @@ const We = {
|
|
|
682
682
|
const n = {
|
|
683
683
|
...k.modelValue
|
|
684
684
|
}, $ = xe(t);
|
|
685
|
-
n.amount = We[
|
|
685
|
+
n.amount = We[g.value].toAdjustmentAmount(
|
|
686
686
|
t,
|
|
687
687
|
$.precision
|
|
688
688
|
), y("update:modelValue", n);
|
|
@@ -718,7 +718,7 @@ const We = {
|
|
|
718
718
|
return n ? xt(t, n.conversion) : t;
|
|
719
719
|
}), m = T(
|
|
720
720
|
() => k.isBackdate ? a.value : Qe(a.value, D.value)
|
|
721
|
-
),
|
|
721
|
+
), b = T(
|
|
722
722
|
() => Zt(m.value, k.modelValue.doc.unit)
|
|
723
723
|
), o = T(
|
|
724
724
|
() => !k.isBackdate && D.value.amount < 0
|
|
@@ -746,8 +746,8 @@ const We = {
|
|
|
746
746
|
class: "col-span-2",
|
|
747
747
|
label: "Type",
|
|
748
748
|
items: d.value,
|
|
749
|
-
modelValue:
|
|
750
|
-
"onUpdate:modelValue": n[1] || (n[1] = (L) =>
|
|
749
|
+
modelValue: g.value,
|
|
750
|
+
"onUpdate:modelValue": n[1] || (n[1] = (L) => g.value = L),
|
|
751
751
|
rules: [s(Xt)()],
|
|
752
752
|
"label-mark": "required"
|
|
753
753
|
}, null, 8, ["disabled", "items", "modelValue", "rules"]),
|
|
@@ -778,11 +778,11 @@ const We = {
|
|
|
778
778
|
"label-mark": "optional"
|
|
779
779
|
}, null, 8, ["disabled", "modelValue"]),
|
|
780
780
|
e("div", Uo, [
|
|
781
|
-
e("div", Po, p(s(
|
|
781
|
+
e("div", Po, p(s(w)("inventory.stock.stock_adjustment.stockAfter")), 1),
|
|
782
782
|
e("div", {
|
|
783
783
|
class: He(["fm-typo-en-body-lg-600", o.value ? "text-red-700" : "text-green-700"])
|
|
784
|
-
}, p(
|
|
785
|
-
t.isBackdate ? (V(), q("div", Ro, p(s(
|
|
784
|
+
}, p(b.value), 3),
|
|
785
|
+
t.isBackdate ? (V(), q("div", Ro, p(s(w)("inventory.stock.stock_adjustment.backdatePreviewWarning")), 1)) : se("", !0)
|
|
786
786
|
])
|
|
787
787
|
]),
|
|
788
788
|
_: 1
|
|
@@ -797,9 +797,9 @@ const We = {
|
|
|
797
797
|
},
|
|
798
798
|
emits: ["update:show", "submitted"],
|
|
799
799
|
setup(A, { expose: u, emit: k }) {
|
|
800
|
-
const y = A,
|
|
800
|
+
const y = A, w = k, j = Ne(), d = Le(), r = Ae(), g = we(), R = Y(!1), { t: C } = pe();
|
|
801
801
|
function l() {
|
|
802
|
-
|
|
802
|
+
b(Re(m));
|
|
803
803
|
}
|
|
804
804
|
const a = Y();
|
|
805
805
|
u({
|
|
@@ -841,7 +841,7 @@ const We = {
|
|
|
841
841
|
}
|
|
842
842
|
]);
|
|
843
843
|
});
|
|
844
|
-
async function
|
|
844
|
+
async function b(n) {
|
|
845
845
|
R.value = !0;
|
|
846
846
|
try {
|
|
847
847
|
await r.adjustSku({
|
|
@@ -854,9 +854,9 @@ const We = {
|
|
|
854
854
|
doc: $,
|
|
855
855
|
type: N
|
|
856
856
|
}))
|
|
857
|
-
}),
|
|
857
|
+
}), w("update:show", !1), w("submitted");
|
|
858
858
|
} catch ($) {
|
|
859
|
-
|
|
859
|
+
g.open({
|
|
860
860
|
title: C("inventory.stock.adjust.error.title"),
|
|
861
861
|
message: C("inventory.stock.adjust.error.message"),
|
|
862
862
|
type: "error"
|
|
@@ -977,11 +977,11 @@ const We = {
|
|
|
977
977
|
},
|
|
978
978
|
emits: ["update:show", "submitted"],
|
|
979
979
|
setup(A, { emit: u }) {
|
|
980
|
-
const k = A, y = u, { t:
|
|
980
|
+
const k = A, y = u, { t: w } = pe(), j = Ne(), d = Ae(), r = Le(), g = we(), R = Ye(k, "show"), C = Y(!1), l = _t({
|
|
981
981
|
remark: "",
|
|
982
982
|
effectiveAt: /* @__PURE__ */ new Date(),
|
|
983
983
|
adjustments: []
|
|
984
|
-
}), a = Y(!1), D = Y(ke().format("YYYY-MM-DD")), m = Y(ke().format("HH:mm")),
|
|
984
|
+
}), a = Y(!1), D = Y(ke().format("YYYY-MM-DD")), m = Y(ke().format("HH:mm")), b = Y();
|
|
985
985
|
Fe([D, m], () => {
|
|
986
986
|
if (D.value && m.value) {
|
|
987
987
|
const K = ke(`${D.value} ${m.value}`, "YYYY-MM-DD HH:mm");
|
|
@@ -992,12 +992,12 @@ const We = {
|
|
|
992
992
|
function t() {
|
|
993
993
|
if (!a.value) return !0;
|
|
994
994
|
const K = ke(`${D.value} ${m.value}`, "YYYY-MM-DD HH:mm");
|
|
995
|
-
if (!K.isValid()) return
|
|
995
|
+
if (!K.isValid()) return w("inventory.stock.stock_adjustment.invalidDateTime");
|
|
996
996
|
const U = ke();
|
|
997
997
|
if (K.isAfter(U))
|
|
998
|
-
return
|
|
998
|
+
return w("inventory.stock.stock_adjustment.futureDateNotAllowed");
|
|
999
999
|
const Z = U.subtract(yt, "day");
|
|
1000
|
-
return K.isBefore(Z) ?
|
|
1000
|
+
return K.isBefore(Z) ? w("inventory.stock.stock_adjustment.backdateLimitError", { days: yt }) : !0;
|
|
1001
1001
|
}
|
|
1002
1002
|
const n = T(() => [() => t()]), $ = T(() => l.adjustments.length === 0 || t() !== !0);
|
|
1003
1003
|
function E() {
|
|
@@ -1019,7 +1019,7 @@ const We = {
|
|
|
1019
1019
|
value: Z._id
|
|
1020
1020
|
})), U = l.adjustments.map((Z) => Z.doc._id);
|
|
1021
1021
|
r.open({
|
|
1022
|
-
title:
|
|
1022
|
+
title: w("inventory.stock.adjust.selectIngredients"),
|
|
1023
1023
|
contentComponent: St,
|
|
1024
1024
|
contentComponentProps: {
|
|
1025
1025
|
items: K,
|
|
@@ -1030,17 +1030,17 @@ const We = {
|
|
|
1030
1030
|
closeButton: !0,
|
|
1031
1031
|
dismissAway: !0,
|
|
1032
1032
|
primaryActions: {
|
|
1033
|
-
text:
|
|
1033
|
+
text: w("common.confirm"),
|
|
1034
1034
|
close: !0
|
|
1035
1035
|
},
|
|
1036
1036
|
secondaryActions: {
|
|
1037
|
-
text:
|
|
1037
|
+
text: w("common.close"),
|
|
1038
1038
|
close: !0,
|
|
1039
1039
|
variant: "tertiary"
|
|
1040
1040
|
}
|
|
1041
1041
|
}).onPrimary((Z) => {
|
|
1042
1042
|
l.adjustments = Z.map(
|
|
1043
|
-
(re) => l.adjustments.find((
|
|
1043
|
+
(re) => l.adjustments.find((x) => x.doc._id === re) ?? {
|
|
1044
1044
|
id: "",
|
|
1045
1045
|
type: ie.enum.PURCHASE,
|
|
1046
1046
|
doc: O.value[re],
|
|
@@ -1056,9 +1056,9 @@ const We = {
|
|
|
1056
1056
|
}
|
|
1057
1057
|
async function z() {
|
|
1058
1058
|
if (l.adjustments.length === 0) {
|
|
1059
|
-
|
|
1060
|
-
title:
|
|
1061
|
-
message:
|
|
1059
|
+
g.open({
|
|
1060
|
+
title: w("inventory.stock.error.title"),
|
|
1061
|
+
message: w("inventory.stock.stock_adjustment.noAdjustments"),
|
|
1062
1062
|
type: "warning"
|
|
1063
1063
|
});
|
|
1064
1064
|
return;
|
|
@@ -1066,13 +1066,13 @@ const We = {
|
|
|
1066
1066
|
C.value = !0;
|
|
1067
1067
|
try {
|
|
1068
1068
|
const K = l.adjustments.map(
|
|
1069
|
-
({ doc: Z, remark: re, type:
|
|
1069
|
+
({ doc: Z, remark: re, type: x, amount: F, measurement: G }) => ({
|
|
1070
1070
|
id: Z._id,
|
|
1071
1071
|
amount: F,
|
|
1072
1072
|
measurement: G,
|
|
1073
1073
|
remark: re,
|
|
1074
1074
|
doc: Z,
|
|
1075
|
-
type:
|
|
1075
|
+
type: x
|
|
1076
1076
|
})
|
|
1077
1077
|
), U = {
|
|
1078
1078
|
remark: l.remark,
|
|
@@ -1081,9 +1081,9 @@ const We = {
|
|
|
1081
1081
|
};
|
|
1082
1082
|
await d.adjustSku(Re(U)), y("submitted"), y("update:show", !1);
|
|
1083
1083
|
} catch (K) {
|
|
1084
|
-
|
|
1085
|
-
title:
|
|
1086
|
-
message:
|
|
1084
|
+
g.open({
|
|
1085
|
+
title: w("inventory.stock.adjust.error.title"),
|
|
1086
|
+
message: w("inventory.stock.adjust.error.message"),
|
|
1087
1087
|
type: "error"
|
|
1088
1088
|
}), console.error("error on stock adjustment", K);
|
|
1089
1089
|
} finally {
|
|
@@ -1091,7 +1091,7 @@ const We = {
|
|
|
1091
1091
|
}
|
|
1092
1092
|
}
|
|
1093
1093
|
return (K, U) => {
|
|
1094
|
-
const Z = B("FmTextarea"), re = B("FmSwitch"),
|
|
1094
|
+
const Z = B("FmTextarea"), re = B("FmSwitch"), x = B("FmDatePicker"), F = B("FmTimePicker"), G = B("FmFormGroup"), H = B("FmButton"), J = B("FmForm"), I = B("FmSideSheet");
|
|
1095
1095
|
return V(), ne(I, {
|
|
1096
1096
|
modelValue: s(R),
|
|
1097
1097
|
"onUpdate:modelValue": U[6] || (U[6] = (c) => Pe(R) ? R.value = c : null),
|
|
@@ -1101,19 +1101,19 @@ const We = {
|
|
|
1101
1101
|
}, {
|
|
1102
1102
|
"side-sheet-header": M(() => [
|
|
1103
1103
|
e("div", Wo, [
|
|
1104
|
-
e("div", Ko, p(s(
|
|
1104
|
+
e("div", Ko, p(s(w)("inventory.stock.stock_adjustment.title")), 1)
|
|
1105
1105
|
])
|
|
1106
1106
|
]),
|
|
1107
1107
|
default: M(() => [
|
|
1108
1108
|
_(J, {
|
|
1109
1109
|
class: "flex flex-col gap-16",
|
|
1110
1110
|
ref_key: "formRef",
|
|
1111
|
-
ref:
|
|
1111
|
+
ref: b,
|
|
1112
1112
|
onValidationSuccess: z
|
|
1113
1113
|
}, {
|
|
1114
1114
|
default: M(() => [
|
|
1115
1115
|
_(Z, {
|
|
1116
|
-
label: s(
|
|
1116
|
+
label: s(w)("inventory.stock.adjust.remark"),
|
|
1117
1117
|
modelValue: l.remark,
|
|
1118
1118
|
"onUpdate:modelValue": U[0] || (U[0] = (c) => l.remark = c),
|
|
1119
1119
|
"label-mark": "optional"
|
|
@@ -1122,15 +1122,15 @@ const We = {
|
|
|
1122
1122
|
value: "",
|
|
1123
1123
|
"model-value": a.value,
|
|
1124
1124
|
"onUpdate:modelValue": U[1] || (U[1] = (c) => a.value = c),
|
|
1125
|
-
label: s(
|
|
1126
|
-
sublabel: s(
|
|
1125
|
+
label: s(w)("inventory.stock.stock_adjustment.backdateLabel"),
|
|
1126
|
+
sublabel: s(w)("inventory.stock.stock_adjustment.backdateSublabel"),
|
|
1127
1127
|
labelPlacement: "right"
|
|
1128
1128
|
}, null, 8, ["model-value", "label", "sublabel"]),
|
|
1129
1129
|
a.value ? (V(), q("div", qo, [
|
|
1130
|
-
e("label", Xo, p(s(
|
|
1130
|
+
e("label", Xo, p(s(w)("inventory.stock.stock_adjustment.effectiveAt")), 1),
|
|
1131
1131
|
e("div", Jo, [
|
|
1132
1132
|
e("div", Qo, [
|
|
1133
|
-
_(
|
|
1133
|
+
_(x, {
|
|
1134
1134
|
class: "w-full",
|
|
1135
1135
|
modelValue: D.value,
|
|
1136
1136
|
"onUpdate:modelValue": U[2] || (U[2] = (c) => D.value = c),
|
|
@@ -1150,10 +1150,10 @@ const We = {
|
|
|
1150
1150
|
"model-value": o.value,
|
|
1151
1151
|
rules: n.value
|
|
1152
1152
|
}, null, 8, ["model-value", "rules"]),
|
|
1153
|
-
e("div", en, p(s(
|
|
1153
|
+
e("div", en, p(s(w)("inventory.stock.stock_adjustment.immediateHint")), 1)
|
|
1154
1154
|
])) : se("", !0),
|
|
1155
1155
|
e("div", tn, [
|
|
1156
|
-
e("div", on, p(s(
|
|
1156
|
+
e("div", on, p(s(w)("inventory.stock.adjust.adjustedItems")), 1),
|
|
1157
1157
|
_(H, {
|
|
1158
1158
|
"prepend-icon": "add",
|
|
1159
1159
|
variant: "tertiary",
|
|
@@ -1175,16 +1175,16 @@ const We = {
|
|
|
1175
1175
|
"side-sheet-footer": M(() => [
|
|
1176
1176
|
e("div", nn, [
|
|
1177
1177
|
_(H, {
|
|
1178
|
-
label: s(
|
|
1178
|
+
label: s(w)("common.confirm"),
|
|
1179
1179
|
loading: C.value,
|
|
1180
1180
|
disabled: $.value,
|
|
1181
1181
|
onClick: U[4] || (U[4] = (c) => {
|
|
1182
1182
|
var h, f;
|
|
1183
|
-
return (f = (h =
|
|
1183
|
+
return (f = (h = b.value) == null ? void 0 : h.validateInputs) == null ? void 0 : f.call(h);
|
|
1184
1184
|
})
|
|
1185
1185
|
}, null, 8, ["label", "loading", "disabled"]),
|
|
1186
1186
|
_(H, {
|
|
1187
|
-
label: s(
|
|
1187
|
+
label: s(w)("common.close"),
|
|
1188
1188
|
variant: "tertiary",
|
|
1189
1189
|
onClick: U[5] || (U[5] = (c) => y("update:show", !1))
|
|
1190
1190
|
}, null, 8, ["label"])
|
|
@@ -1196,17 +1196,17 @@ const We = {
|
|
|
1196
1196
|
}
|
|
1197
1197
|
}), an = Tt((A, u) => ({
|
|
1198
1198
|
// TODO: remove once latest inventory backend has been push
|
|
1199
|
-
async findBillsByBusinessId(k, y,
|
|
1199
|
+
async findBillsByBusinessId(k, y, w) {
|
|
1200
1200
|
const j = `${A.businessesBackendUrl}/${k}/reports/find-many`, d = {
|
|
1201
1201
|
// type: TYPE.bill,
|
|
1202
1202
|
type: "bill",
|
|
1203
1203
|
restaurantIds: y,
|
|
1204
|
-
ids:
|
|
1204
|
+
ids: w
|
|
1205
1205
|
};
|
|
1206
1206
|
return await u.post(j, d);
|
|
1207
1207
|
},
|
|
1208
1208
|
async findBillsById(k) {
|
|
1209
|
-
const
|
|
1209
|
+
const w = Se().currentLocationDBName, j = `${A.inventoryBackendUrl}/${w}/bill/search`, d = {
|
|
1210
1210
|
ids: k
|
|
1211
1211
|
};
|
|
1212
1212
|
return await u.post(j, d);
|
|
@@ -1224,13 +1224,13 @@ const We = {
|
|
|
1224
1224
|
}),
|
|
1225
1225
|
emits: /* @__PURE__ */ nt(["refreshHistory"], ["update:modelValue"]),
|
|
1226
1226
|
setup(A, { emit: u }) {
|
|
1227
|
-
const k = A, y = u,
|
|
1227
|
+
const k = A, y = u, w = Ae(), j = jt(A, "modelValue"), d = Y(!1), r = Y(!1), g = Y(!1), R = Y({
|
|
1228
1228
|
_id: `inventoryAdjustment_${(/* @__PURE__ */ new Date()).toISOString()}_XXXXX`,
|
|
1229
1229
|
skus: []
|
|
1230
1230
|
}), C = Y();
|
|
1231
1231
|
qe(async () => {
|
|
1232
1232
|
d.value = !0;
|
|
1233
|
-
const o = await
|
|
1233
|
+
const o = await w.readSingleAdjustment(k.adjustmentId);
|
|
1234
1234
|
if (!o) throw new Error("Adjustment not found");
|
|
1235
1235
|
R.value = o, d.value = !1;
|
|
1236
1236
|
});
|
|
@@ -1245,10 +1245,10 @@ const We = {
|
|
|
1245
1245
|
const O = (X = (L = j.value) == null ? void 0 : L[$]) == null ? void 0 : X[Number(N)];
|
|
1246
1246
|
O && D(O.amount) > 0 && (o[$] || (o[$] = []), o[$].push(O));
|
|
1247
1247
|
});
|
|
1248
|
-
}), await
|
|
1248
|
+
}), await w.revertWastageAdjustment({
|
|
1249
1249
|
targetWastageAdjustmentId: k.adjustmentId,
|
|
1250
1250
|
amountsGoingToAdjust: o
|
|
1251
|
-
}), y("refreshHistory"),
|
|
1251
|
+
}), y("refreshHistory"), g.value = !1, j.value = {};
|
|
1252
1252
|
}
|
|
1253
1253
|
function a(o) {
|
|
1254
1254
|
const { skuId: t, idx: n, unit: $, measurement: E } = o;
|
|
@@ -1279,7 +1279,7 @@ const We = {
|
|
|
1279
1279
|
function m(o, t) {
|
|
1280
1280
|
return t.measurement ? t.measurement.abbrev : o.sku.unit.abbrev;
|
|
1281
1281
|
}
|
|
1282
|
-
function
|
|
1282
|
+
function b(o, t) {
|
|
1283
1283
|
if (t.amount === 0) return "N/A";
|
|
1284
1284
|
const n = _e.add([o, t]);
|
|
1285
1285
|
return n ? _e.toFormatString({ value: n }) : "N/A";
|
|
@@ -1287,15 +1287,15 @@ const We = {
|
|
|
1287
1287
|
return (o, t) => {
|
|
1288
1288
|
const n = B("FmIcon"), $ = B("FmStepperField"), E = B("FmCard"), N = B("FmForm"), O = B("FmSpacer"), L = B("FmButton"), X = B("FmDialog");
|
|
1289
1289
|
return V(), ne(X, {
|
|
1290
|
-
modelValue:
|
|
1291
|
-
"onUpdate:modelValue": t[4] || (t[4] = (z) =>
|
|
1290
|
+
modelValue: g.value,
|
|
1291
|
+
"onUpdate:modelValue": t[4] || (t[4] = (z) => g.value = z),
|
|
1292
1292
|
overlay: !0
|
|
1293
1293
|
}, {
|
|
1294
1294
|
"dialog-button": M(() => [
|
|
1295
1295
|
_(Je, null, {
|
|
1296
1296
|
default: M(() => [
|
|
1297
1297
|
e("button", {
|
|
1298
|
-
onClick: t[0] || (t[0] = (z) =>
|
|
1298
|
+
onClick: t[0] || (t[0] = (z) => g.value = !0),
|
|
1299
1299
|
class: "rounded-md hover:bg-gray-100 transition-colors"
|
|
1300
1300
|
}, [
|
|
1301
1301
|
_(n, {
|
|
@@ -1320,7 +1320,7 @@ const We = {
|
|
|
1320
1320
|
label: "Close",
|
|
1321
1321
|
size: "md",
|
|
1322
1322
|
variant: "tertiary",
|
|
1323
|
-
onClick: t[3] || (t[3] = (z) =>
|
|
1323
|
+
onClick: t[3] || (t[3] = (z) => g.value = !1)
|
|
1324
1324
|
}),
|
|
1325
1325
|
_(L, {
|
|
1326
1326
|
class: "sm:w-full xs:w-full",
|
|
@@ -1396,7 +1396,7 @@ const We = {
|
|
|
1396
1396
|
e("div", vn, [
|
|
1397
1397
|
t[10] || (t[10] = e("span", { class: "fm-typo-en-body-lg-600" }, "Amount after amend:", -1)),
|
|
1398
1398
|
t[11] || (t[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)),
|
|
1399
|
-
ye(" " + p(
|
|
1399
|
+
ye(" " + p(b(
|
|
1400
1400
|
U.amount,
|
|
1401
1401
|
s(_e).fromNumber(
|
|
1402
1402
|
a({
|
|
@@ -1450,31 +1450,31 @@ const We = {
|
|
|
1450
1450
|
if (u.costMechanism === "adjustment")
|
|
1451
1451
|
return null;
|
|
1452
1452
|
const a = u.unitCostHistory.filter(
|
|
1453
|
-
(
|
|
1453
|
+
(b) => b.mechanism === u.costMechanism && b.skuId === u.sku._id
|
|
1454
1454
|
);
|
|
1455
1455
|
if (a.length === 0) return null;
|
|
1456
|
-
const D = a.find((
|
|
1457
|
-
const o =
|
|
1456
|
+
const D = a.find((b) => {
|
|
1457
|
+
const o = b.meta;
|
|
1458
1458
|
return (o == null ? void 0 : o.adjustmentId) === C;
|
|
1459
1459
|
});
|
|
1460
1460
|
if (D) return D.cost;
|
|
1461
|
-
const m = [...a].filter((
|
|
1461
|
+
const m = [...a].filter((b) => new Date(b.snapshotAt) <= new Date(l)).sort((b, o) => new Date(o.snapshotAt).getTime() - new Date(b.snapshotAt).getTime());
|
|
1462
1462
|
return m.length > 0 ? m[0].cost : null;
|
|
1463
1463
|
}
|
|
1464
|
-
const y = Y(!1),
|
|
1464
|
+
const y = Y(!1), w = Y(), j = Y(null), d = T(() => j.value === null ? "unset" : y.value ? `${j.value}px` : "0px");
|
|
1465
1465
|
qe(() => {
|
|
1466
1466
|
var C;
|
|
1467
|
-
j.value = ((C =
|
|
1467
|
+
j.value = ((C = w.value) == null ? void 0 : C.scrollHeight) || 0;
|
|
1468
1468
|
});
|
|
1469
1469
|
const r = T(() => {
|
|
1470
|
-
var
|
|
1470
|
+
var b;
|
|
1471
1471
|
const C = u.record.adjustments, l = u.sku, a = {}, m = C.flatMap((o) => {
|
|
1472
1472
|
var t;
|
|
1473
1473
|
return ((t = o.skus) == null ? void 0 : t.filter((n) => n.sku._id === l._id)) ?? [];
|
|
1474
1474
|
}).flatMap((o) => o.amounts);
|
|
1475
1475
|
for (const o of m) {
|
|
1476
1476
|
const t = o.measurement ? xt(o.measurement.conversion, o.amount) : o.amount;
|
|
1477
|
-
a[
|
|
1477
|
+
a[b = o.type] ?? (a[b] = { amount: 0, precision: 0 }), a[o.type] = Qe(t, a[o.type]);
|
|
1478
1478
|
}
|
|
1479
1479
|
return Object.entries(a).reduce(
|
|
1480
1480
|
(o, [t, n]) => (o[t] = /// comment, because without it formatter makes code uglier
|
|
@@ -1484,15 +1484,15 @@ const We = {
|
|
|
1484
1484
|
})} ${l.unit.abbrev}`, o),
|
|
1485
1485
|
{}
|
|
1486
1486
|
);
|
|
1487
|
-
}), { t:
|
|
1487
|
+
}), { t: g } = pe(), R = T(() => u.record.adjustmentsByTime.map(({ date: C, adjustments: l }) => ({
|
|
1488
1488
|
time: to(new Date(C)),
|
|
1489
1489
|
adjustments: l.flatMap(
|
|
1490
1490
|
(a) => {
|
|
1491
1491
|
var D, m;
|
|
1492
|
-
return ((m = (D = a.skus) == null ? void 0 : D.map) == null ? void 0 : m.call(D, (
|
|
1492
|
+
return ((m = (D = a.skus) == null ? void 0 : D.map) == null ? void 0 : m.call(D, (b) => {
|
|
1493
1493
|
var o, t;
|
|
1494
1494
|
return {
|
|
1495
|
-
...
|
|
1495
|
+
...b,
|
|
1496
1496
|
ref: a.ref,
|
|
1497
1497
|
reason: a.reason,
|
|
1498
1498
|
adjustmentRemark: a.remark,
|
|
@@ -1505,7 +1505,7 @@ const We = {
|
|
|
1505
1505
|
}
|
|
1506
1506
|
).flatMap((a) => {
|
|
1507
1507
|
var t;
|
|
1508
|
-
const D = (t = u.bills.find((n) => n._id === a.ref)) == null ? void 0 : t.seqNumber, m = D ?
|
|
1508
|
+
const D = (t = u.bills.find((n) => n._id === a.ref)) == null ? void 0 : t.seqNumber, m = D ? g("inventory.stock.record.bill", [D]) : "", b = a.adjustmentTime ?? (/* @__PURE__ */ new Date()).toISOString(), o = k(a.adjustmentId, b);
|
|
1509
1509
|
return (a.amounts || []).filter((n) => n != null).map((n) => {
|
|
1510
1510
|
var N;
|
|
1511
1511
|
let $ = n.cost;
|
|
@@ -1545,7 +1545,7 @@ const We = {
|
|
|
1545
1545
|
e("div", kn, [
|
|
1546
1546
|
e("div", {
|
|
1547
1547
|
class: "flex items-center cursor-pointer mb-1",
|
|
1548
|
-
onClick: l[0] || (l[0] = (
|
|
1548
|
+
onClick: l[0] || (l[0] = (b) => y.value = !y.value)
|
|
1549
1549
|
}, [
|
|
1550
1550
|
e("div", hn, p(C.record.date), 1),
|
|
1551
1551
|
_(a, {
|
|
@@ -1554,23 +1554,23 @@ const We = {
|
|
|
1554
1554
|
size: "md"
|
|
1555
1555
|
}, null, 8, ["name"])
|
|
1556
1556
|
]),
|
|
1557
|
-
(V(!0), q(ue, null, fe(r.value, (
|
|
1557
|
+
(V(!0), q(ue, null, fe(r.value, (b, o) => (V(), q("div", {
|
|
1558
1558
|
key: o,
|
|
1559
1559
|
class: "flex flex-row py-1",
|
|
1560
1560
|
style: { "font-size": "0.8rem" }
|
|
1561
1561
|
}, [
|
|
1562
|
-
e("div", bn, p(s(
|
|
1562
|
+
e("div", bn, p(s(g)(`inventory.inventoryAdjustment.type.${o}`)), 1),
|
|
1563
1563
|
e("div", {
|
|
1564
1564
|
class: He({
|
|
1565
|
-
"text-fm-color-typo-error":
|
|
1566
|
-
"text-fm-color-typo-success": !
|
|
1565
|
+
"text-fm-color-typo-error": b.startsWith("-"),
|
|
1566
|
+
"text-fm-color-typo-success": !b.startsWith("-"),
|
|
1567
1567
|
"ml-auto": !0
|
|
1568
1568
|
})
|
|
1569
|
-
}, p(
|
|
1569
|
+
}, p(b), 3)
|
|
1570
1570
|
]))), 128)),
|
|
1571
1571
|
e("div", {
|
|
1572
1572
|
ref_key: "detailRef",
|
|
1573
|
-
ref:
|
|
1573
|
+
ref: w,
|
|
1574
1574
|
style: kt({
|
|
1575
1575
|
fontSize: "0.8rem",
|
|
1576
1576
|
maxHeight: d.value,
|
|
@@ -1579,18 +1579,18 @@ const We = {
|
|
|
1579
1579
|
})
|
|
1580
1580
|
}, [
|
|
1581
1581
|
R.value.length ? (V(), q("hr", gn)) : se("", !0),
|
|
1582
|
-
(V(!0), q(ue, null, fe(R.value, (
|
|
1583
|
-
key:
|
|
1582
|
+
(V(!0), q(ue, null, fe(R.value, (b) => (V(), q("div", {
|
|
1583
|
+
key: b.time,
|
|
1584
1584
|
class: "flex gap-1 w-full"
|
|
1585
1585
|
}, [
|
|
1586
|
-
e("div", xn, p(
|
|
1586
|
+
e("div", xn, p(b.time), 1),
|
|
1587
1587
|
e("div", Sn, [
|
|
1588
|
-
(V(!0), q(ue, null, fe(
|
|
1588
|
+
(V(!0), q(ue, null, fe(b.adjustments, (o) => (V(), q("div", {
|
|
1589
1589
|
key: o.name,
|
|
1590
1590
|
class: "flex gap-1"
|
|
1591
1591
|
}, [
|
|
1592
1592
|
e("div", wn, [
|
|
1593
|
-
ye(p(s(
|
|
1593
|
+
ye(p(s(g)(`inventory.inventoryAdjustment.type.${o.name}`)) + " ", 1),
|
|
1594
1594
|
o.backdateFrom ? (V(), ne(D, {
|
|
1595
1595
|
key: 0,
|
|
1596
1596
|
variant: "plain",
|
|
@@ -1598,7 +1598,7 @@ const We = {
|
|
|
1598
1598
|
"z-index": 50
|
|
1599
1599
|
}, {
|
|
1600
1600
|
content: M(() => [
|
|
1601
|
-
e("div", An, p(s(
|
|
1601
|
+
e("div", An, p(s(g)("inventory.stock.record.backdate", [
|
|
1602
1602
|
s(wt)(new Date(o.backdateFrom))
|
|
1603
1603
|
])), 1)
|
|
1604
1604
|
]),
|
|
@@ -1652,19 +1652,19 @@ function Mn(A, u) {
|
|
|
1652
1652
|
(d, [r]) => (d[r] = oe.fromNumber(0), d),
|
|
1653
1653
|
{}
|
|
1654
1654
|
);
|
|
1655
|
-
const
|
|
1655
|
+
const w = A.flatMap((d) => {
|
|
1656
1656
|
var r;
|
|
1657
|
-
return ((r = d.skus) == null ? void 0 : r.filter((
|
|
1657
|
+
return ((r = d.skus) == null ? void 0 : r.filter((g) => g.sku._id === u._id)) ?? [];
|
|
1658
1658
|
}).flatMap((d) => d.amounts);
|
|
1659
|
-
for (const d of
|
|
1659
|
+
for (const d of w) {
|
|
1660
1660
|
const r = d.measurement ? oe.multiply([d.measurement.conversion, d.amount]) : d.amount;
|
|
1661
1661
|
k[j = d.type] ?? (k[j] = { amount: 0, precision: 0 }), k[d.type] = oe.add([r, k[d.type]]);
|
|
1662
1662
|
}
|
|
1663
1663
|
return Object.entries(k).reduce(
|
|
1664
|
-
(d, [r,
|
|
1664
|
+
(d, [r, g]) => {
|
|
1665
1665
|
const R = {
|
|
1666
|
-
...
|
|
1667
|
-
amount: Math.abs(
|
|
1666
|
+
...g,
|
|
1667
|
+
amount: Math.abs(g.amount)
|
|
1668
1668
|
};
|
|
1669
1669
|
return d[r] = /// comment, because without it formatter makes code uglier
|
|
1670
1670
|
`${oe.toFormatString({
|
|
@@ -1679,20 +1679,20 @@ function In(A, u) {
|
|
|
1679
1679
|
if (!u)
|
|
1680
1680
|
return null;
|
|
1681
1681
|
let k = null;
|
|
1682
|
-
const
|
|
1682
|
+
const w = A.flatMap((j) => {
|
|
1683
1683
|
var d;
|
|
1684
1684
|
return ((d = j.skus) == null ? void 0 : d.filter((r) => r.sku._id === u._id)) ?? [];
|
|
1685
1685
|
}).flatMap((j) => {
|
|
1686
1686
|
var d;
|
|
1687
1687
|
return !j.history || ((d = j.history) == null ? void 0 : d.length) === 0 ? [] : j.history[0];
|
|
1688
1688
|
});
|
|
1689
|
-
for (const j of
|
|
1689
|
+
for (const j of w) {
|
|
1690
1690
|
const d = j.amounts;
|
|
1691
1691
|
for (const r of d) {
|
|
1692
1692
|
if (r.type !== ie.Enum.SALES)
|
|
1693
1693
|
continue;
|
|
1694
|
-
const
|
|
1695
|
-
k ?? (k = oe.fromNumber(0)), k = oe.add([k,
|
|
1694
|
+
const g = r.measurement ? oe.multiply([r.measurement.conversion, r.amount]) : r.amount;
|
|
1695
|
+
k ?? (k = oe.fromNumber(0)), k = oe.add([k, g]);
|
|
1696
1696
|
}
|
|
1697
1697
|
}
|
|
1698
1698
|
return k != null ? (k.amount = Math.abs(k.amount), `${oe.toFormatString({
|
|
@@ -1723,10 +1723,10 @@ const Hn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Tn = {
|
|
|
1723
1723
|
},
|
|
1724
1724
|
emits: ["update:show"],
|
|
1725
1725
|
setup(A) {
|
|
1726
|
-
const u = Xe(), k = Oe(), y = Ae(),
|
|
1726
|
+
const u = Xe(), k = Oe(), y = Ae(), w = an(), j = Se(), d = io(), { t: r } = pe(), g = A, R = Y(!1), C = we(), l = Y("adjustment"), a = Y([
|
|
1727
1727
|
{ label: "Adjustment (Default)", value: "adjustment" }
|
|
1728
1728
|
]), D = Y([]), m = Y(ao(0));
|
|
1729
|
-
async function
|
|
1729
|
+
async function b() {
|
|
1730
1730
|
R.value = !0;
|
|
1731
1731
|
try {
|
|
1732
1732
|
await N(), await k.readStockBalance();
|
|
@@ -1735,15 +1735,15 @@ const Hn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Tn = {
|
|
|
1735
1735
|
title: "Something went wrong",
|
|
1736
1736
|
message: "Cannot fetch stock history. Please try again.",
|
|
1737
1737
|
type: "error"
|
|
1738
|
-
}), console.log("failed at fetching item adjustment history",
|
|
1738
|
+
}), console.log("failed at fetching item adjustment history", g.sku, m, c);
|
|
1739
1739
|
} finally {
|
|
1740
1740
|
R.value = !1;
|
|
1741
1741
|
}
|
|
1742
1742
|
}
|
|
1743
1743
|
qe(() => {
|
|
1744
|
-
|
|
1745
|
-
}), Fe([() => m.value, () =>
|
|
1746
|
-
|
|
1744
|
+
b();
|
|
1745
|
+
}), Fe([() => m.value, () => g.sku], () => {
|
|
1746
|
+
b();
|
|
1747
1747
|
});
|
|
1748
1748
|
const o = Y([]), t = Y([]), n = Y(new Array());
|
|
1749
1749
|
function $(c, h) {
|
|
@@ -1752,10 +1752,10 @@ const Hn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Tn = {
|
|
|
1752
1752
|
function E(c, h) {
|
|
1753
1753
|
const f = c.reduce(
|
|
1754
1754
|
(v, i) => {
|
|
1755
|
-
const
|
|
1756
|
-
if (!
|
|
1755
|
+
const S = i.effectiveAt ?? Te(i._id);
|
|
1756
|
+
if (!S)
|
|
1757
1757
|
return v;
|
|
1758
|
-
const P = $(new Date(
|
|
1758
|
+
const P = $(new Date(S), h);
|
|
1759
1759
|
return v[P] ?? (v[P] = []), v[P].push(i), v;
|
|
1760
1760
|
},
|
|
1761
1761
|
{}
|
|
@@ -1767,7 +1767,7 @@ const Hn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Tn = {
|
|
|
1767
1767
|
}
|
|
1768
1768
|
async function N() {
|
|
1769
1769
|
let c = await y.readStockAdjustment(
|
|
1770
|
-
|
|
1770
|
+
g.sku._id,
|
|
1771
1771
|
dt(new Date(m.value.startDate)).toISOString(),
|
|
1772
1772
|
mt(new Date(m.value.endDate)).toISOString()
|
|
1773
1773
|
);
|
|
@@ -1780,14 +1780,14 @@ const Hn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Tn = {
|
|
|
1780
1780
|
}));
|
|
1781
1781
|
try {
|
|
1782
1782
|
const f = await y.readUnitCostHistory(
|
|
1783
|
-
|
|
1783
|
+
g.sku._id,
|
|
1784
1784
|
dt(new Date(m.value.startDate)).toISOString(),
|
|
1785
1785
|
mt(new Date(m.value.endDate)).toISOString()
|
|
1786
1786
|
);
|
|
1787
1787
|
D.value = f;
|
|
1788
1788
|
const v = /* @__PURE__ */ new Set();
|
|
1789
|
-
f.forEach((
|
|
1790
|
-
v.add(
|
|
1789
|
+
f.forEach((S) => {
|
|
1790
|
+
v.add(S.mechanism);
|
|
1791
1791
|
});
|
|
1792
1792
|
const i = [{ label: "Default", value: "adjustment" }];
|
|
1793
1793
|
v.has(ge.Enum.weightedAverage) && i.push({
|
|
@@ -1802,57 +1802,57 @@ const Hn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Tn = {
|
|
|
1802
1802
|
}
|
|
1803
1803
|
}
|
|
1804
1804
|
async function O(c) {
|
|
1805
|
-
c.length && (n.value = await
|
|
1805
|
+
c.length && (n.value = await w.findBillsById(c).catch((h) => {
|
|
1806
1806
|
var i;
|
|
1807
1807
|
console.error("Error on using latest bill API, retrying using legacy api", h);
|
|
1808
1808
|
const f = ((i = u.currentBusiness.value) == null ? void 0 : i._id) ?? "", v = j.currentLocation.doc._id;
|
|
1809
|
-
return
|
|
1809
|
+
return w.findBillsByBusinessId(f, [v], c);
|
|
1810
1810
|
}));
|
|
1811
1811
|
}
|
|
1812
1812
|
const L = T(() => {
|
|
1813
|
-
const c = o.value, h =
|
|
1813
|
+
const c = o.value, h = g.sku;
|
|
1814
1814
|
return Mn(c, h);
|
|
1815
1815
|
}), X = T(() => {
|
|
1816
|
-
const c = o.value, h =
|
|
1816
|
+
const c = o.value, h = g.sku;
|
|
1817
1817
|
return In(c, h);
|
|
1818
1818
|
}), z = T(() => {
|
|
1819
1819
|
const c = [...o.value].computeFirst((f) => {
|
|
1820
|
-
var i,
|
|
1821
|
-
const v = (
|
|
1820
|
+
var i, S;
|
|
1821
|
+
const v = (S = (i = f.skus) == null ? void 0 : i.find) == null ? void 0 : S.call(i, (P) => P.sku._id === g.sku._id);
|
|
1822
1822
|
return v == null ? void 0 : v.fromBalance;
|
|
1823
1823
|
}) ?? {
|
|
1824
1824
|
amount: 0,
|
|
1825
1825
|
precision: 0
|
|
1826
|
-
}, h =
|
|
1826
|
+
}, h = g.sku;
|
|
1827
1827
|
return h ? `${oe.toFormatString({
|
|
1828
1828
|
value: c,
|
|
1829
1829
|
precision: 4
|
|
1830
1830
|
})} ${h.unit.abbrev}` : "";
|
|
1831
1831
|
}), K = T(() => {
|
|
1832
1832
|
const c = [...o.value].reverse().computeFirst((f) => {
|
|
1833
|
-
var i,
|
|
1834
|
-
const v = (
|
|
1833
|
+
var i, S;
|
|
1834
|
+
const v = (S = (i = f.skus) == null ? void 0 : i.find) == null ? void 0 : S.call(i, (P) => P.sku._id === g.sku._id);
|
|
1835
1835
|
return v == null ? void 0 : v.toBalance;
|
|
1836
1836
|
}) ?? {
|
|
1837
1837
|
amount: 0,
|
|
1838
1838
|
precision: 0
|
|
1839
|
-
}, h =
|
|
1839
|
+
}, h = g.sku;
|
|
1840
1840
|
return h ? `${oe.toFormatString({ value: c, precision: 4 })} ${h.unit.abbrev}` : "";
|
|
1841
1841
|
}), U = T(() => {
|
|
1842
1842
|
var f;
|
|
1843
1843
|
const h = o.value.flatMap((v) => {
|
|
1844
1844
|
var i;
|
|
1845
|
-
return ((i = v.skus) == null ? void 0 : i.flatMap((
|
|
1845
|
+
return ((i = v.skus) == null ? void 0 : i.flatMap((S) => S.amounts)) ?? [];
|
|
1846
1846
|
}).filter((v) => v.amount.amount < 0).reduce(
|
|
1847
1847
|
(v, i) => {
|
|
1848
|
-
const
|
|
1849
|
-
if (!
|
|
1848
|
+
const S = i.cost;
|
|
1849
|
+
if (!S) return v;
|
|
1850
1850
|
const P = {
|
|
1851
|
-
...Wt(v, Math.max(v.precision,
|
|
1852
|
-
currency:
|
|
1851
|
+
...Wt(v, Math.max(v.precision, S.precision)),
|
|
1852
|
+
currency: S.currency
|
|
1853
1853
|
};
|
|
1854
1854
|
return {
|
|
1855
|
-
...Qe(P,
|
|
1855
|
+
...Qe(P, S),
|
|
1856
1856
|
currency: v.currency
|
|
1857
1857
|
};
|
|
1858
1858
|
},
|
|
@@ -1872,42 +1872,42 @@ const Hn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Tn = {
|
|
|
1872
1872
|
});
|
|
1873
1873
|
}
|
|
1874
1874
|
const re = T(() => r("inventory.ingredient.valuationMethod.WAVG"));
|
|
1875
|
-
function
|
|
1875
|
+
function x(c, h) {
|
|
1876
1876
|
if (l.value === "adjustment")
|
|
1877
1877
|
return null;
|
|
1878
1878
|
const f = D.value.filter(
|
|
1879
|
-
(
|
|
1879
|
+
(S) => S.mechanism === l.value && S.skuId === g.sku._id
|
|
1880
1880
|
);
|
|
1881
1881
|
if (f.length === 0) return null;
|
|
1882
|
-
const v = f.find((
|
|
1883
|
-
const P =
|
|
1882
|
+
const v = f.find((S) => {
|
|
1883
|
+
const P = S.meta;
|
|
1884
1884
|
return (P == null ? void 0 : P.adjustmentId) === c;
|
|
1885
1885
|
});
|
|
1886
1886
|
if (v) return v.cost;
|
|
1887
|
-
const i = [...f].filter((
|
|
1887
|
+
const i = [...f].filter((S) => new Date(S.snapshotAt) <= new Date(h)).sort((S, P) => new Date(P.snapshotAt).getTime() - new Date(S.snapshotAt).getTime());
|
|
1888
1888
|
return i.length > 0 ? i[0].cost : null;
|
|
1889
1889
|
}
|
|
1890
1890
|
const F = T(() => {
|
|
1891
|
-
var v, i,
|
|
1891
|
+
var v, i, S, P, ee, ae;
|
|
1892
1892
|
const c = [...o.value].reverse().find((Q) => {
|
|
1893
1893
|
var W, te;
|
|
1894
|
-
return (te = (W = Q.skus) == null ? void 0 : W.find) == null ? void 0 : te.call(W, (le) => le.sku._id ===
|
|
1894
|
+
return (te = (W = Q.skus) == null ? void 0 : W.find) == null ? void 0 : te.call(W, (le) => le.sku._id === g.sku._id);
|
|
1895
1895
|
});
|
|
1896
1896
|
if (!c) return "No data";
|
|
1897
|
-
const h = (v = c.skus) == null ? void 0 : v.find((Q) => Q.sku._id ===
|
|
1897
|
+
const h = (v = c.skus) == null ? void 0 : v.find((Q) => Q.sku._id === g.sku._id);
|
|
1898
1898
|
if (!h) return "No data";
|
|
1899
1899
|
const f = h.toBalance;
|
|
1900
1900
|
if (l.value === "adjustment") {
|
|
1901
1901
|
const Q = [...h.amounts].reverse()[0], W = {
|
|
1902
1902
|
amount: ((i = Q.cost) == null ? void 0 : i.amount) ?? 0,
|
|
1903
|
-
precision: ((
|
|
1903
|
+
precision: ((S = Q.cost) == null ? void 0 : S.precision) ?? 0
|
|
1904
1904
|
}, te = Q.amount, le = te.amount == 0 ? oe.fromNumber(0) : oe.divide([W, te]);
|
|
1905
1905
|
return {
|
|
1906
1906
|
...oe.multiply([le, f]),
|
|
1907
1907
|
currency: ((P = Q.cost) == null ? void 0 : P.currency) || Ce(((ee = u.currentCountry) == null ? void 0 : ee.value) ?? lt)
|
|
1908
1908
|
};
|
|
1909
1909
|
} else {
|
|
1910
|
-
const Q = c.effectiveAt ?? Te(c._id), W =
|
|
1910
|
+
const Q = c.effectiveAt ?? Te(c._id), W = x(
|
|
1911
1911
|
c._id,
|
|
1912
1912
|
Q ?? (/* @__PURE__ */ new Date()).toISOString()
|
|
1913
1913
|
);
|
|
@@ -1921,8 +1921,8 @@ const Hn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Tn = {
|
|
|
1921
1921
|
}), G = T(() => {
|
|
1922
1922
|
var f;
|
|
1923
1923
|
const c = [...o.value].reverse().computeFirst((v) => {
|
|
1924
|
-
var
|
|
1925
|
-
const i = (P = (
|
|
1924
|
+
var S, P;
|
|
1925
|
+
const i = (P = (S = v.skus) == null ? void 0 : S.find) == null ? void 0 : P.call(S, (ee) => ee.sku._id === g.sku._id);
|
|
1926
1926
|
return i == null ? void 0 : i.toCostBalances;
|
|
1927
1927
|
});
|
|
1928
1928
|
return c ? {
|
|
@@ -1932,7 +1932,7 @@ const Hn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Tn = {
|
|
|
1932
1932
|
}),
|
|
1933
1933
|
currency: Ce((f = u.currentCountry) == null ? void 0 : f.value)
|
|
1934
1934
|
} : "No data";
|
|
1935
|
-
}), H = T(() =>
|
|
1935
|
+
}), H = T(() => g.sku.valuation === it.Enum.FIFO ? G.value : F.value);
|
|
1936
1936
|
function J() {
|
|
1937
1937
|
const { startDate: c, endDate: h } = no(m.value);
|
|
1938
1938
|
c !== null && h !== null && (m.value = {
|
|
@@ -1940,9 +1940,9 @@ const Hn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Tn = {
|
|
|
1940
1940
|
endDate: h
|
|
1941
1941
|
});
|
|
1942
1942
|
}
|
|
1943
|
-
const I = Ye(
|
|
1943
|
+
const I = Ye(g, "show");
|
|
1944
1944
|
return (c, h) => {
|
|
1945
|
-
const f = B("FmButton"), v = B("FmField"), i = B("FmDateRangePicker"),
|
|
1945
|
+
const f = B("FmButton"), v = B("FmField"), i = B("FmDateRangePicker"), S = B("FmSpacer"), P = B("FmCircularProgress"), ee = B("FmIcon"), ae = B("FmTooltip"), Q = B("FmMenuDivider"), W = B("FmChip"), te = B("FmSelect"), le = B("FmCardSection"), ce = B("FmCard"), je = B("FmSideSheet");
|
|
1946
1946
|
return V(), ne(je, {
|
|
1947
1947
|
"dismiss-away": "",
|
|
1948
1948
|
modelValue: s(I),
|
|
@@ -2000,11 +2000,11 @@ const Hn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Tn = {
|
|
|
2000
2000
|
})
|
|
2001
2001
|
]),
|
|
2002
2002
|
R.value ? (V(), q("div", Rn, [
|
|
2003
|
-
_(
|
|
2003
|
+
_(S),
|
|
2004
2004
|
_(P, { size: "xl" }),
|
|
2005
2005
|
e("div", Nn, p(s(r)("inventory.stock.history.loading")), 1),
|
|
2006
|
-
_(
|
|
2007
|
-
_(
|
|
2006
|
+
_(S),
|
|
2007
|
+
_(S)
|
|
2008
2008
|
])) : t.value && ((me = t.value) == null ? void 0 : me.length) > 0 ? (V(), q("div", On, [
|
|
2009
2009
|
_(ce, { variant: "outlined" }, {
|
|
2010
2010
|
default: M(() => [
|
|
@@ -2168,11 +2168,11 @@ const Hn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Tn = {
|
|
|
2168
2168
|
bills: n.value,
|
|
2169
2169
|
"unit-cost-history": D.value,
|
|
2170
2170
|
"cost-mechanism": l.value,
|
|
2171
|
-
onRefreshHistory:
|
|
2171
|
+
onRefreshHistory: b
|
|
2172
2172
|
}, null, 8, ["record", "sku", "bills", "unit-cost-history", "cost-mechanism"])) : se("", !0)
|
|
2173
2173
|
], 64))), 128))
|
|
2174
2174
|
])) : (V(), q("div", js, [
|
|
2175
|
-
_(
|
|
2175
|
+
_(S),
|
|
2176
2176
|
e("div", null, [
|
|
2177
2177
|
e("img", {
|
|
2178
2178
|
src: s(lo),
|
|
@@ -2181,8 +2181,8 @@ const Hn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Tn = {
|
|
|
2181
2181
|
]),
|
|
2182
2182
|
e("div", Cs, p(s(r)("inventory.stock.history.noRecords")), 1),
|
|
2183
2183
|
e("div", Ds, p(s(r)("inventory.stock.history.changeDateRange")), 1),
|
|
2184
|
-
_(
|
|
2185
|
-
_(
|
|
2184
|
+
_(S),
|
|
2185
|
+
_(S)
|
|
2186
2186
|
]))
|
|
2187
2187
|
])
|
|
2188
2188
|
];
|
|
@@ -2200,40 +2200,40 @@ const Hn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Tn = {
|
|
|
2200
2200
|
},
|
|
2201
2201
|
setup(A) {
|
|
2202
2202
|
const u = A, k = T(() => {
|
|
2203
|
-
const
|
|
2204
|
-
return u.permission &&
|
|
2203
|
+
const w = [];
|
|
2204
|
+
return u.permission && w.push(u.permission), u.permissions && w.push(...u.permissions), w;
|
|
2205
2205
|
});
|
|
2206
2206
|
Vt(() => {
|
|
2207
2207
|
});
|
|
2208
2208
|
const { hasPermission: y } = At(k, () => u.mode);
|
|
2209
|
-
return (
|
|
2209
|
+
return (w, j) => s(y) ? st(w.$slots, "default", { key: 0 }) : st(w.$slots, "fallback", { key: 1 });
|
|
2210
2210
|
}
|
|
2211
2211
|
});
|
|
2212
2212
|
function Is(A) {
|
|
2213
|
-
const u = Ut(), k = Se(), y = Y(!1),
|
|
2214
|
-
let d = null, r = !1,
|
|
2213
|
+
const u = Ut(), k = Se(), y = Y(!1), w = Y(null), j = Y(null);
|
|
2214
|
+
let d = null, r = !1, g = !1;
|
|
2215
2215
|
function R() {
|
|
2216
|
-
if (
|
|
2216
|
+
if (g) return;
|
|
2217
2217
|
const a = k.currentLocationDBName;
|
|
2218
2218
|
if (!a) return;
|
|
2219
|
-
|
|
2219
|
+
g = !0;
|
|
2220
2220
|
const D = {
|
|
2221
2221
|
type: "refresh-balance",
|
|
2222
2222
|
params: { locationId: a }
|
|
2223
|
-
}, { unsubscribe: m, initialState:
|
|
2223
|
+
}, { unsubscribe: m, initialState: b } = u.subscribe(
|
|
2224
2224
|
D,
|
|
2225
2225
|
C
|
|
2226
2226
|
);
|
|
2227
|
-
d = m,
|
|
2227
|
+
d = m, b.then((o) => {
|
|
2228
2228
|
o != null && o.initialState && C(o.initialState);
|
|
2229
2229
|
}).catch((o) => {
|
|
2230
2230
|
console.error("Failed to fetch refresh-balance initial state", o);
|
|
2231
2231
|
});
|
|
2232
2232
|
}
|
|
2233
2233
|
async function C(a) {
|
|
2234
|
-
var D;
|
|
2235
|
-
if (!(!
|
|
2236
|
-
if (
|
|
2234
|
+
var D, m, b;
|
|
2235
|
+
if (!(!g || !a)) {
|
|
2236
|
+
if (w.value = a, a.completedAt && (j.value = a.completedAt), a.message === "processing" || !a.completedAt && !a.message) {
|
|
2237
2237
|
r = !0, y.value = !0;
|
|
2238
2238
|
return;
|
|
2239
2239
|
}
|
|
@@ -2242,25 +2242,26 @@ function Is(A) {
|
|
|
2242
2242
|
l();
|
|
2243
2243
|
try {
|
|
2244
2244
|
await A.onCompleted();
|
|
2245
|
-
} catch (
|
|
2246
|
-
console.error("Failed to reload after refresh",
|
|
2245
|
+
} catch (o) {
|
|
2246
|
+
console.error("Failed to reload after refresh", o);
|
|
2247
2247
|
}
|
|
2248
2248
|
return;
|
|
2249
2249
|
}
|
|
2250
|
-
if (a.message === "error") {
|
|
2251
|
-
|
|
2252
|
-
|
|
2250
|
+
if (a.message === "error" || (D = a.message) != null && D.startsWith("error:")) {
|
|
2251
|
+
console.log("Stock balance refresh error:", a.message);
|
|
2252
|
+
const o = (m = a.message) != null && m.startsWith("error:") ? a.message.slice(6).trim() : "Failed to refresh stock balance.";
|
|
2253
|
+
l(), await ((b = A.onError) == null ? void 0 : b.call(A, o));
|
|
2253
2254
|
}
|
|
2254
2255
|
}
|
|
2255
2256
|
}
|
|
2256
2257
|
function l() {
|
|
2257
|
-
d && (d(), d = null),
|
|
2258
|
+
d && (d(), d = null), g = !1, r = !1, y.value = !1, w.value = null;
|
|
2258
2259
|
}
|
|
2259
2260
|
return Ct(() => {
|
|
2260
2261
|
l();
|
|
2261
2262
|
}), {
|
|
2262
2263
|
refreshing: y,
|
|
2263
|
-
refreshStatus:
|
|
2264
|
+
refreshStatus: w,
|
|
2264
2265
|
lastCompletedAt: j,
|
|
2265
2266
|
startListening: R,
|
|
2266
2267
|
stopListening: l
|
|
@@ -2272,7 +2273,7 @@ const Hs = {
|
|
|
2272
2273
|
}, Ts = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Es = { class: "flex flex-col gap-8" }, Us = { class: "flex flex-col" }, Ps = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Rs = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary line-clamp-1" }, _a = /* @__PURE__ */ ve({
|
|
2273
2274
|
__name: "StockView",
|
|
2274
2275
|
setup(A) {
|
|
2275
|
-
const { t: u } = pe(), k = Ne(), y = Se(),
|
|
2276
|
+
const { t: u } = pe(), k = Ne(), y = Se(), w = Oe(), j = Ft(), d = Ae(), r = gt(), g = co(), { columnDefs: R } = ko(), C = Xe(), { hasPermission: l } = At(
|
|
2276
2277
|
T(() => [
|
|
2277
2278
|
{
|
|
2278
2279
|
action: De.Action.manage,
|
|
@@ -2286,8 +2287,8 @@ const Hs = {
|
|
|
2286
2287
|
}
|
|
2287
2288
|
), D = Le(), m = we();
|
|
2288
2289
|
y.watchLocation(X);
|
|
2289
|
-
const
|
|
2290
|
-
() => new Set(
|
|
2290
|
+
const b = T(
|
|
2291
|
+
() => new Set(g.getAvailableItems(g.businessSubsidiaryId))
|
|
2291
2292
|
), o = Y(!1), t = Y(!1), { refreshing: n, lastCompletedAt: $, startListening: E, stopListening: N } = Is({
|
|
2292
2293
|
onCompleted: async () => {
|
|
2293
2294
|
await X(), t.value = !1, m.open({
|
|
@@ -2332,8 +2333,8 @@ Last refreshed: ${new Date($.value).toLocaleString()}` : f;
|
|
|
2332
2333
|
await d.recalculation.refreshCurrentBalances();
|
|
2333
2334
|
} catch (i) {
|
|
2334
2335
|
console.log("Failed to queue refresh balan22ce", typeof i);
|
|
2335
|
-
const
|
|
2336
|
-
console.log("Error details:",
|
|
2336
|
+
const S = typeof i == "object" ? JSON.stringify(i) : String(i);
|
|
2337
|
+
console.log("Error details:", S), t.value = !1, m.open({
|
|
2337
2338
|
title: u("inventory.common.refreshFailed"),
|
|
2338
2339
|
message: (i instanceof Error ? i.message : null) ?? u("inventory.stock.stock_balance.refreshBalanceError"),
|
|
2339
2340
|
type: "error"
|
|
@@ -2348,7 +2349,7 @@ Last refreshed: ${new Date($.value).toLocaleString()}` : f;
|
|
|
2348
2349
|
if (y._currentLocation) {
|
|
2349
2350
|
o.value = !0;
|
|
2350
2351
|
try {
|
|
2351
|
-
await
|
|
2352
|
+
await w.readStockBalance(), await w.readProductBalance(), await r.readStockEstimateBalance();
|
|
2352
2353
|
} catch (f) {
|
|
2353
2354
|
m.open({
|
|
2354
2355
|
title: u("inventory.stock.error.title"),
|
|
@@ -2378,20 +2379,20 @@ Last refreshed: ${new Date($.value).toLocaleString()}` : f;
|
|
|
2378
2379
|
}
|
|
2379
2380
|
]
|
|
2380
2381
|
}), U = T(() => {
|
|
2381
|
-
var i,
|
|
2382
|
+
var i, S, P;
|
|
2382
2383
|
const f = K.value ? mo.build(K.value) : null, v = [];
|
|
2383
2384
|
for (const ee of k.skus) {
|
|
2384
2385
|
let ae = !0;
|
|
2385
|
-
if (
|
|
2386
|
+
if (g.isEnabled && re.value && b.value && ae && (ae = b.value.has(ee._id)), f && ae && (ae = fo(
|
|
2386
2387
|
{
|
|
2387
2388
|
status: ee.isInactive ? "Inactive" : "Active"
|
|
2388
2389
|
},
|
|
2389
2390
|
f
|
|
2390
2391
|
)), ae) {
|
|
2391
2392
|
const Q = ee.trackingMeasurement;
|
|
2392
|
-
let W = (
|
|
2393
|
+
let W = (S = (i = w.stockBalance.skus) == null ? void 0 : i.find(
|
|
2393
2394
|
(ce) => ce.id === ee._id
|
|
2394
|
-
)) == null ? void 0 :
|
|
2395
|
+
)) == null ? void 0 : S.balance, te = r.inventoryForecast.skus.find(
|
|
2395
2396
|
(ce) => ce.id === ee._id
|
|
2396
2397
|
);
|
|
2397
2398
|
const le = {
|
|
@@ -2408,7 +2409,7 @@ Last refreshed: ${new Date($.value).toLocaleString()}` : f;
|
|
|
2408
2409
|
}
|
|
2409
2410
|
}
|
|
2410
2411
|
return v;
|
|
2411
|
-
}), Z = Y(""), re = Y(!0), { breakpoints:
|
|
2412
|
+
}), Z = Y(""), re = Y(!0), { breakpoints: x } = Lt(), F = T(() => x.value.xs || x.value.sm), G = T(() => F.value ? 10 : 20), H = Bt(), J = T(() => {
|
|
2412
2413
|
const f = [
|
|
2413
2414
|
{
|
|
2414
2415
|
label: u("inventory.stock.stock_balance.refreshBalance"),
|
|
@@ -2446,7 +2447,7 @@ Last refreshed: ${new Date($.value).toLocaleString()}` : f;
|
|
|
2446
2447
|
}
|
|
2447
2448
|
}
|
|
2448
2449
|
return (f, v) => {
|
|
2449
|
-
const i = B("FmSwitch"),
|
|
2450
|
+
const i = B("FmSwitch"), S = B("FmTable");
|
|
2450
2451
|
return V(), ne(Mt, {
|
|
2451
2452
|
title: s(u)("inventory.stock.title"),
|
|
2452
2453
|
actions: J.value,
|
|
@@ -2476,7 +2477,7 @@ Last refreshed: ${new Date($.value).toLocaleString()}` : f;
|
|
|
2476
2477
|
"onUpdate:filter": v[2] || (v[2] = (W) => K.value = W)
|
|
2477
2478
|
}, {
|
|
2478
2479
|
default: M(() => [
|
|
2479
|
-
s(
|
|
2480
|
+
s(g).isEnabled ? (V(), q("div", Hs, [
|
|
2480
2481
|
e("span", Ts, p(s(u)("inventory.integration.netsuite.subsidiaryHierarchy.filtering")), 1),
|
|
2481
2482
|
_(Nt),
|
|
2482
2483
|
_(Je, null, {
|
|
@@ -2492,7 +2493,7 @@ Last refreshed: ${new Date($.value).toLocaleString()}` : f;
|
|
|
2492
2493
|
]),
|
|
2493
2494
|
_: 1
|
|
2494
2495
|
}, 8, ["search", "filter-attributes", "filter"]),
|
|
2495
|
-
(V(), ne(
|
|
2496
|
+
(V(), ne(S, {
|
|
2496
2497
|
style: kt(s(H).tableHeight),
|
|
2497
2498
|
"column-defs": s(R),
|
|
2498
2499
|
"row-data": U.value,
|