@feedmepos/mf-inventory-portal 1.0.20 → 1.0.21

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 (57) hide show
  1. package/dist/{App-HCucbXT5.js → App-Dm1dub7v.js} +2 -2
  2. package/dist/{ApprovalView-CR8Ievmh.js → ApprovalView-DZK5guKS.js} +2 -2
  3. package/dist/{BindingsDialog-BsbaWyqP.js → BindingsDialog-BL2jOxN4.js} +2 -2
  4. package/dist/{BindingsPicker-ByFOp6B3.js → BindingsPicker-G1SdBXsq.js} +1 -1
  5. package/dist/{BindingsTable-BhGnyUQH.js → BindingsTable-Coy6_ryj.js} +1 -1
  6. package/dist/{ClosingDraftView-5Eem33MA.js → ClosingDraftView-RTjmn1uK.js} +2 -2
  7. package/dist/{ClosingTemplateView-CydMQc2L.js → ClosingTemplateView-DkX8edyP.js} +2 -2
  8. package/dist/{DeliveryOrderPrintPreview-Csbca_v0.js → DeliveryOrderPrintPreview-j-DgrDiv.js} +1 -1
  9. package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-LV2wLWWk.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-BL8MG9yR.js} +3 -3
  10. package/dist/{FmMultiselectDialog-DISDKgZY.js → FmMultiselectDialog-C2FfQXZp.js} +1 -1
  11. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-TSO_zgPu.js → FmUnitInput.vue_vue_type_script_setup_true_lang-D4dnq4rA.js} +1 -1
  12. package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-Cg8vkF_r.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-DXbFhLpK.js} +1 -1
  13. package/dist/{IngredientGroupView-BONl2HNV.js → IngredientGroupView-DHbQCRy_.js} +2 -2
  14. package/dist/{IngredientsView-b-ztsnrh.js → IngredientsView-CF-wb-6-.js} +5 -5
  15. package/dist/IntegrationView-X5yvur-x.js +6007 -0
  16. package/dist/{InventoryBindingForm-BJvKlpQv.js → InventoryBindingForm-CeJZHDY0.js} +1 -1
  17. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-Cw_LyQCc.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-9hirHThb.js} +3 -3
  18. package/dist/{InventoryBindingSummary-o1qzcGiz.js → InventoryBindingSummary-CBg7KhPi.js} +1 -1
  19. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-8ne5kKtT.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-BSVs7T4a.js} +1 -1
  20. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-D60Y07cG.js → PremiumBadge.vue_vue_type_script_setup_true_lang-ChZwsyJM.js} +1 -1
  21. package/dist/{PublishView-BAzw6iNq.js → PublishView-BjvKb7f-.js} +2 -2
  22. package/dist/{PurchaseOrderPrintPreview-DBaLVHMs.js → PurchaseOrderPrintPreview-CbAMXMPU.js} +1 -1
  23. package/dist/{ReceiveRequestView-CHwB-N1X.js → ReceiveRequestView-ihHtocTf.js} +10 -10
  24. package/dist/{RecipeView-CTNJ1Alw.js → RecipeView-BoR36rGq.js} +4 -4
  25. package/dist/{StockView-Dd0FpkBz.js → StockView-DcHopPZO.js} +7 -7
  26. package/dist/{SupplierView-C5tHBFjz.js → SupplierView-V67QXaLX.js} +482 -480
  27. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-eeL8-QuF.js +2181 -0
  28. package/dist/TransferTemplateView-DKDeo49Q.js +1432 -0
  29. package/dist/{UnitView-DIqdD9rK.js → UnitView-BRVRLheN.js} +3 -3
  30. package/dist/WarehouseView-tRg5Hn4L.js +1034 -0
  31. package/dist/api/netsuite.d.ts +1 -0
  32. package/dist/{app-D6VUced2.js → app-82JEull2.js} +43642 -39723
  33. package/dist/app.js +4 -4
  34. package/dist/{decimal-B-F4KR7a.js → decimal-D-zH_vXe.js} +1 -1
  35. package/dist/{feature-BXo8MNXq.js → feature-UG6T1t8f.js} +394 -387
  36. package/dist/{format-unit-display-CKfsmYU1.js → format-unit-display-CIPAWL-6.js} +2 -2
  37. package/dist/{index-Bx9GXnw-.js → index-B7w4ky-g.js} +2 -2
  38. package/dist/{index-DWWzKqnk.js → index-BDC93VCL.js} +1 -1
  39. package/dist/{stock-CKqcI427.js → stock-Bq9xHemt.js} +1 -1
  40. package/dist/stores/integration/netsuite.d.ts +31 -0
  41. package/dist/{supplier-DsBIy15T.js → supplier-BrZdgPMN.js} +2 -2
  42. package/dist/tsconfig.app.tsbuildinfo +1 -1
  43. package/dist/{use-ingredient-select-dialog-DVBnJIlK.js → use-ingredient-select-dialog-Dzy7PO1j.js} +1 -1
  44. package/dist/{use-inventory-binding-dialog-DgbGDAWk.js → use-inventory-binding-dialog-DT4t22Eb.js} +1 -1
  45. package/dist/views/receive-request/components/netsuite/NetSuiteLatestInfo.vue.d.ts +17 -0
  46. package/dist/views/transfer-template/components/transfer-template-dialog/TransferTemplateDialog.vue.d.ts +497 -12
  47. package/dist/views/transfer-template/components/transfer-template-form/TransferTemplateForm.vue.d.ts +5 -1
  48. package/dist/views/transfer-template/components/transfer-template-form/components/NetSuiteCustomCodeSelection.vue.d.ts +172 -0
  49. package/dist/views/transfer-template/components/transfer-template-form/components/TransferTemplateItemTable.vue.d.ts +2 -0
  50. package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-template-items.d.ts +3 -2
  51. package/dist/{vue-i18n-g4GUXOuk.js → vue-i18n-D5ETg5F3.js} +300 -300
  52. package/package.json +5 -3
  53. package/dist/IntegrationView-oRHoLLjT.js +0 -9671
  54. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-CpngWNmz.js +0 -2095
  55. package/dist/TransferTemplateView-CP24Mv9n.js +0 -1421
  56. package/dist/WarehouseView-DCtBNHvx.js +0 -1032
  57. package/dist/views/transfer-template/composables/useTransferTemplateHelper.d.ts +0 -305
@@ -0,0 +1,2181 @@
1
+ import { a2 as ct, u as ue, aM as k, b as De, a7 as ut, a9 as dt, aa as mt, aN as ft, d as Qe, e as et, $ as Ve, aO as pt, a4 as Le, Q as xe, i as le, aP as tt, ae as Ne, f as Ye, h as Q, D as te, av as ce, aQ as rt, aR as st, a8 as yt, at as Xe, a6 as Oe, aj as Ce, aw as vt } from "./app-82JEull2.js";
2
+ import { ref as U, computed as Y, h as q, defineComponent as fe, reactive as ht, onMounted as at, resolveComponent as V, openBlock as g, createBlock as ne, withCtx as re, createElementVNode as a, createVNode as C, unref as b, createElementBlock as R, toDisplayString as N, createCommentVNode as L, Fragment as ee, renderList as de, watch as bt, isRef as gt, normalizeClass as ke, createTextVNode as Ie, resolveDynamicComponent as _t } from "vue";
3
+ import { F as St } from "./decimal-D-zH_vXe.js";
4
+ import { b as wt, u as Rt, f as nt, P as me } from "./format-unit-display-CIPAWL-6.js";
5
+ import { useCoreStore as qe, useI18n as ot } from "@feedmepos/mf-common";
6
+ import { E as Ot } from "./empty-placeholder-wf6-BWE8.js";
7
+ import { useDialog as Me, useSnackbar as Ae, components as Je, FmButtonVariant as Z, useProxiedModel as kt } from "@feedmepos/ui-library";
8
+ import { u as $e, F as Fe } from "./feature-UG6T1t8f.js";
9
+ import { _ as xt, F as Nt, a as Dt } from "./FmUnitInput.vue_vue_type_script_setup_true_lang-D4dnq4rA.js";
10
+ import { u as qt, R as Ze } from "./usePromise-CbVUCxhj.js";
11
+ import { u as At } from "./index-B7w4ky-g.js";
12
+ const Te = ct((m, s) => {
13
+ const n = ue(), O = qe();
14
+ return {
15
+ async readRequests(u, e, l) {
16
+ const d = u ?? n.currentLocationDBName, r = `${m.inventoryBackendUrl}/${d}/purchase-request`;
17
+ return e && l ? await s.get(`${r}?startDate=${e}&endDate=${l}`) : await s.get(r);
18
+ },
19
+ async readRequestById(u, e) {
20
+ const l = e ?? n.currentLocationDBName, d = `${m.inventoryBackendUrl}/${l}/purchase-request/${u}`;
21
+ return await s.get(d);
22
+ },
23
+ async readRequestByIds(u, e) {
24
+ const l = e ?? n.currentLocationDBName, d = `${m.inventoryBackendUrl}/${l}/purchase-request/find`;
25
+ return await s.post(d, { requestIds: u });
26
+ },
27
+ async getPurchaseOrders({
28
+ start: u,
29
+ end: e
30
+ }) {
31
+ const l = n.currentLocationDBName, d = `${m.inventoryBackendUrl}/${l}/purchase-order`;
32
+ return await s.get(`${d}?start=${u}&end=${e}`);
33
+ },
34
+ async getLatestPurchaseOrderRequest(u) {
35
+ const e = n.currentLocationDBName, l = `${m.inventoryBackendUrl}/${e}/purchase-request/find-by-purchase-order-id`;
36
+ return await s.get(`${l}/${u}`);
37
+ },
38
+ async getPurchaseOrderById(u) {
39
+ const e = n.currentLocationDBName, l = `${m.inventoryBackendUrl}/${e}/purchase-order`;
40
+ return await s.get(`${l}/${u}`);
41
+ },
42
+ /**
43
+ * @deprecated Use `processPurchaseOrderV2` instead.
44
+ */
45
+ async processPurchaseOrder(u, e) {
46
+ const l = n.currentLocationDBName, d = e || l, r = `${m.inventoryBackendUrl}/${d}/purchase-order/run-operation`;
47
+ return await s.put(r, u);
48
+ },
49
+ async createPurchaseOrder(u) {
50
+ const e = n.currentLocationDBName, l = `${m.inventoryBackendUrl}/${e}/purchase-order`;
51
+ return await s.post(l, u);
52
+ },
53
+ async updatePurchaseOrder(u) {
54
+ const e = n.currentLocationDBName, l = `${m.inventoryBackendUrl}/${e}/purchase-order`;
55
+ return await s.put(l, u);
56
+ },
57
+ async importFromXilnex(u) {
58
+ const e = n.currentLocationDBName, l = `${m.inventoryBackendUrl}/${e}/purchase-order/import-from-xilnex`;
59
+ return await s.post(l, u);
60
+ },
61
+ async processPurchaseOrderV2(u, e) {
62
+ const l = n.currentLocationDBName, d = e || l, r = `${m.inventoryBackendUrl}/${d}/v2/purchase-order/run-operation`;
63
+ return await s.put(r, u);
64
+ },
65
+ async getWorkflowConfig() {
66
+ var d;
67
+ const e = `business_${(d = O.currentBusiness.value) == null ? void 0 : d._id}`, l = `${m.inventoryBackendUrl}/${e}/v2/purchase-order/workflow-config`;
68
+ return await s.get(l);
69
+ }
70
+ };
71
+ }), it = {
72
+ [k.enum.confirmDraft]: {
73
+ primaryActions: {
74
+ text: "Confirm draft",
75
+ close: !0
76
+ },
77
+ title: "Confirm draft?",
78
+ message: "Purchase order cannot be changed after confirm draft.",
79
+ successMessage: "Purchase order draft has been confirmed"
80
+ },
81
+ [k.enum.cancelDraft]: {
82
+ primaryActions: {
83
+ text: "Cancel draft",
84
+ close: !0,
85
+ variant: "destructive"
86
+ },
87
+ title: "Cancel draft?",
88
+ message: "Purchase order cannot be changed after cancelled draft.",
89
+ successMessage: "Purchase order draft has been cancelled"
90
+ },
91
+ [k.enum.submitRequest]: {
92
+ primaryActions: {
93
+ text: "Submit request",
94
+ close: !0
95
+ },
96
+ title: "Confirm draft?",
97
+ message: "Purchase order cannot be changed after confirm draft.",
98
+ successMessage: "Purchase order draft has been submitted"
99
+ },
100
+ [k.enum.completeReceive]: {
101
+ primaryActions: {
102
+ text: "Mark received",
103
+ close: !0
104
+ },
105
+ title: "Mark as received",
106
+ message: "Purchase order cannot be changed after it has complete receiving.",
107
+ successMessage: "Purchase order has been marked as received"
108
+ },
109
+ [k.enum.approveRequest]: {
110
+ primaryActions: {
111
+ text: "Accept request",
112
+ close: !0
113
+ },
114
+ title: "Accept request?",
115
+ message: "Transfer out request will be accepted.",
116
+ successMessage: "Transfer out request has been approved"
117
+ },
118
+ [k.enum.rejectRequest]: {
119
+ primaryActions: {
120
+ text: "Reject request",
121
+ close: !0,
122
+ variant: "destructive"
123
+ },
124
+ title: "Reject request?",
125
+ message: "Purchase order will be rejected.",
126
+ successMessage: "Purchase order has been rejected"
127
+ },
128
+ [k.enum.processRequest]: {
129
+ primaryActions: {
130
+ text: "Process request",
131
+ close: !0,
132
+ variant: "destructive"
133
+ },
134
+ title: "Process request?",
135
+ message: "Purchase order will be processed.",
136
+ successMessage: "Purchase order has been processed"
137
+ }
138
+ };
139
+ function lt() {
140
+ const m = ue(), s = Te(), n = $e();
141
+ async function O(e, l) {
142
+ const d = m.currentLocationDBName;
143
+ return e.doc.supplier.internal && e.operation === k.enum.confirmDraft && (e.operation = k.enum.submitRequest), await s.processPurchaseOrder(e, l || d);
144
+ }
145
+ async function u(e, l) {
146
+ const d = m.currentLocationDBName;
147
+ return await s.processPurchaseOrderV2(e, l || d);
148
+ }
149
+ return (e) => n.useOperatePurchaseOrderV2 ? u(e.operateV2, e.transferTo) : O(e.operate, e.transferTo);
150
+ }
151
+ var Ue = /* @__PURE__ */ ((m) => (m.RECEIVE_REQUEST = "receive/request", m.APPROVAL = "approval", m))(Ue || {});
152
+ const we = U(), Ee = U();
153
+ function Es(m, s) {
154
+ const n = Me(), O = ue(), u = $e();
155
+ De();
156
+ const e = wt(), l = Rt(), d = U(!1), r = Ae(), h = Te(), _ = U(new Array()), f = U(
157
+ s != null && s.startDate && (s != null && s.endDate) ? s : ut()
158
+ ), i = Y(() => {
159
+ const D = new Date(f.value.startDate), t = new Date(f.value.endDate);
160
+ return {
161
+ start: dt(D).toISOString(),
162
+ end: mt(t).toISOString()
163
+ };
164
+ }), c = U(new Array()), o = ft(), y = U(null);
165
+ async function x(D) {
166
+ function t(w) {
167
+ const S = {
168
+ mode: Qe.CREATE,
169
+ modelValue: D || void 0,
170
+ show: !0,
171
+ "onUpdate:show"($) {
172
+ we.value.show = $;
173
+ },
174
+ templateId: w,
175
+ lastClosingDate: y.value
176
+ };
177
+ we.value = S;
178
+ }
179
+ let p;
180
+ u.mustUsePoTemplate && !(D != null && D.template) ? n.open({
181
+ title: "Create transfer",
182
+ message: "",
183
+ primaryActions: {
184
+ text: "Select a template",
185
+ close: !0
186
+ },
187
+ secondaryActions: {
188
+ text: "Outlet to Outlet",
189
+ variant: "secondary",
190
+ close: !0
191
+ }
192
+ }).onPrimary(async () => {
193
+ p = await e.getTemplateId(), p && t(p);
194
+ }).onSecondary(() => {
195
+ t(void 0);
196
+ }) : t(p);
197
+ }
198
+ function A(D) {
199
+ const t = {
200
+ mode: Qe.UPDATE,
201
+ modelValue: et(D),
202
+ show: !0,
203
+ "onUpdate:show"(p) {
204
+ we.value.show = p;
205
+ },
206
+ lastClosingDate: y.value
207
+ };
208
+ we.value = t;
209
+ }
210
+ async function H() {
211
+ _.value = [], d.value = !0;
212
+ try {
213
+ _.value = await h.getPurchaseOrders(i.value).then((w) => w.sort((S, $) => $._id.localeCompare(S._id)));
214
+ const D = await o.readCurrentLocationLastClosing(!0), t = D == null ? void 0 : D._id;
215
+ t && (y.value = pt(t)), await u.awaitFeatureLoaded(() => u.mustUsePoTemplate) && await l.fetchTemplates();
216
+ const p = _.value.map((w) => {
217
+ var S;
218
+ return ((S = w.request) == null ? void 0 : S.id) ?? "";
219
+ }).filter((w) => w);
220
+ c.value = await h.readRequestByIds(p);
221
+ } catch {
222
+ r.open({
223
+ title: "Something went wrong",
224
+ message: "Error at fetching purchase orders",
225
+ type: "error"
226
+ });
227
+ } finally {
228
+ d.value = !1;
229
+ }
230
+ }
231
+ async function M() {
232
+ c.value = [], d.value = !0;
233
+ try {
234
+ c.value = await h.readRequests(
235
+ void 0,
236
+ i.value.start,
237
+ i.value.end
238
+ ).then((D) => D.reverse());
239
+ } catch {
240
+ r.open({
241
+ title: "Something went wrong",
242
+ message: "Error at fetching purchase requests",
243
+ type: "error"
244
+ });
245
+ } finally {
246
+ d.value = !1;
247
+ }
248
+ }
249
+ function X() {
250
+ switch (m) {
251
+ case "receive/request":
252
+ return H();
253
+ case "approval":
254
+ return M();
255
+ }
256
+ }
257
+ function se(D, t) {
258
+ f.value = {
259
+ startDate: D,
260
+ endDate: t
261
+ }, X();
262
+ }
263
+ O.watchLocation(async (D) => {
264
+ if (!D) {
265
+ _.value = [];
266
+ return;
267
+ }
268
+ await X();
269
+ });
270
+ const J = U(), pe = U(Math.random().toString());
271
+ async function oe(D, t) {
272
+ const p = Math.random().toString();
273
+ pe.value = p, t ?? (t = c.value.computeFirst(
274
+ ($) => $.purchaseOrderId === D._id ? $ : null
275
+ ) ?? void 0);
276
+ const w = m === "receive/request" ? O.currentLocation : t == null ? void 0 : t.to, S = {
277
+ poRequest: t,
278
+ purchaseOrder: D,
279
+ transferTo: w == null ? void 0 : w.name,
280
+ transferToDbName: w == null ? void 0 : w.dbName,
281
+ show: !0,
282
+ canResubmit: !1,
283
+ canApprove: m === "approval",
284
+ "onUpdate:show"($) {
285
+ J.value.show = $;
286
+ },
287
+ scope: m
288
+ };
289
+ J.value = S;
290
+ }
291
+ async function ye(D, t, p, w) {
292
+ const S = lt();
293
+ d.value = !0;
294
+ try {
295
+ await S({
296
+ operate: {
297
+ operation: t,
298
+ doc: D,
299
+ options: (
300
+ // auto receive for supplier to warehouse
301
+ (t === k.enum.confirmDraft || // auto receive for warehouse to warehouse
302
+ t === k.enum.completeReceive) && u.autoReceiveWarehouse ? {
303
+ autoReceive: !0
304
+ } : void 0
305
+ )
306
+ },
307
+ operateV2: {
308
+ _id: D._id,
309
+ _rev: D._rev ?? "",
310
+ action: t,
311
+ payloads: []
312
+ },
313
+ transferTo: w
314
+ }), await new Promise((G) => setTimeout(G, 1e3));
315
+ const K = ue().currentLocationDBName.startsWith("restaurant_");
316
+ t === k.enum.confirmDraft && D.effectiveAt && K ? r.open({
317
+ title: "Success",
318
+ message: `${p}. The backdate will be reflected once your POS has received this change.`,
319
+ type: "success"
320
+ }) : r.open({
321
+ title: "Success",
322
+ message: p,
323
+ type: "success"
324
+ });
325
+ } catch ($) {
326
+ r.open({
327
+ title: "Something went wrong",
328
+ message: "Please try again.",
329
+ type: "error"
330
+ }), console.error("Error when submitting PO operation", t, D, $);
331
+ } finally {
332
+ d.value = !1, X();
333
+ }
334
+ }
335
+ async function Pe(D, t, p) {
336
+ const w = it[t];
337
+ if (!w) {
338
+ r.open({
339
+ title: "Something went wrong",
340
+ message: `Cannot process order: ${Ve(t)}`,
341
+ type: "error"
342
+ });
343
+ return;
344
+ }
345
+ const { successMessage: S, ...$ } = w;
346
+ n.open({
347
+ title: $.title,
348
+ message: $.message,
349
+ primaryActions: $.primaryActions
350
+ }).onPrimary(() => {
351
+ ye(D, t, S, p);
352
+ });
353
+ }
354
+ async function ie() {
355
+ n.open({
356
+ title: "Upload Transfer",
357
+ primaryActions: {
358
+ text: "Xilnex transfer note",
359
+ close: !0
360
+ },
361
+ secondaryActions: {
362
+ text: "Cancel",
363
+ close: !0
364
+ }
365
+ }).onPrimary(() => {
366
+ const D = {
367
+ show: !0,
368
+ "onUpdate:show"(t) {
369
+ Ee.value.show = t;
370
+ }
371
+ };
372
+ Ee.value = D;
373
+ });
374
+ }
375
+ return {
376
+ purchaseOrders: _,
377
+ purchaseRequests: c,
378
+ updateDateRange: se,
379
+ fetchData: X,
380
+ loading: d,
381
+ transferDialogProps: we,
382
+ promptCreateTransferDialog: x,
383
+ promptUpdateTransferDialog: A,
384
+ transferDetailsProps: J,
385
+ promptShowTransferDetails: oe,
386
+ submitAction: Pe,
387
+ xilnexImportDialogProps: Ee,
388
+ promptUploadTransferDialog: ie
389
+ };
390
+ }
391
+ function $t(m, s) {
392
+ return s.reduce(
393
+ (O, u) => {
394
+ const e = u.received.find((l) => l.sku._id === m._id);
395
+ return e && (O = Le(O, e.amount)), O;
396
+ },
397
+ St.toPrecision(xe(0), m.unit.precision)
398
+ );
399
+ }
400
+ function Tt(m, s, n, O) {
401
+ const { name: u, address: e, regNo: l } = s.doc.profile, d = {
402
+ name: u,
403
+ registrationNumber: l,
404
+ line1: e == null ? void 0 : e.line1,
405
+ line2: e == null ? void 0 : e.line2,
406
+ postcode: e == null ? void 0 : e.postcode,
407
+ city: e == null ? void 0 : e.city,
408
+ state: e == null ? void 0 : e.state,
409
+ country: e == null ? void 0 : e.country
410
+ }, r = {
411
+ name: m.supplier.name,
412
+ phoneNumber: m.supplier.phoneNumber,
413
+ registrationNumber: m.supplier.registrationNumber,
414
+ line1: m.supplier.address.line1,
415
+ line2: m.supplier.address.line2,
416
+ postcode: m.supplier.address.postcode,
417
+ city: m.supplier.address.city,
418
+ state: m.supplier.address.state,
419
+ country: m.supplier.address.country
420
+ }, h = m.items.map((o) => {
421
+ const { sku: y, measurement: x } = o, A = le(
422
+ $t(o.sku, m.deliveryOrder || []),
423
+ !1
424
+ );
425
+ return {
426
+ code: y.code,
427
+ description: y.name,
428
+ quantity: nt(o.quantity, y.unit, o.measurement),
429
+ unit: (x == null ? void 0 : x.abbrev) || y.unit.abbrev,
430
+ received: A
431
+ };
432
+ }), _ = m.deliveryOrder.map((o) => ({
433
+ createdAt: tt(new Date(o.createdAt)),
434
+ ref: o.deliveryOrderNumber,
435
+ remark: o.remark || "",
436
+ items: o.received.map((y) => {
437
+ var x;
438
+ return {
439
+ code: y.sku.code,
440
+ description: y.sku.name,
441
+ quantity: le(y.amount),
442
+ unit: ((x = y.measurement) == null ? void 0 : x.abbrev) || y.sku.unit.abbrev
443
+ };
444
+ })
445
+ })), f = {
446
+ businessName: n == null ? void 0 : n.name,
447
+ logo: n == null ? void 0 : n.thumbnail,
448
+ orderNumber: m.seqNumber.toString(),
449
+ createdAt: Ne(m._id),
450
+ ref: m.ref || "",
451
+ remark: m.remark || "",
452
+ buyer: d,
453
+ supplier: r,
454
+ items: h,
455
+ status: m.status,
456
+ deliveryOrders: _
457
+ }, i = new URL(window.location.href), c = O && (m.deliveryFullfillment || []).length > 0 ? "receive-request/delivery-print-preview" : "receive-request/print-preview";
458
+ i.pathname = i.hostname.includes("portal.feedme") ? `/inventory/${c}` : `/${c}`, i.searchParams.append("data", JSON.stringify(f)), window.open(i.href, "_blank", "noreferrer");
459
+ }
460
+ const be = {
461
+ submitRequest: {
462
+ translationKey: "inventory.transfer.receiveRequest.actions.submitRequest",
463
+ color: "text-fm-color-typo-primary",
464
+ value: k.enum.submitRequest
465
+ },
466
+ confirmDraft: {
467
+ translationKey: "inventory.transfer.receiveRequest.actions.confirmDraft",
468
+ color: "text-fm-color-typo-primary",
469
+ value: k.enum.confirmDraft
470
+ },
471
+ cancelDraft: {
472
+ translationKey: "inventory.transfer.receiveRequest.actions.cancelDraft",
473
+ color: "text-fm-color-typo-error",
474
+ value: k.enum.cancelDraft
475
+ },
476
+ approveRequest: {
477
+ translationKey: "inventory.transfer.receiveRequest.actions.approveRequest",
478
+ color: "text-fm-color-typo-primary",
479
+ value: k.enum.approveRequest
480
+ },
481
+ rejectRequest: {
482
+ translationKey: "inventory.transfer.receiveRequest.actions.rejectRequest",
483
+ color: "text-fm-color-typo-error",
484
+ value: k.enum.rejectRequest
485
+ },
486
+ processRequest: {
487
+ translationKey: "inventory.transfer.receiveRequest.actions.processRequest",
488
+ color: "text-fm-color-typo-primary",
489
+ value: k.enum.processRequest
490
+ },
491
+ receiveStock: {
492
+ translationKey: "inventory.transfer.receiveRequest.actions.receiveStock",
493
+ color: "text-fm-color-typo-primary",
494
+ value: k.enum.receiveStock
495
+ },
496
+ completeReceive: {
497
+ translationKey: "inventory.transfer.receiveRequest.actions.completeReceive",
498
+ color: "text-fm-color-typo-primary",
499
+ value: k.enum.completeReceive
500
+ },
501
+ closeRequest: {
502
+ translationKey: "inventory.transfer.receiveRequest.actions.closeRequest",
503
+ color: "system-error-300",
504
+ value: k.enum.closeRequest
505
+ },
506
+ approveDraft: {
507
+ translationKey: "",
508
+ color: "",
509
+ value: void 0
510
+ },
511
+ rejectDraft: {
512
+ translationKey: "",
513
+ color: "",
514
+ value: void 0
515
+ },
516
+ returnStock: {
517
+ translationKey: "inventory.transfer.receiveRequest.actions.returnStock",
518
+ color: "text-fm-color-typo-primary",
519
+ value: k.enum.returnStock
520
+ }
521
+ };
522
+ function Bs(m, s) {
523
+ const n = ue(), O = De(), u = qe(), { t: e } = ot();
524
+ function l(i) {
525
+ switch (i.status) {
526
+ case "DRAFT":
527
+ return [
528
+ te[Q.Update],
529
+ te[Q.Details],
530
+ i.supplier.internal === "restaurant" || i.supplier.internal === "warehouse" ? be[k.enum.submitRequest] : be[k.enum.confirmDraft],
531
+ be[k.enum.cancelDraft]
532
+ ];
533
+ case "RECEIVING":
534
+ return [
535
+ be[k.enum.completeReceive],
536
+ te[Q.Details],
537
+ te[Q.Print]
538
+ ];
539
+ case "REQUESTING":
540
+ return m === "receive/request" ? [te[Q.Details], te[Q.Print]] : [
541
+ be[k.enum.approveRequest],
542
+ be[k.enum.rejectRequest],
543
+ te[Q.Details]
544
+ // DefaultRowActions[RowActionEnum.Print]
545
+ ];
546
+ case "PROCESSING":
547
+ return [te[Q.Details], te[Q.Print]];
548
+ case "COMPLETE":
549
+ case "CANCEL":
550
+ default:
551
+ return [te[Q.Details], te[Q.Print]];
552
+ }
553
+ }
554
+ function d(i) {
555
+ return Object.values(k.enum).includes(i);
556
+ }
557
+ async function r(i, c, o) {
558
+ var x, A, H, M;
559
+ const y = et(c);
560
+ if (i === Q.Print) {
561
+ const X = (o == null ? void 0 : o.toInventoryLocation) ?? n.currentLocation;
562
+ y.ref = [((x = o == null ? void 0 : o.netSuite) == null ? void 0 : x.refNo) || ((A = y.netSuite) == null ? void 0 : A.refNo)].filter((se) => se).join(" "), Tt(y, X, u.currentBusiness.value, m === "approval");
563
+ return;
564
+ }
565
+ if (i === Q.Details) {
566
+ s.promptShowTransferDetails(y, o);
567
+ return;
568
+ }
569
+ if (i === Q.Update) {
570
+ (H = s.promptUpdateTransferDialog) == null || H.call(s, y);
571
+ return;
572
+ }
573
+ if (d(i)) {
574
+ s.submitAction(c, i, (M = o == null ? void 0 : o.to) == null ? void 0 : M.dbName);
575
+ return;
576
+ }
577
+ }
578
+ function h() {
579
+ const i = [
580
+ {
581
+ accessorKey: "seqNumber",
582
+ header: () => e("inventory.transfer.table.seqNo"),
583
+ enableSorting: !0,
584
+ size: 80,
585
+ sortUndefined: "last"
586
+ },
587
+ {
588
+ accessorKey: "_id",
589
+ header: () => e("inventory.transfer.table.createdAt"),
590
+ cell(c) {
591
+ return Ne(`${c.getValue()}`);
592
+ },
593
+ enableSorting: !0
594
+ },
595
+ {
596
+ accessorKey: "supplier.name",
597
+ header: () => e("inventory.transfer.table.transferFrom"),
598
+ enableSorting: !0,
599
+ size: 200
600
+ },
601
+ {
602
+ accessorKey: "items.length",
603
+ header: () => e("inventory.transfer.table.noOfItems"),
604
+ enableSorting: !1,
605
+ meta: {
606
+ width: "10rem"
607
+ }
608
+ },
609
+ {
610
+ accessorKey: "ref",
611
+ header: () => e("inventory.transfer.table.reference"),
612
+ enableSorting: !1,
613
+ size: "auto"
614
+ },
615
+ {
616
+ accessorKey: "status",
617
+ header: () => e("inventory.transfer.table.status"),
618
+ cell(c) {
619
+ const o = e(`inventory.transfer.status.${c.getValue() ?? ""}`), y = `${c.getValue() ?? ""}`.toLocaleLowerCase("en-us");
620
+ return q(
621
+ "div",
622
+ {
623
+ class: "flex"
624
+ },
625
+ q(
626
+ "div",
627
+ {
628
+ class: `fm-status-badge fm-status-badge-${y}`
629
+ },
630
+ o
631
+ )
632
+ );
633
+ },
634
+ enableSorting: !0,
635
+ size: 200
636
+ },
637
+ {
638
+ id: "action",
639
+ cell(c) {
640
+ const o = c.row.original, y = l(o);
641
+ return Ye(y, (x) => r(x, o));
642
+ },
643
+ enableSorting: !1,
644
+ size: 40,
645
+ meta: {
646
+ cellClass: "",
647
+ headerClass: ""
648
+ }
649
+ }
650
+ ];
651
+ if (O.isEnabled) {
652
+ const c = [
653
+ {
654
+ id: "netsuiteTransferOrder",
655
+ header: () => "NetSuite Order (ID)",
656
+ cell(o) {
657
+ var x;
658
+ const y = o.row.original;
659
+ return (x = y.netSuite) != null && x.id ? `${y.netSuite.refNo} (${y.netSuite.id})` : "N/A";
660
+ },
661
+ enableSorting: !1,
662
+ size: 200,
663
+ meta: {
664
+ cellClass: "",
665
+ headerClass: ""
666
+ }
667
+ },
668
+ {
669
+ id: "netsuiteTransactionNumber",
670
+ header: () => "NetSuite Transaction No.",
671
+ cell(o) {
672
+ var x, A;
673
+ return ((A = (x = o.row.original.netSuite) == null ? void 0 : x.additionalInfo) == null ? void 0 : A.transactionnumber) ?? "N/A";
674
+ },
675
+ enableSorting: !1,
676
+ size: 200,
677
+ meta: {
678
+ cellClass: "",
679
+ headerClass: ""
680
+ }
681
+ }
682
+ ];
683
+ i.splice(i.length - 2, 0, ...c);
684
+ }
685
+ return i;
686
+ }
687
+ function _() {
688
+ const i = [
689
+ {
690
+ accessorKey: "purchaseOrder.seqNumber",
691
+ header: () => e("inventory.transfer.table.seqNo"),
692
+ enableSorting: !0,
693
+ size: 80,
694
+ sortUndefined: "last"
695
+ },
696
+ {
697
+ accessorKey: "purchaseOrder._id",
698
+ header: () => e("inventory.transfer.table.createdAt"),
699
+ cell(c) {
700
+ return Ne(`${c.getValue()}`);
701
+ },
702
+ enableSorting: !0
703
+ },
704
+ {
705
+ accessorKey: "to.name",
706
+ header: () => e("inventory.transfer.table.transferTo"),
707
+ enableSorting: !1,
708
+ size: 200
709
+ },
710
+ {
711
+ accessorKey: "purchaseOrder.items.length",
712
+ header: () => e("inventory.transfer.table.noOfItems"),
713
+ enableSorting: !1
714
+ },
715
+ {
716
+ accessorKey: "purchaseOrder.ref",
717
+ header: () => e("inventory.transfer.table.reference"),
718
+ enableSorting: !1,
719
+ size: "auto"
720
+ },
721
+ {
722
+ accessorKey: "purchaseOrder.status",
723
+ header: () => e("inventory.transfer.table.status"),
724
+ cell(c) {
725
+ const o = e(`inventory.transfer.status.${c.getValue() ?? ""}`), y = `${c.getValue() ?? ""}`.toLocaleLowerCase("en-us");
726
+ return q(
727
+ "div",
728
+ {
729
+ class: "flex"
730
+ },
731
+ q(
732
+ "div",
733
+ {
734
+ class: `fm-status-badge fm-status-badge-${y}`
735
+ },
736
+ o
737
+ )
738
+ );
739
+ },
740
+ enableSorting: !0
741
+ },
742
+ {
743
+ id: "action",
744
+ cell(c) {
745
+ const o = c.row.original, x = (o.purchaseOrder ? l(o.purchaseOrder) : []).map((A) => A.value === Q.Print ? {
746
+ ...A,
747
+ translationKey: "inventory.transfer.receiveRequest.details.printDeliveryOrder"
748
+ } : A);
749
+ return Ye(
750
+ x,
751
+ (A) => o.purchaseOrder ? r(A, o.purchaseOrder, o) : void 0
752
+ );
753
+ },
754
+ enableSorting: !1,
755
+ size: 40,
756
+ meta: {
757
+ cellClass: "",
758
+ headerClass: ""
759
+ }
760
+ }
761
+ ];
762
+ if (O.isEnabled) {
763
+ const c = [
764
+ {
765
+ id: "netsuiteTransferOrder",
766
+ header: () => "NetSuite Order (ID)",
767
+ cell(o) {
768
+ var x;
769
+ const y = o.row.original;
770
+ return (x = y.netSuite) != null && x.id ? `${y.netSuite.refNo} (${y.netSuite.id})` : "N/A";
771
+ },
772
+ enableSorting: !1,
773
+ size: 200,
774
+ meta: {
775
+ cellClass: "",
776
+ headerClass: ""
777
+ }
778
+ },
779
+ {
780
+ id: "netsuiteTransactionNumber",
781
+ header: () => "NetSuite Transaction No.",
782
+ cell(o) {
783
+ var x, A;
784
+ return ((A = (x = o.row.original.netSuite) == null ? void 0 : x.additionalInfo) == null ? void 0 : A.transactionnumber) ?? "N/A";
785
+ },
786
+ enableSorting: !1,
787
+ size: 200,
788
+ meta: {
789
+ cellClass: "",
790
+ headerClass: ""
791
+ }
792
+ }
793
+ ];
794
+ i.splice(i.length - 2, 0, ...c);
795
+ }
796
+ return i;
797
+ }
798
+ const f = Y(() => m === "receive/request" ? h() : _());
799
+ return {
800
+ get columnDefs() {
801
+ return f.value;
802
+ }
803
+ };
804
+ }
805
+ const Pt = { class: "border border-fm-color-neutral-gray-200 fm-corner-radius-lg p-16" }, Ct = { class: "flex flex-col gap-8" }, It = { class: "flex w-full justify-end gap-16" }, Ft = /* @__PURE__ */ fe({
806
+ __name: "FulfillmentForm",
807
+ props: {
808
+ purchaseOrder: {},
809
+ confirm: { type: Function }
810
+ },
811
+ emits: ["update:show"],
812
+ setup(m, { emit: s }) {
813
+ const n = m, O = ht({
814
+ id: "",
815
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
816
+ items: []
817
+ }), u = U(), e = s;
818
+ return at(() => {
819
+ n.purchaseOrder && (O.items = n.purchaseOrder.items.map((l) => ({
820
+ id: l.id,
821
+ sku: l.sku,
822
+ measurement: l.measurement,
823
+ amount: l.quantity ?? { amount: 1, precision: 0 }
824
+ })));
825
+ }), (l, d) => {
826
+ const r = V("FmTable"), h = V("FmButton"), _ = V("FmForm");
827
+ return g(), ne(_, {
828
+ ref_key: "formRef",
829
+ ref: u,
830
+ class: "bg-white flex flex-col gap-32 rounded-3xl p-24 w-[800px]",
831
+ onValidationFailed: console.log,
832
+ onValidationSuccess: d[1] || (d[1] = () => n.confirm(O))
833
+ }, {
834
+ default: re(() => [
835
+ d[2] || (d[2] = a("div", { class: "fm-typo-en-title-sm-600" }, "Confirm the transfer amount", -1)),
836
+ a("div", Pt, [
837
+ a("div", Ct, [
838
+ C(r, {
839
+ "column-defs": [
840
+ {
841
+ header: "Code",
842
+ cell: (f) => {
843
+ const i = n.purchaseOrder.items.find((c) => c.id === f.row.original.id || c.sku._id === f.row.original.sku._id);
844
+ return q(
845
+ b(Je).FmTooltip,
846
+ {
847
+ content: i.code,
848
+ placement: "top",
849
+ variant: "plain",
850
+ zIndex: 50
851
+ },
852
+ q(
853
+ "span",
854
+ {
855
+ class: "flex-auto line-clamp-2 text-ellipsis break-all"
856
+ },
857
+ i.code
858
+ )
859
+ );
860
+ }
861
+ },
862
+ {
863
+ header: "Name",
864
+ cell: (f) => {
865
+ const i = n.purchaseOrder.items.find((c) => c.id === f.row.original.id || c.sku._id === f.row.original.sku._id);
866
+ return q(
867
+ b(Je).FmTooltip,
868
+ {
869
+ content: i.name,
870
+ placement: "top",
871
+ variant: "plain",
872
+ zIndex: 50
873
+ },
874
+ q(
875
+ "span",
876
+ {
877
+ class: "flex-auto line-clamp-2 text-ellipsis break-all"
878
+ },
879
+ i.name
880
+ )
881
+ );
882
+ }
883
+ },
884
+ {
885
+ header: "Amount",
886
+ cell: (f) => {
887
+ const i = f.row.original, c = n.purchaseOrder.items.find((y) => y.id === i.id || y.sku._id === i.sku._id), o = i.amount ?? {
888
+ amount: 1,
889
+ precision: 0
890
+ };
891
+ return q(xt, {
892
+ style: {
893
+ flex: "1 1 0%"
894
+ },
895
+ modelValue: {
896
+ amount: o,
897
+ measurement: i.measurement ?? null
898
+ },
899
+ key: i.id ?? i.sku._id,
900
+ unit: i.sku.unit,
901
+ "onUpdate:modelValue": (y) => {
902
+ if (!y) return;
903
+ const x = O.items.find((A) => A.id === i.id || A.sku._id === i.sku._id);
904
+ x && (x.amount = y.amount);
905
+ },
906
+ disableUnit: !0,
907
+ rules: [
908
+ b(Nt)(
909
+ +b(le)({ amount: 0, precision: 0 })
910
+ ),
911
+ b(Dt)(+b(le)(c.quantity))
912
+ ],
913
+ applyDefaultRules: !0
914
+ });
915
+ }
916
+ }
917
+ ],
918
+ "row-data": O.items,
919
+ "hide-footer": !0
920
+ }, null, 8, ["column-defs", "row-data"])
921
+ ])
922
+ ]),
923
+ a("div", It, [
924
+ C(h, {
925
+ class: "px-16",
926
+ label: "Confirm",
927
+ size: "md",
928
+ variant: "primary",
929
+ type: "submit"
930
+ }),
931
+ C(h, {
932
+ class: "px-16",
933
+ label: "Cancel",
934
+ size: "md",
935
+ variant: "secondary",
936
+ onClick: d[0] || (d[0] = () => e("update:show", !1))
937
+ })
938
+ ])
939
+ ]),
940
+ _: 1
941
+ }, 8, ["onValidationFailed"]);
942
+ };
943
+ }
944
+ }), Be = {
945
+ submitRequest: {
946
+ translationKey: "inventory.transfer.receiveRequest.actions.submitRequest",
947
+ color: "primary",
948
+ buttonVariant: Z.Primary
949
+ },
950
+ confirmDraft: {
951
+ translationKey: "inventory.transfer.receiveRequest.actions.confirmDraft",
952
+ color: "primary",
953
+ buttonVariant: Z.Primary
954
+ },
955
+ cancelDraft: {
956
+ translationKey: "inventory.transfer.receiveRequest.actions.cancelDraft",
957
+ color: "system-error-300",
958
+ buttonVariant: Z.Destructive
959
+ },
960
+ approveDraft: {
961
+ translationKey: "inventory.transfer.receiveRequest.actions.approveDraft",
962
+ color: "primary",
963
+ buttonVariant: Z.Primary
964
+ },
965
+ rejectDraft: {
966
+ translationKey: "inventory.transfer.receiveRequest.actions.rejectDraft",
967
+ color: "system-error-300",
968
+ buttonVariant: Z.Destructive
969
+ },
970
+ approveRequest: {
971
+ translationKey: "inventory.transfer.receiveRequest.actions.approveRequest",
972
+ color: "primary",
973
+ buttonVariant: Z.Primary
974
+ },
975
+ processRequest: {
976
+ translationKey: "inventory.transfer.receiveRequest.actions.processRequest",
977
+ color: "primary",
978
+ buttonVariant: Z.Primary
979
+ },
980
+ receiveStock: {
981
+ translationKey: "inventory.transfer.receiveRequest.actions.receiveStock",
982
+ color: "primary",
983
+ buttonVariant: Z.Primary,
984
+ available: !1
985
+ },
986
+ completeReceive: {
987
+ translationKey: "inventory.transfer.receiveRequest.actions.completeReceive",
988
+ color: "primary",
989
+ buttonVariant: Z.Plain
990
+ },
991
+ rejectRequest: {
992
+ translationKey: "inventory.transfer.receiveRequest.actions.rejectRequest",
993
+ color: "system-error-300",
994
+ buttonVariant: Z.Destructive
995
+ },
996
+ closeRequest: {
997
+ translationKey: "inventory.transfer.receiveRequest.actions.closeRequest",
998
+ color: "system-error-300",
999
+ buttonVariant: Z.Destructive,
1000
+ available: !1
1001
+ },
1002
+ returnStock: {
1003
+ translationKey: "inventory.transfer.receiveRequest.actions.returnStock",
1004
+ color: "primary",
1005
+ buttonVariant: Z.Primary,
1006
+ available: !1
1007
+ }
1008
+ };
1009
+ function Et() {
1010
+ const m = $e();
1011
+ return {
1012
+ ableToMarkReceived(s) {
1013
+ if (!s || s.status !== ce.enum.RECEIVING)
1014
+ return !1;
1015
+ const O = ue().currentLocationDBName;
1016
+ return `${s.supplier.internal}_${s.supplier._id}` !== O;
1017
+ },
1018
+ ableToMarkApproved(s) {
1019
+ return !(!s || (s == null ? void 0 : s.status) !== ce.enum.REQUESTING);
1020
+ },
1021
+ ableToCreateFulfillment(s, n) {
1022
+ var e, l;
1023
+ if (!m.acceptRequireFulfillment || !s || !n || s.status !== ce.enum.PROCESSING || !n.processedAt)
1024
+ return !1;
1025
+ const O = (e = n == null ? void 0 : n.from) == null ? void 0 : e.dbName, u = (l = n == null ? void 0 : n.to) == null ? void 0 : l.dbName;
1026
+ return !(O.startsWith("restaurant_") && u.startsWith("restaurant_"));
1027
+ }
1028
+ };
1029
+ }
1030
+ const Bt = { class: "flex flex-row-reverse" }, Lt = /* @__PURE__ */ fe({
1031
+ __name: "NetSuiteSync",
1032
+ props: {
1033
+ poRequest: {},
1034
+ purchaseOrder: {},
1035
+ isTransferBetweenOutlets: { type: Boolean },
1036
+ scope: {}
1037
+ },
1038
+ setup(m) {
1039
+ const s = m, n = De(), O = Ae(), u = Me(), e = U(!1);
1040
+ Y(() => {
1041
+ var _, f, i, c;
1042
+ let d = !0;
1043
+ n.isEnabled || (d = !1);
1044
+ const r = s.purchaseOrder, h = s.poRequest;
1045
+ return r && ((_ = r == null ? void 0 : r.supplier) != null && _.internal ? (!h && r.status == ce.enum.DRAFT && (d = !1), h && !((f = h == null ? void 0 : h.netSuite) != null && f.id) && (d = !1), s.isTransferBetweenOutlets && (d = !1)) : ((r == null ? void 0 : r.status) !== ce.enum.REQUESTING && r.supplier.internal && (d = !1), !h && !((i = r == null ? void 0 : r.netSuite) != null && i.id) && (d = !1), !h && ((c = r == null ? void 0 : r.netSuite) != null && c.id) && (r == null ? void 0 : r.status) == ce.enum.REQUESTING && (d = !1))), d;
1046
+ });
1047
+ async function l() {
1048
+ e.value || u.open({
1049
+ title: "Sync with NetSuite",
1050
+ contentComponent: q("div", [
1051
+ q("p", "Are you sure you want to sync now?"),
1052
+ q("br"),
1053
+ q(
1054
+ "p",
1055
+ { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" },
1056
+ "Please wait a moment before syncing manually to avoid unnecessary actions."
1057
+ )
1058
+ ]),
1059
+ primaryActions: {
1060
+ text: "Sync",
1061
+ close: !0,
1062
+ variant: "destructive"
1063
+ },
1064
+ secondaryActions: { text: "Not now", close: !0 }
1065
+ }).onPrimary(async () => {
1066
+ var d, r, h;
1067
+ try {
1068
+ e.value = !0;
1069
+ const _ = ((d = s.purchaseOrder) == null ? void 0 : d._id) || ((r = s.poRequest) == null ? void 0 : r.purchaseOrderId) || "", f = (h = s.poRequest) == null ? void 0 : h.to.dbName;
1070
+ await n.syncPurchaseOrder(
1071
+ _,
1072
+ s.scope === "approval" ? f : void 0
1073
+ ), O.open({
1074
+ title: "Sync with NetSuite",
1075
+ message: "Requested to sync with NetSuite. Please wait a moment.",
1076
+ type: "success"
1077
+ }), await new Promise((i) => setTimeout(i, 5e3)), e.value = !1;
1078
+ } catch {
1079
+ O.open({
1080
+ title: "Error",
1081
+ message: "Failed to sync with NetSuite",
1082
+ type: "error"
1083
+ }), e.value = !1;
1084
+ }
1085
+ });
1086
+ }
1087
+ return (d, r) => {
1088
+ const h = V("FmButton");
1089
+ return g(), R("div", Bt, [
1090
+ C(h, {
1091
+ "prepend-icon": "sync",
1092
+ variant: "secondary",
1093
+ label: "Sync",
1094
+ loading: e.value,
1095
+ onClick: l,
1096
+ "text-color": "primary",
1097
+ "bg-color": "transparent",
1098
+ "border-color": "primary"
1099
+ }, null, 8, ["loading"])
1100
+ ]);
1101
+ };
1102
+ }
1103
+ }), Ut = {
1104
+ key: 0,
1105
+ class: "flex flex-col gap-8"
1106
+ }, Vt = { class: "flex flex-col gap-4" }, Mt = { class: "fm-typo-en-body-lg-600" }, jt = {
1107
+ key: 0,
1108
+ class: "flex flex-col gap-4"
1109
+ }, Kt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, zt = { class: "fm-typo-en-body-lg-600" }, Ht = { key: 0 }, Gt = { key: 1 }, Wt = {
1110
+ key: 1,
1111
+ class: "flex flex-col gap-4"
1112
+ }, Qt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Yt = { class: "fm-typo-en-body-lg-600" }, Xt = { key: 0 }, Jt = { key: 1 }, Zt = {
1113
+ key: 2,
1114
+ class: "flex flex-col gap-4"
1115
+ }, er = { class: "fm-typo-en-body-lg-600" }, tr = {
1116
+ key: 3,
1117
+ class: "flex flex-col gap-4"
1118
+ }, rr = { class: "fm-typo-en-body-lg-600" }, sr = /* @__PURE__ */ fe({
1119
+ __name: "NetSuiteInfo",
1120
+ props: {
1121
+ transferType: {},
1122
+ transferToDbName: {},
1123
+ poRequest: {},
1124
+ purchaseOrder: {},
1125
+ isTransferBetweenOutlets: { type: Boolean },
1126
+ scope: {}
1127
+ },
1128
+ setup(m) {
1129
+ const s = m, n = De(), O = Te(), u = U(s.poRequest);
1130
+ at(async () => {
1131
+ var r;
1132
+ if (!s.poRequest && ((r = s.purchaseOrder) != null && r._id)) {
1133
+ const h = await O.getLatestPurchaseOrderRequest(s.purchaseOrder._id);
1134
+ u.value = h;
1135
+ }
1136
+ });
1137
+ const e = Y(
1138
+ () => {
1139
+ var r, h, _, f, i, c;
1140
+ return n.getSubsidiaryFullName(
1141
+ ((_ = (h = (r = s.purchaseOrder) == null ? void 0 : r.netSuite) == null ? void 0 : h.subsidiary) == null ? void 0 : _.id) || ((c = (i = (f = s.poRequest) == null ? void 0 : f.netSuite) == null ? void 0 : i.subsidiary) == null ? void 0 : c.id)
1142
+ ).fullName;
1143
+ }
1144
+ ), l = Y(() => {
1145
+ var r, h, _, f, i, c, o, y, x, A, H, M;
1146
+ return (_ = (h = (r = s.purchaseOrder) == null ? void 0 : r.netSuite) == null ? void 0 : h.additionalInfo) != null && _.transactionnumber ? (c = (i = (f = s.purchaseOrder) == null ? void 0 : f.netSuite) == null ? void 0 : i.additionalInfo) == null ? void 0 : c.transactionnumber : (x = (y = (o = u.value) == null ? void 0 : o.netSuite) == null ? void 0 : y.additionalInfo) != null && x.transactionnumber ? (M = (H = (A = u.value) == null ? void 0 : A.netSuite) == null ? void 0 : H.additionalInfo) == null ? void 0 : M.transactionnumber : null;
1147
+ }), d = Y(() => {
1148
+ var r, h, _, f, i, c;
1149
+ return (h = (r = s.purchaseOrder) == null ? void 0 : r.deliveryFullfillment) != null && h.length && ((f = (_ = s.purchaseOrder) == null ? void 0 : _.deliveryFullfillment) == null ? void 0 : f.length) > 0 ? (c = (i = s.purchaseOrder) == null ? void 0 : i.deliveryFullfillment) == null ? void 0 : c.map((o) => {
1150
+ var y;
1151
+ return (y = o.netSuite) == null ? void 0 : y.refNo;
1152
+ }).join(", ") : "N/A";
1153
+ });
1154
+ return (r, h) => {
1155
+ var _, f, i, c, o, y, x, A, H, M, X, se, J, pe, oe, ye;
1156
+ return b(n).isEnabled ? (g(), R("div", Ut, [
1157
+ a("div", Vt, [
1158
+ h[0] || (h[0] = a("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, "NetSuite subsidiary", -1)),
1159
+ a("div", Mt, N(e.value || "N/A"), 1)
1160
+ ]),
1161
+ !r.isTransferBetweenOutlets && r.scope === b(Ue).RECEIVE_REQUEST ? (g(), R("div", jt, [
1162
+ a("div", Kt, " NetSuite " + N((f = (_ = r.purchaseOrder) == null ? void 0 : _.netSuite) != null && f.recordType ? b(rt)((c = (i = r.purchaseOrder) == null ? void 0 : i.netSuite) == null ? void 0 : c.recordType) : r.transferType === b(me).PURCHASE ? "Purchase Order" : "Transfer Order") + " (ID) ", 1),
1163
+ a("div", zt, [
1164
+ (y = (o = r.purchaseOrder) == null ? void 0 : o.netSuite) != null && y.id ? (g(), R("span", Ht, N((A = (x = r.purchaseOrder) == null ? void 0 : x.netSuite) == null ? void 0 : A.refNo) + " (" + N((M = (H = r.purchaseOrder) == null ? void 0 : H.netSuite) == null ? void 0 : M.id) + ") ", 1)) : (g(), R("span", Gt, "N/A"))
1165
+ ])
1166
+ ])) : L("", !0),
1167
+ !r.isTransferBetweenOutlets && u.value || r.scope === b(Ue).APPROVAL ? (g(), R("div", Wt, [
1168
+ a("div", Qt, " (Request) NetSuite " + N(r.transferType === b(me).PURCHASE ? "Purchase Order" : "Transfer Order") + " (ID) ", 1),
1169
+ a("div", Yt, [
1170
+ (se = (X = u.value) == null ? void 0 : X.netSuite) != null && se.id ? (g(), R("span", Xt, N((pe = (J = u.value) == null ? void 0 : J.netSuite) == null ? void 0 : pe.refNo) + " (" + N((ye = (oe = u.value) == null ? void 0 : oe.netSuite) == null ? void 0 : ye.id) + ") ", 1)) : (g(), R("span", Jt, "N/A"))
1171
+ ])
1172
+ ])) : L("", !0),
1173
+ l.value ? (g(), R("div", Zt, [
1174
+ h[1] || (h[1] = a("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " NetSuite Transaction Number ", -1)),
1175
+ a("div", er, N(l.value), 1)
1176
+ ])) : L("", !0),
1177
+ b(n).isEnabled && r.transferType === b(me).TRANSFER && !r.isTransferBetweenOutlets ? (g(), R("div", tr, [
1178
+ h[2] || (h[2] = a("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " NetSuite fulfillment IDs ", -1)),
1179
+ a("div", rr, N(d.value), 1)
1180
+ ])) : L("", !0)
1181
+ ])) : L("", !0);
1182
+ };
1183
+ }
1184
+ }), ar = { class: "flex flex-row-reverse" }, nr = /* @__PURE__ */ fe({
1185
+ __name: "NetSuiteLog",
1186
+ props: {
1187
+ netsuiteId: {},
1188
+ purchaseOrderId: {}
1189
+ },
1190
+ setup(m) {
1191
+ const s = Ae(), n = st();
1192
+ async function O(u, e) {
1193
+ let l = `attributes.pod:netsuite* AND body.message:*${u}*`;
1194
+ if (e) {
1195
+ const r = e.replace(/:/g, "\\:");
1196
+ l = `attributes.pod:netsuite* AND (body.message:*${u}* OR ${r})`;
1197
+ }
1198
+ const { url: d } = await n.getLogs(l);
1199
+ s.open(
1200
+ {
1201
+ message: "Opening NetSuite logs...",
1202
+ type: "info"
1203
+ },
1204
+ 800
1205
+ ), await new Promise((r) => setTimeout(r, 800)), window.open(d, "_blank");
1206
+ }
1207
+ return (u, e) => {
1208
+ const l = V("FmButton");
1209
+ return g(), R("div", ar, [
1210
+ C(l, {
1211
+ "prepend-icon": "history",
1212
+ variant: "secondary",
1213
+ label: "Logs",
1214
+ onClick: e[0] || (e[0] = (d) => O(u.netsuiteId, u.purchaseOrderId)),
1215
+ "text-color": "primary",
1216
+ "bg-color": "transparent",
1217
+ "border-color": "primary"
1218
+ })
1219
+ ]);
1220
+ };
1221
+ }
1222
+ }), or = { class: "flex flex-row-reverse" }, ir = { key: 0 }, lr = {
1223
+ key: 1,
1224
+ class: "w-[480px]"
1225
+ }, cr = { class: "fm-typo-en-body-md-400" }, ur = { key: 0 }, dr = { key: 1 }, mr = { key: 1 }, fr = /* @__PURE__ */ fe({
1226
+ __name: "NetSuiteLatestInfo",
1227
+ props: {
1228
+ netsuiteId: {},
1229
+ purchaseOrderId: {}
1230
+ },
1231
+ setup(m) {
1232
+ const s = m, n = st(), O = U(!1), u = ue(), e = U(!0), l = U(!1), d = U(null);
1233
+ async function r() {
1234
+ if (!d.value) {
1235
+ O.value = !0;
1236
+ try {
1237
+ e.value = !0;
1238
+ const h = await n.getMoreInfo(
1239
+ u.currentLocation.dbName,
1240
+ s.purchaseOrderId
1241
+ );
1242
+ d.value = h, l.value = !1;
1243
+ } catch {
1244
+ l.value = !0;
1245
+ } finally {
1246
+ e.value = !1;
1247
+ }
1248
+ }
1249
+ }
1250
+ return (h, _) => {
1251
+ const f = V("FmButton"), i = V("FmLabel"), c = V("FmDialog");
1252
+ return g(), R("div", or, [
1253
+ C(c, {
1254
+ modelValue: O.value,
1255
+ "onUpdate:modelValue": _[2] || (_[2] = (o) => O.value = o),
1256
+ overlay: !0
1257
+ }, {
1258
+ "dialog-button": re(() => [
1259
+ C(f, {
1260
+ "prepend-icon": "info",
1261
+ variant: "secondary",
1262
+ label: "Latest Info",
1263
+ onClick: _[0] || (_[0] = (o) => r()),
1264
+ "text-color": "primary",
1265
+ "bg-color": "transparent",
1266
+ "border-color": "primary"
1267
+ })
1268
+ ]),
1269
+ "dialog-header": re(() => _[3] || (_[3] = [
1270
+ a("div", null, "NetSuite latest info", -1)
1271
+ ])),
1272
+ "dialog-footer": re(() => [
1273
+ C(f, {
1274
+ class: "ml-auto sm:w-full xs:w-full",
1275
+ label: "Close",
1276
+ size: "md",
1277
+ variant: "primary",
1278
+ onClick: _[1] || (_[1] = (o) => O.value = !1)
1279
+ })
1280
+ ]),
1281
+ default: re(() => [
1282
+ e.value ? (g(), R("div", ir, "Loading...")) : (g(), R("div", lr, [
1283
+ l.value ? (g(), R("p", mr, "Something went wrong.")) : (g(!0), R(ee, { key: 0 }, de(d.value, (o, y) => (g(), R("div", {
1284
+ key: y,
1285
+ class: "mb-2"
1286
+ }, [
1287
+ a("div", null, [
1288
+ C(i, {
1289
+ label: b(Ve)(y)
1290
+ }, null, 8, ["label"]),
1291
+ a("div", cr, [
1292
+ Array.isArray(o) ? (g(), R("span", ur, N(o.length > 0 ? o.join(", ") : "N/A"), 1)) : (g(), R("span", dr, N(o), 1))
1293
+ ])
1294
+ ])
1295
+ ]))), 128))
1296
+ ]))
1297
+ ]),
1298
+ _: 1
1299
+ }, 8, ["modelValue"])
1300
+ ]);
1301
+ };
1302
+ }
1303
+ }), pr = {
1304
+ key: 0,
1305
+ class: "border border-fm-color-neutral-gray-200 fm-corner-radius-lg p-16 flex flex-col gap-8"
1306
+ }, yr = { class: "flex gap-8 items-center" }, vr = { class: "ml-auto" }, hr = { class: "flex gap-4" }, br = /* @__PURE__ */ fe({
1307
+ __name: "NetSuitePanel",
1308
+ props: {
1309
+ poRequest: {},
1310
+ purchaseOrder: {},
1311
+ transferType: {},
1312
+ transferToDbName: {},
1313
+ scope: {}
1314
+ },
1315
+ setup(m) {
1316
+ const s = m, n = At(), O = qe(), u = Y(() => {
1317
+ var r, h, _, f, i, c, o;
1318
+ const e = ((r = s.transferToDbName) == null ? void 0 : r.startsWith("restaurant")) && ((_ = (h = s.purchaseOrder) == null ? void 0 : h.supplier) == null ? void 0 : _.internal) === "restaurant", l = s.transferType === me.PURCHASE, d = s.transferType === me.TRANSFER;
1319
+ return l || d && !e || ((i = (f = s.purchaseOrder) == null ? void 0 : f.netSuite) == null ? void 0 : i.id) || ((o = (c = s.poRequest) == null ? void 0 : c.netSuite) == null ? void 0 : o.id);
1320
+ });
1321
+ return (e, l) => {
1322
+ var r, h, _, f, i, c, o, y, x, A, H, M;
1323
+ const d = V("FmMenuDivider");
1324
+ return b(n).isNetSuiteEnabled && u.value ? (g(), R("div", pr, [
1325
+ a("div", yr, [
1326
+ l[0] || (l[0] = a("span", { class: "flex-1 fm-typo-en-body-lg-600" }, "NetSuite Info", -1)),
1327
+ a("div", vr, [
1328
+ a("div", hr, [
1329
+ (r = b(O).sessionUser.value) != null && r.role.isAdmin && ((_ = (h = s.purchaseOrder) == null ? void 0 : h.netSuite) != null && _.id) ? (g(), ne(fr, {
1330
+ key: 0,
1331
+ "netsuite-id": (i = (f = e.purchaseOrder) == null ? void 0 : f.netSuite) == null ? void 0 : i.id,
1332
+ "purchase-order-id": (c = e.purchaseOrder) == null ? void 0 : c._id
1333
+ }, null, 8, ["netsuite-id", "purchase-order-id"])) : L("", !0),
1334
+ (o = b(O).sessionUser.value) != null && o.role.isAdmin && ((x = (y = s.purchaseOrder) == null ? void 0 : y.netSuite) != null && x.id) ? (g(), ne(nr, {
1335
+ key: 1,
1336
+ "netsuite-id": (H = (A = e.purchaseOrder) == null ? void 0 : A.netSuite) == null ? void 0 : H.id,
1337
+ "purchase-order-id": (M = e.purchaseOrder) == null ? void 0 : M._id
1338
+ }, null, 8, ["netsuite-id", "purchase-order-id"])) : L("", !0),
1339
+ C(Lt, {
1340
+ "po-request": e.poRequest,
1341
+ "purchase-order": e.purchaseOrder,
1342
+ "is-transfer-between-outlets": !u.value,
1343
+ scope: e.scope
1344
+ }, null, 8, ["po-request", "purchase-order", "is-transfer-between-outlets", "scope"])
1345
+ ])
1346
+ ])
1347
+ ]),
1348
+ C(d),
1349
+ C(sr, {
1350
+ "po-request": e.poRequest,
1351
+ "purchase-order": e.purchaseOrder,
1352
+ "transfer-type": e.transferType,
1353
+ "transfer-to-db-name": e.transferToDbName,
1354
+ "is-transfer-between-outlets": !u.value,
1355
+ scope: e.scope
1356
+ }, null, 8, ["po-request", "purchase-order", "transfer-type", "transfer-to-db-name", "is-transfer-between-outlets", "scope"])
1357
+ ])) : L("", !0);
1358
+ };
1359
+ }
1360
+ }), gr = { class: "flex flex-col gap-16 w-full h-full" }, _r = { class: "flex justify-between" }, Sr = { class: "fm-typo-en-body-lg-600" }, wr = { class: "flex flex-col gap-8" }, Rr = { class: "flex flex-col gap-4" }, Or = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, kr = { class: "flex gap-1" }, xr = { class: "fm-typo-en-body-lg-600" }, Nr = {
1361
+ key: 0,
1362
+ class: "flex flex-col gap-4"
1363
+ }, Dr = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, qr = { class: "fm-typo-en-body-lg-600" }, Ar = { class: "flex flex-col gap-4" }, $r = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Tr = { class: "fm-typo-en-body-lg-600" }, Pr = {
1364
+ key: 1,
1365
+ class: "flex flex-col gap-4"
1366
+ }, Cr = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ir = { class: "fm-typo-en-body-lg-600" }, Fr = {
1367
+ key: 2,
1368
+ class: "flex flex-col gap-4"
1369
+ }, Er = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Br = { class: "fm-typo-en-body-lg-600" }, Lr = {
1370
+ key: 3,
1371
+ class: "flex flex-col gap-4"
1372
+ }, Ur = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Vr = { class: "fm-typo-en-body-lg-600" }, Mr = {
1373
+ key: 4,
1374
+ class: "flex flex-col gap-4"
1375
+ }, jr = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Kr = { class: "fm-typo-en-body-lg-600" }, zr = { class: "border border-fm-color-neutral-gray-200 fm-corner-radius-lg p-16" }, Hr = { class: "flex flex-col gap-8" }, Gr = { class: "flex gap-8 items-center" }, Wr = { class: "flex-1 fm-typo-en-body-lg-600" }, Qr = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary flex flex-col gap-4" }, Yr = { class: "flex w-full gap-4" }, Xr = { class: "basis-1/2 shrink-0 grow fm-typo-en-body-lg-400 line-clamp-2" }, Jr = { class: "fm-typo-en-body-lg-600 line-clamp-2" }, Zr = { class: "flex w-full gap-4 fm-typo-en-body-sm-400" }, es = { class: "grow fm-typo-en-body-lg-400 text-fm-color-typo-secondary line-clamp-1" }, ts = {
1376
+ key: 0,
1377
+ class: "line-clamp-1 fm-typo-en-body-lg-400 text-fm-color-typo-secondary"
1378
+ }, rs = { class: "py-8" }, ss = { class: "flex justify-end gap-4 items-center" }, as = { class: "fm-typo-en-body-lg-600" }, ns = {
1379
+ key: 1,
1380
+ class: "flex-1 xs:w-screen xs:max-w-full"
1381
+ }, os = {
1382
+ key: 0,
1383
+ class: "flex flex-col items-center gap-8 h-full"
1384
+ }, is = ["src"], ls = { class: "fm-typo-en-body-lg-600" }, cs = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary px-16" }, us = {
1385
+ key: 1,
1386
+ class: "px-4 flex flex-col"
1387
+ }, ds = { class: "flex gap-12 content-stretch" }, ms = {
1388
+ class: "flex flex-col w-24",
1389
+ name: "circles"
1390
+ }, fs = { class: "flex-1 flex flex-col items-center" }, ps = { class: "flex-1 flex flex-col items-center" }, ys = {
1391
+ class: "py-12 flex flex-col gap-4",
1392
+ name: "received-at header"
1393
+ }, vs = { class: "fm-typo-en-body-lg-400" }, hs = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, bs = { class: "flex gap-12 content-stretch" }, gs = {
1394
+ class: "flex flex-col w-24",
1395
+ name: "circles"
1396
+ }, _s = { class: "flex-1 flex flex-col items-center" }, Ss = {
1397
+ class: "py-12 flex flex-col gap-4 flex-1",
1398
+ name: "delivery details"
1399
+ }, ws = { class: "flex flex-col gap-8" }, Rs = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, Os = { class: "flex flex-col gap-4" }, ks = { class: "flex gap-8 xs:flex-col" }, Ls = /* @__PURE__ */ fe({
1400
+ __name: "TransferDetails",
1401
+ props: {
1402
+ poRequest: {},
1403
+ purchaseOrder: {},
1404
+ transferTo: {},
1405
+ transferToDbName: {},
1406
+ show: { type: Boolean },
1407
+ canResubmit: { type: Boolean },
1408
+ canApprove: { type: Boolean },
1409
+ scope: {}
1410
+ },
1411
+ emits: ["update:show", "submitted"],
1412
+ setup(m, { emit: s }) {
1413
+ const n = m, O = s, u = Me(), e = Ae(), l = $e(), d = ue(), r = qe(), h = Y(
1414
+ () => {
1415
+ var t, p;
1416
+ return {
1417
+ id: ((t = r.sessionUser.value) == null ? void 0 : t.id) ?? "",
1418
+ name: ((p = r.sessionUser.value) == null ? void 0 : p.displayName) ?? ""
1419
+ };
1420
+ }
1421
+ ), _ = Et(), { t: f } = ot(), i = Y(
1422
+ () => {
1423
+ var t, p, w, S;
1424
+ return ((p = (t = n.purchaseOrder) == null ? void 0 : t.supplier) == null ? void 0 : p.internal) === "restaurant" || ((S = (w = n.purchaseOrder) == null ? void 0 : w.supplier) == null ? void 0 : S.internal) === "warehouse" ? me.TRANSFER : me.PURCHASE;
1425
+ }
1426
+ ), c = U(!1), o = U(""), y = U(!0), x = Te(), A = qt(x.getWorkflowConfig), H = lt(), M = Y(() => {
1427
+ if (!n.purchaseOrder)
1428
+ return [];
1429
+ const t = A.result.value;
1430
+ if (t.state === Ze.loading)
1431
+ return [];
1432
+ const p = {
1433
+ user: h.value,
1434
+ executedAt: d.locations.computeFirst(
1435
+ (S) => {
1436
+ var $;
1437
+ return S.dbName === (($ = d._currentLocation) == null ? void 0 : $.dbName) ? S : null;
1438
+ }
1439
+ ),
1440
+ purchaseOrderRequest: n.poRequest,
1441
+ purchaseOrder: n.purchaseOrder
1442
+ };
1443
+ let w = [];
1444
+ try {
1445
+ t.state === Ze.error ? (console.error("Error fetching workflow config:", t.error), w = Fe.getAvailableActions({
1446
+ ...p,
1447
+ orderConfig: Fe.getDefaultConfig()
1448
+ }).actions.filter(
1449
+ (S) => (
1450
+ // TODO: create receiveStock & processRequest dialog
1451
+ // to create their payload
1452
+ S !== k.enum.receiveStock && S !== k.enum.processRequest && S !== k.enum.closeRequest
1453
+ )
1454
+ )) : w = Fe.getAvailableActions({
1455
+ ...p,
1456
+ orderConfig: t.data
1457
+ }).actions.filter(
1458
+ (S) => S !== k.enum.receiveStock && S !== k.enum.processRequest && S !== k.enum.closeRequest
1459
+ );
1460
+ } catch (S) {
1461
+ console.error("Error getting available actions:", S);
1462
+ }
1463
+ return n.scope === "approval" && (w = w.filter((S) => S !== k.enum.completeReceive)), w;
1464
+ }), X = kt(n, "show"), se = Y(() => [
1465
+ {
1466
+ label: f("inventory.transfer.receiveRequest.details.overview"),
1467
+ value: "overview"
1468
+ },
1469
+ {
1470
+ label: f("inventory.transfer.receiveRequest.details.deliveryHistory"),
1471
+ value: "deliveryHistory"
1472
+ }
1473
+ ]), J = U(se.value[0]);
1474
+ bt(
1475
+ () => n.show,
1476
+ (t) => {
1477
+ t && (J.value = se.value[0]);
1478
+ }
1479
+ );
1480
+ async function pe(t, p, w, S, $) {
1481
+ return new Promise((K, G) => {
1482
+ u.open({
1483
+ closeButton: !1,
1484
+ title: S.title,
1485
+ message: S.message,
1486
+ primaryActions: S.primaryActions,
1487
+ secondaryActions: { text: "No", close: !1 }
1488
+ }).onPrimary(async () => {
1489
+ var T, I, j, F;
1490
+ const v = [];
1491
+ w === k.enum.approveRequest ? (v.push({
1492
+ action: "approveRequest",
1493
+ payload: null
1494
+ }), p.fulfillment && v.push({
1495
+ action: "processRequest",
1496
+ payload: {
1497
+ fulfillmentId: "",
1498
+ deliveryOrderNumber: "",
1499
+ deliveryRemark: null,
1500
+ items: p.fulfillment.items,
1501
+ createdBy: h.value
1502
+ }
1503
+ })) : w === k.enum.processRequest && p.fulfillment && v.push({
1504
+ action: "processRequest",
1505
+ payload: {
1506
+ fulfillmentId: "",
1507
+ deliveryOrderNumber: "",
1508
+ deliveryRemark: null,
1509
+ items: p.fulfillment.items,
1510
+ createdBy: h.value
1511
+ }
1512
+ });
1513
+ try {
1514
+ await H({
1515
+ operate: {
1516
+ operation: w,
1517
+ doc: t,
1518
+ options: p
1519
+ },
1520
+ operateV2: {
1521
+ _id: ((T = n.purchaseOrder) == null ? void 0 : T._id) ?? "",
1522
+ _rev: ((I = n.purchaseOrder) == null ? void 0 : I._rev) ?? "",
1523
+ action: w,
1524
+ payloads: v
1525
+ // add payload if action is receiveStock or processRequest
1526
+ },
1527
+ transferTo: (F = (j = n.poRequest) == null ? void 0 : j.to) == null ? void 0 : F.dbName
1528
+ }).delayed(1e3), K("submitted");
1529
+ } catch (W) {
1530
+ G(W);
1531
+ }
1532
+ }).onSecondary(() => {
1533
+ K("cancelled");
1534
+ for (let v = 0; v < $ + 2; v++)
1535
+ u.close();
1536
+ }).onClose(() => {
1537
+ });
1538
+ });
1539
+ }
1540
+ async function oe(t) {
1541
+ var S, $, K, G;
1542
+ if (t === k.enum.receiveStock)
1543
+ return;
1544
+ const p = it[t];
1545
+ if (!p) {
1546
+ e.open({
1547
+ title: "Something went wrong",
1548
+ message: `Cannot process order: ${Ve(t)}`,
1549
+ type: "error"
1550
+ });
1551
+ return;
1552
+ }
1553
+ const { successMessage: w } = p;
1554
+ if (n.purchaseOrder) {
1555
+ o.value = `${t}`, c.value = !0, y.value = !1;
1556
+ const v = {};
1557
+ let T = 0;
1558
+ if ((t === k.enum.confirmDraft || // auto receive for warehouse to warehouse
1559
+ t === k.enum.completeReceive) && l.autoReceiveWarehouse)
1560
+ v.autoReceive = !0;
1561
+ else if ((t === k.enum.approveRequest || t === k.enum.processRequest) && l.acceptRequireFulfillment) {
1562
+ const I = ($ = (S = n.poRequest) == null ? void 0 : S.from) == null ? void 0 : $.dbName, j = (G = (K = n.poRequest) == null ? void 0 : K.to) == null ? void 0 : G.dbName;
1563
+ if (I && j && (I.startsWith("warehouse_") || j.startsWith("warehouse_"))) {
1564
+ const F = await new Promise((W, E) => {
1565
+ u.open({
1566
+ closeButton: !1,
1567
+ title: "Confirm transfer amount",
1568
+ dialogComponent: Ft,
1569
+ dialogComponentProps: {
1570
+ purchaseOrder: n.purchaseOrder,
1571
+ confirm: W,
1572
+ "onUpdate:show": (ae) => {
1573
+ ae || (o.value = "", c.value = !1, y.value = !0, T++, u.close()), E("cancelled");
1574
+ }
1575
+ }
1576
+ });
1577
+ });
1578
+ v.fulfillment = F;
1579
+ }
1580
+ }
1581
+ try {
1582
+ await pe(
1583
+ n.purchaseOrder,
1584
+ v,
1585
+ t,
1586
+ p,
1587
+ T
1588
+ ) === "submitted" && (e.open({
1589
+ title: "Success",
1590
+ message: w,
1591
+ type: "success"
1592
+ }), O("update:show", !1), O("submitted"));
1593
+ } catch (I) {
1594
+ e.open({
1595
+ title: "Something went wrong",
1596
+ message: "Please try again.",
1597
+ type: "error"
1598
+ }), console.error("Error when submitting PO operation", t, n.purchaseOrder, I);
1599
+ } finally {
1600
+ o.value = "", c.value = !1, y.value = !0;
1601
+ }
1602
+ }
1603
+ }
1604
+ const ye = Y(() => {
1605
+ var t, p;
1606
+ return ((t = n.purchaseOrder) == null ? void 0 : t.status) === ce.enum.RECEIVING || ((p = n.purchaseOrder) == null ? void 0 : p.status) === ce.enum.COMPLETE;
1607
+ }), Pe = Y(() => {
1608
+ var K, G, v;
1609
+ const w = (((K = n.purchaseOrder) == null ? void 0 : K.deliveryOrder) ?? []).flatMap((T) => T.received ?? []).reduce(
1610
+ (T, I) => {
1611
+ const j = T[I.sku._id] ?? [];
1612
+ return T[I.sku._id] = [...j, I], T;
1613
+ },
1614
+ {}
1615
+ ), S = Object.entries(w).reduce(
1616
+ (T, [I, j]) => {
1617
+ const F = j.reduce((W, E) => {
1618
+ const ae = yt(
1619
+ W,
1620
+ Math.max(W.precision, E.amount.precision)
1621
+ );
1622
+ return Le(ae, E.amount);
1623
+ }, xe(0));
1624
+ return T[I] = F, T;
1625
+ },
1626
+ {}
1627
+ ), $ = ((G = n.purchaseOrder) == null ? void 0 : G.items) ?? [];
1628
+ for (const T of $)
1629
+ S[v = T.sku._id] ?? (S[v] = xe(0));
1630
+ return S;
1631
+ }), ie = Y(() => {
1632
+ var K, G;
1633
+ const t = ((K = n.purchaseOrder) == null ? void 0 : K.deliveryOrder) ?? [], p = ((G = n.purchaseOrder) == null ? void 0 : G.deliveryFullfillment) ?? [], w = [
1634
+ ...t.map((v) => ({
1635
+ createdAt: v.createdAt,
1636
+ type: "grn",
1637
+ doc: v
1638
+ })),
1639
+ ...p.map((v) => ({
1640
+ createdAt: v.createdAt,
1641
+ type: "fulfillment",
1642
+ doc: v
1643
+ }))
1644
+ ];
1645
+ w.reverse().sort((v, T) => v.createdAt.localeCompare(T.createdAt));
1646
+ function S(v) {
1647
+ var j, F, W, E, ae, ge, _e, Se, B;
1648
+ const T = p.findIndex((P) => P.id === v.fullfillmentId), I = [
1649
+ (F = (j = p[T]) == null ? void 0 : j.netSuite) != null && F.refNo ? {
1650
+ label: "Fulfillment's ref no. (Netsuite)",
1651
+ values: [(E = (W = p[T]) == null ? void 0 : W.netSuite) == null ? void 0 : E.refNo]
1652
+ } : null,
1653
+ (ae = v == null ? void 0 : v.netSuite) != null && ae.refNo ? {
1654
+ label: "Netsuite ref no.",
1655
+ values: [(ge = v == null ? void 0 : v.netSuite) == null ? void 0 : ge.refNo]
1656
+ } : null,
1657
+ (_e = v == null ? void 0 : v.netSuite) != null && _e.recordType ? {
1658
+ label: "Netsuite Type",
1659
+ values: [rt((Se = v == null ? void 0 : v.netSuite) == null ? void 0 : Se.recordType)]
1660
+ } : null
1661
+ ];
1662
+ return {
1663
+ header: "Received",
1664
+ date: Ce(new Date(v.createdAt)),
1665
+ info: [
1666
+ {
1667
+ label: "Adjustment date",
1668
+ values: [
1669
+ v.adjustment ? Ce(new Date(vt(v.adjustment))) : "-"
1670
+ ]
1671
+ },
1672
+ {
1673
+ label: "Received by",
1674
+ values: [(B = v.createdBy) == null ? void 0 : B.name]
1675
+ },
1676
+ {
1677
+ label: "Received items",
1678
+ values: v.received.map((P) => {
1679
+ var z;
1680
+ return q("div", [
1681
+ q(
1682
+ "div",
1683
+ {
1684
+ class: "flex gap-4"
1685
+ },
1686
+ [
1687
+ q(
1688
+ "div",
1689
+ {
1690
+ class: "flex flex-col"
1691
+ },
1692
+ [
1693
+ q(
1694
+ "span",
1695
+ {
1696
+ class: "fm-typo-en-body-lg-800 basis-1/2 shrink-0 grow"
1697
+ },
1698
+ `${P.sku.name}`
1699
+ ),
1700
+ q(
1701
+ "span",
1702
+ {
1703
+ class: "fm-typo-en-body-md-400"
1704
+ },
1705
+ `${P.sku.code} `
1706
+ )
1707
+ ]
1708
+ ),
1709
+ q(
1710
+ "div",
1711
+ {
1712
+ class: "ml-auto flex flex-col"
1713
+ },
1714
+ [
1715
+ q(
1716
+ "div",
1717
+ {
1718
+ class: "ml-auto flex gap-1"
1719
+ },
1720
+ [
1721
+ q(
1722
+ "span",
1723
+ {
1724
+ class: "fm-typo-en-body-lg-600 self-end"
1725
+ },
1726
+ le(P.amount, !1)
1727
+ ),
1728
+ q(
1729
+ "span",
1730
+ {
1731
+ class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary"
1732
+ },
1733
+ ((z = P.measurement) == null ? void 0 : z.abbrev) ?? P.sku.unit.abbrev
1734
+ )
1735
+ ]
1736
+ ),
1737
+ q(
1738
+ "div",
1739
+ {
1740
+ class: "flex self-end fm-typo-en-body-md-400 text-fm-color-typo-secondary"
1741
+ },
1742
+ `${P.cost ? `(${Oe(P.cost)})` : ""}`
1743
+ )
1744
+ ]
1745
+ )
1746
+ ]
1747
+ )
1748
+ ]);
1749
+ })
1750
+ },
1751
+ v.deliveryOrderNumber ? {
1752
+ label: "Delivery order no.",
1753
+ values: [v.deliveryOrderNumber]
1754
+ } : null,
1755
+ v.remark ? {
1756
+ label: "Remark",
1757
+ values: [v.remark]
1758
+ } : null,
1759
+ T > -1 ? {
1760
+ label: "Fulfilment's sequence",
1761
+ values: [`${T + 1}`]
1762
+ } : null,
1763
+ ...I
1764
+ ].filter((P) => P)
1765
+ };
1766
+ }
1767
+ function $(v) {
1768
+ var I, j;
1769
+ const T = p.findIndex((F) => F.id === v.id);
1770
+ return {
1771
+ header: "Fulfillment",
1772
+ date: Ce(new Date(v.createdAt)),
1773
+ info: [
1774
+ {
1775
+ label: "Sequence",
1776
+ values: [String(T + 1)]
1777
+ },
1778
+ {
1779
+ label: "Receiveable items",
1780
+ values: v.items.map((F) => {
1781
+ var W;
1782
+ return q("div", [
1783
+ q(
1784
+ "div",
1785
+ {
1786
+ class: "flex gap-4"
1787
+ },
1788
+ [
1789
+ q(
1790
+ "div",
1791
+ {
1792
+ class: "flex flex-col"
1793
+ },
1794
+ [
1795
+ q(
1796
+ "span",
1797
+ {
1798
+ class: "fm-typo-en-body-lg-800 basis-1/2 shrink-0 grow"
1799
+ },
1800
+ `${F.sku.name}`
1801
+ ),
1802
+ q(
1803
+ "span",
1804
+ {
1805
+ class: "fm-typo-en-body-md-400"
1806
+ },
1807
+ `${F.sku.code} `
1808
+ )
1809
+ ]
1810
+ ),
1811
+ q(
1812
+ "div",
1813
+ {
1814
+ class: "ml-auto flex flex-col"
1815
+ },
1816
+ [
1817
+ q(
1818
+ "div",
1819
+ {
1820
+ class: "ml-auto flex gap-1"
1821
+ },
1822
+ [
1823
+ q(
1824
+ "span",
1825
+ {
1826
+ class: "fm-typo-en-body-lg-600 self-end"
1827
+ },
1828
+ le(F.amount, !1)
1829
+ ),
1830
+ q(
1831
+ "span",
1832
+ {
1833
+ class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary"
1834
+ },
1835
+ ((W = F.measurement) == null ? void 0 : W.abbrev) ?? F.sku.unit.abbrev
1836
+ )
1837
+ ]
1838
+ ),
1839
+ q(
1840
+ "div",
1841
+ {
1842
+ class: "flex self-end fm-typo-en-body-md-400 text-fm-color-typo-secondary"
1843
+ },
1844
+ `${F.cost ? `(${Oe(F.cost)})` : ""}`
1845
+ )
1846
+ ]
1847
+ )
1848
+ ]
1849
+ )
1850
+ ]);
1851
+ })
1852
+ },
1853
+ (I = v.netSuite) != null && I.refNo ? {
1854
+ label: "Ref no. (Netsuite)",
1855
+ values: [(j = v.netSuite) == null ? void 0 : j.refNo]
1856
+ } : null
1857
+ ].filter((F) => F)
1858
+ };
1859
+ }
1860
+ return w.map((v) => {
1861
+ switch (v.type) {
1862
+ case "grn":
1863
+ return S(v.doc);
1864
+ case "fulfillment":
1865
+ return $(v.doc);
1866
+ }
1867
+ });
1868
+ }), D = Y(() => {
1869
+ var p;
1870
+ const t = {
1871
+ ...xe(0),
1872
+ currency: Xe()
1873
+ };
1874
+ return ((p = n.purchaseOrder) == null ? void 0 : p.items.reduce((w, S) => ({
1875
+ ...Le(w, S.totalCost ?? t),
1876
+ currency: Xe()
1877
+ }), t)) ?? t;
1878
+ });
1879
+ return (t, p) => {
1880
+ var F, W;
1881
+ const w = V("FmButtonGroup"), S = V("FmChip"), $ = V("FmMenuDivider"), K = V("FmCard"), G = V("FmIcon"), v = V("FmTooltip"), T = V("FmSpacer"), I = V("FmButton"), j = V("FmSideSheet");
1882
+ return g(), ne(j, {
1883
+ header: b(f)("inventory.transfer.receiveRequest.details.title") + ((F = t.purchaseOrder) != null && F.seqNumber ? ` #${(W = t.purchaseOrder) == null ? void 0 : W.seqNumber}` : ""),
1884
+ modelValue: b(X),
1885
+ "onUpdate:modelValue": p[5] || (p[5] = (E) => gt(X) ? X.value = E : null),
1886
+ "dismiss-away": y.value,
1887
+ "close-button": "",
1888
+ "max-width": 600
1889
+ }, {
1890
+ default: re(() => {
1891
+ var E, ae, ge, _e, Se;
1892
+ return [
1893
+ a("div", gr, [
1894
+ a("div", null, [
1895
+ C(w, {
1896
+ items: se.value,
1897
+ modelValue: J.value,
1898
+ "onUpdate:modelValue": p[0] || (p[0] = (B) => J.value = B)
1899
+ }, null, 8, ["items", "modelValue"])
1900
+ ]),
1901
+ J.value.value === "overview" ? (g(), R(ee, { key: 0 }, [
1902
+ a("div", null, [
1903
+ C(K, {
1904
+ variant: "outlined",
1905
+ class: "flex flex-col gap-8 px-12 py-16"
1906
+ }, {
1907
+ default: re(() => {
1908
+ var B, P, z, ve, he, Re, je, Ke, ze, He, Ge, We;
1909
+ return [
1910
+ a("div", _r, [
1911
+ a("div", Sr, N(b(f)("inventory.transfer.receiveRequest.details.requestSummary")), 1),
1912
+ a("div", null, [
1913
+ C(S, {
1914
+ label: b(f)(`inventory.transfer.status.${(B = t.purchaseOrder) == null ? void 0 : B.status}`),
1915
+ class: ke(`fm-status-badge fm-status-badge-${(z = (P = t.purchaseOrder) == null ? void 0 : P.status) == null ? void 0 : z.toLocaleLowerCase("en-us")}`),
1916
+ compact: ""
1917
+ }, null, 8, ["label", "class"])
1918
+ ])
1919
+ ]),
1920
+ C($),
1921
+ a("div", wr, [
1922
+ a("div", Rr, [
1923
+ a("div", Or, [
1924
+ a("div", kr, N(b(f)("inventory.transfer.receiveRequest.details.createdAt")), 1)
1925
+ ]),
1926
+ a("div", xr, N(b(Ne)(((ve = t.purchaseOrder) == null ? void 0 : ve._id) ?? "")), 1)
1927
+ ]),
1928
+ (he = t.purchaseOrder) != null && he.effectiveAt ? (g(), R("div", Nr, [
1929
+ a("div", Dr, N(b(f)("inventory.transfer.receiveRequest.details.backdatedTo")), 1),
1930
+ a("div", qr, N(b(tt)(new Date((Re = t.purchaseOrder) == null ? void 0 : Re.effectiveAt))), 1)
1931
+ ])) : L("", !0),
1932
+ a("div", Ar, [
1933
+ a("div", $r, N(b(f)("inventory.transfer.receiveRequest.details.type.title")), 1),
1934
+ a("div", Tr, N(b(f)(
1935
+ `inventory.transfer.receiveRequest.details.type.${i.value.toLocaleLowerCase("en-US")}`
1936
+ )), 1)
1937
+ ]),
1938
+ (Ke = (je = t.purchaseOrder) == null ? void 0 : je.supplier) != null && Ke.name ? (g(), R("div", Pr, [
1939
+ a("div", Cr, N(b(f)("inventory.transfer.receiveRequest.details.from")), 1),
1940
+ a("div", Ir, N((He = (ze = t.purchaseOrder) == null ? void 0 : ze.supplier) == null ? void 0 : He.name), 1)
1941
+ ])) : L("", !0),
1942
+ t.transferTo ? (g(), R("div", Fr, [
1943
+ a("div", Er, N(b(f)("inventory.transfer.receiveRequest.details.to")), 1),
1944
+ a("div", Br, N(t.transferTo), 1)
1945
+ ])) : L("", !0),
1946
+ (Ge = t.purchaseOrder) != null && Ge.ref ? (g(), R("div", Lr, [
1947
+ a("div", Ur, N(b(f)("inventory.transfer.receiveRequest.details.reference")), 1),
1948
+ a("div", Vr, N(t.purchaseOrder.ref), 1)
1949
+ ])) : L("", !0),
1950
+ (We = t.purchaseOrder) != null && We.remark ? (g(), R("div", Mr, [
1951
+ a("div", jr, N(b(f)("inventory.transfer.receiveRequest.details.remark")), 1),
1952
+ a("div", Kr, N(t.purchaseOrder.remark), 1)
1953
+ ])) : L("", !0)
1954
+ ])
1955
+ ];
1956
+ }),
1957
+ _: 1
1958
+ })
1959
+ ]),
1960
+ C(br, {
1961
+ "po-request": t.poRequest,
1962
+ purchaseOrder: t.purchaseOrder,
1963
+ transferType: i.value,
1964
+ transferToDbName: t.transferToDbName,
1965
+ scope: t.scope
1966
+ }, null, 8, ["po-request", "purchaseOrder", "transferType", "transferToDbName", "scope"]),
1967
+ a("div", zr, [
1968
+ a("div", Hr, [
1969
+ a("div", Gr, [
1970
+ a("span", Wr, [
1971
+ Ie(N(ye.value ? b(f)("inventory.transfer.receiveRequest.details.receivedItems") : b(f)("inventory.transfer.receiveRequest.details.requestedItems")) + " ", 1),
1972
+ (ae = (E = t.purchaseOrder) == null ? void 0 : E.netSuite) != null && ae.missingItems && ((_e = (ge = t.purchaseOrder) == null ? void 0 : ge.netSuite) == null ? void 0 : _e.missingItems.length) > 0 ? (g(), ne(v, {
1973
+ key: 0,
1974
+ variant: "rich",
1975
+ placement: "top",
1976
+ "z-index": 51
1977
+ }, {
1978
+ content: re(() => {
1979
+ var B, P;
1980
+ return [
1981
+ a("div", Qr, [
1982
+ (g(!0), R(ee, null, de((P = (B = t.purchaseOrder) == null ? void 0 : B.netSuite) == null ? void 0 : P.missingItems, (z, ve) => (g(), R("div", {
1983
+ class: "flex justify-center align-middle",
1984
+ key: ve
1985
+ }, [
1986
+ C(G, {
1987
+ name: "arrow_right",
1988
+ size: "sm"
1989
+ }),
1990
+ Ie(" " + N(`(${z.netSuiteId}) ${z.name}: ${z.reason}`), 1)
1991
+ ]))), 128))
1992
+ ])
1993
+ ];
1994
+ }),
1995
+ default: re(() => [
1996
+ C(G, {
1997
+ name: "error",
1998
+ color: "#ff2c2c",
1999
+ size: "sm"
2000
+ })
2001
+ ]),
2002
+ _: 1
2003
+ })) : L("", !0)
2004
+ ])
2005
+ ]),
2006
+ C($),
2007
+ (g(!0), R(ee, null, de(((Se = t.purchaseOrder) == null ? void 0 : Se.items) ?? [], (B) => {
2008
+ var P;
2009
+ return g(), R("div", {
2010
+ key: B.code,
2011
+ class: "flex flex-col"
2012
+ }, [
2013
+ a("div", Yr, [
2014
+ a("div", Xr, N(B.name), 1),
2015
+ a("div", Jr, N(b(le)(Pe.value[B.sku._id], !1)) + "/" + N(b(nt)(B.quantity, B.sku.unit, B.measurement)), 1)
2016
+ ]),
2017
+ a("div", Zr, [
2018
+ a("div", es, N(B.code), 1),
2019
+ (P = B.totalCost) != null && P.amount && b(l).enableTotalCost ? (g(), R("div", ts, " (" + N(b(Oe)(B.totalCost)) + ") ", 1)) : L("", !0)
2020
+ ])
2021
+ ]);
2022
+ }), 128)),
2023
+ +b(le)(D.value) ? (g(), R(ee, { key: 0 }, [
2024
+ a("div", rs, [
2025
+ C($)
2026
+ ]),
2027
+ a("div", ss, [
2028
+ p[6] || (p[6] = a("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, "Total:", -1)),
2029
+ a("div", as, N(b(Oe)(D.value)), 1)
2030
+ ])
2031
+ ], 64)) : L("", !0)
2032
+ ])
2033
+ ])
2034
+ ], 64)) : J.value.value === "deliveryHistory" ? (g(), R("div", ns, [
2035
+ ie.value.length ? (g(), R("div", us, [
2036
+ (g(!0), R(ee, null, de(ie.value, (B, P) => (g(), R(ee, { key: P }, [
2037
+ a("div", ds, [
2038
+ a("div", ms, [
2039
+ a("div", fs, [
2040
+ a("div", {
2041
+ class: ke([
2042
+ {
2043
+ "bg-fm-color-primary": P !== 0,
2044
+ "bg-white": P === 0
2045
+ },
2046
+ "w-[2px] h-full"
2047
+ ])
2048
+ }, null, 2)
2049
+ ]),
2050
+ p[7] || (p[7] = a("div", { class: "h-24 w-24 bg-fm-color-primary rounded-full" }, null, -1)),
2051
+ a("div", ps, [
2052
+ a("div", {
2053
+ class: ke([
2054
+ {
2055
+ "bg-fm-color-primary": P < ie.value.length - 1,
2056
+ "bg-white": P >= ie.value.length - 1
2057
+ },
2058
+ "w-[2px] h-full"
2059
+ ])
2060
+ }, null, 2)
2061
+ ])
2062
+ ]),
2063
+ a("div", ys, [
2064
+ a("div", vs, N(B.header), 1),
2065
+ a("div", hs, N(B.date), 1)
2066
+ ])
2067
+ ]),
2068
+ a("div", bs, [
2069
+ a("div", gs, [
2070
+ a("div", _s, [
2071
+ a("div", {
2072
+ class: ke([
2073
+ {
2074
+ "bg-fm-color-primary": P < ie.value.length - 1,
2075
+ "bg-white": P >= ie.value.length - 1
2076
+ },
2077
+ "w-[2px] h-full"
2078
+ ])
2079
+ }, null, 2)
2080
+ ])
2081
+ ]),
2082
+ a("div", Ss, [
2083
+ C(K, {
2084
+ variant: "outlined",
2085
+ class: "py-12 px-16"
2086
+ }, {
2087
+ default: re(() => [
2088
+ a("div", ws, [
2089
+ (g(!0), R(ee, null, de(B.info, (z, ve) => (g(), R("div", {
2090
+ key: ve,
2091
+ class: "flex flex-col gap-4"
2092
+ }, [
2093
+ a("div", Rs, N(z == null ? void 0 : z.label), 1),
2094
+ a("div", Os, [
2095
+ (g(!0), R(ee, null, de(z == null ? void 0 : z.values, (he, Re) => (g(), R("div", {
2096
+ key: Re,
2097
+ class: "fm-typo-en-body-lg-600"
2098
+ }, [
2099
+ typeof he == "string" ? (g(), R(ee, { key: 0 }, [
2100
+ Ie(N(he), 1)
2101
+ ], 64)) : (g(), ne(_t(he), { key: 1 }))
2102
+ ]))), 128))
2103
+ ])
2104
+ ]))), 128))
2105
+ ])
2106
+ ]),
2107
+ _: 2
2108
+ }, 1024)
2109
+ ])
2110
+ ])
2111
+ ], 64))), 128))
2112
+ ])) : (g(), R("div", os, [
2113
+ C(T),
2114
+ a("div", null, [
2115
+ a("img", {
2116
+ src: b(Ot),
2117
+ alt: "List is empty"
2118
+ }, null, 8, is)
2119
+ ]),
2120
+ a("div", ls, N(b(f)("inventory.transfer.receiveRequest.details.noRecordsFound")), 1),
2121
+ a("div", cs, N(b(f)("inventory.transfer.receiveRequest.details.trackDeliveryMessage")), 1),
2122
+ C(T),
2123
+ C(T)
2124
+ ]))
2125
+ ])) : L("", !0)
2126
+ ])
2127
+ ];
2128
+ }),
2129
+ "side-sheet-footer": re(() => [
2130
+ a("div", ks, [
2131
+ (g(!0), R(ee, null, de(M.value, (E) => (g(), R(ee, null, [
2132
+ b(Be)[E].available != !1 ? (g(), ne(I, {
2133
+ key: E,
2134
+ label: b(f)(b(Be)[E].translationKey),
2135
+ onClick: (ae) => oe(E),
2136
+ loading: o.value === E,
2137
+ disabled: o.value !== E && c.value,
2138
+ variant: b(Be)[E].buttonVariant
2139
+ }, null, 8, ["label", "onClick", "loading", "disabled", "variant"])) : L("", !0)
2140
+ ], 64))), 256)),
2141
+ b(_).ableToMarkReceived(t.purchaseOrder) && !M.value.includes("completeReceive") ? (g(), ne(I, {
2142
+ key: 0,
2143
+ label: b(f)("inventory.transfer.receiveRequest.actions.completeReceive"),
2144
+ onClick: p[1] || (p[1] = (E) => oe("completeReceive")),
2145
+ loading: o.value === "completeReceive",
2146
+ disabled: o.value !== "completeReceive" && c.value
2147
+ }, null, 8, ["label", "loading", "disabled"])) : L("", !0),
2148
+ b(_).ableToMarkApproved(t.purchaseOrder) && t.canApprove && !M.value.includes("approveRequest") ? (g(), ne(I, {
2149
+ key: 1,
2150
+ label: b(f)("inventory.transfer.approval.actions.approveRequest"),
2151
+ onClick: p[2] || (p[2] = (E) => oe("approveRequest")),
2152
+ loading: o.value === "approveRequest",
2153
+ disabled: o.value !== "approveRequest" && c.value
2154
+ }, null, 8, ["label", "loading", "disabled"])) : L("", !0),
2155
+ b(_).ableToCreateFulfillment(t.purchaseOrder, t.poRequest) ? (g(), ne(I, {
2156
+ key: 2,
2157
+ label: b(f)("inventory.transfer.receiveRequest.actions.processRequest"),
2158
+ onClick: p[3] || (p[3] = (E) => oe("processRequest")),
2159
+ loading: o.value === "processRequest",
2160
+ disabled: o.value !== "processRequest" && c.value
2161
+ }, null, 8, ["label", "loading", "disabled"])) : L("", !0),
2162
+ C(I, {
2163
+ label: b(f)("common.close"),
2164
+ variant: "tertiary",
2165
+ onClick: p[4] || (p[4] = (E) => O("update:show", !1))
2166
+ }, null, 8, ["label"])
2167
+ ])
2168
+ ]),
2169
+ _: 1
2170
+ }, 8, ["header", "modelValue", "dismiss-away"]);
2171
+ };
2172
+ }
2173
+ });
2174
+ export {
2175
+ Ue as P,
2176
+ Ls as _,
2177
+ Es as a,
2178
+ Bs as b,
2179
+ $t as g,
2180
+ Te as u
2181
+ };