@feedmepos/mf-inventory-portal 0.0.22-dev.3 → 0.0.22-dev.30

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 (79) hide show
  1. package/dist/App.vue.d.ts +2 -0
  2. package/dist/{ApprovalView-BnkFRJgX.js → ApprovalView-BowcCo8d.js} +26 -26
  3. package/dist/{BindingsDialog-BDzmf8Wr.js → BindingsDialog-CmmLVQTN.js} +1 -1
  4. package/dist/{BindingsPicker-CRGFd-d8.js → BindingsPicker-BErHbcxb.js} +8 -8
  5. package/dist/{BindingsTable-BnHju77G.js → BindingsTable-hrfbN6tX.js} +1 -1
  6. package/dist/ClosingTemplateView-BVefCGpC.js +1072 -0
  7. package/dist/Entry.vue.d.ts +0 -2
  8. package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-BRV9dZhu.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-CXHh_Bti.js} +8 -8
  9. package/dist/IngredientsView-BqnUckSv.js +1817 -0
  10. package/dist/{IntegrationView-UySDEAnh.js → IntegrationView-BEdAKS1I.js} +120 -120
  11. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-Cxy6vo9D.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-pr7Sb7Om.js} +1 -1
  12. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-ChrCZc0C.js → PremiumBadge.vue_vue_type_script_setup_true_lang-DsYwNO5N.js} +1 -1
  13. package/dist/{PurchaseOrderPrintPreview-CGxMILW0.js → PurchaseOrderPrintPreview-DzaS_c8R.js} +1 -1
  14. package/dist/{ReceiveRequestView-BHOC-ZLV.js → ReceiveRequestView-CU-bhIjl.js} +20 -21
  15. package/dist/RecipeView-CmETsz5e.js +590 -0
  16. package/dist/{StockView-BcXcQZpl.js → StockView-BgmjwPbh.js} +602 -585
  17. package/dist/{SupplierView-Bl13ZM-9.js → SupplierView-CDm5q1th.js} +108 -108
  18. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-BZJyhJu4.js +858 -0
  19. package/dist/TransferDialog.vue_vue_type_script_setup_true_lang-lybenWiw.js +1678 -0
  20. package/dist/TransferTemplateView-CSQ2XxFU.js +1232 -0
  21. package/dist/{UnitView-DG8PGv5Y.js → UnitView-D7bcDkOX.js} +6 -6
  22. package/dist/{WarehouseView-CeS8jrgw.js → WarehouseView-BJAKVdRs.js} +17 -17
  23. package/dist/api/inventory.d.ts +72 -85
  24. package/dist/api/netsuite.d.ts +47 -0
  25. package/dist/api/purchase-order-template.d.ts +0 -4
  26. package/dist/{app-DYhspC_r.js → app-A8ykBdGf.js} +21877 -20978
  27. package/dist/app.d.ts +7 -0
  28. package/dist/app.js +3 -3
  29. package/dist/components/FmFilterableMenuOptions.vue.d.ts +54 -0
  30. package/dist/components/FmMinMaxInputRules.d.ts +2 -0
  31. package/dist/components/FmUnitInputRules.d.ts +2 -0
  32. package/dist/{decimal-DwEh3AcZ.js → decimal-BC4EGBAX.js} +1 -1
  33. package/dist/{defineDeepModel-htf7zxRR.js → defineDeepModel-Ckfkwau_.js} +3 -3
  34. package/dist/{format-time-from-id-1BxShIsX.js → format-time-from-id-o1plVFRH.js} +3 -3
  35. package/dist/helper/rules.d.ts +7 -0
  36. package/dist/helper/rules.spec.d.ts +1 -0
  37. package/dist/{id-to-date-CzSDsYm2.js → id-to-date-DyPIToei.js} +1 -1
  38. package/dist/purchase-order-transaction-type-skN4AmEj.js +678 -0
  39. package/dist/stores/api.d.ts +1 -0
  40. package/dist/stores/feature.d.ts +0 -1
  41. package/dist/stores/helper/core-store-proxy.d.ts +3 -0
  42. package/dist/stores/helper/generate-backend-urls.d.ts +1 -0
  43. package/dist/stores/inventory.d.ts +22 -0
  44. package/dist/stores/location.d.ts +420 -504
  45. package/dist/stores/netsuite.d.ts +68 -0
  46. package/dist/stores/route.d.ts +0 -5
  47. package/dist/stores/warehouse.d.ts +4 -7
  48. package/dist/style.css +1 -1
  49. package/dist/{supplier-DegAxD_n.js → supplier-DV3Tg4TT.js} +1 -1
  50. package/dist/tsconfig.app.tsbuildinfo +1 -1
  51. package/dist/use-template-enabled-locations-2-u_kejm-N.js +85 -0
  52. package/dist/views/closing-template/composables/use-closing-template-actions.d.ts +1080 -1020
  53. package/dist/views/closing-template/composables/use-closing-template-table.d.ts +1080 -1020
  54. package/dist/views/receive-request/components/transfer-details/TransferDetailsProps.d.ts +1 -0
  55. package/dist/views/receive-request/components/transfer-form/TransferForm.vue.d.ts +1854 -0
  56. package/dist/views/receive-request/components/transfer-form/TransferFormProps.d.ts +1 -0
  57. package/dist/views/receive-request/composables/use-receive-request-form.d.ts +2329 -286
  58. package/dist/views/receive-request/composables/use-receive-request-table.d.ts +2213 -170
  59. package/dist/views/transfer-template/components/transfer-template-form/composables/use-template-enabled-locations-2.d.ts +13 -0
  60. package/dist/views/transfer-template/components/transfer-template-form/composables/use-template-enabled-locations.d.ts +71 -85
  61. package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-locations.d.ts +39 -2
  62. package/dist/views/transfer-template/composables/use-transfer-template-actions.d.ts +1253 -1457
  63. package/dist/views/transfer-template/composables/use-transfer-template-table.d.ts +420 -1474
  64. package/dist/views/transfer-template/helpers/remove-deleted-skus.helper.d.ts +230 -0
  65. package/dist/views/warehouse/components/WarehouseForm.vue.d.ts +8 -14
  66. package/dist/{xlsx-CSS2klUs.js → xlsx-CrHTSBmd.js} +1 -1
  67. package/dist/{xlsx.util-CeY18XxV.js → xlsx.util-hjzkZFnf.js} +2 -2
  68. package/package.json +5 -5
  69. package/dist/ClosingTemplateView-D2EIa9YG.js +0 -1030
  70. package/dist/IngredientsView-CiUpjKmC.js +0 -1759
  71. package/dist/RecipeView-lgrm1J9x.js +0 -581
  72. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-SXFiNrtm.js +0 -740
  73. package/dist/TransferDialog.vue_vue_type_script_setup_true_lang-DSBEn-Mt.js +0 -1409
  74. package/dist/TransferTemplateView-C_eqQ9a8.js +0 -1230
  75. package/dist/array-ClJzD_Lt.js +0 -30
  76. package/dist/layout/InventoryLayout.vue.d.ts +0 -2
  77. package/dist/layout/layout-routes.d.ts +0 -6
  78. package/dist/purchase-order-transaction-type-lwIoC03T.js +0 -712
  79. package/dist/use-template-enabled-locations-B2ZtZAoX.js +0 -57
@@ -0,0 +1,858 @@
1
+ import { f as ue } from "./format-time-from-id-o1plVFRH.js";
2
+ import { computed as z, h as re, defineComponent as Ae, ref as ae, resolveComponent as H, openBlock as c, createBlock as $, unref as r, isRef as Ce, withCtx as ne, createElementVNode as e, createVNode as L, createElementBlock as b, Fragment as J, toDisplayString as d, normalizeClass as oe, createCommentVNode as x, renderList as le } from "vue";
3
+ import { c as he } from "./TableActionableRow.vue_vue_type_script_setup_true_lang-DlNJ6kRg.js";
4
+ import { D as k, R as h } from "./row-action.enum-PMKMRrZR.js";
5
+ import { D as Re, m as de, a as te, am as _e, an as S, c as Ee, j as Ne, ag as A, J as Te, H as Pe, ak as Fe, b as $e, x as Ie, T as ge } from "./app-A8ykBdGf.js";
6
+ import { F as je } from "./decimal-BC4EGBAX.js";
7
+ import { f as Oe, P as ie, d as Me, e as Le } from "./purchase-order-transaction-type-skN4AmEj.js";
8
+ import { useDialog as Ue, useSnackbar as Ke, useProxiedModel as Ve } from "@feedmepos/ui-library";
9
+ import { useI18n as xe } from "@feedmepos/mf-common";
10
+ import { E as Be } from "./empty-placeholder-wf6-BWE8.js";
11
+ function Ge(v, C) {
12
+ return C.reduce(
13
+ (a, I) => {
14
+ const P = I.received.find((E) => E.sku._id === v._id);
15
+ return P && (a = Re(a, P.amount)), a;
16
+ },
17
+ je.toPrecision(de(0), v.unit.precision)
18
+ );
19
+ }
20
+ function He(v, C) {
21
+ const { name: y, address: a, regNo: I } = C.doc.profile, P = {
22
+ name: y,
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
+ }, E = {
31
+ name: v.supplier.name,
32
+ registrationNumber: v.supplier.registrationNumber,
33
+ line1: v.supplier.address.line1,
34
+ line2: v.supplier.address.line2,
35
+ postcode: v.supplier.address.postcode,
36
+ city: v.supplier.address.city,
37
+ state: v.supplier.address.state,
38
+ country: v.supplier.address.country
39
+ }, Y = v.items.map((i) => {
40
+ const { sku: l, measurement: u } = i, j = te(
41
+ Ge(i.sku, v.deliveryOrder || []),
42
+ !1
43
+ );
44
+ return {
45
+ code: l.code,
46
+ description: l.name,
47
+ quantity: Oe(i.quantity, l.unit, i.measurement),
48
+ unit: (u == null ? void 0 : u.abbrev) || l.unit.abbrev,
49
+ received: j
50
+ };
51
+ }), m = v.deliveryOrder.map((i) => ({
52
+ createdAt: _e(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
+ })), U = {
65
+ orderNumber: v.seqNumber.toString(),
66
+ createdAt: ue(v._id),
67
+ ref: v.ref || "",
68
+ remark: v.remark || "",
69
+ buyer: P,
70
+ supplier: E,
71
+ items: Y,
72
+ status: v.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(U)), window.open(o.href, "_blank", "noreferrer");
76
+ }
77
+ const W = {
78
+ submitRequest: {
79
+ translationKey: "inventory.transfer.receiveRequest.actions.submitRequest",
80
+ color: "text-fm-color-typo-primary",
81
+ value: S.enum.submitRequest
82
+ },
83
+ confirmDraft: {
84
+ translationKey: "inventory.transfer.receiveRequest.actions.confirmDraft",
85
+ color: "text-fm-color-typo-primary",
86
+ value: S.enum.confirmDraft
87
+ },
88
+ cancelDraft: {
89
+ translationKey: "inventory.transfer.receiveRequest.actions.cancelDraft",
90
+ color: "text-fm-color-typo-error",
91
+ value: S.enum.cancelDraft
92
+ },
93
+ approveRequest: {
94
+ translationKey: "inventory.transfer.receiveRequest.actions.approveRequest",
95
+ color: "text-fm-color-typo-primary",
96
+ value: S.enum.approveRequest
97
+ },
98
+ rejectRequest: {
99
+ translationKey: "inventory.transfer.receiveRequest.actions.rejectRequest",
100
+ color: "text-fm-color-typo-error",
101
+ value: S.enum.rejectRequest
102
+ },
103
+ processRequest: {
104
+ translationKey: "inventory.transfer.receiveRequest.actions.processRequest",
105
+ color: "text-fm-color-typo-primary",
106
+ value: S.enum.processRequest
107
+ },
108
+ receiveStock: {
109
+ translationKey: "inventory.transfer.receiveRequest.actions.receiveStock",
110
+ color: "text-fm-color-typo-primary",
111
+ value: S.enum.receiveStock
112
+ },
113
+ completeReceive: {
114
+ translationKey: "inventory.transfer.receiveRequest.actions.completeReceive",
115
+ color: "text-fm-color-typo-primary",
116
+ value: S.enum.completeReceive
117
+ }
118
+ };
119
+ function ds(v, C) {
120
+ const y = Ne(), { t: a } = xe();
121
+ function I(o) {
122
+ switch (o.status) {
123
+ case "DRAFT":
124
+ return [
125
+ o.supplier.internal === "restaurant" || o.supplier.internal === "warehouse" ? W[S.enum.submitRequest] : W[S.enum.confirmDraft],
126
+ W[S.enum.cancelDraft],
127
+ k[h.Update],
128
+ k[h.Details],
129
+ k[h.Print]
130
+ ];
131
+ case "RECEIVING":
132
+ return [
133
+ W[S.enum.completeReceive],
134
+ k[h.Update],
135
+ k[h.Details],
136
+ k[h.Print]
137
+ ];
138
+ case "REQUESTING":
139
+ return v === "receive/request" ? [
140
+ k[h.Update],
141
+ k[h.Details],
142
+ k[h.Print]
143
+ ] : [
144
+ W[S.enum.approveRequest],
145
+ W[S.enum.rejectRequest],
146
+ k[h.Details],
147
+ k[h.Print]
148
+ ];
149
+ case "PROCESSING":
150
+ return [k[h.Details], k[h.Print]];
151
+ case "COMPLETE":
152
+ return [
153
+ k[h.Update],
154
+ k[h.Details],
155
+ k[h.Print]
156
+ ];
157
+ case "CANCEL":
158
+ default:
159
+ return [k[h.Details], k[h.Print]];
160
+ }
161
+ }
162
+ function P(o) {
163
+ return Object.values(S.enum).includes(o);
164
+ }
165
+ async function E(o, i, l) {
166
+ var j, se;
167
+ const u = Ee(i);
168
+ if (o === h.Print) {
169
+ He(u, y.currentLocation);
170
+ return;
171
+ }
172
+ if (o === h.Details) {
173
+ C.promptShowTransferDetails(u, l);
174
+ return;
175
+ }
176
+ if (o === h.Update) {
177
+ (j = C.promptUpdateTransferDialog) == null || j.call(C, u);
178
+ return;
179
+ }
180
+ if (P(o)) {
181
+ C.submitAction(i, o, (se = l == null ? void 0 : l.to) == null ? void 0 : se.dbName);
182
+ return;
183
+ }
184
+ }
185
+ function Y() {
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 he(l, (u) => E(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 he(
319
+ l,
320
+ (u) => i.purchaseOrder ? E(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 U = z(() => v === "receive/request" ? Y() : m());
333
+ return {
334
+ get columnDefs() {
335
+ return U.value;
336
+ }
337
+ };
338
+ }
339
+ const ze = { class: "flex flex-col gap-16 w-full h-full" }, Ye = { class: "flex justify-between" }, Qe = { class: "fm-typo-en-body-lg-600" }, Je = { class: "flex flex-col gap-8" }, We = { class: "flex flex-col gap-4" }, Xe = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ze = { class: "flex gap-1" }, et = { class: "fm-typo-en-body-lg-600" }, tt = {
340
+ key: 0,
341
+ class: "flex flex-col gap-4"
342
+ }, st = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, rt = { class: "fm-typo-en-body-lg-600" }, at = { class: "flex flex-col gap-4" }, nt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ot = { class: "fm-typo-en-body-lg-600" }, lt = {
343
+ key: 1,
344
+ class: "flex flex-col gap-4"
345
+ }, it = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ut = { class: "fm-typo-en-body-lg-600" }, ct = {
346
+ key: 2,
347
+ class: "flex flex-col gap-4"
348
+ }, dt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, mt = { class: "fm-typo-en-body-lg-600" }, ft = {
349
+ key: 3,
350
+ class: "flex flex-col gap-4"
351
+ }, vt = { class: "fm-typo-en-body-lg-600" }, pt = {
352
+ key: 4,
353
+ class: "flex flex-col gap-4"
354
+ }, yt = { class: "fm-typo-en-body-lg-600" }, bt = {
355
+ key: 5,
356
+ class: "flex flex-col gap-4"
357
+ }, ht = { class: "fm-typo-en-body-lg-600" }, gt = {
358
+ key: 6,
359
+ class: "flex flex-col gap-4"
360
+ }, Rt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, _t = { class: "fm-typo-en-body-lg-600" }, Ot = {
361
+ key: 7,
362
+ class: "flex flex-col gap-4"
363
+ }, xt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, kt = { class: "fm-typo-en-body-lg-600" }, St = { class: "border border-fm-color-neutral-gray-200 fm-corner-radius-lg p-16" }, qt = { class: "flex flex-col gap-8" }, Dt = { class: "fm-typo-en-body-lg-600" }, wt = { class: "flex w-full gap-4" }, At = { class: "basis-1/2 shrink-0 grow fm-typo-en-body-lg-400 line-clamp-2" }, Ct = { class: "fm-typo-en-body-lg-600 line-clamp-2" }, Et = { class: "flex w-full gap-4 fm-typo-en-body-sm-400" }, Nt = { class: "grow fm-typo-en-body-lg-400 text-fm-color-typo-secondary line-clamp-1" }, Tt = {
364
+ key: 0,
365
+ class: "line-clamp-1 fm-typo-en-body-lg-400 text-fm-color-typo-secondary"
366
+ }, Pt = {
367
+ key: 1,
368
+ class: "flex-1 xs:w-screen xs:max-w-full"
369
+ }, Ft = {
370
+ key: 0,
371
+ class: "flex flex-col items-center gap-8 h-full"
372
+ }, $t = ["src"], It = { class: "fm-typo-en-body-lg-600" }, jt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary px-16" }, Mt = {
373
+ key: 1,
374
+ class: "px-4 flex flex-col"
375
+ }, Lt = { class: "flex gap-12 content-stretch" }, Ut = {
376
+ class: "flex flex-col w-24",
377
+ name: "circles"
378
+ }, Kt = { class: "flex-1 flex flex-col items-center" }, Vt = { class: "flex-1 flex flex-col items-center" }, Bt = {
379
+ class: "py-12 flex flex-col gap-4",
380
+ name: "received-at header"
381
+ }, Gt = { class: "fm-typo-en-body-lg-400" }, Ht = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, zt = { class: "flex gap-12 content-stretch" }, Yt = {
382
+ class: "flex flex-col w-24",
383
+ name: "circles"
384
+ }, Qt = { class: "flex-1 flex flex-col items-center" }, Jt = {
385
+ class: "py-12 flex flex-col gap-4 flex-1",
386
+ name: "delivery details"
387
+ }, Wt = { class: "flex flex-col gap-8" }, Xt = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, Zt = { class: "flex flex-col gap-4" }, es = { class: "flex gap-8 xs:flex-col" }, ms = /* @__PURE__ */ Ae({
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(v, { emit: C }) {
400
+ const y = v, a = C, I = Ue(), P = Ke(), E = Fe(), Y = $e(), { t: m } = xe(), U = z(
401
+ () => {
402
+ var t, s, g, f;
403
+ return ((s = (t = y.purchaseOrder) == null ? void 0 : t.supplier) == null ? void 0 : s.internal) === "restaurant" || ((f = (g = y.purchaseOrder) == null ? void 0 : g.supplier) == null ? void 0 : f.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 = Me(), ce = Ve(y, "show");
415
+ async function ke(t, s, g) {
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 === S.enum.confirmDraft || // auto receive for warehouse to warehouse
425
+ s === S.enum.completeReceive) && Y.autoReceiveWarehouse ? {
426
+ autoReceive: !0
427
+ } : void 0
428
+ )
429
+ },
430
+ y.transferToDbName
431
+ ), await new Promise((f) => setTimeout(f, 1e3)), P.open({
432
+ title: "Success",
433
+ message: g,
434
+ type: "success"
435
+ }), a("update:show", !1), a("submitted");
436
+ } catch (f) {
437
+ P.open({
438
+ title: "Something went wrong",
439
+ message: "Please try again.",
440
+ type: "error"
441
+ }), console.error("Error when submitting PO operation", s, t, f);
442
+ } finally {
443
+ u.value = "", l.value = !1, j.value = !0;
444
+ }
445
+ }
446
+ async function K(t) {
447
+ const s = Le[t];
448
+ if (!s) {
449
+ P.open({
450
+ title: "Something went wrong",
451
+ message: `Cannot process order: ${Ie(t)}`,
452
+ type: "error"
453
+ });
454
+ return;
455
+ }
456
+ const { successMessage: g, ...f } = s;
457
+ I.open({
458
+ title: f.title,
459
+ message: f.message,
460
+ primaryActions: f.primaryActions
461
+ }).onPrimary(() => {
462
+ y.purchaseOrder && ke(y.purchaseOrder, t, g);
463
+ });
464
+ }
465
+ const Se = z(() => {
466
+ var t, s;
467
+ return ((t = y.purchaseOrder) == null ? void 0 : t.status) === A.enum.RECEIVING || ((s = y.purchaseOrder) == null ? void 0 : s.status) === A.enum.COMPLETE;
468
+ }), qe = z(
469
+ () => {
470
+ var t, s, g, f;
471
+ return E.getLocationSubsidiary(
472
+ ((s = (t = y.purchaseOrder) == null ? void 0 : t.netSuite) == null ? void 0 : s.subsidiary.id) || ((f = (g = y.poRequest) == null ? void 0 : g.netSuite) == null ? void 0 : f.subsidiary.id)
473
+ ).fullName;
474
+ }
475
+ ), De = z(() => {
476
+ var t, s, g, f, M, N;
477
+ return (s = (t = y.purchaseOrder) == null ? void 0 : t.deliveryFullfillment) != null && s.length && ((f = (g = y.purchaseOrder) == null ? void 0 : g.deliveryFullfillment) == null ? void 0 : f.length) > 0 ? (N = (M = y.purchaseOrder) == null ? void 0 : M.deliveryFullfillment) == null ? void 0 : N.map((T) => {
478
+ var n;
479
+ return (n = T.netSuite) == null ? void 0 : n.refNo;
480
+ }).join(", ") : "-";
481
+ }), we = z(() => {
482
+ var N, T, n;
483
+ const g = (((N = y.purchaseOrder) == null ? void 0 : N.deliveryOrder) ?? []).flatMap((R) => R.received ?? []).reduce(
484
+ (R, _) => {
485
+ const O = R[_.sku._id] ?? [];
486
+ return R[_.sku._id] = [...O, _], R;
487
+ },
488
+ {}
489
+ ), f = Object.entries(g).reduce(
490
+ (R, [_, O]) => {
491
+ const w = O.reduce((p, q) => {
492
+ const D = Te(
493
+ p,
494
+ Math.max(p.precision, q.amount.precision)
495
+ );
496
+ return Re(D, q.amount);
497
+ }, de(0));
498
+ return R[_] = w, R;
499
+ },
500
+ {}
501
+ ), M = ((T = y.purchaseOrder) == null ? void 0 : T.items) ?? [];
502
+ for (const R of M)
503
+ f[n = R.sku._id] ?? (f[n] = de(0));
504
+ return f;
505
+ }), Q = z(() => {
506
+ var N, T;
507
+ const t = ((N = y.purchaseOrder) == null ? void 0 : N.deliveryOrder) ?? [], s = ((T = y.purchaseOrder) == null ? void 0 : T.deliveryFullfillment) ?? [], g = [
508
+ ...t.map((n) => ({
509
+ createdAt: n.createdAt,
510
+ type: "grn",
511
+ doc: n
512
+ })),
513
+ ...s.map((n) => ({
514
+ createdAt: n.createdAt,
515
+ type: "fulfillment",
516
+ doc: n
517
+ }))
518
+ ];
519
+ g.reverse().sort((n, R) => n.createdAt.localeCompare(R.createdAt));
520
+ function f(n) {
521
+ var _;
522
+ const R = s.findIndex((O) => O.id === n.fullfillmentId);
523
+ return {
524
+ header: "Received",
525
+ date: ge(new Date(n.createdAt)),
526
+ info: [
527
+ {
528
+ label: "Received by",
529
+ values: [(_ = n.createdBy) == null ? void 0 : _.name]
530
+ },
531
+ {
532
+ label: "Received items",
533
+ values: n.received.map((O) => {
534
+ var w;
535
+ return `(${O.sku.code}) ${O.sku.name}: ${te(O.amount, !1)} ${((w = O.measurement) == null ? void 0 : w.abbrev) ?? O.sku.unit.abbrev}`;
536
+ })
537
+ },
538
+ n.deliveryOrderNumber ? {
539
+ label: "Delivery order no.",
540
+ values: [n.deliveryOrderNumber]
541
+ } : null,
542
+ n.remark ? {
543
+ label: "Remark",
544
+ values: [n.remark]
545
+ } : null,
546
+ R > -1 ? {
547
+ label: "Fulfilment",
548
+ values: [`${R}`]
549
+ } : null
550
+ ].filter((O) => O)
551
+ };
552
+ }
553
+ function M(n) {
554
+ const R = s.findIndex((_) => _.id === n.id);
555
+ return {
556
+ header: "Fulfillment",
557
+ date: ge(new Date(n.createdAt)),
558
+ info: [
559
+ {
560
+ label: "Sequence",
561
+ values: [String(R + 1)]
562
+ },
563
+ {
564
+ label: "Receiveable items",
565
+ values: n.items.map((_) => {
566
+ var O;
567
+ return `(${_.sku.code}) ${_.sku.name}: ${te(_.amount, !1)} ${((O = _.measurement) == null ? void 0 : O.abbrev) ?? _.sku.unit.abbrev}`;
568
+ })
569
+ }
570
+ ]
571
+ };
572
+ }
573
+ return g.map((n) => {
574
+ switch (n.type) {
575
+ case "grn":
576
+ return f(n.doc);
577
+ case "fulfillment":
578
+ return M(n.doc);
579
+ }
580
+ });
581
+ });
582
+ return (t, s) => {
583
+ var _, O;
584
+ const g = H("FmButtonGroup"), f = H("FmChip"), M = H("FmMenuDivider"), N = H("FmCard"), T = H("FmSpacer"), n = H("FmButton"), R = H("FmSideSheet");
585
+ return c(), $(R, {
586
+ header: r(m)("inventory.transfer.receiveRequest.details.title") + ((_ = t.purchaseOrder) != null && _.seqNumber ? ` #${(O = t.purchaseOrder) == null ? void 0 : O.seqNumber}` : ""),
587
+ modelValue: r(ce),
588
+ "onUpdate:modelValue": s[9] || (s[9] = (w) => Ce(ce) ? ce.value = w : null),
589
+ "dismiss-away": j.value,
590
+ "close-button": "",
591
+ "max-width": 500
592
+ }, {
593
+ default: ne(() => {
594
+ var w;
595
+ return [
596
+ e("div", ze, [
597
+ e("div", null, [
598
+ L(g, {
599
+ items: o,
600
+ modelValue: i.value,
601
+ "onUpdate:modelValue": s[0] || (s[0] = (p) => i.value = p)
602
+ }, null, 8, ["modelValue"])
603
+ ]),
604
+ i.value.value === "overview" ? (c(), b(J, { key: 0 }, [
605
+ e("div", null, [
606
+ L(N, {
607
+ variant: "outlined",
608
+ class: "flex flex-col gap-8 px-12 py-16"
609
+ }, {
610
+ default: ne(() => {
611
+ var p, q, D, V, B, G, X, Z, ee, F, me, fe, ve, pe, ye, be;
612
+ return [
613
+ e("div", Ye, [
614
+ e("div", Qe, d(r(m)("inventory.transfer.receiveRequest.details.requestSummary")), 1),
615
+ e("div", null, [
616
+ L(f, {
617
+ label: r(m)(`inventory.transfer.status.${(p = t.purchaseOrder) == null ? void 0 : p.status}`),
618
+ class: oe(`fm-status-badge fm-status-badge-${(D = (q = t.purchaseOrder) == null ? void 0 : q.status) == null ? void 0 : D.toLocaleLowerCase("en-us")}`),
619
+ compact: ""
620
+ }, null, 8, ["label", "class"])
621
+ ])
622
+ ]),
623
+ L(M),
624
+ e("div", Je, [
625
+ e("div", We, [
626
+ e("div", Xe, [
627
+ e("div", Ze, d(r(m)("inventory.transfer.receiveRequest.details.createdAt")), 1)
628
+ ]),
629
+ e("div", et, d(r(ue)(((V = t.purchaseOrder) == null ? void 0 : V._id) ?? "")), 1)
630
+ ]),
631
+ (B = t.purchaseOrder) != null && B.effectiveAt ? (c(), b("div", tt, [
632
+ e("div", st, d(r(m)("inventory.transfer.receiveRequest.details.backdatedTo")), 1),
633
+ e("div", rt, d(r(_e)(new Date((G = t.purchaseOrder) == null ? void 0 : G.effectiveAt))), 1)
634
+ ])) : x("", !0),
635
+ e("div", at, [
636
+ e("div", nt, d(r(m)("inventory.transfer.receiveRequest.details.type.title")), 1),
637
+ e("div", ot, d(r(m)(
638
+ `inventory.transfer.receiveRequest.details.type.${U.value.toLocaleLowerCase("en-US")}`
639
+ )), 1)
640
+ ]),
641
+ (Z = (X = t.purchaseOrder) == null ? void 0 : X.supplier) != null && Z.name ? (c(), b("div", lt, [
642
+ e("div", it, d(r(m)("inventory.transfer.receiveRequest.details.from")), 1),
643
+ e("div", ut, d((F = (ee = t.purchaseOrder) == null ? void 0 : ee.supplier) == null ? void 0 : F.name), 1)
644
+ ])) : x("", !0),
645
+ t.transferTo ? (c(), b("div", ct, [
646
+ e("div", dt, d(r(m)("inventory.transfer.receiveRequest.details.to")), 1),
647
+ e("div", mt, d(t.transferTo), 1)
648
+ ])) : x("", !0),
649
+ r(E).isEnabled ? (c(), b("div", ft, [
650
+ s[10] || (s[10] = e("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " NetSuite Subsidiary ", -1)),
651
+ e("div", vt, d(qe.value), 1)
652
+ ])) : x("", !0),
653
+ r(E).isEnabled ? (c(), b("div", pt, [
654
+ s[11] || (s[11] = e("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " NetSuite Transfer Order ", -1)),
655
+ e("div", yt, d(((fe = (me = t.purchaseOrder) == null ? void 0 : me.netSuite) == null ? void 0 : fe.id) || ((pe = (ve = t.poRequest) == null ? void 0 : ve.netSuite) == null ? void 0 : pe.id) || "-"), 1)
656
+ ])) : x("", !0),
657
+ r(E).isEnabled ? (c(), b("div", bt, [
658
+ s[12] || (s[12] = e("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " NetSuite Fulfilment IDs ", -1)),
659
+ e("div", ht, d(De.value), 1)
660
+ ])) : x("", !0),
661
+ (ye = t.purchaseOrder) != null && ye.ref ? (c(), b("div", gt, [
662
+ e("div", Rt, d(r(m)("inventory.transfer.receiveRequest.details.reference")), 1),
663
+ e("div", _t, d(t.purchaseOrder.ref), 1)
664
+ ])) : x("", !0),
665
+ (be = t.purchaseOrder) != null && be.remark ? (c(), b("div", Ot, [
666
+ e("div", xt, d(r(m)("inventory.transfer.receiveRequest.details.remark")), 1),
667
+ e("div", kt, d(t.purchaseOrder.remark), 1)
668
+ ])) : x("", !0)
669
+ ])
670
+ ];
671
+ }),
672
+ _: 1
673
+ })
674
+ ]),
675
+ e("div", St, [
676
+ e("div", qt, [
677
+ e("div", Dt, d(Se.value ? r(m)("inventory.transfer.receiveRequest.details.receivedItems") : r(m)("inventory.transfer.receiveRequest.details.requestedItems")), 1),
678
+ (c(!0), b(J, null, le(((w = t.purchaseOrder) == null ? void 0 : w.items) ?? [], (p) => (c(), b("div", {
679
+ key: p.code,
680
+ class: "flex flex-col"
681
+ }, [
682
+ e("div", wt, [
683
+ e("div", At, d(p.name), 1),
684
+ e("div", Ct, d(r(te)(we.value[p.sku._id], !1)) + "/" + d(r(Oe)(p.quantity, p.sku.unit, p.measurement)), 1)
685
+ ]),
686
+ e("div", Et, [
687
+ e("div", Nt, d(p.code), 1),
688
+ p.totalCost && r(Y).enableTotalCost ? (c(), b("div", Tt, " (" + d(r(Pe)(p.totalCost)) + ") ", 1)) : x("", !0)
689
+ ])
690
+ ]))), 128))
691
+ ])
692
+ ])
693
+ ], 64)) : x("", !0),
694
+ i.value.value === "deliveryHistory" ? (c(), b("div", Pt, [
695
+ Q.value.length ? (c(), b("div", Mt, [
696
+ (c(!0), b(J, null, le(Q.value, (p, q) => (c(), b(J, { key: q }, [
697
+ e("div", Lt, [
698
+ e("div", Ut, [
699
+ e("div", Kt, [
700
+ e("div", {
701
+ class: oe([
702
+ {
703
+ "bg-fm-color-primary": q !== 0,
704
+ "bg-white": q === 0
705
+ },
706
+ "w-[2px] h-full"
707
+ ])
708
+ }, null, 2)
709
+ ]),
710
+ s[13] || (s[13] = e("div", { class: "h-24 w-24 bg-fm-color-primary rounded-full" }, null, -1)),
711
+ e("div", Vt, [
712
+ e("div", {
713
+ class: oe([
714
+ {
715
+ "bg-fm-color-primary": q < Q.value.length - 1,
716
+ "bg-white": q >= Q.value.length - 1
717
+ },
718
+ "w-[2px] h-full"
719
+ ])
720
+ }, null, 2)
721
+ ])
722
+ ]),
723
+ e("div", Bt, [
724
+ e("div", Gt, d(p.header), 1),
725
+ e("div", Ht, d(p.date), 1)
726
+ ])
727
+ ]),
728
+ e("div", zt, [
729
+ e("div", Yt, [
730
+ e("div", Qt, [
731
+ e("div", {
732
+ class: oe([
733
+ {
734
+ "bg-fm-color-primary": q < Q.value.length - 1,
735
+ "bg-white": q >= Q.value.length - 1
736
+ },
737
+ "w-[2px] h-full"
738
+ ])
739
+ }, null, 2)
740
+ ])
741
+ ]),
742
+ e("div", Jt, [
743
+ L(N, {
744
+ variant: "outlined",
745
+ class: "py-12 px-16"
746
+ }, {
747
+ default: ne(() => [
748
+ e("div", Wt, [
749
+ (c(!0), b(J, null, le(p.info, (D, V) => (c(), b("div", {
750
+ key: V,
751
+ class: "flex flex-col gap-4"
752
+ }, [
753
+ e("div", Xt, d(D == null ? void 0 : D.label), 1),
754
+ e("div", Zt, [
755
+ (c(!0), b(J, null, le(D == null ? void 0 : D.values, (B, G) => (c(), b("div", {
756
+ key: G,
757
+ class: "fm-typo-en-body-lg-600"
758
+ }, d(B), 1))), 128))
759
+ ])
760
+ ]))), 128))
761
+ ])
762
+ ]),
763
+ _: 2
764
+ }, 1024)
765
+ ])
766
+ ])
767
+ ], 64))), 128))
768
+ ])) : (c(), b("div", Ft, [
769
+ L(T),
770
+ e("div", null, [
771
+ e("img", {
772
+ src: r(Be),
773
+ alt: "List is empty"
774
+ }, null, 8, $t)
775
+ ]),
776
+ e("div", It, d(r(m)("inventory.transfer.receiveRequest.details.noRecordsFound")), 1),
777
+ e("div", jt, d(r(m)("inventory.transfer.receiveRequest.details.trackDeliveryMessage")), 1),
778
+ L(T),
779
+ L(T)
780
+ ]))
781
+ ])) : x("", !0)
782
+ ])
783
+ ];
784
+ }),
785
+ "side-sheet-footer": ne(() => {
786
+ var w, p, q, D, V, B, G, X, Z, ee;
787
+ return [
788
+ e("div", es, [
789
+ ((w = t.purchaseOrder) == null ? void 0 : w.status) === r(A).enum.DRAFT && U.value === r(ie).PURCHASE ? (c(), $(n, {
790
+ key: 0,
791
+ label: r(m)("inventory.transfer.receiveRequest.actions.confirmDraft"),
792
+ onClick: s[1] || (s[1] = (F) => K("confirmDraft")),
793
+ loading: u.value === "confirmDraft",
794
+ disabled: u.value !== "confirmDraft" && l.value
795
+ }, null, 8, ["label", "loading", "disabled"])) : x("", !0),
796
+ ((p = t.purchaseOrder) == null ? void 0 : p.status) === r(A).enum.DRAFT && U.value === r(ie).TRANSFER ? (c(), $(n, {
797
+ key: 1,
798
+ label: r(m)("inventory.transfer.receiveRequest.actions.submitRequest"),
799
+ onClick: s[2] || (s[2] = (F) => K("submitRequest")),
800
+ loading: u.value === "submitRequest",
801
+ disabled: u.value !== "submitRequest" && l.value
802
+ }, null, 8, ["label", "loading", "disabled"])) : x("", !0),
803
+ ((q = t.purchaseOrder) == null ? void 0 : q.status) === r(A).enum.DRAFT ? (c(), $(n, {
804
+ key: 2,
805
+ label: r(m)("inventory.transfer.receiveRequest.actions.cancelDraft"),
806
+ onClick: s[3] || (s[3] = (F) => K("cancelDraft")),
807
+ loading: u.value === "cancelDraft",
808
+ disabled: u.value !== "cancelDraft" && l.value,
809
+ variant: "destructive"
810
+ }, null, 8, ["label", "loading", "disabled"])) : x("", !0),
811
+ ((D = t.purchaseOrder) == null ? void 0 : D.status) === r(A).enum.RECEIVING ? (c(), $(n, {
812
+ key: 3,
813
+ label: r(m)("inventory.transfer.receiveRequest.actions.completeReceive"),
814
+ onClick: s[4] || (s[4] = (F) => K("completeReceive")),
815
+ loading: u.value === "completeReceive",
816
+ disabled: u.value !== "completeReceive" && l.value
817
+ }, null, 8, ["label", "loading", "disabled"])) : x("", !0),
818
+ t.canResubmit ? (c(), $(n, {
819
+ key: 4,
820
+ label: r(m)("inventory.transfer.receiveRequest.actions.resubmitRequest"),
821
+ onClick: s[5] || (s[5] = (F) => K("submitRequest")),
822
+ loading: u.value === "submitRequest",
823
+ disabled: u.value !== "submitRequest" && l.value
824
+ }, null, 8, ["label", "loading", "disabled"])) : x("", !0),
825
+ (((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, {
826
+ key: 5,
827
+ label: r(m)("inventory.transfer.approval.actions.approveRequest"),
828
+ onClick: s[6] || (s[6] = (F) => K("approveRequest")),
829
+ loading: u.value === "approveRequest",
830
+ disabled: u.value !== "approveRequest" && l.value
831
+ }, null, 8, ["label", "loading", "disabled"])) : x("", !0),
832
+ ((G = t.purchaseOrder) == null ? void 0 : G.status) === r(A).enum.REQUESTING && t.canApprove ? (c(), $(n, {
833
+ key: 6,
834
+ label: r(m)("inventory.transfer.approval.actions.rejectRequest"),
835
+ onClick: s[7] || (s[7] = (F) => K("rejectRequest")),
836
+ loading: u.value === "rejectRequest",
837
+ disabled: u.value !== "rejectRequest" && l.value,
838
+ variant: "destructive"
839
+ }, null, 8, ["label", "loading", "disabled"])) : x("", !0),
840
+ ((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, {
841
+ key: 7,
842
+ label: r(m)("common.close"),
843
+ variant: "tertiary",
844
+ onClick: s[8] || (s[8] = (F) => a("update:show", !1))
845
+ }, null, 8, ["label"])) : x("", !0)
846
+ ])
847
+ ];
848
+ }),
849
+ _: 1
850
+ }, 8, ["header", "modelValue", "dismiss-away"]);
851
+ };
852
+ }
853
+ });
854
+ export {
855
+ ms as _,
856
+ Ge as g,
857
+ ds as u
858
+ };