@ozdao/prometheus-framework 0.1.23 → 0.1.26

Sign up to get free protection for your applications and to get access to all the features.
Files changed (87) hide show
  1. package/dist/BackofficeGallery-0e0132f5.mjs +306 -0
  2. package/dist/BackofficeGallery-a52a27b6.js +1 -0
  3. package/dist/Breadcrumbs.vue_vue_type_style_index_0_lang-19e23006.mjs +1945 -0
  4. package/dist/Breadcrumbs.vue_vue_type_style_index_0_lang-f3d37f29.js +1 -0
  5. package/dist/Button-d8e72ac0.mjs +296 -0
  6. package/dist/Button-ee08e6bf.js +1 -0
  7. package/dist/ButtonFollow-00d85977.mjs +133 -0
  8. package/dist/ButtonFollow-7c0180b3.js +1 -0
  9. package/dist/CardOrganization-3f4a13d3.mjs +230 -0
  10. package/dist/CardOrganization-bf366e4e.js +1 -0
  11. package/dist/Feed-0b1dad65.js +1 -0
  12. package/dist/Feed-8110366a.mjs +439 -0
  13. package/dist/Feed-82ad8e29.mjs +368 -0
  14. package/dist/Feed-c8b1c72d.js +1 -0
  15. package/dist/Image-2269667e.js +9 -0
  16. package/dist/Image-7dcfe90d.mjs +477 -0
  17. package/dist/MenuItem-1216a99f.js +1 -0
  18. package/dist/MenuItem-97c50b97.mjs +93 -0
  19. package/dist/Popup-0420381f.js +1 -0
  20. package/dist/Popup-47b37484.mjs +76 -0
  21. package/dist/Product-977a8a7f.js +7 -0
  22. package/dist/Product-bbe7171a.mjs +842 -0
  23. package/dist/ProductEdit-e4cad9d1.js +1 -0
  24. package/dist/ProductEdit-f7a9af17.mjs +303 -0
  25. package/dist/ProfileBlogposts-5379335e.js +1 -0
  26. package/dist/ProfileBlogposts-5deee0c5.mjs +65 -0
  27. package/dist/ProfileComments-3cf3e265.mjs +44 -0
  28. package/dist/ProfileComments-8c9146ef.js +1 -0
  29. package/dist/ProfileEvents-7502ed90.mjs +57 -0
  30. package/dist/ProfileEvents-ea023c17.js +1 -0
  31. package/dist/ProfileLikes-23b6f2f9.js +1 -0
  32. package/dist/ProfileLikes-5b52e4ae.mjs +44 -0
  33. package/dist/ProfileOrganizations-769325c7.js +1 -0
  34. package/dist/ProfileOrganizations-c5151835.mjs +214 -0
  35. package/dist/Publics-4438ca51.js +1 -0
  36. package/dist/Publics-538180a8.mjs +45 -0
  37. package/dist/UploadImage-33f6a9f4.js +1 -0
  38. package/dist/UploadImage-f7b0335f.mjs +83 -0
  39. package/dist/UploadImageMultiple-297b3897.js +1 -0
  40. package/dist/UploadImageMultiple-7b132ba0.mjs +58 -0
  41. package/dist/auth-2f9b2dfc.js +7 -0
  42. package/dist/auth-b047fdc0.mjs +612 -0
  43. package/dist/auth.client.cjs +8 -8
  44. package/dist/auth.client.js +24 -23
  45. package/dist/auth.validation-02e0629b.mjs +20 -0
  46. package/dist/auth.validation-6a59443b.js +1 -0
  47. package/dist/backoffice.client.cjs +1 -1
  48. package/dist/backoffice.client.js +1 -1
  49. package/dist/community.client.cjs +1 -1
  50. package/dist/community.client.js +69 -68
  51. package/dist/events.client.cjs +2 -2
  52. package/dist/events.client.js +21 -20
  53. package/dist/files.server.js +1 -1
  54. package/dist/files.server.mjs +1 -1
  55. package/dist/index-0ab9d59c.mjs +934 -0
  56. package/dist/index-7ecbf72a.js +2 -0
  57. package/dist/legal.client.cjs +1 -0
  58. package/dist/legal.client.js +8426 -0
  59. package/dist/modules/landing/components/pages/Legal.vue.d.ts +2 -0
  60. package/dist/modules/landing/components/pages/legal/Cookies.vue.d.ts +2 -0
  61. package/dist/modules/landing/components/pages/legal/Privacy.vue.d.ts +2 -0
  62. package/dist/modules/landing/components/pages/legal/Terms.vue.d.ts +2 -0
  63. package/dist/modules/legal/components/pages/Legal.vue.d.ts +2 -0
  64. package/dist/modules/legal/components/pages/legal/Cookies.vue.d.ts +2 -0
  65. package/dist/modules/legal/components/pages/legal/Privacy.vue.d.ts +2 -0
  66. package/dist/modules/legal/components/pages/legal/Terms.vue.d.ts +2 -0
  67. package/dist/organizations-aed4245d.mjs +122 -0
  68. package/dist/organizations-bb8f676d.js +1 -0
  69. package/dist/organizations.client-5548024c.js +3 -0
  70. package/dist/organizations.client-976762d2.mjs +3021 -0
  71. package/dist/organizations.client.cjs +1 -1
  72. package/dist/organizations.client.js +45 -44
  73. package/dist/style.css +1 -1
  74. package/dist/users.client.cjs +1 -1
  75. package/dist/users.client.js +254 -324
  76. package/package.json +5 -1
  77. package/src/modules/community/components/pages/CreateBlogPost.vue +1 -1
  78. package/src/modules/constructor/components/sections/Constructor.vue +3 -3
  79. package/src/modules/files/middlewares/server/middlewareMulter.js +1 -2
  80. package/src/modules/landing/landing.client.js +1 -2
  81. package/src/modules/legal/components/pages/Legal.vue +43 -0
  82. package/src/modules/legal/components/pages/legal/Cookies.vue +370 -0
  83. package/src/modules/legal/components/pages/legal/Privacy.vue +4284 -0
  84. package/src/modules/legal/components/pages/legal/Terms.vue +1283 -0
  85. package/src/modules/legal/legal.client.js +16 -0
  86. package/src/modules/legal/router/legal.js +22 -0
  87. package/src/modules/users/components/pages/Profile.vue +13 -0
@@ -0,0 +1,306 @@
1
+ import { reactive as X, ref as p, watchEffect as H, openBlock as r, createElementBlock as c, createVNode as _, unref as A, withCtx as b, Fragment as G, renderList as j, createElementVNode as e, computed as J, onMounted as K, createCommentVNode as $, Transition as U, createTextVNode as R, toDisplayString as S, withDirectives as Q, vShow as W, pushScopeId as Y, popScopeId as Z } from "vue";
2
+ import { F as ee, _ as te } from "./Button-d8e72ac0.mjs";
3
+ import { S as se } from "./Select-90d4b7c8.mjs";
4
+ import { a as L } from "./index-0ab9d59c.mjs";
5
+ import { V as le } from "./vue-draggable-next.esm-bundler-ff6e3f52.mjs";
6
+ import { _ as ae } from "./UploadImageMultiple-7b132ba0.mjs";
7
+ import { _ as oe } from "./_plugin-vue_export-helper-dad06003.mjs";
8
+ import "./Select.vue_vue_type_style_index_0_scoped_a78dbba1_lang-4ed993c7.mjs";
9
+ const ie = process.env.API_URL, V = L.create({ baseURL: ie, withCredentials: !0 }), g = X({
10
+ gallery: []
11
+ }), y = {
12
+ async fetchGallery(l, t) {
13
+ const n = [];
14
+ l && n.push(`page=${l}`), t && n.push(`limit=${t}`);
15
+ const a = `/api/gallery${n.length ? `?${n.join("&")}` : ""}`;
16
+ try {
17
+ const o = await V.get(a);
18
+ if (console.log(o), o && o.data)
19
+ return g.gallery = [...g.gallery, ...o.data], o.data;
20
+ } catch (o) {
21
+ throw console.error("Error fetching gallery:", o), o;
22
+ }
23
+ },
24
+ async createPhoto(l) {
25
+ try {
26
+ const t = await V.post("/api/gallery/create", l);
27
+ console.log(t.data), g.gallery = [...t.data, ...g.gallery];
28
+ } catch (t) {
29
+ console.error(t);
30
+ }
31
+ },
32
+ async updatePhoto(l) {
33
+ try {
34
+ const t = {
35
+ ...l,
36
+ categories: typeof l.categories == "string" ? l.categories.split(",").map((o) => o.trim()) : l.categories
37
+ }, n = await L.post("/api/gallery/update", t), a = g.gallery.findIndex((o) => o._id === l._id);
38
+ a !== -1 && (g.gallery[a] = n.data);
39
+ } catch (t) {
40
+ console.error(t);
41
+ }
42
+ },
43
+ async deletePhoto(l) {
44
+ try {
45
+ const t = await V.post(`/api/gallery/delete/${l}`), n = g.gallery.findIndex((a) => a._id === l);
46
+ n !== -1 && g.gallery.splice(n, 1);
47
+ } catch (t) {
48
+ console.error(t);
49
+ }
50
+ }
51
+ };
52
+ const ne = { class: "pos-relative" }, re = ["src"], ce = ["onClick"], de = {
53
+ __name: "EditImages",
54
+ props: {
55
+ images: Array
56
+ },
57
+ emits: ["update"],
58
+ setup(l, { emit: t }) {
59
+ const n = l, a = p([...n.images]);
60
+ H(() => {
61
+ a.value = [...n.images];
62
+ });
63
+ const o = () => {
64
+ t("update:images", a.value);
65
+ }, w = (u) => {
66
+ a.value = [...a.value, ...u], o();
67
+ }, k = (u) => {
68
+ a.value.splice(u, 1), o();
69
+ };
70
+ return (u, x) => (r(), c("div", null, [
71
+ _(ae, {
72
+ "onUpdate:images": w,
73
+ uploadPath: "photos",
74
+ class: "mn-semi pd-small w-100 button bg-black t-white"
75
+ }),
76
+ _(A(le), {
77
+ class: "gap-small flex dragArea list-group w-full",
78
+ modelValue: a.value,
79
+ "onUpdate:modelValue": x[0] || (x[0] = (v) => a.value = v),
80
+ onChange: o
81
+ }, {
82
+ default: b(() => [
83
+ (r(!0), c(G, null, j(a.value, (v, P) => (r(), c("div", ne, [
84
+ e("img", {
85
+ class: "i-extra radius-small o-hidden mn-thin",
86
+ src: (u.FILE_SERVER_URL || "") + v
87
+ }, null, 8, re),
88
+ e("a", {
89
+ onClick: (h) => k(P),
90
+ class: "pos-absolute t-center radius-extra i-medium bg-red pos-t-0 pos-r-0"
91
+ }, "X", 8, ce)
92
+ ]))), 256))
93
+ ]),
94
+ _: 1
95
+ }, 8, ["modelValue"])
96
+ ]));
97
+ }
98
+ };
99
+ const E = (l) => (Y("data-v-26ef6b15"), l = l(), Z(), l), ue = { class: "pos-relative w-100" }, me = { class: "w-100 o-hidden" }, pe = { class: "pd-medium flex-nowrap flex pd-t-thin pd-b-thin o-scroll" }, ge = ["data-id"], _e = ["src", "onClick"], ve = {
100
+ key: 1,
101
+ class: "pd-small radius-small bg-white"
102
+ }, he = ["src", "onClick"], fe = { class: "t-black p-small mn-small" }, ye = /* @__PURE__ */ E(() => /* @__PURE__ */ e("span", { class: "uppercase t-transp" }, "Size", -1)), be = /* @__PURE__ */ E(() => /* @__PURE__ */ e("br", null, null, -1)), we = { class: "pd-2px radius-big d-inline-block bg-grey" }, ke = { class: "t-black p-small mn-small uppe" }, xe = /* @__PURE__ */ E(() => /* @__PURE__ */ e("span", { class: "uppercase t-transp" }, "Categories", -1)), Ce = /* @__PURE__ */ E(() => /* @__PURE__ */ e("br", null, null, -1)), Ie = { class: "pd-2px radius-big d-inline-block bg-grey t-semi" }, $e = { class: "flex-nowrap flex" }, Se = ["onClick"], Ee = { class: "modal pd-thin" }, Pe = { class: "modal-content radius-big" }, ze = { class: "" }, Ue = ["src"], Ve = {
103
+ key: 0,
104
+ class: "flex-v-center flex m modal pd-big"
105
+ }, Ge = { class: "modal-content radius-small pd-medium bg-white" }, je = ["src"], Be = ["src"], Me = {
106
+ __name: "BackofficeGallery",
107
+ setup(l) {
108
+ const t = p(!0), n = p(null);
109
+ let a = 1;
110
+ const o = 10;
111
+ let w = p(null), k = p(!1);
112
+ const u = p([]), x = (d) => {
113
+ u.value = d;
114
+ }, v = J(() => M.value === "all" ? g.gallery : g.gallery.filter((d) => d.categories.includes(M.value))), P = async () => {
115
+ k.value = !0, await y.fetchGallery(a, o), k.value = !1;
116
+ }, h = p(null), s = p({
117
+ categories: "",
118
+ size: "",
119
+ image: !1
120
+ }), C = p(null), z = (d) => {
121
+ console.log(t.value), t.value ? N(d) : (h.value = "modal", s.value.image = d, B());
122
+ }, N = (d) => {
123
+ h.value = "edit-modal", s.value = d || {
124
+ categories: "",
125
+ size: "",
126
+ image: null
127
+ }, B();
128
+ }, f = () => {
129
+ s.value = {
130
+ categories: "",
131
+ size: "",
132
+ image: !1
133
+ }, C.value = null, D();
134
+ }, B = () => {
135
+ document.body.style.overflow = "hidden", document.documentElement.style.overflow = "hidden";
136
+ }, D = () => {
137
+ document.body.style.overflow = "", document.documentElement.style.overflow = "";
138
+ }, F = [
139
+ { name: "Small", value: "" },
140
+ { name: "Regular", value: "grid-item--width1 grid-item--height1" },
141
+ { name: "Medium", value: "grid-item--width2 grid-item--height2" },
142
+ { name: "Big", value: "grid-item--width3 grid-item--height3" }
143
+ ], O = async (d) => {
144
+ await y.deletePhoto(d);
145
+ }, T = async () => {
146
+ await y.updatePhoto(s.value), f();
147
+ }, q = async (d) => {
148
+ if (u.length < 1 || !s.value.categories || !s.value.size) {
149
+ console.error("All fields are required.");
150
+ return;
151
+ }
152
+ await y.createPhoto({
153
+ images: u.value,
154
+ size: s.value.size,
155
+ categories: typeof s.value.categories == "string" ? s.value.categories.split(",").map((m) => m.trim()) : s.value.categories
156
+ }), f();
157
+ };
158
+ let M = p("all");
159
+ return K(async () => {
160
+ await y.fetchGallery(a, o), typeof window < "u" && new IntersectionObserver((m) => {
161
+ m.some((i) => i.isIntersecting) && (a += 1, P());
162
+ }).observe(w.value);
163
+ }), (d, m) => (r(), c("div", ue, [
164
+ e("div", me, [
165
+ e("div", pe, [
166
+ t.value ? (r(), c("button", {
167
+ key: 0,
168
+ onClick: m[0] || (m[0] = (i) => z(null)),
169
+ class: "mn-r-small t-white t-black bg-second button-small button"
170
+ }, "Add photos +")) : $("", !0)
171
+ ])
172
+ ]),
173
+ e("div", {
174
+ ref_key: "grid",
175
+ ref: n,
176
+ class: "pd-medium cols-4 gap-thin"
177
+ }, [
178
+ (r(!0), c(G, null, j(A(v), (i, Re) => (r(), c("div", {
179
+ key: i.id,
180
+ "data-id": i.id
181
+ }, [
182
+ _(U, {
183
+ name: "scaleIn",
184
+ mode: "in-out"
185
+ }, {
186
+ default: b(() => [
187
+ !t.value && n.value ? (r(), c("img", {
188
+ key: 0,
189
+ src: "https://thecommunephuket.com/photos/" + i.cover,
190
+ class: "w-100 h-100 o-hidden radius-medium object-fit-cover",
191
+ onClick: (I) => z(i.image)
192
+ }, null, 8, _e)) : (r(), c("div", ve, [
193
+ R(S(i._id) + " ", 1),
194
+ e("img", {
195
+ src: "https://thecommunephuket.com/photos/" + i.cover,
196
+ class: "w-100 radius-small mn-small h-10r object-fit-cover",
197
+ onClick: (I) => z(i)
198
+ }, null, 8, he),
199
+ e("p", fe, [
200
+ ye,
201
+ be,
202
+ e("span", we, S(i.size.name), 1)
203
+ ]),
204
+ e("p", ke, [
205
+ xe,
206
+ Ce,
207
+ (r(!0), c(G, null, j(i.categories, (I) => (r(), c("span", Ie, S(I), 1))), 256))
208
+ ]),
209
+ e("div", $e, [
210
+ e("button", {
211
+ class: "button-small w-100 button",
212
+ onClick: (I) => O(i._id)
213
+ }, "Delete", 8, Se)
214
+ ])
215
+ ]))
216
+ ]),
217
+ _: 2
218
+ }, 1024)
219
+ ], 8, ge))), 128)),
220
+ e("div", {
221
+ ref_key: "sentinel",
222
+ ref: w,
223
+ class: "sentinel"
224
+ }, null, 512),
225
+ _(U, { name: "modal" }, {
226
+ default: b(() => [
227
+ Q(e("div", Ee, [
228
+ e("div", Pe, [
229
+ e("div", ze, [
230
+ e("span", {
231
+ class: "close",
232
+ onClick: f
233
+ }, "×"),
234
+ e("img", {
235
+ src: "https://thecommunephuket.com/photos/" + s.value.image
236
+ }, null, 8, Ue)
237
+ ])
238
+ ])
239
+ ], 512), [
240
+ [W, s.value.image !== !1 && h.value === "modal"]
241
+ ])
242
+ ]),
243
+ _: 1
244
+ }),
245
+ _(U, { name: "modal" }, {
246
+ default: b(() => [
247
+ s.value.image !== !1 && h.value === "edit-modal" ? (r(), c("div", Ve, [
248
+ e("div", Ge, [
249
+ e("span", {
250
+ class: "close",
251
+ onClick: f
252
+ }, "×"),
253
+ typeof C.value == "string" ? (r(), c("img", {
254
+ key: 0,
255
+ src: C.value,
256
+ class: "radius-small w-100 mn-small h-20r object-fit-cover"
257
+ }, null, 8, je)) : $("", !0),
258
+ typeof C.value == "object" && s.value.image !== null ? (r(), c("img", {
259
+ key: 1,
260
+ class: "radius-small w-100 mn-small h-20r object-fit-cover",
261
+ src: "/photos/" + s.value.cover
262
+ }, null, 8, Be)) : $("", !0),
263
+ _(se, {
264
+ options: F,
265
+ label: "Size",
266
+ select: s.value.size,
267
+ "onUpdate:select": m[1] || (m[1] = (i) => s.value.size = i),
268
+ placeholder: "Select Size",
269
+ class: "bg-grey pd-thin radius-small mn-thin t-black"
270
+ }, null, 8, ["select"]),
271
+ _(ee, {
272
+ field: s.value.categories,
273
+ "onUpdate:field": m[2] || (m[2] = (i) => s.value.categories = i),
274
+ type: "text",
275
+ label: "Categories",
276
+ placeholder: "Enter categories for image (comma separated)",
277
+ class: "bg-grey pd-thin radius-small mn-medium t-black"
278
+ }, null, 8, ["field"]),
279
+ _(de, {
280
+ images: u.value,
281
+ "onUpdate:images": x,
282
+ uploadPath: "photos",
283
+ class: "mn-semi"
284
+ }, null, 8, ["images"]),
285
+ _(te, {
286
+ submit: s.value._id ? T : q,
287
+ callback: f,
288
+ class: "mn-thin"
289
+ }, {
290
+ default: b(() => [
291
+ R(S(s.value._id ? "Update" : "Create"), 1)
292
+ ]),
293
+ _: 1
294
+ }, 8, ["submit"])
295
+ ])
296
+ ])) : $("", !0)
297
+ ]),
298
+ _: 1
299
+ })
300
+ ], 512)
301
+ ]));
302
+ }
303
+ }, Xe = /* @__PURE__ */ oe(Me, [["__scopeId", "data-v-26ef6b15"]]);
304
+ export {
305
+ Xe as default
306
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),B=require("./Button-ee08e6bf.js"),q=require("./Select-b9299fb6.js"),C=require("./index-7ecbf72a.js"),D=require("./vue-draggable-next.esm-bundler-80731ae0.js"),M=require("./UploadImageMultiple-297b3897.js"),j=require("./_plugin-vue_export-helper-f246444f.js");require("./Select.vue_vue_type_style_index_0_scoped_a78dbba1_lang-0ea8fbf8.js");const G=process.env.API_URL,V=C.axios.create({baseURL:G,withCredentials:!0}),u=e.reactive({gallery:[]}),v={async fetchGallery(a,t){const c=[];a&&c.push(`page=${a}`),t&&c.push(`limit=${t}`);const o=`/api/gallery${c.length?`?${c.join("&")}`:""}`;try{const s=await V.get(o);if(console.log(s),s&&s.data)return u.gallery=[...u.gallery,...s.data],s.data}catch(s){throw console.error("Error fetching gallery:",s),s}},async createPhoto(a){try{const t=await V.post("/api/gallery/create",a);console.log(t.data),u.gallery=[...t.data,...u.gallery]}catch(t){console.error(t)}},async updatePhoto(a){try{const t={...a,categories:typeof a.categories=="string"?a.categories.split(",").map(s=>s.trim()):a.categories},c=await C.axios.post("/api/gallery/update",t),o=u.gallery.findIndex(s=>s._id===a._id);o!==-1&&(u.gallery[o]=c.data)}catch(t){console.error(t)}},async deletePhoto(a){try{const t=await V.post(`/api/gallery/delete/${a}`),c=u.gallery.findIndex(o=>o._id===a);c!==-1&&u.gallery.splice(c,1)}catch(t){console.error(t)}}};const L={class:"pos-relative"},R=["src"],T=["onClick"],A={__name:"EditImages",props:{images:Array},emits:["update"],setup(a,{emit:t}){const c=a,o=e.ref([...c.images]);e.watchEffect(()=>{o.value=[...c.images]});const s=()=>{t("update:images",o.value)},_=i=>{o.value=[...o.value,...i],s()},h=i=>{o.value.splice(i,1),s()};return(i,f)=>(e.openBlock(),e.createElementBlock("div",null,[e.createVNode(M._sfc_main,{"onUpdate:images":_,uploadPath:"photos",class:"mn-semi pd-small w-100 button bg-black t-white"}),e.createVNode(e.unref(D.VueDraggableNext),{class:"gap-small flex dragArea list-group w-full",modelValue:o.value,"onUpdate:modelValue":f[0]||(f[0]=m=>o.value=m),onChange:s},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value,(m,E)=>(e.openBlock(),e.createElementBlock("div",L,[e.createElementVNode("img",{class:"i-extra radius-small o-hidden mn-thin",src:(i.FILE_SERVER_URL||"")+m},null,8,R),e.createElementVNode("a",{onClick:p=>h(E),class:"pos-absolute t-center radius-extra i-medium bg-red pos-t-0 pos-r-0"},"X",8,T)]))),256))]),_:1},8,["modelValue"])]))}};const b=a=>(e.pushScopeId("data-v-26ef6b15"),a=a(),e.popScopeId(),a),F={class:"pos-relative w-100"},O={class:"w-100 o-hidden"},H={class:"pd-medium flex-nowrap flex pd-t-thin pd-b-thin o-scroll"},X=["data-id"],J=["src","onClick"],K={key:1,class:"pd-small radius-small bg-white"},Q=["src","onClick"],W={class:"t-black p-small mn-small"},Y=b(()=>e.createElementVNode("span",{class:"uppercase t-transp"},"Size",-1)),Z=b(()=>e.createElementVNode("br",null,null,-1)),ee={class:"pd-2px radius-big d-inline-block bg-grey"},te={class:"t-black p-small mn-small uppe"},le=b(()=>e.createElementVNode("span",{class:"uppercase t-transp"},"Categories",-1)),ae=b(()=>e.createElementVNode("br",null,null,-1)),oe={class:"pd-2px radius-big d-inline-block bg-grey t-semi"},se={class:"flex-nowrap flex"},ne=["onClick"],ce={class:"modal pd-thin"},re={class:"modal-content radius-big"},ie={class:""},de=["src"],ue={key:0,class:"flex-v-center flex m modal pd-big"},me={class:"modal-content radius-small pd-medium bg-white"},pe=["src"],ge=["src"],ve={__name:"BackofficeGallery",setup(a){const t=e.ref(!0),c=e.ref(null);let o=1;const s=10;let _=e.ref(null),h=e.ref(!1);const i=e.ref([]),f=r=>{i.value=r},m=e.computed(()=>x.value==="all"?u.gallery:u.gallery.filter(r=>r.categories.includes(x.value))),E=async()=>{h.value=!0,await v.fetchGallery(o,s),h.value=!1},p=e.ref(null),l=e.ref({categories:"",size:"",image:!1}),y=e.ref(null),w=r=>{console.log(t.value),t.value?I(r):(p.value="modal",l.value.image=r,N())},I=r=>{p.value="edit-modal",l.value=r||{categories:"",size:"",image:null},N()},g=()=>{l.value={categories:"",size:"",image:!1},y.value=null,S()},N=()=>{document.body.style.overflow="hidden",document.documentElement.style.overflow="hidden"},S=()=>{document.body.style.overflow="",document.documentElement.style.overflow=""},$=[{name:"Small",value:""},{name:"Regular",value:"grid-item--width1 grid-item--height1"},{name:"Medium",value:"grid-item--width2 grid-item--height2"},{name:"Big",value:"grid-item--width3 grid-item--height3"}],P=async r=>{await v.deletePhoto(r)},z=async()=>{await v.updatePhoto(l.value),g()},U=async r=>{if(i.length<1||!l.value.categories||!l.value.size){console.error("All fields are required.");return}await v.createPhoto({images:i.value,size:l.value.size,categories:typeof l.value.categories=="string"?l.value.categories.split(",").map(d=>d.trim()):l.value.categories}),g()};let x=e.ref("all");return e.onMounted(async()=>{await v.fetchGallery(o,s),typeof window<"u"&&new IntersectionObserver(d=>{d.some(n=>n.isIntersecting)&&(o+=1,E())}).observe(_.value)}),(r,d)=>(e.openBlock(),e.createElementBlock("div",F,[e.createElementVNode("div",O,[e.createElementVNode("div",H,[t.value?(e.openBlock(),e.createElementBlock("button",{key:0,onClick:d[0]||(d[0]=n=>w(null)),class:"mn-r-small t-white t-black bg-second button-small button"},"Add photos +")):e.createCommentVNode("",!0)])]),e.createElementVNode("div",{ref_key:"grid",ref:c,class:"pd-medium cols-4 gap-thin"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(m),(n,he)=>(e.openBlock(),e.createElementBlock("div",{key:n.id,"data-id":n.id},[e.createVNode(e.Transition,{name:"scaleIn",mode:"in-out"},{default:e.withCtx(()=>[!t.value&&c.value?(e.openBlock(),e.createElementBlock("img",{key:0,src:"https://thecommunephuket.com/photos/"+n.cover,class:"w-100 h-100 o-hidden radius-medium object-fit-cover",onClick:k=>w(n.image)},null,8,J)):(e.openBlock(),e.createElementBlock("div",K,[e.createTextVNode(e.toDisplayString(n._id)+" ",1),e.createElementVNode("img",{src:"https://thecommunephuket.com/photos/"+n.cover,class:"w-100 radius-small mn-small h-10r object-fit-cover",onClick:k=>w(n)},null,8,Q),e.createElementVNode("p",W,[Y,Z,e.createElementVNode("span",ee,e.toDisplayString(n.size.name),1)]),e.createElementVNode("p",te,[le,ae,(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.categories,k=>(e.openBlock(),e.createElementBlock("span",oe,e.toDisplayString(k),1))),256))]),e.createElementVNode("div",se,[e.createElementVNode("button",{class:"button-small w-100 button",onClick:k=>P(n._id)},"Delete",8,ne)])]))]),_:2},1024)],8,X))),128)),e.createElementVNode("div",{ref_key:"sentinel",ref:_,class:"sentinel"},null,512),e.createVNode(e.Transition,{name:"modal"},{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",ce,[e.createElementVNode("div",re,[e.createElementVNode("div",ie,[e.createElementVNode("span",{class:"close",onClick:g},"×"),e.createElementVNode("img",{src:"https://thecommunephuket.com/photos/"+l.value.image},null,8,de)])])],512),[[e.vShow,l.value.image!==!1&&p.value==="modal"]])]),_:1}),e.createVNode(e.Transition,{name:"modal"},{default:e.withCtx(()=>[l.value.image!==!1&&p.value==="edit-modal"?(e.openBlock(),e.createElementBlock("div",ue,[e.createElementVNode("div",me,[e.createElementVNode("span",{class:"close",onClick:g},"×"),typeof y.value=="string"?(e.openBlock(),e.createElementBlock("img",{key:0,src:y.value,class:"radius-small w-100 mn-small h-20r object-fit-cover"},null,8,pe)):e.createCommentVNode("",!0),typeof y.value=="object"&&l.value.image!==null?(e.openBlock(),e.createElementBlock("img",{key:1,class:"radius-small w-100 mn-small h-20r object-fit-cover",src:"/photos/"+l.value.cover},null,8,ge)):e.createCommentVNode("",!0),e.createVNode(q.Select,{options:$,label:"Size",select:l.value.size,"onUpdate:select":d[1]||(d[1]=n=>l.value.size=n),placeholder:"Select Size",class:"bg-grey pd-thin radius-small mn-thin t-black"},null,8,["select"]),e.createVNode(B.Field,{field:l.value.categories,"onUpdate:field":d[2]||(d[2]=n=>l.value.categories=n),type:"text",label:"Categories",placeholder:"Enter categories for image (comma separated)",class:"bg-grey pd-thin radius-small mn-medium t-black"},null,8,["field"]),e.createVNode(A,{images:i.value,"onUpdate:images":f,uploadPath:"photos",class:"mn-semi"},null,8,["images"]),e.createVNode(B._sfc_main,{submit:l.value._id?z:U,callback:g,class:"mn-thin"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.value._id?"Update":"Create"),1)]),_:1},8,["submit"])])])):e.createCommentVNode("",!0)]),_:1})],512)]))}},_e=j._export_sfc(ve,[["__scopeId","data-v-26ef6b15"]]);exports.default=_e;