@feedmepos/mf-inventory-portal 0.0.22-dev.17 → 0.0.22-dev.18

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