@feedmepos/mf-inventory-portal 1.3.9-dev.2 → 1.3.10
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-BdI67_JN.js → App-AMCLoiCx.js} +3 -3
- package/dist/{ApprovalView-B1NNaLLy.js → ApprovalView-Ck5sbwhv.js} +7 -7
- package/dist/{BindingsDialog-jE-dghzD.js → BindingsDialog-E5UFxBQJ.js} +2 -2
- package/dist/{BindingsPicker-BjzQVedz.js → BindingsPicker-Dtm9YX11.js} +2 -2
- package/dist/{BindingsTable-BeNHq3Cs.js → BindingsTable-Bl2Oy_78.js} +3 -3
- package/dist/ClosingDraftView-BBJPae1z.js +2460 -0
- package/dist/ClosingHistoryView-B0Ceyn5l.js +1099 -0
- package/dist/{ClosingTemplateView-BUjDyYGl.js → ClosingTemplateView-B0nxOAiX.js} +14 -14
- package/dist/{DeliveryOrderPrintPreview-Czt1MLZ_.js → DeliveryOrderPrintPreview-Ca0H1Ohm.js} +2 -2
- package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-BHoMk9oO.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-Bd4RuhVn.js} +3 -3
- package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-CSuTIhFr.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-BhN9g4ed.js} +2 -2
- package/dist/{FmMultiselectDialog-_mQIndQU.js → FmMultiselectDialog-Cth3pVpH.js} +2 -2
- package/dist/{FmMultiselectDialog-CLjJFmL2.js → FmMultiselectDialog-D4gPja33.js} +1 -1
- package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-Db3KL1J4.js → FmUnitInput.vue_vue_type_script_setup_true_lang-Ckg0Bk7q.js} +4 -4
- package/dist/{ImportView-Hmv8oOwi.js → ImportView-DNZHXGqI.js} +6 -6
- package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-DJ74tTtu.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-CtgvXj7S.js} +1 -1
- package/dist/{IngredientGroupView-D_fdrAir.js → IngredientGroupView-CJqntGUb.js} +5 -5
- package/dist/{IngredientsView-Ci5oxdy3.js → IngredientsView-rnlLpT0N.js} +15 -15
- package/dist/{IntegrationExplorerView-CVPV3V6E.js → IntegrationExplorerView-Df1bUIb_.js} +5 -5
- package/dist/{IntegrationView-8e450eho.js → IntegrationView-D7hpS7rk.js} +15 -15
- package/dist/{InventoryBindingForm-DQ8v7_rx.js → InventoryBindingForm-O2Aa9sTu.js} +1 -1
- package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-B6EgVlRx.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-CNfQNVWa.js} +5 -5
- package/dist/{InventoryBindingSummary-CUQurNIf.js → InventoryBindingSummary-BeW6UPMa.js} +1 -1
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-Gva5TitS.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-CmkR9Kwv.js} +1 -1
- package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-DWnVDWYN.js → PremiumBadge.vue_vue_type_script_setup_true_lang-8HEq6wUL.js} +1 -1
- package/dist/{PublishView-BOqcyvXi.js → PublishView-BWVQj7KV.js} +3 -3
- package/dist/{PurchaseOrderPrintPreview-BSmCNsRd.js → PurchaseOrderPrintPreview-Buu_XKZ6.js} +2 -2
- package/dist/{ReceiveRequestView-CSpbpF8o.js → ReceiveRequestView-BFMr29ao.js} +23 -23
- package/dist/{RecipeView-n8O74vm0.js → RecipeView-CKwIiPvs.js} +15 -15
- package/dist/{SettingsView-Cd-XI85I.js → SettingsView-D9sl-8ky.js} +6 -5
- package/dist/{StockView-C6EC-gfN.js → StockView-DW-XdEFn.js} +18 -18
- package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-CCDPVBEk.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-CM68SEVE.js} +1 -1
- package/dist/{SupplierView-CIhoOaRm.js → SupplierView-cFigezy0.js} +12 -12
- package/dist/{SurchargeView-CMsPGwN6.js → SurchargeView-esXeVFYR.js} +6 -6
- package/dist/{SystemTrailDialog.vue_vue_type_script_setup_true_lang-Co-QAzlC.js → SystemTrailDialog.vue_vue_type_script_setup_true_lang-B6WHfp7s.js} +2 -2
- package/dist/{TemplatePublishDialog.vue_vue_type_script_setup_true_lang-C-PNgED3.js → TemplatePublishDialog.vue_vue_type_script_setup_true_lang-WkcGwhKF.js} +1 -1
- package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-6hlwPSZr.js → TransferDetails.vue_vue_type_script_setup_true_lang-C6wgnpjA.js} +19 -19
- package/dist/{TransferTemplateView-Ba7bZICY.js → TransferTemplateView-ORJYkbik.js} +17 -17
- package/dist/{UnitCostHistoryView-BlpAzQC9.js → UnitCostHistoryView-lOjkEykk.js} +4 -4
- package/dist/{UnitDisplayControl.vue_vue_type_script_setup_true_lang-xiUvPYVX.js → UnitDisplayControl.vue_vue_type_script_setup_true_lang-DHP8-Qeq.js} +4 -4
- package/dist/{UnitView-BR0uGHcU.js → UnitView-BciDe30E.js} +7 -7
- package/dist/{WarehouseView-Cn8W93kO.js → WarehouseView-LrZMhOZ3.js} +5 -5
- package/dist/{WastageTemplateView-B3Rlhrgt.js → WastageTemplateView-_XtPd3w7.js} +14 -14
- package/dist/{app-Dbe7V63L.js → app-BwuCotIT.js} +47 -15
- package/dist/app.d.ts +32 -0
- package/dist/app.js +1 -1
- package/dist/{closing-template-C60HJnuG.js → closing-template-CrwrQRVT.js} +1 -1
- package/dist/{date2-DYdjU4Dj.js → date2-CN6oeiND.js} +1 -1
- package/dist/{dayjs.min-Dg5QmVd4.js → dayjs.min-DXr7vZ0q.js} +1 -1
- package/dist/{decimal-QkHGtq6S.js → decimal-cbUB1bNB.js} +2 -2
- package/dist/{defineDeepModel-DHKXLKo8.js → defineDeepModel-DbejVC8E.js} +1 -1
- package/dist/{duplicate-template-Dq4BRUUL.js → duplicate-template-UfjN1u1a.js} +1 -1
- package/dist/{export-DPp8BiEP.js → export-CgVMsyty.js} +1 -1
- package/dist/{feature-BK5cMjRG.js → feature-DvDCwJgX.js} +2 -2
- package/dist/{format-time-from-id-BpQopXAH.js → format-time-from-id-fDBus_Pv.js} +1 -1
- package/dist/{format-unit-display-Cd6ytcux.js → format-unit-display-DoSgnu6k.js} +11 -11
- package/dist/{import-export.helper-altzSoJ6.js → import-export.helper-BCgj8CQm.js} +6 -6
- package/dist/{index-CN0nHrpu.js → index-BA5L3Wrg.js} +1 -1
- package/dist/{index-BIpODgwB.js → index-DNiI_HP3.js} +3 -3
- package/dist/{index-CPiqET5G.js → index-bEeIRiah.js} +1 -1
- package/dist/{inventory-core-dart.default-D70169Bu.js → inventory-core-dart.default-DU0ShPuP.js} +6 -6
- package/dist/{lodash-Bxf-HD6Z.js → lodash-BGuKCADh.js} +1 -1
- package/dist/{lz-string-9T-4wD-Z.js → lz-string-DeRM387a.js} +1 -1
- package/dist/{netsuite-BKXgpKUj.js → netsuite-C42sBtDq.js} +3 -3
- package/dist/{number-8SeP62VA.js → number-C272zRB2.js} +3 -3
- package/dist/{predefined-templates-fq9IwL3Z.js → predefined-templates-BVtb9AuB.js} +1 -1
- package/dist/{purchase-order-template-B5nDbemx.js → purchase-order-template-Dit4HCbR.js} +1 -1
- package/dist/recalculationUtils-TOCl7HAN.js +93 -0
- package/dist/{rules-CkEGsMeN.js → rules-BWuA1LhO.js} +2 -2
- package/dist/{stock-gVGvyX7k.js → stock-OdR_zYes.js} +1 -1
- package/dist/{stock-6in8sQP7.js → stock-tStZ6BaN.js} +3 -3
- package/dist/{supplier-LPpRbpiG.js → supplier-J5zLFk0g.js} +2 -2
- package/dist/{surcharge-C6hh2TF1.js → surcharge-Opp82HwR.js} +1 -1
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{use-ingredient-select-dialog-Cu-MKKsF.js → use-ingredient-select-dialog-Bj07pe0e.js} +2 -2
- package/dist/{use-inventory-binding-dialog-D_nkJQuf.js → use-inventory-binding-dialog-BrqmqQsH.js} +2 -2
- package/dist/{use-template-enabled-locations-VtfLGQ5g.js → use-template-enabled-locations-CJ0YnZF0.js} +2 -2
- package/dist/views/closing-draft/composables/use-closing-draft-table.d.ts +178 -2502
- package/dist/views/integration/components/netsuite/business/AddLocationDialog.vue.d.ts +4 -22
- package/dist/views/integration/components/netsuite/business/AddVendorDialog.vue.d.ts +4 -22
- package/dist/views/stock/components/dialog/recalculationUtils.d.ts +13 -0
- package/dist/{vue-i18n-DCT1ZMkA.js → vue-i18n-Duedc0G3.js} +292 -292
- package/dist/{xlsx-B7ycJmBG.js → xlsx-BxSTEHnr.js} +398 -398
- package/dist/{xlsx.util-CaSNWKSp.js → xlsx.util-BytvgbQg.js} +1 -1
- package/package.json +2 -2
- package/dist/ClosingDraftView-CzEtmv80.js +0 -2423
- package/dist/ClosingHistoryView-BKF0J6Ks.js +0 -1158
|
@@ -1,1158 +0,0 @@
|
|
|
1
|
-
import { defineComponent as le, ref as g, computed as V, watch as me, resolveComponent as $, openBlock as c, createElementBlock as y, createBlock as H, withModifiers as fe, createCommentVNode as k, createVNode as b, withCtx as I, createElementVNode as n, toDisplayString as i, unref as r, Fragment as z, createTextVNode as Z, renderList as ne, normalizeClass as pe, h as X, Teleport as ge } from "vue";
|
|
2
|
-
import { _ as he } from "./SingleColumnLayout.vue_vue_type_script_setup_true_lang-sUxHOj47.js";
|
|
3
|
-
import { useI18n as se, useCoreStore as be } from "@feedmepos/mf-common";
|
|
4
|
-
import { D as P, H as ce, a as _e, u as ke } from "./app-Dbe7V63L.js";
|
|
5
|
-
import { F as de } from "./FmAdminBadge-DjnBAgyv.js";
|
|
6
|
-
import { _ as xe } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-CSuTIhFr.js";
|
|
7
|
-
import { useSnackbar as re, useDialog as De } from "@feedmepos/ui-library";
|
|
8
|
-
import { u as ye } from "./stock-gVGvyX7k.js";
|
|
9
|
-
import { _ as Se } from "./UnitDisplayControl.vue_vue_type_script_setup_true_lang-xiUvPYVX.js";
|
|
10
|
-
function ie(B) {
|
|
11
|
-
return Math.floor(B.getTime() / 1e3) * 1e3;
|
|
12
|
-
}
|
|
13
|
-
function ue(B) {
|
|
14
|
-
const x = [
|
|
15
|
-
"Jan",
|
|
16
|
-
"Feb",
|
|
17
|
-
"Mar",
|
|
18
|
-
"Apr",
|
|
19
|
-
"May",
|
|
20
|
-
"Jun",
|
|
21
|
-
"Jul",
|
|
22
|
-
"Aug",
|
|
23
|
-
"Sep",
|
|
24
|
-
"Oct",
|
|
25
|
-
"Nov",
|
|
26
|
-
"Dec"
|
|
27
|
-
], D = B.getFullYear(), L = x[B.getMonth()], o = B.getDate();
|
|
28
|
-
let h = B.getHours();
|
|
29
|
-
const A = B.getMinutes().toString().padStart(2, "0"), p = B.getSeconds().toString().padStart(2, "0"), u = h >= 12 ? "PM" : "AM";
|
|
30
|
-
return h = h % 12, h = h || 12, `${D} ${L} ${o} ${h}:${A}:${p} ${u}`;
|
|
31
|
-
}
|
|
32
|
-
function ve(B, x = []) {
|
|
33
|
-
const D = B.map((p) => {
|
|
34
|
-
const u = P(p._id), s = new Date(u);
|
|
35
|
-
return {
|
|
36
|
-
label: "",
|
|
37
|
-
// Will be set after grouping
|
|
38
|
-
value: p._id,
|
|
39
|
-
type: "closing",
|
|
40
|
-
date: s
|
|
41
|
-
};
|
|
42
|
-
}), L = x.map((p) => {
|
|
43
|
-
const u = P(p._id), s = new Date(u);
|
|
44
|
-
return {
|
|
45
|
-
label: "",
|
|
46
|
-
// Will be set after grouping
|
|
47
|
-
value: p._id,
|
|
48
|
-
type: "snapshot",
|
|
49
|
-
date: s
|
|
50
|
-
};
|
|
51
|
-
}), o = [...D, ...L].sort(
|
|
52
|
-
(p, u) => u.date.getTime() - p.date.getTime()
|
|
53
|
-
), h = /* @__PURE__ */ new Map();
|
|
54
|
-
for (const p of o) {
|
|
55
|
-
const u = ie(p.date);
|
|
56
|
-
h.has(u) || h.set(u, []), h.get(u).push(p);
|
|
57
|
-
}
|
|
58
|
-
const A = x.length > 0;
|
|
59
|
-
for (const [, p] of h)
|
|
60
|
-
if (p.length > 1)
|
|
61
|
-
p.sort((u, s) => u.date.getTime() - s.date.getTime()), p.forEach((u, s) => {
|
|
62
|
-
const d = A ? u.type === "closing" ? " (Closing)" : " (Snapshot)" : "";
|
|
63
|
-
u.label = `${ue(u.date)}${d} (Rev ${s + 1})`;
|
|
64
|
-
});
|
|
65
|
-
else {
|
|
66
|
-
const u = p[0], s = A ? u.type === "closing" ? " (Closing)" : " (Snapshot)" : "";
|
|
67
|
-
u.label = `${ue(u.date)}${s}`;
|
|
68
|
-
}
|
|
69
|
-
return o.sort((p, u) => {
|
|
70
|
-
const s = ie(p.date), d = ie(u.date);
|
|
71
|
-
return s !== d ? d - s : u.date.getTime() - p.date.getTime();
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
const we = { class: "fm-typo-en-heading-lg-600" }, $e = { class: "flex flex-col gap-16" }, Ce = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ve = { class: "flex flex-col gap-8" }, Ae = { class: "fm-typo-en-body-md-600" }, Fe = { class: "flex flex-col gap-8" }, Te = { class: "fm-typo-en-body-md-600" }, Re = { class: "flex items-center gap-8 mb-8" }, Be = {
|
|
75
|
-
key: 2,
|
|
76
|
-
class: "text-red-500 text-sm mt-2"
|
|
77
|
-
}, Ie = { class: "fm-typo-en-body-sm-400" }, Le = {
|
|
78
|
-
key: 1,
|
|
79
|
-
class: "p-12 border border-fm-color-border-primary rounded-8 bg-fm-color-background-secondary"
|
|
80
|
-
}, Oe = {
|
|
81
|
-
key: 0,
|
|
82
|
-
class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
|
|
83
|
-
}, Ee = {
|
|
84
|
-
key: 1,
|
|
85
|
-
class: "flex flex-col gap-8"
|
|
86
|
-
}, Me = { class: "fm-typo-en-body-sm-600" }, Pe = { class: "flex flex-col gap-4" }, Ue = { key: 0 }, Ne = {
|
|
87
|
-
key: 1,
|
|
88
|
-
class: "flex flex-col gap-8"
|
|
89
|
-
}, 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" }, Je = { class: "flex items-center gap-8" }, We = {
|
|
90
|
-
key: 0,
|
|
91
|
-
class: "fm-typo-en-body-xs-600 px-8 py-4 rounded-4 bg-fm-color-neutral-100 text-fm-color-typo-secondary"
|
|
92
|
-
}, Ye = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Ge = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Qe = {
|
|
93
|
-
key: 0,
|
|
94
|
-
class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
|
|
95
|
-
}, Xe = {
|
|
96
|
-
key: 1,
|
|
97
|
-
class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
|
|
98
|
-
}, Ze = {
|
|
99
|
-
key: 2,
|
|
100
|
-
class: "fm-typo-en-body-xs-400 text-fm-color-system-error-500"
|
|
101
|
-
}, qe = {
|
|
102
|
-
key: 0,
|
|
103
|
-
class: "flex gap-8 ml-auto"
|
|
104
|
-
}, et = {
|
|
105
|
-
key: 1,
|
|
106
|
-
class: "flex gap-8 ml-auto"
|
|
107
|
-
}, tt = /* @__PURE__ */ le({
|
|
108
|
-
__name: "RecalculationDialog",
|
|
109
|
-
props: {
|
|
110
|
-
showButton: { type: Boolean }
|
|
111
|
-
},
|
|
112
|
-
emits: ["submitted"],
|
|
113
|
-
setup(B, { expose: x, emit: D }) {
|
|
114
|
-
const L = D, { t: o } = se(), h = ye(), A = ce(), p = re(), u = g(!1), s = g(""), d = g(""), T = g(!1), v = g([]), l = g(!1), S = g([]), C = g(!1), _ = g([]), w = g(!1), J = V(() => ve(v.value)), G = V(() => {
|
|
115
|
-
if (!s.value) return [];
|
|
116
|
-
const e = J.value.find((a) => a.value === s.value);
|
|
117
|
-
return e ? J.value.filter((a) => a.date.getTime() > e.date.getTime()).sort((a, F) => F.date.getTime() - a.date.getTime()) : [];
|
|
118
|
-
}), U = V({
|
|
119
|
-
get: () => {
|
|
120
|
-
if (T.value && d.value) {
|
|
121
|
-
const e = v.value.find((a) => P(a._id) === d.value);
|
|
122
|
-
return (e == null ? void 0 : e._id) || d.value;
|
|
123
|
-
}
|
|
124
|
-
return d.value;
|
|
125
|
-
},
|
|
126
|
-
set: (e) => {
|
|
127
|
-
T.value && e ? d.value = P(e) : d.value = e;
|
|
128
|
-
}
|
|
129
|
-
}), q = V(() => {
|
|
130
|
-
if (s.value)
|
|
131
|
-
try {
|
|
132
|
-
const e = P(s.value);
|
|
133
|
-
if (e)
|
|
134
|
-
return e;
|
|
135
|
-
} catch (e) {
|
|
136
|
-
console.error("Error parsing date from closing ID:", e);
|
|
137
|
-
}
|
|
138
|
-
}), O = V(() => {
|
|
139
|
-
if (!s.value || !d.value) return "";
|
|
140
|
-
const e = P(s.value), a = d.value;
|
|
141
|
-
if (e && a) {
|
|
142
|
-
const F = new Date(e).getTime();
|
|
143
|
-
if (new Date(a).getTime() <= F)
|
|
144
|
-
return o("inventory.stock.recalculation.error.endDateBeforeOpening");
|
|
145
|
-
}
|
|
146
|
-
return "";
|
|
147
|
-
}), N = V(() => !!s.value && !!d.value && !O.value), W = V(() => S.value.some(
|
|
148
|
-
(e) => !e.completedAt && !e.failedReason
|
|
149
|
-
));
|
|
150
|
-
async function Q() {
|
|
151
|
-
u.value = !0, await Promise.all([te(), K()]), s.value = "", d.value = "", T.value = !1;
|
|
152
|
-
}
|
|
153
|
-
function ee() {
|
|
154
|
-
u.value = !1;
|
|
155
|
-
}
|
|
156
|
-
x({
|
|
157
|
-
open: Q,
|
|
158
|
-
close: ee
|
|
159
|
-
});
|
|
160
|
-
async function te() {
|
|
161
|
-
l.value = !0;
|
|
162
|
-
try {
|
|
163
|
-
const e = await A.getLastNClosings(30);
|
|
164
|
-
v.value = e;
|
|
165
|
-
} catch (e) {
|
|
166
|
-
console.error("Error fetching recent closings:", e), p.open({
|
|
167
|
-
title: o("common.error"),
|
|
168
|
-
message: "Failed to fetch recent closings",
|
|
169
|
-
type: "error"
|
|
170
|
-
});
|
|
171
|
-
} finally {
|
|
172
|
-
l.value = !1;
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
async function K() {
|
|
176
|
-
C.value = !0;
|
|
177
|
-
try {
|
|
178
|
-
const e = await h.recalculation.recalculationRequests();
|
|
179
|
-
S.value = e;
|
|
180
|
-
} catch (e) {
|
|
181
|
-
console.error("Error fetching recalculation requests:", e);
|
|
182
|
-
} finally {
|
|
183
|
-
C.value = !1;
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
async function j() {
|
|
187
|
-
if (!s.value || !d.value) {
|
|
188
|
-
_.value = [];
|
|
189
|
-
return;
|
|
190
|
-
}
|
|
191
|
-
w.value = !0;
|
|
192
|
-
try {
|
|
193
|
-
const e = await h.recalculation.getAffectedClosingDrafts(
|
|
194
|
-
s.value,
|
|
195
|
-
d.value
|
|
196
|
-
);
|
|
197
|
-
_.value = e;
|
|
198
|
-
} catch {
|
|
199
|
-
p.open({
|
|
200
|
-
title: o("common.error"),
|
|
201
|
-
message: "Failed to fetch affected closing drafts",
|
|
202
|
-
type: "error"
|
|
203
|
-
}), _.value = [];
|
|
204
|
-
} finally {
|
|
205
|
-
w.value = !1;
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
me(
|
|
209
|
-
[s, d],
|
|
210
|
-
() => {
|
|
211
|
-
s.value && d.value && !O.value ? j() : _.value = [];
|
|
212
|
-
},
|
|
213
|
-
{ immediate: !1 }
|
|
214
|
-
);
|
|
215
|
-
async function oe() {
|
|
216
|
-
if (N.value) {
|
|
217
|
-
l.value = !0;
|
|
218
|
-
try {
|
|
219
|
-
if (await h.recalculation.scheduleRecalculation({
|
|
220
|
-
openingId: s.value,
|
|
221
|
-
untilDate: d.value
|
|
222
|
-
}), _.value.length > 0) {
|
|
223
|
-
const e = _.value.map((a) => a._id);
|
|
224
|
-
await h.recalculation.scheduleInvalidateClosingDraftCache(e);
|
|
225
|
-
}
|
|
226
|
-
p.open({
|
|
227
|
-
title: o("common.success"),
|
|
228
|
-
message: "Stock recalculation has been scheduled successfully",
|
|
229
|
-
type: "success"
|
|
230
|
-
}), await K(), u.value = !1, L("submitted");
|
|
231
|
-
} catch (e) {
|
|
232
|
-
console.error("Error scheduling recalculation:", e), p.open({
|
|
233
|
-
title: o("common.error"),
|
|
234
|
-
message: "Failed to schedule stock recalculation",
|
|
235
|
-
type: "error"
|
|
236
|
-
});
|
|
237
|
-
} finally {
|
|
238
|
-
l.value = !1;
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
return (e, a) => {
|
|
243
|
-
const F = $("FmButton"), m = $("FmSelect"), f = $("FmRadio"), R = $("FmDatePicker"), E = $("FmAlert"), ae = $("FmDialog");
|
|
244
|
-
return c(), y("div", null, [
|
|
245
|
-
e.showButton ? (c(), H(F, {
|
|
246
|
-
key: 0,
|
|
247
|
-
"prepend-icon": "info",
|
|
248
|
-
variant: "tertiary",
|
|
249
|
-
onClick: fe(Q, ["stop"])
|
|
250
|
-
})) : k("", !0),
|
|
251
|
-
b(ae, {
|
|
252
|
-
modelValue: u.value,
|
|
253
|
-
"onUpdate:modelValue": a[7] || (a[7] = (t) => u.value = t),
|
|
254
|
-
"close-button": "",
|
|
255
|
-
dismissAway: "",
|
|
256
|
-
"max-width": "600px"
|
|
257
|
-
}, {
|
|
258
|
-
"dialog-header": I(() => [
|
|
259
|
-
n("div", we, i(r(o)("inventory.stock.recalculation.title")), 1)
|
|
260
|
-
]),
|
|
261
|
-
"dialog-footer": I(() => [
|
|
262
|
-
W.value ? (c(), y("div", et, [
|
|
263
|
-
b(F, {
|
|
264
|
-
variant: "tertiary",
|
|
265
|
-
onClick: a[6] || (a[6] = (t) => u.value = !1),
|
|
266
|
-
label: r(o)("common.close")
|
|
267
|
-
}, null, 8, ["label"])
|
|
268
|
-
])) : (c(), y("div", qe, [
|
|
269
|
-
b(F, {
|
|
270
|
-
variant: "tertiary",
|
|
271
|
-
onClick: a[5] || (a[5] = (t) => u.value = !1),
|
|
272
|
-
disabled: l.value,
|
|
273
|
-
label: r(o)("common.cancel")
|
|
274
|
-
}, null, 8, ["disabled", "label"]),
|
|
275
|
-
b(F, {
|
|
276
|
-
variant: "primary",
|
|
277
|
-
onClick: oe,
|
|
278
|
-
disabled: !N.value || l.value,
|
|
279
|
-
loading: l.value,
|
|
280
|
-
label: r(o)("inventory.stock.recalculation.schedule")
|
|
281
|
-
}, null, 8, ["disabled", "loading", "label"])
|
|
282
|
-
]))
|
|
283
|
-
]),
|
|
284
|
-
default: I(() => [
|
|
285
|
-
n("div", $e, [
|
|
286
|
-
n("div", Ce, i(r(o)("inventory.stock.recalculation.description")), 1),
|
|
287
|
-
W.value ? k("", !0) : (c(), y(z, { key: 0 }, [
|
|
288
|
-
n("div", Ve, [
|
|
289
|
-
n("p", Ae, [
|
|
290
|
-
Z(i(r(o)("inventory.stock.recalculation.openingDate")) + " ", 1),
|
|
291
|
-
a[8] || (a[8] = n("span", { class: "text-fm-color-system-error-300" }, "*", -1))
|
|
292
|
-
]),
|
|
293
|
-
a[9] || (a[9] = n("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)),
|
|
294
|
-
b(m, {
|
|
295
|
-
modelValue: s.value,
|
|
296
|
-
"onUpdate:modelValue": a[0] || (a[0] = (t) => s.value = t),
|
|
297
|
-
items: J.value,
|
|
298
|
-
placeholder: r(o)("inventory.stock.recalculation.selectOpening"),
|
|
299
|
-
loading: l.value,
|
|
300
|
-
disabled: l.value
|
|
301
|
-
}, null, 8, ["modelValue", "items", "placeholder", "loading", "disabled"])
|
|
302
|
-
]),
|
|
303
|
-
n("div", Fe, [
|
|
304
|
-
n("p", Te, [
|
|
305
|
-
Z(i(r(o)("inventory.stock.recalculation.untilDate")) + " ", 1),
|
|
306
|
-
a[10] || (a[10] = n("span", { class: "text-fm-color-system-error-300" }, "*", -1))
|
|
307
|
-
]),
|
|
308
|
-
n("div", Re, [
|
|
309
|
-
b(f, {
|
|
310
|
-
modelValue: T.value,
|
|
311
|
-
"onUpdate:modelValue": a[1] || (a[1] = (t) => T.value = t),
|
|
312
|
-
value: !1,
|
|
313
|
-
label: r(o)("inventory.stock.recalculation.selectByDate")
|
|
314
|
-
}, null, 8, ["modelValue", "label"]),
|
|
315
|
-
b(f, {
|
|
316
|
-
modelValue: T.value,
|
|
317
|
-
"onUpdate:modelValue": a[2] || (a[2] = (t) => T.value = t),
|
|
318
|
-
value: !0,
|
|
319
|
-
label: r(o)("inventory.stock.recalculation.selectByClosing")
|
|
320
|
-
}, null, 8, ["modelValue", "label"])
|
|
321
|
-
]),
|
|
322
|
-
T.value ? (c(), H(m, {
|
|
323
|
-
key: 1,
|
|
324
|
-
modelValue: U.value,
|
|
325
|
-
"onUpdate:modelValue": a[4] || (a[4] = (t) => U.value = t),
|
|
326
|
-
items: G.value,
|
|
327
|
-
placeholder: r(o)("inventory.stock.recalculation.selectClosing"),
|
|
328
|
-
loading: l.value,
|
|
329
|
-
disabled: !s.value || l.value
|
|
330
|
-
}, null, 8, ["modelValue", "items", "placeholder", "loading", "disabled"])) : (c(), H(R, {
|
|
331
|
-
key: 0,
|
|
332
|
-
modelValue: d.value,
|
|
333
|
-
"onUpdate:modelValue": a[3] || (a[3] = (t) => d.value = t),
|
|
334
|
-
placeholder: r(o)("inventory.stock.recalculation.selectDate"),
|
|
335
|
-
min: q.value,
|
|
336
|
-
disabled: !s.value || l.value
|
|
337
|
-
}, null, 8, ["modelValue", "placeholder", "min", "disabled"])),
|
|
338
|
-
O.value ? (c(), y("div", Be, i(O.value), 1)) : k("", !0)
|
|
339
|
-
]),
|
|
340
|
-
s.value && d.value && !O.value ? (c(), H(E, {
|
|
341
|
-
key: 0,
|
|
342
|
-
type: "info"
|
|
343
|
-
}, {
|
|
344
|
-
default: I(() => [
|
|
345
|
-
n("div", Ie, i(r(o)("inventory.stock.recalculation.info")), 1)
|
|
346
|
-
]),
|
|
347
|
-
_: 1
|
|
348
|
-
})) : k("", !0),
|
|
349
|
-
_.value.length > 0 ? (c(), y("div", Le, [
|
|
350
|
-
w.value ? (c(), y("div", Oe, " Loading affected closing drafts... ")) : (c(), y("div", Ee, [
|
|
351
|
-
n("div", Me, " Affected closing draft(s): " + i(_.value.length), 1),
|
|
352
|
-
n("div", Pe, [
|
|
353
|
-
(c(!0), y(z, null, ne(_.value, (t) => (c(), y("div", {
|
|
354
|
-
key: t._id,
|
|
355
|
-
class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
|
|
356
|
-
}, [
|
|
357
|
-
Z(" • " + i(t._id) + " ", 1),
|
|
358
|
-
t.effectiveAt ? (c(), y("span", Ue, " (" + i(new Date(t.effectiveAt).toLocaleString()) + ") ", 1)) : k("", !0)
|
|
359
|
-
]))), 128))
|
|
360
|
-
])
|
|
361
|
-
]))
|
|
362
|
-
])) : k("", !0)
|
|
363
|
-
], 64)),
|
|
364
|
-
S.value.length > 0 ? (c(), y("div", Ne, [
|
|
365
|
-
n("p", Ke, i(r(o)("inventory.stock.recalculation.recentRequests")), 1),
|
|
366
|
-
n("div", He, [
|
|
367
|
-
(c(!0), y(z, null, ne(S.value, (t) => {
|
|
368
|
-
var Y;
|
|
369
|
-
return c(), y("div", {
|
|
370
|
-
key: t._id,
|
|
371
|
-
class: "p-12 border border-fm-color-border-primary rounded-8 flex flex-col gap-4"
|
|
372
|
-
}, [
|
|
373
|
-
n("div", je, [
|
|
374
|
-
n("div", ze, i(r(o)("inventory.stock.recalculation.requestedAt")) + ": " + i(new Date(t.createdAt).toLocaleString()), 1),
|
|
375
|
-
n("div", Je, [
|
|
376
|
-
(Y = t.meta) != null && Y.openingType ? (c(), y("div", We, i(t.meta.openingType === "stockSnapshot" ? "Snapshot" : "Closing"), 1)) : k("", !0),
|
|
377
|
-
n("div", {
|
|
378
|
-
class: pe(["fm-typo-en-body-xs-600 px-8 py-4 rounded-4", {
|
|
379
|
-
"bg-fm-color-system-error-100 text-fm-color-system-error-500": t.failedReason,
|
|
380
|
-
"bg-fm-color-system-success-100 text-fm-color-system-success-500": t.completedAt,
|
|
381
|
-
"bg-fm-color-system-info-100 text-fm-color-system-info-500": !t.failedReason && !t.completedAt
|
|
382
|
-
}])
|
|
383
|
-
}, i(t.failedReason ? r(o)("inventory.stock.recalculation.status.failed") : t.completedAt ? r(o)("inventory.stock.recalculation.status.completed") : r(o)("inventory.stock.recalculation.status.inProgress")), 3)
|
|
384
|
-
])
|
|
385
|
-
]),
|
|
386
|
-
n("div", Ye, i(r(o)("inventory.stock.recalculation.from")) + ": " + i(new Date(t.recalculateStartDate).toLocaleDateString()), 1),
|
|
387
|
-
n("div", Ge, i(r(o)("inventory.stock.recalculation.to")) + ": " + i(new Date(t.recalculateEndDate).toLocaleDateString()), 1),
|
|
388
|
-
t.createdBy ? (c(), y("div", Qe, i(r(o)("inventory.stock.recalculation.requestedBy")) + ": " + i(t.createdBy.name || t.createdBy.id), 1)) : k("", !0),
|
|
389
|
-
t.completedAt ? (c(), y("div", Xe, i(r(o)("inventory.stock.recalculation.completedAt")) + ": " + i(new Date(t.completedAt).toLocaleString()), 1)) : k("", !0),
|
|
390
|
-
t.failedReason ? (c(), y("div", Ze, i(t.failedReason), 1)) : k("", !0)
|
|
391
|
-
]);
|
|
392
|
-
}), 128))
|
|
393
|
-
])
|
|
394
|
-
])) : k("", !0)
|
|
395
|
-
])
|
|
396
|
-
]),
|
|
397
|
-
_: 1
|
|
398
|
-
}, 8, ["modelValue"])
|
|
399
|
-
]);
|
|
400
|
-
};
|
|
401
|
-
}
|
|
402
|
-
}), ot = { class: "fm-typo-en-heading-lg-600" }, at = { class: "flex flex-col gap-16" }, nt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, lt = { 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 = {
|
|
403
|
-
key: 0,
|
|
404
|
-
class: "text-red-500 text-sm mt-2"
|
|
405
|
-
}, dt = { class: "fm-typo-en-body-sm-400" }, ut = {
|
|
406
|
-
key: 1,
|
|
407
|
-
class: "p-12 border border-fm-color-border-primary rounded-8 bg-fm-color-background-secondary"
|
|
408
|
-
}, mt = {
|
|
409
|
-
key: 0,
|
|
410
|
-
class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
|
|
411
|
-
}, ft = {
|
|
412
|
-
key: 1,
|
|
413
|
-
class: "flex flex-col gap-8"
|
|
414
|
-
}, pt = { class: "fm-typo-en-body-sm-600" }, yt = { class: "flex flex-col gap-4" }, vt = { key: 0 }, gt = {
|
|
415
|
-
key: 1,
|
|
416
|
-
class: "flex flex-col gap-8"
|
|
417
|
-
}, ht = { class: "fm-typo-en-body-md-600" }, bt = { class: "flex flex-col gap-8 max-h-[300px] overflow-y-auto" }, _t = { class: "flex items-center justify-between" }, kt = { class: "fm-typo-en-body-sm-600" }, xt = { class: "flex items-center gap-8" }, Dt = {
|
|
418
|
-
key: 0,
|
|
419
|
-
class: "fm-typo-en-body-xs-600 px-8 py-4 rounded-4 bg-fm-color-neutral-100 text-fm-color-typo-secondary"
|
|
420
|
-
}, St = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, wt = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, $t = {
|
|
421
|
-
key: 0,
|
|
422
|
-
class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
|
|
423
|
-
}, Ct = {
|
|
424
|
-
key: 1,
|
|
425
|
-
class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
|
|
426
|
-
}, Vt = {
|
|
427
|
-
key: 2,
|
|
428
|
-
class: "fm-typo-en-body-xs-400 text-fm-color-system-error-500"
|
|
429
|
-
}, At = {
|
|
430
|
-
key: 0,
|
|
431
|
-
class: "flex gap-8 ml-auto"
|
|
432
|
-
}, Ft = {
|
|
433
|
-
key: 1,
|
|
434
|
-
class: "flex gap-8 ml-auto"
|
|
435
|
-
}, Tt = /* @__PURE__ */ le({
|
|
436
|
-
__name: "SnapshotRecalculationDialog",
|
|
437
|
-
props: {
|
|
438
|
-
showButton: { type: Boolean }
|
|
439
|
-
},
|
|
440
|
-
emits: ["submitted"],
|
|
441
|
-
setup(B, { expose: x, emit: D }) {
|
|
442
|
-
const L = D, { t: o } = se(), h = ye(), A = ce(), p = re(), u = g(!1), s = g(""), d = g(""), T = g([]), v = g([]), l = g(!1), S = g([]), C = g(!1), _ = g([]), w = g(!1), J = V(
|
|
443
|
-
() => ve(T.value, v.value)
|
|
444
|
-
), G = V(() => {
|
|
445
|
-
if (s.value)
|
|
446
|
-
try {
|
|
447
|
-
const e = P(s.value);
|
|
448
|
-
if (e)
|
|
449
|
-
return e;
|
|
450
|
-
} catch (e) {
|
|
451
|
-
console.error("Error parsing date from opening ID:", e);
|
|
452
|
-
}
|
|
453
|
-
}), U = V(() => {
|
|
454
|
-
if (!s.value || !d.value) return "";
|
|
455
|
-
const e = P(s.value);
|
|
456
|
-
if (e && d.value) {
|
|
457
|
-
const a = new Date(e).getTime();
|
|
458
|
-
if (new Date(d.value).getTime() <= a)
|
|
459
|
-
return o("inventory.stock.recalculation.error.endDateBeforeOpening");
|
|
460
|
-
}
|
|
461
|
-
return "";
|
|
462
|
-
}), q = V(() => {
|
|
463
|
-
if (!d.value) return !1;
|
|
464
|
-
const e = new Date(d.value), a = /* @__PURE__ */ new Date();
|
|
465
|
-
return a.setHours(0, 0, 0, 0), e.setHours(0, 0, 0, 0), e >= a;
|
|
466
|
-
}), O = V(() => !!s.value && !!d.value && !U.value), N = V(() => S.value.some(
|
|
467
|
-
(e) => !e.completedAt && !e.failedReason
|
|
468
|
-
));
|
|
469
|
-
async function W() {
|
|
470
|
-
u.value = !0, await Promise.all([ee(), te(), K()]), s.value = "", d.value = "";
|
|
471
|
-
}
|
|
472
|
-
function Q() {
|
|
473
|
-
u.value = !1;
|
|
474
|
-
}
|
|
475
|
-
x({
|
|
476
|
-
open: W,
|
|
477
|
-
close: Q
|
|
478
|
-
});
|
|
479
|
-
async function ee() {
|
|
480
|
-
l.value = !0;
|
|
481
|
-
try {
|
|
482
|
-
const e = await A.getLastNClosings(30);
|
|
483
|
-
T.value = e;
|
|
484
|
-
} catch (e) {
|
|
485
|
-
console.error("Error fetching recent closings:", e), p.open({
|
|
486
|
-
title: o("common.error"),
|
|
487
|
-
message: "Failed to fetch recent closings",
|
|
488
|
-
type: "error"
|
|
489
|
-
});
|
|
490
|
-
} finally {
|
|
491
|
-
l.value = !1;
|
|
492
|
-
}
|
|
493
|
-
}
|
|
494
|
-
async function te() {
|
|
495
|
-
try {
|
|
496
|
-
const e = await A.getLastNStockSnapshots(30);
|
|
497
|
-
v.value = e;
|
|
498
|
-
} catch (e) {
|
|
499
|
-
console.error("Error fetching recent snapshots:", e);
|
|
500
|
-
}
|
|
501
|
-
}
|
|
502
|
-
async function K() {
|
|
503
|
-
C.value = !0;
|
|
504
|
-
try {
|
|
505
|
-
const e = await h.recalculation.recalculationRequests();
|
|
506
|
-
S.value = e;
|
|
507
|
-
} catch (e) {
|
|
508
|
-
console.error("Error fetching recalculation requests:", e);
|
|
509
|
-
} finally {
|
|
510
|
-
C.value = !1;
|
|
511
|
-
}
|
|
512
|
-
}
|
|
513
|
-
async function j() {
|
|
514
|
-
if (!s.value || !d.value) {
|
|
515
|
-
_.value = [];
|
|
516
|
-
return;
|
|
517
|
-
}
|
|
518
|
-
w.value = !0;
|
|
519
|
-
try {
|
|
520
|
-
const e = new Date(d.value);
|
|
521
|
-
e.setHours(23, 59, 59, 999);
|
|
522
|
-
const a = await h.recalculation.getAffectedClosingDrafts(
|
|
523
|
-
s.value,
|
|
524
|
-
e.toISOString()
|
|
525
|
-
);
|
|
526
|
-
_.value = a;
|
|
527
|
-
} catch {
|
|
528
|
-
p.open({
|
|
529
|
-
title: o("common.error"),
|
|
530
|
-
message: "Failed to fetch affected closing drafts",
|
|
531
|
-
type: "error"
|
|
532
|
-
}), _.value = [];
|
|
533
|
-
} finally {
|
|
534
|
-
w.value = !1;
|
|
535
|
-
}
|
|
536
|
-
}
|
|
537
|
-
me(
|
|
538
|
-
[s, d],
|
|
539
|
-
() => {
|
|
540
|
-
s.value && d.value && !U.value ? j() : _.value = [];
|
|
541
|
-
},
|
|
542
|
-
{ immediate: !1 }
|
|
543
|
-
);
|
|
544
|
-
async function oe() {
|
|
545
|
-
if (!(!O.value || !d.value)) {
|
|
546
|
-
l.value = !0;
|
|
547
|
-
try {
|
|
548
|
-
if (await h.recalculation.scheduleRecalculation({
|
|
549
|
-
openingId: s.value,
|
|
550
|
-
untilDate: new Date(d.value).toISOString(),
|
|
551
|
-
recalculateBySnapshot: !0
|
|
552
|
-
}), _.value.length > 0) {
|
|
553
|
-
const e = _.value.map((a) => a._id);
|
|
554
|
-
await h.recalculation.scheduleInvalidateClosingDraftCache(e);
|
|
555
|
-
}
|
|
556
|
-
p.open({
|
|
557
|
-
title: o("common.success"),
|
|
558
|
-
message: "Stock recalculation has been scheduled successfully",
|
|
559
|
-
type: "success"
|
|
560
|
-
}), await K(), u.value = !1, L("submitted");
|
|
561
|
-
} catch (e) {
|
|
562
|
-
console.error("Error scheduling recalculation:", e), p.open({
|
|
563
|
-
title: o("common.error"),
|
|
564
|
-
message: "Failed to schedule stock recalculation",
|
|
565
|
-
type: "error"
|
|
566
|
-
});
|
|
567
|
-
} finally {
|
|
568
|
-
l.value = !1;
|
|
569
|
-
}
|
|
570
|
-
}
|
|
571
|
-
}
|
|
572
|
-
return (e, a) => {
|
|
573
|
-
const F = $("FmButton"), m = $("FmSelect"), f = $("FmDatePicker"), R = $("FmSnackbar"), E = $("FmAlert"), ae = $("FmDialog");
|
|
574
|
-
return c(), y("div", null, [
|
|
575
|
-
e.showButton ? (c(), H(F, {
|
|
576
|
-
key: 0,
|
|
577
|
-
"prepend-icon": "info",
|
|
578
|
-
variant: "tertiary",
|
|
579
|
-
onClick: fe(W, ["stop"])
|
|
580
|
-
})) : k("", !0),
|
|
581
|
-
b(ae, {
|
|
582
|
-
modelValue: u.value,
|
|
583
|
-
"onUpdate:modelValue": a[4] || (a[4] = (t) => u.value = t),
|
|
584
|
-
"close-button": "",
|
|
585
|
-
dismissAway: "",
|
|
586
|
-
"max-width": "600px"
|
|
587
|
-
}, {
|
|
588
|
-
"dialog-header": I(() => [
|
|
589
|
-
n("div", ot, i(r(o)("inventory.stock.recalculation.title")), 1)
|
|
590
|
-
]),
|
|
591
|
-
"dialog-footer": I(() => [
|
|
592
|
-
N.value ? (c(), y("div", Ft, [
|
|
593
|
-
b(F, {
|
|
594
|
-
variant: "tertiary",
|
|
595
|
-
onClick: a[3] || (a[3] = (t) => u.value = !1),
|
|
596
|
-
label: r(o)("common.close")
|
|
597
|
-
}, null, 8, ["label"])
|
|
598
|
-
])) : (c(), y("div", At, [
|
|
599
|
-
b(F, {
|
|
600
|
-
variant: "tertiary",
|
|
601
|
-
onClick: a[2] || (a[2] = (t) => u.value = !1),
|
|
602
|
-
disabled: l.value,
|
|
603
|
-
label: r(o)("common.cancel")
|
|
604
|
-
}, null, 8, ["disabled", "label"]),
|
|
605
|
-
b(F, {
|
|
606
|
-
variant: "primary",
|
|
607
|
-
onClick: oe,
|
|
608
|
-
disabled: !O.value || l.value,
|
|
609
|
-
loading: l.value,
|
|
610
|
-
label: r(o)("inventory.stock.recalculation.schedule")
|
|
611
|
-
}, null, 8, ["disabled", "loading", "label"])
|
|
612
|
-
]))
|
|
613
|
-
]),
|
|
614
|
-
default: I(() => [
|
|
615
|
-
n("div", at, [
|
|
616
|
-
n("div", nt, i(r(o)("inventory.stock.recalculation.description")), 1),
|
|
617
|
-
N.value ? k("", !0) : (c(), y(z, { key: 0 }, [
|
|
618
|
-
n("div", lt, [
|
|
619
|
-
n("p", st, [
|
|
620
|
-
Z(i(r(o)("inventory.stock.recalculation.openingDate")) + " ", 1),
|
|
621
|
-
a[5] || (a[5] = n("span", { class: "text-fm-color-system-error-300" }, "*", -1))
|
|
622
|
-
]),
|
|
623
|
-
a[6] || (a[6] = n("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)),
|
|
624
|
-
b(m, {
|
|
625
|
-
modelValue: s.value,
|
|
626
|
-
"onUpdate:modelValue": a[0] || (a[0] = (t) => s.value = t),
|
|
627
|
-
items: J.value,
|
|
628
|
-
placeholder: r(o)("inventory.stock.recalculation.selectOpening"),
|
|
629
|
-
loading: l.value,
|
|
630
|
-
disabled: l.value
|
|
631
|
-
}, null, 8, ["modelValue", "items", "placeholder", "loading", "disabled"])
|
|
632
|
-
]),
|
|
633
|
-
n("div", it, [
|
|
634
|
-
n("p", ct, [
|
|
635
|
-
Z(i(r(o)("inventory.stock.recalculation.untilDate")) + " ", 1),
|
|
636
|
-
a[7] || (a[7] = n("span", { class: "text-fm-color-system-error-300" }, "*", -1))
|
|
637
|
-
]),
|
|
638
|
-
a[8] || (a[8] = n("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)),
|
|
639
|
-
b(f, {
|
|
640
|
-
modelValue: d.value,
|
|
641
|
-
"onUpdate:modelValue": a[1] || (a[1] = (t) => d.value = t),
|
|
642
|
-
placeholder: r(o)("inventory.stock.recalculation.selectDate"),
|
|
643
|
-
min: G.value,
|
|
644
|
-
disabled: !s.value || l.value
|
|
645
|
-
}, null, 8, ["modelValue", "placeholder", "min", "disabled"]),
|
|
646
|
-
U.value ? (c(), y("div", rt, i(U.value), 1)) : k("", !0),
|
|
647
|
-
q.value ? (c(), H(R, {
|
|
648
|
-
key: 1,
|
|
649
|
-
title: "Warning",
|
|
650
|
-
variant: "warning",
|
|
651
|
-
description: "You have selected today or a future date. The stock balance will be refreshed accordingly."
|
|
652
|
-
})) : k("", !0)
|
|
653
|
-
]),
|
|
654
|
-
s.value && d.value && !U.value ? (c(), H(E, {
|
|
655
|
-
key: 0,
|
|
656
|
-
type: "info"
|
|
657
|
-
}, {
|
|
658
|
-
default: I(() => [
|
|
659
|
-
n("div", dt, i(r(o)("inventory.stock.recalculation.info")), 1)
|
|
660
|
-
]),
|
|
661
|
-
_: 1
|
|
662
|
-
})) : k("", !0),
|
|
663
|
-
_.value.length > 0 ? (c(), y("div", ut, [
|
|
664
|
-
w.value ? (c(), y("div", mt, " Loading affected closing drafts... ")) : (c(), y("div", ft, [
|
|
665
|
-
n("div", pt, " Affected closing draft(s): " + i(_.value.length), 1),
|
|
666
|
-
n("div", yt, [
|
|
667
|
-
(c(!0), y(z, null, ne(_.value, (t) => (c(), y("div", {
|
|
668
|
-
key: t._id,
|
|
669
|
-
class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
|
|
670
|
-
}, [
|
|
671
|
-
Z(" • " + i(t._id) + " ", 1),
|
|
672
|
-
t.effectiveAt ? (c(), y("span", vt, " (" + i(new Date(t.effectiveAt).toLocaleString()) + ") ", 1)) : k("", !0)
|
|
673
|
-
]))), 128))
|
|
674
|
-
])
|
|
675
|
-
]))
|
|
676
|
-
])) : k("", !0)
|
|
677
|
-
], 64)),
|
|
678
|
-
S.value.length > 0 ? (c(), y("div", gt, [
|
|
679
|
-
n("p", ht, i(r(o)("inventory.stock.recalculation.recentRequests")), 1),
|
|
680
|
-
n("div", bt, [
|
|
681
|
-
(c(!0), y(z, null, ne(S.value, (t) => {
|
|
682
|
-
var Y;
|
|
683
|
-
return c(), y("div", {
|
|
684
|
-
key: t._id,
|
|
685
|
-
class: "p-12 border border-fm-color-border-primary rounded-8 flex flex-col gap-4"
|
|
686
|
-
}, [
|
|
687
|
-
n("div", _t, [
|
|
688
|
-
n("div", kt, i(r(o)("inventory.stock.recalculation.requestedAt")) + ": " + i(new Date(t.createdAt).toLocaleString()), 1),
|
|
689
|
-
n("div", xt, [
|
|
690
|
-
(Y = t.meta) != null && Y.openingType ? (c(), y("div", Dt, i(t.meta.openingType === "stockSnapshot" ? "Snapshot" : "Closing"), 1)) : k("", !0),
|
|
691
|
-
n("div", {
|
|
692
|
-
class: pe(["fm-typo-en-body-xs-600 px-8 py-4 rounded-4", {
|
|
693
|
-
"bg-fm-color-system-error-100 text-fm-color-system-error-500": t.failedReason,
|
|
694
|
-
"bg-fm-color-system-success-100 text-fm-color-system-success-500": t.completedAt,
|
|
695
|
-
"bg-fm-color-system-info-100 text-fm-color-system-info-500": !t.failedReason && !t.completedAt
|
|
696
|
-
}])
|
|
697
|
-
}, i(t.failedReason ? r(o)("inventory.stock.recalculation.status.failed") : t.completedAt ? r(o)("inventory.stock.recalculation.status.completed") : r(o)("inventory.stock.recalculation.status.inProgress")), 3)
|
|
698
|
-
])
|
|
699
|
-
]),
|
|
700
|
-
n("div", St, i(r(o)("inventory.stock.recalculation.from")) + ": " + i(new Date(t.recalculateStartDate).toLocaleDateString()), 1),
|
|
701
|
-
n("div", wt, i(r(o)("inventory.stock.recalculation.to")) + ": " + i(new Date(t.recalculateEndDate).toLocaleDateString()), 1),
|
|
702
|
-
t.createdBy ? (c(), y("div", $t, i(r(o)("inventory.stock.recalculation.requestedBy")) + ": " + i(t.createdBy.name || t.createdBy.id), 1)) : k("", !0),
|
|
703
|
-
t.completedAt ? (c(), y("div", Ct, i(r(o)("inventory.stock.recalculation.completedAt")) + ": " + i(new Date(t.completedAt).toLocaleString()), 1)) : k("", !0),
|
|
704
|
-
t.failedReason ? (c(), y("div", Vt, i(t.failedReason), 1)) : k("", !0)
|
|
705
|
-
]);
|
|
706
|
-
}), 128))
|
|
707
|
-
])
|
|
708
|
-
])) : k("", !0)
|
|
709
|
-
])
|
|
710
|
-
]),
|
|
711
|
-
_: 1
|
|
712
|
-
}, 8, ["modelValue"])
|
|
713
|
-
]);
|
|
714
|
-
};
|
|
715
|
-
}
|
|
716
|
-
}), Rt = { class: "fm-typo-en-heading-lg-600" }, Bt = { class: "flex flex-col gap-16" }, It = { class: "flex flex-col gap-4" }, Lt = { class: "fm-typo-en-label-md-400 text-fm-color-typo-secondary" }, Ot = { class: "fm-typo-en-body-md-400" }, Et = { class: "flex flex-col gap-4" }, Mt = { class: "fm-typo-en-label-md-400 text-fm-color-typo-secondary" }, Pt = { class: "fm-typo-en-body-md-400" }, Ut = { class: "flex flex-col gap-4" }, Nt = { class: "fm-typo-en-label-md-400 text-fm-color-typo-secondary" }, Kt = { class: "flex gap-8 ml-auto" }, Ht = /* @__PURE__ */ le({
|
|
717
|
-
__name: "ClosingDetailDialog",
|
|
718
|
-
props: {
|
|
719
|
-
modelValue: { type: Boolean },
|
|
720
|
-
type: {},
|
|
721
|
-
data: {}
|
|
722
|
-
},
|
|
723
|
-
emits: ["update:modelValue"],
|
|
724
|
-
setup(B, { emit: x }) {
|
|
725
|
-
const { t: D } = se(), L = _e(), o = B, h = x, A = V({
|
|
726
|
-
get: () => o.modelValue,
|
|
727
|
-
set: (v) => h("update:modelValue", v)
|
|
728
|
-
}), p = V(() => {
|
|
729
|
-
var v;
|
|
730
|
-
return ((v = o.data) == null ? void 0 : v.skus) ?? [];
|
|
731
|
-
}), u = V(() => {
|
|
732
|
-
var C;
|
|
733
|
-
const v = (C = o.data) == null ? void 0 : C._id;
|
|
734
|
-
if (!v) return "-";
|
|
735
|
-
const l = P(v);
|
|
736
|
-
return new Date(l).toLocaleString();
|
|
737
|
-
}), s = V(() => o.type === "closing" ? D("inventory.closing.history.closingDetail", "Closing Detail") : D("inventory.closing.history.snapshotDetail", "Snapshot Detail")), d = V(() => p.value.map((v) => {
|
|
738
|
-
const l = L.skuById[v.id] ?? null, S = !l;
|
|
739
|
-
return {
|
|
740
|
-
id: v.id,
|
|
741
|
-
sku: l,
|
|
742
|
-
skuName: (l == null ? void 0 : l.name) ?? v.id,
|
|
743
|
-
skuCode: (l == null ? void 0 : l.code) ?? "-",
|
|
744
|
-
balance: v.balance ?? { amount: 0, precision: 0 },
|
|
745
|
-
isMissing: S,
|
|
746
|
-
costs: v.costs,
|
|
747
|
-
weightedAverage: v.weightedAverage
|
|
748
|
-
};
|
|
749
|
-
})), T = [
|
|
750
|
-
{
|
|
751
|
-
accessorKey: "skuName",
|
|
752
|
-
header: () => D("inventory.ingredient.name", "Ingredient Name"),
|
|
753
|
-
cell: (v) => {
|
|
754
|
-
const l = v.row.original;
|
|
755
|
-
return l.isMissing ? X("div", { class: "flex items-center gap-8" }, [
|
|
756
|
-
X("span", {}, l.id),
|
|
757
|
-
X(
|
|
758
|
-
"span",
|
|
759
|
-
{
|
|
760
|
-
class: "px-8 py-2 rounded-4 bg-fm-color-danger-weak text-fm-color-danger-default fm-typo-en-label-sm-400"
|
|
761
|
-
},
|
|
762
|
-
"Missing"
|
|
763
|
-
)
|
|
764
|
-
]) : v.getValue();
|
|
765
|
-
}
|
|
766
|
-
},
|
|
767
|
-
{
|
|
768
|
-
accessorKey: "skuCode",
|
|
769
|
-
header: () => D("inventory.ingredient.code", "Code")
|
|
770
|
-
},
|
|
771
|
-
{
|
|
772
|
-
id: "balance",
|
|
773
|
-
header: () => D("inventory.closing.history.balance", "Balance"),
|
|
774
|
-
cell: (v) => {
|
|
775
|
-
var C;
|
|
776
|
-
const l = v.row.original;
|
|
777
|
-
if (l.isMissing || !((C = l.sku) != null && C.unit))
|
|
778
|
-
return `${l.balance.amount / Math.pow(10, l.balance.precision)}`;
|
|
779
|
-
const S = {
|
|
780
|
-
unit: l.sku.unit,
|
|
781
|
-
sku: l.sku,
|
|
782
|
-
amount: l.balance,
|
|
783
|
-
defaultTrackingMeasurement: l.sku.trackingMeasurement ?? void 0
|
|
784
|
-
};
|
|
785
|
-
return X(Se, S);
|
|
786
|
-
},
|
|
787
|
-
size: 180
|
|
788
|
-
},
|
|
789
|
-
{
|
|
790
|
-
accessorKey: "weightedAverage",
|
|
791
|
-
header: () => D("inventory.closing.history.weightedAvgCost", "Weighted Avg Cost"),
|
|
792
|
-
cell: (v) => {
|
|
793
|
-
const l = v.getValue();
|
|
794
|
-
if (!l) return "-";
|
|
795
|
-
const S = l.amount ?? 0, C = l.precision ?? 0, _ = l.currency ?? "", w = S / Math.pow(10, C);
|
|
796
|
-
return `${_} ${w.toFixed(2)}`;
|
|
797
|
-
}
|
|
798
|
-
}
|
|
799
|
-
];
|
|
800
|
-
return (v, l) => {
|
|
801
|
-
const S = $("FmTable"), C = $("FmButton"), _ = $("FmDialog");
|
|
802
|
-
return c(), H(_, {
|
|
803
|
-
modelValue: A.value,
|
|
804
|
-
"onUpdate:modelValue": l[1] || (l[1] = (w) => A.value = w),
|
|
805
|
-
"close-button": "",
|
|
806
|
-
dismissAway: "",
|
|
807
|
-
"max-width": "900px"
|
|
808
|
-
}, {
|
|
809
|
-
"dialog-header": I(() => [
|
|
810
|
-
n("div", Rt, i(s.value), 1)
|
|
811
|
-
]),
|
|
812
|
-
default: I(() => {
|
|
813
|
-
var w;
|
|
814
|
-
return [
|
|
815
|
-
n("div", Bt, [
|
|
816
|
-
n("div", It, [
|
|
817
|
-
n("div", Lt, i(o.type === "closing" ? r(D)("inventory.closing.history.closingId") : r(D)("inventory.closing.history.snapshotId", "Snapshot ID")), 1),
|
|
818
|
-
n("div", Ot, i(((w = o.data) == null ? void 0 : w._id) ?? "-"), 1)
|
|
819
|
-
]),
|
|
820
|
-
n("div", Et, [
|
|
821
|
-
n("div", Mt, i(r(D)("inventory.closing.history.date")), 1),
|
|
822
|
-
n("div", Pt, i(u.value), 1)
|
|
823
|
-
]),
|
|
824
|
-
n("div", Ut, [
|
|
825
|
-
n("div", Nt, i(r(D)("inventory.closing.history.ingredientBalances", "Ingredient Balances")) + " (" + i(p.value.length) + ") ", 1),
|
|
826
|
-
b(S, {
|
|
827
|
-
"row-data": d.value,
|
|
828
|
-
"column-defs": T,
|
|
829
|
-
pagination: { pageSize: 10 }
|
|
830
|
-
}, null, 8, ["row-data"])
|
|
831
|
-
])
|
|
832
|
-
])
|
|
833
|
-
];
|
|
834
|
-
}),
|
|
835
|
-
"dialog-footer": I(() => [
|
|
836
|
-
n("div", Kt, [
|
|
837
|
-
b(C, {
|
|
838
|
-
variant: "tertiary",
|
|
839
|
-
onClick: l[0] || (l[0] = (w) => A.value = !1),
|
|
840
|
-
label: "Close"
|
|
841
|
-
})
|
|
842
|
-
])
|
|
843
|
-
]),
|
|
844
|
-
_: 1
|
|
845
|
-
}, 8, ["modelValue"]);
|
|
846
|
-
};
|
|
847
|
-
}
|
|
848
|
-
}), jt = { class: "flex flex-col gap-16 p-16" }, zt = { class: "flex flex-col gap-16" }, Jt = { class: "flex gap-8 ml-auto" }, oo = /* @__PURE__ */ le({
|
|
849
|
-
__name: "ClosingHistoryView",
|
|
850
|
-
setup(B) {
|
|
851
|
-
var a, F;
|
|
852
|
-
const { t: x } = se(), D = ce(), L = ke(), o = be(), h = De(), A = re(), p = g("closings"), u = [
|
|
853
|
-
{ label: "Closings", value: "closings" },
|
|
854
|
-
{ label: "Snapshots", value: "snapshots" }
|
|
855
|
-
], s = g([]), d = g(!1), T = g([]), v = g(!1), l = g(!1), S = g("closing"), C = g(null), _ = new Date(Date.now() - 864e5), w = g(_.toISOString().split("T")[0]), J = V(() => {
|
|
856
|
-
const m = [];
|
|
857
|
-
return p.value === "closings" ? m.push(
|
|
858
|
-
{
|
|
859
|
-
label: x("inventory.stock.recalculation.title"),
|
|
860
|
-
value: "recalculation",
|
|
861
|
-
prependIcon: "history",
|
|
862
|
-
isAdminOnly: !0
|
|
863
|
-
},
|
|
864
|
-
{
|
|
865
|
-
label: x("inventory.closing.history.initiate_opening"),
|
|
866
|
-
value: "initiateOpening",
|
|
867
|
-
prependIcon: "add_box",
|
|
868
|
-
isAdminOnly: !0
|
|
869
|
-
},
|
|
870
|
-
{
|
|
871
|
-
label: "Refresh",
|
|
872
|
-
value: "refreshOpening",
|
|
873
|
-
prependIcon: "refresh"
|
|
874
|
-
}
|
|
875
|
-
) : m.push(
|
|
876
|
-
{
|
|
877
|
-
label: `${x("inventory.stock.recalculation.title")} (BETA)`,
|
|
878
|
-
value: "recalculation",
|
|
879
|
-
prependIcon: "history",
|
|
880
|
-
isAdminOnly: !0
|
|
881
|
-
},
|
|
882
|
-
{
|
|
883
|
-
label: `${x("inventory.closing.history.initiate_snapshot")} (BETA)`,
|
|
884
|
-
value: "initiateStockSnapshot",
|
|
885
|
-
prependIcon: "camera",
|
|
886
|
-
isAdminOnly: !0
|
|
887
|
-
},
|
|
888
|
-
{
|
|
889
|
-
label: "Refresh",
|
|
890
|
-
value: "refreshStockSnapshot",
|
|
891
|
-
prependIcon: "refresh"
|
|
892
|
-
}
|
|
893
|
-
), m;
|
|
894
|
-
}), G = g(), U = g();
|
|
895
|
-
function q(m) {
|
|
896
|
-
var f, R;
|
|
897
|
-
switch (m) {
|
|
898
|
-
case "recalculation":
|
|
899
|
-
return p.value === "closings" ? (f = G.value) == null ? void 0 : f.open() : (R = U.value) == null ? void 0 : R.open();
|
|
900
|
-
case "initiateOpening": {
|
|
901
|
-
h.open({
|
|
902
|
-
title: "Initiate Opening Balance",
|
|
903
|
-
message: "Initiate opening balance if no opening balance exists for the current location.",
|
|
904
|
-
primaryActions: { text: "Confirm", close: !0 }
|
|
905
|
-
}).onPrimary(async () => {
|
|
906
|
-
try {
|
|
907
|
-
await D.initiateClosing(), A.open({
|
|
908
|
-
message: "Opening balance initiated successfully.",
|
|
909
|
-
type: "success"
|
|
910
|
-
}), await K();
|
|
911
|
-
} catch (E) {
|
|
912
|
-
A.open({
|
|
913
|
-
message: E.message || "Failed to initiate opening balance. Please try again.",
|
|
914
|
-
type: "error"
|
|
915
|
-
});
|
|
916
|
-
}
|
|
917
|
-
});
|
|
918
|
-
break;
|
|
919
|
-
}
|
|
920
|
-
case "initiateStockSnapshot": {
|
|
921
|
-
const E = new Date(Date.now() - 864e5);
|
|
922
|
-
w.value = E.toISOString().split("T")[0], O.value = !0;
|
|
923
|
-
break;
|
|
924
|
-
}
|
|
925
|
-
case "refreshOpening": {
|
|
926
|
-
K();
|
|
927
|
-
break;
|
|
928
|
-
}
|
|
929
|
-
case "refreshStockSnapshot": {
|
|
930
|
-
j();
|
|
931
|
-
break;
|
|
932
|
-
}
|
|
933
|
-
}
|
|
934
|
-
}
|
|
935
|
-
const O = g(!1), N = g(!1), W = (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
|
|
936
|
-
async function Q() {
|
|
937
|
-
N.value = !0;
|
|
938
|
-
try {
|
|
939
|
-
const m = new Date(w.value).toISOString();
|
|
940
|
-
await D.initiateStockSnapshot(m), A.open({
|
|
941
|
-
message: "Stock snapshot created successfully.",
|
|
942
|
-
type: "success"
|
|
943
|
-
}), O.value = !1, await j();
|
|
944
|
-
} catch (m) {
|
|
945
|
-
A.open({
|
|
946
|
-
message: m.message || "Failed to create stock snapshot. Please try again.",
|
|
947
|
-
type: "error"
|
|
948
|
-
});
|
|
949
|
-
} finally {
|
|
950
|
-
N.value = !1;
|
|
951
|
-
}
|
|
952
|
-
}
|
|
953
|
-
const ee = [
|
|
954
|
-
...(a = o.sessionUser.value) != null && a.role.isAdmin ? [
|
|
955
|
-
{
|
|
956
|
-
accessorKey: "_id",
|
|
957
|
-
header: () => X(de, {}, () => `${x("inventory.closing.history.closingId")}`),
|
|
958
|
-
cell: (m) => m.getValue()
|
|
959
|
-
}
|
|
960
|
-
] : [],
|
|
961
|
-
{
|
|
962
|
-
accessorKey: "_id",
|
|
963
|
-
id: "date",
|
|
964
|
-
header: () => x("inventory.closing.history.date"),
|
|
965
|
-
cell: (m) => {
|
|
966
|
-
const f = m.getValue(), R = P(f);
|
|
967
|
-
return new Date(R).toLocaleDateString();
|
|
968
|
-
}
|
|
969
|
-
},
|
|
970
|
-
{
|
|
971
|
-
accessorKey: "_id",
|
|
972
|
-
id: "time",
|
|
973
|
-
header: () => x("inventory.closing.history.time"),
|
|
974
|
-
cell: (m) => {
|
|
975
|
-
const f = m.getValue(), R = P(f);
|
|
976
|
-
return new Date(R).toLocaleTimeString();
|
|
977
|
-
}
|
|
978
|
-
},
|
|
979
|
-
{
|
|
980
|
-
accessorKey: "ref",
|
|
981
|
-
header: () => x("inventory.closing.history.createdFrom"),
|
|
982
|
-
cell: (m) => m.getValue() || "-"
|
|
983
|
-
}
|
|
984
|
-
], te = [
|
|
985
|
-
...(F = o.sessionUser.value) != null && F.role.isAdmin ? [
|
|
986
|
-
{
|
|
987
|
-
accessorKey: "_id",
|
|
988
|
-
header: () => X(
|
|
989
|
-
de,
|
|
990
|
-
{},
|
|
991
|
-
() => `${x("inventory.closing.history.snapshotId", "Snapshot ID")}`
|
|
992
|
-
),
|
|
993
|
-
cell: (m) => m.getValue()
|
|
994
|
-
}
|
|
995
|
-
] : [],
|
|
996
|
-
{
|
|
997
|
-
accessorKey: "_id",
|
|
998
|
-
id: "date",
|
|
999
|
-
header: () => x("inventory.closing.history.date"),
|
|
1000
|
-
cell: (m) => {
|
|
1001
|
-
const f = m.getValue(), R = P(f);
|
|
1002
|
-
return new Date(R).toLocaleDateString();
|
|
1003
|
-
}
|
|
1004
|
-
},
|
|
1005
|
-
{
|
|
1006
|
-
accessorKey: "_id",
|
|
1007
|
-
id: "time",
|
|
1008
|
-
header: () => x("inventory.closing.history.time"),
|
|
1009
|
-
cell: (m) => {
|
|
1010
|
-
const f = m.getValue(), R = P(f);
|
|
1011
|
-
return new Date(R).toLocaleTimeString();
|
|
1012
|
-
}
|
|
1013
|
-
},
|
|
1014
|
-
{
|
|
1015
|
-
accessorKey: "remark",
|
|
1016
|
-
header: () => x("inventory.closing.history.createdFrom"),
|
|
1017
|
-
cell: (m) => m.getValue() || "-"
|
|
1018
|
-
}
|
|
1019
|
-
];
|
|
1020
|
-
async function K() {
|
|
1021
|
-
if (L.currentLocationDBName) {
|
|
1022
|
-
d.value = !0;
|
|
1023
|
-
try {
|
|
1024
|
-
const m = await D.getLastNClosings(30);
|
|
1025
|
-
s.value = m;
|
|
1026
|
-
} catch (m) {
|
|
1027
|
-
console.error("Error fetching closings:", m), s.value = [];
|
|
1028
|
-
} finally {
|
|
1029
|
-
d.value = !1;
|
|
1030
|
-
}
|
|
1031
|
-
}
|
|
1032
|
-
}
|
|
1033
|
-
async function j() {
|
|
1034
|
-
if (L.currentLocationDBName) {
|
|
1035
|
-
v.value = !0;
|
|
1036
|
-
try {
|
|
1037
|
-
const m = await D.getLastNStockSnapshots(30);
|
|
1038
|
-
T.value = m;
|
|
1039
|
-
} catch (m) {
|
|
1040
|
-
console.error("Error fetching stock snapshots:", m), T.value = [];
|
|
1041
|
-
} finally {
|
|
1042
|
-
v.value = !1;
|
|
1043
|
-
}
|
|
1044
|
-
}
|
|
1045
|
-
}
|
|
1046
|
-
function oe(m) {
|
|
1047
|
-
S.value = "closing", C.value = m, l.value = !0;
|
|
1048
|
-
}
|
|
1049
|
-
function e(m) {
|
|
1050
|
-
S.value = "snapshot", C.value = m, l.value = !0;
|
|
1051
|
-
}
|
|
1052
|
-
return L.watchLocation(async () => {
|
|
1053
|
-
L.currentLocationDBName && (await K(), await j());
|
|
1054
|
-
}), (m, f) => {
|
|
1055
|
-
const R = $("FmTabs"), E = $("FmTable"), ae = $("FmDatePicker"), t = $("FmButton"), Y = $("FmDialog");
|
|
1056
|
-
return c(), H(he, {
|
|
1057
|
-
actions: J.value,
|
|
1058
|
-
title: r(x)("inventory.closing.history.title"),
|
|
1059
|
-
"onClick:action": q
|
|
1060
|
-
}, {
|
|
1061
|
-
default: I(() => [
|
|
1062
|
-
n("div", jt, [
|
|
1063
|
-
b(xe, {
|
|
1064
|
-
"change-location": "",
|
|
1065
|
-
"hide-filter-options": !0
|
|
1066
|
-
}),
|
|
1067
|
-
b(R, {
|
|
1068
|
-
"model-value": p.value,
|
|
1069
|
-
"onUpdate:modelValue": f[0] || (f[0] = (M) => p.value = M),
|
|
1070
|
-
items: u
|
|
1071
|
-
}, null, 8, ["model-value"]),
|
|
1072
|
-
p.value === "closings" ? (c(), y(z, { key: 0 }, [
|
|
1073
|
-
f[9] || (f[9] = n("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)),
|
|
1074
|
-
b(E, {
|
|
1075
|
-
loading: d.value,
|
|
1076
|
-
"row-data": s.value,
|
|
1077
|
-
"column-defs": ee,
|
|
1078
|
-
onRowClick: f[1] || (f[1] = (M) => oe(M.original))
|
|
1079
|
-
}, null, 8, ["loading", "row-data"])
|
|
1080
|
-
], 64)) : k("", !0),
|
|
1081
|
-
p.value === "snapshots" ? (c(), y(z, { key: 1 }, [
|
|
1082
|
-
f[10] || (f[10] = n("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)),
|
|
1083
|
-
b(E, {
|
|
1084
|
-
loading: v.value,
|
|
1085
|
-
"row-data": T.value,
|
|
1086
|
-
"column-defs": te,
|
|
1087
|
-
onRowClick: f[2] || (f[2] = (M) => e(M.original))
|
|
1088
|
-
}, null, 8, ["loading", "row-data"])
|
|
1089
|
-
], 64)) : k("", !0)
|
|
1090
|
-
]),
|
|
1091
|
-
(c(), H(ge, { to: "body" }, [
|
|
1092
|
-
b(tt, {
|
|
1093
|
-
"show-button": !1,
|
|
1094
|
-
ref_key: "recalculationDialogRef",
|
|
1095
|
-
ref: G,
|
|
1096
|
-
onSubmitted: f[3] || (f[3] = (M) => K())
|
|
1097
|
-
}, null, 512),
|
|
1098
|
-
b(Tt, {
|
|
1099
|
-
"show-button": !1,
|
|
1100
|
-
ref_key: "snapshotRecalculationDialogRef",
|
|
1101
|
-
ref: U,
|
|
1102
|
-
onSubmitted: f[4] || (f[4] = (M) => j())
|
|
1103
|
-
}, null, 512),
|
|
1104
|
-
b(Ht, {
|
|
1105
|
-
modelValue: l.value,
|
|
1106
|
-
"onUpdate:modelValue": f[5] || (f[5] = (M) => l.value = M),
|
|
1107
|
-
type: S.value,
|
|
1108
|
-
data: C.value
|
|
1109
|
-
}, null, 8, ["modelValue", "type", "data"]),
|
|
1110
|
-
b(Y, {
|
|
1111
|
-
modelValue: O.value,
|
|
1112
|
-
"onUpdate:modelValue": f[8] || (f[8] = (M) => O.value = M),
|
|
1113
|
-
"close-button": "",
|
|
1114
|
-
dismissAway: "",
|
|
1115
|
-
"max-width": "400px"
|
|
1116
|
-
}, {
|
|
1117
|
-
"dialog-header": I(() => f[11] || (f[11] = [
|
|
1118
|
-
n("div", { class: "fm-typo-en-heading-lg-600" }, "Initiate Stock Snapshot", -1)
|
|
1119
|
-
])),
|
|
1120
|
-
default: I(() => [
|
|
1121
|
-
n("div", zt, [
|
|
1122
|
-
f[12] || (f[12] = n("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)),
|
|
1123
|
-
b(ae, {
|
|
1124
|
-
modelValue: w.value,
|
|
1125
|
-
"onUpdate:modelValue": f[6] || (f[6] = (M) => w.value = M),
|
|
1126
|
-
label: "Snapshot Date",
|
|
1127
|
-
max: r(W)
|
|
1128
|
-
}, null, 8, ["modelValue", "max"])
|
|
1129
|
-
])
|
|
1130
|
-
]),
|
|
1131
|
-
"dialog-footer": I(() => [
|
|
1132
|
-
n("div", Jt, [
|
|
1133
|
-
b(t, {
|
|
1134
|
-
variant: "tertiary",
|
|
1135
|
-
onClick: f[7] || (f[7] = (M) => O.value = !1),
|
|
1136
|
-
label: "Cancel",
|
|
1137
|
-
disabled: N.value
|
|
1138
|
-
}, null, 8, ["disabled"]),
|
|
1139
|
-
b(t, {
|
|
1140
|
-
variant: "primary",
|
|
1141
|
-
onClick: Q,
|
|
1142
|
-
label: "Confirm",
|
|
1143
|
-
loading: N.value
|
|
1144
|
-
}, null, 8, ["loading"])
|
|
1145
|
-
])
|
|
1146
|
-
]),
|
|
1147
|
-
_: 1
|
|
1148
|
-
}, 8, ["modelValue"])
|
|
1149
|
-
]))
|
|
1150
|
-
]),
|
|
1151
|
-
_: 1
|
|
1152
|
-
}, 8, ["actions", "title"]);
|
|
1153
|
-
};
|
|
1154
|
-
}
|
|
1155
|
-
});
|
|
1156
|
-
export {
|
|
1157
|
-
oo as default
|
|
1158
|
-
};
|