@feedmepos/mf-inventory-portal 0.0.25-dev.11 → 0.0.25-dev.13

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 (65) hide show
  1. package/dist/{App-CO-6e1yq.js → App-Dh5gRSP-.js} +2 -2
  2. package/dist/ApprovalView-D5uEtt6k.js +140 -0
  3. package/dist/{BindingsDialog-oWRH8tAd.js → BindingsDialog-CTFT3z8w.js} +2 -2
  4. package/dist/{BindingsPicker-CpM2ldne.js → BindingsPicker-2Ef8BRE7.js} +1 -1
  5. package/dist/{BindingsTable-BA3ATsO3.js → BindingsTable-CGygQ1XK.js} +1 -1
  6. package/dist/{ClosingDraftView-CS2v3zbm.js → ClosingDraftView-BJypLAmr.js} +2 -2
  7. package/dist/{ClosingTemplateView-BS8RaUgX.js → ClosingTemplateView-Q5DzidlM.js} +2 -2
  8. package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-7qLOtuzy.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-46g6-tKZ.js} +3 -3
  9. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-Dn5wTNsE.js → FmUnitInput.vue_vue_type_script_setup_true_lang-6bQg2aCs.js} +1 -1
  10. package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-Wv_HtVUG.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-BkV9XenY.js} +1 -1
  11. package/dist/{IngredientGroupView-DLDfRzPQ.js → IngredientGroupView-APUX5LH2.js} +1 -1
  12. package/dist/{IngredientsView-IpEhZhFt.js → IngredientsView-CMg_ceRg.js} +4 -4
  13. package/dist/{IntegrationView-D8DFRPr1.js → IntegrationView-_8RPUhEn.js} +1 -1
  14. package/dist/{InventoryBindingForm-9255LnDG.js → InventoryBindingForm-Tl-zMqto.js} +1 -1
  15. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-BqlOlgnY.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-BJRsnj9t.js} +54 -54
  16. package/dist/{InventoryBindingSummary-BPEwj0Gs.js → InventoryBindingSummary-DEWxs1BN.js} +1 -1
  17. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-E53iSENL.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-C6JAyWVz.js} +1 -1
  18. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-CByTbk0u.js → PremiumBadge.vue_vue_type_script_setup_true_lang-B-cgItiN.js} +1 -1
  19. package/dist/{PublishView-SUyD0hW-.js → PublishView-BNyLfPLp.js} +2 -2
  20. package/dist/{PurchaseOrderPrintPreview-CSi_l2J8.js → PurchaseOrderPrintPreview-DU11dxSl.js} +1 -1
  21. package/dist/ReceiveRequestView-BxiADYjh.js +2239 -0
  22. package/dist/{RecipeView-DYGIII7T.js → RecipeView-D_qa4uZi.js} +3 -3
  23. package/dist/{StockView-DjQlAXbi.js → StockView-BsyPwHaJ.js} +7 -7
  24. package/dist/{SupplierView-CB8pq2dk.js → SupplierView-BudjeZWP.js} +4 -4
  25. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-D-9e8rDq.js +1494 -0
  26. package/dist/TransferTemplateView-DnuPDeZP.js +1660 -0
  27. package/dist/{UnitView-DD8sGjaR.js → UnitView-0WXciTrD.js} +3 -3
  28. package/dist/{WarehouseView-BE131osn.js → WarehouseView-BqjRTN_3.js} +1 -1
  29. package/dist/api/purchase-order.d.ts +1 -0
  30. package/dist/{app-CbAke6dP.js → app-MFSGVtiz.js} +4494 -4276
  31. package/dist/app.js +1 -1
  32. package/dist/components/FmMultiselectDialog.d.ts +23 -0
  33. package/dist/{decimal-ITAjlTW6.js → decimal-rt-lEA2N.js} +1 -1
  34. package/dist/{feature-Dq5knPmf.js → feature-DNwxU2wo.js} +7 -2
  35. package/dist/{format-unit-display-D-Ho5ga9.js → format-unit-display-B8C39Cxn.js} +2 -2
  36. package/dist/{index-DpN0zX69.js → index-DIxkPrGm.js} +2 -2
  37. package/dist/{stock-CjI4mNO9.js → stock-3RGlApSR.js} +1 -1
  38. package/dist/style.css +1 -1
  39. package/dist/{supplier-DnImzKTa.js → supplier-DDg5BqMd.js} +1 -1
  40. package/dist/tsconfig.app.tsbuildinfo +1 -1
  41. package/dist/{use-ingredient-select-dialog-AgNLUJRC.js → use-ingredient-select-dialog-D_9-XpBR.js} +1 -1
  42. package/dist/{use-inventory-binding-dialog-sJsbhbQI.js → use-inventory-binding-dialog-F-PVAZwM.js} +1 -1
  43. package/dist/views/receive-request/components/netsuite/NetSuiteProps.d.ts +2 -0
  44. package/dist/views/receive-request/components/transfer-details/TransferDetailsProps.d.ts +2 -0
  45. package/dist/views/receive-request/components/transfer-form/TransferForm.vue.d.ts +370 -0
  46. package/dist/views/receive-request/components/transfer-form/components/ForecastStock.vue.d.ts +46 -0
  47. package/dist/views/receive-request/components/transfer-form/components/TransferItemTable.vue.d.ts +490 -2
  48. package/dist/views/receive-request/components/transfer-form/components/TransferSubItemTable.vue.d.ts +72 -0
  49. package/dist/views/receive-request/components/transfer-form/composables/use-transfer-items.d.ts +24 -0
  50. package/dist/views/receive-request/components/transfer-form/helpers/calculate-sub-item-total.helper.d.ts +4 -0
  51. package/dist/views/receive-request/composables/use-receive-request-form.d.ts +630 -2
  52. package/dist/views/receive-request/composables/use-receive-request-table.d.ts +626 -2
  53. package/dist/views/transfer-template/components/transfer-template-form/components/TransferTemplateItem.vue.d.ts +270 -2
  54. package/dist/views/transfer-template/components/transfer-template-form/components/TransferTemplateItemTable.vue.d.ts +286 -0
  55. package/dist/views/transfer-template/components/transfer-template-form/components/TransferTemplateSubItem.vue.d.ts +74 -0
  56. package/dist/views/transfer-template/components/transfer-template-form/components/TransferTemplateSubItemTable.vue.d.ts +92 -0
  57. package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-template-items.d.ts +35 -0
  58. package/dist/views/transfer-template/composables/use-transfer-template-actions.d.ts +420 -0
  59. package/dist/views/transfer-template/composables/use-transfer-template-table.d.ts +420 -0
  60. package/dist/{vue-i18n-DYyu2tND.js → vue-i18n-DEHYDDMC.js} +395 -395
  61. package/package.json +3 -3
  62. package/dist/ApprovalView-CibKgQlF.js +0 -138
  63. package/dist/ReceiveRequestView-DA7CofZ1.js +0 -1877
  64. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-IxGRO3vL.js +0 -1461
  65. package/dist/TransferTemplateView-CjVir2Ql.js +0 -1371
@@ -1,1461 +0,0 @@
1
- import { ref as G, computed as W, h as D, defineComponent as Re, unref as c, openBlock as b, createElementBlock as x, createElementVNode as e, toDisplayString as S, createCommentVNode as P, resolveComponent as Z, createVNode as L, createBlock as Q, isRef as Ge, withCtx as de, Fragment as re, normalizeClass as ye, createTextVNode as Se, renderList as pe, resolveDynamicComponent as ze } from "vue";
2
- import { W as He, u as be, aL as k, a5 as Ye, a7 as Qe, a8 as We, am as Je, d as Pe, e as Ie, av as B, T as Fe, aM as Ze, Y as we, K as he, i as fe, aN as Me, ac as ge, f as Ce, D as V, h as M, b as Be, a6 as Xe, as as $e, a0 as _e, ai as Ee } from "./app-CbAke6dP.js";
3
- import { useDialog as Oe, useSnackbar as xe, useProxiedModel as et } from "@feedmepos/ui-library";
4
- import { u as Ue } from "./feature-Dq5knPmf.js";
5
- import { b as tt, u as st, f as Le, P as ce } from "./format-unit-display-D-Ho5ga9.js";
6
- import { F as rt } from "./decimal-ITAjlTW6.js";
7
- import { useI18n as je } from "@feedmepos/mf-common";
8
- import { E as at } from "./empty-placeholder-wf6-BWE8.js";
9
- const Ke = He((v, y) => {
10
- const g = be();
11
- return {
12
- async readRequests(s) {
13
- const O = s ?? g.currentLocationDBName, i = `${v.inventoryBackendUrl}/${O}/purchase-request`;
14
- return await y.get(i);
15
- },
16
- async getPurchaseOrders({
17
- start: s,
18
- end: O
19
- }) {
20
- const i = g.currentLocationDBName, R = `${v.inventoryBackendUrl}/${i}/purchase-order`;
21
- return await y.get(`${R}?start=${s}&end=${O}`);
22
- },
23
- async getPurchaseOrderById(s) {
24
- const O = g.currentLocationDBName, i = `${v.inventoryBackendUrl}/${O}/purchase-order`;
25
- return await y.get(`${i}/${s}`);
26
- },
27
- async processPurchaseOrder(s, O) {
28
- const i = g.currentLocationDBName, R = O || i, l = `${v.inventoryBackendUrl}/${R}/purchase-order/run-operation`;
29
- return await y.put(l, s);
30
- },
31
- async createPurchaseOrder(s) {
32
- const O = g.currentLocationDBName, i = `${v.inventoryBackendUrl}/${O}/purchase-order`;
33
- return await y.post(i, s);
34
- },
35
- async updatePurchaseOrder(s) {
36
- const O = g.currentLocationDBName, i = `${v.inventoryBackendUrl}/${O}/purchase-order`;
37
- return await y.put(i, s);
38
- }
39
- };
40
- }), Ve = {
41
- [k.enum.confirmDraft]: {
42
- primaryActions: {
43
- text: "Confirm draft",
44
- close: !0
45
- },
46
- title: "Confirm draft?",
47
- message: "Purchase order cannot be changed after confirm draft.",
48
- successMessage: "Purchase order draft has been confirmed"
49
- },
50
- [k.enum.cancelDraft]: {
51
- primaryActions: {
52
- text: "Cancel draft",
53
- close: !0,
54
- variant: "destructive"
55
- },
56
- title: "Cancel draft?",
57
- message: "Purchase order cannot be changed after cancelled draft.",
58
- successMessage: "Purchase order draft has been cancelled"
59
- },
60
- [k.enum.submitRequest]: {
61
- primaryActions: {
62
- text: "Submit request",
63
- close: !0
64
- },
65
- title: "Confirm draft?",
66
- message: "Purchase order cannot be changed after confirm draft.",
67
- successMessage: "Purchase order draft has been submitted"
68
- },
69
- [k.enum.completeReceive]: {
70
- primaryActions: {
71
- text: "Mark received",
72
- close: !0
73
- },
74
- title: "Mark as received",
75
- message: "Purchase order cannot be changed after it has complete receiving.",
76
- successMessage: "Purchase order has been marked as received"
77
- },
78
- [k.enum.approveRequest]: {
79
- primaryActions: {
80
- text: "Approve request",
81
- close: !0
82
- },
83
- title: "Approve request?",
84
- message: "Purchase order will be approved.",
85
- successMessage: "Purchase order has been approved"
86
- },
87
- [k.enum.rejectRequest]: {
88
- primaryActions: {
89
- text: "Reject request",
90
- close: !0,
91
- variant: "destructive"
92
- },
93
- title: "Reject request?",
94
- message: "Purchase order will be rejected.",
95
- successMessage: "Purchase order has been rejected"
96
- }
97
- }, ve = G();
98
- function Es(v, y) {
99
- const g = Oe(), s = be(), O = Ue(), i = tt(), R = st(), l = G(!1), h = xe(), o = Ke(), r = G(new Array()), u = G(
100
- y != null && y.startDate && (y != null && y.endDate) ? y : Ye()
101
- ), m = W(() => {
102
- const p = new Date(u.value.startDate), d = new Date(u.value.endDate);
103
- return {
104
- start: Qe(p).toISOString(),
105
- end: We(d).toISOString()
106
- };
107
- }), f = G(new Array()), $ = Je(), Y = G(null);
108
- async function ae(p) {
109
- function d(n) {
110
- const _ = {
111
- mode: Pe.CREATE,
112
- modelValue: p || void 0,
113
- show: !0,
114
- "onUpdate:show"(w) {
115
- ve.value.show = w;
116
- },
117
- templateId: n,
118
- lastClosingDate: Y.value
119
- };
120
- ve.value = _;
121
- }
122
- let N;
123
- O.mustUsePoTemplate && !(p != null && p.template) ? g.open({
124
- title: "Create transfer",
125
- message: "",
126
- primaryActions: {
127
- text: "Select a template",
128
- close: !0
129
- },
130
- secondaryActions: {
131
- text: "Outlet to Outlet",
132
- variant: "secondary",
133
- close: !0
134
- }
135
- }).onPrimary(async () => {
136
- N = await i.getTemplateId(), N && d(N);
137
- }).onSecondary(() => {
138
- d(void 0);
139
- }) : d(N);
140
- }
141
- function ie(p) {
142
- const d = {
143
- mode: Pe.UPDATE,
144
- modelValue: Ie(p),
145
- show: !0,
146
- "onUpdate:show"(N) {
147
- ve.value.show = N;
148
- },
149
- lastClosingDate: Y.value
150
- };
151
- ve.value = d;
152
- }
153
- async function z() {
154
- r.value = [], l.value = !0;
155
- try {
156
- r.value = await o.getPurchaseOrders(m.value).then((N) => N.sort((n, _) => _._id.localeCompare(n._id)));
157
- const p = await $.readLastClosing(!0), d = p == null ? void 0 : p._id;
158
- d && (Y.value = Ze(d)), O.mustUsePoTemplate && await R.fetchTemplates();
159
- } catch {
160
- h.open({
161
- title: "Something went wrong",
162
- message: "Error at fetching purchase orders",
163
- type: "error"
164
- });
165
- } finally {
166
- l.value = !1;
167
- }
168
- }
169
- async function ue() {
170
- f.value = [], l.value = !0;
171
- try {
172
- f.value = await o.readRequests().then((p) => p.reverse());
173
- } catch {
174
- h.open({
175
- title: "Something went wrong",
176
- message: "Error at fetching purchase requests",
177
- type: "error"
178
- });
179
- } finally {
180
- l.value = !1;
181
- }
182
- }
183
- function X() {
184
- switch (v) {
185
- case "receive/request":
186
- return z();
187
- case "approval":
188
- return ue();
189
- }
190
- }
191
- function ne(p, d) {
192
- u.value = {
193
- startDate: p,
194
- endDate: d
195
- }, X();
196
- }
197
- s.watchLocation(async (p) => {
198
- if (!p) {
199
- r.value = [];
200
- return;
201
- }
202
- await X();
203
- });
204
- const ee = G(), t = G(Math.random().toString());
205
- async function a(p, d) {
206
- var w, E;
207
- const N = Math.random().toString();
208
- t.value = N;
209
- const n = v === "receive/request" ? s.currentLocation : d == null ? void 0 : d.to, _ = {
210
- poRequest: d,
211
- purchaseOrder: p,
212
- transferTo: n == null ? void 0 : n.name,
213
- transferToDbName: n == null ? void 0 : n.dbName,
214
- show: !0,
215
- canResubmit: !1,
216
- canApprove: v === "approval",
217
- "onUpdate:show"(T) {
218
- ee.value.show = T;
219
- }
220
- };
221
- if (ee.value = _, !(d || p.status !== B.enum.REQUESTING)) {
222
- try {
223
- d = (await o.readRequests(
224
- `${p.supplier.internal}_${p.supplier._id}`
225
- )).find((j) => j.purchaseOrderId === p._id);
226
- } catch {
227
- console.error("Error at fetching po request to check");
228
- }
229
- N === t.value && (ee.value.canResubmit = !d, ee.value.transferTo = (w = d == null ? void 0 : d.to) == null ? void 0 : w.name, ee.value.transferToDbName = (E = d == null ? void 0 : d.to) == null ? void 0 : E.dbName);
230
- }
231
- }
232
- async function C(p, d, N, n) {
233
- l.value = !0;
234
- try {
235
- await o.processPurchaseOrder(
236
- {
237
- operation: d,
238
- doc: p,
239
- options: (
240
- // auto receive for supplier to warehouse
241
- (d === k.enum.confirmDraft || // auto receive for warehouse to warehouse
242
- d === k.enum.completeReceive) && O.autoReceiveWarehouse ? {
243
- autoReceive: !0
244
- } : void 0
245
- )
246
- },
247
- n
248
- ), await new Promise((E) => setTimeout(E, 1e3));
249
- const w = be().currentLocationDBName.startsWith("restaurant_");
250
- d === k.enum.confirmDraft && p.effectiveAt && w ? h.open({
251
- title: "Success",
252
- message: `${N}. The backdate will be reflected once your POS has received this change.`,
253
- type: "success"
254
- }) : h.open({
255
- title: "Success",
256
- message: N,
257
- type: "success"
258
- });
259
- } catch (_) {
260
- h.open({
261
- title: "Something went wrong",
262
- message: "Please try again.",
263
- type: "error"
264
- }), console.error("Error when submitting PO operation", d, p, _);
265
- } finally {
266
- l.value = !1, X();
267
- }
268
- }
269
- async function q(p, d, N) {
270
- const n = Ve[d];
271
- if (!n) {
272
- h.open({
273
- title: "Something went wrong",
274
- message: `Cannot process order: ${Fe(d)}`,
275
- type: "error"
276
- });
277
- return;
278
- }
279
- const { successMessage: _, ...w } = n;
280
- g.open({
281
- title: w.title,
282
- message: w.message,
283
- primaryActions: w.primaryActions
284
- }).onPrimary(() => {
285
- C(p, d, _, N);
286
- });
287
- }
288
- return {
289
- purchaseOrders: r,
290
- purchaseRequests: f,
291
- updateDateRange: ne,
292
- fetchData: X,
293
- loading: l,
294
- transferDialogProps: ve,
295
- promptCreateTransferDialog: ae,
296
- promptUpdateTransferDialog: ie,
297
- transferDetailsProps: ee,
298
- promptShowTransferDetails: a,
299
- submitAction: q
300
- };
301
- }
302
- function nt(v, y) {
303
- return y.reduce(
304
- (s, O) => {
305
- const i = O.received.find((R) => R.sku._id === v._id);
306
- return i && (s = we(s, i.amount)), s;
307
- },
308
- rt.toPrecision(he(0), v.unit.precision)
309
- );
310
- }
311
- function ot(v, y) {
312
- const { name: g, address: s, regNo: O } = y.doc.profile, i = {
313
- name: g,
314
- registrationNumber: O,
315
- line1: s == null ? void 0 : s.line1,
316
- line2: s == null ? void 0 : s.line2,
317
- postcode: s == null ? void 0 : s.postcode,
318
- city: s == null ? void 0 : s.city,
319
- state: s == null ? void 0 : s.state,
320
- country: s == null ? void 0 : s.country
321
- }, R = {
322
- name: v.supplier.name,
323
- registrationNumber: v.supplier.registrationNumber,
324
- line1: v.supplier.address.line1,
325
- line2: v.supplier.address.line2,
326
- postcode: v.supplier.address.postcode,
327
- city: v.supplier.address.city,
328
- state: v.supplier.address.state,
329
- country: v.supplier.address.country
330
- }, l = v.items.map((u) => {
331
- const { sku: m, measurement: f } = u, $ = fe(
332
- nt(u.sku, v.deliveryOrder || []),
333
- !1
334
- );
335
- return {
336
- code: m.code,
337
- description: m.name,
338
- quantity: Le(u.quantity, m.unit, u.measurement),
339
- unit: (f == null ? void 0 : f.abbrev) || m.unit.abbrev,
340
- received: $
341
- };
342
- }), h = v.deliveryOrder.map((u) => ({
343
- createdAt: Me(new Date(u.createdAt)),
344
- ref: u.deliveryOrderNumber,
345
- remark: u.remark || "",
346
- items: u.received.map((m) => {
347
- var f;
348
- return {
349
- code: m.sku.code,
350
- description: m.sku.name,
351
- quantity: fe(m.amount),
352
- unit: ((f = m.measurement) == null ? void 0 : f.abbrev) || m.sku.unit.abbrev
353
- };
354
- })
355
- })), o = {
356
- orderNumber: v.seqNumber.toString(),
357
- createdAt: ge(v._id),
358
- ref: v.ref || "",
359
- remark: v.remark || "",
360
- buyer: i,
361
- supplier: R,
362
- items: l,
363
- status: v.status,
364
- deliveryOrders: h
365
- }, r = new URL(window.location.href);
366
- r.pathname = r.hostname.includes("inventory.feedme") ? "/receive-request/print-preview" : "/inventory/receive-request/print-preview", r.searchParams.append("data", JSON.stringify(o)), window.open(r.href, "_blank", "noreferrer");
367
- }
368
- const me = {
369
- submitRequest: {
370
- translationKey: "inventory.transfer.receiveRequest.actions.submitRequest",
371
- color: "text-fm-color-typo-primary",
372
- value: k.enum.submitRequest
373
- },
374
- confirmDraft: {
375
- translationKey: "inventory.transfer.receiveRequest.actions.confirmDraft",
376
- color: "text-fm-color-typo-primary",
377
- value: k.enum.confirmDraft
378
- },
379
- cancelDraft: {
380
- translationKey: "inventory.transfer.receiveRequest.actions.cancelDraft",
381
- color: "text-fm-color-typo-error",
382
- value: k.enum.cancelDraft
383
- },
384
- approveRequest: {
385
- translationKey: "inventory.transfer.receiveRequest.actions.approveRequest",
386
- color: "text-fm-color-typo-primary",
387
- value: k.enum.approveRequest
388
- },
389
- rejectRequest: {
390
- translationKey: "inventory.transfer.receiveRequest.actions.rejectRequest",
391
- color: "text-fm-color-typo-error",
392
- value: k.enum.rejectRequest
393
- },
394
- processRequest: {
395
- translationKey: "inventory.transfer.receiveRequest.actions.processRequest",
396
- color: "text-fm-color-typo-primary",
397
- value: k.enum.processRequest
398
- },
399
- receiveStock: {
400
- translationKey: "inventory.transfer.receiveRequest.actions.receiveStock",
401
- color: "text-fm-color-typo-primary",
402
- value: k.enum.receiveStock
403
- },
404
- completeReceive: {
405
- translationKey: "inventory.transfer.receiveRequest.actions.completeReceive",
406
- color: "text-fm-color-typo-primary",
407
- value: k.enum.completeReceive
408
- }
409
- };
410
- function Is(v, y) {
411
- const g = be(), { t: s } = je();
412
- function O(r) {
413
- switch (r.status) {
414
- case "DRAFT":
415
- return [
416
- V[M.Update],
417
- V[M.Details],
418
- r.supplier.internal === "restaurant" || r.supplier.internal === "warehouse" ? me[k.enum.submitRequest] : me[k.enum.confirmDraft],
419
- me[k.enum.cancelDraft],
420
- V[M.Print]
421
- ];
422
- case "RECEIVING":
423
- return [
424
- me[k.enum.completeReceive],
425
- V[M.Details],
426
- V[M.Print]
427
- ];
428
- case "REQUESTING":
429
- return v === "receive/request" ? [V[M.Details], V[M.Print]] : [
430
- me[k.enum.approveRequest],
431
- me[k.enum.rejectRequest],
432
- V[M.Details],
433
- V[M.Print]
434
- ];
435
- case "PROCESSING":
436
- return [V[M.Details], V[M.Print]];
437
- case "COMPLETE":
438
- case "CANCEL":
439
- default:
440
- return [V[M.Details], V[M.Print]];
441
- }
442
- }
443
- function i(r) {
444
- return Object.values(k.enum).includes(r);
445
- }
446
- async function R(r, u, m) {
447
- var $, Y;
448
- const f = Ie(u);
449
- if (r === M.Print) {
450
- ot(f, g.currentLocation);
451
- return;
452
- }
453
- if (r === M.Details) {
454
- y.promptShowTransferDetails(f, m);
455
- return;
456
- }
457
- if (r === M.Update) {
458
- ($ = y.promptUpdateTransferDialog) == null || $.call(y, f);
459
- return;
460
- }
461
- if (i(r)) {
462
- y.submitAction(u, r, (Y = m == null ? void 0 : m.to) == null ? void 0 : Y.dbName);
463
- return;
464
- }
465
- }
466
- function l() {
467
- return [
468
- {
469
- accessorKey: "seqNumber",
470
- header: () => s("inventory.transfer.table.seqNo"),
471
- enableSorting: !0,
472
- size: 80,
473
- sortUndefined: "last"
474
- },
475
- {
476
- accessorKey: "_id",
477
- header: () => s("inventory.transfer.table.createdAt"),
478
- cell(r) {
479
- return ge(`${r.getValue()}`);
480
- },
481
- enableSorting: !0
482
- },
483
- {
484
- accessorKey: "supplier.name",
485
- header: () => s("inventory.transfer.table.transferFrom"),
486
- enableSorting: !0,
487
- size: 200
488
- },
489
- {
490
- accessorKey: "items.length",
491
- header: () => s("inventory.transfer.table.noOfItems"),
492
- enableSorting: !1,
493
- meta: {
494
- width: "10rem"
495
- }
496
- },
497
- {
498
- accessorKey: "ref",
499
- header: () => s("inventory.transfer.table.reference"),
500
- enableSorting: !1,
501
- size: "auto"
502
- },
503
- {
504
- accessorKey: "status",
505
- header: () => s("inventory.transfer.table.status"),
506
- cell(r) {
507
- const u = s(`inventory.transfer.status.${r.getValue() ?? ""}`), m = `${r.getValue() ?? ""}`.toLocaleLowerCase("en-us");
508
- return D(
509
- "div",
510
- {
511
- class: "flex"
512
- },
513
- D(
514
- "div",
515
- {
516
- class: `fm-status-badge fm-status-badge-${m}`
517
- },
518
- u
519
- )
520
- );
521
- },
522
- enableSorting: !0,
523
- size: 200
524
- },
525
- {
526
- id: "action",
527
- cell(r) {
528
- const u = r.row.original, m = O(u);
529
- return Ce(m, (f) => R(f, u));
530
- },
531
- enableSorting: !1,
532
- size: 40,
533
- meta: {
534
- cellClass: "",
535
- headerClass: ""
536
- }
537
- }
538
- ];
539
- }
540
- function h() {
541
- return [
542
- {
543
- accessorKey: "purchaseOrder.seqNumber",
544
- header: () => s("inventory.transfer.table.seqNo"),
545
- enableSorting: !0,
546
- size: 80,
547
- sortUndefined: "last"
548
- },
549
- {
550
- accessorKey: "purchaseOrder._id",
551
- header: () => s("inventory.transfer.table.createdAt"),
552
- cell(r) {
553
- return ge(`${r.getValue()}`);
554
- },
555
- enableSorting: !0
556
- },
557
- {
558
- accessorKey: "to.name",
559
- header: () => s("inventory.transfer.table.transferTo"),
560
- enableSorting: !1,
561
- size: 200
562
- },
563
- {
564
- accessorKey: "purchaseOrder.items.length",
565
- header: () => s("inventory.transfer.table.noOfItems"),
566
- enableSorting: !1
567
- },
568
- {
569
- accessorKey: "purchaseOrder.ref",
570
- header: () => s("inventory.transfer.table.reference"),
571
- enableSorting: !1,
572
- size: "auto"
573
- },
574
- {
575
- accessorKey: "purchaseOrder.status",
576
- header: () => s("inventory.transfer.table.status"),
577
- cell(r) {
578
- const u = s(`inventory.transfer.status.${r.getValue() ?? ""}`), m = `${r.getValue() ?? ""}`.toLocaleLowerCase("en-us");
579
- return D(
580
- "div",
581
- {
582
- class: "flex"
583
- },
584
- D(
585
- "div",
586
- {
587
- class: `fm-status-badge fm-status-badge-${m}`
588
- },
589
- u
590
- )
591
- );
592
- },
593
- enableSorting: !0
594
- },
595
- {
596
- id: "action",
597
- cell(r) {
598
- const u = r.row.original, m = u.purchaseOrder ? O(u.purchaseOrder) : [];
599
- return Ce(
600
- m,
601
- (f) => u.purchaseOrder ? R(f, u.purchaseOrder, u) : void 0
602
- );
603
- },
604
- enableSorting: !1,
605
- size: 40,
606
- meta: {
607
- cellClass: "",
608
- headerClass: ""
609
- }
610
- }
611
- ];
612
- }
613
- const o = W(() => v === "receive/request" ? l() : h());
614
- return {
615
- get columnDefs() {
616
- return o.value;
617
- }
618
- };
619
- }
620
- const lt = {
621
- key: 0,
622
- class: "flex flex-col gap-8"
623
- }, ct = { class: "flex flex-col gap-4" }, it = { class: "fm-typo-en-body-lg-600" }, ut = {
624
- key: 0,
625
- class: "flex flex-col gap-4"
626
- }, dt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, mt = { class: "fm-typo-en-body-lg-600" }, ft = {
627
- key: 1,
628
- class: "flex flex-col gap-4"
629
- }, pt = { class: "fm-typo-en-body-lg-600" }, vt = {
630
- key: 2,
631
- class: "flex flex-col gap-4"
632
- }, yt = { class: "fm-typo-en-body-lg-600" }, ht = /* @__PURE__ */ Re({
633
- __name: "NetSuiteInfo",
634
- props: {
635
- transferType: {},
636
- transferToDbName: {},
637
- poRequest: {},
638
- purchaseOrder: {},
639
- isTransferBetweenOutlets: { type: Boolean }
640
- },
641
- setup(v) {
642
- const y = v, g = Be(), s = W(
643
- () => {
644
- var i, R, l, h, o, r;
645
- return g.getSubsidiaryFullName(
646
- ((l = (R = (i = y.purchaseOrder) == null ? void 0 : i.netSuite) == null ? void 0 : R.subsidiary) == null ? void 0 : l.id) || ((r = (o = (h = y.poRequest) == null ? void 0 : h.netSuite) == null ? void 0 : o.subsidiary) == null ? void 0 : r.id)
647
- ).fullName;
648
- }
649
- ), O = W(() => {
650
- var i, R, l, h, o, r;
651
- return (R = (i = y.purchaseOrder) == null ? void 0 : i.deliveryFullfillment) != null && R.length && ((h = (l = y.purchaseOrder) == null ? void 0 : l.deliveryFullfillment) == null ? void 0 : h.length) > 0 ? (r = (o = y.purchaseOrder) == null ? void 0 : o.deliveryFullfillment) == null ? void 0 : r.map((u) => {
652
- var m;
653
- return (m = u.netSuite) == null ? void 0 : m.refNo;
654
- }).join(", ") : "-";
655
- });
656
- return (i, R) => {
657
- var l, h, o, r, u, m, f, $, Y, ae, ie, z, ue, X;
658
- return c(g).isEnabled ? (b(), x("div", lt, [
659
- e("div", ct, [
660
- R[0] || (R[0] = e("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, "NetSuite subsidiary", -1)),
661
- e("div", it, S(s.value || "-"), 1)
662
- ]),
663
- i.isTransferBetweenOutlets ? P("", !0) : (b(), x("div", ut, [
664
- e("div", dt, " NetSuite " + S(i.transferType === c(ce).PURCHASE ? "Purchase Order" : "Transfer Order") + " (ID) ", 1),
665
- e("div", mt, S(i.poRequest ? (h = (l = i.poRequest) == null ? void 0 : l.netSuite) == null ? void 0 : h.refNo : (r = (o = i.purchaseOrder) == null ? void 0 : o.netSuite) == null ? void 0 : r.refNo) + " (" + S(i.poRequest ? (m = (u = i.poRequest) == null ? void 0 : u.netSuite) == null ? void 0 : m.id : ($ = (f = i.purchaseOrder) == null ? void 0 : f.netSuite) == null ? void 0 : $.id) + ") ", 1)
666
- ])),
667
- (ie = (ae = (Y = i.purchaseOrder) == null ? void 0 : Y.netSuite) == null ? void 0 : ae.additionalInfo) != null && ie.transactionnumber ? (b(), x("div", ft, [
668
- R[1] || (R[1] = e("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " NetSuite Transaction Number ", -1)),
669
- e("div", pt, S((X = (ue = (z = i.purchaseOrder) == null ? void 0 : z.netSuite) == null ? void 0 : ue.additionalInfo) == null ? void 0 : X.transactionnumber), 1)
670
- ])) : P("", !0),
671
- c(g).isEnabled && i.transferType === c(ce).TRANSFER && !i.isTransferBetweenOutlets ? (b(), x("div", vt, [
672
- R[2] || (R[2] = e("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " NetSuite fulfillment IDs ", -1)),
673
- e("div", yt, S(O.value), 1)
674
- ])) : P("", !0)
675
- ])) : P("", !0);
676
- };
677
- }
678
- }), bt = {
679
- key: 0,
680
- class: "flex flex-row-reverse"
681
- }, gt = /* @__PURE__ */ Re({
682
- __name: "NetSuiteSync",
683
- props: {
684
- poRequest: {},
685
- purchaseOrder: {},
686
- isTransferBetweenOutlets: { type: Boolean }
687
- },
688
- setup(v) {
689
- const y = v, g = Be(), s = xe(), O = Oe(), i = G(!1), R = W(() => {
690
- var u, m, f, $;
691
- let h = !0;
692
- g.isEnabled || (h = !1);
693
- const o = y.purchaseOrder, r = y.poRequest;
694
- return o && ((u = o == null ? void 0 : o.supplier) != null && u.internal ? (!r && o.status == B.enum.DRAFT && (h = !1), r && !((m = r == null ? void 0 : r.netSuite) != null && m.id) && (h = !1), y.isTransferBetweenOutlets && (h = !1)) : ((o == null ? void 0 : o.status) !== B.enum.REQUESTING && o.supplier.internal && (h = !1), !r && !((f = o == null ? void 0 : o.netSuite) != null && f.id) && (h = !1), !r && (($ = o == null ? void 0 : o.netSuite) != null && $.id) && (o == null ? void 0 : o.status) == B.enum.REQUESTING && (h = !1))), h;
695
- });
696
- async function l() {
697
- i.value || O.open({
698
- title: "Sync with NetSuite",
699
- contentComponent: D("div", [
700
- D("p", "Are you sure you want to sync now?"),
701
- D("br"),
702
- D(
703
- "p",
704
- { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" },
705
- "Please wait a moment before syncing manually to avoid unnecessary actions."
706
- )
707
- ]),
708
- primaryActions: {
709
- text: "Sync",
710
- close: !0,
711
- variant: "destructive"
712
- },
713
- secondaryActions: { text: "Not now", close: !0 }
714
- }).onPrimary(async () => {
715
- var h;
716
- try {
717
- i.value = !0;
718
- const o = y.purchaseOrder, r = y.poRequest;
719
- let u = "purchaseOrder";
720
- if ((h = o == null ? void 0 : o.supplier) != null && h.internal && (u = "purchaseOrderRequest"), !(o != null && o._id)) {
721
- s.open({
722
- title: "Error",
723
- message: "Invalid sync ID",
724
- type: "error"
725
- });
726
- return;
727
- }
728
- await g.syncTransferOrder(u, o == null ? void 0 : o._id, r == null ? void 0 : r._id), s.open({
729
- title: "Sync with NetSuite",
730
- message: "Requested to sync with NetSuite. Please wait a moment.",
731
- type: "success"
732
- });
733
- } catch {
734
- s.open({
735
- title: "Error",
736
- message: "Failed to sync with NetSuite",
737
- type: "error"
738
- });
739
- }
740
- setTimeout(() => {
741
- i.value = !1;
742
- }, 5e3);
743
- });
744
- }
745
- return (h, o) => {
746
- const r = Z("FmButton");
747
- return R.value ? (b(), x("div", bt, [
748
- L(r, {
749
- "prepend-icon": "sync",
750
- variant: "primary",
751
- label: "NetSuite",
752
- loading: i.value,
753
- onClick: l
754
- }, null, 8, ["loading"])
755
- ])) : P("", !0);
756
- };
757
- }
758
- }), St = { class: "flex flex-col gap-16 w-full h-full" }, _t = { class: "flex justify-between" }, wt = { class: "fm-typo-en-body-lg-600" }, Rt = { class: "flex flex-col gap-8" }, Ot = { class: "flex flex-col gap-4" }, xt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Dt = { class: "flex gap-1" }, kt = { class: "fm-typo-en-body-lg-600" }, Nt = {
759
- key: 0,
760
- class: "flex flex-col gap-4"
761
- }, At = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, qt = { class: "fm-typo-en-body-lg-600" }, Tt = { class: "flex flex-col gap-4" }, Pt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ct = { class: "fm-typo-en-body-lg-600" }, $t = {
762
- key: 1,
763
- class: "flex flex-col gap-4"
764
- }, Et = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, It = { class: "fm-typo-en-body-lg-600" }, Ft = {
765
- key: 2,
766
- class: "flex flex-col gap-4"
767
- }, Mt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Bt = { class: "fm-typo-en-body-lg-600" }, Ut = {
768
- key: 3,
769
- class: "flex flex-col gap-4"
770
- }, Lt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, jt = { class: "fm-typo-en-body-lg-600" }, Kt = {
771
- key: 4,
772
- class: "flex flex-col gap-4"
773
- }, Vt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Gt = { class: "fm-typo-en-body-lg-600" }, zt = { class: "border border-fm-color-neutral-gray-200 fm-corner-radius-lg p-16" }, Ht = { class: "flex flex-col gap-8" }, Yt = { class: "fm-typo-en-body-lg-600" }, Qt = { class: "flex gap-8" }, Wt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary flex flex-col gap-4" }, Jt = { class: "flex w-full gap-4" }, Zt = { class: "basis-1/2 shrink-0 grow fm-typo-en-body-lg-400 line-clamp-2" }, Xt = { class: "fm-typo-en-body-lg-600 line-clamp-2" }, es = { class: "flex w-full gap-4 fm-typo-en-body-sm-400" }, ts = { class: "grow fm-typo-en-body-lg-400 text-fm-color-typo-secondary line-clamp-1" }, ss = {
774
- key: 0,
775
- class: "line-clamp-1 fm-typo-en-body-lg-400 text-fm-color-typo-secondary"
776
- }, rs = { class: "py-8" }, as = { class: "flex justify-end gap-4 items-center" }, ns = { class: "fm-typo-en-body-lg-600" }, os = {
777
- key: 1,
778
- class: "flex-1 xs:w-screen xs:max-w-full"
779
- }, ls = {
780
- key: 0,
781
- class: "flex flex-col items-center gap-8 h-full"
782
- }, cs = ["src"], is = { class: "fm-typo-en-body-lg-600" }, us = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary px-16" }, ds = {
783
- key: 1,
784
- class: "px-4 flex flex-col"
785
- }, ms = { class: "flex gap-12 content-stretch" }, fs = {
786
- class: "flex flex-col w-24",
787
- name: "circles"
788
- }, ps = { class: "flex-1 flex flex-col items-center" }, vs = { class: "flex-1 flex flex-col items-center" }, ys = {
789
- class: "py-12 flex flex-col gap-4",
790
- name: "received-at header"
791
- }, hs = { class: "fm-typo-en-body-lg-400" }, bs = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, gs = { class: "flex gap-12 content-stretch" }, Ss = {
792
- class: "flex flex-col w-24",
793
- name: "circles"
794
- }, _s = { class: "flex-1 flex flex-col items-center" }, ws = {
795
- class: "py-12 flex flex-col gap-4 flex-1",
796
- name: "delivery details"
797
- }, Rs = { class: "flex flex-col gap-8" }, Os = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, xs = { class: "flex flex-col gap-4" }, Ds = { class: "flex gap-8 xs:flex-col" }, Fs = /* @__PURE__ */ Re({
798
- __name: "TransferDetails",
799
- props: {
800
- poRequest: {},
801
- purchaseOrder: {},
802
- transferTo: {},
803
- transferToDbName: {},
804
- show: { type: Boolean },
805
- canResubmit: { type: Boolean },
806
- canApprove: { type: Boolean }
807
- },
808
- emits: ["update:show", "submitted"],
809
- setup(v, { emit: y }) {
810
- const g = v, s = y, O = Oe(), i = xe(), R = Ue(), { t: l } = je(), h = W(
811
- () => {
812
- var t, a, C, q;
813
- return ((a = (t = g.purchaseOrder) == null ? void 0 : t.supplier) == null ? void 0 : a.internal) === "restaurant" || ((q = (C = g.purchaseOrder) == null ? void 0 : C.supplier) == null ? void 0 : q.internal) === "warehouse" ? ce.TRANSFER : ce.PURCHASE;
814
- }
815
- ), o = W(() => {
816
- var t, a, C;
817
- return h.value === ce.TRANSFER && ((t = g.transferToDbName) == null ? void 0 : t.startsWith("restaurant")) && ((C = (a = g.purchaseOrder) == null ? void 0 : a.supplier) == null ? void 0 : C.internal) === "restaurant";
818
- }), r = [
819
- {
820
- label: l("inventory.transfer.receiveRequest.details.overview"),
821
- value: "overview"
822
- },
823
- {
824
- label: l("inventory.transfer.receiveRequest.details.deliveryHistory"),
825
- value: "deliveryHistory"
826
- }
827
- ], u = G(r[0]), m = G(!1), f = G(""), $ = G(!0), Y = Ke(), ae = et(g, "show");
828
- async function ie(t, a, C) {
829
- f.value = a, m.value = !0, $.value = !1;
830
- try {
831
- await Y.processPurchaseOrder(
832
- {
833
- operation: a,
834
- doc: t,
835
- options: (
836
- // auto receive for supplier to warehouse
837
- (a === k.enum.confirmDraft || // auto receive for warehouse to warehouse
838
- a === k.enum.completeReceive) && R.autoReceiveWarehouse ? {
839
- autoReceive: !0
840
- } : void 0
841
- )
842
- },
843
- g.transferToDbName
844
- ), await new Promise((q) => setTimeout(q, 1e3)), i.open({
845
- title: "Success",
846
- message: C,
847
- type: "success"
848
- }), s("update:show", !1), s("submitted");
849
- } catch (q) {
850
- i.open({
851
- title: "Something went wrong",
852
- message: "Please try again.",
853
- type: "error"
854
- }), console.error("Error when submitting PO operation", a, t, q);
855
- } finally {
856
- f.value = "", m.value = !1, $.value = !0;
857
- }
858
- }
859
- async function z(t) {
860
- const a = Ve[t];
861
- if (!a) {
862
- i.open({
863
- title: "Something went wrong",
864
- message: `Cannot process order: ${Fe(t)}`,
865
- type: "error"
866
- });
867
- return;
868
- }
869
- const { successMessage: C, ...q } = a;
870
- O.open({
871
- title: q.title,
872
- message: q.message,
873
- primaryActions: q.primaryActions
874
- }).onPrimary(() => {
875
- g.purchaseOrder && ie(g.purchaseOrder, t, C);
876
- });
877
- }
878
- const ue = W(() => {
879
- var t, a;
880
- return ((t = g.purchaseOrder) == null ? void 0 : t.status) === B.enum.RECEIVING || ((a = g.purchaseOrder) == null ? void 0 : a.status) === B.enum.COMPLETE;
881
- }), X = W(() => {
882
- var d, N, n;
883
- const C = (((d = g.purchaseOrder) == null ? void 0 : d.deliveryOrder) ?? []).flatMap((_) => _.received ?? []).reduce(
884
- (_, w) => {
885
- const E = _[w.sku._id] ?? [];
886
- return _[w.sku._id] = [...E, w], _;
887
- },
888
- {}
889
- ), q = Object.entries(C).reduce(
890
- (_, [w, E]) => {
891
- const T = E.reduce((j, K) => {
892
- const J = Xe(
893
- j,
894
- Math.max(j.precision, K.amount.precision)
895
- );
896
- return we(J, K.amount);
897
- }, he(0));
898
- return _[w] = T, _;
899
- },
900
- {}
901
- ), p = ((N = g.purchaseOrder) == null ? void 0 : N.items) ?? [];
902
- for (const _ of p)
903
- q[n = _.sku._id] ?? (q[n] = he(0));
904
- return q;
905
- }), ne = W(() => {
906
- var d, N;
907
- const t = ((d = g.purchaseOrder) == null ? void 0 : d.deliveryOrder) ?? [], a = ((N = g.purchaseOrder) == null ? void 0 : N.deliveryFullfillment) ?? [], C = [
908
- ...t.map((n) => ({
909
- createdAt: n.createdAt,
910
- type: "grn",
911
- doc: n
912
- })),
913
- ...a.map((n) => ({
914
- createdAt: n.createdAt,
915
- type: "fulfillment",
916
- doc: n
917
- }))
918
- ];
919
- C.reverse().sort((n, _) => n.createdAt.localeCompare(_.createdAt));
920
- function q(n) {
921
- var w, E, T, j, K, J, oe;
922
- const _ = a.findIndex((U) => U.id === n.fullfillmentId);
923
- return {
924
- header: "Received",
925
- date: Ee(new Date(n.createdAt)),
926
- info: [
927
- {
928
- label: "Received by",
929
- values: [(w = n.createdBy) == null ? void 0 : w.name]
930
- },
931
- {
932
- label: "Received items",
933
- values: n.received.map((U) => {
934
- var le;
935
- return D("div", [
936
- D(
937
- "div",
938
- {
939
- class: "flex gap-4"
940
- },
941
- [
942
- D(
943
- "div",
944
- {
945
- class: "flex flex-col"
946
- },
947
- [
948
- D(
949
- "span",
950
- {
951
- class: "fm-typo-en-body-lg-800 basis-1/2 shrink-0 grow"
952
- },
953
- `${U.sku.name}`
954
- ),
955
- D(
956
- "span",
957
- {
958
- class: "fm-typo-en-body-md-400"
959
- },
960
- `${U.sku.code} `
961
- )
962
- ]
963
- ),
964
- D(
965
- "div",
966
- {
967
- class: "ml-auto flex flex-col"
968
- },
969
- [
970
- D(
971
- "div",
972
- {
973
- class: "ml-auto flex gap-1"
974
- },
975
- [
976
- D(
977
- "span",
978
- {
979
- class: "fm-typo-en-body-lg-600 self-end"
980
- },
981
- fe(U.amount, !1)
982
- ),
983
- D(
984
- "span",
985
- {
986
- class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary"
987
- },
988
- ((le = U.measurement) == null ? void 0 : le.abbrev) ?? U.sku.unit.abbrev
989
- )
990
- ]
991
- )
992
- ]
993
- )
994
- ]
995
- )
996
- ]);
997
- })
998
- },
999
- n.deliveryOrderNumber ? {
1000
- label: "Delivery order no.",
1001
- values: [n.deliveryOrderNumber]
1002
- } : null,
1003
- n.remark ? {
1004
- label: "Remark",
1005
- values: [n.remark]
1006
- } : null,
1007
- _ > -1 ? {
1008
- label: "Fulfilment's sequence",
1009
- values: [`${_ + 1}`]
1010
- } : null,
1011
- (T = (E = a[_]) == null ? void 0 : E.netSuite) != null && T.refNo ? {
1012
- label: "Fulfillment's ref no. (Netsuite)",
1013
- values: [(K = (j = a[_]) == null ? void 0 : j.netSuite) == null ? void 0 : K.refNo]
1014
- } : null,
1015
- (J = n == null ? void 0 : n.netSuite) != null && J.refNo ? {
1016
- label: "Item receipt (Netsuite)",
1017
- values: [(oe = n == null ? void 0 : n.netSuite) == null ? void 0 : oe.refNo]
1018
- } : null
1019
- ].filter((U) => U)
1020
- };
1021
- }
1022
- function p(n) {
1023
- var w, E;
1024
- const _ = a.findIndex((T) => T.id === n.id);
1025
- return {
1026
- header: "Fulfillment",
1027
- date: Ee(new Date(n.createdAt)),
1028
- info: [
1029
- {
1030
- label: "Sequence",
1031
- values: [String(_ + 1)]
1032
- },
1033
- {
1034
- label: "Receiveable items",
1035
- values: n.items.map((T) => {
1036
- var j;
1037
- return D("div", [
1038
- D(
1039
- "div",
1040
- {
1041
- class: "flex gap-4"
1042
- },
1043
- [
1044
- D(
1045
- "div",
1046
- {
1047
- class: "flex flex-col"
1048
- },
1049
- [
1050
- D(
1051
- "span",
1052
- {
1053
- class: "fm-typo-en-body-lg-800 basis-1/2 shrink-0 grow"
1054
- },
1055
- `${T.sku.name}`
1056
- ),
1057
- D(
1058
- "span",
1059
- {
1060
- class: "fm-typo-en-body-md-400"
1061
- },
1062
- `${T.sku.code} `
1063
- )
1064
- ]
1065
- ),
1066
- D(
1067
- "div",
1068
- {
1069
- class: "ml-auto flex flex-col"
1070
- },
1071
- [
1072
- D(
1073
- "div",
1074
- {
1075
- class: "ml-auto flex gap-1"
1076
- },
1077
- [
1078
- D(
1079
- "span",
1080
- {
1081
- class: "fm-typo-en-body-lg-600 self-end"
1082
- },
1083
- fe(T.amount, !1)
1084
- ),
1085
- D(
1086
- "span",
1087
- {
1088
- class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary"
1089
- },
1090
- ((j = T.measurement) == null ? void 0 : j.abbrev) ?? T.sku.unit.abbrev
1091
- )
1092
- ]
1093
- ),
1094
- D(
1095
- "div",
1096
- {
1097
- class: "flex self-end fm-typo-en-body-md-400 text-fm-color-typo-secondary"
1098
- },
1099
- `${T.cost ? `(${_e(T.cost)})` : ""}`
1100
- )
1101
- ]
1102
- )
1103
- ]
1104
- )
1105
- ]);
1106
- })
1107
- },
1108
- (w = n.netSuite) != null && w.refNo ? {
1109
- label: "Ref no. (Netsuite)",
1110
- values: [(E = n.netSuite) == null ? void 0 : E.refNo]
1111
- } : null
1112
- ].filter((T) => T)
1113
- };
1114
- }
1115
- return C.map((n) => {
1116
- switch (n.type) {
1117
- case "grn":
1118
- return q(n.doc);
1119
- case "fulfillment":
1120
- return p(n.doc);
1121
- }
1122
- });
1123
- }), ee = W(() => {
1124
- var a;
1125
- const t = {
1126
- ...he(0),
1127
- currency: $e()
1128
- };
1129
- return ((a = g.purchaseOrder) == null ? void 0 : a.items.reduce((C, q) => ({
1130
- ...we(C, q.totalCost ?? t),
1131
- currency: $e()
1132
- }), t)) ?? t;
1133
- });
1134
- return (t, a) => {
1135
- var T, j;
1136
- const C = Z("FmButtonGroup"), q = Z("FmChip"), p = Z("FmMenuDivider"), d = Z("FmCard"), N = Z("FmIcon"), n = Z("FmTooltip"), _ = Z("FmSpacer"), w = Z("FmButton"), E = Z("FmSideSheet");
1137
- return b(), Q(E, {
1138
- header: c(l)("inventory.transfer.receiveRequest.details.title") + ((T = t.purchaseOrder) != null && T.seqNumber ? ` #${(j = t.purchaseOrder) == null ? void 0 : j.seqNumber}` : ""),
1139
- modelValue: c(ae),
1140
- "onUpdate:modelValue": a[9] || (a[9] = (K) => Ge(ae) ? ae.value = K : null),
1141
- "dismiss-away": $.value,
1142
- "close-button": "",
1143
- "max-width": 600
1144
- }, {
1145
- default: de(() => {
1146
- var K, J, oe, U, le;
1147
- return [
1148
- e("div", St, [
1149
- L(gt, {
1150
- "po-request": t.poRequest,
1151
- "purchase-order": t.purchaseOrder,
1152
- "is-transfer-between-outlets": o.value
1153
- }, null, 8, ["po-request", "purchase-order", "is-transfer-between-outlets"]),
1154
- e("div", null, [
1155
- L(C, {
1156
- items: r,
1157
- modelValue: u.value,
1158
- "onUpdate:modelValue": a[0] || (a[0] = (A) => u.value = A)
1159
- }, null, 8, ["modelValue"])
1160
- ]),
1161
- u.value.value === "overview" ? (b(), x(re, { key: 0 }, [
1162
- e("div", null, [
1163
- L(d, {
1164
- variant: "outlined",
1165
- class: "flex flex-col gap-8 px-12 py-16"
1166
- }, {
1167
- default: de(() => {
1168
- var A, I, F, te, se, H, De, ke, Ne, Ae, qe, Te;
1169
- return [
1170
- e("div", _t, [
1171
- e("div", wt, S(c(l)("inventory.transfer.receiveRequest.details.requestSummary")), 1),
1172
- e("div", null, [
1173
- L(q, {
1174
- label: c(l)(`inventory.transfer.status.${(A = t.purchaseOrder) == null ? void 0 : A.status}`),
1175
- class: ye(`fm-status-badge fm-status-badge-${(F = (I = t.purchaseOrder) == null ? void 0 : I.status) == null ? void 0 : F.toLocaleLowerCase("en-us")}`),
1176
- compact: ""
1177
- }, null, 8, ["label", "class"])
1178
- ])
1179
- ]),
1180
- L(p),
1181
- e("div", Rt, [
1182
- e("div", Ot, [
1183
- e("div", xt, [
1184
- e("div", Dt, S(c(l)("inventory.transfer.receiveRequest.details.createdAt")), 1)
1185
- ]),
1186
- e("div", kt, S(c(ge)(((te = t.purchaseOrder) == null ? void 0 : te._id) ?? "")), 1)
1187
- ]),
1188
- (se = t.purchaseOrder) != null && se.effectiveAt ? (b(), x("div", Nt, [
1189
- e("div", At, S(c(l)("inventory.transfer.receiveRequest.details.backdatedTo")), 1),
1190
- e("div", qt, S(c(Me)(new Date((H = t.purchaseOrder) == null ? void 0 : H.effectiveAt))), 1)
1191
- ])) : P("", !0),
1192
- e("div", Tt, [
1193
- e("div", Pt, S(c(l)("inventory.transfer.receiveRequest.details.type.title")), 1),
1194
- e("div", Ct, S(c(l)(
1195
- `inventory.transfer.receiveRequest.details.type.${h.value.toLocaleLowerCase("en-US")}`
1196
- )), 1)
1197
- ]),
1198
- (ke = (De = t.purchaseOrder) == null ? void 0 : De.supplier) != null && ke.name ? (b(), x("div", $t, [
1199
- e("div", Et, S(c(l)("inventory.transfer.receiveRequest.details.from")), 1),
1200
- e("div", It, S((Ae = (Ne = t.purchaseOrder) == null ? void 0 : Ne.supplier) == null ? void 0 : Ae.name), 1)
1201
- ])) : P("", !0),
1202
- t.transferTo ? (b(), x("div", Ft, [
1203
- e("div", Mt, S(c(l)("inventory.transfer.receiveRequest.details.to")), 1),
1204
- e("div", Bt, S(t.transferTo), 1)
1205
- ])) : P("", !0),
1206
- L(ht, {
1207
- "po-request": t.poRequest,
1208
- "purchase-order": t.purchaseOrder,
1209
- "transfer-type": h.value,
1210
- "transfer-to-db-name": t.transferToDbName,
1211
- "is-transfer-between-outlets": o.value
1212
- }, null, 8, ["po-request", "purchase-order", "transfer-type", "transfer-to-db-name", "is-transfer-between-outlets"]),
1213
- (qe = t.purchaseOrder) != null && qe.ref ? (b(), x("div", Ut, [
1214
- e("div", Lt, S(c(l)("inventory.transfer.receiveRequest.details.reference")), 1),
1215
- e("div", jt, S(t.purchaseOrder.ref), 1)
1216
- ])) : P("", !0),
1217
- (Te = t.purchaseOrder) != null && Te.remark ? (b(), x("div", Kt, [
1218
- e("div", Vt, S(c(l)("inventory.transfer.receiveRequest.details.remark")), 1),
1219
- e("div", Gt, S(t.purchaseOrder.remark), 1)
1220
- ])) : P("", !0)
1221
- ])
1222
- ];
1223
- }),
1224
- _: 1
1225
- })
1226
- ]),
1227
- e("div", zt, [
1228
- e("div", Ht, [
1229
- e("div", Yt, [
1230
- e("div", Qt, [
1231
- Se(S(ue.value ? c(l)("inventory.transfer.receiveRequest.details.receivedItems") : c(l)("inventory.transfer.receiveRequest.details.requestedItems")) + " ", 1),
1232
- (J = (K = t.purchaseOrder) == null ? void 0 : K.netSuite) != null && J.missingItems && ((U = (oe = t.purchaseOrder) == null ? void 0 : oe.netSuite) == null ? void 0 : U.missingItems.length) > 0 ? (b(), Q(n, {
1233
- key: 0,
1234
- variant: "rich",
1235
- placement: "top",
1236
- "z-index": 51
1237
- }, {
1238
- content: de(() => {
1239
- var A, I;
1240
- return [
1241
- e("div", Wt, [
1242
- (b(!0), x(re, null, pe((I = (A = t.purchaseOrder) == null ? void 0 : A.netSuite) == null ? void 0 : I.missingItems, (F, te) => (b(), x("div", {
1243
- class: "flex justify-center align-middle",
1244
- key: te
1245
- }, [
1246
- L(N, {
1247
- name: "arrow_right",
1248
- size: "sm"
1249
- }),
1250
- Se(" " + S(`(${F.netSuiteId}) ${F.name}: ${F.reason}`), 1)
1251
- ]))), 128))
1252
- ])
1253
- ];
1254
- }),
1255
- default: de(() => [
1256
- L(N, {
1257
- name: "error",
1258
- color: "#ff2c2c",
1259
- size: "sm"
1260
- })
1261
- ]),
1262
- _: 1
1263
- })) : P("", !0)
1264
- ])
1265
- ]),
1266
- (b(!0), x(re, null, pe(((le = t.purchaseOrder) == null ? void 0 : le.items) ?? [], (A) => (b(), x("div", {
1267
- key: A.code,
1268
- class: "flex flex-col"
1269
- }, [
1270
- e("div", Jt, [
1271
- e("div", Zt, S(A.name), 1),
1272
- e("div", Xt, S(c(fe)(X.value[A.sku._id], !1)) + "/" + S(c(Le)(A.quantity, A.sku.unit, A.measurement)), 1)
1273
- ]),
1274
- e("div", es, [
1275
- e("div", ts, S(A.code), 1),
1276
- A.totalCost && c(R).enableTotalCost ? (b(), x("div", ss, " (" + S(c(_e)(A.totalCost)) + ") ", 1)) : P("", !0)
1277
- ])
1278
- ]))), 128)),
1279
- +c(fe)(ee.value) ? (b(), x(re, { key: 0 }, [
1280
- e("div", rs, [
1281
- L(p)
1282
- ]),
1283
- e("div", as, [
1284
- a[10] || (a[10] = e("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, "Total:", -1)),
1285
- e("div", ns, S(c(_e)(ee.value)), 1)
1286
- ])
1287
- ], 64)) : P("", !0)
1288
- ])
1289
- ])
1290
- ], 64)) : P("", !0),
1291
- u.value.value === "deliveryHistory" ? (b(), x("div", os, [
1292
- ne.value.length ? (b(), x("div", ds, [
1293
- (b(!0), x(re, null, pe(ne.value, (A, I) => (b(), x(re, { key: I }, [
1294
- e("div", ms, [
1295
- e("div", fs, [
1296
- e("div", ps, [
1297
- e("div", {
1298
- class: ye([
1299
- {
1300
- "bg-fm-color-primary": I !== 0,
1301
- "bg-white": I === 0
1302
- },
1303
- "w-[2px] h-full"
1304
- ])
1305
- }, null, 2)
1306
- ]),
1307
- a[11] || (a[11] = e("div", { class: "h-24 w-24 bg-fm-color-primary rounded-full" }, null, -1)),
1308
- e("div", vs, [
1309
- e("div", {
1310
- class: ye([
1311
- {
1312
- "bg-fm-color-primary": I < ne.value.length - 1,
1313
- "bg-white": I >= ne.value.length - 1
1314
- },
1315
- "w-[2px] h-full"
1316
- ])
1317
- }, null, 2)
1318
- ])
1319
- ]),
1320
- e("div", ys, [
1321
- e("div", hs, S(A.header), 1),
1322
- e("div", bs, S(A.date), 1)
1323
- ])
1324
- ]),
1325
- e("div", gs, [
1326
- e("div", Ss, [
1327
- e("div", _s, [
1328
- e("div", {
1329
- class: ye([
1330
- {
1331
- "bg-fm-color-primary": I < ne.value.length - 1,
1332
- "bg-white": I >= ne.value.length - 1
1333
- },
1334
- "w-[2px] h-full"
1335
- ])
1336
- }, null, 2)
1337
- ])
1338
- ]),
1339
- e("div", ws, [
1340
- L(d, {
1341
- variant: "outlined",
1342
- class: "py-12 px-16"
1343
- }, {
1344
- default: de(() => [
1345
- e("div", Rs, [
1346
- (b(!0), x(re, null, pe(A.info, (F, te) => (b(), x("div", {
1347
- key: te,
1348
- class: "flex flex-col gap-4"
1349
- }, [
1350
- e("div", Os, S(F == null ? void 0 : F.label), 1),
1351
- e("div", xs, [
1352
- (b(!0), x(re, null, pe(F == null ? void 0 : F.values, (se, H) => (b(), x("div", {
1353
- key: H,
1354
- class: "fm-typo-en-body-lg-600"
1355
- }, [
1356
- typeof se == "string" ? (b(), x(re, { key: 0 }, [
1357
- Se(S(se), 1)
1358
- ], 64)) : (b(), Q(ze(se), { key: 1 }))
1359
- ]))), 128))
1360
- ])
1361
- ]))), 128))
1362
- ])
1363
- ]),
1364
- _: 2
1365
- }, 1024)
1366
- ])
1367
- ])
1368
- ], 64))), 128))
1369
- ])) : (b(), x("div", ls, [
1370
- L(_),
1371
- e("div", null, [
1372
- e("img", {
1373
- src: c(at),
1374
- alt: "List is empty"
1375
- }, null, 8, cs)
1376
- ]),
1377
- e("div", is, S(c(l)("inventory.transfer.receiveRequest.details.noRecordsFound")), 1),
1378
- e("div", us, S(c(l)("inventory.transfer.receiveRequest.details.trackDeliveryMessage")), 1),
1379
- L(_),
1380
- L(_)
1381
- ]))
1382
- ])) : P("", !0)
1383
- ])
1384
- ];
1385
- }),
1386
- "side-sheet-footer": de(() => {
1387
- var K, J, oe, U, le, A, I, F, te, se;
1388
- return [
1389
- e("div", Ds, [
1390
- ((K = t.purchaseOrder) == null ? void 0 : K.status) === c(B).enum.DRAFT && h.value === c(ce).PURCHASE ? (b(), Q(w, {
1391
- key: 0,
1392
- label: c(l)("inventory.transfer.receiveRequest.actions.confirmDraft"),
1393
- onClick: a[1] || (a[1] = (H) => z("confirmDraft")),
1394
- loading: f.value === "confirmDraft",
1395
- disabled: f.value !== "confirmDraft" && m.value
1396
- }, null, 8, ["label", "loading", "disabled"])) : P("", !0),
1397
- ((J = t.purchaseOrder) == null ? void 0 : J.status) === c(B).enum.DRAFT && h.value === c(ce).TRANSFER ? (b(), Q(w, {
1398
- key: 1,
1399
- label: c(l)("inventory.transfer.receiveRequest.actions.submitRequest"),
1400
- onClick: a[2] || (a[2] = (H) => z("submitRequest")),
1401
- loading: f.value === "submitRequest",
1402
- disabled: f.value !== "submitRequest" && m.value
1403
- }, null, 8, ["label", "loading", "disabled"])) : P("", !0),
1404
- ((oe = t.purchaseOrder) == null ? void 0 : oe.status) === c(B).enum.DRAFT ? (b(), Q(w, {
1405
- key: 2,
1406
- label: c(l)("inventory.transfer.receiveRequest.actions.cancelDraft"),
1407
- onClick: a[3] || (a[3] = (H) => z("cancelDraft")),
1408
- loading: f.value === "cancelDraft",
1409
- disabled: f.value !== "cancelDraft" && m.value,
1410
- variant: "destructive"
1411
- }, null, 8, ["label", "loading", "disabled"])) : P("", !0),
1412
- ((U = t.purchaseOrder) == null ? void 0 : U.status) === c(B).enum.RECEIVING ? (b(), Q(w, {
1413
- key: 3,
1414
- label: c(l)("inventory.transfer.receiveRequest.actions.completeReceive"),
1415
- onClick: a[4] || (a[4] = (H) => z("completeReceive")),
1416
- loading: f.value === "completeReceive",
1417
- disabled: f.value !== "completeReceive" && m.value
1418
- }, null, 8, ["label", "loading", "disabled"])) : P("", !0),
1419
- t.canResubmit ? (b(), Q(w, {
1420
- key: 4,
1421
- label: c(l)("inventory.transfer.receiveRequest.actions.resubmitRequest"),
1422
- onClick: a[5] || (a[5] = (H) => z("submitRequest")),
1423
- loading: f.value === "submitRequest",
1424
- disabled: f.value !== "submitRequest" && m.value
1425
- }, null, 8, ["label", "loading", "disabled"])) : P("", !0),
1426
- (((le = t.purchaseOrder) == null ? void 0 : le.status) === c(B).enum.REQUESTING || ((A = t.purchaseOrder) == null ? void 0 : A.status) === c(B).enum.PROCESSING) && t.canApprove ? (b(), Q(w, {
1427
- key: 5,
1428
- label: c(l)("inventory.transfer.approval.actions.approveRequest"),
1429
- onClick: a[6] || (a[6] = (H) => z("approveRequest")),
1430
- loading: f.value === "approveRequest",
1431
- disabled: f.value !== "approveRequest" && m.value
1432
- }, null, 8, ["label", "loading", "disabled"])) : P("", !0),
1433
- ((I = t.purchaseOrder) == null ? void 0 : I.status) === c(B).enum.REQUESTING && t.canApprove ? (b(), Q(w, {
1434
- key: 6,
1435
- label: c(l)("inventory.transfer.approval.actions.rejectRequest"),
1436
- onClick: a[7] || (a[7] = (H) => z("rejectRequest")),
1437
- loading: f.value === "rejectRequest",
1438
- disabled: f.value !== "rejectRequest" && m.value,
1439
- variant: "destructive"
1440
- }, null, 8, ["label", "loading", "disabled"])) : P("", !0),
1441
- ((F = t.purchaseOrder) == null ? void 0 : F.status) !== c(B).enum.COMPLETE && ((te = t.purchaseOrder) == null ? void 0 : te.status) !== c(B).enum.CANCEL && (((se = t.purchaseOrder) == null ? void 0 : se.status) !== c(B).enum.REQUESTING || t.canApprove) ? (b(), Q(w, {
1442
- key: 7,
1443
- label: c(l)("common.close"),
1444
- variant: "tertiary",
1445
- onClick: a[8] || (a[8] = (H) => s("update:show", !1))
1446
- }, null, 8, ["label"])) : P("", !0)
1447
- ])
1448
- ];
1449
- }),
1450
- _: 1
1451
- }, 8, ["header", "modelValue", "dismiss-away"]);
1452
- };
1453
- }
1454
- });
1455
- export {
1456
- Fs as _,
1457
- Es as a,
1458
- Is as b,
1459
- nt as g,
1460
- Ke as u
1461
- };