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