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

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-DD_lqQyg.js} +4 -4
  2. package/dist/{BindingsDialog-CCS9ek6i.js → BindingsDialog-CZk3Vdnx.js} +1 -1
  3. package/dist/{BindingsPicker-aN6Bt5S-.js → BindingsPicker-C1AH5FdB.js} +1 -1
  4. package/dist/{BindingsTable-BWy16dDq.js → BindingsTable-CBX6Q6AL.js} +1 -1
  5. package/dist/{ClosingTemplateView-CcpTmujq.js → ClosingTemplateView-DIwPDy2t.js} +5 -5
  6. package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-CnqvCwZ1.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-W06VyJ31.js} +1 -1
  7. package/dist/{IngredientsView-e1fUwLV5.js → IngredientsView-BC8YIErg.js} +3 -3
  8. package/dist/{IntegrationView-wClaTngm.js → IntegrationView-DENEIkTh.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-CgnLlcQZ.js} +1 -1
  10. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-5oJQidum.js → PremiumBadge.vue_vue_type_script_setup_true_lang-DNPwbLEZ.js} +1 -1
  11. package/dist/{PurchaseOrderPrintPreview-B8L_w8dN.js → PurchaseOrderPrintPreview-CpBmXdD0.js} +1 -1
  12. package/dist/{ReceiveRequestView-DjkgdIE_.js → ReceiveRequestView-C81Zf3zY.js} +6 -6
  13. package/dist/{RecipeView-DCBx5IFe.js → RecipeView-TFZgTDUh.js} +3 -3
  14. package/dist/{StockView-Cn1b4T7N.js → StockView-bgZTOV6i.js} +6 -6
  15. package/dist/{SupplierView-DYtpWPFD.js → SupplierView-BYyQxw0t.js} +3 -3
  16. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-CY6OZxCv.js +776 -0
  17. package/dist/{TransferDialog.vue_vue_type_script_setup_true_lang-B7DXQ57v.js → TransferDialog.vue_vue_type_script_setup_true_lang-uSVIE5_5.js} +235 -232
  18. package/dist/{TransferTemplateView-CxZIwfiT.js → TransferTemplateView-BFhNAi7K.js} +8 -8
  19. package/dist/{UnitView-EQl6iujM.js → UnitView-DX5CnVUR.js} +4 -4
  20. package/dist/{WarehouseView-BMBM2emY.js → WarehouseView-THb6FBXI.js} +2 -2
  21. package/dist/{app-Ai2ZyFFs.js → app-BWF5tQwd.js} +313 -308
  22. package/dist/app.js +1 -1
  23. package/dist/{decimal-CHqei97s.js → decimal-BFC0XDk1.js} +1 -1
  24. package/dist/{defineDeepModel-CkReIsWC.js → defineDeepModel-KSKvsqlu.js} +1 -1
  25. package/dist/{format-time-from-id-Cb2zp48Q.js → format-time-from-id-DtUlqmuq.js} +1 -1
  26. package/dist/{id-to-date-CnOKmysf.js → id-to-date-D1NcrKrG.js} +1 -1
  27. package/dist/{purchase-order-transaction-type-CHRCkOeZ.js → purchase-order-transaction-type-C-dx5pQr.js} +3 -3
  28. package/dist/{supplier-rHVJDY4i.js → supplier-CUzOSQb7.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-CTYd9dEQ.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-Do087aDY.js} +1 -1
  38. package/dist/{xlsx.util-BCiEge44.js → xlsx.util-DD3Ate6Q.js} +2 -2
  39. package/package.json +1 -1
  40. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-DVlkmZxl.js +0 -763
@@ -1,763 +0,0 @@
1
- import { f as ae } from "./format-time-from-id-Cb2zp48Q.js";
2
- import { computed as re, h as le, defineComponent as Te, ref as Z, resolveComponent as L, openBlock as d, createBlock as N, unref as s, isRef as Fe, withCtx as ee, createElementVNode as e, createVNode as U, createElementBlock as y, Fragment as W, toDisplayString as n, normalizeClass as te, 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 h, 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 g, c as je, j as Ie, ag as q, J as Ue, H as Me, G as $e, aj as Ke, b as Le, x as Ve } from "./app-Ai2ZyFFs.js";
6
- import { F as Be } from "./decimal-CHqei97s.js";
7
- import { f as me, P as se, d as Ge, e as He } from "./purchase-order-transaction-type-CHRCkOeZ.js";
8
- import { components as ze, useDialog as Qe, useSnackbar as Ye, useProxiedModel as Je } from "@feedmepos/ui-library";
9
- import { useI18n as Ce } from "@feedmepos/mf-common";
10
- import { E as We } from "./empty-placeholder-wf6-BWE8.js";
11
- function Xe(f, k) {
12
- return k.reduce(
13
- (a, P) => {
14
- const w = P.received.find((C) => C.sku._id === f._id);
15
- return w && (a = Ae(a, w.amount)), a;
16
- },
17
- Be.toPrecision(ce(0), f.unit.precision)
18
- );
19
- }
20
- function Ze(f, k) {
21
- const { name: _, address: a, regNo: P } = k.doc.profile, w = {
22
- name: _,
23
- registrationNumber: P,
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
- }, C = {
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
- }, V = f.items.map((c) => {
40
- const { sku: i, measurement: u } = c, T = ue(
41
- Xe(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
- }), o = 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
- })), M = {
65
- orderNumber: f.seqNumber.toString(),
66
- createdAt: ae(f._id),
67
- ref: f.ref || "",
68
- remark: f.remark || "",
69
- buyer: w,
70
- supplier: C,
71
- items: V,
72
- status: f.status,
73
- deliveryOrders: o
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(M)), window.open(l.href, "_blank", "noreferrer");
76
- }
77
- const H = {
78
- submitRequest: {
79
- translationKey: "inventory.transfer.receiveRequest.actions.submitRequest",
80
- color: "text-fm-color-typo-primary",
81
- value: g.enum.submitRequest
82
- },
83
- confirmDraft: {
84
- translationKey: "inventory.transfer.receiveRequest.actions.confirmDraft",
85
- color: "text-fm-color-typo-primary",
86
- value: g.enum.confirmDraft
87
- },
88
- cancelDraft: {
89
- translationKey: "inventory.transfer.receiveRequest.actions.cancelDraft",
90
- color: "text-fm-color-typo-error",
91
- value: g.enum.cancelDraft
92
- },
93
- approveRequest: {
94
- translationKey: "inventory.transfer.receiveRequest.actions.approveRequest",
95
- color: "text-fm-color-typo-primary",
96
- value: g.enum.approveRequest
97
- },
98
- rejectRequest: {
99
- translationKey: "inventory.transfer.receiveRequest.actions.rejectRequest",
100
- color: "text-fm-color-typo-error",
101
- value: g.enum.rejectRequest
102
- },
103
- processRequest: {
104
- translationKey: "inventory.transfer.receiveRequest.actions.processRequest",
105
- color: "text-fm-color-typo-primary",
106
- value: g.enum.processRequest
107
- },
108
- receiveStock: {
109
- translationKey: "inventory.transfer.receiveRequest.actions.receiveStock",
110
- color: "text-fm-color-typo-primary",
111
- value: g.enum.receiveStock
112
- },
113
- completeReceive: {
114
- translationKey: "inventory.transfer.receiveRequest.actions.completeReceive",
115
- color: "text-fm-color-typo-primary",
116
- value: g.enum.completeReceive
117
- }
118
- };
119
- function xs(f, k) {
120
- const _ = Ie(), { t: a } = Ce();
121
- function P(l) {
122
- switch (l.status) {
123
- case "DRAFT":
124
- return [
125
- l.supplier.internal === "restaurant" || l.supplier.internal === "warehouse" ? H[g.enum.submitRequest] : H[g.enum.confirmDraft],
126
- H[g.enum.cancelDraft],
127
- h[v.Update],
128
- h[v.Details],
129
- h[v.Print]
130
- ];
131
- case "RECEIVING":
132
- return [
133
- H[g.enum.completeReceive],
134
- h[v.Update],
135
- h[v.Details],
136
- h[v.Print]
137
- ];
138
- case "REQUESTING":
139
- return f === "receive/request" ? [
140
- h[v.Update],
141
- h[v.Details],
142
- h[v.Print]
143
- ] : [
144
- H[g.enum.approveRequest],
145
- H[g.enum.rejectRequest],
146
- h[v.Details],
147
- h[v.Print]
148
- ];
149
- case "PROCESSING":
150
- return [h[v.Details], h[v.Print]];
151
- case "COMPLETE":
152
- return [
153
- h[v.Update],
154
- h[v.Details],
155
- h[v.Print]
156
- ];
157
- case "CANCEL":
158
- default:
159
- return [h[v.Details], h[v.Print]];
160
- }
161
- }
162
- function w(l) {
163
- return Object.values(g.enum).includes(l);
164
- }
165
- async function C(l, c, i) {
166
- var T, X;
167
- const u = je(c);
168
- if (l === v.Print) {
169
- Ze(u, _.currentLocation);
170
- return;
171
- }
172
- if (l === v.Details) {
173
- k.promptShowTransferDetails(u, i);
174
- return;
175
- }
176
- if (l === v.Update) {
177
- (T = k.promptUpdateTransferDialog) == null || T.call(k, u);
178
- return;
179
- }
180
- if (w(l)) {
181
- k.submitAction(c, l, (X = i == null ? void 0 : i.to) == null ? void 0 : X.dbName);
182
- return;
183
- }
184
- }
185
- function V() {
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(l) {
198
- return ae(`${l.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(l) {
226
- const c = a(`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) => C(u, c));
249
- },
250
- enableSorting: !1,
251
- size: 40,
252
- meta: {
253
- cellClass: "",
254
- headerClass: ""
255
- }
256
- }
257
- ];
258
- }
259
- function o() {
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(l) {
272
- return ae(`${l.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(l) {
297
- const c = a(`inventory.transfer.status.${l.getValue() ?? ""}`), i = `${l.getValue() ?? ""}`.toLocaleLowerCase("en-us");
298
- return le(ze.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 ? C(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 M = re(() => f === "receive/request" ? V() : o());
325
- return {
326
- get columnDefs() {
327
- return M.value;
328
- }
329
- };
330
- }
331
- const et = { class: "flex flex-col gap-16 w-full h-full" }, tt = { class: "flex justify-between" }, st = { class: "fm-typo-en-body-lg-600" }, rt = { class: "flex flex-col gap-8" }, at = { class: "flex flex-col gap-4" }, nt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ot = { class: "flex gap-1" }, lt = { class: "fm-typo-en-body-lg-600" }, it = {
332
- key: 0,
333
- class: "flex flex-col gap-4"
334
- }, ct = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ut = { class: "fm-typo-en-body-lg-600" }, dt = { class: "flex flex-col gap-4" }, mt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ft = { class: "fm-typo-en-body-lg-600" }, pt = {
335
- key: 1,
336
- class: "flex flex-col gap-4"
337
- }, vt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, yt = { class: "fm-typo-en-body-lg-600" }, ht = {
338
- key: 2,
339
- class: "flex flex-col gap-4"
340
- }, bt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, gt = { class: "fm-typo-en-body-lg-600" }, _t = {
341
- key: 3,
342
- class: "flex flex-col gap-4"
343
- }, Rt = { class: "fm-typo-en-body-lg-600" }, Ot = {
344
- key: 4,
345
- class: "flex flex-col gap-4"
346
- }, qt = { class: "fm-typo-en-body-lg-600" }, kt = {
347
- key: 5,
348
- class: "flex flex-col gap-4"
349
- }, xt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, 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 = { class: "border border-fm-color-neutral-gray-200 fm-corner-radius-lg p-16" }, Et = { class: "flex flex-col gap-8" }, Nt = { class: "fm-typo-en-body-lg-600" }, Pt = { class: "flex w-full gap-4" }, Tt = { class: "basis-1/2 shrink-0 grow fm-typo-en-body-lg-400 line-clamp-2" }, Ft = { class: "fm-typo-en-body-lg-600 line-clamp-2" }, jt = { class: "flex w-full gap-4 fm-typo-en-body-sm-400" }, It = { class: "grow fm-typo-en-body-lg-400 text-fm-color-typo-secondary line-clamp-1" }, Ut = {
353
- key: 0,
354
- class: "line-clamp-1 fm-typo-en-body-lg-400 text-fm-color-typo-secondary"
355
- }, Mt = {
356
- key: 1,
357
- class: "flex-1 xs:w-screen xs:max-w-full"
358
- }, $t = {
359
- key: 0,
360
- class: "flex flex-col items-center gap-8 h-full"
361
- }, Kt = ["src"], Lt = { class: "fm-typo-en-body-lg-600" }, Vt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary px-16" }, Bt = {
362
- key: 1,
363
- class: "px-4 flex flex-col"
364
- }, Gt = { class: "flex gap-12 content-stretch" }, Ht = {
365
- class: "flex flex-col w-24",
366
- name: "circles"
367
- }, zt = { class: "flex-1 flex flex-col items-center" }, Qt = { class: "flex-1 flex flex-col items-center" }, Yt = {
368
- class: "py-12 flex flex-col gap-4",
369
- name: "received-at header"
370
- }, Jt = { class: "fm-typo-en-body-lg-400" }, Wt = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, Xt = { class: "flex gap-12 content-stretch" }, Zt = {
371
- class: "flex flex-col w-24",
372
- name: "circles"
373
- }, es = { class: "flex-1 flex flex-col items-center" }, ts = {
374
- class: "py-12 flex flex-col gap-4 flex-1",
375
- name: "delivery details"
376
- }, ss = { class: "flex flex-col gap-8" }, rs = { class: "flex flex-col gap-4" }, as = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, ns = { class: "fm-typo-en-body-lg-600" }, os = { class: "flex flex-col gap-4" }, ls = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, is = { class: "flex flex-col gap-4" }, cs = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, us = { class: "fm-typo-en-body-lg-600" }, ds = { class: "flex flex-col gap-4" }, ms = {
377
- key: 0,
378
- class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary"
379
- }, fs = { class: "fm-typo-en-body-lg-600" }, ps = { class: "flex gap-8 xs:flex-col" }, Ss = /* @__PURE__ */ Te({
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: k }) {
392
- const _ = f, a = k, P = Qe(), w = Ye(), C = Ke(), V = Le(), { t: o } = Ce(), M = re(
393
- () => {
394
- var t, r, D, b;
395
- return ((r = (t = _.purchaseOrder) == null ? void 0 : t.supplier) == null ? void 0 : r.internal) === "restaurant" || ((b = (D = _.purchaseOrder) == null ? void 0 : D.supplier) == null ? void 0 : b.internal) === "warehouse" ? se.TRANSFER : se.PURCHASE;
396
- }
397
- ), l = [
398
- {
399
- label: o("inventory.transfer.receiveRequest.details.overview"),
400
- value: "overview"
401
- },
402
- {
403
- label: o("inventory.transfer.receiveRequest.details.deliveryHistory"),
404
- value: "deliveryHistory"
405
- }
406
- ], c = Z(l[0]), i = Z(!1), u = Z(""), T = Z(!0), X = Ge(), ne = Je(_, "show");
407
- async function Ee(t, r, D) {
408
- u.value = r, i.value = !0, T.value = !1;
409
- try {
410
- await X.processPurchaseOrder(
411
- {
412
- operation: r,
413
- doc: t,
414
- options: (
415
- // auto receive for supplier to warehouse
416
- (r === g.enum.confirmDraft || // auto receive for warehouse to warehouse
417
- r === g.enum.completeReceive) && V.autoReceiveWarehouse ? {
418
- autoReceive: !0
419
- } : void 0
420
- )
421
- },
422
- _.transferToDbName
423
- ), await new Promise((b) => setTimeout(b, 1e3)), w.open({
424
- title: "Success",
425
- message: D,
426
- type: "success"
427
- }), a("update:show", !1), a("submitted");
428
- } catch (b) {
429
- w.open({
430
- title: "Something went wrong",
431
- message: "Please try again.",
432
- type: "error"
433
- }), console.error("Error when submitting PO operation", r, t, b);
434
- } finally {
435
- u.value = "", i.value = !1, T.value = !0;
436
- }
437
- }
438
- async function $(t) {
439
- const r = He[t];
440
- if (!r) {
441
- w.open({
442
- title: "Something went wrong",
443
- message: `Cannot process order: ${Ve(t)}`,
444
- type: "error"
445
- });
446
- return;
447
- }
448
- const { successMessage: D, ...b } = r;
449
- P.open({
450
- title: b.title,
451
- message: b.message,
452
- primaryActions: b.primaryActions
453
- }).onPrimary(() => {
454
- _.purchaseOrder && Ee(_.purchaseOrder, t, D);
455
- });
456
- }
457
- const Ne = re(() => {
458
- var t, r;
459
- return ((t = _.purchaseOrder) == null ? void 0 : t.status) === q.enum.RECEIVING || ((r = _.purchaseOrder) == null ? void 0 : r.status) === q.enum.COMPLETE;
460
- }), Pe = re(() => {
461
- var z, B, x;
462
- const D = (((z = _.purchaseOrder) == null ? void 0 : z.deliveryOrder) ?? []).flatMap((O) => O.received ?? []).reduce(
463
- (O, F) => {
464
- const G = O[F.sku._id] ?? [];
465
- return O[F.sku._id] = [...G, F], O;
466
- },
467
- {}
468
- ), b = Object.entries(D).reduce(
469
- (O, [F, G]) => {
470
- const E = G.reduce((j, I) => {
471
- const K = Ue(
472
- j,
473
- Math.max(j.precision, I.amount.precision)
474
- );
475
- return Ae(K, I.amount);
476
- }, ce(0));
477
- return O[F] = E, O;
478
- },
479
- {}
480
- ), oe = ((B = _.purchaseOrder) == null ? void 0 : B.items) ?? [];
481
- for (const O of oe)
482
- b[x = O.sku._id] ?? (b[x] = ce(0));
483
- return b;
484
- });
485
- return (t, r) => {
486
- var F, G;
487
- const D = L("FmButtonGroup"), b = L("FmChip"), oe = L("FmMenuDivider"), z = L("FmCard"), B = L("FmSpacer"), x = L("FmButton"), O = L("FmSideSheet");
488
- return d(), N(O, {
489
- header: s(o)("inventory.transfer.receiveRequest.details.title") + ((F = t.purchaseOrder) != null && F.seqNumber ? ` #${(G = t.purchaseOrder) == null ? void 0 : G.seqNumber}` : ""),
490
- modelValue: s(ne),
491
- "onUpdate:modelValue": r[9] || (r[9] = (E) => Fe(ne) ? ne.value = E : null),
492
- "dismiss-away": T.value,
493
- "close-button": "",
494
- "max-width": 500
495
- }, {
496
- default: ee(() => {
497
- var E, j, I, K, Q, Y;
498
- return [
499
- e("div", et, [
500
- e("div", null, [
501
- U(D, {
502
- items: l,
503
- modelValue: c.value,
504
- "onUpdate:modelValue": r[0] || (r[0] = (m) => c.value = m)
505
- }, null, 8, ["modelValue"])
506
- ]),
507
- c.value.value === "overview" ? (d(), y(W, { key: 0 }, [
508
- U(z, {
509
- variant: "outlined",
510
- class: "flex flex-col gap-8 px-12 py-16"
511
- }, {
512
- default: ee(() => {
513
- var m, R, S, J, A, fe, pe, ve, ye, he, be, ge, _e, Re, Oe, qe, ke, xe, Se, we;
514
- return [
515
- e("div", tt, [
516
- e("div", st, n(s(o)("inventory.transfer.receiveRequest.details.requestSummary")), 1),
517
- e("div", null, [
518
- U(b, {
519
- label: s(o)(`inventory.transfer.status.${(m = t.purchaseOrder) == null ? void 0 : m.status}`),
520
- class: te(`fm-status-badge fm-status-badge-${(S = (R = t.purchaseOrder) == null ? void 0 : R.status) == null ? void 0 : S.toLocaleLowerCase("en-us")}`),
521
- compact: ""
522
- }, null, 8, ["label", "class"])
523
- ])
524
- ]),
525
- U(oe),
526
- e("div", rt, [
527
- e("div", at, [
528
- e("div", nt, [
529
- e("div", ot, n(s(o)("inventory.transfer.receiveRequest.details.createdAt")), 1)
530
- ]),
531
- e("div", lt, n(s(ae)(((J = t.purchaseOrder) == null ? void 0 : J._id) ?? "")), 1)
532
- ]),
533
- (A = t.purchaseOrder) != null && A.effectiveAt ? (d(), y("div", it, [
534
- e("div", ct, n(s(o)("inventory.transfer.receiveRequest.details.backdatedTo")), 1),
535
- e("div", ut, n(s(de)(new Date((fe = t.purchaseOrder) == null ? void 0 : fe.effectiveAt))), 1)
536
- ])) : p("", !0),
537
- e("div", dt, [
538
- e("div", mt, n(s(o)("inventory.transfer.receiveRequest.details.type.title")), 1),
539
- e("div", ft, n(s(o)(
540
- `inventory.transfer.receiveRequest.details.type.${M.value.toLocaleLowerCase("en-US")}`
541
- )), 1)
542
- ]),
543
- (ve = (pe = t.purchaseOrder) == null ? void 0 : pe.supplier) != null && ve.name ? (d(), y("div", pt, [
544
- e("div", vt, n(s(o)("inventory.transfer.receiveRequest.details.from")), 1),
545
- e("div", yt, n((he = (ye = t.purchaseOrder) == null ? void 0 : ye.supplier) == null ? void 0 : he.name), 1)
546
- ])) : p("", !0),
547
- t.transferTo ? (d(), y("div", ht, [
548
- e("div", bt, n(s(o)("inventory.transfer.receiveRequest.details.to")), 1),
549
- e("div", gt, n(t.transferTo), 1)
550
- ])) : p("", !0),
551
- s(C).isEnabled ? (d(), y("div", _t, [
552
- r[10] || (r[10] = e("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " NetSuite Subsidiary ", -1)),
553
- e("div", Rt, n(((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)
554
- ])) : p("", !0),
555
- s(C).isEnabled ? (d(), y("div", Ot, [
556
- r[11] || (r[11] = e("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " NetSuite Transfer Order ", -1)),
557
- e("div", qt, n(((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)
558
- ])) : p("", !0),
559
- (Se = t.purchaseOrder) != null && Se.ref ? (d(), y("div", kt, [
560
- e("div", xt, n(s(o)("inventory.transfer.receiveRequest.details.reference")), 1),
561
- e("div", St, n(t.purchaseOrder.ref), 1)
562
- ])) : p("", !0),
563
- (we = t.purchaseOrder) != null && we.remark ? (d(), y("div", wt, [
564
- e("div", Dt, n(s(o)("inventory.transfer.receiveRequest.details.remark")), 1),
565
- e("div", At, n(t.purchaseOrder.remark), 1)
566
- ])) : p("", !0)
567
- ])
568
- ];
569
- }),
570
- _: 1
571
- }),
572
- e("div", Ct, [
573
- e("div", Et, [
574
- e("div", Nt, n(Ne.value ? s(o)("inventory.transfer.receiveRequest.details.receivedItems") : s(o)("inventory.transfer.receiveRequest.details.requestedItems")), 1),
575
- (d(!0), y(W, null, ie(((E = t.purchaseOrder) == null ? void 0 : E.items) ?? [], (m) => (d(), y("div", {
576
- key: m.code,
577
- class: "flex flex-col"
578
- }, [
579
- e("div", Pt, [
580
- e("div", Tt, n(m.name), 1),
581
- e("div", Ft, n(s(ue)(Pe.value[m.sku._id], !1)) + "/" + n(s(me)(m.quantity, m.sku.unit, m.measurement)), 1)
582
- ]),
583
- e("div", jt, [
584
- e("div", It, n(m.code), 1),
585
- m.totalCost && s(V).enableTotalCost ? (d(), y("div", Ut, " (" + n(s(Me)(m.totalCost)) + ") ", 1)) : p("", !0)
586
- ])
587
- ]))), 128))
588
- ])
589
- ])
590
- ], 64)) : p("", !0),
591
- c.value.value === "deliveryHistory" ? (d(), y("div", Mt, [
592
- ((I = (j = t.purchaseOrder) == null ? void 0 : j.deliveryOrder) == null ? void 0 : I.length) === 0 ? (d(), y("div", $t, [
593
- U(B),
594
- e("div", null, [
595
- e("img", {
596
- src: s(We),
597
- alt: "List is empty"
598
- }, null, 8, Kt)
599
- ]),
600
- e("div", Lt, n(s(o)("inventory.transfer.receiveRequest.details.noRecordsFound")), 1),
601
- e("div", Vt, n(s(o)("inventory.transfer.receiveRequest.details.trackDeliveryMessage")), 1),
602
- U(B),
603
- U(B)
604
- ])) : p("", !0),
605
- (K = t.purchaseOrder) != null && K.deliveryOrder && ((Q = t.purchaseOrder) == null ? void 0 : Q.deliveryOrder.length) > 0 ? (d(), y("div", Bt, [
606
- (d(!0), y(W, null, ie((Y = t.purchaseOrder) == null ? void 0 : Y.deliveryOrder, (m, R) => (d(), y(W, { key: R }, [
607
- e("div", Gt, [
608
- e("div", Ht, [
609
- e("div", zt, [
610
- e("div", {
611
- class: te([
612
- {
613
- "bg-fm-color-primary": R !== 0,
614
- "bg-white": R === 0
615
- },
616
- "w-[2px] h-full"
617
- ])
618
- }, null, 2)
619
- ]),
620
- r[12] || (r[12] = e("div", { class: "h-24 w-24 bg-fm-color-primary rounded-full" }, null, -1)),
621
- e("div", Qt, [
622
- e("div", {
623
- class: te([
624
- {
625
- "bg-fm-color-primary": R < t.purchaseOrder.deliveryOrder.length - 1,
626
- "bg-white": R >= t.purchaseOrder.deliveryOrder.length - 1
627
- },
628
- "w-[2px] h-full"
629
- ])
630
- }, null, 2)
631
- ])
632
- ]),
633
- e("div", Yt, [
634
- e("div", Jt, n(s(o)("inventory.transfer.receiveRequest.details.received")), 1),
635
- e("div", Wt, n(s(de)(new Date(m.createdAt))) + ", " + n(s($e)(new Date(m.createdAt))), 1)
636
- ])
637
- ]),
638
- e("div", Xt, [
639
- e("div", Zt, [
640
- e("div", es, [
641
- e("div", {
642
- class: te([
643
- {
644
- "bg-fm-color-primary": R < t.purchaseOrder.deliveryOrder.length - 1,
645
- "bg-white": R >= t.purchaseOrder.deliveryOrder.length - 1
646
- },
647
- "w-[2px] h-full"
648
- ])
649
- }, null, 2)
650
- ])
651
- ]),
652
- e("div", ts, [
653
- U(z, {
654
- variant: "outlined",
655
- class: "py-12 px-16"
656
- }, {
657
- default: ee(() => [
658
- e("div", ss, [
659
- e("div", rs, [
660
- e("div", as, n(s(o)("inventory.transfer.receiveRequest.details.receivedBy")), 1),
661
- e("div", ns, n(m.createdBy.name), 1)
662
- ]),
663
- e("div", os, [
664
- e("div", ls, n(s(o)("inventory.transfer.receiveRequest.details.receivedItems")), 1),
665
- (d(!0), y(W, null, ie(m.received, (S) => (d(), y("div", {
666
- class: "fm-typo-en-body-lg-600",
667
- key: S.sku._id
668
- }, n(S.sku.name) + " " + n(s(me)(S.amount, S.sku.unit, S.measurement)), 1))), 128))
669
- ]),
670
- e("div", is, [
671
- e("div", cs, n(s(o)("inventory.transfer.receiveRequest.details.deliveryOrderNo")), 1),
672
- e("div", us, n(m.deliveryOrderNumber.trim().length ? m.deliveryOrderNumber : "-"), 1)
673
- ]),
674
- e("div", ds, [
675
- m.remark ? (d(), y("div", ms, n(s(o)("inventory.transfer.receiveRequest.details.deliveryRemark")), 1)) : p("", !0),
676
- e("div", fs, n(m.remark), 1)
677
- ])
678
- ])
679
- ]),
680
- _: 2
681
- }, 1024)
682
- ])
683
- ])
684
- ], 64))), 128))
685
- ])) : p("", !0)
686
- ])) : p("", !0)
687
- ])
688
- ];
689
- }),
690
- "side-sheet-footer": ee(() => {
691
- var E, j, I, K, Q, Y, m, R, S, J;
692
- return [
693
- e("div", ps, [
694
- ((E = t.purchaseOrder) == null ? void 0 : E.status) === s(q).enum.DRAFT && M.value === s(se).PURCHASE ? (d(), N(x, {
695
- key: 0,
696
- label: s(o)("inventory.transfer.receiveRequest.actions.confirmDraft"),
697
- onClick: r[1] || (r[1] = (A) => $("confirmDraft")),
698
- loading: u.value === "confirmDraft",
699
- disabled: u.value !== "confirmDraft" && i.value
700
- }, null, 8, ["label", "loading", "disabled"])) : p("", !0),
701
- ((j = t.purchaseOrder) == null ? void 0 : j.status) === s(q).enum.DRAFT && M.value === s(se).TRANSFER ? (d(), N(x, {
702
- key: 1,
703
- label: s(o)("inventory.transfer.receiveRequest.actions.submitRequest"),
704
- onClick: r[2] || (r[2] = (A) => $("submitRequest")),
705
- loading: u.value === "submitRequest",
706
- disabled: u.value !== "submitRequest" && i.value
707
- }, null, 8, ["label", "loading", "disabled"])) : p("", !0),
708
- ((I = t.purchaseOrder) == null ? void 0 : I.status) === s(q).enum.DRAFT ? (d(), N(x, {
709
- key: 2,
710
- label: s(o)("inventory.transfer.receiveRequest.actions.cancelDraft"),
711
- onClick: r[3] || (r[3] = (A) => $("cancelDraft")),
712
- loading: u.value === "cancelDraft",
713
- disabled: u.value !== "cancelDraft" && i.value,
714
- variant: "destructive"
715
- }, null, 8, ["label", "loading", "disabled"])) : p("", !0),
716
- ((K = t.purchaseOrder) == null ? void 0 : K.status) === s(q).enum.RECEIVING ? (d(), N(x, {
717
- key: 3,
718
- label: s(o)("inventory.transfer.receiveRequest.actions.completeReceive"),
719
- onClick: r[4] || (r[4] = (A) => $("completeReceive")),
720
- loading: u.value === "completeReceive",
721
- disabled: u.value !== "completeReceive" && i.value
722
- }, null, 8, ["label", "loading", "disabled"])) : p("", !0),
723
- t.canResubmit ? (d(), N(x, {
724
- key: 4,
725
- label: s(o)("inventory.transfer.receiveRequest.actions.resubmitRequest"),
726
- onClick: r[5] || (r[5] = (A) => $("submitRequest")),
727
- loading: u.value === "submitRequest",
728
- disabled: u.value !== "submitRequest" && i.value
729
- }, null, 8, ["label", "loading", "disabled"])) : p("", !0),
730
- (((Q = t.purchaseOrder) == null ? void 0 : Q.status) === s(q).enum.REQUESTING || ((Y = t.purchaseOrder) == null ? void 0 : Y.status) === s(q).enum.PROCESSING) && t.canApprove ? (d(), N(x, {
731
- key: 5,
732
- label: s(o)("inventory.transfer.approval.actions.approveRequest"),
733
- onClick: r[6] || (r[6] = (A) => $("approveRequest")),
734
- loading: u.value === "approveRequest",
735
- disabled: u.value !== "approveRequest" && i.value
736
- }, null, 8, ["label", "loading", "disabled"])) : p("", !0),
737
- ((m = t.purchaseOrder) == null ? void 0 : m.status) === s(q).enum.REQUESTING && t.canApprove ? (d(), N(x, {
738
- key: 6,
739
- label: s(o)("inventory.transfer.approval.actions.rejectRequest"),
740
- onClick: r[7] || (r[7] = (A) => $("rejectRequest")),
741
- loading: u.value === "rejectRequest",
742
- disabled: u.value !== "rejectRequest" && i.value,
743
- variant: "destructive"
744
- }, null, 8, ["label", "loading", "disabled"])) : p("", !0),
745
- ((R = t.purchaseOrder) == null ? void 0 : R.status) !== s(q).enum.COMPLETE && ((S = t.purchaseOrder) == null ? void 0 : S.status) !== s(q).enum.CANCEL && (((J = t.purchaseOrder) == null ? void 0 : J.status) !== s(q).enum.REQUESTING || t.canApprove) ? (d(), N(x, {
746
- key: 7,
747
- label: s(o)("common.close"),
748
- variant: "tertiary",
749
- onClick: r[8] || (r[8] = (A) => a("update:show", !1))
750
- }, null, 8, ["label"])) : p("", !0)
751
- ])
752
- ];
753
- }),
754
- _: 1
755
- }, 8, ["header", "modelValue", "dismiss-away"]);
756
- };
757
- }
758
- });
759
- export {
760
- Ss as _,
761
- Xe as g,
762
- xs as u
763
- };