@feedmepos/mf-inventory-portal 0.0.25-dev.17 → 0.0.25-dev.19

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