@feedmepos/mf-inventory-portal 1.7.0-dev.5 → 1.7.0-dev.7
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/README.md +8 -8
- package/dist/{App-Dy8S0KRt.js → App-CdLmQWt8.js} +4 -4
- package/dist/{ApprovalView-DjJI93rS.js → ApprovalView-CSsDqhpv.js} +8 -8
- package/dist/{BindingsDialog-D--FhGpZ.js → BindingsDialog-DHJ1tvNJ.js} +2 -2
- package/dist/{BindingsPicker-XsEHl2xi.js → BindingsPicker-C8MPcvSz.js} +2 -2
- package/dist/{BindingsTable-BklChwvo.js → BindingsTable-52py8Ws5.js} +3 -3
- package/dist/{BulkReceiveRequestView-Czz40o9P.js → BulkReceiveRequestView-DV-Pi8Dl.js} +19 -19
- package/dist/{ChangeLocationComponent.vue_vue_type_script_setup_true_lang-WtLADzmS.js → ChangeLocationComponent.vue_vue_type_script_setup_true_lang-DqEFrMvv.js} +1 -1
- package/dist/ClosingDraftView-By9Ubrjj.js +4398 -0
- package/dist/ClosingHistoryView-DPX0oThW.js +1112 -0
- package/dist/ClosingTemplateView-CPfsw6Jo.js +2270 -0
- package/dist/CursorPaginatedTable.vue_vue_type_script_setup_true_lang-4KT9rH9e.js +152 -0
- package/dist/{DefaultView-CsSsO8eT.js → DefaultView-bnlvalOA.js} +2 -2
- package/dist/{DeliveryOrderPrintPreview-RXp9AXeV.js → DeliveryOrderPrintPreview-DvCoRkS5.js} +2 -2
- package/dist/{EmailDialog.vue_vue_type_script_setup_true_lang-C6wahz4p.js → EmailDialog.vue_vue_type_script_setup_true_lang-hclhTx1v.js} +23 -23
- package/dist/FmDateRangePickerChip.vue_vue_type_script_setup_true_lang-Dnb11ZZu.js +69 -0
- package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-C0526zpI.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-5zyDFkIj.js} +2 -2
- package/dist/FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-BGeYHCo3.js +120 -0
- package/dist/{FmMultiselectDialog-BKOope7A.js → FmMultiselectDialog-BmsipVZ1.js} +1 -1
- package/dist/{FmMultiselectDialog-CxGDMX78.js → FmMultiselectDialog-C89_c6t-.js} +2 -2
- package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-CEpk3BEP.js → FmUnitInput.vue_vue_type_script_setup_true_lang-mZVsLfXN.js} +5 -5
- package/dist/{ImportView-BHxX1hqT.js → ImportView-5o7viifV.js} +6 -6
- package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-CQ_oSSOb.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-Cf5aYcgE.js} +1 -1
- package/dist/{IngredientGroupView-DByeVT7v.js → IngredientGroupView-DFtA9PGx.js} +5 -5
- package/dist/{IngredientsView-CPgE5eqn.js → IngredientsView-B7xgch69.js} +16 -16
- package/dist/{IntegrationExplorerView-CrXHD7rd.js → IntegrationExplorerView-WgrLMM-S.js} +4 -4
- package/dist/{IntegrationView-DzFBFmzL.js → IntegrationView-DODVvXar.js} +13 -13
- package/dist/{InventoryBindingForm-B58ZezqT.js → InventoryBindingForm-BFjgIg5X.js} +1 -1
- package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-09qFxTZJ.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-BafAL8Ko.js} +5 -5
- package/dist/{InventoryBindingSummary-WjQDrDji.js → InventoryBindingSummary-DIbLUq8T.js} +1 -1
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DoUxZyJS.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-CmMhWVV1.js} +1 -1
- package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-CaohrG8R.js → PremiumBadge.vue_vue_type_script_setup_true_lang-ChruzrrP.js} +1 -1
- package/dist/{ProductionView-9s0UPdgF.js → ProductionView-DbomR0mp.js} +8 -8
- package/dist/{PublishView-CZ-sgofx.js → PublishView-CY8RPc96.js} +3 -3
- package/dist/{PurchaseOrderPrintPreview-BRfOlr1A.js → PurchaseOrderPrintPreview-LlaeK9yj.js} +2 -2
- package/dist/{ReceiveRequestView-DOpcBlPk.js → ReceiveRequestView-DhaH8q7H.js} +13 -13
- package/dist/{RecipeView-CqqtIJv3.js → RecipeView-BssQDDZQ.js} +17 -17
- package/dist/{SettingsView-CPqrpICj.js → SettingsView-t33Yw-Y7.js} +4 -4
- package/dist/{StockView-DL16QIzP.js → StockView-BS4bOyqr.js} +21 -21
- package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-CRLRbY8r.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-DuC1cXzZ.js} +1 -1
- package/dist/{SupplierView-BKYDTRly.js → SupplierView-BJvfJjTL.js} +12 -12
- package/dist/{SurchargeView-BXHVfmHS.js → SurchargeView-D9MTfTxj.js} +6 -6
- package/dist/{SystemTrailDialog.vue_vue_type_script_setup_true_lang-DZgTmzRk.js → SystemTrailDialog.vue_vue_type_script_setup_true_lang-BDbdkJMO.js} +2 -2
- package/dist/{TemplatePublishDialog.vue_vue_type_script_setup_true_lang-D0JkImSa.js → TemplatePublishDialog.vue_vue_type_script_setup_true_lang-bHKvO-R3.js} +1 -1
- package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-dBmVI2CQ.js → TransferDetails.vue_vue_type_script_setup_true_lang-CiLaobTu.js} +20 -20
- package/dist/{TransferTemplateView-CI9TVc67.js → TransferTemplateView-BJyvlc5A.js} +20 -20
- package/dist/{UnitCostHistoryView-D3TUepMk.js → UnitCostHistoryView-D1x3terP.js} +4 -4
- package/dist/{UnitDisplayControl.vue_vue_type_script_setup_true_lang-C518diLn.js → UnitDisplayControl.vue_vue_type_script_setup_true_lang-CQuzAchK.js} +4 -4
- package/dist/{UnitView-BHNkFYA8.js → UnitView-Bt6iIBYS.js} +7 -7
- package/dist/{WarehouseView-Bh391caS.js → WarehouseView-Ds_FmW5Y.js} +5 -5
- package/dist/{WastageTemplateView-Dgi21iCN.js → WastageTemplateView-DEYy49G9.js} +14 -14
- package/dist/api/closing-draft.d.ts +11 -0
- package/dist/api/closing-template.d.ts +11 -2
- package/dist/api/closing.d.ts +12 -1
- package/dist/{app-CMeYC_Q8.js → app-C5ZjmQBL.js} +4228 -4018
- package/dist/app.d.ts +8 -0
- package/dist/app.js +1 -1
- package/dist/{closing-template-CA09sApB.js → closing-template-C1RAVtfm.js} +31 -11
- package/dist/components/CursorPaginatedTable.vue.d.ts +136 -0
- package/dist/components/FmInventoryTableToolbar.vue.d.ts +26 -0
- package/dist/components/ui-library/FmDateRangePickerChip.vue.d.ts +5 -0
- package/dist/composable/defineApi.d.ts +1 -1
- package/dist/{date2-CzejXWLl.js → date2-C_I6Sj_2.js} +1 -1
- package/dist/{dayjs.min-Bt3TyY_o.js → dayjs.min-DLA2WeAZ.js} +1 -1
- package/dist/{decimal-5fD_ux1d.js → decimal-CmyPHcIE.js} +2 -2
- package/dist/{defineDeepModel-Dm7rseSW.js → defineDeepModel-DgZRD9r1.js} +1 -1
- package/dist/{duplicate-template-BufbAoPU.js → duplicate-template-YgZzxaM1.js} +1 -1
- package/dist/{feature-eNVOuvir.js → feature-DM1fHf-j.js} +2 -2
- package/dist/{format-time-from-id-W3Y0GVAS.js → format-time-from-id-ZLKKvFN3.js} +1 -1
- package/dist/{format-unit-display-Bl9U8EY8.js → format-unit-display-Dh9Gkal3.js} +12 -12
- package/dist/{import-export.helper-DoKOvdUD.js → import-export.helper-NRzOlfjs.js} +6 -6
- package/dist/{index-CkYWKMMm.js → index-CH2gGkkr.js} +1 -1
- package/dist/{index-O88uLh8G.js → index-D6ZdZoYl.js} +3 -3
- package/dist/{index-CDkRQHsH.js → index-tlUzP5gu.js} +3344 -3066
- package/dist/{inventory-core-dart.default-w9TD2218.js → inventory-core-dart.default-DEJl1cw1.js} +1 -1
- package/dist/{jszip.min-B_IXYK70.js → jszip.min-IIc159ih.js} +2 -2
- package/dist/{lz-string-B1yTzLvw.js → lz-string-CLDiS3IE.js} +1 -1
- package/dist/{netsuite-044jD35H.js → netsuite-DuBR2cEF.js} +2 -2
- package/dist/{number-BRWq97Cn.js → number-D80m3cTF.js} +3 -3
- package/dist/{predefined-templates-Bux2_3lt.js → predefined-templates-DRyPnzlW.js} +1 -1
- package/dist/{purchase-order-template-Caf8z-jM.js → purchase-order-template-BBnMW_fW.js} +1 -1
- package/dist/{recalculationUtils-CfRcpX6e.js → recalculationUtils-DJK6lrcN.js} +1 -1
- package/dist/{rules-BZ4IEShU.js → rules-BVYE7agw.js} +2 -2
- package/dist/{stock-CPjd7Xin.js → stock-Bp5E9dDF.js} +1 -1
- package/dist/{stock-Csd8P79g.js → stock-WZL_VV0O.js} +3 -3
- package/dist/{supplier-EkV-Jm3U.js → supplier-DaLG_xt7.js} +2 -2
- package/dist/{surcharge-DbTgB3SV.js → surcharge-4CBOByoy.js} +1 -1
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{uom-rules-DjZk24TE.js → uom-rules-B604Aftd.js} +1 -1
- package/dist/{use-ingredient-select-dialog-UyT2i0Xd.js → use-ingredient-select-dialog-C6FoBmcN.js} +2 -2
- package/dist/{use-inventory-binding-dialog-DqiIIjP-.js → use-inventory-binding-dialog-DGSFzKVG.js} +2 -2
- package/dist/{use-template-enabled-locations-DCS26PkR.js → use-template-enabled-locations-D5_hVbtg.js} +2 -2
- package/dist/{use-transfer-locations-ASNqbq4F.js → use-transfer-locations-C8Tn4jb9.js} +2 -2
- package/dist/{useHrmPermission-CJghd6jy.js → useHrmPermission-Cu0490uh.js} +1 -1
- package/dist/{useNavigationMenu-BmYGiYHz.js → useNavigationMenu-HSwbFOrI.js} +2 -2
- package/dist/{useSseClient-CjdMXh9s.js → useSseClient-CptMV4gY.js} +1 -1
- package/dist/views/adjustment-template/wastage-template/table.d.ts +1 -1
- package/dist/views/closing-draft/composables/use-closing-draft-actions.d.ts +1284 -15
- package/dist/views/closing-draft/composables/use-closing-draft-table.d.ts +234 -3090
- package/dist/views/closing-draft/helpers/closing-group-status.helper.d.ts +5 -3
- package/dist/views/closing-draft/helpers/closing-groups.helper.d.ts +19 -8
- package/dist/views/closing-template/composables/use-closing-template-actions.d.ts +577 -15
- package/dist/views/closing-template/composables/use-closing-template-table.d.ts +51 -1025
- package/dist/views/closing-template/helpers/import-export.helper.d.ts +1 -1
- package/dist/views/transfer-template/composables/use-transfer-template-table.d.ts +1 -1
- package/dist/{vue-i18n-DGE7TahE.js → vue-i18n-CXcdytIG.js} +1 -1
- package/dist/{xlsx.util-DTNSgR0e.js → xlsx.util-Dhm1k2gt.js} +2 -2
- package/package.json +4 -4
- package/dist/ClosingDraftView-4UP_hqXM.js +0 -4320
- package/dist/ClosingHistoryView-BxPiqt9O.js +0 -1115
- package/dist/ClosingTemplateView-BlRJQaNt.js +0 -2237
- package/dist/FmDateRangePickerChip.vue_vue_type_script_setup_true_lang-BoIkrjeO.js +0 -61
- package/dist/FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DzmXMjXi.js +0 -118
|
@@ -1,1115 +0,0 @@
|
|
|
1
|
-
import { defineComponent as se, ref as g, computed as D, watch as ce, resolveComponent as w, createElementBlock as y, openBlock as n, createBlock as z, createCommentVNode as b, createVNode as _, withModifiers as me, withCtx as R, createElementVNode as o, toDisplayString as a, unref as s, Fragment as Q, createTextVNode as ee, renderList as ne, normalizeClass as fe, h as q, Teleport as pe } from "vue";
|
|
2
|
-
import { _ as ge } from "./SingleColumnLayout.vue_vue_type_script_setup_true_lang-DwrLsWX_.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-CMeYC_Q8.js";
|
|
5
|
-
import { F as ue } from "./FmAdminBadge-DlplQOHb.js";
|
|
6
|
-
import { _ as ke } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DzmXMjXi.js";
|
|
7
|
-
import { useSnackbar as de, useDialog as xe } from "@feedmepos/ui-library";
|
|
8
|
-
import { u as ve } from "./stock-CPjd7Xin.js";
|
|
9
|
-
import { g as ye, f as De } from "./recalculationUtils-CfRcpX6e.js";
|
|
10
|
-
import { _ as we } from "./UnitDisplayControl.vue_vue_type_script_setup_true_lang-C518diLn.js";
|
|
11
|
-
const Se = { class: "fm-typo-en-heading-lg-600" }, Ve = { class: "flex flex-col gap-16" }, $e = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ce = { 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" }, Te = {
|
|
12
|
-
key: 2,
|
|
13
|
-
class: "text-red-500 text-sm mt-2"
|
|
14
|
-
}, Be = { 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" }, He = { class: "flex flex-col gap-8 max-h-[300px] overflow-y-auto" }, je = { 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: k, emit: V }) {
|
|
51
|
-
const K = V, { t } = ie(), O = ve(), I = re(), x = de(), S = g(!1), v = g(""), m = g(""), C = g(!1), E = g([]), l = g(!1), i = g([]), $ = g(!1), h = g([]), F = g(!1), T = D(() => ye(E.value)), U = D(() => {
|
|
52
|
-
if (!v.value) return [];
|
|
53
|
-
const r = T.value.find((e) => e.value === v.value);
|
|
54
|
-
return r ? T.value.filter((e) => e.date.getTime() > r.date.getTime()).sort((e, d) => d.date.getTime() - e.date.getTime()) : [];
|
|
55
|
-
}), W = D({
|
|
56
|
-
get: () => {
|
|
57
|
-
if (C.value && m.value) {
|
|
58
|
-
const r = E.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
|
-
C.value && r ? m.value = N(r) : m.value = r;
|
|
65
|
-
}
|
|
66
|
-
}), H = D(() => {
|
|
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 = D(() => {
|
|
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 = D(() => !!v.value && !!m.value && !Y.value), j = D(() => i.value.some(
|
|
85
|
-
(r) => !r.completedAt && !r.failedReason
|
|
86
|
-
));
|
|
87
|
-
async function X() {
|
|
88
|
-
S.value = !0, await Promise.all([oe(), Z()]), v.value = "", m.value = "", C.value = !1;
|
|
89
|
-
}
|
|
90
|
-
function te() {
|
|
91
|
-
S.value = !1;
|
|
92
|
-
}
|
|
93
|
-
k({
|
|
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
|
-
E.value = r;
|
|
102
|
-
} catch (r) {
|
|
103
|
-
console.error("Error fetching recent closings:", r), x.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
|
-
$.value = !0;
|
|
114
|
-
try {
|
|
115
|
-
const r = await O.recalculation.recalculationRequests();
|
|
116
|
-
i.value = r;
|
|
117
|
-
} catch (r) {
|
|
118
|
-
console.error("Error fetching recalculation requests:", r);
|
|
119
|
-
} finally {
|
|
120
|
-
$.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 O.recalculation.getAffectedClosingDrafts(
|
|
131
|
-
v.value,
|
|
132
|
-
m.value
|
|
133
|
-
);
|
|
134
|
-
h.value = r;
|
|
135
|
-
} catch {
|
|
136
|
-
x.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 O.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 O.recalculation.scheduleInvalidateClosingDraftCache(r);
|
|
162
|
-
}
|
|
163
|
-
x.open({
|
|
164
|
-
title: t("common.success"),
|
|
165
|
-
message: "Stock recalculation has been scheduled successfully",
|
|
166
|
-
type: "success"
|
|
167
|
-
}), await Z(), S.value = !1, K("submitted");
|
|
168
|
-
} catch (r) {
|
|
169
|
-
console.error("Error scheduling recalculation:", r), x.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 = w("FmButton"), B = w("FmSelect"), c = w("FmRadio"), p = w("FmDatePicker"), A = w("FmAlert"), P = w("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: S.value,
|
|
190
|
-
"onUpdate:modelValue": e[7] || (e[7] = (u) => S.value = u),
|
|
191
|
-
"close-button": "",
|
|
192
|
-
dismissAway: "",
|
|
193
|
-
"max-width": "600px"
|
|
194
|
-
}, {
|
|
195
|
-
"dialog-header": R(() => [
|
|
196
|
-
o("div", Se, a(s(t)("inventory.stock.recalculation.title")), 1)
|
|
197
|
-
]),
|
|
198
|
-
"dialog-footer": R(() => [
|
|
199
|
-
j.value ? (n(), y("div", et, [
|
|
200
|
-
_(d, {
|
|
201
|
-
variant: "tertiary",
|
|
202
|
-
onClick: e[6] || (e[6] = (u) => S.value = !1),
|
|
203
|
-
label: s(t)("common.close")
|
|
204
|
-
}, null, 8, ["label"])
|
|
205
|
-
])) : (n(), y("div", qe, [
|
|
206
|
-
_(d, {
|
|
207
|
-
variant: "tertiary",
|
|
208
|
-
onClick: e[5] || (e[5] = (u) => S.value = !1),
|
|
209
|
-
disabled: l.value,
|
|
210
|
-
label: s(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: s(t)("inventory.stock.recalculation.schedule")
|
|
218
|
-
}, null, 8, ["disabled", "loading", "label"])
|
|
219
|
-
]))
|
|
220
|
-
]),
|
|
221
|
-
default: R(() => [
|
|
222
|
-
o("div", Ve, [
|
|
223
|
-
o("div", $e, a(s(t)("inventory.stock.recalculation.description")), 1),
|
|
224
|
-
j.value ? b("", !0) : (n(), y(Q, { key: 0 }, [
|
|
225
|
-
o("div", Ce, [
|
|
226
|
-
o("p", Ae, [
|
|
227
|
-
ee(a(s(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
|
-
_(B, {
|
|
232
|
-
modelValue: v.value,
|
|
233
|
-
"onUpdate:modelValue": e[0] || (e[0] = (u) => v.value = u),
|
|
234
|
-
items: T.value,
|
|
235
|
-
placeholder: s(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(s(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: C.value,
|
|
248
|
-
"onUpdate:modelValue": e[1] || (e[1] = (u) => C.value = u),
|
|
249
|
-
value: !1,
|
|
250
|
-
label: s(t)("inventory.stock.recalculation.selectByDate")
|
|
251
|
-
}, null, 8, ["modelValue", "label"]),
|
|
252
|
-
_(c, {
|
|
253
|
-
modelValue: C.value,
|
|
254
|
-
"onUpdate:modelValue": e[2] || (e[2] = (u) => C.value = u),
|
|
255
|
-
value: !0,
|
|
256
|
-
label: s(t)("inventory.stock.recalculation.selectByClosing")
|
|
257
|
-
}, null, 8, ["modelValue", "label"])
|
|
258
|
-
]),
|
|
259
|
-
C.value ? (n(), z(B, {
|
|
260
|
-
key: 1,
|
|
261
|
-
modelValue: W.value,
|
|
262
|
-
"onUpdate:modelValue": e[4] || (e[4] = (u) => W.value = u),
|
|
263
|
-
items: U.value,
|
|
264
|
-
placeholder: s(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(p, {
|
|
268
|
-
key: 0,
|
|
269
|
-
modelValue: m.value,
|
|
270
|
-
"onUpdate:modelValue": e[3] || (e[3] = (u) => m.value = u),
|
|
271
|
-
placeholder: s(t)("inventory.stock.recalculation.selectDate"),
|
|
272
|
-
min: H.value,
|
|
273
|
-
disabled: !v.value || l.value
|
|
274
|
-
}, null, 8, ["modelValue", "placeholder", "min", "disabled"])),
|
|
275
|
-
Y.value ? (n(), y("div", Te, 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", Be, a(s(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
|
-
i.value.length > 0 ? (n(), y("div", Me, [
|
|
302
|
-
o("p", Ke, a(s(t)("inventory.stock.recalculation.recentRequests")), 1),
|
|
303
|
-
o("div", He, [
|
|
304
|
-
(n(!0), y(Q, null, ne(i.value, (u) => {
|
|
305
|
-
var f;
|
|
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", je, [
|
|
311
|
-
o("div", ze, a(s(t)("inventory.stock.recalculation.requestedAt")) + ": " + a(new Date(u.createdAt).toLocaleString()), 1),
|
|
312
|
-
o("div", We, [
|
|
313
|
-
(f = u.meta) != null && f.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 ? s(t)("inventory.stock.recalculation.status.failed") : u.completedAt ? s(t)("inventory.stock.recalculation.status.completed") : s(t)("inventory.stock.recalculation.status.inProgress")), 3)
|
|
321
|
-
])
|
|
322
|
-
]),
|
|
323
|
-
o("div", Ge, a(s(t)("inventory.stock.recalculation.from")) + ": " + a(new Date(u.recalculateStartDate).toLocaleDateString()), 1),
|
|
324
|
-
o("div", Je, a(s(t)("inventory.stock.recalculation.to")) + ": " + a(new Date(u.recalculateEndDate).toLocaleDateString()), 1),
|
|
325
|
-
u.createdBy ? (n(), y("div", Qe, a(s(t)("inventory.stock.recalculation.requestedBy")) + ": " + a(u.createdBy.name || u.createdBy.id), 1)) : b("", !0),
|
|
326
|
-
u.completedAt ? (n(), y("div", Xe, a(s(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
|
-
}, vt = { class: "fm-typo-en-body-sm-600" }, yt = { class: "flex flex-col gap-4" }, pt = { 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" }, $t = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Ct = {
|
|
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
|
-
}, Tt = /* @__PURE__ */ se({
|
|
373
|
-
__name: "SnapshotRecalculationDialog",
|
|
374
|
-
props: {
|
|
375
|
-
showButton: { type: Boolean }
|
|
376
|
-
},
|
|
377
|
-
emits: ["submitted"],
|
|
378
|
-
setup(ae, { expose: k, emit: V }) {
|
|
379
|
-
const K = V, { t } = ie(), O = ve(), I = re(), x = de(), S = g(!1), v = g(""), m = g(""), C = g([]), E = g([]), l = g(!1), i = g([]), $ = g(!1), h = g([]), F = g(!1), T = D(
|
|
380
|
-
() => ye(C.value, E.value)
|
|
381
|
-
), U = D(() => De(
|
|
382
|
-
h.value.filter((e) => !!e.closingId).map((e) => ({ closingId: e.closingId, draftCreatedAt: new Date(N(e._id)) }))
|
|
383
|
-
)), W = D(() => {
|
|
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
|
-
}), H = D(() => {
|
|
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 = D(() => {
|
|
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 = D(() => !!v.value && !!m.value && !H.value), j = D(() => i.value.some(
|
|
406
|
-
(e) => !e.completedAt && !e.failedReason
|
|
407
|
-
));
|
|
408
|
-
async function X() {
|
|
409
|
-
S.value = !0, await Promise.all([oe(), Z(), G()]), v.value = "", m.value = "";
|
|
410
|
-
}
|
|
411
|
-
function te() {
|
|
412
|
-
S.value = !1;
|
|
413
|
-
}
|
|
414
|
-
k({
|
|
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
|
-
C.value = e;
|
|
423
|
-
} catch (e) {
|
|
424
|
-
console.error("Error fetching recent closings:", e), x.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
|
-
E.value = e;
|
|
437
|
-
} catch (e) {
|
|
438
|
-
console.error("Error fetching recent snapshots:", e);
|
|
439
|
-
}
|
|
440
|
-
}
|
|
441
|
-
async function G() {
|
|
442
|
-
$.value = !0;
|
|
443
|
-
try {
|
|
444
|
-
const e = await O.recalculation.recalculationRequests();
|
|
445
|
-
i.value = e;
|
|
446
|
-
} catch (e) {
|
|
447
|
-
console.error("Error fetching recalculation requests:", e);
|
|
448
|
-
} finally {
|
|
449
|
-
$.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 O.recalculation.getAffectedClosingDrafts(
|
|
462
|
-
v.value,
|
|
463
|
-
e.toISOString()
|
|
464
|
-
);
|
|
465
|
-
h.value = d;
|
|
466
|
-
} catch {
|
|
467
|
-
x.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 && !H.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
|
-
const e = new Date(m.value);
|
|
488
|
-
if (e.setHours(23, 59, 59, 999), await O.recalculation.scheduleRecalculation({
|
|
489
|
-
openingId: v.value,
|
|
490
|
-
untilDate: e.toISOString(),
|
|
491
|
-
recalculateBySnapshot: !0
|
|
492
|
-
}), h.value.length > 0) {
|
|
493
|
-
const d = h.value.map((B) => B._id);
|
|
494
|
-
await O.recalculation.scheduleInvalidateClosingDraftCache(d);
|
|
495
|
-
}
|
|
496
|
-
x.open({
|
|
497
|
-
title: t("common.success"),
|
|
498
|
-
message: "Stock recalculation has been scheduled successfully",
|
|
499
|
-
type: "success"
|
|
500
|
-
}), await G(), S.value = !1, K("submitted");
|
|
501
|
-
} catch (e) {
|
|
502
|
-
console.error("Error scheduling recalculation:", e), x.open({
|
|
503
|
-
title: t("common.error"),
|
|
504
|
-
message: "Failed to schedule stock recalculation",
|
|
505
|
-
type: "error"
|
|
506
|
-
});
|
|
507
|
-
} finally {
|
|
508
|
-
l.value = !1;
|
|
509
|
-
}
|
|
510
|
-
}
|
|
511
|
-
}
|
|
512
|
-
return (e, d) => {
|
|
513
|
-
const B = w("FmButton"), c = w("FmSelect"), p = w("FmDatePicker"), A = w("FmSnackbar"), P = w("FmAlert"), u = w("FmDialog");
|
|
514
|
-
return n(), y("div", null, [
|
|
515
|
-
e.showButton ? (n(), z(B, {
|
|
516
|
-
key: 0,
|
|
517
|
-
"prepend-icon": "info",
|
|
518
|
-
variant: "tertiary",
|
|
519
|
-
onClick: me(X, ["stop"])
|
|
520
|
-
})) : b("", !0),
|
|
521
|
-
_(u, {
|
|
522
|
-
modelValue: S.value,
|
|
523
|
-
"onUpdate:modelValue": d[4] || (d[4] = (f) => S.value = f),
|
|
524
|
-
"close-button": "",
|
|
525
|
-
dismissAway: "",
|
|
526
|
-
"max-width": "600px"
|
|
527
|
-
}, {
|
|
528
|
-
"dialog-header": R(() => [
|
|
529
|
-
o("div", ot, a(s(t)("inventory.stock.recalculation.title")), 1)
|
|
530
|
-
]),
|
|
531
|
-
"dialog-footer": R(() => [
|
|
532
|
-
j.value ? (n(), y("div", It, [
|
|
533
|
-
_(B, {
|
|
534
|
-
variant: "tertiary",
|
|
535
|
-
onClick: d[3] || (d[3] = (f) => S.value = !1),
|
|
536
|
-
label: s(t)("common.close")
|
|
537
|
-
}, null, 8, ["label"])
|
|
538
|
-
])) : (n(), y("div", Rt, [
|
|
539
|
-
_(B, {
|
|
540
|
-
variant: "tertiary",
|
|
541
|
-
onClick: d[2] || (d[2] = (f) => S.value = !1),
|
|
542
|
-
disabled: l.value,
|
|
543
|
-
label: s(t)("common.cancel")
|
|
544
|
-
}, null, 8, ["disabled", "label"]),
|
|
545
|
-
_(B, {
|
|
546
|
-
variant: "primary",
|
|
547
|
-
onClick: r,
|
|
548
|
-
disabled: !M.value || l.value,
|
|
549
|
-
loading: l.value,
|
|
550
|
-
label: s(t)("inventory.stock.recalculation.schedule")
|
|
551
|
-
}, null, 8, ["disabled", "loading", "label"])
|
|
552
|
-
]))
|
|
553
|
-
]),
|
|
554
|
-
default: R(() => [
|
|
555
|
-
o("div", at, [
|
|
556
|
-
o("div", lt, a(s(t)("inventory.stock.recalculation.description")), 1),
|
|
557
|
-
j.value ? b("", !0) : (n(), y(Q, { key: 0 }, [
|
|
558
|
-
o("div", nt, [
|
|
559
|
-
o("p", st, [
|
|
560
|
-
ee(a(s(t)("inventory.stock.recalculation.openingDate")) + " ", 1),
|
|
561
|
-
d[5] || (d[5] = o("span", { class: "text-fm-color-system-error-300" }, "*", -1))
|
|
562
|
-
]),
|
|
563
|
-
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)),
|
|
564
|
-
_(c, {
|
|
565
|
-
modelValue: v.value,
|
|
566
|
-
"onUpdate:modelValue": d[0] || (d[0] = (f) => v.value = f),
|
|
567
|
-
items: T.value,
|
|
568
|
-
placeholder: s(t)("inventory.stock.recalculation.selectOpening"),
|
|
569
|
-
loading: l.value,
|
|
570
|
-
disabled: l.value
|
|
571
|
-
}, null, 8, ["modelValue", "items", "placeholder", "loading", "disabled"])
|
|
572
|
-
]),
|
|
573
|
-
o("div", it, [
|
|
574
|
-
o("p", ct, [
|
|
575
|
-
ee(a(s(t)("inventory.stock.recalculation.untilDate")) + " ", 1),
|
|
576
|
-
d[7] || (d[7] = o("span", { class: "text-fm-color-system-error-300" }, "*", -1))
|
|
577
|
-
]),
|
|
578
|
-
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)),
|
|
579
|
-
_(p, {
|
|
580
|
-
modelValue: m.value,
|
|
581
|
-
"onUpdate:modelValue": d[1] || (d[1] = (f) => m.value = f),
|
|
582
|
-
placeholder: s(t)("inventory.stock.recalculation.selectDate"),
|
|
583
|
-
min: W.value,
|
|
584
|
-
disabled: !v.value || l.value
|
|
585
|
-
}, null, 8, ["modelValue", "placeholder", "min", "disabled"]),
|
|
586
|
-
H.value ? (n(), y("div", rt, a(H.value), 1)) : b("", !0),
|
|
587
|
-
Y.value ? (n(), z(A, {
|
|
588
|
-
key: 1,
|
|
589
|
-
title: "Warning",
|
|
590
|
-
variant: "warning",
|
|
591
|
-
description: "You have selected today or a future date. The stock balance will be refreshed accordingly."
|
|
592
|
-
})) : b("", !0)
|
|
593
|
-
]),
|
|
594
|
-
v.value && m.value && !H.value ? (n(), z(P, {
|
|
595
|
-
key: 0,
|
|
596
|
-
type: "info"
|
|
597
|
-
}, {
|
|
598
|
-
default: R(() => [
|
|
599
|
-
o("div", dt, a(s(t)("inventory.stock.recalculation.info")), 1)
|
|
600
|
-
]),
|
|
601
|
-
_: 1
|
|
602
|
-
})) : b("", !0),
|
|
603
|
-
h.value.length > 0 ? (n(), y("div", ut, [
|
|
604
|
-
F.value ? (n(), y("div", mt, " Loading affected closing drafts... ")) : (n(), y("div", ft, [
|
|
605
|
-
o("div", vt, " Affected closing draft(s): " + a(h.value.length), 1),
|
|
606
|
-
o("div", yt, [
|
|
607
|
-
(n(!0), y(Q, null, ne(h.value, (f) => (n(), y("div", {
|
|
608
|
-
key: f._id,
|
|
609
|
-
class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
|
|
610
|
-
}, [
|
|
611
|
-
d[9] || (d[9] = ee(" • ")),
|
|
612
|
-
f.closingId && U.value.get(f.closingId) ? (n(), y("span", pt, a(U.value.get(f.closingId)), 1)) : (n(), y("span", gt, a(f._id), 1)),
|
|
613
|
-
f.effectiveAt ? (n(), y("span", ht, " (" + a(new Date(f.effectiveAt).toLocaleString()) + ") ", 1)) : b("", !0)
|
|
614
|
-
]))), 128))
|
|
615
|
-
])
|
|
616
|
-
]))
|
|
617
|
-
])) : b("", !0)
|
|
618
|
-
], 64)),
|
|
619
|
-
i.value.length > 0 ? (n(), y("div", _t, [
|
|
620
|
-
o("p", bt, a(s(t)("inventory.stock.recalculation.recentRequests")), 1),
|
|
621
|
-
o("div", kt, [
|
|
622
|
-
(n(!0), y(Q, null, ne(i.value, (f) => {
|
|
623
|
-
var le;
|
|
624
|
-
return n(), y("div", {
|
|
625
|
-
key: f._id,
|
|
626
|
-
class: "p-12 border border-fm-color-border-primary rounded-8 flex flex-col gap-4"
|
|
627
|
-
}, [
|
|
628
|
-
o("div", xt, [
|
|
629
|
-
o("div", Dt, a(s(t)("inventory.stock.recalculation.requestedAt")) + ": " + a(new Date(f.createdAt).toLocaleString()), 1),
|
|
630
|
-
o("div", wt, [
|
|
631
|
-
(le = f.meta) != null && le.openingType ? (n(), y("div", St, a(f.meta.openingType === "stockSnapshot" ? "Snapshot" : "Closing"), 1)) : b("", !0),
|
|
632
|
-
o("div", {
|
|
633
|
-
class: fe(["fm-typo-en-body-xs-600 px-8 py-4 rounded-4", {
|
|
634
|
-
"bg-fm-color-system-error-100 text-fm-color-system-error-500": f.failedReason,
|
|
635
|
-
"bg-fm-color-system-success-100 text-fm-color-system-success-500": f.completedAt,
|
|
636
|
-
"bg-fm-color-system-info-100 text-fm-color-system-info-500": !f.failedReason && !f.completedAt
|
|
637
|
-
}])
|
|
638
|
-
}, a(f.failedReason ? s(t)("inventory.stock.recalculation.status.failed") : f.completedAt ? s(t)("inventory.stock.recalculation.status.completed") : s(t)("inventory.stock.recalculation.status.inProgress")), 3)
|
|
639
|
-
])
|
|
640
|
-
]),
|
|
641
|
-
o("div", Vt, a(s(t)("inventory.stock.recalculation.from")) + ": " + a(new Date(f.recalculateStartDate).toLocaleDateString()), 1),
|
|
642
|
-
o("div", $t, a(s(t)("inventory.stock.recalculation.to")) + ": " + a(new Date(f.recalculateEndDate).toLocaleDateString()), 1),
|
|
643
|
-
f.createdBy ? (n(), y("div", Ct, a(s(t)("inventory.stock.recalculation.requestedBy")) + ": " + a(f.createdBy.name || f.createdBy.id), 1)) : b("", !0),
|
|
644
|
-
f.completedAt ? (n(), y("div", At, a(s(t)("inventory.stock.recalculation.completedAt")) + ": " + a(new Date(f.completedAt).toLocaleString()), 1)) : b("", !0),
|
|
645
|
-
f.failedReason ? (n(), y("div", Ft, a(f.failedReason), 1)) : b("", !0)
|
|
646
|
-
]);
|
|
647
|
-
}), 128))
|
|
648
|
-
])
|
|
649
|
-
])) : b("", !0)
|
|
650
|
-
])
|
|
651
|
-
]),
|
|
652
|
-
_: 1
|
|
653
|
-
}, 8, ["modelValue"])
|
|
654
|
-
]);
|
|
655
|
-
};
|
|
656
|
-
}
|
|
657
|
-
}), Bt = { 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" }, Ht = { class: "fm-typo-en-label-md-400 text-fm-color-typo-secondary" }, jt = { class: "flex gap-8 ml-auto" }, zt = /* @__PURE__ */ se({
|
|
658
|
-
__name: "ClosingDetailDialog",
|
|
659
|
-
props: {
|
|
660
|
-
modelValue: { type: Boolean },
|
|
661
|
-
type: {},
|
|
662
|
-
data: {}
|
|
663
|
-
},
|
|
664
|
-
emits: ["update:modelValue"],
|
|
665
|
-
setup(ae, { emit: k }) {
|
|
666
|
-
const { t: V } = ie(), K = _e(), t = ae, O = k, I = D({
|
|
667
|
-
get: () => t.modelValue,
|
|
668
|
-
set: (l) => O("update:modelValue", l)
|
|
669
|
-
}), x = g("");
|
|
670
|
-
ce(I, (l) => {
|
|
671
|
-
l || (x.value = "");
|
|
672
|
-
});
|
|
673
|
-
const S = D(() => {
|
|
674
|
-
var l;
|
|
675
|
-
return ((l = t.data) == null ? void 0 : l.skus) ?? [];
|
|
676
|
-
}), v = D(() => {
|
|
677
|
-
var h;
|
|
678
|
-
const l = (h = t.data) == null ? void 0 : h._id;
|
|
679
|
-
if (!l) return "-";
|
|
680
|
-
const i = N(l);
|
|
681
|
-
return new Date(i).toLocaleString();
|
|
682
|
-
}), m = D(() => t.type === "closing" ? V("inventory.closing.history.closingDetail", "Closing Detail") : V("inventory.closing.history.snapshotDetail", "Snapshot Detail")), C = D(() => S.value.map((l) => {
|
|
683
|
-
const i = K.skuById[l.id] ?? null, $ = !i;
|
|
684
|
-
return {
|
|
685
|
-
id: l.id,
|
|
686
|
-
sku: i,
|
|
687
|
-
skuName: (i == null ? void 0 : i.name) ?? l.id,
|
|
688
|
-
skuCode: (i == null ? void 0 : i.code) ?? "-",
|
|
689
|
-
balance: l.balance ?? { amount: 0, precision: 0 },
|
|
690
|
-
isMissing: $,
|
|
691
|
-
costs: l.costs,
|
|
692
|
-
weightedAverage: l.weightedAverage
|
|
693
|
-
};
|
|
694
|
-
})), E = [
|
|
695
|
-
{
|
|
696
|
-
accessorKey: "skuName",
|
|
697
|
-
header: () => V("inventory.ingredient.name", "Ingredient Name"),
|
|
698
|
-
cell: (l) => {
|
|
699
|
-
const i = l.row.original;
|
|
700
|
-
return i.isMissing ? q("div", { class: "flex items-center gap-8" }, [
|
|
701
|
-
q("span", {}, i.id),
|
|
702
|
-
q(
|
|
703
|
-
"span",
|
|
704
|
-
{
|
|
705
|
-
class: "px-8 py-2 rounded-4 bg-fm-color-danger-weak text-fm-color-danger-default fm-typo-en-label-sm-400"
|
|
706
|
-
},
|
|
707
|
-
"Missing"
|
|
708
|
-
)
|
|
709
|
-
]) : l.getValue();
|
|
710
|
-
}
|
|
711
|
-
},
|
|
712
|
-
{
|
|
713
|
-
accessorKey: "skuCode",
|
|
714
|
-
header: () => V("inventory.ingredient.code", "Code")
|
|
715
|
-
},
|
|
716
|
-
{
|
|
717
|
-
id: "balance",
|
|
718
|
-
header: () => V("inventory.closing.history.balance", "Balance"),
|
|
719
|
-
cell: (l) => {
|
|
720
|
-
var h;
|
|
721
|
-
const i = l.row.original;
|
|
722
|
-
if (i.isMissing || !((h = i.sku) != null && h.unit))
|
|
723
|
-
return `${i.balance.amount / Math.pow(10, i.balance.precision)}`;
|
|
724
|
-
const $ = {
|
|
725
|
-
unit: i.sku.unit,
|
|
726
|
-
sku: i.sku,
|
|
727
|
-
amount: i.balance,
|
|
728
|
-
defaultTrackingMeasurement: i.sku.trackingMeasurement ?? void 0
|
|
729
|
-
};
|
|
730
|
-
return q(we, $);
|
|
731
|
-
},
|
|
732
|
-
size: 180
|
|
733
|
-
},
|
|
734
|
-
{
|
|
735
|
-
accessorKey: "weightedAverage",
|
|
736
|
-
header: () => V("inventory.closing.history.weightedAvgCost", "Weighted Avg Cost"),
|
|
737
|
-
cell: (l) => {
|
|
738
|
-
const i = l.getValue();
|
|
739
|
-
if (!i) return "-";
|
|
740
|
-
const $ = i.amount ?? 0, h = i.precision ?? 0, F = i.currency ?? "", T = $ / Math.pow(10, h);
|
|
741
|
-
return `${F} ${T.toFixed(2)}`;
|
|
742
|
-
}
|
|
743
|
-
}
|
|
744
|
-
];
|
|
745
|
-
return (l, i) => {
|
|
746
|
-
const $ = w("FmTextField"), h = w("FmTable"), F = w("FmButton"), T = w("FmDialog");
|
|
747
|
-
return n(), z(T, {
|
|
748
|
-
modelValue: I.value,
|
|
749
|
-
"onUpdate:modelValue": i[2] || (i[2] = (U) => I.value = U),
|
|
750
|
-
"close-button": "",
|
|
751
|
-
dismissAway: "",
|
|
752
|
-
"max-width": "900px"
|
|
753
|
-
}, {
|
|
754
|
-
"dialog-header": R(() => [
|
|
755
|
-
o("div", Bt, a(m.value), 1)
|
|
756
|
-
]),
|
|
757
|
-
default: R(() => {
|
|
758
|
-
var U;
|
|
759
|
-
return [
|
|
760
|
-
o("div", Lt, [
|
|
761
|
-
o("div", Ot, [
|
|
762
|
-
o("div", Et, a(t.type === "closing" ? s(V)("inventory.closing.history.closingId") : s(V)("inventory.closing.history.snapshotId", "Snapshot ID")), 1),
|
|
763
|
-
o("div", Ut, a(((U = t.data) == null ? void 0 : U._id) ?? "-"), 1)
|
|
764
|
-
]),
|
|
765
|
-
o("div", Pt, [
|
|
766
|
-
o("div", Nt, a(s(V)("inventory.closing.history.date")), 1),
|
|
767
|
-
o("div", Mt, a(v.value), 1)
|
|
768
|
-
]),
|
|
769
|
-
o("div", Kt, [
|
|
770
|
-
o("div", Ht, a(s(V)("inventory.closing.history.ingredientBalances", "Ingredient Balances")) + " (" + a(S.value.length) + ") ", 1),
|
|
771
|
-
_($, {
|
|
772
|
-
modelValue: x.value,
|
|
773
|
-
"onUpdate:modelValue": i[0] || (i[0] = (W) => x.value = W),
|
|
774
|
-
placeholder: "Filter by code or name"
|
|
775
|
-
}, null, 8, ["modelValue"]),
|
|
776
|
-
_(h, {
|
|
777
|
-
"row-data": C.value,
|
|
778
|
-
"column-defs": E,
|
|
779
|
-
pagination: { pageSize: 10 },
|
|
780
|
-
"search-value": x.value
|
|
781
|
-
}, null, 8, ["row-data", "search-value"])
|
|
782
|
-
])
|
|
783
|
-
])
|
|
784
|
-
];
|
|
785
|
-
}),
|
|
786
|
-
"dialog-footer": R(() => [
|
|
787
|
-
o("div", jt, [
|
|
788
|
-
_(F, {
|
|
789
|
-
variant: "tertiary",
|
|
790
|
-
onClick: i[1] || (i[1] = (U) => I.value = !1),
|
|
791
|
-
label: "Close"
|
|
792
|
-
})
|
|
793
|
-
])
|
|
794
|
-
]),
|
|
795
|
-
_: 1
|
|
796
|
-
}, 8, ["modelValue"]);
|
|
797
|
-
};
|
|
798
|
-
}
|
|
799
|
-
}), Wt = { class: "flex flex-col gap-16 p-16" }, Yt = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Gt = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Jt = { class: "flex flex-col gap-16" }, Qt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Xt = { class: "flex gap-8 ml-auto" }, co = /* @__PURE__ */ se({
|
|
800
|
-
__name: "ClosingHistoryView",
|
|
801
|
-
setup(ae) {
|
|
802
|
-
var d, B;
|
|
803
|
-
const { t: k } = ie(), V = re(), K = be(), t = he(), O = xe(), I = de(), x = g("closings"), S = D(() => [
|
|
804
|
-
{ label: k("inventory.closing.history.closingsTab"), value: "closings" },
|
|
805
|
-
{ label: k("inventory.closing.history.snapshotsTab"), value: "snapshots" }
|
|
806
|
-
]), v = g([]), m = g(!1), C = g([]), E = g(!1), l = g(!1), i = g("closing"), $ = g(null);
|
|
807
|
-
function h(c) {
|
|
808
|
-
return [
|
|
809
|
-
c.getFullYear(),
|
|
810
|
-
String(c.getMonth() + 1).padStart(2, "0"),
|
|
811
|
-
String(c.getDate()).padStart(2, "0")
|
|
812
|
-
].join("-");
|
|
813
|
-
}
|
|
814
|
-
const F = () => h(new Date(Date.now() - 864e5)), T = g(F()), U = D(() => {
|
|
815
|
-
const c = [];
|
|
816
|
-
return x.value === "closings" ? c.push(
|
|
817
|
-
{
|
|
818
|
-
label: k("inventory.stock.recalculation.title"),
|
|
819
|
-
value: "recalculation",
|
|
820
|
-
prependIcon: "history",
|
|
821
|
-
isAdminOnly: !0
|
|
822
|
-
},
|
|
823
|
-
{
|
|
824
|
-
label: k("inventory.closing.history.initiate_opening"),
|
|
825
|
-
value: "initiateOpening",
|
|
826
|
-
prependIcon: "add_box",
|
|
827
|
-
isAdminOnly: !0
|
|
828
|
-
},
|
|
829
|
-
{
|
|
830
|
-
label: "Refresh",
|
|
831
|
-
value: "refreshOpening",
|
|
832
|
-
prependIcon: "refresh"
|
|
833
|
-
}
|
|
834
|
-
) : c.push(
|
|
835
|
-
{
|
|
836
|
-
label: `${k("inventory.stock.recalculation.title")} (BETA)`,
|
|
837
|
-
value: "recalculation",
|
|
838
|
-
prependIcon: "history",
|
|
839
|
-
isAdminOnly: !0
|
|
840
|
-
},
|
|
841
|
-
{
|
|
842
|
-
label: `${k("inventory.closing.history.initiate_snapshot")} (BETA)`,
|
|
843
|
-
value: "initiateStockSnapshot",
|
|
844
|
-
prependIcon: "camera",
|
|
845
|
-
isAdminOnly: !0
|
|
846
|
-
},
|
|
847
|
-
{
|
|
848
|
-
label: "Refresh",
|
|
849
|
-
value: "refreshStockSnapshot",
|
|
850
|
-
prependIcon: "refresh"
|
|
851
|
-
}
|
|
852
|
-
), c;
|
|
853
|
-
}), W = g(), H = g();
|
|
854
|
-
function Y(c) {
|
|
855
|
-
var p, A;
|
|
856
|
-
switch (c) {
|
|
857
|
-
case "recalculation":
|
|
858
|
-
return x.value === "closings" ? (p = W.value) == null ? void 0 : p.open() : (A = H.value) == null ? void 0 : A.open();
|
|
859
|
-
case "initiateOpening": {
|
|
860
|
-
O.open({
|
|
861
|
-
title: "Initiate Opening Balance",
|
|
862
|
-
message: "Initiate opening balance if no opening balance exists for the current location.",
|
|
863
|
-
primaryActions: { text: "Confirm", close: !0 }
|
|
864
|
-
}).onPrimary(async () => {
|
|
865
|
-
try {
|
|
866
|
-
await V.initiateClosing(), I.open({
|
|
867
|
-
message: "Opening balance initiated successfully.",
|
|
868
|
-
type: "success"
|
|
869
|
-
}), await G();
|
|
870
|
-
} catch (P) {
|
|
871
|
-
I.open({
|
|
872
|
-
message: P.message || "Failed to initiate opening balance. Please try again.",
|
|
873
|
-
type: "error"
|
|
874
|
-
});
|
|
875
|
-
}
|
|
876
|
-
});
|
|
877
|
-
break;
|
|
878
|
-
}
|
|
879
|
-
case "initiateStockSnapshot": {
|
|
880
|
-
T.value = F(), M.value = !0;
|
|
881
|
-
break;
|
|
882
|
-
}
|
|
883
|
-
case "refreshOpening": {
|
|
884
|
-
G();
|
|
885
|
-
break;
|
|
886
|
-
}
|
|
887
|
-
case "refreshStockSnapshot": {
|
|
888
|
-
J();
|
|
889
|
-
break;
|
|
890
|
-
}
|
|
891
|
-
}
|
|
892
|
-
}
|
|
893
|
-
const M = g(!1), j = g(!1), X = F();
|
|
894
|
-
async function te() {
|
|
895
|
-
j.value = !0;
|
|
896
|
-
try {
|
|
897
|
-
await V.initiateStockSnapshot(T.value), I.open({
|
|
898
|
-
message: "Stock snapshot created successfully.",
|
|
899
|
-
type: "success"
|
|
900
|
-
}), M.value = !1, await J();
|
|
901
|
-
} catch (c) {
|
|
902
|
-
I.open({
|
|
903
|
-
message: c.message || "Failed to create stock snapshot. Please try again.",
|
|
904
|
-
type: "error"
|
|
905
|
-
});
|
|
906
|
-
} finally {
|
|
907
|
-
j.value = !1;
|
|
908
|
-
}
|
|
909
|
-
}
|
|
910
|
-
const oe = [
|
|
911
|
-
...(d = t.sessionUser.value) != null && d.role.isAdmin ? [
|
|
912
|
-
{
|
|
913
|
-
accessorKey: "_id",
|
|
914
|
-
header: () => q(ue, {}, () => `${k("inventory.closing.history.closingId")}`),
|
|
915
|
-
cell: (c) => c.getValue()
|
|
916
|
-
}
|
|
917
|
-
] : [],
|
|
918
|
-
{
|
|
919
|
-
accessorKey: "_id",
|
|
920
|
-
id: "date",
|
|
921
|
-
header: () => k("inventory.closing.history.date"),
|
|
922
|
-
cell: (c) => {
|
|
923
|
-
const p = c.getValue(), A = N(p);
|
|
924
|
-
return new Date(A).toLocaleDateString();
|
|
925
|
-
}
|
|
926
|
-
},
|
|
927
|
-
{
|
|
928
|
-
accessorKey: "_id",
|
|
929
|
-
id: "time",
|
|
930
|
-
header: () => k("inventory.closing.history.time"),
|
|
931
|
-
cell: (c) => {
|
|
932
|
-
const p = c.getValue(), A = N(p);
|
|
933
|
-
return new Date(A).toLocaleTimeString();
|
|
934
|
-
}
|
|
935
|
-
},
|
|
936
|
-
{
|
|
937
|
-
accessorKey: "ref",
|
|
938
|
-
header: () => k("inventory.closing.history.createdFrom"),
|
|
939
|
-
cell: (c) => c.getValue() || "-"
|
|
940
|
-
}
|
|
941
|
-
], Z = [
|
|
942
|
-
...(B = t.sessionUser.value) != null && B.role.isAdmin ? [
|
|
943
|
-
{
|
|
944
|
-
accessorKey: "_id",
|
|
945
|
-
header: () => q(
|
|
946
|
-
ue,
|
|
947
|
-
{},
|
|
948
|
-
() => `${k("inventory.closing.history.snapshotId", "Snapshot ID")}`
|
|
949
|
-
),
|
|
950
|
-
cell: (c) => c.getValue()
|
|
951
|
-
}
|
|
952
|
-
] : [],
|
|
953
|
-
{
|
|
954
|
-
accessorKey: "_id",
|
|
955
|
-
id: "date",
|
|
956
|
-
header: () => k("inventory.closing.history.date"),
|
|
957
|
-
cell: (c) => {
|
|
958
|
-
const p = c.getValue(), A = N(p);
|
|
959
|
-
return new Date(A).toLocaleDateString();
|
|
960
|
-
}
|
|
961
|
-
},
|
|
962
|
-
{
|
|
963
|
-
accessorKey: "_id",
|
|
964
|
-
id: "time",
|
|
965
|
-
header: () => k("inventory.closing.history.time"),
|
|
966
|
-
cell: (c) => {
|
|
967
|
-
const p = c.getValue(), A = N(p);
|
|
968
|
-
return new Date(A).toLocaleTimeString();
|
|
969
|
-
}
|
|
970
|
-
},
|
|
971
|
-
{
|
|
972
|
-
accessorKey: "remark",
|
|
973
|
-
header: () => k("inventory.closing.history.createdFrom"),
|
|
974
|
-
cell: (c) => c.getValue() || "-"
|
|
975
|
-
}
|
|
976
|
-
];
|
|
977
|
-
async function G() {
|
|
978
|
-
if (K.currentLocationDBName) {
|
|
979
|
-
m.value = !0;
|
|
980
|
-
try {
|
|
981
|
-
const c = await V.getLastNClosings(30);
|
|
982
|
-
v.value = c;
|
|
983
|
-
} catch (c) {
|
|
984
|
-
console.error("Error fetching closings:", c), v.value = [];
|
|
985
|
-
} finally {
|
|
986
|
-
m.value = !1;
|
|
987
|
-
}
|
|
988
|
-
}
|
|
989
|
-
}
|
|
990
|
-
async function J() {
|
|
991
|
-
if (K.currentLocationDBName) {
|
|
992
|
-
E.value = !0;
|
|
993
|
-
try {
|
|
994
|
-
const c = await V.getLastNStockSnapshots(30);
|
|
995
|
-
C.value = c;
|
|
996
|
-
} catch (c) {
|
|
997
|
-
console.error("Error fetching stock snapshots:", c), C.value = [];
|
|
998
|
-
} finally {
|
|
999
|
-
E.value = !1;
|
|
1000
|
-
}
|
|
1001
|
-
}
|
|
1002
|
-
}
|
|
1003
|
-
function r(c) {
|
|
1004
|
-
i.value = "closing", $.value = c, l.value = !0;
|
|
1005
|
-
}
|
|
1006
|
-
function e(c) {
|
|
1007
|
-
i.value = "snapshot", $.value = c, l.value = !0;
|
|
1008
|
-
}
|
|
1009
|
-
return K.watchLocation(async () => {
|
|
1010
|
-
K.currentLocationDBName && (await G(), await J());
|
|
1011
|
-
}), (c, p) => {
|
|
1012
|
-
const A = w("FmTabs"), P = w("FmTable"), u = w("FmDatePicker"), f = w("FmButton"), le = w("FmDialog");
|
|
1013
|
-
return n(), z(ge, {
|
|
1014
|
-
actions: U.value,
|
|
1015
|
-
title: s(k)("inventory.closing.history.title"),
|
|
1016
|
-
"onClick:action": Y
|
|
1017
|
-
}, {
|
|
1018
|
-
default: R(() => [
|
|
1019
|
-
o("div", Wt, [
|
|
1020
|
-
_(ke, {
|
|
1021
|
-
"change-location": "",
|
|
1022
|
-
"hide-filter-options": !0
|
|
1023
|
-
}),
|
|
1024
|
-
_(A, {
|
|
1025
|
-
"model-value": x.value,
|
|
1026
|
-
"onUpdate:modelValue": p[0] || (p[0] = (L) => x.value = L),
|
|
1027
|
-
items: S.value
|
|
1028
|
-
}, null, 8, ["model-value", "items"]),
|
|
1029
|
-
x.value === "closings" ? (n(), y(Q, { key: 0 }, [
|
|
1030
|
-
o("div", Yt, a(s(k)("inventory.closing.history.closingsDescription")), 1),
|
|
1031
|
-
_(P, {
|
|
1032
|
-
loading: m.value,
|
|
1033
|
-
"row-data": v.value,
|
|
1034
|
-
"column-defs": oe,
|
|
1035
|
-
onRowClick: p[1] || (p[1] = (L) => r(L.original))
|
|
1036
|
-
}, null, 8, ["loading", "row-data"])
|
|
1037
|
-
], 64)) : b("", !0),
|
|
1038
|
-
x.value === "snapshots" ? (n(), y(Q, { key: 1 }, [
|
|
1039
|
-
o("div", Gt, a(s(k)("inventory.closing.history.snapshotsDescription")), 1),
|
|
1040
|
-
_(P, {
|
|
1041
|
-
loading: E.value,
|
|
1042
|
-
"row-data": C.value,
|
|
1043
|
-
"column-defs": Z,
|
|
1044
|
-
onRowClick: p[2] || (p[2] = (L) => e(L.original))
|
|
1045
|
-
}, null, 8, ["loading", "row-data"])
|
|
1046
|
-
], 64)) : b("", !0)
|
|
1047
|
-
]),
|
|
1048
|
-
(n(), z(pe, { to: "body" }, [
|
|
1049
|
-
_(tt, {
|
|
1050
|
-
"show-button": !1,
|
|
1051
|
-
ref_key: "recalculationDialogRef",
|
|
1052
|
-
ref: W,
|
|
1053
|
-
onSubmitted: p[3] || (p[3] = (L) => G())
|
|
1054
|
-
}, null, 512),
|
|
1055
|
-
_(Tt, {
|
|
1056
|
-
"show-button": !1,
|
|
1057
|
-
ref_key: "snapshotRecalculationDialogRef",
|
|
1058
|
-
ref: H,
|
|
1059
|
-
onSubmitted: p[4] || (p[4] = (L) => J())
|
|
1060
|
-
}, null, 512),
|
|
1061
|
-
_(zt, {
|
|
1062
|
-
modelValue: l.value,
|
|
1063
|
-
"onUpdate:modelValue": p[5] || (p[5] = (L) => l.value = L),
|
|
1064
|
-
type: i.value,
|
|
1065
|
-
data: $.value
|
|
1066
|
-
}, null, 8, ["modelValue", "type", "data"]),
|
|
1067
|
-
_(le, {
|
|
1068
|
-
modelValue: M.value,
|
|
1069
|
-
"onUpdate:modelValue": p[8] || (p[8] = (L) => M.value = L),
|
|
1070
|
-
"close-button": "",
|
|
1071
|
-
dismissAway: "",
|
|
1072
|
-
"max-width": "400px"
|
|
1073
|
-
}, {
|
|
1074
|
-
"dialog-header": R(() => p[9] || (p[9] = [
|
|
1075
|
-
o("div", { class: "fm-typo-en-heading-lg-600" }, "Initiate Stock Snapshot", -1)
|
|
1076
|
-
])),
|
|
1077
|
-
default: R(() => [
|
|
1078
|
-
o("div", Jt, [
|
|
1079
|
-
o("div", Qt, a(s(k)("inventory.closing.history.snapshotsDescription")), 1),
|
|
1080
|
-
_(u, {
|
|
1081
|
-
modelValue: T.value,
|
|
1082
|
-
"onUpdate:modelValue": p[6] || (p[6] = (L) => T.value = L),
|
|
1083
|
-
label: "Snapshot Date",
|
|
1084
|
-
max: s(X)
|
|
1085
|
-
}, null, 8, ["modelValue", "max"])
|
|
1086
|
-
])
|
|
1087
|
-
]),
|
|
1088
|
-
"dialog-footer": R(() => [
|
|
1089
|
-
o("div", Xt, [
|
|
1090
|
-
_(f, {
|
|
1091
|
-
variant: "tertiary",
|
|
1092
|
-
onClick: p[7] || (p[7] = (L) => M.value = !1),
|
|
1093
|
-
label: "Cancel",
|
|
1094
|
-
disabled: j.value
|
|
1095
|
-
}, null, 8, ["disabled"]),
|
|
1096
|
-
_(f, {
|
|
1097
|
-
variant: "primary",
|
|
1098
|
-
onClick: te,
|
|
1099
|
-
label: "Confirm",
|
|
1100
|
-
loading: j.value
|
|
1101
|
-
}, null, 8, ["loading"])
|
|
1102
|
-
])
|
|
1103
|
-
]),
|
|
1104
|
-
_: 1
|
|
1105
|
-
}, 8, ["modelValue"])
|
|
1106
|
-
]))
|
|
1107
|
-
]),
|
|
1108
|
-
_: 1
|
|
1109
|
-
}, 8, ["actions", "title"]);
|
|
1110
|
-
};
|
|
1111
|
-
}
|
|
1112
|
-
});
|
|
1113
|
-
export {
|
|
1114
|
-
co as default
|
|
1115
|
-
};
|