@feedmepos/mf-connect 0.0.5-beta.20 → 0.0.5-beta.21

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 (67) hide show
  1. package/dist/{Analytic-DUWe-WYz.js → Analytic-CVpCpEBl.js} +12 -13
  2. package/dist/{Broadcast-CAmI-dS9.js → Broadcast-C0SHdFpT.js} +11 -12
  3. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-CQbePPyW.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-B94-nKP4.js} +8 -8
  4. package/dist/Card-C5yXOEhK.js +827 -0
  5. package/dist/Collections-Ka_q_V3S.js +424 -0
  6. package/dist/{Credit-CxyIk-mH.js → Credit-CmTa3hjm.js} +11 -12
  7. package/dist/{EditCampaignSheet.vue_vue_type_script_setup_true_lang-AGQwe70B.js → EditCampaignSheet.vue_vue_type_script_setup_true_lang-CNSfNMA_.js} +23 -24
  8. package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-y263YYGy.js → EffectSheet.vue_vue_type_style_index_0_lang-BLfzJ46z.js} +5 -5
  9. package/dist/{Experience-DH6nbWal.js → Experience-yd4ZPBXy.js} +11 -12
  10. package/dist/{Game-BGMGl6Uw.js → Game-DYTplwOh.js} +22 -23
  11. package/dist/{ImageInput.vue_vue_type_script_setup_true_lang-rs3BEnpo.js → ImageInput.vue_vue_type_script_setup_true_lang-BuuYdlE4.js} +1 -1
  12. package/dist/{LottieAnimation.vue_vue_type_script_setup_true_lang-BIwBZ7FH.js → LottieAnimation.vue_vue_type_script_setup_true_lang-BfWuKa1w.js} +1 -1
  13. package/dist/{MainLayout-CjvNB4RK.js → MainLayout-8tc3ZtLI.js} +2 -2
  14. package/dist/{Marketing-BLbR9_KN.js → Marketing-D5Le-SWn.js} +19 -20
  15. package/dist/{Member-BqPHWUos.js → Member-CzY5Um_y.js} +2 -2
  16. package/dist/{MemberList-DoBv4aBY.js → MemberList-DpFa2ttF.js} +20 -21
  17. package/dist/{MemberTransactions-Cri3UCrX.js → MemberTransactions-CDKkRdfp.js} +4 -4
  18. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang--qiv_ZUS.js → MessageInput.vue_vue_type_script_setup_true_lang-BD27S5wB.js} +4 -4
  19. package/dist/{Mission-BXRMH__V.js → Mission-9BmMMzyr.js} +25 -26
  20. package/dist/{Point-MS30HaX7.js → Point-IiWgZIyI.js} +11 -12
  21. package/dist/{Promotion-BuOELg3x.js → Promotion-BmEQ28sH.js} +42 -44
  22. package/dist/{RuleGroup.vue_vue_type_script_setup_true_lang-CAnO-3XN.js → RuleGroup.vue_vue_type_script_setup_true_lang-BhOoz0HL.js} +12 -12
  23. package/dist/{Segment-C9s9hDBX.js → Segment-D1ID4Rmt.js} +39 -40
  24. package/dist/{Setting-CHk3QEsN.js → Setting-B3WeabHJ.js} +17 -18
  25. package/dist/{Store-CQWAs4Ew.js → Store-CKFLaYKH.js} +18 -19
  26. package/dist/{StoreRewards-DJkh42Es.js → StoreRewards-DIQL173Q.js} +27 -28
  27. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-B2kjcViv.js +794 -0
  28. package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-CEBqSaBp.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-C1QmPELI.js} +1 -1
  29. package/dist/{Tier-3zGwCsja.js → Tier-BvE47ciZ.js} +43 -43
  30. package/dist/{Title-TotAXw2n.js → Title-DfcczCHg.js} +42 -42
  31. package/dist/Transaction-CF0f3QCU.js +36 -0
  32. package/dist/Voucher-CCOZjT6k.js +481 -0
  33. package/dist/{app--rCS8dWb.js → app-B4oDOeXm.js} +1456 -1456
  34. package/dist/app.js +1 -1
  35. package/dist/{campaign-BPWXzTLO.js → campaign-BWwTQs_d.js} +2 -2
  36. package/dist/{collection.fn-NFB67-6j.js → collection.fn-C5XN0PPR.js} +2 -2
  37. package/dist/{dto-ChVvY7GG.js → dto-Ktuw3JiD.js} +138 -139
  38. package/dist/{effect-CbwZuhWY.js → effect-BM2dJl1a.js} +1 -1
  39. package/dist/export-LApNX--r.js +97 -0
  40. package/dist/{helper-D16-sxkv.js → helper-BUC1dAUX.js} +1 -1
  41. package/dist/{index-EmqFPQGb.js → index-B6GvsaDA.js} +1 -1
  42. package/dist/{index-DlqRXSLU.js → index-BZMMIcyM.js} +1 -1
  43. package/dist/{index-Blbjd5Y9.js → index-Bc-r4pik.js} +5 -5
  44. package/dist/{index-CGTaSvN6.js → index-Bt_xFt9g.js} +1 -1
  45. package/dist/{index-D-bPAs1d.js → index-C7qI5flU.js} +2 -2
  46. package/dist/{index-Dh6x04Wk.js → index-C86T8VON.js} +2 -2
  47. package/dist/{index-C7SZ9gvu.js → index-CvZ_MhCE.js} +7 -7
  48. package/dist/{index-vsgk07Y2.js → index-CzVShOLS.js} +1 -1
  49. package/dist/{index-BGAWJ6-h.js → index-DSUUVWFu.js} +3 -3
  50. package/dist/{index--VC0kdJZ.js → index-DVJQt0_Q.js} +2 -2
  51. package/dist/{plugins-Ccv9TIl4.js → loading-CM3ZyteE.js} +8204 -8108
  52. package/dist/{lodash-7Fz14kKI.js → lodash-DYMRs712.js} +1 -1
  53. package/dist/{membership-ByQds6Nb.js → membership-D0Z9EBWi.js} +3 -3
  54. package/dist/{money-DsiT1-aV.js → money-Cyt6uuok.js} +1 -1
  55. package/dist/{number-D4SI_vwy.js → number-CSBV_14_.js} +1 -1
  56. package/dist/{rule-NzJI8lrC.js → rule-C4ovkUox.js} +2 -2
  57. package/dist/{rule-builder-CNz0WgMq.js → rule-builder-DxDhft7B.js} +1 -1
  58. package/dist/{template-9wDwTGR-.js → template-Dd9xYS-m.js} +6 -6
  59. package/dist/{usePagination-CsZrmXsU.js → usePagination-cObe7G1g.js} +1 -1
  60. package/dist/{xlsx-CUa5ix7U.js → xlsx--baqnGDY.js} +1 -1
  61. package/package.json +1 -1
  62. package/dist/Card-DhgETjhz.js +0 -914
  63. package/dist/Collections-9fPXIR34.js +0 -424
  64. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-1GgzlIRZ.js +0 -693
  65. package/dist/Transaction-gV9vaJCR.js +0 -34
  66. package/dist/Voucher-BJ-pXo7Y.js +0 -449
  67. package/dist/loading-B5tUSWjN.js +0 -100
@@ -0,0 +1,794 @@
1
+ import { defineComponent as P, ref as k, computed as $, onMounted as z, resolveComponent as x, openBlock as R, createBlock as O, unref as a, withCtx as N, createVNode as g, normalizeClass as U, createCommentVNode as oe, createElementVNode as C, toDisplayString as q, createElementBlock as L, Fragment as le, renderList as se, mergeModels as K, useModel as ie, watch as j, onBeforeMount as ce, h as c } from "vue";
2
+ import { components as S } from "@feedmepos/ui-library";
3
+ import { d as ue } from "./index-C7qI5flU.js";
4
+ import { a as X } from "./loading-CM3ZyteE.js";
5
+ import { s as de } from "./index-Dbd4WA4r.js";
6
+ import { h as b } from "./moment-BWErdI6_.js";
7
+ import { s as Y } from "./index-CuvNtC_M.js";
8
+ import { f as H } from "./number-CSBV_14_.js";
9
+ import { d as G, i as me, S as pe, f as fe, a as ge } from "./app-B4oDOeXm.js";
10
+ import { u as J, _ as Q } from "./usePagination-cObe7G1g.js";
11
+ import { g as Z } from "./user-Bm4KttFq.js";
12
+ import { B as ee, a as te } from "./export-LApNX--r.js";
13
+ import { o as A } from "./objectId-dwaoBfJX.js";
14
+ function ye(o) {
15
+ let s = "";
16
+ switch (o) {
17
+ case "PORTAL":
18
+ s = "ADMIN";
19
+ break;
20
+ case "EXPIRED":
21
+ s = "EXPIRED";
22
+ break;
23
+ case "BENEFIT":
24
+ s = "MEMBERSHIP";
25
+ break;
26
+ case "ORDER":
27
+ s = "ORDER";
28
+ break;
29
+ case "BILL":
30
+ s = "SPENDING";
31
+ break;
32
+ case "CASHBACK":
33
+ s = "CASHBACK";
34
+ break;
35
+ case "CYCLE":
36
+ s = "EXPIRED";
37
+ break;
38
+ case "COUNTER_CONSUME":
39
+ s = "COUNTER REDEEM";
40
+ break;
41
+ default:
42
+ s = o;
43
+ break;
44
+ }
45
+ return s;
46
+ }
47
+ function be(o) {
48
+ var s, l, p, d, r, y;
49
+ switch ((s = o == null ? void 0 : o.pf_collectible) == null ? void 0 : s.type) {
50
+ case "VOUCHER":
51
+ return `${(l = o.pf_collectible) == null ? void 0 : l.type} (${(p = o.pf_collectible) == null ? void 0 : p.name})`;
52
+ case "TITLE":
53
+ return `${(d = o.pf_collectible) == null ? void 0 : d.type} (${(r = o.pf_collectible) == null ? void 0 : r.name})`;
54
+ case "POINT":
55
+ return "Experience";
56
+ case "COIN":
57
+ return "Point";
58
+ default:
59
+ return de((y = o == null ? void 0 : o.pf_collectible) == null ? void 0 : y.type);
60
+ }
61
+ }
62
+ function he(o) {
63
+ switch (o) {
64
+ case "ONLINE":
65
+ return "Online";
66
+ case "COIN":
67
+ return "Point";
68
+ default:
69
+ return o;
70
+ }
71
+ }
72
+ const T = {
73
+ getReason: ye,
74
+ formattedType: be,
75
+ formattedPaymentType: he
76
+ }, ve = { class: "fm-typo-en-body-md-600 select-none text-ellipsis overflow-hidden whitespace-nowrap" }, B = /* @__PURE__ */ P({
77
+ __name: "FilterChip",
78
+ props: {
79
+ modelValue: {
80
+ type: Array,
81
+ required: !1
82
+ },
83
+ label: {
84
+ type: String,
85
+ required: !1,
86
+ default: ""
87
+ },
88
+ showItemLabel: {
89
+ type: Boolean,
90
+ default: !1
91
+ },
92
+ placement: {
93
+ type: String,
94
+ required: !1,
95
+ default: "bottom-end"
96
+ },
97
+ class: {
98
+ type: String,
99
+ required: !1
100
+ },
101
+ disabled: {
102
+ type: Boolean,
103
+ required: !1
104
+ },
105
+ items: {
106
+ type: Array,
107
+ required: !0
108
+ },
109
+ icon: {
110
+ type: String,
111
+ required: !1
112
+ }
113
+ },
114
+ emits: ["update:model-value"],
115
+ setup(o, { emit: s }) {
116
+ const l = o, p = s, d = k(!1), r = k({}), y = $(() => {
117
+ if (!r.value || Object.keys(r.value).length == l.items.length)
118
+ return "All";
119
+ {
120
+ const m = Object.keys(r.value).length;
121
+ return `${m > 0 ? m : "None"} selected`;
122
+ }
123
+ });
124
+ function D(m) {
125
+ r.value[m] ? delete r.value[m] : r.value[m] = !0, p("update:model-value", Object.keys(r.value));
126
+ }
127
+ function I() {
128
+ Object.keys(r.value).length > 0 ? r.value = {} : r.value = l.items.reduce((m, t) => (m[t.value] = !0, m), {}), p("update:model-value", Object.keys(r.value));
129
+ }
130
+ return z(() => {
131
+ r.value = l.modelValue.reduce(
132
+ (m, t) => (m[t] = !0, m),
133
+ {}
134
+ ), l.modelValue.length == 0;
135
+ }), (m, t) => {
136
+ const u = x("FmIcon"), _ = x("FmChip"), w = x("FmMenuItem"), f = x("FmMenu");
137
+ return R(), O(f, {
138
+ placement: o.placement || "bottom-end",
139
+ disabled: o.disabled == !0,
140
+ "model-value": a(d),
141
+ onMenuChanged: t[0] || (t[0] = (e) => d.value = e),
142
+ "close-on-click": !1
143
+ }, {
144
+ "menu-button": N(() => [
145
+ g(_, {
146
+ label: o.label,
147
+ class: U(l.class || "text-fm-color-neutral-gray-400 cursor-pointer")
148
+ }, {
149
+ default: N(() => [
150
+ l.icon ? (R(), O(u, {
151
+ key: 0,
152
+ name: l.icon,
153
+ class: U(l.class),
154
+ outline: "",
155
+ size: "sm"
156
+ }, null, 8, ["name", "class"])) : oe("", !0),
157
+ C("div", ve, q(l.label) + " " + q(o.showItemLabel ? a(y) : ""), 1),
158
+ g(u, {
159
+ name: a(d) ? "keyboard_arrow_up" : "keyboard_arrow_down",
160
+ class: U(l.class),
161
+ outline: "",
162
+ size: "sm"
163
+ }, null, 8, ["name", "class"])
164
+ ]),
165
+ _: 1
166
+ }, 8, ["label", "class"])
167
+ ]),
168
+ default: N(() => [
169
+ g(w, {
170
+ "model-value": Object.keys(a(r)).length === l.items.length,
171
+ label: "All",
172
+ "has-checkbox": !0,
173
+ indeterminate: !0,
174
+ onClick: I
175
+ }, null, 8, ["model-value"]),
176
+ (R(!0), L(le, null, se(l.items ?? [], (e) => (R(), O(w, {
177
+ key: e.value,
178
+ value: e.value,
179
+ label: e.label,
180
+ "has-checkbox": !0,
181
+ "model-value": a(r)[e.value],
182
+ "onUpdate:modelValue": (n) => D(e.value)
183
+ }, null, 8, ["value", "label", "model-value", "onUpdate:modelValue"]))), 128))
184
+ ]),
185
+ _: 1
186
+ }, 8, ["placement", "disabled", "model-value"]);
187
+ };
188
+ }
189
+ }), V = "YYYY-MM-DD", ae = /* @__PURE__ */ P({
190
+ __name: "DateRangeChip",
191
+ props: /* @__PURE__ */ K({
192
+ modelValue: {
193
+ type: Object,
194
+ required: !0
195
+ }
196
+ }, {
197
+ dateRange: {
198
+ type: Object,
199
+ default: () => ({
200
+ startDate: b().subtract(7, "day").format(V),
201
+ endDate: b().endOf("day").format(V)
202
+ })
203
+ },
204
+ dateRangeModifiers: {}
205
+ }),
206
+ emits: /* @__PURE__ */ K(["update:model-value"], ["update:dateRange"]),
207
+ setup(o, { emit: s }) {
208
+ const l = o, p = s, d = ie(o, "dateRange"), r = $(() => d.value ? `${y.value.startDate ?? "Start"} - ${y.value.endDate ?? "End"}` : "No dates selected."), y = $(() => ({
209
+ startDate: d.value.startDate ? b(d.value.startDate).format(V) : void 0,
210
+ endDate: d.value.endDate ? b(d.value.endDate).format(V) : void 0
211
+ }));
212
+ return z(() => {
213
+ d.value = l.modelValue;
214
+ }), j(
215
+ () => d.value,
216
+ () => {
217
+ p("update:model-value", y.value);
218
+ }
219
+ ), (D, I) => {
220
+ const m = x("FmChip"), t = x("FmDateRangePicker");
221
+ return R(), O(t, {
222
+ modelValue: d.value,
223
+ "onUpdate:modelValue": I[0] || (I[0] = (u) => d.value = u),
224
+ "show-predefined-range": ""
225
+ }, {
226
+ "trigger-button": N(() => [
227
+ g(m, {
228
+ label: a(r),
229
+ icon: "calendar_month",
230
+ "right-icon": "keyboard_arrow_down",
231
+ class: "text-fm-color-neutral-gray-400 cursor-pointer"
232
+ }, null, 8, ["label"])
233
+ ]),
234
+ _: 1
235
+ }, 8, ["modelValue"]);
236
+ };
237
+ }
238
+ });
239
+ class _e extends ee {
240
+ }
241
+ const W = () => {
242
+ const o = pe.getBusinessId();
243
+ if (!o) throw new Error("Invalid business ID");
244
+ return fe(`businesses/${o}/transactions`, {
245
+ noIdRequired: !0
246
+ });
247
+ }, M = {
248
+ async readAll(o, s) {
249
+ const l = G(
250
+ await W().get("", {
251
+ params: { ...o, ...s }
252
+ })
253
+ );
254
+ return {
255
+ meta: l.meta,
256
+ resources: l.resources
257
+ };
258
+ },
259
+ async readStoreTransactions(o, s) {
260
+ const l = G(
261
+ await W().get("/store", {
262
+ params: { ...o, ...s }
263
+ })
264
+ );
265
+ return {
266
+ meta: l.meta,
267
+ resources: l.resources
268
+ };
269
+ },
270
+ async readBills(o, s, l) {
271
+ return (await me("").get(`/restaurants/${o}/receipt?start=${s}&end=${l}`)).data;
272
+ }
273
+ }, Se = { class: "hidden xs:flex items-center justify-end" }, xe = { class: "flex items-center justify-between" }, we = { class: "flex gap-8 items-center w-full overflow-x-scroll" }, De = { class: "xs:hidden" }, ze = /* @__PURE__ */ P({
274
+ __name: "CollectionTransactions",
275
+ props: {
276
+ user: {
277
+ type: String
278
+ }
279
+ },
280
+ setup(o) {
281
+ const s = ge(), l = o, p = k(!1), d = [
282
+ {
283
+ header: "Transaction ID",
284
+ accessorKey: "_id",
285
+ meta: {
286
+ maxWidth: "100px"
287
+ },
288
+ cell(e) {
289
+ return c("div", { class: "flex items-center" }, [
290
+ c(S.FmIcon, {
291
+ name: "content_copy",
292
+ outline: !0,
293
+ size: "sm",
294
+ class: "cursor-pointer mr-4",
295
+ onClick: (n) => {
296
+ n.preventDefault(), n.stopPropagation(), X(e.row.original._id.toString());
297
+ }
298
+ }),
299
+ c(
300
+ "div",
301
+ { class: "pr-2 text-ellipsis overflow-hidden" },
302
+ e.row.original._id.toString()
303
+ )
304
+ ]);
305
+ },
306
+ enableSorting: !1
307
+ },
308
+ {
309
+ header: "Created at",
310
+ accessorKey: "_id",
311
+ accessorFn: (e) => b(A(e._id.toString())).format("D MMM YYYY, hh:mmA"),
312
+ enableSorting: !0
313
+ },
314
+ {
315
+ header: "Amount",
316
+ // accessorKey: 'totalAmount',
317
+ enableSorting: !1,
318
+ cell(e) {
319
+ var v, i, F, E;
320
+ const n = H(
321
+ e.row.original.expiryAmount.reduce(
322
+ (ne, re) => ne + re.amount,
323
+ e.row.original.amount ?? 0
324
+ ),
325
+ 2
326
+ ), h = (i = (v = e.row.original.expiryAmount) == null ? void 0 : v[0]) != null && i.expiredAt ? b((E = (F = e.row.original.expiryAmount) == null ? void 0 : F[0]) == null ? void 0 : E.expiredAt).format(
327
+ "D MMM YYYY"
328
+ ) : "";
329
+ return c("div", { class: "flex items-center" }, [
330
+ c(
331
+ "div",
332
+ {
333
+ class: [
334
+ "pr-2",
335
+ +n > 0 ? "text-fm-color-system-success-300" : "text-fm-color-system-error-300"
336
+ ]
337
+ },
338
+ n
339
+ ),
340
+ c("div", { class: "flex items-center" }, [
341
+ e.row.original.expiryAmount.length > 0 ? c(
342
+ S.FmTooltip,
343
+ {
344
+ content: `Expired on ${h}`
345
+ },
346
+ [
347
+ c(S.FmIcon, {
348
+ name: "info",
349
+ outline: !0,
350
+ size: "sm"
351
+ })
352
+ ]
353
+ ) : c("div")
354
+ ])
355
+ ]);
356
+ }
357
+ },
358
+ {
359
+ header: "Type",
360
+ accessorKey: "pf_collectible.type",
361
+ accessorFn: (e) => T.formattedType(e),
362
+ meta: {
363
+ maxWidth: "200px"
364
+ },
365
+ cell(e) {
366
+ const n = T.formattedType(e.row.original);
367
+ return c("div", { class: "flex items-center" }, [
368
+ c("div", { class: "truncate text-ellipsis" }, n),
369
+ n.length > 20 ? c(
370
+ S.FmTooltip,
371
+ {
372
+ content: n
373
+ },
374
+ [
375
+ c(S.FmIcon, {
376
+ name: "info",
377
+ outline: !0,
378
+ size: "sm"
379
+ })
380
+ ]
381
+ ) : null
382
+ ]);
383
+ }
384
+ },
385
+ {
386
+ header: "Source",
387
+ accessorKey: "source",
388
+ accessorFn: (e) => Y(T.getReason(e.source))
389
+ },
390
+ {
391
+ header: "User",
392
+ accessorKey: "pf_user.name",
393
+ cell(e) {
394
+ return Z(e.row.original.pf_user);
395
+ }
396
+ },
397
+ {
398
+ header: "Phone No.",
399
+ accessorKey: "pf_user.phoneNumber",
400
+ accessorFn: (e) => e.pf_user.phoneNumber
401
+ },
402
+ {
403
+ accessorFn: (e) => e.ref,
404
+ header: "References",
405
+ accessorKey: "ref",
406
+ cell(e) {
407
+ var n, h;
408
+ return c("div", { class: "flex items-center justify-between gap-4" }, [
409
+ c("div", { class: "flex items-center" }, [
410
+ (n = e.row.original.metadata) != null && n.remark ? c(
411
+ S.FmTooltip,
412
+ {
413
+ content: (h = e.row.original.metadata) == null ? void 0 : h.remark
414
+ },
415
+ [
416
+ c(S.FmIcon, {
417
+ name: "info",
418
+ outline: !0,
419
+ size: "sm"
420
+ })
421
+ ]
422
+ ) : c("div")
423
+ ]),
424
+ c("div", { class: "flex-1" }, e.row.original.ref)
425
+ ]);
426
+ }
427
+ }
428
+ ], r = k({
429
+ search: "",
430
+ "pf_collectible.type": [],
431
+ "metadata.location": [],
432
+ dateRange: {
433
+ startDate: b().subtract(7, "day").toISOString(),
434
+ endDate: b().endOf("day").toISOString()
435
+ },
436
+ source: []
437
+ }), { tableMeta: y, rowData: D, onSort: I, debouncedFetchData: m, onSearch: t } = J(async (e) => {
438
+ const n = {
439
+ ...r.value,
440
+ user: l.user,
441
+ dateRange: {
442
+ start: new Date(r.value.dateRange.startDate).toISOString(),
443
+ end: new Date(r.value.dateRange.endDate).toISOString()
444
+ }
445
+ }, h = await M.readAll(e, n);
446
+ return {
447
+ resources: h.resources.map((v) => {
448
+ const i = u.value.find((F) => F._id === v.ref);
449
+ return { ...v, ref: (i == null ? void 0 : i.seqNumber) || v.ref };
450
+ }),
451
+ meta: h.meta
452
+ };
453
+ }), u = k([]), _ = ue.options.map((e) => ({ label: Y(T.getReason(e)), value: e })), w = s.locations.map((e) => ({ label: e.name, value: e._id }));
454
+ j(
455
+ r,
456
+ () => {
457
+ m();
458
+ },
459
+ { deep: !0 }
460
+ );
461
+ async function f() {
462
+ try {
463
+ p.value = !0;
464
+ const e = {
465
+ ...r.value,
466
+ user: l.user,
467
+ dateRange: {
468
+ start: new Date(r.value.dateRange.startDate).toISOString(),
469
+ end: new Date(r.value.dateRange.endDate).toISOString()
470
+ }
471
+ };
472
+ await te({
473
+ exporter: new _e(),
474
+ readFunction: (n) => M.readAll(n, e),
475
+ transformRecord: (n) => {
476
+ var h, v, i;
477
+ return {
478
+ TransactionID: n._id,
479
+ CreatedAt: b(A(n._id.toString())).format(
480
+ "D MMM YYYY, hh:mmA"
481
+ ),
482
+ Amount: H(
483
+ n.expiryAmount.reduce(
484
+ (F, E) => F + E.amount,
485
+ n.amount ?? 0
486
+ ),
487
+ 2
488
+ ),
489
+ Type: T.formattedType(n),
490
+ Source: Y(T.getReason(n.source)),
491
+ User: ((h = n.pf_user) == null ? void 0 : h.name) || "",
492
+ "Phone No.": ((v = n.pf_user) == null ? void 0 : v.phoneNumber) || "",
493
+ References: n.ref,
494
+ Remark: ((i = n.metadata) == null ? void 0 : i.remark) || ""
495
+ };
496
+ },
497
+ filename: "transactions"
498
+ });
499
+ } catch (e) {
500
+ console.error(e);
501
+ } finally {
502
+ p.value = !1;
503
+ }
504
+ }
505
+ return ce(async () => {
506
+ await s.readLocations(), await m();
507
+ }), (e, n) => {
508
+ const h = x("FmSearch"), v = x("FmButton");
509
+ return R(), L("div", null, [
510
+ C("div", Se, [
511
+ g(h, {
512
+ class: "hidden xs:flex border-b border-fm-color-neutral-gray-100",
513
+ modelValue: a(r).search,
514
+ "onUpdate:modelValue": n[0] || (n[0] = (i) => a(r).search = i),
515
+ placeholder: "Search",
516
+ collapsible: ""
517
+ }, null, 8, ["modelValue"]),
518
+ g(v, {
519
+ icon: "ios_share",
520
+ variant: "tertiary",
521
+ onClick: f
522
+ })
523
+ ]),
524
+ C("div", xe, [
525
+ C("div", we, [
526
+ g(B, {
527
+ class: "cursor-pointer text-fm-color-neutral-gray-400",
528
+ "right-icon": "keyboard_arrow_down",
529
+ modelValue: a(r)["metadata.location"],
530
+ "onUpdate:modelValue": n[1] || (n[1] = (i) => a(r)["metadata.location"] = i),
531
+ icon: "storefront",
532
+ "show-item-label": !0,
533
+ items: a(w)
534
+ }, null, 8, ["modelValue", "items"]),
535
+ g(B, {
536
+ class: "cursor-pointer text-fm-color-neutral-gray-400",
537
+ "right-icon": "keyboard_arrow_down",
538
+ modelValue: a(r)["pf_collectible.type"],
539
+ "onUpdate:modelValue": n[2] || (n[2] = (i) => a(r)["pf_collectible.type"] = i),
540
+ label: "Type: ",
541
+ "show-item-label": !0,
542
+ items: [
543
+ { label: "Point", value: "COIN" },
544
+ { label: "Credit", value: "CREDIT" },
545
+ { label: "Voucher", value: "VOUCHER" },
546
+ { label: "Experience", value: "POINT" },
547
+ { label: "Tier", value: "TIER" },
548
+ { label: "Title", value: "TITLE" },
549
+ { label: "Game", value: "GAME" },
550
+ { label: "Stamp", value: "STAMP" }
551
+ ]
552
+ }, null, 8, ["modelValue"]),
553
+ g(B, {
554
+ class: "cursor-pointer text-fm-color-neutral-gray-400",
555
+ "right-icon": "keyboard_arrow_down",
556
+ modelValue: a(r).source,
557
+ "onUpdate:modelValue": n[3] || (n[3] = (i) => a(r).source = i),
558
+ label: "Source: ",
559
+ "show-item-label": !0,
560
+ items: a(_)
561
+ }, null, 8, ["modelValue", "items"]),
562
+ g(ae, {
563
+ "model-value": {
564
+ startDate: a(r).dateRange.startDate,
565
+ endDate: a(r).dateRange.endDate
566
+ },
567
+ "onUpdate:modelValue": n[4] || (n[4] = (i) => a(r).dateRange = {
568
+ startDate: a(b)(i.startDate).startOf("d").toISOString(),
569
+ endDate: a(b)(i.endDate).endOf("d").toISOString()
570
+ })
571
+ }, null, 8, ["model-value"])
572
+ ]),
573
+ g(h, {
574
+ class: "xs:hidden",
575
+ modelValue: a(r).search,
576
+ "onUpdate:modelValue": n[5] || (n[5] = (i) => a(r).search = i),
577
+ placeholder: "Search",
578
+ collapsible: ""
579
+ }, null, 8, ["modelValue"]),
580
+ C("div", De, [
581
+ g(v, {
582
+ icon: "ios_share",
583
+ variant: "tertiary",
584
+ onClick: f
585
+ })
586
+ ])
587
+ ]),
588
+ g(Q, {
589
+ loading: a(y).isLoading,
590
+ "row-data": a(D),
591
+ "row-count": a(y).totalRows,
592
+ "column-defs": d.filter(
593
+ (i) => !l.user || i.header !== "User" && i.header !== "Phone No."
594
+ ),
595
+ "page-count": a(y).pageCount,
596
+ "page-index": a(y).pageIndex,
597
+ "page-size": a(y).pageSize,
598
+ "shrink-at": !1,
599
+ onSortChange: a(I),
600
+ onPageChange: n[6] || (n[6] = (i) => a(m)({
601
+ pageSize: i.pageSize,
602
+ pageIndex: i.pageIndex
603
+ }))
604
+ }, null, 8, ["loading", "row-data", "row-count", "column-defs", "page-count", "page-index", "page-size", "onSortChange"])
605
+ ]);
606
+ };
607
+ }
608
+ });
609
+ class Ie extends ee {
610
+ }
611
+ const Ce = { class: "flex items-center justify-between" }, Re = { class: "flex gap-8 items-center" }, Fe = { class: "flex gap-8 items-center xs:hidden" }, Le = /* @__PURE__ */ P({
612
+ __name: "StoreTransactions",
613
+ props: {
614
+ user: {
615
+ type: String
616
+ }
617
+ },
618
+ setup(o) {
619
+ const s = o, l = [
620
+ {
621
+ header: "Transaction ID",
622
+ meta: {
623
+ maxWidth: "150px"
624
+ },
625
+ cell(t) {
626
+ return c("div", { class: "flex items-center" }, [
627
+ c(S.FmIcon, {
628
+ name: "content_copy",
629
+ outline: !0,
630
+ size: "sm",
631
+ class: "cursor-pointer mr-4 shrink-0",
632
+ onClick: (u) => {
633
+ u.preventDefault(), u.stopPropagation(), X(t.row.original._id.toString());
634
+ }
635
+ }),
636
+ c("div", { class: "truncate" }, t.row.original._id.toString())
637
+ ]);
638
+ }
639
+ },
640
+ {
641
+ header: "Created at",
642
+ accessorFn: (t) => b(A(t._id.toString())).format("D MMM YYYY, hh:mmA"),
643
+ enableSorting: !0
644
+ },
645
+ {
646
+ header: "Bundle",
647
+ accessorFn: (t) => t.bundle.name
648
+ },
649
+ {
650
+ header: "Location",
651
+ accessorFn: (t) => t.location ? t.pf_location.name : "Online Store"
652
+ },
653
+ {
654
+ header: "Payment Type",
655
+ accessorFn: (t) => {
656
+ var u;
657
+ return ((u = t.paymentType) == null ? void 0 : u.type) ?? "N/A";
658
+ },
659
+ cell(t) {
660
+ var u, _;
661
+ return c("div", { class: "flex items-center gap-4" }, [
662
+ c("div", { class: "flex items-center" }, [
663
+ ((u = t.row.original.paymentType) == null ? void 0 : u.type) == "ONLINE" && t.row.original.paymentType.extra ? c(
664
+ S.FmTooltip,
665
+ {
666
+ content: t.row.original.paymentType.extra
667
+ },
668
+ [
669
+ c(S.FmIcon, {
670
+ name: "info",
671
+ outline: !0,
672
+ size: "sm"
673
+ })
674
+ ]
675
+ ) : c("div")
676
+ ]),
677
+ c(
678
+ "div",
679
+ { class: "flex-1" },
680
+ ((_ = t.row.original.paymentType) == null ? void 0 : _.type) ?? "N/A"
681
+ )
682
+ ]);
683
+ }
684
+ },
685
+ {
686
+ header: "User",
687
+ cell: (t) => Z(t.row.original.pf_member)
688
+ },
689
+ {
690
+ header: "Phone No.",
691
+ accessorFn: (t) => t.pf_member.phoneNumber
692
+ },
693
+ {
694
+ header: "Status",
695
+ accessorFn: (t) => t.status
696
+ }
697
+ ], p = k({
698
+ searchValue: "",
699
+ dateRange: {
700
+ startDate: b().subtract(7, "day").toISOString(),
701
+ endDate: b().toISOString()
702
+ }
703
+ }), { tableMeta: d, rowData: r, onSort: y, debouncedFetchData: D, onSearch: I } = J(async (t) => {
704
+ const u = {
705
+ ...p.value.dateRange,
706
+ user: s.user
707
+ };
708
+ return await M.readStoreTransactions(t, u);
709
+ });
710
+ j(
711
+ p,
712
+ () => {
713
+ D();
714
+ },
715
+ { deep: !0 }
716
+ ), z(async () => {
717
+ await D();
718
+ });
719
+ const m = async () => te({
720
+ exporter: new Ie(),
721
+ readFunction: (t) => M.readStoreTransactions(t, {
722
+ ...p.value.dateRange,
723
+ user: s.user
724
+ }),
725
+ transformRecord: (t) => {
726
+ var u, _, w, f, e;
727
+ return {
728
+ TransactionId: ((u = t._id) == null ? void 0 : u.toString()) || "",
729
+ CreatedAt: b(A(t._id.toString())).format(
730
+ "DD/MM/YYYY HH:mm:ss"
731
+ ),
732
+ Bundle: t.bundle.name || "",
733
+ Location: t.location ? t.pf_location.name : "Online Store",
734
+ PaymentType: ((_ = t.paymentType) == null ? void 0 : _.type) || "N/A",
735
+ PaymentExtra: ((w = t.paymentType) == null ? void 0 : w.extra) || "",
736
+ User: ((f = t.pf_member) == null ? void 0 : f.name) || "",
737
+ PhoneNumber: ((e = t.pf_member) == null ? void 0 : e.phoneNumber) || "",
738
+ Status: t.status || ""
739
+ };
740
+ },
741
+ filename: "store-transactions"
742
+ });
743
+ return (t, u) => {
744
+ const _ = x("FmSearch"), w = x("FmButton");
745
+ return R(), L("div", null, [
746
+ C("div", Ce, [
747
+ C("div", Re, [
748
+ g(ae, {
749
+ modelValue: a(p).dateRange,
750
+ "onUpdate:modelValue": u[0] || (u[0] = (f) => a(p).dateRange = f)
751
+ }, null, 8, ["modelValue"])
752
+ ]),
753
+ C("div", Fe, [
754
+ g(_, {
755
+ modelValue: a(d).searchValue,
756
+ "onUpdate:modelValue": [
757
+ u[1] || (u[1] = (f) => a(d).searchValue = f),
758
+ a(I)
759
+ ],
760
+ placeholder: "Search",
761
+ collapsible: ""
762
+ }, null, 8, ["modelValue", "onUpdate:modelValue"]),
763
+ g(w, {
764
+ icon: "ios_share",
765
+ variant: "tertiary",
766
+ onClick: m
767
+ })
768
+ ])
769
+ ]),
770
+ g(Q, {
771
+ loading: a(d).isLoading,
772
+ "row-data": a(r),
773
+ "row-count": a(d).totalRows,
774
+ "column-defs": l.filter(
775
+ (f) => !s.user || f.header !== "User" && f.header !== "Phone No."
776
+ ),
777
+ "page-count": a(d).pageCount,
778
+ "page-index": a(d).pageIndex,
779
+ "page-size": a(d).pageSize,
780
+ "shrink-at": !1,
781
+ onSortChange: a(y),
782
+ onPageChange: u[2] || (u[2] = (f) => a(D)({
783
+ pageSize: f.pageSize,
784
+ pageIndex: f.pageIndex
785
+ }))
786
+ }, null, 8, ["loading", "row-data", "row-count", "column-defs", "page-count", "page-index", "page-size", "onSortChange"])
787
+ ]);
788
+ };
789
+ }
790
+ });
791
+ export {
792
+ ze as _,
793
+ Le as a
794
+ };