@feedmepos/mf-connect 0.1.98-beta.15 → 0.1.98-beta.16

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 (138) hide show
  1. package/dist/App-DNXDhULP.js +4782 -0
  2. package/dist/AuditLogs-BNS27IJT.js +2013 -0
  3. package/dist/Bin-Dkjyrbz-.js +166 -0
  4. package/dist/Broadcast-B-fpjVzY.js +266 -0
  5. package/dist/CampaignTypeDialog.vue_vue_type_script_setup_true_lang-qBcG-vPM.js +120 -0
  6. package/dist/Card-BvVHO8kN.js +910 -0
  7. package/dist/ChipMenu.vue_vue_type_script_setup_true_lang-BPpZZNkr.js +97 -0
  8. package/dist/Collections-BLxPSOJl.js +540 -0
  9. package/dist/Credit-DU-stilH.js +260 -0
  10. package/dist/CustomSelect.vue_vue_type_script_setup_true_lang-Du7fRSZC.js +128 -0
  11. package/dist/DateRangeChip.vue_vue_type_script_setup_true_lang-eIoPtgO5.js +58 -0
  12. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-Bqnb00zk.js +3377 -0
  13. package/dist/EffectSheet.vue_vue_type_style_index_0_lang-CTSfEq5N.js +351 -0
  14. package/dist/Experience-C3tB8hTp.js +259 -0
  15. package/dist/FileSaver.min-EIworvUf.js +74 -0
  16. package/dist/FilterChip.vue_vue_type_script_setup_true_lang-DaU-9GzO.js +129 -0
  17. package/dist/FmTableSelection.vue_vue_type_script_setup_true_lang-DzcUc0_w.js +52 -0
  18. package/dist/Game-Dq1ms2fA.js +330 -0
  19. package/dist/Grab-DnSO2oLx.js +300 -0
  20. package/dist/ImageInput.vue_vue_type_script_setup_true_lang-n1r2bgOE.js +145 -0
  21. package/dist/Index-BFIHgW9W.js +259 -0
  22. package/dist/JsonViewer-v8_C7l5N.js +87 -0
  23. package/dist/LocationPicker.vue_vue_type_script_setup_true_lang-Do7CJZuh.js +48 -0
  24. package/dist/LottieAnimation.vue_vue_type_script_setup_true_lang-vpJmHgKM.js +18737 -0
  25. package/dist/LoyaltyDashboard-CcBogXzl.js +1082 -0
  26. package/dist/MainLayout-CPNiL_et.js +41 -0
  27. package/dist/Marketing-Bzb1VaVA.js +235 -0
  28. package/dist/MarketingMaterialEdit-8UQNx3mV.js +1035 -0
  29. package/dist/Member-Drb_NVrb.js +280 -0
  30. package/dist/MemberList-wa3JxCVr.js +1601 -0
  31. package/dist/MemberOverview-wL_ailso.js +58 -0
  32. package/dist/MemberTransactions-8qlm-T67.js +45 -0
  33. package/dist/MessageInput.vue_vue_type_script_setup_true_lang-BHicaUXs.js +60802 -0
  34. package/dist/Mission-DmWbQmOv.js +334 -0
  35. package/dist/Overview-COEFtf12.js +1079 -0
  36. package/dist/Overview-D7ki-aBA.js +969 -0
  37. package/dist/Point-B0W-BcPA.js +262 -0
  38. package/dist/Promotion-CY16SjmK.js +397 -0
  39. package/dist/Queue-hMur40Xc.js +260 -0
  40. package/dist/Record-Bj7GQP1r.js +342 -0
  41. package/dist/Review-Z1XD6bJK.js +45 -0
  42. package/dist/ReviewFacebookCallback-DirGtKLX.js +248 -0
  43. package/dist/ReviewGoogleCallback-CVC6741e.js +213 -0
  44. package/dist/Reward-DDB5Usau.js +442 -0
  45. package/dist/RewardGroup.vue_vue_type_script_setup_true_lang-B-OnKAbx.js +149 -0
  46. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-DDHM8NLi.js +1911 -0
  47. package/dist/Segment-Bl0k9fvJ.js +1014 -0
  48. package/dist/SelectItems.vue_vue_type_script_setup_true_lang-C33DPiN6.js +181 -0
  49. package/dist/SendCollectionSheet.vue_vue_type_script_setup_true_lang-YMpQ-IiW.js +188 -0
  50. package/dist/SendVoucherSheet.vue_vue_type_script_setup_true_lang--Rtf3gRa.js +226 -0
  51. package/dist/Setting-CpD98E2N.js +2047 -0
  52. package/dist/SettingAdvertisements-BZFQu_HI.js +264 -0
  53. package/dist/Settings-CRqlKNsc.js +228 -0
  54. package/dist/Store-CDG2_iqc.js +1996 -0
  55. package/dist/StoreRewards-DIU5hPXv.js +540 -0
  56. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-B82RH_ZC.js +1133 -0
  57. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-DKGCmk5y.js +7007 -0
  58. package/dist/Tier-BXgIdYDa.js +969 -0
  59. package/dist/Title-DgHxyV8p.js +566 -0
  60. package/dist/Transaction-iDacnm6Y.js +39 -0
  61. package/dist/UserRuleGroup.vue_vue_type_script_setup_true_lang-RUbR6pdK.js +130 -0
  62. package/dist/Voucher-C-I8JK4F.js +421 -0
  63. package/dist/VoucherEditor.vue_vue_type_script_setup_true_lang-BUpYZxij.js +421 -0
  64. package/dist/ZodTextField.vue_vue_type_script_setup_true_lang-LhG5jJq3.js +56 -0
  65. package/dist/_plugin-vue_export-helper-CHgC5LLL.js +9 -0
  66. package/dist/app-CyNzTZOx.js +59950 -0
  67. package/dist/app-wDQR6dpb.js +39 -0
  68. package/dist/app.js +7 -0
  69. package/dist/business-o_sAO_33.js +82 -0
  70. package/dist/campaign--IUcyI8h.js +219 -0
  71. package/dist/campaign-CpzFl8Vr.js +4 -0
  72. package/dist/campaign-zLKyql03.js +277 -0
  73. package/dist/campaign.enum-CEbNgaGZ.js +26 -0
  74. package/dist/campaign.fn-BVT0m6Uy.js +776 -0
  75. package/dist/collectible.enum-2y8KIQLL.js +19 -0
  76. package/dist/duplicateCampaign-DIzdQf0e.js +51 -0
  77. package/dist/effect-B6gKaH4T.js +89 -0
  78. package/dist/email-addresses-CO9GNnUN.js +705 -0
  79. package/dist/export-DdDpRFVg.js +97 -0
  80. package/dist/feedme.ico +0 -0
  81. package/dist/google-BQK68wbe.js +5 -0
  82. package/dist/helper-DqypCsTm.js +86 -0
  83. package/dist/index-BK0OmX3R.js +85 -0
  84. package/dist/index-Bc7JXl59.js +54 -0
  85. package/dist/index-BgiIGrLb.js +32 -0
  86. package/dist/index-C-TiT9bf.js +1157 -0
  87. package/dist/index-COXmoOd1.js +3678 -0
  88. package/dist/index-CT6uJJ9y.js +151 -0
  89. package/dist/index-Ci2gFCfD.js +61 -0
  90. package/dist/index-CtJ0MQQ1.js +3 -0
  91. package/dist/index-CuvNtC_M.js +61 -0
  92. package/dist/index-D41Xq5qY.js +8910 -0
  93. package/dist/index-DBD_e_yR.js +31 -0
  94. package/dist/index-DDpz9LmI.js +67 -0
  95. package/dist/index-Dh2apeby.js +2819 -0
  96. package/dist/index-DiDmMG_M.js +28900 -0
  97. package/dist/index-pjXQwa0j.js +30289 -0
  98. package/dist/index-vh86FiIQ.js +10 -0
  99. package/dist/index.esm2017-Cd4FhecE.js +3069 -0
  100. package/dist/loading-D-RglDMV.js +72 -0
  101. package/dist/lodash-cggYhL9V.js +3678 -0
  102. package/dist/membership-DTfMyKwP.js +255 -0
  103. package/dist/moment-D7p2TMB-.js +2583 -0
  104. package/dist/money-fGZfbdgV.js +15 -0
  105. package/dist/number-BOalh3ZH.js +12 -0
  106. package/dist/object-BYyQ0PZp.js +18 -0
  107. package/dist/objectId-dwaoBfJX.js +7 -0
  108. package/dist/objectid-zPJFVngY.js +145 -0
  109. package/dist/plugins-CbpvMMOJ.js +1788 -0
  110. package/dist/reward-DkVAHEq2.js +36 -0
  111. package/dist/rule-EzWg2u8d.js +1969 -0
  112. package/dist/string-Gcy5IM_H.js +32 -0
  113. package/dist/style.css +4 -0
  114. package/dist/template-BfVFq4on.js +188 -0
  115. package/dist/tier-BJDhpH6X.js +4 -0
  116. package/dist/tiers/tier=1.png +0 -0
  117. package/dist/tiers/tier=2.png +0 -0
  118. package/dist/tiers/tier=3.png +0 -0
  119. package/dist/tiers/tier=4.png +0 -0
  120. package/dist/titles/type=diamond.png +0 -0
  121. package/dist/titles/type=drinks.png +0 -0
  122. package/dist/titles/type=food.png +0 -0
  123. package/dist/titles/type=heart.png +0 -0
  124. package/dist/titles/type=medal.png +0 -0
  125. package/dist/titles/type=spend.png +0 -0
  126. package/dist/titles/type=thank-you.png +0 -0
  127. package/dist/titles/type=thumbs-up.png +0 -0
  128. package/dist/titles/type=years.png +0 -0
  129. package/dist/trigger-es-_uiSg.js +213 -0
  130. package/dist/tslib.es6-BCqqvLQ_.js +44 -0
  131. package/dist/type_drinks-D6jnpvwV.js +4 -0
  132. package/dist/useMarketingMaterialActions-CpiIKMmG.js +107 -0
  133. package/dist/usePagination-SYsXgU6x.js +220 -0
  134. package/dist/user-DUe40u3g.js +55 -0
  135. package/dist/vue-i18n-Dn9zxRuv.js +2365 -0
  136. package/dist/xlsx-DugGi7dB.js +15491 -0
  137. package/dist/zod-Dw8_B6RC.js +91 -0
  138. package/package.json +1 -1
@@ -0,0 +1,1133 @@
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 _e, withCtx as le, createElementVNode as S, createVNode as I, createElementBlock as B, Fragment as J, renderList as ie, toDisplayString as G, createTextVNode as Se, 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-COXmoOd1.js";
4
+ import "./index-pjXQwa0j.js";
5
+ import { s as Ie } from "./index-DBD_e_yR.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-BOalh3ZH.js";
11
+ import { u as me } from "./business-o_sAO_33.js";
12
+ import { _ as de, u as Fe } from "./usePagination-SYsXgU6x.js";
13
+ import { c as ae, p as De } from "./plugins-CbpvMMOJ.js";
14
+ import { g as pe } from "./user-DUe40u3g.js";
15
+ import { B as fe, e as Ee } from "./export-DdDpRFVg.js";
16
+ import { u as ge } from "./campaign--IUcyI8h.js";
17
+ import "./index-CtJ0MQQ1.js";
18
+ import "./index-Dh2apeby.js";
19
+ import "./index-D41Xq5qY.js";
20
+ import "./index-Bc7JXl59.js";
21
+ import { u as ye } from "./vue-i18n-Dn9zxRuv.js";
22
+ import { o as U } from "./objectId-dwaoBfJX.js";
23
+ import { u as he } from "./loading-D-RglDMV.js";
24
+ import { w as Ae } from "./xlsx-DugGi7dB.js";
25
+ import { useRouter as Ne } from "vue-router";
26
+ import { t as L } from "./index-DDpz9LmI.js";
27
+ import { R as W } from "./app-CyNzTZOx.js";
28
+ import { F as Q } from "./collectible.enum-2y8KIQLL.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-CT6uJJ9y.js";
32
+ function ke(u) {
33
+ let p = "";
34
+ switch (u) {
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 = u;
58
+ break;
59
+ }
60
+ return p;
61
+ }
62
+ function Ve(u) {
63
+ var p, m, d, x, h, T;
64
+ switch ((p = u == null ? void 0 : u.pf_collectible) == null ? void 0 : p.type) {
65
+ case "VOUCHER":
66
+ return `${(m = u.pf_collectible) == null ? void 0 : m.type} (${(d = u.pf_collectible) == null ? void 0 : d.name})`;
67
+ case "TITLE":
68
+ return `${(x = u.pf_collectible) == null ? void 0 : x.type} (${(h = u.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 = u == null ? void 0 : u.pf_collectible) == null ? void 0 : T.type);
75
+ }
76
+ }
77
+ function ze(u) {
78
+ switch (u) {
79
+ case "ONLINE":
80
+ return "Online";
81
+ case "COIN":
82
+ return "Point";
83
+ default:
84
+ return u;
85
+ }
86
+ }
87
+ const z = {
88
+ getReason: ke,
89
+ formattedType: Ve,
90
+ formattedPaymentType: ze
91
+ }, Be = (u) => {
92
+ if (u.startsWith("_") || u.includes("."))
93
+ return u;
94
+ for (const p of ["pf_user_", "pf_collectible_"])
95
+ if (u.startsWith(p))
96
+ return `${p.slice(0, -1)}.${u.slice(p.length).replace(new RegExp("_", "g"), ".")}`;
97
+ return u.replace(new RegExp("_", "g"), ".");
98
+ };
99
+ function Ue(u, p = { key: "_id", descending: !0 }) {
100
+ const m = P({
101
+ pageCount: 1,
102
+ searchValue: "",
103
+ pageIndex: 0,
104
+ totalRows: 0,
105
+ isLoading: !1,
106
+ pageSize: 10,
107
+ hasNext: !1
108
+ }), d = P(p), x = P([]), h = P([void 0]);
109
+ function T() {
110
+ h.value = [void 0], m.value.pageIndex = 0, m.value.pageCount = 1, m.value.hasNext = !1;
111
+ }
112
+ const M = async (n = {}) => {
113
+ const o = n.pageSize ?? m.value.pageSize, b = o !== m.value.pageSize;
114
+ b && T();
115
+ const y = b ? 0 : Math.max(n.pageIndex ?? m.value.pageIndex, 0), R = y === 0 || !!h.value[y] ? y : m.value.pageIndex, K = h.value[R];
116
+ m.value.isLoading = !0, m.value.pageSize = o, x.value = [];
117
+ try {
118
+ const A = await u({
119
+ limit: o,
120
+ sortBy: d.value.key,
121
+ descending: d.value.descending,
122
+ search: m.value.searchValue,
123
+ ...K ? { cursor: K } : {}
124
+ });
125
+ x.value = A.resources, m.value.pageIndex = R, m.value.totalRows = A.resources.length, m.value.hasNext = A.meta.hasNext, m.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), m.value.hasNext = !1;
128
+ } finally {
129
+ m.value.isLoading = !1;
130
+ }
131
+ };
132
+ let D, g;
133
+ const f = (n) => (D && clearTimeout(D), g && g(), new Promise((o) => {
134
+ g = o, D = setTimeout(async () => {
135
+ D = void 0, g = void 0, await M(n), o();
136
+ }, 200);
137
+ }));
138
+ return {
139
+ tableMeta: m,
140
+ rowData: x,
141
+ sortBy: d,
142
+ pageCursors: h,
143
+ resetCursorState: T,
144
+ fetchData: M,
145
+ debouncedFetchData: f,
146
+ onSort: async (n) => {
147
+ n.length ? d.value = {
148
+ key: Be(n[0].id),
149
+ descending: n[0].desc
150
+ } : d.value = p, T(), await f({
151
+ pageIndex: 0,
152
+ pageSize: m.value.pageSize
153
+ });
154
+ },
155
+ onSearch: () => (T(), f({
156
+ pageIndex: 0,
157
+ pageSize: m.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(u, { expose: p }) {
166
+ ye();
167
+ const m = P(!1), d = P(), x = ge(), h = me();
168
+ function T(f, a) {
169
+ m.value = f, d.value = a ?? null;
170
+ }
171
+ const M = j(() => {
172
+ var f, a;
173
+ return ee(
174
+ ((a = d.value) == null ? void 0 : a.expiryAmount.reduce(
175
+ (e, n) => e + n.amount,
176
+ ((f = d.value) == null ? void 0 : f.amount) ?? 0
177
+ )) ?? 0,
178
+ 2
179
+ );
180
+ }), D = j(() => {
181
+ var f, a, e, n, o;
182
+ return d.value ? [
183
+ {
184
+ label: "Transaction ID",
185
+ value: (f = d.value) == null ? void 0 : f._id
186
+ },
187
+ {
188
+ label: "Date/Time",
189
+ value: C(U(d.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(d.value)
209
+ },
210
+ {
211
+ label: "Source",
212
+ value: q(z.getReason(d.value.source))
213
+ },
214
+ {
215
+ label: "User",
216
+ value: (e = (a = d.value) == null ? void 0 : a.pf_user) == null ? void 0 : e.name
217
+ },
218
+ {
219
+ label: "Phone Number",
220
+ value: (o = (n = d.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 (!d.value) return [];
226
+ const f = [], a = (n = d.value) == null ? void 0 : n.metadata, e = d.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 = d.value) != null && o.ref.startsWith("bill_") && f.push({
241
+ label: "Bill Number",
242
+ value: (b = d.value) == null ? void 0 : b.ref,
243
+ copy: () => {
244
+ var w;
245
+ return ae((w = d.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(m),
273
+ "onUpdate:modelValue": a[1] || (a[1] = (o) => _e(m) ? m.value = o : null),
274
+ header: "Transaction Details"
275
+ }, {
276
+ "side-sheet-footer": le(() => [
277
+ S("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
+ S("div", $e, [
287
+ S("div", Le, [
288
+ (V(!0), B(J, null, ie(l(D), (o) => (V(), B("div", {
289
+ key: o.label,
290
+ class: "flex flex-col gap-4"
291
+ }, [
292
+ S("div", Ke, G(o.label), 1),
293
+ S("div", {
294
+ class: "text-fm-color-typo-secondary fm-typo-en-body-md-400 hover:underline",
295
+ onClick: o.copy
296
+ }, [
297
+ Se(G(o.accessorFn ? o.accessorFn() : o.value) + " ", 1),
298
+ (V(), se(we(o.component)))
299
+ ], 8, He),
300
+ a[2] || (a[2] = S("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
+ S("div", Ge, G(o.label), 1),
307
+ S("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] = S("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(u) {
328
+ const { t: p } = ye(), m = me(), d = ge(), x = Ne(), h = u, T = P(!1), { minor: M } = he, D = [
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 c, i, F, 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
+ ), _ = (i = (c = t.row.original.expiryAmount) == null ? void 0 : c[0]) != null && i.expiredAt ? C((N = (F = t.row.original.expiryAmount) == null ? void 0 : F[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 ${_}`
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 _;
453
+ return (_ = d.campaigns.all.find(
454
+ (c) => {
455
+ var i;
456
+ return c._id === ((i = t.row.original.metadata) == null ? void 0 : i.campaign);
457
+ }
458
+ )) == null ? void 0 : _.name;
459
+ }
460
+ },
461
+ [
462
+ s(v.FmIcon, {
463
+ name: "info",
464
+ color: "primary",
465
+ size: "sm",
466
+ onClick: async (_) => {
467
+ _.preventDefault(), _.stopPropagation();
468
+ const c = d.campaigns.all.find(
469
+ (i) => {
470
+ var F;
471
+ return i._id === ((F = t.row.original.metadata) == null ? void 0 : F.campaign);
472
+ }
473
+ );
474
+ if (c)
475
+ switch (c.type) {
476
+ case "VOUCHER":
477
+ case "PROMOTION":
478
+ case "BROADCAST":
479
+ await x.push({
480
+ name: W[`$connect-CAMPAIGN_${c.type}`]
481
+ });
482
+ break;
483
+ case "GAME":
484
+ case "CREDIT":
485
+ case "MISSION":
486
+ await x.push({
487
+ name: W[`$connect-PROGRAM_${c.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, _;
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: (_ = t.row.original.metadata) == null ? void 0 : _.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: (_) => {
582
+ _.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
+ ), _ = await Promise.all(
610
+ r.resources.map(async (c) => {
611
+ let i;
612
+ if (c.source !== Z.enum.BILL)
613
+ i = !1;
614
+ else {
615
+ const N = c.refunded || !!c.refundedFrom;
616
+ if (c.expiryAmount.reduce(
617
+ (O, k) => O + k.amount,
618
+ c.amount ?? 0
619
+ ) > 0) {
620
+ let O = [];
621
+ [
622
+ Q.enum.STAMP,
623
+ Q.enum.POINT
624
+ ].includes(c.pf_collectible.type) ? i = !1 : i = !N;
625
+ } else
626
+ switch (c.pf_collectible.type) {
627
+ case Q.enum.VOUCHER:
628
+ i = c.expiryAmount.some(
629
+ (k) => !k.expiredAt || C(k.expiredAt).isAfter(C())
630
+ ) && !N;
631
+ break;
632
+ default:
633
+ i = !N;
634
+ break;
635
+ }
636
+ }
637
+ const F = y.value.find((N) => N._id === c.ref);
638
+ return {
639
+ ...c,
640
+ ref: (F == null ? void 0 : F.seqNumber) || c.ref,
641
+ isRevertable: i
642
+ };
643
+ })
644
+ );
645
+ return {
646
+ resources: r.resources.map((c) => {
647
+ const i = y.value.find((F) => F._id === c.ref);
648
+ return { ...c, ref: (i == null ? void 0 : i.seqNumber) || c.ref };
649
+ }),
650
+ meta: r.meta
651
+ };
652
+ }), y = P([]), w = Z.options.map((t) => ({ label: q(z.getReason(t)), value: t })), R = j(
653
+ () => m.locations.map((t) => ({ label: t.name, value: t._id }))
654
+ );
655
+ ce(
656
+ g,
657
+ () => {
658
+ b(), o({ pageIndex: 0 });
659
+ },
660
+ { deep: !0 }
661
+ );
662
+ async function K(t) {
663
+ M(
664
+ async () => {
665
+ await L.revertTransaction({
666
+ id: t._id.toString()
667
+ }), await o();
668
+ },
669
+ {
670
+ message: "Reverting transaction...",
671
+ successMessage: "Transaction reverted successfully"
672
+ }
673
+ );
674
+ }
675
+ async function A() {
676
+ try {
677
+ T.value = !0;
678
+ const t = new Ye(), r = f(), _ = 1e3;
679
+ await M(
680
+ async () => {
681
+ var F, N, $, O, k, ne, re;
682
+ let c, i = !0;
683
+ for (; i; ) {
684
+ const H = await L.readAllCursor(
685
+ {
686
+ limit: _,
687
+ sortBy: "_id",
688
+ descending: !1,
689
+ ...c ? { cursor: c } : {}
690
+ },
691
+ r
692
+ );
693
+ if (!H.resources.length)
694
+ break;
695
+ for (const E of H.resources)
696
+ t.addRecord({
697
+ TransactionID: E._id,
698
+ CreatedAt: C(U(E._id.toString())).format(
699
+ "D MMM YYYY, hh:mmA"
700
+ ),
701
+ Amount: ee(
702
+ E.expiryAmount.reduce(
703
+ (xe, be) => xe + be.amount,
704
+ E.amount ?? 0
705
+ ),
706
+ 2
707
+ ),
708
+ ExpiredAt: (N = (F = E.expiryAmount) == null ? void 0 : F[0]) != null && N.expiredAt ? C((O = ($ = E.expiryAmount) == null ? void 0 : $[0]) == null ? void 0 : O.expiredAt).format("D MMM YYYY") : "",
709
+ Type: z.formattedType(E),
710
+ Source: q(z.getReason(E.source)),
711
+ User: ((k = E.pf_user) == null ? void 0 : k.name) || "",
712
+ "Phone No.": ((ne = E.pf_user) == null ? void 0 : ne.phoneNumber) || "",
713
+ References: E.ref,
714
+ Remark: ((re = E.metadata) == null ? void 0 : re.remark) || ""
715
+ });
716
+ c = H.meta.nextCursor ?? void 0, i = H.meta.hasNext && !!c;
717
+ }
718
+ await Ae(
719
+ t.buildExcel(),
720
+ `transactions-${(/* @__PURE__ */ new Date()).toISOString()}.xlsx`,
721
+ {
722
+ bookType: "xlsx",
723
+ bookSST: !1,
724
+ type: "array"
725
+ }
726
+ );
727
+ },
728
+ {
729
+ message: "Exporting transactions...",
730
+ successMessage: "transactions exported successfully"
731
+ }
732
+ );
733
+ } catch (t) {
734
+ console.error(t);
735
+ } finally {
736
+ T.value = !1;
737
+ }
738
+ }
739
+ const oe = P(null);
740
+ function ve(t) {
741
+ var r;
742
+ console.log(t), (r = oe.value) == null || r.showSheet(!0, t.original);
743
+ }
744
+ return Ce(async () => {
745
+ await m.readLocations(), await d.read(), await o();
746
+ }), (t, r) => {
747
+ const _ = Y("FmSearch"), c = Y("FmButton");
748
+ return V(), B(J, null, [
749
+ S("div", null, [
750
+ S("div", Xe, [
751
+ I(_, {
752
+ class: "hidden xs:!flex border-b border-fm-color-neutral-gray-100",
753
+ modelValue: l(g).search,
754
+ "onUpdate:modelValue": r[0] || (r[0] = (i) => l(g).search = i),
755
+ placeholder: "Search",
756
+ collapsible: ""
757
+ }, null, 8, ["modelValue"]),
758
+ I(c, {
759
+ icon: "ios_share",
760
+ variant: "tertiary",
761
+ onClick: A
762
+ })
763
+ ]),
764
+ S("div", Qe, [
765
+ S("div", Je, [
766
+ I(X, {
767
+ class: "cursor-pointer text-fm-color-neutral-gray-400",
768
+ "right-icon": "keyboard_arrow_down",
769
+ modelValue: l(g)["metadata.location"],
770
+ "onUpdate:modelValue": r[1] || (r[1] = (i) => l(g)["metadata.location"] = i),
771
+ icon: "storefront",
772
+ "show-item-label": !0,
773
+ items: l(R)
774
+ }, null, 8, ["modelValue", "items"]),
775
+ I(X, {
776
+ class: "cursor-pointer text-fm-color-neutral-gray-400",
777
+ "right-icon": "keyboard_arrow_down",
778
+ modelValue: l(g)["pf_collectible.type"],
779
+ "onUpdate:modelValue": r[2] || (r[2] = (i) => l(g)["pf_collectible.type"] = i),
780
+ label: "Type: ",
781
+ "show-item-label": !0,
782
+ items: [
783
+ { label: "Point", value: "COIN" },
784
+ { label: "Credit", value: "CREDIT" },
785
+ { label: "Voucher", value: "VOUCHER" },
786
+ { label: "Experience", value: "POINT" },
787
+ { label: "Tier", value: "TIER" },
788
+ { label: "Title", value: "TITLE" },
789
+ { label: "Game", value: "GAME" },
790
+ { label: "Stamp", value: "STAMP" }
791
+ ]
792
+ }, null, 8, ["modelValue"]),
793
+ I(X, {
794
+ class: "cursor-pointer text-fm-color-neutral-gray-400",
795
+ "right-icon": "keyboard_arrow_down",
796
+ modelValue: l(g).source,
797
+ "onUpdate:modelValue": r[3] || (r[3] = (i) => l(g).source = i),
798
+ label: "Source: ",
799
+ "show-item-label": !0,
800
+ items: l(w)
801
+ }, null, 8, ["modelValue", "items"]),
802
+ I(ue, {
803
+ "model-value": {
804
+ startDate: l(g).dateRange.startDate,
805
+ endDate: l(g).dateRange.endDate
806
+ },
807
+ "onUpdate:modelValue": r[4] || (r[4] = (i) => l(g).dateRange = {
808
+ startDate: l(C)(i.startDate).startOf("d").toISOString(),
809
+ endDate: l(C)(i.endDate).endOf("d").toISOString()
810
+ })
811
+ }, null, 8, ["model-value"])
812
+ ]),
813
+ I(_, {
814
+ class: "xs:hidden",
815
+ modelValue: l(g).search,
816
+ "onUpdate:modelValue": r[5] || (r[5] = (i) => l(g).search = i),
817
+ placeholder: "Search",
818
+ collapsible: ""
819
+ }, null, 8, ["modelValue"]),
820
+ S("div", Ze, [
821
+ I(c, {
822
+ icon: "ios_share",
823
+ variant: "tertiary",
824
+ onClick: A
825
+ })
826
+ ])
827
+ ]),
828
+ I(de, {
829
+ loading: l(a).isLoading,
830
+ "row-data": l(e),
831
+ "row-count": l(a).totalRows,
832
+ "column-defs": D.filter(
833
+ (i) => !h.user || i.header !== "User" && i.header !== "Phone No."
834
+ ),
835
+ "page-count": l(a).pageCount,
836
+ "page-index": l(a).pageIndex,
837
+ "page-size": l(a).pageSize,
838
+ "shrink-at": !1,
839
+ "pagination-mode": "cursor",
840
+ "has-next": l(a).hasNext,
841
+ onSortChange: l(n),
842
+ onPageChange: r[6] || (r[6] = (i) => l(o)({
843
+ pageSize: i.pageSize,
844
+ pageIndex: i.pageIndex
845
+ })),
846
+ onRowClick: ve
847
+ }, null, 8, ["loading", "row-data", "row-count", "column-defs", "page-count", "page-index", "page-size", "has-next", "onSortChange"])
848
+ ]),
849
+ I(qe, {
850
+ ref_key: "transactionDetailSheet",
851
+ ref: oe
852
+ }, null, 512)
853
+ ], 64);
854
+ };
855
+ }
856
+ });
857
+ class et extends fe {
858
+ }
859
+ 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({
860
+ __name: "StoreTransactions",
861
+ props: {
862
+ user: {
863
+ type: String
864
+ }
865
+ },
866
+ setup(u) {
867
+ const p = u, { minor: m } = he;
868
+ Re();
869
+ const d = [
870
+ {
871
+ header: "Transaction ID",
872
+ meta: {
873
+ maxWidth: "150px"
874
+ },
875
+ cell(e) {
876
+ return s("div", { class: "flex items-center" }, [
877
+ s(v.FmIcon, {
878
+ name: "content_copy",
879
+ outline: !0,
880
+ size: "sm",
881
+ class: "cursor-pointer mr-4 shrink-0",
882
+ onClick: (n) => {
883
+ n.preventDefault(), n.stopPropagation(), ae(e.row.original._id.toString());
884
+ }
885
+ }),
886
+ s("div", { class: "truncate" }, e.row.original._id.toString())
887
+ ]);
888
+ }
889
+ },
890
+ {
891
+ header: "Created at",
892
+ accessorFn: (e) => C(U(e._id.toString())).format("D MMM YYYY, hh:mmA"),
893
+ enableSorting: !0
894
+ },
895
+ {
896
+ header: "Bundle",
897
+ accessorFn: (e) => e.bundle.name
898
+ },
899
+ {
900
+ header: "Location",
901
+ accessorFn: (e) => e.location ? e.pf_location[0].name : "Online Store"
902
+ },
903
+ {
904
+ header: "Payment Type",
905
+ accessorFn: (e) => {
906
+ var n;
907
+ return ((n = e.paymentType) == null ? void 0 : n.type) ?? "N/A";
908
+ },
909
+ cell(e) {
910
+ var n, o;
911
+ return s("div", { class: "flex items-center gap-4" }, [
912
+ s("div", { class: "flex items-center" }, [
913
+ ((n = e.row.original.paymentType) == null ? void 0 : n.type) == "ONLINE" && e.row.original.paymentType.extra ? s(
914
+ v.FmTooltip,
915
+ {
916
+ content: e.row.original.paymentType.extra
917
+ },
918
+ [
919
+ s(v.FmIcon, {
920
+ name: "info",
921
+ outline: !0,
922
+ size: "sm"
923
+ })
924
+ ]
925
+ ) : s("div")
926
+ ]),
927
+ s(
928
+ "div",
929
+ { class: "flex-1" },
930
+ ((o = e.row.original.paymentType) == null ? void 0 : o.type) ?? "N/A"
931
+ )
932
+ ]);
933
+ }
934
+ },
935
+ {
936
+ header: "User",
937
+ cell: (e) => pe(e.row.original.pf_member)
938
+ },
939
+ {
940
+ header: "Phone No.",
941
+ accessorFn: (e) => e.pf_member.phoneNumber
942
+ },
943
+ {
944
+ header: "Status",
945
+ // accessorFn: (u) => u.status,
946
+ cell(e) {
947
+ var b, y, w, R;
948
+ const n = e.row.original.status, o = {
949
+ COMPLETED: "text-fm-color-typo-success bg-fm-color-system-success-100",
950
+ REFUNDED: "text-fm-color-typo-warning bg-fm-color-system-warning-100"
951
+ };
952
+ return s("div", { class: "flex items-center gap-4" }, [
953
+ s(v.FmChip, {
954
+ label: Me.title(n),
955
+ variant: "plain",
956
+ class: o[n] ?? ""
957
+ }),
958
+ (y = (b = e.row.original) == null ? void 0 : b.refund) != null && y.reason ? s(
959
+ v.FmTooltip,
960
+ {
961
+ content: (R = (w = e.row.original) == null ? void 0 : w.refund) == null ? void 0 : R.reason
962
+ },
963
+ [
964
+ s(v.FmIcon, {
965
+ name: "info",
966
+ color: "primary",
967
+ outline: !0,
968
+ size: "sm"
969
+ })
970
+ ]
971
+ ) : null
972
+ ]);
973
+ }
974
+ },
975
+ {
976
+ header: "Source",
977
+ accessorFn: (e) => e.source
978
+ },
979
+ {
980
+ header: "Ref",
981
+ accessorFn: (e) => e.ref
982
+ },
983
+ {
984
+ id: "action",
985
+ cell(e) {
986
+ const n = e.row.original, o = n.status === "COMPLETED" && !n.refund && n.source == "ADMIN";
987
+ return o ? s(
988
+ v.FmMenu,
989
+ {
990
+ placement: "bottom-end",
991
+ onClick: (b) => {
992
+ b.stopPropagation();
993
+ }
994
+ },
995
+ {
996
+ "menu-button": () => s(v.FmButton, {
997
+ icon: "settings",
998
+ variant: "tertiary",
999
+ if: o
1000
+ }),
1001
+ default: () => [
1002
+ s(v.FmMenuItem, {
1003
+ label: "Refund",
1004
+ sublabel: "Refund this transaction",
1005
+ onClick: async (b) => {
1006
+ b.stopPropagation(), await f(n);
1007
+ }
1008
+ })
1009
+ ]
1010
+ }
1011
+ ) : s("div");
1012
+ }
1013
+ }
1014
+ ], x = P({
1015
+ searchValue: "",
1016
+ dateRange: {
1017
+ startDate: C().subtract(7, "day").toISOString(),
1018
+ endDate: C().toISOString()
1019
+ }
1020
+ }), { tableMeta: h, rowData: T, onSort: M, debouncedFetchData: D, onSearch: g } = Fe(async (e) => {
1021
+ const n = {
1022
+ ...x.value.dateRange,
1023
+ user: p.user
1024
+ };
1025
+ return await L.readStoreTransactions(e, n);
1026
+ });
1027
+ async function f(e) {
1028
+ await De.confirm(
1029
+ "Are you sure you want to refund this transaction?",
1030
+ "Refund Store Transaction",
1031
+ "Confirm",
1032
+ "Cancel"
1033
+ ) && await m(
1034
+ async () => {
1035
+ var o;
1036
+ await Oe.refundStoreTransaction({
1037
+ id: e._id,
1038
+ reason: `ADMIN:${(o = Pe().sessionUser) == null ? void 0 : o.name}`
1039
+ }), await D();
1040
+ },
1041
+ {
1042
+ message: "Refunding transaction...",
1043
+ successMessage: "Transaction refunded successfully"
1044
+ }
1045
+ );
1046
+ }
1047
+ ce(
1048
+ x,
1049
+ () => {
1050
+ D();
1051
+ },
1052
+ { deep: !0 }
1053
+ ), Te(async () => {
1054
+ await D();
1055
+ });
1056
+ const a = async () => Ee({
1057
+ exporter: new et(),
1058
+ readFunction: (e) => L.readStoreTransactions(e, {
1059
+ ...x.value.dateRange,
1060
+ user: p.user
1061
+ }),
1062
+ transformRecord: (e) => {
1063
+ var n, o, b, y, w, R;
1064
+ return {
1065
+ TransactionId: ((n = e._id) == null ? void 0 : n.toString()) || "",
1066
+ CreatedAt: C(U(e._id.toString())).format(
1067
+ "DD/MM/YYYY HH:mm:ss"
1068
+ ),
1069
+ Bundle: e.bundle.name || "",
1070
+ Location: e.location ? e.pf_location[0].name : "Online Store",
1071
+ PaymentType: ((o = e.paymentType) == null ? void 0 : o.type) || "N/A",
1072
+ PaymentExtra: ((b = e.paymentType) == null ? void 0 : b.extra) || "",
1073
+ User: ((y = e.pf_member) == null ? void 0 : y.name) || "",
1074
+ PhoneNumber: ((w = e.pf_member) == null ? void 0 : w.phoneNumber) || "",
1075
+ Status: e.status || "",
1076
+ RefundReason: ((R = e == null ? void 0 : e.refund) == null ? void 0 : R.reason) || "",
1077
+ Ref: (e == null ? void 0 : e.ref) || ""
1078
+ };
1079
+ },
1080
+ filename: "store-transactions"
1081
+ });
1082
+ return (e, n) => {
1083
+ const o = Y("FmSearch"), b = Y("FmButton");
1084
+ return V(), B("div", null, [
1085
+ S("div", tt, [
1086
+ S("div", at, [
1087
+ I(ue, {
1088
+ modelValue: l(x).dateRange,
1089
+ "onUpdate:modelValue": n[0] || (n[0] = (y) => l(x).dateRange = y)
1090
+ }, null, 8, ["modelValue"])
1091
+ ]),
1092
+ S("div", ot, [
1093
+ I(o, {
1094
+ modelValue: l(h).searchValue,
1095
+ "onUpdate:modelValue": [
1096
+ n[1] || (n[1] = (y) => l(h).searchValue = y),
1097
+ l(g)
1098
+ ],
1099
+ placeholder: "Search",
1100
+ collapsible: ""
1101
+ }, null, 8, ["modelValue", "onUpdate:modelValue"]),
1102
+ I(b, {
1103
+ icon: "ios_share",
1104
+ variant: "tertiary",
1105
+ onClick: a
1106
+ })
1107
+ ])
1108
+ ]),
1109
+ I(de, {
1110
+ loading: l(h).isLoading,
1111
+ "row-data": l(T),
1112
+ "row-count": l(h).totalRows,
1113
+ "column-defs": d.filter(
1114
+ (y) => !p.user || y.header !== "User" && y.header !== "Phone No."
1115
+ ),
1116
+ "page-count": l(h).pageCount,
1117
+ "page-index": l(h).pageIndex,
1118
+ "page-size": l(h).pageSize,
1119
+ "shrink-at": !1,
1120
+ onSortChange: l(M),
1121
+ onPageChange: n[2] || (n[2] = (y) => l(D)({
1122
+ pageSize: y.pageSize,
1123
+ pageIndex: y.pageIndex
1124
+ }))
1125
+ }, null, 8, ["loading", "row-data", "row-count", "column-defs", "page-count", "page-index", "page-size", "onSortChange"])
1126
+ ]);
1127
+ };
1128
+ }
1129
+ });
1130
+ export {
1131
+ Ot as _,
1132
+ kt as a
1133
+ };