@feedmepos/mf-connect 0.1.0-beta.11 → 0.1.0-beta.13
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-IpLNFnjo.js → Analytic-hvE4B2NP.js} +9 -9
- package/dist/{App-D9Bi7WTi.js → App-GwIOv-m-.js} +201 -201
- package/dist/{Broadcast-3BNGmPyG.js → Broadcast-Bdwj5qA3.js} +8 -8
- package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-CnVZZnAO.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-DY4xs9ra.js} +8 -8
- package/dist/{Card-CpE7eylY.js → Card-FzeDxGpd.js} +126 -126
- package/dist/{Collections-DFZ_McBC.js → Collections-DnltkOji.js} +4 -4
- package/dist/{Credit-Beml9hZH.js → Credit-BjOs1-SV.js} +8 -8
- package/dist/{EditCampaignSheet.vue_vue_type_script_setup_true_lang-XZtq7qUh.js → EditCampaignSheet.vue_vue_type_script_setup_true_lang-B_Si_AQ1.js} +66 -63
- package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-CrViguLt.js → EffectSheet.vue_vue_type_style_index_0_lang-B2flXsB2.js} +6 -6
- package/dist/{Experience-HYyi__Wf.js → Experience-C4DvTIRT.js} +8 -8
- package/dist/{Game-Dtn11CP_.js → Game-CH9nOj1Y.js} +8 -8
- package/dist/{Marketing-BYMpQugE.js → Marketing-COgP0cW-.js} +5 -5
- package/dist/{Member-BP5W6ocI.js → Member-D9UOCOnD.js} +4 -4
- package/dist/MemberList-BiqQuhWx.js +1040 -0
- package/dist/{MemberTransactions-BDuQ2poX.js → MemberTransactions-B6DqB6mk.js} +1 -1
- package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-hkK13pIu.js → MessageInput.vue_vue_type_script_setup_true_lang-Dkn6ic59.js} +2 -2
- package/dist/{Mission-CVPfpXqE.js → Mission-65OFi1cJ.js} +8 -8
- package/dist/{Point-CNq0UR3i.js → Point-8HmgJRmV.js} +8 -8
- package/dist/{Promotion-DDGkSEq4.js → Promotion-NN9iJfPq.js} +9 -9
- package/dist/{RuleGroup.vue_vue_type_script_setup_true_lang-CAmHafWG.js → RuleGroup.vue_vue_type_script_setup_true_lang-D4f7298N.js} +226 -217
- package/dist/{Segment-BTChC1dG.js → Segment-CnLQiZ3g.js} +13 -13
- package/dist/{Setting-v3mUUrpu.js → Setting-DmZU3gAP.js} +8 -8
- package/dist/{Store-C0yfrePX.js → Store-BkUj4woF.js} +13 -13
- package/dist/{StoreRewards-D5iGadfW.js → StoreRewards-D49SIccs.js} +12 -12
- package/dist/{StoreTransactions.vue_vue_type_script_setup_true_lang-kfT1Myf8.js → StoreTransactions.vue_vue_type_script_setup_true_lang-ClY5DLPQ.js} +10 -10
- package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-CSYS1qZG.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-BS4PXh2q.js} +1 -1
- package/dist/{Tier-Dm78VvDR.js → Tier-rRoE4M3e.js} +15 -15
- package/dist/{Title-DBFXMOFn.js → Title-ByHAW7J5.js} +15 -15
- package/dist/{Transaction-BqxS-rpt.js → Transaction-daG9-W0y.js} +2 -2
- package/dist/{Voucher-DSe_1GCt.js → Voucher-B9xf0e6x.js} +11 -11
- package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-iV7RhMM0.js → ZodTextField.vue_vue_type_script_setup_true_lang-T3nC1YZf.js} +1 -1
- package/dist/{app-CnclNehS.js → app-BNcCsLJ1.js} +24 -24
- package/dist/{app-BKZTSa3I.js → app-CO5FtQ_v.js} +1 -1
- package/dist/app.js +1 -1
- package/dist/{business-BhDQlLuP.js → business-BhQb-hkF.js} +1 -1
- package/dist/{campaign-CQ9Nt5aw.js → campaign-26brACND.js} +2 -2
- package/dist/{collection.fn-CCFKWzrd.js → collection.fn-yhoNFXoc.js} +2 -2
- package/dist/{dto-C9p4nlpM.js → dto-Ha-7No98.js} +9 -9
- package/dist/{effect-BW2ndqNC.js → effect-BMN_DZq2.js} +1 -1
- package/dist/{email-addresses-f6Qi69T4.js → email-addresses-CiIGkdZd.js} +1 -1
- package/dist/{export-BTF1th7Q.js → export-DqdobYQ9.js} +3 -3
- package/dist/{helper-AHY68CPn.js → helper-CxKVaS7J.js} +1 -1
- package/dist/{index-DtGPRAq2.js → index-BggU-YHH.js} +319 -304
- package/dist/{index-Cg9npkzC.js → index-CICZWUs_.js} +5 -5
- package/dist/{index-t3RW39Z7.js → index-CKzehlZH.js} +1 -1
- package/dist/{index-D6XbU0Qa.js → index-CM_02sYD.js} +3 -3
- package/dist/{index-tkSRs4ZW.js → index-CNk82BB9.js} +3 -3
- package/dist/{index-DuLGLnDF.js → index-CvCUq_ma.js} +1 -1
- package/dist/{index-DX0qEaPU.js → index-D6wN6YpG.js} +1 -1
- package/dist/{index-WbzCjhRU.js → index-DYTBka1k.js} +1 -1
- package/dist/{index-Cc2nUHpJ.js → index-Du0pfy3X.js} +1 -1
- package/dist/{index-BElfYwE6.js → index-LPxuEkQA.js} +34 -33
- package/dist/{index-CsC5CEEX.js → index-ko44g5Wh.js} +2 -2
- package/dist/{index-BD3B1WsX.js → index-x7P8HJ9i.js} +2 -2
- package/dist/{index.esm2017-D_SvBpjK.js → index.esm2017-BJmoEKbU.js} +1 -1
- package/dist/{loading-DYgnbsuc.js → loading-sqn4egKz.js} +4 -4
- package/dist/{membership-DD0hHJl3.js → membership-CFgp0Gr1.js} +3 -3
- package/dist/{money-Cgrz-BtT.js → money-BIslIi4C.js} +1 -1
- package/dist/{number-DnNIyLAO.js → number-CmUbTbIe.js} +1 -1
- package/dist/{rule-builder-CtABwqc_.js → rule-builder-CZqF05r6.js} +1 -1
- package/dist/{rule-BtuowduB.js → rule-xgVE9qkb.js} +179 -177
- package/dist/{template-DLkN8BDg.js → template-BC7H5E09.js} +4 -4
- package/dist/{usePagination-Dt34_eYZ.js → usePagination-DSH2zVJ_.js} +1 -1
- package/dist/{vue-i18n-Bzlk0Afk.js → vue-i18n-ClNna7Hi.js} +2 -2
- package/package.json +1 -1
- package/dist/MemberList-CBHldoAX.js +0 -1036
|
@@ -1,1036 +0,0 @@
|
|
|
1
|
-
import { defineComponent as ue, computed as L, ref as X, resolveComponent as _, openBlock as y, createElementBlock as I, Fragment as ee, createElementVNode as a, unref as t, createBlock as z, createCommentVNode as se, createVNode as g, renderList as ae, withCtx as ne, createTextVNode as fe, toDisplayString as N, withDirectives as Be, vShow as Ue, onMounted as Pe, isRef as We, h as oe } from "vue";
|
|
2
|
-
import { h as x } from "./moment-BWErdI6_.js";
|
|
3
|
-
import { useDialog as be, components as de } from "@feedmepos/ui-library";
|
|
4
|
-
import { e as Qe, M as Ze } from "./email-addresses-f6Qi69T4.js";
|
|
5
|
-
import { a as et, _ as tt, w as ot } from "./usePagination-Dt34_eYZ.js";
|
|
6
|
-
import "./index-WbzCjhRU.js";
|
|
7
|
-
import { p as Ie, b as $e, u as Oe } from "./loading-DYgnbsuc.js";
|
|
8
|
-
import { u as ye, C as Ee, s as nt } from "./membership-DD0hHJl3.js";
|
|
9
|
-
import { c as st } from "./index-tkSRs4ZW.js";
|
|
10
|
-
import { _ as De } from "./lodash-B5I3zXaY.js";
|
|
11
|
-
import { D as at } from "./type_drinks-D6jnpvwV.js";
|
|
12
|
-
import { F as it, a as rt, b as lt, c as dt } from "./index-BD3B1WsX.js";
|
|
13
|
-
import { F as ct } from "./index-D6XbU0Qa.js";
|
|
14
|
-
import { C as pe } from "./collection.fn-CCFKWzrd.js";
|
|
15
|
-
import { u as Re } from "./business-BhDQlLuP.js";
|
|
16
|
-
import { defineStore as mt } from "pinia";
|
|
17
|
-
import { m as J } from "./index-DX0qEaPU.js";
|
|
18
|
-
import { o as Ye } from "./objectId-dwaoBfJX.js";
|
|
19
|
-
import { f as me } from "./number-DnNIyLAO.js";
|
|
20
|
-
import { t as ut } from "./money-Cgrz-BtT.js";
|
|
21
|
-
import { g as pt, a as ft, b as bt } from "./user-Bm4KttFq.js";
|
|
22
|
-
import { useRouter as yt } from "vue-router";
|
|
23
|
-
import { R as vt } from "./app-CnclNehS.js";
|
|
24
|
-
const xt = { class: "flex flex-col" }, gt = { key: 1 }, Ct = { class: "flex flex-nowrap gap-4 items-center my-[-4px]" }, St = { class: "flex flex-nowrap gap-8 items-center pt-24 w-full" }, Ft = /* @__PURE__ */ ue({
|
|
25
|
-
__name: "MemberStatsDialog",
|
|
26
|
-
props: {
|
|
27
|
-
member: {
|
|
28
|
-
type: Object,
|
|
29
|
-
required: !0
|
|
30
|
-
},
|
|
31
|
-
onSubmit: {
|
|
32
|
-
type: Function,
|
|
33
|
-
required: !0
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
setup(C) {
|
|
37
|
-
var W, G, K, T;
|
|
38
|
-
const j = be(), v = ye(), f = C, $ = L(
|
|
39
|
-
() => {
|
|
40
|
-
var d;
|
|
41
|
-
return (((d = f.member.collection) == null ? void 0 : d.TITLE) ?? []).reduce(
|
|
42
|
-
(l, s) => {
|
|
43
|
-
var e, u, m, b, k;
|
|
44
|
-
const n = v.sortedTitles.find(
|
|
45
|
-
(A) => A._id.toString() === s.collectible
|
|
46
|
-
);
|
|
47
|
-
if (!n) return l;
|
|
48
|
-
const o = [...s.expiryBalance ?? []].sort(
|
|
49
|
-
(A, U) => x(A.expiredAt).isAfter(x(U.expiredAt)) ? -1 : 1
|
|
50
|
-
);
|
|
51
|
-
return (e = o[0]) != null && e.expiredAt && x((u = o[0]) == null ? void 0 : u.expiredAt).isBefore(x()) || l.push({
|
|
52
|
-
_id: n._id,
|
|
53
|
-
name: n.name,
|
|
54
|
-
expiredAt: (m = o[0]) != null && m.expiredAt ? x((b = o[0]) == null ? void 0 : b.expiredAt).toISOString() : "",
|
|
55
|
-
expiresIn: x((k = o[0]) == null ? void 0 : k.expiredAt).diff(x(), "days")
|
|
56
|
-
}), l;
|
|
57
|
-
},
|
|
58
|
-
[]
|
|
59
|
-
);
|
|
60
|
-
}
|
|
61
|
-
), c = X({
|
|
62
|
-
cardNo: f.member.cardNo,
|
|
63
|
-
experience: ((G = (W = f.member.collection) == null ? void 0 : W.POINT) == null ? void 0 : G[0].balance) ?? 0,
|
|
64
|
-
tier: ((T = (K = f.member.collection) == null ? void 0 : K.TIER) == null ? void 0 : T[0].balance) ?? -1,
|
|
65
|
-
titles: $.value.map((d) => ({ expiredAt: d.expiresIn, id: d._id })) ?? void 0
|
|
66
|
-
}), E = L(
|
|
67
|
-
() => (v.sortedTitles ?? []).map((d) => ({
|
|
68
|
-
label: d.name,
|
|
69
|
-
value: d._id.toString(),
|
|
70
|
-
sublabel: $.value.some((l) => l._id === d._id) ? "Owned" : void 0
|
|
71
|
-
}))
|
|
72
|
-
), M = L(() => (v.sortedTiers ?? []).map((d, l) => ({
|
|
73
|
-
label: d.name,
|
|
74
|
-
sublabel: `${d.option.from} - ${d.option.to}`,
|
|
75
|
-
from: d.option.from,
|
|
76
|
-
to: d.option.to,
|
|
77
|
-
value: l + 1
|
|
78
|
-
})));
|
|
79
|
-
function h() {
|
|
80
|
-
var s, n;
|
|
81
|
-
const d = ((s = M.value[(c.value.tier ?? 1) - 1]) == null ? void 0 : s.from) ?? 0, l = (n = M.value[(c.value.tier ?? 1) - 1]) == null ? void 0 : n.to;
|
|
82
|
-
c.value.experience = Math.min(
|
|
83
|
-
l ?? d,
|
|
84
|
-
Math.max(d, c.value.experience ?? 0)
|
|
85
|
-
);
|
|
86
|
-
}
|
|
87
|
-
const D = L(() => {
|
|
88
|
-
var s, n, o, e, u, m;
|
|
89
|
-
const d = ((n = (s = f.member.collection) == null ? void 0 : s.TIER) == null ? void 0 : n[0].balance) ?? -1, l = ((e = (o = f.member.collection) == null ? void 0 : o.POINT) == null ? void 0 : e[0].balance) ?? 0;
|
|
90
|
-
if (d != c.value.tier) return !0;
|
|
91
|
-
if (c.value.experience && c.value.experience != l) {
|
|
92
|
-
const b = ((u = M.value[d - 1]) == null ? void 0 : u.from) ?? 0, k = ((m = M.value[d - 1]) == null ? void 0 : m.to) ?? 0;
|
|
93
|
-
if (c.value.experience < b || k && c.value.experience > k)
|
|
94
|
-
return !0;
|
|
95
|
-
}
|
|
96
|
-
return !1;
|
|
97
|
-
});
|
|
98
|
-
function S(d) {
|
|
99
|
-
var l;
|
|
100
|
-
return (l = $.value.find((s) => s._id === d)) == null ? void 0 : l.expiresIn;
|
|
101
|
-
}
|
|
102
|
-
const Y = L(() => {
|
|
103
|
-
const d = ct.safeParse(c.value);
|
|
104
|
-
return d.success ? void 0 : d.error.errors;
|
|
105
|
-
});
|
|
106
|
-
function V(d) {
|
|
107
|
-
var l, s;
|
|
108
|
-
return (s = (l = Y.value) == null ? void 0 : l.find((n) => n.path.join(".") === d)) == null ? void 0 : s.message;
|
|
109
|
-
}
|
|
110
|
-
function q(d) {
|
|
111
|
-
var l;
|
|
112
|
-
return (l = Y.value) == null ? void 0 : l.filter((s) => s.path.join(".").startsWith(d)).map((s) => s.message);
|
|
113
|
-
}
|
|
114
|
-
async function B() {
|
|
115
|
-
await f.onSubmit(c.value), j.close();
|
|
116
|
-
}
|
|
117
|
-
return (d, l) => {
|
|
118
|
-
var A, U;
|
|
119
|
-
const s = _("FmSelect"), n = _("FmStepperField"), o = _("FmTextField"), e = _("FmField"), u = _("FmFormGroup"), m = _("FmButton"), b = _("FmHelperText"), k = _("FmSpacer");
|
|
120
|
-
return y(), I(ee, null, [
|
|
121
|
-
a("div", xt, [
|
|
122
|
-
l[6] || (l[6] = a("div", { class: "fm-typo-en-title-sm-800 mb-8" }, "Member tiering", -1)),
|
|
123
|
-
t(M).length ? (y(), z(s, {
|
|
124
|
-
key: 0,
|
|
125
|
-
modelValue: t(c).tier,
|
|
126
|
-
"onUpdate:modelValue": [
|
|
127
|
-
l[0] || (l[0] = (i) => t(c).tier = i),
|
|
128
|
-
h
|
|
129
|
-
],
|
|
130
|
-
label: "Member Tier",
|
|
131
|
-
items: t(M),
|
|
132
|
-
"helper-text": V("tier"),
|
|
133
|
-
"helper-state": V("tier") ? "error" : void 0
|
|
134
|
-
}, null, 8, ["modelValue", "items", "helper-text", "helper-state"])) : se("", !0),
|
|
135
|
-
g(n, {
|
|
136
|
-
"model-value": t(c).experience ?? 0,
|
|
137
|
-
"onUpdate:modelValue": l[1] || (l[1] = (i) => t(c).experience = i),
|
|
138
|
-
label: "Member Experience",
|
|
139
|
-
"max-fraction-digits": 0,
|
|
140
|
-
"helper-text": V("experience"),
|
|
141
|
-
"helper-state": V("experience") ? "error" : void 0
|
|
142
|
-
}, null, 8, ["model-value", "helper-text", "helper-state"]),
|
|
143
|
-
l[7] || (l[7] = a("div", { class: "fm-typo-en-title-sm-800 mt-16 mb-8" }, "Member Card", -1)),
|
|
144
|
-
g(o, {
|
|
145
|
-
modelValue: t(c).cardNo,
|
|
146
|
-
"onUpdate:modelValue": l[2] || (l[2] = (i) => t(c).cardNo = i),
|
|
147
|
-
label: "Card number",
|
|
148
|
-
"helper-text": V("cardNo"),
|
|
149
|
-
"helper-state": V("cardNo") ? "error" : void 0
|
|
150
|
-
}, null, 8, ["modelValue", "helper-text", "helper-state"]),
|
|
151
|
-
l[8] || (l[8] = a("div", { class: "fm-typo-en-title-sm-800 mt-16 mb-8" }, "Titles", -1)),
|
|
152
|
-
(A = t(c).titles) != null && A.length ? (y(), I("div", gt, l[5] || (l[5] = [
|
|
153
|
-
a("div", { class: "flex flex-nowrap gap-4 items-center" }, [
|
|
154
|
-
a("div", { class: "flex-1" }, "Title"),
|
|
155
|
-
a("div", { class: "flex-1" }, "Expires in days"),
|
|
156
|
-
a("div", { class: "w-24 h-1" })
|
|
157
|
-
], -1)
|
|
158
|
-
]))) : se("", !0),
|
|
159
|
-
(y(!0), I(ee, null, ae(t(c).titles ?? [], (i, F) => (y(), I("div", { key: F }, [
|
|
160
|
-
a("div", Ct, [
|
|
161
|
-
t($).some((p) => p._id === i.id) ? (y(), z(u, {
|
|
162
|
-
key: 1,
|
|
163
|
-
"model-value": "",
|
|
164
|
-
class: "flex-1"
|
|
165
|
-
}, {
|
|
166
|
-
default: ne(() => [
|
|
167
|
-
g(e, {
|
|
168
|
-
disabled: !0,
|
|
169
|
-
class: "text-fm-color-typo-secondary"
|
|
170
|
-
}, {
|
|
171
|
-
default: ne(() => {
|
|
172
|
-
var p;
|
|
173
|
-
return [
|
|
174
|
-
fe(N((p = t(E).find((w) => w.value === i.id)) == null ? void 0 : p.label), 1)
|
|
175
|
-
];
|
|
176
|
-
}),
|
|
177
|
-
_: 2
|
|
178
|
-
}, 1024)
|
|
179
|
-
]),
|
|
180
|
-
_: 2
|
|
181
|
-
}, 1024)) : (y(), z(s, {
|
|
182
|
-
key: 0,
|
|
183
|
-
modelValue: i.id,
|
|
184
|
-
"onUpdate:modelValue": [(p) => i.id = p, (p) => i.expiredAt = S(p) ?? 1],
|
|
185
|
-
class: "flex-1",
|
|
186
|
-
items: t(E).filter(
|
|
187
|
-
(p) => {
|
|
188
|
-
var w;
|
|
189
|
-
return !((w = t(c).titles) != null && w.map((P) => P.id).includes(p.value)) || i.id === p.value;
|
|
190
|
-
}
|
|
191
|
-
)
|
|
192
|
-
}, null, 8, ["modelValue", "onUpdate:modelValue", "items"])),
|
|
193
|
-
g(n, {
|
|
194
|
-
modelValue: i.expiredAt,
|
|
195
|
-
"onUpdate:modelValue": (p) => i.expiredAt = p,
|
|
196
|
-
class: "flex-1",
|
|
197
|
-
label: "",
|
|
198
|
-
"max-fraction-digits": 0
|
|
199
|
-
}, null, 8, ["modelValue", "onUpdate:modelValue"]),
|
|
200
|
-
g(m, {
|
|
201
|
-
class: "w-24 h-24",
|
|
202
|
-
icon: "close",
|
|
203
|
-
variant: "tertiary",
|
|
204
|
-
onClick: (p) => {
|
|
205
|
-
var w;
|
|
206
|
-
return (w = t(c).titles) == null ? void 0 : w.splice(F, 1);
|
|
207
|
-
}
|
|
208
|
-
}, null, 8, ["onClick"])
|
|
209
|
-
]),
|
|
210
|
-
(y(!0), I(ee, null, ae(q(`titles.${F}`), (p, w) => (y(), z(b, {
|
|
211
|
-
key: w,
|
|
212
|
-
class: "items-center",
|
|
213
|
-
state: "error",
|
|
214
|
-
text: p.toString()
|
|
215
|
-
}, null, 8, ["text"]))), 128))
|
|
216
|
-
]))), 128)),
|
|
217
|
-
t(E).length && (((U = t(c).titles) == null ? void 0 : U.length) ?? 0) < t(E).length ? (y(), z(m, {
|
|
218
|
-
key: 2,
|
|
219
|
-
icon: "add",
|
|
220
|
-
label: "Give title",
|
|
221
|
-
variant: "plain",
|
|
222
|
-
onClick: l[3] || (l[3] = (i) => {
|
|
223
|
-
var F;
|
|
224
|
-
return t(c).titles = [
|
|
225
|
-
...t(c).titles ?? [],
|
|
226
|
-
{
|
|
227
|
-
id: ((F = t(E).find(
|
|
228
|
-
(p) => {
|
|
229
|
-
var w;
|
|
230
|
-
return !((w = t(c).titles) != null && w.map((P) => P.id).includes(p.value));
|
|
231
|
-
}
|
|
232
|
-
)) == null ? void 0 : F.value) || t(E)[0].value,
|
|
233
|
-
expiredAt: 0
|
|
234
|
-
}
|
|
235
|
-
];
|
|
236
|
-
})
|
|
237
|
-
})) : se("", !0)
|
|
238
|
-
]),
|
|
239
|
-
a("div", St, [
|
|
240
|
-
Be(g(b, {
|
|
241
|
-
state: "warning",
|
|
242
|
-
text: "Updating member will cause tier to change"
|
|
243
|
-
}, null, 512), [
|
|
244
|
-
[Ue, t(D)]
|
|
245
|
-
]),
|
|
246
|
-
g(k),
|
|
247
|
-
g(m, {
|
|
248
|
-
variant: "secondary",
|
|
249
|
-
label: "Cancel",
|
|
250
|
-
size: "md",
|
|
251
|
-
onClick: l[4] || (l[4] = (i) => t(j).close())
|
|
252
|
-
}),
|
|
253
|
-
g(m, {
|
|
254
|
-
disabled: !!t(Y),
|
|
255
|
-
variant: "primary",
|
|
256
|
-
label: "Submit",
|
|
257
|
-
size: "md",
|
|
258
|
-
onClick: B
|
|
259
|
-
}, null, 8, ["disabled"])
|
|
260
|
-
])
|
|
261
|
-
], 64);
|
|
262
|
-
};
|
|
263
|
-
}
|
|
264
|
-
}), _t = { class: "fm-typo-en-title-sm-800" }, ht = { class: "space-y-16" }, Tt = { class: "flex flex-nowrap gap-8 items-center justify-end pt-24 w-full" }, wt = /* @__PURE__ */ ue({
|
|
265
|
-
__name: "CreditCoinDialog",
|
|
266
|
-
props: {
|
|
267
|
-
type: { type: String, required: !0 },
|
|
268
|
-
action: { type: String, required: !0 },
|
|
269
|
-
onSubmit: {
|
|
270
|
-
type: Function,
|
|
271
|
-
required: !0
|
|
272
|
-
}
|
|
273
|
-
},
|
|
274
|
-
setup(C) {
|
|
275
|
-
const j = be(), v = C, f = X({
|
|
276
|
-
amount: 1,
|
|
277
|
-
day: 1,
|
|
278
|
-
remark: void 0
|
|
279
|
-
}), $ = X(!0), c = L(() => pe.formattedType(v.type.toUpperCase()));
|
|
280
|
-
function E(D) {
|
|
281
|
-
$.value = D, !D && v.type === "coin" && (f.value.day = void 0);
|
|
282
|
-
}
|
|
283
|
-
async function M() {
|
|
284
|
-
if (v.action === "send") {
|
|
285
|
-
const D = f.value.day ? `, expire in ${f.value.day} days` : "";
|
|
286
|
-
Ie.confirm(
|
|
287
|
-
`Are you sure to send ${f.value.amount} ${c.value.toLowerCase()}${D}? This action cannot be reversed.`
|
|
288
|
-
).then(async (S) => {
|
|
289
|
-
S && await v.onSubmit(f.value);
|
|
290
|
-
});
|
|
291
|
-
} else
|
|
292
|
-
Ie.confirm(
|
|
293
|
-
`Are you sure to deduct ${f.value.amount} ${c.value.toLowerCase()}? This action cannot be reversed.`
|
|
294
|
-
).then(async (D) => {
|
|
295
|
-
D && await v.onSubmit(f.value);
|
|
296
|
-
});
|
|
297
|
-
}
|
|
298
|
-
const h = L(() => {
|
|
299
|
-
const S = (v.action === "send" ? v.type === "coin" ? it : rt : v.type === "coin" ? lt : dt).safeParse(f.value);
|
|
300
|
-
return S.success == !1 ? S.error.flatten().fieldErrors : void 0;
|
|
301
|
-
});
|
|
302
|
-
return (D, S) => {
|
|
303
|
-
const Y = _("FmStepperField"), V = _("FmSwitch"), q = _("FmTextarea"), B = _("FmButton"), W = _("FmCard");
|
|
304
|
-
return y(), z(W, { class: "flex flex-col gap-16 p-16" }, {
|
|
305
|
-
default: ne(() => {
|
|
306
|
-
var G, K, T, d, l, s;
|
|
307
|
-
return [
|
|
308
|
-
a("div", _t, N(v.action == "send" ? "Send" : "Deduct") + " " + N(t(Ee)[v.type.toUpperCase()].name), 1),
|
|
309
|
-
fe(" " + N(t(h)) + " ", 1),
|
|
310
|
-
a("div", ht, [
|
|
311
|
-
g(Y, {
|
|
312
|
-
modelValue: t(f).amount,
|
|
313
|
-
"onUpdate:modelValue": S[0] || (S[0] = (n) => t(f).amount = n),
|
|
314
|
-
label: `${t(Ee)[v.type.toUpperCase()].name} amount`,
|
|
315
|
-
"is-currency": !0,
|
|
316
|
-
"max-fraction-digits": 2,
|
|
317
|
-
"helper-state": (G = t(h)) != null && G.amount ? "error" : void 0,
|
|
318
|
-
"helper-text": (T = (K = t(h)) == null ? void 0 : K.amount) == null ? void 0 : T[0]
|
|
319
|
-
}, null, 8, ["modelValue", "label", "helper-state", "helper-text"]),
|
|
320
|
-
C.action === "send" && v.type === "coin" ? (y(), z(V, {
|
|
321
|
-
key: 0,
|
|
322
|
-
"model-value": t($),
|
|
323
|
-
label: `${t(c)} expires`,
|
|
324
|
-
"label-placement": "right",
|
|
325
|
-
"onUpdate:modelValue": S[1] || (S[1] = (n) => E(n))
|
|
326
|
-
}, null, 8, ["model-value", "label"])) : se("", !0),
|
|
327
|
-
C.action === "send" && t($) ? (y(), z(Y, {
|
|
328
|
-
key: 1,
|
|
329
|
-
modelValue: t(f).day,
|
|
330
|
-
"onUpdate:modelValue": S[2] || (S[2] = (n) => t(f).day = n),
|
|
331
|
-
label: `${t(c)} expires in`,
|
|
332
|
-
"max-fraction-digits": 0,
|
|
333
|
-
"append-text": "day(s)",
|
|
334
|
-
max: 9999,
|
|
335
|
-
min: 0,
|
|
336
|
-
"helper-state": (d = t(h)) != null && d.day ? "error" : void 0,
|
|
337
|
-
"helper-text": (s = (l = t(h)) == null ? void 0 : l.day) == null ? void 0 : s[0]
|
|
338
|
-
}, null, 8, ["modelValue", "label", "helper-state", "helper-text"])) : se("", !0),
|
|
339
|
-
g(q, {
|
|
340
|
-
modelValue: t(f).remark,
|
|
341
|
-
"onUpdate:modelValue": S[3] || (S[3] = (n) => t(f).remark = n),
|
|
342
|
-
label: "Remark"
|
|
343
|
-
}, null, 8, ["modelValue"])
|
|
344
|
-
]),
|
|
345
|
-
a("div", Tt, [
|
|
346
|
-
g(B, {
|
|
347
|
-
variant: "secondary",
|
|
348
|
-
label: "Cancel",
|
|
349
|
-
size: "md",
|
|
350
|
-
onClick: S[4] || (S[4] = (n) => t(j).close())
|
|
351
|
-
}),
|
|
352
|
-
g(B, {
|
|
353
|
-
disabled: !!t(h),
|
|
354
|
-
variant: "primary",
|
|
355
|
-
label: "Submit",
|
|
356
|
-
size: "md",
|
|
357
|
-
onClick: S[5] || (S[5] = async () => M())
|
|
358
|
-
}, null, 8, ["disabled"])
|
|
359
|
-
])
|
|
360
|
-
];
|
|
361
|
-
}),
|
|
362
|
-
_: 1
|
|
363
|
-
});
|
|
364
|
-
};
|
|
365
|
-
}
|
|
366
|
-
}), Le = mt("segment", () => {
|
|
367
|
-
const C = X([]);
|
|
368
|
-
async function j() {
|
|
369
|
-
const v = await nt.readAll({
|
|
370
|
-
limit: 1e3,
|
|
371
|
-
skip: 0,
|
|
372
|
-
sortBy: "_id",
|
|
373
|
-
descending: !0
|
|
374
|
-
});
|
|
375
|
-
C.value = v.resources;
|
|
376
|
-
}
|
|
377
|
-
return {
|
|
378
|
-
segments: C,
|
|
379
|
-
read: j
|
|
380
|
-
};
|
|
381
|
-
}), kt = { class: "flex flex-col flex-nowrap gap-y-24 max-h-full" }, Mt = { class: "space-y-16" }, At = { class: "flex gap-16 items-center" }, Nt = { class: "flex-auto" }, Vt = { class: "fm-typo-en-body-md-600" }, It = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, $t = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Et = { class: "fm-typo-en-body-md-800" }, Dt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Bt = { class: "fm-typo-en-body-md-600" }, Ut = { class: "gap-16 grid grid-cols-2" }, Pt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ot = { class: "fm-typo-en-body-md-600" }, Rt = { class: "space-y-8" }, Yt = {
|
|
382
|
-
key: 0,
|
|
383
|
-
class: "space-x-8"
|
|
384
|
-
}, Lt = {
|
|
385
|
-
key: 1,
|
|
386
|
-
class: "text-fm-color-typo-secondary"
|
|
387
|
-
}, zt = { class: "space-y-8" }, jt = ["src"], qt = { class: "fm-typo-en-body-md-600" }, Kt = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Gt = {
|
|
388
|
-
key: 1,
|
|
389
|
-
class: "text-fm-color-typo-secondary"
|
|
390
|
-
}, Ht = {
|
|
391
|
-
key: 1,
|
|
392
|
-
class: "space-y-24"
|
|
393
|
-
}, Jt = { class: "space-y-8" }, Xt = { class: "fm-typo-en-title-md-800" }, Wt = { class: "space-y-4" }, Qt = { class: "fm-typo-en-body-md-600" }, Zt = { class: "flex gap-24 items-center xs:flex-col xs:items-start" }, eo = { class: "space-y-8" }, to = { class: "fm-typo-en-title-md-800" }, oo = { class: "space-y-4" }, no = { class: "fm-typo-en-body-md-600" }, so = { class: "flex gap-24 items-center xs:flex-col xs:items-start" }, ao = /* @__PURE__ */ ue({
|
|
394
|
-
__name: "MemberDetailSheet",
|
|
395
|
-
props: {
|
|
396
|
-
member: {
|
|
397
|
-
type: Object,
|
|
398
|
-
required: !0
|
|
399
|
-
}
|
|
400
|
-
},
|
|
401
|
-
emits: ["update:member"],
|
|
402
|
-
setup(C, { expose: j, emit: v }) {
|
|
403
|
-
const f = Re(), $ = ye(), c = Le(), E = be(), { minor: M } = Oe, h = C, D = v, S = L(() => f.locations.map((o) => ({
|
|
404
|
-
label: o.name,
|
|
405
|
-
value: o._id
|
|
406
|
-
}))), Y = L(() => (h.member.segment || []).map((o) => {
|
|
407
|
-
var e;
|
|
408
|
-
return ((e = c.segments.find((u) => u._id === o)) == null ? void 0 : e.name) || "";
|
|
409
|
-
}).filter(Boolean));
|
|
410
|
-
async function V(o, e) {
|
|
411
|
-
E.open({
|
|
412
|
-
title: "",
|
|
413
|
-
dialogComponent: wt,
|
|
414
|
-
dialogComponentProps: {
|
|
415
|
-
type: o,
|
|
416
|
-
action: e,
|
|
417
|
-
onSubmit: async (u) => {
|
|
418
|
-
await M(
|
|
419
|
-
async () => {
|
|
420
|
-
const m = {
|
|
421
|
-
"credit-send": J.sendCredit,
|
|
422
|
-
"credit-deduct": J.deductCredit,
|
|
423
|
-
"coin-send": J.sendCoin,
|
|
424
|
-
"coin-deduct": J.deductCoin
|
|
425
|
-
}, b = `${o}-${e}`, k = m[b];
|
|
426
|
-
k && await k(h.member._id, u), D("update:member"), E.close();
|
|
427
|
-
},
|
|
428
|
-
{
|
|
429
|
-
message: `Adjusting ${pe.formattedType(o.toUpperCase()).toLowerCase()}`,
|
|
430
|
-
successMessage: `${u.amount} ${pe.formattedType(o.toUpperCase()).toLowerCase()} ${e} ${e == "send" ? "to" : "from"} ${h.member.phoneNumber}`
|
|
431
|
-
}
|
|
432
|
-
);
|
|
433
|
-
}
|
|
434
|
-
}
|
|
435
|
-
});
|
|
436
|
-
}
|
|
437
|
-
async function q() {
|
|
438
|
-
E.open({
|
|
439
|
-
title: "Update member statistics",
|
|
440
|
-
contentComponent: Ft,
|
|
441
|
-
contentComponentProps: {
|
|
442
|
-
member: h.member,
|
|
443
|
-
onSubmit: async (o) => {
|
|
444
|
-
await M(
|
|
445
|
-
async () => {
|
|
446
|
-
await J.updateMember(h.member._id, o), D("update:member"), E.close();
|
|
447
|
-
},
|
|
448
|
-
{
|
|
449
|
-
message: "Updating member stats",
|
|
450
|
-
successMessage: `Updated member ${h.member.phoneNumber} stats successfully`
|
|
451
|
-
}
|
|
452
|
-
);
|
|
453
|
-
}
|
|
454
|
-
}
|
|
455
|
-
});
|
|
456
|
-
}
|
|
457
|
-
const B = [
|
|
458
|
-
{
|
|
459
|
-
label: "Mobile No.",
|
|
460
|
-
key: "phoneNumber"
|
|
461
|
-
},
|
|
462
|
-
{
|
|
463
|
-
label: "Tier",
|
|
464
|
-
getter: (o) => {
|
|
465
|
-
var A, U, i, F, p;
|
|
466
|
-
const e = (((U = De.first((A = h.member.collection) == null ? void 0 : A.TIER)) == null ? void 0 : U.balance) || 0) - 1, u = G.value.name, m = ((F = (i = o.collection) == null ? void 0 : i.POINT) == null ? void 0 : F[0].balance) ?? 0, b = $.sortedTiers[e + 1], k = ((p = b == null ? void 0 : b.option) == null ? void 0 : p.to) ?? 1 / 0;
|
|
467
|
-
return `${u} (${m}/${k})`;
|
|
468
|
-
}
|
|
469
|
-
},
|
|
470
|
-
{
|
|
471
|
-
label: "Email",
|
|
472
|
-
key: "email"
|
|
473
|
-
},
|
|
474
|
-
{
|
|
475
|
-
label: "Birthday",
|
|
476
|
-
getter: (o) => o.birthday ? x(o.birthday).format("D MMM YYYY") : "-"
|
|
477
|
-
}
|
|
478
|
-
], W = [
|
|
479
|
-
{
|
|
480
|
-
label: "Customer since",
|
|
481
|
-
getter: (o) => x(Ye(o._id.toString())).format("D MMM YYYY")
|
|
482
|
-
},
|
|
483
|
-
{
|
|
484
|
-
label: "Joined at location",
|
|
485
|
-
getter: (o) => {
|
|
486
|
-
var e;
|
|
487
|
-
return o != null && o.location && ((e = S.value.find((u) => u.value == o.location)) == null ? void 0 : e.label) || "-";
|
|
488
|
-
}
|
|
489
|
-
},
|
|
490
|
-
{
|
|
491
|
-
label: "Total visit(s)",
|
|
492
|
-
getter: (o) => $e.singularOrPlural(o.stats.visitCount, "bill")
|
|
493
|
-
},
|
|
494
|
-
{
|
|
495
|
-
label: "Last visit",
|
|
496
|
-
getter: (o) => x(o.stats.lastVisit).fromNow()
|
|
497
|
-
},
|
|
498
|
-
{
|
|
499
|
-
label: "Frequency",
|
|
500
|
-
getter: (o) => `Every ${$e.singularOrPlural(Number(Math.ceil(o.stats.avgVisitFrequency).toFixed(0)), "day")}`
|
|
501
|
-
},
|
|
502
|
-
{
|
|
503
|
-
label: "Average spend",
|
|
504
|
-
getter: (o) => st.Dinero.fromNumber({ number: Number(o.stats.avgBillSize || 0) }).toFormat(
|
|
505
|
-
!0
|
|
506
|
-
)
|
|
507
|
-
}
|
|
508
|
-
// {
|
|
509
|
-
// label: 'Feedback',
|
|
510
|
-
// key: 'feedbackCount',
|
|
511
|
-
// },
|
|
512
|
-
// {
|
|
513
|
-
// label: 'Tier Earned this season',
|
|
514
|
-
// key: 'lastSeasonTierEarned',
|
|
515
|
-
// },
|
|
516
|
-
// {
|
|
517
|
-
// label: 'Point Earned this season',
|
|
518
|
-
// key: 'lastSeasonPointEarned',
|
|
519
|
-
// },
|
|
520
|
-
], G = L(() => {
|
|
521
|
-
var u, m;
|
|
522
|
-
const o = (((m = De.first((u = h.member.collection) == null ? void 0 : u.TIER)) == null ? void 0 : m.balance) || 0) - 1, e = $.sortedTiers[o];
|
|
523
|
-
return { name: (e == null ? void 0 : e.name) || "-", tier: o, config: e };
|
|
524
|
-
}), K = L(() => {
|
|
525
|
-
var o;
|
|
526
|
-
return (((o = h.member.collection) == null ? void 0 : o.TITLE) || []).map((e) => {
|
|
527
|
-
var m, b, k;
|
|
528
|
-
const u = (m = $.sortedTitles) == null ? void 0 : m.find(
|
|
529
|
-
(A) => A._id == e.collectible
|
|
530
|
-
);
|
|
531
|
-
return {
|
|
532
|
-
name: u == null ? void 0 : u.name,
|
|
533
|
-
expiredAt: (k = (b = e.expiryBalance) == null ? void 0 : b.at(-1)) == null ? void 0 : k.expiredAt,
|
|
534
|
-
collectible: u
|
|
535
|
-
};
|
|
536
|
-
}).filter(
|
|
537
|
-
(e) => e.expiredAt ? x(e.expiredAt).isAfter(x()) : !0
|
|
538
|
-
);
|
|
539
|
-
}), T = X(!0);
|
|
540
|
-
function d() {
|
|
541
|
-
T.value = !0, n.value = s[0];
|
|
542
|
-
}
|
|
543
|
-
function l() {
|
|
544
|
-
T.value = !1;
|
|
545
|
-
}
|
|
546
|
-
const s = [
|
|
547
|
-
{
|
|
548
|
-
label: "Overview",
|
|
549
|
-
value: "overview"
|
|
550
|
-
},
|
|
551
|
-
{
|
|
552
|
-
label: "Loyalty",
|
|
553
|
-
value: "loyalty"
|
|
554
|
-
}
|
|
555
|
-
], n = X(s[0]);
|
|
556
|
-
return Pe(async () => {
|
|
557
|
-
await $.readMembership(), f.locations.length || await f.readLocations();
|
|
558
|
-
}), j({
|
|
559
|
-
showSheet: d,
|
|
560
|
-
hideSheet: l
|
|
561
|
-
}), (o, e) => {
|
|
562
|
-
const u = _("FmTabs"), m = _("FmAvatar"), b = _("FmButton"), k = _("FmChip"), A = _("FmCard"), U = _("FmSideSheet");
|
|
563
|
-
return y(), z(U, {
|
|
564
|
-
modelValue: t(T),
|
|
565
|
-
"onUpdate:modelValue": e[5] || (e[5] = (i) => We(T) ? T.value = i : null),
|
|
566
|
-
header: "Member Detail",
|
|
567
|
-
"dismiss-away": "",
|
|
568
|
-
"close-button": !0,
|
|
569
|
-
"max-width": 550
|
|
570
|
-
}, {
|
|
571
|
-
"side-sheet-footer": ne(() => e[19] || (e[19] = [])),
|
|
572
|
-
default: ne(() => [
|
|
573
|
-
a("div", kt, [
|
|
574
|
-
g(u, {
|
|
575
|
-
"model-value": t(n).value,
|
|
576
|
-
items: s,
|
|
577
|
-
"onUpdate:modelValue": e[0] || (e[0] = (i) => n.value = s.find((F) => F.value === i))
|
|
578
|
-
}, null, 8, ["model-value"]),
|
|
579
|
-
t(n).value == "overview" ? (y(), I(ee, { key: 0 }, [
|
|
580
|
-
e[10] || (e[10] = a("div", { class: "fm-typo-en-title-sm-800" }, "Profile Information", -1)),
|
|
581
|
-
a("div", Mt, [
|
|
582
|
-
a("div", At, [
|
|
583
|
-
g(m, {
|
|
584
|
-
name: C.member.photoUrl ? void 0 : C.member.name,
|
|
585
|
-
src: C.member.photoUrl || void 0
|
|
586
|
-
}, null, 8, ["name", "src"]),
|
|
587
|
-
a("div", Nt, [
|
|
588
|
-
e[7] || (e[7] = a("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " Member Name ", -1)),
|
|
589
|
-
a("div", Vt, N(C.member.name), 1),
|
|
590
|
-
a("div", It, N(C.member._id), 1),
|
|
591
|
-
a("div", $t, [
|
|
592
|
-
e[6] || (e[6] = fe(" Member Card: ")),
|
|
593
|
-
a("span", Et, N(C.member.cardNo ? C.member.cardNo : "-"), 1)
|
|
594
|
-
])
|
|
595
|
-
]),
|
|
596
|
-
g(b, {
|
|
597
|
-
variant: "tertiary",
|
|
598
|
-
icon: "settings",
|
|
599
|
-
onClick: q
|
|
600
|
-
})
|
|
601
|
-
]),
|
|
602
|
-
(y(), I(ee, null, ae(B, (i, F) => a("div", { key: F }, [
|
|
603
|
-
a("div", Dt, N(i.label), 1),
|
|
604
|
-
a("div", Bt, N(i.key ? C.member[i.key] : i.getter(C.member)), 1)
|
|
605
|
-
])), 64))
|
|
606
|
-
]),
|
|
607
|
-
e[11] || (e[11] = a("div", { class: "border-fm-color-neutral-gray-100 rounded-sm border-t" }, null, -1)),
|
|
608
|
-
e[12] || (e[12] = a("div", { class: "fm-typo-en-title-sm-800" }, "Activities", -1)),
|
|
609
|
-
a("div", Ut, [
|
|
610
|
-
(y(), I(ee, null, ae(W, (i) => a("div", {
|
|
611
|
-
key: i.key
|
|
612
|
-
}, [
|
|
613
|
-
a("div", Pt, N(i.label), 1),
|
|
614
|
-
a("div", Ot, N(i.key ? h.member.stats[i.key] || "-" : i.getter(C.member)), 1)
|
|
615
|
-
])), 64))
|
|
616
|
-
]),
|
|
617
|
-
e[13] || (e[13] = a("div", { class: "border-fm-color-neutral-gray-100 rounded-sm border-t" }, null, -1)),
|
|
618
|
-
a("div", Rt, [
|
|
619
|
-
e[8] || (e[8] = a("div", { class: "fm-typo-en-title-sm-800" }, "Segments", -1)),
|
|
620
|
-
t(Y).length ? (y(), I("div", Yt, [
|
|
621
|
-
(y(!0), I(ee, null, ae(t(Y), (i) => (y(), z(k, {
|
|
622
|
-
label: i.toString()
|
|
623
|
-
}, null, 8, ["label"]))), 256))
|
|
624
|
-
])) : (y(), I("div", Lt, "No titles"))
|
|
625
|
-
]),
|
|
626
|
-
e[14] || (e[14] = a("div", { class: "border-fm-color-neutral-gray-100 rounded-sm border-t" }, null, -1)),
|
|
627
|
-
a("div", zt, [
|
|
628
|
-
e[9] || (e[9] = a("div", { class: "fm-typo-en-title-sm-800" }, "Title badge", -1)),
|
|
629
|
-
t(K).length ? (y(!0), I(ee, { key: 0 }, ae(t(K).filter((i) => i.collectible), (i) => (y(), I("div", {
|
|
630
|
-
class: "flex items-center gap-x-8 h-48",
|
|
631
|
-
key: i.name
|
|
632
|
-
}, [
|
|
633
|
-
a("img", {
|
|
634
|
-
src: i.collectible.image || t(at),
|
|
635
|
-
class: "aspect-square h-full object-contain"
|
|
636
|
-
}, null, 8, jt),
|
|
637
|
-
a("div", null, [
|
|
638
|
-
a("div", qt, N(i.name), 1),
|
|
639
|
-
a("div", Kt, " Expired on " + N(t(x)(i.expiredAt).format("MMM D, Y")), 1)
|
|
640
|
-
])
|
|
641
|
-
]))), 128)) : (y(), I("div", Gt, "No titles"))
|
|
642
|
-
])
|
|
643
|
-
], 64)) : t(n).value == "loyalty" ? (y(), I("div", Ht, [
|
|
644
|
-
g(A, {
|
|
645
|
-
class: "p-16 space-y-24",
|
|
646
|
-
variant: "outlined"
|
|
647
|
-
}, {
|
|
648
|
-
default: ne(() => {
|
|
649
|
-
var i, F, p, w, P, Q, Z;
|
|
650
|
-
return [
|
|
651
|
-
a("div", Jt, [
|
|
652
|
-
e[15] || (e[15] = a("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " Credit ", -1)),
|
|
653
|
-
a("div", Xt, N(((p = (F = (i = C.member.collection) == null ? void 0 : i.CREDIT) == null ? void 0 : F[0]) == null ? void 0 : p.balance) ?? 0), 1)
|
|
654
|
-
]),
|
|
655
|
-
a("div", Wt, [
|
|
656
|
-
e[16] || (e[16] = a("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " Credit(s) to be expired in 30 days ", -1)),
|
|
657
|
-
a("div", Qt, N(((Z = (Q = (P = (w = C.member.collection) == null ? void 0 : w.CREDIT) == null ? void 0 : P[0]) == null ? void 0 : Q.expiryBalance) == null ? void 0 : Z.reduce(
|
|
658
|
-
(O, R) => R.expiredAt && t(x)(R.expiredAt).isAfter(t(x)()) && t(x)(R.expiredAt).isBefore(t(x)().add(30, "days")) ? O + R.amount : O,
|
|
659
|
-
0
|
|
660
|
-
)) ?? 0), 1)
|
|
661
|
-
]),
|
|
662
|
-
a("div", Zt, [
|
|
663
|
-
g(b, {
|
|
664
|
-
label: "Add credit",
|
|
665
|
-
icon: "add",
|
|
666
|
-
variant: "plain",
|
|
667
|
-
onClick: e[1] || (e[1] = (O) => V("credit", "send"))
|
|
668
|
-
}),
|
|
669
|
-
g(b, {
|
|
670
|
-
label: "Deduct credit",
|
|
671
|
-
icon: "remove",
|
|
672
|
-
variant: "plain",
|
|
673
|
-
onClick: e[2] || (e[2] = (O) => V("credit", "deduct"))
|
|
674
|
-
})
|
|
675
|
-
])
|
|
676
|
-
];
|
|
677
|
-
}),
|
|
678
|
-
_: 1
|
|
679
|
-
}),
|
|
680
|
-
g(A, {
|
|
681
|
-
class: "p-16 space-y-24",
|
|
682
|
-
variant: "outlined"
|
|
683
|
-
}, {
|
|
684
|
-
default: ne(() => {
|
|
685
|
-
var i, F, p, w, P, Q, Z;
|
|
686
|
-
return [
|
|
687
|
-
a("div", eo, [
|
|
688
|
-
e[17] || (e[17] = a("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " Point ", -1)),
|
|
689
|
-
a("div", to, N(((p = (F = (i = C.member.collection) == null ? void 0 : i.COIN) == null ? void 0 : F[0]) == null ? void 0 : p.balance) ?? 0), 1)
|
|
690
|
-
]),
|
|
691
|
-
a("div", oo, [
|
|
692
|
-
e[18] || (e[18] = a("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " Point(s) to be expired in 30 days ", -1)),
|
|
693
|
-
a("div", no, N(((Z = (Q = (P = (w = C.member.collection) == null ? void 0 : w.COIN) == null ? void 0 : P[0]) == null ? void 0 : Q.expiryBalance) == null ? void 0 : Z.reduce(
|
|
694
|
-
(O, R) => R.expiredAt && t(x)(R.expiredAt).isAfter(t(x)()) && t(x)(R.expiredAt).isBefore(t(x)().add(30, "days")) ? O + R.amount : O,
|
|
695
|
-
0
|
|
696
|
-
)) ?? 0), 1)
|
|
697
|
-
]),
|
|
698
|
-
a("div", so, [
|
|
699
|
-
g(b, {
|
|
700
|
-
label: "Add point",
|
|
701
|
-
icon: "add",
|
|
702
|
-
variant: "plain",
|
|
703
|
-
onClick: e[3] || (e[3] = (O) => V("coin", "send"))
|
|
704
|
-
}),
|
|
705
|
-
g(b, {
|
|
706
|
-
label: "Deduct point",
|
|
707
|
-
icon: "remove",
|
|
708
|
-
variant: "plain",
|
|
709
|
-
onClick: e[4] || (e[4] = (O) => V("coin", "deduct"))
|
|
710
|
-
})
|
|
711
|
-
])
|
|
712
|
-
];
|
|
713
|
-
}),
|
|
714
|
-
_: 1
|
|
715
|
-
})
|
|
716
|
-
])) : se("", !0)
|
|
717
|
-
])
|
|
718
|
-
]),
|
|
719
|
-
_: 1
|
|
720
|
-
}, 8, ["modelValue"]);
|
|
721
|
-
};
|
|
722
|
-
}
|
|
723
|
-
}), io = { class: "flex items-center justify-end" }, Vo = /* @__PURE__ */ ue({
|
|
724
|
-
__name: "MemberList",
|
|
725
|
-
setup(C) {
|
|
726
|
-
const j = Le(), v = ye(), f = Re(), { minor: $ } = Oe, c = yt(), E = [
|
|
727
|
-
{
|
|
728
|
-
header: "Name",
|
|
729
|
-
enableSorting: !0,
|
|
730
|
-
accessorKey: "name",
|
|
731
|
-
cell(s) {
|
|
732
|
-
return pt(s.row.original);
|
|
733
|
-
}
|
|
734
|
-
},
|
|
735
|
-
{
|
|
736
|
-
accessorFn: (s) => x(Ye(s._id.toString())).format("D MMM YYYY"),
|
|
737
|
-
header: "Customer Since",
|
|
738
|
-
accessorKey: "_id",
|
|
739
|
-
id: "_id"
|
|
740
|
-
},
|
|
741
|
-
{
|
|
742
|
-
accessorKey: "collection_TIER_0_balance",
|
|
743
|
-
header: "Tier",
|
|
744
|
-
enableSorting: !0,
|
|
745
|
-
cell(s) {
|
|
746
|
-
return ft(
|
|
747
|
-
s.row.original,
|
|
748
|
-
v.sortedTiers
|
|
749
|
-
);
|
|
750
|
-
}
|
|
751
|
-
},
|
|
752
|
-
{
|
|
753
|
-
header: "Title",
|
|
754
|
-
enableSorting: !1,
|
|
755
|
-
cell(s) {
|
|
756
|
-
return bt(
|
|
757
|
-
s.row.original,
|
|
758
|
-
v.sortedTitles
|
|
759
|
-
);
|
|
760
|
-
}
|
|
761
|
-
},
|
|
762
|
-
{
|
|
763
|
-
accessorKey: "collection_CREDIT_0_balance",
|
|
764
|
-
accessorFn: (s) => {
|
|
765
|
-
var n, o, e;
|
|
766
|
-
return me(((e = (o = (n = s.collection) == null ? void 0 : n.CREDIT) == null ? void 0 : o[0]) == null ? void 0 : e.balance) ?? 0, 2);
|
|
767
|
-
},
|
|
768
|
-
header: "Credit(s)",
|
|
769
|
-
enableSorting: !0
|
|
770
|
-
},
|
|
771
|
-
{
|
|
772
|
-
accessorKey: "collection_POINT_0_balance",
|
|
773
|
-
accessorFn: (s) => {
|
|
774
|
-
var n, o, e;
|
|
775
|
-
return me(((e = (o = (n = s.collection) == null ? void 0 : n.POINT) == null ? void 0 : o[0]) == null ? void 0 : e.balance) ?? 0, 2);
|
|
776
|
-
},
|
|
777
|
-
header: "Experience(s)",
|
|
778
|
-
enableSorting: !0
|
|
779
|
-
},
|
|
780
|
-
{
|
|
781
|
-
accessorKey: "collection_COIN_0_balance",
|
|
782
|
-
accessorFn: (s) => {
|
|
783
|
-
var n, o, e;
|
|
784
|
-
return me(((e = (o = (n = s.collection) == null ? void 0 : n.COIN) == null ? void 0 : o[0]) == null ? void 0 : e.balance) ?? 0, 2);
|
|
785
|
-
},
|
|
786
|
-
header: "Point(s)",
|
|
787
|
-
enableSorting: !0
|
|
788
|
-
},
|
|
789
|
-
{
|
|
790
|
-
accessorFn: (s) => {
|
|
791
|
-
var n;
|
|
792
|
-
return ((n = s.stats) == null ? void 0 : n.visitCount) ?? 0;
|
|
793
|
-
},
|
|
794
|
-
header: "Total visit",
|
|
795
|
-
accessorKey: "stats.visitCount",
|
|
796
|
-
id: "stats.visitCount"
|
|
797
|
-
},
|
|
798
|
-
{
|
|
799
|
-
accessorFn: (s) => {
|
|
800
|
-
var n;
|
|
801
|
-
return (n = s.stats) == null ? void 0 : n.lastVisit;
|
|
802
|
-
},
|
|
803
|
-
sortingFn: (s, n) => {
|
|
804
|
-
var o, e;
|
|
805
|
-
return new Date((o = s.original.stats) == null ? void 0 : o.lastVisit).getTime() - new Date((e = n.original.stats) == null ? void 0 : e.lastVisit).getTime();
|
|
806
|
-
},
|
|
807
|
-
id: "stats.lastVisit",
|
|
808
|
-
header: "Last visit",
|
|
809
|
-
cell(s) {
|
|
810
|
-
var n, o;
|
|
811
|
-
return oe("div", { class: "flex items-center justify-end gap-4" }, [
|
|
812
|
-
oe(
|
|
813
|
-
"span",
|
|
814
|
-
(n = s.row.original.stats) != null && n.lastVisit ? x((o = s.row.original.stats) == null ? void 0 : o.lastVisit).fromNow() : "NA"
|
|
815
|
-
),
|
|
816
|
-
oe(
|
|
817
|
-
de.FmTooltip,
|
|
818
|
-
{
|
|
819
|
-
content: x(s.row.original.stats.lastVisit).format(
|
|
820
|
-
"D MMM YYYY - hh:mmA"
|
|
821
|
-
)
|
|
822
|
-
},
|
|
823
|
-
[oe(de.FmIcon, { name: "info", outline: !0, size: "sm" })]
|
|
824
|
-
)
|
|
825
|
-
]);
|
|
826
|
-
}
|
|
827
|
-
},
|
|
828
|
-
{
|
|
829
|
-
id: "actions",
|
|
830
|
-
cell(s) {
|
|
831
|
-
return oe(
|
|
832
|
-
de.FmMenu,
|
|
833
|
-
{
|
|
834
|
-
placement: "bottom-end",
|
|
835
|
-
onClick: (n) => {
|
|
836
|
-
n.stopPropagation();
|
|
837
|
-
}
|
|
838
|
-
},
|
|
839
|
-
{
|
|
840
|
-
"menu-button": () => oe(de.FmButton, { icon: "more_vert", variant: "tertiary" }),
|
|
841
|
-
default: () => [
|
|
842
|
-
oe(de.FmMenuItem, {
|
|
843
|
-
label: "Transaction details",
|
|
844
|
-
onClick: async (n) => {
|
|
845
|
-
n.stopPropagation(), await K(s.row.original._id);
|
|
846
|
-
}
|
|
847
|
-
})
|
|
848
|
-
]
|
|
849
|
-
}
|
|
850
|
-
);
|
|
851
|
-
}
|
|
852
|
-
}
|
|
853
|
-
], { tableMeta: M, rowData: h, onSort: D, debouncedFetchData: S, onSearch: Y } = et(J.read), V = X(), q = X(!1), B = X();
|
|
854
|
-
async function W() {
|
|
855
|
-
B.value = await J.readById(
|
|
856
|
-
B.value._id.toString()
|
|
857
|
-
), q.value = !0;
|
|
858
|
-
}
|
|
859
|
-
async function G() {
|
|
860
|
-
await S(), q.value = !1;
|
|
861
|
-
}
|
|
862
|
-
async function K(s) {
|
|
863
|
-
await c.push({
|
|
864
|
-
name: vt["$connect-LOYALTY_MEMBER_TRANSACTIONS"],
|
|
865
|
-
params: { id: s }
|
|
866
|
-
});
|
|
867
|
-
}
|
|
868
|
-
const T = {
|
|
869
|
-
sortBy: "_id",
|
|
870
|
-
descending: !1,
|
|
871
|
-
rowsPerPage: 1e3,
|
|
872
|
-
page: 1,
|
|
873
|
-
rowsNumber: 0
|
|
874
|
-
};
|
|
875
|
-
function d(s) {
|
|
876
|
-
const n = x(s);
|
|
877
|
-
return n.isValid() ? n.format("DD/MM/YYYY") : "";
|
|
878
|
-
}
|
|
879
|
-
async function l() {
|
|
880
|
-
const s = new Ze(), n = (await J.read({
|
|
881
|
-
limit: 1,
|
|
882
|
-
skip: 0,
|
|
883
|
-
sortBy: T.sortBy,
|
|
884
|
-
descending: T.descending
|
|
885
|
-
})).meta.totalResources ?? 0, o = T.rowsPerPage;
|
|
886
|
-
await $(
|
|
887
|
-
async () => {
|
|
888
|
-
var e, u, m, b, k, A, U, i, F, p, w, P, Q, Z, O, R, ve, xe, ge, Ce, Se, Fe, _e, he, Te, we, ke;
|
|
889
|
-
for (let Me = 0; Me < n; Me += o) {
|
|
890
|
-
const ze = {
|
|
891
|
-
...T,
|
|
892
|
-
limit: o,
|
|
893
|
-
skip: T.page - 1,
|
|
894
|
-
sortBy: T.sortBy,
|
|
895
|
-
descending: T.descending
|
|
896
|
-
}, je = await J.read(ze);
|
|
897
|
-
for (const r of je.resources) {
|
|
898
|
-
const qe = (e = Qe.parseOneAddress(
|
|
899
|
-
r == null ? void 0 : r.email
|
|
900
|
-
)) != null && e.domain.includes("feedmepos.com") ? void 0 : r.email, Ke = (m = ((u = r == null ? void 0 : r.collection) == null ? void 0 : u.TITLE) || []) == null ? void 0 : m.reduce(
|
|
901
|
-
(H, te) => {
|
|
902
|
-
var re, le;
|
|
903
|
-
const ie = (le = (re = v.sortedTitles) == null ? void 0 : re.find(
|
|
904
|
-
(ce) => ce._id === te.collectible
|
|
905
|
-
)) == null ? void 0 : le.name;
|
|
906
|
-
return !ie || te.balance <= 0 || H.push(ie), H;
|
|
907
|
-
},
|
|
908
|
-
[]
|
|
909
|
-
), Ge = (v.sortedTitles || []).reduce(
|
|
910
|
-
(H, te) => {
|
|
911
|
-
var re, le, ce, Ve;
|
|
912
|
-
const ie = (Ve = (ce = (le = (((re = r == null ? void 0 : r.collection) == null ? void 0 : re.TITLE) || []).find(
|
|
913
|
-
(Xe) => Xe.collectible === te._id
|
|
914
|
-
)) == null ? void 0 : le.expiryBalance) == null ? void 0 : ce[0]) == null ? void 0 : Ve.expiredAt;
|
|
915
|
-
return H[te.name] = ie ? x(ie).format("DD/MM/YYYY") : "", H;
|
|
916
|
-
},
|
|
917
|
-
{}
|
|
918
|
-
), He = ((A = (k = (b = r.collection) == null ? void 0 : b.CREDIT) == null ? void 0 : k.at(0)) == null ? void 0 : A.balance) || 0, Ae = ((p = (F = (i = (U = r.collection) == null ? void 0 : U.CREDIT) == null ? void 0 : i.at(0)) == null ? void 0 : F.expiryBalance) == null ? void 0 : p.reduce(
|
|
919
|
-
(H, te) => H + te.amount,
|
|
920
|
-
0
|
|
921
|
-
)) || 0, Ne = me(He, 2), Je = {
|
|
922
|
-
ID: r._id.toString(),
|
|
923
|
-
Name: ((w = r.name) == null ? void 0 : w.trim()) || "",
|
|
924
|
-
Phone: ((P = r == null ? void 0 : r.phoneNumber) == null ? void 0 : P.trim()) || "",
|
|
925
|
-
Email: qe || "",
|
|
926
|
-
Gender: r.gender || "",
|
|
927
|
-
CardNo: r.cardNo || "",
|
|
928
|
-
Birthday: d((r == null ? void 0 : r.birthday) || void 0),
|
|
929
|
-
Credit: (Number(Ne) - Number(Ae)).toFixed(2),
|
|
930
|
-
FreeCredit: Number(Ae.toFixed(2)),
|
|
931
|
-
TotalCredit: Number(Ne),
|
|
932
|
-
Exp: r != null && r.collection ? ((O = (Z = (Q = r.collection) == null ? void 0 : Q.POINT) == null ? void 0 : Z.at(0)) == null ? void 0 : O.balance) ?? 0 : 0,
|
|
933
|
-
Point: r != null && r.collection ? ((xe = (ve = (R = r.collection) == null ? void 0 : R.COIN) == null ? void 0 : ve.at(0)) == null ? void 0 : xe.balance) ?? 0 : 0,
|
|
934
|
-
Level: r != null && r.collection ? ((Se = (Ce = (ge = r.collection) == null ? void 0 : ge.TIER) == null ? void 0 : Ce.at(0)) == null ? void 0 : Se.balance) ?? 0 : 0,
|
|
935
|
-
Tier: r != null && r.collection ? ((he = (_e = (Fe = r.collection) == null ? void 0 : Fe.TIER) == null ? void 0 : _e.at(0)) == null ? void 0 : he.balance) ?? 0 : 0,
|
|
936
|
-
Titles: Ke.join(","),
|
|
937
|
-
...Ge,
|
|
938
|
-
TotalTransaction: r.stats.visitCount,
|
|
939
|
-
AvgSpent: ut(Number(r.stats.avgBillSize || 0)).toFormat(
|
|
940
|
-
!1
|
|
941
|
-
),
|
|
942
|
-
TotalSpent: r.stats.avgBillSize * r.stats.visitCount,
|
|
943
|
-
LastVisit: d(r.stats.lastVisit),
|
|
944
|
-
Feedback: ((Te = r.stats) == null ? void 0 : Te.feedbackCount) || 0,
|
|
945
|
-
LastSeasonTierEarned: ((we = r.stats) == null ? void 0 : we.lastSeasonTierEarned) || 0,
|
|
946
|
-
LastSeasonPointEarned: ((ke = r.stats) == null ? void 0 : ke.lastSeasonPointEarned) || 0,
|
|
947
|
-
JoinedAt: d(r.joinAt || void 0),
|
|
948
|
-
VisitFrequency: `${Number(
|
|
949
|
-
Math.ceil(r.stats.avgVisitFrequency).toFixed(0)
|
|
950
|
-
)}`
|
|
951
|
-
};
|
|
952
|
-
s.addRecord(Je);
|
|
953
|
-
}
|
|
954
|
-
T.page++;
|
|
955
|
-
}
|
|
956
|
-
await ot(
|
|
957
|
-
s.buildExcel(),
|
|
958
|
-
`members-${(/* @__PURE__ */ new Date()).toISOString()}.xlsx`,
|
|
959
|
-
{
|
|
960
|
-
bookType: "xlsx",
|
|
961
|
-
bookSST: !1,
|
|
962
|
-
type: "array"
|
|
963
|
-
}
|
|
964
|
-
), T.page = 1;
|
|
965
|
-
},
|
|
966
|
-
{
|
|
967
|
-
message: "Exporting member...",
|
|
968
|
-
successMessage: "Member exported successfully"
|
|
969
|
-
}
|
|
970
|
-
);
|
|
971
|
-
}
|
|
972
|
-
return Pe(async () => {
|
|
973
|
-
await v.readMembership(), await f.readLocations(), await j.read(), await S();
|
|
974
|
-
}), (s, n) => {
|
|
975
|
-
const o = _("FmSearch"), e = _("FmButton"), u = _("FmSnackbar");
|
|
976
|
-
return y(), I("div", null, [
|
|
977
|
-
a("div", io, [
|
|
978
|
-
g(o, {
|
|
979
|
-
class: "mt-4",
|
|
980
|
-
modelValue: t(M).searchValue,
|
|
981
|
-
"onUpdate:modelValue": [
|
|
982
|
-
n[0] || (n[0] = (m) => t(M).searchValue = m),
|
|
983
|
-
t(Y)
|
|
984
|
-
],
|
|
985
|
-
placeholder: "Search",
|
|
986
|
-
collapsible: ""
|
|
987
|
-
}, null, 8, ["modelValue", "onUpdate:modelValue"]),
|
|
988
|
-
g(e, {
|
|
989
|
-
icon: "ios_share",
|
|
990
|
-
variant: "tertiary",
|
|
991
|
-
onClick: l
|
|
992
|
-
})
|
|
993
|
-
]),
|
|
994
|
-
Be(g(u, {
|
|
995
|
-
"z-index": 0,
|
|
996
|
-
class: "!max-w-full my-16",
|
|
997
|
-
title: "Info",
|
|
998
|
-
description: "Current list is not up to date, please refresh table for latest data.",
|
|
999
|
-
variant: "info",
|
|
1000
|
-
dismissable: "",
|
|
1001
|
-
onOnDismiss: n[1] || (n[1] = (m) => q.value = !1),
|
|
1002
|
-
action: "Refresh",
|
|
1003
|
-
onOnAction: G
|
|
1004
|
-
}, null, 512), [
|
|
1005
|
-
[Ue, t(q)]
|
|
1006
|
-
]),
|
|
1007
|
-
g(tt, {
|
|
1008
|
-
loading: t(M).isLoading,
|
|
1009
|
-
"row-data": t(h),
|
|
1010
|
-
"row-count": t(M).totalRows,
|
|
1011
|
-
"column-defs": E,
|
|
1012
|
-
"shrink-at": !1,
|
|
1013
|
-
"page-count": t(M).pageCount,
|
|
1014
|
-
"page-index": t(M).pageIndex,
|
|
1015
|
-
"page-size": t(M).pageSize,
|
|
1016
|
-
onSortChange: t(D),
|
|
1017
|
-
onPageChange: n[2] || (n[2] = (m) => t(S)({ pageSize: m.pageSize, pageIndex: m.pageIndex })),
|
|
1018
|
-
onRowClick: n[3] || (n[3] = (m) => {
|
|
1019
|
-
var b;
|
|
1020
|
-
B.value = m.original, (b = t(V)) == null || b.showSheet();
|
|
1021
|
-
})
|
|
1022
|
-
}, null, 8, ["loading", "row-data", "row-count", "page-count", "page-index", "page-size", "onSortChange"]),
|
|
1023
|
-
t(B) ? (y(), z(ao, {
|
|
1024
|
-
key: 0,
|
|
1025
|
-
ref_key: "sheetRef",
|
|
1026
|
-
ref: V,
|
|
1027
|
-
member: t(B),
|
|
1028
|
-
"onUpdate:member": W
|
|
1029
|
-
}, null, 8, ["member"])) : se("", !0)
|
|
1030
|
-
]);
|
|
1031
|
-
};
|
|
1032
|
-
}
|
|
1033
|
-
});
|
|
1034
|
-
export {
|
|
1035
|
-
Vo as default
|
|
1036
|
-
};
|