@feedmepos/mf-connect 0.1.0-beta.45 → 0.1.0-beta.47

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 (82) hide show
  1. package/dist/{Analytic-BjwZQX39.js → Analytic-lSdhbAE5.js} +10 -10
  2. package/dist/{App-Dvs3_Z5O.js → App-5yWxPSqa.js} +6 -6
  3. package/dist/{Broadcast-a2H3LF3s.js → Broadcast-BkDCNB93.js} +8 -8
  4. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-C2OtGvlw.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-2l4qBEIr.js} +6 -6
  5. package/dist/{Card-CWWCCewT.js → Card-CKh6sC-j.js} +14 -14
  6. package/dist/{Collections-B2FojWde.js → Collections-D81rKHHA.js} +4 -4
  7. package/dist/{Credit-Dh0mQqJn.js → Credit-Swf1Bccg.js} +8 -8
  8. package/dist/{EditCampaignSheet.vue_vue_type_script_setup_true_lang-EwsODqaZ.js → EditCampaignSheet.vue_vue_type_script_setup_true_lang-CFGREAre.js} +27 -27
  9. package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-D25VstRS.js → EffectSheet.vue_vue_type_style_index_0_lang-DN186Ykx.js} +6 -6
  10. package/dist/{Experience-Ie9Bo9iB.js → Experience-DoAwLHvr.js} +8 -8
  11. package/dist/{Game-BM1cOcY5.js → Game-B4-8bZaf.js} +8 -8
  12. package/dist/{Index-DvJs3UAT.js → Index-O-qPz_45.js} +9 -9
  13. package/dist/{Marketing-MpYLBNDQ.js → Marketing-A8TyRzoX.js} +5 -5
  14. package/dist/{Member-BEB10ygY.js → Member-C9uQuhVr.js} +4 -4
  15. package/dist/MemberList--aWor7_G.js +1596 -0
  16. package/dist/{MemberTransactions-YIQ-_zlK.js → MemberTransactions-C-01Qdmx.js} +1 -1
  17. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-CY-MH_iI.js → MessageInput.vue_vue_type_script_setup_true_lang-Cdx1rPtp.js} +2 -2
  18. package/dist/{Mission-XnZWYc5H.js → Mission-Ln1_nTS2.js} +8 -8
  19. package/dist/{Overview-pYdy_goH.js → Overview-BJlPQi5S.js} +16 -16
  20. package/dist/{Point-ovwfLSFh.js → Point-wi6j4ns_.js} +8 -8
  21. package/dist/{Promotion-BITFDxR-.js → Promotion-hahMm7v9.js} +9 -9
  22. package/dist/{Record-vjah9GaK.js → Record-BO7qqPQP.js} +6 -6
  23. package/dist/{Reward-Bt__mhKV.js → Reward-DQhrs6So.js} +65 -64
  24. package/dist/{RewardGroup.vue_vue_type_script_setup_true_lang-BjYTMl_a.js → RewardGroup.vue_vue_type_script_setup_true_lang-a7CjUVso.js} +10 -10
  25. package/dist/{RuleGroup.vue_vue_type_script_setup_true_lang-CiwE3c6k.js → RuleGroup.vue_vue_type_script_setup_true_lang-CIkop4iY.js} +12 -12
  26. package/dist/{Segment-C9Bd35KQ.js → Segment-Cdi_lkEd.js} +13 -13
  27. package/dist/{SelectItems.vue_vue_type_script_setup_true_lang-XoQ5-CV8.js → SelectItems.vue_vue_type_script_setup_true_lang-DIpnyCH_.js} +2 -2
  28. package/dist/{Setting-BP7tAdY4.js → Setting-CEmkP1ak.js} +9 -9
  29. package/dist/{Store-pkGUh3Zm.js → Store-BXcCorEJ.js} +17 -17
  30. package/dist/{StoreRewards-C63vA7Kk.js → StoreRewards-C6s4S1bR.js} +12 -12
  31. package/dist/{StoreTransactions.vue_vue_type_script_setup_true_lang-VEdomYI_.js → StoreTransactions.vue_vue_type_script_setup_true_lang-e2Phr4sy.js} +17 -17
  32. package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-CDSOE29J.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-9XLezVlo.js} +1 -1
  33. package/dist/{Tier-DQZKblL_.js → Tier-ymDmSa8e.js} +18 -18
  34. package/dist/{Title-ClkX72Ir.js → Title-DyT8EwGd.js} +18 -18
  35. package/dist/{Transaction-B933-pIH.js → Transaction-BqfYCKHC.js} +2 -2
  36. package/dist/{UserRuleGroup.vue_vue_type_script_setup_true_lang-D3O3M6Qw.js → UserRuleGroup.vue_vue_type_script_setup_true_lang-D8OzqKdh.js} +6 -6
  37. package/dist/{Voucher-G7ywUwjB.js → Voucher-B4H6izT-.js} +11 -11
  38. package/dist/{VoucherEditor.vue_vue_type_script_setup_true_lang-CLXzGkQ8.js → VoucherEditor.vue_vue_type_script_setup_true_lang-BzUCl5A0.js} +10 -10
  39. package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-nvaDHtuf.js → ZodTextField.vue_vue_type_script_setup_true_lang-Qyn1rKwq.js} +1 -1
  40. package/dist/{app-C0oBILJ2.js → app-DFhKMlXT.js} +28 -28
  41. package/dist/{app-Beet9tUu.js → app-fgJef1gk.js} +1 -1
  42. package/dist/app.js +1 -1
  43. package/dist/{business-VgdrINGO.js → business-CWVg8oTw.js} +1 -1
  44. package/dist/{campaign-CxXRTMmE.js → campaign-CXx39lOY.js} +9 -9
  45. package/dist/{campaign-CZTdUrMu.js → campaign-DqE4D_Ie.js} +2 -2
  46. package/dist/{campaign.enum-D2wSHmQx.js → campaign.enum-BhHy5QqC.js} +1 -1
  47. package/dist/{campaign.fn-BbqKYcrw.js → campaign.fn-DpRMdaoZ.js} +22 -22
  48. package/dist/{collectible.enum-BxcI4yWH.js → collectible.enum-CsAoXB-o.js} +1 -1
  49. package/dist/{collection.fn-gDP3q9jD.js → collection.fn-BgfqVgLc.js} +2 -2
  50. package/dist/{dto-B9btUyaP.js → dto-CbOlUDXO.js} +4 -4
  51. package/dist/{effect-DxVo_v8x.js → effect-DVzBcdAh.js} +1 -1
  52. package/dist/{email-addresses-DDUEYehN.js → email-addresses-D7cuPyCu.js} +1 -1
  53. package/dist/{export-9TveNOb1.js → export-fqAmDRzH.js} +5 -5
  54. package/dist/{helper-BE3MH0kV.js → helper-Cr9hVBrL.js} +1 -1
  55. package/dist/{index-Cgbi9dJ5.js → index-1fDhAPmJ.js} +2 -2
  56. package/dist/{index-Di9E6l5y.js → index-B-VO7A5g.js} +4 -4
  57. package/dist/{index-CFopBV2A.js → index-BYziLSU1.js} +1 -1
  58. package/dist/{index-CtQZBAI1.js → index-BpqE7ONp.js} +3 -3
  59. package/dist/{index-DW8iifyS.js → index-BrZ9oOl8.js} +1 -1
  60. package/dist/{index-D5r0OeAs.js → index-CLKiPqHH.js} +3 -3
  61. package/dist/{index-Sfy8KKeP.js → index-CLeEuF1Q.js} +1 -1
  62. package/dist/{index-BcHTyJek.js → index-CoGSXqP_.js} +6 -6
  63. package/dist/{index-CaZpkskS.js → index-Lrwmot9Q.js} +1 -1
  64. package/dist/{index-Q3hKRKMe.js → index-c-mT7CUc.js} +16 -5
  65. package/dist/{index-BZ7gVL8f.js → index-iHW9prE9.js} +1 -1
  66. package/dist/{index-BSMVnQ4E.js → index-zaKL-M_1.js} +1 -1
  67. package/dist/{index.esm2017-CgDW40nF.js → index.esm2017-CZ5oluks.js} +1 -1
  68. package/dist/{loading-BV_uwtpG.js → loading-D84WknQA.js} +4 -4
  69. package/dist/{membership-BIm_U0K3.js → membership-D9qRdNxE.js} +3 -3
  70. package/dist/{money-DJEtzYrY.js → money-B-nNBD6W.js} +1 -1
  71. package/dist/{number-Bq64oQ5h.js → number--UNR-Ea-.js} +1 -1
  72. package/dist/{objectid-DsZvG_IA.js → objectid-DJNlN9do.js} +4 -4
  73. package/dist/{reward-CYVVLw0c.js → reward-tqNSZbg2.js} +1 -1
  74. package/dist/{rule-builder-BqLJsffO.js → rule-builder-djwiKBYX.js} +1 -1
  75. package/dist/{rule-pXA06Cth.js → rule-tJ5_2tKg.js} +3 -3
  76. package/dist/{template-CufZHpMl.js → template-DrDV1Aex.js} +4 -4
  77. package/dist/{trigger-BaZB592e.js → trigger-ChRRXEa5.js} +4 -4
  78. package/dist/{usePagination-CYaPym1G.js → usePagination--wzkJiPp.js} +1 -1
  79. package/dist/{user-CJzzLCCr.js → user-CwS7aiK5.js} +1 -1
  80. package/dist/{vue-i18n-DJrZ_4TC.js → vue-i18n-BLCr04dZ.js} +201 -201
  81. package/package.json +1 -1
  82. package/dist/MemberList-BAkyfu4k.js +0 -1554
@@ -1,1554 +0,0 @@
1
- import { defineComponent as be, computed as q, ref as Z, resolveComponent as V, openBlock as f, createElementBlock as A, Fragment as z, createElementVNode as o, unref as e, createBlock as G, createCommentVNode as he, createVNode as h, renderList as le, withCtx as xe, createTextVNode as Fe, toDisplayString as E, withDirectives as ze, vShow as je, watch as qe, onBeforeMount as ct, h as j, onMounted as Ge, isRef as dt, normalizeClass as mt } from "vue";
2
- import { h as w } from "./moment-BWErdI6_.js";
3
- import { useDialog as Ie, components as ve } from "@feedmepos/ui-library";
4
- import { e as ut, M as pt } from "./email-addresses-DDUEYehN.js";
5
- import { a as Ke, _ as He, w as bt } from "./usePagination-CYaPym1G.js";
6
- import "./index-CFopBV2A.js";
7
- import { p as Pe, c as Ye, b as Oe, u as We } from "./loading-BV_uwtpG.js";
8
- import { u as Ve, C as Ue, s as ft } from "./membership-BIm_U0K3.js";
9
- import { c as yt } from "./index-D5r0OeAs.js";
10
- import { _ as Re } from "./lodash-B5I3zXaY.js";
11
- import { D as gt } from "./type_drinks-D6jnpvwV.js";
12
- import { j as vt, k as xt, l as ht, m as _t, n as St, d as Le } from "./index-Di9E6l5y.js";
13
- import { C as Ae } from "./collection.fn-gDP3q9jD.js";
14
- import { u as Je } from "./business-VgdrINGO.js";
15
- import { defineStore as Ct } from "pinia";
16
- import { u as wt } from "./campaign-CZTdUrMu.js";
17
- import { f as Q } from "./number-Bq64oQ5h.js";
18
- import "./index-Cgbi9dJ5.js";
19
- import "./index-BcHTyJek.js";
20
- import "./index-CaZpkskS.js";
21
- import "./index-CtQZBAI1.js";
22
- import { m as Xe } from "./index-Q3hKRKMe.js";
23
- import { s as Ft } from "./index-CsaQJMAR.js";
24
- import { o as Me } from "./objectId-dwaoBfJX.js";
25
- import { a as ke } from "./collectible.enum-BxcI4yWH.js";
26
- import { c as Tt, a as Mt } from "./campaign-CxXRTMmE.js";
27
- import { useRouter as Qe } from "vue-router";
28
- import { m as ce } from "./index-BSMVnQ4E.js";
29
- import { t as kt } from "./index-BZ7gVL8f.js";
30
- import { R as Ze } from "./app-C0oBILJ2.js";
31
- import { t as At } from "./money-DJEtzYrY.js";
32
- import { g as It, a as Vt, b as Et } from "./user-CJzzLCCr.js";
33
- const $t = { class: "flex flex-col" }, Nt = { key: 1 }, Dt = { class: "flex flex-nowrap gap-4 items-center my-[-4px]" }, Bt = { class: "flex flex-nowrap gap-8 items-center pt-24 w-full" }, Pt = /* @__PURE__ */ be({
34
- __name: "MemberStatsDialog",
35
- props: {
36
- member: {
37
- type: Object,
38
- required: !0
39
- },
40
- onSubmit: {
41
- type: Function,
42
- required: !0
43
- }
44
- },
45
- setup(g) {
46
- var fe, ae, se, W;
47
- const N = Ie(), b = Ve(), p = g, r = q(
48
- () => {
49
- var m;
50
- return (((m = p.member.collection) == null ? void 0 : m.TITLE) ?? []).reduce(
51
- (c, M) => {
52
- var C, F, U, D, B;
53
- const s = b.sortedTitles.find(
54
- (te) => te._id.toString() === M.collectible
55
- );
56
- if (!s) return c;
57
- const l = [...M.expiryBalance ?? []].sort(
58
- (te, re) => w(te.expiredAt).isAfter(w(re.expiredAt)) ? -1 : 1
59
- );
60
- return (C = l[0]) != null && C.expiredAt && w((F = l[0]) == null ? void 0 : F.expiredAt).isBefore(w()) || c.push({
61
- _id: s._id,
62
- name: s.name,
63
- expiredAt: (U = l[0]) != null && U.expiredAt ? w((D = l[0]) == null ? void 0 : D.expiredAt).toISOString() : "",
64
- expiresIn: w((B = l[0]) == null ? void 0 : B.expiredAt).diff(w(), "days")
65
- }), c;
66
- },
67
- []
68
- );
69
- }
70
- ), a = Z({
71
- cardNo: p.member.cardNo,
72
- experience: ((ae = (fe = p.member.collection) == null ? void 0 : fe.POINT) == null ? void 0 : ae[0].balance) ?? 0,
73
- tier: ((W = (se = p.member.collection) == null ? void 0 : se.TIER) == null ? void 0 : W[0].balance) ?? -1,
74
- titles: r.value.map((m) => ({ expiredAt: m.expiresIn, id: m._id })) ?? void 0
75
- }), x = q(
76
- () => (b.sortedTitles ?? []).map((m) => ({
77
- label: m.name,
78
- value: m._id.toString(),
79
- sublabel: r.value.some((c) => c._id === m._id) ? "Owned" : void 0
80
- }))
81
- ), y = q(() => (b.sortedTiers ?? []).map((m, c) => ({
82
- label: m.name,
83
- sublabel: `${m.option.from} - ${m.option.to}`,
84
- from: m.option.from,
85
- to: m.option.to,
86
- value: c + 1
87
- })));
88
- function T() {
89
- var M, s;
90
- const m = ((M = y.value[(a.value.tier ?? 1) - 1]) == null ? void 0 : M.from) ?? 0, c = (s = y.value[(a.value.tier ?? 1) - 1]) == null ? void 0 : s.to;
91
- a.value.experience = Math.min(
92
- c ?? m,
93
- Math.max(m, a.value.experience ?? 0)
94
- );
95
- }
96
- const S = q(() => {
97
- var M, s, l, C, F, U;
98
- const m = ((s = (M = p.member.collection) == null ? void 0 : M.TIER) == null ? void 0 : s[0].balance) ?? -1, c = ((C = (l = p.member.collection) == null ? void 0 : l.POINT) == null ? void 0 : C[0].balance) ?? 0;
99
- if (m != a.value.tier) return !0;
100
- if (a.value.experience && a.value.experience != c) {
101
- const D = ((F = y.value[m - 1]) == null ? void 0 : F.from) ?? 0, B = ((U = y.value[m - 1]) == null ? void 0 : U.to) ?? 0;
102
- if (a.value.experience < D || B && a.value.experience > B)
103
- return !0;
104
- }
105
- return !1;
106
- });
107
- function u(m) {
108
- var c;
109
- return (c = r.value.find((M) => M._id === m)) == null ? void 0 : c.expiresIn;
110
- }
111
- const O = q(() => {
112
- const m = vt.safeParse(a.value);
113
- return m.success ? void 0 : m.error.errors;
114
- });
115
- function K(m) {
116
- var c, M;
117
- return (M = (c = O.value) == null ? void 0 : c.find((s) => s.path.join(".") === m)) == null ? void 0 : M.message;
118
- }
119
- function ee(m) {
120
- var c;
121
- return (c = O.value) == null ? void 0 : c.filter((M) => M.path.join(".").startsWith(m)).map((M) => M.message);
122
- }
123
- async function H() {
124
- await p.onSubmit(a.value), N.close();
125
- }
126
- return (m, c) => {
127
- var te, re;
128
- const M = V("FmSelect"), s = V("FmStepperField"), l = V("FmTextField"), C = V("FmField"), F = V("FmFormGroup"), U = V("FmButton"), D = V("FmHelperText"), B = V("FmSpacer");
129
- return f(), A(z, null, [
130
- o("div", $t, [
131
- c[6] || (c[6] = o("div", { class: "fm-typo-en-title-sm-800 mb-8" }, "Member tiering", -1)),
132
- e(y).length ? (f(), G(M, {
133
- key: 0,
134
- modelValue: e(a).tier,
135
- "onUpdate:modelValue": [
136
- c[0] || (c[0] = (k) => e(a).tier = k),
137
- T
138
- ],
139
- label: "Member Tier",
140
- items: e(y),
141
- "helper-text": K("tier"),
142
- "helper-state": K("tier") ? "error" : void 0
143
- }, null, 8, ["modelValue", "items", "helper-text", "helper-state"])) : he("", !0),
144
- h(s, {
145
- "model-value": e(a).experience ?? 0,
146
- "onUpdate:modelValue": c[1] || (c[1] = (k) => e(a).experience = k),
147
- label: "Member Experience",
148
- "max-fraction-digits": 0,
149
- "helper-text": K("experience"),
150
- "helper-state": K("experience") ? "error" : void 0
151
- }, null, 8, ["model-value", "helper-text", "helper-state"]),
152
- c[7] || (c[7] = o("div", { class: "fm-typo-en-title-sm-800 mt-16 mb-8" }, "Member Card", -1)),
153
- h(l, {
154
- modelValue: e(a).cardNo,
155
- "onUpdate:modelValue": c[2] || (c[2] = (k) => e(a).cardNo = k),
156
- label: "Card number",
157
- "helper-text": K("cardNo"),
158
- "helper-state": K("cardNo") ? "error" : void 0
159
- }, null, 8, ["modelValue", "helper-text", "helper-state"]),
160
- c[8] || (c[8] = o("div", { class: "fm-typo-en-title-sm-800 mt-16 mb-8" }, "Titles", -1)),
161
- (te = e(a).titles) != null && te.length ? (f(), A("div", Nt, c[5] || (c[5] = [
162
- o("div", { class: "flex flex-nowrap gap-4 items-center" }, [
163
- o("div", { class: "flex-1" }, "Title"),
164
- o("div", { class: "flex-1" }, "Expires in days"),
165
- o("div", { class: "w-24 h-1" })
166
- ], -1)
167
- ]))) : he("", !0),
168
- (f(!0), A(z, null, le(e(a).titles ?? [], (k, P) => (f(), A("div", { key: P }, [
169
- o("div", Dt, [
170
- e(r).some((I) => I._id === k.id) ? (f(), G(F, {
171
- key: 1,
172
- "model-value": "",
173
- class: "flex-1"
174
- }, {
175
- default: xe(() => [
176
- h(C, {
177
- disabled: !0,
178
- class: "text-fm-color-typo-secondary"
179
- }, {
180
- default: xe(() => {
181
- var I;
182
- return [
183
- Fe(E((I = e(x).find((n) => n.value === k.id)) == null ? void 0 : I.label), 1)
184
- ];
185
- }),
186
- _: 2
187
- }, 1024)
188
- ]),
189
- _: 2
190
- }, 1024)) : (f(), G(M, {
191
- key: 0,
192
- modelValue: k.id,
193
- "onUpdate:modelValue": [(I) => k.id = I, (I) => k.expiredAt = u(I) ?? 1],
194
- class: "flex-1",
195
- items: e(x).filter(
196
- (I) => {
197
- var n;
198
- return !((n = e(a).titles) != null && n.map((t) => t.id).includes(I.value)) || k.id === I.value;
199
- }
200
- )
201
- }, null, 8, ["modelValue", "onUpdate:modelValue", "items"])),
202
- h(s, {
203
- modelValue: k.expiredAt,
204
- "onUpdate:modelValue": (I) => k.expiredAt = I,
205
- class: "flex-1",
206
- label: "",
207
- "max-fraction-digits": 0
208
- }, null, 8, ["modelValue", "onUpdate:modelValue"]),
209
- h(U, {
210
- class: "w-24 h-24",
211
- icon: "close",
212
- variant: "tertiary",
213
- onClick: (I) => {
214
- var n;
215
- return (n = e(a).titles) == null ? void 0 : n.splice(P, 1);
216
- }
217
- }, null, 8, ["onClick"])
218
- ]),
219
- (f(!0), A(z, null, le(ee(`titles.${P}`), (I, n) => (f(), G(D, {
220
- key: n,
221
- class: "items-center",
222
- state: "error",
223
- text: I.toString()
224
- }, null, 8, ["text"]))), 128))
225
- ]))), 128)),
226
- e(x).length && (((re = e(a).titles) == null ? void 0 : re.length) ?? 0) < e(x).length ? (f(), G(U, {
227
- key: 2,
228
- icon: "add",
229
- label: "Give title",
230
- variant: "plain",
231
- onClick: c[3] || (c[3] = (k) => {
232
- var P;
233
- return e(a).titles = [
234
- ...e(a).titles ?? [],
235
- {
236
- id: ((P = e(x).find(
237
- (I) => {
238
- var n;
239
- return !((n = e(a).titles) != null && n.map((t) => t.id).includes(I.value));
240
- }
241
- )) == null ? void 0 : P.value) || e(x)[0].value,
242
- expiredAt: 0
243
- }
244
- ];
245
- })
246
- })) : he("", !0)
247
- ]),
248
- o("div", Bt, [
249
- ze(h(D, {
250
- state: "warning",
251
- text: "Updating member will cause tier to change"
252
- }, null, 512), [
253
- [je, e(S)]
254
- ]),
255
- h(B),
256
- h(U, {
257
- variant: "secondary",
258
- label: "Cancel",
259
- size: "md",
260
- onClick: c[4] || (c[4] = (k) => e(N).close())
261
- }),
262
- h(U, {
263
- disabled: !!e(O),
264
- variant: "primary",
265
- label: "Submit",
266
- size: "md",
267
- onClick: H
268
- }, null, 8, ["disabled"])
269
- ])
270
- ], 64);
271
- };
272
- }
273
- }), Yt = { class: "fm-typo-en-title-sm-800" }, Ot = { class: "space-y-16" }, Ut = { class: "flex flex-nowrap gap-8 items-center justify-end pt-24 w-full" }, Rt = /* @__PURE__ */ be({
274
- __name: "CreditCoinDialog",
275
- props: {
276
- type: { type: String, required: !0 },
277
- action: { type: String, required: !0 },
278
- onSubmit: {
279
- type: Function,
280
- required: !0
281
- }
282
- },
283
- setup(g) {
284
- const N = Ie(), b = g, p = Z({
285
- amount: 1,
286
- day: 1,
287
- remark: void 0
288
- }), r = Z(!0), a = q(() => Ae.formattedType(b.type.toUpperCase()));
289
- function x(S) {
290
- r.value = S, !S && b.type === "coin" && (p.value.day = void 0);
291
- }
292
- async function y() {
293
- if (b.action === "send") {
294
- const S = p.value.day ? `, expire in ${p.value.day} days` : "";
295
- Pe.confirm(
296
- `Are you sure to send ${p.value.amount} ${a.value.toLowerCase()}${S}? This action cannot be reversed.`
297
- ).then(async (u) => {
298
- u && await b.onSubmit(p.value);
299
- });
300
- } else
301
- Pe.confirm(
302
- `Are you sure to deduct ${p.value.amount} ${a.value.toLowerCase()}? This action cannot be reversed.`
303
- ).then(async (S) => {
304
- S && await b.onSubmit(p.value);
305
- });
306
- }
307
- const T = q(() => {
308
- const u = (b.action === "send" ? b.type === "coin" ? xt : ht : b.type === "coin" ? _t : St).safeParse(p.value);
309
- return u.success == !1 ? u.error.flatten().fieldErrors : void 0;
310
- });
311
- return (S, u) => {
312
- const O = V("FmStepperField"), K = V("FmSwitch"), ee = V("FmTextarea"), H = V("FmButton"), fe = V("FmCard");
313
- return f(), G(fe, { class: "flex flex-col gap-16 p-16" }, {
314
- default: xe(() => {
315
- var ae, se, W, m, c, M;
316
- return [
317
- o("div", Yt, E(b.action == "send" ? "Send" : "Deduct") + " " + E(e(Ue)[b.type.toUpperCase()].name), 1),
318
- Fe(" " + E(e(T)) + " ", 1),
319
- o("div", Ot, [
320
- h(O, {
321
- modelValue: e(p).amount,
322
- "onUpdate:modelValue": u[0] || (u[0] = (s) => e(p).amount = s),
323
- label: `${e(Ue)[b.type.toUpperCase()].name} amount`,
324
- "is-currency": !0,
325
- "max-fraction-digits": 2,
326
- "helper-state": (ae = e(T)) != null && ae.amount ? "error" : void 0,
327
- "helper-text": (W = (se = e(T)) == null ? void 0 : se.amount) == null ? void 0 : W[0]
328
- }, null, 8, ["modelValue", "label", "helper-state", "helper-text"]),
329
- g.action === "send" && b.type === "coin" ? (f(), G(K, {
330
- key: 0,
331
- "model-value": e(r),
332
- label: `${e(a)} expires`,
333
- "label-placement": "right",
334
- "onUpdate:modelValue": u[1] || (u[1] = (s) => x(s))
335
- }, null, 8, ["model-value", "label"])) : he("", !0),
336
- g.action === "send" && e(r) ? (f(), G(O, {
337
- key: 1,
338
- modelValue: e(p).day,
339
- "onUpdate:modelValue": u[2] || (u[2] = (s) => e(p).day = s),
340
- label: `${e(a)} expires in`,
341
- "max-fraction-digits": 0,
342
- "append-text": "day(s)",
343
- max: 9999,
344
- min: 0,
345
- "helper-state": (m = e(T)) != null && m.day ? "error" : void 0,
346
- "helper-text": (M = (c = e(T)) == null ? void 0 : c.day) == null ? void 0 : M[0]
347
- }, null, 8, ["modelValue", "label", "helper-state", "helper-text"])) : he("", !0),
348
- h(ee, {
349
- modelValue: e(p).remark,
350
- "onUpdate:modelValue": u[3] || (u[3] = (s) => e(p).remark = s),
351
- label: "Remark"
352
- }, null, 8, ["modelValue"])
353
- ]),
354
- o("div", Ut, [
355
- h(H, {
356
- variant: "secondary",
357
- label: "Cancel",
358
- size: "md",
359
- onClick: u[4] || (u[4] = (s) => e(N).close())
360
- }),
361
- h(H, {
362
- disabled: !!e(T),
363
- variant: "primary",
364
- label: "Submit",
365
- size: "md",
366
- onClick: u[5] || (u[5] = async () => y())
367
- }, null, 8, ["disabled"])
368
- ])
369
- ];
370
- }),
371
- _: 1
372
- });
373
- };
374
- }
375
- }), et = Ct("segment", () => {
376
- const g = Z([]);
377
- async function N() {
378
- const b = await ft.readAll({
379
- limit: 1e3,
380
- skip: 0,
381
- sortBy: "_id",
382
- descending: !0
383
- });
384
- g.value = b.resources;
385
- }
386
- return {
387
- segments: g,
388
- read: N
389
- };
390
- }), Lt = { class: "border border-fm-color-neutral-gray-100 rounded-lg p-16" }, zt = { class: "hidden xs:flex items-center justify-end" }, jt = { class: "flex items-center justify-between mb-4" }, qt = { class: "flex items-center justify-between gap-x-8" }, Gt = { class: "fm-typo-en-body-lg-600" }, Kt = { class: "px-4 py-0.5 rounded-md bg-fm-color-neutral-gray-100 fm-typo-en-body-md-600" }, Te = /* @__PURE__ */ be({
391
- __name: "MemberCollectionTable",
392
- props: {
393
- member: {
394
- type: Object,
395
- required: !0
396
- },
397
- title: {
398
- type: String,
399
- default: ""
400
- },
401
- columns: {
402
- type: Array,
403
- default: [],
404
- required: !0
405
- },
406
- filters: {
407
- type: Object,
408
- default: {}
409
- }
410
- },
411
- setup(g) {
412
- const N = g, b = Z({
413
- search: ""
414
- }), { tableMeta: p, rowData: r, onSort: a, debouncedFetchData: x, onSearch: y } = Ke(async (T) => {
415
- const S = {
416
- ...b.value,
417
- ...N.filters
418
- };
419
- return await Xe.readCollectionsByMemberId(
420
- N.member._id.toString(),
421
- T,
422
- S
423
- );
424
- });
425
- return qe(
426
- b,
427
- () => {
428
- x();
429
- },
430
- { deep: !0 }
431
- ), ct(async () => {
432
- await x();
433
- }), (T, S) => {
434
- const u = V("FmSearch");
435
- return f(), A("div", Lt, [
436
- o("div", zt, [
437
- h(u, {
438
- class: "hidden xs:flex",
439
- modelValue: e(b).search,
440
- "onUpdate:modelValue": [
441
- S[0] || (S[0] = (O) => e(b).search = O),
442
- e(y)
443
- ],
444
- placeholder: "Search",
445
- collapsible: ""
446
- }, null, 8, ["modelValue", "onUpdate:modelValue"])
447
- ]),
448
- o("div", jt, [
449
- o("div", qt, [
450
- o("div", Gt, E(N.title), 1),
451
- o("div", Kt, E(e(p).totalRows), 1)
452
- ]),
453
- h(u, {
454
- class: "xs:hidden",
455
- modelValue: e(b).search,
456
- "onUpdate:modelValue": [
457
- S[1] || (S[1] = (O) => e(b).search = O),
458
- e(y)
459
- ],
460
- placeholder: "Search"
461
- }, null, 8, ["modelValue", "onUpdate:modelValue"])
462
- ]),
463
- h(He, {
464
- loading: e(p).isLoading,
465
- "row-data": e(r),
466
- "row-count": e(p).totalRows,
467
- "column-defs": g.columns,
468
- "page-count": e(p).pageCount,
469
- "page-index": e(p).pageIndex,
470
- "page-size": e(p).pageSize,
471
- "shrink-at": !1,
472
- onSortChange: e(a),
473
- onPageChange: S[2] || (S[2] = (O) => e(x)({
474
- pageSize: O.pageSize,
475
- pageIndex: O.pageIndex
476
- }))
477
- }, null, 8, ["loading", "row-data", "row-count", "column-defs", "page-count", "page-index", "page-size", "onSortChange"])
478
- ]);
479
- };
480
- }
481
- }), Ht = /* @__PURE__ */ be({
482
- __name: "MemberVouchers",
483
- props: {
484
- member: {
485
- type: Object,
486
- required: !0
487
- }
488
- },
489
- setup(g) {
490
- const N = g, b = [
491
- {
492
- header: "Voucher title",
493
- meta: {
494
- maxWidth: "300px"
495
- },
496
- cell(r) {
497
- var a;
498
- return j(
499
- "div",
500
- { class: "text-ellipsis truncate" },
501
- ((a = r.row.original.pf_collectible) == null ? void 0 : a.name) || "-"
502
- );
503
- },
504
- enableSorting: !1
505
- },
506
- {
507
- header: "Claimed at",
508
- accessorKey: "_id",
509
- accessorFn: (r) => w(Me(r._id.toString())).format("D MMM YYYY"),
510
- enableSorting: !1
511
- },
512
- {
513
- header: "Expired at",
514
- cell(r) {
515
- var x, y, T, S;
516
- const a = (y = (x = r.row.original.expiryBalance) == null ? void 0 : x[0]) != null && y.expiredAt ? w((S = (T = r.row.original.expiryBalance) == null ? void 0 : T[0]) == null ? void 0 : S.expiredAt).format(
517
- "D MMM YYYY"
518
- ) : "-";
519
- return j("div", {}, a);
520
- },
521
- enableSorting: !0
522
- },
523
- {
524
- header: "Transfer open",
525
- accessorFn: (r) => {
526
- var a, x, y;
527
- return Ft((y = (x = (a = r.pf_collectible) == null ? void 0 : a.options) == null ? void 0 : x.enableTransfer) == null ? void 0 : y.toString());
528
- },
529
- enableSorting: !1
530
- }
531
- ], p = (r) => ({
532
- type: ke.enum.VOUCHER,
533
- isActive: r
534
- });
535
- return (r, a) => (f(), A(z, null, [
536
- a[0] || (a[0] = o("div", { class: "fm-typo-en-title-sm-600 mb-16" }, "Voucher Collections", -1)),
537
- h(Te, {
538
- member: N.member,
539
- columns: b,
540
- title: "Active voucher",
541
- filters: p(!0)
542
- }, null, 8, ["member", "filters"]),
543
- h(Te, {
544
- member: N.member,
545
- columns: b,
546
- title: "Past voucher",
547
- filters: p(!1)
548
- }, null, 8, ["member", "filters"])
549
- ], 64));
550
- }
551
- }), Wt = /* @__PURE__ */ be({
552
- __name: "MemberMissions",
553
- props: {
554
- member: {
555
- type: Object,
556
- required: !0
557
- }
558
- },
559
- setup(g) {
560
- const N = g, b = [
561
- {
562
- header: "Mission title",
563
- meta: {
564
- maxWidth: "300px"
565
- },
566
- cell(r) {
567
- var a;
568
- return j(
569
- "div",
570
- { class: "text-ellipsis truncate" },
571
- ((a = r.row.original.pf_campaign) == null ? void 0 : a.name) || "-"
572
- );
573
- },
574
- enableSorting: !1
575
- },
576
- {
577
- header: "Type",
578
- accessorFn: (r) => {
579
- var a, x, y;
580
- return Ye.title(((y = (x = (a = r == null ? void 0 : r.pf_collectible) == null ? void 0 : a.extras) == null ? void 0 : x.mission) == null ? void 0 : y.type) || "-");
581
- },
582
- enableSorting: !1
583
- },
584
- {
585
- header: "Status",
586
- cell(r) {
587
- if (r.row.original.pf_campaign) {
588
- const a = {
589
- active: "text-fm-color-typo-warning bg-fm-color-system-warning-100",
590
- upcoming: "text-fm-color-typo-info bg-fm-color-system-info-100",
591
- completed: "text-fm-color-typo-success bg-fm-color-system-success-100",
592
- expired: "text-fm-color-typo-error bg-fm-color-system-error-100"
593
- }, x = Tt(
594
- r.row.original.pf_campaign
595
- ), T = r.row.original.balance === r.row.original.pf_collectible.extras.mission.end && x === "active" ? "completed" : x;
596
- return j(ve.FmChip, {
597
- class: a[T],
598
- label: Ye.title(T),
599
- compact: !0
600
- });
601
- }
602
- return j(ve.FmChip, {
603
- class: "",
604
- label: "-",
605
- compact: !0
606
- });
607
- },
608
- enableSorting: !1
609
- },
610
- {
611
- header: "Summary",
612
- accessorFn: (r) => r != null && r.pf_campaign ? Mt(r.pf_campaign) : "-",
613
- enableSorting: !1
614
- },
615
- {
616
- header: "Current Step",
617
- accessorKey: "balance",
618
- enableSorting: !1
619
- },
620
- {
621
- header: "Total Step",
622
- accessorFn: (r) => {
623
- var a, x, y;
624
- return ((y = (x = (a = r == null ? void 0 : r.pf_collectible) == null ? void 0 : a.extras) == null ? void 0 : x.mission) == null ? void 0 : y.end) ?? 0;
625
- },
626
- enableSorting: !1
627
- }
628
- ], p = {
629
- type: ke.enum.STAMP
630
- };
631
- return (r, a) => (f(), A(z, null, [
632
- a[0] || (a[0] = o("div", { class: "fm-typo-en-title-sm-600 mb-16" }, "Mission", -1)),
633
- h(Te, {
634
- member: N.member,
635
- columns: b,
636
- title: "Mission",
637
- filters: p
638
- }, null, 8, ["member"])
639
- ], 64));
640
- }
641
- }), Jt = /* @__PURE__ */ be({
642
- __name: "MemberGames",
643
- props: {
644
- member: {
645
- type: Object,
646
- required: !0
647
- }
648
- },
649
- setup(g) {
650
- const N = g, b = [
651
- {
652
- header: "Game title",
653
- meta: {
654
- maxWidth: "300px"
655
- },
656
- cell(r) {
657
- var a;
658
- return j(
659
- "div",
660
- { class: "text-ellipsis truncate" },
661
- ((a = r.row.original.pf_campaign) == null ? void 0 : a.name) || "-"
662
- );
663
- },
664
- enableSorting: !1
665
- },
666
- {
667
- header: "Claimed at",
668
- accessorKey: "_id",
669
- accessorFn: (r) => w(Me(r._id.toString())).format("D MMM YYYY"),
670
- enableSorting: !1
671
- },
672
- {
673
- header: "Expired at",
674
- cell(r) {
675
- var x, y, T, S;
676
- const a = (y = (x = r.row.original.expiryBalance) == null ? void 0 : x[0]) != null && y.expiredAt ? w((S = (T = r.row.original.expiryBalance) == null ? void 0 : T[0]) == null ? void 0 : S.expiredAt).format(
677
- "D MMM YYYY"
678
- ) : "-";
679
- return j("div", {}, a);
680
- },
681
- enableSorting: !1
682
- },
683
- {
684
- header: "Token received",
685
- accessorKey: "balance",
686
- enableSorting: !1
687
- }
688
- ], p = (r) => ({
689
- type: ke.enum.GAME,
690
- isActive: r
691
- });
692
- return (r, a) => (f(), A(z, null, [
693
- a[0] || (a[0] = o("div", { class: "fm-typo-en-title-sm-600 mb-16" }, "Game program", -1)),
694
- h(Te, {
695
- member: N.member,
696
- columns: b,
697
- title: "Active game token",
698
- filters: p(!0)
699
- }, null, 8, ["member", "filters"])
700
- ], 64));
701
- }
702
- }), Xt = { class: "flex flex-col flex-nowrap gap-y-24 max-h-full" }, Qt = { class: "grid md:grid-cols-2 lg:grid-cols-2 gap-x-36 gap-y-24" }, Zt = { class: "space-y-16" }, eo = { class: "flex gap-16 items-center" }, to = { class: "flex-auto" }, oo = { class: "fm-typo-en-body-md-600" }, no = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ao = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, so = { class: "fm-typo-en-body-md-800" }, ro = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, io = { class: "fm-typo-en-body-md-800" }, lo = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, co = { class: "fm-typo-en-body-md-600" }, mo = { class: "gap-16 grid grid-cols-1" }, uo = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, po = { class: "fm-typo-en-body-md-600" }, bo = { class: "p-16 grid md:grid-cols-3 lg:grid-cols-3 border-2 border-fm-color-neutral-gray-100 rounded-lg gap-16 divide-y md:divide-y-0 lg:divide-y-0 md:divide-x lg:divide-x divide-fm-color-neutral-gray-100" }, fo = { class: "flex justify-between mb-16" }, yo = { class: "fm-typo-en-title-sm-600" }, go = ["onClick"], vo = { class: "flex flex-col gap-y-16" }, xo = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ho = { class: "fm-typo-en-body-md-600" }, _o = { class: "space-y-8" }, So = {
703
- key: 0,
704
- class: "space-x-8"
705
- }, Co = {
706
- key: 1,
707
- class: "text-fm-color-typo-secondary"
708
- }, wo = { class: "space-y-8" }, Fo = ["src"], To = { class: "fm-typo-en-body-md-600" }, Mo = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, ko = {
709
- key: 1,
710
- class: "text-fm-color-typo-secondary"
711
- }, Ao = {
712
- key: 1,
713
- class: "space-y-24"
714
- }, Io = { class: "space-y-8" }, Vo = { class: "fm-typo-en-title-md-800" }, Eo = { class: "space-y-4" }, $o = { class: "fm-typo-en-body-md-600" }, No = { class: "flex gap-24 items-center xs:flex-col xs:items-start" }, Do = { class: "space-y-8" }, Bo = { class: "fm-typo-en-title-md-800" }, Po = { class: "space-y-4" }, Yo = { class: "fm-typo-en-body-md-600" }, Oo = { class: "flex gap-24 items-center xs:flex-col xs:items-start" }, Uo = /* @__PURE__ */ be({
715
- __name: "MemberDetailSheet",
716
- props: {
717
- member: {
718
- type: Object,
719
- required: !0
720
- }
721
- },
722
- emits: ["update:member"],
723
- setup(g, { expose: N, emit: b }) {
724
- const p = Qe(), r = Je(), a = Ve(), x = et(), y = wt(), T = Ie(), { minor: S } = We, u = g, O = b, K = q(() => r.locations.map((n) => ({
725
- label: n.name,
726
- value: n._id
727
- }))), ee = q(() => (u.member.segment || []).map((n) => {
728
- var t;
729
- return ((t = x.segments.find((d) => d._id === n)) == null ? void 0 : t.name) || "";
730
- }).filter(Boolean)), H = [
731
- {
732
- label: "Loyalty",
733
- stats: [
734
- {
735
- label: "Experiences",
736
- getter: (n) => {
737
- var t, d, _;
738
- return Q(((_ = (d = (t = n.collection) == null ? void 0 : t.POINT) == null ? void 0 : d[0]) == null ? void 0 : _.balance) ?? 0, 2);
739
- }
740
- },
741
- {
742
- label: "Credits",
743
- getter: (n) => {
744
- var t, d, _;
745
- return Q(((_ = (d = (t = n.collection) == null ? void 0 : t.CREDIT) == null ? void 0 : d[0]) == null ? void 0 : _.balance) ?? 0, 2);
746
- }
747
- }
748
- ]
749
- },
750
- {
751
- label: "Voucher",
752
- stats: [
753
- {
754
- label: "Active vouchers",
755
- getter: (n) => Q(F.value.active, 0)
756
- },
757
- {
758
- label: "Past vouchers",
759
- getter: (n) => Q(F.value.past, 0)
760
- }
761
- ]
762
- },
763
- {
764
- label: "Mission",
765
- stats: [
766
- {
767
- label: "Stamp missions",
768
- getter: (n) => Q(C.value.stamp.length, 0)
769
- },
770
- {
771
- label: "Progress missions",
772
- getter: (n) => Q(C.value.progressive.length, 0)
773
- }
774
- ]
775
- },
776
- {
777
- label: "Game",
778
- stats: [
779
- {
780
- label: "Tokens",
781
- getter: (n) => {
782
- var t, d;
783
- return Q(
784
- ((d = (t = n.collection) == null ? void 0 : t.GAME) == null ? void 0 : d.reduce(
785
- (_, $) => _ + $.balance,
786
- 0
787
- )) || 0,
788
- 0
789
- );
790
- }
791
- }
792
- ]
793
- },
794
- {
795
- label: "Store bundle",
796
- stats: [
797
- {
798
- label: "Bundle purchased",
799
- getter: (n) => Q(D.value, 0)
800
- }
801
- ]
802
- }
803
- ], ae = (() => {
804
- const t = [];
805
- for (let d = 0; d < H.length; d += 3)
806
- t.push(H.slice(d, d + 3));
807
- return t;
808
- })();
809
- async function se(n, t) {
810
- switch (n.stopPropagation(), t) {
811
- case "Store bundle":
812
- await p.push({
813
- name: Ze["$connect-LOYALTY_MEMBER_TRANSACTIONS"],
814
- params: { id: u.member._id.toString() },
815
- query: { tab: "store" }
816
- });
817
- break;
818
- default:
819
- P.value = k.find((d) => d.label === t) || k[0];
820
- break;
821
- }
822
- }
823
- async function W(n, t) {
824
- T.open({
825
- title: "",
826
- dialogComponent: Rt,
827
- dialogComponentProps: {
828
- type: n,
829
- action: t,
830
- onSubmit: async (d) => {
831
- await S(
832
- async () => {
833
- const _ = {
834
- "credit-send": ce.sendCredit,
835
- "credit-deduct": ce.deductCredit,
836
- "coin-send": ce.sendCoin,
837
- "coin-deduct": ce.deductCoin
838
- }, $ = `${n}-${t}`, R = _[$];
839
- R && await R(u.member._id, d), O("update:member"), T.close();
840
- },
841
- {
842
- message: `Adjusting ${Ae.formattedType(
843
- n.toUpperCase()
844
- ).toLowerCase()}`,
845
- successMessage: `${d.amount} ${Ae.formattedType(
846
- n.toUpperCase()
847
- ).toLowerCase()} ${t} ${t == "send" ? "to" : "from"} ${u.member.phoneNumber}`
848
- }
849
- );
850
- }
851
- }
852
- });
853
- }
854
- async function m() {
855
- T.open({
856
- title: "Update member statistics",
857
- contentComponent: Pt,
858
- contentComponentProps: {
859
- member: u.member,
860
- onSubmit: async (n) => {
861
- await S(
862
- async () => {
863
- await ce.updateMember(u.member._id, n), O("update:member"), T.close();
864
- },
865
- {
866
- message: "Updating member stats",
867
- successMessage: `Updated member ${u.member.phoneNumber} stats successfully`
868
- }
869
- );
870
- }
871
- }
872
- });
873
- }
874
- const c = [
875
- {
876
- label: "Mobile No.",
877
- key: "phoneNumber"
878
- },
879
- {
880
- label: "Tier",
881
- getter: (n) => {
882
- var ie, de, ye, v, Y;
883
- const t = (((de = Re.first((ie = u.member.collection) == null ? void 0 : ie.TIER)) == null ? void 0 : de.balance) || 0) - 1, d = s.value.name, _ = ((v = (ye = n.collection) == null ? void 0 : ye.POINT) == null ? void 0 : v[0].balance) ?? 0, $ = a.sortedTiers[t + 1], R = ((Y = $ == null ? void 0 : $.option) == null ? void 0 : Y.to) ?? 1 / 0;
884
- return `${d} (${_}/${R})`;
885
- }
886
- },
887
- {
888
- label: "Email",
889
- key: "email"
890
- },
891
- {
892
- label: "Birthday",
893
- getter: (n) => n.birthday ? w(n.birthday).format("D MMM YYYY") : "-"
894
- }
895
- ], M = [
896
- {
897
- label: "Customer since",
898
- getter: (n) => w(Me(n._id.toString())).format("D MMM YYYY")
899
- },
900
- {
901
- label: "Joined at location",
902
- getter: (n) => {
903
- var t;
904
- return n != null && n.location && ((t = K.value.find((d) => d.value == n.location)) == null ? void 0 : t.label) || "-";
905
- }
906
- },
907
- {
908
- label: "Total visit(s)",
909
- getter: (n) => Oe.singularOrPlural(n.stats.visitCount, "bill")
910
- },
911
- {
912
- label: "Last visit",
913
- getter: (n) => w(n.stats.lastVisit).fromNow()
914
- },
915
- {
916
- label: "Frequency",
917
- getter: (n) => `Every ${Oe.singularOrPlural(
918
- Number(Math.ceil(n.stats.avgVisitFrequency).toFixed(0)),
919
- "day"
920
- )}`
921
- },
922
- {
923
- label: "Average spend",
924
- getter: (n) => yt.Dinero.fromNumber({ number: Number(n.stats.avgBillSize || 0) }).toFormat(
925
- !0
926
- )
927
- }
928
- // {
929
- // label: 'Feedback',
930
- // key: 'feedbackCount',
931
- // },
932
- // {
933
- // label: 'Tier Earned this season',
934
- // key: 'lastSeasonTierEarned',
935
- // },
936
- // {
937
- // label: 'Point Earned this season',
938
- // key: 'lastSeasonPointEarned',
939
- // },
940
- ], s = q(() => {
941
- var d, _;
942
- const n = (((_ = Re.first((d = u.member.collection) == null ? void 0 : d.TIER)) == null ? void 0 : _.balance) || 0) - 1, t = a.sortedTiers[n];
943
- return { name: (t == null ? void 0 : t.name) || "-", tier: n, config: t };
944
- }), l = q(() => {
945
- var n;
946
- return (((n = u.member.collection) == null ? void 0 : n.TITLE) || []).map((t) => {
947
- var _, $, R;
948
- const d = (_ = a.sortedTitles) == null ? void 0 : _.find(
949
- (ie) => ie._id == t.collectible
950
- );
951
- return {
952
- name: d == null ? void 0 : d.name,
953
- expiredAt: (R = ($ = t.expiryBalance) == null ? void 0 : $.at(-1)) == null ? void 0 : R.expiredAt,
954
- collectible: d
955
- };
956
- }).filter(
957
- (t) => t.expiredAt ? w(t.expiredAt).isAfter(w()) : !0
958
- );
959
- }), C = q(() => {
960
- var t;
961
- const n = (((t = u.member.collection) == null ? void 0 : t.STAMP) || []).map((d) => {
962
- var _, $;
963
- return ($ = (_ = y.campaigns) == null ? void 0 : _.mission) == null ? void 0 : $.find(
964
- (R) => R.collectible.toString() === d.collectible
965
- );
966
- }).filter((d) => d);
967
- return {
968
- stamp: n.filter(
969
- (d) => {
970
- var _;
971
- return ((_ = d == null ? void 0 : d.mission) == null ? void 0 : _.type) === Le.enum.STAMP;
972
- }
973
- ),
974
- progressive: n.filter(
975
- (d) => {
976
- var _;
977
- return ((_ = d == null ? void 0 : d.mission) == null ? void 0 : _.type) === Le.enum.PROGRESSIVE;
978
- }
979
- )
980
- };
981
- }), F = Z({ active: 0, past: 0 }), U = Z([]), D = q(
982
- () => U.value.reduce((n, t) => n + t.count, 0)
983
- ), B = Z(!0);
984
- function te() {
985
- B.value = !0, P.value = k[0];
986
- }
987
- function re() {
988
- B.value = !1;
989
- }
990
- const k = [
991
- {
992
- label: "Overview",
993
- value: "overview"
994
- },
995
- {
996
- label: "Loyalty",
997
- value: "loyalty"
998
- },
999
- {
1000
- label: "Voucher",
1001
- value: "voucher"
1002
- },
1003
- {
1004
- label: "Mission",
1005
- value: "mission"
1006
- },
1007
- {
1008
- label: "Game",
1009
- value: "game"
1010
- }
1011
- ], P = Z(k[0]), I = async () => {
1012
- F.value = await Xe.readCollectionCountByMemberId(
1013
- u.member._id.toString(),
1014
- ke.enum.VOUCHER
1015
- ), U.value = await kt.readPurchaseCountByMember(
1016
- u.member._id.toString()
1017
- );
1018
- };
1019
- return Ge(async () => {
1020
- await a.readMembership(), await y.read("MISSION"), await I(), r.locations.length || await r.readLocations();
1021
- }), qe(B, async () => {
1022
- await I();
1023
- }), N({
1024
- showSheet: te,
1025
- hideSheet: re
1026
- }), (n, t) => {
1027
- const d = V("FmTabs"), _ = V("FmAvatar"), $ = V("FmButton"), R = V("FmIcon"), ie = V("FmChip"), de = V("FmCard"), ye = V("FmSideSheet");
1028
- return f(), G(ye, {
1029
- modelValue: e(B),
1030
- "onUpdate:modelValue": t[5] || (t[5] = (v) => dt(B) ? B.value = v : null),
1031
- header: "Member Detail",
1032
- "dismiss-away": "",
1033
- "close-button": !0,
1034
- "max-width": 1100
1035
- }, {
1036
- "side-sheet-footer": xe(() => t[19] || (t[19] = [])),
1037
- default: xe(() => [
1038
- o("div", Xt, [
1039
- o("div", null, [
1040
- h(d, {
1041
- "model-value": e(P).value,
1042
- items: k,
1043
- class: "overflow-x-auto",
1044
- "onUpdate:modelValue": t[0] || (t[0] = (v) => P.value = k.find((Y) => Y.value === v))
1045
- }, null, 8, ["model-value"])
1046
- ]),
1047
- e(P).value == "overview" ? (f(), A(z, { key: 0 }, [
1048
- o("div", Qt, [
1049
- o("div", null, [
1050
- t[9] || (t[9] = o("div", { class: "fm-typo-en-title-sm-800 mb-16" }, "Profile Information", -1)),
1051
- o("div", Zt, [
1052
- o("div", eo, [
1053
- h(_, {
1054
- name: g.member.photoUrl ? void 0 : g.member.name,
1055
- src: g.member.photoUrl || void 0
1056
- }, null, 8, ["name", "src"]),
1057
- o("div", to, [
1058
- t[8] || (t[8] = o("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " Member Name ", -1)),
1059
- o("div", oo, E(g.member.name), 1),
1060
- o("div", no, E(g.member._id), 1),
1061
- o("div", ao, [
1062
- t[6] || (t[6] = Fe(" Member Card: ")),
1063
- o("span", so, E(g.member.cardNo ? g.member.cardNo : "-"), 1)
1064
- ]),
1065
- o("div", ro, [
1066
- t[7] || (t[7] = Fe(" Referral Code: ")),
1067
- o("span", io, E(g.member.referralCode ? g.member.referralCode : "-"), 1)
1068
- ])
1069
- ]),
1070
- h($, {
1071
- variant: "tertiary",
1072
- icon: "settings",
1073
- onClick: m
1074
- })
1075
- ]),
1076
- (f(), A(z, null, le(c, (v, Y) => o("div", { key: Y }, [
1077
- o("div", lo, E(v.label), 1),
1078
- o("div", co, E(v.key ? g.member[v.key] : v.getter(g.member)), 1)
1079
- ])), 64))
1080
- ])
1081
- ]),
1082
- o("div", null, [
1083
- t[10] || (t[10] = o("div", { class: "fm-typo-en-title-sm-800 mb-16" }, "Activities", -1)),
1084
- o("div", mo, [
1085
- (f(), A(z, null, le(M, (v) => o("div", {
1086
- key: v.key
1087
- }, [
1088
- o("div", uo, E(v.label), 1),
1089
- o("div", po, E(v.key ? u.member.stats[v.key] || "-" : v.getter(g.member)), 1)
1090
- ])), 64))
1091
- ])
1092
- ])
1093
- ]),
1094
- t[13] || (t[13] = o("div", { class: "border-fm-color-neutral-gray-100 rounded-sm border-t" }, null, -1)),
1095
- (f(!0), A(z, null, le(e(ae), (v) => (f(), A("div", bo, [
1096
- (f(!0), A(z, null, le(v, (Y, oe) => (f(), A("div", { key: oe }, [
1097
- o("div", {
1098
- class: mt(oe !== 0 ? "pt-12 md:pt-0 lg:pt-0 md:pl-12 lg:pl-12" : "")
1099
- }, [
1100
- o("div", fo, [
1101
- o("div", yo, E(Y.label), 1),
1102
- o("button", {
1103
- onClick: (L) => se(L, Y.label)
1104
- }, [
1105
- h(R, {
1106
- name: "chevron_right",
1107
- outline: "",
1108
- size: "md"
1109
- })
1110
- ], 8, go)
1111
- ]),
1112
- o("div", vo, [
1113
- (f(!0), A(z, null, le(Y.stats, (L) => (f(), A("div", {
1114
- key: L.key
1115
- }, [
1116
- o("div", xo, E(L.label), 1),
1117
- o("div", ho, E(L.getter(g.member)), 1)
1118
- ]))), 128))
1119
- ])
1120
- ], 2)
1121
- ]))), 128))
1122
- ]))), 256)),
1123
- o("div", _o, [
1124
- t[11] || (t[11] = o("div", { class: "fm-typo-en-title-sm-800" }, "Segments", -1)),
1125
- e(ee).length ? (f(), A("div", So, [
1126
- (f(!0), A(z, null, le(e(ee), (v) => (f(), G(ie, {
1127
- label: v.toString()
1128
- }, null, 8, ["label"]))), 256))
1129
- ])) : (f(), A("div", Co, "No titles"))
1130
- ]),
1131
- t[14] || (t[14] = o("div", { class: "border-fm-color-neutral-gray-100 rounded-sm border-t" }, null, -1)),
1132
- o("div", wo, [
1133
- t[12] || (t[12] = o("div", { class: "fm-typo-en-title-sm-800" }, "Title badge", -1)),
1134
- e(l).length ? (f(!0), A(z, { key: 0 }, le(e(l).filter((v) => v.collectible), (v) => (f(), A("div", {
1135
- class: "flex items-center gap-x-8 h-48",
1136
- key: v.name
1137
- }, [
1138
- o("img", {
1139
- src: v.collectible.image || e(gt),
1140
- class: "aspect-square h-full object-contain"
1141
- }, null, 8, Fo),
1142
- o("div", null, [
1143
- o("div", To, E(v.name), 1),
1144
- o("div", Mo, " Expired on " + E(e(w)(v.expiredAt).format("MMM D, Y")), 1)
1145
- ])
1146
- ]))), 128)) : (f(), A("div", ko, "No titles"))
1147
- ])
1148
- ], 64)) : e(P).value == "loyalty" ? (f(), A("div", Ao, [
1149
- h(de, {
1150
- class: "p-16 space-y-24",
1151
- variant: "outlined"
1152
- }, {
1153
- default: xe(() => {
1154
- var v, Y, oe, L, me, ue, pe;
1155
- return [
1156
- o("div", Io, [
1157
- t[15] || (t[15] = o("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " Credit ", -1)),
1158
- o("div", Vo, E(((oe = (Y = (v = g.member.collection) == null ? void 0 : v.CREDIT) == null ? void 0 : Y[0]) == null ? void 0 : oe.balance) ?? 0), 1)
1159
- ]),
1160
- o("div", Eo, [
1161
- t[16] || (t[16] = o("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " Credit(s) to be expired in 30 days ", -1)),
1162
- o("div", $o, E(((pe = (ue = (me = (L = g.member.collection) == null ? void 0 : L.CREDIT) == null ? void 0 : me[0]) == null ? void 0 : ue.expiryBalance) == null ? void 0 : pe.reduce(
1163
- (J, X) => X.expiredAt && e(w)(X.expiredAt).isAfter(e(w)()) && e(w)(X.expiredAt).isBefore(e(w)().add(30, "days")) ? J + X.amount : J,
1164
- 0
1165
- )) ?? 0), 1)
1166
- ]),
1167
- o("div", No, [
1168
- h($, {
1169
- label: "Add credit",
1170
- icon: "add",
1171
- variant: "plain",
1172
- onClick: t[1] || (t[1] = (J) => W("credit", "send"))
1173
- }),
1174
- h($, {
1175
- label: "Deduct credit",
1176
- icon: "remove",
1177
- variant: "plain",
1178
- onClick: t[2] || (t[2] = (J) => W("credit", "deduct"))
1179
- })
1180
- ])
1181
- ];
1182
- }),
1183
- _: 1
1184
- }),
1185
- h(de, {
1186
- class: "p-16 space-y-24",
1187
- variant: "outlined"
1188
- }, {
1189
- default: xe(() => {
1190
- var v, Y, oe, L, me, ue, pe;
1191
- return [
1192
- o("div", Do, [
1193
- t[17] || (t[17] = o("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " Point ", -1)),
1194
- o("div", Bo, E(((oe = (Y = (v = g.member.collection) == null ? void 0 : v.COIN) == null ? void 0 : Y[0]) == null ? void 0 : oe.balance) ?? 0), 1)
1195
- ]),
1196
- o("div", Po, [
1197
- t[18] || (t[18] = o("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " Point(s) to be expired in 30 days ", -1)),
1198
- o("div", Yo, E(((pe = (ue = (me = (L = g.member.collection) == null ? void 0 : L.COIN) == null ? void 0 : me[0]) == null ? void 0 : ue.expiryBalance) == null ? void 0 : pe.reduce(
1199
- (J, X) => X.expiredAt && e(w)(X.expiredAt).isAfter(e(w)()) && e(w)(X.expiredAt).isBefore(e(w)().add(30, "days")) ? J + X.amount : J,
1200
- 0
1201
- )) ?? 0), 1)
1202
- ]),
1203
- o("div", Oo, [
1204
- h($, {
1205
- label: "Add point",
1206
- icon: "add",
1207
- variant: "plain",
1208
- onClick: t[3] || (t[3] = (J) => W("coin", "send"))
1209
- }),
1210
- h($, {
1211
- label: "Deduct point",
1212
- icon: "remove",
1213
- variant: "plain",
1214
- onClick: t[4] || (t[4] = (J) => W("coin", "deduct"))
1215
- })
1216
- ])
1217
- ];
1218
- }),
1219
- _: 1
1220
- })
1221
- ])) : e(P).value == "voucher" ? (f(), G(Ht, {
1222
- key: 2,
1223
- member: u.member
1224
- }, null, 8, ["member"])) : e(P).value == "mission" ? (f(), G(Wt, {
1225
- key: 3,
1226
- member: u.member
1227
- }, null, 8, ["member"])) : e(P).value == "game" ? (f(), G(Jt, {
1228
- key: 4,
1229
- member: u.member
1230
- }, null, 8, ["member"])) : he("", !0)
1231
- ])
1232
- ]),
1233
- _: 1
1234
- }, 8, ["modelValue"]);
1235
- };
1236
- }
1237
- }), Ro = { class: "flex items-center justify-end" }, _n = /* @__PURE__ */ be({
1238
- __name: "MemberList",
1239
- setup(g) {
1240
- const N = et(), b = Ve(), p = Je(), { minor: r } = We, a = Qe(), x = [
1241
- {
1242
- header: "Name",
1243
- enableSorting: !0,
1244
- accessorKey: "name",
1245
- cell(s) {
1246
- return It(s.row.original);
1247
- }
1248
- },
1249
- {
1250
- accessorFn: (s) => w(Me(s._id.toString())).format("D MMM YYYY"),
1251
- header: "Customer Since",
1252
- accessorKey: "_id",
1253
- id: "_id"
1254
- },
1255
- {
1256
- accessorKey: "collection_TIER_0_balance",
1257
- header: "Tier",
1258
- enableSorting: !0,
1259
- cell(s) {
1260
- return Vt(
1261
- s.row.original,
1262
- b.sortedTiers
1263
- );
1264
- }
1265
- },
1266
- {
1267
- header: "Title",
1268
- enableSorting: !1,
1269
- cell(s) {
1270
- return Et(
1271
- s.row.original,
1272
- b.sortedTitles
1273
- );
1274
- }
1275
- },
1276
- {
1277
- accessorKey: "collection_CREDIT_0_balance",
1278
- accessorFn: (s) => {
1279
- var l, C, F;
1280
- return Q(((F = (C = (l = s.collection) == null ? void 0 : l.CREDIT) == null ? void 0 : C[0]) == null ? void 0 : F.balance) ?? 0, 2);
1281
- },
1282
- header: "Credit(s)",
1283
- enableSorting: !0
1284
- },
1285
- {
1286
- accessorKey: "collection_POINT_0_balance",
1287
- accessorFn: (s) => {
1288
- var l, C, F;
1289
- return Q(((F = (C = (l = s.collection) == null ? void 0 : l.POINT) == null ? void 0 : C[0]) == null ? void 0 : F.balance) ?? 0, 2);
1290
- },
1291
- header: "Experience(s)",
1292
- enableSorting: !0
1293
- },
1294
- {
1295
- accessorKey: "collection_COIN_0_balance",
1296
- accessorFn: (s) => {
1297
- var l, C, F;
1298
- return Q(((F = (C = (l = s.collection) == null ? void 0 : l.COIN) == null ? void 0 : C[0]) == null ? void 0 : F.balance) ?? 0, 2);
1299
- },
1300
- header: "Point(s)",
1301
- enableSorting: !0
1302
- },
1303
- {
1304
- accessorFn: (s) => {
1305
- var l;
1306
- return ((l = s.stats) == null ? void 0 : l.visitCount) ?? 0;
1307
- },
1308
- header: "Total visit",
1309
- accessorKey: "stats.visitCount",
1310
- id: "stats.visitCount"
1311
- },
1312
- {
1313
- accessorFn: (s) => {
1314
- var l;
1315
- return (l = s.stats) == null ? void 0 : l.lastVisit;
1316
- },
1317
- sortingFn: (s, l) => {
1318
- var C, F;
1319
- return new Date((C = s.original.stats) == null ? void 0 : C.lastVisit).getTime() - new Date((F = l.original.stats) == null ? void 0 : F.lastVisit).getTime();
1320
- },
1321
- id: "stats.lastVisit",
1322
- header: "Last visit",
1323
- cell(s) {
1324
- var l, C;
1325
- return j("div", { class: "flex items-center justify-end gap-4" }, [
1326
- j(
1327
- "span",
1328
- (l = s.row.original.stats) != null && l.lastVisit ? w((C = s.row.original.stats) == null ? void 0 : C.lastVisit).fromNow() : "NA"
1329
- ),
1330
- j(
1331
- ve.FmTooltip,
1332
- {
1333
- content: w(s.row.original.stats.lastVisit).format(
1334
- "D MMM YYYY - hh:mmA"
1335
- )
1336
- },
1337
- [j(ve.FmIcon, { name: "info", outline: !0, size: "sm" })]
1338
- )
1339
- ]);
1340
- }
1341
- },
1342
- {
1343
- id: "actions",
1344
- cell(s) {
1345
- return j(
1346
- ve.FmMenu,
1347
- {
1348
- placement: "bottom-end",
1349
- onClick: (l) => {
1350
- l.stopPropagation();
1351
- }
1352
- },
1353
- {
1354
- "menu-button": () => j(ve.FmButton, { icon: "more_vert", variant: "tertiary" }),
1355
- default: () => [
1356
- j(ve.FmMenuItem, {
1357
- label: "Transaction details",
1358
- onClick: async (l) => {
1359
- l.stopPropagation(), await W(s.row.original._id);
1360
- }
1361
- })
1362
- ]
1363
- }
1364
- );
1365
- }
1366
- }
1367
- ], { tableMeta: y, rowData: T, onSort: S, debouncedFetchData: u, onSearch: O } = Ke(ce.read), K = Z(), ee = Z(!1), H = Z(), fe = q(() => p.locations.map((s) => ({
1368
- label: s.name,
1369
- value: s._id
1370
- })));
1371
- async function ae() {
1372
- H.value = await ce.readById(
1373
- H.value._id.toString()
1374
- ), ee.value = !0;
1375
- }
1376
- async function se() {
1377
- await u(), ee.value = !1;
1378
- }
1379
- async function W(s) {
1380
- await a.push({
1381
- name: Ze["$connect-LOYALTY_MEMBER_TRANSACTIONS"],
1382
- params: { id: s }
1383
- });
1384
- }
1385
- const m = {
1386
- sortBy: "_id",
1387
- descending: !1,
1388
- rowsPerPage: 1e3,
1389
- page: 1,
1390
- rowsNumber: 0
1391
- };
1392
- function c(s) {
1393
- const l = w(s);
1394
- return l.isValid() ? l.format("DD/MM/YYYY") : "";
1395
- }
1396
- async function M() {
1397
- const s = new pt(), l = (await ce.read({
1398
- limit: 1,
1399
- skip: 0,
1400
- sortBy: m.sortBy,
1401
- descending: m.descending
1402
- })).meta.totalResources ?? 0, C = m.rowsPerPage;
1403
- await r(
1404
- async () => {
1405
- var F, U, D, B, te, re, k, P, I, n, t, d, _, $, R, ie, de, ye, v, Y, oe, L, me, ue, pe, J, X, Ee;
1406
- for (let $e = 0; $e < l; $e += C) {
1407
- const tt = {
1408
- ...m,
1409
- limit: C,
1410
- skip: m.page - 1,
1411
- sortBy: m.sortBy,
1412
- descending: m.descending
1413
- }, ot = await ce.read(tt);
1414
- for (const i of ot.resources) {
1415
- const nt = (F = ut.parseOneAddress(
1416
- i == null ? void 0 : i.email
1417
- )) != null && F.domain.includes("feedmepos.com") ? void 0 : i.email, at = (D = ((U = i == null ? void 0 : i.collection) == null ? void 0 : U.TITLE) || []) == null ? void 0 : D.reduce(
1418
- (ne, ge) => {
1419
- var Se, Ce;
1420
- const _e = (Ce = (Se = b.sortedTitles) == null ? void 0 : Se.find(
1421
- (we) => we._id === ge.collectible
1422
- )) == null ? void 0 : Ce.name;
1423
- return !_e || ge.balance <= 0 || ne.push(_e), ne;
1424
- },
1425
- []
1426
- ), st = (b.sortedTitles || []).reduce(
1427
- (ne, ge) => {
1428
- var Se, Ce, we, Be;
1429
- const _e = (Be = (we = (Ce = (((Se = i == null ? void 0 : i.collection) == null ? void 0 : Se.TITLE) || []).find(
1430
- (lt) => lt.collectible === ge._id
1431
- )) == null ? void 0 : Ce.expiryBalance) == null ? void 0 : we[0]) == null ? void 0 : Be.expiredAt;
1432
- return ne[ge.name] = _e ? w(_e).format("DD/MM/YYYY") : "", ne;
1433
- },
1434
- {}
1435
- ), rt = ((re = (te = (B = i.collection) == null ? void 0 : B.CREDIT) == null ? void 0 : te.at(0)) == null ? void 0 : re.balance) || 0, Ne = ((n = (I = (P = (k = i.collection) == null ? void 0 : k.CREDIT) == null ? void 0 : P.at(0)) == null ? void 0 : I.expiryBalance) == null ? void 0 : n.reduce(
1436
- (ne, ge) => ne + ge.amount,
1437
- 0
1438
- )) || 0, De = Q(rt, 2), it = {
1439
- ID: i._id.toString(),
1440
- Name: ((t = i.name) == null ? void 0 : t.trim()) || "",
1441
- Phone: ((d = i == null ? void 0 : i.phoneNumber) == null ? void 0 : d.trim()) || "",
1442
- Email: nt || "",
1443
- Gender: i.gender || "",
1444
- CardNo: i.cardNo || "",
1445
- Birthday: i != null && i.birthday ? c(i == null ? void 0 : i.birthday) : "",
1446
- Credit: (Number(De) - Number(Ne)).toFixed(2),
1447
- FreeCredit: Number(Ne.toFixed(2)),
1448
- TotalCredit: Number(De),
1449
- Exp: i != null && i.collection ? ((R = ($ = (_ = i.collection) == null ? void 0 : _.POINT) == null ? void 0 : $.at(0)) == null ? void 0 : R.balance) ?? 0 : 0,
1450
- Point: i != null && i.collection ? ((ye = (de = (ie = i.collection) == null ? void 0 : ie.COIN) == null ? void 0 : de.at(0)) == null ? void 0 : ye.balance) ?? 0 : 0,
1451
- Level: i != null && i.collection ? ((oe = (Y = (v = i.collection) == null ? void 0 : v.TIER) == null ? void 0 : Y.at(0)) == null ? void 0 : oe.balance) ?? 0 : 0,
1452
- Tier: i != null && i.collection ? ((ue = (me = (L = i.collection) == null ? void 0 : L.TIER) == null ? void 0 : me.at(0)) == null ? void 0 : ue.balance) ?? 0 : 0,
1453
- Titles: at.join(","),
1454
- ...st,
1455
- TotalTransaction: i.stats.visitCount,
1456
- AvgSpent: At(Number(i.stats.avgBillSize || 0)).toFormat(
1457
- !1
1458
- ),
1459
- TotalSpent: i.stats.avgBillSize * i.stats.visitCount,
1460
- LastVisit: c(i.stats.lastVisit),
1461
- Feedback: ((pe = i.stats) == null ? void 0 : pe.feedbackCount) || 0,
1462
- LastSeasonTierEarned: ((J = i.stats) == null ? void 0 : J.lastSeasonTierEarned) || 0,
1463
- LastSeasonPointEarned: ((X = i.stats) == null ? void 0 : X.lastSeasonPointEarned) || 0,
1464
- JoinedAt: c(i.joinAt || void 0),
1465
- JoinedAtLocation: i.location && ((Ee = fe.value.find((ne) => ne.value == i.location)) == null ? void 0 : Ee.label) || "-",
1466
- VisitFrequency: `${Number(
1467
- Math.ceil(i.stats.avgVisitFrequency).toFixed(0)
1468
- )}`
1469
- };
1470
- s.addRecord(it);
1471
- }
1472
- m.page++;
1473
- }
1474
- await bt(
1475
- s.buildExcel(),
1476
- `members-${(/* @__PURE__ */ new Date()).toISOString()}.xlsx`,
1477
- {
1478
- bookType: "xlsx",
1479
- bookSST: !1,
1480
- type: "array"
1481
- }
1482
- ), m.page = 1;
1483
- },
1484
- {
1485
- message: "Exporting member...",
1486
- successMessage: "Member exported successfully"
1487
- }
1488
- );
1489
- }
1490
- return Ge(async () => {
1491
- await b.readMembership(), await p.readLocations(), await N.read(), await p.readLocations(), await u();
1492
- }), (s, l) => {
1493
- const C = V("FmSearch"), F = V("FmButton"), U = V("FmSnackbar");
1494
- return f(), A("div", null, [
1495
- o("div", Ro, [
1496
- h(C, {
1497
- class: "mt-4",
1498
- modelValue: e(y).searchValue,
1499
- "onUpdate:modelValue": [
1500
- l[0] || (l[0] = (D) => e(y).searchValue = D),
1501
- e(O)
1502
- ],
1503
- placeholder: "Search",
1504
- collapsible: ""
1505
- }, null, 8, ["modelValue", "onUpdate:modelValue"]),
1506
- h(F, {
1507
- icon: "ios_share",
1508
- variant: "tertiary",
1509
- onClick: M
1510
- })
1511
- ]),
1512
- ze(h(U, {
1513
- "z-index": 0,
1514
- class: "!max-w-full my-16",
1515
- title: "Info",
1516
- description: "Current list is not up to date, please refresh table for latest data.",
1517
- variant: "info",
1518
- dismissable: "",
1519
- onOnDismiss: l[1] || (l[1] = (D) => ee.value = !1),
1520
- action: "Refresh",
1521
- onOnAction: se
1522
- }, null, 512), [
1523
- [je, e(ee)]
1524
- ]),
1525
- h(He, {
1526
- loading: e(y).isLoading,
1527
- "row-data": e(T),
1528
- "row-count": e(y).totalRows,
1529
- "column-defs": x,
1530
- "shrink-at": !1,
1531
- "page-count": e(y).pageCount,
1532
- "page-index": e(y).pageIndex,
1533
- "page-size": e(y).pageSize,
1534
- onSortChange: e(S),
1535
- onPageChange: l[2] || (l[2] = (D) => e(u)({ pageSize: D.pageSize, pageIndex: D.pageIndex })),
1536
- onRowClick: l[3] || (l[3] = (D) => {
1537
- var B;
1538
- H.value = D.original, (B = e(K)) == null || B.showSheet();
1539
- })
1540
- }, null, 8, ["loading", "row-data", "row-count", "page-count", "page-index", "page-size", "onSortChange"]),
1541
- e(H) ? (f(), G(Uo, {
1542
- key: 0,
1543
- ref_key: "sheetRef",
1544
- ref: K,
1545
- member: e(H),
1546
- "onUpdate:member": ae
1547
- }, null, 8, ["member"])) : he("", !0)
1548
- ]);
1549
- };
1550
- }
1551
- });
1552
- export {
1553
- _n as default
1554
- };