@feedmepos/mf-connect 0.1.0-beta.39 → 0.1.0-beta.40

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