@feedmepos/mf-inventory-portal 1.2.56-dev.1 → 1.2.56
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-Dlnr4iYC.js → App-KmP0TzgM.js} +3 -3
- package/dist/{ApprovalView-Txmz-hCz.js → ApprovalView-BfXRpwMD.js} +5 -5
- package/dist/{BindingsDialog-BXnuWCaK.js → BindingsDialog-DNYn8rOv.js} +5 -5
- package/dist/{BindingsPicker-CO2_vfjx.js → BindingsPicker-C_BwhQ6B.js} +3 -3
- package/dist/{BindingsTable-amypZb8r.js → BindingsTable-BUNvU001.js} +5 -5
- package/dist/{ClosingDraftView-Kegm5V38.js → ClosingDraftView-D7eJrwDC.js} +139 -139
- package/dist/{ClosingHistoryView-D9VXx7c6.js → ClosingHistoryView-LPBqAMLm.js} +36 -36
- package/dist/{ClosingTemplateView-PYKa8KDQ.js → ClosingTemplateView-GvF2Tvny.js} +14 -14
- package/dist/{DeliveryOrderPrintPreview-BBUliD2T.js → DeliveryOrderPrintPreview-CFEuEOxp.js} +7 -7
- package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-DhJjC8RN.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-BWq4rWaC.js} +17 -17
- package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-D0z-41dr.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-uIJ2INOr.js} +2 -2
- package/dist/{FmMultiselectDialog-DTYS42tQ.js → FmMultiselectDialog-B7UPOXEa.js} +1 -1
- package/dist/{FmMultiselectDialog-CswtC1AP.js → FmMultiselectDialog-CdBuD2tB.js} +16 -16
- package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-DXkTWOFj.js → FmUnitInput.vue_vue_type_script_setup_true_lang-DZPqBIno.js} +11 -11
- package/dist/{ImportView-DvECDSkN.js → ImportView-DABcONRX.js} +6 -6
- package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-Dg0gQJFw.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-Bgs6kzxt.js} +1 -1
- package/dist/{IngredientGroupView-PYLW-jdb.js → IngredientGroupView-Dyw0SWa2.js} +5 -5
- package/dist/{IngredientsView-fzMFu5Kd.js → IngredientsView-3svDZ3pM.js} +14 -14
- package/dist/{IntegrationView-BJraR9yF.js → IntegrationView-B5Ql6B4Z.js} +12 -12
- package/dist/{InventoryBindingForm-BCLg-OVi.js → InventoryBindingForm-BnbjaC3n.js} +1 -1
- package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-BAoFz9Xy.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-CU0p8OtH.js} +14 -14
- package/dist/{InventoryBindingSummary-BaihKVNj.js → InventoryBindingSummary-BWYqDQFW.js} +1 -1
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-sxY8hdeR.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DO47als9.js} +1 -1
- package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-BhOwDBiq.js → PremiumBadge.vue_vue_type_script_setup_true_lang-B6jIGOQk.js} +2 -2
- package/dist/{PublishView-BMmcC0Vq.js → PublishView-X78B9ips.js} +8 -8
- package/dist/{PurchaseOrderPrintPreview-BWl9FIys.js → PurchaseOrderPrintPreview-BcBjpdKk.js} +11 -11
- package/dist/{ReceiveRequestView-Cn5w0cDy.js → ReceiveRequestView-jCXmQuZN.js} +19 -19
- package/dist/RecipeView-BQN7W4_n.js +646 -0
- package/dist/{StockView-oxOQh8eg.js → StockView-DBI_vEFM.js} +881 -860
- package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-JGzokQMQ.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-BowCyYAA.js} +1 -1
- package/dist/{SupplierView-TSbv1g43.js → SupplierView-2OV8kRmK.js} +11 -11
- package/dist/{SurchargeView-CZDaMAk2.js → SurchargeView-B_FvfxFV.js} +6 -6
- package/dist/{SystemTrailDialog.vue_vue_type_script_setup_true_lang-BH90OuDB.js → SystemTrailDialog.vue_vue_type_script_setup_true_lang-B-yk6Tpp.js} +2 -2
- package/dist/{TemplatePublishDialog.vue_vue_type_script_setup_true_lang-D0geyvW9.js → TemplatePublishDialog.vue_vue_type_script_setup_true_lang-BN52gPS6.js} +1 -1
- package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-Dxm9e7s0.js → TransferDetails.vue_vue_type_script_setup_true_lang-CJeTHWlX.js} +72 -72
- package/dist/{TransferTemplateView-Ds4UfF6z.js → TransferTemplateView-CTZzJO_r.js} +15 -15
- package/dist/{UnitView-DNfslwNA.js → UnitView-D4L2o3mi.js} +6 -6
- package/dist/{WarehouseView-DkcPy1mF.js → WarehouseView-D0YRCoO-.js} +5 -5
- package/dist/{WastageTemplateView-CP_sQsdU.js → WastageTemplateView-BnO927Yb.js} +60 -60
- package/dist/api/inventory.d.ts +36 -126
- package/dist/api/netsuite.d.ts +1 -8
- package/dist/{app-Do7d9F2j.js → app-DDU7NeKU.js} +6379 -7340
- package/dist/app.d.ts +0 -200
- package/dist/app.js +1 -1
- package/dist/{closing-template-BidraMN0.js → closing-template-Cbj_owJh.js} +1 -1
- package/dist/components/inventory-binding/InventoryBinding.vue.d.ts +1 -37
- package/dist/components/shell/inventory/binding-dialog.vue.d.ts +0 -14
- package/dist/components/shell/inventory/binding-ui.vue.d.ts +1 -16
- package/dist/{date2-xmQqiCBU.js → date2-CdIVvJMO.js} +1 -1
- package/dist/{dayjs.min-C2InbamH.js → dayjs.min-x0l3YFuh.js} +16 -16
- package/dist/{decimal-BHD_uD50.js → decimal-BmI-vHdY.js} +2 -2
- package/dist/{defineDeepModel-CoBQILOz.js → defineDeepModel-DVq8J3K0.js} +1 -1
- package/dist/{duplicate-template-BfJ6g_ux.js → duplicate-template-6sxuQt7G.js} +1 -1
- package/dist/{feature-BsP8KV0O.js → feature-CBAV6rwn.js} +89 -94
- package/dist/{format-time-from-id-CLLM4KoK.js → format-time-from-id-gonrB7zJ.js} +1 -1
- package/dist/{format-unit-display-BLtS1XcY.js → format-unit-display-UX-3QtOQ.js} +10 -10
- package/dist/{import-export.helper-DQvkoWnj.js → import-export.helper-D3XtnI5X.js} +7 -7
- package/dist/{index-p8EMSeUp.js → index-Bbs6bv6_.js} +3 -3
- package/dist/{index-CUm44l1O.js → index-DYB4AFCJ.js} +1 -1
- package/dist/{index-CrS7Yig1.js → index-VxOfv9io.js} +1412 -1471
- package/dist/{lodash-BNImU2Ov.js → lodash-xDP15O6H.js} +1 -1
- package/dist/{netsuite-DpB7HK5Q.js → netsuite-04rSEWQB.js} +60 -60
- package/dist/{purchase-order-template-DgbM99CO.js → purchase-order-template-Cc3-mrLi.js} +1 -1
- package/dist/{rules-CmGXcEkE.js → rules-CttmEqBJ.js} +18 -18
- package/dist/{stock-C1-SWNBT.js → stock-DJB96pzi.js} +1 -1
- package/dist/{stock-CUjopFIE.js → stock-VzLu7DTu.js} +3 -3
- package/dist/stores/feature.d.ts +0 -2
- package/dist/stores/integration/netsuite.d.ts +1 -8
- package/dist/stores/inventory.d.ts +30 -119
- package/dist/{supplier-BLGyTOqT.js → supplier-xpNYUwPV.js} +2 -2
- package/dist/{surcharge-BA-bc8RT.js → surcharge-CjnXVWpE.js} +1 -1
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{use-ingredient-select-dialog-BDMeEnJC.js → use-ingredient-select-dialog-RroJA5ty.js} +2 -2
- package/dist/{use-inventory-binding-dialog-CmAOk0d6.js → use-inventory-binding-dialog-kecoeAsI.js} +2 -2
- package/dist/{use-template-enabled-locations-2-DSQY7vNB.js → use-template-enabled-locations-2-BKrIbHc5.js} +2 -2
- package/dist/views/closing-draft/components/closing-draft-dialog/ClosingDraftDialog.vue.d.ts +8 -64
- package/dist/views/closing-draft/composables/use-closing-draft-table.d.ts +24 -192
- package/dist/views/closing-template/components/closing-template-form/composables/use-closing-template-items.d.ts +1 -8
- package/dist/views/closing-template/composables/use-closing-template-actions.d.ts +12 -96
- package/dist/views/closing-template/composables/use-closing-template-table.d.ts +12 -96
- package/dist/views/ingredient-group/composables/use-ingredient-group-table.d.ts +18 -18
- package/dist/views/ingredients/components/convert/ConvertForm.vue.d.ts +0 -14
- package/dist/views/ingredients/components/ingredient-form/IngredientForm.vue.d.ts +4 -32
- package/dist/views/ingredients/components/inventory-binding/InventoryBindingForm.vue.d.ts +0 -28
- package/dist/views/ingredients/composables/use-ingredient-table.d.ts +1 -8
- package/dist/views/integration/components/netsuite/InventoryTransferIngredientTable.vue.d.ts +2 -16
- package/dist/views/receive-request/components/transfer-form/TransferFormWithController.vue.d.ts +5 -33
- package/dist/views/receive-request/components/transfer-form/components/ForecastStock.vue.d.ts +2 -16
- package/dist/views/receive-request/components/transfer-form/components/TransferItemTable.vue.d.ts +4 -32
- package/dist/views/receive-request/components/transfer-form/composables/use-transfer-items.d.ts +1 -8
- package/dist/views/receive-request/composables/use-process-purchase-order.d.ts +6 -41
- package/dist/views/receive-request/composables/use-receive-request-form.d.ts +36 -246
- package/dist/views/receive-request/composables/use-receive-request-table.d.ts +42 -287
- package/dist/views/recipe/components/recipe-form/RecipeForm.vue.d.ts +0 -16
- package/dist/views/stock/components/dialog/AdjustedItemForm.vue.d.ts +2 -16
- package/dist/views/transfer-template/components/transfer-template-dialog/TransferTemplateDialog.vue.d.ts +2 -16
- package/dist/views/transfer-template/components/transfer-template-form/components/NetSuiteCustomCodeSelection.vue.d.ts +2 -16
- package/dist/views/transfer-template/components/transfer-template-form/components/TransferTemplateItemTable.vue.d.ts +2 -16
- package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-template-items.d.ts +1 -8
- package/dist/views/transfer-template/composables/use-netsuite-custom-field.d.ts +3 -24
- package/dist/views/transfer-template/composables/use-transfer-template-actions.d.ts +12 -96
- package/dist/views/transfer-template/composables/use-transfer-template-table.d.ts +12 -96
- package/dist/{vue-i18n-CIhYwCeG.js → vue-i18n-DsZSVX8N.js} +328 -328
- package/dist/{xlsx-BcQjo8NU.js → xlsx-7KX7f3af.js} +1 -1
- package/dist/{xlsx.util-GOcrvAJZ.js → xlsx.util-MseAEQJ5.js} +1 -1
- package/package.json +3 -3
- package/dist/RecipeView-BW5KCmkx.js +0 -1557
- package/dist/views/ingredients/components/inventory-binding/v2/InventoryBindingFormV2.vue.d.ts +0 -169
- package/dist/views/ingredients/components/inventory-binding/v2/components/InventoryBindingAlternative.vue.d.ts +0 -43
- package/dist/views/ingredients/components/inventory-binding/v2/components/InventoryBindingRule.vue.d.ts +0 -25
- package/dist/views/ingredients/components/inventory-binding/v2/components/InventoryRecipeBindingV2Field.vue.d.ts +0 -125
- package/dist/views/ingredients/components/inventory-binding/v2/components/InventorySkuBindingV2Field.vue.d.ts +0 -129
- package/dist/views/ingredients/components/inventory-binding/v2/composables/use-inventory-binding-alternative-table.d.ts +0 -30
- package/dist/views/ingredients/components/inventory-binding/v2/composables/use-inventory-binding-dialog.d.ts +0 -4
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import { defineComponent as me, ref as
|
|
1
|
+
import { defineComponent as me, ref as z, computed as Y, resolveComponent as H, openBlock as D, createBlock as X, withCtx as U, createElementVNode as e, normalizeClass as ge, toDisplayString as p, createVNode as y, createElementBlock as W, Fragment as le, renderList as ce, unref as a, h as ke, watch as $e, isRef as Ee, createCommentVNode as se, reactive as ut, mergeModels as Qe, useModel as bt, onMounted as qe, createTextVNode as ve, normalizeStyle as ct, Teleport as xt, normalizeProps as Le, mergeProps as ze } from "vue";
|
|
2
2
|
import { F as Xe, u as St, _ as wt } from "./SingleColumnLayout.vue_vue_type_script_setup_true_lang-CWZkVCAj.js";
|
|
3
|
-
import { u as
|
|
4
|
-
import { u as
|
|
3
|
+
import { u as xe, c as Pe, a as Re, F as Ze, H as Ft, D as ae, v as At, o as $t, B as Vt, w as Q, h as De, i as et, e as tt, I as he } from "./app-DDU7NeKU.js";
|
|
4
|
+
import { u as Oe } from "./stock-VzLu7DTu.js";
|
|
5
5
|
import { c as Ct } from "./component-DpCUABT3.js";
|
|
6
|
-
import { g as
|
|
7
|
-
import { d as
|
|
8
|
-
import { e as
|
|
9
|
-
import { _ as
|
|
6
|
+
import { g as Ve } from "./decimal-BmI-vHdY.js";
|
|
7
|
+
import { d as ye } from "./dayjs.min-x0l3YFuh.js";
|
|
8
|
+
import { e as Dt, u as dt, i as Ie, _ as nt } from "./PremiumBadge.vue_vue_type_script_setup_true_lang-B6jIGOQk.js";
|
|
9
|
+
import { _ as Ke, S as Ge, g as mt, a as jt } from "./SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-BowCyYAA.js";
|
|
10
10
|
import { _ as Mt } from "./PreviewBadge.vue_vue_type_script_setup_true_lang-CRZiQHjx.js";
|
|
11
11
|
import { useI18n as fe, useCoreStore as ft } from "@feedmepos/mf-common";
|
|
12
|
-
import { useSnackbar as
|
|
12
|
+
import { useSnackbar as Se, useDialog as Ne, useProxiedModel as Ye, useBreakpoints as Bt } from "@feedmepos/ui-library";
|
|
13
13
|
import { defineStore as It } from "pinia";
|
|
14
|
-
import { g as
|
|
15
|
-
import { u as
|
|
16
|
-
import { u as Ot } from "./use-inventory-binding-dialog-
|
|
17
|
-
import { a as
|
|
18
|
-
import { _ as Nt } from "./NumberPrecisionInput.vue_vue_type_script_setup_true_lang-
|
|
19
|
-
import { a as Yt, b as Lt, f as yt, t as st, c as at, p as zt, n as Gt, d as Wt } from "./date2-
|
|
20
|
-
import { i as Kt, _ as qt } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-
|
|
14
|
+
import { g as Ce, a as _e, f as Tt, t as Te, h as He, A as Ht, M as Ut, d as be, i as Et, j as ot, k as vt, l as Je, R as Pt, e as Me, m as Rt } from "./rules-CttmEqBJ.js";
|
|
15
|
+
import { u as we } from "./stock-DJB96pzi.js";
|
|
16
|
+
import { u as Ot } from "./use-inventory-binding-dialog-kecoeAsI.js";
|
|
17
|
+
import { a as pt } from "./FmMultiselectDialog-CdBuD2tB.js";
|
|
18
|
+
import { _ as Nt } from "./NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DO47als9.js";
|
|
19
|
+
import { a as Yt, b as Lt, f as yt, t as st, c as at, p as zt, n as Gt, d as Wt } from "./date2-CdIVvJMO.js";
|
|
20
|
+
import { i as Kt, _ as qt } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-uIJ2INOr.js";
|
|
21
21
|
import { E as Xt } from "./empty-placeholder-wf6-BWE8.js";
|
|
22
|
-
import { F as
|
|
22
|
+
import { F as pe, u as Jt } from "./feature-CBAV6rwn.js";
|
|
23
23
|
import { _ as Qt, F as lt } from "./TableActionableRow.vue_vue_type_script_setup_true_lang-Ca_eYa8-.js";
|
|
24
|
-
import { u as Zt } from "./netsuite-
|
|
24
|
+
import { u as Zt } from "./netsuite-04rSEWQB.js";
|
|
25
25
|
import { P as en, J as tn } from "./app-DiX-EfV6.js";
|
|
26
|
-
var
|
|
26
|
+
var Be = /* @__PURE__ */ ((k) => (k.History = "History", k.Convert = "Convert", k.Adjust = "Adjust", k))(Be || {});
|
|
27
27
|
const nn = [
|
|
28
28
|
{
|
|
29
29
|
translationKey: "inventory.stock.action.history",
|
|
@@ -52,11 +52,11 @@ const nn = [
|
|
|
52
52
|
}
|
|
53
53
|
];
|
|
54
54
|
async function sn(k) {
|
|
55
|
-
const d = `${(
|
|
55
|
+
const d = `${(xe().currentLocation.name || "").replace(
|
|
56
56
|
/ /g,
|
|
57
57
|
"_"
|
|
58
|
-
)}_${
|
|
59
|
-
await
|
|
58
|
+
)}_${ye().format("DD_MM_YYYY_HHmm")}.xlsx`;
|
|
59
|
+
await Dt(
|
|
60
60
|
[
|
|
61
61
|
{
|
|
62
62
|
name: "stock",
|
|
@@ -73,16 +73,16 @@ async function sn(k) {
|
|
|
73
73
|
{
|
|
74
74
|
name: "Balance",
|
|
75
75
|
selector: (s) => {
|
|
76
|
-
const
|
|
77
|
-
return
|
|
76
|
+
const j = Ue(s, s.unit);
|
|
77
|
+
return j.type === "unit" ? Ve(s.balance, s.unit, null, !1) : Ve(s.balance, s.unit, j.measurement, !1);
|
|
78
78
|
}
|
|
79
79
|
},
|
|
80
80
|
{
|
|
81
81
|
name: "Unit",
|
|
82
82
|
selector: (s) => {
|
|
83
|
-
var
|
|
84
|
-
const
|
|
85
|
-
return
|
|
83
|
+
var w;
|
|
84
|
+
const j = Ue(s, s.unit);
|
|
85
|
+
return j.type === "unit" ? s.unit.abbrev : ((w = s.unit.measurements.find((c) => c.id === j.measurement)) == null ? void 0 : w.abbrev) || "";
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
]
|
|
@@ -91,7 +91,7 @@ async function sn(k) {
|
|
|
91
91
|
d
|
|
92
92
|
);
|
|
93
93
|
}
|
|
94
|
-
function
|
|
94
|
+
function Ue(k, m) {
|
|
95
95
|
const d = localStorage.getItem(`uom:${k._id}`);
|
|
96
96
|
return d ? d === m._id ? {
|
|
97
97
|
type: "unit"
|
|
@@ -120,58 +120,58 @@ const an = { class: "fm-typo-en-body-md-400 flex-grow" }, _t = /* @__PURE__ */ m
|
|
|
120
120
|
return `uom:${B._id}`;
|
|
121
121
|
}
|
|
122
122
|
function d(B) {
|
|
123
|
-
const
|
|
124
|
-
B ? localStorage.setItem(
|
|
123
|
+
const b = m(s.sku);
|
|
124
|
+
B ? localStorage.setItem(b, B) : localStorage.setItem(b, s.unit._id), j.value = Ue(s.sku, s.unit);
|
|
125
125
|
}
|
|
126
|
-
const s = k,
|
|
126
|
+
const s = k, j = z(Ue(s.sku, s.unit)), w = Y(() => {
|
|
127
127
|
const { measurements: B } = s.unit;
|
|
128
128
|
return [
|
|
129
129
|
{
|
|
130
|
-
label: `${
|
|
130
|
+
label: `${Ve(s.amount, s.unit)}`,
|
|
131
131
|
value: null
|
|
132
132
|
},
|
|
133
|
-
...B.map(({ id:
|
|
134
|
-
label: `${
|
|
135
|
-
value:
|
|
133
|
+
...B.map(({ id: b }) => ({
|
|
134
|
+
label: `${Ve(s.amount, s.unit, b)}`,
|
|
135
|
+
value: b
|
|
136
136
|
}))
|
|
137
137
|
];
|
|
138
138
|
});
|
|
139
139
|
function c({ value: B }) {
|
|
140
|
-
return a(
|
|
140
|
+
return a(j).type === "unit" ? B === null : B === a(j).measurement;
|
|
141
141
|
}
|
|
142
|
-
const l =
|
|
142
|
+
const l = Y(
|
|
143
143
|
() => {
|
|
144
144
|
var B;
|
|
145
|
-
return ((B =
|
|
145
|
+
return ((B = w.value.find((b) => c(b))) == null ? void 0 : B.label) ?? "";
|
|
146
146
|
}
|
|
147
|
-
), h =
|
|
148
|
-
return (B,
|
|
149
|
-
const i =
|
|
150
|
-
return
|
|
147
|
+
), h = z(!1);
|
|
148
|
+
return (B, b) => {
|
|
149
|
+
const i = H("FmIcon"), f = H("FmMenuItem"), T = H("FmMenu");
|
|
150
|
+
return D(), X(T, {
|
|
151
151
|
"stop-click-propagation": "",
|
|
152
|
-
onMenuChanged:
|
|
152
|
+
onMenuChanged: b[0] || (b[0] = (g) => h.value = g)
|
|
153
153
|
}, {
|
|
154
|
-
"menu-button":
|
|
154
|
+
"menu-button": U(() => [
|
|
155
155
|
e("button", {
|
|
156
156
|
type: "button",
|
|
157
|
-
class:
|
|
157
|
+
class: ge([
|
|
158
158
|
"w-full text-left flex items-center gap-8 cursor-pointer fm-corner-radius-sm px-8 py-4 border bg-white",
|
|
159
159
|
h.value ? "border-fm-color-primary" : "border-fm-color-neutral-gray-100"
|
|
160
160
|
])
|
|
161
161
|
}, [
|
|
162
|
-
e("div", an,
|
|
162
|
+
e("div", an, p(l.value), 1),
|
|
163
163
|
y(i, {
|
|
164
164
|
class: "text-fm-color-neutral-gray-400",
|
|
165
165
|
name: "expand_more"
|
|
166
166
|
})
|
|
167
167
|
], 2)
|
|
168
168
|
]),
|
|
169
|
-
default:
|
|
170
|
-
(
|
|
171
|
-
key:
|
|
172
|
-
label:
|
|
173
|
-
"model-value": c(
|
|
174
|
-
onClick: (
|
|
169
|
+
default: U(() => [
|
|
170
|
+
(D(!0), W(le, null, ce(w.value, (g) => (D(), X(f, {
|
|
171
|
+
key: g.value ?? 0,
|
|
172
|
+
label: g.label,
|
|
173
|
+
"model-value": c(g),
|
|
174
|
+
onClick: (x) => d(g.value)
|
|
175
175
|
}, null, 8, ["label", "model-value", "onClick"]))), 128))
|
|
176
176
|
]),
|
|
177
177
|
_: 1
|
|
@@ -182,22 +182,22 @@ const an = { class: "fm-typo-en-body-md-400 flex-grow" }, _t = /* @__PURE__ */ m
|
|
|
182
182
|
__name: "StockHeaderPreview",
|
|
183
183
|
setup(k) {
|
|
184
184
|
const { t: m } = fe();
|
|
185
|
-
return (d, s) => (
|
|
186
|
-
default:
|
|
187
|
-
e("div", ln,
|
|
185
|
+
return (d, s) => (D(), X(Mt, null, {
|
|
186
|
+
default: U(() => [
|
|
187
|
+
e("div", ln, p(a(m)("inventory.stock.prediction.daysRemaining")), 1)
|
|
188
188
|
]),
|
|
189
189
|
_: 1
|
|
190
190
|
}));
|
|
191
191
|
}
|
|
192
192
|
}), kt = It("stockActions", () => {
|
|
193
|
-
const k =
|
|
193
|
+
const k = z(!1), m = xe(), d = Oe(), s = dt(), j = Se(), w = Ne(), { t: c } = fe();
|
|
194
194
|
async function l() {
|
|
195
195
|
if (m._currentLocation) {
|
|
196
196
|
k.value = !0;
|
|
197
197
|
try {
|
|
198
198
|
await d.readStockBalance(), await d.readProductBalance(), await s.readStockEstimateBalance();
|
|
199
199
|
} catch {
|
|
200
|
-
|
|
200
|
+
j.open({
|
|
201
201
|
title: c("inventory.stock.error.title"),
|
|
202
202
|
message: c("inventory.stock.error.message"),
|
|
203
203
|
type: "error"
|
|
@@ -207,80 +207,80 @@ const an = { class: "fm-typo-en-body-md-400 flex-grow" }, _t = /* @__PURE__ */ m
|
|
|
207
207
|
}
|
|
208
208
|
}
|
|
209
209
|
}
|
|
210
|
-
const h =
|
|
211
|
-
async function B(
|
|
212
|
-
var
|
|
213
|
-
if (!!!((
|
|
214
|
-
|
|
210
|
+
const h = z();
|
|
211
|
+
async function B(x) {
|
|
212
|
+
var S, C, A;
|
|
213
|
+
if (!!!((C = (S = x.convert) == null ? void 0 : S.inventoryBindings) != null && C.length)) {
|
|
214
|
+
w.open({
|
|
215
215
|
title: c("inventory.stock.error.convert.title"),
|
|
216
216
|
message: c("inventory.stock.error.convert.message")
|
|
217
217
|
});
|
|
218
218
|
return;
|
|
219
219
|
}
|
|
220
|
-
const
|
|
221
|
-
maxCount: ((
|
|
222
|
-
sku:
|
|
220
|
+
const n = {
|
|
221
|
+
maxCount: ((A = d.productBalance.find(({ id: I }) => I === x._id)) == null ? void 0 : A.count) || 0,
|
|
222
|
+
sku: x,
|
|
223
223
|
show: !0,
|
|
224
|
-
"onUpdate:show"(
|
|
225
|
-
h.value.show =
|
|
224
|
+
"onUpdate:show"(I) {
|
|
225
|
+
h.value.show = I;
|
|
226
226
|
},
|
|
227
227
|
onSubmitted() {
|
|
228
228
|
l();
|
|
229
229
|
}
|
|
230
230
|
};
|
|
231
|
-
h.value =
|
|
231
|
+
h.value = n;
|
|
232
232
|
}
|
|
233
|
-
const
|
|
234
|
-
async function i(
|
|
235
|
-
const
|
|
236
|
-
stock:
|
|
233
|
+
const b = z();
|
|
234
|
+
async function i(x) {
|
|
235
|
+
const o = {
|
|
236
|
+
stock: x,
|
|
237
237
|
show: !0,
|
|
238
238
|
"onUpdate:show"(t) {
|
|
239
|
-
|
|
239
|
+
b.value.show = t;
|
|
240
240
|
},
|
|
241
241
|
onSubmitted() {
|
|
242
242
|
l();
|
|
243
243
|
}
|
|
244
244
|
};
|
|
245
|
-
|
|
245
|
+
b.value = o;
|
|
246
246
|
}
|
|
247
|
-
const f =
|
|
248
|
-
async function
|
|
249
|
-
const
|
|
250
|
-
sku:
|
|
247
|
+
const f = z();
|
|
248
|
+
async function T(x) {
|
|
249
|
+
const o = {
|
|
250
|
+
sku: x,
|
|
251
251
|
show: !0,
|
|
252
252
|
"onUpdate:show"(t) {
|
|
253
253
|
f.value.show = t;
|
|
254
254
|
}
|
|
255
255
|
};
|
|
256
|
-
f.value =
|
|
256
|
+
f.value = o;
|
|
257
257
|
}
|
|
258
|
-
function
|
|
259
|
-
const t =
|
|
260
|
-
switch (
|
|
261
|
-
case
|
|
262
|
-
|
|
258
|
+
function g(x, o) {
|
|
259
|
+
const t = Pe(o);
|
|
260
|
+
switch (x) {
|
|
261
|
+
case Be.History:
|
|
262
|
+
T(t);
|
|
263
263
|
return;
|
|
264
|
-
case
|
|
264
|
+
case Be.Convert:
|
|
265
265
|
B(t);
|
|
266
266
|
return;
|
|
267
|
-
case
|
|
267
|
+
case Be.Adjust:
|
|
268
268
|
i(t);
|
|
269
269
|
return;
|
|
270
270
|
}
|
|
271
271
|
}
|
|
272
272
|
return {
|
|
273
273
|
fetchStockBalance: l,
|
|
274
|
-
onActionMenu:
|
|
274
|
+
onActionMenu: g,
|
|
275
275
|
stockHistoryProps: f,
|
|
276
|
-
showSkuHistory:
|
|
276
|
+
showSkuHistory: T,
|
|
277
277
|
convertSkuDialogProps: h,
|
|
278
|
-
adjustSkuDialogProps:
|
|
278
|
+
adjustSkuDialogProps: b
|
|
279
279
|
};
|
|
280
280
|
});
|
|
281
281
|
function un() {
|
|
282
|
-
var
|
|
283
|
-
const k =
|
|
282
|
+
var w;
|
|
283
|
+
const k = xe(), m = kt(), d = ft(), { t: s } = fe();
|
|
284
284
|
return {
|
|
285
285
|
columnDefs: [
|
|
286
286
|
{
|
|
@@ -305,17 +305,17 @@ function un() {
|
|
|
305
305
|
amount: l.balance,
|
|
306
306
|
defaultTrackingMeasurement: l.trackingMeasurement ?? void 0
|
|
307
307
|
};
|
|
308
|
-
return
|
|
308
|
+
return ke(_t, h);
|
|
309
309
|
},
|
|
310
310
|
size: 180
|
|
311
311
|
},
|
|
312
|
-
...(
|
|
312
|
+
...(w = d.sessionUser.value) != null && w.role.isAdmin ? [
|
|
313
313
|
{
|
|
314
314
|
accessorKey: "isInactive",
|
|
315
|
-
header: () =>
|
|
315
|
+
header: () => ke(Xe, {}, () => `${s("inventory.ingredient.status.title")}`),
|
|
316
316
|
cell(c) {
|
|
317
317
|
const l = c.row.original.isInactive;
|
|
318
|
-
return
|
|
318
|
+
return ke(
|
|
319
319
|
"span",
|
|
320
320
|
{
|
|
321
321
|
class: [
|
|
@@ -332,20 +332,20 @@ function un() {
|
|
|
332
332
|
{
|
|
333
333
|
accessorKey: "day",
|
|
334
334
|
id: "expireDate",
|
|
335
|
-
header: () =>
|
|
335
|
+
header: () => ke(rn),
|
|
336
336
|
enableSorting: !0,
|
|
337
337
|
sortUndefined: "last",
|
|
338
338
|
cell(c) {
|
|
339
|
-
var f,
|
|
340
|
-
const l = c.row.original.day, h = (f = c.row.original.thresholds) == null ? void 0 : f.low, B = (
|
|
339
|
+
var f, T;
|
|
340
|
+
const l = c.row.original.day, h = (f = c.row.original.thresholds) == null ? void 0 : f.low, B = (T = c.row.original.thresholds) == null ? void 0 : T.mid;
|
|
341
341
|
if (typeof l != "number" || typeof h != "number" || typeof B != "number")
|
|
342
|
-
return
|
|
342
|
+
return ke(Ke, {
|
|
343
343
|
days: l
|
|
344
344
|
});
|
|
345
|
-
const
|
|
346
|
-
return
|
|
345
|
+
const b = l <= h ? Ge.low : l <= B ? Ge.mid : Ge.high;
|
|
346
|
+
return ke(Ke, {
|
|
347
347
|
days: l,
|
|
348
|
-
level:
|
|
348
|
+
level: b
|
|
349
349
|
});
|
|
350
350
|
},
|
|
351
351
|
size: 200
|
|
@@ -406,7 +406,7 @@ const cn = {
|
|
|
406
406
|
function rt(k) {
|
|
407
407
|
return { ...cn, context: k };
|
|
408
408
|
}
|
|
409
|
-
const dn = { class: "flex items-center" }, mn = { class: "fm-typo-en-title-md-800" }, fn = { class: "flex flex-col gap-24 w-full" },
|
|
409
|
+
const dn = { class: "flex items-center" }, mn = { class: "fm-typo-en-title-md-800" }, fn = { class: "flex flex-col gap-24 w-full" }, vn = { class: "flex flex-col gap-8" }, pn = { class: "fm-typo-en-body-lg-600" }, yn = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary flex-grow" }, _n = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-error" }, kn = { class: "flex flex-col p-16 gap-8" }, hn = { class: "flex flex-col gap-4" }, gn = { class: "fm-typo-en-body-md-600 text-fm-color-typo-secondary bg-fm-color-neutral-gray-100 border-b py-12 px-16" }, bn = { class: "grid grid-cols-[auto_100px_100px_48px] xs:grid-cols-[auto_80px_120px_48px] gap-8 px-8 items-center" }, xn = { class: "xs:col-span-3" }, Sn = { class: "flex gap-8" }, wn = /* @__PURE__ */ me({
|
|
410
410
|
__name: "ConvertSkuDialog",
|
|
411
411
|
props: {
|
|
412
412
|
sku: {},
|
|
@@ -415,98 +415,98 @@ const dn = { class: "flex items-center" }, mn = { class: "fm-typo-en-title-md-80
|
|
|
415
415
|
},
|
|
416
416
|
emits: ["update:show", "submitted"],
|
|
417
417
|
setup(k, { expose: m, emit: d }) {
|
|
418
|
-
const s = k,
|
|
418
|
+
const s = k, j = d, w = Ot(), c = Re(), l = we(), h = Se(), { t: B } = fe(), b = z(0), i = z(null), f = Y(() => c.skus), T = Y(
|
|
419
419
|
() => {
|
|
420
|
-
var
|
|
421
|
-
return ((($ = (
|
|
420
|
+
var v, $;
|
|
421
|
+
return ((($ = (v = s.sku) == null ? void 0 : v.convert) == null ? void 0 : $.inventoryBindings) ?? []).filter(
|
|
422
422
|
(G) => G.type === Ze.enum.SKU
|
|
423
423
|
);
|
|
424
424
|
}
|
|
425
|
-
),
|
|
425
|
+
), g = Y({
|
|
426
426
|
get() {
|
|
427
427
|
return !!i.value;
|
|
428
428
|
},
|
|
429
|
-
set(
|
|
430
|
-
|
|
429
|
+
set(v) {
|
|
430
|
+
v ? i.value = Pe(T.value) : (i.value = null, b.value = Math.min(b.value, s.maxCount ?? 0));
|
|
431
431
|
}
|
|
432
|
-
}),
|
|
433
|
-
|
|
434
|
-
|
|
432
|
+
}), x = z(!1);
|
|
433
|
+
$e([() => s.show], ([v]) => {
|
|
434
|
+
v && (b.value = 0);
|
|
435
435
|
});
|
|
436
|
-
function
|
|
437
|
-
|
|
436
|
+
function o() {
|
|
437
|
+
R(s.sku, Te(b.value), i.value);
|
|
438
438
|
}
|
|
439
|
-
function t(
|
|
439
|
+
function t(v) {
|
|
440
440
|
if (i.value)
|
|
441
441
|
return !0;
|
|
442
|
-
const $ = rt(
|
|
442
|
+
const $ = rt(v).isInteger().max(s.maxCount ?? 0).error ?? "";
|
|
443
443
|
return $ || !0;
|
|
444
444
|
}
|
|
445
|
-
function
|
|
445
|
+
function n(v) {
|
|
446
446
|
var E;
|
|
447
447
|
const $ = (E = s.sku.convert) != null && E.measurement ? s.sku.unit.measurements.find((_) => {
|
|
448
448
|
var r;
|
|
449
449
|
return _.id === ((r = s.sku.convert) == null ? void 0 : r.measurement);
|
|
450
|
-
}) ?? null : null, G =
|
|
450
|
+
}) ?? null : null, G = Ce(s.sku.unit, $), P = Et(+v);
|
|
451
451
|
return rt(P).isInteger().max(G).error ? "Precision cannot be more than " + G : !0;
|
|
452
452
|
}
|
|
453
|
-
const
|
|
453
|
+
const S = Y(
|
|
454
454
|
() => {
|
|
455
|
-
var
|
|
456
|
-
return (
|
|
455
|
+
var v, $;
|
|
456
|
+
return (v = s.sku.convert) != null && v.measurement ? ($ = s.sku.unit.measurements.find((G) => {
|
|
457
457
|
var P;
|
|
458
458
|
return G.id === ((P = s.sku.convert) == null ? void 0 : P.measurement);
|
|
459
459
|
})) == null ? void 0 : $.abbrev : s.sku.unit.abbrev;
|
|
460
460
|
}
|
|
461
|
-
),
|
|
462
|
-
var P,
|
|
461
|
+
), C = Y(() => {
|
|
462
|
+
var P, L;
|
|
463
463
|
const $ = Ft({
|
|
464
464
|
bindings: ((P = s.sku.convert) == null ? void 0 : P.inventoryBindings) ?? [],
|
|
465
465
|
skus: c.skus,
|
|
466
466
|
skuGroups: c.skuGroups,
|
|
467
467
|
recipes: c.recipes
|
|
468
468
|
}).inventoryBindings.filter((E) => "success" in E && E.success).map((E) => E).map((E) => E.binding);
|
|
469
|
-
return (
|
|
469
|
+
return (L = i.value ?? $) == null ? void 0 : L.map((E) => {
|
|
470
470
|
var ne, re, J, te, oe;
|
|
471
471
|
const _ = c.skus.find((ie) => ie._id === E.id), r = ((ne = E.measurement) == null ? void 0 : ne.abbrev) ?? ((re = _ == null ? void 0 : _.unit) == null ? void 0 : re.abbrev), M = (J = s.sku.convert) != null && J.measurement ? s.sku.unit.measurements.find((ie) => {
|
|
472
|
-
var
|
|
473
|
-
return ie.id === ((
|
|
474
|
-
}) ?? null : null, V =
|
|
472
|
+
var Fe;
|
|
473
|
+
return ie.id === ((Fe = s.sku.convert) == null ? void 0 : Fe.measurement);
|
|
474
|
+
}) ?? null : null, V = Ce(s.sku.unit, M), u = n(`${b.value}`) === !0 ? _e(
|
|
475
475
|
Tt(
|
|
476
476
|
E.amount,
|
|
477
|
-
|
|
477
|
+
Te(+b.value, V)
|
|
478
478
|
),
|
|
479
479
|
!1
|
|
480
|
-
) : "0",
|
|
480
|
+
) : "0", F = (oe = (te = i.value) == null ? void 0 : te.find((ie) => ie.id === (_ == null ? void 0 : _._id))) == null ? void 0 : oe.amount, N = F ? _e(F, !1) : null;
|
|
481
481
|
return {
|
|
482
482
|
sku: _,
|
|
483
|
-
convertAmount:
|
|
483
|
+
convertAmount: N ?? u,
|
|
484
484
|
abbrev: r
|
|
485
485
|
};
|
|
486
486
|
});
|
|
487
|
-
}),
|
|
487
|
+
}), A = z();
|
|
488
488
|
m({
|
|
489
489
|
validateInputs: () => {
|
|
490
|
-
var
|
|
491
|
-
($ = (
|
|
490
|
+
var v, $;
|
|
491
|
+
($ = (v = A.value) == null ? void 0 : v.validateInputs) == null || $.call(v);
|
|
492
492
|
},
|
|
493
493
|
resetInputsValidation: () => {
|
|
494
|
-
var
|
|
495
|
-
($ = (
|
|
494
|
+
var v, $;
|
|
495
|
+
($ = (v = A.value) == null ? void 0 : v.resetInputsValidation) == null || $.call(v);
|
|
496
496
|
},
|
|
497
497
|
resetInputs: () => {
|
|
498
|
-
var
|
|
499
|
-
($ = (
|
|
498
|
+
var v, $;
|
|
499
|
+
($ = (v = A.value) == null ? void 0 : v.resetInputs) == null || $.call(v);
|
|
500
500
|
}
|
|
501
501
|
});
|
|
502
|
-
const
|
|
503
|
-
async function
|
|
504
|
-
|
|
502
|
+
const I = Ye(s, "show");
|
|
503
|
+
async function R(v, $, G) {
|
|
504
|
+
x.value = !0;
|
|
505
505
|
try {
|
|
506
506
|
await l.convertSku({
|
|
507
507
|
conversions: [
|
|
508
508
|
{
|
|
509
|
-
doc:
|
|
509
|
+
doc: v,
|
|
510
510
|
amount: $,
|
|
511
511
|
overrides: G == null ? void 0 : G.map((P) => ({
|
|
512
512
|
...P,
|
|
@@ -518,176 +518,176 @@ const dn = { class: "flex items-center" }, mn = { class: "fm-typo-en-title-md-80
|
|
|
518
518
|
}))
|
|
519
519
|
}
|
|
520
520
|
]
|
|
521
|
-
}),
|
|
521
|
+
}), j("update:show", !1), j("submitted");
|
|
522
522
|
} catch (P) {
|
|
523
523
|
h.open({
|
|
524
524
|
title: "Something went wrong",
|
|
525
|
-
message: `Cannot convert ${
|
|
525
|
+
message: `Cannot convert ${v.name}. Please try again.`,
|
|
526
526
|
type: "error"
|
|
527
|
-
}), console.error("error at converting stock amount",
|
|
527
|
+
}), console.error("error at converting stock amount", v, $, P);
|
|
528
528
|
} finally {
|
|
529
|
-
|
|
529
|
+
x.value = !1;
|
|
530
530
|
}
|
|
531
531
|
}
|
|
532
|
-
function
|
|
532
|
+
function K(v, $, G) {
|
|
533
533
|
const P = +$;
|
|
534
|
-
let
|
|
535
|
-
$.length > 0 && isFinite(P) ?
|
|
534
|
+
let L = G;
|
|
535
|
+
$.length > 0 && isFinite(P) ? L = G.map((E) => (E.id !== v || (E.amount = be(P)), E)) : L = G.map((E) => (E.id !== v || (E.amount = { amount: 0, precision: 0 }), E)), i.value = L;
|
|
536
536
|
}
|
|
537
|
-
function
|
|
538
|
-
const $ = f.value.find((G) => G._id ===
|
|
537
|
+
function O(v) {
|
|
538
|
+
const $ = f.value.find((G) => G._id === v);
|
|
539
539
|
return $ ? mt($.unit, !0) : [];
|
|
540
540
|
}
|
|
541
|
-
function Z(
|
|
542
|
-
const G =
|
|
541
|
+
function Z(v, $) {
|
|
542
|
+
const G = O(v), P = G.find((L) => L.value === $) ?? G.find((L) => L.value === null);
|
|
543
543
|
return P ? {
|
|
544
544
|
...P,
|
|
545
545
|
label: P.abbrev
|
|
546
546
|
} : null;
|
|
547
547
|
}
|
|
548
|
-
function
|
|
548
|
+
function q(v, $, G) {
|
|
549
549
|
let P;
|
|
550
550
|
if ($ === null)
|
|
551
|
-
P = G.map((
|
|
551
|
+
P = G.map((L) => (L.id !== v || (L.measurement = null), L)) ?? [];
|
|
552
552
|
else {
|
|
553
|
-
const
|
|
553
|
+
const L = f.value.find((E) => E._id === v);
|
|
554
554
|
P = G.map((E) => {
|
|
555
555
|
var _, r;
|
|
556
|
-
return E.id !==
|
|
556
|
+
return E.id !== v || (E.measurement = (r = (_ = L == null ? void 0 : L.unit) == null ? void 0 : _.measurements) == null ? void 0 : r.find((M) => M.id === $)), E;
|
|
557
557
|
}) ?? [];
|
|
558
558
|
}
|
|
559
559
|
i.value = P;
|
|
560
560
|
}
|
|
561
|
-
function ue(
|
|
562
|
-
const G = $.filter((P) => P.id !==
|
|
561
|
+
function ue(v, $) {
|
|
562
|
+
const G = $.filter((P) => P.id !== v);
|
|
563
563
|
i.value = G;
|
|
564
564
|
}
|
|
565
565
|
function ee() {
|
|
566
|
-
const
|
|
566
|
+
const v = (i.value ?? []).map(($) => ({
|
|
567
567
|
...$,
|
|
568
568
|
type: Ze.enum.SKU
|
|
569
569
|
}));
|
|
570
|
-
|
|
571
|
-
|
|
570
|
+
w.promptIngredientsBinding(
|
|
571
|
+
v,
|
|
572
572
|
($) => i.value = $,
|
|
573
573
|
s.sku._id
|
|
574
574
|
);
|
|
575
575
|
}
|
|
576
|
-
return
|
|
576
|
+
return $e(
|
|
577
577
|
() => s.show,
|
|
578
|
-
(
|
|
579
|
-
|
|
578
|
+
(v) => {
|
|
579
|
+
v || (i.value = null, b.value = 0);
|
|
580
580
|
}
|
|
581
|
-
), (
|
|
582
|
-
const G =
|
|
583
|
-
return
|
|
581
|
+
), (v, $) => {
|
|
582
|
+
const G = H("FmTextField"), P = H("FmForm"), L = H("FmCard"), E = H("FmSwitch"), _ = H("FmFormGroup"), r = H("FmSelect"), M = H("FmButton"), V = H("FmSideSheet");
|
|
583
|
+
return D(), X(V, {
|
|
584
584
|
"dismiss-away": "",
|
|
585
|
-
modelValue: a(
|
|
586
|
-
"onUpdate:modelValue": $[3] || ($[3] = (u) =>
|
|
585
|
+
modelValue: a(I),
|
|
586
|
+
"onUpdate:modelValue": $[3] || ($[3] = (u) => Ee(I) ? I.value = u : null),
|
|
587
587
|
"max-width": 500
|
|
588
588
|
}, {
|
|
589
|
-
"side-sheet-header":
|
|
589
|
+
"side-sheet-header": U(() => [
|
|
590
590
|
e("div", dn, [
|
|
591
|
-
e("div", mn,
|
|
591
|
+
e("div", mn, p(a(B)("inventory.stock.convert.title", { name: v.sku.name })), 1)
|
|
592
592
|
])
|
|
593
593
|
]),
|
|
594
|
-
default:
|
|
594
|
+
default: U(() => [
|
|
595
595
|
e("div", fn, [
|
|
596
596
|
y(P, {
|
|
597
597
|
ref_key: "formRef",
|
|
598
|
-
ref:
|
|
599
|
-
onValidationSuccess:
|
|
598
|
+
ref: A,
|
|
599
|
+
onValidationSuccess: o
|
|
600
600
|
}, {
|
|
601
|
-
default:
|
|
601
|
+
default: U(() => [
|
|
602
602
|
y(G, {
|
|
603
|
-
disabled:
|
|
604
|
-
"model-value":
|
|
605
|
-
"onUpdate:modelValue": $[0] || ($[0] = (u) =>
|
|
603
|
+
disabled: x.value,
|
|
604
|
+
"model-value": b.value,
|
|
605
|
+
"onUpdate:modelValue": $[0] || ($[0] = (u) => b.value = u),
|
|
606
606
|
label: a(B)("inventory.stock.convert.amount"),
|
|
607
|
-
rules: [t,
|
|
608
|
-
"append-text":
|
|
609
|
-
"helper-text": i.value ? void 0 : `Max ${
|
|
607
|
+
rules: [t, n, a(He)(0)],
|
|
608
|
+
"append-text": S.value,
|
|
609
|
+
"helper-text": i.value ? void 0 : `Max ${v.maxCount} ${S.value}`
|
|
610
610
|
}, null, 8, ["disabled", "model-value", "label", "rules", "append-text", "helper-text"])
|
|
611
611
|
]),
|
|
612
612
|
_: 1
|
|
613
613
|
}, 512),
|
|
614
|
-
y(
|
|
614
|
+
y(L, {
|
|
615
615
|
variant: "outlined",
|
|
616
616
|
class: "p-16"
|
|
617
617
|
}, {
|
|
618
|
-
default:
|
|
619
|
-
e("div",
|
|
620
|
-
e("div",
|
|
621
|
-
(
|
|
622
|
-
var
|
|
623
|
-
return
|
|
624
|
-
key: (
|
|
618
|
+
default: U(() => [
|
|
619
|
+
e("div", vn, [
|
|
620
|
+
e("div", pn, p(a(B)("inventory.stock.convert.deductionSummary")), 1),
|
|
621
|
+
(D(!0), W(le, null, ce(C.value, (u) => {
|
|
622
|
+
var F, N;
|
|
623
|
+
return D(), W("div", {
|
|
624
|
+
key: (F = u.sku) == null ? void 0 : F._id,
|
|
625
625
|
class: "flex items-center"
|
|
626
626
|
}, [
|
|
627
|
-
e("div", yn,
|
|
628
|
-
e("div", _n, " -" +
|
|
627
|
+
e("div", yn, p((N = u.sku) == null ? void 0 : N.name), 1),
|
|
628
|
+
e("div", _n, " -" + p(u.convertAmount) + " " + p(u.abbrev), 1)
|
|
629
629
|
]);
|
|
630
630
|
}), 128))
|
|
631
631
|
])
|
|
632
632
|
]),
|
|
633
633
|
_: 1
|
|
634
634
|
}),
|
|
635
|
-
y(
|
|
636
|
-
default:
|
|
635
|
+
y(L, { variant: "outlined" }, {
|
|
636
|
+
default: U(() => [
|
|
637
637
|
e("div", kn, [
|
|
638
638
|
y(E, {
|
|
639
639
|
value: "",
|
|
640
|
-
modelValue:
|
|
641
|
-
"onUpdate:modelValue": $[1] || ($[1] = (u) =>
|
|
640
|
+
modelValue: g.value,
|
|
641
|
+
"onUpdate:modelValue": $[1] || ($[1] = (u) => g.value = u),
|
|
642
642
|
label: a(B)("inventory.stock.convert.overrideDeduction"),
|
|
643
643
|
"label-placement": "right"
|
|
644
644
|
}, null, 8, ["modelValue", "label"]),
|
|
645
|
-
|
|
645
|
+
g.value ? (D(), W(le, { key: 0 }, [
|
|
646
646
|
y(_, {
|
|
647
647
|
modelValue: i.value,
|
|
648
|
-
rules: [a(
|
|
648
|
+
rules: [a(Ht)(1, "Must have at least one ingredient binding")]
|
|
649
649
|
}, null, 8, ["modelValue", "rules"]),
|
|
650
650
|
e("div", hn, [
|
|
651
|
-
e("div", gn,
|
|
652
|
-
(
|
|
651
|
+
e("div", gn, p(a(B)("inventory.stock.convert.ingredients")), 1),
|
|
652
|
+
(D(!0), W(le, null, ce(i.value, (u) => (D(), X(_, {
|
|
653
653
|
key: u.id,
|
|
654
|
-
disabled:
|
|
655
|
-
modelValue: +a(
|
|
654
|
+
disabled: x.value,
|
|
655
|
+
modelValue: +a(_e)(u.amount ?? { amount: 1, precision: 0 }),
|
|
656
656
|
rules: [
|
|
657
|
-
a(
|
|
658
|
-
f.value.find((
|
|
657
|
+
a(Ut)(
|
|
658
|
+
f.value.find((F) => F._id === u.id).unit,
|
|
659
659
|
u.measurement
|
|
660
660
|
),
|
|
661
|
-
a(
|
|
661
|
+
a(He)(0)
|
|
662
662
|
]
|
|
663
663
|
}, {
|
|
664
|
-
default:
|
|
665
|
-
var
|
|
664
|
+
default: U(({ invalid: F }) => {
|
|
665
|
+
var N, ne, re;
|
|
666
666
|
return [
|
|
667
667
|
e("div", bn, [
|
|
668
|
-
e("div", xn,
|
|
668
|
+
e("div", xn, p((N = f.value.find((J) => J._id === u.id)) == null ? void 0 : N.name), 1),
|
|
669
669
|
y(G, {
|
|
670
670
|
class: "xs:col-span-2",
|
|
671
|
-
disabled:
|
|
672
|
-
modelValue: +a(
|
|
671
|
+
disabled: x.value,
|
|
672
|
+
modelValue: +a(_e)(
|
|
673
673
|
u.amount ?? { amount: 1, precision: 0 }
|
|
674
674
|
),
|
|
675
|
-
"onUpdate:modelValue": (J) =>
|
|
676
|
-
invalid:
|
|
675
|
+
"onUpdate:modelValue": (J) => K(u.id, J, i.value ?? []),
|
|
676
|
+
invalid: F
|
|
677
677
|
}, null, 8, ["disabled", "modelValue", "onUpdate:modelValue", "invalid"]),
|
|
678
678
|
y(r, {
|
|
679
|
-
disabled:
|
|
679
|
+
disabled: x.value,
|
|
680
680
|
class: "translate-y-[2px]",
|
|
681
|
-
items:
|
|
681
|
+
items: O(u.id),
|
|
682
682
|
"model-value": (re = Z(u.id, (ne = u.measurement) == null ? void 0 : ne.id)) == null ? void 0 : re.value,
|
|
683
|
-
"onUpdate:modelValue": (J) =>
|
|
684
|
-
invalid:
|
|
683
|
+
"onUpdate:modelValue": (J) => q(u.id, J, i.value ?? []),
|
|
684
|
+
invalid: F
|
|
685
685
|
}, {
|
|
686
|
-
"helper-text":
|
|
686
|
+
"helper-text": U(() => $[4] || ($[4] = [])),
|
|
687
687
|
_: 2
|
|
688
688
|
}, 1032, ["disabled", "items", "model-value", "onUpdate:modelValue", "invalid"]),
|
|
689
689
|
y(M, {
|
|
690
|
-
disabled:
|
|
690
|
+
disabled: x.value,
|
|
691
691
|
type: "button",
|
|
692
692
|
variant: "tertiary",
|
|
693
693
|
icon: "delete",
|
|
@@ -714,14 +714,14 @@ const dn = { class: "flex items-center" }, mn = { class: "fm-typo-en-title-md-80
|
|
|
714
714
|
})
|
|
715
715
|
])
|
|
716
716
|
]),
|
|
717
|
-
"side-sheet-footer":
|
|
717
|
+
"side-sheet-footer": U(() => [
|
|
718
718
|
e("div", Sn, [
|
|
719
719
|
y(M, {
|
|
720
|
-
loading:
|
|
720
|
+
loading: x.value,
|
|
721
721
|
label: a(B)("inventory.stock.convert.convertButton"),
|
|
722
722
|
onClick: $[2] || ($[2] = (u) => {
|
|
723
|
-
var
|
|
724
|
-
return (
|
|
723
|
+
var F, N;
|
|
724
|
+
return (N = (F = A.value) == null ? void 0 : F.validateInputs) == null ? void 0 : N.call(F);
|
|
725
725
|
})
|
|
726
726
|
}, null, 8, ["loading", "label"])
|
|
727
727
|
])
|
|
@@ -731,29 +731,29 @@ const dn = { class: "flex items-center" }, mn = { class: "fm-typo-en-title-md-80
|
|
|
731
731
|
};
|
|
732
732
|
}
|
|
733
733
|
});
|
|
734
|
-
function
|
|
735
|
-
const d =
|
|
734
|
+
function je(k, m) {
|
|
735
|
+
const d = Te(k, m);
|
|
736
736
|
return { ...d, amount: -d.amount };
|
|
737
737
|
}
|
|
738
738
|
function it(k, m) {
|
|
739
|
-
return
|
|
739
|
+
return Te(Math.abs(k), m);
|
|
740
740
|
}
|
|
741
|
-
const
|
|
741
|
+
const We = {
|
|
742
742
|
[ae.enum.DAMAGE]: {
|
|
743
743
|
label: "Damage",
|
|
744
|
-
toAdjustmentAmount:
|
|
744
|
+
toAdjustmentAmount: je
|
|
745
745
|
},
|
|
746
746
|
[ae.enum.WASTAGE]: {
|
|
747
747
|
label: "Wastage",
|
|
748
|
-
toAdjustmentAmount:
|
|
748
|
+
toAdjustmentAmount: je
|
|
749
749
|
},
|
|
750
750
|
[ae.enum.THEFT]: {
|
|
751
751
|
label: "Theft",
|
|
752
|
-
toAdjustmentAmount:
|
|
752
|
+
toAdjustmentAmount: je
|
|
753
753
|
},
|
|
754
754
|
[ae.enum.LOSE]: {
|
|
755
755
|
label: "Lose",
|
|
756
|
-
toAdjustmentAmount:
|
|
756
|
+
toAdjustmentAmount: je
|
|
757
757
|
},
|
|
758
758
|
[ae.enum.EXTRA]: {
|
|
759
759
|
label: "Extra",
|
|
@@ -763,7 +763,7 @@ const Ge = {
|
|
|
763
763
|
label: "Purchase",
|
|
764
764
|
toAdjustmentAmount: it
|
|
765
765
|
}
|
|
766
|
-
}, Fn = { class: "col-span-2 flex" }, An = { class: "flex-1" }, $n = { class: "fm-typo-en-body-lg-600" }, Vn = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Cn = { class: "col-span-2 flex flex-col gap-4" },
|
|
766
|
+
}, Fn = { class: "col-span-2 flex" }, An = { class: "flex-1" }, $n = { class: "fm-typo-en-body-lg-600" }, Vn = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Cn = { class: "col-span-2 flex flex-col gap-4" }, Dn = { class: "flex gap-4 text-fm-color-typo-primary fm-typo-en-body-lg-600" }, ht = /* @__PURE__ */ me({
|
|
767
767
|
__name: "AdjustedItemForm",
|
|
768
768
|
props: {
|
|
769
769
|
modelValue: {},
|
|
@@ -771,140 +771,140 @@ const Ge = {
|
|
|
771
771
|
},
|
|
772
772
|
emits: ["update:modelValue", "click:delete"],
|
|
773
773
|
setup(k, { emit: m }) {
|
|
774
|
-
const d = k, s = m, { t:
|
|
775
|
-
() => Object.keys(
|
|
774
|
+
const d = k, s = m, { t: j } = fe(), w = Oe(), c = Y(
|
|
775
|
+
() => Object.keys(We).map((t) => ({
|
|
776
776
|
label: At(t),
|
|
777
777
|
value: t
|
|
778
778
|
}))
|
|
779
|
-
), l =
|
|
779
|
+
), l = Y(() => mt(d.modelValue.doc.unit, !0)), h = Y({
|
|
780
780
|
get() {
|
|
781
781
|
return d.modelValue.type ?? ae.enum.PURCHASE;
|
|
782
782
|
},
|
|
783
783
|
set(t) {
|
|
784
|
-
const
|
|
784
|
+
const n = {
|
|
785
785
|
...d.modelValue
|
|
786
786
|
};
|
|
787
|
-
|
|
788
|
-
const
|
|
789
|
-
|
|
790
|
-
+
|
|
791
|
-
|
|
792
|
-
), s("update:modelValue",
|
|
787
|
+
n.type = t;
|
|
788
|
+
const S = ot(d.modelValue.amount);
|
|
789
|
+
n.amount = We[n.type].toAdjustmentAmount(
|
|
790
|
+
+_e(S),
|
|
791
|
+
S.precision
|
|
792
|
+
), s("update:modelValue", n);
|
|
793
793
|
}
|
|
794
|
-
}), B =
|
|
794
|
+
}), B = Y({
|
|
795
795
|
get() {
|
|
796
796
|
const t = ot(d.modelValue.amount);
|
|
797
|
-
return +
|
|
797
|
+
return +_e(t);
|
|
798
798
|
},
|
|
799
799
|
set(t) {
|
|
800
|
-
const
|
|
800
|
+
const n = {
|
|
801
801
|
...d.modelValue
|
|
802
|
-
},
|
|
803
|
-
|
|
802
|
+
}, S = be(t);
|
|
803
|
+
n.amount = We[h.value].toAdjustmentAmount(
|
|
804
804
|
t,
|
|
805
|
-
|
|
806
|
-
), s("update:modelValue",
|
|
805
|
+
S.precision
|
|
806
|
+
), s("update:modelValue", n);
|
|
807
807
|
}
|
|
808
|
-
}),
|
|
808
|
+
}), b = Y({
|
|
809
809
|
get() {
|
|
810
810
|
var t;
|
|
811
811
|
return ((t = d.modelValue.measurement) == null ? void 0 : t.id) ?? null;
|
|
812
812
|
},
|
|
813
813
|
set(t) {
|
|
814
|
-
var
|
|
815
|
-
const
|
|
814
|
+
var S, C;
|
|
815
|
+
const n = {
|
|
816
816
|
...d.modelValue
|
|
817
817
|
};
|
|
818
|
-
|
|
818
|
+
n.measurement = ((C = (S = d.modelValue.doc.unit) == null ? void 0 : S.measurements) == null ? void 0 : C.find((A) => A.id === t)) ?? null, s("update:modelValue", n);
|
|
819
819
|
}
|
|
820
|
-
}), i =
|
|
820
|
+
}), i = Y({
|
|
821
821
|
get() {
|
|
822
822
|
return d.modelValue.remark ?? "";
|
|
823
823
|
},
|
|
824
824
|
set(t) {
|
|
825
|
-
const
|
|
825
|
+
const n = {
|
|
826
826
|
...d.modelValue
|
|
827
827
|
};
|
|
828
|
-
|
|
828
|
+
n.remark = t, s("update:modelValue", n);
|
|
829
829
|
}
|
|
830
|
-
}), f =
|
|
831
|
-
var
|
|
832
|
-
const t = (
|
|
830
|
+
}), f = Y(() => {
|
|
831
|
+
var n;
|
|
832
|
+
const t = (n = w.stockBalance.skus) == null ? void 0 : n.find((S) => S.id === d.modelValue.doc._id);
|
|
833
833
|
return (t == null ? void 0 : t.balance) ?? { amount: 0, precision: 0 };
|
|
834
|
-
}),
|
|
835
|
-
const t = d.modelValue.amount,
|
|
836
|
-
return
|
|
837
|
-
}),
|
|
838
|
-
() => Je(f.value,
|
|
839
|
-
),
|
|
840
|
-
() =>
|
|
841
|
-
),
|
|
842
|
-
return (t,
|
|
843
|
-
const
|
|
844
|
-
return
|
|
834
|
+
}), T = Y(() => {
|
|
835
|
+
const t = d.modelValue.amount, n = d.modelValue.measurement;
|
|
836
|
+
return n ? vt(t, n.conversion) : t;
|
|
837
|
+
}), g = Y(
|
|
838
|
+
() => Je(f.value, T.value)
|
|
839
|
+
), x = Y(
|
|
840
|
+
() => Ve(g.value, d.modelValue.doc.unit)
|
|
841
|
+
), o = Y(() => T.value.amount < 0);
|
|
842
|
+
return (t, n) => {
|
|
843
|
+
const S = H("FmButton"), C = H("FmSelect"), A = H("FmTextarea"), I = H("FmCard");
|
|
844
|
+
return D(), X(I, {
|
|
845
845
|
variant: "outlined",
|
|
846
846
|
class: "grid grid-cols-2 gap-8 p-16"
|
|
847
847
|
}, {
|
|
848
|
-
default:
|
|
848
|
+
default: U(() => [
|
|
849
849
|
e("div", Fn, [
|
|
850
850
|
e("div", An, [
|
|
851
|
-
e("div", $n,
|
|
852
|
-
e("div", Vn,
|
|
851
|
+
e("div", $n, p(t.modelValue.doc.name), 1),
|
|
852
|
+
e("div", Vn, p(t.modelValue.doc.code), 1)
|
|
853
853
|
]),
|
|
854
|
-
y(
|
|
854
|
+
y(S, {
|
|
855
855
|
variant: "tertiary",
|
|
856
856
|
"prepend-icon": "delete",
|
|
857
|
-
onClick:
|
|
857
|
+
onClick: n[0] || (n[0] = (R) => s("click:delete"))
|
|
858
858
|
})
|
|
859
859
|
]),
|
|
860
|
-
y(
|
|
860
|
+
y(C, {
|
|
861
861
|
disabled: t.disabled,
|
|
862
862
|
class: "col-span-2",
|
|
863
863
|
label: "Type",
|
|
864
864
|
items: c.value,
|
|
865
865
|
modelValue: h.value,
|
|
866
|
-
"onUpdate:modelValue":
|
|
866
|
+
"onUpdate:modelValue": n[1] || (n[1] = (R) => h.value = R),
|
|
867
867
|
rules: [a(Pt)()],
|
|
868
868
|
"label-mark": "required"
|
|
869
869
|
}, null, 8, ["disabled", "items", "modelValue", "rules"]),
|
|
870
870
|
y(Nt, {
|
|
871
871
|
disabled: t.disabled,
|
|
872
872
|
label: "Amount",
|
|
873
|
-
step: +a(
|
|
873
|
+
step: +a(_e)({
|
|
874
874
|
amount: 1,
|
|
875
|
-
precision: a(
|
|
875
|
+
precision: a(Ce)(t.modelValue.doc.unit, t.modelValue.measurement)
|
|
876
876
|
}),
|
|
877
877
|
modelValue: B.value,
|
|
878
|
-
"onUpdate:modelValue":
|
|
879
|
-
rules: [a(
|
|
878
|
+
"onUpdate:modelValue": n[2] || (n[2] = (R) => B.value = R),
|
|
879
|
+
rules: [a(He)(0)]
|
|
880
880
|
}, null, 8, ["disabled", "step", "modelValue", "rules"]),
|
|
881
|
-
y(
|
|
881
|
+
y(C, {
|
|
882
882
|
disabled: t.disabled,
|
|
883
883
|
label: "Unit",
|
|
884
884
|
items: l.value,
|
|
885
|
-
modelValue:
|
|
886
|
-
"onUpdate:modelValue":
|
|
885
|
+
modelValue: b.value,
|
|
886
|
+
"onUpdate:modelValue": n[3] || (n[3] = (R) => b.value = R)
|
|
887
887
|
}, null, 8, ["disabled", "items", "modelValue"]),
|
|
888
|
-
y(
|
|
888
|
+
y(A, {
|
|
889
889
|
class: "col-span-2",
|
|
890
890
|
disabled: t.disabled,
|
|
891
891
|
label: "Remark",
|
|
892
892
|
modelValue: i.value,
|
|
893
|
-
"onUpdate:modelValue":
|
|
893
|
+
"onUpdate:modelValue": n[4] || (n[4] = (R) => i.value = R),
|
|
894
894
|
"label-mark": "optional"
|
|
895
895
|
}, null, 8, ["disabled", "modelValue"]),
|
|
896
896
|
e("div", Cn, [
|
|
897
|
-
e("div",
|
|
897
|
+
e("div", Dn, p(a(j)("inventory.stock.stock_adjustment.stockAfter")), 1),
|
|
898
898
|
e("div", {
|
|
899
|
-
class:
|
|
900
|
-
},
|
|
899
|
+
class: ge(["fm-typo-en-body-lg-600", o.value ? "text-red-700" : "text-green-700"])
|
|
900
|
+
}, p(x.value), 3)
|
|
901
901
|
])
|
|
902
902
|
]),
|
|
903
903
|
_: 1
|
|
904
904
|
});
|
|
905
905
|
};
|
|
906
906
|
}
|
|
907
|
-
}),
|
|
907
|
+
}), jn = { class: "flex items-center" }, Mn = { class: "fm-typo-en-title-md-800" }, Bn = { class: "flex items-center" }, In = { class: "fm-typo-en-title-sm-800 flex-1" }, Tn = { class: "flex gap-8" }, Hn = /* @__PURE__ */ me({
|
|
908
908
|
__name: "AdjustSkuDialog",
|
|
909
909
|
props: {
|
|
910
910
|
stock: {},
|
|
@@ -912,26 +912,26 @@ const Ge = {
|
|
|
912
912
|
},
|
|
913
913
|
emits: ["update:show", "submitted"],
|
|
914
914
|
setup(k, { expose: m, emit: d }) {
|
|
915
|
-
const s = k,
|
|
915
|
+
const s = k, j = d, w = Re(), c = Ne(), l = we(), h = Se(), B = z(!1), { t: b } = fe();
|
|
916
916
|
function i() {
|
|
917
|
-
|
|
917
|
+
x(Pe(g));
|
|
918
918
|
}
|
|
919
|
-
const f =
|
|
919
|
+
const f = z();
|
|
920
920
|
m({
|
|
921
921
|
validateInputs: () => {
|
|
922
|
-
var
|
|
923
|
-
(
|
|
922
|
+
var n, S;
|
|
923
|
+
(S = (n = f.value) == null ? void 0 : n.validateInputs) == null || S.call(n);
|
|
924
924
|
},
|
|
925
925
|
resetInputsValidation: () => {
|
|
926
|
-
var
|
|
927
|
-
(
|
|
926
|
+
var n, S;
|
|
927
|
+
(S = (n = f.value) == null ? void 0 : n.resetInputsValidation) == null || S.call(n);
|
|
928
928
|
},
|
|
929
929
|
resetInputs: () => {
|
|
930
|
-
var
|
|
931
|
-
(
|
|
930
|
+
var n, S;
|
|
931
|
+
(S = (n = f.value) == null ? void 0 : n.resetInputs) == null || S.call(n);
|
|
932
932
|
}
|
|
933
933
|
});
|
|
934
|
-
const
|
|
934
|
+
const T = Ye(s, "show"), g = ut({
|
|
935
935
|
remark: "",
|
|
936
936
|
adjustments: [
|
|
937
937
|
{
|
|
@@ -940,58 +940,58 @@ const Ge = {
|
|
|
940
940
|
doc: s.stock,
|
|
941
941
|
measurement: null,
|
|
942
942
|
remark: "",
|
|
943
|
-
amount:
|
|
943
|
+
amount: be(1)
|
|
944
944
|
}
|
|
945
945
|
]
|
|
946
946
|
});
|
|
947
|
-
|
|
948
|
-
|
|
947
|
+
$e([() => s.show], ([n]) => {
|
|
948
|
+
n && (g.remark = "", g.adjustments = [
|
|
949
949
|
{
|
|
950
950
|
id: `sku_${(/* @__PURE__ */ new Date()).toISOString()}_${Math.random().toString(16).slice(2, 8)}`,
|
|
951
951
|
type: ae.enum.PURCHASE,
|
|
952
952
|
doc: s.stock,
|
|
953
953
|
measurement: null,
|
|
954
954
|
remark: "",
|
|
955
|
-
amount:
|
|
955
|
+
amount: be(1)
|
|
956
956
|
}
|
|
957
957
|
]);
|
|
958
958
|
});
|
|
959
|
-
async function
|
|
959
|
+
async function x(n) {
|
|
960
960
|
B.value = !0;
|
|
961
961
|
try {
|
|
962
962
|
await l.adjustSku({
|
|
963
|
-
remark:
|
|
964
|
-
adjustments:
|
|
965
|
-
id:
|
|
966
|
-
amount:
|
|
967
|
-
measurement:
|
|
968
|
-
remark:
|
|
969
|
-
doc:
|
|
970
|
-
type:
|
|
963
|
+
remark: n.remark,
|
|
964
|
+
adjustments: n.adjustments.map(({ doc: S, remark: C, type: A, amount: I, measurement: R }) => ({
|
|
965
|
+
id: S._id,
|
|
966
|
+
amount: I,
|
|
967
|
+
measurement: R,
|
|
968
|
+
remark: C,
|
|
969
|
+
doc: S,
|
|
970
|
+
type: A
|
|
971
971
|
}))
|
|
972
|
-
}),
|
|
973
|
-
} catch (
|
|
972
|
+
}), j("update:show", !1), j("submitted");
|
|
973
|
+
} catch (S) {
|
|
974
974
|
h.open({
|
|
975
|
-
title:
|
|
976
|
-
message:
|
|
975
|
+
title: b("inventory.stock.adjust.error.title"),
|
|
976
|
+
message: b("inventory.stock.adjust.error.message"),
|
|
977
977
|
type: "error"
|
|
978
|
-
}), console.log("error on adjust ingredients",
|
|
978
|
+
}), console.log("error on adjust ingredients", n, S);
|
|
979
979
|
} finally {
|
|
980
980
|
B.value = !1;
|
|
981
981
|
}
|
|
982
982
|
}
|
|
983
|
-
function
|
|
984
|
-
const
|
|
985
|
-
label:
|
|
986
|
-
sublabel:
|
|
987
|
-
value:
|
|
988
|
-
})),
|
|
983
|
+
function o() {
|
|
984
|
+
const n = w.skus.map((C) => ({
|
|
985
|
+
label: C.name,
|
|
986
|
+
sublabel: C.code,
|
|
987
|
+
value: C._id
|
|
988
|
+
})), S = n.filter((C) => g.adjustments.find((A) => A.doc._id === C.value)).map((C) => C.value);
|
|
989
989
|
c.open({
|
|
990
990
|
title: "Select ingredients",
|
|
991
|
-
contentComponent:
|
|
991
|
+
contentComponent: pt,
|
|
992
992
|
contentComponentProps: {
|
|
993
|
-
items:
|
|
994
|
-
modelValue:
|
|
993
|
+
items: n,
|
|
994
|
+
modelValue: S
|
|
995
995
|
},
|
|
996
996
|
overlay: !0,
|
|
997
997
|
closeButton: !0,
|
|
@@ -1005,75 +1005,75 @@ const Ge = {
|
|
|
1005
1005
|
close: !0,
|
|
1006
1006
|
variant: "tertiary"
|
|
1007
1007
|
}
|
|
1008
|
-
}).onPrimary((
|
|
1009
|
-
|
|
1010
|
-
(
|
|
1008
|
+
}).onPrimary((C) => {
|
|
1009
|
+
g.adjustments = C.map(
|
|
1010
|
+
(A) => g.adjustments.find((I) => I.doc._id === A) ?? {
|
|
1011
1011
|
id: `sku_${(/* @__PURE__ */ new Date()).toISOString()}_${Math.random().toString(16).slice(2, 8)}`,
|
|
1012
1012
|
type: ae.enum.PURCHASE,
|
|
1013
|
-
doc:
|
|
1013
|
+
doc: w.skus.find((I) => I._id === A),
|
|
1014
1014
|
measurement: null,
|
|
1015
1015
|
remark: "",
|
|
1016
|
-
amount:
|
|
1016
|
+
amount: be(1)
|
|
1017
1017
|
}
|
|
1018
1018
|
);
|
|
1019
1019
|
});
|
|
1020
1020
|
}
|
|
1021
|
-
function t(
|
|
1022
|
-
|
|
1021
|
+
function t(n) {
|
|
1022
|
+
g.adjustments.splice(n, 1);
|
|
1023
1023
|
}
|
|
1024
|
-
return (
|
|
1025
|
-
const
|
|
1026
|
-
return
|
|
1027
|
-
modelValue: a(
|
|
1028
|
-
"onUpdate:modelValue":
|
|
1024
|
+
return (n, S) => {
|
|
1025
|
+
const C = H("FmTextarea"), A = H("FmButton"), I = H("FmForm"), R = H("FmSideSheet");
|
|
1026
|
+
return D(), X(R, {
|
|
1027
|
+
modelValue: a(T),
|
|
1028
|
+
"onUpdate:modelValue": S[2] || (S[2] = (K) => Ee(T) ? T.value = K : null),
|
|
1029
1029
|
"dismiss-away": "",
|
|
1030
1030
|
"max-width": 500
|
|
1031
1031
|
}, {
|
|
1032
|
-
"side-sheet-header":
|
|
1033
|
-
e("div",
|
|
1034
|
-
e("div", Mn,
|
|
1032
|
+
"side-sheet-header": U(() => [
|
|
1033
|
+
e("div", jn, [
|
|
1034
|
+
e("div", Mn, p(a(b)("inventory.stock.adjust.title")), 1)
|
|
1035
1035
|
])
|
|
1036
1036
|
]),
|
|
1037
|
-
default:
|
|
1038
|
-
y(
|
|
1037
|
+
default: U(() => [
|
|
1038
|
+
y(I, {
|
|
1039
1039
|
class: "w-full flex flex-col gap-12",
|
|
1040
1040
|
ref_key: "formRef",
|
|
1041
1041
|
ref: f,
|
|
1042
1042
|
onValidationSuccess: i
|
|
1043
1043
|
}, {
|
|
1044
|
-
default:
|
|
1045
|
-
y(
|
|
1046
|
-
label: a(
|
|
1047
|
-
modelValue:
|
|
1048
|
-
"onUpdate:modelValue":
|
|
1044
|
+
default: U(() => [
|
|
1045
|
+
y(C, {
|
|
1046
|
+
label: a(b)("inventory.stock.adjust.remark"),
|
|
1047
|
+
modelValue: g.remark,
|
|
1048
|
+
"onUpdate:modelValue": S[0] || (S[0] = (K) => g.remark = K)
|
|
1049
1049
|
}, null, 8, ["label", "modelValue"]),
|
|
1050
1050
|
e("div", Bn, [
|
|
1051
|
-
e("div", In,
|
|
1052
|
-
y(
|
|
1051
|
+
e("div", In, p(a(b)("inventory.stock.adjust.adjustedItems")), 1),
|
|
1052
|
+
y(A, {
|
|
1053
1053
|
"prepend-icon": "add",
|
|
1054
1054
|
variant: "tertiary",
|
|
1055
1055
|
size: "md",
|
|
1056
|
-
onClick:
|
|
1056
|
+
onClick: o
|
|
1057
1057
|
})
|
|
1058
1058
|
]),
|
|
1059
|
-
(
|
|
1060
|
-
key:
|
|
1061
|
-
modelValue:
|
|
1062
|
-
"onUpdate:modelValue": (Z) =>
|
|
1063
|
-
"onClick:delete": (Z) => t(
|
|
1059
|
+
(D(!0), W(le, null, ce(g.adjustments, (K, O) => (D(), X(ht, {
|
|
1060
|
+
key: K.id,
|
|
1061
|
+
modelValue: g.adjustments[O],
|
|
1062
|
+
"onUpdate:modelValue": (Z) => g.adjustments[O] = Z,
|
|
1063
|
+
"onClick:delete": (Z) => t(O)
|
|
1064
1064
|
}, null, 8, ["modelValue", "onUpdate:modelValue", "onClick:delete"]))), 128))
|
|
1065
1065
|
]),
|
|
1066
1066
|
_: 1
|
|
1067
1067
|
}, 512)
|
|
1068
1068
|
]),
|
|
1069
|
-
"side-sheet-footer":
|
|
1069
|
+
"side-sheet-footer": U(() => [
|
|
1070
1070
|
e("div", Tn, [
|
|
1071
|
-
y(
|
|
1072
|
-
label: a(
|
|
1071
|
+
y(A, {
|
|
1072
|
+
label: a(b)("inventory.stock.adjust.adjustButton"),
|
|
1073
1073
|
loading: B.value,
|
|
1074
|
-
onClick:
|
|
1075
|
-
var
|
|
1076
|
-
return (Z = (
|
|
1074
|
+
onClick: S[1] || (S[1] = (K) => {
|
|
1075
|
+
var O, Z;
|
|
1076
|
+
return (Z = (O = f.value) == null ? void 0 : O.validateInputs) == null ? void 0 : Z.call(O);
|
|
1077
1077
|
})
|
|
1078
1078
|
}, null, 8, ["label", "loading"])
|
|
1079
1079
|
])
|
|
@@ -1082,190 +1082,190 @@ const Ge = {
|
|
|
1082
1082
|
}, 8, ["modelValue"]);
|
|
1083
1083
|
};
|
|
1084
1084
|
}
|
|
1085
|
-
}),
|
|
1085
|
+
}), Un = { class: "flex items-center w-full gap-8" }, En = { class: "fm-typo-en-title-md-800 flex-1" }, Pn = { class: "flex flex-col gap-16" }, Rn = { class: "flex flex-col gap-4" }, On = { class: "fm-typo-en-body-md-600" }, Nn = { class: "flex gap-8 items-start" }, Yn = { class: "flex-1 min-w-0" }, Ln = { class: "flex-1 min-w-0" }, zn = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Gn = { class: "flex items-center" }, Wn = { class: "fm-typo-en-title-sm-800 flex-1" }, Kn = { class: "flex gap-8" }, qn = /* @__PURE__ */ me({
|
|
1086
1086
|
__name: "StockAdjustmentSideSheet",
|
|
1087
1087
|
props: {
|
|
1088
1088
|
show: { type: Boolean }
|
|
1089
1089
|
},
|
|
1090
1090
|
emits: ["update:show", "submitted"],
|
|
1091
1091
|
setup(k, { emit: m }) {
|
|
1092
|
-
const d = k, s = m, { t:
|
|
1092
|
+
const d = k, s = m, { t: j } = fe(), w = Re(), c = we(), l = Ne(), h = Se(), B = Ye(d, "show"), b = z(!1), i = ut({
|
|
1093
1093
|
remark: "",
|
|
1094
1094
|
effectiveAt: /* @__PURE__ */ new Date(),
|
|
1095
1095
|
adjustments: []
|
|
1096
|
-
}), f =
|
|
1097
|
-
|
|
1098
|
-
if (f.value &&
|
|
1099
|
-
const
|
|
1100
|
-
if (
|
|
1101
|
-
const
|
|
1102
|
-
|
|
1096
|
+
}), f = z(ye().format("YYYY-MM-DD")), T = z(ye().format("HH:mm"));
|
|
1097
|
+
$e([f, T], () => {
|
|
1098
|
+
if (f.value && T.value) {
|
|
1099
|
+
const C = ye(`${f.value} ${T.value}`, "YYYY-MM-DD HH:mm");
|
|
1100
|
+
if (C.isValid()) {
|
|
1101
|
+
const A = ye();
|
|
1102
|
+
C.isAfter(A) ? i.effectiveAt = A.toDate() : i.effectiveAt = C.toDate();
|
|
1103
1103
|
}
|
|
1104
1104
|
}
|
|
1105
1105
|
});
|
|
1106
|
-
function
|
|
1107
|
-
i.remark = "", i.effectiveAt = /* @__PURE__ */ new Date(), i.adjustments = [], f.value =
|
|
1106
|
+
function g() {
|
|
1107
|
+
i.remark = "", i.effectiveAt = /* @__PURE__ */ new Date(), i.adjustments = [], f.value = ye(i.effectiveAt).format("YYYY-MM-DD"), T.value = ye(i.effectiveAt).format("HH:mm");
|
|
1108
1108
|
}
|
|
1109
|
-
function
|
|
1110
|
-
|
|
1109
|
+
function x() {
|
|
1110
|
+
g();
|
|
1111
1111
|
}
|
|
1112
|
-
const
|
|
1113
|
-
const
|
|
1114
|
-
return
|
|
1115
|
-
|
|
1116
|
-
}),
|
|
1112
|
+
const o = Y(() => {
|
|
1113
|
+
const C = {};
|
|
1114
|
+
return w.skus.forEach((A) => {
|
|
1115
|
+
C[A._id] = A;
|
|
1116
|
+
}), C;
|
|
1117
1117
|
});
|
|
1118
1118
|
function t() {
|
|
1119
|
-
const
|
|
1120
|
-
label:
|
|
1121
|
-
sublabel:
|
|
1122
|
-
value:
|
|
1123
|
-
})),
|
|
1119
|
+
const C = w.skus.map((I) => ({
|
|
1120
|
+
label: I.name,
|
|
1121
|
+
sublabel: I.code,
|
|
1122
|
+
value: I._id
|
|
1123
|
+
})), A = i.adjustments.map((I) => I.doc._id);
|
|
1124
1124
|
l.open({
|
|
1125
|
-
title:
|
|
1126
|
-
contentComponent:
|
|
1125
|
+
title: j("inventory.stock.adjust.selectIngredients"),
|
|
1126
|
+
contentComponent: pt,
|
|
1127
1127
|
contentComponentProps: {
|
|
1128
|
-
items:
|
|
1129
|
-
modelValue:
|
|
1128
|
+
items: C,
|
|
1129
|
+
modelValue: A,
|
|
1130
1130
|
virtualScroll: !0
|
|
1131
1131
|
},
|
|
1132
1132
|
overlay: !0,
|
|
1133
1133
|
closeButton: !0,
|
|
1134
1134
|
dismissAway: !0,
|
|
1135
1135
|
primaryActions: {
|
|
1136
|
-
text:
|
|
1136
|
+
text: j("common.confirm"),
|
|
1137
1137
|
close: !0
|
|
1138
1138
|
},
|
|
1139
1139
|
secondaryActions: {
|
|
1140
|
-
text:
|
|
1140
|
+
text: j("common.close"),
|
|
1141
1141
|
close: !0,
|
|
1142
1142
|
variant: "tertiary"
|
|
1143
1143
|
}
|
|
1144
|
-
}).onPrimary((
|
|
1145
|
-
i.adjustments =
|
|
1146
|
-
(
|
|
1144
|
+
}).onPrimary((I) => {
|
|
1145
|
+
i.adjustments = I.map(
|
|
1146
|
+
(R) => i.adjustments.find((K) => K.doc._id === R) ?? {
|
|
1147
1147
|
id: "",
|
|
1148
1148
|
type: ae.enum.PURCHASE,
|
|
1149
|
-
doc:
|
|
1149
|
+
doc: o.value[R],
|
|
1150
1150
|
measurement: null,
|
|
1151
1151
|
remark: "",
|
|
1152
|
-
amount:
|
|
1152
|
+
amount: be(1)
|
|
1153
1153
|
}
|
|
1154
1154
|
);
|
|
1155
1155
|
});
|
|
1156
1156
|
}
|
|
1157
|
-
function
|
|
1158
|
-
i.adjustments.splice(
|
|
1157
|
+
function n(C) {
|
|
1158
|
+
i.adjustments.splice(C, 1);
|
|
1159
1159
|
}
|
|
1160
|
-
async function
|
|
1160
|
+
async function S() {
|
|
1161
1161
|
if (i.adjustments.length === 0) {
|
|
1162
1162
|
h.open({
|
|
1163
|
-
title:
|
|
1164
|
-
message:
|
|
1163
|
+
title: j("inventory.stock.error.title"),
|
|
1164
|
+
message: j("inventory.stock.stock_adjustment.noAdjustments"),
|
|
1165
1165
|
type: "warning"
|
|
1166
1166
|
});
|
|
1167
1167
|
return;
|
|
1168
1168
|
}
|
|
1169
|
-
|
|
1169
|
+
b.value = !0;
|
|
1170
1170
|
try {
|
|
1171
|
-
const
|
|
1172
|
-
({ doc:
|
|
1173
|
-
id:
|
|
1174
|
-
amount:
|
|
1171
|
+
const C = i.adjustments.map(
|
|
1172
|
+
({ doc: I, remark: R, type: K, amount: O, measurement: Z }) => ({
|
|
1173
|
+
id: I._id,
|
|
1174
|
+
amount: O,
|
|
1175
1175
|
measurement: Z,
|
|
1176
|
-
remark:
|
|
1177
|
-
doc:
|
|
1178
|
-
type:
|
|
1176
|
+
remark: R,
|
|
1177
|
+
doc: I,
|
|
1178
|
+
type: K
|
|
1179
1179
|
})
|
|
1180
|
-
),
|
|
1180
|
+
), A = {
|
|
1181
1181
|
remark: i.remark,
|
|
1182
|
-
adjustments:
|
|
1182
|
+
adjustments: C,
|
|
1183
1183
|
effectiveAt: i.effectiveAt.toISOString()
|
|
1184
1184
|
};
|
|
1185
|
-
await c.adjustSku(
|
|
1186
|
-
} catch (
|
|
1185
|
+
await c.adjustSku(Pe(A)), s("submitted"), s("update:show", !1);
|
|
1186
|
+
} catch (C) {
|
|
1187
1187
|
h.open({
|
|
1188
|
-
title:
|
|
1189
|
-
message:
|
|
1188
|
+
title: j("inventory.stock.adjust.error.title"),
|
|
1189
|
+
message: j("inventory.stock.adjust.error.message"),
|
|
1190
1190
|
type: "error"
|
|
1191
|
-
}), console.error("error on stock adjustment",
|
|
1191
|
+
}), console.error("error on stock adjustment", C);
|
|
1192
1192
|
} finally {
|
|
1193
|
-
|
|
1193
|
+
b.value = !1;
|
|
1194
1194
|
}
|
|
1195
1195
|
}
|
|
1196
|
-
return (
|
|
1197
|
-
const
|
|
1198
|
-
return
|
|
1196
|
+
return (C, A) => {
|
|
1197
|
+
const I = H("FmTextarea"), R = H("FmDatePicker"), K = H("FmTimePicker"), O = H("FmButton"), Z = H("FmSideSheet");
|
|
1198
|
+
return D(), X(Z, {
|
|
1199
1199
|
modelValue: a(B),
|
|
1200
|
-
"onUpdate:modelValue":
|
|
1200
|
+
"onUpdate:modelValue": A[4] || (A[4] = (q) => Ee(B) ? B.value = q : null),
|
|
1201
1201
|
"dismiss-away": "",
|
|
1202
1202
|
"max-width": 560,
|
|
1203
|
-
onAfterEnter:
|
|
1203
|
+
onAfterEnter: x
|
|
1204
1204
|
}, {
|
|
1205
|
-
"side-sheet-header":
|
|
1206
|
-
e("div",
|
|
1207
|
-
e("div", En,
|
|
1205
|
+
"side-sheet-header": U(() => [
|
|
1206
|
+
e("div", Un, [
|
|
1207
|
+
e("div", En, p(a(j)("inventory.stock.stock_adjustment.title")), 1)
|
|
1208
1208
|
])
|
|
1209
1209
|
]),
|
|
1210
|
-
default:
|
|
1210
|
+
default: U(() => [
|
|
1211
1211
|
e("div", Pn, [
|
|
1212
|
-
y(
|
|
1213
|
-
label: a(
|
|
1212
|
+
y(I, {
|
|
1213
|
+
label: a(j)("inventory.stock.adjust.remark"),
|
|
1214
1214
|
modelValue: i.remark,
|
|
1215
|
-
"onUpdate:modelValue":
|
|
1215
|
+
"onUpdate:modelValue": A[0] || (A[0] = (q) => i.remark = q),
|
|
1216
1216
|
"label-mark": "optional"
|
|
1217
1217
|
}, null, 8, ["label", "modelValue"]),
|
|
1218
1218
|
e("div", Rn, [
|
|
1219
|
-
e("label", On,
|
|
1219
|
+
e("label", On, p(a(j)("inventory.stock.stock_adjustment.effectiveAt")), 1),
|
|
1220
1220
|
e("div", Nn, [
|
|
1221
1221
|
e("div", Yn, [
|
|
1222
|
-
y(
|
|
1222
|
+
y(R, {
|
|
1223
1223
|
class: "w-full",
|
|
1224
1224
|
modelValue: f.value,
|
|
1225
|
-
"onUpdate:modelValue":
|
|
1225
|
+
"onUpdate:modelValue": A[1] || (A[1] = (q) => f.value = q),
|
|
1226
1226
|
clearable: !1,
|
|
1227
|
-
max: a(
|
|
1227
|
+
max: a(ye)().format("YYYY-MM-DD")
|
|
1228
1228
|
}, null, 8, ["modelValue", "max"])
|
|
1229
1229
|
]),
|
|
1230
1230
|
e("div", Ln, [
|
|
1231
|
-
y(
|
|
1231
|
+
y(K, {
|
|
1232
1232
|
class: "w-full",
|
|
1233
|
-
modelValue:
|
|
1234
|
-
"onUpdate:modelValue":
|
|
1233
|
+
modelValue: T.value,
|
|
1234
|
+
"onUpdate:modelValue": A[2] || (A[2] = (q) => T.value = q),
|
|
1235
1235
|
format: "HH:mm"
|
|
1236
1236
|
}, null, 8, ["modelValue"])
|
|
1237
1237
|
])
|
|
1238
1238
|
]),
|
|
1239
|
-
e("div", zn,
|
|
1239
|
+
e("div", zn, p(a(j)("inventory.stock.stock_adjustment.immediateHint")), 1)
|
|
1240
1240
|
]),
|
|
1241
1241
|
e("div", Gn, [
|
|
1242
|
-
e("div", Wn,
|
|
1243
|
-
y(
|
|
1242
|
+
e("div", Wn, p(a(j)("inventory.stock.adjust.adjustedItems")), 1),
|
|
1243
|
+
y(O, {
|
|
1244
1244
|
"prepend-icon": "add",
|
|
1245
1245
|
variant: "tertiary",
|
|
1246
1246
|
size: "md",
|
|
1247
1247
|
onClick: t
|
|
1248
1248
|
})
|
|
1249
1249
|
]),
|
|
1250
|
-
(
|
|
1251
|
-
key:
|
|
1250
|
+
(D(!0), W(le, null, ce(i.adjustments, (q, ue) => (D(), X(ht, {
|
|
1251
|
+
key: q.id,
|
|
1252
1252
|
modelValue: i.adjustments[ue],
|
|
1253
1253
|
"onUpdate:modelValue": (ee) => i.adjustments[ue] = ee,
|
|
1254
|
-
"onClick:delete": (ee) =>
|
|
1254
|
+
"onClick:delete": (ee) => n(ue)
|
|
1255
1255
|
}, null, 8, ["modelValue", "onUpdate:modelValue", "onClick:delete"]))), 128))
|
|
1256
1256
|
])
|
|
1257
1257
|
]),
|
|
1258
|
-
"side-sheet-footer":
|
|
1258
|
+
"side-sheet-footer": U(() => [
|
|
1259
1259
|
e("div", Kn, [
|
|
1260
|
-
y(
|
|
1261
|
-
label: a(
|
|
1262
|
-
loading:
|
|
1263
|
-
onClick:
|
|
1260
|
+
y(O, {
|
|
1261
|
+
label: a(j)("common.confirm"),
|
|
1262
|
+
loading: b.value,
|
|
1263
|
+
onClick: S
|
|
1264
1264
|
}, null, 8, ["label", "loading"]),
|
|
1265
|
-
y(
|
|
1266
|
-
label: a(
|
|
1265
|
+
y(O, {
|
|
1266
|
+
label: a(j)("common.close"),
|
|
1267
1267
|
variant: "tertiary",
|
|
1268
|
-
onClick:
|
|
1268
|
+
onClick: A[3] || (A[3] = (q) => s("update:show", !1))
|
|
1269
1269
|
}, null, 8, ["label"])
|
|
1270
1270
|
])
|
|
1271
1271
|
]),
|
|
@@ -1275,20 +1275,20 @@ const Ge = {
|
|
|
1275
1275
|
}
|
|
1276
1276
|
}), Xn = $t((k, m) => ({
|
|
1277
1277
|
// TODO: remove once latest inventory backend has been push
|
|
1278
|
-
async findBillsByBusinessId(d, s,
|
|
1279
|
-
const
|
|
1278
|
+
async findBillsByBusinessId(d, s, j) {
|
|
1279
|
+
const w = `${k.businessesBackendUrl}/${d}/reports/find-many`, c = {
|
|
1280
1280
|
// type: TYPE.bill,
|
|
1281
1281
|
type: "bill",
|
|
1282
1282
|
restaurantIds: s,
|
|
1283
|
-
ids:
|
|
1283
|
+
ids: j
|
|
1284
1284
|
};
|
|
1285
|
-
return await m.post(
|
|
1285
|
+
return await m.post(w, c);
|
|
1286
1286
|
},
|
|
1287
1287
|
async findBillsById(d) {
|
|
1288
|
-
const
|
|
1288
|
+
const j = xe().currentLocationDBName, w = `${k.inventoryBackendUrl}/${j}/bill/search`, c = {
|
|
1289
1289
|
ids: d
|
|
1290
1290
|
};
|
|
1291
|
-
return await m.post(
|
|
1291
|
+
return await m.post(w, c);
|
|
1292
1292
|
}
|
|
1293
1293
|
})), Jn = {
|
|
1294
1294
|
key: 0,
|
|
@@ -1303,75 +1303,81 @@ const Ge = {
|
|
|
1303
1303
|
}),
|
|
1304
1304
|
emits: /* @__PURE__ */ Qe(["refreshHistory"], ["update:modelValue"]),
|
|
1305
1305
|
setup(k, { emit: m }) {
|
|
1306
|
-
const d = k, s = m,
|
|
1306
|
+
const d = k, s = m, j = we(), w = bt(k, "modelValue"), c = z(!1), l = z(!1), h = z(!1), B = z({
|
|
1307
1307
|
_id: `inventoryAdjustment_${(/* @__PURE__ */ new Date()).toISOString()}_XXXXX`,
|
|
1308
1308
|
skus: []
|
|
1309
|
-
}),
|
|
1309
|
+
}), b = z();
|
|
1310
1310
|
qe(async () => {
|
|
1311
1311
|
c.value = !0;
|
|
1312
|
-
const
|
|
1313
|
-
if (!
|
|
1314
|
-
B.value =
|
|
1312
|
+
const o = await j.readSingleAdjustment(d.adjustmentId);
|
|
1313
|
+
if (!o) throw new Error("Adjustment not found");
|
|
1314
|
+
B.value = o, c.value = !1;
|
|
1315
1315
|
});
|
|
1316
1316
|
async function i() {
|
|
1317
|
-
var t,
|
|
1318
|
-
if ((
|
|
1319
|
-
const
|
|
1320
|
-
Object.keys(
|
|
1321
|
-
var
|
|
1322
|
-
Object.keys(((
|
|
1323
|
-
var
|
|
1324
|
-
const
|
|
1325
|
-
|
|
1317
|
+
var t, n;
|
|
1318
|
+
if ((n = (t = b == null ? void 0 : b.value) == null ? void 0 : t.validateInputs) == null || n.call(t), !l.value) return;
|
|
1319
|
+
const o = {};
|
|
1320
|
+
Object.keys(w.value || {}).forEach((S) => {
|
|
1321
|
+
var C;
|
|
1322
|
+
Object.keys(((C = w.value) == null ? void 0 : C[S]) || {}).forEach((A) => {
|
|
1323
|
+
var R, K;
|
|
1324
|
+
const I = (K = (R = w.value) == null ? void 0 : R[S]) == null ? void 0 : K[Number(A)];
|
|
1325
|
+
I && T(I.amount) > 0 && (o[S] || (o[S] = []), o[S].push(I));
|
|
1326
1326
|
});
|
|
1327
|
-
}), await
|
|
1327
|
+
}), await j.revertWastageAdjustment({
|
|
1328
1328
|
targetWastageAdjustmentId: d.adjustmentId,
|
|
1329
|
-
amountsGoingToAdjust:
|
|
1330
|
-
}), s("refreshHistory"), h.value = !1,
|
|
1329
|
+
amountsGoingToAdjust: o
|
|
1330
|
+
}), s("refreshHistory"), h.value = !1, w.value = {};
|
|
1331
1331
|
}
|
|
1332
|
-
function f(
|
|
1333
|
-
|
|
1332
|
+
function f(o) {
|
|
1333
|
+
const { skuId: t, idx: n, unit: S, measurement: C } = o;
|
|
1334
|
+
return Y({
|
|
1334
1335
|
get: () => {
|
|
1335
|
-
var
|
|
1336
|
-
const
|
|
1337
|
-
return
|
|
1336
|
+
var R, K, O;
|
|
1337
|
+
const A = (O = (K = (R = w.value) == null ? void 0 : R[t]) == null ? void 0 : K[n]) == null ? void 0 : O.amount;
|
|
1338
|
+
return A ? Number(pe.toFormatString({ value: A })) : 0;
|
|
1338
1339
|
},
|
|
1339
|
-
set: (
|
|
1340
|
-
|
|
1341
|
-
const
|
|
1342
|
-
|
|
1343
|
-
amount:
|
|
1340
|
+
set: (A) => {
|
|
1341
|
+
w.value || (w.value = {});
|
|
1342
|
+
const I = { ...w.value };
|
|
1343
|
+
I[t] || (I[t] = {}), I[t][n] = {
|
|
1344
|
+
amount: pe.convertPrecision({
|
|
1345
|
+
value: pe.fromNumber(A),
|
|
1346
|
+
precision: Ce(S)
|
|
1347
|
+
}),
|
|
1344
1348
|
type: ae.Enum.WASTAGE,
|
|
1345
|
-
measurement:
|
|
1346
|
-
},
|
|
1349
|
+
measurement: C
|
|
1350
|
+
}, w.value = I;
|
|
1347
1351
|
}
|
|
1348
1352
|
});
|
|
1349
1353
|
}
|
|
1350
|
-
function
|
|
1351
|
-
const
|
|
1352
|
-
return t ? Math.abs(
|
|
1354
|
+
function T(o, t = !0) {
|
|
1355
|
+
const n = Number(pe.toFormatString({ value: o }));
|
|
1356
|
+
return t ? Math.abs(n) : n;
|
|
1353
1357
|
}
|
|
1354
|
-
function
|
|
1355
|
-
return t.measurement ? t.measurement.abbrev :
|
|
1358
|
+
function g(o, t) {
|
|
1359
|
+
return t.measurement ? t.measurement.abbrev : o.sku.unit.abbrev;
|
|
1356
1360
|
}
|
|
1357
|
-
function
|
|
1358
|
-
|
|
1361
|
+
function x(o, t) {
|
|
1362
|
+
if (t.amount === 0) return "N/A";
|
|
1363
|
+
const n = pe.add([o, t]);
|
|
1364
|
+
return n ? pe.toFormatString({ value: n }) : "N/A";
|
|
1359
1365
|
}
|
|
1360
|
-
return (
|
|
1361
|
-
const
|
|
1362
|
-
return
|
|
1366
|
+
return (o, t) => {
|
|
1367
|
+
const n = H("FmIcon"), S = H("FmStepperField"), C = H("FmCard"), A = H("FmForm"), I = H("FmSpacer"), R = H("FmButton"), K = H("FmDialog");
|
|
1368
|
+
return D(), X(K, {
|
|
1363
1369
|
modelValue: h.value,
|
|
1364
|
-
"onUpdate:modelValue": t[4] || (t[4] = (
|
|
1370
|
+
"onUpdate:modelValue": t[4] || (t[4] = (O) => h.value = O),
|
|
1365
1371
|
overlay: !0
|
|
1366
1372
|
}, {
|
|
1367
|
-
"dialog-button":
|
|
1373
|
+
"dialog-button": U(() => [
|
|
1368
1374
|
y(Xe, null, {
|
|
1369
|
-
default:
|
|
1375
|
+
default: U(() => [
|
|
1370
1376
|
e("button", {
|
|
1371
|
-
onClick: t[0] || (t[0] = (
|
|
1377
|
+
onClick: t[0] || (t[0] = (O) => h.value = !0),
|
|
1372
1378
|
class: "rounded-md hover:bg-gray-100 transition-colors"
|
|
1373
1379
|
}, [
|
|
1374
|
-
y(
|
|
1380
|
+
y(n, {
|
|
1375
1381
|
name: "edit",
|
|
1376
1382
|
size: "sm"
|
|
1377
1383
|
})
|
|
@@ -1380,22 +1386,22 @@ const Ge = {
|
|
|
1380
1386
|
_: 1
|
|
1381
1387
|
})
|
|
1382
1388
|
]),
|
|
1383
|
-
"dialog-header":
|
|
1389
|
+
"dialog-header": U(() => t[5] || (t[5] = [
|
|
1384
1390
|
e("div", null, "Amend Adjustment", -1)
|
|
1385
1391
|
])),
|
|
1386
|
-
"dialog-footer":
|
|
1392
|
+
"dialog-footer": U(() => [
|
|
1387
1393
|
e("div", ao, [
|
|
1388
1394
|
t[13] || (t[13] = e("span", { class: "text-fm-color-system-warning-400 fm-typo-en-body-sm-400" }, "1. New adjustment EXTRA will be created for each reversal", -1)),
|
|
1389
1395
|
e("div", lo, [
|
|
1390
|
-
y(
|
|
1391
|
-
y(
|
|
1396
|
+
y(I),
|
|
1397
|
+
y(R, {
|
|
1392
1398
|
class: "sm:w-full xs:w-full",
|
|
1393
1399
|
label: "Close",
|
|
1394
1400
|
size: "md",
|
|
1395
1401
|
variant: "tertiary",
|
|
1396
|
-
onClick: t[3] || (t[3] = (
|
|
1402
|
+
onClick: t[3] || (t[3] = (O) => h.value = !1)
|
|
1397
1403
|
}),
|
|
1398
|
-
y(
|
|
1404
|
+
y(R, {
|
|
1399
1405
|
class: "sm:w-full xs:w-full",
|
|
1400
1406
|
label: "Submit",
|
|
1401
1407
|
size: "md",
|
|
@@ -1405,11 +1411,11 @@ const Ge = {
|
|
|
1405
1411
|
])
|
|
1406
1412
|
])
|
|
1407
1413
|
]),
|
|
1408
|
-
default:
|
|
1409
|
-
c.value ? (
|
|
1414
|
+
default: U(() => [
|
|
1415
|
+
c.value ? (D(), W("div", Jn)) : (D(), X(A, {
|
|
1410
1416
|
key: 1,
|
|
1411
1417
|
ref_key: "formRef",
|
|
1412
|
-
ref:
|
|
1418
|
+
ref: b,
|
|
1413
1419
|
onValidationFailed: t[1] || (t[1] = () => {
|
|
1414
1420
|
l.value = !1;
|
|
1415
1421
|
}),
|
|
@@ -1418,52 +1424,67 @@ const Ge = {
|
|
|
1418
1424
|
}),
|
|
1419
1425
|
blameFormChildOnValidationFailed: ""
|
|
1420
1426
|
}, {
|
|
1421
|
-
default:
|
|
1427
|
+
default: U(() => [
|
|
1422
1428
|
e("p", Qn, [
|
|
1423
1429
|
t[6] || (t[6] = e("b", null, "Date:", -1)),
|
|
1424
1430
|
t[7] || (t[7] = e("br", null, null, -1)),
|
|
1425
|
-
|
|
1431
|
+
ve(" " + p(a(Yt)(a(Vt)(B.value._id))), 1)
|
|
1426
1432
|
]),
|
|
1427
1433
|
e("div", Zn, [
|
|
1428
|
-
(
|
|
1429
|
-
(
|
|
1434
|
+
(D(!0), W(le, null, ce(B.value.skus, (O, Z) => (D(), W(le, { key: Z }, [
|
|
1435
|
+
(D(!0), W(le, null, ce(O.amounts, (q, ue) => (D(), X(C, {
|
|
1430
1436
|
key: ue,
|
|
1431
1437
|
variant: "outlined",
|
|
1432
1438
|
class: "p-2"
|
|
1433
1439
|
}, {
|
|
1434
|
-
default:
|
|
1440
|
+
default: U(() => [
|
|
1435
1441
|
e("div", eo, [
|
|
1436
|
-
e("span", to,
|
|
1437
|
-
e("span", null,
|
|
1442
|
+
e("span", to, p(O.sku.code), 1),
|
|
1443
|
+
e("span", null, p(O.sku.name), 1)
|
|
1438
1444
|
]),
|
|
1439
1445
|
t[12] || (t[12] = e("hr", { class: "m-2" }, null, -1)),
|
|
1440
1446
|
e("div", no, [
|
|
1441
1447
|
t[8] || (t[8] = e("span", { class: "fm-typo-en-body-lg-600" }, "Adjustment type:", -1)),
|
|
1442
|
-
e("span", null,
|
|
1448
|
+
e("span", null, p(q.type), 1)
|
|
1443
1449
|
]),
|
|
1444
1450
|
e("div", oo, [
|
|
1445
1451
|
t[9] || (t[9] = e("span", { class: "fm-typo-en-body-lg-600" }, "Current amount:", -1)),
|
|
1446
|
-
e("span", null,
|
|
1452
|
+
e("span", null, p(a(pe).toFormatString({ value: q.amount })) + " " + p(g(O, q)), 1)
|
|
1447
1453
|
]),
|
|
1448
|
-
y(
|
|
1449
|
-
"
|
|
1450
|
-
"
|
|
1454
|
+
y(S, {
|
|
1455
|
+
"max-fraction-digits": a(Ce)(O.sku.unit),
|
|
1456
|
+
"model-value": f({
|
|
1457
|
+
skuId: O.sku._id,
|
|
1458
|
+
idx: ue,
|
|
1459
|
+
unit: O.sku.unit
|
|
1460
|
+
}).value,
|
|
1461
|
+
"onUpdate:modelValue": (ee) => f({
|
|
1462
|
+
skuId: O.sku._id,
|
|
1463
|
+
idx: ue,
|
|
1464
|
+
unit: O.sku.unit
|
|
1465
|
+
}).value = ee,
|
|
1451
1466
|
class: "mb-3",
|
|
1452
1467
|
label: "Adjust Amount (Leave 0 to skip)",
|
|
1453
|
-
"helper-text": `Max: ${
|
|
1454
|
-
"append-text":
|
|
1468
|
+
"helper-text": `Max: ${T(q.amount)}`,
|
|
1469
|
+
"append-text": g(O, q),
|
|
1455
1470
|
rules: [
|
|
1456
|
-
(ee) => ee <=
|
|
1457
|
-
a(
|
|
1471
|
+
(ee) => ee <= T(q.amount) || `Cannot be more than ${T(q.amount)}`,
|
|
1472
|
+
a(He)(-1)
|
|
1458
1473
|
]
|
|
1459
|
-
}, null, 8, ["model-value", "onUpdate:modelValue", "helper-text", "append-text", "rules"]),
|
|
1474
|
+
}, null, 8, ["max-fraction-digits", "model-value", "onUpdate:modelValue", "helper-text", "append-text", "rules"]),
|
|
1460
1475
|
e("div", so, [
|
|
1461
1476
|
t[10] || (t[10] = e("span", { class: "fm-typo-en-body-lg-600" }, "Amount after amend:", -1)),
|
|
1462
1477
|
t[11] || (t[11] = e("span", { class: "text-fm-color-system-warning-400 fm-typo-en-body-sm-400" }, "* It's an estimate for your reference, as it didn't include all the reversals related to this adjustment", -1)),
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1478
|
+
ve(" " + p(x(
|
|
1479
|
+
q.amount,
|
|
1480
|
+
a(pe).fromNumber(
|
|
1481
|
+
f({
|
|
1482
|
+
skuId: O.sku._id,
|
|
1483
|
+
idx: ue,
|
|
1484
|
+
unit: O.sku.unit
|
|
1485
|
+
}).value
|
|
1486
|
+
)
|
|
1487
|
+
)) + " " + p(g(O, q)), 1)
|
|
1467
1488
|
])
|
|
1468
1489
|
]),
|
|
1469
1490
|
_: 2
|
|
@@ -1481,7 +1502,7 @@ const Ge = {
|
|
|
1481
1502
|
}), io = { class: "p-16" }, uo = { class: "fm-typo-en-body-md-600 flex-grow" }, co = { class: "flex-grow text-fm-color-typo-secondary" }, mo = {
|
|
1482
1503
|
key: 0,
|
|
1483
1504
|
class: "my-5"
|
|
1484
|
-
}, fo = { class: "text-neutral-400" },
|
|
1505
|
+
}, fo = { class: "text-neutral-400" }, vo = { class: "flex-grow" }, po = { class: "flex gap-1" }, yo = { class: "flex flex-col gap-1" }, _o = {
|
|
1485
1506
|
key: 1,
|
|
1486
1507
|
class: "t-system text-fsecondary"
|
|
1487
1508
|
}, ko = {
|
|
@@ -1501,81 +1522,81 @@ const Ge = {
|
|
|
1501
1522
|
},
|
|
1502
1523
|
setup(k) {
|
|
1503
1524
|
const m = k;
|
|
1504
|
-
function d(
|
|
1525
|
+
function d(b, i) {
|
|
1505
1526
|
if (m.costMechanism === "adjustment")
|
|
1506
1527
|
return null;
|
|
1507
1528
|
const f = m.unitCostHistory.filter(
|
|
1508
|
-
(
|
|
1529
|
+
(x) => x.mechanism === m.costMechanism && x.skuId === m.sku._id
|
|
1509
1530
|
);
|
|
1510
1531
|
if (f.length === 0) return null;
|
|
1511
|
-
const
|
|
1512
|
-
const
|
|
1513
|
-
return (
|
|
1532
|
+
const T = f.find((x) => {
|
|
1533
|
+
const o = x.meta;
|
|
1534
|
+
return (o == null ? void 0 : o.adjustmentId) === b;
|
|
1514
1535
|
});
|
|
1515
|
-
if (
|
|
1516
|
-
const
|
|
1517
|
-
return
|
|
1536
|
+
if (T) return T.cost;
|
|
1537
|
+
const g = [...f].filter((x) => new Date(x.snapshotAt) <= new Date(i)).sort((x, o) => new Date(o.snapshotAt).getTime() - new Date(x.snapshotAt).getTime());
|
|
1538
|
+
return g.length > 0 ? g[0].cost : null;
|
|
1518
1539
|
}
|
|
1519
|
-
const s =
|
|
1540
|
+
const s = z(!1), j = z(), w = z(null), c = Y(() => w.value === null ? "unset" : s.value ? `${w.value}px` : "0px");
|
|
1520
1541
|
qe(() => {
|
|
1521
|
-
var
|
|
1522
|
-
|
|
1542
|
+
var b;
|
|
1543
|
+
w.value = ((b = j.value) == null ? void 0 : b.scrollHeight) || 0;
|
|
1523
1544
|
});
|
|
1524
|
-
const l =
|
|
1525
|
-
var
|
|
1526
|
-
const
|
|
1545
|
+
const l = Y(() => {
|
|
1546
|
+
var x;
|
|
1547
|
+
const b = m.record.adjustments, i = m.sku, f = {}, g = b.flatMap((o) => {
|
|
1527
1548
|
var t;
|
|
1528
|
-
return ((t =
|
|
1529
|
-
}).flatMap((
|
|
1530
|
-
for (const
|
|
1531
|
-
const t =
|
|
1532
|
-
f[
|
|
1549
|
+
return ((t = o.skus) == null ? void 0 : t.filter((n) => n.sku._id === i._id)) ?? [];
|
|
1550
|
+
}).flatMap((o) => o.amounts);
|
|
1551
|
+
for (const o of g) {
|
|
1552
|
+
const t = o.measurement ? vt(o.measurement.conversion, o.amount) : o.amount;
|
|
1553
|
+
f[x = o.type] ?? (f[x] = { amount: 0, precision: 0 }), f[o.type] = Je(t, f[o.type]);
|
|
1533
1554
|
}
|
|
1534
1555
|
return Object.entries(f).reduce(
|
|
1535
|
-
(
|
|
1556
|
+
(o, [t, n]) => (o[t] = /// comment, because without it formatter makes code uglier
|
|
1536
1557
|
`${Q.toFormatString({
|
|
1537
|
-
value:
|
|
1558
|
+
value: n,
|
|
1538
1559
|
precision: 4
|
|
1539
|
-
})} ${i.unit.abbrev}`,
|
|
1560
|
+
})} ${i.unit.abbrev}`, o),
|
|
1540
1561
|
{}
|
|
1541
1562
|
);
|
|
1542
|
-
}), { t: h } = fe(), B =
|
|
1543
|
-
time: Lt(new Date(
|
|
1563
|
+
}), { t: h } = fe(), B = Y(() => m.record.adjustmentsByTime.map(({ date: b, adjustments: i }) => ({
|
|
1564
|
+
time: Lt(new Date(b)),
|
|
1544
1565
|
adjustments: i.flatMap(
|
|
1545
1566
|
(f) => {
|
|
1546
|
-
var
|
|
1547
|
-
return ((
|
|
1548
|
-
var
|
|
1567
|
+
var T, g;
|
|
1568
|
+
return ((g = (T = f.skus) == null ? void 0 : T.map) == null ? void 0 : g.call(T, (x) => {
|
|
1569
|
+
var o, t;
|
|
1549
1570
|
return {
|
|
1550
|
-
...
|
|
1571
|
+
...x,
|
|
1551
1572
|
ref: f.ref,
|
|
1552
|
-
backdateFrom: f.effectiveAt != null ?
|
|
1553
|
-
toBalance: (t = (
|
|
1573
|
+
backdateFrom: f.effectiveAt != null ? Ie(f._id) : null,
|
|
1574
|
+
toBalance: (t = (o = f.skus) == null ? void 0 : o[0]) == null ? void 0 : t.toBalance,
|
|
1554
1575
|
adjustmentId: f._id,
|
|
1555
|
-
adjustmentTime: f.effectiveAt ??
|
|
1576
|
+
adjustmentTime: f.effectiveAt ?? Ie(f._id)
|
|
1556
1577
|
};
|
|
1557
1578
|
})) ?? [];
|
|
1558
1579
|
}
|
|
1559
1580
|
).flatMap((f) => {
|
|
1560
1581
|
var t;
|
|
1561
|
-
const
|
|
1562
|
-
return f.amounts.map((
|
|
1563
|
-
var
|
|
1564
|
-
let
|
|
1565
|
-
if (
|
|
1566
|
-
const
|
|
1567
|
-
|
|
1568
|
-
...Q.multiply([
|
|
1569
|
-
currency:
|
|
1582
|
+
const T = (t = m.bills.find((n) => n._id === f.ref)) == null ? void 0 : t.seqNumber, g = T ? h("inventory.stock.record.bill", [T]) : "", x = f.adjustmentTime ?? (/* @__PURE__ */ new Date()).toISOString(), o = d(f.adjustmentId, x);
|
|
1583
|
+
return f.amounts.map((n) => {
|
|
1584
|
+
var C;
|
|
1585
|
+
let S = n.cost;
|
|
1586
|
+
if (o) {
|
|
1587
|
+
const A = Q.fromDinero(o), I = n.amount, R = n.measurement ? Q.multiply([I, n.measurement.conversion]) : I;
|
|
1588
|
+
S = {
|
|
1589
|
+
...Q.multiply([A, R]),
|
|
1590
|
+
currency: o.currency
|
|
1570
1591
|
};
|
|
1571
1592
|
}
|
|
1572
1593
|
return {
|
|
1573
|
-
amount: `${Q.toFormatString({ value:
|
|
1594
|
+
amount: `${Q.toFormatString({ value: n.amount, precision: 4 })} ${((C = n.measurement) == null ? void 0 : C.abbrev) ?? f.sku.unit.abbrev}`,
|
|
1574
1595
|
backdateFrom: f.backdateFrom,
|
|
1575
|
-
name:
|
|
1576
|
-
billRemark:
|
|
1577
|
-
remark:
|
|
1578
|
-
cost:
|
|
1596
|
+
name: n.type,
|
|
1597
|
+
billRemark: g,
|
|
1598
|
+
remark: n.remark || "",
|
|
1599
|
+
cost: S,
|
|
1579
1600
|
toBalance: Q.toFormatString({
|
|
1580
1601
|
value: f.toBalance ?? Q.fromNumber(0),
|
|
1581
1602
|
precision: 4
|
|
@@ -1586,39 +1607,39 @@ const Ge = {
|
|
|
1586
1607
|
});
|
|
1587
1608
|
})
|
|
1588
1609
|
})));
|
|
1589
|
-
return (
|
|
1590
|
-
const f =
|
|
1591
|
-
return
|
|
1592
|
-
default:
|
|
1610
|
+
return (b, i) => {
|
|
1611
|
+
const f = H("FmIcon"), T = H("FmTooltip"), g = H("FmCard");
|
|
1612
|
+
return D(), X(g, { variant: "outlined" }, {
|
|
1613
|
+
default: U(() => [
|
|
1593
1614
|
e("div", io, [
|
|
1594
1615
|
e("div", {
|
|
1595
1616
|
class: "flex items-center cursor-pointer mb-1",
|
|
1596
|
-
onClick: i[0] || (i[0] = (
|
|
1617
|
+
onClick: i[0] || (i[0] = (x) => s.value = !s.value)
|
|
1597
1618
|
}, [
|
|
1598
|
-
e("div", uo,
|
|
1619
|
+
e("div", uo, p(b.record.date), 1),
|
|
1599
1620
|
y(f, {
|
|
1600
1621
|
name: s.value ? "expand_more" : "expand_less",
|
|
1601
1622
|
color: "#777777",
|
|
1602
1623
|
size: "md"
|
|
1603
1624
|
}, null, 8, ["name"])
|
|
1604
1625
|
]),
|
|
1605
|
-
(
|
|
1606
|
-
key:
|
|
1626
|
+
(D(!0), W(le, null, ce(l.value, (x, o) => (D(), W("div", {
|
|
1627
|
+
key: o,
|
|
1607
1628
|
class: "flex flex-row py-1",
|
|
1608
1629
|
style: { "font-size": "0.8rem" }
|
|
1609
1630
|
}, [
|
|
1610
|
-
e("div", co,
|
|
1631
|
+
e("div", co, p(a(h)(`inventory.inventoryAdjustment.type.${o}`)), 1),
|
|
1611
1632
|
e("div", {
|
|
1612
|
-
class:
|
|
1613
|
-
"text-fm-color-typo-error":
|
|
1614
|
-
"text-fm-color-typo-success": !
|
|
1633
|
+
class: ge({
|
|
1634
|
+
"text-fm-color-typo-error": x.startsWith("-"),
|
|
1635
|
+
"text-fm-color-typo-success": !x.startsWith("-"),
|
|
1615
1636
|
"ml-auto": !0
|
|
1616
1637
|
})
|
|
1617
|
-
},
|
|
1638
|
+
}, p(x), 3)
|
|
1618
1639
|
]))), 128)),
|
|
1619
1640
|
e("div", {
|
|
1620
1641
|
ref_key: "detailRef",
|
|
1621
|
-
ref:
|
|
1642
|
+
ref: j,
|
|
1622
1643
|
style: ct({
|
|
1623
1644
|
fontSize: "0.8rem",
|
|
1624
1645
|
maxHeight: c.value,
|
|
@@ -1626,31 +1647,31 @@ const Ge = {
|
|
|
1626
1647
|
transition: "max-height 0.2s ease-out"
|
|
1627
1648
|
})
|
|
1628
1649
|
}, [
|
|
1629
|
-
B.value.length ? (
|
|
1630
|
-
(
|
|
1631
|
-
key:
|
|
1650
|
+
B.value.length ? (D(), W("hr", mo)) : se("", !0),
|
|
1651
|
+
(D(!0), W(le, null, ce(B.value, (x) => (D(), W("div", {
|
|
1652
|
+
key: x.time,
|
|
1632
1653
|
class: "flex gap-1 w-full"
|
|
1633
1654
|
}, [
|
|
1634
|
-
e("div", fo,
|
|
1635
|
-
e("div",
|
|
1636
|
-
(
|
|
1637
|
-
key:
|
|
1655
|
+
e("div", fo, p(x.time), 1),
|
|
1656
|
+
e("div", vo, [
|
|
1657
|
+
(D(!0), W(le, null, ce(x.adjustments, (o) => (D(), W("div", {
|
|
1658
|
+
key: o.name,
|
|
1638
1659
|
class: "flex gap-1"
|
|
1639
1660
|
}, [
|
|
1640
|
-
e("div",
|
|
1641
|
-
|
|
1642
|
-
|
|
1661
|
+
e("div", po, [
|
|
1662
|
+
ve(p(a(h)(`inventory.inventoryAdjustment.type.${o.name}`)) + " ", 1),
|
|
1663
|
+
o.backdateFrom ? (D(), X(T, {
|
|
1643
1664
|
key: 0,
|
|
1644
1665
|
variant: "plain",
|
|
1645
1666
|
placement: "top",
|
|
1646
1667
|
"z-index": 50
|
|
1647
1668
|
}, {
|
|
1648
|
-
content:
|
|
1649
|
-
e("div", yo,
|
|
1650
|
-
a(yt)(new Date(
|
|
1669
|
+
content: U(() => [
|
|
1670
|
+
e("div", yo, p(a(h)("inventory.stock.record.backdate", [
|
|
1671
|
+
a(yt)(new Date(o.backdateFrom))
|
|
1651
1672
|
])), 1)
|
|
1652
1673
|
]),
|
|
1653
|
-
default:
|
|
1674
|
+
default: U(() => [
|
|
1654
1675
|
y(f, {
|
|
1655
1676
|
name: "info",
|
|
1656
1677
|
size: "sm",
|
|
@@ -1659,26 +1680,26 @@ const Ge = {
|
|
|
1659
1680
|
]),
|
|
1660
1681
|
_: 2
|
|
1661
1682
|
}, 1024)) : se("", !0),
|
|
1662
|
-
|
|
1663
|
-
|
|
1683
|
+
o.billRemark ? (D(), W("span", _o, " # " + p(o.billRemark), 1)) : se("", !0),
|
|
1684
|
+
o.remark ? (D(), W("span", {
|
|
1664
1685
|
key: 2,
|
|
1665
|
-
class:
|
|
1666
|
-
},
|
|
1667
|
-
|
|
1686
|
+
class: ge(o.billRemark ? "text-xs text-gray-400" : "")
|
|
1687
|
+
}, p(o.billRemark ? `(${o.remark})` : `# ${o.remark}`), 3)) : se("", !0),
|
|
1688
|
+
o.name === a(ae).Enum.CLOSING ? (D(), W("span", ko, " Actual Balance: " + p(o.toBalance) + " " + p(o.baseUnit), 1)) : se("", !0)
|
|
1668
1689
|
]),
|
|
1669
1690
|
e("div", {
|
|
1670
|
-
class:
|
|
1671
|
-
"text-fm-color-typo-error":
|
|
1672
|
-
"text-fm-color-typo-success": !
|
|
1691
|
+
class: ge({
|
|
1692
|
+
"text-fm-color-typo-error": o.amount.startsWith("-"),
|
|
1693
|
+
"text-fm-color-typo-success": !o.amount.startsWith("-"),
|
|
1673
1694
|
"ml-auto": !0
|
|
1674
1695
|
})
|
|
1675
|
-
},
|
|
1676
|
-
|
|
1696
|
+
}, p(o.amount), 3),
|
|
1697
|
+
o.name === a(ae).Enum.WASTAGE ? (D(), X(ro, {
|
|
1677
1698
|
key: 0,
|
|
1678
|
-
adjustmentId:
|
|
1679
|
-
onRefreshHistory: i[1] || (i[1] = (t) =>
|
|
1699
|
+
adjustmentId: o.adjustmentId,
|
|
1700
|
+
onRefreshHistory: i[1] || (i[1] = (t) => b.$emit("refreshHistory"))
|
|
1680
1701
|
}, null, 8, ["adjustmentId"])) : se("", !0),
|
|
1681
|
-
|
|
1702
|
+
o.cost ? (D(), W("div", ho, " (" + p(a(Me)(o.cost, !1, o.cost.precision)) + ") ", 1)) : se("", !0)
|
|
1682
1703
|
]))), 128))
|
|
1683
1704
|
])
|
|
1684
1705
|
]))), 128))
|
|
@@ -1691,7 +1712,7 @@ const Ge = {
|
|
|
1691
1712
|
}
|
|
1692
1713
|
});
|
|
1693
1714
|
function bo(k, m) {
|
|
1694
|
-
var
|
|
1715
|
+
var w;
|
|
1695
1716
|
const d = Object.keys(ae.enum).reduce(
|
|
1696
1717
|
(c, l) => (c[l] = { amount: 0, precision: 0 }, c),
|
|
1697
1718
|
{}
|
|
@@ -1701,13 +1722,13 @@ function bo(k, m) {
|
|
|
1701
1722
|
(c, [l]) => (c[l] = Q.fromNumber(0), c),
|
|
1702
1723
|
{}
|
|
1703
1724
|
);
|
|
1704
|
-
const
|
|
1725
|
+
const j = k.flatMap((c) => {
|
|
1705
1726
|
var l;
|
|
1706
1727
|
return ((l = c.skus) == null ? void 0 : l.filter((h) => h.sku._id === m._id)) ?? [];
|
|
1707
1728
|
}).flatMap((c) => c.amounts);
|
|
1708
|
-
for (const c of
|
|
1729
|
+
for (const c of j) {
|
|
1709
1730
|
const l = c.measurement ? Q.multiply([c.measurement.conversion, c.amount]) : c.amount;
|
|
1710
|
-
d[
|
|
1731
|
+
d[w = c.type] ?? (d[w] = { amount: 0, precision: 0 }), d[c.type] = Q.add([l, d[c.type]]);
|
|
1711
1732
|
}
|
|
1712
1733
|
return Object.entries(d).reduce(
|
|
1713
1734
|
(c, [l, h]) => {
|
|
@@ -1728,15 +1749,15 @@ function xo(k, m) {
|
|
|
1728
1749
|
if (!m)
|
|
1729
1750
|
return null;
|
|
1730
1751
|
let d = null;
|
|
1731
|
-
const
|
|
1752
|
+
const j = k.flatMap((w) => {
|
|
1732
1753
|
var c;
|
|
1733
|
-
return ((c =
|
|
1734
|
-
}).flatMap((
|
|
1754
|
+
return ((c = w.skus) == null ? void 0 : c.filter((l) => l.sku._id === m._id)) ?? [];
|
|
1755
|
+
}).flatMap((w) => {
|
|
1735
1756
|
var c;
|
|
1736
|
-
return !
|
|
1757
|
+
return !w.history || ((c = w.history) == null ? void 0 : c.length) === 0 ? [] : w.history[0];
|
|
1737
1758
|
});
|
|
1738
|
-
for (const
|
|
1739
|
-
const c =
|
|
1759
|
+
for (const w of j) {
|
|
1760
|
+
const c = w.amounts;
|
|
1740
1761
|
for (const l of c) {
|
|
1741
1762
|
if (l.type !== ae.Enum.SALES)
|
|
1742
1763
|
continue;
|
|
@@ -1752,16 +1773,16 @@ function xo(k, m) {
|
|
|
1752
1773
|
const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = { class: "flex-1 line-clamp-2" }, Fo = { class: "flex flex-col gap-32 w-full h-full" }, Ao = { class: "flex items-center relative gap-4" }, $o = { class: "flex-1" }, Vo = {
|
|
1753
1774
|
key: 0,
|
|
1754
1775
|
class: "flex-1 flex flex-col items-center gap-16"
|
|
1755
|
-
}, Co = { class: "fm-typo-en-body-lg-400 translate-x-4" },
|
|
1776
|
+
}, Co = { class: "fm-typo-en-body-lg-400 translate-x-4" }, Do = {
|
|
1756
1777
|
key: 1,
|
|
1757
1778
|
class: "flex flex-col gap-12"
|
|
1758
|
-
},
|
|
1779
|
+
}, jo = { class: "pb-16" }, Mo = { class: "fm-typo-cn-body-lg-600" }, Bo = {
|
|
1759
1780
|
class: "grid gap-12 fm-typo-en-body-md-400",
|
|
1760
1781
|
style: { "grid-template-columns": "auto auto auto", "grid-auto-rows": "1fr" }
|
|
1761
|
-
}, Io = { class: "flex flex-col gap-1" }, To = { class: "text-fm-color-typo-secondary" },
|
|
1782
|
+
}, Io = { class: "flex flex-col gap-1" }, To = { class: "text-fm-color-typo-secondary" }, Ho = { class: "font-bold" }, Uo = { class: "flex flex-col gap-1" }, Eo = { class: "text-fm-color-typo-secondary flex" }, Po = { class: "font-bold" }, Ro = { class: "flex flex-col gap-1" }, Oo = { class: "text-fm-color-typo-secondary" }, No = { class: "font-bold" }, Yo = { class: "flex flex-col gap-1" }, Lo = { class: "text-fm-color-typo-secondary" }, zo = { class: "font-bold" }, Go = { class: "flex flex-col gap-1" }, Wo = { class: "text-fm-color-typo-secondary" }, Ko = { class: "font-bold" }, qo = { class: "flex flex-col gap-1" }, Xo = { class: "text-fm-color-typo-secondary" }, Jo = { class: "font-bold" }, Qo = { class: "flex flex-col gap-1" }, Zo = { class: "text-fm-color-typo-secondary" }, es = { class: "font-bold" }, ts = { class: "flex flex-col gap-1" }, ns = { class: "text-fm-color-typo-secondary" }, os = { class: "font-bold" }, ss = { class: "flex flex-col gap-1" }, as = { class: "text-fm-color-typo-secondary" }, ls = { class: "font-bold" }, rs = {
|
|
1762
1783
|
key: 0,
|
|
1763
1784
|
class: "flex flex-col gap-8"
|
|
1764
|
-
}, is = { class: "flex" }, us = { class: "flex-1 flex flex-col gap-1" }, cs = { class: "flex gap-1 items-center text-fm-color-typo-secondary" }, ds = { class: "font-bold" }, ms = { class: "flex-1 flex flex-col gap-1" }, fs = { class: "flex gap-1 items-center text-fm-color-typo-secondary" },
|
|
1785
|
+
}, is = { class: "flex" }, us = { class: "flex-1 flex flex-col gap-1" }, cs = { class: "flex gap-1 items-center text-fm-color-typo-secondary" }, ds = { class: "font-bold" }, ms = { class: "flex-1 flex flex-col gap-1" }, fs = { class: "flex gap-1 items-center text-fm-color-typo-secondary" }, vs = { class: "flex flex-col gap-1" }, ps = { class: "font-bold" }, ys = {
|
|
1765
1786
|
key: 2,
|
|
1766
1787
|
class: "flex-1 flex flex-col items-center gap-8"
|
|
1767
1788
|
}, _s = ["src"], ks = { class: "font-bold text-lg" }, hs = { class: "text-xs text-neutral-400 text-center" }, gs = /* @__PURE__ */ me({
|
|
@@ -1772,40 +1793,40 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
|
|
|
1772
1793
|
},
|
|
1773
1794
|
emits: ["update:show"],
|
|
1774
1795
|
setup(k) {
|
|
1775
|
-
const m = ft(), d =
|
|
1796
|
+
const m = ft(), d = Oe(), s = we(), j = Xn(), w = xe(), c = Jt(), { t: l } = fe(), h = k, B = z(!1), b = Se(), i = z("adjustment"), f = z([
|
|
1776
1797
|
{ label: "Adjustment (Default)", value: "adjustment" }
|
|
1777
|
-
]),
|
|
1778
|
-
async function
|
|
1798
|
+
]), T = z([]), g = z(Kt(0));
|
|
1799
|
+
async function x() {
|
|
1779
1800
|
B.value = !0;
|
|
1780
1801
|
try {
|
|
1781
|
-
await
|
|
1802
|
+
await A(), await d.readStockBalance();
|
|
1782
1803
|
} catch (_) {
|
|
1783
|
-
|
|
1804
|
+
b.open({
|
|
1784
1805
|
title: "Something went wrong",
|
|
1785
1806
|
message: "Cannot fetch stock history. Please try again.",
|
|
1786
1807
|
type: "error"
|
|
1787
|
-
}), console.log("failed at fetching item adjustment history", h.sku,
|
|
1808
|
+
}), console.log("failed at fetching item adjustment history", h.sku, g, _);
|
|
1788
1809
|
} finally {
|
|
1789
1810
|
B.value = !1;
|
|
1790
1811
|
}
|
|
1791
1812
|
}
|
|
1792
1813
|
qe(() => {
|
|
1793
|
-
|
|
1794
|
-
}),
|
|
1795
|
-
|
|
1814
|
+
x();
|
|
1815
|
+
}), $e([() => g.value, () => h.sku], () => {
|
|
1816
|
+
x();
|
|
1796
1817
|
});
|
|
1797
|
-
const
|
|
1798
|
-
function
|
|
1818
|
+
const o = z([]), t = z([]), n = z(new Array());
|
|
1819
|
+
function S(_, r) {
|
|
1799
1820
|
return r === "day" ? Wt(_) : yt(_);
|
|
1800
1821
|
}
|
|
1801
|
-
function
|
|
1822
|
+
function C(_, r) {
|
|
1802
1823
|
const M = _.reduce(
|
|
1803
1824
|
(V, u) => {
|
|
1804
|
-
const
|
|
1805
|
-
if (!
|
|
1825
|
+
const F = u.effectiveAt ?? Ie(u._id);
|
|
1826
|
+
if (!F)
|
|
1806
1827
|
return V;
|
|
1807
|
-
const
|
|
1808
|
-
return V[
|
|
1828
|
+
const N = S(new Date(F), r);
|
|
1829
|
+
return V[N] ?? (V[N] = []), V[N].push(u), V;
|
|
1809
1830
|
},
|
|
1810
1831
|
{}
|
|
1811
1832
|
);
|
|
@@ -1814,60 +1835,60 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
|
|
|
1814
1835
|
adjustments: M[V]
|
|
1815
1836
|
}));
|
|
1816
1837
|
}
|
|
1817
|
-
async function
|
|
1838
|
+
async function A() {
|
|
1818
1839
|
let _ = await s.readStockAdjustment(
|
|
1819
1840
|
h.sku._id,
|
|
1820
|
-
st(new Date(
|
|
1821
|
-
at(new Date(
|
|
1841
|
+
st(new Date(g.value.startDate)).toISOString(),
|
|
1842
|
+
at(new Date(g.value.endDate)).toISOString()
|
|
1822
1843
|
);
|
|
1823
|
-
|
|
1844
|
+
o.value = _;
|
|
1824
1845
|
const r = _.filter(({ ref: M }) => M == null ? void 0 : M.startsWith("bill_")).map(({ ref: M }) => M);
|
|
1825
|
-
await
|
|
1846
|
+
await I(r), t.value = C(_, "day").map(({ date: M, adjustments: V }) => ({
|
|
1826
1847
|
date: M,
|
|
1827
1848
|
adjustments: V,
|
|
1828
|
-
adjustmentsByTime:
|
|
1849
|
+
adjustmentsByTime: C(V, "minute")
|
|
1829
1850
|
}));
|
|
1830
1851
|
try {
|
|
1831
1852
|
const M = await s.readUnitCostHistory(
|
|
1832
1853
|
h.sku._id,
|
|
1833
|
-
st(new Date(
|
|
1834
|
-
at(new Date(
|
|
1854
|
+
st(new Date(g.value.startDate)).toISOString(),
|
|
1855
|
+
at(new Date(g.value.endDate)).toISOString()
|
|
1835
1856
|
);
|
|
1836
|
-
|
|
1857
|
+
T.value = M;
|
|
1837
1858
|
const V = /* @__PURE__ */ new Set();
|
|
1838
|
-
M.forEach((
|
|
1839
|
-
V.add(
|
|
1859
|
+
M.forEach((F) => {
|
|
1860
|
+
V.add(F.mechanism);
|
|
1840
1861
|
});
|
|
1841
1862
|
const u = [{ label: "Default", value: "adjustment" }];
|
|
1842
|
-
V.has(
|
|
1863
|
+
V.has(he.Enum.weightedAverage) && u.push({
|
|
1843
1864
|
label: "Weighted Average (Beta)",
|
|
1844
|
-
value:
|
|
1845
|
-
}), V.has(
|
|
1865
|
+
value: he.Enum.weightedAverage
|
|
1866
|
+
}), V.has(he.Enum.netsuite) && u.push({ label: "NetSuite (Beta)", value: he.Enum.netsuite }), V.has(he.Enum["netsuite-average"]) && u.push({
|
|
1846
1867
|
label: "NetSuite Average (Beta)",
|
|
1847
|
-
value:
|
|
1868
|
+
value: he.Enum["netsuite-average"]
|
|
1848
1869
|
}), f.value = u, !V.has(i.value) && i.value !== "adjustment" && (i.value = "adjustment");
|
|
1849
1870
|
} catch (M) {
|
|
1850
1871
|
console.error("Failed to fetch unit cost history:", M);
|
|
1851
1872
|
}
|
|
1852
1873
|
}
|
|
1853
|
-
async function
|
|
1854
|
-
_.length && (
|
|
1874
|
+
async function I(_) {
|
|
1875
|
+
_.length && (n.value = await j.findBillsById(_).catch((r) => {
|
|
1855
1876
|
var u;
|
|
1856
1877
|
console.error("Error on using latest bill API, retrying using legacy api", r);
|
|
1857
|
-
const M = ((u = m.currentBusiness.value) == null ? void 0 : u._id) ?? "", V =
|
|
1858
|
-
return
|
|
1878
|
+
const M = ((u = m.currentBusiness.value) == null ? void 0 : u._id) ?? "", V = w.currentLocation.doc._id;
|
|
1879
|
+
return j.findBillsByBusinessId(M, [V], _);
|
|
1859
1880
|
}));
|
|
1860
1881
|
}
|
|
1861
|
-
const
|
|
1862
|
-
const _ =
|
|
1882
|
+
const R = Y(() => {
|
|
1883
|
+
const _ = o.value, r = h.sku;
|
|
1863
1884
|
return bo(_, r);
|
|
1864
|
-
}),
|
|
1865
|
-
const _ =
|
|
1885
|
+
}), K = Y(() => {
|
|
1886
|
+
const _ = o.value, r = h.sku;
|
|
1866
1887
|
return xo(_, r);
|
|
1867
|
-
}),
|
|
1868
|
-
const _ = [...
|
|
1869
|
-
var u,
|
|
1870
|
-
const V = (
|
|
1888
|
+
}), O = Y(() => {
|
|
1889
|
+
const _ = [...o.value].computeFirst((M) => {
|
|
1890
|
+
var u, F;
|
|
1891
|
+
const V = (F = (u = M.skus) == null ? void 0 : u.find) == null ? void 0 : F.call(u, (N) => N.sku._id === h.sku._id);
|
|
1871
1892
|
return V == null ? void 0 : V.fromBalance;
|
|
1872
1893
|
}) ?? {
|
|
1873
1894
|
amount: 0,
|
|
@@ -1877,68 +1898,68 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
|
|
|
1877
1898
|
value: _,
|
|
1878
1899
|
precision: 4
|
|
1879
1900
|
})} ${r.unit.abbrev}` : "";
|
|
1880
|
-
}), Z =
|
|
1881
|
-
const _ = [...
|
|
1882
|
-
var u,
|
|
1883
|
-
const V = (
|
|
1901
|
+
}), Z = Y(() => {
|
|
1902
|
+
const _ = [...o.value].reverse().computeFirst((M) => {
|
|
1903
|
+
var u, F;
|
|
1904
|
+
const V = (F = (u = M.skus) == null ? void 0 : u.find) == null ? void 0 : F.call(u, (N) => N.sku._id === h.sku._id);
|
|
1884
1905
|
return V == null ? void 0 : V.toBalance;
|
|
1885
1906
|
}) ?? {
|
|
1886
1907
|
amount: 0,
|
|
1887
1908
|
precision: 0
|
|
1888
1909
|
}, r = h.sku;
|
|
1889
1910
|
return r ? `${Q.toFormatString({ value: _, precision: 4 })} ${r.unit.abbrev}` : "";
|
|
1890
|
-
}),
|
|
1911
|
+
}), q = Y(() => {
|
|
1891
1912
|
var M;
|
|
1892
|
-
const r =
|
|
1913
|
+
const r = o.value.flatMap((V) => {
|
|
1893
1914
|
var u;
|
|
1894
|
-
return ((u = V.skus) == null ? void 0 : u.flatMap((
|
|
1915
|
+
return ((u = V.skus) == null ? void 0 : u.flatMap((F) => F.amounts)) ?? [];
|
|
1895
1916
|
}).filter((V) => V.amount.amount < 0).reduce(
|
|
1896
1917
|
(V, u) => {
|
|
1897
|
-
const
|
|
1898
|
-
if (!
|
|
1899
|
-
const
|
|
1900
|
-
...Rt(V, Math.max(V.precision,
|
|
1901
|
-
currency:
|
|
1918
|
+
const F = u.cost;
|
|
1919
|
+
if (!F) return V;
|
|
1920
|
+
const N = {
|
|
1921
|
+
...Rt(V, Math.max(V.precision, F.precision)),
|
|
1922
|
+
currency: F.currency
|
|
1902
1923
|
};
|
|
1903
1924
|
return {
|
|
1904
|
-
...Je(
|
|
1925
|
+
...Je(N, F),
|
|
1905
1926
|
currency: V.currency
|
|
1906
1927
|
};
|
|
1907
1928
|
},
|
|
1908
1929
|
{
|
|
1909
1930
|
amount: 0,
|
|
1910
1931
|
precision: 0,
|
|
1911
|
-
currency:
|
|
1932
|
+
currency: De((M = m.currentCountry) == null ? void 0 : M.value)
|
|
1912
1933
|
}
|
|
1913
1934
|
);
|
|
1914
|
-
return
|
|
1935
|
+
return Me(r, !1, r.precision);
|
|
1915
1936
|
});
|
|
1916
1937
|
function ue() {
|
|
1917
|
-
const { startDate: _, endDate: r } = zt(
|
|
1918
|
-
_ !== null && r !== null && (
|
|
1938
|
+
const { startDate: _, endDate: r } = zt(g.value);
|
|
1939
|
+
_ !== null && r !== null && (g.value = {
|
|
1919
1940
|
startDate: _,
|
|
1920
1941
|
endDate: r
|
|
1921
1942
|
});
|
|
1922
1943
|
}
|
|
1923
|
-
const ee =
|
|
1924
|
-
function
|
|
1944
|
+
const ee = Y(() => l("inventory.ingredient.valuationMethod.WAVG"));
|
|
1945
|
+
function v(_, r) {
|
|
1925
1946
|
if (i.value === "adjustment")
|
|
1926
1947
|
return null;
|
|
1927
|
-
const M =
|
|
1928
|
-
(
|
|
1948
|
+
const M = T.value.filter(
|
|
1949
|
+
(F) => F.mechanism === i.value && F.skuId === h.sku._id
|
|
1929
1950
|
);
|
|
1930
1951
|
if (M.length === 0) return null;
|
|
1931
|
-
const V = M.find((
|
|
1932
|
-
const
|
|
1933
|
-
return (
|
|
1952
|
+
const V = M.find((F) => {
|
|
1953
|
+
const N = F.meta;
|
|
1954
|
+
return (N == null ? void 0 : N.adjustmentId) === _;
|
|
1934
1955
|
});
|
|
1935
1956
|
if (V) return V.cost;
|
|
1936
|
-
const u = [...M].filter((
|
|
1957
|
+
const u = [...M].filter((F) => new Date(F.snapshotAt) <= new Date(r)).sort((F, N) => new Date(N.snapshotAt).getTime() - new Date(F.snapshotAt).getTime());
|
|
1937
1958
|
return u.length > 0 ? u[0].cost : null;
|
|
1938
1959
|
}
|
|
1939
|
-
const $ =
|
|
1940
|
-
var V, u,
|
|
1941
|
-
const _ = [...
|
|
1960
|
+
const $ = Y(() => {
|
|
1961
|
+
var V, u, F, N, ne, re;
|
|
1962
|
+
const _ = [...o.value].reverse().find((J) => {
|
|
1942
1963
|
var te, oe;
|
|
1943
1964
|
return (oe = (te = J.skus) == null ? void 0 : te.find) == null ? void 0 : oe.call(te, (ie) => ie.sku._id === h.sku._id);
|
|
1944
1965
|
});
|
|
@@ -1949,14 +1970,14 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
|
|
|
1949
1970
|
if (i.value === "adjustment") {
|
|
1950
1971
|
const J = [...r.amounts].reverse()[0], te = {
|
|
1951
1972
|
amount: ((u = J.cost) == null ? void 0 : u.amount) ?? 0,
|
|
1952
|
-
precision: ((
|
|
1973
|
+
precision: ((F = J.cost) == null ? void 0 : F.precision) ?? 0
|
|
1953
1974
|
}, oe = J.amount, ie = oe.amount == 0 ? Q.fromNumber(0) : Q.divide([te, oe]);
|
|
1954
1975
|
return {
|
|
1955
1976
|
...Q.multiply([ie, M]),
|
|
1956
|
-
currency: ((
|
|
1977
|
+
currency: ((N = J.cost) == null ? void 0 : N.currency) || De(((ne = m.currentCountry) == null ? void 0 : ne.value) ?? et)
|
|
1957
1978
|
};
|
|
1958
1979
|
} else {
|
|
1959
|
-
const J = _.effectiveAt ??
|
|
1980
|
+
const J = _.effectiveAt ?? Ie(_._id), te = v(
|
|
1960
1981
|
_._id,
|
|
1961
1982
|
J ?? (/* @__PURE__ */ new Date()).toISOString()
|
|
1962
1983
|
);
|
|
@@ -1964,14 +1985,14 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
|
|
|
1964
1985
|
const oe = Q.fromDinero(te);
|
|
1965
1986
|
return {
|
|
1966
1987
|
...Q.multiply([oe, M]),
|
|
1967
|
-
currency: te.currency ||
|
|
1988
|
+
currency: te.currency || De(((re = m.currentCountry) == null ? void 0 : re.value) ?? et)
|
|
1968
1989
|
};
|
|
1969
1990
|
}
|
|
1970
|
-
}), G =
|
|
1991
|
+
}), G = Y(() => {
|
|
1971
1992
|
var M;
|
|
1972
|
-
const _ = [...
|
|
1973
|
-
var
|
|
1974
|
-
const u = (
|
|
1993
|
+
const _ = [...o.value].reverse().computeFirst((V) => {
|
|
1994
|
+
var F, N;
|
|
1995
|
+
const u = (N = (F = V.skus) == null ? void 0 : F.find) == null ? void 0 : N.call(F, (ne) => ne.sku._id === h.sku._id);
|
|
1975
1996
|
return u == null ? void 0 : u.toCostBalances;
|
|
1976
1997
|
});
|
|
1977
1998
|
return _ ? {
|
|
@@ -1979,57 +2000,57 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
|
|
|
1979
2000
|
amount: 0,
|
|
1980
2001
|
precision: 0
|
|
1981
2002
|
}),
|
|
1982
|
-
currency:
|
|
2003
|
+
currency: De((M = m.currentCountry) == null ? void 0 : M.value)
|
|
1983
2004
|
} : "No data";
|
|
1984
|
-
}), P =
|
|
1985
|
-
function
|
|
1986
|
-
const { startDate: _, endDate: r } = Gt(
|
|
1987
|
-
_ !== null && r !== null && (
|
|
2005
|
+
}), P = Y(() => h.sku.valuation === tt.Enum.FIFO ? G.value : $.value);
|
|
2006
|
+
function L() {
|
|
2007
|
+
const { startDate: _, endDate: r } = Gt(g.value);
|
|
2008
|
+
_ !== null && r !== null && (g.value = {
|
|
1988
2009
|
startDate: _,
|
|
1989
2010
|
endDate: r
|
|
1990
2011
|
});
|
|
1991
2012
|
}
|
|
1992
|
-
const E =
|
|
2013
|
+
const E = Ye(h, "show");
|
|
1993
2014
|
return (_, r) => {
|
|
1994
|
-
const M =
|
|
1995
|
-
return
|
|
2015
|
+
const M = H("FmButton"), V = H("FmField"), u = H("FmDateRangePicker"), F = H("FmSpacer"), N = H("FmCircularProgress"), ne = H("FmIcon"), re = H("FmTooltip"), J = H("FmMenuDivider"), te = H("FmChip"), oe = H("FmSelect"), ie = H("FmCardSection"), Fe = H("FmCard"), gt = H("FmSideSheet");
|
|
2016
|
+
return D(), X(gt, {
|
|
1996
2017
|
"dismiss-away": "",
|
|
1997
2018
|
modelValue: a(E),
|
|
1998
|
-
"onUpdate:modelValue": r[5] || (r[5] = (
|
|
2019
|
+
"onUpdate:modelValue": r[5] || (r[5] = (Ae) => Ee(E) ? E.value = Ae : null),
|
|
1999
2020
|
"close-button": !1,
|
|
2000
2021
|
"max-width": 560
|
|
2001
2022
|
}, {
|
|
2002
|
-
"side-sheet-header":
|
|
2023
|
+
"side-sheet-header": U(() => [
|
|
2003
2024
|
e("div", So, [
|
|
2004
|
-
e("div", wo,
|
|
2025
|
+
e("div", wo, p(a(l)("inventory.stock.history.title", [_.sku.name])), 1),
|
|
2005
2026
|
y(M, {
|
|
2006
2027
|
variant: "tertiary",
|
|
2007
2028
|
"prepend-icon": "close",
|
|
2008
|
-
onClick: r[0] || (r[0] = (
|
|
2029
|
+
onClick: r[0] || (r[0] = (Ae) => E.value = !1)
|
|
2009
2030
|
})
|
|
2010
2031
|
])
|
|
2011
2032
|
]),
|
|
2012
|
-
default:
|
|
2013
|
-
var
|
|
2033
|
+
default: U(() => {
|
|
2034
|
+
var Ae;
|
|
2014
2035
|
return [
|
|
2015
2036
|
e("div", Fo, [
|
|
2016
2037
|
e("div", Ao, [
|
|
2017
2038
|
e("div", $o, [
|
|
2018
2039
|
y(u, {
|
|
2019
|
-
modelValue:
|
|
2020
|
-
"onUpdate:modelValue": r[1] || (r[1] = (de) =>
|
|
2040
|
+
modelValue: g.value,
|
|
2041
|
+
"onUpdate:modelValue": r[1] || (r[1] = (de) => g.value = de),
|
|
2021
2042
|
"show-predefined-range": "",
|
|
2022
2043
|
"start-label": "",
|
|
2023
2044
|
"end-label": "",
|
|
2024
2045
|
"z-index": 50
|
|
2025
2046
|
}, {
|
|
2026
|
-
"trigger-button":
|
|
2047
|
+
"trigger-button": U(({ opened: de }) => [
|
|
2027
2048
|
y(V, {
|
|
2028
2049
|
"prepend-icon": "calendar_month",
|
|
2029
2050
|
focused: de
|
|
2030
2051
|
}, {
|
|
2031
|
-
default:
|
|
2032
|
-
|
|
2052
|
+
default: U(() => [
|
|
2053
|
+
ve(p(g.value.startDate) + " - " + p(g.value.endDate), 1)
|
|
2033
2054
|
]),
|
|
2034
2055
|
_: 2
|
|
2035
2056
|
}, 1032, ["focused"])
|
|
@@ -2044,40 +2065,40 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
|
|
|
2044
2065
|
}),
|
|
2045
2066
|
y(M, {
|
|
2046
2067
|
variant: "tertiary",
|
|
2047
|
-
onClick: r[3] || (r[3] = (de) =>
|
|
2068
|
+
onClick: r[3] || (r[3] = (de) => L()),
|
|
2048
2069
|
"prepend-icon": "navigate_next"
|
|
2049
2070
|
})
|
|
2050
2071
|
]),
|
|
2051
|
-
B.value ? (
|
|
2052
|
-
y(
|
|
2053
|
-
y(
|
|
2054
|
-
e("div", Co,
|
|
2055
|
-
y(
|
|
2056
|
-
y(
|
|
2057
|
-
])) : t.value && ((
|
|
2058
|
-
y(
|
|
2059
|
-
default:
|
|
2072
|
+
B.value ? (D(), W("div", Vo, [
|
|
2073
|
+
y(F),
|
|
2074
|
+
y(N, { size: "xl" }),
|
|
2075
|
+
e("div", Co, p(a(l)("inventory.stock.history.loading")), 1),
|
|
2076
|
+
y(F),
|
|
2077
|
+
y(F)
|
|
2078
|
+
])) : t.value && ((Ae = t.value) == null ? void 0 : Ae.length) > 0 ? (D(), W("div", Do, [
|
|
2079
|
+
y(Fe, { variant: "outlined" }, {
|
|
2080
|
+
default: U(() => [
|
|
2060
2081
|
y(ie, { class: "flex flex-col gap-4" }, {
|
|
2061
|
-
default:
|
|
2062
|
-
e("div",
|
|
2063
|
-
e("div", Mo,
|
|
2082
|
+
default: U(() => [
|
|
2083
|
+
e("div", jo, [
|
|
2084
|
+
e("div", Mo, p(a(l)("inventory.stock.history.summary.title")), 1)
|
|
2064
2085
|
]),
|
|
2065
2086
|
e("div", Bo, [
|
|
2066
2087
|
e("div", Io, [
|
|
2067
|
-
e("div", To,
|
|
2068
|
-
e("div",
|
|
2088
|
+
e("div", To, p(a(l)("inventory.stock.history.summary.totalPurchase")), 1),
|
|
2089
|
+
e("div", Ho, p(R.value.PURCHASE), 1)
|
|
2069
2090
|
]),
|
|
2070
|
-
e("div",
|
|
2091
|
+
e("div", Uo, [
|
|
2071
2092
|
e("div", Eo, [
|
|
2072
|
-
|
|
2073
|
-
|
|
2093
|
+
ve(p(a(l)("inventory.stock.history.summary.totalSales")) + " ", 1),
|
|
2094
|
+
K.value != null ? (D(), X(re, {
|
|
2074
2095
|
key: 0,
|
|
2075
2096
|
variant: "plain",
|
|
2076
2097
|
placement: "top",
|
|
2077
|
-
content: `Before: ${
|
|
2098
|
+
content: `Before: ${K.value}`,
|
|
2078
2099
|
"z-index": 50
|
|
2079
2100
|
}, {
|
|
2080
|
-
default:
|
|
2101
|
+
default: U(() => [
|
|
2081
2102
|
y(ne, {
|
|
2082
2103
|
name: "warning",
|
|
2083
2104
|
size: "sm"
|
|
@@ -2086,52 +2107,52 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
|
|
|
2086
2107
|
_: 1
|
|
2087
2108
|
}, 8, ["content"])) : se("", !0)
|
|
2088
2109
|
]),
|
|
2089
|
-
e("div", Po,
|
|
2110
|
+
e("div", Po, p(R.value.SALES), 1)
|
|
2090
2111
|
]),
|
|
2091
2112
|
e("div", Ro, [
|
|
2092
|
-
e("div", Oo,
|
|
2093
|
-
e("div", No,
|
|
2113
|
+
e("div", Oo, p(a(l)("inventory.stock.history.summary.totalLose")), 1),
|
|
2114
|
+
e("div", No, p(R.value.LOSE), 1)
|
|
2094
2115
|
]),
|
|
2095
2116
|
e("div", Yo, [
|
|
2096
|
-
e("div", Lo,
|
|
2097
|
-
e("div", zo,
|
|
2117
|
+
e("div", Lo, p(a(l)("inventory.stock.history.summary.totalRequest")), 1),
|
|
2118
|
+
e("div", zo, p(R.value.REQUEST), 1)
|
|
2098
2119
|
]),
|
|
2099
2120
|
e("div", Go, [
|
|
2100
|
-
e("div", Wo,
|
|
2101
|
-
e("div", Ko,
|
|
2121
|
+
e("div", Wo, p(a(l)("inventory.stock.history.summary.totalReceive")), 1),
|
|
2122
|
+
e("div", Ko, p(R.value.RECEIVE), 1)
|
|
2102
2123
|
]),
|
|
2103
2124
|
e("div", qo, [
|
|
2104
|
-
e("div", Xo,
|
|
2105
|
-
e("div", Jo,
|
|
2125
|
+
e("div", Xo, p(a(l)("inventory.stock.history.summary.totalConvert")), 1),
|
|
2126
|
+
e("div", Jo, p(R.value.CONVERT), 1)
|
|
2106
2127
|
]),
|
|
2107
2128
|
e("div", Qo, [
|
|
2108
|
-
e("div", Zo,
|
|
2109
|
-
e("div", es,
|
|
2129
|
+
e("div", Zo, p(a(l)("inventory.stock.history.summary.totalDamage")), 1),
|
|
2130
|
+
e("div", es, p(R.value.DAMAGE), 1)
|
|
2110
2131
|
]),
|
|
2111
2132
|
e("div", ts, [
|
|
2112
|
-
e("div", ns,
|
|
2113
|
-
e("div", os,
|
|
2133
|
+
e("div", ns, p(a(l)("inventory.stock.history.summary.openingBalance")), 1),
|
|
2134
|
+
e("div", os, p(O.value), 1)
|
|
2114
2135
|
]),
|
|
2115
2136
|
e("div", ss, [
|
|
2116
|
-
e("div", as,
|
|
2117
|
-
e("div", ls,
|
|
2137
|
+
e("div", as, p(a(l)("inventory.stock.history.summary.lastStockBalance")), 1),
|
|
2138
|
+
e("div", ls, p(Z.value), 1)
|
|
2118
2139
|
])
|
|
2119
2140
|
]),
|
|
2120
|
-
a(c).enableTotalCost ? (
|
|
2141
|
+
a(c).enableTotalCost ? (D(), W("div", rs, [
|
|
2121
2142
|
y(J, { class: "w-full" }),
|
|
2122
2143
|
e("div", is, [
|
|
2123
2144
|
e("div", us, [
|
|
2124
2145
|
y(nt, { "z-index": 50 }, {
|
|
2125
|
-
default:
|
|
2146
|
+
default: U(() => [
|
|
2126
2147
|
e("div", cs, [
|
|
2127
|
-
|
|
2148
|
+
ve(p(a(l)("inventory.stock.history.estimatedValue")) + " ", 1),
|
|
2128
2149
|
y(re, {
|
|
2129
2150
|
variant: "plain",
|
|
2130
2151
|
placement: "top",
|
|
2131
2152
|
content: `[${ee.value}] ${a(l)("inventory.stock.history.estimatedValueTooltip")}`,
|
|
2132
2153
|
"z-index": 50
|
|
2133
2154
|
}, {
|
|
2134
|
-
default:
|
|
2155
|
+
default: U(() => [
|
|
2135
2156
|
y(ne, {
|
|
2136
2157
|
name: "help",
|
|
2137
2158
|
size: "sm"
|
|
@@ -2144,18 +2165,18 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
|
|
|
2144
2165
|
_: 1
|
|
2145
2166
|
}),
|
|
2146
2167
|
e("div", ds, [
|
|
2147
|
-
_.sku.valuation === a(tt).Enum.FIFO ? (
|
|
2168
|
+
_.sku.valuation === a(tt).Enum.FIFO ? (D(), W(le, { key: 0 }, [
|
|
2148
2169
|
y(te, {
|
|
2149
2170
|
label: "FIFO",
|
|
2150
2171
|
compact: ""
|
|
2151
2172
|
}),
|
|
2152
|
-
|
|
2173
|
+
ve(" " + p(typeof P.value != "string" ? a(Me)(
|
|
2153
2174
|
P.value,
|
|
2154
2175
|
!1,
|
|
2155
2176
|
P.value.precision
|
|
2156
2177
|
) : P.value), 1)
|
|
2157
|
-
], 64)) : (
|
|
2158
|
-
|
|
2178
|
+
], 64)) : (D(), W(le, { key: 1 }, [
|
|
2179
|
+
ve(p(typeof P.value != "string" ? a(Me)(
|
|
2159
2180
|
P.value,
|
|
2160
2181
|
!1,
|
|
2161
2182
|
P.value.precision
|
|
@@ -2173,18 +2194,18 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
|
|
|
2173
2194
|
]),
|
|
2174
2195
|
e("div", ms, [
|
|
2175
2196
|
y(nt, { "z-index": 50 }, {
|
|
2176
|
-
default:
|
|
2197
|
+
default: U(() => [
|
|
2177
2198
|
e("div", fs, [
|
|
2178
|
-
|
|
2199
|
+
ve(p(a(l)("inventory.stock.history.costSold")) + " ", 1),
|
|
2179
2200
|
y(re, {
|
|
2180
2201
|
variant: "plain",
|
|
2181
2202
|
placement: "top",
|
|
2182
2203
|
"z-index": 50
|
|
2183
2204
|
}, {
|
|
2184
|
-
content:
|
|
2185
|
-
e("div",
|
|
2205
|
+
content: U(() => [
|
|
2206
|
+
e("div", vs, p(a(l)("inventory.stock.history.costSoldTooltip")), 1)
|
|
2186
2207
|
]),
|
|
2187
|
-
default:
|
|
2208
|
+
default: U(() => [
|
|
2188
2209
|
y(ne, {
|
|
2189
2210
|
name: "help",
|
|
2190
2211
|
size: "sm"
|
|
@@ -2196,7 +2217,7 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
|
|
|
2196
2217
|
]),
|
|
2197
2218
|
_: 1
|
|
2198
2219
|
}),
|
|
2199
|
-
e("div",
|
|
2220
|
+
e("div", ps, p(q.value), 1)
|
|
2200
2221
|
])
|
|
2201
2222
|
])
|
|
2202
2223
|
])) : se("", !0)
|
|
@@ -2207,31 +2228,31 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
|
|
|
2207
2228
|
_: 1
|
|
2208
2229
|
}),
|
|
2209
2230
|
r[6] || (r[6] = e("div", null, null, -1)),
|
|
2210
|
-
(
|
|
2231
|
+
(D(!0), W(le, null, ce(t.value, (de) => (D(), W(le, {
|
|
2211
2232
|
key: de.date
|
|
2212
2233
|
}, [
|
|
2213
|
-
_.sku ? (
|
|
2234
|
+
_.sku ? (D(), X(go, {
|
|
2214
2235
|
key: 0,
|
|
2215
2236
|
record: de,
|
|
2216
2237
|
sku: _.sku,
|
|
2217
|
-
bills:
|
|
2218
|
-
"unit-cost-history":
|
|
2238
|
+
bills: n.value,
|
|
2239
|
+
"unit-cost-history": T.value,
|
|
2219
2240
|
"cost-mechanism": i.value,
|
|
2220
|
-
onRefreshHistory:
|
|
2241
|
+
onRefreshHistory: x
|
|
2221
2242
|
}, null, 8, ["record", "sku", "bills", "unit-cost-history", "cost-mechanism"])) : se("", !0)
|
|
2222
2243
|
], 64))), 128))
|
|
2223
|
-
])) : (
|
|
2224
|
-
y(
|
|
2244
|
+
])) : (D(), W("div", ys, [
|
|
2245
|
+
y(F),
|
|
2225
2246
|
e("div", null, [
|
|
2226
2247
|
e("img", {
|
|
2227
2248
|
src: a(Xt),
|
|
2228
2249
|
alt: "List is empty"
|
|
2229
2250
|
}, null, 8, _s)
|
|
2230
2251
|
]),
|
|
2231
|
-
e("div", ks,
|
|
2232
|
-
e("div", hs,
|
|
2233
|
-
y(
|
|
2234
|
-
y(
|
|
2252
|
+
e("div", ks, p(a(l)("inventory.stock.history.noRecords")), 1),
|
|
2253
|
+
e("div", hs, p(a(l)("inventory.stock.history.changeDateRange")), 1),
|
|
2254
|
+
y(F),
|
|
2255
|
+
y(F)
|
|
2235
2256
|
]))
|
|
2236
2257
|
])
|
|
2237
2258
|
];
|
|
@@ -2246,13 +2267,13 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
|
|
|
2246
2267
|
}, xs = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ss = { class: "flex flex-col gap-8" }, ws = { class: "flex flex-col" }, Fs = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, As = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary line-clamp-1" }, Qs = /* @__PURE__ */ me({
|
|
2247
2268
|
__name: "StockView",
|
|
2248
2269
|
setup(k) {
|
|
2249
|
-
const { t: m } = fe(), d =
|
|
2250
|
-
s.watchLocation(
|
|
2251
|
-
const f =
|
|
2270
|
+
const { t: m } = fe(), d = Re(), s = xe(), j = Oe(), w = kt(), c = we(), l = dt(), h = Zt(), { columnDefs: B } = un(), b = Ne(), i = Se();
|
|
2271
|
+
s.watchLocation(x);
|
|
2272
|
+
const f = Y(
|
|
2252
2273
|
() => new Set(h.getAvailableItems(h.businessSubsidiaryId))
|
|
2253
|
-
),
|
|
2254
|
-
async function
|
|
2255
|
-
|
|
2274
|
+
), T = z(!1);
|
|
2275
|
+
async function g() {
|
|
2276
|
+
b.open({
|
|
2256
2277
|
title: m("inventory.stock.stock_balance.refreshBalance"),
|
|
2257
2278
|
message: m("inventory.stock.stock_balance.refreshBalanceDescription"),
|
|
2258
2279
|
closeButton: !0,
|
|
@@ -2273,11 +2294,11 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
|
|
|
2273
2294
|
});
|
|
2274
2295
|
});
|
|
2275
2296
|
}
|
|
2276
|
-
async function
|
|
2297
|
+
async function x() {
|
|
2277
2298
|
if (s._currentLocation) {
|
|
2278
|
-
|
|
2299
|
+
T.value = !0;
|
|
2279
2300
|
try {
|
|
2280
|
-
await
|
|
2301
|
+
await j.readStockBalance(), await j.readProductBalance(), await l.readStockEstimateBalance();
|
|
2281
2302
|
} catch (ee) {
|
|
2282
2303
|
i.open({
|
|
2283
2304
|
title: m("inventory.stock.error.title"),
|
|
@@ -2285,18 +2306,18 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
|
|
|
2285
2306
|
type: "error"
|
|
2286
2307
|
}), console.error("error on fetch stock balance", ee);
|
|
2287
2308
|
} finally {
|
|
2288
|
-
|
|
2309
|
+
T.value = !1;
|
|
2289
2310
|
}
|
|
2290
2311
|
}
|
|
2291
2312
|
}
|
|
2292
|
-
const
|
|
2313
|
+
const o = Y(() => [
|
|
2293
2314
|
{
|
|
2294
2315
|
type: "string",
|
|
2295
2316
|
key: "status",
|
|
2296
2317
|
entity: "sku",
|
|
2297
2318
|
values: ["Active", "Inactive"]
|
|
2298
2319
|
}
|
|
2299
|
-
]), t =
|
|
2320
|
+
]), t = z({
|
|
2300
2321
|
logic: "AND",
|
|
2301
2322
|
rules: [
|
|
2302
2323
|
{
|
|
@@ -2306,37 +2327,37 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
|
|
|
2306
2327
|
type: "string"
|
|
2307
2328
|
}
|
|
2308
2329
|
]
|
|
2309
|
-
}),
|
|
2330
|
+
}), n = Y(() => {
|
|
2310
2331
|
var $, G, P;
|
|
2311
|
-
const ee = t.value ? en.build(t.value) : null,
|
|
2312
|
-
for (const
|
|
2332
|
+
const ee = t.value ? en.build(t.value) : null, v = [];
|
|
2333
|
+
for (const L of d.skus) {
|
|
2313
2334
|
let E = !0;
|
|
2314
|
-
if (h.isEnabled &&
|
|
2335
|
+
if (h.isEnabled && C.value && f.value && E && (E = f.value.has(L._id)), ee && E && (E = tn(
|
|
2315
2336
|
{
|
|
2316
|
-
status:
|
|
2337
|
+
status: L.isInactive ? "Inactive" : "Active"
|
|
2317
2338
|
},
|
|
2318
2339
|
ee
|
|
2319
2340
|
)), E) {
|
|
2320
|
-
const _ =
|
|
2321
|
-
let r = (G = ($ =
|
|
2322
|
-
(u) => u.id ===
|
|
2341
|
+
const _ = L.trackingMeasurement;
|
|
2342
|
+
let r = (G = ($ = j.stockBalance.skus) == null ? void 0 : $.find(
|
|
2343
|
+
(u) => u.id === L._id
|
|
2323
2344
|
)) == null ? void 0 : G.balance, M = l.inventoryForecast.skus.find(
|
|
2324
|
-
(u) => u.id ===
|
|
2345
|
+
(u) => u.id === L._id
|
|
2325
2346
|
);
|
|
2326
2347
|
const V = {
|
|
2327
|
-
...
|
|
2348
|
+
...L,
|
|
2328
2349
|
balance: r ?? {
|
|
2329
2350
|
amount: 0,
|
|
2330
2351
|
precision: 0
|
|
2331
2352
|
},
|
|
2332
2353
|
day: (M == null ? void 0 : M.depletionDays) ?? void 0,
|
|
2333
|
-
trackingUnitAbbrev: _ ? ((P =
|
|
2354
|
+
trackingUnitAbbrev: _ ? ((P = L.unit.measurements.find((u) => u.id === _)) == null ? void 0 : P.abbrev) ?? "" : L.unit.abbrev
|
|
2334
2355
|
};
|
|
2335
|
-
|
|
2356
|
+
v.push(V);
|
|
2336
2357
|
}
|
|
2337
2358
|
}
|
|
2338
|
-
return
|
|
2339
|
-
}),
|
|
2359
|
+
return v;
|
|
2360
|
+
}), S = z(""), C = z(!0), { breakpoints: A } = Bt(), I = Y(() => A.value.xs || A.value.sm), R = Y(() => I.value ? 10 : 20), K = St(), O = Y(() => [
|
|
2340
2361
|
{
|
|
2341
2362
|
label: m("inventory.stock.stock_balance.refreshBalance"),
|
|
2342
2363
|
value: "refresh-balance",
|
|
@@ -2356,61 +2377,61 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
|
|
|
2356
2377
|
value: "stockAdjustment",
|
|
2357
2378
|
isAdminOnly: !0
|
|
2358
2379
|
}
|
|
2359
|
-
]), Z =
|
|
2360
|
-
function
|
|
2380
|
+
]), Z = z(!1);
|
|
2381
|
+
function q() {
|
|
2361
2382
|
Z.value = !0;
|
|
2362
2383
|
}
|
|
2363
2384
|
function ue(ee) {
|
|
2364
2385
|
switch (ee) {
|
|
2365
2386
|
case "refresh-balance":
|
|
2366
|
-
return
|
|
2387
|
+
return g();
|
|
2367
2388
|
case "refresh":
|
|
2368
|
-
return
|
|
2389
|
+
return x();
|
|
2369
2390
|
case "export":
|
|
2370
|
-
return sn(
|
|
2391
|
+
return sn(n.value);
|
|
2371
2392
|
case "stockAdjustment":
|
|
2372
|
-
return
|
|
2393
|
+
return q();
|
|
2373
2394
|
}
|
|
2374
2395
|
}
|
|
2375
|
-
return (ee,
|
|
2376
|
-
const $ =
|
|
2377
|
-
return
|
|
2396
|
+
return (ee, v) => {
|
|
2397
|
+
const $ = H("FmSwitch"), G = H("FmTable");
|
|
2398
|
+
return D(), X(wt, {
|
|
2378
2399
|
title: a(m)("inventory.stock.title"),
|
|
2379
|
-
actions:
|
|
2400
|
+
actions: O.value,
|
|
2380
2401
|
"onClick:action": ue
|
|
2381
2402
|
}, {
|
|
2382
|
-
default:
|
|
2383
|
-
var P,
|
|
2403
|
+
default: U(() => {
|
|
2404
|
+
var P, L, E, _;
|
|
2384
2405
|
return [
|
|
2385
2406
|
e("div", {
|
|
2386
|
-
class:
|
|
2407
|
+
class: ge([
|
|
2387
2408
|
"flex flex-col gap-8 max-h-full",
|
|
2388
2409
|
{
|
|
2389
|
-
"p-0":
|
|
2390
|
-
"px-24 ": !
|
|
2410
|
+
"p-0": I.value,
|
|
2411
|
+
"px-24 ": !I.value
|
|
2391
2412
|
}
|
|
2392
2413
|
])
|
|
2393
2414
|
}, [
|
|
2394
2415
|
y(qt, {
|
|
2395
2416
|
searchable: "",
|
|
2396
2417
|
"change-location": "",
|
|
2397
|
-
search:
|
|
2398
|
-
"onUpdate:search":
|
|
2418
|
+
search: S.value,
|
|
2419
|
+
"onUpdate:search": v[1] || (v[1] = (r) => S.value = r),
|
|
2399
2420
|
"hide-filter-options": !0,
|
|
2400
2421
|
filterable: "",
|
|
2401
|
-
"filter-attributes":
|
|
2422
|
+
"filter-attributes": o.value,
|
|
2402
2423
|
filter: t.value,
|
|
2403
|
-
"onUpdate:filter":
|
|
2424
|
+
"onUpdate:filter": v[2] || (v[2] = (r) => t.value = r)
|
|
2404
2425
|
}, {
|
|
2405
|
-
default:
|
|
2406
|
-
a(h).isEnabled ? (
|
|
2407
|
-
e("span", xs,
|
|
2408
|
-
y(
|
|
2426
|
+
default: U(() => [
|
|
2427
|
+
a(h).isEnabled ? (D(), W("div", bs, [
|
|
2428
|
+
e("span", xs, p(a(m)("inventory.integration.netsuite.subsidiaryHierarchy.filtering")), 1),
|
|
2429
|
+
y(jt),
|
|
2409
2430
|
y(Xe, null, {
|
|
2410
|
-
default:
|
|
2431
|
+
default: U(() => [
|
|
2411
2432
|
y($, {
|
|
2412
|
-
modelValue:
|
|
2413
|
-
"onUpdate:modelValue":
|
|
2433
|
+
modelValue: C.value,
|
|
2434
|
+
"onUpdate:modelValue": v[0] || (v[0] = (r) => C.value = r)
|
|
2414
2435
|
}, null, 8, ["modelValue"])
|
|
2415
2436
|
]),
|
|
2416
2437
|
_: 1
|
|
@@ -2419,30 +2440,30 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
|
|
|
2419
2440
|
]),
|
|
2420
2441
|
_: 1
|
|
2421
2442
|
}, 8, ["search", "filter-attributes", "filter"]),
|
|
2422
|
-
(
|
|
2423
|
-
style: ct(a(
|
|
2443
|
+
(D(), X(G, {
|
|
2444
|
+
style: ct(a(K).tableHeight),
|
|
2424
2445
|
"column-defs": a(B),
|
|
2425
|
-
"row-data":
|
|
2426
|
-
"search-value":
|
|
2427
|
-
loading:
|
|
2446
|
+
"row-data": n.value,
|
|
2447
|
+
"search-value": S.value,
|
|
2448
|
+
loading: T.value || !a(s)._currentLocation,
|
|
2428
2449
|
key: (P = a(s)._currentLocation) == null ? void 0 : P.dbName,
|
|
2429
|
-
onRowClick:
|
|
2430
|
-
"page-size":
|
|
2450
|
+
onRowClick: v[3] || (v[3] = (r) => a(w).showSkuHistory(r.original)),
|
|
2451
|
+
"page-size": R.value
|
|
2431
2452
|
}, {
|
|
2432
|
-
"list-row":
|
|
2453
|
+
"list-row": U((r) => [
|
|
2433
2454
|
y(Qt, {
|
|
2434
2455
|
row: r,
|
|
2435
|
-
onRowClick: a(
|
|
2456
|
+
onRowClick: a(w).showSkuHistory
|
|
2436
2457
|
}, {
|
|
2437
|
-
default:
|
|
2438
|
-
var V, u,
|
|
2458
|
+
default: U((M) => {
|
|
2459
|
+
var V, u, F, N, ne, re, J, te, oe, ie;
|
|
2439
2460
|
return [
|
|
2440
2461
|
e("div", Ss, [
|
|
2441
2462
|
e("div", ws, [
|
|
2442
2463
|
e("div", Fs, [
|
|
2443
2464
|
y(a(lt), {
|
|
2444
|
-
render: (
|
|
2445
|
-
props: (ne = (
|
|
2465
|
+
render: (F = (u = (V = M.code) == null ? void 0 : V.column) == null ? void 0 : u.columnDef) == null ? void 0 : F.cell,
|
|
2466
|
+
props: (ne = (N = M.code) == null ? void 0 : N.getContext) == null ? void 0 : ne.call(N)
|
|
2446
2467
|
}, null, 8, ["render", "props"])
|
|
2447
2468
|
]),
|
|
2448
2469
|
e("div", As, [
|
|
@@ -2453,7 +2474,7 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
|
|
|
2453
2474
|
])
|
|
2454
2475
|
]),
|
|
2455
2476
|
e("div", null, [
|
|
2456
|
-
y(
|
|
2477
|
+
y(Ke, {
|
|
2457
2478
|
days: r.original.day
|
|
2458
2479
|
}, null, 8, ["days"])
|
|
2459
2480
|
]),
|
|
@@ -2475,15 +2496,15 @@ const So = { class: "flex items-center w-full fm-typo-en-title-md-800" }, wo = {
|
|
|
2475
2496
|
_: 1
|
|
2476
2497
|
}, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"]))
|
|
2477
2498
|
], 2),
|
|
2478
|
-
(
|
|
2479
|
-
(
|
|
2480
|
-
(E = a(
|
|
2481
|
-
(_ = a(
|
|
2482
|
-
Z.value ? (
|
|
2499
|
+
(D(), X(xt, { to: "body" }, [
|
|
2500
|
+
(L = a(w).stockHistoryProps) != null && L.sku ? (D(), X(gs, Le(ze({ key: 0 }, a(w).stockHistoryProps)), null, 16)) : se("", !0),
|
|
2501
|
+
(E = a(w).convertSkuDialogProps) != null && E.sku ? (D(), X(wn, Le(ze({ key: 1 }, a(w).convertSkuDialogProps)), null, 16)) : se("", !0),
|
|
2502
|
+
(_ = a(w).adjustSkuDialogProps) != null && _.stock ? (D(), X(Hn, Le(ze({ key: 2 }, a(w).adjustSkuDialogProps)), null, 16)) : se("", !0),
|
|
2503
|
+
Z.value ? (D(), X(qn, {
|
|
2483
2504
|
key: 3,
|
|
2484
2505
|
show: Z.value,
|
|
2485
|
-
"onUpdate:show":
|
|
2486
|
-
onSubmitted:
|
|
2506
|
+
"onUpdate:show": v[4] || (v[4] = (r) => Z.value = r),
|
|
2507
|
+
onSubmitted: v[5] || (v[5] = (r) => x())
|
|
2487
2508
|
}, null, 8, ["show"])) : se("", !0)
|
|
2488
2509
|
]))
|
|
2489
2510
|
];
|