@feedmepos/mf-connect 0.1.38-beta.8 → 0.1.38-beta.80

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 (159) hide show
  1. package/dist/{Analytic-CJap-Cat.js → Analytic-LOK5TzX0.js} +31 -32
  2. package/dist/{App-CLTtX1QT.js → App-Bk5Z5u5_.js} +617 -607
  3. package/dist/AuditLogs-Rezf9EeA.js +1991 -0
  4. package/dist/{Bin-C2xMLxoE.js → Bin-B8yzS5bD.js} +10 -10
  5. package/dist/Broadcast-CZ0QCvua.js +266 -0
  6. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-BCkD7Xfn.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-iJQS2Ck9.js} +6 -6
  7. package/dist/{Card-BPrCNLQy.js → Card-BQOv5yB9.js} +145 -140
  8. package/dist/Collections-qenPlCd2.js +540 -0
  9. package/dist/Credit-BJLskbVu.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-DKWCWOU_.js +3120 -0
  14. package/dist/EffectSheet.vue_vue_type_style_index_0_lang-Dw1qQfnG.js +351 -0
  15. package/dist/Experience-BjfEiGT8.js +259 -0
  16. package/dist/{FileSaver.min-NlMItPOc.js → FileSaver.min-C013Tr1o.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-Gw_tFjen.js +330 -0
  20. package/dist/Grab-Bdv7SaB9.js +300 -0
  21. package/dist/{ImageInput.vue_vue_type_script_setup_true_lang-rWUkV9gn.js → ImageInput.vue_vue_type_script_setup_true_lang-Ba4L39GL.js} +49 -48
  22. package/dist/{Index-DMdNgISh.js → Index-C67U3YDJ.js} +54 -54
  23. package/dist/LocationPicker.vue_vue_type_script_setup_true_lang-pQ8sF5KW.js +48 -0
  24. package/dist/{LottieAnimation.vue_vue_type_script_setup_true_lang-CyGJxUol.js → LottieAnimation.vue_vue_type_script_setup_true_lang-o-eN3J4i.js} +1 -1
  25. package/dist/{MainLayout-B1aJoR95.js → MainLayout-DPjqCyJ5.js} +1 -1
  26. package/dist/Marketing-DtEooXof.js +166 -0
  27. package/dist/MarketingMaterialEdit-Balw055Y.js +1065 -0
  28. package/dist/{Member-CnSXGQi_.js → Member-QA7TQnyw.js} +38 -37
  29. package/dist/{MemberList-DcpEKV1D.js → MemberList-CSJQFYlh.js} +486 -491
  30. package/dist/{MemberTransactions-DeuuEcO5.js → MemberTransactions-D-46vda_.js} +1 -1
  31. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-DLAEPNsq.js → MessageInput.vue_vue_type_script_setup_true_lang-6a7_lw74.js} +13443 -10607
  32. package/dist/Mission-DJVxFbX5.js +334 -0
  33. package/dist/{Overview-elpi-jpI.js → Overview-Btkh3oiI.js} +24 -25
  34. package/dist/Point-CVdF9GtN.js +262 -0
  35. package/dist/Promotion-BtmlvUd3.js +396 -0
  36. package/dist/{Queue-GvBhNEFe.js → Queue-BfiCMsLC.js} +23 -24
  37. package/dist/{Record-CbSxgo8i.js → Record-B07QGPli.js} +10 -10
  38. package/dist/Review-BeZ90jW9.js +621 -0
  39. package/dist/ReviewFacebookCallback-CwAcKaib.js +243 -0
  40. package/dist/ReviewGoogleCallback-CVK6Yc5E.js +213 -0
  41. package/dist/{Reward-QCGlrq89.js → Reward-CyXqNpAa.js} +16 -16
  42. package/dist/{RewardGroup.vue_vue_type_script_setup_true_lang-DSRvoo9z.js → RewardGroup.vue_vue_type_script_setup_true_lang-BICsdgSh.js} +13 -14
  43. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-BgKGNK7y.js +1912 -0
  44. package/dist/{Segment-5PndnEUa.js → Segment-B9g57O7g.js} +273 -274
  45. package/dist/{SelectItems.vue_vue_type_script_setup_true_lang-DXR7bpzY.js → SelectItems.vue_vue_type_script_setup_true_lang-BwDOXE87.js} +23 -23
  46. package/dist/{SendCollectionSheet.vue_vue_type_script_setup_true_lang-DmITlNtt.js → SendCollectionSheet.vue_vue_type_script_setup_true_lang-DXDcJLYF.js} +12 -12
  47. package/dist/SendVoucherSheet.vue_vue_type_script_setup_true_lang-CROBk6cD.js +226 -0
  48. package/dist/Setting-BHteqZv6.js +2039 -0
  49. package/dist/SettingAdvertisements-CubrbuSL.js +264 -0
  50. package/dist/Store-u6LYUnmp.js +1996 -0
  51. package/dist/StoreRewards-D9h0YnEx.js +535 -0
  52. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-vrYqDGOa.js +1129 -0
  53. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-WgNstmNx.js +7007 -0
  54. package/dist/{Tier-BKKxG29r.js → Tier-CBdi4sPT.js} +561 -480
  55. package/dist/{Title-CReZgw8V.js → Title-BegmN7hs.js} +151 -149
  56. package/dist/{Transaction-HWCmSVaJ.js → Transaction-C6XMd9_r.js} +2 -2
  57. package/dist/{UserRuleGroup.vue_vue_type_script_setup_true_lang-D00AchXo.js → UserRuleGroup.vue_vue_type_script_setup_true_lang-BBf4BP4m.js} +7 -7
  58. package/dist/Voucher-D6hSas_z.js +421 -0
  59. package/dist/VoucherEditor.vue_vue_type_script_setup_true_lang-ZOlAZ_q5.js +421 -0
  60. package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-DXF39yC1.js → ZodTextField.vue_vue_type_script_setup_true_lang-Bs8TNiCY.js} +2 -2
  61. package/dist/app-Duwed9mD.js +59309 -0
  62. package/dist/app.js +1 -1
  63. package/dist/{business-Bc-EMd2p.js → business-6oZ8Rgui.js} +11 -8
  64. package/dist/campaign-CzenWLhs.js +219 -0
  65. package/dist/campaign-PYce7g0o.js +253 -0
  66. package/dist/campaign.enum-KHniCp5a.js +26 -0
  67. package/dist/campaign.fn-dOSgHJcU.js +776 -0
  68. package/dist/{collectible.enum-C4dM8khp.js → collectible.enum-BZA1DKIB.js} +1 -1
  69. package/dist/{collection.fn-AjDNdFe1.js → collection.fn-CyfrdKBf.js} +2 -2
  70. package/dist/dto-DYmM2ud_.js +222 -0
  71. package/dist/duplicateCampaign-BXaDK8Q6.js +51 -0
  72. package/dist/effect-DBI_JHbP.js +89 -0
  73. package/dist/{email-addresses-B0SzUCQM.js → email-addresses-BNs-WN79.js} +2 -2
  74. package/dist/{export-Bgz6WcNZ.js → export-DTCCKE2m.js} +4 -4
  75. package/dist/{helper-B1vFwohM.js → helper-CeYr7Anh.js} +22 -7
  76. package/dist/index-38u-cCwD.js +3431 -0
  77. package/dist/{index-Cm2sBagk.js → index-BdjY7GRO.js} +1 -1
  78. package/dist/index-CGMiuxyf.js +85 -0
  79. package/dist/index-CQZbm9P5.js +8912 -0
  80. package/dist/index-Cal60fAm.js +48 -0
  81. package/dist/{index-DT2viYsL.js → index-CnRLkzpg.js} +617 -191
  82. package/dist/index-CuvNtC_M.js +61 -0
  83. package/dist/{index-CSQY21Zb.js → index-D-kPBF9C.js} +3 -3
  84. package/dist/{index-DVQnrex_.js → index-DcFYm1fy.js} +3 -3
  85. package/dist/index-DjONNxbl.js +30289 -0
  86. package/dist/{index-26SopNpv.js → index-ItaoypTr.js} +1 -1
  87. package/dist/index-_jxXI4_v.js +28899 -0
  88. package/dist/{index-DwT9RLst.js → index-nXfjG8UQ.js} +23 -12
  89. package/dist/{index-BIRmS75g.js → index-pHQfP2e7.js} +1 -1
  90. package/dist/{index.esm2017-BAIN70_n.js → index.esm2017-CokFPnqn.js} +185 -185
  91. package/dist/{loading-C6Ouh0mG.js → loading-fZQi5zP8.js} +1 -1
  92. package/dist/{lodash-B5I3zXaY.js → lodash-R-DIRmbj.js} +1 -1
  93. package/dist/{membership-DU0BwIj8.js → membership-CApN5ZJ1.js} +3 -3
  94. package/dist/{moment-BWErdI6_.js → moment-D7p2TMB-.js} +6 -1
  95. package/dist/{money-Bg7GuE5s.js → money-C6I6vVy2.js} +1 -1
  96. package/dist/{number-Ddmqo5D_.js → number-Dq4d381U.js} +1 -1
  97. package/dist/objectid-Kv5GREBk.js +145 -0
  98. package/dist/{campaign-BeF8kTyg.js → plugins-9_UvAdJ2.js} +784 -777
  99. package/dist/remy-NLAa-9Qg.js +46 -0
  100. package/dist/{reward-CN4gvn4c.js → reward-DXHGeGYY.js} +1 -1
  101. package/dist/{rule-CpiqqR0c.js → rule-B_XgRDr-.js} +505 -487
  102. package/dist/rule-builder-BMXyzu8k.js +102 -0
  103. package/dist/style.css +11 -2
  104. package/dist/template-CnyTUzQU.js +188 -0
  105. package/dist/timezone-Izs3ibB-.js +1156 -0
  106. package/dist/trigger-Dda3NmaE.js +213 -0
  107. package/dist/usePagination-Byxk4XVn.js +220 -0
  108. package/dist/user-BZxO8qdh.js +55 -0
  109. package/dist/{vue-i18n-DVmD9I_o.js → vue-i18n-DDbkmbSf.js} +433 -433
  110. package/dist/{xlsx-qJHsnW7k.js → xlsx-D8yNl8dN.js} +1 -1
  111. package/dist/{zod-Bg2FbC-D.js → zod-Xp7TePRP.js} +32 -31
  112. package/package.json +14 -6
  113. package/dist/AuditLogs-DW4rwNOn.js +0 -1887
  114. package/dist/Broadcast-Dhc0j16O.js +0 -227
  115. package/dist/Collections-CsUJEmqz.js +0 -465
  116. package/dist/Credit-Mqa-0XJd.js +0 -222
  117. package/dist/CustomSelect.vue_vue_type_script_setup_true_lang-DLnvDVgf.js +0 -108
  118. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-DWWLxIq-.js +0 -2185
  119. package/dist/EffectSheet.vue_vue_type_style_index_0_lang-BiQGZeDc.js +0 -347
  120. package/dist/Experience-BD5C3old.js +0 -223
  121. package/dist/FilterChip.vue_vue_type_script_setup_true_lang-d8rh38tD.js +0 -114
  122. package/dist/Game-D4xsi8Ym.js +0 -278
  123. package/dist/Marketing-axcQYl8k.js +0 -20073
  124. package/dist/Mission-BHZiL-GH.js +0 -296
  125. package/dist/Point-gKvdggAl.js +0 -226
  126. package/dist/Promotion-7x2F_sFX.js +0 -289
  127. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-AuN9NgcG.js +0 -1751
  128. package/dist/SendVoucherSheet.vue_vue_type_script_setup_true_lang-DTlv8ZAn.js +0 -147
  129. package/dist/Setting-Cab47wfH.js +0 -1936
  130. package/dist/Store-BFL3T9B5.js +0 -1842
  131. package/dist/StoreRewards-C43dCJtM.js +0 -423
  132. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-aAj5-nzZ.js +0 -1029
  133. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-K3OPSYrF.js +0 -139
  134. package/dist/Voucher-BhUAcPZg.js +0 -384
  135. package/dist/VoucherEditor.vue_vue_type_script_setup_true_lang-C0YNez2L.js +0 -419
  136. package/dist/_commonjsHelpers-BkfeUUK-.js +0 -28
  137. package/dist/app-BGaUIdCr.js +0 -7086
  138. package/dist/app-DccKBdW_.js +0 -33357
  139. package/dist/campaign-DbJZEU7P.js +0 -96
  140. package/dist/campaign.enum-PBKYGUQY.js +0 -20
  141. package/dist/campaign.fn-Cq-4LfQj.js +0 -758
  142. package/dist/dto-8NvMMYAb.js +0 -214
  143. package/dist/effect-DZhcEQ5g.js +0 -78
  144. package/dist/index-CQQedv0M.js +0 -32260
  145. package/dist/index-CTgQRqQR.js +0 -30038
  146. package/dist/index-CsaQJMAR.js +0 -66
  147. package/dist/index-DGaywhpY.js +0 -76
  148. package/dist/index-DOfLDlI8.js +0 -8861
  149. package/dist/index-DVpAocyR.js +0 -3120
  150. package/dist/index-DlJGd8RC.js +0 -121
  151. package/dist/index-Dm65CTdy.js +0 -38
  152. package/dist/objectid-MCaJXAgq.js +0 -145
  153. package/dist/plugins-C-CRzeyC.js +0 -208
  154. package/dist/remy-vue-client-Cpppk9h-.js +0 -1693
  155. package/dist/rule-builder-DmkJng-x.js +0 -89
  156. package/dist/template-DTZgnkl5.js +0 -190
  157. package/dist/trigger-CPjJ73Rc.js +0 -144
  158. package/dist/usePagination-BeF5K3M7.js +0 -223
  159. package/dist/user-8VIt8A1x.js +0 -54
@@ -0,0 +1,1129 @@
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 { r as Z } from "./index-38u-cCwD.js";
4
+ import "./index-DjONNxbl.js";
5
+ import { s as Ie } from "./index-DcFYm1fy.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-Dq4d381U.js";
11
+ import { u as me } from "./business-6oZ8Rgui.js";
12
+ import { _ as de, u as Fe } from "./usePagination-Byxk4XVn.js";
13
+ import { a as ae, c as De, p as Ee } from "./plugins-9_UvAdJ2.js";
14
+ import { g as pe } from "./user-BZxO8qdh.js";
15
+ import { B as fe, e as Ae } from "./export-DTCCKE2m.js";
16
+ import { u as ge } from "./campaign-CzenWLhs.js";
17
+ import "./index-BdjY7GRO.js";
18
+ import "./index-CnRLkzpg.js";
19
+ import "./index-CQZbm9P5.js";
20
+ import "./index-D-kPBF9C.js";
21
+ import { u as ye } from "./vue-i18n-DDbkmbSf.js";
22
+ import { o as U } from "./objectId-dwaoBfJX.js";
23
+ import { u as he } from "./loading-fZQi5zP8.js";
24
+ import { w as Ne } from "./xlsx-D8yNl8dN.js";
25
+ import { useRouter as Pe } from "vue-router";
26
+ import { t as L } from "./index-nXfjG8UQ.js";
27
+ import { R as W } from "./app-Duwed9mD.js";
28
+ import { F as Q } from "./collectible.enum-BZA1DKIB.js";
29
+ import { useCoreStore as Me } from "@feedmepos/mf-common";
30
+ import { m as Oe } from "./index-pHQfP2e7.js";
31
+ function ke(c) {
32
+ let p = "";
33
+ switch (c) {
34
+ case "PORTAL":
35
+ p = "ADMIN";
36
+ break;
37
+ case "BENEFIT":
38
+ p = "MEMBERSHIP";
39
+ break;
40
+ case "ORDER":
41
+ p = "ORDER";
42
+ break;
43
+ case "BILL":
44
+ p = "SPENDING";
45
+ break;
46
+ case "CASHBACK":
47
+ p = "CASHBACK";
48
+ break;
49
+ case "CYCLE":
50
+ p = "EXPIRED";
51
+ break;
52
+ case "COUNTER_CONSUME":
53
+ p = "COUNTER REDEEM";
54
+ break;
55
+ default:
56
+ p = c;
57
+ break;
58
+ }
59
+ return p;
60
+ }
61
+ function Ve(c) {
62
+ var p, u, m, x, h, T;
63
+ switch ((p = c == null ? void 0 : c.pf_collectible) == null ? void 0 : p.type) {
64
+ case "VOUCHER":
65
+ return `${(u = c.pf_collectible) == null ? void 0 : u.type} (${(m = c.pf_collectible) == null ? void 0 : m.name})`;
66
+ case "TITLE":
67
+ return `${(x = c.pf_collectible) == null ? void 0 : x.type} (${(h = c.pf_collectible) == null ? void 0 : h.name})`;
68
+ case "POINT":
69
+ return "Experience";
70
+ case "COIN":
71
+ return "Point";
72
+ default:
73
+ return Ie((T = c == null ? void 0 : c.pf_collectible) == null ? void 0 : T.type);
74
+ }
75
+ }
76
+ function ze(c) {
77
+ switch (c) {
78
+ case "ONLINE":
79
+ return "Online";
80
+ case "COIN":
81
+ return "Point";
82
+ default:
83
+ return c;
84
+ }
85
+ }
86
+ const z = {
87
+ getReason: ke,
88
+ formattedType: Ve,
89
+ formattedPaymentType: ze
90
+ }, Be = (c) => {
91
+ if (c.startsWith("_") || c.includes("."))
92
+ return c;
93
+ for (const p of ["pf_user_", "pf_collectible_"])
94
+ if (c.startsWith(p))
95
+ return `${p.slice(0, -1)}.${c.slice(p.length).replace(new RegExp("_", "g"), ".")}`;
96
+ return c.replace(new RegExp("_", "g"), ".");
97
+ };
98
+ function Ue(c, p = { key: "_id", descending: !0 }) {
99
+ const u = P({
100
+ pageCount: 1,
101
+ searchValue: "",
102
+ pageIndex: 0,
103
+ totalRows: 0,
104
+ isLoading: !1,
105
+ pageSize: 10,
106
+ hasNext: !1
107
+ }), m = P(p), x = P([]), h = P([void 0]);
108
+ function T() {
109
+ h.value = [void 0], u.value.pageIndex = 0, u.value.pageCount = 1, u.value.hasNext = !1;
110
+ }
111
+ const M = async (n = {}) => {
112
+ const o = n.pageSize ?? u.value.pageSize, b = o !== u.value.pageSize;
113
+ b && T();
114
+ 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];
115
+ u.value.isLoading = !0, u.value.pageSize = o, x.value = [];
116
+ try {
117
+ const A = await c({
118
+ limit: o,
119
+ sortBy: m.value.key,
120
+ descending: m.value.descending,
121
+ search: u.value.searchValue,
122
+ ...K ? { cursor: K } : {}
123
+ });
124
+ 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);
125
+ } catch (A) {
126
+ console.error("Error fetching data:", A), u.value.hasNext = !1;
127
+ } finally {
128
+ u.value.isLoading = !1;
129
+ }
130
+ };
131
+ let F, g;
132
+ const f = (n) => (F && clearTimeout(F), g && g(), new Promise((o) => {
133
+ g = o, F = setTimeout(async () => {
134
+ F = void 0, g = void 0, await M(n), o();
135
+ }, 200);
136
+ }));
137
+ return {
138
+ tableMeta: u,
139
+ rowData: x,
140
+ sortBy: m,
141
+ pageCursors: h,
142
+ resetCursorState: T,
143
+ fetchData: M,
144
+ debouncedFetchData: f,
145
+ onSort: async (n) => {
146
+ n.length ? m.value = {
147
+ key: Be(n[0].id),
148
+ descending: n[0].desc
149
+ } : m.value = p, T(), await f({
150
+ pageIndex: 0,
151
+ pageSize: u.value.pageSize
152
+ });
153
+ },
154
+ onSearch: () => (T(), f({
155
+ pageIndex: 0,
156
+ pageSize: u.value.pageSize
157
+ }))
158
+ };
159
+ }
160
+ class Ye extends fe {
161
+ }
162
+ 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({
163
+ __name: "TransactionDetailSheet",
164
+ setup(c, { expose: p }) {
165
+ ye();
166
+ const u = P(!1), m = P(), x = ge(), h = me();
167
+ function T(f, a) {
168
+ u.value = f, m.value = a ?? null;
169
+ }
170
+ const M = j(() => {
171
+ var f, a;
172
+ return ee(
173
+ ((a = m.value) == null ? void 0 : a.expiryAmount.reduce(
174
+ (e, n) => e + n.amount,
175
+ ((f = m.value) == null ? void 0 : f.amount) ?? 0
176
+ )) ?? 0,
177
+ 2
178
+ );
179
+ }), F = j(() => {
180
+ var f, a, e, n, o;
181
+ return m.value ? [
182
+ {
183
+ label: "Transaction ID",
184
+ value: (f = m.value) == null ? void 0 : f._id
185
+ },
186
+ {
187
+ label: "Date/Time",
188
+ value: C(U(m.value._id.toString())).format(
189
+ "D MMM YYYY, hh:mmA"
190
+ )
191
+ },
192
+ {
193
+ label: "Amount",
194
+ component: () => s(
195
+ "span",
196
+ {
197
+ class: [
198
+ "pr-2",
199
+ +M.value > 0 ? "text-fm-color-system-success-300" : "text-fm-color-system-error-300"
200
+ ]
201
+ },
202
+ M.value
203
+ )
204
+ },
205
+ {
206
+ label: "Type",
207
+ value: z.formattedType(m.value)
208
+ },
209
+ {
210
+ label: "Source",
211
+ value: q(z.getReason(m.value.source))
212
+ },
213
+ {
214
+ label: "User",
215
+ value: (e = (a = m.value) == null ? void 0 : a.pf_user) == null ? void 0 : e.name
216
+ },
217
+ {
218
+ label: "Phone Number",
219
+ value: (o = (n = m.value) == null ? void 0 : n.pf_user) == null ? void 0 : o.phoneNumber
220
+ }
221
+ ] : [];
222
+ }), g = j(() => {
223
+ var n, o, b, y;
224
+ if (!m.value) return [];
225
+ const f = [], a = (n = m.value) == null ? void 0 : n.metadata, e = m.value;
226
+ if (a != null && a.campaign) {
227
+ const w = x.campaigns.all.find(
228
+ (R) => R._id === (a == null ? void 0 : a.campaign)
229
+ );
230
+ if (!w) return;
231
+ f.push({
232
+ label: "Campaign",
233
+ value: w.name
234
+ });
235
+ }
236
+ return a != null && a.remark && f.push({
237
+ label: "Remark",
238
+ value: a.remark
239
+ }), (o = m.value) != null && o.ref.startsWith("bill_") && f.push({
240
+ label: "Bill Number",
241
+ value: (b = m.value) == null ? void 0 : b.ref,
242
+ copy: () => {
243
+ var w;
244
+ return ae((w = m.value) == null ? void 0 : w.ref);
245
+ }
246
+ }), a != null && a.location && f.push({
247
+ label: "Location",
248
+ value: (y = h.locations.find(
249
+ (w) => w._id.toString() === (a == null ? void 0 : a.location)
250
+ )) == null ? void 0 : y.name
251
+ }), e.source === Z.enum.STORE && f.push({
252
+ label: "Store Transaction",
253
+ value: e.ref
254
+ }), a != null && a.originTransaction && f.push({
255
+ label: "Parent Transaction",
256
+ value: a.originTransaction
257
+ }), a != null && a.referral_count && f.push({
258
+ label: "Referral Count",
259
+ value: a.referral_count
260
+ }), e.refundedFrom && f.push({
261
+ label: "Refunded From",
262
+ value: e.refundedFrom
263
+ }), f;
264
+ });
265
+ return p({
266
+ showSheet: T
267
+ }), (f, a) => {
268
+ const e = Y("FmButton"), n = Y("FmSideSheet");
269
+ return V(), se(n, {
270
+ "max-width": 560,
271
+ modelValue: l(u),
272
+ "onUpdate:modelValue": a[1] || (a[1] = (o) => Se(u) ? u.value = o : null),
273
+ header: "Transaction Details"
274
+ }, {
275
+ "side-sheet-footer": le(() => [
276
+ _("div", je, [
277
+ I(e, {
278
+ label: "Close",
279
+ onClick: a[0] || (a[0] = (o) => T(!1)),
280
+ variant: "tertiary"
281
+ })
282
+ ])
283
+ ]),
284
+ default: le(() => [
285
+ _("div", $e, [
286
+ _("div", Le, [
287
+ (V(!0), B(J, null, ie(l(F), (o) => (V(), B("div", {
288
+ key: o.label,
289
+ class: "flex flex-col gap-4"
290
+ }, [
291
+ _("div", Ke, G(o.label), 1),
292
+ _("div", {
293
+ class: "text-fm-color-typo-secondary fm-typo-en-body-md-400 hover:underline",
294
+ onClick: o.copy
295
+ }, [
296
+ _e(G(o.accessorFn ? o.accessorFn() : o.value) + " ", 1),
297
+ (V(), se(we(o.component)))
298
+ ], 8, He),
299
+ a[2] || (a[2] = _("hr", { class: "mt-3" }, null, -1))
300
+ ]))), 128)),
301
+ (V(!0), B(J, null, ie(l(g), (o) => (V(), B("div", {
302
+ key: o.label,
303
+ class: "flex flex-col gap-4"
304
+ }, [
305
+ _("div", Ge, G(o.label), 1),
306
+ _("div", {
307
+ class: "text-fm-color-typo-secondary fm-typo-en-body-md-400 hover:underline",
308
+ onClick: o.copy
309
+ }, G(o.accessorFn ? o.accessorFn() : o.value), 9, We),
310
+ a[3] || (a[3] = _("hr", { class: "mt-3" }, null, -1))
311
+ ]))), 128))
312
+ ])
313
+ ])
314
+ ]),
315
+ _: 1
316
+ }, 8, ["modelValue"]);
317
+ };
318
+ }
319
+ }), 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" }, Mt = /* @__PURE__ */ te({
320
+ __name: "CollectionTransactions",
321
+ props: {
322
+ user: {
323
+ type: String
324
+ }
325
+ },
326
+ setup(c) {
327
+ const { t: p } = ye(), u = me(), m = ge(), x = Pe(), h = c, T = P(!1), { minor: M } = he, F = [
328
+ {
329
+ header: "Transaction ID",
330
+ accessorKey: "_id",
331
+ meta: {
332
+ maxWidth: "100px"
333
+ },
334
+ cell(t) {
335
+ return s("div", { class: "flex items-center" }, [
336
+ s(v.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(), ae(t.row.original._id.toString());
343
+ }
344
+ }),
345
+ s(
346
+ "div",
347
+ { class: "pr-2 text-ellipsis overflow-hidden" },
348
+ t.row.original._id.toString()
349
+ )
350
+ ]);
351
+ },
352
+ enableSorting: !1
353
+ },
354
+ {
355
+ header: "Created at",
356
+ accessorKey: "_id",
357
+ accessorFn: (t) => C(U(t._id.toString())),
358
+ cell: (t) => C(U(t.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(t) {
368
+ var d, i, D, N;
369
+ const r = ee(
370
+ t.row.original.expiryAmount.reduce(
371
+ ($, O) => $ + O.amount,
372
+ t.row.original.amount ?? 0
373
+ ),
374
+ 2
375
+ ), 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(
376
+ "D MMM YYYY"
377
+ ) : "";
378
+ return s("div", { class: "flex items-center" }, [
379
+ s(
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
+ s("div", { class: "flex items-center" }, [
390
+ t.row.original.expiryAmount.length > 0 ? s(
391
+ v.FmTooltip,
392
+ {
393
+ content: `Expired on ${S}`
394
+ },
395
+ [
396
+ s(v.FmIcon, {
397
+ name: "info",
398
+ outline: !0,
399
+ size: "sm"
400
+ })
401
+ ]
402
+ ) : s("div")
403
+ ])
404
+ ]);
405
+ }
406
+ },
407
+ {
408
+ header: "Type",
409
+ accessorKey: "pf_collectible.type",
410
+ accessorFn: (t) => z.formattedType(t),
411
+ meta: {
412
+ maxWidth: "200px"
413
+ },
414
+ cell(t) {
415
+ const r = z.formattedType(t.row.original);
416
+ return s("div", { class: "flex items-center" }, [
417
+ s("div", { class: "truncate text-ellipsis" }, r),
418
+ r.length > 20 ? s(
419
+ v.FmTooltip,
420
+ {
421
+ content: r
422
+ },
423
+ [
424
+ s(v.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(t) {
439
+ var r;
440
+ return s("div", { class: "flex items-center gap-4" }, [
441
+ s(
442
+ "div",
443
+ { class: "truncate text-ellipsis" },
444
+ q(z.getReason(t.row.original.source))
445
+ ),
446
+ ...(r = t.row.original.metadata) != null && r.campaign ? [
447
+ s(
448
+ v.FmTooltip,
449
+ {
450
+ get content() {
451
+ var S;
452
+ return (S = m.campaigns.all.find(
453
+ (d) => {
454
+ var i;
455
+ return d._id === ((i = t.row.original.metadata) == null ? void 0 : i.campaign);
456
+ }
457
+ )) == null ? void 0 : S.name;
458
+ }
459
+ },
460
+ [
461
+ s(v.FmIcon, {
462
+ name: "info",
463
+ color: "primary",
464
+ size: "sm",
465
+ onClick: async (S) => {
466
+ S.preventDefault(), S.stopPropagation();
467
+ const d = m.campaigns.all.find(
468
+ (i) => {
469
+ var D;
470
+ return i._id === ((D = t.row.original.metadata) == null ? void 0 : D.campaign);
471
+ }
472
+ );
473
+ if (d)
474
+ switch (d.type) {
475
+ case "VOUCHER":
476
+ case "PROMOTION":
477
+ case "BROADCAST":
478
+ await x.push({
479
+ name: W[`$connect-CAMPAIGN_${d.type}`]
480
+ });
481
+ break;
482
+ case "GAME":
483
+ case "CREDIT":
484
+ case "MISSION":
485
+ await x.push({
486
+ name: W[`$connect-PROGRAM_${d.type}`]
487
+ });
488
+ break;
489
+ case "POINT":
490
+ await x.push({
491
+ name: W["$connect-PROGRAM_EXPERIENCE"]
492
+ });
493
+ break;
494
+ case "COIN":
495
+ await x.push({
496
+ name: W["$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(t) {
512
+ return pe(t.row.original.pf_user);
513
+ }
514
+ },
515
+ {
516
+ header: "Phone No.",
517
+ accessorKey: "pf_user.phoneNumber",
518
+ accessorFn: (t) => {
519
+ var r;
520
+ return ((r = t == null ? void 0 : t.pf_user) == null ? void 0 : r.phoneNumber) || "";
521
+ }
522
+ },
523
+ {
524
+ header: "Status",
525
+ id: "status",
526
+ enableSorting: !1,
527
+ cell(t) {
528
+ const r = !!t.row.original.refunded;
529
+ return s(v.FmChip, {
530
+ label: p(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: (t) => t.ref,
538
+ header: "References",
539
+ accessorKey: "ref",
540
+ cell(t) {
541
+ var r, S;
542
+ return s("div", { class: "flex items-center justify-between gap-4" }, [
543
+ s("div", { class: "flex items-center" }, [
544
+ (r = t.row.original.metadata) != null && r.remark ? s(
545
+ v.FmTooltip,
546
+ {
547
+ content: (S = t.row.original.metadata) == null ? void 0 : S.remark
548
+ },
549
+ [
550
+ s(v.FmIcon, {
551
+ name: "info",
552
+ class: "pl-2",
553
+ outline: !0,
554
+ size: "sm"
555
+ })
556
+ ]
557
+ ) : s("div")
558
+ ]),
559
+ s("div", { class: "flex-1" }, t.row.original.ref)
560
+ ]);
561
+ }
562
+ },
563
+ {
564
+ header: "Actions",
565
+ cell(t) {
566
+ const r = t.row.original;
567
+ return s(
568
+ v.FmTooltip,
569
+ {
570
+ get content() {
571
+ return "Revert Transaction";
572
+ }
573
+ },
574
+ [
575
+ s(v.FmButton, {
576
+ variant: "tertiary",
577
+ icon: "amend",
578
+ iconColor: "neutral-gray-400",
579
+ disabled: !r.isRevertable,
580
+ onClick: (S) => {
581
+ S.stopPropagation(), K(r);
582
+ }
583
+ })
584
+ ]
585
+ );
586
+ }
587
+ }
588
+ ], g = P({
589
+ search: "",
590
+ "pf_collectible.type": [],
591
+ "metadata.location": [],
592
+ dateRange: {
593
+ startDate: C().subtract(7, "day").toISOString(),
594
+ endDate: C().endOf("day").toISOString()
595
+ },
596
+ source: []
597
+ }), f = () => ({
598
+ ...g.value,
599
+ user: h.user,
600
+ dateRange: {
601
+ start: new Date(g.value.dateRange.startDate).toISOString(),
602
+ end: new Date(g.value.dateRange.endDate).toISOString()
603
+ }
604
+ }), { tableMeta: a, rowData: e, onSort: n, debouncedFetchData: o, resetCursorState: b } = Ue(async (t) => {
605
+ const r = await L.readAllCursor(
606
+ t,
607
+ f()
608
+ );
609
+ return {
610
+ resources: await Promise.all(
611
+ r.resources.map(async (d) => {
612
+ let i;
613
+ if (d.source !== Z.enum.BILL)
614
+ i = !1;
615
+ else {
616
+ const N = d.refunded || !!d.refundedFrom;
617
+ if (d.expiryAmount.reduce(
618
+ (O, k) => O + k.amount,
619
+ d.amount ?? 0
620
+ ) > 0) {
621
+ let O = [];
622
+ [
623
+ Q.enum.STAMP,
624
+ Q.enum.POINT
625
+ ].includes(d.pf_collectible.type) ? i = !1 : i = !N;
626
+ } else
627
+ switch (d.pf_collectible.type) {
628
+ case Q.enum.VOUCHER:
629
+ i = d.expiryAmount.some(
630
+ (k) => !k.expiredAt || C(k.expiredAt).isAfter(C())
631
+ ) && !N;
632
+ break;
633
+ default:
634
+ i = !N;
635
+ break;
636
+ }
637
+ }
638
+ const D = y.value.find((N) => N._id === d.ref);
639
+ return {
640
+ ...d,
641
+ ref: (D == null ? void 0 : D.seqNumber) || d.ref,
642
+ isRevertable: i
643
+ };
644
+ })
645
+ ),
646
+ meta: r.meta
647
+ };
648
+ }), y = P([]), w = Z.options.map((t) => ({ label: q(z.getReason(t)), value: t })), R = j(
649
+ () => u.locations.map((t) => ({ label: t.name, value: t._id }))
650
+ );
651
+ ce(
652
+ g,
653
+ () => {
654
+ b(), o({ pageIndex: 0 });
655
+ },
656
+ { deep: !0 }
657
+ );
658
+ async function K(t) {
659
+ M(
660
+ async () => {
661
+ await L.revertTransaction({
662
+ id: t._id.toString()
663
+ }), await o();
664
+ },
665
+ {
666
+ message: "Reverting transaction...",
667
+ successMessage: "Transaction reverted successfully"
668
+ }
669
+ );
670
+ }
671
+ async function A() {
672
+ try {
673
+ T.value = !0;
674
+ const t = new Ye(), r = f(), S = 1e3;
675
+ await M(
676
+ async () => {
677
+ var D, N, $, O, k, ne, re;
678
+ let d, i = !0;
679
+ for (; i; ) {
680
+ const H = await L.readAllCursor(
681
+ {
682
+ limit: S,
683
+ sortBy: "_id",
684
+ descending: !1,
685
+ ...d ? { cursor: d } : {}
686
+ },
687
+ r
688
+ );
689
+ if (!H.resources.length)
690
+ break;
691
+ for (const E of H.resources)
692
+ t.addRecord({
693
+ TransactionID: E._id,
694
+ CreatedAt: C(U(E._id.toString())).format(
695
+ "D MMM YYYY, hh:mmA"
696
+ ),
697
+ Amount: ee(
698
+ E.expiryAmount.reduce(
699
+ (xe, be) => xe + be.amount,
700
+ E.amount ?? 0
701
+ ),
702
+ 2
703
+ ),
704
+ 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") : "",
705
+ Type: z.formattedType(E),
706
+ Source: q(z.getReason(E.source)),
707
+ User: ((k = E.pf_user) == null ? void 0 : k.name) || "",
708
+ "Phone No.": ((ne = E.pf_user) == null ? void 0 : ne.phoneNumber) || "",
709
+ References: E.ref,
710
+ Remark: ((re = E.metadata) == null ? void 0 : re.remark) || ""
711
+ });
712
+ d = H.meta.nextCursor ?? void 0, i = H.meta.hasNext && !!d;
713
+ }
714
+ await Ne(
715
+ t.buildExcel(),
716
+ `transactions-${(/* @__PURE__ */ new Date()).toISOString()}.xlsx`,
717
+ {
718
+ bookType: "xlsx",
719
+ bookSST: !1,
720
+ type: "array"
721
+ }
722
+ );
723
+ },
724
+ {
725
+ message: "Exporting transactions...",
726
+ successMessage: "transactions exported successfully"
727
+ }
728
+ );
729
+ } catch (t) {
730
+ console.error(t);
731
+ } finally {
732
+ T.value = !1;
733
+ }
734
+ }
735
+ const oe = P(null);
736
+ function ve(t) {
737
+ var r;
738
+ console.log(t), (r = oe.value) == null || r.showSheet(!0, t.original);
739
+ }
740
+ return Ce(async () => {
741
+ await u.readLocations(), await m.read(), await o();
742
+ }), (t, r) => {
743
+ const S = Y("FmSearch"), d = Y("FmButton");
744
+ return V(), B(J, null, [
745
+ _("div", null, [
746
+ _("div", Xe, [
747
+ I(S, {
748
+ class: "hidden xs:!flex border-b border-fm-color-neutral-gray-100",
749
+ modelValue: l(g).search,
750
+ "onUpdate:modelValue": r[0] || (r[0] = (i) => l(g).search = i),
751
+ placeholder: "Search",
752
+ collapsible: ""
753
+ }, null, 8, ["modelValue"]),
754
+ I(d, {
755
+ icon: "ios_share",
756
+ variant: "tertiary",
757
+ onClick: A
758
+ })
759
+ ]),
760
+ _("div", Qe, [
761
+ _("div", Je, [
762
+ I(X, {
763
+ class: "cursor-pointer text-fm-color-neutral-gray-400",
764
+ "right-icon": "keyboard_arrow_down",
765
+ modelValue: l(g)["metadata.location"],
766
+ "onUpdate:modelValue": r[1] || (r[1] = (i) => l(g)["metadata.location"] = i),
767
+ icon: "storefront",
768
+ "show-item-label": !0,
769
+ items: l(R)
770
+ }, null, 8, ["modelValue", "items"]),
771
+ I(X, {
772
+ class: "cursor-pointer text-fm-color-neutral-gray-400",
773
+ "right-icon": "keyboard_arrow_down",
774
+ modelValue: l(g)["pf_collectible.type"],
775
+ "onUpdate:modelValue": r[2] || (r[2] = (i) => l(g)["pf_collectible.type"] = i),
776
+ label: "Type: ",
777
+ "show-item-label": !0,
778
+ items: [
779
+ { label: "Point", value: "COIN" },
780
+ { label: "Credit", value: "CREDIT" },
781
+ { label: "Voucher", value: "VOUCHER" },
782
+ { label: "Experience", value: "POINT" },
783
+ { label: "Tier", value: "TIER" },
784
+ { label: "Title", value: "TITLE" },
785
+ { label: "Game", value: "GAME" },
786
+ { label: "Stamp", value: "STAMP" }
787
+ ]
788
+ }, null, 8, ["modelValue"]),
789
+ I(X, {
790
+ class: "cursor-pointer text-fm-color-neutral-gray-400",
791
+ "right-icon": "keyboard_arrow_down",
792
+ modelValue: l(g).source,
793
+ "onUpdate:modelValue": r[3] || (r[3] = (i) => l(g).source = i),
794
+ label: "Source: ",
795
+ "show-item-label": !0,
796
+ items: l(w)
797
+ }, null, 8, ["modelValue", "items"]),
798
+ I(ue, {
799
+ "model-value": {
800
+ startDate: l(g).dateRange.startDate,
801
+ endDate: l(g).dateRange.endDate
802
+ },
803
+ "onUpdate:modelValue": r[4] || (r[4] = (i) => l(g).dateRange = {
804
+ startDate: l(C)(i.startDate).startOf("d").toISOString(),
805
+ endDate: l(C)(i.endDate).endOf("d").toISOString()
806
+ })
807
+ }, null, 8, ["model-value"])
808
+ ]),
809
+ I(S, {
810
+ class: "xs:hidden",
811
+ modelValue: l(g).search,
812
+ "onUpdate:modelValue": r[5] || (r[5] = (i) => l(g).search = i),
813
+ placeholder: "Search",
814
+ collapsible: ""
815
+ }, null, 8, ["modelValue"]),
816
+ _("div", Ze, [
817
+ I(d, {
818
+ icon: "ios_share",
819
+ variant: "tertiary",
820
+ onClick: A
821
+ })
822
+ ])
823
+ ]),
824
+ I(de, {
825
+ loading: l(a).isLoading,
826
+ "row-data": l(e),
827
+ "row-count": l(a).totalRows,
828
+ "column-defs": F.filter(
829
+ (i) => !h.user || i.header !== "User" && i.header !== "Phone No."
830
+ ),
831
+ "page-count": l(a).pageCount,
832
+ "page-index": l(a).pageIndex,
833
+ "page-size": l(a).pageSize,
834
+ "shrink-at": !1,
835
+ "pagination-mode": "cursor",
836
+ "has-next": l(a).hasNext,
837
+ onSortChange: l(n),
838
+ onPageChange: r[6] || (r[6] = (i) => l(o)({
839
+ pageSize: i.pageSize,
840
+ pageIndex: i.pageIndex
841
+ })),
842
+ onRowClick: ve
843
+ }, null, 8, ["loading", "row-data", "row-count", "column-defs", "page-count", "page-index", "page-size", "has-next", "onSortChange"])
844
+ ]),
845
+ I(qe, {
846
+ ref_key: "transactionDetailSheet",
847
+ ref: oe
848
+ }, null, 512)
849
+ ], 64);
850
+ };
851
+ }
852
+ });
853
+ class et extends fe {
854
+ }
855
+ const tt = { class: "flex items-center justify-between" }, at = { class: "flex gap-8 items-center" }, ot = { class: "flex gap-8 items-center xs:hidden" }, Ot = /* @__PURE__ */ te({
856
+ __name: "StoreTransactions",
857
+ props: {
858
+ user: {
859
+ type: String
860
+ }
861
+ },
862
+ setup(c) {
863
+ const p = c, { minor: u } = he;
864
+ Re();
865
+ const m = [
866
+ {
867
+ header: "Transaction ID",
868
+ meta: {
869
+ maxWidth: "150px"
870
+ },
871
+ cell(e) {
872
+ return s("div", { class: "flex items-center" }, [
873
+ s(v.FmIcon, {
874
+ name: "content_copy",
875
+ outline: !0,
876
+ size: "sm",
877
+ class: "cursor-pointer mr-4 shrink-0",
878
+ onClick: (n) => {
879
+ n.preventDefault(), n.stopPropagation(), ae(e.row.original._id.toString());
880
+ }
881
+ }),
882
+ s("div", { class: "truncate" }, e.row.original._id.toString())
883
+ ]);
884
+ }
885
+ },
886
+ {
887
+ header: "Created at",
888
+ accessorFn: (e) => C(U(e._id.toString())).format("D MMM YYYY, hh:mmA"),
889
+ enableSorting: !0
890
+ },
891
+ {
892
+ header: "Bundle",
893
+ accessorFn: (e) => e.bundle.name
894
+ },
895
+ {
896
+ header: "Location",
897
+ accessorFn: (e) => e.location ? e.pf_location[0].name : "Online Store"
898
+ },
899
+ {
900
+ header: "Payment Type",
901
+ accessorFn: (e) => {
902
+ var n;
903
+ return ((n = e.paymentType) == null ? void 0 : n.type) ?? "N/A";
904
+ },
905
+ cell(e) {
906
+ var n, o;
907
+ return s("div", { class: "flex items-center gap-4" }, [
908
+ s("div", { class: "flex items-center" }, [
909
+ ((n = e.row.original.paymentType) == null ? void 0 : n.type) == "ONLINE" && e.row.original.paymentType.extra ? s(
910
+ v.FmTooltip,
911
+ {
912
+ content: e.row.original.paymentType.extra
913
+ },
914
+ [
915
+ s(v.FmIcon, {
916
+ name: "info",
917
+ outline: !0,
918
+ size: "sm"
919
+ })
920
+ ]
921
+ ) : s("div")
922
+ ]),
923
+ s(
924
+ "div",
925
+ { class: "flex-1" },
926
+ ((o = e.row.original.paymentType) == null ? void 0 : o.type) ?? "N/A"
927
+ )
928
+ ]);
929
+ }
930
+ },
931
+ {
932
+ header: "User",
933
+ cell: (e) => pe(e.row.original.pf_member)
934
+ },
935
+ {
936
+ header: "Phone No.",
937
+ accessorFn: (e) => e.pf_member.phoneNumber
938
+ },
939
+ {
940
+ header: "Status",
941
+ // accessorFn: (u) => u.status,
942
+ cell(e) {
943
+ var b, y, w, R;
944
+ const n = e.row.original.status, o = {
945
+ COMPLETED: "text-fm-color-typo-success bg-fm-color-system-success-100",
946
+ REFUNDED: "text-fm-color-typo-warning bg-fm-color-system-warning-100"
947
+ };
948
+ return s("div", { class: "flex items-center gap-4" }, [
949
+ s(v.FmChip, {
950
+ label: De.title(n),
951
+ variant: "plain",
952
+ class: o[n] ?? ""
953
+ }),
954
+ (y = (b = e.row.original) == null ? void 0 : b.refund) != null && y.reason ? s(
955
+ v.FmTooltip,
956
+ {
957
+ content: (R = (w = e.row.original) == null ? void 0 : w.refund) == null ? void 0 : R.reason
958
+ },
959
+ [
960
+ s(v.FmIcon, {
961
+ name: "info",
962
+ color: "primary",
963
+ outline: !0,
964
+ size: "sm"
965
+ })
966
+ ]
967
+ ) : null
968
+ ]);
969
+ }
970
+ },
971
+ {
972
+ header: "Source",
973
+ accessorFn: (e) => e.source
974
+ },
975
+ {
976
+ header: "Ref",
977
+ accessorFn: (e) => e.ref
978
+ },
979
+ {
980
+ id: "action",
981
+ cell(e) {
982
+ const n = e.row.original, o = n.status === "COMPLETED" && !n.refund && n.source == "ADMIN";
983
+ return o ? s(
984
+ v.FmMenu,
985
+ {
986
+ placement: "bottom-end",
987
+ onClick: (b) => {
988
+ b.stopPropagation();
989
+ }
990
+ },
991
+ {
992
+ "menu-button": () => s(v.FmButton, {
993
+ icon: "settings",
994
+ variant: "tertiary",
995
+ if: o
996
+ }),
997
+ default: () => [
998
+ s(v.FmMenuItem, {
999
+ label: "Refund",
1000
+ sublabel: "Refund this transaction",
1001
+ onClick: async (b) => {
1002
+ b.stopPropagation(), await f(n);
1003
+ }
1004
+ })
1005
+ ]
1006
+ }
1007
+ ) : s("div");
1008
+ }
1009
+ }
1010
+ ], x = P({
1011
+ searchValue: "",
1012
+ dateRange: {
1013
+ startDate: C().subtract(7, "day").toISOString(),
1014
+ endDate: C().toISOString()
1015
+ }
1016
+ }), { tableMeta: h, rowData: T, onSort: M, debouncedFetchData: F, onSearch: g } = Fe(async (e) => {
1017
+ const n = {
1018
+ ...x.value.dateRange,
1019
+ user: p.user
1020
+ };
1021
+ return await L.readStoreTransactions(e, n);
1022
+ });
1023
+ async function f(e) {
1024
+ await Ee.confirm(
1025
+ "Are you sure you want to refund this transaction?",
1026
+ "Refund Store Transaction",
1027
+ "Confirm",
1028
+ "Cancel"
1029
+ ) && await u(
1030
+ async () => {
1031
+ var o;
1032
+ await Oe.refundStoreTransaction({
1033
+ id: e._id,
1034
+ reason: `ADMIN:${(o = Me().sessionUser) == null ? void 0 : o.name}`
1035
+ }), await F();
1036
+ },
1037
+ {
1038
+ message: "Refunding transaction...",
1039
+ successMessage: "Transaction refunded successfully"
1040
+ }
1041
+ );
1042
+ }
1043
+ ce(
1044
+ x,
1045
+ () => {
1046
+ F();
1047
+ },
1048
+ { deep: !0 }
1049
+ ), Te(async () => {
1050
+ await F();
1051
+ });
1052
+ const a = async () => Ae({
1053
+ exporter: new et(),
1054
+ readFunction: (e) => L.readStoreTransactions(e, {
1055
+ ...x.value.dateRange,
1056
+ user: p.user
1057
+ }),
1058
+ transformRecord: (e) => {
1059
+ var n, o, b, y, w, R;
1060
+ return {
1061
+ TransactionId: ((n = e._id) == null ? void 0 : n.toString()) || "",
1062
+ CreatedAt: C(U(e._id.toString())).format(
1063
+ "DD/MM/YYYY HH:mm:ss"
1064
+ ),
1065
+ Bundle: e.bundle.name || "",
1066
+ Location: e.location ? e.pf_location[0].name : "Online Store",
1067
+ PaymentType: ((o = e.paymentType) == null ? void 0 : o.type) || "N/A",
1068
+ PaymentExtra: ((b = e.paymentType) == null ? void 0 : b.extra) || "",
1069
+ User: ((y = e.pf_member) == null ? void 0 : y.name) || "",
1070
+ PhoneNumber: ((w = e.pf_member) == null ? void 0 : w.phoneNumber) || "",
1071
+ Status: e.status || "",
1072
+ RefundReason: ((R = e == null ? void 0 : e.refund) == null ? void 0 : R.reason) || "",
1073
+ Ref: (e == null ? void 0 : e.ref) || ""
1074
+ };
1075
+ },
1076
+ filename: "store-transactions"
1077
+ });
1078
+ return (e, n) => {
1079
+ const o = Y("FmSearch"), b = Y("FmButton");
1080
+ return V(), B("div", null, [
1081
+ _("div", tt, [
1082
+ _("div", at, [
1083
+ I(ue, {
1084
+ modelValue: l(x).dateRange,
1085
+ "onUpdate:modelValue": n[0] || (n[0] = (y) => l(x).dateRange = y)
1086
+ }, null, 8, ["modelValue"])
1087
+ ]),
1088
+ _("div", ot, [
1089
+ I(o, {
1090
+ modelValue: l(h).searchValue,
1091
+ "onUpdate:modelValue": [
1092
+ n[1] || (n[1] = (y) => l(h).searchValue = y),
1093
+ l(g)
1094
+ ],
1095
+ placeholder: "Search",
1096
+ collapsible: ""
1097
+ }, null, 8, ["modelValue", "onUpdate:modelValue"]),
1098
+ I(b, {
1099
+ icon: "ios_share",
1100
+ variant: "tertiary",
1101
+ onClick: a
1102
+ })
1103
+ ])
1104
+ ]),
1105
+ I(de, {
1106
+ loading: l(h).isLoading,
1107
+ "row-data": l(T),
1108
+ "row-count": l(h).totalRows,
1109
+ "column-defs": m.filter(
1110
+ (y) => !p.user || y.header !== "User" && y.header !== "Phone No."
1111
+ ),
1112
+ "page-count": l(h).pageCount,
1113
+ "page-index": l(h).pageIndex,
1114
+ "page-size": l(h).pageSize,
1115
+ "shrink-at": !1,
1116
+ onSortChange: l(M),
1117
+ onPageChange: n[2] || (n[2] = (y) => l(F)({
1118
+ pageSize: y.pageSize,
1119
+ pageIndex: y.pageIndex
1120
+ }))
1121
+ }, null, 8, ["loading", "row-data", "row-count", "column-defs", "page-count", "page-index", "page-size", "onSortChange"])
1122
+ ]);
1123
+ };
1124
+ }
1125
+ });
1126
+ export {
1127
+ Mt as _,
1128
+ Ot as a
1129
+ };