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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/dist/{App-Dg4euzi-.js → App-CBwWCCOM.js} +1 -1
  2. package/dist/{ApprovalView-CPEajz8D.js → ApprovalView-BrRGheio.js} +2 -2
  3. package/dist/{BindingsDialog-D69Lz-W9.js → BindingsDialog-BSPkkRis.js} +2 -2
  4. package/dist/{BindingsPicker-CvM0o8k2.js → BindingsPicker-L3XnC3__.js} +1 -1
  5. package/dist/{BindingsTable-DX9KrKZx.js → BindingsTable-CgUm0Ity.js} +1 -1
  6. package/dist/{ClosingDraftView-zo2KEPba.js → ClosingDraftView-D_gq2fCk.js} +2 -2
  7. package/dist/{ClosingTemplateView-DfkfCFdy.js → ClosingTemplateView-Q16zr6EV.js} +2 -2
  8. package/dist/{DeliveryOrderPrintPreview-Cl_G1v2L.js → DeliveryOrderPrintPreview-mVDQO6Xq.js} +1 -1
  9. package/dist/{FmAdminBadge--YYdqDeq.js → FmAdminBadge-Cjy6QPoR.js} +1 -1
  10. package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-BnxjX2Nv.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-DnH2Qxnr.js} +3 -3
  11. package/dist/{FmMultiselectDialog-CENHExht.js → FmMultiselectDialog-BbYhJk_O.js} +1 -1
  12. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-DTfMfCVb.js → FmUnitInput.vue_vue_type_script_setup_true_lang-D0qlxGgo.js} +1 -1
  13. package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-D65OfkW-.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-CCuLSITo.js} +1 -1
  14. package/dist/{IngredientGroupView-BBw9UqRf.js → IngredientGroupView-CJ9Rsfg-.js} +2 -2
  15. package/dist/{IngredientsView-WtOZ9Ara.js → IngredientsView-BbKzQnQP.js} +4 -4
  16. package/dist/{IntegrationView-YFafrCnU.js → IntegrationView-B4giJ-Zl.js} +4 -4
  17. package/dist/{InventoryBindingForm-DNljyNN-.js → InventoryBindingForm-bNRoyTsA.js} +1 -1
  18. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-C2dTKKAj.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-DAaoOXUY.js} +3 -3
  19. package/dist/{InventoryBindingSummary-DOONgjR-.js → InventoryBindingSummary-NfFve-nM.js} +1 -1
  20. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-D3Elw6_K.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DP11tzty.js} +1 -1
  21. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-CYiwHmvH.js → PremiumBadge.vue_vue_type_script_setup_true_lang-yjjkBSqL.js} +1 -1
  22. package/dist/{PublishView-CL5U8cyq.js → PublishView-w9GYA6kf.js} +1 -1
  23. package/dist/{PurchaseOrderPrintPreview-PfG5JjNN.js → PurchaseOrderPrintPreview-DmdDJmEq.js} +1 -1
  24. package/dist/{ReceiveRequestView-DB-Df7af.js → ReceiveRequestView-z4o7lZvK.js} +8 -8
  25. package/dist/{RecipeView-DYYehKGI.js → RecipeView-DiiQtfXn.js} +3 -3
  26. package/dist/{StockView-lbA_CgVg.js → StockView-DKR2nFdm.js} +7 -7
  27. package/dist/{SupplierView-DKq68lkF.js → SupplierView-BJcU4iQk.js} +3 -3
  28. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-UNVxzRmJ.js +3058 -0
  29. package/dist/{TransferTemplateView-CYdVExkv.js → TransferTemplateView-rCbAWlh_.js} +6 -6
  30. package/dist/{UnitView-BLDTNtXw.js → UnitView-BW9hbVHL.js} +3 -3
  31. package/dist/{WarehouseView-ByfTvgQq.js → WarehouseView-BO0hf42-.js} +1 -1
  32. package/dist/api/purchase-order.d.ts +2 -0
  33. package/dist/{app-DEpHnIaM.js → app-ChezCkd5.js} +8261 -8205
  34. package/dist/app.js +1 -1
  35. package/dist/{decimal-BdGG2NHb.js → decimal-1sc-GcXN.js} +1 -1
  36. package/dist/{format-unit-display-DoCxmNPB.js → format-unit-display-BK2TkQOA.js} +2 -2
  37. package/dist/{index-BI2zM3ru.js → index-CWivxw9k.js} +1 -1
  38. package/dist/{index-CCmaDOGB.js → index-cLW2Uxz3.js} +1 -1
  39. package/dist/{stock-CtzGgdTO.js → stock-FEj_v-SS.js} +1 -1
  40. package/dist/stores/feature.d.ts +8 -0
  41. package/dist/{supplier-hiLnFx22.js → supplier-2r8VFThu.js} +1 -1
  42. package/dist/tsconfig.app.tsbuildinfo +1 -1
  43. package/dist/{use-ingredient-select-dialog-BWBy-LTC.js → use-ingredient-select-dialog-CvgFQA-k.js} +1 -1
  44. package/dist/{use-inventory-binding-dialog-6H3lD9xF.js → use-inventory-binding-dialog-BNp88Pjt.js} +1 -1
  45. package/dist/views/receive-request/components/delivery-order-form/CreateForm.vue.d.ts +16 -0
  46. package/dist/views/receive-request/components/delivery-order-form/CreateFormProps.d.ts +4 -0
  47. package/dist/views/receive-request/components/delivery-order-form/EditForm.vue.d.ts +16 -0
  48. package/dist/views/receive-request/components/delivery-order-form/EditFormProps.d.ts +4 -0
  49. package/package.json +1 -1
  50. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-DKR568Dl.js +0 -2578
@@ -0,0 +1,3058 @@
1
+ import { a4 as mt, u as _e, aT as F, aU as Ge, aC as Z, c as qe, b as We, ac as xt, ae as wt, af as $t, aV as Rt, e as it, f as pt, a1 as rt, aW as kt, a9 as ft, V as yt, j as ye, a7 as Dt, aX as vt, aj as je, h as ct, i as me, D as ve, aY as ht, aZ as bt, a_ as Ie, L as gt, a5 as Be, a6 as ze, ab as Le, T as ke, t as ut, aA as Ae, a$ as Qe, b0 as Re } from "./app-ChezCkd5.js";
2
+ import { ref as Y, computed as H, h as P, defineComponent as Se, reactive as Nt, onMounted as _t, resolveComponent as G, openBlock as f, createBlock as le, withCtx as X, createElementVNode as e, createVNode as I, unref as v, createElementBlock as x, toDisplayString as _, createCommentVNode as M, Fragment as ue, renderList as be, createTextVNode as De, normalizeClass as Ve, watch as Ct, isRef as At, resolveDynamicComponent as Tt } from "vue";
3
+ import { F as qt } from "./decimal-1sc-GcXN.js";
4
+ import { useCoreStore as Ue, useI18n as st } from "@feedmepos/mf-common";
5
+ import { useDialog as Ye, useSnackbar as Fe, components as Ke, FmButtonVariant as fe, useProxiedModel as Ft } from "@feedmepos/ui-library";
6
+ import { F as Te } from "./FmAdminBadge-Cjy6QPoR.js";
7
+ import { b as Pt, u as It, P as Ne, f as Et } from "./format-unit-display-BK2TkQOA.js";
8
+ import { E as Lt } from "./empty-placeholder-wf6-BWE8.js";
9
+ import { _ as Vt, F as Bt, a as Ut } from "./FmUnitInput.vue_vue_type_script_setup_true_lang-D0qlxGgo.js";
10
+ import { u as Mt, R as dt } from "./usePromise-CbVUCxhj.js";
11
+ import { u as jt } from "./index-CWivxw9k.js";
12
+ const Pe = mt((g, r) => {
13
+ const o = _e(), p = Ue();
14
+ return {
15
+ async readRequests(a, n, l) {
16
+ const s = a ?? o.currentLocationDBName, i = `${g.inventoryBackendUrl}/${s}/purchase-request`;
17
+ return n && l ? await r.get(`${i}?startDate=${n}&endDate=${l}`) : await r.get(i);
18
+ },
19
+ async readRequestById(a, n) {
20
+ const l = n ?? o.currentLocationDBName, s = `${g.inventoryBackendUrl}/${l}/purchase-request/${a}`;
21
+ return await r.get(s);
22
+ },
23
+ async readRequestByIds(a, n) {
24
+ const l = n ?? o.currentLocationDBName, s = `${g.inventoryBackendUrl}/${l}/purchase-request/find`;
25
+ return await r.post(s, { requestIds: a });
26
+ },
27
+ async getPurchaseOrders({
28
+ start: a,
29
+ end: n
30
+ }) {
31
+ const l = o.currentLocationDBName, s = `${g.inventoryBackendUrl}/${l}/purchase-order`;
32
+ return await r.get(`${s}?start=${a}&end=${n}`);
33
+ },
34
+ async getLatestPurchaseOrderRequest(a) {
35
+ const n = o.currentLocationDBName, l = `${g.inventoryBackendUrl}/${n}/purchase-request/find-by-purchase-order-id`;
36
+ return await r.get(`${l}/${a}`);
37
+ },
38
+ async getPurchaseOrderById(a) {
39
+ const n = o.currentLocationDBName, l = `${g.inventoryBackendUrl}/${n}/purchase-order`;
40
+ return await r.get(`${l}/${a}`);
41
+ },
42
+ /**
43
+ * @deprecated Use `processPurchaseOrderV2` instead.
44
+ */
45
+ async processPurchaseOrder(a, n) {
46
+ const l = o.currentLocationDBName, s = n || l, i = `${g.inventoryBackendUrl}/${s}/purchase-order/run-operation`;
47
+ return await r.put(i, a);
48
+ },
49
+ async createPurchaseOrder(a) {
50
+ const n = o.currentLocationDBName, l = `${g.inventoryBackendUrl}/${n}/purchase-order`;
51
+ return await r.post(l, a);
52
+ },
53
+ async updatePurchaseOrder(a) {
54
+ const n = o.currentLocationDBName, l = `${g.inventoryBackendUrl}/${n}/purchase-order`;
55
+ return await r.put(l, a);
56
+ },
57
+ async importFromXilnex(a) {
58
+ const n = o.currentLocationDBName, l = `${g.inventoryBackendUrl}/${n}/purchase-order/import-from-xilnex`;
59
+ return await r.post(l, a);
60
+ },
61
+ async processPurchaseOrderV2(a, n) {
62
+ const l = o.currentLocationDBName, s = n || l, i = `${g.inventoryBackendUrl}/${s}/v2/purchase-order/run-operation`;
63
+ return await r.put(i, a);
64
+ },
65
+ async getWorkflowConfig() {
66
+ var s;
67
+ const n = `business_${(s = p.currentBusiness.value) == null ? void 0 : s._id}`, l = `${g.inventoryBackendUrl}/${n}/v2/purchase-order/workflow-config`;
68
+ return await r.get(l);
69
+ },
70
+ async updateDeliveryOrder(a) {
71
+ const n = o.currentLocationDBName, l = `${g.inventoryBackendUrl}/${n}/delivery-order`;
72
+ return await r.put(l, a);
73
+ },
74
+ async createDeliveryOrder(a) {
75
+ const n = o.currentLocationDBName, l = `${g.inventoryBackendUrl}/${n}/delivery-order`;
76
+ return await r.post(l, a);
77
+ }
78
+ };
79
+ }), zt = mt((g, r) => {
80
+ const o = _e();
81
+ return {
82
+ async getShipments({
83
+ start: p,
84
+ end: a
85
+ }) {
86
+ const n = o.currentLocationDBName, l = `${g.inventoryBackendUrl}/${n}/shipments`;
87
+ return await r.get(`${l}?start=${p}&end=${a}`);
88
+ },
89
+ async getShipmentsByIds(p) {
90
+ if (p.length === 0)
91
+ return [];
92
+ const a = o.currentLocationDBName, n = `${g.inventoryBackendUrl}/${a}/shipments/get`;
93
+ return await r.post(n, { shipmentIds: p });
94
+ }
95
+ };
96
+ }), St = {
97
+ [F.enum.confirmDraft]: {
98
+ primaryActions: {
99
+ text: "Confirm draft",
100
+ close: !0
101
+ },
102
+ title: "Confirm draft?",
103
+ message: "Purchase order cannot be changed after confirm draft.",
104
+ successMessage: "Purchase order draft has been confirmed"
105
+ },
106
+ [F.enum.cancelDraft]: {
107
+ primaryActions: {
108
+ text: "Cancel draft",
109
+ close: !0,
110
+ variant: "destructive"
111
+ },
112
+ title: "Cancel draft?",
113
+ message: "Purchase order cannot be changed after cancelled draft.",
114
+ successMessage: "Purchase order draft has been cancelled"
115
+ },
116
+ [F.enum.submitRequest]: {
117
+ primaryActions: {
118
+ text: "Submit request",
119
+ close: !0
120
+ },
121
+ title: "Confirm draft?",
122
+ message: "Purchase order cannot be changed after confirm draft.",
123
+ successMessage: "Purchase order draft has been submitted"
124
+ },
125
+ [F.enum.completeReceive]: {
126
+ primaryActions: {
127
+ text: "Mark received",
128
+ close: !0
129
+ },
130
+ title: "Mark as received",
131
+ message: "Purchase order cannot be changed after it has complete receiving.",
132
+ successMessage: "Purchase order has been marked as received"
133
+ },
134
+ [F.enum.approveRequest]: {
135
+ primaryActions: {
136
+ text: "Accept request",
137
+ close: !0
138
+ },
139
+ title: "Accept request?",
140
+ message: "Transfer out request will be accepted.",
141
+ successMessage: "Transfer out request has been approved"
142
+ },
143
+ [F.enum.rejectRequest]: {
144
+ primaryActions: {
145
+ text: "Reject request",
146
+ close: !0,
147
+ variant: "destructive"
148
+ },
149
+ title: "Reject request?",
150
+ message: "Purchase order will be rejected.",
151
+ successMessage: "Purchase order has been rejected"
152
+ },
153
+ [F.enum.processRequest]: {
154
+ primaryActions: {
155
+ text: "Process request",
156
+ close: !0,
157
+ variant: "destructive"
158
+ },
159
+ title: "Process request?",
160
+ message: "Purchase order will be processed.",
161
+ successMessage: "Purchase order has been processed"
162
+ }
163
+ };
164
+ function He(g) {
165
+ return Ge.generatedPOReceivedMap({
166
+ purchaseOrder: g
167
+ });
168
+ }
169
+ function Kt(g) {
170
+ return Ge.validatePOItemReceivedStatus({
171
+ dto: g
172
+ });
173
+ }
174
+ function Je(g) {
175
+ return Ge.validatePOReceivedStatus({
176
+ receivedMap: g
177
+ });
178
+ }
179
+ function et(g, r, o) {
180
+ if (!Z.safeParse(g).success)
181
+ throw new Error(`Invalid purchase order status: ${g}`);
182
+ const p = Z.parse(g);
183
+ return Ge.orderStatusCombination({
184
+ status: p,
185
+ isPOPartialReceive: r,
186
+ isPOOverReceive: o
187
+ });
188
+ }
189
+ function Ot() {
190
+ const g = _e(), r = Pe(), o = qe();
191
+ async function p(n, l) {
192
+ const s = g.currentLocationDBName;
193
+ return n.doc.supplier.internal && n.operation === F.enum.confirmDraft && (n.operation = F.enum.submitRequest), await r.processPurchaseOrder(n, l || s);
194
+ }
195
+ async function a(n, l) {
196
+ const s = g.currentLocationDBName;
197
+ return await r.processPurchaseOrderV2(n, l || s);
198
+ }
199
+ return (n) => o.useOperatePurchaseOrderV2 ? a(n.operateV2, n.transferTo) : p(n.operate, n.transferTo);
200
+ }
201
+ var tt = /* @__PURE__ */ ((g) => (g.RECEIVE_REQUEST = "receive/request", g.APPROVAL = "approval", g))(tt || {});
202
+ const Ee = Y(), Xe = Y();
203
+ function gn(g, r) {
204
+ const o = Ye(), p = _e(), a = qe();
205
+ We();
206
+ const n = Pt(), l = It(), s = Y(!1), i = Fe(), O = Pe(), $ = zt(), h = Y(new Array()), q = Y(new Array()), u = Y(
207
+ r != null && r.startDate && (r != null && r.endDate) ? r : xt()
208
+ ), C = H(() => {
209
+ const V = new Date(u.value.startDate), B = new Date(u.value.endDate);
210
+ return {
211
+ start: wt(V).toISOString(),
212
+ end: $t(B).toISOString()
213
+ };
214
+ }), d = Y(new Array()), c = Rt(), y = Y(null);
215
+ async function R(V) {
216
+ function B(D) {
217
+ const S = {
218
+ mode: it.CREATE,
219
+ modelValue: V || void 0,
220
+ show: !0,
221
+ "onUpdate:show"(N) {
222
+ Ee.value.show = N;
223
+ },
224
+ templateId: D,
225
+ lastClosingDate: y.value
226
+ };
227
+ Ee.value = S;
228
+ }
229
+ let se;
230
+ a.mustUsePoTemplate && !(V != null && V.template) ? o.open({
231
+ title: "Create transfer",
232
+ message: "",
233
+ primaryActions: {
234
+ text: "Select a template",
235
+ close: !0
236
+ },
237
+ secondaryActions: {
238
+ text: "Outlet to Outlet",
239
+ variant: "secondary",
240
+ close: !0
241
+ }
242
+ }).onPrimary(async () => {
243
+ se = await n.getTemplateId(), se && B(se);
244
+ }).onSecondary(() => {
245
+ B(void 0);
246
+ }) : B(se);
247
+ }
248
+ function k(V) {
249
+ const B = {
250
+ mode: it.UPDATE,
251
+ modelValue: pt(V),
252
+ show: !0,
253
+ "onUpdate:show"(se) {
254
+ Ee.value.show = se;
255
+ },
256
+ lastClosingDate: y.value
257
+ };
258
+ Ee.value = B;
259
+ }
260
+ async function z() {
261
+ h.value = [], q.value = [], s.value = !0;
262
+ try {
263
+ const V = await O.getPurchaseOrders(C.value);
264
+ h.value = V.sort((t, m) => m._id.localeCompare(t._id));
265
+ const B = V.flatMap((t) => t.shipmentIds || []).filter(Boolean), se = B.length > 0 ? await $.getShipmentsByIds(B) : [];
266
+ q.value = se;
267
+ const D = await c.readCurrentLocationLastClosing(!0), S = D == null ? void 0 : D._id;
268
+ S && (y.value = kt(S)), await a.awaitFeatureLoaded(() => a.mustUsePoTemplate) && await l.fetchTemplates();
269
+ const N = h.value.map((t) => {
270
+ var m;
271
+ return ((m = t.request) == null ? void 0 : m.id) ?? "";
272
+ }).filter((t) => t);
273
+ d.value = await O.readRequestByIds(N);
274
+ } catch {
275
+ i.open({
276
+ title: "Something went wrong",
277
+ message: "Error at fetching purchase orders",
278
+ type: "error"
279
+ });
280
+ } finally {
281
+ s.value = !1;
282
+ }
283
+ }
284
+ async function T() {
285
+ d.value = [], s.value = !0;
286
+ try {
287
+ d.value = await O.readRequests(
288
+ void 0,
289
+ C.value.start,
290
+ C.value.end
291
+ ).then((V) => V.reverse());
292
+ } catch {
293
+ i.open({
294
+ title: "Something went wrong",
295
+ message: "Error at fetching purchase requests",
296
+ type: "error"
297
+ });
298
+ } finally {
299
+ s.value = !1;
300
+ }
301
+ }
302
+ function K() {
303
+ switch (g) {
304
+ case "receive/request":
305
+ return z();
306
+ case "approval":
307
+ return T();
308
+ }
309
+ }
310
+ function J(V, B) {
311
+ u.value = {
312
+ startDate: V,
313
+ endDate: B
314
+ }, K();
315
+ }
316
+ p.watchLocation(async (V) => {
317
+ if (!V) {
318
+ h.value = [];
319
+ return;
320
+ }
321
+ await K();
322
+ });
323
+ const oe = Y(), ce = Y(Math.random().toString());
324
+ async function Oe(V, B) {
325
+ const se = Math.random().toString();
326
+ ce.value = se, B ?? (B = d.value.computeFirst(
327
+ (N) => N.purchaseOrderId === V._id ? N : null
328
+ ) ?? void 0);
329
+ const D = g === "receive/request" ? p.currentLocation : B == null ? void 0 : B.to, S = {
330
+ poRequest: B,
331
+ purchaseOrder: V,
332
+ transferTo: D == null ? void 0 : D.name,
333
+ transferToDbName: D == null ? void 0 : D.dbName,
334
+ show: !0,
335
+ canResubmit: !1,
336
+ canApprove: g === "approval",
337
+ "onUpdate:show"(N) {
338
+ oe.value.show = N;
339
+ },
340
+ scope: g,
341
+ receivedMap: He(V) ?? {},
342
+ shipments: q.value
343
+ };
344
+ oe.value = S;
345
+ }
346
+ async function ge(V, B, se, D) {
347
+ const S = Ot();
348
+ s.value = !0;
349
+ try {
350
+ await S({
351
+ operate: {
352
+ operation: B,
353
+ doc: V,
354
+ options: (
355
+ // auto receive for supplier to warehouse
356
+ (B === F.enum.confirmDraft || // auto receive for warehouse to warehouse
357
+ B === F.enum.completeReceive) && a.autoReceiveWarehouse ? {
358
+ autoReceive: !0
359
+ } : void 0
360
+ )
361
+ },
362
+ operateV2: {
363
+ _id: V._id,
364
+ _rev: V._rev ?? "",
365
+ action: B,
366
+ payloads: []
367
+ },
368
+ transferTo: D
369
+ }), await new Promise((m) => setTimeout(m, 1e3));
370
+ const t = _e().currentLocationDBName.startsWith("restaurant_");
371
+ B === F.enum.confirmDraft && V.effectiveAt && t ? i.open({
372
+ title: "Success",
373
+ message: `${se}. The backdate will be reflected once your POS has received this change.`,
374
+ type: "success"
375
+ }) : i.open({
376
+ title: "Success",
377
+ message: se,
378
+ type: "success"
379
+ });
380
+ } catch (N) {
381
+ i.open({
382
+ title: "Something went wrong",
383
+ message: "Please try again.",
384
+ type: "error"
385
+ }), console.error("Error when submitting PO operation", B, V, N);
386
+ } finally {
387
+ s.value = !1, K();
388
+ }
389
+ }
390
+ async function xe(V, B, se) {
391
+ const D = St[B];
392
+ if (!D) {
393
+ i.open({
394
+ title: "Something went wrong",
395
+ message: `Cannot process order: ${rt(B)}`,
396
+ type: "error"
397
+ });
398
+ return;
399
+ }
400
+ const { successMessage: S, ...N } = D;
401
+ o.open({
402
+ title: N.title,
403
+ message: N.message,
404
+ primaryActions: N.primaryActions
405
+ }).onPrimary(() => {
406
+ ge(V, B, S, se);
407
+ });
408
+ }
409
+ async function he() {
410
+ o.open({
411
+ title: "Upload Transfer",
412
+ primaryActions: {
413
+ text: "Xilnex transfer note",
414
+ close: !0
415
+ },
416
+ secondaryActions: {
417
+ text: "Cancel",
418
+ close: !0
419
+ }
420
+ }).onPrimary(() => {
421
+ const V = {
422
+ show: !0,
423
+ "onUpdate:show"(B) {
424
+ Xe.value.show = B;
425
+ }
426
+ };
427
+ Xe.value = V;
428
+ });
429
+ }
430
+ return {
431
+ purchaseOrders: h,
432
+ shipments: q,
433
+ purchaseRequests: d,
434
+ updateDateRange: J,
435
+ fetchData: K,
436
+ loading: s,
437
+ transferDialogProps: Ee,
438
+ promptCreateTransferDialog: R,
439
+ promptUpdateTransferDialog: k,
440
+ transferDetailsProps: oe,
441
+ promptShowTransferDetails: Oe,
442
+ submitAction: xe,
443
+ xilnexImportDialogProps: Xe,
444
+ promptUploadTransferDialog: he
445
+ };
446
+ }
447
+ function Ht(g, r) {
448
+ return r.reduce(
449
+ (p, a) => {
450
+ const n = a.received.find((l) => l.sku._id === g._id);
451
+ return n && (p = ft(p, n.amount)), p;
452
+ },
453
+ qt.toPrecision(yt(0), g.unit.precision)
454
+ );
455
+ }
456
+ function Gt(g) {
457
+ const { po: r, currentLocation: o, business: p, fulfilling: a, por: n } = g, { name: l, address: s, regNo: i } = o.doc.profile, O = {
458
+ name: l,
459
+ registrationNumber: i,
460
+ line1: s == null ? void 0 : s.line1,
461
+ line2: s == null ? void 0 : s.line2,
462
+ postcode: s == null ? void 0 : s.postcode,
463
+ city: s == null ? void 0 : s.city,
464
+ state: s == null ? void 0 : s.state,
465
+ country: s == null ? void 0 : s.country
466
+ }, $ = {
467
+ name: r.supplier.name,
468
+ phoneNumber: r.supplier.phoneNumber,
469
+ registrationNumber: r.supplier.registrationNumber,
470
+ line1: r.supplier.address.line1,
471
+ line2: r.supplier.address.line2,
472
+ postcode: r.supplier.address.postcode,
473
+ city: r.supplier.address.city,
474
+ state: r.supplier.address.state,
475
+ country: r.supplier.address.country
476
+ }, h = r.items.map((k) => {
477
+ const { sku: z, measurement: T } = k, K = ye(
478
+ Ht(k.sku, r.deliveryOrder || []),
479
+ !1
480
+ );
481
+ return {
482
+ code: z.code,
483
+ description: z.name,
484
+ quantity: ye(k.quantity, !1),
485
+ unit: (T == null ? void 0 : T.abbrev) || z.unit.abbrev,
486
+ received: K,
487
+ cost: k.totalCost ? `${k.totalCost.currency} ${Dt.toFormatString({
488
+ value: k.totalCost
489
+ })}` : void 0
490
+ };
491
+ }), q = r.deliveryOrder.map((k) => ({
492
+ createdAt: vt(new Date(k.createdAt)),
493
+ ref: k.deliveryOrderNumber,
494
+ remark: k.remark || "",
495
+ items: k.received.map((z) => {
496
+ var T;
497
+ return {
498
+ code: z.sku.code,
499
+ description: z.sku.name,
500
+ quantity: ye(z.amount),
501
+ unit: ((T = z.measurement) == null ? void 0 : T.abbrev) || z.sku.unit.abbrev
502
+ };
503
+ })
504
+ })), u = [
505
+ // Production
506
+ "67ca5d2c80bd0e001c5bf5bc",
507
+ // Dev
508
+ "6880b36a3054c5001db19218"
509
+ ];
510
+ let C = "Inventory Receive Note";
511
+ if (r.supplier.internal ? (C = "Inventory Transfer Note", u.includes((p == null ? void 0 : p._id) || "") && (C = "Stock Request")) : C = "Purchase Order", n) {
512
+ const k = n.from.dbName;
513
+ o.dbName === k || (C = "Inventory Receive Note");
514
+ }
515
+ const c = {
516
+ title: C,
517
+ businessName: p == null ? void 0 : p.name,
518
+ logo: p == null ? void 0 : p.thumbnail,
519
+ orderNumber: r.seqNumber.toString(),
520
+ createdAt: je(r._id),
521
+ ref: r.ref || "",
522
+ remark: r.remark || "",
523
+ buyer: O,
524
+ supplier: $,
525
+ items: h,
526
+ status: r.status,
527
+ deliveryOrders: q
528
+ }, y = new URL(window.location.href), R = a && (r.deliveryFullfillment || []).length > 0 ? "receive-request/delivery-print-preview" : "receive-request/print-preview";
529
+ y.pathname = y.hostname.includes("portal.feedme") ? `/inventory/${R}` : `/${R}`, y.searchParams.append("data", JSON.stringify(c)), window.open(y.href, "_blank", "noreferrer");
530
+ }
531
+ const Ce = {
532
+ submitRequest: {
533
+ translationKey: "inventory.transfer.receiveRequest.actions.submitRequest",
534
+ color: "text-fm-color-typo-primary",
535
+ value: F.enum.submitRequest
536
+ },
537
+ confirmDraft: {
538
+ translationKey: "inventory.transfer.receiveRequest.actions.confirmDraft",
539
+ color: "text-fm-color-typo-primary",
540
+ value: F.enum.confirmDraft
541
+ },
542
+ cancelDraft: {
543
+ translationKey: "inventory.transfer.receiveRequest.actions.cancelDraft",
544
+ color: "text-fm-color-typo-error",
545
+ value: F.enum.cancelDraft
546
+ },
547
+ approveRequest: {
548
+ translationKey: "inventory.transfer.receiveRequest.actions.approveRequest",
549
+ color: "text-fm-color-typo-primary",
550
+ value: F.enum.approveRequest
551
+ },
552
+ rejectRequest: {
553
+ translationKey: "inventory.transfer.receiveRequest.actions.rejectRequest",
554
+ color: "text-fm-color-typo-error",
555
+ value: F.enum.rejectRequest
556
+ },
557
+ processRequest: {
558
+ translationKey: "inventory.transfer.receiveRequest.actions.processRequest",
559
+ color: "text-fm-color-typo-primary",
560
+ value: F.enum.processRequest
561
+ },
562
+ receiveStock: {
563
+ translationKey: "inventory.transfer.receiveRequest.actions.receiveStock",
564
+ color: "text-fm-color-typo-primary",
565
+ value: F.enum.receiveStock
566
+ },
567
+ completeReceive: {
568
+ translationKey: "inventory.transfer.receiveRequest.actions.completeReceive",
569
+ color: "text-fm-color-typo-primary",
570
+ value: F.enum.completeReceive
571
+ },
572
+ closeRequest: {
573
+ translationKey: "inventory.transfer.receiveRequest.actions.closeRequest",
574
+ color: "system-error-300",
575
+ value: F.enum.closeRequest
576
+ },
577
+ approveDraft: {
578
+ translationKey: "",
579
+ color: "",
580
+ value: void 0
581
+ },
582
+ rejectDraft: {
583
+ translationKey: "",
584
+ color: "",
585
+ value: void 0
586
+ },
587
+ returnStock: {
588
+ translationKey: "inventory.transfer.receiveRequest.actions.returnStock",
589
+ color: "text-fm-color-typo-primary",
590
+ value: F.enum.returnStock
591
+ }
592
+ };
593
+ function _n(g, r, o) {
594
+ const p = _e(), a = We(), n = Ue(), { t: l } = st();
595
+ function s(u) {
596
+ switch (u.status) {
597
+ case "DRAFT":
598
+ return [
599
+ ve[me.Update],
600
+ ve[me.Details],
601
+ u.supplier.internal === "restaurant" || u.supplier.internal === "warehouse" ? Ce[F.enum.submitRequest] : Ce[F.enum.confirmDraft],
602
+ Ce[F.enum.cancelDraft]
603
+ ];
604
+ case "RECEIVING":
605
+ return [
606
+ Ce[F.enum.completeReceive],
607
+ ve[me.Details],
608
+ ve[me.Print]
609
+ ];
610
+ case "REQUESTING":
611
+ return g === "receive/request" ? [ve[me.Details], ve[me.Print]] : [
612
+ Ce[F.enum.approveRequest],
613
+ Ce[F.enum.rejectRequest],
614
+ ve[me.Details]
615
+ // DefaultRowActions[RowActionEnum.Print]
616
+ ];
617
+ case "PROCESSING":
618
+ return [ve[me.Details], ve[me.Print]];
619
+ case "COMPLETE":
620
+ case "CANCEL":
621
+ default:
622
+ return [ve[me.Details], ve[me.Print]];
623
+ }
624
+ }
625
+ function i(u) {
626
+ return Object.values(F.enum).includes(u);
627
+ }
628
+ async function O(u, C, d) {
629
+ var y, R, k, z, T, K;
630
+ const c = pt(C);
631
+ if (u === me.Print) {
632
+ const J = (d == null ? void 0 : d.toInventoryLocation) ?? p.currentLocation;
633
+ ((y = d == null ? void 0 : d.netSuite) != null && y.refNo || (R = c.netSuite) != null && R.refNo) && (c.ref = [((k = d == null ? void 0 : d.netSuite) == null ? void 0 : k.refNo) || ((z = c.netSuite) == null ? void 0 : z.refNo)].filter((oe) => oe).join(" ")), Gt({
634
+ po: c,
635
+ currentLocation: J,
636
+ business: n.currentBusiness.value,
637
+ fulfilling: g === "approval",
638
+ por: d
639
+ });
640
+ return;
641
+ }
642
+ if (u === me.Details) {
643
+ r.promptShowTransferDetails(c, d);
644
+ return;
645
+ }
646
+ if (u === me.Update) {
647
+ (T = r.promptUpdateTransferDialog) == null || T.call(r, c);
648
+ return;
649
+ }
650
+ if (i(u)) {
651
+ r.submitAction(C, u, (K = d == null ? void 0 : d.to) == null ? void 0 : K.dbName);
652
+ return;
653
+ }
654
+ }
655
+ function $() {
656
+ var C;
657
+ const u = [
658
+ {
659
+ accessorKey: "seqNumber",
660
+ header: () => l("inventory.transfer.table.seqNo"),
661
+ enableSorting: !0,
662
+ size: 80,
663
+ sortUndefined: "last"
664
+ },
665
+ {
666
+ accessorKey: "_id",
667
+ header: () => l("inventory.transfer.table.createdAt"),
668
+ cell(d) {
669
+ return je(`${d.getValue()}`);
670
+ },
671
+ enableSorting: !0
672
+ },
673
+ {
674
+ accessorKey: "supplier.name",
675
+ header: () => l("inventory.transfer.table.transferFrom"),
676
+ enableSorting: !0,
677
+ size: 200
678
+ },
679
+ {
680
+ accessorKey: "items.length",
681
+ header: () => l("inventory.transfer.table.noOfItems"),
682
+ cell: (d) => {
683
+ const c = d.row.original.version || "1", y = d.getValue();
684
+ return P("div", { class: "flex items-center gap-2" }, [
685
+ y,
686
+ c !== "1" ? P(
687
+ "div",
688
+ { class: "py-3" },
689
+ P(
690
+ Te,
691
+ P(
692
+ "div",
693
+ {
694
+ class: ["fm-status-badge", "fm-status-badge-draft"].join(" ")
695
+ },
696
+ `v${c}`
697
+ )
698
+ )
699
+ ) : null
700
+ ]);
701
+ },
702
+ enableSorting: !1,
703
+ meta: {
704
+ width: "10rem"
705
+ }
706
+ },
707
+ {
708
+ accessorKey: "ref",
709
+ header: () => l("inventory.transfer.table.reference"),
710
+ enableSorting: !1,
711
+ size: "auto"
712
+ },
713
+ ...(C = n.sessionUser.value) != null && C.role.isAdmin ? [
714
+ {
715
+ id: "statusForAdmin",
716
+ header: () => P(Te, {}, () => `${l("inventory.transfer.table.status")}`),
717
+ cell(d) {
718
+ return d.row.original.status;
719
+ },
720
+ enableSorting: !0,
721
+ size: 200
722
+ }
723
+ ] : [],
724
+ {
725
+ accessorKey: "status",
726
+ header: () => l("inventory.transfer.table.status"),
727
+ cell(d) {
728
+ const c = d.getValue(), y = He(d.row.original), { partial: R, over: k } = Je(y), z = et(c ?? "", R, k);
729
+ let T = l(`inventory.transfer.status.${z}`), K = `${c ?? ""}`.toLocaleLowerCase("en-us");
730
+ z === Z.enum.CLOSE && (T = `${l(`inventory.transfer.status.${Z.enum.COMPLETE}`)}`), z === "PARTIAL_RECEIVED" && K === Z.enum.PROCESSING.toLocaleLowerCase("en-us") && (K = Z.enum.RECEIVING.toLocaleLowerCase("en-us"));
731
+ let J = null;
732
+ const oe = o.value.find((ce) => ce.ref === d.row.original._id);
733
+ if (oe != null && oe.milestones && oe.milestones.length > 0) {
734
+ const ce = oe.milestones[oe.milestones.length - 1];
735
+ if (ce.estimatedTime) {
736
+ const Oe = new Date(ce.estimatedTime), ge = Oe.getDate().toString().padStart(2, "0");
737
+ J = `${Oe.toLocaleString("en-US", { month: "short" })} ${ge}`;
738
+ }
739
+ }
740
+ return P(
741
+ "div",
742
+ {
743
+ class: "flex"
744
+ },
745
+ [
746
+ P(
747
+ "div",
748
+ { class: "flex items-center" },
749
+ P(
750
+ "div",
751
+ {
752
+ class: [
753
+ "fm-status-badge",
754
+ `fm-status-badge-${K}`,
755
+ k && "fm-status-badge-error"
756
+ ].filter(Boolean).join(" ")
757
+ },
758
+ `${T}`
759
+ )
760
+ ),
761
+ ...J ? [
762
+ P(
763
+ "div",
764
+ {
765
+ class: "flex items-center gap-1 ml-2"
766
+ },
767
+ [
768
+ P(Ke.FmIcon, {
769
+ name: "local_shipping",
770
+ size: "md",
771
+ color: "neutral-gray-400"
772
+ }),
773
+ P(
774
+ "span",
775
+ { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" },
776
+ J
777
+ )
778
+ ]
779
+ )
780
+ ] : []
781
+ ]
782
+ );
783
+ },
784
+ enableSorting: !0,
785
+ size: 150
786
+ },
787
+ {
788
+ id: "action",
789
+ cell(d) {
790
+ const c = d.row.original, y = s(c);
791
+ return ct(y, (R) => O(R, c));
792
+ },
793
+ enableSorting: !1,
794
+ size: 40,
795
+ meta: {
796
+ cellClass: "",
797
+ headerClass: ""
798
+ }
799
+ }
800
+ ];
801
+ if (a.isEnabled) {
802
+ const d = [
803
+ {
804
+ id: "netsuiteTransferOrder",
805
+ accessorFn: (c) => {
806
+ var y;
807
+ return (y = c.netSuite) != null && y.id ? `${c.netSuite.refNo} (${c.netSuite.id})` : "N/A";
808
+ },
809
+ header: () => "NetSuite Order (ID)",
810
+ cell(c) {
811
+ var R;
812
+ const y = c.row.original;
813
+ return (R = y.netSuite) != null && R.id ? `${y.netSuite.refNo} (${y.netSuite.id})` : "N/A";
814
+ },
815
+ enableSorting: !1,
816
+ size: 200,
817
+ meta: {
818
+ cellClass: "",
819
+ headerClass: ""
820
+ }
821
+ },
822
+ {
823
+ id: "netsuiteTransactionNumber",
824
+ accessorFn: (c) => {
825
+ var y, R;
826
+ return ((R = (y = c.netSuite) == null ? void 0 : y.additionalInfo) == null ? void 0 : R.transactionnumber) ?? "N/A";
827
+ },
828
+ header: () => "NetSuite Transaction No.",
829
+ cell(c) {
830
+ var R, k;
831
+ return ((k = (R = c.row.original.netSuite) == null ? void 0 : R.additionalInfo) == null ? void 0 : k.transactionnumber) ?? "N/A";
832
+ },
833
+ enableSorting: !1,
834
+ size: 200,
835
+ meta: {
836
+ cellClass: "",
837
+ headerClass: ""
838
+ }
839
+ }
840
+ ];
841
+ u.splice(u.length - 1, 0, ...d);
842
+ }
843
+ return u;
844
+ }
845
+ function h() {
846
+ var C;
847
+ const u = [
848
+ {
849
+ accessorKey: "purchaseOrder.seqNumber",
850
+ header: () => l("inventory.transfer.table.seqNo"),
851
+ enableSorting: !0,
852
+ size: 80,
853
+ sortUndefined: "last"
854
+ },
855
+ {
856
+ accessorKey: "purchaseOrder._id",
857
+ header: () => l("inventory.transfer.table.createdAt"),
858
+ cell(d) {
859
+ return je(`${d.getValue()}`);
860
+ },
861
+ enableSorting: !0
862
+ },
863
+ {
864
+ accessorKey: "to.name",
865
+ header: () => l("inventory.transfer.table.transferTo"),
866
+ enableSorting: !1,
867
+ size: 200
868
+ },
869
+ {
870
+ accessorKey: "purchaseOrder.items.length",
871
+ header: () => l("inventory.transfer.table.noOfItems"),
872
+ enableSorting: !1
873
+ },
874
+ {
875
+ accessorKey: "purchaseOrder.ref",
876
+ header: () => l("inventory.transfer.table.reference"),
877
+ enableSorting: !1,
878
+ size: "auto"
879
+ },
880
+ ...(C = n.sessionUser.value) != null && C.role.isAdmin ? [
881
+ {
882
+ id: "statusForAdmin",
883
+ header: () => P(Te, {}, () => `${l("inventory.transfer.table.status")}`),
884
+ cell(d) {
885
+ return d.row.original.status;
886
+ },
887
+ enableSorting: !0,
888
+ size: 200
889
+ }
890
+ ] : [],
891
+ {
892
+ accessorKey: "purchaseOrder.status",
893
+ header: () => l("inventory.transfer.table.status"),
894
+ cell(d) {
895
+ const c = d.row.original, y = d.getValue();
896
+ if (!c.purchaseOrder)
897
+ return P(Ke.FmChip, {
898
+ label: "N/A",
899
+ compact: !0
900
+ });
901
+ const R = He(c.purchaseOrder), { partial: k, over: z } = Je(R), T = et(y ?? "", k, z);
902
+ let K = l(`inventory.transfer.status.${T}`), J = `${y ?? ""}`.toLocaleLowerCase("en-us");
903
+ return T === Z.enum.CLOSE && (K = `${l(`inventory.transfer.status.${Z.enum.COMPLETE}`)}`), T === "PARTIAL_RECEIVED" && J === Z.enum.PROCESSING.toLocaleLowerCase("en-us") && (J = Z.enum.RECEIVING.toLocaleLowerCase("en-us")), P(
904
+ "div",
905
+ {
906
+ class: "flex"
907
+ },
908
+ P(
909
+ "div",
910
+ {
911
+ class: [
912
+ "fm-status-badge",
913
+ `fm-status-badge-${J}`,
914
+ z && "fm-status-badge-error"
915
+ ].filter(Boolean).join(" ")
916
+ },
917
+ `${K}`
918
+ )
919
+ );
920
+ },
921
+ enableSorting: !0
922
+ },
923
+ {
924
+ id: "action",
925
+ cell(d) {
926
+ const c = d.row.original, R = (c.purchaseOrder ? s(c.purchaseOrder) : []).map((k) => k.value === me.Print ? {
927
+ ...k,
928
+ translationKey: "inventory.transfer.receiveRequest.details.printDeliveryOrder"
929
+ } : k);
930
+ return ct(
931
+ R,
932
+ (k) => c.purchaseOrder ? O(k, c.purchaseOrder, c) : void 0
933
+ );
934
+ },
935
+ enableSorting: !1,
936
+ size: 40,
937
+ meta: {
938
+ cellClass: "",
939
+ headerClass: ""
940
+ }
941
+ }
942
+ ];
943
+ if (a.isEnabled) {
944
+ const d = [
945
+ {
946
+ id: "netsuiteTransferOrder",
947
+ accessorFn: (c) => {
948
+ var y;
949
+ return (y = c.netSuite) != null && y.id ? `${c.netSuite.refNo} (${c.netSuite.id})` : "N/A";
950
+ },
951
+ header: () => "NetSuite Order (ID)",
952
+ cell(c) {
953
+ var R;
954
+ const y = c.row.original;
955
+ return (R = y.netSuite) != null && R.id ? `${y.netSuite.refNo} (${y.netSuite.id})` : "N/A";
956
+ },
957
+ enableSorting: !1,
958
+ size: 200,
959
+ meta: {
960
+ cellClass: "",
961
+ headerClass: ""
962
+ }
963
+ },
964
+ {
965
+ id: "netsuiteTransactionNumber",
966
+ accessorFn: (c) => {
967
+ var y, R;
968
+ return ((R = (y = c.netSuite) == null ? void 0 : y.additionalInfo) == null ? void 0 : R.transactionnumber) ?? "N/A";
969
+ },
970
+ header: () => "NetSuite Transaction No.",
971
+ cell(c) {
972
+ var R, k;
973
+ return ((k = (R = c.row.original.netSuite) == null ? void 0 : R.additionalInfo) == null ? void 0 : k.transactionnumber) ?? "N/A";
974
+ },
975
+ enableSorting: !1,
976
+ size: 200,
977
+ meta: {
978
+ cellClass: "",
979
+ headerClass: ""
980
+ }
981
+ }
982
+ ];
983
+ u.splice(u.length - 2, 0, ...d);
984
+ }
985
+ return u;
986
+ }
987
+ return {
988
+ columnDefs: H(() => g === "receive/request" ? $() : h())
989
+ };
990
+ }
991
+ const Wt = { class: "border border-fm-color-neutral-gray-200 fm-corner-radius-lg p-16" }, Yt = { class: "flex flex-col gap-8" }, Qt = { class: "flex w-full justify-end gap-16" }, Xt = /* @__PURE__ */ Se({
992
+ __name: "FulfillmentForm",
993
+ props: {
994
+ purchaseOrder: {},
995
+ confirm: { type: Function }
996
+ },
997
+ emits: ["update:show"],
998
+ setup(g, { emit: r }) {
999
+ const o = g, p = Nt({
1000
+ id: "",
1001
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
1002
+ items: []
1003
+ }), a = Y(), n = r;
1004
+ _t(() => {
1005
+ o.purchaseOrder && (p.items = o.purchaseOrder.items.map((s) => ({
1006
+ id: s.id,
1007
+ sku: s.sku,
1008
+ measurement: s.measurement,
1009
+ amount: s.quantity ?? { amount: 1, precision: 0 }
1010
+ })));
1011
+ });
1012
+ const l = H(() => p.items.length <= 10);
1013
+ return (s, i) => {
1014
+ const O = G("FmTable"), $ = G("FmButton"), h = G("FmForm");
1015
+ return f(), le(h, {
1016
+ ref_key: "formRef",
1017
+ ref: a,
1018
+ class: "bg-white flex flex-col gap-32 rounded-3xl p-24 w-[800px]",
1019
+ onValidationFailed: console.log,
1020
+ onValidationSuccess: i[1] || (i[1] = () => o.confirm(p))
1021
+ }, {
1022
+ default: X(() => [
1023
+ i[2] || (i[2] = e("div", { class: "fm-typo-en-title-sm-600" }, "Confirm the transfer amount", -1)),
1024
+ e("div", Wt, [
1025
+ e("div", Yt, [
1026
+ I(O, {
1027
+ "column-defs": [
1028
+ {
1029
+ header: "Code",
1030
+ cell: (q) => {
1031
+ const u = o.purchaseOrder.items.find((C) => C.id === q.row.original.id || C.sku._id === q.row.original.sku._id);
1032
+ return P(
1033
+ v(Ke).FmTooltip,
1034
+ {
1035
+ content: u.code,
1036
+ placement: "top",
1037
+ variant: "plain",
1038
+ zIndex: 50
1039
+ },
1040
+ P(
1041
+ "span",
1042
+ {
1043
+ class: "flex-auto line-clamp-2 text-ellipsis break-all"
1044
+ },
1045
+ u.code
1046
+ )
1047
+ );
1048
+ }
1049
+ },
1050
+ {
1051
+ header: "Name",
1052
+ cell: (q) => {
1053
+ const u = o.purchaseOrder.items.find((C) => C.id === q.row.original.id || C.sku._id === q.row.original.sku._id);
1054
+ return P(
1055
+ v(Ke).FmTooltip,
1056
+ {
1057
+ content: u.name,
1058
+ placement: "top",
1059
+ variant: "plain",
1060
+ zIndex: 50
1061
+ },
1062
+ P(
1063
+ "span",
1064
+ {
1065
+ class: "flex-auto line-clamp-2 text-ellipsis break-all"
1066
+ },
1067
+ u.name
1068
+ )
1069
+ );
1070
+ }
1071
+ },
1072
+ {
1073
+ header: "Amount",
1074
+ cell: (q) => {
1075
+ const u = q.row.original, C = o.purchaseOrder.items.find((c) => c.id === u.id || c.sku._id === u.sku._id), d = u.amount ?? {
1076
+ amount: 1,
1077
+ precision: 0
1078
+ };
1079
+ return P(Vt, {
1080
+ style: {
1081
+ flex: "1 1 0%"
1082
+ },
1083
+ modelValue: {
1084
+ amount: d,
1085
+ measurement: u.measurement ?? null
1086
+ },
1087
+ key: u.id ?? u.sku._id,
1088
+ unit: u.sku.unit,
1089
+ "onUpdate:modelValue": (c) => {
1090
+ if (!c) return;
1091
+ const y = p.items.find((R) => R.id === u.id || R.sku._id === u.sku._id);
1092
+ y && (y.amount = c.amount);
1093
+ },
1094
+ disableUnit: !0,
1095
+ rules: [
1096
+ v(Bt)(
1097
+ +v(ye)({ amount: 0, precision: 0 })
1098
+ ),
1099
+ v(Ut)(+v(ye)(C.quantity))
1100
+ ],
1101
+ applyDefaultRules: !0
1102
+ });
1103
+ }
1104
+ }
1105
+ ],
1106
+ "row-data": p.items,
1107
+ "hide-footer": l.value
1108
+ }, null, 8, ["column-defs", "row-data", "hide-footer"])
1109
+ ])
1110
+ ]),
1111
+ e("div", Qt, [
1112
+ I($, {
1113
+ class: "px-16",
1114
+ label: "Confirm",
1115
+ size: "md",
1116
+ variant: "primary",
1117
+ type: "submit"
1118
+ }),
1119
+ I($, {
1120
+ class: "px-16",
1121
+ label: "Cancel",
1122
+ size: "md",
1123
+ variant: "secondary",
1124
+ onClick: i[0] || (i[0] = () => n("update:show", !1))
1125
+ })
1126
+ ])
1127
+ ]),
1128
+ _: 1
1129
+ }, 8, ["onValidationFailed"]);
1130
+ };
1131
+ }
1132
+ }), Ze = {
1133
+ submitRequest: {
1134
+ translationKey: "inventory.transfer.receiveRequest.actions.submitRequest",
1135
+ color: "primary",
1136
+ buttonVariant: fe.Primary
1137
+ },
1138
+ confirmDraft: {
1139
+ translationKey: "inventory.transfer.receiveRequest.actions.confirmDraft",
1140
+ color: "primary",
1141
+ buttonVariant: fe.Primary
1142
+ },
1143
+ cancelDraft: {
1144
+ translationKey: "inventory.transfer.receiveRequest.actions.cancelDraft",
1145
+ color: "system-error-300",
1146
+ buttonVariant: fe.Destructive
1147
+ },
1148
+ approveDraft: {
1149
+ translationKey: "inventory.transfer.receiveRequest.actions.approveDraft",
1150
+ color: "primary",
1151
+ buttonVariant: fe.Primary
1152
+ },
1153
+ rejectDraft: {
1154
+ translationKey: "inventory.transfer.receiveRequest.actions.rejectDraft",
1155
+ color: "system-error-300",
1156
+ buttonVariant: fe.Destructive
1157
+ },
1158
+ approveRequest: {
1159
+ translationKey: "inventory.transfer.receiveRequest.actions.approveRequest",
1160
+ color: "primary",
1161
+ buttonVariant: fe.Primary
1162
+ },
1163
+ processRequest: {
1164
+ translationKey: "inventory.transfer.receiveRequest.actions.processRequest",
1165
+ color: "primary",
1166
+ buttonVariant: fe.Primary
1167
+ },
1168
+ receiveStock: {
1169
+ translationKey: "inventory.transfer.receiveRequest.actions.receiveStock",
1170
+ color: "primary",
1171
+ buttonVariant: fe.Primary,
1172
+ available: !1
1173
+ },
1174
+ completeReceive: {
1175
+ translationKey: "inventory.transfer.receiveRequest.actions.completeReceive",
1176
+ color: "primary",
1177
+ buttonVariant: fe.Plain
1178
+ },
1179
+ rejectRequest: {
1180
+ translationKey: "inventory.transfer.receiveRequest.actions.rejectRequest",
1181
+ color: "system-error-300",
1182
+ buttonVariant: fe.Destructive
1183
+ },
1184
+ closeRequest: {
1185
+ translationKey: "inventory.transfer.receiveRequest.actions.closeRequest",
1186
+ color: "system-error-300",
1187
+ buttonVariant: fe.Destructive,
1188
+ available: !1
1189
+ },
1190
+ returnStock: {
1191
+ translationKey: "inventory.transfer.receiveRequest.actions.returnStock",
1192
+ color: "primary",
1193
+ buttonVariant: fe.Primary,
1194
+ available: !1
1195
+ }
1196
+ };
1197
+ function Zt() {
1198
+ const g = qe();
1199
+ return {
1200
+ ableToMarkReceived(r) {
1201
+ if (!r || r.status !== Z.enum.RECEIVING)
1202
+ return !1;
1203
+ const p = _e().currentLocationDBName;
1204
+ return `${r.supplier.internal}_${r.supplier._id}` !== p;
1205
+ },
1206
+ ableToMarkApproved(r) {
1207
+ return !(!r || (r == null ? void 0 : r.status) !== Z.enum.REQUESTING);
1208
+ },
1209
+ ableToCreateFulfillment(r, o) {
1210
+ var n, l;
1211
+ if (!g.acceptRequireFulfillment || !r || !o || r.status !== Z.enum.PROCESSING || !o.processedAt)
1212
+ return !1;
1213
+ const p = (n = o == null ? void 0 : o.from) == null ? void 0 : n.dbName, a = (l = o == null ? void 0 : o.to) == null ? void 0 : l.dbName;
1214
+ return !(p.startsWith("restaurant_") && a.startsWith("restaurant_"));
1215
+ }
1216
+ };
1217
+ }
1218
+ const Jt = { class: "flex flex-row-reverse" }, er = /* @__PURE__ */ Se({
1219
+ __name: "NetSuiteSync",
1220
+ props: {
1221
+ poRequest: {},
1222
+ purchaseOrder: {},
1223
+ isTransferBetweenOutlets: { type: Boolean },
1224
+ scope: {}
1225
+ },
1226
+ setup(g) {
1227
+ const r = g, o = We(), p = Fe(), a = Ye(), n = Y(!1);
1228
+ H(() => {
1229
+ var $, h, q, u;
1230
+ let s = !0;
1231
+ o.isEnabled || (s = !1);
1232
+ const i = r.purchaseOrder, O = r.poRequest;
1233
+ return i && (($ = i == null ? void 0 : i.supplier) != null && $.internal ? (!O && i.status == Z.enum.DRAFT && (s = !1), O && !((h = O == null ? void 0 : O.netSuite) != null && h.id) && (s = !1), r.isTransferBetweenOutlets && (s = !1)) : ((i == null ? void 0 : i.status) !== Z.enum.REQUESTING && i.supplier.internal && (s = !1), !O && !((q = i == null ? void 0 : i.netSuite) != null && q.id) && (s = !1), !O && ((u = i == null ? void 0 : i.netSuite) != null && u.id) && (i == null ? void 0 : i.status) == Z.enum.REQUESTING && (s = !1))), s;
1234
+ });
1235
+ async function l() {
1236
+ n.value || a.open({
1237
+ title: "Sync with NetSuite",
1238
+ contentComponent: P("div", [
1239
+ P("p", "Are you sure you want to sync now?"),
1240
+ P("br"),
1241
+ P(
1242
+ "p",
1243
+ { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" },
1244
+ "Please wait a moment before syncing manually to avoid unnecessary actions."
1245
+ )
1246
+ ]),
1247
+ primaryActions: {
1248
+ text: "Sync",
1249
+ close: !0,
1250
+ variant: "destructive"
1251
+ },
1252
+ secondaryActions: { text: "Not now", close: !0 }
1253
+ }).onPrimary(async () => {
1254
+ var s, i, O;
1255
+ try {
1256
+ n.value = !0;
1257
+ const $ = ((s = r.purchaseOrder) == null ? void 0 : s._id) || ((i = r.poRequest) == null ? void 0 : i.purchaseOrderId) || "", h = (O = r.poRequest) == null ? void 0 : O.to.dbName;
1258
+ await o.syncPurchaseOrder(
1259
+ $,
1260
+ r.scope === "approval" ? h : void 0
1261
+ ), p.open({
1262
+ title: "Sync with NetSuite",
1263
+ message: "Requested to sync with NetSuite. Please wait a moment.",
1264
+ type: "success"
1265
+ }), await new Promise((q) => setTimeout(q, 5e3)), n.value = !1;
1266
+ } catch {
1267
+ p.open({
1268
+ title: "Error",
1269
+ message: "Failed to sync with NetSuite",
1270
+ type: "error"
1271
+ }), n.value = !1;
1272
+ }
1273
+ });
1274
+ }
1275
+ return (s, i) => {
1276
+ const O = G("FmButton");
1277
+ return f(), x("div", Jt, [
1278
+ I(O, {
1279
+ "prepend-icon": "sync",
1280
+ variant: "secondary",
1281
+ label: "Sync",
1282
+ loading: n.value,
1283
+ onClick: l,
1284
+ "text-color": "primary",
1285
+ "bg-color": "transparent",
1286
+ "border-color": "primary"
1287
+ }, null, 8, ["loading"])
1288
+ ]);
1289
+ };
1290
+ }
1291
+ }), tr = {
1292
+ key: 0,
1293
+ class: "flex flex-col gap-8"
1294
+ }, rr = { class: "flex flex-col gap-4" }, sr = { class: "fm-typo-en-body-lg-600" }, or = {
1295
+ key: 0,
1296
+ class: "flex flex-col gap-4"
1297
+ }, nr = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ar = { class: "fm-typo-en-body-lg-600" }, lr = { key: 0 }, ir = { key: 1 }, cr = {
1298
+ key: 1,
1299
+ class: "flex flex-col gap-4"
1300
+ }, ur = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, dr = { class: "fm-typo-en-body-lg-600" }, mr = { key: 0 }, pr = { key: 1 }, fr = {
1301
+ key: 2,
1302
+ class: "flex flex-col gap-4"
1303
+ }, yr = { class: "fm-typo-en-body-lg-600" }, vr = {
1304
+ key: 3,
1305
+ class: "flex flex-col gap-4"
1306
+ }, hr = { class: "fm-typo-en-body-lg-600" }, br = /* @__PURE__ */ Se({
1307
+ __name: "NetSuiteInfo",
1308
+ props: {
1309
+ transferType: {},
1310
+ transferToDbName: {},
1311
+ poRequest: {},
1312
+ purchaseOrder: {},
1313
+ isTransferBetweenOutlets: { type: Boolean },
1314
+ scope: {}
1315
+ },
1316
+ setup(g) {
1317
+ const r = g, o = We(), p = Pe(), a = Y(r.poRequest);
1318
+ _t(async () => {
1319
+ var i;
1320
+ if (!r.poRequest && ((i = r.purchaseOrder) != null && i._id)) {
1321
+ const O = await p.getLatestPurchaseOrderRequest(r.purchaseOrder._id);
1322
+ a.value = O;
1323
+ }
1324
+ });
1325
+ const n = H(
1326
+ () => {
1327
+ var i, O, $, h, q, u;
1328
+ return o.getSubsidiaryFullName(
1329
+ (($ = (O = (i = r.purchaseOrder) == null ? void 0 : i.netSuite) == null ? void 0 : O.subsidiary) == null ? void 0 : $.id) || ((u = (q = (h = r.poRequest) == null ? void 0 : h.netSuite) == null ? void 0 : q.subsidiary) == null ? void 0 : u.id)
1330
+ ).fullName;
1331
+ }
1332
+ ), l = H(() => {
1333
+ var i, O, $, h, q, u, C, d, c, y, R, k;
1334
+ return ($ = (O = (i = r.purchaseOrder) == null ? void 0 : i.netSuite) == null ? void 0 : O.additionalInfo) != null && $.transactionnumber ? (u = (q = (h = r.purchaseOrder) == null ? void 0 : h.netSuite) == null ? void 0 : q.additionalInfo) == null ? void 0 : u.transactionnumber : (c = (d = (C = a.value) == null ? void 0 : C.netSuite) == null ? void 0 : d.additionalInfo) != null && c.transactionnumber ? (k = (R = (y = a.value) == null ? void 0 : y.netSuite) == null ? void 0 : R.additionalInfo) == null ? void 0 : k.transactionnumber : null;
1335
+ }), s = H(() => {
1336
+ var i, O, $, h, q, u;
1337
+ return (O = (i = r.purchaseOrder) == null ? void 0 : i.deliveryFullfillment) != null && O.length && ((h = ($ = r.purchaseOrder) == null ? void 0 : $.deliveryFullfillment) == null ? void 0 : h.length) > 0 ? (u = (q = r.purchaseOrder) == null ? void 0 : q.deliveryFullfillment) == null ? void 0 : u.map((C) => {
1338
+ var d;
1339
+ return (d = C.netSuite) == null ? void 0 : d.refNo;
1340
+ }).join(", ") : "N/A";
1341
+ });
1342
+ return (i, O) => {
1343
+ var $, h, q, u, C, d, c, y, R, k, z, T, K, J, oe, ce;
1344
+ return v(o).isEnabled ? (f(), x("div", tr, [
1345
+ e("div", rr, [
1346
+ O[0] || (O[0] = e("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, "NetSuite subsidiary", -1)),
1347
+ e("div", sr, _(n.value || "N/A"), 1)
1348
+ ]),
1349
+ !i.isTransferBetweenOutlets && i.scope === v(tt).RECEIVE_REQUEST ? (f(), x("div", or, [
1350
+ e("div", nr, " NetSuite " + _((h = ($ = i.purchaseOrder) == null ? void 0 : $.netSuite) != null && h.recordType ? v(ht)((u = (q = i.purchaseOrder) == null ? void 0 : q.netSuite) == null ? void 0 : u.recordType) : i.transferType === v(Ne).PURCHASE ? "Purchase Order" : "Transfer Order") + " (ID) ", 1),
1351
+ e("div", ar, [
1352
+ (d = (C = i.purchaseOrder) == null ? void 0 : C.netSuite) != null && d.id ? (f(), x("span", lr, _((y = (c = i.purchaseOrder) == null ? void 0 : c.netSuite) == null ? void 0 : y.refNo) + " (" + _((k = (R = i.purchaseOrder) == null ? void 0 : R.netSuite) == null ? void 0 : k.id) + ") ", 1)) : (f(), x("span", ir, "N/A"))
1353
+ ])
1354
+ ])) : M("", !0),
1355
+ !i.isTransferBetweenOutlets && a.value || i.scope === v(tt).APPROVAL ? (f(), x("div", cr, [
1356
+ e("div", ur, " (Request) NetSuite " + _(i.transferType === v(Ne).PURCHASE ? "Purchase Order" : "Transfer Order") + " (ID) ", 1),
1357
+ e("div", dr, [
1358
+ (T = (z = a.value) == null ? void 0 : z.netSuite) != null && T.id ? (f(), x("span", mr, _((J = (K = a.value) == null ? void 0 : K.netSuite) == null ? void 0 : J.refNo) + " (" + _((ce = (oe = a.value) == null ? void 0 : oe.netSuite) == null ? void 0 : ce.id) + ") ", 1)) : (f(), x("span", pr, "N/A"))
1359
+ ])
1360
+ ])) : M("", !0),
1361
+ l.value ? (f(), x("div", fr, [
1362
+ O[1] || (O[1] = e("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " NetSuite Transaction Number ", -1)),
1363
+ e("div", yr, _(l.value), 1)
1364
+ ])) : M("", !0),
1365
+ v(o).isEnabled && i.transferType === v(Ne).TRANSFER && !i.isTransferBetweenOutlets ? (f(), x("div", vr, [
1366
+ O[2] || (O[2] = e("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " NetSuite fulfillment IDs ", -1)),
1367
+ e("div", hr, _(s.value), 1)
1368
+ ])) : M("", !0)
1369
+ ])) : M("", !0);
1370
+ };
1371
+ }
1372
+ }), gr = { class: "flex flex-row-reverse" }, _r = /* @__PURE__ */ Se({
1373
+ __name: "NetSuiteLog",
1374
+ props: {
1375
+ netsuiteId: {},
1376
+ purchaseOrderId: {}
1377
+ },
1378
+ setup(g) {
1379
+ const r = Fe(), o = bt();
1380
+ async function p(a, n) {
1381
+ const l = [];
1382
+ if (a && l.push(`body.message:*${a}*`), n) {
1383
+ const $ = n.replace(/:/g, "\\:");
1384
+ l.push(`${$}`);
1385
+ }
1386
+ if (l.length === 0) {
1387
+ r.open({
1388
+ message: "Cannot open logs without valid filters.",
1389
+ type: "error"
1390
+ });
1391
+ return;
1392
+ }
1393
+ const i = `attributes.pod:netsuite* AND (${l.join(" OR ")})`, { url: O } = await o.getSyncLogs(i);
1394
+ r.open(
1395
+ {
1396
+ message: "Opening NetSuite logs...",
1397
+ type: "info"
1398
+ },
1399
+ 800
1400
+ ), await new Promise(($) => setTimeout($, 800)), window.open(O, "_blank");
1401
+ }
1402
+ return (a, n) => {
1403
+ const l = G("FmButton");
1404
+ return f(), x("div", gr, [
1405
+ I(l, {
1406
+ "prepend-icon": "history",
1407
+ variant: "secondary",
1408
+ label: "Logs",
1409
+ onClick: n[0] || (n[0] = (s) => p(a.netsuiteId, a.purchaseOrderId)),
1410
+ "text-color": "primary",
1411
+ "bg-color": "transparent",
1412
+ "border-color": "primary"
1413
+ })
1414
+ ]);
1415
+ };
1416
+ }
1417
+ }), Sr = { class: "flex flex-row-reverse" }, Or = { key: 0 }, xr = { key: 1 }, wr = { class: "mb-6" }, $r = { class: "fm-typo-en-body-md-400" }, Rr = { key: 0 }, kr = { key: 1 }, Dr = { key: 0 }, Nr = {
1418
+ key: 1,
1419
+ class: "border-t pt-6"
1420
+ }, Cr = { class: "fm-typo-en-body-lg-600 mb-4 flex items-center gap-2" }, Ar = { class: "border border-fm-color-neutral-gray-200 fm-corner-radius-lg overflow-y-auto" }, Tr = { class: "w-full" }, qr = {
1421
+ class: "p-3 fm-typo-en-body-sm-600",
1422
+ style: { "min-width": "130px" }
1423
+ }, Fr = { class: "p-3 fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Pr = { class: "p-3 fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Ir = { class: "p-3 fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Er = { class: "p-3 fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Lr = { class: "p-3 fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Vr = { class: "p-3 fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Br = { class: "p-3 fm-typo-en-body-sm-600" }, Ur = { key: 2 }, Mr = { key: 1 }, jr = /* @__PURE__ */ Se({
1424
+ __name: "NetSuiteLatestInfo",
1425
+ props: {
1426
+ netsuiteId: {},
1427
+ purchaseOrderId: {}
1428
+ },
1429
+ setup(g) {
1430
+ const r = g, o = bt(), p = Y(!1), a = _e(), n = Y(!0), l = Y(!1), s = Y(!1), i = Y(!1), O = Y(null), $ = Y([]);
1431
+ async function h() {
1432
+ if (!O.value) {
1433
+ p.value = !0;
1434
+ try {
1435
+ n.value = !0;
1436
+ const d = await o.getMoreInfo(
1437
+ a.currentLocation.dbName,
1438
+ r.purchaseOrderId
1439
+ );
1440
+ O.value = d, l.value = !1;
1441
+ } catch {
1442
+ l.value = !0;
1443
+ } finally {
1444
+ n.value = !1;
1445
+ }
1446
+ await q();
1447
+ }
1448
+ }
1449
+ async function q() {
1450
+ if (!($.value.length > 0))
1451
+ try {
1452
+ s.value = !0;
1453
+ const d = await o.getChangeLogs(r.netsuiteId);
1454
+ $.value = d, i.value = !1;
1455
+ } catch {
1456
+ i.value = !0;
1457
+ } finally {
1458
+ s.value = !1;
1459
+ }
1460
+ }
1461
+ function u(d) {
1462
+ switch (d) {
1463
+ case Ie.Create:
1464
+ return "text-green-600 bg-green-100";
1465
+ case Ie.Set:
1466
+ return "text-blue-600 bg-blue-100";
1467
+ case Ie.Change:
1468
+ return "text-yellow-600 bg-yellow-100";
1469
+ case Ie.Unset:
1470
+ return "text-red-600 bg-red-100";
1471
+ default:
1472
+ return "text-gray-600 bg-gray-100";
1473
+ }
1474
+ }
1475
+ function C(d) {
1476
+ return new Date(d).toLocaleDateString("en-US", {
1477
+ year: "numeric",
1478
+ month: "short",
1479
+ day: "numeric",
1480
+ hour: "2-digit",
1481
+ minute: "2-digit"
1482
+ });
1483
+ }
1484
+ return (d, c) => {
1485
+ const y = G("FmButton"), R = G("FmLabel"), k = G("FmIcon"), z = G("FmDialog");
1486
+ return f(), x("div", Sr, [
1487
+ I(z, {
1488
+ modelValue: p.value,
1489
+ "onUpdate:modelValue": c[2] || (c[2] = (T) => p.value = T),
1490
+ overlay: !0,
1491
+ "max-width": 800
1492
+ }, {
1493
+ "dialog-button": X(() => [
1494
+ I(y, {
1495
+ "prepend-icon": "info",
1496
+ variant: "secondary",
1497
+ label: "Latest Info",
1498
+ onClick: c[0] || (c[0] = (T) => h()),
1499
+ "text-color": "primary",
1500
+ "bg-color": "transparent",
1501
+ "border-color": "primary"
1502
+ })
1503
+ ]),
1504
+ "dialog-header": X(() => c[3] || (c[3] = [
1505
+ e("div", null, "NetSuite latest info", -1)
1506
+ ])),
1507
+ default: X(() => [
1508
+ n.value ? (f(), x("div", Or, "Loading...")) : (f(), x("div", xr, [
1509
+ l.value ? (f(), x("p", Mr, "Something went wrong.")) : (f(), x(ue, { key: 0 }, [
1510
+ e("div", wr, [
1511
+ c[4] || (c[4] = e("h3", { class: "fm-typo-en-body-lg-600 mb-4" }, "NetSuite Order Details", -1)),
1512
+ (f(!0), x(ue, null, be(O.value, (T, K) => (f(), x("div", {
1513
+ key: K,
1514
+ class: "mb-2"
1515
+ }, [
1516
+ e("div", null, [
1517
+ I(R, {
1518
+ label: v(rt)(K)
1519
+ }, null, 8, ["label"]),
1520
+ e("div", $r, [
1521
+ Array.isArray(T) ? (f(), x("span", Rr, _(T.length > 0 ? T.join(", ") : "N/A"), 1)) : (f(), x("span", kr, _(T), 1))
1522
+ ])
1523
+ ])
1524
+ ]))), 128))
1525
+ ]),
1526
+ s.value ? (f(), x("div", Dr, "Change Log Loading...")) : M("", !0),
1527
+ !s.value && $.value.length > 0 ? (f(), x("div", Nr, [
1528
+ e("h3", Cr, [
1529
+ I(k, {
1530
+ name: "error",
1531
+ color: "#ff9500",
1532
+ size: "sm"
1533
+ }),
1534
+ c[5] || (c[5] = De(" Change Logs "))
1535
+ ]),
1536
+ e("div", Ar, [
1537
+ e("table", Tr, [
1538
+ c[6] || (c[6] = e("thead", { class: "bg-fm-color-neutral-gray-50" }, [
1539
+ e("tr", { class: "border-b border-fm-color-neutral-gray-200" }, [
1540
+ e("th", {
1541
+ class: "text-left p-3 fm-typo-en-body-md-600",
1542
+ style: { "min-width": "130px" }
1543
+ }, " Date "),
1544
+ e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "Role"),
1545
+ e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "Name"),
1546
+ e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "Context"),
1547
+ e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "Type"),
1548
+ e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "Line ID"),
1549
+ e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "Field"),
1550
+ e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "Old Value"),
1551
+ e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "New Value")
1552
+ ])
1553
+ ], -1)),
1554
+ e("tbody", null, [
1555
+ (f(!0), x(ue, null, be($.value, (T, K) => (f(), x("tr", {
1556
+ key: K,
1557
+ class: "border-b border-fm-color-neutral-gray-200 last:border-b-0"
1558
+ }, [
1559
+ e("td", qr, _(C(T._dateiso8601)), 1),
1560
+ e("td", Fr, _(T._rolename), 1),
1561
+ e("td", Pr, _(T._employeename), 1),
1562
+ e("td", Ir, _(T._contextname), 1),
1563
+ e("td", {
1564
+ class: Ve(`p-3 fm-typo-en-body-sm-600 ${u(Number(T.type) - 1)}`)
1565
+ }, _(v(Ie)[Number(T.type) - 1]), 3),
1566
+ e("td", Er, _(T.lineid || ""), 1),
1567
+ e("td", Lr, _(T._fieldname), 1),
1568
+ e("td", Vr, _(T.oldvalue || ""), 1),
1569
+ e("td", Br, _(T.newvalue || ""), 1)
1570
+ ]))), 128))
1571
+ ])
1572
+ ])
1573
+ ])
1574
+ ])) : (f(), x("div", Ur, c[7] || (c[7] = [
1575
+ e("p", null, "No change logs available.", -1)
1576
+ ])))
1577
+ ], 64))
1578
+ ]))
1579
+ ]),
1580
+ "dialog-footer": X(() => [
1581
+ I(y, {
1582
+ class: "ml-auto sm:w-full xs:w-full",
1583
+ label: "Close",
1584
+ size: "md",
1585
+ variant: "primary",
1586
+ onClick: c[1] || (c[1] = (T) => p.value = !1)
1587
+ })
1588
+ ]),
1589
+ _: 1
1590
+ }, 8, ["modelValue"])
1591
+ ]);
1592
+ };
1593
+ }
1594
+ }), zr = {
1595
+ key: 0,
1596
+ class: "border border-fm-color-neutral-gray-200 fm-corner-radius-lg p-16 flex flex-col gap-8"
1597
+ }, Kr = { class: "flex gap-8 items-center" }, Hr = { class: "ml-auto" }, Gr = { class: "flex gap-3" }, Wr = /* @__PURE__ */ Se({
1598
+ __name: "NetSuitePanel",
1599
+ props: {
1600
+ poRequest: {},
1601
+ purchaseOrder: {},
1602
+ transferType: {},
1603
+ transferToDbName: {},
1604
+ scope: {}
1605
+ },
1606
+ setup(g) {
1607
+ const r = g, o = jt();
1608
+ Ue();
1609
+ const p = H(() => {
1610
+ var s, i, O, $, h, q, u;
1611
+ const a = ((s = r.transferToDbName) == null ? void 0 : s.startsWith("restaurant")) && ((O = (i = r.purchaseOrder) == null ? void 0 : i.supplier) == null ? void 0 : O.internal) === "restaurant", n = r.transferType === Ne.PURCHASE, l = r.transferType === Ne.TRANSFER;
1612
+ return n || l && !a || ((h = ($ = r.purchaseOrder) == null ? void 0 : $.netSuite) == null ? void 0 : h.id) || ((u = (q = r.poRequest) == null ? void 0 : q.netSuite) == null ? void 0 : u.id);
1613
+ });
1614
+ return (a, n) => {
1615
+ var s, i;
1616
+ const l = G("FmMenuDivider");
1617
+ return v(o).isNetSuiteEnabled && p.value ? (f(), x("div", zr, [
1618
+ e("div", Kr, [
1619
+ n[0] || (n[0] = e("span", { class: "flex-1 fm-typo-en-body-lg-600" }, "NetSuite Info", -1)),
1620
+ e("div", Hr, [
1621
+ e("div", Gr, [
1622
+ (i = (s = r.purchaseOrder) == null ? void 0 : s.netSuite) != null && i.id ? (f(), le(Te, { key: 0 }, {
1623
+ default: X(() => {
1624
+ var O, $, h;
1625
+ return [
1626
+ I(jr, {
1627
+ "netsuite-id": ($ = (O = a.purchaseOrder) == null ? void 0 : O.netSuite) == null ? void 0 : $.id,
1628
+ "purchase-order-id": (h = a.purchaseOrder) == null ? void 0 : h._id
1629
+ }, null, 8, ["netsuite-id", "purchase-order-id"])
1630
+ ];
1631
+ }),
1632
+ _: 1
1633
+ })) : M("", !0),
1634
+ I(Te, null, {
1635
+ default: X(() => {
1636
+ var O, $, h;
1637
+ return [
1638
+ I(_r, {
1639
+ "netsuite-id": ($ = (O = a.purchaseOrder) == null ? void 0 : O.netSuite) == null ? void 0 : $.id,
1640
+ "purchase-order-id": (h = a.purchaseOrder) == null ? void 0 : h._id
1641
+ }, null, 8, ["netsuite-id", "purchase-order-id"])
1642
+ ];
1643
+ }),
1644
+ _: 1
1645
+ }),
1646
+ I(er, {
1647
+ "po-request": a.poRequest,
1648
+ "purchase-order": a.purchaseOrder,
1649
+ "is-transfer-between-outlets": !p.value,
1650
+ scope: a.scope
1651
+ }, null, 8, ["po-request", "purchase-order", "is-transfer-between-outlets", "scope"])
1652
+ ])
1653
+ ])
1654
+ ]),
1655
+ I(l),
1656
+ I(br, {
1657
+ "po-request": a.poRequest,
1658
+ "purchase-order": a.purchaseOrder,
1659
+ "transfer-type": a.transferType,
1660
+ "transfer-to-db-name": a.transferToDbName,
1661
+ "is-transfer-between-outlets": !p.value,
1662
+ scope: a.scope
1663
+ }, null, 8, ["po-request", "purchase-order", "transfer-type", "transfer-to-db-name", "is-transfer-between-outlets", "scope"])
1664
+ ])) : M("", !0);
1665
+ };
1666
+ }
1667
+ }), Yr = { class: "flex flex-col gap-3" }, Qr = { class: "flex flex-col gap-4" }, Xr = { class: "flex flex-col gap-4 fm-typo-en-body-lg-600" }, Zr = { class: "flex flex-col gap-4" }, Jr = { class: "flex flex-col gap-4 fm-typo-en-body-lg-600" }, es = { class: "flex flex-col gap-4" }, ts = { class: "flex gap-4" }, rs = { class: "flex flex-col" }, ss = { class: "fm-typo-en-body-lg-600 basis-1/2 shrink-0 grow" }, os = { class: "fm-typo-en-body-md-400" }, ns = { class: "ml-auto flex flex-col" }, as = { class: "ml-auto flex gap-1" }, ls = { class: "fm-typo-en-body-lg-600 self-end" }, is = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, cs = { class: "flex self-end fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, us = { class: "flex flex-col gap-4" }, ds = { class: "flex flex-col gap-4" }, ms = { class: "flex flex-col gap-4" }, ps = { class: "flex flex-col gap-4 fm-typo-en-body-lg-600" }, fs = {
1668
+ key: 0,
1669
+ class: "flex flex-col gap-4"
1670
+ }, ys = { class: "flex flex-col gap-4 fm-typo-en-body-lg-600" }, vs = /* @__PURE__ */ Se({
1671
+ __name: "EditForm",
1672
+ props: {
1673
+ purchaseOrder: {},
1674
+ deliveryOrder: {}
1675
+ },
1676
+ emits: ["submitted"],
1677
+ setup(g, { emit: r }) {
1678
+ const o = Y(!1), p = g, a = r, n = gt("deliveryOrder"), l = Pe(), s = H(
1679
+ () => {
1680
+ var q;
1681
+ return ((q = p.purchaseOrder.deliveryFullfillment) == null ? void 0 : q.findIndex(
1682
+ (u) => p.deliveryOrder.fullfillmentId && u.id === p.deliveryOrder.fullfillmentId
1683
+ )) ?? -1;
1684
+ }
1685
+ ), O = qe().enablePortalDeliveryOrderWrite, $ = Fe();
1686
+ function h() {
1687
+ l.updateDeliveryOrder({
1688
+ deliveryOrder: {
1689
+ ...p.deliveryOrder,
1690
+ deliveryOrderNumber: n.deliveryOrderNumber || ""
1691
+ },
1692
+ purchaseOrderId: p.purchaseOrder._id,
1693
+ purchaseOrderRev: p.purchaseOrder._rev
1694
+ }).then(() => {
1695
+ $.open(
1696
+ {
1697
+ title: "Success",
1698
+ message: `PO# ${p.purchaseOrder.seqNumber} Changes have been saved`,
1699
+ type: "success"
1700
+ },
1701
+ 1e4
1702
+ ), o.value = !1, a("submitted");
1703
+ });
1704
+ }
1705
+ return (q, u) => {
1706
+ const C = G("FmButton"), d = G("FmTextField"), c = G("FmDialog");
1707
+ return f(), le(c, {
1708
+ modelValue: o.value,
1709
+ "onUpdate:modelValue": u[1] || (u[1] = (y) => o.value = y),
1710
+ overlay: !0
1711
+ }, {
1712
+ "dialog-button": X(() => [
1713
+ v(O) ? (f(), le(C, {
1714
+ key: 0,
1715
+ variant: "plain",
1716
+ label: "Edit",
1717
+ size: "md",
1718
+ "prepend-icon": "edit"
1719
+ })) : M("", !0)
1720
+ ]),
1721
+ "dialog-header": X(() => [
1722
+ e("div", null, "Received on " + _(v(Be)(p.deliveryOrder.createdAt)), 1)
1723
+ ]),
1724
+ "dialog-footer": X(() => [
1725
+ I(C, {
1726
+ class: "ml-auto",
1727
+ label: "Apply changes",
1728
+ size: "md",
1729
+ variant: "destructive",
1730
+ onClick: h
1731
+ })
1732
+ ]),
1733
+ default: X(() => [
1734
+ e("div", null, [
1735
+ e("div", Yr, [
1736
+ e("div", Qr, [
1737
+ u[2] || (u[2] = e("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, "Adjustment date", -1)),
1738
+ e("div", Xr, _(p.deliveryOrder.adjustment ? v(Be)(new Date(v(ze)(p.deliveryOrder.adjustment))) : "-"), 1)
1739
+ ]),
1740
+ e("div", Zr, [
1741
+ u[3] || (u[3] = e("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, "Received by", -1)),
1742
+ e("div", Jr, _(p.deliveryOrder.createdBy.name), 1)
1743
+ ]),
1744
+ e("div", es, [
1745
+ u[4] || (u[4] = e("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, "Received items", -1)),
1746
+ (f(!0), x(ue, null, be(p.deliveryOrder.received, (y, R) => {
1747
+ var k;
1748
+ return f(), x("div", { key: R }, [
1749
+ e("div", ts, [
1750
+ e("div", rs, [
1751
+ e("span", ss, _(y.sku.name), 1),
1752
+ e("span", os, _(y.sku.code), 1)
1753
+ ]),
1754
+ e("div", ns, [
1755
+ e("div", as, [
1756
+ e("span", ls, _(v(ye)(y.amount, !1)), 1),
1757
+ e("span", is, _(((k = y.measurement) == null ? void 0 : k.abbrev) ?? y.sku.unit.abbrev), 1)
1758
+ ]),
1759
+ e("div", cs, _(`${y.cost ? `(${v(Le)(y.cost)})` : ""}`), 1)
1760
+ ])
1761
+ ])
1762
+ ]);
1763
+ }), 128))
1764
+ ]),
1765
+ e("div", us, [
1766
+ u[5] || (u[5] = e("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, "Delivery order no.", -1)),
1767
+ e("div", ds, [
1768
+ I(d, {
1769
+ modelValue: v(n).deliveryOrderNumber,
1770
+ "onUpdate:modelValue": u[0] || (u[0] = (y) => v(n).deliveryOrderNumber = y),
1771
+ size: "md",
1772
+ placeholder: p.deliveryOrder.deliveryOrderNumber
1773
+ }, null, 8, ["modelValue", "placeholder"])
1774
+ ])
1775
+ ]),
1776
+ e("div", ms, [
1777
+ u[6] || (u[6] = e("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, "Remark", -1)),
1778
+ e("div", ps, _(p.deliveryOrder.remark || "N/A"), 1)
1779
+ ]),
1780
+ s.value >= 0 ? (f(), x("div", fs, [
1781
+ u[7] || (u[7] = e("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, " Fulfilment's sequence ", -1)),
1782
+ e("div", ys, _(s.value + 1), 1)
1783
+ ])) : M("", !0)
1784
+ ])
1785
+ ])
1786
+ ]),
1787
+ _: 1
1788
+ }, 8, ["modelValue"]);
1789
+ };
1790
+ }
1791
+ }), hs = { class: "flex flex-col gap-3" }, bs = { class: "flex flex-col gap-4" }, gs = { class: "flex flex-col gap-4 fm-typo-en-body-lg-600" }, _s = {
1792
+ key: 0,
1793
+ class: "flex flex-col gap-4"
1794
+ }, Ss = { class: "flex items-center justify-between" }, Os = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, xs = {
1795
+ key: 0,
1796
+ class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
1797
+ }, ws = { class: "flex gap-4" }, $s = { class: "flex-1" }, Rs = { class: "flex-1" }, ks = {
1798
+ key: 0,
1799
+ class: "flex items-center text-fm-color-system-error-300"
1800
+ }, Ds = { class: "fm-typo-en-body-md-400" }, Ns = { class: "flex flex-col gap-4" }, Cs = { class: "flex justify-between items-center py-1 gap-4" }, As = { class: "flex flex-col" }, Ts = { class: "fm-typo-en-body-lg-600" }, qs = { class: "fm-typo-en-body-md-400" }, Fs = { class: "flex flex-col gap-2 items-end" }, Ps = {
1801
+ key: 0,
1802
+ class: "flex items-center gap-2"
1803
+ }, Is = {
1804
+ key: 0,
1805
+ class: "border-b border-fm-color-stroke-secondary"
1806
+ }, Es = { class: "flex flex-col gap-4" }, Ls = { class: "flex flex-col gap-4" }, Vs = { class: "flex flex-col gap-4" }, Bs = { class: "flex flex-col gap-4 fm-typo-en-body-lg-600" }, Us = /* @__PURE__ */ Se({
1807
+ __name: "CreateForm",
1808
+ props: {
1809
+ purchaseOrder: {},
1810
+ receivedInfoMap: {}
1811
+ },
1812
+ emits: ["submitted"],
1813
+ setup(g, { emit: r }) {
1814
+ var V, B, se;
1815
+ const { t: o } = st(), p = Y(!1), a = Ue(), n = g, l = r, s = gt("", {
1816
+ default: {
1817
+ deliveryOrderNumber: "",
1818
+ remark: "",
1819
+ received: n.purchaseOrder.items.map((D) => ({
1820
+ sku: D.sku,
1821
+ amount: ke.fromNumber(0),
1822
+ measurement: D.measurement
1823
+ })),
1824
+ createdBy: {
1825
+ id: ((V = a.sessionUser.value) == null ? void 0 : V.id) || "",
1826
+ name: ((B = a.sessionUser.value) == null ? void 0 : B.displayName) || ""
1827
+ },
1828
+ createdAt: ""
1829
+ }
1830
+ }), i = Pe(), O = Ye(), $ = qe(), h = ((se = n.purchaseOrder) == null ? void 0 : se.supplier.internal) != null, q = h && $.enablePOSTransferRequireFulfillment, u = $.enablePortalDeliveryOrderWrite && (n.purchaseOrder.status === Z.Enum.RECEIVING || n.purchaseOrder.status === Z.Enum.COMPLETE) && (h ? !q : !0), C = $.enablePurchaseOrderReceiveWithCustomCost, d = $.enableBackdateReceive, c = Y({}), y = Fe(), R = H({
1831
+ get() {
1832
+ if (!s.createdAt) return "";
1833
+ const D = new Date(s.createdAt), S = D.getFullYear(), N = String(D.getMonth() + 1).padStart(2, "0"), t = String(D.getDate()).padStart(2, "0");
1834
+ return `${S}-${N}-${t}`;
1835
+ },
1836
+ set(D) {
1837
+ if (D) {
1838
+ const S = s.createdAt ? new Date(s.createdAt) : /* @__PURE__ */ new Date(), [N, t, m] = D.split("-");
1839
+ S.setFullYear(parseInt(N)), S.setMonth(parseInt(t) - 1), S.setDate(parseInt(m)), s.createdAt = S.toISOString();
1840
+ }
1841
+ }
1842
+ }), k = H({
1843
+ get() {
1844
+ if (!s.createdAt) return "";
1845
+ const D = new Date(s.createdAt), S = String(D.getHours()).padStart(2, "0"), N = String(D.getMinutes()).padStart(2, "0");
1846
+ return `${S}:${N}`;
1847
+ },
1848
+ set(D) {
1849
+ if (D) {
1850
+ const S = s.createdAt ? new Date(s.createdAt) : /* @__PURE__ */ new Date(), [N, t] = D.split(":");
1851
+ S.setHours(parseInt(N)), S.setMinutes(parseInt(t)), s.createdAt = S.toISOString();
1852
+ }
1853
+ }
1854
+ }), z = H(() => {
1855
+ const D = ze(n.purchaseOrder._id);
1856
+ if (!D) return "";
1857
+ const S = new Date(D), N = S.getFullYear(), t = String(S.getMonth() + 1).padStart(2, "0"), m = String(S.getDate()).padStart(2, "0");
1858
+ return `${N}-${t}-${m}`;
1859
+ }), T = H(() => {
1860
+ const D = ze(n.purchaseOrder._id);
1861
+ return D ? new Date(D) : null;
1862
+ }), K = H(() => {
1863
+ if (!R.value || !k.value || !T.value) return null;
1864
+ if (/* @__PURE__ */ new Date(`${R.value}T${k.value}:00`) < T.value) {
1865
+ const S = z.value, N = T.value.getHours(), t = T.value.getMinutes(), m = N >= 12 ? "PM" : "AM", A = N % 12 || 12, w = `${String(A).padStart(2, "0")}:${String(t).padStart(2, "0")} ${m}`;
1866
+ return `Delivery date & time cannot be earlier than order creation (${S} ${w})`;
1867
+ }
1868
+ return null;
1869
+ }), J = H(() => K.value ? !1 : s.received.some((S) => {
1870
+ const N = S.amount;
1871
+ return N ? +ye(N) > 0 : !1;
1872
+ }));
1873
+ function oe() {
1874
+ s.createdAt = "";
1875
+ }
1876
+ const ce = H(() => n.purchaseOrder.items.map((D, S) => H({
1877
+ get: () => {
1878
+ var t;
1879
+ const N = (t = s.received[S]) == null ? void 0 : t.amount;
1880
+ return N ? +ye(N) : 0;
1881
+ },
1882
+ set: (N) => {
1883
+ s.received[S].amount = ut(N, 2);
1884
+ }
1885
+ })));
1886
+ function Oe(D) {
1887
+ const S = !c.value[D];
1888
+ if (c.value[D] = S, S) {
1889
+ const N = n.purchaseOrder.items[D];
1890
+ N.totalCost ? s.received[D].cost = {
1891
+ currency: N.totalCost.currency,
1892
+ amount: N.totalCost.amount,
1893
+ precision: 4
1894
+ // Standardize to 4 decimals
1895
+ } : s.received[D].cost = {
1896
+ currency: Ae(),
1897
+ amount: 0,
1898
+ precision: 4
1899
+ };
1900
+ } else
1901
+ delete s.received[D].cost;
1902
+ }
1903
+ const ge = H(() => n.purchaseOrder.items.map((D, S) => H({
1904
+ get: () => {
1905
+ var t;
1906
+ const N = (t = s.received[S]) == null ? void 0 : t.cost;
1907
+ return N ? +ye(N) : 0;
1908
+ },
1909
+ set: (N) => {
1910
+ s.received[S].cost = {
1911
+ currency: Ae(),
1912
+ ...ut(N, 4)
1913
+ };
1914
+ }
1915
+ })));
1916
+ function xe() {
1917
+ O.open({
1918
+ title: "Confirm Create Delivery Order",
1919
+ message: `Are you sure you want to create delivery order for PO# ${n.purchaseOrder.seqNumber}?`,
1920
+ primaryActions: {
1921
+ text: "Create",
1922
+ close: !0,
1923
+ variant: "primary"
1924
+ },
1925
+ secondaryActions: {
1926
+ text: "Cancel",
1927
+ close: !0
1928
+ }
1929
+ }).onPrimary(() => he());
1930
+ }
1931
+ function he() {
1932
+ i.createDeliveryOrder({
1933
+ deliveryOrder: s,
1934
+ purchaseOrderId: n.purchaseOrder._id,
1935
+ purchaseOrderRev: n.purchaseOrder._rev,
1936
+ currency: Ae()
1937
+ }).then(() => {
1938
+ y.open(
1939
+ {
1940
+ title: "Success",
1941
+ message: `New delivery order created for PO# ${n.purchaseOrder.seqNumber}`,
1942
+ type: "success"
1943
+ },
1944
+ 1e4
1945
+ ), p.value = !1, l("submitted");
1946
+ });
1947
+ }
1948
+ return (D, S) => {
1949
+ const N = G("FmButton"), t = G("FmDatePicker"), m = G("FmTimePicker"), A = G("FmIcon"), w = G("FmStepperField"), j = G("FmSwitch"), U = G("FmTextField"), ee = G("FmDialog");
1950
+ return f(), le(ee, {
1951
+ modelValue: p.value,
1952
+ "onUpdate:modelValue": S[4] || (S[4] = (b) => p.value = b),
1953
+ overlay: !0,
1954
+ "min-width": 800
1955
+ }, {
1956
+ "dialog-button": X(() => [
1957
+ v(u) ? (f(), le(N, {
1958
+ key: 0,
1959
+ variant: "primary",
1960
+ label: "Create",
1961
+ size: "md",
1962
+ "prepend-icon": "add",
1963
+ class: "w-full"
1964
+ })) : M("", !0)
1965
+ ]),
1966
+ "dialog-header": X(() => [
1967
+ e("div", null, "Order #" + _(n.purchaseOrder.seqNumber) + " (New Delivery Order)", 1)
1968
+ ]),
1969
+ "dialog-footer": X(() => [
1970
+ I(N, {
1971
+ class: "ml-auto",
1972
+ label: "Create",
1973
+ size: "md",
1974
+ variant: "destructive",
1975
+ disabled: !J.value,
1976
+ onClick: xe
1977
+ }, null, 8, ["disabled"])
1978
+ ]),
1979
+ default: X(() => {
1980
+ var b;
1981
+ return [
1982
+ e("div", hs, [
1983
+ e("div", bs, [
1984
+ S[5] || (S[5] = e("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, "Received by", -1)),
1985
+ e("div", gs, _((b = v(a).sessionUser.value) == null ? void 0 : b.displayName), 1)
1986
+ ]),
1987
+ v(d) ? (f(), x("div", _s, [
1988
+ e("div", Ss, [
1989
+ e("div", Os, [
1990
+ S[6] || (S[6] = De(" Delivery Date & Time ")),
1991
+ !R.value && !k.value ? (f(), x("div", xs, " Leave blank to use current date & time ")) : M("", !0)
1992
+ ]),
1993
+ R.value || k.value ? (f(), le(N, {
1994
+ key: 0,
1995
+ variant: "tertiary",
1996
+ label: "Clear",
1997
+ "prepend-icon": "close",
1998
+ onClick: oe
1999
+ })) : M("", !0)
2000
+ ]),
2001
+ e("div", ws, [
2002
+ e("div", $s, [
2003
+ I(t, {
2004
+ modelValue: R.value,
2005
+ "onUpdate:modelValue": S[0] || (S[0] = (L) => R.value = L)
2006
+ }, null, 8, ["modelValue"])
2007
+ ]),
2008
+ e("div", Rs, [
2009
+ I(m, {
2010
+ modelValue: k.value,
2011
+ "onUpdate:modelValue": S[1] || (S[1] = (L) => k.value = L)
2012
+ }, null, 8, ["modelValue"])
2013
+ ])
2014
+ ]),
2015
+ K.value ? (f(), x("div", ks, [
2016
+ I(A, {
2017
+ name: "error",
2018
+ class: "inline-block mr-1",
2019
+ size: "sm"
2020
+ }),
2021
+ e("div", Ds, _(K.value), 1)
2022
+ ])) : M("", !0)
2023
+ ])) : M("", !0),
2024
+ e("div", Ns, [
2025
+ S[8] || (S[8] = e("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, " Items going to receive ", -1)),
2026
+ (f(!0), x(ue, null, be(n.purchaseOrder.items, (L, W) => {
2027
+ var te, E, ne;
2028
+ return f(), x("div", { key: W }, [
2029
+ e("div", Cs, [
2030
+ e("div", As, [
2031
+ e("span", Ts, _(L.sku.name), 1),
2032
+ e("span", qs, _(L.sku.code), 1)
2033
+ ]),
2034
+ e("div", Fs, [
2035
+ I(w, {
2036
+ label: "Receive Quantity",
2037
+ modelValue: ce.value[W].value,
2038
+ "onUpdate:modelValue": (de) => ce.value[W].value = de,
2039
+ "helper-text": `${v(o)("inventory.transfer.receiveRequest.details.received")} ${v(ke).toFormatString(
2040
+ {
2041
+ value: (te = D.receivedInfoMap[L.sku._id]) == null ? void 0 : te.received
2042
+ }
2043
+ )} ${((E = L.measurement) == null ? void 0 : E.abbrev) ?? L.sku.unit.abbrev}`,
2044
+ min: 0,
2045
+ "append-text": ((ne = L.measurement) == null ? void 0 : ne.abbrev) ?? L.sku.unit.abbrev
2046
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "helper-text", "append-text"]),
2047
+ v(C) ? (f(), x("div", Ps, [
2048
+ I(j, {
2049
+ "model-value": c.value[W],
2050
+ "onUpdate:modelValue": (de) => Oe(W),
2051
+ size: "sm"
2052
+ }, null, 8, ["model-value", "onUpdate:modelValue"]),
2053
+ S[7] || (S[7] = e("span", { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, " Override cost ", -1))
2054
+ ])) : M("", !0),
2055
+ v(C) && c.value[W] ? (f(), le(w, {
2056
+ key: 1,
2057
+ modelValue: ge.value[W].value,
2058
+ "onUpdate:modelValue": (de) => ge.value[W].value = de,
2059
+ label: "Total Cost",
2060
+ step: 1e-4,
2061
+ min: 0,
2062
+ placeholder: "0.0000",
2063
+ size: "sm",
2064
+ "append-text": v(Ae)()
2065
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "append-text"])) : M("", !0)
2066
+ ])
2067
+ ]),
2068
+ W < n.purchaseOrder.items.length - 1 ? (f(), x("div", Is)) : M("", !0)
2069
+ ]);
2070
+ }), 128))
2071
+ ]),
2072
+ e("div", Es, [
2073
+ S[9] || (S[9] = e("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, "Delivery order no.", -1)),
2074
+ e("div", Ls, [
2075
+ I(U, {
2076
+ modelValue: v(s).deliveryOrderNumber,
2077
+ "onUpdate:modelValue": S[2] || (S[2] = (L) => v(s).deliveryOrderNumber = L),
2078
+ size: "md"
2079
+ }, null, 8, ["modelValue"])
2080
+ ])
2081
+ ]),
2082
+ e("div", Vs, [
2083
+ S[10] || (S[10] = e("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, "Remark", -1)),
2084
+ e("div", Bs, [
2085
+ I(U, {
2086
+ modelValue: v(s).remark,
2087
+ "onUpdate:modelValue": S[3] || (S[3] = (L) => v(s).remark = L),
2088
+ size: "md"
2089
+ }, null, 8, ["modelValue"])
2090
+ ])
2091
+ ])
2092
+ ])
2093
+ ];
2094
+ }),
2095
+ _: 1
2096
+ }, 8, ["modelValue"]);
2097
+ };
2098
+ }
2099
+ }), Ms = { class: "flex flex-col w-full gap-3" }, js = { class: "flex" }, zs = { class: "fm-typo-en-title-md-600 text-fm-color-typo-primary" }, Ks = { class: "flex flex-col gap-16 w-full h-full" }, Hs = { class: "flex justify-between" }, Gs = { class: "fm-typo-en-body-lg-600" }, Ws = { class: "flex gap-2" }, Ys = {
2100
+ key: 0,
2101
+ class: "flex items-center gap-1"
2102
+ }, Qs = { class: "fm-typo-en-body-md-400" }, Xs = { class: "flex flex-col gap-8" }, Zs = { class: "flex flex-col gap-4" }, Js = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, eo = { class: "flex gap-1" }, to = { class: "fm-typo-en-body-lg-600" }, ro = {
2103
+ key: 0,
2104
+ class: "flex flex-col gap-4"
2105
+ }, so = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, oo = { class: "fm-typo-en-body-lg-600" }, no = { class: "flex flex-col gap-4" }, ao = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, lo = { class: "fm-typo-en-body-lg-600" }, io = {
2106
+ key: 1,
2107
+ class: "flex flex-col gap-4"
2108
+ }, co = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, uo = { class: "fm-typo-en-body-lg-600" }, mo = {
2109
+ key: 2,
2110
+ class: "flex flex-col gap-4"
2111
+ }, po = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, fo = { class: "fm-typo-en-body-lg-600" }, yo = {
2112
+ key: 3,
2113
+ class: "flex flex-col gap-4"
2114
+ }, vo = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ho = { class: "fm-typo-en-body-lg-600" }, bo = {
2115
+ key: 4,
2116
+ class: "flex flex-col gap-4"
2117
+ }, go = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, _o = { class: "fm-typo-en-body-lg-600" }, So = { class: "border border-fm-color-neutral-gray-200 fm-corner-radius-lg p-16" }, Oo = { class: "flex flex-col gap-8" }, xo = { class: "flex gap-8 items-center" }, wo = { class: "flex-1 fm-typo-en-body-lg-600" }, $o = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary flex flex-col gap-4" }, Ro = { class: "flex w-full gap-4" }, ko = { class: "basis-1/2 shrink-0 grow fm-typo-en-body-lg-400 line-clamp-2 flex items-center gap-2" }, Do = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary flex flex-col gap-2" }, No = { class: "fm-typo-en-body-lg-400 line-clamp-2" }, Co = ["innerHTML"], Ao = { class: "flex w-full gap-4 fm-typo-en-body-sm-400" }, To = { class: "grow fm-typo-en-body-lg-400 text-fm-color-typo-secondary line-clamp-1" }, qo = {
2118
+ key: 0,
2119
+ class: "line-clamp-1 fm-typo-en-body-lg-400 text-fm-color-typo-secondary"
2120
+ }, Fo = { class: "py-8" }, Po = { class: "flex justify-end gap-4 items-center" }, Io = { class: "fm-typo-en-body-lg-600" }, Eo = {
2121
+ key: 1,
2122
+ class: "flex-1 xs:w-screen xs:max-w-full"
2123
+ }, Lo = {
2124
+ key: 0,
2125
+ class: "flex flex-col items-center gap-8 h-full"
2126
+ }, Vo = ["src"], Bo = { class: "fm-typo-en-body-lg-600" }, Uo = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary px-16" }, Mo = {
2127
+ key: 1,
2128
+ class: "px-4 flex flex-col"
2129
+ }, jo = { class: "flex gap-12 content-stretch" }, zo = {
2130
+ class: "flex flex-col w-40",
2131
+ name: "circles"
2132
+ }, Ko = { class: "flex-1 flex flex-col items-center" }, Ho = { class: "h-40 w-40 bg-fm-color-primary rounded-full flex items-center justify-center" }, Go = { class: "flex-1 flex flex-col items-center" }, Wo = { class: "flex w-full items-center gap-4" }, Yo = {
2133
+ class: "py-12 flex flex-col gap-4",
2134
+ name: "received-at header"
2135
+ }, Qo = { class: "fm-typo-en-body-lg-400" }, Xo = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, Zo = { class: "ml-auto" }, Jo = { class: "flex gap-12 content-stretch" }, en = {
2136
+ class: "flex flex-col w-40",
2137
+ name: "circles"
2138
+ }, tn = { class: "flex-1 flex flex-col items-center" }, rn = {
2139
+ class: "py-12 flex flex-col gap-4 flex-1",
2140
+ name: "delivery details"
2141
+ }, sn = { class: "flex flex-col gap-8" }, on = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, nn = { class: "flex flex-col gap-4" }, an = { class: "flex gap-8 xs:flex-col" }, Sn = /* @__PURE__ */ Se({
2142
+ __name: "TransferDetails",
2143
+ props: {
2144
+ poRequest: {},
2145
+ purchaseOrder: {},
2146
+ transferTo: {},
2147
+ transferToDbName: {},
2148
+ show: { type: Boolean },
2149
+ canResubmit: { type: Boolean },
2150
+ canApprove: { type: Boolean },
2151
+ scope: {},
2152
+ receivedMap: {},
2153
+ shipments: {}
2154
+ },
2155
+ emits: ["update:show", "submitted"],
2156
+ setup(g, { emit: r }) {
2157
+ const o = g, p = r, a = Ye(), n = Fe(), l = qe(), s = _e(), i = Ue(), O = H(
2158
+ () => {
2159
+ var t, m;
2160
+ return {
2161
+ id: ((t = i.sessionUser.value) == null ? void 0 : t.id) ?? "",
2162
+ name: ((m = i.sessionUser.value) == null ? void 0 : m.displayName) ?? ""
2163
+ };
2164
+ }
2165
+ ), $ = Zt(), { t: h } = st(), q = H(
2166
+ () => {
2167
+ var t, m, A, w;
2168
+ return ((m = (t = o.purchaseOrder) == null ? void 0 : t.supplier) == null ? void 0 : m.internal) === "restaurant" || ((w = (A = o.purchaseOrder) == null ? void 0 : A.supplier) == null ? void 0 : w.internal) === "warehouse" ? Ne.TRANSFER : Ne.PURCHASE;
2169
+ }
2170
+ ), u = H(() => {
2171
+ var A;
2172
+ const t = (A = o.shipments) == null ? void 0 : A.find((w) => {
2173
+ var j;
2174
+ return w.ref === ((j = o.purchaseOrder) == null ? void 0 : j._id);
2175
+ });
2176
+ let m = null;
2177
+ if (t != null && t.milestones && t.milestones.length > 0) {
2178
+ const w = t.milestones[t.milestones.length - 1];
2179
+ if (w.estimatedTime) {
2180
+ const j = new Date(w.estimatedTime), U = j.getDate().toString().padStart(2, "0");
2181
+ m = `${j.toLocaleString("en-US", { month: "short" })} ${U}`;
2182
+ }
2183
+ }
2184
+ return m;
2185
+ }), C = Y(!1), d = Y(""), c = Y(!0), y = Pe(), R = Mt(y.getWorkflowConfig), k = Ot(), z = H(() => {
2186
+ if (!o.purchaseOrder)
2187
+ return [];
2188
+ const t = R.result.value;
2189
+ if (t.state === dt.loading)
2190
+ return [];
2191
+ const m = {
2192
+ user: O.value,
2193
+ executedAt: s.locations.computeFirst(
2194
+ (w) => {
2195
+ var j;
2196
+ return w.dbName === ((j = s._currentLocation) == null ? void 0 : j.dbName) ? w : null;
2197
+ }
2198
+ ),
2199
+ purchaseOrderRequest: o.poRequest,
2200
+ purchaseOrder: o.purchaseOrder
2201
+ };
2202
+ let A = [];
2203
+ try {
2204
+ t.state === dt.error ? (console.error("Error fetching workflow config:", t.error), A = Qe.getAvailableActions({
2205
+ ...m,
2206
+ orderConfig: Qe.getDefaultConfig()
2207
+ }).actions.filter(
2208
+ (w) => (
2209
+ // TODO: create receiveStock & processRequest dialog
2210
+ // to create their payload
2211
+ w !== F.enum.receiveStock && w !== F.enum.processRequest && w !== F.enum.closeRequest
2212
+ )
2213
+ )) : A = Qe.getAvailableActions({
2214
+ ...m,
2215
+ orderConfig: t.data
2216
+ }).actions.filter(
2217
+ (w) => w !== F.enum.receiveStock && w !== F.enum.processRequest && w !== F.enum.closeRequest
2218
+ );
2219
+ } catch (w) {
2220
+ console.error("Error getting available actions:", w);
2221
+ }
2222
+ return o.scope === "approval" && (A = A.filter((w) => w !== F.enum.completeReceive)), A;
2223
+ }), T = Ft(o, "show"), K = H(() => [
2224
+ {
2225
+ label: h("inventory.transfer.receiveRequest.details.overview"),
2226
+ value: "overview"
2227
+ },
2228
+ {
2229
+ label: h("inventory.transfer.receiveRequest.details.deliveryHistory"),
2230
+ value: "deliveryHistory"
2231
+ }
2232
+ ]), J = Y(K.value[0]);
2233
+ Ct(
2234
+ () => o.show,
2235
+ (t) => {
2236
+ t && (J.value = K.value[0]);
2237
+ }
2238
+ );
2239
+ async function oe(t, m, A, w, j) {
2240
+ return new Promise((U, ee) => {
2241
+ a.open({
2242
+ closeButton: !1,
2243
+ title: w.title,
2244
+ message: w.message,
2245
+ primaryActions: w.primaryActions,
2246
+ secondaryActions: { text: "No", close: !1 }
2247
+ }).onPrimary(async () => {
2248
+ var L, W, te, E;
2249
+ const b = [];
2250
+ A === F.enum.approveRequest ? (b.push({
2251
+ action: "approveRequest",
2252
+ payload: null
2253
+ }), m.fulfillment && b.push({
2254
+ action: "processRequest",
2255
+ payload: {
2256
+ fulfillmentId: "",
2257
+ deliveryOrderNumber: "",
2258
+ deliveryRemark: null,
2259
+ items: m.fulfillment.items,
2260
+ createdBy: O.value
2261
+ }
2262
+ })) : A === F.enum.processRequest ? m.fulfillment && b.push({
2263
+ action: "processRequest",
2264
+ payload: {
2265
+ fulfillmentId: "",
2266
+ deliveryOrderNumber: "",
2267
+ deliveryRemark: null,
2268
+ items: m.fulfillment.items,
2269
+ createdBy: O.value
2270
+ }
2271
+ }) : A === F.enum.rejectRequest ? b.push({
2272
+ action: "rejectRequest",
2273
+ payload: null
2274
+ }) : A === F.enum.closeRequest && b.push({
2275
+ action: "closeRequest",
2276
+ payload: null
2277
+ });
2278
+ try {
2279
+ await k({
2280
+ operate: {
2281
+ operation: A,
2282
+ doc: t,
2283
+ options: m
2284
+ },
2285
+ operateV2: {
2286
+ _id: ((L = o.purchaseOrder) == null ? void 0 : L._id) ?? "",
2287
+ _rev: ((W = o.purchaseOrder) == null ? void 0 : W._rev) ?? "",
2288
+ action: A,
2289
+ payloads: b
2290
+ // add payload if action is receiveStock or processRequest
2291
+ },
2292
+ transferTo: (E = (te = o.poRequest) == null ? void 0 : te.to) == null ? void 0 : E.dbName
2293
+ }).delayed(1e3), U("submitted");
2294
+ } catch (ne) {
2295
+ ee(ne);
2296
+ }
2297
+ }).onSecondary(() => {
2298
+ U("cancelled");
2299
+ for (let b = 0; b < j + 2; b++)
2300
+ a.close();
2301
+ }).onClose(() => {
2302
+ });
2303
+ });
2304
+ }
2305
+ async function ce(t) {
2306
+ var j, U, ee, b;
2307
+ if (t === F.enum.receiveStock)
2308
+ return;
2309
+ const m = St[t];
2310
+ if (!m) {
2311
+ n.open({
2312
+ title: "Something went wrong",
2313
+ message: `Cannot process order: ${rt(t)}`,
2314
+ type: "error"
2315
+ });
2316
+ return;
2317
+ }
2318
+ const { successMessage: A, ...w } = m;
2319
+ if (o.purchaseOrder) {
2320
+ d.value = `${t}`, C.value = !0, c.value = !1;
2321
+ const L = {};
2322
+ let W = 0;
2323
+ if ((t === F.enum.confirmDraft || // auto receive for warehouse to warehouse
2324
+ t === F.enum.completeReceive) && l.autoReceiveWarehouse)
2325
+ L.autoReceive = !0;
2326
+ else if ((t === F.enum.approveRequest || t === F.enum.processRequest) && l.acceptRequireFulfillment) {
2327
+ const te = (U = (j = o.poRequest) == null ? void 0 : j.from) == null ? void 0 : U.dbName, E = (b = (ee = o.poRequest) == null ? void 0 : ee.to) == null ? void 0 : b.dbName;
2328
+ if (te && E && (te.startsWith("warehouse_") || E.startsWith("warehouse_"))) {
2329
+ const ne = await new Promise((de, we) => {
2330
+ a.open({
2331
+ closeButton: !1,
2332
+ title: "Confirm transfer amount",
2333
+ dialogComponent: Xt,
2334
+ dialogComponentProps: {
2335
+ purchaseOrder: o.purchaseOrder,
2336
+ confirm: de,
2337
+ "onUpdate:show": ($e) => {
2338
+ $e || (d.value = "", C.value = !1, c.value = !0, W++, a.close()), we("cancelled");
2339
+ }
2340
+ }
2341
+ });
2342
+ });
2343
+ L.fulfillment = ne;
2344
+ }
2345
+ }
2346
+ try {
2347
+ await oe(
2348
+ o.purchaseOrder,
2349
+ L,
2350
+ t,
2351
+ m,
2352
+ W
2353
+ ) === "submitted" && (n.open({
2354
+ title: "Success",
2355
+ message: A,
2356
+ type: "success"
2357
+ }), p("update:show", !1), p("submitted"));
2358
+ } catch (te) {
2359
+ n.open({
2360
+ title: "Something went wrong",
2361
+ message: "Please try again.",
2362
+ type: "error"
2363
+ }), console.error("Error when submitting PO operation", t, o.purchaseOrder, te);
2364
+ } finally {
2365
+ d.value = "", C.value = !1, c.value = !0;
2366
+ }
2367
+ }
2368
+ }
2369
+ const Oe = H(() => {
2370
+ var t, m;
2371
+ return ((t = o.purchaseOrder) == null ? void 0 : t.status) === Z.enum.RECEIVING || ((m = o.purchaseOrder) == null ? void 0 : m.status) === Z.enum.COMPLETE;
2372
+ }), ge = H(() => o.purchaseOrder ? He(o.purchaseOrder) : {}), xe = H(() => {
2373
+ const t = o.purchaseOrder;
2374
+ if (!t) return { status: "", statusClass: "" };
2375
+ const { partial: m, over: A } = Je(ge.value), w = et(t.status, m, A);
2376
+ let j = h(`inventory.transfer.status.${w}`), U = `${t.status}`.toLocaleLowerCase("en-us");
2377
+ return w === Z.enum.CLOSE && (j = `${h(`inventory.transfer.status.${Z.enum.COMPLETE}`)}`), w === "PARTIAL_RECEIVED" && U === Z.enum.PROCESSING.toLocaleLowerCase("en-us") && (U = Z.enum.RECEIVING.toLocaleLowerCase("en-us")), {
2378
+ status: j,
2379
+ statusClass: `fm-status-badge fm-status-badge-${U}`
2380
+ };
2381
+ }), he = H(() => {
2382
+ var U, ee;
2383
+ const t = ((U = o.purchaseOrder) == null ? void 0 : U.deliveryOrder) ?? [], m = ((ee = o.purchaseOrder) == null ? void 0 : ee.deliveryFullfillment) ?? [], A = [
2384
+ ...t.map((b) => ({
2385
+ createdAt: b.createdAt,
2386
+ type: "grn",
2387
+ doc: b
2388
+ })),
2389
+ ...m.map((b) => ({
2390
+ createdAt: b.createdAt,
2391
+ type: "fulfillment",
2392
+ doc: b
2393
+ }))
2394
+ ];
2395
+ A.reverse().sort((b, L) => b.createdAt.localeCompare(L.createdAt));
2396
+ function w(b) {
2397
+ var te, E, ne, de, we, $e, Q, ie, ae;
2398
+ const L = m.findIndex((re) => re.id === b.fullfillmentId), W = [
2399
+ (E = (te = m[L]) == null ? void 0 : te.netSuite) != null && E.refNo ? {
2400
+ label: "Fulfillment's ref no. (Netsuite)",
2401
+ values: [(de = (ne = m[L]) == null ? void 0 : ne.netSuite) == null ? void 0 : de.refNo]
2402
+ } : null,
2403
+ (we = b == null ? void 0 : b.netSuite) != null && we.refNo ? {
2404
+ label: "Netsuite ref no.",
2405
+ values: [($e = b == null ? void 0 : b.netSuite) == null ? void 0 : $e.refNo]
2406
+ } : null,
2407
+ (Q = b == null ? void 0 : b.netSuite) != null && Q.recordType ? {
2408
+ label: "Netsuite Type",
2409
+ values: [ht((ie = b == null ? void 0 : b.netSuite) == null ? void 0 : ie.recordType)]
2410
+ } : null
2411
+ ];
2412
+ return {
2413
+ header: "Received",
2414
+ deliveryOrder: b,
2415
+ date: Be(new Date(b.createdAt)),
2416
+ info: [
2417
+ {
2418
+ label: "Adjustment date",
2419
+ values: [
2420
+ b.adjustment ? Be(new Date(ze(b.adjustment))) : "-"
2421
+ ]
2422
+ },
2423
+ {
2424
+ label: "Received by",
2425
+ values: [(ae = b.createdBy) == null ? void 0 : ae.name]
2426
+ },
2427
+ {
2428
+ label: "Received items",
2429
+ values: b.received.map((re) => {
2430
+ var pe;
2431
+ return P("div", [
2432
+ P(
2433
+ "div",
2434
+ {
2435
+ class: "flex gap-4"
2436
+ },
2437
+ [
2438
+ P(
2439
+ "div",
2440
+ {
2441
+ class: "flex flex-col"
2442
+ },
2443
+ [
2444
+ P(
2445
+ "span",
2446
+ {
2447
+ class: "fm-typo-en-body-lg-800 basis-1/2 shrink-0 grow"
2448
+ },
2449
+ `${re.sku.name}`
2450
+ ),
2451
+ P(
2452
+ "span",
2453
+ {
2454
+ class: "fm-typo-en-body-md-400"
2455
+ },
2456
+ `${re.sku.code} `
2457
+ )
2458
+ ]
2459
+ ),
2460
+ P(
2461
+ "div",
2462
+ {
2463
+ class: "ml-auto flex flex-col"
2464
+ },
2465
+ [
2466
+ P(
2467
+ "div",
2468
+ {
2469
+ class: "ml-auto flex gap-1"
2470
+ },
2471
+ [
2472
+ P(
2473
+ "span",
2474
+ {
2475
+ class: "fm-typo-en-body-lg-600 self-end"
2476
+ },
2477
+ ye(re.amount, !1)
2478
+ ),
2479
+ P(
2480
+ "span",
2481
+ {
2482
+ class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary"
2483
+ },
2484
+ ((pe = re.measurement) == null ? void 0 : pe.abbrev) ?? re.sku.unit.abbrev
2485
+ )
2486
+ ]
2487
+ ),
2488
+ P(
2489
+ "div",
2490
+ {
2491
+ class: "flex self-end fm-typo-en-body-md-400 text-fm-color-typo-secondary"
2492
+ },
2493
+ `${re.cost ? `(${Le(re.cost)})` : ""}`
2494
+ )
2495
+ ]
2496
+ )
2497
+ ]
2498
+ )
2499
+ ]);
2500
+ })
2501
+ },
2502
+ {
2503
+ label: "Delivery order no.",
2504
+ values: [b.deliveryOrderNumber || "N/A"]
2505
+ },
2506
+ {
2507
+ label: "Remark",
2508
+ values: [b.remark || "N/A"]
2509
+ },
2510
+ L > -1 ? {
2511
+ label: "Fulfilment's sequence",
2512
+ values: [`${L + 1}`]
2513
+ } : null,
2514
+ ...W
2515
+ ].filter((re) => !!re)
2516
+ };
2517
+ }
2518
+ function j(b) {
2519
+ var W, te;
2520
+ const L = m.findIndex((E) => E.id === b.id);
2521
+ return {
2522
+ header: "Fulfillment",
2523
+ date: Be(new Date(b.createdAt)),
2524
+ info: [
2525
+ {
2526
+ label: "Sequence",
2527
+ values: [String(L + 1)]
2528
+ },
2529
+ {
2530
+ label: "Receiveable items",
2531
+ values: b.items.map((E) => {
2532
+ var ne;
2533
+ return P("div", [
2534
+ P(
2535
+ "div",
2536
+ {
2537
+ class: "flex gap-4"
2538
+ },
2539
+ [
2540
+ P(
2541
+ "div",
2542
+ {
2543
+ class: "flex flex-col"
2544
+ },
2545
+ [
2546
+ P(
2547
+ "span",
2548
+ {
2549
+ class: "fm-typo-en-body-lg-800 basis-1/2 shrink-0 grow"
2550
+ },
2551
+ `${E.sku.name}`
2552
+ ),
2553
+ P(
2554
+ "span",
2555
+ {
2556
+ class: "fm-typo-en-body-md-400"
2557
+ },
2558
+ `${E.sku.code} `
2559
+ )
2560
+ ]
2561
+ ),
2562
+ P(
2563
+ "div",
2564
+ {
2565
+ class: "ml-auto flex flex-col"
2566
+ },
2567
+ [
2568
+ P(
2569
+ "div",
2570
+ {
2571
+ class: "ml-auto flex gap-1"
2572
+ },
2573
+ [
2574
+ P(
2575
+ "span",
2576
+ {
2577
+ class: "fm-typo-en-body-lg-600 self-end"
2578
+ },
2579
+ ye(E.amount, !1)
2580
+ ),
2581
+ P(
2582
+ "span",
2583
+ {
2584
+ class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary"
2585
+ },
2586
+ ((ne = E.measurement) == null ? void 0 : ne.abbrev) ?? E.sku.unit.abbrev
2587
+ )
2588
+ ]
2589
+ ),
2590
+ P(
2591
+ "div",
2592
+ {
2593
+ class: "flex self-end fm-typo-en-body-md-400 text-fm-color-typo-secondary"
2594
+ },
2595
+ `${E.cost ? `(${Le(E.cost)})` : ""}`
2596
+ )
2597
+ ]
2598
+ )
2599
+ ]
2600
+ )
2601
+ ]);
2602
+ })
2603
+ },
2604
+ (W = b.netSuite) != null && W.refNo ? {
2605
+ label: "Ref no. (Netsuite)",
2606
+ values: [(te = b.netSuite) == null ? void 0 : te.refNo]
2607
+ } : null
2608
+ ].filter((E) => !!E)
2609
+ };
2610
+ }
2611
+ return A.map((b) => {
2612
+ switch (b.type) {
2613
+ case "grn":
2614
+ return w(b.doc);
2615
+ case "fulfillment":
2616
+ return j(b.doc);
2617
+ }
2618
+ });
2619
+ }), V = H(() => {
2620
+ var m;
2621
+ const t = {
2622
+ ...yt(0),
2623
+ currency: Ae()
2624
+ };
2625
+ return ((m = o.purchaseOrder) == null ? void 0 : m.items.reduce((A, w) => ({
2626
+ ...ft(A, w.totalCost ?? t),
2627
+ currency: Ae()
2628
+ }), t)) ?? t;
2629
+ });
2630
+ function B(t) {
2631
+ var U;
2632
+ const A = (((U = o.purchaseOrder) == null ? void 0 : U.version) ?? Re.enum[1]) === Re.enum[2] ? t.id : t.sku._id, w = o.receivedMap[A];
2633
+ return `<span class="${se(t)} fm-typo-en-body-lg-600">${ke.toFormatString({ value: w.received })}</span>/${Et(t.quantity, t.sku.unit, t.measurement)}`;
2634
+ }
2635
+ function se(t) {
2636
+ var L;
2637
+ const A = (((L = o.purchaseOrder) == null ? void 0 : L.version) ?? Re.enum[1]) === Re.enum[2] ? t.id : t.sku._id, w = o.receivedMap[A], { isPartialReceive: j, isNoReceive: U, isOverReceive: ee, isFullReceive: b } = Kt(w);
2638
+ return U ? "text-fm-color-typo-tertiary" : j ? "text-fm-color-system-warning-300" : ee ? "text-fm-color-system-error-300" : b ? "text-fm-color-system-success-300" : "";
2639
+ }
2640
+ const D = H(() => {
2641
+ var t, m, A;
2642
+ return (t = o.purchaseOrder) != null && t.itemsAtSubmission ? ((m = o.purchaseOrder) == null ? void 0 : m.version) === Re.enum[2] ? o.purchaseOrder.items.reduce((w, j) => {
2643
+ var ee, b;
2644
+ const U = (b = (ee = o.purchaseOrder) == null ? void 0 : ee.itemsAtSubmission) == null ? void 0 : b.find(
2645
+ (L) => L.id === j.id
2646
+ );
2647
+ return U && U.quantity !== j.quantity && w.set(j.sku.code, {
2648
+ originalAmount: Number(ke.toFormatString({ value: U.quantity })),
2649
+ newAmount: Number(ke.toFormatString({ value: j.quantity }))
2650
+ }), w;
2651
+ }, /* @__PURE__ */ new Map()) : (A = o.purchaseOrder) == null ? void 0 : A.items.reduce((w, j) => {
2652
+ var L, W;
2653
+ const U = (W = (L = o.purchaseOrder) == null ? void 0 : L.itemsAtSubmission) == null ? void 0 : W.find(
2654
+ (te) => te.sku._id === j.sku._id
2655
+ ), ee = U ? Number(ke.toFormatString({ value: U.quantity })) : 0, b = Number(ke.toFormatString({ value: j.quantity }));
2656
+ return U && ee !== b && w.set(j.sku.code, {
2657
+ originalAmount: ee,
2658
+ newAmount: b
2659
+ }), w;
2660
+ }, /* @__PURE__ */ new Map()) : /* @__PURE__ */ new Map();
2661
+ }), S = (t) => {
2662
+ var A, w;
2663
+ const m = D.value;
2664
+ return ((A = o.purchaseOrder) == null ? void 0 : A.version) === Re.enum[2] ? m.has(t.id) : m.has((w = t.sku) == null ? void 0 : w.code);
2665
+ }, N = (t) => {
2666
+ var A, w;
2667
+ const m = D.value;
2668
+ return ((A = o.purchaseOrder) == null ? void 0 : A.version) === Re.enum[2] ? m.get(t.id) : m.get((w = t.sku) == null ? void 0 : w.code);
2669
+ };
2670
+ return (t, m) => {
2671
+ const A = G("FmButton"), w = G("FmButtonGroup"), j = G("FmChip"), U = G("FmIcon"), ee = G("FmMenuDivider"), b = G("FmCard"), L = G("FmTooltip"), W = G("FmSpacer"), te = G("FmSideSheet");
2672
+ return f(), le(te, {
2673
+ modelValue: v(T),
2674
+ "onUpdate:modelValue": m[8] || (m[8] = (E) => At(T) ? T.value = E : null),
2675
+ "dismiss-away": c.value,
2676
+ "max-width": 600,
2677
+ "close-button": !1
2678
+ }, {
2679
+ "side-sheet-header": X(() => {
2680
+ var E, ne;
2681
+ return [
2682
+ e("div", Ms, [
2683
+ e("div", js, [
2684
+ e("div", zs, _(v(h)("inventory.transfer.receiveRequest.details.title") + ((E = t.purchaseOrder) != null && E.seqNumber ? ` #${(ne = t.purchaseOrder) == null ? void 0 : ne.seqNumber}` : "")), 1),
2685
+ I(A, {
2686
+ class: "ml-auto -m-2",
2687
+ variant: "tertiary",
2688
+ "prepend-icon": "close",
2689
+ onClick: m[0] || (m[0] = (de) => p("update:show", !1))
2690
+ })
2691
+ ]),
2692
+ I(w, {
2693
+ items: K.value,
2694
+ modelValue: J.value,
2695
+ "onUpdate:modelValue": m[1] || (m[1] = (de) => J.value = de)
2696
+ }, null, 8, ["items", "modelValue"]),
2697
+ t.purchaseOrder && J.value.value === "deliveryHistory" ? (f(), le(Us, {
2698
+ key: 0,
2699
+ "purchase-order": t.purchaseOrder,
2700
+ "received-info-map": ge.value,
2701
+ onSubmitted: m[2] || (m[2] = () => {
2702
+ p("update:show", !1), p("submitted");
2703
+ })
2704
+ }, null, 8, ["purchase-order", "received-info-map"])) : M("", !0)
2705
+ ])
2706
+ ];
2707
+ }),
2708
+ default: X(() => {
2709
+ var E, ne, de, we, $e;
2710
+ return [
2711
+ e("div", Ks, [
2712
+ J.value.value === "overview" ? (f(), x(ue, { key: 0 }, [
2713
+ e("div", null, [
2714
+ I(b, {
2715
+ variant: "outlined",
2716
+ class: "flex flex-col gap-8 px-12 py-16"
2717
+ }, {
2718
+ default: X(() => {
2719
+ var Q, ie, ae, re, pe, Me, ot, nt, at;
2720
+ return [
2721
+ e("div", Hs, [
2722
+ e("div", Gs, _(v(h)("inventory.transfer.receiveRequest.details.requestSummary")), 1),
2723
+ e("div", Ws, [
2724
+ I(Te, null, {
2725
+ default: X(() => {
2726
+ var lt;
2727
+ return [
2728
+ De(_((lt = o.purchaseOrder) == null ? void 0 : lt.status), 1)
2729
+ ];
2730
+ }),
2731
+ _: 1
2732
+ }),
2733
+ I(j, {
2734
+ label: xe.value.status,
2735
+ class: Ve(xe.value.statusClass),
2736
+ compact: ""
2737
+ }, null, 8, ["label", "class"]),
2738
+ u.value ? (f(), x("div", Ys, [
2739
+ I(U, {
2740
+ name: "local_shipping",
2741
+ color: "#666666"
2742
+ }),
2743
+ e("span", Qs, _(u.value), 1)
2744
+ ])) : M("", !0)
2745
+ ])
2746
+ ]),
2747
+ I(ee),
2748
+ e("div", Xs, [
2749
+ e("div", Zs, [
2750
+ e("div", Js, [
2751
+ e("div", eo, _(v(h)("inventory.transfer.receiveRequest.details.createdAt")), 1)
2752
+ ]),
2753
+ e("div", to, _(v(je)(((Q = t.purchaseOrder) == null ? void 0 : Q._id) ?? "")), 1)
2754
+ ]),
2755
+ (ie = t.purchaseOrder) != null && ie.effectiveAt ? (f(), x("div", ro, [
2756
+ e("div", so, _(v(h)("inventory.transfer.receiveRequest.details.backdatedTo")), 1),
2757
+ e("div", oo, _(v(vt)(new Date((ae = t.purchaseOrder) == null ? void 0 : ae.effectiveAt))), 1)
2758
+ ])) : M("", !0),
2759
+ e("div", no, [
2760
+ e("div", ao, _(v(h)("inventory.transfer.receiveRequest.details.type.title")), 1),
2761
+ e("div", lo, _(v(h)(
2762
+ `inventory.transfer.receiveRequest.details.type.${q.value.toLocaleLowerCase("en-US")}`
2763
+ )), 1)
2764
+ ]),
2765
+ (pe = (re = t.purchaseOrder) == null ? void 0 : re.supplier) != null && pe.name ? (f(), x("div", io, [
2766
+ e("div", co, _(v(h)("inventory.transfer.receiveRequest.details.from")), 1),
2767
+ e("div", uo, _((ot = (Me = t.purchaseOrder) == null ? void 0 : Me.supplier) == null ? void 0 : ot.name), 1)
2768
+ ])) : M("", !0),
2769
+ t.transferTo ? (f(), x("div", mo, [
2770
+ e("div", po, _(v(h)("inventory.transfer.receiveRequest.details.to")), 1),
2771
+ e("div", fo, _(t.transferTo), 1)
2772
+ ])) : M("", !0),
2773
+ (nt = t.purchaseOrder) != null && nt.ref ? (f(), x("div", yo, [
2774
+ e("div", vo, _(v(h)("inventory.transfer.receiveRequest.details.reference")), 1),
2775
+ e("div", ho, _(t.purchaseOrder.ref), 1)
2776
+ ])) : M("", !0),
2777
+ (at = t.purchaseOrder) != null && at.remark ? (f(), x("div", bo, [
2778
+ e("div", go, _(v(h)("inventory.transfer.receiveRequest.details.remark")), 1),
2779
+ e("div", _o, _(t.purchaseOrder.remark), 1)
2780
+ ])) : M("", !0)
2781
+ ])
2782
+ ];
2783
+ }),
2784
+ _: 1
2785
+ })
2786
+ ]),
2787
+ I(Wr, {
2788
+ "po-request": t.poRequest,
2789
+ purchaseOrder: t.purchaseOrder,
2790
+ transferType: q.value,
2791
+ transferToDbName: t.transferToDbName,
2792
+ scope: t.scope
2793
+ }, null, 8, ["po-request", "purchaseOrder", "transferType", "transferToDbName", "scope"]),
2794
+ e("div", So, [
2795
+ e("div", Oo, [
2796
+ e("div", xo, [
2797
+ e("span", wo, [
2798
+ De(_(Oe.value ? v(h)("inventory.transfer.receiveRequest.details.receivedItems") : v(h)("inventory.transfer.receiveRequest.details.requestedItems")) + " ", 1),
2799
+ (ne = (E = t.purchaseOrder) == null ? void 0 : E.netSuite) != null && ne.missingItems && ((we = (de = t.purchaseOrder) == null ? void 0 : de.netSuite) == null ? void 0 : we.missingItems.length) > 0 ? (f(), le(L, {
2800
+ key: 0,
2801
+ variant: "rich",
2802
+ placement: "top",
2803
+ "z-index": 51
2804
+ }, {
2805
+ content: X(() => {
2806
+ var Q, ie;
2807
+ return [
2808
+ e("div", $o, [
2809
+ (f(!0), x(ue, null, be((ie = (Q = t.purchaseOrder) == null ? void 0 : Q.netSuite) == null ? void 0 : ie.missingItems, (ae, re) => (f(), x("div", {
2810
+ class: "flex justify-center align-middle",
2811
+ key: re
2812
+ }, [
2813
+ I(U, {
2814
+ name: "arrow_right",
2815
+ size: "sm"
2816
+ }),
2817
+ De(" " + _(`(${ae.netSuiteId}) ${ae.name}: ${ae.reason}`), 1)
2818
+ ]))), 128))
2819
+ ])
2820
+ ];
2821
+ }),
2822
+ default: X(() => [
2823
+ I(U, {
2824
+ name: "error",
2825
+ color: "#ff2c2c",
2826
+ size: "sm"
2827
+ })
2828
+ ]),
2829
+ _: 1
2830
+ })) : M("", !0)
2831
+ ])
2832
+ ]),
2833
+ I(ee),
2834
+ (f(!0), x(ue, null, be((($e = t.purchaseOrder) == null ? void 0 : $e.items) ?? [], (Q, ie) => {
2835
+ var ae;
2836
+ return f(), x("div", {
2837
+ key: ie,
2838
+ class: "flex flex-col"
2839
+ }, [
2840
+ e("div", Ro, [
2841
+ e("div", ko, [
2842
+ De(_(Q.name) + " ", 1),
2843
+ S(Q) ? (f(), le(L, {
2844
+ key: 0,
2845
+ variant: "rich",
2846
+ placement: "top",
2847
+ "z-index": 51
2848
+ }, {
2849
+ content: X(() => {
2850
+ var re, pe;
2851
+ return [
2852
+ e("div", Do, [
2853
+ m[9] || (m[9] = e("div", { class: "font-semibold" }, "Submission changes", -1)),
2854
+ e("div", null, "Original Amount: " + _((re = N(Q)) == null ? void 0 : re.originalAmount), 1),
2855
+ e("div", null, " New Amount: " + _((pe = N(Q)) == null ? void 0 : pe.newAmount), 1)
2856
+ ])
2857
+ ];
2858
+ }),
2859
+ default: X(() => [
2860
+ I(U, {
2861
+ name: "error",
2862
+ color: "#ff9500",
2863
+ size: "sm"
2864
+ })
2865
+ ]),
2866
+ _: 2
2867
+ }, 1024)) : M("", !0)
2868
+ ]),
2869
+ e("div", No, [
2870
+ e("span", {
2871
+ innerHTML: B(Q)
2872
+ }, null, 8, Co)
2873
+ ])
2874
+ ]),
2875
+ e("div", Ao, [
2876
+ e("div", To, _(Q.code), 1),
2877
+ (ae = Q.totalCost) != null && ae.amount && v(l).enableTotalCost ? (f(), x("div", qo, " (" + _(v(Le)(Q.totalCost)) + ") ", 1)) : M("", !0)
2878
+ ])
2879
+ ]);
2880
+ }), 128)),
2881
+ +v(ye)(V.value) ? (f(), x(ue, { key: 0 }, [
2882
+ e("div", Fo, [
2883
+ I(ee)
2884
+ ]),
2885
+ e("div", Po, [
2886
+ m[10] || (m[10] = e("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, "Total:", -1)),
2887
+ e("div", Io, _(v(Le)(V.value)), 1)
2888
+ ])
2889
+ ], 64)) : M("", !0)
2890
+ ])
2891
+ ])
2892
+ ], 64)) : J.value.value === "deliveryHistory" ? (f(), x("div", Eo, [
2893
+ he.value.length ? (f(), x("div", Mo, [
2894
+ (f(!0), x(ue, null, be(he.value, (Q, ie) => (f(), x(ue, { key: ie }, [
2895
+ e("div", jo, [
2896
+ e("div", zo, [
2897
+ e("div", Ko, [
2898
+ e("div", {
2899
+ class: Ve([
2900
+ {
2901
+ "bg-fm-color-primary": ie !== 0,
2902
+ "bg-white": ie === 0
2903
+ },
2904
+ "w-[2px] h-full"
2905
+ ])
2906
+ }, null, 2)
2907
+ ]),
2908
+ e("div", Ho, [
2909
+ Q.header === "Received" ? (f(), le(U, {
2910
+ key: 0,
2911
+ name: "local_shipping",
2912
+ outline: "",
2913
+ color: "#ffffff"
2914
+ })) : M("", !0)
2915
+ ]),
2916
+ e("div", Go, [
2917
+ e("div", {
2918
+ class: Ve([
2919
+ {
2920
+ "bg-fm-color-primary": ie < he.value.length - 1,
2921
+ "bg-white": ie >= he.value.length - 1
2922
+ },
2923
+ "w-[2px] h-full"
2924
+ ])
2925
+ }, null, 2)
2926
+ ])
2927
+ ]),
2928
+ e("div", Wo, [
2929
+ e("div", Yo, [
2930
+ e("div", Qo, _(Q.header), 1),
2931
+ e("div", Xo, _(Q.date), 1)
2932
+ ]),
2933
+ e("div", Zo, [
2934
+ Q.header === "Received" && Q.deliveryOrder && t.purchaseOrder ? (f(), le(vs, {
2935
+ key: 0,
2936
+ deliveryOrder: Q.deliveryOrder,
2937
+ purchaseOrder: t.purchaseOrder,
2938
+ onSubmitted: m[3] || (m[3] = () => {
2939
+ p("update:show", !1), p("submitted");
2940
+ })
2941
+ }, null, 8, ["deliveryOrder", "purchaseOrder"])) : M("", !0)
2942
+ ])
2943
+ ])
2944
+ ]),
2945
+ e("div", Jo, [
2946
+ e("div", en, [
2947
+ e("div", tn, [
2948
+ e("div", {
2949
+ class: Ve([
2950
+ {
2951
+ "bg-fm-color-primary": ie < he.value.length - 1,
2952
+ "bg-white": ie >= he.value.length - 1
2953
+ },
2954
+ "w-[2px] h-full"
2955
+ ])
2956
+ }, null, 2)
2957
+ ])
2958
+ ]),
2959
+ e("div", rn, [
2960
+ I(b, {
2961
+ variant: "outlined",
2962
+ class: "py-12 px-16"
2963
+ }, {
2964
+ default: X(() => [
2965
+ e("div", sn, [
2966
+ (f(!0), x(ue, null, be(Q.info, (ae, re) => (f(), x("div", {
2967
+ key: re,
2968
+ class: "flex flex-col gap-4"
2969
+ }, [
2970
+ e("div", on, _(ae == null ? void 0 : ae.label), 1),
2971
+ e("div", nn, [
2972
+ (f(!0), x(ue, null, be(ae == null ? void 0 : ae.values, (pe, Me) => (f(), x("div", {
2973
+ key: Me,
2974
+ class: "fm-typo-en-body-lg-600"
2975
+ }, [
2976
+ typeof pe == "string" ? (f(), x(ue, { key: 0 }, [
2977
+ De(_(pe), 1)
2978
+ ], 64)) : (f(), le(Tt(pe), { key: 1 }))
2979
+ ]))), 128))
2980
+ ])
2981
+ ]))), 128))
2982
+ ])
2983
+ ]),
2984
+ _: 2
2985
+ }, 1024)
2986
+ ])
2987
+ ])
2988
+ ], 64))), 128))
2989
+ ])) : (f(), x("div", Lo, [
2990
+ I(W),
2991
+ e("div", null, [
2992
+ e("img", {
2993
+ src: v(Lt),
2994
+ alt: "List is empty"
2995
+ }, null, 8, Vo)
2996
+ ]),
2997
+ e("div", Bo, _(v(h)("inventory.transfer.receiveRequest.details.noRecordsFound")), 1),
2998
+ e("div", Uo, _(v(h)("inventory.transfer.receiveRequest.details.trackDeliveryMessage")), 1),
2999
+ I(W),
3000
+ I(W)
3001
+ ]))
3002
+ ])) : M("", !0)
3003
+ ])
3004
+ ];
3005
+ }),
3006
+ "side-sheet-footer": X(() => [
3007
+ e("div", an, [
3008
+ (f(!0), x(ue, null, be(z.value, (E) => (f(), x(ue, null, [
3009
+ v(Ze)[E].available != !1 ? (f(), le(A, {
3010
+ key: E,
3011
+ label: v(h)(v(Ze)[E].translationKey),
3012
+ onClick: (ne) => ce(E),
3013
+ loading: d.value === E,
3014
+ disabled: d.value !== E && C.value,
3015
+ variant: v(Ze)[E].buttonVariant
3016
+ }, null, 8, ["label", "onClick", "loading", "disabled", "variant"])) : M("", !0)
3017
+ ], 64))), 256)),
3018
+ v($).ableToMarkReceived(t.purchaseOrder) && !z.value.includes("completeReceive") ? (f(), le(A, {
3019
+ key: 0,
3020
+ label: v(h)("inventory.transfer.receiveRequest.actions.completeReceive"),
3021
+ onClick: m[4] || (m[4] = (E) => ce("completeReceive")),
3022
+ loading: d.value === "completeReceive",
3023
+ disabled: d.value !== "completeReceive" && C.value
3024
+ }, null, 8, ["label", "loading", "disabled"])) : M("", !0),
3025
+ v($).ableToMarkApproved(t.purchaseOrder) && t.canApprove && !z.value.includes("approveRequest") ? (f(), le(A, {
3026
+ key: 1,
3027
+ label: v(h)("inventory.transfer.approval.actions.approveRequest"),
3028
+ onClick: m[5] || (m[5] = (E) => ce("approveRequest")),
3029
+ loading: d.value === "approveRequest",
3030
+ disabled: d.value !== "approveRequest" && C.value
3031
+ }, null, 8, ["label", "loading", "disabled"])) : M("", !0),
3032
+ v($).ableToCreateFulfillment(t.purchaseOrder, t.poRequest) && o.scope === "approval" ? (f(), le(A, {
3033
+ key: 2,
3034
+ label: v(h)("inventory.transfer.receiveRequest.actions.processRequest"),
3035
+ onClick: m[6] || (m[6] = (E) => ce("processRequest")),
3036
+ loading: d.value === "processRequest",
3037
+ disabled: d.value !== "processRequest" && C.value
3038
+ }, null, 8, ["label", "loading", "disabled"])) : M("", !0),
3039
+ I(A, {
3040
+ label: v(h)("common.close"),
3041
+ variant: "tertiary",
3042
+ onClick: m[7] || (m[7] = (E) => p("update:show", !1))
3043
+ }, null, 8, ["label"])
3044
+ ])
3045
+ ]),
3046
+ _: 1
3047
+ }, 8, ["modelValue", "dismiss-away"]);
3048
+ };
3049
+ }
3050
+ });
3051
+ export {
3052
+ tt as P,
3053
+ Sn as _,
3054
+ gn as a,
3055
+ _n as b,
3056
+ Ht as g,
3057
+ Pe as u
3058
+ };