@feedmepos/mf-connect 0.1.38-beta.71 → 0.1.38-beta.72

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