@feedmepos/mf-inventory-portal 1.2.60-dev.1 → 1.2.60
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-Dgk5k8U-.js → App-B6JtYLP4.js} +78 -82
- package/dist/{ApprovalView-CU2YMuZb.js → ApprovalView-fiHlFJKJ.js} +5 -5
- package/dist/{BindingsDialog-Cu0AR6jW.js → BindingsDialog-BlF79qCu.js} +5 -5
- package/dist/{BindingsPicker-DyycJJ6i.js → BindingsPicker-BS2OcyII.js} +3 -3
- package/dist/{BindingsTable-wFAnOCdU.js → BindingsTable-RyfzT4g6.js} +5 -5
- package/dist/{ClosingDraftView-C01bZNv_.js → ClosingDraftView-B2d-XA_E.js} +216 -217
- package/dist/{ClosingHistoryView-Bwjadf1x.js → ClosingHistoryView-DZPNorN6.js} +36 -36
- package/dist/{ClosingTemplateView-BAalivwa.js → ClosingTemplateView-L596UQJH.js} +14 -14
- package/dist/{DeliveryOrderPrintPreview-CaEmXkPV.js → DeliveryOrderPrintPreview-C82JPcVR.js} +7 -7
- package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-D7J8uo_B.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-CNf3PA0N.js} +17 -17
- package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DU4I0imJ.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-WWzwaGw-.js} +2 -2
- package/dist/{FmMultiselectDialog-v004bPKF.js → FmMultiselectDialog-CcMB_4yD.js} +16 -16
- package/dist/{FmMultiselectDialog-CdhcCzVw.js → FmMultiselectDialog-DTLcPYaF.js} +1 -1
- package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-C756UIBL.js → FmUnitInput.vue_vue_type_script_setup_true_lang-ChqG8Av1.js} +22 -23
- package/dist/{ImportView-WyG44i3g.js → ImportView-diTEPSKt.js} +6 -6
- package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-Y74PdyhQ.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-Cu-dNL-B.js} +1 -1
- package/dist/{IngredientGroupView-7bkBWvrQ.js → IngredientGroupView-CYqZOXH1.js} +5 -5
- package/dist/{IngredientsView-BDgOWARl.js → IngredientsView-DoCTezXa.js} +24 -25
- package/dist/{IntegrationView-BB7asiWy.js → IntegrationView-JboVfhvd.js} +17 -18
- package/dist/{InventoryBindingForm-CU9dnGdy.js → InventoryBindingForm-B1MrDzRK.js} +1 -1
- package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-BmlVB1SU.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-Br1hzlQ5.js} +16 -17
- package/dist/{InventoryBindingSummary-D2W_WcLV.js → InventoryBindingSummary-B09SU9pE.js} +1 -1
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-CVfShkXe.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-BX26mYQG.js} +5 -5
- package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-CC4jkZg4.js → PremiumBadge.vue_vue_type_script_setup_true_lang-DIk5aP_6.js} +2 -2
- package/dist/{PublishView-DR_TwAkf.js → PublishView-BLu0VGTW.js} +8 -8
- package/dist/{PurchaseOrderPrintPreview-CoX0u7jn.js → PurchaseOrderPrintPreview-CFZX2Yen.js} +11 -11
- package/dist/{ReceiveRequestView-VBePJl-U.js → ReceiveRequestView-DD0kz7x8.js} +248 -249
- package/dist/RecipeView-Cg7v20hW.js +646 -0
- package/dist/{StockView-BFv_Tl8E.js → StockView-CJk1YeM_.js} +646 -645
- package/dist/SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-BFCjZO6S.js +183 -0
- package/dist/{SupplierView-PSGUQEzz.js → SupplierView-CTEInwI-.js} +19 -20
- package/dist/{SurchargeView-B7qTXk1L.js → SurchargeView-CKJ2LS9l.js} +6 -6
- package/dist/{SystemTrailDialog.vue_vue_type_script_setup_true_lang-CxEeb4BW.js → SystemTrailDialog.vue_vue_type_script_setup_true_lang-DVhI5Qy6.js} +2 -2
- package/dist/{TemplatePublishDialog.vue_vue_type_script_setup_true_lang-Dxg6HaiQ.js → TemplatePublishDialog.vue_vue_type_script_setup_true_lang-DjjLI4tM.js} +1 -1
- package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-Dte8E0MX.js +3354 -0
- package/dist/{TransferTemplateView-CsRPCwN_.js → TransferTemplateView-rmrQtfX8.js} +21 -22
- package/dist/{UnitView-CdZ_GaUr.js → UnitView-Drvo3Tew.js} +10 -11
- package/dist/{WarehouseView-DQGYq00N.js → WarehouseView-DIBgCCzG.js} +5 -5
- package/dist/{WastageTemplateView-CE7aiWUH.js → WastageTemplateView-Cdvx4Ist.js} +14 -14
- package/dist/api/inventory.d.ts +36 -126
- package/dist/api/netsuite.d.ts +1 -8
- package/dist/api/stock-estimate.d.ts +2 -0
- package/dist/{app-CpEqZK89.js → app-BQahEYX9.js} +6708 -7673
- package/dist/app.d.ts +32 -228
- package/dist/app.js +1 -1
- package/dist/{closing-template-C20qxOGw.js → closing-template-ByR8ktYf.js} +1 -1
- package/dist/components/StockForecastProps.d.ts +6 -0
- package/dist/components/inventory-binding/InventoryBinding.vue.d.ts +1 -37
- package/dist/components/shell/inventory/binding-dialog.vue.d.ts +0 -14
- package/dist/components/shell/inventory/binding-ui.vue.d.ts +1 -16
- package/dist/{date2-C37x5LGh.js → date2-BTP8kRm1.js} +1 -1
- package/dist/{dayjs.min-C5A6b5Ut.js → dayjs.min-1rxaqCQM.js} +16 -16
- package/dist/{defineDeepModel-btW96tVp.js → defineDeepModel-BaJIlpWC.js} +1 -1
- package/dist/{duplicate-template-BPduDL4a.js → duplicate-template-XaB2svr5.js} +1 -1
- package/dist/{feature-Cu77Fha2.js → feature-Ce7hky70.js} +1696 -1560
- package/dist/{format-time-from-id-ULW7QQVk.js → format-time-from-id-DwTuSEMw.js} +1 -1
- package/dist/{format-unit-display-CeyXEKCV.js → format-unit-display-DviFIF9R.js} +15 -16
- package/dist/{import-export.helper-DpgGeeZ4.js → import-export.helper-CyeFjIHv.js} +15 -16
- package/dist/{index-Cl2lmtBz.js → index-CC_ls9B4.js} +1412 -1471
- package/dist/{index-DKDWBhbI.js → index-CeTIFqwk.js} +3 -3
- package/dist/{index-6Is7orHh.js → index-f1rjUE_a.js} +1 -1
- package/dist/{lodash-BS2snJNb.js → lodash-Be4onxQF.js} +1 -1
- package/dist/{netsuite-B5YYhPhU.js → netsuite-CB9u725A.js} +374 -372
- package/dist/{purchase-order-template-DVz_OXJ7.js → purchase-order-template-DoBDYEtP.js} +1 -1
- package/dist/router/name.d.ts +0 -1
- package/dist/rules-DZnC9R5E.js +327 -0
- package/dist/stock-DcXdnfU0.js +75 -0
- package/dist/{stock-D9iwDDOz.js → stock-DjHGX36M.js} +1 -1
- package/dist/stores/feature.d.ts +0 -2
- package/dist/stores/integration/netsuite.d.ts +1 -8
- package/dist/stores/inventory.d.ts +30 -119
- package/dist/style.css +1 -1
- package/dist/{supplier-UJg1gtQ8.js → supplier-BtZvsnMx.js} +2 -2
- package/dist/{surcharge-CcJatYN4.js → surcharge-CDGjoxGm.js} +1 -1
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{use-ingredient-select-dialog-C--_de2u.js → use-ingredient-select-dialog-l54ucmfp.js} +2 -2
- package/dist/{use-inventory-binding-dialog-JsmcY8OK.js → use-inventory-binding-dialog-adxsJaIL.js} +2 -2
- package/dist/{use-template-enabled-locations-2-Ce6Y0gQ_.js → use-template-enabled-locations-2-CgWtnf8k.js} +2 -2
- package/dist/views/closing-draft/components/closing-draft-dialog/ClosingDraftDialog.vue.d.ts +8 -64
- package/dist/views/closing-draft/composables/use-closing-draft-table.d.ts +24 -192
- package/dist/views/closing-template/components/closing-template-form/composables/use-closing-template-items.d.ts +1 -8
- package/dist/views/closing-template/composables/use-closing-template-actions.d.ts +12 -96
- package/dist/views/closing-template/composables/use-closing-template-table.d.ts +12 -96
- package/dist/views/ingredient-group/composables/use-ingredient-group-table.d.ts +18 -18
- package/dist/views/ingredients/components/convert/ConvertForm.vue.d.ts +0 -14
- package/dist/views/ingredients/components/ingredient-form/IngredientForm.vue.d.ts +4 -32
- package/dist/views/ingredients/components/inventory-binding/InventoryBindingForm.vue.d.ts +0 -28
- package/dist/views/ingredients/composables/use-ingredient-table.d.ts +1 -8
- package/dist/views/integration/components/netsuite/InventoryTransferIngredientTable.vue.d.ts +2 -16
- package/dist/views/receive-request/components/transfer-details/RejectDraftForm.vue.d.ts +19 -0
- package/dist/views/receive-request/components/transfer-details/TransferDetailsProps.d.ts +5 -1
- package/dist/views/receive-request/components/transfer-form/TransferFormWithController.vue.d.ts +6 -33
- package/dist/views/receive-request/components/transfer-form/components/ForecastStock.vue.d.ts +2 -16
- package/dist/views/receive-request/components/transfer-form/components/TransferItemTable.vue.d.ts +4 -32
- package/dist/views/receive-request/components/transfer-form/composables/use-transfer-items.d.ts +1 -8
- package/dist/views/receive-request/composables/use-process-purchase-order.d.ts +7 -41
- package/dist/views/receive-request/composables/use-receive-request-form.d.ts +42 -246
- package/dist/views/receive-request/composables/use-receive-request-table.d.ts +49 -287
- package/dist/views/recipe/components/recipe-form/RecipeForm.vue.d.ts +0 -16
- package/dist/views/stock/components/StockRecordCard.vue.d.ts +0 -1
- package/dist/views/stock/components/dialog/AdjustedItemForm.vue.d.ts +2 -16
- package/dist/views/stock/type.d.ts +2 -0
- package/dist/views/transfer-template/components/transfer-template-dialog/TransferTemplateDialog.vue.d.ts +2 -16
- package/dist/views/transfer-template/components/transfer-template-form/components/NetSuiteCustomCodeSelection.vue.d.ts +2 -16
- package/dist/views/transfer-template/components/transfer-template-form/components/TransferTemplateItemTable.vue.d.ts +2 -16
- package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-template-items.d.ts +1 -8
- package/dist/views/transfer-template/composables/use-netsuite-custom-field.d.ts +3 -24
- package/dist/views/transfer-template/composables/use-transfer-template-actions.d.ts +12 -96
- package/dist/views/transfer-template/composables/use-transfer-template-table.d.ts +12 -96
- package/dist/{vue-i18n-Cv_EPb3h.js → vue-i18n-CgWPe8oO.js} +438 -438
- package/dist/{xlsx-DuXSmSdO.js → xlsx-FLEhrhiP.js} +1 -1
- package/dist/{xlsx.util-B75iIY7V.js → xlsx.util-DoAD8sxa.js} +1 -1
- package/package.json +2 -2
- package/dist/RecipeView-CiZw14m_.js +0 -1558
- package/dist/SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-BMEsUpAC.js +0 -172
- package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-CAviJscD.js +0 -3241
- package/dist/UnitCostHistoryView-Byd2FHbH.js +0 -651
- package/dist/api/unit-cost-history.d.ts +0 -28
- package/dist/number-DgdltWRu.js +0 -232
- package/dist/rules-BPG3Fjva.js +0 -98
- package/dist/stock-BXorYvfp.js +0 -75
- package/dist/views/ingredients/components/inventory-binding/v2/InventoryBindingFormV2.vue.d.ts +0 -169
- package/dist/views/ingredients/components/inventory-binding/v2/components/InventoryBindingAlternative.vue.d.ts +0 -43
- package/dist/views/ingredients/components/inventory-binding/v2/components/InventoryBindingRule.vue.d.ts +0 -25
- package/dist/views/ingredients/components/inventory-binding/v2/components/InventoryRecipeBindingV2Field.vue.d.ts +0 -125
- package/dist/views/ingredients/components/inventory-binding/v2/components/InventorySkuBindingV2Field.vue.d.ts +0 -129
- package/dist/views/ingredients/components/inventory-binding/v2/composables/use-inventory-binding-alternative-table.d.ts +0 -30
- package/dist/views/ingredients/components/inventory-binding/v2/composables/use-inventory-binding-dialog.d.ts +0 -4
- package/dist/views/unit-cost-history/UnitCostHistoryView.vue.d.ts +0 -2
- package/dist/views/unit-cost-history/components/UnitCostDetailsSideSheet.vue.d.ts +0 -19
- package/dist/views/unit-cost-history/components/UnitCostRecalculationDialog.vue.d.ts +0 -11
- package/dist/views/unit-cost-history/composables/use-unit-cost-history.d.ts +0 -65
|
@@ -1,29 +1,28 @@
|
|
|
1
|
-
import { defineComponent as me, ref as z, computed as Y, resolveComponent as
|
|
1
|
+
import { defineComponent as me, ref as z, computed as Y, resolveComponent as H, openBlock as j, createBlock as X, withCtx as U, createElementVNode as e, normalizeClass as ge, toDisplayString as p, createVNode as y, createElementBlock as W, Fragment as le, renderList as ce, unref as a, h as ke, watch as $e, isRef as Ee, createCommentVNode as se, reactive as ut, mergeModels as Qe, useModel as bt, onMounted as qe, createTextVNode as pe, normalizeStyle as ct, Teleport as xt, normalizeProps as Le, mergeProps as ze } from "vue";
|
|
2
2
|
import { F as Xe, u as St, _ as wt } from "./SingleColumnLayout.vue_vue_type_script_setup_true_lang-CWZkVCAj.js";
|
|
3
|
-
import { u as xe, c as Pe, a as Re, F as Ze,
|
|
4
|
-
import { u as Oe } from "./stock-
|
|
3
|
+
import { u as xe, c as Pe, a as Re, F as Ze, H as Ft, D as ae, v as At, o as $t, B as Vt, w as Q, h as De, i as et, e as tt, I as he } from "./app-BQahEYX9.js";
|
|
4
|
+
import { u as Oe } from "./stock-DcXdnfU0.js";
|
|
5
5
|
import { c as Ct } from "./component-DpCUABT3.js";
|
|
6
|
-
import {
|
|
7
|
-
import { d as ye } from "./dayjs.min-
|
|
8
|
-
import { e as
|
|
9
|
-
import { _ as Ke, S as Ge, g as ft, a as
|
|
10
|
-
import { _ as
|
|
11
|
-
import { useI18n as fe, useCoreStore as
|
|
12
|
-
import { useSnackbar as Se, useDialog as Ne, useProxiedModel as Ye, useBreakpoints as
|
|
13
|
-
import { defineStore as
|
|
14
|
-
import { u as we } from "./stock-
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import { i as Kt, _ as qt } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DU4I0imJ.js";
|
|
6
|
+
import { i as Ve, g as Ce, a as _e, f as Dt, t as Ie, h as Te, A as jt, M as Mt, d as be, j as Bt, k as nt, l as dt, m as Je, R as It, e as Me, o as Tt } from "./rules-DZnC9R5E.js";
|
|
7
|
+
import { d as ye } from "./dayjs.min-1rxaqCQM.js";
|
|
8
|
+
import { e as Ht, u as mt, i as He, _ as ot } from "./PremiumBadge.vue_vue_type_script_setup_true_lang-DIk5aP_6.js";
|
|
9
|
+
import { _ as Ke, S as Ge, g as ft, a as Ut } from "./SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-BFCjZO6S.js";
|
|
10
|
+
import { _ as Et } from "./PreviewBadge.vue_vue_type_script_setup_true_lang-CRZiQHjx.js";
|
|
11
|
+
import { useI18n as fe, useCoreStore as pt } from "@feedmepos/mf-common";
|
|
12
|
+
import { useSnackbar as Se, useDialog as Ne, useProxiedModel as Ye, useBreakpoints as Pt } from "@feedmepos/ui-library";
|
|
13
|
+
import { defineStore as Rt } from "pinia";
|
|
14
|
+
import { u as we } from "./stock-DjHGX36M.js";
|
|
15
|
+
import { u as Ot } from "./use-inventory-binding-dialog-adxsJaIL.js";
|
|
16
|
+
import { a as vt } from "./FmMultiselectDialog-CcMB_4yD.js";
|
|
17
|
+
import { _ as Nt } from "./NumberPrecisionInput.vue_vue_type_script_setup_true_lang-BX26mYQG.js";
|
|
18
|
+
import { a as Yt, b as Lt, f as yt, t as st, c as at, p as zt, n as Gt, d as Wt } from "./date2-BTP8kRm1.js";
|
|
19
|
+
import { i as Kt, _ as qt } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-WWzwaGw-.js";
|
|
21
20
|
import { E as Xt } from "./empty-placeholder-wf6-BWE8.js";
|
|
22
|
-
import { F as
|
|
21
|
+
import { F as ve, u as Jt } from "./feature-Ce7hky70.js";
|
|
23
22
|
import { _ as Qt, F as lt } from "./TableActionableRow.vue_vue_type_script_setup_true_lang-Ca_eYa8-.js";
|
|
24
|
-
import { u as Zt } from "./netsuite-
|
|
23
|
+
import { u as Zt } from "./netsuite-CB9u725A.js";
|
|
25
24
|
import { P as en, J as tn } from "./app-DiX-EfV6.js";
|
|
26
|
-
var Be = /* @__PURE__ */ ((
|
|
25
|
+
var Be = /* @__PURE__ */ ((h) => (h.History = "History", h.Convert = "Convert", h.Adjust = "Adjust", h))(Be || {});
|
|
27
26
|
const nn = [
|
|
28
27
|
{
|
|
29
28
|
translationKey: "inventory.stock.action.history",
|
|
@@ -51,16 +50,16 @@ const nn = [
|
|
|
51
50
|
/* Adjust */
|
|
52
51
|
}
|
|
53
52
|
];
|
|
54
|
-
async function sn(
|
|
53
|
+
async function sn(h) {
|
|
55
54
|
const d = `${(xe().currentLocation.name || "").replace(
|
|
56
55
|
/ /g,
|
|
57
56
|
"_"
|
|
58
57
|
)}_${ye().format("DD_MM_YYYY_HHmm")}.xlsx`;
|
|
59
|
-
await
|
|
58
|
+
await Ht(
|
|
60
59
|
[
|
|
61
60
|
{
|
|
62
61
|
name: "stock",
|
|
63
|
-
data:
|
|
62
|
+
data: h,
|
|
64
63
|
columns: [
|
|
65
64
|
{
|
|
66
65
|
name: "Code",
|
|
@@ -73,16 +72,16 @@ async function sn(k) {
|
|
|
73
72
|
{
|
|
74
73
|
name: "Balance",
|
|
75
74
|
selector: (s) => {
|
|
76
|
-
const
|
|
77
|
-
return
|
|
75
|
+
const M = Ue(s, s.unit);
|
|
76
|
+
return M.type === "unit" ? Ve(s.balance, s.unit, null, !1) : Ve(s.balance, s.unit, M.measurement, !1);
|
|
78
77
|
}
|
|
79
78
|
},
|
|
80
79
|
{
|
|
81
80
|
name: "Unit",
|
|
82
81
|
selector: (s) => {
|
|
83
82
|
var w;
|
|
84
|
-
const
|
|
85
|
-
return
|
|
83
|
+
const M = Ue(s, s.unit);
|
|
84
|
+
return M.type === "unit" ? s.unit.abbrev : ((w = s.unit.measurements.find((c) => c.id === M.measurement)) == null ? void 0 : w.abbrev) || "";
|
|
86
85
|
}
|
|
87
86
|
}
|
|
88
87
|
]
|
|
@@ -91,8 +90,8 @@ async function sn(k) {
|
|
|
91
90
|
d
|
|
92
91
|
);
|
|
93
92
|
}
|
|
94
|
-
function
|
|
95
|
-
const d = localStorage.getItem(`uom:${
|
|
93
|
+
function Ue(h, m) {
|
|
94
|
+
const d = localStorage.getItem(`uom:${h._id}`);
|
|
96
95
|
return d ? d === m._id ? {
|
|
97
96
|
type: "unit"
|
|
98
97
|
} : m.measurements.find((s) => s.id === d) ? {
|
|
@@ -100,9 +99,9 @@ function He(k, m) {
|
|
|
100
99
|
measurement: d
|
|
101
100
|
} : {
|
|
102
101
|
type: "unit"
|
|
103
|
-
} :
|
|
102
|
+
} : h.trackingMeasurement && m.measurements.find((s) => s.id === h.trackingMeasurement) ? {
|
|
104
103
|
type: "measurement",
|
|
105
|
-
measurement:
|
|
104
|
+
measurement: h.trackingMeasurement
|
|
106
105
|
} : {
|
|
107
106
|
type: "unit"
|
|
108
107
|
};
|
|
@@ -115,15 +114,15 @@ const an = { class: "fm-typo-en-body-md-400 flex-grow" }, _t = /* @__PURE__ */ m
|
|
|
115
114
|
amount: {},
|
|
116
115
|
defaultTrackingMeasurement: {}
|
|
117
116
|
},
|
|
118
|
-
setup(
|
|
117
|
+
setup(h) {
|
|
119
118
|
function m(B) {
|
|
120
119
|
return `uom:${B._id}`;
|
|
121
120
|
}
|
|
122
121
|
function d(B) {
|
|
123
122
|
const b = m(s.sku);
|
|
124
|
-
B ? localStorage.setItem(b, B) : localStorage.setItem(b, s.unit._id),
|
|
123
|
+
B ? localStorage.setItem(b, B) : localStorage.setItem(b, s.unit._id), M.value = Ue(s.sku, s.unit);
|
|
125
124
|
}
|
|
126
|
-
const s =
|
|
125
|
+
const s = h, M = z(Ue(s.sku, s.unit)), w = Y(() => {
|
|
127
126
|
const { measurements: B } = s.unit;
|
|
128
127
|
return [
|
|
129
128
|
{
|
|
@@ -137,41 +136,41 @@ const an = { class: "fm-typo-en-body-md-400 flex-grow" }, _t = /* @__PURE__ */ m
|
|
|
137
136
|
];
|
|
138
137
|
});
|
|
139
138
|
function c({ value: B }) {
|
|
140
|
-
return a(
|
|
139
|
+
return a(M).type === "unit" ? B === null : B === a(M).measurement;
|
|
141
140
|
}
|
|
142
141
|
const l = Y(
|
|
143
142
|
() => {
|
|
144
143
|
var B;
|
|
145
144
|
return ((B = w.value.find((b) => c(b))) == null ? void 0 : B.label) ?? "";
|
|
146
145
|
}
|
|
147
|
-
),
|
|
146
|
+
), g = z(!1);
|
|
148
147
|
return (B, b) => {
|
|
149
|
-
const
|
|
150
|
-
return
|
|
148
|
+
const r = H("FmIcon"), v = H("FmMenuItem"), T = H("FmMenu");
|
|
149
|
+
return j(), X(T, {
|
|
151
150
|
"stop-click-propagation": "",
|
|
152
|
-
onMenuChanged: b[0] || (b[0] = (
|
|
151
|
+
onMenuChanged: b[0] || (b[0] = (k) => g.value = k)
|
|
153
152
|
}, {
|
|
154
|
-
"menu-button":
|
|
153
|
+
"menu-button": U(() => [
|
|
155
154
|
e("button", {
|
|
156
155
|
type: "button",
|
|
157
156
|
class: ge([
|
|
158
157
|
"w-full text-left flex items-center gap-8 cursor-pointer fm-corner-radius-sm px-8 py-4 border bg-white",
|
|
159
|
-
|
|
158
|
+
g.value ? "border-fm-color-primary" : "border-fm-color-neutral-gray-100"
|
|
160
159
|
])
|
|
161
160
|
}, [
|
|
162
161
|
e("div", an, p(l.value), 1),
|
|
163
|
-
y(
|
|
162
|
+
y(r, {
|
|
164
163
|
class: "text-fm-color-neutral-gray-400",
|
|
165
164
|
name: "expand_more"
|
|
166
165
|
})
|
|
167
166
|
], 2)
|
|
168
167
|
]),
|
|
169
|
-
default:
|
|
170
|
-
(
|
|
171
|
-
key:
|
|
172
|
-
label:
|
|
173
|
-
"model-value": c(
|
|
174
|
-
onClick: (x) => d(
|
|
168
|
+
default: U(() => [
|
|
169
|
+
(j(!0), W(le, null, ce(w.value, (k) => (j(), X(v, {
|
|
170
|
+
key: k.value ?? 0,
|
|
171
|
+
label: k.label,
|
|
172
|
+
"model-value": c(k),
|
|
173
|
+
onClick: (x) => d(k.value)
|
|
175
174
|
}, null, 8, ["label", "model-value", "onClick"]))), 128))
|
|
176
175
|
]),
|
|
177
176
|
_: 1
|
|
@@ -180,37 +179,37 @@ const an = { class: "fm-typo-en-body-md-400 flex-grow" }, _t = /* @__PURE__ */ m
|
|
|
180
179
|
}
|
|
181
180
|
}), ln = { class: "whitespace-nowrap" }, rn = /* @__PURE__ */ me({
|
|
182
181
|
__name: "StockHeaderPreview",
|
|
183
|
-
setup(
|
|
182
|
+
setup(h) {
|
|
184
183
|
const { t: m } = fe();
|
|
185
|
-
return (d, s) => (
|
|
186
|
-
default:
|
|
184
|
+
return (d, s) => (j(), X(Et, null, {
|
|
185
|
+
default: U(() => [
|
|
187
186
|
e("div", ln, p(a(m)("inventory.stock.prediction.daysRemaining")), 1)
|
|
188
187
|
]),
|
|
189
188
|
_: 1
|
|
190
189
|
}));
|
|
191
190
|
}
|
|
192
|
-
}), kt =
|
|
193
|
-
const
|
|
191
|
+
}), kt = Rt("stockActions", () => {
|
|
192
|
+
const h = z(!1), m = xe(), d = Oe(), s = mt(), M = Se(), w = Ne(), { t: c } = fe();
|
|
194
193
|
async function l() {
|
|
195
194
|
if (m._currentLocation) {
|
|
196
|
-
|
|
195
|
+
h.value = !0;
|
|
197
196
|
try {
|
|
198
197
|
await d.readStockBalance(), await d.readProductBalance(), await s.readStockEstimateBalance();
|
|
199
198
|
} catch {
|
|
200
|
-
|
|
199
|
+
M.open({
|
|
201
200
|
title: c("inventory.stock.error.title"),
|
|
202
201
|
message: c("inventory.stock.error.message"),
|
|
203
202
|
type: "error"
|
|
204
203
|
});
|
|
205
204
|
} finally {
|
|
206
|
-
|
|
205
|
+
h.value = !1;
|
|
207
206
|
}
|
|
208
207
|
}
|
|
209
208
|
}
|
|
210
|
-
const
|
|
209
|
+
const g = z();
|
|
211
210
|
async function B(x) {
|
|
212
|
-
var S,
|
|
213
|
-
if (!!!((
|
|
211
|
+
var S, D, A;
|
|
212
|
+
if (!!!((D = (S = x.convert) == null ? void 0 : S.inventoryBindings) != null && D.length)) {
|
|
214
213
|
w.open({
|
|
215
214
|
title: c("inventory.stock.error.convert.title"),
|
|
216
215
|
message: c("inventory.stock.error.convert.message")
|
|
@@ -222,16 +221,16 @@ const an = { class: "fm-typo-en-body-md-400 flex-grow" }, _t = /* @__PURE__ */ m
|
|
|
222
221
|
sku: x,
|
|
223
222
|
show: !0,
|
|
224
223
|
"onUpdate:show"(I) {
|
|
225
|
-
|
|
224
|
+
g.value.show = I;
|
|
226
225
|
},
|
|
227
226
|
onSubmitted() {
|
|
228
227
|
l();
|
|
229
228
|
}
|
|
230
229
|
};
|
|
231
|
-
|
|
230
|
+
g.value = n;
|
|
232
231
|
}
|
|
233
232
|
const b = z();
|
|
234
|
-
async function
|
|
233
|
+
async function r(x) {
|
|
235
234
|
const o = {
|
|
236
235
|
stock: x,
|
|
237
236
|
show: !0,
|
|
@@ -244,18 +243,18 @@ const an = { class: "fm-typo-en-body-md-400 flex-grow" }, _t = /* @__PURE__ */ m
|
|
|
244
243
|
};
|
|
245
244
|
b.value = o;
|
|
246
245
|
}
|
|
247
|
-
const
|
|
246
|
+
const v = z();
|
|
248
247
|
async function T(x) {
|
|
249
248
|
const o = {
|
|
250
249
|
sku: x,
|
|
251
250
|
show: !0,
|
|
252
251
|
"onUpdate:show"(t) {
|
|
253
|
-
|
|
252
|
+
v.value.show = t;
|
|
254
253
|
}
|
|
255
254
|
};
|
|
256
|
-
|
|
255
|
+
v.value = o;
|
|
257
256
|
}
|
|
258
|
-
function
|
|
257
|
+
function k(x, o) {
|
|
259
258
|
const t = Pe(o);
|
|
260
259
|
switch (x) {
|
|
261
260
|
case Be.History:
|
|
@@ -265,22 +264,22 @@ const an = { class: "fm-typo-en-body-md-400 flex-grow" }, _t = /* @__PURE__ */ m
|
|
|
265
264
|
B(t);
|
|
266
265
|
return;
|
|
267
266
|
case Be.Adjust:
|
|
268
|
-
|
|
267
|
+
r(t);
|
|
269
268
|
return;
|
|
270
269
|
}
|
|
271
270
|
}
|
|
272
271
|
return {
|
|
273
272
|
fetchStockBalance: l,
|
|
274
|
-
onActionMenu:
|
|
275
|
-
stockHistoryProps:
|
|
273
|
+
onActionMenu: k,
|
|
274
|
+
stockHistoryProps: v,
|
|
276
275
|
showSkuHistory: T,
|
|
277
|
-
convertSkuDialogProps:
|
|
276
|
+
convertSkuDialogProps: g,
|
|
278
277
|
adjustSkuDialogProps: b
|
|
279
278
|
};
|
|
280
279
|
});
|
|
281
280
|
function un() {
|
|
282
281
|
var w;
|
|
283
|
-
const
|
|
282
|
+
const h = xe(), m = kt(), d = pt(), { t: s } = fe();
|
|
284
283
|
return {
|
|
285
284
|
columnDefs: [
|
|
286
285
|
{
|
|
@@ -299,13 +298,13 @@ function un() {
|
|
|
299
298
|
id: "UOM",
|
|
300
299
|
header: () => s("inventory.stock.balance"),
|
|
301
300
|
cell(c) {
|
|
302
|
-
const l = c.row.original,
|
|
301
|
+
const l = c.row.original, g = {
|
|
303
302
|
unit: l.unit,
|
|
304
303
|
sku: l,
|
|
305
304
|
amount: l.balance,
|
|
306
305
|
defaultTrackingMeasurement: l.trackingMeasurement ?? void 0
|
|
307
306
|
};
|
|
308
|
-
return ke(_t,
|
|
307
|
+
return ke(_t, g);
|
|
309
308
|
},
|
|
310
309
|
size: 180
|
|
311
310
|
},
|
|
@@ -336,16 +335,17 @@ function un() {
|
|
|
336
335
|
enableSorting: !0,
|
|
337
336
|
sortUndefined: "last",
|
|
338
337
|
cell(c) {
|
|
339
|
-
var
|
|
340
|
-
const l = c.row.original.day,
|
|
341
|
-
if (typeof l != "number" || typeof
|
|
338
|
+
var T, k;
|
|
339
|
+
const l = c.row.original.day, g = c.row.original.operator, B = (T = c.row.original.thresholds) == null ? void 0 : T.low, b = (k = c.row.original.thresholds) == null ? void 0 : k.mid;
|
|
340
|
+
if (typeof l != "number" || typeof B != "number" || typeof b != "number")
|
|
342
341
|
return ke(Ke, {
|
|
343
|
-
days: l
|
|
342
|
+
days: l,
|
|
343
|
+
operator: g
|
|
344
344
|
});
|
|
345
|
-
const
|
|
345
|
+
const r = l <= B ? Ge.low : l <= b ? Ge.mid : Ge.high;
|
|
346
346
|
return ke(Ke, {
|
|
347
347
|
days: l,
|
|
348
|
-
level:
|
|
348
|
+
level: r
|
|
349
349
|
});
|
|
350
350
|
},
|
|
351
351
|
size: 200
|
|
@@ -355,8 +355,8 @@ function un() {
|
|
|
355
355
|
cell(c) {
|
|
356
356
|
var l;
|
|
357
357
|
return Ct(
|
|
358
|
-
((l =
|
|
359
|
-
(
|
|
358
|
+
((l = h._currentLocation) == null ? void 0 : l.type) === "restaurant" ? nn : on,
|
|
359
|
+
(g) => m.onActionMenu(g, c.row.original)
|
|
360
360
|
);
|
|
361
361
|
},
|
|
362
362
|
enableSorting: !1,
|
|
@@ -372,41 +372,41 @@ function un() {
|
|
|
372
372
|
const cn = {
|
|
373
373
|
context: null,
|
|
374
374
|
error: null,
|
|
375
|
-
isRequired(
|
|
376
|
-
return `${this.context ?? ""}`.length === 0 && (this.error =
|
|
375
|
+
isRequired(h = "This field is required") {
|
|
376
|
+
return `${this.context ?? ""}`.length === 0 && (this.error = h), this;
|
|
377
377
|
},
|
|
378
|
-
isString(
|
|
379
|
-
return this.error ? this : (typeof this.context != "string" && (this.error ?? (this.error =
|
|
378
|
+
isString(h = "Must be a valid string") {
|
|
379
|
+
return this.error ? this : (typeof this.context != "string" && (this.error ?? (this.error = h)), this);
|
|
380
380
|
},
|
|
381
381
|
toInt() {
|
|
382
382
|
return this.error ? this : (this.context = +this.context, this);
|
|
383
383
|
},
|
|
384
|
-
isInteger(
|
|
385
|
-
return this.error ? this : (this.toInt(), isNaN(this.context) && (this.error =
|
|
384
|
+
isInteger(h = "Must be an integer") {
|
|
385
|
+
return this.error ? this : (this.toInt(), isNaN(this.context) && (this.error = h), this);
|
|
386
386
|
},
|
|
387
|
-
min(
|
|
387
|
+
min(h, m) {
|
|
388
388
|
if (this.error) return this;
|
|
389
389
|
try {
|
|
390
|
-
typeof this.context == "number" ? +this.context <
|
|
390
|
+
typeof this.context == "number" ? +this.context < h && (this.error = m ?? `Must be at least ${h}`) : Object.prototype.hasOwnProperty.call(this.context, "length") ? +this.context.length < h && (this.error = m ?? `Must be at least ${h}`) : this.error = "Length cannot be determined";
|
|
391
391
|
} catch {
|
|
392
392
|
this.error = "Length cannot be determined";
|
|
393
393
|
}
|
|
394
394
|
return this;
|
|
395
395
|
},
|
|
396
|
-
max(
|
|
396
|
+
max(h, m) {
|
|
397
397
|
if (this.error) return this;
|
|
398
398
|
try {
|
|
399
|
-
typeof this.context == "number" ? +this.context >
|
|
399
|
+
typeof this.context == "number" ? +this.context > h && (this.error = m ?? `Must be at most ${h}`) : "length" in this.context ? +this.context.length > h && (this.error = m ?? `Must be at most ${h}`) : this.error = "Length cannot be determined";
|
|
400
400
|
} catch {
|
|
401
401
|
this.error = "Length cannot be determined";
|
|
402
402
|
}
|
|
403
403
|
return this;
|
|
404
404
|
}
|
|
405
405
|
};
|
|
406
|
-
function rt(
|
|
407
|
-
return { ...cn, context:
|
|
406
|
+
function rt(h) {
|
|
407
|
+
return { ...cn, context: h };
|
|
408
408
|
}
|
|
409
|
-
const dn = { class: "flex items-center" }, mn = { class: "fm-typo-en-title-md-800" }, fn = { class: "flex flex-col gap-24 w-full" },
|
|
409
|
+
const dn = { class: "flex items-center" }, mn = { class: "fm-typo-en-title-md-800" }, fn = { class: "flex flex-col gap-24 w-full" }, pn = { class: "flex flex-col gap-8" }, vn = { class: "fm-typo-en-body-lg-600" }, yn = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary flex-grow" }, _n = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-error" }, kn = { class: "flex flex-col p-16 gap-8" }, hn = { class: "flex flex-col gap-4" }, gn = { class: "fm-typo-en-body-md-600 text-fm-color-typo-secondary bg-fm-color-neutral-gray-100 border-b py-12 px-16" }, bn = { class: "grid grid-cols-[auto_100px_100px_48px] xs:grid-cols-[auto_80px_120px_48px] gap-8 px-8 items-center" }, xn = { class: "xs:col-span-3" }, Sn = { class: "flex gap-8" }, wn = /* @__PURE__ */ me({
|
|
410
410
|
__name: "ConvertSkuDialog",
|
|
411
411
|
props: {
|
|
412
412
|
sku: {},
|
|
@@ -414,51 +414,51 @@ const dn = { class: "flex items-center" }, mn = { class: "fm-typo-en-title-md-80
|
|
|
414
414
|
show: { type: Boolean }
|
|
415
415
|
},
|
|
416
416
|
emits: ["update:show", "submitted"],
|
|
417
|
-
setup(
|
|
418
|
-
const s =
|
|
417
|
+
setup(h, { expose: m, emit: d }) {
|
|
418
|
+
const s = h, M = d, w = Ot(), c = Re(), l = we(), g = Se(), { t: B } = fe(), b = z(0), r = z(null), v = Y(() => c.skus), T = Y(
|
|
419
419
|
() => {
|
|
420
|
-
var
|
|
421
|
-
return ((($ = (
|
|
420
|
+
var f, $;
|
|
421
|
+
return ((($ = (f = s.sku) == null ? void 0 : f.convert) == null ? void 0 : $.inventoryBindings) ?? []).filter(
|
|
422
422
|
(G) => G.type === Ze.enum.SKU
|
|
423
423
|
);
|
|
424
424
|
}
|
|
425
|
-
),
|
|
425
|
+
), k = Y({
|
|
426
426
|
get() {
|
|
427
|
-
return !!
|
|
427
|
+
return !!r.value;
|
|
428
428
|
},
|
|
429
|
-
set(
|
|
430
|
-
|
|
429
|
+
set(f) {
|
|
430
|
+
f ? r.value = Pe(T.value) : (r.value = null, b.value = Math.min(b.value, s.maxCount ?? 0));
|
|
431
431
|
}
|
|
432
432
|
}), x = z(!1);
|
|
433
|
-
$e([() => s.show], ([
|
|
434
|
-
|
|
433
|
+
$e([() => s.show], ([f]) => {
|
|
434
|
+
f && (b.value = 0);
|
|
435
435
|
});
|
|
436
436
|
function o() {
|
|
437
|
-
R(s.sku, Ie(b.value),
|
|
437
|
+
R(s.sku, Ie(b.value), r.value);
|
|
438
438
|
}
|
|
439
|
-
function t(
|
|
440
|
-
if (
|
|
439
|
+
function t(f) {
|
|
440
|
+
if (r.value)
|
|
441
441
|
return !0;
|
|
442
|
-
const $ = rt(
|
|
442
|
+
const $ = rt(f).isInteger().max(s.maxCount ?? 0).error ?? "";
|
|
443
443
|
return $ || !0;
|
|
444
444
|
}
|
|
445
|
-
function n(
|
|
445
|
+
function n(f) {
|
|
446
446
|
var E;
|
|
447
447
|
const $ = (E = s.sku.convert) != null && E.measurement ? s.sku.unit.measurements.find((_) => {
|
|
448
|
-
var
|
|
449
|
-
return _.id === ((
|
|
450
|
-
}) ?? null : null, G = Ce(s.sku.unit, $), P =
|
|
448
|
+
var i;
|
|
449
|
+
return _.id === ((i = s.sku.convert) == null ? void 0 : i.measurement);
|
|
450
|
+
}) ?? null : null, G = Ce(s.sku.unit, $), P = Bt(+f);
|
|
451
451
|
return rt(P).isInteger().max(G).error ? "Precision cannot be more than " + G : !0;
|
|
452
452
|
}
|
|
453
453
|
const S = Y(
|
|
454
454
|
() => {
|
|
455
|
-
var
|
|
456
|
-
return (
|
|
455
|
+
var f, $;
|
|
456
|
+
return (f = s.sku.convert) != null && f.measurement ? ($ = s.sku.unit.measurements.find((G) => {
|
|
457
457
|
var P;
|
|
458
458
|
return G.id === ((P = s.sku.convert) == null ? void 0 : P.measurement);
|
|
459
459
|
})) == null ? void 0 : $.abbrev : s.sku.unit.abbrev;
|
|
460
460
|
}
|
|
461
|
-
),
|
|
461
|
+
), D = Y(() => {
|
|
462
462
|
var P, L;
|
|
463
463
|
const $ = Ft({
|
|
464
464
|
bindings: ((P = s.sku.convert) == null ? void 0 : P.inventoryBindings) ?? [],
|
|
@@ -466,47 +466,47 @@ const dn = { class: "flex items-center" }, mn = { class: "fm-typo-en-title-md-80
|
|
|
466
466
|
skuGroups: c.skuGroups,
|
|
467
467
|
recipes: c.recipes
|
|
468
468
|
}).inventoryBindings.filter((E) => "success" in E && E.success).map((E) => E).map((E) => E.binding);
|
|
469
|
-
return (L =
|
|
469
|
+
return (L = r.value ?? $) == null ? void 0 : L.map((E) => {
|
|
470
470
|
var ne, re, J, te, oe;
|
|
471
|
-
const _ = c.skus.find((ie) => ie._id === E.id),
|
|
471
|
+
const _ = c.skus.find((ie) => ie._id === E.id), i = ((ne = E.measurement) == null ? void 0 : ne.abbrev) ?? ((re = _ == null ? void 0 : _.unit) == null ? void 0 : re.abbrev), V = (J = s.sku.convert) != null && J.measurement ? s.sku.unit.measurements.find((ie) => {
|
|
472
472
|
var Fe;
|
|
473
473
|
return ie.id === ((Fe = s.sku.convert) == null ? void 0 : Fe.measurement);
|
|
474
|
-
}) ?? null : null,
|
|
474
|
+
}) ?? null : null, C = Ce(s.sku.unit, V), u = n(`${b.value}`) === !0 ? _e(
|
|
475
475
|
Dt(
|
|
476
476
|
E.amount,
|
|
477
|
-
Ie(+b.value,
|
|
477
|
+
Ie(+b.value, C)
|
|
478
478
|
),
|
|
479
479
|
!1
|
|
480
|
-
) : "0", F = (oe = (te =
|
|
480
|
+
) : "0", F = (oe = (te = r.value) == null ? void 0 : te.find((ie) => ie.id === (_ == null ? void 0 : _._id))) == null ? void 0 : oe.amount, N = F ? _e(F, !1) : null;
|
|
481
481
|
return {
|
|
482
482
|
sku: _,
|
|
483
483
|
convertAmount: N ?? u,
|
|
484
|
-
abbrev:
|
|
484
|
+
abbrev: i
|
|
485
485
|
};
|
|
486
486
|
});
|
|
487
487
|
}), A = z();
|
|
488
488
|
m({
|
|
489
489
|
validateInputs: () => {
|
|
490
|
-
var
|
|
491
|
-
($ = (
|
|
490
|
+
var f, $;
|
|
491
|
+
($ = (f = A.value) == null ? void 0 : f.validateInputs) == null || $.call(f);
|
|
492
492
|
},
|
|
493
493
|
resetInputsValidation: () => {
|
|
494
|
-
var
|
|
495
|
-
($ = (
|
|
494
|
+
var f, $;
|
|
495
|
+
($ = (f = A.value) == null ? void 0 : f.resetInputsValidation) == null || $.call(f);
|
|
496
496
|
},
|
|
497
497
|
resetInputs: () => {
|
|
498
|
-
var
|
|
499
|
-
($ = (
|
|
498
|
+
var f, $;
|
|
499
|
+
($ = (f = A.value) == null ? void 0 : f.resetInputs) == null || $.call(f);
|
|
500
500
|
}
|
|
501
501
|
});
|
|
502
502
|
const I = Ye(s, "show");
|
|
503
|
-
async function R(
|
|
503
|
+
async function R(f, $, G) {
|
|
504
504
|
x.value = !0;
|
|
505
505
|
try {
|
|
506
506
|
await l.convertSku({
|
|
507
507
|
conversions: [
|
|
508
508
|
{
|
|
509
|
-
doc:
|
|
509
|
+
doc: f,
|
|
510
510
|
amount: $,
|
|
511
511
|
overrides: G == null ? void 0 : G.map((P) => ({
|
|
512
512
|
...P,
|
|
@@ -518,95 +518,95 @@ const dn = { class: "flex items-center" }, mn = { class: "fm-typo-en-title-md-80
|
|
|
518
518
|
}))
|
|
519
519
|
}
|
|
520
520
|
]
|
|
521
|
-
}),
|
|
521
|
+
}), M("update:show", !1), M("submitted");
|
|
522
522
|
} catch (P) {
|
|
523
|
-
|
|
523
|
+
g.open({
|
|
524
524
|
title: "Something went wrong",
|
|
525
|
-
message: `Cannot convert ${
|
|
525
|
+
message: `Cannot convert ${f.name}. Please try again.`,
|
|
526
526
|
type: "error"
|
|
527
|
-
}), console.error("error at converting stock amount",
|
|
527
|
+
}), console.error("error at converting stock amount", f, $, P);
|
|
528
528
|
} finally {
|
|
529
529
|
x.value = !1;
|
|
530
530
|
}
|
|
531
531
|
}
|
|
532
|
-
function K(
|
|
532
|
+
function K(f, $, G) {
|
|
533
533
|
const P = +$;
|
|
534
534
|
let L = G;
|
|
535
|
-
$.length > 0 && isFinite(P) ? L = G.map((E) => (E.id !==
|
|
535
|
+
$.length > 0 && isFinite(P) ? L = G.map((E) => (E.id !== f || (E.amount = be(P)), E)) : L = G.map((E) => (E.id !== f || (E.amount = { amount: 0, precision: 0 }), E)), r.value = L;
|
|
536
536
|
}
|
|
537
|
-
function O(
|
|
538
|
-
const $ =
|
|
537
|
+
function O(f) {
|
|
538
|
+
const $ = v.value.find((G) => G._id === f);
|
|
539
539
|
return $ ? ft($.unit, !0) : [];
|
|
540
540
|
}
|
|
541
|
-
function Z(
|
|
542
|
-
const G = O(
|
|
541
|
+
function Z(f, $) {
|
|
542
|
+
const G = O(f), P = G.find((L) => L.value === $) ?? G.find((L) => L.value === null);
|
|
543
543
|
return P ? {
|
|
544
544
|
...P,
|
|
545
545
|
label: P.abbrev
|
|
546
546
|
} : null;
|
|
547
547
|
}
|
|
548
|
-
function q(
|
|
548
|
+
function q(f, $, G) {
|
|
549
549
|
let P;
|
|
550
550
|
if ($ === null)
|
|
551
|
-
P = G.map((L) => (L.id !==
|
|
551
|
+
P = G.map((L) => (L.id !== f || (L.measurement = null), L)) ?? [];
|
|
552
552
|
else {
|
|
553
|
-
const L =
|
|
553
|
+
const L = v.value.find((E) => E._id === f);
|
|
554
554
|
P = G.map((E) => {
|
|
555
|
-
var _,
|
|
556
|
-
return E.id !==
|
|
555
|
+
var _, i;
|
|
556
|
+
return E.id !== f || (E.measurement = (i = (_ = L == null ? void 0 : L.unit) == null ? void 0 : _.measurements) == null ? void 0 : i.find((V) => V.id === $)), E;
|
|
557
557
|
}) ?? [];
|
|
558
558
|
}
|
|
559
|
-
|
|
559
|
+
r.value = P;
|
|
560
560
|
}
|
|
561
|
-
function ue(
|
|
562
|
-
const G = $.filter((P) => P.id !==
|
|
563
|
-
|
|
561
|
+
function ue(f, $) {
|
|
562
|
+
const G = $.filter((P) => P.id !== f);
|
|
563
|
+
r.value = G;
|
|
564
564
|
}
|
|
565
565
|
function ee() {
|
|
566
|
-
const
|
|
566
|
+
const f = (r.value ?? []).map(($) => ({
|
|
567
567
|
...$,
|
|
568
568
|
type: Ze.enum.SKU
|
|
569
569
|
}));
|
|
570
570
|
w.promptIngredientsBinding(
|
|
571
|
-
|
|
572
|
-
($) =>
|
|
571
|
+
f,
|
|
572
|
+
($) => r.value = $,
|
|
573
573
|
s.sku._id
|
|
574
574
|
);
|
|
575
575
|
}
|
|
576
576
|
return $e(
|
|
577
577
|
() => s.show,
|
|
578
|
-
(
|
|
579
|
-
|
|
578
|
+
(f) => {
|
|
579
|
+
f || (r.value = null, b.value = 0);
|
|
580
580
|
}
|
|
581
|
-
), (
|
|
582
|
-
const G =
|
|
583
|
-
return
|
|
581
|
+
), (f, $) => {
|
|
582
|
+
const G = H("FmTextField"), P = H("FmForm"), L = H("FmCard"), E = H("FmSwitch"), _ = H("FmFormGroup"), i = H("FmSelect"), V = H("FmButton"), C = H("FmSideSheet");
|
|
583
|
+
return j(), X(C, {
|
|
584
584
|
"dismiss-away": "",
|
|
585
585
|
modelValue: a(I),
|
|
586
586
|
"onUpdate:modelValue": $[3] || ($[3] = (u) => Ee(I) ? I.value = u : null),
|
|
587
587
|
"max-width": 500
|
|
588
588
|
}, {
|
|
589
|
-
"side-sheet-header":
|
|
589
|
+
"side-sheet-header": U(() => [
|
|
590
590
|
e("div", dn, [
|
|
591
|
-
e("div", mn, p(a(B)("inventory.stock.convert.title", { name:
|
|
591
|
+
e("div", mn, p(a(B)("inventory.stock.convert.title", { name: f.sku.name })), 1)
|
|
592
592
|
])
|
|
593
593
|
]),
|
|
594
|
-
default:
|
|
594
|
+
default: U(() => [
|
|
595
595
|
e("div", fn, [
|
|
596
596
|
y(P, {
|
|
597
597
|
ref_key: "formRef",
|
|
598
598
|
ref: A,
|
|
599
599
|
onValidationSuccess: o
|
|
600
600
|
}, {
|
|
601
|
-
default:
|
|
601
|
+
default: U(() => [
|
|
602
602
|
y(G, {
|
|
603
603
|
disabled: x.value,
|
|
604
604
|
"model-value": b.value,
|
|
605
605
|
"onUpdate:modelValue": $[0] || ($[0] = (u) => b.value = u),
|
|
606
606
|
label: a(B)("inventory.stock.convert.amount"),
|
|
607
|
-
rules: [t, n, a(
|
|
607
|
+
rules: [t, n, a(Te)(0)],
|
|
608
608
|
"append-text": S.value,
|
|
609
|
-
"helper-text":
|
|
609
|
+
"helper-text": r.value ? void 0 : `Max ${f.maxCount} ${S.value}`
|
|
610
610
|
}, null, 8, ["disabled", "model-value", "label", "rules", "append-text", "helper-text"])
|
|
611
611
|
]),
|
|
612
612
|
_: 1
|
|
@@ -615,12 +615,12 @@ const dn = { class: "flex items-center" }, mn = { class: "fm-typo-en-title-md-80
|
|
|
615
615
|
variant: "outlined",
|
|
616
616
|
class: "p-16"
|
|
617
617
|
}, {
|
|
618
|
-
default:
|
|
619
|
-
e("div",
|
|
620
|
-
e("div",
|
|
621
|
-
(
|
|
618
|
+
default: U(() => [
|
|
619
|
+
e("div", pn, [
|
|
620
|
+
e("div", vn, p(a(B)("inventory.stock.convert.deductionSummary")), 1),
|
|
621
|
+
(j(!0), W(le, null, ce(D.value, (u) => {
|
|
622
622
|
var F, N;
|
|
623
|
-
return
|
|
623
|
+
return j(), W("div", {
|
|
624
624
|
key: (F = u.sku) == null ? void 0 : F._id,
|
|
625
625
|
class: "flex items-center"
|
|
626
626
|
}, [
|
|
@@ -633,65 +633,65 @@ const dn = { class: "flex items-center" }, mn = { class: "fm-typo-en-title-md-80
|
|
|
633
633
|
_: 1
|
|
634
634
|
}),
|
|
635
635
|
y(L, { variant: "outlined" }, {
|
|
636
|
-
default:
|
|
636
|
+
default: U(() => [
|
|
637
637
|
e("div", kn, [
|
|
638
638
|
y(E, {
|
|
639
639
|
value: "",
|
|
640
|
-
modelValue:
|
|
641
|
-
"onUpdate:modelValue": $[1] || ($[1] = (u) =>
|
|
640
|
+
modelValue: k.value,
|
|
641
|
+
"onUpdate:modelValue": $[1] || ($[1] = (u) => k.value = u),
|
|
642
642
|
label: a(B)("inventory.stock.convert.overrideDeduction"),
|
|
643
643
|
"label-placement": "right"
|
|
644
644
|
}, null, 8, ["modelValue", "label"]),
|
|
645
|
-
|
|
645
|
+
k.value ? (j(), W(le, { key: 0 }, [
|
|
646
646
|
y(_, {
|
|
647
|
-
modelValue:
|
|
648
|
-
rules: [a(
|
|
647
|
+
modelValue: r.value,
|
|
648
|
+
rules: [a(jt)(1, "Must have at least one ingredient binding")]
|
|
649
649
|
}, null, 8, ["modelValue", "rules"]),
|
|
650
650
|
e("div", hn, [
|
|
651
651
|
e("div", gn, p(a(B)("inventory.stock.convert.ingredients")), 1),
|
|
652
|
-
(
|
|
652
|
+
(j(!0), W(le, null, ce(r.value, (u) => (j(), X(_, {
|
|
653
653
|
key: u.id,
|
|
654
654
|
disabled: x.value,
|
|
655
655
|
modelValue: +a(_e)(u.amount ?? { amount: 1, precision: 0 }),
|
|
656
656
|
rules: [
|
|
657
|
-
a(
|
|
658
|
-
|
|
657
|
+
a(Mt)(
|
|
658
|
+
v.value.find((F) => F._id === u.id).unit,
|
|
659
659
|
u.measurement
|
|
660
660
|
),
|
|
661
|
-
a(
|
|
661
|
+
a(Te)(0)
|
|
662
662
|
]
|
|
663
663
|
}, {
|
|
664
|
-
default:
|
|
664
|
+
default: U(({ invalid: F }) => {
|
|
665
665
|
var N, ne, re;
|
|
666
666
|
return [
|
|
667
667
|
e("div", bn, [
|
|
668
|
-
e("div", xn, p((N =
|
|
668
|
+
e("div", xn, p((N = v.value.find((J) => J._id === u.id)) == null ? void 0 : N.name), 1),
|
|
669
669
|
y(G, {
|
|
670
670
|
class: "xs:col-span-2",
|
|
671
671
|
disabled: x.value,
|
|
672
672
|
modelValue: +a(_e)(
|
|
673
673
|
u.amount ?? { amount: 1, precision: 0 }
|
|
674
674
|
),
|
|
675
|
-
"onUpdate:modelValue": (J) => K(u.id, J,
|
|
675
|
+
"onUpdate:modelValue": (J) => K(u.id, J, r.value ?? []),
|
|
676
676
|
invalid: F
|
|
677
677
|
}, null, 8, ["disabled", "modelValue", "onUpdate:modelValue", "invalid"]),
|
|
678
|
-
y(
|
|
678
|
+
y(i, {
|
|
679
679
|
disabled: x.value,
|
|
680
680
|
class: "translate-y-[2px]",
|
|
681
681
|
items: O(u.id),
|
|
682
682
|
"model-value": (re = Z(u.id, (ne = u.measurement) == null ? void 0 : ne.id)) == null ? void 0 : re.value,
|
|
683
|
-
"onUpdate:modelValue": (J) => q(u.id, J,
|
|
683
|
+
"onUpdate:modelValue": (J) => q(u.id, J, r.value ?? []),
|
|
684
684
|
invalid: F
|
|
685
685
|
}, {
|
|
686
|
-
"helper-text":
|
|
686
|
+
"helper-text": U(() => $[4] || ($[4] = [])),
|
|
687
687
|
_: 2
|
|
688
688
|
}, 1032, ["disabled", "items", "model-value", "onUpdate:modelValue", "invalid"]),
|
|
689
|
-
y(
|
|
689
|
+
y(V, {
|
|
690
690
|
disabled: x.value,
|
|
691
691
|
type: "button",
|
|
692
692
|
variant: "tertiary",
|
|
693
693
|
icon: "delete",
|
|
694
|
-
onClick: (J) => ue(u.id,
|
|
694
|
+
onClick: (J) => ue(u.id, r.value ?? [])
|
|
695
695
|
}, null, 8, ["disabled", "onClick"])
|
|
696
696
|
])
|
|
697
697
|
];
|
|
@@ -700,7 +700,7 @@ const dn = { class: "flex items-center" }, mn = { class: "fm-typo-en-title-md-80
|
|
|
700
700
|
}, 1032, ["disabled", "modelValue", "rules"]))), 128))
|
|
701
701
|
]),
|
|
702
702
|
e("div", null, [
|
|
703
|
-
y(
|
|
703
|
+
y(V, {
|
|
704
704
|
icon: "link",
|
|
705
705
|
label: a(B)("inventory.stock.convert.linkIngredient"),
|
|
706
706
|
variant: "plain",
|
|
@@ -714,9 +714,9 @@ const dn = { class: "flex items-center" }, mn = { class: "fm-typo-en-title-md-80
|
|
|
714
714
|
})
|
|
715
715
|
])
|
|
716
716
|
]),
|
|
717
|
-
"side-sheet-footer":
|
|
717
|
+
"side-sheet-footer": U(() => [
|
|
718
718
|
e("div", Sn, [
|
|
719
|
-
y(
|
|
719
|
+
y(V, {
|
|
720
720
|
loading: x.value,
|
|
721
721
|
label: a(B)("inventory.stock.convert.convertButton"),
|
|
722
722
|
onClick: $[2] || ($[2] = (u) => {
|
|
@@ -731,12 +731,12 @@ const dn = { class: "flex items-center" }, mn = { class: "fm-typo-en-title-md-80
|
|
|
731
731
|
};
|
|
732
732
|
}
|
|
733
733
|
});
|
|
734
|
-
function je(
|
|
735
|
-
const d = Ie(
|
|
734
|
+
function je(h, m) {
|
|
735
|
+
const d = Ie(h, m);
|
|
736
736
|
return { ...d, amount: -d.amount };
|
|
737
737
|
}
|
|
738
|
-
function it(
|
|
739
|
-
return Ie(Math.abs(
|
|
738
|
+
function it(h, m) {
|
|
739
|
+
return Ie(Math.abs(h), m);
|
|
740
740
|
}
|
|
741
741
|
const We = {
|
|
742
742
|
[ae.enum.DAMAGE]: {
|
|
@@ -770,13 +770,13 @@ const We = {
|
|
|
770
770
|
disabled: { type: Boolean }
|
|
771
771
|
},
|
|
772
772
|
emits: ["update:modelValue", "click:delete"],
|
|
773
|
-
setup(
|
|
774
|
-
const d =
|
|
773
|
+
setup(h, { emit: m }) {
|
|
774
|
+
const d = h, s = m, { t: M } = fe(), w = Oe(), c = Y(
|
|
775
775
|
() => Object.keys(We).map((t) => ({
|
|
776
776
|
label: At(t),
|
|
777
777
|
value: t
|
|
778
778
|
}))
|
|
779
|
-
), l = Y(() => ft(d.modelValue.doc.unit, !0)),
|
|
779
|
+
), l = Y(() => ft(d.modelValue.doc.unit, !0)), g = Y({
|
|
780
780
|
get() {
|
|
781
781
|
return d.modelValue.type ?? ae.enum.PURCHASE;
|
|
782
782
|
},
|
|
@@ -800,7 +800,7 @@ const We = {
|
|
|
800
800
|
const n = {
|
|
801
801
|
...d.modelValue
|
|
802
802
|
}, S = be(t);
|
|
803
|
-
n.amount = We[
|
|
803
|
+
n.amount = We[g.value].toAdjustmentAmount(
|
|
804
804
|
t,
|
|
805
805
|
S.precision
|
|
806
806
|
), s("update:modelValue", n);
|
|
@@ -811,13 +811,13 @@ const We = {
|
|
|
811
811
|
return ((t = d.modelValue.measurement) == null ? void 0 : t.id) ?? null;
|
|
812
812
|
},
|
|
813
813
|
set(t) {
|
|
814
|
-
var S,
|
|
814
|
+
var S, D;
|
|
815
815
|
const n = {
|
|
816
816
|
...d.modelValue
|
|
817
817
|
};
|
|
818
|
-
n.measurement = ((
|
|
818
|
+
n.measurement = ((D = (S = d.modelValue.doc.unit) == null ? void 0 : S.measurements) == null ? void 0 : D.find((A) => A.id === t)) ?? null, s("update:modelValue", n);
|
|
819
819
|
}
|
|
820
|
-
}),
|
|
820
|
+
}), r = Y({
|
|
821
821
|
get() {
|
|
822
822
|
return d.modelValue.remark ?? "";
|
|
823
823
|
},
|
|
@@ -827,25 +827,25 @@ const We = {
|
|
|
827
827
|
};
|
|
828
828
|
n.remark = t, s("update:modelValue", n);
|
|
829
829
|
}
|
|
830
|
-
}),
|
|
830
|
+
}), v = Y(() => {
|
|
831
831
|
var n;
|
|
832
832
|
const t = (n = w.stockBalance.skus) == null ? void 0 : n.find((S) => S.id === d.modelValue.doc._id);
|
|
833
833
|
return (t == null ? void 0 : t.balance) ?? { amount: 0, precision: 0 };
|
|
834
834
|
}), T = Y(() => {
|
|
835
835
|
const t = d.modelValue.amount, n = d.modelValue.measurement;
|
|
836
836
|
return n ? dt(t, n.conversion) : t;
|
|
837
|
-
}),
|
|
838
|
-
() => Je(
|
|
837
|
+
}), k = Y(
|
|
838
|
+
() => Je(v.value, T.value)
|
|
839
839
|
), x = Y(
|
|
840
|
-
() => Ve(
|
|
840
|
+
() => Ve(k.value, d.modelValue.doc.unit)
|
|
841
841
|
), o = Y(() => T.value.amount < 0);
|
|
842
842
|
return (t, n) => {
|
|
843
|
-
const S =
|
|
844
|
-
return
|
|
843
|
+
const S = H("FmButton"), D = H("FmSelect"), A = H("FmTextarea"), I = H("FmCard");
|
|
844
|
+
return j(), X(I, {
|
|
845
845
|
variant: "outlined",
|
|
846
846
|
class: "grid grid-cols-2 gap-8 p-16"
|
|
847
847
|
}, {
|
|
848
|
-
default:
|
|
848
|
+
default: U(() => [
|
|
849
849
|
e("div", Fn, [
|
|
850
850
|
e("div", An, [
|
|
851
851
|
e("div", $n, p(t.modelValue.doc.name), 1),
|
|
@@ -857,14 +857,14 @@ const We = {
|
|
|
857
857
|
onClick: n[0] || (n[0] = (R) => s("click:delete"))
|
|
858
858
|
})
|
|
859
859
|
]),
|
|
860
|
-
y(
|
|
860
|
+
y(D, {
|
|
861
861
|
disabled: t.disabled,
|
|
862
862
|
class: "col-span-2",
|
|
863
863
|
label: "Type",
|
|
864
864
|
items: c.value,
|
|
865
|
-
modelValue:
|
|
866
|
-
"onUpdate:modelValue": n[1] || (n[1] = (R) =>
|
|
867
|
-
rules: [a(
|
|
865
|
+
modelValue: g.value,
|
|
866
|
+
"onUpdate:modelValue": n[1] || (n[1] = (R) => g.value = R),
|
|
867
|
+
rules: [a(It)()],
|
|
868
868
|
"label-mark": "required"
|
|
869
869
|
}, null, 8, ["disabled", "items", "modelValue", "rules"]),
|
|
870
870
|
y(Nt, {
|
|
@@ -876,9 +876,9 @@ const We = {
|
|
|
876
876
|
}),
|
|
877
877
|
modelValue: B.value,
|
|
878
878
|
"onUpdate:modelValue": n[2] || (n[2] = (R) => B.value = R),
|
|
879
|
-
rules: [a(
|
|
879
|
+
rules: [a(Te)(0)]
|
|
880
880
|
}, null, 8, ["disabled", "step", "modelValue", "rules"]),
|
|
881
|
-
y(
|
|
881
|
+
y(D, {
|
|
882
882
|
disabled: t.disabled,
|
|
883
883
|
label: "Unit",
|
|
884
884
|
items: l.value,
|
|
@@ -889,12 +889,12 @@ const We = {
|
|
|
889
889
|
class: "col-span-2",
|
|
890
890
|
disabled: t.disabled,
|
|
891
891
|
label: "Remark",
|
|
892
|
-
modelValue:
|
|
893
|
-
"onUpdate:modelValue": n[4] || (n[4] = (R) =>
|
|
892
|
+
modelValue: r.value,
|
|
893
|
+
"onUpdate:modelValue": n[4] || (n[4] = (R) => r.value = R),
|
|
894
894
|
"label-mark": "optional"
|
|
895
895
|
}, null, 8, ["disabled", "modelValue"]),
|
|
896
896
|
e("div", Cn, [
|
|
897
|
-
e("div", Dn, p(a(
|
|
897
|
+
e("div", Dn, p(a(M)("inventory.stock.stock_adjustment.stockAfter")), 1),
|
|
898
898
|
e("div", {
|
|
899
899
|
class: ge(["fm-typo-en-body-lg-600", o.value ? "text-red-700" : "text-green-700"])
|
|
900
900
|
}, p(x.value), 3)
|
|
@@ -904,34 +904,34 @@ const We = {
|
|
|
904
904
|
});
|
|
905
905
|
};
|
|
906
906
|
}
|
|
907
|
-
}), jn = { class: "flex items-center" }, Mn = { class: "fm-typo-en-title-md-800" }, Bn = { class: "flex items-center" }, In = { class: "fm-typo-en-title-sm-800 flex-1" }, Tn = { class: "flex gap-8" },
|
|
907
|
+
}), jn = { class: "flex items-center" }, Mn = { class: "fm-typo-en-title-md-800" }, Bn = { class: "flex items-center" }, In = { class: "fm-typo-en-title-sm-800 flex-1" }, Tn = { class: "flex gap-8" }, Hn = /* @__PURE__ */ me({
|
|
908
908
|
__name: "AdjustSkuDialog",
|
|
909
909
|
props: {
|
|
910
910
|
stock: {},
|
|
911
911
|
show: { type: Boolean }
|
|
912
912
|
},
|
|
913
913
|
emits: ["update:show", "submitted"],
|
|
914
|
-
setup(
|
|
915
|
-
const s =
|
|
916
|
-
function
|
|
917
|
-
x(Pe(
|
|
914
|
+
setup(h, { expose: m, emit: d }) {
|
|
915
|
+
const s = h, M = d, w = Re(), c = Ne(), l = we(), g = Se(), B = z(!1), { t: b } = fe();
|
|
916
|
+
function r() {
|
|
917
|
+
x(Pe(k));
|
|
918
918
|
}
|
|
919
|
-
const
|
|
919
|
+
const v = z();
|
|
920
920
|
m({
|
|
921
921
|
validateInputs: () => {
|
|
922
922
|
var n, S;
|
|
923
|
-
(S = (n =
|
|
923
|
+
(S = (n = v.value) == null ? void 0 : n.validateInputs) == null || S.call(n);
|
|
924
924
|
},
|
|
925
925
|
resetInputsValidation: () => {
|
|
926
926
|
var n, S;
|
|
927
|
-
(S = (n =
|
|
927
|
+
(S = (n = v.value) == null ? void 0 : n.resetInputsValidation) == null || S.call(n);
|
|
928
928
|
},
|
|
929
929
|
resetInputs: () => {
|
|
930
930
|
var n, S;
|
|
931
|
-
(S = (n =
|
|
931
|
+
(S = (n = v.value) == null ? void 0 : n.resetInputs) == null || S.call(n);
|
|
932
932
|
}
|
|
933
933
|
});
|
|
934
|
-
const T = Ye(s, "show"),
|
|
934
|
+
const T = Ye(s, "show"), k = ut({
|
|
935
935
|
remark: "",
|
|
936
936
|
adjustments: [
|
|
937
937
|
{
|
|
@@ -945,7 +945,7 @@ const We = {
|
|
|
945
945
|
]
|
|
946
946
|
});
|
|
947
947
|
$e([() => s.show], ([n]) => {
|
|
948
|
-
n && (
|
|
948
|
+
n && (k.remark = "", k.adjustments = [
|
|
949
949
|
{
|
|
950
950
|
id: `sku_${(/* @__PURE__ */ new Date()).toISOString()}_${Math.random().toString(16).slice(2, 8)}`,
|
|
951
951
|
type: ae.enum.PURCHASE,
|
|
@@ -961,17 +961,17 @@ const We = {
|
|
|
961
961
|
try {
|
|
962
962
|
await l.adjustSku({
|
|
963
963
|
remark: n.remark,
|
|
964
|
-
adjustments: n.adjustments.map(({ doc: S, remark:
|
|
964
|
+
adjustments: n.adjustments.map(({ doc: S, remark: D, type: A, amount: I, measurement: R }) => ({
|
|
965
965
|
id: S._id,
|
|
966
966
|
amount: I,
|
|
967
967
|
measurement: R,
|
|
968
|
-
remark:
|
|
968
|
+
remark: D,
|
|
969
969
|
doc: S,
|
|
970
970
|
type: A
|
|
971
971
|
}))
|
|
972
|
-
}),
|
|
972
|
+
}), M("update:show", !1), M("submitted");
|
|
973
973
|
} catch (S) {
|
|
974
|
-
|
|
974
|
+
g.open({
|
|
975
975
|
title: b("inventory.stock.adjust.error.title"),
|
|
976
976
|
message: b("inventory.stock.adjust.error.message"),
|
|
977
977
|
type: "error"
|
|
@@ -981,14 +981,14 @@ const We = {
|
|
|
981
981
|
}
|
|
982
982
|
}
|
|
983
983
|
function o() {
|
|
984
|
-
const n = w.skus.map((
|
|
985
|
-
label:
|
|
986
|
-
sublabel:
|
|
987
|
-
value:
|
|
988
|
-
})), S = n.filter((
|
|
984
|
+
const n = w.skus.map((D) => ({
|
|
985
|
+
label: D.name,
|
|
986
|
+
sublabel: D.code,
|
|
987
|
+
value: D._id
|
|
988
|
+
})), S = n.filter((D) => k.adjustments.find((A) => A.doc._id === D.value)).map((D) => D.value);
|
|
989
989
|
c.open({
|
|
990
990
|
title: "Select ingredients",
|
|
991
|
-
contentComponent:
|
|
991
|
+
contentComponent: vt,
|
|
992
992
|
contentComponentProps: {
|
|
993
993
|
items: n,
|
|
994
994
|
modelValue: S
|
|
@@ -1005,9 +1005,9 @@ const We = {
|
|
|
1005
1005
|
close: !0,
|
|
1006
1006
|
variant: "tertiary"
|
|
1007
1007
|
}
|
|
1008
|
-
}).onPrimary((
|
|
1009
|
-
|
|
1010
|
-
(A) =>
|
|
1008
|
+
}).onPrimary((D) => {
|
|
1009
|
+
k.adjustments = D.map(
|
|
1010
|
+
(A) => k.adjustments.find((I) => I.doc._id === A) ?? {
|
|
1011
1011
|
id: `sku_${(/* @__PURE__ */ new Date()).toISOString()}_${Math.random().toString(16).slice(2, 8)}`,
|
|
1012
1012
|
type: ae.enum.PURCHASE,
|
|
1013
1013
|
doc: w.skus.find((I) => I._id === A),
|
|
@@ -1019,33 +1019,33 @@ const We = {
|
|
|
1019
1019
|
});
|
|
1020
1020
|
}
|
|
1021
1021
|
function t(n) {
|
|
1022
|
-
|
|
1022
|
+
k.adjustments.splice(n, 1);
|
|
1023
1023
|
}
|
|
1024
1024
|
return (n, S) => {
|
|
1025
|
-
const
|
|
1026
|
-
return
|
|
1025
|
+
const D = H("FmTextarea"), A = H("FmButton"), I = H("FmForm"), R = H("FmSideSheet");
|
|
1026
|
+
return j(), X(R, {
|
|
1027
1027
|
modelValue: a(T),
|
|
1028
1028
|
"onUpdate:modelValue": S[2] || (S[2] = (K) => Ee(T) ? T.value = K : null),
|
|
1029
1029
|
"dismiss-away": "",
|
|
1030
1030
|
"max-width": 500
|
|
1031
1031
|
}, {
|
|
1032
|
-
"side-sheet-header":
|
|
1032
|
+
"side-sheet-header": U(() => [
|
|
1033
1033
|
e("div", jn, [
|
|
1034
1034
|
e("div", Mn, p(a(b)("inventory.stock.adjust.title")), 1)
|
|
1035
1035
|
])
|
|
1036
1036
|
]),
|
|
1037
|
-
default:
|
|
1037
|
+
default: U(() => [
|
|
1038
1038
|
y(I, {
|
|
1039
1039
|
class: "w-full flex flex-col gap-12",
|
|
1040
1040
|
ref_key: "formRef",
|
|
1041
|
-
ref:
|
|
1042
|
-
onValidationSuccess:
|
|
1041
|
+
ref: v,
|
|
1042
|
+
onValidationSuccess: r
|
|
1043
1043
|
}, {
|
|
1044
|
-
default:
|
|
1045
|
-
y(
|
|
1044
|
+
default: U(() => [
|
|
1045
|
+
y(D, {
|
|
1046
1046
|
label: a(b)("inventory.stock.adjust.remark"),
|
|
1047
|
-
modelValue:
|
|
1048
|
-
"onUpdate:modelValue": S[0] || (S[0] = (K) =>
|
|
1047
|
+
modelValue: k.remark,
|
|
1048
|
+
"onUpdate:modelValue": S[0] || (S[0] = (K) => k.remark = K)
|
|
1049
1049
|
}, null, 8, ["label", "modelValue"]),
|
|
1050
1050
|
e("div", Bn, [
|
|
1051
1051
|
e("div", In, p(a(b)("inventory.stock.adjust.adjustedItems")), 1),
|
|
@@ -1056,24 +1056,24 @@ const We = {
|
|
|
1056
1056
|
onClick: o
|
|
1057
1057
|
})
|
|
1058
1058
|
]),
|
|
1059
|
-
(
|
|
1059
|
+
(j(!0), W(le, null, ce(k.adjustments, (K, O) => (j(), X(ht, {
|
|
1060
1060
|
key: K.id,
|
|
1061
|
-
modelValue:
|
|
1062
|
-
"onUpdate:modelValue": (Z) =>
|
|
1061
|
+
modelValue: k.adjustments[O],
|
|
1062
|
+
"onUpdate:modelValue": (Z) => k.adjustments[O] = Z,
|
|
1063
1063
|
"onClick:delete": (Z) => t(O)
|
|
1064
1064
|
}, null, 8, ["modelValue", "onUpdate:modelValue", "onClick:delete"]))), 128))
|
|
1065
1065
|
]),
|
|
1066
1066
|
_: 1
|
|
1067
1067
|
}, 512)
|
|
1068
1068
|
]),
|
|
1069
|
-
"side-sheet-footer":
|
|
1069
|
+
"side-sheet-footer": U(() => [
|
|
1070
1070
|
e("div", Tn, [
|
|
1071
1071
|
y(A, {
|
|
1072
1072
|
label: a(b)("inventory.stock.adjust.adjustButton"),
|
|
1073
1073
|
loading: B.value,
|
|
1074
1074
|
onClick: S[1] || (S[1] = (K) => {
|
|
1075
1075
|
var O, Z;
|
|
1076
|
-
return (Z = (O =
|
|
1076
|
+
return (Z = (O = v.value) == null ? void 0 : O.validateInputs) == null ? void 0 : Z.call(O);
|
|
1077
1077
|
})
|
|
1078
1078
|
}, null, 8, ["label", "loading"])
|
|
1079
1079
|
])
|
|
@@ -1082,50 +1082,50 @@ const We = {
|
|
|
1082
1082
|
}, 8, ["modelValue"]);
|
|
1083
1083
|
};
|
|
1084
1084
|
}
|
|
1085
|
-
}),
|
|
1085
|
+
}), Un = { class: "flex items-center w-full gap-8" }, En = { class: "fm-typo-en-title-md-800 flex-1" }, Pn = { class: "flex flex-col gap-16" }, Rn = { class: "flex flex-col gap-4" }, On = { class: "fm-typo-en-body-md-600" }, Nn = { class: "flex gap-8 items-start" }, Yn = { class: "flex-1 min-w-0" }, Ln = { class: "flex-1 min-w-0" }, zn = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Gn = { class: "flex items-center" }, Wn = { class: "fm-typo-en-title-sm-800 flex-1" }, Kn = { class: "flex gap-8" }, qn = /* @__PURE__ */ me({
|
|
1086
1086
|
__name: "StockAdjustmentSideSheet",
|
|
1087
1087
|
props: {
|
|
1088
1088
|
show: { type: Boolean }
|
|
1089
1089
|
},
|
|
1090
1090
|
emits: ["update:show", "submitted"],
|
|
1091
|
-
setup(
|
|
1092
|
-
const d =
|
|
1091
|
+
setup(h, { emit: m }) {
|
|
1092
|
+
const d = h, s = m, { t: M } = fe(), w = Re(), c = we(), l = Ne(), g = Se(), B = Ye(d, "show"), b = z(!1), r = ut({
|
|
1093
1093
|
remark: "",
|
|
1094
1094
|
effectiveAt: /* @__PURE__ */ new Date(),
|
|
1095
1095
|
adjustments: []
|
|
1096
|
-
}),
|
|
1097
|
-
$e([
|
|
1098
|
-
if (
|
|
1099
|
-
const
|
|
1100
|
-
if (
|
|
1096
|
+
}), v = z(ye().format("YYYY-MM-DD")), T = z(ye().format("HH:mm"));
|
|
1097
|
+
$e([v, T], () => {
|
|
1098
|
+
if (v.value && T.value) {
|
|
1099
|
+
const D = ye(`${v.value} ${T.value}`, "YYYY-MM-DD HH:mm");
|
|
1100
|
+
if (D.isValid()) {
|
|
1101
1101
|
const A = ye();
|
|
1102
|
-
|
|
1102
|
+
D.isAfter(A) ? r.effectiveAt = A.toDate() : r.effectiveAt = D.toDate();
|
|
1103
1103
|
}
|
|
1104
1104
|
}
|
|
1105
1105
|
});
|
|
1106
|
-
function
|
|
1107
|
-
|
|
1106
|
+
function k() {
|
|
1107
|
+
r.remark = "", r.effectiveAt = /* @__PURE__ */ new Date(), r.adjustments = [], v.value = ye(r.effectiveAt).format("YYYY-MM-DD"), T.value = ye(r.effectiveAt).format("HH:mm");
|
|
1108
1108
|
}
|
|
1109
1109
|
function x() {
|
|
1110
|
-
|
|
1110
|
+
k();
|
|
1111
1111
|
}
|
|
1112
1112
|
const o = Y(() => {
|
|
1113
|
-
const
|
|
1113
|
+
const D = {};
|
|
1114
1114
|
return w.skus.forEach((A) => {
|
|
1115
|
-
|
|
1116
|
-
}),
|
|
1115
|
+
D[A._id] = A;
|
|
1116
|
+
}), D;
|
|
1117
1117
|
});
|
|
1118
1118
|
function t() {
|
|
1119
|
-
const
|
|
1119
|
+
const D = w.skus.map((I) => ({
|
|
1120
1120
|
label: I.name,
|
|
1121
1121
|
sublabel: I.code,
|
|
1122
1122
|
value: I._id
|
|
1123
|
-
})), A =
|
|
1123
|
+
})), A = r.adjustments.map((I) => I.doc._id);
|
|
1124
1124
|
l.open({
|
|
1125
|
-
title:
|
|
1126
|
-
contentComponent:
|
|
1125
|
+
title: M("inventory.stock.adjust.selectIngredients"),
|
|
1126
|
+
contentComponent: vt,
|
|
1127
1127
|
contentComponentProps: {
|
|
1128
|
-
items:
|
|
1128
|
+
items: D,
|
|
1129
1129
|
modelValue: A,
|
|
1130
1130
|
virtualScroll: !0
|
|
1131
1131
|
},
|
|
@@ -1133,17 +1133,17 @@ const We = {
|
|
|
1133
1133
|
closeButton: !0,
|
|
1134
1134
|
dismissAway: !0,
|
|
1135
1135
|
primaryActions: {
|
|
1136
|
-
text:
|
|
1136
|
+
text: M("common.confirm"),
|
|
1137
1137
|
close: !0
|
|
1138
1138
|
},
|
|
1139
1139
|
secondaryActions: {
|
|
1140
|
-
text:
|
|
1140
|
+
text: M("common.close"),
|
|
1141
1141
|
close: !0,
|
|
1142
1142
|
variant: "tertiary"
|
|
1143
1143
|
}
|
|
1144
1144
|
}).onPrimary((I) => {
|
|
1145
|
-
|
|
1146
|
-
(R) =>
|
|
1145
|
+
r.adjustments = I.map(
|
|
1146
|
+
(R) => r.adjustments.find((K) => K.doc._id === R) ?? {
|
|
1147
1147
|
id: "",
|
|
1148
1148
|
type: ae.enum.PURCHASE,
|
|
1149
1149
|
doc: o.value[R],
|
|
@@ -1154,21 +1154,21 @@ const We = {
|
|
|
1154
1154
|
);
|
|
1155
1155
|
});
|
|
1156
1156
|
}
|
|
1157
|
-
function n(
|
|
1158
|
-
|
|
1157
|
+
function n(D) {
|
|
1158
|
+
r.adjustments.splice(D, 1);
|
|
1159
1159
|
}
|
|
1160
1160
|
async function S() {
|
|
1161
|
-
if (
|
|
1162
|
-
|
|
1163
|
-
title:
|
|
1164
|
-
message:
|
|
1161
|
+
if (r.adjustments.length === 0) {
|
|
1162
|
+
g.open({
|
|
1163
|
+
title: M("inventory.stock.error.title"),
|
|
1164
|
+
message: M("inventory.stock.stock_adjustment.noAdjustments"),
|
|
1165
1165
|
type: "warning"
|
|
1166
1166
|
});
|
|
1167
1167
|
return;
|
|
1168
1168
|
}
|
|
1169
1169
|
b.value = !0;
|
|
1170
1170
|
try {
|
|
1171
|
-
const
|
|
1171
|
+
const D = r.adjustments.map(
|
|
1172
1172
|
({ doc: I, remark: R, type: K, amount: O, measurement: Z }) => ({
|
|
1173
1173
|
id: I._id,
|
|
1174
1174
|
amount: O,
|
|
@@ -1178,51 +1178,51 @@ const We = {
|
|
|
1178
1178
|
type: K
|
|
1179
1179
|
})
|
|
1180
1180
|
), A = {
|
|
1181
|
-
remark:
|
|
1182
|
-
adjustments:
|
|
1183
|
-
effectiveAt:
|
|
1181
|
+
remark: r.remark,
|
|
1182
|
+
adjustments: D,
|
|
1183
|
+
effectiveAt: r.effectiveAt.toISOString()
|
|
1184
1184
|
};
|
|
1185
1185
|
await c.adjustSku(Pe(A)), s("submitted"), s("update:show", !1);
|
|
1186
|
-
} catch (
|
|
1187
|
-
|
|
1188
|
-
title:
|
|
1189
|
-
message:
|
|
1186
|
+
} catch (D) {
|
|
1187
|
+
g.open({
|
|
1188
|
+
title: M("inventory.stock.adjust.error.title"),
|
|
1189
|
+
message: M("inventory.stock.adjust.error.message"),
|
|
1190
1190
|
type: "error"
|
|
1191
|
-
}), console.error("error on stock adjustment",
|
|
1191
|
+
}), console.error("error on stock adjustment", D);
|
|
1192
1192
|
} finally {
|
|
1193
1193
|
b.value = !1;
|
|
1194
1194
|
}
|
|
1195
1195
|
}
|
|
1196
|
-
return (
|
|
1197
|
-
const I =
|
|
1198
|
-
return
|
|
1196
|
+
return (D, A) => {
|
|
1197
|
+
const I = H("FmTextarea"), R = H("FmDatePicker"), K = H("FmTimePicker"), O = H("FmButton"), Z = H("FmSideSheet");
|
|
1198
|
+
return j(), X(Z, {
|
|
1199
1199
|
modelValue: a(B),
|
|
1200
1200
|
"onUpdate:modelValue": A[4] || (A[4] = (q) => Ee(B) ? B.value = q : null),
|
|
1201
1201
|
"dismiss-away": "",
|
|
1202
1202
|
"max-width": 560,
|
|
1203
1203
|
onAfterEnter: x
|
|
1204
1204
|
}, {
|
|
1205
|
-
"side-sheet-header":
|
|
1206
|
-
e("div",
|
|
1207
|
-
e("div", En, p(a(
|
|
1205
|
+
"side-sheet-header": U(() => [
|
|
1206
|
+
e("div", Un, [
|
|
1207
|
+
e("div", En, p(a(M)("inventory.stock.stock_adjustment.title")), 1)
|
|
1208
1208
|
])
|
|
1209
1209
|
]),
|
|
1210
|
-
default:
|
|
1210
|
+
default: U(() => [
|
|
1211
1211
|
e("div", Pn, [
|
|
1212
1212
|
y(I, {
|
|
1213
|
-
label: a(
|
|
1214
|
-
modelValue:
|
|
1215
|
-
"onUpdate:modelValue": A[0] || (A[0] = (q) =>
|
|
1213
|
+
label: a(M)("inventory.stock.adjust.remark"),
|
|
1214
|
+
modelValue: r.remark,
|
|
1215
|
+
"onUpdate:modelValue": A[0] || (A[0] = (q) => r.remark = q),
|
|
1216
1216
|
"label-mark": "optional"
|
|
1217
1217
|
}, null, 8, ["label", "modelValue"]),
|
|
1218
1218
|
e("div", Rn, [
|
|
1219
|
-
e("label", On, p(a(
|
|
1219
|
+
e("label", On, p(a(M)("inventory.stock.stock_adjustment.effectiveAt")), 1),
|
|
1220
1220
|
e("div", Nn, [
|
|
1221
1221
|
e("div", Yn, [
|
|
1222
1222
|
y(R, {
|
|
1223
1223
|
class: "w-full",
|
|
1224
|
-
modelValue:
|
|
1225
|
-
"onUpdate:modelValue": A[1] || (A[1] = (q) =>
|
|
1224
|
+
modelValue: v.value,
|
|
1225
|
+
"onUpdate:modelValue": A[1] || (A[1] = (q) => v.value = q),
|
|
1226
1226
|
clearable: !1,
|
|
1227
1227
|
max: a(ye)().format("YYYY-MM-DD")
|
|
1228
1228
|
}, null, 8, ["modelValue", "max"])
|
|
@@ -1236,10 +1236,10 @@ const We = {
|
|
|
1236
1236
|
}, null, 8, ["modelValue"])
|
|
1237
1237
|
])
|
|
1238
1238
|
]),
|
|
1239
|
-
e("div", zn, p(a(
|
|
1239
|
+
e("div", zn, p(a(M)("inventory.stock.stock_adjustment.immediateHint")), 1)
|
|
1240
1240
|
]),
|
|
1241
1241
|
e("div", Gn, [
|
|
1242
|
-
e("div", Wn, p(a(
|
|
1242
|
+
e("div", Wn, p(a(M)("inventory.stock.adjust.adjustedItems")), 1),
|
|
1243
1243
|
y(O, {
|
|
1244
1244
|
"prepend-icon": "add",
|
|
1245
1245
|
variant: "tertiary",
|
|
@@ -1247,23 +1247,23 @@ const We = {
|
|
|
1247
1247
|
onClick: t
|
|
1248
1248
|
})
|
|
1249
1249
|
]),
|
|
1250
|
-
(
|
|
1250
|
+
(j(!0), W(le, null, ce(r.adjustments, (q, ue) => (j(), X(ht, {
|
|
1251
1251
|
key: q.id,
|
|
1252
|
-
modelValue:
|
|
1253
|
-
"onUpdate:modelValue": (ee) =>
|
|
1252
|
+
modelValue: r.adjustments[ue],
|
|
1253
|
+
"onUpdate:modelValue": (ee) => r.adjustments[ue] = ee,
|
|
1254
1254
|
"onClick:delete": (ee) => n(ue)
|
|
1255
1255
|
}, null, 8, ["modelValue", "onUpdate:modelValue", "onClick:delete"]))), 128))
|
|
1256
1256
|
])
|
|
1257
1257
|
]),
|
|
1258
|
-
"side-sheet-footer":
|
|
1258
|
+
"side-sheet-footer": U(() => [
|
|
1259
1259
|
e("div", Kn, [
|
|
1260
1260
|
y(O, {
|
|
1261
|
-
label: a(
|
|
1261
|
+
label: a(M)("common.confirm"),
|
|
1262
1262
|
loading: b.value,
|
|
1263
1263
|
onClick: S
|
|
1264
1264
|
}, null, 8, ["label", "loading"]),
|
|
1265
1265
|
y(O, {
|
|
1266
|
-
label: a(
|
|
1266
|
+
label: a(M)("common.close"),
|
|
1267
1267
|
variant: "tertiary",
|
|
1268
1268
|
onClick: A[3] || (A[3] = (q) => s("update:show", !1))
|
|
1269
1269
|
}, null, 8, ["label"])
|
|
@@ -1273,19 +1273,19 @@ const We = {
|
|
|
1273
1273
|
}, 8, ["modelValue"]);
|
|
1274
1274
|
};
|
|
1275
1275
|
}
|
|
1276
|
-
}), Xn = $t((
|
|
1276
|
+
}), Xn = $t((h, m) => ({
|
|
1277
1277
|
// TODO: remove once latest inventory backend has been push
|
|
1278
|
-
async findBillsByBusinessId(d, s,
|
|
1279
|
-
const w = `${
|
|
1278
|
+
async findBillsByBusinessId(d, s, M) {
|
|
1279
|
+
const w = `${h.businessesBackendUrl}/${d}/reports/find-many`, c = {
|
|
1280
1280
|
// type: TYPE.bill,
|
|
1281
1281
|
type: "bill",
|
|
1282
1282
|
restaurantIds: s,
|
|
1283
|
-
ids:
|
|
1283
|
+
ids: M
|
|
1284
1284
|
};
|
|
1285
1285
|
return await m.post(w, c);
|
|
1286
1286
|
},
|
|
1287
1287
|
async findBillsById(d) {
|
|
1288
|
-
const
|
|
1288
|
+
const M = xe().currentLocationDBName, w = `${h.inventoryBackendUrl}/${M}/bill/search`, c = {
|
|
1289
1289
|
ids: d
|
|
1290
1290
|
};
|
|
1291
1291
|
return await m.post(w, c);
|
|
@@ -1302,79 +1302,79 @@ const We = {
|
|
|
1302
1302
|
modelModifiers: {}
|
|
1303
1303
|
}),
|
|
1304
1304
|
emits: /* @__PURE__ */ Qe(["refreshHistory"], ["update:modelValue"]),
|
|
1305
|
-
setup(
|
|
1306
|
-
const d =
|
|
1305
|
+
setup(h, { emit: m }) {
|
|
1306
|
+
const d = h, s = m, M = we(), w = bt(h, "modelValue"), c = z(!1), l = z(!1), g = z(!1), B = z({
|
|
1307
1307
|
_id: `inventoryAdjustment_${(/* @__PURE__ */ new Date()).toISOString()}_XXXXX`,
|
|
1308
1308
|
skus: []
|
|
1309
1309
|
}), b = z();
|
|
1310
1310
|
qe(async () => {
|
|
1311
1311
|
c.value = !0;
|
|
1312
|
-
const o = await
|
|
1312
|
+
const o = await M.readSingleAdjustment(d.adjustmentId);
|
|
1313
1313
|
if (!o) throw new Error("Adjustment not found");
|
|
1314
1314
|
B.value = o, c.value = !1;
|
|
1315
1315
|
});
|
|
1316
|
-
async function
|
|
1316
|
+
async function r() {
|
|
1317
1317
|
var t, n;
|
|
1318
1318
|
if ((n = (t = b == null ? void 0 : b.value) == null ? void 0 : t.validateInputs) == null || n.call(t), !l.value) return;
|
|
1319
1319
|
const o = {};
|
|
1320
1320
|
Object.keys(w.value || {}).forEach((S) => {
|
|
1321
|
-
var
|
|
1322
|
-
Object.keys(((
|
|
1321
|
+
var D;
|
|
1322
|
+
Object.keys(((D = w.value) == null ? void 0 : D[S]) || {}).forEach((A) => {
|
|
1323
1323
|
var R, K;
|
|
1324
1324
|
const I = (K = (R = w.value) == null ? void 0 : R[S]) == null ? void 0 : K[Number(A)];
|
|
1325
1325
|
I && T(I.amount) > 0 && (o[S] || (o[S] = []), o[S].push(I));
|
|
1326
1326
|
});
|
|
1327
|
-
}), await
|
|
1327
|
+
}), await M.revertWastageAdjustment({
|
|
1328
1328
|
targetWastageAdjustmentId: d.adjustmentId,
|
|
1329
1329
|
amountsGoingToAdjust: o
|
|
1330
|
-
}), s("refreshHistory"),
|
|
1330
|
+
}), s("refreshHistory"), g.value = !1, w.value = {};
|
|
1331
1331
|
}
|
|
1332
|
-
function
|
|
1333
|
-
const { skuId: t, idx: n, unit: S, measurement:
|
|
1332
|
+
function v(o) {
|
|
1333
|
+
const { skuId: t, idx: n, unit: S, measurement: D } = o;
|
|
1334
1334
|
return Y({
|
|
1335
1335
|
get: () => {
|
|
1336
1336
|
var R, K, O;
|
|
1337
1337
|
const A = (O = (K = (R = w.value) == null ? void 0 : R[t]) == null ? void 0 : K[n]) == null ? void 0 : O.amount;
|
|
1338
|
-
return A ? Number(
|
|
1338
|
+
return A ? Number(ve.toFormatString({ value: A })) : 0;
|
|
1339
1339
|
},
|
|
1340
1340
|
set: (A) => {
|
|
1341
1341
|
w.value || (w.value = {});
|
|
1342
1342
|
const I = { ...w.value };
|
|
1343
1343
|
I[t] || (I[t] = {}), I[t][n] = {
|
|
1344
|
-
amount:
|
|
1345
|
-
value:
|
|
1344
|
+
amount: ve.convertPrecision({
|
|
1345
|
+
value: ve.fromNumber(A),
|
|
1346
1346
|
precision: Ce(S)
|
|
1347
1347
|
}),
|
|
1348
1348
|
type: ae.Enum.WASTAGE,
|
|
1349
|
-
measurement:
|
|
1349
|
+
measurement: D
|
|
1350
1350
|
}, w.value = I;
|
|
1351
1351
|
}
|
|
1352
1352
|
});
|
|
1353
1353
|
}
|
|
1354
1354
|
function T(o, t = !0) {
|
|
1355
|
-
const n = Number(
|
|
1355
|
+
const n = Number(ve.toFormatString({ value: o }));
|
|
1356
1356
|
return t ? Math.abs(n) : n;
|
|
1357
1357
|
}
|
|
1358
|
-
function
|
|
1358
|
+
function k(o, t) {
|
|
1359
1359
|
return t.measurement ? t.measurement.abbrev : o.sku.unit.abbrev;
|
|
1360
1360
|
}
|
|
1361
1361
|
function x(o, t) {
|
|
1362
1362
|
if (t.amount === 0) return "N/A";
|
|
1363
|
-
const n =
|
|
1364
|
-
return n ?
|
|
1363
|
+
const n = ve.add([o, t]);
|
|
1364
|
+
return n ? ve.toFormatString({ value: n }) : "N/A";
|
|
1365
1365
|
}
|
|
1366
1366
|
return (o, t) => {
|
|
1367
|
-
const n =
|
|
1368
|
-
return
|
|
1369
|
-
modelValue:
|
|
1370
|
-
"onUpdate:modelValue": t[4] || (t[4] = (O) =>
|
|
1367
|
+
const n = H("FmIcon"), S = H("FmStepperField"), D = H("FmCard"), A = H("FmForm"), I = H("FmSpacer"), R = H("FmButton"), K = H("FmDialog");
|
|
1368
|
+
return j(), X(K, {
|
|
1369
|
+
modelValue: g.value,
|
|
1370
|
+
"onUpdate:modelValue": t[4] || (t[4] = (O) => g.value = O),
|
|
1371
1371
|
overlay: !0
|
|
1372
1372
|
}, {
|
|
1373
|
-
"dialog-button":
|
|
1373
|
+
"dialog-button": U(() => [
|
|
1374
1374
|
y(Xe, null, {
|
|
1375
|
-
default:
|
|
1375
|
+
default: U(() => [
|
|
1376
1376
|
e("button", {
|
|
1377
|
-
onClick: t[0] || (t[0] = (O) =>
|
|
1377
|
+
onClick: t[0] || (t[0] = (O) => g.value = !0),
|
|
1378
1378
|
class: "rounded-md hover:bg-gray-100 transition-colors"
|
|
1379
1379
|
}, [
|
|
1380
1380
|
y(n, {
|
|
@@ -1386,10 +1386,10 @@ const We = {
|
|
|
1386
1386
|
_: 1
|
|
1387
1387
|
})
|
|
1388
1388
|
]),
|
|
1389
|
-
"dialog-header":
|
|
1389
|
+
"dialog-header": U(() => t[5] || (t[5] = [
|
|
1390
1390
|
e("div", null, "Amend Adjustment", -1)
|
|
1391
1391
|
])),
|
|
1392
|
-
"dialog-footer":
|
|
1392
|
+
"dialog-footer": U(() => [
|
|
1393
1393
|
e("div", ao, [
|
|
1394
1394
|
t[13] || (t[13] = e("span", { class: "text-fm-color-system-warning-400 fm-typo-en-body-sm-400" }, "1. New adjustment EXTRA will be created for each reversal", -1)),
|
|
1395
1395
|
e("div", lo, [
|
|
@@ -1399,20 +1399,20 @@ const We = {
|
|
|
1399
1399
|
label: "Close",
|
|
1400
1400
|
size: "md",
|
|
1401
1401
|
variant: "tertiary",
|
|
1402
|
-
onClick: t[3] || (t[3] = (O) =>
|
|
1402
|
+
onClick: t[3] || (t[3] = (O) => g.value = !1)
|
|
1403
1403
|
}),
|
|
1404
1404
|
y(R, {
|
|
1405
1405
|
class: "sm:w-full xs:w-full",
|
|
1406
1406
|
label: "Submit",
|
|
1407
1407
|
size: "md",
|
|
1408
1408
|
variant: "primary",
|
|
1409
|
-
onClick:
|
|
1409
|
+
onClick: r
|
|
1410
1410
|
})
|
|
1411
1411
|
])
|
|
1412
1412
|
])
|
|
1413
1413
|
]),
|
|
1414
|
-
default:
|
|
1415
|
-
c.value ? (
|
|
1414
|
+
default: U(() => [
|
|
1415
|
+
c.value ? (j(), W("div", Jn)) : (j(), X(A, {
|
|
1416
1416
|
key: 1,
|
|
1417
1417
|
ref_key: "formRef",
|
|
1418
1418
|
ref: b,
|
|
@@ -1424,20 +1424,20 @@ const We = {
|
|
|
1424
1424
|
}),
|
|
1425
1425
|
blameFormChildOnValidationFailed: ""
|
|
1426
1426
|
}, {
|
|
1427
|
-
default:
|
|
1427
|
+
default: U(() => [
|
|
1428
1428
|
e("p", Qn, [
|
|
1429
1429
|
t[6] || (t[6] = e("b", null, "Date:", -1)),
|
|
1430
1430
|
t[7] || (t[7] = e("br", null, null, -1)),
|
|
1431
|
-
|
|
1431
|
+
pe(" " + p(a(Yt)(a(Vt)(B.value._id))), 1)
|
|
1432
1432
|
]),
|
|
1433
1433
|
e("div", Zn, [
|
|
1434
|
-
(
|
|
1435
|
-
(
|
|
1434
|
+
(j(!0), W(le, null, ce(B.value.skus, (O, Z) => (j(), W(le, { key: Z }, [
|
|
1435
|
+
(j(!0), W(le, null, ce(O.amounts, (q, ue) => (j(), X(D, {
|
|
1436
1436
|
key: ue,
|
|
1437
1437
|
variant: "outlined",
|
|
1438
1438
|
class: "p-2"
|
|
1439
1439
|
}, {
|
|
1440
|
-
default:
|
|
1440
|
+
default: U(() => [
|
|
1441
1441
|
e("div", eo, [
|
|
1442
1442
|
e("span", to, p(O.sku.code), 1),
|
|
1443
1443
|
e("span", null, p(O.sku.name), 1)
|
|
@@ -1449,16 +1449,16 @@ const We = {
|
|
|
1449
1449
|
]),
|
|
1450
1450
|
e("div", oo, [
|
|
1451
1451
|
t[9] || (t[9] = e("span", { class: "fm-typo-en-body-lg-600" }, "Current amount:", -1)),
|
|
1452
|
-
e("span", null, p(a(
|
|
1452
|
+
e("span", null, p(a(ve).toFormatString({ value: q.amount })) + " " + p(k(O, q)), 1)
|
|
1453
1453
|
]),
|
|
1454
1454
|
y(S, {
|
|
1455
1455
|
"max-fraction-digits": a(Ce)(O.sku.unit),
|
|
1456
|
-
"model-value":
|
|
1456
|
+
"model-value": v({
|
|
1457
1457
|
skuId: O.sku._id,
|
|
1458
1458
|
idx: ue,
|
|
1459
1459
|
unit: O.sku.unit
|
|
1460
1460
|
}).value,
|
|
1461
|
-
"onUpdate:modelValue": (ee) =>
|
|
1461
|
+
"onUpdate:modelValue": (ee) => v({
|
|
1462
1462
|
skuId: O.sku._id,
|
|
1463
1463
|
idx: ue,
|
|
1464
1464
|
unit: O.sku.unit
|
|
@@ -1466,25 +1466,25 @@ const We = {
|
|
|
1466
1466
|
class: "mb-3",
|
|
1467
1467
|
label: "Adjust Amount (Leave 0 to skip)",
|
|
1468
1468
|
"helper-text": `Max: ${T(q.amount)}`,
|
|
1469
|
-
"append-text":
|
|
1469
|
+
"append-text": k(O, q),
|
|
1470
1470
|
rules: [
|
|
1471
1471
|
(ee) => ee <= T(q.amount) || `Cannot be more than ${T(q.amount)}`,
|
|
1472
|
-
a(
|
|
1472
|
+
a(Te)(-1)
|
|
1473
1473
|
]
|
|
1474
1474
|
}, null, 8, ["max-fraction-digits", "model-value", "onUpdate:modelValue", "helper-text", "append-text", "rules"]),
|
|
1475
1475
|
e("div", so, [
|
|
1476
1476
|
t[10] || (t[10] = e("span", { class: "fm-typo-en-body-lg-600" }, "Amount after amend:", -1)),
|
|
1477
1477
|
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)),
|
|
1478
|
-
|
|
1478
|
+
pe(" " + p(x(
|
|
1479
1479
|
q.amount,
|
|
1480
|
-
a(
|
|
1481
|
-
|
|
1480
|
+
a(ve).fromNumber(
|
|
1481
|
+
v({
|
|
1482
1482
|
skuId: O.sku._id,
|
|
1483
1483
|
idx: ue,
|
|
1484
1484
|
unit: O.sku.unit
|
|
1485
1485
|
}).value
|
|
1486
1486
|
)
|
|
1487
|
-
)) + " " + p(
|
|
1487
|
+
)) + " " + p(k(O, q)), 1)
|
|
1488
1488
|
])
|
|
1489
1489
|
]),
|
|
1490
1490
|
_: 2
|
|
@@ -1502,7 +1502,7 @@ const We = {
|
|
|
1502
1502
|
}), io = { class: "p-16" }, uo = { class: "fm-typo-en-body-md-600 flex-grow" }, co = { class: "flex-grow text-fm-color-typo-secondary" }, mo = {
|
|
1503
1503
|
key: 0,
|
|
1504
1504
|
class: "my-5"
|
|
1505
|
-
}, fo = { class: "text-neutral-400" },
|
|
1505
|
+
}, fo = { class: "text-neutral-400" }, po = { class: "flex-grow" }, vo = { class: "flex gap-1" }, yo = { class: "flex flex-col gap-1" }, _o = {
|
|
1506
1506
|
key: 1,
|
|
1507
1507
|
class: "t-system text-fsecondary"
|
|
1508
1508
|
}, ko = {
|
|
@@ -1520,68 +1520,68 @@ const We = {
|
|
|
1520
1520
|
unitCostHistory: { default: () => [] },
|
|
1521
1521
|
costMechanism: { default: "adjustment" }
|
|
1522
1522
|
},
|
|
1523
|
-
setup(
|
|
1524
|
-
const m =
|
|
1525
|
-
function d(b,
|
|
1523
|
+
setup(h) {
|
|
1524
|
+
const m = h;
|
|
1525
|
+
function d(b, r) {
|
|
1526
1526
|
if (m.costMechanism === "adjustment")
|
|
1527
1527
|
return null;
|
|
1528
|
-
const
|
|
1528
|
+
const v = m.unitCostHistory.filter(
|
|
1529
1529
|
(x) => x.mechanism === m.costMechanism && x.skuId === m.sku._id
|
|
1530
1530
|
);
|
|
1531
|
-
if (
|
|
1532
|
-
const T =
|
|
1531
|
+
if (v.length === 0) return null;
|
|
1532
|
+
const T = v.find((x) => {
|
|
1533
1533
|
const o = x.meta;
|
|
1534
1534
|
return (o == null ? void 0 : o.adjustmentId) === b;
|
|
1535
1535
|
});
|
|
1536
1536
|
if (T) return T.cost;
|
|
1537
|
-
const
|
|
1538
|
-
return
|
|
1537
|
+
const k = [...v].filter((x) => new Date(x.snapshotAt) <= new Date(r)).sort((x, o) => new Date(o.snapshotAt).getTime() - new Date(x.snapshotAt).getTime());
|
|
1538
|
+
return k.length > 0 ? k[0].cost : null;
|
|
1539
1539
|
}
|
|
1540
|
-
const s = z(!1),
|
|
1540
|
+
const s = z(!1), M = z(), w = z(null), c = Y(() => w.value === null ? "unset" : s.value ? `${w.value}px` : "0px");
|
|
1541
1541
|
qe(() => {
|
|
1542
1542
|
var b;
|
|
1543
|
-
w.value = ((b =
|
|
1543
|
+
w.value = ((b = M.value) == null ? void 0 : b.scrollHeight) || 0;
|
|
1544
1544
|
});
|
|
1545
1545
|
const l = Y(() => {
|
|
1546
1546
|
var x;
|
|
1547
|
-
const b = m.record.adjustments,
|
|
1547
|
+
const b = m.record.adjustments, r = m.sku, v = {}, k = b.flatMap((o) => {
|
|
1548
1548
|
var t;
|
|
1549
|
-
return ((t = o.skus) == null ? void 0 : t.filter((n) => n.sku._id ===
|
|
1549
|
+
return ((t = o.skus) == null ? void 0 : t.filter((n) => n.sku._id === r._id)) ?? [];
|
|
1550
1550
|
}).flatMap((o) => o.amounts);
|
|
1551
|
-
for (const o of
|
|
1551
|
+
for (const o of k) {
|
|
1552
1552
|
const t = o.measurement ? dt(o.measurement.conversion, o.amount) : o.amount;
|
|
1553
|
-
|
|
1553
|
+
v[x = o.type] ?? (v[x] = { amount: 0, precision: 0 }), v[o.type] = Je(t, v[o.type]);
|
|
1554
1554
|
}
|
|
1555
|
-
return Object.entries(
|
|
1555
|
+
return Object.entries(v).reduce(
|
|
1556
1556
|
(o, [t, n]) => (o[t] = /// comment, because without it formatter makes code uglier
|
|
1557
1557
|
`${Q.toFormatString({
|
|
1558
1558
|
value: n,
|
|
1559
1559
|
precision: 4
|
|
1560
|
-
})} ${
|
|
1560
|
+
})} ${r.unit.abbrev}`, o),
|
|
1561
1561
|
{}
|
|
1562
1562
|
);
|
|
1563
|
-
}), { t:
|
|
1563
|
+
}), { t: g } = fe(), B = Y(() => m.record.adjustmentsByTime.map(({ date: b, adjustments: r }) => ({
|
|
1564
1564
|
time: Lt(new Date(b)),
|
|
1565
|
-
adjustments:
|
|
1566
|
-
(
|
|
1567
|
-
var T,
|
|
1568
|
-
return ((
|
|
1565
|
+
adjustments: r.flatMap(
|
|
1566
|
+
(v) => {
|
|
1567
|
+
var T, k;
|
|
1568
|
+
return ((k = (T = v.skus) == null ? void 0 : T.map) == null ? void 0 : k.call(T, (x) => {
|
|
1569
1569
|
var o, t;
|
|
1570
1570
|
return {
|
|
1571
1571
|
...x,
|
|
1572
|
-
ref:
|
|
1573
|
-
backdateFrom:
|
|
1574
|
-
toBalance: (t = (o =
|
|
1575
|
-
adjustmentId:
|
|
1576
|
-
adjustmentTime:
|
|
1572
|
+
ref: v.ref,
|
|
1573
|
+
backdateFrom: v.effectiveAt != null ? He(v._id) : null,
|
|
1574
|
+
toBalance: (t = (o = v.skus) == null ? void 0 : o[0]) == null ? void 0 : t.toBalance,
|
|
1575
|
+
adjustmentId: v._id,
|
|
1576
|
+
adjustmentTime: v.effectiveAt ?? He(v._id)
|
|
1577
1577
|
};
|
|
1578
1578
|
})) ?? [];
|
|
1579
1579
|
}
|
|
1580
|
-
).flatMap((
|
|
1580
|
+
).flatMap((v) => {
|
|
1581
1581
|
var t;
|
|
1582
|
-
const T = (t = m.bills.find((n) => n._id ===
|
|
1583
|
-
return
|
|
1584
|
-
var
|
|
1582
|
+
const T = (t = m.bills.find((n) => n._id === v.ref)) == null ? void 0 : t.seqNumber, k = T ? g("inventory.stock.record.bill", [T]) : "", x = v.adjustmentTime ?? (/* @__PURE__ */ new Date()).toISOString(), o = d(v.adjustmentId, x);
|
|
1583
|
+
return v.amounts.map((n) => {
|
|
1584
|
+
var D;
|
|
1585
1585
|
let S = n.cost;
|
|
1586
1586
|
if (o) {
|
|
1587
1587
|
const A = Q.fromDinero(o), I = n.amount, R = n.measurement ? Q.multiply([I, n.measurement.conversion]) : I;
|
|
@@ -1591,44 +1591,44 @@ const We = {
|
|
|
1591
1591
|
};
|
|
1592
1592
|
}
|
|
1593
1593
|
return {
|
|
1594
|
-
amount: `${Q.toFormatString({ value: n.amount, precision: 4 })} ${((
|
|
1595
|
-
backdateFrom:
|
|
1594
|
+
amount: `${Q.toFormatString({ value: n.amount, precision: 4 })} ${((D = n.measurement) == null ? void 0 : D.abbrev) ?? v.sku.unit.abbrev}`,
|
|
1595
|
+
backdateFrom: v.backdateFrom,
|
|
1596
1596
|
name: n.type,
|
|
1597
|
-
billRemark:
|
|
1597
|
+
billRemark: k,
|
|
1598
1598
|
remark: n.remark || "",
|
|
1599
1599
|
cost: S,
|
|
1600
1600
|
toBalance: Q.toFormatString({
|
|
1601
|
-
value:
|
|
1601
|
+
value: v.toBalance ?? Q.fromNumber(0),
|
|
1602
1602
|
precision: 4
|
|
1603
1603
|
}),
|
|
1604
|
-
baseUnit:
|
|
1605
|
-
adjustmentId:
|
|
1604
|
+
baseUnit: v.sku.unit.abbrev,
|
|
1605
|
+
adjustmentId: v.adjustmentId
|
|
1606
1606
|
};
|
|
1607
1607
|
});
|
|
1608
1608
|
})
|
|
1609
1609
|
})));
|
|
1610
|
-
return (b,
|
|
1611
|
-
const
|
|
1612
|
-
return
|
|
1613
|
-
default:
|
|
1610
|
+
return (b, r) => {
|
|
1611
|
+
const v = H("FmIcon"), T = H("FmTooltip"), k = H("FmCard");
|
|
1612
|
+
return j(), X(k, { variant: "outlined" }, {
|
|
1613
|
+
default: U(() => [
|
|
1614
1614
|
e("div", io, [
|
|
1615
1615
|
e("div", {
|
|
1616
1616
|
class: "flex items-center cursor-pointer mb-1",
|
|
1617
|
-
onClick:
|
|
1617
|
+
onClick: r[0] || (r[0] = (x) => s.value = !s.value)
|
|
1618
1618
|
}, [
|
|
1619
1619
|
e("div", uo, p(b.record.date), 1),
|
|
1620
|
-
y(
|
|
1620
|
+
y(v, {
|
|
1621
1621
|
name: s.value ? "expand_more" : "expand_less",
|
|
1622
1622
|
color: "#777777",
|
|
1623
1623
|
size: "md"
|
|
1624
1624
|
}, null, 8, ["name"])
|
|
1625
1625
|
]),
|
|
1626
|
-
(
|
|
1626
|
+
(j(!0), W(le, null, ce(l.value, (x, o) => (j(), W("div", {
|
|
1627
1627
|
key: o,
|
|
1628
1628
|
class: "flex flex-row py-1",
|
|
1629
1629
|
style: { "font-size": "0.8rem" }
|
|
1630
1630
|
}, [
|
|
1631
|
-
e("div", co, p(a(
|
|
1631
|
+
e("div", co, p(a(g)(`inventory.inventoryAdjustment.type.${o}`)), 1),
|
|
1632
1632
|
e("div", {
|
|
1633
1633
|
class: ge({
|
|
1634
1634
|
"text-fm-color-typo-error": x.startsWith("-"),
|
|
@@ -1639,7 +1639,7 @@ const We = {
|
|
|
1639
1639
|
]))), 128)),
|
|
1640
1640
|
e("div", {
|
|
1641
1641
|
ref_key: "detailRef",
|
|
1642
|
-
ref:
|
|
1642
|
+
ref: M,
|
|
1643
1643
|
style: ct({
|
|
1644
1644
|
fontSize: "0.8rem",
|
|
1645
1645
|
maxHeight: c.value,
|
|
@@ -1647,32 +1647,32 @@ const We = {
|
|
|
1647
1647
|
transition: "max-height 0.2s ease-out"
|
|
1648
1648
|
})
|
|
1649
1649
|
}, [
|
|
1650
|
-
B.value.length ? (
|
|
1651
|
-
(
|
|
1650
|
+
B.value.length ? (j(), W("hr", mo)) : se("", !0),
|
|
1651
|
+
(j(!0), W(le, null, ce(B.value, (x) => (j(), W("div", {
|
|
1652
1652
|
key: x.time,
|
|
1653
1653
|
class: "flex gap-1 w-full"
|
|
1654
1654
|
}, [
|
|
1655
1655
|
e("div", fo, p(x.time), 1),
|
|
1656
|
-
e("div",
|
|
1657
|
-
(
|
|
1656
|
+
e("div", po, [
|
|
1657
|
+
(j(!0), W(le, null, ce(x.adjustments, (o) => (j(), W("div", {
|
|
1658
1658
|
key: o.name,
|
|
1659
1659
|
class: "flex gap-1"
|
|
1660
1660
|
}, [
|
|
1661
|
-
e("div",
|
|
1662
|
-
|
|
1663
|
-
o.backdateFrom ? (
|
|
1661
|
+
e("div", vo, [
|
|
1662
|
+
pe(p(a(g)(`inventory.inventoryAdjustment.type.${o.name}`)) + " ", 1),
|
|
1663
|
+
o.backdateFrom ? (j(), X(T, {
|
|
1664
1664
|
key: 0,
|
|
1665
1665
|
variant: "plain",
|
|
1666
1666
|
placement: "top",
|
|
1667
1667
|
"z-index": 50
|
|
1668
1668
|
}, {
|
|
1669
|
-
content:
|
|
1670
|
-
e("div", yo, p(a(
|
|
1669
|
+
content: U(() => [
|
|
1670
|
+
e("div", yo, p(a(g)("inventory.stock.record.backdate", [
|
|
1671
1671
|
a(yt)(new Date(o.backdateFrom))
|
|
1672
1672
|
])), 1)
|
|
1673
1673
|
]),
|
|
1674
|
-
default:
|
|
1675
|
-
y(
|
|
1674
|
+
default: U(() => [
|
|
1675
|
+
y(v, {
|
|
1676
1676
|
name: "info",
|
|
1677
1677
|
size: "sm",
|
|
1678
1678
|
color: "primary"
|
|
@@ -1680,12 +1680,12 @@ const We = {
|
|
|
1680
1680
|
]),
|
|
1681
1681
|
_: 2
|
|
1682
1682
|
}, 1024)) : se("", !0),
|
|
1683
|
-
o.billRemark ? (
|
|
1684
|
-
o.remark ? (
|
|
1683
|
+
o.billRemark ? (j(), W("span", _o, " # " + p(o.billRemark), 1)) : se("", !0),
|
|
1684
|
+
o.remark ? (j(), W("span", {
|
|
1685
1685
|
key: 2,
|
|
1686
1686
|
class: ge(o.billRemark ? "text-xs text-gray-400" : "")
|
|
1687
1687
|
}, p(o.billRemark ? `(${o.remark})` : `# ${o.remark}`), 3)) : se("", !0),
|
|
1688
|
-
o.name === a(ae).Enum.CLOSING ? (
|
|
1688
|
+
o.name === a(ae).Enum.CLOSING ? (j(), W("span", ko, " Actual Balance: " + p(o.toBalance) + " " + p(o.baseUnit), 1)) : se("", !0)
|
|
1689
1689
|
]),
|
|
1690
1690
|
e("div", {
|
|
1691
1691
|
class: ge({
|
|
@@ -1694,12 +1694,12 @@ const We = {
|
|
|
1694
1694
|
"ml-auto": !0
|
|
1695
1695
|
})
|
|
1696
1696
|
}, p(o.amount), 3),
|
|
1697
|
-
o.name === a(ae).Enum.WASTAGE ? (
|
|
1697
|
+
o.name === a(ae).Enum.WASTAGE ? (j(), X(ro, {
|
|
1698
1698
|
key: 0,
|
|
1699
1699
|
adjustmentId: o.adjustmentId,
|
|
1700
|
-
onRefreshHistory:
|
|
1700
|
+
onRefreshHistory: r[1] || (r[1] = (t) => b.$emit("refreshHistory"))
|
|
1701
1701
|
}, null, 8, ["adjustmentId"])) : se("", !0),
|
|
1702
|
-
o.cost ? (
|
|
1702
|
+
o.cost ? (j(), W("div", ho, " (" + p(a(Me)(o.cost, !1, o.cost.precision)) + ") ", 1)) : se("", !0)
|
|
1703
1703
|
]))), 128))
|
|
1704
1704
|
])
|
|
1705
1705
|
]))), 128))
|
|
@@ -1711,7 +1711,7 @@ const We = {
|
|
|
1711
1711
|
};
|
|
1712
1712
|
}
|
|
1713
1713
|
});
|
|
1714
|
-
function bo(
|
|
1714
|
+
function bo(h, m) {
|
|
1715
1715
|
var w;
|
|
1716
1716
|
const d = Object.keys(ae.enum).reduce(
|
|
1717
1717
|
(c, l) => (c[l] = { amount: 0, precision: 0 }, c),
|
|
@@ -1722,19 +1722,19 @@ function bo(k, m) {
|
|
|
1722
1722
|
(c, [l]) => (c[l] = Q.fromNumber(0), c),
|
|
1723
1723
|
{}
|
|
1724
1724
|
);
|
|
1725
|
-
const
|
|
1725
|
+
const M = h.flatMap((c) => {
|
|
1726
1726
|
var l;
|
|
1727
|
-
return ((l = c.skus) == null ? void 0 : l.filter((
|
|
1727
|
+
return ((l = c.skus) == null ? void 0 : l.filter((g) => g.sku._id === m._id)) ?? [];
|
|
1728
1728
|
}).flatMap((c) => c.amounts);
|
|
1729
|
-
for (const c of
|
|
1729
|
+
for (const c of M) {
|
|
1730
1730
|
const l = c.measurement ? Q.multiply([c.measurement.conversion, c.amount]) : c.amount;
|
|
1731
1731
|
d[w = c.type] ?? (d[w] = { amount: 0, precision: 0 }), d[c.type] = Q.add([l, d[c.type]]);
|
|
1732
1732
|
}
|
|
1733
1733
|
return Object.entries(d).reduce(
|
|
1734
|
-
(c, [l,
|
|
1734
|
+
(c, [l, g]) => {
|
|
1735
1735
|
const B = {
|
|
1736
|
-
...
|
|
1737
|
-
amount: Math.abs(
|
|
1736
|
+
...g,
|
|
1737
|
+
amount: Math.abs(g.amount)
|
|
1738
1738
|
};
|
|
1739
1739
|
return c[l] = /// comment, because without it formatter makes code uglier
|
|
1740
1740
|
`${Q.toFormatString({
|
|
@@ -1745,24 +1745,24 @@ function bo(k, m) {
|
|
|
1745
1745
|
{}
|
|
1746
1746
|
);
|
|
1747
1747
|
}
|
|
1748
|
-
function xo(
|
|
1748
|
+
function xo(h, m) {
|
|
1749
1749
|
if (!m)
|
|
1750
1750
|
return null;
|
|
1751
1751
|
let d = null;
|
|
1752
|
-
const
|
|
1752
|
+
const M = h.flatMap((w) => {
|
|
1753
1753
|
var c;
|
|
1754
1754
|
return ((c = w.skus) == null ? void 0 : c.filter((l) => l.sku._id === m._id)) ?? [];
|
|
1755
1755
|
}).flatMap((w) => {
|
|
1756
1756
|
var c;
|
|
1757
1757
|
return !w.history || ((c = w.history) == null ? void 0 : c.length) === 0 ? [] : w.history[0];
|
|
1758
1758
|
});
|
|
1759
|
-
for (const w of
|
|
1759
|
+
for (const w of M) {
|
|
1760
1760
|
const c = w.amounts;
|
|
1761
1761
|
for (const l of c) {
|
|
1762
1762
|
if (l.type !== ae.Enum.SALES)
|
|
1763
1763
|
continue;
|
|
1764
|
-
const
|
|
1765
|
-
d ?? (d = Q.fromNumber(0)), d = Q.add([d,
|
|
1764
|
+
const g = l.measurement ? Q.multiply([l.measurement.conversion, l.amount]) : l.amount;
|
|
1765
|
+
d ?? (d = Q.fromNumber(0)), d = Q.add([d, g]);
|
|
1766
1766
|
}
|
|
1767
1767
|
}
|
|
1768
1768
|
return d != null ? (d.amount = Math.abs(d.amount), `${Q.toFormatString({
|
|
@@ -1779,10 +1779,10 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
|
|
|
1779
1779
|
}, jo = { class: "pb-16" }, Mo = { class: "fm-typo-cn-body-lg-600" }, Bo = {
|
|
1780
1780
|
class: "grid gap-12 fm-typo-en-body-md-400",
|
|
1781
1781
|
style: { "grid-template-columns": "auto auto auto", "grid-auto-rows": "1fr" }
|
|
1782
|
-
}, Io = { class: "flex flex-col gap-1" }, To = { class: "text-fm-color-typo-secondary" },
|
|
1782
|
+
}, Io = { class: "flex flex-col gap-1" }, To = { class: "text-fm-color-typo-secondary" }, Ho = { class: "font-bold" }, Uo = { class: "flex flex-col gap-1" }, Eo = { class: "text-fm-color-typo-secondary flex" }, Po = { class: "font-bold" }, Ro = { class: "flex flex-col gap-1" }, Oo = { class: "text-fm-color-typo-secondary" }, No = { class: "font-bold" }, Yo = { class: "flex flex-col gap-1" }, Lo = { class: "text-fm-color-typo-secondary" }, zo = { class: "font-bold" }, Go = { class: "flex flex-col gap-1" }, Wo = { class: "text-fm-color-typo-secondary" }, Ko = { class: "font-bold" }, qo = { class: "flex flex-col gap-1" }, Xo = { class: "text-fm-color-typo-secondary" }, Jo = { class: "font-bold" }, Qo = { class: "flex flex-col gap-1" }, Zo = { class: "text-fm-color-typo-secondary" }, es = { class: "font-bold" }, ts = { class: "flex flex-col gap-1" }, ns = { class: "text-fm-color-typo-secondary" }, os = { class: "font-bold" }, ss = { class: "flex flex-col gap-1" }, as = { class: "text-fm-color-typo-secondary" }, ls = { class: "font-bold" }, rs = {
|
|
1783
1783
|
key: 0,
|
|
1784
1784
|
class: "flex flex-col gap-8"
|
|
1785
|
-
}, is = { class: "flex" }, us = { class: "flex-1 flex flex-col gap-1" }, cs = { class: "flex gap-1 items-center text-fm-color-typo-secondary" }, ds = { class: "font-bold" }, ms = { class: "flex-1 flex flex-col gap-1" }, fs = { class: "flex gap-1 items-center text-fm-color-typo-secondary" },
|
|
1785
|
+
}, is = { class: "flex" }, us = { class: "flex-1 flex flex-col gap-1" }, cs = { class: "flex gap-1 items-center text-fm-color-typo-secondary" }, ds = { class: "font-bold" }, ms = { class: "flex-1 flex flex-col gap-1" }, fs = { class: "flex gap-1 items-center text-fm-color-typo-secondary" }, ps = { class: "flex flex-col gap-1" }, vs = { class: "font-bold" }, ys = {
|
|
1786
1786
|
key: 2,
|
|
1787
1787
|
class: "flex-1 flex flex-col items-center gap-8"
|
|
1788
1788
|
}, _s = ["src"], ks = { class: "font-bold text-lg" }, hs = { class: "text-xs text-neutral-400 text-center" }, gs = /* @__PURE__ */ me({
|
|
@@ -1792,10 +1792,10 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
|
|
|
1792
1792
|
show: { type: Boolean }
|
|
1793
1793
|
},
|
|
1794
1794
|
emits: ["update:show"],
|
|
1795
|
-
setup(
|
|
1796
|
-
const m =
|
|
1795
|
+
setup(h) {
|
|
1796
|
+
const m = pt(), d = Oe(), s = we(), M = Xn(), w = xe(), c = Jt(), { t: l } = fe(), g = h, B = z(!1), b = Se(), r = z("adjustment"), v = z([
|
|
1797
1797
|
{ label: "Adjustment (Default)", value: "adjustment" }
|
|
1798
|
-
]), T = z([]),
|
|
1798
|
+
]), T = z([]), k = z(Kt(0));
|
|
1799
1799
|
async function x() {
|
|
1800
1800
|
B.value = !0;
|
|
1801
1801
|
try {
|
|
@@ -1805,252 +1805,252 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
|
|
|
1805
1805
|
title: "Something went wrong",
|
|
1806
1806
|
message: "Cannot fetch stock history. Please try again.",
|
|
1807
1807
|
type: "error"
|
|
1808
|
-
}), console.log("failed at fetching item adjustment history",
|
|
1808
|
+
}), console.log("failed at fetching item adjustment history", g.sku, k, _);
|
|
1809
1809
|
} finally {
|
|
1810
1810
|
B.value = !1;
|
|
1811
1811
|
}
|
|
1812
1812
|
}
|
|
1813
1813
|
qe(() => {
|
|
1814
1814
|
x();
|
|
1815
|
-
}), $e([() =>
|
|
1815
|
+
}), $e([() => k.value, () => g.sku], () => {
|
|
1816
1816
|
x();
|
|
1817
1817
|
});
|
|
1818
1818
|
const o = z([]), t = z([]), n = z(new Array());
|
|
1819
|
-
function S(_,
|
|
1820
|
-
return
|
|
1819
|
+
function S(_, i) {
|
|
1820
|
+
return i === "day" ? Wt(_) : yt(_);
|
|
1821
1821
|
}
|
|
1822
|
-
function
|
|
1823
|
-
const
|
|
1824
|
-
(
|
|
1825
|
-
const F = u.effectiveAt ??
|
|
1822
|
+
function D(_, i) {
|
|
1823
|
+
const V = _.reduce(
|
|
1824
|
+
(C, u) => {
|
|
1825
|
+
const F = u.effectiveAt ?? He(u._id);
|
|
1826
1826
|
if (!F)
|
|
1827
|
-
return
|
|
1828
|
-
const N = S(new Date(F),
|
|
1829
|
-
return
|
|
1827
|
+
return C;
|
|
1828
|
+
const N = S(new Date(F), i);
|
|
1829
|
+
return C[N] ?? (C[N] = []), C[N].push(u), C;
|
|
1830
1830
|
},
|
|
1831
1831
|
{}
|
|
1832
1832
|
);
|
|
1833
|
-
return Object.keys(
|
|
1834
|
-
date:
|
|
1835
|
-
adjustments:
|
|
1833
|
+
return Object.keys(V).map((C) => ({
|
|
1834
|
+
date: C,
|
|
1835
|
+
adjustments: V[C]
|
|
1836
1836
|
}));
|
|
1837
1837
|
}
|
|
1838
1838
|
async function A() {
|
|
1839
1839
|
let _ = await s.readStockAdjustment(
|
|
1840
|
-
|
|
1841
|
-
st(new Date(
|
|
1842
|
-
at(new Date(
|
|
1840
|
+
g.sku._id,
|
|
1841
|
+
st(new Date(k.value.startDate)).toISOString(),
|
|
1842
|
+
at(new Date(k.value.endDate)).toISOString()
|
|
1843
1843
|
);
|
|
1844
1844
|
o.value = _;
|
|
1845
|
-
const
|
|
1846
|
-
await I(
|
|
1847
|
-
date:
|
|
1848
|
-
adjustments:
|
|
1849
|
-
adjustmentsByTime: C
|
|
1845
|
+
const i = _.filter(({ ref: V }) => V == null ? void 0 : V.startsWith("bill_")).map(({ ref: V }) => V);
|
|
1846
|
+
await I(i), t.value = D(_, "day").map(({ date: V, adjustments: C }) => ({
|
|
1847
|
+
date: V,
|
|
1848
|
+
adjustments: C,
|
|
1849
|
+
adjustmentsByTime: D(C, "minute")
|
|
1850
1850
|
}));
|
|
1851
1851
|
try {
|
|
1852
|
-
const
|
|
1853
|
-
|
|
1854
|
-
st(new Date(
|
|
1855
|
-
at(new Date(
|
|
1852
|
+
const V = await s.readUnitCostHistory(
|
|
1853
|
+
g.sku._id,
|
|
1854
|
+
st(new Date(k.value.startDate)).toISOString(),
|
|
1855
|
+
at(new Date(k.value.endDate)).toISOString()
|
|
1856
1856
|
);
|
|
1857
|
-
T.value =
|
|
1858
|
-
const
|
|
1859
|
-
|
|
1860
|
-
|
|
1857
|
+
T.value = V;
|
|
1858
|
+
const C = /* @__PURE__ */ new Set();
|
|
1859
|
+
V.forEach((F) => {
|
|
1860
|
+
C.add(F.mechanism);
|
|
1861
1861
|
});
|
|
1862
1862
|
const u = [{ label: "Default", value: "adjustment" }];
|
|
1863
|
-
|
|
1863
|
+
C.has(he.Enum.weightedAverage) && u.push({
|
|
1864
1864
|
label: "Weighted Average (Beta)",
|
|
1865
1865
|
value: he.Enum.weightedAverage
|
|
1866
|
-
}),
|
|
1866
|
+
}), C.has(he.Enum.netsuite) && u.push({ label: "NetSuite (Beta)", value: he.Enum.netsuite }), C.has(he.Enum["netsuite-average"]) && u.push({
|
|
1867
1867
|
label: "NetSuite Average (Beta)",
|
|
1868
1868
|
value: he.Enum["netsuite-average"]
|
|
1869
|
-
}),
|
|
1870
|
-
} catch (
|
|
1871
|
-
console.error("Failed to fetch unit cost history:",
|
|
1869
|
+
}), v.value = u, !C.has(r.value) && r.value !== "adjustment" && (r.value = "adjustment");
|
|
1870
|
+
} catch (V) {
|
|
1871
|
+
console.error("Failed to fetch unit cost history:", V);
|
|
1872
1872
|
}
|
|
1873
1873
|
}
|
|
1874
1874
|
async function I(_) {
|
|
1875
|
-
_.length && (n.value = await
|
|
1875
|
+
_.length && (n.value = await M.findBillsById(_).catch((i) => {
|
|
1876
1876
|
var u;
|
|
1877
|
-
console.error("Error on using latest bill API, retrying using legacy api",
|
|
1878
|
-
const
|
|
1879
|
-
return
|
|
1877
|
+
console.error("Error on using latest bill API, retrying using legacy api", i);
|
|
1878
|
+
const V = ((u = m.currentBusiness.value) == null ? void 0 : u._id) ?? "", C = w.currentLocation.doc._id;
|
|
1879
|
+
return M.findBillsByBusinessId(V, [C], _);
|
|
1880
1880
|
}));
|
|
1881
1881
|
}
|
|
1882
1882
|
const R = Y(() => {
|
|
1883
|
-
const _ = o.value,
|
|
1884
|
-
return bo(_,
|
|
1883
|
+
const _ = o.value, i = g.sku;
|
|
1884
|
+
return bo(_, i);
|
|
1885
1885
|
}), K = Y(() => {
|
|
1886
|
-
const _ = o.value,
|
|
1887
|
-
return xo(_,
|
|
1886
|
+
const _ = o.value, i = g.sku;
|
|
1887
|
+
return xo(_, i);
|
|
1888
1888
|
}), O = Y(() => {
|
|
1889
|
-
const _ = [...o.value].computeFirst((
|
|
1889
|
+
const _ = [...o.value].computeFirst((V) => {
|
|
1890
1890
|
var u, F;
|
|
1891
|
-
const
|
|
1892
|
-
return
|
|
1891
|
+
const C = (F = (u = V.skus) == null ? void 0 : u.find) == null ? void 0 : F.call(u, (N) => N.sku._id === g.sku._id);
|
|
1892
|
+
return C == null ? void 0 : C.fromBalance;
|
|
1893
1893
|
}) ?? {
|
|
1894
1894
|
amount: 0,
|
|
1895
1895
|
precision: 0
|
|
1896
|
-
},
|
|
1897
|
-
return
|
|
1896
|
+
}, i = g.sku;
|
|
1897
|
+
return i ? `${Q.toFormatString({
|
|
1898
1898
|
value: _,
|
|
1899
1899
|
precision: 4
|
|
1900
|
-
})} ${
|
|
1900
|
+
})} ${i.unit.abbrev}` : "";
|
|
1901
1901
|
}), Z = Y(() => {
|
|
1902
|
-
const _ = [...o.value].reverse().computeFirst((
|
|
1902
|
+
const _ = [...o.value].reverse().computeFirst((V) => {
|
|
1903
1903
|
var u, F;
|
|
1904
|
-
const
|
|
1905
|
-
return
|
|
1904
|
+
const C = (F = (u = V.skus) == null ? void 0 : u.find) == null ? void 0 : F.call(u, (N) => N.sku._id === g.sku._id);
|
|
1905
|
+
return C == null ? void 0 : C.toBalance;
|
|
1906
1906
|
}) ?? {
|
|
1907
1907
|
amount: 0,
|
|
1908
1908
|
precision: 0
|
|
1909
|
-
},
|
|
1910
|
-
return
|
|
1909
|
+
}, i = g.sku;
|
|
1910
|
+
return i ? `${Q.toFormatString({ value: _, precision: 4 })} ${i.unit.abbrev}` : "";
|
|
1911
1911
|
}), q = Y(() => {
|
|
1912
|
-
var
|
|
1913
|
-
const
|
|
1912
|
+
var V;
|
|
1913
|
+
const i = o.value.flatMap((C) => {
|
|
1914
1914
|
var u;
|
|
1915
|
-
return ((u =
|
|
1916
|
-
}).filter((
|
|
1917
|
-
(
|
|
1915
|
+
return ((u = C.skus) == null ? void 0 : u.flatMap((F) => F.amounts)) ?? [];
|
|
1916
|
+
}).filter((C) => C.amount.amount < 0).reduce(
|
|
1917
|
+
(C, u) => {
|
|
1918
1918
|
const F = u.cost;
|
|
1919
|
-
if (!F) return
|
|
1919
|
+
if (!F) return C;
|
|
1920
1920
|
const N = {
|
|
1921
|
-
...
|
|
1921
|
+
...Tt(C, Math.max(C.precision, F.precision)),
|
|
1922
1922
|
currency: F.currency
|
|
1923
1923
|
};
|
|
1924
1924
|
return {
|
|
1925
1925
|
...Je(N, F),
|
|
1926
|
-
currency:
|
|
1926
|
+
currency: C.currency
|
|
1927
1927
|
};
|
|
1928
1928
|
},
|
|
1929
1929
|
{
|
|
1930
1930
|
amount: 0,
|
|
1931
1931
|
precision: 0,
|
|
1932
|
-
currency: De((
|
|
1932
|
+
currency: De((V = m.currentCountry) == null ? void 0 : V.value)
|
|
1933
1933
|
}
|
|
1934
1934
|
);
|
|
1935
|
-
return Me(
|
|
1935
|
+
return Me(i, !1, i.precision);
|
|
1936
1936
|
});
|
|
1937
1937
|
function ue() {
|
|
1938
|
-
const { startDate: _, endDate:
|
|
1939
|
-
_ !== null &&
|
|
1938
|
+
const { startDate: _, endDate: i } = zt(k.value);
|
|
1939
|
+
_ !== null && i !== null && (k.value = {
|
|
1940
1940
|
startDate: _,
|
|
1941
|
-
endDate:
|
|
1941
|
+
endDate: i
|
|
1942
1942
|
});
|
|
1943
1943
|
}
|
|
1944
1944
|
const ee = Y(() => l("inventory.ingredient.valuationMethod.WAVG"));
|
|
1945
|
-
function
|
|
1946
|
-
if (
|
|
1945
|
+
function f(_, i) {
|
|
1946
|
+
if (r.value === "adjustment")
|
|
1947
1947
|
return null;
|
|
1948
|
-
const
|
|
1949
|
-
(F) => F.mechanism ===
|
|
1948
|
+
const V = T.value.filter(
|
|
1949
|
+
(F) => F.mechanism === r.value && F.skuId === g.sku._id
|
|
1950
1950
|
);
|
|
1951
|
-
if (
|
|
1952
|
-
const
|
|
1951
|
+
if (V.length === 0) return null;
|
|
1952
|
+
const C = V.find((F) => {
|
|
1953
1953
|
const N = F.meta;
|
|
1954
1954
|
return (N == null ? void 0 : N.adjustmentId) === _;
|
|
1955
1955
|
});
|
|
1956
|
-
if (
|
|
1957
|
-
const u = [...
|
|
1956
|
+
if (C) return C.cost;
|
|
1957
|
+
const u = [...V].filter((F) => new Date(F.snapshotAt) <= new Date(i)).sort((F, N) => new Date(N.snapshotAt).getTime() - new Date(F.snapshotAt).getTime());
|
|
1958
1958
|
return u.length > 0 ? u[0].cost : null;
|
|
1959
1959
|
}
|
|
1960
1960
|
const $ = Y(() => {
|
|
1961
|
-
var
|
|
1961
|
+
var C, u, F, N, ne, re;
|
|
1962
1962
|
const _ = [...o.value].reverse().find((J) => {
|
|
1963
1963
|
var te, oe;
|
|
1964
|
-
return (oe = (te = J.skus) == null ? void 0 : te.find) == null ? void 0 : oe.call(te, (ie) => ie.sku._id ===
|
|
1964
|
+
return (oe = (te = J.skus) == null ? void 0 : te.find) == null ? void 0 : oe.call(te, (ie) => ie.sku._id === g.sku._id);
|
|
1965
1965
|
});
|
|
1966
1966
|
if (!_) return "No data";
|
|
1967
|
-
const
|
|
1968
|
-
if (!
|
|
1969
|
-
const
|
|
1970
|
-
if (
|
|
1971
|
-
const J = [...
|
|
1967
|
+
const i = (C = _.skus) == null ? void 0 : C.find((J) => J.sku._id === g.sku._id);
|
|
1968
|
+
if (!i) return "No data";
|
|
1969
|
+
const V = i.toBalance;
|
|
1970
|
+
if (r.value === "adjustment") {
|
|
1971
|
+
const J = [...i.amounts].reverse()[0], te = {
|
|
1972
1972
|
amount: ((u = J.cost) == null ? void 0 : u.amount) ?? 0,
|
|
1973
1973
|
precision: ((F = J.cost) == null ? void 0 : F.precision) ?? 0
|
|
1974
1974
|
}, oe = J.amount, ie = oe.amount == 0 ? Q.fromNumber(0) : Q.divide([te, oe]);
|
|
1975
1975
|
return {
|
|
1976
|
-
...Q.multiply([ie,
|
|
1976
|
+
...Q.multiply([ie, V]),
|
|
1977
1977
|
currency: ((N = J.cost) == null ? void 0 : N.currency) || De(((ne = m.currentCountry) == null ? void 0 : ne.value) ?? et)
|
|
1978
1978
|
};
|
|
1979
1979
|
} else {
|
|
1980
|
-
const J = _.effectiveAt ??
|
|
1980
|
+
const J = _.effectiveAt ?? He(_._id), te = f(
|
|
1981
1981
|
_._id,
|
|
1982
1982
|
J ?? (/* @__PURE__ */ new Date()).toISOString()
|
|
1983
1983
|
);
|
|
1984
1984
|
if (!te) return "No data";
|
|
1985
1985
|
const oe = Q.fromDinero(te);
|
|
1986
1986
|
return {
|
|
1987
|
-
...Q.multiply([oe,
|
|
1987
|
+
...Q.multiply([oe, V]),
|
|
1988
1988
|
currency: te.currency || De(((re = m.currentCountry) == null ? void 0 : re.value) ?? et)
|
|
1989
1989
|
};
|
|
1990
1990
|
}
|
|
1991
1991
|
}), G = Y(() => {
|
|
1992
|
-
var
|
|
1993
|
-
const _ = [...o.value].reverse().computeFirst((
|
|
1992
|
+
var V;
|
|
1993
|
+
const _ = [...o.value].reverse().computeFirst((C) => {
|
|
1994
1994
|
var F, N;
|
|
1995
|
-
const u = (N = (F =
|
|
1995
|
+
const u = (N = (F = C.skus) == null ? void 0 : F.find) == null ? void 0 : N.call(F, (ne) => ne.sku._id === g.sku._id);
|
|
1996
1996
|
return u == null ? void 0 : u.toCostBalances;
|
|
1997
1997
|
});
|
|
1998
1998
|
return _ ? {
|
|
1999
|
-
..._.reduce((
|
|
1999
|
+
..._.reduce((C, u) => Q.add([C, Q.fromDinero(u.cost)]), {
|
|
2000
2000
|
amount: 0,
|
|
2001
2001
|
precision: 0
|
|
2002
2002
|
}),
|
|
2003
|
-
currency: De((
|
|
2003
|
+
currency: De((V = m.currentCountry) == null ? void 0 : V.value)
|
|
2004
2004
|
} : "No data";
|
|
2005
|
-
}), P = Y(() =>
|
|
2005
|
+
}), P = Y(() => g.sku.valuation === tt.Enum.FIFO ? G.value : $.value);
|
|
2006
2006
|
function L() {
|
|
2007
|
-
const { startDate: _, endDate:
|
|
2008
|
-
_ !== null &&
|
|
2007
|
+
const { startDate: _, endDate: i } = Gt(k.value);
|
|
2008
|
+
_ !== null && i !== null && (k.value = {
|
|
2009
2009
|
startDate: _,
|
|
2010
|
-
endDate:
|
|
2010
|
+
endDate: i
|
|
2011
2011
|
});
|
|
2012
2012
|
}
|
|
2013
|
-
const E = Ye(
|
|
2014
|
-
return (_,
|
|
2015
|
-
const
|
|
2016
|
-
return
|
|
2013
|
+
const E = Ye(g, "show");
|
|
2014
|
+
return (_, i) => {
|
|
2015
|
+
const V = H("FmButton"), C = H("FmField"), u = H("FmDateRangePicker"), F = H("FmSpacer"), N = H("FmCircularProgress"), ne = H("FmIcon"), re = H("FmTooltip"), J = H("FmMenuDivider"), te = H("FmChip"), oe = H("FmSelect"), ie = H("FmCardSection"), Fe = H("FmCard"), gt = H("FmSideSheet");
|
|
2016
|
+
return j(), X(gt, {
|
|
2017
2017
|
"dismiss-away": "",
|
|
2018
2018
|
modelValue: a(E),
|
|
2019
|
-
"onUpdate:modelValue":
|
|
2019
|
+
"onUpdate:modelValue": i[5] || (i[5] = (Ae) => Ee(E) ? E.value = Ae : null),
|
|
2020
2020
|
"close-button": !1,
|
|
2021
2021
|
"max-width": 560
|
|
2022
2022
|
}, {
|
|
2023
|
-
"side-sheet-header":
|
|
2023
|
+
"side-sheet-header": U(() => [
|
|
2024
2024
|
e("div", So, [
|
|
2025
2025
|
e("div", wo, p(a(l)("inventory.stock.history.title", [_.sku.name])), 1),
|
|
2026
|
-
y(
|
|
2026
|
+
y(V, {
|
|
2027
2027
|
variant: "tertiary",
|
|
2028
2028
|
"prepend-icon": "close",
|
|
2029
|
-
onClick:
|
|
2029
|
+
onClick: i[0] || (i[0] = (Ae) => E.value = !1)
|
|
2030
2030
|
})
|
|
2031
2031
|
])
|
|
2032
2032
|
]),
|
|
2033
|
-
default:
|
|
2033
|
+
default: U(() => {
|
|
2034
2034
|
var Ae;
|
|
2035
2035
|
return [
|
|
2036
2036
|
e("div", Fo, [
|
|
2037
2037
|
e("div", Ao, [
|
|
2038
2038
|
e("div", $o, [
|
|
2039
2039
|
y(u, {
|
|
2040
|
-
modelValue:
|
|
2041
|
-
"onUpdate:modelValue":
|
|
2040
|
+
modelValue: k.value,
|
|
2041
|
+
"onUpdate:modelValue": i[1] || (i[1] = (de) => k.value = de),
|
|
2042
2042
|
"show-predefined-range": "",
|
|
2043
2043
|
"start-label": "",
|
|
2044
2044
|
"end-label": "",
|
|
2045
2045
|
"z-index": 50
|
|
2046
2046
|
}, {
|
|
2047
|
-
"trigger-button":
|
|
2048
|
-
y(
|
|
2047
|
+
"trigger-button": U(({ opened: de }) => [
|
|
2048
|
+
y(C, {
|
|
2049
2049
|
"prepend-icon": "calendar_month",
|
|
2050
2050
|
focused: de
|
|
2051
2051
|
}, {
|
|
2052
|
-
default:
|
|
2053
|
-
|
|
2052
|
+
default: U(() => [
|
|
2053
|
+
pe(p(k.value.startDate) + " - " + p(k.value.endDate), 1)
|
|
2054
2054
|
]),
|
|
2055
2055
|
_: 2
|
|
2056
2056
|
}, 1032, ["focused"])
|
|
@@ -2058,47 +2058,47 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
|
|
|
2058
2058
|
_: 1
|
|
2059
2059
|
}, 8, ["modelValue"])
|
|
2060
2060
|
]),
|
|
2061
|
-
y(
|
|
2061
|
+
y(V, {
|
|
2062
2062
|
variant: "tertiary",
|
|
2063
|
-
onClick:
|
|
2063
|
+
onClick: i[2] || (i[2] = (de) => ue()),
|
|
2064
2064
|
"prepend-icon": "navigate_before"
|
|
2065
2065
|
}),
|
|
2066
|
-
y(
|
|
2066
|
+
y(V, {
|
|
2067
2067
|
variant: "tertiary",
|
|
2068
|
-
onClick:
|
|
2068
|
+
onClick: i[3] || (i[3] = (de) => L()),
|
|
2069
2069
|
"prepend-icon": "navigate_next"
|
|
2070
2070
|
})
|
|
2071
2071
|
]),
|
|
2072
|
-
B.value ? (
|
|
2072
|
+
B.value ? (j(), W("div", Vo, [
|
|
2073
2073
|
y(F),
|
|
2074
2074
|
y(N, { size: "xl" }),
|
|
2075
2075
|
e("div", Co, p(a(l)("inventory.stock.history.loading")), 1),
|
|
2076
2076
|
y(F),
|
|
2077
2077
|
y(F)
|
|
2078
|
-
])) : t.value && ((Ae = t.value) == null ? void 0 : Ae.length) > 0 ? (
|
|
2078
|
+
])) : t.value && ((Ae = t.value) == null ? void 0 : Ae.length) > 0 ? (j(), W("div", Do, [
|
|
2079
2079
|
y(Fe, { variant: "outlined" }, {
|
|
2080
|
-
default:
|
|
2080
|
+
default: U(() => [
|
|
2081
2081
|
y(ie, { class: "flex flex-col gap-4" }, {
|
|
2082
|
-
default:
|
|
2082
|
+
default: U(() => [
|
|
2083
2083
|
e("div", jo, [
|
|
2084
2084
|
e("div", Mo, p(a(l)("inventory.stock.history.summary.title")), 1)
|
|
2085
2085
|
]),
|
|
2086
2086
|
e("div", Bo, [
|
|
2087
2087
|
e("div", Io, [
|
|
2088
2088
|
e("div", To, p(a(l)("inventory.stock.history.summary.totalPurchase")), 1),
|
|
2089
|
-
e("div",
|
|
2089
|
+
e("div", Ho, p(R.value.PURCHASE), 1)
|
|
2090
2090
|
]),
|
|
2091
|
-
e("div",
|
|
2091
|
+
e("div", Uo, [
|
|
2092
2092
|
e("div", Eo, [
|
|
2093
|
-
|
|
2094
|
-
K.value != null ? (
|
|
2093
|
+
pe(p(a(l)("inventory.stock.history.summary.totalSales")) + " ", 1),
|
|
2094
|
+
K.value != null ? (j(), X(re, {
|
|
2095
2095
|
key: 0,
|
|
2096
2096
|
variant: "plain",
|
|
2097
2097
|
placement: "top",
|
|
2098
2098
|
content: `Before: ${K.value}`,
|
|
2099
2099
|
"z-index": 50
|
|
2100
2100
|
}, {
|
|
2101
|
-
default:
|
|
2101
|
+
default: U(() => [
|
|
2102
2102
|
y(ne, {
|
|
2103
2103
|
name: "warning",
|
|
2104
2104
|
size: "sm"
|
|
@@ -2138,21 +2138,21 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
|
|
|
2138
2138
|
e("div", ls, p(Z.value), 1)
|
|
2139
2139
|
])
|
|
2140
2140
|
]),
|
|
2141
|
-
a(c).enableTotalCost ? (
|
|
2141
|
+
a(c).enableTotalCost ? (j(), W("div", rs, [
|
|
2142
2142
|
y(J, { class: "w-full" }),
|
|
2143
2143
|
e("div", is, [
|
|
2144
2144
|
e("div", us, [
|
|
2145
2145
|
y(ot, { "z-index": 50 }, {
|
|
2146
|
-
default:
|
|
2146
|
+
default: U(() => [
|
|
2147
2147
|
e("div", cs, [
|
|
2148
|
-
|
|
2148
|
+
pe(p(a(l)("inventory.stock.history.estimatedValue")) + " ", 1),
|
|
2149
2149
|
y(re, {
|
|
2150
2150
|
variant: "plain",
|
|
2151
2151
|
placement: "top",
|
|
2152
2152
|
content: `[${ee.value}] ${a(l)("inventory.stock.history.estimatedValueTooltip")}`,
|
|
2153
2153
|
"z-index": 50
|
|
2154
2154
|
}, {
|
|
2155
|
-
default:
|
|
2155
|
+
default: U(() => [
|
|
2156
2156
|
y(ne, {
|
|
2157
2157
|
name: "help",
|
|
2158
2158
|
size: "sm"
|
|
@@ -2165,18 +2165,18 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
|
|
|
2165
2165
|
_: 1
|
|
2166
2166
|
}),
|
|
2167
2167
|
e("div", ds, [
|
|
2168
|
-
_.sku.valuation === a(tt).Enum.FIFO ? (
|
|
2168
|
+
_.sku.valuation === a(tt).Enum.FIFO ? (j(), W(le, { key: 0 }, [
|
|
2169
2169
|
y(te, {
|
|
2170
2170
|
label: "FIFO",
|
|
2171
2171
|
compact: ""
|
|
2172
2172
|
}),
|
|
2173
|
-
|
|
2173
|
+
pe(" " + p(typeof P.value != "string" ? a(Me)(
|
|
2174
2174
|
P.value,
|
|
2175
2175
|
!1,
|
|
2176
2176
|
P.value.precision
|
|
2177
2177
|
) : P.value), 1)
|
|
2178
|
-
], 64)) : (
|
|
2179
|
-
|
|
2178
|
+
], 64)) : (j(), W(le, { key: 1 }, [
|
|
2179
|
+
pe(p(typeof P.value != "string" ? a(Me)(
|
|
2180
2180
|
P.value,
|
|
2181
2181
|
!1,
|
|
2182
2182
|
P.value.precision
|
|
@@ -2184,9 +2184,9 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
|
|
|
2184
2184
|
], 64))
|
|
2185
2185
|
]),
|
|
2186
2186
|
y(oe, {
|
|
2187
|
-
modelValue:
|
|
2188
|
-
"onUpdate:modelValue":
|
|
2189
|
-
items:
|
|
2187
|
+
modelValue: r.value,
|
|
2188
|
+
"onUpdate:modelValue": i[4] || (i[4] = (de) => r.value = de),
|
|
2189
|
+
items: v.value,
|
|
2190
2190
|
compact: "",
|
|
2191
2191
|
size: "sm",
|
|
2192
2192
|
style: { width: "200px" }
|
|
@@ -2194,18 +2194,18 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
|
|
|
2194
2194
|
]),
|
|
2195
2195
|
e("div", ms, [
|
|
2196
2196
|
y(ot, { "z-index": 50 }, {
|
|
2197
|
-
default:
|
|
2197
|
+
default: U(() => [
|
|
2198
2198
|
e("div", fs, [
|
|
2199
|
-
|
|
2199
|
+
pe(p(a(l)("inventory.stock.history.costSold")) + " ", 1),
|
|
2200
2200
|
y(re, {
|
|
2201
2201
|
variant: "plain",
|
|
2202
2202
|
placement: "top",
|
|
2203
2203
|
"z-index": 50
|
|
2204
2204
|
}, {
|
|
2205
|
-
content:
|
|
2206
|
-
e("div",
|
|
2205
|
+
content: U(() => [
|
|
2206
|
+
e("div", ps, p(a(l)("inventory.stock.history.costSoldTooltip")), 1)
|
|
2207
2207
|
]),
|
|
2208
|
-
default:
|
|
2208
|
+
default: U(() => [
|
|
2209
2209
|
y(ne, {
|
|
2210
2210
|
name: "help",
|
|
2211
2211
|
size: "sm"
|
|
@@ -2217,7 +2217,7 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
|
|
|
2217
2217
|
]),
|
|
2218
2218
|
_: 1
|
|
2219
2219
|
}),
|
|
2220
|
-
e("div",
|
|
2220
|
+
e("div", vs, p(q.value), 1)
|
|
2221
2221
|
])
|
|
2222
2222
|
])
|
|
2223
2223
|
])) : se("", !0)
|
|
@@ -2227,21 +2227,21 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
|
|
|
2227
2227
|
]),
|
|
2228
2228
|
_: 1
|
|
2229
2229
|
}),
|
|
2230
|
-
|
|
2231
|
-
(
|
|
2230
|
+
i[6] || (i[6] = e("div", null, null, -1)),
|
|
2231
|
+
(j(!0), W(le, null, ce(t.value, (de) => (j(), W(le, {
|
|
2232
2232
|
key: de.date
|
|
2233
2233
|
}, [
|
|
2234
|
-
_.sku ? (
|
|
2234
|
+
_.sku ? (j(), X(go, {
|
|
2235
2235
|
key: 0,
|
|
2236
2236
|
record: de,
|
|
2237
2237
|
sku: _.sku,
|
|
2238
2238
|
bills: n.value,
|
|
2239
2239
|
"unit-cost-history": T.value,
|
|
2240
|
-
"cost-mechanism":
|
|
2240
|
+
"cost-mechanism": r.value,
|
|
2241
2241
|
onRefreshHistory: x
|
|
2242
2242
|
}, null, 8, ["record", "sku", "bills", "unit-cost-history", "cost-mechanism"])) : se("", !0)
|
|
2243
2243
|
], 64))), 128))
|
|
2244
|
-
])) : (
|
|
2244
|
+
])) : (j(), W("div", ys, [
|
|
2245
2245
|
y(F),
|
|
2246
2246
|
e("div", null, [
|
|
2247
2247
|
e("img", {
|
|
@@ -2264,15 +2264,15 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
|
|
|
2264
2264
|
}), bs = {
|
|
2265
2265
|
key: 0,
|
|
2266
2266
|
class: "flex items-center gap-1"
|
|
2267
|
-
}, xs = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ss = { class: "flex flex-col gap-8" }, ws = { class: "flex flex-col" }, Fs = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, As = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary line-clamp-1" },
|
|
2267
|
+
}, xs = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ss = { class: "flex flex-col gap-8" }, ws = { class: "flex flex-col" }, Fs = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, As = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary line-clamp-1" }, Js = /* @__PURE__ */ me({
|
|
2268
2268
|
__name: "StockView",
|
|
2269
|
-
setup(
|
|
2270
|
-
const { t: m } = fe(), d = Re(), s = xe(),
|
|
2269
|
+
setup(h) {
|
|
2270
|
+
const { t: m } = fe(), d = Re(), s = xe(), M = Oe(), w = kt(), c = we(), l = mt(), g = Zt(), { columnDefs: B } = un(), b = Ne(), r = Se();
|
|
2271
2271
|
s.watchLocation(x);
|
|
2272
|
-
const
|
|
2273
|
-
() => new Set(
|
|
2272
|
+
const v = Y(
|
|
2273
|
+
() => new Set(g.getAvailableItems(g.businessSubsidiaryId))
|
|
2274
2274
|
), T = z(!1);
|
|
2275
|
-
async function
|
|
2275
|
+
async function k() {
|
|
2276
2276
|
b.open({
|
|
2277
2277
|
title: m("inventory.stock.stock_balance.refreshBalance"),
|
|
2278
2278
|
message: m("inventory.stock.stock_balance.refreshBalanceDescription"),
|
|
@@ -2287,7 +2287,7 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
|
|
|
2287
2287
|
variant: "tertiary"
|
|
2288
2288
|
}
|
|
2289
2289
|
}).onPrimary(async () => {
|
|
2290
|
-
await c.recalculation.refreshCurrentBalances(),
|
|
2290
|
+
await c.recalculation.refreshCurrentBalances(), r.open({
|
|
2291
2291
|
title: "Refresh Stock Balance",
|
|
2292
2292
|
message: "Stock balance refresh has been queued. This may take a moment to complete.",
|
|
2293
2293
|
type: "success"
|
|
@@ -2298,9 +2298,9 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
|
|
|
2298
2298
|
if (s._currentLocation) {
|
|
2299
2299
|
T.value = !0;
|
|
2300
2300
|
try {
|
|
2301
|
-
await
|
|
2301
|
+
await M.readStockBalance(), await M.readProductBalance(), await l.readStockEstimateBalance();
|
|
2302
2302
|
} catch (ee) {
|
|
2303
|
-
|
|
2303
|
+
r.open({
|
|
2304
2304
|
title: m("inventory.stock.error.title"),
|
|
2305
2305
|
message: m("inventory.stock.error.message"),
|
|
2306
2306
|
type: "error"
|
|
@@ -2329,35 +2329,36 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
|
|
|
2329
2329
|
]
|
|
2330
2330
|
}), n = Y(() => {
|
|
2331
2331
|
var $, G, P;
|
|
2332
|
-
const ee = t.value ? en.build(t.value) : null,
|
|
2332
|
+
const ee = t.value ? en.build(t.value) : null, f = [];
|
|
2333
2333
|
for (const L of d.skus) {
|
|
2334
2334
|
let E = !0;
|
|
2335
|
-
if (
|
|
2335
|
+
if (g.isEnabled && D.value && v.value && E && (E = v.value.has(L._id)), ee && E && (E = tn(
|
|
2336
2336
|
{
|
|
2337
2337
|
status: L.isInactive ? "Inactive" : "Active"
|
|
2338
2338
|
},
|
|
2339
2339
|
ee
|
|
2340
2340
|
)), E) {
|
|
2341
2341
|
const _ = L.trackingMeasurement;
|
|
2342
|
-
let
|
|
2342
|
+
let i = (G = ($ = M.stockBalance.skus) == null ? void 0 : $.find(
|
|
2343
2343
|
(u) => u.id === L._id
|
|
2344
|
-
)) == null ? void 0 : G.balance,
|
|
2344
|
+
)) == null ? void 0 : G.balance, V = l.inventoryForecast.skus.find(
|
|
2345
2345
|
(u) => u.id === L._id
|
|
2346
2346
|
);
|
|
2347
|
-
const
|
|
2347
|
+
const C = {
|
|
2348
2348
|
...L,
|
|
2349
|
-
balance:
|
|
2349
|
+
balance: i ?? {
|
|
2350
2350
|
amount: 0,
|
|
2351
2351
|
precision: 0
|
|
2352
2352
|
},
|
|
2353
|
-
|
|
2353
|
+
operator: V == null ? void 0 : V.operator,
|
|
2354
|
+
day: (V == null ? void 0 : V.depletionDays) ?? void 0,
|
|
2354
2355
|
trackingUnitAbbrev: _ ? ((P = L.unit.measurements.find((u) => u.id === _)) == null ? void 0 : P.abbrev) ?? "" : L.unit.abbrev
|
|
2355
2356
|
};
|
|
2356
|
-
|
|
2357
|
+
f.push(C);
|
|
2357
2358
|
}
|
|
2358
2359
|
}
|
|
2359
|
-
return
|
|
2360
|
-
}), S = z(""),
|
|
2360
|
+
return f;
|
|
2361
|
+
}), S = z(""), D = z(!0), { breakpoints: A } = Pt(), I = Y(() => A.value.xs || A.value.sm), R = Y(() => I.value ? 10 : 20), K = St(), O = Y(() => [
|
|
2361
2362
|
{
|
|
2362
2363
|
label: m("inventory.stock.stock_balance.refreshBalance"),
|
|
2363
2364
|
value: "refresh-balance",
|
|
@@ -2384,7 +2385,7 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
|
|
|
2384
2385
|
function ue(ee) {
|
|
2385
2386
|
switch (ee) {
|
|
2386
2387
|
case "refresh-balance":
|
|
2387
|
-
return
|
|
2388
|
+
return k();
|
|
2388
2389
|
case "refresh":
|
|
2389
2390
|
return x();
|
|
2390
2391
|
case "export":
|
|
@@ -2393,14 +2394,14 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
|
|
|
2393
2394
|
return q();
|
|
2394
2395
|
}
|
|
2395
2396
|
}
|
|
2396
|
-
return (ee,
|
|
2397
|
-
const $ =
|
|
2398
|
-
return
|
|
2397
|
+
return (ee, f) => {
|
|
2398
|
+
const $ = H("FmSwitch"), G = H("FmTable");
|
|
2399
|
+
return j(), X(wt, {
|
|
2399
2400
|
title: a(m)("inventory.stock.title"),
|
|
2400
2401
|
actions: O.value,
|
|
2401
2402
|
"onClick:action": ue
|
|
2402
2403
|
}, {
|
|
2403
|
-
default:
|
|
2404
|
+
default: U(() => {
|
|
2404
2405
|
var P, L, E, _;
|
|
2405
2406
|
return [
|
|
2406
2407
|
e("div", {
|
|
@@ -2416,22 +2417,22 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
|
|
|
2416
2417
|
searchable: "",
|
|
2417
2418
|
"change-location": "",
|
|
2418
2419
|
search: S.value,
|
|
2419
|
-
"onUpdate:search":
|
|
2420
|
+
"onUpdate:search": f[1] || (f[1] = (i) => S.value = i),
|
|
2420
2421
|
"hide-filter-options": !0,
|
|
2421
2422
|
filterable: "",
|
|
2422
2423
|
"filter-attributes": o.value,
|
|
2423
2424
|
filter: t.value,
|
|
2424
|
-
"onUpdate:filter":
|
|
2425
|
+
"onUpdate:filter": f[2] || (f[2] = (i) => t.value = i)
|
|
2425
2426
|
}, {
|
|
2426
|
-
default:
|
|
2427
|
-
a(
|
|
2427
|
+
default: U(() => [
|
|
2428
|
+
a(g).isEnabled ? (j(), W("div", bs, [
|
|
2428
2429
|
e("span", xs, p(a(m)("inventory.integration.netsuite.subsidiaryHierarchy.filtering")), 1),
|
|
2429
|
-
y(
|
|
2430
|
+
y(Ut),
|
|
2430
2431
|
y(Xe, null, {
|
|
2431
|
-
default:
|
|
2432
|
+
default: U(() => [
|
|
2432
2433
|
y($, {
|
|
2433
|
-
modelValue:
|
|
2434
|
-
"onUpdate:modelValue":
|
|
2434
|
+
modelValue: D.value,
|
|
2435
|
+
"onUpdate:modelValue": f[0] || (f[0] = (i) => D.value = i)
|
|
2435
2436
|
}, null, 8, ["modelValue"])
|
|
2436
2437
|
]),
|
|
2437
2438
|
_: 1
|
|
@@ -2440,51 +2441,51 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
|
|
|
2440
2441
|
]),
|
|
2441
2442
|
_: 1
|
|
2442
2443
|
}, 8, ["search", "filter-attributes", "filter"]),
|
|
2443
|
-
(
|
|
2444
|
+
(j(), X(G, {
|
|
2444
2445
|
style: ct(a(K).tableHeight),
|
|
2445
2446
|
"column-defs": a(B),
|
|
2446
2447
|
"row-data": n.value,
|
|
2447
2448
|
"search-value": S.value,
|
|
2448
2449
|
loading: T.value || !a(s)._currentLocation,
|
|
2449
2450
|
key: (P = a(s)._currentLocation) == null ? void 0 : P.dbName,
|
|
2450
|
-
onRowClick:
|
|
2451
|
+
onRowClick: f[3] || (f[3] = (i) => a(w).showSkuHistory(i.original)),
|
|
2451
2452
|
"page-size": R.value
|
|
2452
2453
|
}, {
|
|
2453
|
-
"list-row":
|
|
2454
|
+
"list-row": U((i) => [
|
|
2454
2455
|
y(Qt, {
|
|
2455
|
-
row:
|
|
2456
|
+
row: i,
|
|
2456
2457
|
onRowClick: a(w).showSkuHistory
|
|
2457
2458
|
}, {
|
|
2458
|
-
default:
|
|
2459
|
-
var
|
|
2459
|
+
default: U((V) => {
|
|
2460
|
+
var C, u, F, N, ne, re, J, te, oe, ie;
|
|
2460
2461
|
return [
|
|
2461
2462
|
e("div", Ss, [
|
|
2462
2463
|
e("div", ws, [
|
|
2463
2464
|
e("div", Fs, [
|
|
2464
2465
|
y(a(lt), {
|
|
2465
|
-
render: (F = (u = (
|
|
2466
|
-
props: (ne = (N =
|
|
2466
|
+
render: (F = (u = (C = V.code) == null ? void 0 : C.column) == null ? void 0 : u.columnDef) == null ? void 0 : F.cell,
|
|
2467
|
+
props: (ne = (N = V.code) == null ? void 0 : N.getContext) == null ? void 0 : ne.call(N)
|
|
2467
2468
|
}, null, 8, ["render", "props"])
|
|
2468
2469
|
]),
|
|
2469
2470
|
e("div", As, [
|
|
2470
2471
|
y(a(lt), {
|
|
2471
|
-
render: (te = (J = (re =
|
|
2472
|
-
props: (ie = (oe =
|
|
2472
|
+
render: (te = (J = (re = V.name) == null ? void 0 : re.column) == null ? void 0 : J.columnDef) == null ? void 0 : te.cell,
|
|
2473
|
+
props: (ie = (oe = V.name) == null ? void 0 : oe.getContext) == null ? void 0 : ie.call(oe)
|
|
2473
2474
|
}, null, 8, ["render", "props"])
|
|
2474
2475
|
])
|
|
2475
2476
|
]),
|
|
2476
2477
|
e("div", null, [
|
|
2477
2478
|
y(Ke, {
|
|
2478
|
-
days:
|
|
2479
|
+
days: i.original.day
|
|
2479
2480
|
}, null, 8, ["days"])
|
|
2480
2481
|
]),
|
|
2481
2482
|
e("div", null, [
|
|
2482
2483
|
y(_t, {
|
|
2483
2484
|
class: "xs:w-[160px]",
|
|
2484
|
-
unit:
|
|
2485
|
-
sku:
|
|
2486
|
-
amount:
|
|
2487
|
-
"default-tracking-measurement":
|
|
2485
|
+
unit: i.original.unit,
|
|
2486
|
+
sku: i.original,
|
|
2487
|
+
amount: i.original.balance,
|
|
2488
|
+
"default-tracking-measurement": i.original.trackingMeasurement ?? void 0
|
|
2488
2489
|
}, null, 8, ["unit", "sku", "amount", "default-tracking-measurement"])
|
|
2489
2490
|
])
|
|
2490
2491
|
])
|
|
@@ -2496,15 +2497,15 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
|
|
|
2496
2497
|
_: 1
|
|
2497
2498
|
}, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"]))
|
|
2498
2499
|
], 2),
|
|
2499
|
-
(
|
|
2500
|
-
(L = a(w).stockHistoryProps) != null && L.sku ? (
|
|
2501
|
-
(E = a(w).convertSkuDialogProps) != null && E.sku ? (
|
|
2502
|
-
(_ = a(w).adjustSkuDialogProps) != null && _.stock ? (
|
|
2503
|
-
Z.value ? (
|
|
2500
|
+
(j(), X(xt, { to: "body" }, [
|
|
2501
|
+
(L = a(w).stockHistoryProps) != null && L.sku ? (j(), X(gs, Le(ze({ key: 0 }, a(w).stockHistoryProps)), null, 16)) : se("", !0),
|
|
2502
|
+
(E = a(w).convertSkuDialogProps) != null && E.sku ? (j(), X(wn, Le(ze({ key: 1 }, a(w).convertSkuDialogProps)), null, 16)) : se("", !0),
|
|
2503
|
+
(_ = a(w).adjustSkuDialogProps) != null && _.stock ? (j(), X(Hn, Le(ze({ key: 2 }, a(w).adjustSkuDialogProps)), null, 16)) : se("", !0),
|
|
2504
|
+
Z.value ? (j(), X(qn, {
|
|
2504
2505
|
key: 3,
|
|
2505
2506
|
show: Z.value,
|
|
2506
|
-
"onUpdate:show":
|
|
2507
|
-
onSubmitted:
|
|
2507
|
+
"onUpdate:show": f[4] || (f[4] = (i) => Z.value = i),
|
|
2508
|
+
onSubmitted: f[5] || (f[5] = (i) => x())
|
|
2508
2509
|
}, null, 8, ["show"])) : se("", !0)
|
|
2509
2510
|
]))
|
|
2510
2511
|
];
|
|
@@ -2515,5 +2516,5 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
|
|
|
2515
2516
|
}
|
|
2516
2517
|
});
|
|
2517
2518
|
export {
|
|
2518
|
-
|
|
2519
|
+
Js as default
|
|
2519
2520
|
};
|