@feedmepos/mf-connect 0.1.98-beta.46 → 0.1.98-beta.49

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