@feedmepos/mf-inventory-portal 0.0.25-dev.29 → 0.0.25-dev.30

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