@feedmepos/mf-inventory-portal 0.0.25-dev.42 → 0.0.25-dev.44

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