@feedmepos/mf-connect 0.1.38-beta.2 → 0.1.39-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-D8WCDkga.js +427 -0
- package/dist/{App-D11A2JY1.js → App-CTnXtg1W.js} +352 -364
- package/dist/{Bin-9wV4Ah3M.js → Bin-BY6-bvFj.js} +8 -8
- package/dist/{Broadcast-I3BtSk8V.js → Broadcast-5VTEIQAr.js} +40 -40
- package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-XJqTXbKr.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-BuAQxEM4.js} +18 -18
- package/dist/{Card-CqALG5RM.js → Card-8ivdV-Qz.js} +159 -159
- package/dist/{Collections-rg3SzoUb.js → Collections-CFszRHmE.js} +91 -103
- package/dist/{Credit-BNn1sYZv.js → Credit-DFslY__4.js} +74 -74
- package/dist/{EditCampaignSheet.vue_vue_type_script_setup_true_lang-PJ8q72XH.js → EditCampaignSheet.vue_vue_type_script_setup_true_lang-BvCLYtJ3.js} +488 -489
- package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-Sww7KNle.js → EffectSheet.vue_vue_type_style_index_0_lang-Ci_bp7GH.js} +94 -94
- package/dist/{Experience-D_Qm8SUj.js → Experience-BxfiZNlY.js} +41 -41
- package/dist/{Game-CKXgXm6Q.js → Game-0FZJcLmj.js} +31 -31
- package/dist/ImageInput.vue_vue_type_script_setup_true_lang-ByhTB9Ie.js +144 -0
- package/dist/{Index-D4DGfUHd.js → Index-ByeKKbuM.js} +10 -10
- package/dist/Marketing-C7F4abzg.js +319 -0
- package/dist/{Member-B55vWHDd.js → Member-DP0fLSIV.js} +64 -64
- package/dist/MemberList-DFW2bMbr.js +1606 -0
- package/dist/MemberOverview-C2n9oJZh.js +58 -0
- package/dist/{MemberTransactions-CP5EI-W0.js → MemberTransactions-CW62fvgx.js} +1 -1
- package/dist/MessageInput.vue_vue_type_script_setup_true_lang-iJXNbgsB.js +455 -0
- package/dist/{Mission-CFvhROuB.js → Mission-DEgQHJw6.js} +21 -21
- package/dist/{Overview-4273yNwL.js → Overview-5jDtZKi8.js} +335 -335
- package/dist/{Point-B_-_C919.js → Point-D2lB1-xB.js} +41 -41
- package/dist/{Promotion-D2S3COxk.js → Promotion-Diz1gIa0.js} +42 -42
- package/dist/{Queue-BmS1Oi-C.js → Queue-DIAuq7HG.js} +51 -51
- package/dist/{Record-DRBl0M8g.js → Record-T608yda1.js} +9 -9
- package/dist/{Reward-8056NmfK.js → Reward-fZzHrHCW.js} +173 -173
- package/dist/{RewardGroup.vue_vue_type_script_setup_true_lang-CJ_WC2gV.js → RewardGroup.vue_vue_type_script_setup_true_lang-YOKVfimM.js} +11 -11
- package/dist/{RuleGroup.vue_vue_type_script_setup_true_lang-DqNQl_nz.js → RuleGroup.vue_vue_type_script_setup_true_lang-C3_lmBe5.js} +431 -431
- package/dist/Segment-DDQIzsrk.js +882 -0
- package/dist/{SelectItems.vue_vue_type_script_setup_true_lang-4nNkkklE.js → SelectItems.vue_vue_type_script_setup_true_lang-B5oUf91Q.js} +2 -2
- package/dist/{SendCollectionSheet.vue_vue_type_script_setup_true_lang-Dnf2oxOG.js → SendCollectionSheet.vue_vue_type_script_setup_true_lang-C2U6Kzvx.js} +11 -11
- package/dist/{SendVoucherSheet.vue_vue_type_script_setup_true_lang-BLYP-5U9.js → SendVoucherSheet.vue_vue_type_script_setup_true_lang-BRmqgxES.js} +3 -3
- package/dist/{Setting-BrJfYoru.js → Setting-CQNyXmp4.js} +432 -432
- package/dist/{Store-Bpl_4yZW.js → Store-CIA1Rtsg.js} +210 -210
- package/dist/StoreRewards-D5zlE6cE.js +423 -0
- package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-BkTYngJ_.js +995 -0
- package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-QucRaI08.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-D8l3fQyz.js} +1 -1
- package/dist/{Tier-_LnXg3n6.js → Tier-jFXVOje_.js} +106 -106
- package/dist/{Title-B7AGStvx.js → Title-DVpZ1YMK.js} +131 -133
- package/dist/{Transaction-Chxv6V7u.js → Transaction-BF_wmok6.js} +2 -2
- package/dist/{UserRuleGroup.vue_vue_type_script_setup_true_lang-CzXNmobp.js → UserRuleGroup.vue_vue_type_script_setup_true_lang-Cex1Z43W.js} +6 -6
- package/dist/{Voucher-C5z2kOq9.js → Voucher-CaBMU5w0.js} +37 -37
- package/dist/VoucherEditor.vue_vue_type_script_setup_true_lang-BXt2fLOD.js +419 -0
- package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-BlXzEWA6.js → ZodTextField.vue_vue_type_script_setup_true_lang-CtHjWpUe.js} +1 -1
- package/dist/{app-BVojNX0w.js → app-CPhyKlyf.js} +1 -1
- package/dist/{app-7cvPyHJ7.js → app-DuIzRGvb.js} +124 -161
- package/dist/app.js +3 -4
- package/dist/{business-CmxV69wT.js → business-TTvv3aTz.js} +1 -1
- package/dist/{campaign-Dq5C_no-.js → campaign-BiMCoAzx.js} +3 -5
- package/dist/{campaign-CT_cNJEL.js → campaign-CjEVStN1.js} +9 -9
- package/dist/{campaign.enum-dp7yHKzF.js → campaign.enum-DpYmj9jp.js} +1 -1
- package/dist/campaign.fn-DJ6J98jS.js +758 -0
- package/dist/{collectible.enum-DxbB4DxT.js → collectible.enum-Cgmm_s-C.js} +1 -1
- package/dist/{collection.fn-CNZRdUgy.js → collection.fn-BsYCNgfJ.js} +2 -2
- package/dist/{dto-CT9zZbv9.js → dto-DgmHIlZ2.js} +4 -4
- package/dist/{effect-FIlOEC4H.js → effect-DnAVIDFy.js} +1 -1
- package/dist/{email-addresses-Ba7xImfX.js → email-addresses-CMRgb6Uv.js} +1 -1
- package/dist/{export-uzjZFNF9.js → export-DtarK6IJ.js} +3 -3
- package/dist/{helper-D4sAZde0.js → helper-BKZghMbF.js} +1 -1
- package/dist/{index-l2F5MnLF.js → index-2OAcPmuQ.js} +1 -1
- package/dist/{index-BI3m1Ehv.js → index-B0YZKHyu.js} +3 -3
- package/dist/{index-CH3z92VV.js → index-B5oXFFlO.js} +1 -1
- package/dist/{index-CvBcve-r.js → index-BQ3KHJXX.js} +1 -1
- package/dist/{index-B9pl4zRZ.js → index-B_893fH7.js} +79 -179
- package/dist/{index-CNJLP3D5.js → index-BoR-BOFw.js} +1 -1
- package/dist/{index-DNxa8Rqx.js → index-C7rl1eHp.js} +449 -516
- package/dist/{index-BXz54M1s.js → index-CBcbwf0k.js} +1 -1
- package/dist/{index-CS3Jmojj.js → index-CIztuDE4.js} +2462 -2453
- package/dist/{index-D5rvMvzx.js → index-CK67enPK.js} +1 -1
- package/dist/index-CuvNtC_M.js +61 -0
- package/dist/index-D2uZzjpn.js +44 -0
- package/dist/{index-CUfS9Kp1.js → index-DWdAUovq.js} +9 -9
- package/dist/{index-CONvJfKv.js → index-DkWcEDHA.js} +1 -1
- package/dist/{index-BjU8LVUC.js → index-VHu8hYtE.js} +385 -376
- package/dist/{index.esm2017-ATcsD5N4.js → index.esm2017-DkwLmmR_.js} +127 -127
- package/dist/{loading-BWGQSrCB.js → loading-BFkEqWR6.js} +1 -1
- package/dist/{membership-Cc4OZ8-U.js → membership-D0eN3i_T.js} +3 -3
- package/dist/{money-D7p8nfun.js → money-DS9ZQwSP.js} +1 -1
- package/dist/{number-CMJjC4qz.js → number-C8Gt93v9.js} +1 -1
- package/dist/objectid-Cr99eTPd.js +145 -0
- package/dist/{plugins-eQis66QR.js → plugins-DK_ue6Xa.js} +2 -2
- package/dist/{reward-DrnzbG20.js → reward-CW2dSLDW.js} +1 -1
- package/dist/{rule-CtRxkYXB.js → rule-CebKyXSm.js} +3 -3
- package/dist/{rule-builder-Di9RIYHF.js → rule-builder-kQq14RfN.js} +17 -17
- package/dist/style.css +1 -1
- package/dist/{template-C3UfY0v5.js → template-CxUxlb6-.js} +64 -64
- package/dist/{trigger-C9U7Zgad.js → trigger-RqJo06KA.js} +4 -4
- package/dist/{usePagination-BeF5K3M7.js → usePagination-JoYaROkV.js} +85 -85
- package/dist/{user-D7n9yYmO.js → user-DhV5Iy52.js} +1 -1
- package/dist/{vue-i18n-Bz45zC04.js → vue-i18n-BtvUK9hI.js} +419 -419
- package/dist/{xlsx-D4S4qbcZ.js → xlsx-WnLDq4qn.js} +381 -381
- package/package.json +3 -9
- package/dist/Analytic-BjSfI2Ff.js +0 -761
- package/dist/AuditLogs-DWCFYoRg.js +0 -1887
- package/dist/DateRangeChip.vue_vue_type_script_setup_true_lang-BUzUIIUW.js +0 -58
- package/dist/ImageInput.vue_vue_type_script_setup_true_lang-rWUkV9gn.js +0 -144
- package/dist/Marketing-Dn9A1vgH.js +0 -20073
- package/dist/MemberList-BWTG9Ohy.js +0 -1606
- package/dist/MemberOverview-wL_ailso.js +0 -58
- package/dist/MessageInput.vue_vue_type_script_setup_true_lang-D--_An-f.js +0 -60279
- package/dist/Segment-Bzq-pyhc.js +0 -882
- package/dist/StoreRewards-Cu7n7Pjz.js +0 -423
- package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-T3Wo2maC.js +0 -1029
- package/dist/VoucherEditor.vue_vue_type_script_setup_true_lang-DdGMrk2C.js +0 -419
- package/dist/campaign.fn-BYZgKDN7.js +0 -758
- package/dist/index-CsaQJMAR.js +0 -66
- package/dist/index-CwsMG2cV.js +0 -56
- package/dist/objectid-D5T27iny.js +0 -145
- package/dist/remy-vue-client-Cpppk9h-.js +0 -1693
|
@@ -0,0 +1,1606 @@
|
|
|
1
|
+
import { defineComponent as be, computed as H, ref as G, resolveComponent as $, openBlock as u, createElementBlock as A, Fragment as q, createElementVNode as t, unref as e, createBlock as R, createCommentVNode as ce, createVNode as h, renderList as ie, withCtx as xe, createTextVNode as Fe, toDisplayString as I, withDirectives as Re, vShow as Ue, watch as Le, onBeforeMount as st, h as K, onMounted as ze, isRef as rt, normalizeClass as it } from "vue";
|
|
2
|
+
import { h as S } from "./moment-BWErdI6_.js";
|
|
3
|
+
import { useDialog as Ee, components as ve } from "@feedmepos/ui-library";
|
|
4
|
+
import { e as lt, M as ct } from "./email-addresses-CMRgb6Uv.js";
|
|
5
|
+
import { w as dt } from "./xlsx-WnLDq4qn.js";
|
|
6
|
+
import "./index-BoR-BOFw.js";
|
|
7
|
+
import "./index-CIztuDE4.js";
|
|
8
|
+
import { u as $e, C as De, s as mt } from "./membership-D0eN3i_T.js";
|
|
9
|
+
import { c as ut } from "./index-VHu8hYtE.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-C7rl1eHp.js";
|
|
13
|
+
import { p as Ye, c as Pe, b as Oe } from "./plugins-DK_ue6Xa.js";
|
|
14
|
+
import { u as je } from "./loading-BFkEqWR6.js";
|
|
15
|
+
import { C as Ae } from "./collection.fn-BsYCNgfJ.js";
|
|
16
|
+
import { defineStore as xt } from "pinia";
|
|
17
|
+
import { u as qe } from "./business-TTvv3aTz.js";
|
|
18
|
+
import { f as ee } from "./number-C8Gt93v9.js";
|
|
19
|
+
import "./index-DWdAUovq.js";
|
|
20
|
+
import "./index-B_893fH7.js";
|
|
21
|
+
import "./index-DkWcEDHA.js";
|
|
22
|
+
import "./index-B0YZKHyu.js";
|
|
23
|
+
import { s as _t } from "./index-CuvNtC_M.js";
|
|
24
|
+
import { u as Ke, _ as Ge } from "./usePagination-JoYaROkV.js";
|
|
25
|
+
import { B as ht, e as St } from "./export-DtarK6IJ.js";
|
|
26
|
+
import { m as Me } from "./index-2OAcPmuQ.js";
|
|
27
|
+
import { o as Ce } from "./objectId-dwaoBfJX.js";
|
|
28
|
+
import { F as ke } from "./collectible.enum-Cgmm_s-C.js";
|
|
29
|
+
import { g as Ct, b as wt } from "./campaign-CjEVStN1.js";
|
|
30
|
+
import { useRouter as He } from "vue-router";
|
|
31
|
+
import { m as le } from "./index-BQ3KHJXX.js";
|
|
32
|
+
import { t as Ft } from "./index-D2uZzjpn.js";
|
|
33
|
+
import { R as We } from "./app-DuIzRGvb.js";
|
|
34
|
+
import { t as Mt } from "./money-DS9ZQwSP.js";
|
|
35
|
+
import { g as Tt, a as kt, b as At } from "./user-DhV5Iy52.js";
|
|
36
|
+
const Et = { class: "flex flex-col" }, $t = /* @__PURE__ */ t("div", { class: "fm-typo-en-title-sm-800 mb-8" }, "Member tiering", -1), Vt = /* @__PURE__ */ t("div", { class: "fm-typo-en-title-sm-800 mt-16 mb-8" }, "Member Card", -1), It = /* @__PURE__ */ t("div", { class: "fm-typo-en-title-sm-800 mt-16 mb-8" }, "Titles", -1), Bt = { key: 1 }, Dt = /* @__PURE__ */ t("div", { class: "flex flex-nowrap gap-4 items-center" }, [
|
|
37
|
+
/* @__PURE__ */ t("div", { class: "flex-1" }, "Title"),
|
|
38
|
+
/* @__PURE__ */ t("div", { class: "flex-1" }, "Expires in days"),
|
|
39
|
+
/* @__PURE__ */ t("div", { class: "w-24 h-1" })
|
|
40
|
+
], -1), Nt = [
|
|
41
|
+
Dt
|
|
42
|
+
], Yt = { class: "flex flex-nowrap gap-4 items-center my-[-4px]" }, Pt = { class: "flex flex-nowrap gap-8 items-center pt-24 w-full" }, Ot = /* @__PURE__ */ be({
|
|
43
|
+
__name: "MemberStatsDialog",
|
|
44
|
+
props: {
|
|
45
|
+
member: {
|
|
46
|
+
type: Object,
|
|
47
|
+
required: !0
|
|
48
|
+
},
|
|
49
|
+
onSubmit: {
|
|
50
|
+
type: Function,
|
|
51
|
+
required: !0
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
setup(y) {
|
|
55
|
+
var de, ne, W, se;
|
|
56
|
+
const k = Ee(), p = $e(), x = y, r = H(
|
|
57
|
+
() => {
|
|
58
|
+
var c;
|
|
59
|
+
return (((c = x.member.collection) == null ? void 0 : c.TITLE) ?? []).reduce(
|
|
60
|
+
(f, M) => {
|
|
61
|
+
var w, T, O, E, U;
|
|
62
|
+
const s = p.sortedTitles.find(
|
|
63
|
+
(te) => te._id.toString() === M.collectible
|
|
64
|
+
);
|
|
65
|
+
if (!s) return f;
|
|
66
|
+
const i = [...M.expiryBalance ?? []].sort(
|
|
67
|
+
(te, z) => S(te.expiredAt).isAfter(S(z.expiredAt)) ? -1 : 1
|
|
68
|
+
);
|
|
69
|
+
return (w = i[0]) != null && w.expiredAt && S((T = i[0]) == null ? void 0 : T.expiredAt).isBefore(S()) || f.push({
|
|
70
|
+
_id: s._id,
|
|
71
|
+
name: s.name,
|
|
72
|
+
expiredAt: (O = i[0]) != null && O.expiredAt ? S((E = i[0]) == null ? void 0 : E.expiredAt).toISOString() : "",
|
|
73
|
+
expiresIn: S((U = i[0]) == null ? void 0 : U.expiredAt).diff(S(), "days")
|
|
74
|
+
}), f;
|
|
75
|
+
},
|
|
76
|
+
[]
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
), o = G({
|
|
80
|
+
cardNo: x.member.cardNo,
|
|
81
|
+
experience: ((ne = (de = x.member.collection) == null ? void 0 : de.POINT) == null ? void 0 : ne[0].balance) ?? 0,
|
|
82
|
+
tier: ((se = (W = x.member.collection) == null ? void 0 : W.TIER) == null ? void 0 : se[0].balance) ?? -1,
|
|
83
|
+
titles: r.value.map((c) => ({ expiredAt: c.expiresIn, id: c._id })) ?? void 0
|
|
84
|
+
}), v = H(
|
|
85
|
+
() => (p.sortedTitles ?? []).map((c) => ({
|
|
86
|
+
label: c.name,
|
|
87
|
+
value: c._id.toString(),
|
|
88
|
+
sublabel: r.value.some((f) => f._id === c._id) ? "Owned" : void 0
|
|
89
|
+
}))
|
|
90
|
+
), d = H(() => (p.sortedTiers ?? []).map((c, f) => ({
|
|
91
|
+
label: c.name,
|
|
92
|
+
sublabel: `${c.option.from} - ${c.option.to}`,
|
|
93
|
+
from: c.option.from,
|
|
94
|
+
to: c.option.to,
|
|
95
|
+
value: f + 1
|
|
96
|
+
})));
|
|
97
|
+
function C() {
|
|
98
|
+
var M, s;
|
|
99
|
+
const c = ((M = d.value[(o.value.tier ?? 1) - 1]) == null ? void 0 : M.from) ?? 0, f = (s = d.value[(o.value.tier ?? 1) - 1]) == null ? void 0 : s.to;
|
|
100
|
+
o.value.experience = Math.min(
|
|
101
|
+
f ?? c,
|
|
102
|
+
Math.max(c, o.value.experience ?? 0)
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
const m = H(() => {
|
|
106
|
+
var M, s, i, w, T, O;
|
|
107
|
+
const c = ((s = (M = x.member.collection) == null ? void 0 : M.TIER) == null ? void 0 : s[0].balance) ?? -1, f = ((w = (i = x.member.collection) == null ? void 0 : i.POINT) == null ? void 0 : w[0].balance) ?? 0;
|
|
108
|
+
if (c != o.value.tier) return !0;
|
|
109
|
+
if (o.value.experience && o.value.experience != f) {
|
|
110
|
+
const E = ((T = d.value[c - 1]) == null ? void 0 : T.from) ?? 0, U = ((O = d.value[c - 1]) == null ? void 0 : O.to) ?? 0;
|
|
111
|
+
if (o.value.experience < E || U && o.value.experience > U)
|
|
112
|
+
return !0;
|
|
113
|
+
}
|
|
114
|
+
return !1;
|
|
115
|
+
});
|
|
116
|
+
function g(c) {
|
|
117
|
+
var f;
|
|
118
|
+
return (f = r.value.find((M) => M._id === c)) == null ? void 0 : f.expiresIn;
|
|
119
|
+
}
|
|
120
|
+
const V = H(() => {
|
|
121
|
+
const c = ft.safeParse(o.value);
|
|
122
|
+
return c.success ? void 0 : c.error.errors;
|
|
123
|
+
});
|
|
124
|
+
function D(c) {
|
|
125
|
+
var f, M;
|
|
126
|
+
return (M = (f = V.value) == null ? void 0 : f.find((s) => s.path.join(".") === c)) == null ? void 0 : M.message;
|
|
127
|
+
}
|
|
128
|
+
function L(c) {
|
|
129
|
+
var f;
|
|
130
|
+
return (f = V.value) == null ? void 0 : f.filter((M) => M.path.join(".").startsWith(c)).map((M) => M.message);
|
|
131
|
+
}
|
|
132
|
+
async function P() {
|
|
133
|
+
await x.onSubmit(o.value), k.close();
|
|
134
|
+
}
|
|
135
|
+
return (c, f) => {
|
|
136
|
+
var te, z;
|
|
137
|
+
const M = $("FmSelect"), s = $("FmStepperField"), i = $("FmTextField"), w = $("FmField"), T = $("FmFormGroup"), O = $("FmButton"), E = $("FmHelperText"), U = $("FmSpacer");
|
|
138
|
+
return u(), A(q, null, [
|
|
139
|
+
t("div", Et, [
|
|
140
|
+
$t,
|
|
141
|
+
e(d).length ? (u(), R(M, {
|
|
142
|
+
key: 0,
|
|
143
|
+
modelValue: e(o).tier,
|
|
144
|
+
"onUpdate:modelValue": [
|
|
145
|
+
f[0] || (f[0] = (F) => e(o).tier = F),
|
|
146
|
+
C
|
|
147
|
+
],
|
|
148
|
+
label: "Member Tier",
|
|
149
|
+
items: e(d),
|
|
150
|
+
"helper-text": D("tier"),
|
|
151
|
+
"helper-state": D("tier") ? "error" : void 0
|
|
152
|
+
}, null, 8, ["modelValue", "items", "helper-text", "helper-state"])) : ce("", !0),
|
|
153
|
+
h(s, {
|
|
154
|
+
"model-value": e(o).experience ?? 0,
|
|
155
|
+
"onUpdate:modelValue": f[1] || (f[1] = (F) => e(o).experience = F),
|
|
156
|
+
label: "Member Experience",
|
|
157
|
+
"max-fraction-digits": 0,
|
|
158
|
+
"helper-text": D("experience"),
|
|
159
|
+
"helper-state": D("experience") ? "error" : void 0
|
|
160
|
+
}, null, 8, ["model-value", "helper-text", "helper-state"]),
|
|
161
|
+
Vt,
|
|
162
|
+
h(i, {
|
|
163
|
+
modelValue: e(o).cardNo,
|
|
164
|
+
"onUpdate:modelValue": f[2] || (f[2] = (F) => e(o).cardNo = F),
|
|
165
|
+
label: "Card number",
|
|
166
|
+
"helper-text": D("cardNo"),
|
|
167
|
+
"helper-state": D("cardNo") ? "error" : void 0
|
|
168
|
+
}, null, 8, ["modelValue", "helper-text", "helper-state"]),
|
|
169
|
+
It,
|
|
170
|
+
(te = e(o).titles) != null && te.length ? (u(), A("div", Bt, Nt)) : ce("", !0),
|
|
171
|
+
(u(!0), A(q, null, ie(e(o).titles ?? [], (F, J) => (u(), A("div", { key: J }, [
|
|
172
|
+
t("div", Yt, [
|
|
173
|
+
e(r).some((a) => a._id === F.id) ? (u(), R(T, {
|
|
174
|
+
key: 1,
|
|
175
|
+
"model-value": "",
|
|
176
|
+
class: "flex-1"
|
|
177
|
+
}, {
|
|
178
|
+
default: xe(() => [
|
|
179
|
+
h(w, {
|
|
180
|
+
disabled: !0,
|
|
181
|
+
class: "text-fm-color-typo-secondary"
|
|
182
|
+
}, {
|
|
183
|
+
default: xe(() => {
|
|
184
|
+
var a;
|
|
185
|
+
return [
|
|
186
|
+
Fe(I((a = e(v).find((n) => n.value === F.id)) == null ? void 0 : a.label), 1)
|
|
187
|
+
];
|
|
188
|
+
}),
|
|
189
|
+
_: 2
|
|
190
|
+
}, 1024)
|
|
191
|
+
]),
|
|
192
|
+
_: 2
|
|
193
|
+
}, 1024)) : (u(), R(M, {
|
|
194
|
+
key: 0,
|
|
195
|
+
modelValue: F.id,
|
|
196
|
+
"onUpdate:modelValue": [(a) => F.id = a, (a) => F.expiredAt = g(a) ?? 1],
|
|
197
|
+
class: "flex-1",
|
|
198
|
+
items: e(v).filter(
|
|
199
|
+
(a) => {
|
|
200
|
+
var n;
|
|
201
|
+
return !((n = e(o).titles) != null && n.map((b) => b.id).includes(a.value)) || F.id === a.value;
|
|
202
|
+
}
|
|
203
|
+
)
|
|
204
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue", "items"])),
|
|
205
|
+
h(s, {
|
|
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
|
+
h(O, {
|
|
216
|
+
class: "w-24 h-24",
|
|
217
|
+
icon: "close",
|
|
218
|
+
variant: "tertiary",
|
|
219
|
+
onClick: (a) => {
|
|
220
|
+
var n;
|
|
221
|
+
return (n = e(o).titles) == null ? void 0 : n.splice(J, 1);
|
|
222
|
+
}
|
|
223
|
+
}, null, 8, ["onClick"])
|
|
224
|
+
]),
|
|
225
|
+
(u(!0), A(q, null, ie(L(`titles.${J}`), (a, n) => (u(), R(E, {
|
|
226
|
+
key: n,
|
|
227
|
+
class: "items-center",
|
|
228
|
+
state: "error",
|
|
229
|
+
text: a.toString()
|
|
230
|
+
}, null, 8, ["text"]))), 128))
|
|
231
|
+
]))), 128)),
|
|
232
|
+
e(v).length && (((z = e(o).titles) == null ? void 0 : z.length) ?? 0) < e(v).length ? (u(), R(O, {
|
|
233
|
+
key: 2,
|
|
234
|
+
icon: "add",
|
|
235
|
+
label: "Give title",
|
|
236
|
+
variant: "plain",
|
|
237
|
+
onClick: f[3] || (f[3] = (F) => {
|
|
238
|
+
var J;
|
|
239
|
+
return e(o).titles = [
|
|
240
|
+
...e(o).titles ?? [],
|
|
241
|
+
{
|
|
242
|
+
id: ((J = e(v).find(
|
|
243
|
+
(a) => {
|
|
244
|
+
var n;
|
|
245
|
+
return !((n = e(o).titles) != null && n.map((b) => b.id).includes(a.value));
|
|
246
|
+
}
|
|
247
|
+
)) == null ? void 0 : J.value) || e(v)[0].value,
|
|
248
|
+
expiredAt: 0
|
|
249
|
+
}
|
|
250
|
+
];
|
|
251
|
+
})
|
|
252
|
+
})) : ce("", !0)
|
|
253
|
+
]),
|
|
254
|
+
t("div", Pt, [
|
|
255
|
+
Re(h(E, {
|
|
256
|
+
state: "warning",
|
|
257
|
+
text: "Updating member will cause tier to change"
|
|
258
|
+
}, null, 512), [
|
|
259
|
+
[Ue, e(m)]
|
|
260
|
+
]),
|
|
261
|
+
h(U),
|
|
262
|
+
h(O, {
|
|
263
|
+
variant: "secondary",
|
|
264
|
+
label: "Cancel",
|
|
265
|
+
size: "md",
|
|
266
|
+
onClick: f[4] || (f[4] = (F) => e(k).close())
|
|
267
|
+
}),
|
|
268
|
+
h(O, {
|
|
269
|
+
disabled: !!e(V),
|
|
270
|
+
variant: "primary",
|
|
271
|
+
label: "Submit",
|
|
272
|
+
size: "md",
|
|
273
|
+
onClick: P
|
|
274
|
+
}, null, 8, ["disabled"])
|
|
275
|
+
])
|
|
276
|
+
], 64);
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
}), Rt = { class: "fm-typo-en-title-sm-800" }, Ut = { class: "space-y-16" }, Lt = { class: "flex flex-nowrap gap-8 items-center justify-end pt-24 w-full" }, zt = /* @__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(), p = y, x = G({
|
|
291
|
+
amount: 1,
|
|
292
|
+
day: 1,
|
|
293
|
+
remark: void 0
|
|
294
|
+
}), r = G(!0), o = H(() => Ae.formattedType(p.type.toUpperCase()));
|
|
295
|
+
function v(m) {
|
|
296
|
+
r.value = m, !m && p.type === "coin" && (x.value.day = void 0);
|
|
297
|
+
}
|
|
298
|
+
async function d() {
|
|
299
|
+
if (p.action === "send") {
|
|
300
|
+
const m = x.value.day ? `, expire in ${x.value.day} days` : "";
|
|
301
|
+
Ye.confirm(
|
|
302
|
+
`Are you sure to send ${x.value.amount} ${o.value.toLowerCase()}${m}? This action cannot be reversed.`
|
|
303
|
+
).then(async (g) => {
|
|
304
|
+
g && await p.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 (m) => {
|
|
310
|
+
m && await p.onSubmit(x.value);
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
const C = H(() => {
|
|
314
|
+
const g = (p.action === "send" ? p.type === "coin" ? bt : yt : p.type === "coin" ? gt : vt).safeParse(x.value);
|
|
315
|
+
return g.success == !1 ? g.error.flatten().fieldErrors : void 0;
|
|
316
|
+
});
|
|
317
|
+
return (m, g) => {
|
|
318
|
+
const V = $("FmStepperField"), D = $("FmSwitch"), L = $("FmTextarea"), P = $("FmButton"), de = $("FmCard");
|
|
319
|
+
return u(), R(de, { class: "flex flex-col gap-16 p-16" }, {
|
|
320
|
+
default: xe(() => {
|
|
321
|
+
var ne, W, se, c, f, M;
|
|
322
|
+
return [
|
|
323
|
+
t("div", Rt, I(p.action == "send" ? "Send" : "Deduct") + " " + I(e(De)[p.type.toUpperCase()].name), 1),
|
|
324
|
+
Fe(" " + I(e(C)) + " ", 1),
|
|
325
|
+
t("div", Ut, [
|
|
326
|
+
h(V, {
|
|
327
|
+
modelValue: e(x).amount,
|
|
328
|
+
"onUpdate:modelValue": g[0] || (g[0] = (s) => e(x).amount = s),
|
|
329
|
+
label: `${e(De)[p.type.toUpperCase()].name} amount`,
|
|
330
|
+
"is-currency": !0,
|
|
331
|
+
"max-fraction-digits": 2,
|
|
332
|
+
"helper-state": (ne = e(C)) != null && ne.amount ? "error" : void 0,
|
|
333
|
+
"helper-text": (se = (W = e(C)) == null ? void 0 : W.amount) == null ? void 0 : se[0]
|
|
334
|
+
}, null, 8, ["modelValue", "label", "helper-state", "helper-text"]),
|
|
335
|
+
y.action === "send" && p.type === "coin" ? (u(), R(D, {
|
|
336
|
+
key: 0,
|
|
337
|
+
"model-value": e(r),
|
|
338
|
+
label: `${e(o)} expires`,
|
|
339
|
+
"label-placement": "right",
|
|
340
|
+
"onUpdate:modelValue": g[1] || (g[1] = (s) => v(s))
|
|
341
|
+
}, null, 8, ["model-value", "label"])) : ce("", !0),
|
|
342
|
+
y.action === "send" && e(r) ? (u(), R(V, {
|
|
343
|
+
key: 1,
|
|
344
|
+
modelValue: e(x).day,
|
|
345
|
+
"onUpdate:modelValue": g[2] || (g[2] = (s) => e(x).day = s),
|
|
346
|
+
label: `${e(o)} expires in`,
|
|
347
|
+
"max-fraction-digits": 0,
|
|
348
|
+
"append-text": "day(s)",
|
|
349
|
+
max: 9999,
|
|
350
|
+
min: 0,
|
|
351
|
+
"helper-state": (c = e(C)) != null && c.day ? "error" : void 0,
|
|
352
|
+
"helper-text": (M = (f = e(C)) == null ? void 0 : f.day) == null ? void 0 : M[0]
|
|
353
|
+
}, null, 8, ["modelValue", "label", "helper-state", "helper-text"])) : ce("", !0),
|
|
354
|
+
h(L, {
|
|
355
|
+
modelValue: e(x).remark,
|
|
356
|
+
"onUpdate:modelValue": g[3] || (g[3] = (s) => e(x).remark = s),
|
|
357
|
+
label: "Remark"
|
|
358
|
+
}, null, 8, ["modelValue"])
|
|
359
|
+
]),
|
|
360
|
+
t("div", Lt, [
|
|
361
|
+
h(P, {
|
|
362
|
+
variant: "secondary",
|
|
363
|
+
label: "Cancel",
|
|
364
|
+
size: "md",
|
|
365
|
+
onClick: g[4] || (g[4] = (s) => e(k).close())
|
|
366
|
+
}),
|
|
367
|
+
h(P, {
|
|
368
|
+
disabled: !!e(C),
|
|
369
|
+
variant: "primary",
|
|
370
|
+
label: "Submit",
|
|
371
|
+
size: "md",
|
|
372
|
+
onClick: g[5] || (g[5] = async () => d())
|
|
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 p = await mt.readAll({
|
|
385
|
+
limit: 1e3,
|
|
386
|
+
skip: 0,
|
|
387
|
+
sortBy: "_id",
|
|
388
|
+
descending: !0
|
|
389
|
+
});
|
|
390
|
+
y.value = p.resources;
|
|
391
|
+
}
|
|
392
|
+
return {
|
|
393
|
+
segments: y,
|
|
394
|
+
read: k
|
|
395
|
+
};
|
|
396
|
+
});
|
|
397
|
+
class jt extends ht {
|
|
398
|
+
}
|
|
399
|
+
const qt = { class: "border border-fm-color-neutral-gray-100 rounded-lg p-16" }, Kt = { class: "hidden xs:flex items-center justify-end" }, Gt = { class: "flex items-center justify-between mb-4" }, Ht = { class: "flex items-center justify-between gap-x-8" }, Wt = { 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" }, Xt = { 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, p = G({
|
|
429
|
+
search: ""
|
|
430
|
+
}), x = G(!1), { tableMeta: r, rowData: o, onSort: v, debouncedFetchData: d, onSearch: C } = Ke(async (g) => {
|
|
431
|
+
const V = {
|
|
432
|
+
...p.value,
|
|
433
|
+
...k.filters
|
|
434
|
+
};
|
|
435
|
+
return await Me.readCollectionsByMemberId(
|
|
436
|
+
k.member._id.toString(),
|
|
437
|
+
g,
|
|
438
|
+
V
|
|
439
|
+
);
|
|
440
|
+
});
|
|
441
|
+
Le(
|
|
442
|
+
p,
|
|
443
|
+
() => {
|
|
444
|
+
d();
|
|
445
|
+
},
|
|
446
|
+
{ deep: !0 }
|
|
447
|
+
);
|
|
448
|
+
async function m() {
|
|
449
|
+
try {
|
|
450
|
+
x.value = !0;
|
|
451
|
+
const g = {
|
|
452
|
+
...p.value,
|
|
453
|
+
...k.filters
|
|
454
|
+
};
|
|
455
|
+
await St({
|
|
456
|
+
exporter: new jt(),
|
|
457
|
+
readFunction: (V) => Me.readCollectionsByMemberId(
|
|
458
|
+
k.member._id.toString(),
|
|
459
|
+
V,
|
|
460
|
+
g
|
|
461
|
+
),
|
|
462
|
+
transformRecord: k.transformExportRecord,
|
|
463
|
+
filename: `${k.member._id.toString()}-${k.title.replace(" ", "-").toLowerCase()}`
|
|
464
|
+
});
|
|
465
|
+
} catch (g) {
|
|
466
|
+
console.error(g);
|
|
467
|
+
} finally {
|
|
468
|
+
x.value = !1;
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
return st(async () => {
|
|
472
|
+
await d();
|
|
473
|
+
}), (g, V) => {
|
|
474
|
+
const D = $("FmSearch"), L = $("FmButton");
|
|
475
|
+
return u(), A("div", qt, [
|
|
476
|
+
t("div", Kt, [
|
|
477
|
+
h(D, {
|
|
478
|
+
class: "hidden xs:flex",
|
|
479
|
+
modelValue: e(p).search,
|
|
480
|
+
"onUpdate:modelValue": [
|
|
481
|
+
V[0] || (V[0] = (P) => e(p).search = P),
|
|
482
|
+
e(C)
|
|
483
|
+
],
|
|
484
|
+
placeholder: "Search",
|
|
485
|
+
collapsible: ""
|
|
486
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue"]),
|
|
487
|
+
y.withExport ? (u(), R(L, {
|
|
488
|
+
key: 0,
|
|
489
|
+
icon: "ios_share",
|
|
490
|
+
variant: "tertiary",
|
|
491
|
+
onClick: m
|
|
492
|
+
})) : ce("", !0)
|
|
493
|
+
]),
|
|
494
|
+
t("div", Gt, [
|
|
495
|
+
t("div", Ht, [
|
|
496
|
+
t("div", Wt, I(k.title), 1),
|
|
497
|
+
t("div", Jt, I(e(r).totalRows), 1)
|
|
498
|
+
]),
|
|
499
|
+
t("div", Xt, [
|
|
500
|
+
h(D, {
|
|
501
|
+
modelValue: e(p).search,
|
|
502
|
+
"onUpdate:modelValue": [
|
|
503
|
+
V[1] || (V[1] = (P) => e(p).search = P),
|
|
504
|
+
e(C)
|
|
505
|
+
],
|
|
506
|
+
placeholder: "Search"
|
|
507
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue"]),
|
|
508
|
+
y.withExport ? (u(), R(L, {
|
|
509
|
+
key: 0,
|
|
510
|
+
icon: "ios_share",
|
|
511
|
+
variant: "tertiary",
|
|
512
|
+
onClick: m
|
|
513
|
+
})) : ce("", !0)
|
|
514
|
+
])
|
|
515
|
+
]),
|
|
516
|
+
h(Ge, {
|
|
517
|
+
loading: e(r).isLoading,
|
|
518
|
+
"row-data": e(o),
|
|
519
|
+
"row-count": e(r).totalRows,
|
|
520
|
+
"column-defs": y.columns,
|
|
521
|
+
"page-count": e(r).pageCount,
|
|
522
|
+
"page-index": e(r).pageIndex,
|
|
523
|
+
"page-size": e(r).pageSize,
|
|
524
|
+
"shrink-at": !1,
|
|
525
|
+
onSortChange: e(v),
|
|
526
|
+
onPageChange: V[2] || (V[2] = (P) => e(d)({
|
|
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
|
+
}), Qt = /* @__PURE__ */ t("div", { class: "fm-typo-en-title-sm-600 mb-16" }, "Voucher Collections", -1), Zt = /* @__PURE__ */ be({
|
|
535
|
+
__name: "MemberVouchers",
|
|
536
|
+
props: {
|
|
537
|
+
member: {
|
|
538
|
+
type: Object,
|
|
539
|
+
required: !0
|
|
540
|
+
}
|
|
541
|
+
},
|
|
542
|
+
setup(y) {
|
|
543
|
+
const k = y, p = [
|
|
544
|
+
{
|
|
545
|
+
header: "Voucher title",
|
|
546
|
+
meta: {
|
|
547
|
+
maxWidth: "300px"
|
|
548
|
+
},
|
|
549
|
+
cell(o) {
|
|
550
|
+
var v;
|
|
551
|
+
return K(
|
|
552
|
+
"div",
|
|
553
|
+
{ class: "text-ellipsis truncate" },
|
|
554
|
+
((v = o.row.original.pf_collectible) == null ? void 0 : v.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 d, C, m, g;
|
|
569
|
+
const v = (C = (d = o.row.original.expiryBalance) == null ? void 0 : d[0]) != null && C.expiredAt ? S((g = (m = o.row.original.expiryBalance) == null ? void 0 : m[0]) == null ? void 0 : g.expiredAt).format(
|
|
570
|
+
"D MMM YYYY"
|
|
571
|
+
) : "-";
|
|
572
|
+
return K("div", {}, v);
|
|
573
|
+
},
|
|
574
|
+
enableSorting: !0
|
|
575
|
+
},
|
|
576
|
+
{
|
|
577
|
+
header: "Transfer open",
|
|
578
|
+
accessorFn: (o) => {
|
|
579
|
+
var v, d, C;
|
|
580
|
+
return _t((C = (d = (v = o.pf_collectible) == null ? void 0 : v.options) == null ? void 0 : d.enableTransfer) == null ? void 0 : C.toString());
|
|
581
|
+
},
|
|
582
|
+
enableSorting: !1
|
|
583
|
+
}
|
|
584
|
+
], x = (o) => ({
|
|
585
|
+
type: ke.enum.VOUCHER,
|
|
586
|
+
isActive: o
|
|
587
|
+
}), r = (o) => {
|
|
588
|
+
var v, d, C, m, g, V, D;
|
|
589
|
+
return {
|
|
590
|
+
CollectionID: o._id,
|
|
591
|
+
Title: (v = o.pf_collectible) == null ? void 0 : v.name,
|
|
592
|
+
ClaimedAt: S(Ce(o._id.toString())).format(
|
|
593
|
+
"D MMM YYYY, hh:mmA"
|
|
594
|
+
),
|
|
595
|
+
ExpiredAt: (C = (d = o.expiryBalance) == null ? void 0 : d[0]) != null && C.expiredAt ? S((g = (m = o.expiryBalance) == null ? void 0 : m[0]) == null ? void 0 : g.expiredAt).format("D MMM YYYY") : "",
|
|
596
|
+
TransferOpen: ((D = (V = o.pf_collectible) == null ? void 0 : V.options) == null ? void 0 : D.enableTransfer) || !1
|
|
597
|
+
};
|
|
598
|
+
};
|
|
599
|
+
return (o, v) => (u(), A(q, null, [
|
|
600
|
+
Qt,
|
|
601
|
+
h(Te, {
|
|
602
|
+
member: k.member,
|
|
603
|
+
columns: p,
|
|
604
|
+
title: "Active voucher",
|
|
605
|
+
filters: x(!0),
|
|
606
|
+
withExport: !0,
|
|
607
|
+
transformExportRecord: r
|
|
608
|
+
}, null, 8, ["member", "filters"]),
|
|
609
|
+
h(Te, {
|
|
610
|
+
member: k.member,
|
|
611
|
+
columns: p,
|
|
612
|
+
title: "Past voucher",
|
|
613
|
+
filters: x(!1),
|
|
614
|
+
withExport: !0,
|
|
615
|
+
transformExportRecord: r
|
|
616
|
+
}, null, 8, ["member", "filters"])
|
|
617
|
+
], 64));
|
|
618
|
+
}
|
|
619
|
+
}), eo = /* @__PURE__ */ t("div", { class: "fm-typo-en-title-sm-600 mb-16" }, "Mission", -1), to = /* @__PURE__ */ be({
|
|
620
|
+
__name: "MemberMissions",
|
|
621
|
+
props: {
|
|
622
|
+
member: {
|
|
623
|
+
type: Object,
|
|
624
|
+
required: !0
|
|
625
|
+
}
|
|
626
|
+
},
|
|
627
|
+
setup(y) {
|
|
628
|
+
const k = y, p = [
|
|
629
|
+
{
|
|
630
|
+
header: "Mission title",
|
|
631
|
+
meta: {
|
|
632
|
+
maxWidth: "300px"
|
|
633
|
+
},
|
|
634
|
+
cell(r) {
|
|
635
|
+
var o;
|
|
636
|
+
return K(
|
|
637
|
+
"div",
|
|
638
|
+
{ class: "text-ellipsis truncate" },
|
|
639
|
+
((o = r.row.original.pf_campaign) == null ? void 0 : o.name) || "Deleted Campaign"
|
|
640
|
+
);
|
|
641
|
+
},
|
|
642
|
+
enableSorting: !1
|
|
643
|
+
},
|
|
644
|
+
{
|
|
645
|
+
header: "Type",
|
|
646
|
+
accessorFn: (r) => {
|
|
647
|
+
var o, v, d;
|
|
648
|
+
return Pe.title(((d = (v = (o = r == null ? void 0 : r.pf_collectible) == null ? void 0 : o.extras) == null ? void 0 : v.mission) == null ? void 0 : d.type) || "-");
|
|
649
|
+
},
|
|
650
|
+
enableSorting: !1
|
|
651
|
+
},
|
|
652
|
+
{
|
|
653
|
+
header: "Status",
|
|
654
|
+
cell(r) {
|
|
655
|
+
if (r.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
|
+
}, v = Ct(
|
|
662
|
+
r.row.original.pf_campaign
|
|
663
|
+
), C = r.row.original.balance === r.row.original.pf_collectible.extras.mission.end && v === "active" ? "completed" : v;
|
|
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: (r) => r != null && r.pf_campaign ? wt(r.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: (r) => {
|
|
691
|
+
var o, v, d;
|
|
692
|
+
return ((d = (v = (o = r == null ? void 0 : r.pf_collectible) == null ? void 0 : o.extras) == null ? void 0 : v.mission) == null ? void 0 : d.end) ?? 0;
|
|
693
|
+
},
|
|
694
|
+
enableSorting: !1
|
|
695
|
+
}
|
|
696
|
+
], x = {
|
|
697
|
+
type: ke.enum.STAMP
|
|
698
|
+
};
|
|
699
|
+
return (r, o) => (u(), A(q, null, [
|
|
700
|
+
eo,
|
|
701
|
+
h(Te, {
|
|
702
|
+
member: k.member,
|
|
703
|
+
columns: p,
|
|
704
|
+
title: "Mission",
|
|
705
|
+
filters: x
|
|
706
|
+
}, null, 8, ["member"])
|
|
707
|
+
], 64));
|
|
708
|
+
}
|
|
709
|
+
}), oo = /* @__PURE__ */ t("div", { class: "fm-typo-en-title-sm-600 mb-16" }, "Game program", -1), ao = /* @__PURE__ */ be({
|
|
710
|
+
__name: "MemberGames",
|
|
711
|
+
props: {
|
|
712
|
+
member: {
|
|
713
|
+
type: Object,
|
|
714
|
+
required: !0
|
|
715
|
+
}
|
|
716
|
+
},
|
|
717
|
+
setup(y) {
|
|
718
|
+
const k = y, p = [
|
|
719
|
+
{
|
|
720
|
+
header: "Game title",
|
|
721
|
+
meta: {
|
|
722
|
+
maxWidth: "300px"
|
|
723
|
+
},
|
|
724
|
+
cell(r) {
|
|
725
|
+
var o;
|
|
726
|
+
return K(
|
|
727
|
+
"div",
|
|
728
|
+
{ class: "text-ellipsis truncate" },
|
|
729
|
+
((o = r.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: (r) => S(Ce(r._id.toString())).format("D MMM YYYY"),
|
|
738
|
+
enableSorting: !1
|
|
739
|
+
},
|
|
740
|
+
{
|
|
741
|
+
header: "Expired at",
|
|
742
|
+
cell(r) {
|
|
743
|
+
var v, d, C, m;
|
|
744
|
+
const o = (d = (v = r.row.original.expiryBalance) == null ? void 0 : v[0]) != null && d.expiredAt ? S((m = (C = r.row.original.expiryBalance) == null ? void 0 : C[0]) == null ? void 0 : m.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 = (r) => ({
|
|
757
|
+
type: ke.enum.GAME,
|
|
758
|
+
isActive: r
|
|
759
|
+
});
|
|
760
|
+
return (r, o) => (u(), A(q, null, [
|
|
761
|
+
oo,
|
|
762
|
+
h(Te, {
|
|
763
|
+
member: k.member,
|
|
764
|
+
columns: p,
|
|
765
|
+
title: "Active game token",
|
|
766
|
+
filters: x(!0)
|
|
767
|
+
}, null, 8, ["member", "filters"])
|
|
768
|
+
], 64));
|
|
769
|
+
}
|
|
770
|
+
}), no = { class: "flex flex-col flex-nowrap gap-y-24 max-h-full" }, so = { class: "grid md:grid-cols-2 lg:grid-cols-2 gap-x-36 gap-y-24" }, ro = /* @__PURE__ */ t("div", { class: "fm-typo-en-title-sm-800 mb-16" }, "Profile Information", -1), io = { class: "space-y-16" }, lo = { class: "flex gap-16 items-center" }, co = { class: "flex-auto" }, mo = /* @__PURE__ */ t("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " Member Name ", -1), uo = { class: "fm-typo-en-body-md-600" }, po = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, fo = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, bo = { class: "fm-typo-en-body-md-800" }, yo = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, go = { class: "fm-typo-en-body-md-600" }, vo = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, xo = { class: "fm-typo-en-body-md-800" }, _o = /* @__PURE__ */ t("div", { class: "fm-typo-en-title-sm-800 mb-16" }, "Activities", -1), ho = { class: "gap-16 grid grid-cols-1" }, So = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Co = { class: "fm-typo-en-body-md-600" }, wo = /* @__PURE__ */ t("div", { class: "border-fm-color-neutral-gray-100 rounded-sm border-t" }, null, -1), Fo = { 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" }, Mo = { class: "flex justify-between mb-16" }, To = { class: "fm-typo-en-title-sm-600" }, ko = ["onClick"], Ao = { class: "flex flex-col gap-y-16" }, Eo = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, $o = { class: "fm-typo-en-body-md-600" }, Vo = { class: "space-y-8" }, Io = /* @__PURE__ */ t("div", { class: "fm-typo-en-title-sm-800" }, "Segments", -1), Bo = {
|
|
771
|
+
key: 0,
|
|
772
|
+
class: "space-x-8"
|
|
773
|
+
}, Do = {
|
|
774
|
+
key: 1,
|
|
775
|
+
class: "text-fm-color-typo-secondary"
|
|
776
|
+
}, No = /* @__PURE__ */ t("div", { class: "border-fm-color-neutral-gray-100 rounded-sm border-t" }, null, -1), Yo = { class: "space-y-8" }, Po = /* @__PURE__ */ t("div", { class: "fm-typo-en-title-sm-800" }, "Title badge", -1), Oo = ["src"], Ro = { class: "fm-typo-en-body-md-600" }, Uo = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Lo = {
|
|
777
|
+
key: 1,
|
|
778
|
+
class: "text-fm-color-typo-secondary"
|
|
779
|
+
}, zo = {
|
|
780
|
+
key: 1,
|
|
781
|
+
class: "space-y-24"
|
|
782
|
+
}, jo = { class: "space-y-8" }, qo = /* @__PURE__ */ t("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " Credit ", -1), Ko = { class: "fm-typo-en-title-md-800" }, Go = { class: "space-y-4" }, Ho = /* @__PURE__ */ t("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " Credit(s) to be expired in 30 days ", -1), Wo = { class: "fm-typo-en-body-md-600" }, Jo = { class: "flex gap-24 items-center xs:flex-col xs:items-start" }, Xo = { class: "space-y-8" }, Qo = /* @__PURE__ */ t("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " Point ", -1), Zo = { class: "fm-typo-en-title-md-800" }, ea = { class: "space-y-4" }, ta = /* @__PURE__ */ t("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " Point(s) to be expired in 30 days ", -1), oa = { class: "fm-typo-en-body-md-600" }, aa = { class: "flex gap-24 items-center xs:flex-col xs:items-start" }, na = /* @__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: p }) {
|
|
792
|
+
const x = He(), r = $e(), o = qe(), v = Je(), d = Ee(), { minor: C } = je, m = y, g = p, V = H(() => o.locations.map((a) => ({
|
|
793
|
+
label: a.name,
|
|
794
|
+
value: a._id
|
|
795
|
+
}))), D = H(() => (m.member.segment || []).map((a) => {
|
|
796
|
+
var n;
|
|
797
|
+
return ((n = v.segments.find((b) => b._id === a)) == null ? void 0 : n.name) || "";
|
|
798
|
+
}).filter(Boolean)), L = [
|
|
799
|
+
{
|
|
800
|
+
label: "Loyalty",
|
|
801
|
+
stats: [
|
|
802
|
+
{
|
|
803
|
+
label: "Experiences",
|
|
804
|
+
getter: (a) => {
|
|
805
|
+
var n, b, B;
|
|
806
|
+
return ee(((B = (b = (n = a.collection) == null ? void 0 : n.POINT) == null ? void 0 : b[0]) == null ? void 0 : B.balance) ?? 0, 2);
|
|
807
|
+
}
|
|
808
|
+
},
|
|
809
|
+
{
|
|
810
|
+
label: "Credits",
|
|
811
|
+
getter: (a) => {
|
|
812
|
+
var n, b, B;
|
|
813
|
+
return ee(((B = (b = (n = a.collection) == null ? void 0 : n.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 n, b;
|
|
851
|
+
return ee(
|
|
852
|
+
((b = (n = a.collection) == null ? void 0 : n.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 n = [];
|
|
873
|
+
for (let b = 0; b < L.length; b += 3)
|
|
874
|
+
n.push(L.slice(b, b + 3));
|
|
875
|
+
return n;
|
|
876
|
+
})();
|
|
877
|
+
async function ne(a, n) {
|
|
878
|
+
switch (a.stopPropagation(), n) {
|
|
879
|
+
case "Store bundle":
|
|
880
|
+
await x.push({
|
|
881
|
+
name: We["$connect-LOYALTY_MEMBER_TRANSACTIONS"],
|
|
882
|
+
params: { id: m.member._id.toString() },
|
|
883
|
+
query: { tab: "store" }
|
|
884
|
+
});
|
|
885
|
+
break;
|
|
886
|
+
default:
|
|
887
|
+
F.value = z.find((b) => b.label === n) || z[0];
|
|
888
|
+
break;
|
|
889
|
+
}
|
|
890
|
+
}
|
|
891
|
+
async function W(a, n) {
|
|
892
|
+
d.open({
|
|
893
|
+
title: "",
|
|
894
|
+
dialogComponent: zt,
|
|
895
|
+
dialogComponentProps: {
|
|
896
|
+
type: a,
|
|
897
|
+
action: n,
|
|
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}-${n}`, X = B[N];
|
|
907
|
+
X && await X(m.member._id, b), g("update:member"), d.close();
|
|
908
|
+
},
|
|
909
|
+
{
|
|
910
|
+
message: `Adjusting ${Ae.formattedType(
|
|
911
|
+
a.toUpperCase()
|
|
912
|
+
).toLowerCase()}`,
|
|
913
|
+
successMessage: `${b.amount} ${Ae.formattedType(
|
|
914
|
+
a.toUpperCase()
|
|
915
|
+
).toLowerCase()} ${n} ${n == "send" ? "to" : "from"} ${m.member.phoneNumber}`
|
|
916
|
+
}
|
|
917
|
+
);
|
|
918
|
+
}
|
|
919
|
+
}
|
|
920
|
+
});
|
|
921
|
+
}
|
|
922
|
+
async function se() {
|
|
923
|
+
d.open({
|
|
924
|
+
title: "Update member statistics",
|
|
925
|
+
contentComponent: Ot,
|
|
926
|
+
contentComponentProps: {
|
|
927
|
+
member: m.member,
|
|
928
|
+
onSubmit: async (a) => {
|
|
929
|
+
await C(
|
|
930
|
+
async () => {
|
|
931
|
+
await le.updateMember(m.member._id, a), g("update:member"), d.close();
|
|
932
|
+
},
|
|
933
|
+
{
|
|
934
|
+
message: "Updating member stats",
|
|
935
|
+
successMessage: `Updated member ${m.member.phoneNumber} stats successfully`
|
|
936
|
+
}
|
|
937
|
+
);
|
|
938
|
+
}
|
|
939
|
+
}
|
|
940
|
+
});
|
|
941
|
+
}
|
|
942
|
+
const c = [
|
|
943
|
+
{
|
|
944
|
+
label: "Mobile No.",
|
|
945
|
+
key: "phoneNumber"
|
|
946
|
+
},
|
|
947
|
+
{
|
|
948
|
+
label: "Tier",
|
|
949
|
+
getter: (a) => {
|
|
950
|
+
var re, me, ye, _, Y;
|
|
951
|
+
const n = (((me = Ne.first((re = m.member.collection) == null ? void 0 : re.TIER)) == null ? void 0 : me.balance) || 0) - 1, b = M.value.name, B = ((_ = (ye = a.collection) == null ? void 0 : ye.POINT) == null ? void 0 : _[0].balance) ?? 0, N = r.sortedTiers[n + 1], X = ((Y = N == null ? void 0 : N.option) == null ? void 0 : Y.to) ?? 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
|
+
], f = [
|
|
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 n;
|
|
972
|
+
return a != null && a.location && ((n = V.value.find((b) => b.value == a.location)) == null ? void 0 : n.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 = m.member.collection) == null ? void 0 : b.TIER)) == null ? void 0 : B.balance) || 0) - 1, n = r.sortedTiers[a];
|
|
1011
|
+
return { name: (n == null ? void 0 : n.name) || "-", tier: a, config: n };
|
|
1012
|
+
}), s = H(() => {
|
|
1013
|
+
var a;
|
|
1014
|
+
return (((a = m.member.collection) == null ? void 0 : a.TITLE) || []).map((n) => {
|
|
1015
|
+
var B, N, X;
|
|
1016
|
+
const b = (B = r.sortedTitles) == null ? void 0 : B.find(
|
|
1017
|
+
(re) => re._id == n.collectible
|
|
1018
|
+
);
|
|
1019
|
+
return {
|
|
1020
|
+
name: b == null ? void 0 : b.name,
|
|
1021
|
+
expiredAt: (X = (N = n.expiryBalance) == null ? void 0 : N.at(-1)) == null ? void 0 : X.expiredAt,
|
|
1022
|
+
collectible: b
|
|
1023
|
+
};
|
|
1024
|
+
}).filter(
|
|
1025
|
+
(n) => n.expiredAt ? S(n.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, n) => a + n.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
|
+
m.member._id.toString(),
|
|
1060
|
+
ke.enum.VOUCHER
|
|
1061
|
+
), T.value = await Ft.readPurchaseCountByMember(
|
|
1062
|
+
m.member._id.toString()
|
|
1063
|
+
), i.value = await Me.readMissionCountByMemberId(
|
|
1064
|
+
m.member._id.toString()
|
|
1065
|
+
);
|
|
1066
|
+
};
|
|
1067
|
+
return ze(async () => {
|
|
1068
|
+
await r.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, n) => {
|
|
1075
|
+
const b = $("FmTabs"), B = $("FmAvatar"), N = $("FmButton"), X = $("FmIcon"), re = $("FmChip"), me = $("FmCard"), ye = $("FmSideSheet");
|
|
1076
|
+
return u(), R(ye, {
|
|
1077
|
+
modelValue: e(E),
|
|
1078
|
+
"onUpdate:modelValue": n[5] || (n[5] = (_) => rt(E) ? E.value = _ : null),
|
|
1079
|
+
header: "Member Detail",
|
|
1080
|
+
"dismiss-away": "",
|
|
1081
|
+
"close-button": !0,
|
|
1082
|
+
"max-width": 1100
|
|
1083
|
+
}, {
|
|
1084
|
+
"side-sheet-footer": xe(() => []),
|
|
1085
|
+
default: xe(() => [
|
|
1086
|
+
t("div", no, [
|
|
1087
|
+
t("div", null, [
|
|
1088
|
+
h(b, {
|
|
1089
|
+
"model-value": e(F).value,
|
|
1090
|
+
items: z,
|
|
1091
|
+
class: "overflow-x-auto",
|
|
1092
|
+
"onUpdate:modelValue": n[0] || (n[0] = (_) => F.value = z.find((Y) => Y.value === _))
|
|
1093
|
+
}, null, 8, ["model-value"])
|
|
1094
|
+
]),
|
|
1095
|
+
e(F).value == "overview" ? (u(), A(q, { key: 0 }, [
|
|
1096
|
+
t("div", so, [
|
|
1097
|
+
t("div", null, [
|
|
1098
|
+
ro,
|
|
1099
|
+
t("div", io, [
|
|
1100
|
+
t("div", lo, [
|
|
1101
|
+
h(B, {
|
|
1102
|
+
name: y.member.photoUrl ? void 0 : y.member.name,
|
|
1103
|
+
src: y.member.photoUrl || void 0
|
|
1104
|
+
}, null, 8, ["name", "src"]),
|
|
1105
|
+
t("div", co, [
|
|
1106
|
+
mo,
|
|
1107
|
+
t("div", uo, I(y.member.name), 1),
|
|
1108
|
+
t("div", po, I(y.member._id), 1),
|
|
1109
|
+
t("div", fo, [
|
|
1110
|
+
Fe(" Member Card: "),
|
|
1111
|
+
t("span", bo, I(y.member.cardNo ? y.member.cardNo : "-"), 1)
|
|
1112
|
+
])
|
|
1113
|
+
]),
|
|
1114
|
+
h(N, {
|
|
1115
|
+
variant: "tertiary",
|
|
1116
|
+
icon: "settings",
|
|
1117
|
+
onClick: se
|
|
1118
|
+
})
|
|
1119
|
+
]),
|
|
1120
|
+
(u(), A(q, null, ie(c, (_, Y) => t("div", { key: Y }, [
|
|
1121
|
+
t("div", yo, I(_.label), 1),
|
|
1122
|
+
t("div", go, I(_.key ? y.member[_.key] : _.getter(y.member)), 1)
|
|
1123
|
+
])), 64)),
|
|
1124
|
+
t("div", vo, [
|
|
1125
|
+
Fe(" Referral Code: "),
|
|
1126
|
+
t("span", xo, I(y.member.referralCode ? y.member.referralCode : "-"), 1)
|
|
1127
|
+
])
|
|
1128
|
+
])
|
|
1129
|
+
]),
|
|
1130
|
+
t("div", null, [
|
|
1131
|
+
_o,
|
|
1132
|
+
t("div", ho, [
|
|
1133
|
+
(u(), A(q, null, ie(f, (_) => t("div", {
|
|
1134
|
+
key: _.key
|
|
1135
|
+
}, [
|
|
1136
|
+
t("div", So, I(_.label), 1),
|
|
1137
|
+
t("div", Co, I(_.key ? m.member.stats[_.key] || "-" : _.getter(y.member)), 1)
|
|
1138
|
+
])), 64))
|
|
1139
|
+
])
|
|
1140
|
+
])
|
|
1141
|
+
]),
|
|
1142
|
+
wo,
|
|
1143
|
+
(u(!0), A(q, null, ie(e(de), (_) => (u(), A("div", Fo, [
|
|
1144
|
+
(u(!0), A(q, null, ie(_, (Y, oe) => (u(), A("div", { key: oe }, [
|
|
1145
|
+
t("div", {
|
|
1146
|
+
class: it(oe !== 0 ? "pt-12 md:pt-0 lg:pt-0 md:pl-12 lg:pl-12" : "")
|
|
1147
|
+
}, [
|
|
1148
|
+
t("div", Mo, [
|
|
1149
|
+
t("div", To, I(Y.label), 1),
|
|
1150
|
+
t("button", {
|
|
1151
|
+
onClick: (j) => ne(j, Y.label)
|
|
1152
|
+
}, [
|
|
1153
|
+
h(X, {
|
|
1154
|
+
name: "chevron_right",
|
|
1155
|
+
outline: "",
|
|
1156
|
+
size: "md"
|
|
1157
|
+
})
|
|
1158
|
+
], 8, ko)
|
|
1159
|
+
]),
|
|
1160
|
+
t("div", Ao, [
|
|
1161
|
+
(u(!0), A(q, null, ie(Y.stats, (j) => (u(), A("div", {
|
|
1162
|
+
key: j.key
|
|
1163
|
+
}, [
|
|
1164
|
+
t("div", Eo, I(j.label), 1),
|
|
1165
|
+
t("div", $o, I(j.getter(y.member)), 1)
|
|
1166
|
+
]))), 128))
|
|
1167
|
+
])
|
|
1168
|
+
], 2)
|
|
1169
|
+
]))), 128))
|
|
1170
|
+
]))), 256)),
|
|
1171
|
+
t("div", Vo, [
|
|
1172
|
+
Io,
|
|
1173
|
+
e(D).length ? (u(), A("div", Bo, [
|
|
1174
|
+
(u(!0), A(q, null, ie(e(D), (_) => (u(), R(re, {
|
|
1175
|
+
label: _.toString()
|
|
1176
|
+
}, null, 8, ["label"]))), 256))
|
|
1177
|
+
])) : (u(), A("div", Do, "No titles"))
|
|
1178
|
+
]),
|
|
1179
|
+
No,
|
|
1180
|
+
t("div", Yo, [
|
|
1181
|
+
Po,
|
|
1182
|
+
e(s).length ? (u(!0), A(q, { key: 0 }, ie(e(s).filter((_) => _.collectible), (_) => (u(), A("div", {
|
|
1183
|
+
class: "flex items-center gap-x-8 h-48",
|
|
1184
|
+
key: _.name
|
|
1185
|
+
}, [
|
|
1186
|
+
t("img", {
|
|
1187
|
+
src: _.collectible.image || e(pt),
|
|
1188
|
+
class: "aspect-square h-full object-contain"
|
|
1189
|
+
}, null, 8, Oo),
|
|
1190
|
+
t("div", null, [
|
|
1191
|
+
t("div", Ro, I(_.name), 1),
|
|
1192
|
+
t("div", Uo, " Expired on " + I(e(S)(_.expiredAt).format("MMM D, Y")), 1)
|
|
1193
|
+
])
|
|
1194
|
+
]))), 128)) : (u(), A("div", Lo, "No titles"))
|
|
1195
|
+
])
|
|
1196
|
+
], 64)) : e(F).value == "loyalty" ? (u(), A("div", zo, [
|
|
1197
|
+
h(me, {
|
|
1198
|
+
class: "p-16 space-y-24",
|
|
1199
|
+
variant: "outlined"
|
|
1200
|
+
}, {
|
|
1201
|
+
default: xe(() => {
|
|
1202
|
+
var _, Y, oe, j, ue, pe, fe;
|
|
1203
|
+
return [
|
|
1204
|
+
t("div", jo, [
|
|
1205
|
+
qo,
|
|
1206
|
+
t("div", Ko, I(((oe = (Y = (_ = y.member.collection) == null ? void 0 : _.CREDIT) == null ? void 0 : Y[0]) == null ? void 0 : oe.balance) ?? 0), 1)
|
|
1207
|
+
]),
|
|
1208
|
+
t("div", Go, [
|
|
1209
|
+
Ho,
|
|
1210
|
+
t("div", Wo, I(((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 && e(S)(Z.expiredAt).isAfter(e(S)()) && e(S)(Z.expiredAt).isBefore(e(S)().add(30, "days")) ? Q + Z.amount : Q,
|
|
1212
|
+
0
|
|
1213
|
+
)) ?? 0), 1)
|
|
1214
|
+
]),
|
|
1215
|
+
t("div", Jo, [
|
|
1216
|
+
h(N, {
|
|
1217
|
+
label: "Add credit",
|
|
1218
|
+
icon: "add",
|
|
1219
|
+
variant: "plain",
|
|
1220
|
+
onClick: n[1] || (n[1] = (Q) => W("credit", "send"))
|
|
1221
|
+
}),
|
|
1222
|
+
h(N, {
|
|
1223
|
+
label: "Deduct credit",
|
|
1224
|
+
icon: "remove",
|
|
1225
|
+
variant: "plain",
|
|
1226
|
+
onClick: n[2] || (n[2] = (Q) => W("credit", "deduct"))
|
|
1227
|
+
})
|
|
1228
|
+
])
|
|
1229
|
+
];
|
|
1230
|
+
}),
|
|
1231
|
+
_: 1
|
|
1232
|
+
}),
|
|
1233
|
+
h(me, {
|
|
1234
|
+
class: "p-16 space-y-24",
|
|
1235
|
+
variant: "outlined"
|
|
1236
|
+
}, {
|
|
1237
|
+
default: xe(() => {
|
|
1238
|
+
var _, Y, oe, j, ue, pe, fe;
|
|
1239
|
+
return [
|
|
1240
|
+
t("div", Xo, [
|
|
1241
|
+
Qo,
|
|
1242
|
+
t("div", Zo, I(((oe = (Y = (_ = y.member.collection) == null ? void 0 : _.COIN) == null ? void 0 : Y[0]) == null ? void 0 : oe.balance) ?? 0), 1)
|
|
1243
|
+
]),
|
|
1244
|
+
t("div", ea, [
|
|
1245
|
+
ta,
|
|
1246
|
+
t("div", oa, I(((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 && e(S)(Z.expiredAt).isAfter(e(S)()) && e(S)(Z.expiredAt).isBefore(e(S)().add(30, "days")) ? Q + Z.amount : Q,
|
|
1248
|
+
0
|
|
1249
|
+
)) ?? 0), 1)
|
|
1250
|
+
]),
|
|
1251
|
+
t("div", aa, [
|
|
1252
|
+
h(N, {
|
|
1253
|
+
label: "Add point",
|
|
1254
|
+
icon: "add",
|
|
1255
|
+
variant: "plain",
|
|
1256
|
+
onClick: n[3] || (n[3] = (Q) => W("coin", "send"))
|
|
1257
|
+
}),
|
|
1258
|
+
h(N, {
|
|
1259
|
+
label: "Deduct point",
|
|
1260
|
+
icon: "remove",
|
|
1261
|
+
variant: "plain",
|
|
1262
|
+
onClick: n[4] || (n[4] = (Q) => W("coin", "deduct"))
|
|
1263
|
+
})
|
|
1264
|
+
])
|
|
1265
|
+
];
|
|
1266
|
+
}),
|
|
1267
|
+
_: 1
|
|
1268
|
+
})
|
|
1269
|
+
])) : e(F).value == "voucher" ? (u(), R(Zt, {
|
|
1270
|
+
key: 2,
|
|
1271
|
+
member: m.member
|
|
1272
|
+
}, null, 8, ["member"])) : e(F).value == "mission" ? (u(), R(to, {
|
|
1273
|
+
key: 3,
|
|
1274
|
+
member: m.member
|
|
1275
|
+
}, null, 8, ["member"])) : e(F).value == "game" ? (u(), R(ao, {
|
|
1276
|
+
key: 4,
|
|
1277
|
+
member: m.member
|
|
1278
|
+
}, null, 8, ["member"])) : ce("", !0)
|
|
1279
|
+
])
|
|
1280
|
+
]),
|
|
1281
|
+
_: 1
|
|
1282
|
+
}, 8, ["modelValue"]);
|
|
1283
|
+
};
|
|
1284
|
+
}
|
|
1285
|
+
}), sa = { class: "flex items-center justify-end" }, Ua = /* @__PURE__ */ be({
|
|
1286
|
+
__name: "MemberList",
|
|
1287
|
+
setup(y) {
|
|
1288
|
+
const k = Je(), p = $e(), x = qe(), { minor: r } = je, o = He(), v = [
|
|
1289
|
+
{
|
|
1290
|
+
header: "Name",
|
|
1291
|
+
enableSorting: !0,
|
|
1292
|
+
accessorKey: "name",
|
|
1293
|
+
cell(s) {
|
|
1294
|
+
return Tt(s.row.original);
|
|
1295
|
+
}
|
|
1296
|
+
},
|
|
1297
|
+
{
|
|
1298
|
+
header: "Phone",
|
|
1299
|
+
enableSorting: !0,
|
|
1300
|
+
accessorKey: "phoneNumber"
|
|
1301
|
+
},
|
|
1302
|
+
{
|
|
1303
|
+
accessorFn: (s) => S(Ce(s._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(s) {
|
|
1313
|
+
return kt(
|
|
1314
|
+
s.row.original,
|
|
1315
|
+
p.sortedTiers
|
|
1316
|
+
);
|
|
1317
|
+
}
|
|
1318
|
+
},
|
|
1319
|
+
{
|
|
1320
|
+
header: "Title",
|
|
1321
|
+
enableSorting: !1,
|
|
1322
|
+
cell(s) {
|
|
1323
|
+
return At(
|
|
1324
|
+
s.row.original,
|
|
1325
|
+
p.sortedTitles
|
|
1326
|
+
);
|
|
1327
|
+
}
|
|
1328
|
+
},
|
|
1329
|
+
{
|
|
1330
|
+
accessorKey: "collection_CREDIT_0_balance",
|
|
1331
|
+
accessorFn: (s) => {
|
|
1332
|
+
var i, w, T;
|
|
1333
|
+
return ee(((T = (w = (i = s.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: (s) => {
|
|
1341
|
+
var i, w, T;
|
|
1342
|
+
return ee(((T = (w = (i = s.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: (s) => {
|
|
1350
|
+
var i, w, T;
|
|
1351
|
+
return ee(((T = (w = (i = s.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: (s) => {
|
|
1358
|
+
var i;
|
|
1359
|
+
return ((i = s.stats) == null ? void 0 : i.visitCount) ?? 0;
|
|
1360
|
+
},
|
|
1361
|
+
header: "Total visit",
|
|
1362
|
+
accessorKey: "stats.visitCount",
|
|
1363
|
+
id: "stats.visitCount"
|
|
1364
|
+
},
|
|
1365
|
+
{
|
|
1366
|
+
accessorFn: (s) => {
|
|
1367
|
+
var i;
|
|
1368
|
+
return (i = s.stats) == null ? void 0 : i.lastVisit;
|
|
1369
|
+
},
|
|
1370
|
+
sortingFn: (s, i) => {
|
|
1371
|
+
var w, T;
|
|
1372
|
+
return new Date((w = s.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(s) {
|
|
1377
|
+
var i, w;
|
|
1378
|
+
return K("div", { class: "flex items-center justify-end gap-4" }, [
|
|
1379
|
+
K(
|
|
1380
|
+
"span",
|
|
1381
|
+
(i = s.row.original.stats) != null && i.lastVisit ? S((w = s.row.original.stats) == null ? void 0 : w.lastVisit).fromNow() : "NA"
|
|
1382
|
+
),
|
|
1383
|
+
K(
|
|
1384
|
+
ve.FmTooltip,
|
|
1385
|
+
{
|
|
1386
|
+
content: S(s.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(s) {
|
|
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 se(s.row.original._id);
|
|
1413
|
+
}
|
|
1414
|
+
})
|
|
1415
|
+
]
|
|
1416
|
+
}
|
|
1417
|
+
);
|
|
1418
|
+
}
|
|
1419
|
+
}
|
|
1420
|
+
], { tableMeta: d, rowData: C, onSort: m, debouncedFetchData: g, onSearch: V } = Ke(le.read), D = G(), L = G(!1), P = G(), de = H(() => x.locations.map((s) => ({
|
|
1421
|
+
label: s.name,
|
|
1422
|
+
value: s._id
|
|
1423
|
+
})));
|
|
1424
|
+
async function ne() {
|
|
1425
|
+
P.value = await le.readById(
|
|
1426
|
+
P.value._id.toString()
|
|
1427
|
+
), L.value = !0;
|
|
1428
|
+
}
|
|
1429
|
+
async function W() {
|
|
1430
|
+
await g(), L.value = !1;
|
|
1431
|
+
}
|
|
1432
|
+
async function se(s) {
|
|
1433
|
+
await o.push({
|
|
1434
|
+
name: We["$connect-LOYALTY_MEMBER_TRANSACTIONS"],
|
|
1435
|
+
params: { id: s }
|
|
1436
|
+
});
|
|
1437
|
+
}
|
|
1438
|
+
const c = {
|
|
1439
|
+
sortBy: "_id",
|
|
1440
|
+
descending: !1,
|
|
1441
|
+
rowsPerPage: 1e3,
|
|
1442
|
+
page: 1,
|
|
1443
|
+
rowsNumber: 0
|
|
1444
|
+
};
|
|
1445
|
+
function f(s) {
|
|
1446
|
+
const i = S(s);
|
|
1447
|
+
return i.isValid() ? i.format("DD/MM/YYYY") : "";
|
|
1448
|
+
}
|
|
1449
|
+
async function M() {
|
|
1450
|
+
const s = new ct(), i = (await le.read({
|
|
1451
|
+
limit: 1,
|
|
1452
|
+
skip: 0,
|
|
1453
|
+
sortBy: c.sortBy,
|
|
1454
|
+
descending: c.descending
|
|
1455
|
+
})).meta.totalResources ?? 0, w = c.rowsPerPage;
|
|
1456
|
+
await r(
|
|
1457
|
+
async () => {
|
|
1458
|
+
var T, O, E, U, te, z, F, J, a, n, b, B, N, X, re, me, ye, _, Y, oe, j, ue, pe, fe, Q;
|
|
1459
|
+
for (let Z = 0; Z < i; Z += w) {
|
|
1460
|
+
const Xe = {
|
|
1461
|
+
...c,
|
|
1462
|
+
limit: w,
|
|
1463
|
+
skip: c.page - 1,
|
|
1464
|
+
sortBy: c.sortBy,
|
|
1465
|
+
descending: c.descending
|
|
1466
|
+
}, Qe = await le.read(Xe);
|
|
1467
|
+
for (const l of Qe.resources) {
|
|
1468
|
+
const Ze = (T = lt.parseOneAddress(
|
|
1469
|
+
l == null ? void 0 : l.email
|
|
1470
|
+
)) != null && T.domain.includes("feedmepos.com") ? void 0 : l.email, et = (E = ((O = l == null ? void 0 : l.collection) == null ? void 0 : O.TITLE) || []) == null ? void 0 : E.reduce(
|
|
1471
|
+
(ae, ge) => {
|
|
1472
|
+
var he, Se;
|
|
1473
|
+
const _e = (Se = (he = p.sortedTitles) == null ? void 0 : he.find(
|
|
1474
|
+
(we) => we._id === ge.collectible
|
|
1475
|
+
)) == null ? void 0 : Se.name;
|
|
1476
|
+
return !_e || ge.balance <= 0 || ae.push(_e), ae;
|
|
1477
|
+
},
|
|
1478
|
+
[]
|
|
1479
|
+
), tt = (p.sortedTitles || []).reduce(
|
|
1480
|
+
(ae, ge) => {
|
|
1481
|
+
var he, Se, we, Be;
|
|
1482
|
+
const _e = (Be = (we = (Se = (((he = l == null ? void 0 : l.collection) == null ? void 0 : he.TITLE) || []).find(
|
|
1483
|
+
(nt) => nt.collectible === ge._id
|
|
1484
|
+
)) == null ? void 0 : Se.expiryBalance) == null ? void 0 : we[0]) == null ? void 0 : Be.expiredAt;
|
|
1485
|
+
return ae[ge.name] = _e ? S(_e).format("DD/MM/YYYY") : "", ae;
|
|
1486
|
+
},
|
|
1487
|
+
{}
|
|
1488
|
+
), ot = ((z = (te = (U = l.collection) == null ? void 0 : U.CREDIT) == null ? void 0 : te.at(0)) == null ? void 0 : z.balance) || 0, Ve = ((n = (a = (J = (F = l.collection) == null ? void 0 : F.CREDIT) == null ? void 0 : J.at(0)) == null ? void 0 : a.expiryBalance) == null ? void 0 : n.reduce(
|
|
1489
|
+
(ae, ge) => ae + ge.amount,
|
|
1490
|
+
0
|
|
1491
|
+
)) || 0, Ie = ee(ot, 2), at = {
|
|
1492
|
+
ID: l._id.toString(),
|
|
1493
|
+
Name: ((b = l.name) == null ? void 0 : b.trim()) || "",
|
|
1494
|
+
Phone: ((B = l == null ? void 0 : l.phoneNumber) == null ? void 0 : B.trim()) || "",
|
|
1495
|
+
Email: Ze || "",
|
|
1496
|
+
Gender: l.gender || "",
|
|
1497
|
+
CardNo: l.cardNo || "",
|
|
1498
|
+
Birthday: l != null && l.birthday ? f(l == null ? void 0 : l.birthday) : "",
|
|
1499
|
+
Credit: (Number(Ie) - Number(Ve)).toFixed(2),
|
|
1500
|
+
FreeCredit: Number(Ve.toFixed(2)),
|
|
1501
|
+
TotalCredit: Number(Ie),
|
|
1502
|
+
Exp: l != null && l.collection ? ((re = (X = (N = l.collection) == null ? void 0 : N.POINT) == null ? void 0 : X.at(0)) == null ? void 0 : re.balance) ?? 0 : 0,
|
|
1503
|
+
Point: l != null && l.collection ? ((_ = (ye = (me = l.collection) == null ? void 0 : me.COIN) == null ? void 0 : ye.at(0)) == null ? void 0 : _.balance) ?? 0 : 0,
|
|
1504
|
+
Tier: l != null && l.collection ? ((j = (oe = (Y = l.collection) == null ? void 0 : Y.TIER) == null ? void 0 : oe.at(0)) == null ? void 0 : j.balance) ?? 0 : 0,
|
|
1505
|
+
Titles: et.join(","),
|
|
1506
|
+
...tt,
|
|
1507
|
+
TotalTransaction: l.stats.visitCount,
|
|
1508
|
+
AvgSpent: Mt(Number(l.stats.avgBillSize || 0)).toFormat(
|
|
1509
|
+
!1
|
|
1510
|
+
),
|
|
1511
|
+
TotalSpent: l.stats.avgBillSize * l.stats.visitCount,
|
|
1512
|
+
LastVisit: f(l.stats.lastVisit),
|
|
1513
|
+
Feedback: ((ue = l.stats) == null ? void 0 : ue.feedbackCount) || 0,
|
|
1514
|
+
LastSeasonTierEarned: ((pe = l.stats) == null ? void 0 : pe.lastSeasonTierEarned) || 0,
|
|
1515
|
+
LastSeasonPointEarned: ((fe = l.stats) == null ? void 0 : fe.lastSeasonPointEarned) || 0,
|
|
1516
|
+
JoinedAt: f(l.joinAt || void 0),
|
|
1517
|
+
JoinedAtLocation: l.location && ((Q = de.value.find((ae) => ae.value == l.location)) == null ? void 0 : Q.label) || "-",
|
|
1518
|
+
VisitFrequency: `${Number(
|
|
1519
|
+
Math.ceil(l.stats.avgVisitFrequency).toFixed(0)
|
|
1520
|
+
)}`
|
|
1521
|
+
};
|
|
1522
|
+
s.addRecord(at);
|
|
1523
|
+
}
|
|
1524
|
+
c.page++;
|
|
1525
|
+
}
|
|
1526
|
+
await dt(
|
|
1527
|
+
s.buildExcel(),
|
|
1528
|
+
`members-${(/* @__PURE__ */ new Date()).toISOString()}.xlsx`,
|
|
1529
|
+
{
|
|
1530
|
+
bookType: "xlsx",
|
|
1531
|
+
bookSST: !1,
|
|
1532
|
+
type: "array"
|
|
1533
|
+
}
|
|
1534
|
+
), c.page = 1;
|
|
1535
|
+
},
|
|
1536
|
+
{
|
|
1537
|
+
message: "Exporting member...",
|
|
1538
|
+
successMessage: "Member exported successfully"
|
|
1539
|
+
}
|
|
1540
|
+
);
|
|
1541
|
+
}
|
|
1542
|
+
return ze(async () => {
|
|
1543
|
+
await p.readMembership(), await k.read(), await x.readLocations(), await g();
|
|
1544
|
+
}), (s, i) => {
|
|
1545
|
+
const w = $("FmSearch"), T = $("FmButton"), O = $("FmSnackbar");
|
|
1546
|
+
return u(), A("div", null, [
|
|
1547
|
+
t("div", sa, [
|
|
1548
|
+
h(w, {
|
|
1549
|
+
class: "mt-4",
|
|
1550
|
+
modelValue: e(d).searchValue,
|
|
1551
|
+
"onUpdate:modelValue": [
|
|
1552
|
+
i[0] || (i[0] = (E) => e(d).searchValue = E),
|
|
1553
|
+
e(V)
|
|
1554
|
+
],
|
|
1555
|
+
placeholder: "Search",
|
|
1556
|
+
collapsible: ""
|
|
1557
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue"]),
|
|
1558
|
+
h(T, {
|
|
1559
|
+
icon: "ios_share",
|
|
1560
|
+
variant: "tertiary",
|
|
1561
|
+
onClick: M
|
|
1562
|
+
})
|
|
1563
|
+
]),
|
|
1564
|
+
Re(h(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, e(L)]
|
|
1576
|
+
]),
|
|
1577
|
+
h(Ge, {
|
|
1578
|
+
loading: e(d).isLoading,
|
|
1579
|
+
"row-data": e(C),
|
|
1580
|
+
"row-count": e(d).totalRows,
|
|
1581
|
+
"column-defs": v,
|
|
1582
|
+
"shrink-at": !1,
|
|
1583
|
+
"page-count": e(d).pageCount,
|
|
1584
|
+
"page-index": e(d).pageIndex,
|
|
1585
|
+
"page-size": e(d).pageSize,
|
|
1586
|
+
onSortChange: e(m),
|
|
1587
|
+
onPageChange: i[2] || (i[2] = (E) => e(g)({ pageSize: E.pageSize, pageIndex: E.pageIndex })),
|
|
1588
|
+
onRowClick: i[3] || (i[3] = (E) => {
|
|
1589
|
+
var U;
|
|
1590
|
+
P.value = E.original, (U = e(D)) == null || U.showSheet();
|
|
1591
|
+
})
|
|
1592
|
+
}, null, 8, ["loading", "row-data", "row-count", "page-count", "page-index", "page-size", "onSortChange"]),
|
|
1593
|
+
e(P) ? (u(), R(na, {
|
|
1594
|
+
key: 0,
|
|
1595
|
+
ref_key: "sheetRef",
|
|
1596
|
+
ref: D,
|
|
1597
|
+
member: e(P),
|
|
1598
|
+
"onUpdate:member": ne
|
|
1599
|
+
}, null, 8, ["member"])) : ce("", !0)
|
|
1600
|
+
]);
|
|
1601
|
+
};
|
|
1602
|
+
}
|
|
1603
|
+
});
|
|
1604
|
+
export {
|
|
1605
|
+
Ua as default
|
|
1606
|
+
};
|