@feedmepos/mf-connect 0.0.25-prod → 0.0.26-prod

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/dist/{Analytic-mt_AuAdc.js → Analytic-BwBhJ7bl.js} +8 -8
  2. package/dist/{App-BpN5YKl3.js → App-CA0Bo7YB.js} +5 -5
  3. package/dist/{Broadcast-Cyqvqzb6.js → Broadcast-B7Vr0vR9.js} +7 -7
  4. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-CdF8di4i.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-DHe7YrHv.js} +8 -8
  5. package/dist/{Card-Bi1IodNQ.js → Card-CMtk619g.js} +58 -58
  6. package/dist/{Collections-D92KGO6k.js → Collections-CoqcbHXm.js} +5 -5
  7. package/dist/{Credit-BrdLkWJu.js → Credit-DO5d0Ia5.js} +7 -7
  8. package/dist/{EditCampaignSheet.vue_vue_type_script_setup_true_lang-Bra05loG.js → EditCampaignSheet.vue_vue_type_script_setup_true_lang-wjcSfHZH.js} +20 -20
  9. package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-BZglwVYd.js → EffectSheet.vue_vue_type_style_index_0_lang-nOplo491.js} +5 -5
  10. package/dist/{Experience-C_BWJffW.js → Experience-0UrzWEqm.js} +7 -7
  11. package/dist/{Game-mp2Y4BET.js → Game-D8Mu-QrE.js} +7 -7
  12. package/dist/{Marketing-fzP5GpBh.js → Marketing-CR39uxLG.js} +4 -4
  13. package/dist/{Member-DgYpkGLZ.js → Member-BZc2vm9K.js} +3 -3
  14. package/dist/{MemberList-BnMttFok.js → MemberList-B82Z9gw6.js} +12 -12
  15. package/dist/{MemberTransactions-B4Xi3Zx5.js → MemberTransactions-D930e4BY.js} +1 -1
  16. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-BLC79OBk.js → MessageInput.vue_vue_type_script_setup_true_lang-tJa9UGBw.js} +2 -2
  17. package/dist/{Mission-CXckOBsJ.js → Mission-BF7HKRi8.js} +7 -7
  18. package/dist/{Point-D4I0kfdL.js → Point-B0NCGElf.js} +7 -7
  19. package/dist/{Promotion-DA616J_Z.js → Promotion-BmQnf0S_.js} +8 -8
  20. package/dist/{RuleGroup.vue_vue_type_script_setup_true_lang-S1rG2NU5.js → RuleGroup.vue_vue_type_script_setup_true_lang-DLk3mfqC.js} +14 -14
  21. package/dist/{Segment-D6BYFtM-.js → Segment-e6COr7ja.js} +7 -7
  22. package/dist/{Setting-BHwDEeWd.js → Setting-AIeGOPa5.js} +7 -7
  23. package/dist/{Store-Ed5BzoLG.js → Store-BuMv-LTP.js} +11 -11
  24. package/dist/{StoreRewards-DRVHeaDt.js → StoreRewards-ZneBcoft.js} +10 -10
  25. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-oTTUzRap.js +818 -0
  26. package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-Cit_xMrA.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-BxIB_0F7.js} +1 -1
  27. package/dist/{Tier-1gSlZGTz.js → Tier-COOABCAS.js} +13 -13
  28. package/dist/{Title-U_0pMT0p.js → Title-C3SBQRLi.js} +13 -13
  29. package/dist/{Transaction-BLTXYzcK.js → Transaction-D2mzi_Jl.js} +1 -1
  30. package/dist/{Voucher-CA4vlDXm.js → Voucher-CTzZO62k.js} +10 -10
  31. package/dist/{app-BS8VGmru.js → app-BdK2GXbi.js} +24 -24
  32. package/dist/{app-CcIUASJw.js → app-DnQYkIC1.js} +1 -1
  33. package/dist/app.js +1 -1
  34. package/dist/{business-Cb7TdO2i.js → business-DOjJsL7e.js} +1 -1
  35. package/dist/{campaign-cDY7zmMZ.js → campaign-BfMIUjwj.js} +2 -2
  36. package/dist/{dto-DaNI5PJr.js → dto-CVcS74Vc.js} +125 -125
  37. package/dist/{effect-cIPNhqdn.js → effect-BoRL9Psq.js} +1 -1
  38. package/dist/{export-DpzvYx4-.js → export-BF80KJle.js} +3 -3
  39. package/dist/{helper-zcD8wSPk.js → helper-nDRCuCMN.js} +1 -1
  40. package/dist/{index-Br5rtA_c.js → index-B4sdSZlj.js} +1 -1
  41. package/dist/{index-EHWXEK5m.js → index-BLMsRNp3.js} +3 -3
  42. package/dist/{index-Dh0-S-rq.js → index-Bmre6Xyp.js} +5 -5
  43. package/dist/{index-b4pgNE_c.js → index-BoPQzRxs.js} +2 -2
  44. package/dist/{index-GA7gdWfl.js → index-BqxhzaPB.js} +1 -1
  45. package/dist/{index-DU11jl6w.js → index-C3Ue1uba.js} +3 -3
  46. package/dist/{index-CnSwEKU1.js → index-D7SjamN8.js} +1 -1
  47. package/dist/{index-BpOYW3od.js → index-DNcU_RF1.js} +1 -1
  48. package/dist/{index-BBJiSjAD.js → index-DTolyILx.js} +1 -1
  49. package/dist/{index-BOn8drxv.js → index-F2VnwXeh.js} +1 -1
  50. package/dist/{index-C4hH2Zns.js → index-KXzxwHB2.js} +5 -5
  51. package/dist/{index-B3zFgAM5.js → index-MP-346gd.js} +2 -2
  52. package/dist/{index.esm2017-DVHSqcDL.js → index.esm2017-EdeAmUeI.js} +30 -30
  53. package/dist/{loading-h7bfDCtI.js → loading-CmOFZn8N.js} +4 -4
  54. package/dist/{membership-CdjorwHD.js → membership-BVO31tOv.js} +3 -3
  55. package/dist/{money-DGAT5n_7.js → money-B5Qx7zIa.js} +1 -1
  56. package/dist/{number-Dj6ykRst.js → number-DSC_WHKN.js} +1 -1
  57. package/dist/{rule-DAaUmM-u.js → rule-B7oRK5yD.js} +2 -2
  58. package/dist/{rule-builder-DfvaFxJL.js → rule-builder-DdebV2-2.js} +1 -1
  59. package/dist/{template-CnieUz5M.js → template-C9fzQdej.js} +3 -3
  60. package/dist/{xlsx-CGSgxC-D.js → xlsx-Cv4wYDm9.js} +226 -226
  61. package/package.json +1 -1
  62. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-Bksyj7mi.js +0 -795
@@ -0,0 +1,818 @@
1
+ import { defineComponent as U, ref as k, computed as L, onMounted as j, resolveComponent as w, openBlock as F, createBlock as N, unref as r, withCtx as M, createVNode as g, normalizeClass as B, createCommentVNode as se, createElementVNode as C, toDisplayString as H, createElementBlock as q, Fragment as ie, renderList as ue, mergeModels as G, useModel as ce, watch as K, onBeforeMount as de, h as l } from "vue";
2
+ import { components as S } from "@feedmepos/ui-library";
3
+ import { d as me } from "./index-MP-346gd.js";
4
+ import { a as Q } from "./loading-CmOFZn8N.js";
5
+ import { s as pe } from "./index-Dbd4WA4r.js";
6
+ import { h as b } from "./moment-BWErdI6_.js";
7
+ import { s as $ } from "./index-CuvNtC_M.js";
8
+ import { f as W } from "./number-DSC_WHKN.js";
9
+ import { u as fe } from "./business-DOjJsL7e.js";
10
+ import { u as Z, _ as ee } from "./usePagination-JoYaROkV.js";
11
+ import { g as te } from "./user-Bm4KttFq.js";
12
+ import { B as ae, a as re } from "./export-BF80KJle.js";
13
+ import { o as Y } from "./objectId-dwaoBfJX.js";
14
+ import { g as X, a as ge, S as ye, b as be } from "./index-C3Ue1uba.js";
15
+ function he(o) {
16
+ let u = "";
17
+ switch (o) {
18
+ case "PORTAL":
19
+ u = "ADMIN";
20
+ break;
21
+ case "BENEFIT":
22
+ u = "MEMBERSHIP";
23
+ break;
24
+ case "ORDER":
25
+ u = "ORDER";
26
+ break;
27
+ case "BILL":
28
+ u = "SPENDING";
29
+ break;
30
+ case "CASHBACK":
31
+ u = "CASHBACK";
32
+ break;
33
+ case "CYCLE":
34
+ u = "EXPIRED";
35
+ break;
36
+ case "COUNTER_CONSUME":
37
+ u = "COUNTER REDEEM";
38
+ break;
39
+ default:
40
+ u = o;
41
+ break;
42
+ }
43
+ return u;
44
+ }
45
+ function ve(o) {
46
+ var u, s, f, d, n, y;
47
+ switch ((u = o == null ? void 0 : o.pf_collectible) == null ? void 0 : u.type) {
48
+ case "VOUCHER":
49
+ return `${(s = o.pf_collectible) == null ? void 0 : s.type} (${(f = o.pf_collectible) == null ? void 0 : f.name})`;
50
+ case "TITLE":
51
+ return `${(d = o.pf_collectible) == null ? void 0 : d.type} (${(n = o.pf_collectible) == null ? void 0 : n.name})`;
52
+ case "POINT":
53
+ return "Experience";
54
+ case "COIN":
55
+ return "Point";
56
+ default:
57
+ return pe((y = o == null ? void 0 : o.pf_collectible) == null ? void 0 : y.type);
58
+ }
59
+ }
60
+ function xe(o) {
61
+ switch (o) {
62
+ case "ONLINE":
63
+ return "Online";
64
+ case "COIN":
65
+ return "Point";
66
+ default:
67
+ return o;
68
+ }
69
+ }
70
+ const T = {
71
+ getReason: he,
72
+ formattedType: ve,
73
+ formattedPaymentType: xe
74
+ }, _e = { class: "fm-typo-en-body-md-600 select-none text-ellipsis overflow-hidden whitespace-nowrap" }, z = /* @__PURE__ */ U({
75
+ __name: "FilterChip",
76
+ props: {
77
+ modelValue: {
78
+ type: Array,
79
+ required: !1
80
+ },
81
+ label: {
82
+ type: String,
83
+ required: !1,
84
+ default: ""
85
+ },
86
+ showItemLabel: {
87
+ type: Boolean,
88
+ default: !1
89
+ },
90
+ placement: {
91
+ type: String,
92
+ required: !1,
93
+ default: "bottom-end"
94
+ },
95
+ class: {
96
+ type: String,
97
+ required: !1
98
+ },
99
+ disabled: {
100
+ type: Boolean,
101
+ required: !1
102
+ },
103
+ items: {
104
+ type: Array,
105
+ required: !0
106
+ },
107
+ icon: {
108
+ type: String,
109
+ required: !1
110
+ }
111
+ },
112
+ emits: ["update:model-value"],
113
+ setup(o, { emit: u }) {
114
+ const s = o, f = u, d = k(!1), n = k({}), y = L(() => {
115
+ if (!n.value || Object.keys(n.value).length == s.items.length)
116
+ return "All";
117
+ {
118
+ const m = Object.keys(n.value).length;
119
+ return `${m > 0 ? m : "None"} selected`;
120
+ }
121
+ });
122
+ function D(m) {
123
+ n.value[m] ? delete n.value[m] : n.value[m] = !0, f("update:model-value", Object.keys(n.value));
124
+ }
125
+ function I() {
126
+ Object.keys(n.value).length > 0 ? n.value = {} : n.value = s.items.reduce((m, e) => (m[e.value] = !0, m), {}), f("update:model-value", Object.keys(n.value));
127
+ }
128
+ return j(() => {
129
+ n.value = s.modelValue.reduce(
130
+ (m, e) => (m[e] = !0, m),
131
+ {}
132
+ ), s.modelValue.length == 0;
133
+ }), (m, e) => {
134
+ const i = w("FmIcon"), h = w("FmChip"), x = w("FmMenuItem"), p = w("FmMenu");
135
+ return F(), N(p, {
136
+ placement: o.placement || "bottom-end",
137
+ disabled: o.disabled == !0,
138
+ "model-value": r(d),
139
+ onMenuChanged: e[0] || (e[0] = (t) => d.value = t),
140
+ "close-on-click": !1
141
+ }, {
142
+ "menu-button": M(() => [
143
+ g(h, {
144
+ label: o.label,
145
+ class: B(s.class || "text-fm-color-neutral-gray-400 cursor-pointer")
146
+ }, {
147
+ default: M(() => [
148
+ s.icon ? (F(), N(i, {
149
+ key: 0,
150
+ name: s.icon,
151
+ class: B(s.class),
152
+ outline: "",
153
+ size: "sm"
154
+ }, null, 8, ["name", "class"])) : se("", !0),
155
+ C("div", _e, H(s.label) + " " + H(o.showItemLabel ? r(y) : ""), 1),
156
+ g(i, {
157
+ name: r(d) ? "keyboard_arrow_up" : "keyboard_arrow_down",
158
+ class: B(s.class),
159
+ outline: "",
160
+ size: "sm"
161
+ }, null, 8, ["name", "class"])
162
+ ]),
163
+ _: 1
164
+ }, 8, ["label", "class"])
165
+ ]),
166
+ default: M(() => [
167
+ g(x, {
168
+ "model-value": Object.keys(r(n)).length === s.items.length,
169
+ label: "All",
170
+ "has-checkbox": !0,
171
+ indeterminate: !0,
172
+ onClick: I
173
+ }, null, 8, ["model-value"]),
174
+ (F(!0), q(ie, null, ue(s.items ?? [], (t) => (F(), N(x, {
175
+ key: t.value,
176
+ value: t.value,
177
+ label: t.label,
178
+ "has-checkbox": !0,
179
+ "model-value": r(n)[t.value],
180
+ "onUpdate:modelValue": (a) => D(t.value)
181
+ }, null, 8, ["value", "label", "model-value", "onUpdate:modelValue"]))), 128))
182
+ ]),
183
+ _: 1
184
+ }, 8, ["placement", "disabled", "model-value"]);
185
+ };
186
+ }
187
+ }), E = "YYYY-MM-DD", ne = /* @__PURE__ */ U({
188
+ __name: "DateRangeChip",
189
+ props: /* @__PURE__ */ G({
190
+ modelValue: {
191
+ type: Object,
192
+ required: !0
193
+ }
194
+ }, {
195
+ dateRange: {
196
+ type: Object,
197
+ default: () => ({
198
+ startDate: b().subtract(7, "day").format(E),
199
+ endDate: b().endOf("day").format(E)
200
+ })
201
+ },
202
+ dateRangeModifiers: {}
203
+ }),
204
+ emits: /* @__PURE__ */ G(["update:model-value"], ["update:dateRange"]),
205
+ setup(o, { emit: u }) {
206
+ const s = o, f = u, d = ce(o, "dateRange"), n = L(() => d.value ? `${y.value.startDate ?? "Start"} - ${y.value.endDate ?? "End"}` : "No dates selected."), y = L(() => ({
207
+ startDate: d.value.startDate ? b(d.value.startDate).format(E) : void 0,
208
+ endDate: d.value.endDate ? b(d.value.endDate).format(E) : void 0
209
+ }));
210
+ return j(() => {
211
+ d.value = s.modelValue;
212
+ }), K(
213
+ () => d.value,
214
+ () => {
215
+ f("update:model-value", y.value);
216
+ }
217
+ ), (D, I) => {
218
+ const m = w("FmChip"), e = w("FmDateRangePicker");
219
+ return F(), N(e, {
220
+ modelValue: d.value,
221
+ "onUpdate:modelValue": I[0] || (I[0] = (i) => d.value = i),
222
+ "show-predefined-range": ""
223
+ }, {
224
+ "trigger-button": M(() => [
225
+ g(m, {
226
+ label: r(n),
227
+ icon: "calendar_month",
228
+ "right-icon": "keyboard_arrow_down",
229
+ class: "text-fm-color-neutral-gray-400 cursor-pointer"
230
+ }, null, 8, ["label"])
231
+ ]),
232
+ _: 1
233
+ }, 8, ["modelValue"]);
234
+ };
235
+ }
236
+ });
237
+ class Se extends ae {
238
+ }
239
+ const J = () => {
240
+ const o = ye.getBusinessId();
241
+ if (!o) throw new Error("Invalid business ID");
242
+ return be(`businesses/${o}/transactions`, {
243
+ noIdRequired: !0
244
+ });
245
+ }, P = {
246
+ async readAll(o, u) {
247
+ const s = X(
248
+ await J().get("", {
249
+ params: { ...o, ...u }
250
+ })
251
+ );
252
+ return {
253
+ meta: s.meta,
254
+ resources: s.resources
255
+ };
256
+ },
257
+ async readStoreTransactions(o, u) {
258
+ const s = X(
259
+ await J().get("/store", {
260
+ params: { ...o, ...u }
261
+ })
262
+ );
263
+ return {
264
+ meta: s.meta,
265
+ resources: s.resources
266
+ };
267
+ },
268
+ async readBills(o, u, s) {
269
+ return (await ge("").get(`/restaurants/${o}/receipt?start=${u}&end=${s}`)).data;
270
+ }
271
+ }, we = { class: "hidden xs:flex items-center justify-end" }, De = { class: "flex items-center justify-between" }, Ie = { class: "flex gap-8 items-center w-full overflow-x-scroll" }, Ce = { class: "xs:hidden" }, qe = /* @__PURE__ */ U({
272
+ __name: "CollectionTransactions",
273
+ props: {
274
+ user: {
275
+ type: String
276
+ }
277
+ },
278
+ setup(o) {
279
+ const u = fe(), s = o, f = k(!1), d = [
280
+ {
281
+ header: "Transaction ID",
282
+ accessorKey: "_id",
283
+ meta: {
284
+ maxWidth: "100px"
285
+ },
286
+ cell(t) {
287
+ return l("div", { class: "flex items-center" }, [
288
+ l(S.FmIcon, {
289
+ name: "content_copy",
290
+ outline: !0,
291
+ size: "sm",
292
+ class: "cursor-pointer mr-4",
293
+ onClick: (a) => {
294
+ a.preventDefault(), a.stopPropagation(), Q(t.row.original._id.toString());
295
+ }
296
+ }),
297
+ l(
298
+ "div",
299
+ { class: "pr-2 text-ellipsis overflow-hidden" },
300
+ t.row.original._id.toString()
301
+ )
302
+ ]);
303
+ },
304
+ enableSorting: !1
305
+ },
306
+ {
307
+ header: "Created at",
308
+ accessorKey: "_id",
309
+ accessorFn: (t) => b(Y(t._id.toString())).format("D MMM YYYY, hh:mmA"),
310
+ enableSorting: !0
311
+ },
312
+ {
313
+ header: "Amount",
314
+ // accessorKey: 'totalAmount',
315
+ enableSorting: !1,
316
+ cell(t) {
317
+ var _, c, R, V;
318
+ const a = W(
319
+ t.row.original.expiryAmount.reduce(
320
+ (O, A) => O + A.amount,
321
+ t.row.original.amount ?? 0
322
+ ),
323
+ 2
324
+ ), v = (c = (_ = t.row.original.expiryAmount) == null ? void 0 : _[0]) != null && c.expiredAt ? b((V = (R = t.row.original.expiryAmount) == null ? void 0 : R[0]) == null ? void 0 : V.expiredAt).format(
325
+ "D MMM YYYY"
326
+ ) : "";
327
+ return l("div", { class: "flex items-center" }, [
328
+ l(
329
+ "div",
330
+ {
331
+ class: [
332
+ "pr-2",
333
+ +a > 0 ? "text-fm-color-system-success-300" : "text-fm-color-system-error-300"
334
+ ]
335
+ },
336
+ a
337
+ ),
338
+ l("div", { class: "flex items-center" }, [
339
+ t.row.original.expiryAmount.length > 0 ? l(
340
+ S.FmTooltip,
341
+ {
342
+ content: `Expired on ${v}`
343
+ },
344
+ [
345
+ l(S.FmIcon, {
346
+ name: "info",
347
+ outline: !0,
348
+ size: "sm"
349
+ })
350
+ ]
351
+ ) : l("div")
352
+ ])
353
+ ]);
354
+ }
355
+ },
356
+ {
357
+ header: "Type",
358
+ accessorKey: "pf_collectible.type",
359
+ accessorFn: (t) => T.formattedType(t),
360
+ meta: {
361
+ maxWidth: "200px"
362
+ },
363
+ cell(t) {
364
+ const a = T.formattedType(t.row.original);
365
+ return l("div", { class: "flex items-center" }, [
366
+ l("div", { class: "truncate text-ellipsis" }, a),
367
+ a.length > 20 ? l(
368
+ S.FmTooltip,
369
+ {
370
+ content: a
371
+ },
372
+ [
373
+ l(S.FmIcon, {
374
+ name: "info",
375
+ outline: !0,
376
+ size: "sm"
377
+ })
378
+ ]
379
+ ) : null
380
+ ]);
381
+ }
382
+ },
383
+ {
384
+ header: "Source",
385
+ accessorKey: "source",
386
+ accessorFn: (t) => $(T.getReason(t.source))
387
+ },
388
+ {
389
+ header: "User",
390
+ accessorKey: "pf_user.name",
391
+ cell(t) {
392
+ return te(t.row.original.pf_user);
393
+ }
394
+ },
395
+ {
396
+ header: "Phone No.",
397
+ accessorKey: "pf_user.phoneNumber",
398
+ accessorFn: (t) => {
399
+ var a;
400
+ return ((a = t == null ? void 0 : t.pf_user) == null ? void 0 : a.phoneNumber) || "";
401
+ }
402
+ },
403
+ {
404
+ accessorFn: (t) => t.ref,
405
+ header: "References",
406
+ accessorKey: "ref",
407
+ cell(t) {
408
+ var a, v;
409
+ return l("div", { class: "flex items-center justify-between gap-4" }, [
410
+ l("div", { class: "flex items-center" }, [
411
+ (a = t.row.original.metadata) != null && a.remark ? l(
412
+ S.FmTooltip,
413
+ {
414
+ content: (v = t.row.original.metadata) == null ? void 0 : v.remark
415
+ },
416
+ [
417
+ l(S.FmIcon, {
418
+ name: "info",
419
+ outline: !0,
420
+ size: "sm"
421
+ })
422
+ ]
423
+ ) : l("div")
424
+ ]),
425
+ l("div", { class: "flex-1" }, t.row.original.ref)
426
+ ]);
427
+ }
428
+ }
429
+ ], n = k({
430
+ search: "",
431
+ "pf_collectible.type": [],
432
+ "metadata.location": [],
433
+ dateRange: {
434
+ startDate: b().subtract(7, "day").toISOString(),
435
+ endDate: b().endOf("day").toISOString()
436
+ },
437
+ source: []
438
+ }), { tableMeta: y, rowData: D, onSort: I, debouncedFetchData: m, onSearch: e } = Z(async (t) => {
439
+ const a = {
440
+ ...n.value,
441
+ user: s.user,
442
+ dateRange: {
443
+ start: new Date(n.value.dateRange.startDate).toISOString(),
444
+ end: new Date(n.value.dateRange.endDate).toISOString()
445
+ }
446
+ }, v = await P.readAll(t, a);
447
+ return {
448
+ resources: v.resources.map((_) => {
449
+ const c = i.value.find((R) => R._id === _.ref);
450
+ return { ..._, ref: (c == null ? void 0 : c.seqNumber) || _.ref };
451
+ }),
452
+ meta: v.meta
453
+ };
454
+ }), i = k([]), h = me.options.map((t) => ({ label: $(T.getReason(t)), value: t })), x = u.locations.map((t) => ({ label: t.name, value: t._id }));
455
+ K(
456
+ n,
457
+ () => {
458
+ m();
459
+ },
460
+ { deep: !0 }
461
+ );
462
+ async function p() {
463
+ try {
464
+ f.value = !0;
465
+ const t = {
466
+ ...n.value,
467
+ user: s.user,
468
+ dateRange: {
469
+ start: new Date(n.value.dateRange.startDate).toISOString(),
470
+ end: new Date(n.value.dateRange.endDate).toISOString()
471
+ }
472
+ };
473
+ await re({
474
+ exporter: new Se(),
475
+ readFunction: (a) => P.readAll(a, t),
476
+ transformRecord: (a) => {
477
+ var v, _, c, R, V, O, A;
478
+ return {
479
+ TransactionID: a._id,
480
+ CreatedAt: b(Y(a._id.toString())).format(
481
+ "D MMM YYYY, hh:mmA"
482
+ ),
483
+ Amount: W(
484
+ a.expiryAmount.reduce(
485
+ (oe, le) => oe + le.amount,
486
+ a.amount ?? 0
487
+ ),
488
+ 2
489
+ ),
490
+ ExpiredAt: (_ = (v = a.expiryAmount) == null ? void 0 : v[0]) != null && _.expiredAt ? b((R = (c = a.expiryAmount) == null ? void 0 : c[0]) == null ? void 0 : R.expiredAt).format("D MMM YYYY") : "",
491
+ Type: T.formattedType(a),
492
+ Source: $(T.getReason(a.source)),
493
+ User: ((V = a.pf_user) == null ? void 0 : V.name) || "",
494
+ "Phone No.": ((O = a.pf_user) == null ? void 0 : O.phoneNumber) || "",
495
+ References: a.ref,
496
+ Remark: ((A = a.metadata) == null ? void 0 : A.remark) || ""
497
+ };
498
+ },
499
+ filename: "transactions"
500
+ });
501
+ } catch (t) {
502
+ console.error(t);
503
+ } finally {
504
+ f.value = !1;
505
+ }
506
+ }
507
+ return de(async () => {
508
+ await u.readLocations(), await m();
509
+ }), (t, a) => {
510
+ const v = w("FmSearch"), _ = w("FmButton");
511
+ return F(), q("div", null, [
512
+ C("div", we, [
513
+ g(v, {
514
+ class: "hidden xs:flex border-b border-fm-color-neutral-gray-100",
515
+ modelValue: r(n).search,
516
+ "onUpdate:modelValue": a[0] || (a[0] = (c) => r(n).search = c),
517
+ placeholder: "Search",
518
+ collapsible: ""
519
+ }, null, 8, ["modelValue"]),
520
+ g(_, {
521
+ icon: "ios_share",
522
+ variant: "tertiary",
523
+ onClick: p
524
+ })
525
+ ]),
526
+ C("div", De, [
527
+ C("div", Ie, [
528
+ g(z, {
529
+ class: "cursor-pointer text-fm-color-neutral-gray-400",
530
+ "right-icon": "keyboard_arrow_down",
531
+ modelValue: r(n)["metadata.location"],
532
+ "onUpdate:modelValue": a[1] || (a[1] = (c) => r(n)["metadata.location"] = c),
533
+ icon: "storefront",
534
+ "show-item-label": !0,
535
+ items: r(x)
536
+ }, null, 8, ["modelValue", "items"]),
537
+ g(z, {
538
+ class: "cursor-pointer text-fm-color-neutral-gray-400",
539
+ "right-icon": "keyboard_arrow_down",
540
+ modelValue: r(n)["pf_collectible.type"],
541
+ "onUpdate:modelValue": a[2] || (a[2] = (c) => r(n)["pf_collectible.type"] = c),
542
+ label: "Type: ",
543
+ "show-item-label": !0,
544
+ items: [
545
+ { label: "Point", value: "COIN" },
546
+ { label: "Credit", value: "CREDIT" },
547
+ { label: "Voucher", value: "VOUCHER" },
548
+ { label: "Experience", value: "POINT" },
549
+ { label: "Tier", value: "TIER" },
550
+ { label: "Title", value: "TITLE" },
551
+ { label: "Game", value: "GAME" },
552
+ { label: "Stamp", value: "STAMP" }
553
+ ]
554
+ }, null, 8, ["modelValue"]),
555
+ g(z, {
556
+ class: "cursor-pointer text-fm-color-neutral-gray-400",
557
+ "right-icon": "keyboard_arrow_down",
558
+ modelValue: r(n).source,
559
+ "onUpdate:modelValue": a[3] || (a[3] = (c) => r(n).source = c),
560
+ label: "Source: ",
561
+ "show-item-label": !0,
562
+ items: r(h)
563
+ }, null, 8, ["modelValue", "items"]),
564
+ g(ne, {
565
+ "model-value": {
566
+ startDate: r(n).dateRange.startDate,
567
+ endDate: r(n).dateRange.endDate
568
+ },
569
+ "onUpdate:modelValue": a[4] || (a[4] = (c) => r(n).dateRange = {
570
+ startDate: r(b)(c.startDate).startOf("d").toISOString(),
571
+ endDate: r(b)(c.endDate).endOf("d").toISOString()
572
+ })
573
+ }, null, 8, ["model-value"])
574
+ ]),
575
+ g(v, {
576
+ class: "xs:hidden",
577
+ modelValue: r(n).search,
578
+ "onUpdate:modelValue": a[5] || (a[5] = (c) => r(n).search = c),
579
+ placeholder: "Search",
580
+ collapsible: ""
581
+ }, null, 8, ["modelValue"]),
582
+ C("div", Ce, [
583
+ g(_, {
584
+ icon: "ios_share",
585
+ variant: "tertiary",
586
+ onClick: p
587
+ })
588
+ ])
589
+ ]),
590
+ g(ee, {
591
+ loading: r(y).isLoading,
592
+ "row-data": r(D),
593
+ "row-count": r(y).totalRows,
594
+ "column-defs": d.filter(
595
+ (c) => !s.user || c.header !== "User" && c.header !== "Phone No."
596
+ ),
597
+ "page-count": r(y).pageCount,
598
+ "page-index": r(y).pageIndex,
599
+ "page-size": r(y).pageSize,
600
+ "shrink-at": !1,
601
+ onSortChange: r(I),
602
+ onPageChange: a[6] || (a[6] = (c) => r(m)({
603
+ pageSize: c.pageSize,
604
+ pageIndex: c.pageIndex
605
+ }))
606
+ }, null, 8, ["loading", "row-data", "row-count", "column-defs", "page-count", "page-index", "page-size", "onSortChange"])
607
+ ]);
608
+ };
609
+ }
610
+ });
611
+ class Re extends ae {
612
+ }
613
+ const Fe = { class: "flex items-center justify-between" }, Te = { class: "flex gap-8 items-center" }, ke = { class: "flex gap-8 items-center xs:hidden" }, Ke = /* @__PURE__ */ U({
614
+ __name: "StoreTransactions",
615
+ props: {
616
+ user: {
617
+ type: String
618
+ }
619
+ },
620
+ setup(o) {
621
+ const u = o, s = [
622
+ {
623
+ header: "Transaction ID",
624
+ meta: {
625
+ maxWidth: "150px"
626
+ },
627
+ cell(e) {
628
+ return l("div", { class: "flex items-center" }, [
629
+ l(S.FmIcon, {
630
+ name: "content_copy",
631
+ outline: !0,
632
+ size: "sm",
633
+ class: "cursor-pointer mr-4 shrink-0",
634
+ onClick: (i) => {
635
+ i.preventDefault(), i.stopPropagation(), Q(e.row.original._id.toString());
636
+ }
637
+ }),
638
+ l("div", { class: "truncate" }, e.row.original._id.toString())
639
+ ]);
640
+ }
641
+ },
642
+ {
643
+ header: "Created at",
644
+ accessorFn: (e) => b(Y(e._id.toString())).format("D MMM YYYY, hh:mmA"),
645
+ enableSorting: !0
646
+ },
647
+ {
648
+ header: "Bundle",
649
+ accessorFn: (e) => e.bundle.name
650
+ },
651
+ {
652
+ header: "Location",
653
+ accessorFn: (e) => e.location ? e.pf_location.name : "Online Store"
654
+ },
655
+ {
656
+ header: "Payment Type",
657
+ accessorFn: (e) => {
658
+ var i;
659
+ return ((i = e.paymentType) == null ? void 0 : i.type) ?? "N/A";
660
+ },
661
+ cell(e) {
662
+ var i, h;
663
+ return l("div", { class: "flex items-center gap-4" }, [
664
+ l("div", { class: "flex items-center" }, [
665
+ ((i = e.row.original.paymentType) == null ? void 0 : i.type) == "ONLINE" && e.row.original.paymentType.extra ? l(
666
+ S.FmTooltip,
667
+ {
668
+ content: e.row.original.paymentType.extra
669
+ },
670
+ [
671
+ l(S.FmIcon, {
672
+ name: "info",
673
+ outline: !0,
674
+ size: "sm"
675
+ })
676
+ ]
677
+ ) : l("div")
678
+ ]),
679
+ l(
680
+ "div",
681
+ { class: "flex-1" },
682
+ ((h = e.row.original.paymentType) == null ? void 0 : h.type) ?? "N/A"
683
+ )
684
+ ]);
685
+ }
686
+ },
687
+ {
688
+ header: "User",
689
+ cell: (e) => te(e.row.original.pf_member)
690
+ },
691
+ {
692
+ header: "Phone No.",
693
+ accessorFn: (e) => e.pf_member.phoneNumber
694
+ },
695
+ {
696
+ header: "Status",
697
+ // accessorFn: (u) => u.status,
698
+ cell(e) {
699
+ var i, h, x, p;
700
+ return l("div", { class: "flex items-center" }, [
701
+ l("div", e.row.original.status),
702
+ l("div", { class: "flex items-center" }, [
703
+ (h = (i = e.row.original) == null ? void 0 : i.refund) != null && h.reason ? l(
704
+ S.FmTooltip,
705
+ {
706
+ content: (p = (x = e.row.original) == null ? void 0 : x.refund) == null ? void 0 : p.reason
707
+ },
708
+ [
709
+ l(S.FmIcon, {
710
+ name: "info",
711
+ outline: !0,
712
+ size: "sm"
713
+ })
714
+ ]
715
+ ) : l("div")
716
+ ])
717
+ ]);
718
+ }
719
+ }
720
+ ], f = k({
721
+ searchValue: "",
722
+ dateRange: {
723
+ startDate: b().subtract(7, "day").toISOString(),
724
+ endDate: b().toISOString()
725
+ }
726
+ }), { tableMeta: d, rowData: n, onSort: y, debouncedFetchData: D, onSearch: I } = Z(async (e) => {
727
+ const i = {
728
+ ...f.value.dateRange,
729
+ user: u.user
730
+ };
731
+ return await P.readStoreTransactions(e, i);
732
+ });
733
+ K(
734
+ f,
735
+ () => {
736
+ D();
737
+ },
738
+ { deep: !0 }
739
+ ), j(async () => {
740
+ await D();
741
+ });
742
+ const m = async () => re({
743
+ exporter: new Re(),
744
+ readFunction: (e) => P.readStoreTransactions(e, {
745
+ ...f.value.dateRange,
746
+ user: u.user
747
+ }),
748
+ transformRecord: (e) => {
749
+ var i, h, x, p, t, a;
750
+ return {
751
+ TransactionId: ((i = e._id) == null ? void 0 : i.toString()) || "",
752
+ CreatedAt: b(Y(e._id.toString())).format(
753
+ "DD/MM/YYYY HH:mm:ss"
754
+ ),
755
+ Bundle: e.bundle.name || "",
756
+ Location: e.location ? e.pf_location.name : "Online Store",
757
+ PaymentType: ((h = e.paymentType) == null ? void 0 : h.type) || "N/A",
758
+ PaymentExtra: ((x = e.paymentType) == null ? void 0 : x.extra) || "",
759
+ User: ((p = e.pf_member) == null ? void 0 : p.name) || "",
760
+ PhoneNumber: ((t = e.pf_member) == null ? void 0 : t.phoneNumber) || "",
761
+ Status: e.status || "",
762
+ RefundReason: ((a = e == null ? void 0 : e.refund) == null ? void 0 : a.reason) || ""
763
+ };
764
+ },
765
+ filename: "store-transactions"
766
+ });
767
+ return (e, i) => {
768
+ const h = w("FmSearch"), x = w("FmButton");
769
+ return F(), q("div", null, [
770
+ C("div", Fe, [
771
+ C("div", Te, [
772
+ g(ne, {
773
+ modelValue: r(f).dateRange,
774
+ "onUpdate:modelValue": i[0] || (i[0] = (p) => r(f).dateRange = p)
775
+ }, null, 8, ["modelValue"])
776
+ ]),
777
+ C("div", ke, [
778
+ g(h, {
779
+ modelValue: r(d).searchValue,
780
+ "onUpdate:modelValue": [
781
+ i[1] || (i[1] = (p) => r(d).searchValue = p),
782
+ r(I)
783
+ ],
784
+ placeholder: "Search",
785
+ collapsible: ""
786
+ }, null, 8, ["modelValue", "onUpdate:modelValue"]),
787
+ g(x, {
788
+ icon: "ios_share",
789
+ variant: "tertiary",
790
+ onClick: m
791
+ })
792
+ ])
793
+ ]),
794
+ g(ee, {
795
+ loading: r(d).isLoading,
796
+ "row-data": r(n),
797
+ "row-count": r(d).totalRows,
798
+ "column-defs": s.filter(
799
+ (p) => !u.user || p.header !== "User" && p.header !== "Phone No."
800
+ ),
801
+ "page-count": r(d).pageCount,
802
+ "page-index": r(d).pageIndex,
803
+ "page-size": r(d).pageSize,
804
+ "shrink-at": !1,
805
+ onSortChange: r(y),
806
+ onPageChange: i[2] || (i[2] = (p) => r(D)({
807
+ pageSize: p.pageSize,
808
+ pageIndex: p.pageIndex
809
+ }))
810
+ }, null, 8, ["loading", "row-data", "row-count", "column-defs", "page-count", "page-index", "page-size", "onSortChange"])
811
+ ]);
812
+ };
813
+ }
814
+ });
815
+ export {
816
+ qe as _,
817
+ Ke as a
818
+ };