@feedmepos/mf-inventory-portal 1.2.0-dev.2 → 1.2.0-dev.4

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