@feedmepos/mf-connect 0.1.98-beta.8 → 0.1.98-prod

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (116) hide show
  1. package/dist/Analytic-BHDjuMfN.js +426 -0
  2. package/dist/{App-DsB2o1oB.js → App-BSSze_b9.js} +106 -118
  3. package/dist/{Bin-DMr7K8Kj.js → Bin-DfzoQbE0.js} +8 -8
  4. package/dist/{Broadcast-C9akM-TB.js → Broadcast-DsqO4SXX.js} +17 -18
  5. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-CwGoEBsW.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-DQ0x2VJp.js} +6 -5
  6. package/dist/{Card-DRkIYs0M.js → Card-VxbqomXV.js} +19 -19
  7. package/dist/{Collections-B0uGC2FE.js → Collections-CvD98I3M.js} +185 -197
  8. package/dist/{Credit-V5YA_hGx.js → Credit-BhM2m2L2.js} +53 -54
  9. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-DvfrrjHc.js +2223 -0
  10. package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-DJLxGk7W.js → EffectSheet.vue_vue_type_style_index_0_lang-CPx9U9fU.js} +6 -6
  11. package/dist/{Experience-WTWy5yY6.js → Experience-uWQRb-qf.js} +34 -35
  12. package/dist/{FileSaver.min-BlA0oZEC.js → FileSaver.min-DKNoHTvP.js} +1 -1
  13. package/dist/{Game-BwOfTCW5.js → Game-BgT3oNx7.js} +15 -16
  14. package/dist/{ImageInput.vue_vue_type_script_setup_true_lang-DNtLW0yQ.js → ImageInput.vue_vue_type_script_setup_true_lang-ClqrJbU6.js} +1 -1
  15. package/dist/{Index-m7l4insz.js → Index-D3RgVj9V.js} +10 -10
  16. package/dist/{LottieAnimation.vue_vue_type_script_setup_true_lang-Dsg2sWjF.js → LottieAnimation.vue_vue_type_script_setup_true_lang-CkCpumzB.js} +1 -1
  17. package/dist/{MainLayout-Du5kZOtA.js → MainLayout-B2RiPsIR.js} +1 -1
  18. package/dist/{Marketing-C9pSIdBU.js → Marketing-FrE7k7eW.js} +4 -4
  19. package/dist/{MarketingMaterialEdit-BEF2T9LR.js → MarketingMaterialEdit-DGNjEUu-.js} +211 -214
  20. package/dist/{Member-DUV_vbPI.js → Member-CgTagUQ9.js} +20 -20
  21. package/dist/{MemberList-Ye4nOk-i.js → MemberList-CKbzsDMX.js} +51 -50
  22. package/dist/{MemberTransactions-CAut1TQb.js → MemberTransactions-CnY5cFdv.js} +1 -1
  23. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-1AuHixPC.js → MessageInput.vue_vue_type_script_setup_true_lang-DqivG_O4.js} +11 -11
  24. package/dist/{Mission-BBmCGpt8.js → Mission-BGNqy7wQ.js} +34 -35
  25. package/dist/{Overview-DOJj4XvO.js → Overview-CnpF74wa.js} +19 -19
  26. package/dist/{Point-Bzg6hi6o.js → Point-BHgIy7Bz.js} +29 -30
  27. package/dist/{Promotion-BMXIp_ef.js → Promotion-CNQvO5Lq.js} +105 -111
  28. package/dist/{Queue-55G2gtP5.js → Queue-CoPBE0UP.js} +43 -43
  29. package/dist/{Record-DNPI02c6.js → Record-BuDQ15FJ.js} +10 -10
  30. package/dist/{Reward-CnP8R2pS.js → Reward-BQlCO3Dk.js} +17 -17
  31. package/dist/{RewardGroup.vue_vue_type_script_setup_true_lang-BN71h9IK.js → RewardGroup.vue_vue_type_script_setup_true_lang-nhNr_T7D.js} +12 -12
  32. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-lnxwLa8o.js +1888 -0
  33. package/dist/{Segment-CxiQnnyj.js → Segment-DKFAXGzY.js} +78 -77
  34. package/dist/{SelectItems.vue_vue_type_script_setup_true_lang-C4vohf6c.js → SelectItems.vue_vue_type_script_setup_true_lang-CUR7djaM.js} +3 -3
  35. package/dist/{SendCollectionSheet.vue_vue_type_script_setup_true_lang-B1vj5f7T.js → SendCollectionSheet.vue_vue_type_script_setup_true_lang-CZ3s2W8Q.js} +12 -12
  36. package/dist/{SendVoucherSheet.vue_vue_type_script_setup_true_lang-cWx0G3nM.js → SendVoucherSheet.vue_vue_type_script_setup_true_lang-BbilZk82.js} +4 -4
  37. package/dist/{Setting-jHAjccod.js → Setting-hrDZ1cQR.js} +248 -259
  38. package/dist/{SettingAdvertisements-Vt7w1WN3.js → SettingAdvertisements-CQsx4JqQ.js} +13 -13
  39. package/dist/{Store-Cu-hKmVa.js → Store-Cgmsklnt.js} +24 -24
  40. package/dist/{StoreRewards-DILeipMG.js → StoreRewards-CrPO4DKG.js} +16 -16
  41. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-yesp6BoT.js +1118 -0
  42. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-BnKybdKJ.js +142 -0
  43. package/dist/{Tier-BAZ1xuKL.js → Tier-DgKMMyKr.js} +469 -544
  44. package/dist/{Title-CcNAt47f.js → Title-BKijiEFV.js} +92 -93
  45. package/dist/{Transaction-D7DO3dKQ.js → Transaction-zHL4q_wj.js} +2 -2
  46. package/dist/{UserRuleGroup.vue_vue_type_script_setup_true_lang-hUjQVZ_U.js → UserRuleGroup.vue_vue_type_script_setup_true_lang-DjafpVOa.js} +6 -6
  47. package/dist/{Voucher-Cq-n1CaC.js → Voucher-DW4-SD1w.js} +27 -28
  48. package/dist/{VoucherEditor.vue_vue_type_script_setup_true_lang-CTQDxc5l.js → VoucherEditor.vue_vue_type_script_setup_true_lang-y2wm2Bcu.js} +12 -12
  49. package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-DuRKA4cj.js → ZodTextField.vue_vue_type_script_setup_true_lang-BWZUE554.js} +2 -2
  50. package/dist/{app-Z-UKRG5V.js → app-B23RANXL.js} +3083 -3663
  51. package/dist/app.js +3 -4
  52. package/dist/{business-C7EF6cKC.js → business-BFU-2tpT.js} +1 -1
  53. package/dist/{campaign-DHBuP4UA.js → campaign-BEKKOWya.js} +64 -114
  54. package/dist/{campaign--MjoY1Mn.js → campaign-CwlWx58O.js} +7 -13
  55. package/dist/{campaign.enum-BNN2gLFY.js → campaign.enum-5KIiekYl.js} +2 -3
  56. package/dist/{campaign.fn-Bd34dVnx.js → campaign.fn-CyWn_KL-.js} +130 -130
  57. package/dist/{collectible.enum-DO9HdJGH.js → collectible.enum-DmmR-4Nj.js} +1 -1
  58. package/dist/collection.fn-BB1OjBHL.js +26 -0
  59. package/dist/dto-p31OYANk.js +216 -0
  60. package/dist/{effect-BcB8IlTI.js → effect-DNDXE2iM.js} +1 -1
  61. package/dist/{email-addresses-BcTeU4Sh.js → email-addresses-DXSkxrZ6.js} +2 -2
  62. package/dist/{export-CjB7qxZ9.js → export-zMj-UAnF.js} +3 -3
  63. package/dist/{helper-BSgrCJRv.js → helper-D32ml7Qv.js} +1 -1
  64. package/dist/{index-HXiYGO4_.js → index-9jgqbdnt.js} +7 -7
  65. package/dist/{index-hlyg-wxV.js → index-B2OiTtF5.js} +1 -1
  66. package/dist/{index-CoHWpylO.js → index-B9-jeiQR.js} +1281 -1518
  67. package/dist/{index-iMPtFp54.js → index-BWHk6oqv.js} +3 -3
  68. package/dist/{index-hbyCVNa7.js → index-BmmFSQPd.js} +3 -3
  69. package/dist/{index-CsoBDon4.js → index-CA09A75h.js} +1968 -1996
  70. package/dist/index-Cc15IFUt.js +55 -0
  71. package/dist/{index-BpI-BI4H.js → index-CcnOzrwY.js} +1 -1
  72. package/dist/{index-VlFWaBrg.js → index-DSGHkaP0.js} +1 -1
  73. package/dist/{index-BoYEqLif.js → index-DvHLsdIR.js} +205 -817
  74. package/dist/{index-Bf6jNZit.js → index-PrTZHXNT.js} +1 -1
  75. package/dist/{index-BIAjmMga.js → index-txVWLdtz.js} +1 -1
  76. package/dist/{index.esm2017-CM7OnEyP.js → index.esm2017-BJG8dqci.js} +209 -209
  77. package/dist/{loading-CSXr0Yqz.js → loading-DuZVM_Ow.js} +1 -1
  78. package/dist/{lodash-Bh7XKI-R.js → lodash-DqQem5rZ.js} +1 -1
  79. package/dist/{membership-CfredTm3.js → membership-CvoEzwor.js} +3 -3
  80. package/dist/{money-BZIST_m9.js → money-B9PJ_JYh.js} +1 -1
  81. package/dist/{number-DXLR2w95.js → number-GIC15kny.js} +1 -1
  82. package/dist/object-qECH92oz.js +26 -0
  83. package/dist/objectid-CtJ4pTf2.js +145 -0
  84. package/dist/{plugins-4FlbwoES.js → plugins-XAhAFHmZ.js} +95 -94
  85. package/dist/{reward-DUbl79bZ.js → reward-Dy0Z6PLL.js} +1 -1
  86. package/dist/{rule-BQUoZ4l_.js → rule-CUu9I1Ly.js} +487 -505
  87. package/dist/rule-builder-DPmaehAO.js +102 -0
  88. package/dist/style.css +1 -1
  89. package/dist/template-BHtdbnoX.js +236 -0
  90. package/dist/{index-CIBPhxlC.js → timezone-BE1YhvLN.js} +20 -21
  91. package/dist/{trigger-D5g5m6tT.js → trigger-BcHfjuiZ.js} +5 -5
  92. package/dist/{useMarketingMaterialActions-B-Jlw2Z9.js → useMarketingMaterialActions-YQq4LWOp.js} +3 -3
  93. package/dist/{usePagination-DHePBBoR.js → usePagination-B1KK2gTx.js} +1 -1
  94. package/dist/{user-C_ToSo-g.js → user-BTRRi1B3.js} +1 -1
  95. package/dist/{vue-i18n-BcYh6_51.js → vue-i18n-D8NX5Rry.js} +298 -298
  96. package/dist/{xlsx-h4G1C-xj.js → xlsx-C9LzK7Kg.js} +1 -1
  97. package/dist/{zod-CgigfJar.js → zod-D3ciRzE4.js} +1 -1
  98. package/package.json +4 -8
  99. package/dist/AuditLogs-BcfgiYnJ.js +0 -2013
  100. package/dist/DateRangeChip.vue_vue_type_script_setup_true_lang-eIoPtgO5.js +0 -58
  101. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-CYQMXARx.js +0 -3377
  102. package/dist/Grab-DmmwrGzk.js +0 -300
  103. package/dist/LocationPicker.vue_vue_type_script_setup_true_lang-B9sJ-M20.js +0 -48
  104. package/dist/LoyaltyDashboard-CJdhYiea.js +0 -1082
  105. package/dist/Review-CYNPPxYU.js +0 -1141
  106. package/dist/ReviewFacebookCallback-0SUkKAaC.js +0 -243
  107. package/dist/ReviewGoogleCallback-BZEzx68n.js +0 -208
  108. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-CtB9Ls5-.js +0 -1911
  109. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-CGz6CTWA.js +0 -1130
  110. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-C7lVeybl.js +0 -7007
  111. package/dist/duplicateCampaign-2ODeDw3a.js +0 -51
  112. package/dist/index-Bm0QPucw.js +0 -67
  113. package/dist/index-Bv4MBLQ5.js +0 -52
  114. package/dist/object-BYyQ0PZp.js +0 -18
  115. package/dist/objectid-Dg4ZodlT.js +0 -145
  116. package/dist/template-BoiSG7G7.js +0 -188
@@ -1,1130 +0,0 @@
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 { s as Z } from "./index-CoHWpylO.js";
4
- import "./index-hbyCVNa7.js";
5
- import { s as Ie } from "./index-BpI-BI4H.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-DXLR2w95.js";
11
- import { u as me } from "./business-C7EF6cKC.js";
12
- import { _ as de, u as Fe } from "./usePagination-DHePBBoR.js";
13
- import { c as ae, p as De } from "./plugins-4FlbwoES.js";
14
- import { g as pe } from "./user-C_ToSo-g.js";
15
- import { B as fe, e as Ee } from "./export-CjB7qxZ9.js";
16
- import { u as ge } from "./campaign--MjoY1Mn.js";
17
- import "./index-hlyg-wxV.js";
18
- import "./index-BoYEqLif.js";
19
- import "./index-CsoBDon4.js";
20
- import "./index-iMPtFp54.js";
21
- import { u as ye } from "./vue-i18n-BcYh6_51.js";
22
- import { o as U } from "./objectId-dwaoBfJX.js";
23
- import { u as he } from "./loading-CSXr0Yqz.js";
24
- import { w as Ae } from "./xlsx-h4G1C-xj.js";
25
- import { useRouter as Ne } from "vue-router";
26
- import { t as L } from "./index-Bm0QPucw.js";
27
- import { R as W } from "./app-Z-UKRG5V.js";
28
- import { F as Q } from "./collectible.enum-DO9HdJGH.js";
29
- import { useCoreStore as Pe } from "@feedmepos/mf-common";
30
- import { c as Me } from "./string-Gcy5IM_H.js";
31
- import { m as Oe } from "./index-Bf6jNZit.js";
32
- function ke(c) {
33
- let p = "";
34
- switch (c) {
35
- case "PORTAL":
36
- p = "ADMIN";
37
- break;
38
- case "BENEFIT":
39
- p = "MEMBERSHIP";
40
- break;
41
- case "ORDER":
42
- p = "ORDER";
43
- break;
44
- case "BILL":
45
- p = "SPENDING";
46
- break;
47
- case "CASHBACK":
48
- p = "CASHBACK";
49
- break;
50
- case "CYCLE":
51
- p = "EXPIRED";
52
- break;
53
- case "COUNTER_CONSUME":
54
- p = "COUNTER REDEEM";
55
- break;
56
- default:
57
- p = c;
58
- break;
59
- }
60
- return p;
61
- }
62
- function Ve(c) {
63
- var p, u, m, x, h, T;
64
- switch ((p = c == null ? void 0 : c.pf_collectible) == null ? void 0 : p.type) {
65
- case "VOUCHER":
66
- return `${(u = c.pf_collectible) == null ? void 0 : u.type} (${(m = c.pf_collectible) == null ? void 0 : m.name})`;
67
- case "TITLE":
68
- return `${(x = c.pf_collectible) == null ? void 0 : x.type} (${(h = c.pf_collectible) == null ? void 0 : h.name})`;
69
- case "POINT":
70
- return "Experience";
71
- case "COIN":
72
- return "Point";
73
- default:
74
- return Ie((T = c == null ? void 0 : c.pf_collectible) == null ? void 0 : T.type);
75
- }
76
- }
77
- function ze(c) {
78
- switch (c) {
79
- case "ONLINE":
80
- return "Online";
81
- case "COIN":
82
- return "Point";
83
- default:
84
- return c;
85
- }
86
- }
87
- const z = {
88
- getReason: ke,
89
- formattedType: Ve,
90
- formattedPaymentType: ze
91
- }, Be = (c) => {
92
- if (c.startsWith("_") || c.includes("."))
93
- return c;
94
- for (const p of ["pf_user_", "pf_collectible_"])
95
- if (c.startsWith(p))
96
- return `${p.slice(0, -1)}.${c.slice(p.length).replace(new RegExp("_", "g"), ".")}`;
97
- return c.replace(new RegExp("_", "g"), ".");
98
- };
99
- function Ue(c, p = { key: "_id", descending: !0 }) {
100
- const u = P({
101
- pageCount: 1,
102
- searchValue: "",
103
- pageIndex: 0,
104
- totalRows: 0,
105
- isLoading: !1,
106
- pageSize: 10,
107
- hasNext: !1
108
- }), m = P(p), x = P([]), h = P([void 0]);
109
- function T() {
110
- h.value = [void 0], u.value.pageIndex = 0, u.value.pageCount = 1, u.value.hasNext = !1;
111
- }
112
- const M = async (n = {}) => {
113
- const o = n.pageSize ?? u.value.pageSize, b = o !== u.value.pageSize;
114
- b && T();
115
- 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];
116
- u.value.isLoading = !0, u.value.pageSize = o, x.value = [];
117
- try {
118
- const A = await c({
119
- limit: o,
120
- sortBy: m.value.key,
121
- descending: m.value.descending,
122
- search: u.value.searchValue,
123
- ...K ? { cursor: K } : {}
124
- });
125
- 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);
126
- } catch (A) {
127
- console.error("Error fetching data:", A), u.value.hasNext = !1;
128
- } finally {
129
- u.value.isLoading = !1;
130
- }
131
- };
132
- let F, g;
133
- const f = (n) => (F && clearTimeout(F), g && g(), new Promise((o) => {
134
- g = o, F = setTimeout(async () => {
135
- F = void 0, g = void 0, await M(n), o();
136
- }, 200);
137
- }));
138
- return {
139
- tableMeta: u,
140
- rowData: x,
141
- sortBy: m,
142
- pageCursors: h,
143
- resetCursorState: T,
144
- fetchData: M,
145
- debouncedFetchData: f,
146
- onSort: async (n) => {
147
- n.length ? m.value = {
148
- key: Be(n[0].id),
149
- descending: n[0].desc
150
- } : m.value = p, T(), await f({
151
- pageIndex: 0,
152
- pageSize: u.value.pageSize
153
- });
154
- },
155
- onSearch: () => (T(), f({
156
- pageIndex: 0,
157
- pageSize: u.value.pageSize
158
- }))
159
- };
160
- }
161
- class Ye extends fe {
162
- }
163
- 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({
164
- __name: "TransactionDetailSheet",
165
- setup(c, { expose: p }) {
166
- ye();
167
- const u = P(!1), m = P(), x = ge(), h = me();
168
- function T(f, a) {
169
- u.value = f, m.value = a ?? null;
170
- }
171
- const M = j(() => {
172
- var f, a;
173
- return ee(
174
- ((a = m.value) == null ? void 0 : a.expiryAmount.reduce(
175
- (e, n) => e + n.amount,
176
- ((f = m.value) == null ? void 0 : f.amount) ?? 0
177
- )) ?? 0,
178
- 2
179
- );
180
- }), F = j(() => {
181
- var f, a, e, n, o;
182
- return m.value ? [
183
- {
184
- label: "Transaction ID",
185
- value: (f = m.value) == null ? void 0 : f._id
186
- },
187
- {
188
- label: "Date/Time",
189
- value: C(U(m.value._id.toString())).format(
190
- "D MMM YYYY, hh:mmA"
191
- )
192
- },
193
- {
194
- label: "Amount",
195
- component: () => s(
196
- "span",
197
- {
198
- class: [
199
- "pr-2",
200
- +M.value > 0 ? "text-fm-color-system-success-300" : "text-fm-color-system-error-300"
201
- ]
202
- },
203
- M.value
204
- )
205
- },
206
- {
207
- label: "Type",
208
- value: z.formattedType(m.value)
209
- },
210
- {
211
- label: "Source",
212
- value: q(z.getReason(m.value.source))
213
- },
214
- {
215
- label: "User",
216
- value: (e = (a = m.value) == null ? void 0 : a.pf_user) == null ? void 0 : e.name
217
- },
218
- {
219
- label: "Phone Number",
220
- value: (o = (n = m.value) == null ? void 0 : n.pf_user) == null ? void 0 : o.phoneNumber
221
- }
222
- ] : [];
223
- }), g = j(() => {
224
- var n, o, b, y;
225
- if (!m.value) return [];
226
- const f = [], a = (n = m.value) == null ? void 0 : n.metadata, e = m.value;
227
- if (a != null && a.campaign) {
228
- const w = x.campaigns.all.find(
229
- (R) => R._id === (a == null ? void 0 : a.campaign)
230
- );
231
- if (!w) return;
232
- f.push({
233
- label: "Campaign",
234
- value: w.name
235
- });
236
- }
237
- return a != null && a.remark && f.push({
238
- label: "Remark",
239
- value: a.remark
240
- }), (o = m.value) != null && o.ref.startsWith("bill_") && f.push({
241
- label: "Bill Number",
242
- value: (b = m.value) == null ? void 0 : b.ref,
243
- copy: () => {
244
- var w;
245
- return ae((w = m.value) == null ? void 0 : w.ref);
246
- }
247
- }), a != null && a.location && f.push({
248
- label: "Location",
249
- value: (y = h.locations.find(
250
- (w) => w._id.toString() === (a == null ? void 0 : a.location)
251
- )) == null ? void 0 : y.name
252
- }), e.source === Z.enum.STORE && f.push({
253
- label: "Store Transaction",
254
- value: e.ref
255
- }), a != null && a.originTransaction && f.push({
256
- label: "Parent Transaction",
257
- value: a.originTransaction
258
- }), a != null && a.referral_count && f.push({
259
- label: "Referral Count",
260
- value: a.referral_count
261
- }), e.refundedFrom && f.push({
262
- label: "Refunded From",
263
- value: e.refundedFrom
264
- }), f;
265
- });
266
- return p({
267
- showSheet: T
268
- }), (f, a) => {
269
- const e = Y("FmButton"), n = Y("FmSideSheet");
270
- return V(), se(n, {
271
- "max-width": 560,
272
- modelValue: l(u),
273
- "onUpdate:modelValue": a[1] || (a[1] = (o) => Se(u) ? u.value = o : null),
274
- header: "Transaction Details"
275
- }, {
276
- "side-sheet-footer": le(() => [
277
- _("div", je, [
278
- I(e, {
279
- label: "Close",
280
- onClick: a[0] || (a[0] = (o) => T(!1)),
281
- variant: "tertiary"
282
- })
283
- ])
284
- ]),
285
- default: le(() => [
286
- _("div", $e, [
287
- _("div", Le, [
288
- (V(!0), B(J, null, ie(l(F), (o) => (V(), B("div", {
289
- key: o.label,
290
- class: "flex flex-col gap-4"
291
- }, [
292
- _("div", Ke, G(o.label), 1),
293
- _("div", {
294
- class: "text-fm-color-typo-secondary fm-typo-en-body-md-400 hover:underline",
295
- onClick: o.copy
296
- }, [
297
- _e(G(o.accessorFn ? o.accessorFn() : o.value) + " ", 1),
298
- (V(), se(we(o.component)))
299
- ], 8, He),
300
- a[2] || (a[2] = _("hr", { class: "mt-3" }, null, -1))
301
- ]))), 128)),
302
- (V(!0), B(J, null, ie(l(g), (o) => (V(), B("div", {
303
- key: o.label,
304
- class: "flex flex-col gap-4"
305
- }, [
306
- _("div", Ge, G(o.label), 1),
307
- _("div", {
308
- class: "text-fm-color-typo-secondary fm-typo-en-body-md-400 hover:underline",
309
- onClick: o.copy
310
- }, G(o.accessorFn ? o.accessorFn() : o.value), 9, We),
311
- a[3] || (a[3] = _("hr", { class: "mt-3" }, null, -1))
312
- ]))), 128))
313
- ])
314
- ])
315
- ]),
316
- _: 1
317
- }, 8, ["modelValue"]);
318
- };
319
- }
320
- }), 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" }, Ot = /* @__PURE__ */ te({
321
- __name: "CollectionTransactions",
322
- props: {
323
- user: {
324
- type: String
325
- }
326
- },
327
- setup(c) {
328
- const { t: p } = ye(), u = me(), m = ge(), x = Ne(), h = c, T = P(!1), { minor: M } = he, F = [
329
- {
330
- header: "Transaction ID",
331
- accessorKey: "_id",
332
- meta: {
333
- maxWidth: "100px"
334
- },
335
- cell(t) {
336
- return s("div", { class: "flex items-center" }, [
337
- s(v.FmIcon, {
338
- name: "content_copy",
339
- outline: !0,
340
- size: "sm",
341
- class: "cursor-pointer mr-4",
342
- onClick: (r) => {
343
- r.preventDefault(), r.stopPropagation(), ae(t.row.original._id.toString());
344
- }
345
- }),
346
- s(
347
- "div",
348
- { class: "pr-2 text-ellipsis overflow-hidden" },
349
- t.row.original._id.toString()
350
- )
351
- ]);
352
- },
353
- enableSorting: !1
354
- },
355
- {
356
- header: "Created at",
357
- accessorKey: "_id",
358
- accessorFn: (t) => C(U(t._id.toString())),
359
- cell: (t) => C(U(t.row.original._id.toString())).format(
360
- "D MMM YYYY, hh:mmA"
361
- ),
362
- enableSorting: !0
363
- },
364
- {
365
- header: "Amount",
366
- // accessorKey: 'totalAmount',
367
- enableSorting: !1,
368
- cell(t) {
369
- var d, i, D, N;
370
- const r = ee(
371
- t.row.original.expiryAmount.reduce(
372
- ($, O) => $ + O.amount,
373
- t.row.original.amount ?? 0
374
- ),
375
- 2
376
- ), 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(
377
- "D MMM YYYY"
378
- ) : "";
379
- return s("div", { class: "flex items-center" }, [
380
- s(
381
- "div",
382
- {
383
- class: [
384
- "pr-2",
385
- +r > 0 ? "text-fm-color-system-success-300" : "text-fm-color-system-error-300"
386
- ]
387
- },
388
- r
389
- ),
390
- s("div", { class: "flex items-center" }, [
391
- t.row.original.expiryAmount.length > 0 ? s(
392
- v.FmTooltip,
393
- {
394
- content: `Expired on ${S}`
395
- },
396
- [
397
- s(v.FmIcon, {
398
- name: "info",
399
- outline: !0,
400
- size: "sm"
401
- })
402
- ]
403
- ) : s("div")
404
- ])
405
- ]);
406
- }
407
- },
408
- {
409
- header: "Type",
410
- accessorKey: "pf_collectible.type",
411
- accessorFn: (t) => z.formattedType(t),
412
- meta: {
413
- maxWidth: "200px"
414
- },
415
- cell(t) {
416
- const r = z.formattedType(t.row.original);
417
- return s("div", { class: "flex items-center" }, [
418
- s("div", { class: "truncate text-ellipsis" }, r),
419
- r.length > 20 ? s(
420
- v.FmTooltip,
421
- {
422
- content: r
423
- },
424
- [
425
- s(v.FmIcon, {
426
- name: "info",
427
- color: "primary",
428
- outline: !0,
429
- size: "sm"
430
- })
431
- ]
432
- ) : null
433
- ]);
434
- }
435
- },
436
- {
437
- header: "Source",
438
- accessorKey: "source",
439
- cell(t) {
440
- var r;
441
- return s("div", { class: "flex items-center gap-4" }, [
442
- s(
443
- "div",
444
- { class: "truncate text-ellipsis" },
445
- q(z.getReason(t.row.original.source))
446
- ),
447
- ...(r = t.row.original.metadata) != null && r.campaign ? [
448
- s(
449
- v.FmTooltip,
450
- {
451
- get content() {
452
- var S;
453
- return (S = m.campaigns.all.find(
454
- (d) => {
455
- var i;
456
- return d._id === ((i = t.row.original.metadata) == null ? void 0 : i.campaign);
457
- }
458
- )) == null ? void 0 : S.name;
459
- }
460
- },
461
- [
462
- s(v.FmIcon, {
463
- name: "info",
464
- color: "primary",
465
- size: "sm",
466
- onClick: async (S) => {
467
- S.preventDefault(), S.stopPropagation();
468
- const d = m.campaigns.all.find(
469
- (i) => {
470
- var D;
471
- return i._id === ((D = t.row.original.metadata) == null ? void 0 : D.campaign);
472
- }
473
- );
474
- if (d)
475
- switch (d.type) {
476
- case "VOUCHER":
477
- case "PROMOTION":
478
- case "BROADCAST":
479
- await x.push({
480
- name: W[`$connect-CAMPAIGN_${d.type}`]
481
- });
482
- break;
483
- case "GAME":
484
- case "CREDIT":
485
- case "MISSION":
486
- await x.push({
487
- name: W[`$connect-PROGRAM_${d.type}`]
488
- });
489
- break;
490
- case "POINT":
491
- await x.push({
492
- name: W["$connect-PROGRAM_EXPERIENCE"]
493
- });
494
- break;
495
- case "COIN":
496
- await x.push({
497
- name: W["$connect-PROGRAM_POINT"]
498
- });
499
- break;
500
- }
501
- }
502
- })
503
- ]
504
- )
505
- ] : []
506
- ]);
507
- }
508
- },
509
- {
510
- header: "User",
511
- accessorKey: "pf_user.name",
512
- cell(t) {
513
- return pe(t.row.original.pf_user);
514
- }
515
- },
516
- {
517
- header: "Phone No.",
518
- accessorKey: "pf_user.phoneNumber",
519
- accessorFn: (t) => {
520
- var r;
521
- return ((r = t == null ? void 0 : t.pf_user) == null ? void 0 : r.phoneNumber) || "";
522
- }
523
- },
524
- {
525
- header: "Status",
526
- id: "status",
527
- enableSorting: !1,
528
- cell(t) {
529
- const r = !!t.row.original.refunded;
530
- return s(v.FmChip, {
531
- label: p(r ? "connect.transaction.refunded" : "connect.transaction.completed"),
532
- variant: "plain",
533
- class: r ? "text-fm-color-typo-warning bg-fm-color-system-warning-100" : "text-fm-color-typo-success bg-fm-color-system-success-100"
534
- });
535
- }
536
- },
537
- {
538
- accessorFn: (t) => t.ref,
539
- header: "References",
540
- accessorKey: "ref",
541
- cell(t) {
542
- var r, S;
543
- return s("div", { class: "flex items-center justify-between gap-4" }, [
544
- s("div", { class: "flex items-center" }, [
545
- (r = t.row.original.metadata) != null && r.remark ? s(
546
- v.FmTooltip,
547
- {
548
- content: (S = t.row.original.metadata) == null ? void 0 : S.remark
549
- },
550
- [
551
- s(v.FmIcon, {
552
- name: "info",
553
- class: "pl-2",
554
- outline: !0,
555
- size: "sm"
556
- })
557
- ]
558
- ) : s("div")
559
- ]),
560
- s("div", { class: "flex-1" }, t.row.original.ref)
561
- ]);
562
- }
563
- },
564
- {
565
- header: "Actions",
566
- cell(t) {
567
- const r = t.row.original;
568
- return s(
569
- v.FmTooltip,
570
- {
571
- get content() {
572
- return "Revert Transaction";
573
- }
574
- },
575
- [
576
- s(v.FmButton, {
577
- variant: "tertiary",
578
- icon: "amend",
579
- iconColor: "neutral-gray-400",
580
- disabled: !r.isRevertable,
581
- onClick: (S) => {
582
- S.stopPropagation(), K(r);
583
- }
584
- })
585
- ]
586
- );
587
- }
588
- }
589
- ], g = P({
590
- search: "",
591
- "pf_collectible.type": [],
592
- "metadata.location": [],
593
- dateRange: {
594
- startDate: C().subtract(7, "day").toISOString(),
595
- endDate: C().endOf("day").toISOString()
596
- },
597
- source: []
598
- }), f = () => ({
599
- ...g.value,
600
- user: h.user,
601
- dateRange: {
602
- start: new Date(g.value.dateRange.startDate).toISOString(),
603
- end: new Date(g.value.dateRange.endDate).toISOString()
604
- }
605
- }), { tableMeta: a, rowData: e, onSort: n, debouncedFetchData: o, resetCursorState: b } = Ue(async (t) => {
606
- const r = await L.readAllCursor(
607
- t,
608
- f()
609
- );
610
- return {
611
- resources: await Promise.all(
612
- r.resources.map(async (d) => {
613
- let i;
614
- if (d.source !== Z.enum.BILL)
615
- i = !1;
616
- else {
617
- const N = d.refunded || !!d.refundedFrom;
618
- if (d.expiryAmount.reduce(
619
- (O, k) => O + k.amount,
620
- d.amount ?? 0
621
- ) > 0) {
622
- let O = [];
623
- [
624
- Q.enum.STAMP,
625
- Q.enum.POINT
626
- ].includes(d.pf_collectible.type) ? i = !1 : i = !N;
627
- } else
628
- switch (d.pf_collectible.type) {
629
- case Q.enum.VOUCHER:
630
- i = d.expiryAmount.some(
631
- (k) => !k.expiredAt || C(k.expiredAt).isAfter(C())
632
- ) && !N;
633
- break;
634
- default:
635
- i = !N;
636
- break;
637
- }
638
- }
639
- const D = y.value.find((N) => N._id === d.ref);
640
- return {
641
- ...d,
642
- ref: (D == null ? void 0 : D.seqNumber) || d.ref,
643
- isRevertable: i
644
- };
645
- })
646
- ),
647
- meta: r.meta
648
- };
649
- }), y = P([]), w = Z.options.map((t) => ({ label: q(z.getReason(t)), value: t })), R = j(
650
- () => u.locations.map((t) => ({ label: t.name, value: t._id }))
651
- );
652
- ce(
653
- g,
654
- () => {
655
- b(), o({ pageIndex: 0 });
656
- },
657
- { deep: !0 }
658
- );
659
- async function K(t) {
660
- M(
661
- async () => {
662
- await L.revertTransaction({
663
- id: t._id.toString()
664
- }), await o();
665
- },
666
- {
667
- message: "Reverting transaction...",
668
- successMessage: "Transaction reverted successfully"
669
- }
670
- );
671
- }
672
- async function A() {
673
- try {
674
- T.value = !0;
675
- const t = new Ye(), r = f(), S = 1e3;
676
- await M(
677
- async () => {
678
- var D, N, $, O, k, ne, re;
679
- let d, i = !0;
680
- for (; i; ) {
681
- const H = await L.readAllCursor(
682
- {
683
- limit: S,
684
- sortBy: "_id",
685
- descending: !1,
686
- ...d ? { cursor: d } : {}
687
- },
688
- r
689
- );
690
- if (!H.resources.length)
691
- break;
692
- for (const E of H.resources)
693
- t.addRecord({
694
- TransactionID: E._id,
695
- CreatedAt: C(U(E._id.toString())).format(
696
- "D MMM YYYY, hh:mmA"
697
- ),
698
- Amount: ee(
699
- E.expiryAmount.reduce(
700
- (xe, be) => xe + be.amount,
701
- E.amount ?? 0
702
- ),
703
- 2
704
- ),
705
- 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") : "",
706
- Type: z.formattedType(E),
707
- Source: q(z.getReason(E.source)),
708
- User: ((k = E.pf_user) == null ? void 0 : k.name) || "",
709
- "Phone No.": ((ne = E.pf_user) == null ? void 0 : ne.phoneNumber) || "",
710
- References: E.ref,
711
- Remark: ((re = E.metadata) == null ? void 0 : re.remark) || ""
712
- });
713
- d = H.meta.nextCursor ?? void 0, i = H.meta.hasNext && !!d;
714
- }
715
- await Ae(
716
- t.buildExcel(),
717
- `transactions-${(/* @__PURE__ */ new Date()).toISOString()}.xlsx`,
718
- {
719
- bookType: "xlsx",
720
- bookSST: !1,
721
- type: "array"
722
- }
723
- );
724
- },
725
- {
726
- message: "Exporting transactions...",
727
- successMessage: "transactions exported successfully"
728
- }
729
- );
730
- } catch (t) {
731
- console.error(t);
732
- } finally {
733
- T.value = !1;
734
- }
735
- }
736
- const oe = P(null);
737
- function ve(t) {
738
- var r;
739
- console.log(t), (r = oe.value) == null || r.showSheet(!0, t.original);
740
- }
741
- return Ce(async () => {
742
- await u.readLocations(), await m.read(), await o();
743
- }), (t, r) => {
744
- const S = Y("FmSearch"), d = Y("FmButton");
745
- return V(), B(J, null, [
746
- _("div", null, [
747
- _("div", Xe, [
748
- I(S, {
749
- class: "hidden xs:!flex border-b border-fm-color-neutral-gray-100",
750
- modelValue: l(g).search,
751
- "onUpdate:modelValue": r[0] || (r[0] = (i) => l(g).search = i),
752
- placeholder: "Search",
753
- collapsible: ""
754
- }, null, 8, ["modelValue"]),
755
- I(d, {
756
- icon: "ios_share",
757
- variant: "tertiary",
758
- onClick: A
759
- })
760
- ]),
761
- _("div", Qe, [
762
- _("div", Je, [
763
- I(X, {
764
- class: "cursor-pointer text-fm-color-neutral-gray-400",
765
- "right-icon": "keyboard_arrow_down",
766
- modelValue: l(g)["metadata.location"],
767
- "onUpdate:modelValue": r[1] || (r[1] = (i) => l(g)["metadata.location"] = i),
768
- icon: "storefront",
769
- "show-item-label": !0,
770
- items: l(R)
771
- }, null, 8, ["modelValue", "items"]),
772
- I(X, {
773
- class: "cursor-pointer text-fm-color-neutral-gray-400",
774
- "right-icon": "keyboard_arrow_down",
775
- modelValue: l(g)["pf_collectible.type"],
776
- "onUpdate:modelValue": r[2] || (r[2] = (i) => l(g)["pf_collectible.type"] = i),
777
- label: "Type: ",
778
- "show-item-label": !0,
779
- items: [
780
- { label: "Point", value: "COIN" },
781
- { label: "Credit", value: "CREDIT" },
782
- { label: "Voucher", value: "VOUCHER" },
783
- { label: "Experience", value: "POINT" },
784
- { label: "Tier", value: "TIER" },
785
- { label: "Title", value: "TITLE" },
786
- { label: "Game", value: "GAME" },
787
- { label: "Stamp", value: "STAMP" }
788
- ]
789
- }, null, 8, ["modelValue"]),
790
- I(X, {
791
- class: "cursor-pointer text-fm-color-neutral-gray-400",
792
- "right-icon": "keyboard_arrow_down",
793
- modelValue: l(g).source,
794
- "onUpdate:modelValue": r[3] || (r[3] = (i) => l(g).source = i),
795
- label: "Source: ",
796
- "show-item-label": !0,
797
- items: l(w)
798
- }, null, 8, ["modelValue", "items"]),
799
- I(ue, {
800
- "model-value": {
801
- startDate: l(g).dateRange.startDate,
802
- endDate: l(g).dateRange.endDate
803
- },
804
- "onUpdate:modelValue": r[4] || (r[4] = (i) => l(g).dateRange = {
805
- startDate: l(C)(i.startDate).startOf("d").toISOString(),
806
- endDate: l(C)(i.endDate).endOf("d").toISOString()
807
- })
808
- }, null, 8, ["model-value"])
809
- ]),
810
- I(S, {
811
- class: "xs:hidden",
812
- modelValue: l(g).search,
813
- "onUpdate:modelValue": r[5] || (r[5] = (i) => l(g).search = i),
814
- placeholder: "Search",
815
- collapsible: ""
816
- }, null, 8, ["modelValue"]),
817
- _("div", Ze, [
818
- I(d, {
819
- icon: "ios_share",
820
- variant: "tertiary",
821
- onClick: A
822
- })
823
- ])
824
- ]),
825
- I(de, {
826
- loading: l(a).isLoading,
827
- "row-data": l(e),
828
- "row-count": l(a).totalRows,
829
- "column-defs": F.filter(
830
- (i) => !h.user || i.header !== "User" && i.header !== "Phone No."
831
- ),
832
- "page-count": l(a).pageCount,
833
- "page-index": l(a).pageIndex,
834
- "page-size": l(a).pageSize,
835
- "shrink-at": !1,
836
- "pagination-mode": "cursor",
837
- "has-next": l(a).hasNext,
838
- onSortChange: l(n),
839
- onPageChange: r[6] || (r[6] = (i) => l(o)({
840
- pageSize: i.pageSize,
841
- pageIndex: i.pageIndex
842
- })),
843
- onRowClick: ve
844
- }, null, 8, ["loading", "row-data", "row-count", "column-defs", "page-count", "page-index", "page-size", "has-next", "onSortChange"])
845
- ]),
846
- I(qe, {
847
- ref_key: "transactionDetailSheet",
848
- ref: oe
849
- }, null, 512)
850
- ], 64);
851
- };
852
- }
853
- });
854
- class et extends fe {
855
- }
856
- const tt = { class: "flex items-center justify-between" }, at = { class: "flex gap-8 items-center" }, ot = { class: "flex gap-8 items-center xs:hidden" }, kt = /* @__PURE__ */ te({
857
- __name: "StoreTransactions",
858
- props: {
859
- user: {
860
- type: String
861
- }
862
- },
863
- setup(c) {
864
- const p = c, { minor: u } = he;
865
- Re();
866
- const m = [
867
- {
868
- header: "Transaction ID",
869
- meta: {
870
- maxWidth: "150px"
871
- },
872
- cell(e) {
873
- return s("div", { class: "flex items-center" }, [
874
- s(v.FmIcon, {
875
- name: "content_copy",
876
- outline: !0,
877
- size: "sm",
878
- class: "cursor-pointer mr-4 shrink-0",
879
- onClick: (n) => {
880
- n.preventDefault(), n.stopPropagation(), ae(e.row.original._id.toString());
881
- }
882
- }),
883
- s("div", { class: "truncate" }, e.row.original._id.toString())
884
- ]);
885
- }
886
- },
887
- {
888
- header: "Created at",
889
- accessorFn: (e) => C(U(e._id.toString())).format("D MMM YYYY, hh:mmA"),
890
- enableSorting: !0
891
- },
892
- {
893
- header: "Bundle",
894
- accessorFn: (e) => e.bundle.name
895
- },
896
- {
897
- header: "Location",
898
- accessorFn: (e) => e.location ? e.pf_location[0].name : "Online Store"
899
- },
900
- {
901
- header: "Payment Type",
902
- accessorFn: (e) => {
903
- var n;
904
- return ((n = e.paymentType) == null ? void 0 : n.type) ?? "N/A";
905
- },
906
- cell(e) {
907
- var n, o;
908
- return s("div", { class: "flex items-center gap-4" }, [
909
- s("div", { class: "flex items-center" }, [
910
- ((n = e.row.original.paymentType) == null ? void 0 : n.type) == "ONLINE" && e.row.original.paymentType.extra ? s(
911
- v.FmTooltip,
912
- {
913
- content: e.row.original.paymentType.extra
914
- },
915
- [
916
- s(v.FmIcon, {
917
- name: "info",
918
- outline: !0,
919
- size: "sm"
920
- })
921
- ]
922
- ) : s("div")
923
- ]),
924
- s(
925
- "div",
926
- { class: "flex-1" },
927
- ((o = e.row.original.paymentType) == null ? void 0 : o.type) ?? "N/A"
928
- )
929
- ]);
930
- }
931
- },
932
- {
933
- header: "User",
934
- cell: (e) => pe(e.row.original.pf_member)
935
- },
936
- {
937
- header: "Phone No.",
938
- accessorFn: (e) => e.pf_member.phoneNumber
939
- },
940
- {
941
- header: "Status",
942
- // accessorFn: (u) => u.status,
943
- cell(e) {
944
- var b, y, w, R;
945
- const n = e.row.original.status, o = {
946
- COMPLETED: "text-fm-color-typo-success bg-fm-color-system-success-100",
947
- REFUNDED: "text-fm-color-typo-warning bg-fm-color-system-warning-100"
948
- };
949
- return s("div", { class: "flex items-center gap-4" }, [
950
- s(v.FmChip, {
951
- label: Me.title(n),
952
- variant: "plain",
953
- class: o[n] ?? ""
954
- }),
955
- (y = (b = e.row.original) == null ? void 0 : b.refund) != null && y.reason ? s(
956
- v.FmTooltip,
957
- {
958
- content: (R = (w = e.row.original) == null ? void 0 : w.refund) == null ? void 0 : R.reason
959
- },
960
- [
961
- s(v.FmIcon, {
962
- name: "info",
963
- color: "primary",
964
- outline: !0,
965
- size: "sm"
966
- })
967
- ]
968
- ) : null
969
- ]);
970
- }
971
- },
972
- {
973
- header: "Source",
974
- accessorFn: (e) => e.source
975
- },
976
- {
977
- header: "Ref",
978
- accessorFn: (e) => e.ref
979
- },
980
- {
981
- id: "action",
982
- cell(e) {
983
- const n = e.row.original, o = n.status === "COMPLETED" && !n.refund && n.source == "ADMIN";
984
- return o ? s(
985
- v.FmMenu,
986
- {
987
- placement: "bottom-end",
988
- onClick: (b) => {
989
- b.stopPropagation();
990
- }
991
- },
992
- {
993
- "menu-button": () => s(v.FmButton, {
994
- icon: "settings",
995
- variant: "tertiary",
996
- if: o
997
- }),
998
- default: () => [
999
- s(v.FmMenuItem, {
1000
- label: "Refund",
1001
- sublabel: "Refund this transaction",
1002
- onClick: async (b) => {
1003
- b.stopPropagation(), await f(n);
1004
- }
1005
- })
1006
- ]
1007
- }
1008
- ) : s("div");
1009
- }
1010
- }
1011
- ], x = P({
1012
- searchValue: "",
1013
- dateRange: {
1014
- startDate: C().subtract(7, "day").toISOString(),
1015
- endDate: C().toISOString()
1016
- }
1017
- }), { tableMeta: h, rowData: T, onSort: M, debouncedFetchData: F, onSearch: g } = Fe(async (e) => {
1018
- const n = {
1019
- ...x.value.dateRange,
1020
- user: p.user
1021
- };
1022
- return await L.readStoreTransactions(e, n);
1023
- });
1024
- async function f(e) {
1025
- await De.confirm(
1026
- "Are you sure you want to refund this transaction?",
1027
- "Refund Store Transaction",
1028
- "Confirm",
1029
- "Cancel"
1030
- ) && await u(
1031
- async () => {
1032
- var o;
1033
- await Oe.refundStoreTransaction({
1034
- id: e._id,
1035
- reason: `ADMIN:${(o = Pe().sessionUser) == null ? void 0 : o.name}`
1036
- }), await F();
1037
- },
1038
- {
1039
- message: "Refunding transaction...",
1040
- successMessage: "Transaction refunded successfully"
1041
- }
1042
- );
1043
- }
1044
- ce(
1045
- x,
1046
- () => {
1047
- F();
1048
- },
1049
- { deep: !0 }
1050
- ), Te(async () => {
1051
- await F();
1052
- });
1053
- const a = async () => Ee({
1054
- exporter: new et(),
1055
- readFunction: (e) => L.readStoreTransactions(e, {
1056
- ...x.value.dateRange,
1057
- user: p.user
1058
- }),
1059
- transformRecord: (e) => {
1060
- var n, o, b, y, w, R;
1061
- return {
1062
- TransactionId: ((n = e._id) == null ? void 0 : n.toString()) || "",
1063
- CreatedAt: C(U(e._id.toString())).format(
1064
- "DD/MM/YYYY HH:mm:ss"
1065
- ),
1066
- Bundle: e.bundle.name || "",
1067
- Location: e.location ? e.pf_location[0].name : "Online Store",
1068
- PaymentType: ((o = e.paymentType) == null ? void 0 : o.type) || "N/A",
1069
- PaymentExtra: ((b = e.paymentType) == null ? void 0 : b.extra) || "",
1070
- User: ((y = e.pf_member) == null ? void 0 : y.name) || "",
1071
- PhoneNumber: ((w = e.pf_member) == null ? void 0 : w.phoneNumber) || "",
1072
- Status: e.status || "",
1073
- RefundReason: ((R = e == null ? void 0 : e.refund) == null ? void 0 : R.reason) || "",
1074
- Ref: (e == null ? void 0 : e.ref) || ""
1075
- };
1076
- },
1077
- filename: "store-transactions"
1078
- });
1079
- return (e, n) => {
1080
- const o = Y("FmSearch"), b = Y("FmButton");
1081
- return V(), B("div", null, [
1082
- _("div", tt, [
1083
- _("div", at, [
1084
- I(ue, {
1085
- modelValue: l(x).dateRange,
1086
- "onUpdate:modelValue": n[0] || (n[0] = (y) => l(x).dateRange = y)
1087
- }, null, 8, ["modelValue"])
1088
- ]),
1089
- _("div", ot, [
1090
- I(o, {
1091
- modelValue: l(h).searchValue,
1092
- "onUpdate:modelValue": [
1093
- n[1] || (n[1] = (y) => l(h).searchValue = y),
1094
- l(g)
1095
- ],
1096
- placeholder: "Search",
1097
- collapsible: ""
1098
- }, null, 8, ["modelValue", "onUpdate:modelValue"]),
1099
- I(b, {
1100
- icon: "ios_share",
1101
- variant: "tertiary",
1102
- onClick: a
1103
- })
1104
- ])
1105
- ]),
1106
- I(de, {
1107
- loading: l(h).isLoading,
1108
- "row-data": l(T),
1109
- "row-count": l(h).totalRows,
1110
- "column-defs": m.filter(
1111
- (y) => !p.user || y.header !== "User" && y.header !== "Phone No."
1112
- ),
1113
- "page-count": l(h).pageCount,
1114
- "page-index": l(h).pageIndex,
1115
- "page-size": l(h).pageSize,
1116
- "shrink-at": !1,
1117
- onSortChange: l(M),
1118
- onPageChange: n[2] || (n[2] = (y) => l(F)({
1119
- pageSize: y.pageSize,
1120
- pageIndex: y.pageIndex
1121
- }))
1122
- }, null, 8, ["loading", "row-data", "row-count", "column-defs", "page-count", "page-index", "page-size", "onSortChange"])
1123
- ]);
1124
- };
1125
- }
1126
- });
1127
- export {
1128
- Ot as _,
1129
- kt as a
1130
- };