@feedmepos/mf-connect 0.1.56-prod → 0.1.58-prod

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (128) hide show
  1. package/package.json +1 -1
  2. package/dist/Analytic-XUI4rZyP.js +0 -427
  3. package/dist/App-vv5J1Ebe.js +0 -4630
  4. package/dist/Bin-D4V36uXK.js +0 -166
  5. package/dist/Broadcast-BvW27G77.js +0 -233
  6. package/dist/CampaignTypeDialog.vue_vue_type_script_setup_true_lang-D2MC6Gy1.js +0 -121
  7. package/dist/Card-C7xLv1Fb.js +0 -911
  8. package/dist/ChipMenu.vue_vue_type_script_setup_true_lang-BPpZZNkr.js +0 -97
  9. package/dist/Collections-BKfS-bGL.js +0 -458
  10. package/dist/Credit-CGmWQq0t.js +0 -228
  11. package/dist/CustomSelect.vue_vue_type_script_setup_true_lang-Du7fRSZC.js +0 -128
  12. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-C2p6_R01.js +0 -2194
  13. package/dist/EffectSheet.vue_vue_type_style_index_0_lang-BGlaqjWp.js +0 -348
  14. package/dist/Experience-CT7Yab3W.js +0 -229
  15. package/dist/FileSaver.min-NlMItPOc.js +0 -74
  16. package/dist/FilterChip.vue_vue_type_script_setup_true_lang-DaU-9GzO.js +0 -129
  17. package/dist/Game-DtW4rtYQ.js +0 -284
  18. package/dist/ImageInput.vue_vue_type_script_setup_true_lang-D1KQpDGg.js +0 -144
  19. package/dist/Index-Bs5ob9Km.js +0 -259
  20. package/dist/JsonViewer-v8_C7l5N.js +0 -87
  21. package/dist/LottieAnimation.vue_vue_type_script_setup_true_lang-CyGJxUol.js +0 -18737
  22. package/dist/MainLayout-B1aJoR95.js +0 -41
  23. package/dist/Marketing-tA350rTd.js +0 -319
  24. package/dist/Member-CZoTXgKz.js +0 -279
  25. package/dist/MemberList-ChwyPtmW.js +0 -1607
  26. package/dist/MemberOverview-wL_ailso.js +0 -58
  27. package/dist/MemberTransactions-Cchtvxm9.js +0 -45
  28. package/dist/MessageInput.vue_vue_type_script_setup_true_lang-Bo0EnHBx.js +0 -60553
  29. package/dist/Mission-DDpelLqN.js +0 -302
  30. package/dist/Overview-Da3ewBat.js +0 -1079
  31. package/dist/Point-CggE8VUk.js +0 -232
  32. package/dist/Promotion-DxvbZhgQ.js +0 -289
  33. package/dist/Queue-fIxlHrMd.js +0 -260
  34. package/dist/Record-Bv90_VUG.js +0 -341
  35. package/dist/Reward-BWYLk7aC.js +0 -442
  36. package/dist/RewardGroup.vue_vue_type_script_setup_true_lang-CjYEtENe.js +0 -150
  37. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-Ak1R8Y2a.js +0 -1763
  38. package/dist/Segment-_VGdBy3a.js +0 -882
  39. package/dist/SelectItems.vue_vue_type_script_setup_true_lang-Dm4hF1n1.js +0 -181
  40. package/dist/SendCollectionSheet.vue_vue_type_script_setup_true_lang-DWDMhmNr.js +0 -188
  41. package/dist/SendVoucherSheet.vue_vue_type_script_setup_true_lang-Czy25PII.js +0 -147
  42. package/dist/Setting-7fTz1dJa.js +0 -1936
  43. package/dist/Store-TQHKR__B.js +0 -1842
  44. package/dist/StoreRewards-DZy1ZwiI.js +0 -423
  45. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-Cae25Vr6.js +0 -995
  46. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-BVVEzpyP.js +0 -139
  47. package/dist/Tier-CK53vdbl.js +0 -895
  48. package/dist/Title-CGWPq_FF.js +0 -566
  49. package/dist/Transaction-DjJ03PfX.js +0 -39
  50. package/dist/UserRuleGroup.vue_vue_type_script_setup_true_lang-DNSdyxrF.js +0 -130
  51. package/dist/Voucher-D6RuJjNn.js +0 -384
  52. package/dist/VoucherEditor.vue_vue_type_script_setup_true_lang-D4iCOq3V.js +0 -419
  53. package/dist/ZodTextField.vue_vue_type_script_setup_true_lang-BFz8RvY_.js +0 -56
  54. package/dist/_commonjsHelpers-BkfeUUK-.js +0 -28
  55. package/dist/_plugin-vue_export-helper-CHgC5LLL.js +0 -9
  56. package/dist/app-BLlAxdVk.js +0 -57962
  57. package/dist/app-_rmIFJ8M.js +0 -7057
  58. package/dist/app-wDQR6dpb.js +0 -39
  59. package/dist/app.js +0 -6
  60. package/dist/business-gJ9fK_2b.js +0 -82
  61. package/dist/campaign-BfznfcHc.js +0 -94
  62. package/dist/campaign-C_Yq-ffV.js +0 -1810
  63. package/dist/campaign-CpzFl8Vr.js +0 -4
  64. package/dist/campaign.enum-Dsbpz7BO.js +0 -20
  65. package/dist/campaign.fn-C6vKb-lp.js +0 -758
  66. package/dist/collectible.enum-DNpj_oyC.js +0 -19
  67. package/dist/collection.fn-Cgo0sPL2.js +0 -26
  68. package/dist/dto-CaSQ4Pp9.js +0 -216
  69. package/dist/effect-DuH74x-N.js +0 -78
  70. package/dist/email-addresses-DXr-Qqt9.js +0 -705
  71. package/dist/export-tMPFlVV0.js +0 -97
  72. package/dist/feedme.ico +0 -0
  73. package/dist/helper-CJTseW10.js +0 -71
  74. package/dist/index-8RETBwYy.js +0 -8861
  75. package/dist/index-B57kxqv7.js +0 -3
  76. package/dist/index-BNUuy_4R.js +0 -44
  77. package/dist/index-BSJ-4JYy.js +0 -146
  78. package/dist/index-BTpBLMHl.js +0 -3070
  79. package/dist/index-C6Iyn1Q6.js +0 -54
  80. package/dist/index-CWI06v9e.js +0 -31
  81. package/dist/index-CdnKwJuz.js +0 -30076
  82. package/dist/index-Cr_9Bqa1.js +0 -121
  83. package/dist/index-CuvNtC_M.js +0 -61
  84. package/dist/index-DTyfvK3U.js +0 -2130
  85. package/dist/index-Dn0gJspN.js +0 -32269
  86. package/dist/index-IHKkNyxb.js +0 -38
  87. package/dist/index-J3TDCX-5.js +0 -76
  88. package/dist/index-V9kRRAB1.js +0 -32
  89. package/dist/index-vh86FiIQ.js +0 -10
  90. package/dist/index.esm2017-P2nmohVw.js +0 -3069
  91. package/dist/loading-D5ZAAdUU.js +0 -71
  92. package/dist/lodash-B5I3zXaY.js +0 -3678
  93. package/dist/membership-xl9aKOQ_.js +0 -235
  94. package/dist/moment-D7p2TMB-.js +0 -2583
  95. package/dist/money-CIHN3jJZ.js +0 -15
  96. package/dist/number-BN4-Jdog.js +0 -12
  97. package/dist/object-qECH92oz.js +0 -26
  98. package/dist/objectId-dwaoBfJX.js +0 -7
  99. package/dist/objectid-Dh6RD0Tk.js +0 -145
  100. package/dist/plugins-CJlgzIv2.js +0 -208
  101. package/dist/reward-C8mezXzs.js +0 -36
  102. package/dist/rule-9VRIJFHZ.js +0 -1951
  103. package/dist/rule-builder-CZUgrDAw.js +0 -102
  104. package/dist/style.css +0 -4
  105. package/dist/template-aPJnNGLi.js +0 -190
  106. package/dist/tier-BJDhpH6X.js +0 -4
  107. package/dist/tiers/tier=1.png +0 -0
  108. package/dist/tiers/tier=2.png +0 -0
  109. package/dist/tiers/tier=3.png +0 -0
  110. package/dist/tiers/tier=4.png +0 -0
  111. package/dist/timezone-CpvXaiqq.js +0 -1151
  112. package/dist/titles/type=diamond.png +0 -0
  113. package/dist/titles/type=drinks.png +0 -0
  114. package/dist/titles/type=food.png +0 -0
  115. package/dist/titles/type=heart.png +0 -0
  116. package/dist/titles/type=medal.png +0 -0
  117. package/dist/titles/type=spend.png +0 -0
  118. package/dist/titles/type=thank-you.png +0 -0
  119. package/dist/titles/type=thumbs-up.png +0 -0
  120. package/dist/titles/type=years.png +0 -0
  121. package/dist/trigger-BfrtcBd-.js +0 -144
  122. package/dist/tslib.es6-BCqqvLQ_.js +0 -44
  123. package/dist/type_drinks-D6jnpvwV.js +0 -4
  124. package/dist/usePagination-Ds-cuHop.js +0 -223
  125. package/dist/user-Bt1C0yV5.js +0 -54
  126. package/dist/vue-i18n-OdHHHpEE.js +0 -2365
  127. package/dist/xlsx-BgB0dYfE.js +0 -15491
  128. package/dist/zod-Bg2FbC-D.js +0 -90
@@ -1,260 +0,0 @@
1
- import { defineComponent as h, h as n, ref as A, watch as B, onBeforeMount as U, resolveComponent as V, openBlock as z, createElementBlock as O, Fragment as q, createVNode as m, unref as o, createElementVNode as f } from "vue";
2
- import { u as L, _ as Y } from "./usePagination-Ds-cuHop.js";
3
- import { _ as S } from "./FilterChip.vue_vue_type_script_setup_true_lang-DaU-9GzO.js";
4
- import { c as u, a as G } from "./plugins-CJlgzIv2.js";
5
- import { useDialog as K, components as b } from "@feedmepos/ui-library";
6
- import { D as c, c as d } from "./index-BTpBLMHl.js";
7
- import "./index-8RETBwYy.js";
8
- import "./index-DTyfvK3U.js";
9
- import "./index-IHKkNyxb.js";
10
- import "./index-C6Iyn1Q6.js";
11
- import "./index-Dn0gJspN.js";
12
- import { h as y } from "./moment-D7p2TMB-.js";
13
- import { u as j } from "./vue-i18n-OdHHHpEE.js";
14
- import { u as H, v as W, w as $ } from "./index.esm2017-P2nmohVw.js";
15
- import { useRoute as Q } from "vue-router";
16
- import { g as J, S as X, u as Z } from "./index-CdnKwJuz.js";
17
- import { o as ee } from "./objectId-dwaoBfJX.js";
18
- const te = () => {
19
- if (!X.getBusinessId()) throw new Error("Invalid business ID");
20
- return Z("queues");
21
- }, oe = {
22
- async readImportMember(p, w) {
23
- return J(
24
- await te().get("", {
25
- params: { ...p, ...w }
26
- })
27
- );
28
- }
29
- };
30
- var ae = { firebase: { apiKey: "AIzaSyA_isPR1-9bX7UmRiJIhsIRNNwdn6DdmW4", authDomain: "feedme-253402.firebaseapp.com", databaseURL: "https://feedme-253402.firebaseio.com", projectId: "feedme-253402", storageBucket: "image.feedme.cc", messagingSenderId: "128512026847", appId: "1:128512026847:web:7c5c8ab7e8b90502dc616a", measurementId: "G-LTKS7N2HQS" }, assetBucketUrl: "static.feedme.cc", importFilesBucketUrl: "feedme-253402.appspot.com", clientId: "d5f8840d63dbb758b6c4ee2a5e8b013d15dd25e242c457481326062b83962476" };
31
- const re = { class: "p-24 flex flex-col gap-y-2" }, ne = { class: "flex items-center justify-between" }, se = { class: "flex gap-8 items-center w-full overflow-x-scroll" }, De = /* @__PURE__ */ h({
32
- __name: "Queue",
33
- setup(p) {
34
- const x = Q().query.type, { t: D } = j(), E = K(), v = [
35
- {
36
- header: "ID",
37
- accessorKey: "_id",
38
- meta: {
39
- maxWidth: "100px"
40
- },
41
- cell(t) {
42
- return n("div", { class: "flex items-center" }, [
43
- n(b.FmIcon, {
44
- name: "content_copy",
45
- outline: !0,
46
- size: "sm",
47
- class: "cursor-pointer mr-4",
48
- onClick: (e) => {
49
- e.preventDefault(), e.stopPropagation(), G(t.row.original._id.toString());
50
- }
51
- }),
52
- n(
53
- "div",
54
- { class: "pr-2 text-ellipsis overflow-hidden" },
55
- t.row.original._id.toString()
56
- )
57
- ]);
58
- },
59
- enableSorting: !1
60
- },
61
- {
62
- header: "Type",
63
- accessorFn: (t) => u.title(t.type.replace("_", " ")),
64
- enableSorting: !1
65
- },
66
- {
67
- header: "Status",
68
- accessorFn: (t) => {
69
- var e;
70
- return t.status ? u.title((e = t.status) == null ? void 0 : e.toString()) : "-";
71
- },
72
- cell(t) {
73
- const e = t.row.original.status;
74
- return n(b.FmChip, {
75
- label: e ? u.title(e) : "-",
76
- compact: !0,
77
- class: F(e)
78
- });
79
- },
80
- enableSorting: !1
81
- },
82
- {
83
- header: "Ref",
84
- accessorKey: "ref",
85
- enableSorting: !1
86
- },
87
- {
88
- header: "Created at",
89
- accessorFn: (t) => y(ee(t._id.toString())).format("D MMM YYYY, hh:mmA"),
90
- enableSorting: !0
91
- },
92
- {
93
- header: "Context",
94
- cell(t) {
95
- var r, a;
96
- const e = ((a = (r = t.row.original.context) == null ? void 0 : r.context) == null ? void 0 : a.file) || null;
97
- return e != null && e.downloadUrl && (e != null && e.originalName) ? n(
98
- "a",
99
- {
100
- class: "fm-typo-en-link-md-600",
101
- href: e.downloadUrl,
102
- download: e.originalName,
103
- target: "_blank",
104
- rel: "noopener"
105
- },
106
- e.originalName
107
- ) : e != null && e.originalName ? n("div", null, e.originalName) : n("div", null, "-");
108
- },
109
- enableSorting: !1
110
- },
111
- {
112
- header: "Failed reason",
113
- cell(t) {
114
- return n(b.FmButton, {
115
- icon: "visibility",
116
- variant: "tertiary",
117
- disabled: !t.row.original.failedReason,
118
- onClick: (e) => {
119
- e.preventDefault(), e.stopPropagation(), R(t.row.original.failedReason);
120
- }
121
- });
122
- },
123
- enableSorting: !1
124
- }
125
- ], F = (t) => {
126
- switch (t) {
127
- case c.enum.ACTIVE:
128
- return "text-fm-color-typo-info bg-fm-color-system-info-100";
129
- case c.enum.WAITING:
130
- return "text-fm-color-typo-warning bg-fm-color-system-warning-100";
131
- case c.enum.COMPLETED:
132
- return "text-fm-color-typo-success bg-fm-color-system-success-100";
133
- case c.enum.FAILED:
134
- return "text-fm-color-typo-error bg-fm-color-system-error-100";
135
- default:
136
- return "text-fm-color-typo-primary bg-fm-color-system-primary-100";
137
- }
138
- }, C = h({
139
- name: "FailedReasonDialog",
140
- props: {
141
- data: {
142
- type: String,
143
- required: !0
144
- }
145
- },
146
- setup(t) {
147
- return () => n("div", { class: "whitespace-pre-line" }, t.data);
148
- }
149
- });
150
- async function R(t) {
151
- E.open({
152
- title: "Failed Reason",
153
- closeButton: !0,
154
- dismissAway: !0,
155
- contentComponent: C,
156
- contentComponentProps: {
157
- data: t
158
- }
159
- });
160
- }
161
- const T = async (t) => {
162
- const e = H(void 0, ae.importFilesBucketUrl), r = W(e, t);
163
- return await $(r);
164
- }, M = c.options.map((t) => ({ label: u.title(t), value: t })), s = A({
165
- type: x ?? [
166
- d.enum.MEMBER_IMPORTED,
167
- d.enum.SEGMENTATION_IMPORTED
168
- ],
169
- status: []
170
- }), { tableMeta: i, rowData: N, onSort: k, debouncedFetchData: g } = L(
171
- async (t) => {
172
- const e = {
173
- ...s.value
174
- }, r = await oe.readImportMember(t, e);
175
- return await Promise.all(
176
- r.resources.map(async (a) => {
177
- var _, I;
178
- const l = (I = (_ = a.context) == null ? void 0 : _.context) == null ? void 0 : I.file;
179
- if (y(a.context.emittedAt).diff(y(), "days") < 7 && l)
180
- try {
181
- l.downloadUrl = await T(l == null ? void 0 : l.fbFilePath);
182
- } catch (P) {
183
- console.log(P);
184
- }
185
- })
186
- ), {
187
- resources: r.resources,
188
- meta: r.meta
189
- };
190
- }
191
- );
192
- return B(
193
- s,
194
- () => {
195
- g();
196
- },
197
- { deep: !0 }
198
- ), U(async () => {
199
- await g();
200
- }), (t, e) => {
201
- const r = V("FmPageHead");
202
- return z(), O(q, null, [
203
- m(r, {
204
- title: o(D)("connect.queue.title")
205
- }, null, 8, ["title"]),
206
- f("div", re, [
207
- f("div", ne, [
208
- f("div", se, [
209
- m(S, {
210
- class: "cursor-pointer text-fm-color-neutral-gray-400",
211
- "right-icon": "keyboard_arrow_down",
212
- modelValue: o(s).type,
213
- "onUpdate:modelValue": e[0] || (e[0] = (a) => o(s).type = a),
214
- label: "Type: ",
215
- "show-item-label": !0,
216
- items: [
217
- {
218
- label: "Member Imported",
219
- value: o(d).enum.MEMBER_IMPORTED
220
- },
221
- {
222
- label: "Segmentation Imported",
223
- value: o(d).enum.SEGMENTATION_IMPORTED
224
- }
225
- ]
226
- }, null, 8, ["modelValue", "items"]),
227
- m(S, {
228
- class: "cursor-pointer text-fm-color-neutral-gray-400",
229
- "right-icon": "keyboard_arrow_down",
230
- modelValue: o(s).status,
231
- "onUpdate:modelValue": e[1] || (e[1] = (a) => o(s).status = a),
232
- label: "Status: ",
233
- "show-item-label": !0,
234
- items: o(M)
235
- }, null, 8, ["modelValue", "items"])
236
- ])
237
- ]),
238
- m(Y, {
239
- loading: o(i).isLoading,
240
- "row-data": o(N),
241
- "row-count": o(i).totalRows,
242
- "column-defs": v,
243
- "page-count": o(i).pageCount,
244
- "page-index": o(i).pageIndex,
245
- "page-size": o(i).pageSize,
246
- "shrink-at": !1,
247
- onSortChange: o(k),
248
- onPageChange: e[2] || (e[2] = (a) => o(g)({
249
- pageSize: a.pageSize,
250
- pageIndex: a.pageIndex
251
- }))
252
- }, null, 8, ["loading", "row-data", "row-count", "page-count", "page-index", "page-size", "onSortChange"])
253
- ])
254
- ], 64);
255
- };
256
- }
257
- });
258
- export {
259
- De as default
260
- };
@@ -1,341 +0,0 @@
1
- var q = Object.defineProperty;
2
- var G = (g, o, m) => o in g ? q(g, o, { enumerable: !0, configurable: !0, writable: !0, value: m }) : g[o] = m;
3
- var z = (g, o, m) => G(g, typeof o != "symbol" ? o + "" : o, m);
4
- import { defineComponent as T, ref as B, computed as H, resolveComponent as C, openBlock as I, createBlock as J, unref as n, isRef as Q, withCtx as X, createElementBlock as U, createVNode as w, withModifiers as Z, createCommentVNode as ee, createElementVNode as N, h, onMounted as re, Fragment as te } from "vue";
5
- import { u as oe, _ as ae } from "./usePagination-Ds-cuHop.js";
6
- import { g as A } from "./user-Bt1C0yV5.js";
7
- import { components as R } from "@feedmepos/ui-library";
8
- import "./index-Dn0gJspN.js";
9
- import { u as j } from "./vue-i18n-OdHHHpEE.js";
10
- import { u as L } from "./loading-D5ZAAdUU.js";
11
- import { useCoreStore as se } from "@feedmepos/mf-common";
12
- import { r as v } from "./index-V9kRRAB1.js";
13
- import { c as ie, a as ne } from "./object-qECH92oz.js";
14
- import { u as ce } from "./membership-xl9aKOQ_.js";
15
- import { a as le, c as de } from "./plugins-CJlgzIv2.js";
16
- import { u as V, w as me } from "./xlsx-BgB0dYfE.js";
17
- import { e as f } from "./index-vh86FiIQ.js";
18
- import { h as ue } from "./moment-D7p2TMB-.js";
19
- import { o as pe } from "./objectId-dwaoBfJX.js";
20
- const fe = {
21
- key: 0,
22
- class: "flex justify-end mb-16"
23
- }, ge = { class: "flex flex-col space-y-16 pr-12" }, he = /* @__PURE__ */ T({
24
- __name: "UpdateCriteriaProgressSheet",
25
- emits: ["refresh"],
26
- setup(g, { expose: o, emit: m }) {
27
- const y = m;
28
- j();
29
- const { minor: k } = L, l = B(!1), d = B({}), F = se(), S = [
30
- {
31
- header: "Criteria title",
32
- accessorFn: (a) => a.name
33
- },
34
- {
35
- header: "Status",
36
- cell(a) {
37
- var u;
38
- const e = a.row.original, r = (u = d.value.criteria_progress) == null ? void 0 : u.find(
39
- (_) => _.criteria === e._id
40
- ), i = r ? "Completed" : "Pending", c = r ? "text-fm-color-typo-success bg-fm-color-system-success-100" : "text-fm-color-typo-warning bg-fm-color-system-warning-100";
41
- return [
42
- h(R.FmChip, {
43
- label: i,
44
- compact: !0,
45
- class: c
46
- })
47
- ];
48
- }
49
- },
50
- {
51
- id: "actions",
52
- cell(a) {
53
- var i;
54
- const e = a.row.original;
55
- return [
56
- !((i = d.value.criteria_progress) == null ? void 0 : i.some(
57
- (c) => c.criteria === e._id
58
- )) && e.type == "MANUAL" ? h(R.FmButton, {
59
- variant: "secondary",
60
- label: "Mark as completed",
61
- size: "md",
62
- onClick: (c) => {
63
- c.stopPropagation(), x(e._id.toString());
64
- }
65
- }) : null
66
- ];
67
- }
68
- }
69
- ], M = H(() => {
70
- var e, r, i, c;
71
- return (((r = (e = d.value) == null ? void 0 : e.criteria_progress) == null ? void 0 : r.filter(
72
- (u) => {
73
- var _;
74
- return (_ = d.value) == null ? void 0 : _.criteria.some(
75
- (P) => P._id.toString() === u.criteria.toString()
76
- );
77
- }
78
- )) || []).length == ((i = d.value) == null ? void 0 : i.criteria.length) && ((c = d.value) == null ? void 0 : c.status) != "COMPLETED";
79
- });
80
- async function x(a) {
81
- var r;
82
- const e = ie(ne(d.value));
83
- e.criteria_progress = [
84
- {
85
- criteria: a,
86
- ref: `ADMIN:${(r = F.user) == null ? void 0 : r.id}:${(/* @__PURE__ */ new Date()).toISOString()}`,
87
- completedAt: /* @__PURE__ */ new Date()
88
- }
89
- ], k(
90
- async () => {
91
- await v.updateCriteriaProgress(
92
- d.value._id,
93
- e
94
- ), l.value = !1, y("refresh");
95
- },
96
- {
97
- message: "Updating criteria progress",
98
- successMessage: "Criteria progress updated successfully"
99
- }
100
- );
101
- }
102
- function t(a, e) {
103
- l.value = a, d.value = e;
104
- }
105
- function s() {
106
- l.value = !1;
107
- }
108
- return o({
109
- showSheet: t,
110
- hideSheet: s,
111
- data: d
112
- }), (a, e) => {
113
- const r = C("FmButton"), i = C("FmTable"), c = C("FmSideSheet");
114
- return I(), J(c, {
115
- "max-width": 768,
116
- modelValue: n(l),
117
- "onUpdate:modelValue": e[1] || (e[1] = (u) => Q(l) ? l.value = u : null),
118
- header: "Referee Criteria"
119
- }, {
120
- default: X(() => [
121
- n(M) ? (I(), U("div", fe, [
122
- w(r, {
123
- icon: "refresh",
124
- label: "Refresh",
125
- onClick: e[0] || (e[0] = Z((u) => x(n(d)._id), ["stop"]))
126
- })
127
- ])) : ee("", !0),
128
- N("div", ge, [
129
- w(i, {
130
- "row-data": n(d).criteria,
131
- "hide-footer": !0,
132
- "page-size": 100,
133
- "column-defs": S
134
- }, null, 8, ["row-data"])
135
- ])
136
- ]),
137
- _: 1
138
- }, 8, ["modelValue"]);
139
- };
140
- }
141
- });
142
- class _e {
143
- constructor() {
144
- z(this, "data", []);
145
- }
146
- addRecord(o) {
147
- this.data.push(o);
148
- }
149
- buildExcel() {
150
- const o = V.book_new(), m = V.json_to_sheet(this.data);
151
- return V.book_append_sheet(o, m, "Referrals"), o;
152
- }
153
- }
154
- const we = { class: "flex items-center justify-end" }, $e = /* @__PURE__ */ T({
155
- __name: "Record",
156
- setup(g) {
157
- const { t: o } = j();
158
- ce();
159
- const { minor: m } = L, y = B(null), k = [
160
- {
161
- header: "ID",
162
- meta: {
163
- maxWidth: "100px"
164
- },
165
- cell(t) {
166
- return h("div", { class: "flex items-center" }, [
167
- h(R.FmIcon, {
168
- name: "content_copy",
169
- outline: !0,
170
- size: "sm",
171
- class: "cursor-pointer mr-4",
172
- onClick: (s) => {
173
- s.preventDefault(), s.stopPropagation(), le(t.row.original._id.toString());
174
- }
175
- }),
176
- h(
177
- "div",
178
- { class: "pr-2 text-ellipsis overflow-hidden" },
179
- t.row.original._id.toString()
180
- )
181
- ]);
182
- },
183
- enableSorting: !1
184
- },
185
- {
186
- header: o("connect.referral.record.referer_info"),
187
- enableSorting: !0,
188
- cell(t) {
189
- return t.row.original.pf_referer ? A(t.row.original.pf_referer, !0) : "N/A";
190
- }
191
- },
192
- {
193
- header: o("connect.referral.record.referee_info"),
194
- enableSorting: !0,
195
- cell(t) {
196
- return t.row.original.pf_referee ? A(t.row.original.pf_referee, !0) : "N/A";
197
- }
198
- },
199
- {
200
- header: o("connect.referral.record.referee_criteria"),
201
- accessorKey: "criteria",
202
- id: "criteria",
203
- cell(t) {
204
- var r;
205
- const a = (((r = t.row.original.criteria_progress) == null ? void 0 : r.filter(
206
- (i) => t.row.original.criteria.some(
207
- (c) => c._id.toString() === i.criteria.toString()
208
- )
209
- )) || []).length, e = t.row.original.criteria.length;
210
- return e === 0 ? h("div", "No criteria") : h("div", `${a}/${e} completed criteria`);
211
- }
212
- },
213
- {
214
- header: o("connect.referral.record.status"),
215
- id: "status",
216
- cell(t) {
217
- const s = t.row.original.status;
218
- return h(R.FmChip, {
219
- label: de.title(s.replace("_", " ")),
220
- compact: !0,
221
- class: s == "COMPLETED" ? "text-fm-color-typo-success bg-fm-color-system-success-100" : "text-fm-color-typo-primary bg-fm-color-system-primary-100"
222
- });
223
- }
224
- }
225
- ], { tableMeta: l, rowData: d, onSort: F, debouncedFetchData: S, onSearch: M } = oe(v.readRecords);
226
- async function x() {
227
- const t = new _e(), s = (await v.readRecords({
228
- limit: 1,
229
- skip: 0,
230
- sortBy: f.sortBy,
231
- descending: f.descending
232
- })).meta.totalResources ?? 0, a = f.rowsPerPage;
233
- await m(
234
- async () => {
235
- var e, r, i, c;
236
- for (let u = 0; u < s; u += a) {
237
- const _ = {
238
- ...f,
239
- limit: a,
240
- skip: f.page - 1,
241
- sortBy: f.sortBy,
242
- descending: f.descending
243
- }, P = await v.readRecords(_);
244
- for (const p of P.resources) {
245
- const E = (p.criteria || []).reduce(
246
- (b, D) => {
247
- var $;
248
- const Y = (($ = p.criteria_progress) == null ? void 0 : $.filter(
249
- (K) => p.criteria.some(
250
- (W) => W._id.toString() === K.criteria.toString()
251
- )
252
- )) || [];
253
- return b[D.name] = Y.length > 0 ? "Completed" : "In Progress", b;
254
- },
255
- {}
256
- );
257
- console.log(E);
258
- const O = {
259
- ID: p._id.toString(),
260
- RefererName: ((e = p.pf_referer) == null ? void 0 : e.name) ?? "",
261
- RefererPhone: ((r = p.pf_referer) == null ? void 0 : r.phoneNumber) ?? "",
262
- RefereeName: ((i = p.pf_referee) == null ? void 0 : i.name) ?? "",
263
- RefereePhone: ((c = p.pf_referee) == null ? void 0 : c.phoneNumber) ?? "",
264
- ReferredAt: ue(pe(p._id)).format(
265
- "DD/MM/YYYY"
266
- ),
267
- Status: p.status,
268
- Criteria: Object.entries(E).map(([b, D]) => `${b}: ${D}`).join(", ")
269
- };
270
- t.addRecord(O);
271
- }
272
- f.page++;
273
- }
274
- await me(
275
- t.buildExcel(),
276
- `referrals-${(/* @__PURE__ */ new Date()).toISOString()}.xlsx`,
277
- {
278
- bookType: "xlsx",
279
- bookSST: !1,
280
- type: "array"
281
- }
282
- ), f.page = 1;
283
- },
284
- {
285
- message: "Exporting referral records...",
286
- successMessage: "Referral record exported successfully"
287
- }
288
- );
289
- }
290
- return re(async () => {
291
- await S();
292
- }), (t, s) => {
293
- const a = C("FmSearch"), e = C("FmButton");
294
- return I(), U(te, null, [
295
- N("div", null, [
296
- N("div", we, [
297
- w(a, {
298
- class: "mt-4",
299
- modelValue: n(l).searchValue,
300
- "onUpdate:modelValue": [
301
- s[0] || (s[0] = (r) => n(l).searchValue = r),
302
- n(M)
303
- ],
304
- placeholder: "Search",
305
- collapsible: ""
306
- }, null, 8, ["modelValue", "onUpdate:modelValue"]),
307
- w(e, {
308
- icon: "ios_share",
309
- variant: "tertiary",
310
- onClick: x
311
- })
312
- ]),
313
- w(ae, {
314
- loading: n(l).isLoading,
315
- "row-data": n(d),
316
- "row-count": n(l).totalRows,
317
- "column-defs": k,
318
- "shrink-at": !1,
319
- "page-count": n(l).pageCount,
320
- "page-index": n(l).pageIndex,
321
- "page-size": n(l).pageSize,
322
- onSortChange: n(F),
323
- onPageChange: s[1] || (s[1] = (r) => n(S)({ pageSize: r.pageSize, pageIndex: r.pageIndex })),
324
- onRowClick: s[2] || (s[2] = (r) => {
325
- var i;
326
- return (i = n(y)) == null ? void 0 : i.showSheet(!0, r.original);
327
- })
328
- }, null, 8, ["loading", "row-data", "row-count", "page-count", "page-index", "page-size", "onSortChange"])
329
- ]),
330
- w(he, {
331
- ref_key: "updateCriteriaProgressSheetRef",
332
- ref: y,
333
- onRefresh: n(S)
334
- }, null, 8, ["onRefresh"])
335
- ], 64);
336
- };
337
- }
338
- });
339
- export {
340
- $e as default
341
- };