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