@ozdao/prometheus-framework 0.1.16 → 0.1.17

Sign up to get free protection for your applications and to get access to all the features.
Files changed (100) hide show
  1. package/dist/Breadcrumbs.vue_vue_type_style_index_0_lang-579e2c7a.mjs +1945 -0
  2. package/dist/Breadcrumbs.vue_vue_type_style_index_0_lang-cab2bcd2.js +1 -0
  3. package/dist/ButtonFollow-23c4d9fc.mjs +132 -0
  4. package/dist/ButtonFollow-bf5e6d42.js +1 -0
  5. package/dist/CardOrganization-63dcc83b.js +1 -0
  6. package/dist/CardOrganization-e530c9d5.mjs +230 -0
  7. package/dist/Chips-3dac276c.js +1 -0
  8. package/dist/Feed-4d9001aa.mjs +368 -0
  9. package/dist/Feed-51eef23f.js +1 -0
  10. package/dist/Feed-d78d4b91.mjs +439 -0
  11. package/dist/Feed-f4e9769e.js +1 -0
  12. package/dist/Gallery-1f82841a.mjs +357 -0
  13. package/dist/Gallery-dd29c7f6.js +1 -0
  14. package/dist/Image-a2c2ab9c.js +9 -0
  15. package/dist/Image-ad6d4f0f.mjs +477 -0
  16. package/dist/Popup-383abb2e.js +1 -0
  17. package/dist/Popup-f7a5e86b.mjs +76 -0
  18. package/dist/Product-b32fb0e1.js +7 -0
  19. package/dist/Product-d01e3a0d.mjs +839 -0
  20. package/dist/ProductEdit-2b4d1d88.js +1 -0
  21. package/dist/ProductEdit-5e479343.mjs +300 -0
  22. package/dist/ProfileBlogposts-070cb7e9.mjs +65 -0
  23. package/dist/ProfileBlogposts-b6bf0c42.js +1 -0
  24. package/dist/ProfileComments-8a0c489c.mjs +44 -0
  25. package/dist/ProfileComments-f0000ea6.js +1 -0
  26. package/dist/ProfileEvents-8b88287a.js +1 -0
  27. package/dist/ProfileEvents-d978617d.mjs +57 -0
  28. package/dist/ProfileLikes-d5f9f058.js +1 -0
  29. package/dist/ProfileLikes-f5ad4497.mjs +44 -0
  30. package/dist/ProfileOrganizations-422d1fa5.js +1 -0
  31. package/dist/ProfileOrganizations-6b1bc5b2.mjs +213 -0
  32. package/dist/Publics-640d32fc.mjs +123 -0
  33. package/dist/Publics-8595ab7e.js +1 -0
  34. package/dist/Socials-43293869.js +1 -0
  35. package/dist/Tab-dcd62005.js +1 -0
  36. package/dist/UploadImage-dfb36cdb.js +1 -0
  37. package/dist/UploadImage-e4418b43.mjs +83 -0
  38. package/dist/UploadImageMultiple-c9a7b54f.js +1 -0
  39. package/dist/UploadImageMultiple-d2d48f39.mjs +58 -0
  40. package/dist/auth-45a454f2.js +7 -0
  41. package/dist/auth-5cd34aae.mjs +905 -0
  42. package/dist/auth.client.cjs +8 -8
  43. package/dist/auth.client.js +16 -15
  44. package/dist/auth.validation-4b016fa5.js +1 -0
  45. package/dist/auth.validation-a52304cf.mjs +20 -0
  46. package/dist/backoffice.client.cjs +1 -0
  47. package/dist/backoffice.client.js +69 -0
  48. package/dist/carousel.es-cdfb392c.js +5 -0
  49. package/dist/community.client.cjs +1 -1
  50. package/dist/community.client.js +23 -22
  51. package/dist/components/EditImages/EditImages.vue.d.ts +7 -0
  52. package/dist/components/FieldPhone/FieldPhone(script-setup).vue.d.ts +3 -3
  53. package/dist/components/FieldPhone/FieldPhone.vue.d.ts +1 -1
  54. package/dist/events.client.cjs +2 -2
  55. package/dist/events.client.js +17 -16
  56. package/dist/files.server.js +149 -112
  57. package/dist/files.server.mjs +149 -112
  58. package/dist/gallery.server.js +127 -0
  59. package/dist/gallery.server.mjs +128 -0
  60. package/dist/index-2059e444.js +2 -0
  61. package/dist/index-4e469a71.mjs +941 -0
  62. package/dist/landing.client.cjs +1 -1
  63. package/dist/modules/gallery/components/sections/Gallery.vue.d.ts +2 -0
  64. package/dist/modules/icons/navigation/IconChevronRight.vue.d.ts +13 -1
  65. package/dist/modules/mobile/components/Menu/MenuItem.vue.d.ts +14 -2
  66. package/dist/organizations-81e762e7.mjs +122 -0
  67. package/dist/organizations-cf1ab766.js +1 -0
  68. package/dist/organizations.client-b692a78a.mjs +3018 -0
  69. package/dist/organizations.client-bdc9b044.js +3 -0
  70. package/dist/organizations.client.cjs +1 -1
  71. package/dist/organizations.client.js +44 -43
  72. package/dist/style.css +1 -1
  73. package/dist/users.client.cjs +1 -1
  74. package/dist/users.client.js +224 -184
  75. package/dist/vue-draggable-next.esm-bundler-21a209c6.js +10 -0
  76. package/dist/vuex.esm-bundler-685cf29f.js +5 -0
  77. package/package.json +10 -1
  78. package/src/components/EditImages/EditImages.vue +55 -0
  79. package/src/configurator/components/layouts/layoutConfigurator.vue +0 -40
  80. package/src/modules/backoffice/backoffice.client.js +15 -0
  81. package/src/modules/backoffice/components/layouts/Account.vue +48 -58
  82. package/src/modules/backoffice/router/backoffice.js +20 -0
  83. package/src/modules/files/controllers/files.controller.js +27 -131
  84. package/src/modules/files/middlewares/server/index.js +10 -0
  85. package/src/modules/files/middlewares/server/md.js +151 -0
  86. package/src/modules/files/middlewares/server/middlewareMulter.js +121 -0
  87. package/src/modules/files/routes/files.routes.js +20 -6
  88. package/src/modules/gallery/components/sections/Gallery.vue +414 -0
  89. package/src/modules/gallery/controllers/gallery.controller.js +87 -73
  90. package/src/modules/gallery/gallery.client.js +17 -0
  91. package/src/modules/gallery/gallery.server.js +13 -0
  92. package/src/modules/gallery/models/photo.model.js +20 -14
  93. package/src/modules/gallery/routes/gallery.routes.js +18 -9
  94. package/src/modules/gallery/store/gallery.js +25 -19
  95. package/src/modules/icons/navigation/IconChevronRight.vue +14 -2
  96. package/src/modules/mobile/components/Menu/Menu.vue +1 -1
  97. package/src/modules/mobile/components/Menu/MenuItem.vue +8 -2
  98. package/src/modules/users/components/pages/Profile.vue +22 -1
  99. package/src/modules/backoffice/components/pages/Profile.vue +0 -109
  100. package/src/modules/backoffice/components/pages/profile/ProfileEdit.vue +0 -132
@@ -0,0 +1,439 @@
1
+ import { reactive as z, watch as B, openBlock as o, createElementBlock as i, toDisplayString as d, createCommentVNode as c, createElementVNode as b, ref as g, createTextVNode as I, computed as L, createBlock as w, withModifiers as T, createVNode as k, normalizeClass as N, unref as m, renderSlot as O, onMounted as U, Transition as $, withCtx as j, Fragment as A, renderList as M } from "vue";
2
+ import { _ as F } from "./EmptyState-34d85f10.mjs";
3
+ import { _ as V } from "./_plugin-vue_export-helper-dad06003.mjs";
4
+ import { _ as q, a as D } from "./Chips-03ff0c34.mjs";
5
+ import { useRouter as G } from "vue-router";
6
+ import { a as E } from "./index-4e469a71.mjs";
7
+ import { s as p } from "./globals-96ba60e4.mjs";
8
+ import { I as H } from "./IconEdit-eacf3856.mjs";
9
+ const _ = E.create({ baseURL: process.env.API_URL, withCredentials: !0 });
10
+ _.defaults.withCredentials = !0;
11
+ const f = z({
12
+ all: [],
13
+ filter: {
14
+ // query
15
+ tags: [],
16
+ period: ""
17
+ // pagination
18
+ },
19
+ pagination: {
20
+ page: 1,
21
+ perPage: 18
22
+ },
23
+ // Sort
24
+ sort: {
25
+ current: "popularity",
26
+ ascending: !1
27
+ },
28
+ current: {
29
+ _id: "",
30
+ url: "",
31
+ status: "",
32
+ name: "",
33
+ tags: [],
34
+ owner: {},
35
+ date: "",
36
+ views: 0,
37
+ content: []
38
+ }
39
+ });
40
+ async function R(e = {}) {
41
+ e.params = e.params || {}, e.params.skip = e.skip || 0, e.params.limit = e.limit || 9, e.params.tags = e.tags || [], e.period && (e.params.period = e.period), e.url && (e.params = { url: e.url }), e.category && (e.params.category = e.category), e.organization && (e.params.organization = e.organization), e.owner && (e.params.owner = e.owner), e.creator && (e.params.creator = e.creator), e.status && (e.params.status = e.status), e.user && (e.params.user = e.user), e.params.skip = e.skip || 0, e.params.limit = e.limit || 10;
42
+ try {
43
+ console.log("Request params:" + e.params);
44
+ const t = await _.get("/api/blog/read", { params: e.params });
45
+ return e.url ? P(t.data, "current") : P(t.data, "all"), Promise.resolve(t.data);
46
+ } catch (t) {
47
+ return p(t), Promise.reject(t);
48
+ }
49
+ }
50
+ async function J(e) {
51
+ return _.post("/api/blog/create", e).then(
52
+ (t) => (P(t.data, "current"), Promise.resolve(t.data)),
53
+ (t) => (p(t), Promise.reject(t))
54
+ );
55
+ }
56
+ async function K(e) {
57
+ return _.post("/api/blog/update", e).then(
58
+ (t) => (P(t.data, "current"), Promise.resolve(t.data)),
59
+ (t) => (p(t), Promise.reject(t))
60
+ );
61
+ }
62
+ async function Q(e) {
63
+ return await _.delete(`/api/blog/delete/${e}`).then(
64
+ (t) => {
65
+ const a = f.all.findIndex((r) => r._id === e);
66
+ return a !== -1 && f.all.splice(a, 1), Promise.resolve(t.data);
67
+ },
68
+ (t) => (p(t), Promise.reject(t))
69
+ );
70
+ }
71
+ function P(e, t) {
72
+ f[t] = e;
73
+ }
74
+ function W() {
75
+ f.current = {
76
+ _id: "",
77
+ url: "",
78
+ status: "",
79
+ name: "",
80
+ tags: [],
81
+ author: "",
82
+ owner: "",
83
+ date: "",
84
+ views: 0,
85
+ content: []
86
+ };
87
+ }
88
+ function X(e) {
89
+ const t = {
90
+ order: f.project.content.length + 1,
91
+ type: e.type,
92
+ data: e.data,
93
+ class: e.class,
94
+ content: e.content
95
+ };
96
+ f.project.content.push(t);
97
+ }
98
+ B(f, (e, t) => {
99
+ });
100
+ const Ce = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
101
+ __proto__: null,
102
+ blockAdd: X,
103
+ clean: W,
104
+ create: J,
105
+ read: R,
106
+ remove: Q,
107
+ set: P,
108
+ state: f,
109
+ update: K
110
+ }, Symbol.toStringTag, { value: "Module" })), Y = {
111
+ props: {
112
+ progress: {
113
+ type: Number,
114
+ default: null
115
+ },
116
+ status: {
117
+ type: String,
118
+ default: null
119
+ }
120
+ }
121
+ }, Z = { class: "circular-loader" }, ee = /* @__PURE__ */ b("svg", { viewBox: "25 25 50 50" }, [
122
+ /* @__PURE__ */ b("circle", {
123
+ cx: "50",
124
+ cy: "50",
125
+ r: "20",
126
+ fill: "none",
127
+ "stroke-width": "4",
128
+ "stroke-miterlimit": "10"
129
+ })
130
+ ], -1), te = {
131
+ key: 0,
132
+ class: "progress-text"
133
+ }, re = {
134
+ key: 1,
135
+ class: "uppercase t-semi w-m-10r status-text"
136
+ };
137
+ function ae(e, t, a, r, s, l) {
138
+ return o(), i("div", Z, [
139
+ ee,
140
+ a.progress ? (o(), i("div", te, d(a.progress), 1)) : c("", !0),
141
+ a.status ? (o(), i("div", re, d(a.status), 1)) : c("", !0)
142
+ ]);
143
+ }
144
+ const se = /* @__PURE__ */ V(Y, [["render", ae]]), x = E.create({
145
+ baseURL: process.env.API_URL,
146
+ withCredentials: !0
147
+ }), y = z({
148
+ reactions: [],
149
+ error: null
150
+ }), S = {
151
+ async read({ user: e, type: t, target: a, role: r }) {
152
+ try {
153
+ const s = await x.get("/api/reactions", { params: { user: e, type: t, target: a, role: r } });
154
+ return y.error = null, y.reactions = s.data, Promise.resolve(s.data);
155
+ } catch (s) {
156
+ return p(s), Promise.reject(s);
157
+ }
158
+ },
159
+ async create(e) {
160
+ try {
161
+ const t = await x.post("/api/reactions/create", e);
162
+ return y.error = null, Promise.resolve(t.data);
163
+ } catch (t) {
164
+ return console.log(t), p(t), Promise.reject(t);
165
+ }
166
+ },
167
+ async update(e) {
168
+ try {
169
+ const t = await x.post("/api/reactions/update", e);
170
+ return y.error = null, Promise.resolve(t.data);
171
+ } catch (t) {
172
+ return p(t), Promise.reject(t);
173
+ }
174
+ },
175
+ async delete(e) {
176
+ try {
177
+ const t = await x.post("/api/reactions/delete", e);
178
+ return y.error = null, Promise.resolve(t.data);
179
+ } catch (t) {
180
+ return p(t), Promise.reject(t);
181
+ }
182
+ }
183
+ }, oe = {
184
+ handleReactionUpdate(e, t, a) {
185
+ let r;
186
+ if (Array.isArray(e) ? r = e.find((s) => s._id === t.target) : typeof e == "object" && e._id === t.target && (r = e), r)
187
+ if (r.hasReaction = a, a)
188
+ r.reactions.push(t), r.numberOfReactions += 1;
189
+ else {
190
+ const s = r.reactions.findIndex((l) => l._id === t._id);
191
+ s !== -1 && (r.reactions.splice(s, 1), r.numberOfReactions -= 1);
192
+ }
193
+ }
194
+ };
195
+ B(y, (e) => {
196
+ });
197
+ const Ie = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
198
+ __proto__: null,
199
+ actions: S,
200
+ mutations: oe,
201
+ state: y
202
+ }, Symbol.toStringTag, { value: "Module" })), ne = { class: "t-semi br-top-dark flex-nowrap flex-nojustify flex" }, le = /* @__PURE__ */ b("span", { class: "mn-r-small mn-l-small d-block" }, "·", -1), ie = { class: "cursor-pointer" }, ce = /* @__PURE__ */ b("span", { class: "mn-r-small mn-l-small d-block" }, "·", -1), ue = {
203
+ __name: "FooterBlogpost",
204
+ props: ["blogpost", "owner", "user"],
205
+ setup(e) {
206
+ const t = e, a = g(t.blogpost.numberOfReactions), r = g(t.blogpost.isReacted), s = g(t.blogpost.reactionId);
207
+ async function l(v) {
208
+ if (!t.user) {
209
+ alert("Please login to add a reaction");
210
+ return;
211
+ }
212
+ try {
213
+ const n = {
214
+ target: t.blogpost._id,
215
+ type: "blogpost",
216
+ user: t.user,
217
+ class: "like"
218
+ }, h = await S.create(n);
219
+ h.reaction.class === "like" && (a.value += 1, r.value = !0, s.value = h.reaction._id);
220
+ } catch (n) {
221
+ console.error(n), alert("Error adding reaction. Please try again later.");
222
+ }
223
+ }
224
+ async function u(v) {
225
+ if (!t.user) {
226
+ alert("Please login to add a reaction");
227
+ return;
228
+ }
229
+ try {
230
+ const n = { _id: s.value };
231
+ await S.delete(n), a.value -= 1, r.value = !1, s.value = null;
232
+ } catch {
233
+ alert("Error adding reaction. Please try again later.");
234
+ }
235
+ }
236
+ return (v, n) => (o(), i("footer", ne, [
237
+ I(" 👁️ " + d(e.blogpost.views) + " ", 1),
238
+ le,
239
+ b("div", ie, [
240
+ r.value ? c("", !0) : (o(), i("div", {
241
+ key: 0,
242
+ class: "cursor-pointer",
243
+ onClick: n[0] || (n[0] = (h) => l())
244
+ }, " 👍 " + d(a.value), 1)),
245
+ r.value ? (o(), i("div", {
246
+ key: 1,
247
+ class: "cursor-pointer",
248
+ onClick: n[1] || (n[1] = (h) => u())
249
+ }, " 👍 " + d(a.value), 1)) : c("", !0)
250
+ ]),
251
+ ce,
252
+ I(" 💬 " + d(e.blogpost.numberOfComments), 1)
253
+ ]));
254
+ }
255
+ }, de = { class: "pos-relative bg-grey radius-big" }, me = ["src"], ge = { class: "pd-t-zero pd-medium" }, pe = {
256
+ key: 0,
257
+ class: "cursor-pointer mn-thin flex-nowrap flex w-100"
258
+ }, fe = {
259
+ key: 0,
260
+ class: "pd-micro t-white uppercase t-semi p-small flex-center flex pd-r-small pd-l-small mn-l-thin w-min bg-second radius-extra"
261
+ }, ye = {
262
+ key: 1,
263
+ class: "mn-small t-transp p-big"
264
+ }, be = {
265
+ key: 2,
266
+ class: "mn-small h2"
267
+ }, ve = {
268
+ __name: "CardBlogpost",
269
+ props: ["blogpost", "user", "type"],
270
+ setup(e) {
271
+ const t = e, a = G(), r = L(() => t.blogpost.content.find((l) => l.type === "ImageUpload")), s = L(() => t.blogpost.content.find((l) => l.type === "Textarea"));
272
+ return (l, u) => (o(), i("article", de, [
273
+ e.user === e.blogpost.creator.target._id ? (o(), w(H, {
274
+ key: 0,
275
+ onClick: u[0] || (u[0] = T((v) => l.$router.push({
276
+ name: "Edit BlogPost",
277
+ params: {
278
+ url: e.blogpost.url
279
+ }
280
+ }), ["stop"])),
281
+ class: "z-index-2 pos-absolute pos-t-regular pos-r-regular i-regular t-transp"
282
+ })) : c("", !0),
283
+ k(q, {
284
+ class: N({
285
+ "mn-small pd-medium": e.type !== "short",
286
+ "flex-child-order-last flex-child mn-l-small": e.type === "short"
287
+ }),
288
+ owner: e.blogpost.owner,
289
+ creator: e.blogpost.creator,
290
+ date: e.blogpost.createdAt
291
+ }, null, 8, ["class", "owner", "creator", "date"]),
292
+ m(r) && m(r).content && e.type !== "blogpostPage" ? (o(), i("img", {
293
+ key: 1,
294
+ src: (l.FILE_SERVER_URL || "") + m(r).content,
295
+ alt: "Blog post image",
296
+ class: "mn-medium object-fit-cover w-100 h-20r"
297
+ }, null, 8, me)) : c("", !0),
298
+ b("section", ge, [
299
+ e.type !== "blogpostPage" ? (o(), i("div", pe, [
300
+ b("h3", {
301
+ onClick: u[1] || (u[1] = (v) => m(a).push({
302
+ name: "BlogPost",
303
+ params: {
304
+ url: e.blogpost.url
305
+ }
306
+ })),
307
+ class: ""
308
+ }, d(e.blogpost.name), 1),
309
+ e.blogpost.status === "draft" ? (o(), i("div", fe, d(e.blogpost.status), 1)) : c("", !0)
310
+ ])) : c("", !0),
311
+ m(s) && m(s).content && e.type !== "blogpostPage" ? (o(), i("p", ye, d(m(s).content.slice(0, 120)) + "... ", 1)) : c("", !0),
312
+ e.type === "blogpostPage" ? (o(), i("h3", be, d(e.blogpost.name), 1)) : c("", !0),
313
+ O(l.$slots, "default"),
314
+ e.type !== "short" && e.blogpost.tags.length > 0 ? (o(), w(D, {
315
+ key: 3,
316
+ chips: e.blogpost.tags
317
+ }, null, 8, ["chips"])) : c("", !0)
318
+ ]),
319
+ k(ue, {
320
+ class: "pd-t-zero pd-medium",
321
+ blogpost: e.blogpost,
322
+ user: e.user
323
+ }, null, 8, ["blogpost", "user"])
324
+ ]));
325
+ }
326
+ }, he = { class: "feed" }, we = { key: 1 }, Le = {
327
+ __name: "Feed",
328
+ props: {
329
+ category: {
330
+ type: String,
331
+ default: null
332
+ },
333
+ owner: {
334
+ type: String,
335
+ default: null
336
+ },
337
+ creator: {
338
+ type: String,
339
+ default: null
340
+ },
341
+ status: {
342
+ type: String,
343
+ default: "published"
344
+ },
345
+ user: {
346
+ type: [String, Number],
347
+ default: null
348
+ },
349
+ period: {
350
+ type: String,
351
+ default: null
352
+ }
353
+ },
354
+ setup(e) {
355
+ const t = e, a = g([]), r = g(!0);
356
+ let s = g(!0), l = g(0), u = g(7);
357
+ const v = async () => {
358
+ if (r.value) {
359
+ l.value += u.value;
360
+ const n = await R({
361
+ skip: l.value,
362
+ limit: u.value,
363
+ category: t.category,
364
+ user: t.user,
365
+ owner: t.owner,
366
+ status: t.status,
367
+ creator: t.creator,
368
+ period: t.period
369
+ });
370
+ n.length === 0 && (r.value = !1), a.value = [...a.value, ...n];
371
+ }
372
+ };
373
+ return U(async () => {
374
+ const n = await R({
375
+ skip: l.value,
376
+ limit: u.value,
377
+ category: t.category,
378
+ user: t.user,
379
+ owner: t.owner,
380
+ status: t.status,
381
+ creator: t.creator,
382
+ period: t.period
383
+ });
384
+ n.length === 0 ? r.value = !1 : r.value = !0, a.value = n, s.value = !1;
385
+ }), (n, h) => (o(), i("section", he, [
386
+ k($, { name: "scaleTransition" }, {
387
+ default: j(() => [
388
+ m(s) ? (o(), w(se, {
389
+ key: 0,
390
+ class: "z-index-5 pos-t-50 left-t-50 pos-absolute"
391
+ })) : c("", !0)
392
+ ]),
393
+ _: 1
394
+ }),
395
+ k($, { name: "scaleTransition" }, {
396
+ default: j(() => [
397
+ !m(s) && a.value.length < 1 ? (o(), w(F, {
398
+ key: 0,
399
+ title: "No Blog Posts Found",
400
+ description: "Currently, there are no posts available in this blog. Please check back later.",
401
+ class: "pd-medium mn-thin bg-grey radius-big"
402
+ })) : (o(), i("div", we, [
403
+ (o(!0), i(A, null, M(a.value, (C) => (o(), w(ve, {
404
+ key: C._id,
405
+ blogpost: C,
406
+ user: e.user,
407
+ class: "mn-medium"
408
+ }, null, 8, ["blogpost", "user"]))), 128)),
409
+ k($, { name: "scaleTransition" }, {
410
+ default: j(() => [
411
+ r.value && a.value.length > 0 ? (o(), i("button", {
412
+ key: 0,
413
+ onClick: v,
414
+ class: "w-100 bg-main button"
415
+ }, " Load more ")) : c("", !0)
416
+ ]),
417
+ _: 1
418
+ })
419
+ ]))
420
+ ]),
421
+ _: 1
422
+ })
423
+ ]));
424
+ }
425
+ };
426
+ export {
427
+ se as L,
428
+ Le as _,
429
+ J as a,
430
+ Q as b,
431
+ W as c,
432
+ ve as d,
433
+ ue as e,
434
+ Ce as f,
435
+ Ie as g,
436
+ R as r,
437
+ f as s,
438
+ K as u
439
+ };
@@ -0,0 +1 @@
1
+ "use strict";const e=require("vue"),N=require("./EmptyState-7658d7d6.js"),C=require("./Chips-3dac276c.js"),V=require("./IconEdit-4cfe2115.js"),D=require("./index-2059e444.js"),U=require("vue-router"),$=require("./_plugin-vue_export-helper-f246444f.js"),h=require("./globals-928eb13c.js"),z={key:0,class:"o-hidden pos-relative bg-grey mn-small w-100"},P=["src"],M=["src"],I={class:"w-max mn-r-thin pd-thin radius-small t-semi bg-main"},F={key:0,class:"t-semi"},L={class:"t-semi"},R={key:0,class:"t-semi uppercase"},_={key:1,class:"cursor-pointer mn-thin flex-nowrap flex w-100"},O={key:0,class:""},q={key:1,class:"pd-micro t-white uppercase t-semi p-small flex-center flex pd-r-small pd-l-small mn-l-thin w-min bg-second radius-extra"},j={key:2,class:"mn-small p-big"},b={__name:"CardEvent",props:["event","user","short","type"],setup(t){const r=t;e.ref(new Date),U.useRouter(),e.computed(()=>r.event.content.find(a=>a.type.name==="ImageUpload")),e.computed(()=>r.event.content.find(a=>a.type.name==="Textarea"));const s=e.computed(()=>{const a=new Date,c=Date.UTC(a.getUTCFullYear(),a.getUTCMonth(),a.getUTCDate(),a.getUTCHours(),a.getUTCMinutes(),a.getUTCSeconds()),n=new Date(r.event.date.start),o=Date.UTC(n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate(),n.getUTCHours(),n.getUTCMinutes(),n.getUTCSeconds())-c;if(o<0)return"Finished";if(o===0)return"Starting Now";{const f=Math.floor(o/1e3),g=Math.floor(f/60),k=Math.floor(g/60),w=Math.floor(k/24);return w>0?`${w} days until event`:k>0?`${k} hours until event`:g>0?`${g} minutes until event`:`${f} seconds until event`}}),l=e.computed(()=>{const a=new Date(r.event.date.start),c={day:"2-digit",month:"2-digit"};return a.toLocaleDateString(void 0,c)}),i=e.computed(()=>{console.log(r.event.date.start),console.log(r.event.date.end);const a=new Date(r.event.date.start),c=new Date(r.event.date.end),n=new Intl.DateTimeFormat(void 0,{hour:"2-digit",minute:"2-digit",hourCycle:"h23"}).format(a),p=new Intl.DateTimeFormat(void 0,{hour:"2-digit",minute:"2-digit",hourCycle:"h23"}).format(c);return`${n}-${p}`}),d=e.computed(()=>{const a=r.event.name;return a.length>26?`${a.substring(0,22)}…`:a});return(a,c)=>(e.openBlock(),e.createElementBlock("article",{class:e.normalizeClass([{"flex-nowrap flex-v-center flex":t.type==="short"},"pos-relative"])},[e.createVNode(C._sfc_main,{class:e.normalizeClass({"mn-small pd-medium":t.type!=="short","flex-child-order-last flex-child mn-l-small":t.type==="short"}),owner:t.event.owner,creator:t.event.creator,members:t.event.numberOfTickets,membersPhotos:t.event.participantsPhotos,type:t.type,dateFormatted:e.unref(s)},null,8,["class","owner","creator","members","membersPhotos","type","dateFormatted"]),t.event.cover&&t.type!=="short"?(e.openBlock(),e.createElementBlock("div",z,[e.createElementVNode("img",{src:(a.FILE_SERVER_URL||"")+t.event.cover,alt:"Event image",class:"pos-relative z-index-1 d-block mn-auto h-20r"},null,8,P),e.createElementVNode("img",{src:(a.FILE_SERVER_URL||"")+t.event.cover,alt:"Event Background",class:"z-index-0 pos-absolute w-100 h-100 pos-t-0 pos-r-0",style:{transform:"scale(1.5)",filter:"blur(2rem)","-webkit-filter":"blur(2rem)"}},null,8,M)])):e.createCommentVNode("",!0),e.createElementVNode("section",{class:e.normalizeClass(["pos-relative w-100",{"pd-t-zero pd-medium":t.type!=="short"}])},[t.user===t.event.creator.target._id?(e.openBlock(),e.createBlock(V.IconEdit,{key:0,onClick:c[0]||(c[0]=e.withModifiers(n=>a.$router.push({name:"Edit Event",params:{url:t.event.url}}),["stop"])),class:"z-index-2 pos-absolute pos-t-regular pos-r-regular i-regular t-transp"})):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass([{"mn-small":t.type!=="short"},"flex-v-center flex-nowrap flex"])},[e.createElementVNode("div",I,[t.type!=="short"?(e.openBlock(),e.createElementBlock("span",F,e.toDisplayString(e.unref(l))+" | ",1)):e.createCommentVNode("",!0),e.createElementVNode("span",L,e.toDisplayString(e.unref(i)),1)]),t.type==="short"?(e.openBlock(),e.createElementBlock("span",R,e.toDisplayString(e.unref(d)),1)):e.createCommentVNode("",!0)],2),t.type!=="short"?(e.openBlock(),e.createElementBlock("div",_,[t.type!=="short"?(e.openBlock(),e.createElementBlock("h3",O,e.toDisplayString(t.event.name),1)):e.createCommentVNode("",!0),t.event.status==="draft"?(e.openBlock(),e.createElementBlock("div",q,e.toDisplayString(t.event.status),1)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),t.type!=="short"?(e.openBlock(),e.createElementBlock("p",j,e.toDisplayString(t.event.description),1)):e.createCommentVNode("",!0),e.renderSlot(a.$slots,"default"),t.type!=="short"&&t.event.tags.length>0?(e.openBlock(),e.createBlock(C._sfc_main$1,{key:3,chips:t.event.tags},null,8,["chips"])):e.createCommentVNode("",!0)],2)],2))}},H={},G={width:"100%",height:"20rem",xmlns:"http://www.w3.org/2000/svg"},Y=e.createStaticVNode('<rect x="0" y="0" rx="5" ry="5" width="100%" height="100%" fill="rgb(var(--grey))"></rect><rect x="15" y="15" rx="4" ry="4" width="40%" height="20" fill="rgba(var(--black),0.05)"></rect><rect x="15" y="45" rx="5" ry="5" width="70%" height="50" fill="rgba(var(--black),0.05)"></rect><rect x="15" y="110" rx="3" ry="3" width="90%" height="6" fill="rgba(var(--black),0.05)"></rect><rect x="15" y="130" rx="3" ry="3" width="70%" height="6" fill="rgba(var(--black),0.05)"></rect><rect x="-25%" y="0" width="25%" height="100%" fill="#fff" mask="url(#myMask)" opacity="0.3"><animate attributeName="x" from="-25%" to="100%" dur="2s" repeatCount="indefinite"></animate></rect>',6),A=[Y];function J(t,r){return e.openBlock(),e.createElementBlock("svg",G,A)}const E=$._export_sfc(H,[["render",J]]),y=D.axios.create({baseURL:process.env.API_URL,withCredentials:!0}),u=e.reactive({all:[],filter:{tags:[],period:"",date:null},pagination:{page:1,perPage:18},sort:{current:"popularity",ascending:!1},current:{_id:"",cover:"",url:"",status:"",name:"",tags:[],date:{start:null,false:null},views:0,content:[]}});async function v(t={}){t.params=t.params||{},t.params.skip=t.skip||0,t.params.limit=t.limit||9,t.params.tags=t.tags||[],t.status&&(t.params={status:t.status}),t.url&&(t.params={url:t.url}),t.period&&(t.params.period=t.period),t.category&&(t.params.category=t.category),t.organization&&(t.params.organization=t.organization),t.date&&(t.params.date=t.date),t.participant&&(t.params.participant=t.participant),t.owner&&(t.params.owner=t.owner),t.creator&&(t.params.creator=t.creator),t.user&&(t.params.user=t.user),t.sortOrder&&(t.params.sortOrder=t.sortOrder),t.sortParam&&(t.params.sortParam=t.sortParam),t.params.skip=t.skip||0,t.params.limit=t.limit||10;try{console.log("Request params:"+t.params);const r=await y.get("/api/events/read",{params:t.params});return console.log(t.params),t.url?m(r.data,"current"):m(r.data,"all"),Promise.resolve(r.data)}catch(r){return h.setError(r),Promise.reject(r)}}async function x(t){return y.post("/api/events/create",t).then(r=>(m(r.data,"current"),Promise.resolve(r.data)),r=>(h.setError(r),Promise.reject(r)))}async function B(t){return y.post("/api/events/update",t).then(r=>(m(r.data,"current"),Promise.resolve(r.data)),r=>(h.setError(r),Promise.reject(r)))}async function S(t){return await y.post("/api/events/delete",{_id:t}).then(r=>{const s=u.all.findIndex(l=>l._id===t);return s!==-1&&u.all.splice(s,1),Promise.resolve(r.data)},r=>(h.setError(r),Promise.reject(r)))}function m(t,r){u[r]=t}function T(){u.current={_id:"",cover:"",url:"",status:"",name:"",tags:[],date:{start:null,false:null},views:0,content:[]}}e.watch(u,(t,r)=>{});const K=Object.freeze(Object.defineProperty({__proto__:null,clean:T,create:x,read:v,remove:S,set:m,state:u,update:B},Symbol.toStringTag,{value:"Module"})),Q={class:"feed"},W={__name:"Feed",props:{category:{type:String,default:null},selectedDate:{type:String,default:null},organization:{type:String,default:null},owner:{type:String,default:null},creator:{type:String,default:null},user:{type:[String,Number],default:null},sortOrder:{type:String,default:"desc"},participant:{type:String,default:null},period:{type:String,default:null},status:{type:String,default:null}},setup(t){const r=t,s=e.ref([]),l=e.ref(!1),i=e.ref(!0),d=e.ref(0),a=e.ref(20),c=async()=>{if(l.value){d.value+=a.value;const n=await v({skip:d.value,limit:a.value,category:r.category,sortOrder:r.sortOrder,participant:r.participant,creator:r.creator,user:r.user,date:r.selectedDate,owner:r.owner,organization:r.organization,period:r.period,status:r.status});n.length===0?l.value=!1:l.value=!0,s.value=[...s.value,...n]}};return e.onMounted(async()=>{i.value=!0,console.log(r.selectedDate);const n=await v({skip:d.value,limit:a.value,category:r.category,participant:r.participant,sortOrder:r.sortOrder,user:r.user,owner:r.owner,creator:r.creator,date:r.selectedDate,organization:r.organization,period:r.period,status:r.status});n.length===0?l.value=!1:l.value=!0,s.value=n,i.value=!1}),(n,p)=>(e.openBlock(),e.createElementBlock("section",Q,[e.createVNode(e.TransitionGroup,{tag:"ul",name:"scaleTransition",class:"o-hidden bg-grey radius-big"},{default:e.withCtx(()=>[i.value?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(a.value,o=>(e.openBlock(),e.createBlock(E,{key:o}))),128)):e.createCommentVNode("",!0)]),_:1}),e.createVNode(e.Transition,{name:"scaleTransition"},{default:e.withCtx(()=>[!i.value&&s.value.length<1?(e.openBlock(),e.createBlock(N._sfc_main,{key:0,title:"No Events Found",description:"Currently, there are no events available. Please check back later.",class:"pd-medium mn-thin bg-grey radius-big"})):e.createCommentVNode("",!0)]),_:1}),e.createVNode(e.TransitionGroup,{tag:"ul",name:"scaleTransition",class:"container"},{default:e.withCtx(()=>[!i.value&&s.value.length>0?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(s.value,(o,f)=>(e.openBlock(),e.createBlock(b,{onClick:g=>n.$router.push({name:"Event",params:{url:o.url}}),key:o._id,event:o,owner:t.user,type:"normal",class:e.normalizeClass(["bg-grey radius-big mn-medium",{"br-b br-solid br-black-transp-10":f!==s.value.length-1}])},null,8,["onClick","event","owner","class"]))),128)):e.createCommentVNode("",!0),l.value&&s.value.length>0?(e.openBlock(),e.createElementBlock("button",{key:1,onClick:c,class:"w-100 bg-main button"},"Load more")):e.createCommentVNode("",!0)]),_:1})]))}};exports.SkeletonEvent=E;exports._sfc_main=W;exports._sfc_main$1=b;exports.clean=T;exports.create=x;exports.events=K;exports.read=v;exports.remove=S;exports.state=u;exports.update=B;