@feedmepos/mf-payment 1.0.1 → 1.0.2-beta.2

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 (41) hide show
  1. package/dist/{PayoutAccount-DLxO15Kf.js → PayoutAccount-WMo1Wi6d.js} +3 -3
  2. package/dist/{PayoutAccount-Bxz83we4.js → PayoutAccount-jO4yRGDD.js} +5 -5
  3. package/dist/{PayoutAccountSetting-C1yeSNv8.js → PayoutAccountSetting-BbtOFbsd.js} +4 -4
  4. package/dist/Restaurant-BN04ZHox.js +302 -0
  5. package/dist/{RestaurantSetting-CWZAKz1A.js → RestaurantSetting-BboKM1iG.js} +4 -4
  6. package/dist/{Settlement-D8nayzFt.js → Settlement-BgVw1gLS.js} +3 -3
  7. package/dist/{Settlement-CAHgJIuH.js → Settlement-DTWdfbAT.js} +3 -3
  8. package/dist/{SettlementTransactions-JJyQEOMw.js → SettlementTransactions-DHoHXPTr.js} +4 -4
  9. package/dist/{SettlementTransactions-DfXEf1fm.js → SettlementTransactions-Ye65VrAA.js} +4 -4
  10. package/dist/Terminal-nWQ95k-W.js +404 -0
  11. package/dist/{TerminalSetting-qklmRz3H.js → TerminalSetting-JD3sbXOB.js} +3 -3
  12. package/dist/{TerminalTransaction-BjwvTbGu.js → TerminalTransaction-CjMDx6bg.js} +5 -5
  13. package/dist/{TerminalTransaction-D-mJRP0T.js → TerminalTransaction-D7Vy3Hn8.js} +182 -153
  14. package/dist/{Transaction-CZkNzH-m.js → Transaction-CeJhi9Hg.js} +4 -4
  15. package/dist/{Transaction-CvrsRuuz.js → Transaction-DGoMEHjT.js} +123 -96
  16. package/dist/{app-FuKCNfJl.js → app-CQiyh6x1.js} +317 -317
  17. package/dist/app.js +1 -1
  18. package/dist/{assets-DjRoCcqv.js → assets-8c19wXSV.js} +1 -1
  19. package/dist/grafana-CqkYm_ru.js +46 -0
  20. package/dist/helpers/grafana.d.ts +7 -0
  21. package/dist/{index-Dj_LwPBy.js → index-1fXAFo2E.js} +1 -1
  22. package/dist/{index-BWFqxSU3.js → index-BIXuzGa9.js} +1 -1
  23. package/dist/{index-CFjLufVa.js → index-BzmIt2Le.js} +22 -17
  24. package/dist/{index-CWGSYCJG.js → index-Cb1zVhcH.js} +1 -1
  25. package/dist/{index-CTSM9lSC.js → index-Cx7X9kBf.js} +34 -28
  26. package/dist/{index-BerQZMQW.js → index-DdJrUqkm.js} +1 -1
  27. package/dist/{index-DFePh4ct.js → index-DeU3Qyca.js} +1 -1
  28. package/dist/{index-BEFlDEyV.js → index-DsLFmVsY.js} +1 -1
  29. package/dist/{index.vue_vue_type_script_setup_true_lang-BgTr7KWF.js → index.vue_vue_type_script_setup_true_lang-GT2x04Bn.js} +1 -1
  30. package/dist/model/transaction.d.ts +1 -0
  31. package/dist/package.json +1 -1
  32. package/dist/{payout-account-YJZlBDSF.js → payout-account-BHUNAuhN.js} +2 -2
  33. package/dist/{transaction-CIYqsLqc.js → transaction-DGZWXzQ3.js} +9 -8
  34. package/dist/tsconfig.app.tsbuildinfo +1 -1
  35. package/dist/views/admin/restaurant/cell/LogButton.vue.d.ts +5 -0
  36. package/dist/views/admin/terminal-transaction/cell/Actions.vue.d.ts +3 -1
  37. package/dist/views/admin/transaction/TransactionTable.vue.d.ts +2 -0
  38. package/dist/views/admin/transaction/cell/Actions.vue.d.ts +1 -1
  39. package/package.json +1 -1
  40. package/dist/Restaurant-B02jty0J.js +0 -262
  41. package/dist/Terminal-DX8v8WpM.js +0 -386
@@ -0,0 +1,5 @@
1
+ type __VLS_Props = {
2
+ id: string;
3
+ };
4
+ declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, HTMLDivElement>;
5
+ export default _default;
@@ -1,6 +1,8 @@
1
- export type emitAction = "query" | "refund";
1
+ import { F_TERMINAL_PAYMENT_GATEWAY_PROVIDER } from '@feedmepos/payment-entity';
2
+ export type emitAction = "query" | "refund" | "history";
2
3
  type __VLS_Props = {
3
4
  onAction: (event: emitAction) => void;
5
+ gateway: F_TERMINAL_PAYMENT_GATEWAY_PROVIDER;
4
6
  };
5
7
  declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, HTMLDivElement>;
6
8
  export default _default;
@@ -12,6 +12,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
12
12
  }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
13
13
  query: (index: number) => any;
14
14
  refund: (index: number) => any;
15
+ history: (index: number) => any;
15
16
  notify: (index: number) => any;
16
17
  }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
17
18
  data: {
@@ -25,6 +26,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
25
26
  }>> & Readonly<{
26
27
  onQuery?: ((index: number) => any) | undefined;
27
28
  onRefund?: ((index: number) => any) | undefined;
29
+ onHistory?: ((index: number) => any) | undefined;
28
30
  onNotify?: ((index: number) => any) | undefined;
29
31
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
30
32
  export default _default;
@@ -1,4 +1,4 @@
1
- export type emitAction = "query" | "refund" | "notify";
1
+ export type emitAction = "query" | "refund" | "notify" | "history";
2
2
  type __VLS_Props = {
3
3
  onAction: (event: emitAction) => void;
4
4
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@feedmepos/mf-payment",
3
- "version": "1.0.1",
3
+ "version": "1.0.2-beta.2",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"
@@ -1,262 +0,0 @@
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-BerQZMQW.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-Dj_LwPBy.js";
6
- import { _ as G } from "./AutoCopyCell.vue_vue_type_script_setup_true_lang-CdmfrBoW.js";
7
- import { r as H } from "./index-BWFqxSU3.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
- };
@@ -1,386 +0,0 @@
1
- import { defineComponent as x, openBlock as f, createElementBlock as B, createTextVNode as O, createElementVNode as h, toDisplayString as $, resolveComponent as p, createVNode as y, normalizeClass as z, withCtx as V, createBlock as g, createCommentVNode as F, ref as k, computed as Y, unref as c, watch as K, isRef as P, h as E } from "vue";
2
- import "./index-Dj_LwPBy.js";
3
- import { h as j } from "./moment-h96o7c8I.js";
4
- import { u as q } from "./index-BerQZMQW.js";
5
- import { _ as Q } from "./index.vue_vue_type_script_setup_true_lang-BgTr7KWF.js";
6
- import { _ as G } from "./AdminLayout.vue_vue_type_script_setup_true_lang-BTmMOzwx.js";
7
- import { useSnackbar as D, useDialogChild as H, useDialog as J } from "@feedmepos/ui-library";
8
- import { t as A } from "./index-DFePh4ct.js";
9
- import { c as M } from "./clipboard-4jh1WteU.js";
10
- import { u as N } from "./error-K1CakhA9.js";
11
- import { z as R, a as U } from "./validator-D5jtpt9A.js";
12
- import { useCoreStore as W } from "@feedmepos/mf-common";
13
- import { w as X } from "./Modal-DB8M9o1T.js";
14
- import { useRouter as Z } from "vue-router";
15
- const ee = { class: "t-caption" }, te = /* @__PURE__ */ x({
16
- __name: "TerminalBindCodeDialog",
17
- props: {
18
- code: {
19
- type: String,
20
- required: !0
21
- }
22
- },
23
- setup(v) {
24
- const n = v, a = D();
25
- function r() {
26
- try {
27
- M(n.code), a.open({ title: "Text copied to clipboard." }, 1e3);
28
- } catch {
29
- a.open({ title: "Clipboard API incompatible." }, 1e3);
30
- }
31
- }
32
- return (i, l) => (f(), B("div", ee, [
33
- l[1] || (l[1] = O(" Enter the binding code below on your device to link it with this terminal and apply the configuration. ")),
34
- h("div", {
35
- class: "my-6 text-center fm-typo-en-title-md-800 tracking-[0.3rem] cursor-pointer hover:text-fm-color-neutral-gray-300",
36
- onClick: l[0] || (l[0] = (o) => {
37
- o.stopPropagation(), r();
38
- })
39
- }, $(v.code), 1)
40
- ]));
41
- }
42
- }), ne = /* @__PURE__ */ x({
43
- __name: "ID",
44
- props: {
45
- row: {},
46
- data: {}
47
- },
48
- setup(v) {
49
- const n = v, a = D();
50
- function r() {
51
- return n.row.original.status === "Active" ? "!w-[16px] !h-[16px] bg-green-400" : "!w-[16px] !h-[16px] bg-red-400";
52
- }
53
- function i() {
54
- try {
55
- M(n.data), a.open({ title: "Text copied to clipboard." }, 1e3);
56
- } catch {
57
- a.open({ title: "Clipboard API incompatible." }, 1e3);
58
- }
59
- n.data;
60
- }
61
- return (l, o) => {
62
- const d = p("FmBadge");
63
- return f(), B("div", {
64
- onClick: o[0] || (o[0] = (_) => {
65
- _.stopPropagation(), i();
66
- })
67
- }, [
68
- y(d, {
69
- inline: "",
70
- class: z(r())
71
- }, {
72
- default: V(() => [
73
- h("div", null, $(l.data), 1)
74
- ]),
75
- _: 1
76
- }, 8, ["class"])
77
- ]);
78
- };
79
- }
80
- }), oe = { class: "flex" }, ae = /* @__PURE__ */ x({
81
- __name: "Actions",
82
- props: {
83
- data: {}
84
- },
85
- emits: ["link", "unlink", "edit"],
86
- setup(v, { emit: n }) {
87
- const a = n;
88
- return (r, i) => {
89
- const l = p("FmButton");
90
- return f(), B("div", oe, [
91
- r.data.deviceType === "TERMINAL" && !r.data.deviceId ? (f(), g(l, {
92
- key: 0,
93
- variant: "plain",
94
- "prepend-icon": "link",
95
- onClick: i[0] || (i[0] = (o) => {
96
- o.stopPropagation(), a("link");
97
- })
98
- })) : F("", !0),
99
- r.data.deviceType === "TERMINAL" && r.data.deviceId ? (f(), g(l, {
100
- key: 1,
101
- variant: "plain",
102
- "prepend-icon": "link_off",
103
- onClick: i[1] || (i[1] = (o) => {
104
- o.stopPropagation(), a("unlink");
105
- })
106
- })) : F("", !0),
107
- y(l, {
108
- variant: "plain",
109
- "prepend-icon": "edit",
110
- onClick: i[2] || (i[2] = (o) => {
111
- o.stopPropagation(), a("edit");
112
- })
113
- })
114
- ]);
115
- };
116
- }
117
- }), re = /* @__PURE__ */ x({
118
- __name: "TerminalDialog",
119
- props: {
120
- terminal: {
121
- type: Object
122
- }
123
- },
124
- setup(v) {
125
- var w, b, I;
126
- const n = v, a = W(), r = H(), i = k(), l = k((w = n.terminal) == null ? void 0 : w.name), o = k((b = n.terminal) == null ? void 0 : b.referenceId), d = k(((I = n.terminal) == null ? void 0 : I.status) === "Active"), _ = Y(() => a.restaurants.value.map((T) => ({
127
- label: T.profile.name,
128
- value: T._id
129
- })));
130
- return (T, u) => {
131
- const e = p("FmSelect"), t = p("FmTextField"), m = p("FmSwitch"), C = p("FmButton"), S = p("FmForm");
132
- return f(), g(S, {
133
- ref: i.value,
134
- class: "flex flex-col gap-16 mb-6",
135
- onValidationSuccess: u[3] || (u[3] = () => {
136
- c(r).emitData({ name: l.value, referenceId: o.value, status: d.value ? "Active" : "Inactive" }), c(r).emitAction("primary");
137
- })
138
- }, {
139
- default: V(() => [
140
- n.terminal ? F("", !0) : (f(), g(e, {
141
- key: 0,
142
- modelValue: o.value,
143
- "onUpdate:modelValue": u[0] || (u[0] = (s) => o.value = s),
144
- label: "Restaurant",
145
- "helper-text": "If you can't find the restaurant please change the business to the restaurant's business.",
146
- items: _.value,
147
- rules: c(R)(c(U).string())
148
- }, null, 8, ["modelValue", "items", "rules"])),
149
- y(t, {
150
- modelValue: l.value,
151
- "onUpdate:modelValue": u[1] || (u[1] = (s) => l.value = s),
152
- label: "Terminal Name",
153
- rules: c(R)(c(U).string())
154
- }, null, 8, ["modelValue", "rules"]),
155
- n.terminal ? (f(), g(m, {
156
- key: 1,
157
- modelValue: d.value,
158
- "onUpdate:modelValue": u[2] || (u[2] = (s) => d.value = s),
159
- label: "Status"
160
- }, null, 8, ["modelValue"])) : F("", !0),
161
- y(C, {
162
- type: "submit",
163
- label: "Create"
164
- })
165
- ]),
166
- _: 1
167
- }, 512);
168
- };
169
- }
170
- }), le = { class: "flex justify-between mb-6 items-center" }, ie = { class: "flex space-x-4" }, se = { class: "flex space-x-4" }, he = /* @__PURE__ */ x({
171
- __name: "Terminal",
172
- setup(v) {
173
- const n = k(), { searchKey: a, deviceType: r } = q({
174
- searchKey: "",
175
- deviceType: void 0
176
- });
177
- K(r, () => {
178
- var e;
179
- return (e = n.value) == null ? void 0 : e.reset();
180
- });
181
- let i;
182
- K(a, async () => {
183
- i && clearTimeout(i), i = setTimeout(
184
- () => {
185
- var e;
186
- return (e = n.value) == null ? void 0 : e.reset();
187
- },
188
- 700
189
- );
190
- });
191
- const l = Z(), o = J(), d = D();
192
- async function _(e) {
193
- X(
194
- o,
195
- "Terminal Unbind",
196
- "Are you sure to unbind terminal from device? This action cannot be revert and device will be logged out!",
197
- async () => {
198
- var t;
199
- try {
200
- await A.unbind(e), (t = n.value) == null || t.reset(), d.open({
201
- type: "success",
202
- message: "Terminal unbind successfully"
203
- });
204
- } catch (m) {
205
- d.open({
206
- type: "error",
207
- title: "Error occurs when unbind terminal",
208
- message: N(m)
209
- });
210
- }
211
- }
212
- );
213
- }
214
- async function w(e) {
215
- const t = await A.getBindCode(e);
216
- o.open({
217
- title: "Terminal Bind Code",
218
- closeButton: !0,
219
- overlay: !0,
220
- contentComponent: te,
221
- contentComponentProps: { code: t }
222
- });
223
- }
224
- async function b(e) {
225
- o.open({
226
- title: e ? "Update Terminal" : "Create New Terminal",
227
- closeButton: !0,
228
- overlay: !0,
229
- contentComponent: re,
230
- contentComponentProps: { terminal: e }
231
- }).onPrimary(async (t) => {
232
- var m;
233
- o.close();
234
- try {
235
- await A.create(t), (m = n.value) == null || m.reset(), d.open({
236
- type: "success",
237
- message: e ? "Terminal udpated successfully" : "Terminal created successfully."
238
- });
239
- } catch (C) {
240
- d.open({
241
- type: "error",
242
- title: "Error occurs when create terminal",
243
- message: N(C)
244
- });
245
- }
246
- });
247
- }
248
- const I = function(e) {
249
- return {
250
- id: e._id,
251
- status: e.status,
252
- referenceId: e.referenceId,
253
- name: e.name,
254
- deviceId: e.deviceId,
255
- deviceType: e.deviceType,
256
- updatedAt: j(e.updatedAt).format("YYYY-MM-DD hh:mm:ss")
257
- };
258
- }, T = [
259
- {
260
- accessorKey: "id",
261
- header: () => "Terminal ID",
262
- meta: {
263
- textAlign: "right"
264
- },
265
- cell: ({ cell: e, row: t }) => E(ne, { row: t, data: e.getValue() })
266
- },
267
- {
268
- accessorKey: "deviceType",
269
- header: () => "Device Type",
270
- meta: {
271
- textAlign: "left"
272
- }
273
- },
274
- {
275
- accessorKey: "name",
276
- header: () => "Name",
277
- meta: {
278
- textAlign: "left"
279
- }
280
- },
281
- {
282
- accessorKey: "referenceId",
283
- header: () => "Reference",
284
- meta: {
285
- textAlign: "left"
286
- }
287
- },
288
- {
289
- accessorKey: "deviceId",
290
- header: () => "Bound Device Id",
291
- meta: {
292
- textAlign: "left"
293
- }
294
- },
295
- {
296
- accessorKey: "updatedAt",
297
- header: () => "Last Updated",
298
- meta: {
299
- textAlign: "left"
300
- }
301
- },
302
- {
303
- accessorKey: "id",
304
- header: () => "Actions",
305
- meta: {
306
- textAlign: "center"
307
- },
308
- cell: ({ row: e }) => {
309
- var m;
310
- const t = (m = n.value) == null ? void 0 : m.pageData().at(e.index);
311
- return E(ae, {
312
- data: t,
313
- onLink: () => w(t._id),
314
- onUnlink: () => _(t._id),
315
- onEdit: () => b(t)
316
- });
317
- }
318
- }
319
- ], u = [
320
- {
321
- label: "POS",
322
- value: "POS"
323
- },
324
- {
325
- label: "KIOSK",
326
- value: "KIOSK"
327
- },
328
- {
329
- label: "TERMINAL",
330
- value: "TERMINAL"
331
- }
332
- ];
333
- return (e, t) => {
334
- const m = p("FmSearch"), C = p("FmSelect"), S = p("FmButton");
335
- return f(), g(G, {
336
- title: "Terminals",
337
- loading: !1
338
- }, {
339
- default: V(() => [
340
- h("div", le, [
341
- h("div", ie, [
342
- y(m, {
343
- "model-value": c(a),
344
- "onUpdate:modelValue": t[0] || (t[0] = (s) => P(a) ? a.value = s : null),
345
- class: "mr-8",
346
- label: "Search",
347
- placeholder: "Search Terminals ..."
348
- }, null, 8, ["model-value"]),
349
- y(C, {
350
- modelValue: c(r),
351
- "onUpdate:modelValue": t[1] || (t[1] = (s) => P(r) ? r.value = s : null),
352
- class: "ml-6 w-[180px]",
353
- label: "Device",
354
- items: u
355
- }, null, 8, ["modelValue"])
356
- ]),
357
- h("div", se, [
358
- y(S, {
359
- label: "Create",
360
- icon: "add",
361
- onClick: t[2] || (t[2] = () => b())
362
- })
363
- ])
364
- ]),
365
- y(Q, {
366
- ref_key: "controller",
367
- ref: n,
368
- "column-defs": T,
369
- "rows-defs": I,
370
- paginate: (s, L) => c(A).read({ searchKey: c(a), deviceType: c(r), limit: s, cursor: L }),
371
- onRowClick: t[3] || (t[3] = (s) => c(l).push({
372
- name: "mf-payment-admin.terminal-setting",
373
- params: {
374
- terminalId: s._id
375
- }
376
- }))
377
- }, null, 8, ["paginate"])
378
- ]),
379
- _: 1
380
- });
381
- };
382
- }
383
- });
384
- export {
385
- he as default
386
- };