@feedmepos/mf-payment 1.0.0-beta.9 → 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 (43) hide show
  1. package/dist/{AutoCopyCell.vue_vue_type_script_setup_true_lang-GXPXBEf5.js → AutoCopyCell.vue_vue_type_script_setup_true_lang-CdmfrBoW.js} +8 -9
  2. package/dist/{PayoutAccount-_d3TfUSc.js → PayoutAccount-CyVXI1Sx.js} +5 -5
  3. package/dist/{PayoutAccount-DgN3EHTj.js → PayoutAccount-DGUnImHC.js} +4 -4
  4. package/dist/{PayoutAccountSetting-CmgVLhdp.js → PayoutAccountSetting-BbtOFbsd.js} +161 -183
  5. package/dist/Restaurant-ewsvVw3P.js +262 -0
  6. package/dist/RestaurantSetting-BboKM1iG.js +389 -0
  7. package/dist/{Settlement-B1-WmCwC.js → Settlement-DsJlFpCC.js} +4 -4
  8. package/dist/{Settlement-BSOQRlp1.js → Settlement-Hr7jN3EL.js} +4 -4
  9. package/dist/{SettlementTransactions-Cqd2raea.js → SettlementTransactions-BncoGGQ3.js} +10 -10
  10. package/dist/{SettlementTransactions-JTwD_Vuq.js → SettlementTransactions-Bz9ZVYfq.js} +41 -41
  11. package/dist/{Terminal-De69bTKY.js → Terminal-D-U0BVTe.js} +121 -108
  12. package/dist/{TerminalSetting-DlRHaEZh.js → TerminalSetting-JD3sbXOB.js} +3 -3
  13. package/dist/{TerminalTransaction-CZCsCpEp.js → TerminalTransaction-B5iY_F-3.js} +18 -18
  14. package/dist/{TerminalTransaction-C1egvX6I.js → TerminalTransaction-DHmD5x8e.js} +12 -12
  15. package/dist/{Transaction-B3ZWKg6Q.js → Transaction-BedQtv8p.js} +64 -64
  16. package/dist/{Transaction-B_0nUmpf.js → Transaction-DA_TB9zD.js} +11 -11
  17. package/dist/api/restaurant/index.d.ts +6 -0
  18. package/dist/{app-B-XC_fSK.js → app-CpyZU23J.js} +164 -147
  19. package/dist/app.js +1 -1
  20. package/dist/{assets-BCAivOTo.js → assets-8c19wXSV.js} +22 -21
  21. package/dist/components/PagingTable/FmTableSelection.vue.d.ts +13 -0
  22. package/dist/components/PagingTable/index.vue.d.ts +48 -0
  23. package/dist/{index-4meiCsRz.js → index-1fXAFo2E.js} +31211 -31211
  24. package/dist/index-BIXuzGa9.js +19 -0
  25. package/dist/{index-BFYq3eq8.js → index-Cb1zVhcH.js} +1 -1
  26. package/dist/{index-CbsnpMWl.js → index-DEpszFWF.js} +1 -1
  27. package/dist/{index-BwFHcZlm.js → index-DdJrUqkm.js} +1 -1
  28. package/dist/{index-CBa6eapm.js → index-DeU3Qyca.js} +1 -1
  29. package/dist/{index-CETCXB6X.js → index-DoAIw4wM.js} +1 -1
  30. package/dist/index-DsLFmVsY.js +28 -0
  31. package/dist/{index.vue_vue_type_script_setup_true_lang-CKOlikHb.js → index.vue_vue_type_script_setup_true_lang-GT2x04Bn.js} +64 -61
  32. package/dist/package.json +2 -2
  33. package/dist/{payout-account-CKhGpN_d.js → payout-account-BbheLTUt.js} +2 -2
  34. package/dist/{transaction-COjHU7aN.js → transaction-W49zE8RL.js} +3 -3
  35. package/dist/tsconfig.app.tsbuildinfo +1 -1
  36. package/dist/views/admin/restaurant/Restaurant.vue.d.ts +2 -0
  37. package/dist/views/admin/restaurant/RestaurantSetting.vue.d.ts +12 -0
  38. package/dist/views/admin/restaurant/cell/IsActive.vue.d.ts +7 -0
  39. package/dist/views/admin/restaurant/tabs/PaymentGateway.vue.d.ts +803 -0
  40. package/dist/views/admin/restaurant/tabs/gateway/FiuuGateway.vue.d.ts +56 -0
  41. package/dist/views/admin/restaurant/tabs/gateway/GhlGateway.vue.d.ts +50 -0
  42. package/dist/views/admin/restaurant/tabs/gateway/RevenueMonsterGateway.vue.d.ts +52 -0
  43. package/package.json +2 -2
@@ -0,0 +1,262 @@
1
+ import { defineComponent as B, ref as g, resolveComponent as y, openBlock as h, createBlock as A, withCtx as P, createVNode as v, createElementVNode as i, normalizeStyle as L, createElementBlock as D, Fragment as z, renderList as N, computed as C, watch as I, onMounted as E, unref as b, toDisplayString as V, normalizeClass as W, isRef as q, h as $ } from "vue";
2
+ import { u as j } from "./index-DdJrUqkm.js";
3
+ import { _ as O } from "./AdminLayout.vue_vue_type_script_setup_true_lang-BTmMOzwx.js";
4
+ import "@feedmepos/ui-library";
5
+ import { u as Q } from "./index-1fXAFo2E.js";
6
+ import { _ as G } from "./AutoCopyCell.vue_vue_type_script_setup_true_lang-CdmfrBoW.js";
7
+ import { r as H } from "./index-BIXuzGa9.js";
8
+ import { useRouter as J } from "vue-router";
9
+ const X = ["id"], R = /* @__PURE__ */ B({
10
+ __name: "FmTableSelection",
11
+ props: {
12
+ value: {},
13
+ items: {}
14
+ },
15
+ emits: ["update:modelValue"],
16
+ setup(f, { emit: l }) {
17
+ const m = l, c = f, u = g(!1);
18
+ return (_, d) => {
19
+ const o = y("FmButton"), n = y("FmMenuItem"), x = y("FmMenu");
20
+ return h(), A(x, {
21
+ "max-height": 264,
22
+ shift: "",
23
+ onMenuChanged: d[0] || (d[0] = (e) => u.value = e)
24
+ }, {
25
+ "menu-button": P(() => {
26
+ var e;
27
+ return [
28
+ v(o, {
29
+ icon: u.value ? "expand_less" : "expand_more",
30
+ label: (e = _.items.find((t) => t.value === c.value)) == null ? void 0 : e.label,
31
+ "icon-position": "append",
32
+ size: "md",
33
+ variant: "tertiary"
34
+ }, null, 8, ["icon", "label"])
35
+ ];
36
+ }),
37
+ "menu-wrapper": P(({ maxHeight: e }) => [
38
+ i("div", {
39
+ id: `menu-wrapper-${e}`,
40
+ style: L({ maxHeight: `${e}px` }),
41
+ class: "bg-fm-color-neutral-white flex flex-col overflow-y-auto px-4 py-12 rounded-md shadow-light-300 w-[75px]"
42
+ }, [
43
+ (h(!0), D(z, null, N(_.items, (t) => (h(), A(n, {
44
+ key: t.value,
45
+ label: t.label,
46
+ value: t.value,
47
+ "model-value": t.value === c.value,
48
+ "onUpdate:modelValue": (w) => m("update:modelValue", t.value)
49
+ }, null, 8, ["label", "value", "model-value", "onUpdate:modelValue"]))), 128))
50
+ ], 12, X)
51
+ ]),
52
+ _: 1
53
+ });
54
+ };
55
+ }
56
+ }), Y = { class: "basis-72 bg-white flex items-center justify-between px-24 pt-6" }, Z = { class: "flex gap-24 items-center justify-between xs:hidden xs:invisible" }, ee = { class: "flex gap-8 items-center" }, te = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary xs:hidden xs:invisible" }, ae = {
57
+ class: /* @__PURE__ */ W(["flex gap-8 items-center"])
58
+ }, oe = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-primary xs:mr-auto" }, ne = { class: "flex gap-8" }, le = /* @__PURE__ */ B({
59
+ __name: "index",
60
+ props: {
61
+ columnDefs: {
62
+ type: Array,
63
+ required: !0
64
+ },
65
+ rowsDefs: {
66
+ type: Function,
67
+ required: !0
68
+ },
69
+ paginate: {
70
+ type: Function,
71
+ required: !0
72
+ }
73
+ },
74
+ emits: ["row-click"],
75
+ setup(f, { expose: l, emit: m }) {
76
+ const c = [10, 20, 30, 50, 100].map((p) => ({
77
+ label: p.toString(),
78
+ value: p
79
+ })), u = f, _ = m, { isLoading: d, startLoading: o, stopLoading: n } = Q(!0), x = g(), e = g(), t = g(10), w = g(0), s = g(1), F = async function(p = !1) {
80
+ o(), p && (e.value = [], s.value = 1);
81
+ const a = await u.paginate(t.value, s.value);
82
+ e.value = a.resources, w.value = a.meta.totalPages ?? 1, n();
83
+ }, M = C(() => s.value > 1), T = C(() => s.value < w.value), U = C(() => {
84
+ var p;
85
+ return (p = e.value) == null ? void 0 : p.map(u.rowsDefs);
86
+ });
87
+ return I(t, () => F(!0)), I(s, () => F()), E(() => F()), l({
88
+ reset: () => F(!0)
89
+ }), (p, a) => {
90
+ const K = y("FmTable"), S = y("FmButton");
91
+ return h(), D(z, null, [
92
+ v(K, {
93
+ modelValue: x.value,
94
+ "onUpdate:modelValue": a[0] || (a[0] = (r) => x.value = r),
95
+ loading: b(d),
96
+ "page-size": t.value,
97
+ "row-data": U.value,
98
+ "column-defs": f.columnDefs,
99
+ "hide-footer": !0,
100
+ onRowClick: a[1] || (a[1] = (r) => {
101
+ var k;
102
+ return _("row-click", (k = e.value) == null ? void 0 : k.at(r.index));
103
+ })
104
+ }, null, 8, ["modelValue", "loading", "page-size", "row-data", "column-defs"]),
105
+ i("div", Y, [
106
+ i("div", Z, [
107
+ i("div", ee, [
108
+ a[6] || (a[6] = i("span", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-primary" }, " Items per page: ", -1)),
109
+ v(R, {
110
+ items: b(c),
111
+ value: t.value,
112
+ "onUpdate:modelValue": a[2] || (a[2] = (r) => t.value = r)
113
+ }, null, 8, ["items", "value"])
114
+ ]),
115
+ i("span", te, V((s.value - 1) * t.value) + " - " + V((s.value - 1) * t.value + t.value), 1)
116
+ ]),
117
+ i("div", ae, [
118
+ v(R, {
119
+ items: Array.from(Array(w.value), (r, k) => k + 1).map(
120
+ (r) => ({
121
+ label: r.toString(),
122
+ value: r
123
+ })
124
+ ),
125
+ value: s.value,
126
+ "onUpdate:modelValue": a[3] || (a[3] = (r) => s.value = r)
127
+ }, null, 8, ["items", "value"]),
128
+ i("span", oe, " Page " + V(s.value) + " of " + V(w.value), 1),
129
+ i("div", ne, [
130
+ v(S, {
131
+ disabled: !M.value,
132
+ icon: "chevron_left",
133
+ "icon-color": "neutral-black",
134
+ variant: "tertiary",
135
+ onClick: a[4] || (a[4] = () => s.value -= 1)
136
+ }, null, 8, ["disabled"]),
137
+ v(S, {
138
+ disabled: !T.value,
139
+ icon: "chevron_right",
140
+ "icon-color": "neutral-black",
141
+ variant: "tertiary",
142
+ onClick: a[5] || (a[5] = () => s.value += 1)
143
+ }, null, 8, ["disabled"])
144
+ ])
145
+ ])
146
+ ])
147
+ ], 64);
148
+ };
149
+ }
150
+ }), se = /* @__PURE__ */ B({
151
+ __name: "IsActive",
152
+ props: {
153
+ row: {},
154
+ data: {}
155
+ },
156
+ setup(f) {
157
+ const l = f;
158
+ function m() {
159
+ return l.data ? "#66BB6A" : "#EF5350";
160
+ }
161
+ function c() {
162
+ return l.data ? "check" : "close";
163
+ }
164
+ return (u, _) => {
165
+ const d = y("FmIcon");
166
+ return h(), A(d, {
167
+ name: c(),
168
+ color: m(),
169
+ size: "lg"
170
+ }, null, 8, ["name", "color"]);
171
+ };
172
+ }
173
+ }), re = { class: "flex items-start mb-6" }, _e = /* @__PURE__ */ B({
174
+ __name: "Restaurant",
175
+ setup(f) {
176
+ const { searchKey: l } = j({
177
+ searchKey: ""
178
+ }), m = g(), c = J();
179
+ let u;
180
+ I(l, async () => {
181
+ u && clearTimeout(u), u = setTimeout(
182
+ () => {
183
+ var o;
184
+ return (o = m.value) == null ? void 0 : o.reset();
185
+ },
186
+ 700
187
+ );
188
+ });
189
+ const _ = function(o) {
190
+ const n = o.payoutAccount;
191
+ return {
192
+ id: o._id,
193
+ name: o.profile.name,
194
+ hasPayoutAccount: (n == null ? void 0 : n.enable) && n.status != "NEW"
195
+ };
196
+ }, d = [
197
+ {
198
+ header: () => "ID",
199
+ accessorKey: "id",
200
+ cell: ({ cell: o }) => $(G, { data: o.getValue() }),
201
+ meta: {
202
+ maxWidth: "72px",
203
+ textAlign: "right"
204
+ }
205
+ },
206
+ {
207
+ header: () => "Name",
208
+ accessorKey: "name"
209
+ },
210
+ {
211
+ header: () => "Account?",
212
+ accessorKey: "hasPayoutAccount",
213
+ meta: {
214
+ maxWidth: "64px"
215
+ },
216
+ cell: ({ cell: o, row: n }) => $(se, { row: n, data: o.getValue() })
217
+ }
218
+ ];
219
+ return (o, n) => {
220
+ const x = y("FmSearch");
221
+ return h(), A(O, {
222
+ title: "Restaurants",
223
+ loading: !1
224
+ }, {
225
+ default: P(() => [
226
+ i("div", re, [
227
+ v(x, {
228
+ "model-value": b(l),
229
+ "onUpdate:modelValue": n[0] || (n[0] = (e) => q(l) ? l.value = e : null),
230
+ class: "mr-8",
231
+ label: "Search",
232
+ placeholder: "Search Restaurants ..."
233
+ }, null, 8, ["model-value"])
234
+ ]),
235
+ v(le, {
236
+ ref_key: "controller",
237
+ ref: m,
238
+ "column-defs": d,
239
+ "rows-defs": _,
240
+ paginate: (e, t) => b(H).readRestaurantWithPagination({
241
+ limit: e,
242
+ skip: t - 1,
243
+ sortBy: "name",
244
+ search: b(l),
245
+ descending: !1
246
+ }),
247
+ onRowClick: n[1] || (n[1] = (e) => b(c).push({
248
+ name: "mf-payment-admin.restaurant-settings",
249
+ params: {
250
+ restaurantId: e._id
251
+ }
252
+ }))
253
+ }, null, 8, ["paginate"])
254
+ ]),
255
+ _: 1
256
+ });
257
+ };
258
+ }
259
+ });
260
+ export {
261
+ _e as default
262
+ };
@@ -0,0 +1,389 @@
1
+ import { defineComponent as S, ref as U, resolveComponent as i, openBlock as v, createBlock as V, withCtx as k, createVNode as u, unref as a, createElementVNode as T, createCommentVNode as C, onMounted as D, computed as K, createElementBlock as R, Fragment as E, resolveDynamicComponent as P, normalizeProps as q, mergeProps as O, isRef as M } from "vue";
2
+ import { u as B, e as I } from "./index-1fXAFo2E.js";
3
+ import { _ as N } from "./Layout.vue_vue_type_script_setup_true_lang-DJm5br5a.js";
4
+ import { useRouter as Y } from "vue-router";
5
+ import { u as $ } from "./index-DdJrUqkm.js";
6
+ import { p as x } from "./index-DsLFmVsY.js";
7
+ import { z as p, a as y } from "./validator-D5jtpt9A.js";
8
+ import { useCoreStore as A } from "@feedmepos/mf-common";
9
+ import { r as L } from "./index-BIXuzGa9.js";
10
+ const j = { class: "flex mt-6 space-x-6" }, z = /* @__PURE__ */ S({
11
+ __name: "FiuuGateway",
12
+ props: {
13
+ onUpdate: {
14
+ type: Function,
15
+ required: !0
16
+ },
17
+ onDelete: {
18
+ type: Function,
19
+ required: !0
20
+ },
21
+ gateway: {
22
+ type: Object,
23
+ required: !0
24
+ }
25
+ },
26
+ setup(n) {
27
+ var d;
28
+ const t = U(((d = n.gateway) == null ? void 0 : d.config) || {
29
+ merchantId: "",
30
+ uniqueId: "",
31
+ verifyKey: "",
32
+ secretKey: "",
33
+ applicationCode: "",
34
+ offlineSecret: ""
35
+ });
36
+ return (b, e) => {
37
+ const l = i("FmTextField"), g = i("FmButton"), F = i("FmForm");
38
+ return v(), V(F, {
39
+ ref: "form",
40
+ class: "flex flex-col gap-16",
41
+ onValidationSuccess: e[6] || (e[6] = () => n.onUpdate(t.value))
42
+ }, {
43
+ default: k(() => [
44
+ u(l, {
45
+ modelValue: t.value.merchantId,
46
+ "onUpdate:modelValue": e[0] || (e[0] = (r) => t.value.merchantId = r),
47
+ label: "Merchant ID",
48
+ rules: a(p)(a(y).string())
49
+ }, null, 8, ["modelValue", "rules"]),
50
+ u(l, {
51
+ modelValue: t.value.uniqueId,
52
+ "onUpdate:modelValue": e[1] || (e[1] = (r) => t.value.uniqueId = r),
53
+ label: "Unique ID",
54
+ rules: a(p)(a(y).string())
55
+ }, null, 8, ["modelValue", "rules"]),
56
+ u(l, {
57
+ modelValue: t.value.verifyKey,
58
+ "onUpdate:modelValue": e[2] || (e[2] = (r) => t.value.verifyKey = r),
59
+ label: "Verify Key",
60
+ rules: a(p)(a(y).string())
61
+ }, null, 8, ["modelValue", "rules"]),
62
+ u(l, {
63
+ modelValue: t.value.secretKey,
64
+ "onUpdate:modelValue": e[3] || (e[3] = (r) => t.value.secretKey = r),
65
+ label: "Secret Key",
66
+ rules: a(p)(a(y).string())
67
+ }, null, 8, ["modelValue", "rules"]),
68
+ u(l, {
69
+ modelValue: t.value.applicationCode,
70
+ "onUpdate:modelValue": e[4] || (e[4] = (r) => t.value.applicationCode = r),
71
+ label: "Application Code ( Offline )",
72
+ rules: a(p)(a(y).string())
73
+ }, null, 8, ["modelValue", "rules"]),
74
+ u(l, {
75
+ modelValue: t.value.offlineSecret,
76
+ "onUpdate:modelValue": e[5] || (e[5] = (r) => t.value.offlineSecret = r),
77
+ label: "Offline Secret ( Offline )",
78
+ rules: a(p)(a(y).string())
79
+ }, null, 8, ["modelValue", "rules"]),
80
+ T("div", j, [
81
+ n.gateway ? (v(), V(g, {
82
+ key: 0,
83
+ class: "flex-1",
84
+ variant: "secondary",
85
+ label: "Delete",
86
+ onclick: () => n.onDelete(n.gateway)
87
+ }, null, 8, ["onclick"])) : C("", !0),
88
+ u(g, {
89
+ type: "submit",
90
+ class: "flex-1",
91
+ variant: "primary",
92
+ label: "Save"
93
+ })
94
+ ])
95
+ ]),
96
+ _: 1
97
+ }, 512);
98
+ };
99
+ }
100
+ }), H = { class: "flex mt-6 space-x-6" }, Q = /* @__PURE__ */ S({
101
+ __name: "RevenueMonsterGateway",
102
+ props: {
103
+ onUpdate: {
104
+ type: Function,
105
+ required: !0
106
+ },
107
+ onDelete: {
108
+ type: Function,
109
+ required: !0
110
+ },
111
+ gateway: {
112
+ type: Object,
113
+ required: !0
114
+ }
115
+ },
116
+ setup(n) {
117
+ var d;
118
+ const t = U(((d = n.gateway) == null ? void 0 : d.config) || {
119
+ storeId: "",
120
+ clientId: "",
121
+ clientSecret: "",
122
+ clientPrivateKey: ""
123
+ });
124
+ return (b, e) => {
125
+ const l = i("FmTextField"), g = i("FmTextarea"), F = i("FmButton"), r = i("FmForm");
126
+ return v(), V(r, {
127
+ ref: "form",
128
+ class: "flex flex-col gap-16",
129
+ onValidationSuccess: e[4] || (e[4] = () => n.onUpdate(t.value))
130
+ }, {
131
+ default: k(() => [
132
+ u(l, {
133
+ modelValue: t.value.storeId,
134
+ "onUpdate:modelValue": e[0] || (e[0] = (o) => t.value.storeId = o),
135
+ label: "Store ID",
136
+ rules: a(p)(a(y).string())
137
+ }, null, 8, ["modelValue", "rules"]),
138
+ u(l, {
139
+ modelValue: t.value.clientId,
140
+ "onUpdate:modelValue": e[1] || (e[1] = (o) => t.value.clientId = o),
141
+ label: "Client ID",
142
+ rules: a(p)(a(y).string())
143
+ }, null, 8, ["modelValue", "rules"]),
144
+ u(l, {
145
+ modelValue: t.value.clientSecret,
146
+ "onUpdate:modelValue": e[2] || (e[2] = (o) => t.value.clientSecret = o),
147
+ label: "Client Secret",
148
+ rules: a(p)(a(y).string())
149
+ }, null, 8, ["modelValue", "rules"]),
150
+ u(g, {
151
+ modelValue: t.value.clientPrivateKey,
152
+ "onUpdate:modelValue": e[3] || (e[3] = (o) => t.value.clientPrivateKey = o),
153
+ label: "Client Private Key"
154
+ }, null, 8, ["modelValue"]),
155
+ T("div", H, [
156
+ n.gateway ? (v(), V(F, {
157
+ key: 0,
158
+ class: "flex-1",
159
+ variant: "secondary",
160
+ label: "Delete",
161
+ onclick: () => n.onDelete(n.gateway)
162
+ }, null, 8, ["onclick"])) : C("", !0),
163
+ u(F, {
164
+ type: "submit",
165
+ class: "flex-1",
166
+ variant: "primary",
167
+ label: "Save"
168
+ })
169
+ ])
170
+ ]),
171
+ _: 1
172
+ }, 512);
173
+ };
174
+ }
175
+ }), Z = { class: "flex mt-6 space-x-6" }, J = /* @__PURE__ */ S({
176
+ __name: "GhlGateway",
177
+ props: {
178
+ onUpdate: {
179
+ type: Function,
180
+ required: !0
181
+ },
182
+ onDelete: {
183
+ type: Function,
184
+ required: !0
185
+ },
186
+ gateway: {
187
+ type: Object,
188
+ required: !0
189
+ }
190
+ },
191
+ setup(n) {
192
+ var d;
193
+ const t = U(((d = n.gateway) == null ? void 0 : d.config) || {
194
+ merchantId: "",
195
+ terminalId: "",
196
+ privateKey: ""
197
+ });
198
+ return (b, e) => {
199
+ const l = i("FmTextField"), g = i("FmTextarea"), F = i("FmButton"), r = i("FmForm");
200
+ return v(), V(r, {
201
+ ref: "form",
202
+ class: "flex flex-col gap-16",
203
+ onValidationSuccess: e[3] || (e[3] = () => n.onUpdate(t.value))
204
+ }, {
205
+ default: k(() => [
206
+ u(l, {
207
+ modelValue: t.value.merchantId,
208
+ "onUpdate:modelValue": e[0] || (e[0] = (o) => t.value.merchantId = o),
209
+ label: "Merchant ID",
210
+ rules: a(p)(a(y).string())
211
+ }, null, 8, ["modelValue", "rules"]),
212
+ u(l, {
213
+ modelValue: t.value.terminalId,
214
+ "onUpdate:modelValue": e[1] || (e[1] = (o) => t.value.terminalId = o),
215
+ label: "Terminal ID",
216
+ rules: a(p)(a(y).string())
217
+ }, null, 8, ["modelValue", "rules"]),
218
+ u(g, {
219
+ modelValue: t.value.privateKey,
220
+ "onUpdate:modelValue": e[2] || (e[2] = (o) => t.value.privateKey = o),
221
+ label: "Private Key",
222
+ rules: a(p)(a(y).string())
223
+ }, null, 8, ["modelValue", "rules"]),
224
+ T("div", Z, [
225
+ n.gateway ? (v(), V(F, {
226
+ key: 0,
227
+ class: "flex-1",
228
+ variant: "secondary",
229
+ label: "Delete",
230
+ onclick: () => n.onDelete(n.gateway)
231
+ }, null, 8, ["onclick"])) : C("", !0),
232
+ u(F, {
233
+ type: "submit",
234
+ class: "flex-1",
235
+ variant: "primary",
236
+ label: "Save"
237
+ })
238
+ ])
239
+ ]),
240
+ _: 1
241
+ }, 512);
242
+ };
243
+ }
244
+ }), W = {
245
+ key: 0,
246
+ class: "flex items-center justify-center min-h-[80vh]"
247
+ }, X = /* @__PURE__ */ S({
248
+ __name: "PaymentGateway",
249
+ props: {
250
+ restaurant: {
251
+ type: Object,
252
+ required: !0
253
+ }
254
+ },
255
+ setup(n) {
256
+ const f = n, t = A(), { isLoading: d, startAsyncCall: b } = B(), e = U(), l = U([]);
257
+ function g() {
258
+ b(async () => {
259
+ var c;
260
+ l.value = await x.get(f.restaurant._id), e.value = (c = l.value.find((s) => s.active)) == null ? void 0 : c.paymentGateway;
261
+ });
262
+ }
263
+ async function F(c) {
264
+ b(async () => {
265
+ var G;
266
+ const s = {
267
+ _id: "",
268
+ _rev: "",
269
+ paymentGateway: e.value,
270
+ config: c,
271
+ active: !0
272
+ }, w = l.value.find((m) => m.paymentGateway === e.value);
273
+ w && (s._id = w._id, s._rev = w._rev), await Promise.all(
274
+ l.value.map(async (m) => {
275
+ m.active && m.paymentGateway !== s.paymentGateway && await x.upsert(f.restaurant._id, {
276
+ ...m,
277
+ active: !1
278
+ });
279
+ })
280
+ ), await x.upsert(f.restaurant._id, s), l.value = await x.get(f.restaurant._id), e.value = (G = l.value.find((m) => m.active)) == null ? void 0 : G.paymentGateway;
281
+ });
282
+ }
283
+ async function r(c) {
284
+ b(async () => {
285
+ var s;
286
+ await x.delete(f.restaurant._id, c._id), l.value = await x.get(f.restaurant._id), e.value = (s = l.value.find((w) => w.active)) == null ? void 0 : s.paymentGateway;
287
+ });
288
+ }
289
+ D(g);
290
+ const o = [
291
+ {
292
+ label: "Fiuu",
293
+ value: "RAZER_MERCHANT_SERVICE",
294
+ form: z,
295
+ region: [I.F_COUNTRY.enum.MY, I.F_COUNTRY.enum.SG]
296
+ },
297
+ {
298
+ label: "Revenue Monster",
299
+ value: "REVENUE_MONSTER",
300
+ form: Q,
301
+ region: [I.F_COUNTRY.enum.MY]
302
+ },
303
+ {
304
+ label: "GHL",
305
+ value: "E_GHL",
306
+ form: J,
307
+ region: [I.F_COUNTRY.enum.MY]
308
+ }
309
+ ], _ = K(() => {
310
+ var c;
311
+ return (c = o.find((s) => s.value === e.value)) == null ? void 0 : c.form;
312
+ });
313
+ return (c, s) => {
314
+ const w = i("FmCircularProgress"), G = i("FmSelect");
315
+ return v(), R(E, null, [
316
+ a(d) ? (v(), R("div", W, [
317
+ u(w, { size: "xxl" })
318
+ ])) : (v(), V(G, {
319
+ key: 1,
320
+ modelValue: e.value,
321
+ "onUpdate:modelValue": s[0] || (s[0] = (m) => e.value = m),
322
+ class: "mb-6",
323
+ label: "Payment Service Provider",
324
+ items: o.filter((m) => m.region.includes(a(t).currentCountry.value ?? a(I.F_COUNTRY).enum.MY))
325
+ }, null, 8, ["modelValue", "items"])),
326
+ e.value ? (v(), V(P(_.value), q(O({ key: 2 }, {
327
+ gateway: l.value.find((m) => m.paymentGateway === e.value),
328
+ onDelete: r,
329
+ onUpdate: F
330
+ })), null, 16)) : C("", !0)
331
+ ], 64);
332
+ };
333
+ }
334
+ }), se = /* @__PURE__ */ S({
335
+ __name: "RestaurantSetting",
336
+ props: {
337
+ restaurantId: {
338
+ type: String,
339
+ required: !0
340
+ }
341
+ },
342
+ setup(n) {
343
+ const f = n, { tab: t } = $({
344
+ tab: "payment-gateway"
345
+ }), { isLoading: d, startAsyncCall: b } = B(!0), e = Y(), l = U(), g = [
346
+ {
347
+ label: "Payment Gateway",
348
+ value: "payment-gateway",
349
+ icon: "assured_workload",
350
+ render: X
351
+ }
352
+ ];
353
+ function F() {
354
+ b(async () => {
355
+ l.value = await L.readRestaurantById(f.restaurantId);
356
+ });
357
+ }
358
+ D(F);
359
+ const r = K(() => {
360
+ var o;
361
+ return (o = g.find((_) => _.value === t.value)) == null ? void 0 : o.render;
362
+ });
363
+ return (o, _) => {
364
+ var s;
365
+ const c = i("FmTabs");
366
+ return v(), V(N, {
367
+ title: `Restaurant (${(s = l.value) == null ? void 0 : s._id})`,
368
+ loading: a(d),
369
+ onBack: a(e).back
370
+ }, {
371
+ default: k(() => [
372
+ u(c, {
373
+ "model-value": a(t),
374
+ "onUpdate:modelValue": _[0] || (_[0] = (w) => M(t) ? t.value = w : null),
375
+ class: "mb-6",
376
+ items: g
377
+ }, null, 8, ["model-value"]),
378
+ a(t) && l.value ? (v(), V(P(r.value), q(O({ key: 0 }, {
379
+ restaurant: l.value
380
+ })), null, 16)) : C("", !0)
381
+ ]),
382
+ _: 1
383
+ }, 8, ["title", "loading", "onBack"]);
384
+ };
385
+ }
386
+ });
387
+ export {
388
+ se as default
389
+ };
@@ -1,13 +1,13 @@
1
1
  import { defineComponent as C, ref as h, computed as x, resolveComponent as d, openBlock as k, createBlock as A, h as B, watch as V, onMounted as I, unref as a, withCtx as b, createElementVNode as y, createVNode as s, isRef as $, createElementBlock as L, Fragment as K, renderList as E } from "vue";
2
- import { u as D } from "./index-4meiCsRz.js";
2
+ import { u as D } from "./index-1fXAFo2E.js";
3
3
  import { h as g } from "./moment-h96o7c8I.js";
4
- import { s as c } from "./index-CETCXB6X.js";
4
+ import { s as c } from "./index-DoAIw4wM.js";
5
5
  import { useSnackbar as T } from "@feedmepos/ui-library";
6
6
  import { d as v } from "./dinero-CIVmXLL-.js";
7
- import { _ as P } from "./AutoCopyCell.vue_vue_type_script_setup_true_lang-GXPXBEf5.js";
7
+ import { _ as P } from "./AutoCopyCell.vue_vue_type_script_setup_true_lang-CdmfrBoW.js";
8
8
  import { useRouter as q } from "vue-router";
9
9
  import { _ as N } from "./AdminLayout.vue_vue_type_script_setup_true_lang-BTmMOzwx.js";
10
- import { u as O } from "./index-BwFHcZlm.js";
10
+ import { u as O } from "./index-DdJrUqkm.js";
11
11
  import { u as U } from "./error-K1CakhA9.js";
12
12
  import { _ as j } from "./DateRangePicker.vue_vue_type_script_setup_true_lang-dP_5WjEJ.js";
13
13
  const z = /* @__PURE__ */ C({
@@ -1,14 +1,14 @@
1
1
  import { defineComponent as g, ref as h, computed as x, resolveComponent as Y, openBlock as v, createBlock as D, h as S, onMounted as A, watch as R, unref as n, withCtx as V, createElementVNode as i, createVNode as d, isRef as $ } from "vue";
2
- import { u as b } from "./index-4meiCsRz.js";
2
+ import { u as b } from "./index-1fXAFo2E.js";
3
3
  import { h as _ } from "./moment-h96o7c8I.js";
4
4
  import { useCoreStore as C } from "@feedmepos/mf-common";
5
5
  import { _ as k } from "./Layout.vue_vue_type_script_setup_true_lang-DJm5br5a.js";
6
- import { s as w } from "./index-CETCXB6X.js";
6
+ import { s as w } from "./index-DoAIw4wM.js";
7
7
  import "@feedmepos/ui-library";
8
8
  import { d as f } from "./dinero-CIVmXLL-.js";
9
- import { _ as F } from "./AutoCopyCell.vue_vue_type_script_setup_true_lang-GXPXBEf5.js";
9
+ import { _ as F } from "./AutoCopyCell.vue_vue_type_script_setup_true_lang-CdmfrBoW.js";
10
10
  import { useRouter as M } from "vue-router";
11
- import { u as K } from "./index-BwFHcZlm.js";
11
+ import { u as K } from "./index-DdJrUqkm.js";
12
12
  import { _ as B } from "./AsyncButton.vue_vue_type_script_setup_true_lang-DcjzvYwT.js";
13
13
  import { _ as I } from "./RestaurantSelector.vue_vue_type_script_setup_true_lang-CY4ttpKj.js";
14
14
  import { _ as L } from "./DateRangePicker.vue_vue_type_script_setup_true_lang-dP_5WjEJ.js";