@feedmepos/mf-inventory-portal 1.2.61-dev.1 → 1.2.61

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 (126) hide show
  1. package/dist/{App-Dj4TFhg1.js → App-BqScGtJx.js} +78 -82
  2. package/dist/{ApprovalView-Cpbfph-H.js → ApprovalView-BFdlYIot.js} +5 -5
  3. package/dist/{BindingsDialog-CUbU9tih.js → BindingsDialog-Dvmrms77.js} +5 -5
  4. package/dist/{BindingsPicker-CMlAGOJT.js → BindingsPicker-fPVSXv-h.js} +3 -3
  5. package/dist/{BindingsTable-DvOE5QM2.js → BindingsTable-CnUa8VOi.js} +5 -5
  6. package/dist/{ClosingDraftView-DKv-ehO_.js → ClosingDraftView-10BcpWkm.js} +216 -217
  7. package/dist/{ClosingHistoryView-DIl78iH9.js → ClosingHistoryView-zLh0HCIb.js} +36 -36
  8. package/dist/{ClosingTemplateView-DPDh_geQ.js → ClosingTemplateView-BFupX87V.js} +14 -14
  9. package/dist/{DeliveryOrderPrintPreview-Bi3xgagw.js → DeliveryOrderPrintPreview-BLBqmOjw.js} +7 -7
  10. package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-B_5_SxUn.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-DN8ziFA_.js} +20 -20
  11. package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-B3Kl8YBw.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DJT_7Uus.js} +2 -2
  12. package/dist/{FmMultiselectDialog-1IUxEPwt.js → FmMultiselectDialog-B5paZk6T.js} +16 -16
  13. package/dist/{FmMultiselectDialog-BSOTemHV.js → FmMultiselectDialog-DmnYEmN1.js} +1 -1
  14. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-BMK8Az4J.js → FmUnitInput.vue_vue_type_script_setup_true_lang-MW749j29.js} +22 -23
  15. package/dist/{ImportView-CkitDDEU.js → ImportView-BsI1_unJ.js} +6 -6
  16. package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-DZUQavPo.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-D8hvH-4n.js} +1 -1
  17. package/dist/{IngredientGroupView-ogDZwQFL.js → IngredientGroupView-BALVTSwF.js} +5 -5
  18. package/dist/{IngredientsView-B5AWPQhS.js → IngredientsView-C-sauieO.js} +24 -25
  19. package/dist/{IntegrationView-DIx6B_wR.js → IntegrationView-GG2E4Yrl.js} +17 -18
  20. package/dist/{InventoryBindingForm-CAs2PaKF.js → InventoryBindingForm-DCSBFj6b.js} +1 -1
  21. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-D62U_Ewm.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-4_i25unG.js} +16 -17
  22. package/dist/{InventoryBindingSummary-DNWMJUDR.js → InventoryBindingSummary-6dFJPewB.js} +1 -1
  23. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-flGJ-4xe.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-CU9mgYbv.js} +5 -5
  24. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-CwcKHn69.js → PremiumBadge.vue_vue_type_script_setup_true_lang-DC1HpuMm.js} +2 -2
  25. package/dist/{PublishView-IYCGQZF7.js → PublishView-DO7k1AeP.js} +8 -8
  26. package/dist/{PurchaseOrderPrintPreview-CQ-J1uJn.js → PurchaseOrderPrintPreview-C3VqOLCi.js} +11 -11
  27. package/dist/ReceiveRequestView-CpgLQtbw.js +2806 -0
  28. package/dist/RecipeView-C2D7FdzN.js +646 -0
  29. package/dist/{StockView-F7oGArF7.js → StockView-CtC3ldc6.js} +105 -106
  30. package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-j6pS_g4o.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-Cj6cVmd0.js} +1 -1
  31. package/dist/{SupplierView-DaDXVRF6.js → SupplierView-DKFtc22j.js} +19 -20
  32. package/dist/{SurchargeView-CBkF-szL.js → SurchargeView-B-EYMp6w.js} +6 -6
  33. package/dist/{SystemTrailDialog.vue_vue_type_script_setup_true_lang-BDxbVt07.js → SystemTrailDialog.vue_vue_type_script_setup_true_lang-CDeeFvnm.js} +2 -2
  34. package/dist/{TemplatePublishDialog.vue_vue_type_script_setup_true_lang-DnoutmMc.js → TemplatePublishDialog.vue_vue_type_script_setup_true_lang-CH3hjFS8.js} +1 -1
  35. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-rAyYuhku.js +3493 -0
  36. package/dist/{TransferTemplateView-BlyMl_7M.js → TransferTemplateView-FeC34QoJ.js} +21 -22
  37. package/dist/{UnitView-JRqgYWbI.js → UnitView-BoJisnXd.js} +10 -11
  38. package/dist/{WarehouseView-Cb5Dj6f4.js → WarehouseView-s-xF6xJ0.js} +5 -5
  39. package/dist/{WastageTemplateView-DoyXkHM6.js → WastageTemplateView-BQBlHZLh.js} +14 -14
  40. package/dist/api/inventory.d.ts +36 -126
  41. package/dist/api/netsuite.d.ts +1 -8
  42. package/dist/{app-DMbbrEyL.js → app-_4kRbuQl.js} +7147 -8148
  43. package/dist/app.d.ts +0 -228
  44. package/dist/app.js +1 -1
  45. package/dist/{closing-template-B68c4BCg.js → closing-template-BBWYKm_X.js} +1 -1
  46. package/dist/components/inventory-binding/InventoryBinding.vue.d.ts +1 -37
  47. package/dist/components/shell/inventory/binding-dialog.vue.d.ts +0 -14
  48. package/dist/components/shell/inventory/binding-ui.vue.d.ts +1 -16
  49. package/dist/{date2-WSrIZrGN.js → date2-Cd93SZu4.js} +1 -1
  50. package/dist/{dayjs.min-BEzS3oNC.js → dayjs.min-DeHn_Fz-.js} +16 -16
  51. package/dist/{defineDeepModel-B7GuNHyt.js → defineDeepModel-DUOLQh1E.js} +1 -1
  52. package/dist/{duplicate-template-BTdZ25aR.js → duplicate-template-BgpMF-fd.js} +1 -1
  53. package/dist/{feature-DJFFmYSS.js → feature-DqGkM6Yx.js} +1439 -1334
  54. package/dist/{format-time-from-id-BEqcrmTR.js → format-time-from-id-BkH4swoc.js} +1 -1
  55. package/dist/{format-unit-display-DIqyPFuN.js → format-unit-display-rkrD3WLD.js} +15 -16
  56. package/dist/{import-export.helper-Dnvx2Wa0.js → import-export.helper-C8Q4AMQx.js} +15 -16
  57. package/dist/{index-dh2P5FKl.js → index-B0WTs-3a.js} +1412 -1471
  58. package/dist/{index-J3wFLjDN.js → index-B3m_9m2a.js} +3 -3
  59. package/dist/{index-BNBtrozQ.js → index-O5M93j6z.js} +1 -1
  60. package/dist/{lodash-DoqYeksT.js → lodash-Dj6GdEkm.js} +1 -1
  61. package/dist/{netsuite-C87QvoFY.js → netsuite-DpQxb3vH.js} +60 -60
  62. package/dist/{purchase-order-template-CbRmEHxi.js → purchase-order-template-DKuo07gT.js} +1 -1
  63. package/dist/router/name.d.ts +0 -1
  64. package/dist/rules-D6o4zK8x.js +327 -0
  65. package/dist/{stock-DrdiXQFX.js → stock-D7HQf4-H.js} +1 -1
  66. package/dist/stock-DLFjfcAv.js +75 -0
  67. package/dist/stores/feature.d.ts +0 -2
  68. package/dist/stores/integration/netsuite.d.ts +1 -8
  69. package/dist/stores/inventory.d.ts +30 -119
  70. package/dist/{supplier-DWophRmk.js → supplier-B3kE2tbF.js} +2 -2
  71. package/dist/{surcharge-Ds9TtpDs.js → surcharge-Cc9vownX.js} +1 -1
  72. package/dist/tsconfig.app.tsbuildinfo +1 -1
  73. package/dist/{use-ingredient-select-dialog-CPugamev.js → use-ingredient-select-dialog-MnUTm-3P.js} +2 -2
  74. package/dist/{use-inventory-binding-dialog-Vj7T-h-w.js → use-inventory-binding-dialog-_J9LNiGo.js} +2 -2
  75. package/dist/{use-template-enabled-locations-2-DfKY5avH.js → use-template-enabled-locations-2-B9gbuIPM.js} +2 -2
  76. package/dist/views/closing-draft/components/closing-draft-dialog/ClosingDraftDialog.vue.d.ts +8 -64
  77. package/dist/views/closing-draft/composables/use-closing-draft-table.d.ts +24 -192
  78. package/dist/views/closing-template/components/closing-template-form/composables/use-closing-template-items.d.ts +1 -8
  79. package/dist/views/closing-template/composables/use-closing-template-actions.d.ts +12 -96
  80. package/dist/views/closing-template/composables/use-closing-template-table.d.ts +12 -96
  81. package/dist/views/ingredient-group/composables/use-ingredient-group-table.d.ts +18 -18
  82. package/dist/views/ingredients/components/convert/ConvertForm.vue.d.ts +0 -14
  83. package/dist/views/ingredients/components/ingredient-form/IngredientForm.vue.d.ts +4 -32
  84. package/dist/views/ingredients/components/inventory-binding/InventoryBindingForm.vue.d.ts +0 -28
  85. package/dist/views/ingredients/composables/use-ingredient-table.d.ts +1 -8
  86. package/dist/views/integration/components/netsuite/InventoryTransferIngredientTable.vue.d.ts +2 -16
  87. package/dist/views/receive-request/components/transfer-form/TransferFormWithController.vue.d.ts +5 -33
  88. package/dist/views/receive-request/components/transfer-form/components/ForecastStock.vue.d.ts +2 -16
  89. package/dist/views/receive-request/components/transfer-form/components/TransferItemTable.vue.d.ts +4 -32
  90. package/dist/views/receive-request/components/transfer-form/composables/use-transfer-items.d.ts +1 -8
  91. package/dist/views/receive-request/composables/use-process-purchase-order.d.ts +6 -41
  92. package/dist/views/receive-request/composables/use-receive-request-form.d.ts +36 -246
  93. package/dist/views/receive-request/composables/use-receive-request-table.d.ts +42 -287
  94. package/dist/views/recipe/components/recipe-form/RecipeForm.vue.d.ts +0 -16
  95. package/dist/views/stock/components/StockRecordCard.vue.d.ts +0 -1
  96. package/dist/views/stock/components/dialog/AdjustedItemForm.vue.d.ts +2 -16
  97. package/dist/views/transfer-template/components/transfer-template-dialog/TransferTemplateDialog.vue.d.ts +2 -16
  98. package/dist/views/transfer-template/components/transfer-template-form/components/NetSuiteCustomCodeSelection.vue.d.ts +2 -16
  99. package/dist/views/transfer-template/components/transfer-template-form/components/TransferTemplateItemTable.vue.d.ts +2 -16
  100. package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-template-items.d.ts +1 -8
  101. package/dist/views/transfer-template/composables/use-netsuite-custom-field.d.ts +3 -24
  102. package/dist/views/transfer-template/composables/use-transfer-template-actions.d.ts +12 -96
  103. package/dist/views/transfer-template/composables/use-transfer-template-table.d.ts +12 -96
  104. package/dist/{vue-i18n-Td4-wYd2.js → vue-i18n-BvsTy4Fg.js} +535 -535
  105. package/dist/{xlsx-DFL__z5b.js → xlsx-BvjocXXw.js} +398 -398
  106. package/dist/{xlsx.util-Bi7Vb-wa.js → xlsx.util-D65Nsat4.js} +1 -1
  107. package/package.json +3 -3
  108. package/dist/ReceiveRequestView-NOIHVxoI.js +0 -2916
  109. package/dist/RecipeView-KZV269Yw.js +0 -1558
  110. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-B_u8kuNh.js +0 -3354
  111. package/dist/UnitCostHistoryView-B6mco57v.js +0 -651
  112. package/dist/api/unit-cost-history.d.ts +0 -28
  113. package/dist/number-nN9jCKom.js +0 -232
  114. package/dist/rules-Dbz4JyZU.js +0 -98
  115. package/dist/stock-ChSl_QOD.js +0 -75
  116. package/dist/views/ingredients/components/inventory-binding/v2/InventoryBindingFormV2.vue.d.ts +0 -169
  117. package/dist/views/ingredients/components/inventory-binding/v2/components/InventoryBindingAlternative.vue.d.ts +0 -43
  118. package/dist/views/ingredients/components/inventory-binding/v2/components/InventoryBindingRule.vue.d.ts +0 -25
  119. package/dist/views/ingredients/components/inventory-binding/v2/components/InventoryRecipeBindingV2Field.vue.d.ts +0 -125
  120. package/dist/views/ingredients/components/inventory-binding/v2/components/InventorySkuBindingV2Field.vue.d.ts +0 -129
  121. package/dist/views/ingredients/components/inventory-binding/v2/composables/use-inventory-binding-alternative-table.d.ts +0 -30
  122. package/dist/views/ingredients/components/inventory-binding/v2/composables/use-inventory-binding-dialog.d.ts +0 -4
  123. package/dist/views/unit-cost-history/UnitCostHistoryView.vue.d.ts +0 -2
  124. package/dist/views/unit-cost-history/components/UnitCostDetailsSideSheet.vue.d.ts +0 -19
  125. package/dist/views/unit-cost-history/components/UnitCostRecalculationDialog.vue.d.ts +0 -11
  126. package/dist/views/unit-cost-history/composables/use-unit-cost-history.d.ts +0 -65
@@ -1,651 +0,0 @@
1
- import { ref as h, defineComponent as Q, computed as b, resolveComponent as L, openBlock as u, createElementBlock as g, createVNode as p, withModifiers as oe, withCtx as A, createElementVNode as t, toDisplayString as n, unref as r, Fragment as O, createTextVNode as H, createCommentVNode as F, createBlock as T, renderList as se, normalizeClass as E, normalizeStyle as ae, Teleport as X } from "vue";
2
- import { F as ne, u as le, _ as re } from "./SingleColumnLayout.vue_vue_type_script_setup_true_lang-CWZkVCAj.js";
3
- import { o as ie, u as J, a as Z } from "./app-DMbbrEyL.js";
4
- import { useSnackbar as q, useBreakpoints as ce } from "@feedmepos/ui-library";
5
- import { _ as ue } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-B3Kl8YBw.js";
6
- import { useI18n as ee, useCoreStore as de } from "@feedmepos/mf-common";
7
- import { d as Y } from "./date2-WSrIZrGN.js";
8
- import { d as j } from "./number-nN9jCKom.js";
9
- import { P as me, J as fe } from "./app-DiX-EfV6.js";
10
- const te = ie((w, _) => {
11
- const i = J();
12
- return {
13
- async getLatestCostForAllSkus(d) {
14
- const o = `${w.inventoryBackendUrl}/api/unit-cost-history?locationId=${encodeURIComponent(d)}`;
15
- return await _.get(o);
16
- },
17
- async recalculate(d) {
18
- const o = `${w.inventoryBackendUrl}/api/unit-cost-history/recalculate`;
19
- return await _.post(o, d);
20
- },
21
- async getJobStatus(d) {
22
- const o = `${w.inventoryBackendUrl}/api/unit-cost-history/jobs/${d}`;
23
- return await _.get(o);
24
- },
25
- async listRecentRecalculationRequests() {
26
- var C;
27
- const d = (C = i._currentLocation) == null ? void 0 : C.dbName;
28
- if (!d) return [];
29
- const o = `${w.inventoryBackendUrl}/api/unit-cost-history/recalculation-requests?location=${encodeURIComponent(d)}`;
30
- return await _.get(o);
31
- }
32
- };
33
- });
34
- function ye() {
35
- const w = te(), _ = J(), i = h([]), d = h(!1);
36
- async function o() {
37
- if (!_._currentLocation)
38
- return [];
39
- d.value = !0;
40
- try {
41
- const C = _.currentLocation.doc._id, m = await w.getLatestCostForAllSkus(C);
42
- return i.value = m, m;
43
- } finally {
44
- d.value = !1;
45
- }
46
- }
47
- return {
48
- historyData: i,
49
- isLoading: d,
50
- fetchHistory: o
51
- };
52
- }
53
- const pe = { class: "fm-typo-en-heading-lg-600" }, ve = { class: "flex flex-col gap-16" }, ge = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, be = { class: "flex flex-col gap-8" }, he = { class: "fm-typo-en-body-md-600" }, _e = { class: "flex flex-col gap-8" }, xe = { class: "fm-typo-en-body-md-600" }, Ce = {
54
- key: 0,
55
- class: "text-red-500 text-sm mt-2"
56
- }, ke = { class: "fm-typo-en-body-sm-400" }, Se = {
57
- key: 1,
58
- class: "flex flex-col gap-8"
59
- }, we = { class: "fm-typo-en-body-md-600" }, De = { class: "flex flex-col gap-8 max-h-[300px] overflow-y-auto" }, Ae = { class: "flex items-center justify-between" }, $e = { class: "fm-typo-en-body-sm-600" }, Re = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Ie = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Fe = {
60
- key: 0,
61
- class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
62
- }, Le = {
63
- key: 1,
64
- class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
65
- }, Ue = {
66
- key: 2,
67
- class: "fm-typo-en-body-xs-400 text-fm-color-system-error-500"
68
- }, Ne = {
69
- key: 0,
70
- class: "flex gap-8 ml-auto"
71
- }, Be = {
72
- key: 1,
73
- class: "flex gap-8 ml-auto"
74
- }, Ve = /* @__PURE__ */ Q({
75
- __name: "UnitCostRecalculationDialog",
76
- emits: ["submitted"],
77
- setup(w, { expose: _, emit: i }) {
78
- const d = i, { t: o } = ee(), C = te(), m = q(), U = de(), M = J(), x = h(!1), s = h(""), a = h(""), v = h(!1), $ = h([]), B = h(!1), D = b(() => {
79
- if (!s.value || !a.value) return "";
80
- const f = new Date(s.value).getTime();
81
- return new Date(a.value).getTime() <= f ? o("inventory.unitCost.recalculation.error.endDateBeforeStart") : "";
82
- }), R = b(() => !!s.value && !!a.value && !D.value), k = b(() => $.value.some(
83
- (f) => !f.completedAt && !f.failedReason
84
- ));
85
- async function V() {
86
- x.value = !0, await K();
87
- const f = /* @__PURE__ */ new Date();
88
- a.value = f.toISOString().split("T")[0];
89
- const c = new Date(f.getFullYear(), 0, 1);
90
- s.value = c.toISOString().split("T")[0];
91
- }
92
- function P() {
93
- x.value = !1;
94
- }
95
- _({
96
- open: V,
97
- close: P
98
- });
99
- async function K() {
100
- B.value = !0;
101
- try {
102
- const f = await C.listRecentRecalculationRequests();
103
- $.value = f;
104
- } catch (f) {
105
- console.error("Error fetching recalculation requests:", f);
106
- } finally {
107
- B.value = !1;
108
- }
109
- }
110
- async function W() {
111
- var f, c;
112
- if (R.value) {
113
- v.value = !0;
114
- try {
115
- const S = ((f = U.currentBusiness.value) == null ? void 0 : f._id) ?? "", N = ((c = M._currentLocation) == null ? void 0 : c.dbName) ?? "";
116
- if (!S)
117
- throw new Error("No active business selected");
118
- if (!N)
119
- throw new Error("No active location selected");
120
- await C.recalculate({
121
- businessId: S,
122
- locationId: N,
123
- startDate: s.value,
124
- endDate: a.value
125
- }), m.open({
126
- title: o("common.success"),
127
- message: o("inventory.unitCost.recalculation.successMessage"),
128
- type: "success"
129
- }), await K(), x.value = !1, d("submitted");
130
- } catch (S) {
131
- console.error("Error scheduling recalculation:", S), m.open({
132
- title: o("common.error"),
133
- message: o("inventory.unitCost.recalculation.errorMessage"),
134
- type: "error"
135
- });
136
- } finally {
137
- v.value = !1;
138
- }
139
- }
140
- }
141
- return (f, c) => {
142
- const S = L("FmButton"), N = L("FmDatePicker"), G = L("FmAlert"), l = L("FmDialog");
143
- return u(), g("div", null, [
144
- p(S, {
145
- "prepend-icon": "info",
146
- variant: "tertiary",
147
- onClick: oe(V, ["stop"])
148
- }),
149
- p(l, {
150
- modelValue: x.value,
151
- "onUpdate:modelValue": c[4] || (c[4] = (e) => x.value = e),
152
- "close-button": "",
153
- dismissAway: "",
154
- "max-width": "600px"
155
- }, {
156
- "dialog-header": A(() => [
157
- t("div", pe, n(r(o)("inventory.unitCost.recalculation.title")), 1)
158
- ]),
159
- "dialog-footer": A(() => [
160
- k.value ? (u(), g("div", Be, [
161
- p(S, {
162
- variant: "tertiary",
163
- onClick: c[3] || (c[3] = (e) => x.value = !1),
164
- label: r(o)("common.close")
165
- }, null, 8, ["label"])
166
- ])) : (u(), g("div", Ne, [
167
- p(S, {
168
- variant: "tertiary",
169
- onClick: c[2] || (c[2] = (e) => x.value = !1),
170
- disabled: v.value,
171
- label: r(o)("common.cancel")
172
- }, null, 8, ["disabled", "label"]),
173
- p(S, {
174
- variant: "primary",
175
- onClick: W,
176
- disabled: !R.value || v.value,
177
- loading: v.value,
178
- label: r(o)("inventory.unitCost.recalculation.schedule")
179
- }, null, 8, ["disabled", "loading", "label"])
180
- ]))
181
- ]),
182
- default: A(() => [
183
- t("div", ve, [
184
- t("div", ge, n(r(o)("inventory.unitCost.recalculation.description")), 1),
185
- k.value ? F("", !0) : (u(), g(O, { key: 0 }, [
186
- t("div", be, [
187
- t("p", he, [
188
- H(n(r(o)("inventory.unitCost.recalculation.startDate")) + " ", 1),
189
- c[5] || (c[5] = t("span", { class: "text-fm-color-system-error-300" }, "*", -1))
190
- ]),
191
- p(N, {
192
- modelValue: s.value,
193
- "onUpdate:modelValue": c[0] || (c[0] = (e) => s.value = e),
194
- placeholder: r(o)("inventory.unitCost.recalculation.selectStartDate"),
195
- disabled: v.value
196
- }, null, 8, ["modelValue", "placeholder", "disabled"])
197
- ]),
198
- t("div", _e, [
199
- t("p", xe, [
200
- H(n(r(o)("inventory.unitCost.recalculation.endDate")) + " ", 1),
201
- c[6] || (c[6] = t("span", { class: "text-fm-color-system-error-300" }, "*", -1))
202
- ]),
203
- p(N, {
204
- modelValue: a.value,
205
- "onUpdate:modelValue": c[1] || (c[1] = (e) => a.value = e),
206
- placeholder: r(o)("inventory.unitCost.recalculation.selectEndDate"),
207
- disabled: !s.value || v.value,
208
- min: s.value
209
- }, null, 8, ["modelValue", "placeholder", "disabled", "min"]),
210
- D.value ? (u(), g("div", Ce, n(D.value), 1)) : F("", !0)
211
- ]),
212
- s.value && a.value && !D.value ? (u(), T(G, {
213
- key: 0,
214
- type: "info"
215
- }, {
216
- default: A(() => [
217
- t("div", ke, n(r(o)("inventory.unitCost.recalculation.info")), 1)
218
- ]),
219
- _: 1
220
- })) : F("", !0)
221
- ], 64)),
222
- $.value.length > 0 ? (u(), g("div", Se, [
223
- t("p", we, n(r(o)("inventory.unitCost.recalculation.recentRequests")), 1),
224
- t("div", De, [
225
- (u(!0), g(O, null, se($.value, (e) => (u(), g("div", {
226
- key: e._id,
227
- class: "p-12 border border-fm-color-border-primary rounded-8 flex flex-col gap-4"
228
- }, [
229
- t("div", Ae, [
230
- t("div", $e, n(r(o)("inventory.unitCost.recalculation.requestedAt")) + ": " + n(new Date(e.createdAt).toLocaleString()), 1),
231
- t("div", {
232
- class: E(["fm-typo-en-body-xs-600 px-8 py-4 rounded-4", {
233
- "bg-fm-color-system-error-100 text-fm-color-system-error-500": e.failedReason,
234
- "bg-fm-color-system-success-100 text-fm-color-system-success-500": e.completedAt,
235
- "bg-fm-color-system-info-100 text-fm-color-system-info-500": !e.failedReason && !e.completedAt
236
- }])
237
- }, n(e.failedReason ? r(o)("inventory.unitCost.recalculation.status.failed") : e.completedAt ? r(o)("inventory.unitCost.recalculation.status.completed") : r(o)("inventory.unitCost.recalculation.status.inProgress")), 3)
238
- ]),
239
- t("div", Re, n(r(o)("inventory.unitCost.recalculation.from")) + ": " + n(new Date(e.recalculateStartDate).toLocaleDateString()), 1),
240
- t("div", Ie, n(r(o)("inventory.unitCost.recalculation.to")) + ": " + n(new Date(e.recalculateEndDate).toLocaleDateString()), 1),
241
- e.createdBy ? (u(), g("div", Fe, n(r(o)("inventory.unitCost.recalculation.requestedBy")) + ": " + n(e.createdBy.name || e.createdBy._id), 1)) : F("", !0),
242
- e.completedAt ? (u(), g("div", Le, n(r(o)("inventory.unitCost.recalculation.completedAt")) + ": " + n(new Date(e.completedAt).toLocaleString()), 1)) : F("", !0),
243
- e.failedReason ? (u(), g("div", Ue, n(e.failedReason), 1)) : F("", !0)
244
- ]))), 128))
245
- ])
246
- ])) : F("", !0)
247
- ])
248
- ]),
249
- _: 1
250
- }, 8, ["modelValue"])
251
- ]);
252
- };
253
- }
254
- }), Te = {
255
- key: 0,
256
- class: "flex flex-col gap-24"
257
- }, Me = { class: "flex flex-col gap-8" }, ze = { class: "flex flex-col gap-5" }, He = { class: "flex flex-col gap-4" }, Ee = { class: "fm-typo-en-body-lg-600 flex gap-2" }, Pe = { class: "flex flex-col gap-4" }, Ke = { class: "fm-typo-en-body-lg-600 flex gap-2" }, Oe = { class: "flex flex-col gap-4" }, Ye = { class: "fm-typo-en-body-lg-600 flex gap-2" }, je = { class: "flex flex-col gap-4" }, Je = { class: "fm-typo-en-body-lg-600" }, We = { class: "flex flex-col gap-4" }, Ge = { class: "fm-typo-en-body-lg-600" }, Qe = { class: "flex flex-col gap-4" }, Xe = { class: "fm-typo-en-body-lg-600" }, Ze = { class: "flex flex-col gap-4" }, qe = { class: "fm-typo-en-body-lg-600" }, et = { class: "flex flex-col gap-8" }, tt = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary whitespace-pre-wrap" }, ot = { class: "flex gap-4" }, st = /* @__PURE__ */ Q({
258
- __name: "UnitCostDetailsSideSheet",
259
- props: {
260
- record: {}
261
- },
262
- setup(w, { expose: _ }) {
263
- const i = w, d = Z(), o = h(!1), C = b(() => {
264
- var s;
265
- return (s = i.record) != null && s.skuId ? d.skus.find((a) => a._id === i.record.skuId) : null;
266
- }), m = b(() => {
267
- if (!i.record || !i.record.previousCost) return null;
268
- const s = i.record.previousCost.amount, v = i.record.cost.amount - s;
269
- return {
270
- amount: Math.abs(v),
271
- precision: i.record.cost.precision,
272
- currency: i.record.cost.currency,
273
- isIncrease: v > 0
274
- };
275
- }), U = b(() => i.record ? {
276
- default: "Default",
277
- weightedAverage: "Weighted Average (WAVG)",
278
- netsuite: "NetSuite",
279
- "netsuite-average": "NetSuite Average"
280
- }[i.record.mechanism] || i.record.mechanism : "");
281
- b(() => {
282
- var s;
283
- return !((s = i.record) != null && s.meta) || i.record.mechanism !== "netsuite" ? null : i.record.meta;
284
- });
285
- function M() {
286
- o.value = !0;
287
- }
288
- function x() {
289
- o.value = !1;
290
- }
291
- return _({
292
- open: M,
293
- close: x
294
- }), (s, a) => {
295
- const v = L("FmMenuDivider"), $ = L("FmCard"), B = L("FmButton"), D = L("FmSideSheet");
296
- return u(), T(D, {
297
- "model-value": o.value,
298
- "onUpdate:modelValue": a[0] || (a[0] = (R) => o.value = R),
299
- header: "Unit Cost History Details",
300
- "close-button": "",
301
- "dismiss-away": "",
302
- "max-width": 500
303
- }, {
304
- "side-sheet-footer": A(() => [
305
- t("div", ot, [
306
- p(B, {
307
- variant: "tertiary",
308
- onClick: x,
309
- label: "Close"
310
- })
311
- ])
312
- ]),
313
- default: A(() => [
314
- s.record ? (u(), g("div", Te, [
315
- p($, {
316
- variant: "outlined",
317
- class: "flex flex-col gap-8 px-12 py-16"
318
- }, {
319
- default: A(() => {
320
- var R, k;
321
- return [
322
- a[8] || (a[8] = t("div", { class: "flex justify-between" }, [
323
- t("div", { class: "fm-typo-en-body-lg-600" }, "Details")
324
- ], -1)),
325
- p(v),
326
- t("div", Me, [
327
- t("div", ze, [
328
- t("div", He, [
329
- a[1] || (a[1] = t("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, "Ingredient Code", -1)),
330
- t("div", Ee, n((R = C.value) == null ? void 0 : R.code), 1)
331
- ]),
332
- t("div", Pe, [
333
- a[2] || (a[2] = t("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, "Ingredient Name", -1)),
334
- t("div", Ke, n((k = C.value) == null ? void 0 : k.name), 1)
335
- ]),
336
- t("div", Oe, [
337
- a[3] || (a[3] = t("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, "New Cost", -1)),
338
- t("div", Ye, [
339
- H(n(r(j)(s.record.cost, !0, s.record.cost.precision)) + " ", 1),
340
- m.value ? (u(), g("div", {
341
- key: 0,
342
- class: E(["fm-typo-en-body-md-600 flex items-center gap-4", {
343
- "text-fm-color-system-success-500": m.value.isIncrease,
344
- "text-fm-color-system-error-500": !m.value.isIncrease
345
- }])
346
- }, [
347
- t("span", {
348
- class: E({
349
- "text-red-500": m.value.isIncrease,
350
- "text-green-600": !m.value.isIncrease
351
- })
352
- }, n(m.value.isIncrease ? "↑" : "↓"), 3),
353
- t("span", {
354
- class: E({
355
- "text-red-500": m.value.isIncrease,
356
- "text-green-600": !m.value.isIncrease
357
- })
358
- }, n(m.value.isIncrease ? "Increase" : "Decrease"), 3)
359
- ], 2)) : F("", !0)
360
- ])
361
- ]),
362
- t("div", je, [
363
- a[4] || (a[4] = t("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, "Previous Cost", -1)),
364
- t("div", Je, n(s.record.previousCost ? r(j)(
365
- s.record.previousCost,
366
- !0,
367
- s.record.previousCost.precision
368
- ) : "-"), 1)
369
- ]),
370
- t("div", We, [
371
- a[5] || (a[5] = t("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, "Mechanism", -1)),
372
- t("div", Ge, n(U.value), 1)
373
- ]),
374
- t("div", Qe, [
375
- a[6] || (a[6] = t("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, "Snapshot At", -1)),
376
- t("div", Xe, n(r(Y)(new Date(s.record.snapshotAt))) + " " + n(new Date(s.record.snapshotAt).toLocaleTimeString()), 1)
377
- ]),
378
- t("div", Ze, [
379
- a[7] || (a[7] = t("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, "Updated At", -1)),
380
- t("div", qe, [
381
- s.record.updatedAt ? (u(), g(O, { key: 0 }, [
382
- H(n(r(Y)(new Date(s.record.updatedAt))) + " " + n(new Date(s.record.updatedAt).toLocaleTimeString()), 1)
383
- ], 64)) : (u(), g(O, { key: 1 }, [
384
- H("-")
385
- ], 64))
386
- ])
387
- ])
388
- ])
389
- ])
390
- ];
391
- }),
392
- _: 1
393
- }),
394
- p(ne, null, {
395
- default: A(() => [
396
- p($, {
397
- variant: "outlined",
398
- class: "flex flex-col gap-8 px-12 py-16"
399
- }, {
400
- default: A(() => [
401
- a[9] || (a[9] = t("div", { class: "flex justify-between" }, [
402
- t("div", { class: "fm-typo-en-body-lg-600" }, "Raw data")
403
- ], -1)),
404
- p(v),
405
- t("div", et, [
406
- t("pre", tt, n(JSON.stringify(s.record, null, 2)) + `
407
- `, 1)
408
- ])
409
- ]),
410
- _: 1
411
- })
412
- ]),
413
- _: 1
414
- })
415
- ])) : F("", !0)
416
- ]),
417
- _: 1
418
- }, 8, ["model-value"]);
419
- };
420
- }
421
- }), ft = /* @__PURE__ */ Q({
422
- __name: "UnitCostHistoryView",
423
- setup(w) {
424
- const { t: _ } = ee(), i = J(), d = Z(), o = q(), C = le(), { breakpoints: m } = ce(), U = b(() => m.value.xs || m.value.sm), M = b(() => U.value ? 10 : 20), x = h(), s = h(), a = h(null), { historyData: v, isLoading: $, fetchHistory: B } = ye(), D = h(""), R = b(() => [
425
- {
426
- type: "string",
427
- key: "skuCode",
428
- entity: "sku",
429
- values: d.skus.map((e) => e.code)
430
- },
431
- {
432
- type: "string",
433
- key: "skuName",
434
- entity: "sku",
435
- values: d.skus.map((e) => e.name)
436
- },
437
- {
438
- type: "string",
439
- key: "mechanism",
440
- entity: "sku",
441
- values: ["weightedAverage", "netsuite", "netsuite-average"]
442
- }
443
- ]), k = h(null);
444
- i.watchLocation(V);
445
- async function V() {
446
- if (i._currentLocation)
447
- try {
448
- await B();
449
- } catch (l) {
450
- o.open({
451
- title: "Error",
452
- message: "Failed to fetch unit cost history. Please try again.",
453
- type: "error"
454
- }), console.error("Error fetching unit cost history:", l);
455
- }
456
- }
457
- const P = b(() => {
458
- const l = /* @__PURE__ */ new Map();
459
- for (const e of d.skus)
460
- l.set(e._id, e);
461
- return l;
462
- }), K = b(() => {
463
- let l = v.value;
464
- if (k.value) {
465
- const e = me.build(k.value);
466
- l = l.filter((y) => {
467
- const I = P.value.get(y.skuId);
468
- return fe(
469
- {
470
- skuCode: (I == null ? void 0 : I.code) ?? y.skuId,
471
- skuName: (I == null ? void 0 : I.name) ?? y.skuId,
472
- mechanism: y.mechanism
473
- },
474
- e
475
- );
476
- });
477
- }
478
- return l.map((e) => {
479
- const y = P.value.get(e.skuId);
480
- return {
481
- ...e,
482
- skuCode: (y == null ? void 0 : y.code) ?? e.skuId,
483
- skuName: (y == null ? void 0 : y.name) ?? "Unknown SKU"
484
- };
485
- });
486
- }), W = b(() => [
487
- {
488
- accessorKey: "snapshotAt",
489
- header: () => "Snapshot At",
490
- cell: (l) => {
491
- const e = new Date(l.row.original.snapshotAt);
492
- return Y(e) + " " + e.toLocaleTimeString();
493
- },
494
- enableSorting: !0,
495
- size: 180
496
- },
497
- {
498
- accessorKey: "skuCode",
499
- header: () => "SKU Code",
500
- enableSorting: !0,
501
- size: 150
502
- },
503
- {
504
- accessorKey: "skuName",
505
- header: () => "SKU Name",
506
- enableSorting: !0,
507
- size: "auto"
508
- },
509
- {
510
- accessorKey: "previousCost",
511
- header: () => "Previous Cost",
512
- cell: (l) => {
513
- const e = l.row.original.previousCost;
514
- return e ? j(e, !1, e.precision) : "-";
515
- },
516
- enableSorting: !1,
517
- size: 150
518
- },
519
- {
520
- accessorKey: "cost",
521
- header: () => "Current Cost",
522
- cell: (l) => {
523
- const e = l.row.original.cost;
524
- return e ? j(e, !1, e.precision) : "-";
525
- },
526
- enableSorting: !1,
527
- size: 150
528
- },
529
- {
530
- accessorKey: "mechanism",
531
- header: () => "Mechanism",
532
- cell: (l) => {
533
- const e = l.row.original.mechanism;
534
- return {
535
- default: "Default",
536
- weightedAverage: "Weighted Average",
537
- netsuite: "NetSuite",
538
- "netsuite-average": "NetSuite Average"
539
- }[e] ?? e;
540
- },
541
- enableSorting: !0,
542
- size: 150
543
- },
544
- {
545
- accessorKey: "updatedAt",
546
- header: () => "Updated At",
547
- cell: (l) => {
548
- const e = l.row.original.updatedAt;
549
- if (!e) return "-";
550
- const y = new Date(e);
551
- return Y(y) + " " + y.toLocaleTimeString();
552
- },
553
- enableSorting: !0,
554
- size: 180
555
- }
556
- ]), f = b(() => [
557
- {
558
- label: "Recalculate Cost History",
559
- value: "recalculate",
560
- isPrimary: !0,
561
- prependIcon: "calculate",
562
- isAdminOnly: !0
563
- },
564
- {
565
- label: _("inventory.common.refresh"),
566
- value: "refresh"
567
- }
568
- ]);
569
- function c() {
570
- var l;
571
- (l = x.value) == null || l.open();
572
- }
573
- function S() {
574
- V();
575
- }
576
- function N(l) {
577
- var e;
578
- a.value = l, (e = s.value) == null || e.open();
579
- }
580
- function G(l) {
581
- switch (l) {
582
- case "recalculate":
583
- return c();
584
- case "refresh":
585
- return V();
586
- }
587
- }
588
- return (l, e) => {
589
- const y = L("FmTable");
590
- return u(), T(re, {
591
- title: "Unit Cost History",
592
- actions: f.value,
593
- "onClick:action": G
594
- }, {
595
- default: A(() => {
596
- var I;
597
- return [
598
- t("div", {
599
- class: E([
600
- "flex flex-col gap-8 max-h-full",
601
- {
602
- "p-0": U.value,
603
- "px-24": !U.value
604
- }
605
- ])
606
- }, [
607
- p(ue, {
608
- searchable: "",
609
- "change-location": "",
610
- search: D.value,
611
- "onUpdate:search": e[0] || (e[0] = (z) => D.value = z),
612
- filterable: "",
613
- "filter-attributes": R.value,
614
- filter: k.value,
615
- "onUpdate:filter": e[1] || (e[1] = (z) => k.value = z)
616
- }, null, 8, ["search", "filter-attributes", "filter"]),
617
- (u(), T(y, {
618
- key: `${(I = r(i)._currentLocation) == null ? void 0 : I.dbName}-${JSON.stringify(k.value)}`,
619
- style: ae(r(C).tableHeight),
620
- "column-defs": W.value,
621
- "row-data": K.value,
622
- "search-value": D.value,
623
- loading: r($) || !r(i)._currentLocation,
624
- "page-size": M.value,
625
- onRowClick: e[2] || (e[2] = (z) => N(z.original))
626
- }, null, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"]))
627
- ], 2),
628
- (u(), T(X, { to: "body" }, [
629
- p(Ve, {
630
- ref_key: "recalculationDialogRef",
631
- ref: x,
632
- onSubmitted: S
633
- }, null, 512)
634
- ])),
635
- (u(), T(X, { to: "body" }, [
636
- p(st, {
637
- ref_key: "detailsSideSheetRef",
638
- ref: s,
639
- record: a.value
640
- }, null, 8, ["record"])
641
- ]))
642
- ];
643
- }),
644
- _: 1
645
- }, 8, ["actions"]);
646
- };
647
- }
648
- });
649
- export {
650
- ft as default
651
- };
@@ -1,28 +0,0 @@
1
- export interface UnitCostHistoryRecalculateParams {
2
- businessId: string;
3
- locationId?: string;
4
- startDate?: string;
5
- endDate?: string;
6
- skuId?: string;
7
- }
8
- export interface CostRecalculationRequestResponse {
9
- _id: string;
10
- location: string;
11
- recalculateStartDate: string;
12
- recalculateEndDate: string;
13
- createdBy: {
14
- _id: string;
15
- name: string;
16
- };
17
- createdAt: string;
18
- completedAt?: string;
19
- failedReason?: string;
20
- }
21
- export declare const useUnitCostHistoryApi: () => {
22
- getLatestCostForAllSkus(locationId: string): Promise<FdoUnitCostHistory[]>;
23
- recalculate(params: UnitCostHistoryRecalculateParams): Promise<{
24
- jobId: string;
25
- }>;
26
- getJobStatus(jobId: string): Promise<CostRecalculationRequestResponse>;
27
- listRecentRecalculationRequests(): Promise<CostRecalculationRequestResponse[]>;
28
- };