@feedmepos/mf-connect 0.1.98-beta.52 → 0.1.98-beta.53
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/{App-C9-lD2Hw.js → App-GVbZXaOb.js} +8 -8
- package/dist/{AuditLogs-mVSa1e2d.js → AuditLogs-COC3VF6K.js} +10 -10
- package/dist/{Bin-CHSDqvyp.js → Bin-BqN1F26B.js} +8 -8
- package/dist/{Broadcast-BUEwwGv8.js → Broadcast-BXP5eA1_.js} +11 -11
- package/dist/{CampaignAnalytic-D_qHmP-j.js → CampaignAnalytic-B3Vm1qDu.js} +6 -6
- package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-DEzM1EH8.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-CkX0_HxH.js} +7 -7
- package/dist/Card-UnclF25U.js +1084 -0
- package/dist/{Collections-CERrTLRX.js → Collections-DjrrHxTV.js} +8 -8
- package/dist/{Credit-JxLtbWS-.js → Credit-DoDJIxEC.js} +12 -12
- package/dist/{EditCampaignSheet.vue_vue_type_script_setup_true_lang-DKIxsZIb.js → EditCampaignSheet.vue_vue_type_script_setup_true_lang-BM_btYhW.js} +34 -34
- package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-Bu486h20.js → EffectSheet.vue_vue_type_style_index_0_lang-ftrIH_p9.js} +6 -6
- package/dist/{Experience-C-9zbUbV.js → Experience-Dr2Arehy.js} +12 -12
- package/dist/{FileSaver.min-B4bNs8iH.js → FileSaver.min-D9YchN9l.js} +1 -1
- package/dist/{Game-BYV8NF0m.js → Game-3dq-RL7M.js} +13 -13
- package/dist/{GiftCardSetup-CJi_--PA.js → GiftCardSetup-DD1r4qll.js} +9 -9
- package/dist/{Grab-Bgm7CS6o.js → Grab-Ca0WiQpm.js} +9 -9
- package/dist/{ImageInput.vue_vue_type_script_setup_true_lang-CuC8sOKH.js → ImageInput.vue_vue_type_script_setup_true_lang-D66OFyD2.js} +1 -1
- package/dist/{Index-sjstmJ91.js → Index-8kZCkUM2.js} +10 -10
- package/dist/{LocationPicker.vue_vue_type_script_setup_true_lang-Dk1_IA4x.js → LocationPicker.vue_vue_type_script_setup_true_lang-CUCAO-YP.js} +1 -1
- package/dist/{LottieAnimation.vue_vue_type_script_setup_true_lang-1COn62uz.js → LottieAnimation.vue_vue_type_script_setup_true_lang-Cggoq2NY.js} +1 -1
- package/dist/{LoyaltyDashboard-D6d8uvqc.js → LoyaltyDashboard-DT-hdzf3.js} +10 -10
- package/dist/{MainLayout-JJUJwFTJ.js → MainLayout-7w0y1egK.js} +3 -3
- package/dist/{Marketing-DRCAImhs.js → Marketing-DPJc-3ff.js} +4 -4
- package/dist/{MarketingMaterialEdit-KiR6qhk6.js → MarketingMaterialEdit-D-hqhuMF.js} +6 -6
- package/dist/{Member-RbLwG_XD.js → Member-CkRqgHe4.js} +7 -7
- package/dist/{MemberDetailSheet.vue_vue_type_script_setup_true_lang-CKuNtryb.js → MemberDetailSheet.vue_vue_type_script_setup_true_lang-Dl8u5fl6.js} +23 -23
- package/dist/{MemberImportHistory-CSMmUYaF.js → MemberImportHistory-DAQ65F9g.js} +7 -7
- package/dist/{MemberList-CKe9oSOX.js → MemberList-D5FzPL99.js} +14 -14
- package/dist/{MemberTransactions-Cz9oW1ZB.js → MemberTransactions-DZaibYxC.js} +1 -1
- package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-Czt1s9hi.js → MessageInput.vue_vue_type_script_setup_true_lang-6xakpZEo.js} +10 -10
- package/dist/{Mission-PgkkwDkY.js → Mission-PXCFl4e-.js} +13 -13
- package/dist/{Overview-BiQvzE6U.js → Overview-BOlwqxBU.js} +19 -19
- package/dist/{Overview-kvJ0MdN-.js → Overview-CcDElaj4.js} +3 -3
- package/dist/{Point-q1JBP2YV.js → Point-CDSO_YG3.js} +12 -12
- package/dist/{Promotion-D4mlfhUW.js → Promotion-DVw7hepB.js} +13 -13
- package/dist/{Queue-C073ieg_.js → Queue-DUb4qqpc.js} +11 -11
- package/dist/{Record-BzrKG6WO.js → Record-r2Bj4Y-2.js} +9 -9
- package/dist/{Review-Ddzsk4S5.js → Review-D5sC1CpN.js} +2 -2
- package/dist/{ReviewFacebookCallback-B85JCrQU.js → ReviewFacebookCallback-C-pIS4uj.js} +5 -5
- package/dist/{ReviewGoogleCallback-DdK3pD4V.js → ReviewGoogleCallback-wKBmFpBe.js} +5 -5
- package/dist/{Reward-CG9HGB8d.js → Reward-eY6C0L7i.js} +16 -16
- package/dist/{RewardGroup.vue_vue_type_script_setup_true_lang-BSv9kF2a.js → RewardGroup.vue_vue_type_script_setup_true_lang-CEXYfR09.js} +12 -12
- package/dist/{RuleGroup.vue_vue_type_script_setup_true_lang-CpUO-nFy.js → RuleGroup.vue_vue_type_script_setup_true_lang-ifUAqLwG.js} +15 -15
- package/dist/{Segment-V_LOxVT5.js → Segment-CKXmFk6Q.js} +25 -25
- package/dist/{SelectItems.vue_vue_type_script_setup_true_lang-CrscmyI5.js → SelectItems.vue_vue_type_script_setup_true_lang-DD7KLdTt.js} +2 -2
- package/dist/{SendCollectionSheet.vue_vue_type_script_setup_true_lang-DEg68hNO.js → SendCollectionSheet.vue_vue_type_script_setup_true_lang-Bl3KaAjj.js} +13 -13
- package/dist/{SendVoucherSheet.vue_vue_type_script_setup_true_lang-BFlPOyFp.js → SendVoucherSheet.vue_vue_type_script_setup_true_lang-tpcHzd48.js} +4 -4
- package/dist/{Setting-DHop8c8g.js → Setting-K-x016Eq.js} +14 -14
- package/dist/{SettingAdvertisements-YHMTZE3J.js → SettingAdvertisements-BGznpHIH.js} +12 -12
- package/dist/{Settings-BCaNCpJT.js → Settings-CrPLvP2-.js} +5 -5
- package/dist/{Store-Cs_8_ngC.js → Store-PbvFQ03o.js} +219 -222
- package/dist/{StoreRewards-DFoUaW2a.js → StoreRewards-pYNbeyOQ.js} +15 -15
- package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-C5YoHPxm.js +1329 -0
- package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-D5O5DKbh.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-DOyli0Kj.js} +2 -2
- package/dist/{Tier-BmQh3fVh.js → Tier-BHlyTQfq.js} +25 -25
- package/dist/{Title-UT4g--1-.js → Title-CSuSHz1O.js} +22 -22
- package/dist/{Transaction-ESFus2Ol.js → Transaction-bKcfOmz1.js} +2 -2
- package/dist/{UserRuleGroup.vue_vue_type_script_setup_true_lang-BGh_tZBk.js → UserRuleGroup.vue_vue_type_script_setup_true_lang-C6Pb93cp.js} +6 -6
- package/dist/{Voucher-DZL9Fdg9.js → Voucher-D_zf4aRU.js} +14 -14
- package/dist/{VoucherEditor.vue_vue_type_script_setup_true_lang-BAQ9jtAM.js → VoucherEditor.vue_vue_type_script_setup_true_lang-D1VBWUFD.js} +12 -12
- package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-DYQUgY-k.js → ZodTextField.vue_vue_type_script_setup_true_lang-CRz6uhOz.js} +2 -2
- package/dist/{app-C38mcv88.js → app-DsVK_Z9F.js} +92 -67
- package/dist/app.js +1 -1
- package/dist/base.export-wsjx1b1F.js +75 -0
- package/dist/{business-2oH_ru_8.js → business-emEflb7G.js} +1 -1
- package/dist/{campaign-CMZqifqP.js → campaign-CH1zEmK_.js} +8 -8
- package/dist/{campaign-Bjso0Xy2.js → campaign-CczdPZEx.js} +2 -2
- package/dist/{campaign.enum-Y6SY-diZ.js → campaign.enum-jb40hQyq.js} +1 -1
- package/dist/{campaign.fn-FdFgkYSj.js → campaign.fn-ZvIMg3Jv.js} +125 -125
- package/dist/{collectible.enum-MBCR_vBG.js → collectible.enum-Q0sMqRej.js} +1 -1
- package/dist/{collection.fn-BXNobS3V.js → collection.fn-CpOJTvnW.js} +2 -2
- package/dist/currency-nVkRZfQp.js +7 -0
- package/dist/{duplicateCampaign-XPBqYkWX.js → duplicateCampaign-DszCNBjZ.js} +2 -2
- package/dist/{effect-DIBdj1V2.js → effect-De3cFxjA.js} +1 -1
- package/dist/{email-addresses-DV4VUh2g.js → email-addresses-BENEAxtQ.js} +2 -2
- package/dist/{helper-aWWZOhk-.js → helper-DjTmaBve.js} +1 -1
- package/dist/{index-DVA1kIwN.js → index-B-GBUWJi.js} +47 -46
- package/dist/{index-Pz3KsQfw.js → index-BEU1eux8.js} +1 -1
- package/dist/{index-CHhk4SQx.js → index-BH4TDRw4.js} +2 -2
- package/dist/{index-DlzhY2Gz.js → index-BMQVCeHN.js} +7 -7
- package/dist/{index-BGZVdX7n.js → index-BanLR_f4.js} +2 -2
- package/dist/{index-DafINJH8.js → index-Bj_LrRir.js} +1 -1
- package/dist/{index-DbULfnV3.js → index-BlsV0pDI.js} +7 -7
- package/dist/{index-WVDXkuyC.js → index-BxRbdJOU.js} +1 -1
- package/dist/{index-Dps3MKMS.js → index-CKfVSZcR.js} +2 -2
- package/dist/{index-BDxwnonR.js → index-DEtIu7G-.js} +3 -3
- package/dist/{index-C567s8tj.js → index-DlAwtfWQ.js} +3 -3
- package/dist/{index-HQFexw0Z.js → index-DrSpG2nV.js} +1 -1
- package/dist/{index-CeXhFaZg.js → index-DsviWEPT.js} +5 -5
- package/dist/{index-CueUIXPn.js → index-P2yevS6i.js} +1 -1
- package/dist/{index-WXnNDUyq.js → index-Wd_vLVMH.js} +3 -3
- package/dist/{index-DfXU3JsN.js → index-fl12LmlG.js} +1 -1
- package/dist/{index-BW0_NNEE.js → index-p0RFjPyp.js} +1 -1
- package/dist/{index-Br-UT1ir.js → index-vV9W0EhO.js} +1 -1
- package/dist/{index.esm2017-D9a8Ow55.js → index.esm2017-C-k-2kM3.js} +1 -1
- package/dist/{loading-C5r1cx-_.js → loading-TBGTHWt0.js} +1 -1
- package/dist/{lodash-BbPpFjHe.js → lodash-qQ2ie1zb.js} +1 -1
- package/dist/{member-import-CftPgU92.js → member-import-B_sizua-.js} +1 -1
- package/dist/{membership-C7KQ-KXT.js → membership-DJIuI4sn.js} +3 -3
- package/dist/{money-CxcffdSc.js → money-BOnCYNt8.js} +1 -1
- package/dist/{number-Cqd6VhtH.js → number-GrW7Sgoo.js} +1 -1
- package/dist/{objectid-CpTyDbom.js → objectid-DPTR7IEN.js} +12 -12
- package/dist/{plugins-BO66KEQi.js → plugins-D80BsQ8l.js} +3 -3
- package/dist/{reward-D369xt9c.js → reward-ByHQgT7i.js} +1 -1
- package/dist/{rule-Dc83EYyn.js → rule-Djn2x0ov.js} +3 -3
- package/dist/{rule-builder-CFK1__-e.js → rule-builder-Dp6YiO8-.js} +1 -1
- package/dist/{template-voSvaSNk.js → template-CR7fSIew.js} +6 -6
- package/dist/{timezone-DMQW1WZ5.js → timezone-BQH2AZ_H.js} +1 -1
- package/dist/{transaction.fn-BoPRNLs9.js → transaction.fn-sp8FkkYr.js} +1 -1
- package/dist/{trigger-D2uZtisI.js → trigger-Y9ted5Uv.js} +5 -5
- package/dist/{useMarketingMaterialActions-Cfc1aeg0.js → useMarketingMaterialActions-jZ3QuyxF.js} +3 -3
- package/dist/{usePagination-D6tENEun.js → usePagination-pzo4ADvP.js} +1 -1
- package/dist/{user-lQkrcDz7.js → user-BtkZFzFm.js} +1 -1
- package/dist/{vue-i18n-3ow1X-2g.js → vue-i18n-DHFwvj0q.js} +391 -391
- package/dist/{xlsx-BtLSi0cI.js → xlsx-BWsO-8j5.js} +1 -1
- package/dist/{zod-BkZnH28K.js → zod-BMKVB5Fl.js} +1 -1
- package/package.json +1 -1
- package/dist/Card-Bzbm3-sW.js +0 -1060
- package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-gK0o53mY.js +0 -1075
- package/dist/export-DWSRMvQd.js +0 -97
|
@@ -0,0 +1,1329 @@
|
|
|
1
|
+
import { ref as E, defineComponent as re, computed as z, h as l, resolveComponent as K, openBlock as k, createBlock as ce, unref as i, isRef as ge, withCtx as ae, createElementVNode as S, createVNode as A, createElementBlock as O, Fragment as X, renderList as ne, toDisplayString as G, createTextVNode as Ie, resolveDynamicComponent as Fe, watch as ye, onBeforeMount as De, onMounted as Ae } from "vue";
|
|
2
|
+
import { components as T } from "@feedmepos/ui-library";
|
|
3
|
+
import { x as ue } from "./index-B-GBUWJi.js";
|
|
4
|
+
import "./index-DEtIu7G-.js";
|
|
5
|
+
import { T as L } from "./transaction.fn-sp8FkkYr.js";
|
|
6
|
+
import { h as N } from "./moment-D7p2TMB-.js";
|
|
7
|
+
import { _ as le } from "./FilterChip.vue_vue_type_script_setup_true_lang-DaU-9GzO.js";
|
|
8
|
+
import { _ as ve } from "./DateRangeChip.vue_vue_type_script_setup_true_lang-eIoPtgO5.js";
|
|
9
|
+
import { s as te } from "./index-CuvNtC_M.js";
|
|
10
|
+
import { f as W, F as Ne } from "./number-GrW7Sgoo.js";
|
|
11
|
+
import { u as he } from "./business-emEflb7G.js";
|
|
12
|
+
import { _ as be, u as Pe } from "./usePagination-pzo4ADvP.js";
|
|
13
|
+
import { c as de, p as ke } from "./plugins-D80BsQ8l.js";
|
|
14
|
+
import { g as xe } from "./user-BtkZFzFm.js";
|
|
15
|
+
import { B as Se, e as Me } from "./base.export-wsjx1b1F.js";
|
|
16
|
+
import { u as _e } from "./campaign-CczdPZEx.js";
|
|
17
|
+
import "./index-DrSpG2nV.js";
|
|
18
|
+
import "./index-BMQVCeHN.js";
|
|
19
|
+
import "./index-Wd_vLVMH.js";
|
|
20
|
+
import "./index-DsviWEPT.js";
|
|
21
|
+
import "./index-DlAwtfWQ.js";
|
|
22
|
+
import { u as se } from "./vue-i18n-DHFwvj0q.js";
|
|
23
|
+
import { o as j } from "./objectId-dwaoBfJX.js";
|
|
24
|
+
import { u as Te } from "./loading-TBGTHWt0.js";
|
|
25
|
+
import { w as Ee } from "./xlsx-BWsO-8j5.js";
|
|
26
|
+
import { useRouter as Ve } from "vue-router";
|
|
27
|
+
import { t as H } from "./index-p0RFjPyp.js";
|
|
28
|
+
import { R as ee } from "./app-DsVK_Z9F.js";
|
|
29
|
+
import { F as ie } from "./collectible.enum-Q0sMqRej.js";
|
|
30
|
+
import { useCoreStore as $e } from "@feedmepos/mf-common";
|
|
31
|
+
import { c as Q } from "./string-Gcy5IM_H.js";
|
|
32
|
+
import { f as Oe } from "./currency-nVkRZfQp.js";
|
|
33
|
+
import { m as Be } from "./index-P2yevS6i.js";
|
|
34
|
+
const ze = (f) => {
|
|
35
|
+
if (f.startsWith("_") || f.includes("."))
|
|
36
|
+
return f;
|
|
37
|
+
for (const v of ["pf_user_", "pf_collectible_"])
|
|
38
|
+
if (f.startsWith(v))
|
|
39
|
+
return `${v.slice(0, -1)}.${f.slice(v.length).replace(new RegExp("_", "g"), ".")}`;
|
|
40
|
+
return f.replace(new RegExp("_", "g"), ".");
|
|
41
|
+
};
|
|
42
|
+
function Ue(f, v = { key: "_id", descending: !0 }) {
|
|
43
|
+
const u = E({
|
|
44
|
+
pageCount: 1,
|
|
45
|
+
searchValue: "",
|
|
46
|
+
pageIndex: 0,
|
|
47
|
+
totalRows: 0,
|
|
48
|
+
isLoading: !1,
|
|
49
|
+
pageSize: 10,
|
|
50
|
+
hasNext: !1
|
|
51
|
+
}), m = E(v), C = E([]), w = E([void 0]);
|
|
52
|
+
function P() {
|
|
53
|
+
w.value = [void 0], u.value.pageIndex = 0, u.value.pageCount = 1, u.value.hasNext = !1;
|
|
54
|
+
}
|
|
55
|
+
const V = async (x = {}) => {
|
|
56
|
+
const p = x.pageSize ?? u.value.pageSize, a = p !== u.value.pageSize;
|
|
57
|
+
a && P();
|
|
58
|
+
const t = a ? 0 : Math.max(x.pageIndex ?? u.value.pageIndex, 0), e = t === 0 || !!w.value[t] ? t : u.value.pageIndex, o = w.value[e];
|
|
59
|
+
u.value.isLoading = !0, u.value.pageSize = p, C.value = [];
|
|
60
|
+
try {
|
|
61
|
+
const c = await f({
|
|
62
|
+
limit: p,
|
|
63
|
+
sortBy: m.value.key,
|
|
64
|
+
descending: m.value.descending,
|
|
65
|
+
search: u.value.searchValue,
|
|
66
|
+
...o ? { cursor: o } : {}
|
|
67
|
+
});
|
|
68
|
+
C.value = c.resources, u.value.pageIndex = e, u.value.totalRows = c.resources.length, u.value.hasNext = c.meta.hasNext, u.value.pageCount = e + (c.meta.hasNext ? 2 : 1), c.meta.nextCursor ? w.value[e + 1] = c.meta.nextCursor : w.value.splice(e + 1);
|
|
69
|
+
} catch (c) {
|
|
70
|
+
console.error("Error fetching data:", c), u.value.hasNext = !1;
|
|
71
|
+
} finally {
|
|
72
|
+
u.value.isLoading = !1;
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
let I, g;
|
|
76
|
+
const h = (x) => (I && clearTimeout(I), g && g(), new Promise((p) => {
|
|
77
|
+
g = p, I = setTimeout(async () => {
|
|
78
|
+
I = void 0, g = void 0, await V(x), p();
|
|
79
|
+
}, 200);
|
|
80
|
+
}));
|
|
81
|
+
return {
|
|
82
|
+
tableMeta: u,
|
|
83
|
+
rowData: C,
|
|
84
|
+
sortBy: m,
|
|
85
|
+
pageCursors: w,
|
|
86
|
+
resetCursorState: P,
|
|
87
|
+
fetchData: V,
|
|
88
|
+
debouncedFetchData: h,
|
|
89
|
+
onSort: async (x) => {
|
|
90
|
+
x.length ? m.value = {
|
|
91
|
+
key: ze(x[0].id),
|
|
92
|
+
descending: x[0].desc
|
|
93
|
+
} : m.value = v, P(), await h({
|
|
94
|
+
pageIndex: 0,
|
|
95
|
+
pageSize: u.value.pageSize
|
|
96
|
+
});
|
|
97
|
+
},
|
|
98
|
+
onSearch: () => (P(), h({
|
|
99
|
+
pageIndex: 0,
|
|
100
|
+
pageSize: u.value.pageSize
|
|
101
|
+
}))
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
class Ye extends Se {
|
|
105
|
+
}
|
|
106
|
+
const Le = { class: "space-y-24 pr-12" }, Ge = { class: "w-full space-y-16" }, Ke = { class: "fm-typo-en-body-lg-600" }, je = ["onClick"], We = { class: "fm-typo-en-body-lg-600" }, qe = ["onClick"], He = { class: "flex items-center gap-8" }, Qe = /* @__PURE__ */ re({
|
|
107
|
+
__name: "TransactionDetailSheet",
|
|
108
|
+
setup(f, { expose: v }) {
|
|
109
|
+
se();
|
|
110
|
+
const u = E(!1), m = E(), C = _e(), w = he();
|
|
111
|
+
function P(h, r) {
|
|
112
|
+
u.value = h, m.value = r ?? null;
|
|
113
|
+
}
|
|
114
|
+
const V = z(() => {
|
|
115
|
+
var h, r;
|
|
116
|
+
return W(
|
|
117
|
+
((r = m.value) == null ? void 0 : r.expiryAmount.reduce(
|
|
118
|
+
(_, x) => _ + x.amount,
|
|
119
|
+
((h = m.value) == null ? void 0 : h.amount) ?? 0
|
|
120
|
+
)) ?? 0,
|
|
121
|
+
2
|
|
122
|
+
);
|
|
123
|
+
}), I = z(() => {
|
|
124
|
+
var h, r, _, x, p;
|
|
125
|
+
return m.value ? [
|
|
126
|
+
{
|
|
127
|
+
label: "Transaction ID",
|
|
128
|
+
value: (h = m.value) == null ? void 0 : h._id
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
label: "Date/Time",
|
|
132
|
+
value: N(j(m.value._id.toString())).format(
|
|
133
|
+
"D MMM YYYY, hh:mmA"
|
|
134
|
+
)
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
label: "Amount",
|
|
138
|
+
component: () => l(
|
|
139
|
+
"span",
|
|
140
|
+
{
|
|
141
|
+
class: [
|
|
142
|
+
"pr-2",
|
|
143
|
+
+V.value > 0 ? "text-fm-color-system-success-300" : "text-fm-color-system-error-300"
|
|
144
|
+
]
|
|
145
|
+
},
|
|
146
|
+
V.value
|
|
147
|
+
)
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
label: "Type",
|
|
151
|
+
value: L.formattedType(m.value)
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
label: "Source",
|
|
155
|
+
value: te(L.getReason(m.value.source))
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
label: "User",
|
|
159
|
+
value: (_ = (r = m.value) == null ? void 0 : r.pf_user) == null ? void 0 : _.name
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
label: "Phone Number",
|
|
163
|
+
value: (p = (x = m.value) == null ? void 0 : x.pf_user) == null ? void 0 : p.phoneNumber
|
|
164
|
+
}
|
|
165
|
+
] : [];
|
|
166
|
+
}), g = z(() => {
|
|
167
|
+
var x, p, a, t;
|
|
168
|
+
if (!m.value) return [];
|
|
169
|
+
const h = [], r = (x = m.value) == null ? void 0 : x.metadata, _ = m.value;
|
|
170
|
+
if (r != null && r.campaign) {
|
|
171
|
+
const b = C.campaigns.all.find(
|
|
172
|
+
(e) => e._id === (r == null ? void 0 : r.campaign)
|
|
173
|
+
);
|
|
174
|
+
if (!b) return;
|
|
175
|
+
h.push({
|
|
176
|
+
label: "Campaign",
|
|
177
|
+
value: b.name
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
return r != null && r.remark && h.push({
|
|
181
|
+
label: "Remark",
|
|
182
|
+
value: r.remark
|
|
183
|
+
}), (p = m.value) != null && p.ref.startsWith("bill_") && h.push({
|
|
184
|
+
label: "Bill Number",
|
|
185
|
+
value: (a = m.value) == null ? void 0 : a.ref,
|
|
186
|
+
copy: () => {
|
|
187
|
+
var b;
|
|
188
|
+
return de((b = m.value) == null ? void 0 : b.ref);
|
|
189
|
+
}
|
|
190
|
+
}), r != null && r.location && h.push({
|
|
191
|
+
label: "Location",
|
|
192
|
+
value: (t = w.locations.find(
|
|
193
|
+
(b) => b._id.toString() === (r == null ? void 0 : r.location)
|
|
194
|
+
)) == null ? void 0 : t.name
|
|
195
|
+
}), _.source === ue.enum.STORE && h.push({
|
|
196
|
+
label: "Store Transaction",
|
|
197
|
+
value: _.ref
|
|
198
|
+
}), r != null && r.originTransaction && h.push({
|
|
199
|
+
label: "Parent Transaction",
|
|
200
|
+
value: r.originTransaction
|
|
201
|
+
}), r != null && r.referral_count && h.push({
|
|
202
|
+
label: "Referral Count",
|
|
203
|
+
value: r.referral_count
|
|
204
|
+
}), _.refundedFrom && h.push({
|
|
205
|
+
label: "Refunded From",
|
|
206
|
+
value: _.refundedFrom
|
|
207
|
+
}), h;
|
|
208
|
+
});
|
|
209
|
+
return v({
|
|
210
|
+
showSheet: P
|
|
211
|
+
}), (h, r) => {
|
|
212
|
+
const _ = K("FmButton"), x = K("FmSideSheet");
|
|
213
|
+
return k(), ce(x, {
|
|
214
|
+
"max-width": 560,
|
|
215
|
+
modelValue: i(u),
|
|
216
|
+
"onUpdate:modelValue": r[1] || (r[1] = (p) => ge(u) ? u.value = p : null),
|
|
217
|
+
header: "Transaction Details"
|
|
218
|
+
}, {
|
|
219
|
+
"side-sheet-footer": ae(() => [
|
|
220
|
+
S("div", He, [
|
|
221
|
+
A(_, {
|
|
222
|
+
label: "Close",
|
|
223
|
+
onClick: r[0] || (r[0] = (p) => P(!1)),
|
|
224
|
+
variant: "tertiary"
|
|
225
|
+
})
|
|
226
|
+
])
|
|
227
|
+
]),
|
|
228
|
+
default: ae(() => [
|
|
229
|
+
S("div", Le, [
|
|
230
|
+
S("div", Ge, [
|
|
231
|
+
(k(!0), O(X, null, ne(i(I), (p) => (k(), O("div", {
|
|
232
|
+
key: p.label,
|
|
233
|
+
class: "flex flex-col gap-4"
|
|
234
|
+
}, [
|
|
235
|
+
S("div", Ke, G(p.label), 1),
|
|
236
|
+
S("div", {
|
|
237
|
+
class: "text-fm-color-typo-secondary fm-typo-en-body-md-400 hover:underline",
|
|
238
|
+
onClick: p.copy
|
|
239
|
+
}, [
|
|
240
|
+
Ie(G(p.accessorFn ? p.accessorFn() : p.value) + " ", 1),
|
|
241
|
+
(k(), ce(Fe(p.component)))
|
|
242
|
+
], 8, je),
|
|
243
|
+
r[2] || (r[2] = S("hr", { class: "mt-3" }, null, -1))
|
|
244
|
+
]))), 128)),
|
|
245
|
+
(k(!0), O(X, null, ne(i(g), (p) => (k(), O("div", {
|
|
246
|
+
key: p.label,
|
|
247
|
+
class: "flex flex-col gap-4"
|
|
248
|
+
}, [
|
|
249
|
+
S("div", We, G(p.label), 1),
|
|
250
|
+
S("div", {
|
|
251
|
+
class: "text-fm-color-typo-secondary fm-typo-en-body-md-400 hover:underline",
|
|
252
|
+
onClick: p.copy
|
|
253
|
+
}, G(p.accessorFn ? p.accessorFn() : p.value), 9, qe),
|
|
254
|
+
r[3] || (r[3] = S("hr", { class: "mt-3" }, null, -1))
|
|
255
|
+
]))), 128))
|
|
256
|
+
])
|
|
257
|
+
])
|
|
258
|
+
]),
|
|
259
|
+
_: 1
|
|
260
|
+
}, 8, ["modelValue"]);
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
}), Xe = { class: "hidden xs:!flex items-center justify-end" }, Je = { class: "flex items-center justify-between" }, Ze = { class: "flex gap-8 items-center w-full overflow-x-scroll" }, et = { class: "xs:hidden" }, Wt = /* @__PURE__ */ re({
|
|
264
|
+
__name: "CollectionTransactions",
|
|
265
|
+
props: {
|
|
266
|
+
user: {
|
|
267
|
+
type: String
|
|
268
|
+
}
|
|
269
|
+
},
|
|
270
|
+
setup(f) {
|
|
271
|
+
const { t: v } = se(), u = he(), m = _e(), C = Ve(), w = f, P = E(!1), { minor: V } = Te, I = [
|
|
272
|
+
{
|
|
273
|
+
header: "Transaction ID",
|
|
274
|
+
accessorKey: "_id",
|
|
275
|
+
meta: {
|
|
276
|
+
maxWidth: "100px"
|
|
277
|
+
},
|
|
278
|
+
cell(n) {
|
|
279
|
+
return l("div", { class: "flex items-center" }, [
|
|
280
|
+
l(T.FmIcon, {
|
|
281
|
+
name: "content_copy",
|
|
282
|
+
outline: !0,
|
|
283
|
+
size: "sm",
|
|
284
|
+
class: "cursor-pointer mr-4",
|
|
285
|
+
onClick: (s) => {
|
|
286
|
+
s.preventDefault(), s.stopPropagation(), de(n.row.original._id.toString());
|
|
287
|
+
}
|
|
288
|
+
}),
|
|
289
|
+
l(
|
|
290
|
+
"div",
|
|
291
|
+
{ class: "pr-2 text-ellipsis overflow-hidden" },
|
|
292
|
+
n.row.original._id.toString()
|
|
293
|
+
)
|
|
294
|
+
]);
|
|
295
|
+
},
|
|
296
|
+
enableSorting: !1
|
|
297
|
+
},
|
|
298
|
+
{
|
|
299
|
+
header: "Created at",
|
|
300
|
+
accessorKey: "_id",
|
|
301
|
+
accessorFn: (n) => N(j(n._id.toString())),
|
|
302
|
+
cell: (n) => N(j(n.row.original._id.toString())).format(
|
|
303
|
+
"D MMM YYYY, hh:mmA"
|
|
304
|
+
),
|
|
305
|
+
enableSorting: !0
|
|
306
|
+
},
|
|
307
|
+
{
|
|
308
|
+
header: "Amount",
|
|
309
|
+
// accessorKey: 'totalAmount',
|
|
310
|
+
enableSorting: !1,
|
|
311
|
+
cell(n) {
|
|
312
|
+
var y, d, M, B;
|
|
313
|
+
const s = W(
|
|
314
|
+
n.row.original.expiryAmount.reduce(
|
|
315
|
+
(q, U) => q + U.amount,
|
|
316
|
+
n.row.original.amount ?? 0
|
|
317
|
+
),
|
|
318
|
+
2
|
|
319
|
+
), R = (d = (y = n.row.original.expiryAmount) == null ? void 0 : y[0]) != null && d.expiredAt ? N((B = (M = n.row.original.expiryAmount) == null ? void 0 : M[0]) == null ? void 0 : B.expiredAt).format(
|
|
320
|
+
"D MMM YYYY"
|
|
321
|
+
) : "";
|
|
322
|
+
return l("div", { class: "flex items-center" }, [
|
|
323
|
+
l(
|
|
324
|
+
"div",
|
|
325
|
+
{
|
|
326
|
+
class: [
|
|
327
|
+
"pr-2",
|
|
328
|
+
+s > 0 ? "text-fm-color-system-success-300" : "text-fm-color-system-error-300"
|
|
329
|
+
]
|
|
330
|
+
},
|
|
331
|
+
s
|
|
332
|
+
),
|
|
333
|
+
l("div", { class: "flex items-center" }, [
|
|
334
|
+
n.row.original.expiryAmount.length > 0 ? l(
|
|
335
|
+
T.FmTooltip,
|
|
336
|
+
{
|
|
337
|
+
content: `Expired on ${R}`
|
|
338
|
+
},
|
|
339
|
+
[
|
|
340
|
+
l(T.FmIcon, {
|
|
341
|
+
name: "info",
|
|
342
|
+
outline: !0,
|
|
343
|
+
size: "sm"
|
|
344
|
+
})
|
|
345
|
+
]
|
|
346
|
+
) : l("div")
|
|
347
|
+
])
|
|
348
|
+
]);
|
|
349
|
+
}
|
|
350
|
+
},
|
|
351
|
+
{
|
|
352
|
+
header: "Type",
|
|
353
|
+
accessorKey: "pf_collectible.type",
|
|
354
|
+
accessorFn: (n) => L.formattedType(n),
|
|
355
|
+
meta: {
|
|
356
|
+
maxWidth: "200px"
|
|
357
|
+
},
|
|
358
|
+
cell(n) {
|
|
359
|
+
const s = L.formattedType(n.row.original);
|
|
360
|
+
return l("div", { class: "flex items-center" }, [
|
|
361
|
+
l("div", { class: "truncate text-ellipsis" }, s),
|
|
362
|
+
s.length > 20 ? l(
|
|
363
|
+
T.FmTooltip,
|
|
364
|
+
{
|
|
365
|
+
content: s
|
|
366
|
+
},
|
|
367
|
+
[
|
|
368
|
+
l(T.FmIcon, {
|
|
369
|
+
name: "info",
|
|
370
|
+
color: "primary",
|
|
371
|
+
outline: !0,
|
|
372
|
+
size: "sm"
|
|
373
|
+
})
|
|
374
|
+
]
|
|
375
|
+
) : null
|
|
376
|
+
]);
|
|
377
|
+
}
|
|
378
|
+
},
|
|
379
|
+
{
|
|
380
|
+
header: "Source",
|
|
381
|
+
accessorKey: "source",
|
|
382
|
+
cell(n) {
|
|
383
|
+
var s;
|
|
384
|
+
return l("div", { class: "flex items-center gap-4" }, [
|
|
385
|
+
l(
|
|
386
|
+
"div",
|
|
387
|
+
{ class: "truncate text-ellipsis" },
|
|
388
|
+
te(L.getReason(n.row.original.source))
|
|
389
|
+
),
|
|
390
|
+
...(s = n.row.original.metadata) != null && s.campaign ? [
|
|
391
|
+
l(
|
|
392
|
+
T.FmTooltip,
|
|
393
|
+
{
|
|
394
|
+
get content() {
|
|
395
|
+
var R;
|
|
396
|
+
return (R = m.campaigns.all.find(
|
|
397
|
+
(y) => {
|
|
398
|
+
var d;
|
|
399
|
+
return y._id === ((d = n.row.original.metadata) == null ? void 0 : d.campaign);
|
|
400
|
+
}
|
|
401
|
+
)) == null ? void 0 : R.name;
|
|
402
|
+
}
|
|
403
|
+
},
|
|
404
|
+
[
|
|
405
|
+
l(T.FmIcon, {
|
|
406
|
+
name: "info",
|
|
407
|
+
color: "primary",
|
|
408
|
+
size: "sm",
|
|
409
|
+
onClick: async (R) => {
|
|
410
|
+
R.preventDefault(), R.stopPropagation();
|
|
411
|
+
const y = m.campaigns.all.find(
|
|
412
|
+
(d) => {
|
|
413
|
+
var M;
|
|
414
|
+
return d._id === ((M = n.row.original.metadata) == null ? void 0 : M.campaign);
|
|
415
|
+
}
|
|
416
|
+
);
|
|
417
|
+
if (y)
|
|
418
|
+
switch (y.type) {
|
|
419
|
+
case "VOUCHER":
|
|
420
|
+
case "PROMOTION":
|
|
421
|
+
case "BROADCAST":
|
|
422
|
+
await C.push({
|
|
423
|
+
name: ee[`$connect-CAMPAIGN_${y.type}`]
|
|
424
|
+
});
|
|
425
|
+
break;
|
|
426
|
+
case "GAME":
|
|
427
|
+
case "CREDIT":
|
|
428
|
+
case "MISSION":
|
|
429
|
+
await C.push({
|
|
430
|
+
name: ee[`$connect-PROGRAM_${y.type}`]
|
|
431
|
+
});
|
|
432
|
+
break;
|
|
433
|
+
case "POINT":
|
|
434
|
+
await C.push({
|
|
435
|
+
name: ee["$connect-PROGRAM_EXPERIENCE"]
|
|
436
|
+
});
|
|
437
|
+
break;
|
|
438
|
+
case "COIN":
|
|
439
|
+
await C.push({
|
|
440
|
+
name: ee["$connect-PROGRAM_POINT"]
|
|
441
|
+
});
|
|
442
|
+
break;
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
})
|
|
446
|
+
]
|
|
447
|
+
)
|
|
448
|
+
] : []
|
|
449
|
+
]);
|
|
450
|
+
}
|
|
451
|
+
},
|
|
452
|
+
{
|
|
453
|
+
header: "User",
|
|
454
|
+
accessorKey: "pf_user.name",
|
|
455
|
+
cell(n) {
|
|
456
|
+
return xe(n.row.original.pf_user);
|
|
457
|
+
}
|
|
458
|
+
},
|
|
459
|
+
{
|
|
460
|
+
header: "Phone No.",
|
|
461
|
+
accessorKey: "pf_user.phoneNumber",
|
|
462
|
+
accessorFn: (n) => {
|
|
463
|
+
var s;
|
|
464
|
+
return ((s = n == null ? void 0 : n.pf_user) == null ? void 0 : s.phoneNumber) || "";
|
|
465
|
+
}
|
|
466
|
+
},
|
|
467
|
+
{
|
|
468
|
+
header: "Status",
|
|
469
|
+
id: "status",
|
|
470
|
+
enableSorting: !1,
|
|
471
|
+
cell(n) {
|
|
472
|
+
const s = !!n.row.original.refunded;
|
|
473
|
+
return l(T.FmChip, {
|
|
474
|
+
label: v(s ? "connect.transaction.refunded" : "connect.transaction.completed"),
|
|
475
|
+
variant: "plain",
|
|
476
|
+
class: s ? "text-fm-color-typo-warning bg-fm-color-system-warning-100" : "text-fm-color-typo-success bg-fm-color-system-success-100"
|
|
477
|
+
});
|
|
478
|
+
}
|
|
479
|
+
},
|
|
480
|
+
{
|
|
481
|
+
accessorFn: (n) => n.ref,
|
|
482
|
+
header: "References",
|
|
483
|
+
accessorKey: "ref",
|
|
484
|
+
cell(n) {
|
|
485
|
+
var s, R;
|
|
486
|
+
return l("div", { class: "flex items-center justify-between gap-4" }, [
|
|
487
|
+
l("div", { class: "flex items-center" }, [
|
|
488
|
+
(s = n.row.original.metadata) != null && s.remark ? l(
|
|
489
|
+
T.FmTooltip,
|
|
490
|
+
{
|
|
491
|
+
content: (R = n.row.original.metadata) == null ? void 0 : R.remark
|
|
492
|
+
},
|
|
493
|
+
[
|
|
494
|
+
l(T.FmIcon, {
|
|
495
|
+
name: "info",
|
|
496
|
+
class: "pl-2",
|
|
497
|
+
outline: !0,
|
|
498
|
+
size: "sm"
|
|
499
|
+
})
|
|
500
|
+
]
|
|
501
|
+
) : l("div")
|
|
502
|
+
]),
|
|
503
|
+
l("div", { class: "flex-1" }, n.row.original.ref)
|
|
504
|
+
]);
|
|
505
|
+
}
|
|
506
|
+
},
|
|
507
|
+
{
|
|
508
|
+
header: "Actions",
|
|
509
|
+
cell(n) {
|
|
510
|
+
const s = n.row.original;
|
|
511
|
+
return l(
|
|
512
|
+
T.FmTooltip,
|
|
513
|
+
{
|
|
514
|
+
get content() {
|
|
515
|
+
return "Revert Transaction";
|
|
516
|
+
}
|
|
517
|
+
},
|
|
518
|
+
[
|
|
519
|
+
l(T.FmButton, {
|
|
520
|
+
variant: "tertiary",
|
|
521
|
+
icon: "amend",
|
|
522
|
+
iconColor: "neutral-gray-400",
|
|
523
|
+
disabled: !s.isRevertable,
|
|
524
|
+
onClick: (R) => {
|
|
525
|
+
R.stopPropagation(), o(s);
|
|
526
|
+
}
|
|
527
|
+
})
|
|
528
|
+
]
|
|
529
|
+
);
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
], g = E({
|
|
533
|
+
search: "",
|
|
534
|
+
"pf_collectible.type": [],
|
|
535
|
+
"metadata.location": [],
|
|
536
|
+
dateRange: {
|
|
537
|
+
startDate: N().subtract(7, "day").toISOString(),
|
|
538
|
+
endDate: N().endOf("day").toISOString()
|
|
539
|
+
},
|
|
540
|
+
source: []
|
|
541
|
+
}), h = () => ({
|
|
542
|
+
...g.value,
|
|
543
|
+
user: w.user,
|
|
544
|
+
dateRange: {
|
|
545
|
+
start: new Date(g.value.dateRange.startDate).toISOString(),
|
|
546
|
+
end: new Date(g.value.dateRange.endDate).toISOString()
|
|
547
|
+
}
|
|
548
|
+
}), { tableMeta: r, rowData: _, onSort: x, debouncedFetchData: p, resetCursorState: a } = Ue(async (n) => {
|
|
549
|
+
const s = await H.readAllCursor(
|
|
550
|
+
n,
|
|
551
|
+
h()
|
|
552
|
+
), R = await Promise.all(
|
|
553
|
+
s.resources.map(async (y) => {
|
|
554
|
+
let d;
|
|
555
|
+
if (y.source !== ue.enum.BILL)
|
|
556
|
+
d = !1;
|
|
557
|
+
else {
|
|
558
|
+
const B = y.refunded || !!y.refundedFrom;
|
|
559
|
+
if (y.expiryAmount.reduce(
|
|
560
|
+
(U, Y) => U + Y.amount,
|
|
561
|
+
y.amount ?? 0
|
|
562
|
+
) > 0) {
|
|
563
|
+
let U = [];
|
|
564
|
+
[
|
|
565
|
+
ie.enum.STAMP,
|
|
566
|
+
ie.enum.POINT
|
|
567
|
+
].includes(y.pf_collectible.type) ? d = !1 : d = !B;
|
|
568
|
+
} else
|
|
569
|
+
switch (y.pf_collectible.type) {
|
|
570
|
+
case ie.enum.VOUCHER:
|
|
571
|
+
d = y.expiryAmount.some(
|
|
572
|
+
(Y) => !Y.expiredAt || N(Y.expiredAt).isAfter(N())
|
|
573
|
+
) && !B;
|
|
574
|
+
break;
|
|
575
|
+
default:
|
|
576
|
+
d = !B;
|
|
577
|
+
break;
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
const M = t.value.find((B) => B._id === y.ref);
|
|
581
|
+
return {
|
|
582
|
+
...y,
|
|
583
|
+
ref: (M == null ? void 0 : M.seqNumber) || y.ref,
|
|
584
|
+
isRevertable: d
|
|
585
|
+
};
|
|
586
|
+
})
|
|
587
|
+
);
|
|
588
|
+
return {
|
|
589
|
+
resources: s.resources.map((y) => {
|
|
590
|
+
const d = t.value.find((M) => M._id === y.ref);
|
|
591
|
+
return { ...y, ref: (d == null ? void 0 : d.seqNumber) || y.ref };
|
|
592
|
+
}),
|
|
593
|
+
meta: s.meta
|
|
594
|
+
};
|
|
595
|
+
}), t = E([]), b = ue.options.map((n) => ({ label: te(L.getReason(n)), value: n })), e = z(
|
|
596
|
+
() => u.locations.map((n) => ({ label: n.name, value: n._id }))
|
|
597
|
+
);
|
|
598
|
+
ye(
|
|
599
|
+
g,
|
|
600
|
+
() => {
|
|
601
|
+
a(), p({ pageIndex: 0 });
|
|
602
|
+
},
|
|
603
|
+
{ deep: !0 }
|
|
604
|
+
);
|
|
605
|
+
async function o(n) {
|
|
606
|
+
V(
|
|
607
|
+
async () => {
|
|
608
|
+
await H.revertTransaction({
|
|
609
|
+
id: n._id.toString()
|
|
610
|
+
}), await p();
|
|
611
|
+
},
|
|
612
|
+
{
|
|
613
|
+
message: "Reverting transaction...",
|
|
614
|
+
successMessage: "Transaction reverted successfully"
|
|
615
|
+
}
|
|
616
|
+
);
|
|
617
|
+
}
|
|
618
|
+
async function c() {
|
|
619
|
+
try {
|
|
620
|
+
P.value = !0;
|
|
621
|
+
const n = new Ye(), s = h(), R = 1e3;
|
|
622
|
+
await V(
|
|
623
|
+
async () => {
|
|
624
|
+
var M, B, q, U, Y, pe, fe;
|
|
625
|
+
let y, d = !0;
|
|
626
|
+
for (; d; ) {
|
|
627
|
+
const Z = await H.readAllCursor(
|
|
628
|
+
{
|
|
629
|
+
limit: R,
|
|
630
|
+
sortBy: "_id",
|
|
631
|
+
descending: !1,
|
|
632
|
+
...y ? { cursor: y } : {}
|
|
633
|
+
},
|
|
634
|
+
s
|
|
635
|
+
);
|
|
636
|
+
if (!Z.resources.length)
|
|
637
|
+
break;
|
|
638
|
+
for (const $ of Z.resources)
|
|
639
|
+
n.addRecord({
|
|
640
|
+
TransactionID: $._id,
|
|
641
|
+
CreatedAt: N(j($._id.toString())).format(
|
|
642
|
+
"D MMM YYYY, hh:mmA"
|
|
643
|
+
),
|
|
644
|
+
Amount: W(
|
|
645
|
+
$.expiryAmount.reduce(
|
|
646
|
+
(Ce, Re) => Ce + Re.amount,
|
|
647
|
+
$.amount ?? 0
|
|
648
|
+
),
|
|
649
|
+
2
|
|
650
|
+
),
|
|
651
|
+
ExpiredAt: (B = (M = $.expiryAmount) == null ? void 0 : M[0]) != null && B.expiredAt ? N((U = (q = $.expiryAmount) == null ? void 0 : q[0]) == null ? void 0 : U.expiredAt).format("D MMM YYYY") : "",
|
|
652
|
+
Type: L.formattedType($),
|
|
653
|
+
Source: te(L.getReason($.source)),
|
|
654
|
+
User: ((Y = $.pf_user) == null ? void 0 : Y.name) || "",
|
|
655
|
+
"Phone No.": ((pe = $.pf_user) == null ? void 0 : pe.phoneNumber) || "",
|
|
656
|
+
References: $.ref,
|
|
657
|
+
Remark: ((fe = $.metadata) == null ? void 0 : fe.remark) || ""
|
|
658
|
+
});
|
|
659
|
+
y = Z.meta.nextCursor ?? void 0, d = Z.meta.hasNext && !!y;
|
|
660
|
+
}
|
|
661
|
+
await Ee(
|
|
662
|
+
n.buildExcel(),
|
|
663
|
+
`transactions-${(/* @__PURE__ */ new Date()).toISOString()}.xlsx`,
|
|
664
|
+
{
|
|
665
|
+
bookType: "xlsx",
|
|
666
|
+
bookSST: !1,
|
|
667
|
+
type: "array"
|
|
668
|
+
}
|
|
669
|
+
);
|
|
670
|
+
},
|
|
671
|
+
{
|
|
672
|
+
message: "Exporting transactions...",
|
|
673
|
+
successMessage: "transactions exported successfully"
|
|
674
|
+
}
|
|
675
|
+
);
|
|
676
|
+
} catch (n) {
|
|
677
|
+
console.error(n);
|
|
678
|
+
} finally {
|
|
679
|
+
P.value = !1;
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
const F = E(null);
|
|
683
|
+
function D(n) {
|
|
684
|
+
var s;
|
|
685
|
+
console.log(n), (s = F.value) == null || s.showSheet(!0, n.original);
|
|
686
|
+
}
|
|
687
|
+
return De(async () => {
|
|
688
|
+
await u.readLocations(), await m.read(), await p();
|
|
689
|
+
}), (n, s) => {
|
|
690
|
+
const R = K("FmSearch"), y = K("FmButton");
|
|
691
|
+
return k(), O(X, null, [
|
|
692
|
+
S("div", null, [
|
|
693
|
+
S("div", Xe, [
|
|
694
|
+
A(R, {
|
|
695
|
+
class: "hidden xs:!flex border-b border-fm-color-neutral-gray-100",
|
|
696
|
+
modelValue: i(g).search,
|
|
697
|
+
"onUpdate:modelValue": s[0] || (s[0] = (d) => i(g).search = d),
|
|
698
|
+
placeholder: "Search",
|
|
699
|
+
collapsible: ""
|
|
700
|
+
}, null, 8, ["modelValue"]),
|
|
701
|
+
A(y, {
|
|
702
|
+
icon: "ios_share",
|
|
703
|
+
variant: "tertiary",
|
|
704
|
+
onClick: c
|
|
705
|
+
})
|
|
706
|
+
]),
|
|
707
|
+
S("div", Je, [
|
|
708
|
+
S("div", Ze, [
|
|
709
|
+
A(le, {
|
|
710
|
+
class: "cursor-pointer text-fm-color-neutral-gray-400",
|
|
711
|
+
"right-icon": "keyboard_arrow_down",
|
|
712
|
+
modelValue: i(g)["metadata.location"],
|
|
713
|
+
"onUpdate:modelValue": s[1] || (s[1] = (d) => i(g)["metadata.location"] = d),
|
|
714
|
+
icon: "storefront",
|
|
715
|
+
"show-item-label": !0,
|
|
716
|
+
items: i(e)
|
|
717
|
+
}, null, 8, ["modelValue", "items"]),
|
|
718
|
+
A(le, {
|
|
719
|
+
class: "cursor-pointer text-fm-color-neutral-gray-400",
|
|
720
|
+
"right-icon": "keyboard_arrow_down",
|
|
721
|
+
modelValue: i(g)["pf_collectible.type"],
|
|
722
|
+
"onUpdate:modelValue": s[2] || (s[2] = (d) => i(g)["pf_collectible.type"] = d),
|
|
723
|
+
label: "Type: ",
|
|
724
|
+
"show-item-label": !0,
|
|
725
|
+
items: [
|
|
726
|
+
{ label: "Point", value: "COIN" },
|
|
727
|
+
{ label: "Credit", value: "CREDIT" },
|
|
728
|
+
{ label: "Voucher", value: "VOUCHER" },
|
|
729
|
+
{ label: "Experience", value: "POINT" },
|
|
730
|
+
{ label: "Tier", value: "TIER" },
|
|
731
|
+
{ label: "Title", value: "TITLE" },
|
|
732
|
+
{ label: "Game", value: "GAME" },
|
|
733
|
+
{ label: "Stamp", value: "STAMP" }
|
|
734
|
+
]
|
|
735
|
+
}, null, 8, ["modelValue"]),
|
|
736
|
+
A(le, {
|
|
737
|
+
class: "cursor-pointer text-fm-color-neutral-gray-400",
|
|
738
|
+
"right-icon": "keyboard_arrow_down",
|
|
739
|
+
modelValue: i(g).source,
|
|
740
|
+
"onUpdate:modelValue": s[3] || (s[3] = (d) => i(g).source = d),
|
|
741
|
+
label: "Source: ",
|
|
742
|
+
"show-item-label": !0,
|
|
743
|
+
items: i(b)
|
|
744
|
+
}, null, 8, ["modelValue", "items"]),
|
|
745
|
+
A(ve, {
|
|
746
|
+
"model-value": {
|
|
747
|
+
startDate: i(g).dateRange.startDate,
|
|
748
|
+
endDate: i(g).dateRange.endDate
|
|
749
|
+
},
|
|
750
|
+
"onUpdate:modelValue": s[4] || (s[4] = (d) => i(g).dateRange = {
|
|
751
|
+
startDate: i(N)(d.startDate).startOf("d").toISOString(),
|
|
752
|
+
endDate: i(N)(d.endDate).endOf("d").toISOString()
|
|
753
|
+
})
|
|
754
|
+
}, null, 8, ["model-value"])
|
|
755
|
+
]),
|
|
756
|
+
A(R, {
|
|
757
|
+
class: "xs:hidden",
|
|
758
|
+
modelValue: i(g).search,
|
|
759
|
+
"onUpdate:modelValue": s[5] || (s[5] = (d) => i(g).search = d),
|
|
760
|
+
placeholder: "Search",
|
|
761
|
+
collapsible: ""
|
|
762
|
+
}, null, 8, ["modelValue"]),
|
|
763
|
+
S("div", et, [
|
|
764
|
+
A(y, {
|
|
765
|
+
icon: "ios_share",
|
|
766
|
+
variant: "tertiary",
|
|
767
|
+
onClick: c
|
|
768
|
+
})
|
|
769
|
+
])
|
|
770
|
+
]),
|
|
771
|
+
A(be, {
|
|
772
|
+
loading: i(r).isLoading,
|
|
773
|
+
"row-data": i(_),
|
|
774
|
+
"row-count": i(r).totalRows,
|
|
775
|
+
"column-defs": I.filter(
|
|
776
|
+
(d) => !w.user || d.header !== "User" && d.header !== "Phone No."
|
|
777
|
+
),
|
|
778
|
+
"page-count": i(r).pageCount,
|
|
779
|
+
"page-index": i(r).pageIndex,
|
|
780
|
+
"page-size": i(r).pageSize,
|
|
781
|
+
"shrink-at": !1,
|
|
782
|
+
"pagination-mode": "cursor",
|
|
783
|
+
"has-next": i(r).hasNext,
|
|
784
|
+
onSortChange: i(x),
|
|
785
|
+
onPageChange: s[6] || (s[6] = (d) => i(p)({
|
|
786
|
+
pageSize: d.pageSize,
|
|
787
|
+
pageIndex: d.pageIndex
|
|
788
|
+
})),
|
|
789
|
+
onRowClick: D
|
|
790
|
+
}, null, 8, ["loading", "row-data", "row-count", "column-defs", "page-count", "page-index", "page-size", "has-next", "onSortChange"])
|
|
791
|
+
]),
|
|
792
|
+
A(Qe, {
|
|
793
|
+
ref_key: "transactionDetailSheet",
|
|
794
|
+
ref: F
|
|
795
|
+
}, null, 512)
|
|
796
|
+
], 64);
|
|
797
|
+
};
|
|
798
|
+
}
|
|
799
|
+
});
|
|
800
|
+
class tt extends Se {
|
|
801
|
+
}
|
|
802
|
+
function oe(f) {
|
|
803
|
+
return f.quantity ?? 1;
|
|
804
|
+
}
|
|
805
|
+
function we(f, v) {
|
|
806
|
+
var u, m;
|
|
807
|
+
switch ((u = f.paymentType) == null ? void 0 : u.type) {
|
|
808
|
+
case "COIN":
|
|
809
|
+
return v("connect.store.paymentType.point");
|
|
810
|
+
case "CARD":
|
|
811
|
+
return v("connect.store.paymentType.cardActivation");
|
|
812
|
+
default:
|
|
813
|
+
return ((m = f.paymentType) == null ? void 0 : m.type) ?? v("connect.store.paymentType.notAvailable");
|
|
814
|
+
}
|
|
815
|
+
}
|
|
816
|
+
function J(f, v) {
|
|
817
|
+
return Oe({
|
|
818
|
+
...v,
|
|
819
|
+
amount: v.amount * oe(f)
|
|
820
|
+
});
|
|
821
|
+
}
|
|
822
|
+
function me(f) {
|
|
823
|
+
var v;
|
|
824
|
+
if (((v = f.paymentType) == null ? void 0 : v.type) === "COIN") {
|
|
825
|
+
if (f.bundle.coinPrice == null) return "N/A";
|
|
826
|
+
const u = f.bundle.coinPrice * oe(f);
|
|
827
|
+
return `${W(u, 2, !0)} points`;
|
|
828
|
+
}
|
|
829
|
+
return J(
|
|
830
|
+
f,
|
|
831
|
+
f.bundle.priceWithTaxes ?? f.bundle.price
|
|
832
|
+
);
|
|
833
|
+
}
|
|
834
|
+
function at(f) {
|
|
835
|
+
return J(
|
|
836
|
+
f,
|
|
837
|
+
f.bundle.originalPrice ?? f.bundle.price
|
|
838
|
+
);
|
|
839
|
+
}
|
|
840
|
+
function nt(f) {
|
|
841
|
+
const [v, ...u] = f.bundle.taxTotals ?? [];
|
|
842
|
+
if (!v) return null;
|
|
843
|
+
const m = u.reduce(
|
|
844
|
+
(C, w) => C + w.total.amount,
|
|
845
|
+
v.total.amount
|
|
846
|
+
);
|
|
847
|
+
return J(f, {
|
|
848
|
+
...v.total,
|
|
849
|
+
amount: m
|
|
850
|
+
});
|
|
851
|
+
}
|
|
852
|
+
const ot = { class: "space-y-24 pr-12" }, rt = { class: "fm-typo-en-title-sm-800 mb-16" }, st = {
|
|
853
|
+
key: 0,
|
|
854
|
+
class: "space-y-16"
|
|
855
|
+
}, lt = { class: "fm-typo-en-body-lg-600" }, it = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary break-words" }, ct = {
|
|
856
|
+
key: 1,
|
|
857
|
+
class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary"
|
|
858
|
+
}, ut = /* @__PURE__ */ re({
|
|
859
|
+
__name: "StoreTransactionDetailSheet",
|
|
860
|
+
setup(f, { expose: v }) {
|
|
861
|
+
const u = E(!1), m = E(null), { t: C } = se();
|
|
862
|
+
function w(a, t) {
|
|
863
|
+
u.value = a, m.value = t ?? null;
|
|
864
|
+
}
|
|
865
|
+
function P(a) {
|
|
866
|
+
if (!a.location) return "Online Store";
|
|
867
|
+
const t = Array.isArray(a.pf_location) ? a.pf_location[0] : a.pf_location;
|
|
868
|
+
return (t == null ? void 0 : t.name) ?? a.location.toString();
|
|
869
|
+
}
|
|
870
|
+
function V(a) {
|
|
871
|
+
return Array.isArray(a) ? a.flatMap((t) => typeof t != "object" || t === null || !("name" in t) || typeof t.name != "string" ? [] : [t.name]) : [];
|
|
872
|
+
}
|
|
873
|
+
function I(a, t, b, e) {
|
|
874
|
+
if (a.length === t)
|
|
875
|
+
return a.map((c) => b > 1 ? `${c} × ${b}` : c).join(", ");
|
|
876
|
+
const o = t * b;
|
|
877
|
+
return `${o} ${e}${o === 1 ? "" : "s"}`;
|
|
878
|
+
}
|
|
879
|
+
const g = z(() => {
|
|
880
|
+
var e, o, c;
|
|
881
|
+
const a = m.value;
|
|
882
|
+
if (!a) return [];
|
|
883
|
+
const t = a.pf_member, b = we(a, C);
|
|
884
|
+
return [
|
|
885
|
+
{ label: "Transaction ID", value: a._id.toString() },
|
|
886
|
+
{
|
|
887
|
+
label: "Date/Time",
|
|
888
|
+
value: N(j(a._id.toString())).format(
|
|
889
|
+
"D MMM YYYY, hh:mmA"
|
|
890
|
+
)
|
|
891
|
+
},
|
|
892
|
+
{
|
|
893
|
+
label: "Status",
|
|
894
|
+
value: Q.title(a.refund ? "REFUNDED" : a.status)
|
|
895
|
+
},
|
|
896
|
+
{
|
|
897
|
+
label: "Customer",
|
|
898
|
+
value: (t == null ? void 0 : t.name) ?? (t == null ? void 0 : t.email) ?? (t == null ? void 0 : t.phoneNumber) ?? "Unknown"
|
|
899
|
+
},
|
|
900
|
+
{ label: "Location", value: P(a) },
|
|
901
|
+
{
|
|
902
|
+
label: "Payment Type",
|
|
903
|
+
value: ((e = a.paymentType) == null ? void 0 : e.type) === "COIN" || ((o = a.paymentType) == null ? void 0 : o.type) === "CARD" || !((c = a.paymentType) != null && c.type) ? b : Q.title(b)
|
|
904
|
+
},
|
|
905
|
+
{ label: "Reference", value: a.ref || "N/A" },
|
|
906
|
+
...a.paymentRef ? [{ label: "Payment Reference", value: a.paymentRef }] : [],
|
|
907
|
+
{
|
|
908
|
+
label: "Quantity",
|
|
909
|
+
value: oe(a).toString()
|
|
910
|
+
}
|
|
911
|
+
];
|
|
912
|
+
}), h = z(() => {
|
|
913
|
+
const a = m.value;
|
|
914
|
+
return a ? [
|
|
915
|
+
{ label: "Bundle Name", value: a.bundle.name },
|
|
916
|
+
{
|
|
917
|
+
label: "Bundle Value",
|
|
918
|
+
value: at(a)
|
|
919
|
+
},
|
|
920
|
+
{
|
|
921
|
+
label: "Base Subtotal",
|
|
922
|
+
value: J(a, a.bundle.price)
|
|
923
|
+
},
|
|
924
|
+
{
|
|
925
|
+
label: "Selling Price",
|
|
926
|
+
value: me(a)
|
|
927
|
+
}
|
|
928
|
+
] : [];
|
|
929
|
+
}), r = z(() => {
|
|
930
|
+
var o;
|
|
931
|
+
const a = m.value;
|
|
932
|
+
if (!a) return [];
|
|
933
|
+
const { bundle: t } = a, b = oe(a), e = [];
|
|
934
|
+
if (t.credit.normal > 0 && e.push({
|
|
935
|
+
label: "Credit",
|
|
936
|
+
value: `${W(
|
|
937
|
+
t.credit.normal * b,
|
|
938
|
+
2,
|
|
939
|
+
!0
|
|
940
|
+
)} credits`
|
|
941
|
+
}), (o = t.credit.free) != null && o.amount) {
|
|
942
|
+
const c = `${t.credit.free.day} day${t.credit.free.day === 1 ? "" : "s"}`;
|
|
943
|
+
e.push({
|
|
944
|
+
label: "Free Credit",
|
|
945
|
+
value: `${W(
|
|
946
|
+
t.credit.free.amount * b,
|
|
947
|
+
2,
|
|
948
|
+
!0
|
|
949
|
+
)} credits (${c})`
|
|
950
|
+
});
|
|
951
|
+
}
|
|
952
|
+
return t.vouchers.length > 0 && e.push({
|
|
953
|
+
label: "Vouchers",
|
|
954
|
+
value: I(
|
|
955
|
+
V(t.pf_vouchers),
|
|
956
|
+
t.vouchers.length,
|
|
957
|
+
b,
|
|
958
|
+
"voucher"
|
|
959
|
+
)
|
|
960
|
+
}), t.titles.length > 0 && e.push({
|
|
961
|
+
label: "Titles",
|
|
962
|
+
value: I(
|
|
963
|
+
V(t.pf_titles),
|
|
964
|
+
t.titles.length,
|
|
965
|
+
b,
|
|
966
|
+
"title"
|
|
967
|
+
)
|
|
968
|
+
}), e;
|
|
969
|
+
}), _ = z(() => {
|
|
970
|
+
const a = m.value;
|
|
971
|
+
if (!a) return [];
|
|
972
|
+
const t = (a.bundle.taxTotals ?? []).map((e) => {
|
|
973
|
+
var c;
|
|
974
|
+
const o = (c = a.bundle._inclusiveTaxes) == null ? void 0 : c.some(
|
|
975
|
+
(F) => F.systemCode === e.systemCode && F.inclusive
|
|
976
|
+
);
|
|
977
|
+
return {
|
|
978
|
+
label: `${e.name} (${Ne(e.rate)}%, ${o ? "Inclusive" : "Exclusive"})`,
|
|
979
|
+
value: J(a, e.total)
|
|
980
|
+
};
|
|
981
|
+
}), b = nt(a);
|
|
982
|
+
return b ? [...t, { label: "Tax Total", value: b }] : t;
|
|
983
|
+
}), x = z(() => {
|
|
984
|
+
var t;
|
|
985
|
+
const a = (t = m.value) == null ? void 0 : t.giftCard;
|
|
986
|
+
return a ? [
|
|
987
|
+
{ label: "Movement", value: Q.title(a.movement) },
|
|
988
|
+
{
|
|
989
|
+
label: "Serial Number",
|
|
990
|
+
value: a.serialNumber ?? (a.movement === "PURCHASE" ? "Pending card issuance" : "Not available")
|
|
991
|
+
}
|
|
992
|
+
] : [];
|
|
993
|
+
}), p = z(() => [
|
|
994
|
+
{ title: "Transaction", items: g.value },
|
|
995
|
+
{ title: "Bundle & Pricing", items: h.value },
|
|
996
|
+
{ title: "Rewards", items: r.value, emptyText: "No rewards" },
|
|
997
|
+
{ title: "Taxes", items: _.value, emptyText: "No taxes" },
|
|
998
|
+
...x.value.length ? [{ title: "Gift Card", items: x.value }] : []
|
|
999
|
+
]);
|
|
1000
|
+
return v({ showSheet: w }), (a, t) => {
|
|
1001
|
+
const b = K("FmButton"), e = K("FmSideSheet");
|
|
1002
|
+
return k(), ce(e, {
|
|
1003
|
+
modelValue: i(u),
|
|
1004
|
+
"onUpdate:modelValue": t[1] || (t[1] = (o) => ge(u) ? u.value = o : null),
|
|
1005
|
+
"max-width": 560,
|
|
1006
|
+
header: "Store Transaction Details"
|
|
1007
|
+
}, {
|
|
1008
|
+
"side-sheet-footer": ae(() => [
|
|
1009
|
+
A(b, {
|
|
1010
|
+
label: "Close",
|
|
1011
|
+
variant: "tertiary",
|
|
1012
|
+
onClick: t[0] || (t[0] = (o) => w(!1))
|
|
1013
|
+
})
|
|
1014
|
+
]),
|
|
1015
|
+
default: ae(() => [
|
|
1016
|
+
S("div", ot, [
|
|
1017
|
+
(k(!0), O(X, null, ne(i(p), (o) => (k(), O("section", {
|
|
1018
|
+
key: o.title
|
|
1019
|
+
}, [
|
|
1020
|
+
S("h3", rt, G(o.title), 1),
|
|
1021
|
+
o.items.length ? (k(), O("div", st, [
|
|
1022
|
+
(k(!0), O(X, null, ne(o.items, (c) => (k(), O("div", {
|
|
1023
|
+
key: c.label,
|
|
1024
|
+
class: "flex flex-col gap-4"
|
|
1025
|
+
}, [
|
|
1026
|
+
S("div", lt, G(c.label), 1),
|
|
1027
|
+
S("div", it, G(c.value), 1),
|
|
1028
|
+
t[2] || (t[2] = S("hr", { class: "mt-3 border-fm-color-neutral-gray-100" }, null, -1))
|
|
1029
|
+
]))), 128))
|
|
1030
|
+
])) : (k(), O("div", ct, G(o.emptyText), 1))
|
|
1031
|
+
]))), 128))
|
|
1032
|
+
])
|
|
1033
|
+
]),
|
|
1034
|
+
_: 1
|
|
1035
|
+
}, 8, ["modelValue"]);
|
|
1036
|
+
};
|
|
1037
|
+
}
|
|
1038
|
+
}), mt = { class: "flex items-center justify-between" }, dt = { class: "flex gap-8 items-center" }, pt = { class: "flex gap-8 items-center xs:hidden" }, qt = /* @__PURE__ */ re({
|
|
1039
|
+
__name: "StoreTransactions",
|
|
1040
|
+
props: {
|
|
1041
|
+
user: {
|
|
1042
|
+
type: String
|
|
1043
|
+
}
|
|
1044
|
+
},
|
|
1045
|
+
setup(f) {
|
|
1046
|
+
const v = f, { minor: u } = Te, { t: m } = se();
|
|
1047
|
+
function C(e) {
|
|
1048
|
+
return we(e, m);
|
|
1049
|
+
}
|
|
1050
|
+
function w(e) {
|
|
1051
|
+
return N(j(e._id.toString())).format(
|
|
1052
|
+
"D MMM YYYY, hh:mmA"
|
|
1053
|
+
);
|
|
1054
|
+
}
|
|
1055
|
+
function P(e) {
|
|
1056
|
+
var o, c;
|
|
1057
|
+
return e.location ? ((c = (o = e.pf_location) == null ? void 0 : o[0]) == null ? void 0 : c.name) ?? e.location.toString() : "Online Store";
|
|
1058
|
+
}
|
|
1059
|
+
const V = [
|
|
1060
|
+
{
|
|
1061
|
+
header: "Transaction ID",
|
|
1062
|
+
meta: {
|
|
1063
|
+
maxWidth: "150px"
|
|
1064
|
+
},
|
|
1065
|
+
cell(e) {
|
|
1066
|
+
return l("div", { class: "flex items-center" }, [
|
|
1067
|
+
l(T.FmIcon, {
|
|
1068
|
+
name: "content_copy",
|
|
1069
|
+
outline: !0,
|
|
1070
|
+
size: "sm",
|
|
1071
|
+
class: "cursor-pointer mr-4 shrink-0",
|
|
1072
|
+
onClick: (o) => {
|
|
1073
|
+
o.preventDefault(), o.stopPropagation(), de(e.row.original._id.toString());
|
|
1074
|
+
}
|
|
1075
|
+
}),
|
|
1076
|
+
l("div", { class: "truncate" }, e.row.original._id.toString())
|
|
1077
|
+
]);
|
|
1078
|
+
}
|
|
1079
|
+
},
|
|
1080
|
+
{
|
|
1081
|
+
header: "Created at",
|
|
1082
|
+
accessorFn: w,
|
|
1083
|
+
enableSorting: !0
|
|
1084
|
+
},
|
|
1085
|
+
{
|
|
1086
|
+
header: "Bundle",
|
|
1087
|
+
accessorFn: (e) => e.bundle.name
|
|
1088
|
+
},
|
|
1089
|
+
{
|
|
1090
|
+
header: "Selling Price",
|
|
1091
|
+
cell: (e) => me(e.row.original)
|
|
1092
|
+
},
|
|
1093
|
+
{
|
|
1094
|
+
header: "Location",
|
|
1095
|
+
accessorFn: P
|
|
1096
|
+
},
|
|
1097
|
+
{
|
|
1098
|
+
header: "Payment Type",
|
|
1099
|
+
accessorFn: C,
|
|
1100
|
+
cell(e) {
|
|
1101
|
+
var o;
|
|
1102
|
+
return l("div", { class: "flex items-center gap-4" }, [
|
|
1103
|
+
l("div", { class: "flex items-center" }, [
|
|
1104
|
+
((o = e.row.original.paymentType) == null ? void 0 : o.type) == "ONLINE" && e.row.original.paymentType.extra ? l(
|
|
1105
|
+
T.FmTooltip,
|
|
1106
|
+
{
|
|
1107
|
+
content: e.row.original.paymentType.extra
|
|
1108
|
+
},
|
|
1109
|
+
[
|
|
1110
|
+
l(T.FmIcon, {
|
|
1111
|
+
name: "info",
|
|
1112
|
+
outline: !0,
|
|
1113
|
+
size: "sm"
|
|
1114
|
+
})
|
|
1115
|
+
]
|
|
1116
|
+
) : l("div")
|
|
1117
|
+
]),
|
|
1118
|
+
l("div", { class: "flex-1" }, C(e.row.original))
|
|
1119
|
+
]);
|
|
1120
|
+
}
|
|
1121
|
+
},
|
|
1122
|
+
{
|
|
1123
|
+
header: "User",
|
|
1124
|
+
cell: (e) => xe(e.row.original.pf_member)
|
|
1125
|
+
},
|
|
1126
|
+
{
|
|
1127
|
+
header: "Phone No.",
|
|
1128
|
+
accessorFn: (e) => e.pf_member.phoneNumber
|
|
1129
|
+
},
|
|
1130
|
+
{
|
|
1131
|
+
header: "Status",
|
|
1132
|
+
// accessorFn: (u) => u.status,
|
|
1133
|
+
cell(e) {
|
|
1134
|
+
var F, D, n, s;
|
|
1135
|
+
const o = e.row.original.status, c = {
|
|
1136
|
+
COMPLETED: "text-fm-color-typo-success bg-fm-color-system-success-100",
|
|
1137
|
+
REFUNDED: "text-fm-color-typo-warning bg-fm-color-system-warning-100"
|
|
1138
|
+
};
|
|
1139
|
+
return l("div", { class: "flex items-center gap-4" }, [
|
|
1140
|
+
l(T.FmChip, {
|
|
1141
|
+
label: Q.title(o),
|
|
1142
|
+
variant: "plain",
|
|
1143
|
+
class: c[o] ?? ""
|
|
1144
|
+
}),
|
|
1145
|
+
(D = (F = e.row.original) == null ? void 0 : F.refund) != null && D.reason ? l(
|
|
1146
|
+
T.FmTooltip,
|
|
1147
|
+
{
|
|
1148
|
+
content: (s = (n = e.row.original) == null ? void 0 : n.refund) == null ? void 0 : s.reason
|
|
1149
|
+
},
|
|
1150
|
+
[
|
|
1151
|
+
l(T.FmIcon, {
|
|
1152
|
+
name: "info",
|
|
1153
|
+
color: "primary",
|
|
1154
|
+
outline: !0,
|
|
1155
|
+
size: "sm"
|
|
1156
|
+
})
|
|
1157
|
+
]
|
|
1158
|
+
) : null
|
|
1159
|
+
]);
|
|
1160
|
+
}
|
|
1161
|
+
},
|
|
1162
|
+
{
|
|
1163
|
+
header: "Source",
|
|
1164
|
+
accessorFn: (e) => e.source
|
|
1165
|
+
},
|
|
1166
|
+
{
|
|
1167
|
+
header: "Ref",
|
|
1168
|
+
accessorFn: (e) => e.ref
|
|
1169
|
+
},
|
|
1170
|
+
{
|
|
1171
|
+
id: "action",
|
|
1172
|
+
cell(e) {
|
|
1173
|
+
const o = e.row.original, c = o.status === "COMPLETED" && !o.refund && o.source == "ADMIN";
|
|
1174
|
+
return c ? l(
|
|
1175
|
+
T.FmMenu,
|
|
1176
|
+
{
|
|
1177
|
+
placement: "bottom-end",
|
|
1178
|
+
onClick: (F) => {
|
|
1179
|
+
F.stopPropagation();
|
|
1180
|
+
}
|
|
1181
|
+
},
|
|
1182
|
+
{
|
|
1183
|
+
"menu-button": () => l(T.FmButton, {
|
|
1184
|
+
icon: "settings",
|
|
1185
|
+
variant: "tertiary",
|
|
1186
|
+
if: c
|
|
1187
|
+
}),
|
|
1188
|
+
default: () => [
|
|
1189
|
+
l(T.FmMenuItem, {
|
|
1190
|
+
label: "Refund",
|
|
1191
|
+
sublabel: "Refund this transaction",
|
|
1192
|
+
onClick: async (F) => {
|
|
1193
|
+
F.stopPropagation(), await p(o);
|
|
1194
|
+
}
|
|
1195
|
+
})
|
|
1196
|
+
]
|
|
1197
|
+
}
|
|
1198
|
+
) : l("div");
|
|
1199
|
+
}
|
|
1200
|
+
}
|
|
1201
|
+
], I = E({
|
|
1202
|
+
searchValue: "",
|
|
1203
|
+
dateRange: {
|
|
1204
|
+
startDate: N().subtract(7, "day").toISOString(),
|
|
1205
|
+
endDate: N().toISOString()
|
|
1206
|
+
}
|
|
1207
|
+
}), { tableMeta: g, rowData: h, onSort: r, debouncedFetchData: _, onSearch: x } = Pe(async (e) => {
|
|
1208
|
+
const o = {
|
|
1209
|
+
...I.value.dateRange,
|
|
1210
|
+
user: v.user
|
|
1211
|
+
};
|
|
1212
|
+
return await H.readStoreTransactions(e, o);
|
|
1213
|
+
});
|
|
1214
|
+
async function p(e) {
|
|
1215
|
+
await ke.confirm(
|
|
1216
|
+
"Are you sure you want to refund this transaction?",
|
|
1217
|
+
"Refund Store Transaction",
|
|
1218
|
+
"Confirm",
|
|
1219
|
+
"Cancel"
|
|
1220
|
+
) && await u(
|
|
1221
|
+
async () => {
|
|
1222
|
+
var c;
|
|
1223
|
+
await Be.refundStoreTransaction({
|
|
1224
|
+
id: e._id,
|
|
1225
|
+
reason: `ADMIN:${(c = $e().sessionUser) == null ? void 0 : c.name}`
|
|
1226
|
+
}), await _();
|
|
1227
|
+
},
|
|
1228
|
+
{
|
|
1229
|
+
message: "Refunding transaction...",
|
|
1230
|
+
successMessage: "Transaction refunded successfully"
|
|
1231
|
+
}
|
|
1232
|
+
);
|
|
1233
|
+
}
|
|
1234
|
+
ye(
|
|
1235
|
+
I,
|
|
1236
|
+
() => {
|
|
1237
|
+
_();
|
|
1238
|
+
},
|
|
1239
|
+
{ deep: !0 }
|
|
1240
|
+
), Ae(async () => {
|
|
1241
|
+
await _();
|
|
1242
|
+
});
|
|
1243
|
+
const a = async () => Me({
|
|
1244
|
+
exporter: new tt(),
|
|
1245
|
+
readFunction: (e) => H.readStoreTransactions(e, {
|
|
1246
|
+
...I.value.dateRange,
|
|
1247
|
+
user: v.user
|
|
1248
|
+
}),
|
|
1249
|
+
transformRecord: (e) => {
|
|
1250
|
+
var o, c, F, D;
|
|
1251
|
+
return {
|
|
1252
|
+
"Transaction ID": e._id.toString(),
|
|
1253
|
+
"Created at": w(e),
|
|
1254
|
+
Bundle: e.bundle.name || "",
|
|
1255
|
+
"Selling Price": me(e),
|
|
1256
|
+
Location: P(e),
|
|
1257
|
+
"Payment Type": C(e),
|
|
1258
|
+
"Payment Extra": ((o = e.paymentType) == null ? void 0 : o.extra) || "",
|
|
1259
|
+
User: ((c = e.pf_member) == null ? void 0 : c.name) || "",
|
|
1260
|
+
"Phone No.": ((F = e.pf_member) == null ? void 0 : F.phoneNumber) || "",
|
|
1261
|
+
Status: Q.title(e.status),
|
|
1262
|
+
"Refund Reason": ((D = e.refund) == null ? void 0 : D.reason) || "",
|
|
1263
|
+
Source: e.source,
|
|
1264
|
+
Ref: (e == null ? void 0 : e.ref) || ""
|
|
1265
|
+
};
|
|
1266
|
+
},
|
|
1267
|
+
filename: "store-transactions"
|
|
1268
|
+
}), t = E(null);
|
|
1269
|
+
function b(e) {
|
|
1270
|
+
var o;
|
|
1271
|
+
(o = t.value) == null || o.showSheet(!0, e.original);
|
|
1272
|
+
}
|
|
1273
|
+
return (e, o) => {
|
|
1274
|
+
const c = K("FmSearch"), F = K("FmButton");
|
|
1275
|
+
return k(), O("div", null, [
|
|
1276
|
+
S("div", mt, [
|
|
1277
|
+
S("div", dt, [
|
|
1278
|
+
A(ve, {
|
|
1279
|
+
modelValue: i(I).dateRange,
|
|
1280
|
+
"onUpdate:modelValue": o[0] || (o[0] = (D) => i(I).dateRange = D)
|
|
1281
|
+
}, null, 8, ["modelValue"])
|
|
1282
|
+
]),
|
|
1283
|
+
S("div", pt, [
|
|
1284
|
+
A(c, {
|
|
1285
|
+
modelValue: i(g).searchValue,
|
|
1286
|
+
"onUpdate:modelValue": [
|
|
1287
|
+
o[1] || (o[1] = (D) => i(g).searchValue = D),
|
|
1288
|
+
i(x)
|
|
1289
|
+
],
|
|
1290
|
+
placeholder: "Search",
|
|
1291
|
+
collapsible: ""
|
|
1292
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue"]),
|
|
1293
|
+
A(F, {
|
|
1294
|
+
icon: "ios_share",
|
|
1295
|
+
variant: "tertiary",
|
|
1296
|
+
onClick: a
|
|
1297
|
+
})
|
|
1298
|
+
])
|
|
1299
|
+
]),
|
|
1300
|
+
A(be, {
|
|
1301
|
+
loading: i(g).isLoading,
|
|
1302
|
+
"row-data": i(h),
|
|
1303
|
+
"row-count": i(g).totalRows,
|
|
1304
|
+
"column-defs": V.filter(
|
|
1305
|
+
(D) => !v.user || D.header !== "User" && D.header !== "Phone No."
|
|
1306
|
+
),
|
|
1307
|
+
"page-count": i(g).pageCount,
|
|
1308
|
+
"page-index": i(g).pageIndex,
|
|
1309
|
+
"page-size": i(g).pageSize,
|
|
1310
|
+
"shrink-at": !1,
|
|
1311
|
+
onSortChange: i(r),
|
|
1312
|
+
onRowClick: b,
|
|
1313
|
+
onPageChange: o[2] || (o[2] = (D) => i(_)({
|
|
1314
|
+
pageSize: D.pageSize,
|
|
1315
|
+
pageIndex: D.pageIndex
|
|
1316
|
+
}))
|
|
1317
|
+
}, null, 8, ["loading", "row-data", "row-count", "column-defs", "page-count", "page-index", "page-size", "onSortChange"]),
|
|
1318
|
+
A(ut, {
|
|
1319
|
+
ref_key: "transactionDetailSheet",
|
|
1320
|
+
ref: t
|
|
1321
|
+
}, null, 512)
|
|
1322
|
+
]);
|
|
1323
|
+
};
|
|
1324
|
+
}
|
|
1325
|
+
});
|
|
1326
|
+
export {
|
|
1327
|
+
Wt as _,
|
|
1328
|
+
qt as a
|
|
1329
|
+
};
|