@feedmepos/mf-inventory-portal 0.0.25-dev.17 → 0.0.25-dev.19

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