@feedmepos/mf-connect 0.0.39-prod → 0.1.0-beta.2

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 (101) hide show
  1. package/dist/Analytic-DSD9TsKr.js +622 -0
  2. package/dist/{App-X3fNEBF3.js → App-D8a5eW51.js} +250 -249
  3. package/dist/Broadcast-C8jgMe6g.js +223 -0
  4. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-CRYS_tzZ.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-pG8WvV4I.js} +20 -20
  5. package/dist/Card-C1K7ULPo.js +825 -0
  6. package/dist/Collections-lMrdPUuM.js +453 -0
  7. package/dist/Credit-CJfU5tP4.js +220 -0
  8. package/dist/{EditCampaignSheet.vue_vue_type_script_setup_true_lang-DoZyevfa.js → EditCampaignSheet.vue_vue_type_script_setup_true_lang-BYoaa_-x.js} +1042 -1011
  9. package/dist/EffectSheet.vue_vue_type_style_index_0_lang-CzEtOmp0.js +345 -0
  10. package/dist/Experience-Bp2ki8gU.js +221 -0
  11. package/dist/Game-BpTf6ebE.js +255 -0
  12. package/dist/ImageInput.vue_vue_type_script_setup_true_lang-rWUkV9gn.js +144 -0
  13. package/dist/{MainLayout-DpZC6o3R.js → LottieAnimation.vue_vue_type_script_setup_true_lang-CyGJxUol.js} +19 -53
  14. package/dist/MainLayout-B1aJoR95.js +41 -0
  15. package/dist/Marketing-BiKE2gxA.js +316 -0
  16. package/dist/Member-BSWyy32a.js +69 -0
  17. package/dist/MemberList-CHlGREyR.js +1733 -0
  18. package/dist/MemberOverview-wL_ailso.js +58 -0
  19. package/dist/{MemberTransactions-DueaXBCy.js → MemberTransactions-BzHiXCnp.js} +1 -1
  20. package/dist/MessageInput.vue_vue_type_script_setup_true_lang-e-zWg08J.js +432 -0
  21. package/dist/Mission-8IGT3T2C.js +261 -0
  22. package/dist/Point-CbbJ6ohd.js +222 -0
  23. package/dist/Promotion-BYXCJa_S.js +247 -0
  24. package/dist/{RuleGroup.vue_vue_type_script_setup_true_lang-_RX1J0Br.js → RuleGroup.vue_vue_type_script_setup_true_lang-Bruh-umZ.js} +557 -557
  25. package/dist/Segment-DXDNM0yd.js +437 -0
  26. package/dist/Setting-CLpvvZTv.js +1901 -0
  27. package/dist/Store-C6-P6bwc.js +1511 -0
  28. package/dist/StoreRewards-CUM2irXK.js +401 -0
  29. package/dist/{StoreTransactions.vue_vue_type_script_setup_true_lang-CLFiuO5k.js → StoreTransactions.vue_vue_type_script_setup_true_lang-JaRdmqif.js} +10 -10
  30. package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-CoMQBL4P.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-DEb4OBcX.js} +1 -1
  31. package/dist/{Tier-CftEoP_R.js → Tier-DZTDxWBo.js} +481 -453
  32. package/dist/{Title-BsavXbYh.js → Title-C2Dr5ceK.js} +314 -295
  33. package/dist/Transaction-BL4mS29d.js +39 -0
  34. package/dist/Voucher-Cx0r2-df.js +490 -0
  35. package/dist/ZodTextField.vue_vue_type_script_setup_true_lang-DWuAODUF.js +56 -0
  36. package/dist/{app-BNmAx3zq.js → app-B_xuZ5HB.js} +1 -1
  37. package/dist/app-wE5HTF_Y.js +5762 -0
  38. package/dist/app.js +5 -3
  39. package/dist/{business-DGL4Ayx0.js → business-DSv8zM8C.js} +1 -1
  40. package/dist/{campaign-D94sS1kM.js → campaign-7y5qquHZ.js} +5 -3
  41. package/dist/{collection.fn-BHJ1ISqO.js → collection.fn-BxVZQAx0.js} +2 -2
  42. package/dist/dto-Ew1QwLci.js +2778 -0
  43. package/dist/{effect-CFRICzlM.js → effect-BzPh8fRI.js} +9 -9
  44. package/dist/{export-w2o9NYcy.js → export-C9tDplkA.js} +3 -3
  45. package/dist/{helper-CUDWQ8vq.js → helper-Sz7oQ0F4.js} +1 -1
  46. package/dist/{index-BGuLhEym.js → index-BQm0C3Jm.js} +3 -3
  47. package/dist/{index-BjwyxNSp.js → index-C-SOz7jt.js} +1 -1
  48. package/dist/{index-BcWJcD9f.js → index-C0lpADCo.js} +1 -1
  49. package/dist/{index-DIq2KVis.js → index-C3_4GUiI.js} +1 -1
  50. package/dist/{index-BPEV5Tzg.js → index-D-2nFLsg.js} +59 -47
  51. package/dist/{index-CFMBSL24.js → index-DBMaUGYI.js} +2 -2
  52. package/dist/{index-CpwFQFTV.js → index-DH_1nOJ_.js} +3 -3
  53. package/dist/index-Dy4pmQpt.js +29193 -0
  54. package/dist/{index-BQ6isIeo.js → index-_3qBsogG.js} +1 -1
  55. package/dist/index-gIRszcHf.js +3 -0
  56. package/dist/{index-VjUw31dN.js → index-tv4t0Pnh.js} +1 -1
  57. package/dist/{index-tZ1aqhks.js → index-z0IfdrZk.js} +319 -281
  58. package/dist/{index.esm2017-zciuPty-.js → index.esm2017-BnKJDxUo.js} +55 -55
  59. package/dist/{loading-GuXe5bYG.js → loading-Ds-yFYhc.js} +469 -460
  60. package/dist/{membership-BHWJVI3e.js → membership-DaiVw9qF.js} +3 -3
  61. package/dist/money-BHtBdZoz.js +15 -0
  62. package/dist/number-CZhcB8ef.js +12 -0
  63. package/dist/{rule-MgNa_8FF.js → rule-Cd2M6Ri2.js} +2 -2
  64. package/dist/{rule-builder-BsBCWzq_.js → rule-builder-B6og27Q1.js} +1 -1
  65. package/dist/style.css +1 -1
  66. package/dist/{template-D6k3lusq.js → template-DouRWBpv.js} +63 -63
  67. package/dist/{usePagination-JoYaROkV.js → usePagination-BeF5K3M7.js} +85 -85
  68. package/dist/vue-i18n-BTlOChXs.js +2365 -0
  69. package/dist/{xlsx-ClrA4KOh.js → xlsx-SahfXQ70.js} +517 -517
  70. package/dist/zod-Bg2FbC-D.js +90 -0
  71. package/package.json +7 -4
  72. package/dist/Analytic-DMFueUju.js +0 -620
  73. package/dist/Broadcast-YIfWIXeA.js +0 -216
  74. package/dist/Card-BIxlgQm7.js +0 -824
  75. package/dist/Collections-M6DaHM2W.js +0 -441
  76. package/dist/Credit-BtRy-xoY.js +0 -214
  77. package/dist/EffectSheet.vue_vue_type_style_index_0_lang-D5DNTBSQ.js +0 -344
  78. package/dist/Experience-DGm1lnqj.js +0 -211
  79. package/dist/Game-B8-lG7qq.js +0 -250
  80. package/dist/ImageInput.vue_vue_type_script_setup_true_lang-ByhTB9Ie.js +0 -144
  81. package/dist/Marketing-DtG3AIWr.js +0 -309
  82. package/dist/Member-K443-9Vy.js +0 -92
  83. package/dist/MemberList-CYXHXFTL.js +0 -1735
  84. package/dist/MemberOverview-C2n9oJZh.js +0 -58
  85. package/dist/MessageInput.vue_vue_type_script_setup_true_lang-Bk2HLVmt.js +0 -203
  86. package/dist/Mission-CN5umXXA.js +0 -248
  87. package/dist/Point-XAm6H2p_.js +0 -220
  88. package/dist/Promotion-DsrA4KiE.js +0 -244
  89. package/dist/Segment-CZGGHoAu.js +0 -435
  90. package/dist/Setting-BjfxLKyp.js +0 -1870
  91. package/dist/Store-D_B-vhh3.js +0 -1513
  92. package/dist/StoreRewards-BjHffUKj.js +0 -429
  93. package/dist/Transaction-CdxzoKDG.js +0 -36
  94. package/dist/Voucher-B_9Nv1Mr.js +0 -485
  95. package/dist/ZodTextField.vue_vue_type_script_setup_true_lang-3LlSDiq0.js +0 -140
  96. package/dist/app--1Ks5Hms.js +0 -2974
  97. package/dist/dto-X0Eeujxx.js +0 -1151
  98. package/dist/index-BPNG8N-w.js +0 -11
  99. package/dist/index-DWM9MWGj.js +0 -28058
  100. package/dist/money-CrttVpCp.js +0 -15
  101. package/dist/number-CIndGU4O.js +0 -12
@@ -1,441 +0,0 @@
1
- var ee = Object.defineProperty;
2
- var oe = (f, r, d) => r in f ? ee(f, r, { enumerable: !0, configurable: !0, writable: !0, value: d }) : f[r] = d;
3
- var z = (f, r, d) => oe(f, typeof r != "symbol" ? r + "" : r, d);
4
- import { defineComponent as G, ref as p, computed as H, watch as O, resolveComponent as u, openBlock as y, createBlock as L, unref as e, isRef as K, withCtx as I, createElementVNode as b, createVNode as s, createElementBlock as P, Fragment as R, renderList as te, createCommentVNode as U, onMounted as ae, h as T } from "vue";
5
- import { h as j } from "./moment-BWErdI6_.js";
6
- import { components as le } from "@feedmepos/ui-library";
7
- import { u as J, a as ne } from "./loading-GuXe5bYG.js";
8
- import { J as se } from "./JsonViewer-v8_C7l5N.js";
9
- import { u as re } from "./app-wDQR6dpb.js";
10
- import { useRoute as Q, useRouter as ie } from "vue-router";
11
- import { c as N } from "./index-BjwyxNSp.js";
12
- import { u as Y, w as ue } from "./xlsx-ClrA4KOh.js";
13
- import { g as de } from "./user-Bm4KttFq.js";
14
- import { u as ce, _ as me } from "./usePagination-JoYaROkV.js";
15
- import { m as pe } from "./index-DIq2KVis.js";
16
- import { o as fe } from "./objectId-dwaoBfJX.js";
17
- const ge = /* @__PURE__ */ b("div", { class: "fm-typo-en-body-lg-600" }, "Code type", -1), be = { class: "space-y-16" }, Ce = /* @__PURE__ */ b("div", { class: "fm-typo-en-body-lg-600" }, "Settings", -1), ve = { class: "gap-16 grid grid-cols-2" }, he = { class: "flex items-center gap-8" }, ye = /* @__PURE__ */ G({
18
- __name: "CreateCollectionSheet",
19
- emits: ["success"],
20
- setup(f, { expose: r, emit: d }) {
21
- const { minor: S } = J, F = Q(), k = p(), _ = p(!1), E = d, g = p(!1);
22
- function q(l) {
23
- g.value = l, l && (a.value = {
24
- quantity: 1,
25
- code: "",
26
- codeConfig: {
27
- length: 8,
28
- charset: "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",
29
- prefix: "",
30
- suffix: "",
31
- pattern: "########"
32
- }
33
- });
34
- }
35
- const a = p({
36
- quantity: 1,
37
- code: "",
38
- codeConfig: {
39
- length: 8,
40
- charset: "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",
41
- prefix: "",
42
- suffix: "",
43
- pattern: "########"
44
- }
45
- }), A = [
46
- {
47
- label: "Bulk codes",
48
- value: "bulk",
49
- sublabel: "Bulk generate unique codes"
50
- },
51
- {
52
- label: "Custom code",
53
- value: "single",
54
- sublabel: "Enter your own custom codes"
55
- }
56
- ], B = [
57
- {
58
- label: "Alphanumeric",
59
- value: "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
60
- },
61
- {
62
- label: "Alphabetic",
63
- value: "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
64
- },
65
- { label: "Alphabetic Lowercase", value: "abcdefghijklmnopqrstuvwxyz" },
66
- { label: "Alphabetic Uppercase", value: "ABCDEFGHIJKLMNOPQRSTUVWXYZ" },
67
- { label: "Numbers", value: "0123456789" },
68
- { label: "Custom", value: "" }
69
- ], C = p(B[0].value), c = p("bulk"), x = p(!1), D = H(() => F.params.id);
70
- async function n(l) {
71
- var o;
72
- await ((o = k.value) == null ? void 0 : o.validateInputs()), _.value && await S(
73
- async () => {
74
- await N.createCollectionByCampaignId(D.value, l), await E("success");
75
- },
76
- {
77
- message: "Creating claim(s)",
78
- successMessage: "Claim(s) created"
79
- }
80
- );
81
- }
82
- return r({
83
- showSheet: q
84
- }), O(
85
- () => c.value,
86
- (l, o) => {
87
- o != l && (a.value.code = "", a.value.codeConfig.length = 8, a.value.codeConfig.charset = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", a.value.codeConfig.prefix = "", a.value.codeConfig.suffix = "", a.value.codeConfig.pattern = "########");
88
- }
89
- ), O(
90
- () => a.value.codeConfig.length,
91
- (l, o) => {
92
- l != o && (a.value.codeConfig.pattern = "#".repeat(Math.min(16, Number(l))));
93
- }
94
- ), (l, o) => {
95
- const v = u("FmRadio"), i = u("FmRadioGroup"), V = u("FmSwitch"), M = u("FmStepperField"), w = u("FmSelect"), h = u("FmTextField"), W = u("FmTextarea"), X = u("FmForm"), $ = u("FmButton"), Z = u("FmSideSheet");
96
- return y(), L(Z, {
97
- "max-width": 560,
98
- "dismiss-away": !0,
99
- header: "Create collection",
100
- modelValue: e(g),
101
- "onUpdate:modelValue": [
102
- o[14] || (o[14] = (t) => K(g) ? g.value = t : null),
103
- o[15] || (o[15] = (t) => g.value = t)
104
- ]
105
- }, {
106
- "side-sheet-footer": I(() => [
107
- b("div", he, [
108
- s($, {
109
- label: "Save",
110
- onClick: o[12] || (o[12] = (t) => n(e(a))),
111
- loading: e(re)().isLoading
112
- }, null, 8, ["loading"]),
113
- s($, {
114
- label: "Cancel",
115
- type: "button",
116
- variant: "tertiary",
117
- onClick: o[13] || (o[13] = (t) => g.value = !1)
118
- })
119
- ])
120
- ]),
121
- default: I(() => [
122
- s(se, { json: e(a) }, null, 8, ["json"]),
123
- s(X, {
124
- ref_key: "form",
125
- ref: k,
126
- class: "space-y-40",
127
- onValidationSuccess: o[10] || (o[10] = (t) => _.value = !0),
128
- onValidationFailed: o[11] || (o[11] = (t) => _.value = !1)
129
- }, {
130
- default: I(() => [
131
- b("div", null, [
132
- ge,
133
- s(i, {
134
- modelValue: e(c),
135
- "onUpdate:modelValue": o[0] || (o[0] = (t) => K(c) ? c.value = t : null),
136
- inline: !1
137
- }, {
138
- default: I(() => [
139
- (y(), P(R, null, te(A, (t) => s(v, {
140
- key: t.value,
141
- value: t.value,
142
- label: t.label,
143
- sublabel: t.sublabel
144
- }, null, 8, ["value", "label", "sublabel"])), 64))
145
- ]),
146
- _: 1
147
- }, 8, ["modelValue"])
148
- ]),
149
- b("div", be, [
150
- Ce,
151
- e(c) === "bulk" ? (y(), P(R, { key: 0 }, [
152
- s(V, {
153
- "model-value": e(x),
154
- "label-placement": "right",
155
- value: "true",
156
- label: "Advance code setting",
157
- required: !0,
158
- "onUpdate:modelValue": o[1] || (o[1] = () => x.value = !e(x))
159
- }, null, 8, ["model-value"]),
160
- e(x) ? (y(), P(R, { key: 0 }, [
161
- s(M, {
162
- modelValue: e(a).codeConfig.length,
163
- "onUpdate:modelValue": o[2] || (o[2] = (t) => e(a).codeConfig.length = t),
164
- label: "Code length",
165
- max: 16,
166
- min: 1,
167
- rules: [
168
- (t) => Number(t) >= 1 || "Code length must at least 1",
169
- (t) => Number(t) <= 16 || "Code length must less than 16"
170
- ],
171
- required: !0
172
- }, null, 8, ["modelValue", "rules"]),
173
- s(w, {
174
- label: "Charset",
175
- "model-value": e(C),
176
- items: B,
177
- "helper-text": e(a).codeConfig.charset.length > 62 ? `${e(a).codeConfig.charset.substring(0, 62)}...` : e(a).codeConfig.charset,
178
- "onUpdate:modelValue": o[3] || (o[3] = (t) => {
179
- C.value = t, e(a).codeConfig.charset = t;
180
- })
181
- }, null, 8, ["model-value", "helper-text"]),
182
- e(C) === "" ? (y(), L(h, {
183
- key: 0,
184
- modelValue: e(a).codeConfig.charset,
185
- "onUpdate:modelValue": o[4] || (o[4] = (t) => e(a).codeConfig.charset = t),
186
- label: "Custom Charset",
187
- required: ""
188
- }, null, 8, ["modelValue"])) : U("", !0),
189
- b("div", ve, [
190
- s(h, {
191
- modelValue: e(a).codeConfig.prefix,
192
- "onUpdate:modelValue": o[5] || (o[5] = (t) => e(a).codeConfig.prefix = t),
193
- label: "Prefix (Optional)"
194
- }, null, 8, ["modelValue"]),
195
- s(h, {
196
- modelValue: e(a).codeConfig.suffix,
197
- "onUpdate:modelValue": o[6] || (o[6] = (t) => e(a).codeConfig.suffix = t),
198
- label: "Suffix (Optional)"
199
- }, null, 8, ["modelValue"])
200
- ]),
201
- s(h, {
202
- modelValue: e(a).codeConfig.pattern,
203
- "onUpdate:modelValue": o[7] || (o[7] = (t) => e(a).codeConfig.pattern = t),
204
- label: "Pattern",
205
- required: !0
206
- }, null, 8, ["modelValue"])
207
- ], 64)) : U("", !0),
208
- s(h, {
209
- modelValue: e(a).quantity,
210
- "onUpdate:modelValue": o[8] || (o[8] = (t) => e(a).quantity = t),
211
- label: "Number of code",
212
- rules: [
213
- (t) => t >= 1 || "Quantity cannot be less than 1",
214
- (t) => t <= 1e4 || "Quantity cannot more than 10,000"
215
- ],
216
- required: !0,
217
- "helper-text": `${e(a).quantity} claim will be created`
218
- }, null, 8, ["modelValue", "rules", "helper-text"])
219
- ], 64)) : U("", !0),
220
- e(c) !== "bulk" ? (y(), L(W, {
221
- key: 1,
222
- modelValue: e(a).code,
223
- "onUpdate:modelValue": o[9] || (o[9] = (t) => e(a).code = t),
224
- label: "Custom Code",
225
- rules: [(t) => e(c) != "single" || !!t || "Custom code is required"],
226
- placeholder: "(For multiple codes, please enter in the new row.)"
227
- }, null, 8, ["modelValue", "rules"])) : U("", !0)
228
- ])
229
- ]),
230
- _: 1
231
- }, 512)
232
- ]),
233
- _: 1
234
- }, 8, ["modelValue"]);
235
- };
236
- }
237
- });
238
- class xe {
239
- constructor() {
240
- z(this, "data", []);
241
- }
242
- addRecord(r) {
243
- this.data.push(r);
244
- }
245
- buildExcel() {
246
- const r = Y.book_new(), d = Y.json_to_sheet(this.data);
247
- return Y.book_append_sheet(r, d, "Collection"), r;
248
- }
249
- }
250
- const m = {
251
- sortBy: "_id",
252
- descending: !1,
253
- rowsPerPage: 1e3,
254
- page: 1,
255
- rowsNumber: 0
256
- }, Ve = { class: "px-24 flex flex-col gap-y-32 pb-24" }, we = { class: "flex items-center justify-end py-4 xs:hidden" }, Me = /* @__PURE__ */ G({
257
- __name: "Collections",
258
- setup(f) {
259
- const r = ie(), d = Q(), S = p(), F = H(() => d.params.id), k = p(!1), { custom: _ } = J, E = [
260
- {
261
- header: "ID/Code",
262
- accessorKey: "_id",
263
- cell(n) {
264
- return T("div", { class: "flex items-center" }, [
265
- T(le.FmIcon, {
266
- name: "content_copy",
267
- outline: !0,
268
- size: "sm",
269
- class: "cursor-pointer mr-4",
270
- onClick: (l) => {
271
- l.preventDefault(), l.stopPropagation(), ne(
272
- n.row.original.code || n.row.original._id.toString()
273
- );
274
- }
275
- }),
276
- T(
277
- "div",
278
- { class: "pr-2 text-ellipsis overflow-hidden" },
279
- n.row.original.code || n.row.original._id.toString()
280
- )
281
- ]);
282
- }
283
- },
284
- {
285
- header: "User",
286
- accessorKey: "user",
287
- enableSorting: !1,
288
- cell(n) {
289
- const l = n.row.original.pf_user;
290
- return de(l);
291
- }
292
- },
293
- {
294
- header: "Phone",
295
- accessorFn: (n) => {
296
- var l;
297
- return ((l = n.pf_user) == null ? void 0 : l.phoneNumber) || "-";
298
- },
299
- accessorKey: "pf_user.phoneNumber"
300
- },
301
- {
302
- header: "Balance",
303
- accessorKey: "balance"
304
- },
305
- {
306
- header: "Created at",
307
- accessorKey: "_id",
308
- accessorFn: (n) => j(fe(n._id.toString())).format("DD MMM YYYY")
309
- },
310
- {
311
- header: "Nearest expired at",
312
- accessorKey: "expiryBalance",
313
- accessorFn: (n) => {
314
- var l;
315
- return n.expiryBalance && n.expiryBalance.length ? j((l = n.expiryBalance) == null ? void 0 : l[0].expiredAt).format("DD MMM YYYY") : "Never expires";
316
- }
317
- }
318
- ], g = {
319
- "$connect-STORE_REWARD_COLLECTIONS": pe.readCollectionsByRewardId,
320
- "$connect-CAMPAIGN_VOUCHER_COLLECTIONS": N.readCollectionsByCampaignId
321
- }, q = (n) => {
322
- const l = g[d.name];
323
- return (o) => l(n, o);
324
- }, { tableMeta: a, rowData: A, onSort: B, debouncedFetchData: C, onSearch: c } = ce(q(F.value));
325
- async function x() {
326
- var n;
327
- await C(), (n = S.value) == null || n.showSheet(!1);
328
- }
329
- async function D() {
330
- k.value || _(
331
- async () => {
332
- var v;
333
- const n = new xe(), l = (await N.readCollectionsByCampaignId(F.value, {
334
- limit: 1,
335
- skip: 0,
336
- sortBy: m.sortBy,
337
- descending: m.descending
338
- })).meta.totalResources ?? 0, o = m.rowsPerPage;
339
- for (let i = 0; i < l; i += o) {
340
- const V = {
341
- ...m,
342
- limit: o,
343
- skip: (m.page - 1) * m.rowsPerPage,
344
- sortBy: m.sortBy,
345
- descending: m.descending
346
- }, M = await N.readCollectionsByCampaignId(
347
- F.value,
348
- V
349
- );
350
- for await (const w of M.resources) {
351
- const h = {
352
- Id: (w == null ? void 0 : w.code) || ((v = w._id) == null ? void 0 : v.toString()) || ""
353
- };
354
- n.addRecord(h);
355
- }
356
- m.page++;
357
- }
358
- await ue(
359
- n.buildExcel(),
360
- `members-${(/* @__PURE__ */ new Date()).toISOString()}.xlsx`,
361
- {
362
- bookType: "xlsx",
363
- bookSST: !1,
364
- type: "array"
365
- }
366
- ), m.page = 1;
367
- },
368
- {
369
- isLoading: k
370
- }
371
- );
372
- }
373
- return ae(async () => {
374
- await C();
375
- }), (n, l) => {
376
- const o = u("FmPageHead"), v = u("FmSearch");
377
- return y(), P(R, null, [
378
- s(o, {
379
- title: "Collections",
380
- "back-button": !0,
381
- actions: [
382
- { label: "Export", value: "export", isPrimary: !1 },
383
- {
384
- label: "Create collection",
385
- value: "create",
386
- isPrimary: !0
387
- }
388
- ],
389
- "onClick:back": l[0] || (l[0] = (i) => e(r).back()),
390
- "onClick:action": l[1] || (l[1] = (i) => {
391
- var V;
392
- i === "create" && ((V = e(S)) == null || V.showSheet(!0)), i === "export" && D();
393
- })
394
- }),
395
- b("div", Ve, [
396
- s(v, {
397
- class: "hidden xs:flex border-b border-fm-color-neutral-gray-100",
398
- modelValue: e(a).searchValue,
399
- "onUpdate:modelValue": [
400
- l[2] || (l[2] = (i) => e(a).searchValue = i),
401
- e(c)
402
- ],
403
- placeholder: "Search",
404
- collapsible: ""
405
- }, null, 8, ["modelValue", "onUpdate:modelValue"]),
406
- b("div", we, [
407
- s(v, {
408
- modelValue: e(a).searchValue,
409
- "onUpdate:modelValue": [
410
- l[3] || (l[3] = (i) => e(a).searchValue = i),
411
- e(c)
412
- ],
413
- placeholder: "Search",
414
- collapsible: ""
415
- }, null, 8, ["modelValue", "onUpdate:modelValue"])
416
- ]),
417
- s(me, {
418
- loading: e(a).isLoading,
419
- "row-data": e(A),
420
- "column-defs": E,
421
- "row-count": e(a).totalRows,
422
- "page-count": e(a).pageCount,
423
- "page-index": e(a).pageIndex,
424
- "page-size": e(a).pageSize,
425
- "shrink-at": !1,
426
- onSortChange: e(B),
427
- onPageChange: l[4] || (l[4] = (i) => e(C)({ pageSize: i.pageSize, pageIndex: i.pageIndex }))
428
- }, null, 8, ["loading", "row-data", "row-count", "page-count", "page-index", "page-size", "onSortChange"]),
429
- s(ye, {
430
- ref_key: "sheetRef",
431
- ref: S,
432
- onSuccess: x
433
- }, null, 512)
434
- ])
435
- ], 64);
436
- };
437
- }
438
- });
439
- export {
440
- Me as default
441
- };
@@ -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-GuXe5bYG.js";
5
- import { u as W } from "./business-DGL4Ayx0.js";
6
- import { u as X } from "./campaign-D94sS1kM.js";
7
- import { g as S, b as V } from "./dto-X0Eeujxx.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-DoZyevfa.js";
10
- import { u as ee } from "./template-D6k3lusq.js";
11
- import { c as _ } from "./index-BjwyxNSp.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
- };