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