@feedmepos/mf-payment 0.0.0-beta.9 → 1.0.0-beta.2

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