@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
@@ -1,4 +1,4 @@
1
- import { r as m, u, a as d } from "./xlsx-oL4emcgf.js";
1
+ import { r as m, u, a as d } from "./xlsx-CtFn9Ikt.js";
2
2
  function* x(o) {
3
3
  const [e, n] = o.split(":"), t = /\d+/, l = t.exec(e), c = t.exec(n);
4
4
  if (!l || !c)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@feedmepos/mf-inventory-portal",
3
- "version": "1.2.43",
3
+ "version": "1.2.44-dev.2",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"
@@ -44,11 +44,11 @@
44
44
  "vue-router": "^4.4.0",
45
45
  "xlsx": "^0.18.5",
46
46
  "@feedmepos/inventory-core": "^1.0.1-dev.2",
47
+ "@feedmepos/inventory-core-2": "^2.0.0",
47
48
  "@feedmepos/inventory-core-dart": "^1.0.0",
48
49
  "@feedmepos/inventory-core-js": "^1.0.1",
49
50
  "@feedmepos/netsuite-core": "^1.0.0",
50
- "@feedmepos/zod-inventory": "^2.0.0",
51
- "@feedmepos/inventory-core-2": "^2.0.0"
51
+ "@feedmepos/zod-inventory": "^2.0.0"
52
52
  },
53
53
  "devDependencies": {
54
54
  "@rushstack/eslint-patch": "^1.10.3",
@@ -1,391 +0,0 @@
1
- import { defineComponent as H, ref as f, computed as k, resolveComponent as w, openBlock as d, createElementBlock as y, createVNode as p, withModifiers as oe, withCtx as R, createElementVNode as n, toDisplayString as s, unref as a, Fragment as M, createTextVNode as z, createBlock as B, createCommentVNode as V, renderList as le, normalizeClass as ae, h as ne, onMounted as se, Teleport as ie } from "vue";
2
- import { F as ce, _ as re } from "./SingleColumnLayout.vue_vue_type_script_setup_true_lang-CWZkVCAj.js";
3
- import { useI18n as j, useCoreStore as ue } from "@feedmepos/mf-common";
4
- import { C as G, z as S, u as de } from "./app-CioeggUO.js";
5
- import { _ as me } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-yp0tPBLr.js";
6
- import { useSnackbar as J, useDialog as ve } from "@feedmepos/ui-library";
7
- import { u as ye } from "./stock-8-vRigjE.js";
8
- const fe = { class: "fm-typo-en-heading-lg-600" }, pe = { class: "flex flex-col gap-16" }, ge = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, _e = { class: "flex flex-col gap-8" }, be = { class: "fm-typo-en-body-md-600" }, he = { class: "flex flex-col gap-8" }, ke = { class: "fm-typo-en-body-md-600" }, xe = { class: "flex items-center gap-8 mb-8" }, De = {
9
- key: 2,
10
- class: "text-red-500 text-sm mt-2"
11
- }, Ve = { class: "fm-typo-en-body-sm-400" }, we = {
12
- key: 1,
13
- class: "flex flex-col gap-8"
14
- }, Se = { class: "fm-typo-en-body-md-600" }, Ce = { class: "flex flex-col gap-8 max-h-[300px] overflow-y-auto" }, Ae = { class: "flex items-center justify-between" }, Fe = { class: "fm-typo-en-body-sm-600" }, Re = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Be = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Le = {
15
- key: 0,
16
- class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
17
- }, Te = {
18
- key: 1,
19
- class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
20
- }, Oe = {
21
- key: 2,
22
- class: "fm-typo-en-body-xs-400 text-fm-color-system-error-500"
23
- }, $e = {
24
- key: 0,
25
- class: "flex gap-8 ml-auto"
26
- }, Ee = {
27
- key: 1,
28
- class: "flex gap-8 ml-auto"
29
- }, Ie = /* @__PURE__ */ H({
30
- __name: "RecalculationDialog",
31
- emits: ["submitted"],
32
- setup(Q, { expose: b, emit: L }) {
33
- const C = L, { t: l } = j(), T = ye(), O = G(), x = J(), v = f(!1), u = f(""), i = f(""), g = f(!1), A = f([]), c = f(!1), D = f([]), r = f(!1), m = k(() => A.value.map((e) => {
34
- const o = S(e._id), _ = new Date(o);
35
- return {
36
- label: `${_.toLocaleDateString()} ${_.toLocaleTimeString()}`,
37
- value: e._id
38
- };
39
- })), h = k(() => u.value ? m.value.filter((e) => e.value > u.value) : []), F = k({
40
- get: () => {
41
- if (g.value && i.value) {
42
- const e = A.value.find((o) => S(o._id) === i.value);
43
- return (e == null ? void 0 : e._id) || i.value;
44
- }
45
- return i.value;
46
- },
47
- set: (e) => {
48
- g.value && e ? i.value = S(e) : i.value = e;
49
- }
50
- }), W = k(() => {
51
- if (u.value)
52
- try {
53
- const e = S(u.value);
54
- if (e)
55
- return e;
56
- } catch (e) {
57
- console.error("Error parsing date from closing ID:", e);
58
- }
59
- }), $ = k(() => {
60
- if (!u.value || !i.value) return "";
61
- const e = S(u.value), o = i.value;
62
- if (e && o) {
63
- const _ = new Date(e).getTime();
64
- if (new Date(o).getTime() <= _)
65
- return l("inventory.stock.recalculation.error.endDateBeforeOpening");
66
- }
67
- return "";
68
- }), I = k(() => !!u.value && !!i.value && !$.value), N = k(() => D.value.some(
69
- (e) => !e.completedAt && !e.failedReason
70
- ));
71
- async function P() {
72
- v.value = !0, await Promise.all([Y(), U()]), u.value = "", i.value = "", g.value = !1;
73
- }
74
- function X() {
75
- v.value = !1;
76
- }
77
- b({
78
- open: P,
79
- close: X
80
- });
81
- async function Y() {
82
- c.value = !0;
83
- try {
84
- const e = await O.getLastNClosings(30);
85
- A.value = e;
86
- } catch (e) {
87
- console.error("Error fetching recent closings:", e), x.open({
88
- title: l("common.error"),
89
- message: "Failed to fetch recent closings",
90
- type: "error"
91
- });
92
- } finally {
93
- c.value = !1;
94
- }
95
- }
96
- async function U() {
97
- r.value = !0;
98
- try {
99
- const e = await T.recalculation.recalculationRequests();
100
- D.value = e;
101
- } catch (e) {
102
- console.error("Error fetching recalculation requests:", e);
103
- } finally {
104
- r.value = !1;
105
- }
106
- }
107
- async function Z() {
108
- if (I.value) {
109
- c.value = !0;
110
- try {
111
- await T.recalculation.scheduleRecalculation(u.value, i.value), x.open({
112
- title: l("common.success"),
113
- message: "Stock recalculation has been scheduled successfully",
114
- type: "success"
115
- }), await U(), v.value = !1, C("submitted");
116
- } catch (e) {
117
- console.error("Error scheduling recalculation:", e), x.open({
118
- title: l("common.error"),
119
- message: "Failed to schedule stock recalculation",
120
- type: "error"
121
- });
122
- } finally {
123
- c.value = !1;
124
- }
125
- }
126
- }
127
- return (e, o) => {
128
- const _ = w("FmButton"), E = w("FmSelect"), K = w("FmRadio"), q = w("FmDatePicker"), ee = w("FmAlert"), te = w("FmDialog");
129
- return d(), y("div", null, [
130
- p(_, {
131
- "prepend-icon": "info",
132
- variant: "tertiary",
133
- onClick: oe(P, ["stop"])
134
- }),
135
- p(te, {
136
- modelValue: v.value,
137
- "onUpdate:modelValue": o[7] || (o[7] = (t) => v.value = t),
138
- "close-button": "",
139
- dismissAway: "",
140
- "max-width": "600px"
141
- }, {
142
- "dialog-header": R(() => [
143
- n("div", fe, s(a(l)("inventory.stock.recalculation.title")), 1)
144
- ]),
145
- "dialog-footer": R(() => [
146
- N.value ? (d(), y("div", Ee, [
147
- p(_, {
148
- variant: "tertiary",
149
- onClick: o[6] || (o[6] = (t) => v.value = !1),
150
- label: a(l)("common.close")
151
- }, null, 8, ["label"])
152
- ])) : (d(), y("div", $e, [
153
- p(_, {
154
- variant: "tertiary",
155
- onClick: o[5] || (o[5] = (t) => v.value = !1),
156
- disabled: c.value,
157
- label: a(l)("common.cancel")
158
- }, null, 8, ["disabled", "label"]),
159
- p(_, {
160
- variant: "primary",
161
- onClick: Z,
162
- disabled: !I.value || c.value,
163
- loading: c.value,
164
- label: a(l)("inventory.stock.recalculation.schedule")
165
- }, null, 8, ["disabled", "loading", "label"])
166
- ]))
167
- ]),
168
- default: R(() => [
169
- n("div", pe, [
170
- n("div", ge, s(a(l)("inventory.stock.recalculation.description")), 1),
171
- N.value ? V("", !0) : (d(), y(M, { key: 0 }, [
172
- n("div", _e, [
173
- n("p", be, [
174
- z(s(a(l)("inventory.stock.recalculation.openingDate")) + " ", 1),
175
- o[8] || (o[8] = n("span", { class: "text-fm-color-system-error-300" }, "*", -1))
176
- ]),
177
- 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)),
178
- p(E, {
179
- modelValue: u.value,
180
- "onUpdate:modelValue": o[0] || (o[0] = (t) => u.value = t),
181
- items: m.value,
182
- placeholder: a(l)("inventory.stock.recalculation.selectOpening"),
183
- loading: c.value,
184
- disabled: c.value
185
- }, null, 8, ["modelValue", "items", "placeholder", "loading", "disabled"])
186
- ]),
187
- n("div", he, [
188
- n("p", ke, [
189
- z(s(a(l)("inventory.stock.recalculation.untilDate")) + " ", 1),
190
- o[10] || (o[10] = n("span", { class: "text-fm-color-system-error-300" }, "*", -1))
191
- ]),
192
- n("div", xe, [
193
- p(K, {
194
- modelValue: g.value,
195
- "onUpdate:modelValue": o[1] || (o[1] = (t) => g.value = t),
196
- value: !1,
197
- label: a(l)("inventory.stock.recalculation.selectByDate")
198
- }, null, 8, ["modelValue", "label"]),
199
- p(K, {
200
- modelValue: g.value,
201
- "onUpdate:modelValue": o[2] || (o[2] = (t) => g.value = t),
202
- value: !0,
203
- label: a(l)("inventory.stock.recalculation.selectByClosing")
204
- }, null, 8, ["modelValue", "label"])
205
- ]),
206
- g.value ? (d(), B(E, {
207
- key: 1,
208
- modelValue: F.value,
209
- "onUpdate:modelValue": o[4] || (o[4] = (t) => F.value = t),
210
- items: h.value,
211
- placeholder: a(l)("inventory.stock.recalculation.selectClosing"),
212
- loading: c.value,
213
- disabled: !u.value || c.value
214
- }, null, 8, ["modelValue", "items", "placeholder", "loading", "disabled"])) : (d(), B(q, {
215
- key: 0,
216
- modelValue: i.value,
217
- "onUpdate:modelValue": o[3] || (o[3] = (t) => i.value = t),
218
- placeholder: a(l)("inventory.stock.recalculation.selectDate"),
219
- min: W.value,
220
- disabled: !u.value || c.value
221
- }, null, 8, ["modelValue", "placeholder", "min", "disabled"])),
222
- $.value ? (d(), y("div", De, s($.value), 1)) : V("", !0)
223
- ]),
224
- u.value && i.value && !$.value ? (d(), B(ee, {
225
- key: 0,
226
- type: "info"
227
- }, {
228
- default: R(() => [
229
- n("div", Ve, s(a(l)("inventory.stock.recalculation.info")), 1)
230
- ]),
231
- _: 1
232
- })) : V("", !0)
233
- ], 64)),
234
- D.value.length > 0 ? (d(), y("div", we, [
235
- n("p", Se, s(a(l)("inventory.stock.recalculation.recentRequests")), 1),
236
- n("div", Ce, [
237
- (d(!0), y(M, null, le(D.value, (t) => (d(), y("div", {
238
- key: t._id,
239
- class: "p-12 border border-fm-color-border-primary rounded-8 flex flex-col gap-4"
240
- }, [
241
- n("div", Ae, [
242
- n("div", Fe, s(a(l)("inventory.stock.recalculation.requestedAt")) + ": " + s(new Date(t.createdAt).toLocaleString()), 1),
243
- n("div", {
244
- class: ae(["fm-typo-en-body-xs-600 px-8 py-4 rounded-4", {
245
- "bg-fm-color-system-error-100 text-fm-color-system-error-500": t.failedReason,
246
- "bg-fm-color-system-success-100 text-fm-color-system-success-500": t.completedAt,
247
- "bg-fm-color-system-info-100 text-fm-color-system-info-500": !t.failedReason && !t.completedAt
248
- }])
249
- }, 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)
250
- ]),
251
- n("div", Re, s(a(l)("inventory.stock.recalculation.from")) + ": " + s(new Date(t.recalculateStartDate).toLocaleDateString()), 1),
252
- n("div", Be, s(a(l)("inventory.stock.recalculation.to")) + ": " + s(new Date(t.recalculateEndDate).toLocaleDateString()), 1),
253
- t.createdBy ? (d(), y("div", Le, s(a(l)("inventory.stock.recalculation.requestedBy")) + ": " + s(t.createdBy.name || t.createdBy.id), 1)) : V("", !0),
254
- t.completedAt ? (d(), y("div", Te, s(a(l)("inventory.stock.recalculation.completedAt")) + ": " + s(new Date(t.completedAt).toLocaleString()), 1)) : V("", !0),
255
- t.failedReason ? (d(), y("div", Oe, s(t.failedReason), 1)) : V("", !0)
256
- ]))), 128))
257
- ])
258
- ])) : V("", !0)
259
- ])
260
- ]),
261
- _: 1
262
- }, 8, ["modelValue"])
263
- ]);
264
- };
265
- }
266
- }), Ne = { class: "flex flex-col gap-16 p-16" }, Ge = /* @__PURE__ */ H({
267
- __name: "ClosingHistoryView",
268
- setup(Q) {
269
- var D;
270
- const { t: b } = j(), L = G(), C = de(), l = ue(), T = ve(), O = J(), x = f([]), v = f(!1), u = k(() => [
271
- {
272
- label: b("inventory.stock.recalculation.title", "Stock Recalculation"),
273
- value: "recalculation",
274
- prependIcon: "history",
275
- isAdminOnly: !0
276
- },
277
- {
278
- label: b("inventory.closing.history.initiate_opening", "Initiate Opening"),
279
- value: "initiateOpening",
280
- prependIcon: "add_box",
281
- isAdminOnly: !0
282
- }
283
- ]), i = f();
284
- function g(r) {
285
- var m;
286
- switch (r) {
287
- case "recalculation":
288
- return (m = i.value) == null ? void 0 : m.open();
289
- case "initiateOpening":
290
- T.open({
291
- title: "Initiate Opening Balance",
292
- message: "Initiate opening balance if no opening balance exists for the current location.",
293
- primaryActions: { text: "Confirm", close: !0 }
294
- }).onPrimary(async () => {
295
- try {
296
- await L.initiateClosing(), O.open({
297
- message: "Opening balance initiated successfully.",
298
- type: "success"
299
- }), await c();
300
- } catch (h) {
301
- O.open({
302
- message: h.message || "Failed to initiate opening balance. Please try again.",
303
- type: "error"
304
- });
305
- }
306
- });
307
- }
308
- }
309
- const A = [
310
- ...(D = l.sessionUser.value) != null && D.role.isAdmin ? [
311
- {
312
- accessorKey: "_id",
313
- header: () => ne(ce, {}, () => `${b("inventory.closing.history.closingId")}`),
314
- cell: (r) => r.getValue()
315
- }
316
- ] : [],
317
- {
318
- accessorKey: "_id",
319
- id: "date",
320
- header: () => b("inventory.closing.history.date"),
321
- cell: (r) => {
322
- const m = r.getValue(), h = S(m);
323
- return new Date(h).toLocaleDateString();
324
- }
325
- },
326
- {
327
- accessorKey: "_id",
328
- id: "time",
329
- header: () => b("inventory.closing.history.time"),
330
- cell: (r) => {
331
- const m = r.getValue(), h = S(m);
332
- return new Date(h).toLocaleTimeString();
333
- }
334
- },
335
- {
336
- accessorKey: "ref",
337
- header: () => b("inventory.closing.history.createdFrom"),
338
- cell: (r) => r.getValue() || "-"
339
- }
340
- ];
341
- async function c() {
342
- if (C.currentLocationDBName) {
343
- v.value = !0;
344
- try {
345
- const r = await L.getLastNClosings(30);
346
- x.value = r;
347
- } catch (r) {
348
- console.error("Error fetching closings:", r), x.value = [];
349
- } finally {
350
- v.value = !1;
351
- }
352
- }
353
- }
354
- return se(async () => {
355
- C.currentLocationDBName && await c();
356
- }), C.watchLocation(c), (r, m) => {
357
- const h = w("FmTable");
358
- return d(), B(re, {
359
- actions: u.value,
360
- title: a(b)("inventory.closing.history.title"),
361
- "onClick:action": g
362
- }, {
363
- default: R(() => [
364
- n("div", Ne, [
365
- p(me, {
366
- "change-location": "",
367
- "hide-filter-options": !0
368
- }),
369
- m[1] || (m[1] = n("div", { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, " Displaying the last 30 closing records. ", -1)),
370
- p(h, {
371
- loading: v.value,
372
- "row-data": x.value,
373
- "column-defs": A
374
- }, null, 8, ["loading", "row-data"])
375
- ]),
376
- (d(), B(ie, { to: "body" }, [
377
- p(Ie, {
378
- ref_key: "recalculationDialogRef",
379
- ref: i,
380
- onSubmitted: m[0] || (m[0] = (F) => c())
381
- }, null, 512)
382
- ]))
383
- ]),
384
- _: 1
385
- }, 8, ["actions", "title"]);
386
- };
387
- }
388
- });
389
- export {
390
- Ge as default
391
- };