@feedmepos/mf-payment 1.0.0-beta.1 → 1.0.0-beta.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,4 @@
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 R, isRef as N, h as A } from "vue";
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
2
  import { c as f } from "./index-CWaKb7bG.js";
3
3
  import { h as S } from "./moment-h96o7c8I.js";
4
4
  import { u as B } from "./index-7KNaibcq.js";
@@ -6,81 +6,82 @@ import { _ as G } from "./index.vue_vue_type_script_setup_true_lang-JdAFa8vy.js"
6
6
  import { _ as U } from "./AdminLayout.vue_vue_type_script_setup_true_lang-BTmMOzwx.js";
7
7
  import { useSnackbar as Y, useDialog as Q } from "@feedmepos/ui-library";
8
8
  import { g as W } from "./assets-NrCec-W0.js";
9
- import { E as j, t as b } from "./index-DbJpbpSs.js";
9
+ import { E as j, t as N } from "./index-DbJpbpSs.js";
10
10
  import { d as z } from "./dinero-CIVmXLL-.js";
11
11
  import { _ as H } from "./AsyncButton.vue_vue_type_script_setup_true_lang-DcjzvYwT.js";
12
12
  import { _ as J } from "./AutoCopyCell.vue_vue_type_script_setup_true_lang-GXPXBEf5.js";
13
13
  import { useRouter as X } from "vue-router";
14
14
  import { w as Z } from "./Modal-DB8M9o1T.js";
15
15
  import { u as F } from "./error-K1CakhA9.js";
16
- const ee = { class: "flex" }, te = ["src"], ae = ["src"], ne = /* @__PURE__ */ h({
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({
17
18
  __name: "Gateway",
18
19
  props: {
19
20
  row: {},
20
21
  data: {}
21
22
  },
22
23
  setup(T) {
23
- return (a, m) => (y(), I("div", ee, [
24
- a.row.original.ecrGateway ? (y(), I("img", {
24
+ return (n, d) => (y(), I("div", te, [
25
+ n.row.original.ecrGateway ? (y(), I("img", {
25
26
  key: 0,
26
27
  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),
28
+ src: l(j)
29
+ }, null, 8, ae)) : q("", !0),
29
30
  w("img", {
30
31
  class: "rounded-md m-auto border-transparent w-[32px] h-[32px]",
31
- src: c(W)(a.row.original.gateway)
32
- }, null, 8, ae)
32
+ src: l(W)(n.row.original.gateway)
33
+ }, null, 8, ne)
33
34
  ]));
34
35
  }
35
- }), re = /* @__PURE__ */ h({
36
+ }), oe = /* @__PURE__ */ b({
36
37
  __name: "Status",
37
38
  props: {
38
39
  row: {},
39
40
  data: {}
40
41
  },
41
42
  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";
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";
45
46
  }
46
- return (o, l) => {
47
+ return (o, i) => {
47
48
  const s = g("FmBadge");
48
- return y(), v(s, {
49
+ return y(), C(s, {
49
50
  inline: "",
50
- class: K(m())
51
+ class: K(d())
51
52
  }, {
52
- default: x(() => [
53
- w("div", null, C(o.data.toUpperCase()), 1)
53
+ default: h(() => [
54
+ w("div", null, k(o.data.toUpperCase()), 1)
54
55
  ]),
55
56
  _: 1
56
57
  }, 8, ["class"]);
57
58
  };
58
59
  }
59
- }), oe = /* @__PURE__ */ h({
60
+ }), se = /* @__PURE__ */ b({
60
61
  __name: "RouteCell",
61
62
  props: {
62
63
  data: {},
63
64
  route: {}
64
65
  },
65
66
  setup(T) {
66
- const a = T, m = X();
67
+ const n = T, d = X();
67
68
  function o() {
68
- m.push(a.route);
69
+ d.push(n.route);
69
70
  }
70
- return (l, s) => (y(), I("div", {
71
+ return (i, s) => (y(), I("div", {
71
72
  class: "fm-typo-en-link-md-600",
72
73
  onClick: s[0] || (s[0] = (u) => {
73
74
  u.stopPropagation(), o();
74
75
  })
75
- }, C(l.data), 1));
76
+ }, k(i.data), 1));
76
77
  }
77
- }), se = /* @__PURE__ */ h({
78
+ }), le = /* @__PURE__ */ b({
78
79
  __name: "Actions",
79
80
  props: {
80
81
  onAction: { type: Function }
81
82
  },
82
83
  setup(T) {
83
- const a = [
84
+ const n = [
84
85
  {
85
86
  label: "Query",
86
87
  sublabel: "Perform transaction status inquriy",
@@ -94,25 +95,25 @@ const ee = { class: "flex" }, te = ["src"], ae = ["src"], ne = /* @__PURE__ */ h
94
95
  action: "refund"
95
96
  }
96
97
  ];
97
- return (m, o) => {
98
- const l = g("FmIcon"), s = g("FmMenuItem"), u = g("FmMenu");
98
+ return (d, o) => {
99
+ const i = g("FmIcon"), s = g("FmMenuItem"), u = g("FmMenu");
99
100
  return y(), I("div", {
100
- onClick: o[0] || (o[0] = (i) => {
101
- i.stopPropagation();
101
+ onClick: o[0] || (o[0] = (c) => {
102
+ c.stopPropagation();
102
103
  })
103
104
  }, [
104
- p(u, null, {
105
- "menu-button": x(() => [
106
- p(l, { name: "settings" })
105
+ m(u, null, {
106
+ "menu-button": h(() => [
107
+ m(i, { name: "settings" })
107
108
  ]),
108
- default: x(() => [
109
- (y(), I($, null, P(a, (i) => p(s, {
109
+ default: h(() => [
110
+ (y(), I($, null, P(n, (c) => m(s, {
110
111
  selectable: !0,
111
- key: i.label,
112
- sublabel: i.sublabel,
113
- label: i.label,
114
- icon: i.icon,
115
- onclick: () => m.onAction(i.action)
112
+ key: c.label,
113
+ sublabel: c.sublabel,
114
+ label: c.label,
115
+ icon: c.icon,
116
+ onclick: () => d.onAction(c.action)
116
117
  }, null, 8, ["sublabel", "label", "icon", "onclick"])), 64))
117
118
  ]),
118
119
  _: 1
@@ -120,10 +121,10 @@ const ee = { class: "flex" }, te = ["src"], ae = ["src"], ne = /* @__PURE__ */ h
120
121
  ]);
121
122
  };
122
123
  }
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
+ }), 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({
124
125
  __name: "TerminalTransaction",
125
126
  setup(T) {
126
- const a = Y(), m = Q(), o = L(), { dateRange: l, status: s, searchKey: u } = B({
127
+ const n = Y(), d = Q(), o = L(), { dateRange: i, status: s, searchKey: u } = B({
127
128
  searchKey: "",
128
129
  status: [f.F_TERMINAL_TRANSACTION_ACTION.Enum.success],
129
130
  dateRange: {
@@ -131,13 +132,13 @@ const ee = { class: "flex" }, te = ["src"], ae = ["src"], ne = /* @__PURE__ */ h
131
132
  endDate: S().endOf("day").toISOString()
132
133
  }
133
134
  });
134
- R([l, s], () => {
135
+ v([i, s], () => {
135
136
  var e;
136
137
  return (e = o.value) == null ? void 0 : e.reset();
137
138
  });
138
- let i;
139
- R(u, async () => {
140
- i && clearTimeout(i), i = setTimeout(
139
+ let c;
140
+ v(u, async () => {
141
+ c && clearTimeout(c), c = setTimeout(
141
142
  () => {
142
143
  var e;
143
144
  return (e = o.value) == null ? void 0 : e.reset();
@@ -145,11 +146,11 @@ const ee = { class: "flex" }, te = ["src"], ae = ["src"], ne = /* @__PURE__ */ h
145
146
  700
146
147
  );
147
148
  });
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);
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);
151
152
  if (!t) {
152
- a.open({
153
+ n.open({
153
154
  type: "error",
154
155
  title: "Something went wrong",
155
156
  message: "Fail to find transactions from the displayed transactions."
@@ -157,7 +158,7 @@ const ee = { class: "flex" }, te = ["src"], ae = ["src"], ne = /* @__PURE__ */ h
157
158
  return;
158
159
  }
159
160
  if (!t.refId) {
160
- a.open({
161
+ n.open({
161
162
  type: "error",
162
163
  title: "Something went wrong",
163
164
  message: "Transaction isn't a valid transaction to perform query"
@@ -165,24 +166,24 @@ const ee = { class: "flex" }, te = ["src"], ae = ["src"], ne = /* @__PURE__ */ h
165
166
  return;
166
167
  }
167
168
  try {
168
- const n = await b.queryTransaction(t._id);
169
- (_ = o.value) == null || _.replaceData(e, n), a.open({
169
+ const a = await N.queryTransaction(t._id);
170
+ (_ = o.value) == null || _.replaceData(e, a), n.open({
170
171
  type: "success",
171
172
  title: "Transaction queried and updated successfully."
172
173
  });
173
- } catch (n) {
174
- a.open({
174
+ } catch (a) {
175
+ n.open({
175
176
  type: "error",
176
177
  title: "Fail to query transaction.",
177
- message: F(n)
178
+ message: F(a)
178
179
  });
179
180
  }
180
181
  }
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);
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);
184
185
  if (!t) {
185
- a.open({
186
+ n.open({
186
187
  type: "error",
187
188
  title: "Something went wrong",
188
189
  message: "Fail to find transactions from the displayed transactions."
@@ -190,7 +191,7 @@ const ee = { class: "flex" }, te = ["src"], ae = ["src"], ne = /* @__PURE__ */ h
190
191
  return;
191
192
  }
192
193
  if (!t.refId) {
193
- a.open({
194
+ n.open({
194
195
  type: "error",
195
196
  title: "Something went wrong",
196
197
  message: "Transaction isn't a valid transaction to perform refund"
@@ -198,32 +199,32 @@ const ee = { class: "flex" }, te = ["src"], ae = ["src"], ne = /* @__PURE__ */ h
198
199
  return;
199
200
  }
200
201
  Z(
201
- m,
202
+ d,
202
203
  "Refund Transaction",
203
204
  "Are you sure to refund transaction? This action cannot be revert!",
204
205
  async () => {
205
206
  var _;
206
207
  try {
207
- const n = await b.refundTransaction({
208
+ const a = await N.refundTransaction({
208
209
  transactionId: t._id,
209
210
  reason: "portal transaction refund",
210
211
  amount: t.details.amount
211
212
  });
212
- (_ = o.value) == null || _.replaceData(e, n), a.open({
213
+ (_ = o.value) == null || _.replaceData(e, a), n.open({
213
214
  type: "success",
214
215
  title: "Transaction queried and updated successfully."
215
216
  });
216
- } catch (n) {
217
- a.open({
217
+ } catch (a) {
218
+ n.open({
218
219
  type: "error",
219
220
  title: "Fail to query transaction.",
220
- message: F(n)
221
+ message: F(a)
221
222
  });
222
223
  }
223
224
  }
224
225
  );
225
226
  }
226
- const O = [
227
+ const R = [
227
228
  {
228
229
  label: "Success",
229
230
  value: f.F_TERMINAL_TRANSACTION_ACTION.Enum.success
@@ -255,7 +256,7 @@ const ee = { class: "flex" }, te = ["src"], ae = ["src"], ne = /* @__PURE__ */ h
255
256
  ecrGateway: e.ecrGateway,
256
257
  amount: r
257
258
  };
258
- }, M = [
259
+ }, V = [
259
260
  {
260
261
  accessorKey: "id",
261
262
  header: () => "Transaction ID",
@@ -285,7 +286,7 @@ const ee = { class: "flex" }, te = ["src"], ae = ["src"], ne = /* @__PURE__ */ h
285
286
  textAlign: "center",
286
287
  maxWidth: "128px"
287
288
  },
288
- cell: ({ cell: e, row: t }) => A(ne, { row: t, data: e.getValue() })
289
+ cell: ({ cell: e, row: t }) => A(re, { row: t, data: e.getValue() })
289
290
  },
290
291
  {
291
292
  accessorKey: "action",
@@ -294,7 +295,7 @@ const ee = { class: "flex" }, te = ["src"], ae = ["src"], ne = /* @__PURE__ */ h
294
295
  textAlign: "right",
295
296
  maxWidth: "132px"
296
297
  },
297
- cell: ({ cell: e, row: t }) => A(re, { row: t, data: e.getValue() })
298
+ cell: ({ cell: e, row: t }) => A(oe, { row: t, data: e.getValue() })
298
299
  },
299
300
  {
300
301
  accessorKey: "amount",
@@ -311,7 +312,7 @@ const ee = { class: "flex" }, te = ["src"], ae = ["src"], ne = /* @__PURE__ */ h
311
312
  },
312
313
  cell: ({ cell: e, row: t }) => {
313
314
  const r = e.getValue();
314
- return A(oe, {
315
+ return A(se, {
315
316
  data: r,
316
317
  route: {
317
318
  name: "mf-payment-admin.terminal-setting",
@@ -339,14 +340,14 @@ const ee = { class: "flex" }, te = ["src"], ae = ["src"], ne = /* @__PURE__ */ h
339
340
  accessorKey: "actions",
340
341
  cell: ({ row: e }) => {
341
342
  if (e.original.gateway === "ScanPay")
342
- return A(se, {
343
+ return A(le, {
343
344
  onAction: (t) => {
344
345
  const r = e.index;
345
346
  switch (t) {
346
347
  case "query":
347
- return k(r);
348
- case "refund":
349
348
  return E(r);
349
+ case "refund":
350
+ return O(r);
350
351
  }
351
352
  }
352
353
  });
@@ -354,64 +355,73 @@ const ee = { class: "flex" }, te = ["src"], ae = ["src"], ne = /* @__PURE__ */ h
354
355
  }
355
356
  ];
356
357
  return (e, t) => {
357
- const r = g("FmSearch"), d = g("FmSelect"), _ = g("FmSimpleDateRangePicker");
358
- return y(), v(U, {
358
+ const r = g("FmSearch"), p = g("FmSelect"), _ = g("FmSimpleDateRangePicker");
359
+ return y(), C(U, {
359
360
  title: "Offline Transactions",
360
361
  loading: !1
361
362
  }, {
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),
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),
368
369
  class: "mr-8",
369
370
  label: "Search",
370
371
  placeholder: "Search Transactions ..."
371
372
  }, 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),
373
+ m(p, {
374
+ modelValue: l(s),
375
+ "onUpdate:modelValue": t[2] || (t[2] = (a) => x(s) ? s.value = a : null),
375
376
  class: "mr-6 w-[300px]",
376
377
  label: "Status",
377
378
  "label-mark": "required",
378
379
  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),
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),
384
394
  "show-predefined-range": ""
385
395
  }, null, 8, ["modelValue"])
386
396
  ]),
387
- w("div", ce, [
388
- p(H, {
397
+ w("div", ue, [
398
+ m(H, {
389
399
  button: {
390
400
  appendIcon: "file_download",
391
401
  variant: "primary",
392
402
  label: "Export"
393
403
  },
394
404
  handler: async () => {
395
- var n;
396
- return c(b).downloadTransactions(await ((n = o.value) == null ? void 0 : n.allData()) ?? []);
405
+ var a;
406
+ return l(N).downloadTransactions(await ((a = o.value) == null ? void 0 : a.allData()) ?? []);
397
407
  }
398
408
  }, null, 8, ["handler"])
399
409
  ])
400
410
  ]),
401
- p(G, {
411
+ m(G, {
402
412
  ref_key: "controller",
403
413
  ref: o,
404
- "column-defs": M,
414
+ "column-defs": V,
405
415
  "rows-defs": D,
406
- onRowClick: t[3] || (t[3] = () => {
416
+ onRowClick: t[4] || (t[4] = () => {
407
417
  }),
408
- paginate: (n, q) => c(b).readTransactions({
409
- status: c(s),
410
- searchKey: c(u),
411
- limit: n,
412
- cursor: q,
413
- start: c(l).startDate,
414
- end: c(l).endDate
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
415
425
  })
416
426
  }, null, 8, ["paginate"])
417
427
  ]),
@@ -421,5 +431,5 @@ const ee = { class: "flex" }, te = ["src"], ae = ["src"], ne = /* @__PURE__ */ h
421
431
  }
422
432
  });
423
433
  export {
424
- Ne as default
434
+ Re as default
425
435
  };