@feedmepos/mf-connect 0.1.98-beta.9 → 0.1.99-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 (121) hide show
  1. package/dist/Analytic-CmlJa1WX.js +426 -0
  2. package/dist/{App-CwMrP0Q-.js → App-D0thRELq.js} +807 -673
  3. package/dist/{Bin-sSw4Gatd.js → Bin-DnkPcZdC.js} +8 -8
  4. package/dist/{Broadcast-DH2Fpb-O.js → Broadcast-o6nSQOsx.js} +17 -18
  5. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-Cd47Mrej.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-BPGzh4u8.js} +6 -5
  6. package/dist/{Card-D4YJZ_I8.js → Card-zjezSaRB.js} +19 -19
  7. package/dist/{Collections--8QcjuAp.js → Collections-48W_jFFS.js} +185 -197
  8. package/dist/{Credit-DgF3qd52.js → Credit-CYaCjNVK.js} +53 -54
  9. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-D3SnYlQ0.js +2223 -0
  10. package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-BgHApZqm.js → EffectSheet.vue_vue_type_style_index_0_lang-CbpKQj-r.js} +6 -6
  11. package/dist/{Experience-DxtkVeS9.js → Experience-HmfLlywu.js} +34 -35
  12. package/dist/{FileSaver.min-BtPuPAIo.js → FileSaver.min-cDraiw9g.js} +1 -1
  13. package/dist/{Game-CbcrkUBh.js → Game-DHLdDQRi.js} +15 -16
  14. package/dist/{ImageInput.vue_vue_type_script_setup_true_lang-CqoO7N7r.js → ImageInput.vue_vue_type_script_setup_true_lang-DZrmFruC.js} +1 -1
  15. package/dist/{Index-BzPX7mr1.js → Index-CMm5L1Ph.js} +10 -10
  16. package/dist/{LocationPicker.vue_vue_type_script_setup_true_lang-mI-5po-a.js → LocationPicker.vue_vue_type_script_setup_true_lang-B6tGeGGC.js} +1 -1
  17. package/dist/{LottieAnimation.vue_vue_type_script_setup_true_lang-DyP3ipwX.js → LottieAnimation.vue_vue_type_script_setup_true_lang-CV4V9qlc.js} +1 -1
  18. package/dist/{MainLayout-gxkaZeZ-.js → MainLayout-iru8naVF.js} +1 -1
  19. package/dist/{Marketing-BlMjT0cP.js → Marketing-AP8z-pA0.js} +4 -4
  20. package/dist/{MarketingMaterialEdit-v0vGn3Lz.js → MarketingMaterialEdit-HYTdiTvs.js} +211 -214
  21. package/dist/{Member-BBUlAPqZ.js → Member-N_ks2GiW.js} +20 -20
  22. package/dist/{MemberList-DZJhULFD.js → MemberList-Cj8EfN0q.js} +51 -50
  23. package/dist/{MemberTransactions-CTBoDEg4.js → MemberTransactions-DUj4Fq6M.js} +1 -1
  24. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-nlYOP9gZ.js → MessageInput.vue_vue_type_script_setup_true_lang-ZD6_8BzX.js} +11 -11
  25. package/dist/{Mission-D_xjOnWO.js → Mission-DfZ0brqC.js} +34 -35
  26. package/dist/{Overview-C5-uSEJH.js → Overview-BnFPQbSg.js} +19 -19
  27. package/dist/Overview-kB_HApIc.js +969 -0
  28. package/dist/{Point-BmVyG_i-.js → Point-PsWJEEsn.js} +29 -30
  29. package/dist/{Promotion-BWmTkHyw.js → Promotion-BsNT1kOG.js} +105 -111
  30. package/dist/{Queue-Do2XlY5H.js → Queue-Cgw3PgEi.js} +43 -43
  31. package/dist/{Record-BIzUOikr.js → Record-DwzoIz3R.js} +10 -10
  32. package/dist/Review-kF2wLu5o.js +46 -0
  33. package/dist/ReviewFacebookCallback-B6RjqR5T.js +238 -0
  34. package/dist/ReviewGoogleCallback-DjLK1b4-.js +213 -0
  35. package/dist/{Reward-gCpIJIq9.js → Reward-C8O5U2NU.js} +17 -17
  36. package/dist/{RewardGroup.vue_vue_type_script_setup_true_lang-Dkyz-W9m.js → RewardGroup.vue_vue_type_script_setup_true_lang-BqKABBF1.js} +12 -12
  37. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-DvNyurCW.js +1888 -0
  38. package/dist/{Segment-CZrzY2st.js → Segment-BtmeNQnL.js} +78 -77
  39. package/dist/{SelectItems.vue_vue_type_script_setup_true_lang-B1qAMtkn.js → SelectItems.vue_vue_type_script_setup_true_lang-P4wy1bqG.js} +3 -3
  40. package/dist/{SendCollectionSheet.vue_vue_type_script_setup_true_lang-Dc36wzB0.js → SendCollectionSheet.vue_vue_type_script_setup_true_lang-DQ93AOeI.js} +12 -12
  41. package/dist/{SendVoucherSheet.vue_vue_type_script_setup_true_lang-BtnF-BPt.js → SendVoucherSheet.vue_vue_type_script_setup_true_lang-B3P7Ob40.js} +4 -4
  42. package/dist/{Setting-JrI4ttI1.js → Setting-D1SQ6TKF.js} +248 -259
  43. package/dist/{SettingAdvertisements-iOOpEUlI.js → SettingAdvertisements-pUTX9uu3.js} +13 -13
  44. package/dist/Settings-Bbd3cMNH.js +228 -0
  45. package/dist/{Store-DbXKThJn.js → Store-Dgc-J8Q7.js} +24 -24
  46. package/dist/{StoreRewards-CfkwVw7d.js → StoreRewards-CJ090vEj.js} +16 -16
  47. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-B35vDFFq.js +1067 -0
  48. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-5Aazsvfa.js +142 -0
  49. package/dist/{Tier-BVrAqpWt.js → Tier-CKGyFDiY.js} +469 -544
  50. package/dist/{Title-DhumBh-S.js → Title-DXRex7t9.js} +92 -93
  51. package/dist/{Transaction-BQLge28p.js → Transaction-B1eC-Gln.js} +2 -2
  52. package/dist/{UserRuleGroup.vue_vue_type_script_setup_true_lang-CSPaj2uN.js → UserRuleGroup.vue_vue_type_script_setup_true_lang-B2GABNUx.js} +6 -6
  53. package/dist/{Voucher-DeB4YhvL.js → Voucher-Omh_kYVH.js} +27 -28
  54. package/dist/{VoucherEditor.vue_vue_type_script_setup_true_lang-BjUFEIlS.js → VoucherEditor.vue_vue_type_script_setup_true_lang-DD2WD_Vt.js} +12 -12
  55. package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-BzrPUcC9.js → ZodTextField.vue_vue_type_script_setup_true_lang-CAtzo8zL.js} +2 -2
  56. package/dist/{app-BHIG18wW.js → app-D8i8XAyR.js} +1439 -1406
  57. package/dist/app.js +3 -4
  58. package/dist/{business-CCmy2VBj.js → business-6gZtKQ8L.js} +1 -1
  59. package/dist/{campaign-DiFdvcPE.js → campaign-DIgbywUy.js} +64 -114
  60. package/dist/{campaign-jofcGLi8.js → campaign-MPUFwgli.js} +7 -13
  61. package/dist/{campaign.enum-CBp5IeWz.js → campaign.enum-CSlbGhc-.js} +2 -3
  62. package/dist/{campaign.fn-BZ0Ivuwi.js → campaign.fn-BvxZt-0r.js} +65 -65
  63. package/dist/{collectible.enum-frp5wluZ.js → collectible.enum-20LKRFir.js} +1 -1
  64. package/dist/collection.fn-03oGQuF_.js +26 -0
  65. package/dist/dto-C5_Te4gk.js +216 -0
  66. package/dist/{effect-BegkMXTr.js → effect-CkurpNMu.js} +1 -1
  67. package/dist/{email-addresses-B0t3BKV6.js → email-addresses-CR8pgurp.js} +2 -2
  68. package/dist/{export-CGrchnsA.js → export-CfDeISbW.js} +3 -3
  69. package/dist/google-BQK68wbe.js +5 -0
  70. package/dist/{helper-CIYSBZvt.js → helper-BQYvN6FL.js} +1 -1
  71. package/dist/{index-Dg_OJTxE.js → index-6FvsyekG.js} +1 -1
  72. package/dist/index-ARC-NYFZ.js +55 -0
  73. package/dist/{index-Cv0pq7A_.js → index-C9j6OhgK.js} +302 -634
  74. package/dist/{index-BPh_k5rA.js → index-CH_QL_76.js} +3 -3
  75. package/dist/{index-DdAl4SK2.js → index-CJUzQG6t.js} +26 -17
  76. package/dist/{index-PmoP3mXP.js → index-Cv-DbZdw.js} +7 -7
  77. package/dist/{index-D4_JDL9j.js → index-D6wOnTAl.js} +3 -3
  78. package/dist/{index-CixwNfnv.js → index-D8vmbFE5.js} +1 -1
  79. package/dist/{index-DcE-11T-.js → index-DW7H-3z4.js} +1275 -1506
  80. package/dist/{index-C_6y8OES.js → index-Dcxjgr6s.js} +1 -1
  81. package/dist/{index-CF1RNy12.js → index-Dz130JVH.js} +1 -1
  82. package/dist/{index-BBgVfqVf.js → index-ERqXuFvQ.js} +1 -1
  83. package/dist/{index-C-2YkeBp.js → index-hTgJrZR8.js} +1968 -1996
  84. package/dist/{index.esm2017-QGfAIiCc.js → index.esm2017-DY9Lrb0O.js} +184 -184
  85. package/dist/{loading-Cql_LElt.js → loading-EnU7K0k3.js} +1 -1
  86. package/dist/{lodash-PMdIVUsY.js → lodash-Cr7KdLib.js} +1 -1
  87. package/dist/{membership-BHD1GQ45.js → membership-B1eIzQDB.js} +3 -3
  88. package/dist/{money-CASVly6f.js → money-DpUzzEJj.js} +1 -1
  89. package/dist/{number-dMI2x0jy.js → number-DAz9zOKI.js} +1 -1
  90. package/dist/object-qECH92oz.js +26 -0
  91. package/dist/objectid-LXOkMCkM.js +145 -0
  92. package/dist/{plugins-CnEVta3V.js → plugins-DJ13vaqz.js} +95 -94
  93. package/dist/{reward-vdrNMYrF.js → reward-Cmx_swM1.js} +1 -1
  94. package/dist/{rule-BLXUDFEw.js → rule-BCzySyr6.js} +487 -505
  95. package/dist/rule-builder-CDkWYBLG.js +102 -0
  96. package/dist/style.css +1 -1
  97. package/dist/template-DfnYZzoa.js +236 -0
  98. package/dist/{index-DzQCyuGA.js → timezone-Beb0XkZC.js} +20 -21
  99. package/dist/{trigger-Ccrh378a.js → trigger-BfQprjI-.js} +5 -5
  100. package/dist/{useMarketingMaterialActions-BQLBRa3G.js → useMarketingMaterialActions-CagN58AP.js} +3 -3
  101. package/dist/{usePagination-BjsffqjT.js → usePagination-XyeJR5ws.js} +1 -1
  102. package/dist/{user-B5jS1GLb.js → user-l2YG1VjD.js} +1 -1
  103. package/dist/{vue-i18n-CCjHlB6z.js → vue-i18n-DJXhpQga.js} +391 -391
  104. package/dist/{xlsx-DmBOvA2N.js → xlsx-DypdT1NW.js} +1 -1
  105. package/dist/{zod-DrYZ6KS4.js → zod-BM5P7Bti.js} +1 -1
  106. package/package.json +4 -8
  107. package/dist/AuditLogs-CAtlilma.js +0 -2013
  108. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-Bpr9KuHW.js +0 -3377
  109. package/dist/Grab-CDhmMNsL.js +0 -300
  110. package/dist/LoyaltyDashboard-BFjI3IWT.js +0 -1082
  111. package/dist/Review-D9cFDrhN.js +0 -1192
  112. package/dist/ReviewFacebookCallback-DbE8_6D3.js +0 -243
  113. package/dist/ReviewGoogleCallback-LMZgyopt.js +0 -208
  114. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-BEqgU70M.js +0 -1911
  115. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-CNC_jNgW.js +0 -1130
  116. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-BBlCR4pN.js +0 -7007
  117. package/dist/duplicateCampaign-CxuNftok.js +0 -51
  118. package/dist/index-Dc-I4Jr-.js +0 -67
  119. package/dist/object-BYyQ0PZp.js +0 -18
  120. package/dist/objectid-Db_4Ays3.js +0 -145
  121. package/dist/template-CRjkIq3e.js +0 -188
@@ -0,0 +1,1067 @@
1
+ import { ref as N, defineComponent as J, computed as H, h as l, resolveComponent as z, openBlock as O, createBlock as oe, unref as s, isRef as xe, withCtx as ne, createElementVNode as _, createVNode as R, createElementBlock as P, Fragment as X, renderList as re, toDisplayString as K, createTextVNode as be, resolveDynamicComponent as Se, watch as se, onBeforeMount as _e, onMounted as we } from "vue";
2
+ import { components as S, useDialog as Ce } from "@feedmepos/ui-library";
3
+ import { s as le } from "./index-DW7H-3z4.js";
4
+ import "./index-CH_QL_76.js";
5
+ import { s as Te } from "./index-D8vmbFE5.js";
6
+ import { h as I } from "./moment-D7p2TMB-.js";
7
+ import { _ as q } from "./FilterChip.vue_vue_type_script_setup_true_lang-DaU-9GzO.js";
8
+ import { _ as ie } from "./DateRangeChip.vue_vue_type_script_setup_true_lang-eIoPtgO5.js";
9
+ import { s as W } from "./index-CuvNtC_M.js";
10
+ import { f as Q } from "./number-DAz9zOKI.js";
11
+ import { u as ce } from "./business-6gZtKQ8L.js";
12
+ import { _ as ue, u as Re } from "./usePagination-XyeJR5ws.js";
13
+ import { c as Z, p as Ie } from "./plugins-DJ13vaqz.js";
14
+ import { g as me } from "./user-l2YG1VjD.js";
15
+ import { B as de, e as De } from "./export-CfDeISbW.js";
16
+ import { u as pe } from "./campaign-MPUFwgli.js";
17
+ import "./index-Dz130JVH.js";
18
+ import "./index-hTgJrZR8.js";
19
+ import "./index-C9j6OhgK.js";
20
+ import "./index-D6wOnTAl.js";
21
+ import { u as fe } from "./vue-i18n-DJXhpQga.js";
22
+ import { o as V } from "./objectId-dwaoBfJX.js";
23
+ import { u as ge } from "./loading-EnU7K0k3.js";
24
+ import { w as Fe } from "./xlsx-DypdT1NW.js";
25
+ import { useRouter as Ee } from "vue-router";
26
+ import { t as j } from "./index-ARC-NYFZ.js";
27
+ import { R as G } from "./app-D8i8XAyR.js";
28
+ import { useCoreStore as Ne } from "@feedmepos/mf-common";
29
+ import { c as Ae } from "./string-Gcy5IM_H.js";
30
+ import { m as Me } from "./index-6FvsyekG.js";
31
+ function Oe(i) {
32
+ let d = "";
33
+ switch (i) {
34
+ case "PORTAL":
35
+ d = "ADMIN";
36
+ break;
37
+ case "BENEFIT":
38
+ d = "MEMBERSHIP";
39
+ break;
40
+ case "ORDER":
41
+ d = "ORDER";
42
+ break;
43
+ case "BILL":
44
+ d = "SPENDING";
45
+ break;
46
+ case "CASHBACK":
47
+ d = "CASHBACK";
48
+ break;
49
+ case "CYCLE":
50
+ d = "EXPIRED";
51
+ break;
52
+ case "COUNTER_CONSUME":
53
+ d = "COUNTER REDEEM";
54
+ break;
55
+ default:
56
+ d = i;
57
+ break;
58
+ }
59
+ return d;
60
+ }
61
+ function ke(i) {
62
+ var d, c, u, v, h, C;
63
+ switch ((d = i == null ? void 0 : i.pf_collectible) == null ? void 0 : d.type) {
64
+ case "VOUCHER":
65
+ return `${(c = i.pf_collectible) == null ? void 0 : c.type} (${(u = i.pf_collectible) == null ? void 0 : u.name})`;
66
+ case "TITLE":
67
+ return `${(v = i.pf_collectible) == null ? void 0 : v.type} (${(h = i.pf_collectible) == null ? void 0 : h.name})`;
68
+ case "POINT":
69
+ return "Experience";
70
+ case "COIN":
71
+ return "Point";
72
+ default:
73
+ return Te((C = i == null ? void 0 : i.pf_collectible) == null ? void 0 : C.type);
74
+ }
75
+ }
76
+ function Pe(i) {
77
+ switch (i) {
78
+ case "ONLINE":
79
+ return "Online";
80
+ case "COIN":
81
+ return "Point";
82
+ default:
83
+ return i;
84
+ }
85
+ }
86
+ const k = {
87
+ getReason: Oe,
88
+ formattedType: ke,
89
+ formattedPaymentType: Pe
90
+ }, Ve = (i) => {
91
+ if (i.startsWith("_") || i.includes("."))
92
+ return i;
93
+ for (const d of ["pf_user_", "pf_collectible_"])
94
+ if (i.startsWith(d))
95
+ return `${d.slice(0, -1)}.${i.slice(d.length).replace(new RegExp("_", "g"), ".")}`;
96
+ return i.replace(new RegExp("_", "g"), ".");
97
+ };
98
+ function ze(i, d = { key: "_id", descending: !0 }) {
99
+ const c = N({
100
+ pageCount: 1,
101
+ searchValue: "",
102
+ pageIndex: 0,
103
+ totalRows: 0,
104
+ isLoading: !1,
105
+ pageSize: 10,
106
+ hasNext: !1
107
+ }), u = N(d), v = N([]), h = N([void 0]);
108
+ function C() {
109
+ h.value = [void 0], c.value.pageIndex = 0, c.value.pageCount = 1, c.value.hasNext = !1;
110
+ }
111
+ const A = async (o = {}) => {
112
+ const n = o.pageSize ?? c.value.pageSize, x = n !== c.value.pageSize;
113
+ x && C();
114
+ const g = x ? 0 : Math.max(o.pageIndex ?? c.value.pageIndex, 0), T = g === 0 || !!h.value[g] ? g : c.value.pageIndex, U = h.value[T];
115
+ c.value.isLoading = !0, c.value.pageSize = n, v.value = [];
116
+ try {
117
+ const E = await i({
118
+ limit: n,
119
+ sortBy: u.value.key,
120
+ descending: u.value.descending,
121
+ search: c.value.searchValue,
122
+ ...U ? { cursor: U } : {}
123
+ });
124
+ v.value = E.resources, c.value.pageIndex = T, c.value.totalRows = E.resources.length, c.value.hasNext = E.meta.hasNext, c.value.pageCount = T + (E.meta.hasNext ? 2 : 1), E.meta.nextCursor ? h.value[T + 1] = E.meta.nextCursor : h.value.splice(T + 1);
125
+ } catch (E) {
126
+ console.error("Error fetching data:", E), c.value.hasNext = !1;
127
+ } finally {
128
+ c.value.isLoading = !1;
129
+ }
130
+ };
131
+ let D, f;
132
+ const p = (o) => (D && clearTimeout(D), f && f(), new Promise((n) => {
133
+ f = n, D = setTimeout(async () => {
134
+ D = void 0, f = void 0, await A(o), n();
135
+ }, 200);
136
+ }));
137
+ return {
138
+ tableMeta: c,
139
+ rowData: v,
140
+ sortBy: u,
141
+ pageCursors: h,
142
+ resetCursorState: C,
143
+ fetchData: A,
144
+ debouncedFetchData: p,
145
+ onSort: async (o) => {
146
+ o.length ? u.value = {
147
+ key: Ve(o[0].id),
148
+ descending: o[0].desc
149
+ } : u.value = d, C(), await p({
150
+ pageIndex: 0,
151
+ pageSize: c.value.pageSize
152
+ });
153
+ },
154
+ onSearch: () => (C(), p({
155
+ pageIndex: 0,
156
+ pageSize: c.value.pageSize
157
+ }))
158
+ };
159
+ }
160
+ class Ue extends de {
161
+ }
162
+ const Ye = { class: "space-y-24 pr-12" }, $e = { class: "w-full space-y-16" }, Be = { class: "fm-typo-en-body-lg-600" }, Le = ["onClick"], Ke = { class: "fm-typo-en-body-lg-600" }, Ge = ["onClick"], He = { class: "flex items-center gap-8" }, We = /* @__PURE__ */ J({
163
+ __name: "TransactionDetailSheet",
164
+ setup(i, { expose: d }) {
165
+ fe();
166
+ const c = N(!1), u = N(), v = pe(), h = ce();
167
+ function C(p, t) {
168
+ c.value = p, u.value = t ?? null;
169
+ }
170
+ const A = H(() => {
171
+ var p, t;
172
+ return Q(
173
+ ((t = u.value) == null ? void 0 : t.expiryAmount.reduce(
174
+ (e, o) => e + o.amount,
175
+ ((p = u.value) == null ? void 0 : p.amount) ?? 0
176
+ )) ?? 0,
177
+ 2
178
+ );
179
+ }), D = H(() => {
180
+ var p, t, e, o, n;
181
+ return u.value ? [
182
+ {
183
+ label: "Transaction ID",
184
+ value: (p = u.value) == null ? void 0 : p._id
185
+ },
186
+ {
187
+ label: "Date/Time",
188
+ value: I(V(u.value._id.toString())).format(
189
+ "D MMM YYYY, hh:mmA"
190
+ )
191
+ },
192
+ {
193
+ label: "Amount",
194
+ component: () => l(
195
+ "span",
196
+ {
197
+ class: [
198
+ "pr-2",
199
+ +A.value > 0 ? "text-fm-color-system-success-300" : "text-fm-color-system-error-300"
200
+ ]
201
+ },
202
+ A.value
203
+ )
204
+ },
205
+ {
206
+ label: "Type",
207
+ value: k.formattedType(u.value)
208
+ },
209
+ {
210
+ label: "Source",
211
+ value: W(k.getReason(u.value.source))
212
+ },
213
+ {
214
+ label: "User",
215
+ value: (e = (t = u.value) == null ? void 0 : t.pf_user) == null ? void 0 : e.name
216
+ },
217
+ {
218
+ label: "Phone Number",
219
+ value: (n = (o = u.value) == null ? void 0 : o.pf_user) == null ? void 0 : n.phoneNumber
220
+ }
221
+ ] : [];
222
+ }), f = H(() => {
223
+ var o, n, x, g;
224
+ if (!u.value) return [];
225
+ const p = [], t = (o = u.value) == null ? void 0 : o.metadata, e = u.value;
226
+ if (t != null && t.campaign) {
227
+ const w = v.campaigns.all.find(
228
+ (T) => T._id === (t == null ? void 0 : t.campaign)
229
+ );
230
+ if (!w) return;
231
+ p.push({
232
+ label: "Campaign",
233
+ value: w.name
234
+ });
235
+ }
236
+ return t != null && t.remark && p.push({
237
+ label: "Remark",
238
+ value: t.remark
239
+ }), (n = u.value) != null && n.ref.startsWith("bill_") && p.push({
240
+ label: "Bill Number",
241
+ value: (x = u.value) == null ? void 0 : x.ref,
242
+ copy: () => {
243
+ var w;
244
+ return Z((w = u.value) == null ? void 0 : w.ref);
245
+ }
246
+ }), t != null && t.location && p.push({
247
+ label: "Location",
248
+ value: (g = h.locations.find(
249
+ (w) => w._id.toString() === (t == null ? void 0 : t.location)
250
+ )) == null ? void 0 : g.name
251
+ }), e.source === le.enum.STORE && p.push({
252
+ label: "Store Transaction",
253
+ value: e.ref
254
+ }), t != null && t.originTransaction && p.push({
255
+ label: "Parent Transaction",
256
+ value: t.originTransaction
257
+ }), t != null && t.referral_count && p.push({
258
+ label: "Referral Count",
259
+ value: t.referral_count
260
+ }), e.refundedFrom && p.push({
261
+ label: "Refunded From",
262
+ value: e.refundedFrom
263
+ }), p;
264
+ });
265
+ return d({
266
+ showSheet: C
267
+ }), (p, t) => {
268
+ const e = z("FmButton"), o = z("FmSideSheet");
269
+ return O(), oe(o, {
270
+ "max-width": 560,
271
+ modelValue: s(c),
272
+ "onUpdate:modelValue": t[1] || (t[1] = (n) => xe(c) ? c.value = n : null),
273
+ header: "Transaction Details"
274
+ }, {
275
+ "side-sheet-footer": ne(() => [
276
+ _("div", He, [
277
+ R(e, {
278
+ label: "Close",
279
+ onClick: t[0] || (t[0] = (n) => C(!1)),
280
+ variant: "tertiary"
281
+ })
282
+ ])
283
+ ]),
284
+ default: ne(() => [
285
+ _("div", Ye, [
286
+ _("div", $e, [
287
+ (O(!0), P(X, null, re(s(D), (n) => (O(), P("div", {
288
+ key: n.label,
289
+ class: "flex flex-col gap-4"
290
+ }, [
291
+ _("div", Be, K(n.label), 1),
292
+ _("div", {
293
+ class: "text-fm-color-typo-secondary fm-typo-en-body-md-400 hover:underline",
294
+ onClick: n.copy
295
+ }, [
296
+ be(K(n.accessorFn ? n.accessorFn() : n.value) + " ", 1),
297
+ (O(), oe(Se(n.component)))
298
+ ], 8, Le),
299
+ t[2] || (t[2] = _("hr", { class: "mt-3" }, null, -1))
300
+ ]))), 128)),
301
+ (O(!0), P(X, null, re(s(f), (n) => (O(), P("div", {
302
+ key: n.label,
303
+ class: "flex flex-col gap-4"
304
+ }, [
305
+ _("div", Ke, K(n.label), 1),
306
+ _("div", {
307
+ class: "text-fm-color-typo-secondary fm-typo-en-body-md-400 hover:underline",
308
+ onClick: n.copy
309
+ }, K(n.accessorFn ? n.accessorFn() : n.value), 9, Ge),
310
+ t[3] || (t[3] = _("hr", { class: "mt-3" }, null, -1))
311
+ ]))), 128))
312
+ ])
313
+ ])
314
+ ]),
315
+ _: 1
316
+ }, 8, ["modelValue"]);
317
+ };
318
+ }
319
+ }), je = { class: "hidden xs:!flex items-center justify-end" }, qe = { class: "flex items-center justify-between" }, Xe = { class: "flex gap-8 items-center w-full overflow-x-scroll" }, Qe = { class: "xs:hidden" }, Aa = /* @__PURE__ */ J({
320
+ __name: "CollectionTransactions",
321
+ props: {
322
+ user: {
323
+ type: String
324
+ }
325
+ },
326
+ setup(i) {
327
+ const { t: d } = fe(), c = ce(), u = pe(), v = Ee(), h = i, C = N(!1), { minor: A } = ge, D = [
328
+ {
329
+ header: "Transaction ID",
330
+ accessorKey: "_id",
331
+ meta: {
332
+ maxWidth: "100px"
333
+ },
334
+ cell(a) {
335
+ return l("div", { class: "flex items-center" }, [
336
+ l(S.FmIcon, {
337
+ name: "content_copy",
338
+ outline: !0,
339
+ size: "sm",
340
+ class: "cursor-pointer mr-4",
341
+ onClick: (r) => {
342
+ r.preventDefault(), r.stopPropagation(), Z(a.row.original._id.toString());
343
+ }
344
+ }),
345
+ l(
346
+ "div",
347
+ { class: "pr-2 text-ellipsis overflow-hidden" },
348
+ a.row.original._id.toString()
349
+ )
350
+ ]);
351
+ },
352
+ enableSorting: !1
353
+ },
354
+ {
355
+ header: "Created at",
356
+ accessorKey: "_id",
357
+ accessorFn: (a) => I(V(a._id.toString())),
358
+ cell: (a) => I(V(a.row.original._id.toString())).format(
359
+ "D MMM YYYY, hh:mmA"
360
+ ),
361
+ enableSorting: !0
362
+ },
363
+ {
364
+ header: "Amount",
365
+ // accessorKey: 'totalAmount',
366
+ enableSorting: !1,
367
+ cell(a) {
368
+ var y, m, M, Y;
369
+ const r = Q(
370
+ a.row.original.expiryAmount.reduce(
371
+ ($, B) => $ + B.amount,
372
+ a.row.original.amount ?? 0
373
+ ),
374
+ 2
375
+ ), b = (m = (y = a.row.original.expiryAmount) == null ? void 0 : y[0]) != null && m.expiredAt ? I((Y = (M = a.row.original.expiryAmount) == null ? void 0 : M[0]) == null ? void 0 : Y.expiredAt).format(
376
+ "D MMM YYYY"
377
+ ) : "";
378
+ return l("div", { class: "flex items-center" }, [
379
+ l(
380
+ "div",
381
+ {
382
+ class: [
383
+ "pr-2",
384
+ +r > 0 ? "text-fm-color-system-success-300" : "text-fm-color-system-error-300"
385
+ ]
386
+ },
387
+ r
388
+ ),
389
+ l("div", { class: "flex items-center" }, [
390
+ a.row.original.expiryAmount.length > 0 ? l(
391
+ S.FmTooltip,
392
+ {
393
+ content: `Expired on ${b}`
394
+ },
395
+ [
396
+ l(S.FmIcon, {
397
+ name: "info",
398
+ outline: !0,
399
+ size: "sm"
400
+ })
401
+ ]
402
+ ) : l("div")
403
+ ])
404
+ ]);
405
+ }
406
+ },
407
+ {
408
+ header: "Type",
409
+ accessorKey: "pf_collectible.type",
410
+ accessorFn: (a) => k.formattedType(a),
411
+ meta: {
412
+ maxWidth: "200px"
413
+ },
414
+ cell(a) {
415
+ const r = k.formattedType(a.row.original);
416
+ return l("div", { class: "flex items-center" }, [
417
+ l("div", { class: "truncate text-ellipsis" }, r),
418
+ r.length > 20 ? l(
419
+ S.FmTooltip,
420
+ {
421
+ content: r
422
+ },
423
+ [
424
+ l(S.FmIcon, {
425
+ name: "info",
426
+ color: "primary",
427
+ outline: !0,
428
+ size: "sm"
429
+ })
430
+ ]
431
+ ) : null
432
+ ]);
433
+ }
434
+ },
435
+ {
436
+ header: "Source",
437
+ accessorKey: "source",
438
+ cell(a) {
439
+ var r;
440
+ return l("div", { class: "flex items-center gap-4" }, [
441
+ l(
442
+ "div",
443
+ { class: "truncate text-ellipsis" },
444
+ W(k.getReason(a.row.original.source))
445
+ ),
446
+ ...(r = a.row.original.metadata) != null && r.campaign ? [
447
+ l(
448
+ S.FmTooltip,
449
+ {
450
+ get content() {
451
+ var b;
452
+ return (b = u.campaigns.all.find(
453
+ (y) => {
454
+ var m;
455
+ return y._id === ((m = a.row.original.metadata) == null ? void 0 : m.campaign);
456
+ }
457
+ )) == null ? void 0 : b.name;
458
+ }
459
+ },
460
+ [
461
+ l(S.FmIcon, {
462
+ name: "info",
463
+ color: "primary",
464
+ size: "sm",
465
+ onClick: async (b) => {
466
+ b.preventDefault(), b.stopPropagation();
467
+ const y = u.campaigns.all.find(
468
+ (m) => {
469
+ var M;
470
+ return m._id === ((M = a.row.original.metadata) == null ? void 0 : M.campaign);
471
+ }
472
+ );
473
+ if (y)
474
+ switch (y.type) {
475
+ case "VOUCHER":
476
+ case "PROMOTION":
477
+ case "BROADCAST":
478
+ await v.push({
479
+ name: G[`$connect-CAMPAIGN_${y.type}`]
480
+ });
481
+ break;
482
+ case "GAME":
483
+ case "CREDIT":
484
+ case "MISSION":
485
+ await v.push({
486
+ name: G[`$connect-PROGRAM_${y.type}`]
487
+ });
488
+ break;
489
+ case "POINT":
490
+ await v.push({
491
+ name: G["$connect-PROGRAM_EXPERIENCE"]
492
+ });
493
+ break;
494
+ case "COIN":
495
+ await v.push({
496
+ name: G["$connect-PROGRAM_POINT"]
497
+ });
498
+ break;
499
+ }
500
+ }
501
+ })
502
+ ]
503
+ )
504
+ ] : []
505
+ ]);
506
+ }
507
+ },
508
+ {
509
+ header: "User",
510
+ accessorKey: "pf_user.name",
511
+ cell(a) {
512
+ return me(a.row.original.pf_user);
513
+ }
514
+ },
515
+ {
516
+ header: "Phone No.",
517
+ accessorKey: "pf_user.phoneNumber",
518
+ accessorFn: (a) => {
519
+ var r;
520
+ return ((r = a == null ? void 0 : a.pf_user) == null ? void 0 : r.phoneNumber) || "";
521
+ }
522
+ },
523
+ {
524
+ header: "Status",
525
+ id: "status",
526
+ enableSorting: !1,
527
+ cell(a) {
528
+ const r = !!a.row.original.refunded;
529
+ return l(S.FmChip, {
530
+ label: d(r ? "connect.transaction.refunded" : "connect.transaction.completed"),
531
+ variant: "plain",
532
+ class: r ? "text-fm-color-typo-warning bg-fm-color-system-warning-100" : "text-fm-color-typo-success bg-fm-color-system-success-100"
533
+ });
534
+ }
535
+ },
536
+ {
537
+ accessorFn: (a) => a.ref,
538
+ header: "References",
539
+ accessorKey: "ref",
540
+ cell(a) {
541
+ var r, b;
542
+ return l("div", { class: "flex items-center justify-between gap-4" }, [
543
+ l("div", { class: "flex items-center" }, [
544
+ (r = a.row.original.metadata) != null && r.remark ? l(
545
+ S.FmTooltip,
546
+ {
547
+ content: (b = a.row.original.metadata) == null ? void 0 : b.remark
548
+ },
549
+ [
550
+ l(S.FmIcon, {
551
+ name: "info",
552
+ class: "pl-2",
553
+ outline: !0,
554
+ size: "sm"
555
+ })
556
+ ]
557
+ ) : l("div")
558
+ ]),
559
+ l("div", { class: "flex-1" }, a.row.original.ref)
560
+ ]);
561
+ }
562
+ }
563
+ ], f = N({
564
+ search: "",
565
+ "pf_collectible.type": [],
566
+ "metadata.location": [],
567
+ dateRange: {
568
+ startDate: I().subtract(7, "day").toISOString(),
569
+ endDate: I().endOf("day").toISOString()
570
+ },
571
+ source: []
572
+ }), p = () => ({
573
+ ...f.value,
574
+ user: h.user,
575
+ dateRange: {
576
+ start: new Date(f.value.dateRange.startDate).toISOString(),
577
+ end: new Date(f.value.dateRange.endDate).toISOString()
578
+ }
579
+ }), {
580
+ tableMeta: t,
581
+ rowData: e,
582
+ onSort: o,
583
+ debouncedFetchData: n,
584
+ resetCursorState: x
585
+ } = ze(async (a) => {
586
+ const r = await j.readAllCursor(
587
+ a,
588
+ p()
589
+ );
590
+ return {
591
+ resources: r.resources.map((b) => {
592
+ const y = g.value.find((m) => m._id === b.ref);
593
+ return { ...b, ref: (y == null ? void 0 : y.seqNumber) || b.ref };
594
+ }),
595
+ meta: r.meta
596
+ };
597
+ }), g = N([]), w = le.options.map((a) => ({ label: W(k.getReason(a)), value: a })), T = H(
598
+ () => c.locations.map((a) => ({ label: a.name, value: a._id }))
599
+ );
600
+ se(
601
+ f,
602
+ () => {
603
+ x(), n({ pageIndex: 0 });
604
+ },
605
+ { deep: !0 }
606
+ );
607
+ async function U() {
608
+ try {
609
+ C.value = !0;
610
+ const a = new Ue(), r = p(), b = 1e3;
611
+ await A(
612
+ async () => {
613
+ var M, Y, $, B, ee, ae, te;
614
+ let y, m = !0;
615
+ for (; m; ) {
616
+ const L = await j.readAllCursor(
617
+ {
618
+ limit: b,
619
+ sortBy: "_id",
620
+ descending: !1,
621
+ ...y ? { cursor: y } : {}
622
+ },
623
+ r
624
+ );
625
+ if (!L.resources.length)
626
+ break;
627
+ for (const F of L.resources)
628
+ a.addRecord({
629
+ TransactionID: F._id,
630
+ CreatedAt: I(V(F._id.toString())).format(
631
+ "D MMM YYYY, hh:mmA"
632
+ ),
633
+ Amount: Q(
634
+ F.expiryAmount.reduce(
635
+ (ye, ve) => ye + ve.amount,
636
+ F.amount ?? 0
637
+ ),
638
+ 2
639
+ ),
640
+ ExpiredAt: (Y = (M = F.expiryAmount) == null ? void 0 : M[0]) != null && Y.expiredAt ? I((B = ($ = F.expiryAmount) == null ? void 0 : $[0]) == null ? void 0 : B.expiredAt).format(
641
+ "D MMM YYYY"
642
+ ) : "",
643
+ Type: k.formattedType(F),
644
+ Source: W(k.getReason(F.source)),
645
+ User: ((ee = F.pf_user) == null ? void 0 : ee.name) || "",
646
+ "Phone No.": ((ae = F.pf_user) == null ? void 0 : ae.phoneNumber) || "",
647
+ References: F.ref,
648
+ Remark: ((te = F.metadata) == null ? void 0 : te.remark) || ""
649
+ });
650
+ y = L.meta.nextCursor ?? void 0, m = L.meta.hasNext && !!y;
651
+ }
652
+ await Fe(
653
+ a.buildExcel(),
654
+ `transactions-${(/* @__PURE__ */ new Date()).toISOString()}.xlsx`,
655
+ {
656
+ bookType: "xlsx",
657
+ bookSST: !1,
658
+ type: "array"
659
+ }
660
+ );
661
+ },
662
+ {
663
+ message: "Exporting transactions...",
664
+ successMessage: "transactions exported successfully"
665
+ }
666
+ );
667
+ } catch (a) {
668
+ console.error(a);
669
+ } finally {
670
+ C.value = !1;
671
+ }
672
+ }
673
+ const E = N(null);
674
+ function he(a) {
675
+ var r;
676
+ console.log(a), (r = E.value) == null || r.showSheet(!0, a.original);
677
+ }
678
+ return _e(async () => {
679
+ await c.readLocations(), await u.read(), await n();
680
+ }), (a, r) => {
681
+ const b = z("FmSearch"), y = z("FmButton");
682
+ return O(), P(X, null, [
683
+ _("div", null, [
684
+ _("div", je, [
685
+ R(b, {
686
+ class: "hidden xs:!flex border-b border-fm-color-neutral-gray-100",
687
+ modelValue: s(f).search,
688
+ "onUpdate:modelValue": r[0] || (r[0] = (m) => s(f).search = m),
689
+ placeholder: "Search",
690
+ collapsible: ""
691
+ }, null, 8, ["modelValue"]),
692
+ R(y, {
693
+ icon: "ios_share",
694
+ variant: "tertiary",
695
+ onClick: U
696
+ })
697
+ ]),
698
+ _("div", qe, [
699
+ _("div", Xe, [
700
+ R(q, {
701
+ class: "cursor-pointer text-fm-color-neutral-gray-400",
702
+ "right-icon": "keyboard_arrow_down",
703
+ modelValue: s(f)["metadata.location"],
704
+ "onUpdate:modelValue": r[1] || (r[1] = (m) => s(f)["metadata.location"] = m),
705
+ icon: "storefront",
706
+ "show-item-label": !0,
707
+ items: s(T)
708
+ }, null, 8, ["modelValue", "items"]),
709
+ R(q, {
710
+ class: "cursor-pointer text-fm-color-neutral-gray-400",
711
+ "right-icon": "keyboard_arrow_down",
712
+ modelValue: s(f)["pf_collectible.type"],
713
+ "onUpdate:modelValue": r[2] || (r[2] = (m) => s(f)["pf_collectible.type"] = m),
714
+ label: "Type: ",
715
+ "show-item-label": !0,
716
+ items: [
717
+ { label: "Point", value: "COIN" },
718
+ { label: "Credit", value: "CREDIT" },
719
+ { label: "Voucher", value: "VOUCHER" },
720
+ { label: "Experience", value: "POINT" },
721
+ { label: "Tier", value: "TIER" },
722
+ { label: "Title", value: "TITLE" },
723
+ { label: "Game", value: "GAME" },
724
+ { label: "Stamp", value: "STAMP" }
725
+ ]
726
+ }, null, 8, ["modelValue"]),
727
+ R(q, {
728
+ class: "cursor-pointer text-fm-color-neutral-gray-400",
729
+ "right-icon": "keyboard_arrow_down",
730
+ modelValue: s(f).source,
731
+ "onUpdate:modelValue": r[3] || (r[3] = (m) => s(f).source = m),
732
+ label: "Source: ",
733
+ "show-item-label": !0,
734
+ items: s(w)
735
+ }, null, 8, ["modelValue", "items"]),
736
+ R(ie, {
737
+ "model-value": {
738
+ startDate: s(f).dateRange.startDate,
739
+ endDate: s(f).dateRange.endDate
740
+ },
741
+ "onUpdate:modelValue": r[4] || (r[4] = (m) => s(f).dateRange = {
742
+ startDate: s(I)(m.startDate).startOf("d").toISOString(),
743
+ endDate: s(I)(m.endDate).endOf("d").toISOString()
744
+ })
745
+ }, null, 8, ["model-value"])
746
+ ]),
747
+ R(b, {
748
+ class: "xs:hidden",
749
+ modelValue: s(f).search,
750
+ "onUpdate:modelValue": r[5] || (r[5] = (m) => s(f).search = m),
751
+ placeholder: "Search",
752
+ collapsible: ""
753
+ }, null, 8, ["modelValue"]),
754
+ _("div", Qe, [
755
+ R(y, {
756
+ icon: "ios_share",
757
+ variant: "tertiary",
758
+ onClick: U
759
+ })
760
+ ])
761
+ ]),
762
+ R(ue, {
763
+ loading: s(t).isLoading,
764
+ "row-data": s(e),
765
+ "row-count": s(t).totalRows,
766
+ "column-defs": D.filter(
767
+ (m) => !h.user || m.header !== "User" && m.header !== "Phone No."
768
+ ),
769
+ "page-count": s(t).pageCount,
770
+ "page-index": s(t).pageIndex,
771
+ "page-size": s(t).pageSize,
772
+ "shrink-at": !1,
773
+ "pagination-mode": "cursor",
774
+ "has-next": s(t).hasNext,
775
+ onSortChange: s(o),
776
+ onPageChange: r[6] || (r[6] = (m) => s(n)({
777
+ pageSize: m.pageSize,
778
+ pageIndex: m.pageIndex
779
+ })),
780
+ onRowClick: he
781
+ }, null, 8, ["loading", "row-data", "row-count", "column-defs", "page-count", "page-index", "page-size", "has-next", "onSortChange"])
782
+ ]),
783
+ R(We, {
784
+ ref_key: "transactionDetailSheet",
785
+ ref: E
786
+ }, null, 512)
787
+ ], 64);
788
+ };
789
+ }
790
+ });
791
+ class Je extends de {
792
+ }
793
+ const Ze = { class: "flex items-center justify-between" }, ea = { class: "flex gap-8 items-center" }, aa = { class: "flex gap-8 items-center xs:hidden" }, Ma = /* @__PURE__ */ J({
794
+ __name: "StoreTransactions",
795
+ props: {
796
+ user: {
797
+ type: String
798
+ }
799
+ },
800
+ setup(i) {
801
+ const d = i, { minor: c } = ge;
802
+ Ce();
803
+ const u = [
804
+ {
805
+ header: "Transaction ID",
806
+ meta: {
807
+ maxWidth: "150px"
808
+ },
809
+ cell(e) {
810
+ return l("div", { class: "flex items-center" }, [
811
+ l(S.FmIcon, {
812
+ name: "content_copy",
813
+ outline: !0,
814
+ size: "sm",
815
+ class: "cursor-pointer mr-4 shrink-0",
816
+ onClick: (o) => {
817
+ o.preventDefault(), o.stopPropagation(), Z(e.row.original._id.toString());
818
+ }
819
+ }),
820
+ l("div", { class: "truncate" }, e.row.original._id.toString())
821
+ ]);
822
+ }
823
+ },
824
+ {
825
+ header: "Created at",
826
+ accessorFn: (e) => I(V(e._id.toString())).format("D MMM YYYY, hh:mmA"),
827
+ enableSorting: !0
828
+ },
829
+ {
830
+ header: "Bundle",
831
+ accessorFn: (e) => e.bundle.name
832
+ },
833
+ {
834
+ header: "Location",
835
+ accessorFn: (e) => e.location ? e.pf_location[0].name : "Online Store"
836
+ },
837
+ {
838
+ header: "Payment Type",
839
+ accessorFn: (e) => {
840
+ var o;
841
+ return ((o = e.paymentType) == null ? void 0 : o.type) ?? "N/A";
842
+ },
843
+ cell(e) {
844
+ var o, n;
845
+ return l("div", { class: "flex items-center gap-4" }, [
846
+ l("div", { class: "flex items-center" }, [
847
+ ((o = e.row.original.paymentType) == null ? void 0 : o.type) == "ONLINE" && e.row.original.paymentType.extra ? l(
848
+ S.FmTooltip,
849
+ {
850
+ content: e.row.original.paymentType.extra
851
+ },
852
+ [
853
+ l(S.FmIcon, {
854
+ name: "info",
855
+ outline: !0,
856
+ size: "sm"
857
+ })
858
+ ]
859
+ ) : l("div")
860
+ ]),
861
+ l(
862
+ "div",
863
+ { class: "flex-1" },
864
+ ((n = e.row.original.paymentType) == null ? void 0 : n.type) ?? "N/A"
865
+ )
866
+ ]);
867
+ }
868
+ },
869
+ {
870
+ header: "User",
871
+ cell: (e) => me(e.row.original.pf_member)
872
+ },
873
+ {
874
+ header: "Phone No.",
875
+ accessorFn: (e) => e.pf_member.phoneNumber
876
+ },
877
+ {
878
+ header: "Status",
879
+ // accessorFn: (u) => u.status,
880
+ cell(e) {
881
+ var x, g, w, T;
882
+ const o = e.row.original.status, n = {
883
+ COMPLETED: "text-fm-color-typo-success bg-fm-color-system-success-100",
884
+ REFUNDED: "text-fm-color-typo-warning bg-fm-color-system-warning-100"
885
+ };
886
+ return l("div", { class: "flex items-center gap-4" }, [
887
+ l(S.FmChip, {
888
+ label: Ae.title(o),
889
+ variant: "plain",
890
+ class: n[o] ?? ""
891
+ }),
892
+ (g = (x = e.row.original) == null ? void 0 : x.refund) != null && g.reason ? l(
893
+ S.FmTooltip,
894
+ {
895
+ content: (T = (w = e.row.original) == null ? void 0 : w.refund) == null ? void 0 : T.reason
896
+ },
897
+ [
898
+ l(S.FmIcon, {
899
+ name: "info",
900
+ color: "primary",
901
+ outline: !0,
902
+ size: "sm"
903
+ })
904
+ ]
905
+ ) : null
906
+ ]);
907
+ }
908
+ },
909
+ {
910
+ header: "Source",
911
+ accessorFn: (e) => e.source
912
+ },
913
+ {
914
+ header: "Ref",
915
+ accessorFn: (e) => e.ref
916
+ },
917
+ {
918
+ id: "action",
919
+ cell(e) {
920
+ const o = e.row.original, n = o.status === "COMPLETED" && !o.refund && o.source == "ADMIN";
921
+ return n ? l(
922
+ S.FmMenu,
923
+ {
924
+ placement: "bottom-end",
925
+ onClick: (x) => {
926
+ x.stopPropagation();
927
+ }
928
+ },
929
+ {
930
+ "menu-button": () => l(S.FmButton, {
931
+ icon: "settings",
932
+ variant: "tertiary",
933
+ if: n
934
+ }),
935
+ default: () => [
936
+ l(S.FmMenuItem, {
937
+ label: "Refund",
938
+ sublabel: "Refund this transaction",
939
+ onClick: async (x) => {
940
+ x.stopPropagation(), await p(o);
941
+ }
942
+ })
943
+ ]
944
+ }
945
+ ) : l("div");
946
+ }
947
+ }
948
+ ], v = N({
949
+ searchValue: "",
950
+ dateRange: {
951
+ startDate: I().subtract(7, "day").toISOString(),
952
+ endDate: I().toISOString()
953
+ }
954
+ }), { tableMeta: h, rowData: C, onSort: A, debouncedFetchData: D, onSearch: f } = Re(async (e) => {
955
+ const o = {
956
+ ...v.value.dateRange,
957
+ user: d.user
958
+ };
959
+ return await j.readStoreTransactions(e, o);
960
+ });
961
+ async function p(e) {
962
+ await Ie.confirm(
963
+ "Are you sure you want to refund this transaction?",
964
+ "Refund Store Transaction",
965
+ "Confirm",
966
+ "Cancel"
967
+ ) && await c(
968
+ async () => {
969
+ var n;
970
+ await Me.refundStoreTransaction({
971
+ id: e._id,
972
+ reason: `ADMIN:${(n = Ne().sessionUser) == null ? void 0 : n.name}`
973
+ }), await D();
974
+ },
975
+ {
976
+ message: "Refunding transaction...",
977
+ successMessage: "Transaction refunded successfully"
978
+ }
979
+ );
980
+ }
981
+ se(
982
+ v,
983
+ () => {
984
+ D();
985
+ },
986
+ { deep: !0 }
987
+ ), we(async () => {
988
+ await D();
989
+ });
990
+ const t = async () => De({
991
+ exporter: new Je(),
992
+ readFunction: (e) => j.readStoreTransactions(e, {
993
+ ...v.value.dateRange,
994
+ user: d.user
995
+ }),
996
+ transformRecord: (e) => {
997
+ var o, n, x, g, w, T;
998
+ return {
999
+ TransactionId: ((o = e._id) == null ? void 0 : o.toString()) || "",
1000
+ CreatedAt: I(V(e._id.toString())).format(
1001
+ "DD/MM/YYYY HH:mm:ss"
1002
+ ),
1003
+ Bundle: e.bundle.name || "",
1004
+ Location: e.location ? e.pf_location[0].name : "Online Store",
1005
+ PaymentType: ((n = e.paymentType) == null ? void 0 : n.type) || "N/A",
1006
+ PaymentExtra: ((x = e.paymentType) == null ? void 0 : x.extra) || "",
1007
+ User: ((g = e.pf_member) == null ? void 0 : g.name) || "",
1008
+ PhoneNumber: ((w = e.pf_member) == null ? void 0 : w.phoneNumber) || "",
1009
+ Status: e.status || "",
1010
+ RefundReason: ((T = e == null ? void 0 : e.refund) == null ? void 0 : T.reason) || "",
1011
+ Ref: (e == null ? void 0 : e.ref) || ""
1012
+ };
1013
+ },
1014
+ filename: "store-transactions"
1015
+ });
1016
+ return (e, o) => {
1017
+ const n = z("FmSearch"), x = z("FmButton");
1018
+ return O(), P("div", null, [
1019
+ _("div", Ze, [
1020
+ _("div", ea, [
1021
+ R(ie, {
1022
+ modelValue: s(v).dateRange,
1023
+ "onUpdate:modelValue": o[0] || (o[0] = (g) => s(v).dateRange = g)
1024
+ }, null, 8, ["modelValue"])
1025
+ ]),
1026
+ _("div", aa, [
1027
+ R(n, {
1028
+ modelValue: s(h).searchValue,
1029
+ "onUpdate:modelValue": [
1030
+ o[1] || (o[1] = (g) => s(h).searchValue = g),
1031
+ s(f)
1032
+ ],
1033
+ placeholder: "Search",
1034
+ collapsible: ""
1035
+ }, null, 8, ["modelValue", "onUpdate:modelValue"]),
1036
+ R(x, {
1037
+ icon: "ios_share",
1038
+ variant: "tertiary",
1039
+ onClick: t
1040
+ })
1041
+ ])
1042
+ ]),
1043
+ R(ue, {
1044
+ loading: s(h).isLoading,
1045
+ "row-data": s(C),
1046
+ "row-count": s(h).totalRows,
1047
+ "column-defs": u.filter(
1048
+ (g) => !d.user || g.header !== "User" && g.header !== "Phone No."
1049
+ ),
1050
+ "page-count": s(h).pageCount,
1051
+ "page-index": s(h).pageIndex,
1052
+ "page-size": s(h).pageSize,
1053
+ "shrink-at": !1,
1054
+ onSortChange: s(A),
1055
+ onPageChange: o[2] || (o[2] = (g) => s(D)({
1056
+ pageSize: g.pageSize,
1057
+ pageIndex: g.pageIndex
1058
+ }))
1059
+ }, null, 8, ["loading", "row-data", "row-count", "column-defs", "page-count", "page-index", "page-size", "onSortChange"])
1060
+ ]);
1061
+ };
1062
+ }
1063
+ });
1064
+ export {
1065
+ Aa as _,
1066
+ Ma as a
1067
+ };