@feedmepos/mf-inventory-portal 1.1.1-dev.2 → 1.1.2-dev.1

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