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

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 (98) hide show
  1. package/README.md +11 -1
  2. package/dist/{AutoCopyCell.vue_vue_type_script_setup_true_lang-GXPXBEf5.js → AutoCopyCell.vue_vue_type_script_setup_true_lang-CdmfrBoW.js} +8 -9
  3. package/dist/DateRangePicker.vue_vue_type_script_setup_true_lang-dP_5WjEJ.js +31 -0
  4. package/dist/PDFViewer-xrBtzrlR.js +22426 -0
  5. package/dist/{PayoutAccount-Dc1CYQ0W.js → PayoutAccount-CyVXI1Sx.js} +93 -83
  6. package/dist/{PayoutAccount-DZaKHWcy.js → PayoutAccount-DGUnImHC.js} +259 -258
  7. package/dist/{PayoutAccountSetting-BzmNuLFj.js → PayoutAccountSetting-BbtOFbsd.js} +161 -183
  8. package/dist/Restaurant-ewsvVw3P.js +262 -0
  9. package/dist/RestaurantSetting-BboKM1iG.js +389 -0
  10. package/dist/SelectAll.vue_vue_type_script_setup_true_lang-DA4rs3tk.js +42 -0
  11. package/dist/{Settlement-Bx3zAkIw.js → Settlement-DsJlFpCC.js} +41 -43
  12. package/dist/Settlement-Hr7jN3EL.js +145 -0
  13. package/dist/{SettlementTransactions-D_SVuKyR.js → SettlementTransactions-BncoGGQ3.js} +10 -10
  14. package/dist/{SettlementTransactions-AaYyTH96.js → SettlementTransactions-Bz9ZVYfq.js} +41 -41
  15. package/dist/{Terminal-68OQnhM3.js → Terminal-D-U0BVTe.js} +117 -103
  16. package/dist/TerminalSetting-JD3sbXOB.js +387 -0
  17. package/dist/TerminalTransaction-B5iY_F-3.js +261 -0
  18. package/dist/TerminalTransaction-DHmD5x8e.js +485 -0
  19. package/dist/{Transaction-a1VfiCP_.js → Transaction-BedQtv8p.js} +125 -127
  20. package/dist/Transaction-DA_TB9zD.js +238 -0
  21. package/dist/api/restaurant/index.d.ts +6 -0
  22. package/dist/{app-C9FRsUfb.js → app-CpyZU23J.js} +315 -285
  23. package/dist/app.js +1 -1
  24. package/dist/{assets-Bji7O2YD.js → assets-8c19wXSV.js} +22 -21
  25. package/dist/components/AdminLayout.vue.d.ts +8 -13
  26. package/dist/components/AutoCopyCell.vue.d.ts +3 -4
  27. package/dist/components/DateRangePicker.vue.d.ts +13 -0
  28. package/dist/components/Layout.vue.d.ts +8 -13
  29. package/dist/components/PDFViewer.vue.d.ts +1 -1
  30. package/dist/components/PagingTable/FmTableSelection.vue.d.ts +13 -0
  31. package/dist/components/PagingTable/index.vue.d.ts +48 -0
  32. package/dist/components/RouteCell.vue.d.ts +5 -6
  33. package/dist/components/SelectAll.vue.d.ts +57 -0
  34. package/dist/helpers/idToDate.d.ts +1 -1
  35. package/dist/{index-Bt_OgDYn.js → index-1fXAFo2E.js} +32176 -32166
  36. package/dist/index-BIXuzGa9.js +19 -0
  37. package/dist/{index-DBfZnaV1.js → index-Cb1zVhcH.js} +1 -1
  38. package/dist/{index-DSuZG0l6.js → index-DEpszFWF.js} +1 -1
  39. package/dist/{index-DjDGwRX8.js → index-DdJrUqkm.js} +1 -1
  40. package/dist/{index-CLYePgWW.js → index-DeU3Qyca.js} +1 -1
  41. package/dist/{index-_0TroOJr.js → index-DoAIw4wM.js} +1 -1
  42. package/dist/index-DsLFmVsY.js +28 -0
  43. package/dist/{index.vue_vue_type_script_setup_true_lang-Jlcg1hAB.js → index.vue_vue_type_script_setup_true_lang-GT2x04Bn.js} +64 -61
  44. package/dist/package.json +2 -2
  45. package/dist/{payout-account-BWcq7OJy.js → payout-account-BbheLTUt.js} +2 -2
  46. package/dist/router/index.d.ts +1 -0
  47. package/dist/stores/iframe.d.ts +1 -1
  48. package/dist/stores/payoutAccount.d.ts +1 -1
  49. package/dist/{transaction-DqrhM5jB.js → transaction-W49zE8RL.js} +26 -16
  50. package/dist/tsconfig.app.tsbuildinfo +1 -1
  51. package/dist/views/admin/payout-account/cell/Bank.vue.d.ts +3 -5
  52. package/dist/views/admin/payout-account/cell/IsActive.vue.d.ts +3 -5
  53. package/dist/views/admin/payout-account/cell/PersonInCharge.vue.d.ts +3 -5
  54. package/dist/views/admin/payout-account/cell/RateInput.vue.d.ts +3 -5
  55. package/dist/views/admin/payout-account/cell/Status.vue.d.ts +3 -5
  56. package/dist/views/admin/payout-account/cell/TPlusInput.vue.d.ts +3 -5
  57. package/dist/views/admin/restaurant/Restaurant.vue.d.ts +2 -0
  58. package/dist/views/admin/restaurant/RestaurantSetting.vue.d.ts +12 -0
  59. package/dist/views/admin/restaurant/cell/IsActive.vue.d.ts +7 -0
  60. package/dist/views/admin/restaurant/tabs/PaymentGateway.vue.d.ts +803 -0
  61. package/dist/views/admin/restaurant/tabs/gateway/FiuuGateway.vue.d.ts +56 -0
  62. package/dist/views/admin/restaurant/tabs/gateway/GhlGateway.vue.d.ts +50 -0
  63. package/dist/views/admin/restaurant/tabs/gateway/RevenueMonsterGateway.vue.d.ts +52 -0
  64. package/dist/views/admin/settlement/cell/Actions.vue.d.ts +4 -6
  65. package/dist/views/admin/settlement/cell/Gateway.vue.d.ts +3 -5
  66. package/dist/views/admin/settlement/cell/Method.vue.d.ts +3 -5
  67. package/dist/views/admin/settlement/cell/Status.vue.d.ts +3 -5
  68. package/dist/views/admin/terminal/TerminalBindCodeDialog.vue.d.ts +1 -1
  69. package/dist/views/admin/terminal/cell/Actions.vue.d.ts +7 -79
  70. package/dist/views/admin/terminal/cell/ID.vue.d.ts +3 -5
  71. package/dist/views/admin/terminal-transaction/cell/Actions.vue.d.ts +3 -4
  72. package/dist/views/admin/terminal-transaction/cell/Gateway.vue.d.ts +3 -5
  73. package/dist/views/admin/terminal-transaction/cell/Status.vue.d.ts +3 -5
  74. package/dist/views/admin/terminal-transaction/cell/Timestamp.vue.d.ts +7 -0
  75. package/dist/views/admin/transaction/cell/Actions.vue.d.ts +3 -4
  76. package/dist/views/admin/transaction/cell/Gateway.vue.d.ts +3 -5
  77. package/dist/views/admin/transaction/cell/Method.vue.d.ts +3 -5
  78. package/dist/views/admin/transaction/cell/Status.vue.d.ts +3 -5
  79. package/dist/views/payout-account/cell/Bank.vue.d.ts +3 -5
  80. package/dist/views/payout-account/cell/IsActive.vue.d.ts +3 -5
  81. package/dist/views/payout-account/cell/PersonInCharge.vue.d.ts +3 -5
  82. package/dist/views/payout-account/cell/Status.vue.d.ts +3 -5
  83. package/dist/views/settlement/cell/Actions.vue.d.ts +4 -6
  84. package/dist/views/settlement/cell/Gateway.vue.d.ts +3 -5
  85. package/dist/views/settlement/cell/Method.vue.d.ts +3 -5
  86. package/dist/views/settlement/cell/Status.vue.d.ts +3 -5
  87. package/dist/views/terminal-transaction/cell/Gateway.vue.d.ts +3 -5
  88. package/dist/views/terminal-transaction/cell/Status.vue.d.ts +3 -5
  89. package/dist/views/transaction/cell/Gateway.vue.d.ts +3 -5
  90. package/dist/views/transaction/cell/Method.vue.d.ts +3 -5
  91. package/dist/views/transaction/cell/Status.vue.d.ts +3 -5
  92. package/package.json +2 -2
  93. package/dist/PDFViewer-CjH_C1uT.js +0 -21792
  94. package/dist/Settlement-mwnO-iYH.js +0 -150
  95. package/dist/TerminalSetting-DEFim0xg.js +0 -379
  96. package/dist/TerminalTransaction-CQjNdffr.js +0 -426
  97. package/dist/TerminalTransaction-ClihmWOJ.js +0 -250
  98. package/dist/Transaction-68L7JzIk.js +0 -242
@@ -1,150 +0,0 @@
1
- import { defineComponent as w, ref as S, computed as D, resolveComponent as h, openBlock as v, createBlock as x, h as A, onMounted as k, watch as F, unref as n, withCtx as V, createElementVNode as p, createVNode as i, isRef as C } from "vue";
2
- import { u as $ } from "./index-Bt_OgDYn.js";
3
- import { h as _ } from "./moment-h96o7c8I.js";
4
- import { useCoreStore as b } from "@feedmepos/mf-common";
5
- import { _ as I } from "./Layout.vue_vue_type_script_setup_true_lang-DJm5br5a.js";
6
- import { s as g } from "./index-_0TroOJr.js";
7
- import "@feedmepos/ui-library";
8
- import { d as f } from "./dinero-CIVmXLL-.js";
9
- import { _ as K } from "./AutoCopyCell.vue_vue_type_script_setup_true_lang-GXPXBEf5.js";
10
- import { useRouter as P } from "vue-router";
11
- import { u as O } from "./index-DjDGwRX8.js";
12
- import { _ as Y } from "./AsyncButton.vue_vue_type_script_setup_true_lang-DcjzvYwT.js";
13
- import { _ as B } from "./RestaurantSelector.vue_vue_type_script_setup_true_lang-CY4ttpKj.js";
14
- const L = /* @__PURE__ */ w({
15
- __name: "SettlementTable",
16
- props: {
17
- data: {
18
- type: Array,
19
- required: !0
20
- },
21
- loading: {
22
- type: Boolean,
23
- required: !0
24
- }
25
- },
26
- emits: ["row-click"],
27
- setup(y, { emit: d }) {
28
- const e = y, r = d, s = S(""), c = [
29
- {
30
- header: () => "Settlement ID",
31
- accessorKey: "id",
32
- cell: ({ cell: t }) => A(K, { data: t.getValue() })
33
- },
34
- {
35
- header: () => "Created At",
36
- accessorKey: "transactionAt",
37
- meta: {
38
- width: "180px"
39
- }
40
- },
41
- {
42
- header: () => "Sales Amount",
43
- accessorKey: "amount"
44
- },
45
- {
46
- header: () => "Fee",
47
- accessorKey: "fee"
48
- },
49
- {
50
- header: () => "Settlement Amount",
51
- accessorKey: "payout"
52
- }
53
- ], l = D(() => e.data.map((t) => ({
54
- id: t._id,
55
- transactionAt: _(t.createdAt).format("YYYY-MM-DD"),
56
- amount: f(t.totalAmount).toFormat("$0.00"),
57
- fee: f(t.totalFee).toFormat("$0.00"),
58
- payout: f(t.totalPayout).toFormat("$0.00")
59
- })));
60
- return (t, o) => {
61
- const m = h("FmTable");
62
- return v(), x(m, {
63
- modelValue: s.value,
64
- "onUpdate:modelValue": o[0] || (o[0] = (a) => s.value = a),
65
- "row-data": l.value,
66
- "column-defs": c,
67
- loading: e.loading,
68
- onRowClick: o[1] || (o[1] = (a) => r("row-click", e.data.at(a.index)))
69
- }, null, 8, ["modelValue", "row-data", "loading"]);
70
- };
71
- }
72
- }), M = { class: "flex justify-between items-center mb-6" }, T = { class: "flex space-x-8 items-center" }, q = { class: "flex space-x-4 items-center" }, te = /* @__PURE__ */ w({
73
- __name: "Settlement",
74
- setup(y) {
75
- const d = P(), { dateRange: e } = O({
76
- dateRange: {
77
- startDate: _().startOf("day").toISOString(),
78
- endDate: _().endOf("day").toISOString()
79
- }
80
- }), { isLoading: r, startAsyncCall: s } = $(!0), { currentRestaurant: c } = b(), l = S([]);
81
- async function t() {
82
- await s(async () => {
83
- const m = await g.readRestaurantSettlements(
84
- {
85
- start: e.value.startDate,
86
- end: e.value.endDate
87
- }
88
- );
89
- l.value = m;
90
- });
91
- }
92
- function o() {
93
- t();
94
- }
95
- return k(o), F(c, o), (m, a) => {
96
- const R = h("FmDateRangePicker");
97
- return v(), x(I, {
98
- title: "Settlements",
99
- description: "Settlements are the finalization of financial transactions, transferring funds to complete payments.",
100
- loading: n(r)
101
- }, {
102
- default: V(() => [
103
- p("div", M, [
104
- p("div", T, [
105
- i(B),
106
- i(R, {
107
- modelValue: n(e),
108
- "onUpdate:modelValue": [
109
- a[0] || (a[0] = (u) => C(e) ? e.value = u : null),
110
- t
111
- ],
112
- compare: "",
113
- "show-predefined-range": ""
114
- }, null, 8, ["modelValue"])
115
- ]),
116
- p("div", q, [
117
- i(Y, {
118
- button: {
119
- appendIcon: "file_download",
120
- variant: "primary",
121
- label: "Export"
122
- },
123
- handler: async () => {
124
- await n(g).downloadRestaurantSettlementReport({
125
- start: n(e).startDate,
126
- end: n(e).endDate
127
- });
128
- }
129
- }, null, 8, ["handler"])
130
- ])
131
- ]),
132
- i(L, {
133
- loading: n(r),
134
- data: l.value,
135
- onRowClick: a[1] || (a[1] = (u) => n(d).push({
136
- name: "mf-payment-settlement-transaction",
137
- params: {
138
- settlementId: u._id
139
- }
140
- }))
141
- }, null, 8, ["loading", "data"])
142
- ]),
143
- _: 1
144
- }, 8, ["loading"]);
145
- };
146
- }
147
- });
148
- export {
149
- te as default
150
- };
@@ -1,379 +0,0 @@
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-Bt_OgDYn.js";
3
- import { useRouter as L } from "vue-router";
4
- import { t as S } from "./index-CLYePgWW.js";
5
- import { _ as j } from "./Layout.vue_vue_type_script_setup_true_lang-DJm5br5a.js";
6
- import { u as E } from "./index-DjDGwRX8.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
- };