@feedmepos/mf-connect 0.1.38-beta.74 → 0.1.38-beta.75
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-9B27Q-I3.js +761 -0
- package/dist/App-isiE4pjM.js +4642 -0
- package/dist/AuditLogs-BmHr7pNI.js +1991 -0
- package/dist/Bin-BR06pDbx.js +166 -0
- package/dist/Broadcast-D_t80J2I.js +267 -0
- package/dist/CampaignTypeDialog.vue_vue_type_script_setup_true_lang-C5IuPCTB.js +121 -0
- package/dist/Card-Zs-1lcSr.js +910 -0
- package/dist/ChipMenu.vue_vue_type_script_setup_true_lang-BPpZZNkr.js +97 -0
- package/dist/Collections-BjeTJSHo.js +541 -0
- package/dist/Credit-DdmdsxOF.js +261 -0
- package/dist/CustomSelect.vue_vue_type_script_setup_true_lang-Du7fRSZC.js +128 -0
- package/dist/DateInput.vue_vue_type_script_setup_true_lang-BN4Q5Y3l.js +54 -0
- package/dist/DateRangeChip.vue_vue_type_script_setup_true_lang-eIoPtgO5.js +58 -0
- package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-DkOfrONH.js +3120 -0
- package/dist/EffectSheet.vue_vue_type_style_index_0_lang-kzk3iEKA.js +351 -0
- package/dist/Experience-WxtE9ZIT.js +260 -0
- package/dist/FileSaver.min-Vgxo4jNi.js +74 -0
- package/dist/FilterChip.vue_vue_type_script_setup_true_lang-DaU-9GzO.js +129 -0
- package/dist/Game-Cc0mZ3y4.js +331 -0
- package/dist/GenerateMaterial-Dsvnpz4o.js +589 -0
- package/dist/Grab-CcaXToD-.js +301 -0
- package/dist/ImageInput.vue_vue_type_script_setup_true_lang-D0yJMgs9.js +145 -0
- package/dist/Index-C0TcFJJY.js +259 -0
- package/dist/JsonViewer-v8_C7l5N.js +87 -0
- package/dist/LocationPicker.vue_vue_type_script_setup_true_lang-CXFtSS9_.js +48 -0
- package/dist/LottieAnimation.vue_vue_type_script_setup_true_lang-Ca7hKpcD.js +18737 -0
- package/dist/MainLayout-DPpjvWwq.js +41 -0
- package/dist/Marketing-DfXuNM7X.js +145 -0
- package/dist/MarketingMaterialEdit-C63qyQSd.js +746 -0
- package/dist/Member-LTYVn-80.js +280 -0
- package/dist/MemberList-Gqr6ha5p.js +1601 -0
- package/dist/MemberOverview-wL_ailso.js +58 -0
- package/dist/MemberTransactions-CVZ-SPhm.js +45 -0
- package/dist/MessageInput.vue_vue_type_script_setup_true_lang-BGooFTgg.js +60799 -0
- package/dist/Mission-CLQdNsOe.js +335 -0
- package/dist/Overview-BluyLBRI.js +1078 -0
- package/dist/Point-DQLQxJG1.js +263 -0
- package/dist/Promotion-BG0xL1ed.js +397 -0
- package/dist/Queue-BR7TrLI8.js +259 -0
- package/dist/Record-2WFpDhAb.js +341 -0
- package/dist/Review-Bu9SGftr.js +617 -0
- package/dist/ReviewFacebookCallback-CV99Udei.js +243 -0
- package/dist/ReviewGoogleCallback-DiqgQzOt.js +213 -0
- package/dist/Reward-CPhM3ChT.js +442 -0
- package/dist/RewardGroup.vue_vue_type_script_setup_true_lang-Q9pVq11w.js +149 -0
- package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-BRUQtqjv.js +1912 -0
- package/dist/Segment-D6V8FKUY.js +881 -0
- package/dist/SelectItems.vue_vue_type_script_setup_true_lang-BrE1gGHP.js +181 -0
- package/dist/SendCollectionSheet.vue_vue_type_script_setup_true_lang-DQhO9k7V.js +188 -0
- package/dist/SendVoucherSheet.vue_vue_type_script_setup_true_lang-CyHx6m95.js +147 -0
- package/dist/Setting-Bh5bB75w.js +2000 -0
- package/dist/SettingAdvertisements-CFUjq6s1.js +264 -0
- package/dist/Store-DiVaUn7w.js +1996 -0
- package/dist/StoreRewards-Bb9iW3Yz.js +535 -0
- package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-DVFsPzLK.js +1129 -0
- package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-D9uZR0si.js +7005 -0
- package/dist/Tier-BYxLjqAB.js +970 -0
- package/dist/Title-D3cdNE2O.js +568 -0
- package/dist/Transaction-D7ItbBra.js +39 -0
- package/dist/UserRuleGroup.vue_vue_type_script_setup_true_lang-UXSlpEM0.js +130 -0
- package/dist/Voucher-DNQz_ujN.js +422 -0
- package/dist/VoucherEditor.vue_vue_type_script_setup_true_lang-CztGuaCV.js +421 -0
- package/dist/ZodTextField.vue_vue_type_script_setup_true_lang-RI0mY3Nx.js +56 -0
- package/dist/_plugin-vue_export-helper-CHgC5LLL.js +9 -0
- package/dist/app-wDQR6dpb.js +39 -0
- package/dist/app-zPef9Uzl.js +59396 -0
- package/dist/app.js +7 -0
- package/dist/business-DKEB57Mf.js +82 -0
- package/dist/campaign-BD_s6pW4.js +100 -0
- package/dist/campaign-CpzFl8Vr.js +4 -0
- package/dist/campaign-D9IfNIPI.js +253 -0
- package/dist/campaign.enum-gPz5hWSW.js +26 -0
- package/dist/campaign.fn-Csxad3W7.js +776 -0
- package/dist/collectible.enum-CA-QbTP-.js +19 -0
- package/dist/collection.fn-tFxG0UiA.js +26 -0
- package/dist/dto-CdvywxS_.js +222 -0
- package/dist/duplicateCampaign-Cj68m0Ti.js +51 -0
- package/dist/effect-KecOJIEK.js +89 -0
- package/dist/email-addresses-Ske7sY-s.js +705 -0
- package/dist/export-17vDh5vq.js +97 -0
- package/dist/feedme.ico +0 -0
- package/dist/helper-B-ZDFjy7.js +86 -0
- package/dist/index-BRZC-Cy5.js +85 -0
- package/dist/index-BV_G-XzK.js +30289 -0
- package/dist/index-BwLCkOIF.js +36 -0
- package/dist/index-C1Z4oibL.js +48 -0
- package/dist/index-CNLqZu6_.js +2639 -0
- package/dist/index-CdByBgmF.js +32 -0
- package/dist/index-CkqQGjg1.js +8912 -0
- package/dist/index-CuvNtC_M.js +61 -0
- package/dist/index-D05Pcg0E.js +124 -0
- package/dist/index-D58_aTiN.js +28897 -0
- package/dist/index-DCzjjZgV.js +67 -0
- package/dist/index-DY3_9zbY.js +3431 -0
- package/dist/index-Dc2JsMD2.js +54 -0
- package/dist/index-Dh78uGTl.js +146 -0
- package/dist/index-DnrSd_o_.js +3 -0
- package/dist/index-vh86FiIQ.js +10 -0
- package/dist/index-woXH3LmA.js +31 -0
- package/dist/index.esm2017-DxQe1gCt.js +3069 -0
- package/dist/loading-B1ymwDT_.js +71 -0
- package/dist/lodash-BiGSPE0G.js +3678 -0
- package/dist/membership-GnNCDGBk.js +235 -0
- package/dist/moment-D7p2TMB-.js +2583 -0
- package/dist/money-CG6LGklW.js +15 -0
- package/dist/number-p19we-YD.js +12 -0
- package/dist/object-qECH92oz.js +26 -0
- package/dist/objectId-dwaoBfJX.js +7 -0
- package/dist/objectid-XhaZoPQl.js +145 -0
- package/dist/plugins-cxSxZO0d.js +1817 -0
- package/dist/remy-D_Deb3ue.js +13 -0
- package/dist/reward-siULTu5h.js +36 -0
- package/dist/rule-GD9oMCPH.js +1969 -0
- package/dist/rule-builder-DWFem4d5.js +102 -0
- package/dist/style.css +13 -0
- package/dist/template-o23nw6e2.js +188 -0
- package/dist/tier-BJDhpH6X.js +4 -0
- package/dist/tiers/tier=1.png +0 -0
- package/dist/tiers/tier=2.png +0 -0
- package/dist/tiers/tier=3.png +0 -0
- package/dist/tiers/tier=4.png +0 -0
- package/dist/timezone-BVwygiRH.js +1154 -0
- package/dist/titles/type=diamond.png +0 -0
- package/dist/titles/type=drinks.png +0 -0
- package/dist/titles/type=food.png +0 -0
- package/dist/titles/type=heart.png +0 -0
- package/dist/titles/type=medal.png +0 -0
- package/dist/titles/type=spend.png +0 -0
- package/dist/titles/type=thank-you.png +0 -0
- package/dist/titles/type=thumbs-up.png +0 -0
- package/dist/titles/type=years.png +0 -0
- package/dist/trigger-CrEBP1aZ.js +213 -0
- package/dist/tslib.es6-BCqqvLQ_.js +44 -0
- package/dist/type_drinks-D6jnpvwV.js +4 -0
- package/dist/usePagination-BbTCnhtY.js +266 -0
- package/dist/user-DcMEufQ6.js +55 -0
- package/dist/vue-i18n-BxV_u4BZ.js +2365 -0
- package/dist/xlsx-BnJDxONa.js +15491 -0
- package/dist/zod-CUN5LrI6.js +91 -0
- package/package.json +1 -1
|
@@ -0,0 +1,1129 @@
|
|
|
1
|
+
import { ref as P, defineComponent as te, computed as j, h as s, resolveComponent as Y, openBlock as V, createBlock as se, unref as l, isRef as Se, withCtx as le, createElementVNode as _, createVNode as I, createElementBlock as B, Fragment as J, renderList as ie, toDisplayString as G, createTextVNode as _e, resolveDynamicComponent as we, watch as ce, onBeforeMount as Ce, onMounted as Te } from "vue";
|
|
2
|
+
import { components as v, useDialog as Re } from "@feedmepos/ui-library";
|
|
3
|
+
import { r as Z } from "./index-DY3_9zbY.js";
|
|
4
|
+
import "./index-BV_G-XzK.js";
|
|
5
|
+
import { s as Ie } from "./index-woXH3LmA.js";
|
|
6
|
+
import { h as C } from "./moment-D7p2TMB-.js";
|
|
7
|
+
import { _ as X } from "./FilterChip.vue_vue_type_script_setup_true_lang-DaU-9GzO.js";
|
|
8
|
+
import { _ as ue } from "./DateRangeChip.vue_vue_type_script_setup_true_lang-eIoPtgO5.js";
|
|
9
|
+
import { s as q } from "./index-CuvNtC_M.js";
|
|
10
|
+
import { f as ee } from "./number-p19we-YD.js";
|
|
11
|
+
import { u as me } from "./business-DKEB57Mf.js";
|
|
12
|
+
import { _ as de, u as Fe } from "./usePagination-BbTCnhtY.js";
|
|
13
|
+
import { a as ae, c as De, p as Ee } from "./plugins-cxSxZO0d.js";
|
|
14
|
+
import { g as pe } from "./user-DcMEufQ6.js";
|
|
15
|
+
import { B as fe, e as Ae } from "./export-17vDh5vq.js";
|
|
16
|
+
import { u as ge } from "./campaign-BD_s6pW4.js";
|
|
17
|
+
import "./index-DnrSd_o_.js";
|
|
18
|
+
import "./index-CNLqZu6_.js";
|
|
19
|
+
import "./index-CkqQGjg1.js";
|
|
20
|
+
import "./index-Dc2JsMD2.js";
|
|
21
|
+
import { u as ye } from "./vue-i18n-BxV_u4BZ.js";
|
|
22
|
+
import { o as U } from "./objectId-dwaoBfJX.js";
|
|
23
|
+
import { u as he } from "./loading-B1ymwDT_.js";
|
|
24
|
+
import { w as Ne } from "./xlsx-BnJDxONa.js";
|
|
25
|
+
import { useRouter as Pe } from "vue-router";
|
|
26
|
+
import { t as L } from "./index-DCzjjZgV.js";
|
|
27
|
+
import { R as W } from "./app-zPef9Uzl.js";
|
|
28
|
+
import { F as Q } from "./collectible.enum-CA-QbTP-.js";
|
|
29
|
+
import { useCoreStore as Me } from "@feedmepos/mf-common";
|
|
30
|
+
import { m as Oe } from "./index-Dh78uGTl.js";
|
|
31
|
+
function ke(c) {
|
|
32
|
+
let p = "";
|
|
33
|
+
switch (c) {
|
|
34
|
+
case "PORTAL":
|
|
35
|
+
p = "ADMIN";
|
|
36
|
+
break;
|
|
37
|
+
case "BENEFIT":
|
|
38
|
+
p = "MEMBERSHIP";
|
|
39
|
+
break;
|
|
40
|
+
case "ORDER":
|
|
41
|
+
p = "ORDER";
|
|
42
|
+
break;
|
|
43
|
+
case "BILL":
|
|
44
|
+
p = "SPENDING";
|
|
45
|
+
break;
|
|
46
|
+
case "CASHBACK":
|
|
47
|
+
p = "CASHBACK";
|
|
48
|
+
break;
|
|
49
|
+
case "CYCLE":
|
|
50
|
+
p = "EXPIRED";
|
|
51
|
+
break;
|
|
52
|
+
case "COUNTER_CONSUME":
|
|
53
|
+
p = "COUNTER REDEEM";
|
|
54
|
+
break;
|
|
55
|
+
default:
|
|
56
|
+
p = c;
|
|
57
|
+
break;
|
|
58
|
+
}
|
|
59
|
+
return p;
|
|
60
|
+
}
|
|
61
|
+
function Ve(c) {
|
|
62
|
+
var p, u, m, x, h, T;
|
|
63
|
+
switch ((p = c == null ? void 0 : c.pf_collectible) == null ? void 0 : p.type) {
|
|
64
|
+
case "VOUCHER":
|
|
65
|
+
return `${(u = c.pf_collectible) == null ? void 0 : u.type} (${(m = c.pf_collectible) == null ? void 0 : m.name})`;
|
|
66
|
+
case "TITLE":
|
|
67
|
+
return `${(x = c.pf_collectible) == null ? void 0 : x.type} (${(h = c.pf_collectible) == null ? void 0 : h.name})`;
|
|
68
|
+
case "POINT":
|
|
69
|
+
return "Experience";
|
|
70
|
+
case "COIN":
|
|
71
|
+
return "Point";
|
|
72
|
+
default:
|
|
73
|
+
return Ie((T = c == null ? void 0 : c.pf_collectible) == null ? void 0 : T.type);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
function ze(c) {
|
|
77
|
+
switch (c) {
|
|
78
|
+
case "ONLINE":
|
|
79
|
+
return "Online";
|
|
80
|
+
case "COIN":
|
|
81
|
+
return "Point";
|
|
82
|
+
default:
|
|
83
|
+
return c;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
const z = {
|
|
87
|
+
getReason: ke,
|
|
88
|
+
formattedType: Ve,
|
|
89
|
+
formattedPaymentType: ze
|
|
90
|
+
}, Be = (c) => {
|
|
91
|
+
if (c.startsWith("_") || c.includes("."))
|
|
92
|
+
return c;
|
|
93
|
+
for (const p of ["pf_user_", "pf_collectible_"])
|
|
94
|
+
if (c.startsWith(p))
|
|
95
|
+
return `${p.slice(0, -1)}.${c.slice(p.length).replace(new RegExp("_", "g"), ".")}`;
|
|
96
|
+
return c.replace(new RegExp("_", "g"), ".");
|
|
97
|
+
};
|
|
98
|
+
function Ue(c, p = { key: "_id", descending: !0 }) {
|
|
99
|
+
const u = P({
|
|
100
|
+
pageCount: 1,
|
|
101
|
+
searchValue: "",
|
|
102
|
+
pageIndex: 0,
|
|
103
|
+
totalRows: 0,
|
|
104
|
+
isLoading: !1,
|
|
105
|
+
pageSize: 10,
|
|
106
|
+
hasNext: !1
|
|
107
|
+
}), m = P(p), x = P([]), h = P([void 0]);
|
|
108
|
+
function T() {
|
|
109
|
+
h.value = [void 0], u.value.pageIndex = 0, u.value.pageCount = 1, u.value.hasNext = !1;
|
|
110
|
+
}
|
|
111
|
+
const M = async (n = {}) => {
|
|
112
|
+
const o = n.pageSize ?? u.value.pageSize, b = o !== u.value.pageSize;
|
|
113
|
+
b && T();
|
|
114
|
+
const y = b ? 0 : Math.max(n.pageIndex ?? u.value.pageIndex, 0), R = y === 0 || !!h.value[y] ? y : u.value.pageIndex, K = h.value[R];
|
|
115
|
+
u.value.isLoading = !0, u.value.pageSize = o, x.value = [];
|
|
116
|
+
try {
|
|
117
|
+
const A = await c({
|
|
118
|
+
limit: o,
|
|
119
|
+
sortBy: m.value.key,
|
|
120
|
+
descending: m.value.descending,
|
|
121
|
+
search: u.value.searchValue,
|
|
122
|
+
...K ? { cursor: K } : {}
|
|
123
|
+
});
|
|
124
|
+
x.value = A.resources, u.value.pageIndex = R, u.value.totalRows = A.resources.length, u.value.hasNext = A.meta.hasNext, u.value.pageCount = R + (A.meta.hasNext ? 2 : 1), A.meta.nextCursor ? h.value[R + 1] = A.meta.nextCursor : h.value.splice(R + 1);
|
|
125
|
+
} catch (A) {
|
|
126
|
+
console.error("Error fetching data:", A), u.value.hasNext = !1;
|
|
127
|
+
} finally {
|
|
128
|
+
u.value.isLoading = !1;
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
let F, g;
|
|
132
|
+
const f = (n) => (F && clearTimeout(F), g && g(), new Promise((o) => {
|
|
133
|
+
g = o, F = setTimeout(async () => {
|
|
134
|
+
F = void 0, g = void 0, await M(n), o();
|
|
135
|
+
}, 200);
|
|
136
|
+
}));
|
|
137
|
+
return {
|
|
138
|
+
tableMeta: u,
|
|
139
|
+
rowData: x,
|
|
140
|
+
sortBy: m,
|
|
141
|
+
pageCursors: h,
|
|
142
|
+
resetCursorState: T,
|
|
143
|
+
fetchData: M,
|
|
144
|
+
debouncedFetchData: f,
|
|
145
|
+
onSort: async (n) => {
|
|
146
|
+
n.length ? m.value = {
|
|
147
|
+
key: Be(n[0].id),
|
|
148
|
+
descending: n[0].desc
|
|
149
|
+
} : m.value = p, T(), await f({
|
|
150
|
+
pageIndex: 0,
|
|
151
|
+
pageSize: u.value.pageSize
|
|
152
|
+
});
|
|
153
|
+
},
|
|
154
|
+
onSearch: () => (T(), f({
|
|
155
|
+
pageIndex: 0,
|
|
156
|
+
pageSize: u.value.pageSize
|
|
157
|
+
}))
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
class Ye extends fe {
|
|
161
|
+
}
|
|
162
|
+
const $e = { class: "space-y-24 pr-12" }, Le = { class: "w-full space-y-16" }, Ke = { class: "fm-typo-en-body-lg-600" }, He = ["onClick"], Ge = { class: "fm-typo-en-body-lg-600" }, We = ["onClick"], je = { class: "flex items-center gap-8" }, qe = /* @__PURE__ */ te({
|
|
163
|
+
__name: "TransactionDetailSheet",
|
|
164
|
+
setup(c, { expose: p }) {
|
|
165
|
+
ye();
|
|
166
|
+
const u = P(!1), m = P(), x = ge(), h = me();
|
|
167
|
+
function T(f, a) {
|
|
168
|
+
u.value = f, m.value = a ?? null;
|
|
169
|
+
}
|
|
170
|
+
const M = j(() => {
|
|
171
|
+
var f, a;
|
|
172
|
+
return ee(
|
|
173
|
+
((a = m.value) == null ? void 0 : a.expiryAmount.reduce(
|
|
174
|
+
(e, n) => e + n.amount,
|
|
175
|
+
((f = m.value) == null ? void 0 : f.amount) ?? 0
|
|
176
|
+
)) ?? 0,
|
|
177
|
+
2
|
|
178
|
+
);
|
|
179
|
+
}), F = j(() => {
|
|
180
|
+
var f, a, e, n, o;
|
|
181
|
+
return m.value ? [
|
|
182
|
+
{
|
|
183
|
+
label: "Transaction ID",
|
|
184
|
+
value: (f = m.value) == null ? void 0 : f._id
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
label: "Date/Time",
|
|
188
|
+
value: C(U(m.value._id.toString())).format(
|
|
189
|
+
"D MMM YYYY, hh:mmA"
|
|
190
|
+
)
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
label: "Amount",
|
|
194
|
+
component: () => s(
|
|
195
|
+
"span",
|
|
196
|
+
{
|
|
197
|
+
class: [
|
|
198
|
+
"pr-2",
|
|
199
|
+
+M.value > 0 ? "text-fm-color-system-success-300" : "text-fm-color-system-error-300"
|
|
200
|
+
]
|
|
201
|
+
},
|
|
202
|
+
M.value
|
|
203
|
+
)
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
label: "Type",
|
|
207
|
+
value: z.formattedType(m.value)
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
label: "Source",
|
|
211
|
+
value: q(z.getReason(m.value.source))
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
label: "User",
|
|
215
|
+
value: (e = (a = m.value) == null ? void 0 : a.pf_user) == null ? void 0 : e.name
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
label: "Phone Number",
|
|
219
|
+
value: (o = (n = m.value) == null ? void 0 : n.pf_user) == null ? void 0 : o.phoneNumber
|
|
220
|
+
}
|
|
221
|
+
] : [];
|
|
222
|
+
}), g = j(() => {
|
|
223
|
+
var n, o, b, y;
|
|
224
|
+
if (!m.value) return [];
|
|
225
|
+
const f = [], a = (n = m.value) == null ? void 0 : n.metadata, e = m.value;
|
|
226
|
+
if (a != null && a.campaign) {
|
|
227
|
+
const w = x.campaigns.all.find(
|
|
228
|
+
(R) => R._id === (a == null ? void 0 : a.campaign)
|
|
229
|
+
);
|
|
230
|
+
if (!w) return;
|
|
231
|
+
f.push({
|
|
232
|
+
label: "Campaign",
|
|
233
|
+
value: w.name
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
return a != null && a.remark && f.push({
|
|
237
|
+
label: "Remark",
|
|
238
|
+
value: a.remark
|
|
239
|
+
}), (o = m.value) != null && o.ref.startsWith("bill_") && f.push({
|
|
240
|
+
label: "Bill Number",
|
|
241
|
+
value: (b = m.value) == null ? void 0 : b.ref,
|
|
242
|
+
copy: () => {
|
|
243
|
+
var w;
|
|
244
|
+
return ae((w = m.value) == null ? void 0 : w.ref);
|
|
245
|
+
}
|
|
246
|
+
}), a != null && a.location && f.push({
|
|
247
|
+
label: "Location",
|
|
248
|
+
value: (y = h.locations.find(
|
|
249
|
+
(w) => w._id.toString() === (a == null ? void 0 : a.location)
|
|
250
|
+
)) == null ? void 0 : y.name
|
|
251
|
+
}), e.source === Z.enum.STORE && f.push({
|
|
252
|
+
label: "Store Transaction",
|
|
253
|
+
value: e.ref
|
|
254
|
+
}), a != null && a.originTransaction && f.push({
|
|
255
|
+
label: "Parent Transaction",
|
|
256
|
+
value: a.originTransaction
|
|
257
|
+
}), a != null && a.referral_count && f.push({
|
|
258
|
+
label: "Referral Count",
|
|
259
|
+
value: a.referral_count
|
|
260
|
+
}), e.refundedFrom && f.push({
|
|
261
|
+
label: "Refunded From",
|
|
262
|
+
value: e.refundedFrom
|
|
263
|
+
}), f;
|
|
264
|
+
});
|
|
265
|
+
return p({
|
|
266
|
+
showSheet: T
|
|
267
|
+
}), (f, a) => {
|
|
268
|
+
const e = Y("FmButton"), n = Y("FmSideSheet");
|
|
269
|
+
return V(), se(n, {
|
|
270
|
+
"max-width": 560,
|
|
271
|
+
modelValue: l(u),
|
|
272
|
+
"onUpdate:modelValue": a[1] || (a[1] = (o) => Se(u) ? u.value = o : null),
|
|
273
|
+
header: "Transaction Details"
|
|
274
|
+
}, {
|
|
275
|
+
"side-sheet-footer": le(() => [
|
|
276
|
+
_("div", je, [
|
|
277
|
+
I(e, {
|
|
278
|
+
label: "Close",
|
|
279
|
+
onClick: a[0] || (a[0] = (o) => T(!1)),
|
|
280
|
+
variant: "tertiary"
|
|
281
|
+
})
|
|
282
|
+
])
|
|
283
|
+
]),
|
|
284
|
+
default: le(() => [
|
|
285
|
+
_("div", $e, [
|
|
286
|
+
_("div", Le, [
|
|
287
|
+
(V(!0), B(J, null, ie(l(F), (o) => (V(), B("div", {
|
|
288
|
+
key: o.label,
|
|
289
|
+
class: "flex flex-col gap-4"
|
|
290
|
+
}, [
|
|
291
|
+
_("div", Ke, G(o.label), 1),
|
|
292
|
+
_("div", {
|
|
293
|
+
class: "text-fm-color-typo-secondary fm-typo-en-body-md-400 hover:underline",
|
|
294
|
+
onClick: o.copy
|
|
295
|
+
}, [
|
|
296
|
+
_e(G(o.accessorFn ? o.accessorFn() : o.value) + " ", 1),
|
|
297
|
+
(V(), se(we(o.component)))
|
|
298
|
+
], 8, He),
|
|
299
|
+
a[2] || (a[2] = _("hr", { class: "mt-3" }, null, -1))
|
|
300
|
+
]))), 128)),
|
|
301
|
+
(V(!0), B(J, null, ie(l(g), (o) => (V(), B("div", {
|
|
302
|
+
key: o.label,
|
|
303
|
+
class: "flex flex-col gap-4"
|
|
304
|
+
}, [
|
|
305
|
+
_("div", Ge, G(o.label), 1),
|
|
306
|
+
_("div", {
|
|
307
|
+
class: "text-fm-color-typo-secondary fm-typo-en-body-md-400 hover:underline",
|
|
308
|
+
onClick: o.copy
|
|
309
|
+
}, G(o.accessorFn ? o.accessorFn() : o.value), 9, We),
|
|
310
|
+
a[3] || (a[3] = _("hr", { class: "mt-3" }, null, -1))
|
|
311
|
+
]))), 128))
|
|
312
|
+
])
|
|
313
|
+
])
|
|
314
|
+
]),
|
|
315
|
+
_: 1
|
|
316
|
+
}, 8, ["modelValue"]);
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
}), Xe = { class: "hidden xs:!flex items-center justify-end" }, Qe = { class: "flex items-center justify-between" }, Je = { class: "flex gap-8 items-center w-full overflow-x-scroll" }, Ze = { class: "xs:hidden" }, Mt = /* @__PURE__ */ te({
|
|
320
|
+
__name: "CollectionTransactions",
|
|
321
|
+
props: {
|
|
322
|
+
user: {
|
|
323
|
+
type: String
|
|
324
|
+
}
|
|
325
|
+
},
|
|
326
|
+
setup(c) {
|
|
327
|
+
const { t: p } = ye(), u = me(), m = ge(), x = Pe(), h = c, T = P(!1), { minor: M } = he, F = [
|
|
328
|
+
{
|
|
329
|
+
header: "Transaction ID",
|
|
330
|
+
accessorKey: "_id",
|
|
331
|
+
meta: {
|
|
332
|
+
maxWidth: "100px"
|
|
333
|
+
},
|
|
334
|
+
cell(t) {
|
|
335
|
+
return s("div", { class: "flex items-center" }, [
|
|
336
|
+
s(v.FmIcon, {
|
|
337
|
+
name: "content_copy",
|
|
338
|
+
outline: !0,
|
|
339
|
+
size: "sm",
|
|
340
|
+
class: "cursor-pointer mr-4",
|
|
341
|
+
onClick: (r) => {
|
|
342
|
+
r.preventDefault(), r.stopPropagation(), ae(t.row.original._id.toString());
|
|
343
|
+
}
|
|
344
|
+
}),
|
|
345
|
+
s(
|
|
346
|
+
"div",
|
|
347
|
+
{ class: "pr-2 text-ellipsis overflow-hidden" },
|
|
348
|
+
t.row.original._id.toString()
|
|
349
|
+
)
|
|
350
|
+
]);
|
|
351
|
+
},
|
|
352
|
+
enableSorting: !1
|
|
353
|
+
},
|
|
354
|
+
{
|
|
355
|
+
header: "Created at",
|
|
356
|
+
accessorKey: "_id",
|
|
357
|
+
accessorFn: (t) => C(U(t._id.toString())),
|
|
358
|
+
cell: (t) => C(U(t.row.original._id.toString())).format(
|
|
359
|
+
"D MMM YYYY, hh:mmA"
|
|
360
|
+
),
|
|
361
|
+
enableSorting: !0
|
|
362
|
+
},
|
|
363
|
+
{
|
|
364
|
+
header: "Amount",
|
|
365
|
+
// accessorKey: 'totalAmount',
|
|
366
|
+
enableSorting: !1,
|
|
367
|
+
cell(t) {
|
|
368
|
+
var d, i, D, N;
|
|
369
|
+
const r = ee(
|
|
370
|
+
t.row.original.expiryAmount.reduce(
|
|
371
|
+
($, O) => $ + O.amount,
|
|
372
|
+
t.row.original.amount ?? 0
|
|
373
|
+
),
|
|
374
|
+
2
|
|
375
|
+
), S = (i = (d = t.row.original.expiryAmount) == null ? void 0 : d[0]) != null && i.expiredAt ? C((N = (D = t.row.original.expiryAmount) == null ? void 0 : D[0]) == null ? void 0 : N.expiredAt).format(
|
|
376
|
+
"D MMM YYYY"
|
|
377
|
+
) : "";
|
|
378
|
+
return s("div", { class: "flex items-center" }, [
|
|
379
|
+
s(
|
|
380
|
+
"div",
|
|
381
|
+
{
|
|
382
|
+
class: [
|
|
383
|
+
"pr-2",
|
|
384
|
+
+r > 0 ? "text-fm-color-system-success-300" : "text-fm-color-system-error-300"
|
|
385
|
+
]
|
|
386
|
+
},
|
|
387
|
+
r
|
|
388
|
+
),
|
|
389
|
+
s("div", { class: "flex items-center" }, [
|
|
390
|
+
t.row.original.expiryAmount.length > 0 ? s(
|
|
391
|
+
v.FmTooltip,
|
|
392
|
+
{
|
|
393
|
+
content: `Expired on ${S}`
|
|
394
|
+
},
|
|
395
|
+
[
|
|
396
|
+
s(v.FmIcon, {
|
|
397
|
+
name: "info",
|
|
398
|
+
outline: !0,
|
|
399
|
+
size: "sm"
|
|
400
|
+
})
|
|
401
|
+
]
|
|
402
|
+
) : s("div")
|
|
403
|
+
])
|
|
404
|
+
]);
|
|
405
|
+
}
|
|
406
|
+
},
|
|
407
|
+
{
|
|
408
|
+
header: "Type",
|
|
409
|
+
accessorKey: "pf_collectible.type",
|
|
410
|
+
accessorFn: (t) => z.formattedType(t),
|
|
411
|
+
meta: {
|
|
412
|
+
maxWidth: "200px"
|
|
413
|
+
},
|
|
414
|
+
cell(t) {
|
|
415
|
+
const r = z.formattedType(t.row.original);
|
|
416
|
+
return s("div", { class: "flex items-center" }, [
|
|
417
|
+
s("div", { class: "truncate text-ellipsis" }, r),
|
|
418
|
+
r.length > 20 ? s(
|
|
419
|
+
v.FmTooltip,
|
|
420
|
+
{
|
|
421
|
+
content: r
|
|
422
|
+
},
|
|
423
|
+
[
|
|
424
|
+
s(v.FmIcon, {
|
|
425
|
+
name: "info",
|
|
426
|
+
color: "primary",
|
|
427
|
+
outline: !0,
|
|
428
|
+
size: "sm"
|
|
429
|
+
})
|
|
430
|
+
]
|
|
431
|
+
) : null
|
|
432
|
+
]);
|
|
433
|
+
}
|
|
434
|
+
},
|
|
435
|
+
{
|
|
436
|
+
header: "Source",
|
|
437
|
+
accessorKey: "source",
|
|
438
|
+
cell(t) {
|
|
439
|
+
var r;
|
|
440
|
+
return s("div", { class: "flex items-center gap-4" }, [
|
|
441
|
+
s(
|
|
442
|
+
"div",
|
|
443
|
+
{ class: "truncate text-ellipsis" },
|
|
444
|
+
q(z.getReason(t.row.original.source))
|
|
445
|
+
),
|
|
446
|
+
...(r = t.row.original.metadata) != null && r.campaign ? [
|
|
447
|
+
s(
|
|
448
|
+
v.FmTooltip,
|
|
449
|
+
{
|
|
450
|
+
get content() {
|
|
451
|
+
var S;
|
|
452
|
+
return (S = m.campaigns.all.find(
|
|
453
|
+
(d) => {
|
|
454
|
+
var i;
|
|
455
|
+
return d._id === ((i = t.row.original.metadata) == null ? void 0 : i.campaign);
|
|
456
|
+
}
|
|
457
|
+
)) == null ? void 0 : S.name;
|
|
458
|
+
}
|
|
459
|
+
},
|
|
460
|
+
[
|
|
461
|
+
s(v.FmIcon, {
|
|
462
|
+
name: "info",
|
|
463
|
+
color: "primary",
|
|
464
|
+
size: "sm",
|
|
465
|
+
onClick: async (S) => {
|
|
466
|
+
S.preventDefault(), S.stopPropagation();
|
|
467
|
+
const d = m.campaigns.all.find(
|
|
468
|
+
(i) => {
|
|
469
|
+
var D;
|
|
470
|
+
return i._id === ((D = t.row.original.metadata) == null ? void 0 : D.campaign);
|
|
471
|
+
}
|
|
472
|
+
);
|
|
473
|
+
if (d)
|
|
474
|
+
switch (d.type) {
|
|
475
|
+
case "VOUCHER":
|
|
476
|
+
case "PROMOTION":
|
|
477
|
+
case "BROADCAST":
|
|
478
|
+
await x.push({
|
|
479
|
+
name: W[`$connect-CAMPAIGN_${d.type}`]
|
|
480
|
+
});
|
|
481
|
+
break;
|
|
482
|
+
case "GAME":
|
|
483
|
+
case "CREDIT":
|
|
484
|
+
case "MISSION":
|
|
485
|
+
await x.push({
|
|
486
|
+
name: W[`$connect-PROGRAM_${d.type}`]
|
|
487
|
+
});
|
|
488
|
+
break;
|
|
489
|
+
case "POINT":
|
|
490
|
+
await x.push({
|
|
491
|
+
name: W["$connect-PROGRAM_EXPERIENCE"]
|
|
492
|
+
});
|
|
493
|
+
break;
|
|
494
|
+
case "COIN":
|
|
495
|
+
await x.push({
|
|
496
|
+
name: W["$connect-PROGRAM_POINT"]
|
|
497
|
+
});
|
|
498
|
+
break;
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
})
|
|
502
|
+
]
|
|
503
|
+
)
|
|
504
|
+
] : []
|
|
505
|
+
]);
|
|
506
|
+
}
|
|
507
|
+
},
|
|
508
|
+
{
|
|
509
|
+
header: "User",
|
|
510
|
+
accessorKey: "pf_user.name",
|
|
511
|
+
cell(t) {
|
|
512
|
+
return pe(t.row.original.pf_user);
|
|
513
|
+
}
|
|
514
|
+
},
|
|
515
|
+
{
|
|
516
|
+
header: "Phone No.",
|
|
517
|
+
accessorKey: "pf_user.phoneNumber",
|
|
518
|
+
accessorFn: (t) => {
|
|
519
|
+
var r;
|
|
520
|
+
return ((r = t == null ? void 0 : t.pf_user) == null ? void 0 : r.phoneNumber) || "";
|
|
521
|
+
}
|
|
522
|
+
},
|
|
523
|
+
{
|
|
524
|
+
header: "Status",
|
|
525
|
+
id: "status",
|
|
526
|
+
enableSorting: !1,
|
|
527
|
+
cell(t) {
|
|
528
|
+
const r = !!t.row.original.refunded;
|
|
529
|
+
return s(v.FmChip, {
|
|
530
|
+
label: p(r ? "connect.transaction.refunded" : "connect.transaction.completed"),
|
|
531
|
+
variant: "plain",
|
|
532
|
+
class: r ? "text-fm-color-typo-warning bg-fm-color-system-warning-100" : "text-fm-color-typo-success bg-fm-color-system-success-100"
|
|
533
|
+
});
|
|
534
|
+
}
|
|
535
|
+
},
|
|
536
|
+
{
|
|
537
|
+
accessorFn: (t) => t.ref,
|
|
538
|
+
header: "References",
|
|
539
|
+
accessorKey: "ref",
|
|
540
|
+
cell(t) {
|
|
541
|
+
var r, S;
|
|
542
|
+
return s("div", { class: "flex items-center justify-between gap-4" }, [
|
|
543
|
+
s("div", { class: "flex items-center" }, [
|
|
544
|
+
(r = t.row.original.metadata) != null && r.remark ? s(
|
|
545
|
+
v.FmTooltip,
|
|
546
|
+
{
|
|
547
|
+
content: (S = t.row.original.metadata) == null ? void 0 : S.remark
|
|
548
|
+
},
|
|
549
|
+
[
|
|
550
|
+
s(v.FmIcon, {
|
|
551
|
+
name: "info",
|
|
552
|
+
class: "pl-2",
|
|
553
|
+
outline: !0,
|
|
554
|
+
size: "sm"
|
|
555
|
+
})
|
|
556
|
+
]
|
|
557
|
+
) : s("div")
|
|
558
|
+
]),
|
|
559
|
+
s("div", { class: "flex-1" }, t.row.original.ref)
|
|
560
|
+
]);
|
|
561
|
+
}
|
|
562
|
+
},
|
|
563
|
+
{
|
|
564
|
+
header: "Actions",
|
|
565
|
+
cell(t) {
|
|
566
|
+
const r = t.row.original;
|
|
567
|
+
return s(
|
|
568
|
+
v.FmTooltip,
|
|
569
|
+
{
|
|
570
|
+
get content() {
|
|
571
|
+
return "Revert Transaction";
|
|
572
|
+
}
|
|
573
|
+
},
|
|
574
|
+
[
|
|
575
|
+
s(v.FmButton, {
|
|
576
|
+
variant: "tertiary",
|
|
577
|
+
icon: "amend",
|
|
578
|
+
iconColor: "neutral-gray-400",
|
|
579
|
+
disabled: !r.isRevertable,
|
|
580
|
+
onClick: (S) => {
|
|
581
|
+
S.stopPropagation(), K(r);
|
|
582
|
+
}
|
|
583
|
+
})
|
|
584
|
+
]
|
|
585
|
+
);
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
], g = P({
|
|
589
|
+
search: "",
|
|
590
|
+
"pf_collectible.type": [],
|
|
591
|
+
"metadata.location": [],
|
|
592
|
+
dateRange: {
|
|
593
|
+
startDate: C().subtract(7, "day").toISOString(),
|
|
594
|
+
endDate: C().endOf("day").toISOString()
|
|
595
|
+
},
|
|
596
|
+
source: []
|
|
597
|
+
}), f = () => ({
|
|
598
|
+
...g.value,
|
|
599
|
+
user: h.user,
|
|
600
|
+
dateRange: {
|
|
601
|
+
start: new Date(g.value.dateRange.startDate).toISOString(),
|
|
602
|
+
end: new Date(g.value.dateRange.endDate).toISOString()
|
|
603
|
+
}
|
|
604
|
+
}), { tableMeta: a, rowData: e, onSort: n, debouncedFetchData: o, resetCursorState: b } = Ue(async (t) => {
|
|
605
|
+
const r = await L.readAllCursor(
|
|
606
|
+
t,
|
|
607
|
+
f()
|
|
608
|
+
);
|
|
609
|
+
return {
|
|
610
|
+
resources: await Promise.all(
|
|
611
|
+
r.resources.map(async (d) => {
|
|
612
|
+
let i;
|
|
613
|
+
if (d.source !== Z.enum.BILL)
|
|
614
|
+
i = !1;
|
|
615
|
+
else {
|
|
616
|
+
const N = d.refunded || !!d.refundedFrom;
|
|
617
|
+
if (d.expiryAmount.reduce(
|
|
618
|
+
(O, k) => O + k.amount,
|
|
619
|
+
d.amount ?? 0
|
|
620
|
+
) > 0) {
|
|
621
|
+
let O = [];
|
|
622
|
+
[
|
|
623
|
+
Q.enum.STAMP,
|
|
624
|
+
Q.enum.POINT
|
|
625
|
+
].includes(d.pf_collectible.type) ? i = !1 : i = !N;
|
|
626
|
+
} else
|
|
627
|
+
switch (d.pf_collectible.type) {
|
|
628
|
+
case Q.enum.VOUCHER:
|
|
629
|
+
i = d.expiryAmount.some(
|
|
630
|
+
(k) => !k.expiredAt || C(k.expiredAt).isAfter(C())
|
|
631
|
+
) && !N;
|
|
632
|
+
break;
|
|
633
|
+
default:
|
|
634
|
+
i = !N;
|
|
635
|
+
break;
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
const D = y.value.find((N) => N._id === d.ref);
|
|
639
|
+
return {
|
|
640
|
+
...d,
|
|
641
|
+
ref: (D == null ? void 0 : D.seqNumber) || d.ref,
|
|
642
|
+
isRevertable: i
|
|
643
|
+
};
|
|
644
|
+
})
|
|
645
|
+
),
|
|
646
|
+
meta: r.meta
|
|
647
|
+
};
|
|
648
|
+
}), y = P([]), w = Z.options.map((t) => ({ label: q(z.getReason(t)), value: t })), R = j(
|
|
649
|
+
() => u.locations.map((t) => ({ label: t.name, value: t._id }))
|
|
650
|
+
);
|
|
651
|
+
ce(
|
|
652
|
+
g,
|
|
653
|
+
() => {
|
|
654
|
+
b(), o({ pageIndex: 0 });
|
|
655
|
+
},
|
|
656
|
+
{ deep: !0 }
|
|
657
|
+
);
|
|
658
|
+
async function K(t) {
|
|
659
|
+
M(
|
|
660
|
+
async () => {
|
|
661
|
+
await L.revertTransaction({
|
|
662
|
+
id: t._id.toString()
|
|
663
|
+
}), await o();
|
|
664
|
+
},
|
|
665
|
+
{
|
|
666
|
+
message: "Reverting transaction...",
|
|
667
|
+
successMessage: "Transaction reverted successfully"
|
|
668
|
+
}
|
|
669
|
+
);
|
|
670
|
+
}
|
|
671
|
+
async function A() {
|
|
672
|
+
try {
|
|
673
|
+
T.value = !0;
|
|
674
|
+
const t = new Ye(), r = f(), S = 1e3;
|
|
675
|
+
await M(
|
|
676
|
+
async () => {
|
|
677
|
+
var D, N, $, O, k, ne, re;
|
|
678
|
+
let d, i = !0;
|
|
679
|
+
for (; i; ) {
|
|
680
|
+
const H = await L.readAllCursor(
|
|
681
|
+
{
|
|
682
|
+
limit: S,
|
|
683
|
+
sortBy: "_id",
|
|
684
|
+
descending: !1,
|
|
685
|
+
...d ? { cursor: d } : {}
|
|
686
|
+
},
|
|
687
|
+
r
|
|
688
|
+
);
|
|
689
|
+
if (!H.resources.length)
|
|
690
|
+
break;
|
|
691
|
+
for (const E of H.resources)
|
|
692
|
+
t.addRecord({
|
|
693
|
+
TransactionID: E._id,
|
|
694
|
+
CreatedAt: C(U(E._id.toString())).format(
|
|
695
|
+
"D MMM YYYY, hh:mmA"
|
|
696
|
+
),
|
|
697
|
+
Amount: ee(
|
|
698
|
+
E.expiryAmount.reduce(
|
|
699
|
+
(xe, be) => xe + be.amount,
|
|
700
|
+
E.amount ?? 0
|
|
701
|
+
),
|
|
702
|
+
2
|
|
703
|
+
),
|
|
704
|
+
ExpiredAt: (N = (D = E.expiryAmount) == null ? void 0 : D[0]) != null && N.expiredAt ? C((O = ($ = E.expiryAmount) == null ? void 0 : $[0]) == null ? void 0 : O.expiredAt).format("D MMM YYYY") : "",
|
|
705
|
+
Type: z.formattedType(E),
|
|
706
|
+
Source: q(z.getReason(E.source)),
|
|
707
|
+
User: ((k = E.pf_user) == null ? void 0 : k.name) || "",
|
|
708
|
+
"Phone No.": ((ne = E.pf_user) == null ? void 0 : ne.phoneNumber) || "",
|
|
709
|
+
References: E.ref,
|
|
710
|
+
Remark: ((re = E.metadata) == null ? void 0 : re.remark) || ""
|
|
711
|
+
});
|
|
712
|
+
d = H.meta.nextCursor ?? void 0, i = H.meta.hasNext && !!d;
|
|
713
|
+
}
|
|
714
|
+
await Ne(
|
|
715
|
+
t.buildExcel(),
|
|
716
|
+
`transactions-${(/* @__PURE__ */ new Date()).toISOString()}.xlsx`,
|
|
717
|
+
{
|
|
718
|
+
bookType: "xlsx",
|
|
719
|
+
bookSST: !1,
|
|
720
|
+
type: "array"
|
|
721
|
+
}
|
|
722
|
+
);
|
|
723
|
+
},
|
|
724
|
+
{
|
|
725
|
+
message: "Exporting transactions...",
|
|
726
|
+
successMessage: "transactions exported successfully"
|
|
727
|
+
}
|
|
728
|
+
);
|
|
729
|
+
} catch (t) {
|
|
730
|
+
console.error(t);
|
|
731
|
+
} finally {
|
|
732
|
+
T.value = !1;
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
const oe = P(null);
|
|
736
|
+
function ve(t) {
|
|
737
|
+
var r;
|
|
738
|
+
console.log(t), (r = oe.value) == null || r.showSheet(!0, t.original);
|
|
739
|
+
}
|
|
740
|
+
return Ce(async () => {
|
|
741
|
+
await u.readLocations(), await m.read(), await o();
|
|
742
|
+
}), (t, r) => {
|
|
743
|
+
const S = Y("FmSearch"), d = Y("FmButton");
|
|
744
|
+
return V(), B(J, null, [
|
|
745
|
+
_("div", null, [
|
|
746
|
+
_("div", Xe, [
|
|
747
|
+
I(S, {
|
|
748
|
+
class: "hidden xs:!flex border-b border-fm-color-neutral-gray-100",
|
|
749
|
+
modelValue: l(g).search,
|
|
750
|
+
"onUpdate:modelValue": r[0] || (r[0] = (i) => l(g).search = i),
|
|
751
|
+
placeholder: "Search",
|
|
752
|
+
collapsible: ""
|
|
753
|
+
}, null, 8, ["modelValue"]),
|
|
754
|
+
I(d, {
|
|
755
|
+
icon: "ios_share",
|
|
756
|
+
variant: "tertiary",
|
|
757
|
+
onClick: A
|
|
758
|
+
})
|
|
759
|
+
]),
|
|
760
|
+
_("div", Qe, [
|
|
761
|
+
_("div", Je, [
|
|
762
|
+
I(X, {
|
|
763
|
+
class: "cursor-pointer text-fm-color-neutral-gray-400",
|
|
764
|
+
"right-icon": "keyboard_arrow_down",
|
|
765
|
+
modelValue: l(g)["metadata.location"],
|
|
766
|
+
"onUpdate:modelValue": r[1] || (r[1] = (i) => l(g)["metadata.location"] = i),
|
|
767
|
+
icon: "storefront",
|
|
768
|
+
"show-item-label": !0,
|
|
769
|
+
items: l(R)
|
|
770
|
+
}, null, 8, ["modelValue", "items"]),
|
|
771
|
+
I(X, {
|
|
772
|
+
class: "cursor-pointer text-fm-color-neutral-gray-400",
|
|
773
|
+
"right-icon": "keyboard_arrow_down",
|
|
774
|
+
modelValue: l(g)["pf_collectible.type"],
|
|
775
|
+
"onUpdate:modelValue": r[2] || (r[2] = (i) => l(g)["pf_collectible.type"] = i),
|
|
776
|
+
label: "Type: ",
|
|
777
|
+
"show-item-label": !0,
|
|
778
|
+
items: [
|
|
779
|
+
{ label: "Point", value: "COIN" },
|
|
780
|
+
{ label: "Credit", value: "CREDIT" },
|
|
781
|
+
{ label: "Voucher", value: "VOUCHER" },
|
|
782
|
+
{ label: "Experience", value: "POINT" },
|
|
783
|
+
{ label: "Tier", value: "TIER" },
|
|
784
|
+
{ label: "Title", value: "TITLE" },
|
|
785
|
+
{ label: "Game", value: "GAME" },
|
|
786
|
+
{ label: "Stamp", value: "STAMP" }
|
|
787
|
+
]
|
|
788
|
+
}, null, 8, ["modelValue"]),
|
|
789
|
+
I(X, {
|
|
790
|
+
class: "cursor-pointer text-fm-color-neutral-gray-400",
|
|
791
|
+
"right-icon": "keyboard_arrow_down",
|
|
792
|
+
modelValue: l(g).source,
|
|
793
|
+
"onUpdate:modelValue": r[3] || (r[3] = (i) => l(g).source = i),
|
|
794
|
+
label: "Source: ",
|
|
795
|
+
"show-item-label": !0,
|
|
796
|
+
items: l(w)
|
|
797
|
+
}, null, 8, ["modelValue", "items"]),
|
|
798
|
+
I(ue, {
|
|
799
|
+
"model-value": {
|
|
800
|
+
startDate: l(g).dateRange.startDate,
|
|
801
|
+
endDate: l(g).dateRange.endDate
|
|
802
|
+
},
|
|
803
|
+
"onUpdate:modelValue": r[4] || (r[4] = (i) => l(g).dateRange = {
|
|
804
|
+
startDate: l(C)(i.startDate).startOf("d").toISOString(),
|
|
805
|
+
endDate: l(C)(i.endDate).endOf("d").toISOString()
|
|
806
|
+
})
|
|
807
|
+
}, null, 8, ["model-value"])
|
|
808
|
+
]),
|
|
809
|
+
I(S, {
|
|
810
|
+
class: "xs:hidden",
|
|
811
|
+
modelValue: l(g).search,
|
|
812
|
+
"onUpdate:modelValue": r[5] || (r[5] = (i) => l(g).search = i),
|
|
813
|
+
placeholder: "Search",
|
|
814
|
+
collapsible: ""
|
|
815
|
+
}, null, 8, ["modelValue"]),
|
|
816
|
+
_("div", Ze, [
|
|
817
|
+
I(d, {
|
|
818
|
+
icon: "ios_share",
|
|
819
|
+
variant: "tertiary",
|
|
820
|
+
onClick: A
|
|
821
|
+
})
|
|
822
|
+
])
|
|
823
|
+
]),
|
|
824
|
+
I(de, {
|
|
825
|
+
loading: l(a).isLoading,
|
|
826
|
+
"row-data": l(e),
|
|
827
|
+
"row-count": l(a).totalRows,
|
|
828
|
+
"column-defs": F.filter(
|
|
829
|
+
(i) => !h.user || i.header !== "User" && i.header !== "Phone No."
|
|
830
|
+
),
|
|
831
|
+
"page-count": l(a).pageCount,
|
|
832
|
+
"page-index": l(a).pageIndex,
|
|
833
|
+
"page-size": l(a).pageSize,
|
|
834
|
+
"shrink-at": !1,
|
|
835
|
+
"pagination-mode": "cursor",
|
|
836
|
+
"has-next": l(a).hasNext,
|
|
837
|
+
onSortChange: l(n),
|
|
838
|
+
onPageChange: r[6] || (r[6] = (i) => l(o)({
|
|
839
|
+
pageSize: i.pageSize,
|
|
840
|
+
pageIndex: i.pageIndex
|
|
841
|
+
})),
|
|
842
|
+
onRowClick: ve
|
|
843
|
+
}, null, 8, ["loading", "row-data", "row-count", "column-defs", "page-count", "page-index", "page-size", "has-next", "onSortChange"])
|
|
844
|
+
]),
|
|
845
|
+
I(qe, {
|
|
846
|
+
ref_key: "transactionDetailSheet",
|
|
847
|
+
ref: oe
|
|
848
|
+
}, null, 512)
|
|
849
|
+
], 64);
|
|
850
|
+
};
|
|
851
|
+
}
|
|
852
|
+
});
|
|
853
|
+
class et extends fe {
|
|
854
|
+
}
|
|
855
|
+
const tt = { class: "flex items-center justify-between" }, at = { class: "flex gap-8 items-center" }, ot = { class: "flex gap-8 items-center xs:hidden" }, Ot = /* @__PURE__ */ te({
|
|
856
|
+
__name: "StoreTransactions",
|
|
857
|
+
props: {
|
|
858
|
+
user: {
|
|
859
|
+
type: String
|
|
860
|
+
}
|
|
861
|
+
},
|
|
862
|
+
setup(c) {
|
|
863
|
+
const p = c, { minor: u } = he;
|
|
864
|
+
Re();
|
|
865
|
+
const m = [
|
|
866
|
+
{
|
|
867
|
+
header: "Transaction ID",
|
|
868
|
+
meta: {
|
|
869
|
+
maxWidth: "150px"
|
|
870
|
+
},
|
|
871
|
+
cell(e) {
|
|
872
|
+
return s("div", { class: "flex items-center" }, [
|
|
873
|
+
s(v.FmIcon, {
|
|
874
|
+
name: "content_copy",
|
|
875
|
+
outline: !0,
|
|
876
|
+
size: "sm",
|
|
877
|
+
class: "cursor-pointer mr-4 shrink-0",
|
|
878
|
+
onClick: (n) => {
|
|
879
|
+
n.preventDefault(), n.stopPropagation(), ae(e.row.original._id.toString());
|
|
880
|
+
}
|
|
881
|
+
}),
|
|
882
|
+
s("div", { class: "truncate" }, e.row.original._id.toString())
|
|
883
|
+
]);
|
|
884
|
+
}
|
|
885
|
+
},
|
|
886
|
+
{
|
|
887
|
+
header: "Created at",
|
|
888
|
+
accessorFn: (e) => C(U(e._id.toString())).format("D MMM YYYY, hh:mmA"),
|
|
889
|
+
enableSorting: !0
|
|
890
|
+
},
|
|
891
|
+
{
|
|
892
|
+
header: "Bundle",
|
|
893
|
+
accessorFn: (e) => e.bundle.name
|
|
894
|
+
},
|
|
895
|
+
{
|
|
896
|
+
header: "Location",
|
|
897
|
+
accessorFn: (e) => e.location ? e.pf_location[0].name : "Online Store"
|
|
898
|
+
},
|
|
899
|
+
{
|
|
900
|
+
header: "Payment Type",
|
|
901
|
+
accessorFn: (e) => {
|
|
902
|
+
var n;
|
|
903
|
+
return ((n = e.paymentType) == null ? void 0 : n.type) ?? "N/A";
|
|
904
|
+
},
|
|
905
|
+
cell(e) {
|
|
906
|
+
var n, o;
|
|
907
|
+
return s("div", { class: "flex items-center gap-4" }, [
|
|
908
|
+
s("div", { class: "flex items-center" }, [
|
|
909
|
+
((n = e.row.original.paymentType) == null ? void 0 : n.type) == "ONLINE" && e.row.original.paymentType.extra ? s(
|
|
910
|
+
v.FmTooltip,
|
|
911
|
+
{
|
|
912
|
+
content: e.row.original.paymentType.extra
|
|
913
|
+
},
|
|
914
|
+
[
|
|
915
|
+
s(v.FmIcon, {
|
|
916
|
+
name: "info",
|
|
917
|
+
outline: !0,
|
|
918
|
+
size: "sm"
|
|
919
|
+
})
|
|
920
|
+
]
|
|
921
|
+
) : s("div")
|
|
922
|
+
]),
|
|
923
|
+
s(
|
|
924
|
+
"div",
|
|
925
|
+
{ class: "flex-1" },
|
|
926
|
+
((o = e.row.original.paymentType) == null ? void 0 : o.type) ?? "N/A"
|
|
927
|
+
)
|
|
928
|
+
]);
|
|
929
|
+
}
|
|
930
|
+
},
|
|
931
|
+
{
|
|
932
|
+
header: "User",
|
|
933
|
+
cell: (e) => pe(e.row.original.pf_member)
|
|
934
|
+
},
|
|
935
|
+
{
|
|
936
|
+
header: "Phone No.",
|
|
937
|
+
accessorFn: (e) => e.pf_member.phoneNumber
|
|
938
|
+
},
|
|
939
|
+
{
|
|
940
|
+
header: "Status",
|
|
941
|
+
// accessorFn: (u) => u.status,
|
|
942
|
+
cell(e) {
|
|
943
|
+
var b, y, w, R;
|
|
944
|
+
const n = e.row.original.status, o = {
|
|
945
|
+
COMPLETED: "text-fm-color-typo-success bg-fm-color-system-success-100",
|
|
946
|
+
REFUNDED: "text-fm-color-typo-warning bg-fm-color-system-warning-100"
|
|
947
|
+
};
|
|
948
|
+
return s("div", { class: "flex items-center gap-4" }, [
|
|
949
|
+
s(v.FmChip, {
|
|
950
|
+
label: De.title(n),
|
|
951
|
+
variant: "plain",
|
|
952
|
+
class: o[n] ?? ""
|
|
953
|
+
}),
|
|
954
|
+
(y = (b = e.row.original) == null ? void 0 : b.refund) != null && y.reason ? s(
|
|
955
|
+
v.FmTooltip,
|
|
956
|
+
{
|
|
957
|
+
content: (R = (w = e.row.original) == null ? void 0 : w.refund) == null ? void 0 : R.reason
|
|
958
|
+
},
|
|
959
|
+
[
|
|
960
|
+
s(v.FmIcon, {
|
|
961
|
+
name: "info",
|
|
962
|
+
color: "primary",
|
|
963
|
+
outline: !0,
|
|
964
|
+
size: "sm"
|
|
965
|
+
})
|
|
966
|
+
]
|
|
967
|
+
) : null
|
|
968
|
+
]);
|
|
969
|
+
}
|
|
970
|
+
},
|
|
971
|
+
{
|
|
972
|
+
header: "Source",
|
|
973
|
+
accessorFn: (e) => e.source
|
|
974
|
+
},
|
|
975
|
+
{
|
|
976
|
+
header: "Ref",
|
|
977
|
+
accessorFn: (e) => e.ref
|
|
978
|
+
},
|
|
979
|
+
{
|
|
980
|
+
id: "action",
|
|
981
|
+
cell(e) {
|
|
982
|
+
const n = e.row.original, o = n.status === "COMPLETED" && !n.refund && n.source == "ADMIN";
|
|
983
|
+
return o ? s(
|
|
984
|
+
v.FmMenu,
|
|
985
|
+
{
|
|
986
|
+
placement: "bottom-end",
|
|
987
|
+
onClick: (b) => {
|
|
988
|
+
b.stopPropagation();
|
|
989
|
+
}
|
|
990
|
+
},
|
|
991
|
+
{
|
|
992
|
+
"menu-button": () => s(v.FmButton, {
|
|
993
|
+
icon: "settings",
|
|
994
|
+
variant: "tertiary",
|
|
995
|
+
if: o
|
|
996
|
+
}),
|
|
997
|
+
default: () => [
|
|
998
|
+
s(v.FmMenuItem, {
|
|
999
|
+
label: "Refund",
|
|
1000
|
+
sublabel: "Refund this transaction",
|
|
1001
|
+
onClick: async (b) => {
|
|
1002
|
+
b.stopPropagation(), await f(n);
|
|
1003
|
+
}
|
|
1004
|
+
})
|
|
1005
|
+
]
|
|
1006
|
+
}
|
|
1007
|
+
) : s("div");
|
|
1008
|
+
}
|
|
1009
|
+
}
|
|
1010
|
+
], x = P({
|
|
1011
|
+
searchValue: "",
|
|
1012
|
+
dateRange: {
|
|
1013
|
+
startDate: C().subtract(7, "day").toISOString(),
|
|
1014
|
+
endDate: C().toISOString()
|
|
1015
|
+
}
|
|
1016
|
+
}), { tableMeta: h, rowData: T, onSort: M, debouncedFetchData: F, onSearch: g } = Fe(async (e) => {
|
|
1017
|
+
const n = {
|
|
1018
|
+
...x.value.dateRange,
|
|
1019
|
+
user: p.user
|
|
1020
|
+
};
|
|
1021
|
+
return await L.readStoreTransactions(e, n);
|
|
1022
|
+
});
|
|
1023
|
+
async function f(e) {
|
|
1024
|
+
await Ee.confirm(
|
|
1025
|
+
"Are you sure you want to refund this transaction?",
|
|
1026
|
+
"Refund Store Transaction",
|
|
1027
|
+
"Confirm",
|
|
1028
|
+
"Cancel"
|
|
1029
|
+
) && await u(
|
|
1030
|
+
async () => {
|
|
1031
|
+
var o;
|
|
1032
|
+
await Oe.refundStoreTransaction({
|
|
1033
|
+
id: e._id,
|
|
1034
|
+
reason: `ADMIN:${(o = Me().sessionUser) == null ? void 0 : o.name}`
|
|
1035
|
+
}), await F();
|
|
1036
|
+
},
|
|
1037
|
+
{
|
|
1038
|
+
message: "Refunding transaction...",
|
|
1039
|
+
successMessage: "Transaction refunded successfully"
|
|
1040
|
+
}
|
|
1041
|
+
);
|
|
1042
|
+
}
|
|
1043
|
+
ce(
|
|
1044
|
+
x,
|
|
1045
|
+
() => {
|
|
1046
|
+
F();
|
|
1047
|
+
},
|
|
1048
|
+
{ deep: !0 }
|
|
1049
|
+
), Te(async () => {
|
|
1050
|
+
await F();
|
|
1051
|
+
});
|
|
1052
|
+
const a = async () => Ae({
|
|
1053
|
+
exporter: new et(),
|
|
1054
|
+
readFunction: (e) => L.readStoreTransactions(e, {
|
|
1055
|
+
...x.value.dateRange,
|
|
1056
|
+
user: p.user
|
|
1057
|
+
}),
|
|
1058
|
+
transformRecord: (e) => {
|
|
1059
|
+
var n, o, b, y, w, R;
|
|
1060
|
+
return {
|
|
1061
|
+
TransactionId: ((n = e._id) == null ? void 0 : n.toString()) || "",
|
|
1062
|
+
CreatedAt: C(U(e._id.toString())).format(
|
|
1063
|
+
"DD/MM/YYYY HH:mm:ss"
|
|
1064
|
+
),
|
|
1065
|
+
Bundle: e.bundle.name || "",
|
|
1066
|
+
Location: e.location ? e.pf_location[0].name : "Online Store",
|
|
1067
|
+
PaymentType: ((o = e.paymentType) == null ? void 0 : o.type) || "N/A",
|
|
1068
|
+
PaymentExtra: ((b = e.paymentType) == null ? void 0 : b.extra) || "",
|
|
1069
|
+
User: ((y = e.pf_member) == null ? void 0 : y.name) || "",
|
|
1070
|
+
PhoneNumber: ((w = e.pf_member) == null ? void 0 : w.phoneNumber) || "",
|
|
1071
|
+
Status: e.status || "",
|
|
1072
|
+
RefundReason: ((R = e == null ? void 0 : e.refund) == null ? void 0 : R.reason) || "",
|
|
1073
|
+
Ref: (e == null ? void 0 : e.ref) || ""
|
|
1074
|
+
};
|
|
1075
|
+
},
|
|
1076
|
+
filename: "store-transactions"
|
|
1077
|
+
});
|
|
1078
|
+
return (e, n) => {
|
|
1079
|
+
const o = Y("FmSearch"), b = Y("FmButton");
|
|
1080
|
+
return V(), B("div", null, [
|
|
1081
|
+
_("div", tt, [
|
|
1082
|
+
_("div", at, [
|
|
1083
|
+
I(ue, {
|
|
1084
|
+
modelValue: l(x).dateRange,
|
|
1085
|
+
"onUpdate:modelValue": n[0] || (n[0] = (y) => l(x).dateRange = y)
|
|
1086
|
+
}, null, 8, ["modelValue"])
|
|
1087
|
+
]),
|
|
1088
|
+
_("div", ot, [
|
|
1089
|
+
I(o, {
|
|
1090
|
+
modelValue: l(h).searchValue,
|
|
1091
|
+
"onUpdate:modelValue": [
|
|
1092
|
+
n[1] || (n[1] = (y) => l(h).searchValue = y),
|
|
1093
|
+
l(g)
|
|
1094
|
+
],
|
|
1095
|
+
placeholder: "Search",
|
|
1096
|
+
collapsible: ""
|
|
1097
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue"]),
|
|
1098
|
+
I(b, {
|
|
1099
|
+
icon: "ios_share",
|
|
1100
|
+
variant: "tertiary",
|
|
1101
|
+
onClick: a
|
|
1102
|
+
})
|
|
1103
|
+
])
|
|
1104
|
+
]),
|
|
1105
|
+
I(de, {
|
|
1106
|
+
loading: l(h).isLoading,
|
|
1107
|
+
"row-data": l(T),
|
|
1108
|
+
"row-count": l(h).totalRows,
|
|
1109
|
+
"column-defs": m.filter(
|
|
1110
|
+
(y) => !p.user || y.header !== "User" && y.header !== "Phone No."
|
|
1111
|
+
),
|
|
1112
|
+
"page-count": l(h).pageCount,
|
|
1113
|
+
"page-index": l(h).pageIndex,
|
|
1114
|
+
"page-size": l(h).pageSize,
|
|
1115
|
+
"shrink-at": !1,
|
|
1116
|
+
onSortChange: l(M),
|
|
1117
|
+
onPageChange: n[2] || (n[2] = (y) => l(F)({
|
|
1118
|
+
pageSize: y.pageSize,
|
|
1119
|
+
pageIndex: y.pageIndex
|
|
1120
|
+
}))
|
|
1121
|
+
}, null, 8, ["loading", "row-data", "row-count", "column-defs", "page-count", "page-index", "page-size", "onSortChange"])
|
|
1122
|
+
]);
|
|
1123
|
+
};
|
|
1124
|
+
}
|
|
1125
|
+
});
|
|
1126
|
+
export {
|
|
1127
|
+
Mt as _,
|
|
1128
|
+
Ot as a
|
|
1129
|
+
};
|