@feedmepos/mf-inventory-portal 0.0.25-dev.5 → 0.0.25-dev.50

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 (117) hide show
  1. package/dist/{App-Kq8apMtA.js → App-B7fIlPKw.js} +29 -28
  2. package/dist/ApprovalView-Dp20w8em.js +143 -0
  3. package/dist/{BindingsDialog-DOXckftj.js → BindingsDialog-BIHCuoDe.js} +6 -6
  4. package/dist/{BindingsPicker-Cm5vh_SU.js → BindingsPicker-DoM1Dh1y.js} +8 -8
  5. package/dist/{BindingsTable-CqIY16hU.js → BindingsTable-ChJYIxrf.js} +6 -6
  6. package/dist/ClosingDraftView-L4EHR0Sb.js +1348 -0
  7. package/dist/ClosingTemplateView-CFVINyCr.js +1859 -0
  8. package/dist/FmCustomAttribute.vue_vue_type_script_setup_true_lang-D-IWRjRD.js +34 -0
  9. package/dist/FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-Dn-DgO81.js +211 -0
  10. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-0Kw57u62.js → FmUnitInput.vue_vue_type_script_setup_true_lang-CdWkJ2U-.js} +52 -52
  11. package/dist/IngredientBindedItem.vue_vue_type_script_setup_true_lang-BN2ec0EU.js +51 -0
  12. package/dist/{IngredientGroupView-CLmsjrp8.js → IngredientGroupView-Vz6XV_-q.js} +14 -14
  13. package/dist/{IngredientsView-T5S1322D.js → IngredientsView-D1lmg_97.js} +577 -551
  14. package/dist/{IntegrationView-DLLrgrr9.js → IntegrationView-CfDmLYwt.js} +661 -690
  15. package/dist/{InventoryBindingForm-BCPZcNwR.js → InventoryBindingForm-C68ZfWme.js} +1 -1
  16. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-DY96hhyi.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-Bd13FqsE.js} +96 -96
  17. package/dist/{InventoryBindingSummary-CpCsz_Xc.js → InventoryBindingSummary-DT9cg2b4.js} +1 -1
  18. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-CP5yNARW.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-BfhvXVHK.js} +1 -1
  19. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-Cow0sp-k.js → PremiumBadge.vue_vue_type_script_setup_true_lang-Dvj1F-DM.js} +15 -15
  20. package/dist/PublishView-DMzULnCX.js +222 -0
  21. package/dist/{PurchaseOrderPrintPreview-DQ8GaxvA.js → PurchaseOrderPrintPreview-D6wcth8H.js} +1 -1
  22. package/dist/ReceiveRequestView-DsX41zj-.js +2579 -0
  23. package/dist/{RecipeView-CROffYxl.js → RecipeView-DlKk9-tm.js} +47 -46
  24. package/dist/{index-B2ISFLHY.js → StockView-CNmvVK0V.js} +3616 -1783
  25. package/dist/{SupplierView-DUFTtK7r.js → SupplierView-BcoOgM67.js} +446 -457
  26. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-CDDvq_mI.js +1605 -0
  27. package/dist/TransferTemplateView-BI96LQfP.js +1526 -0
  28. package/dist/{UnitView-B4jcaZF4.js → UnitView-BF2eBWtF.js} +14 -14
  29. package/dist/{WarehouseView-BmZtdMZU.js → WarehouseView-joOR4EsJ.js} +332 -314
  30. package/dist/api/closing-draft.d.ts +1 -0
  31. package/dist/api/inventory.d.ts +9 -6
  32. package/dist/api/netsuite.d.ts +22 -5
  33. package/dist/api/purchase-order.d.ts +7 -1
  34. package/dist/api/stock.d.ts +1 -0
  35. package/dist/app-DavuMSpS.js +88117 -0
  36. package/dist/app.js +1 -1
  37. package/dist/components/FmAutocompleteTextField.vue.d.ts +31 -0
  38. package/dist/components/FmCustomAttribute.vue.d.ts +3 -8
  39. package/dist/components/FmLockableField.vue.d.ts +3 -0
  40. package/dist/components/FmMultiselectDialog.d.ts +23 -0
  41. package/dist/components/FmMultiselectDialog.vue.d.ts +9 -1
  42. package/dist/components/FmMultiselectDialogProps.d.ts +2 -0
  43. package/dist/components/inventory-binding/InventoryBinding.vue.d.ts +1 -1
  44. package/dist/components/shell/inventory/binding-ui.vue.d.ts +1 -1
  45. package/dist/{decimal-T4Ng3pLP.js → decimal-C_LJTg2_.js} +1 -1
  46. package/dist/feature-D3M-bziy.js +1015 -0
  47. package/dist/{format-unit-display-D6tf1DHa.js → format-unit-display-BebmN2s-.js} +335 -328
  48. package/dist/helper/country.d.ts +1 -0
  49. package/dist/helper/fuzzy.d.ts +10 -0
  50. package/dist/index-BDEeA1dY.js +12197 -0
  51. package/dist/index-DzshvJTA.js +77 -0
  52. package/dist/{stock-CmZXXh6b.js → stock-CHVVTrSI.js} +29 -25
  53. package/dist/stores/feature.d.ts +7 -5
  54. package/dist/stores/helper/generate-backend-urls.d.ts +0 -1
  55. package/dist/stores/integration/index.d.ts +1 -0
  56. package/dist/stores/integration/netsuite.d.ts +22 -5
  57. package/dist/stores/inventory.d.ts +141 -8
  58. package/dist/stores/location.d.ts +9 -0
  59. package/dist/stores/stock.d.ts +5 -0
  60. package/dist/stores/warehouse.d.ts +5 -7
  61. package/dist/style.css +1 -1
  62. package/dist/{supplier-BVsAD8Ou.js → supplier-Ddl4sUpm.js} +1 -1
  63. package/dist/tsconfig.app.tsbuildinfo +1 -1
  64. package/dist/use-ingredient-select-dialog-Z6bbIKfM.js +51 -0
  65. package/dist/{use-inventory-binding-dialog-CqrrqmB7.js → use-inventory-binding-dialog-Dj45RBWc.js} +1 -1
  66. package/dist/views/adjustment-template/wastage-template/actions.d.ts +24 -0
  67. package/dist/views/adjustment-template/wastage-template/table.d.ts +24 -0
  68. package/dist/views/closing-draft/components/closing-draft-dialog/ClosingDraftDialog.vue.d.ts +8 -4
  69. package/dist/views/closing-draft/composables/use-closing-draft-actions.d.ts +4 -1
  70. package/dist/views/closing-draft/composables/use-closing-draft-table.d.ts +48 -24
  71. package/dist/views/closing-draft/helpers/export-draft.helper.d.ts +1 -1
  72. package/dist/views/closing-template/components/closing-template-form/composables/use-closing-template-items.d.ts +1 -1
  73. package/dist/views/closing-template/composables/use-closing-template-actions.d.ts +36 -12
  74. package/dist/views/closing-template/composables/use-closing-template-table.d.ts +36 -12
  75. package/dist/views/dev/components/AutocompleteTextField.vue.d.ts +2 -0
  76. package/dist/views/ingredient-group/composables/use-ingredient-group-table.d.ts +3 -3
  77. package/dist/views/ingredients/components/ingredient-form/IngredientForm.vue.d.ts +2 -2
  78. package/dist/views/ingredients/composables/use-ingredient-select-dialog.d.ts +16 -0
  79. package/dist/views/ingredients/composables/use-ingredient-table.d.ts +1 -1
  80. package/dist/views/receive-request/components/netsuite/NetSuiteProps.d.ts +2 -0
  81. package/dist/views/receive-request/components/transfer-details/TransferDetailsProps.d.ts +4 -1
  82. package/dist/views/receive-request/components/transfer-form/TransferForm.vue.d.ts +427 -31
  83. package/dist/views/receive-request/components/transfer-form/components/ForecastStock.vue.d.ts +8 -4
  84. package/dist/views/receive-request/components/transfer-form/components/TransferItemTable.vue.d.ts +382 -2
  85. package/dist/views/receive-request/components/transfer-form/composables/use-transfer-items.d.ts +7 -4
  86. package/dist/views/receive-request/composables/use-process-purchase-order.d.ts +18 -0
  87. package/dist/views/receive-request/composables/use-receive-request-form.d.ts +867 -68
  88. package/dist/views/receive-request/composables/use-receive-request-table.d.ts +678 -70
  89. package/dist/views/receive-request/import/XilnexImportDialog.vue.d.ts +22 -0
  90. package/dist/views/receive-request/import/XilnexImportForm.vue.d.ts +17 -0
  91. package/dist/views/receive-request/import/XilnexResult.vue.d.ts +17 -0
  92. package/dist/views/receive-request/import/export.d.ts +12 -0
  93. package/dist/views/receive-request/import/props.d.ts +7 -0
  94. package/dist/views/stock/components/dialog/AdjustedItemForm.vue.d.ts +4 -2
  95. package/dist/views/transfer-template/components/transfer-template-form/components/TransferTemplateItemTable.vue.d.ts +220 -0
  96. package/dist/views/transfer-template/components/transfer-template-form/composables/use-template-enabled-locations-2.d.ts +8 -0
  97. package/dist/views/transfer-template/components/transfer-template-form/composables/use-template-enabled-locations.d.ts +1 -0
  98. package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-template-items.d.ts +10 -5
  99. package/dist/views/transfer-template/composables/use-transfer-template-actions.d.ts +72 -24
  100. package/dist/views/transfer-template/composables/use-transfer-template-table.d.ts +72 -24
  101. package/dist/views/transfer-template/composables/useTransferTemplateHelper.d.ts +305 -0
  102. package/dist/views/warehouse/components/WarehouseForm.vue.d.ts +10 -14
  103. package/dist/{vue-i18n-Mb3AM8uP.js → vue-i18n-Cak3W4nS.js} +331 -331
  104. package/package.json +4 -4
  105. package/dist/ApprovalView-DXlXet32.js +0 -138
  106. package/dist/ClosingDraftView-CABY9YVF.js +0 -1225
  107. package/dist/ClosingTemplateView-Bsd6W6id.js +0 -1819
  108. package/dist/FmCustomAttribute.vue_vue_type_script_setup_true_lang-d-Qy7I_I.js +0 -142
  109. package/dist/FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-CXjO-PL0.js +0 -286
  110. package/dist/PublishView-BQ9pqu-S.js +0 -192
  111. package/dist/ReceiveRequestView-Cj1g6ZzI.js +0 -1876
  112. package/dist/StockView-D_XXAmSl.js +0 -1817
  113. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-BLADqDM9.js +0 -1327
  114. package/dist/TransferTemplateView-Dy2nZRCc.js +0 -1284
  115. package/dist/app-DcBKHZIR.js +0 -85643
  116. package/dist/components/FmCustomAttribute2.vue.d.ts +0 -18
  117. package/dist/index-Cxi2NbBg.js +0 -29202
@@ -0,0 +1,1605 @@
1
+ import { W as We, u as Oe, aL as N, a5 as Ye, a7 as Xe, a8 as Je, aM as Ze, d as Fe, e as Me, au as F, T as je, aN as et, Y as Re, K as ge, i as pe, aO as Ve, ac as _e, f as Ue, D as z, h as j, b as Ke, a6 as tt, ar as Le, a0 as he, ai as Be } from "./app-DavuMSpS.js";
2
+ import { ref as H, computed as Q, h as x, defineComponent as Ne, onMounted as rt, unref as i, openBlock as y, createElementBlock as S, createElementVNode as t, toDisplayString as _, createCommentVNode as P, resolveComponent as ae, createVNode as V, watch as st, createBlock as te, isRef as at, withCtx as me, Fragment as ce, normalizeClass as be, createTextVNode as Se, renderList as ve, resolveDynamicComponent as nt } from "vue";
3
+ import { F as ot } from "./decimal-C_LJTg2_.js";
4
+ import { b as lt, u as ct, f as Ge, P as de } from "./format-unit-display-BebmN2s-.js";
5
+ import { useI18n as He } from "@feedmepos/mf-common";
6
+ import { E as it } from "./empty-placeholder-wf6-BWE8.js";
7
+ import { useDialog as De, useSnackbar as Ae, useProxiedModel as ut } from "@feedmepos/ui-library";
8
+ import { u as ke } from "./feature-D3M-bziy.js";
9
+ import { u as dt } from "./index-DzshvJTA.js";
10
+ const Te = We((f, m) => {
11
+ const s = Oe();
12
+ return {
13
+ async readRequests(l) {
14
+ const h = l ?? s.currentLocationDBName, g = `${f.inventoryBackendUrl}/${h}/purchase-request`;
15
+ return await m.get(g);
16
+ },
17
+ async getPurchaseOrders({
18
+ start: l,
19
+ end: h
20
+ }) {
21
+ const g = s.currentLocationDBName, k = `${f.inventoryBackendUrl}/${g}/purchase-order`;
22
+ return await m.get(`${k}?start=${l}&end=${h}`);
23
+ },
24
+ async getLatestPurchaseOrderRequest(l) {
25
+ const h = s.currentLocationDBName, g = `${f.inventoryBackendUrl}/${h}/purchase-request/find-by-purchase-order-id`;
26
+ return await m.get(`${g}/${l}`);
27
+ },
28
+ async getPurchaseOrderById(l) {
29
+ const h = s.currentLocationDBName, g = `${f.inventoryBackendUrl}/${h}/purchase-order`;
30
+ return await m.get(`${g}/${l}`);
31
+ },
32
+ async processPurchaseOrder(l, h) {
33
+ const g = `${s.currentLocation.dbName} ${s.currentLocation.name}`;
34
+ console.log(`${g}: using legacy operate v1`);
35
+ const k = s.currentLocationDBName, w = h || k, e = `${f.inventoryBackendUrl}/${w}/purchase-order/run-operation`;
36
+ return await m.put(e, l);
37
+ },
38
+ async processPurchaseOrderV2(l, h) {
39
+ const g = `${s.currentLocation.dbName} ${s.currentLocation.name}`;
40
+ console.log(`${g}: using new operate v2`);
41
+ const k = s.currentLocationDBName, w = h || k, e = `${f.inventoryBackendUrl}/${w}/purchase-order/run-operation/v2`;
42
+ return await m.put(e, l);
43
+ },
44
+ async createPurchaseOrder(l) {
45
+ const h = s.currentLocationDBName, g = `${f.inventoryBackendUrl}/${h}/purchase-order`;
46
+ return await m.post(g, l);
47
+ },
48
+ async updatePurchaseOrder(l) {
49
+ const h = s.currentLocationDBName, g = `${f.inventoryBackendUrl}/${h}/purchase-order`;
50
+ return await m.put(g, l);
51
+ },
52
+ async importFromXilnex(l) {
53
+ const h = s.currentLocationDBName, g = `${f.inventoryBackendUrl}/${h}/purchase-order/import-from-xilnex`;
54
+ return await m.post(g, l);
55
+ }
56
+ };
57
+ }), ze = {
58
+ [N.enum.confirmDraft]: {
59
+ primaryActions: {
60
+ text: "Confirm draft",
61
+ close: !0
62
+ },
63
+ title: "Confirm draft?",
64
+ message: "Purchase order cannot be changed after confirm draft.",
65
+ successMessage: "Purchase order draft has been confirmed"
66
+ },
67
+ [N.enum.cancelDraft]: {
68
+ primaryActions: {
69
+ text: "Cancel draft",
70
+ close: !0,
71
+ variant: "destructive"
72
+ },
73
+ title: "Cancel draft?",
74
+ message: "Purchase order cannot be changed after cancelled draft.",
75
+ successMessage: "Purchase order draft has been cancelled"
76
+ },
77
+ [N.enum.submitRequest]: {
78
+ primaryActions: {
79
+ text: "Submit request",
80
+ close: !0
81
+ },
82
+ title: "Confirm draft?",
83
+ message: "Purchase order cannot be changed after confirm draft.",
84
+ successMessage: "Purchase order draft has been submitted"
85
+ },
86
+ [N.enum.completeReceive]: {
87
+ primaryActions: {
88
+ text: "Mark received",
89
+ close: !0
90
+ },
91
+ title: "Mark as received",
92
+ message: "Purchase order cannot be changed after it has complete receiving.",
93
+ successMessage: "Purchase order has been marked as received"
94
+ },
95
+ [N.enum.approveRequest]: {
96
+ primaryActions: {
97
+ text: "Approve request",
98
+ close: !0
99
+ },
100
+ title: "Approve request?",
101
+ message: "Purchase order will be approved.",
102
+ successMessage: "Purchase order has been approved"
103
+ },
104
+ [N.enum.rejectRequest]: {
105
+ primaryActions: {
106
+ text: "Reject request",
107
+ close: !0,
108
+ variant: "destructive"
109
+ },
110
+ title: "Reject request?",
111
+ message: "Purchase order will be rejected.",
112
+ successMessage: "Purchase order has been rejected"
113
+ }
114
+ }, Qe = () => {
115
+ const f = ke(), m = Te();
116
+ return (s) => f.enablePoOperateV2 ? m.processPurchaseOrderV2(
117
+ {
118
+ operation: s.operation,
119
+ purchaseOrderId: s.purchaseOrder._id,
120
+ purchaseOrderRev: s.purchaseOrder._rev,
121
+ payload: Object.values(s.payloadV2).find((l) => l)
122
+ },
123
+ s.dbName
124
+ ) : m.processPurchaseOrder(
125
+ {
126
+ operation: s.operation,
127
+ ...s.payloadV1
128
+ },
129
+ s.dbName
130
+ );
131
+ };
132
+ var xe = /* @__PURE__ */ ((f) => (f.RECEIVE_REQUEST = "receive/request", f.APPROVAL = "approval", f))(xe || {});
133
+ const ye = H(), we = H();
134
+ function Jr(f, m) {
135
+ const s = De(), l = Oe(), h = ke(), g = lt(), k = ct(), w = H(!1), e = Ae(), a = Te(), v = H(new Array()), n = H(
136
+ m != null && m.startDate && (m != null && m.endDate) ? m : Ye()
137
+ ), c = Qe(), R = Q(() => {
138
+ const p = new Date(n.value.startDate), d = new Date(n.value.endDate);
139
+ return {
140
+ start: Xe(p).toISOString(),
141
+ end: Je(d).toISOString()
142
+ };
143
+ }), q = H(new Array()), U = Ze(), I = H(null);
144
+ async function W(p) {
145
+ function d(b) {
146
+ const O = {
147
+ mode: Fe.CREATE,
148
+ modelValue: p || void 0,
149
+ show: !0,
150
+ "onUpdate:show"($) {
151
+ ye.value.show = $;
152
+ },
153
+ templateId: b,
154
+ lastClosingDate: I.value
155
+ };
156
+ ye.value = O;
157
+ }
158
+ let u;
159
+ h.mustUsePoTemplate && !(p != null && p.template) ? s.open({
160
+ title: "Create transfer",
161
+ message: "",
162
+ primaryActions: {
163
+ text: "Select a template",
164
+ close: !0
165
+ },
166
+ secondaryActions: {
167
+ text: "Outlet to Outlet",
168
+ variant: "secondary",
169
+ close: !0
170
+ }
171
+ }).onPrimary(async () => {
172
+ u = await g.getTemplateId(), u && d(u);
173
+ }).onSecondary(() => {
174
+ d(void 0);
175
+ }) : d(u);
176
+ }
177
+ function Y(p) {
178
+ const d = {
179
+ mode: Fe.UPDATE,
180
+ modelValue: Me(p),
181
+ show: !0,
182
+ "onUpdate:show"(u) {
183
+ ye.value.show = u;
184
+ },
185
+ lastClosingDate: I.value
186
+ };
187
+ ye.value = d;
188
+ }
189
+ async function L() {
190
+ v.value = [], w.value = !0;
191
+ try {
192
+ v.value = await a.getPurchaseOrders(R.value).then((u) => u.sort((b, O) => O._id.localeCompare(b._id)));
193
+ const p = await U.readLastClosing(!0), d = p == null ? void 0 : p._id;
194
+ d && (I.value = et(d)), h.mustUsePoTemplate && await k.fetchTemplates();
195
+ } catch {
196
+ e.open({
197
+ title: "Something went wrong",
198
+ message: "Error at fetching purchase orders",
199
+ type: "error"
200
+ });
201
+ } finally {
202
+ w.value = !1;
203
+ }
204
+ }
205
+ async function ne() {
206
+ q.value = [], w.value = !0;
207
+ try {
208
+ q.value = await a.readRequests().then((p) => p.reverse());
209
+ } catch {
210
+ e.open({
211
+ title: "Something went wrong",
212
+ message: "Error at fetching purchase requests",
213
+ type: "error"
214
+ });
215
+ } finally {
216
+ w.value = !1;
217
+ }
218
+ }
219
+ function Z() {
220
+ switch (f) {
221
+ case "receive/request":
222
+ return L();
223
+ case "approval":
224
+ return ne();
225
+ }
226
+ }
227
+ function ee(p, d) {
228
+ n.value = {
229
+ startDate: p,
230
+ endDate: d
231
+ }, Z();
232
+ }
233
+ l.watchLocation(async (p) => {
234
+ if (!p) {
235
+ v.value = [];
236
+ return;
237
+ }
238
+ await Z();
239
+ });
240
+ const X = H(), r = H(Math.random().toString());
241
+ async function o(p, d) {
242
+ var $, D;
243
+ const u = Math.random().toString();
244
+ r.value = u;
245
+ const b = f === "receive/request" ? l.currentLocation : d == null ? void 0 : d.to, O = {
246
+ poRequest: d,
247
+ purchaseOrder: p,
248
+ transferTo: b == null ? void 0 : b.name,
249
+ transferToDbName: b == null ? void 0 : b.dbName,
250
+ show: !0,
251
+ canResubmit: !1,
252
+ canApprove: f === "approval",
253
+ "onUpdate:show"(K) {
254
+ X.value.show = K;
255
+ },
256
+ scope: f
257
+ };
258
+ if (X.value = O, !(d || p.status !== F.enum.REQUESTING)) {
259
+ try {
260
+ d = (await a.readRequests(
261
+ `${p.supplier.internal}_${p.supplier._id}`
262
+ )).find((G) => G.purchaseOrderId === p._id);
263
+ } catch {
264
+ console.error("Error at fetching po request to check");
265
+ }
266
+ u === r.value && d && (X.value.canResubmit = !d, X.value.transferTo = ($ = d == null ? void 0 : d.to) == null ? void 0 : $.name, X.value.transferToDbName = (D = d == null ? void 0 : d.to) == null ? void 0 : D.dbName);
267
+ }
268
+ }
269
+ async function E(p, d, u, b) {
270
+ w.value = !0;
271
+ try {
272
+ await c({
273
+ operation: d,
274
+ purchaseOrder: p,
275
+ payloadV2: {
276
+ confirmDraft: d === "confirmDraft" ? {
277
+ warehouseAutoReceive: h.autoReceiveWarehouse
278
+ } : void 0,
279
+ completeReceive: d === "completeReceive" ? {
280
+ warehouseAutoReceive: h.autoReceiveWarehouse
281
+ } : void 0,
282
+ submitRequest: d === "submitRequest" ? {
283
+ requestId: ""
284
+ // will be populated in backend
285
+ } : void 0
286
+ },
287
+ payloadV1: {
288
+ doc: p,
289
+ options: (
290
+ // auto receive for supplier to warehouse
291
+ (d === N.enum.confirmDraft || // auto receive for warehouse to warehouse
292
+ d === N.enum.completeReceive) && h.autoReceiveWarehouse ? {
293
+ autoReceive: !0
294
+ } : void 0
295
+ )
296
+ },
297
+ dbName: b
298
+ }), await new Promise((D) => setTimeout(D, 1e3));
299
+ const $ = Oe().currentLocationDBName.startsWith("restaurant_");
300
+ d === N.enum.confirmDraft && p.effectiveAt && $ ? e.open({
301
+ title: "Success",
302
+ message: `${u}. The backdate will be reflected once your POS has received this change.`,
303
+ type: "success"
304
+ }) : e.open({
305
+ title: "Success",
306
+ message: u,
307
+ type: "success"
308
+ });
309
+ } catch (O) {
310
+ e.open({
311
+ title: "Something went wrong",
312
+ message: "Please try again.",
313
+ type: "error"
314
+ }), console.error("Error when submitting PO operation", d, p, O);
315
+ } finally {
316
+ w.value = !1, Z();
317
+ }
318
+ }
319
+ async function T(p, d, u) {
320
+ const b = ze[d];
321
+ if (!b) {
322
+ e.open({
323
+ title: "Something went wrong",
324
+ message: `Cannot process order: ${je(d)}`,
325
+ type: "error"
326
+ });
327
+ return;
328
+ }
329
+ const { successMessage: O, ...$ } = b;
330
+ s.open({
331
+ title: $.title,
332
+ message: $.message,
333
+ primaryActions: $.primaryActions
334
+ }).onPrimary(() => {
335
+ E(p, d, O, u);
336
+ });
337
+ }
338
+ async function re() {
339
+ s.open({
340
+ title: "Upload Transfer",
341
+ primaryActions: {
342
+ text: "Xilnex transfer note",
343
+ close: !0
344
+ },
345
+ secondaryActions: {
346
+ text: "Cancel",
347
+ close: !0
348
+ }
349
+ }).onPrimary(() => {
350
+ const p = {
351
+ show: !0,
352
+ "onUpdate:show"(d) {
353
+ we.value.show = d;
354
+ }
355
+ };
356
+ we.value = p;
357
+ });
358
+ }
359
+ return {
360
+ purchaseOrders: v,
361
+ purchaseRequests: q,
362
+ updateDateRange: ee,
363
+ fetchData: Z,
364
+ loading: w,
365
+ transferDialogProps: ye,
366
+ promptCreateTransferDialog: W,
367
+ promptUpdateTransferDialog: Y,
368
+ transferDetailsProps: X,
369
+ promptShowTransferDetails: o,
370
+ submitAction: T,
371
+ xilnexImportDialogProps: we,
372
+ promptUploadTransferDialog: re
373
+ };
374
+ }
375
+ function mt(f, m) {
376
+ return m.reduce(
377
+ (l, h) => {
378
+ const g = h.received.find((k) => k.sku._id === f._id);
379
+ return g && (l = Re(l, g.amount)), l;
380
+ },
381
+ ot.toPrecision(ge(0), f.unit.precision)
382
+ );
383
+ }
384
+ function ft(f, m) {
385
+ const { name: s, address: l, regNo: h } = m.doc.profile, g = {
386
+ name: s,
387
+ registrationNumber: h,
388
+ line1: l == null ? void 0 : l.line1,
389
+ line2: l == null ? void 0 : l.line2,
390
+ postcode: l == null ? void 0 : l.postcode,
391
+ city: l == null ? void 0 : l.city,
392
+ state: l == null ? void 0 : l.state,
393
+ country: l == null ? void 0 : l.country
394
+ }, k = {
395
+ name: f.supplier.name,
396
+ registrationNumber: f.supplier.registrationNumber,
397
+ line1: f.supplier.address.line1,
398
+ line2: f.supplier.address.line2,
399
+ postcode: f.supplier.address.postcode,
400
+ city: f.supplier.address.city,
401
+ state: f.supplier.address.state,
402
+ country: f.supplier.address.country
403
+ }, w = f.items.map((n) => {
404
+ const { sku: c, measurement: R } = n, q = pe(
405
+ mt(n.sku, f.deliveryOrder || []),
406
+ !1
407
+ );
408
+ return {
409
+ code: c.code,
410
+ description: c.name,
411
+ quantity: Ge(n.quantity, c.unit, n.measurement),
412
+ unit: (R == null ? void 0 : R.abbrev) || c.unit.abbrev,
413
+ received: q
414
+ };
415
+ }), e = f.deliveryOrder.map((n) => ({
416
+ createdAt: Ve(new Date(n.createdAt)),
417
+ ref: n.deliveryOrderNumber,
418
+ remark: n.remark || "",
419
+ items: n.received.map((c) => {
420
+ var R;
421
+ return {
422
+ code: c.sku.code,
423
+ description: c.sku.name,
424
+ quantity: pe(c.amount),
425
+ unit: ((R = c.measurement) == null ? void 0 : R.abbrev) || c.sku.unit.abbrev
426
+ };
427
+ })
428
+ })), a = {
429
+ orderNumber: f.seqNumber.toString(),
430
+ createdAt: _e(f._id),
431
+ ref: f.ref || "",
432
+ remark: f.remark || "",
433
+ buyer: g,
434
+ supplier: k,
435
+ items: w,
436
+ status: f.status,
437
+ deliveryOrders: e
438
+ }, v = new URL(window.location.href);
439
+ v.pathname = v.hostname.includes("inventory.feedme") ? "/receive-request/print-preview" : "/inventory/receive-request/print-preview", v.searchParams.append("data", JSON.stringify(a)), window.open(v.href, "_blank", "noreferrer");
440
+ }
441
+ const fe = {
442
+ submitRequest: {
443
+ translationKey: "inventory.transfer.receiveRequest.actions.submitRequest",
444
+ color: "text-fm-color-typo-primary",
445
+ value: N.enum.submitRequest
446
+ },
447
+ confirmDraft: {
448
+ translationKey: "inventory.transfer.receiveRequest.actions.confirmDraft",
449
+ color: "text-fm-color-typo-primary",
450
+ value: N.enum.confirmDraft
451
+ },
452
+ cancelDraft: {
453
+ translationKey: "inventory.transfer.receiveRequest.actions.cancelDraft",
454
+ color: "text-fm-color-typo-error",
455
+ value: N.enum.cancelDraft
456
+ },
457
+ approveRequest: {
458
+ translationKey: "inventory.transfer.receiveRequest.actions.approveRequest",
459
+ color: "text-fm-color-typo-primary",
460
+ value: N.enum.approveRequest
461
+ },
462
+ rejectRequest: {
463
+ translationKey: "inventory.transfer.receiveRequest.actions.rejectRequest",
464
+ color: "text-fm-color-typo-error",
465
+ value: N.enum.rejectRequest
466
+ },
467
+ processRequest: {
468
+ translationKey: "inventory.transfer.receiveRequest.actions.processRequest",
469
+ color: "text-fm-color-typo-primary",
470
+ value: N.enum.processRequest
471
+ },
472
+ receiveStock: {
473
+ translationKey: "inventory.transfer.receiveRequest.actions.receiveStock",
474
+ color: "text-fm-color-typo-primary",
475
+ value: N.enum.receiveStock
476
+ },
477
+ completeReceive: {
478
+ translationKey: "inventory.transfer.receiveRequest.actions.completeReceive",
479
+ color: "text-fm-color-typo-primary",
480
+ value: N.enum.completeReceive
481
+ }
482
+ };
483
+ function Zr(f, m) {
484
+ const { t: s } = He();
485
+ function l(a) {
486
+ switch (a.status) {
487
+ case "DRAFT":
488
+ return [
489
+ z[j.Update],
490
+ z[j.Details],
491
+ a.supplier.internal === "restaurant" || a.supplier.internal === "warehouse" ? fe[N.enum.submitRequest] : fe[N.enum.confirmDraft],
492
+ fe[N.enum.cancelDraft],
493
+ z[j.Print]
494
+ ];
495
+ case "RECEIVING":
496
+ return [
497
+ fe[N.enum.completeReceive],
498
+ z[j.Details],
499
+ z[j.Print]
500
+ ];
501
+ case "REQUESTING":
502
+ return f === "receive/request" ? [z[j.Details], z[j.Print]] : [
503
+ fe[N.enum.approveRequest],
504
+ fe[N.enum.rejectRequest],
505
+ z[j.Details],
506
+ z[j.Print]
507
+ ];
508
+ case "PROCESSING":
509
+ return [z[j.Details], z[j.Print]];
510
+ case "COMPLETE":
511
+ case "CANCEL":
512
+ default:
513
+ return [z[j.Details], z[j.Print]];
514
+ }
515
+ }
516
+ function h(a) {
517
+ return Object.values(N.enum).includes(a);
518
+ }
519
+ async function g(a, v, n) {
520
+ var R, q, U, I, W, Y;
521
+ const c = Me(v);
522
+ if (a === j.Print) {
523
+ const L = (n == null ? void 0 : n.toInventoryLocation) ?? {
524
+ name: "",
525
+ type: "restaurant",
526
+ acceptRequest: !0,
527
+ dbName: "",
528
+ doc: {
529
+ _id: "",
530
+ businessId: "",
531
+ profile: {}
532
+ }
533
+ }, ne = `${((R = n == null ? void 0 : n.netSuite) == null ? void 0 : R.id) ?? ""} ${((q = n == null ? void 0 : n.netSuite) == null ? void 0 : q.refNo) ?? ""}`.trim() || `${((U = c.netSuite) == null ? void 0 : U.id) ?? ""} ${((I = c.netSuite) == null ? void 0 : I.refNo) ?? ""}`.trim();
534
+ c.ref = [ne ? `Netsuite: (${ne})` : "", c.ref].filter((Z) => Z).join(" "), ft(c, L);
535
+ return;
536
+ }
537
+ if (a === j.Details) {
538
+ m.promptShowTransferDetails(c, n);
539
+ return;
540
+ }
541
+ if (a === j.Update) {
542
+ (W = m.promptUpdateTransferDialog) == null || W.call(m, c);
543
+ return;
544
+ }
545
+ if (h(a)) {
546
+ m.submitAction(v, a, (Y = n == null ? void 0 : n.to) == null ? void 0 : Y.dbName);
547
+ return;
548
+ }
549
+ }
550
+ function k() {
551
+ return [
552
+ {
553
+ accessorKey: "seqNumber",
554
+ header: () => s("inventory.transfer.table.seqNo"),
555
+ enableSorting: !0,
556
+ size: 80,
557
+ sortUndefined: "last"
558
+ },
559
+ {
560
+ accessorKey: "_id",
561
+ header: () => s("inventory.transfer.table.createdAt"),
562
+ cell(a) {
563
+ return _e(`${a.getValue()}`);
564
+ },
565
+ enableSorting: !0
566
+ },
567
+ {
568
+ accessorKey: "supplier.name",
569
+ header: () => s("inventory.transfer.table.transferFrom"),
570
+ enableSorting: !0,
571
+ size: 200
572
+ },
573
+ {
574
+ accessorKey: "items.length",
575
+ header: () => s("inventory.transfer.table.noOfItems"),
576
+ enableSorting: !1,
577
+ meta: {
578
+ width: "10rem"
579
+ }
580
+ },
581
+ {
582
+ accessorKey: "ref",
583
+ header: () => s("inventory.transfer.table.reference"),
584
+ enableSorting: !1,
585
+ size: "auto"
586
+ },
587
+ {
588
+ accessorKey: "status",
589
+ header: () => s("inventory.transfer.table.status"),
590
+ cell(a) {
591
+ const v = s(`inventory.transfer.status.${a.getValue() ?? ""}`), n = `${a.getValue() ?? ""}`.toLocaleLowerCase("en-us");
592
+ return x(
593
+ "div",
594
+ {
595
+ class: "flex"
596
+ },
597
+ x(
598
+ "div",
599
+ {
600
+ class: `fm-status-badge fm-status-badge-${n}`
601
+ },
602
+ v
603
+ )
604
+ );
605
+ },
606
+ enableSorting: !0,
607
+ size: 200
608
+ },
609
+ {
610
+ id: "action",
611
+ cell(a) {
612
+ const v = a.row.original, n = l(v);
613
+ return Ue(n, (c) => g(c, v));
614
+ },
615
+ enableSorting: !1,
616
+ size: 40,
617
+ meta: {
618
+ cellClass: "",
619
+ headerClass: ""
620
+ }
621
+ }
622
+ ];
623
+ }
624
+ function w() {
625
+ return [
626
+ {
627
+ accessorKey: "purchaseOrder.seqNumber",
628
+ header: () => s("inventory.transfer.table.seqNo"),
629
+ enableSorting: !0,
630
+ size: 80,
631
+ sortUndefined: "last"
632
+ },
633
+ {
634
+ accessorKey: "purchaseOrder._id",
635
+ header: () => s("inventory.transfer.table.createdAt"),
636
+ cell(a) {
637
+ return _e(`${a.getValue()}`);
638
+ },
639
+ enableSorting: !0
640
+ },
641
+ {
642
+ accessorKey: "to.name",
643
+ header: () => s("inventory.transfer.table.transferTo"),
644
+ enableSorting: !1,
645
+ size: 200
646
+ },
647
+ {
648
+ accessorKey: "purchaseOrder.items.length",
649
+ header: () => s("inventory.transfer.table.noOfItems"),
650
+ enableSorting: !1
651
+ },
652
+ {
653
+ accessorKey: "purchaseOrder.ref",
654
+ header: () => s("inventory.transfer.table.reference"),
655
+ enableSorting: !1,
656
+ size: "auto"
657
+ },
658
+ {
659
+ accessorKey: "purchaseOrder.status",
660
+ header: () => s("inventory.transfer.table.status"),
661
+ cell(a) {
662
+ const v = s(`inventory.transfer.status.${a.getValue() ?? ""}`), n = `${a.getValue() ?? ""}`.toLocaleLowerCase("en-us");
663
+ return x(
664
+ "div",
665
+ {
666
+ class: "flex"
667
+ },
668
+ x(
669
+ "div",
670
+ {
671
+ class: `fm-status-badge fm-status-badge-${n}`
672
+ },
673
+ v
674
+ )
675
+ );
676
+ },
677
+ enableSorting: !0
678
+ },
679
+ {
680
+ id: "action",
681
+ cell(a) {
682
+ const v = a.row.original, n = v.purchaseOrder ? l(v.purchaseOrder) : [];
683
+ return Ue(
684
+ n,
685
+ (c) => v.purchaseOrder ? g(c, v.purchaseOrder, v) : void 0
686
+ );
687
+ },
688
+ enableSorting: !1,
689
+ size: 40,
690
+ meta: {
691
+ cellClass: "",
692
+ headerClass: ""
693
+ }
694
+ }
695
+ ];
696
+ }
697
+ const e = Q(() => f === "receive/request" ? k() : w());
698
+ return {
699
+ get columnDefs() {
700
+ return e.value;
701
+ }
702
+ };
703
+ }
704
+ const pt = {
705
+ key: 0,
706
+ class: "flex flex-col gap-8"
707
+ }, vt = { class: "flex flex-col gap-4" }, yt = { class: "fm-typo-en-body-lg-600" }, ht = {
708
+ key: 0,
709
+ class: "flex flex-col gap-4"
710
+ }, bt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, gt = { class: "fm-typo-en-body-lg-600" }, _t = { key: 0 }, St = { key: 1 }, wt = {
711
+ key: 1,
712
+ class: "flex flex-col gap-4"
713
+ }, Ot = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Rt = { class: "fm-typo-en-body-lg-600" }, xt = { key: 0 }, Nt = { key: 1 }, Dt = {
714
+ key: 2,
715
+ class: "flex flex-col gap-4"
716
+ }, At = { class: "fm-typo-en-body-lg-600" }, kt = {
717
+ key: 3,
718
+ class: "flex flex-col gap-4"
719
+ }, Tt = { class: "fm-typo-en-body-lg-600" }, Pt = /* @__PURE__ */ Ne({
720
+ __name: "NetSuiteInfo",
721
+ props: {
722
+ transferType: {},
723
+ transferToDbName: {},
724
+ poRequest: {},
725
+ purchaseOrder: {},
726
+ isTransferBetweenOutlets: { type: Boolean },
727
+ scope: {}
728
+ },
729
+ setup(f) {
730
+ const m = f, s = Ke(), l = Te(), h = H(m.poRequest);
731
+ rt(async () => {
732
+ var e;
733
+ if (!m.poRequest && ((e = m.purchaseOrder) != null && e._id)) {
734
+ const a = await l.getLatestPurchaseOrderRequest(m.purchaseOrder._id);
735
+ h.value = a;
736
+ }
737
+ });
738
+ const g = Q(
739
+ () => {
740
+ var e, a, v, n, c, R;
741
+ return s.getSubsidiaryFullName(
742
+ ((v = (a = (e = m.purchaseOrder) == null ? void 0 : e.netSuite) == null ? void 0 : a.subsidiary) == null ? void 0 : v.id) || ((R = (c = (n = m.poRequest) == null ? void 0 : n.netSuite) == null ? void 0 : c.subsidiary) == null ? void 0 : R.id)
743
+ ).fullName;
744
+ }
745
+ ), k = Q(() => {
746
+ var e, a, v, n, c, R, q, U, I, W, Y, L;
747
+ return (v = (a = (e = m.purchaseOrder) == null ? void 0 : e.netSuite) == null ? void 0 : a.additionalInfo) != null && v.transactionnumber ? (R = (c = (n = m.purchaseOrder) == null ? void 0 : n.netSuite) == null ? void 0 : c.additionalInfo) == null ? void 0 : R.transactionnumber : (I = (U = (q = h.value) == null ? void 0 : q.netSuite) == null ? void 0 : U.additionalInfo) != null && I.transactionnumber ? (L = (Y = (W = h.value) == null ? void 0 : W.netSuite) == null ? void 0 : Y.additionalInfo) == null ? void 0 : L.transactionnumber : null;
748
+ }), w = Q(() => {
749
+ var e, a, v, n, c, R;
750
+ return (a = (e = m.purchaseOrder) == null ? void 0 : e.deliveryFullfillment) != null && a.length && ((n = (v = m.purchaseOrder) == null ? void 0 : v.deliveryFullfillment) == null ? void 0 : n.length) > 0 ? (R = (c = m.purchaseOrder) == null ? void 0 : c.deliveryFullfillment) == null ? void 0 : R.map((q) => {
751
+ var U;
752
+ return (U = q.netSuite) == null ? void 0 : U.refNo;
753
+ }).join(", ") : "N/A";
754
+ });
755
+ return (e, a) => {
756
+ var v, n, c, R, q, U, I, W, Y, L, ne, Z, ee, X;
757
+ return i(s).isEnabled ? (y(), S("div", pt, [
758
+ t("div", vt, [
759
+ a[0] || (a[0] = t("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, "NetSuite subsidiary", -1)),
760
+ t("div", yt, _(g.value || "N/A"), 1)
761
+ ]),
762
+ !e.isTransferBetweenOutlets && ((v = e.purchaseOrder) == null ? void 0 : v.status) !== i(F).Enum.REQUESTING && e.scope === i(xe).RECEIVE_REQUEST ? (y(), S("div", ht, [
763
+ t("div", bt, " NetSuite " + _(e.transferType === i(de).PURCHASE ? "Purchase Order" : "Transfer Order") + " (ID) ", 1),
764
+ t("div", gt, [
765
+ (c = (n = e.purchaseOrder) == null ? void 0 : n.netSuite) != null && c.id ? (y(), S("span", _t, _((q = (R = e.purchaseOrder) == null ? void 0 : R.netSuite) == null ? void 0 : q.refNo) + " (" + _((I = (U = e.purchaseOrder) == null ? void 0 : U.netSuite) == null ? void 0 : I.id) + ") ", 1)) : (y(), S("span", St, "N/A"))
766
+ ])
767
+ ])) : P("", !0),
768
+ !e.isTransferBetweenOutlets && h.value && ((W = e.purchaseOrder) == null ? void 0 : W.status) === i(F).Enum.REQUESTING || e.scope === i(xe).APPROVAL ? (y(), S("div", wt, [
769
+ t("div", Ot, " (Request) NetSuite " + _(e.transferType === i(de).PURCHASE ? "Purchase Order" : "Transfer Order") + " (ID) ", 1),
770
+ t("div", Rt, [
771
+ (L = (Y = h.value) == null ? void 0 : Y.netSuite) != null && L.id ? (y(), S("span", xt, _((Z = (ne = h.value) == null ? void 0 : ne.netSuite) == null ? void 0 : Z.refNo) + " (" + _((X = (ee = h.value) == null ? void 0 : ee.netSuite) == null ? void 0 : X.id) + ") ", 1)) : (y(), S("span", Nt, "N/A"))
772
+ ])
773
+ ])) : P("", !0),
774
+ k.value ? (y(), S("div", Dt, [
775
+ a[1] || (a[1] = t("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " NetSuite Transaction Number ", -1)),
776
+ t("div", At, _(k.value), 1)
777
+ ])) : P("", !0),
778
+ i(s).isEnabled && e.transferType === i(de).TRANSFER && !e.isTransferBetweenOutlets ? (y(), S("div", kt, [
779
+ a[2] || (a[2] = t("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " NetSuite fulfillment IDs ", -1)),
780
+ t("div", Tt, _(w.value), 1)
781
+ ])) : P("", !0)
782
+ ])) : P("", !0);
783
+ };
784
+ }
785
+ }), $t = { class: "flex flex-row-reverse" }, qt = /* @__PURE__ */ Ne({
786
+ __name: "NetSuiteSync",
787
+ props: {
788
+ poRequest: {},
789
+ purchaseOrder: {},
790
+ isTransferBetweenOutlets: { type: Boolean }
791
+ },
792
+ setup(f) {
793
+ const m = f, s = Ke(), l = Ae(), h = De(), g = H(!1);
794
+ Q(() => {
795
+ var v, n, c, R;
796
+ let w = !0;
797
+ s.isEnabled || (w = !1);
798
+ const e = m.purchaseOrder, a = m.poRequest;
799
+ return e && ((v = e == null ? void 0 : e.supplier) != null && v.internal ? (!a && e.status == F.enum.DRAFT && (w = !1), a && !((n = a == null ? void 0 : a.netSuite) != null && n.id) && (w = !1), m.isTransferBetweenOutlets && (w = !1)) : ((e == null ? void 0 : e.status) !== F.enum.REQUESTING && e.supplier.internal && (w = !1), !a && !((c = e == null ? void 0 : e.netSuite) != null && c.id) && (w = !1), !a && ((R = e == null ? void 0 : e.netSuite) != null && R.id) && (e == null ? void 0 : e.status) == F.enum.REQUESTING && (w = !1))), w;
800
+ });
801
+ async function k() {
802
+ g.value || h.open({
803
+ title: "Sync with NetSuite",
804
+ contentComponent: x("div", [
805
+ x("p", "Are you sure you want to sync now?"),
806
+ x("br"),
807
+ x(
808
+ "p",
809
+ { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" },
810
+ "Please wait a moment before syncing manually to avoid unnecessary actions."
811
+ )
812
+ ]),
813
+ primaryActions: {
814
+ text: "Sync",
815
+ close: !0,
816
+ variant: "destructive"
817
+ },
818
+ secondaryActions: { text: "Not now", close: !0 }
819
+ }).onPrimary(async () => {
820
+ var w, e;
821
+ try {
822
+ g.value = !0;
823
+ const a = ((w = m.purchaseOrder) == null ? void 0 : w._id) || ((e = m.poRequest) == null ? void 0 : e.purchaseOrderId) || "";
824
+ await s.syncPurchaseOrder(a), l.open({
825
+ title: "Sync with NetSuite",
826
+ message: "Requested to sync with NetSuite. Please wait a moment.",
827
+ type: "success"
828
+ });
829
+ } catch {
830
+ l.open({
831
+ title: "Error",
832
+ message: "Failed to sync with NetSuite",
833
+ type: "error"
834
+ });
835
+ }
836
+ setTimeout(() => {
837
+ g.value = !1;
838
+ }, 5e3);
839
+ });
840
+ }
841
+ return (w, e) => {
842
+ const a = ae("FmButton");
843
+ return y(), S("div", $t, [
844
+ V(a, {
845
+ "prepend-icon": "sync",
846
+ variant: "secondary",
847
+ label: "Sync",
848
+ loading: g.value,
849
+ onClick: k,
850
+ "text-color": "primary",
851
+ "bg-color": "transparent",
852
+ "border-color": "primary"
853
+ }, null, 8, ["loading"])
854
+ ]);
855
+ };
856
+ }
857
+ }), Et = { class: "flex flex-col gap-16 w-full h-full" }, Ct = { class: "flex justify-between" }, It = { class: "fm-typo-en-body-lg-600" }, Ft = { class: "flex flex-col gap-8" }, Ut = { class: "flex flex-col gap-4" }, Lt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Bt = { class: "flex gap-1" }, Mt = { class: "fm-typo-en-body-lg-600" }, jt = {
858
+ key: 0,
859
+ class: "flex flex-col gap-4"
860
+ }, Vt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Kt = { class: "fm-typo-en-body-lg-600" }, Gt = { class: "flex flex-col gap-4" }, Ht = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, zt = { class: "fm-typo-en-body-lg-600" }, Qt = {
861
+ key: 1,
862
+ class: "flex flex-col gap-4"
863
+ }, Wt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Yt = { class: "fm-typo-en-body-lg-600" }, Xt = {
864
+ key: 2,
865
+ class: "flex flex-col gap-4"
866
+ }, Jt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Zt = { class: "fm-typo-en-body-lg-600" }, er = {
867
+ key: 3,
868
+ class: "flex flex-col gap-4"
869
+ }, tr = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, rr = { class: "fm-typo-en-body-lg-600" }, sr = {
870
+ key: 4,
871
+ class: "flex flex-col gap-4"
872
+ }, ar = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, nr = { class: "fm-typo-en-body-lg-600" }, or = {
873
+ key: 0,
874
+ class: "border border-fm-color-neutral-gray-200 fm-corner-radius-lg p-16 flex flex-col gap-8"
875
+ }, lr = { class: "flex gap-8 items-center" }, cr = { class: "border border-fm-color-neutral-gray-200 fm-corner-radius-lg p-16" }, ir = { class: "flex flex-col gap-8" }, ur = { class: "flex gap-8 items-center" }, dr = { class: "flex-1 fm-typo-en-body-lg-600" }, mr = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary flex flex-col gap-4" }, fr = { class: "flex w-full gap-4" }, pr = { class: "basis-1/2 shrink-0 grow fm-typo-en-body-lg-400 line-clamp-2" }, vr = { class: "fm-typo-en-body-lg-600 line-clamp-2" }, yr = { class: "flex w-full gap-4 fm-typo-en-body-sm-400" }, hr = { class: "grow fm-typo-en-body-lg-400 text-fm-color-typo-secondary line-clamp-1" }, br = {
876
+ key: 0,
877
+ class: "line-clamp-1 fm-typo-en-body-lg-400 text-fm-color-typo-secondary"
878
+ }, gr = { class: "py-8" }, _r = { class: "flex justify-end gap-4 items-center" }, Sr = { class: "fm-typo-en-body-lg-600" }, wr = {
879
+ key: 1,
880
+ class: "flex-1 xs:w-screen xs:max-w-full"
881
+ }, Or = {
882
+ key: 0,
883
+ class: "flex flex-col items-center gap-8 h-full"
884
+ }, Rr = ["src"], xr = { class: "fm-typo-en-body-lg-600" }, Nr = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary px-16" }, Dr = {
885
+ key: 1,
886
+ class: "px-4 flex flex-col"
887
+ }, Ar = { class: "flex gap-12 content-stretch" }, kr = {
888
+ class: "flex flex-col w-24",
889
+ name: "circles"
890
+ }, Tr = { class: "flex-1 flex flex-col items-center" }, Pr = { class: "flex-1 flex flex-col items-center" }, $r = {
891
+ class: "py-12 flex flex-col gap-4",
892
+ name: "received-at header"
893
+ }, qr = { class: "fm-typo-en-body-lg-400" }, Er = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, Cr = { class: "flex gap-12 content-stretch" }, Ir = {
894
+ class: "flex flex-col w-24",
895
+ name: "circles"
896
+ }, Fr = { class: "flex-1 flex flex-col items-center" }, Ur = {
897
+ class: "py-12 flex flex-col gap-4 flex-1",
898
+ name: "delivery details"
899
+ }, Lr = { class: "flex flex-col gap-8" }, Br = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, Mr = { class: "flex flex-col gap-4" }, jr = { class: "flex gap-8 xs:flex-col" }, es = /* @__PURE__ */ Ne({
900
+ __name: "TransferDetails",
901
+ props: {
902
+ poRequest: {},
903
+ purchaseOrder: {},
904
+ transferTo: {},
905
+ transferToDbName: {},
906
+ show: { type: Boolean },
907
+ canResubmit: { type: Boolean },
908
+ canApprove: { type: Boolean },
909
+ scope: {}
910
+ },
911
+ emits: ["update:show", "submitted"],
912
+ setup(f, { emit: m }) {
913
+ const s = f, l = m, h = De(), g = Ae(), k = ke(), w = dt(), { t: e } = He(), a = Q(
914
+ () => {
915
+ var r, o, E, T;
916
+ return ((o = (r = s.purchaseOrder) == null ? void 0 : r.supplier) == null ? void 0 : o.internal) === "restaurant" || ((T = (E = s.purchaseOrder) == null ? void 0 : E.supplier) == null ? void 0 : T.internal) === "warehouse" ? de.TRANSFER : de.PURCHASE;
917
+ }
918
+ ), v = Q(() => {
919
+ var r, o, E;
920
+ return a.value === de.TRANSFER && ((r = s.transferToDbName) == null ? void 0 : r.startsWith("restaurant")) && ((E = (o = s.purchaseOrder) == null ? void 0 : o.supplier) == null ? void 0 : E.internal) === "restaurant";
921
+ }), n = H(!1), c = H(""), R = H(!0), q = ut(s, "show"), U = Q(() => [
922
+ {
923
+ label: e("inventory.transfer.receiveRequest.details.overview"),
924
+ value: "overview"
925
+ },
926
+ {
927
+ label: e("inventory.transfer.receiveRequest.details.deliveryHistory"),
928
+ value: "deliveryHistory"
929
+ }
930
+ ]), I = H(U.value[0]), W = Qe();
931
+ st(
932
+ () => s.show,
933
+ (r) => {
934
+ r && (I.value = U.value[0]);
935
+ }
936
+ );
937
+ async function Y(r, o, E) {
938
+ c.value = `${o}`, n.value = !0, R.value = !1;
939
+ try {
940
+ await W({
941
+ operation: o,
942
+ purchaseOrder: r,
943
+ payloadV2: {
944
+ confirmDraft: o === "confirmDraft" ? {
945
+ warehouseAutoReceive: k.autoReceiveWarehouse
946
+ } : void 0,
947
+ completeReceive: o === "completeReceive" ? {
948
+ warehouseAutoReceive: k.autoReceiveWarehouse
949
+ } : void 0,
950
+ submitRequest: o === "submitRequest" ? {
951
+ requestId: ""
952
+ // will be populated in backend
953
+ } : void 0
954
+ },
955
+ payloadV1: {
956
+ doc: r,
957
+ options: (
958
+ // auto receive for supplier to warehouse
959
+ (o === N.enum.confirmDraft || // auto receive for warehouse to warehouse
960
+ o === N.enum.completeReceive) && k.autoReceiveWarehouse ? {
961
+ autoReceive: !0
962
+ } : void 0
963
+ )
964
+ },
965
+ dbName: s.transferToDbName
966
+ }), await new Promise((T) => setTimeout(T, 1e3)), g.open({
967
+ title: "Success",
968
+ message: E,
969
+ type: "success"
970
+ }), l("update:show", !1), l("submitted");
971
+ } catch (T) {
972
+ g.open({
973
+ title: "Something went wrong",
974
+ message: "Please try again.",
975
+ type: "error"
976
+ }), console.error("Error when submitting PO operation", o, r, T);
977
+ } finally {
978
+ c.value = "", n.value = !1, R.value = !0;
979
+ }
980
+ }
981
+ async function L(r) {
982
+ if (r === N.enum.receiveStock)
983
+ return;
984
+ const o = ze[r];
985
+ if (!o) {
986
+ g.open({
987
+ title: "Something went wrong",
988
+ message: `Cannot process order: ${je(r)}`,
989
+ type: "error"
990
+ });
991
+ return;
992
+ }
993
+ const { successMessage: E, ...T } = o;
994
+ h.open({
995
+ title: T.title,
996
+ message: T.message,
997
+ primaryActions: T.primaryActions
998
+ }).onPrimary(() => {
999
+ s.purchaseOrder && Y(s.purchaseOrder, r, E);
1000
+ });
1001
+ }
1002
+ const ne = Q(() => {
1003
+ var r, o;
1004
+ return ((r = s.purchaseOrder) == null ? void 0 : r.status) === F.enum.RECEIVING || ((o = s.purchaseOrder) == null ? void 0 : o.status) === F.enum.COMPLETE;
1005
+ }), Z = Q(() => {
1006
+ var p, d, u;
1007
+ const E = (((p = s.purchaseOrder) == null ? void 0 : p.deliveryOrder) ?? []).flatMap((b) => b.received ?? []).reduce(
1008
+ (b, O) => {
1009
+ const $ = b[O.sku._id] ?? [];
1010
+ return b[O.sku._id] = [...$, O], b;
1011
+ },
1012
+ {}
1013
+ ), T = Object.entries(E).reduce(
1014
+ (b, [O, $]) => {
1015
+ const D = $.reduce((K, G) => {
1016
+ const se = tt(
1017
+ K,
1018
+ Math.max(K.precision, G.amount.precision)
1019
+ );
1020
+ return Re(se, G.amount);
1021
+ }, ge(0));
1022
+ return b[O] = D, b;
1023
+ },
1024
+ {}
1025
+ ), re = ((d = s.purchaseOrder) == null ? void 0 : d.items) ?? [];
1026
+ for (const b of re)
1027
+ T[u = b.sku._id] ?? (T[u] = ge(0));
1028
+ return T;
1029
+ }), ee = Q(() => {
1030
+ var p, d;
1031
+ const r = ((p = s.purchaseOrder) == null ? void 0 : p.deliveryOrder) ?? [], o = ((d = s.purchaseOrder) == null ? void 0 : d.deliveryFullfillment) ?? [], E = [
1032
+ ...r.map((u) => ({
1033
+ createdAt: u.createdAt,
1034
+ type: "grn",
1035
+ doc: u
1036
+ })),
1037
+ ...o.map((u) => ({
1038
+ createdAt: u.createdAt,
1039
+ type: "fulfillment",
1040
+ doc: u
1041
+ }))
1042
+ ];
1043
+ E.reverse().sort((u, b) => u.createdAt.localeCompare(b.createdAt));
1044
+ function T(u) {
1045
+ var O, $, D, K, G, se, ie;
1046
+ const b = o.findIndex((B) => B.id === u.fullfillmentId);
1047
+ return {
1048
+ header: "Received",
1049
+ date: Be(new Date(u.createdAt)),
1050
+ info: [
1051
+ {
1052
+ label: "Received by",
1053
+ values: [(O = u.createdBy) == null ? void 0 : O.name]
1054
+ },
1055
+ {
1056
+ label: "Received items",
1057
+ values: u.received.map((B) => {
1058
+ var ue;
1059
+ return x("div", [
1060
+ x(
1061
+ "div",
1062
+ {
1063
+ class: "flex gap-4"
1064
+ },
1065
+ [
1066
+ x(
1067
+ "div",
1068
+ {
1069
+ class: "flex flex-col"
1070
+ },
1071
+ [
1072
+ x(
1073
+ "span",
1074
+ {
1075
+ class: "fm-typo-en-body-lg-800 basis-1/2 shrink-0 grow"
1076
+ },
1077
+ `${B.sku.name}`
1078
+ ),
1079
+ x(
1080
+ "span",
1081
+ {
1082
+ class: "fm-typo-en-body-md-400"
1083
+ },
1084
+ `${B.sku.code} `
1085
+ )
1086
+ ]
1087
+ ),
1088
+ x(
1089
+ "div",
1090
+ {
1091
+ class: "ml-auto flex flex-col"
1092
+ },
1093
+ [
1094
+ x(
1095
+ "div",
1096
+ {
1097
+ class: "ml-auto flex gap-1"
1098
+ },
1099
+ [
1100
+ x(
1101
+ "span",
1102
+ {
1103
+ class: "fm-typo-en-body-lg-600 self-end"
1104
+ },
1105
+ pe(B.amount, !1)
1106
+ ),
1107
+ x(
1108
+ "span",
1109
+ {
1110
+ class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary"
1111
+ },
1112
+ ((ue = B.measurement) == null ? void 0 : ue.abbrev) ?? B.sku.unit.abbrev
1113
+ )
1114
+ ]
1115
+ ),
1116
+ x(
1117
+ "div",
1118
+ {
1119
+ class: "flex self-end fm-typo-en-body-md-400 text-fm-color-typo-secondary"
1120
+ },
1121
+ `${B.cost ? `(${he(B.cost)})` : ""}`
1122
+ )
1123
+ ]
1124
+ )
1125
+ ]
1126
+ )
1127
+ ]);
1128
+ })
1129
+ },
1130
+ u.deliveryOrderNumber ? {
1131
+ label: "Delivery order no.",
1132
+ values: [u.deliveryOrderNumber]
1133
+ } : null,
1134
+ u.remark ? {
1135
+ label: "Remark",
1136
+ values: [u.remark]
1137
+ } : null,
1138
+ b > -1 ? {
1139
+ label: "Fulfilment's sequence",
1140
+ values: [`${b + 1}`]
1141
+ } : null,
1142
+ (D = ($ = o[b]) == null ? void 0 : $.netSuite) != null && D.refNo ? {
1143
+ label: "Fulfillment's ref no. (Netsuite)",
1144
+ values: [(G = (K = o[b]) == null ? void 0 : K.netSuite) == null ? void 0 : G.refNo]
1145
+ } : null,
1146
+ (se = u == null ? void 0 : u.netSuite) != null && se.refNo ? {
1147
+ label: "Item receipt (Netsuite)",
1148
+ values: [(ie = u == null ? void 0 : u.netSuite) == null ? void 0 : ie.refNo]
1149
+ } : null
1150
+ ].filter((B) => B)
1151
+ };
1152
+ }
1153
+ function re(u) {
1154
+ var O, $;
1155
+ const b = o.findIndex((D) => D.id === u.id);
1156
+ return {
1157
+ header: "Fulfillment",
1158
+ date: Be(new Date(u.createdAt)),
1159
+ info: [
1160
+ {
1161
+ label: "Sequence",
1162
+ values: [String(b + 1)]
1163
+ },
1164
+ {
1165
+ label: "Receiveable items",
1166
+ values: u.items.map((D) => {
1167
+ var K;
1168
+ return x("div", [
1169
+ x(
1170
+ "div",
1171
+ {
1172
+ class: "flex gap-4"
1173
+ },
1174
+ [
1175
+ x(
1176
+ "div",
1177
+ {
1178
+ class: "flex flex-col"
1179
+ },
1180
+ [
1181
+ x(
1182
+ "span",
1183
+ {
1184
+ class: "fm-typo-en-body-lg-800 basis-1/2 shrink-0 grow"
1185
+ },
1186
+ `${D.sku.name}`
1187
+ ),
1188
+ x(
1189
+ "span",
1190
+ {
1191
+ class: "fm-typo-en-body-md-400"
1192
+ },
1193
+ `${D.sku.code} `
1194
+ )
1195
+ ]
1196
+ ),
1197
+ x(
1198
+ "div",
1199
+ {
1200
+ class: "ml-auto flex flex-col"
1201
+ },
1202
+ [
1203
+ x(
1204
+ "div",
1205
+ {
1206
+ class: "ml-auto flex gap-1"
1207
+ },
1208
+ [
1209
+ x(
1210
+ "span",
1211
+ {
1212
+ class: "fm-typo-en-body-lg-600 self-end"
1213
+ },
1214
+ pe(D.amount, !1)
1215
+ ),
1216
+ x(
1217
+ "span",
1218
+ {
1219
+ class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary"
1220
+ },
1221
+ ((K = D.measurement) == null ? void 0 : K.abbrev) ?? D.sku.unit.abbrev
1222
+ )
1223
+ ]
1224
+ ),
1225
+ x(
1226
+ "div",
1227
+ {
1228
+ class: "flex self-end fm-typo-en-body-md-400 text-fm-color-typo-secondary"
1229
+ },
1230
+ `${D.cost ? `(${he(D.cost)})` : ""}`
1231
+ )
1232
+ ]
1233
+ )
1234
+ ]
1235
+ )
1236
+ ]);
1237
+ })
1238
+ },
1239
+ (O = u.netSuite) != null && O.refNo ? {
1240
+ label: "Ref no. (Netsuite)",
1241
+ values: [($ = u.netSuite) == null ? void 0 : $.refNo]
1242
+ } : null
1243
+ ].filter((D) => D)
1244
+ };
1245
+ }
1246
+ return E.map((u) => {
1247
+ switch (u.type) {
1248
+ case "grn":
1249
+ return T(u.doc);
1250
+ case "fulfillment":
1251
+ return re(u.doc);
1252
+ }
1253
+ });
1254
+ }), X = Q(() => {
1255
+ var o;
1256
+ const r = {
1257
+ ...ge(0),
1258
+ currency: Le()
1259
+ };
1260
+ return ((o = s.purchaseOrder) == null ? void 0 : o.items.reduce((E, T) => ({
1261
+ ...Re(E, T.totalCost ?? r),
1262
+ currency: Le()
1263
+ }), r)) ?? r;
1264
+ });
1265
+ return (r, o) => {
1266
+ var D, K;
1267
+ const E = ae("FmButtonGroup"), T = ae("FmChip"), re = ae("FmMenuDivider"), p = ae("FmCard"), d = ae("FmIcon"), u = ae("FmTooltip"), b = ae("FmSpacer"), O = ae("FmButton"), $ = ae("FmSideSheet");
1268
+ return y(), te($, {
1269
+ header: i(e)("inventory.transfer.receiveRequest.details.title") + ((D = r.purchaseOrder) != null && D.seqNumber ? ` #${(K = r.purchaseOrder) == null ? void 0 : K.seqNumber}` : ""),
1270
+ modelValue: i(q),
1271
+ "onUpdate:modelValue": o[9] || (o[9] = (G) => at(q) ? q.value = G : null),
1272
+ "dismiss-away": R.value,
1273
+ "close-button": "",
1274
+ "max-width": 600
1275
+ }, {
1276
+ default: me(() => {
1277
+ var G, se, ie, B, ue;
1278
+ return [
1279
+ t("div", Et, [
1280
+ t("div", null, [
1281
+ V(E, {
1282
+ items: U.value,
1283
+ modelValue: I.value,
1284
+ "onUpdate:modelValue": o[0] || (o[0] = (A) => I.value = A)
1285
+ }, null, 8, ["items", "modelValue"])
1286
+ ]),
1287
+ I.value.value === "overview" ? (y(), S(ce, { key: 0 }, [
1288
+ t("div", null, [
1289
+ V(p, {
1290
+ variant: "outlined",
1291
+ class: "flex flex-col gap-8 px-12 py-16"
1292
+ }, {
1293
+ default: me(() => {
1294
+ var A, C, M, oe, le, J, Pe, $e, qe, Ee, Ce, Ie;
1295
+ return [
1296
+ t("div", Ct, [
1297
+ t("div", It, _(i(e)("inventory.transfer.receiveRequest.details.requestSummary")), 1),
1298
+ t("div", null, [
1299
+ V(T, {
1300
+ label: i(e)(`inventory.transfer.status.${(A = r.purchaseOrder) == null ? void 0 : A.status}`),
1301
+ class: be(`fm-status-badge fm-status-badge-${(M = (C = r.purchaseOrder) == null ? void 0 : C.status) == null ? void 0 : M.toLocaleLowerCase("en-us")}`),
1302
+ compact: ""
1303
+ }, null, 8, ["label", "class"])
1304
+ ])
1305
+ ]),
1306
+ V(re),
1307
+ t("div", Ft, [
1308
+ t("div", Ut, [
1309
+ t("div", Lt, [
1310
+ t("div", Bt, _(i(e)("inventory.transfer.receiveRequest.details.createdAt")), 1)
1311
+ ]),
1312
+ t("div", Mt, _(i(_e)(((oe = r.purchaseOrder) == null ? void 0 : oe._id) ?? "")), 1)
1313
+ ]),
1314
+ (le = r.purchaseOrder) != null && le.effectiveAt ? (y(), S("div", jt, [
1315
+ t("div", Vt, _(i(e)("inventory.transfer.receiveRequest.details.backdatedTo")), 1),
1316
+ t("div", Kt, _(i(Ve)(new Date((J = r.purchaseOrder) == null ? void 0 : J.effectiveAt))), 1)
1317
+ ])) : P("", !0),
1318
+ t("div", Gt, [
1319
+ t("div", Ht, _(i(e)("inventory.transfer.receiveRequest.details.type.title")), 1),
1320
+ t("div", zt, _(i(e)(
1321
+ `inventory.transfer.receiveRequest.details.type.${a.value.toLocaleLowerCase("en-US")}`
1322
+ )), 1)
1323
+ ]),
1324
+ ($e = (Pe = r.purchaseOrder) == null ? void 0 : Pe.supplier) != null && $e.name ? (y(), S("div", Qt, [
1325
+ t("div", Wt, _(i(e)("inventory.transfer.receiveRequest.details.from")), 1),
1326
+ t("div", Yt, _((Ee = (qe = r.purchaseOrder) == null ? void 0 : qe.supplier) == null ? void 0 : Ee.name), 1)
1327
+ ])) : P("", !0),
1328
+ r.transferTo ? (y(), S("div", Xt, [
1329
+ t("div", Jt, _(i(e)("inventory.transfer.receiveRequest.details.to")), 1),
1330
+ t("div", Zt, _(r.transferTo), 1)
1331
+ ])) : P("", !0),
1332
+ (Ce = r.purchaseOrder) != null && Ce.ref ? (y(), S("div", er, [
1333
+ t("div", tr, _(i(e)("inventory.transfer.receiveRequest.details.reference")), 1),
1334
+ t("div", rr, _(r.purchaseOrder.ref), 1)
1335
+ ])) : P("", !0),
1336
+ (Ie = r.purchaseOrder) != null && Ie.remark ? (y(), S("div", sr, [
1337
+ t("div", ar, _(i(e)("inventory.transfer.receiveRequest.details.remark")), 1),
1338
+ t("div", nr, _(r.purchaseOrder.remark), 1)
1339
+ ])) : P("", !0)
1340
+ ])
1341
+ ];
1342
+ }),
1343
+ _: 1
1344
+ })
1345
+ ]),
1346
+ i(w).isNetSuiteEnabled ? (y(), S("div", or, [
1347
+ t("div", lr, [
1348
+ o[10] || (o[10] = t("span", { class: "flex-1 fm-typo-en-body-lg-600" }, "NetSuite Info", -1)),
1349
+ t("div", null, [
1350
+ V(qt, {
1351
+ "po-request": r.poRequest,
1352
+ "purchase-order": r.purchaseOrder,
1353
+ "is-transfer-between-outlets": v.value
1354
+ }, null, 8, ["po-request", "purchase-order", "is-transfer-between-outlets"])
1355
+ ])
1356
+ ]),
1357
+ V(re),
1358
+ V(Pt, {
1359
+ "po-request": r.poRequest,
1360
+ "purchase-order": r.purchaseOrder,
1361
+ "transfer-type": a.value,
1362
+ "transfer-to-db-name": r.transferToDbName,
1363
+ "is-transfer-between-outlets": v.value,
1364
+ scope: r.scope
1365
+ }, null, 8, ["po-request", "purchase-order", "transfer-type", "transfer-to-db-name", "is-transfer-between-outlets", "scope"])
1366
+ ])) : P("", !0),
1367
+ t("div", cr, [
1368
+ t("div", ir, [
1369
+ t("div", ur, [
1370
+ t("span", dr, [
1371
+ Se(_(ne.value ? i(e)("inventory.transfer.receiveRequest.details.receivedItems") : i(e)("inventory.transfer.receiveRequest.details.requestedItems")) + " ", 1),
1372
+ (se = (G = r.purchaseOrder) == null ? void 0 : G.netSuite) != null && se.missingItems && ((B = (ie = r.purchaseOrder) == null ? void 0 : ie.netSuite) == null ? void 0 : B.missingItems.length) > 0 ? (y(), te(u, {
1373
+ key: 0,
1374
+ variant: "rich",
1375
+ placement: "top",
1376
+ "z-index": 51
1377
+ }, {
1378
+ content: me(() => {
1379
+ var A, C;
1380
+ return [
1381
+ t("div", mr, [
1382
+ (y(!0), S(ce, null, ve((C = (A = r.purchaseOrder) == null ? void 0 : A.netSuite) == null ? void 0 : C.missingItems, (M, oe) => (y(), S("div", {
1383
+ class: "flex justify-center align-middle",
1384
+ key: oe
1385
+ }, [
1386
+ V(d, {
1387
+ name: "arrow_right",
1388
+ size: "sm"
1389
+ }),
1390
+ Se(" " + _(`(${M.netSuiteId}) ${M.name}: ${M.reason}`), 1)
1391
+ ]))), 128))
1392
+ ])
1393
+ ];
1394
+ }),
1395
+ default: me(() => [
1396
+ V(d, {
1397
+ name: "error",
1398
+ color: "#ff2c2c",
1399
+ size: "sm"
1400
+ })
1401
+ ]),
1402
+ _: 1
1403
+ })) : P("", !0)
1404
+ ])
1405
+ ]),
1406
+ V(re),
1407
+ (y(!0), S(ce, null, ve(((ue = r.purchaseOrder) == null ? void 0 : ue.items) ?? [], (A) => {
1408
+ var C;
1409
+ return y(), S("div", {
1410
+ key: A.code,
1411
+ class: "flex flex-col"
1412
+ }, [
1413
+ t("div", fr, [
1414
+ t("div", pr, _(A.name), 1),
1415
+ t("div", vr, _(i(pe)(Z.value[A.sku._id], !1)) + "/" + _(i(Ge)(A.quantity, A.sku.unit, A.measurement)), 1)
1416
+ ]),
1417
+ t("div", yr, [
1418
+ t("div", hr, _(A.code), 1),
1419
+ (C = A.totalCost) != null && C.amount && i(k).enableTotalCost ? (y(), S("div", br, " (" + _(i(he)(A.totalCost)) + ") ", 1)) : P("", !0)
1420
+ ])
1421
+ ]);
1422
+ }), 128)),
1423
+ +i(pe)(X.value) ? (y(), S(ce, { key: 0 }, [
1424
+ t("div", gr, [
1425
+ V(re)
1426
+ ]),
1427
+ t("div", _r, [
1428
+ o[11] || (o[11] = t("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, "Total:", -1)),
1429
+ t("div", Sr, _(i(he)(X.value)), 1)
1430
+ ])
1431
+ ], 64)) : P("", !0)
1432
+ ])
1433
+ ])
1434
+ ], 64)) : I.value.value === "deliveryHistory" ? (y(), S("div", wr, [
1435
+ ee.value.length ? (y(), S("div", Dr, [
1436
+ (y(!0), S(ce, null, ve(ee.value, (A, C) => (y(), S(ce, { key: C }, [
1437
+ t("div", Ar, [
1438
+ t("div", kr, [
1439
+ t("div", Tr, [
1440
+ t("div", {
1441
+ class: be([
1442
+ {
1443
+ "bg-fm-color-primary": C !== 0,
1444
+ "bg-white": C === 0
1445
+ },
1446
+ "w-[2px] h-full"
1447
+ ])
1448
+ }, null, 2)
1449
+ ]),
1450
+ o[12] || (o[12] = t("div", { class: "h-24 w-24 bg-fm-color-primary rounded-full" }, null, -1)),
1451
+ t("div", Pr, [
1452
+ t("div", {
1453
+ class: be([
1454
+ {
1455
+ "bg-fm-color-primary": C < ee.value.length - 1,
1456
+ "bg-white": C >= ee.value.length - 1
1457
+ },
1458
+ "w-[2px] h-full"
1459
+ ])
1460
+ }, null, 2)
1461
+ ])
1462
+ ]),
1463
+ t("div", $r, [
1464
+ t("div", qr, _(A.header), 1),
1465
+ t("div", Er, _(A.date), 1)
1466
+ ])
1467
+ ]),
1468
+ t("div", Cr, [
1469
+ t("div", Ir, [
1470
+ t("div", Fr, [
1471
+ t("div", {
1472
+ class: be([
1473
+ {
1474
+ "bg-fm-color-primary": C < ee.value.length - 1,
1475
+ "bg-white": C >= ee.value.length - 1
1476
+ },
1477
+ "w-[2px] h-full"
1478
+ ])
1479
+ }, null, 2)
1480
+ ])
1481
+ ]),
1482
+ t("div", Ur, [
1483
+ V(p, {
1484
+ variant: "outlined",
1485
+ class: "py-12 px-16"
1486
+ }, {
1487
+ default: me(() => [
1488
+ t("div", Lr, [
1489
+ (y(!0), S(ce, null, ve(A.info, (M, oe) => (y(), S("div", {
1490
+ key: oe,
1491
+ class: "flex flex-col gap-4"
1492
+ }, [
1493
+ t("div", Br, _(M == null ? void 0 : M.label), 1),
1494
+ t("div", Mr, [
1495
+ (y(!0), S(ce, null, ve(M == null ? void 0 : M.values, (le, J) => (y(), S("div", {
1496
+ key: J,
1497
+ class: "fm-typo-en-body-lg-600"
1498
+ }, [
1499
+ typeof le == "string" ? (y(), S(ce, { key: 0 }, [
1500
+ Se(_(le), 1)
1501
+ ], 64)) : (y(), te(nt(le), { key: 1 }))
1502
+ ]))), 128))
1503
+ ])
1504
+ ]))), 128))
1505
+ ])
1506
+ ]),
1507
+ _: 2
1508
+ }, 1024)
1509
+ ])
1510
+ ])
1511
+ ], 64))), 128))
1512
+ ])) : (y(), S("div", Or, [
1513
+ V(b),
1514
+ t("div", null, [
1515
+ t("img", {
1516
+ src: i(it),
1517
+ alt: "List is empty"
1518
+ }, null, 8, Rr)
1519
+ ]),
1520
+ t("div", xr, _(i(e)("inventory.transfer.receiveRequest.details.noRecordsFound")), 1),
1521
+ t("div", Nr, _(i(e)("inventory.transfer.receiveRequest.details.trackDeliveryMessage")), 1),
1522
+ V(b),
1523
+ V(b)
1524
+ ]))
1525
+ ])) : P("", !0)
1526
+ ])
1527
+ ];
1528
+ }),
1529
+ "side-sheet-footer": me(() => {
1530
+ var G, se, ie, B, ue, A, C, M, oe, le;
1531
+ return [
1532
+ t("div", jr, [
1533
+ ((G = r.purchaseOrder) == null ? void 0 : G.status) === i(F).enum.DRAFT && a.value === i(de).PURCHASE ? (y(), te(O, {
1534
+ key: 0,
1535
+ label: i(e)("inventory.transfer.receiveRequest.actions.confirmDraft"),
1536
+ onClick: o[1] || (o[1] = (J) => L("confirmDraft")),
1537
+ loading: c.value === "confirmDraft",
1538
+ disabled: c.value !== "confirmDraft" && n.value
1539
+ }, null, 8, ["label", "loading", "disabled"])) : P("", !0),
1540
+ ((se = r.purchaseOrder) == null ? void 0 : se.status) === i(F).enum.DRAFT && a.value === i(de).TRANSFER ? (y(), te(O, {
1541
+ key: 1,
1542
+ label: i(e)("inventory.transfer.receiveRequest.actions.submitRequest"),
1543
+ onClick: o[2] || (o[2] = (J) => L("submitRequest")),
1544
+ loading: c.value === "submitRequest",
1545
+ disabled: c.value !== "submitRequest" && n.value
1546
+ }, null, 8, ["label", "loading", "disabled"])) : P("", !0),
1547
+ ((ie = r.purchaseOrder) == null ? void 0 : ie.status) === i(F).enum.DRAFT ? (y(), te(O, {
1548
+ key: 2,
1549
+ label: i(e)("inventory.transfer.receiveRequest.actions.cancelDraft"),
1550
+ onClick: o[3] || (o[3] = (J) => L("cancelDraft")),
1551
+ loading: c.value === "cancelDraft",
1552
+ disabled: c.value !== "cancelDraft" && n.value,
1553
+ variant: "destructive"
1554
+ }, null, 8, ["label", "loading", "disabled"])) : P("", !0),
1555
+ ((B = r.purchaseOrder) == null ? void 0 : B.status) === i(F).enum.RECEIVING ? (y(), te(O, {
1556
+ key: 3,
1557
+ label: i(e)("inventory.transfer.receiveRequest.actions.completeReceive"),
1558
+ onClick: o[4] || (o[4] = (J) => L("completeReceive")),
1559
+ loading: c.value === "completeReceive",
1560
+ disabled: c.value !== "completeReceive" && n.value
1561
+ }, null, 8, ["label", "loading", "disabled"])) : P("", !0),
1562
+ r.canResubmit ? (y(), te(O, {
1563
+ key: 4,
1564
+ label: i(e)("inventory.transfer.receiveRequest.actions.resubmitRequest"),
1565
+ onClick: o[5] || (o[5] = (J) => L("submitRequest")),
1566
+ loading: c.value === "submitRequest",
1567
+ disabled: c.value !== "submitRequest" && n.value
1568
+ }, null, 8, ["label", "loading", "disabled"])) : P("", !0),
1569
+ (((ue = r.purchaseOrder) == null ? void 0 : ue.status) === i(F).enum.REQUESTING || ((A = r.purchaseOrder) == null ? void 0 : A.status) === i(F).enum.PROCESSING) && r.canApprove ? (y(), te(O, {
1570
+ key: 5,
1571
+ label: i(e)("inventory.transfer.approval.actions.approveRequest"),
1572
+ onClick: o[6] || (o[6] = (J) => L("approveRequest")),
1573
+ loading: c.value === "approveRequest",
1574
+ disabled: c.value !== "approveRequest" && n.value
1575
+ }, null, 8, ["label", "loading", "disabled"])) : P("", !0),
1576
+ ((C = r.purchaseOrder) == null ? void 0 : C.status) === i(F).enum.REQUESTING && r.canApprove ? (y(), te(O, {
1577
+ key: 6,
1578
+ label: i(e)("inventory.transfer.approval.actions.rejectRequest"),
1579
+ onClick: o[7] || (o[7] = (J) => L("rejectRequest")),
1580
+ loading: c.value === "rejectRequest",
1581
+ disabled: c.value !== "rejectRequest" && n.value,
1582
+ variant: "destructive"
1583
+ }, null, 8, ["label", "loading", "disabled"])) : P("", !0),
1584
+ ((M = r.purchaseOrder) == null ? void 0 : M.status) !== i(F).enum.COMPLETE && ((oe = r.purchaseOrder) == null ? void 0 : oe.status) !== i(F).enum.CANCEL && (((le = r.purchaseOrder) == null ? void 0 : le.status) !== i(F).enum.REQUESTING || r.canApprove) ? (y(), te(O, {
1585
+ key: 7,
1586
+ label: i(e)("common.close"),
1587
+ variant: "tertiary",
1588
+ onClick: o[8] || (o[8] = (J) => l("update:show", !1))
1589
+ }, null, 8, ["label"])) : P("", !0)
1590
+ ])
1591
+ ];
1592
+ }),
1593
+ _: 1
1594
+ }, 8, ["header", "modelValue", "dismiss-away"]);
1595
+ };
1596
+ }
1597
+ });
1598
+ export {
1599
+ xe as P,
1600
+ es as _,
1601
+ Jr as a,
1602
+ Zr as b,
1603
+ mt as g,
1604
+ Te as u
1605
+ };