@feedmepos/mf-inventory-portal 0.0.19-dev.1 → 0.0.19-dev.3

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 (69) hide show
  1. package/dist/ApprovalView-CS7NtcBA.js +120 -0
  2. package/dist/{BindingsDialog-DpC48bqK.js → BindingsDialog-BA2w-qkY.js} +5 -6
  3. package/dist/{BindingsPicker-BU52g6zk.js → BindingsPicker-wf7b30Bk.js} +6 -7
  4. package/dist/{BindingsTable-aIuFdScv.js → BindingsTable-mqqSPDbO.js} +4 -6
  5. package/dist/FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-CViUEhuw.js +272 -0
  6. package/dist/IngredientsView-BVX31o67.js +1750 -0
  7. package/dist/IntegrationView-DFdl_238.js +1172 -0
  8. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-BuyM580N.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-BENFVQkL.js} +1 -1
  9. package/dist/{PurchaseOrderPrintPreview-EeKhENYH.js → PurchaseOrderPrintPreview-06PokYt4.js} +13 -13
  10. package/dist/ReceiveRequestView-ck-05Ly7.js +1394 -0
  11. package/dist/RecipeView-CiOb2lvU.js +572 -0
  12. package/dist/StockForecast.vue_vue_type_style_index_0_lang-KLXSWvo5.js +59 -0
  13. package/dist/StockView-5LkTxYI2.js +1876 -0
  14. package/dist/SupplierView-BAfC5Wcw.js +801 -0
  15. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-qZDMkkIZ.js +1031 -0
  16. package/dist/UnitView-wsbXOcbf.js +638 -0
  17. package/dist/WarehouseView-DHhDNAk8.js +1050 -0
  18. package/dist/api/bill.d.ts +2 -2
  19. package/dist/app-DNCC20Aq.js +66729 -0
  20. package/dist/app.d.ts +1031 -0
  21. package/dist/app.js +5 -3
  22. package/dist/components/FmDroppableField.vue.d.ts +1 -1
  23. package/dist/{decimal-BAZuuTcd.js → decimal-DaXHxukU.js} +1 -1
  24. package/dist/{stock-estimate-CL4HShG8.js → id-to-date-XiomI6dP.js} +12 -13
  25. package/dist/{layout-BnTfCS_X.js → layout-DvgFrTEG.js} +14 -14
  26. package/dist/router/name.d.ts +1 -1
  27. package/dist/style.css +1 -1
  28. package/dist/{supplier-CjAH8O1y.js → supplier-BepZrUgL.js} +3 -3
  29. package/dist/tsconfig.app.tsbuildinfo +1 -1
  30. package/dist/views/ingredients/composables/use-ingredient-form.d.ts +14 -2
  31. package/dist/views/ingredients/composables/use-ingredient-table.d.ts +1 -2
  32. package/dist/views/receive-request/components/transfer-form/SparkIcon.vue.d.ts +1 -1
  33. package/dist/views/receive-request/composables/use-receive-request-table.d.ts +12 -12
  34. package/dist/views/recipe/composables/use-recipe-form.d.ts +14 -2
  35. package/dist/views/recipe/composables/use-recipe-table.d.ts +1 -2
  36. package/dist/views/stock/components/StockRecordCard.vue.d.ts +1 -1
  37. package/dist/views/stock/components/dialog/AdjustedItemForm.vue.d.ts +2 -2
  38. package/dist/views/stock/composables/use-stock-action.d.ts +26 -0
  39. package/dist/views/stock/composables/use-stock-table.d.ts +1 -8
  40. package/dist/views/stock/helper/compute-summary-total.d.ts +2 -2
  41. package/dist/views/unit/composables/use-unit-form.d.ts +14 -2
  42. package/dist/views/unit/composables/use-unit-table.d.ts +1 -2
  43. package/dist/{xlsx-vUzm_udV.js → xlsx-DaxqUL1h.js} +1 -1
  44. package/dist/xlsx.util-Dwiw0sTo.js +109 -0
  45. package/package.json +6 -5
  46. package/dist/ApprovalView-BTZwnKLf.js +0 -118
  47. package/dist/FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DjgmtvXU.js +0 -268
  48. package/dist/FmMultiselectDialog.vue_vue_type_script_setup_true_lang-n09XXJZK.js +0 -143
  49. package/dist/FmUnitInput.vue_vue_type_script_setup_true_lang-B-19iYaK.js +0 -236
  50. package/dist/IngredientsView-DMyEGdik.js +0 -1767
  51. package/dist/IntegrationView-Dn_qL_vC.js +0 -1166
  52. package/dist/InventoryBindingForm.vue_vue_type_script_setup_true_lang-DGTLUrb9.js +0 -276
  53. package/dist/ReceiveRequestView-BOdgbFFM.js +0 -1394
  54. package/dist/RecipeView-B1aNLDIK.js +0 -573
  55. package/dist/StockForecast.vue_vue_type_style_index_0_lang-B5EK101t.js +0 -58
  56. package/dist/StockView-C_Ur_jTg.js +0 -1862
  57. package/dist/SupplierView-CXfOoHTr.js +0 -796
  58. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-kjV5Eazv.js +0 -1028
  59. package/dist/UnitView-DHXfAsnq.js +0 -635
  60. package/dist/WarehouseView-DMwbxs1q.js +0 -1043
  61. package/dist/app-BkcO8oNJ.js +0 -66113
  62. package/dist/date2-Cvp5iJkI.js +0 -95
  63. package/dist/dayjs.min-D1_pOsO7.js +0 -282
  64. package/dist/fuzzy-0roCBvgC.js +0 -41
  65. package/dist/index-B_aEOJsR.js +0 -21515
  66. package/dist/number-DLj3W3RW.js +0 -97
  67. package/dist/rules-CCmXA0Yi.js +0 -85
  68. package/dist/use-inventory-binding-dialog-GkJOzE6V.js +0 -93
  69. package/dist/xlsx.util-B_bqymTM.js +0 -107
@@ -0,0 +1,1031 @@
1
+ import { ref as F, computed as se, h as Re, defineComponent as Ue, resolveComponent as Q, openBlock as h, createBlock as H, unref as s, isRef as Me, withCtx as ae, createElementVNode as e, createVNode as K, createElementBlock as x, Fragment as te, toDisplayString as d, normalizeClass as oe, createCommentVNode as S, renderList as me } from "vue";
2
+ import { i as Fe } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-CViUEhuw.js";
3
+ import { n as Ie, j as ne, a7 as b, a8 as ce, J as Le, K as je, a9 as Be, c as ke, $ as T, w as Ae, b as xe, B as Ce, l as fe, a as le, H as Ve, G as He, E as Ge } from "./app-DNCC20Aq.js";
4
+ import { F as Oe, D as C, R as k } from "./row-action.enum-BwQbURNh.js";
5
+ import { useDialog as Pe, useSnackbar as qe, components as De, useProxiedModel as Ke } from "@feedmepos/ui-library";
6
+ import { c as Se } from "./layout-DvgFrTEG.js";
7
+ import { F as ze } from "./decimal-DaXHxukU.js";
8
+ import { useI18n as Ne } from "@feedmepos/mf-common";
9
+ import { E as Qe } from "./empty-placeholder-wf6-BWE8.js";
10
+ const Ee = Ie((a, m) => {
11
+ const p = ne();
12
+ return {
13
+ async readRequests(t) {
14
+ const _ = t ?? p.currentLocationDBName, v = `${a.inventoryBackendUrl}/${_}/purchase-request`;
15
+ return await m.get(v);
16
+ },
17
+ async getPurchaseOrders({
18
+ start: t,
19
+ end: _
20
+ }) {
21
+ const v = p.currentLocationDBName, O = `${a.inventoryBackendUrl}/${v}/purchase-order`;
22
+ return await m.get(`${O}?start=${t}&end=${_}`);
23
+ },
24
+ async getPurchaseOrderById(t) {
25
+ const _ = p.currentLocationDBName, v = `${a.inventoryBackendUrl}/${_}/purchase-order`;
26
+ return await m.get(`${v}/${t}`);
27
+ },
28
+ async processPurchaseOrder(t, _) {
29
+ const v = p.currentLocationDBName, O = _ || v, l = `${a.inventoryBackendUrl}/${O}/purchase-order/run-operation`;
30
+ return await m.put(l, t);
31
+ },
32
+ async createPurchaseOrder(t) {
33
+ const _ = p.currentLocationDBName, v = `${a.inventoryBackendUrl}/${_}/purchase-order`;
34
+ return await m.post(v, t);
35
+ },
36
+ async updatePurchaseOrder(t) {
37
+ const _ = p.currentLocationDBName, v = `${a.inventoryBackendUrl}/${_}/purchase-order`;
38
+ return await m.put(v, t);
39
+ }
40
+ };
41
+ }), Te = {
42
+ [b.enum.confirmDraft]: {
43
+ primaryActions: {
44
+ text: "Confirm draft",
45
+ close: !0
46
+ },
47
+ title: "Confirm draft?",
48
+ message: "Purchase order cannot be changed after confirm draft.",
49
+ successMessage: "Purchase order draft has been confirmed"
50
+ },
51
+ [b.enum.cancelDraft]: {
52
+ primaryActions: {
53
+ text: "Cancel draft",
54
+ close: !0,
55
+ variant: "destructive"
56
+ },
57
+ title: "Cancel draft?",
58
+ message: "Purchase order cannot be changed after cancelled draft.",
59
+ successMessage: "Purchase order draft has been cancelled"
60
+ },
61
+ [b.enum.submitRequest]: {
62
+ primaryActions: {
63
+ text: "Submit request",
64
+ close: !0
65
+ },
66
+ title: "Confirm draft?",
67
+ message: "Purchase order cannot be changed after confirm draft.",
68
+ successMessage: "Purchase order draft has been submitted"
69
+ },
70
+ [b.enum.completeReceive]: {
71
+ primaryActions: {
72
+ text: "Mark received",
73
+ close: !0
74
+ },
75
+ title: "Mark as received",
76
+ message: "Purchase order cannot be changed after it has complete receiving.",
77
+ successMessage: "Purchase order has been marked as received"
78
+ },
79
+ [b.enum.approveRequest]: {
80
+ primaryActions: {
81
+ text: "Approve request",
82
+ close: !0
83
+ },
84
+ title: "Approve request?",
85
+ message: "Purchase order will be approved.",
86
+ successMessage: "Purchase order has been approved"
87
+ },
88
+ [b.enum.rejectRequest]: {
89
+ primaryActions: {
90
+ text: "Reject request",
91
+ close: !0,
92
+ variant: "destructive"
93
+ },
94
+ title: "Reject request?",
95
+ message: "Purchase order will be rejected.",
96
+ successMessage: "Purchase order has been rejected"
97
+ }
98
+ };
99
+ function ie(a) {
100
+ const m = $e(a);
101
+ return m === null ? "" : ce(m);
102
+ }
103
+ function $e(a) {
104
+ const m = a.match(/\w+_(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z).*/);
105
+ if (!m) return null;
106
+ const p = /* @__PURE__ */ new Date(`${m[1]}`);
107
+ return isNaN(p.getTime()) ? null : p;
108
+ }
109
+ function _r(a, m) {
110
+ const p = Pe(), t = ne(), _ = xe(), v = F(!1), O = qe(), l = Ee(), $ = F(new Array()), L = F(
111
+ m != null && m.startDate && (m != null && m.endDate) ? m : Fe()
112
+ ), u = se(() => {
113
+ const f = new Date(L.value.startDate), o = new Date(L.value.endDate);
114
+ return {
115
+ start: Le(f).toISOString(),
116
+ end: je(o).toISOString()
117
+ };
118
+ }), i = F(new Array()), c = Be(), w = F(null), U = F();
119
+ function G() {
120
+ const f = {
121
+ mode: Oe.CREATE,
122
+ modelValue: {},
123
+ show: !0,
124
+ "onUpdate:show"(o) {
125
+ U.value.show = o;
126
+ },
127
+ lastClosingDate: w.value
128
+ };
129
+ U.value = f;
130
+ }
131
+ function ue(f) {
132
+ const o = {
133
+ mode: Oe.UPDATE,
134
+ modelValue: ke(f),
135
+ show: !0,
136
+ "onUpdate:show"(g) {
137
+ U.value.show = g;
138
+ },
139
+ lastClosingDate: w.value
140
+ };
141
+ U.value = o;
142
+ }
143
+ async function B() {
144
+ $.value = [], v.value = !0;
145
+ try {
146
+ $.value = await l.getPurchaseOrders(u.value).then((g) => g.sort((R, P) => P._id.localeCompare(R._id)));
147
+ const f = await c.readLastClosing(!0), o = f == null ? void 0 : f._id;
148
+ o && (w.value = $e(o));
149
+ } catch {
150
+ O.open({
151
+ title: "Something went wrong",
152
+ message: "Error at fetching purchase orders",
153
+ type: "error"
154
+ });
155
+ } finally {
156
+ v.value = !1;
157
+ }
158
+ }
159
+ async function de() {
160
+ i.value = [], v.value = !0;
161
+ try {
162
+ i.value = await l.readRequests();
163
+ } catch {
164
+ O.open({
165
+ title: "Something went wrong",
166
+ message: "Error at fetching purchase requests",
167
+ type: "error"
168
+ });
169
+ } finally {
170
+ v.value = !1;
171
+ }
172
+ }
173
+ function Y() {
174
+ switch (a) {
175
+ case "receive/request":
176
+ return B();
177
+ case "approval":
178
+ return de();
179
+ }
180
+ }
181
+ function r(f, o) {
182
+ L.value = {
183
+ startDate: f,
184
+ endDate: o
185
+ }, Y();
186
+ }
187
+ t.watchLocation(async (f) => {
188
+ if (!f) {
189
+ $.value = [];
190
+ return;
191
+ }
192
+ await Y();
193
+ });
194
+ const n = F(), q = F(Math.random().toString());
195
+ async function D(f, o) {
196
+ var A, N;
197
+ const g = Math.random().toString();
198
+ q.value = g;
199
+ const R = a === "receive/request" ? t.currentLocation : o == null ? void 0 : o.to, P = {
200
+ purchaseOrder: f,
201
+ transferTo: R == null ? void 0 : R.name,
202
+ transferToDbName: R == null ? void 0 : R.dbName,
203
+ show: !0,
204
+ canResubmit: !1,
205
+ canApprove: a === "approval",
206
+ "onUpdate:show"(M) {
207
+ n.value.show = M;
208
+ }
209
+ };
210
+ if (n.value = P, !(o || f.status !== T.enum.REQUESTING)) {
211
+ try {
212
+ o = (await l.readRequests(
213
+ `${f.supplier.internal}_${f.supplier._id}`
214
+ )).find((V) => V.purchaseOrderId === f._id);
215
+ } catch {
216
+ console.error("Error at fetching po request to check");
217
+ }
218
+ g === q.value && (n.value.canResubmit = !o, n.value.transferTo = (A = o == null ? void 0 : o.to) == null ? void 0 : A.name, n.value.transferToDbName = (N = o == null ? void 0 : o.to) == null ? void 0 : N.dbName);
219
+ }
220
+ }
221
+ async function J(f, o, g, R) {
222
+ v.value = !0;
223
+ try {
224
+ await l.processPurchaseOrder(
225
+ {
226
+ operation: o,
227
+ doc: f,
228
+ options: (
229
+ // auto receive for supplier to warehouse
230
+ (o === b.enum.confirmDraft || // auto receive for warehouse to warehouse
231
+ o === b.enum.completeReceive) && _.autoReceiveWarehouse ? {
232
+ autoReceive: !0
233
+ } : void 0
234
+ )
235
+ },
236
+ R
237
+ ), await new Promise((N) => setTimeout(N, 1e3));
238
+ const A = ne().currentLocationDBName.startsWith("restaurant_");
239
+ o === b.enum.confirmDraft && f.effectiveAt && A ? O.open({
240
+ title: "Success",
241
+ message: `${g}. The backdate will be reflected once your POS has received this change.`,
242
+ type: "success"
243
+ }) : O.open({
244
+ title: "Success",
245
+ message: g,
246
+ type: "success"
247
+ });
248
+ } catch (P) {
249
+ O.open({
250
+ title: "Something went wrong",
251
+ message: "Please try again.",
252
+ type: "error"
253
+ }), console.error("Error when submitting PO operation", o, f, P);
254
+ } finally {
255
+ v.value = !1, Y();
256
+ }
257
+ }
258
+ async function z(f, o, g) {
259
+ const R = Te[o];
260
+ if (!R) {
261
+ O.open({
262
+ title: "Something went wrong",
263
+ message: `Cannot process order: ${Ae(o)}`,
264
+ type: "error"
265
+ });
266
+ return;
267
+ }
268
+ const { successMessage: P, ...A } = R;
269
+ p.open({
270
+ title: A.title,
271
+ message: A.message,
272
+ primaryActions: A.primaryActions
273
+ }).onPrimary(() => {
274
+ J(f, o, P, g);
275
+ });
276
+ }
277
+ return {
278
+ purchaseOrders: $,
279
+ purchaseRequests: i,
280
+ updateDateRange: r,
281
+ fetchData: Y,
282
+ loading: v,
283
+ transferDialogProps: U,
284
+ promptCreateTransferDialog: G,
285
+ promptUpdateTransferDialog: ue,
286
+ transferDetailsProps: n,
287
+ promptShowTransferDetails: D,
288
+ submitAction: z
289
+ };
290
+ }
291
+ function Ye(a, m) {
292
+ return m.reduce(
293
+ (t, _) => {
294
+ const v = _.received.find((O) => O.sku._id === a._id);
295
+ return v && (t = Ce(t, v.amount)), t;
296
+ },
297
+ ze.toPrecision(fe(0), a.unit.precision)
298
+ );
299
+ }
300
+ function pe(a, m, p) {
301
+ const t = (p == null ? void 0 : p.abbrev) ?? m.abbrev;
302
+ return `${le(a, !1)} ${t}`;
303
+ }
304
+ function We(a, m) {
305
+ const { name: p, address: t, regNo: _ } = m.doc.profile, v = {
306
+ name: p,
307
+ registrationNumber: _,
308
+ line1: t == null ? void 0 : t.line1,
309
+ line2: t == null ? void 0 : t.line2,
310
+ postcode: t == null ? void 0 : t.postcode,
311
+ city: t == null ? void 0 : t.city,
312
+ state: t == null ? void 0 : t.state,
313
+ country: t == null ? void 0 : t.country
314
+ }, O = {
315
+ name: a.supplier.name,
316
+ registrationNumber: a.supplier.registrationNumber,
317
+ line1: a.supplier.address.line1,
318
+ line2: a.supplier.address.line2,
319
+ postcode: a.supplier.address.postcode,
320
+ city: a.supplier.address.city,
321
+ state: a.supplier.address.state,
322
+ country: a.supplier.address.country
323
+ }, l = a.items.map((i) => {
324
+ const { sku: c, measurement: w } = i, U = le(
325
+ Ye(i.sku, a.deliveryOrder || []),
326
+ !1
327
+ );
328
+ return {
329
+ code: c.code,
330
+ description: c.name,
331
+ quantity: pe(i.quantity, c.unit, i.measurement),
332
+ unit: (w == null ? void 0 : w.abbrev) || c.unit.abbrev,
333
+ received: U
334
+ };
335
+ }), $ = a.deliveryOrder.map((i) => ({
336
+ createdAt: ce(new Date(i.createdAt)),
337
+ ref: i.deliveryOrderNumber,
338
+ remark: i.remark || "",
339
+ items: i.received.map((c) => {
340
+ var w;
341
+ return {
342
+ code: c.sku.code,
343
+ description: c.sku.name,
344
+ quantity: le(c.amount),
345
+ unit: ((w = c.measurement) == null ? void 0 : w.abbrev) || c.sku.unit.abbrev
346
+ };
347
+ })
348
+ })), L = {
349
+ orderNumber: a.seqNumber.toString(),
350
+ createdAt: ie(a._id),
351
+ ref: a.ref || "",
352
+ remark: a.remark || "",
353
+ buyer: v,
354
+ supplier: O,
355
+ items: l,
356
+ status: a.status,
357
+ deliveryOrders: $
358
+ }, u = new URL(window.location.href);
359
+ u.pathname = "/receive-request/print-preview", u.searchParams.append("data", JSON.stringify(L)), window.open(u.href, "_blank", "noreferrer");
360
+ }
361
+ const W = {
362
+ submitRequest: {
363
+ label: "Submit request",
364
+ color: "text-fm-color-typo-primary",
365
+ value: b.enum.submitRequest
366
+ },
367
+ confirmDraft: {
368
+ label: "Confirm draft",
369
+ color: "text-fm-color-typo-primary",
370
+ value: b.enum.confirmDraft
371
+ },
372
+ cancelDraft: {
373
+ label: "Cancel draft",
374
+ color: "text-fm-color-typo-error",
375
+ value: b.enum.cancelDraft
376
+ },
377
+ approveRequest: {
378
+ label: "Approve",
379
+ color: "text-fm-color-typo-primary",
380
+ value: b.enum.approveRequest
381
+ },
382
+ rejectRequest: {
383
+ label: "Reject",
384
+ color: "text-fm-color-typo-error",
385
+ value: b.enum.rejectRequest
386
+ },
387
+ processRequest: {
388
+ label: "Process",
389
+ color: "text-fm-color-typo-primary",
390
+ value: b.enum.processRequest
391
+ },
392
+ receiveStock: {
393
+ label: "Receive Stock",
394
+ color: "text-fm-color-typo-primary",
395
+ value: b.enum.receiveStock
396
+ },
397
+ completeReceive: {
398
+ label: "Mark completed",
399
+ color: "text-fm-color-typo-primary",
400
+ value: b.enum.completeReceive
401
+ }
402
+ };
403
+ function wr(a, m) {
404
+ const p = ne(), { t } = Ne();
405
+ function _(u) {
406
+ switch (u.status) {
407
+ case "DRAFT":
408
+ return [
409
+ u.supplier.internal === "restaurant" || u.supplier.internal === "warehouse" ? W[b.enum.submitRequest] : W[b.enum.confirmDraft],
410
+ W[b.enum.cancelDraft],
411
+ C[k.Update],
412
+ C[k.Details],
413
+ C[k.Print]
414
+ ];
415
+ case "RECEIVING":
416
+ return [
417
+ W[b.enum.completeReceive],
418
+ C[k.Update],
419
+ C[k.Details],
420
+ C[k.Print]
421
+ ];
422
+ case "REQUESTING":
423
+ return a === "receive/request" ? [
424
+ C[k.Update],
425
+ C[k.Details],
426
+ C[k.Print]
427
+ ] : [
428
+ W[b.enum.approveRequest],
429
+ W[b.enum.rejectRequest],
430
+ C[k.Details],
431
+ C[k.Print]
432
+ ];
433
+ case "PROCESSING":
434
+ return [C[k.Details], C[k.Print]];
435
+ case "COMPLETE":
436
+ case "CANCEL":
437
+ default:
438
+ return [
439
+ C[k.Update],
440
+ C[k.Details],
441
+ C[k.Print]
442
+ ];
443
+ }
444
+ }
445
+ function v(u) {
446
+ return Object.values(b.enum).includes(u);
447
+ }
448
+ async function O(u, i, c) {
449
+ var U, G;
450
+ const w = ke(i);
451
+ if (u === k.Print) {
452
+ We(w, p.currentLocation);
453
+ return;
454
+ }
455
+ if (u === k.Details) {
456
+ m.promptShowTransferDetails(w, c);
457
+ return;
458
+ }
459
+ if (u === k.Update) {
460
+ (U = m.promptUpdateTransferDialog) == null || U.call(m, w);
461
+ return;
462
+ }
463
+ if (v(u)) {
464
+ m.submitAction(i, u, (G = c == null ? void 0 : c.to) == null ? void 0 : G.dbName);
465
+ return;
466
+ }
467
+ }
468
+ function l() {
469
+ return [
470
+ {
471
+ accessorKey: "seqNumber",
472
+ header: () => t("inventory.transfer.table.seqNo"),
473
+ enableSorting: !0,
474
+ size: 80,
475
+ sortUndefined: "last"
476
+ },
477
+ {
478
+ accessorKey: "_id",
479
+ header: () => t("inventory.transfer.table.createdAt"),
480
+ cell(u) {
481
+ return ie(`${u.getValue()}`);
482
+ },
483
+ enableSorting: !0
484
+ },
485
+ {
486
+ accessorKey: "supplier.name",
487
+ header: () => t("inventory.transfer.table.transferFrom"),
488
+ enableSorting: !0,
489
+ size: 200
490
+ },
491
+ {
492
+ accessorKey: "items.length",
493
+ header: () => t("inventory.transfer.table.noOfItems"),
494
+ enableSorting: !1,
495
+ meta: {
496
+ width: "10rem"
497
+ }
498
+ },
499
+ {
500
+ accessorKey: "ref",
501
+ header: () => t("inventory.transfer.table.reference"),
502
+ enableSorting: !1,
503
+ size: "auto"
504
+ },
505
+ {
506
+ accessorKey: "status",
507
+ header: () => t("inventory.transfer.table.status"),
508
+ cell(u) {
509
+ const i = t(`inventory.transfer.status.${u.getValue() ?? ""}`), c = `${u.getValue() ?? ""}`.toLocaleLowerCase("en-us");
510
+ return Re(De.FmChip, {
511
+ label: i,
512
+ class: `fm-status-badge fm-status-badge-${c}`,
513
+ compact: !0
514
+ });
515
+ },
516
+ enableSorting: !0,
517
+ size: 200
518
+ },
519
+ {
520
+ id: "action",
521
+ cell(u) {
522
+ const i = u.row.original, c = _(i);
523
+ return Se(c, (w) => O(w, i));
524
+ },
525
+ enableSorting: !1,
526
+ size: 40,
527
+ meta: {
528
+ cellClass: "",
529
+ headerClass: ""
530
+ }
531
+ }
532
+ ];
533
+ }
534
+ function $() {
535
+ return [
536
+ {
537
+ accessorKey: "purchaseOrder.seqNumber",
538
+ header: () => t("inventory.transfer.table.seqNo"),
539
+ enableSorting: !0,
540
+ size: 80,
541
+ sortUndefined: "last"
542
+ },
543
+ {
544
+ accessorKey: "purchaseOrder._id",
545
+ header: () => t("inventory.transfer.table.createdAt"),
546
+ cell(u) {
547
+ return ie(`${u.getValue()}`);
548
+ },
549
+ enableSorting: !0
550
+ },
551
+ {
552
+ accessorKey: "to.name",
553
+ header: () => t("inventory.transfer.table.transferTo"),
554
+ enableSorting: !1,
555
+ size: 200
556
+ },
557
+ {
558
+ accessorKey: "purchaseOrder.items.length",
559
+ header: () => t("inventory.transfer.table.noOfItems"),
560
+ enableSorting: !1
561
+ },
562
+ {
563
+ accessorKey: "purchaseOrder.ref",
564
+ header: () => t("inventory.transfer.table.reference"),
565
+ enableSorting: !1,
566
+ size: "auto"
567
+ },
568
+ {
569
+ accessorKey: "purchaseOrder.status",
570
+ header: () => t("inventory.transfer.table.status"),
571
+ cell(u) {
572
+ const i = t(`inventory.transfer.status.${u.getValue() ?? ""}`), c = `${u.getValue() ?? ""}`.toLocaleLowerCase("en-us");
573
+ return Re(De.FmChip, {
574
+ label: i,
575
+ class: `fm-status-badge fm-status-badge-${c}`,
576
+ compact: !0
577
+ });
578
+ },
579
+ enableSorting: !0
580
+ },
581
+ {
582
+ id: "action",
583
+ cell(u) {
584
+ const i = u.row.original, c = i.purchaseOrder ? _(i.purchaseOrder) : [];
585
+ return Se(
586
+ c,
587
+ (w) => i.purchaseOrder ? O(w, i.purchaseOrder, i) : void 0
588
+ );
589
+ },
590
+ enableSorting: !1,
591
+ size: 40,
592
+ meta: {
593
+ cellClass: "",
594
+ headerClass: ""
595
+ }
596
+ }
597
+ ];
598
+ }
599
+ const L = se(() => a === "receive/request" ? l() : $());
600
+ return {
601
+ get columnDefs() {
602
+ return L.value;
603
+ }
604
+ };
605
+ }
606
+ var re = /* @__PURE__ */ ((a) => (a.PURCHASE = "PURCHASE", a.TRANSFER = "TRANSFER", a))(re || {});
607
+ const Je = { class: "flex flex-col gap-16 w-full h-full" }, Ze = { class: "xs:w-screen max-w-full" }, Xe = { class: "flex justify-between" }, et = { class: "fm-typo-en-body-lg-600" }, tt = { class: "flex flex-col gap-8" }, rt = { class: "flex flex-col gap-4" }, st = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, at = { class: "flex gap-1" }, ot = { class: "fm-typo-en-body-lg-600" }, nt = {
608
+ key: 0,
609
+ class: "flex flex-col gap-4"
610
+ }, ct = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, lt = { class: "fm-typo-en-body-lg-600" }, it = { class: "flex flex-col gap-4" }, ut = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, dt = { class: "fm-typo-en-body-lg-600" }, mt = {
611
+ key: 1,
612
+ class: "flex flex-col gap-4"
613
+ }, ft = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, pt = { class: "fm-typo-en-body-lg-600" }, vt = {
614
+ key: 2,
615
+ class: "flex flex-col gap-4"
616
+ }, yt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ht = { class: "fm-typo-en-body-lg-600" }, bt = {
617
+ key: 3,
618
+ class: "flex flex-col gap-4"
619
+ }, gt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, _t = { class: "fm-typo-en-body-lg-600" }, wt = {
620
+ key: 4,
621
+ class: "flex flex-col gap-4"
622
+ }, Rt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ot = { class: "fm-typo-en-body-lg-600" }, Dt = { class: "border border-fm-color-neutral-gray-200 fm-corner-radius-lg p-16" }, St = { class: "flex flex-col gap-8" }, kt = { class: "fm-typo-en-body-lg-600" }, At = { class: "flex w-full gap-4" }, xt = { class: "grow fm-typo-en-body-lg-400 line-clamp-2" }, Ct = /* @__PURE__ */ e("div", { class: "flex-1 min-w-32" }, null, -1), Pt = { class: "fm-typo-en-body-lg-600 shrink-0" }, qt = { class: "flex w-full gap-4 fm-typo-en-body-sm-400" }, Nt = { class: "grow fm-typo-en-body-lg-400 text-fm-color-typo-secondary line-clamp-2" }, Et = {
623
+ key: 0,
624
+ class: "shrink-0 fm-typo-en-body-lg-400 text-fm-color-typo-secondary"
625
+ }, Tt = {
626
+ key: 1,
627
+ class: "flex-1 xs:w-screen xs:max-w-full"
628
+ }, $t = {
629
+ key: 0,
630
+ class: "flex flex-col items-center gap-8 h-full"
631
+ }, Ut = ["src"], Mt = { class: "fm-typo-en-body-lg-600" }, Ft = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary px-16" }, It = {
632
+ key: 1,
633
+ class: "px-4 flex flex-col"
634
+ }, Lt = { class: "flex gap-12 content-stretch" }, jt = {
635
+ class: "flex flex-col w-24",
636
+ name: "circles"
637
+ }, Bt = { class: "flex-1 flex flex-col items-center" }, Vt = /* @__PURE__ */ e("div", { class: "h-24 w-24 bg-fm-color-primary rounded-full" }, null, -1), Ht = { class: "flex-1 flex flex-col items-center" }, Gt = {
638
+ class: "py-12 flex flex-col gap-4",
639
+ name: "received-at header"
640
+ }, Kt = { class: "fm-typo-en-body-lg-400" }, zt = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, Qt = { class: "flex gap-12 content-stretch" }, Yt = {
641
+ class: "flex flex-col w-24",
642
+ name: "circles"
643
+ }, Wt = { class: "flex-1 flex flex-col items-center" }, Jt = {
644
+ class: "py-12 flex flex-col gap-4 flex-1",
645
+ name: "delivery details"
646
+ }, Zt = { class: "flex flex-col gap-8" }, Xt = { class: "flex flex-col gap-4" }, er = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, tr = { class: "fm-typo-en-body-lg-600" }, rr = { class: "flex flex-col gap-4" }, sr = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, ar = { class: "flex flex-col gap-4" }, or = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, nr = { class: "fm-typo-en-body-lg-600" }, cr = { class: "flex flex-col gap-4" }, lr = {
647
+ key: 0,
648
+ class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary"
649
+ }, ir = { class: "fm-typo-en-body-lg-600" }, ur = { class: "flex gap-8 xs:flex-col" }, Rr = /* @__PURE__ */ Ue({
650
+ __name: "TransferDetails",
651
+ props: {
652
+ purchaseOrder: {},
653
+ transferTo: {},
654
+ transferToDbName: {},
655
+ show: { type: Boolean },
656
+ canResubmit: { type: Boolean },
657
+ canApprove: { type: Boolean }
658
+ },
659
+ emits: ["update:show", "submitted"],
660
+ setup(a, { emit: m }) {
661
+ const p = a, t = m, _ = Pe(), v = qe(), O = xe(), { t: l } = Ne(), $ = se(
662
+ () => {
663
+ var r, n, q, D;
664
+ return ((n = (r = p.purchaseOrder) == null ? void 0 : r.supplier) == null ? void 0 : n.internal) === "restaurant" || ((D = (q = p.purchaseOrder) == null ? void 0 : q.supplier) == null ? void 0 : D.internal) === "warehouse" ? re.TRANSFER : re.PURCHASE;
665
+ }
666
+ ), L = [
667
+ {
668
+ label: l("inventory.transfer.receiveRequest.details.overview"),
669
+ value: "overview"
670
+ },
671
+ {
672
+ label: l("inventory.transfer.receiveRequest.details.deliveryHistory"),
673
+ value: "deliveryHistory"
674
+ }
675
+ ], u = F(L[0]), i = F(!1), c = F(""), w = F(!0), U = Ee(), G = Ke(p, "show");
676
+ async function ue(r, n, q) {
677
+ c.value = n, i.value = !0, w.value = !1;
678
+ try {
679
+ await U.processPurchaseOrder(
680
+ {
681
+ operation: n,
682
+ doc: r,
683
+ options: (
684
+ // auto receive for supplier to warehouse
685
+ (n === b.enum.confirmDraft || // auto receive for warehouse to warehouse
686
+ n === b.enum.completeReceive) && O.autoReceiveWarehouse ? {
687
+ autoReceive: !0
688
+ } : void 0
689
+ )
690
+ },
691
+ p.transferToDbName
692
+ ), await new Promise((D) => setTimeout(D, 1e3)), v.open({
693
+ title: "Success",
694
+ message: q,
695
+ type: "success"
696
+ }), t("update:show", !1), t("submitted");
697
+ } catch (D) {
698
+ v.open({
699
+ title: "Something went wrong",
700
+ message: "Please try again.",
701
+ type: "error"
702
+ }), console.error("Error when submitting PO operation", n, r, D);
703
+ } finally {
704
+ c.value = "", i.value = !1, w.value = !0;
705
+ }
706
+ }
707
+ async function B(r) {
708
+ const n = Te[r];
709
+ if (!n) {
710
+ v.open({
711
+ title: "Something went wrong",
712
+ message: `Cannot process order: ${Ae(r)}`,
713
+ type: "error"
714
+ });
715
+ return;
716
+ }
717
+ const { successMessage: q, ...D } = n;
718
+ _.open({
719
+ title: D.title,
720
+ message: D.message,
721
+ primaryActions: D.primaryActions
722
+ }).onPrimary(() => {
723
+ p.purchaseOrder && ue(p.purchaseOrder, r, q);
724
+ });
725
+ }
726
+ const de = se(() => {
727
+ var r, n;
728
+ return ((r = p.purchaseOrder) == null ? void 0 : r.status) === T.enum.RECEIVING || ((n = p.purchaseOrder) == null ? void 0 : n.status) === T.enum.COMPLETE;
729
+ }), Y = se(() => {
730
+ var z, f, o;
731
+ const q = (((z = p.purchaseOrder) == null ? void 0 : z.deliveryOrder) ?? []).flatMap((g) => g.received ?? []).reduce(
732
+ (g, R) => {
733
+ const P = g[R.sku._id] ?? [];
734
+ return g[R.sku._id] = [...P, R], g;
735
+ },
736
+ {}
737
+ ), D = Object.entries(q).reduce(
738
+ (g, [R, P]) => {
739
+ const A = P.reduce((N, M) => {
740
+ const V = Ve(
741
+ N,
742
+ Math.max(N.precision, M.amount.precision)
743
+ );
744
+ return Ce(V, M.amount);
745
+ }, fe(0));
746
+ return g[R] = A, g;
747
+ },
748
+ {}
749
+ ), J = ((f = p.purchaseOrder) == null ? void 0 : f.items) ?? [];
750
+ for (const g of J)
751
+ D[o = g.sku._id] ?? (D[o] = fe(0));
752
+ return D;
753
+ });
754
+ return (r, n) => {
755
+ var R, P;
756
+ const q = Q("FmButtonGroup"), D = Q("FmChip"), J = Q("FmMenuDivider"), z = Q("FmCard"), f = Q("FmSpacer"), o = Q("FmButton"), g = Q("FmSideSheet");
757
+ return h(), H(g, {
758
+ header: s(l)("inventory.transfer.receiveRequest.details.title") + ((R = r.purchaseOrder) != null && R.seqNumber ? ` #${(P = r.purchaseOrder) == null ? void 0 : P.seqNumber}` : ""),
759
+ modelValue: s(G),
760
+ "onUpdate:modelValue": n[9] || (n[9] = (A) => Me(G) ? G.value = A : null),
761
+ "dismiss-away": w.value,
762
+ "close-button": "",
763
+ "max-width": 500
764
+ }, {
765
+ default: ae(() => {
766
+ var A, N, M, V, Z, X;
767
+ return [
768
+ e("div", Je, [
769
+ e("div", null, [
770
+ K(q, {
771
+ items: L,
772
+ modelValue: u.value,
773
+ "onUpdate:modelValue": n[0] || (n[0] = (y) => u.value = y)
774
+ }, null, 8, ["modelValue"])
775
+ ]),
776
+ u.value.value === "overview" ? (h(), x(te, { key: 0 }, [
777
+ e("div", Ze, [
778
+ K(z, {
779
+ variant: "outlined",
780
+ class: "flex flex-col gap-8 px-12 py-16"
781
+ }, {
782
+ default: ae(() => {
783
+ var y, E, I, ee, j, ve, ye, he, be, ge, _e, we;
784
+ return [
785
+ e("div", Xe, [
786
+ e("div", et, d(s(l)("inventory.transfer.receiveRequest.details.requestSummary")), 1),
787
+ e("div", null, [
788
+ K(D, {
789
+ label: s(l)(`inventory.transfer.status.${(y = r.purchaseOrder) == null ? void 0 : y.status}`),
790
+ class: oe(`fm-status-badge fm-status-badge-${(I = (E = r.purchaseOrder) == null ? void 0 : E.status) == null ? void 0 : I.toLocaleLowerCase("en-us")}`),
791
+ compact: ""
792
+ }, null, 8, ["label", "class"])
793
+ ])
794
+ ]),
795
+ K(J),
796
+ e("div", tt, [
797
+ e("div", rt, [
798
+ e("div", st, [
799
+ e("div", at, d(s(l)("inventory.transfer.receiveRequest.details.createdAt")), 1)
800
+ ]),
801
+ e("div", ot, d(s(ie)(((ee = r.purchaseOrder) == null ? void 0 : ee._id) ?? "")), 1)
802
+ ]),
803
+ (j = r.purchaseOrder) != null && j.effectiveAt ? (h(), x("div", nt, [
804
+ e("div", ct, d(s(l)("inventory.transfer.receiveRequest.details.backdatedTo")), 1),
805
+ e("div", lt, d(s(ce)(new Date((ve = r.purchaseOrder) == null ? void 0 : ve.effectiveAt))), 1)
806
+ ])) : S("", !0),
807
+ e("div", it, [
808
+ e("div", ut, d(s(l)("inventory.transfer.receiveRequest.details.type.title")), 1),
809
+ e("div", dt, d(s(l)(
810
+ `inventory.transfer.receiveRequest.details.type.${$.value.toLocaleLowerCase("en-US")}`
811
+ )), 1)
812
+ ]),
813
+ (he = (ye = r.purchaseOrder) == null ? void 0 : ye.supplier) != null && he.name ? (h(), x("div", mt, [
814
+ e("div", ft, d(s(l)("inventory.transfer.receiveRequest.details.from")), 1),
815
+ e("div", pt, d((ge = (be = r.purchaseOrder) == null ? void 0 : be.supplier) == null ? void 0 : ge.name), 1)
816
+ ])) : S("", !0),
817
+ r.transferTo ? (h(), x("div", vt, [
818
+ e("div", yt, d(s(l)("inventory.transfer.receiveRequest.details.to")), 1),
819
+ e("div", ht, d(r.transferTo), 1)
820
+ ])) : S("", !0),
821
+ (_e = r.purchaseOrder) != null && _e.ref ? (h(), x("div", bt, [
822
+ e("div", gt, d(s(l)("inventory.transfer.receiveRequest.details.reference")), 1),
823
+ e("div", _t, d(r.purchaseOrder.ref), 1)
824
+ ])) : S("", !0),
825
+ (we = r.purchaseOrder) != null && we.remark ? (h(), x("div", wt, [
826
+ e("div", Rt, d(s(l)("inventory.transfer.receiveRequest.details.remark")), 1),
827
+ e("div", Ot, d(r.purchaseOrder.remark), 1)
828
+ ])) : S("", !0)
829
+ ])
830
+ ];
831
+ }),
832
+ _: 1
833
+ })
834
+ ]),
835
+ e("div", Dt, [
836
+ e("div", St, [
837
+ e("div", kt, d(de.value ? s(l)("inventory.transfer.receiveRequest.details.receivedItems") : s(l)("inventory.transfer.receiveRequest.details.requestedItems")), 1),
838
+ (h(!0), x(te, null, me(((A = r.purchaseOrder) == null ? void 0 : A.items) ?? [], (y) => (h(), x("div", {
839
+ key: y.code,
840
+ class: "flex flex-col"
841
+ }, [
842
+ e("div", At, [
843
+ e("div", xt, d(y.name), 1),
844
+ Ct,
845
+ e("div", Pt, d(s(le)(Y.value[y.sku._id], !1)) + "/" + d(s(pe)(y.quantity, y.sku.unit, y.measurement)), 1)
846
+ ]),
847
+ e("div", qt, [
848
+ e("div", Nt, d(y.code), 1),
849
+ y.totalCost && s(O).enableTotalCost ? (h(), x("div", Et, " (" + d(s(He)(y.totalCost)) + ") ", 1)) : S("", !0)
850
+ ])
851
+ ]))), 128))
852
+ ])
853
+ ])
854
+ ], 64)) : S("", !0),
855
+ u.value.value === "deliveryHistory" ? (h(), x("div", Tt, [
856
+ ((M = (N = r.purchaseOrder) == null ? void 0 : N.deliveryOrder) == null ? void 0 : M.length) === 0 ? (h(), x("div", $t, [
857
+ K(f),
858
+ e("div", null, [
859
+ e("img", {
860
+ src: s(Qe),
861
+ alt: "List is empty"
862
+ }, null, 8, Ut)
863
+ ]),
864
+ e("div", Mt, d(s(l)("inventory.transfer.receiveRequest.details.noRecordsFound")), 1),
865
+ e("div", Ft, d(s(l)("inventory.transfer.receiveRequest.details.trackDeliveryMessage")), 1),
866
+ K(f),
867
+ K(f)
868
+ ])) : S("", !0),
869
+ (V = r.purchaseOrder) != null && V.deliveryOrder && ((Z = r.purchaseOrder) == null ? void 0 : Z.deliveryOrder.length) > 0 ? (h(), x("div", It, [
870
+ (h(!0), x(te, null, me((X = r.purchaseOrder) == null ? void 0 : X.deliveryOrder, (y, E) => (h(), x(te, { key: E }, [
871
+ e("div", Lt, [
872
+ e("div", jt, [
873
+ e("div", Bt, [
874
+ e("div", {
875
+ class: oe([
876
+ {
877
+ "bg-fm-color-primary": E !== 0,
878
+ "bg-white": E === 0
879
+ },
880
+ "w-[2px] h-full"
881
+ ])
882
+ }, null, 2)
883
+ ]),
884
+ Vt,
885
+ e("div", Ht, [
886
+ e("div", {
887
+ class: oe([
888
+ {
889
+ "bg-fm-color-primary": E < r.purchaseOrder.deliveryOrder.length - 1,
890
+ "bg-white": E >= r.purchaseOrder.deliveryOrder.length - 1
891
+ },
892
+ "w-[2px] h-full"
893
+ ])
894
+ }, null, 2)
895
+ ])
896
+ ]),
897
+ e("div", Gt, [
898
+ e("div", Kt, d(s(l)("inventory.transfer.receiveRequest.details.received")), 1),
899
+ e("div", zt, d(s(ce)(new Date(y.createdAt))) + ", " + d(s(Ge)(new Date(y.createdAt))), 1)
900
+ ])
901
+ ]),
902
+ e("div", Qt, [
903
+ e("div", Yt, [
904
+ e("div", Wt, [
905
+ e("div", {
906
+ class: oe([
907
+ {
908
+ "bg-fm-color-primary": E < r.purchaseOrder.deliveryOrder.length - 1,
909
+ "bg-white": E >= r.purchaseOrder.deliveryOrder.length - 1
910
+ },
911
+ "w-[2px] h-full"
912
+ ])
913
+ }, null, 2)
914
+ ])
915
+ ]),
916
+ e("div", Jt, [
917
+ K(z, {
918
+ variant: "outlined",
919
+ class: "py-12 px-16"
920
+ }, {
921
+ default: ae(() => [
922
+ e("div", Zt, [
923
+ e("div", Xt, [
924
+ e("div", er, d(s(l)("inventory.transfer.receiveRequest.details.receivedBy")), 1),
925
+ e("div", tr, d(y.createdBy.name), 1)
926
+ ]),
927
+ e("div", rr, [
928
+ e("div", sr, d(s(l)("inventory.transfer.receiveRequest.details.receivedItems")), 1),
929
+ (h(!0), x(te, null, me(y.received, (I) => (h(), x("div", {
930
+ class: "fm-typo-en-body-lg-600",
931
+ key: I.sku._id
932
+ }, d(I.sku.name) + " " + d(s(pe)(I.amount, I.sku.unit, I.measurement)), 1))), 128))
933
+ ]),
934
+ e("div", ar, [
935
+ e("div", or, d(s(l)("inventory.transfer.receiveRequest.details.deliveryOrderNo")), 1),
936
+ e("div", nr, d(y.deliveryOrderNumber.trim().length ? y.deliveryOrderNumber : "-"), 1)
937
+ ]),
938
+ e("div", cr, [
939
+ y.remark ? (h(), x("div", lr, d(s(l)("inventory.transfer.receiveRequest.details.deliveryRemark")), 1)) : S("", !0),
940
+ e("div", ir, d(y.remark), 1)
941
+ ])
942
+ ])
943
+ ]),
944
+ _: 2
945
+ }, 1024)
946
+ ])
947
+ ])
948
+ ], 64))), 128))
949
+ ])) : S("", !0)
950
+ ])) : S("", !0)
951
+ ])
952
+ ];
953
+ }),
954
+ "side-sheet-footer": ae(() => {
955
+ var A, N, M, V, Z, X, y, E, I, ee;
956
+ return [
957
+ e("div", ur, [
958
+ ((A = r.purchaseOrder) == null ? void 0 : A.status) === s(T).enum.DRAFT && $.value === s(re).PURCHASE ? (h(), H(o, {
959
+ key: 0,
960
+ label: s(l)("inventory.transfer.receiveRequest.actions.confirmDraft"),
961
+ onClick: n[1] || (n[1] = (j) => B("confirmDraft")),
962
+ loading: c.value === "confirmDraft",
963
+ disabled: c.value !== "confirmDraft" && i.value
964
+ }, null, 8, ["label", "loading", "disabled"])) : S("", !0),
965
+ ((N = r.purchaseOrder) == null ? void 0 : N.status) === s(T).enum.DRAFT && $.value === s(re).TRANSFER ? (h(), H(o, {
966
+ key: 1,
967
+ label: s(l)("inventory.transfer.receiveRequest.actions.submitRequest"),
968
+ onClick: n[2] || (n[2] = (j) => B("submitRequest")),
969
+ loading: c.value === "submitRequest",
970
+ disabled: c.value !== "submitRequest" && i.value
971
+ }, null, 8, ["label", "loading", "disabled"])) : S("", !0),
972
+ ((M = r.purchaseOrder) == null ? void 0 : M.status) === s(T).enum.DRAFT ? (h(), H(o, {
973
+ key: 2,
974
+ label: s(l)("inventory.transfer.receiveRequest.actions.cancelDraft"),
975
+ onClick: n[3] || (n[3] = (j) => B("cancelDraft")),
976
+ loading: c.value === "cancelDraft",
977
+ disabled: c.value !== "cancelDraft" && i.value,
978
+ variant: "destructive"
979
+ }, null, 8, ["label", "loading", "disabled"])) : S("", !0),
980
+ ((V = r.purchaseOrder) == null ? void 0 : V.status) === s(T).enum.RECEIVING ? (h(), H(o, {
981
+ key: 3,
982
+ label: s(l)("inventory.transfer.receiveRequest.actions.completeReceive"),
983
+ onClick: n[4] || (n[4] = (j) => B("completeReceive")),
984
+ loading: c.value === "completeReceive",
985
+ disabled: c.value !== "completeReceive" && i.value
986
+ }, null, 8, ["label", "loading", "disabled"])) : S("", !0),
987
+ r.canResubmit ? (h(), H(o, {
988
+ key: 4,
989
+ label: s(l)("inventory.transfer.receiveRequest.actions.resubmitRequest"),
990
+ onClick: n[5] || (n[5] = (j) => B("submitRequest")),
991
+ loading: c.value === "submitRequest",
992
+ disabled: c.value !== "submitRequest" && i.value
993
+ }, null, 8, ["label", "loading", "disabled"])) : S("", !0),
994
+ (((Z = r.purchaseOrder) == null ? void 0 : Z.status) === s(T).enum.REQUESTING || ((X = r.purchaseOrder) == null ? void 0 : X.status) === s(T).enum.PROCESSING) && r.canApprove ? (h(), H(o, {
995
+ key: 5,
996
+ label: s(l)("inventory.transfer.approval.actions.approveRequest"),
997
+ onClick: n[6] || (n[6] = (j) => B("approveRequest")),
998
+ loading: c.value === "approveRequest",
999
+ disabled: c.value !== "approveRequest" && i.value
1000
+ }, null, 8, ["label", "loading", "disabled"])) : S("", !0),
1001
+ ((y = r.purchaseOrder) == null ? void 0 : y.status) === s(T).enum.REQUESTING && r.canApprove ? (h(), H(o, {
1002
+ key: 6,
1003
+ label: s(l)("inventory.transfer.approval.actions.rejectRequest"),
1004
+ onClick: n[7] || (n[7] = (j) => B("rejectRequest")),
1005
+ loading: c.value === "rejectRequest",
1006
+ disabled: c.value !== "rejectRequest" && i.value,
1007
+ variant: "destructive"
1008
+ }, null, 8, ["label", "loading", "disabled"])) : S("", !0),
1009
+ ((E = r.purchaseOrder) == null ? void 0 : E.status) !== s(T).enum.COMPLETE && ((I = r.purchaseOrder) == null ? void 0 : I.status) !== s(T).enum.CANCEL && (((ee = r.purchaseOrder) == null ? void 0 : ee.status) !== s(T).enum.REQUESTING || r.canApprove) ? (h(), H(o, {
1010
+ key: 7,
1011
+ label: s(l)("common.close"),
1012
+ variant: "tertiary",
1013
+ onClick: n[8] || (n[8] = (j) => t("update:show", !1))
1014
+ }, null, 8, ["label"])) : S("", !0)
1015
+ ])
1016
+ ];
1017
+ }),
1018
+ _: 1
1019
+ }, 8, ["header", "modelValue", "dismiss-away"]);
1020
+ };
1021
+ }
1022
+ });
1023
+ export {
1024
+ re as P,
1025
+ Rr as _,
1026
+ _r as a,
1027
+ wr as b,
1028
+ Ye as g,
1029
+ $e as p,
1030
+ Ee as u
1031
+ };