@feedmepos/mf-connect 0.1.56-prod → 0.1.58-prod

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