@feedmepos/mf-payment 0.0.0-beta.36 → 0.0.0-beta.37

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@feedmepos/mf-payment",
3
- "version": "0.0.0-beta.36",
3
+ "version": "0.0.0-beta.37",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"
@@ -1,339 +0,0 @@
1
- import { defineComponent as h, openBlock as d, createElementBlock as I, createTextVNode as R, createElementVNode as k, toDisplayString as N, resolveComponent as m, createVNode as _, normalizeClass as U, withCtx as V, createBlock as g, createCommentVNode as A, ref as T, computed as M, unref as c, watch as z, isRef as L, h as S } from "vue";
2
- import "./index-Cnxt2xmc.js";
3
- import { h as Y } from "./moment-h96o7c8I.js";
4
- import { u as j } from "./index-BgnU5ezY.js";
5
- import { _ as q } from "./index.vue_vue_type_script_setup_true_lang-B8eGz19R.js";
6
- import { _ as O } from "./AdminLayout.vue_vue_type_script_setup_true_lang-1DSAdvX7.js";
7
- import { useSnackbar as P, useDialogChild as Q, useDialog as G } from "@feedmepos/ui-library";
8
- import { t as F } from "./index-CBFVJirn.js";
9
- import { c as H } from "./clipboard-4jh1WteU.js";
10
- import { u as D } from "./error-K1CakhA9.js";
11
- import { z as E, a as K } from "./validator-D5jtpt9A.js";
12
- import { useCoreStore as J } from "@feedmepos/mf-common";
13
- import { w as W } from "./Modal-DB8M9o1T.js";
14
- import { useRouter as X } from "vue-router";
15
- const Z = { class: "t-caption" }, ee = { class: "t-h1 my-6 text-center" }, te = /* @__PURE__ */ h({
16
- __name: "TerminalBindCodeDialog",
17
- props: {
18
- code: {
19
- type: String,
20
- required: !0
21
- }
22
- },
23
- setup(u) {
24
- return (n, o) => (d(), I("div", Z, [
25
- o[0] || (o[0] = R(" Enter the binding code below on your device to link it with this terminal and apply the configuration. ")),
26
- k("div", ee, N(u.code), 1)
27
- ]));
28
- }
29
- }), ne = /* @__PURE__ */ h({
30
- __name: "ID",
31
- props: {
32
- row: {},
33
- data: {}
34
- },
35
- setup(u) {
36
- const n = u, o = P();
37
- function s() {
38
- return n.row.original.status === "Active" ? "!w-[16px] !h-[16px] bg-green-400" : "!w-[16px] !h-[16px] bg-red-400";
39
- }
40
- function i() {
41
- try {
42
- H(n.data), o.open({ title: "Text copied to clipboard." }, 1e3);
43
- } catch {
44
- o.open({ title: "Clipboard API incompatible." }, 1e3);
45
- }
46
- n.data;
47
- }
48
- return (r, a) => {
49
- const p = m("FmBadge");
50
- return d(), I("div", {
51
- onClick: a[0] || (a[0] = (v) => {
52
- v.stopPropagation(), i();
53
- })
54
- }, [
55
- _(p, {
56
- inline: "",
57
- class: U(s())
58
- }, {
59
- default: V(() => [
60
- k("div", null, N(r.data), 1)
61
- ]),
62
- _: 1
63
- }, 8, ["class"])
64
- ]);
65
- };
66
- }
67
- }), oe = { class: "flex" }, ae = /* @__PURE__ */ h({
68
- __name: "Actions",
69
- props: {
70
- data: {}
71
- },
72
- emits: ["link", "unlink", "edit"],
73
- setup(u, { emit: n }) {
74
- const o = n;
75
- return (s, i) => {
76
- const r = m("FmButton");
77
- return d(), I("div", oe, [
78
- s.data.deviceType === "TERMINAL" && !s.data.deviceId ? (d(), g(r, {
79
- key: 0,
80
- variant: "plain",
81
- "prepend-icon": "link",
82
- onClick: i[0] || (i[0] = (a) => {
83
- a.stopPropagation(), o("link");
84
- })
85
- })) : A("", !0),
86
- s.data.deviceType === "TERMINAL" && s.data.deviceId ? (d(), g(r, {
87
- key: 1,
88
- variant: "plain",
89
- "prepend-icon": "link_off",
90
- onClick: i[1] || (i[1] = (a) => {
91
- a.stopPropagation(), o("unlink");
92
- })
93
- })) : A("", !0),
94
- _(r, {
95
- variant: "plain",
96
- "prepend-icon": "edit",
97
- onClick: i[2] || (i[2] = (a) => {
98
- a.stopPropagation(), o("edit");
99
- })
100
- })
101
- ]);
102
- };
103
- }
104
- }), re = /* @__PURE__ */ h({
105
- __name: "TerminalDialog",
106
- props: {
107
- terminal: {
108
- type: Object
109
- }
110
- },
111
- setup(u) {
112
- var y, x, w;
113
- const n = u, o = J(), s = Q(), i = T(), r = T((y = n.terminal) == null ? void 0 : y.name), a = T((x = n.terminal) == null ? void 0 : x.referenceId), p = T(((w = n.terminal) == null ? void 0 : w.status) === "Active"), v = M(() => o.restaurants.value.map((t) => ({
114
- label: t.profile.name,
115
- value: t._id
116
- })));
117
- return (t, e) => {
118
- const l = m("FmSelect"), b = m("FmTextField"), f = m("FmSwitch"), B = m("FmButton"), $ = m("FmForm");
119
- return d(), g($, {
120
- ref: i.value,
121
- class: "flex flex-col gap-16 mb-6",
122
- onValidationSuccess: e[3] || (e[3] = () => {
123
- c(s).emitData({ name: r.value, referenceId: a.value, status: p.value ? "Active" : "Inactive" }), c(s).emitAction("primary");
124
- })
125
- }, {
126
- default: V(() => [
127
- n.terminal ? A("", !0) : (d(), g(l, {
128
- key: 0,
129
- modelValue: a.value,
130
- "onUpdate:modelValue": e[0] || (e[0] = (C) => a.value = C),
131
- label: "Restaurant",
132
- items: v.value,
133
- rules: c(E)(c(K).string())
134
- }, null, 8, ["modelValue", "items", "rules"])),
135
- _(b, {
136
- modelValue: r.value,
137
- "onUpdate:modelValue": e[1] || (e[1] = (C) => r.value = C),
138
- label: "Terminal Name",
139
- rules: c(E)(c(K).string())
140
- }, null, 8, ["modelValue", "rules"]),
141
- n.terminal ? (d(), g(f, {
142
- key: 1,
143
- modelValue: p.value,
144
- "onUpdate:modelValue": e[2] || (e[2] = (C) => p.value = C),
145
- label: "Status"
146
- }, null, 8, ["modelValue"])) : A("", !0),
147
- _(B, {
148
- type: "submit",
149
- label: "Create"
150
- })
151
- ]),
152
- _: 1
153
- }, 512);
154
- };
155
- }
156
- }), se = { class: "flex justify-between mb-6 items-center" }, ie = { class: "flex space-x-4" }, le = { class: "flex space-x-4" }, he = /* @__PURE__ */ h({
157
- __name: "Terminal",
158
- setup(u) {
159
- const n = T(), { searchKey: o } = j({
160
- searchKey: ""
161
- });
162
- let s;
163
- z(o, async () => {
164
- s && clearTimeout(s), s = setTimeout(
165
- () => {
166
- var t;
167
- return (t = n.value) == null ? void 0 : t.reset();
168
- },
169
- 700
170
- );
171
- });
172
- const i = X(), r = G(), a = P();
173
- async function p(t) {
174
- W(
175
- r,
176
- "Terminal Unbind",
177
- "Are you sure to unbind terminal from device? This action cannot be revert and device will be logged out!",
178
- async () => {
179
- var e;
180
- try {
181
- await F.unbind(t), (e = n.value) == null || e.reset(), a.open({
182
- type: "success",
183
- message: "Terminal unbind successfully"
184
- });
185
- } catch (l) {
186
- a.open({
187
- type: "error",
188
- title: "Error occurs when unbind terminal",
189
- message: D(l)
190
- });
191
- }
192
- }
193
- );
194
- }
195
- async function v(t) {
196
- const e = await F.getBindCode(t);
197
- r.open({
198
- title: "Terminal Bind Code",
199
- closeButton: !0,
200
- overlay: !0,
201
- contentComponent: te,
202
- contentComponentProps: { code: e }
203
- });
204
- }
205
- async function y(t) {
206
- r.open({
207
- title: t ? "Update Terminal" : "Create New Terminal",
208
- closeButton: !0,
209
- overlay: !0,
210
- contentComponent: re,
211
- contentComponentProps: { terminal: t }
212
- }).onPrimary(async (e) => {
213
- var l;
214
- r.close();
215
- try {
216
- await F.create(e), (l = n.value) == null || l.reset(), a.open({
217
- type: "success",
218
- message: t ? "Terminal udpated successfully" : "Terminal created successfully."
219
- });
220
- } catch (b) {
221
- a.open({
222
- type: "error",
223
- title: "Error occurs when create terminal",
224
- message: D(b)
225
- });
226
- }
227
- });
228
- }
229
- const x = function(t) {
230
- return {
231
- id: t._id,
232
- status: t.status,
233
- referenceId: t.referenceId,
234
- name: t.name,
235
- deviceId: t.deviceId,
236
- updatedAt: Y(t.updatedAt).format("YYYY-MM-DD hh:mm:ss")
237
- };
238
- }, w = [
239
- {
240
- accessorKey: "id",
241
- header: () => "Terminal ID",
242
- meta: {
243
- textAlign: "right"
244
- },
245
- cell: ({ cell: t, row: e }) => S(ne, { row: e, data: t.getValue() })
246
- },
247
- {
248
- accessorKey: "name",
249
- header: () => "Name",
250
- meta: {
251
- textAlign: "left"
252
- }
253
- },
254
- {
255
- accessorKey: "referenceId",
256
- header: () => "Reference",
257
- meta: {
258
- textAlign: "left"
259
- }
260
- },
261
- {
262
- accessorKey: "deviceId",
263
- header: () => "Bound Device Id",
264
- meta: {
265
- textAlign: "left"
266
- }
267
- },
268
- {
269
- accessorKey: "updatedAt",
270
- header: () => "Last Updated",
271
- meta: {
272
- textAlign: "left"
273
- }
274
- },
275
- {
276
- accessorKey: "id",
277
- header: () => "Actions",
278
- meta: {
279
- textAlign: "center"
280
- },
281
- cell: ({ row: t }) => {
282
- var l;
283
- const e = (l = n.value) == null ? void 0 : l.pageData().at(t.index);
284
- return S(ae, {
285
- data: e,
286
- onLink: () => v(e._id),
287
- onUnlink: () => p(e._id),
288
- onEdit: () => y(e)
289
- });
290
- }
291
- }
292
- ];
293
- return (t, e) => {
294
- const l = m("FmSearch"), b = m("FmButton");
295
- return d(), g(O, {
296
- title: "Terminals",
297
- loading: !1
298
- }, {
299
- default: V(() => [
300
- k("div", se, [
301
- k("div", ie, [
302
- _(l, {
303
- "model-value": c(o),
304
- "onUpdate:modelValue": e[0] || (e[0] = (f) => L(o) ? o.value = f : null),
305
- class: "mr-8",
306
- label: "Search",
307
- placeholder: "Search Terminals ..."
308
- }, null, 8, ["model-value"])
309
- ]),
310
- k("div", le, [
311
- _(b, {
312
- label: "Create",
313
- icon: "add",
314
- onClick: e[1] || (e[1] = () => y())
315
- })
316
- ])
317
- ]),
318
- _(q, {
319
- ref_key: "controller",
320
- ref: n,
321
- "column-defs": w,
322
- "rows-defs": x,
323
- paginate: (f, B) => c(F).read({ searchKey: c(o), limit: f, cursor: B }),
324
- onRowClick: e[2] || (e[2] = (f) => c(i).push({
325
- name: "mf-payment-admin.terminal-setting",
326
- params: {
327
- terminalId: f._id
328
- }
329
- }))
330
- }, null, 8, ["paginate"])
331
- ]),
332
- _: 1
333
- });
334
- };
335
- }
336
- });
337
- export {
338
- he as default
339
- };