@feedmepos/mf-connect 0.1.47-prod → 0.1.49-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.
- package/dist/{Analytic-AnuRQDA4.js → Analytic-ibBD_21m.js} +113 -113
- package/dist/{App-DP_jCyej.js → App-CDjwWK8a.js} +632 -622
- package/dist/{Bin-tL4lF6PB.js → Bin-DCaG0YGW.js} +9 -9
- package/dist/Broadcast-CbF3d_N7.js +233 -0
- package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-BgPJCH02.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-BqYusgBO.js} +18 -18
- package/dist/{Card-Bi-ODgCc.js → Card-CDNE85po.js} +239 -239
- package/dist/{Collections-JHWotZ1I.js → Collections-DHn__E9U.js} +31 -31
- package/dist/Credit-DiTnwnFe.js +228 -0
- package/dist/{EditCampaignSheet.vue_vue_type_script_setup_true_lang-hxuYl-OQ.js → EditCampaignSheet.vue_vue_type_script_setup_true_lang-BJEAsRON.js} +756 -753
- package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-ECkaQxuI.js → EffectSheet.vue_vue_type_style_index_0_lang-CU9XpMjd.js} +96 -96
- package/dist/Experience-CjMVeGsX.js +229 -0
- package/dist/FilterChip.vue_vue_type_script_setup_true_lang-DaU-9GzO.js +129 -0
- package/dist/{Game-DUCx2Dl9.js → Game-D3gANFAo.js} +98 -92
- package/dist/ImageInput.vue_vue_type_script_setup_true_lang-D1KQpDGg.js +144 -0
- package/dist/{Index-zynxjOOr.js → Index-DEF_a5Mu.js} +54 -54
- package/dist/{Marketing-BBHDVRkR.js → Marketing-BeED4Y7H.js} +24 -24
- package/dist/{Member-B09bj6C3.js → Member-CA4hnHJY.js} +63 -63
- package/dist/MemberList-CZtriA_Q.js +1606 -0
- package/dist/MemberOverview-wL_ailso.js +58 -0
- package/dist/{MemberTransactions-DERMSs7o.js → MemberTransactions-BVrvf4AM.js} +1 -1
- package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-CAADF6vv.js → MessageInput.vue_vue_type_script_setup_true_lang-BqTDGnOG.js} +2286 -2220
- package/dist/{Mission-DAv0e_ZH.js → Mission-CDSMpqnG.js} +113 -107
- package/dist/{Overview-D0rBTEtP.js → Overview-ArineqY4.js} +337 -337
- package/dist/Point-51MD49EM.js +232 -0
- package/dist/{Promotion-BSPU5hP9.js → Promotion-BVrofYd6.js} +43 -43
- package/dist/{Queue-C5IFJ3iE.js → Queue-Q-aEeZ8w.js} +13 -13
- package/dist/{Record-CoFSrv7j.js → Record-DaVcschI.js} +10 -10
- package/dist/{Reward-COIOBOl-.js → Reward-DTtFuqOZ.js} +173 -173
- package/dist/{RewardGroup.vue_vue_type_script_setup_true_lang-B9Tl7hqv.js → RewardGroup.vue_vue_type_script_setup_true_lang-P_gNd6ZP.js} +11 -11
- package/dist/{RuleGroup.vue_vue_type_script_setup_true_lang-BzsYC3k2.js → RuleGroup.vue_vue_type_script_setup_true_lang-CVy_kDmy.js} +381 -381
- package/dist/{Segment-DF5SrucQ.js → Segment-DIy4RERw.js} +327 -327
- package/dist/{SelectItems.vue_vue_type_script_setup_true_lang-BSSfQu3F.js → SelectItems.vue_vue_type_script_setup_true_lang-D3KIZJLo.js} +14 -14
- package/dist/{SendCollectionSheet.vue_vue_type_script_setup_true_lang-DoL_gTKy.js → SendCollectionSheet.vue_vue_type_script_setup_true_lang-bSi6_uqi.js} +11 -11
- package/dist/{SendVoucherSheet.vue_vue_type_script_setup_true_lang-Cijyol1Q.js → SendVoucherSheet.vue_vue_type_script_setup_true_lang-BsNLkA2v.js} +3 -3
- package/dist/Setting-DGDgmP84.js +1936 -0
- package/dist/{Store-E2_0EIy8.js → Store-Dh2uVHGY.js} +238 -238
- package/dist/StoreRewards-DFF_0g59.js +423 -0
- package/dist/{StoreTransactions.vue_vue_type_script_setup_true_lang-DuatzcJ8.js → StoreTransactions.vue_vue_type_script_setup_true_lang-PrFhYJXc.js} +186 -186
- package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-D_r8I0h7.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-VcU2Asjy.js} +1 -1
- package/dist/{Tier-CEEHsXkC.js → Tier-yKvE4mRW.js} +106 -106
- package/dist/{Title-BMAWlGeW.js → Title-DWWSC02W.js} +95 -95
- package/dist/{Transaction-CLsceq-O.js → Transaction-ru7M0PKE.js} +2 -2
- package/dist/{UserRuleGroup.vue_vue_type_script_setup_true_lang-CFLekn9O.js → UserRuleGroup.vue_vue_type_script_setup_true_lang-BSkv6hMH.js} +6 -6
- package/dist/{Voucher-Cd293WYY.js → Voucher-DmuaThKv.js} +37 -37
- package/dist/VoucherEditor.vue_vue_type_script_setup_true_lang-Db_aeyc1.js +419 -0
- package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-B8HHh8HU.js → ZodTextField.vue_vue_type_script_setup_true_lang-B5co0F__.js} +1 -1
- package/dist/app-DaFoFS2V.js +57962 -0
- package/dist/{app-aVXsWATU.js → app-ja_XST5q.js} +31 -31
- package/dist/app.js +1 -1
- package/dist/{business-DVlHPzaL.js → business-BSP_3iNl.js} +11 -8
- package/dist/{campaign-D9KeUWA7.js → campaign-C1hWNRWr.js} +2 -2
- package/dist/{campaign-l-u9A514.js → campaign-DMZnXtyb.js} +10 -10
- package/dist/{campaign.enum-Cud82tES.js → campaign.enum-Bfsz7Aon.js} +1 -1
- package/dist/campaign.fn-B-xvcbEb.js +758 -0
- package/dist/{collectible.enum-PrlUDScv.js → collectible.enum-BRkrN4Bi.js} +1 -1
- package/dist/{collection.fn-yR-xnV4g.js → collection.fn-D03AXdUn.js} +2 -2
- package/dist/{dto-Cua1OHMY.js → dto-DpRkSGg6.js} +4 -4
- package/dist/{effect-B5-eXNEr.js → effect-BW1-I1J4.js} +1 -1
- package/dist/{email-addresses-BeYh5fr5.js → email-addresses-BLVkwSkP.js} +1 -1
- package/dist/{export-BUF4_DUz.js → export-DOfDownW.js} +4 -4
- package/dist/{helper-CGwOThAl.js → helper-BzfjLXgi.js} +1 -1
- package/dist/{index-DlFVLRKG.js → index-BBi9jDD1.js} +3 -3
- package/dist/{index-Cx8-ipee.js → index-BJl_HxaB.js} +6 -6
- package/dist/{index-1BGPM6Uy.js → index-Ba5-z1MU.js} +1 -1
- package/dist/{index-BmL_b0IR.js → index-Bp8F6U9V.js} +1 -1
- package/dist/{index-C-d_4n-1.js → index-C6fpU8-G.js} +1 -1
- package/dist/{index-knuJv0ti.js → index-COoQSeE7.js} +4 -4
- package/dist/{index-aMDi62-C.js → index-DTnzjEWu.js} +1 -1
- package/dist/{index-BLdVWQId.js → index-DWBeauin.js} +3 -3
- package/dist/{index-Cl2iYM2F.js → index-Da1qz9oA.js} +1 -1
- package/dist/{index-CB8iWT_p.js → index-Dve1-uYX.js} +1 -1
- package/dist/{index-ng2IXlL1.js → index-P6ISAxfQ.js} +1 -1
- package/dist/{index-hX2mE0gQ.js → index-cpWgtd-c.js} +1 -1
- package/dist/{index-D5KIp8ZB.js → index-sFyvCun2.js} +1023 -1023
- package/dist/{index-DNTd-FNx.js → index-zyVYgteg.js} +2 -2
- package/dist/{index.esm2017-D8stWFci.js → index.esm2017-DT0awUwa.js} +40 -40
- package/dist/{loading-c4b7n9Xp.js → loading-CZH88Duq.js} +1 -1
- package/dist/{membership-oBIs4sbL.js → membership-GNRX1fEK.js} +3 -3
- package/dist/{moment-BWErdI6_.js → moment-D7p2TMB-.js} +6 -1
- package/dist/{money-AP24H0gk.js → money-Xe5mDYRC.js} +1 -1
- package/dist/{number-CwsAYC_2.js → number-CAjqc2Pu.js} +1 -1
- package/dist/objectid-BQJRv_jX.js +145 -0
- package/dist/{plugins-Dn7JDHi7.js → plugins-Z2YcDTj8.js} +2 -2
- package/dist/{reward-4wdoZeXw.js → reward-G656rbLJ.js} +1 -1
- package/dist/{rule-_OJza6tn.js → rule-BJ5blBZp.js} +4 -4
- package/dist/{rule-builder-DmlhHAED.js → rule-builder-CursBigG.js} +1 -1
- package/dist/{template-BSQLFHf4.js → template-BnyUm8is.js} +63 -63
- package/dist/timezone-B64-HrWi.js +1150 -0
- package/dist/{trigger-DC9tDnI2.js → trigger-C_ih51ky.js} +4 -4
- package/dist/usePagination-Ds-cuHop.js +223 -0
- package/dist/{user-CCVOptFD.js → user-BZc_OAUj.js} +1 -1
- package/dist/{vue-i18n--_Wu1nMj.js → vue-i18n-2D47GxQX.js} +401 -401
- package/dist/{xlsx-BVMaOi8M.js → xlsx-BEk5qawh.js} +226 -226
- package/package.json +5 -4
- package/dist/Broadcast-T2a5tN8R.js +0 -227
- package/dist/Credit-DQQCXqS0.js +0 -222
- package/dist/Experience-DzTV21vX.js +0 -223
- package/dist/FilterChip.vue_vue_type_script_setup_true_lang-d8rh38tD.js +0 -114
- package/dist/ImageInput.vue_vue_type_script_setup_true_lang-ByhTB9Ie.js +0 -144
- package/dist/MemberList-DLSLGQ02.js +0 -1606
- package/dist/MemberOverview-C2n9oJZh.js +0 -58
- package/dist/Point-BeBYi1BT.js +0 -226
- package/dist/Setting-Dt0sG_hk.js +0 -1936
- package/dist/StoreRewards-DuSsWnTE.js +0 -423
- package/dist/VoucherEditor.vue_vue_type_script_setup_true_lang-Qc5cCqh5.js +0 -419
- package/dist/app-jRT7vsk_.js +0 -33357
- package/dist/campaign.fn-C-UojhHv.js +0 -758
- package/dist/objectid-CVDLTdni.js +0 -145
- package/dist/usePagination-JoYaROkV.js +0 -223
|
@@ -0,0 +1,1606 @@
|
|
|
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-BLVkwSkP.js";
|
|
5
|
+
import { w as dt } from "./xlsx-BEk5qawh.js";
|
|
6
|
+
import "./index-Da1qz9oA.js";
|
|
7
|
+
import "./index-sFyvCun2.js";
|
|
8
|
+
import { u as Ve, C as De, s as mt } from "./membership-GNRX1fEK.js";
|
|
9
|
+
import { c as ut } from "./index-DWBeauin.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-COoQSeE7.js";
|
|
13
|
+
import { p as Ye, c as Pe, b as Oe } from "./plugins-Z2YcDTj8.js";
|
|
14
|
+
import { u as je } from "./loading-CZH88Duq.js";
|
|
15
|
+
import { C as Ae } from "./collection.fn-D03AXdUn.js";
|
|
16
|
+
import { defineStore as xt } from "pinia";
|
|
17
|
+
import { u as qe } from "./business-BSP_3iNl.js";
|
|
18
|
+
import { f as ee } from "./number-CAjqc2Pu.js";
|
|
19
|
+
import "./index-zyVYgteg.js";
|
|
20
|
+
import "./index-BJl_HxaB.js";
|
|
21
|
+
import "./index-P6ISAxfQ.js";
|
|
22
|
+
import "./index-BBi9jDD1.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-DOfDownW.js";
|
|
26
|
+
import { m as Me } from "./index-DTnzjEWu.js";
|
|
27
|
+
import { o as Ce } from "./objectId-dwaoBfJX.js";
|
|
28
|
+
import { F as ke } from "./collectible.enum-BRkrN4Bi.js";
|
|
29
|
+
import { g as Ct, b as wt } from "./campaign-DMZnXtyb.js";
|
|
30
|
+
import { useRouter as He } from "vue-router";
|
|
31
|
+
import { m as le } from "./index-C6fpU8-G.js";
|
|
32
|
+
import { t as Ft } from "./index-Bp8F6U9V.js";
|
|
33
|
+
import { R as We } from "./app-ja_XST5q.js";
|
|
34
|
+
import { t as Mt } from "./money-Xe5mDYRC.js";
|
|
35
|
+
import { g as Tt, a as kt, b as At } from "./user-BZc_OAUj.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 w, 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 (w = i[0]) != null && w.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 C() {
|
|
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, w, T, O;
|
|
101
|
+
const d = ((r = (M = x.member.collection) == null ? void 0 : M.TIER) == null ? void 0 : r[0].balance) ?? -1, l = ((w = (i = x.member.collection) == null ? void 0 : i.POINT) == null ? void 0 : w[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"), w = 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
|
+
C
|
|
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
|
+
_(w, {
|
|
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 C = 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(C)) + " ", 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(C)) != null && ae.amount ? "error" : void 0,
|
|
333
|
+
"helper-text": (re = (W = t(C)) == 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(C)) != null && d.day ? "error" : void 0,
|
|
352
|
+
"helper-text": (M = (l = t(C)) == 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(C),
|
|
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: C } = 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(C)
|
|
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(C)
|
|
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, C, u, v;
|
|
569
|
+
const g = (C = (m = o.row.original.expiryBalance) == null ? void 0 : m[0]) != null && C.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, C;
|
|
580
|
+
return ht((C = (m = (g = o.pf_collectible) == null ? void 0 : g.options) == null ? void 0 : m.enableTransfer) == null ? void 0 : C.toString());
|
|
581
|
+
},
|
|
582
|
+
enableSorting: !1
|
|
583
|
+
}
|
|
584
|
+
], x = (o) => ({
|
|
585
|
+
type: ke.enum.VOUCHER,
|
|
586
|
+
isActive: o
|
|
587
|
+
}), s = (o) => {
|
|
588
|
+
var g, m, C, 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: (C = (m = o.expiryBalance) == null ? void 0 : m[0]) != null && C.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
|
+
if (s.row.original.pf_campaign) {
|
|
656
|
+
const o = {
|
|
657
|
+
active: "text-fm-color-typo-warning bg-fm-color-system-warning-100",
|
|
658
|
+
upcoming: "text-fm-color-typo-info bg-fm-color-system-info-100",
|
|
659
|
+
completed: "text-fm-color-typo-success bg-fm-color-system-success-100",
|
|
660
|
+
expired: "text-fm-color-typo-error bg-fm-color-system-error-100"
|
|
661
|
+
}, g = Ct(
|
|
662
|
+
s.row.original.pf_campaign
|
|
663
|
+
), C = s.row.original.balance === s.row.original.pf_collectible.extras.mission.end && g === "active" ? "completed" : g;
|
|
664
|
+
return K(ve.FmChip, {
|
|
665
|
+
class: o[C],
|
|
666
|
+
label: Pe.title(C),
|
|
667
|
+
compact: !0
|
|
668
|
+
});
|
|
669
|
+
}
|
|
670
|
+
return K(ve.FmChip, {
|
|
671
|
+
class: "",
|
|
672
|
+
label: "-",
|
|
673
|
+
compact: !0
|
|
674
|
+
});
|
|
675
|
+
},
|
|
676
|
+
enableSorting: !1
|
|
677
|
+
},
|
|
678
|
+
{
|
|
679
|
+
header: "Summary",
|
|
680
|
+
accessorFn: (s) => s != null && s.pf_campaign ? wt(s.pf_campaign) : "Deleted Campaign",
|
|
681
|
+
enableSorting: !1
|
|
682
|
+
},
|
|
683
|
+
{
|
|
684
|
+
header: "Current Step",
|
|
685
|
+
accessorKey: "balance",
|
|
686
|
+
enableSorting: !1
|
|
687
|
+
},
|
|
688
|
+
{
|
|
689
|
+
header: "Total Step",
|
|
690
|
+
accessorFn: (s) => {
|
|
691
|
+
var o, g, m;
|
|
692
|
+
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;
|
|
693
|
+
},
|
|
694
|
+
enableSorting: !1
|
|
695
|
+
}
|
|
696
|
+
], x = {
|
|
697
|
+
type: ke.enum.STAMP
|
|
698
|
+
};
|
|
699
|
+
return (s, o) => (p(), A(q, null, [
|
|
700
|
+
o[0] || (o[0] = n("div", { class: "fm-typo-en-title-sm-600 mb-16" }, "Mission", -1)),
|
|
701
|
+
_(Te, {
|
|
702
|
+
member: k.member,
|
|
703
|
+
columns: f,
|
|
704
|
+
title: "Mission",
|
|
705
|
+
filters: x
|
|
706
|
+
}, null, 8, ["member"])
|
|
707
|
+
], 64));
|
|
708
|
+
}
|
|
709
|
+
}), Wt = /* @__PURE__ */ be({
|
|
710
|
+
__name: "MemberGames",
|
|
711
|
+
props: {
|
|
712
|
+
member: {
|
|
713
|
+
type: Object,
|
|
714
|
+
required: !0
|
|
715
|
+
}
|
|
716
|
+
},
|
|
717
|
+
setup(y) {
|
|
718
|
+
const k = y, f = [
|
|
719
|
+
{
|
|
720
|
+
header: "Game title",
|
|
721
|
+
meta: {
|
|
722
|
+
maxWidth: "300px"
|
|
723
|
+
},
|
|
724
|
+
cell(s) {
|
|
725
|
+
var o;
|
|
726
|
+
return K(
|
|
727
|
+
"div",
|
|
728
|
+
{ class: "text-ellipsis truncate" },
|
|
729
|
+
((o = s.row.original.pf_campaign) == null ? void 0 : o.name) || "-"
|
|
730
|
+
);
|
|
731
|
+
},
|
|
732
|
+
enableSorting: !1
|
|
733
|
+
},
|
|
734
|
+
{
|
|
735
|
+
header: "Claimed at",
|
|
736
|
+
accessorKey: "_id",
|
|
737
|
+
accessorFn: (s) => S(Ce(s._id.toString())).format("D MMM YYYY"),
|
|
738
|
+
enableSorting: !1
|
|
739
|
+
},
|
|
740
|
+
{
|
|
741
|
+
header: "Expired at",
|
|
742
|
+
cell(s) {
|
|
743
|
+
var g, m, C, u;
|
|
744
|
+
const o = (m = (g = s.row.original.expiryBalance) == null ? void 0 : g[0]) != null && m.expiredAt ? S((u = (C = s.row.original.expiryBalance) == null ? void 0 : C[0]) == null ? void 0 : u.expiredAt).format(
|
|
745
|
+
"D MMM YYYY"
|
|
746
|
+
) : "-";
|
|
747
|
+
return K("div", {}, o);
|
|
748
|
+
},
|
|
749
|
+
enableSorting: !1
|
|
750
|
+
},
|
|
751
|
+
{
|
|
752
|
+
header: "Token received",
|
|
753
|
+
accessorKey: "balance",
|
|
754
|
+
enableSorting: !1
|
|
755
|
+
}
|
|
756
|
+
], x = (s) => ({
|
|
757
|
+
type: ke.enum.GAME,
|
|
758
|
+
isActive: s
|
|
759
|
+
});
|
|
760
|
+
return (s, o) => (p(), A(q, null, [
|
|
761
|
+
o[0] || (o[0] = n("div", { class: "fm-typo-en-title-sm-600 mb-16" }, "Game program", -1)),
|
|
762
|
+
_(Te, {
|
|
763
|
+
member: k.member,
|
|
764
|
+
columns: f,
|
|
765
|
+
title: "Active game token",
|
|
766
|
+
filters: x(!0)
|
|
767
|
+
}, null, 8, ["member", "filters"])
|
|
768
|
+
], 64));
|
|
769
|
+
}
|
|
770
|
+
}), 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 = {
|
|
771
|
+
key: 0,
|
|
772
|
+
class: "space-x-8"
|
|
773
|
+
}, So = {
|
|
774
|
+
key: 1,
|
|
775
|
+
class: "text-fm-color-typo-secondary"
|
|
776
|
+
}, 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 = {
|
|
777
|
+
key: 1,
|
|
778
|
+
class: "text-fm-color-typo-secondary"
|
|
779
|
+
}, ko = {
|
|
780
|
+
key: 1,
|
|
781
|
+
class: "space-y-24"
|
|
782
|
+
}, 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({
|
|
783
|
+
__name: "MemberDetailSheet",
|
|
784
|
+
props: {
|
|
785
|
+
member: {
|
|
786
|
+
type: Object,
|
|
787
|
+
required: !0
|
|
788
|
+
}
|
|
789
|
+
},
|
|
790
|
+
emits: ["update:member"],
|
|
791
|
+
setup(y, { expose: k, emit: f }) {
|
|
792
|
+
const x = He(), s = Ve(), o = qe(), g = Je(), m = Ee(), { minor: C } = je, u = y, v = f, I = H(() => o.locations.map((a) => ({
|
|
793
|
+
label: a.name,
|
|
794
|
+
value: a._id
|
|
795
|
+
}))), D = H(() => (u.member.segment || []).map((a) => {
|
|
796
|
+
var e;
|
|
797
|
+
return ((e = g.segments.find((b) => b._id === a)) == null ? void 0 : e.name) || "";
|
|
798
|
+
}).filter(Boolean)), L = [
|
|
799
|
+
{
|
|
800
|
+
label: "Loyalty",
|
|
801
|
+
stats: [
|
|
802
|
+
{
|
|
803
|
+
label: "Experiences",
|
|
804
|
+
getter: (a) => {
|
|
805
|
+
var e, b, B;
|
|
806
|
+
return ee(((B = (b = (e = a.collection) == null ? void 0 : e.POINT) == null ? void 0 : b[0]) == null ? void 0 : B.balance) ?? 0, 2);
|
|
807
|
+
}
|
|
808
|
+
},
|
|
809
|
+
{
|
|
810
|
+
label: "Credits",
|
|
811
|
+
getter: (a) => {
|
|
812
|
+
var e, b, B;
|
|
813
|
+
return ee(((B = (b = (e = a.collection) == null ? void 0 : e.CREDIT) == null ? void 0 : b[0]) == null ? void 0 : B.balance) ?? 0, 2);
|
|
814
|
+
}
|
|
815
|
+
}
|
|
816
|
+
]
|
|
817
|
+
},
|
|
818
|
+
{
|
|
819
|
+
label: "Voucher",
|
|
820
|
+
stats: [
|
|
821
|
+
{
|
|
822
|
+
label: "Active vouchers",
|
|
823
|
+
getter: () => ee(w.value.active, 0)
|
|
824
|
+
},
|
|
825
|
+
{
|
|
826
|
+
label: "Past vouchers",
|
|
827
|
+
getter: () => ee(w.value.past, 0)
|
|
828
|
+
}
|
|
829
|
+
]
|
|
830
|
+
},
|
|
831
|
+
{
|
|
832
|
+
label: "Mission",
|
|
833
|
+
stats: [
|
|
834
|
+
{
|
|
835
|
+
label: "Stamp missions",
|
|
836
|
+
getter: () => ee(i.value.stamp, 0)
|
|
837
|
+
},
|
|
838
|
+
{
|
|
839
|
+
label: "Progress missions",
|
|
840
|
+
getter: () => ee(i.value.progressive, 0)
|
|
841
|
+
}
|
|
842
|
+
]
|
|
843
|
+
},
|
|
844
|
+
{
|
|
845
|
+
label: "Game",
|
|
846
|
+
stats: [
|
|
847
|
+
{
|
|
848
|
+
label: "Tokens",
|
|
849
|
+
getter: (a) => {
|
|
850
|
+
var e, b;
|
|
851
|
+
return ee(
|
|
852
|
+
((b = (e = a.collection) == null ? void 0 : e.GAME) == null ? void 0 : b.reduce(
|
|
853
|
+
(B, N) => B + N.balance,
|
|
854
|
+
0
|
|
855
|
+
)) || 0,
|
|
856
|
+
0
|
|
857
|
+
);
|
|
858
|
+
}
|
|
859
|
+
}
|
|
860
|
+
]
|
|
861
|
+
},
|
|
862
|
+
{
|
|
863
|
+
label: "Store bundle",
|
|
864
|
+
stats: [
|
|
865
|
+
{
|
|
866
|
+
label: "Bundle purchased",
|
|
867
|
+
getter: () => ee(O.value, 0)
|
|
868
|
+
}
|
|
869
|
+
]
|
|
870
|
+
}
|
|
871
|
+
], de = (() => {
|
|
872
|
+
const e = [];
|
|
873
|
+
for (let b = 0; b < L.length; b += 3)
|
|
874
|
+
e.push(L.slice(b, b + 3));
|
|
875
|
+
return e;
|
|
876
|
+
})();
|
|
877
|
+
async function ae(a, e) {
|
|
878
|
+
switch (a.stopPropagation(), e) {
|
|
879
|
+
case "Store bundle":
|
|
880
|
+
await x.push({
|
|
881
|
+
name: We["$connect-LOYALTY_MEMBER_TRANSACTIONS"],
|
|
882
|
+
params: { id: u.member._id.toString() },
|
|
883
|
+
query: { tab: "store" }
|
|
884
|
+
});
|
|
885
|
+
break;
|
|
886
|
+
default:
|
|
887
|
+
F.value = z.find((b) => b.label === e) || z[0];
|
|
888
|
+
break;
|
|
889
|
+
}
|
|
890
|
+
}
|
|
891
|
+
async function W(a, e) {
|
|
892
|
+
m.open({
|
|
893
|
+
title: "",
|
|
894
|
+
dialogComponent: Pt,
|
|
895
|
+
dialogComponentProps: {
|
|
896
|
+
type: a,
|
|
897
|
+
action: e,
|
|
898
|
+
onSubmit: async (b) => {
|
|
899
|
+
await C(
|
|
900
|
+
async () => {
|
|
901
|
+
const B = {
|
|
902
|
+
"credit-send": le.sendCredit,
|
|
903
|
+
"credit-deduct": le.deductCredit,
|
|
904
|
+
"coin-send": le.sendCoin,
|
|
905
|
+
"coin-deduct": le.deductCoin
|
|
906
|
+
}, N = `${a}-${e}`, X = B[N];
|
|
907
|
+
X && await X(u.member._id, b), v("update:member"), m.close();
|
|
908
|
+
},
|
|
909
|
+
{
|
|
910
|
+
message: `Adjusting ${Ae.formattedType(
|
|
911
|
+
a.toUpperCase()
|
|
912
|
+
).toLowerCase()}`,
|
|
913
|
+
successMessage: `${b.amount} ${Ae.formattedType(
|
|
914
|
+
a.toUpperCase()
|
|
915
|
+
).toLowerCase()} ${e} ${e == "send" ? "to" : "from"} ${u.member.phoneNumber}`
|
|
916
|
+
}
|
|
917
|
+
);
|
|
918
|
+
}
|
|
919
|
+
}
|
|
920
|
+
});
|
|
921
|
+
}
|
|
922
|
+
async function re() {
|
|
923
|
+
m.open({
|
|
924
|
+
title: "Update member statistics",
|
|
925
|
+
contentComponent: Bt,
|
|
926
|
+
contentComponentProps: {
|
|
927
|
+
member: u.member,
|
|
928
|
+
onSubmit: async (a) => {
|
|
929
|
+
await C(
|
|
930
|
+
async () => {
|
|
931
|
+
await le.updateMember(u.member._id, a), v("update:member"), m.close();
|
|
932
|
+
},
|
|
933
|
+
{
|
|
934
|
+
message: "Updating member stats",
|
|
935
|
+
successMessage: `Updated member ${u.member.phoneNumber} stats successfully`
|
|
936
|
+
}
|
|
937
|
+
);
|
|
938
|
+
}
|
|
939
|
+
}
|
|
940
|
+
});
|
|
941
|
+
}
|
|
942
|
+
const d = [
|
|
943
|
+
{
|
|
944
|
+
label: "Mobile No.",
|
|
945
|
+
key: "phoneNumber"
|
|
946
|
+
},
|
|
947
|
+
{
|
|
948
|
+
label: "Tier",
|
|
949
|
+
getter: (a) => {
|
|
950
|
+
var se, me, ye, h, Y;
|
|
951
|
+
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;
|
|
952
|
+
return `${b} (${B}/${X})`;
|
|
953
|
+
}
|
|
954
|
+
},
|
|
955
|
+
{
|
|
956
|
+
label: "Email",
|
|
957
|
+
key: "email"
|
|
958
|
+
},
|
|
959
|
+
{
|
|
960
|
+
label: "Birthday",
|
|
961
|
+
getter: (a) => a.birthday ? S(a.birthday).format("D MMM YYYY") : "-"
|
|
962
|
+
}
|
|
963
|
+
], l = [
|
|
964
|
+
{
|
|
965
|
+
label: "Customer since",
|
|
966
|
+
getter: (a) => S(Ce(a._id.toString())).format("D MMM YYYY")
|
|
967
|
+
},
|
|
968
|
+
{
|
|
969
|
+
label: "Joined at location",
|
|
970
|
+
getter: (a) => {
|
|
971
|
+
var e;
|
|
972
|
+
return a != null && a.location && ((e = I.value.find((b) => b.value == a.location)) == null ? void 0 : e.label) || "-";
|
|
973
|
+
}
|
|
974
|
+
},
|
|
975
|
+
{
|
|
976
|
+
label: "Total visit(s)",
|
|
977
|
+
getter: (a) => Oe.singularOrPlural(a.stats.visitCount, "bill")
|
|
978
|
+
},
|
|
979
|
+
{
|
|
980
|
+
label: "Last visit",
|
|
981
|
+
getter: (a) => S(a.stats.lastVisit).fromNow()
|
|
982
|
+
},
|
|
983
|
+
{
|
|
984
|
+
label: "Frequency",
|
|
985
|
+
getter: (a) => `Every ${Oe.singularOrPlural(
|
|
986
|
+
Number(Math.ceil(a.stats.avgVisitFrequency).toFixed(0)),
|
|
987
|
+
"day"
|
|
988
|
+
)}`
|
|
989
|
+
},
|
|
990
|
+
{
|
|
991
|
+
label: "Average spend",
|
|
992
|
+
getter: (a) => ut.Dinero.fromNumber({ number: Number(a.stats.avgBillSize || 0) }).toFormat(
|
|
993
|
+
!0
|
|
994
|
+
)
|
|
995
|
+
}
|
|
996
|
+
// {
|
|
997
|
+
// label: 'Feedback',
|
|
998
|
+
// key: 'feedbackCount',
|
|
999
|
+
// },
|
|
1000
|
+
// {
|
|
1001
|
+
// label: 'Tier Earned this season',
|
|
1002
|
+
// key: 'lastSeasonTierEarned',
|
|
1003
|
+
// },
|
|
1004
|
+
// {
|
|
1005
|
+
// label: 'Point Earned this season',
|
|
1006
|
+
// key: 'lastSeasonPointEarned',
|
|
1007
|
+
// },
|
|
1008
|
+
], M = H(() => {
|
|
1009
|
+
var b, B;
|
|
1010
|
+
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];
|
|
1011
|
+
return { name: (e == null ? void 0 : e.name) || "-", tier: a, config: e };
|
|
1012
|
+
}), r = H(() => {
|
|
1013
|
+
var a;
|
|
1014
|
+
return (((a = u.member.collection) == null ? void 0 : a.TITLE) || []).map((e) => {
|
|
1015
|
+
var B, N, X;
|
|
1016
|
+
const b = (B = s.sortedTitles) == null ? void 0 : B.find(
|
|
1017
|
+
(se) => se._id == e.collectible
|
|
1018
|
+
);
|
|
1019
|
+
return {
|
|
1020
|
+
name: b == null ? void 0 : b.name,
|
|
1021
|
+
expiredAt: (X = (N = e.expiryBalance) == null ? void 0 : N.at(-1)) == null ? void 0 : X.expiredAt,
|
|
1022
|
+
collectible: b
|
|
1023
|
+
};
|
|
1024
|
+
}).filter(
|
|
1025
|
+
(e) => e.expiredAt ? S(e.expiredAt).isAfter(S()) : !0
|
|
1026
|
+
);
|
|
1027
|
+
}), i = G({ stamp: 0, progressive: 0 }), w = G({ active: 0, past: 0 }), T = G([]), O = H(
|
|
1028
|
+
() => T.value.reduce((a, e) => a + e.count, 0)
|
|
1029
|
+
), E = G(!0);
|
|
1030
|
+
function U() {
|
|
1031
|
+
E.value = !0, F.value = z[0];
|
|
1032
|
+
}
|
|
1033
|
+
function te() {
|
|
1034
|
+
E.value = !1;
|
|
1035
|
+
}
|
|
1036
|
+
const z = [
|
|
1037
|
+
{
|
|
1038
|
+
label: "Overview",
|
|
1039
|
+
value: "overview"
|
|
1040
|
+
},
|
|
1041
|
+
{
|
|
1042
|
+
label: "Loyalty",
|
|
1043
|
+
value: "loyalty"
|
|
1044
|
+
},
|
|
1045
|
+
{
|
|
1046
|
+
label: "Voucher",
|
|
1047
|
+
value: "voucher"
|
|
1048
|
+
},
|
|
1049
|
+
{
|
|
1050
|
+
label: "Mission",
|
|
1051
|
+
value: "mission"
|
|
1052
|
+
},
|
|
1053
|
+
{
|
|
1054
|
+
label: "Game",
|
|
1055
|
+
value: "game"
|
|
1056
|
+
}
|
|
1057
|
+
], F = G(z[0]), J = async () => {
|
|
1058
|
+
w.value = await Me.readCollectionCountByMemberId(
|
|
1059
|
+
u.member._id.toString(),
|
|
1060
|
+
ke.enum.VOUCHER
|
|
1061
|
+
), T.value = await Ft.readPurchaseCountByMember(
|
|
1062
|
+
u.member._id.toString()
|
|
1063
|
+
), i.value = await Me.readMissionCountByMemberId(
|
|
1064
|
+
u.member._id.toString()
|
|
1065
|
+
);
|
|
1066
|
+
};
|
|
1067
|
+
return ze(async () => {
|
|
1068
|
+
await s.readMembership(), await J(), o.locations.length || await o.readLocations();
|
|
1069
|
+
}), Le(E, async () => {
|
|
1070
|
+
await J();
|
|
1071
|
+
}), k({
|
|
1072
|
+
showSheet: U,
|
|
1073
|
+
hideSheet: te
|
|
1074
|
+
}), (a, e) => {
|
|
1075
|
+
const b = V("FmTabs"), B = V("FmAvatar"), N = V("FmButton"), X = V("FmIcon"), se = V("FmChip"), me = V("FmCard"), ye = V("FmSideSheet");
|
|
1076
|
+
return p(), R(ye, {
|
|
1077
|
+
modelValue: t(E),
|
|
1078
|
+
"onUpdate:modelValue": e[5] || (e[5] = (h) => st(E) ? E.value = h : null),
|
|
1079
|
+
header: "Member Detail",
|
|
1080
|
+
"dismiss-away": "",
|
|
1081
|
+
"close-button": !0,
|
|
1082
|
+
"max-width": 1100
|
|
1083
|
+
}, {
|
|
1084
|
+
"side-sheet-footer": xe(() => [...e[19] || (e[19] = [])]),
|
|
1085
|
+
default: xe(() => [
|
|
1086
|
+
n("div", Jt, [
|
|
1087
|
+
n("div", null, [
|
|
1088
|
+
_(b, {
|
|
1089
|
+
"model-value": t(F).value,
|
|
1090
|
+
items: z,
|
|
1091
|
+
class: "overflow-x-auto",
|
|
1092
|
+
"onUpdate:modelValue": e[0] || (e[0] = (h) => F.value = z.find((Y) => Y.value === h))
|
|
1093
|
+
}, null, 8, ["model-value"])
|
|
1094
|
+
]),
|
|
1095
|
+
t(F).value == "overview" ? (p(), A(q, { key: 0 }, [
|
|
1096
|
+
n("div", Xt, [
|
|
1097
|
+
n("div", null, [
|
|
1098
|
+
e[9] || (e[9] = n("div", { class: "fm-typo-en-title-sm-800 mb-16" }, "Profile Information", -1)),
|
|
1099
|
+
n("div", Qt, [
|
|
1100
|
+
n("div", Zt, [
|
|
1101
|
+
_(B, {
|
|
1102
|
+
name: y.member.photoUrl ? void 0 : y.member.name,
|
|
1103
|
+
src: y.member.photoUrl || void 0
|
|
1104
|
+
}, null, 8, ["name", "src"]),
|
|
1105
|
+
n("div", eo, [
|
|
1106
|
+
e[7] || (e[7] = n("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " Member Name ", -1)),
|
|
1107
|
+
n("div", to, $(y.member.name), 1),
|
|
1108
|
+
n("div", oo, $(y.member._id), 1),
|
|
1109
|
+
n("div", no, [
|
|
1110
|
+
e[6] || (e[6] = Fe(" Member Card: ", -1)),
|
|
1111
|
+
n("span", ao, $(y.member.cardNo ? y.member.cardNo : "-"), 1)
|
|
1112
|
+
])
|
|
1113
|
+
]),
|
|
1114
|
+
_(N, {
|
|
1115
|
+
variant: "tertiary",
|
|
1116
|
+
icon: "settings",
|
|
1117
|
+
onClick: re
|
|
1118
|
+
})
|
|
1119
|
+
]),
|
|
1120
|
+
(p(), A(q, null, ie(d, (h, Y) => n("div", { key: Y }, [
|
|
1121
|
+
n("div", ro, $(h.label), 1),
|
|
1122
|
+
n("div", so, $(h.key ? y.member[h.key] : h.getter(y.member)), 1)
|
|
1123
|
+
])), 64)),
|
|
1124
|
+
n("div", io, [
|
|
1125
|
+
e[8] || (e[8] = Fe(" Referral Code: ", -1)),
|
|
1126
|
+
n("span", lo, $(y.member.referralCode ? y.member.referralCode : "-"), 1)
|
|
1127
|
+
])
|
|
1128
|
+
])
|
|
1129
|
+
]),
|
|
1130
|
+
n("div", null, [
|
|
1131
|
+
e[10] || (e[10] = n("div", { class: "fm-typo-en-title-sm-800 mb-16" }, "Activities", -1)),
|
|
1132
|
+
n("div", co, [
|
|
1133
|
+
(p(), A(q, null, ie(l, (h) => n("div", {
|
|
1134
|
+
key: h.key
|
|
1135
|
+
}, [
|
|
1136
|
+
n("div", mo, $(h.label), 1),
|
|
1137
|
+
n("div", uo, $(h.key ? u.member.stats[h.key] || "-" : h.getter(y.member)), 1)
|
|
1138
|
+
])), 64))
|
|
1139
|
+
])
|
|
1140
|
+
])
|
|
1141
|
+
]),
|
|
1142
|
+
e[13] || (e[13] = n("div", { class: "border-fm-color-neutral-gray-100 rounded-sm border-t" }, null, -1)),
|
|
1143
|
+
(p(!0), A(q, null, ie(t(de), (h) => (p(), A("div", po, [
|
|
1144
|
+
(p(!0), A(q, null, ie(h, (Y, oe) => (p(), A("div", { key: oe }, [
|
|
1145
|
+
n("div", {
|
|
1146
|
+
class: it(oe !== 0 ? "pt-12 md:pt-0 lg:pt-0 md:pl-12 lg:pl-12" : "")
|
|
1147
|
+
}, [
|
|
1148
|
+
n("div", fo, [
|
|
1149
|
+
n("div", bo, $(Y.label), 1),
|
|
1150
|
+
n("button", {
|
|
1151
|
+
onClick: (j) => ae(j, Y.label)
|
|
1152
|
+
}, [
|
|
1153
|
+
_(X, {
|
|
1154
|
+
name: "chevron_right",
|
|
1155
|
+
outline: "",
|
|
1156
|
+
size: "md"
|
|
1157
|
+
})
|
|
1158
|
+
], 8, yo)
|
|
1159
|
+
]),
|
|
1160
|
+
n("div", go, [
|
|
1161
|
+
(p(!0), A(q, null, ie(Y.stats, (j) => (p(), A("div", {
|
|
1162
|
+
key: j.key
|
|
1163
|
+
}, [
|
|
1164
|
+
n("div", vo, $(j.label), 1),
|
|
1165
|
+
n("div", xo, $(j.getter(y.member)), 1)
|
|
1166
|
+
]))), 128))
|
|
1167
|
+
])
|
|
1168
|
+
], 2)
|
|
1169
|
+
]))), 128))
|
|
1170
|
+
]))), 256)),
|
|
1171
|
+
n("div", ho, [
|
|
1172
|
+
e[11] || (e[11] = n("div", { class: "fm-typo-en-title-sm-800" }, "Segments", -1)),
|
|
1173
|
+
t(D).length ? (p(), A("div", _o, [
|
|
1174
|
+
(p(!0), A(q, null, ie(t(D), (h) => (p(), R(se, {
|
|
1175
|
+
label: h.toString()
|
|
1176
|
+
}, null, 8, ["label"]))), 256))
|
|
1177
|
+
])) : (p(), A("div", So, "No titles"))
|
|
1178
|
+
]),
|
|
1179
|
+
e[14] || (e[14] = n("div", { class: "border-fm-color-neutral-gray-100 rounded-sm border-t" }, null, -1)),
|
|
1180
|
+
n("div", Co, [
|
|
1181
|
+
e[12] || (e[12] = n("div", { class: "fm-typo-en-title-sm-800" }, "Title badge", -1)),
|
|
1182
|
+
t(r).length ? (p(!0), A(q, { key: 0 }, ie(t(r).filter((h) => h.collectible), (h) => (p(), A("div", {
|
|
1183
|
+
class: "flex items-center gap-x-8 h-48",
|
|
1184
|
+
key: h.name
|
|
1185
|
+
}, [
|
|
1186
|
+
n("img", {
|
|
1187
|
+
src: h.collectible.image || t(pt),
|
|
1188
|
+
class: "aspect-square h-full object-contain"
|
|
1189
|
+
}, null, 8, wo),
|
|
1190
|
+
n("div", null, [
|
|
1191
|
+
n("div", Fo, $(h.name), 1),
|
|
1192
|
+
n("div", Mo, " Expired on " + $(t(S)(h.expiredAt).format("MMM D, Y")), 1)
|
|
1193
|
+
])
|
|
1194
|
+
]))), 128)) : (p(), A("div", To, "No titles"))
|
|
1195
|
+
])
|
|
1196
|
+
], 64)) : t(F).value == "loyalty" ? (p(), A("div", ko, [
|
|
1197
|
+
_(me, {
|
|
1198
|
+
class: "p-16 space-y-24",
|
|
1199
|
+
variant: "outlined"
|
|
1200
|
+
}, {
|
|
1201
|
+
default: xe(() => {
|
|
1202
|
+
var h, Y, oe, j, ue, pe, fe;
|
|
1203
|
+
return [
|
|
1204
|
+
n("div", Ao, [
|
|
1205
|
+
e[15] || (e[15] = n("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " Credit ", -1)),
|
|
1206
|
+
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)
|
|
1207
|
+
]),
|
|
1208
|
+
n("div", Vo, [
|
|
1209
|
+
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)),
|
|
1210
|
+
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(
|
|
1211
|
+
(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,
|
|
1212
|
+
0
|
|
1213
|
+
)) ?? 0), 1)
|
|
1214
|
+
]),
|
|
1215
|
+
n("div", $o, [
|
|
1216
|
+
_(N, {
|
|
1217
|
+
label: "Add credit",
|
|
1218
|
+
icon: "add",
|
|
1219
|
+
variant: "plain",
|
|
1220
|
+
onClick: e[1] || (e[1] = (Q) => W("credit", "send"))
|
|
1221
|
+
}),
|
|
1222
|
+
_(N, {
|
|
1223
|
+
label: "Deduct credit",
|
|
1224
|
+
icon: "remove",
|
|
1225
|
+
variant: "plain",
|
|
1226
|
+
onClick: e[2] || (e[2] = (Q) => W("credit", "deduct"))
|
|
1227
|
+
})
|
|
1228
|
+
])
|
|
1229
|
+
];
|
|
1230
|
+
}),
|
|
1231
|
+
_: 1
|
|
1232
|
+
}),
|
|
1233
|
+
_(me, {
|
|
1234
|
+
class: "p-16 space-y-24",
|
|
1235
|
+
variant: "outlined"
|
|
1236
|
+
}, {
|
|
1237
|
+
default: xe(() => {
|
|
1238
|
+
var h, Y, oe, j, ue, pe, fe;
|
|
1239
|
+
return [
|
|
1240
|
+
n("div", Bo, [
|
|
1241
|
+
e[17] || (e[17] = n("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " Point ", -1)),
|
|
1242
|
+
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)
|
|
1243
|
+
]),
|
|
1244
|
+
n("div", No, [
|
|
1245
|
+
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)),
|
|
1246
|
+
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(
|
|
1247
|
+
(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,
|
|
1248
|
+
0
|
|
1249
|
+
)) ?? 0), 1)
|
|
1250
|
+
]),
|
|
1251
|
+
n("div", Po, [
|
|
1252
|
+
_(N, {
|
|
1253
|
+
label: "Add point",
|
|
1254
|
+
icon: "add",
|
|
1255
|
+
variant: "plain",
|
|
1256
|
+
onClick: e[3] || (e[3] = (Q) => W("coin", "send"))
|
|
1257
|
+
}),
|
|
1258
|
+
_(N, {
|
|
1259
|
+
label: "Deduct point",
|
|
1260
|
+
icon: "remove",
|
|
1261
|
+
variant: "plain",
|
|
1262
|
+
onClick: e[4] || (e[4] = (Q) => W("coin", "deduct"))
|
|
1263
|
+
})
|
|
1264
|
+
])
|
|
1265
|
+
];
|
|
1266
|
+
}),
|
|
1267
|
+
_: 1
|
|
1268
|
+
})
|
|
1269
|
+
])) : t(F).value == "voucher" ? (p(), R(Gt, {
|
|
1270
|
+
key: 2,
|
|
1271
|
+
member: u.member
|
|
1272
|
+
}, null, 8, ["member"])) : t(F).value == "mission" ? (p(), R(Ht, {
|
|
1273
|
+
key: 3,
|
|
1274
|
+
member: u.member
|
|
1275
|
+
}, null, 8, ["member"])) : t(F).value == "game" ? (p(), R(Wt, {
|
|
1276
|
+
key: 4,
|
|
1277
|
+
member: u.member
|
|
1278
|
+
}, null, 8, ["member"])) : ce("", !0)
|
|
1279
|
+
])
|
|
1280
|
+
]),
|
|
1281
|
+
_: 1
|
|
1282
|
+
}, 8, ["modelValue"]);
|
|
1283
|
+
};
|
|
1284
|
+
}
|
|
1285
|
+
}), Ro = { class: "flex items-center justify-end" }, Cn = /* @__PURE__ */ be({
|
|
1286
|
+
__name: "MemberList",
|
|
1287
|
+
setup(y) {
|
|
1288
|
+
const k = Je(), f = Ve(), x = qe(), { minor: s } = je, o = He(), g = [
|
|
1289
|
+
{
|
|
1290
|
+
header: "Name",
|
|
1291
|
+
enableSorting: !0,
|
|
1292
|
+
accessorKey: "name",
|
|
1293
|
+
cell(r) {
|
|
1294
|
+
return Tt(r.row.original);
|
|
1295
|
+
}
|
|
1296
|
+
},
|
|
1297
|
+
{
|
|
1298
|
+
header: "Phone",
|
|
1299
|
+
enableSorting: !0,
|
|
1300
|
+
accessorKey: "phoneNumber"
|
|
1301
|
+
},
|
|
1302
|
+
{
|
|
1303
|
+
accessorFn: (r) => S(Ce(r._id.toString())).format("D MMM YYYY"),
|
|
1304
|
+
header: "Customer Since",
|
|
1305
|
+
accessorKey: "_id",
|
|
1306
|
+
id: "_id"
|
|
1307
|
+
},
|
|
1308
|
+
{
|
|
1309
|
+
accessorKey: "collection_TIER_0_balance",
|
|
1310
|
+
header: "Tier",
|
|
1311
|
+
enableSorting: !0,
|
|
1312
|
+
cell(r) {
|
|
1313
|
+
return kt(
|
|
1314
|
+
r.row.original,
|
|
1315
|
+
f.sortedTiers
|
|
1316
|
+
);
|
|
1317
|
+
}
|
|
1318
|
+
},
|
|
1319
|
+
{
|
|
1320
|
+
header: "Title",
|
|
1321
|
+
enableSorting: !1,
|
|
1322
|
+
cell(r) {
|
|
1323
|
+
return At(
|
|
1324
|
+
r.row.original,
|
|
1325
|
+
f.sortedTitles
|
|
1326
|
+
);
|
|
1327
|
+
}
|
|
1328
|
+
},
|
|
1329
|
+
{
|
|
1330
|
+
accessorKey: "collection_CREDIT_0_balance",
|
|
1331
|
+
accessorFn: (r) => {
|
|
1332
|
+
var i, w, T;
|
|
1333
|
+
return ee(((T = (w = (i = r.collection) == null ? void 0 : i.CREDIT) == null ? void 0 : w[0]) == null ? void 0 : T.balance) ?? 0, 2);
|
|
1334
|
+
},
|
|
1335
|
+
header: "Credit(s)",
|
|
1336
|
+
enableSorting: !0
|
|
1337
|
+
},
|
|
1338
|
+
{
|
|
1339
|
+
accessorKey: "collection_POINT_0_balance",
|
|
1340
|
+
accessorFn: (r) => {
|
|
1341
|
+
var i, w, T;
|
|
1342
|
+
return ee(((T = (w = (i = r.collection) == null ? void 0 : i.POINT) == null ? void 0 : w[0]) == null ? void 0 : T.balance) ?? 0, 2);
|
|
1343
|
+
},
|
|
1344
|
+
header: "Experience(s)",
|
|
1345
|
+
enableSorting: !0
|
|
1346
|
+
},
|
|
1347
|
+
{
|
|
1348
|
+
accessorKey: "collection_COIN_0_balance",
|
|
1349
|
+
accessorFn: (r) => {
|
|
1350
|
+
var i, w, T;
|
|
1351
|
+
return ee(((T = (w = (i = r.collection) == null ? void 0 : i.COIN) == null ? void 0 : w[0]) == null ? void 0 : T.balance) ?? 0, 2);
|
|
1352
|
+
},
|
|
1353
|
+
header: "Point(s)",
|
|
1354
|
+
enableSorting: !0
|
|
1355
|
+
},
|
|
1356
|
+
{
|
|
1357
|
+
accessorFn: (r) => {
|
|
1358
|
+
var i;
|
|
1359
|
+
return ((i = r.stats) == null ? void 0 : i.visitCount) ?? 0;
|
|
1360
|
+
},
|
|
1361
|
+
header: "Total visit",
|
|
1362
|
+
accessorKey: "stats.visitCount",
|
|
1363
|
+
id: "stats.visitCount"
|
|
1364
|
+
},
|
|
1365
|
+
{
|
|
1366
|
+
accessorFn: (r) => {
|
|
1367
|
+
var i;
|
|
1368
|
+
return (i = r.stats) == null ? void 0 : i.lastVisit;
|
|
1369
|
+
},
|
|
1370
|
+
sortingFn: (r, i) => {
|
|
1371
|
+
var w, T;
|
|
1372
|
+
return new Date((w = r.original.stats) == null ? void 0 : w.lastVisit).getTime() - new Date((T = i.original.stats) == null ? void 0 : T.lastVisit).getTime();
|
|
1373
|
+
},
|
|
1374
|
+
id: "stats.lastVisit",
|
|
1375
|
+
header: "Last visit",
|
|
1376
|
+
cell(r) {
|
|
1377
|
+
var i, w;
|
|
1378
|
+
return K("div", { class: "flex items-center justify-end gap-4" }, [
|
|
1379
|
+
K(
|
|
1380
|
+
"span",
|
|
1381
|
+
(i = r.row.original.stats) != null && i.lastVisit ? S((w = r.row.original.stats) == null ? void 0 : w.lastVisit).fromNow() : "NA"
|
|
1382
|
+
),
|
|
1383
|
+
K(
|
|
1384
|
+
ve.FmTooltip,
|
|
1385
|
+
{
|
|
1386
|
+
content: S(r.row.original.stats.lastVisit).format(
|
|
1387
|
+
"D MMM YYYY - hh:mmA"
|
|
1388
|
+
)
|
|
1389
|
+
},
|
|
1390
|
+
[K(ve.FmIcon, { name: "info", outline: !0, size: "sm" })]
|
|
1391
|
+
)
|
|
1392
|
+
]);
|
|
1393
|
+
}
|
|
1394
|
+
},
|
|
1395
|
+
{
|
|
1396
|
+
id: "actions",
|
|
1397
|
+
cell(r) {
|
|
1398
|
+
return K(
|
|
1399
|
+
ve.FmMenu,
|
|
1400
|
+
{
|
|
1401
|
+
placement: "bottom-end",
|
|
1402
|
+
onClick: (i) => {
|
|
1403
|
+
i.stopPropagation();
|
|
1404
|
+
}
|
|
1405
|
+
},
|
|
1406
|
+
{
|
|
1407
|
+
"menu-button": () => K(ve.FmButton, { icon: "more_vert", variant: "tertiary" }),
|
|
1408
|
+
default: () => [
|
|
1409
|
+
K(ve.FmMenuItem, {
|
|
1410
|
+
label: "Transaction details",
|
|
1411
|
+
onClick: async (i) => {
|
|
1412
|
+
i.stopPropagation(), await re(r.row.original._id);
|
|
1413
|
+
}
|
|
1414
|
+
})
|
|
1415
|
+
]
|
|
1416
|
+
}
|
|
1417
|
+
);
|
|
1418
|
+
}
|
|
1419
|
+
}
|
|
1420
|
+
], { tableMeta: m, rowData: C, onSort: u, debouncedFetchData: v, onSearch: I } = Ke(le.read), D = G(), L = G(!1), P = G(), de = H(() => x.locations.map((r) => ({
|
|
1421
|
+
label: r.name,
|
|
1422
|
+
value: r._id
|
|
1423
|
+
})));
|
|
1424
|
+
async function ae() {
|
|
1425
|
+
P.value = await le.readById(
|
|
1426
|
+
P.value._id.toString()
|
|
1427
|
+
), L.value = !0;
|
|
1428
|
+
}
|
|
1429
|
+
async function W() {
|
|
1430
|
+
await v(), L.value = !1;
|
|
1431
|
+
}
|
|
1432
|
+
async function re(r) {
|
|
1433
|
+
await o.push({
|
|
1434
|
+
name: We["$connect-LOYALTY_MEMBER_TRANSACTIONS"],
|
|
1435
|
+
params: { id: r }
|
|
1436
|
+
});
|
|
1437
|
+
}
|
|
1438
|
+
const d = {
|
|
1439
|
+
sortBy: "_id",
|
|
1440
|
+
descending: !1,
|
|
1441
|
+
rowsPerPage: 1e3,
|
|
1442
|
+
page: 1,
|
|
1443
|
+
rowsNumber: 0
|
|
1444
|
+
};
|
|
1445
|
+
function l(r) {
|
|
1446
|
+
const i = S(r);
|
|
1447
|
+
return i.isValid() ? i.format("DD/MM/YYYY") : "";
|
|
1448
|
+
}
|
|
1449
|
+
async function M() {
|
|
1450
|
+
const r = new ct(), i = (await le.read({
|
|
1451
|
+
limit: 1,
|
|
1452
|
+
skip: 0,
|
|
1453
|
+
sortBy: d.sortBy,
|
|
1454
|
+
descending: d.descending
|
|
1455
|
+
})).meta.totalResources ?? 0, w = d.rowsPerPage;
|
|
1456
|
+
await s(
|
|
1457
|
+
async () => {
|
|
1458
|
+
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;
|
|
1459
|
+
for (let Z = 0; Z < i; Z += w) {
|
|
1460
|
+
const Xe = {
|
|
1461
|
+
...d,
|
|
1462
|
+
limit: w,
|
|
1463
|
+
skip: d.page - 1,
|
|
1464
|
+
sortBy: d.sortBy,
|
|
1465
|
+
descending: d.descending
|
|
1466
|
+
}, Qe = await le.read(Xe);
|
|
1467
|
+
for (const c of Qe.resources) {
|
|
1468
|
+
const Ze = (T = lt.parseOneAddress(
|
|
1469
|
+
c == null ? void 0 : c.email
|
|
1470
|
+
)) != 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(
|
|
1471
|
+
(ne, ge) => {
|
|
1472
|
+
var _e, Se;
|
|
1473
|
+
const he = (Se = (_e = f.sortedTitles) == null ? void 0 : _e.find(
|
|
1474
|
+
(we) => we._id === ge.collectible
|
|
1475
|
+
)) == null ? void 0 : Se.name;
|
|
1476
|
+
return !he || ge.balance <= 0 || ne.push(he), ne;
|
|
1477
|
+
},
|
|
1478
|
+
[]
|
|
1479
|
+
), tt = (f.sortedTitles || []).reduce(
|
|
1480
|
+
(ne, ge) => {
|
|
1481
|
+
var _e, Se, we, Be;
|
|
1482
|
+
const he = (Be = (we = (Se = (((_e = c == null ? void 0 : c.collection) == null ? void 0 : _e.TITLE) || []).find(
|
|
1483
|
+
(at) => at.collectible === ge._id
|
|
1484
|
+
)) == null ? void 0 : Se.expiryBalance) == null ? void 0 : we[0]) == null ? void 0 : Be.expiredAt;
|
|
1485
|
+
return ne[ge.name] = he ? S(he).format("DD/MM/YYYY") : "", ne;
|
|
1486
|
+
},
|
|
1487
|
+
{}
|
|
1488
|
+
), 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(
|
|
1489
|
+
(ne, ge) => ne + ge.amount,
|
|
1490
|
+
0
|
|
1491
|
+
)) || 0, $e = ee(ot, 2), nt = {
|
|
1492
|
+
ID: c._id.toString(),
|
|
1493
|
+
Name: ((b = c.name) == null ? void 0 : b.trim()) || "",
|
|
1494
|
+
Phone: ((B = c == null ? void 0 : c.phoneNumber) == null ? void 0 : B.trim()) || "",
|
|
1495
|
+
Email: Ze || "",
|
|
1496
|
+
Gender: c.gender || "",
|
|
1497
|
+
CardNo: c.cardNo || "",
|
|
1498
|
+
Birthday: c != null && c.birthday ? l(c == null ? void 0 : c.birthday) : "",
|
|
1499
|
+
Credit: (Number($e) - Number(Ie)).toFixed(2),
|
|
1500
|
+
FreeCredit: Number(Ie.toFixed(2)),
|
|
1501
|
+
TotalCredit: Number($e),
|
|
1502
|
+
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,
|
|
1503
|
+
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,
|
|
1504
|
+
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,
|
|
1505
|
+
Titles: et.join(","),
|
|
1506
|
+
...tt,
|
|
1507
|
+
TotalTransaction: c.stats.visitCount,
|
|
1508
|
+
AvgSpent: Mt(Number(c.stats.avgBillSize || 0)).toFormat(
|
|
1509
|
+
!1
|
|
1510
|
+
),
|
|
1511
|
+
TotalSpent: c.stats.avgBillSize * c.stats.visitCount,
|
|
1512
|
+
LastVisit: l(c.stats.lastVisit),
|
|
1513
|
+
Feedback: ((ue = c.stats) == null ? void 0 : ue.feedbackCount) || 0,
|
|
1514
|
+
LastSeasonTierEarned: ((pe = c.stats) == null ? void 0 : pe.lastSeasonTierEarned) || 0,
|
|
1515
|
+
LastSeasonPointEarned: ((fe = c.stats) == null ? void 0 : fe.lastSeasonPointEarned) || 0,
|
|
1516
|
+
JoinedAt: l(c.joinAt || void 0),
|
|
1517
|
+
JoinedAtLocation: c.location && ((Q = de.value.find((ne) => ne.value == c.location)) == null ? void 0 : Q.label) || "-",
|
|
1518
|
+
VisitFrequency: `${Number(
|
|
1519
|
+
Math.ceil(c.stats.avgVisitFrequency).toFixed(0)
|
|
1520
|
+
)}`
|
|
1521
|
+
};
|
|
1522
|
+
r.addRecord(nt);
|
|
1523
|
+
}
|
|
1524
|
+
d.page++;
|
|
1525
|
+
}
|
|
1526
|
+
await dt(
|
|
1527
|
+
r.buildExcel(),
|
|
1528
|
+
`members-${(/* @__PURE__ */ new Date()).toISOString()}.xlsx`,
|
|
1529
|
+
{
|
|
1530
|
+
bookType: "xlsx",
|
|
1531
|
+
bookSST: !1,
|
|
1532
|
+
type: "array"
|
|
1533
|
+
}
|
|
1534
|
+
), d.page = 1;
|
|
1535
|
+
},
|
|
1536
|
+
{
|
|
1537
|
+
message: "Exporting member...",
|
|
1538
|
+
successMessage: "Member exported successfully"
|
|
1539
|
+
}
|
|
1540
|
+
);
|
|
1541
|
+
}
|
|
1542
|
+
return ze(async () => {
|
|
1543
|
+
await f.readMembership(), await k.read(), await x.readLocations(), await v();
|
|
1544
|
+
}), (r, i) => {
|
|
1545
|
+
const w = V("FmSearch"), T = V("FmButton"), O = V("FmSnackbar");
|
|
1546
|
+
return p(), A("div", null, [
|
|
1547
|
+
n("div", Ro, [
|
|
1548
|
+
_(w, {
|
|
1549
|
+
class: "mt-4",
|
|
1550
|
+
modelValue: t(m).searchValue,
|
|
1551
|
+
"onUpdate:modelValue": [
|
|
1552
|
+
i[0] || (i[0] = (E) => t(m).searchValue = E),
|
|
1553
|
+
t(I)
|
|
1554
|
+
],
|
|
1555
|
+
placeholder: "Search",
|
|
1556
|
+
collapsible: ""
|
|
1557
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue"]),
|
|
1558
|
+
_(T, {
|
|
1559
|
+
icon: "ios_share",
|
|
1560
|
+
variant: "tertiary",
|
|
1561
|
+
onClick: M
|
|
1562
|
+
})
|
|
1563
|
+
]),
|
|
1564
|
+
Re(_(O, {
|
|
1565
|
+
"z-index": 0,
|
|
1566
|
+
class: "!max-w-full my-16",
|
|
1567
|
+
title: "Info",
|
|
1568
|
+
description: "Current list is not up to date, please refresh table for latest data.",
|
|
1569
|
+
variant: "info",
|
|
1570
|
+
dismissable: "",
|
|
1571
|
+
onOnDismiss: i[1] || (i[1] = (E) => L.value = !1),
|
|
1572
|
+
action: "Refresh",
|
|
1573
|
+
onOnAction: W
|
|
1574
|
+
}, null, 512), [
|
|
1575
|
+
[Ue, t(L)]
|
|
1576
|
+
]),
|
|
1577
|
+
_(Ge, {
|
|
1578
|
+
loading: t(m).isLoading,
|
|
1579
|
+
"row-data": t(C),
|
|
1580
|
+
"row-count": t(m).totalRows,
|
|
1581
|
+
"column-defs": g,
|
|
1582
|
+
"shrink-at": !1,
|
|
1583
|
+
"page-count": t(m).pageCount,
|
|
1584
|
+
"page-index": t(m).pageIndex,
|
|
1585
|
+
"page-size": t(m).pageSize,
|
|
1586
|
+
onSortChange: t(u),
|
|
1587
|
+
onPageChange: i[2] || (i[2] = (E) => t(v)({ pageSize: E.pageSize, pageIndex: E.pageIndex })),
|
|
1588
|
+
onRowClick: i[3] || (i[3] = (E) => {
|
|
1589
|
+
var U;
|
|
1590
|
+
P.value = E.original, (U = t(D)) == null || U.showSheet();
|
|
1591
|
+
})
|
|
1592
|
+
}, null, 8, ["loading", "row-data", "row-count", "page-count", "page-index", "page-size", "onSortChange"]),
|
|
1593
|
+
t(P) ? (p(), R(Oo, {
|
|
1594
|
+
key: 0,
|
|
1595
|
+
ref_key: "sheetRef",
|
|
1596
|
+
ref: D,
|
|
1597
|
+
member: t(P),
|
|
1598
|
+
"onUpdate:member": ae
|
|
1599
|
+
}, null, 8, ["member"])) : ce("", !0)
|
|
1600
|
+
]);
|
|
1601
|
+
};
|
|
1602
|
+
}
|
|
1603
|
+
});
|
|
1604
|
+
export {
|
|
1605
|
+
Cn as default
|
|
1606
|
+
};
|