@feedmepos/mf-inventory-portal 1.0.5-dev → 1.0.6

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 (46) hide show
  1. package/dist/{App-HiQFjdJ-.js → App-CoFxgBe6.js} +1 -1
  2. package/dist/{ApprovalView-CynLDEVc.js → ApprovalView-Cc6FbL1t.js} +2 -2
  3. package/dist/{BindingsDialog-Bnp9wpfo.js → BindingsDialog-DwX1uG0q.js} +2 -2
  4. package/dist/{BindingsPicker-d0mYW8dg.js → BindingsPicker-Ddyllxs3.js} +1 -1
  5. package/dist/{BindingsTable-DTqY2ksc.js → BindingsTable-DJeGXgwh.js} +1 -1
  6. package/dist/{ClosingDraftView-CWioP0pS.js → ClosingDraftView-DUHqCjNZ.js} +2 -2
  7. package/dist/{ClosingTemplateView-BQrAl5fV.js → ClosingTemplateView-DpEXlCuQ.js} +2 -2
  8. package/dist/{DeliveryOrderPrintPreview-BDF8lY7Y.js → DeliveryOrderPrintPreview-BgsMqWD5.js} +1 -1
  9. package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-BN_xp-N6.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-Cuh74MI8.js} +3 -3
  10. package/dist/FmUnitInput.vue_vue_type_script_setup_true_lang-BN3RjN2t.js +338 -0
  11. package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-XhFhN0MD.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-IoATloO4.js} +1 -1
  12. package/dist/{IngredientGroupView-CyjtkSE4.js → IngredientGroupView-mR_Fh2We.js} +1 -1
  13. package/dist/{IngredientsView-DcTIYA5r.js → IngredientsView-DMa2lYUP.js} +3 -3
  14. package/dist/{IntegrationView-Jeh9aw2u.js → IntegrationView-D5uhvmsc.js} +3 -3
  15. package/dist/{InventoryBindingForm-dlNXDnnO.js → InventoryBindingForm-Bkjr3X5G.js} +1 -1
  16. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-BeUd7kC6.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-iZUW6DvO.js} +3 -3
  17. package/dist/{InventoryBindingSummary-BPvSql2a.js → InventoryBindingSummary-DfzOlfQC.js} +1 -1
  18. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DFofvMkD.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DnqRUERc.js} +1 -1
  19. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-CaBtx2ad.js → PremiumBadge.vue_vue_type_script_setup_true_lang-BRKa7jgK.js} +1 -1
  20. package/dist/{PublishView-4Mh9EtfQ.js → PublishView-JP1UeJ0A.js} +2 -2
  21. package/dist/{PurchaseOrderPrintPreview-DFNVxR7Q.js → PurchaseOrderPrintPreview-CiUpBdP6.js} +1 -1
  22. package/dist/{ReceiveRequestView-DGfyfwbS.js → ReceiveRequestView-BMH8q9q8.js} +507 -498
  23. package/dist/{RecipeView-D-M9rodW.js → RecipeView-ChONTHZN.js} +3 -3
  24. package/dist/{StockView-Dmy2nTn9.js → StockView-DnEsw6hb.js} +6 -6
  25. package/dist/{SupplierView-dwayUuSs.js → SupplierView-CsGiwMgL.js} +3 -3
  26. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-dC5nYDyp.js +1746 -0
  27. package/dist/{TransferTemplateView-zl-E8FWk.js → TransferTemplateView-CUzzrvUS.js} +6 -6
  28. package/dist/{UnitView-DlgkMRfA.js → UnitView-Yl8tKI01.js} +3 -3
  29. package/dist/{WarehouseView-Cwm2w_Li.js → WarehouseView-CQrBCdvI.js} +1 -1
  30. package/dist/{app-7jcARtWe.js → app-CvwyJqea.js} +5743 -5602
  31. package/dist/app.js +1 -1
  32. package/dist/{decimal-Df15BvRp.js → decimal-CVFTM-79.js} +1 -1
  33. package/dist/{format-unit-display-CEjqAYMQ.js → format-unit-display-BwsXChSY.js} +2 -2
  34. package/dist/{index-D76OeHWL.js → index-Crb4nQMG.js} +1 -1
  35. package/dist/{index-D1mi5w82.js → index-DzeAemtp.js} +1 -1
  36. package/dist/{stock-C2o7RYsv.js → stock-BCn9m46h.js} +1 -1
  37. package/dist/{supplier-DX4BGHJ3.js → supplier-BNxILiCw.js} +1 -1
  38. package/dist/tsconfig.app.tsbuildinfo +1 -1
  39. package/dist/{use-ingredient-select-dialog-BQq-zLGA.js → use-ingredient-select-dialog-MoaS1fog.js} +1 -1
  40. package/dist/{use-inventory-binding-dialog-NM2fZkBw.js → use-inventory-binding-dialog-9QPChBOp.js} +1 -1
  41. package/dist/views/receive-request/components/transfer-details/FulfillmentForm.vue.d.ts +5 -1
  42. package/dist/views/receive-request/components/transfer-details/usePurchaseOrderFn.d.ts +4 -0
  43. package/dist/{vue-i18n-BRmzzMWS.js → vue-i18n-D47nKBtV.js} +2 -2
  44. package/package.json +1 -1
  45. package/dist/FmUnitInput.vue_vue_type_script_setup_true_lang-BWUrzPyM.js +0 -328
  46. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-DtrWgdXq.js +0 -1723
@@ -1,1723 +0,0 @@
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-7jcARtWe.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-Df15BvRp.js";
4
- import { b as ct, u as ut, f as ze, P as ue } from "./format-unit-display-CEjqAYMQ.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-D1mi5w82.js";
9
- import { _ as yt, F as vt, a as ht } from "./FmUnitInput.vue_vue_type_script_setup_true_lang-BWUrzPyM.js";
10
- const Ne = Ye((f, c) => {
11
- const u = ge();
12
- return {
13
- async readRequests(p) {
14
- const h = p ?? u.currentLocationDBName, l = `${f.inventoryBackendUrl}/${h}/purchase-request`;
15
- return await c.get(l);
16
- },
17
- async getPurchaseOrders({
18
- start: p,
19
- end: h
20
- }) {
21
- const l = u.currentLocationDBName, $ = `${f.inventoryBackendUrl}/${l}/purchase-order`;
22
- return await c.get(`${$}?start=${p}&end=${h}`);
23
- },
24
- async getLatestPurchaseOrderRequest(p) {
25
- const h = u.currentLocationDBName, l = `${f.inventoryBackendUrl}/${h}/purchase-request/find-by-purchase-order-id`;
26
- return await c.get(`${l}/${p}`);
27
- },
28
- async getPurchaseOrderById(p) {
29
- const h = u.currentLocationDBName, l = `${f.inventoryBackendUrl}/${h}/purchase-order`;
30
- return await c.get(`${l}/${p}`);
31
- },
32
- async processPurchaseOrder(p, h) {
33
- const l = u.currentLocationDBName, $ = h || l, k = `${f.inventoryBackendUrl}/${$}/purchase-order/run-operation`;
34
- return await c.put(k, p);
35
- },
36
- async createPurchaseOrder(p) {
37
- const h = u.currentLocationDBName, l = `${f.inventoryBackendUrl}/${h}/purchase-order`;
38
- return await c.post(l, p);
39
- },
40
- async updatePurchaseOrder(p) {
41
- const h = u.currentLocationDBName, l = `${f.inventoryBackendUrl}/${h}/purchase-order`;
42
- return await c.put(l, p);
43
- },
44
- async importFromXilnex(p) {
45
- const h = u.currentLocationDBName, l = `${f.inventoryBackendUrl}/${h}/purchase-order/import-from-xilnex`;
46
- return await c.post(l, p);
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__ */ ((f) => (f.RECEIVE_REQUEST = "receive/request", f.APPROVAL = "approval", f))(ke || {});
108
- const ye = V(), xe = V();
109
- function is(f, c) {
110
- const u = Ae(), p = 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 v = new Date(i.value.startDate), m = new Date(i.value.endDate);
114
- return {
115
- start: Je(v).toISOString(),
116
- end: Xe(m).toISOString()
117
- };
118
- }), g = V(new Array()), w = Ze(), O = V(null);
119
- async function E(v) {
120
- function m(_) {
121
- const D = {
122
- mode: Ie.CREATE,
123
- modelValue: v || 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 && !(v != null && v.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(v) {
153
- const m = {
154
- mode: Ie.UPDATE,
155
- modelValue: Le(v),
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 v = await w.readCurrentLocationLastClosing(!0), m = v == null ? void 0 : v._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((v) => v.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 (f) {
196
- case "receive/request":
197
- return j();
198
- case "approval":
199
- return Z();
200
- }
201
- }
202
- function ee(v, m) {
203
- i.value = {
204
- startDate: v,
205
- endDate: m
206
- }, se();
207
- }
208
- p.watchLocation(async (v) => {
209
- if (!v) {
210
- s.value = [];
211
- return;
212
- }
213
- await se();
214
- });
215
- const W = V(), r = V(Math.random().toString());
216
- async function y(v, m) {
217
- var P, q;
218
- const a = Math.random().toString();
219
- r.value = a;
220
- const _ = f === "receive/request" ? p.currentLocation : m == null ? void 0 : m.to, D = {
221
- poRequest: m,
222
- purchaseOrder: v,
223
- transferTo: _ == null ? void 0 : _.name,
224
- transferToDbName: _ == null ? void 0 : _.dbName,
225
- show: !0,
226
- canResubmit: !1,
227
- canApprove: f === "approval",
228
- "onUpdate:show"(K) {
229
- W.value.show = K;
230
- },
231
- scope: f
232
- };
233
- if (W.value = D, !(m || v.status !== M.enum.REQUESTING)) {
234
- try {
235
- m = (await d.readRequests(
236
- `${v.supplier.internal}_${v.supplier._id}`
237
- )).find((G) => G.purchaseOrderId === v._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(v, m, a, _) {
245
- k.value = !0;
246
- try {
247
- await d.processPurchaseOrder(
248
- {
249
- operation: m,
250
- doc: v,
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 && v.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, v, D);
277
- } finally {
278
- k.value = !1, se();
279
- }
280
- }
281
- async function I(v, 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(v, 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 v = {
313
- show: !0,
314
- "onUpdate:show"(m) {
315
- xe.value.show = m;
316
- }
317
- };
318
- xe.value = v;
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: y,
332
- submitAction: I,
333
- xilnexImportDialogProps: xe,
334
- promptUploadTransferDialog: H
335
- };
336
- }
337
- function bt(f, c) {
338
- return c.reduce(
339
- (p, h) => {
340
- const l = h.received.find(($) => $.sku._id === f._id);
341
- return l && (p = Re(p, l.amount)), p;
342
- },
343
- it.toPrecision(be(0), f.unit.precision)
344
- );
345
- }
346
- function gt(f, c, u, p) {
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: f.supplier.name,
358
- phoneNumber: f.supplier.phoneNumber,
359
- registrationNumber: f.supplier.registrationNumber,
360
- line1: f.supplier.address.line1,
361
- line2: f.supplier.address.line2,
362
- postcode: f.supplier.address.postcode,
363
- city: f.supplier.address.city,
364
- state: f.supplier.address.state,
365
- country: f.supplier.address.country
366
- }, d = f.items.map((w) => {
367
- const { sku: O, measurement: E } = w, U = de(
368
- bt(w.sku, f.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 = f.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: f.seqNumber.toString(),
395
- createdAt: _e(f._id),
396
- ref: f.ref || "",
397
- remark: f.remark || "",
398
- buyer: k,
399
- supplier: e,
400
- items: d,
401
- status: f.status,
402
- deliveryOrders: s
403
- }, o = new URL(window.location.href), g = p && (f.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(f, c) {
449
- ge();
450
- const u = dt(), { t: p } = 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 f === "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, f === "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: () => p("inventory.transfer.table.seqNo"),
520
- enableSorting: !0,
521
- size: 80,
522
- sortUndefined: "last"
523
- },
524
- {
525
- accessorKey: "_id",
526
- header: () => p("inventory.transfer.table.createdAt"),
527
- cell(s) {
528
- return _e(`${s.getValue()}`);
529
- },
530
- enableSorting: !0
531
- },
532
- {
533
- accessorKey: "supplier.name",
534
- header: () => p("inventory.transfer.table.transferFrom"),
535
- enableSorting: !0,
536
- size: 200
537
- },
538
- {
539
- accessorKey: "items.length",
540
- header: () => p("inventory.transfer.table.noOfItems"),
541
- enableSorting: !1,
542
- meta: {
543
- width: "10rem"
544
- }
545
- },
546
- {
547
- accessorKey: "ref",
548
- header: () => p("inventory.transfer.table.reference"),
549
- enableSorting: !1,
550
- size: "auto"
551
- },
552
- {
553
- accessorKey: "status",
554
- header: () => p("inventory.transfer.table.status"),
555
- cell(s) {
556
- const i = p(`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: () => p("inventory.transfer.table.seqNo"),
594
- enableSorting: !0,
595
- size: 80,
596
- sortUndefined: "last"
597
- },
598
- {
599
- accessorKey: "purchaseOrder._id",
600
- header: () => p("inventory.transfer.table.createdAt"),
601
- cell(s) {
602
- return _e(`${s.getValue()}`);
603
- },
604
- enableSorting: !0
605
- },
606
- {
607
- accessorKey: "to.name",
608
- header: () => p("inventory.transfer.table.transferTo"),
609
- enableSorting: !1,
610
- size: 200
611
- },
612
- {
613
- accessorKey: "purchaseOrder.items.length",
614
- header: () => p("inventory.transfer.table.noOfItems"),
615
- enableSorting: !1
616
- },
617
- {
618
- accessorKey: "purchaseOrder.ref",
619
- header: () => p("inventory.transfer.table.reference"),
620
- enableSorting: !1,
621
- size: "auto"
622
- },
623
- {
624
- accessorKey: "purchaseOrder.status",
625
- header: () => p("inventory.transfer.table.status"),
626
- cell(s) {
627
- const i = p(`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(() => f === "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(f) {
698
- const c = f, u = Ke(), p = 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 p.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(f) {
761
- const c = f, u = Ke(), p = 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), p.open({
793
- title: "Sync with NetSuite",
794
- message: "Requested to sync with NetSuite. Please wait a moment.",
795
- type: "success"
796
- });
797
- } catch {
798
- p.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(f) {
832
- const c = f, u = at({
833
- id: "",
834
- createdAt: (/* @__PURE__ */ new Date()).toISOString(),
835
- items: []
836
- }), p = 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: p,
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(f, { emit: c }) {
1016
- const u = f, p = c, h = Ae(), l = De(), $ = je(), k = pt(), { t: e } = He(), d = Y(
1017
- () => {
1018
- var r, y, B, I;
1019
- return ((y = (r = u.purchaseOrder) == null ? void 0 : r.supplier) == null ? void 0 : y.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, y, B;
1023
- return d.value === ue.TRANSFER && ((r = u.transferToDbName) == null ? void 0 : r.startsWith("restaurant")) && ((B = (y = u.purchaseOrder) == null ? void 0 : y.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 y = Qe[r];
1044
- if (!y) {
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 } = y;
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
- const v = await new Promise((m, a) => {
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
- ).delayed(1e3), m("submitted");
1087
- } catch (_) {
1088
- a(_);
1089
- }
1090
- }).onClose(() => m("cancelled"));
1091
- });
1092
- l.open({
1093
- title: "Success",
1094
- message: B,
1095
- type: "success"
1096
- }), console.debug("dialog action result:", v), p("update:show", !1), p("submitted");
1097
- } catch (v) {
1098
- l.open({
1099
- title: "Something went wrong",
1100
- message: "Please try again.",
1101
- type: "error"
1102
- }), console.error("Error when submitting PO operation", r, u.purchaseOrder, v);
1103
- } finally {
1104
- o.value = "", i.value = !1, g.value = !0;
1105
- }
1106
- }
1107
- }
1108
- const Z = Y(() => {
1109
- var r, y;
1110
- return ((r = u.purchaseOrder) == null ? void 0 : r.status) === M.enum.RECEIVING || ((y = u.purchaseOrder) == null ? void 0 : y.status) === M.enum.COMPLETE;
1111
- }), se = Y(() => {
1112
- var v, m, a;
1113
- const B = (((v = u.purchaseOrder) == null ? void 0 : v.deliveryOrder) ?? []).flatMap((_) => _.received ?? []).reduce(
1114
- (_, D) => {
1115
- const P = _[D.sku._id] ?? [];
1116
- return _[D.sku._id] = [...P, D], _;
1117
- },
1118
- {}
1119
- ), I = Object.entries(B).reduce(
1120
- (_, [D, P]) => {
1121
- const q = P.reduce((K, G) => {
1122
- const re = tt(
1123
- K,
1124
- Math.max(K.precision, G.amount.precision)
1125
- );
1126
- return Re(re, G.amount);
1127
- }, be(0));
1128
- return _[D] = q, _;
1129
- },
1130
- {}
1131
- ), H = ((m = u.purchaseOrder) == null ? void 0 : m.items) ?? [];
1132
- for (const _ of H)
1133
- I[a = _.sku._id] ?? (I[a] = be(0));
1134
- return I;
1135
- }), ee = Y(() => {
1136
- var v, m;
1137
- const r = ((v = u.purchaseOrder) == null ? void 0 : v.deliveryOrder) ?? [], y = ((m = u.purchaseOrder) == null ? void 0 : m.deliveryFullfillment) ?? [], B = [
1138
- ...r.map((a) => ({
1139
- createdAt: a.createdAt,
1140
- type: "grn",
1141
- doc: a
1142
- })),
1143
- ...y.map((a) => ({
1144
- createdAt: a.createdAt,
1145
- type: "fulfillment",
1146
- doc: a
1147
- }))
1148
- ];
1149
- B.reverse().sort((a, _) => a.createdAt.localeCompare(_.createdAt));
1150
- function I(a) {
1151
- var P, q, K, G, re, le, ie, ce, T;
1152
- const _ = y.findIndex((A) => A.id === a.fullfillmentId), D = [
1153
- (q = (P = y[_]) == null ? void 0 : P.netSuite) != null && q.refNo ? {
1154
- label: "Fulfillment's ref no. (Netsuite)",
1155
- values: [(G = (K = y[_]) == null ? void 0 : K.netSuite) == null ? void 0 : G.refNo]
1156
- } : null,
1157
- (re = a == null ? void 0 : a.netSuite) != null && re.refNo ? {
1158
- label: "Netsuite ref no.",
1159
- values: [(le = a == null ? void 0 : a.netSuite) == null ? void 0 : le.refNo]
1160
- } : null,
1161
- (ie = a == null ? void 0 : a.netSuite) != null && ie.recordType ? {
1162
- label: "Netsuite Type",
1163
- values: [rt((ce = a == null ? void 0 : a.netSuite) == null ? void 0 : ce.recordType)]
1164
- } : null
1165
- ];
1166
- return {
1167
- header: "Received",
1168
- date: we(new Date(a.createdAt)),
1169
- info: [
1170
- {
1171
- label: "Adjustment date",
1172
- values: [
1173
- a.adjustment ? we(new Date(st(a.adjustment))) : "-"
1174
- ]
1175
- },
1176
- {
1177
- label: "Received by",
1178
- values: [(T = a.createdBy) == null ? void 0 : T.name]
1179
- },
1180
- {
1181
- label: "Received items",
1182
- values: a.received.map((A) => {
1183
- var F;
1184
- return R("div", [
1185
- R(
1186
- "div",
1187
- {
1188
- class: "flex gap-4"
1189
- },
1190
- [
1191
- R(
1192
- "div",
1193
- {
1194
- class: "flex flex-col"
1195
- },
1196
- [
1197
- R(
1198
- "span",
1199
- {
1200
- class: "fm-typo-en-body-lg-800 basis-1/2 shrink-0 grow"
1201
- },
1202
- `${A.sku.name}`
1203
- ),
1204
- R(
1205
- "span",
1206
- {
1207
- class: "fm-typo-en-body-md-400"
1208
- },
1209
- `${A.sku.code} `
1210
- )
1211
- ]
1212
- ),
1213
- R(
1214
- "div",
1215
- {
1216
- class: "ml-auto flex flex-col"
1217
- },
1218
- [
1219
- R(
1220
- "div",
1221
- {
1222
- class: "ml-auto flex gap-1"
1223
- },
1224
- [
1225
- R(
1226
- "span",
1227
- {
1228
- class: "fm-typo-en-body-lg-600 self-end"
1229
- },
1230
- de(A.amount, !1)
1231
- ),
1232
- R(
1233
- "span",
1234
- {
1235
- class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary"
1236
- },
1237
- ((F = A.measurement) == null ? void 0 : F.abbrev) ?? A.sku.unit.abbrev
1238
- )
1239
- ]
1240
- ),
1241
- R(
1242
- "div",
1243
- {
1244
- class: "flex self-end fm-typo-en-body-md-400 text-fm-color-typo-secondary"
1245
- },
1246
- `${A.cost ? `(${ve(A.cost)})` : ""}`
1247
- )
1248
- ]
1249
- )
1250
- ]
1251
- )
1252
- ]);
1253
- })
1254
- },
1255
- a.deliveryOrderNumber ? {
1256
- label: "Delivery order no.",
1257
- values: [a.deliveryOrderNumber]
1258
- } : null,
1259
- a.remark ? {
1260
- label: "Remark",
1261
- values: [a.remark]
1262
- } : null,
1263
- _ > -1 ? {
1264
- label: "Fulfilment's sequence",
1265
- values: [`${_ + 1}`]
1266
- } : null,
1267
- ...D
1268
- ].filter((A) => A)
1269
- };
1270
- }
1271
- function H(a) {
1272
- var D, P;
1273
- const _ = y.findIndex((q) => q.id === a.id);
1274
- return {
1275
- header: "Fulfillment",
1276
- date: we(new Date(a.createdAt)),
1277
- info: [
1278
- {
1279
- label: "Sequence",
1280
- values: [String(_ + 1)]
1281
- },
1282
- {
1283
- label: "Receiveable items",
1284
- values: a.items.map((q) => {
1285
- var K;
1286
- return R("div", [
1287
- R(
1288
- "div",
1289
- {
1290
- class: "flex gap-4"
1291
- },
1292
- [
1293
- R(
1294
- "div",
1295
- {
1296
- class: "flex flex-col"
1297
- },
1298
- [
1299
- R(
1300
- "span",
1301
- {
1302
- class: "fm-typo-en-body-lg-800 basis-1/2 shrink-0 grow"
1303
- },
1304
- `${q.sku.name}`
1305
- ),
1306
- R(
1307
- "span",
1308
- {
1309
- class: "fm-typo-en-body-md-400"
1310
- },
1311
- `${q.sku.code} `
1312
- )
1313
- ]
1314
- ),
1315
- R(
1316
- "div",
1317
- {
1318
- class: "ml-auto flex flex-col"
1319
- },
1320
- [
1321
- R(
1322
- "div",
1323
- {
1324
- class: "ml-auto flex gap-1"
1325
- },
1326
- [
1327
- R(
1328
- "span",
1329
- {
1330
- class: "fm-typo-en-body-lg-600 self-end"
1331
- },
1332
- de(q.amount, !1)
1333
- ),
1334
- R(
1335
- "span",
1336
- {
1337
- class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary"
1338
- },
1339
- ((K = q.measurement) == null ? void 0 : K.abbrev) ?? q.sku.unit.abbrev
1340
- )
1341
- ]
1342
- ),
1343
- R(
1344
- "div",
1345
- {
1346
- class: "flex self-end fm-typo-en-body-md-400 text-fm-color-typo-secondary"
1347
- },
1348
- `${q.cost ? `(${ve(q.cost)})` : ""}`
1349
- )
1350
- ]
1351
- )
1352
- ]
1353
- )
1354
- ]);
1355
- })
1356
- },
1357
- (D = a.netSuite) != null && D.refNo ? {
1358
- label: "Ref no. (Netsuite)",
1359
- values: [(P = a.netSuite) == null ? void 0 : P.refNo]
1360
- } : null
1361
- ].filter((q) => q)
1362
- };
1363
- }
1364
- return B.map((a) => {
1365
- switch (a.type) {
1366
- case "grn":
1367
- return I(a.doc);
1368
- case "fulfillment":
1369
- return H(a.doc);
1370
- }
1371
- });
1372
- }), W = Y(() => {
1373
- var y;
1374
- const r = {
1375
- ...be(0),
1376
- currency: Ue()
1377
- };
1378
- return ((y = u.purchaseOrder) == null ? void 0 : y.items.reduce((B, I) => ({
1379
- ...Re(B, I.totalCost ?? r),
1380
- currency: Ue()
1381
- }), r)) ?? r;
1382
- });
1383
- return (r, y) => {
1384
- var q, K;
1385
- const B = Q("FmButtonGroup"), I = Q("FmChip"), H = Q("FmMenuDivider"), v = Q("FmCard"), m = Q("FmIcon"), a = Q("FmTooltip"), _ = Q("FmSpacer"), D = Q("FmButton"), P = Q("FmSideSheet");
1386
- return b(), X(P, {
1387
- header: n(e)("inventory.transfer.receiveRequest.details.title") + ((q = r.purchaseOrder) != null && q.seqNumber ? ` #${(K = r.purchaseOrder) == null ? void 0 : K.seqNumber}` : ""),
1388
- modelValue: n(O),
1389
- "onUpdate:modelValue": y[9] || (y[9] = (G) => ot(O) ? O.value = G : null),
1390
- "dismiss-away": g.value,
1391
- "close-button": "",
1392
- "max-width": 600
1393
- }, {
1394
- default: me(() => {
1395
- var G, re, le, ie, ce;
1396
- return [
1397
- t("div", Kt, [
1398
- t("div", null, [
1399
- L(B, {
1400
- items: E.value,
1401
- modelValue: U.value,
1402
- "onUpdate:modelValue": y[0] || (y[0] = (T) => U.value = T)
1403
- }, null, 8, ["items", "modelValue"])
1404
- ]),
1405
- U.value.value === "overview" ? (b(), x(oe, { key: 0 }, [
1406
- t("div", null, [
1407
- L(v, {
1408
- variant: "outlined",
1409
- class: "flex flex-col gap-8 px-12 py-16"
1410
- }, {
1411
- default: me(() => {
1412
- var T, A, F, ae, ne, J, Te, qe, $e, Ce, Pe, Ee;
1413
- return [
1414
- t("div", Gt, [
1415
- t("div", zt, S(n(e)("inventory.transfer.receiveRequest.details.requestSummary")), 1),
1416
- t("div", null, [
1417
- L(I, {
1418
- label: n(e)(`inventory.transfer.status.${(T = r.purchaseOrder) == null ? void 0 : T.status}`),
1419
- class: he(`fm-status-badge fm-status-badge-${(F = (A = r.purchaseOrder) == null ? void 0 : A.status) == null ? void 0 : F.toLocaleLowerCase("en-us")}`),
1420
- compact: ""
1421
- }, null, 8, ["label", "class"])
1422
- ])
1423
- ]),
1424
- L(H),
1425
- t("div", Ht, [
1426
- t("div", Qt, [
1427
- t("div", Yt, [
1428
- t("div", Wt, S(n(e)("inventory.transfer.receiveRequest.details.createdAt")), 1)
1429
- ]),
1430
- t("div", Jt, S(n(_e)(((ae = r.purchaseOrder) == null ? void 0 : ae._id) ?? "")), 1)
1431
- ]),
1432
- (ne = r.purchaseOrder) != null && ne.effectiveAt ? (b(), x("div", Xt, [
1433
- t("div", Zt, S(n(e)("inventory.transfer.receiveRequest.details.backdatedTo")), 1),
1434
- t("div", er, S(n(Ve)(new Date((J = r.purchaseOrder) == null ? void 0 : J.effectiveAt))), 1)
1435
- ])) : C("", !0),
1436
- t("div", tr, [
1437
- t("div", rr, S(n(e)("inventory.transfer.receiveRequest.details.type.title")), 1),
1438
- t("div", sr, S(n(e)(
1439
- `inventory.transfer.receiveRequest.details.type.${d.value.toLocaleLowerCase("en-US")}`
1440
- )), 1)
1441
- ]),
1442
- (qe = (Te = r.purchaseOrder) == null ? void 0 : Te.supplier) != null && qe.name ? (b(), x("div", ar, [
1443
- t("div", nr, S(n(e)("inventory.transfer.receiveRequest.details.from")), 1),
1444
- t("div", or, S((Ce = ($e = r.purchaseOrder) == null ? void 0 : $e.supplier) == null ? void 0 : Ce.name), 1)
1445
- ])) : C("", !0),
1446
- r.transferTo ? (b(), x("div", lr, [
1447
- t("div", ir, S(n(e)("inventory.transfer.receiveRequest.details.to")), 1),
1448
- t("div", cr, S(r.transferTo), 1)
1449
- ])) : C("", !0),
1450
- (Pe = r.purchaseOrder) != null && Pe.ref ? (b(), x("div", ur, [
1451
- t("div", dr, S(n(e)("inventory.transfer.receiveRequest.details.reference")), 1),
1452
- t("div", mr, S(r.purchaseOrder.ref), 1)
1453
- ])) : C("", !0),
1454
- (Ee = r.purchaseOrder) != null && Ee.remark ? (b(), x("div", fr, [
1455
- t("div", pr, S(n(e)("inventory.transfer.receiveRequest.details.remark")), 1),
1456
- t("div", yr, S(r.purchaseOrder.remark), 1)
1457
- ])) : C("", !0)
1458
- ])
1459
- ];
1460
- }),
1461
- _: 1
1462
- })
1463
- ]),
1464
- n(k).isNetSuiteEnabled && !s.value ? (b(), x("div", vr, [
1465
- t("div", hr, [
1466
- y[10] || (y[10] = t("span", { class: "flex-1 fm-typo-en-body-lg-600" }, "NetSuite Info", -1)),
1467
- t("div", null, [
1468
- L(Bt, {
1469
- "po-request": r.poRequest,
1470
- "purchase-order": r.purchaseOrder,
1471
- "is-transfer-between-outlets": s.value
1472
- }, null, 8, ["po-request", "purchase-order", "is-transfer-between-outlets"])
1473
- ])
1474
- ]),
1475
- L(H),
1476
- L(Ft, {
1477
- "po-request": r.poRequest,
1478
- "purchase-order": r.purchaseOrder,
1479
- "transfer-type": d.value,
1480
- "transfer-to-db-name": r.transferToDbName,
1481
- "is-transfer-between-outlets": s.value,
1482
- scope: r.scope
1483
- }, null, 8, ["po-request", "purchase-order", "transfer-type", "transfer-to-db-name", "is-transfer-between-outlets", "scope"])
1484
- ])) : C("", !0),
1485
- t("div", br, [
1486
- t("div", gr, [
1487
- t("div", _r, [
1488
- t("span", Sr, [
1489
- Oe(S(Z.value ? n(e)("inventory.transfer.receiveRequest.details.receivedItems") : n(e)("inventory.transfer.receiveRequest.details.requestedItems")) + " ", 1),
1490
- (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, {
1491
- key: 0,
1492
- variant: "rich",
1493
- placement: "top",
1494
- "z-index": 51
1495
- }, {
1496
- content: me(() => {
1497
- var T, A;
1498
- return [
1499
- t("div", wr, [
1500
- (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", {
1501
- class: "flex justify-center align-middle",
1502
- key: ae
1503
- }, [
1504
- L(m, {
1505
- name: "arrow_right",
1506
- size: "sm"
1507
- }),
1508
- Oe(" " + S(`(${F.netSuiteId}) ${F.name}: ${F.reason}`), 1)
1509
- ]))), 128))
1510
- ])
1511
- ];
1512
- }),
1513
- default: me(() => [
1514
- L(m, {
1515
- name: "error",
1516
- color: "#ff2c2c",
1517
- size: "sm"
1518
- })
1519
- ]),
1520
- _: 1
1521
- })) : C("", !0)
1522
- ])
1523
- ]),
1524
- L(H),
1525
- (b(!0), x(oe, null, pe(((ce = r.purchaseOrder) == null ? void 0 : ce.items) ?? [], (T) => {
1526
- var A;
1527
- return b(), x("div", {
1528
- key: T.code,
1529
- class: "flex flex-col"
1530
- }, [
1531
- t("div", Or, [
1532
- t("div", xr, S(T.name), 1),
1533
- t("div", Rr, S(n(de)(se.value[T.sku._id], !1)) + "/" + S(n(ze)(T.quantity, T.sku.unit, T.measurement)), 1)
1534
- ]),
1535
- t("div", kr, [
1536
- t("div", Ar, S(T.code), 1),
1537
- (A = T.totalCost) != null && A.amount && n($).enableTotalCost ? (b(), x("div", Dr, " (" + S(n(ve)(T.totalCost)) + ") ", 1)) : C("", !0)
1538
- ])
1539
- ]);
1540
- }), 128)),
1541
- +n(de)(W.value) ? (b(), x(oe, { key: 0 }, [
1542
- t("div", Nr, [
1543
- L(H)
1544
- ]),
1545
- t("div", Tr, [
1546
- y[11] || (y[11] = t("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, "Total:", -1)),
1547
- t("div", qr, S(n(ve)(W.value)), 1)
1548
- ])
1549
- ], 64)) : C("", !0)
1550
- ])
1551
- ])
1552
- ], 64)) : U.value.value === "deliveryHistory" ? (b(), x("div", $r, [
1553
- ee.value.length ? (b(), x("div", Fr, [
1554
- (b(!0), x(oe, null, pe(ee.value, (T, A) => (b(), x(oe, { key: A }, [
1555
- t("div", Ur, [
1556
- t("div", Br, [
1557
- t("div", Lr, [
1558
- t("div", {
1559
- class: he([
1560
- {
1561
- "bg-fm-color-primary": A !== 0,
1562
- "bg-white": A === 0
1563
- },
1564
- "w-[2px] h-full"
1565
- ])
1566
- }, null, 2)
1567
- ]),
1568
- y[12] || (y[12] = t("div", { class: "h-24 w-24 bg-fm-color-primary rounded-full" }, null, -1)),
1569
- t("div", Mr, [
1570
- t("div", {
1571
- class: he([
1572
- {
1573
- "bg-fm-color-primary": A < ee.value.length - 1,
1574
- "bg-white": A >= ee.value.length - 1
1575
- },
1576
- "w-[2px] h-full"
1577
- ])
1578
- }, null, 2)
1579
- ])
1580
- ]),
1581
- t("div", jr, [
1582
- t("div", Vr, S(T.header), 1),
1583
- t("div", Kr, S(T.date), 1)
1584
- ])
1585
- ]),
1586
- t("div", Gr, [
1587
- t("div", zr, [
1588
- t("div", Hr, [
1589
- t("div", {
1590
- class: he([
1591
- {
1592
- "bg-fm-color-primary": A < ee.value.length - 1,
1593
- "bg-white": A >= ee.value.length - 1
1594
- },
1595
- "w-[2px] h-full"
1596
- ])
1597
- }, null, 2)
1598
- ])
1599
- ]),
1600
- t("div", Qr, [
1601
- L(v, {
1602
- variant: "outlined",
1603
- class: "py-12 px-16"
1604
- }, {
1605
- default: me(() => [
1606
- t("div", Yr, [
1607
- (b(!0), x(oe, null, pe(T.info, (F, ae) => (b(), x("div", {
1608
- key: ae,
1609
- class: "flex flex-col gap-4"
1610
- }, [
1611
- t("div", Wr, S(F == null ? void 0 : F.label), 1),
1612
- t("div", Jr, [
1613
- (b(!0), x(oe, null, pe(F == null ? void 0 : F.values, (ne, J) => (b(), x("div", {
1614
- key: J,
1615
- class: "fm-typo-en-body-lg-600"
1616
- }, [
1617
- typeof ne == "string" ? (b(), x(oe, { key: 0 }, [
1618
- Oe(S(ne), 1)
1619
- ], 64)) : (b(), X(lt(ne), { key: 1 }))
1620
- ]))), 128))
1621
- ])
1622
- ]))), 128))
1623
- ])
1624
- ]),
1625
- _: 2
1626
- }, 1024)
1627
- ])
1628
- ])
1629
- ], 64))), 128))
1630
- ])) : (b(), x("div", Cr, [
1631
- L(_),
1632
- t("div", null, [
1633
- t("img", {
1634
- src: n(mt),
1635
- alt: "List is empty"
1636
- }, null, 8, Pr)
1637
- ]),
1638
- t("div", Er, S(n(e)("inventory.transfer.receiveRequest.details.noRecordsFound")), 1),
1639
- t("div", Ir, S(n(e)("inventory.transfer.receiveRequest.details.trackDeliveryMessage")), 1),
1640
- L(_),
1641
- L(_)
1642
- ]))
1643
- ])) : C("", !0)
1644
- ])
1645
- ];
1646
- }),
1647
- "side-sheet-footer": me(() => {
1648
- var G, re, le, ie, ce, T, A, F, ae, ne;
1649
- return [
1650
- t("div", Xr, [
1651
- ((G = r.purchaseOrder) == null ? void 0 : G.status) === n(M).enum.DRAFT && d.value === n(ue).PURCHASE ? (b(), X(D, {
1652
- key: 0,
1653
- label: n(e)("inventory.transfer.receiveRequest.actions.confirmDraft"),
1654
- onClick: y[1] || (y[1] = (J) => j("confirmDraft")),
1655
- loading: o.value === "confirmDraft",
1656
- disabled: o.value !== "confirmDraft" && i.value
1657
- }, null, 8, ["label", "loading", "disabled"])) : C("", !0),
1658
- ((re = r.purchaseOrder) == null ? void 0 : re.status) === n(M).enum.DRAFT && d.value === n(ue).TRANSFER ? (b(), X(D, {
1659
- key: 1,
1660
- label: n(e)("inventory.transfer.receiveRequest.actions.submitRequest"),
1661
- onClick: y[2] || (y[2] = (J) => j("submitRequest")),
1662
- loading: o.value === "submitRequest",
1663
- disabled: o.value !== "submitRequest" && i.value
1664
- }, null, 8, ["label", "loading", "disabled"])) : C("", !0),
1665
- ((le = r.purchaseOrder) == null ? void 0 : le.status) === n(M).enum.DRAFT ? (b(), X(D, {
1666
- key: 2,
1667
- label: n(e)("inventory.transfer.receiveRequest.actions.cancelDraft"),
1668
- onClick: y[3] || (y[3] = (J) => j("cancelDraft")),
1669
- loading: o.value === "cancelDraft",
1670
- disabled: o.value !== "cancelDraft" && i.value,
1671
- variant: "destructive"
1672
- }, null, 8, ["label", "loading", "disabled"])) : C("", !0),
1673
- ((ie = r.purchaseOrder) == null ? void 0 : ie.status) === n(M).enum.RECEIVING ? (b(), X(D, {
1674
- key: 3,
1675
- label: n(e)("inventory.transfer.receiveRequest.actions.completeReceive"),
1676
- onClick: y[4] || (y[4] = (J) => j("completeReceive")),
1677
- loading: o.value === "completeReceive",
1678
- disabled: o.value !== "completeReceive" && i.value
1679
- }, null, 8, ["label", "loading", "disabled"])) : C("", !0),
1680
- r.canResubmit ? (b(), X(D, {
1681
- key: 4,
1682
- label: n(e)("inventory.transfer.receiveRequest.actions.resubmitRequest"),
1683
- onClick: y[5] || (y[5] = (J) => j("submitRequest")),
1684
- loading: o.value === "submitRequest",
1685
- disabled: o.value !== "submitRequest" && i.value
1686
- }, null, 8, ["label", "loading", "disabled"])) : C("", !0),
1687
- (((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, {
1688
- key: 5,
1689
- label: n(e)("inventory.transfer.approval.actions.approveRequest"),
1690
- onClick: y[6] || (y[6] = (J) => j("approveRequest")),
1691
- loading: o.value === "approveRequest",
1692
- disabled: o.value !== "approveRequest" && i.value
1693
- }, null, 8, ["label", "loading", "disabled"])) : C("", !0),
1694
- ((A = r.purchaseOrder) == null ? void 0 : A.status) === n(M).enum.REQUESTING && r.canApprove ? (b(), X(D, {
1695
- key: 6,
1696
- label: n(e)("inventory.transfer.approval.actions.rejectRequest"),
1697
- onClick: y[7] || (y[7] = (J) => j("rejectRequest")),
1698
- loading: o.value === "rejectRequest",
1699
- disabled: o.value !== "rejectRequest" && i.value,
1700
- variant: "destructive"
1701
- }, null, 8, ["label", "loading", "disabled"])) : C("", !0),
1702
- ((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, {
1703
- key: 7,
1704
- label: n(e)("common.close"),
1705
- variant: "tertiary",
1706
- onClick: y[8] || (y[8] = (J) => p("update:show", !1))
1707
- }, null, 8, ["label"])) : C("", !0)
1708
- ])
1709
- ];
1710
- }),
1711
- _: 1
1712
- }, 8, ["header", "modelValue", "dismiss-away"]);
1713
- };
1714
- }
1715
- });
1716
- export {
1717
- ke as P,
1718
- us as _,
1719
- is as a,
1720
- cs as b,
1721
- bt as g,
1722
- Ne as u
1723
- };