@feedmepos/mf-inventory-portal 1.0.13 → 1.0.15-dev.1

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 (58) hide show
  1. package/dist/{App-D3tAuqoa.js → App-DtuHbzaj.js} +3 -3
  2. package/dist/{ApprovalView-CZSEkuxs.js → ApprovalView-C8gHcI4o.js} +2 -2
  3. package/dist/{BindingsDialog-BCw5xmh3.js → BindingsDialog-CLp5DbdF.js} +2 -2
  4. package/dist/{BindingsPicker-B--B9aT5.js → BindingsPicker-ChB_dM_r.js} +1 -1
  5. package/dist/{BindingsTable-z4ohAK-T.js → BindingsTable-usQiwRyf.js} +1 -1
  6. package/dist/{ClosingDraftView-5fVFzVpD.js → ClosingDraftView-C7mlsyK5.js} +20 -20
  7. package/dist/{ClosingTemplateView-BuJtrXgC.js → ClosingTemplateView-C3csSJ5x.js} +10 -10
  8. package/dist/{DeliveryOrderPrintPreview-DPlR2qhc.js → DeliveryOrderPrintPreview-DGI0Mk4p.js} +1 -1
  9. package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-P1dvKMS3.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-D8iQyzaJ.js} +3 -3
  10. package/dist/{FmMultiselectDialog-CVNqlp0n.js → FmMultiselectDialog-B3MYE2b7.js} +1 -1
  11. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-ublLlB16.js → FmUnitInput.vue_vue_type_script_setup_true_lang-DFidOxdU.js} +12 -12
  12. package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-MSbWAo1i.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-CIKQ6nC1.js} +1 -1
  13. package/dist/{IngredientGroupView-CgNdkuae.js → IngredientGroupView-91WE1P4g.js} +2 -2
  14. package/dist/{IngredientsView-Bg9XhCNT.js → IngredientsView-CLZX2W7Y.js} +4 -4
  15. package/dist/{IntegrationView-DKzLjZig.js → IntegrationView-D8VbNV6H.js} +1009 -1000
  16. package/dist/{InventoryBindingForm-CZl0uidf.js → InventoryBindingForm-rGVDi4T8.js} +1 -1
  17. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-BhxHbT2g.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-Dx4rHyb5.js} +24 -24
  18. package/dist/{InventoryBindingSummary-BTO2qsNW.js → InventoryBindingSummary-BGLbSQRD.js} +1 -1
  19. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-B4GyfLV-.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-CJ5FPRac.js} +26 -20
  20. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-Cfup6M3u.js → PremiumBadge.vue_vue_type_script_setup_true_lang-qUWKfasI.js} +1 -1
  21. package/dist/{PublishView-CjmtkaiI.js → PublishView-ClqhWcBu.js} +8 -8
  22. package/dist/{PurchaseOrderPrintPreview-KG9VkV-7.js → PurchaseOrderPrintPreview-s2TN-ZJL.js} +1 -1
  23. package/dist/{ReceiveRequestView-Og_mkJHQ.js → ReceiveRequestView-0r85gHww.js} +63 -63
  24. package/dist/{RecipeView-SvMt9zdS.js → RecipeView-FRHv7v2K.js} +4 -4
  25. package/dist/{StockView-DjO6wmxl.js → StockView-DeE60k1a.js} +7 -7
  26. package/dist/{SupplierView-CMatOKL0.js → SupplierView-DQSYItBZ.js} +37 -37
  27. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-Bm9lLcf5.js +2020 -0
  28. package/dist/{TransferTemplateView-CNZtqhhI.js → TransferTemplateView-rPjPeB7z.js} +88 -88
  29. package/dist/UnitView-BLfRD-MZ.js +667 -0
  30. package/dist/{WarehouseView-C9Yi9nQV.js → WarehouseView-DmzmdKUj.js} +12 -12
  31. package/dist/api/netsuite.d.ts +3 -0
  32. package/dist/api/purchase-order.d.ts +1 -1
  33. package/dist/{app-9KyslrXV.js → app-BmrQUin8.js} +4445 -4396
  34. package/dist/app.d.ts +1 -0
  35. package/dist/app.js +1 -1
  36. package/dist/{decimal-CX0eUEB3.js → decimal-Ba0cFNkn.js} +1 -1
  37. package/dist/{feature-CmWqoog1.js → feature-CAfGclDp.js} +1856 -965
  38. package/dist/{format-unit-display-UiaVS36D.js → format-unit-display-6JZPqi0z.js} +29 -29
  39. package/dist/{index-CKAZMrqi.js → index-0LAqB9Nf.js} +2 -2
  40. package/dist/{index-BRtGevm6.js → index-Df8rBaGT.js} +4070 -4049
  41. package/dist/{stock-CT3LESH2.js → stock-Ca2xlSi5.js} +1 -1
  42. package/dist/{supplier-BrQo7L81.js → supplier-BFRlDSmN.js} +2 -2
  43. package/dist/tsconfig.app.tsbuildinfo +1 -1
  44. package/dist/{use-ingredient-select-dialog-BLcnX7uY.js → use-ingredient-select-dialog-BleZLcKu.js} +1 -1
  45. package/dist/{use-inventory-binding-dialog-CegZeDD6.js → use-inventory-binding-dialog-C8-NZufG.js} +1 -1
  46. package/dist/views/receive-request/components/netsuite/NetSuiteLog.vue.d.ts +17 -0
  47. package/dist/views/receive-request/components/netsuite/NetSuitePanel.vue.d.ts +21 -0
  48. package/dist/views/receive-request/components/transfer-details/usePurchaseOrderFn.d.ts +1 -0
  49. package/dist/views/receive-request/components/transfer-form/TransferForm.vue.d.ts +4 -4
  50. package/dist/views/receive-request/composables/use-process-purchase-order.d.ts +6 -2
  51. package/dist/views/receive-request/composables/use-receive-request-form.d.ts +6 -6
  52. package/dist/views/receive-request/composables/use-receive-request-table.d.ts +6 -6
  53. package/dist/views/receive-request/constants/po-action-to-ui-style.d.ts +1 -0
  54. package/dist/views/unit/components/unit-form/UnitFormProps.d.ts +1 -1
  55. package/dist/{vue-i18n-C2C5um-s.js → vue-i18n-CLUATIwy.js} +222 -222
  56. package/package.json +3 -3
  57. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-BDbUensL.js +0 -1898
  58. package/dist/UnitView-D75e_8B3.js +0 -648
@@ -1,1898 +0,0 @@
1
- import { X as it, u as me, aH as O, b as Be, a2 as ut, a4 as dt, a5 as mt, aI as ft, d as Ye, e as tt, T as rt, aJ as pt, Z as Fe, J as ke, i as le, aK as st, a9 as De, f as We, h as z, D as Z, aq as se, a3 as yt, ao as Je, a1 as xe, aL as vt, ae as Te, ar as ht } from "./app-9KyslrXV.js";
2
- import { ref as j, computed as G, h as N, defineComponent as qe, onMounted as at, unref as y, openBlock as _, createElementBlock as q, createElementVNode as r, toDisplayString as x, createCommentVNode as V, resolveComponent as Q, createVNode as B, reactive as bt, createBlock as ue, withCtx as de, watch as gt, isRef as _t, Fragment as re, normalizeClass as Oe, createTextVNode as $e, renderList as ye, resolveDynamicComponent as wt } from "vue";
3
- import { F as St } from "./decimal-CX0eUEB3.js";
4
- import { b as Rt, u as xt, f as nt, P as he } from "./format-unit-display-UiaVS36D.js";
5
- import { useCoreStore as Ue, useI18n as ot } from "@feedmepos/mf-common";
6
- import { E as Ot } from "./empty-placeholder-wf6-BWE8.js";
7
- import { useDialog as Le, useSnackbar as Ve, components as Xe, FmButtonVariant as ee, useProxiedModel as kt } from "@feedmepos/ui-library";
8
- import { u as Me, F as Ce } from "./feature-CmWqoog1.js";
9
- import { u as Dt } from "./index-CKAZMrqi.js";
10
- import { _ as qt, F as Nt, a as At } from "./FmUnitInput.vue_vue_type_script_setup_true_lang-ublLlB16.js";
11
- import { u as Pt, R as Ze } from "./usePromise-CbVUCxhj.js";
12
- const Ne = it((n, l) => {
13
- const o = me(), b = Ue();
14
- return {
15
- async readRequests(d, s, m) {
16
- const u = d ?? o.currentLocationDBName, a = `${n.inventoryBackendUrl}/${u}/purchase-request`;
17
- return s && m ? await l.get(`${a}?startDate=${s}&endDate=${m}`) : await l.get(a);
18
- },
19
- async readRequestById(d, s) {
20
- const m = s ?? o.currentLocationDBName, u = `${n.inventoryBackendUrl}/${m}/purchase-request/${d}`;
21
- return await l.get(u);
22
- },
23
- async readRequestByIds(d, s) {
24
- const m = s ?? o.currentLocationDBName, u = `${n.inventoryBackendUrl}/${m}/purchase-request/find`;
25
- return await l.post(u, { requestIds: d });
26
- },
27
- async getPurchaseOrders({
28
- start: d,
29
- end: s
30
- }) {
31
- const m = o.currentLocationDBName, u = `${n.inventoryBackendUrl}/${m}/purchase-order`;
32
- return await l.get(`${u}?start=${d}&end=${s}`);
33
- },
34
- async getLatestPurchaseOrderRequest(d) {
35
- const s = o.currentLocationDBName, m = `${n.inventoryBackendUrl}/${s}/purchase-request/find-by-purchase-order-id`;
36
- return await l.get(`${m}/${d}`);
37
- },
38
- async getPurchaseOrderById(d) {
39
- const s = o.currentLocationDBName, m = `${n.inventoryBackendUrl}/${s}/purchase-order`;
40
- return await l.get(`${m}/${d}`);
41
- },
42
- /**
43
- * @deprecated Use `processPurchaseOrderV2` instead.
44
- */
45
- async processPurchaseOrder(d, s) {
46
- const m = o.currentLocationDBName, u = s || m, a = `${n.inventoryBackendUrl}/${u}/purchase-order/run-operation`;
47
- return await l.put(a, d);
48
- },
49
- async createPurchaseOrder(d) {
50
- const s = o.currentLocationDBName, m = `${n.inventoryBackendUrl}/${s}/purchase-order`;
51
- return await l.post(m, d);
52
- },
53
- async updatePurchaseOrder(d) {
54
- const s = o.currentLocationDBName, m = `${n.inventoryBackendUrl}/${s}/purchase-order`;
55
- return await l.put(m, d);
56
- },
57
- async importFromXilnex(d) {
58
- const s = o.currentLocationDBName, m = `${n.inventoryBackendUrl}/${s}/purchase-order/import-from-xilnex`;
59
- return await l.post(m, d);
60
- },
61
- async processPurchaseOrderV2(d, s) {
62
- const m = o.currentLocationDBName, u = s || m, a = `${n.inventoryBackendUrl}/${u}/v2/purchase-order/run-operation`;
63
- return await l.put(a, d);
64
- },
65
- async getWorkflowConfig() {
66
- var u;
67
- const s = `business_${(u = b.currentBusiness.value) == null ? void 0 : u._id}`, m = `${n.inventoryBackendUrl}/${s}/v2/purchase-order/workflow-config`;
68
- return await l.get(m);
69
- }
70
- };
71
- }), ct = {
72
- [O.enum.confirmDraft]: {
73
- primaryActions: {
74
- text: "Confirm draft",
75
- close: !0
76
- },
77
- title: "Confirm draft?",
78
- message: "Purchase order cannot be changed after confirm draft.",
79
- successMessage: "Purchase order draft has been confirmed"
80
- },
81
- [O.enum.cancelDraft]: {
82
- primaryActions: {
83
- text: "Cancel draft",
84
- close: !0,
85
- variant: "destructive"
86
- },
87
- title: "Cancel draft?",
88
- message: "Purchase order cannot be changed after cancelled draft.",
89
- successMessage: "Purchase order draft has been cancelled"
90
- },
91
- [O.enum.submitRequest]: {
92
- primaryActions: {
93
- text: "Submit request",
94
- close: !0
95
- },
96
- title: "Confirm draft?",
97
- message: "Purchase order cannot be changed after confirm draft.",
98
- successMessage: "Purchase order draft has been submitted"
99
- },
100
- [O.enum.completeReceive]: {
101
- primaryActions: {
102
- text: "Mark received",
103
- close: !0
104
- },
105
- title: "Mark as received",
106
- message: "Purchase order cannot be changed after it has complete receiving.",
107
- successMessage: "Purchase order has been marked as received"
108
- },
109
- [O.enum.approveRequest]: {
110
- primaryActions: {
111
- text: "Accept request",
112
- close: !0
113
- },
114
- title: "Accept request?",
115
- message: "Transfer out request will be accepted.",
116
- successMessage: "Transfer out request has been approved"
117
- },
118
- [O.enum.rejectRequest]: {
119
- primaryActions: {
120
- text: "Reject request",
121
- close: !0,
122
- variant: "destructive"
123
- },
124
- title: "Reject request?",
125
- message: "Purchase order will be rejected.",
126
- successMessage: "Purchase order has been rejected"
127
- }
128
- };
129
- function lt() {
130
- const n = me(), l = Ne(), o = Me();
131
- async function b(s, m) {
132
- const u = n.currentLocationDBName;
133
- return s.doc.supplier.internal && s.operation === O.enum.confirmDraft && (s.operation = O.enum.submitRequest), await l.processPurchaseOrder(s, m || u);
134
- }
135
- async function d(s, m) {
136
- const u = n.currentLocationDBName;
137
- return await l.processPurchaseOrderV2(s, m || u);
138
- }
139
- return (s) => o.useOperatePurchaseOrderV2 ? d(s.operateV2, s.transferTo) : b(s.operate, s.transferTo);
140
- }
141
- var Ee = /* @__PURE__ */ ((n) => (n.RECEIVE_REQUEST = "receive/request", n.APPROVAL = "approval", n))(Ee || {});
142
- const Se = j(), Ie = j();
143
- function Os(n, l) {
144
- const o = Le(), b = me(), d = Me();
145
- Be();
146
- const s = Rt(), m = xt(), u = j(!1), a = Ve(), h = Ne(), i = j(new Array()), p = j(
147
- l != null && l.startDate && (l != null && l.endDate) ? l : ut()
148
- ), t = G(() => {
149
- const k = new Date(p.value.startDate), R = new Date(p.value.endDate);
150
- return {
151
- start: dt(k).toISOString(),
152
- end: mt(R).toISOString()
153
- };
154
- }), v = j(new Array()), D = ft(), w = j(null);
155
- async function A(k) {
156
- function R(e) {
157
- const c = {
158
- mode: Ye.CREATE,
159
- modelValue: k || void 0,
160
- show: !0,
161
- "onUpdate:show"(g) {
162
- Se.value.show = g;
163
- },
164
- templateId: e,
165
- lastClosingDate: w.value
166
- };
167
- Se.value = c;
168
- }
169
- let U;
170
- d.mustUsePoTemplate && !(k != null && k.template) ? o.open({
171
- title: "Create transfer",
172
- message: "",
173
- primaryActions: {
174
- text: "Select a template",
175
- close: !0
176
- },
177
- secondaryActions: {
178
- text: "Outlet to Outlet",
179
- variant: "secondary",
180
- close: !0
181
- }
182
- }).onPrimary(async () => {
183
- U = await s.getTemplateId(), U && R(U);
184
- }).onSecondary(() => {
185
- R(void 0);
186
- }) : R(U);
187
- }
188
- function F(k) {
189
- const R = {
190
- mode: Ye.UPDATE,
191
- modelValue: tt(k),
192
- show: !0,
193
- "onUpdate:show"(U) {
194
- Se.value.show = U;
195
- },
196
- lastClosingDate: w.value
197
- };
198
- Se.value = R;
199
- }
200
- async function W() {
201
- i.value = [], u.value = !0;
202
- try {
203
- i.value = await h.getPurchaseOrders(t.value).then((e) => e.sort((c, g) => g._id.localeCompare(c._id)));
204
- const k = await D.readCurrentLocationLastClosing(!0), R = k == null ? void 0 : k._id;
205
- R && (w.value = pt(R)), await d.awaitFeatureLoaded(() => d.mustUsePoTemplate) && await m.fetchTemplates();
206
- const U = i.value.map((e) => {
207
- var c;
208
- return ((c = e.request) == null ? void 0 : c.id) ?? "";
209
- }).filter((e) => e);
210
- v.value = await h.readRequestByIds(U);
211
- } catch {
212
- a.open({
213
- title: "Something went wrong",
214
- message: "Error at fetching purchase orders",
215
- type: "error"
216
- });
217
- } finally {
218
- u.value = !1;
219
- }
220
- }
221
- async function J() {
222
- v.value = [], u.value = !0;
223
- try {
224
- v.value = await h.readRequests(
225
- void 0,
226
- t.value.start,
227
- t.value.end
228
- ).then((k) => k.reverse());
229
- } catch {
230
- a.open({
231
- title: "Something went wrong",
232
- message: "Error at fetching purchase requests",
233
- type: "error"
234
- });
235
- } finally {
236
- u.value = !1;
237
- }
238
- }
239
- function ae() {
240
- switch (n) {
241
- case "receive/request":
242
- return W();
243
- case "approval":
244
- return J();
245
- }
246
- }
247
- function ne(k, R) {
248
- p.value = {
249
- startDate: k,
250
- endDate: R
251
- }, ae();
252
- }
253
- b.watchLocation(async (k) => {
254
- if (!k) {
255
- i.value = [];
256
- return;
257
- }
258
- await ae();
259
- });
260
- const te = j(), oe = j(Math.random().toString());
261
- async function ie(k, R) {
262
- const U = Math.random().toString();
263
- oe.value = U, R ?? (R = v.value.computeFirst(
264
- (g) => g.purchaseOrderId === k._id ? g : null
265
- ) ?? void 0);
266
- const e = n === "receive/request" ? b.currentLocation : R == null ? void 0 : R.to, c = {
267
- poRequest: R,
268
- purchaseOrder: k,
269
- transferTo: e == null ? void 0 : e.name,
270
- transferToDbName: e == null ? void 0 : e.dbName,
271
- show: !0,
272
- canResubmit: !1,
273
- canApprove: n === "approval",
274
- "onUpdate:show"(g) {
275
- te.value.show = g;
276
- },
277
- scope: n
278
- };
279
- te.value = c;
280
- }
281
- async function Ae(k, R, U, e) {
282
- const c = lt();
283
- u.value = !0;
284
- try {
285
- await c({
286
- operate: {
287
- operation: R,
288
- doc: k,
289
- options: (
290
- // auto receive for supplier to warehouse
291
- (R === O.enum.confirmDraft || // auto receive for warehouse to warehouse
292
- R === O.enum.completeReceive) && d.autoReceiveWarehouse ? {
293
- autoReceive: !0
294
- } : void 0
295
- )
296
- },
297
- operateV2: {
298
- _id: k._id,
299
- _rev: k._rev ?? "",
300
- action: R
301
- },
302
- transferTo: e
303
- }), await new Promise((C) => setTimeout(C, 1e3));
304
- const S = me().currentLocationDBName.startsWith("restaurant_");
305
- R === O.enum.confirmDraft && k.effectiveAt && S ? a.open({
306
- title: "Success",
307
- message: `${U}. The backdate will be reflected once your POS has received this change.`,
308
- type: "success"
309
- }) : a.open({
310
- title: "Success",
311
- message: U,
312
- type: "success"
313
- });
314
- } catch (g) {
315
- a.open({
316
- title: "Something went wrong",
317
- message: "Please try again.",
318
- type: "error"
319
- }), console.error("Error when submitting PO operation", R, k, g);
320
- } finally {
321
- u.value = !1, ae();
322
- }
323
- }
324
- async function be(k, R, U) {
325
- const e = ct[R];
326
- if (!e) {
327
- a.open({
328
- title: "Something went wrong",
329
- message: `Cannot process order: ${rt(R)}`,
330
- type: "error"
331
- });
332
- return;
333
- }
334
- const { successMessage: c, ...g } = e;
335
- o.open({
336
- title: g.title,
337
- message: g.message,
338
- primaryActions: g.primaryActions
339
- }).onPrimary(() => {
340
- Ae(k, R, c, U);
341
- });
342
- }
343
- async function Pe() {
344
- o.open({
345
- title: "Upload Transfer",
346
- primaryActions: {
347
- text: "Xilnex transfer note",
348
- close: !0
349
- },
350
- secondaryActions: {
351
- text: "Cancel",
352
- close: !0
353
- }
354
- }).onPrimary(() => {
355
- const k = {
356
- show: !0,
357
- "onUpdate:show"(R) {
358
- Ie.value.show = R;
359
- }
360
- };
361
- Ie.value = k;
362
- });
363
- }
364
- return {
365
- purchaseOrders: i,
366
- purchaseRequests: v,
367
- updateDateRange: ne,
368
- fetchData: ae,
369
- loading: u,
370
- transferDialogProps: Se,
371
- promptCreateTransferDialog: A,
372
- promptUpdateTransferDialog: F,
373
- transferDetailsProps: te,
374
- promptShowTransferDetails: ie,
375
- submitAction: be,
376
- xilnexImportDialogProps: Ie,
377
- promptUploadTransferDialog: Pe
378
- };
379
- }
380
- function Tt(n, l) {
381
- return l.reduce(
382
- (b, d) => {
383
- const s = d.received.find((m) => m.sku._id === n._id);
384
- return s && (b = Fe(b, s.amount)), b;
385
- },
386
- St.toPrecision(ke(0), n.unit.precision)
387
- );
388
- }
389
- function $t(n, l, o, b) {
390
- const { name: d, address: s, regNo: m } = l.doc.profile, u = {
391
- name: d,
392
- registrationNumber: m,
393
- line1: s == null ? void 0 : s.line1,
394
- line2: s == null ? void 0 : s.line2,
395
- postcode: s == null ? void 0 : s.postcode,
396
- city: s == null ? void 0 : s.city,
397
- state: s == null ? void 0 : s.state,
398
- country: s == null ? void 0 : s.country
399
- }, a = {
400
- name: n.supplier.name,
401
- phoneNumber: n.supplier.phoneNumber,
402
- registrationNumber: n.supplier.registrationNumber,
403
- line1: n.supplier.address.line1,
404
- line2: n.supplier.address.line2,
405
- postcode: n.supplier.address.postcode,
406
- city: n.supplier.address.city,
407
- state: n.supplier.address.state,
408
- country: n.supplier.address.country
409
- }, h = n.items.map((D) => {
410
- const { sku: w, measurement: A } = D, F = le(
411
- Tt(D.sku, n.deliveryOrder || []),
412
- !1
413
- );
414
- return {
415
- code: w.code,
416
- description: w.name,
417
- quantity: nt(D.quantity, w.unit, D.measurement),
418
- unit: (A == null ? void 0 : A.abbrev) || w.unit.abbrev,
419
- received: F
420
- };
421
- }), i = n.deliveryOrder.map((D) => ({
422
- createdAt: st(new Date(D.createdAt)),
423
- ref: D.deliveryOrderNumber,
424
- remark: D.remark || "",
425
- items: D.received.map((w) => {
426
- var A;
427
- return {
428
- code: w.sku.code,
429
- description: w.sku.name,
430
- quantity: le(w.amount),
431
- unit: ((A = w.measurement) == null ? void 0 : A.abbrev) || w.sku.unit.abbrev
432
- };
433
- })
434
- })), p = {
435
- businessName: o == null ? void 0 : o.name,
436
- logo: o == null ? void 0 : o.thumbnail,
437
- orderNumber: n.seqNumber.toString(),
438
- createdAt: De(n._id),
439
- ref: n.ref || "",
440
- remark: n.remark || "",
441
- buyer: u,
442
- supplier: a,
443
- items: h,
444
- status: n.status,
445
- deliveryOrders: i
446
- }, t = new URL(window.location.href), v = b && (n.deliveryFullfillment || []).length > 0 ? "receive-request/delivery-print-preview" : "receive-request/print-preview";
447
- t.pathname = t.hostname.includes("portal.feedme") ? `/inventory/${v}` : `/${v}`, t.searchParams.append("data", JSON.stringify(p)), window.open(t.href, "_blank", "noreferrer");
448
- }
449
- const ve = {
450
- submitRequest: {
451
- translationKey: "inventory.transfer.receiveRequest.actions.submitRequest",
452
- color: "text-fm-color-typo-primary",
453
- value: O.enum.submitRequest
454
- },
455
- confirmDraft: {
456
- translationKey: "inventory.transfer.receiveRequest.actions.confirmDraft",
457
- color: "text-fm-color-typo-primary",
458
- value: O.enum.confirmDraft
459
- },
460
- cancelDraft: {
461
- translationKey: "inventory.transfer.receiveRequest.actions.cancelDraft",
462
- color: "text-fm-color-typo-error",
463
- value: O.enum.cancelDraft
464
- },
465
- approveRequest: {
466
- translationKey: "inventory.transfer.receiveRequest.actions.approveRequest",
467
- color: "text-fm-color-typo-primary",
468
- value: O.enum.approveRequest
469
- },
470
- rejectRequest: {
471
- translationKey: "inventory.transfer.receiveRequest.actions.rejectRequest",
472
- color: "text-fm-color-typo-error",
473
- value: O.enum.rejectRequest
474
- },
475
- processRequest: {
476
- translationKey: "inventory.transfer.receiveRequest.actions.processRequest",
477
- color: "text-fm-color-typo-primary",
478
- value: O.enum.processRequest
479
- },
480
- receiveStock: {
481
- translationKey: "inventory.transfer.receiveRequest.actions.receiveStock",
482
- color: "text-fm-color-typo-primary",
483
- value: O.enum.receiveStock
484
- },
485
- completeReceive: {
486
- translationKey: "inventory.transfer.receiveRequest.actions.completeReceive",
487
- color: "text-fm-color-typo-primary",
488
- value: O.enum.completeReceive
489
- },
490
- closeRequest: {
491
- translationKey: "inventory.transfer.receiveRequest.actions.closeRequest",
492
- color: "system-error-300",
493
- value: O.enum.closeRequest
494
- },
495
- approveDraft: {
496
- label: void 0,
497
- translationKey: "",
498
- color: "",
499
- value: void 0
500
- },
501
- rejectDraft: {
502
- label: void 0,
503
- translationKey: "",
504
- color: "",
505
- value: void 0
506
- }
507
- };
508
- function ks(n, l) {
509
- me();
510
- const o = Ue(), { t: b } = ot();
511
- function d(i) {
512
- switch (i.status) {
513
- case "DRAFT":
514
- return [
515
- Z[z.Update],
516
- Z[z.Details],
517
- i.supplier.internal === "restaurant" || i.supplier.internal === "warehouse" ? ve[O.enum.submitRequest] : ve[O.enum.confirmDraft],
518
- ve[O.enum.cancelDraft]
519
- ];
520
- case "RECEIVING":
521
- return [
522
- ve[O.enum.completeReceive],
523
- Z[z.Details],
524
- Z[z.Print]
525
- ];
526
- case "REQUESTING":
527
- return n === "receive/request" ? [Z[z.Details], Z[z.Print]] : [
528
- ve[O.enum.approveRequest],
529
- ve[O.enum.rejectRequest],
530
- Z[z.Details]
531
- // DefaultRowActions[RowActionEnum.Print]
532
- ];
533
- case "PROCESSING":
534
- return [Z[z.Details], Z[z.Print]];
535
- case "COMPLETE":
536
- case "CANCEL":
537
- default:
538
- return [Z[z.Details], Z[z.Print]];
539
- }
540
- }
541
- function s(i) {
542
- return Object.values(O.enum).includes(i);
543
- }
544
- async function m(i, p, t) {
545
- var D, w, A, F;
546
- const v = tt(p);
547
- if (i === z.Print) {
548
- const W = (t == null ? void 0 : t.toInventoryLocation) ?? {
549
- name: "",
550
- type: "restaurant",
551
- acceptRequest: !0,
552
- dbName: "",
553
- doc: {
554
- _id: "",
555
- businessId: "",
556
- profile: {}
557
- }
558
- };
559
- v.ref = [((D = t == null ? void 0 : t.netSuite) == null ? void 0 : D.refNo) || ((w = v.netSuite) == null ? void 0 : w.refNo)].filter((J) => J).join(" "), $t(v, W, o.currentBusiness.value, n === "approval");
560
- return;
561
- }
562
- if (i === z.Details) {
563
- l.promptShowTransferDetails(v, t);
564
- return;
565
- }
566
- if (i === z.Update) {
567
- (A = l.promptUpdateTransferDialog) == null || A.call(l, v);
568
- return;
569
- }
570
- if (s(i)) {
571
- l.submitAction(p, i, (F = t == null ? void 0 : t.to) == null ? void 0 : F.dbName);
572
- return;
573
- }
574
- }
575
- function u() {
576
- return [
577
- {
578
- accessorKey: "seqNumber",
579
- header: () => b("inventory.transfer.table.seqNo"),
580
- enableSorting: !0,
581
- size: 80,
582
- sortUndefined: "last"
583
- },
584
- {
585
- accessorKey: "_id",
586
- header: () => b("inventory.transfer.table.createdAt"),
587
- cell(i) {
588
- return De(`${i.getValue()}`);
589
- },
590
- enableSorting: !0
591
- },
592
- {
593
- accessorKey: "supplier.name",
594
- header: () => b("inventory.transfer.table.transferFrom"),
595
- enableSorting: !0,
596
- size: 200
597
- },
598
- {
599
- accessorKey: "items.length",
600
- header: () => b("inventory.transfer.table.noOfItems"),
601
- enableSorting: !1,
602
- meta: {
603
- width: "10rem"
604
- }
605
- },
606
- {
607
- accessorKey: "ref",
608
- header: () => b("inventory.transfer.table.reference"),
609
- enableSorting: !1,
610
- size: "auto"
611
- },
612
- {
613
- accessorKey: "status",
614
- header: () => b("inventory.transfer.table.status"),
615
- cell(i) {
616
- const p = b(`inventory.transfer.status.${i.getValue() ?? ""}`), t = `${i.getValue() ?? ""}`.toLocaleLowerCase("en-us");
617
- return N(
618
- "div",
619
- {
620
- class: "flex"
621
- },
622
- N(
623
- "div",
624
- {
625
- class: `fm-status-badge fm-status-badge-${t}`
626
- },
627
- p
628
- )
629
- );
630
- },
631
- enableSorting: !0,
632
- size: 200
633
- },
634
- {
635
- id: "action",
636
- cell(i) {
637
- const p = i.row.original, t = d(p);
638
- return We(t, (v) => m(v, p));
639
- },
640
- enableSorting: !1,
641
- size: 40,
642
- meta: {
643
- cellClass: "",
644
- headerClass: ""
645
- }
646
- }
647
- ];
648
- }
649
- function a() {
650
- return [
651
- {
652
- accessorKey: "purchaseOrder.seqNumber",
653
- header: () => b("inventory.transfer.table.seqNo"),
654
- enableSorting: !0,
655
- size: 80,
656
- sortUndefined: "last"
657
- },
658
- {
659
- accessorKey: "purchaseOrder._id",
660
- header: () => b("inventory.transfer.table.createdAt"),
661
- cell(i) {
662
- return De(`${i.getValue()}`);
663
- },
664
- enableSorting: !0
665
- },
666
- {
667
- accessorKey: "to.name",
668
- header: () => b("inventory.transfer.table.transferTo"),
669
- enableSorting: !1,
670
- size: 200
671
- },
672
- {
673
- accessorKey: "purchaseOrder.items.length",
674
- header: () => b("inventory.transfer.table.noOfItems"),
675
- enableSorting: !1
676
- },
677
- {
678
- accessorKey: "purchaseOrder.ref",
679
- header: () => b("inventory.transfer.table.reference"),
680
- enableSorting: !1,
681
- size: "auto"
682
- },
683
- {
684
- accessorKey: "purchaseOrder.status",
685
- header: () => b("inventory.transfer.table.status"),
686
- cell(i) {
687
- const p = b(`inventory.transfer.status.${i.getValue() ?? ""}`), t = `${i.getValue() ?? ""}`.toLocaleLowerCase("en-us");
688
- return N(
689
- "div",
690
- {
691
- class: "flex"
692
- },
693
- N(
694
- "div",
695
- {
696
- class: `fm-status-badge fm-status-badge-${t}`
697
- },
698
- p
699
- )
700
- );
701
- },
702
- enableSorting: !0
703
- },
704
- {
705
- id: "action",
706
- cell(i) {
707
- const p = i.row.original, v = (p.purchaseOrder ? d(p.purchaseOrder) : []).map((D) => D.value === z.Print ? {
708
- ...D,
709
- translationKey: "inventory.transfer.receiveRequest.details.printDeliveryOrder"
710
- } : D);
711
- return We(
712
- v,
713
- (D) => p.purchaseOrder ? m(D, p.purchaseOrder, p) : void 0
714
- );
715
- },
716
- enableSorting: !1,
717
- size: 40,
718
- meta: {
719
- cellClass: "",
720
- headerClass: ""
721
- }
722
- }
723
- ];
724
- }
725
- const h = G(() => n === "receive/request" ? u() : a());
726
- return {
727
- get columnDefs() {
728
- return h.value;
729
- }
730
- };
731
- }
732
- const Ct = {
733
- key: 0,
734
- class: "flex flex-col gap-8"
735
- }, It = { class: "flex flex-col gap-4" }, Ft = { class: "fm-typo-en-body-lg-600" }, Et = {
736
- key: 0,
737
- class: "flex flex-col gap-4"
738
- }, Bt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ut = { class: "fm-typo-en-body-lg-600" }, Lt = { key: 0 }, Vt = { key: 1 }, Mt = {
739
- key: 1,
740
- class: "flex flex-col gap-4"
741
- }, Kt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, jt = { class: "fm-typo-en-body-lg-600" }, zt = { key: 0 }, Gt = { key: 1 }, Ht = {
742
- key: 2,
743
- class: "flex flex-col gap-4"
744
- }, Qt = { class: "fm-typo-en-body-lg-600" }, Yt = {
745
- key: 3,
746
- class: "flex flex-col gap-4"
747
- }, Wt = { class: "fm-typo-en-body-lg-600" }, Jt = /* @__PURE__ */ qe({
748
- __name: "NetSuiteInfo",
749
- props: {
750
- transferType: {},
751
- transferToDbName: {},
752
- poRequest: {},
753
- purchaseOrder: {},
754
- isTransferBetweenOutlets: { type: Boolean },
755
- scope: {}
756
- },
757
- setup(n) {
758
- const l = n, o = Be(), b = Ne(), d = j(l.poRequest);
759
- at(async () => {
760
- var a;
761
- if (!l.poRequest && ((a = l.purchaseOrder) != null && a._id)) {
762
- const h = await b.getLatestPurchaseOrderRequest(l.purchaseOrder._id);
763
- d.value = h;
764
- }
765
- });
766
- const s = G(
767
- () => {
768
- var a, h, i, p, t, v;
769
- return o.getSubsidiaryFullName(
770
- ((i = (h = (a = l.purchaseOrder) == null ? void 0 : a.netSuite) == null ? void 0 : h.subsidiary) == null ? void 0 : i.id) || ((v = (t = (p = l.poRequest) == null ? void 0 : p.netSuite) == null ? void 0 : t.subsidiary) == null ? void 0 : v.id)
771
- ).fullName;
772
- }
773
- ), m = G(() => {
774
- var a, h, i, p, t, v, D, w, A, F, W, J;
775
- return (i = (h = (a = l.purchaseOrder) == null ? void 0 : a.netSuite) == null ? void 0 : h.additionalInfo) != null && i.transactionnumber ? (v = (t = (p = l.purchaseOrder) == null ? void 0 : p.netSuite) == null ? void 0 : t.additionalInfo) == null ? void 0 : v.transactionnumber : (A = (w = (D = d.value) == null ? void 0 : D.netSuite) == null ? void 0 : w.additionalInfo) != null && A.transactionnumber ? (J = (W = (F = d.value) == null ? void 0 : F.netSuite) == null ? void 0 : W.additionalInfo) == null ? void 0 : J.transactionnumber : null;
776
- }), u = G(() => {
777
- var a, h, i, p, t, v;
778
- return (h = (a = l.purchaseOrder) == null ? void 0 : a.deliveryFullfillment) != null && h.length && ((p = (i = l.purchaseOrder) == null ? void 0 : i.deliveryFullfillment) == null ? void 0 : p.length) > 0 ? (v = (t = l.purchaseOrder) == null ? void 0 : t.deliveryFullfillment) == null ? void 0 : v.map((D) => {
779
- var w;
780
- return (w = D.netSuite) == null ? void 0 : w.refNo;
781
- }).join(", ") : "N/A";
782
- });
783
- return (a, h) => {
784
- var i, p, t, v, D, w, A, F, W, J, ae, ne, te, oe;
785
- return y(o).isEnabled ? (_(), q("div", Ct, [
786
- r("div", It, [
787
- h[0] || (h[0] = r("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, "NetSuite subsidiary", -1)),
788
- r("div", Ft, x(s.value || "N/A"), 1)
789
- ]),
790
- !a.isTransferBetweenOutlets && ((i = a.purchaseOrder) == null ? void 0 : i.status) !== y(se).Enum.REQUESTING && a.scope === y(Ee).RECEIVE_REQUEST ? (_(), q("div", Et, [
791
- r("div", Bt, " NetSuite " + x(a.transferType === y(he).PURCHASE ? "Purchase Order" : "Transfer Order") + " (ID) ", 1),
792
- r("div", Ut, [
793
- (t = (p = a.purchaseOrder) == null ? void 0 : p.netSuite) != null && t.id ? (_(), q("span", Lt, x((D = (v = a.purchaseOrder) == null ? void 0 : v.netSuite) == null ? void 0 : D.refNo) + " (" + x((A = (w = a.purchaseOrder) == null ? void 0 : w.netSuite) == null ? void 0 : A.id) + ") ", 1)) : (_(), q("span", Vt, "N/A"))
794
- ])
795
- ])) : V("", !0),
796
- !a.isTransferBetweenOutlets && d.value && ((F = a.purchaseOrder) == null ? void 0 : F.status) === y(se).Enum.REQUESTING || a.scope === y(Ee).APPROVAL ? (_(), q("div", Mt, [
797
- r("div", Kt, " (Request) NetSuite " + x(a.transferType === y(he).PURCHASE ? "Purchase Order" : "Transfer Order") + " (ID) ", 1),
798
- r("div", jt, [
799
- (J = (W = d.value) == null ? void 0 : W.netSuite) != null && J.id ? (_(), q("span", zt, x((ne = (ae = d.value) == null ? void 0 : ae.netSuite) == null ? void 0 : ne.refNo) + " (" + x((oe = (te = d.value) == null ? void 0 : te.netSuite) == null ? void 0 : oe.id) + ") ", 1)) : (_(), q("span", Gt, "N/A"))
800
- ])
801
- ])) : V("", !0),
802
- m.value ? (_(), q("div", Ht, [
803
- h[1] || (h[1] = r("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " NetSuite Transaction Number ", -1)),
804
- r("div", Qt, x(m.value), 1)
805
- ])) : V("", !0),
806
- y(o).isEnabled && a.transferType === y(he).TRANSFER && !a.isTransferBetweenOutlets ? (_(), q("div", Yt, [
807
- h[2] || (h[2] = r("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " NetSuite fulfillment IDs ", -1)),
808
- r("div", Wt, x(u.value), 1)
809
- ])) : V("", !0)
810
- ])) : V("", !0);
811
- };
812
- }
813
- }), Xt = { class: "flex flex-row-reverse" }, Zt = /* @__PURE__ */ qe({
814
- __name: "NetSuiteSync",
815
- props: {
816
- poRequest: {},
817
- purchaseOrder: {},
818
- isTransferBetweenOutlets: { type: Boolean },
819
- scope: {}
820
- },
821
- setup(n) {
822
- const l = n, o = Be(), b = Ve(), d = Le(), s = j(!1);
823
- G(() => {
824
- var i, p, t, v;
825
- let u = !0;
826
- o.isEnabled || (u = !1);
827
- const a = l.purchaseOrder, h = l.poRequest;
828
- return a && ((i = a == null ? void 0 : a.supplier) != null && i.internal ? (!h && a.status == se.enum.DRAFT && (u = !1), h && !((p = h == null ? void 0 : h.netSuite) != null && p.id) && (u = !1), l.isTransferBetweenOutlets && (u = !1)) : ((a == null ? void 0 : a.status) !== se.enum.REQUESTING && a.supplier.internal && (u = !1), !h && !((t = a == null ? void 0 : a.netSuite) != null && t.id) && (u = !1), !h && ((v = a == null ? void 0 : a.netSuite) != null && v.id) && (a == null ? void 0 : a.status) == se.enum.REQUESTING && (u = !1))), u;
829
- });
830
- async function m() {
831
- s.value || d.open({
832
- title: "Sync with NetSuite",
833
- contentComponent: N("div", [
834
- N("p", "Are you sure you want to sync now?"),
835
- N("br"),
836
- N(
837
- "p",
838
- { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" },
839
- "Please wait a moment before syncing manually to avoid unnecessary actions."
840
- )
841
- ]),
842
- primaryActions: {
843
- text: "Sync",
844
- close: !0,
845
- variant: "destructive"
846
- },
847
- secondaryActions: { text: "Not now", close: !0 }
848
- }).onPrimary(async () => {
849
- var u, a, h;
850
- try {
851
- s.value = !0;
852
- const i = ((u = l.purchaseOrder) == null ? void 0 : u._id) || ((a = l.poRequest) == null ? void 0 : a.purchaseOrderId) || "", p = (h = l.poRequest) == null ? void 0 : h.to.dbName;
853
- await o.syncPurchaseOrder(
854
- i,
855
- l.scope === "approval" ? p : void 0
856
- ), b.open({
857
- title: "Sync with NetSuite",
858
- message: "Requested to sync with NetSuite. Please wait a moment.",
859
- type: "success"
860
- }), await new Promise((t) => setTimeout(t, 5e3)), s.value = !1;
861
- } catch {
862
- b.open({
863
- title: "Error",
864
- message: "Failed to sync with NetSuite",
865
- type: "error"
866
- }), s.value = !1;
867
- }
868
- });
869
- }
870
- return (u, a) => {
871
- const h = Q("FmButton");
872
- return _(), q("div", Xt, [
873
- B(h, {
874
- "prepend-icon": "sync",
875
- variant: "secondary",
876
- label: "Sync",
877
- loading: s.value,
878
- onClick: m,
879
- "text-color": "primary",
880
- "bg-color": "transparent",
881
- "border-color": "primary"
882
- }, null, 8, ["loading"])
883
- ]);
884
- };
885
- }
886
- }), er = { class: "border border-fm-color-neutral-gray-200 fm-corner-radius-lg p-16" }, tr = { class: "flex flex-col gap-8" }, rr = { class: "flex w-full justify-end gap-16" }, sr = /* @__PURE__ */ qe({
887
- __name: "FulfillmentForm",
888
- props: {
889
- purchaseOrder: {},
890
- confirm: { type: Function }
891
- },
892
- emits: ["update:show"],
893
- setup(n, { emit: l }) {
894
- const o = n, b = bt({
895
- id: "",
896
- createdAt: (/* @__PURE__ */ new Date()).toISOString(),
897
- items: []
898
- }), d = j(), s = l;
899
- return at(() => {
900
- o.purchaseOrder && (console.log("props", o.purchaseOrder), b.items = o.purchaseOrder.items.map((m) => ({
901
- id: m.id,
902
- sku: m.sku,
903
- measurement: m.measurement,
904
- amount: m.quantity ?? { amount: 1, precision: 0 }
905
- })));
906
- }), (m, u) => {
907
- const a = Q("FmTable"), h = Q("FmButton"), i = Q("FmForm");
908
- return _(), ue(i, {
909
- ref_key: "formRef",
910
- ref: d,
911
- class: "bg-white flex flex-col gap-32 rounded-3xl p-24 w-[800px]",
912
- onValidationFailed: console.log,
913
- onValidationSuccess: u[1] || (u[1] = () => o.confirm(b))
914
- }, {
915
- default: de(() => [
916
- u[2] || (u[2] = r("div", { class: "fm-typo-en-title-sm-600" }, "Confirm the transfer amount", -1)),
917
- r("div", er, [
918
- r("div", tr, [
919
- B(a, {
920
- "column-defs": [
921
- {
922
- header: "Code",
923
- cell: (p) => {
924
- const t = o.purchaseOrder.items.find((v) => v.id === p.row.original.id || v.sku._id === p.row.original.sku._id);
925
- return N(
926
- y(Xe).FmTooltip,
927
- {
928
- content: t.code,
929
- placement: "top",
930
- variant: "plain",
931
- zIndex: 50
932
- },
933
- N(
934
- "span",
935
- {
936
- class: "flex-auto line-clamp-2 text-ellipsis break-all"
937
- },
938
- t.code
939
- )
940
- );
941
- }
942
- },
943
- {
944
- header: "Name",
945
- cell: (p) => {
946
- const t = o.purchaseOrder.items.find((v) => v.id === p.row.original.id || v.sku._id === p.row.original.sku._id);
947
- return N(
948
- y(Xe).FmTooltip,
949
- {
950
- content: t.name,
951
- placement: "top",
952
- variant: "plain",
953
- zIndex: 50
954
- },
955
- N(
956
- "span",
957
- {
958
- class: "flex-auto line-clamp-2 text-ellipsis break-all"
959
- },
960
- t.name
961
- )
962
- );
963
- }
964
- },
965
- {
966
- header: "Amount",
967
- cell: (p) => {
968
- const t = p.row.original, v = o.purchaseOrder.items.find((w) => w.id === t.id || w.sku._id === t.sku._id), D = t.amount ?? {
969
- amount: 1,
970
- precision: 0
971
- };
972
- return N(qt, {
973
- style: {
974
- flex: "1 1 0%"
975
- },
976
- modelValue: {
977
- amount: D,
978
- measurement: t.measurement ?? null
979
- },
980
- key: t.id ?? t.sku._id,
981
- unit: t.sku.unit,
982
- "onUpdate:modelValue": (w) => {
983
- if (!w) return;
984
- const A = b.items.find((F) => F.id === t.id || F.sku._id === t.sku._id);
985
- A && (A.amount = w.amount);
986
- },
987
- disableUnit: !0,
988
- rules: [
989
- y(Nt)(
990
- +y(le)({ amount: 0, precision: 0 })
991
- ),
992
- y(At)(+y(le)(v.quantity))
993
- ],
994
- applyDefaultRules: !0
995
- });
996
- }
997
- }
998
- ],
999
- "row-data": b.items,
1000
- "hide-footer": !0
1001
- }, null, 8, ["column-defs", "row-data"])
1002
- ])
1003
- ]),
1004
- r("div", rr, [
1005
- B(h, {
1006
- class: "px-16",
1007
- label: "Confirm",
1008
- size: "md",
1009
- variant: "primary",
1010
- type: "submit"
1011
- }),
1012
- B(h, {
1013
- class: "px-16",
1014
- label: "Cancel",
1015
- size: "md",
1016
- variant: "secondary",
1017
- onClick: u[0] || (u[0] = () => s("update:show", !1))
1018
- })
1019
- ])
1020
- ]),
1021
- _: 1
1022
- }, 8, ["onValidationFailed"]);
1023
- };
1024
- }
1025
- }), et = {
1026
- submitRequest: {
1027
- translationKey: "inventory.transfer.receiveRequest.actions.submitRequest",
1028
- color: "primary",
1029
- buttonVariant: ee.Primary
1030
- },
1031
- confirmDraft: {
1032
- translationKey: "inventory.transfer.receiveRequest.actions.confirmDraft",
1033
- color: "primary",
1034
- buttonVariant: ee.Primary
1035
- },
1036
- cancelDraft: {
1037
- translationKey: "inventory.transfer.receiveRequest.actions.cancelDraft",
1038
- color: "system-error-300",
1039
- buttonVariant: ee.Destructive
1040
- },
1041
- approveDraft: {
1042
- translationKey: "inventory.transfer.receiveRequest.actions.approveDraft",
1043
- color: "primary",
1044
- buttonVariant: ee.Primary
1045
- },
1046
- rejectDraft: {
1047
- translationKey: "inventory.transfer.receiveRequest.actions.rejectDraft",
1048
- color: "system-error-300",
1049
- buttonVariant: ee.Destructive
1050
- },
1051
- approveRequest: {
1052
- translationKey: "inventory.transfer.receiveRequest.actions.approveRequest",
1053
- color: "primary",
1054
- buttonVariant: ee.Primary
1055
- },
1056
- processRequest: {
1057
- translationKey: "inventory.transfer.receiveRequest.actions.processRequest",
1058
- color: "primary",
1059
- buttonVariant: ee.Primary
1060
- },
1061
- receiveStock: {
1062
- translationKey: "inventory.transfer.receiveRequest.actions.receiveStock",
1063
- color: "primary",
1064
- buttonVariant: ee.Primary
1065
- },
1066
- completeReceive: {
1067
- translationKey: "inventory.transfer.receiveRequest.actions.completeReceive",
1068
- color: "primary",
1069
- buttonVariant: ee.Plain
1070
- },
1071
- rejectRequest: {
1072
- translationKey: "inventory.transfer.receiveRequest.actions.rejectRequest",
1073
- color: "system-error-300",
1074
- buttonVariant: ee.Destructive
1075
- },
1076
- closeRequest: {
1077
- translationKey: "inventory.transfer.receiveRequest.actions.closeRequest",
1078
- color: "system-error-300",
1079
- buttonVariant: ee.Destructive
1080
- }
1081
- };
1082
- function ar() {
1083
- return {
1084
- ableToMarkReceived(n) {
1085
- if (!n || n.status !== se.enum.RECEIVING)
1086
- return !1;
1087
- const o = me().currentLocationDBName;
1088
- return `${n.supplier.internal}_${n.supplier._id}` !== o;
1089
- },
1090
- ableToMarkApproved(n) {
1091
- return !(!n || (n == null ? void 0 : n.status) !== se.enum.REQUESTING && (n == null ? void 0 : n.status) !== se.enum.PROCESSING);
1092
- }
1093
- };
1094
- }
1095
- const nr = { class: "flex flex-col gap-16 w-full h-full" }, or = { class: "flex justify-between" }, cr = { class: "fm-typo-en-body-lg-600" }, lr = { class: "flex flex-col gap-8" }, ir = { class: "flex flex-col gap-4" }, ur = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, dr = { class: "flex gap-1" }, mr = { class: "fm-typo-en-body-lg-600" }, fr = {
1096
- key: 0,
1097
- class: "flex flex-col gap-4"
1098
- }, pr = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, yr = { class: "fm-typo-en-body-lg-600" }, vr = { class: "flex flex-col gap-4" }, hr = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, br = { class: "fm-typo-en-body-lg-600" }, gr = {
1099
- key: 1,
1100
- class: "flex flex-col gap-4"
1101
- }, _r = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, wr = { class: "fm-typo-en-body-lg-600" }, Sr = {
1102
- key: 2,
1103
- class: "flex flex-col gap-4"
1104
- }, Rr = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, xr = { class: "fm-typo-en-body-lg-600" }, Or = {
1105
- key: 3,
1106
- class: "flex flex-col gap-4"
1107
- }, kr = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Dr = { class: "fm-typo-en-body-lg-600" }, qr = {
1108
- key: 4,
1109
- class: "flex flex-col gap-4"
1110
- }, Nr = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ar = { class: "fm-typo-en-body-lg-600" }, Pr = {
1111
- key: 0,
1112
- class: "border border-fm-color-neutral-gray-200 fm-corner-radius-lg p-16 flex flex-col gap-8"
1113
- }, Tr = { class: "flex gap-8 items-center" }, $r = { class: "border border-fm-color-neutral-gray-200 fm-corner-radius-lg p-16" }, Cr = { class: "flex flex-col gap-8" }, Ir = { class: "flex gap-8 items-center" }, Fr = { class: "flex-1 fm-typo-en-body-lg-600" }, Er = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary flex flex-col gap-4" }, Br = { class: "flex w-full gap-4" }, Ur = { class: "basis-1/2 shrink-0 grow fm-typo-en-body-lg-400 line-clamp-2" }, Lr = { class: "fm-typo-en-body-lg-600 line-clamp-2" }, Vr = { class: "flex w-full gap-4 fm-typo-en-body-sm-400" }, Mr = { class: "grow fm-typo-en-body-lg-400 text-fm-color-typo-secondary line-clamp-1" }, Kr = {
1114
- key: 0,
1115
- class: "line-clamp-1 fm-typo-en-body-lg-400 text-fm-color-typo-secondary"
1116
- }, jr = { class: "py-8" }, zr = { class: "flex justify-end gap-4 items-center" }, Gr = { class: "fm-typo-en-body-lg-600" }, Hr = {
1117
- key: 1,
1118
- class: "flex-1 xs:w-screen xs:max-w-full"
1119
- }, Qr = {
1120
- key: 0,
1121
- class: "flex flex-col items-center gap-8 h-full"
1122
- }, Yr = ["src"], Wr = { class: "fm-typo-en-body-lg-600" }, Jr = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary px-16" }, Xr = {
1123
- key: 1,
1124
- class: "px-4 flex flex-col"
1125
- }, Zr = { class: "flex gap-12 content-stretch" }, es = {
1126
- class: "flex flex-col w-24",
1127
- name: "circles"
1128
- }, ts = { class: "flex-1 flex flex-col items-center" }, rs = { class: "flex-1 flex flex-col items-center" }, ss = {
1129
- class: "py-12 flex flex-col gap-4",
1130
- name: "received-at header"
1131
- }, as = { class: "fm-typo-en-body-lg-400" }, ns = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, os = { class: "flex gap-12 content-stretch" }, cs = {
1132
- class: "flex flex-col w-24",
1133
- name: "circles"
1134
- }, ls = { class: "flex-1 flex flex-col items-center" }, is = {
1135
- class: "py-12 flex flex-col gap-4 flex-1",
1136
- name: "delivery details"
1137
- }, us = { class: "flex flex-col gap-8" }, ds = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, ms = { class: "flex flex-col gap-4" }, fs = { class: "flex gap-8 xs:flex-col" }, Ds = /* @__PURE__ */ qe({
1138
- __name: "TransferDetails",
1139
- props: {
1140
- poRequest: {},
1141
- purchaseOrder: {},
1142
- transferTo: {},
1143
- transferToDbName: {},
1144
- show: { type: Boolean },
1145
- canResubmit: { type: Boolean },
1146
- canApprove: { type: Boolean },
1147
- scope: {}
1148
- },
1149
- emits: ["update:show", "submitted"],
1150
- setup(n, { emit: l }) {
1151
- const o = n, b = l, d = Le(), s = Ve(), m = Me(), u = Dt(), a = me(), h = Ue(), i = G(
1152
- () => {
1153
- var e, c;
1154
- return {
1155
- id: ((e = h.sessionUser.value) == null ? void 0 : e.id) ?? "",
1156
- name: ((c = h.sessionUser.value) == null ? void 0 : c.displayName) ?? ""
1157
- };
1158
- }
1159
- ), p = ar(), { t } = ot(), v = G(
1160
- () => {
1161
- var e, c, g, S;
1162
- return ((c = (e = o.purchaseOrder) == null ? void 0 : e.supplier) == null ? void 0 : c.internal) === "restaurant" || ((S = (g = o.purchaseOrder) == null ? void 0 : g.supplier) == null ? void 0 : S.internal) === "warehouse" ? he.TRANSFER : he.PURCHASE;
1163
- }
1164
- ), D = G(() => {
1165
- var e, c, g, S, C;
1166
- return v.value === he.TRANSFER && ((e = o.transferToDbName) == null ? void 0 : e.startsWith("restaurant")) && ((g = (c = o.purchaseOrder) == null ? void 0 : c.supplier) == null ? void 0 : g.internal) === "restaurant" || ((C = (S = o.purchaseOrder) == null ? void 0 : S.netSuite) == null ? void 0 : C.id);
1167
- }), w = j(!1), A = j(""), F = j(!0), W = Ne(), J = Pt(W.getWorkflowConfig), ae = lt(), ne = G(() => {
1168
- if (!o.purchaseOrder)
1169
- return [];
1170
- const e = J.result.value;
1171
- if (e.state === Ze.loading)
1172
- return [];
1173
- const c = {
1174
- user: i.value,
1175
- executedAt: a.locations.computeFirst(
1176
- (S) => {
1177
- var C;
1178
- return S.dbName === ((C = a._currentLocation) == null ? void 0 : C.dbName) ? S : null;
1179
- }
1180
- ),
1181
- purchaseOrderRequest: o.poRequest,
1182
- purchaseOrder: o.purchaseOrder
1183
- };
1184
- let g = [];
1185
- return e.state === Ze.error ? (console.error("Error fetching workflow config:", e.error), g = Ce.getAvailableActions({
1186
- ...c,
1187
- purchaseOrderConfig: Ce.getDefaultConfig()
1188
- }).actions.filter(
1189
- (S) => (
1190
- // TODO: create receiveStock & processRequest dialog
1191
- // to create their payload
1192
- S !== O.enum.receiveStock && S !== O.enum.processRequest && S !== O.enum.closeRequest
1193
- )
1194
- )) : g = Ce.getAvailableActions({
1195
- ...c,
1196
- purchaseOrderConfig: e.data
1197
- }).actions.filter(
1198
- (S) => S !== O.enum.receiveStock && S !== O.enum.processRequest && S !== O.enum.closeRequest
1199
- ), o.scope === "approval" && (g = g.filter((S) => S !== O.enum.completeReceive)), g;
1200
- }), te = kt(o, "show"), oe = G(() => [
1201
- {
1202
- label: t("inventory.transfer.receiveRequest.details.overview"),
1203
- value: "overview"
1204
- },
1205
- {
1206
- label: t("inventory.transfer.receiveRequest.details.deliveryHistory"),
1207
- value: "deliveryHistory"
1208
- }
1209
- ]), ie = j(oe.value[0]);
1210
- gt(
1211
- () => o.show,
1212
- (e) => {
1213
- e && (ie.value = oe.value[0]);
1214
- }
1215
- );
1216
- async function Ae(e, c, g, S, C) {
1217
- return new Promise((M, Y) => {
1218
- d.open({
1219
- closeButton: !1,
1220
- title: S.title,
1221
- message: S.message,
1222
- primaryActions: S.primaryActions,
1223
- secondaryActions: { text: "No", close: !1 }
1224
- }).onPrimary(async () => {
1225
- var f, P, L, H;
1226
- try {
1227
- await ae({
1228
- operate: {
1229
- operation: g,
1230
- doc: e,
1231
- options: c
1232
- },
1233
- operateV2: {
1234
- _id: ((f = o.purchaseOrder) == null ? void 0 : f._id) ?? "",
1235
- _rev: ((P = o.purchaseOrder) == null ? void 0 : P._rev) ?? "",
1236
- action: g,
1237
- payload: {
1238
- fulfillment: c.fulfillment
1239
- }
1240
- // add payload if action is receiveStock or processRequest
1241
- },
1242
- transferTo: (H = (L = o.poRequest) == null ? void 0 : L.to) == null ? void 0 : H.dbName
1243
- }).delayed(1e3), M("submitted");
1244
- } catch (I) {
1245
- Y(I);
1246
- }
1247
- }).onSecondary(() => {
1248
- M("cancelled");
1249
- for (let f = 0; f < C + 2; f++)
1250
- d.close();
1251
- }).onClose(() => {
1252
- });
1253
- });
1254
- }
1255
- async function be(e) {
1256
- if (e === O.enum.receiveStock)
1257
- return;
1258
- const c = ct[e];
1259
- if (!c) {
1260
- s.open({
1261
- title: "Something went wrong",
1262
- message: `Cannot process order: ${rt(e)}`,
1263
- type: "error"
1264
- });
1265
- return;
1266
- }
1267
- const { successMessage: g } = c;
1268
- if (o.purchaseOrder) {
1269
- A.value = `${e}`, w.value = !0, F.value = !1;
1270
- const S = {};
1271
- let C = 0;
1272
- if ((e === O.enum.confirmDraft || // auto receive for warehouse to warehouse
1273
- e === O.enum.completeReceive) && m.autoReceiveWarehouse)
1274
- S.autoReceive = !0;
1275
- else if (e === O.enum.approveRequest && m.acceptRequireFulfillment) {
1276
- const M = await new Promise((Y, f) => {
1277
- d.open({
1278
- closeButton: !1,
1279
- title: "Confirm transfer amount",
1280
- dialogComponent: sr,
1281
- dialogComponentProps: {
1282
- purchaseOrder: o.purchaseOrder,
1283
- confirm: Y,
1284
- "onUpdate:show": (P) => {
1285
- P || (A.value = "", w.value = !1, F.value = !0, C++, d.close()), f("cancelled");
1286
- }
1287
- }
1288
- });
1289
- });
1290
- S.fulfillment = M;
1291
- }
1292
- try {
1293
- await Ae(
1294
- o.purchaseOrder,
1295
- S,
1296
- e,
1297
- c,
1298
- C
1299
- ) === "submitted" && (s.open({
1300
- title: "Success",
1301
- message: g,
1302
- type: "success"
1303
- }), b("update:show", !1), b("submitted"));
1304
- } catch (M) {
1305
- s.open({
1306
- title: "Something went wrong",
1307
- message: "Please try again.",
1308
- type: "error"
1309
- }), console.error("Error when submitting PO operation", e, o.purchaseOrder, M);
1310
- } finally {
1311
- A.value = "", w.value = !1, F.value = !0;
1312
- }
1313
- }
1314
- }
1315
- const Pe = G(() => {
1316
- var e, c;
1317
- return ((e = o.purchaseOrder) == null ? void 0 : e.status) === se.enum.RECEIVING || ((c = o.purchaseOrder) == null ? void 0 : c.status) === se.enum.COMPLETE;
1318
- }), k = G(() => {
1319
- var M, Y, f;
1320
- const g = (((M = o.purchaseOrder) == null ? void 0 : M.deliveryOrder) ?? []).flatMap((P) => P.received ?? []).reduce(
1321
- (P, L) => {
1322
- const H = P[L.sku._id] ?? [];
1323
- return P[L.sku._id] = [...H, L], P;
1324
- },
1325
- {}
1326
- ), S = Object.entries(g).reduce(
1327
- (P, [L, H]) => {
1328
- const I = H.reduce((X, E) => {
1329
- const ce = yt(
1330
- X,
1331
- Math.max(X.precision, E.amount.precision)
1332
- );
1333
- return Fe(ce, E.amount);
1334
- }, ke(0));
1335
- return P[L] = I, P;
1336
- },
1337
- {}
1338
- ), C = ((Y = o.purchaseOrder) == null ? void 0 : Y.items) ?? [];
1339
- for (const P of C)
1340
- S[f = P.sku._id] ?? (S[f] = ke(0));
1341
- return S;
1342
- }), R = G(() => {
1343
- var M, Y;
1344
- const e = ((M = o.purchaseOrder) == null ? void 0 : M.deliveryOrder) ?? [], c = ((Y = o.purchaseOrder) == null ? void 0 : Y.deliveryFullfillment) ?? [], g = [
1345
- ...e.map((f) => ({
1346
- createdAt: f.createdAt,
1347
- type: "grn",
1348
- doc: f
1349
- })),
1350
- ...c.map((f) => ({
1351
- createdAt: f.createdAt,
1352
- type: "fulfillment",
1353
- doc: f
1354
- }))
1355
- ];
1356
- g.reverse().sort((f, P) => f.createdAt.localeCompare(P.createdAt));
1357
- function S(f) {
1358
- var H, I, X, E, ce, ge, _e, we, $;
1359
- const P = c.findIndex((T) => T.id === f.fullfillmentId), L = [
1360
- (I = (H = c[P]) == null ? void 0 : H.netSuite) != null && I.refNo ? {
1361
- label: "Fulfillment's ref no. (Netsuite)",
1362
- values: [(E = (X = c[P]) == null ? void 0 : X.netSuite) == null ? void 0 : E.refNo]
1363
- } : null,
1364
- (ce = f == null ? void 0 : f.netSuite) != null && ce.refNo ? {
1365
- label: "Netsuite ref no.",
1366
- values: [(ge = f == null ? void 0 : f.netSuite) == null ? void 0 : ge.refNo]
1367
- } : null,
1368
- (_e = f == null ? void 0 : f.netSuite) != null && _e.recordType ? {
1369
- label: "Netsuite Type",
1370
- values: [vt((we = f == null ? void 0 : f.netSuite) == null ? void 0 : we.recordType)]
1371
- } : null
1372
- ];
1373
- return {
1374
- header: "Received",
1375
- date: Te(new Date(f.createdAt)),
1376
- info: [
1377
- {
1378
- label: "Adjustment date",
1379
- values: [
1380
- f.adjustment ? Te(new Date(ht(f.adjustment))) : "-"
1381
- ]
1382
- },
1383
- {
1384
- label: "Received by",
1385
- values: [($ = f.createdBy) == null ? void 0 : $.name]
1386
- },
1387
- {
1388
- label: "Received items",
1389
- values: f.received.map((T) => {
1390
- var K;
1391
- return N("div", [
1392
- N(
1393
- "div",
1394
- {
1395
- class: "flex gap-4"
1396
- },
1397
- [
1398
- N(
1399
- "div",
1400
- {
1401
- class: "flex flex-col"
1402
- },
1403
- [
1404
- N(
1405
- "span",
1406
- {
1407
- class: "fm-typo-en-body-lg-800 basis-1/2 shrink-0 grow"
1408
- },
1409
- `${T.sku.name}`
1410
- ),
1411
- N(
1412
- "span",
1413
- {
1414
- class: "fm-typo-en-body-md-400"
1415
- },
1416
- `${T.sku.code} `
1417
- )
1418
- ]
1419
- ),
1420
- N(
1421
- "div",
1422
- {
1423
- class: "ml-auto flex flex-col"
1424
- },
1425
- [
1426
- N(
1427
- "div",
1428
- {
1429
- class: "ml-auto flex gap-1"
1430
- },
1431
- [
1432
- N(
1433
- "span",
1434
- {
1435
- class: "fm-typo-en-body-lg-600 self-end"
1436
- },
1437
- le(T.amount, !1)
1438
- ),
1439
- N(
1440
- "span",
1441
- {
1442
- class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary"
1443
- },
1444
- ((K = T.measurement) == null ? void 0 : K.abbrev) ?? T.sku.unit.abbrev
1445
- )
1446
- ]
1447
- ),
1448
- N(
1449
- "div",
1450
- {
1451
- class: "flex self-end fm-typo-en-body-md-400 text-fm-color-typo-secondary"
1452
- },
1453
- `${T.cost ? `(${xe(T.cost)})` : ""}`
1454
- )
1455
- ]
1456
- )
1457
- ]
1458
- )
1459
- ]);
1460
- })
1461
- },
1462
- f.deliveryOrderNumber ? {
1463
- label: "Delivery order no.",
1464
- values: [f.deliveryOrderNumber]
1465
- } : null,
1466
- f.remark ? {
1467
- label: "Remark",
1468
- values: [f.remark]
1469
- } : null,
1470
- P > -1 ? {
1471
- label: "Fulfilment's sequence",
1472
- values: [`${P + 1}`]
1473
- } : null,
1474
- ...L
1475
- ].filter((T) => T)
1476
- };
1477
- }
1478
- function C(f) {
1479
- var L, H;
1480
- const P = c.findIndex((I) => I.id === f.id);
1481
- return {
1482
- header: "Fulfillment",
1483
- date: Te(new Date(f.createdAt)),
1484
- info: [
1485
- {
1486
- label: "Sequence",
1487
- values: [String(P + 1)]
1488
- },
1489
- {
1490
- label: "Receiveable items",
1491
- values: f.items.map((I) => {
1492
- var X;
1493
- return N("div", [
1494
- N(
1495
- "div",
1496
- {
1497
- class: "flex gap-4"
1498
- },
1499
- [
1500
- N(
1501
- "div",
1502
- {
1503
- class: "flex flex-col"
1504
- },
1505
- [
1506
- N(
1507
- "span",
1508
- {
1509
- class: "fm-typo-en-body-lg-800 basis-1/2 shrink-0 grow"
1510
- },
1511
- `${I.sku.name}`
1512
- ),
1513
- N(
1514
- "span",
1515
- {
1516
- class: "fm-typo-en-body-md-400"
1517
- },
1518
- `${I.sku.code} `
1519
- )
1520
- ]
1521
- ),
1522
- N(
1523
- "div",
1524
- {
1525
- class: "ml-auto flex flex-col"
1526
- },
1527
- [
1528
- N(
1529
- "div",
1530
- {
1531
- class: "ml-auto flex gap-1"
1532
- },
1533
- [
1534
- N(
1535
- "span",
1536
- {
1537
- class: "fm-typo-en-body-lg-600 self-end"
1538
- },
1539
- le(I.amount, !1)
1540
- ),
1541
- N(
1542
- "span",
1543
- {
1544
- class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary"
1545
- },
1546
- ((X = I.measurement) == null ? void 0 : X.abbrev) ?? I.sku.unit.abbrev
1547
- )
1548
- ]
1549
- ),
1550
- N(
1551
- "div",
1552
- {
1553
- class: "flex self-end fm-typo-en-body-md-400 text-fm-color-typo-secondary"
1554
- },
1555
- `${I.cost ? `(${xe(I.cost)})` : ""}`
1556
- )
1557
- ]
1558
- )
1559
- ]
1560
- )
1561
- ]);
1562
- })
1563
- },
1564
- (L = f.netSuite) != null && L.refNo ? {
1565
- label: "Ref no. (Netsuite)",
1566
- values: [(H = f.netSuite) == null ? void 0 : H.refNo]
1567
- } : null
1568
- ].filter((I) => I)
1569
- };
1570
- }
1571
- return g.map((f) => {
1572
- switch (f.type) {
1573
- case "grn":
1574
- return S(f.doc);
1575
- case "fulfillment":
1576
- return C(f.doc);
1577
- }
1578
- });
1579
- }), U = G(() => {
1580
- var c;
1581
- const e = {
1582
- ...ke(0),
1583
- currency: Je()
1584
- };
1585
- return ((c = o.purchaseOrder) == null ? void 0 : c.items.reduce((g, S) => ({
1586
- ...Fe(g, S.totalCost ?? e),
1587
- currency: Je()
1588
- }), e)) ?? e;
1589
- });
1590
- return (e, c) => {
1591
- var I, X;
1592
- const g = Q("FmButtonGroup"), S = Q("FmChip"), C = Q("FmMenuDivider"), M = Q("FmCard"), Y = Q("FmIcon"), f = Q("FmTooltip"), P = Q("FmSpacer"), L = Q("FmButton"), H = Q("FmSideSheet");
1593
- return _(), ue(H, {
1594
- header: y(t)("inventory.transfer.receiveRequest.details.title") + ((I = e.purchaseOrder) != null && I.seqNumber ? ` #${(X = e.purchaseOrder) == null ? void 0 : X.seqNumber}` : ""),
1595
- modelValue: y(te),
1596
- "onUpdate:modelValue": c[4] || (c[4] = (E) => _t(te) ? te.value = E : null),
1597
- "dismiss-away": F.value,
1598
- "close-button": "",
1599
- "max-width": 600
1600
- }, {
1601
- default: de(() => {
1602
- var E, ce, ge, _e, we;
1603
- return [
1604
- r("div", nr, [
1605
- r("div", null, [
1606
- B(g, {
1607
- items: oe.value,
1608
- modelValue: ie.value,
1609
- "onUpdate:modelValue": c[0] || (c[0] = ($) => ie.value = $)
1610
- }, null, 8, ["items", "modelValue"])
1611
- ]),
1612
- ie.value.value === "overview" ? (_(), q(re, { key: 0 }, [
1613
- r("div", null, [
1614
- B(M, {
1615
- variant: "outlined",
1616
- class: "flex flex-col gap-8 px-12 py-16"
1617
- }, {
1618
- default: de(() => {
1619
- var $, T, K, fe, pe, Re, Ke, je, ze, Ge, He, Qe;
1620
- return [
1621
- r("div", or, [
1622
- r("div", cr, x(y(t)("inventory.transfer.receiveRequest.details.requestSummary")), 1),
1623
- r("div", null, [
1624
- B(S, {
1625
- label: y(t)(`inventory.transfer.status.${($ = e.purchaseOrder) == null ? void 0 : $.status}`),
1626
- class: Oe(`fm-status-badge fm-status-badge-${(K = (T = e.purchaseOrder) == null ? void 0 : T.status) == null ? void 0 : K.toLocaleLowerCase("en-us")}`),
1627
- compact: ""
1628
- }, null, 8, ["label", "class"])
1629
- ])
1630
- ]),
1631
- B(C),
1632
- r("div", lr, [
1633
- r("div", ir, [
1634
- r("div", ur, [
1635
- r("div", dr, x(y(t)("inventory.transfer.receiveRequest.details.createdAt")), 1)
1636
- ]),
1637
- r("div", mr, x(y(De)(((fe = e.purchaseOrder) == null ? void 0 : fe._id) ?? "")), 1)
1638
- ]),
1639
- (pe = e.purchaseOrder) != null && pe.effectiveAt ? (_(), q("div", fr, [
1640
- r("div", pr, x(y(t)("inventory.transfer.receiveRequest.details.backdatedTo")), 1),
1641
- r("div", yr, x(y(st)(new Date((Re = e.purchaseOrder) == null ? void 0 : Re.effectiveAt))), 1)
1642
- ])) : V("", !0),
1643
- r("div", vr, [
1644
- r("div", hr, x(y(t)("inventory.transfer.receiveRequest.details.type.title")), 1),
1645
- r("div", br, x(y(t)(
1646
- `inventory.transfer.receiveRequest.details.type.${v.value.toLocaleLowerCase("en-US")}`
1647
- )), 1)
1648
- ]),
1649
- (je = (Ke = e.purchaseOrder) == null ? void 0 : Ke.supplier) != null && je.name ? (_(), q("div", gr, [
1650
- r("div", _r, x(y(t)("inventory.transfer.receiveRequest.details.from")), 1),
1651
- r("div", wr, x((Ge = (ze = e.purchaseOrder) == null ? void 0 : ze.supplier) == null ? void 0 : Ge.name), 1)
1652
- ])) : V("", !0),
1653
- e.transferTo ? (_(), q("div", Sr, [
1654
- r("div", Rr, x(y(t)("inventory.transfer.receiveRequest.details.to")), 1),
1655
- r("div", xr, x(e.transferTo), 1)
1656
- ])) : V("", !0),
1657
- (He = e.purchaseOrder) != null && He.ref ? (_(), q("div", Or, [
1658
- r("div", kr, x(y(t)("inventory.transfer.receiveRequest.details.reference")), 1),
1659
- r("div", Dr, x(e.purchaseOrder.ref), 1)
1660
- ])) : V("", !0),
1661
- (Qe = e.purchaseOrder) != null && Qe.remark ? (_(), q("div", qr, [
1662
- r("div", Nr, x(y(t)("inventory.transfer.receiveRequest.details.remark")), 1),
1663
- r("div", Ar, x(e.purchaseOrder.remark), 1)
1664
- ])) : V("", !0)
1665
- ])
1666
- ];
1667
- }),
1668
- _: 1
1669
- })
1670
- ]),
1671
- y(u).isNetSuiteEnabled && D.value ? (_(), q("div", Pr, [
1672
- r("div", Tr, [
1673
- c[5] || (c[5] = r("span", { class: "flex-1 fm-typo-en-body-lg-600" }, "NetSuite Info", -1)),
1674
- r("div", null, [
1675
- B(Zt, {
1676
- "po-request": e.poRequest,
1677
- "purchase-order": e.purchaseOrder,
1678
- "is-transfer-between-outlets": !D.value,
1679
- scope: e.scope
1680
- }, null, 8, ["po-request", "purchase-order", "is-transfer-between-outlets", "scope"])
1681
- ])
1682
- ]),
1683
- B(C),
1684
- B(Jt, {
1685
- "po-request": e.poRequest,
1686
- "purchase-order": e.purchaseOrder,
1687
- "transfer-type": v.value,
1688
- "transfer-to-db-name": e.transferToDbName,
1689
- "is-transfer-between-outlets": !D.value,
1690
- scope: e.scope
1691
- }, null, 8, ["po-request", "purchase-order", "transfer-type", "transfer-to-db-name", "is-transfer-between-outlets", "scope"])
1692
- ])) : V("", !0),
1693
- r("div", $r, [
1694
- r("div", Cr, [
1695
- r("div", Ir, [
1696
- r("span", Fr, [
1697
- $e(x(Pe.value ? y(t)("inventory.transfer.receiveRequest.details.receivedItems") : y(t)("inventory.transfer.receiveRequest.details.requestedItems")) + " ", 1),
1698
- (ce = (E = e.purchaseOrder) == null ? void 0 : E.netSuite) != null && ce.missingItems && ((_e = (ge = e.purchaseOrder) == null ? void 0 : ge.netSuite) == null ? void 0 : _e.missingItems.length) > 0 ? (_(), ue(f, {
1699
- key: 0,
1700
- variant: "rich",
1701
- placement: "top",
1702
- "z-index": 51
1703
- }, {
1704
- content: de(() => {
1705
- var $, T;
1706
- return [
1707
- r("div", Er, [
1708
- (_(!0), q(re, null, ye((T = ($ = e.purchaseOrder) == null ? void 0 : $.netSuite) == null ? void 0 : T.missingItems, (K, fe) => (_(), q("div", {
1709
- class: "flex justify-center align-middle",
1710
- key: fe
1711
- }, [
1712
- B(Y, {
1713
- name: "arrow_right",
1714
- size: "sm"
1715
- }),
1716
- $e(" " + x(`(${K.netSuiteId}) ${K.name}: ${K.reason}`), 1)
1717
- ]))), 128))
1718
- ])
1719
- ];
1720
- }),
1721
- default: de(() => [
1722
- B(Y, {
1723
- name: "error",
1724
- color: "#ff2c2c",
1725
- size: "sm"
1726
- })
1727
- ]),
1728
- _: 1
1729
- })) : V("", !0)
1730
- ])
1731
- ]),
1732
- B(C),
1733
- (_(!0), q(re, null, ye(((we = e.purchaseOrder) == null ? void 0 : we.items) ?? [], ($) => {
1734
- var T;
1735
- return _(), q("div", {
1736
- key: $.code,
1737
- class: "flex flex-col"
1738
- }, [
1739
- r("div", Br, [
1740
- r("div", Ur, x($.name), 1),
1741
- r("div", Lr, x(y(le)(k.value[$.sku._id], !1)) + "/" + x(y(nt)($.quantity, $.sku.unit, $.measurement)), 1)
1742
- ]),
1743
- r("div", Vr, [
1744
- r("div", Mr, x($.code), 1),
1745
- (T = $.totalCost) != null && T.amount && y(m).enableTotalCost ? (_(), q("div", Kr, " (" + x(y(xe)($.totalCost)) + ") ", 1)) : V("", !0)
1746
- ])
1747
- ]);
1748
- }), 128)),
1749
- +y(le)(U.value) ? (_(), q(re, { key: 0 }, [
1750
- r("div", jr, [
1751
- B(C)
1752
- ]),
1753
- r("div", zr, [
1754
- c[6] || (c[6] = r("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, "Total:", -1)),
1755
- r("div", Gr, x(y(xe)(U.value)), 1)
1756
- ])
1757
- ], 64)) : V("", !0)
1758
- ])
1759
- ])
1760
- ], 64)) : ie.value.value === "deliveryHistory" ? (_(), q("div", Hr, [
1761
- R.value.length ? (_(), q("div", Xr, [
1762
- (_(!0), q(re, null, ye(R.value, ($, T) => (_(), q(re, { key: T }, [
1763
- r("div", Zr, [
1764
- r("div", es, [
1765
- r("div", ts, [
1766
- r("div", {
1767
- class: Oe([
1768
- {
1769
- "bg-fm-color-primary": T !== 0,
1770
- "bg-white": T === 0
1771
- },
1772
- "w-[2px] h-full"
1773
- ])
1774
- }, null, 2)
1775
- ]),
1776
- c[7] || (c[7] = r("div", { class: "h-24 w-24 bg-fm-color-primary rounded-full" }, null, -1)),
1777
- r("div", rs, [
1778
- r("div", {
1779
- class: Oe([
1780
- {
1781
- "bg-fm-color-primary": T < R.value.length - 1,
1782
- "bg-white": T >= R.value.length - 1
1783
- },
1784
- "w-[2px] h-full"
1785
- ])
1786
- }, null, 2)
1787
- ])
1788
- ]),
1789
- r("div", ss, [
1790
- r("div", as, x($.header), 1),
1791
- r("div", ns, x($.date), 1)
1792
- ])
1793
- ]),
1794
- r("div", os, [
1795
- r("div", cs, [
1796
- r("div", ls, [
1797
- r("div", {
1798
- class: Oe([
1799
- {
1800
- "bg-fm-color-primary": T < R.value.length - 1,
1801
- "bg-white": T >= R.value.length - 1
1802
- },
1803
- "w-[2px] h-full"
1804
- ])
1805
- }, null, 2)
1806
- ])
1807
- ]),
1808
- r("div", is, [
1809
- B(M, {
1810
- variant: "outlined",
1811
- class: "py-12 px-16"
1812
- }, {
1813
- default: de(() => [
1814
- r("div", us, [
1815
- (_(!0), q(re, null, ye($.info, (K, fe) => (_(), q("div", {
1816
- key: fe,
1817
- class: "flex flex-col gap-4"
1818
- }, [
1819
- r("div", ds, x(K == null ? void 0 : K.label), 1),
1820
- r("div", ms, [
1821
- (_(!0), q(re, null, ye(K == null ? void 0 : K.values, (pe, Re) => (_(), q("div", {
1822
- key: Re,
1823
- class: "fm-typo-en-body-lg-600"
1824
- }, [
1825
- typeof pe == "string" ? (_(), q(re, { key: 0 }, [
1826
- $e(x(pe), 1)
1827
- ], 64)) : (_(), ue(wt(pe), { key: 1 }))
1828
- ]))), 128))
1829
- ])
1830
- ]))), 128))
1831
- ])
1832
- ]),
1833
- _: 2
1834
- }, 1024)
1835
- ])
1836
- ])
1837
- ], 64))), 128))
1838
- ])) : (_(), q("div", Qr, [
1839
- B(P),
1840
- r("div", null, [
1841
- r("img", {
1842
- src: y(Ot),
1843
- alt: "List is empty"
1844
- }, null, 8, Yr)
1845
- ]),
1846
- r("div", Wr, x(y(t)("inventory.transfer.receiveRequest.details.noRecordsFound")), 1),
1847
- r("div", Jr, x(y(t)("inventory.transfer.receiveRequest.details.trackDeliveryMessage")), 1),
1848
- B(P),
1849
- B(P)
1850
- ]))
1851
- ])) : V("", !0)
1852
- ])
1853
- ];
1854
- }),
1855
- "side-sheet-footer": de(() => [
1856
- r("div", fs, [
1857
- (_(!0), q(re, null, ye(ne.value, (E) => (_(), ue(L, {
1858
- key: E,
1859
- label: y(t)(y(et)[E].translationKey),
1860
- onClick: (ce) => be(E),
1861
- loading: A.value === E,
1862
- disabled: A.value !== E && w.value,
1863
- variant: y(et)[E].buttonVariant
1864
- }, null, 8, ["label", "onClick", "loading", "disabled", "variant"]))), 128)),
1865
- y(p).ableToMarkReceived(e.purchaseOrder) && !ne.value.includes("completeReceive") ? (_(), ue(L, {
1866
- key: 0,
1867
- label: y(t)("inventory.transfer.receiveRequest.actions.completeReceive"),
1868
- onClick: c[1] || (c[1] = (E) => be("completeReceive")),
1869
- loading: A.value === "completeReceive",
1870
- disabled: A.value !== "completeReceive" && w.value
1871
- }, null, 8, ["label", "loading", "disabled"])) : V("", !0),
1872
- y(p).ableToMarkApproved(e.purchaseOrder) && e.canApprove && !ne.value.includes("approveRequest") ? (_(), ue(L, {
1873
- key: 1,
1874
- label: y(t)("inventory.transfer.approval.actions.approveRequest"),
1875
- onClick: c[2] || (c[2] = (E) => be("approveRequest")),
1876
- loading: A.value === "approveRequest",
1877
- disabled: A.value !== "approveRequest" && w.value
1878
- }, null, 8, ["label", "loading", "disabled"])) : V("", !0),
1879
- B(L, {
1880
- label: y(t)("common.close"),
1881
- variant: "tertiary",
1882
- onClick: c[3] || (c[3] = (E) => b("update:show", !1))
1883
- }, null, 8, ["label"])
1884
- ])
1885
- ]),
1886
- _: 1
1887
- }, 8, ["header", "modelValue", "dismiss-away"]);
1888
- };
1889
- }
1890
- });
1891
- export {
1892
- Ee as P,
1893
- Ds as _,
1894
- Os as a,
1895
- ks as b,
1896
- Tt as g,
1897
- Ne as u
1898
- };