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

Sign up to get free protection for your applications and to get access to all the features.
Files changed (91) 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-BHRhEZ9h.js +613 -0
  6. package/dist/{PayoutAccount-DLhMMlw_.js → PayoutAccount-Bj5zvmoj.js} +38 -35
  7. package/dist/PayoutAccountSetting-kUQLeAcb.js +780 -0
  8. package/dist/RestaurantSelector.vue_vue_type_script_setup_true_lang-CY4ttpKj.js +33 -0
  9. package/dist/Settlement-Crdfq22j.js +149 -0
  10. package/dist/Settlement-JHOJNkhd.js +194 -0
  11. package/dist/{SettlementTransactions-CoEzdtYT.js → SettlementTransactions-BxuLXUR-.js} +99 -105
  12. package/dist/{SettlementTransactions-Dl1H4jvh.js → SettlementTransactions-daWMAmtz.js} +117 -130
  13. package/dist/Terminal-gxGnjFGc.js +372 -0
  14. package/dist/TerminalSetting--ZAJJ_Hf.js +379 -0
  15. package/dist/TerminalTransaction---9nk_4q.js +249 -0
  16. package/dist/TerminalTransaction-B77YK3hF.js +425 -0
  17. package/dist/Transaction-8LlOLPeZ.js +404 -0
  18. package/dist/Transaction-DRQ_uZ30.js +241 -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-DjzULXn3.js +6356 -0
  27. package/dist/app.js +3 -198
  28. package/dist/assets-NrCec-W0.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-Bmka-1lQ.js → index-7KNaibcq.js} +1 -1
  37. package/dist/index-BWUtjGg7.js +47 -0
  38. package/dist/{index-CF56zGyu.js → index-BwcJZFsi.js} +1 -1
  39. package/dist/index-CWaKb7bG.js +56107 -0
  40. package/dist/index-CojhNtuG.js +127 -0
  41. package/dist/index-DbJpbpSs.js +52 -0
  42. package/dist/index.vue_vue_type_script_setup_true_lang-JdAFa8vy.js +167 -0
  43. package/dist/model/transaction.d.ts +2 -1
  44. package/dist/package.json +5 -5
  45. package/dist/payout-account-CBT1rfSS.js +1805 -0
  46. package/dist/router/index.d.ts +1 -0
  47. package/dist/stores/payoutAccount.d.ts +4 -4
  48. package/dist/transaction-CQiT7Y_s.js +87 -0
  49. package/dist/tsconfig.app.tsbuildinfo +1 -1
  50. package/dist/validator-D5jtpt9A.js +2877 -0
  51. package/dist/views/admin/payout-account/tabs/Information.vue.d.ts +4 -4
  52. package/dist/views/admin/payout-account/tabs/PaymentGateway.vue.d.ts +81 -0
  53. package/dist/views/admin/payout-account/tabs/PaymentStatus.vue.d.ts +4 -4
  54. package/dist/views/admin/payout-account/tabs/Settlement.vue.d.ts +4 -4
  55. package/dist/views/admin/payout-account/tabs/gateway/FiuuGateway.vue.d.ts +56 -0
  56. package/dist/views/admin/payout-account/tabs/gateway/GhlGateway.vue.d.ts +50 -0
  57. package/dist/views/admin/payout-account/tabs/gateway/RevenueMonsterGateway.vue.d.ts +52 -0
  58. package/dist/views/admin/settlement/SettlementTable.vue.d.ts +12 -12
  59. package/dist/views/admin/terminal/TerminalDialog.vue.d.ts +83 -0
  60. package/dist/views/admin/terminal/TerminalSetting.vue.d.ts +12 -0
  61. package/dist/views/admin/terminal/cell/Actions.vue.d.ts +80 -9
  62. package/dist/views/admin/terminal/tabs/FiuuGateway.vue.d.ts +94 -0
  63. package/dist/views/admin/terminal/tabs/GhlGateway.vue.d.ts +94 -0
  64. package/dist/views/admin/terminal/tabs/Information.vue.d.ts +85 -0
  65. package/dist/views/admin/terminal/tabs/TerminalGateway.vue.d.ts +94 -0
  66. package/dist/views/admin/terminal-transaction/cell/Actions.vue.d.ts +7 -0
  67. package/dist/views/admin/transaction/TransactionTable.vue.d.ts +6 -2
  68. package/dist/views/admin/transaction/cell/Actions.vue.d.ts +7 -0
  69. package/dist/views/payout-account/PayoutAccountTable.vue.d.ts +8 -8
  70. package/dist/views/settlement/SettlementTable.vue.d.ts +12 -12
  71. package/dist/views/terminal-transaction/TerminalTransaction.vue.d.ts +2 -0
  72. package/dist/views/terminal-transaction/cell/Gateway.vue.d.ts +9 -0
  73. package/dist/views/terminal-transaction/cell/Status.vue.d.ts +9 -0
  74. package/package.json +5 -5
  75. package/dist/AdminLayout.vue_vue_type_script_setup_true_lang-oPYFBeEo.js +0 -42
  76. package/dist/PayoutAccount-xxSxqBTL.js +0 -3485
  77. package/dist/PayoutAccountSetting-CIeos0md.js +0 -425
  78. package/dist/Settlement-BVGACeme.js +0 -136
  79. package/dist/Settlement-Ce48KHrc.js +0 -132
  80. package/dist/Terminal-ByKV2Rof.js +0 -204
  81. package/dist/TerminalTransaction-RuSxBAxf.js +0 -240
  82. package/dist/Transaction-CYo-uLQi.js +0 -241
  83. package/dist/Transaction-Cjw9WwX8.js +0 -242
  84. package/dist/api/auth/index.d.ts +0 -7
  85. package/dist/assets-BuLGUMIx.js +0 -472
  86. package/dist/index-Coz5aeIO.js +0 -61
  87. package/dist/index-DCPNrUDq.js +0 -40075
  88. package/dist/index.vue_vue_type_script_setup_true_lang-CAR-bNaR.js +0 -150
  89. package/dist/mascot-side-3VXskf9y.js +0 -4
  90. package/dist/payout-account-iAM7HPtG.js +0 -3317
  91. package/dist/transaction-vRrBf3FN.js +0 -64
@@ -0,0 +1,379 @@
1
+ import { defineComponent as x, openBlock as I, createElementBlock as M, Fragment as $, createElementVNode as v, createTextVNode as T, toDisplayString as V, ref as g, onMounted as C, computed as D, resolveComponent as f, unref as b, createVNode as F, createBlock as w, withCtx as G, createCommentVNode as q, isRef as P, resolveDynamicComponent as R, normalizeProps as Y, mergeProps as K } from "vue";
2
+ import { u as _, e as U } from "./index-CWaKb7bG.js";
3
+ import { useRouter as L } from "vue-router";
4
+ import { t as S } from "./index-BWUtjGg7.js";
5
+ import { _ as j } from "./Layout.vue_vue_type_script_setup_true_lang-DJm5br5a.js";
6
+ import { u as E } from "./index-7KNaibcq.js";
7
+ import { useSnackbar as A } from "@feedmepos/ui-library";
8
+ import { u as z } from "./error-K1CakhA9.js";
9
+ import { useCoreStore as N } from "@feedmepos/mf-common";
10
+ const h = /* @__PURE__ */ x({
11
+ __name: "Information",
12
+ props: {
13
+ terminal: {
14
+ type: Object,
15
+ required: !0
16
+ }
17
+ },
18
+ setup(t) {
19
+ return (r, a) => (I(), M($, null, [
20
+ a[0] || (a[0] = v("b", null, "Name", -1)),
21
+ T(": " + V(t.terminal.name), 1),
22
+ a[1] || (a[1] = v("br", null, null, -1)),
23
+ a[2] || (a[2] = v("b", null, "Status", -1)),
24
+ T(": " + V(t.terminal.status), 1),
25
+ a[3] || (a[3] = v("br", null, null, -1)),
26
+ a[4] || (a[4] = v("b", null, "Device ID", -1)),
27
+ T(": " + V(t.terminal.deviceId ?? "-"), 1),
28
+ a[5] || (a[5] = v("br", null, null, -1)),
29
+ a[6] || (a[6] = v("b", null, "Device Type", -1)),
30
+ T(": " + V(t.terminal.deviceType ?? "-"), 1),
31
+ a[7] || (a[7] = v("br", null, null, -1))
32
+ ], 64));
33
+ }
34
+ }), H = {
35
+ key: 0,
36
+ class: "flex items-center justify-center min-h-[80vh]"
37
+ }, Q = { class: "flex mt-6 space-x-6" }, J = /* @__PURE__ */ x({
38
+ __name: "TerminalGateway",
39
+ props: {
40
+ terminal: {
41
+ type: Object,
42
+ required: !0
43
+ },
44
+ onUpdate: {
45
+ type: Function,
46
+ required: !0
47
+ }
48
+ },
49
+ setup(t) {
50
+ const { isLoading: r, startAsyncCall: a } = _(), o = t, s = g(), p = g(), n = g(-1), e = g({
51
+ terminalId: ""
52
+ });
53
+ C(() => {
54
+ if (a(async () => {
55
+ s.value = await S.getTerminals(o.terminal.referenceId);
56
+ }), !o.terminal.ecrs)
57
+ return;
58
+ const i = o.terminal.ecrs.findIndex((c) => c && c.gateway && c.gateway === "FeedMe");
59
+ if (i === -1)
60
+ return;
61
+ n.value = i;
62
+ const m = o.terminal.ecrs.at(i);
63
+ m.gateway === "FeedMe" && m.config && (e.value = {
64
+ terminalId: m.config.terminalId
65
+ });
66
+ });
67
+ const u = D(() => (s.value ?? []).map((i) => ({
68
+ label: i.name ?? i._id,
69
+ value: i._id
70
+ })));
71
+ async function l(i) {
72
+ var m;
73
+ (m = o.terminal.ecrs) == null || m.splice(i, 1), o.onUpdate(o.terminal);
74
+ }
75
+ return (i, m) => {
76
+ const c = f("FmCircularProgress"), y = f("FmSelect"), d = f("FmButton"), B = f("FmForm");
77
+ return b(r) ? (I(), M("div", H, [
78
+ F(c, { size: "xxl" })
79
+ ])) : (I(), w(B, {
80
+ key: 1,
81
+ ref: p.value,
82
+ class: "flex flex-col gap-16 w-[500px]",
83
+ onValidationSuccess: m[1] || (m[1] = () => {
84
+ n.value > -1 ? t.terminal.ecrs[n.value] = { gateway: "FeedMe", config: e.value } : (t.terminal.ecrs || (t.terminal.ecrs = []), t.terminal.ecrs.push({ gateway: "FeedMe", config: e.value })), o.onUpdate(t.terminal);
85
+ })
86
+ }, {
87
+ default: G(() => [
88
+ F(y, {
89
+ modelValue: e.value.terminalId,
90
+ "onUpdate:modelValue": m[0] || (m[0] = (k) => e.value.terminalId = k),
91
+ label: "Terminal ID",
92
+ items: u.value
93
+ }, null, 8, ["modelValue", "items"]),
94
+ v("div", Q, [
95
+ n.value > -1 ? (I(), w(d, {
96
+ key: 0,
97
+ class: "flex-1",
98
+ variant: "secondary",
99
+ label: "Delete",
100
+ onclick: () => l(n.value)
101
+ }, null, 8, ["onclick"])) : q("", !0),
102
+ F(d, {
103
+ type: "submit",
104
+ class: "flex-1",
105
+ variant: "primary",
106
+ label: "Save"
107
+ })
108
+ ])
109
+ ]),
110
+ _: 1
111
+ }, 512));
112
+ };
113
+ }
114
+ }), W = { class: "flex mt-6 space-x-6" }, X = /* @__PURE__ */ x({
115
+ __name: "FiuuGateway",
116
+ props: {
117
+ terminal: {
118
+ type: Object,
119
+ required: !0
120
+ },
121
+ onUpdate: {
122
+ type: Function,
123
+ required: !0
124
+ }
125
+ },
126
+ setup(t) {
127
+ const r = t, a = N().currentCountry, o = [
128
+ {
129
+ label: "Fiuu Malaysia",
130
+ value: "cc.feedme.payment.rms",
131
+ region: U.F_COUNTRY.enum.MY
132
+ },
133
+ {
134
+ label: "Fiuu Malaysia V2",
135
+ value: "cc.feedme.payment.fiuu_my",
136
+ region: U.F_COUNTRY.enum.MY
137
+ },
138
+ {
139
+ label: "Fiuu Singapore",
140
+ value: "cc.feedme.payment.fiuu_sg",
141
+ region: U.F_COUNTRY.enum.SG
142
+ }
143
+ ], s = g(), p = g(-1), n = g({
144
+ packageId: "",
145
+ uniqueId: ""
146
+ });
147
+ C(() => {
148
+ if (!r.terminal.gateways)
149
+ return;
150
+ const u = r.terminal.gateways.findIndex((i) => i && i.gateway && i.gateway === "Fiuu");
151
+ if (u === -1)
152
+ return;
153
+ p.value = u;
154
+ const l = r.terminal.gateways.at(u);
155
+ l.gateway === "Fiuu" && l.config && (n.value = {
156
+ packageId: l.config.packageId,
157
+ uniqueId: l.config.uniqueId
158
+ });
159
+ });
160
+ async function e(u) {
161
+ var l;
162
+ (l = r.terminal.gateways) == null || l.splice(u, 1), r.onUpdate(r.terminal);
163
+ }
164
+ return (u, l) => {
165
+ const i = f("FmSelect"), m = f("FmTextField"), c = f("FmButton"), y = f("FmForm");
166
+ return I(), w(y, {
167
+ ref: s.value,
168
+ class: "flex flex-col gap-16 w-[500px]",
169
+ onValidationSuccess: l[2] || (l[2] = () => {
170
+ p.value > -1 ? t.terminal.gateways[p.value] = { gateway: "Fiuu", config: n.value } : (t.terminal.gateways || (t.terminal.gateways = []), t.terminal.gateways.push({ gateway: "Fiuu", config: n.value })), r.onUpdate(t.terminal);
171
+ })
172
+ }, {
173
+ default: G(() => [
174
+ F(i, {
175
+ modelValue: n.value.packageId,
176
+ "onUpdate:modelValue": l[0] || (l[0] = (d) => n.value.packageId = d),
177
+ label: "Package ID",
178
+ items: o.filter((d) => d.region === b(a))
179
+ }, null, 8, ["modelValue", "items"]),
180
+ F(m, {
181
+ modelValue: n.value.uniqueId,
182
+ "onUpdate:modelValue": l[1] || (l[1] = (d) => n.value.uniqueId = d),
183
+ label: "Unique ID"
184
+ }, null, 8, ["modelValue"]),
185
+ v("div", W, [
186
+ p.value > -1 ? (I(), w(c, {
187
+ key: 0,
188
+ class: "flex-1",
189
+ variant: "secondary",
190
+ label: "Delete",
191
+ onclick: () => e(p.value)
192
+ }, null, 8, ["onclick"])) : q("", !0),
193
+ F(c, {
194
+ type: "submit",
195
+ class: "flex-1",
196
+ variant: "primary",
197
+ label: "Save"
198
+ })
199
+ ])
200
+ ]),
201
+ _: 1
202
+ }, 512);
203
+ };
204
+ }
205
+ }), Z = { class: "flex mt-6 space-x-6" }, ee = /* @__PURE__ */ x({
206
+ __name: "GhlGateway",
207
+ props: {
208
+ terminal: {
209
+ type: Object,
210
+ required: !0
211
+ },
212
+ onUpdate: {
213
+ type: Function,
214
+ required: !0
215
+ }
216
+ },
217
+ setup(t) {
218
+ const r = t, a = g(), o = g(-1), s = g({
219
+ merchantId: "",
220
+ terminalId: "",
221
+ privateKey: ""
222
+ });
223
+ C(() => {
224
+ if (!r.terminal.ecrs)
225
+ return;
226
+ const n = r.terminal.ecrs.findIndex((u) => u && u.gateway && u.gateway === "Ghl");
227
+ if (n === -1)
228
+ return;
229
+ o.value = n;
230
+ const e = r.terminal.ecrs.at(n);
231
+ e.gateway === "Ghl" && e.config && (s.value = {
232
+ merchantId: e.config.merchantId,
233
+ terminalId: e.config.terminalId,
234
+ privateKey: e.config.privateKey
235
+ });
236
+ });
237
+ async function p(n) {
238
+ var e;
239
+ (e = r.terminal.ecrs) == null || e.splice(n, 1), r.onUpdate(r.terminal);
240
+ }
241
+ return (n, e) => {
242
+ const u = f("FmTextField"), l = f("FmTextarea"), i = f("FmButton"), m = f("FmForm");
243
+ return I(), w(m, {
244
+ ref: a.value,
245
+ class: "flex flex-col gap-16 w-[500px]",
246
+ onValidationSuccess: e[3] || (e[3] = () => {
247
+ o.value > -1 ? t.terminal.ecrs[o.value] = { gateway: "Ghl", config: s.value } : (t.terminal.ecrs || (t.terminal.ecrs = []), t.terminal.ecrs.push({ gateway: "Ghl", config: s.value })), r.onUpdate(t.terminal);
248
+ })
249
+ }, {
250
+ default: G(() => [
251
+ F(u, {
252
+ modelValue: s.value.merchantId,
253
+ "onUpdate:modelValue": e[0] || (e[0] = (c) => s.value.merchantId = c),
254
+ label: "Merchant ID"
255
+ }, null, 8, ["modelValue"]),
256
+ F(u, {
257
+ modelValue: s.value.terminalId,
258
+ "onUpdate:modelValue": e[1] || (e[1] = (c) => s.value.terminalId = c),
259
+ label: "Terminal ID"
260
+ }, null, 8, ["modelValue"]),
261
+ F(l, {
262
+ modelValue: s.value.privateKey,
263
+ "onUpdate:modelValue": e[2] || (e[2] = (c) => s.value.privateKey = c),
264
+ label: "Private Key"
265
+ }, null, 8, ["modelValue"]),
266
+ v("div", Z, [
267
+ o.value > -1 ? (I(), w(i, {
268
+ key: 0,
269
+ class: "flex-1",
270
+ variant: "secondary",
271
+ label: "Delete",
272
+ onclick: () => p(o.value)
273
+ }, null, 8, ["onclick"])) : q("", !0),
274
+ F(i, {
275
+ type: "submit",
276
+ class: "flex-1",
277
+ variant: "primary",
278
+ label: "Save"
279
+ })
280
+ ])
281
+ ]),
282
+ _: 1
283
+ }, 512);
284
+ };
285
+ }
286
+ }), se = /* @__PURE__ */ x({
287
+ __name: "TerminalSetting",
288
+ props: {
289
+ terminalId: {
290
+ type: String,
291
+ required: !0
292
+ }
293
+ },
294
+ setup(t) {
295
+ const r = t, { tab: a } = E({
296
+ tab: "information"
297
+ }), { isLoading: o, startAsyncCall: s } = _(!0), p = L(), n = A(), e = g();
298
+ async function u(y) {
299
+ try {
300
+ await S.updateById(
301
+ r.terminalId,
302
+ {
303
+ name: y.name,
304
+ status: y.status,
305
+ ecrs: y.ecrs ?? [],
306
+ gateways: y.gateways ?? []
307
+ }
308
+ ), e.value = await S.readById(r.terminalId), n.open({
309
+ type: "success",
310
+ message: "Terminal updated successfully"
311
+ });
312
+ } catch (d) {
313
+ n.open({
314
+ type: "error",
315
+ title: "Error occurs when update terminal",
316
+ message: z(d)
317
+ });
318
+ }
319
+ }
320
+ const l = [
321
+ {
322
+ label: "Information",
323
+ value: "information",
324
+ icon: "overview",
325
+ render: h
326
+ },
327
+ {
328
+ label: "Fiuu",
329
+ value: "fiuu",
330
+ icon: "payment",
331
+ render: X
332
+ }
333
+ ], i = N().currentCountry, m = D(() => {
334
+ var y;
335
+ return (y = l.find((d) => d.value === a.value)) == null ? void 0 : y.render;
336
+ });
337
+ async function c() {
338
+ s(async () => {
339
+ e.value = await S.readById(r.terminalId), e.value.deviceType !== "TERMINAL" && (l.push({
340
+ label: "FeedMe Terminal",
341
+ value: "terminal",
342
+ icon: "shopping_cart_checkout",
343
+ render: J
344
+ }), i.value === U.F_COUNTRY.enum.MY && l.push({
345
+ label: "GHL Terminal (V2)",
346
+ value: "ghl",
347
+ icon: "shopping_cart_checkout",
348
+ render: ee
349
+ }));
350
+ });
351
+ }
352
+ return C(c), (y, d) => {
353
+ var k;
354
+ const B = f("FmTabs");
355
+ return I(), w(j, {
356
+ title: `Terminal (${(k = e.value) == null ? void 0 : k._id})`,
357
+ loading: b(o),
358
+ onBack: b(p).back
359
+ }, {
360
+ default: G(() => [
361
+ F(B, {
362
+ "model-value": b(a),
363
+ "onUpdate:modelValue": d[0] || (d[0] = (O) => P(a) ? a.value = O : null),
364
+ class: "mb-6",
365
+ items: l
366
+ }, null, 8, ["model-value"]),
367
+ b(a) ? (I(), w(R(m.value), Y(K({ key: 0 }, {
368
+ terminal: e.value,
369
+ onUpdate: u
370
+ })), null, 16)) : q("", !0)
371
+ ]),
372
+ _: 1
373
+ }, 8, ["title", "loading", "onBack"]);
374
+ };
375
+ }
376
+ });
377
+ export {
378
+ se as default
379
+ };
@@ -0,0 +1,249 @@
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 S, normalizeClass as D, withCtx as R, 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-CWaKb7bG.js";
3
+ import { h as I } from "./moment-h96o7c8I.js";
4
+ import { u as M } from "./index-7KNaibcq.js";
5
+ import { _ as $ } 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 w } 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
+ 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, c) => {
46
+ const m = p("FmBadge");
47
+ return _(), S(m, {
48
+ inline: "",
49
+ class: D(s())
50
+ }, {
51
+ default: R(() => [
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: c, searchKey: m } = 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, c], () => {
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(m, 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 C = [
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("FmSimpleDateRangePicker");
182
+ return _(), S(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: R(() => [
188
+ d("div", J, [
189
+ d("div", X, [
190
+ i(P),
191
+ i(u, {
192
+ "model-value": t(m),
193
+ "onUpdate:modelValue": a[0] || (a[0] = (r) => g(m) ? m.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(c),
200
+ "onUpdate:modelValue": a[1] || (a[1] = (r) => g(c) ? c.value = r : null),
201
+ class: "mr-6 w-[300px]",
202
+ label: "Status",
203
+ "label-mark": "required",
204
+ multiselect: "",
205
+ items: C
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
+ "show-predefined-range": ""
211
+ }, null, 8, ["modelValue"])
212
+ ]),
213
+ d("div", Z, [
214
+ i(Y, {
215
+ button: {
216
+ appendIcon: "file_download",
217
+ variant: "primary",
218
+ label: "Export"
219
+ },
220
+ handler: () => {
221
+ var r;
222
+ return t(w).downloadTransactions(((r = s.value) == null ? void 0 : r.data()) ?? []);
223
+ }
224
+ }, null, 8, ["handler"])
225
+ ])
226
+ ]),
227
+ i($, {
228
+ ref_key: "controller",
229
+ ref: s,
230
+ "column-defs": O,
231
+ "rows-defs": E,
232
+ paginate: (r, b) => t(w).readRestaurantTransactions({
233
+ status: t(c),
234
+ searchKey: t(m),
235
+ limit: r,
236
+ cursor: b,
237
+ start: t(o).startDate,
238
+ end: t(o).endDate
239
+ })
240
+ }, null, 8, ["paginate"])
241
+ ]),
242
+ _: 1
243
+ });
244
+ };
245
+ }
246
+ });
247
+ export {
248
+ _e as default
249
+ };