@feedmepos/mf-connect 0.1.58-prod → 0.1.59-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 (129) hide show
  1. package/dist/Analytic-1heLfSqq.js +427 -0
  2. package/dist/App-BOM2IfBO.js +4630 -0
  3. package/dist/Bin-BgYzSjrq.js +166 -0
  4. package/dist/Broadcast-DHeN_79K.js +233 -0
  5. package/dist/CampaignTypeDialog.vue_vue_type_script_setup_true_lang-DFOIbmI6.js +121 -0
  6. package/dist/Card-CuJ7bMy5.js +911 -0
  7. package/dist/ChipMenu.vue_vue_type_script_setup_true_lang-BPpZZNkr.js +97 -0
  8. package/dist/Collections-D1FRwIRi.js +458 -0
  9. package/dist/Credit-CeYpgCod.js +228 -0
  10. package/dist/CustomSelect.vue_vue_type_script_setup_true_lang-Du7fRSZC.js +128 -0
  11. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-B8lOyyAc.js +2194 -0
  12. package/dist/EffectSheet.vue_vue_type_style_index_0_lang-De2lhmbT.js +348 -0
  13. package/dist/Experience-D-tJxul7.js +229 -0
  14. package/dist/FileSaver.min-NlMItPOc.js +74 -0
  15. package/dist/FilterChip.vue_vue_type_script_setup_true_lang-DaU-9GzO.js +129 -0
  16. package/dist/Game-BOmYWwRj.js +284 -0
  17. package/dist/ImageInput.vue_vue_type_script_setup_true_lang-D1KQpDGg.js +144 -0
  18. package/dist/Index-CRBYEPFf.js +259 -0
  19. package/dist/JsonViewer-v8_C7l5N.js +87 -0
  20. package/dist/LottieAnimation.vue_vue_type_script_setup_true_lang-CyGJxUol.js +18737 -0
  21. package/dist/MainLayout-B1aJoR95.js +41 -0
  22. package/dist/Marketing-D7WunOsO.js +319 -0
  23. package/dist/Member-iYAPEdoQ.js +279 -0
  24. package/dist/MemberList-CtR-UjtG.js +1607 -0
  25. package/dist/MemberOverview-wL_ailso.js +58 -0
  26. package/dist/MemberTransactions-BMQOdkr2.js +45 -0
  27. package/dist/MessageInput.vue_vue_type_script_setup_true_lang-DhJlcYpw.js +60553 -0
  28. package/dist/Mission-DSBH4Di0.js +302 -0
  29. package/dist/Overview-C0KCN3fH.js +1079 -0
  30. package/dist/Point-AN7wmCXY.js +232 -0
  31. package/dist/Promotion-Cbf4W6Vh.js +289 -0
  32. package/dist/Queue-Bo_RtLpU.js +260 -0
  33. package/dist/Record-BphvsxDb.js +341 -0
  34. package/dist/Reward-CgHUAB5V.js +442 -0
  35. package/dist/RewardGroup.vue_vue_type_script_setup_true_lang-DaBRd_Kw.js +150 -0
  36. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-C_65qxpU.js +1763 -0
  37. package/dist/Segment-Cc0D6nPj.js +882 -0
  38. package/dist/SelectItems.vue_vue_type_script_setup_true_lang-BxUG7_bX.js +181 -0
  39. package/dist/SendCollectionSheet.vue_vue_type_script_setup_true_lang-bqKHjikC.js +188 -0
  40. package/dist/SendVoucherSheet.vue_vue_type_script_setup_true_lang-DA7bevEn.js +147 -0
  41. package/dist/Setting-DjVTTqky.js +1918 -0
  42. package/dist/SettingAdvertisements-BL81KD_S.js +262 -0
  43. package/dist/Store-DqXIQ9EY.js +1842 -0
  44. package/dist/StoreRewards-xlzAHJkc.js +423 -0
  45. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-OphuWknh.js +995 -0
  46. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-DGSjAbol.js +139 -0
  47. package/dist/Tier-DadaaAEc.js +895 -0
  48. package/dist/Title-BDBxQMEm.js +566 -0
  49. package/dist/Transaction-BRGCw9Va.js +39 -0
  50. package/dist/UserRuleGroup.vue_vue_type_script_setup_true_lang-qe26FZBo.js +130 -0
  51. package/dist/Voucher-CtvWJfVU.js +384 -0
  52. package/dist/VoucherEditor.vue_vue_type_script_setup_true_lang-dS7n6KJt.js +419 -0
  53. package/dist/ZodTextField.vue_vue_type_script_setup_true_lang-ndun9vf-.js +56 -0
  54. package/dist/_commonjsHelpers-BkfeUUK-.js +28 -0
  55. package/dist/_plugin-vue_export-helper-CHgC5LLL.js +9 -0
  56. package/dist/app-9QTXPjre.js +57962 -0
  57. package/dist/app-UNZJVzly.js +7094 -0
  58. package/dist/app-wDQR6dpb.js +39 -0
  59. package/dist/app.js +6 -0
  60. package/dist/business-DtufpzhR.js +82 -0
  61. package/dist/campaign-63K4Xtsd.js +94 -0
  62. package/dist/campaign-CpzFl8Vr.js +4 -0
  63. package/dist/campaign-Dm85zK-z.js +1810 -0
  64. package/dist/campaign.enum-DBWgoidX.js +20 -0
  65. package/dist/campaign.fn-BpifzSGC.js +758 -0
  66. package/dist/collectible.enum-2_2_6r39.js +19 -0
  67. package/dist/collection.fn-B2rlSiv_.js +26 -0
  68. package/dist/dto-Df83CuN3.js +216 -0
  69. package/dist/effect-BUEqEGkq.js +78 -0
  70. package/dist/email-addresses-BUNKzO1f.js +705 -0
  71. package/dist/export-BzY3BDZJ.js +97 -0
  72. package/dist/feedme.ico +0 -0
  73. package/dist/helper-BaJdC23g.js +71 -0
  74. package/dist/index-BA5QwPCT.js +146 -0
  75. package/dist/index-BInlN52T.js +54 -0
  76. package/dist/index-BLjKPiBb.js +44 -0
  77. package/dist/index-BQTPw5fM.js +30076 -0
  78. package/dist/index-BSQCStAn.js +38 -0
  79. package/dist/index-Bzv6BHPk.js +32269 -0
  80. package/dist/index-C0XYFg_a.js +3077 -0
  81. package/dist/index-CuvNtC_M.js +61 -0
  82. package/dist/index-D_hUHpqX.js +31 -0
  83. package/dist/index-DlwtDkgr.js +32 -0
  84. package/dist/index-DrAbySpd.js +8859 -0
  85. package/dist/index-JxOM03oW.js +3 -0
  86. package/dist/index-X9YonBq5.js +76 -0
  87. package/dist/index-gvl1UKmI.js +2134 -0
  88. package/dist/index-vh86FiIQ.js +10 -0
  89. package/dist/index-zy0pOMPl.js +121 -0
  90. package/dist/index.esm2017-WVBFvkg-.js +3069 -0
  91. package/dist/loading-CKbcLJje.js +71 -0
  92. package/dist/lodash-B5I3zXaY.js +3678 -0
  93. package/dist/membership-BMv4jrI_.js +235 -0
  94. package/dist/moment-D7p2TMB-.js +2583 -0
  95. package/dist/money-iY-Nby0p.js +15 -0
  96. package/dist/number-CluL-GzZ.js +12 -0
  97. package/dist/object-qECH92oz.js +26 -0
  98. package/dist/objectId-dwaoBfJX.js +7 -0
  99. package/dist/objectid-sIFo0b00.js +145 -0
  100. package/dist/plugins-BlvUeMc1.js +208 -0
  101. package/dist/reward-CZlHuvJJ.js +36 -0
  102. package/dist/rule-DMH3fchR.js +1951 -0
  103. package/dist/rule-builder-BvBTYyZq.js +102 -0
  104. package/dist/style.css +4 -0
  105. package/dist/template-CzqV_mzm.js +190 -0
  106. package/dist/tier-BJDhpH6X.js +4 -0
  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-Bo8HWoc4.js +1151 -0
  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-BGG22zoh.js +144 -0
  122. package/dist/tslib.es6-BCqqvLQ_.js +44 -0
  123. package/dist/type_drinks-D6jnpvwV.js +4 -0
  124. package/dist/usePagination-Ds-cuHop.js +223 -0
  125. package/dist/user-DesAMEEX.js +54 -0
  126. package/dist/vue-i18n-CN3WXgAO.js +2365 -0
  127. package/dist/xlsx-BKuxyTY9.js +15491 -0
  128. package/dist/zod-Bg2FbC-D.js +90 -0
  129. package/package.json +1 -1
@@ -0,0 +1,260 @@
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-BlvUeMc1.js";
5
+ import { useDialog as K, components as b } from "@feedmepos/ui-library";
6
+ import { I as c, c as d } from "./index-C0XYFg_a.js";
7
+ import "./index-DrAbySpd.js";
8
+ import "./index-gvl1UKmI.js";
9
+ import "./index-BSQCStAn.js";
10
+ import "./index-BInlN52T.js";
11
+ import "./index-Bzv6BHPk.js";
12
+ import { h as y } from "./moment-D7p2TMB-.js";
13
+ import { u as j } from "./vue-i18n-CN3WXgAO.js";
14
+ import { u as H, v as W, w as $ } from "./index.esm2017-WVBFvkg-.js";
15
+ import { useRoute as Q } from "vue-router";
16
+ import { g as J, S as X, u as Z } from "./index-BQTPw5fM.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" }, Ee = /* @__PURE__ */ h({
32
+ __name: "Queue",
33
+ setup(p) {
34
+ const x = Q().query.type, { t: E } = j(), v = K(), D = [
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
+ v.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(E)("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": D,
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
+ Ee as default
260
+ };
@@ -0,0 +1,341 @@
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-DesAMEEX.js";
7
+ import { components as R } from "@feedmepos/ui-library";
8
+ import "./index-Bzv6BHPk.js";
9
+ import { u as j } from "./vue-i18n-CN3WXgAO.js";
10
+ import { u as L } from "./loading-CKbcLJje.js";
11
+ import { useCoreStore as se } from "@feedmepos/mf-common";
12
+ import { r as v } from "./index-DlwtDkgr.js";
13
+ import { c as ie, a as ne } from "./object-qECH92oz.js";
14
+ import { u as ce } from "./membership-BMv4jrI_.js";
15
+ import { a as le, c as de } from "./plugins-BlvUeMc1.js";
16
+ import { u as V, w as me } from "./xlsx-BKuxyTY9.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
+ };