@feedmepos/mf-connect 0.0.16-beta.1 → 0.0.16-beta.11

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 (95) hide show
  1. package/dist/{Analytic-C-zZmF5N.js → Analytic-Gq7PoNer.js} +368 -365
  2. package/dist/App-Cikl5jnp.js +177 -0
  3. package/dist/Broadcast-DU3JnBwZ.js +223 -0
  4. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-VWLBlxy1.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-D0I8IZIR.js} +20 -20
  5. package/dist/Card-hIeQ5XUH.js +825 -0
  6. package/dist/Collections-B1SC1rr7.js +453 -0
  7. package/dist/Credit-BgwI8DR3.js +216 -0
  8. package/dist/{EditCampaignSheet.vue_vue_type_script_setup_true_lang-Bz6TSmbW.js → EditCampaignSheet.vue_vue_type_script_setup_true_lang-D9VR3P2d.js} +1026 -1022
  9. package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-AhWnHG02.js → EffectSheet.vue_vue_type_style_index_0_lang-DPgu45MD.js} +29 -29
  10. package/dist/Experience-C2Q-zqV6.js +221 -0
  11. package/dist/Game-DU2pZDGk.js +255 -0
  12. package/dist/ImageInput.vue_vue_type_script_setup_true_lang-rWUkV9gn.js +144 -0
  13. package/dist/JsonViewer-v8_C7l5N.js +87 -0
  14. package/dist/{LottieAnimation.vue_vue_type_script_setup_true_lang-DykNOOFD.js → LottieAnimation.vue_vue_type_script_setup_true_lang-CyGJxUol.js} +1 -1
  15. package/dist/{MainLayout-D0AoA1tk.js → MainLayout-B1aJoR95.js} +2 -2
  16. package/dist/Marketing-DWiTQp9I.js +316 -0
  17. package/dist/Member-BEXKBFry.js +69 -0
  18. package/dist/MemberList-DzMdajIf.js +1733 -0
  19. package/dist/MemberOverview-wL_ailso.js +58 -0
  20. package/dist/{MemberTransactions-CTAx5jIV.js → MemberTransactions-Bciankuu.js} +1 -1
  21. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-C-BtHxSc.js → MessageInput.vue_vue_type_script_setup_true_lang-DH25Hfk3.js} +46 -46
  22. package/dist/Mission-KzwRlaA5.js +259 -0
  23. package/dist/Point-CSKvZXHc.js +222 -0
  24. package/dist/Promotion-IiwPhx8p.js +221 -0
  25. package/dist/{RuleGroup.vue_vue_type_script_setup_true_lang-CrpJySSp.js → RuleGroup.vue_vue_type_script_setup_true_lang-4zIO3oCr.js} +545 -544
  26. package/dist/Segment-2Q0PonBb.js +447 -0
  27. package/dist/{Setting-Zrj5P_4m.js → Setting-Df5vVRt4.js} +600 -598
  28. package/dist/Store-C0WXCKs6.js +1503 -0
  29. package/dist/StoreRewards-eSSIO0nk.js +401 -0
  30. package/dist/{StoreTransactions.vue_vue_type_script_setup_true_lang-DS4APaHw.js → StoreTransactions.vue_vue_type_script_setup_true_lang-BjnCRKGX.js} +106 -108
  31. package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-ZYjWlDJ1.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-b0xTcoEp.js} +1 -1
  32. package/dist/{Tier-DVWJyQ9S.js → Tier-v-1FkRU-.js} +464 -449
  33. package/dist/{Title-B5kX64vs.js → Title-CQ2JWqBW.js} +315 -299
  34. package/dist/Transaction-0OouN_6s.js +39 -0
  35. package/dist/Voucher-CL0cgogx.js +488 -0
  36. package/dist/_commonjsHelpers-BkfeUUK-.js +28 -0
  37. package/dist/_plugin-vue_export-helper-CHgC5LLL.js +9 -0
  38. package/dist/app-Bd19eW7X.js +5381 -0
  39. package/dist/app-CfS25Z66.js +34797 -0
  40. package/dist/app-wDQR6dpb.js +39 -0
  41. package/dist/app.js +5 -3
  42. package/dist/business-dQh3AEot.js +78 -0
  43. package/dist/{campaign-BZJuknWK.js → campaign-BOl8AgKA.js} +12 -12
  44. package/dist/{collection.fn-DoCkZ6z4.js → collection.fn-B_YsXmrP.js} +2 -2
  45. package/dist/dto-B8NfyVPG.js +1169 -0
  46. package/dist/{effect-B8kmnKvY.js → effect-C2jCStXO.js} +1 -1
  47. package/dist/{export-Dm6LYnWo.js → export-BtZc3Yzh.js} +3 -3
  48. package/dist/{helper-DR4XK3nv.js → helper-8oGsrM56.js} +1 -1
  49. package/dist/{index-DcUrk07Q.js → index-6FkKY3q0.js} +3 -3
  50. package/dist/{index-Bu4_26qI.js → index-C7oeXRUl.js} +1 -1
  51. package/dist/{index-CuL5-ORK.js → index-CZKYIefW.js} +6 -7
  52. package/dist/{index-yxJMhfxj.js → index-C_0IFnwi.js} +5 -5
  53. package/dist/{index-BryrRq8O.js → index-DCixRRvz.js} +36 -30
  54. package/dist/{index-CkiYkbXb.js → index-DFgt4-VW.js} +1 -1
  55. package/dist/{index-CWf0mh3a.js → index-DYDhH9bi.js} +177 -168
  56. package/dist/{index-boor8e80.js → index-Di-kWSmf.js} +3 -3
  57. package/dist/{app-DkI7dYRN.js → index-Dn0jdj0o.js} +9665 -13024
  58. package/dist/index-DwKqFNF6.js +3 -0
  59. package/dist/{index-BobRgQrE.js → index-HoacsZDk.js} +2 -2
  60. package/dist/{index-BxkxVtgm.js → index-UTQHDUdW.js} +1 -1
  61. package/dist/{loading-BzV5acUX.js → loading-D_AN6p24.js} +6807 -6805
  62. package/dist/{lodash-mg4435Qq.js → lodash-B5I3zXaY.js} +1 -1
  63. package/dist/{membership-CqbsLHqx.js → membership-Ccrx9R6r.js} +3 -3
  64. package/dist/{money-DA_gtp3q.js → money-waD-f-Zz.js} +1 -1
  65. package/dist/{number-C388eyOu.js → number-CwTGGsh9.js} +1 -1
  66. package/dist/{rule-Clmr5y4j.js → rule-DJ07h3Gh.js} +2 -2
  67. package/dist/{rule-builder-BgqNbM-P.js → rule-builder-DJ-acvVD.js} +1 -1
  68. package/dist/style.css +1 -1
  69. package/dist/template-clxvNnbF.js +190 -0
  70. package/dist/{usePagination-o5fgsZwU.js → usePagination-BeF5K3M7.js} +86 -86
  71. package/dist/vue-i18n-BxwiXSkp.js +2365 -0
  72. package/dist/{xlsx-BRdh9e2p.js → xlsx-BB366cdN.js} +1945 -1945
  73. package/package.json +9 -5
  74. package/dist/Broadcast-X69Mtv3b.js +0 -216
  75. package/dist/Card-D0X3v1UF.js +0 -822
  76. package/dist/Collections-umR6Ehqf.js +0 -452
  77. package/dist/Credit-C1EWF7R0.js +0 -214
  78. package/dist/Experience-CqL8wyPm.js +0 -211
  79. package/dist/Game--kYe64EV.js +0 -250
  80. package/dist/ImageInput.vue_vue_type_script_setup_true_lang-BjOJ3XSL.js +0 -144
  81. package/dist/Marketing-CTCQ5ZmZ.js +0 -308
  82. package/dist/Member-DCduX7zP.js +0 -91
  83. package/dist/MemberList-B0EkXZJu.js +0 -1729
  84. package/dist/MemberOverview-C2n9oJZh.js +0 -58
  85. package/dist/Mission-CVr9rS_D.js +0 -248
  86. package/dist/Point-BnZ6M74y.js +0 -220
  87. package/dist/Promotion-B0PUve5S.js +0 -218
  88. package/dist/Segment-B-XpkyM5.js +0 -445
  89. package/dist/Store-B2gywCt2.js +0 -1503
  90. package/dist/StoreRewards-D8410Q_-.js +0 -434
  91. package/dist/Transaction-CZBO4v4d.js +0 -36
  92. package/dist/Voucher-se-4JF9B.js +0 -481
  93. package/dist/app-B2ImSO3V.js +0 -53382
  94. package/dist/dto-BWpvRpK2.js +0 -1151
  95. package/dist/template-Dwp7heBA.js +0 -190
@@ -1,452 +0,0 @@
1
- var oe = Object.defineProperty;
2
- var te = (b, r, u) => r in b ? oe(b, r, { enumerable: !0, configurable: !0, writable: !0, value: u }) : b[r] = u;
3
- var $ = (b, r, u) => te(b, typeof r != "symbol" ? r + "" : r, u);
4
- import { defineComponent as H, ref as g, computed as J, watch as O, resolveComponent as c, openBlock as h, createBlock as T, unref as e, isRef as K, withCtx as R, createElementVNode as v, createVNode as s, createElementBlock as N, Fragment as A, renderList as ae, createCommentVNode as P, onMounted as le, h as F } from "vue";
5
- import { h as j } from "./moment-BWErdI6_.js";
6
- import { u as ne, J as se, R as re } from "./app-DkI7dYRN.js";
7
- import { components as G } from "@feedmepos/ui-library";
8
- import { u as Q, a as ie } from "./loading-BzV5acUX.js";
9
- import { useRoute as W } from "vue-router";
10
- import { c as E } from "./index-BxkxVtgm.js";
11
- import { u as z, w as de } from "./xlsx-BRdh9e2p.js";
12
- import { u as ue, _ as ce } from "./usePagination-o5fgsZwU.js";
13
- import { m as me } from "./index-Bu4_26qI.js";
14
- import { o as pe } from "./objectId-dwaoBfJX.js";
15
- const fe = /* @__PURE__ */ v("div", { class: "fm-typo-en-body-lg-600" }, "Code type", -1), ge = { class: "space-y-16" }, be = /* @__PURE__ */ v("div", { class: "fm-typo-en-body-lg-600" }, "Settings", -1), Ce = { class: "gap-16 grid grid-cols-2" }, ve = { class: "flex items-center gap-8" }, he = /* @__PURE__ */ H({
16
- __name: "CreateCollectionSheet",
17
- emits: ["success"],
18
- setup(b, { expose: r, emit: u }) {
19
- const { minor: k } = Q, U = W(), I = g(), _ = g(!1), q = u, C = g(!1);
20
- function m(i) {
21
- C.value = i, i && (l.value = {
22
- quantity: 1,
23
- code: "",
24
- codeConfig: {
25
- length: 8,
26
- charset: "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",
27
- prefix: "",
28
- suffix: "",
29
- pattern: "########"
30
- }
31
- });
32
- }
33
- const l = g({
34
- quantity: 1,
35
- code: "",
36
- codeConfig: {
37
- length: 8,
38
- charset: "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",
39
- prefix: "",
40
- suffix: "",
41
- pattern: "########"
42
- }
43
- }), D = [
44
- {
45
- label: "Bulk codes",
46
- value: "bulk",
47
- sublabel: "Bulk generate unique codes"
48
- },
49
- {
50
- label: "Custom code",
51
- value: "single",
52
- sublabel: "Enter your own custom codes"
53
- }
54
- ], x = [
55
- {
56
- label: "Alphanumeric",
57
- value: "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
58
- },
59
- {
60
- label: "Alphabetic",
61
- value: "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
62
- },
63
- { label: "Alphabetic Lowercase", value: "abcdefghijklmnopqrstuvwxyz" },
64
- { label: "Alphabetic Uppercase", value: "ABCDEFGHIJKLMNOPQRSTUVWXYZ" },
65
- { label: "Numbers", value: "0123456789" },
66
- { label: "Custom", value: "" }
67
- ], y = g(x[0].value), f = g("bulk"), V = g(!1), n = J(() => U.params.id);
68
- async function a(i) {
69
- var o;
70
- await ((o = I.value) == null ? void 0 : o.validateInputs()), _.value && await k(
71
- async () => {
72
- await E.createCollectionByCampaignId(n.value, i), await q("success");
73
- },
74
- {
75
- message: "Creating claim(s)",
76
- successMessage: "Claim(s) created"
77
- }
78
- );
79
- }
80
- return r({
81
- showSheet: m
82
- }), O(
83
- () => f.value,
84
- (i, o) => {
85
- o != i && (l.value.code = "", l.value.codeConfig.length = 8, l.value.codeConfig.charset = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", l.value.codeConfig.prefix = "", l.value.codeConfig.suffix = "", l.value.codeConfig.pattern = "########");
86
- }
87
- ), O(
88
- () => l.value.codeConfig.length,
89
- (i, o) => {
90
- i != o && (l.value.codeConfig.pattern = "#".repeat(Math.min(16, Number(i))));
91
- }
92
- ), (i, o) => {
93
- const d = c("FmRadio"), w = c("FmRadioGroup"), M = c("FmSwitch"), S = c("FmStepperField"), L = c("FmSelect"), B = c("FmTextField"), X = c("FmTextarea"), Z = c("FmForm"), Y = c("FmButton"), ee = c("FmSideSheet");
94
- return h(), T(ee, {
95
- "max-width": 560,
96
- "dismiss-away": !0,
97
- header: "Create collection",
98
- modelValue: e(C),
99
- "onUpdate:modelValue": [
100
- o[14] || (o[14] = (t) => K(C) ? C.value = t : null),
101
- o[15] || (o[15] = (t) => C.value = t)
102
- ]
103
- }, {
104
- "side-sheet-footer": R(() => [
105
- v("div", ve, [
106
- s(Y, {
107
- label: "Save",
108
- onClick: o[12] || (o[12] = (t) => a(e(l))),
109
- loading: e(ne)().isLoading
110
- }, null, 8, ["loading"]),
111
- s(Y, {
112
- label: "Cancel",
113
- type: "button",
114
- variant: "tertiary",
115
- onClick: o[13] || (o[13] = (t) => C.value = !1)
116
- })
117
- ])
118
- ]),
119
- default: R(() => [
120
- s(se, { json: e(l) }, null, 8, ["json"]),
121
- s(Z, {
122
- ref_key: "form",
123
- ref: I,
124
- class: "space-y-40",
125
- onValidationSuccess: o[10] || (o[10] = (t) => _.value = !0),
126
- onValidationFailed: o[11] || (o[11] = (t) => _.value = !1)
127
- }, {
128
- default: R(() => [
129
- v("div", null, [
130
- fe,
131
- s(w, {
132
- modelValue: e(f),
133
- "onUpdate:modelValue": o[0] || (o[0] = (t) => K(f) ? f.value = t : null),
134
- inline: !1
135
- }, {
136
- default: R(() => [
137
- (h(), N(A, null, ae(D, (t) => s(d, {
138
- key: t.value,
139
- value: t.value,
140
- label: t.label,
141
- sublabel: t.sublabel
142
- }, null, 8, ["value", "label", "sublabel"])), 64))
143
- ]),
144
- _: 1
145
- }, 8, ["modelValue"])
146
- ]),
147
- v("div", ge, [
148
- be,
149
- e(f) === "bulk" ? (h(), N(A, { key: 0 }, [
150
- s(M, {
151
- "model-value": e(V),
152
- "label-placement": "right",
153
- value: "true",
154
- label: "Advance code setting",
155
- required: !0,
156
- "onUpdate:modelValue": o[1] || (o[1] = () => V.value = !e(V))
157
- }, null, 8, ["model-value"]),
158
- e(V) ? (h(), N(A, { key: 0 }, [
159
- s(S, {
160
- modelValue: e(l).codeConfig.length,
161
- "onUpdate:modelValue": o[2] || (o[2] = (t) => e(l).codeConfig.length = t),
162
- label: "Code length",
163
- max: 16,
164
- min: 1,
165
- rules: [
166
- (t) => Number(t) >= 1 || "Code length must at least 1",
167
- (t) => Number(t) <= 16 || "Code length must less than 16"
168
- ],
169
- required: !0
170
- }, null, 8, ["modelValue", "rules"]),
171
- s(L, {
172
- label: "Charset",
173
- "model-value": e(y),
174
- items: x,
175
- "helper-text": e(l).codeConfig.charset.length > 62 ? `${e(l).codeConfig.charset.substring(0, 62)}...` : e(l).codeConfig.charset,
176
- "onUpdate:modelValue": o[3] || (o[3] = (t) => {
177
- y.value = t, e(l).codeConfig.charset = t;
178
- })
179
- }, null, 8, ["model-value", "helper-text"]),
180
- e(y) === "" ? (h(), T(B, {
181
- key: 0,
182
- modelValue: e(l).codeConfig.charset,
183
- "onUpdate:modelValue": o[4] || (o[4] = (t) => e(l).codeConfig.charset = t),
184
- label: "Custom Charset",
185
- required: ""
186
- }, null, 8, ["modelValue"])) : P("", !0),
187
- v("div", Ce, [
188
- s(B, {
189
- modelValue: e(l).codeConfig.prefix,
190
- "onUpdate:modelValue": o[5] || (o[5] = (t) => e(l).codeConfig.prefix = t),
191
- label: "Prefix (Optional)"
192
- }, null, 8, ["modelValue"]),
193
- s(B, {
194
- modelValue: e(l).codeConfig.suffix,
195
- "onUpdate:modelValue": o[6] || (o[6] = (t) => e(l).codeConfig.suffix = t),
196
- label: "Suffix (Optional)"
197
- }, null, 8, ["modelValue"])
198
- ]),
199
- s(B, {
200
- modelValue: e(l).codeConfig.pattern,
201
- "onUpdate:modelValue": o[7] || (o[7] = (t) => e(l).codeConfig.pattern = t),
202
- label: "Pattern",
203
- required: !0
204
- }, null, 8, ["modelValue"])
205
- ], 64)) : P("", !0),
206
- s(B, {
207
- modelValue: e(l).quantity,
208
- "onUpdate:modelValue": o[8] || (o[8] = (t) => e(l).quantity = t),
209
- label: "Number of code",
210
- rules: [
211
- (t) => t >= 1 || "Quantity cannot be less than 1",
212
- (t) => t <= 1e4 || "Quantity cannot more than 10,000"
213
- ],
214
- required: !0,
215
- "helper-text": `${e(l).quantity} claim will be created`
216
- }, null, 8, ["modelValue", "rules", "helper-text"])
217
- ], 64)) : P("", !0),
218
- e(f) !== "bulk" ? (h(), T(X, {
219
- key: 1,
220
- modelValue: e(l).code,
221
- "onUpdate:modelValue": o[9] || (o[9] = (t) => e(l).code = t),
222
- label: "Custom Code",
223
- rules: [(t) => e(f) != "single" || !!t || "Custom code is required"],
224
- placeholder: "(For multiple codes, please enter in the new row.)"
225
- }, null, 8, ["modelValue", "rules"])) : P("", !0)
226
- ])
227
- ]),
228
- _: 1
229
- }, 512)
230
- ]),
231
- _: 1
232
- }, 8, ["modelValue"]);
233
- };
234
- }
235
- });
236
- class xe {
237
- constructor() {
238
- $(this, "data", []);
239
- }
240
- addRecord(r) {
241
- this.data.push(r);
242
- }
243
- buildExcel() {
244
- const r = z.book_new(), u = z.json_to_sheet(this.data);
245
- return z.book_append_sheet(r, u, "Collection"), r;
246
- }
247
- }
248
- const p = {
249
- sortBy: "_id",
250
- descending: !1,
251
- rowsPerPage: 1e3,
252
- page: 1,
253
- rowsNumber: 0
254
- }, ye = { class: "px-24 flex flex-col gap-y-32 pb-24" }, Ve = { class: "flex items-center justify-end py-4 xs:hidden" }, Ee = /* @__PURE__ */ H({
255
- __name: "Collections",
256
- setup(b) {
257
- const r = W(), u = g(), k = J(() => r.params.id), U = g(!1), { custom: I } = Q, _ = [
258
- {
259
- header: "ID/Code",
260
- accessorKey: "_id",
261
- cell(n) {
262
- return F("div", { class: "flex items-center" }, [
263
- F(G.FmIcon, {
264
- name: "content_copy",
265
- outline: !0,
266
- size: "sm",
267
- class: "cursor-pointer mr-4",
268
- onClick: (a) => {
269
- a.preventDefault(), a.stopPropagation(), ie(
270
- n.row.original.code || n.row.original._id.toString()
271
- );
272
- }
273
- }),
274
- F(
275
- "div",
276
- { class: "pr-2 text-ellipsis overflow-hidden" },
277
- n.row.original.code || n.row.original._id.toString()
278
- )
279
- ]);
280
- }
281
- },
282
- {
283
- header: "User",
284
- accessorKey: "user",
285
- enableSorting: !1,
286
- cell(n) {
287
- const a = n.row.original.pf_user;
288
- return F(
289
- "div",
290
- {
291
- class: "flex items-center gap-x-8"
292
- },
293
- [
294
- F(G.FmAvatar, {
295
- name: a != null && a.photoUrl || a == null ? void 0 : a.name,
296
- src: (a == null ? void 0 : a.photoUrl) ?? void 0,
297
- size: "sm"
298
- }),
299
- F("span", a == null ? void 0 : a.name)
300
- ]
301
- );
302
- }
303
- },
304
- {
305
- header: "Phone",
306
- accessorFn: (n) => {
307
- var a;
308
- return ((a = n.pf_user) == null ? void 0 : a.phoneNumber) || "-";
309
- },
310
- accessorKey: "pf_user.phoneNumber"
311
- },
312
- {
313
- header: "Balance",
314
- accessorKey: "balance"
315
- },
316
- {
317
- header: "Created at",
318
- accessorKey: "_id",
319
- accessorFn: (n) => j(pe(n._id.toString())).format("DD MMM YYYY")
320
- },
321
- {
322
- header: "Nearest expired at",
323
- accessorKey: "expiryBalance",
324
- accessorFn: (n) => {
325
- var a;
326
- return n.expiryBalance && n.expiryBalance.length ? j((a = n.expiryBalance) == null ? void 0 : a[0].expiredAt).format("DD MMM YYYY") : "Never expires";
327
- }
328
- }
329
- ], q = {
330
- "$connect-STORE_REWARD_COLLECTIONS": me.readCollectionsByRewardId,
331
- "$connect-CAMPAIGN_VOUCHER_COLLECTIONS": E.readCollectionsByCampaignId
332
- }, C = (n) => {
333
- const a = q[r.name];
334
- return (i) => a(n, i);
335
- }, { tableMeta: m, rowData: l, onSort: D, debouncedFetchData: x, onSearch: y } = ue(C(k.value));
336
- async function f() {
337
- var n;
338
- await x(), (n = u.value) == null || n.showSheet(!1);
339
- }
340
- async function V() {
341
- U.value || I(
342
- async () => {
343
- var o;
344
- const n = new xe(), a = (await E.readCollectionsByCampaignId(k.value, {
345
- limit: 1,
346
- skip: 0,
347
- sortBy: p.sortBy,
348
- descending: p.descending
349
- })).meta.totalResources ?? 0, i = p.rowsPerPage;
350
- for (let d = 0; d < a; d += i) {
351
- const w = {
352
- ...p,
353
- limit: i,
354
- skip: (p.page - 1) * p.rowsPerPage,
355
- sortBy: p.sortBy,
356
- descending: p.descending
357
- }, M = await E.readCollectionsByCampaignId(
358
- k.value,
359
- w
360
- );
361
- for await (const S of M.resources) {
362
- const L = {
363
- Id: (S == null ? void 0 : S.code) || ((o = S._id) == null ? void 0 : o.toString()) || ""
364
- };
365
- n.addRecord(L);
366
- }
367
- p.page++;
368
- }
369
- await de(
370
- n.buildExcel(),
371
- `members-${(/* @__PURE__ */ new Date()).toISOString()}.xlsx`,
372
- {
373
- bookType: "xlsx",
374
- bookSST: !1,
375
- type: "array"
376
- }
377
- ), p.page = 1;
378
- },
379
- {
380
- isLoading: U
381
- }
382
- );
383
- }
384
- return le(async () => {
385
- await x();
386
- }), (n, a) => {
387
- const i = c("FmPageHead"), o = c("FmSearch");
388
- return h(), N(A, null, [
389
- s(i, {
390
- title: "Collections",
391
- "back-button": !0,
392
- actions: [
393
- { label: "Export", value: "export", isPrimary: !1 },
394
- {
395
- label: "Create collection",
396
- value: "create",
397
- isPrimary: !0
398
- }
399
- ],
400
- "onClick:back": a[0] || (a[0] = (d) => e(re).back()),
401
- "onClick:action": a[1] || (a[1] = (d) => {
402
- var w;
403
- d === "create" && ((w = e(u)) == null || w.showSheet(!0)), d === "export" && V();
404
- })
405
- }),
406
- v("div", ye, [
407
- s(o, {
408
- class: "hidden xs:flex border-b border-fm-color-neutral-gray-100",
409
- modelValue: e(m).searchValue,
410
- "onUpdate:modelValue": [
411
- a[2] || (a[2] = (d) => e(m).searchValue = d),
412
- e(y)
413
- ],
414
- placeholder: "Search",
415
- collapsible: ""
416
- }, null, 8, ["modelValue", "onUpdate:modelValue"]),
417
- v("div", Ve, [
418
- s(o, {
419
- modelValue: e(m).searchValue,
420
- "onUpdate:modelValue": [
421
- a[3] || (a[3] = (d) => e(m).searchValue = d),
422
- e(y)
423
- ],
424
- placeholder: "Search",
425
- collapsible: ""
426
- }, null, 8, ["modelValue", "onUpdate:modelValue"])
427
- ]),
428
- s(ce, {
429
- loading: e(m).isLoading,
430
- "row-data": e(l),
431
- "column-defs": _,
432
- "row-count": e(m).totalRows,
433
- "page-count": e(m).pageCount,
434
- "page-index": e(m).pageIndex,
435
- "page-size": e(m).pageSize,
436
- "shrink-at": !1,
437
- onSortChange: e(D),
438
- onPageChange: a[4] || (a[4] = (d) => e(x)({ pageSize: d.pageSize, pageIndex: d.pageIndex }))
439
- }, null, 8, ["loading", "row-data", "row-count", "page-count", "page-index", "page-size", "onSortChange"]),
440
- s(he, {
441
- ref_key: "sheetRef",
442
- ref: u,
443
- onSuccess: f
444
- }, null, 512)
445
- ])
446
- ], 64);
447
- };
448
- }
449
- });
450
- export {
451
- Ee as default
452
- };
@@ -1,214 +0,0 @@
1
- import { defineComponent as U, ref as k, computed as A, onMounted as N, resolveComponent as i, openBlock as l, createElementBlock as f, Fragment as g, createVNode as r, unref as o, createElementVNode as s, withCtx as h, renderList as j, createBlock as C, resolveDynamicComponent as M, toDisplayString as y, createCommentVNode as H, h as q } from "vue";
2
- import { _ as z } from "./campaign-CpzFl8Vr.js";
3
- import { useDialog as G, components as J } from "@feedmepos/ui-library";
4
- import { u as O, p as Q } from "./loading-BzV5acUX.js";
5
- import { a as W } from "./app-DkI7dYRN.js";
6
- import { u as X } from "./campaign-BZJuknWK.js";
7
- import { g as S, b as V } from "./dto-BWpvRpK2.js";
8
- import { _ as Y } from "./ChipMenu.vue_vue_type_script_setup_true_lang-BPpZZNkr.js";
9
- import { _ as Z } from "./EditCampaignSheet.vue_vue_type_script_setup_true_lang-Bz6TSmbW.js";
10
- import { u as ee } from "./template-Dwp7heBA.js";
11
- import { c as _ } from "./index-BxkxVtgm.js";
12
- const te = { class: "px-24 flex flex-col gap-y-16" }, oe = { class: "flex items-center justify-between w-full" }, ae = { class: "flex gap-8 overflow-x-auto" }, se = { class: "space-y-8" }, ne = { class: "flex w-full gap-4 items-center" }, re = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ie = { class: "space-y-4" }, le = { class: "fm-typo-en-body-lg-600" }, ce = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, me = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, de = { key: 0 }, ue = /* @__PURE__ */ s("div", { class: "text-fm-color-typo-secondary fm-typo-en-body-md-600" }, " No results found ", -1), pe = [
13
- ue
14
- ], fe = /* @__PURE__ */ s("img", {
15
- src: z,
16
- class: "aspect-square w-[150px]"
17
- }, null, -1), ye = /* @__PURE__ */ s("div", { class: "flex flex-col gap-16 text-center" }, [
18
- /* @__PURE__ */ s("div", { class: "fm-typo-en-title-sm-800" }, "Create your credit program"),
19
- /* @__PURE__ */ s("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " Credits are virtual money that customers can use to pay for their purchases, similar to cash within your store. ")
20
- ], -1), Re = /* @__PURE__ */ U({
21
- __name: "Credit",
22
- setup(_e) {
23
- const R = {
24
- label: "Create program",
25
- value: "create",
26
- isPrimary: !0,
27
- prependIcon: "add"
28
- }, L = ee("CREDIT", G()), I = W(), c = X(), { global: B, minor: w } = O, n = k({
29
- searchKey: "",
30
- location: null
31
- }), m = A(
32
- () => c.campaigns.credit.filter(
33
- (e) => !n.value.location || !e.targetLocation || e.targetLocation.includes(n.value.location)
34
- )
35
- ), D = [
36
- {
37
- header: "Program title",
38
- accessorFn: (e) => e.name
39
- },
40
- {
41
- header: "Status",
42
- cell(e) {
43
- return S(e.row.original);
44
- }
45
- },
46
- {
47
- header: "Summary",
48
- accessorFn: (e) => V(e)
49
- //v.effect,
50
- },
51
- {
52
- header: "Actions",
53
- cell(e) {
54
- return q(J.FmButton, {
55
- variant: "tertiary",
56
- icon: "delete",
57
- iconColor: "neutral-gray-400",
58
- onClick: (a) => {
59
- a.stopPropagation(), x(e.row.original);
60
- }
61
- });
62
- }
63
- }
64
- ], v = k();
65
- async function x(e) {
66
- await Q.remove(`Are you sure you want to remove ${e.name}?`) && await w(
67
- async () => {
68
- await _.delete(e._id), await c.read("CREDIT");
69
- },
70
- {
71
- message: `Removing ${e.name}`,
72
- successMessage: `Removed ${e.name} successfully`
73
- }
74
- );
75
- }
76
- async function p(e) {
77
- e ? await a() : L.open(async (d) => {
78
- await a(d);
79
- });
80
- async function a(d) {
81
- var u;
82
- (u = v.value) == null || u.showSheet(
83
- !0,
84
- "CREDIT",
85
- e ? await _.readById(e._id) : void 0,
86
- d
87
- );
88
- }
89
- }
90
- async function T(e) {
91
- await w(
92
- async () => {
93
- e.campaign._id ? await _.update(e.campaign._id, e) : await _.create(e), await c.read("CREDIT");
94
- },
95
- {
96
- message: `${e.campaign._id ? "Updating" : "Creating"} credit program`,
97
- successMessage: `Credit program ${e.campaign._id ? "updated" : "created"} successfully`
98
- }
99
- );
100
- }
101
- return N(async () => {
102
- await B(async () => {
103
- await c.read("CREDIT");
104
- });
105
- }), (e, a) => {
106
- const d = i("FmPageHead"), u = i("FmSearch"), $ = i("FmTable"), b = i("FmButton"), E = i("FmListItem"), K = i("FmList"), P = i("FmCard");
107
- return l(), f(g, null, [
108
- r(d, {
109
- title: "Credit",
110
- actions: o(m).length > 0 ? [R] : [],
111
- "onClick:action": a[0] || (a[0] = () => p())
112
- }, null, 8, ["actions"]),
113
- s("div", te, [
114
- r(u, {
115
- modelValue: o(n).searchKey,
116
- "onUpdate:modelValue": a[1] || (a[1] = (t) => o(n).searchKey = t),
117
- class: "hidden xs:block border-b-2 border-fm-color-neutral-gray-100",
118
- placeholder: "search",
119
- collapsible: ""
120
- }, null, 8, ["modelValue"]),
121
- o(c).campaigns.credit && o(c).campaigns.credit.length > 0 ? (l(), f(g, { key: 0 }, [
122
- s("div", oe, [
123
- s("div", ae, [
124
- r(Y, {
125
- modelValue: o(n).location,
126
- "onUpdate:modelValue": a[2] || (a[2] = (t) => o(n).location = t),
127
- label: "Location: ",
128
- "show-item-label": !0,
129
- icon: "storefront",
130
- placement: "bottom-start",
131
- items: o(I).locationItems
132
- }, null, 8, ["modelValue", "items"])
133
- ]),
134
- r(u, {
135
- modelValue: o(n).searchKey,
136
- "onUpdate:modelValue": a[3] || (a[3] = (t) => o(n).searchKey = t),
137
- class: "xs:hidden",
138
- placeholder: "search",
139
- collapsible: ""
140
- }, null, 8, ["modelValue"])
141
- ]),
142
- r($, {
143
- class: "xs:hidden",
144
- "row-data": o(m),
145
- "column-defs": D,
146
- "search-value": o(n).searchKey,
147
- "column-filter": [],
148
- onRowClick: a[4] || (a[4] = (t) => p(t.original)),
149
- "hide-footer": o(m).length < 10
150
- }, null, 8, ["row-data", "search-value", "hide-footer"]),
151
- r(K, { class: "hidden xs:flex flex-col mx-[-24px]" }, {
152
- default: h(() => [
153
- (l(!0), f(g, null, j(o(m).filter(
154
- (t) => t.name.toLowerCase().includes(o(n).searchKey.toLowerCase())
155
- ), (t) => (l(), C(E, {
156
- key: t._id.toString(),
157
- onClick: (F) => p(t),
158
- class: "py-12 px-16 flex items-center justify-between border-b border-fm-color-neutral-gray-100"
159
- }, {
160
- default: h(() => [
161
- s("div", se, [
162
- s("div", ne, [
163
- (l(), C(M(o(S)(t)))),
164
- s("div", re, y(t.currentReceive ?? 0) + " used ", 1)
165
- ]),
166
- s("div", ie, [
167
- s("div", le, y(t.name), 1),
168
- s("div", ce, y(o(V)(t)), 1)
169
- ]),
170
- s("div", me, " Credit received: " + y(t.currentReceive ?? 0), 1)
171
- ]),
172
- r(b, {
173
- icon: "delete",
174
- "icon-color": "neutral-gray-400",
175
- variant: "tertiary",
176
- onClick: (F) => (F.stopPropagation(), x(t))
177
- }, null, 8, ["onClick"])
178
- ]),
179
- _: 2
180
- }, 1032, ["onClick"]))), 128))
181
- ]),
182
- _: 1
183
- }),
184
- o(m).length == 0 ? (l(), f("div", de, pe)) : H("", !0)
185
- ], 64)) : (l(), C(P, {
186
- key: 1,
187
- variant: "outlined",
188
- class: "w-full flex flex-col items-center justify-center gap-y-24 p-24"
189
- }, {
190
- default: h(() => [
191
- fe,
192
- ye,
193
- r(b, {
194
- variant: "primary",
195
- label: "Create credit program",
196
- icon: "add",
197
- onClick: a[5] || (a[5] = (t) => p())
198
- })
199
- ]),
200
- _: 1
201
- })),
202
- r(Z, {
203
- ref_key: "sheetRef",
204
- ref: v,
205
- "onSubmit:modelValue": T
206
- }, null, 512)
207
- ])
208
- ], 64);
209
- };
210
- }
211
- });
212
- export {
213
- Re as default
214
- };