@feedmepos/mf-inventory-portal 0.0.25-dev.35 → 0.0.25-dev.37

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