@feedmepos/mf-inventory-portal 1.8.0-dev.7 → 1.8.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/dist/App-C8i7vBxz.js +1466 -0
- package/dist/{ApprovalView-1Y_jh_UJ.js → ApprovalView-GHgTeCBV.js} +9 -9
- package/dist/{BindingsDialog-VMvTLguN.js → BindingsDialog-C4-S2CWk.js} +2 -2
- package/dist/{BindingsPicker-KNRM5rMU.js → BindingsPicker-C7YUArBj.js} +2 -2
- package/dist/{BindingsTable-CSyNlNCL.js → BindingsTable-1Zoqi4ZS.js} +4 -4
- package/dist/{BulkReceiveRequestView-vOeHbWM_.js → BulkReceiveRequestView-Lakk8011.js} +19 -19
- package/dist/{ChangeLocationComponent.vue_vue_type_script_setup_true_lang-DQuI04Yj.js → ChangeLocationComponent.vue_vue_type_script_setup_true_lang-DFSg0-gv.js} +1 -1
- package/dist/{ClosingDraftView-A2pJuhIb.js → ClosingDraftView-CnWFyWSE.js} +20 -20
- package/dist/ClosingHistoryView-Bkm0voU6.js +769 -0
- package/dist/{ClosingTemplateView-DpkNCyoB.js → ClosingTemplateView-Bz81JTsg.js} +18 -18
- package/dist/{CustomPrintTemplatePreview.vue_vue_type_script_setup_true_lang-DOpIDvsy.js → CustomPrintTemplatePreview.vue_vue_type_script_setup_true_lang-6s-24euf.js} +1 -1
- package/dist/{DefaultView-B4UuAqYu.js → DefaultView-1RRzbPB3.js} +2 -2
- package/dist/{DeliveryOrderPrintPreview-w0YcNH3F.js → DeliveryOrderPrintPreview-KcLqjOj1.js} +2 -2
- package/dist/{EmailDialog.vue_vue_type_script_setup_true_lang-BimIEHsW.js → EmailDialog.vue_vue_type_script_setup_true_lang-r0Q0qhoK.js} +663 -661
- package/dist/FeatureCapabilityBadge.vue_vue_type_script_setup_true_lang-Cwmk3NLS.js +47 -0
- package/dist/FeatureCapabilityGate-C6t1VwKD.js +74 -0
- package/dist/{FmDateRangePickerChip.vue_vue_type_script_setup_true_lang--54VR4oB.js → FmDateRangePickerChip.vue_vue_type_script_setup_true_lang-pzIzIWpX.js} +1 -1
- package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-B7j4ZSOe.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-B6cFB4vX.js} +2 -2
- package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-D_y8VcCI.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-D_o6pX9i.js} +2 -2
- package/dist/{FmMultiselectDialog-DMA5eR0C.js → FmMultiselectDialog-CC_Na_p1.js} +2 -2
- package/dist/{FmMultiselectDialog-BnZInvgp.js → FmMultiselectDialog-D0GhmOQ9.js} +2 -2
- package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-BXTUsnwN.js → FmUnitInput.vue_vue_type_script_setup_true_lang-DQlSMRoB.js} +6 -6
- package/dist/{ImportView-C7Hah7MM.js → ImportView-DCcdEvy4.js} +6 -6
- package/dist/{IngredientsView-C4-8qNGD.js → IngredientsView-B2I2OPSb.js} +518 -523
- package/dist/{IntegrationExplorerView-D3leld2Z.js → IntegrationExplorerView-WK1EmwLA.js} +4 -4
- package/dist/{IntegrationView-BhRzry3g.js → IntegrationView-CeaL92Yj.js} +15 -15
- package/dist/{InventoryBindingForm-ewAgZ6e-.js → InventoryBindingForm-DgtaDM0I.js} +1 -1
- package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-Bpo7Yv9A.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-CqDN355J.js} +5 -5
- package/dist/{InventoryBindingSummary-e67GzHYr.js → InventoryBindingSummary-C_W456aj.js} +1 -1
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-CKEzy2Uo.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-BMDjCk9T.js} +1 -1
- package/dist/{FeatureCapabilityBadge.vue_vue_type_script_setup_true_lang-BBkF9lOE.js → PlanTierBadge.vue_vue_type_script_setup_true_lang-BSR_nyHY.js} +71 -94
- package/dist/PlanUpgradeDialog.vue_vue_type_script_setup_true_lang-D6-lo7iI.js +79 -0
- package/dist/{ProductionRunDetailView-Ct7kr5Ht.js → ProductionRunDetailView-C9rxLBbL.js} +4 -4
- package/dist/{ProductionRunLifecycleDialogs.vue_vue_type_script_setup_true_lang-7u0HQH67.js → ProductionRunLifecycleDialogs.vue_vue_type_script_setup_true_lang-DwBY6gIb.js} +7 -7
- package/dist/{ProductionRunView-odWyBZGx.js → ProductionRunView-DvMdVGz1.js} +3 -3
- package/dist/{PublishView-BXA3k8Cp.js → PublishView-Dv-W6ntx.js} +3 -3
- package/dist/{PurchaseOrderPrintPreview-DRugr4BU.js → PurchaseOrderPrintPreview-D1TAnJd_.js} +2 -2
- package/dist/{ReceiveRequestView-CeJs9NTD.js → ReceiveRequestView-Rc_uw_Ad.js} +13 -13
- package/dist/{RecipeView-BH0REMB3.js → RecipeView-ByUaGc4w.js} +16 -16
- package/dist/SettingsView-K5wAt8oo.js +1032 -0
- package/dist/StockView-B3EjdjVx.js +2615 -0
- package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-Ckw1_xIc.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-CsRLy0xI.js} +1 -1
- package/dist/{SupplierView-DH9u6e2M.js → SupplierView-CLVupRN0.js} +298 -296
- package/dist/{SurchargeView-BPVEpc0f.js → SurchargeView-CToB_z5v.js} +7 -7
- package/dist/{SystemTrailDialog.vue_vue_type_script_setup_true_lang-BRwxKmwb.js → SystemTrailDialog.vue_vue_type_script_setup_true_lang-CvqIw9q6.js} +2 -2
- package/dist/{TemplatePublishDialog.vue_vue_type_script_setup_true_lang-BpiePSmo.js → TemplatePublishDialog.vue_vue_type_script_setup_true_lang-BGPuaJlU.js} +1 -1
- package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-DOQGPKiv.js → TransferDetails.vue_vue_type_script_setup_true_lang-8ydaQEw-.js} +785 -769
- package/dist/{TransferTemplateView-CEVRsKL7.js → TransferTemplateView-BnfALwmw.js} +20 -20
- package/dist/{UnitCostHistoryView-06rIaX_M.js → UnitCostHistoryView-BMB2MeTh.js} +4 -4
- package/dist/{UnitDisplayControl.vue_vue_type_script_setup_true_lang-C2zidBrl.js → UnitDisplayControl.vue_vue_type_script_setup_true_lang-Dn8Y8zfp.js} +4 -4
- package/dist/{UnitView-Xk_F9SYG.js → UnitView-Bl8jws6R.js} +8 -8
- package/dist/{WarehouseView-bmpLmpcX.js → WarehouseView-BurSM1jg.js} +8 -8
- package/dist/{WastageTemplateView-CWV1pFxM.js → WastageTemplateView-DRfJ9LGR.js} +15 -15
- package/dist/api/license.d.ts +1 -0
- package/dist/{app-CURawLhs.js → app-Duum3eHx.js} +16 -16
- package/dist/app.js +1 -1
- package/dist/{closing-template-q_KGB4jO.js → closing-template-BE41yfue.js} +1 -1
- package/dist/components/FeatureCapabilityGate.spec.d.ts +1 -0
- package/dist/components/FeatureCapabilityGate.vue.d.ts +2 -0
- package/dist/{date2-3kdweNLp.js → date2-DrhO3BxU.js} +1 -1
- package/dist/{dayjs.min-DHE73-wM.js → dayjs.min-CQp6EpOp.js} +1 -1
- package/dist/{decimal-CAnQe2Ib.js → decimal-Cq0qUT4r.js} +2 -2
- package/dist/{defineDeepModel-CctS67Do.js → defineDeepModel-DRC39nJs.js} +1 -1
- package/dist/{duplicate-template-Jk2V2Ezg.js → duplicate-template-j2ymeDNH.js} +1 -1
- package/dist/{feature-D9n0IC0c.js → feature-C0hQza5A.js} +125 -103
- package/dist/feature-flags/vue.spec.d.ts +1 -0
- package/dist/{format-time-from-id-Bmzpbg-8.js → format-time-from-id-BmJoI3jT.js} +1 -1
- package/dist/{format-unit-display-CVg4Bl5L.js → format-unit-display-CRgIMXsD.js} +13 -13
- package/dist/{id-to-date-DPCcxufP.js → id-to-date-CuFZDvIr.js} +1 -1
- package/dist/{import-export.helper-bmGZwUBB.js → import-export.helper-B43zbsbj.js} +6 -6
- package/dist/{index-zCBA-X6R.js → index-BYDjs08n.js} +1 -1
- package/dist/{index-CFNNQo-7.js → index-Cwvg7EHd.js} +3 -3
- package/dist/{index-yt6MlAFG.js → index-DXNYZeq3.js} +1 -1
- package/dist/{lz-string-CqlY9MC2.js → lz-string-6DgW1cPF.js} +1 -1
- package/dist/{netsuite-DudeltN_.js → netsuite-BSpmyaE1.js} +2 -2
- package/dist/{number-BoePMDs8.js → number-5ZeFx-wN.js} +3 -3
- package/dist/{predefined-templates-DT32p04n.js → predefined-templates-C0jtb4T7.js} +1 -1
- package/dist/{purchase-order-template-LaRpWA04.js → purchase-order-template-B5Pjddfi.js} +1 -1
- package/dist/{recalculationUtils-BYN393eE.js → recalculationUtils-DtJWwWSj.js} +1 -1
- package/dist/{row-action.enum-BiP5wkT6.js → row-action.enum-BDDJNSi0.js} +1 -1
- package/dist/{rules-CQT0uAAo.js → rules-CinZKpvV.js} +2 -2
- package/dist/{stock-CVybjhUm.js → stock-1n-4iyqz.js} +3 -3
- package/dist/{stock-B9XerL9c.js → stock-BKMDvf5S.js} +1 -1
- package/dist/stores/feature.d.ts +5 -0
- package/dist/style.css +1 -1
- package/dist/{supplier-dpHijd2E.js → supplier-Cv8HRNou.js} +2 -2
- package/dist/{surcharge-BZ4STY5J.js → surcharge-ktE1pRyy.js} +1 -1
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{uom-rules-Da5Lngvp.js → uom-rules-DCnXmEkb.js} +1 -1
- package/dist/{use-ingredient-select-dialog-C3YsT5l-.js → use-ingredient-select-dialog-CYUUVrCI.js} +2 -2
- package/dist/{use-inventory-binding-dialog-BSsyrcGe.js → use-inventory-binding-dialog-Dugj9i-6.js} +2 -2
- package/dist/{use-template-enabled-locations-BmJUzSUm.js → use-template-enabled-locations-BlZ7WAqX.js} +2 -2
- package/dist/{use-transfer-locations-frEk_aBH.js → use-transfer-locations-CUDFnsVH.js} +2 -2
- package/dist/{useHrmPermission-Cyjm0y9a.js → useHrmPermission-BOwmXi9H.js} +1 -1
- package/dist/{useNavigationMenu-CnTsOF9T.js → useNavigationMenu-CbNKFBwx.js} +58 -57
- package/dist/{useSseClient-D_7o9nuf.js → useSseClient-CdyQh47h.js} +1 -1
- package/dist/views/settings/PlanLicenseDisplay.spec.d.ts +1 -0
- package/dist/views/settings/PlanLicenseDisplay.vue.d.ts +15 -0
- package/dist/{vue-i18n-DwAcG7yc.js → vue-i18n-dSKy66Jh.js} +169 -169
- package/dist/{xlsx.util-C7S-uyqm.js → xlsx.util-pjzuMquw.js} +2 -2
- package/package.json +5 -5
- package/dist/App-Bo29Nwt0.js +0 -1537
- package/dist/ClosingHistoryView-woRmvmYT.js +0 -761
- package/dist/SettingsView-Dc27wyk-.js +0 -977
- package/dist/StockView-DrHLzosW.js +0 -2616
|
@@ -0,0 +1,769 @@
|
|
|
1
|
+
import { defineComponent as se, ref as p, computed as S, watch as ue, resolveComponent as w, createElementBlock as f, openBlock as u, createVNode as _, withCtx as $, createElementVNode as a, createCommentVNode as F, toDisplayString as l, unref as d, Fragment as G, createBlock as j, createTextVNode as ne, renderList as re, normalizeClass as fe, h as P, Teleport as ge } from "vue";
|
|
2
|
+
import { _ as ve } from "./SingleColumnLayout.vue_vue_type_script_setup_true_lang-DpwneGOV.js";
|
|
3
|
+
import { useI18n as le, useCoreStore as he } from "@feedmepos/mf-common";
|
|
4
|
+
import { G as me, B as M, a as _e, u as be } from "./app-Duum3eHx.js";
|
|
5
|
+
import { F as ce } from "./FmAdminBadge-DlplQOHb.js";
|
|
6
|
+
import { _ as ke } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-D_o6pX9i.js";
|
|
7
|
+
import { _ as de } from "./CursorPaginatedTable.vue_vue_type_script_setup_true_lang-BCUhtL_B.js";
|
|
8
|
+
import { useSnackbar as pe, useDialog as De } from "@feedmepos/ui-library";
|
|
9
|
+
import { u as xe } from "./stock-BKMDvf5S.js";
|
|
10
|
+
import { g as Se, f as we } from "./recalculationUtils-DtJWwWSj.js";
|
|
11
|
+
import { u as Ve } from "./feature-C0hQza5A.js";
|
|
12
|
+
import { F as Ce } from "./FeatureCapabilityGate-C6t1VwKD.js";
|
|
13
|
+
import { _ as Fe } from "./UnitDisplayControl.vue_vue_type_script_setup_true_lang-Dn8Y8zfp.js";
|
|
14
|
+
const Ae = { class: "fm-typo-en-heading-lg-600" }, Ie = { class: "flex flex-col gap-16" }, $e = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Te = { class: "flex flex-col gap-8" }, Be = { class: "fm-typo-en-body-md-600" }, Le = { class: "flex flex-col gap-8" }, Re = { class: "fm-typo-en-body-md-600" }, Ne = {
|
|
15
|
+
key: 0,
|
|
16
|
+
class: "text-red-500 text-sm mt-2"
|
|
17
|
+
}, Oe = { class: "fm-typo-en-body-sm-400" }, Pe = {
|
|
18
|
+
key: 1,
|
|
19
|
+
class: "p-12 border border-fm-color-border-primary rounded-8 bg-fm-color-background-secondary"
|
|
20
|
+
}, Me = {
|
|
21
|
+
key: 0,
|
|
22
|
+
class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
|
|
23
|
+
}, Ke = {
|
|
24
|
+
key: 1,
|
|
25
|
+
class: "flex flex-col gap-8"
|
|
26
|
+
}, Ue = { class: "fm-typo-en-body-sm-600" }, Ee = { class: "flex flex-col gap-4" }, He = { key: 0 }, We = { key: 1 }, ze = { key: 2 }, Ge = {
|
|
27
|
+
key: 1,
|
|
28
|
+
class: "flex flex-col gap-8"
|
|
29
|
+
}, je = { class: "fm-typo-en-body-md-600" }, Ye = { class: "flex flex-col gap-8 max-h-[300px] overflow-y-auto" }, Je = { class: "flex items-center justify-between" }, Qe = { class: "fm-typo-en-body-sm-600" }, Xe = { class: "flex items-center gap-8" }, Ze = {
|
|
30
|
+
key: 0,
|
|
31
|
+
class: "fm-typo-en-body-xs-600 px-8 py-4 rounded-4 bg-fm-color-neutral-100 text-fm-color-typo-secondary"
|
|
32
|
+
}, qe = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, et = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, tt = {
|
|
33
|
+
key: 0,
|
|
34
|
+
class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
|
|
35
|
+
}, ot = {
|
|
36
|
+
key: 1,
|
|
37
|
+
class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
|
|
38
|
+
}, at = {
|
|
39
|
+
key: 2,
|
|
40
|
+
class: "fm-typo-en-body-xs-400 text-fm-color-system-error-500"
|
|
41
|
+
}, nt = {
|
|
42
|
+
key: 0,
|
|
43
|
+
class: "flex gap-8 ml-auto"
|
|
44
|
+
}, st = {
|
|
45
|
+
key: 1,
|
|
46
|
+
class: "flex gap-8 ml-auto"
|
|
47
|
+
}, lt = 15 * 60 * 1e3, it = /* @__PURE__ */ se({
|
|
48
|
+
__name: "RecalculationDialog",
|
|
49
|
+
emits: ["submitted"],
|
|
50
|
+
setup(Z, { expose: g, emit: h }) {
|
|
51
|
+
const A = h, { t: c } = le(), V = xe(), L = me(), x = pe(), C = p(!1), y = p(""), v = p(""), N = p([]), K = p([]), D = p(!1), i = p([]), n = p(!1), m = p([]), b = p(!1), T = S(
|
|
52
|
+
() => Se(N.value, K.value)
|
|
53
|
+
), B = S(() => we(
|
|
54
|
+
m.value.filter((t) => !!t.closingId).map((t) => ({ closingId: t.closingId, draftCreatedAt: new Date(M(t._id)) }))
|
|
55
|
+
)), I = S(() => {
|
|
56
|
+
if (y.value)
|
|
57
|
+
try {
|
|
58
|
+
const t = M(y.value);
|
|
59
|
+
if (t)
|
|
60
|
+
return t;
|
|
61
|
+
} catch (t) {
|
|
62
|
+
console.error("Error parsing date from opening ID:", t);
|
|
63
|
+
}
|
|
64
|
+
}), R = S(() => {
|
|
65
|
+
if (!y.value || !v.value) return "";
|
|
66
|
+
const t = M(y.value);
|
|
67
|
+
if (t && v.value) {
|
|
68
|
+
const r = new Date(t).getTime();
|
|
69
|
+
if (new Date(v.value).getTime() <= r)
|
|
70
|
+
return c("inventory.stock.recalculation.error.endDateBeforeOpening");
|
|
71
|
+
}
|
|
72
|
+
return "";
|
|
73
|
+
}), z = S(() => {
|
|
74
|
+
if (!v.value) return !1;
|
|
75
|
+
const t = new Date(v.value), r = /* @__PURE__ */ new Date();
|
|
76
|
+
return r.setHours(0, 0, 0, 0), t.setHours(0, 0, 0, 0), t >= r;
|
|
77
|
+
}), U = S(() => !!y.value && !!v.value && !R.value), Y = S(() => i.value.some(
|
|
78
|
+
(t) => !t.completedAt && !t.failedReason && Date.now() - new Date(t.createdAt).getTime() < lt
|
|
79
|
+
));
|
|
80
|
+
async function J() {
|
|
81
|
+
C.value = !0, await Promise.all([q(), E(), H()]), y.value = "", v.value = "";
|
|
82
|
+
}
|
|
83
|
+
g({
|
|
84
|
+
open: J
|
|
85
|
+
});
|
|
86
|
+
async function q() {
|
|
87
|
+
D.value = !0;
|
|
88
|
+
try {
|
|
89
|
+
const t = await L.getLastNClosings(30);
|
|
90
|
+
N.value = t;
|
|
91
|
+
} catch (t) {
|
|
92
|
+
console.error("Error fetching recent closings:", t), x.open({
|
|
93
|
+
title: c("common.error"),
|
|
94
|
+
message: "Failed to fetch recent closings",
|
|
95
|
+
type: "error"
|
|
96
|
+
});
|
|
97
|
+
} finally {
|
|
98
|
+
D.value = !1;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
async function E() {
|
|
102
|
+
try {
|
|
103
|
+
const t = await L.getLastNStockSnapshots(30);
|
|
104
|
+
K.value = t;
|
|
105
|
+
} catch (t) {
|
|
106
|
+
console.error("Error fetching recent snapshots:", t);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
async function H() {
|
|
110
|
+
n.value = !0;
|
|
111
|
+
try {
|
|
112
|
+
const t = await V.recalculation.recalculationRequests();
|
|
113
|
+
i.value = t;
|
|
114
|
+
} catch (t) {
|
|
115
|
+
console.error("Error fetching recalculation requests:", t);
|
|
116
|
+
} finally {
|
|
117
|
+
n.value = !1;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
async function ee() {
|
|
121
|
+
if (!y.value || !v.value) {
|
|
122
|
+
m.value = [];
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
b.value = !0;
|
|
126
|
+
try {
|
|
127
|
+
const t = new Date(v.value);
|
|
128
|
+
t.setHours(23, 59, 59, 999);
|
|
129
|
+
const r = await V.recalculation.getAffectedClosingDrafts(
|
|
130
|
+
y.value,
|
|
131
|
+
t.toISOString()
|
|
132
|
+
);
|
|
133
|
+
m.value = r;
|
|
134
|
+
} catch {
|
|
135
|
+
x.open({
|
|
136
|
+
title: c("common.error"),
|
|
137
|
+
message: "Failed to fetch affected closing drafts",
|
|
138
|
+
type: "error"
|
|
139
|
+
}), m.value = [];
|
|
140
|
+
} finally {
|
|
141
|
+
b.value = !1;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
ue(
|
|
145
|
+
[y, v],
|
|
146
|
+
() => {
|
|
147
|
+
y.value && v.value && !R.value ? ee() : m.value = [];
|
|
148
|
+
},
|
|
149
|
+
{ immediate: !1 }
|
|
150
|
+
);
|
|
151
|
+
async function te() {
|
|
152
|
+
if (!(!U.value || !v.value)) {
|
|
153
|
+
D.value = !0;
|
|
154
|
+
try {
|
|
155
|
+
const t = new Date(v.value);
|
|
156
|
+
if (t.setHours(23, 59, 59, 999), await V.recalculation.scheduleRecalculation({
|
|
157
|
+
openingId: y.value,
|
|
158
|
+
untilDate: t.toISOString(),
|
|
159
|
+
recalculateBySnapshot: !0
|
|
160
|
+
}), m.value.length > 0) {
|
|
161
|
+
const r = m.value.map((W) => W._id);
|
|
162
|
+
await V.recalculation.scheduleInvalidateClosingDraftCache(r);
|
|
163
|
+
}
|
|
164
|
+
x.open({
|
|
165
|
+
title: c("common.success"),
|
|
166
|
+
message: "Stock recalculation has been scheduled successfully",
|
|
167
|
+
type: "success"
|
|
168
|
+
}), await H(), C.value = !1, A("submitted");
|
|
169
|
+
} catch (t) {
|
|
170
|
+
console.error("Error scheduling recalculation:", t), x.open({
|
|
171
|
+
title: c("common.error"),
|
|
172
|
+
message: "Failed to schedule stock recalculation",
|
|
173
|
+
type: "error"
|
|
174
|
+
});
|
|
175
|
+
} finally {
|
|
176
|
+
D.value = !1;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
return (t, r) => {
|
|
181
|
+
const W = w("FmSelect"), oe = w("FmDatePicker"), Q = w("FmSnackbar"), X = w("FmAlert"), o = w("FmButton"), s = w("FmDialog");
|
|
182
|
+
return u(), f("div", null, [
|
|
183
|
+
_(s, {
|
|
184
|
+
modelValue: C.value,
|
|
185
|
+
"onUpdate:modelValue": r[4] || (r[4] = (e) => C.value = e),
|
|
186
|
+
"close-button": "",
|
|
187
|
+
dismissAway: "",
|
|
188
|
+
"max-width": "600px"
|
|
189
|
+
}, {
|
|
190
|
+
"dialog-header": $(() => [
|
|
191
|
+
a("div", Ae, l(d(c)("inventory.stock.recalculation.title")), 1)
|
|
192
|
+
]),
|
|
193
|
+
"dialog-footer": $(() => [
|
|
194
|
+
Y.value ? (u(), f("div", st, [
|
|
195
|
+
_(o, {
|
|
196
|
+
variant: "tertiary",
|
|
197
|
+
onClick: r[3] || (r[3] = (e) => C.value = !1),
|
|
198
|
+
label: d(c)("common.close")
|
|
199
|
+
}, null, 8, ["label"])
|
|
200
|
+
])) : (u(), f("div", nt, [
|
|
201
|
+
_(o, {
|
|
202
|
+
variant: "tertiary",
|
|
203
|
+
onClick: r[2] || (r[2] = (e) => C.value = !1),
|
|
204
|
+
disabled: D.value,
|
|
205
|
+
label: d(c)("common.cancel")
|
|
206
|
+
}, null, 8, ["disabled", "label"]),
|
|
207
|
+
_(o, {
|
|
208
|
+
variant: "primary",
|
|
209
|
+
onClick: te,
|
|
210
|
+
disabled: !U.value || D.value,
|
|
211
|
+
loading: D.value,
|
|
212
|
+
label: d(c)("inventory.stock.recalculation.schedule")
|
|
213
|
+
}, null, 8, ["disabled", "loading", "label"])
|
|
214
|
+
]))
|
|
215
|
+
]),
|
|
216
|
+
default: $(() => [
|
|
217
|
+
a("div", Ie, [
|
|
218
|
+
a("div", $e, l(d(c)("inventory.stock.recalculation.description")), 1),
|
|
219
|
+
Y.value ? F("", !0) : (u(), f(G, { key: 0 }, [
|
|
220
|
+
a("div", Te, [
|
|
221
|
+
a("p", Be, [
|
|
222
|
+
ne(l(d(c)("inventory.stock.recalculation.openingDate")) + " ", 1),
|
|
223
|
+
r[5] || (r[5] = a("span", { class: "text-fm-color-system-error-300" }, "*", -1))
|
|
224
|
+
]),
|
|
225
|
+
r[6] || (r[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)),
|
|
226
|
+
_(W, {
|
|
227
|
+
modelValue: y.value,
|
|
228
|
+
"onUpdate:modelValue": r[0] || (r[0] = (e) => y.value = e),
|
|
229
|
+
items: T.value,
|
|
230
|
+
placeholder: d(c)("inventory.stock.recalculation.selectOpening"),
|
|
231
|
+
loading: D.value,
|
|
232
|
+
disabled: D.value
|
|
233
|
+
}, null, 8, ["modelValue", "items", "placeholder", "loading", "disabled"])
|
|
234
|
+
]),
|
|
235
|
+
a("div", Le, [
|
|
236
|
+
a("p", Re, [
|
|
237
|
+
ne(l(d(c)("inventory.stock.recalculation.untilDate")) + " ", 1),
|
|
238
|
+
r[7] || (r[7] = a("span", { class: "text-fm-color-system-error-300" }, "*", -1))
|
|
239
|
+
]),
|
|
240
|
+
r[8] || (r[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)),
|
|
241
|
+
_(oe, {
|
|
242
|
+
modelValue: v.value,
|
|
243
|
+
"onUpdate:modelValue": r[1] || (r[1] = (e) => v.value = e),
|
|
244
|
+
placeholder: d(c)("inventory.stock.recalculation.selectDate"),
|
|
245
|
+
min: I.value,
|
|
246
|
+
disabled: !y.value || D.value
|
|
247
|
+
}, null, 8, ["modelValue", "placeholder", "min", "disabled"]),
|
|
248
|
+
R.value ? (u(), f("div", Ne, l(R.value), 1)) : F("", !0),
|
|
249
|
+
z.value ? (u(), j(Q, {
|
|
250
|
+
key: 1,
|
|
251
|
+
title: "Warning",
|
|
252
|
+
variant: "warning",
|
|
253
|
+
description: "You have selected today or a future date. The stock balance will be refreshed accordingly."
|
|
254
|
+
})) : F("", !0)
|
|
255
|
+
]),
|
|
256
|
+
y.value && v.value && !R.value ? (u(), j(X, {
|
|
257
|
+
key: 0,
|
|
258
|
+
type: "info"
|
|
259
|
+
}, {
|
|
260
|
+
default: $(() => [
|
|
261
|
+
a("div", Oe, l(d(c)("inventory.stock.recalculation.info")), 1)
|
|
262
|
+
]),
|
|
263
|
+
_: 1
|
|
264
|
+
})) : F("", !0),
|
|
265
|
+
m.value.length > 0 ? (u(), f("div", Pe, [
|
|
266
|
+
b.value ? (u(), f("div", Me, " Loading affected closing drafts... ")) : (u(), f("div", Ke, [
|
|
267
|
+
a("div", Ue, " Affected closing draft(s): " + l(m.value.length), 1),
|
|
268
|
+
a("div", Ee, [
|
|
269
|
+
(u(!0), f(G, null, re(m.value, (e) => (u(), f("div", {
|
|
270
|
+
key: e._id,
|
|
271
|
+
class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
|
|
272
|
+
}, [
|
|
273
|
+
r[9] || (r[9] = ne(" • ")),
|
|
274
|
+
e.closingId && B.value.get(e.closingId) ? (u(), f("span", He, l(B.value.get(e.closingId)), 1)) : (u(), f("span", We, l(e._id), 1)),
|
|
275
|
+
e.effectiveAt ? (u(), f("span", ze, " (" + l(new Date(e.effectiveAt).toLocaleString()) + ") ", 1)) : F("", !0)
|
|
276
|
+
]))), 128))
|
|
277
|
+
])
|
|
278
|
+
]))
|
|
279
|
+
])) : F("", !0)
|
|
280
|
+
], 64)),
|
|
281
|
+
i.value.length > 0 ? (u(), f("div", Ge, [
|
|
282
|
+
a("p", je, l(d(c)("inventory.stock.recalculation.recentRequests")), 1),
|
|
283
|
+
a("div", Ye, [
|
|
284
|
+
(u(!0), f(G, null, re(i.value, (e) => {
|
|
285
|
+
var O;
|
|
286
|
+
return u(), f("div", {
|
|
287
|
+
key: e._id,
|
|
288
|
+
class: "p-12 border border-fm-color-border-primary rounded-8 flex flex-col gap-4"
|
|
289
|
+
}, [
|
|
290
|
+
a("div", Je, [
|
|
291
|
+
a("div", Qe, l(d(c)("inventory.stock.recalculation.requestedAt")) + ": " + l(new Date(e.createdAt).toLocaleString()), 1),
|
|
292
|
+
a("div", Xe, [
|
|
293
|
+
(O = e.meta) != null && O.openingType ? (u(), f("div", Ze, l(e.meta.openingType === "stockSnapshot" ? "Snapshot" : "Closing"), 1)) : F("", !0),
|
|
294
|
+
a("div", {
|
|
295
|
+
class: fe(["fm-typo-en-body-xs-600 px-8 py-4 rounded-4", {
|
|
296
|
+
"bg-fm-color-system-error-100 text-fm-color-system-error-500": e.failedReason,
|
|
297
|
+
"bg-fm-color-system-success-100 text-fm-color-system-success-500": e.completedAt,
|
|
298
|
+
"bg-fm-color-system-info-100 text-fm-color-system-info-500": !e.failedReason && !e.completedAt
|
|
299
|
+
}])
|
|
300
|
+
}, l(e.failedReason ? d(c)("inventory.stock.recalculation.status.failed") : e.completedAt ? d(c)("inventory.stock.recalculation.status.completed") : d(c)("inventory.stock.recalculation.status.inProgress")), 3)
|
|
301
|
+
])
|
|
302
|
+
]),
|
|
303
|
+
a("div", qe, l(d(c)("inventory.stock.recalculation.from")) + ": " + l(new Date(e.recalculateStartDate).toLocaleDateString()), 1),
|
|
304
|
+
a("div", et, l(d(c)("inventory.stock.recalculation.to")) + ": " + l(new Date(e.recalculateEndDate).toLocaleDateString()), 1),
|
|
305
|
+
e.createdBy ? (u(), f("div", tt, l(d(c)("inventory.stock.recalculation.requestedBy")) + ": " + l(e.createdBy.name || e.createdBy.id), 1)) : F("", !0),
|
|
306
|
+
e.completedAt ? (u(), f("div", ot, l(d(c)("inventory.stock.recalculation.completedAt")) + ": " + l(new Date(e.completedAt).toLocaleString()), 1)) : F("", !0),
|
|
307
|
+
e.failedReason ? (u(), f("div", at, l(e.failedReason), 1)) : F("", !0)
|
|
308
|
+
]);
|
|
309
|
+
}), 128))
|
|
310
|
+
])
|
|
311
|
+
])) : F("", !0)
|
|
312
|
+
])
|
|
313
|
+
]),
|
|
314
|
+
_: 1
|
|
315
|
+
}, 8, ["modelValue"])
|
|
316
|
+
]);
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
}), rt = { class: "fm-typo-en-heading-lg-600" }, ct = { class: "flex flex-col gap-16" }, dt = { class: "flex flex-col gap-4" }, ut = { class: "fm-typo-en-label-md-400 text-fm-color-typo-secondary" }, mt = { class: "fm-typo-en-body-md-400" }, pt = { class: "flex flex-col gap-4" }, yt = { class: "fm-typo-en-label-md-400 text-fm-color-typo-secondary" }, ft = { class: "fm-typo-en-body-md-400" }, gt = { class: "flex flex-col gap-4" }, vt = { class: "fm-typo-en-label-md-400 text-fm-color-typo-secondary" }, ht = { class: "flex gap-8 ml-auto" }, _t = /* @__PURE__ */ se({
|
|
320
|
+
__name: "ClosingDetailDialog",
|
|
321
|
+
props: {
|
|
322
|
+
modelValue: { type: Boolean },
|
|
323
|
+
type: {},
|
|
324
|
+
data: {}
|
|
325
|
+
},
|
|
326
|
+
emits: ["update:modelValue"],
|
|
327
|
+
setup(Z, { emit: g }) {
|
|
328
|
+
const { t: h } = le(), A = _e(), c = Ve(), V = Z, L = g, x = S({
|
|
329
|
+
get: () => V.modelValue,
|
|
330
|
+
set: (i) => L("update:modelValue", i)
|
|
331
|
+
}), C = p("");
|
|
332
|
+
ue(x, (i) => {
|
|
333
|
+
i || (C.value = "");
|
|
334
|
+
});
|
|
335
|
+
const y = S(() => {
|
|
336
|
+
var i;
|
|
337
|
+
return ((i = V.data) == null ? void 0 : i.skus) ?? [];
|
|
338
|
+
}), v = S(() => {
|
|
339
|
+
var b;
|
|
340
|
+
const i = (b = V.data) == null ? void 0 : b._id;
|
|
341
|
+
if (!i) return "-";
|
|
342
|
+
const n = M(i);
|
|
343
|
+
return new Date(n).toLocaleString();
|
|
344
|
+
}), N = S(() => V.type === "closing" ? h("inventory.closing.history.closingDetail", "Closing Detail") : h("inventory.closing.history.snapshotDetail", "Snapshot Detail")), K = S(() => y.value.map((i) => {
|
|
345
|
+
const n = A.skuById[i.id] ?? null, m = !n;
|
|
346
|
+
return {
|
|
347
|
+
id: i.id,
|
|
348
|
+
sku: n,
|
|
349
|
+
skuName: (n == null ? void 0 : n.name) ?? i.id,
|
|
350
|
+
skuCode: (n == null ? void 0 : n.code) ?? "-",
|
|
351
|
+
balance: i.balance ?? { amount: 0, precision: 0 },
|
|
352
|
+
isMissing: m,
|
|
353
|
+
costs: i.costs,
|
|
354
|
+
weightedAverage: i.weightedAverage
|
|
355
|
+
};
|
|
356
|
+
})), D = S(() => [
|
|
357
|
+
{
|
|
358
|
+
accessorKey: "skuName",
|
|
359
|
+
header: () => h("inventory.ingredient.name", "Ingredient Name"),
|
|
360
|
+
cell: (i) => {
|
|
361
|
+
const n = i.row.original;
|
|
362
|
+
return n.isMissing ? P("div", { class: "flex items-center gap-8" }, [
|
|
363
|
+
P("span", {}, n.id),
|
|
364
|
+
P(
|
|
365
|
+
"span",
|
|
366
|
+
{
|
|
367
|
+
class: "px-8 py-2 rounded-4 bg-fm-color-danger-weak text-fm-color-danger-default fm-typo-en-label-sm-400"
|
|
368
|
+
},
|
|
369
|
+
"Missing"
|
|
370
|
+
)
|
|
371
|
+
]) : i.getValue();
|
|
372
|
+
}
|
|
373
|
+
},
|
|
374
|
+
{
|
|
375
|
+
accessorKey: "skuCode",
|
|
376
|
+
header: () => h("inventory.ingredient.code", "Code")
|
|
377
|
+
},
|
|
378
|
+
{
|
|
379
|
+
id: "balance",
|
|
380
|
+
header: () => h("inventory.closing.history.balance", "Balance"),
|
|
381
|
+
cell: (i) => {
|
|
382
|
+
var b;
|
|
383
|
+
const n = i.row.original;
|
|
384
|
+
if (n.isMissing || !((b = n.sku) != null && b.unit))
|
|
385
|
+
return `${n.balance.amount / Math.pow(10, n.balance.precision)}`;
|
|
386
|
+
const m = {
|
|
387
|
+
unit: n.sku.unit,
|
|
388
|
+
sku: n.sku,
|
|
389
|
+
amount: n.balance,
|
|
390
|
+
defaultTrackingMeasurement: n.sku.trackingMeasurement ?? void 0
|
|
391
|
+
};
|
|
392
|
+
return P(Fe, m);
|
|
393
|
+
},
|
|
394
|
+
size: 180
|
|
395
|
+
},
|
|
396
|
+
{
|
|
397
|
+
accessorKey: "weightedAverage",
|
|
398
|
+
header: () => h("inventory.closing.history.weightedAvgCost", "Weighted Avg Cost"),
|
|
399
|
+
cell: (i) => {
|
|
400
|
+
if (!c.enableTotalCost)
|
|
401
|
+
return P(
|
|
402
|
+
Ce,
|
|
403
|
+
{ featureKey: "total-cost", compact: !0 },
|
|
404
|
+
() => P("span", "0.00")
|
|
405
|
+
);
|
|
406
|
+
const n = i.getValue();
|
|
407
|
+
if (!n) return "-";
|
|
408
|
+
const m = n.amount ?? 0, b = n.precision ?? 0, T = n.currency ?? "", B = m / Math.pow(10, b);
|
|
409
|
+
return `${T} ${B.toFixed(2)}`;
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
]);
|
|
413
|
+
return (i, n) => {
|
|
414
|
+
const m = w("FmTextField"), b = w("FmTable"), T = w("FmButton"), B = w("FmDialog");
|
|
415
|
+
return u(), j(B, {
|
|
416
|
+
modelValue: x.value,
|
|
417
|
+
"onUpdate:modelValue": n[2] || (n[2] = (I) => x.value = I),
|
|
418
|
+
"close-button": "",
|
|
419
|
+
dismissAway: "",
|
|
420
|
+
"max-width": "900px"
|
|
421
|
+
}, {
|
|
422
|
+
"dialog-header": $(() => [
|
|
423
|
+
a("div", rt, l(N.value), 1)
|
|
424
|
+
]),
|
|
425
|
+
default: $(() => {
|
|
426
|
+
var I;
|
|
427
|
+
return [
|
|
428
|
+
a("div", ct, [
|
|
429
|
+
a("div", dt, [
|
|
430
|
+
a("div", ut, l(V.type === "closing" ? d(h)("inventory.closing.history.closingId") : d(h)("inventory.closing.history.snapshotId", "Snapshot ID")), 1),
|
|
431
|
+
a("div", mt, l(((I = V.data) == null ? void 0 : I._id) ?? "-"), 1)
|
|
432
|
+
]),
|
|
433
|
+
a("div", pt, [
|
|
434
|
+
a("div", yt, l(d(h)("inventory.closing.history.date")), 1),
|
|
435
|
+
a("div", ft, l(v.value), 1)
|
|
436
|
+
]),
|
|
437
|
+
a("div", gt, [
|
|
438
|
+
a("div", vt, l(d(h)("inventory.closing.history.ingredientBalances", "Ingredient Balances")) + " (" + l(y.value.length) + ") ", 1),
|
|
439
|
+
_(m, {
|
|
440
|
+
modelValue: C.value,
|
|
441
|
+
"onUpdate:modelValue": n[0] || (n[0] = (R) => C.value = R),
|
|
442
|
+
placeholder: "Filter by code or name"
|
|
443
|
+
}, null, 8, ["modelValue"]),
|
|
444
|
+
_(b, {
|
|
445
|
+
"row-data": K.value,
|
|
446
|
+
"column-defs": D.value,
|
|
447
|
+
pagination: { pageSize: 10 },
|
|
448
|
+
"search-value": C.value
|
|
449
|
+
}, null, 8, ["row-data", "column-defs", "search-value"])
|
|
450
|
+
])
|
|
451
|
+
])
|
|
452
|
+
];
|
|
453
|
+
}),
|
|
454
|
+
"dialog-footer": $(() => [
|
|
455
|
+
a("div", ht, [
|
|
456
|
+
_(T, {
|
|
457
|
+
variant: "tertiary",
|
|
458
|
+
onClick: n[1] || (n[1] = (I) => x.value = !1),
|
|
459
|
+
label: "Close"
|
|
460
|
+
})
|
|
461
|
+
])
|
|
462
|
+
]),
|
|
463
|
+
_: 1
|
|
464
|
+
}, 8, ["modelValue"]);
|
|
465
|
+
};
|
|
466
|
+
}
|
|
467
|
+
}), bt = { class: "flex flex-col gap-16 p-16" }, kt = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Dt = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, xt = { class: "flex flex-col gap-16" }, St = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, wt = { class: "flex gap-8 ml-auto" }, Mt = /* @__PURE__ */ se({
|
|
468
|
+
__name: "ClosingHistoryView",
|
|
469
|
+
setup(Z) {
|
|
470
|
+
var Q, X;
|
|
471
|
+
const { t: g } = le(), h = me(), A = be(), c = he(), V = De(), L = pe(), x = p("closings"), C = S(() => [
|
|
472
|
+
{ label: g("inventory.closing.history.closingsTab"), value: "closings" },
|
|
473
|
+
{ label: g("inventory.closing.history.snapshotsTab"), value: "snapshots" }
|
|
474
|
+
]), y = p([]), v = p(0), N = p([]), K = p(0);
|
|
475
|
+
let D = A.currentLocationDBName;
|
|
476
|
+
async function i(o) {
|
|
477
|
+
return A.currentLocationDBName ? (D = A.currentLocationDBName, h.listClosingsPage(o)) : { docs: [], nextStartkey: null, hasMore: !1 };
|
|
478
|
+
}
|
|
479
|
+
async function n(o) {
|
|
480
|
+
return A.currentLocationDBName ? (D = A.currentLocationDBName, h.listStockSnapshotsPage(o)) : { docs: [], nextStartkey: null, hasMore: !1 };
|
|
481
|
+
}
|
|
482
|
+
function m() {
|
|
483
|
+
y.value = [], v.value++;
|
|
484
|
+
}
|
|
485
|
+
function b() {
|
|
486
|
+
N.value = [], K.value++;
|
|
487
|
+
}
|
|
488
|
+
const T = p(!1), B = p("closing"), I = p(null);
|
|
489
|
+
function R(o) {
|
|
490
|
+
return [
|
|
491
|
+
o.getFullYear(),
|
|
492
|
+
String(o.getMonth() + 1).padStart(2, "0"),
|
|
493
|
+
String(o.getDate()).padStart(2, "0")
|
|
494
|
+
].join("-");
|
|
495
|
+
}
|
|
496
|
+
const z = () => R(new Date(Date.now() - 864e5)), U = p(z()), Y = S(() => {
|
|
497
|
+
const o = [
|
|
498
|
+
{
|
|
499
|
+
label: g("inventory.stock.recalculation.title"),
|
|
500
|
+
value: "recalculation",
|
|
501
|
+
prependIcon: "history",
|
|
502
|
+
isAdminOnly: !0
|
|
503
|
+
}
|
|
504
|
+
];
|
|
505
|
+
return x.value === "closings" ? o.push(
|
|
506
|
+
{
|
|
507
|
+
label: g("inventory.closing.history.initiate_opening"),
|
|
508
|
+
value: "initiateOpening",
|
|
509
|
+
prependIcon: "add_box",
|
|
510
|
+
isAdminOnly: !0
|
|
511
|
+
},
|
|
512
|
+
{
|
|
513
|
+
label: "Refresh",
|
|
514
|
+
value: "refreshOpening",
|
|
515
|
+
prependIcon: "refresh"
|
|
516
|
+
}
|
|
517
|
+
) : o.push(
|
|
518
|
+
{
|
|
519
|
+
label: g("inventory.closing.history.initiate_snapshot"),
|
|
520
|
+
value: "initiateStockSnapshot",
|
|
521
|
+
prependIcon: "camera",
|
|
522
|
+
isAdminOnly: !0
|
|
523
|
+
},
|
|
524
|
+
{
|
|
525
|
+
label: "Refresh",
|
|
526
|
+
value: "refreshStockSnapshot",
|
|
527
|
+
prependIcon: "refresh"
|
|
528
|
+
}
|
|
529
|
+
), o;
|
|
530
|
+
}), J = p();
|
|
531
|
+
function q(o) {
|
|
532
|
+
var s;
|
|
533
|
+
switch (o) {
|
|
534
|
+
case "recalculation":
|
|
535
|
+
return (s = J.value) == null ? void 0 : s.open();
|
|
536
|
+
case "initiateOpening": {
|
|
537
|
+
V.open({
|
|
538
|
+
title: "Initiate Opening Balance",
|
|
539
|
+
message: "Initiate opening balance if no opening balance exists for the current location.",
|
|
540
|
+
primaryActions: { text: "Confirm", close: !0 }
|
|
541
|
+
}).onPrimary(async () => {
|
|
542
|
+
try {
|
|
543
|
+
await h.initiateClosing(), L.open({
|
|
544
|
+
message: "Opening balance initiated successfully.",
|
|
545
|
+
type: "success"
|
|
546
|
+
}), await m();
|
|
547
|
+
} catch (e) {
|
|
548
|
+
L.open({
|
|
549
|
+
message: e.message || "Failed to initiate opening balance. Please try again.",
|
|
550
|
+
type: "error"
|
|
551
|
+
});
|
|
552
|
+
}
|
|
553
|
+
});
|
|
554
|
+
break;
|
|
555
|
+
}
|
|
556
|
+
case "initiateStockSnapshot": {
|
|
557
|
+
U.value = z(), E.value = !0;
|
|
558
|
+
break;
|
|
559
|
+
}
|
|
560
|
+
case "refreshOpening": {
|
|
561
|
+
m();
|
|
562
|
+
break;
|
|
563
|
+
}
|
|
564
|
+
case "refreshStockSnapshot": {
|
|
565
|
+
b();
|
|
566
|
+
break;
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
const E = p(!1), H = p(!1), ee = z();
|
|
571
|
+
async function te() {
|
|
572
|
+
H.value = !0;
|
|
573
|
+
try {
|
|
574
|
+
await h.initiateStockSnapshot(U.value), L.open({
|
|
575
|
+
message: "Stock snapshot created successfully.",
|
|
576
|
+
type: "success"
|
|
577
|
+
}), E.value = !1, await b();
|
|
578
|
+
} catch (o) {
|
|
579
|
+
L.open({
|
|
580
|
+
message: o.message || "Failed to create stock snapshot. Please try again.",
|
|
581
|
+
type: "error"
|
|
582
|
+
});
|
|
583
|
+
} finally {
|
|
584
|
+
H.value = !1;
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
const t = [
|
|
588
|
+
...(Q = c.sessionUser.value) != null && Q.role.isAdmin ? [
|
|
589
|
+
{
|
|
590
|
+
accessorKey: "_id",
|
|
591
|
+
header: () => P(ce, {}, () => `${g("inventory.closing.history.closingId")}`),
|
|
592
|
+
cell: (o) => o.getValue()
|
|
593
|
+
}
|
|
594
|
+
] : [],
|
|
595
|
+
{
|
|
596
|
+
accessorKey: "_id",
|
|
597
|
+
id: "date",
|
|
598
|
+
header: () => g("inventory.closing.history.date"),
|
|
599
|
+
cell: (o) => {
|
|
600
|
+
const s = o.getValue(), e = M(s);
|
|
601
|
+
return new Date(e).toLocaleDateString();
|
|
602
|
+
}
|
|
603
|
+
},
|
|
604
|
+
{
|
|
605
|
+
accessorKey: "_id",
|
|
606
|
+
id: "time",
|
|
607
|
+
header: () => g("inventory.closing.history.time"),
|
|
608
|
+
cell: (o) => {
|
|
609
|
+
const s = o.getValue(), e = M(s);
|
|
610
|
+
return new Date(e).toLocaleTimeString();
|
|
611
|
+
}
|
|
612
|
+
},
|
|
613
|
+
{
|
|
614
|
+
accessorKey: "ref",
|
|
615
|
+
header: () => g("inventory.closing.history.createdFrom"),
|
|
616
|
+
cell: (o) => o.getValue() || "-"
|
|
617
|
+
}
|
|
618
|
+
], r = [
|
|
619
|
+
...(X = c.sessionUser.value) != null && X.role.isAdmin ? [
|
|
620
|
+
{
|
|
621
|
+
accessorKey: "_id",
|
|
622
|
+
header: () => P(
|
|
623
|
+
ce,
|
|
624
|
+
{},
|
|
625
|
+
() => `${g("inventory.closing.history.snapshotId", "Snapshot ID")}`
|
|
626
|
+
),
|
|
627
|
+
cell: (o) => o.getValue()
|
|
628
|
+
}
|
|
629
|
+
] : [],
|
|
630
|
+
{
|
|
631
|
+
accessorKey: "_id",
|
|
632
|
+
id: "date",
|
|
633
|
+
header: () => g("inventory.closing.history.date"),
|
|
634
|
+
cell: (o) => {
|
|
635
|
+
const s = o.getValue(), e = M(s);
|
|
636
|
+
return new Date(e).toLocaleDateString();
|
|
637
|
+
}
|
|
638
|
+
},
|
|
639
|
+
{
|
|
640
|
+
accessorKey: "_id",
|
|
641
|
+
id: "time",
|
|
642
|
+
header: () => g("inventory.closing.history.time"),
|
|
643
|
+
cell: (o) => {
|
|
644
|
+
const s = o.getValue(), e = M(s);
|
|
645
|
+
return new Date(e).toLocaleTimeString();
|
|
646
|
+
}
|
|
647
|
+
},
|
|
648
|
+
{
|
|
649
|
+
accessorKey: "remark",
|
|
650
|
+
header: () => g("inventory.closing.history.createdFrom"),
|
|
651
|
+
cell: (o) => o.getValue() || "-"
|
|
652
|
+
}
|
|
653
|
+
];
|
|
654
|
+
async function W(o, s) {
|
|
655
|
+
const e = await h.getClosingById(o, s);
|
|
656
|
+
if (!e) throw new Error(`Closing ${o} not found`);
|
|
657
|
+
return B.value = "closing", I.value = e, T.value = !0, e;
|
|
658
|
+
}
|
|
659
|
+
async function oe(o, s) {
|
|
660
|
+
const e = await h.getStockSnapshotById(o, s);
|
|
661
|
+
if (!e) throw new Error(`Stock snapshot ${o} not found`);
|
|
662
|
+
return B.value = "snapshot", I.value = e, T.value = !0, e;
|
|
663
|
+
}
|
|
664
|
+
return A.watchLocation(async () => {
|
|
665
|
+
(A.currentLocationDBName || void 0) !== D && (m(), b());
|
|
666
|
+
}), (o, s) => {
|
|
667
|
+
const e = w("FmTabs"), O = w("FmDatePicker"), ie = w("FmButton"), ye = w("FmDialog");
|
|
668
|
+
return u(), j(ve, {
|
|
669
|
+
actions: Y.value,
|
|
670
|
+
title: d(g)("inventory.closing.history.title"),
|
|
671
|
+
"onClick:action": q
|
|
672
|
+
}, {
|
|
673
|
+
default: $(() => [
|
|
674
|
+
a("div", bt, [
|
|
675
|
+
_(ke, {
|
|
676
|
+
"change-location": "",
|
|
677
|
+
"hide-filter-options": !0
|
|
678
|
+
}),
|
|
679
|
+
_(e, {
|
|
680
|
+
"model-value": x.value,
|
|
681
|
+
"onUpdate:modelValue": s[0] || (s[0] = (k) => x.value = k),
|
|
682
|
+
items: C.value
|
|
683
|
+
}, null, 8, ["model-value", "items"]),
|
|
684
|
+
x.value === "closings" ? (u(), f(G, { key: 0 }, [
|
|
685
|
+
a("div", kt, l(d(g)("inventory.closing.history.closingsDescription")), 1),
|
|
686
|
+
_(de, {
|
|
687
|
+
rows: y.value,
|
|
688
|
+
"onUpdate:rows": s[1] || (s[1] = (k) => y.value = k),
|
|
689
|
+
"fetch-page": i,
|
|
690
|
+
"refresh-key": v.value,
|
|
691
|
+
"column-defs": t,
|
|
692
|
+
"fetch-detail": (k, ae) => W(k._id, ae)
|
|
693
|
+
}, null, 8, ["rows", "refresh-key", "fetch-detail"])
|
|
694
|
+
], 64)) : F("", !0),
|
|
695
|
+
x.value === "snapshots" ? (u(), f(G, { key: 1 }, [
|
|
696
|
+
a("div", Dt, l(d(g)("inventory.closing.history.snapshotsDescription")), 1),
|
|
697
|
+
_(de, {
|
|
698
|
+
rows: N.value,
|
|
699
|
+
"onUpdate:rows": s[2] || (s[2] = (k) => N.value = k),
|
|
700
|
+
"fetch-page": n,
|
|
701
|
+
"refresh-key": K.value,
|
|
702
|
+
"column-defs": r,
|
|
703
|
+
"fetch-detail": (k, ae) => oe(k._id, ae)
|
|
704
|
+
}, null, 8, ["rows", "refresh-key", "fetch-detail"])
|
|
705
|
+
], 64)) : F("", !0)
|
|
706
|
+
]),
|
|
707
|
+
(u(), j(ge, { to: "body" }, [
|
|
708
|
+
_(it, {
|
|
709
|
+
ref_key: "recalculationDialogRef",
|
|
710
|
+
ref: J,
|
|
711
|
+
onSubmitted: s[3] || (s[3] = (k) => {
|
|
712
|
+
m(), b();
|
|
713
|
+
})
|
|
714
|
+
}, null, 512),
|
|
715
|
+
_(_t, {
|
|
716
|
+
modelValue: T.value,
|
|
717
|
+
"onUpdate:modelValue": s[4] || (s[4] = (k) => T.value = k),
|
|
718
|
+
type: B.value,
|
|
719
|
+
data: I.value
|
|
720
|
+
}, null, 8, ["modelValue", "type", "data"]),
|
|
721
|
+
_(ye, {
|
|
722
|
+
modelValue: E.value,
|
|
723
|
+
"onUpdate:modelValue": s[7] || (s[7] = (k) => E.value = k),
|
|
724
|
+
"close-button": "",
|
|
725
|
+
dismissAway: "",
|
|
726
|
+
"max-width": "400px"
|
|
727
|
+
}, {
|
|
728
|
+
"dialog-header": $(() => s[8] || (s[8] = [
|
|
729
|
+
a("div", { class: "fm-typo-en-heading-lg-600" }, "Initiate Stock Snapshot", -1)
|
|
730
|
+
])),
|
|
731
|
+
default: $(() => [
|
|
732
|
+
a("div", xt, [
|
|
733
|
+
a("div", St, l(d(g)("inventory.closing.history.snapshotsDescription")), 1),
|
|
734
|
+
_(O, {
|
|
735
|
+
modelValue: U.value,
|
|
736
|
+
"onUpdate:modelValue": s[5] || (s[5] = (k) => U.value = k),
|
|
737
|
+
label: "Snapshot Date",
|
|
738
|
+
max: d(ee)
|
|
739
|
+
}, null, 8, ["modelValue", "max"])
|
|
740
|
+
])
|
|
741
|
+
]),
|
|
742
|
+
"dialog-footer": $(() => [
|
|
743
|
+
a("div", wt, [
|
|
744
|
+
_(ie, {
|
|
745
|
+
variant: "tertiary",
|
|
746
|
+
onClick: s[6] || (s[6] = (k) => E.value = !1),
|
|
747
|
+
label: "Cancel",
|
|
748
|
+
disabled: H.value
|
|
749
|
+
}, null, 8, ["disabled"]),
|
|
750
|
+
_(ie, {
|
|
751
|
+
variant: "primary",
|
|
752
|
+
onClick: te,
|
|
753
|
+
label: "Confirm",
|
|
754
|
+
loading: H.value
|
|
755
|
+
}, null, 8, ["loading"])
|
|
756
|
+
])
|
|
757
|
+
]),
|
|
758
|
+
_: 1
|
|
759
|
+
}, 8, ["modelValue"])
|
|
760
|
+
]))
|
|
761
|
+
]),
|
|
762
|
+
_: 1
|
|
763
|
+
}, 8, ["actions", "title"]);
|
|
764
|
+
};
|
|
765
|
+
}
|
|
766
|
+
});
|
|
767
|
+
export {
|
|
768
|
+
Mt as default
|
|
769
|
+
};
|