@feedmepos/mf-inventory-portal 0.0.22-dev.9 → 0.0.23-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 (163) hide show
  1. package/dist/App-Y3Ez8Rjf.js +255 -0
  2. package/dist/ApprovalView-BUU1G4Q2.js +141 -0
  3. package/dist/{BindingsDialog-GzX9Bo2g.js → BindingsDialog-8wc4Q0JQ.js} +13 -12
  4. package/dist/{BindingsPicker-SbOetc0-.js → BindingsPicker-DGWN1LQc.js} +19 -18
  5. package/dist/{BindingsTable-CAcE5y8U.js → BindingsTable-7NJP2jT6.js} +20 -16
  6. package/dist/ClosingTemplateView-9s7vmwaT.js +1833 -0
  7. package/dist/FmDroppableField-8RzKjEdL.js +154 -0
  8. package/dist/FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-B4DDh9-a.js +267 -0
  9. package/dist/FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-5DINn0ZB.js +436 -0
  10. package/dist/FmMultiselectDialog-7hok9sJP.js +411 -0
  11. package/dist/FmUnitInput.vue_vue_type_script_setup_true_lang-CxR1FCft.js +326 -0
  12. package/dist/IngredientBindedItem.vue_vue_type_script_setup_true_lang-FQ0HjuL3.js +51 -0
  13. package/dist/IngredientGroupView-C3maHTCg.js +610 -0
  14. package/dist/IngredientsView-DCR3IBkR.js +1613 -0
  15. package/dist/IntegrationView-gO4h89Wj.js +1227 -0
  16. package/dist/InventoryBindingForm-dh3GeyG-.js +4 -0
  17. package/dist/InventoryBindingForm.vue_vue_type_script_setup_true_lang-CJuo3i7W.js +278 -0
  18. package/dist/InventoryBindingSummary-BPoPcEoe.js +75 -0
  19. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-1FCwvO8A.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-olm8sZKt.js} +1 -1
  20. package/dist/PremiumBadge.vue_vue_type_script_setup_true_lang-BezTV43V.js +116 -0
  21. package/dist/{PurchaseOrderPrintPreview-5HIWHR_f.js → PurchaseOrderPrintPreview-Dix_fIoo.js} +14 -13
  22. package/dist/ReceiveRequestView-DdPiYb2P.js +4082 -0
  23. package/dist/RecipeView-C4-a4IEW.js +597 -0
  24. package/dist/Standalone.vue.d.ts +2 -0
  25. package/dist/StockView-Du2txrIP.js +7778 -0
  26. package/dist/SupplierView-D_09FbQh.js +1474 -0
  27. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-C9MOos--.js +1144 -0
  28. package/dist/TransferTemplateView-j3CRy6Lc.js +1262 -0
  29. package/dist/{UnitView-BpU0Yk7X.js → UnitView-BXw2Vwq1.js} +30 -29
  30. package/dist/{WarehouseView-DqxWgogc.js → WarehouseView-CKamiETC.js} +205 -202
  31. package/dist/_plugin-vue_export-helper-CHgC5LLL.js +9 -0
  32. package/dist/api/bill.d.ts +86 -240
  33. package/dist/api/closing-template.d.ts +6 -4
  34. package/dist/api/inventory.d.ts +281 -88
  35. package/dist/api/netsuite.d.ts +32 -1
  36. package/dist/api/purchase-order-template.d.ts +4 -2
  37. package/dist/api/supplier.d.ts +1 -0
  38. package/dist/app-GUbzqEtW.js +33456 -0
  39. package/dist/app.d.ts +259 -6
  40. package/dist/app.js +8 -7
  41. package/dist/array-hChJVZLE.js +43 -0
  42. package/dist/components/FmFilterableMenuOptions.vue.d.ts +54 -0
  43. package/dist/components/FmMinMaxInputRules.d.ts +2 -0
  44. package/dist/components/FmMultiselectDialog.vue.d.ts +3 -9
  45. package/dist/components/FmMultiselectDialogProps.d.ts +0 -2
  46. package/dist/components/FmUnitInputRules.d.ts +2 -0
  47. package/dist/components/inventory-binding/InventoryBinding.vue.d.ts +5 -5
  48. package/dist/components/map/GoogleMap.vue.d.ts +4 -4
  49. package/dist/components/shell/inventory/binding-dialog.vue.d.ts +2 -2
  50. package/dist/components/shell/inventory/binding-ui.vue.d.ts +2 -2
  51. package/dist/date2-CLE9fB2R.js +117 -0
  52. package/dist/dayjs.min-CY1d38w7.js +282 -0
  53. package/dist/{decimal-DWbwRn_v.js → decimal-SIjO6Mjw.js} +1 -1
  54. package/dist/defineDeepModel-l40rX7kr.js +13 -0
  55. package/dist/extensions/array.d.ts +1 -0
  56. package/dist/feature-BXruKUhX.js +78 -0
  57. package/dist/{format-time-from-id-BnmaRuab.js → format-time-from-id-CcFsBXmk.js} +1 -1
  58. package/dist/format-unit-display-DEKg8cJm.js +1198 -0
  59. package/dist/fuzzy-CVOV9zJc.js +41 -0
  60. package/dist/googlemap-Dm8ERVai.js +97 -0
  61. package/dist/helper/rules.d.ts +7 -0
  62. package/dist/helper/rules.spec.d.ts +1 -0
  63. package/dist/helper/xlsx.util.d.ts +7 -0
  64. package/dist/index-BX5KZXhI.js +22279 -0
  65. package/dist/index-CVsyOEb1.js +10545 -0
  66. package/dist/index-m9e9nYfl.js +45 -0
  67. package/dist/netsuite-DAKRv7zr.js +146 -0
  68. package/dist/normalizeArguments-DP7Hrren.js +1552 -0
  69. package/dist/router/name.d.ts +1 -0
  70. package/dist/rules-DlnN8IP3.js +198 -0
  71. package/dist/stores/integration/foodmarkethub.d.ts +391 -0
  72. package/dist/stores/integration/index.d.ts +7 -0
  73. package/dist/stores/integration/netsuite.d.ts +102 -0
  74. package/dist/stores/inventory.d.ts +295 -9
  75. package/dist/stores/location.d.ts +508 -485
  76. package/dist/stores/supplier.d.ts +124 -4
  77. package/dist/stores/warehouse.d.ts +7 -4
  78. package/dist/style.css +1 -1
  79. package/dist/supplier-B21WlSAM.js +77 -0
  80. package/dist/tsconfig.app.tsbuildinfo +1 -1
  81. package/dist/use-inventory-binding-dialog-D3x6xj2O.js +95 -0
  82. package/dist/{use-template-enabled-locations-2-ClBq9FjN.js → use-template-enabled-locations-2-z-b-UXef.js} +9 -8
  83. package/dist/useTabStorage-BkIVScW_.js +25 -0
  84. package/dist/views/closing-template/closing-template-import/ClosingTemplateImport.vue.d.ts +2 -0
  85. package/dist/views/closing-template/closing-template-import/ClosingTemplateImportItem.vue.d.ts +12 -0
  86. package/dist/views/closing-template/closing-template-import/ClosingTemplateImportItemProps.d.ts +7 -0
  87. package/dist/views/closing-template/components/closing-template-form/composables/use-closing-template-items.d.ts +1 -1
  88. package/dist/views/closing-template/composables/use-closing-template-actions.d.ts +877 -1002
  89. package/dist/views/closing-template/composables/use-closing-template-table.d.ts +882 -1013
  90. package/dist/views/closing-template/helpers/import-export.helper.d.ts +58 -0
  91. package/dist/views/ingredient-group/IngredientGroupView.vue.d.ts +3 -0
  92. package/dist/views/ingredient-group/components/ingredient-group-dialog/IngredientGroupDialog.vue.d.ts +31 -0
  93. package/dist/views/ingredient-group/components/ingredient-group-dialog/IngredientGroupDialogProps.d.ts +12 -0
  94. package/dist/views/ingredient-group/components/ingredient-group-form/IngredientGroupForm.vue.d.ts +20 -0
  95. package/dist/views/ingredient-group/components/ingredient-group-form/IngredientGroupFormProps.d.ts +12 -0
  96. package/dist/views/ingredient-group/composables/use-ingredient-group-actions.d.ts +24 -0
  97. package/dist/views/ingredient-group/composables/use-ingredient-group-table.d.ts +215 -0
  98. package/dist/views/ingredients/components/convert/ConvertForm.vue.d.ts +2 -2
  99. package/dist/views/ingredients/components/ingredient-form/IngredientForm.vue.d.ts +2 -2
  100. package/dist/views/ingredients/components/inventory-binding/InventoryBindingForm.vue.d.ts +5 -5
  101. package/dist/views/ingredients/composables/use-ingredient-form.d.ts +2 -2
  102. package/dist/views/ingredients/composables/use-ingredient-table.d.ts +1 -1
  103. package/dist/views/integration/FoodMarketHub.vue.d.ts +2 -0
  104. package/dist/views/integration/NetSuite.vue.d.ts +2 -0
  105. package/dist/views/integration/components/ApplyProductDialog.vue.d.ts +7 -7
  106. package/dist/views/integration/components/ApplyProductDialogV4.vue.d.ts +7 -7
  107. package/dist/views/receive-request/components/transfer-details/TransferDetailsProps.d.ts +1 -0
  108. package/dist/views/receive-request/components/transfer-form/NetSuiteField.vue.d.ts +49 -0
  109. package/dist/views/receive-request/components/transfer-form/TransferForm.vue.d.ts +1913 -53
  110. package/dist/views/receive-request/components/transfer-form/TransferFormProps.d.ts +1 -0
  111. package/dist/views/receive-request/components/transfer-form/components/ForecastStock.vue.d.ts +2 -2
  112. package/dist/views/receive-request/components/transfer-form/composables/use-transfer-items.d.ts +1 -1
  113. package/dist/views/receive-request/composables/use-receive-request-form.d.ts +2370 -327
  114. package/dist/views/receive-request/composables/use-receive-request-table.d.ts +2304 -261
  115. package/dist/views/recipe/components/recipe-form/RecipeForm.vue.d.ts +2 -2
  116. package/dist/views/recipe/composables/use-recipe-form.d.ts +2 -2
  117. package/dist/views/stock/components/StockRecordCard.vue.d.ts +43 -120
  118. package/dist/views/stock/components/dialog/AdjustedItemForm.vue.d.ts +34 -4
  119. package/dist/views/stock/composables/use-stock-action.d.ts +2 -2
  120. package/dist/views/stock/helper/compute-summary-total.d.ts +2 -2
  121. package/dist/views/supplier/components/supplier-import/SupplierImport.vue.d.ts +2 -0
  122. package/dist/views/supplier/components/supplier-import/SupplierImportItem.vue.d.ts +12 -0
  123. package/dist/views/supplier/components/supplier-import/SupplierImportItemProps.d.ts +6 -0
  124. package/dist/views/supplier/composables/use-supplier-actions.d.ts +10 -0
  125. package/dist/views/supplier/helpers/import-export.helper.d.ts +50 -0
  126. package/dist/views/transfer-template/components/transfer-template-details/TransferTemplateDetails.vue.d.ts +0 -2
  127. package/dist/views/transfer-template/components/transfer-template-details/TransferTemplateDetailsProps.d.ts +0 -1
  128. package/dist/views/transfer-template/components/transfer-template-form/composables/use-template-enabled-locations.d.ts +71 -82
  129. package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-locations.d.ts +38 -1
  130. package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-template-items.d.ts +1 -1
  131. package/dist/views/transfer-template/components/transfer-template-import/TransferTemplateImport.vue.d.ts +2 -0
  132. package/dist/views/transfer-template/components/transfer-template-import/TransferTemplateImportItem.vue.d.ts +12 -0
  133. package/dist/views/transfer-template/components/transfer-template-import/TransferTemplateImportItemProps.d.ts +9 -0
  134. package/dist/views/transfer-template/composables/use-transfer-template-actions.d.ts +1279 -1528
  135. package/dist/views/transfer-template/composables/use-transfer-template-table.d.ts +2207 -446
  136. package/dist/views/transfer-template/helpers/import-export.helper.d.ts +76 -0
  137. package/dist/views/transfer-template/helpers/remove-deleted-skus.helper.d.ts +1 -251
  138. package/dist/views/transfer-template/helpers/template-item.error.helper.d.ts +1 -0
  139. package/dist/views/unit/composables/use-unit-form.d.ts +2 -2
  140. package/dist/views/warehouse/components/WarehouseForm.vue.d.ts +14 -8
  141. package/dist/{xlsx-DiOKvJ6l.js → xlsx-6mM1eNiL.js} +1525 -1525
  142. package/dist/xlsx.util-BLftcF4q.js +78 -0
  143. package/package.json +7 -4
  144. package/dist/ApprovalView-BPsScR5_.js +0 -129
  145. package/dist/ClosingTemplateView-DECwEnlK.js +0 -1066
  146. package/dist/FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DnogYrRE.js +0 -372
  147. package/dist/IngredientsView-8fT1Ljd5.js +0 -1758
  148. package/dist/IntegrationView-CjGLRM78.js +0 -1141
  149. package/dist/PremiumBadge.vue_vue_type_script_setup_true_lang-DlhNc8Vk.js +0 -88
  150. package/dist/ReceiveRequestView-CXZv8g5U.js +0 -215
  151. package/dist/RecipeView-sB0Lgmob.js +0 -581
  152. package/dist/StockView-CY2kNohB.js +0 -1892
  153. package/dist/SupplierView-DTqeZPts.js +0 -827
  154. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-BBby29tW.js +0 -762
  155. package/dist/TransferDialog.vue_vue_type_script_setup_true_lang-ByNQap9n.js +0 -1498
  156. package/dist/TransferTemplateView-DkRVfAox.js +0 -1277
  157. package/dist/app-BuyAj4kw.js +0 -69068
  158. package/dist/defineDeepModel-DuVmbMwq.js +0 -13
  159. package/dist/id-to-date-CI5Vv0Ji.js +0 -30
  160. package/dist/purchase-order-transaction-type-DrFJFvtK.js +0 -676
  161. package/dist/stores/netsuite.d.ts +0 -49
  162. package/dist/supplier-BQyK2eSZ.js +0 -69
  163. package/dist/xlsx.util-CZ7zYxdP.js +0 -109
@@ -0,0 +1,1144 @@
1
+ import { ref as L, computed as J, h as ce, defineComponent as Ue, resolveComponent as X, openBlock as h, createBlock as z, unref as l, isRef as Le, withCtx as ie, createElementVNode as e, createVNode as W, createElementBlock as A, Fragment as ee, toDisplayString as b, normalizeClass as ue, createCommentVNode as P, renderList as de } from "vue";
2
+ import { i as je } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-5DINn0ZB.js";
3
+ import { j as Be, u as fe, B as R, D as Ke, c as xe, v as M, s as qe } from "./app-GUbzqEtW.js";
4
+ import { t as Ve, b as Ge, h as Pe, d as De } from "./date2-CLE9fB2R.js";
5
+ import { F as ke, D as I, R as F } from "./row-action.enum-PMKMRrZR.js";
6
+ import { useDialog as Ne, useSnackbar as Ce, useProxiedModel as He } from "@feedmepos/ui-library";
7
+ import { p as ze, f as pe } from "./format-time-from-id-CcFsBXmk.js";
8
+ import { u as Te } from "./feature-BXruKUhX.js";
9
+ import { b as Ye, u as Qe, f as Ee, P as me } from "./format-unit-display-DEKg8cJm.js";
10
+ import { c as Ae } from "./TableActionableRow.vue_vue_type_script_setup_true_lang-DlNJ6kRg.js";
11
+ import { i as $e, c as be, a as le, k as We, j as Je } from "./rules-DlnN8IP3.js";
12
+ import { F as Xe } from "./decimal-SIjO6Mjw.js";
13
+ import { useI18n as Fe } from "@feedmepos/mf-common";
14
+ import { E as Ze } from "./empty-placeholder-wf6-BWE8.js";
15
+ import { u as et } from "./netsuite-DAKRv7zr.js";
16
+ const Ie = Be((u, w) => {
17
+ const p = fe();
18
+ return {
19
+ async readRequests(s) {
20
+ const S = s ?? p.currentLocationDBName, O = `${u.inventoryBackendUrl}/${S}/purchase-request`;
21
+ return await w.get(O);
22
+ },
23
+ async getPurchaseOrders({
24
+ start: s,
25
+ end: S
26
+ }) {
27
+ const O = p.currentLocationDBName, N = `${u.inventoryBackendUrl}/${O}/purchase-order`;
28
+ return await w.get(`${N}?start=${s}&end=${S}`);
29
+ },
30
+ async getPurchaseOrderById(s) {
31
+ const S = p.currentLocationDBName, O = `${u.inventoryBackendUrl}/${S}/purchase-order`;
32
+ return await w.get(`${O}/${s}`);
33
+ },
34
+ async processPurchaseOrder(s, S) {
35
+ const O = p.currentLocationDBName, N = S || O, E = `${u.inventoryBackendUrl}/${N}/purchase-order/run-operation`;
36
+ return await w.put(E, s);
37
+ },
38
+ async createPurchaseOrder(s) {
39
+ const S = p.currentLocationDBName, O = `${u.inventoryBackendUrl}/${S}/purchase-order`;
40
+ return await w.post(O, s);
41
+ },
42
+ async updatePurchaseOrder(s) {
43
+ const S = p.currentLocationDBName, O = `${u.inventoryBackendUrl}/${S}/purchase-order`;
44
+ return await w.put(O, s);
45
+ }
46
+ };
47
+ }), Me = {
48
+ [R.enum.confirmDraft]: {
49
+ primaryActions: {
50
+ text: "Confirm draft",
51
+ close: !0
52
+ },
53
+ title: "Confirm draft?",
54
+ message: "Purchase order cannot be changed after confirm draft.",
55
+ successMessage: "Purchase order draft has been confirmed"
56
+ },
57
+ [R.enum.cancelDraft]: {
58
+ primaryActions: {
59
+ text: "Cancel draft",
60
+ close: !0,
61
+ variant: "destructive"
62
+ },
63
+ title: "Cancel draft?",
64
+ message: "Purchase order cannot be changed after cancelled draft.",
65
+ successMessage: "Purchase order draft has been cancelled"
66
+ },
67
+ [R.enum.submitRequest]: {
68
+ primaryActions: {
69
+ text: "Submit request",
70
+ close: !0
71
+ },
72
+ title: "Confirm draft?",
73
+ message: "Purchase order cannot be changed after confirm draft.",
74
+ successMessage: "Purchase order draft has been submitted"
75
+ },
76
+ [R.enum.completeReceive]: {
77
+ primaryActions: {
78
+ text: "Mark received",
79
+ close: !0
80
+ },
81
+ title: "Mark as received",
82
+ message: "Purchase order cannot be changed after it has complete receiving.",
83
+ successMessage: "Purchase order has been marked as received"
84
+ },
85
+ [R.enum.approveRequest]: {
86
+ primaryActions: {
87
+ text: "Approve request",
88
+ close: !0
89
+ },
90
+ title: "Approve request?",
91
+ message: "Purchase order will be approved.",
92
+ successMessage: "Purchase order has been approved"
93
+ },
94
+ [R.enum.rejectRequest]: {
95
+ primaryActions: {
96
+ text: "Reject request",
97
+ close: !0,
98
+ variant: "destructive"
99
+ },
100
+ title: "Reject request?",
101
+ message: "Purchase order will be rejected.",
102
+ successMessage: "Purchase order has been rejected"
103
+ }
104
+ }, oe = L();
105
+ function kr(u, w) {
106
+ const p = Ne(), s = fe(), S = Te(), O = Ye(), N = Qe(), E = L(!1), i = Ce(), U = Ie(), c = L(new Array()), d = L(
107
+ w != null && w.startDate && (w != null && w.endDate) ? w : je()
108
+ ), m = J(() => {
109
+ const t = new Date(d.value.startDate), o = new Date(d.value.endDate);
110
+ return {
111
+ start: Ve(t).toISOString(),
112
+ end: Ge(o).toISOString()
113
+ };
114
+ }), f = L(new Array()), j = Ke(), Y = L(null);
115
+ async function re(t) {
116
+ let o;
117
+ if (S.mustUsePoTemplate && !(t != null && t.template) && (o = await O.getTemplateId(), !o))
118
+ return;
119
+ const g = {
120
+ mode: ke.CREATE,
121
+ modelValue: t || void 0,
122
+ show: !0,
123
+ "onUpdate:show"(_) {
124
+ oe.value.show = _;
125
+ },
126
+ templateId: o,
127
+ lastClosingDate: Y.value
128
+ };
129
+ oe.value = g;
130
+ }
131
+ function ve(t) {
132
+ const o = {
133
+ mode: ke.UPDATE,
134
+ modelValue: xe(t),
135
+ show: !0,
136
+ "onUpdate:show"(g) {
137
+ oe.value.show = g;
138
+ },
139
+ lastClosingDate: Y.value
140
+ };
141
+ oe.value = o;
142
+ }
143
+ async function G() {
144
+ c.value = [], E.value = !0;
145
+ try {
146
+ c.value = await U.getPurchaseOrders(m.value).then((g) => g.sort((_, n) => n._id.localeCompare(_._id)));
147
+ const t = await j.readLastClosing(!0), o = t == null ? void 0 : t._id;
148
+ o && (Y.value = ze(o)), S.mustUsePoTemplate && await N.fetchTemplates();
149
+ } catch {
150
+ i.open({
151
+ title: "Something went wrong",
152
+ message: "Error at fetching purchase orders",
153
+ type: "error"
154
+ });
155
+ } finally {
156
+ E.value = !1;
157
+ }
158
+ }
159
+ async function ye() {
160
+ f.value = [], E.value = !0;
161
+ try {
162
+ f.value = await U.readRequests().then((t) => t.reverse());
163
+ } catch {
164
+ i.open({
165
+ title: "Something went wrong",
166
+ message: "Error at fetching purchase requests",
167
+ type: "error"
168
+ });
169
+ } finally {
170
+ E.value = !1;
171
+ }
172
+ }
173
+ function Z() {
174
+ switch (u) {
175
+ case "receive/request":
176
+ return G();
177
+ case "approval":
178
+ return ye();
179
+ }
180
+ }
181
+ function he(t, o) {
182
+ d.value = {
183
+ startDate: t,
184
+ endDate: o
185
+ }, Z();
186
+ }
187
+ s.watchLocation(async (t) => {
188
+ if (!t) {
189
+ c.value = [];
190
+ return;
191
+ }
192
+ await Z();
193
+ });
194
+ const Q = L(), H = L(Math.random().toString());
195
+ async function a(t, o) {
196
+ var v, x;
197
+ const g = Math.random().toString();
198
+ H.value = g;
199
+ const _ = u === "receive/request" ? s.currentLocation : o == null ? void 0 : o.to, n = {
200
+ poRequest: o,
201
+ purchaseOrder: t,
202
+ transferTo: _ == null ? void 0 : _.name,
203
+ transferToDbName: _ == null ? void 0 : _.dbName,
204
+ show: !0,
205
+ canResubmit: !1,
206
+ canApprove: u === "approval",
207
+ "onUpdate:show"($) {
208
+ Q.value.show = $;
209
+ }
210
+ };
211
+ if (Q.value = n, !(o || t.status !== M.enum.REQUESTING)) {
212
+ try {
213
+ o = (await U.readRequests(
214
+ `${t.supplier.internal}_${t.supplier._id}`
215
+ )).find((D) => D.purchaseOrderId === t._id);
216
+ } catch {
217
+ console.error("Error at fetching po request to check");
218
+ }
219
+ g === H.value && (Q.value.canResubmit = !o, Q.value.transferTo = (v = o == null ? void 0 : o.to) == null ? void 0 : v.name, Q.value.transferToDbName = (x = o == null ? void 0 : o.to) == null ? void 0 : x.dbName);
220
+ }
221
+ }
222
+ async function r(t, o, g, _) {
223
+ E.value = !0;
224
+ try {
225
+ await U.processPurchaseOrder(
226
+ {
227
+ operation: o,
228
+ doc: t,
229
+ options: (
230
+ // auto receive for supplier to warehouse
231
+ (o === R.enum.confirmDraft || // auto receive for warehouse to warehouse
232
+ o === R.enum.completeReceive) && S.autoReceiveWarehouse ? {
233
+ autoReceive: !0
234
+ } : void 0
235
+ )
236
+ },
237
+ _
238
+ ), await new Promise((x) => setTimeout(x, 1e3));
239
+ const v = fe().currentLocationDBName.startsWith("restaurant_");
240
+ o === R.enum.confirmDraft && t.effectiveAt && v ? i.open({
241
+ title: "Success",
242
+ message: `${g}. The backdate will be reflected once your POS has received this change.`,
243
+ type: "success"
244
+ }) : i.open({
245
+ title: "Success",
246
+ message: g,
247
+ type: "success"
248
+ });
249
+ } catch (n) {
250
+ i.open({
251
+ title: "Something went wrong",
252
+ message: "Please try again.",
253
+ type: "error"
254
+ }), console.error("Error when submitting PO operation", o, t, n);
255
+ } finally {
256
+ E.value = !1, Z();
257
+ }
258
+ }
259
+ async function k(t, o, g) {
260
+ const _ = Me[o];
261
+ if (!_) {
262
+ i.open({
263
+ title: "Something went wrong",
264
+ message: `Cannot process order: ${qe(o)}`,
265
+ type: "error"
266
+ });
267
+ return;
268
+ }
269
+ const { successMessage: n, ...v } = _;
270
+ p.open({
271
+ title: v.title,
272
+ message: v.message,
273
+ primaryActions: v.primaryActions
274
+ }).onPrimary(() => {
275
+ r(t, o, n, g);
276
+ });
277
+ }
278
+ return {
279
+ purchaseOrders: c,
280
+ purchaseRequests: f,
281
+ updateDateRange: he,
282
+ fetchData: Z,
283
+ loading: E,
284
+ transferDialogProps: oe,
285
+ promptCreateTransferDialog: re,
286
+ promptUpdateTransferDialog: ve,
287
+ transferDetailsProps: Q,
288
+ promptShowTransferDetails: a,
289
+ submitAction: k
290
+ };
291
+ }
292
+ function tt(u, w) {
293
+ return w.reduce(
294
+ (s, S) => {
295
+ const O = S.received.find((N) => N.sku._id === u._id);
296
+ return O && (s = $e(s, O.amount)), s;
297
+ },
298
+ Xe.toPrecision(be(0), u.unit.precision)
299
+ );
300
+ }
301
+ function rt(u, w) {
302
+ const { name: p, address: s, regNo: S } = w.doc.profile, O = {
303
+ name: p,
304
+ registrationNumber: S,
305
+ line1: s == null ? void 0 : s.line1,
306
+ line2: s == null ? void 0 : s.line2,
307
+ postcode: s == null ? void 0 : s.postcode,
308
+ city: s == null ? void 0 : s.city,
309
+ state: s == null ? void 0 : s.state,
310
+ country: s == null ? void 0 : s.country
311
+ }, N = {
312
+ name: u.supplier.name,
313
+ registrationNumber: u.supplier.registrationNumber,
314
+ line1: u.supplier.address.line1,
315
+ line2: u.supplier.address.line2,
316
+ postcode: u.supplier.address.postcode,
317
+ city: u.supplier.address.city,
318
+ state: u.supplier.address.state,
319
+ country: u.supplier.address.country
320
+ }, E = u.items.map((d) => {
321
+ const { sku: m, measurement: f } = d, j = le(
322
+ tt(d.sku, u.deliveryOrder || []),
323
+ !1
324
+ );
325
+ return {
326
+ code: m.code,
327
+ description: m.name,
328
+ quantity: Ee(d.quantity, m.unit, d.measurement),
329
+ unit: (f == null ? void 0 : f.abbrev) || m.unit.abbrev,
330
+ received: j
331
+ };
332
+ }), i = u.deliveryOrder.map((d) => ({
333
+ createdAt: Pe(new Date(d.createdAt)),
334
+ ref: d.deliveryOrderNumber,
335
+ remark: d.remark || "",
336
+ items: d.received.map((m) => {
337
+ var f;
338
+ return {
339
+ code: m.sku.code,
340
+ description: m.sku.name,
341
+ quantity: le(m.amount),
342
+ unit: ((f = m.measurement) == null ? void 0 : f.abbrev) || m.sku.unit.abbrev
343
+ };
344
+ })
345
+ })), U = {
346
+ orderNumber: u.seqNumber.toString(),
347
+ createdAt: pe(u._id),
348
+ ref: u.ref || "",
349
+ remark: u.remark || "",
350
+ buyer: O,
351
+ supplier: N,
352
+ items: E,
353
+ status: u.status,
354
+ deliveryOrders: i
355
+ }, c = new URL(window.location.href);
356
+ c.pathname = c.hostname.includes("inventory.feedme") ? "/receive-request/print-preview" : "/inventory/receive-request/print-preview", c.searchParams.append("data", JSON.stringify(U)), window.open(c.href, "_blank", "noreferrer");
357
+ }
358
+ const te = {
359
+ submitRequest: {
360
+ translationKey: "inventory.transfer.receiveRequest.actions.submitRequest",
361
+ color: "text-fm-color-typo-primary",
362
+ value: R.enum.submitRequest
363
+ },
364
+ confirmDraft: {
365
+ translationKey: "inventory.transfer.receiveRequest.actions.confirmDraft",
366
+ color: "text-fm-color-typo-primary",
367
+ value: R.enum.confirmDraft
368
+ },
369
+ cancelDraft: {
370
+ translationKey: "inventory.transfer.receiveRequest.actions.cancelDraft",
371
+ color: "text-fm-color-typo-error",
372
+ value: R.enum.cancelDraft
373
+ },
374
+ approveRequest: {
375
+ translationKey: "inventory.transfer.receiveRequest.actions.approveRequest",
376
+ color: "text-fm-color-typo-primary",
377
+ value: R.enum.approveRequest
378
+ },
379
+ rejectRequest: {
380
+ translationKey: "inventory.transfer.receiveRequest.actions.rejectRequest",
381
+ color: "text-fm-color-typo-error",
382
+ value: R.enum.rejectRequest
383
+ },
384
+ processRequest: {
385
+ translationKey: "inventory.transfer.receiveRequest.actions.processRequest",
386
+ color: "text-fm-color-typo-primary",
387
+ value: R.enum.processRequest
388
+ },
389
+ receiveStock: {
390
+ translationKey: "inventory.transfer.receiveRequest.actions.receiveStock",
391
+ color: "text-fm-color-typo-primary",
392
+ value: R.enum.receiveStock
393
+ },
394
+ completeReceive: {
395
+ translationKey: "inventory.transfer.receiveRequest.actions.completeReceive",
396
+ color: "text-fm-color-typo-primary",
397
+ value: R.enum.completeReceive
398
+ }
399
+ };
400
+ function Ar(u, w) {
401
+ const p = fe(), { t: s } = Fe();
402
+ function S(c) {
403
+ switch (c.status) {
404
+ case "DRAFT":
405
+ return [
406
+ I[F.Update],
407
+ I[F.Details],
408
+ c.supplier.internal === "restaurant" || c.supplier.internal === "warehouse" ? te[R.enum.submitRequest] : te[R.enum.confirmDraft],
409
+ te[R.enum.cancelDraft],
410
+ I[F.Print]
411
+ ];
412
+ case "RECEIVING":
413
+ return [
414
+ te[R.enum.completeReceive],
415
+ I[F.Details],
416
+ I[F.Print]
417
+ ];
418
+ case "REQUESTING":
419
+ return u === "receive/request" ? [I[F.Details], I[F.Print]] : [
420
+ te[R.enum.approveRequest],
421
+ te[R.enum.rejectRequest],
422
+ I[F.Details],
423
+ I[F.Print]
424
+ ];
425
+ case "PROCESSING":
426
+ return [I[F.Details], I[F.Print]];
427
+ case "COMPLETE":
428
+ case "CANCEL":
429
+ default:
430
+ return [I[F.Details], I[F.Print]];
431
+ }
432
+ }
433
+ function O(c) {
434
+ return Object.values(R.enum).includes(c);
435
+ }
436
+ async function N(c, d, m) {
437
+ var j, Y;
438
+ const f = xe(d);
439
+ if (c === F.Print) {
440
+ rt(f, p.currentLocation);
441
+ return;
442
+ }
443
+ if (c === F.Details) {
444
+ w.promptShowTransferDetails(f, m);
445
+ return;
446
+ }
447
+ if (c === F.Update) {
448
+ (j = w.promptUpdateTransferDialog) == null || j.call(w, f);
449
+ return;
450
+ }
451
+ if (O(c)) {
452
+ w.submitAction(d, c, (Y = m == null ? void 0 : m.to) == null ? void 0 : Y.dbName);
453
+ return;
454
+ }
455
+ }
456
+ function E() {
457
+ return [
458
+ {
459
+ accessorKey: "seqNumber",
460
+ header: () => s("inventory.transfer.table.seqNo"),
461
+ enableSorting: !0,
462
+ size: 80,
463
+ sortUndefined: "last"
464
+ },
465
+ {
466
+ accessorKey: "_id",
467
+ header: () => s("inventory.transfer.table.createdAt"),
468
+ cell(c) {
469
+ return pe(`${c.getValue()}`);
470
+ },
471
+ enableSorting: !0
472
+ },
473
+ {
474
+ accessorKey: "supplier.name",
475
+ header: () => s("inventory.transfer.table.transferFrom"),
476
+ enableSorting: !0,
477
+ size: 200
478
+ },
479
+ {
480
+ accessorKey: "items.length",
481
+ header: () => s("inventory.transfer.table.noOfItems"),
482
+ enableSorting: !1,
483
+ meta: {
484
+ width: "10rem"
485
+ }
486
+ },
487
+ {
488
+ accessorKey: "ref",
489
+ header: () => s("inventory.transfer.table.reference"),
490
+ enableSorting: !1,
491
+ size: "auto"
492
+ },
493
+ {
494
+ accessorKey: "status",
495
+ header: () => s("inventory.transfer.table.status"),
496
+ cell(c) {
497
+ const d = s(`inventory.transfer.status.${c.getValue() ?? ""}`), m = `${c.getValue() ?? ""}`.toLocaleLowerCase("en-us");
498
+ return ce(
499
+ "div",
500
+ {
501
+ class: "flex"
502
+ },
503
+ ce(
504
+ "div",
505
+ {
506
+ class: `fm-status-badge fm-status-badge-${m}`
507
+ },
508
+ d
509
+ )
510
+ );
511
+ },
512
+ enableSorting: !0,
513
+ size: 200
514
+ },
515
+ {
516
+ id: "action",
517
+ cell(c) {
518
+ const d = c.row.original, m = S(d);
519
+ return Ae(m, (f) => N(f, d));
520
+ },
521
+ enableSorting: !1,
522
+ size: 40,
523
+ meta: {
524
+ cellClass: "",
525
+ headerClass: ""
526
+ }
527
+ }
528
+ ];
529
+ }
530
+ function i() {
531
+ return [
532
+ {
533
+ accessorKey: "purchaseOrder.seqNumber",
534
+ header: () => s("inventory.transfer.table.seqNo"),
535
+ enableSorting: !0,
536
+ size: 80,
537
+ sortUndefined: "last"
538
+ },
539
+ {
540
+ accessorKey: "purchaseOrder._id",
541
+ header: () => s("inventory.transfer.table.createdAt"),
542
+ cell(c) {
543
+ return pe(`${c.getValue()}`);
544
+ },
545
+ enableSorting: !0
546
+ },
547
+ {
548
+ accessorKey: "to.name",
549
+ header: () => s("inventory.transfer.table.transferTo"),
550
+ enableSorting: !1,
551
+ size: 200
552
+ },
553
+ {
554
+ accessorKey: "purchaseOrder.items.length",
555
+ header: () => s("inventory.transfer.table.noOfItems"),
556
+ enableSorting: !1
557
+ },
558
+ {
559
+ accessorKey: "purchaseOrder.ref",
560
+ header: () => s("inventory.transfer.table.reference"),
561
+ enableSorting: !1,
562
+ size: "auto"
563
+ },
564
+ {
565
+ accessorKey: "purchaseOrder.status",
566
+ header: () => s("inventory.transfer.table.status"),
567
+ cell(c) {
568
+ const d = s(`inventory.transfer.status.${c.getValue() ?? ""}`), m = `${c.getValue() ?? ""}`.toLocaleLowerCase("en-us");
569
+ return ce(
570
+ "div",
571
+ {
572
+ class: "flex"
573
+ },
574
+ ce(
575
+ "div",
576
+ {
577
+ class: `fm-status-badge fm-status-badge-${m}`
578
+ },
579
+ d
580
+ )
581
+ );
582
+ },
583
+ enableSorting: !0
584
+ },
585
+ {
586
+ id: "action",
587
+ cell(c) {
588
+ const d = c.row.original, m = d.purchaseOrder ? S(d.purchaseOrder) : [];
589
+ return Ae(
590
+ m,
591
+ (f) => d.purchaseOrder ? N(f, d.purchaseOrder, d) : void 0
592
+ );
593
+ },
594
+ enableSorting: !1,
595
+ size: 40,
596
+ meta: {
597
+ cellClass: "",
598
+ headerClass: ""
599
+ }
600
+ }
601
+ ];
602
+ }
603
+ const U = J(() => u === "receive/request" ? E() : i());
604
+ return {
605
+ get columnDefs() {
606
+ return U.value;
607
+ }
608
+ };
609
+ }
610
+ const st = { class: "flex flex-col gap-16 w-full h-full" }, at = { class: "flex justify-between" }, nt = { class: "fm-typo-en-body-lg-600" }, ot = { class: "flex flex-col gap-8" }, lt = { class: "flex flex-col gap-4" }, ct = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, it = { class: "flex gap-1" }, ut = { class: "fm-typo-en-body-lg-600" }, dt = {
611
+ key: 0,
612
+ class: "flex flex-col gap-4"
613
+ }, mt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ft = { class: "fm-typo-en-body-lg-600" }, pt = { class: "flex flex-col gap-4" }, vt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, yt = { class: "fm-typo-en-body-lg-600" }, ht = {
614
+ key: 1,
615
+ class: "flex flex-col gap-4"
616
+ }, bt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, gt = { class: "fm-typo-en-body-lg-600" }, _t = {
617
+ key: 2,
618
+ class: "flex flex-col gap-4"
619
+ }, wt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Rt = { class: "fm-typo-en-body-lg-600" }, St = {
620
+ key: 3,
621
+ class: "flex flex-col gap-4"
622
+ }, Ot = { class: "fm-typo-en-body-lg-600" }, Dt = {
623
+ key: 4,
624
+ class: "flex flex-col gap-4"
625
+ }, kt = { class: "fm-typo-en-body-lg-600" }, At = {
626
+ key: 5,
627
+ class: "flex flex-col gap-4"
628
+ }, xt = { class: "fm-typo-en-body-lg-600" }, qt = {
629
+ key: 6,
630
+ class: "flex flex-col gap-4"
631
+ }, Pt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Nt = { class: "fm-typo-en-body-lg-600" }, Ct = {
632
+ key: 7,
633
+ class: "flex flex-col gap-4"
634
+ }, Tt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Et = { class: "fm-typo-en-body-lg-600" }, $t = { class: "border border-fm-color-neutral-gray-200 fm-corner-radius-lg p-16" }, Ft = { class: "flex flex-col gap-8" }, It = { class: "fm-typo-en-body-lg-600" }, Mt = { class: "flex w-full gap-4" }, Ut = { class: "basis-1/2 shrink-0 grow fm-typo-en-body-lg-400 line-clamp-2" }, Lt = { class: "fm-typo-en-body-lg-600 line-clamp-2" }, jt = { class: "flex w-full gap-4 fm-typo-en-body-sm-400" }, Bt = { class: "grow fm-typo-en-body-lg-400 text-fm-color-typo-secondary line-clamp-1" }, Kt = {
635
+ key: 0,
636
+ class: "line-clamp-1 fm-typo-en-body-lg-400 text-fm-color-typo-secondary"
637
+ }, Vt = {
638
+ key: 1,
639
+ class: "flex-1 xs:w-screen xs:max-w-full"
640
+ }, Gt = {
641
+ key: 0,
642
+ class: "flex flex-col items-center gap-8 h-full"
643
+ }, Ht = ["src"], zt = { class: "fm-typo-en-body-lg-600" }, Yt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary px-16" }, Qt = {
644
+ key: 1,
645
+ class: "px-4 flex flex-col"
646
+ }, Wt = { class: "flex gap-12 content-stretch" }, Jt = {
647
+ class: "flex flex-col w-24",
648
+ name: "circles"
649
+ }, Xt = { class: "flex-1 flex flex-col items-center" }, Zt = { class: "flex-1 flex flex-col items-center" }, er = {
650
+ class: "py-12 flex flex-col gap-4",
651
+ name: "received-at header"
652
+ }, tr = { class: "fm-typo-en-body-lg-400" }, rr = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, sr = { class: "flex gap-12 content-stretch" }, ar = {
653
+ class: "flex flex-col w-24",
654
+ name: "circles"
655
+ }, nr = { class: "flex-1 flex flex-col items-center" }, or = {
656
+ class: "py-12 flex flex-col gap-4 flex-1",
657
+ name: "delivery details"
658
+ }, lr = { class: "flex flex-col gap-8" }, cr = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, ir = { class: "flex flex-col gap-4" }, ur = { class: "flex gap-8 xs:flex-col" }, xr = /* @__PURE__ */ Ue({
659
+ __name: "TransferDetails",
660
+ props: {
661
+ poRequest: {},
662
+ purchaseOrder: {},
663
+ transferTo: {},
664
+ transferToDbName: {},
665
+ show: { type: Boolean },
666
+ canResubmit: { type: Boolean },
667
+ canApprove: { type: Boolean }
668
+ },
669
+ emits: ["update:show", "submitted"],
670
+ setup(u, { emit: w }) {
671
+ const p = u, s = w, S = Ne(), O = Ce(), N = et(), E = Te(), { t: i } = Fe(), U = J(
672
+ () => {
673
+ var a, r, k, t;
674
+ return ((r = (a = p.purchaseOrder) == null ? void 0 : a.supplier) == null ? void 0 : r.internal) === "restaurant" || ((t = (k = p.purchaseOrder) == null ? void 0 : k.supplier) == null ? void 0 : t.internal) === "warehouse" ? me.TRANSFER : me.PURCHASE;
675
+ }
676
+ ), c = [
677
+ {
678
+ label: i("inventory.transfer.receiveRequest.details.overview"),
679
+ value: "overview"
680
+ },
681
+ {
682
+ label: i("inventory.transfer.receiveRequest.details.deliveryHistory"),
683
+ value: "deliveryHistory"
684
+ }
685
+ ], d = L(c[0]), m = L(!1), f = L(""), j = L(!0), Y = Ie(), re = He(p, "show");
686
+ async function ve(a, r, k) {
687
+ f.value = r, m.value = !0, j.value = !1;
688
+ try {
689
+ await Y.processPurchaseOrder(
690
+ {
691
+ operation: r,
692
+ doc: a,
693
+ options: (
694
+ // auto receive for supplier to warehouse
695
+ (r === R.enum.confirmDraft || // auto receive for warehouse to warehouse
696
+ r === R.enum.completeReceive) && E.autoReceiveWarehouse ? {
697
+ autoReceive: !0
698
+ } : void 0
699
+ )
700
+ },
701
+ p.transferToDbName
702
+ ), await new Promise((t) => setTimeout(t, 1e3)), O.open({
703
+ title: "Success",
704
+ message: k,
705
+ type: "success"
706
+ }), s("update:show", !1), s("submitted");
707
+ } catch (t) {
708
+ O.open({
709
+ title: "Something went wrong",
710
+ message: "Please try again.",
711
+ type: "error"
712
+ }), console.error("Error when submitting PO operation", r, a, t);
713
+ } finally {
714
+ f.value = "", m.value = !1, j.value = !0;
715
+ }
716
+ }
717
+ async function G(a) {
718
+ const r = Me[a];
719
+ if (!r) {
720
+ O.open({
721
+ title: "Something went wrong",
722
+ message: `Cannot process order: ${qe(a)}`,
723
+ type: "error"
724
+ });
725
+ return;
726
+ }
727
+ const { successMessage: k, ...t } = r;
728
+ S.open({
729
+ title: t.title,
730
+ message: t.message,
731
+ primaryActions: t.primaryActions
732
+ }).onPrimary(() => {
733
+ p.purchaseOrder && ve(p.purchaseOrder, a, k);
734
+ });
735
+ }
736
+ const ye = J(() => {
737
+ var a, r;
738
+ return ((a = p.purchaseOrder) == null ? void 0 : a.status) === M.enum.RECEIVING || ((r = p.purchaseOrder) == null ? void 0 : r.status) === M.enum.COMPLETE;
739
+ }), Z = J(
740
+ () => {
741
+ var a, r, k, t, o, g;
742
+ return N.getLocationSubsidiary(
743
+ ((k = (r = (a = p.purchaseOrder) == null ? void 0 : a.netSuite) == null ? void 0 : r.subsidiary) == null ? void 0 : k.id) || ((g = (o = (t = p.poRequest) == null ? void 0 : t.netSuite) == null ? void 0 : o.subsidiary) == null ? void 0 : g.id)
744
+ ).fullName;
745
+ }
746
+ ), he = J(() => {
747
+ var a, r, k, t, o, g;
748
+ return (r = (a = p.purchaseOrder) == null ? void 0 : a.deliveryFullfillment) != null && r.length && ((t = (k = p.purchaseOrder) == null ? void 0 : k.deliveryFullfillment) == null ? void 0 : t.length) > 0 ? (g = (o = p.purchaseOrder) == null ? void 0 : o.deliveryFullfillment) == null ? void 0 : g.map((_) => {
749
+ var n;
750
+ return (n = _.netSuite) == null ? void 0 : n.refNo;
751
+ }).join(", ") : "-";
752
+ }), Q = J(() => {
753
+ var g, _, n;
754
+ const k = (((g = p.purchaseOrder) == null ? void 0 : g.deliveryOrder) ?? []).flatMap((v) => v.received ?? []).reduce(
755
+ (v, x) => {
756
+ const $ = v[x.sku._id] ?? [];
757
+ return v[x.sku._id] = [...$, x], v;
758
+ },
759
+ {}
760
+ ), t = Object.entries(k).reduce(
761
+ (v, [x, $]) => {
762
+ const D = $.reduce((y, q) => {
763
+ const C = We(
764
+ y,
765
+ Math.max(y.precision, q.amount.precision)
766
+ );
767
+ return $e(C, q.amount);
768
+ }, be(0));
769
+ return v[x] = D, v;
770
+ },
771
+ {}
772
+ ), o = ((_ = p.purchaseOrder) == null ? void 0 : _.items) ?? [];
773
+ for (const v of o)
774
+ t[n = v.sku._id] ?? (t[n] = be(0));
775
+ return t;
776
+ }), H = J(() => {
777
+ var g, _;
778
+ const a = ((g = p.purchaseOrder) == null ? void 0 : g.deliveryOrder) ?? [], r = ((_ = p.purchaseOrder) == null ? void 0 : _.deliveryFullfillment) ?? [], k = [
779
+ ...a.map((n) => ({
780
+ createdAt: n.createdAt,
781
+ type: "grn",
782
+ doc: n
783
+ })),
784
+ ...r.map((n) => ({
785
+ createdAt: n.createdAt,
786
+ type: "fulfillment",
787
+ doc: n
788
+ }))
789
+ ];
790
+ k.reverse().sort((n, v) => n.createdAt.localeCompare(v.createdAt));
791
+ function t(n) {
792
+ var x, $, D, y, q, C, B;
793
+ const v = r.findIndex((T) => T.id === n.fullfillmentId);
794
+ return {
795
+ header: "Received",
796
+ date: De(new Date(n.createdAt)),
797
+ info: [
798
+ {
799
+ label: "Received by",
800
+ values: [(x = n.createdBy) == null ? void 0 : x.name]
801
+ },
802
+ {
803
+ label: "Received items",
804
+ values: n.received.map((T) => {
805
+ var K;
806
+ return `(${T.sku.code}) ${T.sku.name}: ${le(T.amount, !1)} ${((K = T.measurement) == null ? void 0 : K.abbrev) ?? T.sku.unit.abbrev}`;
807
+ })
808
+ },
809
+ n.deliveryOrderNumber ? {
810
+ label: "Delivery order no.",
811
+ values: [n.deliveryOrderNumber]
812
+ } : null,
813
+ n.remark ? {
814
+ label: "Remark",
815
+ values: [n.remark]
816
+ } : null,
817
+ v > -1 ? {
818
+ label: "Fulfilment's sequence",
819
+ values: [`${v + 1}`]
820
+ } : null,
821
+ (D = ($ = r[v]) == null ? void 0 : $.netSuite) != null && D.refNo ? {
822
+ label: "Fulfillment's ref no. (Netsuite)",
823
+ values: [(q = (y = r[v]) == null ? void 0 : y.netSuite) == null ? void 0 : q.refNo]
824
+ } : null,
825
+ (C = n == null ? void 0 : n.netSuite) != null && C.refNo ? {
826
+ label: "Item receipt (Netsuite)",
827
+ values: [(B = n == null ? void 0 : n.netSuite) == null ? void 0 : B.refNo]
828
+ } : null
829
+ ].filter((T) => T)
830
+ };
831
+ }
832
+ function o(n) {
833
+ var x, $;
834
+ const v = r.findIndex((D) => D.id === n.id);
835
+ return {
836
+ header: "Fulfillment",
837
+ date: De(new Date(n.createdAt)),
838
+ info: [
839
+ {
840
+ label: "Sequence",
841
+ values: [String(v + 1)]
842
+ },
843
+ {
844
+ label: "Receiveable items",
845
+ values: n.items.map((D) => {
846
+ var y;
847
+ return `(${D.sku.code}) ${D.sku.name}: ${le(D.amount, !1)} ${((y = D.measurement) == null ? void 0 : y.abbrev) ?? D.sku.unit.abbrev}`;
848
+ })
849
+ },
850
+ (x = n.netSuite) != null && x.refNo ? {
851
+ label: "Ref no. (Netsuite)",
852
+ values: [($ = n.netSuite) == null ? void 0 : $.refNo]
853
+ } : null
854
+ ].filter((D) => D)
855
+ };
856
+ }
857
+ return k.map((n) => {
858
+ switch (n.type) {
859
+ case "grn":
860
+ return t(n.doc);
861
+ case "fulfillment":
862
+ return o(n.doc);
863
+ }
864
+ });
865
+ });
866
+ return (a, r) => {
867
+ var x, $;
868
+ const k = X("FmButtonGroup"), t = X("FmChip"), o = X("FmMenuDivider"), g = X("FmCard"), _ = X("FmSpacer"), n = X("FmButton"), v = X("FmSideSheet");
869
+ return h(), z(v, {
870
+ header: l(i)("inventory.transfer.receiveRequest.details.title") + ((x = a.purchaseOrder) != null && x.seqNumber ? ` #${($ = a.purchaseOrder) == null ? void 0 : $.seqNumber}` : ""),
871
+ modelValue: l(re),
872
+ "onUpdate:modelValue": r[9] || (r[9] = (D) => Le(re) ? re.value = D : null),
873
+ "dismiss-away": j.value,
874
+ "close-button": "",
875
+ "max-width": 500
876
+ }, {
877
+ default: ie(() => {
878
+ var D;
879
+ return [
880
+ e("div", st, [
881
+ e("div", null, [
882
+ W(k, {
883
+ items: c,
884
+ modelValue: d.value,
885
+ "onUpdate:modelValue": r[0] || (r[0] = (y) => d.value = y)
886
+ }, null, 8, ["modelValue"])
887
+ ]),
888
+ d.value.value === "overview" ? (h(), A(ee, { key: 0 }, [
889
+ e("div", null, [
890
+ W(g, {
891
+ variant: "outlined",
892
+ class: "flex flex-col gap-8 px-12 py-16"
893
+ }, {
894
+ default: ie(() => {
895
+ var y, q, C, B, T, K, se, ae, ne, V, ge, _e, we, Re, Se, Oe;
896
+ return [
897
+ e("div", at, [
898
+ e("div", nt, b(l(i)("inventory.transfer.receiveRequest.details.requestSummary")), 1),
899
+ e("div", null, [
900
+ W(t, {
901
+ label: l(i)(`inventory.transfer.status.${(y = a.purchaseOrder) == null ? void 0 : y.status}`),
902
+ class: ue(`fm-status-badge fm-status-badge-${(C = (q = a.purchaseOrder) == null ? void 0 : q.status) == null ? void 0 : C.toLocaleLowerCase("en-us")}`),
903
+ compact: ""
904
+ }, null, 8, ["label", "class"])
905
+ ])
906
+ ]),
907
+ W(o),
908
+ e("div", ot, [
909
+ e("div", lt, [
910
+ e("div", ct, [
911
+ e("div", it, b(l(i)("inventory.transfer.receiveRequest.details.createdAt")), 1)
912
+ ]),
913
+ e("div", ut, b(l(pe)(((B = a.purchaseOrder) == null ? void 0 : B._id) ?? "")), 1)
914
+ ]),
915
+ (T = a.purchaseOrder) != null && T.effectiveAt ? (h(), A("div", dt, [
916
+ e("div", mt, b(l(i)("inventory.transfer.receiveRequest.details.backdatedTo")), 1),
917
+ e("div", ft, b(l(Pe)(new Date((K = a.purchaseOrder) == null ? void 0 : K.effectiveAt))), 1)
918
+ ])) : P("", !0),
919
+ e("div", pt, [
920
+ e("div", vt, b(l(i)("inventory.transfer.receiveRequest.details.type.title")), 1),
921
+ e("div", yt, b(l(i)(
922
+ `inventory.transfer.receiveRequest.details.type.${U.value.toLocaleLowerCase("en-US")}`
923
+ )), 1)
924
+ ]),
925
+ (ae = (se = a.purchaseOrder) == null ? void 0 : se.supplier) != null && ae.name ? (h(), A("div", ht, [
926
+ e("div", bt, b(l(i)("inventory.transfer.receiveRequest.details.from")), 1),
927
+ e("div", gt, b((V = (ne = a.purchaseOrder) == null ? void 0 : ne.supplier) == null ? void 0 : V.name), 1)
928
+ ])) : P("", !0),
929
+ a.transferTo ? (h(), A("div", _t, [
930
+ e("div", wt, b(l(i)("inventory.transfer.receiveRequest.details.to")), 1),
931
+ e("div", Rt, b(a.transferTo), 1)
932
+ ])) : P("", !0),
933
+ l(N).isEnabled ? (h(), A("div", St, [
934
+ r[10] || (r[10] = e("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " NetSuite Subsidiary ", -1)),
935
+ e("div", Ot, b(Z.value || "-"), 1)
936
+ ])) : P("", !0),
937
+ l(N).isEnabled ? (h(), A("div", Dt, [
938
+ r[11] || (r[11] = e("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " NetSuite Transfer Order ", -1)),
939
+ e("div", kt, b(((_e = (ge = a.purchaseOrder) == null ? void 0 : ge.netSuite) == null ? void 0 : _e.id) || ((Re = (we = a.poRequest) == null ? void 0 : we.netSuite) == null ? void 0 : Re.id) || "-"), 1)
940
+ ])) : P("", !0),
941
+ l(N).isEnabled ? (h(), A("div", At, [
942
+ r[12] || (r[12] = e("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " NetSuite Fulfilment IDs ", -1)),
943
+ e("div", xt, b(he.value), 1)
944
+ ])) : P("", !0),
945
+ (Se = a.purchaseOrder) != null && Se.ref ? (h(), A("div", qt, [
946
+ e("div", Pt, b(l(i)("inventory.transfer.receiveRequest.details.reference")), 1),
947
+ e("div", Nt, b(a.purchaseOrder.ref), 1)
948
+ ])) : P("", !0),
949
+ (Oe = a.purchaseOrder) != null && Oe.remark ? (h(), A("div", Ct, [
950
+ e("div", Tt, b(l(i)("inventory.transfer.receiveRequest.details.remark")), 1),
951
+ e("div", Et, b(a.purchaseOrder.remark), 1)
952
+ ])) : P("", !0)
953
+ ])
954
+ ];
955
+ }),
956
+ _: 1
957
+ })
958
+ ]),
959
+ e("div", $t, [
960
+ e("div", Ft, [
961
+ e("div", It, b(ye.value ? l(i)("inventory.transfer.receiveRequest.details.receivedItems") : l(i)("inventory.transfer.receiveRequest.details.requestedItems")), 1),
962
+ (h(!0), A(ee, null, de(((D = a.purchaseOrder) == null ? void 0 : D.items) ?? [], (y) => (h(), A("div", {
963
+ key: y.code,
964
+ class: "flex flex-col"
965
+ }, [
966
+ e("div", Mt, [
967
+ e("div", Ut, b(y.name), 1),
968
+ e("div", Lt, b(l(le)(Q.value[y.sku._id], !1)) + "/" + b(l(Ee)(y.quantity, y.sku.unit, y.measurement)), 1)
969
+ ]),
970
+ e("div", jt, [
971
+ e("div", Bt, b(y.code), 1),
972
+ y.totalCost && l(E).enableTotalCost ? (h(), A("div", Kt, " (" + b(l(Je)(y.totalCost)) + ") ", 1)) : P("", !0)
973
+ ])
974
+ ]))), 128))
975
+ ])
976
+ ])
977
+ ], 64)) : P("", !0),
978
+ d.value.value === "deliveryHistory" ? (h(), A("div", Vt, [
979
+ H.value.length ? (h(), A("div", Qt, [
980
+ (h(!0), A(ee, null, de(H.value, (y, q) => (h(), A(ee, { key: q }, [
981
+ e("div", Wt, [
982
+ e("div", Jt, [
983
+ e("div", Xt, [
984
+ e("div", {
985
+ class: ue([
986
+ {
987
+ "bg-fm-color-primary": q !== 0,
988
+ "bg-white": q === 0
989
+ },
990
+ "w-[2px] h-full"
991
+ ])
992
+ }, null, 2)
993
+ ]),
994
+ r[13] || (r[13] = e("div", { class: "h-24 w-24 bg-fm-color-primary rounded-full" }, null, -1)),
995
+ e("div", Zt, [
996
+ e("div", {
997
+ class: ue([
998
+ {
999
+ "bg-fm-color-primary": q < H.value.length - 1,
1000
+ "bg-white": q >= H.value.length - 1
1001
+ },
1002
+ "w-[2px] h-full"
1003
+ ])
1004
+ }, null, 2)
1005
+ ])
1006
+ ]),
1007
+ e("div", er, [
1008
+ e("div", tr, b(y.header), 1),
1009
+ e("div", rr, b(y.date), 1)
1010
+ ])
1011
+ ]),
1012
+ e("div", sr, [
1013
+ e("div", ar, [
1014
+ e("div", nr, [
1015
+ e("div", {
1016
+ class: ue([
1017
+ {
1018
+ "bg-fm-color-primary": q < H.value.length - 1,
1019
+ "bg-white": q >= H.value.length - 1
1020
+ },
1021
+ "w-[2px] h-full"
1022
+ ])
1023
+ }, null, 2)
1024
+ ])
1025
+ ]),
1026
+ e("div", or, [
1027
+ W(g, {
1028
+ variant: "outlined",
1029
+ class: "py-12 px-16"
1030
+ }, {
1031
+ default: ie(() => [
1032
+ e("div", lr, [
1033
+ (h(!0), A(ee, null, de(y.info, (C, B) => (h(), A("div", {
1034
+ key: B,
1035
+ class: "flex flex-col gap-4"
1036
+ }, [
1037
+ e("div", cr, b(C == null ? void 0 : C.label), 1),
1038
+ e("div", ir, [
1039
+ (h(!0), A(ee, null, de(C == null ? void 0 : C.values, (T, K) => (h(), A("div", {
1040
+ key: K,
1041
+ class: "fm-typo-en-body-lg-600"
1042
+ }, b(T), 1))), 128))
1043
+ ])
1044
+ ]))), 128))
1045
+ ])
1046
+ ]),
1047
+ _: 2
1048
+ }, 1024)
1049
+ ])
1050
+ ])
1051
+ ], 64))), 128))
1052
+ ])) : (h(), A("div", Gt, [
1053
+ W(_),
1054
+ e("div", null, [
1055
+ e("img", {
1056
+ src: l(Ze),
1057
+ alt: "List is empty"
1058
+ }, null, 8, Ht)
1059
+ ]),
1060
+ e("div", zt, b(l(i)("inventory.transfer.receiveRequest.details.noRecordsFound")), 1),
1061
+ e("div", Yt, b(l(i)("inventory.transfer.receiveRequest.details.trackDeliveryMessage")), 1),
1062
+ W(_),
1063
+ W(_)
1064
+ ]))
1065
+ ])) : P("", !0)
1066
+ ])
1067
+ ];
1068
+ }),
1069
+ "side-sheet-footer": ie(() => {
1070
+ var D, y, q, C, B, T, K, se, ae, ne;
1071
+ return [
1072
+ e("div", ur, [
1073
+ ((D = a.purchaseOrder) == null ? void 0 : D.status) === l(M).enum.DRAFT && U.value === l(me).PURCHASE ? (h(), z(n, {
1074
+ key: 0,
1075
+ label: l(i)("inventory.transfer.receiveRequest.actions.confirmDraft"),
1076
+ onClick: r[1] || (r[1] = (V) => G("confirmDraft")),
1077
+ loading: f.value === "confirmDraft",
1078
+ disabled: f.value !== "confirmDraft" && m.value
1079
+ }, null, 8, ["label", "loading", "disabled"])) : P("", !0),
1080
+ ((y = a.purchaseOrder) == null ? void 0 : y.status) === l(M).enum.DRAFT && U.value === l(me).TRANSFER ? (h(), z(n, {
1081
+ key: 1,
1082
+ label: l(i)("inventory.transfer.receiveRequest.actions.submitRequest"),
1083
+ onClick: r[2] || (r[2] = (V) => G("submitRequest")),
1084
+ loading: f.value === "submitRequest",
1085
+ disabled: f.value !== "submitRequest" && m.value
1086
+ }, null, 8, ["label", "loading", "disabled"])) : P("", !0),
1087
+ ((q = a.purchaseOrder) == null ? void 0 : q.status) === l(M).enum.DRAFT ? (h(), z(n, {
1088
+ key: 2,
1089
+ label: l(i)("inventory.transfer.receiveRequest.actions.cancelDraft"),
1090
+ onClick: r[3] || (r[3] = (V) => G("cancelDraft")),
1091
+ loading: f.value === "cancelDraft",
1092
+ disabled: f.value !== "cancelDraft" && m.value,
1093
+ variant: "destructive"
1094
+ }, null, 8, ["label", "loading", "disabled"])) : P("", !0),
1095
+ ((C = a.purchaseOrder) == null ? void 0 : C.status) === l(M).enum.RECEIVING ? (h(), z(n, {
1096
+ key: 3,
1097
+ label: l(i)("inventory.transfer.receiveRequest.actions.completeReceive"),
1098
+ onClick: r[4] || (r[4] = (V) => G("completeReceive")),
1099
+ loading: f.value === "completeReceive",
1100
+ disabled: f.value !== "completeReceive" && m.value
1101
+ }, null, 8, ["label", "loading", "disabled"])) : P("", !0),
1102
+ a.canResubmit ? (h(), z(n, {
1103
+ key: 4,
1104
+ label: l(i)("inventory.transfer.receiveRequest.actions.resubmitRequest"),
1105
+ onClick: r[5] || (r[5] = (V) => G("submitRequest")),
1106
+ loading: f.value === "submitRequest",
1107
+ disabled: f.value !== "submitRequest" && m.value
1108
+ }, null, 8, ["label", "loading", "disabled"])) : P("", !0),
1109
+ (((B = a.purchaseOrder) == null ? void 0 : B.status) === l(M).enum.REQUESTING || ((T = a.purchaseOrder) == null ? void 0 : T.status) === l(M).enum.PROCESSING) && a.canApprove ? (h(), z(n, {
1110
+ key: 5,
1111
+ label: l(i)("inventory.transfer.approval.actions.approveRequest"),
1112
+ onClick: r[6] || (r[6] = (V) => G("approveRequest")),
1113
+ loading: f.value === "approveRequest",
1114
+ disabled: f.value !== "approveRequest" && m.value
1115
+ }, null, 8, ["label", "loading", "disabled"])) : P("", !0),
1116
+ ((K = a.purchaseOrder) == null ? void 0 : K.status) === l(M).enum.REQUESTING && a.canApprove ? (h(), z(n, {
1117
+ key: 6,
1118
+ label: l(i)("inventory.transfer.approval.actions.rejectRequest"),
1119
+ onClick: r[7] || (r[7] = (V) => G("rejectRequest")),
1120
+ loading: f.value === "rejectRequest",
1121
+ disabled: f.value !== "rejectRequest" && m.value,
1122
+ variant: "destructive"
1123
+ }, null, 8, ["label", "loading", "disabled"])) : P("", !0),
1124
+ ((se = a.purchaseOrder) == null ? void 0 : se.status) !== l(M).enum.COMPLETE && ((ae = a.purchaseOrder) == null ? void 0 : ae.status) !== l(M).enum.CANCEL && (((ne = a.purchaseOrder) == null ? void 0 : ne.status) !== l(M).enum.REQUESTING || a.canApprove) ? (h(), z(n, {
1125
+ key: 7,
1126
+ label: l(i)("common.close"),
1127
+ variant: "tertiary",
1128
+ onClick: r[8] || (r[8] = (V) => s("update:show", !1))
1129
+ }, null, 8, ["label"])) : P("", !0)
1130
+ ])
1131
+ ];
1132
+ }),
1133
+ _: 1
1134
+ }, 8, ["header", "modelValue", "dismiss-away"]);
1135
+ };
1136
+ }
1137
+ });
1138
+ export {
1139
+ xr as _,
1140
+ kr as a,
1141
+ Ar as b,
1142
+ tt as g,
1143
+ Ie as u
1144
+ };