@feedmepos/mf-connect 0.1.0-beta.6 → 0.1.0-beta.61

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 (119) hide show
  1. package/dist/Analytic-u9mtlxSv.js +427 -0
  2. package/dist/{App-C2616cfr.js → App-BwTQE7Ft.js} +445 -420
  3. package/dist/AuditLogs-BVMRclSw.js +1886 -0
  4. package/dist/Bin-Cca-XOkz.js +166 -0
  5. package/dist/{Broadcast-CqSwLTAq.js → Broadcast-DRQgpwdP.js} +56 -54
  6. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-DrR9Pmtb.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-CeUu_T1u.js} +6 -8
  7. package/dist/Card-CnbB_u31.js +896 -0
  8. package/dist/Collections-BjlfOSC3.js +459 -0
  9. package/dist/{Credit-CPcLgnsq.js → Credit-BoElrcx9.js} +36 -34
  10. package/dist/CustomSelect.vue_vue_type_script_setup_true_lang-DLnvDVgf.js +108 -0
  11. package/dist/DateRangeChip.vue_vue_type_script_setup_true_lang-BUzUIIUW.js +58 -0
  12. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-B3WVwem6.js +2181 -0
  13. package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-D2buK6Dj.js → EffectSheet.vue_vue_type_style_index_0_lang-CGfpziKs.js} +18 -18
  14. package/dist/{Experience-BoBikt-x.js → Experience-SdGBf4vU.js} +32 -30
  15. package/dist/FilterChip.vue_vue_type_script_setup_true_lang-BrPLkFX8.js +118 -0
  16. package/dist/{Game-DR8PyYZa.js → Game-ChLHibpB.js} +39 -37
  17. package/dist/Index-D7Kq6uyf.js +259 -0
  18. package/dist/Marketing-BDajIqR_.js +20071 -0
  19. package/dist/Member-BPZryqWL.js +317 -0
  20. package/dist/MemberList-C52Dop8Z.js +1598 -0
  21. package/dist/MemberTransactions-DHU78kgS.js +45 -0
  22. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-DhtIZCjT.js → MessageInput.vue_vue_type_script_setup_true_lang-js1F2E4N.js} +83 -71
  23. package/dist/{Mission-CMpvz9zN.js → Mission-BQR3qjAu.js} +101 -87
  24. package/dist/Overview-BbLYWXjG.js +1078 -0
  25. package/dist/{Point-DkZn6p9s.js → Point-DbTcWJbQ.js} +55 -53
  26. package/dist/{Promotion-B7YzwPc_.js → Promotion-CIrpWBQD.js} +65 -57
  27. package/dist/Queue-B0Mfq2Vn.js +244 -0
  28. package/dist/Record-Z6ZrJeLc.js +340 -0
  29. package/dist/Reward-D6k0QFQA.js +442 -0
  30. package/dist/RewardGroup.vue_vue_type_script_setup_true_lang-GJ6j_jOh.js +150 -0
  31. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-gQxmX9ur.js +1637 -0
  32. package/dist/Segment-D6MF-EO8.js +568 -0
  33. package/dist/SelectItems.vue_vue_type_script_setup_true_lang-BWG-pz6F.js +181 -0
  34. package/dist/SendVoucherSheet.vue_vue_type_script_setup_true_lang-HgorlHNz.js +147 -0
  35. package/dist/Setting--OFDS95z.js +1931 -0
  36. package/dist/Store-BqlRTC-c.js +1751 -0
  37. package/dist/{StoreRewards-6BzVwZqr.js → StoreRewards-BTu0IdDN.js} +33 -32
  38. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-BX053DJA.js +943 -0
  39. package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-B6cAveco.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-BAkuqLwy.js} +1 -1
  40. package/dist/{Tier-CW-46oJS.js → Tier-CE9LYAEX.js} +327 -318
  41. package/dist/{Title-CE9rWVdi.js → Title-DOOASUMI.js} +199 -184
  42. package/dist/{Transaction-B21RrC4M.js → Transaction-DPxUOBP-.js} +2 -2
  43. package/dist/UserRuleGroup.vue_vue_type_script_setup_true_lang-CKwf0F_i.js +130 -0
  44. package/dist/Voucher-D69DD02z.js +354 -0
  45. package/dist/VoucherEditor.vue_vue_type_script_setup_true_lang-CFL0Nsez.js +419 -0
  46. package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-BiVZwBuG.js → ZodTextField.vue_vue_type_script_setup_true_lang-Byh6_EJM.js} +1 -1
  47. package/dist/app-C2u1t47T.js +7059 -0
  48. package/dist/app-DgfmbHZe.js +33357 -0
  49. package/dist/app.js +1 -1
  50. package/dist/{business-aHhRUXc0.js → business-BqCJB_vA.js} +1 -1
  51. package/dist/{campaign-DH9NUNf_.js → campaign-CWMPCmmU.js} +2 -2
  52. package/dist/campaign-D0dTbl5b.js +1810 -0
  53. package/dist/campaign.enum-DhE8N4pA.js +20 -0
  54. package/dist/campaign.fn-BpO-RQih.js +758 -0
  55. package/dist/collectible.enum-rWEc6Tsw.js +19 -0
  56. package/dist/{collection.fn-CYlsA-kW.js → collection.fn-biX2iFDQ.js} +2 -2
  57. package/dist/dto-3m7xZwfI.js +214 -0
  58. package/dist/{effect-LSc9YanX.js → effect-ZMGRxKCZ.js} +9 -9
  59. package/dist/email-addresses-lgY03bkq.js +705 -0
  60. package/dist/{export-Cf0-C5Ly.js → export-BOzeYUy8.js} +5 -5
  61. package/dist/{helper-CiZpeMCM.js → helper-CO29wun4.js} +1 -1
  62. package/dist/index-B3V7krW_.js +29000 -0
  63. package/dist/index-BVbiAxW8.js +115 -0
  64. package/dist/{index-D_83JP2i.js → index-Bvch9tuP.js} +48 -4
  65. package/dist/index-CYOwwy3h.js +44 -0
  66. package/dist/{index-D6cEOHP4.js → index-CbYXYVYp.js} +1501 -1480
  67. package/dist/{index-DtsDOuDx.js → index-ChrOXJDq.js} +24 -21
  68. package/dist/index-CsaQJMAR.js +66 -0
  69. package/dist/index-DNGenFnf.js +32 -0
  70. package/dist/{index-BVb5-Ht8.js → index-Dd22X409.js} +259 -173
  71. package/dist/{index-kPhrD63q.js → index-LYAWIqjk.js} +1 -1
  72. package/dist/index-Xh9cW6Y9.js +54 -0
  73. package/dist/{index-gxwjKu3-.js → index-XhqaicYu.js} +2212 -871
  74. package/dist/{index-DW3PRjPL.js → index-YsC4VklJ.js} +1 -1
  75. package/dist/index-vh86FiIQ.js +10 -0
  76. package/dist/{index.esm2017-B7oVYIbY.js → index.esm2017-CJ1flA6S.js} +121 -121
  77. package/dist/loading-CUs_CN1k.js +71 -0
  78. package/dist/{membership-Dw1ylJ9Y.js → membership-D-GVacos.js} +54 -46
  79. package/dist/money-CMtSALkX.js +15 -0
  80. package/dist/number-CDwwgAYM.js +12 -0
  81. package/dist/objectid-Bf9yKD81.js +145 -0
  82. package/dist/{loading-7yq1tinq.js → plugins-9sQTEyth.js} +3871 -3943
  83. package/dist/remy-vue-client-Cpppk9h-.js +1693 -0
  84. package/dist/reward-DblXGhWc.js +36 -0
  85. package/dist/{rule-C0Q_SHow.js → rule-Cy8cTzuw.js} +180 -177
  86. package/dist/{rule-builder-iu17XIof.js → rule-builder-Cn5vZgFN.js} +1 -1
  87. package/dist/style.css +1 -1
  88. package/dist/{template-CyOanTMu.js → template-Cal94dUy.js} +5 -5
  89. package/dist/trigger-C1nwLSP8.js +144 -0
  90. package/dist/user-ir4Rn5bP.js +54 -0
  91. package/dist/{vue-i18n-B0fLJH7a.js → vue-i18n-eOHBBaH5.js} +243 -243
  92. package/dist/{xlsx-BYO_bB9J.js → xlsx-DulnT75_.js} +1 -1
  93. package/package.json +11 -7
  94. package/dist/Analytic-muDf0oMG.js +0 -622
  95. package/dist/Card-bhLoK0ZV.js +0 -825
  96. package/dist/Collections-DjtsAiol.js +0 -453
  97. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-U_QZneS6.js +0 -2813
  98. package/dist/Marketing-Dny2nMUl.js +0 -316
  99. package/dist/Member-CP_smyk8.js +0 -69
  100. package/dist/MemberList-CR3eYI9p.js +0 -1733
  101. package/dist/MemberTransactions-RTx_lKFb.js +0 -38
  102. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-Cs67_GLE.js +0 -1753
  103. package/dist/Segment-Bb4gHt5V.js +0 -437
  104. package/dist/Setting-Xj0AVzh3.js +0 -1901
  105. package/dist/Store-BWRHQ6Ie.js +0 -1511
  106. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-BsFnT8BS.js +0 -890
  107. package/dist/Voucher-KK9fBI0u.js +0 -490
  108. package/dist/app-CjhXHUQv.js +0 -53428
  109. package/dist/app-Dvf_JNMf.js +0 -5764
  110. package/dist/dto-DArfyZAI.js +0 -2770
  111. package/dist/index-Bi_LGEtY.js +0 -99
  112. package/dist/index-CiQDG7Cm.js +0 -762
  113. package/dist/index-CuvNtC_M.js +0 -61
  114. package/dist/index-DQfjSSMF.js +0 -206
  115. package/dist/index-DcxssxPi.js +0 -29193
  116. package/dist/index-DqJVH2kv.js +0 -298
  117. package/dist/money-CPd0XTNv.js +0 -15
  118. package/dist/number-BgXY4un8.js +0 -12
  119. package/dist/user-Bm4KttFq.js +0 -37
@@ -0,0 +1,244 @@
1
+ import { defineComponent as _, h as n, ref as P, watch as T, onBeforeMount as k, resolveComponent as V, openBlock as N, createElementBlock as B, Fragment as U, createVNode as m, unref as o, createElementVNode as f } from "vue";
2
+ import { u as A, _ as z } from "./usePagination-BeF5K3M7.js";
3
+ import { _ as h } from "./FilterChip.vue_vue_type_script_setup_true_lang-BrPLkFX8.js";
4
+ import { c as u, a as q } from "./plugins-9sQTEyth.js";
5
+ import { useDialog as Y, components as w } from "@feedmepos/ui-library";
6
+ import "./index-Dd22X409.js";
7
+ import { H as c, j as x } from "./index-XhqaicYu.js";
8
+ import "./index-CbYXYVYp.js";
9
+ import "./index-YsC4VklJ.js";
10
+ import "./index-Xh9cW6Y9.js";
11
+ import { h as L } from "./moment-BWErdI6_.js";
12
+ import { u as j } from "./vue-i18n-eOHBBaH5.js";
13
+ import { u as H, v as O, x as $ } from "./index.esm2017-CJ1flA6S.js";
14
+ import { g as K, S as W, u as G } from "./index-B3V7krW_.js";
15
+ import { o as Q } from "./objectId-dwaoBfJX.js";
16
+ const J = () => {
17
+ if (!W.getBusinessId()) throw new Error("Invalid business ID");
18
+ return G("queues");
19
+ }, X = {
20
+ async readImportMember(d, p) {
21
+ return K(
22
+ await J().get("", {
23
+ params: { ...d, ...p }
24
+ })
25
+ );
26
+ }
27
+ }, Z = { class: "p-24 flex flex-col gap-y-2" }, ee = { class: "flex items-center justify-between" }, te = { class: "flex gap-8 items-center w-full overflow-x-scroll" }, ye = /* @__PURE__ */ _({
28
+ __name: "Queue",
29
+ setup(d) {
30
+ const { t: p } = j(), S = Y(), F = [
31
+ {
32
+ header: "ID",
33
+ accessorKey: "_id",
34
+ meta: {
35
+ maxWidth: "100px"
36
+ },
37
+ cell(t) {
38
+ return n("div", { class: "flex items-center" }, [
39
+ n(w.FmIcon, {
40
+ name: "content_copy",
41
+ outline: !0,
42
+ size: "sm",
43
+ class: "cursor-pointer mr-4",
44
+ onClick: (e) => {
45
+ e.preventDefault(), e.stopPropagation(), q(t.row.original._id.toString());
46
+ }
47
+ }),
48
+ n(
49
+ "div",
50
+ { class: "pr-2 text-ellipsis overflow-hidden" },
51
+ t.row.original._id.toString()
52
+ )
53
+ ]);
54
+ },
55
+ enableSorting: !1
56
+ },
57
+ {
58
+ header: "Type",
59
+ accessorFn: (t) => u.title(t.type.replace("_", " ")),
60
+ enableSorting: !1
61
+ },
62
+ {
63
+ header: "Status",
64
+ accessorFn: (t) => {
65
+ var e;
66
+ return t.status ? u.title((e = t.status) == null ? void 0 : e.toString()) : "-";
67
+ },
68
+ cell(t) {
69
+ const e = t.row.original.status;
70
+ return n(w.FmChip, {
71
+ label: e ? u.title(e) : "-",
72
+ compact: !0,
73
+ class: I(e)
74
+ });
75
+ },
76
+ enableSorting: !1
77
+ },
78
+ {
79
+ header: "Ref",
80
+ accessorKey: "ref",
81
+ enableSorting: !1
82
+ },
83
+ {
84
+ header: "Created at",
85
+ accessorFn: (t) => L(Q(t._id.toString())).format("D MMM YYYY, hh:mmA"),
86
+ enableSorting: !0
87
+ },
88
+ {
89
+ header: "Context",
90
+ cell(t) {
91
+ var r, a;
92
+ const e = ((a = (r = t.row.original.context) == null ? void 0 : r.context) == null ? void 0 : a.file) || null;
93
+ return e != null && e.downloadUrl && (e != null && e.originalName) ? n(
94
+ "a",
95
+ {
96
+ class: "fm-typo-en-link-md-600",
97
+ href: e.downloadUrl,
98
+ download: e.originalName,
99
+ target: "_blank",
100
+ rel: "noopener"
101
+ },
102
+ e.originalName
103
+ ) : e != null && e.originalName && (e != null && e.isFbFileDeleted) ? n("div", null, e.originalName) : n("div", null, "-");
104
+ },
105
+ enableSorting: !1
106
+ },
107
+ {
108
+ header: "Failed reason",
109
+ cell(t) {
110
+ return n(w.FmButton, {
111
+ icon: "visibility",
112
+ variant: "tertiary",
113
+ disabled: !t.row.original.failedReason,
114
+ onClick: (e) => {
115
+ e.preventDefault(), e.stopPropagation(), D(t.row.original.failedReason);
116
+ }
117
+ });
118
+ },
119
+ enableSorting: !1
120
+ }
121
+ ], I = (t) => {
122
+ switch (t) {
123
+ case c.enum.ACTIVE:
124
+ return "text-fm-color-typo-info bg-fm-color-system-info-100";
125
+ case c.enum.WAITING:
126
+ return "text-fm-color-typo-warning bg-fm-color-system-warning-100";
127
+ case c.enum.COMPLETED:
128
+ return "text-fm-color-typo-success bg-fm-color-system-success-100";
129
+ case c.enum.FAILED:
130
+ return "text-fm-color-typo-error bg-fm-color-system-error-100";
131
+ default:
132
+ return "text-fm-color-typo-primary bg-fm-color-system-primary-100";
133
+ }
134
+ }, C = _({
135
+ name: "FailedReasonDialog",
136
+ props: {
137
+ data: {
138
+ type: String,
139
+ required: !0
140
+ }
141
+ },
142
+ setup(t) {
143
+ return () => n("div", { class: "whitespace-pre-line" }, t.data);
144
+ }
145
+ });
146
+ async function D(t) {
147
+ S.open({
148
+ title: "Failed Reason",
149
+ closeButton: !0,
150
+ dismissAway: !0,
151
+ contentComponent: C,
152
+ contentComponentProps: {
153
+ data: t
154
+ }
155
+ });
156
+ }
157
+ const v = async (t) => {
158
+ const e = H(), r = O(e, t);
159
+ return await $(r);
160
+ }, E = c.options.map((t) => ({ label: u.title(t), value: t })), l = P({
161
+ type: [x.enum.MEMBER_IMPORTED],
162
+ status: []
163
+ }), { tableMeta: i, rowData: M, onSort: R, debouncedFetchData: g } = A(
164
+ async (t) => {
165
+ const e = {
166
+ ...l.value
167
+ }, r = await X.readImportMember(t, e);
168
+ return await Promise.all(
169
+ r.resources.map(async (a) => {
170
+ var y, b;
171
+ const s = (b = (y = a.context) == null ? void 0 : y.context) == null ? void 0 : b.file;
172
+ s != null && s.isFbFileDeleted || (s.downloadUrl = await v(s == null ? void 0 : s.fbFilePath));
173
+ })
174
+ ), {
175
+ resources: r.resources,
176
+ meta: r.meta
177
+ };
178
+ }
179
+ );
180
+ return T(
181
+ l,
182
+ () => {
183
+ g();
184
+ },
185
+ { deep: !0 }
186
+ ), k(async () => {
187
+ await g();
188
+ }), (t, e) => {
189
+ const r = V("FmPageHead");
190
+ return N(), B(U, null, [
191
+ m(r, {
192
+ title: o(p)("connect.queue.title")
193
+ }, null, 8, ["title"]),
194
+ f("div", Z, [
195
+ f("div", ee, [
196
+ f("div", te, [
197
+ m(h, {
198
+ class: "cursor-pointer text-fm-color-neutral-gray-400",
199
+ "right-icon": "keyboard_arrow_down",
200
+ modelValue: o(l).type,
201
+ "onUpdate:modelValue": e[0] || (e[0] = (a) => o(l).type = a),
202
+ label: "Type: ",
203
+ "show-item-label": !0,
204
+ items: [
205
+ {
206
+ label: "Member Imported",
207
+ value: o(x).enum.MEMBER_IMPORTED
208
+ }
209
+ ]
210
+ }, null, 8, ["modelValue", "items"]),
211
+ m(h, {
212
+ class: "cursor-pointer text-fm-color-neutral-gray-400",
213
+ "right-icon": "keyboard_arrow_down",
214
+ modelValue: o(l).status,
215
+ "onUpdate:modelValue": e[1] || (e[1] = (a) => o(l).status = a),
216
+ label: "Status: ",
217
+ "show-item-label": !0,
218
+ items: o(E)
219
+ }, null, 8, ["modelValue", "items"])
220
+ ])
221
+ ]),
222
+ m(z, {
223
+ loading: o(i).isLoading,
224
+ "row-data": o(M),
225
+ "row-count": o(i).totalRows,
226
+ "column-defs": F,
227
+ "page-count": o(i).pageCount,
228
+ "page-index": o(i).pageIndex,
229
+ "page-size": o(i).pageSize,
230
+ "shrink-at": !1,
231
+ onSortChange: o(R),
232
+ onPageChange: e[2] || (e[2] = (a) => o(g)({
233
+ pageSize: a.pageSize,
234
+ pageIndex: a.pageIndex
235
+ }))
236
+ }, null, 8, ["loading", "row-data", "row-count", "page-count", "page-index", "page-size", "onSortChange"])
237
+ ])
238
+ ], 64);
239
+ };
240
+ }
241
+ });
242
+ export {
243
+ ye as default
244
+ };
@@ -0,0 +1,340 @@
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-BeF5K3M7.js";
6
+ import { g as A } from "./user-ir4Rn5bP.js";
7
+ import { components as R } from "@feedmepos/ui-library";
8
+ import { a as se, c as ie } from "./plugins-9sQTEyth.js";
9
+ import { u as j } from "./vue-i18n-eOHBBaH5.js";
10
+ import { u as L } from "./loading-CUs_CN1k.js";
11
+ import { useCoreStore as ne } from "@feedmepos/mf-common";
12
+ import { r as v } from "./index-DNGenFnf.js";
13
+ import { c as ce, a as le } from "./object-qECH92oz.js";
14
+ import { u as de } from "./membership-D-GVacos.js";
15
+ import { u as V, w as me } from "./xlsx-DulnT75_.js";
16
+ import { e as f } from "./index-vh86FiIQ.js";
17
+ import { h as ue } from "./moment-BWErdI6_.js";
18
+ import { o as pe } from "./objectId-dwaoBfJX.js";
19
+ const fe = {
20
+ key: 0,
21
+ class: "flex justify-end mb-16"
22
+ }, ge = { class: "flex flex-col space-y-16 pr-12" }, he = /* @__PURE__ */ T({
23
+ __name: "UpdateCriteriaProgressSheet",
24
+ emits: ["refresh"],
25
+ setup(g, { expose: o, emit: m }) {
26
+ const y = m;
27
+ j();
28
+ const { minor: k } = L, l = B(!1), d = B({}), F = ne(), S = [
29
+ {
30
+ header: "Criteria title",
31
+ accessorFn: (a) => a.name
32
+ },
33
+ {
34
+ header: "Status",
35
+ cell(a) {
36
+ var u;
37
+ const e = a.row.original, r = (u = d.value.criteria_progress) == null ? void 0 : u.find(
38
+ (_) => _.criteria === e._id
39
+ ), 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";
40
+ return [
41
+ h(R.FmChip, {
42
+ label: i,
43
+ compact: !0,
44
+ class: c
45
+ })
46
+ ];
47
+ }
48
+ },
49
+ {
50
+ id: "actions",
51
+ cell(a) {
52
+ var i;
53
+ const e = a.row.original;
54
+ return [
55
+ !((i = d.value.criteria_progress) == null ? void 0 : i.some(
56
+ (c) => c.criteria === e._id
57
+ )) && e.type == "MANUAL" ? h(R.FmButton, {
58
+ variant: "secondary",
59
+ label: "Mark as completed",
60
+ size: "md",
61
+ onClick: (c) => {
62
+ c.stopPropagation(), x(e._id.toString());
63
+ }
64
+ }) : null
65
+ ];
66
+ }
67
+ }
68
+ ], M = H(() => {
69
+ var e, r, i, c;
70
+ return (((r = (e = d.value) == null ? void 0 : e.criteria_progress) == null ? void 0 : r.filter(
71
+ (u) => {
72
+ var _;
73
+ return (_ = d.value) == null ? void 0 : _.criteria.some(
74
+ (P) => P._id.toString() === u.criteria.toString()
75
+ );
76
+ }
77
+ )) || []).length == ((i = d.value) == null ? void 0 : i.criteria.length) && ((c = d.value) == null ? void 0 : c.status) != "COMPLETED";
78
+ });
79
+ async function x(a) {
80
+ var r;
81
+ const e = ce(le(d.value));
82
+ e.criteria_progress = [
83
+ {
84
+ criteria: a,
85
+ ref: `ADMIN:${(r = F.user) == null ? void 0 : r.id}:${(/* @__PURE__ */ new Date()).toISOString()}`,
86
+ completedAt: /* @__PURE__ */ new Date()
87
+ }
88
+ ], k(
89
+ async () => {
90
+ await v.updateCriteriaProgress(
91
+ d.value._id,
92
+ e
93
+ ), l.value = !1, y("refresh");
94
+ },
95
+ {
96
+ message: "Updating criteria progress",
97
+ successMessage: "Criteria progress updated successfully"
98
+ }
99
+ );
100
+ }
101
+ function t(a, e) {
102
+ l.value = a, d.value = e;
103
+ }
104
+ function s() {
105
+ l.value = !1;
106
+ }
107
+ return o({
108
+ showSheet: t,
109
+ hideSheet: s,
110
+ data: d
111
+ }), (a, e) => {
112
+ const r = C("FmButton"), i = C("FmTable"), c = C("FmSideSheet");
113
+ return I(), J(c, {
114
+ "max-width": 768,
115
+ modelValue: n(l),
116
+ "onUpdate:modelValue": e[1] || (e[1] = (u) => Q(l) ? l.value = u : null),
117
+ header: "Referee Criteria"
118
+ }, {
119
+ default: X(() => [
120
+ n(M) ? (I(), U("div", fe, [
121
+ w(r, {
122
+ icon: "refresh",
123
+ label: "Refresh",
124
+ onClick: e[0] || (e[0] = Z((u) => x(n(d)._id), ["stop"]))
125
+ })
126
+ ])) : ee("", !0),
127
+ N("div", ge, [
128
+ w(i, {
129
+ "row-data": n(d).criteria,
130
+ "hide-footer": !0,
131
+ "page-size": 100,
132
+ "column-defs": S
133
+ }, null, 8, ["row-data"])
134
+ ])
135
+ ]),
136
+ _: 1
137
+ }, 8, ["modelValue"]);
138
+ };
139
+ }
140
+ });
141
+ class _e {
142
+ constructor() {
143
+ z(this, "data", []);
144
+ }
145
+ addRecord(o) {
146
+ this.data.push(o);
147
+ }
148
+ buildExcel() {
149
+ const o = V.book_new(), m = V.json_to_sheet(this.data);
150
+ return V.book_append_sheet(o, m, "Referrals"), o;
151
+ }
152
+ }
153
+ const we = { class: "flex items-center justify-end" }, Ee = /* @__PURE__ */ T({
154
+ __name: "Record",
155
+ setup(g) {
156
+ const { t: o } = j();
157
+ de();
158
+ const { minor: m } = L, y = B(null), k = [
159
+ {
160
+ header: "ID",
161
+ meta: {
162
+ maxWidth: "100px"
163
+ },
164
+ cell(t) {
165
+ return h("div", { class: "flex items-center" }, [
166
+ h(R.FmIcon, {
167
+ name: "content_copy",
168
+ outline: !0,
169
+ size: "sm",
170
+ class: "cursor-pointer mr-4",
171
+ onClick: (s) => {
172
+ s.preventDefault(), s.stopPropagation(), se(t.row.original._id.toString());
173
+ }
174
+ }),
175
+ h(
176
+ "div",
177
+ { class: "pr-2 text-ellipsis overflow-hidden" },
178
+ t.row.original._id.toString()
179
+ )
180
+ ]);
181
+ },
182
+ enableSorting: !1
183
+ },
184
+ {
185
+ header: o("connect.referral.record.referer_info"),
186
+ enableSorting: !0,
187
+ cell(t) {
188
+ return t.row.original.pf_referer ? A(t.row.original.pf_referer, !0) : "N/A";
189
+ }
190
+ },
191
+ {
192
+ header: o("connect.referral.record.referee_info"),
193
+ enableSorting: !0,
194
+ cell(t) {
195
+ return t.row.original.pf_referee ? A(t.row.original.pf_referee, !0) : "N/A";
196
+ }
197
+ },
198
+ {
199
+ header: o("connect.referral.record.referee_criteria"),
200
+ accessorKey: "criteria",
201
+ id: "criteria",
202
+ cell(t) {
203
+ var r;
204
+ const a = (((r = t.row.original.criteria_progress) == null ? void 0 : r.filter(
205
+ (i) => t.row.original.criteria.some(
206
+ (c) => c._id.toString() === i.criteria.toString()
207
+ )
208
+ )) || []).length, e = t.row.original.criteria.length;
209
+ return e === 0 ? h("div", "No criteria") : h("div", `${a}/${e} completed criteria`);
210
+ }
211
+ },
212
+ {
213
+ header: o("connect.referral.record.status"),
214
+ id: "status",
215
+ cell(t) {
216
+ const s = t.row.original.status;
217
+ return h(R.FmChip, {
218
+ label: ie.title(s.replace("_", " ")),
219
+ compact: !0,
220
+ 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"
221
+ });
222
+ }
223
+ }
224
+ ], { tableMeta: l, rowData: d, onSort: F, debouncedFetchData: S, onSearch: M } = oe(v.readRecords);
225
+ async function x() {
226
+ const t = new _e(), s = (await v.readRecords({
227
+ limit: 1,
228
+ skip: 0,
229
+ sortBy: f.sortBy,
230
+ descending: f.descending
231
+ })).meta.totalResources ?? 0, a = f.rowsPerPage;
232
+ await m(
233
+ async () => {
234
+ var e, r, i, c;
235
+ for (let u = 0; u < s; u += a) {
236
+ const _ = {
237
+ ...f,
238
+ limit: a,
239
+ skip: f.page - 1,
240
+ sortBy: f.sortBy,
241
+ descending: f.descending
242
+ }, P = await v.readRecords(_);
243
+ for (const p of P.resources) {
244
+ const E = (p.criteria || []).reduce(
245
+ (b, D) => {
246
+ var $;
247
+ const Y = (($ = p.criteria_progress) == null ? void 0 : $.filter(
248
+ (K) => p.criteria.some(
249
+ (W) => W._id.toString() === K.criteria.toString()
250
+ )
251
+ )) || [];
252
+ return b[D.name] = Y.length > 0 ? "Completed" : "In Progress", b;
253
+ },
254
+ {}
255
+ );
256
+ console.log(E);
257
+ const O = {
258
+ ID: p._id.toString(),
259
+ RefererName: ((e = p.pf_referer) == null ? void 0 : e.name) ?? "",
260
+ RefererPhone: ((r = p.pf_referer) == null ? void 0 : r.phoneNumber) ?? "",
261
+ RefereeName: ((i = p.pf_referee) == null ? void 0 : i.name) ?? "",
262
+ RefereePhone: ((c = p.pf_referee) == null ? void 0 : c.phoneNumber) ?? "",
263
+ ReferredAt: ue(pe(p._id)).format(
264
+ "DD/MM/YYYY"
265
+ ),
266
+ Status: p.status,
267
+ Criteria: Object.entries(E).map(([b, D]) => `${b}: ${D}`).join(", ")
268
+ };
269
+ t.addRecord(O);
270
+ }
271
+ f.page++;
272
+ }
273
+ await me(
274
+ t.buildExcel(),
275
+ `referrals-${(/* @__PURE__ */ new Date()).toISOString()}.xlsx`,
276
+ {
277
+ bookType: "xlsx",
278
+ bookSST: !1,
279
+ type: "array"
280
+ }
281
+ ), f.page = 1;
282
+ },
283
+ {
284
+ message: "Exporting referral records...",
285
+ successMessage: "Referral record exported successfully"
286
+ }
287
+ );
288
+ }
289
+ return re(async () => {
290
+ await S();
291
+ }), (t, s) => {
292
+ const a = C("FmSearch"), e = C("FmButton");
293
+ return I(), U(te, null, [
294
+ N("div", null, [
295
+ N("div", we, [
296
+ w(a, {
297
+ class: "mt-4",
298
+ modelValue: n(l).searchValue,
299
+ "onUpdate:modelValue": [
300
+ s[0] || (s[0] = (r) => n(l).searchValue = r),
301
+ n(M)
302
+ ],
303
+ placeholder: "Search",
304
+ collapsible: ""
305
+ }, null, 8, ["modelValue", "onUpdate:modelValue"]),
306
+ w(e, {
307
+ icon: "ios_share",
308
+ variant: "tertiary",
309
+ onClick: x
310
+ })
311
+ ]),
312
+ w(ae, {
313
+ loading: n(l).isLoading,
314
+ "row-data": n(d),
315
+ "row-count": n(l).totalRows,
316
+ "column-defs": k,
317
+ "shrink-at": !1,
318
+ "page-count": n(l).pageCount,
319
+ "page-index": n(l).pageIndex,
320
+ "page-size": n(l).pageSize,
321
+ onSortChange: n(F),
322
+ onPageChange: s[1] || (s[1] = (r) => n(S)({ pageSize: r.pageSize, pageIndex: r.pageIndex })),
323
+ onRowClick: s[2] || (s[2] = (r) => {
324
+ var i;
325
+ return (i = n(y)) == null ? void 0 : i.showSheet(!0, r.original);
326
+ })
327
+ }, null, 8, ["loading", "row-data", "row-count", "page-count", "page-index", "page-size", "onSortChange"])
328
+ ]),
329
+ w(he, {
330
+ ref_key: "updateCriteriaProgressSheetRef",
331
+ ref: y,
332
+ onRefresh: n(S)
333
+ }, null, 8, ["onRefresh"])
334
+ ], 64);
335
+ };
336
+ }
337
+ });
338
+ export {
339
+ Ee as default
340
+ };