@feedmepos/mf-connect 0.1.38-beta.71 → 0.1.38-beta.73

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 (103) hide show
  1. package/dist/{Analytic-BY0xqCru.js → Analytic-gGjm5ome.js} +14 -14
  2. package/dist/{App-n6-XqhU7.js → App-BDz9mw-6.js} +7 -7
  3. package/dist/{AuditLogs-Dml3WjdH.js → AuditLogs-4x90ZjjY.js} +9 -9
  4. package/dist/{Bin-DaPZyWm-.js → Bin-Bby2f42O.js} +8 -8
  5. package/dist/{Broadcast-hLmkBNne.js → Broadcast-eYN2AqFC.js} +10 -10
  6. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-BahnNhzD.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-B-fO9-Hb.js} +6 -6
  7. package/dist/{Card-C_Fm3E0s.js → Card-Cz-pLt7X.js} +17 -17
  8. package/dist/{Collections-DAUsUa0c.js → Collections-CgfXuVA1.js} +7 -7
  9. package/dist/{Credit-DklbckuQ.js → Credit-Lc6B2oQ9.js} +10 -10
  10. package/dist/{EditCampaignSheet.vue_vue_type_script_setup_true_lang-vpnaCdLI.js → EditCampaignSheet.vue_vue_type_script_setup_true_lang-Bm7XTR7o.js} +33 -33
  11. package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-e1ZWGrXS.js → EffectSheet.vue_vue_type_style_index_0_lang-Cp5nSLEX.js} +6 -6
  12. package/dist/{Experience-D3Ve8dCI.js → Experience-Ca94IJBt.js} +10 -10
  13. package/dist/{FileSaver.min-Bg15HHd0.js → FileSaver.min-BThLVsSf.js} +1 -1
  14. package/dist/{Game-BJzRdZNg.js → Game-BYLYDTU9.js} +11 -11
  15. package/dist/{GenerateMaterial-pDWgptXt.js → GenerateMaterial-CUoG6uyI.js} +6 -6
  16. package/dist/{Grab-B0D8SpcD.js → Grab-DZ_LkTly.js} +9 -9
  17. package/dist/{ImageInput.vue_vue_type_script_setup_true_lang-DkI3qMHv.js → ImageInput.vue_vue_type_script_setup_true_lang-CI4kP9ul.js} +1 -1
  18. package/dist/{Index-ysSM8-pd.js → Index-BZ2r8x0t.js} +10 -10
  19. package/dist/{LottieAnimation.vue_vue_type_script_setup_true_lang-C7bEzQ4b.js → LottieAnimation.vue_vue_type_script_setup_true_lang-BLKlXW1b.js} +1 -1
  20. package/dist/{MainLayout-Kt1Wiz87.js → MainLayout-BfGSSVMW.js} +1 -1
  21. package/dist/{Marketing-CFS6ff03.js → Marketing-DYg0J1xG.js} +4 -4
  22. package/dist/{MarketingMaterialEdit-BDYr5Rlw.js → MarketingMaterialEdit-B--Kck7j.js} +4 -4
  23. package/dist/{Member-Dgb3QBKF.js → Member-By5QEJxn.js} +11 -11
  24. package/dist/{MemberList-CfcQUvN8.js → MemberList-D49bMmGJ.js} +434 -439
  25. package/dist/{MemberTransactions-BVwGdpXo.js → MemberTransactions-Cz9XENK1.js} +1 -1
  26. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-Dj3h51yH.js → MessageInput.vue_vue_type_script_setup_true_lang-IlFjM-Y5.js} +8 -8
  27. package/dist/{Mission-B9K8-Wrt.js → Mission-Cvl-V7c8.js} +11 -11
  28. package/dist/{Overview-DJgKxAvU.js → Overview-lu82lUJp.js} +18 -18
  29. package/dist/{Point-lev1_Nit.js → Point-C65YFhOB.js} +10 -10
  30. package/dist/{Promotion-De9e8yPj.js → Promotion-DQCrKO6a.js} +11 -11
  31. package/dist/{Queue-DH_F0Ekd.js → Queue-DR5lfSMi.js} +10 -10
  32. package/dist/{Record-CH2AZqzF.js → Record-BCt42_VZ.js} +9 -9
  33. package/dist/{Reward-BUgOAjd4.js → Reward-7aOnjmMm.js} +16 -16
  34. package/dist/{RewardGroup.vue_vue_type_script_setup_true_lang-KTaTLjjw.js → RewardGroup.vue_vue_type_script_setup_true_lang-BPgjr91S.js} +11 -11
  35. package/dist/{RuleGroup.vue_vue_type_script_setup_true_lang-rs5kKp_v.js → RuleGroup.vue_vue_type_script_setup_true_lang-Bp5jnlFr.js} +14 -14
  36. package/dist/{Segment-DL6O--Aw.js → Segment-DiYwfb8M.js} +24 -24
  37. package/dist/{SelectItems.vue_vue_type_script_setup_true_lang-ZUGDMD5J.js → SelectItems.vue_vue_type_script_setup_true_lang-ydM5ypC0.js} +2 -2
  38. package/dist/{SendCollectionSheet.vue_vue_type_script_setup_true_lang-CIeyrheH.js → SendCollectionSheet.vue_vue_type_script_setup_true_lang-BRs7pw0l.js} +12 -12
  39. package/dist/{SendVoucherSheet.vue_vue_type_script_setup_true_lang-BAtXxIjO.js → SendVoucherSheet.vue_vue_type_script_setup_true_lang-DU8AAPFD.js} +4 -4
  40. package/dist/{Setting-DOA80XlJ.js → Setting-k6xShcs8.js} +13 -13
  41. package/dist/{SettingAdvertisements-Dl0eisXq.js → SettingAdvertisements-DQa_jXYM.js} +11 -11
  42. package/dist/{Store-fni1Xblz.js → Store-B6lYBpsm.js} +20 -20
  43. package/dist/{StoreRewards-CLMO-kNi.js → StoreRewards-Cqd399q8.js} +14 -14
  44. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-Wv_SHwmo.js +1128 -0
  45. package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-D-jYcuAa.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-Bi1o4YAz.js} +2 -2
  46. package/dist/{Tier-B0_DiVNv.js → Tier-CXXImaDx.js} +23 -23
  47. package/dist/{Title-twptCzpk.js → Title-CTxNCmBW.js} +20 -20
  48. package/dist/{Transaction-CTX5I6gO.js → Transaction-DonaHVzF.js} +2 -2
  49. package/dist/{UserRuleGroup.vue_vue_type_script_setup_true_lang-Bp-rIgz4.js → UserRuleGroup.vue_vue_type_script_setup_true_lang-DbRVYccO.js} +6 -6
  50. package/dist/{Voucher-C7Kxmzjr.js → Voucher-Bso_Mjlg.js} +14 -14
  51. package/dist/{VoucherEditor.vue_vue_type_script_setup_true_lang-lZQTZUUU.js → VoucherEditor.vue_vue_type_script_setup_true_lang-DNvmaJk9.js} +12 -12
  52. package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-BlBEFfgu.js → ZodTextField.vue_vue_type_script_setup_true_lang-KHZ3-THo.js} +2 -2
  53. package/dist/{app-D5GVWKxc.js → app-DKrmktFJ.js} +224 -224
  54. package/dist/app.js +1 -1
  55. package/dist/{business-BvNsRlY4.js → business-Dd73TVX5.js} +1 -1
  56. package/dist/{campaign-DRErhSfb.js → campaign-BUQHH4KL.js} +2 -2
  57. package/dist/{campaign-MN_o01w6.js → campaign-DkJOyF24.js} +8 -8
  58. package/dist/{campaign.enum-BtfwwLCf.js → campaign.enum-C8vJuDAq.js} +1 -1
  59. package/dist/{campaign.fn-BgSGxLPo.js → campaign.fn-DJSpfhZH.js} +3 -3
  60. package/dist/{collectible.enum-CV2tpD2C.js → collectible.enum-D3W0TwoJ.js} +1 -1
  61. package/dist/{collection.fn-BYjqObg7.js → collection.fn-YzgpOmG0.js} +2 -2
  62. package/dist/{dto-CyhnIGn-.js → dto-sceHHLGr.js} +4 -4
  63. package/dist/{duplicateCampaign-jOZ1UznM.js → duplicateCampaign-CDulKxgJ.js} +2 -2
  64. package/dist/{effect-NKfquhhR.js → effect-BSgfR9iB.js} +1 -1
  65. package/dist/{email-addresses-EmFJeFmB.js → email-addresses-D_fyxOof.js} +2 -2
  66. package/dist/{export-B70Bp6s8.js → export-OxiqL1B7.js} +2 -2
  67. package/dist/{helper-DiSstsUa.js → helper-CzurWUe4.js} +1 -1
  68. package/dist/{index-CHXlBh7-.js → index-BF0hGAkO.js} +1 -1
  69. package/dist/{index-bAmlAkpk.js → index-BGMhsZnB.js} +1 -1
  70. package/dist/{index-DK45XoFG.js → index-B_QGGlMD.js} +3 -3
  71. package/dist/{index-BgP5ZHK6.js → index-BbTHqh58.js} +1 -1
  72. package/dist/{index-Cr2243n7.js → index-BqQas5Sx.js} +45 -40
  73. package/dist/{index-tvZKdKVU.js → index-BtMmY44D.js} +1 -1
  74. package/dist/{index-CD7Ji4Nw.js → index-CAUVTn1I.js} +23 -12
  75. package/dist/{index-B09KKPb4.js → index-Cg-sBBf_.js} +4 -4
  76. package/dist/{index-CrDg9PFk.js → index-Cyt6eKEF.js} +3 -3
  77. package/dist/index-Dw3ew6qN.js +85 -0
  78. package/dist/{index-5FmmWAib.js → index-IBvUTxqC.js} +3 -3
  79. package/dist/{index-nTpkh7pU.js → index-pkwrUX33.js} +2 -2
  80. package/dist/{index-C46EHygk.js → index-tYmg4eyJ.js} +1 -1
  81. package/dist/{index.esm2017-B8fYlj6l.js → index.esm2017-5xGykkgL.js} +1 -1
  82. package/dist/{loading-DVr3dbZ1.js → loading-CvHPT80F.js} +2 -2
  83. package/dist/{lodash-BNr1VEn2.js → lodash-Q-_FPkpI.js} +1 -1
  84. package/dist/{membership-LEuPDIbe.js → membership-CU-wFWan.js} +3 -3
  85. package/dist/{money-CogUwiv6.js → money-CzlfhEoe.js} +1 -1
  86. package/dist/{number-C5wGUTN5.js → number-Bee2M41N.js} +1 -1
  87. package/dist/{objectid-DbUENFHd.js → objectid-DRJQv7AY.js} +6 -6
  88. package/dist/{plugins-BxKrsjEx.js → plugins-CAdlnev8.js} +3 -3
  89. package/dist/{reward-CM4Wx2zA.js → reward-BhlYd0FB.js} +1 -1
  90. package/dist/{rule-CMMr2GMg.js → rule-Ccvu41A_.js} +3 -3
  91. package/dist/{rule-builder-D5QsmOxi.js → rule-builder-B968rIyS.js} +1 -1
  92. package/dist/{template-BDKqBasy.js → template-OZfyPJVE.js} +6 -6
  93. package/dist/{timezone-DuaWQsQ2.js → timezone-CopuRbDK.js} +2 -2
  94. package/dist/{trigger-IcyZcRow.js → trigger-BtQI81FL.js} +5 -5
  95. package/dist/usePagination-Ciom38dd.js +266 -0
  96. package/dist/{user-u3blYzG2.js → user-BOW0ixDK.js} +1 -1
  97. package/dist/{vue-i18n-DfD8ZY6j.js → vue-i18n-jTYKTJq1.js} +247 -247
  98. package/dist/{xlsx-Bgf4_JHr.js → xlsx-YD3LYwip.js} +1 -1
  99. package/dist/{zod-9J33xiFS.js → zod-B_G9o5PC.js} +1 -1
  100. package/package.json +1 -1
  101. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-BlBovyiT.js +0 -1034
  102. package/dist/index-Qg_bzaF2.js +0 -76
  103. package/dist/usePagination-D8OEDsCt.js +0 -223
@@ -0,0 +1,1128 @@
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-Cg-sBBf_.js";
4
+ import "./index-IBvUTxqC.js";
5
+ import { s as Ie } from "./index-BbTHqh58.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-Bee2M41N.js";
11
+ import { u as me } from "./business-Dd73TVX5.js";
12
+ import { _ as de, u as Fe } from "./usePagination-Ciom38dd.js";
13
+ import { a as ae, c as De, p as Ee } from "./plugins-CAdlnev8.js";
14
+ import { g as pe } from "./user-BOW0ixDK.js";
15
+ import { B as fe, e as Ae } from "./export-OxiqL1B7.js";
16
+ import { u as ge } from "./campaign-BUQHH4KL.js";
17
+ import "./index-tYmg4eyJ.js";
18
+ import "./index-BqQas5Sx.js";
19
+ import "./index-Cyt6eKEF.js";
20
+ import "./index-B_QGGlMD.js";
21
+ import { u as ye } from "./vue-i18n-jTYKTJq1.js";
22
+ import { o as U } from "./objectId-dwaoBfJX.js";
23
+ import { u as he, m as Ne } from "./loading-CvHPT80F.js";
24
+ import { w as Pe } from "./xlsx-YD3LYwip.js";
25
+ import { useRouter as Me } from "vue-router";
26
+ import { t as L } from "./index-CAUVTn1I.js";
27
+ import { R as W } from "./app-DKrmktFJ.js";
28
+ import { F as Q } from "./collectible.enum-D3W0TwoJ.js";
29
+ import { useCoreStore as Oe } from "@feedmepos/mf-common";
30
+ function ke(c) {
31
+ let p = "";
32
+ switch (c) {
33
+ case "PORTAL":
34
+ p = "ADMIN";
35
+ break;
36
+ case "BENEFIT":
37
+ p = "MEMBERSHIP";
38
+ break;
39
+ case "ORDER":
40
+ p = "ORDER";
41
+ break;
42
+ case "BILL":
43
+ p = "SPENDING";
44
+ break;
45
+ case "CASHBACK":
46
+ p = "CASHBACK";
47
+ break;
48
+ case "CYCLE":
49
+ p = "EXPIRED";
50
+ break;
51
+ case "COUNTER_CONSUME":
52
+ p = "COUNTER REDEEM";
53
+ break;
54
+ default:
55
+ p = c;
56
+ break;
57
+ }
58
+ return p;
59
+ }
60
+ function Ve(c) {
61
+ var p, u, m, x, h, T;
62
+ switch ((p = c == null ? void 0 : c.pf_collectible) == null ? void 0 : p.type) {
63
+ case "VOUCHER":
64
+ return `${(u = c.pf_collectible) == null ? void 0 : u.type} (${(m = c.pf_collectible) == null ? void 0 : m.name})`;
65
+ case "TITLE":
66
+ return `${(x = c.pf_collectible) == null ? void 0 : x.type} (${(h = c.pf_collectible) == null ? void 0 : h.name})`;
67
+ case "POINT":
68
+ return "Experience";
69
+ case "COIN":
70
+ return "Point";
71
+ default:
72
+ return Ie((T = c == null ? void 0 : c.pf_collectible) == null ? void 0 : T.type);
73
+ }
74
+ }
75
+ function ze(c) {
76
+ switch (c) {
77
+ case "ONLINE":
78
+ return "Online";
79
+ case "COIN":
80
+ return "Point";
81
+ default:
82
+ return c;
83
+ }
84
+ }
85
+ const z = {
86
+ getReason: ke,
87
+ formattedType: Ve,
88
+ formattedPaymentType: ze
89
+ }, Be = (c) => {
90
+ if (c.startsWith("_") || c.includes("."))
91
+ return c;
92
+ for (const p of ["pf_user_", "pf_collectible_"])
93
+ if (c.startsWith(p))
94
+ return `${p.slice(0, -1)}.${c.slice(p.length).replace(new RegExp("_", "g"), ".")}`;
95
+ return c.replace(new RegExp("_", "g"), ".");
96
+ };
97
+ function Ue(c, p = { key: "_id", descending: !0 }) {
98
+ const u = P({
99
+ pageCount: 1,
100
+ searchValue: "",
101
+ pageIndex: 0,
102
+ totalRows: 0,
103
+ isLoading: !1,
104
+ pageSize: 10,
105
+ hasNext: !1
106
+ }), m = P(p), x = P([]), h = P([void 0]);
107
+ function T() {
108
+ h.value = [void 0], u.value.pageIndex = 0, u.value.pageCount = 1, u.value.hasNext = !1;
109
+ }
110
+ const M = async (n = {}) => {
111
+ const o = n.pageSize ?? u.value.pageSize, b = o !== u.value.pageSize;
112
+ b && T();
113
+ 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];
114
+ u.value.isLoading = !0, u.value.pageSize = o, x.value = [];
115
+ try {
116
+ const A = await c({
117
+ limit: o,
118
+ sortBy: m.value.key,
119
+ descending: m.value.descending,
120
+ search: u.value.searchValue,
121
+ ...K ? { cursor: K } : {}
122
+ });
123
+ 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);
124
+ } catch (A) {
125
+ console.error("Error fetching data:", A), u.value.hasNext = !1;
126
+ } finally {
127
+ u.value.isLoading = !1;
128
+ }
129
+ };
130
+ let F, g;
131
+ const f = (n) => (F && clearTimeout(F), g && g(), new Promise((o) => {
132
+ g = o, F = setTimeout(async () => {
133
+ F = void 0, g = void 0, await M(n), o();
134
+ }, 200);
135
+ }));
136
+ return {
137
+ tableMeta: u,
138
+ rowData: x,
139
+ sortBy: m,
140
+ pageCursors: h,
141
+ resetCursorState: T,
142
+ fetchData: M,
143
+ debouncedFetchData: f,
144
+ onSort: async (n) => {
145
+ n.length ? m.value = {
146
+ key: Be(n[0].id),
147
+ descending: n[0].desc
148
+ } : m.value = p, T(), await f({
149
+ pageIndex: 0,
150
+ pageSize: u.value.pageSize
151
+ });
152
+ },
153
+ onSearch: () => (T(), f({
154
+ pageIndex: 0,
155
+ pageSize: u.value.pageSize
156
+ }))
157
+ };
158
+ }
159
+ class Ye extends fe {
160
+ }
161
+ 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({
162
+ __name: "TransactionDetailSheet",
163
+ setup(c, { expose: p }) {
164
+ ye();
165
+ const u = P(!1), m = P(), x = ge(), h = me();
166
+ function T(f, a) {
167
+ u.value = f, m.value = a ?? null;
168
+ }
169
+ const M = j(() => {
170
+ var f, a;
171
+ return ee(
172
+ ((a = m.value) == null ? void 0 : a.expiryAmount.reduce(
173
+ (e, n) => e + n.amount,
174
+ ((f = m.value) == null ? void 0 : f.amount) ?? 0
175
+ )) ?? 0,
176
+ 2
177
+ );
178
+ }), F = j(() => {
179
+ var f, a, e, n, o;
180
+ return m.value ? [
181
+ {
182
+ label: "Transaction ID",
183
+ value: (f = m.value) == null ? void 0 : f._id
184
+ },
185
+ {
186
+ label: "Date/Time",
187
+ value: C(U(m.value._id.toString())).format(
188
+ "D MMM YYYY, hh:mmA"
189
+ )
190
+ },
191
+ {
192
+ label: "Amount",
193
+ component: () => s(
194
+ "span",
195
+ {
196
+ class: [
197
+ "pr-2",
198
+ +M.value > 0 ? "text-fm-color-system-success-300" : "text-fm-color-system-error-300"
199
+ ]
200
+ },
201
+ M.value
202
+ )
203
+ },
204
+ {
205
+ label: "Type",
206
+ value: z.formattedType(m.value)
207
+ },
208
+ {
209
+ label: "Source",
210
+ value: q(z.getReason(m.value.source))
211
+ },
212
+ {
213
+ label: "User",
214
+ value: (e = (a = m.value) == null ? void 0 : a.pf_user) == null ? void 0 : e.name
215
+ },
216
+ {
217
+ label: "Phone Number",
218
+ value: (o = (n = m.value) == null ? void 0 : n.pf_user) == null ? void 0 : o.phoneNumber
219
+ }
220
+ ] : [];
221
+ }), g = j(() => {
222
+ var n, o, b, y;
223
+ if (!m.value) return [];
224
+ const f = [], a = (n = m.value) == null ? void 0 : n.metadata, e = m.value;
225
+ if (a != null && a.campaign) {
226
+ const w = x.campaigns.all.find(
227
+ (R) => R._id === (a == null ? void 0 : a.campaign)
228
+ );
229
+ if (!w) return;
230
+ f.push({
231
+ label: "Campaign",
232
+ value: w.name
233
+ });
234
+ }
235
+ return a != null && a.remark && f.push({
236
+ label: "Remark",
237
+ value: a.remark
238
+ }), (o = m.value) != null && o.ref.startsWith("bill_") && f.push({
239
+ label: "Bill Number",
240
+ value: (b = m.value) == null ? void 0 : b.ref,
241
+ copy: () => {
242
+ var w;
243
+ return ae((w = m.value) == null ? void 0 : w.ref);
244
+ }
245
+ }), a != null && a.location && f.push({
246
+ label: "Location",
247
+ value: (y = h.locations.find(
248
+ (w) => w._id.toString() === (a == null ? void 0 : a.location)
249
+ )) == null ? void 0 : y.name
250
+ }), e.source === Z.enum.STORE && f.push({
251
+ label: "Store Transaction",
252
+ value: e.ref
253
+ }), a != null && a.originTransaction && f.push({
254
+ label: "Parent Transaction",
255
+ value: a.originTransaction
256
+ }), a != null && a.referral_count && f.push({
257
+ label: "Referral Count",
258
+ value: a.referral_count
259
+ }), e.refundedFrom && f.push({
260
+ label: "Refunded From",
261
+ value: e.refundedFrom
262
+ }), f;
263
+ });
264
+ return p({
265
+ showSheet: T
266
+ }), (f, a) => {
267
+ const e = Y("FmButton"), n = Y("FmSideSheet");
268
+ return V(), se(n, {
269
+ "max-width": 560,
270
+ modelValue: l(u),
271
+ "onUpdate:modelValue": a[1] || (a[1] = (o) => Se(u) ? u.value = o : null),
272
+ header: "Transaction Details"
273
+ }, {
274
+ "side-sheet-footer": le(() => [
275
+ _("div", je, [
276
+ I(e, {
277
+ label: "Close",
278
+ onClick: a[0] || (a[0] = (o) => T(!1)),
279
+ variant: "tertiary"
280
+ })
281
+ ])
282
+ ]),
283
+ default: le(() => [
284
+ _("div", $e, [
285
+ _("div", Le, [
286
+ (V(!0), B(J, null, ie(l(F), (o) => (V(), B("div", {
287
+ key: o.label,
288
+ class: "flex flex-col gap-4"
289
+ }, [
290
+ _("div", Ke, G(o.label), 1),
291
+ _("div", {
292
+ class: "text-fm-color-typo-secondary fm-typo-en-body-md-400 hover:underline",
293
+ onClick: o.copy
294
+ }, [
295
+ _e(G(o.accessorFn ? o.accessorFn() : o.value) + " ", 1),
296
+ (V(), se(we(o.component)))
297
+ ], 8, He),
298
+ a[2] || (a[2] = _("hr", { class: "mt-3" }, null, -1))
299
+ ]))), 128)),
300
+ (V(!0), B(J, null, ie(l(g), (o) => (V(), B("div", {
301
+ key: o.label,
302
+ class: "flex flex-col gap-4"
303
+ }, [
304
+ _("div", Ge, G(o.label), 1),
305
+ _("div", {
306
+ class: "text-fm-color-typo-secondary fm-typo-en-body-md-400 hover:underline",
307
+ onClick: o.copy
308
+ }, G(o.accessorFn ? o.accessorFn() : o.value), 9, We),
309
+ a[3] || (a[3] = _("hr", { class: "mt-3" }, null, -1))
310
+ ]))), 128))
311
+ ])
312
+ ])
313
+ ]),
314
+ _: 1
315
+ }, 8, ["modelValue"]);
316
+ };
317
+ }
318
+ }), 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" }, Pt = /* @__PURE__ */ te({
319
+ __name: "CollectionTransactions",
320
+ props: {
321
+ user: {
322
+ type: String
323
+ }
324
+ },
325
+ setup(c) {
326
+ const { t: p } = ye(), u = me(), m = ge(), x = Me(), h = c, T = P(!1), { minor: M } = he, F = [
327
+ {
328
+ header: "Transaction ID",
329
+ accessorKey: "_id",
330
+ meta: {
331
+ maxWidth: "100px"
332
+ },
333
+ cell(t) {
334
+ return s("div", { class: "flex items-center" }, [
335
+ s(v.FmIcon, {
336
+ name: "content_copy",
337
+ outline: !0,
338
+ size: "sm",
339
+ class: "cursor-pointer mr-4",
340
+ onClick: (r) => {
341
+ r.preventDefault(), r.stopPropagation(), ae(t.row.original._id.toString());
342
+ }
343
+ }),
344
+ s(
345
+ "div",
346
+ { class: "pr-2 text-ellipsis overflow-hidden" },
347
+ t.row.original._id.toString()
348
+ )
349
+ ]);
350
+ },
351
+ enableSorting: !1
352
+ },
353
+ {
354
+ header: "Created at",
355
+ accessorKey: "_id",
356
+ accessorFn: (t) => C(U(t._id.toString())),
357
+ cell: (t) => C(U(t.row.original._id.toString())).format(
358
+ "D MMM YYYY, hh:mmA"
359
+ ),
360
+ enableSorting: !0
361
+ },
362
+ {
363
+ header: "Amount",
364
+ // accessorKey: 'totalAmount',
365
+ enableSorting: !1,
366
+ cell(t) {
367
+ var d, i, D, N;
368
+ const r = ee(
369
+ t.row.original.expiryAmount.reduce(
370
+ ($, O) => $ + O.amount,
371
+ t.row.original.amount ?? 0
372
+ ),
373
+ 2
374
+ ), 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(
375
+ "D MMM YYYY"
376
+ ) : "";
377
+ return s("div", { class: "flex items-center" }, [
378
+ s(
379
+ "div",
380
+ {
381
+ class: [
382
+ "pr-2",
383
+ +r > 0 ? "text-fm-color-system-success-300" : "text-fm-color-system-error-300"
384
+ ]
385
+ },
386
+ r
387
+ ),
388
+ s("div", { class: "flex items-center" }, [
389
+ t.row.original.expiryAmount.length > 0 ? s(
390
+ v.FmTooltip,
391
+ {
392
+ content: `Expired on ${S}`
393
+ },
394
+ [
395
+ s(v.FmIcon, {
396
+ name: "info",
397
+ outline: !0,
398
+ size: "sm"
399
+ })
400
+ ]
401
+ ) : s("div")
402
+ ])
403
+ ]);
404
+ }
405
+ },
406
+ {
407
+ header: "Type",
408
+ accessorKey: "pf_collectible.type",
409
+ accessorFn: (t) => z.formattedType(t),
410
+ meta: {
411
+ maxWidth: "200px"
412
+ },
413
+ cell(t) {
414
+ const r = z.formattedType(t.row.original);
415
+ return s("div", { class: "flex items-center" }, [
416
+ s("div", { class: "truncate text-ellipsis" }, r),
417
+ r.length > 20 ? s(
418
+ v.FmTooltip,
419
+ {
420
+ content: r
421
+ },
422
+ [
423
+ s(v.FmIcon, {
424
+ name: "info",
425
+ color: "primary",
426
+ outline: !0,
427
+ size: "sm"
428
+ })
429
+ ]
430
+ ) : null
431
+ ]);
432
+ }
433
+ },
434
+ {
435
+ header: "Source",
436
+ accessorKey: "source",
437
+ cell(t) {
438
+ var r;
439
+ return s("div", { class: "flex items-center gap-4" }, [
440
+ s(
441
+ "div",
442
+ { class: "truncate text-ellipsis" },
443
+ q(z.getReason(t.row.original.source))
444
+ ),
445
+ ...(r = t.row.original.metadata) != null && r.campaign ? [
446
+ s(
447
+ v.FmTooltip,
448
+ {
449
+ get content() {
450
+ var S;
451
+ return (S = m.campaigns.all.find(
452
+ (d) => {
453
+ var i;
454
+ return d._id === ((i = t.row.original.metadata) == null ? void 0 : i.campaign);
455
+ }
456
+ )) == null ? void 0 : S.name;
457
+ }
458
+ },
459
+ [
460
+ s(v.FmIcon, {
461
+ name: "info",
462
+ color: "primary",
463
+ size: "sm",
464
+ onClick: async (S) => {
465
+ S.preventDefault(), S.stopPropagation();
466
+ const d = m.campaigns.all.find(
467
+ (i) => {
468
+ var D;
469
+ return i._id === ((D = t.row.original.metadata) == null ? void 0 : D.campaign);
470
+ }
471
+ );
472
+ if (d)
473
+ switch (d.type) {
474
+ case "VOUCHER":
475
+ case "PROMOTION":
476
+ case "BROADCAST":
477
+ await x.push({
478
+ name: W[`$connect-CAMPAIGN_${d.type}`]
479
+ });
480
+ break;
481
+ case "GAME":
482
+ case "CREDIT":
483
+ case "MISSION":
484
+ await x.push({
485
+ name: W[`$connect-PROGRAM_${d.type}`]
486
+ });
487
+ break;
488
+ case "POINT":
489
+ await x.push({
490
+ name: W["$connect-PROGRAM_EXPERIENCE"]
491
+ });
492
+ break;
493
+ case "COIN":
494
+ await x.push({
495
+ name: W["$connect-PROGRAM_POINT"]
496
+ });
497
+ break;
498
+ }
499
+ }
500
+ })
501
+ ]
502
+ )
503
+ ] : []
504
+ ]);
505
+ }
506
+ },
507
+ {
508
+ header: "User",
509
+ accessorKey: "pf_user.name",
510
+ cell(t) {
511
+ return pe(t.row.original.pf_user);
512
+ }
513
+ },
514
+ {
515
+ header: "Phone No.",
516
+ accessorKey: "pf_user.phoneNumber",
517
+ accessorFn: (t) => {
518
+ var r;
519
+ return ((r = t == null ? void 0 : t.pf_user) == null ? void 0 : r.phoneNumber) || "";
520
+ }
521
+ },
522
+ {
523
+ header: "Status",
524
+ id: "status",
525
+ enableSorting: !1,
526
+ cell(t) {
527
+ const r = !!t.row.original.refunded;
528
+ return s(v.FmChip, {
529
+ label: p(r ? "connect.transaction.refunded" : "connect.transaction.completed"),
530
+ variant: "plain",
531
+ class: r ? "text-fm-color-typo-warning bg-fm-color-system-warning-100" : "text-fm-color-typo-success bg-fm-color-system-success-100"
532
+ });
533
+ }
534
+ },
535
+ {
536
+ accessorFn: (t) => t.ref,
537
+ header: "References",
538
+ accessorKey: "ref",
539
+ cell(t) {
540
+ var r, S;
541
+ return s("div", { class: "flex items-center justify-between gap-4" }, [
542
+ s("div", { class: "flex items-center" }, [
543
+ (r = t.row.original.metadata) != null && r.remark ? s(
544
+ v.FmTooltip,
545
+ {
546
+ content: (S = t.row.original.metadata) == null ? void 0 : S.remark
547
+ },
548
+ [
549
+ s(v.FmIcon, {
550
+ name: "info",
551
+ class: "pl-2",
552
+ outline: !0,
553
+ size: "sm"
554
+ })
555
+ ]
556
+ ) : s("div")
557
+ ]),
558
+ s("div", { class: "flex-1" }, t.row.original.ref)
559
+ ]);
560
+ }
561
+ },
562
+ {
563
+ header: "Actions",
564
+ cell(t) {
565
+ const r = t.row.original;
566
+ return s(
567
+ v.FmTooltip,
568
+ {
569
+ get content() {
570
+ return "Revert Transaction";
571
+ }
572
+ },
573
+ [
574
+ s(v.FmButton, {
575
+ variant: "tertiary",
576
+ icon: "amend",
577
+ iconColor: "neutral-gray-400",
578
+ disabled: !r.isRevertable,
579
+ onClick: (S) => {
580
+ S.stopPropagation(), K(r);
581
+ }
582
+ })
583
+ ]
584
+ );
585
+ }
586
+ }
587
+ ], g = P({
588
+ search: "",
589
+ "pf_collectible.type": [],
590
+ "metadata.location": [],
591
+ dateRange: {
592
+ startDate: C().subtract(7, "day").toISOString(),
593
+ endDate: C().endOf("day").toISOString()
594
+ },
595
+ source: []
596
+ }), f = () => ({
597
+ ...g.value,
598
+ user: h.user,
599
+ dateRange: {
600
+ start: new Date(g.value.dateRange.startDate).toISOString(),
601
+ end: new Date(g.value.dateRange.endDate).toISOString()
602
+ }
603
+ }), { tableMeta: a, rowData: e, onSort: n, debouncedFetchData: o, resetCursorState: b } = Ue(async (t) => {
604
+ const r = await L.readAllCursor(
605
+ t,
606
+ f()
607
+ );
608
+ return {
609
+ resources: await Promise.all(
610
+ r.resources.map(async (d) => {
611
+ let i;
612
+ if (d.source !== Z.enum.BILL)
613
+ i = !1;
614
+ else {
615
+ const N = d.refunded || !!d.refundedFrom;
616
+ if (d.expiryAmount.reduce(
617
+ (O, k) => O + k.amount,
618
+ d.amount ?? 0
619
+ ) > 0) {
620
+ let O = [];
621
+ [
622
+ Q.enum.STAMP,
623
+ Q.enum.POINT
624
+ ].includes(d.pf_collectible.type) ? i = !1 : i = !N;
625
+ } else
626
+ switch (d.pf_collectible.type) {
627
+ case Q.enum.VOUCHER:
628
+ i = d.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 D = y.value.find((N) => N._id === d.ref);
638
+ return {
639
+ ...d,
640
+ ref: (D == null ? void 0 : D.seqNumber) || d.ref,
641
+ isRevertable: i
642
+ };
643
+ })
644
+ ),
645
+ meta: r.meta
646
+ };
647
+ }), y = P([]), w = Z.options.map((t) => ({ label: q(z.getReason(t)), value: t })), R = j(
648
+ () => u.locations.map((t) => ({ label: t.name, value: t._id }))
649
+ );
650
+ ce(
651
+ g,
652
+ () => {
653
+ b(), o({ pageIndex: 0 });
654
+ },
655
+ { deep: !0 }
656
+ );
657
+ async function K(t) {
658
+ M(
659
+ async () => {
660
+ await L.revertTransaction({
661
+ id: t._id.toString()
662
+ }), await o();
663
+ },
664
+ {
665
+ message: "Reverting transaction...",
666
+ successMessage: "Transaction reverted successfully"
667
+ }
668
+ );
669
+ }
670
+ async function A() {
671
+ try {
672
+ T.value = !0;
673
+ const t = new Ye(), r = f(), S = 1e3;
674
+ await M(
675
+ async () => {
676
+ var D, N, $, O, k, ne, re;
677
+ let d, i = !0;
678
+ for (; i; ) {
679
+ const H = await L.readAllCursor(
680
+ {
681
+ limit: S,
682
+ sortBy: "_id",
683
+ descending: !1,
684
+ ...d ? { cursor: d } : {}
685
+ },
686
+ r
687
+ );
688
+ if (!H.resources.length)
689
+ break;
690
+ for (const E of H.resources)
691
+ t.addRecord({
692
+ TransactionID: E._id,
693
+ CreatedAt: C(U(E._id.toString())).format(
694
+ "D MMM YYYY, hh:mmA"
695
+ ),
696
+ Amount: ee(
697
+ E.expiryAmount.reduce(
698
+ (xe, be) => xe + be.amount,
699
+ E.amount ?? 0
700
+ ),
701
+ 2
702
+ ),
703
+ 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") : "",
704
+ Type: z.formattedType(E),
705
+ Source: q(z.getReason(E.source)),
706
+ User: ((k = E.pf_user) == null ? void 0 : k.name) || "",
707
+ "Phone No.": ((ne = E.pf_user) == null ? void 0 : ne.phoneNumber) || "",
708
+ References: E.ref,
709
+ Remark: ((re = E.metadata) == null ? void 0 : re.remark) || ""
710
+ });
711
+ d = H.meta.nextCursor ?? void 0, i = H.meta.hasNext && !!d;
712
+ }
713
+ await Pe(
714
+ t.buildExcel(),
715
+ `transactions-${(/* @__PURE__ */ new Date()).toISOString()}.xlsx`,
716
+ {
717
+ bookType: "xlsx",
718
+ bookSST: !1,
719
+ type: "array"
720
+ }
721
+ );
722
+ },
723
+ {
724
+ message: "Exporting transactions...",
725
+ successMessage: "transactions exported successfully"
726
+ }
727
+ );
728
+ } catch (t) {
729
+ console.error(t);
730
+ } finally {
731
+ T.value = !1;
732
+ }
733
+ }
734
+ const oe = P(null);
735
+ function ve(t) {
736
+ var r;
737
+ console.log(t), (r = oe.value) == null || r.showSheet(!0, t.original);
738
+ }
739
+ return Ce(async () => {
740
+ await u.readLocations(), await m.read(), await o();
741
+ }), (t, r) => {
742
+ const S = Y("FmSearch"), d = Y("FmButton");
743
+ return V(), B(J, null, [
744
+ _("div", null, [
745
+ _("div", Xe, [
746
+ I(S, {
747
+ class: "hidden xs:!flex border-b border-fm-color-neutral-gray-100",
748
+ modelValue: l(g).search,
749
+ "onUpdate:modelValue": r[0] || (r[0] = (i) => l(g).search = i),
750
+ placeholder: "Search",
751
+ collapsible: ""
752
+ }, null, 8, ["modelValue"]),
753
+ I(d, {
754
+ icon: "ios_share",
755
+ variant: "tertiary",
756
+ onClick: A
757
+ })
758
+ ]),
759
+ _("div", Qe, [
760
+ _("div", Je, [
761
+ I(X, {
762
+ class: "cursor-pointer text-fm-color-neutral-gray-400",
763
+ "right-icon": "keyboard_arrow_down",
764
+ modelValue: l(g)["metadata.location"],
765
+ "onUpdate:modelValue": r[1] || (r[1] = (i) => l(g)["metadata.location"] = i),
766
+ icon: "storefront",
767
+ "show-item-label": !0,
768
+ items: l(R)
769
+ }, null, 8, ["modelValue", "items"]),
770
+ I(X, {
771
+ class: "cursor-pointer text-fm-color-neutral-gray-400",
772
+ "right-icon": "keyboard_arrow_down",
773
+ modelValue: l(g)["pf_collectible.type"],
774
+ "onUpdate:modelValue": r[2] || (r[2] = (i) => l(g)["pf_collectible.type"] = i),
775
+ label: "Type: ",
776
+ "show-item-label": !0,
777
+ items: [
778
+ { label: "Point", value: "COIN" },
779
+ { label: "Credit", value: "CREDIT" },
780
+ { label: "Voucher", value: "VOUCHER" },
781
+ { label: "Experience", value: "POINT" },
782
+ { label: "Tier", value: "TIER" },
783
+ { label: "Title", value: "TITLE" },
784
+ { label: "Game", value: "GAME" },
785
+ { label: "Stamp", value: "STAMP" }
786
+ ]
787
+ }, null, 8, ["modelValue"]),
788
+ I(X, {
789
+ class: "cursor-pointer text-fm-color-neutral-gray-400",
790
+ "right-icon": "keyboard_arrow_down",
791
+ modelValue: l(g).source,
792
+ "onUpdate:modelValue": r[3] || (r[3] = (i) => l(g).source = i),
793
+ label: "Source: ",
794
+ "show-item-label": !0,
795
+ items: l(w)
796
+ }, null, 8, ["modelValue", "items"]),
797
+ I(ue, {
798
+ "model-value": {
799
+ startDate: l(g).dateRange.startDate,
800
+ endDate: l(g).dateRange.endDate
801
+ },
802
+ "onUpdate:modelValue": r[4] || (r[4] = (i) => l(g).dateRange = {
803
+ startDate: l(C)(i.startDate).startOf("d").toISOString(),
804
+ endDate: l(C)(i.endDate).endOf("d").toISOString()
805
+ })
806
+ }, null, 8, ["model-value"])
807
+ ]),
808
+ I(S, {
809
+ class: "xs:hidden",
810
+ modelValue: l(g).search,
811
+ "onUpdate:modelValue": r[5] || (r[5] = (i) => l(g).search = i),
812
+ placeholder: "Search",
813
+ collapsible: ""
814
+ }, null, 8, ["modelValue"]),
815
+ _("div", Ze, [
816
+ I(d, {
817
+ icon: "ios_share",
818
+ variant: "tertiary",
819
+ onClick: A
820
+ })
821
+ ])
822
+ ]),
823
+ I(de, {
824
+ loading: l(a).isLoading,
825
+ "row-data": l(e),
826
+ "row-count": l(a).totalRows,
827
+ "column-defs": F.filter(
828
+ (i) => !h.user || i.header !== "User" && i.header !== "Phone No."
829
+ ),
830
+ "page-count": l(a).pageCount,
831
+ "page-index": l(a).pageIndex,
832
+ "page-size": l(a).pageSize,
833
+ "shrink-at": !1,
834
+ "pagination-mode": "cursor",
835
+ "has-next": l(a).hasNext,
836
+ onSortChange: l(n),
837
+ onPageChange: r[6] || (r[6] = (i) => l(o)({
838
+ pageSize: i.pageSize,
839
+ pageIndex: i.pageIndex
840
+ })),
841
+ onRowClick: ve
842
+ }, null, 8, ["loading", "row-data", "row-count", "column-defs", "page-count", "page-index", "page-size", "has-next", "onSortChange"])
843
+ ]),
844
+ I(qe, {
845
+ ref_key: "transactionDetailSheet",
846
+ ref: oe
847
+ }, null, 512)
848
+ ], 64);
849
+ };
850
+ }
851
+ });
852
+ class et extends fe {
853
+ }
854
+ const tt = { class: "flex items-center justify-between" }, at = { class: "flex gap-8 items-center" }, ot = { class: "flex gap-8 items-center xs:hidden" }, Mt = /* @__PURE__ */ te({
855
+ __name: "StoreTransactions",
856
+ props: {
857
+ user: {
858
+ type: String
859
+ }
860
+ },
861
+ setup(c) {
862
+ const p = c, { minor: u } = he;
863
+ Re();
864
+ const m = [
865
+ {
866
+ header: "Transaction ID",
867
+ meta: {
868
+ maxWidth: "150px"
869
+ },
870
+ cell(e) {
871
+ return s("div", { class: "flex items-center" }, [
872
+ s(v.FmIcon, {
873
+ name: "content_copy",
874
+ outline: !0,
875
+ size: "sm",
876
+ class: "cursor-pointer mr-4 shrink-0",
877
+ onClick: (n) => {
878
+ n.preventDefault(), n.stopPropagation(), ae(e.row.original._id.toString());
879
+ }
880
+ }),
881
+ s("div", { class: "truncate" }, e.row.original._id.toString())
882
+ ]);
883
+ }
884
+ },
885
+ {
886
+ header: "Created at",
887
+ accessorFn: (e) => C(U(e._id.toString())).format("D MMM YYYY, hh:mmA"),
888
+ enableSorting: !0
889
+ },
890
+ {
891
+ header: "Bundle",
892
+ accessorFn: (e) => e.bundle.name
893
+ },
894
+ {
895
+ header: "Location",
896
+ accessorFn: (e) => e.location ? e.pf_location[0].name : "Online Store"
897
+ },
898
+ {
899
+ header: "Payment Type",
900
+ accessorFn: (e) => {
901
+ var n;
902
+ return ((n = e.paymentType) == null ? void 0 : n.type) ?? "N/A";
903
+ },
904
+ cell(e) {
905
+ var n, o;
906
+ return s("div", { class: "flex items-center gap-4" }, [
907
+ s("div", { class: "flex items-center" }, [
908
+ ((n = e.row.original.paymentType) == null ? void 0 : n.type) == "ONLINE" && e.row.original.paymentType.extra ? s(
909
+ v.FmTooltip,
910
+ {
911
+ content: e.row.original.paymentType.extra
912
+ },
913
+ [
914
+ s(v.FmIcon, {
915
+ name: "info",
916
+ outline: !0,
917
+ size: "sm"
918
+ })
919
+ ]
920
+ ) : s("div")
921
+ ]),
922
+ s(
923
+ "div",
924
+ { class: "flex-1" },
925
+ ((o = e.row.original.paymentType) == null ? void 0 : o.type) ?? "N/A"
926
+ )
927
+ ]);
928
+ }
929
+ },
930
+ {
931
+ header: "User",
932
+ cell: (e) => pe(e.row.original.pf_member)
933
+ },
934
+ {
935
+ header: "Phone No.",
936
+ accessorFn: (e) => e.pf_member.phoneNumber
937
+ },
938
+ {
939
+ header: "Status",
940
+ // accessorFn: (u) => u.status,
941
+ cell(e) {
942
+ var b, y, w, R;
943
+ const n = e.row.original.status, o = {
944
+ COMPLETED: "text-fm-color-typo-success bg-fm-color-system-success-100",
945
+ REFUNDED: "text-fm-color-typo-warning bg-fm-color-system-warning-100"
946
+ };
947
+ return s("div", { class: "flex items-center gap-4" }, [
948
+ s(v.FmChip, {
949
+ label: De.title(n),
950
+ variant: "plain",
951
+ class: o[n] ?? ""
952
+ }),
953
+ (y = (b = e.row.original) == null ? void 0 : b.refund) != null && y.reason ? s(
954
+ v.FmTooltip,
955
+ {
956
+ content: (R = (w = e.row.original) == null ? void 0 : w.refund) == null ? void 0 : R.reason
957
+ },
958
+ [
959
+ s(v.FmIcon, {
960
+ name: "info",
961
+ color: "primary",
962
+ outline: !0,
963
+ size: "sm"
964
+ })
965
+ ]
966
+ ) : null
967
+ ]);
968
+ }
969
+ },
970
+ {
971
+ header: "Source",
972
+ accessorFn: (e) => e.source
973
+ },
974
+ {
975
+ header: "Ref",
976
+ accessorFn: (e) => e.ref
977
+ },
978
+ {
979
+ id: "action",
980
+ cell(e) {
981
+ const n = e.row.original, o = n.status === "COMPLETED" && !n.refund && n.source == "ADMIN";
982
+ return o ? s(
983
+ v.FmMenu,
984
+ {
985
+ placement: "bottom-end",
986
+ onClick: (b) => {
987
+ b.stopPropagation();
988
+ }
989
+ },
990
+ {
991
+ "menu-button": () => s(v.FmButton, {
992
+ icon: "settings",
993
+ variant: "tertiary",
994
+ if: o
995
+ }),
996
+ default: () => [
997
+ s(v.FmMenuItem, {
998
+ label: "Refund",
999
+ sublabel: "Refund this transaction",
1000
+ onClick: async (b) => {
1001
+ b.stopPropagation(), await f(n);
1002
+ }
1003
+ })
1004
+ ]
1005
+ }
1006
+ ) : s("div");
1007
+ }
1008
+ }
1009
+ ], x = P({
1010
+ searchValue: "",
1011
+ dateRange: {
1012
+ startDate: C().subtract(7, "day").toISOString(),
1013
+ endDate: C().toISOString()
1014
+ }
1015
+ }), { tableMeta: h, rowData: T, onSort: M, debouncedFetchData: F, onSearch: g } = Fe(async (e) => {
1016
+ const n = {
1017
+ ...x.value.dateRange,
1018
+ user: p.user
1019
+ };
1020
+ return await L.readStoreTransactions(e, n);
1021
+ });
1022
+ async function f(e) {
1023
+ await Ee.confirm(
1024
+ "Are you sure you want to refund this transaction?",
1025
+ "Refund Store Transaction",
1026
+ "Confirm",
1027
+ "Cancel"
1028
+ ) && await u(
1029
+ async () => {
1030
+ var o;
1031
+ await Ne.refundStoreTransaction({
1032
+ id: e._id,
1033
+ reason: `ADMIN:${(o = Oe().sessionUser) == null ? void 0 : o.name}`
1034
+ }), await F();
1035
+ },
1036
+ {
1037
+ message: "Refunding transaction...",
1038
+ successMessage: "Transaction refunded successfully"
1039
+ }
1040
+ );
1041
+ }
1042
+ ce(
1043
+ x,
1044
+ () => {
1045
+ F();
1046
+ },
1047
+ { deep: !0 }
1048
+ ), Te(async () => {
1049
+ await F();
1050
+ });
1051
+ const a = async () => Ae({
1052
+ exporter: new et(),
1053
+ readFunction: (e) => L.readStoreTransactions(e, {
1054
+ ...x.value.dateRange,
1055
+ user: p.user
1056
+ }),
1057
+ transformRecord: (e) => {
1058
+ var n, o, b, y, w, R;
1059
+ return {
1060
+ TransactionId: ((n = e._id) == null ? void 0 : n.toString()) || "",
1061
+ CreatedAt: C(U(e._id.toString())).format(
1062
+ "DD/MM/YYYY HH:mm:ss"
1063
+ ),
1064
+ Bundle: e.bundle.name || "",
1065
+ Location: e.location ? e.pf_location[0].name : "Online Store",
1066
+ PaymentType: ((o = e.paymentType) == null ? void 0 : o.type) || "N/A",
1067
+ PaymentExtra: ((b = e.paymentType) == null ? void 0 : b.extra) || "",
1068
+ User: ((y = e.pf_member) == null ? void 0 : y.name) || "",
1069
+ PhoneNumber: ((w = e.pf_member) == null ? void 0 : w.phoneNumber) || "",
1070
+ Status: e.status || "",
1071
+ RefundReason: ((R = e == null ? void 0 : e.refund) == null ? void 0 : R.reason) || "",
1072
+ Ref: (e == null ? void 0 : e.ref) || ""
1073
+ };
1074
+ },
1075
+ filename: "store-transactions"
1076
+ });
1077
+ return (e, n) => {
1078
+ const o = Y("FmSearch"), b = Y("FmButton");
1079
+ return V(), B("div", null, [
1080
+ _("div", tt, [
1081
+ _("div", at, [
1082
+ I(ue, {
1083
+ modelValue: l(x).dateRange,
1084
+ "onUpdate:modelValue": n[0] || (n[0] = (y) => l(x).dateRange = y)
1085
+ }, null, 8, ["modelValue"])
1086
+ ]),
1087
+ _("div", ot, [
1088
+ I(o, {
1089
+ modelValue: l(h).searchValue,
1090
+ "onUpdate:modelValue": [
1091
+ n[1] || (n[1] = (y) => l(h).searchValue = y),
1092
+ l(g)
1093
+ ],
1094
+ placeholder: "Search",
1095
+ collapsible: ""
1096
+ }, null, 8, ["modelValue", "onUpdate:modelValue"]),
1097
+ I(b, {
1098
+ icon: "ios_share",
1099
+ variant: "tertiary",
1100
+ onClick: a
1101
+ })
1102
+ ])
1103
+ ]),
1104
+ I(de, {
1105
+ loading: l(h).isLoading,
1106
+ "row-data": l(T),
1107
+ "row-count": l(h).totalRows,
1108
+ "column-defs": m.filter(
1109
+ (y) => !p.user || y.header !== "User" && y.header !== "Phone No."
1110
+ ),
1111
+ "page-count": l(h).pageCount,
1112
+ "page-index": l(h).pageIndex,
1113
+ "page-size": l(h).pageSize,
1114
+ "shrink-at": !1,
1115
+ onSortChange: l(M),
1116
+ onPageChange: n[2] || (n[2] = (y) => l(F)({
1117
+ pageSize: y.pageSize,
1118
+ pageIndex: y.pageIndex
1119
+ }))
1120
+ }, null, 8, ["loading", "row-data", "row-count", "column-defs", "page-count", "page-index", "page-size", "onSortChange"])
1121
+ ]);
1122
+ };
1123
+ }
1124
+ });
1125
+ export {
1126
+ Pt as _,
1127
+ Mt as a
1128
+ };