@feedmepos/mf-inventory-portal 1.5.7 → 1.5.9-dev.1
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-DE6l-D4S.js → App-CRKhmCwm.js} +4 -4
- package/dist/{ApprovalView-rgqaceRG.js → ApprovalView-BdvNZ3Mi.js} +7 -7
- package/dist/{BindingsDialog-CaoCfpO5.js → BindingsDialog-UieCgCDS.js} +13 -13
- package/dist/{BindingsPicker-6ejmOZGg.js → BindingsPicker-Bo7xvsut.js} +2 -2
- package/dist/{BindingsTable-BYv0445O.js → BindingsTable-CUaQzSBn.js} +3 -3
- package/dist/ClosingDraftView-QgRaat2h.js +3335 -0
- package/dist/{ClosingHistoryView-FKmF3_d4.js → ClosingHistoryView-C_qw6v7h.js} +469 -459
- package/dist/{ClosingTemplateView-DZOFAxSC.js → ClosingTemplateView-BAsHjB3H.js} +14 -14
- package/dist/{DefaultView-Bmw-cwMP.js → DefaultView-CaWfkTXn.js} +2 -2
- package/dist/{DeliveryOrderPrintPreview-BAnulm_W.js → DeliveryOrderPrintPreview-Dv2fXveZ.js} +2 -2
- package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-DnRZ48Us.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-BFzPTyKA.js} +22 -22
- package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-pg3ieo_g.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-Y_AhN6qb.js} +2 -2
- package/dist/{FmMultiselectDialog-BFhyKzpc.js → FmMultiselectDialog-DT28lMdK.js} +1 -1
- package/dist/{FmMultiselectDialog-BinKfvTl.js → FmMultiselectDialog-e4dbq-bB.js} +2 -2
- package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-BgA6574c.js → FmUnitInput.vue_vue_type_script_setup_true_lang-CO2Uom0f.js} +111 -110
- package/dist/{ImportView-CAM68Sd4.js → ImportView-Brvxm1EN.js} +6 -6
- package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-CnO7Q7GW.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-DSqbdU3A.js} +1 -1
- package/dist/{IngredientGroupView-DoJ7F14c.js → IngredientGroupView-CqqD1_5X.js} +5 -5
- package/dist/{IngredientsView-DAsMEwld.js → IngredientsView-BmOSo8oo.js} +17 -17
- package/dist/{IntegrationExplorerView-DclCC5r6.js → IntegrationExplorerView-CZH3568k.js} +5 -5
- package/dist/{IntegrationView-BXiSzB-N.js → IntegrationView-CJv9Ps4v.js} +13 -13
- package/dist/{InventoryBindingForm-CC76n6uE.js → InventoryBindingForm-BZVAC4x1.js} +1 -1
- package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-gP24UWKI.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-BPl9weMj.js} +5 -5
- package/dist/{InventoryBindingSummary-BoYnVpYe.js → InventoryBindingSummary-C7Xl5Fd7.js} +1 -1
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-C5mzh-X5.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-CyjRq3A-.js} +1 -1
- package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-CefSaFhj.js → PremiumBadge.vue_vue_type_script_setup_true_lang-DIoYx-x4.js} +1 -1
- package/dist/{PublishView-BIPlQPqV.js → PublishView-DHK3MPsP.js} +3 -3
- package/dist/{PurchaseOrderPrintPreview-ChahKz9N.js → PurchaseOrderPrintPreview-DLg01buw.js} +2 -2
- package/dist/{ReceiveRequestView-BRPknQ4J.js → ReceiveRequestView-B1n42VJ5.js} +569 -570
- package/dist/{RecipeView-ifmP3yur.js → RecipeView-BOEfiTuN.js} +19 -19
- package/dist/{SettingsView-CHhME9fm.js → SettingsView-Bqx3woVD.js} +4 -4
- package/dist/{StockView-BYW7kSMB.js → StockView-UjWpz_eL.js} +775 -765
- package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-PX2cEVZi.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-BxyFAK_X.js} +1 -1
- package/dist/{SupplierView-ChRNEURO.js → SupplierView-_zK2xohX.js} +12 -12
- package/dist/{SurchargeView-pRvo-1Pc.js → SurchargeView-BtUebfil.js} +6 -6
- package/dist/{SystemTrailDialog.vue_vue_type_script_setup_true_lang-D1LOA32J.js → SystemTrailDialog.vue_vue_type_script_setup_true_lang-DF3seGmT.js} +2 -2
- package/dist/{TemplatePublishDialog.vue_vue_type_script_setup_true_lang-DgzLsKyB.js → TemplatePublishDialog.vue_vue_type_script_setup_true_lang-Bpo1u5g2.js} +1 -1
- package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-pRcSERam.js → TransferDetails.vue_vue_type_script_setup_true_lang-B_kdNBCT.js} +20 -20
- package/dist/{TransferTemplateView-CeJn9pkT.js → TransferTemplateView-OlHTVdCG.js} +18 -18
- package/dist/{UnitCostHistoryView-GBZ7kLM2.js → UnitCostHistoryView-BIvYaMio.js} +4 -4
- package/dist/{UnitDisplayControl.vue_vue_type_script_setup_true_lang-CBRziJ6W.js → UnitDisplayControl.vue_vue_type_script_setup_true_lang-DqTis1lE.js} +4 -4
- package/dist/{UnitView-D7qhcFMT.js → UnitView-DAtDiu3f.js} +9 -9
- package/dist/{WarehouseView-D1peFY-b.js → WarehouseView-B3mXQpoO.js} +70 -69
- package/dist/{WastageTemplateView-Cp6j79--.js → WastageTemplateView-BOoybeCb.js} +14 -14
- package/dist/api/error.d.ts +6 -3
- package/dist/{app-BYsl6Q0k.js → app-cwueji6m.js} +9477 -9400
- package/dist/app.d.ts +8 -0
- package/dist/app.js +4 -4
- package/dist/{closing-template-BqDEseEH.js → closing-template-CobmAqhD.js} +1 -1
- package/dist/{date2-ClEr4Hh1.js → date2-D_-j6u1x.js} +1 -1
- package/dist/{dayjs.min-D7rJ5XFt.js → dayjs.min-iDeAwg0n.js} +1 -1
- package/dist/{decimal-C-BtLmxu.js → decimal-DcHr_uvI.js} +2 -2
- package/dist/{defineDeepModel-CAsKxO2x.js → defineDeepModel-BhC1n6G-.js} +1 -1
- package/dist/{duplicate-template-BaLtrzTE.js → duplicate-template-Y9iggS9l.js} +1 -1
- package/dist/{export-CK6V100y.js → export-CAHG4EbP.js} +2 -2
- package/dist/{feature-C1s_dkeb.js → feature-BhK4XmmS.js} +86 -86
- package/dist/{format-time-from-id-BE25JynL.js → format-time-from-id-2IFiQNTX.js} +1 -1
- package/dist/{format-unit-display-6rk6Cvop.js → format-unit-display-CTYZvXcZ.js} +11 -11
- package/dist/helper/uom-rules.d.ts +12 -0
- package/dist/{import-export.helper-Vg3CSgTk.js → import-export.helper-DtWH9atw.js} +6 -6
- package/dist/{index-DkhSxroI.js → index-Ckhb0CMq.js} +1 -1
- package/dist/{index-Bw4sH5QZ.js → index-dfAAA8HA.js} +3 -3
- package/dist/{index-Ck1QT6n3.js → index-iGt85nBk.js} +1 -1
- package/dist/{inventory-core-dart.default-B2h72dXO.js → inventory-core-dart.default-R1tOn2RS.js} +372 -237
- package/dist/{lz-string-DL1izNj1.js → lz-string-DUT6tVSg.js} +1 -1
- package/dist/{menu-usage-module-BiCPifRX.js → menu-usage-module-D7cxkbEk.js} +11 -12
- package/dist/netsuite-BiF6Fo7G.js +9381 -0
- package/dist/{number-CG4iJNxT.js → number-Cqsx9s88.js} +3 -3
- package/dist/{predefined-templates-CBK89oKb.js → predefined-templates-CHExzSjx.js} +1 -1
- package/dist/{purchase-order-template-C2U5EzAN.js → purchase-order-template-_FfLY2u1.js} +1 -1
- package/dist/{recalculationUtils-C6ZDHlwr.js → recalculationUtils-KdVSBljW.js} +1 -1
- package/dist/{rules-BPgfm-C7.js → rules-DB26S6qs.js} +2 -2
- package/dist/{stock-uaUmLATC.js → stock-n6h8HkNk.js} +1 -1
- package/dist/{supplier-CAYiOj5U.js → supplier-6K9Cbfcf.js} +2 -2
- package/dist/{surcharge-BbOjhav8.js → surcharge-BV03ItuR.js} +1 -1
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/uom-rules-CzTxRiqL.js +21 -0
- package/dist/{use-ingredient-select-dialog-CqobC3-_.js → use-ingredient-select-dialog-Bs_4jjVy.js} +2 -2
- package/dist/{use-inventory-binding-dialog-BrAubA9c.js → use-inventory-binding-dialog-CgtoqJ2D.js} +2 -2
- package/dist/{use-template-enabled-locations-DtLAf3Ok.js → use-template-enabled-locations-C6fQtFF0.js} +2 -2
- package/dist/use-transfer-locations-DI48leYd.js +115 -0
- package/dist/{useHrmPermission-BjKDMF1Q.js → useHrmPermission-Co1Jgyvq.js} +1 -1
- package/dist/{useNavigationMenu-B_i92K8y.js → useNavigationMenu-JenXwvSv.js} +2 -2
- package/dist/{useSseClient-CPZj8tzu.js → useSseClient-gIA58rTS.js} +3 -3
- package/dist/views/closing-draft/helpers/export-draft.helper.d.ts +11 -2
- package/dist/{vue-i18n-DFNpQ_4n.js → vue-i18n-C3I0upD3.js} +331 -331
- package/dist/{xlsx-DuvGVByu.js → xlsx-4BYDayT5.js} +184 -184
- package/dist/{xlsx.util-NVQktAdj.js → xlsx.util-CD_xD6ZX.js} +3 -3
- package/package.json +3 -3
- package/dist/ClosingDraftView-BNjmxJNt.js +0 -3202
- package/dist/lodash-PCSvaIXr.js +0 -3678
- package/dist/netsuite-DC8EHD9N.js +0 -5708
- package/dist/use-transfer-locations-DK3Cx3XD.js +0 -116
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import { defineComponent as ve, openBlock as V, createBlock as ne, withCtx as M, createElementVNode as e, toDisplayString as
|
|
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
|
|
4
|
-
import { u as Oe, a as Ut } from "./useSseClient-
|
|
5
|
-
import { c as
|
|
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-
|
|
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-cwueji6m.js";
|
|
4
|
+
import { u as Oe, a as Ut } from "./useSseClient-gIA58rTS.js";
|
|
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-DqTis1lE.js";
|
|
7
|
+
import { _ as Ke, S as Ge, g as bt, a as Nt } from "./SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-BxyFAK_X.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-DIoYx-x4.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
|
|
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
|
|
24
|
-
import { _ as
|
|
25
|
-
import { F as _e } from "./inventory-core-dart.default-
|
|
26
|
-
import { u as io } from "./feature-
|
|
27
|
-
import { u as At } from "./useHrmPermission-
|
|
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-Cqsx9s88.js";
|
|
15
|
+
import { u as Ae } from "./stock-n6h8HkNk.js";
|
|
16
|
+
import { c as Ue, A as Kt, M as qt, R as Xt } from "./rules-DB26S6qs.js";
|
|
17
|
+
import { u as Jt } from "./use-inventory-binding-dialog-CgtoqJ2D.js";
|
|
18
|
+
import { a as St } from "./FmMultiselectDialog-e4dbq-bB.js";
|
|
19
|
+
import { d as ke } from "./dayjs.min-iDeAwg0n.js";
|
|
20
|
+
import { _ as Qt } from "./NumberPrecisionInput.vue_vue_type_script_setup_true_lang-CyjRq3A-.js";
|
|
21
|
+
import { g as Zt } from "./decimal-DcHr_uvI.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-D_-j6u1x.js";
|
|
23
|
+
import { i as ao, _ as ro } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-Y_AhN6qb.js";
|
|
24
|
+
import { _ as lo } from "./empty-placeholder-B0QU467o.js";
|
|
25
|
+
import { F as _e } from "./inventory-core-dart.default-R1tOn2RS.js";
|
|
26
|
+
import { u as io } from "./feature-BhK4XmmS.js";
|
|
27
|
+
import { u as At } from "./useHrmPermission-Co1Jgyvq.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-BiF6Fo7G.js";
|
|
30
30
|
import { P as mo, J as fo } from "./app-DiX-EfV6.js";
|
|
31
|
-
var Ie = /* @__PURE__ */ ((
|
|
31
|
+
var Ie = /* @__PURE__ */ ((A) => (A.History = "History", A.Convert = "Convert", A.Adjust = "Adjust", A))(Ie || {});
|
|
32
32
|
const vo = [
|
|
33
33
|
{
|
|
34
34
|
translationKey: "inventory.stock.action.history",
|
|
@@ -57,74 +57,74 @@ const vo = [
|
|
|
57
57
|
}
|
|
58
58
|
], yo = { class: "whitespace-nowrap" }, _o = /* @__PURE__ */ ve({
|
|
59
59
|
__name: "StockHeaderPreview",
|
|
60
|
-
setup(
|
|
61
|
-
const { t:
|
|
62
|
-
return (k,
|
|
60
|
+
setup(A) {
|
|
61
|
+
const { t: u } = pe();
|
|
62
|
+
return (k, y) => (V(), ne(Ot, null, {
|
|
63
63
|
default: M(() => [
|
|
64
|
-
e("div", yo,
|
|
64
|
+
e("div", yo, p(s(u)("inventory.stock.prediction.daysRemaining")), 1)
|
|
65
65
|
]),
|
|
66
66
|
_: 1
|
|
67
67
|
}));
|
|
68
68
|
}
|
|
69
69
|
}), Ft = Yt("stockActions", () => {
|
|
70
|
-
const
|
|
71
|
-
async function
|
|
72
|
-
if (
|
|
73
|
-
|
|
70
|
+
const A = Y(!1), u = Se(), k = Oe(), y = gt(), S = we(), j = Le(), { t: d } = pe();
|
|
71
|
+
async function r() {
|
|
72
|
+
if (u._currentLocation) {
|
|
73
|
+
A.value = !0;
|
|
74
74
|
try {
|
|
75
|
-
await k.readStockBalance(), await k.readProductBalance(), await
|
|
75
|
+
await k.readStockBalance(), await k.readProductBalance(), await y.readStockEstimateBalance();
|
|
76
76
|
} catch {
|
|
77
|
-
|
|
78
|
-
title:
|
|
79
|
-
message:
|
|
77
|
+
S.open({
|
|
78
|
+
title: d("inventory.stock.error.title"),
|
|
79
|
+
message: d("inventory.stock.error.message"),
|
|
80
80
|
type: "error"
|
|
81
81
|
});
|
|
82
82
|
} finally {
|
|
83
|
-
|
|
83
|
+
A.value = !1;
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
87
|
const b = Y();
|
|
88
|
-
async function R(
|
|
89
|
-
var $,
|
|
90
|
-
if (!!!((
|
|
88
|
+
async function R(w) {
|
|
89
|
+
var $, E, N;
|
|
90
|
+
if (!!!((E = ($ = w.convert) == null ? void 0 : $.inventoryBindings) != null && E.length)) {
|
|
91
91
|
j.open({
|
|
92
|
-
title:
|
|
93
|
-
message:
|
|
92
|
+
title: d("inventory.stock.error.convert.title"),
|
|
93
|
+
message: d("inventory.stock.error.convert.message")
|
|
94
94
|
});
|
|
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 === w._id)) == null ? void 0 : N.count) || 0,
|
|
99
|
+
sku: w,
|
|
100
100
|
show: !0,
|
|
101
101
|
"onUpdate:show"(O) {
|
|
102
102
|
b.value.show = O;
|
|
103
103
|
},
|
|
104
104
|
onSubmitted() {
|
|
105
|
-
|
|
105
|
+
r();
|
|
106
106
|
}
|
|
107
107
|
};
|
|
108
108
|
b.value = n;
|
|
109
109
|
}
|
|
110
110
|
const C = Y();
|
|
111
|
-
async function
|
|
111
|
+
async function l(w) {
|
|
112
112
|
const o = {
|
|
113
|
-
stock:
|
|
113
|
+
stock: w,
|
|
114
114
|
show: !0,
|
|
115
115
|
"onUpdate:show"(t) {
|
|
116
116
|
C.value.show = t;
|
|
117
117
|
},
|
|
118
118
|
onSubmitted() {
|
|
119
|
-
|
|
119
|
+
r();
|
|
120
120
|
}
|
|
121
121
|
};
|
|
122
122
|
C.value = o;
|
|
123
123
|
}
|
|
124
124
|
const a = Y();
|
|
125
|
-
async function D(
|
|
125
|
+
async function D(w) {
|
|
126
126
|
const o = {
|
|
127
|
-
sku:
|
|
127
|
+
sku: w,
|
|
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
|
|
135
|
+
function m(w, o) {
|
|
136
136
|
const t = Re(o);
|
|
137
|
-
switch (
|
|
137
|
+
switch (w) {
|
|
138
138
|
case Ie.History:
|
|
139
139
|
D(t);
|
|
140
140
|
return;
|
|
@@ -142,13 +142,13 @@ const vo = [
|
|
|
142
142
|
R(t);
|
|
143
143
|
return;
|
|
144
144
|
case Ie.Adjust:
|
|
145
|
-
|
|
145
|
+
l(t);
|
|
146
146
|
return;
|
|
147
147
|
}
|
|
148
148
|
}
|
|
149
149
|
return {
|
|
150
|
-
fetchStockBalance:
|
|
151
|
-
onActionMenu:
|
|
150
|
+
fetchStockBalance: r,
|
|
151
|
+
onActionMenu: m,
|
|
152
152
|
stockHistoryProps: a,
|
|
153
153
|
showSkuHistory: D,
|
|
154
154
|
convertSkuDialogProps: b,
|
|
@@ -157,30 +157,30 @@ const vo = [
|
|
|
157
157
|
});
|
|
158
158
|
function ko() {
|
|
159
159
|
var j;
|
|
160
|
-
const
|
|
160
|
+
const A = Se(), u = Ft(), k = Xe(), { t: y } = pe();
|
|
161
161
|
return {
|
|
162
162
|
columnDefs: [
|
|
163
163
|
{
|
|
164
164
|
accessorKey: "code",
|
|
165
|
-
header: () =>
|
|
165
|
+
header: () => y("inventory.stock.code"),
|
|
166
166
|
enableSorting: !0,
|
|
167
167
|
size: 300
|
|
168
168
|
},
|
|
169
169
|
{
|
|
170
170
|
accessorKey: "name",
|
|
171
|
-
header: () =>
|
|
171
|
+
header: () => y("inventory.stock.product"),
|
|
172
172
|
enableSorting: !0,
|
|
173
173
|
size: "auto"
|
|
174
174
|
},
|
|
175
175
|
{
|
|
176
176
|
id: "UOM",
|
|
177
|
-
header: () =>
|
|
178
|
-
cell(
|
|
179
|
-
const
|
|
180
|
-
unit:
|
|
181
|
-
sku:
|
|
182
|
-
amount:
|
|
183
|
-
defaultTrackingMeasurement:
|
|
177
|
+
header: () => y("inventory.stock.balance"),
|
|
178
|
+
cell(d) {
|
|
179
|
+
const r = d.row.original, b = {
|
|
180
|
+
unit: r.unit,
|
|
181
|
+
sku: r,
|
|
182
|
+
amount: r.balance,
|
|
183
|
+
defaultTrackingMeasurement: r.trackingMeasurement ?? void 0
|
|
184
184
|
};
|
|
185
185
|
return be(ht, b);
|
|
186
186
|
},
|
|
@@ -189,18 +189,18 @@ function ko() {
|
|
|
189
189
|
...(j = k.sessionUser.value) != null && j.role.isAdmin ? [
|
|
190
190
|
{
|
|
191
191
|
accessorKey: "isInactive",
|
|
192
|
-
header: () => be(Je, {}, () => `${
|
|
193
|
-
cell(
|
|
194
|
-
const
|
|
192
|
+
header: () => be(Je, {}, () => `${y("inventory.ingredient.status.title")}`),
|
|
193
|
+
cell(d) {
|
|
194
|
+
const r = d.row.original.isInactive;
|
|
195
195
|
return be(
|
|
196
196
|
"span",
|
|
197
197
|
{
|
|
198
198
|
class: [
|
|
199
199
|
"inline-block px-3 py-1 rounded-full text-xs font-semibold",
|
|
200
|
-
|
|
200
|
+
r ? "bg-red-100 text-red-700" : "bg-green-100 text-green-700"
|
|
201
201
|
].join(" ")
|
|
202
202
|
},
|
|
203
|
-
|
|
203
|
+
y(r ? "inventory.ingredient.status.inactive" : "inventory.ingredient.status.active")
|
|
204
204
|
);
|
|
205
205
|
},
|
|
206
206
|
enableSorting: !0
|
|
@@ -212,29 +212,29 @@ function ko() {
|
|
|
212
212
|
header: () => be(_o),
|
|
213
213
|
enableSorting: !0,
|
|
214
214
|
sortUndefined: "last",
|
|
215
|
-
cell(
|
|
216
|
-
var D,
|
|
217
|
-
const
|
|
218
|
-
if (typeof
|
|
215
|
+
cell(d) {
|
|
216
|
+
var D, m;
|
|
217
|
+
const r = d.row.original.day, b = 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
|
+
if (typeof r != "number" || typeof R != "number" || typeof C != "number")
|
|
219
219
|
return be(Ke, {
|
|
220
|
-
days:
|
|
220
|
+
days: r,
|
|
221
221
|
operator: b
|
|
222
222
|
});
|
|
223
|
-
const
|
|
223
|
+
const l = r <= R ? Ge.low : r <= C ? Ge.mid : Ge.high;
|
|
224
224
|
return be(Ke, {
|
|
225
|
-
days:
|
|
226
|
-
level:
|
|
225
|
+
days: r,
|
|
226
|
+
level: l
|
|
227
227
|
});
|
|
228
228
|
},
|
|
229
229
|
size: 200
|
|
230
230
|
},
|
|
231
231
|
{
|
|
232
232
|
id: "action",
|
|
233
|
-
cell(
|
|
234
|
-
var
|
|
235
|
-
return
|
|
236
|
-
((
|
|
237
|
-
(b) =>
|
|
233
|
+
cell(d) {
|
|
234
|
+
var r;
|
|
235
|
+
return Pt(
|
|
236
|
+
((r = A._currentLocation) == null ? void 0 : r.type) === "restaurant" ? vo : po,
|
|
237
|
+
(b) => u.onActionMenu(b, d.row.original)
|
|
238
238
|
);
|
|
239
239
|
},
|
|
240
240
|
enableSorting: !1,
|
|
@@ -250,39 +250,39 @@ function ko() {
|
|
|
250
250
|
const ho = {
|
|
251
251
|
context: null,
|
|
252
252
|
error: null,
|
|
253
|
-
isRequired(
|
|
254
|
-
return `${this.context ?? ""}`.length === 0 && (this.error =
|
|
253
|
+
isRequired(A = "This field is required") {
|
|
254
|
+
return `${this.context ?? ""}`.length === 0 && (this.error = A), this;
|
|
255
255
|
},
|
|
256
|
-
isString(
|
|
257
|
-
return this.error ? this : (typeof this.context != "string" && (this.error ?? (this.error =
|
|
256
|
+
isString(A = "Must be a valid string") {
|
|
257
|
+
return this.error ? this : (typeof this.context != "string" && (this.error ?? (this.error = A)), this);
|
|
258
258
|
},
|
|
259
259
|
toInt() {
|
|
260
260
|
return this.error ? this : (this.context = +this.context, this);
|
|
261
261
|
},
|
|
262
|
-
isInteger(
|
|
263
|
-
return this.error ? this : (this.toInt(), isNaN(this.context) && (this.error =
|
|
262
|
+
isInteger(A = "Must be an integer") {
|
|
263
|
+
return this.error ? this : (this.toInt(), isNaN(this.context) && (this.error = A), this);
|
|
264
264
|
},
|
|
265
|
-
min(
|
|
265
|
+
min(A, u) {
|
|
266
266
|
if (this.error) return this;
|
|
267
267
|
try {
|
|
268
|
-
typeof this.context == "number" ? +this.context <
|
|
268
|
+
typeof this.context == "number" ? +this.context < A && (this.error = u ?? `Must be at least ${A}`) : Object.prototype.hasOwnProperty.call(this.context, "length") ? +this.context.length < A && (this.error = u ?? `Must be at least ${A}`) : this.error = "Length cannot be determined";
|
|
269
269
|
} catch {
|
|
270
270
|
this.error = "Length cannot be determined";
|
|
271
271
|
}
|
|
272
272
|
return this;
|
|
273
273
|
},
|
|
274
|
-
max(
|
|
274
|
+
max(A, u) {
|
|
275
275
|
if (this.error) return this;
|
|
276
276
|
try {
|
|
277
|
-
typeof this.context == "number" ? +this.context >
|
|
277
|
+
typeof this.context == "number" ? +this.context > A && (this.error = u ?? `Must be at most ${A}`) : "length" in this.context ? +this.context.length > A && (this.error = u ?? `Must be at most ${A}`) : this.error = "Length cannot be determined";
|
|
278
278
|
} catch {
|
|
279
279
|
this.error = "Length cannot be determined";
|
|
280
280
|
}
|
|
281
281
|
return this;
|
|
282
282
|
}
|
|
283
283
|
};
|
|
284
|
-
function vt(
|
|
285
|
-
return { ...ho, context:
|
|
284
|
+
function vt(A) {
|
|
285
|
+
return { ...ho, context: A };
|
|
286
286
|
}
|
|
287
287
|
const bo = { class: "flex items-center" }, go = { class: "fm-typo-en-title-md-800" }, xo = { class: "flex flex-col gap-24 w-full" }, So = { class: "flex flex-col gap-8" }, wo = { class: "fm-typo-en-body-lg-600" }, Ao = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary flex-grow" }, Fo = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-error" }, $o = { class: "flex flex-col p-16 gap-8" }, jo = { class: "flex flex-col gap-4" }, Vo = { class: "fm-typo-en-body-md-600 text-fm-color-typo-secondary bg-fm-color-neutral-gray-100 border-b py-12 px-16" }, Co = { class: "grid grid-cols-[auto_100px_100px_48px] xs:grid-cols-[auto_80px_120px_48px] gap-8 px-8 items-center" }, Do = { class: "xs:col-span-3" }, Bo = { class: "flex gap-8" }, Mo = /* @__PURE__ */ ve({
|
|
288
288
|
__name: "ConvertSkuDialog",
|
|
@@ -292,100 +292,100 @@ const bo = { class: "flex items-center" }, go = { class: "fm-typo-en-title-md-80
|
|
|
292
292
|
show: { type: Boolean }
|
|
293
293
|
},
|
|
294
294
|
emits: ["update:show", "submitted"],
|
|
295
|
-
setup(
|
|
296
|
-
const
|
|
295
|
+
setup(A, { expose: u, emit: k }) {
|
|
296
|
+
const y = A, S = k, j = Jt(), d = Ne(), r = Ae(), b = we(), { t: R } = pe(), C = Y(0), l = Y(null), a = T(() => d.skus), D = T(
|
|
297
297
|
() => {
|
|
298
|
-
var g,
|
|
299
|
-
return (((
|
|
300
|
-
(G) => G.type ===
|
|
298
|
+
var g, F;
|
|
299
|
+
return (((F = (g = y.sku) == null ? void 0 : g.convert) == null ? void 0 : F.inventoryBindings) ?? []).filter(
|
|
300
|
+
(G) => G.type === rt.enum.SKU
|
|
301
301
|
);
|
|
302
302
|
}
|
|
303
|
-
),
|
|
303
|
+
), m = T({
|
|
304
304
|
get() {
|
|
305
|
-
return !!
|
|
305
|
+
return !!l.value;
|
|
306
306
|
},
|
|
307
307
|
set(g) {
|
|
308
|
-
g ?
|
|
308
|
+
g ? l.value = Re(D.value) : (l.value = null, C.value = Math.min(C.value, y.maxCount ?? 0));
|
|
309
309
|
}
|
|
310
|
-
}),
|
|
311
|
-
Fe([() =>
|
|
310
|
+
}), w = Y(!1);
|
|
311
|
+
Fe([() => y.show], ([g]) => {
|
|
312
312
|
g && (C.value = 0);
|
|
313
313
|
});
|
|
314
314
|
function o() {
|
|
315
|
-
L(
|
|
315
|
+
L(y.sku, Ee(C.value), l.value);
|
|
316
316
|
}
|
|
317
317
|
function t(g) {
|
|
318
|
-
if (
|
|
318
|
+
if (l.value)
|
|
319
319
|
return !0;
|
|
320
|
-
const
|
|
321
|
-
return
|
|
320
|
+
const F = vt(g).isInteger().max(y.maxCount ?? 0).error ?? "";
|
|
321
|
+
return F || !0;
|
|
322
322
|
}
|
|
323
323
|
function n(g) {
|
|
324
324
|
var I;
|
|
325
|
-
const
|
|
325
|
+
const F = (I = y.sku.convert) != null && I.measurement ? y.sku.unit.measurements.find((c) => {
|
|
326
326
|
var h;
|
|
327
|
-
return
|
|
328
|
-
}) ?? null : null, G = $e(
|
|
327
|
+
return c.id === ((h = y.sku.convert) == null ? void 0 : h.measurement);
|
|
328
|
+
}) ?? null : null, G = $e(y.sku.unit, F), H = Gt(+g);
|
|
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 g,
|
|
334
|
-
return (g =
|
|
333
|
+
var g, F;
|
|
334
|
+
return (g = y.sku.convert) != null && g.measurement ? (F = y.sku.unit.measurements.find((G) => {
|
|
335
335
|
var H;
|
|
336
|
-
return G.id === ((H =
|
|
337
|
-
})) == null ? void 0 :
|
|
336
|
+
return G.id === ((H = y.sku.convert) == null ? void 0 : H.measurement);
|
|
337
|
+
})) == null ? void 0 : F.abbrev : y.sku.unit.abbrev;
|
|
338
338
|
}
|
|
339
|
-
),
|
|
339
|
+
), E = T(() => {
|
|
340
340
|
var H, J;
|
|
341
|
-
const
|
|
342
|
-
bindings: ((H =
|
|
343
|
-
skus:
|
|
344
|
-
skuGroups:
|
|
345
|
-
recipes:
|
|
341
|
+
const F = It({
|
|
342
|
+
bindings: ((H = y.sku.convert) == null ? void 0 : H.inventoryBindings) ?? [],
|
|
343
|
+
skus: d.skus,
|
|
344
|
+
skuGroups: d.skuGroups,
|
|
345
|
+
recipes: d.recipes
|
|
346
346
|
}).inventoryBindings.filter((I) => "success" in I && I.success).map((I) => I).map((I) => I.binding);
|
|
347
|
-
return (J =
|
|
347
|
+
return (J = l.value ?? F) == null ? void 0 : J.map((I) => {
|
|
348
348
|
var ee, ae, Q, W, te;
|
|
349
|
-
const
|
|
349
|
+
const c = d.skus.find((le) => le._id === I.id), h = ((ee = I.measurement) == null ? void 0 : ee.abbrev) ?? ((ae = c == null ? void 0 : c.unit) == null ? void 0 : ae.abbrev), f = (Q = y.sku.convert) != null && Q.measurement ? y.sku.unit.measurements.find((le) => {
|
|
350
350
|
var ce;
|
|
351
|
-
return
|
|
352
|
-
}) ?? null : null,
|
|
351
|
+
return le.id === ((ce = y.sku.convert) == null ? void 0 : ce.measurement);
|
|
352
|
+
}) ?? null : null, v = $e(y.sku.unit, f), i = n(`${C.value}`) === !0 ? he(
|
|
353
353
|
zt(
|
|
354
354
|
I.amount,
|
|
355
|
-
|
|
355
|
+
Ee(+C.value, v)
|
|
356
356
|
),
|
|
357
357
|
!1
|
|
358
|
-
) : "0",
|
|
358
|
+
) : "0", x = (te = (W = l.value) == null ? void 0 : W.find((le) => le.id === (c == null ? void 0 : c._id))) == null ? void 0 : te.amount, P = x ? he(x, !1) : null;
|
|
359
359
|
return {
|
|
360
|
-
sku:
|
|
361
|
-
convertAmount:
|
|
360
|
+
sku: c,
|
|
361
|
+
convertAmount: P ?? i,
|
|
362
362
|
abbrev: h
|
|
363
363
|
};
|
|
364
364
|
});
|
|
365
365
|
}), N = Y();
|
|
366
|
-
|
|
366
|
+
u({
|
|
367
367
|
validateInputs: () => {
|
|
368
|
-
var g,
|
|
369
|
-
(
|
|
368
|
+
var g, F;
|
|
369
|
+
(F = (g = N.value) == null ? void 0 : g.validateInputs) == null || F.call(g);
|
|
370
370
|
},
|
|
371
371
|
resetInputsValidation: () => {
|
|
372
|
-
var g,
|
|
373
|
-
(
|
|
372
|
+
var g, F;
|
|
373
|
+
(F = (g = N.value) == null ? void 0 : g.resetInputsValidation) == null || F.call(g);
|
|
374
374
|
},
|
|
375
375
|
resetInputs: () => {
|
|
376
|
-
var g,
|
|
377
|
-
(
|
|
376
|
+
var g, F;
|
|
377
|
+
(F = (g = N.value) == null ? void 0 : g.resetInputs) == null || F.call(g);
|
|
378
378
|
}
|
|
379
379
|
});
|
|
380
|
-
const O = Ye(
|
|
381
|
-
async function L(g,
|
|
382
|
-
|
|
380
|
+
const O = Ye(y, "show");
|
|
381
|
+
async function L(g, F, G) {
|
|
382
|
+
w.value = !0;
|
|
383
383
|
try {
|
|
384
|
-
await
|
|
384
|
+
await r.convertSku({
|
|
385
385
|
conversions: [
|
|
386
386
|
{
|
|
387
387
|
doc: g,
|
|
388
|
-
amount:
|
|
388
|
+
amount: F,
|
|
389
389
|
overrides: G == null ? void 0 : G.map((H) => ({
|
|
390
390
|
...H,
|
|
391
391
|
amount: {
|
|
@@ -396,77 +396,77 @@ const bo = { class: "flex items-center" }, go = { class: "fm-typo-en-title-md-80
|
|
|
396
396
|
}))
|
|
397
397
|
}
|
|
398
398
|
]
|
|
399
|
-
}),
|
|
399
|
+
}), S("update:show", !1), S("submitted");
|
|
400
400
|
} catch (H) {
|
|
401
401
|
b.open({
|
|
402
402
|
title: "Something went wrong",
|
|
403
403
|
message: `Cannot convert ${g.name}. Please try again.`,
|
|
404
404
|
type: "error"
|
|
405
|
-
}), console.error("error at converting stock amount", g,
|
|
405
|
+
}), console.error("error at converting stock amount", g, F, H);
|
|
406
406
|
} finally {
|
|
407
|
-
|
|
407
|
+
w.value = !1;
|
|
408
408
|
}
|
|
409
409
|
}
|
|
410
|
-
function X(g,
|
|
411
|
-
const H = +
|
|
410
|
+
function X(g, F, G) {
|
|
411
|
+
const H = +F;
|
|
412
412
|
let J = G;
|
|
413
|
-
|
|
413
|
+
F.length > 0 && isFinite(H) ? J = G.map((I) => (I.id !== g || (I.amount = xe(H)), I)) : J = G.map((I) => (I.id !== g || (I.amount = { amount: 0, precision: 0 }), I)), l.value = J;
|
|
414
414
|
}
|
|
415
415
|
function z(g) {
|
|
416
|
-
const
|
|
417
|
-
return
|
|
416
|
+
const F = a.value.find((G) => G._id === g);
|
|
417
|
+
return F ? bt(F.unit, !0) : [];
|
|
418
418
|
}
|
|
419
|
-
function K(g,
|
|
420
|
-
const G = z(g), H = G.find((J) => J.value ===
|
|
419
|
+
function K(g, F) {
|
|
420
|
+
const G = z(g), 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(g,
|
|
426
|
+
function U(g, F, G) {
|
|
427
427
|
let H;
|
|
428
|
-
if (
|
|
428
|
+
if (F === null)
|
|
429
429
|
H = G.map((J) => (J.id !== g || (J.measurement = null), J)) ?? [];
|
|
430
430
|
else {
|
|
431
431
|
const J = a.value.find((I) => I._id === g);
|
|
432
432
|
H = G.map((I) => {
|
|
433
|
-
var
|
|
434
|
-
return I.id !== g || (I.measurement = (h = (
|
|
433
|
+
var c, h;
|
|
434
|
+
return I.id !== g || (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(g,
|
|
440
|
-
const G =
|
|
441
|
-
|
|
439
|
+
function Z(g, F) {
|
|
440
|
+
const G = F.filter((H) => H.id !== g);
|
|
441
|
+
l.value = G;
|
|
442
442
|
}
|
|
443
|
-
function
|
|
444
|
-
const g = (
|
|
445
|
-
...
|
|
446
|
-
type:
|
|
443
|
+
function re() {
|
|
444
|
+
const g = (l.value ?? []).map((F) => ({
|
|
445
|
+
...F,
|
|
446
|
+
type: rt.enum.SKU
|
|
447
447
|
}));
|
|
448
448
|
j.promptIngredientsBinding(
|
|
449
449
|
g,
|
|
450
|
-
(
|
|
451
|
-
|
|
450
|
+
(F) => l.value = F,
|
|
451
|
+
y.sku._id
|
|
452
452
|
);
|
|
453
453
|
}
|
|
454
454
|
return Fe(
|
|
455
|
-
() =>
|
|
455
|
+
() => y.show,
|
|
456
456
|
(g) => {
|
|
457
|
-
g || (
|
|
457
|
+
g || (l.value = null, C.value = 0);
|
|
458
458
|
}
|
|
459
|
-
), (g,
|
|
460
|
-
const G = B("FmTextField"), H = B("FmForm"), J = B("FmCard"), I = B("FmSwitch"),
|
|
461
|
-
return V(), ne(
|
|
459
|
+
), (g, F) => {
|
|
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
|
+
return V(), ne(v, {
|
|
462
462
|
"dismiss-away": "",
|
|
463
463
|
modelValue: s(O),
|
|
464
|
-
"onUpdate:modelValue":
|
|
464
|
+
"onUpdate:modelValue": F[3] || (F[3] = (i) => Pe(O) ? O.value = i : null),
|
|
465
465
|
"max-width": 500
|
|
466
466
|
}, {
|
|
467
467
|
"side-sheet-header": M(() => [
|
|
468
468
|
e("div", bo, [
|
|
469
|
-
e("div", go,
|
|
469
|
+
e("div", go, p(s(R)("inventory.stock.convert.title", { name: g.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: w.value,
|
|
482
482
|
"model-value": C.value,
|
|
483
|
-
"onUpdate:modelValue":
|
|
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":
|
|
487
|
+
"helper-text": l.value ? void 0 : `Max ${g.maxCount} ${$.value}`
|
|
488
488
|
}, null, 8, ["disabled", "model-value", "label", "rules", "append-text", "helper-text"])
|
|
489
489
|
]),
|
|
490
490
|
_: 1
|
|
@@ -495,15 +495,15 @@ const bo = { class: "flex items-center" }, go = { class: "fm-typo-en-title-md-80
|
|
|
495
495
|
}, {
|
|
496
496
|
default: M(() => [
|
|
497
497
|
e("div", So, [
|
|
498
|
-
e("div", wo,
|
|
499
|
-
(V(!0), q(ue, null, fe(
|
|
500
|
-
var
|
|
498
|
+
e("div", wo, p(s(R)("inventory.stock.convert.deductionSummary")), 1),
|
|
499
|
+
(V(!0), q(ue, null, fe(E.value, (i) => {
|
|
500
|
+
var x, P;
|
|
501
501
|
return V(), q("div", {
|
|
502
|
-
key: (
|
|
502
|
+
key: (x = i.sku) == null ? void 0 : x._id,
|
|
503
503
|
class: "flex items-center"
|
|
504
504
|
}, [
|
|
505
|
-
e("div", Ao,
|
|
506
|
-
e("div", Fo, " -" +
|
|
505
|
+
e("div", Ao, p((P = i.sku) == null ? void 0 : P.name), 1),
|
|
506
|
+
e("div", Fo, " -" + p(i.convertAmount) + " " + p(i.abbrev), 1)
|
|
507
507
|
]);
|
|
508
508
|
}), 128))
|
|
509
509
|
])
|
|
@@ -515,61 +515,61 @@ const bo = { class: "flex items-center" }, go = { class: "fm-typo-en-title-md-80
|
|
|
515
515
|
e("div", $o, [
|
|
516
516
|
_(I, {
|
|
517
517
|
value: "",
|
|
518
|
-
modelValue:
|
|
519
|
-
"onUpdate:modelValue":
|
|
518
|
+
modelValue: m.value,
|
|
519
|
+
"onUpdate:modelValue": F[1] || (F[1] = (i) => m.value = i),
|
|
520
520
|
label: s(R)("inventory.stock.convert.overrideDeduction"),
|
|
521
521
|
"label-placement": "right"
|
|
522
522
|
}, null, 8, ["modelValue", "label"]),
|
|
523
|
-
|
|
524
|
-
_(
|
|
525
|
-
modelValue:
|
|
523
|
+
m.value ? (V(), q(ue, { key: 0 }, [
|
|
524
|
+
_(c, {
|
|
525
|
+
modelValue: l.value,
|
|
526
526
|
rules: [s(Kt)(1, "Must have at least one ingredient binding")]
|
|
527
527
|
}, null, 8, ["modelValue", "rules"]),
|
|
528
528
|
e("div", jo, [
|
|
529
|
-
e("div", Vo,
|
|
530
|
-
(V(!0), q(ue, null, fe(
|
|
531
|
-
key:
|
|
532
|
-
disabled:
|
|
533
|
-
modelValue: +s(he)(
|
|
529
|
+
e("div", Vo, p(s(R)("inventory.stock.convert.ingredients")), 1),
|
|
530
|
+
(V(!0), q(ue, null, fe(l.value, (i) => (V(), ne(c, {
|
|
531
|
+
key: i.id,
|
|
532
|
+
disabled: w.value,
|
|
533
|
+
modelValue: +s(he)(i.amount ?? { amount: 1, precision: 0 }),
|
|
534
534
|
rules: [
|
|
535
535
|
s(qt)(
|
|
536
|
-
a.value.find((
|
|
537
|
-
|
|
536
|
+
a.value.find((x) => x._id === i.id).unit,
|
|
537
|
+
i.measurement
|
|
538
538
|
),
|
|
539
539
|
s(Ue)(0)
|
|
540
540
|
]
|
|
541
541
|
}, {
|
|
542
|
-
default: M(({ invalid:
|
|
543
|
-
var
|
|
542
|
+
default: M(({ invalid: x }) => {
|
|
543
|
+
var P, ee, ae;
|
|
544
544
|
return [
|
|
545
545
|
e("div", Co, [
|
|
546
|
-
e("div", Do,
|
|
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: w.value,
|
|
550
550
|
modelValue: +s(he)(
|
|
551
|
-
|
|
551
|
+
i.amount ?? { amount: 1, precision: 0 }
|
|
552
552
|
),
|
|
553
|
-
"onUpdate:modelValue": (Q) => X(
|
|
554
|
-
invalid:
|
|
553
|
+
"onUpdate:modelValue": (Q) => X(i.id, Q, l.value ?? []),
|
|
554
|
+
invalid: x
|
|
555
555
|
}, null, 8, ["disabled", "modelValue", "onUpdate:modelValue", "invalid"]),
|
|
556
556
|
_(h, {
|
|
557
|
-
disabled:
|
|
557
|
+
disabled: w.value,
|
|
558
558
|
class: "translate-y-[2px]",
|
|
559
|
-
items: z(
|
|
560
|
-
"model-value": (ae = K(
|
|
561
|
-
"onUpdate:modelValue": (Q) => U(
|
|
562
|
-
invalid:
|
|
559
|
+
items: z(i.id),
|
|
560
|
+
"model-value": (ae = K(i.id, (ee = i.measurement) == null ? void 0 : ee.id)) == null ? void 0 : ae.value,
|
|
561
|
+
"onUpdate:modelValue": (Q) => U(i.id, Q, l.value ?? []),
|
|
562
|
+
invalid: x
|
|
563
563
|
}, {
|
|
564
|
-
"helper-text": M(() =>
|
|
564
|
+
"helper-text": M(() => F[4] || (F[4] = [])),
|
|
565
565
|
_: 2
|
|
566
566
|
}, 1032, ["disabled", "items", "model-value", "onUpdate:modelValue", "invalid"]),
|
|
567
|
-
_(
|
|
568
|
-
disabled:
|
|
567
|
+
_(f, {
|
|
568
|
+
disabled: w.value,
|
|
569
569
|
type: "button",
|
|
570
570
|
variant: "tertiary",
|
|
571
571
|
icon: "delete",
|
|
572
|
-
onClick: (Q) => Z(
|
|
572
|
+
onClick: (Q) => Z(i.id, l.value ?? [])
|
|
573
573
|
}, null, 8, ["disabled", "onClick"])
|
|
574
574
|
])
|
|
575
575
|
];
|
|
@@ -578,11 +578,11 @@ const bo = { class: "flex items-center" }, go = { class: "fm-typo-en-title-md-80
|
|
|
578
578
|
}, 1032, ["disabled", "modelValue", "rules"]))), 128))
|
|
579
579
|
]),
|
|
580
580
|
e("div", null, [
|
|
581
|
-
_(
|
|
581
|
+
_(f, {
|
|
582
582
|
icon: "link",
|
|
583
583
|
label: s(R)("inventory.stock.convert.linkIngredient"),
|
|
584
584
|
variant: "plain",
|
|
585
|
-
onClick:
|
|
585
|
+
onClick: re
|
|
586
586
|
}, null, 8, ["label"])
|
|
587
587
|
])
|
|
588
588
|
], 64)) : se("", !0)
|
|
@@ -594,12 +594,12 @@ const bo = { class: "flex items-center" }, go = { class: "fm-typo-en-title-md-80
|
|
|
594
594
|
]),
|
|
595
595
|
"side-sheet-footer": M(() => [
|
|
596
596
|
e("div", Bo, [
|
|
597
|
-
_(
|
|
598
|
-
loading:
|
|
597
|
+
_(f, {
|
|
598
|
+
loading: w.value,
|
|
599
599
|
label: s(R)("inventory.stock.convert.convertButton"),
|
|
600
|
-
onClick:
|
|
601
|
-
var
|
|
602
|
-
return (
|
|
600
|
+
onClick: F[2] || (F[2] = (i) => {
|
|
601
|
+
var x, P;
|
|
602
|
+
return (P = (x = N.value) == null ? void 0 : x.validateInputs) == null ? void 0 : P.call(x);
|
|
603
603
|
})
|
|
604
604
|
}, null, 8, ["loading", "label"])
|
|
605
605
|
])
|
|
@@ -609,12 +609,12 @@ const bo = { class: "flex items-center" }, go = { class: "fm-typo-en-title-md-80
|
|
|
609
609
|
};
|
|
610
610
|
}
|
|
611
611
|
});
|
|
612
|
-
function Be(
|
|
613
|
-
const k =
|
|
612
|
+
function Be(A, u) {
|
|
613
|
+
const k = Ee(A, u);
|
|
614
614
|
return { ...k, amount: -k.amount };
|
|
615
615
|
}
|
|
616
|
-
function pt(
|
|
617
|
-
return
|
|
616
|
+
function pt(A, u) {
|
|
617
|
+
return Ee(Math.abs(A), u);
|
|
618
618
|
}
|
|
619
619
|
const We = {
|
|
620
620
|
[ie.enum.DAMAGE]: {
|
|
@@ -641,7 +641,7 @@ const We = {
|
|
|
641
641
|
label: "Purchase",
|
|
642
642
|
toAdjustmentAmount: pt
|
|
643
643
|
}
|
|
644
|
-
}, Io = { class: "col-span-2 flex" }, Ho = { class: "flex-1" }, To = { class: "fm-typo-en-body-lg-600" },
|
|
644
|
+
}, Io = { class: "col-span-2 flex" }, Ho = { class: "flex-1" }, To = { class: "fm-typo-en-body-lg-600" }, Eo = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Uo = { class: "col-span-2 flex flex-col gap-4" }, Po = { class: "flex gap-4 text-fm-color-typo-primary fm-typo-en-body-lg-600" }, Ro = {
|
|
645
645
|
key: 0,
|
|
646
646
|
class: "fm-typo-en-body-md-400 text-fm-color-typo-warning"
|
|
647
647
|
}, $t = /* @__PURE__ */ ve({
|
|
@@ -652,13 +652,13 @@ const We = {
|
|
|
652
652
|
isBackdate: { type: Boolean }
|
|
653
653
|
},
|
|
654
654
|
emits: ["update:modelValue", "click:delete"],
|
|
655
|
-
setup(
|
|
656
|
-
const k =
|
|
655
|
+
setup(A, { emit: u }) {
|
|
656
|
+
const k = A, y = u, { t: S } = pe(), j = Oe(), d = T(
|
|
657
657
|
() => Object.keys(We).map((t) => ({
|
|
658
658
|
label: Ht(t),
|
|
659
659
|
value: t
|
|
660
660
|
}))
|
|
661
|
-
),
|
|
661
|
+
), r = T(() => bt(k.modelValue.doc.unit, !0)), b = T({
|
|
662
662
|
get() {
|
|
663
663
|
return k.modelValue.type ?? ie.enum.PURCHASE;
|
|
664
664
|
},
|
|
@@ -671,7 +671,7 @@ const We = {
|
|
|
671
671
|
n.amount = We[n.type].toAdjustmentAmount(
|
|
672
672
|
+he($),
|
|
673
673
|
$.precision
|
|
674
|
-
),
|
|
674
|
+
), y("update:modelValue", n);
|
|
675
675
|
}
|
|
676
676
|
}), R = T({
|
|
677
677
|
get() {
|
|
@@ -685,7 +685,7 @@ const We = {
|
|
|
685
685
|
n.amount = We[b.value].toAdjustmentAmount(
|
|
686
686
|
t,
|
|
687
687
|
$.precision
|
|
688
|
-
),
|
|
688
|
+
), y("update:modelValue", n);
|
|
689
689
|
}
|
|
690
690
|
}), C = T({
|
|
691
691
|
get() {
|
|
@@ -693,13 +693,13 @@ const We = {
|
|
|
693
693
|
return ((t = k.modelValue.measurement) == null ? void 0 : t.id) ?? null;
|
|
694
694
|
},
|
|
695
695
|
set(t) {
|
|
696
|
-
var $,
|
|
696
|
+
var $, E;
|
|
697
697
|
const n = {
|
|
698
698
|
...k.modelValue
|
|
699
699
|
};
|
|
700
|
-
n.measurement = ((
|
|
700
|
+
n.measurement = ((E = ($ = k.modelValue.doc.unit) == null ? void 0 : $.measurements) == null ? void 0 : E.find((N) => N.id === t)) ?? null, y("update:modelValue", n);
|
|
701
701
|
}
|
|
702
|
-
}),
|
|
702
|
+
}), l = T({
|
|
703
703
|
get() {
|
|
704
704
|
return k.modelValue.remark ?? "";
|
|
705
705
|
},
|
|
@@ -707,7 +707,7 @@ const We = {
|
|
|
707
707
|
const n = {
|
|
708
708
|
...k.modelValue
|
|
709
709
|
};
|
|
710
|
-
n.remark = t,
|
|
710
|
+
n.remark = t, y("update:modelValue", n);
|
|
711
711
|
}
|
|
712
712
|
}), a = T(() => {
|
|
713
713
|
var n;
|
|
@@ -716,15 +716,15 @@ const We = {
|
|
|
716
716
|
}), D = T(() => {
|
|
717
717
|
const t = k.modelValue.amount, n = k.modelValue.measurement;
|
|
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
|
-
),
|
|
722
|
-
() => Zt(
|
|
721
|
+
), w = T(
|
|
722
|
+
() => Zt(m.value, k.modelValue.doc.unit)
|
|
723
723
|
), o = T(
|
|
724
724
|
() => !k.isBackdate && D.value.amount < 0
|
|
725
725
|
);
|
|
726
726
|
return (t, n) => {
|
|
727
|
-
const $ = B("FmButton"),
|
|
727
|
+
const $ = B("FmButton"), E = B("FmSelect"), N = B("FmTextarea"), O = B("FmCard");
|
|
728
728
|
return V(), ne(O, {
|
|
729
729
|
variant: "outlined",
|
|
730
730
|
class: "grid grid-cols-2 gap-8 p-16"
|
|
@@ -732,20 +732,20 @@ const We = {
|
|
|
732
732
|
default: M(() => [
|
|
733
733
|
e("div", Io, [
|
|
734
734
|
e("div", Ho, [
|
|
735
|
-
e("div", To,
|
|
736
|
-
e("div",
|
|
735
|
+
e("div", To, p(t.modelValue.doc.name), 1),
|
|
736
|
+
e("div", Eo, p(t.modelValue.doc.code), 1)
|
|
737
737
|
]),
|
|
738
738
|
_($, {
|
|
739
739
|
variant: "tertiary",
|
|
740
740
|
"prepend-icon": "delete",
|
|
741
|
-
onClick: n[0] || (n[0] = (L) =>
|
|
741
|
+
onClick: n[0] || (n[0] = (L) => y("click:delete"))
|
|
742
742
|
})
|
|
743
743
|
]),
|
|
744
|
-
_(
|
|
744
|
+
_(E, {
|
|
745
745
|
disabled: t.disabled,
|
|
746
746
|
class: "col-span-2",
|
|
747
747
|
label: "Type",
|
|
748
|
-
items:
|
|
748
|
+
items: d.value,
|
|
749
749
|
modelValue: b.value,
|
|
750
750
|
"onUpdate:modelValue": n[1] || (n[1] = (L) => b.value = L),
|
|
751
751
|
rules: [s(Xt)()],
|
|
@@ -762,10 +762,10 @@ const We = {
|
|
|
762
762
|
"onUpdate:modelValue": n[2] || (n[2] = (L) => R.value = L),
|
|
763
763
|
rules: [s(Ue)(0)]
|
|
764
764
|
}, null, 8, ["disabled", "step", "modelValue", "rules"]),
|
|
765
|
-
_(
|
|
765
|
+
_(E, {
|
|
766
766
|
disabled: t.disabled,
|
|
767
767
|
label: "Unit",
|
|
768
|
-
items:
|
|
768
|
+
items: r.value,
|
|
769
769
|
modelValue: C.value,
|
|
770
770
|
"onUpdate:modelValue": n[3] || (n[3] = (L) => C.value = L)
|
|
771
771
|
}, null, 8, ["disabled", "items", "modelValue"]),
|
|
@@ -773,16 +773,16 @@ const We = {
|
|
|
773
773
|
class: "col-span-2",
|
|
774
774
|
disabled: t.disabled,
|
|
775
775
|
label: "Remark",
|
|
776
|
-
modelValue:
|
|
777
|
-
"onUpdate:modelValue": n[4] || (n[4] = (L) =>
|
|
776
|
+
modelValue: l.value,
|
|
777
|
+
"onUpdate:modelValue": n[4] || (n[4] = (L) => l.value = L),
|
|
778
778
|
"label-mark": "optional"
|
|
779
779
|
}, null, 8, ["disabled", "modelValue"]),
|
|
780
780
|
e("div", Uo, [
|
|
781
|
-
e("div",
|
|
781
|
+
e("div", Po, p(s(S)("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
|
-
},
|
|
785
|
-
t.isBackdate ? (V(), q("div", Ro,
|
|
784
|
+
}, p(w.value), 3),
|
|
785
|
+
t.isBackdate ? (V(), q("div", Ro, p(s(S)("inventory.stock.stock_adjustment.backdatePreviewWarning")), 1)) : se("", !0)
|
|
786
786
|
])
|
|
787
787
|
]),
|
|
788
788
|
_: 1
|
|
@@ -796,13 +796,13 @@ const We = {
|
|
|
796
796
|
show: { type: Boolean }
|
|
797
797
|
},
|
|
798
798
|
emits: ["update:show", "submitted"],
|
|
799
|
-
setup(
|
|
800
|
-
const
|
|
801
|
-
function
|
|
802
|
-
|
|
799
|
+
setup(A, { expose: u, emit: k }) {
|
|
800
|
+
const y = A, S = k, j = Ne(), d = Le(), r = Ae(), b = we(), R = Y(!1), { t: C } = pe();
|
|
801
|
+
function l() {
|
|
802
|
+
w(Re(m));
|
|
803
803
|
}
|
|
804
804
|
const a = Y();
|
|
805
|
-
|
|
805
|
+
u({
|
|
806
806
|
validateInputs: () => {
|
|
807
807
|
var n, $;
|
|
808
808
|
($ = (n = a.value) == null ? void 0 : n.validateInputs) == null || $.call(n);
|
|
@@ -816,45 +816,45 @@ const We = {
|
|
|
816
816
|
($ = (n = a.value) == null ? void 0 : n.resetInputs) == null || $.call(n);
|
|
817
817
|
}
|
|
818
818
|
});
|
|
819
|
-
const D = Ye(
|
|
819
|
+
const D = Ye(y, "show"), m = _t({
|
|
820
820
|
remark: "",
|
|
821
821
|
adjustments: [
|
|
822
822
|
{
|
|
823
823
|
id: `sku_${(/* @__PURE__ */ new Date()).toISOString()}_${Math.random().toString(16).slice(2, 8)}`,
|
|
824
824
|
type: ie.enum.PURCHASE,
|
|
825
|
-
doc:
|
|
825
|
+
doc: y.stock,
|
|
826
826
|
measurement: null,
|
|
827
827
|
remark: "",
|
|
828
828
|
amount: xe(1)
|
|
829
829
|
}
|
|
830
830
|
]
|
|
831
831
|
});
|
|
832
|
-
Fe([() =>
|
|
833
|
-
n && (
|
|
832
|
+
Fe([() => y.show], ([n]) => {
|
|
833
|
+
n && (m.remark = "", m.adjustments = [
|
|
834
834
|
{
|
|
835
835
|
id: `sku_${(/* @__PURE__ */ new Date()).toISOString()}_${Math.random().toString(16).slice(2, 8)}`,
|
|
836
836
|
type: ie.enum.PURCHASE,
|
|
837
|
-
doc:
|
|
837
|
+
doc: y.stock,
|
|
838
838
|
measurement: null,
|
|
839
839
|
remark: "",
|
|
840
840
|
amount: xe(1)
|
|
841
841
|
}
|
|
842
842
|
]);
|
|
843
843
|
});
|
|
844
|
-
async function
|
|
844
|
+
async function w(n) {
|
|
845
845
|
R.value = !0;
|
|
846
846
|
try {
|
|
847
|
-
await
|
|
847
|
+
await r.adjustSku({
|
|
848
848
|
remark: n.remark,
|
|
849
|
-
adjustments: n.adjustments.map(({ doc: $, remark:
|
|
849
|
+
adjustments: n.adjustments.map(({ doc: $, remark: E, type: N, amount: O, measurement: L }) => ({
|
|
850
850
|
id: $._id,
|
|
851
851
|
amount: O,
|
|
852
852
|
measurement: L,
|
|
853
|
-
remark:
|
|
853
|
+
remark: E,
|
|
854
854
|
doc: $,
|
|
855
855
|
type: N
|
|
856
856
|
}))
|
|
857
|
-
}),
|
|
857
|
+
}), S("update:show", !1), S("submitted");
|
|
858
858
|
} catch ($) {
|
|
859
859
|
b.open({
|
|
860
860
|
title: C("inventory.stock.adjust.error.title"),
|
|
@@ -866,12 +866,12 @@ const We = {
|
|
|
866
866
|
}
|
|
867
867
|
}
|
|
868
868
|
function o() {
|
|
869
|
-
const n = j.skus.map((
|
|
870
|
-
label:
|
|
871
|
-
sublabel:
|
|
872
|
-
value:
|
|
873
|
-
})), $ = n.filter((
|
|
874
|
-
|
|
869
|
+
const n = j.skus.map((E) => ({
|
|
870
|
+
label: E.name,
|
|
871
|
+
sublabel: E.code,
|
|
872
|
+
value: E._id
|
|
873
|
+
})), $ = n.filter((E) => m.adjustments.find((N) => N.doc._id === E.value)).map((E) => E.value);
|
|
874
|
+
d.open({
|
|
875
875
|
title: "Select ingredients",
|
|
876
876
|
contentComponent: St,
|
|
877
877
|
contentComponentProps: {
|
|
@@ -890,9 +890,9 @@ const We = {
|
|
|
890
890
|
close: !0,
|
|
891
891
|
variant: "tertiary"
|
|
892
892
|
}
|
|
893
|
-
}).onPrimary((
|
|
894
|
-
|
|
895
|
-
(N) =>
|
|
893
|
+
}).onPrimary((E) => {
|
|
894
|
+
m.adjustments = E.map(
|
|
895
|
+
(N) => m.adjustments.find((O) => O.doc._id === N) ?? {
|
|
896
896
|
id: `sku_${(/* @__PURE__ */ new Date()).toISOString()}_${Math.random().toString(16).slice(2, 8)}`,
|
|
897
897
|
type: ie.enum.PURCHASE,
|
|
898
898
|
doc: j.skus.find((O) => O._id === N),
|
|
@@ -904,19 +904,19 @@ const We = {
|
|
|
904
904
|
});
|
|
905
905
|
}
|
|
906
906
|
function t(n) {
|
|
907
|
-
|
|
907
|
+
m.adjustments.splice(n, 1);
|
|
908
908
|
}
|
|
909
909
|
return (n, $) => {
|
|
910
|
-
const
|
|
910
|
+
const E = B("FmTextarea"), N = B("FmButton"), O = B("FmForm"), L = B("FmSideSheet");
|
|
911
911
|
return V(), ne(L, {
|
|
912
912
|
modelValue: s(D),
|
|
913
|
-
"onUpdate:modelValue": $[2] || ($[2] = (X) =>
|
|
913
|
+
"onUpdate:modelValue": $[2] || ($[2] = (X) => Pe(D) ? D.value = X : null),
|
|
914
914
|
"dismiss-away": "",
|
|
915
915
|
"max-width": 500
|
|
916
916
|
}, {
|
|
917
917
|
"side-sheet-header": M(() => [
|
|
918
918
|
e("div", No, [
|
|
919
|
-
e("div", Oo,
|
|
919
|
+
e("div", Oo, p(s(C)("inventory.stock.adjust.title")), 1)
|
|
920
920
|
])
|
|
921
921
|
]),
|
|
922
922
|
default: M(() => [
|
|
@@ -924,16 +924,16 @@ const We = {
|
|
|
924
924
|
class: "w-full flex flex-col gap-12",
|
|
925
925
|
ref_key: "formRef",
|
|
926
926
|
ref: a,
|
|
927
|
-
onValidationSuccess:
|
|
927
|
+
onValidationSuccess: l
|
|
928
928
|
}, {
|
|
929
929
|
default: M(() => [
|
|
930
|
-
_(
|
|
930
|
+
_(E, {
|
|
931
931
|
label: s(C)("inventory.stock.adjust.remark"),
|
|
932
|
-
modelValue:
|
|
933
|
-
"onUpdate:modelValue": $[0] || ($[0] = (X) =>
|
|
932
|
+
modelValue: m.remark,
|
|
933
|
+
"onUpdate:modelValue": $[0] || ($[0] = (X) => m.remark = X)
|
|
934
934
|
}, null, 8, ["label", "modelValue"]),
|
|
935
935
|
e("div", Lo, [
|
|
936
|
-
e("div", Yo,
|
|
936
|
+
e("div", Yo, p(s(C)("inventory.stock.adjust.adjustedItems")), 1),
|
|
937
937
|
_(N, {
|
|
938
938
|
"prepend-icon": "add",
|
|
939
939
|
variant: "tertiary",
|
|
@@ -941,10 +941,10 @@ const We = {
|
|
|
941
941
|
onClick: o
|
|
942
942
|
})
|
|
943
943
|
]),
|
|
944
|
-
(V(!0), q(ue, null, fe(
|
|
944
|
+
(V(!0), q(ue, null, fe(m.adjustments, (X, z) => (V(), ne($t, {
|
|
945
945
|
key: X.id,
|
|
946
|
-
modelValue:
|
|
947
|
-
"onUpdate:modelValue": (K) =>
|
|
946
|
+
modelValue: m.adjustments[z],
|
|
947
|
+
"onUpdate:modelValue": (K) => m.adjustments[z] = K,
|
|
948
948
|
"onClick:delete": (K) => t(z)
|
|
949
949
|
}, null, 8, ["modelValue", "onUpdate:modelValue", "onClick:delete"]))), 128))
|
|
950
950
|
]),
|
|
@@ -976,35 +976,35 @@ const We = {
|
|
|
976
976
|
show: { type: Boolean }
|
|
977
977
|
},
|
|
978
978
|
emits: ["update:show", "submitted"],
|
|
979
|
-
setup(
|
|
980
|
-
const k =
|
|
979
|
+
setup(A, { emit: u }) {
|
|
980
|
+
const k = A, y = u, { t: S } = pe(), j = Ne(), d = Ae(), r = Le(), b = 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")),
|
|
985
|
-
Fe([D,
|
|
986
|
-
if (D.value &&
|
|
987
|
-
const K = ke(`${D.value} ${
|
|
988
|
-
K.isValid() && (
|
|
984
|
+
}), a = Y(!1), D = Y(ke().format("YYYY-MM-DD")), m = Y(ke().format("HH:mm")), w = Y();
|
|
985
|
+
Fe([D, m], () => {
|
|
986
|
+
if (D.value && m.value) {
|
|
987
|
+
const K = ke(`${D.value} ${m.value}`, "YYYY-MM-DD HH:mm");
|
|
988
|
+
K.isValid() && (l.effectiveAt = K.toDate());
|
|
989
989
|
}
|
|
990
990
|
});
|
|
991
|
-
const o = T(() => `${D.value} ${
|
|
991
|
+
const o = T(() => `${D.value} ${m.value}`);
|
|
992
992
|
function t() {
|
|
993
993
|
if (!a.value) return !0;
|
|
994
|
-
const K = ke(`${D.value} ${
|
|
995
|
-
if (!K.isValid()) return
|
|
994
|
+
const K = ke(`${D.value} ${m.value}`, "YYYY-MM-DD HH:mm");
|
|
995
|
+
if (!K.isValid()) return S("inventory.stock.stock_adjustment.invalidDateTime");
|
|
996
996
|
const U = ke();
|
|
997
997
|
if (K.isAfter(U))
|
|
998
|
-
return
|
|
998
|
+
return S("inventory.stock.stock_adjustment.futureDateNotAllowed");
|
|
999
999
|
const Z = U.subtract(yt, "day");
|
|
1000
|
-
return K.isBefore(Z) ?
|
|
1000
|
+
return K.isBefore(Z) ? S("inventory.stock.stock_adjustment.backdateLimitError", { days: yt }) : !0;
|
|
1001
1001
|
}
|
|
1002
|
-
const n = T(() => [() => t()]), $ = T(() =>
|
|
1003
|
-
function
|
|
1004
|
-
|
|
1002
|
+
const n = T(() => [() => t()]), $ = T(() => l.adjustments.length === 0 || t() !== !0);
|
|
1003
|
+
function E() {
|
|
1004
|
+
l.remark = "", l.effectiveAt = /* @__PURE__ */ new Date(), l.adjustments = [], a.value = !1, D.value = ke(l.effectiveAt).format("YYYY-MM-DD"), m.value = ke(l.effectiveAt).format("HH:mm");
|
|
1005
1005
|
}
|
|
1006
1006
|
function N() {
|
|
1007
|
-
|
|
1007
|
+
E();
|
|
1008
1008
|
}
|
|
1009
1009
|
const O = T(() => {
|
|
1010
1010
|
const K = {};
|
|
@@ -1017,9 +1017,9 @@ const We = {
|
|
|
1017
1017
|
label: Z.name,
|
|
1018
1018
|
sublabel: Z.code,
|
|
1019
1019
|
value: Z._id
|
|
1020
|
-
})), U =
|
|
1021
|
-
|
|
1022
|
-
title:
|
|
1020
|
+
})), U = l.adjustments.map((Z) => Z.doc._id);
|
|
1021
|
+
r.open({
|
|
1022
|
+
title: S("inventory.stock.adjust.selectIngredients"),
|
|
1023
1023
|
contentComponent: St,
|
|
1024
1024
|
contentComponentProps: {
|
|
1025
1025
|
items: K,
|
|
@@ -1030,20 +1030,20 @@ const We = {
|
|
|
1030
1030
|
closeButton: !0,
|
|
1031
1031
|
dismissAway: !0,
|
|
1032
1032
|
primaryActions: {
|
|
1033
|
-
text:
|
|
1033
|
+
text: S("common.confirm"),
|
|
1034
1034
|
close: !0
|
|
1035
1035
|
},
|
|
1036
1036
|
secondaryActions: {
|
|
1037
|
-
text:
|
|
1037
|
+
text: S("common.close"),
|
|
1038
1038
|
close: !0,
|
|
1039
1039
|
variant: "tertiary"
|
|
1040
1040
|
}
|
|
1041
1041
|
}).onPrimary((Z) => {
|
|
1042
|
-
|
|
1043
|
-
(
|
|
1042
|
+
l.adjustments = Z.map(
|
|
1043
|
+
(re) => l.adjustments.find((g) => g.doc._id === re) ?? {
|
|
1044
1044
|
id: "",
|
|
1045
1045
|
type: ie.enum.PURCHASE,
|
|
1046
|
-
doc: O.value[
|
|
1046
|
+
doc: O.value[re],
|
|
1047
1047
|
measurement: null,
|
|
1048
1048
|
remark: "",
|
|
1049
1049
|
amount: xe(1)
|
|
@@ -1052,38 +1052,38 @@ const We = {
|
|
|
1052
1052
|
});
|
|
1053
1053
|
}
|
|
1054
1054
|
function X(K) {
|
|
1055
|
-
|
|
1055
|
+
l.adjustments.splice(K, 1);
|
|
1056
1056
|
}
|
|
1057
1057
|
async function z() {
|
|
1058
|
-
if (
|
|
1058
|
+
if (l.adjustments.length === 0) {
|
|
1059
1059
|
b.open({
|
|
1060
|
-
title:
|
|
1061
|
-
message:
|
|
1060
|
+
title: S("inventory.stock.error.title"),
|
|
1061
|
+
message: S("inventory.stock.stock_adjustment.noAdjustments"),
|
|
1062
1062
|
type: "warning"
|
|
1063
1063
|
});
|
|
1064
1064
|
return;
|
|
1065
1065
|
}
|
|
1066
1066
|
C.value = !0;
|
|
1067
1067
|
try {
|
|
1068
|
-
const K =
|
|
1069
|
-
({ doc: Z, remark:
|
|
1068
|
+
const K = l.adjustments.map(
|
|
1069
|
+
({ doc: Z, remark: re, type: g, amount: F, measurement: G }) => ({
|
|
1070
1070
|
id: Z._id,
|
|
1071
|
-
amount:
|
|
1071
|
+
amount: F,
|
|
1072
1072
|
measurement: G,
|
|
1073
|
-
remark:
|
|
1073
|
+
remark: re,
|
|
1074
1074
|
doc: Z,
|
|
1075
1075
|
type: g
|
|
1076
1076
|
})
|
|
1077
1077
|
), U = {
|
|
1078
|
-
remark:
|
|
1078
|
+
remark: l.remark,
|
|
1079
1079
|
adjustments: K,
|
|
1080
|
-
...a.value ? { effectiveAt:
|
|
1080
|
+
...a.value ? { effectiveAt: l.effectiveAt.toISOString() } : {}
|
|
1081
1081
|
};
|
|
1082
|
-
await
|
|
1082
|
+
await d.adjustSku(Re(U)), y("submitted"), y("update:show", !1);
|
|
1083
1083
|
} catch (K) {
|
|
1084
1084
|
b.open({
|
|
1085
|
-
title:
|
|
1086
|
-
message:
|
|
1085
|
+
title: S("inventory.stock.adjust.error.title"),
|
|
1086
|
+
message: S("inventory.stock.adjust.error.message"),
|
|
1087
1087
|
type: "error"
|
|
1088
1088
|
}), console.error("error on stock adjustment", K);
|
|
1089
1089
|
} finally {
|
|
@@ -1091,57 +1091,57 @@ const We = {
|
|
|
1091
1091
|
}
|
|
1092
1092
|
}
|
|
1093
1093
|
return (K, U) => {
|
|
1094
|
-
const Z = B("FmTextarea"),
|
|
1094
|
+
const Z = B("FmTextarea"), re = B("FmSwitch"), g = 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
|
-
"onUpdate:modelValue": U[6] || (U[6] = (
|
|
1097
|
+
"onUpdate:modelValue": U[6] || (U[6] = (c) => Pe(R) ? R.value = c : null),
|
|
1098
1098
|
"dismiss-away": "",
|
|
1099
1099
|
"max-width": 560,
|
|
1100
1100
|
onAfterEnter: N
|
|
1101
1101
|
}, {
|
|
1102
1102
|
"side-sheet-header": M(() => [
|
|
1103
1103
|
e("div", Wo, [
|
|
1104
|
-
e("div", Ko,
|
|
1104
|
+
e("div", Ko, p(s(S)("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: w,
|
|
1112
1112
|
onValidationSuccess: z
|
|
1113
1113
|
}, {
|
|
1114
1114
|
default: M(() => [
|
|
1115
1115
|
_(Z, {
|
|
1116
|
-
label: s(
|
|
1117
|
-
modelValue:
|
|
1118
|
-
"onUpdate:modelValue": U[0] || (U[0] = (
|
|
1116
|
+
label: s(S)("inventory.stock.adjust.remark"),
|
|
1117
|
+
modelValue: l.remark,
|
|
1118
|
+
"onUpdate:modelValue": U[0] || (U[0] = (c) => l.remark = c),
|
|
1119
1119
|
"label-mark": "optional"
|
|
1120
1120
|
}, null, 8, ["label", "modelValue"]),
|
|
1121
|
-
_(
|
|
1121
|
+
_(re, {
|
|
1122
1122
|
value: "",
|
|
1123
1123
|
"model-value": a.value,
|
|
1124
|
-
"onUpdate:modelValue": U[1] || (U[1] = (
|
|
1125
|
-
label: s(
|
|
1126
|
-
sublabel: s(
|
|
1124
|
+
"onUpdate:modelValue": U[1] || (U[1] = (c) => a.value = c),
|
|
1125
|
+
label: s(S)("inventory.stock.stock_adjustment.backdateLabel"),
|
|
1126
|
+
sublabel: s(S)("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,
|
|
1130
|
+
e("label", Xo, p(s(S)("inventory.stock.stock_adjustment.effectiveAt")), 1),
|
|
1131
1131
|
e("div", Jo, [
|
|
1132
1132
|
e("div", Qo, [
|
|
1133
1133
|
_(g, {
|
|
1134
1134
|
class: "w-full",
|
|
1135
1135
|
modelValue: D.value,
|
|
1136
|
-
"onUpdate:modelValue": U[2] || (U[2] = (
|
|
1136
|
+
"onUpdate:modelValue": U[2] || (U[2] = (c) => D.value = c),
|
|
1137
1137
|
clearable: !1
|
|
1138
1138
|
}, null, 8, ["modelValue"])
|
|
1139
1139
|
]),
|
|
1140
1140
|
e("div", Zo, [
|
|
1141
|
-
_(
|
|
1141
|
+
_(F, {
|
|
1142
1142
|
class: "w-full",
|
|
1143
|
-
modelValue:
|
|
1144
|
-
"onUpdate:modelValue": U[3] || (U[3] = (
|
|
1143
|
+
modelValue: m.value,
|
|
1144
|
+
"onUpdate:modelValue": U[3] || (U[3] = (c) => m.value = c),
|
|
1145
1145
|
format: "HH:mm"
|
|
1146
1146
|
}, null, 8, ["modelValue"])
|
|
1147
1147
|
])
|
|
@@ -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,
|
|
1153
|
+
e("div", en, p(s(S)("inventory.stock.stock_adjustment.immediateHint")), 1)
|
|
1154
1154
|
])) : se("", !0),
|
|
1155
1155
|
e("div", tn, [
|
|
1156
|
-
e("div", on,
|
|
1156
|
+
e("div", on, p(s(S)("inventory.stock.adjust.adjustedItems")), 1),
|
|
1157
1157
|
_(H, {
|
|
1158
1158
|
"prepend-icon": "add",
|
|
1159
1159
|
variant: "tertiary",
|
|
@@ -1161,12 +1161,12 @@ const We = {
|
|
|
1161
1161
|
onClick: L
|
|
1162
1162
|
})
|
|
1163
1163
|
]),
|
|
1164
|
-
(V(!0), q(ue, null, fe(
|
|
1165
|
-
key:
|
|
1166
|
-
modelValue:
|
|
1167
|
-
"onUpdate:modelValue": (
|
|
1164
|
+
(V(!0), q(ue, null, fe(l.adjustments, (c, h) => (V(), ne($t, {
|
|
1165
|
+
key: c.doc._id,
|
|
1166
|
+
modelValue: l.adjustments[h],
|
|
1167
|
+
"onUpdate:modelValue": (f) => l.adjustments[h] = f,
|
|
1168
1168
|
"is-backdate": a.value,
|
|
1169
|
-
"onClick:delete": (
|
|
1169
|
+
"onClick:delete": (f) => X(h)
|
|
1170
1170
|
}, null, 8, ["modelValue", "onUpdate:modelValue", "is-backdate", "onClick:delete"]))), 128))
|
|
1171
1171
|
]),
|
|
1172
1172
|
_: 1
|
|
@@ -1175,18 +1175,18 @@ const We = {
|
|
|
1175
1175
|
"side-sheet-footer": M(() => [
|
|
1176
1176
|
e("div", nn, [
|
|
1177
1177
|
_(H, {
|
|
1178
|
-
label: s(
|
|
1178
|
+
label: s(S)("common.confirm"),
|
|
1179
1179
|
loading: C.value,
|
|
1180
1180
|
disabled: $.value,
|
|
1181
|
-
onClick: U[4] || (U[4] = (
|
|
1182
|
-
var h,
|
|
1183
|
-
return (
|
|
1181
|
+
onClick: U[4] || (U[4] = (c) => {
|
|
1182
|
+
var h, f;
|
|
1183
|
+
return (f = (h = w.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(S)("common.close"),
|
|
1188
1188
|
variant: "tertiary",
|
|
1189
|
-
onClick: U[5] || (U[5] = (
|
|
1189
|
+
onClick: U[5] || (U[5] = (c) => y("update:show", !1))
|
|
1190
1190
|
}, null, 8, ["label"])
|
|
1191
1191
|
])
|
|
1192
1192
|
]),
|
|
@@ -1194,27 +1194,27 @@ const We = {
|
|
|
1194
1194
|
}, 8, ["modelValue"]);
|
|
1195
1195
|
};
|
|
1196
1196
|
}
|
|
1197
|
-
}), an = Tt((
|
|
1197
|
+
}), an = Tt((A, u) => ({
|
|
1198
1198
|
// TODO: remove once latest inventory backend has been push
|
|
1199
|
-
async findBillsByBusinessId(k,
|
|
1200
|
-
const j = `${
|
|
1199
|
+
async findBillsByBusinessId(k, y, S) {
|
|
1200
|
+
const j = `${A.businessesBackendUrl}/${k}/reports/find-many`, d = {
|
|
1201
1201
|
// type: TYPE.bill,
|
|
1202
1202
|
type: "bill",
|
|
1203
|
-
restaurantIds:
|
|
1204
|
-
ids:
|
|
1203
|
+
restaurantIds: y,
|
|
1204
|
+
ids: S
|
|
1205
1205
|
};
|
|
1206
|
-
return await
|
|
1206
|
+
return await u.post(j, d);
|
|
1207
1207
|
},
|
|
1208
1208
|
async findBillsById(k) {
|
|
1209
|
-
const
|
|
1209
|
+
const S = Se().currentLocationDBName, j = `${A.inventoryBackendUrl}/${S}/bill/search`, d = {
|
|
1210
1210
|
ids: k
|
|
1211
1211
|
};
|
|
1212
|
-
return await
|
|
1212
|
+
return await u.post(j, d);
|
|
1213
1213
|
}
|
|
1214
|
-
})),
|
|
1214
|
+
})), rn = {
|
|
1215
1215
|
key: 0,
|
|
1216
1216
|
class: "flex justify-center items-center h-32"
|
|
1217
|
-
},
|
|
1217
|
+
}, ln = { class: "mb-3" }, un = { class: "flex flex-col gap-8" }, cn = { class: "flex flex-col text-fm-color-typo-primary mb-3 text-center" }, dn = { class: "text-fm-color-neutral-gray-400 fm-typo-en-body-sm-600" }, mn = { class: "flex flex-col gap-4 text-fm-color-typo-primary mb-3" }, fn = { class: "flex flex-col gap-4 text-fm-color-typo-primary mb-3" }, vn = { class: "flex flex-col gap-4 text-fm-color-typo-primary mb-3" }, pn = { class: "flex flex-col w-full px-2" }, yn = { class: "flex gap-2" }, _n = /* @__PURE__ */ ve({
|
|
1218
1218
|
__name: "AmendAdjustmentForm",
|
|
1219
1219
|
props: /* @__PURE__ */ nt({
|
|
1220
1220
|
adjustmentId: {}
|
|
@@ -1223,35 +1223,35 @@ const We = {
|
|
|
1223
1223
|
modelModifiers: {}
|
|
1224
1224
|
}),
|
|
1225
1225
|
emits: /* @__PURE__ */ nt(["refreshHistory"], ["update:modelValue"]),
|
|
1226
|
-
setup(
|
|
1227
|
-
const k =
|
|
1226
|
+
setup(A, { emit: u }) {
|
|
1227
|
+
const k = A, y = u, S = Ae(), j = jt(A, "modelValue"), d = Y(!1), r = Y(!1), b = 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
|
-
|
|
1233
|
-
const o = await
|
|
1232
|
+
d.value = !0;
|
|
1233
|
+
const o = await S.readSingleAdjustment(k.adjustmentId);
|
|
1234
1234
|
if (!o) throw new Error("Adjustment not found");
|
|
1235
|
-
R.value = o,
|
|
1235
|
+
R.value = o, d.value = !1;
|
|
1236
1236
|
});
|
|
1237
|
-
async function
|
|
1237
|
+
async function l() {
|
|
1238
1238
|
var t, n;
|
|
1239
|
-
if ((n = (t = C == null ? void 0 : C.value) == null ? void 0 : t.validateInputs) == null || n.call(t), !
|
|
1239
|
+
if ((n = (t = C == null ? void 0 : C.value) == null ? void 0 : t.validateInputs) == null || n.call(t), !r.value) return;
|
|
1240
1240
|
const o = {};
|
|
1241
1241
|
Object.keys(j.value || {}).forEach(($) => {
|
|
1242
|
-
var
|
|
1243
|
-
Object.keys(((
|
|
1242
|
+
var E;
|
|
1243
|
+
Object.keys(((E = j.value) == null ? void 0 : E[$]) || {}).forEach((N) => {
|
|
1244
1244
|
var L, X;
|
|
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 S.revertWastageAdjustment({
|
|
1249
1249
|
targetWastageAdjustmentId: k.adjustmentId,
|
|
1250
1250
|
amountsGoingToAdjust: o
|
|
1251
|
-
}),
|
|
1251
|
+
}), y("refreshHistory"), b.value = !1, j.value = {};
|
|
1252
1252
|
}
|
|
1253
1253
|
function a(o) {
|
|
1254
|
-
const { skuId: t, idx: n, unit: $, measurement:
|
|
1254
|
+
const { skuId: t, idx: n, unit: $, measurement: E } = o;
|
|
1255
1255
|
return T({
|
|
1256
1256
|
get: () => {
|
|
1257
1257
|
var L, X, z;
|
|
@@ -1267,7 +1267,7 @@ const We = {
|
|
|
1267
1267
|
precision: $e($)
|
|
1268
1268
|
}),
|
|
1269
1269
|
type: ie.Enum.WASTAGE,
|
|
1270
|
-
measurement:
|
|
1270
|
+
measurement: E
|
|
1271
1271
|
}, j.value = O;
|
|
1272
1272
|
}
|
|
1273
1273
|
});
|
|
@@ -1276,16 +1276,16 @@ const We = {
|
|
|
1276
1276
|
const n = Number(_e.toFormatString({ value: o }));
|
|
1277
1277
|
return t ? Math.abs(n) : n;
|
|
1278
1278
|
}
|
|
1279
|
-
function
|
|
1279
|
+
function m(o, t) {
|
|
1280
1280
|
return t.measurement ? t.measurement.abbrev : o.sku.unit.abbrev;
|
|
1281
1281
|
}
|
|
1282
|
-
function
|
|
1282
|
+
function w(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";
|
|
1286
1286
|
}
|
|
1287
1287
|
return (o, t) => {
|
|
1288
|
-
const n = B("FmIcon"), $ = B("FmStepperField"),
|
|
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
1290
|
modelValue: b.value,
|
|
1291
1291
|
"onUpdate:modelValue": t[4] || (t[4] = (z) => b.value = z),
|
|
@@ -1327,50 +1327,50 @@ const We = {
|
|
|
1327
1327
|
label: "Submit",
|
|
1328
1328
|
size: "md",
|
|
1329
1329
|
variant: "primary",
|
|
1330
|
-
onClick:
|
|
1330
|
+
onClick: l
|
|
1331
1331
|
})
|
|
1332
1332
|
])
|
|
1333
1333
|
])
|
|
1334
1334
|
]),
|
|
1335
1335
|
default: M(() => [
|
|
1336
|
-
|
|
1336
|
+
d.value ? (V(), q("div", rn)) : (V(), ne(N, {
|
|
1337
1337
|
key: 1,
|
|
1338
1338
|
ref_key: "formRef",
|
|
1339
1339
|
ref: C,
|
|
1340
1340
|
onValidationFailed: t[1] || (t[1] = () => {
|
|
1341
|
-
|
|
1341
|
+
r.value = !1;
|
|
1342
1342
|
}),
|
|
1343
1343
|
onValidationSuccess: t[2] || (t[2] = () => {
|
|
1344
|
-
|
|
1344
|
+
r.value = !0;
|
|
1345
1345
|
}),
|
|
1346
1346
|
blameFormChildOnValidationFailed: ""
|
|
1347
1347
|
}, {
|
|
1348
1348
|
default: M(() => [
|
|
1349
|
-
e("p",
|
|
1349
|
+
e("p", ln, [
|
|
1350
1350
|
t[6] || (t[6] = e("b", null, "Date:", -1)),
|
|
1351
1351
|
t[7] || (t[7] = e("br", null, null, -1)),
|
|
1352
|
-
ye(" " +
|
|
1352
|
+
ye(" " + p(s(eo)(s(Et)(R.value._id))), 1)
|
|
1353
1353
|
]),
|
|
1354
1354
|
e("div", un, [
|
|
1355
1355
|
(V(!0), q(ue, null, fe(R.value.skus, (z, K) => (V(), q(ue, { key: K }, [
|
|
1356
|
-
(V(!0), q(ue, null, fe(z.amounts, (U, Z) => (V(), ne(
|
|
1356
|
+
(V(!0), q(ue, null, fe(z.amounts, (U, Z) => (V(), ne(E, {
|
|
1357
1357
|
key: Z,
|
|
1358
1358
|
variant: "outlined",
|
|
1359
1359
|
class: "p-2"
|
|
1360
1360
|
}, {
|
|
1361
1361
|
default: M(() => [
|
|
1362
1362
|
e("div", cn, [
|
|
1363
|
-
e("span", dn,
|
|
1364
|
-
e("span", null,
|
|
1363
|
+
e("span", dn, p(z.sku.code), 1),
|
|
1364
|
+
e("span", null, p(z.sku.name), 1)
|
|
1365
1365
|
]),
|
|
1366
1366
|
t[12] || (t[12] = e("hr", { class: "m-2" }, null, -1)),
|
|
1367
1367
|
e("div", mn, [
|
|
1368
1368
|
t[8] || (t[8] = e("span", { class: "fm-typo-en-body-lg-600" }, "Adjustment type:", -1)),
|
|
1369
|
-
e("span", null,
|
|
1369
|
+
e("span", null, p(U.type), 1)
|
|
1370
1370
|
]),
|
|
1371
1371
|
e("div", fn, [
|
|
1372
1372
|
t[9] || (t[9] = e("span", { class: "fm-typo-en-body-lg-600" }, "Current amount:", -1)),
|
|
1373
|
-
e("span", null,
|
|
1373
|
+
e("span", null, p(s(_e).toFormatString({ value: U.amount })) + " " + p(m(z, U)), 1)
|
|
1374
1374
|
]),
|
|
1375
1375
|
_($, {
|
|
1376
1376
|
"max-fraction-digits": s($e)(z.sku.unit),
|
|
@@ -1379,24 +1379,24 @@ const We = {
|
|
|
1379
1379
|
idx: Z,
|
|
1380
1380
|
unit: z.sku.unit
|
|
1381
1381
|
}).value,
|
|
1382
|
-
"onUpdate:modelValue": (
|
|
1382
|
+
"onUpdate:modelValue": (re) => a({
|
|
1383
1383
|
skuId: z.sku._id,
|
|
1384
1384
|
idx: Z,
|
|
1385
1385
|
unit: z.sku.unit
|
|
1386
|
-
}).value =
|
|
1386
|
+
}).value = re,
|
|
1387
1387
|
class: "mb-3",
|
|
1388
1388
|
label: "Adjust Amount (Leave 0 to skip)",
|
|
1389
1389
|
"helper-text": `Max: ${D(U.amount)}`,
|
|
1390
|
-
"append-text":
|
|
1390
|
+
"append-text": m(z, U),
|
|
1391
1391
|
rules: [
|
|
1392
|
-
(
|
|
1392
|
+
(re) => re <= D(U.amount) || `Cannot be more than ${D(U.amount)}`,
|
|
1393
1393
|
s(Ue)(-1)
|
|
1394
1394
|
]
|
|
1395
1395
|
}, null, 8, ["max-fraction-digits", "model-value", "onUpdate:modelValue", "helper-text", "append-text", "rules"]),
|
|
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(" " +
|
|
1399
|
+
ye(" " + p(w(
|
|
1400
1400
|
U.amount,
|
|
1401
1401
|
s(_e).fromNumber(
|
|
1402
1402
|
a({
|
|
@@ -1405,7 +1405,7 @@ const We = {
|
|
|
1405
1405
|
unit: z.sku.unit
|
|
1406
1406
|
}).value
|
|
1407
1407
|
)
|
|
1408
|
-
)) + " " +
|
|
1408
|
+
)) + " " + p(m(z, U)), 1)
|
|
1409
1409
|
])
|
|
1410
1410
|
]),
|
|
1411
1411
|
_: 2
|
|
@@ -1444,55 +1444,55 @@ const We = {
|
|
|
1444
1444
|
unitCostHistory: { default: () => [] },
|
|
1445
1445
|
costMechanism: { default: "adjustment" }
|
|
1446
1446
|
},
|
|
1447
|
-
setup(
|
|
1448
|
-
const
|
|
1449
|
-
function k(C,
|
|
1450
|
-
if (
|
|
1447
|
+
setup(A) {
|
|
1448
|
+
const u = A;
|
|
1449
|
+
function k(C, l) {
|
|
1450
|
+
if (u.costMechanism === "adjustment")
|
|
1451
1451
|
return null;
|
|
1452
|
-
const a =
|
|
1453
|
-
(
|
|
1452
|
+
const a = u.unitCostHistory.filter(
|
|
1453
|
+
(w) => w.mechanism === u.costMechanism && w.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((w) => {
|
|
1457
|
+
const o = w.meta;
|
|
1458
1458
|
return (o == null ? void 0 : o.adjustmentId) === C;
|
|
1459
1459
|
});
|
|
1460
1460
|
if (D) return D.cost;
|
|
1461
|
-
const
|
|
1462
|
-
return
|
|
1461
|
+
const m = [...a].filter((w) => new Date(w.snapshotAt) <= new Date(l)).sort((w, o) => new Date(o.snapshotAt).getTime() - new Date(w.snapshotAt).getTime());
|
|
1462
|
+
return m.length > 0 ? m[0].cost : null;
|
|
1463
1463
|
}
|
|
1464
|
-
const
|
|
1464
|
+
const y = Y(!1), S = 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 = S.value) == null ? void 0 : C.scrollHeight) || 0;
|
|
1468
1468
|
});
|
|
1469
|
-
const
|
|
1470
|
-
var
|
|
1471
|
-
const C =
|
|
1469
|
+
const r = T(() => {
|
|
1470
|
+
var w;
|
|
1471
|
+
const C = u.record.adjustments, l = u.sku, a = {}, m = C.flatMap((o) => {
|
|
1472
1472
|
var t;
|
|
1473
|
-
return ((t = o.skus) == null ? void 0 : t.filter((n) => n.sku._id ===
|
|
1473
|
+
return ((t = o.skus) == null ? void 0 : t.filter((n) => n.sku._id === l._id)) ?? [];
|
|
1474
1474
|
}).flatMap((o) => o.amounts);
|
|
1475
|
-
for (const o of
|
|
1475
|
+
for (const o of m) {
|
|
1476
1476
|
const t = o.measurement ? xt(o.measurement.conversion, o.amount) : o.amount;
|
|
1477
|
-
a[
|
|
1477
|
+
a[w = o.type] ?? (a[w] = { 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
|
|
1481
1481
|
`${oe.toFormatString({
|
|
1482
1482
|
value: n,
|
|
1483
1483
|
precision: 4
|
|
1484
|
-
})} ${
|
|
1484
|
+
})} ${l.unit.abbrev}`, o),
|
|
1485
1485
|
{}
|
|
1486
1486
|
);
|
|
1487
|
-
}), { t: b } = pe(), R = T(() =>
|
|
1487
|
+
}), { t: b } = pe(), R = T(() => u.record.adjustmentsByTime.map(({ date: C, adjustments: l }) => ({
|
|
1488
1488
|
time: to(new Date(C)),
|
|
1489
|
-
adjustments:
|
|
1489
|
+
adjustments: l.flatMap(
|
|
1490
1490
|
(a) => {
|
|
1491
|
-
var D,
|
|
1492
|
-
return ((
|
|
1491
|
+
var D, m;
|
|
1492
|
+
return ((m = (D = a.skus) == null ? void 0 : D.map) == null ? void 0 : m.call(D, (w) => {
|
|
1493
1493
|
var o, t;
|
|
1494
1494
|
return {
|
|
1495
|
-
...
|
|
1495
|
+
...w,
|
|
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 =
|
|
1508
|
+
const D = (t = u.bills.find((n) => n._id === a.ref)) == null ? void 0 : t.seqNumber, m = D ? b("inventory.stock.record.bill", [D]) : "", w = a.adjustmentTime ?? (/* @__PURE__ */ new Date()).toISOString(), o = k(a.adjustmentId, w);
|
|
1509
1509
|
return (a.amounts || []).filter((n) => n != null).map((n) => {
|
|
1510
1510
|
var N;
|
|
1511
1511
|
let $ = n.cost;
|
|
@@ -1519,13 +1519,13 @@ const We = {
|
|
|
1519
1519
|
currency: o.currency
|
|
1520
1520
|
};
|
|
1521
1521
|
}
|
|
1522
|
-
let
|
|
1523
|
-
return
|
|
1522
|
+
let E = "";
|
|
1523
|
+
return m ? E = n.remark || "" : E = [a.adjustmentRemark, n.remark].filter((L) => L).join("/"), {
|
|
1524
1524
|
amount: `${oe.toFormatString({ value: n.amount, precision: 4 })} ${((N = n.measurement) == null ? void 0 : N.abbrev) ?? a.sku.unit.abbrev}`,
|
|
1525
1525
|
backdateFrom: a.backdateFrom,
|
|
1526
1526
|
name: n.type,
|
|
1527
|
-
billRemark:
|
|
1528
|
-
remark:
|
|
1527
|
+
billRemark: m,
|
|
1528
|
+
remark: E,
|
|
1529
1529
|
reason: a.reason || "",
|
|
1530
1530
|
cost: $,
|
|
1531
1531
|
toBalance: oe.toFormatString({
|
|
@@ -1538,59 +1538,59 @@ const We = {
|
|
|
1538
1538
|
});
|
|
1539
1539
|
})
|
|
1540
1540
|
})));
|
|
1541
|
-
return (C,
|
|
1542
|
-
const a = B("FmIcon"), D = B("FmTooltip"),
|
|
1543
|
-
return V(), ne(
|
|
1541
|
+
return (C, l) => {
|
|
1542
|
+
const a = B("FmIcon"), D = B("FmTooltip"), m = B("FmCard");
|
|
1543
|
+
return V(), ne(m, { variant: "outlined" }, {
|
|
1544
1544
|
default: M(() => [
|
|
1545
1545
|
e("div", kn, [
|
|
1546
1546
|
e("div", {
|
|
1547
1547
|
class: "flex items-center cursor-pointer mb-1",
|
|
1548
|
-
onClick:
|
|
1548
|
+
onClick: l[0] || (l[0] = (w) => y.value = !y.value)
|
|
1549
1549
|
}, [
|
|
1550
|
-
e("div", hn,
|
|
1550
|
+
e("div", hn, p(C.record.date), 1),
|
|
1551
1551
|
_(a, {
|
|
1552
|
-
name:
|
|
1552
|
+
name: y.value ? "expand_more" : "expand_less",
|
|
1553
1553
|
color: "#777777",
|
|
1554
1554
|
size: "md"
|
|
1555
1555
|
}, null, 8, ["name"])
|
|
1556
1556
|
]),
|
|
1557
|
-
(V(!0), q(ue, null, fe(
|
|
1557
|
+
(V(!0), q(ue, null, fe(r.value, (w, 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,
|
|
1562
|
+
e("div", bn, p(s(b)(`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": w.startsWith("-"),
|
|
1566
|
+
"text-fm-color-typo-success": !w.startsWith("-"),
|
|
1567
1567
|
"ml-auto": !0
|
|
1568
1568
|
})
|
|
1569
|
-
},
|
|
1569
|
+
}, p(w), 3)
|
|
1570
1570
|
]))), 128)),
|
|
1571
1571
|
e("div", {
|
|
1572
1572
|
ref_key: "detailRef",
|
|
1573
|
-
ref:
|
|
1573
|
+
ref: S,
|
|
1574
1574
|
style: kt({
|
|
1575
1575
|
fontSize: "0.8rem",
|
|
1576
|
-
maxHeight:
|
|
1576
|
+
maxHeight: d.value,
|
|
1577
1577
|
overflow: "hidden",
|
|
1578
1578
|
transition: "max-height 0.2s ease-out"
|
|
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, (w) => (V(), q("div", {
|
|
1583
|
+
key: w.time,
|
|
1584
1584
|
class: "flex gap-1 w-full"
|
|
1585
1585
|
}, [
|
|
1586
|
-
e("div", xn,
|
|
1586
|
+
e("div", xn, p(w.time), 1),
|
|
1587
1587
|
e("div", Sn, [
|
|
1588
|
-
(V(!0), q(ue, null, fe(
|
|
1588
|
+
(V(!0), q(ue, null, fe(w.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(
|
|
1593
|
+
ye(p(s(b)(`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,
|
|
1601
|
+
e("div", An, p(s(b)("inventory.stock.record.backdate", [
|
|
1602
1602
|
s(wt)(new Date(o.backdateFrom))
|
|
1603
1603
|
])), 1)
|
|
1604
1604
|
]),
|
|
@@ -1611,11 +1611,11 @@ const We = {
|
|
|
1611
1611
|
]),
|
|
1612
1612
|
_: 2
|
|
1613
1613
|
}, 1024)) : se("", !0),
|
|
1614
|
-
o.billRemark ? (V(), q("span", Fn, " # " +
|
|
1615
|
-
o.billRemark && o.remark ? (V(), q("span", $n, " (" +
|
|
1616
|
-
!o.billRemark && o.reason ? (V(), q("span", jn, " (" +
|
|
1617
|
-
!o.billRemark && o.remark ? (V(), q("span", Vn, " # " +
|
|
1618
|
-
o.name === s(ie).Enum.CLOSING ? (V(), q("span", Cn, " Actual Balance: " +
|
|
1614
|
+
o.billRemark ? (V(), q("span", Fn, " # " + p(o.billRemark), 1)) : se("", !0),
|
|
1615
|
+
o.billRemark && o.remark ? (V(), q("span", $n, " (" + p(o.remark) + ") ", 1)) : se("", !0),
|
|
1616
|
+
!o.billRemark && o.reason ? (V(), q("span", jn, " (" + p(o.reason) + ") ", 1)) : se("", !0),
|
|
1617
|
+
!o.billRemark && o.remark ? (V(), q("span", Vn, " # " + p(o.remark), 1)) : se("", !0),
|
|
1618
|
+
o.name === s(ie).Enum.CLOSING ? (V(), q("span", Cn, " Actual Balance: " + p(o.toBalance) + " " + p(o.baseUnit), 1)) : se("", !0)
|
|
1619
1619
|
]),
|
|
1620
1620
|
e("div", {
|
|
1621
1621
|
class: He({
|
|
@@ -1623,13 +1623,13 @@ const We = {
|
|
|
1623
1623
|
"text-fm-color-typo-success": !o.amount.startsWith("-"),
|
|
1624
1624
|
"ml-auto": !0
|
|
1625
1625
|
})
|
|
1626
|
-
},
|
|
1626
|
+
}, p(o.amount), 3),
|
|
1627
1627
|
o.name === s(ie).Enum.WASTAGE ? (V(), ne(_n, {
|
|
1628
1628
|
key: 0,
|
|
1629
1629
|
adjustmentId: o.adjustmentId,
|
|
1630
|
-
onRefreshHistory:
|
|
1630
|
+
onRefreshHistory: l[1] || (l[1] = (t) => C.$emit("refreshHistory"))
|
|
1631
1631
|
}, null, 8, ["adjustmentId"])) : se("", !0),
|
|
1632
|
-
o.cost ? (V(), q("div", Dn, " (" +
|
|
1632
|
+
o.cost ? (V(), q("div", Dn, " (" + p(s(Me)(o.cost, !1, o.cost.precision)) + ") ", 1)) : se("", !0)
|
|
1633
1633
|
]))), 128))
|
|
1634
1634
|
])
|
|
1635
1635
|
]))), 128))
|
|
@@ -1641,66 +1641,66 @@ const We = {
|
|
|
1641
1641
|
};
|
|
1642
1642
|
}
|
|
1643
1643
|
});
|
|
1644
|
-
function Mn(
|
|
1644
|
+
function Mn(A, u) {
|
|
1645
1645
|
var j;
|
|
1646
1646
|
const k = Object.keys(ie.enum).reduce(
|
|
1647
|
-
(
|
|
1647
|
+
(d, r) => (d[r] = { amount: 0, precision: 0 }, d),
|
|
1648
1648
|
{}
|
|
1649
1649
|
);
|
|
1650
|
-
if (!
|
|
1650
|
+
if (!u)
|
|
1651
1651
|
return Object.entries(k).reduce(
|
|
1652
|
-
(
|
|
1652
|
+
(d, [r]) => (d[r] = oe.fromNumber(0), d),
|
|
1653
1653
|
{}
|
|
1654
1654
|
);
|
|
1655
|
-
const
|
|
1656
|
-
var
|
|
1657
|
-
return ((
|
|
1658
|
-
}).flatMap((
|
|
1659
|
-
for (const
|
|
1660
|
-
const
|
|
1661
|
-
k[j =
|
|
1655
|
+
const S = A.flatMap((d) => {
|
|
1656
|
+
var r;
|
|
1657
|
+
return ((r = d.skus) == null ? void 0 : r.filter((b) => b.sku._id === u._id)) ?? [];
|
|
1658
|
+
}).flatMap((d) => d.amounts);
|
|
1659
|
+
for (const d of S) {
|
|
1660
|
+
const r = d.measurement ? oe.multiply([d.measurement.conversion, d.amount]) : d.amount;
|
|
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
|
-
(
|
|
1664
|
+
(d, [r, b]) => {
|
|
1665
1665
|
const R = {
|
|
1666
1666
|
...b,
|
|
1667
1667
|
amount: Math.abs(b.amount)
|
|
1668
1668
|
};
|
|
1669
|
-
return
|
|
1669
|
+
return d[r] = /// comment, because without it formatter makes code uglier
|
|
1670
1670
|
`${oe.toFormatString({
|
|
1671
1671
|
value: R,
|
|
1672
1672
|
precision: 4
|
|
1673
|
-
})} ${
|
|
1673
|
+
})} ${u.unit.abbrev}`, d;
|
|
1674
1674
|
},
|
|
1675
1675
|
{}
|
|
1676
1676
|
);
|
|
1677
1677
|
}
|
|
1678
|
-
function In(
|
|
1679
|
-
if (!
|
|
1678
|
+
function In(A, u) {
|
|
1679
|
+
if (!u)
|
|
1680
1680
|
return null;
|
|
1681
1681
|
let k = null;
|
|
1682
|
-
const
|
|
1683
|
-
var
|
|
1684
|
-
return ((
|
|
1682
|
+
const S = A.flatMap((j) => {
|
|
1683
|
+
var d;
|
|
1684
|
+
return ((d = j.skus) == null ? void 0 : d.filter((r) => r.sku._id === u._id)) ?? [];
|
|
1685
1685
|
}).flatMap((j) => {
|
|
1686
|
-
var
|
|
1687
|
-
return !j.history || ((
|
|
1686
|
+
var d;
|
|
1687
|
+
return !j.history || ((d = j.history) == null ? void 0 : d.length) === 0 ? [] : j.history[0];
|
|
1688
1688
|
});
|
|
1689
|
-
for (const j of
|
|
1690
|
-
const
|
|
1691
|
-
for (const
|
|
1692
|
-
if (
|
|
1689
|
+
for (const j of S) {
|
|
1690
|
+
const d = j.amounts;
|
|
1691
|
+
for (const r of d) {
|
|
1692
|
+
if (r.type !== ie.Enum.SALES)
|
|
1693
1693
|
continue;
|
|
1694
|
-
const b =
|
|
1694
|
+
const b = r.measurement ? oe.multiply([r.measurement.conversion, r.amount]) : r.amount;
|
|
1695
1695
|
k ?? (k = oe.fromNumber(0)), k = oe.add([k, b]);
|
|
1696
1696
|
}
|
|
1697
1697
|
}
|
|
1698
1698
|
return k != null ? (k.amount = Math.abs(k.amount), `${oe.toFormatString({
|
|
1699
1699
|
value: k,
|
|
1700
1700
|
precision: 4
|
|
1701
|
-
})} ${
|
|
1701
|
+
})} ${u.unit.abbrev}`) : null;
|
|
1702
1702
|
}
|
|
1703
|
-
const Hn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Tn = { class: "flex-1 line-clamp-2" },
|
|
1703
|
+
const Hn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Tn = { class: "flex-1 line-clamp-2" }, En = { class: "flex flex-col gap-32 w-full h-full" }, Un = { class: "flex items-center relative gap-4" }, Pn = { class: "flex-1" }, Rn = {
|
|
1704
1704
|
key: 0,
|
|
1705
1705
|
class: "flex-1 flex flex-col items-center gap-16"
|
|
1706
1706
|
}, Nn = { class: "fm-typo-en-body-lg-400 translate-x-4" }, On = {
|
|
@@ -1709,7 +1709,7 @@ const Hn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Tn = {
|
|
|
1709
1709
|
}, Ln = { class: "pb-16" }, Yn = { class: "fm-typo-cn-body-lg-600" }, zn = {
|
|
1710
1710
|
class: "grid gap-12 fm-typo-en-body-md-400",
|
|
1711
1711
|
style: { "grid-template-columns": "auto auto auto", "grid-auto-rows": "1fr" }
|
|
1712
|
-
}, Gn = { class: "flex flex-col gap-1" }, Wn = { class: "text-fm-color-typo-secondary" }, Kn = { class: "font-bold" }, qn = { class: "flex flex-col gap-1" }, Xn = { class: "text-fm-color-typo-secondary flex" }, Jn = { class: "font-bold" }, Qn = { class: "flex flex-col gap-1" }, Zn = { class: "text-fm-color-typo-secondary" }, es = { class: "font-bold" }, ts = { class: "flex flex-col gap-1" }, os = { class: "text-fm-color-typo-secondary" }, ns = { class: "font-bold" }, ss = { class: "flex flex-col gap-1" }, as = { class: "text-fm-color-typo-secondary" },
|
|
1712
|
+
}, Gn = { class: "flex flex-col gap-1" }, Wn = { class: "text-fm-color-typo-secondary" }, Kn = { class: "font-bold" }, qn = { class: "flex flex-col gap-1" }, Xn = { class: "text-fm-color-typo-secondary flex" }, Jn = { class: "font-bold" }, Qn = { class: "flex flex-col gap-1" }, Zn = { class: "text-fm-color-typo-secondary" }, es = { class: "font-bold" }, ts = { class: "flex flex-col gap-1" }, os = { class: "text-fm-color-typo-secondary" }, ns = { class: "font-bold" }, ss = { class: "flex flex-col gap-1" }, as = { class: "text-fm-color-typo-secondary" }, rs = { class: "font-bold" }, ls = { class: "flex flex-col gap-1" }, is = { class: "text-fm-color-typo-secondary" }, us = { class: "font-bold" }, cs = { class: "flex flex-col gap-1" }, ds = { class: "text-fm-color-typo-secondary" }, ms = { class: "font-bold" }, fs = { class: "flex flex-col gap-1" }, vs = { class: "text-fm-color-typo-secondary" }, ps = { class: "font-bold" }, ys = { class: "flex flex-col gap-1" }, _s = { class: "text-fm-color-typo-secondary" }, ks = { class: "font-bold" }, hs = {
|
|
1713
1713
|
key: 0,
|
|
1714
1714
|
class: "flex flex-col gap-8"
|
|
1715
1715
|
}, bs = { class: "flex" }, gs = { class: "flex-1 flex flex-col gap-1" }, xs = { class: "flex gap-1 items-center text-fm-color-typo-secondary" }, Ss = { class: "font-bold" }, ws = { class: "flex-1 flex flex-col gap-1" }, As = { class: "flex gap-1 items-center text-fm-color-typo-secondary" }, Fs = { class: "flex flex-col gap-1" }, $s = { class: "font-bold" }, js = {
|
|
@@ -1722,238 +1722,238 @@ const Hn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Tn = {
|
|
|
1722
1722
|
show: { type: Boolean }
|
|
1723
1723
|
},
|
|
1724
1724
|
emits: ["update:show"],
|
|
1725
|
-
setup(
|
|
1726
|
-
const
|
|
1725
|
+
setup(A) {
|
|
1726
|
+
const u = Xe(), k = Oe(), y = Ae(), S = an(), j = Se(), d = io(), { t: r } = pe(), b = A, R = Y(!1), C = we(), l = Y("adjustment"), a = Y([
|
|
1727
1727
|
{ label: "Adjustment (Default)", value: "adjustment" }
|
|
1728
|
-
]), D = Y([]),
|
|
1729
|
-
async function
|
|
1728
|
+
]), D = Y([]), m = Y(ao(0));
|
|
1729
|
+
async function w() {
|
|
1730
1730
|
R.value = !0;
|
|
1731
1731
|
try {
|
|
1732
1732
|
await N(), await k.readStockBalance();
|
|
1733
|
-
} catch (
|
|
1733
|
+
} catch (c) {
|
|
1734
1734
|
C.open({
|
|
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", b.sku,
|
|
1738
|
+
}), console.log("failed at fetching item adjustment history", b.sku, m, c);
|
|
1739
1739
|
} finally {
|
|
1740
1740
|
R.value = !1;
|
|
1741
1741
|
}
|
|
1742
1742
|
}
|
|
1743
1743
|
qe(() => {
|
|
1744
|
-
|
|
1745
|
-
}), Fe([() =>
|
|
1746
|
-
|
|
1744
|
+
w();
|
|
1745
|
+
}), Fe([() => m.value, () => b.sku], () => {
|
|
1746
|
+
w();
|
|
1747
1747
|
});
|
|
1748
1748
|
const o = Y([]), t = Y([]), n = Y(new Array());
|
|
1749
|
-
function $(
|
|
1750
|
-
return h === "day" ? so(
|
|
1749
|
+
function $(c, h) {
|
|
1750
|
+
return h === "day" ? so(c) : wt(c);
|
|
1751
1751
|
}
|
|
1752
|
-
function
|
|
1753
|
-
const
|
|
1754
|
-
(
|
|
1755
|
-
const
|
|
1756
|
-
if (!
|
|
1757
|
-
return
|
|
1758
|
-
const
|
|
1759
|
-
return
|
|
1752
|
+
function E(c, h) {
|
|
1753
|
+
const f = c.reduce(
|
|
1754
|
+
(v, i) => {
|
|
1755
|
+
const x = i.effectiveAt ?? Te(i._id);
|
|
1756
|
+
if (!x)
|
|
1757
|
+
return v;
|
|
1758
|
+
const P = $(new Date(x), h);
|
|
1759
|
+
return v[P] ?? (v[P] = []), v[P].push(i), v;
|
|
1760
1760
|
},
|
|
1761
1761
|
{}
|
|
1762
1762
|
);
|
|
1763
|
-
return Object.keys(
|
|
1764
|
-
date:
|
|
1765
|
-
adjustments:
|
|
1763
|
+
return Object.keys(f).map((v) => ({
|
|
1764
|
+
date: v,
|
|
1765
|
+
adjustments: f[v]
|
|
1766
1766
|
}));
|
|
1767
1767
|
}
|
|
1768
1768
|
async function N() {
|
|
1769
|
-
let
|
|
1769
|
+
let c = await y.readStockAdjustment(
|
|
1770
1770
|
b.sku._id,
|
|
1771
|
-
dt(new Date(
|
|
1772
|
-
mt(new Date(
|
|
1771
|
+
dt(new Date(m.value.startDate)).toISOString(),
|
|
1772
|
+
mt(new Date(m.value.endDate)).toISOString()
|
|
1773
1773
|
);
|
|
1774
|
-
o.value =
|
|
1775
|
-
const h =
|
|
1776
|
-
await O(h), t.value =
|
|
1777
|
-
date:
|
|
1778
|
-
adjustments:
|
|
1779
|
-
adjustmentsByTime:
|
|
1774
|
+
o.value = c;
|
|
1775
|
+
const h = c.filter(({ ref: f }) => f == null ? void 0 : f.startsWith("bill_")).map(({ ref: f }) => f);
|
|
1776
|
+
await O(h), t.value = E(c, "day").map(({ date: f, adjustments: v }) => ({
|
|
1777
|
+
date: f,
|
|
1778
|
+
adjustments: v,
|
|
1779
|
+
adjustmentsByTime: E(v, "minute")
|
|
1780
1780
|
}));
|
|
1781
1781
|
try {
|
|
1782
|
-
const
|
|
1782
|
+
const f = await y.readUnitCostHistory(
|
|
1783
1783
|
b.sku._id,
|
|
1784
|
-
dt(new Date(
|
|
1785
|
-
mt(new Date(
|
|
1784
|
+
dt(new Date(m.value.startDate)).toISOString(),
|
|
1785
|
+
mt(new Date(m.value.endDate)).toISOString()
|
|
1786
1786
|
);
|
|
1787
|
-
D.value =
|
|
1788
|
-
const
|
|
1789
|
-
|
|
1790
|
-
|
|
1787
|
+
D.value = f;
|
|
1788
|
+
const v = /* @__PURE__ */ new Set();
|
|
1789
|
+
f.forEach((x) => {
|
|
1790
|
+
v.add(x.mechanism);
|
|
1791
1791
|
});
|
|
1792
|
-
const
|
|
1793
|
-
|
|
1792
|
+
const i = [{ label: "Default", value: "adjustment" }];
|
|
1793
|
+
v.has(ge.Enum.weightedAverage) && i.push({
|
|
1794
1794
|
label: "Weighted Average (Beta)",
|
|
1795
1795
|
value: ge.Enum.weightedAverage
|
|
1796
|
-
}),
|
|
1796
|
+
}), v.has(ge.Enum.netsuite) && i.push({ label: "NetSuite (Beta)", value: ge.Enum.netsuite }), v.has(ge.Enum["netsuite-average"]) && i.push({
|
|
1797
1797
|
label: "NetSuite Average (Beta)",
|
|
1798
1798
|
value: ge.Enum["netsuite-average"]
|
|
1799
|
-
}), a.value =
|
|
1800
|
-
} catch (
|
|
1801
|
-
console.error("Failed to fetch unit cost history:",
|
|
1799
|
+
}), a.value = i, !v.has(l.value) && l.value !== "adjustment" && (l.value = "adjustment");
|
|
1800
|
+
} catch (f) {
|
|
1801
|
+
console.error("Failed to fetch unit cost history:", f);
|
|
1802
1802
|
}
|
|
1803
1803
|
}
|
|
1804
|
-
async function O(
|
|
1805
|
-
|
|
1806
|
-
var
|
|
1804
|
+
async function O(c) {
|
|
1805
|
+
c.length && (n.value = await S.findBillsById(c).catch((h) => {
|
|
1806
|
+
var i;
|
|
1807
1807
|
console.error("Error on using latest bill API, retrying using legacy api", h);
|
|
1808
|
-
const
|
|
1809
|
-
return
|
|
1808
|
+
const f = ((i = u.currentBusiness.value) == null ? void 0 : i._id) ?? "", v = j.currentLocation.doc._id;
|
|
1809
|
+
return S.findBillsByBusinessId(f, [v], c);
|
|
1810
1810
|
}));
|
|
1811
1811
|
}
|
|
1812
1812
|
const L = T(() => {
|
|
1813
|
-
const
|
|
1814
|
-
return Mn(
|
|
1813
|
+
const c = o.value, h = b.sku;
|
|
1814
|
+
return Mn(c, h);
|
|
1815
1815
|
}), X = T(() => {
|
|
1816
|
-
const
|
|
1817
|
-
return In(
|
|
1816
|
+
const c = o.value, h = b.sku;
|
|
1817
|
+
return In(c, h);
|
|
1818
1818
|
}), z = T(() => {
|
|
1819
|
-
const
|
|
1820
|
-
var
|
|
1821
|
-
const
|
|
1822
|
-
return
|
|
1819
|
+
const c = [...o.value].computeFirst((f) => {
|
|
1820
|
+
var i, x;
|
|
1821
|
+
const v = (x = (i = f.skus) == null ? void 0 : i.find) == null ? void 0 : x.call(i, (P) => P.sku._id === b.sku._id);
|
|
1822
|
+
return v == null ? void 0 : v.fromBalance;
|
|
1823
1823
|
}) ?? {
|
|
1824
1824
|
amount: 0,
|
|
1825
1825
|
precision: 0
|
|
1826
1826
|
}, h = b.sku;
|
|
1827
1827
|
return h ? `${oe.toFormatString({
|
|
1828
|
-
value:
|
|
1828
|
+
value: c,
|
|
1829
1829
|
precision: 4
|
|
1830
1830
|
})} ${h.unit.abbrev}` : "";
|
|
1831
1831
|
}), K = T(() => {
|
|
1832
|
-
const
|
|
1833
|
-
var
|
|
1834
|
-
const
|
|
1835
|
-
return
|
|
1832
|
+
const c = [...o.value].reverse().computeFirst((f) => {
|
|
1833
|
+
var i, x;
|
|
1834
|
+
const v = (x = (i = f.skus) == null ? void 0 : i.find) == null ? void 0 : x.call(i, (P) => P.sku._id === b.sku._id);
|
|
1835
|
+
return v == null ? void 0 : v.toBalance;
|
|
1836
1836
|
}) ?? {
|
|
1837
1837
|
amount: 0,
|
|
1838
1838
|
precision: 0
|
|
1839
1839
|
}, h = b.sku;
|
|
1840
|
-
return h ? `${oe.toFormatString({ value:
|
|
1840
|
+
return h ? `${oe.toFormatString({ value: c, precision: 4 })} ${h.unit.abbrev}` : "";
|
|
1841
1841
|
}), U = T(() => {
|
|
1842
|
-
var
|
|
1843
|
-
const h = o.value.flatMap((
|
|
1844
|
-
var
|
|
1845
|
-
return ((
|
|
1846
|
-
}).filter((
|
|
1847
|
-
(
|
|
1848
|
-
const
|
|
1849
|
-
if (!
|
|
1850
|
-
const
|
|
1851
|
-
...Wt(
|
|
1852
|
-
currency:
|
|
1842
|
+
var f;
|
|
1843
|
+
const h = o.value.flatMap((v) => {
|
|
1844
|
+
var i;
|
|
1845
|
+
return ((i = v.skus) == null ? void 0 : i.flatMap((x) => x.amounts)) ?? [];
|
|
1846
|
+
}).filter((v) => v.amount.amount < 0).reduce(
|
|
1847
|
+
(v, i) => {
|
|
1848
|
+
const x = i.cost;
|
|
1849
|
+
if (!x) return v;
|
|
1850
|
+
const P = {
|
|
1851
|
+
...Wt(v, Math.max(v.precision, x.precision)),
|
|
1852
|
+
currency: x.currency
|
|
1853
1853
|
};
|
|
1854
1854
|
return {
|
|
1855
|
-
...Qe(
|
|
1856
|
-
currency:
|
|
1855
|
+
...Qe(P, x),
|
|
1856
|
+
currency: v.currency
|
|
1857
1857
|
};
|
|
1858
1858
|
},
|
|
1859
1859
|
{
|
|
1860
1860
|
amount: 0,
|
|
1861
1861
|
precision: 0,
|
|
1862
|
-
currency: Ce((
|
|
1862
|
+
currency: Ce((f = u.currentCountry) == null ? void 0 : f.value)
|
|
1863
1863
|
}
|
|
1864
1864
|
);
|
|
1865
1865
|
return Me(h, !1, h.precision);
|
|
1866
1866
|
});
|
|
1867
1867
|
function Z() {
|
|
1868
|
-
const { startDate:
|
|
1869
|
-
|
|
1870
|
-
startDate:
|
|
1868
|
+
const { startDate: c, endDate: h } = oo(m.value);
|
|
1869
|
+
c !== null && h !== null && (m.value = {
|
|
1870
|
+
startDate: c,
|
|
1871
1871
|
endDate: h
|
|
1872
1872
|
});
|
|
1873
1873
|
}
|
|
1874
|
-
const
|
|
1875
|
-
function g(
|
|
1876
|
-
if (
|
|
1874
|
+
const re = T(() => r("inventory.ingredient.valuationMethod.WAVG"));
|
|
1875
|
+
function g(c, h) {
|
|
1876
|
+
if (l.value === "adjustment")
|
|
1877
1877
|
return null;
|
|
1878
|
-
const
|
|
1879
|
-
(
|
|
1878
|
+
const f = D.value.filter(
|
|
1879
|
+
(x) => x.mechanism === l.value && x.skuId === b.sku._id
|
|
1880
1880
|
);
|
|
1881
|
-
if (
|
|
1882
|
-
const
|
|
1883
|
-
const
|
|
1884
|
-
return (
|
|
1881
|
+
if (f.length === 0) return null;
|
|
1882
|
+
const v = f.find((x) => {
|
|
1883
|
+
const P = x.meta;
|
|
1884
|
+
return (P == null ? void 0 : P.adjustmentId) === c;
|
|
1885
1885
|
});
|
|
1886
|
-
if (
|
|
1887
|
-
const
|
|
1888
|
-
return
|
|
1886
|
+
if (v) return v.cost;
|
|
1887
|
+
const i = [...f].filter((x) => new Date(x.snapshotAt) <= new Date(h)).sort((x, P) => new Date(P.snapshotAt).getTime() - new Date(x.snapshotAt).getTime());
|
|
1888
|
+
return i.length > 0 ? i[0].cost : null;
|
|
1889
1889
|
}
|
|
1890
|
-
const
|
|
1891
|
-
var
|
|
1892
|
-
const
|
|
1890
|
+
const F = T(() => {
|
|
1891
|
+
var v, i, x, P, ee, ae;
|
|
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, (
|
|
1894
|
+
return (te = (W = Q.skus) == null ? void 0 : W.find) == null ? void 0 : te.call(W, (le) => le.sku._id === b.sku._id);
|
|
1895
1895
|
});
|
|
1896
|
-
if (!
|
|
1897
|
-
const h = (
|
|
1896
|
+
if (!c) return "No data";
|
|
1897
|
+
const h = (v = c.skus) == null ? void 0 : v.find((Q) => Q.sku._id === b.sku._id);
|
|
1898
1898
|
if (!h) return "No data";
|
|
1899
|
-
const
|
|
1900
|
-
if (
|
|
1899
|
+
const f = h.toBalance;
|
|
1900
|
+
if (l.value === "adjustment") {
|
|
1901
1901
|
const Q = [...h.amounts].reverse()[0], W = {
|
|
1902
|
-
amount: ((
|
|
1903
|
-
precision: ((
|
|
1904
|
-
}, te = Q.amount,
|
|
1902
|
+
amount: ((i = Q.cost) == null ? void 0 : i.amount) ?? 0,
|
|
1903
|
+
precision: ((x = Q.cost) == null ? void 0 : x.precision) ?? 0
|
|
1904
|
+
}, te = Q.amount, le = te.amount == 0 ? oe.fromNumber(0) : oe.divide([W, te]);
|
|
1905
1905
|
return {
|
|
1906
|
-
...oe.multiply([
|
|
1907
|
-
currency: ((
|
|
1906
|
+
...oe.multiply([le, f]),
|
|
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 =
|
|
1911
|
-
|
|
1910
|
+
const Q = c.effectiveAt ?? Te(c._id), W = g(
|
|
1911
|
+
c._id,
|
|
1912
1912
|
Q ?? (/* @__PURE__ */ new Date()).toISOString()
|
|
1913
1913
|
);
|
|
1914
1914
|
if (!W) return "No data";
|
|
1915
1915
|
const te = oe.fromDinero(W);
|
|
1916
1916
|
return {
|
|
1917
|
-
...oe.multiply([te,
|
|
1918
|
-
currency: W.currency || Ce(((ae =
|
|
1917
|
+
...oe.multiply([te, f]),
|
|
1918
|
+
currency: W.currency || Ce(((ae = u.currentCountry) == null ? void 0 : ae.value) ?? lt)
|
|
1919
1919
|
};
|
|
1920
1920
|
}
|
|
1921
1921
|
}), G = T(() => {
|
|
1922
|
-
var
|
|
1923
|
-
const
|
|
1924
|
-
var
|
|
1925
|
-
const
|
|
1926
|
-
return
|
|
1922
|
+
var f;
|
|
1923
|
+
const c = [...o.value].reverse().computeFirst((v) => {
|
|
1924
|
+
var x, P;
|
|
1925
|
+
const i = (P = (x = v.skus) == null ? void 0 : x.find) == null ? void 0 : P.call(x, (ee) => ee.sku._id === b.sku._id);
|
|
1926
|
+
return i == null ? void 0 : i.toCostBalances;
|
|
1927
1927
|
});
|
|
1928
|
-
return
|
|
1929
|
-
...
|
|
1928
|
+
return c ? {
|
|
1929
|
+
...c.reduce((v, i) => oe.add([v, oe.fromDinero(i.cost)]), {
|
|
1930
1930
|
amount: 0,
|
|
1931
1931
|
precision: 0
|
|
1932
1932
|
}),
|
|
1933
|
-
currency: Ce((
|
|
1933
|
+
currency: Ce((f = u.currentCountry) == null ? void 0 : f.value)
|
|
1934
1934
|
} : "No data";
|
|
1935
|
-
}), H = T(() => b.sku.valuation === it.Enum.FIFO ? G.value :
|
|
1935
|
+
}), H = T(() => b.sku.valuation === it.Enum.FIFO ? G.value : F.value);
|
|
1936
1936
|
function J() {
|
|
1937
|
-
const { startDate:
|
|
1938
|
-
|
|
1939
|
-
startDate:
|
|
1937
|
+
const { startDate: c, endDate: h } = no(m.value);
|
|
1938
|
+
c !== null && h !== null && (m.value = {
|
|
1939
|
+
startDate: c,
|
|
1940
1940
|
endDate: h
|
|
1941
1941
|
});
|
|
1942
1942
|
}
|
|
1943
1943
|
const I = Ye(b, "show");
|
|
1944
|
-
return (
|
|
1945
|
-
const
|
|
1944
|
+
return (c, h) => {
|
|
1945
|
+
const f = B("FmButton"), v = B("FmField"), i = B("FmDateRangePicker"), x = 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),
|
|
1949
|
-
"onUpdate:modelValue": h[5] || (h[5] = (me) =>
|
|
1949
|
+
"onUpdate:modelValue": h[5] || (h[5] = (me) => Pe(I) ? I.value = me : null),
|
|
1950
1950
|
"close-button": !1,
|
|
1951
1951
|
"max-width": 560
|
|
1952
1952
|
}, {
|
|
1953
1953
|
"side-sheet-header": M(() => [
|
|
1954
1954
|
e("div", Hn, [
|
|
1955
|
-
e("div", Tn,
|
|
1956
|
-
_(
|
|
1955
|
+
e("div", Tn, p(s(r)("inventory.stock.history.title", [c.sku.name])), 1),
|
|
1956
|
+
_(f, {
|
|
1957
1957
|
variant: "tertiary",
|
|
1958
1958
|
"prepend-icon": "close",
|
|
1959
1959
|
onClick: h[0] || (h[0] = (me) => I.value = !1)
|
|
@@ -1963,24 +1963,24 @@ const Hn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Tn = {
|
|
|
1963
1963
|
default: M(() => {
|
|
1964
1964
|
var me;
|
|
1965
1965
|
return [
|
|
1966
|
-
e("div",
|
|
1966
|
+
e("div", En, [
|
|
1967
1967
|
e("div", Un, [
|
|
1968
|
-
e("div",
|
|
1969
|
-
_(
|
|
1970
|
-
modelValue:
|
|
1971
|
-
"onUpdate:modelValue": h[1] || (h[1] = (de) =>
|
|
1968
|
+
e("div", Pn, [
|
|
1969
|
+
_(i, {
|
|
1970
|
+
modelValue: m.value,
|
|
1971
|
+
"onUpdate:modelValue": h[1] || (h[1] = (de) => m.value = de),
|
|
1972
1972
|
"show-predefined-range": "",
|
|
1973
1973
|
"start-label": "",
|
|
1974
1974
|
"end-label": "",
|
|
1975
1975
|
"z-index": 50
|
|
1976
1976
|
}, {
|
|
1977
1977
|
"trigger-button": M(({ opened: de }) => [
|
|
1978
|
-
_(
|
|
1978
|
+
_(v, {
|
|
1979
1979
|
"prepend-icon": "calendar_month",
|
|
1980
1980
|
focused: de
|
|
1981
1981
|
}, {
|
|
1982
1982
|
default: M(() => [
|
|
1983
|
-
ye(
|
|
1983
|
+
ye(p(m.value.startDate) + " - " + p(m.value.endDate), 1)
|
|
1984
1984
|
]),
|
|
1985
1985
|
_: 2
|
|
1986
1986
|
}, 1032, ["focused"])
|
|
@@ -1988,39 +1988,39 @@ const Hn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Tn = {
|
|
|
1988
1988
|
_: 1
|
|
1989
1989
|
}, 8, ["modelValue"])
|
|
1990
1990
|
]),
|
|
1991
|
-
_(
|
|
1991
|
+
_(f, {
|
|
1992
1992
|
variant: "tertiary",
|
|
1993
1993
|
onClick: h[2] || (h[2] = (de) => Z()),
|
|
1994
1994
|
"prepend-icon": "navigate_before"
|
|
1995
1995
|
}),
|
|
1996
|
-
_(
|
|
1996
|
+
_(f, {
|
|
1997
1997
|
variant: "tertiary",
|
|
1998
1998
|
onClick: h[3] || (h[3] = (de) => J()),
|
|
1999
1999
|
"prepend-icon": "navigate_next"
|
|
2000
2000
|
})
|
|
2001
2001
|
]),
|
|
2002
2002
|
R.value ? (V(), q("div", Rn, [
|
|
2003
|
-
_(
|
|
2004
|
-
_(
|
|
2005
|
-
e("div", Nn,
|
|
2006
|
-
_(
|
|
2007
|
-
_(
|
|
2003
|
+
_(x),
|
|
2004
|
+
_(P, { size: "xl" }),
|
|
2005
|
+
e("div", Nn, p(s(r)("inventory.stock.history.loading")), 1),
|
|
2006
|
+
_(x),
|
|
2007
|
+
_(x)
|
|
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(() => [
|
|
2011
|
-
_(
|
|
2011
|
+
_(le, { class: "flex flex-col gap-4" }, {
|
|
2012
2012
|
default: M(() => [
|
|
2013
2013
|
e("div", Ln, [
|
|
2014
|
-
e("div", Yn,
|
|
2014
|
+
e("div", Yn, p(s(r)("inventory.stock.history.summary.title")), 1)
|
|
2015
2015
|
]),
|
|
2016
2016
|
e("div", zn, [
|
|
2017
2017
|
e("div", Gn, [
|
|
2018
|
-
e("div", Wn,
|
|
2019
|
-
e("div", Kn,
|
|
2018
|
+
e("div", Wn, p(s(r)("inventory.stock.history.summary.totalPurchase")), 1),
|
|
2019
|
+
e("div", Kn, p(L.value.PURCHASE), 1)
|
|
2020
2020
|
]),
|
|
2021
2021
|
e("div", qn, [
|
|
2022
2022
|
e("div", Xn, [
|
|
2023
|
-
ye(
|
|
2023
|
+
ye(p(s(r)("inventory.stock.history.summary.totalSales")) + " ", 1),
|
|
2024
2024
|
X.value != null ? (V(), ne(ae, {
|
|
2025
2025
|
key: 0,
|
|
2026
2026
|
variant: "plain",
|
|
@@ -2037,49 +2037,49 @@ const Hn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Tn = {
|
|
|
2037
2037
|
_: 1
|
|
2038
2038
|
}, 8, ["content"])) : se("", !0)
|
|
2039
2039
|
]),
|
|
2040
|
-
e("div", Jn,
|
|
2040
|
+
e("div", Jn, p(L.value.SALES), 1)
|
|
2041
2041
|
]),
|
|
2042
2042
|
e("div", Qn, [
|
|
2043
|
-
e("div", Zn,
|
|
2044
|
-
e("div", es,
|
|
2043
|
+
e("div", Zn, p(s(r)("inventory.stock.history.summary.totalLose")), 1),
|
|
2044
|
+
e("div", es, p(L.value.LOSE), 1)
|
|
2045
2045
|
]),
|
|
2046
2046
|
e("div", ts, [
|
|
2047
|
-
e("div", os,
|
|
2048
|
-
e("div", ns,
|
|
2047
|
+
e("div", os, p(s(r)("inventory.stock.history.summary.totalRequest")), 1),
|
|
2048
|
+
e("div", ns, p(L.value.REQUEST), 1)
|
|
2049
2049
|
]),
|
|
2050
2050
|
e("div", ss, [
|
|
2051
|
-
e("div", as,
|
|
2052
|
-
e("div",
|
|
2051
|
+
e("div", as, p(s(r)("inventory.stock.history.summary.totalReceive")), 1),
|
|
2052
|
+
e("div", rs, p(L.value.RECEIVE), 1)
|
|
2053
2053
|
]),
|
|
2054
|
-
e("div",
|
|
2055
|
-
e("div", is,
|
|
2056
|
-
e("div", us,
|
|
2054
|
+
e("div", ls, [
|
|
2055
|
+
e("div", is, p(s(r)("inventory.stock.history.summary.totalConvert")), 1),
|
|
2056
|
+
e("div", us, p(L.value.CONVERT), 1)
|
|
2057
2057
|
]),
|
|
2058
2058
|
e("div", cs, [
|
|
2059
|
-
e("div", ds,
|
|
2060
|
-
e("div", ms,
|
|
2059
|
+
e("div", ds, p(s(r)("inventory.stock.history.summary.totalDamage")), 1),
|
|
2060
|
+
e("div", ms, p(L.value.DAMAGE), 1)
|
|
2061
2061
|
]),
|
|
2062
2062
|
e("div", fs, [
|
|
2063
|
-
e("div", vs,
|
|
2064
|
-
e("div", ps,
|
|
2063
|
+
e("div", vs, p(s(r)("inventory.stock.history.summary.openingBalance")), 1),
|
|
2064
|
+
e("div", ps, p(z.value), 1)
|
|
2065
2065
|
]),
|
|
2066
2066
|
e("div", ys, [
|
|
2067
|
-
e("div", _s,
|
|
2068
|
-
e("div", ks,
|
|
2067
|
+
e("div", _s, p(s(r)("inventory.stock.history.summary.lastStockBalance")), 1),
|
|
2068
|
+
e("div", ks, p(K.value), 1)
|
|
2069
2069
|
])
|
|
2070
2070
|
]),
|
|
2071
|
-
s(
|
|
2071
|
+
s(d).enableTotalCost ? (V(), q("div", hs, [
|
|
2072
2072
|
_(Q, { class: "w-full" }),
|
|
2073
2073
|
e("div", bs, [
|
|
2074
2074
|
e("div", gs, [
|
|
2075
2075
|
_(ut, { "z-index": 50 }, {
|
|
2076
2076
|
default: M(() => [
|
|
2077
2077
|
e("div", xs, [
|
|
2078
|
-
ye(
|
|
2078
|
+
ye(p(s(r)("inventory.stock.history.estimatedValue")) + " ", 1),
|
|
2079
2079
|
_(ae, {
|
|
2080
2080
|
variant: "plain",
|
|
2081
2081
|
placement: "top",
|
|
2082
|
-
content: `[${
|
|
2082
|
+
content: `[${re.value}] ${s(r)("inventory.stock.history.estimatedValueTooltip")}`,
|
|
2083
2083
|
"z-index": 50
|
|
2084
2084
|
}, {
|
|
2085
2085
|
default: M(() => [
|
|
@@ -2095,18 +2095,18 @@ const Hn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Tn = {
|
|
|
2095
2095
|
_: 1
|
|
2096
2096
|
}),
|
|
2097
2097
|
e("div", Ss, [
|
|
2098
|
-
|
|
2098
|
+
c.sku.valuation === s(it).Enum.FIFO ? (V(), q(ue, { key: 0 }, [
|
|
2099
2099
|
_(W, {
|
|
2100
2100
|
label: "FIFO",
|
|
2101
2101
|
compact: ""
|
|
2102
2102
|
}),
|
|
2103
|
-
ye(" " +
|
|
2103
|
+
ye(" " + p(typeof H.value != "string" ? s(Me)(
|
|
2104
2104
|
H.value,
|
|
2105
2105
|
!1,
|
|
2106
2106
|
H.value.precision
|
|
2107
2107
|
) : H.value), 1)
|
|
2108
2108
|
], 64)) : (V(), q(ue, { key: 1 }, [
|
|
2109
|
-
ye(
|
|
2109
|
+
ye(p(typeof H.value != "string" ? s(Me)(
|
|
2110
2110
|
H.value,
|
|
2111
2111
|
!1,
|
|
2112
2112
|
H.value.precision
|
|
@@ -2114,8 +2114,8 @@ const Hn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Tn = {
|
|
|
2114
2114
|
], 64))
|
|
2115
2115
|
]),
|
|
2116
2116
|
_(te, {
|
|
2117
|
-
modelValue:
|
|
2118
|
-
"onUpdate:modelValue": h[4] || (h[4] = (de) =>
|
|
2117
|
+
modelValue: l.value,
|
|
2118
|
+
"onUpdate:modelValue": h[4] || (h[4] = (de) => l.value = de),
|
|
2119
2119
|
items: a.value,
|
|
2120
2120
|
compact: "",
|
|
2121
2121
|
size: "sm",
|
|
@@ -2126,14 +2126,14 @@ const Hn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Tn = {
|
|
|
2126
2126
|
_(ut, { "z-index": 50 }, {
|
|
2127
2127
|
default: M(() => [
|
|
2128
2128
|
e("div", As, [
|
|
2129
|
-
ye(
|
|
2129
|
+
ye(p(s(r)("inventory.stock.history.costSold")) + " ", 1),
|
|
2130
2130
|
_(ae, {
|
|
2131
2131
|
variant: "plain",
|
|
2132
2132
|
placement: "top",
|
|
2133
2133
|
"z-index": 50
|
|
2134
2134
|
}, {
|
|
2135
2135
|
content: M(() => [
|
|
2136
|
-
e("div", Fs,
|
|
2136
|
+
e("div", Fs, p(s(r)("inventory.stock.history.costSoldTooltip")), 1)
|
|
2137
2137
|
]),
|
|
2138
2138
|
default: M(() => [
|
|
2139
2139
|
_(ee, {
|
|
@@ -2147,7 +2147,7 @@ const Hn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Tn = {
|
|
|
2147
2147
|
]),
|
|
2148
2148
|
_: 1
|
|
2149
2149
|
}),
|
|
2150
|
-
e("div", $s,
|
|
2150
|
+
e("div", $s, p(U.value), 1)
|
|
2151
2151
|
])
|
|
2152
2152
|
])
|
|
2153
2153
|
])) : se("", !0)
|
|
@@ -2161,28 +2161,28 @@ const Hn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Tn = {
|
|
|
2161
2161
|
(V(!0), q(ue, null, fe(t.value, (de) => (V(), q(ue, {
|
|
2162
2162
|
key: de.date
|
|
2163
2163
|
}, [
|
|
2164
|
-
|
|
2164
|
+
c.sku ? (V(), ne(Bn, {
|
|
2165
2165
|
key: 0,
|
|
2166
2166
|
record: de,
|
|
2167
|
-
sku:
|
|
2167
|
+
sku: c.sku,
|
|
2168
2168
|
bills: n.value,
|
|
2169
2169
|
"unit-cost-history": D.value,
|
|
2170
|
-
"cost-mechanism":
|
|
2171
|
-
onRefreshHistory:
|
|
2170
|
+
"cost-mechanism": l.value,
|
|
2171
|
+
onRefreshHistory: w
|
|
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
|
+
_(x),
|
|
2176
2176
|
e("div", null, [
|
|
2177
2177
|
e("img", {
|
|
2178
|
-
src: s(
|
|
2178
|
+
src: s(lo),
|
|
2179
2179
|
alt: "List is empty"
|
|
2180
2180
|
}, null, 8, Vs)
|
|
2181
2181
|
]),
|
|
2182
|
-
e("div", Cs,
|
|
2183
|
-
e("div", Ds,
|
|
2184
|
-
_(
|
|
2185
|
-
_(
|
|
2182
|
+
e("div", Cs, p(s(r)("inventory.stock.history.noRecords")), 1),
|
|
2183
|
+
e("div", Ds, p(s(r)("inventory.stock.history.changeDateRange")), 1),
|
|
2184
|
+
_(x),
|
|
2185
|
+
_(x)
|
|
2186
2186
|
]))
|
|
2187
2187
|
])
|
|
2188
2188
|
];
|
|
@@ -2198,20 +2198,20 @@ const Hn = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Tn = {
|
|
|
2198
2198
|
permissions: { default: void 0 },
|
|
2199
2199
|
mode: { default: "all" }
|
|
2200
2200
|
},
|
|
2201
|
-
setup(
|
|
2202
|
-
const
|
|
2203
|
-
const
|
|
2204
|
-
return
|
|
2201
|
+
setup(A) {
|
|
2202
|
+
const u = A, k = T(() => {
|
|
2203
|
+
const S = [];
|
|
2204
|
+
return u.permission && S.push(u.permission), u.permissions && S.push(...u.permissions), S;
|
|
2205
2205
|
});
|
|
2206
2206
|
Vt(() => {
|
|
2207
2207
|
});
|
|
2208
|
-
const { hasPermission:
|
|
2209
|
-
return (
|
|
2208
|
+
const { hasPermission: y } = At(k, () => u.mode);
|
|
2209
|
+
return (S, j) => s(y) ? st(S.$slots, "default", { key: 0 }) : st(S.$slots, "fallback", { key: 1 });
|
|
2210
2210
|
}
|
|
2211
2211
|
});
|
|
2212
|
-
function Is(
|
|
2213
|
-
const
|
|
2214
|
-
let
|
|
2212
|
+
function Is(A) {
|
|
2213
|
+
const u = Ut(), k = Se(), y = Y(!1), S = Y(null), j = Y(null);
|
|
2214
|
+
let d = null, r = !1, b = !1;
|
|
2215
2215
|
function R() {
|
|
2216
2216
|
if (b) return;
|
|
2217
2217
|
const a = k.currentLocationDBName;
|
|
@@ -2220,11 +2220,11 @@ function Is(w) {
|
|
|
2220
2220
|
const D = {
|
|
2221
2221
|
type: "refresh-balance",
|
|
2222
2222
|
params: { locationId: a }
|
|
2223
|
-
}, { unsubscribe:
|
|
2223
|
+
}, { unsubscribe: m, initialState: w } = u.subscribe(
|
|
2224
2224
|
D,
|
|
2225
2225
|
C
|
|
2226
2226
|
);
|
|
2227
|
-
|
|
2227
|
+
d = m, w.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);
|
|
@@ -2233,89 +2233,94 @@ function Is(w) {
|
|
|
2233
2233
|
async function C(a) {
|
|
2234
2234
|
var D;
|
|
2235
2235
|
if (!(!b || !a)) {
|
|
2236
|
-
if (
|
|
2237
|
-
|
|
2236
|
+
if (S.value = a, a.completedAt && (j.value = a.completedAt), a.message === "processing" || !a.completedAt && !a.message) {
|
|
2237
|
+
r = !0, y.value = !0;
|
|
2238
2238
|
return;
|
|
2239
2239
|
}
|
|
2240
2240
|
if (a.message === "completed" || a.completedAt) {
|
|
2241
|
-
if (!
|
|
2242
|
-
|
|
2241
|
+
if (!r) return;
|
|
2242
|
+
l();
|
|
2243
2243
|
try {
|
|
2244
|
-
await
|
|
2245
|
-
} catch (
|
|
2246
|
-
console.error("Failed to reload after refresh",
|
|
2244
|
+
await A.onCompleted();
|
|
2245
|
+
} catch (m) {
|
|
2246
|
+
console.error("Failed to reload after refresh", m);
|
|
2247
2247
|
}
|
|
2248
2248
|
return;
|
|
2249
2249
|
}
|
|
2250
2250
|
if (a.message === "error") {
|
|
2251
|
-
const
|
|
2252
|
-
|
|
2251
|
+
const m = a.error ?? "Failed to refresh stock balance.";
|
|
2252
|
+
l(), await ((D = A.onError) == null ? void 0 : D.call(A, m));
|
|
2253
2253
|
}
|
|
2254
2254
|
}
|
|
2255
2255
|
}
|
|
2256
|
-
function
|
|
2257
|
-
|
|
2256
|
+
function l() {
|
|
2257
|
+
d && (d(), d = null), b = !1, r = !1, y.value = !1, S.value = null;
|
|
2258
2258
|
}
|
|
2259
2259
|
return Ct(() => {
|
|
2260
|
-
|
|
2260
|
+
l();
|
|
2261
2261
|
}), {
|
|
2262
|
-
refreshing:
|
|
2263
|
-
refreshStatus:
|
|
2262
|
+
refreshing: y,
|
|
2263
|
+
refreshStatus: S,
|
|
2264
2264
|
lastCompletedAt: j,
|
|
2265
2265
|
startListening: R,
|
|
2266
|
-
stopListening:
|
|
2266
|
+
stopListening: l
|
|
2267
2267
|
};
|
|
2268
2268
|
}
|
|
2269
2269
|
const Hs = {
|
|
2270
2270
|
key: 0,
|
|
2271
2271
|
class: "flex items-center gap-1"
|
|
2272
|
-
}, Ts = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" },
|
|
2272
|
+
}, 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
2273
|
__name: "StockView",
|
|
2274
|
-
setup(
|
|
2275
|
-
const { t:
|
|
2276
|
-
T(() => [
|
|
2274
|
+
setup(A) {
|
|
2275
|
+
const { t: u } = pe(), k = Ne(), y = Se(), S = Oe(), j = Ft(), d = Ae(), r = gt(), b = co(), { columnDefs: R } = ko(), C = Xe(), { hasPermission: l } = At(
|
|
2276
|
+
T(() => [
|
|
2277
|
+
{
|
|
2278
|
+
action: De.Action.manage,
|
|
2279
|
+
subject: De.Subject.Business.inventory_stockAdjustment
|
|
2280
|
+
}
|
|
2281
|
+
])
|
|
2277
2282
|
), a = T(
|
|
2278
2283
|
() => {
|
|
2279
|
-
var
|
|
2280
|
-
return
|
|
2284
|
+
var f;
|
|
2285
|
+
return l.value || ((f = C.sessionUser.value) == null ? void 0 : f.role.isAdmin);
|
|
2281
2286
|
}
|
|
2282
|
-
), D = Le(),
|
|
2283
|
-
|
|
2284
|
-
const
|
|
2287
|
+
), D = Le(), m = we();
|
|
2288
|
+
y.watchLocation(X);
|
|
2289
|
+
const w = T(
|
|
2285
2290
|
() => new Set(b.getAvailableItems(b.businessSubsidiaryId))
|
|
2286
|
-
), o = Y(!1), t = Y(!1), { refreshing: n, lastCompletedAt: $, startListening:
|
|
2291
|
+
), o = Y(!1), t = Y(!1), { refreshing: n, lastCompletedAt: $, startListening: E, stopListening: N } = Is({
|
|
2287
2292
|
onCompleted: async () => {
|
|
2288
|
-
await X(), t.value = !1,
|
|
2293
|
+
await X(), t.value = !1, m.open({
|
|
2289
2294
|
title: "Balance refreshed",
|
|
2290
2295
|
message: "Stock balance has been recalculated.",
|
|
2291
2296
|
type: "success"
|
|
2292
2297
|
});
|
|
2293
2298
|
},
|
|
2294
|
-
onError: (
|
|
2295
|
-
t.value = !1,
|
|
2296
|
-
title: "
|
|
2297
|
-
message:
|
|
2299
|
+
onError: (f) => {
|
|
2300
|
+
t.value = !1, console.log("Error refreshing stock balance", f), m.open({
|
|
2301
|
+
title: u("inventory.common.refreshFailed"),
|
|
2302
|
+
message: f || u("inventory.stock.stock_balance.refreshBalanceError"),
|
|
2298
2303
|
type: "error"
|
|
2299
2304
|
});
|
|
2300
2305
|
}
|
|
2301
2306
|
}), O = T(() => n.value || t.value);
|
|
2302
2307
|
async function L() {
|
|
2303
|
-
|
|
2304
|
-
const
|
|
2308
|
+
E();
|
|
2309
|
+
const f = u("inventory.stock.stock_balance.refreshBalanceDescription"), v = $.value ? `${f}
|
|
2305
2310
|
|
|
2306
|
-
Last refreshed: ${new Date($.value).toLocaleString()}` :
|
|
2311
|
+
Last refreshed: ${new Date($.value).toLocaleString()}` : f;
|
|
2307
2312
|
D.open({
|
|
2308
|
-
title:
|
|
2309
|
-
message:
|
|
2313
|
+
title: u("inventory.stock.stock_balance.refreshBalance"),
|
|
2314
|
+
message: v,
|
|
2310
2315
|
closeButton: !0,
|
|
2311
2316
|
primaryActions: {
|
|
2312
|
-
text:
|
|
2317
|
+
text: u("common.confirm"),
|
|
2313
2318
|
close: !1,
|
|
2314
2319
|
isLoading: O,
|
|
2315
2320
|
disabled: O
|
|
2316
2321
|
},
|
|
2317
2322
|
secondaryActions: {
|
|
2318
|
-
text:
|
|
2323
|
+
text: u("common.close"),
|
|
2319
2324
|
close: !0,
|
|
2320
2325
|
variant: "tertiary",
|
|
2321
2326
|
disabled: O
|
|
@@ -2324,11 +2329,13 @@ Last refreshed: ${new Date($.value).toLocaleString()}` : y;
|
|
|
2324
2329
|
if (!t.value) {
|
|
2325
2330
|
t.value = !0;
|
|
2326
2331
|
try {
|
|
2327
|
-
await
|
|
2328
|
-
} catch (
|
|
2329
|
-
console.
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
+
await d.recalculation.refreshCurrentBalances();
|
|
2333
|
+
} catch (i) {
|
|
2334
|
+
console.log("Failed to queue refresh balan22ce", typeof i);
|
|
2335
|
+
const x = typeof i == "object" ? JSON.stringify(i) : String(i);
|
|
2336
|
+
console.log("Error details:", x), t.value = !1, m.open({
|
|
2337
|
+
title: u("inventory.common.refreshFailed"),
|
|
2338
|
+
message: (i instanceof Error ? i.message : null) ?? u("inventory.stock.stock_balance.refreshBalanceError"),
|
|
2332
2339
|
type: "error"
|
|
2333
2340
|
});
|
|
2334
2341
|
}
|
|
@@ -2338,16 +2345,16 @@ Last refreshed: ${new Date($.value).toLocaleString()}` : y;
|
|
|
2338
2345
|
});
|
|
2339
2346
|
}
|
|
2340
2347
|
async function X() {
|
|
2341
|
-
if (
|
|
2348
|
+
if (y._currentLocation) {
|
|
2342
2349
|
o.value = !0;
|
|
2343
2350
|
try {
|
|
2344
|
-
await
|
|
2345
|
-
} catch (
|
|
2346
|
-
|
|
2347
|
-
title:
|
|
2348
|
-
message:
|
|
2351
|
+
await S.readStockBalance(), await S.readProductBalance(), await r.readStockEstimateBalance();
|
|
2352
|
+
} catch (f) {
|
|
2353
|
+
m.open({
|
|
2354
|
+
title: u("inventory.stock.error.title"),
|
|
2355
|
+
message: u("inventory.stock.error.message"),
|
|
2349
2356
|
type: "error"
|
|
2350
|
-
}), console.error("error on fetch stock balance",
|
|
2357
|
+
}), console.error("error on fetch stock balance", f);
|
|
2351
2358
|
} finally {
|
|
2352
2359
|
o.value = !1;
|
|
2353
2360
|
}
|
|
@@ -2371,23 +2378,23 @@ Last refreshed: ${new Date($.value).toLocaleString()}` : y;
|
|
|
2371
2378
|
}
|
|
2372
2379
|
]
|
|
2373
2380
|
}), U = T(() => {
|
|
2374
|
-
var
|
|
2375
|
-
const
|
|
2381
|
+
var i, x, P;
|
|
2382
|
+
const f = K.value ? mo.build(K.value) : null, v = [];
|
|
2376
2383
|
for (const ee of k.skus) {
|
|
2377
2384
|
let ae = !0;
|
|
2378
|
-
if (b.isEnabled &&
|
|
2385
|
+
if (b.isEnabled && re.value && w.value && ae && (ae = w.value.has(ee._id)), f && ae && (ae = fo(
|
|
2379
2386
|
{
|
|
2380
2387
|
status: ee.isInactive ? "Inactive" : "Active"
|
|
2381
2388
|
},
|
|
2382
|
-
|
|
2389
|
+
f
|
|
2383
2390
|
)), ae) {
|
|
2384
2391
|
const Q = ee.trackingMeasurement;
|
|
2385
|
-
let W = (
|
|
2392
|
+
let W = (x = (i = S.stockBalance.skus) == null ? void 0 : i.find(
|
|
2386
2393
|
(ce) => ce.id === ee._id
|
|
2387
|
-
)) == null ? void 0 :
|
|
2394
|
+
)) == null ? void 0 : x.balance, te = r.inventoryForecast.skus.find(
|
|
2388
2395
|
(ce) => ce.id === ee._id
|
|
2389
2396
|
);
|
|
2390
|
-
const
|
|
2397
|
+
const le = {
|
|
2391
2398
|
...ee,
|
|
2392
2399
|
balance: W ?? {
|
|
2393
2400
|
amount: 0,
|
|
@@ -2395,39 +2402,39 @@ Last refreshed: ${new Date($.value).toLocaleString()}` : y;
|
|
|
2395
2402
|
},
|
|
2396
2403
|
operator: te == null ? void 0 : te.operator,
|
|
2397
2404
|
day: (te == null ? void 0 : te.depletionDays) ?? void 0,
|
|
2398
|
-
trackingUnitAbbrev: Q ? ((
|
|
2405
|
+
trackingUnitAbbrev: Q ? ((P = ee.unit.measurements.find((ce) => ce.id === Q)) == null ? void 0 : P.abbrev) ?? "" : ee.unit.abbrev
|
|
2399
2406
|
};
|
|
2400
|
-
|
|
2407
|
+
v.push(le);
|
|
2401
2408
|
}
|
|
2402
2409
|
}
|
|
2403
|
-
return
|
|
2404
|
-
}), Z = Y(""),
|
|
2405
|
-
const
|
|
2410
|
+
return v;
|
|
2411
|
+
}), Z = Y(""), re = Y(!0), { breakpoints: g } = Lt(), F = T(() => g.value.xs || g.value.sm), G = T(() => F.value ? 10 : 20), H = Bt(), J = T(() => {
|
|
2412
|
+
const f = [
|
|
2406
2413
|
{
|
|
2407
|
-
label:
|
|
2414
|
+
label: u("inventory.stock.stock_balance.refreshBalance"),
|
|
2408
2415
|
value: "refresh-balance",
|
|
2409
2416
|
isPrimary: !0,
|
|
2410
2417
|
prependIcon: "calculate"
|
|
2411
2418
|
},
|
|
2412
2419
|
{
|
|
2413
|
-
label:
|
|
2420
|
+
label: u("inventory.common.refresh"),
|
|
2414
2421
|
value: "refresh"
|
|
2415
2422
|
},
|
|
2416
2423
|
{
|
|
2417
|
-
label:
|
|
2424
|
+
label: u("inventory.common.export"),
|
|
2418
2425
|
value: "export"
|
|
2419
2426
|
}
|
|
2420
2427
|
];
|
|
2421
|
-
return a.value &&
|
|
2422
|
-
label:
|
|
2428
|
+
return a.value && f.push({
|
|
2429
|
+
label: u("inventory.stock.stock_adjustment.title"),
|
|
2423
2430
|
value: "stockAdjustment"
|
|
2424
|
-
}),
|
|
2431
|
+
}), f;
|
|
2425
2432
|
}), I = Y(!1);
|
|
2426
|
-
function
|
|
2433
|
+
function c() {
|
|
2427
2434
|
I.value = !0;
|
|
2428
2435
|
}
|
|
2429
|
-
function h(
|
|
2430
|
-
switch (
|
|
2436
|
+
function h(f) {
|
|
2437
|
+
switch (f) {
|
|
2431
2438
|
case "refresh-balance":
|
|
2432
2439
|
return L();
|
|
2433
2440
|
case "refresh":
|
|
@@ -2435,48 +2442,48 @@ Last refreshed: ${new Date($.value).toLocaleString()}` : y;
|
|
|
2435
2442
|
case "export":
|
|
2436
2443
|
return Rt(U.value);
|
|
2437
2444
|
case "stockAdjustment":
|
|
2438
|
-
return
|
|
2445
|
+
return c();
|
|
2439
2446
|
}
|
|
2440
2447
|
}
|
|
2441
|
-
return (
|
|
2442
|
-
const
|
|
2448
|
+
return (f, v) => {
|
|
2449
|
+
const i = B("FmSwitch"), x = B("FmTable");
|
|
2443
2450
|
return V(), ne(Mt, {
|
|
2444
|
-
title: s(
|
|
2451
|
+
title: s(u)("inventory.stock.title"),
|
|
2445
2452
|
actions: J.value,
|
|
2446
2453
|
"onClick:action": h
|
|
2447
2454
|
}, {
|
|
2448
2455
|
default: M(() => {
|
|
2449
|
-
var
|
|
2456
|
+
var P, ee, ae, Q;
|
|
2450
2457
|
return [
|
|
2451
2458
|
e("div", {
|
|
2452
2459
|
class: He([
|
|
2453
2460
|
"flex flex-col gap-8 max-h-full",
|
|
2454
2461
|
{
|
|
2455
|
-
"p-0":
|
|
2456
|
-
"px-24 ": !
|
|
2462
|
+
"p-0": F.value,
|
|
2463
|
+
"px-24 ": !F.value
|
|
2457
2464
|
}
|
|
2458
2465
|
])
|
|
2459
2466
|
}, [
|
|
2460
|
-
_(
|
|
2467
|
+
_(ro, {
|
|
2461
2468
|
searchable: "",
|
|
2462
2469
|
"change-location": "",
|
|
2463
2470
|
search: Z.value,
|
|
2464
|
-
"onUpdate:search":
|
|
2471
|
+
"onUpdate:search": v[1] || (v[1] = (W) => Z.value = W),
|
|
2465
2472
|
"hide-filter-options": !0,
|
|
2466
2473
|
filterable: "",
|
|
2467
2474
|
"filter-attributes": z.value,
|
|
2468
2475
|
filter: K.value,
|
|
2469
|
-
"onUpdate:filter":
|
|
2476
|
+
"onUpdate:filter": v[2] || (v[2] = (W) => K.value = W)
|
|
2470
2477
|
}, {
|
|
2471
2478
|
default: M(() => [
|
|
2472
2479
|
s(b).isEnabled ? (V(), q("div", Hs, [
|
|
2473
|
-
e("span", Ts,
|
|
2480
|
+
e("span", Ts, p(s(u)("inventory.integration.netsuite.subsidiaryHierarchy.filtering")), 1),
|
|
2474
2481
|
_(Nt),
|
|
2475
2482
|
_(Je, null, {
|
|
2476
2483
|
default: M(() => [
|
|
2477
|
-
_(
|
|
2478
|
-
modelValue:
|
|
2479
|
-
"onUpdate:modelValue":
|
|
2484
|
+
_(i, {
|
|
2485
|
+
modelValue: re.value,
|
|
2486
|
+
"onUpdate:modelValue": v[0] || (v[0] = (W) => re.value = W)
|
|
2480
2487
|
}, null, 8, ["modelValue"])
|
|
2481
2488
|
]),
|
|
2482
2489
|
_: 1
|
|
@@ -2485,14 +2492,14 @@ Last refreshed: ${new Date($.value).toLocaleString()}` : y;
|
|
|
2485
2492
|
]),
|
|
2486
2493
|
_: 1
|
|
2487
2494
|
}, 8, ["search", "filter-attributes", "filter"]),
|
|
2488
|
-
(V(), ne(
|
|
2495
|
+
(V(), ne(x, {
|
|
2489
2496
|
style: kt(s(H).tableHeight),
|
|
2490
2497
|
"column-defs": s(R),
|
|
2491
2498
|
"row-data": U.value,
|
|
2492
2499
|
"search-value": Z.value,
|
|
2493
|
-
loading: o.value || s(n) || !s(
|
|
2494
|
-
key: (
|
|
2495
|
-
onRowClick:
|
|
2500
|
+
loading: o.value || s(n) || !s(y)._currentLocation,
|
|
2501
|
+
key: (P = s(y)._currentLocation) == null ? void 0 : P.dbName,
|
|
2502
|
+
onRowClick: v[3] || (v[3] = (W) => s(j).showSkuHistory(W.original)),
|
|
2496
2503
|
"page-size": G.value
|
|
2497
2504
|
}, {
|
|
2498
2505
|
"list-row": M((W) => [
|
|
@@ -2501,13 +2508,13 @@ Last refreshed: ${new Date($.value).toLocaleString()}` : y;
|
|
|
2501
2508
|
onRowClick: s(j).showSkuHistory
|
|
2502
2509
|
}, {
|
|
2503
2510
|
default: M((te) => {
|
|
2504
|
-
var
|
|
2511
|
+
var le, ce, je, me, de, Ze, et, tt, Ve, ot;
|
|
2505
2512
|
return [
|
|
2506
|
-
e("div",
|
|
2513
|
+
e("div", Es, [
|
|
2507
2514
|
e("div", Us, [
|
|
2508
|
-
e("div",
|
|
2515
|
+
e("div", Ps, [
|
|
2509
2516
|
_(s(ft), {
|
|
2510
|
-
render: (je = (ce = (
|
|
2517
|
+
render: (je = (ce = (le = te.code) == null ? void 0 : le.column) == null ? void 0 : ce.columnDef) == null ? void 0 : je.cell,
|
|
2511
2518
|
props: (de = (me = te.code) == null ? void 0 : me.getContext) == null ? void 0 : de.call(me)
|
|
2512
2519
|
}, null, 8, ["render", "props"])
|
|
2513
2520
|
]),
|
|
@@ -2545,17 +2552,20 @@ Last refreshed: ${new Date($.value).toLocaleString()}` : y;
|
|
|
2545
2552
|
(ee = s(j).stockHistoryProps) != null && ee.sku ? (V(), ne(Bs, at(ze({ key: 0 }, s(j).stockHistoryProps)), null, 16)) : se("", !0),
|
|
2546
2553
|
(ae = s(j).convertSkuDialogProps) != null && ae.sku ? (V(), ne(Mo, at(ze({ key: 1 }, s(j).convertSkuDialogProps)), null, 16)) : se("", !0),
|
|
2547
2554
|
(Q = s(j).adjustSkuDialogProps) != null && Q.stock ? (V(), ne(Go, ze({ key: 2 }, s(j).adjustSkuDialogProps, {
|
|
2548
|
-
onSubmitted:
|
|
2555
|
+
onSubmitted: v[4] || (v[4] = (W) => X())
|
|
2549
2556
|
}), null, 16)) : se("", !0),
|
|
2550
2557
|
_(Ms, {
|
|
2551
|
-
permission: {
|
|
2558
|
+
permission: {
|
|
2559
|
+
action: s(De).Action.manage,
|
|
2560
|
+
subject: s(De).Subject.Business.inventory_stockAdjustment
|
|
2561
|
+
}
|
|
2552
2562
|
}, {
|
|
2553
2563
|
default: M(() => [
|
|
2554
2564
|
I.value ? (V(), ne(sn, {
|
|
2555
2565
|
key: 0,
|
|
2556
2566
|
show: I.value,
|
|
2557
|
-
"onUpdate:show":
|
|
2558
|
-
onSubmitted:
|
|
2567
|
+
"onUpdate:show": v[5] || (v[5] = (W) => I.value = W),
|
|
2568
|
+
onSubmitted: v[6] || (v[6] = (W) => X())
|
|
2559
2569
|
}, null, 8, ["show"])) : se("", !0)
|
|
2560
2570
|
]),
|
|
2561
2571
|
_: 1
|