@feedmepos/mf-inventory-portal 0.0.25-dev.20 → 0.0.25-dev.21

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