@feedmepos/mf-connect 0.0.28-prod → 0.0.30-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 (64) hide show
  1. package/dist/{Analytic-zePfeaJ8.js → Analytic-CMw4c42B.js} +8 -8
  2. package/dist/{App-DoJIzLZX.js → App-DgQEvhoW.js} +41 -41
  3. package/dist/{Broadcast-CjKEjend.js → Broadcast-DZ0QPkD7.js} +7 -7
  4. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-CLfPnwwA.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-DjbB5yP1.js} +8 -8
  5. package/dist/{Card-CAa06jQK.js → Card-DLS4WEBw.js} +36 -36
  6. package/dist/{Collections-1Sn-K2RI.js → Collections-CtAWEIcO.js} +137 -138
  7. package/dist/{Credit-DmEBNtvC.js → Credit-D7pQXqEt.js} +7 -7
  8. package/dist/{EditCampaignSheet.vue_vue_type_script_setup_true_lang-C36lFGES.js → EditCampaignSheet.vue_vue_type_script_setup_true_lang-BXz2IKaK.js} +21 -21
  9. package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-DA2cZ139.js → EffectSheet.vue_vue_type_style_index_0_lang-Cw-KLvgf.js} +5 -5
  10. package/dist/{Experience-Dn8qQUIo.js → Experience-_UabVSY7.js} +7 -7
  11. package/dist/{Game-QnvPORdU.js → Game-CHMBITlG.js} +7 -7
  12. package/dist/{Marketing-4QXTJvLt.js → Marketing-BHv9eyo6.js} +4 -4
  13. package/dist/{Member-tk4Jxb-q.js → Member-BkqNzcG3.js} +3 -3
  14. package/dist/{MemberList-B898N6zA.js → MemberList-FfxRRSLP.js} +76 -76
  15. package/dist/{MemberTransactions-BbdsbQqh.js → MemberTransactions-DvCtHUkt.js} +1 -1
  16. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-Ct7Vc_Ik.js → MessageInput.vue_vue_type_script_setup_true_lang-MaCtf4Xn.js} +2 -2
  17. package/dist/{Mission-DiOdia3J.js → Mission-OrOKxoPz.js} +7 -7
  18. package/dist/{Point-DyvajcmR.js → Point-CTKv_6wI.js} +7 -7
  19. package/dist/{Promotion-BQ-1dZaK.js → Promotion-D3pQZxX7.js} +8 -8
  20. package/dist/{RuleGroup.vue_vue_type_script_setup_true_lang-Dx9-QqeK.js → RuleGroup.vue_vue_type_script_setup_true_lang-CE9TmOhA.js} +94 -92
  21. package/dist/Segment-DSX0DD-P.js +434 -0
  22. package/dist/{Setting-BgJYDQ2u.js → Setting-CzxXS6LJ.js} +7 -7
  23. package/dist/{Store-Clv8qG7p.js → Store-BfiGvIid.js} +11 -11
  24. package/dist/{StoreRewards-IZjC2nTN.js → StoreRewards-Bm39d1Cc.js} +10 -10
  25. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-CHVFEK2H.js +890 -0
  26. package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-aiclx2-7.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-DdtJ3kNK.js} +1 -1
  27. package/dist/{Tier-ClyCt9KM.js → Tier-BP44jWgR.js} +13 -13
  28. package/dist/{Title-D6PaK72H.js → Title-Ct8QWL2Q.js} +13 -13
  29. package/dist/{Transaction-CLiY-R9h.js → Transaction-RP2dj85O.js} +1 -1
  30. package/dist/{Voucher-DYJDRt0u.js → Voucher-BQ6Kq-jX.js} +10 -10
  31. package/dist/{app-DBR_YmVt.js → app-Bzct9xVo.js} +24 -24
  32. package/dist/{app-OXHo6S1u.js → app-DiKC7FId.js} +1 -1
  33. package/dist/app.js +1 -1
  34. package/dist/{business-CSmJnfxU.js → business-iGcoCCSb.js} +1 -1
  35. package/dist/{campaign-BfzDFYy4.js → campaign-DeEhf0-p.js} +2 -2
  36. package/dist/{collection.fn-B3fehEh0.js → collection.fn-DV5EnxQc.js} +2 -2
  37. package/dist/{dto-D1k_7uk-.js → dto-D27dJqWy.js} +180 -180
  38. package/dist/{effect-Bp1S3oSk.js → effect-cdw61g2Y.js} +1 -1
  39. package/dist/{export-CET2lLBf.js → export-CLtQanYU.js} +3 -3
  40. package/dist/{helper-C6m_E9sn.js → helper-O1xiribY.js} +1 -1
  41. package/dist/{index-CQbf7JEL.js → index-3_r2IGAF.js} +2 -2
  42. package/dist/{index-DcGAYeSq.js → index-Bpb0PhDQ.js} +1 -1
  43. package/dist/{index-vtedTQkR.js → index-BzFp6WIZ.js} +1 -1
  44. package/dist/{index-CCTaLZTz.js → index-C6kizPcL.js} +5 -3
  45. package/dist/{index-BELLwClJ.js → index-C9iPmltA.js} +1 -1
  46. package/dist/{index-B-cD3OOl.js → index-DG0RrwCN.js} +5 -5
  47. package/dist/{index-B1877KRd.js → index-DLxzqdlK.js} +3 -3
  48. package/dist/{index-BaYn8lfH.js → index-DOMUfanW.js} +12 -7
  49. package/dist/{index-C208T65R.js → index-PO2CtKXo.js} +1 -1
  50. package/dist/{index-BzeGWwDC.js → index-X-EzXcGs.js} +3 -3
  51. package/dist/{index-BEi_LnV_.js → index-dbSbwT_z.js} +1 -1
  52. package/dist/{index-JyK7n__U.js → index-rOKsnWx1.js} +16 -14
  53. package/dist/{index.esm2017-D14o0xmi.js → index.esm2017-Dp0jAeUG.js} +30 -30
  54. package/dist/{loading-CTZia9no.js → loading-C7oH4e0j.js} +4 -4
  55. package/dist/{membership-Cdywxyet.js → membership-D0G_5G-y.js} +3 -3
  56. package/dist/{money-epFszMWD.js → money-B6MghTDE.js} +1 -1
  57. package/dist/{number-Ciw2FH5f.js → number-qKhyhzHd.js} +1 -1
  58. package/dist/{rule-DTOaDgf-.js → rule-BIAblb97.js} +2 -2
  59. package/dist/{rule-builder-DR45Z_8u.js → rule-builder-JAqgqMza.js} +1 -1
  60. package/dist/{template-BqcNGFEN.js → template-0FGOnSoC.js} +4 -4
  61. package/dist/{xlsx-Dn1FUo_C.js → xlsx-DD6vbwKN.js} +226 -226
  62. package/package.json +1 -1
  63. package/dist/Segment-ET69WJXK.js +0 -445
  64. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-C0zTQM7S.js +0 -818
@@ -0,0 +1,890 @@
1
+ import { defineComponent as z, ref as A, computed as K, onMounted as G, resolveComponent as D, openBlock as O, createBlock as Y, unref as n, withCtx as U, createVNode as h, normalizeClass as L, createCommentVNode as ue, createElementVNode as T, toDisplayString as X, createElementBlock as H, Fragment as de, renderList as me, mergeModels as J, useModel as pe, watch as W, onBeforeMount as fe, h as o } from "vue";
2
+ import { components as _ } from "@feedmepos/ui-library";
3
+ import { d as ge } from "./index-rOKsnWx1.js";
4
+ import { a as te } from "./loading-C7oH4e0j.js";
5
+ import { s as ye } from "./index-Dbd4WA4r.js";
6
+ import { h as v } from "./moment-BWErdI6_.js";
7
+ import { s as j } from "./index-CuvNtC_M.js";
8
+ import { f as Q } from "./number-qKhyhzHd.js";
9
+ import { u as be } from "./business-iGcoCCSb.js";
10
+ import { u as ae, _ as ne } from "./usePagination-JoYaROkV.js";
11
+ import { g as re } from "./user-Bm4KttFq.js";
12
+ import { B as oe, a as le } from "./export-CLtQanYU.js";
13
+ import { u as he } from "./campaign-DeEhf0-p.js";
14
+ import "./index-PO2CtKXo.js";
15
+ import { useRouter as ve } from "vue-router";
16
+ import { R as V } from "./app-Bzct9xVo.js";
17
+ import { o as $ } from "./objectId-dwaoBfJX.js";
18
+ import { g as Z, a as _e, S as xe, b as Se } from "./index-X-EzXcGs.js";
19
+ function we(r) {
20
+ let c = "";
21
+ switch (r) {
22
+ case "PORTAL":
23
+ c = "ADMIN";
24
+ break;
25
+ case "BENEFIT":
26
+ c = "MEMBERSHIP";
27
+ break;
28
+ case "ORDER":
29
+ c = "ORDER";
30
+ break;
31
+ case "BILL":
32
+ c = "SPENDING";
33
+ break;
34
+ case "CASHBACK":
35
+ c = "CASHBACK";
36
+ break;
37
+ case "CYCLE":
38
+ c = "EXPIRED";
39
+ break;
40
+ case "COUNTER_CONSUME":
41
+ c = "COUNTER REDEEM";
42
+ break;
43
+ default:
44
+ c = r;
45
+ break;
46
+ }
47
+ return c;
48
+ }
49
+ function Ie(r) {
50
+ var c, i, p, u, m, S;
51
+ switch ((c = r == null ? void 0 : r.pf_collectible) == null ? void 0 : c.type) {
52
+ case "VOUCHER":
53
+ return `${(i = r.pf_collectible) == null ? void 0 : i.type} (${(p = r.pf_collectible) == null ? void 0 : p.name})`;
54
+ case "TITLE":
55
+ return `${(u = r.pf_collectible) == null ? void 0 : u.type} (${(m = r.pf_collectible) == null ? void 0 : m.name})`;
56
+ case "POINT":
57
+ return "Experience";
58
+ case "COIN":
59
+ return "Point";
60
+ default:
61
+ return ye((S = r == null ? void 0 : r.pf_collectible) == null ? void 0 : S.type);
62
+ }
63
+ }
64
+ function Re(r) {
65
+ switch (r) {
66
+ case "ONLINE":
67
+ return "Online";
68
+ case "COIN":
69
+ return "Point";
70
+ default:
71
+ return r;
72
+ }
73
+ }
74
+ const k = {
75
+ getReason: we,
76
+ formattedType: Ie,
77
+ formattedPaymentType: Re
78
+ }, Ce = { class: "fm-typo-en-body-md-600 select-none text-ellipsis overflow-hidden whitespace-nowrap" }, q = /* @__PURE__ */ z({
79
+ __name: "FilterChip",
80
+ props: {
81
+ modelValue: {
82
+ type: Array,
83
+ required: !1
84
+ },
85
+ label: {
86
+ type: String,
87
+ required: !1,
88
+ default: ""
89
+ },
90
+ showItemLabel: {
91
+ type: Boolean,
92
+ default: !1
93
+ },
94
+ placement: {
95
+ type: String,
96
+ required: !1,
97
+ default: "bottom-end"
98
+ },
99
+ class: {
100
+ type: String,
101
+ required: !1
102
+ },
103
+ disabled: {
104
+ type: Boolean,
105
+ required: !1
106
+ },
107
+ items: {
108
+ type: Array,
109
+ required: !0
110
+ },
111
+ icon: {
112
+ type: String,
113
+ required: !1
114
+ }
115
+ },
116
+ emits: ["update:model-value"],
117
+ setup(r, { emit: c }) {
118
+ const i = r, p = c, u = A(!1), m = A({}), S = K(() => {
119
+ if (!m.value || Object.keys(m.value).length == i.items.length)
120
+ return "All";
121
+ {
122
+ const f = Object.keys(m.value).length;
123
+ return `${f > 0 ? f : "None"} selected`;
124
+ }
125
+ });
126
+ function d(f) {
127
+ m.value[f] ? delete m.value[f] : m.value[f] = !0, p("update:model-value", Object.keys(m.value));
128
+ }
129
+ function w() {
130
+ Object.keys(m.value).length > 0 ? m.value = {} : m.value = i.items.reduce((f, e) => (f[e.value] = !0, f), {}), p("update:model-value", Object.keys(m.value));
131
+ }
132
+ return G(() => {
133
+ m.value = i.modelValue.reduce(
134
+ (f, e) => (f[e] = !0, f),
135
+ {}
136
+ ), i.modelValue.length == 0;
137
+ }), (f, e) => {
138
+ const s = D("FmIcon"), x = D("FmChip"), I = D("FmMenuItem"), g = D("FmMenu");
139
+ return O(), Y(g, {
140
+ placement: r.placement || "bottom-end",
141
+ disabled: r.disabled == !0,
142
+ "model-value": n(u),
143
+ onMenuChanged: e[0] || (e[0] = (R) => u.value = R),
144
+ "close-on-click": !1
145
+ }, {
146
+ "menu-button": U(() => [
147
+ h(x, {
148
+ label: r.label,
149
+ class: L(i.class || "text-fm-color-neutral-gray-400 cursor-pointer")
150
+ }, {
151
+ default: U(() => [
152
+ i.icon ? (O(), Y(s, {
153
+ key: 0,
154
+ name: i.icon,
155
+ class: L(i.class),
156
+ outline: "",
157
+ size: "sm"
158
+ }, null, 8, ["name", "class"])) : ue("", !0),
159
+ T("div", Ce, X(i.label) + " " + X(r.showItemLabel ? n(S) : ""), 1),
160
+ h(s, {
161
+ name: n(u) ? "keyboard_arrow_up" : "keyboard_arrow_down",
162
+ class: L(i.class),
163
+ outline: "",
164
+ size: "sm"
165
+ }, null, 8, ["name", "class"])
166
+ ]),
167
+ _: 1
168
+ }, 8, ["label", "class"])
169
+ ]),
170
+ default: U(() => [
171
+ h(I, {
172
+ "model-value": Object.keys(n(m)).length === i.items.length,
173
+ label: "All",
174
+ "has-checkbox": !0,
175
+ indeterminate: !0,
176
+ onClick: w
177
+ }, null, 8, ["model-value"]),
178
+ (O(!0), H(de, null, me(i.items ?? [], (R) => (O(), Y(I, {
179
+ key: R.value,
180
+ value: R.value,
181
+ label: R.label,
182
+ "has-checkbox": !0,
183
+ "model-value": n(m)[R.value],
184
+ "onUpdate:modelValue": (F) => d(R.value)
185
+ }, null, 8, ["value", "label", "model-value", "onUpdate:modelValue"]))), 128))
186
+ ]),
187
+ _: 1
188
+ }, 8, ["placement", "disabled", "model-value"]);
189
+ };
190
+ }
191
+ }), P = "YYYY-MM-DD", se = /* @__PURE__ */ z({
192
+ __name: "DateRangeChip",
193
+ props: /* @__PURE__ */ J({
194
+ modelValue: {
195
+ type: Object,
196
+ required: !0
197
+ }
198
+ }, {
199
+ dateRange: {
200
+ type: Object,
201
+ default: () => ({
202
+ startDate: v().subtract(7, "day").format(P),
203
+ endDate: v().endOf("day").format(P)
204
+ })
205
+ },
206
+ dateRangeModifiers: {}
207
+ }),
208
+ emits: /* @__PURE__ */ J(["update:model-value"], ["update:dateRange"]),
209
+ setup(r, { emit: c }) {
210
+ const i = r, p = c, u = pe(r, "dateRange"), m = K(() => u.value ? `${S.value.startDate ?? "Start"} - ${S.value.endDate ?? "End"}` : "No dates selected."), S = K(() => ({
211
+ startDate: u.value.startDate ? v(u.value.startDate).format(P) : void 0,
212
+ endDate: u.value.endDate ? v(u.value.endDate).format(P) : void 0
213
+ }));
214
+ return G(() => {
215
+ u.value = i.modelValue;
216
+ }), W(
217
+ () => u.value,
218
+ () => {
219
+ p("update:model-value", S.value);
220
+ }
221
+ ), (d, w) => {
222
+ const f = D("FmChip"), e = D("FmDateRangePicker");
223
+ return O(), Y(e, {
224
+ modelValue: u.value,
225
+ "onUpdate:modelValue": w[0] || (w[0] = (s) => u.value = s),
226
+ "show-predefined-range": ""
227
+ }, {
228
+ "trigger-button": U(() => [
229
+ h(f, {
230
+ label: n(m),
231
+ icon: "calendar_month",
232
+ "right-icon": "keyboard_arrow_down",
233
+ class: "text-fm-color-neutral-gray-400 cursor-pointer"
234
+ }, null, 8, ["label"])
235
+ ]),
236
+ _: 1
237
+ }, 8, ["modelValue"]);
238
+ };
239
+ }
240
+ });
241
+ class De extends oe {
242
+ }
243
+ const ee = () => {
244
+ const r = xe.getBusinessId();
245
+ if (!r) throw new Error("Invalid business ID");
246
+ return Se(`businesses/${r}/transactions`, {
247
+ noIdRequired: !0
248
+ });
249
+ }, B = {
250
+ async readAll(r, c) {
251
+ const i = Z(
252
+ await ee().get("", {
253
+ params: { ...r, ...c }
254
+ })
255
+ );
256
+ return {
257
+ meta: i.meta,
258
+ resources: i.resources
259
+ };
260
+ },
261
+ async readStoreTransactions(r, c) {
262
+ const i = Z(
263
+ await ee().get("/store", {
264
+ params: { ...r, ...c }
265
+ })
266
+ );
267
+ return {
268
+ meta: i.meta,
269
+ resources: i.resources
270
+ };
271
+ },
272
+ async readBills(r, c, i) {
273
+ return (await _e("").get(`/restaurants/${r}/receipt?start=${c}&end=${i}`)).data;
274
+ }
275
+ }, Te = { class: "hidden xs:flex items-center justify-end" }, Oe = { class: "flex items-center justify-between" }, Fe = { class: "flex gap-8 items-center w-full overflow-x-scroll" }, ke = { class: "xs:hidden" }, et = /* @__PURE__ */ z({
276
+ __name: "CollectionTransactions",
277
+ props: {
278
+ user: {
279
+ type: String
280
+ }
281
+ },
282
+ setup(r) {
283
+ const c = be(), i = he(), p = ve(), u = r, m = A(!1), S = [
284
+ {
285
+ header: "Transaction ID",
286
+ accessorKey: "_id",
287
+ meta: {
288
+ maxWidth: "100px"
289
+ },
290
+ cell(a) {
291
+ return o("div", { class: "flex items-center" }, [
292
+ o(_.FmIcon, {
293
+ name: "content_copy",
294
+ outline: !0,
295
+ size: "sm",
296
+ class: "cursor-pointer mr-4",
297
+ onClick: (t) => {
298
+ t.preventDefault(), t.stopPropagation(), te(a.row.original._id.toString());
299
+ }
300
+ }),
301
+ o(
302
+ "div",
303
+ { class: "pr-2 text-ellipsis overflow-hidden" },
304
+ a.row.original._id.toString()
305
+ )
306
+ ]);
307
+ },
308
+ enableSorting: !1
309
+ },
310
+ {
311
+ header: "Created at",
312
+ accessorKey: "_id",
313
+ accessorFn: (a) => v($(a._id.toString())).format("D MMM YYYY, hh:mmA"),
314
+ enableSorting: !0
315
+ },
316
+ {
317
+ header: "Amount",
318
+ // accessorKey: 'totalAmount',
319
+ enableSorting: !1,
320
+ cell(a) {
321
+ var b, l, C, E;
322
+ const t = Q(
323
+ a.row.original.expiryAmount.reduce(
324
+ (N, M) => N + M.amount,
325
+ a.row.original.amount ?? 0
326
+ ),
327
+ 2
328
+ ), y = (l = (b = a.row.original.expiryAmount) == null ? void 0 : b[0]) != null && l.expiredAt ? v((E = (C = a.row.original.expiryAmount) == null ? void 0 : C[0]) == null ? void 0 : E.expiredAt).format(
329
+ "D MMM YYYY"
330
+ ) : "";
331
+ return o("div", { class: "flex items-center" }, [
332
+ o(
333
+ "div",
334
+ {
335
+ class: [
336
+ "pr-2",
337
+ +t > 0 ? "text-fm-color-system-success-300" : "text-fm-color-system-error-300"
338
+ ]
339
+ },
340
+ t
341
+ ),
342
+ o("div", { class: "flex items-center" }, [
343
+ a.row.original.expiryAmount.length > 0 ? o(
344
+ _.FmTooltip,
345
+ {
346
+ content: `Expired on ${y}`
347
+ },
348
+ [
349
+ o(_.FmIcon, {
350
+ name: "info",
351
+ outline: !0,
352
+ size: "sm"
353
+ })
354
+ ]
355
+ ) : o("div")
356
+ ])
357
+ ]);
358
+ }
359
+ },
360
+ {
361
+ header: "Type",
362
+ accessorKey: "pf_collectible.type",
363
+ accessorFn: (a) => k.formattedType(a),
364
+ meta: {
365
+ maxWidth: "200px"
366
+ },
367
+ cell(a) {
368
+ const t = k.formattedType(a.row.original);
369
+ return o("div", { class: "flex items-center" }, [
370
+ o("div", { class: "truncate text-ellipsis" }, t),
371
+ t.length > 20 ? o(
372
+ _.FmTooltip,
373
+ {
374
+ content: t
375
+ },
376
+ [
377
+ o(_.FmIcon, {
378
+ name: "info",
379
+ outline: !0,
380
+ size: "sm"
381
+ })
382
+ ]
383
+ ) : null
384
+ ]);
385
+ }
386
+ },
387
+ {
388
+ header: "Source",
389
+ accessorKey: "source",
390
+ cell(a) {
391
+ var t;
392
+ return o("div", { class: "flex items-center gap-4" }, [
393
+ o(
394
+ "div",
395
+ { class: "truncate text-ellipsis" },
396
+ j(k.getReason(a.row.original.source))
397
+ ),
398
+ ...(t = a.row.original.metadata) != null && t.campaign ? [
399
+ o(
400
+ _.FmTooltip,
401
+ {
402
+ get content() {
403
+ var y;
404
+ return (y = i.campaigns.all.find(
405
+ (b) => {
406
+ var l;
407
+ return b._id === ((l = a.row.original.metadata) == null ? void 0 : l.campaign);
408
+ }
409
+ )) == null ? void 0 : y.name;
410
+ }
411
+ },
412
+ [
413
+ o(_.FmIcon, {
414
+ name: "info",
415
+ outline: !0,
416
+ size: "sm",
417
+ onClick: async (y) => {
418
+ y.preventDefault(), y.stopPropagation();
419
+ const b = i.campaigns.all.find(
420
+ (l) => {
421
+ var C;
422
+ return l._id === ((C = a.row.original.metadata) == null ? void 0 : C.campaign);
423
+ }
424
+ );
425
+ if (b)
426
+ switch (b.type) {
427
+ case "VOUCHER":
428
+ case "PROMOTION":
429
+ case "BROADCAST":
430
+ await p.push({
431
+ name: V[`$connect-CAMPAIGN_${b.type}`]
432
+ });
433
+ break;
434
+ case "GAME":
435
+ case "CREDIT":
436
+ case "MISSION":
437
+ await p.push({
438
+ name: V[`$connect-PROGRAM_${b.type}`]
439
+ });
440
+ break;
441
+ case "POINT":
442
+ await p.push({
443
+ name: V["$connect-PROGRAM_EXPERIENCE"]
444
+ });
445
+ break;
446
+ case "COIN":
447
+ await p.push({
448
+ name: V["$connect-PROGRAM_POINT"]
449
+ });
450
+ break;
451
+ }
452
+ }
453
+ })
454
+ ]
455
+ )
456
+ ] : []
457
+ ]);
458
+ }
459
+ },
460
+ {
461
+ header: "User",
462
+ accessorKey: "pf_user.name",
463
+ cell(a) {
464
+ return re(a.row.original.pf_user);
465
+ }
466
+ },
467
+ {
468
+ header: "Phone No.",
469
+ accessorKey: "pf_user.phoneNumber",
470
+ accessorFn: (a) => {
471
+ var t;
472
+ return ((t = a == null ? void 0 : a.pf_user) == null ? void 0 : t.phoneNumber) || "";
473
+ }
474
+ },
475
+ {
476
+ accessorFn: (a) => a.ref,
477
+ header: "References",
478
+ accessorKey: "ref",
479
+ cell(a) {
480
+ var t, y;
481
+ return o("div", { class: "flex items-center justify-between gap-4" }, [
482
+ o("div", { class: "flex items-center" }, [
483
+ (t = a.row.original.metadata) != null && t.remark ? o(
484
+ _.FmTooltip,
485
+ {
486
+ content: (y = a.row.original.metadata) == null ? void 0 : y.remark
487
+ },
488
+ [
489
+ o(_.FmIcon, {
490
+ name: "info",
491
+ outline: !0,
492
+ size: "sm"
493
+ })
494
+ ]
495
+ ) : o("div")
496
+ ]),
497
+ o("div", { class: "flex-1" }, a.row.original.ref)
498
+ ]);
499
+ }
500
+ }
501
+ ], d = A({
502
+ search: "",
503
+ "pf_collectible.type": [],
504
+ "metadata.location": [],
505
+ dateRange: {
506
+ startDate: v().subtract(7, "day").toISOString(),
507
+ endDate: v().endOf("day").toISOString()
508
+ },
509
+ source: []
510
+ }), { tableMeta: w, rowData: f, onSort: e, debouncedFetchData: s, onSearch: x } = ae(async (a) => {
511
+ const t = {
512
+ ...d.value,
513
+ user: u.user,
514
+ dateRange: {
515
+ start: new Date(d.value.dateRange.startDate).toISOString(),
516
+ end: new Date(d.value.dateRange.endDate).toISOString()
517
+ }
518
+ }, y = await B.readAll(a, t);
519
+ return {
520
+ resources: y.resources.map((b) => {
521
+ const l = I.value.find((C) => C._id === b.ref);
522
+ return { ...b, ref: (l == null ? void 0 : l.seqNumber) || b.ref };
523
+ }),
524
+ meta: y.meta
525
+ };
526
+ }), I = A([]), g = ge.options.map((a) => ({ label: j(k.getReason(a)), value: a })), R = c.locations.map((a) => ({ label: a.name, value: a._id }));
527
+ W(
528
+ d,
529
+ () => {
530
+ s();
531
+ },
532
+ { deep: !0 }
533
+ );
534
+ async function F() {
535
+ try {
536
+ m.value = !0;
537
+ const a = {
538
+ ...d.value,
539
+ user: u.user,
540
+ dateRange: {
541
+ start: new Date(d.value.dateRange.startDate).toISOString(),
542
+ end: new Date(d.value.dateRange.endDate).toISOString()
543
+ }
544
+ };
545
+ await le({
546
+ exporter: new De(),
547
+ readFunction: (t) => B.readAll(t, a),
548
+ transformRecord: (t) => {
549
+ var y, b, l, C, E, N, M;
550
+ return {
551
+ TransactionID: t._id,
552
+ CreatedAt: v($(t._id.toString())).format(
553
+ "D MMM YYYY, hh:mmA"
554
+ ),
555
+ Amount: Q(
556
+ t.expiryAmount.reduce(
557
+ (ie, ce) => ie + ce.amount,
558
+ t.amount ?? 0
559
+ ),
560
+ 2
561
+ ),
562
+ ExpiredAt: (b = (y = t.expiryAmount) == null ? void 0 : y[0]) != null && b.expiredAt ? v((C = (l = t.expiryAmount) == null ? void 0 : l[0]) == null ? void 0 : C.expiredAt).format("D MMM YYYY") : "",
563
+ Type: k.formattedType(t),
564
+ Source: j(k.getReason(t.source)),
565
+ User: ((E = t.pf_user) == null ? void 0 : E.name) || "",
566
+ "Phone No.": ((N = t.pf_user) == null ? void 0 : N.phoneNumber) || "",
567
+ References: t.ref,
568
+ Remark: ((M = t.metadata) == null ? void 0 : M.remark) || ""
569
+ };
570
+ },
571
+ filename: "transactions"
572
+ });
573
+ } catch (a) {
574
+ console.error(a);
575
+ } finally {
576
+ m.value = !1;
577
+ }
578
+ }
579
+ return fe(async () => {
580
+ await c.readLocations(), await i.read(), await s();
581
+ }), (a, t) => {
582
+ const y = D("FmSearch"), b = D("FmButton");
583
+ return O(), H("div", null, [
584
+ T("div", Te, [
585
+ h(y, {
586
+ class: "hidden xs:flex border-b border-fm-color-neutral-gray-100",
587
+ modelValue: n(d).search,
588
+ "onUpdate:modelValue": t[0] || (t[0] = (l) => n(d).search = l),
589
+ placeholder: "Search",
590
+ collapsible: ""
591
+ }, null, 8, ["modelValue"]),
592
+ h(b, {
593
+ icon: "ios_share",
594
+ variant: "tertiary",
595
+ onClick: F
596
+ })
597
+ ]),
598
+ T("div", Oe, [
599
+ T("div", Fe, [
600
+ h(q, {
601
+ class: "cursor-pointer text-fm-color-neutral-gray-400",
602
+ "right-icon": "keyboard_arrow_down",
603
+ modelValue: n(d)["metadata.location"],
604
+ "onUpdate:modelValue": t[1] || (t[1] = (l) => n(d)["metadata.location"] = l),
605
+ icon: "storefront",
606
+ "show-item-label": !0,
607
+ items: n(R)
608
+ }, null, 8, ["modelValue", "items"]),
609
+ h(q, {
610
+ class: "cursor-pointer text-fm-color-neutral-gray-400",
611
+ "right-icon": "keyboard_arrow_down",
612
+ modelValue: n(d)["pf_collectible.type"],
613
+ "onUpdate:modelValue": t[2] || (t[2] = (l) => n(d)["pf_collectible.type"] = l),
614
+ label: "Type: ",
615
+ "show-item-label": !0,
616
+ items: [
617
+ { label: "Point", value: "COIN" },
618
+ { label: "Credit", value: "CREDIT" },
619
+ { label: "Voucher", value: "VOUCHER" },
620
+ { label: "Experience", value: "POINT" },
621
+ { label: "Tier", value: "TIER" },
622
+ { label: "Title", value: "TITLE" },
623
+ { label: "Game", value: "GAME" },
624
+ { label: "Stamp", value: "STAMP" }
625
+ ]
626
+ }, null, 8, ["modelValue"]),
627
+ h(q, {
628
+ class: "cursor-pointer text-fm-color-neutral-gray-400",
629
+ "right-icon": "keyboard_arrow_down",
630
+ modelValue: n(d).source,
631
+ "onUpdate:modelValue": t[3] || (t[3] = (l) => n(d).source = l),
632
+ label: "Source: ",
633
+ "show-item-label": !0,
634
+ items: n(g)
635
+ }, null, 8, ["modelValue", "items"]),
636
+ h(se, {
637
+ "model-value": {
638
+ startDate: n(d).dateRange.startDate,
639
+ endDate: n(d).dateRange.endDate
640
+ },
641
+ "onUpdate:modelValue": t[4] || (t[4] = (l) => n(d).dateRange = {
642
+ startDate: n(v)(l.startDate).startOf("d").toISOString(),
643
+ endDate: n(v)(l.endDate).endOf("d").toISOString()
644
+ })
645
+ }, null, 8, ["model-value"])
646
+ ]),
647
+ h(y, {
648
+ class: "xs:hidden",
649
+ modelValue: n(d).search,
650
+ "onUpdate:modelValue": t[5] || (t[5] = (l) => n(d).search = l),
651
+ placeholder: "Search",
652
+ collapsible: ""
653
+ }, null, 8, ["modelValue"]),
654
+ T("div", ke, [
655
+ h(b, {
656
+ icon: "ios_share",
657
+ variant: "tertiary",
658
+ onClick: F
659
+ })
660
+ ])
661
+ ]),
662
+ h(ne, {
663
+ loading: n(w).isLoading,
664
+ "row-data": n(f),
665
+ "row-count": n(w).totalRows,
666
+ "column-defs": S.filter(
667
+ (l) => !u.user || l.header !== "User" && l.header !== "Phone No."
668
+ ),
669
+ "page-count": n(w).pageCount,
670
+ "page-index": n(w).pageIndex,
671
+ "page-size": n(w).pageSize,
672
+ "shrink-at": !1,
673
+ onSortChange: n(e),
674
+ onPageChange: t[6] || (t[6] = (l) => n(s)({
675
+ pageSize: l.pageSize,
676
+ pageIndex: l.pageIndex
677
+ }))
678
+ }, null, 8, ["loading", "row-data", "row-count", "column-defs", "page-count", "page-index", "page-size", "onSortChange"])
679
+ ]);
680
+ };
681
+ }
682
+ });
683
+ class Ae extends oe {
684
+ }
685
+ const Ee = { class: "flex items-center justify-between" }, Ne = { class: "flex gap-8 items-center" }, Me = { class: "flex gap-8 items-center xs:hidden" }, tt = /* @__PURE__ */ z({
686
+ __name: "StoreTransactions",
687
+ props: {
688
+ user: {
689
+ type: String
690
+ }
691
+ },
692
+ setup(r) {
693
+ const c = r, i = [
694
+ {
695
+ header: "Transaction ID",
696
+ meta: {
697
+ maxWidth: "150px"
698
+ },
699
+ cell(e) {
700
+ return o("div", { class: "flex items-center" }, [
701
+ o(_.FmIcon, {
702
+ name: "content_copy",
703
+ outline: !0,
704
+ size: "sm",
705
+ class: "cursor-pointer mr-4 shrink-0",
706
+ onClick: (s) => {
707
+ s.preventDefault(), s.stopPropagation(), te(e.row.original._id.toString());
708
+ }
709
+ }),
710
+ o("div", { class: "truncate" }, e.row.original._id.toString())
711
+ ]);
712
+ }
713
+ },
714
+ {
715
+ header: "Created at",
716
+ accessorFn: (e) => v($(e._id.toString())).format("D MMM YYYY, hh:mmA"),
717
+ enableSorting: !0
718
+ },
719
+ {
720
+ header: "Bundle",
721
+ accessorFn: (e) => e.bundle.name
722
+ },
723
+ {
724
+ header: "Location",
725
+ accessorFn: (e) => e.location ? e.pf_location.name : "Online Store"
726
+ },
727
+ {
728
+ header: "Payment Type",
729
+ accessorFn: (e) => {
730
+ var s;
731
+ return ((s = e.paymentType) == null ? void 0 : s.type) ?? "N/A";
732
+ },
733
+ cell(e) {
734
+ var s, x;
735
+ return o("div", { class: "flex items-center gap-4" }, [
736
+ o("div", { class: "flex items-center" }, [
737
+ ((s = e.row.original.paymentType) == null ? void 0 : s.type) == "ONLINE" && e.row.original.paymentType.extra ? o(
738
+ _.FmTooltip,
739
+ {
740
+ content: e.row.original.paymentType.extra
741
+ },
742
+ [
743
+ o(_.FmIcon, {
744
+ name: "info",
745
+ outline: !0,
746
+ size: "sm"
747
+ })
748
+ ]
749
+ ) : o("div")
750
+ ]),
751
+ o(
752
+ "div",
753
+ { class: "flex-1" },
754
+ ((x = e.row.original.paymentType) == null ? void 0 : x.type) ?? "N/A"
755
+ )
756
+ ]);
757
+ }
758
+ },
759
+ {
760
+ header: "User",
761
+ cell: (e) => re(e.row.original.pf_member)
762
+ },
763
+ {
764
+ header: "Phone No.",
765
+ accessorFn: (e) => e.pf_member.phoneNumber
766
+ },
767
+ {
768
+ header: "Status",
769
+ // accessorFn: (u) => u.status,
770
+ cell(e) {
771
+ var s, x, I, g;
772
+ return o("div", { class: "flex items-center" }, [
773
+ o("div", e.row.original.status),
774
+ o("div", { class: "flex items-center" }, [
775
+ (x = (s = e.row.original) == null ? void 0 : s.refund) != null && x.reason ? o(
776
+ _.FmTooltip,
777
+ {
778
+ content: (g = (I = e.row.original) == null ? void 0 : I.refund) == null ? void 0 : g.reason
779
+ },
780
+ [
781
+ o(_.FmIcon, {
782
+ name: "info",
783
+ outline: !0,
784
+ size: "sm"
785
+ })
786
+ ]
787
+ ) : o("div")
788
+ ])
789
+ ]);
790
+ }
791
+ }
792
+ ], p = A({
793
+ searchValue: "",
794
+ dateRange: {
795
+ startDate: v().subtract(7, "day").toISOString(),
796
+ endDate: v().toISOString()
797
+ }
798
+ }), { tableMeta: u, rowData: m, onSort: S, debouncedFetchData: d, onSearch: w } = ae(async (e) => {
799
+ const s = {
800
+ ...p.value.dateRange,
801
+ user: c.user
802
+ };
803
+ return await B.readStoreTransactions(e, s);
804
+ });
805
+ W(
806
+ p,
807
+ () => {
808
+ d();
809
+ },
810
+ { deep: !0 }
811
+ ), G(async () => {
812
+ await d();
813
+ });
814
+ const f = async () => le({
815
+ exporter: new Ae(),
816
+ readFunction: (e) => B.readStoreTransactions(e, {
817
+ ...p.value.dateRange,
818
+ user: c.user
819
+ }),
820
+ transformRecord: (e) => {
821
+ var s, x, I, g, R, F;
822
+ return {
823
+ TransactionId: ((s = e._id) == null ? void 0 : s.toString()) || "",
824
+ CreatedAt: v($(e._id.toString())).format(
825
+ "DD/MM/YYYY HH:mm:ss"
826
+ ),
827
+ Bundle: e.bundle.name || "",
828
+ Location: e.location ? e.pf_location.name : "Online Store",
829
+ PaymentType: ((x = e.paymentType) == null ? void 0 : x.type) || "N/A",
830
+ PaymentExtra: ((I = e.paymentType) == null ? void 0 : I.extra) || "",
831
+ User: ((g = e.pf_member) == null ? void 0 : g.name) || "",
832
+ PhoneNumber: ((R = e.pf_member) == null ? void 0 : R.phoneNumber) || "",
833
+ Status: e.status || "",
834
+ RefundReason: ((F = e == null ? void 0 : e.refund) == null ? void 0 : F.reason) || ""
835
+ };
836
+ },
837
+ filename: "store-transactions"
838
+ });
839
+ return (e, s) => {
840
+ const x = D("FmSearch"), I = D("FmButton");
841
+ return O(), H("div", null, [
842
+ T("div", Ee, [
843
+ T("div", Ne, [
844
+ h(se, {
845
+ modelValue: n(p).dateRange,
846
+ "onUpdate:modelValue": s[0] || (s[0] = (g) => n(p).dateRange = g)
847
+ }, null, 8, ["modelValue"])
848
+ ]),
849
+ T("div", Me, [
850
+ h(x, {
851
+ modelValue: n(u).searchValue,
852
+ "onUpdate:modelValue": [
853
+ s[1] || (s[1] = (g) => n(u).searchValue = g),
854
+ n(w)
855
+ ],
856
+ placeholder: "Search",
857
+ collapsible: ""
858
+ }, null, 8, ["modelValue", "onUpdate:modelValue"]),
859
+ h(I, {
860
+ icon: "ios_share",
861
+ variant: "tertiary",
862
+ onClick: f
863
+ })
864
+ ])
865
+ ]),
866
+ h(ne, {
867
+ loading: n(u).isLoading,
868
+ "row-data": n(m),
869
+ "row-count": n(u).totalRows,
870
+ "column-defs": i.filter(
871
+ (g) => !c.user || g.header !== "User" && g.header !== "Phone No."
872
+ ),
873
+ "page-count": n(u).pageCount,
874
+ "page-index": n(u).pageIndex,
875
+ "page-size": n(u).pageSize,
876
+ "shrink-at": !1,
877
+ onSortChange: n(S),
878
+ onPageChange: s[2] || (s[2] = (g) => n(d)({
879
+ pageSize: g.pageSize,
880
+ pageIndex: g.pageIndex
881
+ }))
882
+ }, null, 8, ["loading", "row-data", "row-count", "column-defs", "page-count", "page-index", "page-size", "onSortChange"])
883
+ ]);
884
+ };
885
+ }
886
+ });
887
+ export {
888
+ et as _,
889
+ tt as a
890
+ };