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

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 (95) hide show
  1. package/dist/{App-DVsAv4k3.js → App-BO6IVlu7.js} +3 -3
  2. package/dist/{ApprovalView-EHDiLsmL.js → ApprovalView-CVX6nsha.js} +5 -5
  3. package/dist/{BindingsDialog-DL2Dgzpf.js → BindingsDialog-CvoCVSNi.js} +8 -8
  4. package/dist/{BindingsPicker-BpdNqjSm.js → BindingsPicker-BgJRr_DM.js} +3 -3
  5. package/dist/{BindingsTable-C6KWR_kl.js → BindingsTable-CoXmqfkS.js} +3 -3
  6. package/dist/{ClosingDraftView-Byx8Zp15.js → ClosingDraftView-DJOHSc45.js} +615 -573
  7. package/dist/ClosingHistoryView-D_-BFRz0.js +447 -0
  8. package/dist/{ClosingTemplateView-DqfxzSBi.js → ClosingTemplateView-Bk3D5Snj.js} +14 -14
  9. package/dist/{DeliveryOrderPrintPreview-DvaTq4XO.js → DeliveryOrderPrintPreview-Cb64kpGv.js} +9 -9
  10. package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-Dadg0d7W.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-DFANhaaJ.js} +59 -60
  11. package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-yp0tPBLr.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DF_WpezC.js} +2 -2
  12. package/dist/{FmMultiselectDialog-M-tcECkK.js → FmMultiselectDialog-Cfc5qRdH.js} +2 -2
  13. package/dist/{FmMultiselectDialog-iXXJJ181.js → FmMultiselectDialog-DeHxbT6C.js} +1 -1
  14. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-CzYmgtjx.js → FmUnitInput.vue_vue_type_script_setup_true_lang-BrCLK3_O.js} +3 -3
  15. package/dist/{ImportView-BGbe571V.js → ImportView-CwTD-Oy5.js} +6 -6
  16. package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-SkZJQR4H.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-DLq0PwYt.js} +1 -1
  17. package/dist/{IngredientGroupView-B5AhZqGE.js → IngredientGroupView-C9IrJkA2.js} +5 -5
  18. package/dist/{IngredientsView-BkORfSgQ.js → IngredientsView-cx05yMa1.js} +14 -14
  19. package/dist/{IntegrationView-DC1u6d1K.js → IntegrationView-DyhKmpP1.js} +12 -12
  20. package/dist/{InventoryBindingForm-D4ht1PMO.js → InventoryBindingForm-BiPyN399.js} +1 -1
  21. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-CFWTE_sj.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-B4hiEtLq.js} +14 -14
  22. package/dist/{InventoryBindingSummary-DKYKoLOt.js → InventoryBindingSummary-CLipXxCy.js} +1 -1
  23. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-D1hfyifk.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-dpwW1B9T.js} +1 -1
  24. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-BfsTUKPQ.js → PremiumBadge.vue_vue_type_script_setup_true_lang-CFi82_2z.js} +2 -2
  25. package/dist/{PublishView-CMTQJ7Nv.js → PublishView-xqkAIXWI.js} +3 -3
  26. package/dist/{PurchaseOrderPrintPreview-CzYlYowQ.js → PurchaseOrderPrintPreview-DQgycOZX.js} +9 -9
  27. package/dist/ReceiveRequestView-Bteeg8L4.js +2894 -0
  28. package/dist/{RecipeView-CIwSZuEd.js → RecipeView-Wr4d3B_9.js} +8 -8
  29. package/dist/{StockView-DBY2sHlj.js → StockView-CkKpgWUl.js} +344 -341
  30. package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-VY2KygFc.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-DSGGTbPw.js} +1 -1
  31. package/dist/{SupplierView-CGsqiXR4.js → SupplierView-BK-t2Qtu.js} +11 -11
  32. package/dist/{SystemTrailDialog.vue_vue_type_script_setup_true_lang-BUs4-nO6.js → SystemTrailDialog.vue_vue_type_script_setup_true_lang-D7L13xxB.js} +2 -2
  33. package/dist/{TemplatePublishDialog.vue_vue_type_script_setup_true_lang-plLh-5S3.js → TemplatePublishDialog.vue_vue_type_script_setup_true_lang-DWMif1dO.js} +1 -1
  34. package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-C8DluFT4.js → TransferDetails.vue_vue_type_script_setup_true_lang-0tyNbKG0.js} +306 -306
  35. package/dist/{TransferTemplateView-BEXsC7mp.js → TransferTemplateView-qIlYcciH.js} +354 -354
  36. package/dist/{UnitView-BGRkT8Hr.js → UnitView-B5boUZuR.js} +6 -6
  37. package/dist/{WarehouseView-D7og7WBg.js → WarehouseView-C3PXZgeW.js} +5 -5
  38. package/dist/WastageTemplateView-BfJZ5Heq.js +2327 -0
  39. package/dist/api/stock.d.ts +2 -0
  40. package/dist/{app-CioeggUO.js → app-IXE7AiJd.js} +2344 -2296
  41. package/dist/app.js +7 -7
  42. package/dist/{closing-template-DrBlhTbC.js → closing-template-Bdb3yRUm.js} +1 -1
  43. package/dist/{date2-mucf0HV-.js → date2-FhBpgAsI.js} +1 -1
  44. package/dist/{dayjs.min-C5lVIjQ1.js → dayjs.min-DzvYG-ky.js} +21 -21
  45. package/dist/{decimal-EYAs7CPT.js → decimal-Io-Hwy_Y.js} +2 -2
  46. package/dist/{defineDeepModel-BQ_3cF8o.js → defineDeepModel-D8sQDXuo.js} +1 -1
  47. package/dist/{duplicate-template-K_oezMr4.js → duplicate-template-DnygqbZo.js} +1 -1
  48. package/dist/feature-C4FdNiJm.js +25697 -0
  49. package/dist/{format-time-from-id-qnJY4xQY.js → format-time-from-id-oJMEPmai.js} +1 -1
  50. package/dist/{format-unit-display-6I_PHQ9C.js → format-unit-display-CyyP1TnC.js} +245 -246
  51. package/dist/helper/form.d.ts +1 -0
  52. package/dist/helper/object.d.ts +21 -0
  53. package/dist/helper/reactivity.d.ts +11 -0
  54. package/dist/helper/reactivity.spec.d.ts +1 -0
  55. package/dist/{import-export.helper-vmA8rXwv.js → import-export.helper-C33N1h7C.js} +5 -5
  56. package/dist/{index-DXJ9MIiE.js → index-DYfJ9nqH.js} +9 -9
  57. package/dist/{index-5yza2WJR.js → index-DdtrR7II.js} +1 -1
  58. package/dist/{index-DqMYKP87.js → index-qDt3kqgv.js} +3 -3
  59. package/dist/{lodash-D6iOSfR7.js → lodash-DRz5U0Za.js} +1 -1
  60. package/dist/{netsuite-DKE_ORM0.js → netsuite-CIv-Yh60.js} +70 -70
  61. package/dist/{purchase-order-template-Brpbfw8K.js → purchase-order-template-CX62LUzz.js} +1 -1
  62. package/dist/{rules-fd3m4inF.js → rules-DmJTahUJ.js} +3 -3
  63. package/dist/{stock-CLX4SKxt.js → stock-BAtpqZgN.js} +3 -3
  64. package/dist/{stock-8-vRigjE.js → stock-dMNUMGOC.js} +35 -27
  65. package/dist/{supplier-Dlv1Clk5.js → supplier-B2g3AW72.js} +2 -2
  66. package/dist/tsconfig.app.tsbuildinfo +1 -1
  67. package/dist/{use-ingredient-select-dialog-2j3Nbou_.js → use-ingredient-select-dialog-ZyFtPCb9.js} +2 -2
  68. package/dist/{use-inventory-binding-dialog-_S2XGoVU.js → use-inventory-binding-dialog-CRgPd2qi.js} +2 -2
  69. package/dist/{use-template-enabled-locations-2-CWlQQnyD.js → use-template-enabled-locations-2-S598U0zh.js} +2 -2
  70. package/dist/views/adjustment-template/wastage-template/form/useAdjustmentTemplateItems.d.ts +7 -0
  71. package/dist/views/closing-draft/composables/use-closing-draft-actions.d.ts +4 -1
  72. package/dist/views/ingredient-group/components/ingredient-group-form/IngredientGroupForm.vue.d.ts +1 -0
  73. package/dist/views/receive-request/components/netsuite/NetSuitePanel.vue.d.ts +3 -2
  74. package/dist/views/receive-request/components/netsuite/NetSuiteProps.d.ts +3 -2
  75. package/dist/views/receive-request/components/transfer-form/TransferFormProps.d.ts +6 -0
  76. package/dist/views/receive-request/components/transfer-form/TransferFormWithController.vue.d.ts +628 -0
  77. package/dist/views/receive-request/components/transfer-form/composables/use-purchase-order-form-controller.d.ts +22 -0
  78. package/dist/views/receive-request/components/transfer-form/composables/use-transfer-items.d.ts +3 -2
  79. package/dist/views/receive-request/composables/use-process-purchase-order.d.ts +1 -1
  80. package/dist/views/receive-request/composables/use-receive-request-form.d.ts +6 -6
  81. package/dist/views/receive-request/composables/use-receive-request-table.d.ts +7 -7
  82. package/dist/views/receive-request/constants/purchase-order-transaction-type.d.ts +2 -2
  83. package/dist/views/receive-request/helper/get-transfer-type.d.ts +1 -2
  84. package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-template-items.d.ts +3 -2
  85. package/dist/views/transfer-template/components/transfer-template-import/TransferTemplateImportItemProps.d.ts +3 -2
  86. package/dist/views/transfer-template/helpers/import-export.helper.d.ts +4 -3
  87. package/dist/{vue-i18n-CCrvzsiW.js → vue-i18n-CoLcy8bm.js} +286 -286
  88. package/dist/{xlsx-oL4emcgf.js → xlsx-CtFn9Ikt.js} +398 -398
  89. package/dist/{xlsx.util-JOeDOZ3P.js → xlsx.util-C5Ug4P4c.js} +1 -1
  90. package/package.json +3 -3
  91. package/dist/ClosingHistoryView-BpFFNCqD.js +0 -391
  92. package/dist/ReceiveRequestView-CMHZZ9ul.js +0 -2841
  93. package/dist/WastageTemplateView-CwEUAwCw.js +0 -2287
  94. package/dist/feature-BkR98vGd.js +0 -20161
  95. package/dist/views/receive-request/components/transfer-form/TransferForm.vue.d.ts +0 -3159
@@ -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-IXE7AiJd.js";
5
+ import { _ as pe } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DF_WpezC.js";
6
+ import { useSnackbar as W, useDialog as ge } from "@feedmepos/ui-library";
7
+ import { u as _e } from "./stock-dMNUMGOC.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-DrBlhTbC.js";
8
- import { u as fe, c as Ne, a as ve, n as ot } from "./app-CioeggUO.js";
9
- import { t as re, a as ge, d as ye, s as Le, r as st } from "./xlsx.util-JOeDOZ3P.js";
7
+ import { a as me } from "./closing-template-Bdb3yRUm.js";
8
+ import { u as fe, c as Ne, a as ve, n as ot } from "./app-IXE7AiJd.js";
9
+ import { t as re, a as ge, d as ye, s as Le, r as st } from "./xlsx.util-C5Ug4P4c.js";
10
10
  import { F as lt } from "./FmDroppableField-J0xUsOTV.js";
11
- import { f as Be, a as le } from "./date2-mucf0HV-.js";
11
+ import { f as Be, a as le } from "./date2-FhBpgAsI.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-qnJY4xQY.js";
15
- import { _ as it } from "./TemplatePublishDialog.vue_vue_type_script_setup_true_lang-plLh-5S3.js";
16
- import { u as ct } from "./netsuite-DKE_ORM0.js";
17
- import { u as mt } from "./duplicate-template-K_oezMr4.js";
18
- import { _ as ut } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-yp0tPBLr.js";
19
- import { R as dt, A as pt } from "./rules-fd3m4inF.js";
20
- import { u as ft } from "./use-ingredient-select-dialog-2j3Nbou_.js";
21
- import { d as vt } from "./defineDeepModel-BQ_3cF8o.js";
22
- import { u as gt } from "./use-template-enabled-locations-2-CWlQQnyD.js";
23
- import { _ as yt } from "./SystemTrailDialog.vue_vue_type_script_setup_true_lang-BUs4-nO6.js";
14
+ import { f as rt } from "./format-time-from-id-oJMEPmai.js";
15
+ import { _ as it } from "./TemplatePublishDialog.vue_vue_type_script_setup_true_lang-DWMif1dO.js";
16
+ import { u as ct } from "./netsuite-CIv-Yh60.js";
17
+ import { u as mt } from "./duplicate-template-DnygqbZo.js";
18
+ import { _ as ut } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DF_WpezC.js";
19
+ import { R as dt, A as pt } from "./rules-DmJTahUJ.js";
20
+ import { u as ft } from "./use-ingredient-select-dialog-ZyFtPCb9.js";
21
+ import { d as vt } from "./defineDeepModel-D8sQDXuo.js";
22
+ import { u as gt } from "./use-template-enabled-locations-2-S598U0zh.js";
23
+ import { _ as yt } from "./SystemTrailDialog.vue_vue_type_script_setup_true_lang-D7L13xxB.js";
24
24
  import { _ as ht } from "./_plugin-vue_export-helper-CHgC5LLL.js";
25
25
  const ue = Ve(
26
26
  "closingTemplateTable",
@@ -1,14 +1,14 @@
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 { K as y } from "./app-CioeggUO.js";
3
+ import { L as y } from "./app-IXE7AiJd.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,
7
7
  class: "subtitle"
8
- }, S = { class: "sub-header" }, E = { class: "caption" }, T = { class: "address" }, q = { class: "text-right" }, F = { class: "sub-header" }, I = { class: "address" }, U = { class: "purchase-body" }, B = { class: "text-left" }, H = { class: "text-left" }, L = { class: "text-left" }, M = { class: "text-left" }, V = { class: "text-left" }, J = { class: "text-right" }, j = { key: 0 }, z = {
8
+ }, S = { class: "sub-header" }, E = { class: "caption" }, T = { class: "address" }, q = { class: "text-right" }, F = { class: "sub-header" }, I = { class: "address" }, L = { class: "purchase-body" }, U = { class: "text-left" }, B = { class: "text-left" }, H = { class: "text-left" }, M = { class: "text-left" }, V = { class: "text-left" }, J = { class: "text-right" }, j = { key: 0 }, z = {
9
9
  key: 1,
10
10
  style: { "padding-top": "30px" }
11
- }, G = { valign: "bottom" }, K = { class: "header" }, Q = { class: "caption" }, W = {
11
+ }, G = { valign: "bottom" }, Q = { class: "header" }, K = { class: "caption" }, W = {
12
12
  class: "text-left",
13
13
  style: { width: "20%" }
14
14
  }, X = { class: "text-left" }, Y = {
@@ -107,7 +107,7 @@ const c = { class: "purchase-box" }, A = { valign: "bottom" }, N = { class: "sub
107
107
  ])
108
108
  ])
109
109
  ]),
110
- t("div", U, [
110
+ t("div", L, [
111
111
  t("table", null, [
112
112
  l[19] || (l[19] = t("thead", { class: "item-header" }, [
113
113
  t("tr", null, [
@@ -127,9 +127,9 @@ const c = { class: "purchase-box" }, A = { valign: "bottom" }, N = { class: "sub
127
127
  ], -1)),
128
128
  t("tbody", null, [
129
129
  t("tr", null, [
130
- t("td", B, e(s.value.orderNumber), 1),
131
- t("td", H, e(s.value.ref), 1),
132
- t("td", L, e(s.value.supplier.phoneNumber), 1)
130
+ t("td", U, e(s.value.orderNumber), 1),
131
+ t("td", B, e(s.value.ref), 1),
132
+ t("td", H, e(s.value.supplier.phoneNumber), 1)
133
133
  ])
134
134
  ])
135
135
  ]),
@@ -179,8 +179,8 @@ const c = { class: "purchase-box" }, A = { valign: "bottom" }, N = { class: "sub
179
179
  t("table", null, [
180
180
  t("tr", G, [
181
181
  t("td", null, [
182
- t("div", K, "Ref: " + e(r.ref), 1),
183
- t("div", Q, e(r.createdAt), 1),
182
+ t("div", Q, "Ref: " + e(r.ref), 1),
183
+ t("div", K, e(r.createdAt), 1),
184
184
  t("div", null, "Remark: " + e(r.remark), 1)
185
185
  ])
186
186
  ])