@feedmepos/mf-inventory-portal 1.0.15-dev.2 → 1.0.15-dev.3

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 (50) hide show
  1. package/dist/{App-CgxrN-aD.js → App-3Zym4rob.js} +2 -2
  2. package/dist/ApprovalView-C4qLlZua.js +213 -0
  3. package/dist/{BindingsDialog-B_ZMDl-b.js → BindingsDialog-DHaF8DtC.js} +2 -2
  4. package/dist/{BindingsPicker-B84BG8zT.js → BindingsPicker-C04HnWZ-.js} +1 -1
  5. package/dist/{BindingsTable-DrvoykYc.js → BindingsTable-CnZUt7GU.js} +1 -1
  6. package/dist/{ClosingDraftView-Ds9sI2Eg.js → ClosingDraftView-DaMruAln.js} +41 -41
  7. package/dist/{ClosingTemplateView-BhZ1OXkD.js → ClosingTemplateView-B3lyKcz-.js} +2 -2
  8. package/dist/{DeliveryOrderPrintPreview-Yuxf-jCh.js → DeliveryOrderPrintPreview-CGPkYOfW.js} +1 -1
  9. package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-D6ktiUO5.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-DFJNtwjV.js} +43 -43
  10. package/dist/{FmMultiselectDialog-4lVsA2Rn.js → FmMultiselectDialog-yR5Mo3U-.js} +1 -1
  11. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-XmTRSHn_.js → FmUnitInput.vue_vue_type_script_setup_true_lang-DoY67RWl.js} +57 -57
  12. package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-B3PvtR0j.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-BSuFAwN3.js} +1 -1
  13. package/dist/IngredientGroupView-B-hyo-7W.js +898 -0
  14. package/dist/IngredientsView-Cod5ahQy.js +1778 -0
  15. package/dist/{IntegrationView-BnrCkjWt.js → IntegrationView-D9KZtPN3.js} +5 -5
  16. package/dist/{InventoryBindingForm-uyHh2TI_.js → InventoryBindingForm-CrRoablh.js} +1 -1
  17. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-CECDj9Pw.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-W9p7khOs.js} +46 -46
  18. package/dist/{InventoryBindingSummary-DyHCqgIe.js → InventoryBindingSummary-D88BG4ze.js} +1 -1
  19. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-Dx2lMf6h.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-VtM-wvuF.js} +1 -1
  20. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-BCX3vlmU.js → PremiumBadge.vue_vue_type_script_setup_true_lang-Ccx9QvpN.js} +15 -15
  21. package/dist/{PublishView-BVGyY6nn.js → PublishView-DhE7YE-k.js} +13 -13
  22. package/dist/{PurchaseOrderPrintPreview-pbYIFiOG.js → PurchaseOrderPrintPreview-CF_VeOeU.js} +4 -4
  23. package/dist/ReceiveRequestView-Bx9-NHyn.js +2576 -0
  24. package/dist/{RecipeView-DcgoCf4g.js → RecipeView-JhM5Z4CP.js} +4 -4
  25. package/dist/{StockView-zO2uL662.js → StockView-u7jlKoO5.js} +108 -108
  26. package/dist/{SupplierView-I5bqiX_2.js → SupplierView-BDBBQnGy.js} +37 -37
  27. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-BJiobEDM.js +2090 -0
  28. package/dist/{TransferTemplateView-BDOt17yc.js → TransferTemplateView-CNMHm8Gy.js} +149 -149
  29. package/dist/{UnitView-BVY5S6-3.js → UnitView-UVgn7ofI.js} +32 -32
  30. package/dist/{WarehouseView-m6MKrtYq.js → WarehouseView-CEw69mhn.js} +26 -26
  31. package/dist/{app-DtICLubM.js → app-cfPLYfcH.js} +33227 -25194
  32. package/dist/app.js +5 -5
  33. package/dist/components/FmInventoryTableToolbar.vue.d.ts +36 -0
  34. package/dist/{decimal-C1dAcCf3.js → decimal-BeCLbdwn.js} +1 -1
  35. package/dist/{feature-Y7qzvbl4.js → feature-dhG2tL_A.js} +79 -79
  36. package/dist/{format-unit-display-CPqfS4vp.js → format-unit-display-D3UdcFM6.js} +48 -48
  37. package/dist/{index-DIEdSG3y.js → index-BUou6R58.js} +1 -1
  38. package/dist/{index-0qsqwB0T.js → index-BkR-Qpc0.js} +4 -4
  39. package/dist/{stock-CowNp_xM.js → stock-DQPwSZX1.js} +1 -1
  40. package/dist/{supplier-JVTTlQNL.js → supplier-CAcd6PiU.js} +2 -2
  41. package/dist/tsconfig.app.tsbuildinfo +1 -1
  42. package/dist/{use-ingredient-select-dialog-Df59lld2.js → use-ingredient-select-dialog-E3qfQso7.js} +5 -5
  43. package/dist/{use-inventory-binding-dialog-Bxxb93Kz.js → use-inventory-binding-dialog-DRKy4nUx.js} +1 -1
  44. package/dist/{vue-i18n-DJOdRwc3.js → vue-i18n-DLrqHK28.js} +271 -271
  45. package/package.json +4 -4
  46. package/dist/ApprovalView-DNGhkVc9.js +0 -147
  47. package/dist/IngredientGroupView-usK9stxT.js +0 -8779
  48. package/dist/IngredientsView-DPx8Z2zo.js +0 -1749
  49. package/dist/ReceiveRequestView-DZAgH2_u.js +0 -2516
  50. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-NyQg_yR9.js +0 -2020
@@ -0,0 +1,2090 @@
1
+ import { a1 as lt, u as de, aL as w, b as qe, a6 as ct, a8 as ut, a9 as dt, aM as mt, d as We, e as Je, Z as et, aN as ft, a3 as Le, P as Ne, i as ie, aO as tt, ad as ke, f as Ye, h as H, D as ee, au as le, aP as rt, aQ as pt, a7 as yt, as as Qe, a5 as Oe, ai as Ce, av as vt } from "./app-cfPLYfcH.js";
2
+ import { ref as K, computed as W, h as D, defineComponent as be, reactive as ht, onMounted as st, resolveComponent as G, openBlock as _, createBlock as ne, withCtx as ce, createElementVNode as n, createVNode as B, unref as h, createElementBlock as q, toDisplayString as x, createCommentVNode as L, watch as bt, isRef as gt, Fragment as te, normalizeClass as xe, createTextVNode as Ie, renderList as ve, resolveDynamicComponent as _t } from "vue";
3
+ import { F as St } from "./decimal-BeCLbdwn.js";
4
+ import { b as wt, u as Rt, f as at, P as ue } from "./format-unit-display-D3UdcFM6.js";
5
+ import { useCoreStore as De, useI18n as nt } from "@feedmepos/mf-common";
6
+ import { E as Ot } from "./empty-placeholder-wf6-BWE8.js";
7
+ import { useDialog as Ve, useSnackbar as Ae, components as Xe, FmButtonVariant as J, useProxiedModel as xt } from "@feedmepos/ui-library";
8
+ import { u as Te, F as Fe } from "./feature-dhG2tL_A.js";
9
+ import { _ as Nt, F as kt, a as qt } from "./FmUnitInput.vue_vue_type_script_setup_true_lang-DoY67RWl.js";
10
+ import { u as Dt, R as Ze } from "./usePromise-CbVUCxhj.js";
11
+ import { u as At } from "./index-BkR-Qpc0.js";
12
+ const Pe = lt((m, r) => {
13
+ const a = de(), N = De();
14
+ return {
15
+ async readRequests(u, e, c) {
16
+ const f = u ?? a.currentLocationDBName, s = `${m.inventoryBackendUrl}/${f}/purchase-request`;
17
+ return e && c ? await r.get(`${s}?startDate=${e}&endDate=${c}`) : await r.get(s);
18
+ },
19
+ async readRequestById(u, e) {
20
+ const c = e ?? a.currentLocationDBName, f = `${m.inventoryBackendUrl}/${c}/purchase-request/${u}`;
21
+ return await r.get(f);
22
+ },
23
+ async readRequestByIds(u, e) {
24
+ const c = e ?? a.currentLocationDBName, f = `${m.inventoryBackendUrl}/${c}/purchase-request/find`;
25
+ return await r.post(f, { requestIds: u });
26
+ },
27
+ async getPurchaseOrders({
28
+ start: u,
29
+ end: e
30
+ }) {
31
+ const c = a.currentLocationDBName, f = `${m.inventoryBackendUrl}/${c}/purchase-order`;
32
+ return await r.get(`${f}?start=${u}&end=${e}`);
33
+ },
34
+ async getLatestPurchaseOrderRequest(u) {
35
+ const e = a.currentLocationDBName, c = `${m.inventoryBackendUrl}/${e}/purchase-request/find-by-purchase-order-id`;
36
+ return await r.get(`${c}/${u}`);
37
+ },
38
+ async getPurchaseOrderById(u) {
39
+ const e = a.currentLocationDBName, c = `${m.inventoryBackendUrl}/${e}/purchase-order`;
40
+ return await r.get(`${c}/${u}`);
41
+ },
42
+ /**
43
+ * @deprecated Use `processPurchaseOrderV2` instead.
44
+ */
45
+ async processPurchaseOrder(u, e) {
46
+ const c = a.currentLocationDBName, f = e || c, s = `${m.inventoryBackendUrl}/${f}/purchase-order/run-operation`;
47
+ return await r.put(s, u);
48
+ },
49
+ async createPurchaseOrder(u) {
50
+ const e = a.currentLocationDBName, c = `${m.inventoryBackendUrl}/${e}/purchase-order`;
51
+ return await r.post(c, u);
52
+ },
53
+ async updatePurchaseOrder(u) {
54
+ const e = a.currentLocationDBName, c = `${m.inventoryBackendUrl}/${e}/purchase-order`;
55
+ return await r.put(c, u);
56
+ },
57
+ async importFromXilnex(u) {
58
+ const e = a.currentLocationDBName, c = `${m.inventoryBackendUrl}/${e}/purchase-order/import-from-xilnex`;
59
+ return await r.post(c, u);
60
+ },
61
+ async processPurchaseOrderV2(u, e) {
62
+ const c = a.currentLocationDBName, f = e || c, s = `${m.inventoryBackendUrl}/${f}/v2/purchase-order/run-operation`;
63
+ return await r.put(s, u);
64
+ },
65
+ async getWorkflowConfig() {
66
+ var f;
67
+ const e = `business_${(f = N.currentBusiness.value) == null ? void 0 : f._id}`, c = `${m.inventoryBackendUrl}/${e}/v2/purchase-order/workflow-config`;
68
+ return await r.get(c);
69
+ }
70
+ };
71
+ }), ot = {
72
+ [w.enum.confirmDraft]: {
73
+ primaryActions: {
74
+ text: "Confirm draft",
75
+ close: !0
76
+ },
77
+ title: "Confirm draft?",
78
+ message: "Purchase order cannot be changed after confirm draft.",
79
+ successMessage: "Purchase order draft has been confirmed"
80
+ },
81
+ [w.enum.cancelDraft]: {
82
+ primaryActions: {
83
+ text: "Cancel draft",
84
+ close: !0,
85
+ variant: "destructive"
86
+ },
87
+ title: "Cancel draft?",
88
+ message: "Purchase order cannot be changed after cancelled draft.",
89
+ successMessage: "Purchase order draft has been cancelled"
90
+ },
91
+ [w.enum.submitRequest]: {
92
+ primaryActions: {
93
+ text: "Submit request",
94
+ close: !0
95
+ },
96
+ title: "Confirm draft?",
97
+ message: "Purchase order cannot be changed after confirm draft.",
98
+ successMessage: "Purchase order draft has been submitted"
99
+ },
100
+ [w.enum.completeReceive]: {
101
+ primaryActions: {
102
+ text: "Mark received",
103
+ close: !0
104
+ },
105
+ title: "Mark as received",
106
+ message: "Purchase order cannot be changed after it has complete receiving.",
107
+ successMessage: "Purchase order has been marked as received"
108
+ },
109
+ [w.enum.approveRequest]: {
110
+ primaryActions: {
111
+ text: "Accept request",
112
+ close: !0
113
+ },
114
+ title: "Accept request?",
115
+ message: "Transfer out request will be accepted.",
116
+ successMessage: "Transfer out request has been approved"
117
+ },
118
+ [w.enum.rejectRequest]: {
119
+ primaryActions: {
120
+ text: "Reject request",
121
+ close: !0,
122
+ variant: "destructive"
123
+ },
124
+ title: "Reject request?",
125
+ message: "Purchase order will be rejected.",
126
+ successMessage: "Purchase order has been rejected"
127
+ },
128
+ [w.enum.processRequest]: {
129
+ primaryActions: {
130
+ text: "Process request",
131
+ close: !0,
132
+ variant: "destructive"
133
+ },
134
+ title: "Process request?",
135
+ message: "Purchase order will be processed.",
136
+ successMessage: "Purchase order has been processed"
137
+ }
138
+ };
139
+ function it() {
140
+ const m = de(), r = Pe(), a = Te();
141
+ async function N(e, c) {
142
+ const f = m.currentLocationDBName;
143
+ return e.doc.supplier.internal && e.operation === w.enum.confirmDraft && (e.operation = w.enum.submitRequest), await r.processPurchaseOrder(e, c || f);
144
+ }
145
+ async function u(e, c) {
146
+ const f = m.currentLocationDBName;
147
+ return await r.processPurchaseOrderV2(e, c || f);
148
+ }
149
+ return (e) => a.useOperatePurchaseOrderV2 ? u(e.operateV2, e.transferTo) : N(e.operate, e.transferTo);
150
+ }
151
+ var Ue = /* @__PURE__ */ ((m) => (m.RECEIVE_REQUEST = "receive/request", m.APPROVAL = "approval", m))(Ue || {});
152
+ const we = K(), Ee = K();
153
+ function Ds(m, r) {
154
+ const a = Ve(), N = de(), u = Te();
155
+ qe();
156
+ const e = wt(), c = Rt(), f = K(!1), s = Ae(), b = Pe(), R = K(new Array()), p = K(
157
+ r != null && r.startDate && (r != null && r.endDate) ? r : ct()
158
+ ), o = W(() => {
159
+ const k = new Date(p.value.startDate), t = new Date(p.value.endDate);
160
+ return {
161
+ start: ut(k).toISOString(),
162
+ end: dt(t).toISOString()
163
+ };
164
+ }), l = K(new Array()), i = mt(), y = K(null);
165
+ async function O(k) {
166
+ function t(S) {
167
+ const g = {
168
+ mode: We.CREATE,
169
+ modelValue: k || void 0,
170
+ show: !0,
171
+ "onUpdate:show"(A) {
172
+ we.value.show = A;
173
+ },
174
+ templateId: S,
175
+ lastClosingDate: y.value
176
+ };
177
+ we.value = g;
178
+ }
179
+ let d;
180
+ u.mustUsePoTemplate && !(k != null && k.template) ? a.open({
181
+ title: "Create transfer",
182
+ message: "",
183
+ primaryActions: {
184
+ text: "Select a template",
185
+ close: !0
186
+ },
187
+ secondaryActions: {
188
+ text: "Outlet to Outlet",
189
+ variant: "secondary",
190
+ close: !0
191
+ }
192
+ }).onPrimary(async () => {
193
+ d = await e.getTemplateId(), d && t(d);
194
+ }).onSecondary(() => {
195
+ t(void 0);
196
+ }) : t(d);
197
+ }
198
+ function T(k) {
199
+ const t = {
200
+ mode: We.UPDATE,
201
+ modelValue: Je(k),
202
+ show: !0,
203
+ "onUpdate:show"(d) {
204
+ we.value.show = d;
205
+ },
206
+ lastClosingDate: y.value
207
+ };
208
+ we.value = t;
209
+ }
210
+ async function X() {
211
+ R.value = [], f.value = !0;
212
+ try {
213
+ R.value = await b.getPurchaseOrders(o.value).then((S) => S.sort((g, A) => A._id.localeCompare(g._id)));
214
+ const k = await i.readCurrentLocationLastClosing(!0), t = k == null ? void 0 : k._id;
215
+ t && (y.value = ft(t)), await u.awaitFeatureLoaded(() => u.mustUsePoTemplate) && await c.fetchTemplates();
216
+ const d = R.value.map((S) => {
217
+ var g;
218
+ return ((g = S.request) == null ? void 0 : g.id) ?? "";
219
+ }).filter((S) => S);
220
+ l.value = await b.readRequestByIds(d);
221
+ } catch {
222
+ s.open({
223
+ title: "Something went wrong",
224
+ message: "Error at fetching purchase orders",
225
+ type: "error"
226
+ });
227
+ } finally {
228
+ f.value = !1;
229
+ }
230
+ }
231
+ async function Y() {
232
+ l.value = [], f.value = !0;
233
+ try {
234
+ l.value = await b.readRequests(
235
+ void 0,
236
+ o.value.start,
237
+ o.value.end
238
+ ).then((k) => k.reverse());
239
+ } catch {
240
+ s.open({
241
+ title: "Something went wrong",
242
+ message: "Error at fetching purchase requests",
243
+ type: "error"
244
+ });
245
+ } finally {
246
+ f.value = !1;
247
+ }
248
+ }
249
+ function Q() {
250
+ switch (m) {
251
+ case "receive/request":
252
+ return X();
253
+ case "approval":
254
+ return Y();
255
+ }
256
+ }
257
+ function re(k, t) {
258
+ p.value = {
259
+ startDate: k,
260
+ endDate: t
261
+ }, Q();
262
+ }
263
+ N.watchLocation(async (k) => {
264
+ if (!k) {
265
+ R.value = [];
266
+ return;
267
+ }
268
+ await Q();
269
+ });
270
+ const Z = K(), me = K(Math.random().toString());
271
+ async function ae(k, t) {
272
+ const d = Math.random().toString();
273
+ me.value = d, t ?? (t = l.value.computeFirst(
274
+ (A) => A.purchaseOrderId === k._id ? A : null
275
+ ) ?? void 0);
276
+ const S = m === "receive/request" ? N.currentLocation : t == null ? void 0 : t.to, g = {
277
+ poRequest: t,
278
+ purchaseOrder: k,
279
+ transferTo: S == null ? void 0 : S.name,
280
+ transferToDbName: S == null ? void 0 : S.dbName,
281
+ show: !0,
282
+ canResubmit: !1,
283
+ canApprove: m === "approval",
284
+ "onUpdate:show"(A) {
285
+ Z.value.show = A;
286
+ },
287
+ scope: m
288
+ };
289
+ Z.value = g;
290
+ }
291
+ async function fe(k, t, d, S) {
292
+ const g = it();
293
+ f.value = !0;
294
+ try {
295
+ await g({
296
+ operate: {
297
+ operation: t,
298
+ doc: k,
299
+ options: (
300
+ // auto receive for supplier to warehouse
301
+ (t === w.enum.confirmDraft || // auto receive for warehouse to warehouse
302
+ t === w.enum.completeReceive) && u.autoReceiveWarehouse ? {
303
+ autoReceive: !0
304
+ } : void 0
305
+ )
306
+ },
307
+ operateV2: {
308
+ _id: k._id,
309
+ _rev: k._rev ?? "",
310
+ action: t
311
+ },
312
+ transferTo: S
313
+ }), await new Promise((j) => setTimeout(j, 1e3));
314
+ const V = de().currentLocationDBName.startsWith("restaurant_");
315
+ t === w.enum.confirmDraft && k.effectiveAt && V ? s.open({
316
+ title: "Success",
317
+ message: `${d}. The backdate will be reflected once your POS has received this change.`,
318
+ type: "success"
319
+ }) : s.open({
320
+ title: "Success",
321
+ message: d,
322
+ type: "success"
323
+ });
324
+ } catch (A) {
325
+ s.open({
326
+ title: "Something went wrong",
327
+ message: "Please try again.",
328
+ type: "error"
329
+ }), console.error("Error when submitting PO operation", t, k, A);
330
+ } finally {
331
+ f.value = !1, Q();
332
+ }
333
+ }
334
+ async function $e(k, t, d) {
335
+ const S = ot[t];
336
+ if (!S) {
337
+ s.open({
338
+ title: "Something went wrong",
339
+ message: `Cannot process order: ${et(t)}`,
340
+ type: "error"
341
+ });
342
+ return;
343
+ }
344
+ const { successMessage: g, ...A } = S;
345
+ a.open({
346
+ title: A.title,
347
+ message: A.message,
348
+ primaryActions: A.primaryActions
349
+ }).onPrimary(() => {
350
+ fe(k, t, g, d);
351
+ });
352
+ }
353
+ async function oe() {
354
+ a.open({
355
+ title: "Upload Transfer",
356
+ primaryActions: {
357
+ text: "Xilnex transfer note",
358
+ close: !0
359
+ },
360
+ secondaryActions: {
361
+ text: "Cancel",
362
+ close: !0
363
+ }
364
+ }).onPrimary(() => {
365
+ const k = {
366
+ show: !0,
367
+ "onUpdate:show"(t) {
368
+ Ee.value.show = t;
369
+ }
370
+ };
371
+ Ee.value = k;
372
+ });
373
+ }
374
+ return {
375
+ purchaseOrders: R,
376
+ purchaseRequests: l,
377
+ updateDateRange: re,
378
+ fetchData: Q,
379
+ loading: f,
380
+ transferDialogProps: we,
381
+ promptCreateTransferDialog: O,
382
+ promptUpdateTransferDialog: T,
383
+ transferDetailsProps: Z,
384
+ promptShowTransferDetails: ae,
385
+ submitAction: $e,
386
+ xilnexImportDialogProps: Ee,
387
+ promptUploadTransferDialog: oe
388
+ };
389
+ }
390
+ function Tt(m, r) {
391
+ return r.reduce(
392
+ (N, u) => {
393
+ const e = u.received.find((c) => c.sku._id === m._id);
394
+ return e && (N = Le(N, e.amount)), N;
395
+ },
396
+ St.toPrecision(Ne(0), m.unit.precision)
397
+ );
398
+ }
399
+ function Pt(m, r, a, N) {
400
+ const { name: u, address: e, regNo: c } = r.doc.profile, f = {
401
+ name: u,
402
+ registrationNumber: c,
403
+ line1: e == null ? void 0 : e.line1,
404
+ line2: e == null ? void 0 : e.line2,
405
+ postcode: e == null ? void 0 : e.postcode,
406
+ city: e == null ? void 0 : e.city,
407
+ state: e == null ? void 0 : e.state,
408
+ country: e == null ? void 0 : e.country
409
+ }, s = {
410
+ name: m.supplier.name,
411
+ phoneNumber: m.supplier.phoneNumber,
412
+ registrationNumber: m.supplier.registrationNumber,
413
+ line1: m.supplier.address.line1,
414
+ line2: m.supplier.address.line2,
415
+ postcode: m.supplier.address.postcode,
416
+ city: m.supplier.address.city,
417
+ state: m.supplier.address.state,
418
+ country: m.supplier.address.country
419
+ }, b = m.items.map((i) => {
420
+ const { sku: y, measurement: O } = i, T = ie(
421
+ Tt(i.sku, m.deliveryOrder || []),
422
+ !1
423
+ );
424
+ return {
425
+ code: y.code,
426
+ description: y.name,
427
+ quantity: at(i.quantity, y.unit, i.measurement),
428
+ unit: (O == null ? void 0 : O.abbrev) || y.unit.abbrev,
429
+ received: T
430
+ };
431
+ }), R = m.deliveryOrder.map((i) => ({
432
+ createdAt: tt(new Date(i.createdAt)),
433
+ ref: i.deliveryOrderNumber,
434
+ remark: i.remark || "",
435
+ items: i.received.map((y) => {
436
+ var O;
437
+ return {
438
+ code: y.sku.code,
439
+ description: y.sku.name,
440
+ quantity: ie(y.amount),
441
+ unit: ((O = y.measurement) == null ? void 0 : O.abbrev) || y.sku.unit.abbrev
442
+ };
443
+ })
444
+ })), p = {
445
+ businessName: a == null ? void 0 : a.name,
446
+ logo: a == null ? void 0 : a.thumbnail,
447
+ orderNumber: m.seqNumber.toString(),
448
+ createdAt: ke(m._id),
449
+ ref: m.ref || "",
450
+ remark: m.remark || "",
451
+ buyer: f,
452
+ supplier: s,
453
+ items: b,
454
+ status: m.status,
455
+ deliveryOrders: R
456
+ }, o = new URL(window.location.href), l = N && (m.deliveryFullfillment || []).length > 0 ? "receive-request/delivery-print-preview" : "receive-request/print-preview";
457
+ o.pathname = o.hostname.includes("portal.feedme") ? `/inventory/${l}` : `/${l}`, o.searchParams.append("data", JSON.stringify(p)), window.open(o.href, "_blank", "noreferrer");
458
+ }
459
+ const he = {
460
+ submitRequest: {
461
+ translationKey: "inventory.transfer.receiveRequest.actions.submitRequest",
462
+ color: "text-fm-color-typo-primary",
463
+ value: w.enum.submitRequest
464
+ },
465
+ confirmDraft: {
466
+ translationKey: "inventory.transfer.receiveRequest.actions.confirmDraft",
467
+ color: "text-fm-color-typo-primary",
468
+ value: w.enum.confirmDraft
469
+ },
470
+ cancelDraft: {
471
+ translationKey: "inventory.transfer.receiveRequest.actions.cancelDraft",
472
+ color: "text-fm-color-typo-error",
473
+ value: w.enum.cancelDraft
474
+ },
475
+ approveRequest: {
476
+ translationKey: "inventory.transfer.receiveRequest.actions.approveRequest",
477
+ color: "text-fm-color-typo-primary",
478
+ value: w.enum.approveRequest
479
+ },
480
+ rejectRequest: {
481
+ translationKey: "inventory.transfer.receiveRequest.actions.rejectRequest",
482
+ color: "text-fm-color-typo-error",
483
+ value: w.enum.rejectRequest
484
+ },
485
+ processRequest: {
486
+ translationKey: "inventory.transfer.receiveRequest.actions.processRequest",
487
+ color: "text-fm-color-typo-primary",
488
+ value: w.enum.processRequest
489
+ },
490
+ receiveStock: {
491
+ translationKey: "inventory.transfer.receiveRequest.actions.receiveStock",
492
+ color: "text-fm-color-typo-primary",
493
+ value: w.enum.receiveStock
494
+ },
495
+ completeReceive: {
496
+ translationKey: "inventory.transfer.receiveRequest.actions.completeReceive",
497
+ color: "text-fm-color-typo-primary",
498
+ value: w.enum.completeReceive
499
+ },
500
+ closeRequest: {
501
+ translationKey: "inventory.transfer.receiveRequest.actions.closeRequest",
502
+ color: "system-error-300",
503
+ value: w.enum.closeRequest
504
+ },
505
+ approveDraft: {
506
+ translationKey: "",
507
+ color: "",
508
+ value: void 0
509
+ },
510
+ rejectDraft: {
511
+ translationKey: "",
512
+ color: "",
513
+ value: void 0
514
+ },
515
+ returnStock: {
516
+ translationKey: "inventory.transfer.receiveRequest.actions.returnStock",
517
+ color: "text-fm-color-typo-primary",
518
+ value: w.enum.returnStock
519
+ }
520
+ };
521
+ function As(m, r) {
522
+ const a = de(), N = qe(), u = De(), { t: e } = nt();
523
+ function c(o) {
524
+ switch (o.status) {
525
+ case "DRAFT":
526
+ return [
527
+ ee[H.Update],
528
+ ee[H.Details],
529
+ o.supplier.internal === "restaurant" || o.supplier.internal === "warehouse" ? he[w.enum.submitRequest] : he[w.enum.confirmDraft],
530
+ he[w.enum.cancelDraft]
531
+ ];
532
+ case "RECEIVING":
533
+ return [
534
+ he[w.enum.completeReceive],
535
+ ee[H.Details],
536
+ ee[H.Print]
537
+ ];
538
+ case "REQUESTING":
539
+ return m === "receive/request" ? [ee[H.Details], ee[H.Print]] : [
540
+ he[w.enum.approveRequest],
541
+ he[w.enum.rejectRequest],
542
+ ee[H.Details]
543
+ // DefaultRowActions[RowActionEnum.Print]
544
+ ];
545
+ case "PROCESSING":
546
+ return [ee[H.Details], ee[H.Print]];
547
+ case "COMPLETE":
548
+ case "CANCEL":
549
+ default:
550
+ return [ee[H.Details], ee[H.Print]];
551
+ }
552
+ }
553
+ function f(o) {
554
+ return Object.values(w.enum).includes(o);
555
+ }
556
+ async function s(o, l, i) {
557
+ var O, T, X, Y;
558
+ const y = Je(l);
559
+ if (o === H.Print) {
560
+ const Q = (i == null ? void 0 : i.toInventoryLocation) ?? a.currentLocation;
561
+ y.ref = [((O = i == null ? void 0 : i.netSuite) == null ? void 0 : O.refNo) || ((T = y.netSuite) == null ? void 0 : T.refNo)].filter((re) => re).join(" "), Pt(y, Q, u.currentBusiness.value, m === "approval");
562
+ return;
563
+ }
564
+ if (o === H.Details) {
565
+ r.promptShowTransferDetails(y, i);
566
+ return;
567
+ }
568
+ if (o === H.Update) {
569
+ (X = r.promptUpdateTransferDialog) == null || X.call(r, y);
570
+ return;
571
+ }
572
+ if (f(o)) {
573
+ r.submitAction(l, o, (Y = i == null ? void 0 : i.to) == null ? void 0 : Y.dbName);
574
+ return;
575
+ }
576
+ }
577
+ function b() {
578
+ const o = [
579
+ {
580
+ accessorKey: "seqNumber",
581
+ header: () => e("inventory.transfer.table.seqNo"),
582
+ enableSorting: !0,
583
+ size: 80,
584
+ sortUndefined: "last"
585
+ },
586
+ {
587
+ accessorKey: "_id",
588
+ header: () => e("inventory.transfer.table.createdAt"),
589
+ cell(l) {
590
+ return ke(`${l.getValue()}`);
591
+ },
592
+ enableSorting: !0
593
+ },
594
+ {
595
+ accessorKey: "supplier.name",
596
+ header: () => e("inventory.transfer.table.transferFrom"),
597
+ enableSorting: !0,
598
+ size: 200
599
+ },
600
+ {
601
+ accessorKey: "items.length",
602
+ header: () => e("inventory.transfer.table.noOfItems"),
603
+ enableSorting: !1,
604
+ meta: {
605
+ width: "10rem"
606
+ }
607
+ },
608
+ {
609
+ accessorKey: "ref",
610
+ header: () => e("inventory.transfer.table.reference"),
611
+ enableSorting: !1,
612
+ size: "auto"
613
+ },
614
+ {
615
+ accessorKey: "status",
616
+ header: () => e("inventory.transfer.table.status"),
617
+ cell(l) {
618
+ const i = e(`inventory.transfer.status.${l.getValue() ?? ""}`), y = `${l.getValue() ?? ""}`.toLocaleLowerCase("en-us");
619
+ return D(
620
+ "div",
621
+ {
622
+ class: "flex"
623
+ },
624
+ D(
625
+ "div",
626
+ {
627
+ class: `fm-status-badge fm-status-badge-${y}`
628
+ },
629
+ i
630
+ )
631
+ );
632
+ },
633
+ enableSorting: !0,
634
+ size: 200
635
+ },
636
+ {
637
+ id: "action",
638
+ cell(l) {
639
+ const i = l.row.original, y = c(i);
640
+ return Ye(y, (O) => s(O, i));
641
+ },
642
+ enableSorting: !1,
643
+ size: 40,
644
+ meta: {
645
+ cellClass: "",
646
+ headerClass: ""
647
+ }
648
+ }
649
+ ];
650
+ if (N.isEnabled) {
651
+ const l = [
652
+ {
653
+ id: "netsuiteTransferOrder",
654
+ header: () => "NetSuite Order (ID)",
655
+ cell(i) {
656
+ var O;
657
+ const y = i.row.original;
658
+ return (O = y.netSuite) != null && O.id ? `${y.netSuite.refNo} (${y.netSuite.id})` : "N/A";
659
+ },
660
+ enableSorting: !1,
661
+ size: 200,
662
+ meta: {
663
+ cellClass: "",
664
+ headerClass: ""
665
+ }
666
+ },
667
+ {
668
+ id: "netsuiteTransactionNumber",
669
+ header: () => "NetSuite Transaction No.",
670
+ cell(i) {
671
+ var O, T;
672
+ return ((T = (O = i.row.original.netSuite) == null ? void 0 : O.additionalInfo) == null ? void 0 : T.transactionnumber) ?? "N/A";
673
+ },
674
+ enableSorting: !1,
675
+ size: 200,
676
+ meta: {
677
+ cellClass: "",
678
+ headerClass: ""
679
+ }
680
+ }
681
+ ];
682
+ o.splice(o.length - 2, 0, ...l);
683
+ }
684
+ return o;
685
+ }
686
+ function R() {
687
+ const o = [
688
+ {
689
+ accessorKey: "purchaseOrder.seqNumber",
690
+ header: () => e("inventory.transfer.table.seqNo"),
691
+ enableSorting: !0,
692
+ size: 80,
693
+ sortUndefined: "last"
694
+ },
695
+ {
696
+ accessorKey: "purchaseOrder._id",
697
+ header: () => e("inventory.transfer.table.createdAt"),
698
+ cell(l) {
699
+ return ke(`${l.getValue()}`);
700
+ },
701
+ enableSorting: !0
702
+ },
703
+ {
704
+ accessorKey: "to.name",
705
+ header: () => e("inventory.transfer.table.transferTo"),
706
+ enableSorting: !1,
707
+ size: 200
708
+ },
709
+ {
710
+ accessorKey: "purchaseOrder.items.length",
711
+ header: () => e("inventory.transfer.table.noOfItems"),
712
+ enableSorting: !1
713
+ },
714
+ {
715
+ accessorKey: "purchaseOrder.ref",
716
+ header: () => e("inventory.transfer.table.reference"),
717
+ enableSorting: !1,
718
+ size: "auto"
719
+ },
720
+ {
721
+ accessorKey: "purchaseOrder.status",
722
+ header: () => e("inventory.transfer.table.status"),
723
+ cell(l) {
724
+ const i = e(`inventory.transfer.status.${l.getValue() ?? ""}`), y = `${l.getValue() ?? ""}`.toLocaleLowerCase("en-us");
725
+ return D(
726
+ "div",
727
+ {
728
+ class: "flex"
729
+ },
730
+ D(
731
+ "div",
732
+ {
733
+ class: `fm-status-badge fm-status-badge-${y}`
734
+ },
735
+ i
736
+ )
737
+ );
738
+ },
739
+ enableSorting: !0
740
+ },
741
+ {
742
+ id: "action",
743
+ cell(l) {
744
+ const i = l.row.original, O = (i.purchaseOrder ? c(i.purchaseOrder) : []).map((T) => T.value === H.Print ? {
745
+ ...T,
746
+ translationKey: "inventory.transfer.receiveRequest.details.printDeliveryOrder"
747
+ } : T);
748
+ return Ye(
749
+ O,
750
+ (T) => i.purchaseOrder ? s(T, i.purchaseOrder, i) : void 0
751
+ );
752
+ },
753
+ enableSorting: !1,
754
+ size: 40,
755
+ meta: {
756
+ cellClass: "",
757
+ headerClass: ""
758
+ }
759
+ }
760
+ ];
761
+ if (N.isEnabled) {
762
+ const l = [
763
+ {
764
+ id: "netsuiteTransferOrder",
765
+ header: () => "NetSuite Order (ID)",
766
+ cell(i) {
767
+ var O;
768
+ const y = i.row.original;
769
+ return (O = y.netSuite) != null && O.id ? `${y.netSuite.refNo} (${y.netSuite.id})` : "N/A";
770
+ },
771
+ enableSorting: !1,
772
+ size: 200,
773
+ meta: {
774
+ cellClass: "",
775
+ headerClass: ""
776
+ }
777
+ },
778
+ {
779
+ id: "netsuiteTransactionNumber",
780
+ header: () => "NetSuite Transaction No.",
781
+ cell(i) {
782
+ var O, T;
783
+ return ((T = (O = i.row.original.netSuite) == null ? void 0 : O.additionalInfo) == null ? void 0 : T.transactionnumber) ?? "N/A";
784
+ },
785
+ enableSorting: !1,
786
+ size: 200,
787
+ meta: {
788
+ cellClass: "",
789
+ headerClass: ""
790
+ }
791
+ }
792
+ ];
793
+ o.splice(o.length - 2, 0, ...l);
794
+ }
795
+ return o;
796
+ }
797
+ const p = W(() => m === "receive/request" ? b() : R());
798
+ return {
799
+ get columnDefs() {
800
+ return p.value;
801
+ }
802
+ };
803
+ }
804
+ const $t = { class: "border border-fm-color-neutral-gray-200 fm-corner-radius-lg p-16" }, Ct = { class: "flex flex-col gap-8" }, It = { class: "flex w-full justify-end gap-16" }, Ft = /* @__PURE__ */ be({
805
+ __name: "FulfillmentForm",
806
+ props: {
807
+ purchaseOrder: {},
808
+ confirm: { type: Function }
809
+ },
810
+ emits: ["update:show"],
811
+ setup(m, { emit: r }) {
812
+ const a = m, N = ht({
813
+ id: "",
814
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
815
+ items: []
816
+ }), u = K(), e = r;
817
+ return st(() => {
818
+ a.purchaseOrder && (N.items = a.purchaseOrder.items.map((c) => ({
819
+ id: c.id,
820
+ sku: c.sku,
821
+ measurement: c.measurement,
822
+ amount: c.quantity ?? { amount: 1, precision: 0 }
823
+ })));
824
+ }), (c, f) => {
825
+ const s = G("FmTable"), b = G("FmButton"), R = G("FmForm");
826
+ return _(), ne(R, {
827
+ ref_key: "formRef",
828
+ ref: u,
829
+ class: "bg-white flex flex-col gap-32 rounded-3xl p-24 w-[800px]",
830
+ onValidationFailed: console.log,
831
+ onValidationSuccess: f[1] || (f[1] = () => a.confirm(N))
832
+ }, {
833
+ default: ce(() => [
834
+ f[2] || (f[2] = n("div", { class: "fm-typo-en-title-sm-600" }, "Confirm the transfer amount", -1)),
835
+ n("div", $t, [
836
+ n("div", Ct, [
837
+ B(s, {
838
+ "column-defs": [
839
+ {
840
+ header: "Code",
841
+ cell: (p) => {
842
+ const o = a.purchaseOrder.items.find((l) => l.id === p.row.original.id || l.sku._id === p.row.original.sku._id);
843
+ return D(
844
+ h(Xe).FmTooltip,
845
+ {
846
+ content: o.code,
847
+ placement: "top",
848
+ variant: "plain",
849
+ zIndex: 50
850
+ },
851
+ D(
852
+ "span",
853
+ {
854
+ class: "flex-auto line-clamp-2 text-ellipsis break-all"
855
+ },
856
+ o.code
857
+ )
858
+ );
859
+ }
860
+ },
861
+ {
862
+ header: "Name",
863
+ cell: (p) => {
864
+ const o = a.purchaseOrder.items.find((l) => l.id === p.row.original.id || l.sku._id === p.row.original.sku._id);
865
+ return D(
866
+ h(Xe).FmTooltip,
867
+ {
868
+ content: o.name,
869
+ placement: "top",
870
+ variant: "plain",
871
+ zIndex: 50
872
+ },
873
+ D(
874
+ "span",
875
+ {
876
+ class: "flex-auto line-clamp-2 text-ellipsis break-all"
877
+ },
878
+ o.name
879
+ )
880
+ );
881
+ }
882
+ },
883
+ {
884
+ header: "Amount",
885
+ cell: (p) => {
886
+ const o = p.row.original, l = a.purchaseOrder.items.find((y) => y.id === o.id || y.sku._id === o.sku._id), i = o.amount ?? {
887
+ amount: 1,
888
+ precision: 0
889
+ };
890
+ return D(Nt, {
891
+ style: {
892
+ flex: "1 1 0%"
893
+ },
894
+ modelValue: {
895
+ amount: i,
896
+ measurement: o.measurement ?? null
897
+ },
898
+ key: o.id ?? o.sku._id,
899
+ unit: o.sku.unit,
900
+ "onUpdate:modelValue": (y) => {
901
+ if (!y) return;
902
+ const O = N.items.find((T) => T.id === o.id || T.sku._id === o.sku._id);
903
+ O && (O.amount = y.amount);
904
+ },
905
+ disableUnit: !0,
906
+ rules: [
907
+ h(kt)(
908
+ +h(ie)({ amount: 0, precision: 0 })
909
+ ),
910
+ h(qt)(+h(ie)(l.quantity))
911
+ ],
912
+ applyDefaultRules: !0
913
+ });
914
+ }
915
+ }
916
+ ],
917
+ "row-data": N.items,
918
+ "hide-footer": !0
919
+ }, null, 8, ["column-defs", "row-data"])
920
+ ])
921
+ ]),
922
+ n("div", It, [
923
+ B(b, {
924
+ class: "px-16",
925
+ label: "Confirm",
926
+ size: "md",
927
+ variant: "primary",
928
+ type: "submit"
929
+ }),
930
+ B(b, {
931
+ class: "px-16",
932
+ label: "Cancel",
933
+ size: "md",
934
+ variant: "secondary",
935
+ onClick: f[0] || (f[0] = () => e("update:show", !1))
936
+ })
937
+ ])
938
+ ]),
939
+ _: 1
940
+ }, 8, ["onValidationFailed"]);
941
+ };
942
+ }
943
+ }), Be = {
944
+ submitRequest: {
945
+ translationKey: "inventory.transfer.receiveRequest.actions.submitRequest",
946
+ color: "primary",
947
+ buttonVariant: J.Primary
948
+ },
949
+ confirmDraft: {
950
+ translationKey: "inventory.transfer.receiveRequest.actions.confirmDraft",
951
+ color: "primary",
952
+ buttonVariant: J.Primary
953
+ },
954
+ cancelDraft: {
955
+ translationKey: "inventory.transfer.receiveRequest.actions.cancelDraft",
956
+ color: "system-error-300",
957
+ buttonVariant: J.Destructive
958
+ },
959
+ approveDraft: {
960
+ translationKey: "inventory.transfer.receiveRequest.actions.approveDraft",
961
+ color: "primary",
962
+ buttonVariant: J.Primary
963
+ },
964
+ rejectDraft: {
965
+ translationKey: "inventory.transfer.receiveRequest.actions.rejectDraft",
966
+ color: "system-error-300",
967
+ buttonVariant: J.Destructive
968
+ },
969
+ approveRequest: {
970
+ translationKey: "inventory.transfer.receiveRequest.actions.approveRequest",
971
+ color: "primary",
972
+ buttonVariant: J.Primary
973
+ },
974
+ processRequest: {
975
+ translationKey: "inventory.transfer.receiveRequest.actions.processRequest",
976
+ color: "primary",
977
+ buttonVariant: J.Primary
978
+ },
979
+ receiveStock: {
980
+ translationKey: "inventory.transfer.receiveRequest.actions.receiveStock",
981
+ color: "primary",
982
+ buttonVariant: J.Primary,
983
+ available: !1
984
+ },
985
+ completeReceive: {
986
+ translationKey: "inventory.transfer.receiveRequest.actions.completeReceive",
987
+ color: "primary",
988
+ buttonVariant: J.Plain
989
+ },
990
+ rejectRequest: {
991
+ translationKey: "inventory.transfer.receiveRequest.actions.rejectRequest",
992
+ color: "system-error-300",
993
+ buttonVariant: J.Destructive
994
+ },
995
+ closeRequest: {
996
+ translationKey: "inventory.transfer.receiveRequest.actions.closeRequest",
997
+ color: "system-error-300",
998
+ buttonVariant: J.Destructive,
999
+ available: !1
1000
+ },
1001
+ returnStock: {
1002
+ translationKey: "inventory.transfer.receiveRequest.actions.returnStock",
1003
+ color: "primary",
1004
+ buttonVariant: J.Primary,
1005
+ available: !1
1006
+ }
1007
+ };
1008
+ function Et() {
1009
+ const m = Te();
1010
+ return {
1011
+ ableToMarkReceived(r) {
1012
+ if (!r || r.status !== le.enum.RECEIVING)
1013
+ return !1;
1014
+ const N = de().currentLocationDBName;
1015
+ return `${r.supplier.internal}_${r.supplier._id}` !== N;
1016
+ },
1017
+ ableToMarkApproved(r) {
1018
+ return !(!r || (r == null ? void 0 : r.status) !== le.enum.REQUESTING);
1019
+ },
1020
+ ableToCreateFulfillment(r, a) {
1021
+ var e, c;
1022
+ if (!m.acceptRequireFulfillment || !r || !a || r.status !== le.enum.PROCESSING || !a.processedAt)
1023
+ return !1;
1024
+ const N = (e = a == null ? void 0 : a.from) == null ? void 0 : e.dbName, u = (c = a == null ? void 0 : a.to) == null ? void 0 : c.dbName;
1025
+ return !(N.startsWith("restaurant_") && u.startsWith("restaurant_"));
1026
+ }
1027
+ };
1028
+ }
1029
+ const Bt = { class: "flex flex-row-reverse" }, Lt = /* @__PURE__ */ be({
1030
+ __name: "NetSuiteSync",
1031
+ props: {
1032
+ poRequest: {},
1033
+ purchaseOrder: {},
1034
+ isTransferBetweenOutlets: { type: Boolean },
1035
+ scope: {}
1036
+ },
1037
+ setup(m) {
1038
+ const r = m, a = qe(), N = Ae(), u = Ve(), e = K(!1);
1039
+ W(() => {
1040
+ var R, p, o, l;
1041
+ let f = !0;
1042
+ a.isEnabled || (f = !1);
1043
+ const s = r.purchaseOrder, b = r.poRequest;
1044
+ return s && ((R = s == null ? void 0 : s.supplier) != null && R.internal ? (!b && s.status == le.enum.DRAFT && (f = !1), b && !((p = b == null ? void 0 : b.netSuite) != null && p.id) && (f = !1), r.isTransferBetweenOutlets && (f = !1)) : ((s == null ? void 0 : s.status) !== le.enum.REQUESTING && s.supplier.internal && (f = !1), !b && !((o = s == null ? void 0 : s.netSuite) != null && o.id) && (f = !1), !b && ((l = s == null ? void 0 : s.netSuite) != null && l.id) && (s == null ? void 0 : s.status) == le.enum.REQUESTING && (f = !1))), f;
1045
+ });
1046
+ async function c() {
1047
+ e.value || u.open({
1048
+ title: "Sync with NetSuite",
1049
+ contentComponent: D("div", [
1050
+ D("p", "Are you sure you want to sync now?"),
1051
+ D("br"),
1052
+ D(
1053
+ "p",
1054
+ { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" },
1055
+ "Please wait a moment before syncing manually to avoid unnecessary actions."
1056
+ )
1057
+ ]),
1058
+ primaryActions: {
1059
+ text: "Sync",
1060
+ close: !0,
1061
+ variant: "destructive"
1062
+ },
1063
+ secondaryActions: { text: "Not now", close: !0 }
1064
+ }).onPrimary(async () => {
1065
+ var f, s, b;
1066
+ try {
1067
+ e.value = !0;
1068
+ const R = ((f = r.purchaseOrder) == null ? void 0 : f._id) || ((s = r.poRequest) == null ? void 0 : s.purchaseOrderId) || "", p = (b = r.poRequest) == null ? void 0 : b.to.dbName;
1069
+ await a.syncPurchaseOrder(
1070
+ R,
1071
+ r.scope === "approval" ? p : void 0
1072
+ ), N.open({
1073
+ title: "Sync with NetSuite",
1074
+ message: "Requested to sync with NetSuite. Please wait a moment.",
1075
+ type: "success"
1076
+ }), await new Promise((o) => setTimeout(o, 5e3)), e.value = !1;
1077
+ } catch {
1078
+ N.open({
1079
+ title: "Error",
1080
+ message: "Failed to sync with NetSuite",
1081
+ type: "error"
1082
+ }), e.value = !1;
1083
+ }
1084
+ });
1085
+ }
1086
+ return (f, s) => {
1087
+ const b = G("FmButton");
1088
+ return _(), q("div", Bt, [
1089
+ B(b, {
1090
+ "prepend-icon": "sync",
1091
+ variant: "secondary",
1092
+ label: "Sync",
1093
+ loading: e.value,
1094
+ onClick: c,
1095
+ "text-color": "primary",
1096
+ "bg-color": "transparent",
1097
+ "border-color": "primary"
1098
+ }, null, 8, ["loading"])
1099
+ ]);
1100
+ };
1101
+ }
1102
+ }), Ut = {
1103
+ key: 0,
1104
+ class: "flex flex-col gap-8"
1105
+ }, Vt = { class: "flex flex-col gap-4" }, Mt = { class: "fm-typo-en-body-lg-600" }, Kt = {
1106
+ key: 0,
1107
+ class: "flex flex-col gap-4"
1108
+ }, jt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, zt = { class: "fm-typo-en-body-lg-600" }, Ht = { key: 0 }, Gt = { key: 1 }, Wt = {
1109
+ key: 1,
1110
+ class: "flex flex-col gap-4"
1111
+ }, Yt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Qt = { class: "fm-typo-en-body-lg-600" }, Xt = { key: 0 }, Zt = { key: 1 }, Jt = {
1112
+ key: 2,
1113
+ class: "flex flex-col gap-4"
1114
+ }, er = { class: "fm-typo-en-body-lg-600" }, tr = {
1115
+ key: 3,
1116
+ class: "flex flex-col gap-4"
1117
+ }, rr = { class: "fm-typo-en-body-lg-600" }, sr = /* @__PURE__ */ be({
1118
+ __name: "NetSuiteInfo",
1119
+ props: {
1120
+ transferType: {},
1121
+ transferToDbName: {},
1122
+ poRequest: {},
1123
+ purchaseOrder: {},
1124
+ isTransferBetweenOutlets: { type: Boolean },
1125
+ scope: {}
1126
+ },
1127
+ setup(m) {
1128
+ const r = m, a = qe(), N = Pe(), u = K(r.poRequest);
1129
+ st(async () => {
1130
+ var s;
1131
+ if (!r.poRequest && ((s = r.purchaseOrder) != null && s._id)) {
1132
+ const b = await N.getLatestPurchaseOrderRequest(r.purchaseOrder._id);
1133
+ u.value = b;
1134
+ }
1135
+ });
1136
+ const e = W(
1137
+ () => {
1138
+ var s, b, R, p, o, l;
1139
+ return a.getSubsidiaryFullName(
1140
+ ((R = (b = (s = r.purchaseOrder) == null ? void 0 : s.netSuite) == null ? void 0 : b.subsidiary) == null ? void 0 : R.id) || ((l = (o = (p = r.poRequest) == null ? void 0 : p.netSuite) == null ? void 0 : o.subsidiary) == null ? void 0 : l.id)
1141
+ ).fullName;
1142
+ }
1143
+ ), c = W(() => {
1144
+ var s, b, R, p, o, l, i, y, O, T, X, Y;
1145
+ return (R = (b = (s = r.purchaseOrder) == null ? void 0 : s.netSuite) == null ? void 0 : b.additionalInfo) != null && R.transactionnumber ? (l = (o = (p = r.purchaseOrder) == null ? void 0 : p.netSuite) == null ? void 0 : o.additionalInfo) == null ? void 0 : l.transactionnumber : (O = (y = (i = u.value) == null ? void 0 : i.netSuite) == null ? void 0 : y.additionalInfo) != null && O.transactionnumber ? (Y = (X = (T = u.value) == null ? void 0 : T.netSuite) == null ? void 0 : X.additionalInfo) == null ? void 0 : Y.transactionnumber : null;
1146
+ }), f = W(() => {
1147
+ var s, b, R, p, o, l;
1148
+ return (b = (s = r.purchaseOrder) == null ? void 0 : s.deliveryFullfillment) != null && b.length && ((p = (R = r.purchaseOrder) == null ? void 0 : R.deliveryFullfillment) == null ? void 0 : p.length) > 0 ? (l = (o = r.purchaseOrder) == null ? void 0 : o.deliveryFullfillment) == null ? void 0 : l.map((i) => {
1149
+ var y;
1150
+ return (y = i.netSuite) == null ? void 0 : y.refNo;
1151
+ }).join(", ") : "N/A";
1152
+ });
1153
+ return (s, b) => {
1154
+ var R, p, o, l, i, y, O, T, X, Y, Q, re, Z, me, ae, fe;
1155
+ return h(a).isEnabled ? (_(), q("div", Ut, [
1156
+ n("div", Vt, [
1157
+ b[0] || (b[0] = n("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, "NetSuite subsidiary", -1)),
1158
+ n("div", Mt, x(e.value || "N/A"), 1)
1159
+ ]),
1160
+ !s.isTransferBetweenOutlets && s.scope === h(Ue).RECEIVE_REQUEST ? (_(), q("div", Kt, [
1161
+ n("div", jt, " NetSuite " + x((p = (R = s.purchaseOrder) == null ? void 0 : R.netSuite) != null && p.recordType ? h(rt)((l = (o = s.purchaseOrder) == null ? void 0 : o.netSuite) == null ? void 0 : l.recordType) : s.transferType === h(ue).PURCHASE ? "Purchase Order" : "Transfer Order") + " (ID) ", 1),
1162
+ n("div", zt, [
1163
+ (y = (i = s.purchaseOrder) == null ? void 0 : i.netSuite) != null && y.id ? (_(), q("span", Ht, x((T = (O = s.purchaseOrder) == null ? void 0 : O.netSuite) == null ? void 0 : T.refNo) + " (" + x((Y = (X = s.purchaseOrder) == null ? void 0 : X.netSuite) == null ? void 0 : Y.id) + ") ", 1)) : (_(), q("span", Gt, "N/A"))
1164
+ ])
1165
+ ])) : L("", !0),
1166
+ !s.isTransferBetweenOutlets && u.value || s.scope === h(Ue).APPROVAL ? (_(), q("div", Wt, [
1167
+ n("div", Yt, " (Request) NetSuite " + x(s.transferType === h(ue).PURCHASE ? "Purchase Order" : "Transfer Order") + " (ID) ", 1),
1168
+ n("div", Qt, [
1169
+ (re = (Q = u.value) == null ? void 0 : Q.netSuite) != null && re.id ? (_(), q("span", Xt, x((me = (Z = u.value) == null ? void 0 : Z.netSuite) == null ? void 0 : me.refNo) + " (" + x((fe = (ae = u.value) == null ? void 0 : ae.netSuite) == null ? void 0 : fe.id) + ") ", 1)) : (_(), q("span", Zt, "N/A"))
1170
+ ])
1171
+ ])) : L("", !0),
1172
+ c.value ? (_(), q("div", Jt, [
1173
+ b[1] || (b[1] = n("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " NetSuite Transaction Number ", -1)),
1174
+ n("div", er, x(c.value), 1)
1175
+ ])) : L("", !0),
1176
+ h(a).isEnabled && s.transferType === h(ue).TRANSFER && !s.isTransferBetweenOutlets ? (_(), q("div", tr, [
1177
+ b[2] || (b[2] = n("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " NetSuite fulfillment IDs ", -1)),
1178
+ n("div", rr, x(f.value), 1)
1179
+ ])) : L("", !0)
1180
+ ])) : L("", !0);
1181
+ };
1182
+ }
1183
+ }), ar = { class: "flex flex-row-reverse" }, nr = /* @__PURE__ */ be({
1184
+ __name: "NetSuiteLog",
1185
+ props: {
1186
+ netsuiteId: {},
1187
+ purchaseOrderId: {}
1188
+ },
1189
+ setup(m) {
1190
+ const r = Ae(), a = pt();
1191
+ async function N(u, e) {
1192
+ let c = `attributes.pod:netsuite* AND body.message:*${u}*`;
1193
+ const { url: f } = await a.getLogs(c);
1194
+ r.open(
1195
+ {
1196
+ message: "Opening NetSuite logs...",
1197
+ type: "info"
1198
+ },
1199
+ 800
1200
+ ), await new Promise((s) => setTimeout(s, 800)), window.open(f, "_blank");
1201
+ }
1202
+ return (u, e) => {
1203
+ const c = G("FmButton");
1204
+ return _(), q("div", ar, [
1205
+ B(c, {
1206
+ "prepend-icon": "history",
1207
+ variant: "secondary",
1208
+ label: "Logs",
1209
+ onClick: e[0] || (e[0] = (f) => N(u.netsuiteId, u.purchaseOrderId)),
1210
+ "text-color": "primary",
1211
+ "bg-color": "transparent",
1212
+ "border-color": "primary"
1213
+ })
1214
+ ]);
1215
+ };
1216
+ }
1217
+ }), or = {
1218
+ key: 0,
1219
+ class: "border border-fm-color-neutral-gray-200 fm-corner-radius-lg p-16 flex flex-col gap-8"
1220
+ }, ir = { class: "flex gap-8 items-center" }, lr = { class: "ml-auto" }, cr = { class: "flex gap-4" }, ur = /* @__PURE__ */ be({
1221
+ __name: "NetSuitePanel",
1222
+ props: {
1223
+ poRequest: {},
1224
+ purchaseOrder: {},
1225
+ transferType: {},
1226
+ transferToDbName: {},
1227
+ scope: {}
1228
+ },
1229
+ setup(m) {
1230
+ const r = m, a = At(), N = De(), u = W(() => {
1231
+ var s, b, R, p, o, l, i;
1232
+ const e = ((s = r.transferToDbName) == null ? void 0 : s.startsWith("restaurant")) && ((R = (b = r.purchaseOrder) == null ? void 0 : b.supplier) == null ? void 0 : R.internal) === "restaurant", c = r.transferType === ue.PURCHASE, f = r.transferType === ue.TRANSFER;
1233
+ return c || f && !e || ((o = (p = r.purchaseOrder) == null ? void 0 : p.netSuite) == null ? void 0 : o.id) || ((i = (l = r.poRequest) == null ? void 0 : l.netSuite) == null ? void 0 : i.id);
1234
+ });
1235
+ return (e, c) => {
1236
+ var s, b, R, p, o, l;
1237
+ const f = G("FmMenuDivider");
1238
+ return h(a).isNetSuiteEnabled && u.value ? (_(), q("div", or, [
1239
+ n("div", ir, [
1240
+ c[0] || (c[0] = n("span", { class: "flex-1 fm-typo-en-body-lg-600" }, "NetSuite Info", -1)),
1241
+ n("div", lr, [
1242
+ n("div", cr, [
1243
+ (s = h(N).sessionUser.value) != null && s.role.isAdmin && ((R = (b = r.purchaseOrder) == null ? void 0 : b.netSuite) != null && R.id) ? (_(), ne(nr, {
1244
+ key: 0,
1245
+ "netsuite-id": (o = (p = e.purchaseOrder) == null ? void 0 : p.netSuite) == null ? void 0 : o.id,
1246
+ "purchase-order-id": (l = e.purchaseOrder) == null ? void 0 : l._id
1247
+ }, null, 8, ["netsuite-id", "purchase-order-id"])) : L("", !0),
1248
+ B(Lt, {
1249
+ "po-request": e.poRequest,
1250
+ "purchase-order": e.purchaseOrder,
1251
+ "is-transfer-between-outlets": !u.value,
1252
+ scope: e.scope
1253
+ }, null, 8, ["po-request", "purchase-order", "is-transfer-between-outlets", "scope"])
1254
+ ])
1255
+ ])
1256
+ ]),
1257
+ B(f),
1258
+ B(sr, {
1259
+ "po-request": e.poRequest,
1260
+ "purchase-order": e.purchaseOrder,
1261
+ "transfer-type": e.transferType,
1262
+ "transfer-to-db-name": e.transferToDbName,
1263
+ "is-transfer-between-outlets": !u.value,
1264
+ scope: e.scope
1265
+ }, null, 8, ["po-request", "purchase-order", "transfer-type", "transfer-to-db-name", "is-transfer-between-outlets", "scope"])
1266
+ ])) : L("", !0);
1267
+ };
1268
+ }
1269
+ }), dr = { class: "flex flex-col gap-16 w-full h-full" }, mr = { class: "flex justify-between" }, fr = { class: "fm-typo-en-body-lg-600" }, pr = { class: "flex flex-col gap-8" }, yr = { class: "flex flex-col gap-4" }, vr = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, hr = { class: "flex gap-1" }, br = { class: "fm-typo-en-body-lg-600" }, gr = {
1270
+ key: 0,
1271
+ class: "flex flex-col gap-4"
1272
+ }, _r = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Sr = { class: "fm-typo-en-body-lg-600" }, wr = { class: "flex flex-col gap-4" }, Rr = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Or = { class: "fm-typo-en-body-lg-600" }, xr = {
1273
+ key: 1,
1274
+ class: "flex flex-col gap-4"
1275
+ }, Nr = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, kr = { class: "fm-typo-en-body-lg-600" }, qr = {
1276
+ key: 2,
1277
+ class: "flex flex-col gap-4"
1278
+ }, Dr = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ar = { class: "fm-typo-en-body-lg-600" }, Tr = {
1279
+ key: 3,
1280
+ class: "flex flex-col gap-4"
1281
+ }, Pr = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, $r = { class: "fm-typo-en-body-lg-600" }, Cr = {
1282
+ key: 4,
1283
+ class: "flex flex-col gap-4"
1284
+ }, Ir = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Fr = { class: "fm-typo-en-body-lg-600" }, Er = { class: "border border-fm-color-neutral-gray-200 fm-corner-radius-lg p-16" }, Br = { class: "flex flex-col gap-8" }, Lr = { class: "flex gap-8 items-center" }, Ur = { class: "flex-1 fm-typo-en-body-lg-600" }, Vr = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary flex flex-col gap-4" }, Mr = { class: "flex w-full gap-4" }, Kr = { class: "basis-1/2 shrink-0 grow fm-typo-en-body-lg-400 line-clamp-2" }, jr = { class: "fm-typo-en-body-lg-600 line-clamp-2" }, zr = { class: "flex w-full gap-4 fm-typo-en-body-sm-400" }, Hr = { class: "grow fm-typo-en-body-lg-400 text-fm-color-typo-secondary line-clamp-1" }, Gr = {
1285
+ key: 0,
1286
+ class: "line-clamp-1 fm-typo-en-body-lg-400 text-fm-color-typo-secondary"
1287
+ }, Wr = { class: "py-8" }, Yr = { class: "flex justify-end gap-4 items-center" }, Qr = { class: "fm-typo-en-body-lg-600" }, Xr = {
1288
+ key: 1,
1289
+ class: "flex-1 xs:w-screen xs:max-w-full"
1290
+ }, Zr = {
1291
+ key: 0,
1292
+ class: "flex flex-col items-center gap-8 h-full"
1293
+ }, Jr = ["src"], es = { class: "fm-typo-en-body-lg-600" }, ts = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary px-16" }, rs = {
1294
+ key: 1,
1295
+ class: "px-4 flex flex-col"
1296
+ }, ss = { class: "flex gap-12 content-stretch" }, as = {
1297
+ class: "flex flex-col w-24",
1298
+ name: "circles"
1299
+ }, ns = { class: "flex-1 flex flex-col items-center" }, os = { class: "flex-1 flex flex-col items-center" }, is = {
1300
+ class: "py-12 flex flex-col gap-4",
1301
+ name: "received-at header"
1302
+ }, ls = { class: "fm-typo-en-body-lg-400" }, cs = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, us = { class: "flex gap-12 content-stretch" }, ds = {
1303
+ class: "flex flex-col w-24",
1304
+ name: "circles"
1305
+ }, ms = { class: "flex-1 flex flex-col items-center" }, fs = {
1306
+ class: "py-12 flex flex-col gap-4 flex-1",
1307
+ name: "delivery details"
1308
+ }, ps = { class: "flex flex-col gap-8" }, ys = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, vs = { class: "flex flex-col gap-4" }, hs = { class: "flex gap-8 xs:flex-col" }, Ts = /* @__PURE__ */ be({
1309
+ __name: "TransferDetails",
1310
+ props: {
1311
+ poRequest: {},
1312
+ purchaseOrder: {},
1313
+ transferTo: {},
1314
+ transferToDbName: {},
1315
+ show: { type: Boolean },
1316
+ canResubmit: { type: Boolean },
1317
+ canApprove: { type: Boolean },
1318
+ scope: {}
1319
+ },
1320
+ emits: ["update:show", "submitted"],
1321
+ setup(m, { emit: r }) {
1322
+ const a = m, N = r, u = Ve(), e = Ae(), c = Te(), f = de(), s = De(), b = W(
1323
+ () => {
1324
+ var t, d;
1325
+ return {
1326
+ id: ((t = s.sessionUser.value) == null ? void 0 : t.id) ?? "",
1327
+ name: ((d = s.sessionUser.value) == null ? void 0 : d.displayName) ?? ""
1328
+ };
1329
+ }
1330
+ ), R = Et(), { t: p } = nt(), o = W(
1331
+ () => {
1332
+ var t, d, S, g;
1333
+ return ((d = (t = a.purchaseOrder) == null ? void 0 : t.supplier) == null ? void 0 : d.internal) === "restaurant" || ((g = (S = a.purchaseOrder) == null ? void 0 : S.supplier) == null ? void 0 : g.internal) === "warehouse" ? ue.TRANSFER : ue.PURCHASE;
1334
+ }
1335
+ ), l = K(!1), i = K(""), y = K(!0), O = Pe(), T = Dt(O.getWorkflowConfig), X = it(), Y = W(() => {
1336
+ if (!a.purchaseOrder)
1337
+ return [];
1338
+ const t = T.result.value;
1339
+ if (t.state === Ze.loading)
1340
+ return [];
1341
+ const d = {
1342
+ user: b.value,
1343
+ executedAt: f.locations.computeFirst(
1344
+ (g) => {
1345
+ var A;
1346
+ return g.dbName === ((A = f._currentLocation) == null ? void 0 : A.dbName) ? g : null;
1347
+ }
1348
+ ),
1349
+ purchaseOrderRequest: a.poRequest,
1350
+ purchaseOrder: a.purchaseOrder
1351
+ };
1352
+ let S = [];
1353
+ try {
1354
+ t.state === Ze.error ? (console.error("Error fetching workflow config:", t.error), S = Fe.getAvailableActions({
1355
+ ...d,
1356
+ orderConfig: Fe.getDefaultConfig()
1357
+ }).actions.filter(
1358
+ (g) => (
1359
+ // TODO: create receiveStock & processRequest dialog
1360
+ // to create their payload
1361
+ g !== w.enum.receiveStock && g !== w.enum.processRequest && g !== w.enum.closeRequest
1362
+ )
1363
+ )) : S = Fe.getAvailableActions({
1364
+ ...d,
1365
+ orderConfig: t.data
1366
+ }).actions.filter(
1367
+ (g) => g !== w.enum.receiveStock && g !== w.enum.processRequest && g !== w.enum.closeRequest
1368
+ );
1369
+ } catch (g) {
1370
+ console.error("Error getting available actions:", g);
1371
+ }
1372
+ return a.scope === "approval" && (S = S.filter((g) => g !== w.enum.completeReceive)), S;
1373
+ }), Q = xt(a, "show"), re = W(() => [
1374
+ {
1375
+ label: p("inventory.transfer.receiveRequest.details.overview"),
1376
+ value: "overview"
1377
+ },
1378
+ {
1379
+ label: p("inventory.transfer.receiveRequest.details.deliveryHistory"),
1380
+ value: "deliveryHistory"
1381
+ }
1382
+ ]), Z = K(re.value[0]);
1383
+ bt(
1384
+ () => a.show,
1385
+ (t) => {
1386
+ t && (Z.value = re.value[0]);
1387
+ }
1388
+ );
1389
+ async function me(t, d, S, g, A) {
1390
+ return new Promise((V, j) => {
1391
+ u.open({
1392
+ closeButton: !1,
1393
+ title: g.title,
1394
+ message: g.message,
1395
+ primaryActions: g.primaryActions,
1396
+ secondaryActions: { text: "No", close: !1 }
1397
+ }).onPrimary(async () => {
1398
+ var P, C, U, I;
1399
+ const v = [];
1400
+ S === w.enum.approveRequest ? (v.push({
1401
+ action: "approveRequest",
1402
+ payload: null
1403
+ }), d.fulfillment && v.push({
1404
+ action: "processRequest",
1405
+ payload: {
1406
+ fulfillmentId: "",
1407
+ deliveryOrderNumber: "",
1408
+ deliveryRemark: null,
1409
+ items: d.fulfillment.items,
1410
+ createdBy: b.value
1411
+ }
1412
+ })) : S === w.enum.processRequest && d.fulfillment && v.push({
1413
+ action: "processRequest",
1414
+ payload: {
1415
+ fulfillmentId: "",
1416
+ deliveryOrderNumber: "",
1417
+ deliveryRemark: null,
1418
+ items: d.fulfillment.items,
1419
+ createdBy: b.value
1420
+ }
1421
+ });
1422
+ try {
1423
+ await X({
1424
+ operate: {
1425
+ operation: S,
1426
+ doc: t,
1427
+ options: d
1428
+ },
1429
+ operateV2: {
1430
+ _id: ((P = a.purchaseOrder) == null ? void 0 : P._id) ?? "",
1431
+ _rev: ((C = a.purchaseOrder) == null ? void 0 : C._rev) ?? "",
1432
+ action: S,
1433
+ payloads: v
1434
+ // add payload if action is receiveStock or processRequest
1435
+ },
1436
+ transferTo: (I = (U = a.poRequest) == null ? void 0 : U.to) == null ? void 0 : I.dbName
1437
+ }).delayed(1e3), V("submitted");
1438
+ } catch (z) {
1439
+ j(z);
1440
+ }
1441
+ }).onSecondary(() => {
1442
+ V("cancelled");
1443
+ for (let v = 0; v < A + 2; v++)
1444
+ u.close();
1445
+ }).onClose(() => {
1446
+ });
1447
+ });
1448
+ }
1449
+ async function ae(t) {
1450
+ var g, A, V, j;
1451
+ if (t === w.enum.receiveStock)
1452
+ return;
1453
+ const d = ot[t];
1454
+ if (!d) {
1455
+ e.open({
1456
+ title: "Something went wrong",
1457
+ message: `Cannot process order: ${et(t)}`,
1458
+ type: "error"
1459
+ });
1460
+ return;
1461
+ }
1462
+ const { successMessage: S } = d;
1463
+ if (a.purchaseOrder) {
1464
+ i.value = `${t}`, l.value = !0, y.value = !1;
1465
+ const v = {};
1466
+ let P = 0;
1467
+ if ((t === w.enum.confirmDraft || // auto receive for warehouse to warehouse
1468
+ t === w.enum.completeReceive) && c.autoReceiveWarehouse)
1469
+ v.autoReceive = !0;
1470
+ else if ((t === w.enum.approveRequest || t === w.enum.processRequest) && c.acceptRequireFulfillment) {
1471
+ const C = (A = (g = a.poRequest) == null ? void 0 : g.from) == null ? void 0 : A.dbName, U = (j = (V = a.poRequest) == null ? void 0 : V.to) == null ? void 0 : j.dbName;
1472
+ if (C && U && (C.startsWith("warehouse_") || U.startsWith("warehouse_"))) {
1473
+ const I = await new Promise((z, F) => {
1474
+ u.open({
1475
+ closeButton: !1,
1476
+ title: "Confirm transfer amount",
1477
+ dialogComponent: Ft,
1478
+ dialogComponentProps: {
1479
+ purchaseOrder: a.purchaseOrder,
1480
+ confirm: z,
1481
+ "onUpdate:show": (se) => {
1482
+ se || (i.value = "", l.value = !1, y.value = !0, P++, u.close()), F("cancelled");
1483
+ }
1484
+ }
1485
+ });
1486
+ });
1487
+ v.fulfillment = I;
1488
+ }
1489
+ }
1490
+ try {
1491
+ await me(
1492
+ a.purchaseOrder,
1493
+ v,
1494
+ t,
1495
+ d,
1496
+ P
1497
+ ) === "submitted" && (e.open({
1498
+ title: "Success",
1499
+ message: S,
1500
+ type: "success"
1501
+ }), N("update:show", !1), N("submitted"));
1502
+ } catch (C) {
1503
+ e.open({
1504
+ title: "Something went wrong",
1505
+ message: "Please try again.",
1506
+ type: "error"
1507
+ }), console.error("Error when submitting PO operation", t, a.purchaseOrder, C);
1508
+ } finally {
1509
+ i.value = "", l.value = !1, y.value = !0;
1510
+ }
1511
+ }
1512
+ }
1513
+ const fe = W(() => {
1514
+ var t, d;
1515
+ return ((t = a.purchaseOrder) == null ? void 0 : t.status) === le.enum.RECEIVING || ((d = a.purchaseOrder) == null ? void 0 : d.status) === le.enum.COMPLETE;
1516
+ }), $e = W(() => {
1517
+ var V, j, v;
1518
+ const S = (((V = a.purchaseOrder) == null ? void 0 : V.deliveryOrder) ?? []).flatMap((P) => P.received ?? []).reduce(
1519
+ (P, C) => {
1520
+ const U = P[C.sku._id] ?? [];
1521
+ return P[C.sku._id] = [...U, C], P;
1522
+ },
1523
+ {}
1524
+ ), g = Object.entries(S).reduce(
1525
+ (P, [C, U]) => {
1526
+ const I = U.reduce((z, F) => {
1527
+ const se = yt(
1528
+ z,
1529
+ Math.max(z.precision, F.amount.precision)
1530
+ );
1531
+ return Le(se, F.amount);
1532
+ }, Ne(0));
1533
+ return P[C] = I, P;
1534
+ },
1535
+ {}
1536
+ ), A = ((j = a.purchaseOrder) == null ? void 0 : j.items) ?? [];
1537
+ for (const P of A)
1538
+ g[v = P.sku._id] ?? (g[v] = Ne(0));
1539
+ return g;
1540
+ }), oe = W(() => {
1541
+ var V, j;
1542
+ const t = ((V = a.purchaseOrder) == null ? void 0 : V.deliveryOrder) ?? [], d = ((j = a.purchaseOrder) == null ? void 0 : j.deliveryFullfillment) ?? [], S = [
1543
+ ...t.map((v) => ({
1544
+ createdAt: v.createdAt,
1545
+ type: "grn",
1546
+ doc: v
1547
+ })),
1548
+ ...d.map((v) => ({
1549
+ createdAt: v.createdAt,
1550
+ type: "fulfillment",
1551
+ doc: v
1552
+ }))
1553
+ ];
1554
+ S.reverse().sort((v, P) => v.createdAt.localeCompare(P.createdAt));
1555
+ function g(v) {
1556
+ var U, I, z, F, se, ge, _e, Se, E;
1557
+ const P = d.findIndex(($) => $.id === v.fullfillmentId), C = [
1558
+ (I = (U = d[P]) == null ? void 0 : U.netSuite) != null && I.refNo ? {
1559
+ label: "Fulfillment's ref no. (Netsuite)",
1560
+ values: [(F = (z = d[P]) == null ? void 0 : z.netSuite) == null ? void 0 : F.refNo]
1561
+ } : null,
1562
+ (se = v == null ? void 0 : v.netSuite) != null && se.refNo ? {
1563
+ label: "Netsuite ref no.",
1564
+ values: [(ge = v == null ? void 0 : v.netSuite) == null ? void 0 : ge.refNo]
1565
+ } : null,
1566
+ (_e = v == null ? void 0 : v.netSuite) != null && _e.recordType ? {
1567
+ label: "Netsuite Type",
1568
+ values: [rt((Se = v == null ? void 0 : v.netSuite) == null ? void 0 : Se.recordType)]
1569
+ } : null
1570
+ ];
1571
+ return {
1572
+ header: "Received",
1573
+ date: Ce(new Date(v.createdAt)),
1574
+ info: [
1575
+ {
1576
+ label: "Adjustment date",
1577
+ values: [
1578
+ v.adjustment ? Ce(new Date(vt(v.adjustment))) : "-"
1579
+ ]
1580
+ },
1581
+ {
1582
+ label: "Received by",
1583
+ values: [(E = v.createdBy) == null ? void 0 : E.name]
1584
+ },
1585
+ {
1586
+ label: "Received items",
1587
+ values: v.received.map(($) => {
1588
+ var M;
1589
+ return D("div", [
1590
+ D(
1591
+ "div",
1592
+ {
1593
+ class: "flex gap-4"
1594
+ },
1595
+ [
1596
+ D(
1597
+ "div",
1598
+ {
1599
+ class: "flex flex-col"
1600
+ },
1601
+ [
1602
+ D(
1603
+ "span",
1604
+ {
1605
+ class: "fm-typo-en-body-lg-800 basis-1/2 shrink-0 grow"
1606
+ },
1607
+ `${$.sku.name}`
1608
+ ),
1609
+ D(
1610
+ "span",
1611
+ {
1612
+ class: "fm-typo-en-body-md-400"
1613
+ },
1614
+ `${$.sku.code} `
1615
+ )
1616
+ ]
1617
+ ),
1618
+ D(
1619
+ "div",
1620
+ {
1621
+ class: "ml-auto flex flex-col"
1622
+ },
1623
+ [
1624
+ D(
1625
+ "div",
1626
+ {
1627
+ class: "ml-auto flex gap-1"
1628
+ },
1629
+ [
1630
+ D(
1631
+ "span",
1632
+ {
1633
+ class: "fm-typo-en-body-lg-600 self-end"
1634
+ },
1635
+ ie($.amount, !1)
1636
+ ),
1637
+ D(
1638
+ "span",
1639
+ {
1640
+ class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary"
1641
+ },
1642
+ ((M = $.measurement) == null ? void 0 : M.abbrev) ?? $.sku.unit.abbrev
1643
+ )
1644
+ ]
1645
+ ),
1646
+ D(
1647
+ "div",
1648
+ {
1649
+ class: "flex self-end fm-typo-en-body-md-400 text-fm-color-typo-secondary"
1650
+ },
1651
+ `${$.cost ? `(${Oe($.cost)})` : ""}`
1652
+ )
1653
+ ]
1654
+ )
1655
+ ]
1656
+ )
1657
+ ]);
1658
+ })
1659
+ },
1660
+ v.deliveryOrderNumber ? {
1661
+ label: "Delivery order no.",
1662
+ values: [v.deliveryOrderNumber]
1663
+ } : null,
1664
+ v.remark ? {
1665
+ label: "Remark",
1666
+ values: [v.remark]
1667
+ } : null,
1668
+ P > -1 ? {
1669
+ label: "Fulfilment's sequence",
1670
+ values: [`${P + 1}`]
1671
+ } : null,
1672
+ ...C
1673
+ ].filter(($) => $)
1674
+ };
1675
+ }
1676
+ function A(v) {
1677
+ var C, U;
1678
+ const P = d.findIndex((I) => I.id === v.id);
1679
+ return {
1680
+ header: "Fulfillment",
1681
+ date: Ce(new Date(v.createdAt)),
1682
+ info: [
1683
+ {
1684
+ label: "Sequence",
1685
+ values: [String(P + 1)]
1686
+ },
1687
+ {
1688
+ label: "Receiveable items",
1689
+ values: v.items.map((I) => {
1690
+ var z;
1691
+ return D("div", [
1692
+ D(
1693
+ "div",
1694
+ {
1695
+ class: "flex gap-4"
1696
+ },
1697
+ [
1698
+ D(
1699
+ "div",
1700
+ {
1701
+ class: "flex flex-col"
1702
+ },
1703
+ [
1704
+ D(
1705
+ "span",
1706
+ {
1707
+ class: "fm-typo-en-body-lg-800 basis-1/2 shrink-0 grow"
1708
+ },
1709
+ `${I.sku.name}`
1710
+ ),
1711
+ D(
1712
+ "span",
1713
+ {
1714
+ class: "fm-typo-en-body-md-400"
1715
+ },
1716
+ `${I.sku.code} `
1717
+ )
1718
+ ]
1719
+ ),
1720
+ D(
1721
+ "div",
1722
+ {
1723
+ class: "ml-auto flex flex-col"
1724
+ },
1725
+ [
1726
+ D(
1727
+ "div",
1728
+ {
1729
+ class: "ml-auto flex gap-1"
1730
+ },
1731
+ [
1732
+ D(
1733
+ "span",
1734
+ {
1735
+ class: "fm-typo-en-body-lg-600 self-end"
1736
+ },
1737
+ ie(I.amount, !1)
1738
+ ),
1739
+ D(
1740
+ "span",
1741
+ {
1742
+ class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary"
1743
+ },
1744
+ ((z = I.measurement) == null ? void 0 : z.abbrev) ?? I.sku.unit.abbrev
1745
+ )
1746
+ ]
1747
+ ),
1748
+ D(
1749
+ "div",
1750
+ {
1751
+ class: "flex self-end fm-typo-en-body-md-400 text-fm-color-typo-secondary"
1752
+ },
1753
+ `${I.cost ? `(${Oe(I.cost)})` : ""}`
1754
+ )
1755
+ ]
1756
+ )
1757
+ ]
1758
+ )
1759
+ ]);
1760
+ })
1761
+ },
1762
+ (C = v.netSuite) != null && C.refNo ? {
1763
+ label: "Ref no. (Netsuite)",
1764
+ values: [(U = v.netSuite) == null ? void 0 : U.refNo]
1765
+ } : null
1766
+ ].filter((I) => I)
1767
+ };
1768
+ }
1769
+ return S.map((v) => {
1770
+ switch (v.type) {
1771
+ case "grn":
1772
+ return g(v.doc);
1773
+ case "fulfillment":
1774
+ return A(v.doc);
1775
+ }
1776
+ });
1777
+ }), k = W(() => {
1778
+ var d;
1779
+ const t = {
1780
+ ...Ne(0),
1781
+ currency: Qe()
1782
+ };
1783
+ return ((d = a.purchaseOrder) == null ? void 0 : d.items.reduce((S, g) => ({
1784
+ ...Le(S, g.totalCost ?? t),
1785
+ currency: Qe()
1786
+ }), t)) ?? t;
1787
+ });
1788
+ return (t, d) => {
1789
+ var I, z;
1790
+ const S = G("FmButtonGroup"), g = G("FmChip"), A = G("FmMenuDivider"), V = G("FmCard"), j = G("FmIcon"), v = G("FmTooltip"), P = G("FmSpacer"), C = G("FmButton"), U = G("FmSideSheet");
1791
+ return _(), ne(U, {
1792
+ header: h(p)("inventory.transfer.receiveRequest.details.title") + ((I = t.purchaseOrder) != null && I.seqNumber ? ` #${(z = t.purchaseOrder) == null ? void 0 : z.seqNumber}` : ""),
1793
+ modelValue: h(Q),
1794
+ "onUpdate:modelValue": d[5] || (d[5] = (F) => gt(Q) ? Q.value = F : null),
1795
+ "dismiss-away": y.value,
1796
+ "close-button": "",
1797
+ "max-width": 600
1798
+ }, {
1799
+ default: ce(() => {
1800
+ var F, se, ge, _e, Se;
1801
+ return [
1802
+ n("div", dr, [
1803
+ n("div", null, [
1804
+ B(S, {
1805
+ items: re.value,
1806
+ modelValue: Z.value,
1807
+ "onUpdate:modelValue": d[0] || (d[0] = (E) => Z.value = E)
1808
+ }, null, 8, ["items", "modelValue"])
1809
+ ]),
1810
+ Z.value.value === "overview" ? (_(), q(te, { key: 0 }, [
1811
+ n("div", null, [
1812
+ B(V, {
1813
+ variant: "outlined",
1814
+ class: "flex flex-col gap-8 px-12 py-16"
1815
+ }, {
1816
+ default: ce(() => {
1817
+ var E, $, M, pe, ye, Re, Me, Ke, je, ze, He, Ge;
1818
+ return [
1819
+ n("div", mr, [
1820
+ n("div", fr, x(h(p)("inventory.transfer.receiveRequest.details.requestSummary")), 1),
1821
+ n("div", null, [
1822
+ B(g, {
1823
+ label: h(p)(`inventory.transfer.status.${(E = t.purchaseOrder) == null ? void 0 : E.status}`),
1824
+ class: xe(`fm-status-badge fm-status-badge-${(M = ($ = t.purchaseOrder) == null ? void 0 : $.status) == null ? void 0 : M.toLocaleLowerCase("en-us")}`),
1825
+ compact: ""
1826
+ }, null, 8, ["label", "class"])
1827
+ ])
1828
+ ]),
1829
+ B(A),
1830
+ n("div", pr, [
1831
+ n("div", yr, [
1832
+ n("div", vr, [
1833
+ n("div", hr, x(h(p)("inventory.transfer.receiveRequest.details.createdAt")), 1)
1834
+ ]),
1835
+ n("div", br, x(h(ke)(((pe = t.purchaseOrder) == null ? void 0 : pe._id) ?? "")), 1)
1836
+ ]),
1837
+ (ye = t.purchaseOrder) != null && ye.effectiveAt ? (_(), q("div", gr, [
1838
+ n("div", _r, x(h(p)("inventory.transfer.receiveRequest.details.backdatedTo")), 1),
1839
+ n("div", Sr, x(h(tt)(new Date((Re = t.purchaseOrder) == null ? void 0 : Re.effectiveAt))), 1)
1840
+ ])) : L("", !0),
1841
+ n("div", wr, [
1842
+ n("div", Rr, x(h(p)("inventory.transfer.receiveRequest.details.type.title")), 1),
1843
+ n("div", Or, x(h(p)(
1844
+ `inventory.transfer.receiveRequest.details.type.${o.value.toLocaleLowerCase("en-US")}`
1845
+ )), 1)
1846
+ ]),
1847
+ (Ke = (Me = t.purchaseOrder) == null ? void 0 : Me.supplier) != null && Ke.name ? (_(), q("div", xr, [
1848
+ n("div", Nr, x(h(p)("inventory.transfer.receiveRequest.details.from")), 1),
1849
+ n("div", kr, x((ze = (je = t.purchaseOrder) == null ? void 0 : je.supplier) == null ? void 0 : ze.name), 1)
1850
+ ])) : L("", !0),
1851
+ t.transferTo ? (_(), q("div", qr, [
1852
+ n("div", Dr, x(h(p)("inventory.transfer.receiveRequest.details.to")), 1),
1853
+ n("div", Ar, x(t.transferTo), 1)
1854
+ ])) : L("", !0),
1855
+ (He = t.purchaseOrder) != null && He.ref ? (_(), q("div", Tr, [
1856
+ n("div", Pr, x(h(p)("inventory.transfer.receiveRequest.details.reference")), 1),
1857
+ n("div", $r, x(t.purchaseOrder.ref), 1)
1858
+ ])) : L("", !0),
1859
+ (Ge = t.purchaseOrder) != null && Ge.remark ? (_(), q("div", Cr, [
1860
+ n("div", Ir, x(h(p)("inventory.transfer.receiveRequest.details.remark")), 1),
1861
+ n("div", Fr, x(t.purchaseOrder.remark), 1)
1862
+ ])) : L("", !0)
1863
+ ])
1864
+ ];
1865
+ }),
1866
+ _: 1
1867
+ })
1868
+ ]),
1869
+ B(ur, {
1870
+ "po-request": t.poRequest,
1871
+ purchaseOrder: t.purchaseOrder,
1872
+ transferType: o.value,
1873
+ transferToDbName: t.transferToDbName,
1874
+ scope: t.scope
1875
+ }, null, 8, ["po-request", "purchaseOrder", "transferType", "transferToDbName", "scope"]),
1876
+ n("div", Er, [
1877
+ n("div", Br, [
1878
+ n("div", Lr, [
1879
+ n("span", Ur, [
1880
+ Ie(x(fe.value ? h(p)("inventory.transfer.receiveRequest.details.receivedItems") : h(p)("inventory.transfer.receiveRequest.details.requestedItems")) + " ", 1),
1881
+ (se = (F = t.purchaseOrder) == null ? void 0 : F.netSuite) != null && se.missingItems && ((_e = (ge = t.purchaseOrder) == null ? void 0 : ge.netSuite) == null ? void 0 : _e.missingItems.length) > 0 ? (_(), ne(v, {
1882
+ key: 0,
1883
+ variant: "rich",
1884
+ placement: "top",
1885
+ "z-index": 51
1886
+ }, {
1887
+ content: ce(() => {
1888
+ var E, $;
1889
+ return [
1890
+ n("div", Vr, [
1891
+ (_(!0), q(te, null, ve(($ = (E = t.purchaseOrder) == null ? void 0 : E.netSuite) == null ? void 0 : $.missingItems, (M, pe) => (_(), q("div", {
1892
+ class: "flex justify-center align-middle",
1893
+ key: pe
1894
+ }, [
1895
+ B(j, {
1896
+ name: "arrow_right",
1897
+ size: "sm"
1898
+ }),
1899
+ Ie(" " + x(`(${M.netSuiteId}) ${M.name}: ${M.reason}`), 1)
1900
+ ]))), 128))
1901
+ ])
1902
+ ];
1903
+ }),
1904
+ default: ce(() => [
1905
+ B(j, {
1906
+ name: "error",
1907
+ color: "#ff2c2c",
1908
+ size: "sm"
1909
+ })
1910
+ ]),
1911
+ _: 1
1912
+ })) : L("", !0)
1913
+ ])
1914
+ ]),
1915
+ B(A),
1916
+ (_(!0), q(te, null, ve(((Se = t.purchaseOrder) == null ? void 0 : Se.items) ?? [], (E) => {
1917
+ var $;
1918
+ return _(), q("div", {
1919
+ key: E.code,
1920
+ class: "flex flex-col"
1921
+ }, [
1922
+ n("div", Mr, [
1923
+ n("div", Kr, x(E.name), 1),
1924
+ n("div", jr, x(h(ie)($e.value[E.sku._id], !1)) + "/" + x(h(at)(E.quantity, E.sku.unit, E.measurement)), 1)
1925
+ ]),
1926
+ n("div", zr, [
1927
+ n("div", Hr, x(E.code), 1),
1928
+ ($ = E.totalCost) != null && $.amount && h(c).enableTotalCost ? (_(), q("div", Gr, " (" + x(h(Oe)(E.totalCost)) + ") ", 1)) : L("", !0)
1929
+ ])
1930
+ ]);
1931
+ }), 128)),
1932
+ +h(ie)(k.value) ? (_(), q(te, { key: 0 }, [
1933
+ n("div", Wr, [
1934
+ B(A)
1935
+ ]),
1936
+ n("div", Yr, [
1937
+ d[6] || (d[6] = n("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, "Total:", -1)),
1938
+ n("div", Qr, x(h(Oe)(k.value)), 1)
1939
+ ])
1940
+ ], 64)) : L("", !0)
1941
+ ])
1942
+ ])
1943
+ ], 64)) : Z.value.value === "deliveryHistory" ? (_(), q("div", Xr, [
1944
+ oe.value.length ? (_(), q("div", rs, [
1945
+ (_(!0), q(te, null, ve(oe.value, (E, $) => (_(), q(te, { key: $ }, [
1946
+ n("div", ss, [
1947
+ n("div", as, [
1948
+ n("div", ns, [
1949
+ n("div", {
1950
+ class: xe([
1951
+ {
1952
+ "bg-fm-color-primary": $ !== 0,
1953
+ "bg-white": $ === 0
1954
+ },
1955
+ "w-[2px] h-full"
1956
+ ])
1957
+ }, null, 2)
1958
+ ]),
1959
+ d[7] || (d[7] = n("div", { class: "h-24 w-24 bg-fm-color-primary rounded-full" }, null, -1)),
1960
+ n("div", os, [
1961
+ n("div", {
1962
+ class: xe([
1963
+ {
1964
+ "bg-fm-color-primary": $ < oe.value.length - 1,
1965
+ "bg-white": $ >= oe.value.length - 1
1966
+ },
1967
+ "w-[2px] h-full"
1968
+ ])
1969
+ }, null, 2)
1970
+ ])
1971
+ ]),
1972
+ n("div", is, [
1973
+ n("div", ls, x(E.header), 1),
1974
+ n("div", cs, x(E.date), 1)
1975
+ ])
1976
+ ]),
1977
+ n("div", us, [
1978
+ n("div", ds, [
1979
+ n("div", ms, [
1980
+ n("div", {
1981
+ class: xe([
1982
+ {
1983
+ "bg-fm-color-primary": $ < oe.value.length - 1,
1984
+ "bg-white": $ >= oe.value.length - 1
1985
+ },
1986
+ "w-[2px] h-full"
1987
+ ])
1988
+ }, null, 2)
1989
+ ])
1990
+ ]),
1991
+ n("div", fs, [
1992
+ B(V, {
1993
+ variant: "outlined",
1994
+ class: "py-12 px-16"
1995
+ }, {
1996
+ default: ce(() => [
1997
+ n("div", ps, [
1998
+ (_(!0), q(te, null, ve(E.info, (M, pe) => (_(), q("div", {
1999
+ key: pe,
2000
+ class: "flex flex-col gap-4"
2001
+ }, [
2002
+ n("div", ys, x(M == null ? void 0 : M.label), 1),
2003
+ n("div", vs, [
2004
+ (_(!0), q(te, null, ve(M == null ? void 0 : M.values, (ye, Re) => (_(), q("div", {
2005
+ key: Re,
2006
+ class: "fm-typo-en-body-lg-600"
2007
+ }, [
2008
+ typeof ye == "string" ? (_(), q(te, { key: 0 }, [
2009
+ Ie(x(ye), 1)
2010
+ ], 64)) : (_(), ne(_t(ye), { key: 1 }))
2011
+ ]))), 128))
2012
+ ])
2013
+ ]))), 128))
2014
+ ])
2015
+ ]),
2016
+ _: 2
2017
+ }, 1024)
2018
+ ])
2019
+ ])
2020
+ ], 64))), 128))
2021
+ ])) : (_(), q("div", Zr, [
2022
+ B(P),
2023
+ n("div", null, [
2024
+ n("img", {
2025
+ src: h(Ot),
2026
+ alt: "List is empty"
2027
+ }, null, 8, Jr)
2028
+ ]),
2029
+ n("div", es, x(h(p)("inventory.transfer.receiveRequest.details.noRecordsFound")), 1),
2030
+ n("div", ts, x(h(p)("inventory.transfer.receiveRequest.details.trackDeliveryMessage")), 1),
2031
+ B(P),
2032
+ B(P)
2033
+ ]))
2034
+ ])) : L("", !0)
2035
+ ])
2036
+ ];
2037
+ }),
2038
+ "side-sheet-footer": ce(() => [
2039
+ n("div", hs, [
2040
+ (_(!0), q(te, null, ve(Y.value, (F) => (_(), q(te, null, [
2041
+ h(Be)[F].available != !1 ? (_(), ne(C, {
2042
+ key: F,
2043
+ label: h(p)(h(Be)[F].translationKey),
2044
+ onClick: (se) => ae(F),
2045
+ loading: i.value === F,
2046
+ disabled: i.value !== F && l.value,
2047
+ variant: h(Be)[F].buttonVariant
2048
+ }, null, 8, ["label", "onClick", "loading", "disabled", "variant"])) : L("", !0)
2049
+ ], 64))), 256)),
2050
+ h(R).ableToMarkReceived(t.purchaseOrder) && !Y.value.includes("completeReceive") ? (_(), ne(C, {
2051
+ key: 0,
2052
+ label: h(p)("inventory.transfer.receiveRequest.actions.completeReceive"),
2053
+ onClick: d[1] || (d[1] = (F) => ae("completeReceive")),
2054
+ loading: i.value === "completeReceive",
2055
+ disabled: i.value !== "completeReceive" && l.value
2056
+ }, null, 8, ["label", "loading", "disabled"])) : L("", !0),
2057
+ h(R).ableToMarkApproved(t.purchaseOrder) && t.canApprove && !Y.value.includes("approveRequest") ? (_(), ne(C, {
2058
+ key: 1,
2059
+ label: h(p)("inventory.transfer.approval.actions.approveRequest"),
2060
+ onClick: d[2] || (d[2] = (F) => ae("approveRequest")),
2061
+ loading: i.value === "approveRequest",
2062
+ disabled: i.value !== "approveRequest" && l.value
2063
+ }, null, 8, ["label", "loading", "disabled"])) : L("", !0),
2064
+ h(R).ableToCreateFulfillment(t.purchaseOrder, t.poRequest) ? (_(), ne(C, {
2065
+ key: 2,
2066
+ label: h(p)("inventory.transfer.receiveRequest.actions.processRequest"),
2067
+ onClick: d[3] || (d[3] = (F) => ae("processRequest")),
2068
+ loading: i.value === "processRequest",
2069
+ disabled: i.value !== "processRequest" && l.value
2070
+ }, null, 8, ["label", "loading", "disabled"])) : L("", !0),
2071
+ B(C, {
2072
+ label: h(p)("common.close"),
2073
+ variant: "tertiary",
2074
+ onClick: d[4] || (d[4] = (F) => N("update:show", !1))
2075
+ }, null, 8, ["label"])
2076
+ ])
2077
+ ]),
2078
+ _: 1
2079
+ }, 8, ["header", "modelValue", "dismiss-away"]);
2080
+ };
2081
+ }
2082
+ });
2083
+ export {
2084
+ Ue as P,
2085
+ Ts as _,
2086
+ Ds as a,
2087
+ As as b,
2088
+ Tt as g,
2089
+ Pe as u
2090
+ };