@feedmepos/mf-inventory-portal 0.0.26-dev.7 → 0.0.27-dev.4

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