@feedmepos/mf-inventory-portal 0.0.22-dev.7 → 0.0.22-dev.9

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 (60) hide show
  1. package/dist/{ApprovalView-B9s4exkr.js → ApprovalView-BPsScR5_.js} +4 -4
  2. package/dist/{BindingsDialog-uksEDFFX.js → BindingsDialog-GzX9Bo2g.js} +1 -1
  3. package/dist/{BindingsPicker-B2rQ9kJH.js → BindingsPicker-SbOetc0-.js} +19 -19
  4. package/dist/{BindingsTable-BLN_bAjO.js → BindingsTable-CAcE5y8U.js} +1 -1
  5. package/dist/{ClosingTemplateView-Bi06Gxzo.js → ClosingTemplateView-DECwEnlK.js} +91 -90
  6. package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-CeBoTYGq.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DnogYrRE.js} +1 -1
  7. package/dist/{IngredientsView-DY6yY-Fk.js → IngredientsView-8fT1Ljd5.js} +3 -3
  8. package/dist/{IntegrationView-C74CJ4PS.js → IntegrationView-CjGLRM78.js} +2 -2
  9. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-BmsbeAvi.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-1FCwvO8A.js} +1 -1
  10. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-RoZStI7P.js → PremiumBadge.vue_vue_type_script_setup_true_lang-DlhNc8Vk.js} +1 -1
  11. package/dist/{PurchaseOrderPrintPreview-Dn5CQDnd.js → PurchaseOrderPrintPreview-5HIWHR_f.js} +1 -1
  12. package/dist/{ReceiveRequestView-BC61WMFL.js → ReceiveRequestView-CXZv8g5U.js} +6 -6
  13. package/dist/{RecipeView-DYbuUEFK.js → RecipeView-sB0Lgmob.js} +3 -3
  14. package/dist/{StockView-D_ZzX7yp.js → StockView-CY2kNohB.js} +6 -6
  15. package/dist/{SupplierView-ChewCZKN.js → SupplierView-DTqeZPts.js} +37 -37
  16. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-BBby29tW.js +762 -0
  17. package/dist/TransferDialog.vue_vue_type_script_setup_true_lang-ByNQap9n.js +1498 -0
  18. package/dist/TransferTemplateView-DkRVfAox.js +1277 -0
  19. package/dist/{UnitView-Cx1xe3Wg.js → UnitView-BpU0Yk7X.js} +4 -4
  20. package/dist/{WarehouseView-CQQf0YFc.js → WarehouseView-DqxWgogc.js} +2 -2
  21. package/dist/api/inventory.d.ts +5 -7
  22. package/dist/api/netsuite.d.ts +40 -0
  23. package/dist/api/purchase-order-template.d.ts +0 -4
  24. package/dist/{app-emo4vLKK.js → app-BuyAj4kw.js} +11903 -11636
  25. package/dist/app.d.ts +6 -0
  26. package/dist/app.js +3 -3
  27. package/dist/{decimal-BO9I7LUt.js → decimal-DWbwRn_v.js} +1 -1
  28. package/dist/{defineDeepModel-D06lO_R2.js → defineDeepModel-DuVmbMwq.js} +4 -4
  29. package/dist/{format-time-from-id-HTOA-soi.js → format-time-from-id-BnmaRuab.js} +1 -1
  30. package/dist/{id-to-date-DAnKDcfC.js → id-to-date-CI5Vv0Ji.js} +1 -1
  31. package/dist/purchase-order-transaction-type-DrFJFvtK.js +676 -0
  32. package/dist/stores/api.d.ts +1 -0
  33. package/dist/stores/feature.d.ts +0 -1
  34. package/dist/stores/helper/core-store-proxy.d.ts +3 -0
  35. package/dist/stores/helper/generate-backend-urls.d.ts +1 -0
  36. package/dist/stores/location.d.ts +24 -42
  37. package/dist/stores/netsuite.d.ts +49 -0
  38. package/dist/stores/warehouse.d.ts +4 -7
  39. package/dist/style.css +1 -1
  40. package/dist/{supplier-CBf_J6D6.js → supplier-BQyK2eSZ.js} +1 -1
  41. package/dist/tsconfig.app.tsbuildinfo +1 -1
  42. package/dist/{use-template-enabled-locations-2-Bo3g55rA.js → use-template-enabled-locations-2-ClBq9FjN.js} +1 -1
  43. package/dist/views/closing-template/composables/use-closing-template-actions.d.ts +48 -84
  44. package/dist/views/closing-template/composables/use-closing-template-table.d.ts +48 -84
  45. package/dist/views/receive-request/components/transfer-form/TransferForm.vue.d.ts +14 -0
  46. package/dist/views/receive-request/composables/use-receive-request-form.d.ts +42 -0
  47. package/dist/views/receive-request/composables/use-receive-request-table.d.ts +42 -0
  48. package/dist/views/transfer-template/components/transfer-template-form/composables/use-template-enabled-locations.d.ts +4 -7
  49. package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-locations.d.ts +2 -2
  50. package/dist/views/transfer-template/composables/use-transfer-template-actions.d.ts +132 -84
  51. package/dist/views/transfer-template/composables/use-transfer-template-table.d.ts +44 -1014
  52. package/dist/views/transfer-template/helpers/remove-deleted-skus.helper.d.ts +11 -7
  53. package/dist/views/warehouse/components/WarehouseForm.vue.d.ts +8 -14
  54. package/dist/{xlsx-DX8dk9eD.js → xlsx-DiOKvJ6l.js} +1 -1
  55. package/dist/{xlsx.util-BaeMOrlY.js → xlsx.util-CZ7zYxdP.js} +2 -2
  56. package/package.json +5 -5
  57. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-CXmk2PYd.js +0 -740
  58. package/dist/TransferDialog.vue_vue_type_script_setup_true_lang-D9XERa2u.js +0 -1409
  59. package/dist/TransferTemplateView-BIsn4jRY.js +0 -1238
  60. package/dist/purchase-order-transaction-type-73S8OLUt.js +0 -702
@@ -0,0 +1,762 @@
1
+ import { f as ae } from "./format-time-from-id-BnmaRuab.js";
2
+ import { computed as re, h as le, defineComponent as Ce, ref as Z, resolveComponent as L, openBlock as d, createBlock as N, unref as s, isRef as Ee, withCtx as ee, createElementVNode as e, createVNode as U, createElementBlock as y, Fragment as W, toDisplayString as n, normalizeClass as te, createCommentVNode as v, renderList as ie } from "vue";
3
+ import { c as ke } from "./TableActionableRow.vue_vue_type_script_setup_true_lang-DlNJ6kRg.js";
4
+ import { D as h, R as p } from "./row-action.enum-PMKMRrZR.js";
5
+ import { B as xe, l as ce, a as ue, a7 as de, aj as g, c as Ne, j as Pe, ae as q, H as Te, G as Fe, E as je, ah as Ie, b as Ue, w as Me } from "./app-BuyAj4kw.js";
6
+ import { F as $e } from "./decimal-DWbwRn_v.js";
7
+ import { f as me, P as se, d as Ke, e as Le } from "./purchase-order-transaction-type-DrFJFvtK.js";
8
+ import { components as Ve, useDialog as Be, useSnackbar as Ge, useProxiedModel as He } from "@feedmepos/ui-library";
9
+ import { useI18n as we } from "@feedmepos/mf-common";
10
+ import { E as ze } from "./empty-placeholder-wf6-BWE8.js";
11
+ function Qe(f, k) {
12
+ return k.reduce(
13
+ (a, P) => {
14
+ const S = P.received.find((C) => C.sku._id === f._id);
15
+ return S && (a = xe(a, S.amount)), a;
16
+ },
17
+ $e.toPrecision(ce(0), f.unit.precision)
18
+ );
19
+ }
20
+ function Ye(f, k) {
21
+ const { name: _, address: a, regNo: P } = k.doc.profile, S = {
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
+ Qe(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: S,
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 Rs(f, k) {
120
+ const _ = Pe(), { t: a } = we();
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[p.Update],
128
+ h[p.Details],
129
+ h[p.Print]
130
+ ];
131
+ case "RECEIVING":
132
+ return [
133
+ H[g.enum.completeReceive],
134
+ h[p.Update],
135
+ h[p.Details],
136
+ h[p.Print]
137
+ ];
138
+ case "REQUESTING":
139
+ return f === "receive/request" ? [
140
+ h[p.Update],
141
+ h[p.Details],
142
+ h[p.Print]
143
+ ] : [
144
+ H[g.enum.approveRequest],
145
+ H[g.enum.rejectRequest],
146
+ h[p.Details],
147
+ h[p.Print]
148
+ ];
149
+ case "PROCESSING":
150
+ return [h[p.Details], h[p.Print]];
151
+ case "COMPLETE":
152
+ return [
153
+ h[p.Update],
154
+ h[p.Details],
155
+ h[p.Print]
156
+ ];
157
+ case "CANCEL":
158
+ default:
159
+ return [h[p.Details], h[p.Print]];
160
+ }
161
+ }
162
+ function S(l) {
163
+ return Object.values(g.enum).includes(l);
164
+ }
165
+ async function C(l, c, i) {
166
+ var T, X;
167
+ const u = Ne(c);
168
+ if (l === p.Print) {
169
+ Ye(u, _.currentLocation);
170
+ return;
171
+ }
172
+ if (l === p.Details) {
173
+ k.promptShowTransferDetails(u, i);
174
+ return;
175
+ }
176
+ if (l === p.Update) {
177
+ (T = k.promptUpdateTransferDialog) == null || T.call(k, u);
178
+ return;
179
+ }
180
+ if (S(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 ke(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(Ve.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 ke(
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 Je = { class: "flex flex-col gap-16 w-full h-full" }, We = { class: "flex justify-between" }, Xe = { class: "fm-typo-en-body-lg-600" }, Ze = { class: "flex flex-col gap-8" }, et = { class: "flex flex-col gap-4" }, tt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, st = { class: "flex gap-1" }, rt = { class: "fm-typo-en-body-lg-600" }, at = {
332
+ key: 0,
333
+ class: "flex flex-col gap-4"
334
+ }, nt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ot = { class: "fm-typo-en-body-lg-600" }, lt = { class: "flex flex-col gap-4" }, it = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ct = { class: "fm-typo-en-body-lg-600" }, ut = {
335
+ key: 1,
336
+ class: "flex flex-col gap-4"
337
+ }, dt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, mt = { class: "fm-typo-en-body-lg-600" }, ft = {
338
+ key: 2,
339
+ class: "flex flex-col gap-4"
340
+ }, vt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, pt = { class: "fm-typo-en-body-lg-600" }, yt = {
341
+ key: 3,
342
+ class: "flex flex-col gap-4"
343
+ }, ht = { class: "fm-typo-en-body-lg-600" }, bt = {
344
+ key: 4,
345
+ class: "flex flex-col gap-4"
346
+ }, gt = { class: "fm-typo-en-body-lg-600" }, _t = {
347
+ key: 5,
348
+ class: "flex flex-col gap-4"
349
+ }, Rt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ot = { class: "fm-typo-en-body-lg-600" }, qt = {
350
+ key: 6,
351
+ class: "flex flex-col gap-4"
352
+ }, kt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, xt = { class: "fm-typo-en-body-lg-600" }, wt = { class: "border border-fm-color-neutral-gray-200 fm-corner-radius-lg p-16" }, St = { class: "flex flex-col gap-8" }, Dt = { class: "fm-typo-en-body-lg-600" }, At = { class: "flex w-full gap-4" }, Ct = { class: "basis-1/2 shrink-0 grow fm-typo-en-body-lg-400 line-clamp-2" }, Et = { class: "fm-typo-en-body-lg-600 line-clamp-2" }, Nt = { class: "flex w-full gap-4 fm-typo-en-body-sm-400" }, Pt = { class: "grow fm-typo-en-body-lg-400 text-fm-color-typo-secondary line-clamp-1" }, Tt = {
353
+ key: 0,
354
+ class: "line-clamp-1 fm-typo-en-body-lg-400 text-fm-color-typo-secondary"
355
+ }, Ft = {
356
+ key: 1,
357
+ class: "flex-1 xs:w-screen xs:max-w-full"
358
+ }, jt = {
359
+ key: 0,
360
+ class: "flex flex-col items-center gap-8 h-full"
361
+ }, It = ["src"], Ut = { class: "fm-typo-en-body-lg-600" }, Mt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary px-16" }, $t = {
362
+ key: 1,
363
+ class: "px-4 flex flex-col"
364
+ }, Kt = { class: "flex gap-12 content-stretch" }, Lt = {
365
+ class: "flex flex-col w-24",
366
+ name: "circles"
367
+ }, Vt = { class: "flex-1 flex flex-col items-center" }, Bt = { class: "flex-1 flex flex-col items-center" }, Gt = {
368
+ class: "py-12 flex flex-col gap-4",
369
+ name: "received-at header"
370
+ }, Ht = { class: "fm-typo-en-body-lg-400" }, zt = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, Qt = { class: "flex gap-12 content-stretch" }, Yt = {
371
+ class: "flex flex-col w-24",
372
+ name: "circles"
373
+ }, Jt = { class: "flex-1 flex flex-col items-center" }, Wt = {
374
+ class: "py-12 flex flex-col gap-4 flex-1",
375
+ name: "delivery details"
376
+ }, Xt = { class: "flex flex-col gap-8" }, Zt = { class: "flex flex-col gap-4" }, es = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, ts = { class: "fm-typo-en-body-lg-600" }, ss = { class: "flex flex-col gap-4" }, rs = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, as = { class: "flex flex-col gap-4" }, ns = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, os = { class: "fm-typo-en-body-lg-600" }, ls = { class: "flex flex-col gap-4" }, is = {
377
+ key: 0,
378
+ class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary"
379
+ }, cs = { class: "fm-typo-en-body-lg-600" }, us = { class: "flex gap-8 xs:flex-col" }, Os = /* @__PURE__ */ Ce({
380
+ __name: "TransferDetails",
381
+ props: {
382
+ purchaseOrder: {},
383
+ transferTo: {},
384
+ transferToDbName: {},
385
+ show: { type: Boolean },
386
+ canResubmit: { type: Boolean },
387
+ canApprove: { type: Boolean }
388
+ },
389
+ emits: ["update:show", "submitted"],
390
+ setup(f, { emit: k }) {
391
+ const _ = f, a = k, P = Be(), S = Ge(), C = Ie(), V = Ue(), { t: o } = we(), M = re(
392
+ () => {
393
+ var t, r, D, b;
394
+ 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;
395
+ }
396
+ ), l = [
397
+ {
398
+ label: o("inventory.transfer.receiveRequest.details.overview"),
399
+ value: "overview"
400
+ },
401
+ {
402
+ label: o("inventory.transfer.receiveRequest.details.deliveryHistory"),
403
+ value: "deliveryHistory"
404
+ }
405
+ ], c = Z(l[0]), i = Z(!1), u = Z(""), T = Z(!0), X = Ke(), ne = He(_, "show");
406
+ async function Se(t, r, D) {
407
+ u.value = r, i.value = !0, T.value = !1;
408
+ try {
409
+ await X.processPurchaseOrder(
410
+ {
411
+ operation: r,
412
+ doc: t,
413
+ options: (
414
+ // auto receive for supplier to warehouse
415
+ (r === g.enum.confirmDraft || // auto receive for warehouse to warehouse
416
+ r === g.enum.completeReceive) && V.autoReceiveWarehouse ? {
417
+ autoReceive: !0
418
+ } : void 0
419
+ )
420
+ },
421
+ _.transferToDbName
422
+ ), await new Promise((b) => setTimeout(b, 1e3)), S.open({
423
+ title: "Success",
424
+ message: D,
425
+ type: "success"
426
+ }), a("update:show", !1), a("submitted");
427
+ } catch (b) {
428
+ S.open({
429
+ title: "Something went wrong",
430
+ message: "Please try again.",
431
+ type: "error"
432
+ }), console.error("Error when submitting PO operation", r, t, b);
433
+ } finally {
434
+ u.value = "", i.value = !1, T.value = !0;
435
+ }
436
+ }
437
+ async function $(t) {
438
+ const r = Le[t];
439
+ if (!r) {
440
+ S.open({
441
+ title: "Something went wrong",
442
+ message: `Cannot process order: ${Me(t)}`,
443
+ type: "error"
444
+ });
445
+ return;
446
+ }
447
+ const { successMessage: D, ...b } = r;
448
+ P.open({
449
+ title: b.title,
450
+ message: b.message,
451
+ primaryActions: b.primaryActions
452
+ }).onPrimary(() => {
453
+ _.purchaseOrder && Se(_.purchaseOrder, t, D);
454
+ });
455
+ }
456
+ const De = re(() => {
457
+ var t, r;
458
+ return ((t = _.purchaseOrder) == null ? void 0 : t.status) === q.enum.RECEIVING || ((r = _.purchaseOrder) == null ? void 0 : r.status) === q.enum.COMPLETE;
459
+ }), Ae = re(() => {
460
+ var z, B, x;
461
+ const D = (((z = _.purchaseOrder) == null ? void 0 : z.deliveryOrder) ?? []).flatMap((O) => O.received ?? []).reduce(
462
+ (O, F) => {
463
+ const G = O[F.sku._id] ?? [];
464
+ return O[F.sku._id] = [...G, F], O;
465
+ },
466
+ {}
467
+ ), b = Object.entries(D).reduce(
468
+ (O, [F, G]) => {
469
+ const E = G.reduce((j, I) => {
470
+ const K = Te(
471
+ j,
472
+ Math.max(j.precision, I.amount.precision)
473
+ );
474
+ return xe(K, I.amount);
475
+ }, ce(0));
476
+ return O[F] = E, O;
477
+ },
478
+ {}
479
+ ), oe = ((B = _.purchaseOrder) == null ? void 0 : B.items) ?? [];
480
+ for (const O of oe)
481
+ b[x = O.sku._id] ?? (b[x] = ce(0));
482
+ return b;
483
+ });
484
+ return (t, r) => {
485
+ var F, G;
486
+ const D = L("FmButtonGroup"), b = L("FmChip"), oe = L("FmMenuDivider"), z = L("FmCard"), B = L("FmSpacer"), x = L("FmButton"), O = L("FmSideSheet");
487
+ return d(), N(O, {
488
+ header: s(o)("inventory.transfer.receiveRequest.details.title") + ((F = t.purchaseOrder) != null && F.seqNumber ? ` #${(G = t.purchaseOrder) == null ? void 0 : G.seqNumber}` : ""),
489
+ modelValue: s(ne),
490
+ "onUpdate:modelValue": r[9] || (r[9] = (E) => Ee(ne) ? ne.value = E : null),
491
+ "dismiss-away": T.value,
492
+ "close-button": "",
493
+ "max-width": 500
494
+ }, {
495
+ default: ee(() => {
496
+ var E, j, I, K, Q, Y;
497
+ return [
498
+ e("div", Je, [
499
+ e("div", null, [
500
+ U(D, {
501
+ items: l,
502
+ modelValue: c.value,
503
+ "onUpdate:modelValue": r[0] || (r[0] = (m) => c.value = m)
504
+ }, null, 8, ["modelValue"])
505
+ ]),
506
+ c.value.value === "overview" ? (d(), y(W, { key: 0 }, [
507
+ U(z, {
508
+ variant: "outlined",
509
+ class: "flex flex-col gap-8 px-12 py-16"
510
+ }, {
511
+ default: ee(() => {
512
+ var m, R, w, J, A, fe, ve, pe, ye, he, be, ge, _e, Re, Oe, qe;
513
+ return [
514
+ e("div", We, [
515
+ e("div", Xe, n(s(o)("inventory.transfer.receiveRequest.details.requestSummary")), 1),
516
+ e("div", null, [
517
+ U(b, {
518
+ label: s(o)(`inventory.transfer.status.${(m = t.purchaseOrder) == null ? void 0 : m.status}`),
519
+ class: te(`fm-status-badge fm-status-badge-${(w = (R = t.purchaseOrder) == null ? void 0 : R.status) == null ? void 0 : w.toLocaleLowerCase("en-us")}`),
520
+ compact: ""
521
+ }, null, 8, ["label", "class"])
522
+ ])
523
+ ]),
524
+ U(oe),
525
+ e("div", Ze, [
526
+ e("div", et, [
527
+ e("div", tt, [
528
+ e("div", st, n(s(o)("inventory.transfer.receiveRequest.details.createdAt")), 1)
529
+ ]),
530
+ e("div", rt, n(s(ae)(((J = t.purchaseOrder) == null ? void 0 : J._id) ?? "")), 1)
531
+ ]),
532
+ (A = t.purchaseOrder) != null && A.effectiveAt ? (d(), y("div", at, [
533
+ e("div", nt, n(s(o)("inventory.transfer.receiveRequest.details.backdatedTo")), 1),
534
+ e("div", ot, n(s(de)(new Date((fe = t.purchaseOrder) == null ? void 0 : fe.effectiveAt))), 1)
535
+ ])) : v("", !0),
536
+ e("div", lt, [
537
+ e("div", it, n(s(o)("inventory.transfer.receiveRequest.details.type.title")), 1),
538
+ e("div", ct, n(s(o)(
539
+ `inventory.transfer.receiveRequest.details.type.${M.value.toLocaleLowerCase("en-US")}`
540
+ )), 1)
541
+ ]),
542
+ (pe = (ve = t.purchaseOrder) == null ? void 0 : ve.supplier) != null && pe.name ? (d(), y("div", ut, [
543
+ e("div", dt, n(s(o)("inventory.transfer.receiveRequest.details.from")), 1),
544
+ e("div", mt, n((he = (ye = t.purchaseOrder) == null ? void 0 : ye.supplier) == null ? void 0 : he.name), 1)
545
+ ])) : v("", !0),
546
+ t.transferTo ? (d(), y("div", ft, [
547
+ e("div", vt, n(s(o)("inventory.transfer.receiveRequest.details.to")), 1),
548
+ e("div", pt, n(t.transferTo), 1)
549
+ ])) : v("", !0),
550
+ s(C).isEnabled ? (d(), y("div", yt, [
551
+ r[10] || (r[10] = e("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " NetSuite Subsidiary ", -1)),
552
+ e("div", ht, n(((ge = (be = t.purchaseOrder) == null ? void 0 : be.netSuite) == null ? void 0 : ge.subsidiary.name) || "-"), 1)
553
+ ])) : v("", !0),
554
+ s(C).isEnabled ? (d(), y("div", bt, [
555
+ r[11] || (r[11] = e("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " NetSuite Transfer Order # ", -1)),
556
+ e("div", gt, n(((Re = (_e = t.purchaseOrder) == null ? void 0 : _e.netSuite) == null ? void 0 : Re.id) || "-"), 1)
557
+ ])) : v("", !0),
558
+ (Oe = t.purchaseOrder) != null && Oe.ref ? (d(), y("div", _t, [
559
+ e("div", Rt, n(s(o)("inventory.transfer.receiveRequest.details.reference")), 1),
560
+ e("div", Ot, n(t.purchaseOrder.ref), 1)
561
+ ])) : v("", !0),
562
+ (qe = t.purchaseOrder) != null && qe.remark ? (d(), y("div", qt, [
563
+ e("div", kt, n(s(o)("inventory.transfer.receiveRequest.details.remark")), 1),
564
+ e("div", xt, n(t.purchaseOrder.remark), 1)
565
+ ])) : v("", !0)
566
+ ])
567
+ ];
568
+ }),
569
+ _: 1
570
+ }),
571
+ e("div", wt, [
572
+ e("div", St, [
573
+ e("div", Dt, n(De.value ? s(o)("inventory.transfer.receiveRequest.details.receivedItems") : s(o)("inventory.transfer.receiveRequest.details.requestedItems")), 1),
574
+ (d(!0), y(W, null, ie(((E = t.purchaseOrder) == null ? void 0 : E.items) ?? [], (m) => (d(), y("div", {
575
+ key: m.code,
576
+ class: "flex flex-col"
577
+ }, [
578
+ e("div", At, [
579
+ e("div", Ct, n(m.name), 1),
580
+ e("div", Et, n(s(ue)(Ae.value[m.sku._id], !1)) + "/" + n(s(me)(m.quantity, m.sku.unit, m.measurement)), 1)
581
+ ]),
582
+ e("div", Nt, [
583
+ e("div", Pt, n(m.code), 1),
584
+ m.totalCost && s(V).enableTotalCost ? (d(), y("div", Tt, " (" + n(s(Fe)(m.totalCost)) + ") ", 1)) : v("", !0)
585
+ ])
586
+ ]))), 128))
587
+ ])
588
+ ])
589
+ ], 64)) : v("", !0),
590
+ c.value.value === "deliveryHistory" ? (d(), y("div", Ft, [
591
+ ((I = (j = t.purchaseOrder) == null ? void 0 : j.deliveryOrder) == null ? void 0 : I.length) === 0 ? (d(), y("div", jt, [
592
+ U(B),
593
+ e("div", null, [
594
+ e("img", {
595
+ src: s(ze),
596
+ alt: "List is empty"
597
+ }, null, 8, It)
598
+ ]),
599
+ e("div", Ut, n(s(o)("inventory.transfer.receiveRequest.details.noRecordsFound")), 1),
600
+ e("div", Mt, n(s(o)("inventory.transfer.receiveRequest.details.trackDeliveryMessage")), 1),
601
+ U(B),
602
+ U(B)
603
+ ])) : v("", !0),
604
+ (K = t.purchaseOrder) != null && K.deliveryOrder && ((Q = t.purchaseOrder) == null ? void 0 : Q.deliveryOrder.length) > 0 ? (d(), y("div", $t, [
605
+ (d(!0), y(W, null, ie((Y = t.purchaseOrder) == null ? void 0 : Y.deliveryOrder, (m, R) => (d(), y(W, { key: R }, [
606
+ e("div", Kt, [
607
+ e("div", Lt, [
608
+ e("div", Vt, [
609
+ e("div", {
610
+ class: te([
611
+ {
612
+ "bg-fm-color-primary": R !== 0,
613
+ "bg-white": R === 0
614
+ },
615
+ "w-[2px] h-full"
616
+ ])
617
+ }, null, 2)
618
+ ]),
619
+ r[12] || (r[12] = e("div", { class: "h-24 w-24 bg-fm-color-primary rounded-full" }, null, -1)),
620
+ e("div", Bt, [
621
+ e("div", {
622
+ class: te([
623
+ {
624
+ "bg-fm-color-primary": R < t.purchaseOrder.deliveryOrder.length - 1,
625
+ "bg-white": R >= t.purchaseOrder.deliveryOrder.length - 1
626
+ },
627
+ "w-[2px] h-full"
628
+ ])
629
+ }, null, 2)
630
+ ])
631
+ ]),
632
+ e("div", Gt, [
633
+ e("div", Ht, n(s(o)("inventory.transfer.receiveRequest.details.received")), 1),
634
+ e("div", zt, n(s(de)(new Date(m.createdAt))) + ", " + n(s(je)(new Date(m.createdAt))), 1)
635
+ ])
636
+ ]),
637
+ e("div", Qt, [
638
+ e("div", Yt, [
639
+ e("div", Jt, [
640
+ e("div", {
641
+ class: te([
642
+ {
643
+ "bg-fm-color-primary": R < t.purchaseOrder.deliveryOrder.length - 1,
644
+ "bg-white": R >= t.purchaseOrder.deliveryOrder.length - 1
645
+ },
646
+ "w-[2px] h-full"
647
+ ])
648
+ }, null, 2)
649
+ ])
650
+ ]),
651
+ e("div", Wt, [
652
+ U(z, {
653
+ variant: "outlined",
654
+ class: "py-12 px-16"
655
+ }, {
656
+ default: ee(() => [
657
+ e("div", Xt, [
658
+ e("div", Zt, [
659
+ e("div", es, n(s(o)("inventory.transfer.receiveRequest.details.receivedBy")), 1),
660
+ e("div", ts, n(m.createdBy.name), 1)
661
+ ]),
662
+ e("div", ss, [
663
+ e("div", rs, n(s(o)("inventory.transfer.receiveRequest.details.receivedItems")), 1),
664
+ (d(!0), y(W, null, ie(m.received, (w) => (d(), y("div", {
665
+ class: "fm-typo-en-body-lg-600",
666
+ key: w.sku._id
667
+ }, n(w.sku.name) + " " + n(s(me)(w.amount, w.sku.unit, w.measurement)), 1))), 128))
668
+ ]),
669
+ e("div", as, [
670
+ e("div", ns, n(s(o)("inventory.transfer.receiveRequest.details.deliveryOrderNo")), 1),
671
+ e("div", os, n(m.deliveryOrderNumber.trim().length ? m.deliveryOrderNumber : "-"), 1)
672
+ ]),
673
+ e("div", ls, [
674
+ m.remark ? (d(), y("div", is, n(s(o)("inventory.transfer.receiveRequest.details.deliveryRemark")), 1)) : v("", !0),
675
+ e("div", cs, n(m.remark), 1)
676
+ ])
677
+ ])
678
+ ]),
679
+ _: 2
680
+ }, 1024)
681
+ ])
682
+ ])
683
+ ], 64))), 128))
684
+ ])) : v("", !0)
685
+ ])) : v("", !0)
686
+ ])
687
+ ];
688
+ }),
689
+ "side-sheet-footer": ee(() => {
690
+ var E, j, I, K, Q, Y, m, R, w, J;
691
+ return [
692
+ e("div", us, [
693
+ ((E = t.purchaseOrder) == null ? void 0 : E.status) === s(q).enum.DRAFT && M.value === s(se).PURCHASE ? (d(), N(x, {
694
+ key: 0,
695
+ label: s(o)("inventory.transfer.receiveRequest.actions.confirmDraft"),
696
+ onClick: r[1] || (r[1] = (A) => $("confirmDraft")),
697
+ loading: u.value === "confirmDraft",
698
+ disabled: u.value !== "confirmDraft" && i.value
699
+ }, null, 8, ["label", "loading", "disabled"])) : v("", !0),
700
+ ((j = t.purchaseOrder) == null ? void 0 : j.status) === s(q).enum.DRAFT && M.value === s(se).TRANSFER ? (d(), N(x, {
701
+ key: 1,
702
+ label: s(o)("inventory.transfer.receiveRequest.actions.submitRequest"),
703
+ onClick: r[2] || (r[2] = (A) => $("submitRequest")),
704
+ loading: u.value === "submitRequest",
705
+ disabled: u.value !== "submitRequest" && i.value
706
+ }, null, 8, ["label", "loading", "disabled"])) : v("", !0),
707
+ ((I = t.purchaseOrder) == null ? void 0 : I.status) === s(q).enum.DRAFT ? (d(), N(x, {
708
+ key: 2,
709
+ label: s(o)("inventory.transfer.receiveRequest.actions.cancelDraft"),
710
+ onClick: r[3] || (r[3] = (A) => $("cancelDraft")),
711
+ loading: u.value === "cancelDraft",
712
+ disabled: u.value !== "cancelDraft" && i.value,
713
+ variant: "destructive"
714
+ }, null, 8, ["label", "loading", "disabled"])) : v("", !0),
715
+ ((K = t.purchaseOrder) == null ? void 0 : K.status) === s(q).enum.RECEIVING ? (d(), N(x, {
716
+ key: 3,
717
+ label: s(o)("inventory.transfer.receiveRequest.actions.completeReceive"),
718
+ onClick: r[4] || (r[4] = (A) => $("completeReceive")),
719
+ loading: u.value === "completeReceive",
720
+ disabled: u.value !== "completeReceive" && i.value
721
+ }, null, 8, ["label", "loading", "disabled"])) : v("", !0),
722
+ t.canResubmit ? (d(), N(x, {
723
+ key: 4,
724
+ label: s(o)("inventory.transfer.receiveRequest.actions.resubmitRequest"),
725
+ onClick: r[5] || (r[5] = (A) => $("submitRequest")),
726
+ loading: u.value === "submitRequest",
727
+ disabled: u.value !== "submitRequest" && i.value
728
+ }, null, 8, ["label", "loading", "disabled"])) : v("", !0),
729
+ (((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, {
730
+ key: 5,
731
+ label: s(o)("inventory.transfer.approval.actions.approveRequest"),
732
+ onClick: r[6] || (r[6] = (A) => $("approveRequest")),
733
+ loading: u.value === "approveRequest",
734
+ disabled: u.value !== "approveRequest" && i.value
735
+ }, null, 8, ["label", "loading", "disabled"])) : v("", !0),
736
+ ((m = t.purchaseOrder) == null ? void 0 : m.status) === s(q).enum.REQUESTING && t.canApprove ? (d(), N(x, {
737
+ key: 6,
738
+ label: s(o)("inventory.transfer.approval.actions.rejectRequest"),
739
+ onClick: r[7] || (r[7] = (A) => $("rejectRequest")),
740
+ loading: u.value === "rejectRequest",
741
+ disabled: u.value !== "rejectRequest" && i.value,
742
+ variant: "destructive"
743
+ }, null, 8, ["label", "loading", "disabled"])) : v("", !0),
744
+ ((R = t.purchaseOrder) == null ? void 0 : R.status) !== s(q).enum.COMPLETE && ((w = t.purchaseOrder) == null ? void 0 : w.status) !== s(q).enum.CANCEL && (((J = t.purchaseOrder) == null ? void 0 : J.status) !== s(q).enum.REQUESTING || t.canApprove) ? (d(), N(x, {
745
+ key: 7,
746
+ label: s(o)("common.close"),
747
+ variant: "tertiary",
748
+ onClick: r[8] || (r[8] = (A) => a("update:show", !1))
749
+ }, null, 8, ["label"])) : v("", !0)
750
+ ])
751
+ ];
752
+ }),
753
+ _: 1
754
+ }, 8, ["header", "modelValue", "dismiss-away"]);
755
+ };
756
+ }
757
+ });
758
+ export {
759
+ Os as _,
760
+ Qe as g,
761
+ Rs as u
762
+ };