@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
@@ -1,740 +0,0 @@
1
- import { f as ae } from "./format-time-from-id-BCAuJEq2.js";
2
- import { computed as re, h as be, defineComponent as xe, ref as Z, resolveComponent as K, openBlock as d, createBlock as P, unref as s, isRef as De, withCtx as ee, createElementVNode as e, createVNode as I, createElementBlock as b, Fragment as X, toDisplayString as i, normalizeClass as te, createCommentVNode as v, renderList as oe } from "vue";
3
- import { c as ge } from "./TableActionableRow.vue_vue_type_script_setup_true_lang-DlNJ6kRg.js";
4
- import { D as y, R as f } from "./row-action.enum-PMKMRrZR.js";
5
- import { B as Re, l as le, a as ie, a6 as ce, ah as g, c as Se, j as Ce, ad as q, H as Ae, G as Ee, E as Pe, b as Te, w as Ne } from "./app-DURkcZal.js";
6
- import { F as Fe } from "./decimal-BGJlFDm8.js";
7
- import { f as ue, P as se, d as je, e as Ie } from "./purchase-order-transaction-type-DvSpCSXr.js";
8
- import { components as _e, useDialog as Ue, useSnackbar as Me, useProxiedModel as $e } from "@feedmepos/ui-library";
9
- import { useI18n as Oe } from "@feedmepos/mf-common";
10
- import { E as Ke } from "./empty-placeholder-wf6-BWE8.js";
11
- function Le(m, k) {
12
- return k.reduce(
13
- (r, T) => {
14
- const D = T.received.find((A) => A.sku._id === m._id);
15
- return D && (r = Re(r, D.amount)), r;
16
- },
17
- Fe.toPrecision(le(0), m.unit.precision)
18
- );
19
- }
20
- function Ve(m, k) {
21
- const { name: _, address: r, regNo: T } = k.doc.profile, D = {
22
- name: _,
23
- registrationNumber: T,
24
- line1: r == null ? void 0 : r.line1,
25
- line2: r == null ? void 0 : r.line2,
26
- postcode: r == null ? void 0 : r.postcode,
27
- city: r == null ? void 0 : r.city,
28
- state: r == null ? void 0 : r.state,
29
- country: r == null ? void 0 : r.country
30
- }, A = {
31
- name: m.supplier.name,
32
- registrationNumber: m.supplier.registrationNumber,
33
- line1: m.supplier.address.line1,
34
- line2: m.supplier.address.line2,
35
- postcode: m.supplier.address.postcode,
36
- city: m.supplier.address.city,
37
- state: m.supplier.address.state,
38
- country: m.supplier.address.country
39
- }, c = m.items.map((o) => {
40
- const { sku: a, measurement: p } = o, V = ie(
41
- Le(o.sku, m.deliveryOrder || []),
42
- !1
43
- );
44
- return {
45
- code: a.code,
46
- description: a.name,
47
- quantity: ue(o.quantity, a.unit, o.measurement),
48
- unit: (p == null ? void 0 : p.abbrev) || a.unit.abbrev,
49
- received: V
50
- };
51
- }), U = m.deliveryOrder.map((o) => ({
52
- createdAt: ce(new Date(o.createdAt)),
53
- ref: o.deliveryOrderNumber,
54
- remark: o.remark || "",
55
- items: o.received.map((a) => {
56
- var p;
57
- return {
58
- code: a.sku.code,
59
- description: a.sku.name,
60
- quantity: ie(a.amount),
61
- unit: ((p = a.measurement) == null ? void 0 : p.abbrev) || a.sku.unit.abbrev
62
- };
63
- })
64
- })), L = {
65
- orderNumber: m.seqNumber.toString(),
66
- createdAt: ae(m._id),
67
- ref: m.ref || "",
68
- remark: m.remark || "",
69
- buyer: D,
70
- supplier: A,
71
- items: c,
72
- status: m.status,
73
- deliveryOrders: U
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(L)), window.open(l.href, "_blank", "noreferrer");
76
- }
77
- const z = {
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 ds(m, k) {
120
- const _ = Ce(), { t: r } = Oe();
121
- function T(l) {
122
- switch (l.status) {
123
- case "DRAFT":
124
- return [
125
- l.supplier.internal === "restaurant" || l.supplier.internal === "warehouse" ? z[g.enum.submitRequest] : z[g.enum.confirmDraft],
126
- z[g.enum.cancelDraft],
127
- y[f.Update],
128
- y[f.Details],
129
- y[f.Print]
130
- ];
131
- case "RECEIVING":
132
- return [
133
- z[g.enum.completeReceive],
134
- y[f.Update],
135
- y[f.Details],
136
- y[f.Print]
137
- ];
138
- case "REQUESTING":
139
- return m === "receive/request" ? [
140
- y[f.Update],
141
- y[f.Details],
142
- y[f.Print]
143
- ] : [
144
- z[g.enum.approveRequest],
145
- z[g.enum.rejectRequest],
146
- y[f.Details],
147
- y[f.Print]
148
- ];
149
- case "PROCESSING":
150
- return [y[f.Details], y[f.Print]];
151
- case "COMPLETE":
152
- return [
153
- y[f.Update],
154
- y[f.Details],
155
- y[f.Print]
156
- ];
157
- case "CANCEL":
158
- default:
159
- return [y[f.Details], y[f.Print]];
160
- }
161
- }
162
- function D(l) {
163
- return Object.values(g.enum).includes(l);
164
- }
165
- async function A(l, o, a) {
166
- var V, B;
167
- const p = Se(o);
168
- if (l === f.Print) {
169
- Ve(p, _.currentLocation);
170
- return;
171
- }
172
- if (l === f.Details) {
173
- k.promptShowTransferDetails(p, a);
174
- return;
175
- }
176
- if (l === f.Update) {
177
- (V = k.promptUpdateTransferDialog) == null || V.call(k, p);
178
- return;
179
- }
180
- if (D(l)) {
181
- k.submitAction(o, l, (B = a == null ? void 0 : a.to) == null ? void 0 : B.dbName);
182
- return;
183
- }
184
- }
185
- function c() {
186
- return [
187
- {
188
- accessorKey: "seqNumber",
189
- header: () => r("inventory.transfer.table.seqNo"),
190
- enableSorting: !0,
191
- size: 80,
192
- sortUndefined: "last"
193
- },
194
- {
195
- accessorKey: "_id",
196
- header: () => r("inventory.transfer.table.createdAt"),
197
- cell(l) {
198
- return ae(`${l.getValue()}`);
199
- },
200
- enableSorting: !0
201
- },
202
- {
203
- accessorKey: "supplier.name",
204
- header: () => r("inventory.transfer.table.transferFrom"),
205
- enableSorting: !0,
206
- size: 200
207
- },
208
- {
209
- accessorKey: "items.length",
210
- header: () => r("inventory.transfer.table.noOfItems"),
211
- enableSorting: !1,
212
- meta: {
213
- width: "10rem"
214
- }
215
- },
216
- {
217
- accessorKey: "ref",
218
- header: () => r("inventory.transfer.table.reference"),
219
- enableSorting: !1,
220
- size: "auto"
221
- },
222
- {
223
- accessorKey: "status",
224
- header: () => r("inventory.transfer.table.status"),
225
- cell(l) {
226
- const o = r(`inventory.transfer.status.${l.getValue() ?? ""}`), a = `${l.getValue() ?? ""}`.toLocaleLowerCase("en-us");
227
- return be(_e.FmChip, {
228
- label: o,
229
- class: `fm-status-badge fm-status-badge-${a}`,
230
- compact: !0
231
- });
232
- },
233
- enableSorting: !0,
234
- size: 200
235
- },
236
- {
237
- id: "action",
238
- cell(l) {
239
- const o = l.row.original, a = T(o);
240
- return ge(a, (p) => A(p, o));
241
- },
242
- enableSorting: !1,
243
- size: 40,
244
- meta: {
245
- cellClass: "",
246
- headerClass: ""
247
- }
248
- }
249
- ];
250
- }
251
- function U() {
252
- return [
253
- {
254
- accessorKey: "purchaseOrder.seqNumber",
255
- header: () => r("inventory.transfer.table.seqNo"),
256
- enableSorting: !0,
257
- size: 80,
258
- sortUndefined: "last"
259
- },
260
- {
261
- accessorKey: "purchaseOrder._id",
262
- header: () => r("inventory.transfer.table.createdAt"),
263
- cell(l) {
264
- return ae(`${l.getValue()}`);
265
- },
266
- enableSorting: !0
267
- },
268
- {
269
- accessorKey: "to.name",
270
- header: () => r("inventory.transfer.table.transferTo"),
271
- enableSorting: !1,
272
- size: 200
273
- },
274
- {
275
- accessorKey: "purchaseOrder.items.length",
276
- header: () => r("inventory.transfer.table.noOfItems"),
277
- enableSorting: !1
278
- },
279
- {
280
- accessorKey: "purchaseOrder.ref",
281
- header: () => r("inventory.transfer.table.reference"),
282
- enableSorting: !1,
283
- size: "auto"
284
- },
285
- {
286
- accessorKey: "purchaseOrder.status",
287
- header: () => r("inventory.transfer.table.status"),
288
- cell(l) {
289
- const o = r(`inventory.transfer.status.${l.getValue() ?? ""}`), a = `${l.getValue() ?? ""}`.toLocaleLowerCase("en-us");
290
- return be(_e.FmChip, {
291
- label: o,
292
- class: `fm-status-badge fm-status-badge-${a}`,
293
- compact: !0
294
- });
295
- },
296
- enableSorting: !0
297
- },
298
- {
299
- id: "action",
300
- cell(l) {
301
- const o = l.row.original, a = o.purchaseOrder ? T(o.purchaseOrder) : [];
302
- return ge(
303
- a,
304
- (p) => o.purchaseOrder ? A(p, o.purchaseOrder, o) : void 0
305
- );
306
- },
307
- enableSorting: !1,
308
- size: 40,
309
- meta: {
310
- cellClass: "",
311
- headerClass: ""
312
- }
313
- }
314
- ];
315
- }
316
- const L = re(() => m === "receive/request" ? c() : U());
317
- return {
318
- get columnDefs() {
319
- return L.value;
320
- }
321
- };
322
- }
323
- const Be = { class: "flex flex-col gap-16 w-full h-full" }, Ge = { class: "flex justify-between" }, He = { class: "fm-typo-en-body-lg-600" }, ze = { class: "flex flex-col gap-8" }, Qe = { class: "flex flex-col gap-4" }, Ye = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Je = { class: "flex gap-1" }, We = { class: "fm-typo-en-body-lg-600" }, Xe = {
324
- key: 0,
325
- class: "flex flex-col gap-4"
326
- }, Ze = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, et = { class: "fm-typo-en-body-lg-600" }, tt = { class: "flex flex-col gap-4" }, st = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, rt = { class: "fm-typo-en-body-lg-600" }, at = {
327
- key: 1,
328
- class: "flex flex-col gap-4"
329
- }, nt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ot = { class: "fm-typo-en-body-lg-600" }, lt = {
330
- key: 2,
331
- class: "flex flex-col gap-4"
332
- }, it = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ct = { class: "fm-typo-en-body-lg-600" }, ut = {
333
- key: 3,
334
- class: "flex flex-col gap-4"
335
- }, dt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, mt = { class: "fm-typo-en-body-lg-600" }, ft = {
336
- key: 4,
337
- class: "flex flex-col gap-4"
338
- }, vt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, pt = { class: "fm-typo-en-body-lg-600" }, yt = { class: "border border-fm-color-neutral-gray-200 fm-corner-radius-lg p-16" }, ht = { class: "flex flex-col gap-8" }, bt = { class: "fm-typo-en-body-lg-600" }, gt = { class: "flex w-full gap-4" }, _t = { class: "basis-1/2 shrink-0 grow fm-typo-en-body-lg-400 line-clamp-2" }, Rt = { class: "fm-typo-en-body-lg-600 line-clamp-2" }, Ot = { class: "flex w-full gap-4 fm-typo-en-body-sm-400" }, qt = { class: "grow fm-typo-en-body-lg-400 text-fm-color-typo-secondary line-clamp-1" }, kt = {
339
- key: 0,
340
- class: "line-clamp-1 fm-typo-en-body-lg-400 text-fm-color-typo-secondary"
341
- }, wt = {
342
- key: 1,
343
- class: "flex-1 xs:w-screen xs:max-w-full"
344
- }, xt = {
345
- key: 0,
346
- class: "flex flex-col items-center gap-8 h-full"
347
- }, Dt = ["src"], St = { class: "fm-typo-en-body-lg-600" }, Ct = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary px-16" }, At = {
348
- key: 1,
349
- class: "px-4 flex flex-col"
350
- }, Et = { class: "flex gap-12 content-stretch" }, Pt = {
351
- class: "flex flex-col w-24",
352
- name: "circles"
353
- }, Tt = { class: "flex-1 flex flex-col items-center" }, Nt = { class: "flex-1 flex flex-col items-center" }, Ft = {
354
- class: "py-12 flex flex-col gap-4",
355
- name: "received-at header"
356
- }, jt = { class: "fm-typo-en-body-lg-400" }, It = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, Ut = { class: "flex gap-12 content-stretch" }, Mt = {
357
- class: "flex flex-col w-24",
358
- name: "circles"
359
- }, $t = { class: "flex-1 flex flex-col items-center" }, Kt = {
360
- class: "py-12 flex flex-col gap-4 flex-1",
361
- name: "delivery details"
362
- }, Lt = { class: "flex flex-col gap-8" }, Vt = { class: "flex flex-col gap-4" }, Bt = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, Gt = { class: "fm-typo-en-body-lg-600" }, Ht = { class: "flex flex-col gap-4" }, zt = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, Qt = { class: "flex flex-col gap-4" }, Yt = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, Jt = { class: "fm-typo-en-body-lg-600" }, Wt = { class: "flex flex-col gap-4" }, Xt = {
363
- key: 0,
364
- class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary"
365
- }, Zt = { class: "fm-typo-en-body-lg-600" }, es = { class: "flex gap-8 xs:flex-col" }, ms = /* @__PURE__ */ xe({
366
- __name: "TransferDetails",
367
- props: {
368
- purchaseOrder: {},
369
- transferTo: {},
370
- transferToDbName: {},
371
- show: { type: Boolean },
372
- canResubmit: { type: Boolean },
373
- canApprove: { type: Boolean }
374
- },
375
- emits: ["update:show", "submitted"],
376
- setup(m, { emit: k }) {
377
- const _ = m, r = k, T = Ue(), D = Me(), A = Te(), { t: c } = Oe(), U = re(
378
- () => {
379
- var t, n, S, h;
380
- return ((n = (t = _.purchaseOrder) == null ? void 0 : t.supplier) == null ? void 0 : n.internal) === "restaurant" || ((h = (S = _.purchaseOrder) == null ? void 0 : S.supplier) == null ? void 0 : h.internal) === "warehouse" ? se.TRANSFER : se.PURCHASE;
381
- }
382
- ), L = [
383
- {
384
- label: c("inventory.transfer.receiveRequest.details.overview"),
385
- value: "overview"
386
- },
387
- {
388
- label: c("inventory.transfer.receiveRequest.details.deliveryHistory"),
389
- value: "deliveryHistory"
390
- }
391
- ], l = Z(L[0]), o = Z(!1), a = Z(""), p = Z(!0), V = je(), B = $e(_, "show");
392
- async function qe(t, n, S) {
393
- a.value = n, o.value = !0, p.value = !1;
394
- try {
395
- await V.processPurchaseOrder(
396
- {
397
- operation: n,
398
- doc: t,
399
- options: (
400
- // auto receive for supplier to warehouse
401
- (n === g.enum.confirmDraft || // auto receive for warehouse to warehouse
402
- n === g.enum.completeReceive) && A.autoReceiveWarehouse ? {
403
- autoReceive: !0
404
- } : void 0
405
- )
406
- },
407
- _.transferToDbName
408
- ), await new Promise((h) => setTimeout(h, 1e3)), D.open({
409
- title: "Success",
410
- message: S,
411
- type: "success"
412
- }), r("update:show", !1), r("submitted");
413
- } catch (h) {
414
- D.open({
415
- title: "Something went wrong",
416
- message: "Please try again.",
417
- type: "error"
418
- }), console.error("Error when submitting PO operation", n, t, h);
419
- } finally {
420
- a.value = "", o.value = !1, p.value = !0;
421
- }
422
- }
423
- async function M(t) {
424
- const n = Ie[t];
425
- if (!n) {
426
- D.open({
427
- title: "Something went wrong",
428
- message: `Cannot process order: ${Ne(t)}`,
429
- type: "error"
430
- });
431
- return;
432
- }
433
- const { successMessage: S, ...h } = n;
434
- T.open({
435
- title: h.title,
436
- message: h.message,
437
- primaryActions: h.primaryActions
438
- }).onPrimary(() => {
439
- _.purchaseOrder && qe(_.purchaseOrder, t, S);
440
- });
441
- }
442
- const ke = re(() => {
443
- var t, n;
444
- return ((t = _.purchaseOrder) == null ? void 0 : t.status) === q.enum.RECEIVING || ((n = _.purchaseOrder) == null ? void 0 : n.status) === q.enum.COMPLETE;
445
- }), we = re(() => {
446
- var Q, G, w;
447
- const S = (((Q = _.purchaseOrder) == null ? void 0 : Q.deliveryOrder) ?? []).flatMap((O) => O.received ?? []).reduce(
448
- (O, N) => {
449
- const H = O[N.sku._id] ?? [];
450
- return O[N.sku._id] = [...H, N], O;
451
- },
452
- {}
453
- ), h = Object.entries(S).reduce(
454
- (O, [N, H]) => {
455
- const E = H.reduce((F, j) => {
456
- const $ = Ae(
457
- F,
458
- Math.max(F.precision, j.amount.precision)
459
- );
460
- return Re($, j.amount);
461
- }, le(0));
462
- return O[N] = E, O;
463
- },
464
- {}
465
- ), ne = ((G = _.purchaseOrder) == null ? void 0 : G.items) ?? [];
466
- for (const O of ne)
467
- h[w = O.sku._id] ?? (h[w] = le(0));
468
- return h;
469
- });
470
- return (t, n) => {
471
- var N, H;
472
- const S = K("FmButtonGroup"), h = K("FmChip"), ne = K("FmMenuDivider"), Q = K("FmCard"), G = K("FmSpacer"), w = K("FmButton"), O = K("FmSideSheet");
473
- return d(), P(O, {
474
- header: s(c)("inventory.transfer.receiveRequest.details.title") + ((N = t.purchaseOrder) != null && N.seqNumber ? ` #${(H = t.purchaseOrder) == null ? void 0 : H.seqNumber}` : ""),
475
- modelValue: s(B),
476
- "onUpdate:modelValue": n[9] || (n[9] = (E) => De(B) ? B.value = E : null),
477
- "dismiss-away": p.value,
478
- "close-button": "",
479
- "max-width": 500
480
- }, {
481
- default: ee(() => {
482
- var E, F, j, $, Y, J;
483
- return [
484
- e("div", Be, [
485
- e("div", null, [
486
- I(S, {
487
- items: L,
488
- modelValue: l.value,
489
- "onUpdate:modelValue": n[0] || (n[0] = (u) => l.value = u)
490
- }, null, 8, ["modelValue"])
491
- ]),
492
- l.value.value === "overview" ? (d(), b(X, { key: 0 }, [
493
- I(Q, {
494
- variant: "outlined",
495
- class: "flex flex-col gap-8 px-12 py-16"
496
- }, {
497
- default: ee(() => {
498
- var u, R, x, W, C, de, me, fe, ve, pe, ye, he;
499
- return [
500
- e("div", Ge, [
501
- e("div", He, i(s(c)("inventory.transfer.receiveRequest.details.requestSummary")), 1),
502
- e("div", null, [
503
- I(h, {
504
- label: s(c)(`inventory.transfer.status.${(u = t.purchaseOrder) == null ? void 0 : u.status}`),
505
- class: te(`fm-status-badge fm-status-badge-${(x = (R = t.purchaseOrder) == null ? void 0 : R.status) == null ? void 0 : x.toLocaleLowerCase("en-us")}`),
506
- compact: ""
507
- }, null, 8, ["label", "class"])
508
- ])
509
- ]),
510
- I(ne),
511
- e("div", ze, [
512
- e("div", Qe, [
513
- e("div", Ye, [
514
- e("div", Je, i(s(c)("inventory.transfer.receiveRequest.details.createdAt")), 1)
515
- ]),
516
- e("div", We, i(s(ae)(((W = t.purchaseOrder) == null ? void 0 : W._id) ?? "")), 1)
517
- ]),
518
- (C = t.purchaseOrder) != null && C.effectiveAt ? (d(), b("div", Xe, [
519
- e("div", Ze, i(s(c)("inventory.transfer.receiveRequest.details.backdatedTo")), 1),
520
- e("div", et, i(s(ce)(new Date((de = t.purchaseOrder) == null ? void 0 : de.effectiveAt))), 1)
521
- ])) : v("", !0),
522
- e("div", tt, [
523
- e("div", st, i(s(c)("inventory.transfer.receiveRequest.details.type.title")), 1),
524
- e("div", rt, i(s(c)(
525
- `inventory.transfer.receiveRequest.details.type.${U.value.toLocaleLowerCase("en-US")}`
526
- )), 1)
527
- ]),
528
- (fe = (me = t.purchaseOrder) == null ? void 0 : me.supplier) != null && fe.name ? (d(), b("div", at, [
529
- e("div", nt, i(s(c)("inventory.transfer.receiveRequest.details.from")), 1),
530
- e("div", ot, i((pe = (ve = t.purchaseOrder) == null ? void 0 : ve.supplier) == null ? void 0 : pe.name), 1)
531
- ])) : v("", !0),
532
- t.transferTo ? (d(), b("div", lt, [
533
- e("div", it, i(s(c)("inventory.transfer.receiveRequest.details.to")), 1),
534
- e("div", ct, i(t.transferTo), 1)
535
- ])) : v("", !0),
536
- (ye = t.purchaseOrder) != null && ye.ref ? (d(), b("div", ut, [
537
- e("div", dt, i(s(c)("inventory.transfer.receiveRequest.details.reference")), 1),
538
- e("div", mt, i(t.purchaseOrder.ref), 1)
539
- ])) : v("", !0),
540
- (he = t.purchaseOrder) != null && he.remark ? (d(), b("div", ft, [
541
- e("div", vt, i(s(c)("inventory.transfer.receiveRequest.details.remark")), 1),
542
- e("div", pt, i(t.purchaseOrder.remark), 1)
543
- ])) : v("", !0)
544
- ])
545
- ];
546
- }),
547
- _: 1
548
- }),
549
- e("div", yt, [
550
- e("div", ht, [
551
- e("div", bt, i(ke.value ? s(c)("inventory.transfer.receiveRequest.details.receivedItems") : s(c)("inventory.transfer.receiveRequest.details.requestedItems")), 1),
552
- (d(!0), b(X, null, oe(((E = t.purchaseOrder) == null ? void 0 : E.items) ?? [], (u) => (d(), b("div", {
553
- key: u.code,
554
- class: "flex flex-col"
555
- }, [
556
- e("div", gt, [
557
- e("div", _t, i(u.name), 1),
558
- e("div", Rt, i(s(ie)(we.value[u.sku._id], !1)) + "/" + i(s(ue)(u.quantity, u.sku.unit, u.measurement)), 1)
559
- ]),
560
- e("div", Ot, [
561
- e("div", qt, i(u.code), 1),
562
- u.totalCost && s(A).enableTotalCost ? (d(), b("div", kt, " (" + i(s(Ee)(u.totalCost)) + ") ", 1)) : v("", !0)
563
- ])
564
- ]))), 128))
565
- ])
566
- ])
567
- ], 64)) : v("", !0),
568
- l.value.value === "deliveryHistory" ? (d(), b("div", wt, [
569
- ((j = (F = t.purchaseOrder) == null ? void 0 : F.deliveryOrder) == null ? void 0 : j.length) === 0 ? (d(), b("div", xt, [
570
- I(G),
571
- e("div", null, [
572
- e("img", {
573
- src: s(Ke),
574
- alt: "List is empty"
575
- }, null, 8, Dt)
576
- ]),
577
- e("div", St, i(s(c)("inventory.transfer.receiveRequest.details.noRecordsFound")), 1),
578
- e("div", Ct, i(s(c)("inventory.transfer.receiveRequest.details.trackDeliveryMessage")), 1),
579
- I(G),
580
- I(G)
581
- ])) : v("", !0),
582
- ($ = t.purchaseOrder) != null && $.deliveryOrder && ((Y = t.purchaseOrder) == null ? void 0 : Y.deliveryOrder.length) > 0 ? (d(), b("div", At, [
583
- (d(!0), b(X, null, oe((J = t.purchaseOrder) == null ? void 0 : J.deliveryOrder, (u, R) => (d(), b(X, { key: R }, [
584
- e("div", Et, [
585
- e("div", Pt, [
586
- e("div", Tt, [
587
- e("div", {
588
- class: te([
589
- {
590
- "bg-fm-color-primary": R !== 0,
591
- "bg-white": R === 0
592
- },
593
- "w-[2px] h-full"
594
- ])
595
- }, null, 2)
596
- ]),
597
- n[10] || (n[10] = e("div", { class: "h-24 w-24 bg-fm-color-primary rounded-full" }, null, -1)),
598
- e("div", Nt, [
599
- e("div", {
600
- class: te([
601
- {
602
- "bg-fm-color-primary": R < t.purchaseOrder.deliveryOrder.length - 1,
603
- "bg-white": R >= t.purchaseOrder.deliveryOrder.length - 1
604
- },
605
- "w-[2px] h-full"
606
- ])
607
- }, null, 2)
608
- ])
609
- ]),
610
- e("div", Ft, [
611
- e("div", jt, i(s(c)("inventory.transfer.receiveRequest.details.received")), 1),
612
- e("div", It, i(s(ce)(new Date(u.createdAt))) + ", " + i(s(Pe)(new Date(u.createdAt))), 1)
613
- ])
614
- ]),
615
- e("div", Ut, [
616
- e("div", Mt, [
617
- e("div", $t, [
618
- e("div", {
619
- class: te([
620
- {
621
- "bg-fm-color-primary": R < t.purchaseOrder.deliveryOrder.length - 1,
622
- "bg-white": R >= t.purchaseOrder.deliveryOrder.length - 1
623
- },
624
- "w-[2px] h-full"
625
- ])
626
- }, null, 2)
627
- ])
628
- ]),
629
- e("div", Kt, [
630
- I(Q, {
631
- variant: "outlined",
632
- class: "py-12 px-16"
633
- }, {
634
- default: ee(() => [
635
- e("div", Lt, [
636
- e("div", Vt, [
637
- e("div", Bt, i(s(c)("inventory.transfer.receiveRequest.details.receivedBy")), 1),
638
- e("div", Gt, i(u.createdBy.name), 1)
639
- ]),
640
- e("div", Ht, [
641
- e("div", zt, i(s(c)("inventory.transfer.receiveRequest.details.receivedItems")), 1),
642
- (d(!0), b(X, null, oe(u.received, (x) => (d(), b("div", {
643
- class: "fm-typo-en-body-lg-600",
644
- key: x.sku._id
645
- }, i(x.sku.name) + " " + i(s(ue)(x.amount, x.sku.unit, x.measurement)), 1))), 128))
646
- ]),
647
- e("div", Qt, [
648
- e("div", Yt, i(s(c)("inventory.transfer.receiveRequest.details.deliveryOrderNo")), 1),
649
- e("div", Jt, i(u.deliveryOrderNumber.trim().length ? u.deliveryOrderNumber : "-"), 1)
650
- ]),
651
- e("div", Wt, [
652
- u.remark ? (d(), b("div", Xt, i(s(c)("inventory.transfer.receiveRequest.details.deliveryRemark")), 1)) : v("", !0),
653
- e("div", Zt, i(u.remark), 1)
654
- ])
655
- ])
656
- ]),
657
- _: 2
658
- }, 1024)
659
- ])
660
- ])
661
- ], 64))), 128))
662
- ])) : v("", !0)
663
- ])) : v("", !0)
664
- ])
665
- ];
666
- }),
667
- "side-sheet-footer": ee(() => {
668
- var E, F, j, $, Y, J, u, R, x, W;
669
- return [
670
- e("div", es, [
671
- ((E = t.purchaseOrder) == null ? void 0 : E.status) === s(q).enum.DRAFT && U.value === s(se).PURCHASE ? (d(), P(w, {
672
- key: 0,
673
- label: s(c)("inventory.transfer.receiveRequest.actions.confirmDraft"),
674
- onClick: n[1] || (n[1] = (C) => M("confirmDraft")),
675
- loading: a.value === "confirmDraft",
676
- disabled: a.value !== "confirmDraft" && o.value
677
- }, null, 8, ["label", "loading", "disabled"])) : v("", !0),
678
- ((F = t.purchaseOrder) == null ? void 0 : F.status) === s(q).enum.DRAFT && U.value === s(se).TRANSFER ? (d(), P(w, {
679
- key: 1,
680
- label: s(c)("inventory.transfer.receiveRequest.actions.submitRequest"),
681
- onClick: n[2] || (n[2] = (C) => M("submitRequest")),
682
- loading: a.value === "submitRequest",
683
- disabled: a.value !== "submitRequest" && o.value
684
- }, null, 8, ["label", "loading", "disabled"])) : v("", !0),
685
- ((j = t.purchaseOrder) == null ? void 0 : j.status) === s(q).enum.DRAFT ? (d(), P(w, {
686
- key: 2,
687
- label: s(c)("inventory.transfer.receiveRequest.actions.cancelDraft"),
688
- onClick: n[3] || (n[3] = (C) => M("cancelDraft")),
689
- loading: a.value === "cancelDraft",
690
- disabled: a.value !== "cancelDraft" && o.value,
691
- variant: "destructive"
692
- }, null, 8, ["label", "loading", "disabled"])) : v("", !0),
693
- (($ = t.purchaseOrder) == null ? void 0 : $.status) === s(q).enum.RECEIVING ? (d(), P(w, {
694
- key: 3,
695
- label: s(c)("inventory.transfer.receiveRequest.actions.completeReceive"),
696
- onClick: n[4] || (n[4] = (C) => M("completeReceive")),
697
- loading: a.value === "completeReceive",
698
- disabled: a.value !== "completeReceive" && o.value
699
- }, null, 8, ["label", "loading", "disabled"])) : v("", !0),
700
- t.canResubmit ? (d(), P(w, {
701
- key: 4,
702
- label: s(c)("inventory.transfer.receiveRequest.actions.resubmitRequest"),
703
- onClick: n[5] || (n[5] = (C) => M("submitRequest")),
704
- loading: a.value === "submitRequest",
705
- disabled: a.value !== "submitRequest" && o.value
706
- }, null, 8, ["label", "loading", "disabled"])) : v("", !0),
707
- (((Y = t.purchaseOrder) == null ? void 0 : Y.status) === s(q).enum.REQUESTING || ((J = t.purchaseOrder) == null ? void 0 : J.status) === s(q).enum.PROCESSING) && t.canApprove ? (d(), P(w, {
708
- key: 5,
709
- label: s(c)("inventory.transfer.approval.actions.approveRequest"),
710
- onClick: n[6] || (n[6] = (C) => M("approveRequest")),
711
- loading: a.value === "approveRequest",
712
- disabled: a.value !== "approveRequest" && o.value
713
- }, null, 8, ["label", "loading", "disabled"])) : v("", !0),
714
- ((u = t.purchaseOrder) == null ? void 0 : u.status) === s(q).enum.REQUESTING && t.canApprove ? (d(), P(w, {
715
- key: 6,
716
- label: s(c)("inventory.transfer.approval.actions.rejectRequest"),
717
- onClick: n[7] || (n[7] = (C) => M("rejectRequest")),
718
- loading: a.value === "rejectRequest",
719
- disabled: a.value !== "rejectRequest" && o.value,
720
- variant: "destructive"
721
- }, null, 8, ["label", "loading", "disabled"])) : v("", !0),
722
- ((R = t.purchaseOrder) == null ? void 0 : R.status) !== s(q).enum.COMPLETE && ((x = t.purchaseOrder) == null ? void 0 : x.status) !== s(q).enum.CANCEL && (((W = t.purchaseOrder) == null ? void 0 : W.status) !== s(q).enum.REQUESTING || t.canApprove) ? (d(), P(w, {
723
- key: 7,
724
- label: s(c)("common.close"),
725
- variant: "tertiary",
726
- onClick: n[8] || (n[8] = (C) => r("update:show", !1))
727
- }, null, 8, ["label"])) : v("", !0)
728
- ])
729
- ];
730
- }),
731
- _: 1
732
- }, 8, ["header", "modelValue", "dismiss-away"]);
733
- };
734
- }
735
- });
736
- export {
737
- ms as _,
738
- Le as g,
739
- ds as u
740
- };