@feedmepos/mf-inventory-portal 0.0.23-dev.5 → 0.0.23-dev.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 (56) hide show
  1. package/dist/{App-FsTwD8n6.js → App-CpS8bz8y.js} +3 -3
  2. package/dist/{ApprovalView-BXPFwc54.js → ApprovalView-BaAkilac.js} +4 -4
  3. package/dist/{BindingsDialog-CHkMKliu.js → BindingsDialog-2XXRx4lk.js} +2 -2
  4. package/dist/{BindingsPicker-D12ragAp.js → BindingsPicker-Dvim94UE.js} +2 -2
  5. package/dist/{BindingsTable-COag_o6k.js → BindingsTable-BqEaLZBo.js} +4 -4
  6. package/dist/{ClosingTemplateView-D8jKBDLt.js → ClosingTemplateView-CuiuCYbL.js} +10 -10
  7. package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-BQtdWZI5.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-CjPxBy2G.js} +4 -4
  8. package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-RNrM3eSt.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-LohSJO6y.js} +2 -2
  9. package/dist/{FmMultiselectDialog-BQVgChfN.js → FmMultiselectDialog-BU399-z7.js} +3 -3
  10. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-DECE_vKa.js → FmUnitInput.vue_vue_type_script_setup_true_lang-BRdc0tSs.js} +2 -2
  11. package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-BUy5XAra.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-r9udN1Fi.js} +1 -1
  12. package/dist/{IngredientGroupView-C5W6TKVb.js → IngredientGroupView-DQDn5HC2.js} +5 -5
  13. package/dist/{IngredientsView-DS18EGAg.js → IngredientsView-BkmK9Km6.js} +9 -9
  14. package/dist/{IntegrationView-BCXq5C_i.js → IntegrationView-y3_6lfnA.js} +4 -4
  15. package/dist/{InventoryBindingForm-D2oUHybU.js → InventoryBindingForm-DvoK_yl7.js} +1 -1
  16. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-Do_WCGzA.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-Bs4QnmyR.js} +5 -5
  17. package/dist/{InventoryBindingSummary-CTzl--8n.js → InventoryBindingSummary-Bsb96T1i.js} +1 -1
  18. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-CrdZrQaL.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-hFoaEGZH.js} +1 -1
  19. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-Ce01_vRB.js → PremiumBadge.vue_vue_type_script_setup_true_lang-Bbn8JMZo.js} +2 -2
  20. package/dist/{PurchaseOrderPrintPreview-C_cUNqE4.js → PurchaseOrderPrintPreview-C-_BepiN.js} +1 -1
  21. package/dist/{ReceiveRequestView-iKUSCnjc.js → ReceiveRequestView-o4YjzcbG.js} +18 -18
  22. package/dist/{RecipeView-9jSzsC2o.js → RecipeView-CKXz1qAw.js} +7 -7
  23. package/dist/{StockView-CkLx8c-q.js → StockView-CyY8hbMg.js} +12 -12
  24. package/dist/{SupplierView-zo_pVaja.js → SupplierView-fwI-Y9WB.js} +2354 -809
  25. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-0CSMleWi.js +1224 -0
  26. package/dist/{TransferTemplateView-CkJs2zmu.js → TransferTemplateView-BUbVs-yI.js} +13 -13
  27. package/dist/{UnitView-DdUCn3QX.js → UnitView-CVbxV_LV.js} +5 -5
  28. package/dist/{WarehouseView-BSKKIUlu.js → WarehouseView-koM4j5Qo.js} +4 -4
  29. package/dist/api/netsuite.d.ts +1 -1
  30. package/dist/{app-CVmmRPWd.js → app-BRONF5GM.js} +755 -748
  31. package/dist/app.js +1 -1
  32. package/dist/{date2-B8or025L.js → date2-BofoGJlV.js} +1 -1
  33. package/dist/{dayjs.min-CIK0S4n6.js → dayjs.min-Byiq9_Vp.js} +1 -1
  34. package/dist/{decimal-DnON7sYp.js → decimal-BB1foOxB.js} +1 -1
  35. package/dist/{defineDeepModel-ZvHrR7G4.js → defineDeepModel-CJyeAQ6C.js} +1 -1
  36. package/dist/{feature-CfLuWtSb.js → feature-CKZ3kQZ2.js} +1 -1
  37. package/dist/{format-time-from-id-DgZIvkJL.js → format-time-from-id-lup3KN2m.js} +1 -1
  38. package/dist/{format-unit-display-BL51mLWH.js → format-unit-display-CG-uhy8Z.js} +8 -8
  39. package/dist/{fuzzy-BrZpb26S.js → fuzzy-B7mmyoPI.js} +1 -1
  40. package/dist/{index-Cgi2fvdH.js → index-B2CSxKjC.js} +1 -1
  41. package/dist/index-BLO8M-w8.js +12087 -0
  42. package/dist/{index-BHBzUsyp.js → index-Dy5RTqm_.js} +1 -1
  43. package/dist/netsuite-rb1w7C1L.js +225 -0
  44. package/dist/{rules-CyLD3MFT.js → rules-CQex0PG8.js} +2 -2
  45. package/dist/stores/integration/netsuite.d.ts +1 -1
  46. package/dist/{supplier-pYrSAyO6.js → supplier-DnK2g2O2.js} +1 -1
  47. package/dist/tsconfig.app.tsbuildinfo +1 -1
  48. package/dist/{use-inventory-binding-dialog-BRfRiwVk.js → use-inventory-binding-dialog-C18erVXs.js} +2 -2
  49. package/dist/{use-template-enabled-locations-2-BFm4_EuV.js → use-template-enabled-locations-2-fcGKuJ6x.js} +2 -2
  50. package/dist/{xlsx-BFsAkixf.js → xlsx-KAYN3sog.js} +1 -1
  51. package/dist/{xlsx.util-ClkX4qFH.js → xlsx.util-_6KMttZO.js} +1 -1
  52. package/package.json +1 -1
  53. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-DVkVNrNG.js +0 -1209
  54. package/dist/index-20AY5LL4.js +0 -10545
  55. package/dist/netsuite-C6f_DtMT.js +0 -224
  56. package/dist/normalizeArguments-DP7Hrren.js +0 -1552
@@ -0,0 +1,1224 @@
1
+ import { ref as U, computed as W, h as ee, defineComponent as Qe, resolveComponent as re, openBlock as v, createBlock as Q, unref as a, isRef as We, withCtx as fe, createElementVNode as r, createElementBlock as D, createVNode as H, createCommentVNode as A, Fragment as se, toDisplayString as y, normalizeClass as pe, renderList as ve } from "vue";
2
+ import { i as Je } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-LohSJO6y.js";
3
+ import { j as Ze, u as he, B as _, D as Xe, c as Ue, v as I, s as Le, r as Ee } from "./app-BRONF5GM.js";
4
+ import { t as et, b as tt, h as je, d as $e } from "./date2-BofoGJlV.js";
5
+ import { F as Ie, D as M, R as N } from "./row-action.enum-PMKMRrZR.js";
6
+ import { useDialog as Be, useSnackbar as Ke, useProxiedModel as rt } from "@feedmepos/ui-library";
7
+ import { p as st, f as be } from "./format-time-from-id-lup3KN2m.js";
8
+ import { u as Ve } from "./feature-CKZ3kQZ2.js";
9
+ import { b as at, u as nt, f as Ge, P as oe } from "./format-unit-display-CG-uhy8Z.js";
10
+ import { c as Fe } from "./TableActionableRow.vue_vue_type_script_setup_true_lang-DlNJ6kRg.js";
11
+ import { i as Re, c as ye, a as ce, k as ot, j as Me } from "./rules-CQex0PG8.js";
12
+ import { F as lt } from "./decimal-BB1foOxB.js";
13
+ import { useI18n as He } from "@feedmepos/mf-common";
14
+ import { E as ct } from "./empty-placeholder-wf6-BWE8.js";
15
+ import { u as it } from "./netsuite-rb1w7C1L.js";
16
+ const ze = Ze((d, b) => {
17
+ const i = he();
18
+ return {
19
+ async readRequests(s) {
20
+ const w = s ?? i.currentLocationDBName, h = `${d.inventoryBackendUrl}/${w}/purchase-request`;
21
+ return await b.get(h);
22
+ },
23
+ async getPurchaseOrders({
24
+ start: s,
25
+ end: w
26
+ }) {
27
+ const h = i.currentLocationDBName, x = `${d.inventoryBackendUrl}/${h}/purchase-order`;
28
+ return await b.get(`${x}?start=${s}&end=${w}`);
29
+ },
30
+ async getPurchaseOrderById(s) {
31
+ const w = i.currentLocationDBName, h = `${d.inventoryBackendUrl}/${w}/purchase-order`;
32
+ return await b.get(`${h}/${s}`);
33
+ },
34
+ async processPurchaseOrder(s, w) {
35
+ const h = i.currentLocationDBName, x = w || h, q = `${d.inventoryBackendUrl}/${x}/purchase-order/run-operation`;
36
+ return await b.put(q, s);
37
+ },
38
+ async createPurchaseOrder(s) {
39
+ const w = i.currentLocationDBName, h = `${d.inventoryBackendUrl}/${w}/purchase-order`;
40
+ return await b.post(h, s);
41
+ },
42
+ async updatePurchaseOrder(s) {
43
+ const w = i.currentLocationDBName, h = `${d.inventoryBackendUrl}/${w}/purchase-order`;
44
+ return await b.put(h, s);
45
+ }
46
+ };
47
+ }), Ye = {
48
+ [_.enum.confirmDraft]: {
49
+ primaryActions: {
50
+ text: "Confirm draft",
51
+ close: !0
52
+ },
53
+ title: "Confirm draft?",
54
+ message: "Purchase order cannot be changed after confirm draft.",
55
+ successMessage: "Purchase order draft has been confirmed"
56
+ },
57
+ [_.enum.cancelDraft]: {
58
+ primaryActions: {
59
+ text: "Cancel draft",
60
+ close: !0,
61
+ variant: "destructive"
62
+ },
63
+ title: "Cancel draft?",
64
+ message: "Purchase order cannot be changed after cancelled draft.",
65
+ successMessage: "Purchase order draft has been cancelled"
66
+ },
67
+ [_.enum.submitRequest]: {
68
+ primaryActions: {
69
+ text: "Submit request",
70
+ close: !0
71
+ },
72
+ title: "Confirm draft?",
73
+ message: "Purchase order cannot be changed after confirm draft.",
74
+ successMessage: "Purchase order draft has been submitted"
75
+ },
76
+ [_.enum.completeReceive]: {
77
+ primaryActions: {
78
+ text: "Mark received",
79
+ close: !0
80
+ },
81
+ title: "Mark as received",
82
+ message: "Purchase order cannot be changed after it has complete receiving.",
83
+ successMessage: "Purchase order has been marked as received"
84
+ },
85
+ [_.enum.approveRequest]: {
86
+ primaryActions: {
87
+ text: "Approve request",
88
+ close: !0
89
+ },
90
+ title: "Approve request?",
91
+ message: "Purchase order will be approved.",
92
+ successMessage: "Purchase order has been approved"
93
+ },
94
+ [_.enum.rejectRequest]: {
95
+ primaryActions: {
96
+ text: "Reject request",
97
+ close: !0,
98
+ variant: "destructive"
99
+ },
100
+ title: "Reject request?",
101
+ message: "Purchase order will be rejected.",
102
+ successMessage: "Purchase order has been rejected"
103
+ }
104
+ }, ue = U();
105
+ function Lr(d, b) {
106
+ const i = Be(), s = he(), w = Ve(), h = at(), x = nt(), q = U(!1), u = Ke(), T = ze(), c = U(new Array()), m = U(
107
+ b != null && b.startDate && (b != null && b.endDate) ? b : Je()
108
+ ), f = W(() => {
109
+ const t = new Date(m.value.startDate), e = new Date(m.value.endDate);
110
+ return {
111
+ start: et(t).toISOString(),
112
+ end: tt(e).toISOString()
113
+ };
114
+ }), p = U(new Array()), V = Xe(), J = U(null);
115
+ async function ie(t) {
116
+ let e;
117
+ if (w.mustUsePoTemplate && !(t != null && t.template) && (e = await h.getTemplateId(), !e))
118
+ return;
119
+ const n = {
120
+ mode: Ie.CREATE,
121
+ modelValue: t || void 0,
122
+ show: !0,
123
+ "onUpdate:show"(o) {
124
+ ue.value.show = o;
125
+ },
126
+ templateId: e,
127
+ lastClosingDate: J.value
128
+ };
129
+ ue.value = n;
130
+ }
131
+ function ge(t) {
132
+ const e = {
133
+ mode: Ie.UPDATE,
134
+ modelValue: Ue(t),
135
+ show: !0,
136
+ "onUpdate:show"(n) {
137
+ ue.value.show = n;
138
+ },
139
+ lastClosingDate: J.value
140
+ };
141
+ ue.value = e;
142
+ }
143
+ async function z() {
144
+ c.value = [], q.value = !0;
145
+ try {
146
+ c.value = await T.getPurchaseOrders(f.value).then((n) => n.sort((o, S) => S._id.localeCompare(o._id)));
147
+ const t = await V.readLastClosing(!0), e = t == null ? void 0 : t._id;
148
+ e && (J.value = st(e)), w.mustUsePoTemplate && await x.fetchTemplates();
149
+ } catch {
150
+ u.open({
151
+ title: "Something went wrong",
152
+ message: "Error at fetching purchase orders",
153
+ type: "error"
154
+ });
155
+ } finally {
156
+ q.value = !1;
157
+ }
158
+ }
159
+ async function _e() {
160
+ p.value = [], q.value = !0;
161
+ try {
162
+ p.value = await T.readRequests().then((t) => t.reverse());
163
+ } catch {
164
+ u.open({
165
+ title: "Something went wrong",
166
+ message: "Error at fetching purchase requests",
167
+ type: "error"
168
+ });
169
+ } finally {
170
+ q.value = !1;
171
+ }
172
+ }
173
+ function ae() {
174
+ switch (d) {
175
+ case "receive/request":
176
+ return z();
177
+ case "approval":
178
+ return _e();
179
+ }
180
+ }
181
+ function we(t, e) {
182
+ m.value = {
183
+ startDate: t,
184
+ endDate: e
185
+ }, ae();
186
+ }
187
+ s.watchLocation(async (t) => {
188
+ if (!t) {
189
+ c.value = [];
190
+ return;
191
+ }
192
+ await ae();
193
+ });
194
+ const Z = U(), Y = U(Math.random().toString());
195
+ async function ne(t, e) {
196
+ var g, P;
197
+ const n = Math.random().toString();
198
+ Y.value = n;
199
+ const o = d === "receive/request" ? s.currentLocation : e == null ? void 0 : e.to, S = {
200
+ poRequest: e,
201
+ purchaseOrder: t,
202
+ transferTo: o == null ? void 0 : o.name,
203
+ transferToDbName: o == null ? void 0 : o.dbName,
204
+ show: !0,
205
+ canResubmit: !1,
206
+ canApprove: d === "approval",
207
+ "onUpdate:show"(l) {
208
+ Z.value.show = l;
209
+ }
210
+ };
211
+ if (Z.value = S, !(e || t.status !== I.enum.REQUESTING)) {
212
+ try {
213
+ e = (await T.readRequests(
214
+ `${t.supplier.internal}_${t.supplier._id}`
215
+ )).find((O) => O.purchaseOrderId === t._id);
216
+ } catch {
217
+ console.error("Error at fetching po request to check");
218
+ }
219
+ n === Y.value && (Z.value.canResubmit = !e, Z.value.transferTo = (g = e == null ? void 0 : e.to) == null ? void 0 : g.name, Z.value.transferToDbName = (P = e == null ? void 0 : e.to) == null ? void 0 : P.dbName);
220
+ }
221
+ }
222
+ async function Se(t, e, n, o) {
223
+ q.value = !0;
224
+ try {
225
+ await T.processPurchaseOrder(
226
+ {
227
+ operation: e,
228
+ doc: t,
229
+ options: (
230
+ // auto receive for supplier to warehouse
231
+ (e === _.enum.confirmDraft || // auto receive for warehouse to warehouse
232
+ e === _.enum.completeReceive) && w.autoReceiveWarehouse ? {
233
+ autoReceive: !0
234
+ } : void 0
235
+ )
236
+ },
237
+ o
238
+ ), await new Promise((P) => setTimeout(P, 1e3));
239
+ const g = he().currentLocationDBName.startsWith("restaurant_");
240
+ e === _.enum.confirmDraft && t.effectiveAt && g ? u.open({
241
+ title: "Success",
242
+ message: `${n}. The backdate will be reflected once your POS has received this change.`,
243
+ type: "success"
244
+ }) : u.open({
245
+ title: "Success",
246
+ message: n,
247
+ type: "success"
248
+ });
249
+ } catch (S) {
250
+ u.open({
251
+ title: "Something went wrong",
252
+ message: "Please try again.",
253
+ type: "error"
254
+ }), console.error("Error when submitting PO operation", e, t, S);
255
+ } finally {
256
+ q.value = !1, ae();
257
+ }
258
+ }
259
+ async function de(t, e, n) {
260
+ const o = Ye[e];
261
+ if (!o) {
262
+ u.open({
263
+ title: "Something went wrong",
264
+ message: `Cannot process order: ${Le(e)}`,
265
+ type: "error"
266
+ });
267
+ return;
268
+ }
269
+ const { successMessage: S, ...g } = o;
270
+ i.open({
271
+ title: g.title,
272
+ message: g.message,
273
+ primaryActions: g.primaryActions
274
+ }).onPrimary(() => {
275
+ Se(t, e, S, n);
276
+ });
277
+ }
278
+ return {
279
+ purchaseOrders: c,
280
+ purchaseRequests: p,
281
+ updateDateRange: we,
282
+ fetchData: ae,
283
+ loading: q,
284
+ transferDialogProps: ue,
285
+ promptCreateTransferDialog: ie,
286
+ promptUpdateTransferDialog: ge,
287
+ transferDetailsProps: Z,
288
+ promptShowTransferDetails: ne,
289
+ submitAction: de
290
+ };
291
+ }
292
+ function ut(d, b) {
293
+ return b.reduce(
294
+ (s, w) => {
295
+ const h = w.received.find((x) => x.sku._id === d._id);
296
+ return h && (s = Re(s, h.amount)), s;
297
+ },
298
+ lt.toPrecision(ye(0), d.unit.precision)
299
+ );
300
+ }
301
+ function dt(d, b) {
302
+ const { name: i, address: s, regNo: w } = b.doc.profile, h = {
303
+ name: i,
304
+ registrationNumber: w,
305
+ line1: s == null ? void 0 : s.line1,
306
+ line2: s == null ? void 0 : s.line2,
307
+ postcode: s == null ? void 0 : s.postcode,
308
+ city: s == null ? void 0 : s.city,
309
+ state: s == null ? void 0 : s.state,
310
+ country: s == null ? void 0 : s.country
311
+ }, x = {
312
+ name: d.supplier.name,
313
+ registrationNumber: d.supplier.registrationNumber,
314
+ line1: d.supplier.address.line1,
315
+ line2: d.supplier.address.line2,
316
+ postcode: d.supplier.address.postcode,
317
+ city: d.supplier.address.city,
318
+ state: d.supplier.address.state,
319
+ country: d.supplier.address.country
320
+ }, q = d.items.map((m) => {
321
+ const { sku: f, measurement: p } = m, V = ce(
322
+ ut(m.sku, d.deliveryOrder || []),
323
+ !1
324
+ );
325
+ return {
326
+ code: f.code,
327
+ description: f.name,
328
+ quantity: Ge(m.quantity, f.unit, m.measurement),
329
+ unit: (p == null ? void 0 : p.abbrev) || f.unit.abbrev,
330
+ received: V
331
+ };
332
+ }), u = d.deliveryOrder.map((m) => ({
333
+ createdAt: je(new Date(m.createdAt)),
334
+ ref: m.deliveryOrderNumber,
335
+ remark: m.remark || "",
336
+ items: m.received.map((f) => {
337
+ var p;
338
+ return {
339
+ code: f.sku.code,
340
+ description: f.sku.name,
341
+ quantity: ce(f.amount),
342
+ unit: ((p = f.measurement) == null ? void 0 : p.abbrev) || f.sku.unit.abbrev
343
+ };
344
+ })
345
+ })), T = {
346
+ orderNumber: d.seqNumber.toString(),
347
+ createdAt: be(d._id),
348
+ ref: d.ref || "",
349
+ remark: d.remark || "",
350
+ buyer: h,
351
+ supplier: x,
352
+ items: q,
353
+ status: d.status,
354
+ deliveryOrders: u
355
+ }, c = new URL(window.location.href);
356
+ c.pathname = c.hostname.includes("inventory.feedme") ? "/receive-request/print-preview" : "/inventory/receive-request/print-preview", c.searchParams.append("data", JSON.stringify(T)), window.open(c.href, "_blank", "noreferrer");
357
+ }
358
+ const le = {
359
+ submitRequest: {
360
+ translationKey: "inventory.transfer.receiveRequest.actions.submitRequest",
361
+ color: "text-fm-color-typo-primary",
362
+ value: _.enum.submitRequest
363
+ },
364
+ confirmDraft: {
365
+ translationKey: "inventory.transfer.receiveRequest.actions.confirmDraft",
366
+ color: "text-fm-color-typo-primary",
367
+ value: _.enum.confirmDraft
368
+ },
369
+ cancelDraft: {
370
+ translationKey: "inventory.transfer.receiveRequest.actions.cancelDraft",
371
+ color: "text-fm-color-typo-error",
372
+ value: _.enum.cancelDraft
373
+ },
374
+ approveRequest: {
375
+ translationKey: "inventory.transfer.receiveRequest.actions.approveRequest",
376
+ color: "text-fm-color-typo-primary",
377
+ value: _.enum.approveRequest
378
+ },
379
+ rejectRequest: {
380
+ translationKey: "inventory.transfer.receiveRequest.actions.rejectRequest",
381
+ color: "text-fm-color-typo-error",
382
+ value: _.enum.rejectRequest
383
+ },
384
+ processRequest: {
385
+ translationKey: "inventory.transfer.receiveRequest.actions.processRequest",
386
+ color: "text-fm-color-typo-primary",
387
+ value: _.enum.processRequest
388
+ },
389
+ receiveStock: {
390
+ translationKey: "inventory.transfer.receiveRequest.actions.receiveStock",
391
+ color: "text-fm-color-typo-primary",
392
+ value: _.enum.receiveStock
393
+ },
394
+ completeReceive: {
395
+ translationKey: "inventory.transfer.receiveRequest.actions.completeReceive",
396
+ color: "text-fm-color-typo-primary",
397
+ value: _.enum.completeReceive
398
+ }
399
+ };
400
+ function jr(d, b) {
401
+ const i = he(), { t: s } = He();
402
+ function w(c) {
403
+ switch (c.status) {
404
+ case "DRAFT":
405
+ return [
406
+ M[N.Update],
407
+ M[N.Details],
408
+ c.supplier.internal === "restaurant" || c.supplier.internal === "warehouse" ? le[_.enum.submitRequest] : le[_.enum.confirmDraft],
409
+ le[_.enum.cancelDraft],
410
+ M[N.Print]
411
+ ];
412
+ case "RECEIVING":
413
+ return [
414
+ le[_.enum.completeReceive],
415
+ M[N.Details],
416
+ M[N.Print]
417
+ ];
418
+ case "REQUESTING":
419
+ return d === "receive/request" ? [M[N.Details], M[N.Print]] : [
420
+ le[_.enum.approveRequest],
421
+ le[_.enum.rejectRequest],
422
+ M[N.Details],
423
+ M[N.Print]
424
+ ];
425
+ case "PROCESSING":
426
+ return [M[N.Details], M[N.Print]];
427
+ case "COMPLETE":
428
+ case "CANCEL":
429
+ default:
430
+ return [M[N.Details], M[N.Print]];
431
+ }
432
+ }
433
+ function h(c) {
434
+ return Object.values(_.enum).includes(c);
435
+ }
436
+ async function x(c, m, f) {
437
+ var V, J;
438
+ const p = Ue(m);
439
+ if (c === N.Print) {
440
+ dt(p, i.currentLocation);
441
+ return;
442
+ }
443
+ if (c === N.Details) {
444
+ b.promptShowTransferDetails(p, f);
445
+ return;
446
+ }
447
+ if (c === N.Update) {
448
+ (V = b.promptUpdateTransferDialog) == null || V.call(b, p);
449
+ return;
450
+ }
451
+ if (h(c)) {
452
+ b.submitAction(m, c, (J = f == null ? void 0 : f.to) == null ? void 0 : J.dbName);
453
+ return;
454
+ }
455
+ }
456
+ function q() {
457
+ return [
458
+ {
459
+ accessorKey: "seqNumber",
460
+ header: () => s("inventory.transfer.table.seqNo"),
461
+ enableSorting: !0,
462
+ size: 80,
463
+ sortUndefined: "last"
464
+ },
465
+ {
466
+ accessorKey: "_id",
467
+ header: () => s("inventory.transfer.table.createdAt"),
468
+ cell(c) {
469
+ return be(`${c.getValue()}`);
470
+ },
471
+ enableSorting: !0
472
+ },
473
+ {
474
+ accessorKey: "supplier.name",
475
+ header: () => s("inventory.transfer.table.transferFrom"),
476
+ enableSorting: !0,
477
+ size: 200
478
+ },
479
+ {
480
+ accessorKey: "items.length",
481
+ header: () => s("inventory.transfer.table.noOfItems"),
482
+ enableSorting: !1,
483
+ meta: {
484
+ width: "10rem"
485
+ }
486
+ },
487
+ {
488
+ accessorKey: "ref",
489
+ header: () => s("inventory.transfer.table.reference"),
490
+ enableSorting: !1,
491
+ size: "auto"
492
+ },
493
+ {
494
+ accessorKey: "status",
495
+ header: () => s("inventory.transfer.table.status"),
496
+ cell(c) {
497
+ const m = s(`inventory.transfer.status.${c.getValue() ?? ""}`), f = `${c.getValue() ?? ""}`.toLocaleLowerCase("en-us");
498
+ return ee(
499
+ "div",
500
+ {
501
+ class: "flex"
502
+ },
503
+ ee(
504
+ "div",
505
+ {
506
+ class: `fm-status-badge fm-status-badge-${f}`
507
+ },
508
+ m
509
+ )
510
+ );
511
+ },
512
+ enableSorting: !0,
513
+ size: 200
514
+ },
515
+ {
516
+ id: "action",
517
+ cell(c) {
518
+ const m = c.row.original, f = w(m);
519
+ return Fe(f, (p) => x(p, m));
520
+ },
521
+ enableSorting: !1,
522
+ size: 40,
523
+ meta: {
524
+ cellClass: "",
525
+ headerClass: ""
526
+ }
527
+ }
528
+ ];
529
+ }
530
+ function u() {
531
+ return [
532
+ {
533
+ accessorKey: "purchaseOrder.seqNumber",
534
+ header: () => s("inventory.transfer.table.seqNo"),
535
+ enableSorting: !0,
536
+ size: 80,
537
+ sortUndefined: "last"
538
+ },
539
+ {
540
+ accessorKey: "purchaseOrder._id",
541
+ header: () => s("inventory.transfer.table.createdAt"),
542
+ cell(c) {
543
+ return be(`${c.getValue()}`);
544
+ },
545
+ enableSorting: !0
546
+ },
547
+ {
548
+ accessorKey: "to.name",
549
+ header: () => s("inventory.transfer.table.transferTo"),
550
+ enableSorting: !1,
551
+ size: 200
552
+ },
553
+ {
554
+ accessorKey: "purchaseOrder.items.length",
555
+ header: () => s("inventory.transfer.table.noOfItems"),
556
+ enableSorting: !1
557
+ },
558
+ {
559
+ accessorKey: "purchaseOrder.ref",
560
+ header: () => s("inventory.transfer.table.reference"),
561
+ enableSorting: !1,
562
+ size: "auto"
563
+ },
564
+ {
565
+ accessorKey: "purchaseOrder.status",
566
+ header: () => s("inventory.transfer.table.status"),
567
+ cell(c) {
568
+ const m = s(`inventory.transfer.status.${c.getValue() ?? ""}`), f = `${c.getValue() ?? ""}`.toLocaleLowerCase("en-us");
569
+ return ee(
570
+ "div",
571
+ {
572
+ class: "flex"
573
+ },
574
+ ee(
575
+ "div",
576
+ {
577
+ class: `fm-status-badge fm-status-badge-${f}`
578
+ },
579
+ m
580
+ )
581
+ );
582
+ },
583
+ enableSorting: !0
584
+ },
585
+ {
586
+ id: "action",
587
+ cell(c) {
588
+ const m = c.row.original, f = m.purchaseOrder ? w(m.purchaseOrder) : [];
589
+ return Fe(
590
+ f,
591
+ (p) => m.purchaseOrder ? x(p, m.purchaseOrder, m) : void 0
592
+ );
593
+ },
594
+ enableSorting: !1,
595
+ size: 40,
596
+ meta: {
597
+ cellClass: "",
598
+ headerClass: ""
599
+ }
600
+ }
601
+ ];
602
+ }
603
+ const T = W(() => d === "receive/request" ? q() : u());
604
+ return {
605
+ get columnDefs() {
606
+ return T.value;
607
+ }
608
+ };
609
+ }
610
+ const mt = { class: "flex flex-col gap-16 w-full h-full" }, ft = {
611
+ key: 0,
612
+ class: "flex flex-row-reverse"
613
+ }, pt = { class: "flex justify-between" }, vt = { class: "fm-typo-en-body-lg-600" }, yt = { class: "flex flex-col gap-8" }, ht = { class: "flex flex-col gap-4" }, bt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, gt = { class: "flex gap-1" }, _t = { class: "fm-typo-en-body-lg-600" }, wt = {
614
+ key: 0,
615
+ class: "flex flex-col gap-4"
616
+ }, St = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Rt = { class: "fm-typo-en-body-lg-600" }, Ot = { class: "flex flex-col gap-4" }, Dt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, kt = { class: "fm-typo-en-body-lg-600" }, At = {
617
+ key: 1,
618
+ class: "flex flex-col gap-4"
619
+ }, xt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, qt = { class: "fm-typo-en-body-lg-600" }, Nt = {
620
+ key: 2,
621
+ class: "flex flex-col gap-4"
622
+ }, Pt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ct = { class: "fm-typo-en-body-lg-600" }, Tt = {
623
+ key: 3,
624
+ class: "flex flex-col gap-4"
625
+ }, Et = { class: "fm-typo-en-body-lg-600" }, $t = {
626
+ key: 4,
627
+ class: "flex flex-col gap-4"
628
+ }, It = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ft = { class: "fm-typo-en-body-lg-600" }, Mt = {
629
+ key: 5,
630
+ class: "flex flex-col gap-4"
631
+ }, Ut = { class: "fm-typo-en-body-lg-600" }, Lt = {
632
+ key: 6,
633
+ class: "flex flex-col gap-4"
634
+ }, jt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Bt = { class: "fm-typo-en-body-lg-600" }, Kt = {
635
+ key: 7,
636
+ class: "flex flex-col gap-4"
637
+ }, Vt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Gt = { class: "fm-typo-en-body-lg-600" }, Ht = { class: "border border-fm-color-neutral-gray-200 fm-corner-radius-lg p-16" }, zt = { class: "flex flex-col gap-8" }, Yt = { class: "fm-typo-en-body-lg-600" }, Qt = { class: "flex w-full gap-4" }, Wt = { class: "basis-1/2 shrink-0 grow fm-typo-en-body-lg-400 line-clamp-2" }, Jt = { class: "fm-typo-en-body-lg-600 line-clamp-2" }, Zt = { class: "flex w-full gap-4 fm-typo-en-body-sm-400" }, Xt = { class: "grow fm-typo-en-body-lg-400 text-fm-color-typo-secondary line-clamp-1" }, er = {
638
+ key: 0,
639
+ class: "line-clamp-1 fm-typo-en-body-lg-400 text-fm-color-typo-secondary"
640
+ }, tr = { class: "py-8" }, rr = { class: "flex justify-end gap-4 items-center" }, sr = { class: "fm-typo-en-body-lg-600" }, ar = {
641
+ key: 2,
642
+ class: "flex-1 xs:w-screen xs:max-w-full"
643
+ }, nr = {
644
+ key: 0,
645
+ class: "flex flex-col items-center gap-8 h-full"
646
+ }, or = ["src"], lr = { class: "fm-typo-en-body-lg-600" }, cr = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary px-16" }, ir = {
647
+ key: 1,
648
+ class: "px-4 flex flex-col"
649
+ }, ur = { class: "flex gap-12 content-stretch" }, dr = {
650
+ class: "flex flex-col w-24",
651
+ name: "circles"
652
+ }, mr = { class: "flex-1 flex flex-col items-center" }, fr = { class: "flex-1 flex flex-col items-center" }, pr = {
653
+ class: "py-12 flex flex-col gap-4",
654
+ name: "received-at header"
655
+ }, vr = { class: "fm-typo-en-body-lg-400" }, yr = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, hr = { class: "flex gap-12 content-stretch" }, br = {
656
+ class: "flex flex-col w-24",
657
+ name: "circles"
658
+ }, gr = { class: "flex-1 flex flex-col items-center" }, _r = {
659
+ class: "py-12 flex flex-col gap-4 flex-1",
660
+ name: "delivery details"
661
+ }, wr = { class: "flex flex-col gap-8" }, Sr = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, Rr = { class: "flex flex-col gap-4" }, Or = { class: "flex gap-8 xs:flex-col" }, Br = /* @__PURE__ */ Qe({
662
+ __name: "TransferDetails",
663
+ props: {
664
+ poRequest: {},
665
+ purchaseOrder: {},
666
+ transferTo: {},
667
+ transferToDbName: {},
668
+ show: { type: Boolean },
669
+ canResubmit: { type: Boolean },
670
+ canApprove: { type: Boolean }
671
+ },
672
+ emits: ["update:show", "submitted"],
673
+ setup(d, { emit: b }) {
674
+ const i = d, s = b, w = Be(), h = Ke(), x = it(), q = Ve(), { t: u } = He(), T = W(
675
+ () => {
676
+ var t, e, n, o;
677
+ return ((e = (t = i.purchaseOrder) == null ? void 0 : t.supplier) == null ? void 0 : e.internal) === "restaurant" || ((o = (n = i.purchaseOrder) == null ? void 0 : n.supplier) == null ? void 0 : o.internal) === "warehouse" ? oe.TRANSFER : oe.PURCHASE;
678
+ }
679
+ ), c = [
680
+ {
681
+ label: u("inventory.transfer.receiveRequest.details.overview"),
682
+ value: "overview"
683
+ },
684
+ {
685
+ label: u("inventory.transfer.receiveRequest.details.deliveryHistory"),
686
+ value: "deliveryHistory"
687
+ }
688
+ ], m = U(c[0]), f = U(!1), p = U(""), V = U(!0), J = ze(), ie = rt(i, "show");
689
+ async function ge(t, e, n) {
690
+ p.value = e, f.value = !0, V.value = !1;
691
+ try {
692
+ await J.processPurchaseOrder(
693
+ {
694
+ operation: e,
695
+ doc: t,
696
+ options: (
697
+ // auto receive for supplier to warehouse
698
+ (e === _.enum.confirmDraft || // auto receive for warehouse to warehouse
699
+ e === _.enum.completeReceive) && q.autoReceiveWarehouse ? {
700
+ autoReceive: !0
701
+ } : void 0
702
+ )
703
+ },
704
+ i.transferToDbName
705
+ ), await new Promise((o) => setTimeout(o, 1e3)), h.open({
706
+ title: "Success",
707
+ message: n,
708
+ type: "success"
709
+ }), s("update:show", !1), s("submitted");
710
+ } catch (o) {
711
+ h.open({
712
+ title: "Something went wrong",
713
+ message: "Please try again.",
714
+ type: "error"
715
+ }), console.error("Error when submitting PO operation", e, t, o);
716
+ } finally {
717
+ p.value = "", f.value = !1, V.value = !0;
718
+ }
719
+ }
720
+ async function z(t) {
721
+ const e = Ye[t];
722
+ if (!e) {
723
+ h.open({
724
+ title: "Something went wrong",
725
+ message: `Cannot process order: ${Le(t)}`,
726
+ type: "error"
727
+ });
728
+ return;
729
+ }
730
+ const { successMessage: n, ...o } = e;
731
+ w.open({
732
+ title: o.title,
733
+ message: o.message,
734
+ primaryActions: o.primaryActions
735
+ }).onPrimary(() => {
736
+ i.purchaseOrder && ge(i.purchaseOrder, t, n);
737
+ });
738
+ }
739
+ const _e = W(() => {
740
+ var t, e;
741
+ return ((t = i.purchaseOrder) == null ? void 0 : t.status) === I.enum.RECEIVING || ((e = i.purchaseOrder) == null ? void 0 : e.status) === I.enum.COMPLETE;
742
+ }), ae = W(
743
+ () => {
744
+ var t, e, n, o, S, g;
745
+ return x.getLocationSubsidiary(
746
+ ((n = (e = (t = i.purchaseOrder) == null ? void 0 : t.netSuite) == null ? void 0 : e.subsidiary) == null ? void 0 : n.id) || ((g = (S = (o = i.poRequest) == null ? void 0 : o.netSuite) == null ? void 0 : S.subsidiary) == null ? void 0 : g.id)
747
+ ).fullName;
748
+ }
749
+ ), we = W(() => {
750
+ var t, e, n, o, S, g;
751
+ return (e = (t = i.purchaseOrder) == null ? void 0 : t.deliveryFullfillment) != null && e.length && ((o = (n = i.purchaseOrder) == null ? void 0 : n.deliveryFullfillment) == null ? void 0 : o.length) > 0 ? (g = (S = i.purchaseOrder) == null ? void 0 : S.deliveryFullfillment) == null ? void 0 : g.map((P) => {
752
+ var l;
753
+ return (l = P.netSuite) == null ? void 0 : l.refNo;
754
+ }).join(", ") : "-";
755
+ }), Z = W(() => {
756
+ var g, P, l;
757
+ const n = (((g = i.purchaseOrder) == null ? void 0 : g.deliveryOrder) ?? []).flatMap((O) => O.received ?? []).reduce(
758
+ (O, E) => {
759
+ const L = O[E.sku._id] ?? [];
760
+ return O[E.sku._id] = [...L, E], O;
761
+ },
762
+ {}
763
+ ), o = Object.entries(n).reduce(
764
+ (O, [E, L]) => {
765
+ const k = L.reduce(($, K) => {
766
+ const G = ot(
767
+ $,
768
+ Math.max($.precision, K.amount.precision)
769
+ );
770
+ return Re(G, K.amount);
771
+ }, ye(0));
772
+ return O[E] = k, O;
773
+ },
774
+ {}
775
+ ), S = ((P = i.purchaseOrder) == null ? void 0 : P.items) ?? [];
776
+ for (const O of S)
777
+ o[l = O.sku._id] ?? (o[l] = ye(0));
778
+ return o;
779
+ }), Y = W(() => {
780
+ var g, P;
781
+ const t = ((g = i.purchaseOrder) == null ? void 0 : g.deliveryOrder) ?? [], e = ((P = i.purchaseOrder) == null ? void 0 : P.deliveryFullfillment) ?? [], n = [
782
+ ...t.map((l) => ({
783
+ createdAt: l.createdAt,
784
+ type: "grn",
785
+ doc: l
786
+ })),
787
+ ...e.map((l) => ({
788
+ createdAt: l.createdAt,
789
+ type: "fulfillment",
790
+ doc: l
791
+ }))
792
+ ];
793
+ n.reverse().sort((l, O) => l.createdAt.localeCompare(O.createdAt));
794
+ function o(l) {
795
+ var E, L, k, $, K, G, X;
796
+ const O = e.findIndex((C) => C.id === l.fullfillmentId);
797
+ return {
798
+ header: "Received",
799
+ date: $e(new Date(l.createdAt)),
800
+ info: [
801
+ {
802
+ label: "Received by",
803
+ values: [(E = l.createdBy) == null ? void 0 : E.name]
804
+ },
805
+ {
806
+ label: "Received items",
807
+ values: l.received.map((C) => {
808
+ var R;
809
+ return `(${C.sku.code}) ${C.sku.name}: ${ce(C.amount, !1)} ${((R = C.measurement) == null ? void 0 : R.abbrev) ?? C.sku.unit.abbrev}`;
810
+ })
811
+ },
812
+ l.deliveryOrderNumber ? {
813
+ label: "Delivery order no.",
814
+ values: [l.deliveryOrderNumber]
815
+ } : null,
816
+ l.remark ? {
817
+ label: "Remark",
818
+ values: [l.remark]
819
+ } : null,
820
+ O > -1 ? {
821
+ label: "Fulfilment's sequence",
822
+ values: [`${O + 1}`]
823
+ } : null,
824
+ (k = (L = e[O]) == null ? void 0 : L.netSuite) != null && k.refNo ? {
825
+ label: "Fulfillment's ref no. (Netsuite)",
826
+ values: [(K = ($ = e[O]) == null ? void 0 : $.netSuite) == null ? void 0 : K.refNo]
827
+ } : null,
828
+ (G = l == null ? void 0 : l.netSuite) != null && G.refNo ? {
829
+ label: "Item receipt (Netsuite)",
830
+ values: [(X = l == null ? void 0 : l.netSuite) == null ? void 0 : X.refNo]
831
+ } : null
832
+ ].filter((C) => C)
833
+ };
834
+ }
835
+ function S(l) {
836
+ var E, L;
837
+ const O = e.findIndex((k) => k.id === l.id);
838
+ return {
839
+ header: "Fulfillment",
840
+ date: $e(new Date(l.createdAt)),
841
+ info: [
842
+ {
843
+ label: "Sequence",
844
+ values: [String(O + 1)]
845
+ },
846
+ {
847
+ label: "Receiveable items",
848
+ values: l.items.map((k) => {
849
+ var $;
850
+ return `(${k.sku.code}) ${k.sku.name}: ${ce(k.amount, !1)} ${(($ = k.measurement) == null ? void 0 : $.abbrev) ?? k.sku.unit.abbrev}`;
851
+ })
852
+ },
853
+ (E = l.netSuite) != null && E.refNo ? {
854
+ label: "Ref no. (Netsuite)",
855
+ values: [(L = l.netSuite) == null ? void 0 : L.refNo]
856
+ } : null
857
+ ].filter((k) => k)
858
+ };
859
+ }
860
+ return n.map((l) => {
861
+ switch (l.type) {
862
+ case "grn":
863
+ return o(l.doc);
864
+ case "fulfillment":
865
+ return S(l.doc);
866
+ }
867
+ });
868
+ }), ne = U(!1);
869
+ async function Se() {
870
+ ne.value || w.open({
871
+ title: "Sync with NetSuite",
872
+ contentComponent: ee("div", [
873
+ ee("p", "Are you sure you want to sync now?"),
874
+ ee("br"),
875
+ ee(
876
+ "p",
877
+ { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" },
878
+ "Please wait a moment before syncing manually to avoid unnecessary actions."
879
+ )
880
+ ]),
881
+ primaryActions: {
882
+ text: "Sync",
883
+ close: !0,
884
+ variant: "destructive"
885
+ },
886
+ secondaryActions: { text: "Not now", close: !0 }
887
+ }).onPrimary(async () => {
888
+ var t, e, n, o;
889
+ try {
890
+ ne.value = !0;
891
+ const S = (e = (t = i.purchaseOrder) == null ? void 0 : t.netSuite) != null && e.id ? "purchaseOrder" : "purchaseOrderRequest", g = S === "purchaseOrder" ? (n = i.purchaseOrder) == null ? void 0 : n._id : (o = i.poRequest) == null ? void 0 : o._id;
892
+ if (!g) {
893
+ h.open({
894
+ title: "Error",
895
+ message: "Invalid sync ID",
896
+ type: "error"
897
+ });
898
+ return;
899
+ }
900
+ await x.syncTransferOrder(S, g), h.open({
901
+ title: "Sync with NetSuite",
902
+ message: "Requested to sync with NetSuite. Please wait a moment.",
903
+ type: "success"
904
+ });
905
+ } catch {
906
+ h.open({
907
+ title: "Error",
908
+ message: "Failed to sync with NetSuite",
909
+ type: "error"
910
+ });
911
+ }
912
+ setTimeout(() => {
913
+ ne.value = !1;
914
+ }, 3e3);
915
+ });
916
+ }
917
+ const de = W(() => {
918
+ var e;
919
+ const t = {
920
+ ...ye(0),
921
+ currency: Ee()
922
+ };
923
+ return ((e = i.purchaseOrder) == null ? void 0 : e.items.reduce((n, o) => ({
924
+ ...Re(n, o.totalCost ?? t),
925
+ currency: Ee()
926
+ }), t)) ?? t;
927
+ });
928
+ return (t, e) => {
929
+ var E, L;
930
+ const n = re("FmButton"), o = re("FmButtonGroup"), S = re("FmChip"), g = re("FmMenuDivider"), P = re("FmCard"), l = re("FmSpacer"), O = re("FmSideSheet");
931
+ return v(), Q(O, {
932
+ header: a(u)("inventory.transfer.receiveRequest.details.title") + ((E = t.purchaseOrder) != null && E.seqNumber ? ` #${(L = t.purchaseOrder) == null ? void 0 : L.seqNumber}` : ""),
933
+ modelValue: a(ie),
934
+ "onUpdate:modelValue": e[9] || (e[9] = (k) => We(ie) ? ie.value = k : null),
935
+ "dismiss-away": V.value,
936
+ "close-button": "",
937
+ "max-width": 600
938
+ }, {
939
+ default: fe(() => {
940
+ var k, $, K, G, X, C;
941
+ return [
942
+ r("div", mt, [
943
+ a(x).isEnabled && i.purchaseOrder != null && ((k = t.purchaseOrder) == null ? void 0 : k.status) !== a(I).enum.DRAFT && ((K = ($ = t.purchaseOrder) == null ? void 0 : $.netSuite) != null && K.id || (X = (G = t.poRequest) == null ? void 0 : G.netSuite) != null && X.id) ? (v(), D("div", ft, [
944
+ H(n, {
945
+ "prepend-icon": "sync",
946
+ variant: "primary",
947
+ label: "NetSuite",
948
+ loading: ne.value,
949
+ onClick: Se
950
+ }, null, 8, ["loading"])
951
+ ])) : A("", !0),
952
+ r("div", null, [
953
+ H(o, {
954
+ items: c,
955
+ modelValue: m.value,
956
+ "onUpdate:modelValue": e[0] || (e[0] = (R) => m.value = R)
957
+ }, null, 8, ["modelValue"])
958
+ ]),
959
+ m.value.value === "overview" ? (v(), D(se, { key: 1 }, [
960
+ r("div", null, [
961
+ H(P, {
962
+ variant: "outlined",
963
+ class: "flex flex-col gap-8 px-12 py-16"
964
+ }, {
965
+ default: fe(() => {
966
+ var R, F, j, te, B, me, Oe, De, ke, Ae, xe, qe, Ne, Pe, Ce, Te;
967
+ return [
968
+ r("div", pt, [
969
+ r("div", vt, y(a(u)("inventory.transfer.receiveRequest.details.requestSummary")), 1),
970
+ r("div", null, [
971
+ H(S, {
972
+ label: a(u)(`inventory.transfer.status.${(R = t.purchaseOrder) == null ? void 0 : R.status}`),
973
+ class: pe(`fm-status-badge fm-status-badge-${(j = (F = t.purchaseOrder) == null ? void 0 : F.status) == null ? void 0 : j.toLocaleLowerCase("en-us")}`),
974
+ compact: ""
975
+ }, null, 8, ["label", "class"])
976
+ ])
977
+ ]),
978
+ H(g),
979
+ r("div", yt, [
980
+ r("div", ht, [
981
+ r("div", bt, [
982
+ r("div", gt, y(a(u)("inventory.transfer.receiveRequest.details.createdAt")), 1)
983
+ ]),
984
+ r("div", _t, y(a(be)(((te = t.purchaseOrder) == null ? void 0 : te._id) ?? "")), 1)
985
+ ]),
986
+ (B = t.purchaseOrder) != null && B.effectiveAt ? (v(), D("div", wt, [
987
+ r("div", St, y(a(u)("inventory.transfer.receiveRequest.details.backdatedTo")), 1),
988
+ r("div", Rt, y(a(je)(new Date((me = t.purchaseOrder) == null ? void 0 : me.effectiveAt))), 1)
989
+ ])) : A("", !0),
990
+ r("div", Ot, [
991
+ r("div", Dt, y(a(u)("inventory.transfer.receiveRequest.details.type.title")), 1),
992
+ r("div", kt, y(a(u)(
993
+ `inventory.transfer.receiveRequest.details.type.${T.value.toLocaleLowerCase("en-US")}`
994
+ )), 1)
995
+ ]),
996
+ (De = (Oe = t.purchaseOrder) == null ? void 0 : Oe.supplier) != null && De.name ? (v(), D("div", At, [
997
+ r("div", xt, y(a(u)("inventory.transfer.receiveRequest.details.from")), 1),
998
+ r("div", qt, y((Ae = (ke = t.purchaseOrder) == null ? void 0 : ke.supplier) == null ? void 0 : Ae.name), 1)
999
+ ])) : A("", !0),
1000
+ t.transferTo ? (v(), D("div", Nt, [
1001
+ r("div", Pt, y(a(u)("inventory.transfer.receiveRequest.details.to")), 1),
1002
+ r("div", Ct, y(t.transferTo), 1)
1003
+ ])) : A("", !0),
1004
+ a(x).isEnabled ? (v(), D("div", Tt, [
1005
+ e[10] || (e[10] = r("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " NetSuite subsidiary ", -1)),
1006
+ r("div", Et, y(ae.value || "-"), 1)
1007
+ ])) : A("", !0),
1008
+ a(x).isEnabled ? (v(), D("div", $t, [
1009
+ r("div", It, " NetSuite " + y(T.value === a(oe).PURCHASE ? "Purchase order" : "Transfer order") + " ID ", 1),
1010
+ r("div", Ft, y(((qe = (xe = t.purchaseOrder) == null ? void 0 : xe.netSuite) == null ? void 0 : qe.id) || ((Pe = (Ne = t.poRequest) == null ? void 0 : Ne.netSuite) == null ? void 0 : Pe.id) || "-"), 1)
1011
+ ])) : A("", !0),
1012
+ a(x).isEnabled && T.value === a(oe).TRANSFER ? (v(), D("div", Mt, [
1013
+ e[11] || (e[11] = r("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " NetSuite fulfillment IDs ", -1)),
1014
+ r("div", Ut, y(we.value), 1)
1015
+ ])) : A("", !0),
1016
+ (Ce = t.purchaseOrder) != null && Ce.ref ? (v(), D("div", Lt, [
1017
+ r("div", jt, y(a(u)("inventory.transfer.receiveRequest.details.reference")), 1),
1018
+ r("div", Bt, y(t.purchaseOrder.ref), 1)
1019
+ ])) : A("", !0),
1020
+ (Te = t.purchaseOrder) != null && Te.remark ? (v(), D("div", Kt, [
1021
+ r("div", Vt, y(a(u)("inventory.transfer.receiveRequest.details.remark")), 1),
1022
+ r("div", Gt, y(t.purchaseOrder.remark), 1)
1023
+ ])) : A("", !0)
1024
+ ])
1025
+ ];
1026
+ }),
1027
+ _: 1
1028
+ })
1029
+ ]),
1030
+ r("div", Ht, [
1031
+ r("div", zt, [
1032
+ r("div", Yt, y(_e.value ? a(u)("inventory.transfer.receiveRequest.details.receivedItems") : a(u)("inventory.transfer.receiveRequest.details.requestedItems")), 1),
1033
+ (v(!0), D(se, null, ve(((C = t.purchaseOrder) == null ? void 0 : C.items) ?? [], (R) => (v(), D("div", {
1034
+ key: R.code,
1035
+ class: "flex flex-col"
1036
+ }, [
1037
+ r("div", Qt, [
1038
+ r("div", Wt, y(R.name), 1),
1039
+ r("div", Jt, y(a(ce)(Z.value[R.sku._id], !1)) + "/" + y(a(Ge)(R.quantity, R.sku.unit, R.measurement)), 1)
1040
+ ]),
1041
+ r("div", Zt, [
1042
+ r("div", Xt, y(R.code), 1),
1043
+ R.totalCost && a(q).enableTotalCost ? (v(), D("div", er, " (" + y(a(Me)(R.totalCost)) + ") ", 1)) : A("", !0)
1044
+ ])
1045
+ ]))), 128)),
1046
+ +a(ce)(de.value) ? (v(), D(se, { key: 0 }, [
1047
+ r("div", tr, [
1048
+ H(g)
1049
+ ]),
1050
+ r("div", rr, [
1051
+ e[12] || (e[12] = r("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, "Total:", -1)),
1052
+ r("div", sr, y(a(Me)(de.value)), 1)
1053
+ ])
1054
+ ], 64)) : A("", !0)
1055
+ ])
1056
+ ])
1057
+ ], 64)) : A("", !0),
1058
+ m.value.value === "deliveryHistory" ? (v(), D("div", ar, [
1059
+ Y.value.length ? (v(), D("div", ir, [
1060
+ (v(!0), D(se, null, ve(Y.value, (R, F) => (v(), D(se, { key: F }, [
1061
+ r("div", ur, [
1062
+ r("div", dr, [
1063
+ r("div", mr, [
1064
+ r("div", {
1065
+ class: pe([
1066
+ {
1067
+ "bg-fm-color-primary": F !== 0,
1068
+ "bg-white": F === 0
1069
+ },
1070
+ "w-[2px] h-full"
1071
+ ])
1072
+ }, null, 2)
1073
+ ]),
1074
+ e[13] || (e[13] = r("div", { class: "h-24 w-24 bg-fm-color-primary rounded-full" }, null, -1)),
1075
+ r("div", fr, [
1076
+ r("div", {
1077
+ class: pe([
1078
+ {
1079
+ "bg-fm-color-primary": F < Y.value.length - 1,
1080
+ "bg-white": F >= Y.value.length - 1
1081
+ },
1082
+ "w-[2px] h-full"
1083
+ ])
1084
+ }, null, 2)
1085
+ ])
1086
+ ]),
1087
+ r("div", pr, [
1088
+ r("div", vr, y(R.header), 1),
1089
+ r("div", yr, y(R.date), 1)
1090
+ ])
1091
+ ]),
1092
+ r("div", hr, [
1093
+ r("div", br, [
1094
+ r("div", gr, [
1095
+ r("div", {
1096
+ class: pe([
1097
+ {
1098
+ "bg-fm-color-primary": F < Y.value.length - 1,
1099
+ "bg-white": F >= Y.value.length - 1
1100
+ },
1101
+ "w-[2px] h-full"
1102
+ ])
1103
+ }, null, 2)
1104
+ ])
1105
+ ]),
1106
+ r("div", _r, [
1107
+ H(P, {
1108
+ variant: "outlined",
1109
+ class: "py-12 px-16"
1110
+ }, {
1111
+ default: fe(() => [
1112
+ r("div", wr, [
1113
+ (v(!0), D(se, null, ve(R.info, (j, te) => (v(), D("div", {
1114
+ key: te,
1115
+ class: "flex flex-col gap-4"
1116
+ }, [
1117
+ r("div", Sr, y(j == null ? void 0 : j.label), 1),
1118
+ r("div", Rr, [
1119
+ (v(!0), D(se, null, ve(j == null ? void 0 : j.values, (B, me) => (v(), D("div", {
1120
+ key: me,
1121
+ class: "fm-typo-en-body-lg-600"
1122
+ }, y(B), 1))), 128))
1123
+ ])
1124
+ ]))), 128))
1125
+ ])
1126
+ ]),
1127
+ _: 2
1128
+ }, 1024)
1129
+ ])
1130
+ ])
1131
+ ], 64))), 128))
1132
+ ])) : (v(), D("div", nr, [
1133
+ H(l),
1134
+ r("div", null, [
1135
+ r("img", {
1136
+ src: a(ct),
1137
+ alt: "List is empty"
1138
+ }, null, 8, or)
1139
+ ]),
1140
+ r("div", lr, y(a(u)("inventory.transfer.receiveRequest.details.noRecordsFound")), 1),
1141
+ r("div", cr, y(a(u)("inventory.transfer.receiveRequest.details.trackDeliveryMessage")), 1),
1142
+ H(l),
1143
+ H(l)
1144
+ ]))
1145
+ ])) : A("", !0)
1146
+ ])
1147
+ ];
1148
+ }),
1149
+ "side-sheet-footer": fe(() => {
1150
+ var k, $, K, G, X, C, R, F, j, te;
1151
+ return [
1152
+ r("div", Or, [
1153
+ ((k = t.purchaseOrder) == null ? void 0 : k.status) === a(I).enum.DRAFT && T.value === a(oe).PURCHASE ? (v(), Q(n, {
1154
+ key: 0,
1155
+ label: a(u)("inventory.transfer.receiveRequest.actions.confirmDraft"),
1156
+ onClick: e[1] || (e[1] = (B) => z("confirmDraft")),
1157
+ loading: p.value === "confirmDraft",
1158
+ disabled: p.value !== "confirmDraft" && f.value
1159
+ }, null, 8, ["label", "loading", "disabled"])) : A("", !0),
1160
+ (($ = t.purchaseOrder) == null ? void 0 : $.status) === a(I).enum.DRAFT && T.value === a(oe).TRANSFER ? (v(), Q(n, {
1161
+ key: 1,
1162
+ label: a(u)("inventory.transfer.receiveRequest.actions.submitRequest"),
1163
+ onClick: e[2] || (e[2] = (B) => z("submitRequest")),
1164
+ loading: p.value === "submitRequest",
1165
+ disabled: p.value !== "submitRequest" && f.value
1166
+ }, null, 8, ["label", "loading", "disabled"])) : A("", !0),
1167
+ ((K = t.purchaseOrder) == null ? void 0 : K.status) === a(I).enum.DRAFT ? (v(), Q(n, {
1168
+ key: 2,
1169
+ label: a(u)("inventory.transfer.receiveRequest.actions.cancelDraft"),
1170
+ onClick: e[3] || (e[3] = (B) => z("cancelDraft")),
1171
+ loading: p.value === "cancelDraft",
1172
+ disabled: p.value !== "cancelDraft" && f.value,
1173
+ variant: "destructive"
1174
+ }, null, 8, ["label", "loading", "disabled"])) : A("", !0),
1175
+ ((G = t.purchaseOrder) == null ? void 0 : G.status) === a(I).enum.RECEIVING ? (v(), Q(n, {
1176
+ key: 3,
1177
+ label: a(u)("inventory.transfer.receiveRequest.actions.completeReceive"),
1178
+ onClick: e[4] || (e[4] = (B) => z("completeReceive")),
1179
+ loading: p.value === "completeReceive",
1180
+ disabled: p.value !== "completeReceive" && f.value
1181
+ }, null, 8, ["label", "loading", "disabled"])) : A("", !0),
1182
+ t.canResubmit ? (v(), Q(n, {
1183
+ key: 4,
1184
+ label: a(u)("inventory.transfer.receiveRequest.actions.resubmitRequest"),
1185
+ onClick: e[5] || (e[5] = (B) => z("submitRequest")),
1186
+ loading: p.value === "submitRequest",
1187
+ disabled: p.value !== "submitRequest" && f.value
1188
+ }, null, 8, ["label", "loading", "disabled"])) : A("", !0),
1189
+ (((X = t.purchaseOrder) == null ? void 0 : X.status) === a(I).enum.REQUESTING || ((C = t.purchaseOrder) == null ? void 0 : C.status) === a(I).enum.PROCESSING) && t.canApprove ? (v(), Q(n, {
1190
+ key: 5,
1191
+ label: a(u)("inventory.transfer.approval.actions.approveRequest"),
1192
+ onClick: e[6] || (e[6] = (B) => z("approveRequest")),
1193
+ loading: p.value === "approveRequest",
1194
+ disabled: p.value !== "approveRequest" && f.value
1195
+ }, null, 8, ["label", "loading", "disabled"])) : A("", !0),
1196
+ ((R = t.purchaseOrder) == null ? void 0 : R.status) === a(I).enum.REQUESTING && t.canApprove ? (v(), Q(n, {
1197
+ key: 6,
1198
+ label: a(u)("inventory.transfer.approval.actions.rejectRequest"),
1199
+ onClick: e[7] || (e[7] = (B) => z("rejectRequest")),
1200
+ loading: p.value === "rejectRequest",
1201
+ disabled: p.value !== "rejectRequest" && f.value,
1202
+ variant: "destructive"
1203
+ }, null, 8, ["label", "loading", "disabled"])) : A("", !0),
1204
+ ((F = t.purchaseOrder) == null ? void 0 : F.status) !== a(I).enum.COMPLETE && ((j = t.purchaseOrder) == null ? void 0 : j.status) !== a(I).enum.CANCEL && (((te = t.purchaseOrder) == null ? void 0 : te.status) !== a(I).enum.REQUESTING || t.canApprove) ? (v(), Q(n, {
1205
+ key: 7,
1206
+ label: a(u)("common.close"),
1207
+ variant: "tertiary",
1208
+ onClick: e[8] || (e[8] = (B) => s("update:show", !1))
1209
+ }, null, 8, ["label"])) : A("", !0)
1210
+ ])
1211
+ ];
1212
+ }),
1213
+ _: 1
1214
+ }, 8, ["header", "modelValue", "dismiss-away"]);
1215
+ };
1216
+ }
1217
+ });
1218
+ export {
1219
+ Br as _,
1220
+ Lr as a,
1221
+ jr as b,
1222
+ ut as g,
1223
+ ze as u
1224
+ };