@feedmepos/mf-connect 0.0.8 → 0.0.9

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 (77) hide show
  1. package/dist/{Analytic-BxRuK2P2.js → Analytic-CwaN0mge.js} +68 -69
  2. package/dist/{Broadcast-BqGojAWW.js → Broadcast-Cjx5xzUC.js} +27 -28
  3. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-B-VzcVMS.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-D4mO5aik.js} +34 -34
  4. package/dist/Card-DbY6YaXk.js +827 -0
  5. package/dist/{Collections-DvdDRozp.js → Collections-DRN2gzwh.js} +158 -168
  6. package/dist/{Credit-BeHm7_2S.js → Credit-DOcrzykJ.js} +11 -12
  7. package/dist/{EditCampaignSheet.vue_vue_type_script_setup_true_lang-BsbgHsah.js → EditCampaignSheet.vue_vue_type_script_setup_true_lang-CUxfXaro.js} +359 -333
  8. package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-hwXvdiut.js → EffectSheet.vue_vue_type_style_index_0_lang-EF_rHfwT.js} +5 -5
  9. package/dist/{Experience-CtDY9u4Y.js → Experience-aQj-3H2Y.js} +11 -12
  10. package/dist/{Game-DjaYuqcb.js → Game-Cnje-m_M.js} +22 -23
  11. package/dist/{ImageInput.vue_vue_type_script_setup_true_lang-Bq5-Gl9N.js → ImageInput.vue_vue_type_script_setup_true_lang-CG-GBVMP.js} +8 -8
  12. package/dist/{MainLayout-B-iAZM2k.js → MainLayout-Cxl9yLPs.js} +1 -1
  13. package/dist/{Marketing-BJJltAh-.js → Marketing-BYUcbcMU.js} +19 -20
  14. package/dist/{Member-eJ9Pdi5w.js → Member-D7K9fm_Q.js} +2 -2
  15. package/dist/MemberList-DbXkxUzF.js +1717 -0
  16. package/dist/{MemberTransactions-DRET8mSQ.js → MemberTransactions-DED1SYwX.js} +4 -4
  17. package/dist/MessageInput.vue_vue_type_script_setup_true_lang-CLqIp5wR.js +203 -0
  18. package/dist/{Point-DPTOgJbC.js → Point-CQm8whVQ.js} +11 -12
  19. package/dist/{Promotion-wzkRuNqO.js → Promotion-DzVXy_C9.js} +42 -44
  20. package/dist/{RuleGroup.vue_vue_type_script_setup_true_lang-Z06eB5i5.js → RuleGroup.vue_vue_type_script_setup_true_lang-CeS6KlhP.js} +12 -12
  21. package/dist/Segment-D3o0D3Uv.js +407 -0
  22. package/dist/{Setting-CXuZu0-m.js → Setting-pCzenLoL.js} +17 -18
  23. package/dist/{Store-4Um9keEp.js → Store-DEwEIFYD.js} +18 -19
  24. package/dist/{StoreRewards-B-UFeyQM.js → StoreRewards-D7vnZN4f.js} +86 -87
  25. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-ALzQU3th.js +793 -0
  26. package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-I_XFpctY.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-GMIztWCj.js} +1 -1
  27. package/dist/{Tier-C6KVsxGO.js → Tier-BJbX5CPB.js} +401 -377
  28. package/dist/{Title-DuN1ahIM.js → Title-C9xV6rBg.js} +274 -248
  29. package/dist/Transaction-C8OHlhzR.js +36 -0
  30. package/dist/Voucher-eZwm7N1D.js +481 -0
  31. package/dist/{app-CxBTTB31.js → app-DgbDbhL-.js} +34 -34
  32. package/dist/app.js +1 -1
  33. package/dist/{campaign-B0aXkadj.js → campaign-BkvrUTEJ.js} +2 -2
  34. package/dist/{dto-BtdVC-Ab.js → dto-YYVhW73A.js} +52 -53
  35. package/dist/{effect-BUN6rkQM.js → effect-f7DAPYC8.js} +1 -1
  36. package/dist/export-BXbCXTfd.js +97 -0
  37. package/dist/{helper-Cpq3x8K5.js → helper-BhvQ9m6d.js} +1 -1
  38. package/dist/{index-D2Juhkdw.js → index-BhacKx5B.js} +85 -83
  39. package/dist/{index-DDSLx7vu.js → index-BsEqtUmY.js} +2 -2
  40. package/dist/{index-0GYrZr4L.js → index-CdtrQ9tR.js} +5 -5
  41. package/dist/{index-8clzk3uX.js → index-Cfo2A0Se.js} +1 -1
  42. package/dist/index-Cz5RZlYh.js +73 -0
  43. package/dist/{index-BTntbYTS.js → index-DQC_1tRF.js} +1 -1
  44. package/dist/{index-DysVCkrx.js → index-Dd3hrFcQ.js} +3 -3
  45. package/dist/{index-CK9yJMj7.js → index-FWp9M1yS.js} +5 -5
  46. package/dist/{index-C6NgUSl2.js → index-VmFlM704.js} +1 -1
  47. package/dist/{index-BvnZdJBY.js → index-oQLJE4Uw.js} +2 -2
  48. package/dist/libs/packages/core/src/collectible/collectible.dto.d.ts +6 -0
  49. package/dist/{plugins-B_d-WFtN.js → loading-DQaawbHE.js} +8204 -8108
  50. package/dist/{lodash-DsT1nK-T.js → lodash-DzdmTD20.js} +1 -1
  51. package/dist/{membership-DtD45RXh.js → membership-Dq2-b-S_.js} +3 -3
  52. package/dist/{money-CFI1TMCS.js → money-vzwOUBrp.js} +1 -1
  53. package/dist/{number-BBtf4fYz.js → number-CBzs6rfW.js} +1 -1
  54. package/dist/packages/connect/src/components/campaign/CampaignSummary.vue.d.ts +13 -0
  55. package/dist/packages/connect/src/composables/export.d.ts +11 -0
  56. package/dist/packages/connect/src/export/base.export.d.ts +7 -0
  57. package/dist/packages/connect/src/export/card.export.d.ts +5 -6
  58. package/dist/packages/connect/src/export/collection-transaction.export.d.ts +14 -0
  59. package/dist/packages/connect/src/export/index.d.ts +1 -0
  60. package/dist/packages/connect/src/export/store-transaction.export.d.ts +14 -0
  61. package/dist/packages/connect/src/helpers/user.d.ts +6 -0
  62. package/dist/{rule-CB9Qlcx1.js → rule-BR5rrmUV.js} +2 -2
  63. package/dist/{rule-builder-BIKcA4Bg.js → rule-builder-7GBNrPXt.js} +1 -1
  64. package/dist/{template-qlb46PGl.js → template-CETJ6lkf.js} +5 -5
  65. package/dist/{usePagination-CX66ab1Y.js → usePagination-DdZeE4Tt.js} +57 -56
  66. package/dist/user-Bm4KttFq.js +37 -0
  67. package/dist/{xlsx-DMaFso0k.js → xlsx-CDAKxZE_.js} +1 -1
  68. package/package.json +1 -1
  69. package/dist/Card-Dlj5jQp4.js +0 -792
  70. package/dist/MemberList-CrhMqUfJ.js +0 -1664
  71. package/dist/MessageInput.vue_vue_type_script_setup_true_lang-D-ttMwn2.js +0 -166
  72. package/dist/Segment-DnsPrP7Q.js +0 -371
  73. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-BAyotuXd.js +0 -660
  74. package/dist/Transaction-DdfX7Xfe.js +0 -34
  75. package/dist/Voucher-DarXrxZr.js +0 -454
  76. package/dist/index-Dg-PMgXV.js +0 -64
  77. package/dist/loading-Cxp7sI5p.js +0 -100
@@ -0,0 +1,793 @@
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-BsEqtUmY.js";
4
+ import { a as X } from "./loading-DQaawbHE.js";
5
+ import { s as de } from "./index-Dbd4WA4r.js";
6
+ import { h } from "./moment-BWErdI6_.js";
7
+ import { s as Y } from "./index-CuvNtC_M.js";
8
+ import { f as H } from "./number-CBzs6rfW.js";
9
+ import { e as G, j as me, S as pe, h as fe, a as ge } from "./app-DgbDbhL-.js";
10
+ import { u as J, _ as Q } from "./usePagination-DdZeE4Tt.js";
11
+ import { g as Z } from "./user-Bm4KttFq.js";
12
+ import { B as ee, a as te } from "./export-BXbCXTfd.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 he(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 be(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: he,
75
+ formattedPaymentType: be
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: h().subtract(7, "day").format(V),
201
+ endDate: h().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 ? h(d.value.startDate).format(V) : void 0,
210
+ endDate: d.value.endDate ? h(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) => h(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
+ ), b = (i = (v = e.row.original.expiryAmount) == null ? void 0 : v[0]) != null && i.expiredAt ? h((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 ${b}`
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, b;
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: (b = e.row.original.metadata) == null ? void 0 : b.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: h().subtract(7, "day").toISOString(),
434
+ endDate: h().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
+ }, b = await M.readAll(e, n);
446
+ return {
447
+ resources: b.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: b.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 b, v, i;
477
+ return {
478
+ TransactionID: n._id,
479
+ CreatedAt: h(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: ((b = n.pf_user) == null ? void 0 : b.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 b = x("FmSearch"), v = x("FmButton");
509
+ return R(), L("div", null, [
510
+ C("div", Se, [
511
+ g(b, {
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
+ ]
551
+ }, null, 8, ["modelValue"]),
552
+ g(B, {
553
+ class: "cursor-pointer text-fm-color-neutral-gray-400",
554
+ "right-icon": "keyboard_arrow_down",
555
+ modelValue: a(r).source,
556
+ "onUpdate:modelValue": n[3] || (n[3] = (i) => a(r).source = i),
557
+ label: "Source: ",
558
+ "show-item-label": !0,
559
+ items: a(_)
560
+ }, null, 8, ["modelValue", "items"]),
561
+ g(ae, {
562
+ "model-value": {
563
+ startDate: a(r).dateRange.startDate,
564
+ endDate: a(r).dateRange.endDate
565
+ },
566
+ "onUpdate:modelValue": n[4] || (n[4] = (i) => a(r).dateRange = {
567
+ startDate: a(h)(i.startDate).startOf("d").toISOString(),
568
+ endDate: a(h)(i.endDate).endOf("d").toISOString()
569
+ })
570
+ }, null, 8, ["model-value"])
571
+ ]),
572
+ g(b, {
573
+ class: "xs:hidden",
574
+ modelValue: a(r).search,
575
+ "onUpdate:modelValue": n[5] || (n[5] = (i) => a(r).search = i),
576
+ placeholder: "Search",
577
+ collapsible: ""
578
+ }, null, 8, ["modelValue"]),
579
+ C("div", De, [
580
+ g(v, {
581
+ icon: "ios_share",
582
+ variant: "tertiary",
583
+ onClick: f
584
+ })
585
+ ])
586
+ ]),
587
+ g(Q, {
588
+ loading: a(y).isLoading,
589
+ "row-data": a(D),
590
+ "row-count": a(y).totalRows,
591
+ "column-defs": d.filter(
592
+ (i) => !l.user || i.header !== "User" && i.header !== "Phone No."
593
+ ),
594
+ "page-count": a(y).pageCount,
595
+ "page-index": a(y).pageIndex,
596
+ "page-size": a(y).pageSize,
597
+ "shrink-at": !1,
598
+ onSortChange: a(I),
599
+ onPageChange: n[6] || (n[6] = (i) => a(m)({
600
+ pageSize: i.pageSize,
601
+ pageIndex: i.pageIndex
602
+ }))
603
+ }, null, 8, ["loading", "row-data", "row-count", "column-defs", "page-count", "page-index", "page-size", "onSortChange"])
604
+ ]);
605
+ };
606
+ }
607
+ });
608
+ class Ie extends ee {
609
+ }
610
+ 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({
611
+ __name: "StoreTransactions",
612
+ props: {
613
+ user: {
614
+ type: String
615
+ }
616
+ },
617
+ setup(o) {
618
+ const s = o, l = [
619
+ {
620
+ header: "Transaction ID",
621
+ meta: {
622
+ maxWidth: "150px"
623
+ },
624
+ cell(t) {
625
+ return c("div", { class: "flex items-center" }, [
626
+ c(S.FmIcon, {
627
+ name: "content_copy",
628
+ outline: !0,
629
+ size: "sm",
630
+ class: "cursor-pointer mr-4 shrink-0",
631
+ onClick: (u) => {
632
+ u.preventDefault(), u.stopPropagation(), X(t.row.original._id.toString());
633
+ }
634
+ }),
635
+ c("div", { class: "truncate" }, t.row.original._id.toString())
636
+ ]);
637
+ }
638
+ },
639
+ {
640
+ header: "Created at",
641
+ accessorFn: (t) => h(A(t._id.toString())).format("D MMM YYYY, hh:mmA"),
642
+ enableSorting: !0
643
+ },
644
+ {
645
+ header: "Bundle",
646
+ accessorFn: (t) => t.bundle.name
647
+ },
648
+ {
649
+ header: "Location",
650
+ accessorFn: (t) => t.location ? t.pf_location.name : "Online Store"
651
+ },
652
+ {
653
+ header: "Payment Type",
654
+ accessorFn: (t) => {
655
+ var u;
656
+ return ((u = t.paymentType) == null ? void 0 : u.type) ?? "N/A";
657
+ },
658
+ cell(t) {
659
+ var u, _;
660
+ return c("div", { class: "flex items-center gap-4" }, [
661
+ c("div", { class: "flex items-center" }, [
662
+ ((u = t.row.original.paymentType) == null ? void 0 : u.type) == "ONLINE" && t.row.original.paymentType.extra ? c(
663
+ S.FmTooltip,
664
+ {
665
+ content: t.row.original.paymentType.extra
666
+ },
667
+ [
668
+ c(S.FmIcon, {
669
+ name: "info",
670
+ outline: !0,
671
+ size: "sm"
672
+ })
673
+ ]
674
+ ) : c("div")
675
+ ]),
676
+ c(
677
+ "div",
678
+ { class: "flex-1" },
679
+ ((_ = t.row.original.paymentType) == null ? void 0 : _.type) ?? "N/A"
680
+ )
681
+ ]);
682
+ }
683
+ },
684
+ {
685
+ header: "User",
686
+ cell: (t) => Z(t.row.original.pf_member)
687
+ },
688
+ {
689
+ header: "Phone No.",
690
+ accessorFn: (t) => t.pf_member.phoneNumber
691
+ },
692
+ {
693
+ header: "Status",
694
+ accessorFn: (t) => t.status
695
+ }
696
+ ], p = k({
697
+ searchValue: "",
698
+ dateRange: {
699
+ startDate: h().subtract(7, "day").toISOString(),
700
+ endDate: h().toISOString()
701
+ }
702
+ }), { tableMeta: d, rowData: r, onSort: y, debouncedFetchData: D, onSearch: I } = J(async (t) => {
703
+ const u = {
704
+ ...p.value.dateRange,
705
+ user: s.user
706
+ };
707
+ return await M.readStoreTransactions(t, u);
708
+ });
709
+ j(
710
+ p,
711
+ () => {
712
+ D();
713
+ },
714
+ { deep: !0 }
715
+ ), z(async () => {
716
+ await D();
717
+ });
718
+ const m = async () => te({
719
+ exporter: new Ie(),
720
+ readFunction: (t) => M.readStoreTransactions(t, {
721
+ ...p.value.dateRange,
722
+ user: s.user
723
+ }),
724
+ transformRecord: (t) => {
725
+ var u, _, w, f, e;
726
+ return {
727
+ TransactionId: ((u = t._id) == null ? void 0 : u.toString()) || "",
728
+ CreatedAt: h(A(t._id.toString())).format(
729
+ "DD/MM/YYYY HH:mm:ss"
730
+ ),
731
+ Bundle: t.bundle.name || "",
732
+ Location: t.location ? t.pf_location.name : "Online Store",
733
+ PaymentType: ((_ = t.paymentType) == null ? void 0 : _.type) || "N/A",
734
+ PaymentExtra: ((w = t.paymentType) == null ? void 0 : w.extra) || "",
735
+ User: ((f = t.pf_member) == null ? void 0 : f.name) || "",
736
+ PhoneNumber: ((e = t.pf_member) == null ? void 0 : e.phoneNumber) || "",
737
+ Status: t.status || ""
738
+ };
739
+ },
740
+ filename: "store-transactions"
741
+ });
742
+ return (t, u) => {
743
+ const _ = x("FmSearch"), w = x("FmButton");
744
+ return R(), L("div", null, [
745
+ C("div", Ce, [
746
+ C("div", Re, [
747
+ g(ae, {
748
+ modelValue: a(p).dateRange,
749
+ "onUpdate:modelValue": u[0] || (u[0] = (f) => a(p).dateRange = f)
750
+ }, null, 8, ["modelValue"])
751
+ ]),
752
+ C("div", Fe, [
753
+ g(_, {
754
+ modelValue: a(d).searchValue,
755
+ "onUpdate:modelValue": [
756
+ u[1] || (u[1] = (f) => a(d).searchValue = f),
757
+ a(I)
758
+ ],
759
+ placeholder: "Search",
760
+ collapsible: ""
761
+ }, null, 8, ["modelValue", "onUpdate:modelValue"]),
762
+ g(w, {
763
+ icon: "ios_share",
764
+ variant: "tertiary",
765
+ onClick: m
766
+ })
767
+ ])
768
+ ]),
769
+ g(Q, {
770
+ loading: a(d).isLoading,
771
+ "row-data": a(r),
772
+ "row-count": a(d).totalRows,
773
+ "column-defs": l.filter(
774
+ (f) => !s.user || f.header !== "User" && f.header !== "Phone No."
775
+ ),
776
+ "page-count": a(d).pageCount,
777
+ "page-index": a(d).pageIndex,
778
+ "page-size": a(d).pageSize,
779
+ "shrink-at": !1,
780
+ onSortChange: a(y),
781
+ onPageChange: u[2] || (u[2] = (f) => a(D)({
782
+ pageSize: f.pageSize,
783
+ pageIndex: f.pageIndex
784
+ }))
785
+ }, null, 8, ["loading", "row-data", "row-count", "column-defs", "page-count", "page-index", "page-size", "onSortChange"])
786
+ ]);
787
+ };
788
+ }
789
+ });
790
+ export {
791
+ ze as _,
792
+ Le as a
793
+ };