@feedmepos/mf-inventory-portal 1.2.43-dev.3 → 1.2.44-dev.1

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.
Files changed (72) hide show
  1. package/dist/{App-DkzM4M0_.js → App-D6h4PbkJ.js} +3 -3
  2. package/dist/{ApprovalView-Dd5bg0yE.js → ApprovalView-Bll-QWib.js} +5 -5
  3. package/dist/{BindingsDialog-FoyqtujI.js → BindingsDialog-cm-tG1Du.js} +2 -2
  4. package/dist/{BindingsPicker-D-DS3PdA.js → BindingsPicker-Ca0BxJKj.js} +2 -2
  5. package/dist/{BindingsTable-viPFJCPm.js → BindingsTable-BBNWeq4W.js} +3 -3
  6. package/dist/{ClosingDraftView-BlaIq6iS.js → ClosingDraftView-r2C27qph.js} +766 -723
  7. package/dist/ClosingHistoryView-CGV72nOD.js +447 -0
  8. package/dist/{ClosingTemplateView-Dil7tncI.js → ClosingTemplateView-Xij995aZ.js} +14 -14
  9. package/dist/{DeliveryOrderPrintPreview-zvfi--WO.js → DeliveryOrderPrintPreview-BoBBu5lC.js} +1 -1
  10. package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-_dZiJ1_p.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-SnXudMX4.js} +4 -4
  11. package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DBSjX9GC.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-ClY0PFyA.js} +2 -2
  12. package/dist/{FmMultiselectDialog-CEnIfKkK.js → FmMultiselectDialog-BcZpbDMT.js} +2 -2
  13. package/dist/{FmMultiselectDialog-D0HzUEWj.js → FmMultiselectDialog-C9g5u6Kk.js} +1 -1
  14. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-BG2lia-P.js → FmUnitInput.vue_vue_type_script_setup_true_lang-B-PD6CbF.js} +3 -3
  15. package/dist/{ImportView-XUXFdNd5.js → ImportView-CzMwJY2A.js} +6 -6
  16. package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-DgutuH9i.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-DgOrurbQ.js} +1 -1
  17. package/dist/{IngredientGroupView-7UTiTjiy.js → IngredientGroupView-DBbwP3E6.js} +5 -5
  18. package/dist/{IngredientsView-BkK-S9zb.js → IngredientsView-jRqkzOTc.js} +14 -14
  19. package/dist/{IntegrationView-BTXcGlp6.js → IntegrationView-B-_39POT.js} +12 -12
  20. package/dist/{InventoryBindingForm-Ch3ltUK8.js → InventoryBindingForm-D14aWQqg.js} +1 -1
  21. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-Dnv5PN-O.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-DtHtGqKw.js} +4 -4
  22. package/dist/{InventoryBindingSummary-BVKjiIfs.js → InventoryBindingSummary-B7Q-G4Fx.js} +1 -1
  23. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-CbK0JN-7.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-CqB7pkKN.js} +1 -1
  24. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-dv4OBeHd.js → PremiumBadge.vue_vue_type_script_setup_true_lang-BfHSMN6k.js} +2 -2
  25. package/dist/{PublishView-g_HbS6jK.js → PublishView-C_icogKG.js} +3 -3
  26. package/dist/{PurchaseOrderPrintPreview-BReNCrqT.js → PurchaseOrderPrintPreview-BeXqhfRn.js} +1 -1
  27. package/dist/{ReceiveRequestView-ClT4-xel.js → ReceiveRequestView-COdOrOyg.js} +18 -18
  28. package/dist/{RecipeView-CtpQ2a0y.js → RecipeView-Desvtm1a.js} +8 -8
  29. package/dist/{StockView-CEbdj6YL.js → StockView-B1NDBHQh.js} +15 -15
  30. package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-Bofw0-xa.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-CbCD3pOQ.js} +1 -1
  31. package/dist/{SupplierView-DzmEjA3j.js → SupplierView-CB6Gz5HH.js} +11 -11
  32. package/dist/{SystemTrailDialog.vue_vue_type_script_setup_true_lang-0A8OWe8S.js → SystemTrailDialog.vue_vue_type_script_setup_true_lang-3bruORgT.js} +2 -2
  33. package/dist/{TemplatePublishDialog.vue_vue_type_script_setup_true_lang-bxporBJ4.js → TemplatePublishDialog.vue_vue_type_script_setup_true_lang-C0Vd0X-5.js} +1 -1
  34. package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-cDwtvgIk.js → TransferDetails.vue_vue_type_script_setup_true_lang-Bnt6-X4t.js} +14 -14
  35. package/dist/{TransferTemplateView-ySDW6lRS.js → TransferTemplateView-CLeLzBvW.js} +15 -15
  36. package/dist/{UnitView-Bv91T6ab.js → UnitView-YM302P8g.js} +6 -6
  37. package/dist/{WarehouseView-kPmRof7c.js → WarehouseView-D69BsVsb.js} +5 -5
  38. package/dist/WastageTemplateView-DfP43M8-.js +2327 -0
  39. package/dist/api/stock.d.ts +2 -0
  40. package/dist/{app-CV3h70p4.js → app-BuvV4n4w.js} +8 -7
  41. package/dist/app.js +1 -1
  42. package/dist/{closing-template-BBIWBX0k.js → closing-template-D1NlAV-G.js} +1 -1
  43. package/dist/{date2-CkCGGaAb.js → date2-CkkGwYSP.js} +1 -1
  44. package/dist/{dayjs.min-Dd-afiDx.js → dayjs.min-DFvOuCCo.js} +1 -1
  45. package/dist/{decimal-CS-CxyFz.js → decimal-D1O4-kbG.js} +2 -2
  46. package/dist/{defineDeepModel-D_bZeRgl.js → defineDeepModel-s0no34Rq.js} +1 -1
  47. package/dist/{duplicate-template-DPXszoh-.js → duplicate-template-DJceVj9n.js} +1 -1
  48. package/dist/{feature-B_VTGztb.js → feature-AINxwcz_.js} +255 -257
  49. package/dist/{format-time-from-id-BmBEi-Jw.js → format-time-from-id-CRiwabgV.js} +1 -1
  50. package/dist/{format-unit-display-CDKsLgE4.js → format-unit-display-kd8gPWFg.js} +10 -10
  51. package/dist/{import-export.helper-BLfWO3Yr.js → import-export.helper-CtI9oUN_.js} +5 -5
  52. package/dist/{index-DU9SwtH5.js → index-Af5Cs7r5.js} +1 -1
  53. package/dist/{index-BRDlwURl.js → index-BVBQnKv6.js} +3 -3
  54. package/dist/{index-DAnsA0Mm.js → index-DKTL7IN3.js} +1 -1
  55. package/dist/{lodash-CYR2InSF.js → lodash-TAQPcjEK.js} +1 -1
  56. package/dist/{netsuite-CPkzurdj.js → netsuite-CcC4Y1c-.js} +3 -3
  57. package/dist/{purchase-order-template-DNQiObjY.js → purchase-order-template-B-Xuh5oQ.js} +1 -1
  58. package/dist/{rules-2RvCSF3q.js → rules-DwOMpBOV.js} +3 -3
  59. package/dist/{stock-BWBlXMgT.js → stock-DolMZJgQ.js} +3 -3
  60. package/dist/{stock-RjFuloPL.js → stock-X1ADgvOm.js} +35 -27
  61. package/dist/{supplier-8UMBjffB.js → supplier-DTzECjWy.js} +2 -2
  62. package/dist/{use-ingredient-select-dialog-DsrecsJw.js → use-ingredient-select-dialog-D7UCiLcS.js} +2 -2
  63. package/dist/{use-inventory-binding-dialog-C4bcTum8.js → use-inventory-binding-dialog-uYYsTsLi.js} +2 -2
  64. package/dist/{use-template-enabled-locations-2-_G7NryCx.js → use-template-enabled-locations-2-l2e5ocrp.js} +2 -2
  65. package/dist/views/adjustment-template/wastage-template/form/useAdjustmentTemplateItems.d.ts +7 -0
  66. package/dist/views/closing-draft/composables/use-closing-draft-actions.d.ts +4 -1
  67. package/dist/{vue-i18n-BU7aJfqP.js → vue-i18n-anAmA_v_.js} +448 -448
  68. package/dist/{xlsx-JEiDJdww.js → xlsx-CtBehOaB.js} +1 -1
  69. package/dist/{xlsx.util-Cc50iTml.js → xlsx.util-jpTCFIaP.js} +1 -1
  70. package/package.json +4 -4
  71. package/dist/ClosingHistoryView-Byb3JIG8.js +0 -391
  72. package/dist/WastageTemplateView-CZq9b3sy.js +0 -2287
@@ -0,0 +1,447 @@
1
+ import { defineComponent as G, ref as v, computed as D, watch as se, resolveComponent as S, openBlock as i, createElementBlock as f, createVNode as g, withModifiers as ie, withCtx as B, createElementVNode as n, toDisplayString as s, unref as a, Fragment as E, createTextVNode as N, createBlock as T, createCommentVNode as k, renderList as z, normalizeClass as ce, h as re, onMounted as de, Teleport as ue } from "vue";
2
+ import { F as me, _ as fe } from "./SingleColumnLayout.vue_vue_type_script_setup_true_lang-CWZkVCAj.js";
3
+ import { useI18n as J, useCoreStore as ve } from "@feedmepos/mf-common";
4
+ import { D as Q, A as V, u as ye } from "./app-BuvV4n4w.js";
5
+ import { _ as pe } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-ClY0PFyA.js";
6
+ import { useSnackbar as W, useDialog as ge } from "@feedmepos/ui-library";
7
+ import { u as _e } from "./stock-X1ADgvOm.js";
8
+ const be = { class: "fm-typo-en-heading-lg-600" }, he = { class: "flex flex-col gap-16" }, ke = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, xe = { class: "flex flex-col gap-8" }, De = { class: "fm-typo-en-body-md-600" }, we = { class: "flex flex-col gap-8" }, Se = { class: "fm-typo-en-body-md-600" }, Ve = { class: "flex items-center gap-8 mb-8" }, Ae = {
9
+ key: 2,
10
+ class: "text-red-500 text-sm mt-2"
11
+ }, Ce = { class: "fm-typo-en-body-sm-400" }, Fe = {
12
+ key: 1,
13
+ class: "p-12 border border-fm-color-border-primary rounded-8 bg-fm-color-background-secondary"
14
+ }, Re = {
15
+ key: 0,
16
+ class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
17
+ }, Le = {
18
+ key: 1,
19
+ class: "flex flex-col gap-8"
20
+ }, Be = { class: "fm-typo-en-body-sm-600" }, Te = { class: "flex flex-col gap-4" }, Ie = { key: 0 }, Oe = {
21
+ key: 1,
22
+ class: "flex flex-col gap-8"
23
+ }, $e = { class: "fm-typo-en-body-md-600" }, Ee = { class: "flex flex-col gap-8 max-h-[300px] overflow-y-auto" }, Ne = { class: "flex items-center justify-between" }, Pe = { class: "fm-typo-en-body-sm-600" }, Ue = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Ke = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Me = {
24
+ key: 0,
25
+ class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
26
+ }, He = {
27
+ key: 1,
28
+ class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
29
+ }, je = {
30
+ key: 2,
31
+ class: "fm-typo-en-body-xs-400 text-fm-color-system-error-500"
32
+ }, ze = {
33
+ key: 0,
34
+ class: "flex gap-8 ml-auto"
35
+ }, Ge = {
36
+ key: 1,
37
+ class: "flex gap-8 ml-auto"
38
+ }, Je = /* @__PURE__ */ G({
39
+ __name: "RecalculationDialog",
40
+ emits: ["submitted"],
41
+ setup(X, { expose: h, emit: I }) {
42
+ const C = I, { t: l } = J(), A = _e(), O = Q(), x = W(), y = v(!1), d = v(""), c = v(""), _ = v(!1), F = v([]), u = v(!1), w = v([]), m = v(!1), r = v([]), p = v(!1), R = D(() => F.value.map((e) => {
43
+ const o = V(e._id), b = new Date(o);
44
+ return {
45
+ label: `${b.toLocaleDateString()} ${b.toLocaleTimeString()}`,
46
+ value: e._id
47
+ };
48
+ })), Y = D(() => d.value ? R.value.filter((e) => e.value > d.value) : []), P = D({
49
+ get: () => {
50
+ if (_.value && c.value) {
51
+ const e = F.value.find((o) => V(o._id) === c.value);
52
+ return (e == null ? void 0 : e._id) || c.value;
53
+ }
54
+ return c.value;
55
+ },
56
+ set: (e) => {
57
+ _.value && e ? c.value = V(e) : c.value = e;
58
+ }
59
+ }), Z = D(() => {
60
+ if (d.value)
61
+ try {
62
+ const e = V(d.value);
63
+ if (e)
64
+ return e;
65
+ } catch (e) {
66
+ console.error("Error parsing date from closing ID:", e);
67
+ }
68
+ }), L = D(() => {
69
+ if (!d.value || !c.value) return "";
70
+ const e = V(d.value), o = c.value;
71
+ if (e && o) {
72
+ const b = new Date(e).getTime();
73
+ if (new Date(o).getTime() <= b)
74
+ return l("inventory.stock.recalculation.error.endDateBeforeOpening");
75
+ }
76
+ return "";
77
+ }), U = D(() => !!d.value && !!c.value && !L.value), K = D(() => w.value.some(
78
+ (e) => !e.completedAt && !e.failedReason
79
+ ));
80
+ async function M() {
81
+ y.value = !0, await Promise.all([ee(), H()]), d.value = "", c.value = "", _.value = !1;
82
+ }
83
+ function q() {
84
+ y.value = !1;
85
+ }
86
+ h({
87
+ open: M,
88
+ close: q
89
+ });
90
+ async function ee() {
91
+ u.value = !0;
92
+ try {
93
+ const e = await O.getLastNClosings(30);
94
+ F.value = e;
95
+ } catch (e) {
96
+ console.error("Error fetching recent closings:", e), x.open({
97
+ title: l("common.error"),
98
+ message: "Failed to fetch recent closings",
99
+ type: "error"
100
+ });
101
+ } finally {
102
+ u.value = !1;
103
+ }
104
+ }
105
+ async function H() {
106
+ m.value = !0;
107
+ try {
108
+ const e = await A.recalculation.recalculationRequests();
109
+ w.value = e;
110
+ } catch (e) {
111
+ console.error("Error fetching recalculation requests:", e);
112
+ } finally {
113
+ m.value = !1;
114
+ }
115
+ }
116
+ async function te() {
117
+ if (!d.value || !c.value) {
118
+ r.value = [];
119
+ return;
120
+ }
121
+ p.value = !0;
122
+ try {
123
+ const e = await A.recalculation.getAffectedClosingDrafts(
124
+ d.value,
125
+ c.value
126
+ );
127
+ r.value = e;
128
+ } catch {
129
+ x.open({
130
+ title: l("common.error"),
131
+ message: "Failed to fetch affected closing drafts",
132
+ type: "error"
133
+ }), r.value = [];
134
+ } finally {
135
+ p.value = !1;
136
+ }
137
+ }
138
+ se(
139
+ [d, c],
140
+ () => {
141
+ d.value && c.value && !L.value ? te() : r.value = [];
142
+ },
143
+ { immediate: !1 }
144
+ );
145
+ async function oe() {
146
+ if (U.value) {
147
+ u.value = !0;
148
+ try {
149
+ if (await A.recalculation.scheduleRecalculation(d.value, c.value), r.value.length > 0) {
150
+ const e = r.value.map((o) => o._id);
151
+ await A.recalculation.scheduleInvalidateClosingDraftCache(e);
152
+ }
153
+ x.open({
154
+ title: l("common.success"),
155
+ message: "Stock recalculation has been scheduled successfully",
156
+ type: "success"
157
+ }), await H(), y.value = !1, C("submitted");
158
+ } catch (e) {
159
+ console.error("Error scheduling recalculation:", e), x.open({
160
+ title: l("common.error"),
161
+ message: "Failed to schedule stock recalculation",
162
+ type: "error"
163
+ });
164
+ } finally {
165
+ u.value = !1;
166
+ }
167
+ }
168
+ }
169
+ return (e, o) => {
170
+ const b = S("FmButton"), $ = S("FmSelect"), j = S("FmRadio"), le = S("FmDatePicker"), ae = S("FmAlert"), ne = S("FmDialog");
171
+ return i(), f("div", null, [
172
+ g(b, {
173
+ "prepend-icon": "info",
174
+ variant: "tertiary",
175
+ onClick: ie(M, ["stop"])
176
+ }),
177
+ g(ne, {
178
+ modelValue: y.value,
179
+ "onUpdate:modelValue": o[7] || (o[7] = (t) => y.value = t),
180
+ "close-button": "",
181
+ dismissAway: "",
182
+ "max-width": "600px"
183
+ }, {
184
+ "dialog-header": B(() => [
185
+ n("div", be, s(a(l)("inventory.stock.recalculation.title")), 1)
186
+ ]),
187
+ "dialog-footer": B(() => [
188
+ K.value ? (i(), f("div", Ge, [
189
+ g(b, {
190
+ variant: "tertiary",
191
+ onClick: o[6] || (o[6] = (t) => y.value = !1),
192
+ label: a(l)("common.close")
193
+ }, null, 8, ["label"])
194
+ ])) : (i(), f("div", ze, [
195
+ g(b, {
196
+ variant: "tertiary",
197
+ onClick: o[5] || (o[5] = (t) => y.value = !1),
198
+ disabled: u.value,
199
+ label: a(l)("common.cancel")
200
+ }, null, 8, ["disabled", "label"]),
201
+ g(b, {
202
+ variant: "primary",
203
+ onClick: oe,
204
+ disabled: !U.value || u.value,
205
+ loading: u.value,
206
+ label: a(l)("inventory.stock.recalculation.schedule")
207
+ }, null, 8, ["disabled", "loading", "label"])
208
+ ]))
209
+ ]),
210
+ default: B(() => [
211
+ n("div", he, [
212
+ n("div", ke, s(a(l)("inventory.stock.recalculation.description")), 1),
213
+ K.value ? k("", !0) : (i(), f(E, { key: 0 }, [
214
+ n("div", xe, [
215
+ n("p", De, [
216
+ N(s(a(l)("inventory.stock.recalculation.openingDate")) + " ", 1),
217
+ o[8] || (o[8] = n("span", { class: "text-fm-color-system-error-300" }, "*", -1))
218
+ ]),
219
+ o[9] || (o[9] = n("div", { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary mb-4" }, " Showing the last 30 closing records. Select the opening date to start recalculation. ", -1)),
220
+ g($, {
221
+ modelValue: d.value,
222
+ "onUpdate:modelValue": o[0] || (o[0] = (t) => d.value = t),
223
+ items: R.value,
224
+ placeholder: a(l)("inventory.stock.recalculation.selectOpening"),
225
+ loading: u.value,
226
+ disabled: u.value
227
+ }, null, 8, ["modelValue", "items", "placeholder", "loading", "disabled"])
228
+ ]),
229
+ n("div", we, [
230
+ n("p", Se, [
231
+ N(s(a(l)("inventory.stock.recalculation.untilDate")) + " ", 1),
232
+ o[10] || (o[10] = n("span", { class: "text-fm-color-system-error-300" }, "*", -1))
233
+ ]),
234
+ n("div", Ve, [
235
+ g(j, {
236
+ modelValue: _.value,
237
+ "onUpdate:modelValue": o[1] || (o[1] = (t) => _.value = t),
238
+ value: !1,
239
+ label: a(l)("inventory.stock.recalculation.selectByDate")
240
+ }, null, 8, ["modelValue", "label"]),
241
+ g(j, {
242
+ modelValue: _.value,
243
+ "onUpdate:modelValue": o[2] || (o[2] = (t) => _.value = t),
244
+ value: !0,
245
+ label: a(l)("inventory.stock.recalculation.selectByClosing")
246
+ }, null, 8, ["modelValue", "label"])
247
+ ]),
248
+ _.value ? (i(), T($, {
249
+ key: 1,
250
+ modelValue: P.value,
251
+ "onUpdate:modelValue": o[4] || (o[4] = (t) => P.value = t),
252
+ items: Y.value,
253
+ placeholder: a(l)("inventory.stock.recalculation.selectClosing"),
254
+ loading: u.value,
255
+ disabled: !d.value || u.value
256
+ }, null, 8, ["modelValue", "items", "placeholder", "loading", "disabled"])) : (i(), T(le, {
257
+ key: 0,
258
+ modelValue: c.value,
259
+ "onUpdate:modelValue": o[3] || (o[3] = (t) => c.value = t),
260
+ placeholder: a(l)("inventory.stock.recalculation.selectDate"),
261
+ min: Z.value,
262
+ disabled: !d.value || u.value
263
+ }, null, 8, ["modelValue", "placeholder", "min", "disabled"])),
264
+ L.value ? (i(), f("div", Ae, s(L.value), 1)) : k("", !0)
265
+ ]),
266
+ d.value && c.value && !L.value ? (i(), T(ae, {
267
+ key: 0,
268
+ type: "info"
269
+ }, {
270
+ default: B(() => [
271
+ n("div", Ce, s(a(l)("inventory.stock.recalculation.info")), 1)
272
+ ]),
273
+ _: 1
274
+ })) : k("", !0),
275
+ r.value.length > 0 ? (i(), f("div", Fe, [
276
+ p.value ? (i(), f("div", Re, " Loading affected closing drafts... ")) : (i(), f("div", Le, [
277
+ n("div", Be, " Affected closing draft(s): " + s(r.value.length), 1),
278
+ n("div", Te, [
279
+ (i(!0), f(E, null, z(r.value, (t) => (i(), f("div", {
280
+ key: t._id,
281
+ class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
282
+ }, [
283
+ N(" • " + s(t._id) + " ", 1),
284
+ t.effectiveAt ? (i(), f("span", Ie, " (" + s(new Date(t.effectiveAt).toLocaleString()) + ") ", 1)) : k("", !0)
285
+ ]))), 128))
286
+ ])
287
+ ]))
288
+ ])) : k("", !0)
289
+ ], 64)),
290
+ w.value.length > 0 ? (i(), f("div", Oe, [
291
+ n("p", $e, s(a(l)("inventory.stock.recalculation.recentRequests")), 1),
292
+ n("div", Ee, [
293
+ (i(!0), f(E, null, z(w.value, (t) => (i(), f("div", {
294
+ key: t._id,
295
+ class: "p-12 border border-fm-color-border-primary rounded-8 flex flex-col gap-4"
296
+ }, [
297
+ n("div", Ne, [
298
+ n("div", Pe, s(a(l)("inventory.stock.recalculation.requestedAt")) + ": " + s(new Date(t.createdAt).toLocaleString()), 1),
299
+ n("div", {
300
+ class: ce(["fm-typo-en-body-xs-600 px-8 py-4 rounded-4", {
301
+ "bg-fm-color-system-error-100 text-fm-color-system-error-500": t.failedReason,
302
+ "bg-fm-color-system-success-100 text-fm-color-system-success-500": t.completedAt,
303
+ "bg-fm-color-system-info-100 text-fm-color-system-info-500": !t.failedReason && !t.completedAt
304
+ }])
305
+ }, s(t.failedReason ? a(l)("inventory.stock.recalculation.status.failed") : t.completedAt ? a(l)("inventory.stock.recalculation.status.completed") : a(l)("inventory.stock.recalculation.status.inProgress")), 3)
306
+ ]),
307
+ n("div", Ue, s(a(l)("inventory.stock.recalculation.from")) + ": " + s(new Date(t.recalculateStartDate).toLocaleDateString()), 1),
308
+ n("div", Ke, s(a(l)("inventory.stock.recalculation.to")) + ": " + s(new Date(t.recalculateEndDate).toLocaleDateString()), 1),
309
+ t.createdBy ? (i(), f("div", Me, s(a(l)("inventory.stock.recalculation.requestedBy")) + ": " + s(t.createdBy.name || t.createdBy.id), 1)) : k("", !0),
310
+ t.completedAt ? (i(), f("div", He, s(a(l)("inventory.stock.recalculation.completedAt")) + ": " + s(new Date(t.completedAt).toLocaleString()), 1)) : k("", !0),
311
+ t.failedReason ? (i(), f("div", je, s(t.failedReason), 1)) : k("", !0)
312
+ ]))), 128))
313
+ ])
314
+ ])) : k("", !0)
315
+ ])
316
+ ]),
317
+ _: 1
318
+ }, 8, ["modelValue"])
319
+ ]);
320
+ };
321
+ }
322
+ }), Qe = { class: "flex flex-col gap-16 p-16" }, ot = /* @__PURE__ */ G({
323
+ __name: "ClosingHistoryView",
324
+ setup(X) {
325
+ var w;
326
+ const { t: h } = J(), I = Q(), C = ye(), l = ve(), A = ge(), O = W(), x = v([]), y = v(!1), d = D(() => [
327
+ {
328
+ label: h("inventory.stock.recalculation.title", "Stock Recalculation"),
329
+ value: "recalculation",
330
+ prependIcon: "history",
331
+ isAdminOnly: !0
332
+ },
333
+ {
334
+ label: h("inventory.closing.history.initiate_opening", "Initiate Opening"),
335
+ value: "initiateOpening",
336
+ prependIcon: "add_box",
337
+ isAdminOnly: !0
338
+ }
339
+ ]), c = v();
340
+ function _(m) {
341
+ var r;
342
+ switch (m) {
343
+ case "recalculation":
344
+ return (r = c.value) == null ? void 0 : r.open();
345
+ case "initiateOpening":
346
+ A.open({
347
+ title: "Initiate Opening Balance",
348
+ message: "Initiate opening balance if no opening balance exists for the current location.",
349
+ primaryActions: { text: "Confirm", close: !0 }
350
+ }).onPrimary(async () => {
351
+ try {
352
+ await I.initiateClosing(), O.open({
353
+ message: "Opening balance initiated successfully.",
354
+ type: "success"
355
+ }), await u();
356
+ } catch (p) {
357
+ O.open({
358
+ message: p.message || "Failed to initiate opening balance. Please try again.",
359
+ type: "error"
360
+ });
361
+ }
362
+ });
363
+ }
364
+ }
365
+ const F = [
366
+ ...(w = l.sessionUser.value) != null && w.role.isAdmin ? [
367
+ {
368
+ accessorKey: "_id",
369
+ header: () => re(me, {}, () => `${h("inventory.closing.history.closingId")}`),
370
+ cell: (m) => m.getValue()
371
+ }
372
+ ] : [],
373
+ {
374
+ accessorKey: "_id",
375
+ id: "date",
376
+ header: () => h("inventory.closing.history.date"),
377
+ cell: (m) => {
378
+ const r = m.getValue(), p = V(r);
379
+ return new Date(p).toLocaleDateString();
380
+ }
381
+ },
382
+ {
383
+ accessorKey: "_id",
384
+ id: "time",
385
+ header: () => h("inventory.closing.history.time"),
386
+ cell: (m) => {
387
+ const r = m.getValue(), p = V(r);
388
+ return new Date(p).toLocaleTimeString();
389
+ }
390
+ },
391
+ {
392
+ accessorKey: "ref",
393
+ header: () => h("inventory.closing.history.createdFrom"),
394
+ cell: (m) => m.getValue() || "-"
395
+ }
396
+ ];
397
+ async function u() {
398
+ if (C.currentLocationDBName) {
399
+ y.value = !0;
400
+ try {
401
+ const m = await I.getLastNClosings(30);
402
+ x.value = m;
403
+ } catch (m) {
404
+ console.error("Error fetching closings:", m), x.value = [];
405
+ } finally {
406
+ y.value = !1;
407
+ }
408
+ }
409
+ }
410
+ return de(async () => {
411
+ C.currentLocationDBName && await u();
412
+ }), C.watchLocation(u), (m, r) => {
413
+ const p = S("FmTable");
414
+ return i(), T(fe, {
415
+ actions: d.value,
416
+ title: a(h)("inventory.closing.history.title"),
417
+ "onClick:action": _
418
+ }, {
419
+ default: B(() => [
420
+ n("div", Qe, [
421
+ g(pe, {
422
+ "change-location": "",
423
+ "hide-filter-options": !0
424
+ }),
425
+ r[1] || (r[1] = n("div", { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, " Displaying the last 30 closing records. ", -1)),
426
+ g(p, {
427
+ loading: y.value,
428
+ "row-data": x.value,
429
+ "column-defs": F
430
+ }, null, 8, ["loading", "row-data"])
431
+ ]),
432
+ (i(), T(ue, { to: "body" }, [
433
+ g(Je, {
434
+ ref_key: "recalculationDialogRef",
435
+ ref: c,
436
+ onSubmitted: r[0] || (r[0] = (R) => u())
437
+ }, null, 512)
438
+ ]))
439
+ ]),
440
+ _: 1
441
+ }, 8, ["actions", "title"]);
442
+ };
443
+ }
444
+ });
445
+ export {
446
+ ot as default
447
+ };
@@ -4,23 +4,23 @@ import { useI18n as W, useCoreStore as de } from "@feedmepos/mf-common";
4
4
  import { useDialog as pe, useDialogChild as Ze, useSnackbar as ce, FmButtonVariant as oe, components as Y, FmAdvancedSort as et, useProxiedModel as tt, useBreakpoints as nt } from "@feedmepos/ui-library";
5
5
  import { defineStore as Ve, storeToRefs as Ue } from "pinia";
6
6
  import { F as G } from "./form-mode.enum-BKiNVH6A.js";
7
- import { a as me } from "./closing-template-BBIWBX0k.js";
8
- import { u as fe, c as Ne, a as ve, n as ot } from "./app-CV3h70p4.js";
9
- import { t as re, a as ge, d as ye, s as Le, r as st } from "./xlsx.util-Cc50iTml.js";
7
+ import { a as me } from "./closing-template-D1NlAV-G.js";
8
+ import { u as fe, c as Ne, a as ve, n as ot } from "./app-BuvV4n4w.js";
9
+ import { t as re, a as ge, d as ye, s as Le, r as st } from "./xlsx.util-jpTCFIaP.js";
10
10
  import { F as lt } from "./FmDroppableField-J0xUsOTV.js";
11
- import { f as Be, a as le } from "./date2-CkCGGaAb.js";
11
+ import { f as Be, a as le } from "./date2-CkkGwYSP.js";
12
12
  import { D as se, R as z } from "./row-action.enum-BcW_L_nE.js";
13
13
  import { c as at, F as X, _ as ze } from "./TableActionableRow.vue_vue_type_script_setup_true_lang-cfFHDIwQ.js";
14
- import { f as rt } from "./format-time-from-id-BmBEi-Jw.js";
15
- import { _ as it } from "./TemplatePublishDialog.vue_vue_type_script_setup_true_lang-bxporBJ4.js";
16
- import { u as ct } from "./netsuite-CPkzurdj.js";
17
- import { u as mt } from "./duplicate-template-DPXszoh-.js";
18
- import { _ as ut } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DBSjX9GC.js";
19
- import { R as dt, A as pt } from "./rules-2RvCSF3q.js";
20
- import { u as ft } from "./use-ingredient-select-dialog-DsrecsJw.js";
21
- import { d as vt } from "./defineDeepModel-D_bZeRgl.js";
22
- import { u as gt } from "./use-template-enabled-locations-2-_G7NryCx.js";
23
- import { _ as yt } from "./SystemTrailDialog.vue_vue_type_script_setup_true_lang-0A8OWe8S.js";
14
+ import { f as rt } from "./format-time-from-id-CRiwabgV.js";
15
+ import { _ as it } from "./TemplatePublishDialog.vue_vue_type_script_setup_true_lang-C0Vd0X-5.js";
16
+ import { u as ct } from "./netsuite-CcC4Y1c-.js";
17
+ import { u as mt } from "./duplicate-template-DJceVj9n.js";
18
+ import { _ as ut } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-ClY0PFyA.js";
19
+ import { R as dt, A as pt } from "./rules-DwOMpBOV.js";
20
+ import { u as ft } from "./use-ingredient-select-dialog-D7UCiLcS.js";
21
+ import { d as vt } from "./defineDeepModel-s0no34Rq.js";
22
+ import { u as gt } from "./use-template-enabled-locations-2-l2e5ocrp.js";
23
+ import { _ as yt } from "./SystemTrailDialog.vue_vue_type_script_setup_true_lang-3bruORgT.js";
24
24
  import { _ as ht } from "./_plugin-vue_export-helper-CHgC5LLL.js";
25
25
  const ue = Ve(
26
26
  "closingTemplateTable",
@@ -1,6 +1,6 @@
1
1
  import { defineComponent as x, computed as f, ref as h, onMounted as _, openBlock as u, createElementBlock as i, createElementVNode as t, createTextVNode as n, toDisplayString as e, createCommentVNode as d, Fragment as o, renderList as p, normalizeClass as g } from "vue";
2
2
  import { useRoute as k } from "vue-router";
3
- import { L as y } from "./app-CV3h70p4.js";
3
+ import { L as y } from "./app-BuvV4n4w.js";
4
4
  import { _ as w } from "./_plugin-vue_export-helper-CHgC5LLL.js";
5
5
  const c = { class: "purchase-box" }, A = { valign: "bottom" }, N = { class: "sub-header" }, O = ["src"], P = { style: { "padding-left": "10px" } }, C = { class: "address" }, D = { class: "text-right" }, R = {
6
6
  key: 0,
@@ -1,8 +1,8 @@
1
- import { I as O, u as D, t as C, Q as A, U as E, y as w } from "./app-CV3h70p4.js";
2
- import { a as L, t as R } from "./rules-2RvCSF3q.js";
3
- import { u as z } from "./supplier-8UMBjffB.js";
1
+ import { I as O, u as D, t as C, Q as A, U as E, y as w } from "./app-BuvV4n4w.js";
2
+ import { a as L, t as R } from "./rules-DwOMpBOV.js";
3
+ import { u as z } from "./supplier-DTzECjWy.js";
4
4
  import { computed as f, defineComponent as H, mergeModels as j, useModel as q, ref as x, resolveComponent as V, openBlock as P, createElementBlock as U, normalizeStyle as W, createElementVNode as I, createVNode as $, withCtx as Q, createBlock as g, createCommentVNode as N, Fragment as Y, renderList as J, unref as M } from "vue";
5
- import { F as K } from "./FmMultiselectDialog-CEnIfKkK.js";
5
+ import { F as K } from "./FmMultiselectDialog-BcZpbDMT.js";
6
6
  function X(e, r, a) {
7
7
  var o;
8
8
  if (!!r.measurement === !!a && ((o = r.measurement) == null ? void 0 : o.id) === a)
@@ -1,7 +1,7 @@
1
1
  import { defineComponent as I, computed as g, ref as z, resolveComponent as h, openBlock as n, createElementBlock as y, createVNode as _, withCtx as L, createElementVNode as f, toDisplayString as Y, unref as u, createBlock as p, createCommentVNode as w, Fragment as $, renderList as R, watch as E, mergeModels as O, useModel as C, renderSlot as H, normalizeClass as S } from "vue";
2
2
  import { useCoreStore as W, useI18n as P } from "@feedmepos/mf-common";
3
- import { u as q } from "./app-CV3h70p4.js";
4
- import { d as U } from "./date2-CkCGGaAb.js";
3
+ import { u as q } from "./app-BuvV4n4w.js";
4
+ import { d as U } from "./date2-CkkGwYSP.js";
5
5
  import { useBreakpoints as G } from "@feedmepos/ui-library";
6
6
  import { u as J, F as K } from "./SingleColumnLayout.vue_vue_type_script_setup_true_lang-CWZkVCAj.js";
7
7
  import { b as A } from "./app-uBuHtW8m.js";
@@ -3,8 +3,8 @@ var De = (F, o, t) => o in F ? Ie(F, o, { enumerable: !0, configurable: !0, writ
3
3
  var me = (F, o, t) => De(F, typeof o != "symbol" ? o + "" : o, t);
4
4
  import { defineComponent as ge, computed as S, ref as L, watch as ke, openBlock as c, createElementBlock as h, normalizeStyle as j, Fragment as V, renderList as $, renderSlot as _e, createCommentVNode as O, useSlots as He, onMounted as $e, onUnmounted as Oe, reactive as q, resolveComponent as B, createElementVNode as I, createVNode as _, toDisplayString as ee, unref as H, createSlots as Ue, withCtx as w, createBlock as M, resolveDynamicComponent as fe, normalizeClass as he, withModifiers as Pe, Transition as Ee } from "vue";
5
5
  import { useDialogChild as Ke } from "@feedmepos/ui-library";
6
- import { y as be } from "./app-CV3h70p4.js";
7
- import { d as Ne } from "./index-DAnsA0Mm.js";
6
+ import { y as be } from "./app-BuvV4n4w.js";
7
+ import { d as Ne } from "./index-DKTL7IN3.js";
8
8
  /* empty css */
9
9
  import { useI18n as je } from "@feedmepos/mf-common";
10
10
  import { N as Ge, H as ye, b as ze } from "./app-uBuHtW8m.js";
@@ -1,7 +1,7 @@
1
1
  import { defineStore as p } from "pinia";
2
2
  import { useDialog as y } from "@feedmepos/ui-library";
3
3
  import { useI18n as v } from "@feedmepos/mf-common";
4
- import { a } from "./FmMultiselectDialog-CEnIfKkK.js";
4
+ import { a } from "./FmMultiselectDialog-BcZpbDMT.js";
5
5
  import { h as S } from "vue";
6
6
  const w = p("inventoryMultiSelectDialog", () => {
7
7
  const l = y(), { t: n } = v();
@@ -1,7 +1,7 @@
1
1
  import { defineComponent as ie, mergeModels as W, useModel as le, computed as v, ref as B, watch as E, onBeforeUnmount as ae, inject as ue, resolveComponent as b, openBlock as d, createElementBlock as y, createElementVNode as u, createVNode as h, withCtx as F, renderSlot as G, normalizeClass as j, toDisplayString as _, withDirectives as re, vModelText as me, createCommentVNode as I, createTextVNode as ce, createBlock as U, Fragment as de, renderList as pe } from "vue";
2
- import { l as fe } from "./lodash-CYR2InSF.js";
3
- import { s as D } from "./app-CV3h70p4.js";
4
- import { I as R, g as O, d as ve, a as M, c as be, t as ye, f as he, p as Me, b as ge, u as xe } from "./rules-2RvCSF3q.js";
2
+ import { l as fe } from "./lodash-TAQPcjEK.js";
3
+ import { s as D } from "./app-BuvV4n4w.js";
4
+ import { I as R, g as O, d as ve, a as M, c as be, t as ye, f as he, p as Me, b as ge, u as xe } from "./rules-DwOMpBOV.js";
5
5
  import "@feedmepos/ui-library";
6
6
  function H() {
7
7
  return {
@@ -2,14 +2,14 @@ import { defineComponent as De, ref as F, computed as J, watch as ze, resolveCom
2
2
  import { u as Ve, _ as ke } from "./SingleColumnLayout.vue_vue_type_script_setup_true_lang-CWZkVCAj.js";
3
3
  import { useCoreStore as Re, useI18n as je } from "@feedmepos/mf-common";
4
4
  import { useDialogChild as We, useSnackbar as Oe, useDialog as Le, useBreakpoints as Je } from "@feedmepos/ui-library";
5
- import { u as Xe } from "./feature-B_VTGztb.js";
6
- import { a as ie } from "./app-CV3h70p4.js";
7
- import "./dayjs.min-Dd-afiDx.js";
5
+ import { u as Xe } from "./feature-AINxwcz_.js";
6
+ import { a as ie } from "./app-BuvV4n4w.js";
7
+ import "./dayjs.min-DFvOuCCo.js";
8
8
  import "./app-uBuHtW8m.js";
9
- import { s as He, a as qe, d as Qe, t as Ce, r as Ye } from "./xlsx.util-Cc50iTml.js";
10
- import { s as Ze, g as et, b as tt, d as Fe } from "./import-export.helper-BLfWO3Yr.js";
9
+ import { s as He, a as qe, d as Qe, t as Ce, r as Ye } from "./xlsx.util-jpTCFIaP.js";
10
+ import { s as Ze, g as et, b as tt, d as Fe } from "./import-export.helper-CtI9oUN_.js";
11
11
  import { r as nt } from "./random-CSbEbElR.js";
12
- import { d as Ae, a as pe } from "./rules-2RvCSF3q.js";
12
+ import { d as Ae, a as pe } from "./rules-DwOMpBOV.js";
13
13
  import { F as ot } from "./FmDroppableField-J0xUsOTV.js";
14
14
  function Ee() {
15
15
  return `measurement_${(/* @__PURE__ */ new Date()).toISOString()}_${nt()}`;
@@ -1,5 +1,5 @@
1
1
  import { defineComponent as p, openBlock as s, createElementBlock as n, createElementVNode as r, toDisplayString as o, unref as l, Fragment as d, renderList as x } from "vue";
2
- import { a, f as y } from "./rules-2RvCSF3q.js";
2
+ import { a, f as y } from "./rules-DwOMpBOV.js";
3
3
  import { useI18n as _ } from "@feedmepos/mf-common";
4
4
  const v = { class: "flex flex-col" }, g = { class: "flex flex-row fm-typo-en-body-md-600 bg-fm-color-neutral-gray-100 text-fm-color-typo-secondary h-48 items-center" }, h = { class: "flex-1 py-8 px-16" }, b = {
5
5
  class: "flex-0 py-8 px-16",
@@ -1,5 +1,5 @@
1
1
  import { ref as A, computed as G, h as C, defineComponent as j, watch as re, resolveComponent as R, openBlock as F, createElementBlock as B, createVNode as b, unref as l, createElementVNode as c, toDisplayString as $, createBlock as M, withCtx as T, Fragment as pe, renderList as ve, createTextVNode as ye, createCommentVNode as se, isRef as ge, normalizeClass as _e, normalizeStyle as be, createSlots as ke, Teleport as xe, normalizeProps as he, guardReactiveProps as we } from "vue";
2
- import { a as L, c as z, j as oe, u as Re } from "./app-CV3h70p4.js";
2
+ import { a as L, c as z, j as oe, u as Re } from "./app-BuvV4n4w.js";
3
3
  import { useDialog as Ie, useSnackbar as Y, components as U, useProxiedModel as Se, useBreakpoints as Fe } from "@feedmepos/ui-library";
4
4
  import { F as S } from "./form-mode.enum-BKiNVH6A.js";
5
5
  import { useI18n as P, useCoreStore as Ge } from "@feedmepos/mf-common";
@@ -7,11 +7,11 @@ import { defineStore as ue, storeToRefs as ae } from "pinia";
7
7
  import { D as le, R as K } from "./row-action.enum-BcW_L_nE.js";
8
8
  import { c as Ve, _ as Ce, F as ie } from "./TableActionableRow.vue_vue_type_script_setup_true_lang-cfFHDIwQ.js";
9
9
  import { u as De, _ as Ae } from "./SingleColumnLayout.vue_vue_type_script_setup_true_lang-CWZkVCAj.js";
10
- import { _ as $e } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DBSjX9GC.js";
11
- import { d as de } from "./defineDeepModel-D_bZeRgl.js";
12
- import { I as Te, A as Ee, U as Me, R as ce } from "./rules-2RvCSF3q.js";
10
+ import { _ as $e } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-ClY0PFyA.js";
11
+ import { d as de } from "./defineDeepModel-s0no34Rq.js";
12
+ import { I as Te, A as Ee, U as Me, R as ce } from "./rules-DwOMpBOV.js";
13
13
  import { x as Ue, N as Be, b as ze } from "./app-uBuHtW8m.js";
14
- import { u as Le } from "./FmMultiselectDialog-D0HzUEWj.js";
14
+ import { u as Le } from "./FmMultiselectDialog-C9g5u6Kk.js";
15
15
  import { r as me } from "./random-CSbEbElR.js";
16
16
  import { u as Pe, R as Ne } from "./usePromise-CbVUCxhj.js";
17
17
  const H = ue(