@feedmepos/mf-inventory-portal 0.0.22-dev.19 → 0.0.22-dev.20

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 (33) hide show
  1. package/dist/{ApprovalView-DD_lqQyg.js → ApprovalView-DrlB6QmP.js} +4 -4
  2. package/dist/{BindingsDialog-CZk3Vdnx.js → BindingsDialog-BIsmJCcX.js} +1 -1
  3. package/dist/{BindingsPicker-C1AH5FdB.js → BindingsPicker-_ozgYyoy.js} +1 -1
  4. package/dist/{BindingsTable-CBX6Q6AL.js → BindingsTable-BdaYKCU2.js} +1 -1
  5. package/dist/{ClosingTemplateView-DIwPDy2t.js → ClosingTemplateView-BNOjDN_Y.js} +5 -5
  6. package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-W06VyJ31.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-BhZWV_te.js} +1 -1
  7. package/dist/{IngredientsView-BC8YIErg.js → IngredientsView-OWTMcqVt.js} +3 -3
  8. package/dist/{IntegrationView-DENEIkTh.js → IntegrationView-DqQV8FK2.js} +2 -2
  9. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-CgnLlcQZ.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-eag0ZVsT.js} +1 -1
  10. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-DNPwbLEZ.js → PremiumBadge.vue_vue_type_script_setup_true_lang-DC3nWhhu.js} +1 -1
  11. package/dist/{PurchaseOrderPrintPreview-CpBmXdD0.js → PurchaseOrderPrintPreview-BPJbSiQf.js} +1 -1
  12. package/dist/{ReceiveRequestView-C81Zf3zY.js → ReceiveRequestView-6qYBopZt.js} +6 -6
  13. package/dist/{RecipeView-TFZgTDUh.js → RecipeView-BKGDLAhE.js} +3 -3
  14. package/dist/{StockView-bgZTOV6i.js → StockView-DV-VVzVM.js} +6 -6
  15. package/dist/{SupplierView-BYyQxw0t.js → SupplierView-BebHHZhB.js} +3 -3
  16. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-dzrP2NYq.js +843 -0
  17. package/dist/{TransferDialog.vue_vue_type_script_setup_true_lang-uSVIE5_5.js → TransferDialog.vue_vue_type_script_setup_true_lang-CCn6h2lC.js} +5 -5
  18. package/dist/{TransferTemplateView-BFhNAi7K.js → TransferTemplateView-DyG0qZqJ.js} +8 -8
  19. package/dist/{UnitView-DX5CnVUR.js → UnitView-sesi0MIU.js} +4 -4
  20. package/dist/{WarehouseView-THb6FBXI.js → WarehouseView-zZCKnbbu.js} +2 -2
  21. package/dist/{app-BWF5tQwd.js → app-b4xcXRca.js} +300 -300
  22. package/dist/app.js +1 -1
  23. package/dist/{decimal-BFC0XDk1.js → decimal-DgBMe5Xq.js} +1 -1
  24. package/dist/{defineDeepModel-KSKvsqlu.js → defineDeepModel-DR6GH0Fd.js} +1 -1
  25. package/dist/{format-time-from-id-DtUlqmuq.js → format-time-from-id-Bsbw1i2y.js} +1 -1
  26. package/dist/{id-to-date-D1NcrKrG.js → id-to-date-Bh9HmRRo.js} +1 -1
  27. package/dist/{purchase-order-transaction-type-C-dx5pQr.js → purchase-order-transaction-type-CFy_l7aK.js} +8 -5
  28. package/dist/{supplier-CUzOSQb7.js → supplier-DZuEtW07.js} +1 -1
  29. package/dist/{use-template-enabled-locations-2-CTYd9dEQ.js → use-template-enabled-locations-2-BjtiCP8N.js} +1 -1
  30. package/dist/{xlsx-Do087aDY.js → xlsx-B3eLI4Oa.js} +1 -1
  31. package/dist/{xlsx.util-DD3Ate6Q.js → xlsx.util-CmEykrDA.js} +2 -2
  32. package/package.json +1 -1
  33. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-CY6OZxCv.js +0 -776
@@ -0,0 +1,843 @@
1
+ import { f as ie } from "./format-time-from-id-Bsbw1i2y.js";
2
+ import { computed as W, h as ue, defineComponent as Ne, ref as re, resolveComponent as H, openBlock as u, createBlock as $, unref as r, isRef as Te, withCtx as ae, createElementVNode as e, createVNode as U, createElementBlock as y, Fragment as Q, toDisplayString as d, normalizeClass as ne, createCommentVNode as O, renderList as oe } from "vue";
3
+ import { c as Oe } from "./TableActionableRow.vue_vue_type_script_setup_true_lang-DlNJ6kRg.js";
4
+ import { D as x, R as b } from "./row-action.enum-PMKMRrZR.js";
5
+ import { D as ke, m as de, a as te, al as qe, am as k, c as Pe, j as Fe, ag as A, J as $e, H as Ie, aj as je, b as Me, x as Ue, T as xe } from "./app-b4xcXRca.js";
6
+ import { F as Ke } from "./decimal-DgBMe5Xq.js";
7
+ import { f as Se, P as le, d as Le, e as Ve } from "./purchase-order-transaction-type-CFy_l7aK.js";
8
+ import { components as Be, useDialog as Ge, useSnackbar as He, useProxiedModel as ze } from "@feedmepos/ui-library";
9
+ import { useI18n as De } from "@feedmepos/mf-common";
10
+ import { E as Ye } from "./empty-placeholder-wf6-BWE8.js";
11
+ function Qe(f, C) {
12
+ return C.reduce(
13
+ (a, I) => {
14
+ const T = I.received.find((P) => P.sku._id === f._id);
15
+ return T && (a = ke(a, T.amount)), a;
16
+ },
17
+ Ke.toPrecision(de(0), f.unit.precision)
18
+ );
19
+ }
20
+ function Je(f, C) {
21
+ const { name: h, address: a, regNo: I } = C.doc.profile, T = {
22
+ name: h,
23
+ registrationNumber: I,
24
+ line1: a == null ? void 0 : a.line1,
25
+ line2: a == null ? void 0 : a.line2,
26
+ postcode: a == null ? void 0 : a.postcode,
27
+ city: a == null ? void 0 : a.city,
28
+ state: a == null ? void 0 : a.state,
29
+ country: a == null ? void 0 : a.country
30
+ }, P = {
31
+ name: f.supplier.name,
32
+ registrationNumber: f.supplier.registrationNumber,
33
+ line1: f.supplier.address.line1,
34
+ line2: f.supplier.address.line2,
35
+ postcode: f.supplier.address.postcode,
36
+ city: f.supplier.address.city,
37
+ state: f.supplier.address.state,
38
+ country: f.supplier.address.country
39
+ }, z = f.items.map((i) => {
40
+ const { sku: l, measurement: c } = i, j = te(
41
+ Qe(i.sku, f.deliveryOrder || []),
42
+ !1
43
+ );
44
+ return {
45
+ code: l.code,
46
+ description: l.name,
47
+ quantity: Se(i.quantity, l.unit, i.measurement),
48
+ unit: (c == null ? void 0 : c.abbrev) || l.unit.abbrev,
49
+ received: j
50
+ };
51
+ }), m = f.deliveryOrder.map((i) => ({
52
+ createdAt: qe(new Date(i.createdAt)),
53
+ ref: i.deliveryOrderNumber,
54
+ remark: i.remark || "",
55
+ items: i.received.map((l) => {
56
+ var c;
57
+ return {
58
+ code: l.sku.code,
59
+ description: l.sku.name,
60
+ quantity: te(l.amount),
61
+ unit: ((c = l.measurement) == null ? void 0 : c.abbrev) || l.sku.unit.abbrev
62
+ };
63
+ })
64
+ })), K = {
65
+ orderNumber: f.seqNumber.toString(),
66
+ createdAt: ie(f._id),
67
+ ref: f.ref || "",
68
+ remark: f.remark || "",
69
+ buyer: T,
70
+ supplier: P,
71
+ items: z,
72
+ status: f.status,
73
+ deliveryOrders: m
74
+ }, o = new URL(window.location.href);
75
+ o.pathname = o.hostname.includes("inventory.feedme") ? "/receive-request/print-preview" : "/inventory/receive-request/print-preview", o.searchParams.append("data", JSON.stringify(K)), window.open(o.href, "_blank", "noreferrer");
76
+ }
77
+ const J = {
78
+ submitRequest: {
79
+ translationKey: "inventory.transfer.receiveRequest.actions.submitRequest",
80
+ color: "text-fm-color-typo-primary",
81
+ value: k.enum.submitRequest
82
+ },
83
+ confirmDraft: {
84
+ translationKey: "inventory.transfer.receiveRequest.actions.confirmDraft",
85
+ color: "text-fm-color-typo-primary",
86
+ value: k.enum.confirmDraft
87
+ },
88
+ cancelDraft: {
89
+ translationKey: "inventory.transfer.receiveRequest.actions.cancelDraft",
90
+ color: "text-fm-color-typo-error",
91
+ value: k.enum.cancelDraft
92
+ },
93
+ approveRequest: {
94
+ translationKey: "inventory.transfer.receiveRequest.actions.approveRequest",
95
+ color: "text-fm-color-typo-primary",
96
+ value: k.enum.approveRequest
97
+ },
98
+ rejectRequest: {
99
+ translationKey: "inventory.transfer.receiveRequest.actions.rejectRequest",
100
+ color: "text-fm-color-typo-error",
101
+ value: k.enum.rejectRequest
102
+ },
103
+ processRequest: {
104
+ translationKey: "inventory.transfer.receiveRequest.actions.processRequest",
105
+ color: "text-fm-color-typo-primary",
106
+ value: k.enum.processRequest
107
+ },
108
+ receiveStock: {
109
+ translationKey: "inventory.transfer.receiveRequest.actions.receiveStock",
110
+ color: "text-fm-color-typo-primary",
111
+ value: k.enum.receiveStock
112
+ },
113
+ completeReceive: {
114
+ translationKey: "inventory.transfer.receiveRequest.actions.completeReceive",
115
+ color: "text-fm-color-typo-primary",
116
+ value: k.enum.completeReceive
117
+ }
118
+ };
119
+ function ps(f, C) {
120
+ const h = Fe(), { t: a } = De();
121
+ function I(o) {
122
+ switch (o.status) {
123
+ case "DRAFT":
124
+ return [
125
+ o.supplier.internal === "restaurant" || o.supplier.internal === "warehouse" ? J[k.enum.submitRequest] : J[k.enum.confirmDraft],
126
+ J[k.enum.cancelDraft],
127
+ x[b.Update],
128
+ x[b.Details],
129
+ x[b.Print]
130
+ ];
131
+ case "RECEIVING":
132
+ return [
133
+ J[k.enum.completeReceive],
134
+ x[b.Update],
135
+ x[b.Details],
136
+ x[b.Print]
137
+ ];
138
+ case "REQUESTING":
139
+ return f === "receive/request" ? [
140
+ x[b.Update],
141
+ x[b.Details],
142
+ x[b.Print]
143
+ ] : [
144
+ J[k.enum.approveRequest],
145
+ J[k.enum.rejectRequest],
146
+ x[b.Details],
147
+ x[b.Print]
148
+ ];
149
+ case "PROCESSING":
150
+ return [x[b.Details], x[b.Print]];
151
+ case "COMPLETE":
152
+ return [
153
+ x[b.Update],
154
+ x[b.Details],
155
+ x[b.Print]
156
+ ];
157
+ case "CANCEL":
158
+ default:
159
+ return [x[b.Details], x[b.Print]];
160
+ }
161
+ }
162
+ function T(o) {
163
+ return Object.values(k.enum).includes(o);
164
+ }
165
+ async function P(o, i, l) {
166
+ var j, se;
167
+ const c = Pe(i);
168
+ if (o === b.Print) {
169
+ Je(c, h.currentLocation);
170
+ return;
171
+ }
172
+ if (o === b.Details) {
173
+ C.promptShowTransferDetails(c, l);
174
+ return;
175
+ }
176
+ if (o === b.Update) {
177
+ (j = C.promptUpdateTransferDialog) == null || j.call(C, c);
178
+ return;
179
+ }
180
+ if (T(o)) {
181
+ C.submitAction(i, o, (se = l == null ? void 0 : l.to) == null ? void 0 : se.dbName);
182
+ return;
183
+ }
184
+ }
185
+ function z() {
186
+ return [
187
+ {
188
+ accessorKey: "seqNumber",
189
+ header: () => a("inventory.transfer.table.seqNo"),
190
+ enableSorting: !0,
191
+ size: 80,
192
+ sortUndefined: "last"
193
+ },
194
+ {
195
+ accessorKey: "_id",
196
+ header: () => a("inventory.transfer.table.createdAt"),
197
+ cell(o) {
198
+ return ie(`${o.getValue()}`);
199
+ },
200
+ enableSorting: !0
201
+ },
202
+ {
203
+ accessorKey: "supplier.name",
204
+ header: () => a("inventory.transfer.table.transferFrom"),
205
+ enableSorting: !0,
206
+ size: 200
207
+ },
208
+ {
209
+ accessorKey: "items.length",
210
+ header: () => a("inventory.transfer.table.noOfItems"),
211
+ enableSorting: !1,
212
+ meta: {
213
+ width: "10rem"
214
+ }
215
+ },
216
+ {
217
+ accessorKey: "ref",
218
+ header: () => a("inventory.transfer.table.reference"),
219
+ enableSorting: !1,
220
+ size: "auto"
221
+ },
222
+ {
223
+ accessorKey: "status",
224
+ header: () => a("inventory.transfer.table.status"),
225
+ cell(o) {
226
+ const i = a(`inventory.transfer.status.${o.getValue() ?? ""}`), l = `${o.getValue() ?? ""}`.toLocaleLowerCase("en-us");
227
+ return ue(
228
+ "div",
229
+ {
230
+ class: "flex"
231
+ },
232
+ ue(
233
+ "div",
234
+ {
235
+ class: `fm-status-badge fm-status-badge-${l}`
236
+ },
237
+ i
238
+ )
239
+ );
240
+ },
241
+ enableSorting: !0,
242
+ size: 200
243
+ },
244
+ {
245
+ id: "action",
246
+ cell(o) {
247
+ const i = o.row.original, l = I(i);
248
+ return Oe(l, (c) => P(c, i));
249
+ },
250
+ enableSorting: !1,
251
+ size: 40,
252
+ meta: {
253
+ cellClass: "",
254
+ headerClass: ""
255
+ }
256
+ }
257
+ ];
258
+ }
259
+ function m() {
260
+ return [
261
+ {
262
+ accessorKey: "purchaseOrder.seqNumber",
263
+ header: () => a("inventory.transfer.table.seqNo"),
264
+ enableSorting: !0,
265
+ size: 80,
266
+ sortUndefined: "last"
267
+ },
268
+ {
269
+ accessorKey: "purchaseOrder._id",
270
+ header: () => a("inventory.transfer.table.createdAt"),
271
+ cell(o) {
272
+ return ie(`${o.getValue()}`);
273
+ },
274
+ enableSorting: !0
275
+ },
276
+ {
277
+ accessorKey: "to.name",
278
+ header: () => a("inventory.transfer.table.transferTo"),
279
+ enableSorting: !1,
280
+ size: 200
281
+ },
282
+ {
283
+ accessorKey: "purchaseOrder.items.length",
284
+ header: () => a("inventory.transfer.table.noOfItems"),
285
+ enableSorting: !1
286
+ },
287
+ {
288
+ accessorKey: "purchaseOrder.ref",
289
+ header: () => a("inventory.transfer.table.reference"),
290
+ enableSorting: !1,
291
+ size: "auto"
292
+ },
293
+ {
294
+ accessorKey: "purchaseOrder.status",
295
+ header: () => a("inventory.transfer.table.status"),
296
+ cell(o) {
297
+ const i = a(`inventory.transfer.status.${o.getValue() ?? ""}`), l = `${o.getValue() ?? ""}`.toLocaleLowerCase("en-us");
298
+ return ue(Be.FmChip, {
299
+ label: i,
300
+ class: `fm-status-badge fm-status-badge-${l}`,
301
+ compact: !0
302
+ });
303
+ },
304
+ enableSorting: !0
305
+ },
306
+ {
307
+ id: "action",
308
+ cell(o) {
309
+ const i = o.row.original, l = i.purchaseOrder ? I(i.purchaseOrder) : [];
310
+ return Oe(
311
+ l,
312
+ (c) => i.purchaseOrder ? P(c, i.purchaseOrder, i) : void 0
313
+ );
314
+ },
315
+ enableSorting: !1,
316
+ size: 40,
317
+ meta: {
318
+ cellClass: "",
319
+ headerClass: ""
320
+ }
321
+ }
322
+ ];
323
+ }
324
+ const K = W(() => f === "receive/request" ? z() : m());
325
+ return {
326
+ get columnDefs() {
327
+ return K.value;
328
+ }
329
+ };
330
+ }
331
+ const We = { class: "flex flex-col gap-16 w-full h-full" }, Xe = { class: "flex justify-between" }, Ze = { class: "fm-typo-en-body-lg-600" }, et = { class: "flex flex-col gap-8" }, tt = { class: "flex flex-col gap-4" }, st = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, rt = { class: "flex gap-1" }, at = { class: "fm-typo-en-body-lg-600" }, nt = {
332
+ key: 0,
333
+ class: "flex flex-col gap-4"
334
+ }, ot = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, lt = { class: "fm-typo-en-body-lg-600" }, it = { class: "flex flex-col gap-4" }, ct = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ut = { class: "fm-typo-en-body-lg-600" }, dt = {
335
+ key: 1,
336
+ class: "flex flex-col gap-4"
337
+ }, mt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ft = { class: "fm-typo-en-body-lg-600" }, vt = {
338
+ key: 2,
339
+ class: "flex flex-col gap-4"
340
+ }, pt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, yt = { class: "fm-typo-en-body-lg-600" }, bt = {
341
+ key: 3,
342
+ class: "flex flex-col gap-4"
343
+ }, ht = { class: "fm-typo-en-body-lg-600" }, gt = {
344
+ key: 4,
345
+ class: "flex flex-col gap-4"
346
+ }, Rt = { class: "fm-typo-en-body-lg-600" }, _t = {
347
+ key: 5,
348
+ class: "flex flex-col gap-4"
349
+ }, Ot = { class: "fm-typo-en-body-lg-600" }, xt = {
350
+ key: 6,
351
+ class: "flex flex-col gap-4"
352
+ }, kt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, qt = { class: "fm-typo-en-body-lg-600" }, St = {
353
+ key: 7,
354
+ class: "flex flex-col gap-4"
355
+ }, Dt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, wt = { class: "fm-typo-en-body-lg-600" }, At = { class: "border border-fm-color-neutral-gray-200 fm-corner-radius-lg p-16" }, Ct = { class: "flex flex-col gap-8" }, Et = { class: "fm-typo-en-body-lg-600" }, Nt = { class: "flex w-full gap-4" }, Tt = { class: "basis-1/2 shrink-0 grow fm-typo-en-body-lg-400 line-clamp-2" }, Pt = { class: "fm-typo-en-body-lg-600 line-clamp-2" }, Ft = { class: "flex w-full gap-4 fm-typo-en-body-sm-400" }, $t = { class: "grow fm-typo-en-body-lg-400 text-fm-color-typo-secondary line-clamp-1" }, It = {
356
+ key: 0,
357
+ class: "line-clamp-1 fm-typo-en-body-lg-400 text-fm-color-typo-secondary"
358
+ }, jt = {
359
+ key: 1,
360
+ class: "flex-1 xs:w-screen xs:max-w-full"
361
+ }, Mt = {
362
+ key: 0,
363
+ class: "flex flex-col items-center gap-8 h-full"
364
+ }, Ut = ["src"], Kt = { class: "fm-typo-en-body-lg-600" }, Lt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary px-16" }, Vt = {
365
+ key: 1,
366
+ class: "px-4 flex flex-col"
367
+ }, Bt = { class: "flex gap-12 content-stretch" }, Gt = {
368
+ class: "flex flex-col w-24",
369
+ name: "circles"
370
+ }, Ht = { class: "flex-1 flex flex-col items-center" }, zt = { class: "flex-1 flex flex-col items-center" }, Yt = {
371
+ class: "py-12 flex flex-col gap-4",
372
+ name: "received-at header"
373
+ }, Qt = { class: "fm-typo-en-body-lg-400" }, Jt = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, Wt = { class: "flex gap-12 content-stretch" }, Xt = {
374
+ class: "flex flex-col w-24",
375
+ name: "circles"
376
+ }, Zt = { class: "flex-1 flex flex-col items-center" }, es = {
377
+ class: "py-12 flex flex-col gap-4 flex-1",
378
+ name: "delivery details"
379
+ }, ts = { class: "flex flex-col gap-8" }, ss = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, rs = { class: "flex flex-col gap-4" }, as = { class: "flex gap-8 xs:flex-col" }, ys = /* @__PURE__ */ Ne({
380
+ __name: "TransferDetails",
381
+ props: {
382
+ poRequest: {},
383
+ purchaseOrder: {},
384
+ transferTo: {},
385
+ transferToDbName: {},
386
+ show: { type: Boolean },
387
+ canResubmit: { type: Boolean },
388
+ canApprove: { type: Boolean }
389
+ },
390
+ emits: ["update:show", "submitted"],
391
+ setup(f, { emit: C }) {
392
+ const h = f, a = C, I = Ge(), T = He(), P = je(), z = Me(), { t: m } = De(), K = W(
393
+ () => {
394
+ var t, s, q, p;
395
+ return ((s = (t = h.purchaseOrder) == null ? void 0 : t.supplier) == null ? void 0 : s.internal) === "restaurant" || ((p = (q = h.purchaseOrder) == null ? void 0 : q.supplier) == null ? void 0 : p.internal) === "warehouse" ? le.TRANSFER : le.PURCHASE;
396
+ }
397
+ ), o = [
398
+ {
399
+ label: m("inventory.transfer.receiveRequest.details.overview"),
400
+ value: "overview"
401
+ },
402
+ {
403
+ label: m("inventory.transfer.receiveRequest.details.deliveryHistory"),
404
+ value: "deliveryHistory"
405
+ }
406
+ ], i = re(o[0]), l = re(!1), c = re(""), j = re(!0), se = Le(), ce = ze(h, "show");
407
+ async function we(t, s, q) {
408
+ c.value = s, l.value = !0, j.value = !1;
409
+ try {
410
+ await se.processPurchaseOrder(
411
+ {
412
+ operation: s,
413
+ doc: t,
414
+ options: (
415
+ // auto receive for supplier to warehouse
416
+ (s === k.enum.confirmDraft || // auto receive for warehouse to warehouse
417
+ s === k.enum.completeReceive) && z.autoReceiveWarehouse ? {
418
+ autoReceive: !0
419
+ } : void 0
420
+ )
421
+ },
422
+ h.transferToDbName
423
+ ), await new Promise((p) => setTimeout(p, 1e3)), T.open({
424
+ title: "Success",
425
+ message: q,
426
+ type: "success"
427
+ }), a("update:show", !1), a("submitted");
428
+ } catch (p) {
429
+ T.open({
430
+ title: "Something went wrong",
431
+ message: "Please try again.",
432
+ type: "error"
433
+ }), console.error("Error when submitting PO operation", s, t, p);
434
+ } finally {
435
+ c.value = "", l.value = !1, j.value = !0;
436
+ }
437
+ }
438
+ async function L(t) {
439
+ const s = Ve[t];
440
+ if (!s) {
441
+ T.open({
442
+ title: "Something went wrong",
443
+ message: `Cannot process order: ${Ue(t)}`,
444
+ type: "error"
445
+ });
446
+ return;
447
+ }
448
+ const { successMessage: q, ...p } = s;
449
+ I.open({
450
+ title: p.title,
451
+ message: p.message,
452
+ primaryActions: p.primaryActions
453
+ }).onPrimary(() => {
454
+ h.purchaseOrder && we(h.purchaseOrder, t, q);
455
+ });
456
+ }
457
+ const Ae = W(() => {
458
+ var t, s;
459
+ return ((t = h.purchaseOrder) == null ? void 0 : t.status) === A.enum.RECEIVING || ((s = h.purchaseOrder) == null ? void 0 : s.status) === A.enum.COMPLETE;
460
+ }), Ce = W(() => {
461
+ var t, s, q, p, M, E;
462
+ return (s = (t = h.purchaseOrder) == null ? void 0 : t.deliveryFullfillment) != null && s.length && ((p = (q = h.purchaseOrder) == null ? void 0 : q.deliveryFullfillment) == null ? void 0 : p.length) > 0 ? (E = (M = h.purchaseOrder) == null ? void 0 : M.deliveryFullfillment) == null ? void 0 : E.map((N) => {
463
+ var n;
464
+ return (n = N.netSuite) == null ? void 0 : n.refNo;
465
+ }).join(", ") : "-";
466
+ }), Ee = W(() => {
467
+ var E, N, n;
468
+ const q = (((E = h.purchaseOrder) == null ? void 0 : E.deliveryOrder) ?? []).flatMap((g) => g.received ?? []).reduce(
469
+ (g, R) => {
470
+ const _ = g[R.sku._id] ?? [];
471
+ return g[R.sku._id] = [..._, R], g;
472
+ },
473
+ {}
474
+ ), p = Object.entries(q).reduce(
475
+ (g, [R, _]) => {
476
+ const w = _.reduce((v, S) => {
477
+ const D = $e(
478
+ v,
479
+ Math.max(v.precision, S.amount.precision)
480
+ );
481
+ return ke(D, S.amount);
482
+ }, de(0));
483
+ return g[R] = w, g;
484
+ },
485
+ {}
486
+ ), M = ((N = h.purchaseOrder) == null ? void 0 : N.items) ?? [];
487
+ for (const g of M)
488
+ p[n = g.sku._id] ?? (p[n] = de(0));
489
+ return p;
490
+ }), Y = W(() => {
491
+ var E, N;
492
+ const t = ((E = h.purchaseOrder) == null ? void 0 : E.deliveryOrder) ?? [], s = ((N = h.purchaseOrder) == null ? void 0 : N.deliveryFullfillment) ?? [], q = [
493
+ ...t.map((n) => ({
494
+ createdAt: n.createdAt,
495
+ type: "grn",
496
+ doc: n
497
+ })),
498
+ ...s.map((n) => ({
499
+ createdAt: n.createdAt,
500
+ type: "fulfillment",
501
+ doc: n
502
+ }))
503
+ ];
504
+ q.reverse().sort((n, g) => n.createdAt.localeCompare(g.createdAt));
505
+ function p(n) {
506
+ var R;
507
+ const g = s.findIndex((_) => _.id === n.fullfillmentId);
508
+ return {
509
+ header: "Received",
510
+ date: xe(new Date(n.createdAt)),
511
+ info: [
512
+ {
513
+ label: "Received by",
514
+ values: [(R = n.createdBy) == null ? void 0 : R.name]
515
+ },
516
+ {
517
+ label: "Received items",
518
+ values: n.received.map((_) => {
519
+ var w;
520
+ return `(${_.sku.code}) ${_.sku.name}: ${te(_.amount, !1)} ${((w = _.measurement) == null ? void 0 : w.abbrev) ?? _.sku.unit.abbrev}`;
521
+ })
522
+ },
523
+ n.deliveryOrderNumber ? {
524
+ label: "Delivery order no.",
525
+ values: [n.deliveryOrderNumber]
526
+ } : null,
527
+ n.remark ? {
528
+ label: "Remark",
529
+ values: [n.remark]
530
+ } : null,
531
+ g > -1 ? {
532
+ label: "Fulfilment",
533
+ values: [`${g}`]
534
+ } : null
535
+ ].filter((_) => _)
536
+ };
537
+ }
538
+ function M(n) {
539
+ const g = s.findIndex((R) => R.id === n.id);
540
+ return {
541
+ header: "Fulfillment",
542
+ date: xe(new Date(n.createdAt)),
543
+ info: [
544
+ {
545
+ label: "Sequence",
546
+ values: [String(g + 1)]
547
+ },
548
+ {
549
+ label: "Receiveable items",
550
+ values: n.items.map((R) => {
551
+ var _;
552
+ return `(${R.sku.code}) ${R.sku.name}: ${te(R.amount, !1)} ${((_ = R.measurement) == null ? void 0 : _.abbrev) ?? R.sku.unit.abbrev}`;
553
+ })
554
+ }
555
+ ]
556
+ };
557
+ }
558
+ return q.map((n) => {
559
+ switch (n.type) {
560
+ case "grn":
561
+ return p(n.doc);
562
+ case "fulfillment":
563
+ return M(n.doc);
564
+ }
565
+ });
566
+ });
567
+ return (t, s) => {
568
+ var R, _;
569
+ const q = H("FmButtonGroup"), p = H("FmChip"), M = H("FmMenuDivider"), E = H("FmCard"), N = H("FmSpacer"), n = H("FmButton"), g = H("FmSideSheet");
570
+ return u(), $(g, {
571
+ header: r(m)("inventory.transfer.receiveRequest.details.title") + ((R = t.purchaseOrder) != null && R.seqNumber ? ` #${(_ = t.purchaseOrder) == null ? void 0 : _.seqNumber}` : ""),
572
+ modelValue: r(ce),
573
+ "onUpdate:modelValue": s[9] || (s[9] = (w) => Te(ce) ? ce.value = w : null),
574
+ "dismiss-away": j.value,
575
+ "close-button": "",
576
+ "max-width": 500
577
+ }, {
578
+ default: ae(() => {
579
+ var w;
580
+ return [
581
+ e("div", We, [
582
+ e("div", null, [
583
+ U(q, {
584
+ items: o,
585
+ modelValue: i.value,
586
+ "onUpdate:modelValue": s[0] || (s[0] = (v) => i.value = v)
587
+ }, null, 8, ["modelValue"])
588
+ ]),
589
+ i.value.value === "overview" ? (u(), y(Q, { key: 0 }, [
590
+ e("div", null, [
591
+ U(E, {
592
+ variant: "outlined",
593
+ class: "flex flex-col gap-8 px-12 py-16"
594
+ }, {
595
+ default: ae(() => {
596
+ var v, S, D, V, B, G, X, Z, ee, F, me, fe, ve, pe, ye, be, he, ge, Re, _e;
597
+ return [
598
+ e("div", Xe, [
599
+ e("div", Ze, d(r(m)("inventory.transfer.receiveRequest.details.requestSummary")), 1),
600
+ e("div", null, [
601
+ U(p, {
602
+ label: r(m)(`inventory.transfer.status.${(v = t.purchaseOrder) == null ? void 0 : v.status}`),
603
+ class: ne(`fm-status-badge fm-status-badge-${(D = (S = t.purchaseOrder) == null ? void 0 : S.status) == null ? void 0 : D.toLocaleLowerCase("en-us")}`),
604
+ compact: ""
605
+ }, null, 8, ["label", "class"])
606
+ ])
607
+ ]),
608
+ U(M),
609
+ e("div", et, [
610
+ e("div", tt, [
611
+ e("div", st, [
612
+ e("div", rt, d(r(m)("inventory.transfer.receiveRequest.details.createdAt")), 1)
613
+ ]),
614
+ e("div", at, d(r(ie)(((V = t.purchaseOrder) == null ? void 0 : V._id) ?? "")), 1)
615
+ ]),
616
+ (B = t.purchaseOrder) != null && B.effectiveAt ? (u(), y("div", nt, [
617
+ e("div", ot, d(r(m)("inventory.transfer.receiveRequest.details.backdatedTo")), 1),
618
+ e("div", lt, d(r(qe)(new Date((G = t.purchaseOrder) == null ? void 0 : G.effectiveAt))), 1)
619
+ ])) : O("", !0),
620
+ e("div", it, [
621
+ e("div", ct, d(r(m)("inventory.transfer.receiveRequest.details.type.title")), 1),
622
+ e("div", ut, d(r(m)(
623
+ `inventory.transfer.receiveRequest.details.type.${K.value.toLocaleLowerCase("en-US")}`
624
+ )), 1)
625
+ ]),
626
+ (Z = (X = t.purchaseOrder) == null ? void 0 : X.supplier) != null && Z.name ? (u(), y("div", dt, [
627
+ e("div", mt, d(r(m)("inventory.transfer.receiveRequest.details.from")), 1),
628
+ e("div", ft, d((F = (ee = t.purchaseOrder) == null ? void 0 : ee.supplier) == null ? void 0 : F.name), 1)
629
+ ])) : O("", !0),
630
+ t.transferTo ? (u(), y("div", vt, [
631
+ e("div", pt, d(r(m)("inventory.transfer.receiveRequest.details.to")), 1),
632
+ e("div", yt, d(t.transferTo), 1)
633
+ ])) : O("", !0),
634
+ r(P).isEnabled ? (u(), y("div", bt, [
635
+ s[10] || (s[10] = e("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " NetSuite Subsidiary ", -1)),
636
+ e("div", ht, d(((fe = (me = t.purchaseOrder) == null ? void 0 : me.netSuite) == null ? void 0 : fe.subsidiary.name) || ((pe = (ve = t.poRequest) == null ? void 0 : ve.netSuite) == null ? void 0 : pe.subsidiary.name) || "-"), 1)
637
+ ])) : O("", !0),
638
+ r(P).isEnabled ? (u(), y("div", gt, [
639
+ s[11] || (s[11] = e("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " NetSuite Transfer Order ", -1)),
640
+ e("div", Rt, d(((be = (ye = t.purchaseOrder) == null ? void 0 : ye.netSuite) == null ? void 0 : be.id) || ((ge = (he = t.poRequest) == null ? void 0 : he.netSuite) == null ? void 0 : ge.id) || "-"), 1)
641
+ ])) : O("", !0),
642
+ r(P).isEnabled ? (u(), y("div", _t, [
643
+ s[12] || (s[12] = e("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " NetSuite Fulfilment IDs ", -1)),
644
+ e("div", Ot, d(Ce.value), 1)
645
+ ])) : O("", !0),
646
+ (Re = t.purchaseOrder) != null && Re.ref ? (u(), y("div", xt, [
647
+ e("div", kt, d(r(m)("inventory.transfer.receiveRequest.details.reference")), 1),
648
+ e("div", qt, d(t.purchaseOrder.ref), 1)
649
+ ])) : O("", !0),
650
+ (_e = t.purchaseOrder) != null && _e.remark ? (u(), y("div", St, [
651
+ e("div", Dt, d(r(m)("inventory.transfer.receiveRequest.details.remark")), 1),
652
+ e("div", wt, d(t.purchaseOrder.remark), 1)
653
+ ])) : O("", !0)
654
+ ])
655
+ ];
656
+ }),
657
+ _: 1
658
+ })
659
+ ]),
660
+ e("div", At, [
661
+ e("div", Ct, [
662
+ e("div", Et, d(Ae.value ? r(m)("inventory.transfer.receiveRequest.details.receivedItems") : r(m)("inventory.transfer.receiveRequest.details.requestedItems")), 1),
663
+ (u(!0), y(Q, null, oe(((w = t.purchaseOrder) == null ? void 0 : w.items) ?? [], (v) => (u(), y("div", {
664
+ key: v.code,
665
+ class: "flex flex-col"
666
+ }, [
667
+ e("div", Nt, [
668
+ e("div", Tt, d(v.name), 1),
669
+ e("div", Pt, d(r(te)(Ee.value[v.sku._id], !1)) + "/" + d(r(Se)(v.quantity, v.sku.unit, v.measurement)), 1)
670
+ ]),
671
+ e("div", Ft, [
672
+ e("div", $t, d(v.code), 1),
673
+ v.totalCost && r(z).enableTotalCost ? (u(), y("div", It, " (" + d(r(Ie)(v.totalCost)) + ") ", 1)) : O("", !0)
674
+ ])
675
+ ]))), 128))
676
+ ])
677
+ ])
678
+ ], 64)) : O("", !0),
679
+ i.value.value === "deliveryHistory" ? (u(), y("div", jt, [
680
+ Y.value.length ? (u(), y("div", Vt, [
681
+ (u(!0), y(Q, null, oe(Y.value, (v, S) => (u(), y(Q, { key: S }, [
682
+ e("div", Bt, [
683
+ e("div", Gt, [
684
+ e("div", Ht, [
685
+ e("div", {
686
+ class: ne([
687
+ {
688
+ "bg-fm-color-primary": S !== 0,
689
+ "bg-white": S === 0
690
+ },
691
+ "w-[2px] h-full"
692
+ ])
693
+ }, null, 2)
694
+ ]),
695
+ s[13] || (s[13] = e("div", { class: "h-24 w-24 bg-fm-color-primary rounded-full" }, null, -1)),
696
+ e("div", zt, [
697
+ e("div", {
698
+ class: ne([
699
+ {
700
+ "bg-fm-color-primary": S < Y.value.length - 1,
701
+ "bg-white": S >= Y.value.length - 1
702
+ },
703
+ "w-[2px] h-full"
704
+ ])
705
+ }, null, 2)
706
+ ])
707
+ ]),
708
+ e("div", Yt, [
709
+ e("div", Qt, d(v.header), 1),
710
+ e("div", Jt, d(v.date), 1)
711
+ ])
712
+ ]),
713
+ e("div", Wt, [
714
+ e("div", Xt, [
715
+ e("div", Zt, [
716
+ e("div", {
717
+ class: ne([
718
+ {
719
+ "bg-fm-color-primary": S < Y.value.length - 1,
720
+ "bg-white": S >= Y.value.length - 1
721
+ },
722
+ "w-[2px] h-full"
723
+ ])
724
+ }, null, 2)
725
+ ])
726
+ ]),
727
+ e("div", es, [
728
+ U(E, {
729
+ variant: "outlined",
730
+ class: "py-12 px-16"
731
+ }, {
732
+ default: ae(() => [
733
+ e("div", ts, [
734
+ (u(!0), y(Q, null, oe(v.info, (D, V) => (u(), y("div", {
735
+ key: V,
736
+ class: "flex flex-col gap-4"
737
+ }, [
738
+ e("div", ss, d(D == null ? void 0 : D.label), 1),
739
+ e("div", rs, [
740
+ (u(!0), y(Q, null, oe(D == null ? void 0 : D.values, (B, G) => (u(), y("div", {
741
+ key: G,
742
+ class: "fm-typo-en-body-lg-600"
743
+ }, d(B), 1))), 128))
744
+ ])
745
+ ]))), 128))
746
+ ])
747
+ ]),
748
+ _: 2
749
+ }, 1024)
750
+ ])
751
+ ])
752
+ ], 64))), 128))
753
+ ])) : (u(), y("div", Mt, [
754
+ U(N),
755
+ e("div", null, [
756
+ e("img", {
757
+ src: r(Ye),
758
+ alt: "List is empty"
759
+ }, null, 8, Ut)
760
+ ]),
761
+ e("div", Kt, d(r(m)("inventory.transfer.receiveRequest.details.noRecordsFound")), 1),
762
+ e("div", Lt, d(r(m)("inventory.transfer.receiveRequest.details.trackDeliveryMessage")), 1),
763
+ U(N),
764
+ U(N)
765
+ ]))
766
+ ])) : O("", !0)
767
+ ])
768
+ ];
769
+ }),
770
+ "side-sheet-footer": ae(() => {
771
+ var w, v, S, D, V, B, G, X, Z, ee;
772
+ return [
773
+ e("div", as, [
774
+ ((w = t.purchaseOrder) == null ? void 0 : w.status) === r(A).enum.DRAFT && K.value === r(le).PURCHASE ? (u(), $(n, {
775
+ key: 0,
776
+ label: r(m)("inventory.transfer.receiveRequest.actions.confirmDraft"),
777
+ onClick: s[1] || (s[1] = (F) => L("confirmDraft")),
778
+ loading: c.value === "confirmDraft",
779
+ disabled: c.value !== "confirmDraft" && l.value
780
+ }, null, 8, ["label", "loading", "disabled"])) : O("", !0),
781
+ ((v = t.purchaseOrder) == null ? void 0 : v.status) === r(A).enum.DRAFT && K.value === r(le).TRANSFER ? (u(), $(n, {
782
+ key: 1,
783
+ label: r(m)("inventory.transfer.receiveRequest.actions.submitRequest"),
784
+ onClick: s[2] || (s[2] = (F) => L("submitRequest")),
785
+ loading: c.value === "submitRequest",
786
+ disabled: c.value !== "submitRequest" && l.value
787
+ }, null, 8, ["label", "loading", "disabled"])) : O("", !0),
788
+ ((S = t.purchaseOrder) == null ? void 0 : S.status) === r(A).enum.DRAFT ? (u(), $(n, {
789
+ key: 2,
790
+ label: r(m)("inventory.transfer.receiveRequest.actions.cancelDraft"),
791
+ onClick: s[3] || (s[3] = (F) => L("cancelDraft")),
792
+ loading: c.value === "cancelDraft",
793
+ disabled: c.value !== "cancelDraft" && l.value,
794
+ variant: "destructive"
795
+ }, null, 8, ["label", "loading", "disabled"])) : O("", !0),
796
+ ((D = t.purchaseOrder) == null ? void 0 : D.status) === r(A).enum.RECEIVING ? (u(), $(n, {
797
+ key: 3,
798
+ label: r(m)("inventory.transfer.receiveRequest.actions.completeReceive"),
799
+ onClick: s[4] || (s[4] = (F) => L("completeReceive")),
800
+ loading: c.value === "completeReceive",
801
+ disabled: c.value !== "completeReceive" && l.value
802
+ }, null, 8, ["label", "loading", "disabled"])) : O("", !0),
803
+ t.canResubmit ? (u(), $(n, {
804
+ key: 4,
805
+ label: r(m)("inventory.transfer.receiveRequest.actions.resubmitRequest"),
806
+ onClick: s[5] || (s[5] = (F) => L("submitRequest")),
807
+ loading: c.value === "submitRequest",
808
+ disabled: c.value !== "submitRequest" && l.value
809
+ }, null, 8, ["label", "loading", "disabled"])) : O("", !0),
810
+ (((V = t.purchaseOrder) == null ? void 0 : V.status) === r(A).enum.REQUESTING || ((B = t.purchaseOrder) == null ? void 0 : B.status) === r(A).enum.PROCESSING) && t.canApprove ? (u(), $(n, {
811
+ key: 5,
812
+ label: r(m)("inventory.transfer.approval.actions.approveRequest"),
813
+ onClick: s[6] || (s[6] = (F) => L("approveRequest")),
814
+ loading: c.value === "approveRequest",
815
+ disabled: c.value !== "approveRequest" && l.value
816
+ }, null, 8, ["label", "loading", "disabled"])) : O("", !0),
817
+ ((G = t.purchaseOrder) == null ? void 0 : G.status) === r(A).enum.REQUESTING && t.canApprove ? (u(), $(n, {
818
+ key: 6,
819
+ label: r(m)("inventory.transfer.approval.actions.rejectRequest"),
820
+ onClick: s[7] || (s[7] = (F) => L("rejectRequest")),
821
+ loading: c.value === "rejectRequest",
822
+ disabled: c.value !== "rejectRequest" && l.value,
823
+ variant: "destructive"
824
+ }, null, 8, ["label", "loading", "disabled"])) : O("", !0),
825
+ ((X = t.purchaseOrder) == null ? void 0 : X.status) !== r(A).enum.COMPLETE && ((Z = t.purchaseOrder) == null ? void 0 : Z.status) !== r(A).enum.CANCEL && (((ee = t.purchaseOrder) == null ? void 0 : ee.status) !== r(A).enum.REQUESTING || t.canApprove) ? (u(), $(n, {
826
+ key: 7,
827
+ label: r(m)("common.close"),
828
+ variant: "tertiary",
829
+ onClick: s[8] || (s[8] = (F) => a("update:show", !1))
830
+ }, null, 8, ["label"])) : O("", !0)
831
+ ])
832
+ ];
833
+ }),
834
+ _: 1
835
+ }, 8, ["header", "modelValue", "dismiss-away"]);
836
+ };
837
+ }
838
+ });
839
+ export {
840
+ ys as _,
841
+ Qe as g,
842
+ ps as u
843
+ };