@feedmepos/mf-payment 0.0.0-beta.22 → 0.0.0-beta.23

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. package/dist/AutoCopyCell.vue_vue_type_script_setup_true_lang-DWoahPJL.js +28 -0
  2. package/dist/{PayoutAccount-C3OOz1oi.js → PayoutAccount-6kS5Xjs8.js} +5 -5
  3. package/dist/{PayoutAccount-BGSq2B6o.js → PayoutAccount-BYNRryiW.js} +3 -3
  4. package/dist/{PayoutAccountSetting-WxLdT6mv.js → PayoutAccountSetting-B26ApwsY.js} +3 -3
  5. package/dist/{Settlement-CKxNAHAH.js → Settlement-CY0-gXn5.js} +25 -23
  6. package/dist/{Settlement-DQcrZNvo.js → Settlement-DTE8p3LA.js} +27 -25
  7. package/dist/{SettlementTransactions-CUG4ePP_.js → SettlementTransactions-BJlBWR1G.js} +4 -4
  8. package/dist/{SettlementTransactions-V5fjLv7H.js → SettlementTransactions-C4tIk6nO.js} +4 -4
  9. package/dist/Terminal-C4gOl3zs.js +339 -0
  10. package/dist/{TerminalSetting-BuAaL5qK.js → TerminalSetting-DC9NBozT.js} +3 -3
  11. package/dist/{TerminalTransaction-D4c0ivQg.js → TerminalTransaction-BUT01dUv.js} +33 -31
  12. package/dist/{TerminalTransaction-DbjVvH2P.js → TerminalTransaction-CCdbfxx0.js} +33 -31
  13. package/dist/{Transaction-h2YrauW3.js → Transaction-60yViCMI.js} +53 -53
  14. package/dist/{Transaction-MrC2wj9k.js → Transaction-CoCZaBfu.js} +4 -4
  15. package/dist/api/index.d.ts +1 -0
  16. package/dist/app.js +13 -13
  17. package/dist/{assets-Cj6QBVPU.js → assets-BmFExmpA.js} +1 -1
  18. package/dist/clipboard-4jh1WteU.js +10 -0
  19. package/dist/components/AutoCopyCell.vue.d.ts +6 -0
  20. package/dist/{index-DA_XRfnd.js → index-Bvb4T6xz.js} +1 -1
  21. package/dist/{index-DN6pSWL_.js → index-CDgQhs3k.js} +1 -1
  22. package/dist/index-DeF94ACV.js +34 -0
  23. package/dist/{index-C58XD8h3.js → index-Df0izARr.js} +1 -1
  24. package/dist/{index-DYnNx4du.js → index-Jtghafz6.js} +1 -1
  25. package/dist/{index-De4-LJjg.js → index-_qikPh5K.js} +766 -766
  26. package/dist/{index.vue_vue_type_script_setup_true_lang-J6BwjC-p.js → index.vue_vue_type_script_setup_true_lang-CfU6stly.js} +1 -1
  27. package/dist/package.json +1 -1
  28. package/dist/{payout-account-BBG-e-NS.js → payout-account-BQmBfucp.js} +220 -220
  29. package/dist/{transaction-BmxtNt6_.js → transaction-B5QUg556.js} +1 -1
  30. package/dist/tsconfig.app.tsbuildinfo +1 -1
  31. package/package.json +1 -1
  32. package/dist/Terminal-C_G_AuJZ.js +0 -318
  33. package/dist/index-CvMai9eW.js +0 -26
@@ -0,0 +1,28 @@
1
+ import { defineComponent as i, openBlock as c, createElementBlock as l, toDisplayString as s } from "vue";
2
+ import { c as m } from "./clipboard-4jh1WteU.js";
3
+ import { useSnackbar as d } from "@feedmepos/ui-library";
4
+ const u = /* @__PURE__ */ i({
5
+ __name: "AutoCopyCell",
6
+ props: {
7
+ data: {}
8
+ },
9
+ setup(p) {
10
+ const o = p, t = d();
11
+ function r() {
12
+ try {
13
+ m(o.data), t.open({ title: "Text copied to clipboard." }, 1e3);
14
+ } catch {
15
+ t.open({ title: "Clipboard API incompatible." }, 1e3);
16
+ }
17
+ o.data;
18
+ }
19
+ return (a, e) => (c(), l("div", {
20
+ onClick: e[0] || (e[0] = (n) => {
21
+ n.stopPropagation(), r();
22
+ })
23
+ }, s(a.data), 1));
24
+ }
25
+ });
26
+ export {
27
+ u as _
28
+ };
@@ -1,11 +1,11 @@
1
1
  import { defineComponent as b, resolveComponent as m, openBlock as g, createBlock as h, normalizeClass as N, withCtx as f, createElementVNode as P, toDisplayString as C, createVNode as c, computed as x, ref as E, watch as F, unref as l, isRef as k, h as w } from "vue";
2
- import { u as S } from "./index-DA_XRfnd.js";
3
- import { _ as O } from "./index-De4-LJjg.js";
2
+ import { u as S } from "./index-Bvb4T6xz.js";
3
+ import { _ as O } from "./index-_qikPh5K.js";
4
4
  import { _ as K } from "./AdminLayout.vue_vue_type_script_setup_true_lang-1DSAdvX7.js";
5
- import { P as V } from "./payout-account-BBG-e-NS.js";
6
- import { p as D } from "./index-DN6pSWL_.js";
5
+ import { P as V } from "./payout-account-BQmBfucp.js";
6
+ import { p as D } from "./index-CDgQhs3k.js";
7
7
  import "@feedmepos/ui-library";
8
- import { _ as T } from "./index.vue_vue_type_script_setup_true_lang-J6BwjC-p.js";
8
+ import { _ as T } from "./index.vue_vue_type_script_setup_true_lang-CfU6stly.js";
9
9
  import { useRouter as $ } from "vue-router";
10
10
  const G = /* @__PURE__ */ b({
11
11
  __name: "Status",
@@ -1,9 +1,9 @@
1
1
  import { defineComponent as F, ref as P, reactive as k, computed as Z, watch as y, resolveComponent as i, openBlock as c, createBlock as Y, withCtx as X, createElementVNode as g, createVNode as u, unref as n, createCommentVNode as v, createElementBlock as p, normalizeClass as N, toDisplayString as R, h as W, onMounted as T, Fragment as L } from "vue";
2
- import { p as z } from "./index-DN6pSWL_.js";
3
- import { _ as I, u as S, e as h } from "./index-De4-LJjg.js";
2
+ import { p as z } from "./index-CDgQhs3k.js";
3
+ import { _ as I, u as S, e as h } from "./index-_qikPh5K.js";
4
4
  import { defineStore as _ } from "pinia";
5
5
  import { useCoreStore as $ } from "@feedmepos/mf-common";
6
- import { c as AA, P as j } from "./payout-account-BBG-e-NS.js";
6
+ import { c as AA, P as j } from "./payout-account-BQmBfucp.js";
7
7
  import { useDialogChild as sA, useDialog as eA } from "@feedmepos/ui-library";
8
8
  import { z as f, a as q } from "./validator-D5jtpt9A.js";
9
9
  import { P as K } from "./PDFViewer-CjH_C1uT.js";
@@ -1,9 +1,9 @@
1
1
  import { defineComponent as I, resolveComponent as y, openBlock as b, createElementBlock as G, Fragment as D, createElementVNode as i, createVNode as o, withCtx as w, createTextVNode as x, toDisplayString as S, createCommentVNode as U, createBlock as V, ref as C, watch as K, computed as E, unref as p, isRef as M, h as N, onMounted as O, resolveDynamicComponent as j, normalizeProps as z, mergeProps as H } from "vue";
2
- import { p as T } from "./index-DN6pSWL_.js";
3
- import { g as _, b as B, u as L } from "./index-De4-LJjg.js";
2
+ import { p as T } from "./index-CDgQhs3k.js";
3
+ import { g as _, b as B, u as L } from "./index-_qikPh5K.js";
4
4
  import { _ as Z } from "./Layout.vue_vue_type_script_setup_true_lang-C38PTqO5.js";
5
5
  import { useRouter as J } from "vue-router";
6
- import { u as Q } from "./index-DA_XRfnd.js";
6
+ import { u as Q } from "./index-Bvb4T6xz.js";
7
7
  import { P as q } from "./PDFViewer-CjH_C1uT.js";
8
8
  import { useSnackbar as X } from "@feedmepos/ui-library";
9
9
  import { u as Y } from "./error-K1CakhA9.js";
@@ -1,16 +1,17 @@
1
- import { defineComponent as w, ref as S, computed as D, resolveComponent as h, openBlock as v, createBlock as x, onMounted as A, watch as k, unref as n, withCtx as F, createElementVNode as p, createVNode as i, isRef as C } from "vue";
2
- import { u as V } from "./index-De4-LJjg.js";
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-_qikPh5K.js";
3
3
  import { h as _ } from "./moment-h96o7c8I.js";
4
4
  import { useCoreStore as b } from "@feedmepos/mf-common";
5
- import { _ as $ } from "./Layout.vue_vue_type_script_setup_true_lang-C38PTqO5.js";
6
- import { s as g } from "./index-C58XD8h3.js";
5
+ import { _ as I } from "./Layout.vue_vue_type_script_setup_true_lang-C38PTqO5.js";
6
+ import { s as g } from "./index-Df0izARr.js";
7
7
  import "@feedmepos/ui-library";
8
8
  import { d as f } from "./dinero-CIVmXLL-.js";
9
- import { useRouter as I } from "vue-router";
10
- import { u as K } from "./index-DA_XRfnd.js";
11
- import { _ as P } from "./AsyncButton.vue_vue_type_script_setup_true_lang-DcjzvYwT.js";
12
- import { _ as O } from "./RestaurantSelector.vue_vue_type_script_setup_true_lang-CY4ttpKj.js";
13
- const Y = /* @__PURE__ */ w({
9
+ import { _ as K } from "./AutoCopyCell.vue_vue_type_script_setup_true_lang-DWoahPJL.js";
10
+ import { useRouter as P } from "vue-router";
11
+ import { u as O } from "./index-Bvb4T6xz.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({
14
15
  __name: "SettlementTable",
15
16
  props: {
16
17
  data: {
@@ -27,7 +28,8 @@ const Y = /* @__PURE__ */ w({
27
28
  const e = y, r = d, s = S(""), c = [
28
29
  {
29
30
  header: () => "Settlement ID",
30
- accessorKey: "id"
31
+ accessorKey: "id",
32
+ cell: ({ cell: t }) => A(K, { data: t.getValue() })
31
33
  },
32
34
  {
33
35
  header: () => "Created At",
@@ -67,15 +69,15 @@ const Y = /* @__PURE__ */ w({
67
69
  }, null, 8, ["modelValue", "row-data", "loading"]);
68
70
  };
69
71
  }
70
- }), B = { class: "flex justify-between items-center mb-6" }, L = { class: "flex space-x-8 items-center" }, M = { class: "flex space-x-4 items-center" }, X = /* @__PURE__ */ w({
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({
71
73
  __name: "Settlement",
72
74
  setup(y) {
73
- const d = I(), { dateRange: e } = K({
75
+ const d = P(), { dateRange: e } = O({
74
76
  dateRange: {
75
77
  startDate: _().startOf("day").toISOString(),
76
78
  endDate: _().endOf("day").toISOString()
77
79
  }
78
- }), { isLoading: r, startAsyncCall: s } = V(!0), { currentRestaurant: c } = b(), l = S([]);
80
+ }), { isLoading: r, startAsyncCall: s } = $(!0), { currentRestaurant: c } = b(), l = S([]);
79
81
  async function t() {
80
82
  await s(async () => {
81
83
  const m = await g.readRestaurantSettlements(
@@ -90,17 +92,17 @@ const Y = /* @__PURE__ */ w({
90
92
  function o() {
91
93
  t();
92
94
  }
93
- return A(o), k(c, o), (m, a) => {
95
+ return k(o), F(c, o), (m, a) => {
94
96
  const R = h("FmDateRangePicker");
95
- return v(), x($, {
97
+ return v(), x(I, {
96
98
  title: "Settlements",
97
99
  description: "Settlements are the finalization of financial transactions, transferring funds to complete payments.",
98
100
  loading: n(r)
99
101
  }, {
100
- default: F(() => [
101
- p("div", B, [
102
- p("div", L, [
103
- i(O),
102
+ default: V(() => [
103
+ p("div", M, [
104
+ p("div", T, [
105
+ i(B),
104
106
  i(R, {
105
107
  modelValue: n(e),
106
108
  "onUpdate:modelValue": [
@@ -111,8 +113,8 @@ const Y = /* @__PURE__ */ w({
111
113
  "show-predefined-range": ""
112
114
  }, null, 8, ["modelValue"])
113
115
  ]),
114
- p("div", M, [
115
- i(P, {
116
+ p("div", q, [
117
+ i(Y, {
116
118
  button: {
117
119
  appendIcon: "file_download",
118
120
  variant: "primary",
@@ -127,7 +129,7 @@ const Y = /* @__PURE__ */ w({
127
129
  }, null, 8, ["handler"])
128
130
  ])
129
131
  ]),
130
- i(Y, {
132
+ i(L, {
131
133
  loading: n(r),
132
134
  data: l.value,
133
135
  onRowClick: a[1] || (a[1] = (u) => n(d).push({
@@ -144,5 +146,5 @@ const Y = /* @__PURE__ */ w({
144
146
  }
145
147
  });
146
148
  export {
147
- X as default
149
+ te as default
148
150
  };
@@ -1,14 +1,15 @@
1
- import { defineComponent as w, ref as v, computed as S, resolveComponent as h, openBlock as x, createBlock as D, watch as A, onMounted as k, unref as o, withCtx as F, createElementVNode as u, createVNode as p, isRef as R } from "vue";
2
- import { u as V } from "./index-De4-LJjg.js";
1
+ import { defineComponent as w, ref as h, computed as S, resolveComponent as v, openBlock as x, createBlock as D, h as A, watch as k, onMounted as F, unref as o, withCtx as R, createElementVNode as u, createVNode as p, isRef as V } from "vue";
2
+ import { u as b } from "./index-_qikPh5K.js";
3
3
  import { h as _ } from "./moment-h96o7c8I.js";
4
- import { s as g } from "./index-C58XD8h3.js";
4
+ import { s as g } from "./index-Df0izARr.js";
5
5
  import "@feedmepos/ui-library";
6
6
  import { d as f } from "./dinero-CIVmXLL-.js";
7
- import { useRouter as b } from "vue-router";
8
- import { _ as C } from "./AdminLayout.vue_vue_type_script_setup_true_lang-1DSAdvX7.js";
9
- import { u as $ } from "./index-DA_XRfnd.js";
10
- import { _ as I } from "./AsyncButton.vue_vue_type_script_setup_true_lang-DcjzvYwT.js";
11
- const K = /* @__PURE__ */ w({
7
+ import { _ as C } from "./AutoCopyCell.vue_vue_type_script_setup_true_lang-DWoahPJL.js";
8
+ import { useRouter as $ } from "vue-router";
9
+ import { _ as I } from "./AdminLayout.vue_vue_type_script_setup_true_lang-1DSAdvX7.js";
10
+ import { u as K } from "./index-Bvb4T6xz.js";
11
+ import { _ as P } from "./AsyncButton.vue_vue_type_script_setup_true_lang-DcjzvYwT.js";
12
+ const B = /* @__PURE__ */ w({
12
13
  __name: "SettlementTable",
13
14
  props: {
14
15
  data: {
@@ -22,10 +23,11 @@ const K = /* @__PURE__ */ w({
22
23
  },
23
24
  emits: ["row-click"],
24
25
  setup(y, { emit: l }) {
25
- const r = y, d = l, m = v(""), e = [
26
+ const r = y, d = l, m = h(""), e = [
26
27
  {
27
28
  header: () => "Settlement ID",
28
- accessorKey: "id"
29
+ accessorKey: "id",
30
+ cell: ({ cell: t }) => A(C, { data: t.getValue() })
29
31
  },
30
32
  {
31
33
  header: () => "Created At",
@@ -54,7 +56,7 @@ const K = /* @__PURE__ */ w({
54
56
  payout: f(t.totalPayout).toFormat("$0.00")
55
57
  })));
56
58
  return (t, a) => {
57
- const n = h("FmTable");
59
+ const n = v("FmTable");
58
60
  return x(), D(n, {
59
61
  modelValue: m.value,
60
62
  "onUpdate:modelValue": a[0] || (a[0] = (s) => m.value = s),
@@ -65,16 +67,16 @@ const K = /* @__PURE__ */ w({
65
67
  }, null, 8, ["modelValue", "row-data", "loading"]);
66
68
  };
67
69
  }
68
- }), P = { class: "flex justify-between items-center mb-6" }, B = { class: "flex space-x-4 items-center" }, O = { class: "flex space-x-4 items-center" }, z = /* @__PURE__ */ w({
70
+ }), O = { class: "flex justify-between items-center mb-6" }, Y = { class: "flex space-x-4 items-center" }, L = { class: "flex space-x-4 items-center" }, J = /* @__PURE__ */ w({
69
71
  __name: "Settlement",
70
72
  setup(y) {
71
- const { isLoading: l, startAsyncCall: r } = V(!0), d = v([]), m = b(), { dateRange: e } = $({
73
+ const { isLoading: l, startAsyncCall: r } = b(!0), d = h([]), m = $(), { dateRange: e } = K({
72
74
  dateRange: {
73
75
  startDate: _().startOf("day").toISOString(),
74
76
  endDate: _().endOf("day").toISOString()
75
77
  }
76
78
  });
77
- A(e, i);
79
+ k(e, i);
78
80
  async function i() {
79
81
  await r(async () => {
80
82
  const a = await g.readByDate(
@@ -89,24 +91,24 @@ const K = /* @__PURE__ */ w({
89
91
  function t() {
90
92
  i();
91
93
  }
92
- return k(t), (a, n) => {
93
- const s = h("FmDateRangePicker");
94
- return x(), D(C, {
94
+ return F(t), (a, n) => {
95
+ const s = v("FmDateRangePicker");
96
+ return x(), D(I, {
95
97
  title: "Settlements",
96
98
  loading: o(l)
97
99
  }, {
98
- default: F(() => [
99
- u("div", P, [
100
- u("div", B, [
100
+ default: R(() => [
101
+ u("div", O, [
102
+ u("div", Y, [
101
103
  p(s, {
102
104
  modelValue: o(e),
103
- "onUpdate:modelValue": n[0] || (n[0] = (c) => R(e) ? e.value = c : null),
105
+ "onUpdate:modelValue": n[0] || (n[0] = (c) => V(e) ? e.value = c : null),
104
106
  compare: "",
105
107
  "show-predefined-range": ""
106
108
  }, null, 8, ["modelValue"])
107
109
  ]),
108
- u("div", O, [
109
- p(I, {
110
+ u("div", L, [
111
+ p(P, {
110
112
  button: {
111
113
  appendIcon: "file_download",
112
114
  variant: "primary",
@@ -121,7 +123,7 @@ const K = /* @__PURE__ */ w({
121
123
  }, null, 8, ["handler"])
122
124
  ])
123
125
  ]),
124
- p(K, {
126
+ p(B, {
125
127
  loading: o(l),
126
128
  data: d.value,
127
129
  onRowClick: n[1] || (n[1] = (c) => o(m).push({
@@ -138,5 +140,5 @@ const K = /* @__PURE__ */ w({
138
140
  }
139
141
  });
140
142
  export {
141
- z as default
143
+ J as default
142
144
  };
@@ -1,12 +1,12 @@
1
1
  import { defineComponent as T, resolveComponent as g, openBlock as F, createBlock as P, normalizeClass as z, withCtx as l, createElementVNode as t, toDisplayString as u, createElementBlock as L, unref as c, ref as _, onMounted as G, watch as $, createVNode as a, createTextVNode as i, h as C } from "vue";
2
- import { e as E, u as j } from "./index-De4-LJjg.js";
2
+ import { e as E, u as j } from "./index-_qikPh5K.js";
3
3
  import "@feedmepos/ui-library";
4
4
  import { d as h } from "./dinero-CIVmXLL-.js";
5
- import { g as Y, a as H } from "./assets-Cj6QBVPU.js";
6
- import { t as q, a as J } from "./transaction-BmxtNt6_.js";
5
+ import { g as Y, a as H } from "./assets-BmFExmpA.js";
6
+ import { t as q, a as J } from "./transaction-B5QUg556.js";
7
7
  import { _ as Q } from "./Layout.vue_vue_type_script_setup_true_lang-C38PTqO5.js";
8
8
  import { useRouter as W } from "vue-router";
9
- import { s as X } from "./index-C58XD8h3.js";
9
+ import { s as X } from "./index-Df0izARr.js";
10
10
  import { useCoreStore as Z } from "@feedmepos/mf-common";
11
11
  const ee = /* @__PURE__ */ T({
12
12
  __name: "Status",
@@ -1,12 +1,12 @@
1
1
  import { defineComponent as w, resolveComponent as g, openBlock as F, createBlock as k, normalizeClass as j, withCtx as l, createElementVNode as t, toDisplayString as u, createElementBlock as L, unref as p, ref as T, onMounted as Y, watch as H, createVNode as n, createTextVNode as i, h as N } from "vue";
2
- import { e as E, u as q } from "./index-De4-LJjg.js";
2
+ import { e as E, u as q } from "./index-_qikPh5K.js";
3
3
  import { useDialog as J, useSnackbar as Q } from "@feedmepos/ui-library";
4
4
  import { d as B } from "./dinero-CIVmXLL-.js";
5
- import { g as W, a as X } from "./assets-Cj6QBVPU.js";
6
- import { t as P, a as Z } from "./transaction-BmxtNt6_.js";
5
+ import { g as W, a as X } from "./assets-BmFExmpA.js";
6
+ import { t as P, a as Z } from "./transaction-B5QUg556.js";
7
7
  import { _ as ee } from "./Layout.vue_vue_type_script_setup_true_lang-C38PTqO5.js";
8
8
  import { useRouter as te } from "vue-router";
9
- import { s as ae } from "./index-C58XD8h3.js";
9
+ import { s as ae } from "./index-Df0izARr.js";
10
10
  import { u as ne } from "./error-K1CakhA9.js";
11
11
  import { w as oe } from "./Modal-DB8M9o1T.js";
12
12
  const re = /* @__PURE__ */ w({
@@ -0,0 +1,339 @@
1
+ import { defineComponent as x, openBlock as d, createElementBlock as I, createTextVNode as N, createElementVNode as h, toDisplayString as $, resolveComponent as m, createVNode as _, normalizeClass as R, withCtx as V, createBlock as g, createCommentVNode as B, ref as k, computed as z, unref as c, watch as Y, isRef as M, h as S } from "vue";
2
+ import "./index-_qikPh5K.js";
3
+ import { h as j } from "./moment-h96o7c8I.js";
4
+ import { u as L } from "./index-Bvb4T6xz.js";
5
+ import { _ as q } from "./index.vue_vue_type_script_setup_true_lang-CfU6stly.js";
6
+ import { _ as O } from "./AdminLayout.vue_vue_type_script_setup_true_lang-1DSAdvX7.js";
7
+ import { useSnackbar as U, useDialogChild as Q, useDialog as G } from "@feedmepos/ui-library";
8
+ import { t as F } from "./index-Jtghafz6.js";
9
+ import { c as H } from "./clipboard-4jh1WteU.js";
10
+ import { u as D } from "./error-K1CakhA9.js";
11
+ import { z as K, a as P } 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__ */ x({
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] = N(" Enter the binding code below on your device to link it with this terminal and apply the configuration. ")),
26
+ h("div", ee, $(u.code), 1)
27
+ ]));
28
+ }
29
+ }), ne = /* @__PURE__ */ x({
30
+ __name: "ID",
31
+ props: {
32
+ row: {},
33
+ data: {}
34
+ },
35
+ setup(u) {
36
+ const n = u, o = U();
37
+ function i() {
38
+ return n.row.original.status === "Active" ? "!w-[16px] !h-[16px] bg-green-400" : "!w-[16px] !h-[16px] bg-red-400";
39
+ }
40
+ function s() {
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(), s();
53
+ })
54
+ }, [
55
+ _(p, {
56
+ inline: "",
57
+ class: R(i())
58
+ }, {
59
+ default: V(() => [
60
+ h("div", null, $(r.data), 1)
61
+ ]),
62
+ _: 1
63
+ }, 8, ["class"])
64
+ ]);
65
+ };
66
+ }
67
+ }), oe = { class: "flex" }, ae = /* @__PURE__ */ x({
68
+ __name: "Actions",
69
+ props: {
70
+ data: {}
71
+ },
72
+ emits: ["link", "unlink", "edit"],
73
+ setup(u, { emit: n }) {
74
+ const o = n;
75
+ return (i, s) => {
76
+ const r = m("FmButton");
77
+ return d(), I("div", oe, [
78
+ i.data.deviceId ? B("", !0) : (d(), g(r, {
79
+ key: 0,
80
+ variant: "plain",
81
+ "prepend-icon": "link",
82
+ onClick: s[0] || (s[0] = (a) => {
83
+ a.stopPropagation(), o("link");
84
+ })
85
+ })),
86
+ i.data.deviceId ? (d(), g(r, {
87
+ key: 1,
88
+ variant: "plain",
89
+ "prepend-icon": "link_off",
90
+ onClick: s[1] || (s[1] = (a) => {
91
+ a.stopPropagation(), o("unlink");
92
+ })
93
+ })) : B("", !0),
94
+ _(r, {
95
+ variant: "plain",
96
+ "prepend-icon": "edit",
97
+ onClick: s[2] || (s[2] = (a) => {
98
+ a.stopPropagation(), o("edit");
99
+ })
100
+ })
101
+ ]);
102
+ };
103
+ }
104
+ }), re = /* @__PURE__ */ x({
105
+ __name: "TerminalDialog",
106
+ props: {
107
+ terminal: {
108
+ type: Object
109
+ }
110
+ },
111
+ setup(u) {
112
+ var y, T, w;
113
+ const n = u, o = J(), i = Q(), s = k(), r = k((y = n.terminal) == null ? void 0 : y.name), a = k((T = n.terminal) == null ? void 0 : T.referenceId), p = k(((w = n.terminal) == null ? void 0 : w.status) === "Active"), v = z(() => 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"), A = m("FmButton"), E = m("FmForm");
119
+ return d(), g(E, {
120
+ ref: s.value,
121
+ class: "flex flex-col gap-16 mb-6",
122
+ onValidationSuccess: e[3] || (e[3] = () => {
123
+ c(i).emitData({ name: r.value, referenceId: a.value, status: p.value ? "Active" : "Inactive" }), c(i).emitAction("primary");
124
+ })
125
+ }, {
126
+ default: V(() => [
127
+ n.terminal ? B("", !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(K)(c(P).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(K)(c(P).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"])) : B("", !0),
147
+ _(A, {
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" }, xe = /* @__PURE__ */ x({
157
+ __name: "Terminal",
158
+ setup(u) {
159
+ const n = k(), { searchKey: o } = L({
160
+ searchKey: ""
161
+ });
162
+ let i;
163
+ Y(o, async () => {
164
+ i && clearTimeout(i), i = setTimeout(
165
+ () => {
166
+ var t;
167
+ return (t = n.value) == null ? void 0 : t.reset();
168
+ },
169
+ 700
170
+ );
171
+ });
172
+ const s = X(), r = G(), a = U();
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 T = 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: j(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
+ h("div", se, [
301
+ h("div", ie, [
302
+ _(l, {
303
+ "model-value": c(o),
304
+ "onUpdate:modelValue": e[0] || (e[0] = (f) => M(o) ? o.value = f : null),
305
+ class: "mr-8",
306
+ label: "Search",
307
+ placeholder: "Search Terminals ..."
308
+ }, null, 8, ["model-value"])
309
+ ]),
310
+ h("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": T,
323
+ paginate: (f, A) => c(F).read({ searchKey: c(o), limit: f, cursor: A }),
324
+ onRowClick: e[2] || (e[2] = (f) => c(s).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
+ xe as default
339
+ };