@feedmepos/mf-inventory-portal 0.0.22-dev.2 → 0.0.22-dev.21

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