@feedmepos/mf-inventory-portal 1.7.0-dev.6 → 1.7.0-dev.8
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-NlIy4RUv.js → App-DGt1TKAe.js} +4 -4
- package/dist/{ApprovalView-E7y0ueFH.js → ApprovalView-DA6vPFB8.js} +8 -8
- package/dist/{BindingsDialog-BNApImJz.js → BindingsDialog-CdcKh6UZ.js} +2 -2
- package/dist/{BindingsPicker-DRWs430b.js → BindingsPicker-C0q1FNa6.js} +2 -2
- package/dist/{BindingsTable-BC1TgKaN.js → BindingsTable-BnBAlW1t.js} +3 -3
- package/dist/{BulkReceiveRequestView-3XmccTDH.js → BulkReceiveRequestView-BiiwvM-O.js} +19 -19
- package/dist/{ChangeLocationComponent.vue_vue_type_script_setup_true_lang-DW71yYOY.js → ChangeLocationComponent.vue_vue_type_script_setup_true_lang-DsY0X4Er.js} +1 -1
- package/dist/ClosingDraftView-CNEvYNfz.js +4398 -0
- package/dist/ClosingHistoryView-BvaVrfjv.js +1112 -0
- package/dist/ClosingTemplateView-DxPGJz0K.js +2270 -0
- package/dist/CursorPaginatedTable.vue_vue_type_script_setup_true_lang-4KT9rH9e.js +152 -0
- package/dist/{DefaultView-vIumMOKt.js → DefaultView-Mqtuxaq1.js} +2 -2
- package/dist/{DeliveryOrderPrintPreview-DhLgl3uz.js → DeliveryOrderPrintPreview--IKofxUf.js} +2 -2
- package/dist/{EmailDialog.vue_vue_type_script_setup_true_lang-Cn2ub5XB.js → EmailDialog.vue_vue_type_script_setup_true_lang-CZLIa7_0.js} +23 -23
- package/dist/FmDateRangePickerChip.vue_vue_type_script_setup_true_lang-cu92NvT7.js +69 -0
- package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-CNkXEMRd.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-DJSDKAcv.js} +2 -2
- package/dist/FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DC21Ybcs.js +120 -0
- package/dist/{FmMultiselectDialog-Ckl1Yv9A.js → FmMultiselectDialog-BRN_fVWG.js} +1 -1
- package/dist/{FmMultiselectDialog-BKUDjNe8.js → FmMultiselectDialog-DNMu6Pyo.js} +2 -2
- package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-D-dqtdHm.js → FmUnitInput.vue_vue_type_script_setup_true_lang-JjqnjgF6.js} +5 -5
- package/dist/{ImportView-B2dZLlIQ.js → ImportView-CzhINr8x.js} +6 -6
- package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-CZN7bMba.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-UX70sCkO.js} +1 -1
- package/dist/{IngredientGroupView-B8uTaewu.js → IngredientGroupView-D34lU0nT.js} +5 -5
- package/dist/{IngredientsView-0pIpqaYP.js → IngredientsView-C5APBsVv.js} +16 -16
- package/dist/{IntegrationExplorerView-m340FRkF.js → IntegrationExplorerView-B9CMZOyM.js} +4 -4
- package/dist/{IntegrationView-CR63stDu.js → IntegrationView-C2QFD6iK.js} +13 -13
- package/dist/{InventoryBindingForm-DxwGujF1.js → InventoryBindingForm-B6KPHHXM.js} +1 -1
- package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-CuXUsDzD.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-DqTs4tkd.js} +5 -5
- package/dist/{InventoryBindingSummary-BZC8PmSy.js → InventoryBindingSummary-C3pSlQIV.js} +1 -1
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DUQxKXKO.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-BBj2fp9p.js} +1 -1
- package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-DhabkmeS.js → PremiumBadge.vue_vue_type_script_setup_true_lang-BQcze770.js} +1 -1
- package/dist/{ProductionView-DGK7ari8.js → ProductionView-D3hxR4Al.js} +7 -7
- package/dist/{PublishView-C2WdbS4L.js → PublishView-dyIbB5oY.js} +3 -3
- package/dist/{PurchaseOrderPrintPreview-DbB68sX0.js → PurchaseOrderPrintPreview-BtecmMvJ.js} +2 -2
- package/dist/{ReceiveRequestView-zAUq0Ssz.js → ReceiveRequestView-CsyLhbWO.js} +13 -13
- package/dist/{RecipeView-C5w_pUXR.js → RecipeView-C0GFeSDy.js} +17 -17
- package/dist/{SettingsView-DLRcCvk4.js → SettingsView-CLjyeHBv.js} +4 -4
- package/dist/{StockView-BaH1vKcT.js → StockView-CGiQO7JM.js} +21 -21
- package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-weKIvp8F.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-Bpa_-7Xw.js} +1 -1
- package/dist/{SupplierView-DrviX9XY.js → SupplierView-BxGah90N.js} +12 -12
- package/dist/{SurchargeView-PeKEls1Z.js → SurchargeView-_K_rxa1E.js} +6 -6
- package/dist/{SystemTrailDialog.vue_vue_type_script_setup_true_lang-Czkd0qqw.js → SystemTrailDialog.vue_vue_type_script_setup_true_lang-C5iFkaac.js} +2 -2
- package/dist/{TemplatePublishDialog.vue_vue_type_script_setup_true_lang-B01wr4F8.js → TemplatePublishDialog.vue_vue_type_script_setup_true_lang-CJHiozGf.js} +1 -1
- package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-Dqz1eFSJ.js → TransferDetails.vue_vue_type_script_setup_true_lang-XTJW-ITd.js} +20 -20
- package/dist/{TransferTemplateView-wN2nr_0X.js → TransferTemplateView-BEVHHa3g.js} +20 -20
- package/dist/{UnitCostHistoryView-DGTYxbvj.js → UnitCostHistoryView-BHYOJdh7.js} +4 -4
- package/dist/{UnitDisplayControl.vue_vue_type_script_setup_true_lang-B6krURPH.js → UnitDisplayControl.vue_vue_type_script_setup_true_lang-DbqnEmeM.js} +4 -4
- package/dist/{UnitView-C8SM9fQP.js → UnitView-BtwxautF.js} +7 -7
- package/dist/{WarehouseView-DhOlmE3U.js → WarehouseView-iCaNZRIz.js} +5 -5
- package/dist/{WastageTemplateView-CM4eTx0N.js → WastageTemplateView-Bc6GJd4d.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-pfHbU1WT.js → app-BP2iMkXf.js} +4521 -4308
- package/dist/app.d.ts +8 -0
- package/dist/app.js +1 -1
- package/dist/{closing-template-C6Vx5eWA.js → closing-template-5y8eotCC.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-C-n9LpKa.js → date2-Bfw67PjS.js} +1 -1
- package/dist/{dayjs.min-Bu4_8gM9.js → dayjs.min-B3qfrpYu.js} +1 -1
- package/dist/{decimal-C2_Vh-I3.js → decimal-SalS1cxI.js} +2 -2
- package/dist/{defineDeepModel-CXP9xlO9.js → defineDeepModel-CCBhCBwm.js} +1 -1
- package/dist/{duplicate-template-XPmYbOJ9.js → duplicate-template-C0FI8Pt9.js} +1 -1
- package/dist/{feature-CLk0uPEH.js → feature-Cp_nrPL6.js} +2 -2
- package/dist/{format-time-from-id-G5QRBa84.js → format-time-from-id-BCn8GnjQ.js} +1 -1
- package/dist/{format-unit-display-IIqavf90.js → format-unit-display-CXbG9MgA.js} +12 -12
- package/dist/{import-export.helper-BO_uqwp4.js → import-export.helper-D4GvjZUO.js} +6 -6
- package/dist/{index-Ce3fiDvd.js → index-CzkezMbA.js} +3344 -3066
- package/dist/{index-Dcm54ldM.js → index-DvTfqbiM.js} +1 -1
- package/dist/{index-DnpSJzwo.js → index-xDQmlVeP.js} +3 -3
- package/dist/{inventory-core-dart.default-INsUG73Y.js → inventory-core-dart.default-CVpYUeBn.js} +1 -1
- package/dist/{jszip.min-D3KgBOLH.js → jszip.min-CfuFlbgP.js} +2 -2
- package/dist/{lz-string-BWhXP-Xc.js → lz-string-D9ANZJke.js} +1 -1
- package/dist/{netsuite-DzOrZBvA.js → netsuite-Dijt7bYw.js} +2 -2
- package/dist/{number-VpMHWJsJ.js → number-DI4WG85J.js} +3 -3
- package/dist/{predefined-templates-BvnvUI_F.js → predefined-templates-1-zDE0Iu.js} +1 -1
- package/dist/{purchase-order-template-CJh4_Q3H.js → purchase-order-template-CbI-13Ym.js} +1 -1
- package/dist/{recalculationUtils-BTvAwC7J.js → recalculationUtils-B2r9j-19.js} +1 -1
- package/dist/{rules-LPO_v5Zr.js → rules-DxJtL6OC.js} +2 -2
- package/dist/{stock-DCHhwIaC.js → stock-6C0d5Fe8.js} +1 -1
- package/dist/{stock-CqpYPWHj.js → stock-BDGgOFuW.js} +3 -3
- package/dist/stores/inventory.import-errors.spec.d.ts +1 -0
- package/dist/{supplier-CZEJx5mC.js → supplier-BVmJ5p3z.js} +2 -2
- package/dist/{surcharge-BbTuG_a2.js → surcharge-BRNgbJmg.js} +1 -1
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{uom-rules-Cu4fXhZ2.js → uom-rules-Czbq4YOl.js} +1 -1
- package/dist/{use-ingredient-select-dialog-D6ETW66d.js → use-ingredient-select-dialog-F4E4y-uM.js} +2 -2
- package/dist/{use-inventory-binding-dialog-D_b729Po.js → use-inventory-binding-dialog-CETXyyXW.js} +2 -2
- package/dist/{use-template-enabled-locations-DeR8DY64.js → use-template-enabled-locations-BXD1IoQM.js} +2 -2
- package/dist/{use-transfer-locations-DysOG_1c.js → use-transfer-locations-DSHSzGPR.js} +2 -2
- package/dist/{useHrmPermission-BDMnFbDK.js → useHrmPermission-tg3v6qrq.js} +1 -1
- package/dist/{useNavigationMenu-CjoofsrC.js → useNavigationMenu-tbjt_qJ2.js} +2 -2
- package/dist/{useSseClient-B7hHgXIn.js → useSseClient-BvEOOnEx.js} +1 -1
- package/dist/views/adjustment-template/wastage-template/table.d.ts +1 -1
- package/dist/views/closing-draft/components/closing-draft-dialog/ClosingDraftApprovalDialog.vue.d.ts +4 -2
- package/dist/views/closing-draft/components/closing-draft-dialog/ClosingDraftDialog.vue.d.ts +8 -4
- package/dist/views/closing-draft/components/closing-draft-groups/ClosingGroupDetailSideSheet.vue.d.ts +4 -2
- package/dist/views/closing-draft/composables/use-closing-draft-actions.d.ts +1290 -15
- package/dist/views/closing-draft/composables/use-closing-draft-import.d.ts +2 -1
- 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-kLRqcyG8.js → vue-i18n-D1uxFCER.js} +1 -1
- package/dist/{xlsx.util-1F6O_wmm.js → xlsx.util-CRhZzioa.js} +2 -2
- package/package.json +2 -2
- package/dist/ClosingDraftView-DUv-k-RN.js +0 -4320
- package/dist/ClosingHistoryView-CGb32hip.js +0 -1115
- package/dist/ClosingTemplateView-DtxeqHgX.js +0 -2237
- package/dist/FmDateRangePickerChip.vue_vue_type_script_setup_true_lang-OReBYvpY.js +0 -61
- package/dist/FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DiyqG-gq.js +0 -118
|
@@ -0,0 +1,1112 @@
|
|
|
1
|
+
import { defineComponent as se, ref as g, computed as D, watch as re, resolveComponent as w, createElementBlock as p, openBlock as i, createBlock as j, createCommentVNode as _, createVNode as h, withModifiers as pe, withCtx as F, createElementVNode as a, toDisplayString as l, unref as c, Fragment as G, createTextVNode as te, renderList as le, normalizeClass as ve, h as ee, Teleport as be } from "vue";
|
|
2
|
+
import { _ as ke } from "./SingleColumnLayout.vue_vue_type_script_setup_true_lang-DwrLsWX_.js";
|
|
3
|
+
import { useI18n as ie, useCoreStore as xe } from "@feedmepos/mf-common";
|
|
4
|
+
import { E as de, B as P, a as De, u as Se } from "./app-BP2iMkXf.js";
|
|
5
|
+
import { F as fe } from "./FmAdminBadge-DlplQOHb.js";
|
|
6
|
+
import { _ as we } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DC21Ybcs.js";
|
|
7
|
+
import { _ as ye } from "./CursorPaginatedTable.vue_vue_type_script_setup_true_lang-4KT9rH9e.js";
|
|
8
|
+
import { useSnackbar as ue, useDialog as Ve } from "@feedmepos/ui-library";
|
|
9
|
+
import { u as ge } from "./stock-6C0d5Fe8.js";
|
|
10
|
+
import { g as he, f as $e } from "./recalculationUtils-B2r9j-19.js";
|
|
11
|
+
import { _ as Ce } from "./UnitDisplayControl.vue_vue_type_script_setup_true_lang-DbqnEmeM.js";
|
|
12
|
+
const Ae = { class: "fm-typo-en-heading-lg-600" }, Fe = { class: "flex flex-col gap-16" }, Re = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Be = { class: "flex flex-col gap-8" }, Ie = { class: "fm-typo-en-body-md-600" }, Te = { class: "flex flex-col gap-8" }, Le = { class: "fm-typo-en-body-md-600" }, Oe = { class: "flex items-center gap-8 mb-8" }, Pe = {
|
|
13
|
+
key: 2,
|
|
14
|
+
class: "text-red-500 text-sm mt-2"
|
|
15
|
+
}, Ee = { class: "fm-typo-en-body-sm-400" }, Ue = {
|
|
16
|
+
key: 1,
|
|
17
|
+
class: "p-12 border border-fm-color-border-primary rounded-8 bg-fm-color-background-secondary"
|
|
18
|
+
}, Ne = {
|
|
19
|
+
key: 0,
|
|
20
|
+
class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
|
|
21
|
+
}, Me = {
|
|
22
|
+
key: 1,
|
|
23
|
+
class: "flex flex-col gap-8"
|
|
24
|
+
}, Ke = { class: "fm-typo-en-body-sm-600" }, He = { class: "flex flex-col gap-4" }, je = { key: 0 }, ze = {
|
|
25
|
+
key: 1,
|
|
26
|
+
class: "flex flex-col gap-8"
|
|
27
|
+
}, We = { class: "fm-typo-en-body-md-600" }, Ye = { class: "flex flex-col gap-8 max-h-[300px] overflow-y-auto" }, Ge = { class: "flex items-center justify-between" }, Je = { class: "fm-typo-en-body-sm-600" }, Qe = { class: "flex items-center gap-8" }, Xe = {
|
|
28
|
+
key: 0,
|
|
29
|
+
class: "fm-typo-en-body-xs-600 px-8 py-4 rounded-4 bg-fm-color-neutral-100 text-fm-color-typo-secondary"
|
|
30
|
+
}, Ze = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, qe = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, et = {
|
|
31
|
+
key: 0,
|
|
32
|
+
class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
|
|
33
|
+
}, tt = {
|
|
34
|
+
key: 1,
|
|
35
|
+
class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
|
|
36
|
+
}, ot = {
|
|
37
|
+
key: 2,
|
|
38
|
+
class: "fm-typo-en-body-xs-400 text-fm-color-system-error-500"
|
|
39
|
+
}, at = {
|
|
40
|
+
key: 0,
|
|
41
|
+
class: "flex gap-8 ml-auto"
|
|
42
|
+
}, nt = {
|
|
43
|
+
key: 1,
|
|
44
|
+
class: "flex gap-8 ml-auto"
|
|
45
|
+
}, lt = /* @__PURE__ */ se({
|
|
46
|
+
__name: "RecalculationDialog",
|
|
47
|
+
props: {
|
|
48
|
+
showButton: { type: Boolean }
|
|
49
|
+
},
|
|
50
|
+
emits: ["submitted"],
|
|
51
|
+
setup(ne, { expose: b, emit: k }) {
|
|
52
|
+
const T = k, { t: o } = ie(), L = ge(), R = de(), x = ue(), S = g(!1), f = g(""), y = g(""), $ = g(!1), E = g([]), s = g(!1), r = g([]), C = g(!1), v = g([]), A = g(!1), B = D(() => he(E.value)), I = D(() => {
|
|
53
|
+
if (!f.value) return [];
|
|
54
|
+
const u = B.value.find((e) => e.value === f.value);
|
|
55
|
+
return u ? B.value.filter((e) => e.date.getTime() > u.date.getTime()).sort((e, m) => m.date.getTime() - e.date.getTime()) : [];
|
|
56
|
+
}), N = D({
|
|
57
|
+
get: () => {
|
|
58
|
+
if ($.value && y.value) {
|
|
59
|
+
const u = E.value.find((e) => P(e._id) === y.value);
|
|
60
|
+
return (u == null ? void 0 : u._id) || y.value;
|
|
61
|
+
}
|
|
62
|
+
return y.value;
|
|
63
|
+
},
|
|
64
|
+
set: (u) => {
|
|
65
|
+
$.value && u ? y.value = P(u) : y.value = u;
|
|
66
|
+
}
|
|
67
|
+
}), z = D(() => {
|
|
68
|
+
if (f.value)
|
|
69
|
+
try {
|
|
70
|
+
const u = P(f.value);
|
|
71
|
+
if (u)
|
|
72
|
+
return u;
|
|
73
|
+
} catch (u) {
|
|
74
|
+
console.error("Error parsing date from closing ID:", u);
|
|
75
|
+
}
|
|
76
|
+
}), U = D(() => {
|
|
77
|
+
if (!f.value || !y.value) return "";
|
|
78
|
+
const u = P(f.value), e = y.value;
|
|
79
|
+
if (u && e) {
|
|
80
|
+
const m = new Date(u).getTime();
|
|
81
|
+
if (new Date(e).getTime() <= m)
|
|
82
|
+
return o("inventory.stock.recalculation.error.endDateBeforeOpening");
|
|
83
|
+
}
|
|
84
|
+
return "";
|
|
85
|
+
}), M = D(() => !!f.value && !!y.value && !U.value), J = D(() => r.value.some(
|
|
86
|
+
(u) => !u.completedAt && !u.failedReason
|
|
87
|
+
));
|
|
88
|
+
async function Y() {
|
|
89
|
+
S.value = !0, await Promise.all([oe(), K()]), f.value = "", y.value = "", $.value = !1;
|
|
90
|
+
}
|
|
91
|
+
function Q() {
|
|
92
|
+
S.value = !1;
|
|
93
|
+
}
|
|
94
|
+
b({
|
|
95
|
+
open: Y,
|
|
96
|
+
close: Q
|
|
97
|
+
});
|
|
98
|
+
async function oe() {
|
|
99
|
+
s.value = !0;
|
|
100
|
+
try {
|
|
101
|
+
const u = await R.getLastNClosings(30);
|
|
102
|
+
E.value = u;
|
|
103
|
+
} catch (u) {
|
|
104
|
+
console.error("Error fetching recent closings:", u), x.open({
|
|
105
|
+
title: o("common.error"),
|
|
106
|
+
message: "Failed to fetch recent closings",
|
|
107
|
+
type: "error"
|
|
108
|
+
});
|
|
109
|
+
} finally {
|
|
110
|
+
s.value = !1;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
async function K() {
|
|
114
|
+
C.value = !0;
|
|
115
|
+
try {
|
|
116
|
+
const u = await L.recalculation.recalculationRequests();
|
|
117
|
+
r.value = u;
|
|
118
|
+
} catch (u) {
|
|
119
|
+
console.error("Error fetching recalculation requests:", u);
|
|
120
|
+
} finally {
|
|
121
|
+
C.value = !1;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
async function W() {
|
|
125
|
+
if (!f.value || !y.value) {
|
|
126
|
+
v.value = [];
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
A.value = !0;
|
|
130
|
+
try {
|
|
131
|
+
const u = await L.recalculation.getAffectedClosingDrafts(
|
|
132
|
+
f.value,
|
|
133
|
+
y.value
|
|
134
|
+
);
|
|
135
|
+
v.value = u;
|
|
136
|
+
} catch {
|
|
137
|
+
x.open({
|
|
138
|
+
title: o("common.error"),
|
|
139
|
+
message: "Failed to fetch affected closing drafts",
|
|
140
|
+
type: "error"
|
|
141
|
+
}), v.value = [];
|
|
142
|
+
} finally {
|
|
143
|
+
A.value = !1;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
re(
|
|
147
|
+
[f, y],
|
|
148
|
+
() => {
|
|
149
|
+
f.value && y.value && !U.value ? W() : v.value = [];
|
|
150
|
+
},
|
|
151
|
+
{ immediate: !1 }
|
|
152
|
+
);
|
|
153
|
+
async function ae() {
|
|
154
|
+
if (M.value) {
|
|
155
|
+
s.value = !0;
|
|
156
|
+
try {
|
|
157
|
+
if (await L.recalculation.scheduleRecalculation({
|
|
158
|
+
openingId: f.value,
|
|
159
|
+
untilDate: y.value
|
|
160
|
+
}), v.value.length > 0) {
|
|
161
|
+
const u = v.value.map((e) => e._id);
|
|
162
|
+
await L.recalculation.scheduleInvalidateClosingDraftCache(u);
|
|
163
|
+
}
|
|
164
|
+
x.open({
|
|
165
|
+
title: o("common.success"),
|
|
166
|
+
message: "Stock recalculation has been scheduled successfully",
|
|
167
|
+
type: "success"
|
|
168
|
+
}), await K(), S.value = !1, T("submitted");
|
|
169
|
+
} catch (u) {
|
|
170
|
+
console.error("Error scheduling recalculation:", u), x.open({
|
|
171
|
+
title: o("common.error"),
|
|
172
|
+
message: "Failed to schedule stock recalculation",
|
|
173
|
+
type: "error"
|
|
174
|
+
});
|
|
175
|
+
} finally {
|
|
176
|
+
s.value = !1;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
return (u, e) => {
|
|
181
|
+
const m = w("FmButton"), O = w("FmSelect"), X = w("FmRadio"), Z = w("FmDatePicker"), q = w("FmAlert"), d = w("FmDialog");
|
|
182
|
+
return i(), p("div", null, [
|
|
183
|
+
u.showButton ? (i(), j(m, {
|
|
184
|
+
key: 0,
|
|
185
|
+
"prepend-icon": "info",
|
|
186
|
+
variant: "tertiary",
|
|
187
|
+
onClick: pe(Y, ["stop"])
|
|
188
|
+
})) : _("", !0),
|
|
189
|
+
h(d, {
|
|
190
|
+
modelValue: S.value,
|
|
191
|
+
"onUpdate:modelValue": e[7] || (e[7] = (t) => S.value = t),
|
|
192
|
+
"close-button": "",
|
|
193
|
+
dismissAway: "",
|
|
194
|
+
"max-width": "600px"
|
|
195
|
+
}, {
|
|
196
|
+
"dialog-header": F(() => [
|
|
197
|
+
a("div", Ae, l(c(o)("inventory.stock.recalculation.title")), 1)
|
|
198
|
+
]),
|
|
199
|
+
"dialog-footer": F(() => [
|
|
200
|
+
J.value ? (i(), p("div", nt, [
|
|
201
|
+
h(m, {
|
|
202
|
+
variant: "tertiary",
|
|
203
|
+
onClick: e[6] || (e[6] = (t) => S.value = !1),
|
|
204
|
+
label: c(o)("common.close")
|
|
205
|
+
}, null, 8, ["label"])
|
|
206
|
+
])) : (i(), p("div", at, [
|
|
207
|
+
h(m, {
|
|
208
|
+
variant: "tertiary",
|
|
209
|
+
onClick: e[5] || (e[5] = (t) => S.value = !1),
|
|
210
|
+
disabled: s.value,
|
|
211
|
+
label: c(o)("common.cancel")
|
|
212
|
+
}, null, 8, ["disabled", "label"]),
|
|
213
|
+
h(m, {
|
|
214
|
+
variant: "primary",
|
|
215
|
+
onClick: ae,
|
|
216
|
+
disabled: !M.value || s.value,
|
|
217
|
+
loading: s.value,
|
|
218
|
+
label: c(o)("inventory.stock.recalculation.schedule")
|
|
219
|
+
}, null, 8, ["disabled", "loading", "label"])
|
|
220
|
+
]))
|
|
221
|
+
]),
|
|
222
|
+
default: F(() => [
|
|
223
|
+
a("div", Fe, [
|
|
224
|
+
a("div", Re, l(c(o)("inventory.stock.recalculation.description")), 1),
|
|
225
|
+
J.value ? _("", !0) : (i(), p(G, { key: 0 }, [
|
|
226
|
+
a("div", Be, [
|
|
227
|
+
a("p", Ie, [
|
|
228
|
+
te(l(c(o)("inventory.stock.recalculation.openingDate")) + " ", 1),
|
|
229
|
+
e[8] || (e[8] = a("span", { class: "text-fm-color-system-error-300" }, "*", -1))
|
|
230
|
+
]),
|
|
231
|
+
e[9] || (e[9] = a("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)),
|
|
232
|
+
h(O, {
|
|
233
|
+
modelValue: f.value,
|
|
234
|
+
"onUpdate:modelValue": e[0] || (e[0] = (t) => f.value = t),
|
|
235
|
+
items: B.value,
|
|
236
|
+
placeholder: c(o)("inventory.stock.recalculation.selectOpening"),
|
|
237
|
+
loading: s.value,
|
|
238
|
+
disabled: s.value
|
|
239
|
+
}, null, 8, ["modelValue", "items", "placeholder", "loading", "disabled"])
|
|
240
|
+
]),
|
|
241
|
+
a("div", Te, [
|
|
242
|
+
a("p", Le, [
|
|
243
|
+
te(l(c(o)("inventory.stock.recalculation.untilDate")) + " ", 1),
|
|
244
|
+
e[10] || (e[10] = a("span", { class: "text-fm-color-system-error-300" }, "*", -1))
|
|
245
|
+
]),
|
|
246
|
+
a("div", Oe, [
|
|
247
|
+
h(X, {
|
|
248
|
+
modelValue: $.value,
|
|
249
|
+
"onUpdate:modelValue": e[1] || (e[1] = (t) => $.value = t),
|
|
250
|
+
value: !1,
|
|
251
|
+
label: c(o)("inventory.stock.recalculation.selectByDate")
|
|
252
|
+
}, null, 8, ["modelValue", "label"]),
|
|
253
|
+
h(X, {
|
|
254
|
+
modelValue: $.value,
|
|
255
|
+
"onUpdate:modelValue": e[2] || (e[2] = (t) => $.value = t),
|
|
256
|
+
value: !0,
|
|
257
|
+
label: c(o)("inventory.stock.recalculation.selectByClosing")
|
|
258
|
+
}, null, 8, ["modelValue", "label"])
|
|
259
|
+
]),
|
|
260
|
+
$.value ? (i(), j(O, {
|
|
261
|
+
key: 1,
|
|
262
|
+
modelValue: N.value,
|
|
263
|
+
"onUpdate:modelValue": e[4] || (e[4] = (t) => N.value = t),
|
|
264
|
+
items: I.value,
|
|
265
|
+
placeholder: c(o)("inventory.stock.recalculation.selectClosing"),
|
|
266
|
+
loading: s.value,
|
|
267
|
+
disabled: !f.value || s.value
|
|
268
|
+
}, null, 8, ["modelValue", "items", "placeholder", "loading", "disabled"])) : (i(), j(Z, {
|
|
269
|
+
key: 0,
|
|
270
|
+
modelValue: y.value,
|
|
271
|
+
"onUpdate:modelValue": e[3] || (e[3] = (t) => y.value = t),
|
|
272
|
+
placeholder: c(o)("inventory.stock.recalculation.selectDate"),
|
|
273
|
+
min: z.value,
|
|
274
|
+
disabled: !f.value || s.value
|
|
275
|
+
}, null, 8, ["modelValue", "placeholder", "min", "disabled"])),
|
|
276
|
+
U.value ? (i(), p("div", Pe, l(U.value), 1)) : _("", !0)
|
|
277
|
+
]),
|
|
278
|
+
f.value && y.value && !U.value ? (i(), j(q, {
|
|
279
|
+
key: 0,
|
|
280
|
+
type: "info"
|
|
281
|
+
}, {
|
|
282
|
+
default: F(() => [
|
|
283
|
+
a("div", Ee, l(c(o)("inventory.stock.recalculation.info")), 1)
|
|
284
|
+
]),
|
|
285
|
+
_: 1
|
|
286
|
+
})) : _("", !0),
|
|
287
|
+
v.value.length > 0 ? (i(), p("div", Ue, [
|
|
288
|
+
A.value ? (i(), p("div", Ne, " Loading affected closing drafts... ")) : (i(), p("div", Me, [
|
|
289
|
+
a("div", Ke, " Affected closing draft(s): " + l(v.value.length), 1),
|
|
290
|
+
a("div", He, [
|
|
291
|
+
(i(!0), p(G, null, le(v.value, (t) => (i(), p("div", {
|
|
292
|
+
key: t._id,
|
|
293
|
+
class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
|
|
294
|
+
}, [
|
|
295
|
+
te(" • " + l(t._id) + " ", 1),
|
|
296
|
+
t.effectiveAt ? (i(), p("span", je, " (" + l(new Date(t.effectiveAt).toLocaleString()) + ") ", 1)) : _("", !0)
|
|
297
|
+
]))), 128))
|
|
298
|
+
])
|
|
299
|
+
]))
|
|
300
|
+
])) : _("", !0)
|
|
301
|
+
], 64)),
|
|
302
|
+
r.value.length > 0 ? (i(), p("div", ze, [
|
|
303
|
+
a("p", We, l(c(o)("inventory.stock.recalculation.recentRequests")), 1),
|
|
304
|
+
a("div", Ye, [
|
|
305
|
+
(i(!0), p(G, null, le(r.value, (t) => {
|
|
306
|
+
var n;
|
|
307
|
+
return i(), p("div", {
|
|
308
|
+
key: t._id,
|
|
309
|
+
class: "p-12 border border-fm-color-border-primary rounded-8 flex flex-col gap-4"
|
|
310
|
+
}, [
|
|
311
|
+
a("div", Ge, [
|
|
312
|
+
a("div", Je, l(c(o)("inventory.stock.recalculation.requestedAt")) + ": " + l(new Date(t.createdAt).toLocaleString()), 1),
|
|
313
|
+
a("div", Qe, [
|
|
314
|
+
(n = t.meta) != null && n.openingType ? (i(), p("div", Xe, l(t.meta.openingType === "stockSnapshot" ? "Snapshot" : "Closing"), 1)) : _("", !0),
|
|
315
|
+
a("div", {
|
|
316
|
+
class: ve(["fm-typo-en-body-xs-600 px-8 py-4 rounded-4", {
|
|
317
|
+
"bg-fm-color-system-error-100 text-fm-color-system-error-500": t.failedReason,
|
|
318
|
+
"bg-fm-color-system-success-100 text-fm-color-system-success-500": t.completedAt,
|
|
319
|
+
"bg-fm-color-system-info-100 text-fm-color-system-info-500": !t.failedReason && !t.completedAt
|
|
320
|
+
}])
|
|
321
|
+
}, l(t.failedReason ? c(o)("inventory.stock.recalculation.status.failed") : t.completedAt ? c(o)("inventory.stock.recalculation.status.completed") : c(o)("inventory.stock.recalculation.status.inProgress")), 3)
|
|
322
|
+
])
|
|
323
|
+
]),
|
|
324
|
+
a("div", Ze, l(c(o)("inventory.stock.recalculation.from")) + ": " + l(new Date(t.recalculateStartDate).toLocaleDateString()), 1),
|
|
325
|
+
a("div", qe, l(c(o)("inventory.stock.recalculation.to")) + ": " + l(new Date(t.recalculateEndDate).toLocaleDateString()), 1),
|
|
326
|
+
t.createdBy ? (i(), p("div", et, l(c(o)("inventory.stock.recalculation.requestedBy")) + ": " + l(t.createdBy.name || t.createdBy.id), 1)) : _("", !0),
|
|
327
|
+
t.completedAt ? (i(), p("div", tt, l(c(o)("inventory.stock.recalculation.completedAt")) + ": " + l(new Date(t.completedAt).toLocaleString()), 1)) : _("", !0),
|
|
328
|
+
t.failedReason ? (i(), p("div", ot, l(t.failedReason), 1)) : _("", !0)
|
|
329
|
+
]);
|
|
330
|
+
}), 128))
|
|
331
|
+
])
|
|
332
|
+
])) : _("", !0)
|
|
333
|
+
])
|
|
334
|
+
]),
|
|
335
|
+
_: 1
|
|
336
|
+
}, 8, ["modelValue"])
|
|
337
|
+
]);
|
|
338
|
+
};
|
|
339
|
+
}
|
|
340
|
+
}), st = { class: "fm-typo-en-heading-lg-600" }, it = { class: "flex flex-col gap-16" }, ct = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, rt = { class: "flex flex-col gap-8" }, dt = { class: "fm-typo-en-body-md-600" }, ut = { class: "flex flex-col gap-8" }, mt = { class: "fm-typo-en-body-md-600" }, ft = {
|
|
341
|
+
key: 0,
|
|
342
|
+
class: "text-red-500 text-sm mt-2"
|
|
343
|
+
}, yt = { class: "fm-typo-en-body-sm-400" }, pt = {
|
|
344
|
+
key: 1,
|
|
345
|
+
class: "p-12 border border-fm-color-border-primary rounded-8 bg-fm-color-background-secondary"
|
|
346
|
+
}, vt = {
|
|
347
|
+
key: 0,
|
|
348
|
+
class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
|
|
349
|
+
}, gt = {
|
|
350
|
+
key: 1,
|
|
351
|
+
class: "flex flex-col gap-8"
|
|
352
|
+
}, ht = { class: "fm-typo-en-body-sm-600" }, _t = { class: "flex flex-col gap-4" }, bt = { key: 0 }, kt = { key: 1 }, xt = { key: 2 }, Dt = {
|
|
353
|
+
key: 1,
|
|
354
|
+
class: "flex flex-col gap-8"
|
|
355
|
+
}, St = { class: "fm-typo-en-body-md-600" }, wt = { class: "flex flex-col gap-8 max-h-[300px] overflow-y-auto" }, Vt = { class: "flex items-center justify-between" }, $t = { class: "fm-typo-en-body-sm-600" }, Ct = { class: "flex items-center gap-8" }, At = {
|
|
356
|
+
key: 0,
|
|
357
|
+
class: "fm-typo-en-body-xs-600 px-8 py-4 rounded-4 bg-fm-color-neutral-100 text-fm-color-typo-secondary"
|
|
358
|
+
}, Ft = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Rt = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Bt = {
|
|
359
|
+
key: 0,
|
|
360
|
+
class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
|
|
361
|
+
}, It = {
|
|
362
|
+
key: 1,
|
|
363
|
+
class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
|
|
364
|
+
}, Tt = {
|
|
365
|
+
key: 2,
|
|
366
|
+
class: "fm-typo-en-body-xs-400 text-fm-color-system-error-500"
|
|
367
|
+
}, Lt = {
|
|
368
|
+
key: 0,
|
|
369
|
+
class: "flex gap-8 ml-auto"
|
|
370
|
+
}, Ot = {
|
|
371
|
+
key: 1,
|
|
372
|
+
class: "flex gap-8 ml-auto"
|
|
373
|
+
}, Pt = /* @__PURE__ */ se({
|
|
374
|
+
__name: "SnapshotRecalculationDialog",
|
|
375
|
+
props: {
|
|
376
|
+
showButton: { type: Boolean }
|
|
377
|
+
},
|
|
378
|
+
emits: ["submitted"],
|
|
379
|
+
setup(ne, { expose: b, emit: k }) {
|
|
380
|
+
const T = k, { t: o } = ie(), L = ge(), R = de(), x = ue(), S = g(!1), f = g(""), y = g(""), $ = g([]), E = g([]), s = g(!1), r = g([]), C = g(!1), v = g([]), A = g(!1), B = D(
|
|
381
|
+
() => he($.value, E.value)
|
|
382
|
+
), I = D(() => $e(
|
|
383
|
+
v.value.filter((e) => !!e.closingId).map((e) => ({ closingId: e.closingId, draftCreatedAt: new Date(P(e._id)) }))
|
|
384
|
+
)), N = D(() => {
|
|
385
|
+
if (f.value)
|
|
386
|
+
try {
|
|
387
|
+
const e = P(f.value);
|
|
388
|
+
if (e)
|
|
389
|
+
return e;
|
|
390
|
+
} catch (e) {
|
|
391
|
+
console.error("Error parsing date from opening ID:", e);
|
|
392
|
+
}
|
|
393
|
+
}), z = D(() => {
|
|
394
|
+
if (!f.value || !y.value) return "";
|
|
395
|
+
const e = P(f.value);
|
|
396
|
+
if (e && y.value) {
|
|
397
|
+
const m = new Date(e).getTime();
|
|
398
|
+
if (new Date(y.value).getTime() <= m)
|
|
399
|
+
return o("inventory.stock.recalculation.error.endDateBeforeOpening");
|
|
400
|
+
}
|
|
401
|
+
return "";
|
|
402
|
+
}), U = D(() => {
|
|
403
|
+
if (!y.value) return !1;
|
|
404
|
+
const e = new Date(y.value), m = /* @__PURE__ */ new Date();
|
|
405
|
+
return m.setHours(0, 0, 0, 0), e.setHours(0, 0, 0, 0), e >= m;
|
|
406
|
+
}), M = D(() => !!f.value && !!y.value && !z.value), J = D(() => r.value.some(
|
|
407
|
+
(e) => !e.completedAt && !e.failedReason
|
|
408
|
+
));
|
|
409
|
+
async function Y() {
|
|
410
|
+
S.value = !0, await Promise.all([oe(), K(), W()]), f.value = "", y.value = "";
|
|
411
|
+
}
|
|
412
|
+
function Q() {
|
|
413
|
+
S.value = !1;
|
|
414
|
+
}
|
|
415
|
+
b({
|
|
416
|
+
open: Y,
|
|
417
|
+
close: Q
|
|
418
|
+
});
|
|
419
|
+
async function oe() {
|
|
420
|
+
s.value = !0;
|
|
421
|
+
try {
|
|
422
|
+
const e = await R.getLastNClosings(30);
|
|
423
|
+
$.value = e;
|
|
424
|
+
} catch (e) {
|
|
425
|
+
console.error("Error fetching recent closings:", e), x.open({
|
|
426
|
+
title: o("common.error"),
|
|
427
|
+
message: "Failed to fetch recent closings",
|
|
428
|
+
type: "error"
|
|
429
|
+
});
|
|
430
|
+
} finally {
|
|
431
|
+
s.value = !1;
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
async function K() {
|
|
435
|
+
try {
|
|
436
|
+
const e = await R.getLastNStockSnapshots(30);
|
|
437
|
+
E.value = e;
|
|
438
|
+
} catch (e) {
|
|
439
|
+
console.error("Error fetching recent snapshots:", e);
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
async function W() {
|
|
443
|
+
C.value = !0;
|
|
444
|
+
try {
|
|
445
|
+
const e = await L.recalculation.recalculationRequests();
|
|
446
|
+
r.value = e;
|
|
447
|
+
} catch (e) {
|
|
448
|
+
console.error("Error fetching recalculation requests:", e);
|
|
449
|
+
} finally {
|
|
450
|
+
C.value = !1;
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
async function ae() {
|
|
454
|
+
if (!f.value || !y.value) {
|
|
455
|
+
v.value = [];
|
|
456
|
+
return;
|
|
457
|
+
}
|
|
458
|
+
A.value = !0;
|
|
459
|
+
try {
|
|
460
|
+
const e = new Date(y.value);
|
|
461
|
+
e.setHours(23, 59, 59, 999);
|
|
462
|
+
const m = await L.recalculation.getAffectedClosingDrafts(
|
|
463
|
+
f.value,
|
|
464
|
+
e.toISOString()
|
|
465
|
+
);
|
|
466
|
+
v.value = m;
|
|
467
|
+
} catch {
|
|
468
|
+
x.open({
|
|
469
|
+
title: o("common.error"),
|
|
470
|
+
message: "Failed to fetch affected closing drafts",
|
|
471
|
+
type: "error"
|
|
472
|
+
}), v.value = [];
|
|
473
|
+
} finally {
|
|
474
|
+
A.value = !1;
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
re(
|
|
478
|
+
[f, y],
|
|
479
|
+
() => {
|
|
480
|
+
f.value && y.value && !z.value ? ae() : v.value = [];
|
|
481
|
+
},
|
|
482
|
+
{ immediate: !1 }
|
|
483
|
+
);
|
|
484
|
+
async function u() {
|
|
485
|
+
if (!(!M.value || !y.value)) {
|
|
486
|
+
s.value = !0;
|
|
487
|
+
try {
|
|
488
|
+
const e = new Date(y.value);
|
|
489
|
+
if (e.setHours(23, 59, 59, 999), await L.recalculation.scheduleRecalculation({
|
|
490
|
+
openingId: f.value,
|
|
491
|
+
untilDate: e.toISOString(),
|
|
492
|
+
recalculateBySnapshot: !0
|
|
493
|
+
}), v.value.length > 0) {
|
|
494
|
+
const m = v.value.map((O) => O._id);
|
|
495
|
+
await L.recalculation.scheduleInvalidateClosingDraftCache(m);
|
|
496
|
+
}
|
|
497
|
+
x.open({
|
|
498
|
+
title: o("common.success"),
|
|
499
|
+
message: "Stock recalculation has been scheduled successfully",
|
|
500
|
+
type: "success"
|
|
501
|
+
}), await W(), S.value = !1, T("submitted");
|
|
502
|
+
} catch (e) {
|
|
503
|
+
console.error("Error scheduling recalculation:", e), x.open({
|
|
504
|
+
title: o("common.error"),
|
|
505
|
+
message: "Failed to schedule stock recalculation",
|
|
506
|
+
type: "error"
|
|
507
|
+
});
|
|
508
|
+
} finally {
|
|
509
|
+
s.value = !1;
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
return (e, m) => {
|
|
514
|
+
const O = w("FmButton"), X = w("FmSelect"), Z = w("FmDatePicker"), q = w("FmSnackbar"), d = w("FmAlert"), t = w("FmDialog");
|
|
515
|
+
return i(), p("div", null, [
|
|
516
|
+
e.showButton ? (i(), j(O, {
|
|
517
|
+
key: 0,
|
|
518
|
+
"prepend-icon": "info",
|
|
519
|
+
variant: "tertiary",
|
|
520
|
+
onClick: pe(Y, ["stop"])
|
|
521
|
+
})) : _("", !0),
|
|
522
|
+
h(t, {
|
|
523
|
+
modelValue: S.value,
|
|
524
|
+
"onUpdate:modelValue": m[4] || (m[4] = (n) => S.value = n),
|
|
525
|
+
"close-button": "",
|
|
526
|
+
dismissAway: "",
|
|
527
|
+
"max-width": "600px"
|
|
528
|
+
}, {
|
|
529
|
+
"dialog-header": F(() => [
|
|
530
|
+
a("div", st, l(c(o)("inventory.stock.recalculation.title")), 1)
|
|
531
|
+
]),
|
|
532
|
+
"dialog-footer": F(() => [
|
|
533
|
+
J.value ? (i(), p("div", Ot, [
|
|
534
|
+
h(O, {
|
|
535
|
+
variant: "tertiary",
|
|
536
|
+
onClick: m[3] || (m[3] = (n) => S.value = !1),
|
|
537
|
+
label: c(o)("common.close")
|
|
538
|
+
}, null, 8, ["label"])
|
|
539
|
+
])) : (i(), p("div", Lt, [
|
|
540
|
+
h(O, {
|
|
541
|
+
variant: "tertiary",
|
|
542
|
+
onClick: m[2] || (m[2] = (n) => S.value = !1),
|
|
543
|
+
disabled: s.value,
|
|
544
|
+
label: c(o)("common.cancel")
|
|
545
|
+
}, null, 8, ["disabled", "label"]),
|
|
546
|
+
h(O, {
|
|
547
|
+
variant: "primary",
|
|
548
|
+
onClick: u,
|
|
549
|
+
disabled: !M.value || s.value,
|
|
550
|
+
loading: s.value,
|
|
551
|
+
label: c(o)("inventory.stock.recalculation.schedule")
|
|
552
|
+
}, null, 8, ["disabled", "loading", "label"])
|
|
553
|
+
]))
|
|
554
|
+
]),
|
|
555
|
+
default: F(() => [
|
|
556
|
+
a("div", it, [
|
|
557
|
+
a("div", ct, l(c(o)("inventory.stock.recalculation.description")), 1),
|
|
558
|
+
J.value ? _("", !0) : (i(), p(G, { key: 0 }, [
|
|
559
|
+
a("div", rt, [
|
|
560
|
+
a("p", dt, [
|
|
561
|
+
te(l(c(o)("inventory.stock.recalculation.openingDate")) + " ", 1),
|
|
562
|
+
m[5] || (m[5] = a("span", { class: "text-fm-color-system-error-300" }, "*", -1))
|
|
563
|
+
]),
|
|
564
|
+
m[6] || (m[6] = a("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)),
|
|
565
|
+
h(X, {
|
|
566
|
+
modelValue: f.value,
|
|
567
|
+
"onUpdate:modelValue": m[0] || (m[0] = (n) => f.value = n),
|
|
568
|
+
items: B.value,
|
|
569
|
+
placeholder: c(o)("inventory.stock.recalculation.selectOpening"),
|
|
570
|
+
loading: s.value,
|
|
571
|
+
disabled: s.value
|
|
572
|
+
}, null, 8, ["modelValue", "items", "placeholder", "loading", "disabled"])
|
|
573
|
+
]),
|
|
574
|
+
a("div", ut, [
|
|
575
|
+
a("p", mt, [
|
|
576
|
+
te(l(c(o)("inventory.stock.recalculation.untilDate")) + " ", 1),
|
|
577
|
+
m[7] || (m[7] = a("span", { class: "text-fm-color-system-error-300" }, "*", -1))
|
|
578
|
+
]),
|
|
579
|
+
m[8] || (m[8] = a("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)),
|
|
580
|
+
h(Z, {
|
|
581
|
+
modelValue: y.value,
|
|
582
|
+
"onUpdate:modelValue": m[1] || (m[1] = (n) => y.value = n),
|
|
583
|
+
placeholder: c(o)("inventory.stock.recalculation.selectDate"),
|
|
584
|
+
min: N.value,
|
|
585
|
+
disabled: !f.value || s.value
|
|
586
|
+
}, null, 8, ["modelValue", "placeholder", "min", "disabled"]),
|
|
587
|
+
z.value ? (i(), p("div", ft, l(z.value), 1)) : _("", !0),
|
|
588
|
+
U.value ? (i(), j(q, {
|
|
589
|
+
key: 1,
|
|
590
|
+
title: "Warning",
|
|
591
|
+
variant: "warning",
|
|
592
|
+
description: "You have selected today or a future date. The stock balance will be refreshed accordingly."
|
|
593
|
+
})) : _("", !0)
|
|
594
|
+
]),
|
|
595
|
+
f.value && y.value && !z.value ? (i(), j(d, {
|
|
596
|
+
key: 0,
|
|
597
|
+
type: "info"
|
|
598
|
+
}, {
|
|
599
|
+
default: F(() => [
|
|
600
|
+
a("div", yt, l(c(o)("inventory.stock.recalculation.info")), 1)
|
|
601
|
+
]),
|
|
602
|
+
_: 1
|
|
603
|
+
})) : _("", !0),
|
|
604
|
+
v.value.length > 0 ? (i(), p("div", pt, [
|
|
605
|
+
A.value ? (i(), p("div", vt, " Loading affected closing drafts... ")) : (i(), p("div", gt, [
|
|
606
|
+
a("div", ht, " Affected closing draft(s): " + l(v.value.length), 1),
|
|
607
|
+
a("div", _t, [
|
|
608
|
+
(i(!0), p(G, null, le(v.value, (n) => (i(), p("div", {
|
|
609
|
+
key: n._id,
|
|
610
|
+
class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
|
|
611
|
+
}, [
|
|
612
|
+
m[9] || (m[9] = te(" • ")),
|
|
613
|
+
n.closingId && I.value.get(n.closingId) ? (i(), p("span", bt, l(I.value.get(n.closingId)), 1)) : (i(), p("span", kt, l(n._id), 1)),
|
|
614
|
+
n.effectiveAt ? (i(), p("span", xt, " (" + l(new Date(n.effectiveAt).toLocaleString()) + ") ", 1)) : _("", !0)
|
|
615
|
+
]))), 128))
|
|
616
|
+
])
|
|
617
|
+
]))
|
|
618
|
+
])) : _("", !0)
|
|
619
|
+
], 64)),
|
|
620
|
+
r.value.length > 0 ? (i(), p("div", Dt, [
|
|
621
|
+
a("p", St, l(c(o)("inventory.stock.recalculation.recentRequests")), 1),
|
|
622
|
+
a("div", wt, [
|
|
623
|
+
(i(!0), p(G, null, le(r.value, (n) => {
|
|
624
|
+
var H;
|
|
625
|
+
return i(), p("div", {
|
|
626
|
+
key: n._id,
|
|
627
|
+
class: "p-12 border border-fm-color-border-primary rounded-8 flex flex-col gap-4"
|
|
628
|
+
}, [
|
|
629
|
+
a("div", Vt, [
|
|
630
|
+
a("div", $t, l(c(o)("inventory.stock.recalculation.requestedAt")) + ": " + l(new Date(n.createdAt).toLocaleString()), 1),
|
|
631
|
+
a("div", Ct, [
|
|
632
|
+
(H = n.meta) != null && H.openingType ? (i(), p("div", At, l(n.meta.openingType === "stockSnapshot" ? "Snapshot" : "Closing"), 1)) : _("", !0),
|
|
633
|
+
a("div", {
|
|
634
|
+
class: ve(["fm-typo-en-body-xs-600 px-8 py-4 rounded-4", {
|
|
635
|
+
"bg-fm-color-system-error-100 text-fm-color-system-error-500": n.failedReason,
|
|
636
|
+
"bg-fm-color-system-success-100 text-fm-color-system-success-500": n.completedAt,
|
|
637
|
+
"bg-fm-color-system-info-100 text-fm-color-system-info-500": !n.failedReason && !n.completedAt
|
|
638
|
+
}])
|
|
639
|
+
}, l(n.failedReason ? c(o)("inventory.stock.recalculation.status.failed") : n.completedAt ? c(o)("inventory.stock.recalculation.status.completed") : c(o)("inventory.stock.recalculation.status.inProgress")), 3)
|
|
640
|
+
])
|
|
641
|
+
]),
|
|
642
|
+
a("div", Ft, l(c(o)("inventory.stock.recalculation.from")) + ": " + l(new Date(n.recalculateStartDate).toLocaleDateString()), 1),
|
|
643
|
+
a("div", Rt, l(c(o)("inventory.stock.recalculation.to")) + ": " + l(new Date(n.recalculateEndDate).toLocaleDateString()), 1),
|
|
644
|
+
n.createdBy ? (i(), p("div", Bt, l(c(o)("inventory.stock.recalculation.requestedBy")) + ": " + l(n.createdBy.name || n.createdBy.id), 1)) : _("", !0),
|
|
645
|
+
n.completedAt ? (i(), p("div", It, l(c(o)("inventory.stock.recalculation.completedAt")) + ": " + l(new Date(n.completedAt).toLocaleString()), 1)) : _("", !0),
|
|
646
|
+
n.failedReason ? (i(), p("div", Tt, l(n.failedReason), 1)) : _("", !0)
|
|
647
|
+
]);
|
|
648
|
+
}), 128))
|
|
649
|
+
])
|
|
650
|
+
])) : _("", !0)
|
|
651
|
+
])
|
|
652
|
+
]),
|
|
653
|
+
_: 1
|
|
654
|
+
}, 8, ["modelValue"])
|
|
655
|
+
]);
|
|
656
|
+
};
|
|
657
|
+
}
|
|
658
|
+
}), Et = { class: "fm-typo-en-heading-lg-600" }, Ut = { class: "flex flex-col gap-16" }, Nt = { class: "flex flex-col gap-4" }, Mt = { class: "fm-typo-en-label-md-400 text-fm-color-typo-secondary" }, Kt = { class: "fm-typo-en-body-md-400" }, Ht = { class: "flex flex-col gap-4" }, jt = { class: "fm-typo-en-label-md-400 text-fm-color-typo-secondary" }, zt = { class: "fm-typo-en-body-md-400" }, Wt = { class: "flex flex-col gap-4" }, Yt = { class: "fm-typo-en-label-md-400 text-fm-color-typo-secondary" }, Gt = { class: "flex gap-8 ml-auto" }, Jt = /* @__PURE__ */ se({
|
|
659
|
+
__name: "ClosingDetailDialog",
|
|
660
|
+
props: {
|
|
661
|
+
modelValue: { type: Boolean },
|
|
662
|
+
type: {},
|
|
663
|
+
data: {}
|
|
664
|
+
},
|
|
665
|
+
emits: ["update:modelValue"],
|
|
666
|
+
setup(ne, { emit: b }) {
|
|
667
|
+
const { t: k } = ie(), T = De(), o = ne, L = b, R = D({
|
|
668
|
+
get: () => o.modelValue,
|
|
669
|
+
set: (s) => L("update:modelValue", s)
|
|
670
|
+
}), x = g("");
|
|
671
|
+
re(R, (s) => {
|
|
672
|
+
s || (x.value = "");
|
|
673
|
+
});
|
|
674
|
+
const S = D(() => {
|
|
675
|
+
var s;
|
|
676
|
+
return ((s = o.data) == null ? void 0 : s.skus) ?? [];
|
|
677
|
+
}), f = D(() => {
|
|
678
|
+
var v;
|
|
679
|
+
const s = (v = o.data) == null ? void 0 : v._id;
|
|
680
|
+
if (!s) return "-";
|
|
681
|
+
const r = P(s);
|
|
682
|
+
return new Date(r).toLocaleString();
|
|
683
|
+
}), y = D(() => o.type === "closing" ? k("inventory.closing.history.closingDetail", "Closing Detail") : k("inventory.closing.history.snapshotDetail", "Snapshot Detail")), $ = D(() => S.value.map((s) => {
|
|
684
|
+
const r = T.skuById[s.id] ?? null, C = !r;
|
|
685
|
+
return {
|
|
686
|
+
id: s.id,
|
|
687
|
+
sku: r,
|
|
688
|
+
skuName: (r == null ? void 0 : r.name) ?? s.id,
|
|
689
|
+
skuCode: (r == null ? void 0 : r.code) ?? "-",
|
|
690
|
+
balance: s.balance ?? { amount: 0, precision: 0 },
|
|
691
|
+
isMissing: C,
|
|
692
|
+
costs: s.costs,
|
|
693
|
+
weightedAverage: s.weightedAverage
|
|
694
|
+
};
|
|
695
|
+
})), E = [
|
|
696
|
+
{
|
|
697
|
+
accessorKey: "skuName",
|
|
698
|
+
header: () => k("inventory.ingredient.name", "Ingredient Name"),
|
|
699
|
+
cell: (s) => {
|
|
700
|
+
const r = s.row.original;
|
|
701
|
+
return r.isMissing ? ee("div", { class: "flex items-center gap-8" }, [
|
|
702
|
+
ee("span", {}, r.id),
|
|
703
|
+
ee(
|
|
704
|
+
"span",
|
|
705
|
+
{
|
|
706
|
+
class: "px-8 py-2 rounded-4 bg-fm-color-danger-weak text-fm-color-danger-default fm-typo-en-label-sm-400"
|
|
707
|
+
},
|
|
708
|
+
"Missing"
|
|
709
|
+
)
|
|
710
|
+
]) : s.getValue();
|
|
711
|
+
}
|
|
712
|
+
},
|
|
713
|
+
{
|
|
714
|
+
accessorKey: "skuCode",
|
|
715
|
+
header: () => k("inventory.ingredient.code", "Code")
|
|
716
|
+
},
|
|
717
|
+
{
|
|
718
|
+
id: "balance",
|
|
719
|
+
header: () => k("inventory.closing.history.balance", "Balance"),
|
|
720
|
+
cell: (s) => {
|
|
721
|
+
var v;
|
|
722
|
+
const r = s.row.original;
|
|
723
|
+
if (r.isMissing || !((v = r.sku) != null && v.unit))
|
|
724
|
+
return `${r.balance.amount / Math.pow(10, r.balance.precision)}`;
|
|
725
|
+
const C = {
|
|
726
|
+
unit: r.sku.unit,
|
|
727
|
+
sku: r.sku,
|
|
728
|
+
amount: r.balance,
|
|
729
|
+
defaultTrackingMeasurement: r.sku.trackingMeasurement ?? void 0
|
|
730
|
+
};
|
|
731
|
+
return ee(Ce, C);
|
|
732
|
+
},
|
|
733
|
+
size: 180
|
|
734
|
+
},
|
|
735
|
+
{
|
|
736
|
+
accessorKey: "weightedAverage",
|
|
737
|
+
header: () => k("inventory.closing.history.weightedAvgCost", "Weighted Avg Cost"),
|
|
738
|
+
cell: (s) => {
|
|
739
|
+
const r = s.getValue();
|
|
740
|
+
if (!r) return "-";
|
|
741
|
+
const C = r.amount ?? 0, v = r.precision ?? 0, A = r.currency ?? "", B = C / Math.pow(10, v);
|
|
742
|
+
return `${A} ${B.toFixed(2)}`;
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
];
|
|
746
|
+
return (s, r) => {
|
|
747
|
+
const C = w("FmTextField"), v = w("FmTable"), A = w("FmButton"), B = w("FmDialog");
|
|
748
|
+
return i(), j(B, {
|
|
749
|
+
modelValue: R.value,
|
|
750
|
+
"onUpdate:modelValue": r[2] || (r[2] = (I) => R.value = I),
|
|
751
|
+
"close-button": "",
|
|
752
|
+
dismissAway: "",
|
|
753
|
+
"max-width": "900px"
|
|
754
|
+
}, {
|
|
755
|
+
"dialog-header": F(() => [
|
|
756
|
+
a("div", Et, l(y.value), 1)
|
|
757
|
+
]),
|
|
758
|
+
default: F(() => {
|
|
759
|
+
var I;
|
|
760
|
+
return [
|
|
761
|
+
a("div", Ut, [
|
|
762
|
+
a("div", Nt, [
|
|
763
|
+
a("div", Mt, l(o.type === "closing" ? c(k)("inventory.closing.history.closingId") : c(k)("inventory.closing.history.snapshotId", "Snapshot ID")), 1),
|
|
764
|
+
a("div", Kt, l(((I = o.data) == null ? void 0 : I._id) ?? "-"), 1)
|
|
765
|
+
]),
|
|
766
|
+
a("div", Ht, [
|
|
767
|
+
a("div", jt, l(c(k)("inventory.closing.history.date")), 1),
|
|
768
|
+
a("div", zt, l(f.value), 1)
|
|
769
|
+
]),
|
|
770
|
+
a("div", Wt, [
|
|
771
|
+
a("div", Yt, l(c(k)("inventory.closing.history.ingredientBalances", "Ingredient Balances")) + " (" + l(S.value.length) + ") ", 1),
|
|
772
|
+
h(C, {
|
|
773
|
+
modelValue: x.value,
|
|
774
|
+
"onUpdate:modelValue": r[0] || (r[0] = (N) => x.value = N),
|
|
775
|
+
placeholder: "Filter by code or name"
|
|
776
|
+
}, null, 8, ["modelValue"]),
|
|
777
|
+
h(v, {
|
|
778
|
+
"row-data": $.value,
|
|
779
|
+
"column-defs": E,
|
|
780
|
+
pagination: { pageSize: 10 },
|
|
781
|
+
"search-value": x.value
|
|
782
|
+
}, null, 8, ["row-data", "search-value"])
|
|
783
|
+
])
|
|
784
|
+
])
|
|
785
|
+
];
|
|
786
|
+
}),
|
|
787
|
+
"dialog-footer": F(() => [
|
|
788
|
+
a("div", Gt, [
|
|
789
|
+
h(A, {
|
|
790
|
+
variant: "tertiary",
|
|
791
|
+
onClick: r[1] || (r[1] = (I) => R.value = !1),
|
|
792
|
+
label: "Close"
|
|
793
|
+
})
|
|
794
|
+
])
|
|
795
|
+
]),
|
|
796
|
+
_: 1
|
|
797
|
+
}, 8, ["modelValue"]);
|
|
798
|
+
};
|
|
799
|
+
}
|
|
800
|
+
}), Qt = { class: "flex flex-col gap-16 p-16" }, Xt = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Zt = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, qt = { class: "flex flex-col gap-16" }, eo = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, to = { class: "flex gap-8 ml-auto" }, yo = /* @__PURE__ */ se({
|
|
801
|
+
__name: "ClosingHistoryView",
|
|
802
|
+
setup(ne) {
|
|
803
|
+
var Z, q;
|
|
804
|
+
const { t: b } = ie(), k = de(), T = Se(), o = xe(), L = Ve(), R = ue(), x = g("closings"), S = D(() => [
|
|
805
|
+
{ label: b("inventory.closing.history.closingsTab"), value: "closings" },
|
|
806
|
+
{ label: b("inventory.closing.history.snapshotsTab"), value: "snapshots" }
|
|
807
|
+
]), f = g([]), y = g(0), $ = g([]), E = g(0);
|
|
808
|
+
let s = T.currentLocationDBName;
|
|
809
|
+
async function r(d) {
|
|
810
|
+
return T.currentLocationDBName ? (s = T.currentLocationDBName, k.listClosingsPage(d)) : { docs: [], nextStartkey: null, hasMore: !1 };
|
|
811
|
+
}
|
|
812
|
+
async function C(d) {
|
|
813
|
+
return T.currentLocationDBName ? (s = T.currentLocationDBName, k.listStockSnapshotsPage(d)) : { docs: [], nextStartkey: null, hasMore: !1 };
|
|
814
|
+
}
|
|
815
|
+
function v() {
|
|
816
|
+
f.value = [], y.value++;
|
|
817
|
+
}
|
|
818
|
+
function A() {
|
|
819
|
+
$.value = [], E.value++;
|
|
820
|
+
}
|
|
821
|
+
const B = g(!1), I = g("closing"), N = g(null);
|
|
822
|
+
function z(d) {
|
|
823
|
+
return [
|
|
824
|
+
d.getFullYear(),
|
|
825
|
+
String(d.getMonth() + 1).padStart(2, "0"),
|
|
826
|
+
String(d.getDate()).padStart(2, "0")
|
|
827
|
+
].join("-");
|
|
828
|
+
}
|
|
829
|
+
const U = () => z(new Date(Date.now() - 864e5)), M = g(U()), J = D(() => {
|
|
830
|
+
const d = [];
|
|
831
|
+
return x.value === "closings" ? d.push(
|
|
832
|
+
{
|
|
833
|
+
label: b("inventory.stock.recalculation.title"),
|
|
834
|
+
value: "recalculation",
|
|
835
|
+
prependIcon: "history",
|
|
836
|
+
isAdminOnly: !0
|
|
837
|
+
},
|
|
838
|
+
{
|
|
839
|
+
label: b("inventory.closing.history.initiate_opening"),
|
|
840
|
+
value: "initiateOpening",
|
|
841
|
+
prependIcon: "add_box",
|
|
842
|
+
isAdminOnly: !0
|
|
843
|
+
},
|
|
844
|
+
{
|
|
845
|
+
label: "Refresh",
|
|
846
|
+
value: "refreshOpening",
|
|
847
|
+
prependIcon: "refresh"
|
|
848
|
+
}
|
|
849
|
+
) : d.push(
|
|
850
|
+
{
|
|
851
|
+
label: `${b("inventory.stock.recalculation.title")} (BETA)`,
|
|
852
|
+
value: "recalculation",
|
|
853
|
+
prependIcon: "history",
|
|
854
|
+
isAdminOnly: !0
|
|
855
|
+
},
|
|
856
|
+
{
|
|
857
|
+
label: `${b("inventory.closing.history.initiate_snapshot")} (BETA)`,
|
|
858
|
+
value: "initiateStockSnapshot",
|
|
859
|
+
prependIcon: "camera",
|
|
860
|
+
isAdminOnly: !0
|
|
861
|
+
},
|
|
862
|
+
{
|
|
863
|
+
label: "Refresh",
|
|
864
|
+
value: "refreshStockSnapshot",
|
|
865
|
+
prependIcon: "refresh"
|
|
866
|
+
}
|
|
867
|
+
), d;
|
|
868
|
+
}), Y = g(), Q = g();
|
|
869
|
+
function oe(d) {
|
|
870
|
+
var t, n;
|
|
871
|
+
switch (d) {
|
|
872
|
+
case "recalculation":
|
|
873
|
+
return x.value === "closings" ? (t = Y.value) == null ? void 0 : t.open() : (n = Q.value) == null ? void 0 : n.open();
|
|
874
|
+
case "initiateOpening": {
|
|
875
|
+
L.open({
|
|
876
|
+
title: "Initiate Opening Balance",
|
|
877
|
+
message: "Initiate opening balance if no opening balance exists for the current location.",
|
|
878
|
+
primaryActions: { text: "Confirm", close: !0 }
|
|
879
|
+
}).onPrimary(async () => {
|
|
880
|
+
try {
|
|
881
|
+
await k.initiateClosing(), R.open({
|
|
882
|
+
message: "Opening balance initiated successfully.",
|
|
883
|
+
type: "success"
|
|
884
|
+
}), await v();
|
|
885
|
+
} catch (H) {
|
|
886
|
+
R.open({
|
|
887
|
+
message: H.message || "Failed to initiate opening balance. Please try again.",
|
|
888
|
+
type: "error"
|
|
889
|
+
});
|
|
890
|
+
}
|
|
891
|
+
});
|
|
892
|
+
break;
|
|
893
|
+
}
|
|
894
|
+
case "initiateStockSnapshot": {
|
|
895
|
+
M.value = U(), K.value = !0;
|
|
896
|
+
break;
|
|
897
|
+
}
|
|
898
|
+
case "refreshOpening": {
|
|
899
|
+
v();
|
|
900
|
+
break;
|
|
901
|
+
}
|
|
902
|
+
case "refreshStockSnapshot": {
|
|
903
|
+
A();
|
|
904
|
+
break;
|
|
905
|
+
}
|
|
906
|
+
}
|
|
907
|
+
}
|
|
908
|
+
const K = g(!1), W = g(!1), ae = U();
|
|
909
|
+
async function u() {
|
|
910
|
+
W.value = !0;
|
|
911
|
+
try {
|
|
912
|
+
await k.initiateStockSnapshot(M.value), R.open({
|
|
913
|
+
message: "Stock snapshot created successfully.",
|
|
914
|
+
type: "success"
|
|
915
|
+
}), K.value = !1, await A();
|
|
916
|
+
} catch (d) {
|
|
917
|
+
R.open({
|
|
918
|
+
message: d.message || "Failed to create stock snapshot. Please try again.",
|
|
919
|
+
type: "error"
|
|
920
|
+
});
|
|
921
|
+
} finally {
|
|
922
|
+
W.value = !1;
|
|
923
|
+
}
|
|
924
|
+
}
|
|
925
|
+
const e = [
|
|
926
|
+
...(Z = o.sessionUser.value) != null && Z.role.isAdmin ? [
|
|
927
|
+
{
|
|
928
|
+
accessorKey: "_id",
|
|
929
|
+
header: () => ee(fe, {}, () => `${b("inventory.closing.history.closingId")}`),
|
|
930
|
+
cell: (d) => d.getValue()
|
|
931
|
+
}
|
|
932
|
+
] : [],
|
|
933
|
+
{
|
|
934
|
+
accessorKey: "_id",
|
|
935
|
+
id: "date",
|
|
936
|
+
header: () => b("inventory.closing.history.date"),
|
|
937
|
+
cell: (d) => {
|
|
938
|
+
const t = d.getValue(), n = P(t);
|
|
939
|
+
return new Date(n).toLocaleDateString();
|
|
940
|
+
}
|
|
941
|
+
},
|
|
942
|
+
{
|
|
943
|
+
accessorKey: "_id",
|
|
944
|
+
id: "time",
|
|
945
|
+
header: () => b("inventory.closing.history.time"),
|
|
946
|
+
cell: (d) => {
|
|
947
|
+
const t = d.getValue(), n = P(t);
|
|
948
|
+
return new Date(n).toLocaleTimeString();
|
|
949
|
+
}
|
|
950
|
+
},
|
|
951
|
+
{
|
|
952
|
+
accessorKey: "ref",
|
|
953
|
+
header: () => b("inventory.closing.history.createdFrom"),
|
|
954
|
+
cell: (d) => d.getValue() || "-"
|
|
955
|
+
}
|
|
956
|
+
], m = [
|
|
957
|
+
...(q = o.sessionUser.value) != null && q.role.isAdmin ? [
|
|
958
|
+
{
|
|
959
|
+
accessorKey: "_id",
|
|
960
|
+
header: () => ee(
|
|
961
|
+
fe,
|
|
962
|
+
{},
|
|
963
|
+
() => `${b("inventory.closing.history.snapshotId", "Snapshot ID")}`
|
|
964
|
+
),
|
|
965
|
+
cell: (d) => d.getValue()
|
|
966
|
+
}
|
|
967
|
+
] : [],
|
|
968
|
+
{
|
|
969
|
+
accessorKey: "_id",
|
|
970
|
+
id: "date",
|
|
971
|
+
header: () => b("inventory.closing.history.date"),
|
|
972
|
+
cell: (d) => {
|
|
973
|
+
const t = d.getValue(), n = P(t);
|
|
974
|
+
return new Date(n).toLocaleDateString();
|
|
975
|
+
}
|
|
976
|
+
},
|
|
977
|
+
{
|
|
978
|
+
accessorKey: "_id",
|
|
979
|
+
id: "time",
|
|
980
|
+
header: () => b("inventory.closing.history.time"),
|
|
981
|
+
cell: (d) => {
|
|
982
|
+
const t = d.getValue(), n = P(t);
|
|
983
|
+
return new Date(n).toLocaleTimeString();
|
|
984
|
+
}
|
|
985
|
+
},
|
|
986
|
+
{
|
|
987
|
+
accessorKey: "remark",
|
|
988
|
+
header: () => b("inventory.closing.history.createdFrom"),
|
|
989
|
+
cell: (d) => d.getValue() || "-"
|
|
990
|
+
}
|
|
991
|
+
];
|
|
992
|
+
async function O(d, t) {
|
|
993
|
+
const n = await k.getClosingById(d, t);
|
|
994
|
+
if (!n) throw new Error(`Closing ${d} not found`);
|
|
995
|
+
return I.value = "closing", N.value = n, B.value = !0, n;
|
|
996
|
+
}
|
|
997
|
+
async function X(d, t) {
|
|
998
|
+
const n = await k.getStockSnapshotById(d, t);
|
|
999
|
+
if (!n) throw new Error(`Stock snapshot ${d} not found`);
|
|
1000
|
+
return I.value = "snapshot", N.value = n, B.value = !0, n;
|
|
1001
|
+
}
|
|
1002
|
+
return T.watchLocation(async () => {
|
|
1003
|
+
(T.currentLocationDBName || void 0) !== s && (v(), A());
|
|
1004
|
+
}), (d, t) => {
|
|
1005
|
+
const n = w("FmTabs"), H = w("FmDatePicker"), me = w("FmButton"), _e = w("FmDialog");
|
|
1006
|
+
return i(), j(ke, {
|
|
1007
|
+
actions: J.value,
|
|
1008
|
+
title: c(b)("inventory.closing.history.title"),
|
|
1009
|
+
"onClick:action": oe
|
|
1010
|
+
}, {
|
|
1011
|
+
default: F(() => [
|
|
1012
|
+
a("div", Qt, [
|
|
1013
|
+
h(we, {
|
|
1014
|
+
"change-location": "",
|
|
1015
|
+
"hide-filter-options": !0
|
|
1016
|
+
}),
|
|
1017
|
+
h(n, {
|
|
1018
|
+
"model-value": x.value,
|
|
1019
|
+
"onUpdate:modelValue": t[0] || (t[0] = (V) => x.value = V),
|
|
1020
|
+
items: S.value
|
|
1021
|
+
}, null, 8, ["model-value", "items"]),
|
|
1022
|
+
x.value === "closings" ? (i(), p(G, { key: 0 }, [
|
|
1023
|
+
a("div", Xt, l(c(b)("inventory.closing.history.closingsDescription")), 1),
|
|
1024
|
+
h(ye, {
|
|
1025
|
+
rows: f.value,
|
|
1026
|
+
"onUpdate:rows": t[1] || (t[1] = (V) => f.value = V),
|
|
1027
|
+
"fetch-page": r,
|
|
1028
|
+
"refresh-key": y.value,
|
|
1029
|
+
"column-defs": e,
|
|
1030
|
+
"fetch-detail": (V, ce) => O(V._id, ce)
|
|
1031
|
+
}, null, 8, ["rows", "refresh-key", "fetch-detail"])
|
|
1032
|
+
], 64)) : _("", !0),
|
|
1033
|
+
x.value === "snapshots" ? (i(), p(G, { key: 1 }, [
|
|
1034
|
+
a("div", Zt, l(c(b)("inventory.closing.history.snapshotsDescription")), 1),
|
|
1035
|
+
h(ye, {
|
|
1036
|
+
rows: $.value,
|
|
1037
|
+
"onUpdate:rows": t[2] || (t[2] = (V) => $.value = V),
|
|
1038
|
+
"fetch-page": C,
|
|
1039
|
+
"refresh-key": E.value,
|
|
1040
|
+
"column-defs": m,
|
|
1041
|
+
"fetch-detail": (V, ce) => X(V._id, ce)
|
|
1042
|
+
}, null, 8, ["rows", "refresh-key", "fetch-detail"])
|
|
1043
|
+
], 64)) : _("", !0)
|
|
1044
|
+
]),
|
|
1045
|
+
(i(), j(be, { to: "body" }, [
|
|
1046
|
+
h(lt, {
|
|
1047
|
+
"show-button": !1,
|
|
1048
|
+
ref_key: "recalculationDialogRef",
|
|
1049
|
+
ref: Y,
|
|
1050
|
+
onSubmitted: t[3] || (t[3] = (V) => v())
|
|
1051
|
+
}, null, 512),
|
|
1052
|
+
h(Pt, {
|
|
1053
|
+
"show-button": !1,
|
|
1054
|
+
ref_key: "snapshotRecalculationDialogRef",
|
|
1055
|
+
ref: Q,
|
|
1056
|
+
onSubmitted: t[4] || (t[4] = (V) => A())
|
|
1057
|
+
}, null, 512),
|
|
1058
|
+
h(Jt, {
|
|
1059
|
+
modelValue: B.value,
|
|
1060
|
+
"onUpdate:modelValue": t[5] || (t[5] = (V) => B.value = V),
|
|
1061
|
+
type: I.value,
|
|
1062
|
+
data: N.value
|
|
1063
|
+
}, null, 8, ["modelValue", "type", "data"]),
|
|
1064
|
+
h(_e, {
|
|
1065
|
+
modelValue: K.value,
|
|
1066
|
+
"onUpdate:modelValue": t[8] || (t[8] = (V) => K.value = V),
|
|
1067
|
+
"close-button": "",
|
|
1068
|
+
dismissAway: "",
|
|
1069
|
+
"max-width": "400px"
|
|
1070
|
+
}, {
|
|
1071
|
+
"dialog-header": F(() => t[9] || (t[9] = [
|
|
1072
|
+
a("div", { class: "fm-typo-en-heading-lg-600" }, "Initiate Stock Snapshot", -1)
|
|
1073
|
+
])),
|
|
1074
|
+
default: F(() => [
|
|
1075
|
+
a("div", qt, [
|
|
1076
|
+
a("div", eo, l(c(b)("inventory.closing.history.snapshotsDescription")), 1),
|
|
1077
|
+
h(H, {
|
|
1078
|
+
modelValue: M.value,
|
|
1079
|
+
"onUpdate:modelValue": t[6] || (t[6] = (V) => M.value = V),
|
|
1080
|
+
label: "Snapshot Date",
|
|
1081
|
+
max: c(ae)
|
|
1082
|
+
}, null, 8, ["modelValue", "max"])
|
|
1083
|
+
])
|
|
1084
|
+
]),
|
|
1085
|
+
"dialog-footer": F(() => [
|
|
1086
|
+
a("div", to, [
|
|
1087
|
+
h(me, {
|
|
1088
|
+
variant: "tertiary",
|
|
1089
|
+
onClick: t[7] || (t[7] = (V) => K.value = !1),
|
|
1090
|
+
label: "Cancel",
|
|
1091
|
+
disabled: W.value
|
|
1092
|
+
}, null, 8, ["disabled"]),
|
|
1093
|
+
h(me, {
|
|
1094
|
+
variant: "primary",
|
|
1095
|
+
onClick: u,
|
|
1096
|
+
label: "Confirm",
|
|
1097
|
+
loading: W.value
|
|
1098
|
+
}, null, 8, ["loading"])
|
|
1099
|
+
])
|
|
1100
|
+
]),
|
|
1101
|
+
_: 1
|
|
1102
|
+
}, 8, ["modelValue"])
|
|
1103
|
+
]))
|
|
1104
|
+
]),
|
|
1105
|
+
_: 1
|
|
1106
|
+
}, 8, ["actions", "title"]);
|
|
1107
|
+
};
|
|
1108
|
+
}
|
|
1109
|
+
});
|
|
1110
|
+
export {
|
|
1111
|
+
yo as default
|
|
1112
|
+
};
|