@feedmepos/mf-inventory-portal 0.0.25-dev.22 → 0.0.25-dev.23

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