@feedmepos/mf-inventory-portal 1.5.8 → 1.5.9-dev.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{App-CkuUHPEo.js → App-CRKhmCwm.js} +4 -4
- package/dist/{ApprovalView-DubepVw0.js → ApprovalView-BdvNZ3Mi.js} +7 -7
- package/dist/{BindingsDialog-B4WNBwyC.js → BindingsDialog-UieCgCDS.js} +13 -13
- package/dist/{BindingsPicker-BRrLqG1M.js → BindingsPicker-Bo7xvsut.js} +2 -2
- package/dist/{BindingsTable-CsL2_ZUy.js → BindingsTable-CUaQzSBn.js} +3 -3
- package/dist/ClosingDraftView-QgRaat2h.js +3335 -0
- package/dist/{ClosingHistoryView-C9Hidhix.js → ClosingHistoryView-C_qw6v7h.js} +469 -459
- package/dist/{ClosingTemplateView-gzJmYQLL.js → ClosingTemplateView-BAsHjB3H.js} +14 -14
- package/dist/{DefaultView-Wd26nwBn.js → DefaultView-CaWfkTXn.js} +2 -2
- package/dist/{DeliveryOrderPrintPreview-5Jm6QgAP.js → DeliveryOrderPrintPreview-Dv2fXveZ.js} +2 -2
- package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-Bye4GWOd.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-BFzPTyKA.js} +2 -2
- package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-D0u8X0Bk.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-Y_AhN6qb.js} +2 -2
- package/dist/{FmMultiselectDialog-BuXhazyF.js → FmMultiselectDialog-DT28lMdK.js} +1 -1
- package/dist/{FmMultiselectDialog-CrbCQvck.js → FmMultiselectDialog-e4dbq-bB.js} +2 -2
- package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-U0Io6FhR.js → FmUnitInput.vue_vue_type_script_setup_true_lang-CO2Uom0f.js} +111 -110
- package/dist/{ImportView-PBP1w1_z.js → ImportView-Brvxm1EN.js} +6 -6
- package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-BvlBuk3S.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-DSqbdU3A.js} +1 -1
- package/dist/{IngredientGroupView-ZavZf2r_.js → IngredientGroupView-CqqD1_5X.js} +5 -5
- package/dist/{IngredientsView-DXKIqdoR.js → IngredientsView-BmOSo8oo.js} +17 -17
- package/dist/{IntegrationExplorerView-D-7q6p_s.js → IntegrationExplorerView-CZH3568k.js} +5 -5
- package/dist/{IntegrationView-ByvhMaCO.js → IntegrationView-CJv9Ps4v.js} +13 -13
- package/dist/{InventoryBindingForm-DAAeny2A.js → InventoryBindingForm-BZVAC4x1.js} +1 -1
- package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-DpR5ySFv.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-BPl9weMj.js} +5 -5
- package/dist/{InventoryBindingSummary-CZBnbomV.js → InventoryBindingSummary-C7Xl5Fd7.js} +1 -1
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-BJ6gswNM.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-CyjRq3A-.js} +1 -1
- package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-mlVRfnxo.js → PremiumBadge.vue_vue_type_script_setup_true_lang-DIoYx-x4.js} +1 -1
- package/dist/{PublishView-CsMKko5l.js → PublishView-DHK3MPsP.js} +3 -3
- package/dist/{PurchaseOrderPrintPreview-B-jchSYL.js → PurchaseOrderPrintPreview-DLg01buw.js} +2 -2
- package/dist/{ReceiveRequestView-DfOcn_OW.js → ReceiveRequestView-B1n42VJ5.js} +25 -25
- package/dist/{RecipeView-C-1PuiaO.js → RecipeView-BOEfiTuN.js} +19 -19
- package/dist/{SettingsView-C3vB5Vjb.js → SettingsView-Bqx3woVD.js} +4 -4
- package/dist/{StockView-BAXULvMh.js → StockView-UjWpz_eL.js} +775 -765
- package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-BI_hHa88.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-BxyFAK_X.js} +1 -1
- package/dist/{SupplierView-B9y9d6C0.js → SupplierView-_zK2xohX.js} +12 -12
- package/dist/{SurchargeView-D3lq3G0g.js → SurchargeView-BtUebfil.js} +6 -6
- package/dist/{SystemTrailDialog.vue_vue_type_script_setup_true_lang-D54FjCtg.js → SystemTrailDialog.vue_vue_type_script_setup_true_lang-DF3seGmT.js} +2 -2
- package/dist/{TemplatePublishDialog.vue_vue_type_script_setup_true_lang-Bi-9US2G.js → TemplatePublishDialog.vue_vue_type_script_setup_true_lang-Bpo1u5g2.js} +1 -1
- package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-BkmO63qQ.js → TransferDetails.vue_vue_type_script_setup_true_lang-B_kdNBCT.js} +20 -20
- package/dist/{TransferTemplateView-B7hDis-b.js → TransferTemplateView-OlHTVdCG.js} +18 -18
- package/dist/{UnitCostHistoryView-DR-RJ6lO.js → UnitCostHistoryView-BIvYaMio.js} +4 -4
- package/dist/{UnitDisplayControl.vue_vue_type_script_setup_true_lang-WSYbNJL_.js → UnitDisplayControl.vue_vue_type_script_setup_true_lang-DqTis1lE.js} +4 -4
- package/dist/{UnitView-Dx3NUFp2.js → UnitView-DAtDiu3f.js} +9 -9
- package/dist/{WarehouseView-CSmq2xhS.js → WarehouseView-B3mXQpoO.js} +5 -5
- package/dist/{WastageTemplateView-Bya8Ptja.js → WastageTemplateView-BOoybeCb.js} +14 -14
- package/dist/api/error.d.ts +6 -3
- package/dist/{app-BtIUZZer.js → app-cwueji6m.js} +10353 -10377
- package/dist/app.d.ts +8 -0
- package/dist/app.js +4 -4
- package/dist/{closing-template-CY4I4oi6.js → closing-template-CobmAqhD.js} +1 -1
- package/dist/{date2-BXHREmqe.js → date2-D_-j6u1x.js} +1 -1
- package/dist/{dayjs.min-B15_mmz6.js → dayjs.min-iDeAwg0n.js} +1 -1
- package/dist/{decimal-CfCuBc7o.js → decimal-DcHr_uvI.js} +2 -2
- package/dist/{defineDeepModel-CeW3ETAv.js → defineDeepModel-BhC1n6G-.js} +1 -1
- package/dist/{duplicate-template-CTHciPHW.js → duplicate-template-Y9iggS9l.js} +1 -1
- package/dist/{export-CCbJ-2Gk.js → export-CAHG4EbP.js} +2 -2
- package/dist/{feature-RoG35971.js → feature-BhK4XmmS.js} +86 -86
- package/dist/{format-time-from-id-q1T46zz9.js → format-time-from-id-2IFiQNTX.js} +1 -1
- package/dist/{format-unit-display-DUaKGmsk.js → format-unit-display-CTYZvXcZ.js} +11 -11
- package/dist/helper/uom-rules.d.ts +12 -0
- package/dist/{import-export.helper-B2ZzXsyT.js → import-export.helper-DtWH9atw.js} +6 -6
- package/dist/{index-CKErlM6H.js → index-Ckhb0CMq.js} +1 -1
- package/dist/{index-CF466Sy_.js → index-dfAAA8HA.js} +3 -3
- package/dist/{index-BC06YbP9.js → index-iGt85nBk.js} +1 -1
- package/dist/{inventory-core-dart.default-BEB7pV9M.js → inventory-core-dart.default-R1tOn2RS.js} +1319 -1264
- package/dist/{lz-string-D3Jm7T7Q.js → lz-string-DUT6tVSg.js} +1 -1
- package/dist/{menu-usage-module-BiCPifRX.js → menu-usage-module-D7cxkbEk.js} +11 -12
- package/dist/netsuite-BiF6Fo7G.js +9381 -0
- package/dist/{number-C6mI12qg.js → number-Cqsx9s88.js} +3 -3
- package/dist/{predefined-templates-DfpzUsNl.js → predefined-templates-CHExzSjx.js} +1 -1
- package/dist/{purchase-order-template-Dq3N4vgB.js → purchase-order-template-_FfLY2u1.js} +1 -1
- package/dist/{recalculationUtils-D0A7mbSs.js → recalculationUtils-KdVSBljW.js} +1 -1
- package/dist/{rules-Dajxj04v.js → rules-DB26S6qs.js} +2 -2
- package/dist/{stock-D6d8tS4B.js → stock-n6h8HkNk.js} +1 -1
- package/dist/{supplier-CkfePT6a.js → supplier-6K9Cbfcf.js} +2 -2
- package/dist/{surcharge-C3uSQoRw.js → surcharge-BV03ItuR.js} +1 -1
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/uom-rules-CzTxRiqL.js +21 -0
- package/dist/{use-ingredient-select-dialog-C3zCgi5E.js → use-ingredient-select-dialog-Bs_4jjVy.js} +2 -2
- package/dist/{use-inventory-binding-dialog-CsDrU6sx.js → use-inventory-binding-dialog-CgtoqJ2D.js} +2 -2
- package/dist/{use-template-enabled-locations-DpZY_R7j.js → use-template-enabled-locations-C6fQtFF0.js} +2 -2
- package/dist/{use-transfer-locations-DlHF5kG-.js → use-transfer-locations-DI48leYd.js} +2 -2
- package/dist/{useHrmPermission-C1G3BVpn.js → useHrmPermission-Co1Jgyvq.js} +1 -1
- package/dist/{useNavigationMenu-tNJYWFkU.js → useNavigationMenu-JenXwvSv.js} +2 -2
- package/dist/{useSseClient-4qu-xO3k.js → useSseClient-gIA58rTS.js} +3 -3
- package/dist/views/closing-draft/helpers/export-draft.helper.d.ts +11 -2
- package/dist/{vue-i18n-eqPSat_0.js → vue-i18n-C3I0upD3.js} +331 -331
- package/dist/{xlsx-DB2JHegF.js → xlsx-4BYDayT5.js} +1 -1
- package/dist/{xlsx.util-TwDCO4ay.js → xlsx.util-CD_xD6ZX.js} +3 -3
- package/package.json +1 -1
- package/dist/ClosingDraftView-Psl49bhd.js +0 -3202
- package/dist/lodash-D9rnJgGZ.js +0 -3678
- package/dist/netsuite-CuPJ_UTs.js +0 -5708
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { defineComponent as ne, ref as g, computed as
|
|
2
|
-
import { _ as
|
|
1
|
+
import { defineComponent as ne, ref as g, computed as w, watch as ie, resolveComponent as x, openBlock as n, createElementBlock as p, createBlock as H, withModifiers as ue, createCommentVNode as b, createVNode as _, withCtx as I, createElementVNode as o, toDisplayString as a, unref as c, Fragment as G, createTextVNode as Z, renderList as le, normalizeClass as me, h as X, Teleport as ye } from "vue";
|
|
2
|
+
import { _ as pe } from "./SingleColumnLayout.vue_vue_type_script_setup_true_lang-DGlWE5I8.js";
|
|
3
3
|
import { useI18n as se, useCoreStore as ge } from "@feedmepos/mf-common";
|
|
4
|
-
import { E as
|
|
5
|
-
import { F as
|
|
6
|
-
import { _ as be } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-
|
|
7
|
-
import { useSnackbar as
|
|
8
|
-
import { u as fe } from "./stock-
|
|
9
|
-
import { g as
|
|
10
|
-
import { _ as De } from "./UnitDisplayControl.vue_vue_type_script_setup_true_lang-
|
|
11
|
-
const we = { class: "fm-typo-en-heading-lg-600" }, Se = { class: "flex flex-col gap-16" },
|
|
4
|
+
import { E as ce, B as P, a as he, u as _e } from "./app-cwueji6m.js";
|
|
5
|
+
import { F as de } from "./FmAdminBadge-DjnBAgyv.js";
|
|
6
|
+
import { _ as be } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-Y_AhN6qb.js";
|
|
7
|
+
import { useSnackbar as re, useDialog as ke } from "@feedmepos/ui-library";
|
|
8
|
+
import { u as fe } from "./stock-n6h8HkNk.js";
|
|
9
|
+
import { g as ve, f as xe } from "./recalculationUtils-KdVSBljW.js";
|
|
10
|
+
import { _ as De } from "./UnitDisplayControl.vue_vue_type_script_setup_true_lang-DqTis1lE.js";
|
|
11
|
+
const we = { class: "fm-typo-en-heading-lg-600" }, Se = { class: "flex flex-col gap-16" }, Ve = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ce = { class: "flex flex-col gap-8" }, $e = { class: "fm-typo-en-body-md-600" }, Ae = { class: "flex flex-col gap-8" }, Fe = { class: "fm-typo-en-body-md-600" }, Re = { class: "flex items-center gap-8 mb-8" }, Ie = {
|
|
12
12
|
key: 2,
|
|
13
13
|
class: "text-red-500 text-sm mt-2"
|
|
14
14
|
}, Te = { class: "fm-typo-en-body-sm-400" }, Be = {
|
|
@@ -20,7 +20,7 @@ const we = { class: "fm-typo-en-heading-lg-600" }, Se = { class: "flex flex-col
|
|
|
20
20
|
}, Oe = {
|
|
21
21
|
key: 1,
|
|
22
22
|
class: "flex flex-col gap-8"
|
|
23
|
-
}, Ee = { class: "fm-typo-en-body-sm-600" },
|
|
23
|
+
}, Ee = { class: "fm-typo-en-body-sm-600" }, Ue = { class: "flex flex-col gap-4" }, Pe = { key: 0 }, Ne = {
|
|
24
24
|
key: 1,
|
|
25
25
|
class: "flex flex-col gap-8"
|
|
26
26
|
}, Me = { class: "fm-typo-en-body-md-600" }, Ke = { class: "flex flex-col gap-8 max-h-[300px] overflow-y-auto" }, He = { class: "flex items-center justify-between" }, je = { class: "fm-typo-en-body-sm-600" }, ze = { class: "flex items-center gap-8" }, We = {
|
|
@@ -47,284 +47,284 @@ const we = { class: "fm-typo-en-heading-lg-600" }, Se = { class: "flex flex-col
|
|
|
47
47
|
showButton: { type: Boolean }
|
|
48
48
|
},
|
|
49
49
|
emits: ["submitted"],
|
|
50
|
-
setup(ae, { expose: S, emit:
|
|
51
|
-
const
|
|
52
|
-
if (!
|
|
53
|
-
const
|
|
54
|
-
return
|
|
55
|
-
}),
|
|
50
|
+
setup(ae, { expose: S, emit: V }) {
|
|
51
|
+
const M = V, { t } = se(), L = fe(), T = ce(), k = re(), D = g(!1), v = g(""), f = g(""), $ = g(!1), U = g([]), l = g(!1), s = g([]), C = g(!1), h = g([]), F = g(!1), N = w(() => ve(U.value)), O = w(() => {
|
|
52
|
+
if (!v.value) return [];
|
|
53
|
+
const d = N.value.find((e) => e.value === v.value);
|
|
54
|
+
return d ? N.value.filter((e) => e.date.getTime() > d.date.getTime()).sort((e, u) => u.date.getTime() - e.date.getTime()) : [];
|
|
55
|
+
}), j = w({
|
|
56
56
|
get: () => {
|
|
57
|
-
if (
|
|
58
|
-
const
|
|
59
|
-
return (
|
|
57
|
+
if ($.value && f.value) {
|
|
58
|
+
const d = U.value.find((e) => P(e._id) === f.value);
|
|
59
|
+
return (d == null ? void 0 : d._id) || f.value;
|
|
60
60
|
}
|
|
61
|
-
return
|
|
61
|
+
return f.value;
|
|
62
62
|
},
|
|
63
|
-
set: (
|
|
64
|
-
|
|
63
|
+
set: (d) => {
|
|
64
|
+
$.value && d ? f.value = P(d) : f.value = d;
|
|
65
65
|
}
|
|
66
|
-
}),
|
|
67
|
-
if (
|
|
66
|
+
}), z = w(() => {
|
|
67
|
+
if (v.value)
|
|
68
68
|
try {
|
|
69
|
-
const
|
|
70
|
-
if (
|
|
71
|
-
return
|
|
72
|
-
} catch (
|
|
73
|
-
console.error("Error parsing date from closing ID:",
|
|
69
|
+
const d = P(v.value);
|
|
70
|
+
if (d)
|
|
71
|
+
return d;
|
|
72
|
+
} catch (d) {
|
|
73
|
+
console.error("Error parsing date from closing ID:", d);
|
|
74
74
|
}
|
|
75
|
-
}), E =
|
|
76
|
-
if (!
|
|
77
|
-
const
|
|
78
|
-
if (
|
|
79
|
-
const
|
|
80
|
-
if (new Date(e).getTime() <=
|
|
75
|
+
}), E = w(() => {
|
|
76
|
+
if (!v.value || !f.value) return "";
|
|
77
|
+
const d = P(v.value), e = f.value;
|
|
78
|
+
if (d && e) {
|
|
79
|
+
const u = new Date(d).getTime();
|
|
80
|
+
if (new Date(e).getTime() <= u)
|
|
81
81
|
return t("inventory.stock.recalculation.error.endDateBeforeOpening");
|
|
82
82
|
}
|
|
83
83
|
return "";
|
|
84
|
-
}),
|
|
85
|
-
(
|
|
84
|
+
}), K = w(() => !!v.value && !!f.value && !E.value), J = w(() => s.value.some(
|
|
85
|
+
(d) => !d.completedAt && !d.failedReason
|
|
86
86
|
));
|
|
87
87
|
async function Q() {
|
|
88
|
-
|
|
88
|
+
D.value = !0, await Promise.all([ee(), W()]), v.value = "", f.value = "", $.value = !1;
|
|
89
89
|
}
|
|
90
90
|
function q() {
|
|
91
|
-
|
|
91
|
+
D.value = !1;
|
|
92
92
|
}
|
|
93
93
|
S({
|
|
94
94
|
open: Q,
|
|
95
95
|
close: q
|
|
96
96
|
});
|
|
97
97
|
async function ee() {
|
|
98
|
-
|
|
98
|
+
l.value = !0;
|
|
99
99
|
try {
|
|
100
|
-
const
|
|
101
|
-
|
|
102
|
-
} catch (
|
|
103
|
-
console.error("Error fetching recent closings:",
|
|
100
|
+
const d = await T.getLastNClosings(30);
|
|
101
|
+
U.value = d;
|
|
102
|
+
} catch (d) {
|
|
103
|
+
console.error("Error fetching recent closings:", d), k.open({
|
|
104
104
|
title: t("common.error"),
|
|
105
105
|
message: "Failed to fetch recent closings",
|
|
106
106
|
type: "error"
|
|
107
107
|
});
|
|
108
108
|
} finally {
|
|
109
|
-
|
|
109
|
+
l.value = !1;
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
|
-
async function
|
|
113
|
-
|
|
112
|
+
async function W() {
|
|
113
|
+
C.value = !0;
|
|
114
114
|
try {
|
|
115
|
-
const
|
|
116
|
-
|
|
117
|
-
} catch (
|
|
118
|
-
console.error("Error fetching recalculation requests:",
|
|
115
|
+
const d = await L.recalculation.recalculationRequests();
|
|
116
|
+
s.value = d;
|
|
117
|
+
} catch (d) {
|
|
118
|
+
console.error("Error fetching recalculation requests:", d);
|
|
119
119
|
} finally {
|
|
120
|
-
|
|
120
|
+
C.value = !1;
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
|
-
async function
|
|
124
|
-
if (!
|
|
123
|
+
async function Y() {
|
|
124
|
+
if (!v.value || !f.value) {
|
|
125
125
|
h.value = [];
|
|
126
126
|
return;
|
|
127
127
|
}
|
|
128
|
-
|
|
128
|
+
F.value = !0;
|
|
129
129
|
try {
|
|
130
|
-
const
|
|
131
|
-
|
|
132
|
-
|
|
130
|
+
const d = await L.recalculation.getAffectedClosingDrafts(
|
|
131
|
+
v.value,
|
|
132
|
+
f.value
|
|
133
133
|
);
|
|
134
|
-
h.value =
|
|
134
|
+
h.value = d;
|
|
135
135
|
} catch {
|
|
136
|
-
|
|
136
|
+
k.open({
|
|
137
137
|
title: t("common.error"),
|
|
138
138
|
message: "Failed to fetch affected closing drafts",
|
|
139
139
|
type: "error"
|
|
140
140
|
}), h.value = [];
|
|
141
141
|
} finally {
|
|
142
|
-
|
|
142
|
+
F.value = !1;
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
|
-
|
|
146
|
-
[
|
|
145
|
+
ie(
|
|
146
|
+
[v, f],
|
|
147
147
|
() => {
|
|
148
|
-
|
|
148
|
+
v.value && f.value && !E.value ? Y() : h.value = [];
|
|
149
149
|
},
|
|
150
150
|
{ immediate: !1 }
|
|
151
151
|
);
|
|
152
152
|
async function te() {
|
|
153
|
-
if (
|
|
154
|
-
|
|
153
|
+
if (K.value) {
|
|
154
|
+
l.value = !0;
|
|
155
155
|
try {
|
|
156
156
|
if (await L.recalculation.scheduleRecalculation({
|
|
157
|
-
openingId:
|
|
158
|
-
untilDate:
|
|
157
|
+
openingId: v.value,
|
|
158
|
+
untilDate: f.value
|
|
159
159
|
}), h.value.length > 0) {
|
|
160
|
-
const
|
|
161
|
-
await L.recalculation.scheduleInvalidateClosingDraftCache(
|
|
160
|
+
const d = h.value.map((e) => e._id);
|
|
161
|
+
await L.recalculation.scheduleInvalidateClosingDraftCache(d);
|
|
162
162
|
}
|
|
163
|
-
|
|
163
|
+
k.open({
|
|
164
164
|
title: t("common.success"),
|
|
165
165
|
message: "Stock recalculation has been scheduled successfully",
|
|
166
166
|
type: "success"
|
|
167
|
-
}), await
|
|
168
|
-
} catch (
|
|
169
|
-
console.error("Error scheduling recalculation:",
|
|
167
|
+
}), await W(), D.value = !1, M("submitted");
|
|
168
|
+
} catch (d) {
|
|
169
|
+
console.error("Error scheduling recalculation:", d), k.open({
|
|
170
170
|
title: t("common.error"),
|
|
171
171
|
message: "Failed to schedule stock recalculation",
|
|
172
172
|
type: "error"
|
|
173
173
|
});
|
|
174
174
|
} finally {
|
|
175
|
-
|
|
175
|
+
l.value = !1;
|
|
176
176
|
}
|
|
177
177
|
}
|
|
178
178
|
}
|
|
179
|
-
return (
|
|
180
|
-
const
|
|
179
|
+
return (d, e) => {
|
|
180
|
+
const u = x("FmButton"), i = x("FmSelect"), m = x("FmRadio"), R = x("FmDatePicker"), B = x("FmAlert"), oe = x("FmDialog");
|
|
181
181
|
return n(), p("div", null, [
|
|
182
|
-
|
|
182
|
+
d.showButton ? (n(), H(u, {
|
|
183
183
|
key: 0,
|
|
184
184
|
"prepend-icon": "info",
|
|
185
185
|
variant: "tertiary",
|
|
186
186
|
onClick: ue(Q, ["stop"])
|
|
187
187
|
})) : b("", !0),
|
|
188
188
|
_(oe, {
|
|
189
|
-
modelValue:
|
|
190
|
-
"onUpdate:modelValue": e[7] || (e[7] = (
|
|
189
|
+
modelValue: D.value,
|
|
190
|
+
"onUpdate:modelValue": e[7] || (e[7] = (r) => D.value = r),
|
|
191
191
|
"close-button": "",
|
|
192
192
|
dismissAway: "",
|
|
193
193
|
"max-width": "600px"
|
|
194
194
|
}, {
|
|
195
|
-
"dialog-header":
|
|
196
|
-
o("div", we,
|
|
195
|
+
"dialog-header": I(() => [
|
|
196
|
+
o("div", we, a(c(t)("inventory.stock.recalculation.title")), 1)
|
|
197
197
|
]),
|
|
198
|
-
"dialog-footer":
|
|
198
|
+
"dialog-footer": I(() => [
|
|
199
199
|
J.value ? (n(), p("div", qe, [
|
|
200
|
-
_(
|
|
200
|
+
_(u, {
|
|
201
201
|
variant: "tertiary",
|
|
202
|
-
onClick: e[6] || (e[6] = (
|
|
203
|
-
label:
|
|
202
|
+
onClick: e[6] || (e[6] = (r) => D.value = !1),
|
|
203
|
+
label: c(t)("common.close")
|
|
204
204
|
}, null, 8, ["label"])
|
|
205
205
|
])) : (n(), p("div", Ze, [
|
|
206
|
-
_(
|
|
206
|
+
_(u, {
|
|
207
207
|
variant: "tertiary",
|
|
208
|
-
onClick: e[5] || (e[5] = (
|
|
209
|
-
disabled:
|
|
210
|
-
label:
|
|
208
|
+
onClick: e[5] || (e[5] = (r) => D.value = !1),
|
|
209
|
+
disabled: l.value,
|
|
210
|
+
label: c(t)("common.cancel")
|
|
211
211
|
}, null, 8, ["disabled", "label"]),
|
|
212
|
-
_(
|
|
212
|
+
_(u, {
|
|
213
213
|
variant: "primary",
|
|
214
214
|
onClick: te,
|
|
215
|
-
disabled: !
|
|
216
|
-
loading:
|
|
217
|
-
label:
|
|
215
|
+
disabled: !K.value || l.value,
|
|
216
|
+
loading: l.value,
|
|
217
|
+
label: c(t)("inventory.stock.recalculation.schedule")
|
|
218
218
|
}, null, 8, ["disabled", "loading", "label"])
|
|
219
219
|
]))
|
|
220
220
|
]),
|
|
221
|
-
default:
|
|
221
|
+
default: I(() => [
|
|
222
222
|
o("div", Se, [
|
|
223
|
-
o("div",
|
|
224
|
-
J.value ? b("", !0) : (n(), p(
|
|
225
|
-
o("div",
|
|
223
|
+
o("div", Ve, a(c(t)("inventory.stock.recalculation.description")), 1),
|
|
224
|
+
J.value ? b("", !0) : (n(), p(G, { key: 0 }, [
|
|
225
|
+
o("div", Ce, [
|
|
226
226
|
o("p", $e, [
|
|
227
|
-
Z(
|
|
227
|
+
Z(a(c(t)("inventory.stock.recalculation.openingDate")) + " ", 1),
|
|
228
228
|
e[8] || (e[8] = o("span", { class: "text-fm-color-system-error-300" }, "*", -1))
|
|
229
229
|
]),
|
|
230
230
|
e[9] || (e[9] = o("div", { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary mb-4" }, " Showing the last 30 closing records. Select the opening date to start recalculation. ", -1)),
|
|
231
|
-
_(
|
|
232
|
-
modelValue:
|
|
233
|
-
"onUpdate:modelValue": e[0] || (e[0] = (
|
|
234
|
-
items:
|
|
235
|
-
placeholder:
|
|
236
|
-
loading:
|
|
237
|
-
disabled:
|
|
231
|
+
_(i, {
|
|
232
|
+
modelValue: v.value,
|
|
233
|
+
"onUpdate:modelValue": e[0] || (e[0] = (r) => v.value = r),
|
|
234
|
+
items: N.value,
|
|
235
|
+
placeholder: c(t)("inventory.stock.recalculation.selectOpening"),
|
|
236
|
+
loading: l.value,
|
|
237
|
+
disabled: l.value
|
|
238
238
|
}, null, 8, ["modelValue", "items", "placeholder", "loading", "disabled"])
|
|
239
239
|
]),
|
|
240
240
|
o("div", Ae, [
|
|
241
241
|
o("p", Fe, [
|
|
242
|
-
Z(
|
|
242
|
+
Z(a(c(t)("inventory.stock.recalculation.untilDate")) + " ", 1),
|
|
243
243
|
e[10] || (e[10] = o("span", { class: "text-fm-color-system-error-300" }, "*", -1))
|
|
244
244
|
]),
|
|
245
245
|
o("div", Re, [
|
|
246
|
-
_(
|
|
247
|
-
modelValue:
|
|
248
|
-
"onUpdate:modelValue": e[1] || (e[1] = (
|
|
246
|
+
_(m, {
|
|
247
|
+
modelValue: $.value,
|
|
248
|
+
"onUpdate:modelValue": e[1] || (e[1] = (r) => $.value = r),
|
|
249
249
|
value: !1,
|
|
250
|
-
label:
|
|
250
|
+
label: c(t)("inventory.stock.recalculation.selectByDate")
|
|
251
251
|
}, null, 8, ["modelValue", "label"]),
|
|
252
|
-
_(
|
|
253
|
-
modelValue:
|
|
254
|
-
"onUpdate:modelValue": e[2] || (e[2] = (
|
|
252
|
+
_(m, {
|
|
253
|
+
modelValue: $.value,
|
|
254
|
+
"onUpdate:modelValue": e[2] || (e[2] = (r) => $.value = r),
|
|
255
255
|
value: !0,
|
|
256
|
-
label:
|
|
256
|
+
label: c(t)("inventory.stock.recalculation.selectByClosing")
|
|
257
257
|
}, null, 8, ["modelValue", "label"])
|
|
258
258
|
]),
|
|
259
|
-
|
|
259
|
+
$.value ? (n(), H(i, {
|
|
260
260
|
key: 1,
|
|
261
|
-
modelValue:
|
|
262
|
-
"onUpdate:modelValue": e[4] || (e[4] = (
|
|
263
|
-
items:
|
|
264
|
-
placeholder:
|
|
265
|
-
loading:
|
|
266
|
-
disabled: !
|
|
267
|
-
}, null, 8, ["modelValue", "items", "placeholder", "loading", "disabled"])) : (n(),
|
|
261
|
+
modelValue: j.value,
|
|
262
|
+
"onUpdate:modelValue": e[4] || (e[4] = (r) => j.value = r),
|
|
263
|
+
items: O.value,
|
|
264
|
+
placeholder: c(t)("inventory.stock.recalculation.selectClosing"),
|
|
265
|
+
loading: l.value,
|
|
266
|
+
disabled: !v.value || l.value
|
|
267
|
+
}, null, 8, ["modelValue", "items", "placeholder", "loading", "disabled"])) : (n(), H(R, {
|
|
268
268
|
key: 0,
|
|
269
|
-
modelValue:
|
|
270
|
-
"onUpdate:modelValue": e[3] || (e[3] = (
|
|
271
|
-
placeholder:
|
|
272
|
-
min:
|
|
273
|
-
disabled: !
|
|
269
|
+
modelValue: f.value,
|
|
270
|
+
"onUpdate:modelValue": e[3] || (e[3] = (r) => f.value = r),
|
|
271
|
+
placeholder: c(t)("inventory.stock.recalculation.selectDate"),
|
|
272
|
+
min: z.value,
|
|
273
|
+
disabled: !v.value || l.value
|
|
274
274
|
}, null, 8, ["modelValue", "placeholder", "min", "disabled"])),
|
|
275
|
-
E.value ? (n(), p("div", Ie,
|
|
275
|
+
E.value ? (n(), p("div", Ie, a(E.value), 1)) : b("", !0)
|
|
276
276
|
]),
|
|
277
|
-
|
|
277
|
+
v.value && f.value && !E.value ? (n(), H(B, {
|
|
278
278
|
key: 0,
|
|
279
279
|
type: "info"
|
|
280
280
|
}, {
|
|
281
|
-
default:
|
|
282
|
-
o("div", Te,
|
|
281
|
+
default: I(() => [
|
|
282
|
+
o("div", Te, a(c(t)("inventory.stock.recalculation.info")), 1)
|
|
283
283
|
]),
|
|
284
284
|
_: 1
|
|
285
285
|
})) : b("", !0),
|
|
286
286
|
h.value.length > 0 ? (n(), p("div", Be, [
|
|
287
|
-
|
|
288
|
-
o("div", Ee, " Affected closing draft(s): " +
|
|
289
|
-
o("div",
|
|
290
|
-
(n(!0), p(
|
|
291
|
-
key:
|
|
287
|
+
F.value ? (n(), p("div", Le, " Loading affected closing drafts... ")) : (n(), p("div", Oe, [
|
|
288
|
+
o("div", Ee, " Affected closing draft(s): " + a(h.value.length), 1),
|
|
289
|
+
o("div", Ue, [
|
|
290
|
+
(n(!0), p(G, null, le(h.value, (r) => (n(), p("div", {
|
|
291
|
+
key: r._id,
|
|
292
292
|
class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
|
|
293
293
|
}, [
|
|
294
|
-
Z(" • " +
|
|
295
|
-
|
|
294
|
+
Z(" • " + a(r._id) + " ", 1),
|
|
295
|
+
r.effectiveAt ? (n(), p("span", Pe, " (" + a(new Date(r.effectiveAt).toLocaleString()) + ") ", 1)) : b("", !0)
|
|
296
296
|
]))), 128))
|
|
297
297
|
])
|
|
298
298
|
]))
|
|
299
299
|
])) : b("", !0)
|
|
300
300
|
], 64)),
|
|
301
|
-
|
|
302
|
-
o("p", Me,
|
|
301
|
+
s.value.length > 0 ? (n(), p("div", Ne, [
|
|
302
|
+
o("p", Me, a(c(t)("inventory.stock.recalculation.recentRequests")), 1),
|
|
303
303
|
o("div", Ke, [
|
|
304
|
-
(n(!0), p(
|
|
304
|
+
(n(!0), p(G, null, le(s.value, (r) => {
|
|
305
305
|
var y;
|
|
306
306
|
return n(), p("div", {
|
|
307
|
-
key:
|
|
307
|
+
key: r._id,
|
|
308
308
|
class: "p-12 border border-fm-color-border-primary rounded-8 flex flex-col gap-4"
|
|
309
309
|
}, [
|
|
310
310
|
o("div", He, [
|
|
311
|
-
o("div", je,
|
|
311
|
+
o("div", je, a(c(t)("inventory.stock.recalculation.requestedAt")) + ": " + a(new Date(r.createdAt).toLocaleString()), 1),
|
|
312
312
|
o("div", ze, [
|
|
313
|
-
(y =
|
|
313
|
+
(y = r.meta) != null && y.openingType ? (n(), p("div", We, a(r.meta.openingType === "stockSnapshot" ? "Snapshot" : "Closing"), 1)) : b("", !0),
|
|
314
314
|
o("div", {
|
|
315
315
|
class: me(["fm-typo-en-body-xs-600 px-8 py-4 rounded-4", {
|
|
316
|
-
"bg-fm-color-system-error-100 text-fm-color-system-error-500":
|
|
317
|
-
"bg-fm-color-system-success-100 text-fm-color-system-success-500":
|
|
318
|
-
"bg-fm-color-system-info-100 text-fm-color-system-info-500": !
|
|
316
|
+
"bg-fm-color-system-error-100 text-fm-color-system-error-500": r.failedReason,
|
|
317
|
+
"bg-fm-color-system-success-100 text-fm-color-system-success-500": r.completedAt,
|
|
318
|
+
"bg-fm-color-system-info-100 text-fm-color-system-info-500": !r.failedReason && !r.completedAt
|
|
319
319
|
}])
|
|
320
|
-
},
|
|
320
|
+
}, a(r.failedReason ? c(t)("inventory.stock.recalculation.status.failed") : r.completedAt ? c(t)("inventory.stock.recalculation.status.completed") : c(t)("inventory.stock.recalculation.status.inProgress")), 3)
|
|
321
321
|
])
|
|
322
322
|
]),
|
|
323
|
-
o("div", Ye,
|
|
324
|
-
o("div", Ge,
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
323
|
+
o("div", Ye, a(c(t)("inventory.stock.recalculation.from")) + ": " + a(new Date(r.recalculateStartDate).toLocaleDateString()), 1),
|
|
324
|
+
o("div", Ge, a(c(t)("inventory.stock.recalculation.to")) + ": " + a(new Date(r.recalculateEndDate).toLocaleDateString()), 1),
|
|
325
|
+
r.createdBy ? (n(), p("div", Je, a(c(t)("inventory.stock.recalculation.requestedBy")) + ": " + a(r.createdBy.name || r.createdBy.id), 1)) : b("", !0),
|
|
326
|
+
r.completedAt ? (n(), p("div", Qe, a(c(t)("inventory.stock.recalculation.completedAt")) + ": " + a(new Date(r.completedAt).toLocaleString()), 1)) : b("", !0),
|
|
327
|
+
r.failedReason ? (n(), p("div", Xe, a(r.failedReason), 1)) : b("", !0)
|
|
328
328
|
]);
|
|
329
329
|
}), 128))
|
|
330
330
|
])
|
|
@@ -348,13 +348,13 @@ const we = { class: "fm-typo-en-heading-lg-600" }, Se = { class: "flex flex-col
|
|
|
348
348
|
}, mt = {
|
|
349
349
|
key: 1,
|
|
350
350
|
class: "flex flex-col gap-8"
|
|
351
|
-
}, ft = { class: "fm-typo-en-body-sm-600" },
|
|
351
|
+
}, ft = { class: "fm-typo-en-body-sm-600" }, vt = { class: "flex flex-col gap-4" }, yt = { key: 0 }, pt = { key: 1 }, gt = { key: 2 }, ht = {
|
|
352
352
|
key: 1,
|
|
353
353
|
class: "flex flex-col gap-8"
|
|
354
354
|
}, _t = { class: "fm-typo-en-body-md-600" }, bt = { class: "flex flex-col gap-8 max-h-[300px] overflow-y-auto" }, kt = { class: "flex items-center justify-between" }, xt = { class: "fm-typo-en-body-sm-600" }, Dt = { class: "flex items-center gap-8" }, wt = {
|
|
355
355
|
key: 0,
|
|
356
356
|
class: "fm-typo-en-body-xs-600 px-8 py-4 rounded-4 bg-fm-color-neutral-100 text-fm-color-typo-secondary"
|
|
357
|
-
}, St = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" },
|
|
357
|
+
}, St = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Vt = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Ct = {
|
|
358
358
|
key: 0,
|
|
359
359
|
class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
|
|
360
360
|
}, $t = {
|
|
@@ -375,273 +375,273 @@ const we = { class: "fm-typo-en-heading-lg-600" }, Se = { class: "flex flex-col
|
|
|
375
375
|
showButton: { type: Boolean }
|
|
376
376
|
},
|
|
377
377
|
emits: ["submitted"],
|
|
378
|
-
setup(ae, { expose: S, emit:
|
|
379
|
-
const
|
|
380
|
-
() =>
|
|
381
|
-
),
|
|
378
|
+
setup(ae, { expose: S, emit: V }) {
|
|
379
|
+
const M = V, { t } = se(), L = fe(), T = ce(), k = re(), D = g(!1), v = g(""), f = g(""), $ = g([]), U = g([]), l = g(!1), s = g([]), C = g(!1), h = g([]), F = g(!1), N = w(
|
|
380
|
+
() => ve($.value, U.value)
|
|
381
|
+
), O = w(() => xe(
|
|
382
382
|
h.value.filter((e) => !!e.closingId).map((e) => ({ closingId: e.closingId, draftCreatedAt: new Date(P(e._id)) }))
|
|
383
|
-
)),
|
|
384
|
-
if (
|
|
383
|
+
)), j = w(() => {
|
|
384
|
+
if (v.value)
|
|
385
385
|
try {
|
|
386
|
-
const e = P(
|
|
386
|
+
const e = P(v.value);
|
|
387
387
|
if (e)
|
|
388
388
|
return e;
|
|
389
389
|
} catch (e) {
|
|
390
390
|
console.error("Error parsing date from opening ID:", e);
|
|
391
391
|
}
|
|
392
|
-
}),
|
|
393
|
-
if (!
|
|
394
|
-
const e = P(
|
|
395
|
-
if (e &&
|
|
396
|
-
const
|
|
397
|
-
if (new Date(
|
|
392
|
+
}), z = w(() => {
|
|
393
|
+
if (!v.value || !f.value) return "";
|
|
394
|
+
const e = P(v.value);
|
|
395
|
+
if (e && f.value) {
|
|
396
|
+
const u = new Date(e).getTime();
|
|
397
|
+
if (new Date(f.value).getTime() <= u)
|
|
398
398
|
return t("inventory.stock.recalculation.error.endDateBeforeOpening");
|
|
399
399
|
}
|
|
400
400
|
return "";
|
|
401
|
-
}), E =
|
|
402
|
-
if (!
|
|
403
|
-
const e = new Date(
|
|
404
|
-
return
|
|
405
|
-
}),
|
|
401
|
+
}), E = w(() => {
|
|
402
|
+
if (!f.value) return !1;
|
|
403
|
+
const e = new Date(f.value), u = /* @__PURE__ */ new Date();
|
|
404
|
+
return u.setHours(0, 0, 0, 0), e.setHours(0, 0, 0, 0), e >= u;
|
|
405
|
+
}), K = w(() => !!v.value && !!f.value && !z.value), J = w(() => s.value.some(
|
|
406
406
|
(e) => !e.completedAt && !e.failedReason
|
|
407
407
|
));
|
|
408
408
|
async function Q() {
|
|
409
|
-
|
|
409
|
+
D.value = !0, await Promise.all([ee(), W(), Y()]), v.value = "", f.value = "";
|
|
410
410
|
}
|
|
411
411
|
function q() {
|
|
412
|
-
|
|
412
|
+
D.value = !1;
|
|
413
413
|
}
|
|
414
414
|
S({
|
|
415
415
|
open: Q,
|
|
416
416
|
close: q
|
|
417
417
|
});
|
|
418
418
|
async function ee() {
|
|
419
|
-
|
|
419
|
+
l.value = !0;
|
|
420
420
|
try {
|
|
421
|
-
const e = await
|
|
422
|
-
|
|
421
|
+
const e = await T.getLastNClosings(30);
|
|
422
|
+
$.value = e;
|
|
423
423
|
} catch (e) {
|
|
424
|
-
console.error("Error fetching recent closings:", e),
|
|
424
|
+
console.error("Error fetching recent closings:", e), k.open({
|
|
425
425
|
title: t("common.error"),
|
|
426
426
|
message: "Failed to fetch recent closings",
|
|
427
427
|
type: "error"
|
|
428
428
|
});
|
|
429
429
|
} finally {
|
|
430
|
-
|
|
430
|
+
l.value = !1;
|
|
431
431
|
}
|
|
432
432
|
}
|
|
433
|
-
async function
|
|
433
|
+
async function W() {
|
|
434
434
|
try {
|
|
435
|
-
const e = await
|
|
436
|
-
|
|
435
|
+
const e = await T.getLastNStockSnapshots(30);
|
|
436
|
+
U.value = e;
|
|
437
437
|
} catch (e) {
|
|
438
438
|
console.error("Error fetching recent snapshots:", e);
|
|
439
439
|
}
|
|
440
440
|
}
|
|
441
|
-
async function
|
|
442
|
-
|
|
441
|
+
async function Y() {
|
|
442
|
+
C.value = !0;
|
|
443
443
|
try {
|
|
444
444
|
const e = await L.recalculation.recalculationRequests();
|
|
445
|
-
|
|
445
|
+
s.value = e;
|
|
446
446
|
} catch (e) {
|
|
447
447
|
console.error("Error fetching recalculation requests:", e);
|
|
448
448
|
} finally {
|
|
449
|
-
|
|
449
|
+
C.value = !1;
|
|
450
450
|
}
|
|
451
451
|
}
|
|
452
452
|
async function te() {
|
|
453
|
-
if (!
|
|
453
|
+
if (!v.value || !f.value) {
|
|
454
454
|
h.value = [];
|
|
455
455
|
return;
|
|
456
456
|
}
|
|
457
|
-
|
|
457
|
+
F.value = !0;
|
|
458
458
|
try {
|
|
459
|
-
const e = new Date(
|
|
459
|
+
const e = new Date(f.value);
|
|
460
460
|
e.setHours(23, 59, 59, 999);
|
|
461
|
-
const
|
|
462
|
-
|
|
461
|
+
const u = await L.recalculation.getAffectedClosingDrafts(
|
|
462
|
+
v.value,
|
|
463
463
|
e.toISOString()
|
|
464
464
|
);
|
|
465
|
-
h.value =
|
|
465
|
+
h.value = u;
|
|
466
466
|
} catch {
|
|
467
|
-
|
|
467
|
+
k.open({
|
|
468
468
|
title: t("common.error"),
|
|
469
469
|
message: "Failed to fetch affected closing drafts",
|
|
470
470
|
type: "error"
|
|
471
471
|
}), h.value = [];
|
|
472
472
|
} finally {
|
|
473
|
-
|
|
473
|
+
F.value = !1;
|
|
474
474
|
}
|
|
475
475
|
}
|
|
476
|
-
|
|
477
|
-
[
|
|
476
|
+
ie(
|
|
477
|
+
[v, f],
|
|
478
478
|
() => {
|
|
479
|
-
|
|
479
|
+
v.value && f.value && !z.value ? te() : h.value = [];
|
|
480
480
|
},
|
|
481
481
|
{ immediate: !1 }
|
|
482
482
|
);
|
|
483
|
-
async function
|
|
484
|
-
if (!(!
|
|
485
|
-
|
|
483
|
+
async function d() {
|
|
484
|
+
if (!(!K.value || !f.value)) {
|
|
485
|
+
l.value = !0;
|
|
486
486
|
try {
|
|
487
487
|
if (await L.recalculation.scheduleRecalculation({
|
|
488
|
-
openingId:
|
|
489
|
-
untilDate: new Date(
|
|
488
|
+
openingId: v.value,
|
|
489
|
+
untilDate: new Date(f.value).toISOString(),
|
|
490
490
|
recalculateBySnapshot: !0
|
|
491
491
|
}), h.value.length > 0) {
|
|
492
|
-
const e = h.value.map((
|
|
492
|
+
const e = h.value.map((u) => u._id);
|
|
493
493
|
await L.recalculation.scheduleInvalidateClosingDraftCache(e);
|
|
494
494
|
}
|
|
495
|
-
|
|
495
|
+
k.open({
|
|
496
496
|
title: t("common.success"),
|
|
497
497
|
message: "Stock recalculation has been scheduled successfully",
|
|
498
498
|
type: "success"
|
|
499
|
-
}), await
|
|
499
|
+
}), await Y(), D.value = !1, M("submitted");
|
|
500
500
|
} catch (e) {
|
|
501
|
-
console.error("Error scheduling recalculation:", e),
|
|
501
|
+
console.error("Error scheduling recalculation:", e), k.open({
|
|
502
502
|
title: t("common.error"),
|
|
503
503
|
message: "Failed to schedule stock recalculation",
|
|
504
504
|
type: "error"
|
|
505
505
|
});
|
|
506
506
|
} finally {
|
|
507
|
-
|
|
507
|
+
l.value = !1;
|
|
508
508
|
}
|
|
509
509
|
}
|
|
510
510
|
}
|
|
511
|
-
return (e,
|
|
512
|
-
const
|
|
511
|
+
return (e, u) => {
|
|
512
|
+
const i = x("FmButton"), m = x("FmSelect"), R = x("FmDatePicker"), B = x("FmSnackbar"), oe = x("FmAlert"), r = x("FmDialog");
|
|
513
513
|
return n(), p("div", null, [
|
|
514
|
-
e.showButton ? (n(),
|
|
514
|
+
e.showButton ? (n(), H(i, {
|
|
515
515
|
key: 0,
|
|
516
516
|
"prepend-icon": "info",
|
|
517
517
|
variant: "tertiary",
|
|
518
518
|
onClick: ue(Q, ["stop"])
|
|
519
519
|
})) : b("", !0),
|
|
520
|
-
_(
|
|
521
|
-
modelValue:
|
|
522
|
-
"onUpdate:modelValue":
|
|
520
|
+
_(r, {
|
|
521
|
+
modelValue: D.value,
|
|
522
|
+
"onUpdate:modelValue": u[4] || (u[4] = (y) => D.value = y),
|
|
523
523
|
"close-button": "",
|
|
524
524
|
dismissAway: "",
|
|
525
525
|
"max-width": "600px"
|
|
526
526
|
}, {
|
|
527
|
-
"dialog-header":
|
|
528
|
-
o("div", tt,
|
|
527
|
+
"dialog-header": I(() => [
|
|
528
|
+
o("div", tt, a(c(t)("inventory.stock.recalculation.title")), 1)
|
|
529
529
|
]),
|
|
530
|
-
"dialog-footer":
|
|
530
|
+
"dialog-footer": I(() => [
|
|
531
531
|
J.value ? (n(), p("div", Rt, [
|
|
532
|
-
_(
|
|
532
|
+
_(i, {
|
|
533
533
|
variant: "tertiary",
|
|
534
|
-
onClick:
|
|
535
|
-
label:
|
|
534
|
+
onClick: u[3] || (u[3] = (y) => D.value = !1),
|
|
535
|
+
label: c(t)("common.close")
|
|
536
536
|
}, null, 8, ["label"])
|
|
537
537
|
])) : (n(), p("div", Ft, [
|
|
538
|
-
_(
|
|
538
|
+
_(i, {
|
|
539
539
|
variant: "tertiary",
|
|
540
|
-
onClick:
|
|
541
|
-
disabled:
|
|
542
|
-
label:
|
|
540
|
+
onClick: u[2] || (u[2] = (y) => D.value = !1),
|
|
541
|
+
disabled: l.value,
|
|
542
|
+
label: c(t)("common.cancel")
|
|
543
543
|
}, null, 8, ["disabled", "label"]),
|
|
544
|
-
_(
|
|
544
|
+
_(i, {
|
|
545
545
|
variant: "primary",
|
|
546
|
-
onClick:
|
|
547
|
-
disabled: !
|
|
548
|
-
loading:
|
|
549
|
-
label:
|
|
546
|
+
onClick: d,
|
|
547
|
+
disabled: !K.value || l.value,
|
|
548
|
+
loading: l.value,
|
|
549
|
+
label: c(t)("inventory.stock.recalculation.schedule")
|
|
550
550
|
}, null, 8, ["disabled", "loading", "label"])
|
|
551
551
|
]))
|
|
552
552
|
]),
|
|
553
|
-
default:
|
|
553
|
+
default: I(() => [
|
|
554
554
|
o("div", ot, [
|
|
555
|
-
o("div", at,
|
|
556
|
-
J.value ? b("", !0) : (n(), p(
|
|
555
|
+
o("div", at, a(c(t)("inventory.stock.recalculation.description")), 1),
|
|
556
|
+
J.value ? b("", !0) : (n(), p(G, { key: 0 }, [
|
|
557
557
|
o("div", lt, [
|
|
558
558
|
o("p", nt, [
|
|
559
|
-
Z(
|
|
560
|
-
|
|
559
|
+
Z(a(c(t)("inventory.stock.recalculation.openingDate")) + " ", 1),
|
|
560
|
+
u[5] || (u[5] = o("span", { class: "text-fm-color-system-error-300" }, "*", -1))
|
|
561
561
|
]),
|
|
562
|
-
|
|
563
|
-
_(
|
|
564
|
-
modelValue:
|
|
565
|
-
"onUpdate:modelValue":
|
|
566
|
-
items:
|
|
567
|
-
placeholder:
|
|
568
|
-
loading:
|
|
569
|
-
disabled:
|
|
562
|
+
u[6] || (u[6] = o("div", { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary mb-4" }, " Select from the last 30 closing or snapshot records as the opening date for recalculation. ", -1)),
|
|
563
|
+
_(m, {
|
|
564
|
+
modelValue: v.value,
|
|
565
|
+
"onUpdate:modelValue": u[0] || (u[0] = (y) => v.value = y),
|
|
566
|
+
items: N.value,
|
|
567
|
+
placeholder: c(t)("inventory.stock.recalculation.selectOpening"),
|
|
568
|
+
loading: l.value,
|
|
569
|
+
disabled: l.value
|
|
570
570
|
}, null, 8, ["modelValue", "items", "placeholder", "loading", "disabled"])
|
|
571
571
|
]),
|
|
572
572
|
o("div", st, [
|
|
573
573
|
o("p", it, [
|
|
574
|
-
Z(
|
|
575
|
-
|
|
574
|
+
Z(a(c(t)("inventory.stock.recalculation.untilDate")) + " ", 1),
|
|
575
|
+
u[7] || (u[7] = o("span", { class: "text-fm-color-system-error-300" }, "*", -1))
|
|
576
576
|
]),
|
|
577
|
-
|
|
578
|
-
_(
|
|
579
|
-
modelValue:
|
|
580
|
-
"onUpdate:modelValue":
|
|
581
|
-
placeholder:
|
|
582
|
-
min:
|
|
583
|
-
disabled: !
|
|
577
|
+
u[8] || (u[8] = o("div", { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary mb-4" }, " Select the end date for recalculation. Must be after the selected opening date. ", -1)),
|
|
578
|
+
_(R, {
|
|
579
|
+
modelValue: f.value,
|
|
580
|
+
"onUpdate:modelValue": u[1] || (u[1] = (y) => f.value = y),
|
|
581
|
+
placeholder: c(t)("inventory.stock.recalculation.selectDate"),
|
|
582
|
+
min: j.value,
|
|
583
|
+
disabled: !v.value || l.value
|
|
584
584
|
}, null, 8, ["modelValue", "placeholder", "min", "disabled"]),
|
|
585
|
-
|
|
586
|
-
E.value ? (n(),
|
|
585
|
+
z.value ? (n(), p("div", ct, a(z.value), 1)) : b("", !0),
|
|
586
|
+
E.value ? (n(), H(B, {
|
|
587
587
|
key: 1,
|
|
588
588
|
title: "Warning",
|
|
589
589
|
variant: "warning",
|
|
590
590
|
description: "You have selected today or a future date. The stock balance will be refreshed accordingly."
|
|
591
591
|
})) : b("", !0)
|
|
592
592
|
]),
|
|
593
|
-
|
|
593
|
+
v.value && f.value && !z.value ? (n(), H(oe, {
|
|
594
594
|
key: 0,
|
|
595
595
|
type: "info"
|
|
596
596
|
}, {
|
|
597
|
-
default:
|
|
598
|
-
o("div", rt,
|
|
597
|
+
default: I(() => [
|
|
598
|
+
o("div", rt, a(c(t)("inventory.stock.recalculation.info")), 1)
|
|
599
599
|
]),
|
|
600
600
|
_: 1
|
|
601
601
|
})) : b("", !0),
|
|
602
602
|
h.value.length > 0 ? (n(), p("div", dt, [
|
|
603
|
-
|
|
604
|
-
o("div", ft, " Affected closing draft(s): " +
|
|
605
|
-
o("div",
|
|
606
|
-
(n(!0), p(
|
|
603
|
+
F.value ? (n(), p("div", ut, " Loading affected closing drafts... ")) : (n(), p("div", mt, [
|
|
604
|
+
o("div", ft, " Affected closing draft(s): " + a(h.value.length), 1),
|
|
605
|
+
o("div", vt, [
|
|
606
|
+
(n(!0), p(G, null, le(h.value, (y) => (n(), p("div", {
|
|
607
607
|
key: y._id,
|
|
608
608
|
class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
|
|
609
609
|
}, [
|
|
610
|
-
|
|
611
|
-
y.closingId &&
|
|
612
|
-
y.effectiveAt ? (n(), p("span", gt, " (" +
|
|
610
|
+
u[9] || (u[9] = Z(" • ")),
|
|
611
|
+
y.closingId && O.value.get(y.closingId) ? (n(), p("span", yt, a(O.value.get(y.closingId)), 1)) : (n(), p("span", pt, a(y._id), 1)),
|
|
612
|
+
y.effectiveAt ? (n(), p("span", gt, " (" + a(new Date(y.effectiveAt).toLocaleString()) + ") ", 1)) : b("", !0)
|
|
613
613
|
]))), 128))
|
|
614
614
|
])
|
|
615
615
|
]))
|
|
616
616
|
])) : b("", !0)
|
|
617
617
|
], 64)),
|
|
618
|
-
|
|
619
|
-
o("p", _t,
|
|
618
|
+
s.value.length > 0 ? (n(), p("div", ht, [
|
|
619
|
+
o("p", _t, a(c(t)("inventory.stock.recalculation.recentRequests")), 1),
|
|
620
620
|
o("div", bt, [
|
|
621
|
-
(n(!0), p(
|
|
622
|
-
var
|
|
621
|
+
(n(!0), p(G, null, le(s.value, (y) => {
|
|
622
|
+
var A;
|
|
623
623
|
return n(), p("div", {
|
|
624
624
|
key: y._id,
|
|
625
625
|
class: "p-12 border border-fm-color-border-primary rounded-8 flex flex-col gap-4"
|
|
626
626
|
}, [
|
|
627
627
|
o("div", kt, [
|
|
628
|
-
o("div", xt,
|
|
628
|
+
o("div", xt, a(c(t)("inventory.stock.recalculation.requestedAt")) + ": " + a(new Date(y.createdAt).toLocaleString()), 1),
|
|
629
629
|
o("div", Dt, [
|
|
630
|
-
(
|
|
630
|
+
(A = y.meta) != null && A.openingType ? (n(), p("div", wt, a(y.meta.openingType === "stockSnapshot" ? "Snapshot" : "Closing"), 1)) : b("", !0),
|
|
631
631
|
o("div", {
|
|
632
632
|
class: me(["fm-typo-en-body-xs-600 px-8 py-4 rounded-4", {
|
|
633
633
|
"bg-fm-color-system-error-100 text-fm-color-system-error-500": y.failedReason,
|
|
634
634
|
"bg-fm-color-system-success-100 text-fm-color-system-success-500": y.completedAt,
|
|
635
635
|
"bg-fm-color-system-info-100 text-fm-color-system-info-500": !y.failedReason && !y.completedAt
|
|
636
636
|
}])
|
|
637
|
-
},
|
|
637
|
+
}, a(y.failedReason ? c(t)("inventory.stock.recalculation.status.failed") : y.completedAt ? c(t)("inventory.stock.recalculation.status.completed") : c(t)("inventory.stock.recalculation.status.inProgress")), 3)
|
|
638
638
|
])
|
|
639
639
|
]),
|
|
640
|
-
o("div", St,
|
|
641
|
-
o("div",
|
|
642
|
-
y.createdBy ? (n(), p("div",
|
|
643
|
-
y.completedAt ? (n(), p("div", $t,
|
|
644
|
-
y.failedReason ? (n(), p("div", At,
|
|
640
|
+
o("div", St, a(c(t)("inventory.stock.recalculation.from")) + ": " + a(new Date(y.recalculateStartDate).toLocaleDateString()), 1),
|
|
641
|
+
o("div", Vt, a(c(t)("inventory.stock.recalculation.to")) + ": " + a(new Date(y.recalculateEndDate).toLocaleDateString()), 1),
|
|
642
|
+
y.createdBy ? (n(), p("div", Ct, a(c(t)("inventory.stock.recalculation.requestedBy")) + ": " + a(y.createdBy.name || y.createdBy.id), 1)) : b("", !0),
|
|
643
|
+
y.completedAt ? (n(), p("div", $t, a(c(t)("inventory.stock.recalculation.completedAt")) + ": " + a(new Date(y.completedAt).toLocaleString()), 1)) : b("", !0),
|
|
644
|
+
y.failedReason ? (n(), p("div", At, a(y.failedReason), 1)) : b("", !0)
|
|
645
645
|
]);
|
|
646
646
|
}), 128))
|
|
647
647
|
])
|
|
@@ -653,7 +653,7 @@ const we = { class: "fm-typo-en-heading-lg-600" }, Se = { class: "flex flex-col
|
|
|
653
653
|
]);
|
|
654
654
|
};
|
|
655
655
|
}
|
|
656
|
-
}), Tt = { class: "fm-typo-en-heading-lg-600" }, Bt = { class: "flex flex-col gap-16" }, Lt = { class: "flex flex-col gap-4" }, Ot = { class: "fm-typo-en-label-md-400 text-fm-color-typo-secondary" }, Et = { class: "fm-typo-en-body-md-400" },
|
|
656
|
+
}), Tt = { class: "fm-typo-en-heading-lg-600" }, Bt = { class: "flex flex-col gap-16" }, Lt = { class: "flex flex-col gap-4" }, Ot = { class: "fm-typo-en-label-md-400 text-fm-color-typo-secondary" }, Et = { class: "fm-typo-en-body-md-400" }, Ut = { class: "flex flex-col gap-4" }, Pt = { class: "fm-typo-en-label-md-400 text-fm-color-typo-secondary" }, Nt = { class: "fm-typo-en-body-md-400" }, Mt = { class: "flex flex-col gap-4" }, Kt = { class: "fm-typo-en-label-md-400 text-fm-color-typo-secondary" }, Ht = { class: "flex gap-8 ml-auto" }, jt = /* @__PURE__ */ ne({
|
|
657
657
|
__name: "ClosingDetailDialog",
|
|
658
658
|
props: {
|
|
659
659
|
modelValue: { type: Boolean },
|
|
@@ -662,38 +662,42 @@ const we = { class: "fm-typo-en-heading-lg-600" }, Se = { class: "flex flex-col
|
|
|
662
662
|
},
|
|
663
663
|
emits: ["update:modelValue"],
|
|
664
664
|
setup(ae, { emit: S }) {
|
|
665
|
-
const { t:
|
|
665
|
+
const { t: V } = se(), M = he(), t = ae, L = S, T = w({
|
|
666
666
|
get: () => t.modelValue,
|
|
667
|
-
set: (
|
|
668
|
-
}),
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
})
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
667
|
+
set: (l) => L("update:modelValue", l)
|
|
668
|
+
}), k = g("");
|
|
669
|
+
ie(T, (l) => {
|
|
670
|
+
l || (k.value = "");
|
|
671
|
+
});
|
|
672
|
+
const D = w(() => {
|
|
673
|
+
var l;
|
|
674
|
+
return ((l = t.data) == null ? void 0 : l.skus) ?? [];
|
|
675
|
+
}), v = w(() => {
|
|
676
|
+
var h;
|
|
677
|
+
const l = (h = t.data) == null ? void 0 : h._id;
|
|
678
|
+
if (!l) return "-";
|
|
679
|
+
const s = P(l);
|
|
680
|
+
return new Date(s).toLocaleString();
|
|
681
|
+
}), f = w(() => t.type === "closing" ? V("inventory.closing.history.closingDetail", "Closing Detail") : V("inventory.closing.history.snapshotDetail", "Snapshot Detail")), $ = w(() => D.value.map((l) => {
|
|
682
|
+
const s = M.skuById[l.id] ?? null, C = !s;
|
|
679
683
|
return {
|
|
680
|
-
id:
|
|
681
|
-
sku:
|
|
682
|
-
skuName: (
|
|
683
|
-
skuCode: (
|
|
684
|
-
balance:
|
|
685
|
-
isMissing:
|
|
686
|
-
costs:
|
|
687
|
-
weightedAverage:
|
|
684
|
+
id: l.id,
|
|
685
|
+
sku: s,
|
|
686
|
+
skuName: (s == null ? void 0 : s.name) ?? l.id,
|
|
687
|
+
skuCode: (s == null ? void 0 : s.code) ?? "-",
|
|
688
|
+
balance: l.balance ?? { amount: 0, precision: 0 },
|
|
689
|
+
isMissing: C,
|
|
690
|
+
costs: l.costs,
|
|
691
|
+
weightedAverage: l.weightedAverage
|
|
688
692
|
};
|
|
689
|
-
})),
|
|
693
|
+
})), U = [
|
|
690
694
|
{
|
|
691
695
|
accessorKey: "skuName",
|
|
692
|
-
header: () =>
|
|
693
|
-
cell: (
|
|
694
|
-
const
|
|
695
|
-
return
|
|
696
|
-
X("span", {},
|
|
696
|
+
header: () => V("inventory.ingredient.name", "Ingredient Name"),
|
|
697
|
+
cell: (l) => {
|
|
698
|
+
const s = l.row.original;
|
|
699
|
+
return s.isMissing ? X("div", { class: "flex items-center gap-8" }, [
|
|
700
|
+
X("span", {}, s.id),
|
|
697
701
|
X(
|
|
698
702
|
"span",
|
|
699
703
|
{
|
|
@@ -701,82 +705,88 @@ const we = { class: "fm-typo-en-heading-lg-600" }, Se = { class: "flex flex-col
|
|
|
701
705
|
},
|
|
702
706
|
"Missing"
|
|
703
707
|
)
|
|
704
|
-
]) :
|
|
708
|
+
]) : l.getValue();
|
|
705
709
|
}
|
|
706
710
|
},
|
|
707
711
|
{
|
|
708
712
|
accessorKey: "skuCode",
|
|
709
|
-
header: () =>
|
|
713
|
+
header: () => V("inventory.ingredient.code", "Code")
|
|
710
714
|
},
|
|
711
715
|
{
|
|
712
716
|
id: "balance",
|
|
713
|
-
header: () =>
|
|
714
|
-
cell: (
|
|
715
|
-
var
|
|
716
|
-
const
|
|
717
|
-
if (
|
|
718
|
-
return `${
|
|
719
|
-
const
|
|
720
|
-
unit:
|
|
721
|
-
sku:
|
|
722
|
-
amount:
|
|
723
|
-
defaultTrackingMeasurement:
|
|
717
|
+
header: () => V("inventory.closing.history.balance", "Balance"),
|
|
718
|
+
cell: (l) => {
|
|
719
|
+
var h;
|
|
720
|
+
const s = l.row.original;
|
|
721
|
+
if (s.isMissing || !((h = s.sku) != null && h.unit))
|
|
722
|
+
return `${s.balance.amount / Math.pow(10, s.balance.precision)}`;
|
|
723
|
+
const C = {
|
|
724
|
+
unit: s.sku.unit,
|
|
725
|
+
sku: s.sku,
|
|
726
|
+
amount: s.balance,
|
|
727
|
+
defaultTrackingMeasurement: s.sku.trackingMeasurement ?? void 0
|
|
724
728
|
};
|
|
725
|
-
return X(De,
|
|
729
|
+
return X(De, C);
|
|
726
730
|
},
|
|
727
731
|
size: 180
|
|
728
732
|
},
|
|
729
733
|
{
|
|
730
734
|
accessorKey: "weightedAverage",
|
|
731
|
-
header: () =>
|
|
732
|
-
cell: (
|
|
733
|
-
const
|
|
734
|
-
if (!
|
|
735
|
-
const
|
|
736
|
-
return `${
|
|
735
|
+
header: () => V("inventory.closing.history.weightedAvgCost", "Weighted Avg Cost"),
|
|
736
|
+
cell: (l) => {
|
|
737
|
+
const s = l.getValue();
|
|
738
|
+
if (!s) return "-";
|
|
739
|
+
const C = s.amount ?? 0, h = s.precision ?? 0, F = s.currency ?? "", N = C / Math.pow(10, h);
|
|
740
|
+
return `${F} ${N.toFixed(2)}`;
|
|
737
741
|
}
|
|
738
742
|
}
|
|
739
743
|
];
|
|
740
|
-
return (
|
|
741
|
-
const
|
|
742
|
-
return n(),
|
|
743
|
-
modelValue:
|
|
744
|
-
"onUpdate:modelValue":
|
|
744
|
+
return (l, s) => {
|
|
745
|
+
const C = x("FmTextField"), h = x("FmTable"), F = x("FmButton"), N = x("FmDialog");
|
|
746
|
+
return n(), H(N, {
|
|
747
|
+
modelValue: T.value,
|
|
748
|
+
"onUpdate:modelValue": s[2] || (s[2] = (O) => T.value = O),
|
|
745
749
|
"close-button": "",
|
|
746
750
|
dismissAway: "",
|
|
747
751
|
"max-width": "900px"
|
|
748
752
|
}, {
|
|
749
|
-
"dialog-header":
|
|
750
|
-
o("div", Tt,
|
|
753
|
+
"dialog-header": I(() => [
|
|
754
|
+
o("div", Tt, a(f.value), 1)
|
|
751
755
|
]),
|
|
752
|
-
default:
|
|
753
|
-
var
|
|
756
|
+
default: I(() => {
|
|
757
|
+
var O;
|
|
754
758
|
return [
|
|
755
759
|
o("div", Bt, [
|
|
756
760
|
o("div", Lt, [
|
|
757
|
-
o("div", Ot,
|
|
758
|
-
o("div", Et,
|
|
761
|
+
o("div", Ot, a(t.type === "closing" ? c(V)("inventory.closing.history.closingId") : c(V)("inventory.closing.history.snapshotId", "Snapshot ID")), 1),
|
|
762
|
+
o("div", Et, a(((O = t.data) == null ? void 0 : O._id) ?? "-"), 1)
|
|
759
763
|
]),
|
|
760
|
-
o("div",
|
|
761
|
-
o("div",
|
|
762
|
-
o("div", Nt,
|
|
764
|
+
o("div", Ut, [
|
|
765
|
+
o("div", Pt, a(c(V)("inventory.closing.history.date")), 1),
|
|
766
|
+
o("div", Nt, a(v.value), 1)
|
|
763
767
|
]),
|
|
764
768
|
o("div", Mt, [
|
|
765
|
-
o("div", Kt,
|
|
766
|
-
_(
|
|
767
|
-
|
|
768
|
-
"
|
|
769
|
-
|
|
770
|
-
}, null, 8, ["
|
|
769
|
+
o("div", Kt, a(c(V)("inventory.closing.history.ingredientBalances", "Ingredient Balances")) + " (" + a(D.value.length) + ") ", 1),
|
|
770
|
+
_(C, {
|
|
771
|
+
modelValue: k.value,
|
|
772
|
+
"onUpdate:modelValue": s[0] || (s[0] = (j) => k.value = j),
|
|
773
|
+
placeholder: "Filter by code or name"
|
|
774
|
+
}, null, 8, ["modelValue"]),
|
|
775
|
+
_(h, {
|
|
776
|
+
"row-data": $.value,
|
|
777
|
+
"column-defs": U,
|
|
778
|
+
pagination: { pageSize: 10 },
|
|
779
|
+
"search-value": k.value
|
|
780
|
+
}, null, 8, ["row-data", "search-value"])
|
|
771
781
|
])
|
|
772
782
|
])
|
|
773
783
|
];
|
|
774
784
|
}),
|
|
775
|
-
"dialog-footer":
|
|
785
|
+
"dialog-footer": I(() => [
|
|
776
786
|
o("div", Ht, [
|
|
777
|
-
_(
|
|
787
|
+
_(F, {
|
|
778
788
|
variant: "tertiary",
|
|
779
|
-
onClick:
|
|
789
|
+
onClick: s[1] || (s[1] = (O) => T.value = !1),
|
|
780
790
|
label: "Close"
|
|
781
791
|
})
|
|
782
792
|
])
|
|
@@ -788,13 +798,13 @@ const we = { class: "fm-typo-en-heading-lg-600" }, Se = { class: "flex flex-col
|
|
|
788
798
|
}), zt = { class: "flex flex-col gap-16 p-16" }, Wt = { class: "flex flex-col gap-16" }, Yt = { class: "flex gap-8 ml-auto" }, lo = /* @__PURE__ */ ne({
|
|
789
799
|
__name: "ClosingHistoryView",
|
|
790
800
|
setup(ae) {
|
|
791
|
-
var e,
|
|
792
|
-
const { t: S } = se(),
|
|
801
|
+
var e, u;
|
|
802
|
+
const { t: S } = se(), V = ce(), M = _e(), t = ge(), L = ke(), T = re(), k = g("closings"), D = [
|
|
793
803
|
{ label: "Closings", value: "closings" },
|
|
794
804
|
{ label: "Snapshots", value: "snapshots" }
|
|
795
|
-
],
|
|
796
|
-
const
|
|
797
|
-
return
|
|
805
|
+
], v = g([]), f = g(!1), $ = g([]), U = g(!1), l = g(!1), s = g("closing"), C = g(null), h = new Date(Date.now() - 864e5), F = g(h.toISOString().split("T")[0]), N = w(() => {
|
|
806
|
+
const i = [];
|
|
807
|
+
return k.value === "closings" ? i.push(
|
|
798
808
|
{
|
|
799
809
|
label: S("inventory.stock.recalculation.title"),
|
|
800
810
|
value: "recalculation",
|
|
@@ -812,7 +822,7 @@ const we = { class: "fm-typo-en-heading-lg-600" }, Se = { class: "flex flex-col
|
|
|
812
822
|
value: "refreshOpening",
|
|
813
823
|
prependIcon: "refresh"
|
|
814
824
|
}
|
|
815
|
-
) :
|
|
825
|
+
) : i.push(
|
|
816
826
|
{
|
|
817
827
|
label: `${S("inventory.stock.recalculation.title")} (BETA)`,
|
|
818
828
|
value: "recalculation",
|
|
@@ -830,13 +840,13 @@ const we = { class: "fm-typo-en-heading-lg-600" }, Se = { class: "flex flex-col
|
|
|
830
840
|
value: "refreshStockSnapshot",
|
|
831
841
|
prependIcon: "refresh"
|
|
832
842
|
}
|
|
833
|
-
),
|
|
834
|
-
}),
|
|
835
|
-
function
|
|
836
|
-
var
|
|
837
|
-
switch (
|
|
843
|
+
), i;
|
|
844
|
+
}), O = g(), j = g();
|
|
845
|
+
function z(i) {
|
|
846
|
+
var m, R;
|
|
847
|
+
switch (i) {
|
|
838
848
|
case "recalculation":
|
|
839
|
-
return
|
|
849
|
+
return k.value === "closings" ? (m = O.value) == null ? void 0 : m.open() : (R = j.value) == null ? void 0 : R.open();
|
|
840
850
|
case "initiateOpening": {
|
|
841
851
|
L.open({
|
|
842
852
|
title: "Initiate Opening Balance",
|
|
@@ -844,12 +854,12 @@ const we = { class: "fm-typo-en-heading-lg-600" }, Se = { class: "flex flex-col
|
|
|
844
854
|
primaryActions: { text: "Confirm", close: !0 }
|
|
845
855
|
}).onPrimary(async () => {
|
|
846
856
|
try {
|
|
847
|
-
await
|
|
857
|
+
await V.initiateClosing(), T.open({
|
|
848
858
|
message: "Opening balance initiated successfully.",
|
|
849
859
|
type: "success"
|
|
850
|
-
}), await
|
|
860
|
+
}), await W();
|
|
851
861
|
} catch (B) {
|
|
852
|
-
|
|
862
|
+
T.open({
|
|
853
863
|
message: B.message || "Failed to initiate opening balance. Please try again.",
|
|
854
864
|
type: "error"
|
|
855
865
|
});
|
|
@@ -859,228 +869,228 @@ const we = { class: "fm-typo-en-heading-lg-600" }, Se = { class: "flex flex-col
|
|
|
859
869
|
}
|
|
860
870
|
case "initiateStockSnapshot": {
|
|
861
871
|
const B = new Date(Date.now() - 864e5);
|
|
862
|
-
|
|
872
|
+
F.value = B.toISOString().split("T")[0], E.value = !0;
|
|
863
873
|
break;
|
|
864
874
|
}
|
|
865
875
|
case "refreshOpening": {
|
|
866
|
-
|
|
876
|
+
W();
|
|
867
877
|
break;
|
|
868
878
|
}
|
|
869
879
|
case "refreshStockSnapshot": {
|
|
870
|
-
|
|
880
|
+
Y();
|
|
871
881
|
break;
|
|
872
882
|
}
|
|
873
883
|
}
|
|
874
884
|
}
|
|
875
|
-
const E = g(!1),
|
|
885
|
+
const E = g(!1), K = g(!1), J = (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
|
|
876
886
|
async function Q() {
|
|
877
|
-
|
|
887
|
+
K.value = !0;
|
|
878
888
|
try {
|
|
879
|
-
const
|
|
880
|
-
await
|
|
889
|
+
const i = new Date(F.value).toISOString();
|
|
890
|
+
await V.initiateStockSnapshot(i), T.open({
|
|
881
891
|
message: "Stock snapshot created successfully.",
|
|
882
892
|
type: "success"
|
|
883
|
-
}), E.value = !1, await
|
|
884
|
-
} catch (
|
|
885
|
-
|
|
886
|
-
message:
|
|
893
|
+
}), E.value = !1, await Y();
|
|
894
|
+
} catch (i) {
|
|
895
|
+
T.open({
|
|
896
|
+
message: i.message || "Failed to create stock snapshot. Please try again.",
|
|
887
897
|
type: "error"
|
|
888
898
|
});
|
|
889
899
|
} finally {
|
|
890
|
-
|
|
900
|
+
K.value = !1;
|
|
891
901
|
}
|
|
892
902
|
}
|
|
893
903
|
const q = [
|
|
894
904
|
...(e = t.sessionUser.value) != null && e.role.isAdmin ? [
|
|
895
905
|
{
|
|
896
906
|
accessorKey: "_id",
|
|
897
|
-
header: () => X(
|
|
898
|
-
cell: (
|
|
907
|
+
header: () => X(de, {}, () => `${S("inventory.closing.history.closingId")}`),
|
|
908
|
+
cell: (i) => i.getValue()
|
|
899
909
|
}
|
|
900
910
|
] : [],
|
|
901
911
|
{
|
|
902
912
|
accessorKey: "_id",
|
|
903
913
|
id: "date",
|
|
904
914
|
header: () => S("inventory.closing.history.date"),
|
|
905
|
-
cell: (
|
|
906
|
-
const
|
|
907
|
-
return new Date(
|
|
915
|
+
cell: (i) => {
|
|
916
|
+
const m = i.getValue(), R = P(m);
|
|
917
|
+
return new Date(R).toLocaleDateString();
|
|
908
918
|
}
|
|
909
919
|
},
|
|
910
920
|
{
|
|
911
921
|
accessorKey: "_id",
|
|
912
922
|
id: "time",
|
|
913
923
|
header: () => S("inventory.closing.history.time"),
|
|
914
|
-
cell: (
|
|
915
|
-
const
|
|
916
|
-
return new Date(
|
|
924
|
+
cell: (i) => {
|
|
925
|
+
const m = i.getValue(), R = P(m);
|
|
926
|
+
return new Date(R).toLocaleTimeString();
|
|
917
927
|
}
|
|
918
928
|
},
|
|
919
929
|
{
|
|
920
930
|
accessorKey: "ref",
|
|
921
931
|
header: () => S("inventory.closing.history.createdFrom"),
|
|
922
|
-
cell: (
|
|
932
|
+
cell: (i) => i.getValue() || "-"
|
|
923
933
|
}
|
|
924
934
|
], ee = [
|
|
925
|
-
...(
|
|
935
|
+
...(u = t.sessionUser.value) != null && u.role.isAdmin ? [
|
|
926
936
|
{
|
|
927
937
|
accessorKey: "_id",
|
|
928
938
|
header: () => X(
|
|
929
|
-
|
|
939
|
+
de,
|
|
930
940
|
{},
|
|
931
941
|
() => `${S("inventory.closing.history.snapshotId", "Snapshot ID")}`
|
|
932
942
|
),
|
|
933
|
-
cell: (
|
|
943
|
+
cell: (i) => i.getValue()
|
|
934
944
|
}
|
|
935
945
|
] : [],
|
|
936
946
|
{
|
|
937
947
|
accessorKey: "_id",
|
|
938
948
|
id: "date",
|
|
939
949
|
header: () => S("inventory.closing.history.date"),
|
|
940
|
-
cell: (
|
|
941
|
-
const
|
|
942
|
-
return new Date(
|
|
950
|
+
cell: (i) => {
|
|
951
|
+
const m = i.getValue(), R = P(m);
|
|
952
|
+
return new Date(R).toLocaleDateString();
|
|
943
953
|
}
|
|
944
954
|
},
|
|
945
955
|
{
|
|
946
956
|
accessorKey: "_id",
|
|
947
957
|
id: "time",
|
|
948
958
|
header: () => S("inventory.closing.history.time"),
|
|
949
|
-
cell: (
|
|
950
|
-
const
|
|
951
|
-
return new Date(
|
|
959
|
+
cell: (i) => {
|
|
960
|
+
const m = i.getValue(), R = P(m);
|
|
961
|
+
return new Date(R).toLocaleTimeString();
|
|
952
962
|
}
|
|
953
963
|
},
|
|
954
964
|
{
|
|
955
965
|
accessorKey: "remark",
|
|
956
966
|
header: () => S("inventory.closing.history.createdFrom"),
|
|
957
|
-
cell: (
|
|
967
|
+
cell: (i) => i.getValue() || "-"
|
|
958
968
|
}
|
|
959
969
|
];
|
|
960
|
-
async function
|
|
961
|
-
if (
|
|
962
|
-
|
|
970
|
+
async function W() {
|
|
971
|
+
if (M.currentLocationDBName) {
|
|
972
|
+
f.value = !0;
|
|
963
973
|
try {
|
|
964
|
-
const
|
|
965
|
-
|
|
966
|
-
} catch (
|
|
967
|
-
console.error("Error fetching closings:",
|
|
974
|
+
const i = await V.getLastNClosings(30);
|
|
975
|
+
v.value = i;
|
|
976
|
+
} catch (i) {
|
|
977
|
+
console.error("Error fetching closings:", i), v.value = [];
|
|
968
978
|
} finally {
|
|
969
|
-
|
|
979
|
+
f.value = !1;
|
|
970
980
|
}
|
|
971
981
|
}
|
|
972
982
|
}
|
|
973
|
-
async function
|
|
974
|
-
if (
|
|
975
|
-
|
|
983
|
+
async function Y() {
|
|
984
|
+
if (M.currentLocationDBName) {
|
|
985
|
+
U.value = !0;
|
|
976
986
|
try {
|
|
977
|
-
const
|
|
978
|
-
|
|
979
|
-
} catch (
|
|
980
|
-
console.error("Error fetching stock snapshots:",
|
|
987
|
+
const i = await V.getLastNStockSnapshots(30);
|
|
988
|
+
$.value = i;
|
|
989
|
+
} catch (i) {
|
|
990
|
+
console.error("Error fetching stock snapshots:", i), $.value = [];
|
|
981
991
|
} finally {
|
|
982
|
-
|
|
992
|
+
U.value = !1;
|
|
983
993
|
}
|
|
984
994
|
}
|
|
985
995
|
}
|
|
986
|
-
function te(
|
|
987
|
-
|
|
996
|
+
function te(i) {
|
|
997
|
+
s.value = "closing", C.value = i, l.value = !0;
|
|
988
998
|
}
|
|
989
|
-
function
|
|
990
|
-
|
|
999
|
+
function d(i) {
|
|
1000
|
+
s.value = "snapshot", C.value = i, l.value = !0;
|
|
991
1001
|
}
|
|
992
|
-
return
|
|
993
|
-
|
|
994
|
-
}), (
|
|
995
|
-
const
|
|
996
|
-
return n(),
|
|
997
|
-
actions:
|
|
998
|
-
title:
|
|
999
|
-
"onClick:action":
|
|
1002
|
+
return M.watchLocation(async () => {
|
|
1003
|
+
M.currentLocationDBName && (await W(), await Y());
|
|
1004
|
+
}), (i, m) => {
|
|
1005
|
+
const R = x("FmTabs"), B = x("FmTable"), oe = x("FmDatePicker"), r = x("FmButton"), y = x("FmDialog");
|
|
1006
|
+
return n(), H(pe, {
|
|
1007
|
+
actions: N.value,
|
|
1008
|
+
title: c(S)("inventory.closing.history.title"),
|
|
1009
|
+
"onClick:action": z
|
|
1000
1010
|
}, {
|
|
1001
|
-
default:
|
|
1011
|
+
default: I(() => [
|
|
1002
1012
|
o("div", zt, [
|
|
1003
1013
|
_(be, {
|
|
1004
1014
|
"change-location": "",
|
|
1005
1015
|
"hide-filter-options": !0
|
|
1006
1016
|
}),
|
|
1007
|
-
_(
|
|
1008
|
-
"model-value":
|
|
1009
|
-
"onUpdate:modelValue":
|
|
1010
|
-
items:
|
|
1017
|
+
_(R, {
|
|
1018
|
+
"model-value": k.value,
|
|
1019
|
+
"onUpdate:modelValue": m[0] || (m[0] = (A) => k.value = A),
|
|
1020
|
+
items: D
|
|
1011
1021
|
}, null, 8, ["model-value"]),
|
|
1012
|
-
|
|
1013
|
-
|
|
1022
|
+
k.value === "closings" ? (n(), p(G, { key: 0 }, [
|
|
1023
|
+
m[9] || (m[9] = o("div", { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, " Displaying the last 30 closing records. Click on a row to view details. ", -1)),
|
|
1014
1024
|
_(B, {
|
|
1015
|
-
loading:
|
|
1016
|
-
"row-data":
|
|
1025
|
+
loading: f.value,
|
|
1026
|
+
"row-data": v.value,
|
|
1017
1027
|
"column-defs": q,
|
|
1018
|
-
onRowClick:
|
|
1028
|
+
onRowClick: m[1] || (m[1] = (A) => te(A.original))
|
|
1019
1029
|
}, null, 8, ["loading", "row-data"])
|
|
1020
1030
|
], 64)) : b("", !0),
|
|
1021
|
-
|
|
1022
|
-
|
|
1031
|
+
k.value === "snapshots" ? (n(), p(G, { key: 1 }, [
|
|
1032
|
+
m[10] || (m[10] = o("div", { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, " Displaying the last 30 stock snapshot records. Snapshots are generated based on adjustments from the last 60 days. Click on a row to view details. ", -1)),
|
|
1023
1033
|
_(B, {
|
|
1024
|
-
loading:
|
|
1025
|
-
"row-data":
|
|
1034
|
+
loading: U.value,
|
|
1035
|
+
"row-data": $.value,
|
|
1026
1036
|
"column-defs": ee,
|
|
1027
|
-
onRowClick:
|
|
1037
|
+
onRowClick: m[2] || (m[2] = (A) => d(A.original))
|
|
1028
1038
|
}, null, 8, ["loading", "row-data"])
|
|
1029
1039
|
], 64)) : b("", !0)
|
|
1030
1040
|
]),
|
|
1031
|
-
(n(),
|
|
1041
|
+
(n(), H(ye, { to: "body" }, [
|
|
1032
1042
|
_(et, {
|
|
1033
1043
|
"show-button": !1,
|
|
1034
1044
|
ref_key: "recalculationDialogRef",
|
|
1035
|
-
ref:
|
|
1036
|
-
onSubmitted:
|
|
1045
|
+
ref: O,
|
|
1046
|
+
onSubmitted: m[3] || (m[3] = (A) => W())
|
|
1037
1047
|
}, null, 512),
|
|
1038
1048
|
_(It, {
|
|
1039
1049
|
"show-button": !1,
|
|
1040
1050
|
ref_key: "snapshotRecalculationDialogRef",
|
|
1041
|
-
ref:
|
|
1042
|
-
onSubmitted:
|
|
1051
|
+
ref: j,
|
|
1052
|
+
onSubmitted: m[4] || (m[4] = (A) => Y())
|
|
1043
1053
|
}, null, 512),
|
|
1044
1054
|
_(jt, {
|
|
1045
|
-
modelValue:
|
|
1046
|
-
"onUpdate:modelValue":
|
|
1047
|
-
type:
|
|
1048
|
-
data:
|
|
1055
|
+
modelValue: l.value,
|
|
1056
|
+
"onUpdate:modelValue": m[5] || (m[5] = (A) => l.value = A),
|
|
1057
|
+
type: s.value,
|
|
1058
|
+
data: C.value
|
|
1049
1059
|
}, null, 8, ["modelValue", "type", "data"]),
|
|
1050
1060
|
_(y, {
|
|
1051
1061
|
modelValue: E.value,
|
|
1052
|
-
"onUpdate:modelValue":
|
|
1062
|
+
"onUpdate:modelValue": m[8] || (m[8] = (A) => E.value = A),
|
|
1053
1063
|
"close-button": "",
|
|
1054
1064
|
dismissAway: "",
|
|
1055
1065
|
"max-width": "400px"
|
|
1056
1066
|
}, {
|
|
1057
|
-
"dialog-header":
|
|
1067
|
+
"dialog-header": I(() => m[11] || (m[11] = [
|
|
1058
1068
|
o("div", { class: "fm-typo-en-heading-lg-600" }, "Initiate Stock Snapshot", -1)
|
|
1059
1069
|
])),
|
|
1060
|
-
default:
|
|
1070
|
+
default: I(() => [
|
|
1061
1071
|
o("div", Wt, [
|
|
1062
|
-
|
|
1072
|
+
m[12] || (m[12] = o("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " Create a stock snapshot for the selected date. The snapshot will capture stock balances based on adjustments from the last 60 days before the selected date. ", -1)),
|
|
1063
1073
|
_(oe, {
|
|
1064
|
-
modelValue:
|
|
1065
|
-
"onUpdate:modelValue":
|
|
1074
|
+
modelValue: F.value,
|
|
1075
|
+
"onUpdate:modelValue": m[6] || (m[6] = (A) => F.value = A),
|
|
1066
1076
|
label: "Snapshot Date",
|
|
1067
|
-
max:
|
|
1077
|
+
max: c(J)
|
|
1068
1078
|
}, null, 8, ["modelValue", "max"])
|
|
1069
1079
|
])
|
|
1070
1080
|
]),
|
|
1071
|
-
"dialog-footer":
|
|
1081
|
+
"dialog-footer": I(() => [
|
|
1072
1082
|
o("div", Yt, [
|
|
1073
|
-
_(
|
|
1083
|
+
_(r, {
|
|
1074
1084
|
variant: "tertiary",
|
|
1075
|
-
onClick:
|
|
1085
|
+
onClick: m[7] || (m[7] = (A) => E.value = !1),
|
|
1076
1086
|
label: "Cancel",
|
|
1077
|
-
disabled:
|
|
1087
|
+
disabled: K.value
|
|
1078
1088
|
}, null, 8, ["disabled"]),
|
|
1079
|
-
_(
|
|
1089
|
+
_(r, {
|
|
1080
1090
|
variant: "primary",
|
|
1081
1091
|
onClick: Q,
|
|
1082
1092
|
label: "Confirm",
|
|
1083
|
-
loading:
|
|
1093
|
+
loading: K.value
|
|
1084
1094
|
}, null, 8, ["loading"])
|
|
1085
1095
|
])
|
|
1086
1096
|
]),
|