@feedmepos/mf-inventory-portal 1.5.10 → 1.5.11-dev.2
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-erqZSd0c.js → App-CquCiNsy.js} +4 -4
- package/dist/{ApprovalView-C2CGthqi.js → ApprovalView-CU-k06kj.js} +7 -7
- package/dist/{BindingsDialog-Cw6MdCbI.js → BindingsDialog-BPBKfeS6.js} +2 -2
- package/dist/{BindingsPicker-CcSrxhUo.js → BindingsPicker-DkBI7_0Y.js} +2 -2
- package/dist/{BindingsTable-C5nMju9L.js → BindingsTable-C22g1gV7.js} +3 -3
- package/dist/{ClosingDraftView-C_Loim5S.js → ClosingDraftView-DgHvcVne.js} +15 -15
- package/dist/ClosingHistoryView-Cjm39o7e.js +1114 -0
- package/dist/{ClosingTemplateView-PQdTcIFY.js → ClosingTemplateView-BfO_HZS-.js} +14 -14
- package/dist/{DefaultView-BIlFmXaB.js → DefaultView-Jl_IdT_Z.js} +2 -2
- package/dist/{DeliveryOrderPrintPreview-BhT1YxRZ.js → DeliveryOrderPrintPreview-CaWTHT6h.js} +2 -2
- package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-DO7xvy5V.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-BXmbD4jZ.js} +2 -2
- package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-Bf6RHJdQ.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DWm36ZgX.js} +2 -2
- package/dist/{FmMultiselectDialog-cXV6Jo4B.js → FmMultiselectDialog-CEsqNTCq.js} +2 -2
- package/dist/{FmMultiselectDialog-B-X6WQXu.js → FmMultiselectDialog-D4gqa0tb.js} +1 -1
- package/dist/FmUnitInput.vue_vue_type_script_setup_true_lang-4NtlySGX.js +388 -0
- package/dist/{ImportView-B3jO8aU8.js → ImportView-GTiAyijj.js} +6 -6
- package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-GPVWrmed.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-BHRq2v-2.js} +1 -1
- package/dist/{IngredientGroupView-BuUoHLDb.js → IngredientGroupView-Kk002hXi.js} +5 -5
- package/dist/{IngredientsView-Dq_YrtQ5.js → IngredientsView-8Dojrj1e.js} +15 -15
- package/dist/{IntegrationExplorerView-Dh5ZPJK-.js → IntegrationExplorerView-BVBqUc3k.js} +352 -352
- package/dist/{IntegrationView-DWbHZdc4.js → IntegrationView-eS-LnDeu.js} +13 -13
- package/dist/{InventoryBindingForm-D-EN8Tpz.js → InventoryBindingForm-DitsFH4v.js} +1 -1
- package/dist/InventoryBindingForm.vue_vue_type_script_setup_true_lang-DncMbF6J.js +429 -0
- package/dist/{InventoryBindingSummary-BTagfxn1.js → InventoryBindingSummary-DIKZ_7lC.js} +1 -1
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-BUBHDMNn.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DJV_hhgt.js} +1 -1
- package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-D2B20Qv0.js → PremiumBadge.vue_vue_type_script_setup_true_lang-Pjde4sd6.js} +1 -1
- package/dist/{PublishView-CpiWv2n6.js → PublishView-CTwkJWJj.js} +3 -3
- package/dist/{PurchaseOrderPrintPreview-Czi5Aip0.js → PurchaseOrderPrintPreview-BuP85XCw.js} +2 -2
- package/dist/{ReceiveRequestView-BVEU4j9p.js → ReceiveRequestView-CfWhi-qh.js} +9631 -9552
- package/dist/{RecipeView-OVmWTAt-.js → RecipeView-CaNmJwqf.js} +1316 -1291
- package/dist/{SettingsView-CMQLojRr.js → SettingsView-DiMxunWj.js} +4 -4
- package/dist/{StockView-DZeeZlJq.js → StockView-CWDb29Cp.js} +19 -19
- package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-Bf1b1rJK.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-0MNUfMmq.js} +1 -1
- package/dist/{SupplierView-BcmkfFvI.js → SupplierView-CLB-ASht.js} +12 -12
- package/dist/{SurchargeView-DhcatJUO.js → SurchargeView-C2clhhAW.js} +6 -6
- package/dist/{SystemTrailDialog.vue_vue_type_script_setup_true_lang-D6bwhx8Z.js → SystemTrailDialog.vue_vue_type_script_setup_true_lang-DF-LJ-3w.js} +2 -2
- package/dist/{TemplatePublishDialog.vue_vue_type_script_setup_true_lang-4Ti9w_wf.js → TemplatePublishDialog.vue_vue_type_script_setup_true_lang-Ga9lkrf8.js} +1 -1
- package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-Dw1TIZVj.js → TransferDetails.vue_vue_type_script_setup_true_lang-R1t4S-6H.js} +20 -20
- package/dist/{TransferTemplateView-CRPvLRHd.js → TransferTemplateView-7lXzFWv2.js} +18 -18
- package/dist/{UnitCostHistoryView-B4pAplGT.js → UnitCostHistoryView-CZg_dxvk.js} +4 -4
- package/dist/UnitDisplayControl.vue_vue_type_script_setup_true_lang-BB3dV6Gh.js +160 -0
- package/dist/{UnitView-95-cARn9.js → UnitView-BnZ_3MwD.js} +7 -7
- package/dist/{WarehouseView-o1FxslRs.js → WarehouseView-D7j9qMqP.js} +5 -5
- package/dist/{WastageTemplateView-D3hu-bq0.js → WastageTemplateView-Cl_9lPqx.js} +14 -14
- package/dist/{app-BEJm79K1.js → app-DMMqtQts.js} +23 -11
- package/dist/app.d.ts +12 -0
- package/dist/app.js +1 -1
- package/dist/{closing-template-BotB3jos.js → closing-template-CiSNSKyE.js} +1 -1
- package/dist/{date2-CnEklTL8.js → date2-Db-IPmri.js} +1 -1
- package/dist/{dayjs.min-CUR65wqq.js → dayjs.min-DD2BO69F.js} +1 -1
- package/dist/{decimal-CV_OL7iL.js → decimal-Ds6h3ukt.js} +2 -2
- package/dist/{defineDeepModel-D7NJvnaz.js → defineDeepModel-BgonxmUi.js} +1 -1
- package/dist/{duplicate-template-DCaAVNSG.js → duplicate-template-L6x61phF.js} +1 -1
- package/dist/{feature-BpZTiO4W.js → feature-C0UUWbkT.js} +2 -2
- package/dist/{format-time-from-id-Awu23hHz.js → format-time-from-id-lrFC2RMu.js} +1 -1
- package/dist/{format-unit-display-B2_RGXzk.js → format-unit-display-CpwFmpcL.js} +11 -11
- package/dist/{import-export.helper-BuNDvFsc.js → import-export.helper-BtXLvHMF.js} +6 -6
- package/dist/{index-BBqEhoS9.js → index-Cej2xM-2.js} +1 -1
- package/dist/{index-BK75WSFH.js → index-CxALGEZr.js} +3 -3
- package/dist/{index-D_u-AkFp.js → index-mtJ1GhRU.js} +1 -1
- package/dist/{inventory-core-dart.default-D_hfcDPc.js → inventory-core-dart.default-CroeeGeI.js} +1 -1
- package/dist/{lz-string-K7l_8Og1.js → lz-string-TL3mT9nT.js} +1 -1
- package/dist/{netsuite-CPUKn7UQ.js → netsuite-DOpNemik.js} +2 -2
- package/dist/{number-DoYjk_zN.js → number-DlYhqTV5.js} +3 -3
- package/dist/{predefined-templates-CEDkdeWc.js → predefined-templates-DDpVS07Q.js} +1 -1
- package/dist/{purchase-order-template-ChZyiCwx.js → purchase-order-template-K6HvK5h0.js} +1 -1
- package/dist/{recalculationUtils-CEkm9-mp.js → recalculationUtils-BHomSQPu.js} +1 -1
- package/dist/{rules-DDjcQi_O.js → rules-r7ubhhR0.js} +2 -2
- package/dist/{stock-Voq2gMuS.js → stock-BcLy5Ilr.js} +1 -1
- package/dist/{supplier-DFopX4OU.js → supplier-rNHLA7rt.js} +2 -2
- package/dist/{surcharge-CjwbPJQi.js → surcharge-B5N4UzQl.js} +1 -1
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{uom-rules-CHnn3ILl.js → uom-rules-B51fYVj3.js} +1 -1
- package/dist/{use-ingredient-select-dialog-DS6__LXy.js → use-ingredient-select-dialog-C7NY9Kj6.js} +2 -2
- package/dist/{use-inventory-binding-dialog-DcJJo3Lr.js → use-inventory-binding-dialog-Ca4VaXkz.js} +2 -2
- package/dist/{use-template-enabled-locations-BVs_0JOA.js → use-template-enabled-locations-RiR-qhSs.js} +2 -2
- package/dist/{use-transfer-locations-Dzp5fj3Z.js → use-transfer-locations-csQ1Ar0m.js} +2 -2
- package/dist/{useHrmPermission-DQQ5MYsL.js → useHrmPermission-DHcinOeI.js} +1 -1
- package/dist/{useNavigationMenu-msCIV-Ux.js → useNavigationMenu-u8V59Vtc.js} +2 -2
- package/dist/{useSseClient-cer6d2VA.js → useSseClient-UQLgDoDc.js} +3 -3
- package/dist/views/receive-request/components/transfer-form/TransferFormProps.d.ts +2 -0
- package/dist/views/receive-request/components/transfer-form/composables/use-stock-balance-toggle.d.ts +3 -0
- package/dist/views/receive-request/components/transfer-form/composables/use-transfer-items.d.ts +4 -0
- package/dist/{vue-i18n-BiedKAFs.js → vue-i18n-CD-rDdDv.js} +534 -534
- package/dist/{xlsx-DGn-BAF9.js → xlsx-BRq0kYfc.js} +1 -1
- package/dist/{xlsx.util-DXnaPoeW.js → xlsx.util-ylgVcZid.js} +3 -3
- package/package.json +2 -2
- package/dist/ClosingHistoryView-7TcMNjKb.js +0 -1108
- package/dist/FmUnitInput.vue_vue_type_script_setup_true_lang-BHazP1jS.js +0 -362
- package/dist/InventoryBindingForm.vue_vue_type_script_setup_true_lang-CI4hutH2.js +0 -404
- package/dist/UnitDisplayControl.vue_vue_type_script_setup_true_lang-D3OGljNP.js +0 -137
- package/dist/export-HmzdllkU.js +0 -26
|
@@ -0,0 +1,1114 @@
|
|
|
1
|
+
import { defineComponent as se, ref as g, computed as w, watch as ce, resolveComponent as x, openBlock as n, createElementBlock as y, createBlock as z, withModifiers as me, createCommentVNode as b, createVNode as _, withCtx as R, createElementVNode as o, toDisplayString as a, unref as i, Fragment as Q, createTextVNode as ee, renderList as ne, normalizeClass as fe, h as q, Teleport as ye } from "vue";
|
|
2
|
+
import { _ as ge } from "./SingleColumnLayout.vue_vue_type_script_setup_true_lang-DGlWE5I8.js";
|
|
3
|
+
import { useI18n as ie, useCoreStore as he } from "@feedmepos/mf-common";
|
|
4
|
+
import { E as re, B as N, a as _e, u as be } from "./app-DMMqtQts.js";
|
|
5
|
+
import { F as ue } from "./FmAdminBadge-DjnBAgyv.js";
|
|
6
|
+
import { _ as ke } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DWm36ZgX.js";
|
|
7
|
+
import { useSnackbar as de, useDialog as xe } from "@feedmepos/ui-library";
|
|
8
|
+
import { u as pe } from "./stock-BcLy5Ilr.js";
|
|
9
|
+
import { g as ve, f as De } from "./recalculationUtils-BHomSQPu.js";
|
|
10
|
+
import { _ as we } from "./UnitDisplayControl.vue_vue_type_script_setup_true_lang-BB3dV6Gh.js";
|
|
11
|
+
const Se = { class: "fm-typo-en-heading-lg-600" }, Ve = { class: "flex flex-col gap-16" }, Ce = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, $e = { class: "flex flex-col gap-8" }, Ae = { class: "fm-typo-en-body-md-600" }, Fe = { class: "flex flex-col gap-8" }, Re = { class: "fm-typo-en-body-md-600" }, Ie = { class: "flex items-center gap-8 mb-8" }, Be = {
|
|
12
|
+
key: 2,
|
|
13
|
+
class: "text-red-500 text-sm mt-2"
|
|
14
|
+
}, Te = { class: "fm-typo-en-body-sm-400" }, Le = {
|
|
15
|
+
key: 1,
|
|
16
|
+
class: "p-12 border border-fm-color-border-primary rounded-8 bg-fm-color-background-secondary"
|
|
17
|
+
}, Oe = {
|
|
18
|
+
key: 0,
|
|
19
|
+
class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
|
|
20
|
+
}, Ee = {
|
|
21
|
+
key: 1,
|
|
22
|
+
class: "flex flex-col gap-8"
|
|
23
|
+
}, Ue = { class: "fm-typo-en-body-sm-600" }, Pe = { class: "flex flex-col gap-4" }, Ne = { key: 0 }, Me = {
|
|
24
|
+
key: 1,
|
|
25
|
+
class: "flex flex-col gap-8"
|
|
26
|
+
}, Ke = { class: "fm-typo-en-body-md-600" }, je = { class: "flex flex-col gap-8 max-h-[300px] overflow-y-auto" }, He = { class: "flex items-center justify-between" }, ze = { class: "fm-typo-en-body-sm-600" }, We = { class: "flex items-center gap-8" }, Ye = {
|
|
27
|
+
key: 0,
|
|
28
|
+
class: "fm-typo-en-body-xs-600 px-8 py-4 rounded-4 bg-fm-color-neutral-100 text-fm-color-typo-secondary"
|
|
29
|
+
}, Ge = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Je = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Qe = {
|
|
30
|
+
key: 0,
|
|
31
|
+
class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
|
|
32
|
+
}, Xe = {
|
|
33
|
+
key: 1,
|
|
34
|
+
class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
|
|
35
|
+
}, Ze = {
|
|
36
|
+
key: 2,
|
|
37
|
+
class: "fm-typo-en-body-xs-400 text-fm-color-system-error-500"
|
|
38
|
+
}, qe = {
|
|
39
|
+
key: 0,
|
|
40
|
+
class: "flex gap-8 ml-auto"
|
|
41
|
+
}, et = {
|
|
42
|
+
key: 1,
|
|
43
|
+
class: "flex gap-8 ml-auto"
|
|
44
|
+
}, tt = /* @__PURE__ */ se({
|
|
45
|
+
__name: "RecalculationDialog",
|
|
46
|
+
props: {
|
|
47
|
+
showButton: { type: Boolean }
|
|
48
|
+
},
|
|
49
|
+
emits: ["submitted"],
|
|
50
|
+
setup(ae, { expose: S, emit: V }) {
|
|
51
|
+
const K = V, { t } = ie(), L = pe(), I = re(), k = de(), D = g(!1), v = g(""), m = g(""), $ = g(!1), O = g([]), l = g(!1), s = g([]), C = g(!1), h = g([]), F = g(!1), B = w(() => ve(O.value)), E = w(() => {
|
|
52
|
+
if (!v.value) return [];
|
|
53
|
+
const r = B.value.find((e) => e.value === v.value);
|
|
54
|
+
return r ? B.value.filter((e) => e.date.getTime() > r.date.getTime()).sort((e, d) => d.date.getTime() - e.date.getTime()) : [];
|
|
55
|
+
}), W = w({
|
|
56
|
+
get: () => {
|
|
57
|
+
if ($.value && m.value) {
|
|
58
|
+
const r = O.value.find((e) => N(e._id) === m.value);
|
|
59
|
+
return (r == null ? void 0 : r._id) || m.value;
|
|
60
|
+
}
|
|
61
|
+
return m.value;
|
|
62
|
+
},
|
|
63
|
+
set: (r) => {
|
|
64
|
+
$.value && r ? m.value = N(r) : m.value = r;
|
|
65
|
+
}
|
|
66
|
+
}), j = w(() => {
|
|
67
|
+
if (v.value)
|
|
68
|
+
try {
|
|
69
|
+
const r = N(v.value);
|
|
70
|
+
if (r)
|
|
71
|
+
return r;
|
|
72
|
+
} catch (r) {
|
|
73
|
+
console.error("Error parsing date from closing ID:", r);
|
|
74
|
+
}
|
|
75
|
+
}), Y = w(() => {
|
|
76
|
+
if (!v.value || !m.value) return "";
|
|
77
|
+
const r = N(v.value), e = m.value;
|
|
78
|
+
if (r && e) {
|
|
79
|
+
const d = new Date(r).getTime();
|
|
80
|
+
if (new Date(e).getTime() <= d)
|
|
81
|
+
return t("inventory.stock.recalculation.error.endDateBeforeOpening");
|
|
82
|
+
}
|
|
83
|
+
return "";
|
|
84
|
+
}), M = w(() => !!v.value && !!m.value && !Y.value), H = w(() => s.value.some(
|
|
85
|
+
(r) => !r.completedAt && !r.failedReason
|
|
86
|
+
));
|
|
87
|
+
async function X() {
|
|
88
|
+
D.value = !0, await Promise.all([oe(), Z()]), v.value = "", m.value = "", $.value = !1;
|
|
89
|
+
}
|
|
90
|
+
function te() {
|
|
91
|
+
D.value = !1;
|
|
92
|
+
}
|
|
93
|
+
S({
|
|
94
|
+
open: X,
|
|
95
|
+
close: te
|
|
96
|
+
});
|
|
97
|
+
async function oe() {
|
|
98
|
+
l.value = !0;
|
|
99
|
+
try {
|
|
100
|
+
const r = await I.getLastNClosings(30);
|
|
101
|
+
O.value = r;
|
|
102
|
+
} catch (r) {
|
|
103
|
+
console.error("Error fetching recent closings:", r), k.open({
|
|
104
|
+
title: t("common.error"),
|
|
105
|
+
message: "Failed to fetch recent closings",
|
|
106
|
+
type: "error"
|
|
107
|
+
});
|
|
108
|
+
} finally {
|
|
109
|
+
l.value = !1;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
async function Z() {
|
|
113
|
+
C.value = !0;
|
|
114
|
+
try {
|
|
115
|
+
const r = await L.recalculation.recalculationRequests();
|
|
116
|
+
s.value = r;
|
|
117
|
+
} catch (r) {
|
|
118
|
+
console.error("Error fetching recalculation requests:", r);
|
|
119
|
+
} finally {
|
|
120
|
+
C.value = !1;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
async function G() {
|
|
124
|
+
if (!v.value || !m.value) {
|
|
125
|
+
h.value = [];
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
F.value = !0;
|
|
129
|
+
try {
|
|
130
|
+
const r = await L.recalculation.getAffectedClosingDrafts(
|
|
131
|
+
v.value,
|
|
132
|
+
m.value
|
|
133
|
+
);
|
|
134
|
+
h.value = r;
|
|
135
|
+
} catch {
|
|
136
|
+
k.open({
|
|
137
|
+
title: t("common.error"),
|
|
138
|
+
message: "Failed to fetch affected closing drafts",
|
|
139
|
+
type: "error"
|
|
140
|
+
}), h.value = [];
|
|
141
|
+
} finally {
|
|
142
|
+
F.value = !1;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
ce(
|
|
146
|
+
[v, m],
|
|
147
|
+
() => {
|
|
148
|
+
v.value && m.value && !Y.value ? G() : h.value = [];
|
|
149
|
+
},
|
|
150
|
+
{ immediate: !1 }
|
|
151
|
+
);
|
|
152
|
+
async function J() {
|
|
153
|
+
if (M.value) {
|
|
154
|
+
l.value = !0;
|
|
155
|
+
try {
|
|
156
|
+
if (await L.recalculation.scheduleRecalculation({
|
|
157
|
+
openingId: v.value,
|
|
158
|
+
untilDate: m.value
|
|
159
|
+
}), h.value.length > 0) {
|
|
160
|
+
const r = h.value.map((e) => e._id);
|
|
161
|
+
await L.recalculation.scheduleInvalidateClosingDraftCache(r);
|
|
162
|
+
}
|
|
163
|
+
k.open({
|
|
164
|
+
title: t("common.success"),
|
|
165
|
+
message: "Stock recalculation has been scheduled successfully",
|
|
166
|
+
type: "success"
|
|
167
|
+
}), await Z(), D.value = !1, K("submitted");
|
|
168
|
+
} catch (r) {
|
|
169
|
+
console.error("Error scheduling recalculation:", r), k.open({
|
|
170
|
+
title: t("common.error"),
|
|
171
|
+
message: "Failed to schedule stock recalculation",
|
|
172
|
+
type: "error"
|
|
173
|
+
});
|
|
174
|
+
} finally {
|
|
175
|
+
l.value = !1;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
return (r, e) => {
|
|
180
|
+
const d = x("FmButton"), U = x("FmSelect"), c = x("FmRadio"), f = x("FmDatePicker"), A = x("FmAlert"), P = x("FmDialog");
|
|
181
|
+
return n(), y("div", null, [
|
|
182
|
+
r.showButton ? (n(), z(d, {
|
|
183
|
+
key: 0,
|
|
184
|
+
"prepend-icon": "info",
|
|
185
|
+
variant: "tertiary",
|
|
186
|
+
onClick: me(X, ["stop"])
|
|
187
|
+
})) : b("", !0),
|
|
188
|
+
_(P, {
|
|
189
|
+
modelValue: D.value,
|
|
190
|
+
"onUpdate:modelValue": e[7] || (e[7] = (u) => D.value = u),
|
|
191
|
+
"close-button": "",
|
|
192
|
+
dismissAway: "",
|
|
193
|
+
"max-width": "600px"
|
|
194
|
+
}, {
|
|
195
|
+
"dialog-header": R(() => [
|
|
196
|
+
o("div", Se, a(i(t)("inventory.stock.recalculation.title")), 1)
|
|
197
|
+
]),
|
|
198
|
+
"dialog-footer": R(() => [
|
|
199
|
+
H.value ? (n(), y("div", et, [
|
|
200
|
+
_(d, {
|
|
201
|
+
variant: "tertiary",
|
|
202
|
+
onClick: e[6] || (e[6] = (u) => D.value = !1),
|
|
203
|
+
label: i(t)("common.close")
|
|
204
|
+
}, null, 8, ["label"])
|
|
205
|
+
])) : (n(), y("div", qe, [
|
|
206
|
+
_(d, {
|
|
207
|
+
variant: "tertiary",
|
|
208
|
+
onClick: e[5] || (e[5] = (u) => D.value = !1),
|
|
209
|
+
disabled: l.value,
|
|
210
|
+
label: i(t)("common.cancel")
|
|
211
|
+
}, null, 8, ["disabled", "label"]),
|
|
212
|
+
_(d, {
|
|
213
|
+
variant: "primary",
|
|
214
|
+
onClick: J,
|
|
215
|
+
disabled: !M.value || l.value,
|
|
216
|
+
loading: l.value,
|
|
217
|
+
label: i(t)("inventory.stock.recalculation.schedule")
|
|
218
|
+
}, null, 8, ["disabled", "loading", "label"])
|
|
219
|
+
]))
|
|
220
|
+
]),
|
|
221
|
+
default: R(() => [
|
|
222
|
+
o("div", Ve, [
|
|
223
|
+
o("div", Ce, a(i(t)("inventory.stock.recalculation.description")), 1),
|
|
224
|
+
H.value ? b("", !0) : (n(), y(Q, { key: 0 }, [
|
|
225
|
+
o("div", $e, [
|
|
226
|
+
o("p", Ae, [
|
|
227
|
+
ee(a(i(t)("inventory.stock.recalculation.openingDate")) + " ", 1),
|
|
228
|
+
e[8] || (e[8] = o("span", { class: "text-fm-color-system-error-300" }, "*", -1))
|
|
229
|
+
]),
|
|
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
|
+
_(U, {
|
|
232
|
+
modelValue: v.value,
|
|
233
|
+
"onUpdate:modelValue": e[0] || (e[0] = (u) => v.value = u),
|
|
234
|
+
items: B.value,
|
|
235
|
+
placeholder: i(t)("inventory.stock.recalculation.selectOpening"),
|
|
236
|
+
loading: l.value,
|
|
237
|
+
disabled: l.value
|
|
238
|
+
}, null, 8, ["modelValue", "items", "placeholder", "loading", "disabled"])
|
|
239
|
+
]),
|
|
240
|
+
o("div", Fe, [
|
|
241
|
+
o("p", Re, [
|
|
242
|
+
ee(a(i(t)("inventory.stock.recalculation.untilDate")) + " ", 1),
|
|
243
|
+
e[10] || (e[10] = o("span", { class: "text-fm-color-system-error-300" }, "*", -1))
|
|
244
|
+
]),
|
|
245
|
+
o("div", Ie, [
|
|
246
|
+
_(c, {
|
|
247
|
+
modelValue: $.value,
|
|
248
|
+
"onUpdate:modelValue": e[1] || (e[1] = (u) => $.value = u),
|
|
249
|
+
value: !1,
|
|
250
|
+
label: i(t)("inventory.stock.recalculation.selectByDate")
|
|
251
|
+
}, null, 8, ["modelValue", "label"]),
|
|
252
|
+
_(c, {
|
|
253
|
+
modelValue: $.value,
|
|
254
|
+
"onUpdate:modelValue": e[2] || (e[2] = (u) => $.value = u),
|
|
255
|
+
value: !0,
|
|
256
|
+
label: i(t)("inventory.stock.recalculation.selectByClosing")
|
|
257
|
+
}, null, 8, ["modelValue", "label"])
|
|
258
|
+
]),
|
|
259
|
+
$.value ? (n(), z(U, {
|
|
260
|
+
key: 1,
|
|
261
|
+
modelValue: W.value,
|
|
262
|
+
"onUpdate:modelValue": e[4] || (e[4] = (u) => W.value = u),
|
|
263
|
+
items: E.value,
|
|
264
|
+
placeholder: i(t)("inventory.stock.recalculation.selectClosing"),
|
|
265
|
+
loading: l.value,
|
|
266
|
+
disabled: !v.value || l.value
|
|
267
|
+
}, null, 8, ["modelValue", "items", "placeholder", "loading", "disabled"])) : (n(), z(f, {
|
|
268
|
+
key: 0,
|
|
269
|
+
modelValue: m.value,
|
|
270
|
+
"onUpdate:modelValue": e[3] || (e[3] = (u) => m.value = u),
|
|
271
|
+
placeholder: i(t)("inventory.stock.recalculation.selectDate"),
|
|
272
|
+
min: j.value,
|
|
273
|
+
disabled: !v.value || l.value
|
|
274
|
+
}, null, 8, ["modelValue", "placeholder", "min", "disabled"])),
|
|
275
|
+
Y.value ? (n(), y("div", Be, a(Y.value), 1)) : b("", !0)
|
|
276
|
+
]),
|
|
277
|
+
v.value && m.value && !Y.value ? (n(), z(A, {
|
|
278
|
+
key: 0,
|
|
279
|
+
type: "info"
|
|
280
|
+
}, {
|
|
281
|
+
default: R(() => [
|
|
282
|
+
o("div", Te, a(i(t)("inventory.stock.recalculation.info")), 1)
|
|
283
|
+
]),
|
|
284
|
+
_: 1
|
|
285
|
+
})) : b("", !0),
|
|
286
|
+
h.value.length > 0 ? (n(), y("div", Le, [
|
|
287
|
+
F.value ? (n(), y("div", Oe, " Loading affected closing drafts... ")) : (n(), y("div", Ee, [
|
|
288
|
+
o("div", Ue, " Affected closing draft(s): " + a(h.value.length), 1),
|
|
289
|
+
o("div", Pe, [
|
|
290
|
+
(n(!0), y(Q, null, ne(h.value, (u) => (n(), y("div", {
|
|
291
|
+
key: u._id,
|
|
292
|
+
class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
|
|
293
|
+
}, [
|
|
294
|
+
ee(" • " + a(u._id) + " ", 1),
|
|
295
|
+
u.effectiveAt ? (n(), y("span", Ne, " (" + a(new Date(u.effectiveAt).toLocaleString()) + ") ", 1)) : b("", !0)
|
|
296
|
+
]))), 128))
|
|
297
|
+
])
|
|
298
|
+
]))
|
|
299
|
+
])) : b("", !0)
|
|
300
|
+
], 64)),
|
|
301
|
+
s.value.length > 0 ? (n(), y("div", Me, [
|
|
302
|
+
o("p", Ke, a(i(t)("inventory.stock.recalculation.recentRequests")), 1),
|
|
303
|
+
o("div", je, [
|
|
304
|
+
(n(!0), y(Q, null, ne(s.value, (u) => {
|
|
305
|
+
var p;
|
|
306
|
+
return n(), y("div", {
|
|
307
|
+
key: u._id,
|
|
308
|
+
class: "p-12 border border-fm-color-border-primary rounded-8 flex flex-col gap-4"
|
|
309
|
+
}, [
|
|
310
|
+
o("div", He, [
|
|
311
|
+
o("div", ze, a(i(t)("inventory.stock.recalculation.requestedAt")) + ": " + a(new Date(u.createdAt).toLocaleString()), 1),
|
|
312
|
+
o("div", We, [
|
|
313
|
+
(p = u.meta) != null && p.openingType ? (n(), y("div", Ye, a(u.meta.openingType === "stockSnapshot" ? "Snapshot" : "Closing"), 1)) : b("", !0),
|
|
314
|
+
o("div", {
|
|
315
|
+
class: fe(["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": u.failedReason,
|
|
317
|
+
"bg-fm-color-system-success-100 text-fm-color-system-success-500": u.completedAt,
|
|
318
|
+
"bg-fm-color-system-info-100 text-fm-color-system-info-500": !u.failedReason && !u.completedAt
|
|
319
|
+
}])
|
|
320
|
+
}, a(u.failedReason ? i(t)("inventory.stock.recalculation.status.failed") : u.completedAt ? i(t)("inventory.stock.recalculation.status.completed") : i(t)("inventory.stock.recalculation.status.inProgress")), 3)
|
|
321
|
+
])
|
|
322
|
+
]),
|
|
323
|
+
o("div", Ge, a(i(t)("inventory.stock.recalculation.from")) + ": " + a(new Date(u.recalculateStartDate).toLocaleDateString()), 1),
|
|
324
|
+
o("div", Je, a(i(t)("inventory.stock.recalculation.to")) + ": " + a(new Date(u.recalculateEndDate).toLocaleDateString()), 1),
|
|
325
|
+
u.createdBy ? (n(), y("div", Qe, a(i(t)("inventory.stock.recalculation.requestedBy")) + ": " + a(u.createdBy.name || u.createdBy.id), 1)) : b("", !0),
|
|
326
|
+
u.completedAt ? (n(), y("div", Xe, a(i(t)("inventory.stock.recalculation.completedAt")) + ": " + a(new Date(u.completedAt).toLocaleString()), 1)) : b("", !0),
|
|
327
|
+
u.failedReason ? (n(), y("div", Ze, a(u.failedReason), 1)) : b("", !0)
|
|
328
|
+
]);
|
|
329
|
+
}), 128))
|
|
330
|
+
])
|
|
331
|
+
])) : b("", !0)
|
|
332
|
+
])
|
|
333
|
+
]),
|
|
334
|
+
_: 1
|
|
335
|
+
}, 8, ["modelValue"])
|
|
336
|
+
]);
|
|
337
|
+
};
|
|
338
|
+
}
|
|
339
|
+
}), ot = { class: "fm-typo-en-heading-lg-600" }, at = { class: "flex flex-col gap-16" }, lt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, nt = { class: "flex flex-col gap-8" }, st = { class: "fm-typo-en-body-md-600" }, it = { class: "flex flex-col gap-8" }, ct = { class: "fm-typo-en-body-md-600" }, rt = {
|
|
340
|
+
key: 0,
|
|
341
|
+
class: "text-red-500 text-sm mt-2"
|
|
342
|
+
}, dt = { class: "fm-typo-en-body-sm-400" }, ut = {
|
|
343
|
+
key: 1,
|
|
344
|
+
class: "p-12 border border-fm-color-border-primary rounded-8 bg-fm-color-background-secondary"
|
|
345
|
+
}, mt = {
|
|
346
|
+
key: 0,
|
|
347
|
+
class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
|
|
348
|
+
}, ft = {
|
|
349
|
+
key: 1,
|
|
350
|
+
class: "flex flex-col gap-8"
|
|
351
|
+
}, pt = { class: "fm-typo-en-body-sm-600" }, vt = { class: "flex flex-col gap-4" }, yt = { key: 0 }, gt = { key: 1 }, ht = { key: 2 }, _t = {
|
|
352
|
+
key: 1,
|
|
353
|
+
class: "flex flex-col gap-8"
|
|
354
|
+
}, bt = { class: "fm-typo-en-body-md-600" }, kt = { class: "flex flex-col gap-8 max-h-[300px] overflow-y-auto" }, xt = { class: "flex items-center justify-between" }, Dt = { class: "fm-typo-en-body-sm-600" }, wt = { class: "flex items-center gap-8" }, St = {
|
|
355
|
+
key: 0,
|
|
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
|
+
}, Vt = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Ct = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, $t = {
|
|
358
|
+
key: 0,
|
|
359
|
+
class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
|
|
360
|
+
}, At = {
|
|
361
|
+
key: 1,
|
|
362
|
+
class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
|
|
363
|
+
}, Ft = {
|
|
364
|
+
key: 2,
|
|
365
|
+
class: "fm-typo-en-body-xs-400 text-fm-color-system-error-500"
|
|
366
|
+
}, Rt = {
|
|
367
|
+
key: 0,
|
|
368
|
+
class: "flex gap-8 ml-auto"
|
|
369
|
+
}, It = {
|
|
370
|
+
key: 1,
|
|
371
|
+
class: "flex gap-8 ml-auto"
|
|
372
|
+
}, Bt = /* @__PURE__ */ se({
|
|
373
|
+
__name: "SnapshotRecalculationDialog",
|
|
374
|
+
props: {
|
|
375
|
+
showButton: { type: Boolean }
|
|
376
|
+
},
|
|
377
|
+
emits: ["submitted"],
|
|
378
|
+
setup(ae, { expose: S, emit: V }) {
|
|
379
|
+
const K = V, { t } = ie(), L = pe(), I = re(), k = de(), D = g(!1), v = g(""), m = g(""), $ = g([]), O = g([]), l = g(!1), s = g([]), C = g(!1), h = g([]), F = g(!1), B = w(
|
|
380
|
+
() => ve($.value, O.value)
|
|
381
|
+
), E = w(() => De(
|
|
382
|
+
h.value.filter((e) => !!e.closingId).map((e) => ({ closingId: e.closingId, draftCreatedAt: new Date(N(e._id)) }))
|
|
383
|
+
)), W = w(() => {
|
|
384
|
+
if (v.value)
|
|
385
|
+
try {
|
|
386
|
+
const e = N(v.value);
|
|
387
|
+
if (e)
|
|
388
|
+
return e;
|
|
389
|
+
} catch (e) {
|
|
390
|
+
console.error("Error parsing date from opening ID:", e);
|
|
391
|
+
}
|
|
392
|
+
}), j = w(() => {
|
|
393
|
+
if (!v.value || !m.value) return "";
|
|
394
|
+
const e = N(v.value);
|
|
395
|
+
if (e && m.value) {
|
|
396
|
+
const d = new Date(e).getTime();
|
|
397
|
+
if (new Date(m.value).getTime() <= d)
|
|
398
|
+
return t("inventory.stock.recalculation.error.endDateBeforeOpening");
|
|
399
|
+
}
|
|
400
|
+
return "";
|
|
401
|
+
}), Y = w(() => {
|
|
402
|
+
if (!m.value) return !1;
|
|
403
|
+
const e = new Date(m.value), d = /* @__PURE__ */ new Date();
|
|
404
|
+
return d.setHours(0, 0, 0, 0), e.setHours(0, 0, 0, 0), e >= d;
|
|
405
|
+
}), M = w(() => !!v.value && !!m.value && !j.value), H = w(() => s.value.some(
|
|
406
|
+
(e) => !e.completedAt && !e.failedReason
|
|
407
|
+
));
|
|
408
|
+
async function X() {
|
|
409
|
+
D.value = !0, await Promise.all([oe(), Z(), G()]), v.value = "", m.value = "";
|
|
410
|
+
}
|
|
411
|
+
function te() {
|
|
412
|
+
D.value = !1;
|
|
413
|
+
}
|
|
414
|
+
S({
|
|
415
|
+
open: X,
|
|
416
|
+
close: te
|
|
417
|
+
});
|
|
418
|
+
async function oe() {
|
|
419
|
+
l.value = !0;
|
|
420
|
+
try {
|
|
421
|
+
const e = await I.getLastNClosings(30);
|
|
422
|
+
$.value = e;
|
|
423
|
+
} catch (e) {
|
|
424
|
+
console.error("Error fetching recent closings:", e), k.open({
|
|
425
|
+
title: t("common.error"),
|
|
426
|
+
message: "Failed to fetch recent closings",
|
|
427
|
+
type: "error"
|
|
428
|
+
});
|
|
429
|
+
} finally {
|
|
430
|
+
l.value = !1;
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
async function Z() {
|
|
434
|
+
try {
|
|
435
|
+
const e = await I.getLastNStockSnapshots(30);
|
|
436
|
+
O.value = e;
|
|
437
|
+
} catch (e) {
|
|
438
|
+
console.error("Error fetching recent snapshots:", e);
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
async function G() {
|
|
442
|
+
C.value = !0;
|
|
443
|
+
try {
|
|
444
|
+
const e = await L.recalculation.recalculationRequests();
|
|
445
|
+
s.value = e;
|
|
446
|
+
} catch (e) {
|
|
447
|
+
console.error("Error fetching recalculation requests:", e);
|
|
448
|
+
} finally {
|
|
449
|
+
C.value = !1;
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
async function J() {
|
|
453
|
+
if (!v.value || !m.value) {
|
|
454
|
+
h.value = [];
|
|
455
|
+
return;
|
|
456
|
+
}
|
|
457
|
+
F.value = !0;
|
|
458
|
+
try {
|
|
459
|
+
const e = new Date(m.value);
|
|
460
|
+
e.setHours(23, 59, 59, 999);
|
|
461
|
+
const d = await L.recalculation.getAffectedClosingDrafts(
|
|
462
|
+
v.value,
|
|
463
|
+
e.toISOString()
|
|
464
|
+
);
|
|
465
|
+
h.value = d;
|
|
466
|
+
} catch {
|
|
467
|
+
k.open({
|
|
468
|
+
title: t("common.error"),
|
|
469
|
+
message: "Failed to fetch affected closing drafts",
|
|
470
|
+
type: "error"
|
|
471
|
+
}), h.value = [];
|
|
472
|
+
} finally {
|
|
473
|
+
F.value = !1;
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
ce(
|
|
477
|
+
[v, m],
|
|
478
|
+
() => {
|
|
479
|
+
v.value && m.value && !j.value ? J() : h.value = [];
|
|
480
|
+
},
|
|
481
|
+
{ immediate: !1 }
|
|
482
|
+
);
|
|
483
|
+
async function r() {
|
|
484
|
+
if (!(!M.value || !m.value)) {
|
|
485
|
+
l.value = !0;
|
|
486
|
+
try {
|
|
487
|
+
if (await L.recalculation.scheduleRecalculation({
|
|
488
|
+
openingId: v.value,
|
|
489
|
+
untilDate: new Date(m.value).toISOString(),
|
|
490
|
+
recalculateBySnapshot: !0
|
|
491
|
+
}), h.value.length > 0) {
|
|
492
|
+
const e = h.value.map((d) => d._id);
|
|
493
|
+
await L.recalculation.scheduleInvalidateClosingDraftCache(e);
|
|
494
|
+
}
|
|
495
|
+
k.open({
|
|
496
|
+
title: t("common.success"),
|
|
497
|
+
message: "Stock recalculation has been scheduled successfully",
|
|
498
|
+
type: "success"
|
|
499
|
+
}), await G(), D.value = !1, K("submitted");
|
|
500
|
+
} catch (e) {
|
|
501
|
+
console.error("Error scheduling recalculation:", e), k.open({
|
|
502
|
+
title: t("common.error"),
|
|
503
|
+
message: "Failed to schedule stock recalculation",
|
|
504
|
+
type: "error"
|
|
505
|
+
});
|
|
506
|
+
} finally {
|
|
507
|
+
l.value = !1;
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
return (e, d) => {
|
|
512
|
+
const U = x("FmButton"), c = x("FmSelect"), f = x("FmDatePicker"), A = x("FmSnackbar"), P = x("FmAlert"), u = x("FmDialog");
|
|
513
|
+
return n(), y("div", null, [
|
|
514
|
+
e.showButton ? (n(), z(U, {
|
|
515
|
+
key: 0,
|
|
516
|
+
"prepend-icon": "info",
|
|
517
|
+
variant: "tertiary",
|
|
518
|
+
onClick: me(X, ["stop"])
|
|
519
|
+
})) : b("", !0),
|
|
520
|
+
_(u, {
|
|
521
|
+
modelValue: D.value,
|
|
522
|
+
"onUpdate:modelValue": d[4] || (d[4] = (p) => D.value = p),
|
|
523
|
+
"close-button": "",
|
|
524
|
+
dismissAway: "",
|
|
525
|
+
"max-width": "600px"
|
|
526
|
+
}, {
|
|
527
|
+
"dialog-header": R(() => [
|
|
528
|
+
o("div", ot, a(i(t)("inventory.stock.recalculation.title")), 1)
|
|
529
|
+
]),
|
|
530
|
+
"dialog-footer": R(() => [
|
|
531
|
+
H.value ? (n(), y("div", It, [
|
|
532
|
+
_(U, {
|
|
533
|
+
variant: "tertiary",
|
|
534
|
+
onClick: d[3] || (d[3] = (p) => D.value = !1),
|
|
535
|
+
label: i(t)("common.close")
|
|
536
|
+
}, null, 8, ["label"])
|
|
537
|
+
])) : (n(), y("div", Rt, [
|
|
538
|
+
_(U, {
|
|
539
|
+
variant: "tertiary",
|
|
540
|
+
onClick: d[2] || (d[2] = (p) => D.value = !1),
|
|
541
|
+
disabled: l.value,
|
|
542
|
+
label: i(t)("common.cancel")
|
|
543
|
+
}, null, 8, ["disabled", "label"]),
|
|
544
|
+
_(U, {
|
|
545
|
+
variant: "primary",
|
|
546
|
+
onClick: r,
|
|
547
|
+
disabled: !M.value || l.value,
|
|
548
|
+
loading: l.value,
|
|
549
|
+
label: i(t)("inventory.stock.recalculation.schedule")
|
|
550
|
+
}, null, 8, ["disabled", "loading", "label"])
|
|
551
|
+
]))
|
|
552
|
+
]),
|
|
553
|
+
default: R(() => [
|
|
554
|
+
o("div", at, [
|
|
555
|
+
o("div", lt, a(i(t)("inventory.stock.recalculation.description")), 1),
|
|
556
|
+
H.value ? b("", !0) : (n(), y(Q, { key: 0 }, [
|
|
557
|
+
o("div", nt, [
|
|
558
|
+
o("p", st, [
|
|
559
|
+
ee(a(i(t)("inventory.stock.recalculation.openingDate")) + " ", 1),
|
|
560
|
+
d[5] || (d[5] = o("span", { class: "text-fm-color-system-error-300" }, "*", -1))
|
|
561
|
+
]),
|
|
562
|
+
d[6] || (d[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
|
+
_(c, {
|
|
564
|
+
modelValue: v.value,
|
|
565
|
+
"onUpdate:modelValue": d[0] || (d[0] = (p) => v.value = p),
|
|
566
|
+
items: B.value,
|
|
567
|
+
placeholder: i(t)("inventory.stock.recalculation.selectOpening"),
|
|
568
|
+
loading: l.value,
|
|
569
|
+
disabled: l.value
|
|
570
|
+
}, null, 8, ["modelValue", "items", "placeholder", "loading", "disabled"])
|
|
571
|
+
]),
|
|
572
|
+
o("div", it, [
|
|
573
|
+
o("p", ct, [
|
|
574
|
+
ee(a(i(t)("inventory.stock.recalculation.untilDate")) + " ", 1),
|
|
575
|
+
d[7] || (d[7] = o("span", { class: "text-fm-color-system-error-300" }, "*", -1))
|
|
576
|
+
]),
|
|
577
|
+
d[8] || (d[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
|
+
_(f, {
|
|
579
|
+
modelValue: m.value,
|
|
580
|
+
"onUpdate:modelValue": d[1] || (d[1] = (p) => m.value = p),
|
|
581
|
+
placeholder: i(t)("inventory.stock.recalculation.selectDate"),
|
|
582
|
+
min: W.value,
|
|
583
|
+
disabled: !v.value || l.value
|
|
584
|
+
}, null, 8, ["modelValue", "placeholder", "min", "disabled"]),
|
|
585
|
+
j.value ? (n(), y("div", rt, a(j.value), 1)) : b("", !0),
|
|
586
|
+
Y.value ? (n(), z(A, {
|
|
587
|
+
key: 1,
|
|
588
|
+
title: "Warning",
|
|
589
|
+
variant: "warning",
|
|
590
|
+
description: "You have selected today or a future date. The stock balance will be refreshed accordingly."
|
|
591
|
+
})) : b("", !0)
|
|
592
|
+
]),
|
|
593
|
+
v.value && m.value && !j.value ? (n(), z(P, {
|
|
594
|
+
key: 0,
|
|
595
|
+
type: "info"
|
|
596
|
+
}, {
|
|
597
|
+
default: R(() => [
|
|
598
|
+
o("div", dt, a(i(t)("inventory.stock.recalculation.info")), 1)
|
|
599
|
+
]),
|
|
600
|
+
_: 1
|
|
601
|
+
})) : b("", !0),
|
|
602
|
+
h.value.length > 0 ? (n(), y("div", ut, [
|
|
603
|
+
F.value ? (n(), y("div", mt, " Loading affected closing drafts... ")) : (n(), y("div", ft, [
|
|
604
|
+
o("div", pt, " Affected closing draft(s): " + a(h.value.length), 1),
|
|
605
|
+
o("div", vt, [
|
|
606
|
+
(n(!0), y(Q, null, ne(h.value, (p) => (n(), y("div", {
|
|
607
|
+
key: p._id,
|
|
608
|
+
class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
|
|
609
|
+
}, [
|
|
610
|
+
d[9] || (d[9] = ee(" • ")),
|
|
611
|
+
p.closingId && E.value.get(p.closingId) ? (n(), y("span", yt, a(E.value.get(p.closingId)), 1)) : (n(), y("span", gt, a(p._id), 1)),
|
|
612
|
+
p.effectiveAt ? (n(), y("span", ht, " (" + a(new Date(p.effectiveAt).toLocaleString()) + ") ", 1)) : b("", !0)
|
|
613
|
+
]))), 128))
|
|
614
|
+
])
|
|
615
|
+
]))
|
|
616
|
+
])) : b("", !0)
|
|
617
|
+
], 64)),
|
|
618
|
+
s.value.length > 0 ? (n(), y("div", _t, [
|
|
619
|
+
o("p", bt, a(i(t)("inventory.stock.recalculation.recentRequests")), 1),
|
|
620
|
+
o("div", kt, [
|
|
621
|
+
(n(!0), y(Q, null, ne(s.value, (p) => {
|
|
622
|
+
var le;
|
|
623
|
+
return n(), y("div", {
|
|
624
|
+
key: p._id,
|
|
625
|
+
class: "p-12 border border-fm-color-border-primary rounded-8 flex flex-col gap-4"
|
|
626
|
+
}, [
|
|
627
|
+
o("div", xt, [
|
|
628
|
+
o("div", Dt, a(i(t)("inventory.stock.recalculation.requestedAt")) + ": " + a(new Date(p.createdAt).toLocaleString()), 1),
|
|
629
|
+
o("div", wt, [
|
|
630
|
+
(le = p.meta) != null && le.openingType ? (n(), y("div", St, a(p.meta.openingType === "stockSnapshot" ? "Snapshot" : "Closing"), 1)) : b("", !0),
|
|
631
|
+
o("div", {
|
|
632
|
+
class: fe(["fm-typo-en-body-xs-600 px-8 py-4 rounded-4", {
|
|
633
|
+
"bg-fm-color-system-error-100 text-fm-color-system-error-500": p.failedReason,
|
|
634
|
+
"bg-fm-color-system-success-100 text-fm-color-system-success-500": p.completedAt,
|
|
635
|
+
"bg-fm-color-system-info-100 text-fm-color-system-info-500": !p.failedReason && !p.completedAt
|
|
636
|
+
}])
|
|
637
|
+
}, a(p.failedReason ? i(t)("inventory.stock.recalculation.status.failed") : p.completedAt ? i(t)("inventory.stock.recalculation.status.completed") : i(t)("inventory.stock.recalculation.status.inProgress")), 3)
|
|
638
|
+
])
|
|
639
|
+
]),
|
|
640
|
+
o("div", Vt, a(i(t)("inventory.stock.recalculation.from")) + ": " + a(new Date(p.recalculateStartDate).toLocaleDateString()), 1),
|
|
641
|
+
o("div", Ct, a(i(t)("inventory.stock.recalculation.to")) + ": " + a(new Date(p.recalculateEndDate).toLocaleDateString()), 1),
|
|
642
|
+
p.createdBy ? (n(), y("div", $t, a(i(t)("inventory.stock.recalculation.requestedBy")) + ": " + a(p.createdBy.name || p.createdBy.id), 1)) : b("", !0),
|
|
643
|
+
p.completedAt ? (n(), y("div", At, a(i(t)("inventory.stock.recalculation.completedAt")) + ": " + a(new Date(p.completedAt).toLocaleString()), 1)) : b("", !0),
|
|
644
|
+
p.failedReason ? (n(), y("div", Ft, a(p.failedReason), 1)) : b("", !0)
|
|
645
|
+
]);
|
|
646
|
+
}), 128))
|
|
647
|
+
])
|
|
648
|
+
])) : b("", !0)
|
|
649
|
+
])
|
|
650
|
+
]),
|
|
651
|
+
_: 1
|
|
652
|
+
}, 8, ["modelValue"])
|
|
653
|
+
]);
|
|
654
|
+
};
|
|
655
|
+
}
|
|
656
|
+
}), Tt = { class: "fm-typo-en-heading-lg-600" }, Lt = { class: "flex flex-col gap-16" }, Ot = { class: "flex flex-col gap-4" }, Et = { class: "fm-typo-en-label-md-400 text-fm-color-typo-secondary" }, Ut = { class: "fm-typo-en-body-md-400" }, Pt = { class: "flex flex-col gap-4" }, Nt = { class: "fm-typo-en-label-md-400 text-fm-color-typo-secondary" }, Mt = { class: "fm-typo-en-body-md-400" }, Kt = { class: "flex flex-col gap-4" }, jt = { class: "fm-typo-en-label-md-400 text-fm-color-typo-secondary" }, Ht = { class: "flex gap-8 ml-auto" }, zt = /* @__PURE__ */ se({
|
|
657
|
+
__name: "ClosingDetailDialog",
|
|
658
|
+
props: {
|
|
659
|
+
modelValue: { type: Boolean },
|
|
660
|
+
type: {},
|
|
661
|
+
data: {}
|
|
662
|
+
},
|
|
663
|
+
emits: ["update:modelValue"],
|
|
664
|
+
setup(ae, { emit: S }) {
|
|
665
|
+
const { t: V } = ie(), K = _e(), t = ae, L = S, I = w({
|
|
666
|
+
get: () => t.modelValue,
|
|
667
|
+
set: (l) => L("update:modelValue", l)
|
|
668
|
+
}), k = g("");
|
|
669
|
+
ce(I, (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 = N(l);
|
|
680
|
+
return new Date(s).toLocaleString();
|
|
681
|
+
}), m = 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 = K.skuById[l.id] ?? null, C = !s;
|
|
683
|
+
return {
|
|
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
|
|
692
|
+
};
|
|
693
|
+
})), O = [
|
|
694
|
+
{
|
|
695
|
+
accessorKey: "skuName",
|
|
696
|
+
header: () => V("inventory.ingredient.name", "Ingredient Name"),
|
|
697
|
+
cell: (l) => {
|
|
698
|
+
const s = l.row.original;
|
|
699
|
+
return s.isMissing ? q("div", { class: "flex items-center gap-8" }, [
|
|
700
|
+
q("span", {}, s.id),
|
|
701
|
+
q(
|
|
702
|
+
"span",
|
|
703
|
+
{
|
|
704
|
+
class: "px-8 py-2 rounded-4 bg-fm-color-danger-weak text-fm-color-danger-default fm-typo-en-label-sm-400"
|
|
705
|
+
},
|
|
706
|
+
"Missing"
|
|
707
|
+
)
|
|
708
|
+
]) : l.getValue();
|
|
709
|
+
}
|
|
710
|
+
},
|
|
711
|
+
{
|
|
712
|
+
accessorKey: "skuCode",
|
|
713
|
+
header: () => V("inventory.ingredient.code", "Code")
|
|
714
|
+
},
|
|
715
|
+
{
|
|
716
|
+
id: "balance",
|
|
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
|
|
728
|
+
};
|
|
729
|
+
return q(we, C);
|
|
730
|
+
},
|
|
731
|
+
size: 180
|
|
732
|
+
},
|
|
733
|
+
{
|
|
734
|
+
accessorKey: "weightedAverage",
|
|
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 ?? "", B = C / Math.pow(10, h);
|
|
740
|
+
return `${F} ${B.toFixed(2)}`;
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
];
|
|
744
|
+
return (l, s) => {
|
|
745
|
+
const C = x("FmTextField"), h = x("FmTable"), F = x("FmButton"), B = x("FmDialog");
|
|
746
|
+
return n(), z(B, {
|
|
747
|
+
modelValue: I.value,
|
|
748
|
+
"onUpdate:modelValue": s[2] || (s[2] = (E) => I.value = E),
|
|
749
|
+
"close-button": "",
|
|
750
|
+
dismissAway: "",
|
|
751
|
+
"max-width": "900px"
|
|
752
|
+
}, {
|
|
753
|
+
"dialog-header": R(() => [
|
|
754
|
+
o("div", Tt, a(m.value), 1)
|
|
755
|
+
]),
|
|
756
|
+
default: R(() => {
|
|
757
|
+
var E;
|
|
758
|
+
return [
|
|
759
|
+
o("div", Lt, [
|
|
760
|
+
o("div", Ot, [
|
|
761
|
+
o("div", Et, a(t.type === "closing" ? i(V)("inventory.closing.history.closingId") : i(V)("inventory.closing.history.snapshotId", "Snapshot ID")), 1),
|
|
762
|
+
o("div", Ut, a(((E = t.data) == null ? void 0 : E._id) ?? "-"), 1)
|
|
763
|
+
]),
|
|
764
|
+
o("div", Pt, [
|
|
765
|
+
o("div", Nt, a(i(V)("inventory.closing.history.date")), 1),
|
|
766
|
+
o("div", Mt, a(v.value), 1)
|
|
767
|
+
]),
|
|
768
|
+
o("div", Kt, [
|
|
769
|
+
o("div", jt, a(i(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] = (W) => k.value = W),
|
|
773
|
+
placeholder: "Filter by code or name"
|
|
774
|
+
}, null, 8, ["modelValue"]),
|
|
775
|
+
_(h, {
|
|
776
|
+
"row-data": $.value,
|
|
777
|
+
"column-defs": O,
|
|
778
|
+
pagination: { pageSize: 10 },
|
|
779
|
+
"search-value": k.value
|
|
780
|
+
}, null, 8, ["row-data", "search-value"])
|
|
781
|
+
])
|
|
782
|
+
])
|
|
783
|
+
];
|
|
784
|
+
}),
|
|
785
|
+
"dialog-footer": R(() => [
|
|
786
|
+
o("div", Ht, [
|
|
787
|
+
_(F, {
|
|
788
|
+
variant: "tertiary",
|
|
789
|
+
onClick: s[1] || (s[1] = (E) => I.value = !1),
|
|
790
|
+
label: "Close"
|
|
791
|
+
})
|
|
792
|
+
])
|
|
793
|
+
]),
|
|
794
|
+
_: 1
|
|
795
|
+
}, 8, ["modelValue"]);
|
|
796
|
+
};
|
|
797
|
+
}
|
|
798
|
+
}), Wt = { class: "flex flex-col gap-16 p-16" }, Yt = { class: "flex flex-col gap-16" }, Gt = { class: "flex gap-8 ml-auto" }, no = /* @__PURE__ */ se({
|
|
799
|
+
__name: "ClosingHistoryView",
|
|
800
|
+
setup(ae) {
|
|
801
|
+
var d, U;
|
|
802
|
+
const { t: S } = ie(), V = re(), K = be(), t = he(), L = xe(), I = de(), k = g("closings"), D = [
|
|
803
|
+
{ label: "Closings", value: "closings" },
|
|
804
|
+
{ label: "Snapshots", value: "snapshots" }
|
|
805
|
+
], v = g([]), m = g(!1), $ = g([]), O = g(!1), l = g(!1), s = g("closing"), C = g(null);
|
|
806
|
+
function h(c) {
|
|
807
|
+
return [
|
|
808
|
+
c.getFullYear(),
|
|
809
|
+
String(c.getMonth() + 1).padStart(2, "0"),
|
|
810
|
+
String(c.getDate()).padStart(2, "0")
|
|
811
|
+
].join("-");
|
|
812
|
+
}
|
|
813
|
+
const F = () => h(new Date(Date.now() - 864e5)), B = g(F()), E = w(() => {
|
|
814
|
+
const c = [];
|
|
815
|
+
return k.value === "closings" ? c.push(
|
|
816
|
+
{
|
|
817
|
+
label: S("inventory.stock.recalculation.title"),
|
|
818
|
+
value: "recalculation",
|
|
819
|
+
prependIcon: "history",
|
|
820
|
+
isAdminOnly: !0
|
|
821
|
+
},
|
|
822
|
+
{
|
|
823
|
+
label: S("inventory.closing.history.initiate_opening"),
|
|
824
|
+
value: "initiateOpening",
|
|
825
|
+
prependIcon: "add_box",
|
|
826
|
+
isAdminOnly: !0
|
|
827
|
+
},
|
|
828
|
+
{
|
|
829
|
+
label: "Refresh",
|
|
830
|
+
value: "refreshOpening",
|
|
831
|
+
prependIcon: "refresh"
|
|
832
|
+
}
|
|
833
|
+
) : c.push(
|
|
834
|
+
{
|
|
835
|
+
label: `${S("inventory.stock.recalculation.title")} (BETA)`,
|
|
836
|
+
value: "recalculation",
|
|
837
|
+
prependIcon: "history",
|
|
838
|
+
isAdminOnly: !0
|
|
839
|
+
},
|
|
840
|
+
{
|
|
841
|
+
label: `${S("inventory.closing.history.initiate_snapshot")} (BETA)`,
|
|
842
|
+
value: "initiateStockSnapshot",
|
|
843
|
+
prependIcon: "camera",
|
|
844
|
+
isAdminOnly: !0
|
|
845
|
+
},
|
|
846
|
+
{
|
|
847
|
+
label: "Refresh",
|
|
848
|
+
value: "refreshStockSnapshot",
|
|
849
|
+
prependIcon: "refresh"
|
|
850
|
+
}
|
|
851
|
+
), c;
|
|
852
|
+
}), W = g(), j = g();
|
|
853
|
+
function Y(c) {
|
|
854
|
+
var f, A;
|
|
855
|
+
switch (c) {
|
|
856
|
+
case "recalculation":
|
|
857
|
+
return k.value === "closings" ? (f = W.value) == null ? void 0 : f.open() : (A = j.value) == null ? void 0 : A.open();
|
|
858
|
+
case "initiateOpening": {
|
|
859
|
+
L.open({
|
|
860
|
+
title: "Initiate Opening Balance",
|
|
861
|
+
message: "Initiate opening balance if no opening balance exists for the current location.",
|
|
862
|
+
primaryActions: { text: "Confirm", close: !0 }
|
|
863
|
+
}).onPrimary(async () => {
|
|
864
|
+
try {
|
|
865
|
+
await V.initiateClosing(), I.open({
|
|
866
|
+
message: "Opening balance initiated successfully.",
|
|
867
|
+
type: "success"
|
|
868
|
+
}), await G();
|
|
869
|
+
} catch (P) {
|
|
870
|
+
I.open({
|
|
871
|
+
message: P.message || "Failed to initiate opening balance. Please try again.",
|
|
872
|
+
type: "error"
|
|
873
|
+
});
|
|
874
|
+
}
|
|
875
|
+
});
|
|
876
|
+
break;
|
|
877
|
+
}
|
|
878
|
+
case "initiateStockSnapshot": {
|
|
879
|
+
B.value = F(), M.value = !0;
|
|
880
|
+
break;
|
|
881
|
+
}
|
|
882
|
+
case "refreshOpening": {
|
|
883
|
+
G();
|
|
884
|
+
break;
|
|
885
|
+
}
|
|
886
|
+
case "refreshStockSnapshot": {
|
|
887
|
+
J();
|
|
888
|
+
break;
|
|
889
|
+
}
|
|
890
|
+
}
|
|
891
|
+
}
|
|
892
|
+
const M = g(!1), H = g(!1), X = F();
|
|
893
|
+
async function te() {
|
|
894
|
+
H.value = !0;
|
|
895
|
+
try {
|
|
896
|
+
await V.initiateStockSnapshot(B.value), I.open({
|
|
897
|
+
message: "Stock snapshot created successfully.",
|
|
898
|
+
type: "success"
|
|
899
|
+
}), M.value = !1, await J();
|
|
900
|
+
} catch (c) {
|
|
901
|
+
I.open({
|
|
902
|
+
message: c.message || "Failed to create stock snapshot. Please try again.",
|
|
903
|
+
type: "error"
|
|
904
|
+
});
|
|
905
|
+
} finally {
|
|
906
|
+
H.value = !1;
|
|
907
|
+
}
|
|
908
|
+
}
|
|
909
|
+
const oe = [
|
|
910
|
+
...(d = t.sessionUser.value) != null && d.role.isAdmin ? [
|
|
911
|
+
{
|
|
912
|
+
accessorKey: "_id",
|
|
913
|
+
header: () => q(ue, {}, () => `${S("inventory.closing.history.closingId")}`),
|
|
914
|
+
cell: (c) => c.getValue()
|
|
915
|
+
}
|
|
916
|
+
] : [],
|
|
917
|
+
{
|
|
918
|
+
accessorKey: "_id",
|
|
919
|
+
id: "date",
|
|
920
|
+
header: () => S("inventory.closing.history.date"),
|
|
921
|
+
cell: (c) => {
|
|
922
|
+
const f = c.getValue(), A = N(f);
|
|
923
|
+
return new Date(A).toLocaleDateString();
|
|
924
|
+
}
|
|
925
|
+
},
|
|
926
|
+
{
|
|
927
|
+
accessorKey: "_id",
|
|
928
|
+
id: "time",
|
|
929
|
+
header: () => S("inventory.closing.history.time"),
|
|
930
|
+
cell: (c) => {
|
|
931
|
+
const f = c.getValue(), A = N(f);
|
|
932
|
+
return new Date(A).toLocaleTimeString();
|
|
933
|
+
}
|
|
934
|
+
},
|
|
935
|
+
{
|
|
936
|
+
accessorKey: "ref",
|
|
937
|
+
header: () => S("inventory.closing.history.createdFrom"),
|
|
938
|
+
cell: (c) => c.getValue() || "-"
|
|
939
|
+
}
|
|
940
|
+
], Z = [
|
|
941
|
+
...(U = t.sessionUser.value) != null && U.role.isAdmin ? [
|
|
942
|
+
{
|
|
943
|
+
accessorKey: "_id",
|
|
944
|
+
header: () => q(
|
|
945
|
+
ue,
|
|
946
|
+
{},
|
|
947
|
+
() => `${S("inventory.closing.history.snapshotId", "Snapshot ID")}`
|
|
948
|
+
),
|
|
949
|
+
cell: (c) => c.getValue()
|
|
950
|
+
}
|
|
951
|
+
] : [],
|
|
952
|
+
{
|
|
953
|
+
accessorKey: "_id",
|
|
954
|
+
id: "date",
|
|
955
|
+
header: () => S("inventory.closing.history.date"),
|
|
956
|
+
cell: (c) => {
|
|
957
|
+
const f = c.getValue(), A = N(f);
|
|
958
|
+
return new Date(A).toLocaleDateString();
|
|
959
|
+
}
|
|
960
|
+
},
|
|
961
|
+
{
|
|
962
|
+
accessorKey: "_id",
|
|
963
|
+
id: "time",
|
|
964
|
+
header: () => S("inventory.closing.history.time"),
|
|
965
|
+
cell: (c) => {
|
|
966
|
+
const f = c.getValue(), A = N(f);
|
|
967
|
+
return new Date(A).toLocaleTimeString();
|
|
968
|
+
}
|
|
969
|
+
},
|
|
970
|
+
{
|
|
971
|
+
accessorKey: "remark",
|
|
972
|
+
header: () => S("inventory.closing.history.createdFrom"),
|
|
973
|
+
cell: (c) => c.getValue() || "-"
|
|
974
|
+
}
|
|
975
|
+
];
|
|
976
|
+
async function G() {
|
|
977
|
+
if (K.currentLocationDBName) {
|
|
978
|
+
m.value = !0;
|
|
979
|
+
try {
|
|
980
|
+
const c = await V.getLastNClosings(30);
|
|
981
|
+
v.value = c;
|
|
982
|
+
} catch (c) {
|
|
983
|
+
console.error("Error fetching closings:", c), v.value = [];
|
|
984
|
+
} finally {
|
|
985
|
+
m.value = !1;
|
|
986
|
+
}
|
|
987
|
+
}
|
|
988
|
+
}
|
|
989
|
+
async function J() {
|
|
990
|
+
if (K.currentLocationDBName) {
|
|
991
|
+
O.value = !0;
|
|
992
|
+
try {
|
|
993
|
+
const c = await V.getLastNStockSnapshots(30);
|
|
994
|
+
$.value = c;
|
|
995
|
+
} catch (c) {
|
|
996
|
+
console.error("Error fetching stock snapshots:", c), $.value = [];
|
|
997
|
+
} finally {
|
|
998
|
+
O.value = !1;
|
|
999
|
+
}
|
|
1000
|
+
}
|
|
1001
|
+
}
|
|
1002
|
+
function r(c) {
|
|
1003
|
+
s.value = "closing", C.value = c, l.value = !0;
|
|
1004
|
+
}
|
|
1005
|
+
function e(c) {
|
|
1006
|
+
s.value = "snapshot", C.value = c, l.value = !0;
|
|
1007
|
+
}
|
|
1008
|
+
return K.watchLocation(async () => {
|
|
1009
|
+
K.currentLocationDBName && (await G(), await J());
|
|
1010
|
+
}), (c, f) => {
|
|
1011
|
+
const A = x("FmTabs"), P = x("FmTable"), u = x("FmDatePicker"), p = x("FmButton"), le = x("FmDialog");
|
|
1012
|
+
return n(), z(ge, {
|
|
1013
|
+
actions: E.value,
|
|
1014
|
+
title: i(S)("inventory.closing.history.title"),
|
|
1015
|
+
"onClick:action": Y
|
|
1016
|
+
}, {
|
|
1017
|
+
default: R(() => [
|
|
1018
|
+
o("div", Wt, [
|
|
1019
|
+
_(ke, {
|
|
1020
|
+
"change-location": "",
|
|
1021
|
+
"hide-filter-options": !0
|
|
1022
|
+
}),
|
|
1023
|
+
_(A, {
|
|
1024
|
+
"model-value": k.value,
|
|
1025
|
+
"onUpdate:modelValue": f[0] || (f[0] = (T) => k.value = T),
|
|
1026
|
+
items: D
|
|
1027
|
+
}, null, 8, ["model-value"]),
|
|
1028
|
+
k.value === "closings" ? (n(), y(Q, { key: 0 }, [
|
|
1029
|
+
f[9] || (f[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)),
|
|
1030
|
+
_(P, {
|
|
1031
|
+
loading: m.value,
|
|
1032
|
+
"row-data": v.value,
|
|
1033
|
+
"column-defs": oe,
|
|
1034
|
+
onRowClick: f[1] || (f[1] = (T) => r(T.original))
|
|
1035
|
+
}, null, 8, ["loading", "row-data"])
|
|
1036
|
+
], 64)) : b("", !0),
|
|
1037
|
+
k.value === "snapshots" ? (n(), y(Q, { key: 1 }, [
|
|
1038
|
+
f[10] || (f[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)),
|
|
1039
|
+
_(P, {
|
|
1040
|
+
loading: O.value,
|
|
1041
|
+
"row-data": $.value,
|
|
1042
|
+
"column-defs": Z,
|
|
1043
|
+
onRowClick: f[2] || (f[2] = (T) => e(T.original))
|
|
1044
|
+
}, null, 8, ["loading", "row-data"])
|
|
1045
|
+
], 64)) : b("", !0)
|
|
1046
|
+
]),
|
|
1047
|
+
(n(), z(ye, { to: "body" }, [
|
|
1048
|
+
_(tt, {
|
|
1049
|
+
"show-button": !1,
|
|
1050
|
+
ref_key: "recalculationDialogRef",
|
|
1051
|
+
ref: W,
|
|
1052
|
+
onSubmitted: f[3] || (f[3] = (T) => G())
|
|
1053
|
+
}, null, 512),
|
|
1054
|
+
_(Bt, {
|
|
1055
|
+
"show-button": !1,
|
|
1056
|
+
ref_key: "snapshotRecalculationDialogRef",
|
|
1057
|
+
ref: j,
|
|
1058
|
+
onSubmitted: f[4] || (f[4] = (T) => J())
|
|
1059
|
+
}, null, 512),
|
|
1060
|
+
_(zt, {
|
|
1061
|
+
modelValue: l.value,
|
|
1062
|
+
"onUpdate:modelValue": f[5] || (f[5] = (T) => l.value = T),
|
|
1063
|
+
type: s.value,
|
|
1064
|
+
data: C.value
|
|
1065
|
+
}, null, 8, ["modelValue", "type", "data"]),
|
|
1066
|
+
_(le, {
|
|
1067
|
+
modelValue: M.value,
|
|
1068
|
+
"onUpdate:modelValue": f[8] || (f[8] = (T) => M.value = T),
|
|
1069
|
+
"close-button": "",
|
|
1070
|
+
dismissAway: "",
|
|
1071
|
+
"max-width": "400px"
|
|
1072
|
+
}, {
|
|
1073
|
+
"dialog-header": R(() => f[11] || (f[11] = [
|
|
1074
|
+
o("div", { class: "fm-typo-en-heading-lg-600" }, "Initiate Stock Snapshot", -1)
|
|
1075
|
+
])),
|
|
1076
|
+
default: R(() => [
|
|
1077
|
+
o("div", Yt, [
|
|
1078
|
+
f[12] || (f[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)),
|
|
1079
|
+
_(u, {
|
|
1080
|
+
modelValue: B.value,
|
|
1081
|
+
"onUpdate:modelValue": f[6] || (f[6] = (T) => B.value = T),
|
|
1082
|
+
label: "Snapshot Date",
|
|
1083
|
+
max: i(X)
|
|
1084
|
+
}, null, 8, ["modelValue", "max"])
|
|
1085
|
+
])
|
|
1086
|
+
]),
|
|
1087
|
+
"dialog-footer": R(() => [
|
|
1088
|
+
o("div", Gt, [
|
|
1089
|
+
_(p, {
|
|
1090
|
+
variant: "tertiary",
|
|
1091
|
+
onClick: f[7] || (f[7] = (T) => M.value = !1),
|
|
1092
|
+
label: "Cancel",
|
|
1093
|
+
disabled: H.value
|
|
1094
|
+
}, null, 8, ["disabled"]),
|
|
1095
|
+
_(p, {
|
|
1096
|
+
variant: "primary",
|
|
1097
|
+
onClick: te,
|
|
1098
|
+
label: "Confirm",
|
|
1099
|
+
loading: H.value
|
|
1100
|
+
}, null, 8, ["loading"])
|
|
1101
|
+
])
|
|
1102
|
+
]),
|
|
1103
|
+
_: 1
|
|
1104
|
+
}, 8, ["modelValue"])
|
|
1105
|
+
]))
|
|
1106
|
+
]),
|
|
1107
|
+
_: 1
|
|
1108
|
+
}, 8, ["actions", "title"]);
|
|
1109
|
+
};
|
|
1110
|
+
}
|
|
1111
|
+
});
|
|
1112
|
+
export {
|
|
1113
|
+
no as default
|
|
1114
|
+
};
|