@feedmepos/mf-payment 1.9.11-dev → 1.9.13-dev

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 (52) hide show
  1. package/dist/{Actions.vue_vue_type_script_setup_true_lang-BGDjooLi.js → Actions.vue_vue_type_script_setup_true_lang-BSVr75X6.js} +1 -1
  2. package/dist/{AdminBusinessSelector.vue_vue_type_script_setup_true_lang-CGBmnYwR.js → AdminBusinessSelector.vue_vue_type_script_setup_true_lang-DepXoTFK.js} +3 -3
  3. package/dist/{AdminRestaurantSelector.vue_vue_type_script_setup_true_lang-CXidPxKT.js → AdminRestaurantSelector.vue_vue_type_script_setup_true_lang-T7WuGpcv.js} +2 -2
  4. package/dist/{Chargeback-DthRQkiu.js → Chargeback-BGGrIqC1.js} +5 -5
  5. package/dist/{DocumentViewer.vue_vue_type_script_setup_true_lang-DHrPFv7y.js → DocumentViewer.vue_vue_type_script_setup_true_lang-LFfqIXzg.js} +1 -1
  6. package/dist/ExternalTerminal-Bgil7e9q.js +596 -0
  7. package/dist/{OnboardForm-DkDqDIZP.js → OnboardForm-Bi55-0QC.js} +6 -6
  8. package/dist/{OnboardForm-OkvFrszY.js → OnboardForm-GY9iFm_0.js} +6 -6
  9. package/dist/{OnboardSubmission-B96tDLwu.js → OnboardSubmission-BjxoLtdy.js} +3 -3
  10. package/dist/{OnboardSubmission-BYxD77AJ.js → OnboardSubmission-XtXfACsT.js} +6 -6
  11. package/dist/{PayoutAccount-CWqfWcc5.js → PayoutAccount-Cf9KDVaS.js} +7 -7
  12. package/dist/{PayoutAccount-Cm-NJOBK.js → PayoutAccount-DRJkFbb7.js} +5 -5
  13. package/dist/{PayoutAccountSetting-MfvuoLsP.js → PayoutAccountSetting-jo5pD78A.js} +6 -6
  14. package/dist/{Restaurant-PMD_DJXo.js → Restaurant-T23GXyN4.js} +4 -4
  15. package/dist/{RestaurantSetting-0HU88xmj.js → RestaurantSetting-Dt_43sff.js} +3 -3
  16. package/dist/{Settlement-Dbje0she.js → Settlement-DYIC_qx5.js} +4 -4
  17. package/dist/{Settlement-D6IglRbP.js → Settlement-iQawCsTk.js} +3 -3
  18. package/dist/{SettlementTransactions-DUy_y6CB.js → SettlementTransactions-D6e2Jfz8.js} +5 -5
  19. package/dist/{SettlementTransactions-DyxDh1dT.js → SettlementTransactions-DxtVwsGQ.js} +5 -5
  20. package/dist/{Status.vue_vue_type_script_setup_true_lang-CFl-D4In.js → Status.vue_vue_type_script_setup_true_lang-RMf0UvJO.js} +1 -1
  21. package/dist/{Terminal-DAjkcZWe.js → Terminal-B-MDewvq.js} +6 -6
  22. package/dist/{TerminalSetting-Cr2jbjzK.js → TerminalSetting-CpDVVqna.js} +202 -208
  23. package/dist/{Transaction-B7DoDQLu.js → Transaction-BdoEqUsK.js} +11 -11
  24. package/dist/{Transaction-BneqY4fv.js → Transaction-DQJOm0M1.js} +10 -10
  25. package/dist/{TransactionOld-Mo2Wyw0L.js → TransactionOld-Cv-ldfgv.js} +7 -7
  26. package/dist/{TransactionStatus.vue_vue_type_script_setup_true_lang-BoPH1EYZ.js → TransactionStatus.vue_vue_type_script_setup_true_lang-DgXB350L.js} +1 -1
  27. package/dist/{app-vzHIBeFa.js → app-BV0gwDWT.js} +24 -24
  28. package/dist/app.js +1 -1
  29. package/dist/{assets-BTU2X5w9.js → assets-B3BMwzbu.js} +1 -1
  30. package/dist/{grafana-BP7gTavJ.js → grafana-BnniZglw.js} +1 -1
  31. package/dist/{index-5q3RTQJK.js → index-2OskxiaA.js} +1 -1
  32. package/dist/{index-CvT4Ma6E.js → index-BANsbSLN.js} +2 -2
  33. package/dist/{index-CMyDiJi8.js → index-Bahs0LXz.js} +1 -1
  34. package/dist/{index-BanK-A0I.js → index-CHb_FpXY.js} +1 -1
  35. package/dist/{index-Bn2RWmUv.js → index-D-aQKndH.js} +1 -1
  36. package/dist/{index-D9oM4gKs.js → index-DVY0KmHF.js} +1 -1
  37. package/dist/{index-BlxSIrHR.js → index-GluKZYof.js} +1 -1
  38. package/dist/{index-CSArnkgt.js → index-JjM7nnLl.js} +1 -1
  39. package/dist/{index-BYAaj_9w.js → index-afhcVzt-.js} +1 -1
  40. package/dist/{index-BzyT3DFq.js → index-jy0qmXan.js} +1 -1
  41. package/dist/{index.vue_vue_type_script_setup_true_lang-mR9s4UON.js → index.vue_vue_type_script_setup_true_lang-CQyJ-QxJ.js} +1 -1
  42. package/dist/{onboard-submission-CDAQMPJo.js → onboard-submission-yLxQsG7y.js} +1 -1
  43. package/dist/package.json +1 -1
  44. package/dist/{payout-account-KmlBBSlW.js → payout-account-C86XmNO4.js} +3 -3
  45. package/dist/style.css +1 -1
  46. package/dist/tsconfig.app.tsbuildinfo +1 -1
  47. package/dist/views/admin/external-terminal/cell/ID.vue.d.ts +0 -2
  48. package/dist/views/admin/external-terminal/cell/Provider.vue.d.ts +7 -0
  49. package/dist/views/admin/external-terminal/cell/Status.vue.d.ts +5 -0
  50. package/dist/views/admin/terminal/tabs/PaymentCheckout.vue.d.ts +5 -5
  51. package/package.json +1 -1
  52. package/dist/ExternalTerminal-D5PdLXl-.js +0 -563
@@ -1,6 +1,4 @@
1
- import { type Row } from '@feedmepos/ui-library';
2
1
  type __VLS_Props = {
3
- row: Row<any>;
4
2
  data: unknown;
5
3
  };
6
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, {}, any>;
@@ -0,0 +1,7 @@
1
+ import { type Row } from '@feedmepos/ui-library';
2
+ type __VLS_Props = {
3
+ row: Row<any>;
4
+ data: unknown;
5
+ };
6
+ 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, {}, any>;
7
+ export default _default;
@@ -0,0 +1,5 @@
1
+ type __VLS_Props = {
2
+ data: unknown;
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, {}, any>;
5
+ export default _default;
@@ -1,11 +1,11 @@
1
- import { type FdoTerminal } from "@feedmepos/payment-entity";
1
+ import { type FdoPaymentCheckout, type FdoTerminal } from "@feedmepos/payment-entity";
2
2
  import { type PropType } from "vue";
3
3
  declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
4
4
  terminal: {
5
5
  type: PropType<{
6
6
  name?: string | null | undefined;
7
7
  deviceId?: string | null | undefined;
8
- bindCode?: string | null | undefined; /** @type {[typeof __VLS_components.FmTextField, ]} */
8
+ bindCode?: string | null | undefined;
9
9
  secretKey?: string | null | undefined;
10
10
  token?: string | null | undefined;
11
11
  gateways?: {
@@ -93,7 +93,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
93
93
  required: true;
94
94
  };
95
95
  onUpdate: {
96
- type: PropType<(account: FdoTerminal) => Promise<void>>;
96
+ type: PropType<(terminal: FdoTerminal, paymentCheckouts?: FdoPaymentCheckout[]) => Promise<void>>;
97
97
  required: true;
98
98
  };
99
99
  }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
@@ -101,7 +101,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
101
101
  type: PropType<{
102
102
  name?: string | null | undefined;
103
103
  deviceId?: string | null | undefined;
104
- bindCode?: string | null | undefined; /** @type {[typeof __VLS_components.FmTextField, ]} */
104
+ bindCode?: string | null | undefined;
105
105
  secretKey?: string | null | undefined;
106
106
  token?: string | null | undefined;
107
107
  gateways?: {
@@ -189,7 +189,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
189
189
  required: true;
190
190
  };
191
191
  onUpdate: {
192
- type: PropType<(account: FdoTerminal) => Promise<void>>;
192
+ type: PropType<(terminal: FdoTerminal, paymentCheckouts?: FdoPaymentCheckout[]) => Promise<void>>;
193
193
  required: true;
194
194
  };
195
195
  }>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@feedmepos/mf-payment",
3
- "version": "1.9.11-dev",
3
+ "version": "1.9.13-dev",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"
@@ -1,563 +0,0 @@
1
- import { defineComponent as P, resolveComponent as p, openBlock as F, createElementBlock as M, createVNode as u, normalizeClass as Z, withCtx as I, createElementVNode as E, toDisplayString as j, createBlock as C, ref as d, Fragment as ee, unref as s, useModel as te, computed as R, watch as L, createCommentVNode as N, resolveDynamicComponent as W, mergeModels as z, createTextVNode as $, normalizeProps as ae, guardReactiveProps as re, isRef as ne, h as H } from "vue";
2
- import { h as le } from "./moment-h96o7c8I.js";
3
- import { useCoreStore as G } from "@feedmepos/mf-common";
4
- import { u as oe } from "./index-D9oM4gKs.js";
5
- import { _ as ie } from "./index.vue_vue_type_script_setup_true_lang-mR9s4UON.js";
6
- import { _ as se } from "./AdminLayout.vue_vue_type_script_setup_true_lang-0Mf1MhAL.js";
7
- import { useSnackbar as Q, useDialogChild as ue, useDialog as me } from "@feedmepos/ui-library";
8
- import { e as h } from "./index-CMyDiJi8.js";
9
- import { c as de } from "./clipboard-4jh1WteU.js";
10
- import { z as V, a as T } from "./validator-CTlVogBQ.js";
11
- import { _ as ce } from "./AdminRestaurantSelector.vue_vue_type_script_setup_true_lang-CXidPxKT.js";
12
- import { e as O, p as pe } from "./index-BanK-A0I.js";
13
- import { u as Y } from "./error-K1CakhA9.js";
14
- import { w as ve } from "./Modal-DB8M9o1T.js";
15
- const fe = /* @__PURE__ */ P({
16
- __name: "ID",
17
- props: {
18
- row: {},
19
- data: {}
20
- },
21
- setup(v) {
22
- const o = v, l = Q();
23
- function a() {
24
- return o.row.original.status === "READY" ? "!w-[16px] !h-[16px] bg-green-400" : "!w-[16px] !h-[16px] bg-amber-400";
25
- }
26
- function i() {
27
- try {
28
- de(o.data), l.open({ title: "Text copied to clipboard." }, 1e3);
29
- } catch {
30
- l.open({ title: "Clipboard API incompatible." }, 1e3);
31
- }
32
- }
33
- return (r, t) => {
34
- const m = p("FmBadge");
35
- return F(), M("div", {
36
- onClick: t[0] || (t[0] = (c) => {
37
- c.stopPropagation(), i();
38
- })
39
- }, [
40
- u(m, {
41
- inline: "",
42
- class: Z(a())
43
- }, {
44
- default: I(() => [
45
- E("div", null, j(v.data), 1)
46
- ]),
47
- _: 1
48
- }, 8, ["class"])
49
- ]);
50
- };
51
- }
52
- }), ye = { class: "flex items-center justify-center" }, _e = {
53
- key: 1,
54
- class: "t-caption text-fm-color-neutral-gray-500 whitespace-nowrap"
55
- }, xe = /* @__PURE__ */ P({
56
- __name: "Actions",
57
- props: {
58
- data: {}
59
- },
60
- emits: ["pair", "edit", "delete"],
61
- setup(v, { emit: o }) {
62
- const l = o;
63
- return (a, i) => {
64
- const r = p("FmButton");
65
- return F(), M("div", ye, [
66
- v.data.status === "NEW" ? (F(), C(r, {
67
- key: 0,
68
- variant: "tertiary",
69
- label: "Pair",
70
- "prepend-icon": "link",
71
- onClick: i[0] || (i[0] = (t) => {
72
- t.stopPropagation(), l("pair");
73
- })
74
- })) : (F(), M("div", _e, " Ready to use ")),
75
- u(r, {
76
- variant: "plain",
77
- "prepend-icon": "edit",
78
- onClick: i[1] || (i[1] = (t) => {
79
- t.stopPropagation(), l("edit");
80
- })
81
- }),
82
- u(r, {
83
- variant: "plain",
84
- "prepend-icon": "delete",
85
- onClick: i[2] || (i[2] = (t) => {
86
- t.stopPropagation(), l("delete");
87
- })
88
- })
89
- ]);
90
- };
91
- }
92
- }), ge = /* @__PURE__ */ P({
93
- __name: "BRITerminal",
94
- props: {
95
- initial: {
96
- type: Object
97
- }
98
- },
99
- setup(v, { expose: o }) {
100
- var m, c, _, x;
101
- const l = v, a = d(((m = l.initial) == null ? void 0 : m.wsUrl) ?? ""), i = d(((c = l.initial) == null ? void 0 : c.mid) ?? ""), r = d(((_ = l.initial) == null ? void 0 : _.apiKey) ?? ""), t = d(((x = l.initial) == null ? void 0 : x.privateKey) ?? "");
102
- return o({
103
- values: () => ({
104
- wsUrl: a.value,
105
- mid: i.value,
106
- apiKey: r.value,
107
- privateKey: t.value
108
- })
109
- }), (D, b) => {
110
- const w = p("FmTextField"), S = p("FmTextarea");
111
- return F(), M(ee, null, [
112
- u(w, {
113
- modelValue: a.value,
114
- "onUpdate:modelValue": b[0] || (b[0] = (e) => a.value = e),
115
- label: "PVS WebSocket URL",
116
- placeholder: "wss://...",
117
- rules: s(V)(s(T).string().min(1, "WebSocket URL is required"))
118
- }, null, 8, ["modelValue", "rules"]),
119
- u(w, {
120
- modelValue: i.value,
121
- "onUpdate:modelValue": b[1] || (b[1] = (e) => i.value = e),
122
- label: "Merchant ID (MID)",
123
- rules: s(V)(s(T).string().min(1, "MID is required"))
124
- }, null, 8, ["modelValue", "rules"]),
125
- u(w, {
126
- modelValue: r.value,
127
- "onUpdate:modelValue": b[2] || (b[2] = (e) => r.value = e),
128
- label: "API Key",
129
- rules: s(V)(s(T).string().min(1, "API key is required"))
130
- }, null, 8, ["modelValue", "rules"]),
131
- u(S, {
132
- modelValue: t.value,
133
- "onUpdate:modelValue": b[3] || (b[3] = (e) => t.value = e),
134
- label: "Private Key",
135
- rows: 3,
136
- placeholder: "PEM, or base64 of the PEM",
137
- rules: s(V)(s(T).string().min(1, "Private key is required"))
138
- }, null, 8, ["modelValue", "rules"])
139
- ], 64);
140
- };
141
- }
142
- }), Fe = /* @__PURE__ */ P({
143
- __name: "ExternalTerminalSideSheet",
144
- props: /* @__PURE__ */ z({
145
- terminal: {
146
- type: Object
147
- }
148
- }, {
149
- modelValue: { type: Boolean, default: !1 },
150
- modelModifiers: {}
151
- }),
152
- emits: /* @__PURE__ */ z(["submit"], ["update:modelValue"]),
153
- setup(v, { emit: o }) {
154
- const l = G(), a = v, i = o, r = te(v, "modelValue"), t = d(), m = d(), c = d(""), _ = d(""), x = d(), D = d({}), b = {
155
- BEAM: [O.F_COUNTRY.enum.TH],
156
- BRI: [O.F_COUNTRY.enum.ID]
157
- }, w = {
158
- BRI: ge
159
- }, S = l.currentCountry, e = R(
160
- () => pe.FdoExternalTerminalProvider.options.filter(
161
- (f) => b[f].includes(S.value ?? O.F_COUNTRY.enum.MY)
162
- ).map((f) => ({
163
- label: f,
164
- value: f
165
- }))
166
- ), n = R(() => {
167
- var f;
168
- return ((f = a.terminal) == null ? void 0 : f.type) ?? x.value;
169
- }), y = R(
170
- () => n.value ? w[n.value] : void 0
171
- );
172
- L(r, (f) => {
173
- var g, U, A, K;
174
- f && (c.value = ((g = a.terminal) == null ? void 0 : g.name) ?? "", _.value = ((U = a.terminal) == null ? void 0 : U.restaurantId) ?? "", x.value = (A = a.terminal) == null ? void 0 : A.type, D.value = { ...((K = a.terminal) == null ? void 0 : K.providerData) ?? {} });
175
- });
176
- function B() {
177
- i("submit", {
178
- name: c.value,
179
- restaurantId: _.value,
180
- type: x.value,
181
- providerData: m.value ? { ...D.value, ...m.value.values() } : void 0
182
- }), r.value = !1;
183
- }
184
- return (f, g) => {
185
- const U = p("FmSelect"), A = p("FmTextField"), K = p("FmButton"), J = p("FmForm"), X = p("FmSideSheet");
186
- return F(), C(X, {
187
- modelValue: r.value,
188
- "onUpdate:modelValue": g[3] || (g[3] = (q) => r.value = q),
189
- header: a.terminal ? "Update External Terminal" : "Create New External Terminal",
190
- "close-button": ""
191
- }, {
192
- default: I(() => [
193
- u(J, {
194
- ref: t.value,
195
- class: "flex flex-col gap-16 px-4 py-6",
196
- onValidationSuccess: B
197
- }, {
198
- default: I(() => {
199
- var q;
200
- return [
201
- a.terminal ? N("", !0) : (F(), C(U, {
202
- key: 0,
203
- modelValue: x.value,
204
- "onUpdate:modelValue": g[0] || (g[0] = (k) => x.value = k),
205
- label: "Provider",
206
- items: e.value,
207
- rules: s(V)(s(T).string().min(1, "Provider is required"))
208
- }, null, 8, ["modelValue", "items", "rules"])),
209
- a.terminal ? N("", !0) : (F(), C(ce, {
210
- key: 1,
211
- modelValue: _.value,
212
- "onUpdate:modelValue": g[1] || (g[1] = (k) => _.value = k),
213
- label: "Restaurant",
214
- "search-placeholder": "Search restaurants",
215
- rules: s(V)(s(T).string().min(1, "Restaurant is required"))
216
- }, null, 8, ["modelValue", "rules"])),
217
- u(A, {
218
- modelValue: c.value,
219
- "onUpdate:modelValue": g[2] || (g[2] = (k) => c.value = k),
220
- label: "Terminal Name",
221
- rules: s(V)(s(T).string().min(1))
222
- }, null, 8, ["modelValue", "rules"]),
223
- y.value ? (F(), C(W(y.value), {
224
- key: `${((q = a.terminal) == null ? void 0 : q._id) ?? "new"}-${n.value}`,
225
- ref_key: "configForm",
226
- ref: m,
227
- initial: D.value
228
- }, null, 8, ["initial"])) : N("", !0),
229
- u(K, {
230
- type: "submit",
231
- label: a.terminal ? "Update" : "Create"
232
- }, null, 8, ["label"])
233
- ];
234
- }),
235
- _: 1
236
- }, 512)
237
- ]),
238
- _: 1
239
- }, 8, ["modelValue", "header"]);
240
- };
241
- }
242
- }), be = { class: "t-caption" }, Ve = /* @__PURE__ */ P({
243
- __name: "BeamTerminal",
244
- props: {
245
- terminal: {
246
- type: Object,
247
- required: !0
248
- },
249
- onPair: {
250
- type: Function,
251
- required: !0
252
- }
253
- },
254
- setup(v) {
255
- const o = v, l = d(), a = d("");
256
- return (i, r) => {
257
- const t = p("FmTextField"), m = p("FmButton"), c = p("FmForm");
258
- return F(), C(c, {
259
- ref: l.value,
260
- class: "flex flex-col gap-16 mb-6",
261
- onValidationSuccess: r[1] || (r[1] = () => o.onPair({ type: "BEAM", pairCode: a.value }))
262
- }, {
263
- default: I(() => [
264
- E("div", be, [
265
- r[2] || (r[2] = $(" Enter the pairing code shown on ", -1)),
266
- E("b", null, j(o.terminal.name), 1),
267
- r[3] || (r[3] = $(" to register it with Bolt Connect. ", -1))
268
- ]),
269
- u(t, {
270
- modelValue: a.value,
271
- "onUpdate:modelValue": r[0] || (r[0] = (_) => a.value = _),
272
- label: "Pair Code",
273
- "label-mark": "required",
274
- rules: s(V)(s(T).string().min(1, "Pair code is required"))
275
- }, null, 8, ["modelValue", "rules"]),
276
- u(m, {
277
- type: "submit",
278
- label: "Pair"
279
- })
280
- ]),
281
- _: 1
282
- }, 512);
283
- };
284
- }
285
- }), Te = { class: "t-caption" }, Ce = /* @__PURE__ */ P({
286
- __name: "BRITerminal",
287
- props: {
288
- terminal: {
289
- type: Object,
290
- required: !0
291
- },
292
- onPair: {
293
- type: Function,
294
- required: !0
295
- }
296
- },
297
- setup(v) {
298
- const o = v, l = d(), a = d(""), i = d("");
299
- return (r, t) => {
300
- const m = p("FmTextField"), c = p("FmButton"), _ = p("FmForm");
301
- return F(), C(_, {
302
- ref: l.value,
303
- class: "flex flex-col gap-16 mb-6",
304
- onValidationSuccess: t[2] || (t[2] = () => o.onPair({ type: "BRI", pairCode: a.value, edcId: i.value }))
305
- }, {
306
- default: I(() => [
307
- E("div", Te, [
308
- t[3] || (t[3] = $(" Enter the pairing code and EDC ID shown on ", -1)),
309
- E("b", null, j(o.terminal.name), 1),
310
- t[4] || (t[4] = $(" to register it with BRI. ", -1))
311
- ]),
312
- u(m, {
313
- modelValue: a.value,
314
- "onUpdate:modelValue": t[0] || (t[0] = (x) => a.value = x),
315
- label: "Pair Code",
316
- "label-mark": "required",
317
- rules: s(V)(s(T).string().min(1, "Pair code is required"))
318
- }, null, 8, ["modelValue", "rules"]),
319
- u(m, {
320
- modelValue: i.value,
321
- "onUpdate:modelValue": t[1] || (t[1] = (x) => i.value = x),
322
- label: "EDC ID",
323
- "label-mark": "required",
324
- rules: s(V)(s(T).string().min(1, "EDC ID is required"))
325
- }, null, 8, ["modelValue", "rules"]),
326
- u(c, {
327
- type: "submit",
328
- label: "Pair"
329
- })
330
- ]),
331
- _: 1
332
- }, 512);
333
- };
334
- }
335
- }), Ee = /* @__PURE__ */ P({
336
- __name: "ExternalTerminalPairDialog",
337
- props: {
338
- terminal: {
339
- type: Object,
340
- required: !0
341
- }
342
- },
343
- setup(v) {
344
- const o = v, l = ue(), a = {
345
- BEAM: Ve,
346
- BRI: Ce
347
- }, i = R(() => a[o.terminal.type]);
348
- function r(t) {
349
- l.emitData(t), l.emitAction("primary");
350
- }
351
- return (t, m) => (F(), C(W(i.value), ae(re({
352
- terminal: o.terminal,
353
- onPair: r
354
- })), null, 16));
355
- }
356
- }), Pe = { class: "flex justify-between mb-6 items-center" }, we = { class: "flex space-x-4" }, Be = { class: "flex space-x-4" }, Ye = /* @__PURE__ */ P({
357
- __name: "ExternalTerminal",
358
- setup(v) {
359
- const o = d(), { searchKey: l } = oe({
360
- searchKey: ""
361
- });
362
- let a;
363
- L(l, async () => {
364
- a && clearTimeout(a), a = setTimeout(() => {
365
- var e;
366
- return (e = o.value) == null ? void 0 : e.reset();
367
- }, 700);
368
- });
369
- const i = G(), r = me(), t = Q();
370
- R(
371
- () => new Map(i.restaurants.value.map((e) => [e._id, e.profile.name]))
372
- );
373
- const m = d(!1), c = d();
374
- function _(e) {
375
- c.value = e, m.value = !0;
376
- }
377
- async function x(e) {
378
- var y;
379
- const n = c.value;
380
- try {
381
- n ? await h.updateById(
382
- n._id,
383
- e.type === "BRI" ? {
384
- type: "BRI",
385
- name: e.name,
386
- providerData: e.providerData
387
- } : { type: "BEAM", name: e.name }
388
- ) : await h.create(e), (y = o.value) == null || y.reset(), t.open({
389
- type: "success",
390
- message: n ? "External terminal updated successfully." : "External terminal created successfully."
391
- });
392
- } catch (B) {
393
- t.open({
394
- type: "error",
395
- title: n ? "Error occurs when update external terminal" : "Error occurs when create external terminal",
396
- message: Y(B)
397
- });
398
- }
399
- }
400
- async function D(e) {
401
- r.open({
402
- title: "Pair External Terminal",
403
- closeButton: !0,
404
- overlay: !0,
405
- contentComponent: Ee,
406
- contentComponentProps: { terminal: e }
407
- }).onPrimary(async (n) => {
408
- var y;
409
- r.close();
410
- try {
411
- await h.pair(e._id, n), (y = o.value) == null || y.reset(), t.open({
412
- type: "success",
413
- message: "External terminal paired successfully."
414
- });
415
- } catch (B) {
416
- t.open({
417
- type: "error",
418
- title: "Error occurs when pair external terminal",
419
- message: Y(B)
420
- });
421
- }
422
- });
423
- }
424
- async function b(e) {
425
- ve(
426
- r,
427
- "Delete External Terminal",
428
- "Are you sure to delete this external terminal? This action cannot be revert!",
429
- async () => {
430
- var n;
431
- try {
432
- await h.delete(e), (n = o.value) == null || n.reset(), t.open({
433
- type: "success",
434
- message: "External terminal deleted successfully."
435
- });
436
- } catch (y) {
437
- t.open({
438
- type: "error",
439
- title: "Error occurs when delete external terminal",
440
- message: Y(y)
441
- });
442
- }
443
- }
444
- );
445
- }
446
- const w = function(e) {
447
- return {
448
- id: e._id,
449
- status: e.status,
450
- name: e.name,
451
- type: e.type,
452
- restaurant: e.restaurantId,
453
- updatedAt: le(e.updatedAt).format("YYYY-MM-DD HH:mm:ss")
454
- };
455
- }, S = [
456
- {
457
- accessorKey: "id",
458
- header: () => "Terminal ID",
459
- meta: {
460
- textAlign: "right"
461
- },
462
- cell: ({ cell: e, row: n }) => H(fe, { row: n, data: e.getValue() })
463
- },
464
- {
465
- accessorKey: "name",
466
- header: () => "Name",
467
- meta: {
468
- textAlign: "left"
469
- }
470
- },
471
- {
472
- accessorKey: "type",
473
- header: () => "Provider",
474
- meta: {
475
- textAlign: "left"
476
- }
477
- },
478
- {
479
- accessorKey: "restaurant",
480
- header: () => "Restaurant",
481
- meta: {
482
- textAlign: "left"
483
- }
484
- },
485
- {
486
- accessorKey: "status",
487
- header: () => "Status",
488
- meta: {
489
- textAlign: "left"
490
- }
491
- },
492
- {
493
- accessorKey: "updatedAt",
494
- header: () => "Last Updated",
495
- meta: {
496
- textAlign: "left"
497
- }
498
- },
499
- {
500
- accessorKey: "id",
501
- header: () => "Actions",
502
- meta: {
503
- textAlign: "center"
504
- },
505
- cell: ({ row: e }) => {
506
- var y;
507
- const n = (y = o.value) == null ? void 0 : y.pageData().at(e.index);
508
- return H(xe, {
509
- data: n,
510
- onPair: () => D(n),
511
- onEdit: () => _(n),
512
- onDelete: () => b(n._id)
513
- });
514
- }
515
- }
516
- ];
517
- return (e, n) => {
518
- const y = p("FmSearch"), B = p("FmButton");
519
- return F(), C(se, {
520
- title: "External Terminals",
521
- loading: !1
522
- }, {
523
- default: I(() => [
524
- E("div", Pe, [
525
- E("div", we, [
526
- u(y, {
527
- "model-value": s(l),
528
- "onUpdate:modelValue": n[0] || (n[0] = (f) => ne(l) ? l.value = f : null),
529
- class: "mr-8",
530
- label: "Search",
531
- placeholder: "Search ..."
532
- }, null, 8, ["model-value"])
533
- ]),
534
- E("div", Be, [
535
- u(B, {
536
- label: "Create",
537
- icon: "add",
538
- onClick: n[1] || (n[1] = () => _())
539
- })
540
- ])
541
- ]),
542
- u(ie, {
543
- ref_key: "controller",
544
- ref: o,
545
- "column-defs": S,
546
- "rows-defs": w,
547
- paginate: (f, g) => s(h).read({ searchKey: s(l), limit: f, cursor: g })
548
- }, null, 8, ["paginate"]),
549
- u(Fe, {
550
- modelValue: m.value,
551
- "onUpdate:modelValue": n[2] || (n[2] = (f) => m.value = f),
552
- terminal: c.value,
553
- onSubmit: x
554
- }, null, 8, ["modelValue", "terminal"])
555
- ]),
556
- _: 1
557
- });
558
- };
559
- }
560
- });
561
- export {
562
- Ye as default
563
- };