@feedmepos/mf-payment 0.0.0-beta.8 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. package/dist/AdminLayout.vue_vue_type_script_setup_true_lang-BTmMOzwx.js +39 -0
  2. package/dist/AsyncButton.vue_vue_type_script_setup_true_lang-DcjzvYwT.js +42 -0
  3. package/dist/AutoCopyCell.vue_vue_type_script_setup_true_lang-GXPXBEf5.js +40 -0
  4. package/dist/Modal-DB8M9o1T.js +13 -0
  5. package/dist/PayoutAccount-DZaKHWcy.js +612 -0
  6. package/dist/{PayoutAccount-CpatyqJa.js → PayoutAccount-Dc1CYQ0W.js} +38 -35
  7. package/dist/PayoutAccountSetting-BzmNuLFj.js +780 -0
  8. package/dist/RestaurantSelector.vue_vue_type_script_setup_true_lang-CY4ttpKj.js +33 -0
  9. package/dist/Settlement-Bx3zAkIw.js +195 -0
  10. package/dist/Settlement-mwnO-iYH.js +150 -0
  11. package/dist/{SettlementTransactions-DT1A_tI5.js → SettlementTransactions-AaYyTH96.js} +99 -105
  12. package/dist/{SettlementTransactions-CkU0gCHb.js → SettlementTransactions-D_SVuKyR.js} +117 -130
  13. package/dist/Terminal-68OQnhM3.js +372 -0
  14. package/dist/TerminalSetting-DEFim0xg.js +379 -0
  15. package/dist/TerminalTransaction-CQjNdffr.js +426 -0
  16. package/dist/TerminalTransaction-ClihmWOJ.js +250 -0
  17. package/dist/Transaction-68L7JzIk.js +242 -0
  18. package/dist/Transaction-a1VfiCP_.js +405 -0
  19. package/dist/api/index.d.ts +14 -0
  20. package/dist/api/pagination.d.ts +20 -0
  21. package/dist/api/payment-gateway/index.d.ts +9 -0
  22. package/dist/api/settlement/index.d.ts +12 -13
  23. package/dist/api/terminal/index.d.ts +13 -1
  24. package/dist/api/terminal-transaction/index.d.ts +12 -1
  25. package/dist/api/transaction/index.d.ts +7 -2
  26. package/dist/app-C9FRsUfb.js +6343 -0
  27. package/dist/app.js +3 -198
  28. package/dist/assets-Bji7O2YD.js +45 -0
  29. package/dist/clipboard-4jh1WteU.js +10 -0
  30. package/dist/components/AsyncButton.vue.d.ts +21 -0
  31. package/dist/components/AutoCopyCell.vue.d.ts +6 -0
  32. package/dist/components/CursorTable/index.vue.d.ts +24 -5
  33. package/dist/components/RestaurantSelector.vue.d.ts +2 -0
  34. package/dist/components/RouteCell.vue.d.ts +8 -0
  35. package/dist/helpers/assets.d.ts +2 -0
  36. package/dist/index-Bt_OgDYn.js +56107 -0
  37. package/dist/index-CLYePgWW.js +47 -0
  38. package/dist/{index-CF56zGyu.js → index-DBfZnaV1.js} +1 -1
  39. package/dist/index-DSuZG0l6.js +52 -0
  40. package/dist/{index-Bmka-1lQ.js → index-DjDGwRX8.js} +1 -1
  41. package/dist/index-_0TroOJr.js +127 -0
  42. package/dist/index.vue_vue_type_script_setup_true_lang-Jlcg1hAB.js +167 -0
  43. package/dist/model/transaction.d.ts +2 -1
  44. package/dist/package.json +4 -4
  45. package/dist/payout-account-BWcq7OJy.js +1805 -0
  46. package/dist/stores/payoutAccount.d.ts +4 -4
  47. package/dist/transaction-DqrhM5jB.js +87 -0
  48. package/dist/tsconfig.app.tsbuildinfo +1 -1
  49. package/dist/validator-D5jtpt9A.js +2877 -0
  50. package/dist/views/admin/payout-account/tabs/Information.vue.d.ts +4 -4
  51. package/dist/views/admin/payout-account/tabs/PaymentGateway.vue.d.ts +81 -0
  52. package/dist/views/admin/payout-account/tabs/PaymentStatus.vue.d.ts +4 -4
  53. package/dist/views/admin/payout-account/tabs/Settlement.vue.d.ts +4 -4
  54. package/dist/views/admin/payout-account/tabs/gateway/FiuuGateway.vue.d.ts +56 -0
  55. package/dist/views/admin/payout-account/tabs/gateway/GhlGateway.vue.d.ts +50 -0
  56. package/dist/views/admin/payout-account/tabs/gateway/RevenueMonsterGateway.vue.d.ts +52 -0
  57. package/dist/views/admin/settlement/SettlementTable.vue.d.ts +12 -12
  58. package/dist/views/admin/terminal/TerminalDialog.vue.d.ts +83 -0
  59. package/dist/views/admin/terminal/TerminalSetting.vue.d.ts +12 -0
  60. package/dist/views/admin/terminal/cell/Actions.vue.d.ts +80 -9
  61. package/dist/views/admin/terminal/tabs/FiuuGateway.vue.d.ts +94 -0
  62. package/dist/views/admin/terminal/tabs/GhlGateway.vue.d.ts +94 -0
  63. package/dist/views/admin/terminal/tabs/Information.vue.d.ts +85 -0
  64. package/dist/views/admin/terminal/tabs/TerminalGateway.vue.d.ts +94 -0
  65. package/dist/views/admin/terminal-transaction/cell/Actions.vue.d.ts +7 -0
  66. package/dist/views/admin/transaction/TransactionTable.vue.d.ts +6 -2
  67. package/dist/views/admin/transaction/cell/Actions.vue.d.ts +7 -0
  68. package/dist/views/payout-account/PayoutAccountTable.vue.d.ts +8 -8
  69. package/dist/views/settlement/SettlementTable.vue.d.ts +12 -12
  70. package/dist/views/terminal-transaction/TerminalTransaction.vue.d.ts +2 -0
  71. package/dist/views/terminal-transaction/cell/Gateway.vue.d.ts +9 -0
  72. package/dist/views/terminal-transaction/cell/Status.vue.d.ts +9 -0
  73. package/package.json +4 -4
  74. package/dist/AdminLayout.vue_vue_type_script_setup_true_lang-oPYFBeEo.js +0 -42
  75. package/dist/PayoutAccount-C0xyoyTa.js +0 -3485
  76. package/dist/PayoutAccountSetting-CIeos0md.js +0 -425
  77. package/dist/Settlement-BVGACeme.js +0 -136
  78. package/dist/Settlement-Ce48KHrc.js +0 -132
  79. package/dist/Terminal-ByKV2Rof.js +0 -204
  80. package/dist/TerminalTransaction-ClhuAOOF.js +0 -240
  81. package/dist/Transaction-BYq9Ymp_.js +0 -242
  82. package/dist/Transaction-Doq11qIf.js +0 -241
  83. package/dist/api/auth/index.d.ts +0 -7
  84. package/dist/assets-Dg26uQOf.js +0 -1756
  85. package/dist/index-Coz5aeIO.js +0 -61
  86. package/dist/index-DCPNrUDq.js +0 -40075
  87. package/dist/index.vue_vue_type_script_setup_true_lang-CAR-bNaR.js +0 -150
  88. package/dist/mascot-side-D5UubCy7.js +0 -8
  89. package/dist/payout-account-D2Ftjrss.js +0 -3317
  90. package/dist/transaction-vRrBf3FN.js +0 -64
@@ -0,0 +1,426 @@
1
+ import { defineComponent as h, openBlock as y, createElementBlock as I, unref as c, createCommentVNode as V, createElementVNode as w, resolveComponent as g, createBlock as v, normalizeClass as K, withCtx as x, toDisplayString as C, createVNode as p, Fragment as $, renderList as P, ref as L, watch as F, isRef as N, h as A } from "vue";
2
+ import { c as f } from "./index-Bt_OgDYn.js";
3
+ import { h as R } from "./moment-h96o7c8I.js";
4
+ import { u as B } from "./index-DjDGwRX8.js";
5
+ import { _ as G } from "./index.vue_vue_type_script_setup_true_lang-Jlcg1hAB.js";
6
+ import { _ as U } from "./AdminLayout.vue_vue_type_script_setup_true_lang-BTmMOzwx.js";
7
+ import { useSnackbar as Y, useDialog as Q } from "@feedmepos/ui-library";
8
+ import { g as W } from "./assets-Bji7O2YD.js";
9
+ import { E as j, t as b } from "./index-DSuZG0l6.js";
10
+ import { d as z } from "./dinero-CIVmXLL-.js";
11
+ import { _ as H } from "./AsyncButton.vue_vue_type_script_setup_true_lang-DcjzvYwT.js";
12
+ import { _ as J } from "./AutoCopyCell.vue_vue_type_script_setup_true_lang-GXPXBEf5.js";
13
+ import { useRouter as X } from "vue-router";
14
+ import { w as Z } from "./Modal-DB8M9o1T.js";
15
+ import { u as S } from "./error-K1CakhA9.js";
16
+ const ee = { class: "flex" }, te = ["src"], ae = ["src"], ne = /* @__PURE__ */ h({
17
+ __name: "Gateway",
18
+ props: {
19
+ row: {},
20
+ data: {}
21
+ },
22
+ setup(T) {
23
+ return (a, m) => (y(), I("div", ee, [
24
+ a.row.original.ecrGateway ? (y(), I("img", {
25
+ key: 0,
26
+ class: "bg-fm-color-overlay-background rounded-md m-auto border-transparent w-[32px] h-[32px]",
27
+ src: c(j)
28
+ }, null, 8, te)) : V("", !0),
29
+ w("img", {
30
+ class: "rounded-md m-auto border-transparent w-[32px] h-[32px]",
31
+ src: c(W)(a.row.original.gateway)
32
+ }, null, 8, ae)
33
+ ]));
34
+ }
35
+ }), re = /* @__PURE__ */ h({
36
+ __name: "Status",
37
+ props: {
38
+ row: {},
39
+ data: {}
40
+ },
41
+ setup(T) {
42
+ const a = T;
43
+ function m() {
44
+ return a.data === f.F_TERMINAL_TRANSACTION_ACTION.Enum.process ? "!w-[16px] !h-[16px] bg-yellow-400" : a.data === f.F_TERMINAL_TRANSACTION_ACTION.Enum.failed ? "!w-[16px] !h-[16px] bg-red-400" : a.data === f.F_TERMINAL_TRANSACTION_ACTION.Enum.refunded ? "!w-[16px] !h-[16px] bg-blue-400" : "!w-[16px] !h-[16px] bg-green-400";
45
+ }
46
+ return (o, l) => {
47
+ const s = g("FmBadge");
48
+ return y(), v(s, {
49
+ inline: "",
50
+ class: K(m())
51
+ }, {
52
+ default: x(() => [
53
+ w("div", null, C(o.data.toUpperCase()), 1)
54
+ ]),
55
+ _: 1
56
+ }, 8, ["class"]);
57
+ };
58
+ }
59
+ }), oe = /* @__PURE__ */ h({
60
+ __name: "RouteCell",
61
+ props: {
62
+ data: {},
63
+ route: {}
64
+ },
65
+ setup(T) {
66
+ const a = T, m = X();
67
+ function o() {
68
+ m.push(a.route);
69
+ }
70
+ return (l, s) => (y(), I("div", {
71
+ class: "fm-typo-en-link-md-600",
72
+ onClick: s[0] || (s[0] = (u) => {
73
+ u.stopPropagation(), o();
74
+ })
75
+ }, C(l.data), 1));
76
+ }
77
+ }), se = /* @__PURE__ */ h({
78
+ __name: "Actions",
79
+ props: {
80
+ onAction: { type: Function }
81
+ },
82
+ setup(T) {
83
+ const a = [
84
+ {
85
+ label: "Query",
86
+ sublabel: "Perform transaction status inquriy",
87
+ icon: "question_answer",
88
+ action: "query"
89
+ },
90
+ {
91
+ label: "Refund",
92
+ sublabel: "Perform transaction refund request",
93
+ icon: "request_page",
94
+ action: "refund"
95
+ }
96
+ ];
97
+ return (m, o) => {
98
+ const l = g("FmIcon"), s = g("FmMenuItem"), u = g("FmMenu");
99
+ return y(), I("div", {
100
+ onClick: o[0] || (o[0] = (i) => {
101
+ i.stopPropagation();
102
+ })
103
+ }, [
104
+ p(u, null, {
105
+ "menu-button": x(() => [
106
+ p(l, { name: "settings" })
107
+ ]),
108
+ default: x(() => [
109
+ (y(), I($, null, P(a, (i) => p(s, {
110
+ selectable: !0,
111
+ key: i.label,
112
+ sublabel: i.sublabel,
113
+ label: i.label,
114
+ icon: i.icon,
115
+ onclick: () => m.onAction(i.action)
116
+ }, null, 8, ["sublabel", "label", "icon", "onclick"])), 64))
117
+ ]),
118
+ _: 1
119
+ })
120
+ ]);
121
+ };
122
+ }
123
+ }), le = { class: "flex justify-between mb-6 items-start" }, ie = { class: "flex space-x-4 items-start" }, ce = { class: "flex space-x-4" }, Ne = /* @__PURE__ */ h({
124
+ __name: "TerminalTransaction",
125
+ setup(T) {
126
+ const a = Y(), m = Q(), o = L(), { dateRange: l, status: s, searchKey: u } = B({
127
+ searchKey: "",
128
+ status: [f.F_TERMINAL_TRANSACTION_ACTION.Enum.success],
129
+ dateRange: {
130
+ startDate: R().startOf("day").toISOString(),
131
+ endDate: R().endOf("day").toISOString()
132
+ }
133
+ });
134
+ F([l, s], () => {
135
+ var e;
136
+ return (e = o.value) == null ? void 0 : e.reset();
137
+ });
138
+ let i;
139
+ F(u, async () => {
140
+ i && clearTimeout(i), i = setTimeout(
141
+ () => {
142
+ var e;
143
+ return (e = o.value) == null ? void 0 : e.reset();
144
+ },
145
+ 700
146
+ );
147
+ });
148
+ async function k(e) {
149
+ var r, d, _;
150
+ const t = (d = (r = o.value) == null ? void 0 : r.pageData()) == null ? void 0 : d.at(e);
151
+ if (!t) {
152
+ a.open({
153
+ type: "error",
154
+ title: "Something went wrong",
155
+ message: "Fail to find transactions from the displayed transactions."
156
+ });
157
+ return;
158
+ }
159
+ if (!t.refId) {
160
+ a.open({
161
+ type: "error",
162
+ title: "Something went wrong",
163
+ message: "Transaction isn't a valid transaction to perform query"
164
+ });
165
+ return;
166
+ }
167
+ try {
168
+ const n = await b.queryTransaction(t._id);
169
+ (_ = o.value) == null || _.replaceData(e, n), a.open({
170
+ type: "success",
171
+ title: "Transaction queried and updated successfully."
172
+ });
173
+ } catch (n) {
174
+ a.open({
175
+ type: "error",
176
+ title: "Fail to query transaction.",
177
+ message: S(n)
178
+ });
179
+ }
180
+ }
181
+ async function E(e) {
182
+ var r, d;
183
+ const t = (d = (r = o.value) == null ? void 0 : r.pageData()) == null ? void 0 : d.at(e);
184
+ if (!t) {
185
+ a.open({
186
+ type: "error",
187
+ title: "Something went wrong",
188
+ message: "Fail to find transactions from the displayed transactions."
189
+ });
190
+ return;
191
+ }
192
+ if (!t.refId) {
193
+ a.open({
194
+ type: "error",
195
+ title: "Something went wrong",
196
+ message: "Transaction isn't a valid transaction to perform refund"
197
+ });
198
+ return;
199
+ }
200
+ Z(
201
+ m,
202
+ "Refund Transaction",
203
+ "Are you sure to refund transaction? This action cannot be revert!",
204
+ async () => {
205
+ var _;
206
+ try {
207
+ const n = await b.refundTransaction({
208
+ transactionId: t._id,
209
+ reason: "portal transaction refund",
210
+ amount: t.details.amount
211
+ });
212
+ (_ = o.value) == null || _.replaceData(e, n), a.open({
213
+ type: "success",
214
+ title: "Transaction queried and updated successfully."
215
+ });
216
+ } catch (n) {
217
+ a.open({
218
+ type: "error",
219
+ title: "Fail to query transaction.",
220
+ message: S(n)
221
+ });
222
+ }
223
+ }
224
+ );
225
+ }
226
+ const O = [
227
+ {
228
+ label: "Success",
229
+ value: f.F_TERMINAL_TRANSACTION_ACTION.Enum.success
230
+ },
231
+ {
232
+ label: "Refunded",
233
+ value: f.F_TERMINAL_TRANSACTION_ACTION.Enum.refunded
234
+ },
235
+ {
236
+ label: "Process",
237
+ value: f.F_TERMINAL_TRANSACTION_ACTION.Enum.process
238
+ },
239
+ {
240
+ label: "Failed",
241
+ value: f.F_TERMINAL_TRANSACTION_ACTION.Enum.failed
242
+ }
243
+ ], D = function(e) {
244
+ const t = e;
245
+ let r = "-";
246
+ return t.details && t.details.amount && (r = z(t.details.amount).toFormat("$0.00")), {
247
+ id: e._id,
248
+ orderId: e.orderId,
249
+ refId: e.refId,
250
+ owner: e.owner,
251
+ terminalId: e.terminalId,
252
+ transactionAt: R(e.transactionAt).format("YYYY-MM-DD hh:mm:ss"),
253
+ action: e.action,
254
+ gateway: e.gateway,
255
+ ecrGateway: e.ecrGateway,
256
+ amount: r
257
+ };
258
+ }, M = [
259
+ {
260
+ accessorKey: "id",
261
+ header: () => "Transaction ID",
262
+ meta: {
263
+ textAlign: "left"
264
+ },
265
+ cell: ({ cell: e }) => A(J, { data: e.getValue() })
266
+ },
267
+ {
268
+ accessorKey: "orderId",
269
+ header: () => "Pay ID",
270
+ meta: {
271
+ textAlign: "left"
272
+ }
273
+ },
274
+ {
275
+ accessorKey: "refId",
276
+ header: () => "Reference ID",
277
+ meta: {
278
+ textAlign: "left"
279
+ }
280
+ },
281
+ {
282
+ accessorKey: "gateway",
283
+ header: () => "Gateway",
284
+ meta: {
285
+ textAlign: "center",
286
+ maxWidth: "128px"
287
+ },
288
+ cell: ({ cell: e, row: t }) => A(ne, { row: t, data: e.getValue() })
289
+ },
290
+ {
291
+ accessorKey: "action",
292
+ header: () => "Status",
293
+ meta: {
294
+ textAlign: "right",
295
+ maxWidth: "132px"
296
+ },
297
+ cell: ({ cell: e, row: t }) => A(re, { row: t, data: e.getValue() })
298
+ },
299
+ {
300
+ accessorKey: "amount",
301
+ header: () => "Sales Amount",
302
+ meta: {
303
+ textAlign: "center"
304
+ }
305
+ },
306
+ {
307
+ accessorKey: "terminalId",
308
+ header: () => "Terminal ID",
309
+ meta: {
310
+ textAlign: "left"
311
+ },
312
+ cell: ({ cell: e, row: t }) => {
313
+ const r = e.getValue();
314
+ return A(oe, {
315
+ data: r,
316
+ route: {
317
+ name: "mf-payment-admin.terminal-setting",
318
+ params: { terminalId: r }
319
+ }
320
+ });
321
+ }
322
+ },
323
+ {
324
+ accessorKey: "owner",
325
+ header: () => "Reference",
326
+ meta: {
327
+ textAlign: "left"
328
+ }
329
+ },
330
+ {
331
+ accessorKey: "transactionAt",
332
+ header: () => "Transaction At",
333
+ meta: {
334
+ textAlign: "left"
335
+ }
336
+ },
337
+ {
338
+ header: () => "Actions",
339
+ accessorKey: "actions",
340
+ cell: ({ row: e }) => {
341
+ if (e.original.gateway === "ScanPay")
342
+ return A(se, {
343
+ onAction: (t) => {
344
+ const r = e.index;
345
+ switch (t) {
346
+ case "query":
347
+ return k(r);
348
+ case "refund":
349
+ return E(r);
350
+ }
351
+ }
352
+ });
353
+ }
354
+ }
355
+ ];
356
+ return (e, t) => {
357
+ const r = g("FmSearch"), d = g("FmSelect"), _ = g("FmDateRangePicker");
358
+ return y(), v(U, {
359
+ title: "Offline Transactions",
360
+ loading: !1
361
+ }, {
362
+ default: x(() => [
363
+ w("div", le, [
364
+ w("div", ie, [
365
+ p(r, {
366
+ "model-value": c(u),
367
+ "onUpdate:modelValue": t[0] || (t[0] = (n) => N(u) ? u.value = n : null),
368
+ class: "mr-8",
369
+ label: "Search",
370
+ placeholder: "Search Transactions ..."
371
+ }, null, 8, ["model-value"]),
372
+ p(d, {
373
+ modelValue: c(s),
374
+ "onUpdate:modelValue": t[1] || (t[1] = (n) => N(s) ? s.value = n : null),
375
+ class: "mr-6 w-[300px]",
376
+ label: "Status",
377
+ "label-mark": "required",
378
+ multiselect: "",
379
+ items: O
380
+ }, null, 8, ["modelValue"]),
381
+ p(_, {
382
+ modelValue: c(l),
383
+ "onUpdate:modelValue": t[2] || (t[2] = (n) => N(l) ? l.value = n : null),
384
+ compare: "",
385
+ "show-predefined-range": ""
386
+ }, null, 8, ["modelValue"])
387
+ ]),
388
+ w("div", ce, [
389
+ p(H, {
390
+ button: {
391
+ appendIcon: "file_download",
392
+ variant: "primary",
393
+ label: "Export"
394
+ },
395
+ handler: async () => {
396
+ var n;
397
+ return c(b).downloadTransactions(await ((n = o.value) == null ? void 0 : n.allData()) ?? []);
398
+ }
399
+ }, null, 8, ["handler"])
400
+ ])
401
+ ]),
402
+ p(G, {
403
+ ref_key: "controller",
404
+ ref: o,
405
+ "column-defs": M,
406
+ "rows-defs": D,
407
+ onRowClick: t[3] || (t[3] = () => {
408
+ }),
409
+ paginate: (n, q) => c(b).readTransactions({
410
+ status: c(s),
411
+ searchKey: c(u),
412
+ limit: n,
413
+ cursor: q,
414
+ start: c(l).startDate,
415
+ end: c(l).endDate
416
+ })
417
+ }, null, 8, ["paginate"])
418
+ ]),
419
+ _: 1
420
+ });
421
+ };
422
+ }
423
+ });
424
+ export {
425
+ Ne as default
426
+ };
@@ -0,0 +1,250 @@
1
+ import { defineComponent as y, openBlock as _, createElementBlock as x, Fragment as F, unref as t, createCommentVNode as k, createElementVNode as d, resolveComponent as p, createBlock as R, normalizeClass as D, withCtx as C, toDisplayString as V, ref as K, watch as T, createVNode as i, isRef as g, h } from "vue";
2
+ import { c as l } from "./index-Bt_OgDYn.js";
3
+ import { h as I } from "./moment-h96o7c8I.js";
4
+ import { u as M } from "./index-DjDGwRX8.js";
5
+ import { _ as $ } from "./index.vue_vue_type_script_setup_true_lang-Jlcg1hAB.js";
6
+ import "@feedmepos/ui-library";
7
+ import { g as L } from "./assets-Bji7O2YD.js";
8
+ import { E as B, t as w } from "./index-DSuZG0l6.js";
9
+ import { d as G } from "./dinero-CIVmXLL-.js";
10
+ import { _ as P } from "./RestaurantSelector.vue_vue_type_script_setup_true_lang-CY4ttpKj.js";
11
+ import { useCoreStore as U } from "@feedmepos/mf-common";
12
+ import { _ as Y } from "./AsyncButton.vue_vue_type_script_setup_true_lang-DcjzvYwT.js";
13
+ import { _ as W } from "./AutoCopyCell.vue_vue_type_script_setup_true_lang-GXPXBEf5.js";
14
+ import { _ as j } from "./Layout.vue_vue_type_script_setup_true_lang-DJm5br5a.js";
15
+ const q = ["src"], z = ["src"], Q = /* @__PURE__ */ y({
16
+ __name: "Gateway",
17
+ props: {
18
+ row: {},
19
+ data: {}
20
+ },
21
+ setup(f) {
22
+ return (n, s) => (_(), x(F, null, [
23
+ n.row.original.ecrGateway ? (_(), x("img", {
24
+ key: 0,
25
+ class: "bg-fm-color-overlay-background rounded-md m-auto border-transparent w-[32px] h-[32px]",
26
+ src: t(B)
27
+ }, null, 8, q)) : k("", !0),
28
+ d("img", {
29
+ class: "rounded-md m-auto border-transparent w-[32px] h-[32px]",
30
+ src: t(L)(n.row.original.gateway)
31
+ }, null, 8, z)
32
+ ], 64));
33
+ }
34
+ }), H = /* @__PURE__ */ y({
35
+ __name: "Status",
36
+ props: {
37
+ row: {},
38
+ data: {}
39
+ },
40
+ setup(f) {
41
+ const n = f;
42
+ function s() {
43
+ return n.data === l.F_TERMINAL_TRANSACTION_ACTION.Enum.process ? "!w-[16px] !h-[16px] bg-yellow-400" : n.data === l.F_TERMINAL_TRANSACTION_ACTION.Enum.failed ? "!w-[16px] !h-[16px] bg-red-400" : n.data === l.F_TERMINAL_TRANSACTION_ACTION.Enum.refunded ? "!w-[16px] !h-[16px] bg-blue-400" : "!w-[16px] !h-[16px] bg-green-400";
44
+ }
45
+ return (o, m) => {
46
+ const c = p("FmBadge");
47
+ return _(), R(c, {
48
+ inline: "",
49
+ class: D(s())
50
+ }, {
51
+ default: C(() => [
52
+ d("div", null, V(o.data.toUpperCase()), 1)
53
+ ]),
54
+ _: 1
55
+ }, 8, ["class"]);
56
+ };
57
+ }
58
+ }), J = { class: "flex justify-between mb-6 items-start" }, X = { class: "flex space-x-8 items-start" }, Z = { class: "flex space-x-4" }, _e = /* @__PURE__ */ y({
59
+ __name: "TerminalTransaction",
60
+ setup(f) {
61
+ const { currentRestaurant: n } = U(), s = K(), { dateRange: o, status: m, searchKey: c } = M({
62
+ searchKey: "",
63
+ status: [l.F_TERMINAL_TRANSACTION_ACTION.Enum.success],
64
+ dateRange: {
65
+ startDate: I().startOf("day").toISOString(),
66
+ endDate: I().endOf("day").toISOString()
67
+ }
68
+ });
69
+ T([o, m], () => {
70
+ var e;
71
+ return (e = s.value) == null ? void 0 : e.reset();
72
+ }), T(n, () => {
73
+ var e;
74
+ return (e = s.value) == null ? void 0 : e.reset();
75
+ });
76
+ let A;
77
+ T(c, async () => {
78
+ A && clearTimeout(A), A = setTimeout(
79
+ () => {
80
+ var e;
81
+ return (e = s.value) == null ? void 0 : e.reset();
82
+ },
83
+ 700
84
+ );
85
+ });
86
+ const S = [
87
+ {
88
+ label: "Success",
89
+ value: l.F_TERMINAL_TRANSACTION_ACTION.Enum.success
90
+ },
91
+ {
92
+ label: "Refunded",
93
+ value: l.F_TERMINAL_TRANSACTION_ACTION.Enum.refunded
94
+ },
95
+ {
96
+ label: "Process",
97
+ value: l.F_TERMINAL_TRANSACTION_ACTION.Enum.process
98
+ },
99
+ {
100
+ label: "Failed",
101
+ value: l.F_TERMINAL_TRANSACTION_ACTION.Enum.failed
102
+ }
103
+ ], E = function(e) {
104
+ const a = e;
105
+ let u = "-";
106
+ return a.details && a.details.amount && (u = G(a.details.amount).toFormat("$0.00")), {
107
+ id: e._id,
108
+ orderId: e.orderId,
109
+ refId: e.refId,
110
+ terminalId: e.terminalId,
111
+ transactionAt: I(e.transactionAt).format("YYYY-MM-DD hh:mm:ss"),
112
+ action: e.action,
113
+ gateway: e.gateway,
114
+ ecrGateway: e.ecrGateway,
115
+ amount: u
116
+ };
117
+ }, O = [
118
+ {
119
+ accessorKey: "id",
120
+ header: () => "Transaction ID",
121
+ meta: {
122
+ textAlign: "left"
123
+ },
124
+ cell: ({ cell: e }) => h(W, { data: e.getValue() })
125
+ },
126
+ {
127
+ accessorKey: "orderId",
128
+ header: () => "Pay ID",
129
+ meta: {
130
+ textAlign: "left"
131
+ }
132
+ },
133
+ {
134
+ accessorKey: "refId",
135
+ header: () => "Reference ID",
136
+ meta: {
137
+ textAlign: "left"
138
+ }
139
+ },
140
+ {
141
+ accessorKey: "gateway",
142
+ header: () => "Gateway",
143
+ meta: {
144
+ textAlign: "center",
145
+ maxWidth: "128px"
146
+ },
147
+ cell: ({ cell: e, row: a }) => h(Q, { row: a, data: e.getValue() })
148
+ },
149
+ {
150
+ accessorKey: "action",
151
+ header: () => "Status",
152
+ meta: {
153
+ textAlign: "right",
154
+ maxWidth: "132px"
155
+ },
156
+ cell: ({ cell: e, row: a }) => h(H, { row: a, data: e.getValue() })
157
+ },
158
+ {
159
+ accessorKey: "amount",
160
+ header: () => "Sales Amount",
161
+ meta: {
162
+ textAlign: "center"
163
+ }
164
+ },
165
+ {
166
+ accessorKey: "terminalId",
167
+ header: () => "Terminal ID",
168
+ meta: {
169
+ textAlign: "left"
170
+ }
171
+ },
172
+ {
173
+ accessorKey: "transactionAt",
174
+ header: () => "Transaction At",
175
+ meta: {
176
+ textAlign: "left"
177
+ }
178
+ }
179
+ ];
180
+ return (e, a) => {
181
+ const u = p("FmSearch"), N = p("FmSelect"), v = p("FmDateRangePicker");
182
+ return _(), R(j, {
183
+ title: "Offline Transactions",
184
+ description: "Transactions are purchases or payments made in retail using electronic devices such as POS systems, kiosks, terminals, or ECRs.",
185
+ loading: !1
186
+ }, {
187
+ default: C(() => [
188
+ d("div", J, [
189
+ d("div", X, [
190
+ i(P),
191
+ i(u, {
192
+ "model-value": t(c),
193
+ "onUpdate:modelValue": a[0] || (a[0] = (r) => g(c) ? c.value = r : null),
194
+ class: "mr-8",
195
+ label: "Search",
196
+ placeholder: "Search Transactions ..."
197
+ }, null, 8, ["model-value"]),
198
+ i(N, {
199
+ modelValue: t(m),
200
+ "onUpdate:modelValue": a[1] || (a[1] = (r) => g(m) ? m.value = r : null),
201
+ class: "mr-6 w-[300px]",
202
+ label: "Status",
203
+ "label-mark": "required",
204
+ multiselect: "",
205
+ items: S
206
+ }, null, 8, ["modelValue"]),
207
+ i(v, {
208
+ modelValue: t(o),
209
+ "onUpdate:modelValue": a[2] || (a[2] = (r) => g(o) ? o.value = r : null),
210
+ compare: "",
211
+ "show-predefined-range": ""
212
+ }, null, 8, ["modelValue"])
213
+ ]),
214
+ d("div", Z, [
215
+ i(Y, {
216
+ button: {
217
+ appendIcon: "file_download",
218
+ variant: "primary",
219
+ label: "Export"
220
+ },
221
+ handler: () => {
222
+ var r;
223
+ return t(w).downloadTransactions(((r = s.value) == null ? void 0 : r.data()) ?? []);
224
+ }
225
+ }, null, 8, ["handler"])
226
+ ])
227
+ ]),
228
+ i($, {
229
+ ref_key: "controller",
230
+ ref: s,
231
+ "column-defs": O,
232
+ "rows-defs": E,
233
+ paginate: (r, b) => t(w).readRestaurantTransactions({
234
+ status: t(m),
235
+ searchKey: t(c),
236
+ limit: r,
237
+ cursor: b,
238
+ start: t(o).startDate,
239
+ end: t(o).endDate
240
+ })
241
+ }, null, 8, ["paginate"])
242
+ ]),
243
+ _: 1
244
+ });
245
+ };
246
+ }
247
+ });
248
+ export {
249
+ _e as default
250
+ };