@feedmepos/mf-inventory-portal 0.0.22-dev.6 → 0.0.22-dev.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/dist/{ApprovalView-C3pfc3dI.js → ApprovalView-BNeTV3TV.js} +4 -4
  2. package/dist/{BindingsDialog-B5Wslo-f.js → BindingsDialog-pBelBtiH.js} +1 -1
  3. package/dist/{BindingsPicker-DvI3H5lb.js → BindingsPicker-VHr76FFM.js} +19 -19
  4. package/dist/{BindingsTable-B6yXjwVZ.js → BindingsTable-CgIp6DKB.js} +1 -1
  5. package/dist/ClosingTemplateView-FleQasJi.js +1065 -0
  6. package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-BTw7Szfi.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-BYfojQsH.js} +1 -1
  7. package/dist/{IngredientsView-J-HwciIj.js → IngredientsView-BEW8_MJ0.js} +3 -3
  8. package/dist/{IntegrationView-CJgc6NQo.js → IntegrationView-NnpJ8nYO.js} +2 -2
  9. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-CzCVf08r.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-CJMb1aR1.js} +1 -1
  10. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-BJHZI0SZ.js → PremiumBadge.vue_vue_type_script_setup_true_lang-DWSq3JsJ.js} +1 -1
  11. package/dist/{PurchaseOrderPrintPreview-DQlHM7ar.js → PurchaseOrderPrintPreview-BZ5uhyRy.js} +1 -1
  12. package/dist/{ReceiveRequestView-l-agN7yj.js → ReceiveRequestView-DN9u5HLn.js} +6 -6
  13. package/dist/{RecipeView-Bo85tc7w.js → RecipeView-DM20cOk3.js} +3 -3
  14. package/dist/{StockView-CqORznbJ.js → StockView-LppKR-nM.js} +6 -6
  15. package/dist/{SupplierView-BSc10_7O.js → SupplierView-DHh6MhoI.js} +37 -37
  16. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-KHwccWdi.js +754 -0
  17. package/dist/TransferDialog.vue_vue_type_script_setup_true_lang-2QZK3Iu5.js +1485 -0
  18. package/dist/TransferTemplateView-CUQSQR8U.js +1278 -0
  19. package/dist/{UnitView-C4Ynhnes.js → UnitView-D8XJca7H.js} +4 -4
  20. package/dist/{WarehouseView-CXhsdB6L.js → WarehouseView-DTnx3-Fi.js} +2 -2
  21. package/dist/api/inventory.d.ts +1 -0
  22. package/dist/api/netsuite.d.ts +40 -0
  23. package/dist/api/purchase-order-template.d.ts +0 -4
  24. package/dist/{app-CEx_CAFE.js → app-Cn0UYdAW.js} +8183 -7946
  25. package/dist/app.d.ts +6 -0
  26. package/dist/app.js +3 -3
  27. package/dist/{decimal-c4am8-9x.js → decimal-BiLgcnqq.js} +1 -1
  28. package/dist/{defineDeepModel-DstjIWV3.js → defineDeepModel-CXCb8GcR.js} +4 -4
  29. package/dist/{format-time-from-id-C7eIbCJx.js → format-time-from-id-5QzQNKlI.js} +1 -1
  30. package/dist/{id-to-date-BvvYzy9E.js → id-to-date-C-LYuoim.js} +1 -1
  31. package/dist/purchase-order-transaction-type-BV80Rx9h.js +676 -0
  32. package/dist/stores/api.d.ts +1 -0
  33. package/dist/stores/helper/core-store-proxy.d.ts +27 -0
  34. package/dist/stores/helper/generate-backend-urls.d.ts +1 -0
  35. package/dist/stores/netsuite.d.ts +49 -0
  36. package/dist/style.css +1 -1
  37. package/dist/{supplier-Buou9AeW.js → supplier-Bg9MjX_y.js} +1 -1
  38. package/dist/tsconfig.app.tsbuildinfo +1 -1
  39. package/dist/use-template-enabled-locations-2-CzY-UFrc.js +85 -0
  40. package/dist/views/receive-request/components/transfer-form/TransferForm.vue.d.ts +14 -0
  41. package/dist/views/receive-request/composables/use-receive-request-form.d.ts +42 -0
  42. package/dist/views/receive-request/composables/use-receive-request-table.d.ts +42 -0
  43. package/dist/views/transfer-template/components/transfer-template-form/composables/use-template-enabled-locations-2.d.ts +13 -0
  44. package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-locations.d.ts +2 -2
  45. package/dist/views/transfer-template/composables/use-transfer-template-actions.d.ts +84 -0
  46. package/dist/views/transfer-template/composables/use-transfer-template-table.d.ts +28 -986
  47. package/dist/views/transfer-template/helpers/remove-deleted-skus.helper.d.ts +7 -0
  48. package/dist/{xlsx-_u-mXW67.js → xlsx-BsdfXPiA.js} +1 -1
  49. package/dist/{xlsx.util-C_mH9WMn.js → xlsx.util-B_ynXZ3Q.js} +2 -2
  50. package/package.json +5 -5
  51. package/dist/ClosingTemplateView-YW5Sw9M5.js +0 -1030
  52. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-qfnlbLSa.js +0 -740
  53. package/dist/TransferDialog.vue_vue_type_script_setup_true_lang-CW4b6og_.js +0 -1409
  54. package/dist/TransferTemplateView-Djn47L76.js +0 -1230
  55. package/dist/purchase-order-transaction-type-DpJe0L78.js +0 -702
  56. package/dist/use-template-enabled-locations-BPap1ER6.js +0 -57
@@ -0,0 +1,754 @@
1
+ import { f as ae } from "./format-time-from-id-5QzQNKlI.js";
2
+ import { computed as re, h as qe, defineComponent as Ee, ref as Z, resolveComponent as L, openBlock as d, createBlock as N, unref as s, isRef as Ne, 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 le } 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 v } from "./row-action.enum-PMKMRrZR.js";
5
+ import { B as we, l as ie, a as ce, a7 as ue, aj as g, c as Pe, j as Te, ae as q, H as Fe, G as je, E as Ie, ah as Ue, b as Me, w as $e } from "./app-Cn0UYdAW.js";
6
+ import { F as Ke } from "./decimal-BiLgcnqq.js";
7
+ import { f as de, P as se, d as Le, e as Ve } from "./purchase-order-transaction-type-BV80Rx9h.js";
8
+ import { components as xe, useDialog as Be, useSnackbar as Ge, useProxiedModel as He } from "@feedmepos/ui-library";
9
+ import { useI18n as Se } 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((A) => A.sku._id === f._id);
15
+ return S && (a = we(a, S.amount)), a;
16
+ },
17
+ Ke.toPrecision(ie(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
+ }, 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
+ }, V = f.items.map((c) => {
40
+ const { sku: i, measurement: u } = c, T = ce(
41
+ Qe(c.sku, f.deliveryOrder || []),
42
+ !1
43
+ );
44
+ return {
45
+ code: i.code,
46
+ description: i.name,
47
+ quantity: de(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: ue(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: ce(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: A,
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 _ = Te(), { t: a } = Se();
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 S(l) {
163
+ return Object.values(g.enum).includes(l);
164
+ }
165
+ async function A(l, c, i) {
166
+ var T, X;
167
+ const u = Pe(c);
168
+ if (l === v.Print) {
169
+ Ye(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 (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 qe(xe.FmChip, {
228
+ label: c,
229
+ class: `fm-status-badge fm-status-badge-${i}`,
230
+ compact: !0
231
+ });
232
+ },
233
+ enableSorting: !0,
234
+ size: 200
235
+ },
236
+ {
237
+ id: "action",
238
+ cell(l) {
239
+ const c = l.row.original, i = P(c);
240
+ return ke(i, (u) => A(u, c));
241
+ },
242
+ enableSorting: !1,
243
+ size: 40,
244
+ meta: {
245
+ cellClass: "",
246
+ headerClass: ""
247
+ }
248
+ }
249
+ ];
250
+ }
251
+ function o() {
252
+ return [
253
+ {
254
+ accessorKey: "purchaseOrder.seqNumber",
255
+ header: () => a("inventory.transfer.table.seqNo"),
256
+ enableSorting: !0,
257
+ size: 80,
258
+ sortUndefined: "last"
259
+ },
260
+ {
261
+ accessorKey: "purchaseOrder._id",
262
+ header: () => a("inventory.transfer.table.createdAt"),
263
+ cell(l) {
264
+ return ae(`${l.getValue()}`);
265
+ },
266
+ enableSorting: !0
267
+ },
268
+ {
269
+ accessorKey: "to.name",
270
+ header: () => a("inventory.transfer.table.transferTo"),
271
+ enableSorting: !1,
272
+ size: 200
273
+ },
274
+ {
275
+ accessorKey: "purchaseOrder.items.length",
276
+ header: () => a("inventory.transfer.table.noOfItems"),
277
+ enableSorting: !1
278
+ },
279
+ {
280
+ accessorKey: "purchaseOrder.ref",
281
+ header: () => a("inventory.transfer.table.reference"),
282
+ enableSorting: !1,
283
+ size: "auto"
284
+ },
285
+ {
286
+ accessorKey: "purchaseOrder.status",
287
+ header: () => a("inventory.transfer.table.status"),
288
+ cell(l) {
289
+ const c = a(`inventory.transfer.status.${l.getValue() ?? ""}`), i = `${l.getValue() ?? ""}`.toLocaleLowerCase("en-us");
290
+ return qe(xe.FmChip, {
291
+ label: c,
292
+ class: `fm-status-badge fm-status-badge-${i}`,
293
+ compact: !0
294
+ });
295
+ },
296
+ enableSorting: !0
297
+ },
298
+ {
299
+ id: "action",
300
+ cell(l) {
301
+ const c = l.row.original, i = c.purchaseOrder ? P(c.purchaseOrder) : [];
302
+ return ke(
303
+ i,
304
+ (u) => c.purchaseOrder ? A(u, c.purchaseOrder, c) : void 0
305
+ );
306
+ },
307
+ enableSorting: !1,
308
+ size: 40,
309
+ meta: {
310
+ cellClass: "",
311
+ headerClass: ""
312
+ }
313
+ }
314
+ ];
315
+ }
316
+ const M = re(() => f === "receive/request" ? V() : o());
317
+ return {
318
+ get columnDefs() {
319
+ return M.value;
320
+ }
321
+ };
322
+ }
323
+ 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 = {
324
+ key: 0,
325
+ class: "flex flex-col gap-4"
326
+ }, 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 = {
327
+ key: 1,
328
+ class: "flex flex-col gap-4"
329
+ }, dt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, mt = { class: "fm-typo-en-body-lg-600" }, ft = {
330
+ key: 2,
331
+ class: "flex flex-col gap-4"
332
+ }, pt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, vt = { class: "fm-typo-en-body-lg-600" }, yt = {
333
+ key: 3,
334
+ class: "flex flex-col gap-4"
335
+ }, ht = { class: "fm-typo-en-body-lg-600" }, bt = {
336
+ key: 4,
337
+ class: "flex flex-col gap-4"
338
+ }, gt = { class: "fm-typo-en-body-lg-600" }, _t = {
339
+ key: 5,
340
+ class: "flex flex-col gap-4"
341
+ }, Rt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ot = { class: "fm-typo-en-body-lg-600" }, qt = {
342
+ key: 6,
343
+ class: "flex flex-col gap-4"
344
+ }, 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" }, Ct = { class: "flex w-full gap-4" }, At = { 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 = {
345
+ key: 0,
346
+ class: "line-clamp-1 fm-typo-en-body-lg-400 text-fm-color-typo-secondary"
347
+ }, Ft = {
348
+ key: 1,
349
+ class: "flex-1 xs:w-screen xs:max-w-full"
350
+ }, jt = {
351
+ key: 0,
352
+ class: "flex flex-col items-center gap-8 h-full"
353
+ }, 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 = {
354
+ key: 1,
355
+ class: "px-4 flex flex-col"
356
+ }, Kt = { class: "flex gap-12 content-stretch" }, Lt = {
357
+ class: "flex flex-col w-24",
358
+ name: "circles"
359
+ }, Vt = { class: "flex-1 flex flex-col items-center" }, Bt = { class: "flex-1 flex flex-col items-center" }, Gt = {
360
+ class: "py-12 flex flex-col gap-4",
361
+ name: "received-at header"
362
+ }, 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 = {
363
+ class: "flex flex-col w-24",
364
+ name: "circles"
365
+ }, Jt = { class: "flex-1 flex flex-col items-center" }, Wt = {
366
+ class: "py-12 flex flex-col gap-4 flex-1",
367
+ name: "delivery details"
368
+ }, 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 = {
369
+ key: 0,
370
+ class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary"
371
+ }, cs = { class: "fm-typo-en-body-lg-600" }, us = { class: "flex gap-8 xs:flex-col" }, Os = /* @__PURE__ */ Ee({
372
+ __name: "TransferDetails",
373
+ props: {
374
+ purchaseOrder: {},
375
+ transferTo: {},
376
+ transferToDbName: {},
377
+ show: { type: Boolean },
378
+ canResubmit: { type: Boolean },
379
+ canApprove: { type: Boolean }
380
+ },
381
+ emits: ["update:show", "submitted"],
382
+ setup(f, { emit: k }) {
383
+ const _ = f, a = k, P = Be(), S = Ge(), A = Ue(), V = Me(), { t: o } = Se(), M = re(
384
+ () => {
385
+ var t, r, D, b;
386
+ 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;
387
+ }
388
+ ), l = [
389
+ {
390
+ label: o("inventory.transfer.receiveRequest.details.overview"),
391
+ value: "overview"
392
+ },
393
+ {
394
+ label: o("inventory.transfer.receiveRequest.details.deliveryHistory"),
395
+ value: "deliveryHistory"
396
+ }
397
+ ], c = Z(l[0]), i = Z(!1), u = Z(""), T = Z(!0), X = Le(), ne = He(_, "show");
398
+ async function De(t, r, D) {
399
+ u.value = r, i.value = !0, T.value = !1;
400
+ try {
401
+ await X.processPurchaseOrder(
402
+ {
403
+ operation: r,
404
+ doc: t,
405
+ options: (
406
+ // auto receive for supplier to warehouse
407
+ (r === g.enum.confirmDraft || // auto receive for warehouse to warehouse
408
+ r === g.enum.completeReceive) && V.autoReceiveWarehouse ? {
409
+ autoReceive: !0
410
+ } : void 0
411
+ )
412
+ },
413
+ _.transferToDbName
414
+ ), await new Promise((b) => setTimeout(b, 1e3)), S.open({
415
+ title: "Success",
416
+ message: D,
417
+ type: "success"
418
+ }), a("update:show", !1), a("submitted");
419
+ } catch (b) {
420
+ S.open({
421
+ title: "Something went wrong",
422
+ message: "Please try again.",
423
+ type: "error"
424
+ }), console.error("Error when submitting PO operation", r, t, b);
425
+ } finally {
426
+ u.value = "", i.value = !1, T.value = !0;
427
+ }
428
+ }
429
+ async function $(t) {
430
+ const r = Ve[t];
431
+ if (!r) {
432
+ S.open({
433
+ title: "Something went wrong",
434
+ message: `Cannot process order: ${$e(t)}`,
435
+ type: "error"
436
+ });
437
+ return;
438
+ }
439
+ const { successMessage: D, ...b } = r;
440
+ P.open({
441
+ title: b.title,
442
+ message: b.message,
443
+ primaryActions: b.primaryActions
444
+ }).onPrimary(() => {
445
+ _.purchaseOrder && De(_.purchaseOrder, t, D);
446
+ });
447
+ }
448
+ const Ce = re(() => {
449
+ var t, r;
450
+ return ((t = _.purchaseOrder) == null ? void 0 : t.status) === q.enum.RECEIVING || ((r = _.purchaseOrder) == null ? void 0 : r.status) === q.enum.COMPLETE;
451
+ }), Ae = re(() => {
452
+ var z, B, x;
453
+ const D = (((z = _.purchaseOrder) == null ? void 0 : z.deliveryOrder) ?? []).flatMap((O) => O.received ?? []).reduce(
454
+ (O, F) => {
455
+ const G = O[F.sku._id] ?? [];
456
+ return O[F.sku._id] = [...G, F], O;
457
+ },
458
+ {}
459
+ ), b = Object.entries(D).reduce(
460
+ (O, [F, G]) => {
461
+ const E = G.reduce((j, I) => {
462
+ const K = Fe(
463
+ j,
464
+ Math.max(j.precision, I.amount.precision)
465
+ );
466
+ return we(K, I.amount);
467
+ }, ie(0));
468
+ return O[F] = E, O;
469
+ },
470
+ {}
471
+ ), oe = ((B = _.purchaseOrder) == null ? void 0 : B.items) ?? [];
472
+ for (const O of oe)
473
+ b[x = O.sku._id] ?? (b[x] = ie(0));
474
+ return b;
475
+ });
476
+ return (t, r) => {
477
+ var F, G;
478
+ const D = L("FmButtonGroup"), b = L("FmChip"), oe = L("FmMenuDivider"), z = L("FmCard"), B = L("FmSpacer"), x = L("FmButton"), O = L("FmSideSheet");
479
+ return d(), N(O, {
480
+ header: s(o)("inventory.transfer.receiveRequest.details.title") + ((F = t.purchaseOrder) != null && F.seqNumber ? ` #${(G = t.purchaseOrder) == null ? void 0 : G.seqNumber}` : ""),
481
+ modelValue: s(ne),
482
+ "onUpdate:modelValue": r[9] || (r[9] = (E) => Ne(ne) ? ne.value = E : null),
483
+ "dismiss-away": T.value,
484
+ "close-button": "",
485
+ "max-width": 500
486
+ }, {
487
+ default: ee(() => {
488
+ var E, j, I, K, Q, Y;
489
+ return [
490
+ e("div", Je, [
491
+ e("div", null, [
492
+ U(D, {
493
+ items: l,
494
+ modelValue: c.value,
495
+ "onUpdate:modelValue": r[0] || (r[0] = (m) => c.value = m)
496
+ }, null, 8, ["modelValue"])
497
+ ]),
498
+ c.value.value === "overview" ? (d(), y(W, { key: 0 }, [
499
+ U(z, {
500
+ variant: "outlined",
501
+ class: "flex flex-col gap-8 px-12 py-16"
502
+ }, {
503
+ default: ee(() => {
504
+ var m, R, w, J, C, me, fe, pe, ve, ye, he, be, ge, _e, Re, Oe;
505
+ return [
506
+ e("div", We, [
507
+ e("div", Xe, n(s(o)("inventory.transfer.receiveRequest.details.requestSummary")), 1),
508
+ e("div", null, [
509
+ U(b, {
510
+ label: s(o)(`inventory.transfer.status.${(m = t.purchaseOrder) == null ? void 0 : m.status}`),
511
+ class: te(`fm-status-badge fm-status-badge-${(w = (R = t.purchaseOrder) == null ? void 0 : R.status) == null ? void 0 : w.toLocaleLowerCase("en-us")}`),
512
+ compact: ""
513
+ }, null, 8, ["label", "class"])
514
+ ])
515
+ ]),
516
+ U(oe),
517
+ e("div", Ze, [
518
+ e("div", et, [
519
+ e("div", tt, [
520
+ e("div", st, n(s(o)("inventory.transfer.receiveRequest.details.createdAt")), 1)
521
+ ]),
522
+ e("div", rt, n(s(ae)(((J = t.purchaseOrder) == null ? void 0 : J._id) ?? "")), 1)
523
+ ]),
524
+ (C = t.purchaseOrder) != null && C.effectiveAt ? (d(), y("div", at, [
525
+ e("div", nt, n(s(o)("inventory.transfer.receiveRequest.details.backdatedTo")), 1),
526
+ e("div", ot, n(s(ue)(new Date((me = t.purchaseOrder) == null ? void 0 : me.effectiveAt))), 1)
527
+ ])) : p("", !0),
528
+ e("div", lt, [
529
+ e("div", it, n(s(o)("inventory.transfer.receiveRequest.details.type.title")), 1),
530
+ e("div", ct, n(s(o)(
531
+ `inventory.transfer.receiveRequest.details.type.${M.value.toLocaleLowerCase("en-US")}`
532
+ )), 1)
533
+ ]),
534
+ (pe = (fe = t.purchaseOrder) == null ? void 0 : fe.supplier) != null && pe.name ? (d(), y("div", ut, [
535
+ e("div", dt, n(s(o)("inventory.transfer.receiveRequest.details.from")), 1),
536
+ e("div", mt, n((ye = (ve = t.purchaseOrder) == null ? void 0 : ve.supplier) == null ? void 0 : ye.name), 1)
537
+ ])) : p("", !0),
538
+ t.transferTo ? (d(), y("div", ft, [
539
+ e("div", pt, n(s(o)("inventory.transfer.receiveRequest.details.to")), 1),
540
+ e("div", vt, n(t.transferTo), 1)
541
+ ])) : p("", !0),
542
+ s(A).isEnabled ? (d(), y("div", yt, [
543
+ r[10] || (r[10] = e("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " NetSuite Subsidiary ", -1)),
544
+ e("div", ht, n(((be = (he = t.purchaseOrder) == null ? void 0 : he.netSuite) == null ? void 0 : be.subsidiary.name) || "-"), 1)
545
+ ])) : p("", !0),
546
+ s(A).isEnabled ? (d(), y("div", bt, [
547
+ r[11] || (r[11] = e("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " NetSuite Transfer Order # ", -1)),
548
+ e("div", gt, n(((_e = (ge = t.purchaseOrder) == null ? void 0 : ge.netSuite) == null ? void 0 : _e.id) || "-"), 1)
549
+ ])) : p("", !0),
550
+ (Re = t.purchaseOrder) != null && Re.ref ? (d(), y("div", _t, [
551
+ e("div", Rt, n(s(o)("inventory.transfer.receiveRequest.details.reference")), 1),
552
+ e("div", Ot, n(t.purchaseOrder.ref), 1)
553
+ ])) : p("", !0),
554
+ (Oe = t.purchaseOrder) != null && Oe.remark ? (d(), y("div", qt, [
555
+ e("div", kt, n(s(o)("inventory.transfer.receiveRequest.details.remark")), 1),
556
+ e("div", xt, n(t.purchaseOrder.remark), 1)
557
+ ])) : p("", !0)
558
+ ])
559
+ ];
560
+ }),
561
+ _: 1
562
+ }),
563
+ e("div", wt, [
564
+ e("div", St, [
565
+ e("div", Dt, n(Ce.value ? s(o)("inventory.transfer.receiveRequest.details.receivedItems") : s(o)("inventory.transfer.receiveRequest.details.requestedItems")), 1),
566
+ (d(!0), y(W, null, le(((E = t.purchaseOrder) == null ? void 0 : E.items) ?? [], (m) => (d(), y("div", {
567
+ key: m.code,
568
+ class: "flex flex-col"
569
+ }, [
570
+ e("div", Ct, [
571
+ e("div", At, n(m.name), 1),
572
+ e("div", Et, n(s(ce)(Ae.value[m.sku._id], !1)) + "/" + n(s(de)(m.quantity, m.sku.unit, m.measurement)), 1)
573
+ ]),
574
+ e("div", Nt, [
575
+ e("div", Pt, n(m.code), 1),
576
+ m.totalCost && s(V).enableTotalCost ? (d(), y("div", Tt, " (" + n(s(je)(m.totalCost)) + ") ", 1)) : p("", !0)
577
+ ])
578
+ ]))), 128))
579
+ ])
580
+ ])
581
+ ], 64)) : p("", !0),
582
+ c.value.value === "deliveryHistory" ? (d(), y("div", Ft, [
583
+ ((I = (j = t.purchaseOrder) == null ? void 0 : j.deliveryOrder) == null ? void 0 : I.length) === 0 ? (d(), y("div", jt, [
584
+ U(B),
585
+ e("div", null, [
586
+ e("img", {
587
+ src: s(ze),
588
+ alt: "List is empty"
589
+ }, null, 8, It)
590
+ ]),
591
+ e("div", Ut, n(s(o)("inventory.transfer.receiveRequest.details.noRecordsFound")), 1),
592
+ e("div", Mt, n(s(o)("inventory.transfer.receiveRequest.details.trackDeliveryMessage")), 1),
593
+ U(B),
594
+ U(B)
595
+ ])) : p("", !0),
596
+ (K = t.purchaseOrder) != null && K.deliveryOrder && ((Q = t.purchaseOrder) == null ? void 0 : Q.deliveryOrder.length) > 0 ? (d(), y("div", $t, [
597
+ (d(!0), y(W, null, le((Y = t.purchaseOrder) == null ? void 0 : Y.deliveryOrder, (m, R) => (d(), y(W, { key: R }, [
598
+ e("div", Kt, [
599
+ e("div", Lt, [
600
+ e("div", Vt, [
601
+ e("div", {
602
+ class: te([
603
+ {
604
+ "bg-fm-color-primary": R !== 0,
605
+ "bg-white": R === 0
606
+ },
607
+ "w-[2px] h-full"
608
+ ])
609
+ }, null, 2)
610
+ ]),
611
+ r[12] || (r[12] = e("div", { class: "h-24 w-24 bg-fm-color-primary rounded-full" }, null, -1)),
612
+ e("div", Bt, [
613
+ e("div", {
614
+ class: te([
615
+ {
616
+ "bg-fm-color-primary": R < t.purchaseOrder.deliveryOrder.length - 1,
617
+ "bg-white": R >= t.purchaseOrder.deliveryOrder.length - 1
618
+ },
619
+ "w-[2px] h-full"
620
+ ])
621
+ }, null, 2)
622
+ ])
623
+ ]),
624
+ e("div", Gt, [
625
+ e("div", Ht, n(s(o)("inventory.transfer.receiveRequest.details.received")), 1),
626
+ e("div", zt, n(s(ue)(new Date(m.createdAt))) + ", " + n(s(Ie)(new Date(m.createdAt))), 1)
627
+ ])
628
+ ]),
629
+ e("div", Qt, [
630
+ e("div", Yt, [
631
+ e("div", Jt, [
632
+ e("div", {
633
+ class: te([
634
+ {
635
+ "bg-fm-color-primary": R < t.purchaseOrder.deliveryOrder.length - 1,
636
+ "bg-white": R >= t.purchaseOrder.deliveryOrder.length - 1
637
+ },
638
+ "w-[2px] h-full"
639
+ ])
640
+ }, null, 2)
641
+ ])
642
+ ]),
643
+ e("div", Wt, [
644
+ U(z, {
645
+ variant: "outlined",
646
+ class: "py-12 px-16"
647
+ }, {
648
+ default: ee(() => [
649
+ e("div", Xt, [
650
+ e("div", Zt, [
651
+ e("div", es, n(s(o)("inventory.transfer.receiveRequest.details.receivedBy")), 1),
652
+ e("div", ts, n(m.createdBy.name), 1)
653
+ ]),
654
+ e("div", ss, [
655
+ e("div", rs, n(s(o)("inventory.transfer.receiveRequest.details.receivedItems")), 1),
656
+ (d(!0), y(W, null, le(m.received, (w) => (d(), y("div", {
657
+ class: "fm-typo-en-body-lg-600",
658
+ key: w.sku._id
659
+ }, n(w.sku.name) + " " + n(s(de)(w.amount, w.sku.unit, w.measurement)), 1))), 128))
660
+ ]),
661
+ e("div", as, [
662
+ e("div", ns, n(s(o)("inventory.transfer.receiveRequest.details.deliveryOrderNo")), 1),
663
+ e("div", os, n(m.deliveryOrderNumber.trim().length ? m.deliveryOrderNumber : "-"), 1)
664
+ ]),
665
+ e("div", ls, [
666
+ m.remark ? (d(), y("div", is, n(s(o)("inventory.transfer.receiveRequest.details.deliveryRemark")), 1)) : p("", !0),
667
+ e("div", cs, n(m.remark), 1)
668
+ ])
669
+ ])
670
+ ]),
671
+ _: 2
672
+ }, 1024)
673
+ ])
674
+ ])
675
+ ], 64))), 128))
676
+ ])) : p("", !0)
677
+ ])) : p("", !0)
678
+ ])
679
+ ];
680
+ }),
681
+ "side-sheet-footer": ee(() => {
682
+ var E, j, I, K, Q, Y, m, R, w, J;
683
+ return [
684
+ e("div", us, [
685
+ ((E = t.purchaseOrder) == null ? void 0 : E.status) === s(q).enum.DRAFT && M.value === s(se).PURCHASE ? (d(), N(x, {
686
+ key: 0,
687
+ label: s(o)("inventory.transfer.receiveRequest.actions.confirmDraft"),
688
+ onClick: r[1] || (r[1] = (C) => $("confirmDraft")),
689
+ loading: u.value === "confirmDraft",
690
+ disabled: u.value !== "confirmDraft" && i.value
691
+ }, null, 8, ["label", "loading", "disabled"])) : p("", !0),
692
+ ((j = t.purchaseOrder) == null ? void 0 : j.status) === s(q).enum.DRAFT && M.value === s(se).TRANSFER ? (d(), N(x, {
693
+ key: 1,
694
+ label: s(o)("inventory.transfer.receiveRequest.actions.submitRequest"),
695
+ onClick: r[2] || (r[2] = (C) => $("submitRequest")),
696
+ loading: u.value === "submitRequest",
697
+ disabled: u.value !== "submitRequest" && i.value
698
+ }, null, 8, ["label", "loading", "disabled"])) : p("", !0),
699
+ ((I = t.purchaseOrder) == null ? void 0 : I.status) === s(q).enum.DRAFT ? (d(), N(x, {
700
+ key: 2,
701
+ label: s(o)("inventory.transfer.receiveRequest.actions.cancelDraft"),
702
+ onClick: r[3] || (r[3] = (C) => $("cancelDraft")),
703
+ loading: u.value === "cancelDraft",
704
+ disabled: u.value !== "cancelDraft" && i.value,
705
+ variant: "destructive"
706
+ }, null, 8, ["label", "loading", "disabled"])) : p("", !0),
707
+ ((K = t.purchaseOrder) == null ? void 0 : K.status) === s(q).enum.RECEIVING ? (d(), N(x, {
708
+ key: 3,
709
+ label: s(o)("inventory.transfer.receiveRequest.actions.completeReceive"),
710
+ onClick: r[4] || (r[4] = (C) => $("completeReceive")),
711
+ loading: u.value === "completeReceive",
712
+ disabled: u.value !== "completeReceive" && i.value
713
+ }, null, 8, ["label", "loading", "disabled"])) : p("", !0),
714
+ t.canResubmit ? (d(), N(x, {
715
+ key: 4,
716
+ label: s(o)("inventory.transfer.receiveRequest.actions.resubmitRequest"),
717
+ onClick: r[5] || (r[5] = (C) => $("submitRequest")),
718
+ loading: u.value === "submitRequest",
719
+ disabled: u.value !== "submitRequest" && i.value
720
+ }, null, 8, ["label", "loading", "disabled"])) : p("", !0),
721
+ (((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, {
722
+ key: 5,
723
+ label: s(o)("inventory.transfer.approval.actions.approveRequest"),
724
+ onClick: r[6] || (r[6] = (C) => $("approveRequest")),
725
+ loading: u.value === "approveRequest",
726
+ disabled: u.value !== "approveRequest" && i.value
727
+ }, null, 8, ["label", "loading", "disabled"])) : p("", !0),
728
+ ((m = t.purchaseOrder) == null ? void 0 : m.status) === s(q).enum.REQUESTING && t.canApprove ? (d(), N(x, {
729
+ key: 6,
730
+ label: s(o)("inventory.transfer.approval.actions.rejectRequest"),
731
+ onClick: r[7] || (r[7] = (C) => $("rejectRequest")),
732
+ loading: u.value === "rejectRequest",
733
+ disabled: u.value !== "rejectRequest" && i.value,
734
+ variant: "destructive"
735
+ }, null, 8, ["label", "loading", "disabled"])) : p("", !0),
736
+ ((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, {
737
+ key: 7,
738
+ label: s(o)("common.close"),
739
+ variant: "tertiary",
740
+ onClick: r[8] || (r[8] = (C) => a("update:show", !1))
741
+ }, null, 8, ["label"])) : p("", !0)
742
+ ])
743
+ ];
744
+ }),
745
+ _: 1
746
+ }, 8, ["header", "modelValue", "dismiss-away"]);
747
+ };
748
+ }
749
+ });
750
+ export {
751
+ Os as _,
752
+ Qe as g,
753
+ Rs as u
754
+ };