@feedmepos/mf-inventory-portal 1.2.1 → 1.2.2-5.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 (147) hide show
  1. package/dist/App-DMkUg806.js +297 -0
  2. package/dist/{ApprovalView-DwRrbVDo.js → ApprovalView-DWJh2K6W.js} +65 -64
  3. package/dist/{BindingsDialog-DUVKv10-.js → BindingsDialog-EmHCvqJI.js} +2 -2
  4. package/dist/{BindingsPicker-Daib_iq4.js → BindingsPicker-h_9jm1s0.js} +3 -3
  5. package/dist/{BindingsTable-Bv9UmcJP.js → BindingsTable-BAVWGUoa.js} +1 -1
  6. package/dist/ClosingDraftView-Du4kOwIg.js +1899 -0
  7. package/dist/ClosingHistoryView-DuW2Vtrs.js +355 -0
  8. package/dist/ClosingTemplateView-CfPY8R5M.js +2001 -0
  9. package/dist/{DeliveryOrderPrintPreview-DZPcRAja.js → DeliveryOrderPrintPreview-C6Cj8mOp.js} +9 -9
  10. package/dist/FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-WWIrybw_.js +230 -0
  11. package/dist/{FmMultiselectDialog-CZmwOkrb.js → FmMultiselectDialog-BzWrQOS4.js} +1 -1
  12. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-C-2V2bGc.js → FmUnitInput.vue_vue_type_script_setup_true_lang-DwqVRUFz.js} +36 -36
  13. package/dist/ImportView-lKlYeLay.js +1291 -0
  14. package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-BGnoF1Zz.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-_2WZMZU2.js} +5 -5
  15. package/dist/{IngredientGroupView-CAVYpEj3.js → IngredientGroupView-CrmwR2Xt.js} +34 -35
  16. package/dist/IngredientsView-1bAsyz-b.js +2254 -0
  17. package/dist/{IntegrationView-DdLFyZ4H.js → IntegrationView-D16qeEc_.js} +1773 -1635
  18. package/dist/{InventoryBindingForm-C7BdEDtM.js → InventoryBindingForm-BRwOXV_P.js} +1 -1
  19. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-B7DND2dQ.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-NDbtbtqK.js} +28 -28
  20. package/dist/{InventoryBindingSummary-IZ7F-Lti.js → InventoryBindingSummary-DKM2gX8_.js} +1 -1
  21. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-sgqVSlUB.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-CdaiYTdf.js} +4 -4
  22. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-DeF32bHu.js → PremiumBadge.vue_vue_type_script_setup_true_lang-B0OKeK5O.js} +7 -7
  23. package/dist/{PublishView-DkgfYneI.js → PublishView-D0NnU22l.js} +73 -63
  24. package/dist/{PurchaseOrderPrintPreview-CltLC4o4.js → PurchaseOrderPrintPreview-BmuwNbeL.js} +4 -4
  25. package/dist/{ReceiveRequestView-Dj7ji0DY.js → ReceiveRequestView-j79m7TKk.js} +343 -333
  26. package/dist/RecipeView-D_fNQQ-C.js +636 -0
  27. package/dist/StockView-DX_xeFBT.js +2385 -0
  28. package/dist/SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-Bg49isUy.js +172 -0
  29. package/dist/{SupplierView-DE_M_9kd.js → SupplierView-DuFTqbOg.js} +1193 -1073
  30. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-c428GXwc.js +3233 -0
  31. package/dist/{TransferTemplateView-gWGBCF3u.js → TransferTemplateView-Ccsfcetz.js} +104 -103
  32. package/dist/UnitView-BklpNsFN.js +674 -0
  33. package/dist/WarehouseView-BrURbU67.js +1066 -0
  34. package/dist/api/adjustment-template.d.ts +1 -0
  35. package/dist/api/bill.d.ts +140 -2
  36. package/dist/api/closing-template.d.ts +1 -0
  37. package/dist/api/closing.d.ts +1 -0
  38. package/dist/api/inventory.d.ts +405 -0
  39. package/dist/api/netsuite.d.ts +5 -1
  40. package/dist/api/purchase-order-template.d.ts +1 -0
  41. package/dist/api/purchase-order.d.ts +3 -0
  42. package/dist/api/shipment.d.ts +11 -0
  43. package/dist/api/stock.d.ts +2 -44
  44. package/dist/api/warehouse.d.ts +3 -1
  45. package/dist/{app-CruHLH1e.js → app-a9r50k3U.js} +68551 -67573
  46. package/dist/app.d.ts +643 -15
  47. package/dist/app.js +6 -6
  48. package/dist/components/FmAdminBadge.vue.d.ts +1 -4
  49. package/dist/components/FmEnhancedSelect.vue.d.ts +30 -0
  50. package/dist/components/FmInventoryTableToolbar.vue.d.ts +16 -2
  51. package/dist/components/FmLockableField.vue.d.ts +3 -0
  52. package/dist/components/netsuite/ItemSubsidiaryTreeDialog.vue.d.ts +16 -0
  53. package/dist/components/netsuite/SubsidiaryTreeDialog.vue.d.ts +2 -0
  54. package/dist/composable/defineApi.d.ts +1 -1
  55. package/dist/composable/useIframe.d.ts +2 -2
  56. package/dist/{decimal-izbvCC1j.js → decimal-AusUnA1W.js} +1 -1
  57. package/dist/{format-unit-display-4SAdfyZB.js → format-unit-display-BqkHL-ph.js} +397 -429
  58. package/dist/helper/array.d.ts +1 -0
  59. package/dist/helper/core/country/utils.d.ts +3 -4
  60. package/dist/helper/country.d.ts +6 -255
  61. package/dist/helper/number.d.ts +1 -0
  62. package/dist/import-export.helper-PIyNeHfa.js +238 -0
  63. package/dist/{index-B6GGthLw.js → index-CjxirPvn.js} +283 -268
  64. package/dist/{index-CnQloOEo.js → index-Dj9-pdT9.js} +1 -1
  65. package/dist/layout/SingleColumnLayout.vue.d.ts +6 -3
  66. package/dist/purchase-order-template-CQikvY1p.js +41 -0
  67. package/dist/router/name.d.ts +2 -0
  68. package/dist/stock-CDZ2uWSF.js +83 -0
  69. package/dist/stock-Dw908dIC.js +74 -0
  70. package/dist/stores/feature.d.ts +12 -0
  71. package/dist/stores/integration/netsuite.d.ts +42 -0
  72. package/dist/stores/inventory.d.ts +28 -199
  73. package/dist/stores/location.d.ts +331 -1
  74. package/dist/stores/supplier.d.ts +96 -0
  75. package/dist/stores/warehouse.d.ts +4 -0
  76. package/dist/style.css +1 -1
  77. package/dist/{supplier-CTVE1lHO.js → supplier-BPPBUudN.js} +1 -1
  78. package/dist/tsconfig.app.tsbuildinfo +1 -1
  79. package/dist/{use-ingredient-select-dialog-CM80TfX0.js → use-ingredient-select-dialog-C_fSKN3_.js} +5 -5
  80. package/dist/{use-inventory-binding-dialog-D_omdhgn.js → use-inventory-binding-dialog-ClAkJ864.js} +8 -8
  81. package/dist/views/adjustment-template/wastage-template/actions.d.ts +60 -0
  82. package/dist/views/adjustment-template/wastage-template/table.d.ts +60 -0
  83. package/dist/views/closing-draft/components/closing-draft-dialog/ClosingDraftDialog.vue.d.ts +56 -0
  84. package/dist/views/closing-draft/composables/use-closing-draft-actions.d.ts +3 -3
  85. package/dist/views/closing-draft/composables/use-closing-draft-table.d.ts +468 -0
  86. package/dist/views/closing-draft/helpers/export-draft.helper.d.ts +9 -2
  87. package/dist/views/closing-history/ClosingHistoryView.vue.d.ts +2 -0
  88. package/dist/views/closing-template/composables/use-closing-template-actions.d.ts +4 -1
  89. package/dist/views/closing-template/helpers/import-export.helper.d.ts +5 -0
  90. package/dist/views/import/ImportView.vue.d.ts +3 -0
  91. package/dist/views/import/components/ImportDialog.vue.d.ts +2 -0
  92. package/dist/views/import/helper/import-export.helper.d.ts +4 -0
  93. package/dist/views/ingredients/components/ingredient-dialog/IngredientDialogProps.d.ts +1 -1
  94. package/dist/views/ingredients/components/ingredient-form/IngredientForm.vue.d.ts +181 -12
  95. package/dist/views/ingredients/components/ingredient-form/IngredientFormProps.d.ts +6 -0
  96. package/dist/views/ingredients/helper/import-export.helper.d.ts +4 -1
  97. package/dist/views/integration/components/netsuite/business/BusinessNetSuiteSideSheet.vue.d.ts +2 -0
  98. package/dist/views/receive-request/components/delivery-order-form/CreateForm.vue.d.ts +16 -0
  99. package/dist/views/receive-request/components/delivery-order-form/CreateFormProps.d.ts +4 -0
  100. package/dist/views/receive-request/components/delivery-order-form/EditForm.vue.d.ts +16 -0
  101. package/dist/views/receive-request/components/delivery-order-form/EditFormProps.d.ts +4 -0
  102. package/dist/views/receive-request/components/delivery-order-form/SystemTrailDialog.vue.d.ts +21 -0
  103. package/dist/views/receive-request/components/netsuite/NetSuiteTransactionChangeLog.vue.d.ts +15 -0
  104. package/dist/views/receive-request/components/transfer-details/TransferDetailsProps.d.ts +1 -0
  105. package/dist/views/receive-request/components/transfer-form/TransferForm.vue.d.ts +420 -2
  106. package/dist/views/receive-request/composables/use-process-purchase-order.d.ts +99 -0
  107. package/dist/views/receive-request/composables/use-receive-request-form.d.ts +644 -13
  108. package/dist/views/receive-request/composables/use-receive-request-table.d.ts +711 -14
  109. package/dist/views/recipe/RecipeView.vue.d.ts +1 -0
  110. package/dist/views/recipe/components/import-recipes/ImportRecipeItem.vue.d.ts +16 -0
  111. package/dist/views/recipe/components/import-recipes/ImportRecipes.vue.d.ts +2 -0
  112. package/dist/views/recipe/helper/import-recipe.d.ts +48 -0
  113. package/dist/views/stock/components/StockRecordCard.vue.d.ts +70 -1
  114. package/dist/views/stock/components/dialog/RecalculationDialog.vue.d.ts +11 -0
  115. package/dist/views/stock/components/dialog/RecalculationDialogProps.d.ts +3 -0
  116. package/dist/views/stock/components/dialog/StockAdjustmentSideSheet.vue.d.ts +20 -0
  117. package/dist/views/supplier/components/SupplierForm.vue.d.ts +8 -0
  118. package/dist/views/supplier/components/SupplierSupplyItemField.vue.d.ts +3 -0
  119. package/dist/views/supplier/composables/use-supplier-table.d.ts +4 -0
  120. package/dist/views/transfer-template/components/transfer-template-dialog/TransferTemplateDialog.vue.d.ts +8 -0
  121. package/dist/views/transfer-template/components/transfer-template-form/components/NetSuiteCustomCodeSelection.vue.d.ts +2 -0
  122. package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-locations.d.ts +16 -0
  123. package/dist/views/transfer-template/composables/use-transfer-template-actions.d.ts +48 -0
  124. package/dist/views/transfer-template/composables/use-transfer-template-table.d.ts +48 -0
  125. package/dist/views/unit/UnitView.vue.d.ts +1 -0
  126. package/dist/views/unit/components/import-units/ImportUnitItem.vue.d.ts +12 -0
  127. package/dist/views/unit/components/import-units/ImportUnitItemProps.d.ts +6 -0
  128. package/dist/views/unit/components/import-units/ImportUnits.vue.d.ts +9 -0
  129. package/dist/views/unit/components/import-units/ImportUnitsProps.d.ts +5 -0
  130. package/dist/views/unit/helper/import-export.helper.d.ts +40 -0
  131. package/dist/views/warehouse/components/WarehouseForm.vue.d.ts +8 -0
  132. package/package.json +3 -3
  133. package/dist/App-BqaRC0Sb.js +0 -276
  134. package/dist/ClosingDraftView-sJ_zRPeo.js +0 -1687
  135. package/dist/ClosingTemplateView-cNgXHq1r.js +0 -1908
  136. package/dist/FmAdminBadge-oCnz8SW6.js +0 -34
  137. package/dist/FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-BKR8C4p_.js +0 -224
  138. package/dist/IngredientsView-CHHeAJH_.js +0 -1858
  139. package/dist/RecipeView-BukmKdVG.js +0 -621
  140. package/dist/StockForecast.vue_vue_type_style_index_0_lang-KLXSWvo5.js +0 -59
  141. package/dist/StockView-wxRCw_w-.js +0 -2087
  142. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-eqUOnJoM.js +0 -2336
  143. package/dist/UnitView-BgwDmGZo.js +0 -667
  144. package/dist/WarehouseView-BdccenhO.js +0 -1034
  145. package/dist/array-Ca8T3f_G.js +0 -44
  146. package/dist/helper/core/country/codes.d.ts +0 -255
  147. package/dist/stock-BJP5BB5b.js +0 -146
@@ -0,0 +1,355 @@
1
+ import { defineComponent as H, ref as v, computed as h, resolveComponent as k, openBlock as d, createElementBlock as g, createVNode as f, withModifiers as te, withCtx as A, createElementVNode as s, toDisplayString as u, unref as n, Fragment as K, createTextVNode as M, createBlock as L, createCommentVNode as F, renderList as oe, normalizeClass as le, h as ae, onMounted as ne, Teleport as se } from "vue";
2
+ import { aD as j, ac as x, u as ie, h as ce, I as re, J as ue } from "./app-a9r50k3U.js";
3
+ import { useI18n as z, useCoreStore as de } from "@feedmepos/mf-common";
4
+ import { useSnackbar as me } from "@feedmepos/ui-library";
5
+ import { u as ve } from "./stock-CDZ2uWSF.js";
6
+ const fe = { class: "fm-typo-en-heading-lg-600" }, ye = { class: "flex flex-col gap-16" }, pe = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ge = { class: "flex flex-col gap-8" }, _e = { class: "fm-typo-en-body-md-600" }, be = { class: "flex flex-col gap-8" }, he = { class: "fm-typo-en-body-md-600" }, ke = { class: "flex items-center gap-8 mb-8" }, xe = {
7
+ key: 2,
8
+ class: "text-red-500 text-sm mt-2"
9
+ }, De = { class: "fm-typo-en-body-sm-400" }, Ve = {
10
+ key: 1,
11
+ class: "flex flex-col gap-8"
12
+ }, Se = { class: "fm-typo-en-body-md-600" }, we = { class: "flex flex-col gap-8 max-h-[300px] overflow-y-auto" }, Ce = { class: "flex items-center justify-between" }, Re = { class: "fm-typo-en-body-sm-600" }, Fe = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Ae = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Le = {
13
+ key: 0,
14
+ class: "fm-typo-en-body-xs-400 text-fm-color-system-error-500"
15
+ }, Te = {
16
+ key: 0,
17
+ class: "flex gap-8 ml-auto"
18
+ }, Be = {
19
+ key: 1,
20
+ class: "flex gap-8 ml-auto"
21
+ }, $e = /* @__PURE__ */ H({
22
+ __name: "RecalculationDialog",
23
+ emits: ["submitted"],
24
+ setup(J, { expose: _, emit: B }) {
25
+ const S = B, { t: a } = z(), D = ve(), w = j(), C = me(), y = v(!1), i = v(""), c = v(""), m = v(!1), V = v([]), t = v(!1), r = v([]), b = v(!1), R = h(() => V.value.map((e) => {
26
+ const o = x(e._id), p = new Date(o);
27
+ return {
28
+ label: `${p.toLocaleDateString()} ${p.toLocaleTimeString()}`,
29
+ value: e._id
30
+ };
31
+ })), G = h(() => i.value ? R.value.filter((e) => e.value > i.value) : []), E = h({
32
+ get: () => {
33
+ if (m.value && c.value) {
34
+ const e = V.value.find((o) => x(o._id) === c.value);
35
+ return (e == null ? void 0 : e._id) || c.value;
36
+ }
37
+ return c.value;
38
+ },
39
+ set: (e) => {
40
+ m.value && e ? c.value = x(e) : c.value = e;
41
+ }
42
+ }), Q = h(() => {
43
+ if (i.value)
44
+ try {
45
+ const e = x(i.value);
46
+ if (e)
47
+ return e;
48
+ } catch (e) {
49
+ console.error("Error parsing date from closing ID:", e);
50
+ }
51
+ }), T = h(() => {
52
+ if (!i.value || !c.value) return "";
53
+ const e = x(i.value), o = c.value;
54
+ if (e && o) {
55
+ const p = new Date(e).getTime();
56
+ if (new Date(o).getTime() <= p)
57
+ return a("inventory.stock.recalculation.error.endDateBeforeOpening");
58
+ }
59
+ return "";
60
+ }), N = h(() => !!i.value && !!c.value && !T.value), U = h(() => r.value.some(
61
+ (e) => !e.completedAt && !e.failedReason
62
+ ));
63
+ async function I() {
64
+ y.value = !0, await Promise.all([X(), P()]), i.value = "", c.value = "", m.value = !1;
65
+ }
66
+ function W() {
67
+ y.value = !1;
68
+ }
69
+ _({
70
+ open: I,
71
+ close: W
72
+ });
73
+ async function X() {
74
+ t.value = !0;
75
+ try {
76
+ const e = await w.getLastNClosings(10);
77
+ V.value = e;
78
+ } catch (e) {
79
+ console.error("Error fetching recent closings:", e), C.open({
80
+ title: a("common.error"),
81
+ message: "Failed to fetch recent closings",
82
+ type: "error"
83
+ });
84
+ } finally {
85
+ t.value = !1;
86
+ }
87
+ }
88
+ async function P() {
89
+ b.value = !0;
90
+ try {
91
+ const e = await D.recalculation.recalculationRequests();
92
+ r.value = e;
93
+ } catch (e) {
94
+ console.error("Error fetching recalculation requests:", e);
95
+ } finally {
96
+ b.value = !1;
97
+ }
98
+ }
99
+ async function Y() {
100
+ if (N.value) {
101
+ t.value = !0;
102
+ try {
103
+ await D.recalculation.scheduleRecalculation(i.value, c.value), C.open({
104
+ title: a("common.success"),
105
+ message: "Stock recalculation has been scheduled successfully",
106
+ type: "success"
107
+ }), await P(), y.value = !1, S("submitted");
108
+ } catch (e) {
109
+ console.error("Error scheduling recalculation:", e), C.open({
110
+ title: a("common.error"),
111
+ message: "Failed to schedule stock recalculation",
112
+ type: "error"
113
+ });
114
+ } finally {
115
+ t.value = !1;
116
+ }
117
+ }
118
+ }
119
+ return (e, o) => {
120
+ const p = k("FmButton"), $ = k("FmSelect"), O = k("FmRadio"), Z = k("FmDatePicker"), q = k("FmAlert"), ee = k("FmDialog");
121
+ return d(), g("div", null, [
122
+ f(p, {
123
+ "prepend-icon": "info",
124
+ variant: "tertiary",
125
+ onClick: te(I, ["stop"])
126
+ }),
127
+ f(ee, {
128
+ modelValue: y.value,
129
+ "onUpdate:modelValue": o[7] || (o[7] = (l) => y.value = l),
130
+ "close-button": "",
131
+ dismissAway: "",
132
+ "max-width": "600px"
133
+ }, {
134
+ "dialog-header": A(() => [
135
+ s("div", fe, u(n(a)("inventory.stock.recalculation.title")), 1)
136
+ ]),
137
+ "dialog-footer": A(() => [
138
+ U.value ? (d(), g("div", Be, [
139
+ f(p, {
140
+ variant: "tertiary",
141
+ onClick: o[6] || (o[6] = (l) => y.value = !1),
142
+ label: n(a)("common.close")
143
+ }, null, 8, ["label"])
144
+ ])) : (d(), g("div", Te, [
145
+ f(p, {
146
+ variant: "tertiary",
147
+ onClick: o[5] || (o[5] = (l) => y.value = !1),
148
+ disabled: t.value,
149
+ label: n(a)("common.cancel")
150
+ }, null, 8, ["disabled", "label"]),
151
+ f(p, {
152
+ variant: "primary",
153
+ onClick: Y,
154
+ disabled: !N.value || t.value,
155
+ loading: t.value,
156
+ label: n(a)("inventory.stock.recalculation.schedule")
157
+ }, null, 8, ["disabled", "loading", "label"])
158
+ ]))
159
+ ]),
160
+ default: A(() => [
161
+ s("div", ye, [
162
+ s("div", pe, u(n(a)("inventory.stock.recalculation.description")), 1),
163
+ U.value ? F("", !0) : (d(), g(K, { key: 0 }, [
164
+ s("div", ge, [
165
+ s("p", _e, [
166
+ M(u(n(a)("inventory.stock.recalculation.openingDate")) + " ", 1),
167
+ o[8] || (o[8] = s("span", { class: "text-fm-color-system-error-300" }, "*", -1))
168
+ ]),
169
+ f($, {
170
+ modelValue: i.value,
171
+ "onUpdate:modelValue": o[0] || (o[0] = (l) => i.value = l),
172
+ items: R.value,
173
+ placeholder: n(a)("inventory.stock.recalculation.selectOpening"),
174
+ loading: t.value,
175
+ disabled: t.value
176
+ }, null, 8, ["modelValue", "items", "placeholder", "loading", "disabled"])
177
+ ]),
178
+ s("div", be, [
179
+ s("p", he, [
180
+ M(u(n(a)("inventory.stock.recalculation.untilDate")) + " ", 1),
181
+ o[9] || (o[9] = s("span", { class: "text-fm-color-system-error-300" }, "*", -1))
182
+ ]),
183
+ s("div", ke, [
184
+ f(O, {
185
+ modelValue: m.value,
186
+ "onUpdate:modelValue": o[1] || (o[1] = (l) => m.value = l),
187
+ value: !1,
188
+ label: n(a)("inventory.stock.recalculation.selectByDate")
189
+ }, null, 8, ["modelValue", "label"]),
190
+ f(O, {
191
+ modelValue: m.value,
192
+ "onUpdate:modelValue": o[2] || (o[2] = (l) => m.value = l),
193
+ value: !0,
194
+ label: n(a)("inventory.stock.recalculation.selectByClosing")
195
+ }, null, 8, ["modelValue", "label"])
196
+ ]),
197
+ m.value ? (d(), L($, {
198
+ key: 1,
199
+ modelValue: E.value,
200
+ "onUpdate:modelValue": o[4] || (o[4] = (l) => E.value = l),
201
+ items: G.value,
202
+ placeholder: n(a)("inventory.stock.recalculation.selectClosing"),
203
+ loading: t.value,
204
+ disabled: !i.value || t.value
205
+ }, null, 8, ["modelValue", "items", "placeholder", "loading", "disabled"])) : (d(), L(Z, {
206
+ key: 0,
207
+ modelValue: c.value,
208
+ "onUpdate:modelValue": o[3] || (o[3] = (l) => c.value = l),
209
+ placeholder: n(a)("inventory.stock.recalculation.selectDate"),
210
+ min: Q.value,
211
+ disabled: !i.value || t.value
212
+ }, null, 8, ["modelValue", "placeholder", "min", "disabled"])),
213
+ T.value ? (d(), g("div", xe, u(T.value), 1)) : F("", !0)
214
+ ]),
215
+ i.value && c.value && !T.value ? (d(), L(q, {
216
+ key: 0,
217
+ type: "info"
218
+ }, {
219
+ default: A(() => [
220
+ s("div", De, u(n(a)("inventory.stock.recalculation.info")), 1)
221
+ ]),
222
+ _: 1
223
+ })) : F("", !0)
224
+ ], 64)),
225
+ r.value.length > 0 ? (d(), g("div", Ve, [
226
+ s("p", Se, u(n(a)("inventory.stock.recalculation.recentRequests")), 1),
227
+ s("div", we, [
228
+ (d(!0), g(K, null, oe(r.value, (l) => (d(), g("div", {
229
+ key: l._id,
230
+ class: "p-12 border border-fm-color-border-primary rounded-8 flex flex-col gap-4"
231
+ }, [
232
+ s("div", Ce, [
233
+ s("div", Re, u(new Date(l.createdAt).toLocaleString()), 1),
234
+ s("div", {
235
+ class: le(["fm-typo-en-body-xs-600 px-8 py-4 rounded-4", {
236
+ "bg-fm-color-system-error-100 text-fm-color-system-error-500": l.failedReason,
237
+ "bg-fm-color-system-success-100 text-fm-color-system-success-500": l.completedAt,
238
+ "bg-fm-color-system-info-100 text-fm-color-system-info-500": !l.failedReason && !l.completedAt
239
+ }])
240
+ }, u(l.failedReason ? n(a)("inventory.stock.recalculation.status.failed") : l.completedAt ? n(a)("inventory.stock.recalculation.status.completed") : n(a)("inventory.stock.recalculation.status.inProgress")), 3)
241
+ ]),
242
+ s("div", Fe, u(n(a)("inventory.stock.recalculation.from")) + ": " + u(new Date(l.recalculateStartDate).toLocaleDateString()), 1),
243
+ s("div", Ae, u(n(a)("inventory.stock.recalculation.to")) + ": " + u(new Date(l.recalculateEndDate).toLocaleDateString()), 1),
244
+ l.failedReason ? (d(), g("div", Le, u(l.failedReason), 1)) : F("", !0)
245
+ ]))), 128))
246
+ ])
247
+ ])) : F("", !0)
248
+ ])
249
+ ]),
250
+ _: 1
251
+ }, 8, ["modelValue"])
252
+ ]);
253
+ };
254
+ }
255
+ }), Ee = { class: "flex flex-col gap-16 p-16" }, Ke = /* @__PURE__ */ H({
256
+ __name: "ClosingHistoryView",
257
+ setup(J) {
258
+ var V;
259
+ const { t: _ } = z(), B = j(), S = ie(), a = de(), D = v([]), w = v(!1), C = h(() => [
260
+ {
261
+ label: _("inventory.stock.recalculation.title", "Stock Recalculation"),
262
+ value: "recalculation",
263
+ prependIcon: "history",
264
+ isAdminOnly: !0
265
+ }
266
+ ]), y = v();
267
+ function i(t) {
268
+ var r;
269
+ switch (t) {
270
+ case "recalculation":
271
+ return (r = y.value) == null ? void 0 : r.open();
272
+ }
273
+ }
274
+ const c = [
275
+ ...(V = a.sessionUser.value) != null && V.role.isAdmin ? [
276
+ {
277
+ accessorKey: "_id",
278
+ header: () => ae(ce, {}, () => `${_("inventory.closing.history.closingId")}`),
279
+ cell: (t) => t.getValue()
280
+ }
281
+ ] : [],
282
+ {
283
+ accessorKey: "_id",
284
+ id: "date",
285
+ header: () => _("inventory.closing.history.date"),
286
+ cell: (t) => {
287
+ const r = t.getValue(), b = x(r);
288
+ return new Date(b).toLocaleDateString();
289
+ }
290
+ },
291
+ {
292
+ accessorKey: "_id",
293
+ id: "time",
294
+ header: () => _("inventory.closing.history.time"),
295
+ cell: (t) => {
296
+ const r = t.getValue(), b = x(r);
297
+ return new Date(b).toLocaleTimeString();
298
+ }
299
+ },
300
+ {
301
+ accessorKey: "ref",
302
+ header: () => _("inventory.closing.history.createdFrom"),
303
+ cell: (t) => t.getValue() || "-"
304
+ }
305
+ ];
306
+ async function m() {
307
+ if (S.currentLocationDBName) {
308
+ w.value = !0;
309
+ try {
310
+ const t = await B.getLastNClosings(10);
311
+ D.value = t;
312
+ } catch (t) {
313
+ console.error("Error fetching closings:", t), D.value = [];
314
+ } finally {
315
+ w.value = !1;
316
+ }
317
+ }
318
+ }
319
+ return ne(async () => {
320
+ S.currentLocationDBName && await m();
321
+ }), S.watchLocation(m), (t, r) => {
322
+ const b = k("FmTable");
323
+ return d(), L(re, {
324
+ actions: C.value,
325
+ title: n(_)("inventory.closing.history.title"),
326
+ "onClick:action": i
327
+ }, {
328
+ default: A(() => [
329
+ s("div", Ee, [
330
+ f(ue, {
331
+ "change-location": "",
332
+ "hide-filter-options": !0
333
+ }),
334
+ f(b, {
335
+ loading: w.value,
336
+ "row-data": D.value,
337
+ "column-defs": c
338
+ }, null, 8, ["loading", "row-data"])
339
+ ]),
340
+ (d(), L(se, { to: "body" }, [
341
+ f($e, {
342
+ ref_key: "recalculationDialogRef",
343
+ ref: y,
344
+ onSubmitted: r[0] || (r[0] = (R) => m())
345
+ }, null, 512)
346
+ ]))
347
+ ]),
348
+ _: 1
349
+ }, 8, ["actions", "title"]);
350
+ };
351
+ }
352
+ });
353
+ export {
354
+ Ke as default
355
+ };