@ozdao/prometheus-framework 0.1.20 → 0.1.22

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