@feedmepos/mf-connect 0.1.98-beta.15 → 0.1.98-beta.16

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 (138) hide show
  1. package/dist/App-DNXDhULP.js +4782 -0
  2. package/dist/AuditLogs-BNS27IJT.js +2013 -0
  3. package/dist/Bin-Dkjyrbz-.js +166 -0
  4. package/dist/Broadcast-B-fpjVzY.js +266 -0
  5. package/dist/CampaignTypeDialog.vue_vue_type_script_setup_true_lang-qBcG-vPM.js +120 -0
  6. package/dist/Card-BvVHO8kN.js +910 -0
  7. package/dist/ChipMenu.vue_vue_type_script_setup_true_lang-BPpZZNkr.js +97 -0
  8. package/dist/Collections-BLxPSOJl.js +540 -0
  9. package/dist/Credit-DU-stilH.js +260 -0
  10. package/dist/CustomSelect.vue_vue_type_script_setup_true_lang-Du7fRSZC.js +128 -0
  11. package/dist/DateRangeChip.vue_vue_type_script_setup_true_lang-eIoPtgO5.js +58 -0
  12. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-Bqnb00zk.js +3377 -0
  13. package/dist/EffectSheet.vue_vue_type_style_index_0_lang-CTSfEq5N.js +351 -0
  14. package/dist/Experience-C3tB8hTp.js +259 -0
  15. package/dist/FileSaver.min-EIworvUf.js +74 -0
  16. package/dist/FilterChip.vue_vue_type_script_setup_true_lang-DaU-9GzO.js +129 -0
  17. package/dist/FmTableSelection.vue_vue_type_script_setup_true_lang-DzcUc0_w.js +52 -0
  18. package/dist/Game-Dq1ms2fA.js +330 -0
  19. package/dist/Grab-DnSO2oLx.js +300 -0
  20. package/dist/ImageInput.vue_vue_type_script_setup_true_lang-n1r2bgOE.js +145 -0
  21. package/dist/Index-BFIHgW9W.js +259 -0
  22. package/dist/JsonViewer-v8_C7l5N.js +87 -0
  23. package/dist/LocationPicker.vue_vue_type_script_setup_true_lang-Do7CJZuh.js +48 -0
  24. package/dist/LottieAnimation.vue_vue_type_script_setup_true_lang-vpJmHgKM.js +18737 -0
  25. package/dist/LoyaltyDashboard-CcBogXzl.js +1082 -0
  26. package/dist/MainLayout-CPNiL_et.js +41 -0
  27. package/dist/Marketing-Bzb1VaVA.js +235 -0
  28. package/dist/MarketingMaterialEdit-8UQNx3mV.js +1035 -0
  29. package/dist/Member-Drb_NVrb.js +280 -0
  30. package/dist/MemberList-wa3JxCVr.js +1601 -0
  31. package/dist/MemberOverview-wL_ailso.js +58 -0
  32. package/dist/MemberTransactions-8qlm-T67.js +45 -0
  33. package/dist/MessageInput.vue_vue_type_script_setup_true_lang-BHicaUXs.js +60802 -0
  34. package/dist/Mission-DmWbQmOv.js +334 -0
  35. package/dist/Overview-COEFtf12.js +1079 -0
  36. package/dist/Overview-D7ki-aBA.js +969 -0
  37. package/dist/Point-B0W-BcPA.js +262 -0
  38. package/dist/Promotion-CY16SjmK.js +397 -0
  39. package/dist/Queue-hMur40Xc.js +260 -0
  40. package/dist/Record-Bj7GQP1r.js +342 -0
  41. package/dist/Review-Z1XD6bJK.js +45 -0
  42. package/dist/ReviewFacebookCallback-DirGtKLX.js +248 -0
  43. package/dist/ReviewGoogleCallback-CVC6741e.js +213 -0
  44. package/dist/Reward-DDB5Usau.js +442 -0
  45. package/dist/RewardGroup.vue_vue_type_script_setup_true_lang-B-OnKAbx.js +149 -0
  46. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-DDHM8NLi.js +1911 -0
  47. package/dist/Segment-Bl0k9fvJ.js +1014 -0
  48. package/dist/SelectItems.vue_vue_type_script_setup_true_lang-C33DPiN6.js +181 -0
  49. package/dist/SendCollectionSheet.vue_vue_type_script_setup_true_lang-YMpQ-IiW.js +188 -0
  50. package/dist/SendVoucherSheet.vue_vue_type_script_setup_true_lang--Rtf3gRa.js +226 -0
  51. package/dist/Setting-CpD98E2N.js +2047 -0
  52. package/dist/SettingAdvertisements-BZFQu_HI.js +264 -0
  53. package/dist/Settings-CRqlKNsc.js +228 -0
  54. package/dist/Store-CDG2_iqc.js +1996 -0
  55. package/dist/StoreRewards-DIU5hPXv.js +540 -0
  56. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-B82RH_ZC.js +1133 -0
  57. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-DKGCmk5y.js +7007 -0
  58. package/dist/Tier-BXgIdYDa.js +969 -0
  59. package/dist/Title-DgHxyV8p.js +566 -0
  60. package/dist/Transaction-iDacnm6Y.js +39 -0
  61. package/dist/UserRuleGroup.vue_vue_type_script_setup_true_lang-RUbR6pdK.js +130 -0
  62. package/dist/Voucher-C-I8JK4F.js +421 -0
  63. package/dist/VoucherEditor.vue_vue_type_script_setup_true_lang-BUpYZxij.js +421 -0
  64. package/dist/ZodTextField.vue_vue_type_script_setup_true_lang-LhG5jJq3.js +56 -0
  65. package/dist/_plugin-vue_export-helper-CHgC5LLL.js +9 -0
  66. package/dist/app-CyNzTZOx.js +59950 -0
  67. package/dist/app-wDQR6dpb.js +39 -0
  68. package/dist/app.js +7 -0
  69. package/dist/business-o_sAO_33.js +82 -0
  70. package/dist/campaign--IUcyI8h.js +219 -0
  71. package/dist/campaign-CpzFl8Vr.js +4 -0
  72. package/dist/campaign-zLKyql03.js +277 -0
  73. package/dist/campaign.enum-CEbNgaGZ.js +26 -0
  74. package/dist/campaign.fn-BVT0m6Uy.js +776 -0
  75. package/dist/collectible.enum-2y8KIQLL.js +19 -0
  76. package/dist/duplicateCampaign-DIzdQf0e.js +51 -0
  77. package/dist/effect-B6gKaH4T.js +89 -0
  78. package/dist/email-addresses-CO9GNnUN.js +705 -0
  79. package/dist/export-DdDpRFVg.js +97 -0
  80. package/dist/feedme.ico +0 -0
  81. package/dist/google-BQK68wbe.js +5 -0
  82. package/dist/helper-DqypCsTm.js +86 -0
  83. package/dist/index-BK0OmX3R.js +85 -0
  84. package/dist/index-Bc7JXl59.js +54 -0
  85. package/dist/index-BgiIGrLb.js +32 -0
  86. package/dist/index-C-TiT9bf.js +1157 -0
  87. package/dist/index-COXmoOd1.js +3678 -0
  88. package/dist/index-CT6uJJ9y.js +151 -0
  89. package/dist/index-Ci2gFCfD.js +61 -0
  90. package/dist/index-CtJ0MQQ1.js +3 -0
  91. package/dist/index-CuvNtC_M.js +61 -0
  92. package/dist/index-D41Xq5qY.js +8910 -0
  93. package/dist/index-DBD_e_yR.js +31 -0
  94. package/dist/index-DDpz9LmI.js +67 -0
  95. package/dist/index-Dh2apeby.js +2819 -0
  96. package/dist/index-DiDmMG_M.js +28900 -0
  97. package/dist/index-pjXQwa0j.js +30289 -0
  98. package/dist/index-vh86FiIQ.js +10 -0
  99. package/dist/index.esm2017-Cd4FhecE.js +3069 -0
  100. package/dist/loading-D-RglDMV.js +72 -0
  101. package/dist/lodash-cggYhL9V.js +3678 -0
  102. package/dist/membership-DTfMyKwP.js +255 -0
  103. package/dist/moment-D7p2TMB-.js +2583 -0
  104. package/dist/money-fGZfbdgV.js +15 -0
  105. package/dist/number-BOalh3ZH.js +12 -0
  106. package/dist/object-BYyQ0PZp.js +18 -0
  107. package/dist/objectId-dwaoBfJX.js +7 -0
  108. package/dist/objectid-zPJFVngY.js +145 -0
  109. package/dist/plugins-CbpvMMOJ.js +1788 -0
  110. package/dist/reward-DkVAHEq2.js +36 -0
  111. package/dist/rule-EzWg2u8d.js +1969 -0
  112. package/dist/string-Gcy5IM_H.js +32 -0
  113. package/dist/style.css +4 -0
  114. package/dist/template-BfVFq4on.js +188 -0
  115. package/dist/tier-BJDhpH6X.js +4 -0
  116. package/dist/tiers/tier=1.png +0 -0
  117. package/dist/tiers/tier=2.png +0 -0
  118. package/dist/tiers/tier=3.png +0 -0
  119. package/dist/tiers/tier=4.png +0 -0
  120. package/dist/titles/type=diamond.png +0 -0
  121. package/dist/titles/type=drinks.png +0 -0
  122. package/dist/titles/type=food.png +0 -0
  123. package/dist/titles/type=heart.png +0 -0
  124. package/dist/titles/type=medal.png +0 -0
  125. package/dist/titles/type=spend.png +0 -0
  126. package/dist/titles/type=thank-you.png +0 -0
  127. package/dist/titles/type=thumbs-up.png +0 -0
  128. package/dist/titles/type=years.png +0 -0
  129. package/dist/trigger-es-_uiSg.js +213 -0
  130. package/dist/tslib.es6-BCqqvLQ_.js +44 -0
  131. package/dist/type_drinks-D6jnpvwV.js +4 -0
  132. package/dist/useMarketingMaterialActions-CpiIKMmG.js +107 -0
  133. package/dist/usePagination-SYsXgU6x.js +220 -0
  134. package/dist/user-DUe40u3g.js +55 -0
  135. package/dist/vue-i18n-Dn9zxRuv.js +2365 -0
  136. package/dist/xlsx-DugGi7dB.js +15491 -0
  137. package/dist/zod-Dw8_B6RC.js +91 -0
  138. 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 L, Fragment as O, createVNode as m, unref as o, createElementVNode as g } from "vue";
2
+ import { u as q, _ as G } from "./usePagination-SYsXgU6x.js";
3
+ import { _ as S } from "./FilterChip.vue_vue_type_script_setup_true_lang-DaU-9GzO.js";
4
+ import { c as u } from "./string-Gcy5IM_H.js";
5
+ import { c as Y } from "./plugins-CbpvMMOJ.js";
6
+ import { useDialog as j, components as y } from "@feedmepos/ui-library";
7
+ import "./index-Dh2apeby.js";
8
+ import { L as c, c as d } from "./index-COXmoOd1.js";
9
+ import "./index-D41Xq5qY.js";
10
+ import "./index-pjXQwa0j.js";
11
+ import "./index-Bc7JXl59.js";
12
+ import { h as b } from "./moment-D7p2TMB-.js";
13
+ import { u as W } from "./vue-i18n-Dn9zxRuv.js";
14
+ import { u as H, v as K, w as Q } from "./index.esm2017-Cd4FhecE.js";
15
+ import { useRoute as $ } from "vue-router";
16
+ import { g as J, S as Z, u as X } from "./index-DiDmMG_M.js";
17
+ import { o as ee } from "./objectId-dwaoBfJX.js";
18
+ const te = () => {
19
+ if (!Z.getBusinessId()) throw new Error("Invalid business ID");
20
+ return X("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: "AIzaSyAj8JdCHtP0Vc5vZobCfgoLzWxPIn0WUG4", authDomain: "feedme-dev-4c3ef.firebaseapp.com", databaseURL: "https://feedme-dev-4c3ef.firebaseio.com", projectId: "feedme-dev-4c3ef", storageBucket: "feedme-dev-4c3ef.appspot.com", messagingSenderId: "458797803788", appId: "1:458797803788:web:37f2af2926a84288f0c129", measurementId: "G-J2QG09D2Q7" }, assetBucketUrl: "feedme-dev-4c3ef.appspot.com", importFilesBucketUrl: "feedme-dev-4c3ef.appspot.com", clientId: "1a362d621873497b277ea55258cc82594ba148d235257f7bd44ea2acc132d8a4" };
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" }, xe = /* @__PURE__ */ h({
32
+ __name: "Queue",
33
+ setup(p) {
34
+ const v = $().query.type, { t: x } = W(), E = j(), C = [
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(y.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(), Y(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(y.FmChip, {
75
+ label: e ? u.title(e) : "-",
76
+ compact: !0,
77
+ class: D(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) => b(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(y.FmButton, {
115
+ icon: "visibility",
116
+ variant: "tertiary",
117
+ disabled: !t.row.original.failedReason,
118
+ onClick: (e) => {
119
+ e.preventDefault(), e.stopPropagation(), M(t.row.original.failedReason);
120
+ }
121
+ });
122
+ },
123
+ enableSorting: !1
124
+ }
125
+ ], D = (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
+ }, F = 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 M(t) {
151
+ E.open({
152
+ title: "Failed Reason",
153
+ closeButton: !0,
154
+ dismissAway: !0,
155
+ contentComponent: F,
156
+ contentComponentProps: {
157
+ data: t
158
+ }
159
+ });
160
+ }
161
+ const T = async (t) => {
162
+ const e = H(void 0, ae.importFilesBucketUrl), r = K(e, t);
163
+ return await Q(r);
164
+ }, R = c.options.map((t) => ({ label: u.title(t), value: t })), s = A({
165
+ type: v ?? [
166
+ d.enum.MEMBER_IMPORTED,
167
+ d.enum.SEGMENTATION_IMPORTED
168
+ ],
169
+ status: []
170
+ }), { tableMeta: i, rowData: P, onSort: k, debouncedFetchData: f } = q(
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 (b(a.context.emittedAt).diff(b(), "days") < 7 && l)
180
+ try {
181
+ l.downloadUrl = await T(l == null ? void 0 : l.fbFilePath);
182
+ } catch (N) {
183
+ console.log(N);
184
+ }
185
+ })
186
+ ), {
187
+ resources: r.resources,
188
+ meta: r.meta
189
+ };
190
+ }
191
+ );
192
+ return B(
193
+ s,
194
+ () => {
195
+ f();
196
+ },
197
+ { deep: !0 }
198
+ ), U(async () => {
199
+ await f();
200
+ }), (t, e) => {
201
+ const r = V("FmPageHead");
202
+ return z(), L(O, null, [
203
+ m(r, {
204
+ title: o(x)("connect.queue.title")
205
+ }, null, 8, ["title"]),
206
+ g("div", re, [
207
+ g("div", ne, [
208
+ g("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(R)
235
+ }, null, 8, ["modelValue", "items"])
236
+ ])
237
+ ]),
238
+ m(G, {
239
+ loading: o(i).isLoading,
240
+ "row-data": o(P),
241
+ "row-count": o(i).totalRows,
242
+ "column-defs": C,
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(f)({
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
+ xe as default
260
+ };
@@ -0,0 +1,342 @@
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-SYsXgU6x.js";
6
+ import { g as A } from "./user-DUe40u3g.js";
7
+ import { components as R } from "@feedmepos/ui-library";
8
+ import "./index-pjXQwa0j.js";
9
+ import { u as j } from "./vue-i18n-Dn9zxRuv.js";
10
+ import { u as L } from "./loading-D-RglDMV.js";
11
+ import { useCoreStore as se } from "@feedmepos/mf-common";
12
+ import { r as v } from "./index-BgiIGrLb.js";
13
+ import { c as ie, a as ne } from "./object-BYyQ0PZp.js";
14
+ import { u as ce } from "./membership-DTfMyKwP.js";
15
+ import { c as le } from "./string-Gcy5IM_H.js";
16
+ import { c as de } from "./plugins-CbpvMMOJ.js";
17
+ import { u as V, w as me } from "./xlsx-DugGi7dB.js";
18
+ import { e as f } from "./index-vh86FiIQ.js";
19
+ import { h as ue } from "./moment-D7p2TMB-.js";
20
+ import { o as pe } from "./objectId-dwaoBfJX.js";
21
+ const fe = {
22
+ key: 0,
23
+ class: "flex justify-end mb-16"
24
+ }, ge = { class: "flex flex-col space-y-16 pr-12" }, he = /* @__PURE__ */ T({
25
+ __name: "UpdateCriteriaProgressSheet",
26
+ emits: ["refresh"],
27
+ setup(g, { expose: o, emit: m }) {
28
+ const y = m;
29
+ j();
30
+ const { minor: k } = L, l = B(!1), d = B({}), F = se(), S = [
31
+ {
32
+ header: "Criteria title",
33
+ accessorFn: (a) => a.name
34
+ },
35
+ {
36
+ header: "Status",
37
+ cell(a) {
38
+ var u;
39
+ const e = a.row.original, r = (u = d.value.criteria_progress) == null ? void 0 : u.find(
40
+ (_) => _.criteria === e._id
41
+ ), 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";
42
+ return [
43
+ h(R.FmChip, {
44
+ label: i,
45
+ compact: !0,
46
+ class: c
47
+ })
48
+ ];
49
+ }
50
+ },
51
+ {
52
+ id: "actions",
53
+ cell(a) {
54
+ var i;
55
+ const e = a.row.original;
56
+ return [
57
+ !((i = d.value.criteria_progress) == null ? void 0 : i.some(
58
+ (c) => c.criteria === e._id
59
+ )) && e.type == "MANUAL" ? h(R.FmButton, {
60
+ variant: "secondary",
61
+ label: "Mark as completed",
62
+ size: "md",
63
+ onClick: (c) => {
64
+ c.stopPropagation(), x(e._id.toString());
65
+ }
66
+ }) : null
67
+ ];
68
+ }
69
+ }
70
+ ], M = H(() => {
71
+ var e, r, i, c;
72
+ return (((r = (e = d.value) == null ? void 0 : e.criteria_progress) == null ? void 0 : r.filter(
73
+ (u) => {
74
+ var _;
75
+ return (_ = d.value) == null ? void 0 : _.criteria.some(
76
+ (P) => P._id.toString() === u.criteria.toString()
77
+ );
78
+ }
79
+ )) || []).length == ((i = d.value) == null ? void 0 : i.criteria.length) && ((c = d.value) == null ? void 0 : c.status) != "COMPLETED";
80
+ });
81
+ async function x(a) {
82
+ var r;
83
+ const e = ie(ne(d.value));
84
+ e.criteria_progress = [
85
+ {
86
+ criteria: a,
87
+ ref: `ADMIN:${(r = F.user) == null ? void 0 : r.id}:${(/* @__PURE__ */ new Date()).toISOString()}`,
88
+ completedAt: /* @__PURE__ */ new Date()
89
+ }
90
+ ], k(
91
+ async () => {
92
+ await v.updateCriteriaProgress(
93
+ d.value._id,
94
+ e
95
+ ), l.value = !1, y("refresh");
96
+ },
97
+ {
98
+ message: "Updating criteria progress",
99
+ successMessage: "Criteria progress updated successfully"
100
+ }
101
+ );
102
+ }
103
+ function t(a, e) {
104
+ l.value = a, d.value = e;
105
+ }
106
+ function s() {
107
+ l.value = !1;
108
+ }
109
+ return o({
110
+ showSheet: t,
111
+ hideSheet: s,
112
+ data: d
113
+ }), (a, e) => {
114
+ const r = C("FmButton"), i = C("FmTable"), c = C("FmSideSheet");
115
+ return I(), J(c, {
116
+ "max-width": 768,
117
+ modelValue: n(l),
118
+ "onUpdate:modelValue": e[1] || (e[1] = (u) => Q(l) ? l.value = u : null),
119
+ header: "Referee Criteria"
120
+ }, {
121
+ default: X(() => [
122
+ n(M) ? (I(), U("div", fe, [
123
+ w(r, {
124
+ icon: "refresh",
125
+ label: "Refresh",
126
+ onClick: e[0] || (e[0] = Z((u) => x(n(d)._id), ["stop"]))
127
+ })
128
+ ])) : ee("", !0),
129
+ N("div", ge, [
130
+ w(i, {
131
+ "row-data": n(d).criteria,
132
+ "hide-footer": !0,
133
+ "page-size": 100,
134
+ "column-defs": S
135
+ }, null, 8, ["row-data"])
136
+ ])
137
+ ]),
138
+ _: 1
139
+ }, 8, ["modelValue"]);
140
+ };
141
+ }
142
+ });
143
+ class _e {
144
+ constructor() {
145
+ z(this, "data", []);
146
+ }
147
+ addRecord(o) {
148
+ this.data.push(o);
149
+ }
150
+ buildExcel() {
151
+ const o = V.book_new(), m = V.json_to_sheet(this.data);
152
+ return V.book_append_sheet(o, m, "Referrals"), o;
153
+ }
154
+ }
155
+ const we = { class: "flex items-center justify-end" }, ze = /* @__PURE__ */ T({
156
+ __name: "Record",
157
+ setup(g) {
158
+ const { t: o } = j();
159
+ ce();
160
+ const { minor: m } = L, y = B(null), k = [
161
+ {
162
+ header: "ID",
163
+ meta: {
164
+ maxWidth: "100px"
165
+ },
166
+ cell(t) {
167
+ return h("div", { class: "flex items-center" }, [
168
+ h(R.FmIcon, {
169
+ name: "content_copy",
170
+ outline: !0,
171
+ size: "sm",
172
+ class: "cursor-pointer mr-4",
173
+ onClick: (s) => {
174
+ s.preventDefault(), s.stopPropagation(), de(t.row.original._id.toString());
175
+ }
176
+ }),
177
+ h(
178
+ "div",
179
+ { class: "pr-2 text-ellipsis overflow-hidden" },
180
+ t.row.original._id.toString()
181
+ )
182
+ ]);
183
+ },
184
+ enableSorting: !1
185
+ },
186
+ {
187
+ header: o("connect.referral.record.referer_info"),
188
+ enableSorting: !0,
189
+ cell(t) {
190
+ return t.row.original.pf_referer ? A(t.row.original.pf_referer, !0) : "N/A";
191
+ }
192
+ },
193
+ {
194
+ header: o("connect.referral.record.referee_info"),
195
+ enableSorting: !0,
196
+ cell(t) {
197
+ return t.row.original.pf_referee ? A(t.row.original.pf_referee, !0) : "N/A";
198
+ }
199
+ },
200
+ {
201
+ header: o("connect.referral.record.referee_criteria"),
202
+ accessorKey: "criteria",
203
+ id: "criteria",
204
+ cell(t) {
205
+ var r;
206
+ const a = (((r = t.row.original.criteria_progress) == null ? void 0 : r.filter(
207
+ (i) => t.row.original.criteria.some(
208
+ (c) => c._id.toString() === i.criteria.toString()
209
+ )
210
+ )) || []).length, e = t.row.original.criteria.length;
211
+ return e === 0 ? h("div", "No criteria") : h("div", `${a}/${e} completed criteria`);
212
+ }
213
+ },
214
+ {
215
+ header: o("connect.referral.record.status"),
216
+ id: "status",
217
+ cell(t) {
218
+ const s = t.row.original.status;
219
+ return h(R.FmChip, {
220
+ label: le.title(s.replace("_", " ")),
221
+ compact: !0,
222
+ 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"
223
+ });
224
+ }
225
+ }
226
+ ], { tableMeta: l, rowData: d, onSort: F, debouncedFetchData: S, onSearch: M } = oe(v.readRecords);
227
+ async function x() {
228
+ const t = new _e(), s = (await v.readRecords({
229
+ limit: 1,
230
+ skip: 0,
231
+ sortBy: f.sortBy,
232
+ descending: f.descending
233
+ })).meta.totalResources ?? 0, a = f.rowsPerPage;
234
+ await m(
235
+ async () => {
236
+ var e, r, i, c;
237
+ for (let u = 0; u < s; u += a) {
238
+ const _ = {
239
+ ...f,
240
+ limit: a,
241
+ skip: f.page - 1,
242
+ sortBy: f.sortBy,
243
+ descending: f.descending
244
+ }, P = await v.readRecords(_);
245
+ for (const p of P.resources) {
246
+ const E = (p.criteria || []).reduce(
247
+ (b, D) => {
248
+ var $;
249
+ const Y = (($ = p.criteria_progress) == null ? void 0 : $.filter(
250
+ (K) => p.criteria.some(
251
+ (W) => W._id.toString() === K.criteria.toString()
252
+ )
253
+ )) || [];
254
+ return b[D.name] = Y.length > 0 ? "Completed" : "In Progress", b;
255
+ },
256
+ {}
257
+ );
258
+ console.log(E);
259
+ const O = {
260
+ ID: p._id.toString(),
261
+ RefererName: ((e = p.pf_referer) == null ? void 0 : e.name) ?? "",
262
+ RefererPhone: ((r = p.pf_referer) == null ? void 0 : r.phoneNumber) ?? "",
263
+ RefereeName: ((i = p.pf_referee) == null ? void 0 : i.name) ?? "",
264
+ RefereePhone: ((c = p.pf_referee) == null ? void 0 : c.phoneNumber) ?? "",
265
+ ReferredAt: ue(pe(p._id)).format(
266
+ "DD/MM/YYYY"
267
+ ),
268
+ Status: p.status,
269
+ Criteria: Object.entries(E).map(([b, D]) => `${b}: ${D}`).join(", ")
270
+ };
271
+ t.addRecord(O);
272
+ }
273
+ f.page++;
274
+ }
275
+ await me(
276
+ t.buildExcel(),
277
+ `referrals-${(/* @__PURE__ */ new Date()).toISOString()}.xlsx`,
278
+ {
279
+ bookType: "xlsx",
280
+ bookSST: !1,
281
+ type: "array"
282
+ }
283
+ ), f.page = 1;
284
+ },
285
+ {
286
+ message: "Exporting referral records...",
287
+ successMessage: "Referral record exported successfully"
288
+ }
289
+ );
290
+ }
291
+ return re(async () => {
292
+ await S();
293
+ }), (t, s) => {
294
+ const a = C("FmSearch"), e = C("FmButton");
295
+ return I(), U(te, null, [
296
+ N("div", null, [
297
+ N("div", we, [
298
+ w(a, {
299
+ class: "mt-4",
300
+ modelValue: n(l).searchValue,
301
+ "onUpdate:modelValue": [
302
+ s[0] || (s[0] = (r) => n(l).searchValue = r),
303
+ n(M)
304
+ ],
305
+ placeholder: "Search",
306
+ collapsible: ""
307
+ }, null, 8, ["modelValue", "onUpdate:modelValue"]),
308
+ w(e, {
309
+ icon: "ios_share",
310
+ variant: "tertiary",
311
+ onClick: x
312
+ })
313
+ ]),
314
+ w(ae, {
315
+ loading: n(l).isLoading,
316
+ "row-data": n(d),
317
+ "row-count": n(l).totalRows,
318
+ "column-defs": k,
319
+ "shrink-at": !1,
320
+ "page-count": n(l).pageCount,
321
+ "page-index": n(l).pageIndex,
322
+ "page-size": n(l).pageSize,
323
+ onSortChange: n(F),
324
+ onPageChange: s[1] || (s[1] = (r) => n(S)({ pageSize: r.pageSize, pageIndex: r.pageIndex })),
325
+ onRowClick: s[2] || (s[2] = (r) => {
326
+ var i;
327
+ return (i = n(y)) == null ? void 0 : i.showSheet(!0, r.original);
328
+ })
329
+ }, null, 8, ["loading", "row-data", "row-count", "page-count", "page-index", "page-size", "onSortChange"])
330
+ ]),
331
+ w(he, {
332
+ ref_key: "updateCriteriaProgressSheetRef",
333
+ ref: y,
334
+ onRefresh: n(S)
335
+ }, null, 8, ["onRefresh"])
336
+ ], 64);
337
+ };
338
+ }
339
+ });
340
+ export {
341
+ ze as default
342
+ };
@@ -0,0 +1,45 @@
1
+ import { defineComponent as d, computed as v, resolveComponent as n, openBlock as f, createElementBlock as E, Fragment as R, createVNode as a, unref as l, createElementVNode as s } from "vue";
2
+ import { u as b } from "./vue-i18n-Dn9zxRuv.js";
3
+ import { R as r } from "./app-CyNzTZOx.js";
4
+ import { useRouter as V } from "vue-router";
5
+ const w = { class: "flex flex-col" }, T = { class: "px-24" }, S = /* @__PURE__ */ d({
6
+ __name: "Review",
7
+ setup(g) {
8
+ const { t } = b(), c = V(), o = [
9
+ {
10
+ label: t("connect.review.tabs.overview"),
11
+ value: r["$connect-REVIEW_OVERVIEW"]
12
+ },
13
+ {
14
+ label: t("connect.review.tabs.settings"),
15
+ value: r["$connect-REVIEW_SETTINGS"]
16
+ }
17
+ ], m = v(
18
+ () => o.find((e) => e.value === c.currentRoute.value.name) ?? o[0]
19
+ );
20
+ async function u(e) {
21
+ await c.push({ name: e });
22
+ }
23
+ return (e, x) => {
24
+ const i = n("FmPageHead"), _ = n("FmTabs"), p = n("RouterView");
25
+ return f(), E(R, null, [
26
+ a(i, {
27
+ title: l(t)("connect.navigation.review")
28
+ }, null, 8, ["title"]),
29
+ s("div", w, [
30
+ s("div", T, [
31
+ a(_, {
32
+ "model-value": l(m).value,
33
+ items: o,
34
+ "onUpdate:modelValue": u
35
+ }, null, 8, ["model-value"])
36
+ ]),
37
+ a(p)
38
+ ])
39
+ ], 64);
40
+ };
41
+ }
42
+ });
43
+ export {
44
+ S as default
45
+ };