@feedmepos/mf-connect 0.1.38-beta.9 → 0.1.38-beta.91

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 (162) hide show
  1. package/dist/{Analytic-3MN2saaU.js → Analytic-Drbkm5By.js} +31 -32
  2. package/dist/{App-Co8X5Wdy.js → App-C0cdcG5i.js} +741 -728
  3. package/dist/AuditLogs-BZZLtf2u.js +2013 -0
  4. package/dist/{Bin-8a56ZDib.js → Bin-DRV5lRmj.js} +10 -10
  5. package/dist/Broadcast-C90FN2LB.js +266 -0
  6. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-BVXlfq31.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-CsdxwjCn.js} +6 -6
  7. package/dist/{Card-B8_09LJu.js → Card-CWF84A1O.js} +145 -140
  8. package/dist/Collections-ja0gMaFf.js +540 -0
  9. package/dist/Credit-D8U2AJgq.js +260 -0
  10. package/dist/CustomSelect.vue_vue_type_script_setup_true_lang-Du7fRSZC.js +128 -0
  11. package/dist/DateInput.vue_vue_type_script_setup_true_lang-BN4Q5Y3l.js +54 -0
  12. package/dist/{DateRangeChip.vue_vue_type_script_setup_true_lang-BUzUIIUW.js → DateRangeChip.vue_vue_type_script_setup_true_lang-eIoPtgO5.js} +1 -1
  13. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-YR62BvBG.js +3120 -0
  14. package/dist/EffectSheet.vue_vue_type_style_index_0_lang-BVbhDMqH.js +351 -0
  15. package/dist/Experience-DDXLGizu.js +259 -0
  16. package/dist/{FileSaver.min-NlMItPOc.js → FileSaver.min-Dng61jiL.js} +1 -1
  17. package/dist/FilterChip.vue_vue_type_script_setup_true_lang-DaU-9GzO.js +129 -0
  18. package/dist/FmTableSelection.vue_vue_type_script_setup_true_lang-DzcUc0_w.js +52 -0
  19. package/dist/Game-CMOilzsW.js +330 -0
  20. package/dist/Grab-tPVQB39R.js +300 -0
  21. package/dist/{ImageInput.vue_vue_type_script_setup_true_lang-rWUkV9gn.js → ImageInput.vue_vue_type_script_setup_true_lang-BbtEXO4b.js} +49 -48
  22. package/dist/{Index-DLF71mx_.js → Index-Ch7wiShF.js} +54 -54
  23. package/dist/LocationPicker.vue_vue_type_script_setup_true_lang-DLO0jj6Z.js +48 -0
  24. package/dist/{LottieAnimation.vue_vue_type_script_setup_true_lang-CyGJxUol.js → LottieAnimation.vue_vue_type_script_setup_true_lang-CplyhUFF.js} +1 -1
  25. package/dist/{MainLayout-B1aJoR95.js → MainLayout-BMqnfxHh.js} +1 -1
  26. package/dist/Marketing-C0weDg-u.js +236 -0
  27. package/dist/MarketingMaterialEdit-BD-SyXVQ.js +1036 -0
  28. package/dist/{Member-Bkw4aqtv.js → Member-Bpf0amjr.js} +38 -37
  29. package/dist/{MemberList-a3PdVYB3.js → MemberList-cWYPEpL4.js} +485 -489
  30. package/dist/{MemberTransactions-CPDBd-n3.js → MemberTransactions-vzRUVwpO.js} +1 -1
  31. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-pbN8pN1m.js → MessageInput.vue_vue_type_script_setup_true_lang-DY3L9CvB.js} +10392 -9967
  32. package/dist/Mission-HRwIp1QY.js +334 -0
  33. package/dist/{Overview-De97NDoe.js → Overview-D9cfX4Kr.js} +34 -34
  34. package/dist/Point-Dz-Z0_m9.js +262 -0
  35. package/dist/Promotion-Csb0bdI6.js +397 -0
  36. package/dist/{Queue-ISVZxCE2.js → Queue-CAVKh9bK.js} +18 -18
  37. package/dist/{Record-2FMByNC6.js → Record-bPnIoHnT.js} +15 -14
  38. package/dist/Review-D2DfvLqJ.js +621 -0
  39. package/dist/ReviewFacebookCallback-CI7V3xbp.js +243 -0
  40. package/dist/ReviewGoogleCallback-LA2S8FLZ.js +213 -0
  41. package/dist/{Reward-DPRyQ37x.js → Reward-DdHF5Pr7.js} +16 -16
  42. package/dist/{RewardGroup.vue_vue_type_script_setup_true_lang-Ba7-3bL-.js → RewardGroup.vue_vue_type_script_setup_true_lang-DyZhWnI4.js} +13 -14
  43. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-B0OSLJVN.js +1912 -0
  44. package/dist/Segment-DV1zcWF7.js +1015 -0
  45. package/dist/{SelectItems.vue_vue_type_script_setup_true_lang-DZbyDVid.js → SelectItems.vue_vue_type_script_setup_true_lang-Df1HE9sL.js} +23 -23
  46. package/dist/{SendCollectionSheet.vue_vue_type_script_setup_true_lang-ioMFYIwK.js → SendCollectionSheet.vue_vue_type_script_setup_true_lang-C0K9giqI.js} +12 -12
  47. package/dist/SendVoucherSheet.vue_vue_type_script_setup_true_lang-CzJL8Xl0.js +226 -0
  48. package/dist/Setting-DZiZy8A5.js +2039 -0
  49. package/dist/SettingAdvertisements-Bb9shWVJ.js +264 -0
  50. package/dist/Store-mymtMyho.js +1996 -0
  51. package/dist/StoreRewards-jcjZfSv7.js +537 -0
  52. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-B-b5_TFL.js +1130 -0
  53. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-sCa1J_hq.js +7007 -0
  54. package/dist/{Tier-CwRj0oJ1.js → Tier-Ba6aHC3R.js} +562 -480
  55. package/dist/{Title-EII5OxSP.js → Title-C4uKD8E1.js} +151 -149
  56. package/dist/{Transaction-1MTkAfej.js → Transaction-Bf2uG6co.js} +2 -2
  57. package/dist/{UserRuleGroup.vue_vue_type_script_setup_true_lang-BlQVWQHJ.js → UserRuleGroup.vue_vue_type_script_setup_true_lang-C3ttU-bw.js} +7 -7
  58. package/dist/Voucher-Lsc2pKCk.js +421 -0
  59. package/dist/VoucherEditor.vue_vue_type_script_setup_true_lang-MA7tsTm-.js +421 -0
  60. package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-CTeGK4bk.js → ZodTextField.vue_vue_type_script_setup_true_lang-DEDavbCx.js} +2 -2
  61. package/dist/app-BRrGcz9U.js +59647 -0
  62. package/dist/app.js +1 -1
  63. package/dist/{business-DjnN-J4U.js → business-TBSvPv65.js} +11 -8
  64. package/dist/campaign-CL95CZkI.js +219 -0
  65. package/dist/campaign-DxcuYXB7.js +254 -0
  66. package/dist/campaign.enum-DRydaoy9.js +26 -0
  67. package/dist/campaign.fn-BsoUwQ5N.js +776 -0
  68. package/dist/{collectible.enum-r6N115Lu.js → collectible.enum-CpTbpumt.js} +1 -1
  69. package/dist/{collection.fn-CSsfVv26.js → collection.fn-BNrPdDIr.js} +2 -2
  70. package/dist/dto-BGrkIVqX.js +222 -0
  71. package/dist/duplicateCampaign-DBaFROXd.js +51 -0
  72. package/dist/effect-fonU-1xO.js +89 -0
  73. package/dist/{email-addresses-D8uheCCF.js → email-addresses-WeV5Gvxa.js} +2 -2
  74. package/dist/{export-Ver6WiX6.js → export-DDXf8yf_.js} +4 -4
  75. package/dist/{helper-Bg4xoFbh.js → helper-DwnzJKxo.js} +22 -7
  76. package/dist/index-10x-WMiS.js +30289 -0
  77. package/dist/index-9Wt89ReU.js +3625 -0
  78. package/dist/{index-Bb0CHeNx.js → index-Brh5FXQ7.js} +3 -3
  79. package/dist/index-BxxNZQUc.js +8910 -0
  80. package/dist/{index-hJUxCNsF.js → index-CDAMmPIn.js} +1 -1
  81. package/dist/{index-CNhr0_Zx.js → index-Cg1vzNzf.js} +617 -191
  82. package/dist/{index-BZZ4iF4-.js → index-Cl7QnFc4.js} +23 -12
  83. package/dist/index-CuvNtC_M.js +61 -0
  84. package/dist/{index-BPQyQc4q.js → index-Cvw-xFek.js} +1 -1
  85. package/dist/index-DCJ_r_e2.js +85 -0
  86. package/dist/{index-Dn_bmcns.js → index-DLG8B-TK.js} +3 -3
  87. package/dist/{index-D4JOeJJJ.js → index-DWhh_u0L.js} +1 -1
  88. package/dist/index-DsQJTvKe.js +28900 -0
  89. package/dist/index-oR7xhhIt.js +48 -0
  90. package/dist/{index.esm2017-hK1Mi9yY.js → index.esm2017-CFvohTUs.js} +122 -122
  91. package/dist/{loading-kIQFOTwH.js → loading-DiD8J1Jc.js} +4 -3
  92. package/dist/{lodash-B5I3zXaY.js → lodash-BJgKlNEt.js} +1 -1
  93. package/dist/{membership--xR-HZoa.js → membership-C8HuK9_K.js} +38 -18
  94. package/dist/{moment-BWErdI6_.js → moment-D7p2TMB-.js} +6 -1
  95. package/dist/{money-c-ITXnlg.js → money-DXl1-c0l.js} +1 -1
  96. package/dist/{number-DfZSBLOY.js → number-C6RGu6qp.js} +1 -1
  97. package/dist/objectid-8Boc1xMT.js +145 -0
  98. package/dist/{campaign-BpJ1O6KS.js → plugins-CxBcRdUi.js} +677 -699
  99. package/dist/remy-D_Deb3ue.js +13 -0
  100. package/dist/{reward-CE0ifMHS.js → reward-CEh2CA9Z.js} +1 -1
  101. package/dist/{rule-DrjdmpaB.js → rule-DEfU8NOO.js} +505 -487
  102. package/dist/rule-builder-BZIx2IzX.js +102 -0
  103. package/dist/string-Gcy5IM_H.js +32 -0
  104. package/dist/style.css +11 -2
  105. package/dist/template-Ba8NxY41.js +188 -0
  106. package/dist/timezone-DUqMvcwo.js +1156 -0
  107. package/dist/trigger-KQ-DPHv-.js +213 -0
  108. package/dist/useMarketingMaterialActions-DSI7Fpu9.js +96 -0
  109. package/dist/usePagination-BeTADCIt.js +220 -0
  110. package/dist/{user-Cl3IotYV.js → user-DN6_QE2j.js} +15 -14
  111. package/dist/vue-i18n-B4dOYJz4.js +2365 -0
  112. package/dist/{xlsx-BDBzdOuM.js → xlsx-BDFTkXYe.js} +1 -1
  113. package/dist/{zod-Bg2FbC-D.js → zod-B8WJKIxe.js} +32 -31
  114. package/package.json +14 -6
  115. package/dist/AuditLogs-DTq6IAuc.js +0 -1887
  116. package/dist/Broadcast-UreS5Kiq.js +0 -227
  117. package/dist/Collections-B0I5ULxR.js +0 -465
  118. package/dist/Credit-B4Ad8DWP.js +0 -222
  119. package/dist/CustomSelect.vue_vue_type_script_setup_true_lang-DLnvDVgf.js +0 -108
  120. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-DjgACf9F.js +0 -2185
  121. package/dist/EffectSheet.vue_vue_type_style_index_0_lang-y5JnuIev.js +0 -347
  122. package/dist/Experience-xO5KpTTm.js +0 -223
  123. package/dist/FilterChip.vue_vue_type_script_setup_true_lang-d8rh38tD.js +0 -114
  124. package/dist/Game-ChgrVvz5.js +0 -278
  125. package/dist/Marketing-BlmRXSGl.js +0 -20073
  126. package/dist/Mission-B07wK0HX.js +0 -296
  127. package/dist/Point-Ckj9QIeH.js +0 -226
  128. package/dist/Promotion-aGNCOeRN.js +0 -289
  129. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-DWj-421v.js +0 -1751
  130. package/dist/Segment-CRMNJ11X.js +0 -882
  131. package/dist/SendVoucherSheet.vue_vue_type_script_setup_true_lang-Cfp8XXdO.js +0 -147
  132. package/dist/Setting-c0FWRZsD.js +0 -1936
  133. package/dist/Store-Bm1_15s8.js +0 -1842
  134. package/dist/StoreRewards-BCQHHfay.js +0 -423
  135. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-CfTF2l-D.js +0 -1029
  136. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-rvhoxo0w.js +0 -139
  137. package/dist/Voucher-CYvjCb-v.js +0 -384
  138. package/dist/VoucherEditor.vue_vue_type_script_setup_true_lang-63Jr71dJ.js +0 -419
  139. package/dist/_commonjsHelpers-BkfeUUK-.js +0 -28
  140. package/dist/app-BJLHk8ao.js +0 -33357
  141. package/dist/app-BzIk1ojT.js +0 -7086
  142. package/dist/campaign-BHNS5kXt.js +0 -96
  143. package/dist/campaign.enum-CJDWE_Om.js +0 -20
  144. package/dist/campaign.fn-C0HQE9uh.js +0 -758
  145. package/dist/dto-Byq51uVH.js +0 -214
  146. package/dist/effect-Do3yTM-_.js +0 -78
  147. package/dist/index-B1V9UnI9.js +0 -76
  148. package/dist/index-BM9CWjC6.js +0 -38
  149. package/dist/index-CsaQJMAR.js +0 -66
  150. package/dist/index-D6VxioBg.js +0 -30038
  151. package/dist/index-DGKlRWn3.js +0 -32260
  152. package/dist/index-DLKyOu7W.js +0 -8861
  153. package/dist/index-DyYF6HYL.js +0 -121
  154. package/dist/index-UXtH44XQ.js +0 -3120
  155. package/dist/objectid-DKbha9-x.js +0 -145
  156. package/dist/plugins-DtakupKW.js +0 -208
  157. package/dist/remy-vue-client-Cpppk9h-.js +0 -1693
  158. package/dist/rule-builder-B_hCyq3x.js +0 -89
  159. package/dist/template-WI4a-lFY.js +0 -190
  160. package/dist/trigger-DieDHht3.js +0 -144
  161. package/dist/usePagination-BeF5K3M7.js +0 -223
  162. package/dist/vue-i18n-DKh0SMhL.js +0 -2365
@@ -0,0 +1,1130 @@
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-9Wt89ReU.js";
4
+ import "./index-10x-WMiS.js";
5
+ import { s as Ie } from "./index-DLG8B-TK.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-C6RGu6qp.js";
11
+ import { u as me } from "./business-TBSvPv65.js";
12
+ import { _ as de, u as Fe } from "./usePagination-BeTADCIt.js";
13
+ import { c as ae, p as De } from "./plugins-CxBcRdUi.js";
14
+ import { g as pe } from "./user-DN6_QE2j.js";
15
+ import { B as fe, e as Ee } from "./export-DDXf8yf_.js";
16
+ import { u as ge } from "./campaign-CL95CZkI.js";
17
+ import "./index-DWhh_u0L.js";
18
+ import "./index-Cg1vzNzf.js";
19
+ import "./index-BxxNZQUc.js";
20
+ import "./index-Brh5FXQ7.js";
21
+ import { u as ye } from "./vue-i18n-B4dOYJz4.js";
22
+ import { o as U } from "./objectId-dwaoBfJX.js";
23
+ import { u as he } from "./loading-DiD8J1Jc.js";
24
+ import { w as Ae } from "./xlsx-BDFTkXYe.js";
25
+ import { useRouter as Ne } from "vue-router";
26
+ import { t as L } from "./index-Cl7QnFc4.js";
27
+ import { R as W } from "./app-BRrGcz9U.js";
28
+ import { F as Q } from "./collectible.enum-CpTbpumt.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-CDAMmPIn.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
+ };