@ozdao/prometheus-framework 0.1.16 → 0.1.18

Sign up to get free protection for your applications and to get access to all the features.
Files changed (146) hide show
  1. package/dist/Breadcrumbs.vue_vue_type_style_index_0_lang-2426cb6f.mjs +1945 -0
  2. package/dist/Breadcrumbs.vue_vue_type_style_index_0_lang-579e2c7a.mjs +1945 -0
  3. package/dist/Breadcrumbs.vue_vue_type_style_index_0_lang-c6aba800.js +1 -0
  4. package/dist/Breadcrumbs.vue_vue_type_style_index_0_lang-cab2bcd2.js +1 -0
  5. package/dist/ButtonFollow-23c4d9fc.mjs +132 -0
  6. package/dist/ButtonFollow-351486b0.js +1 -0
  7. package/dist/ButtonFollow-3a05d29f.mjs +132 -0
  8. package/dist/ButtonFollow-bf5e6d42.js +1 -0
  9. package/dist/CardOrganization-4d22037e.js +1 -0
  10. package/dist/CardOrganization-63dcc83b.js +1 -0
  11. package/dist/CardOrganization-8c5b582b.mjs +230 -0
  12. package/dist/CardOrganization-e530c9d5.mjs +230 -0
  13. package/dist/Chips-3dac276c.js +1 -0
  14. package/dist/Feed-416d84b0.mjs +439 -0
  15. package/dist/Feed-44beaa4c.mjs +368 -0
  16. package/dist/Feed-4d9001aa.mjs +368 -0
  17. package/dist/Feed-51eef23f.js +1 -0
  18. package/dist/Feed-8a151970.js +1 -0
  19. package/dist/Feed-c9e6190e.js +1 -0
  20. package/dist/Feed-d78d4b91.mjs +439 -0
  21. package/dist/Feed-f4e9769e.js +1 -0
  22. package/dist/Gallery-1f82841a.mjs +357 -0
  23. package/dist/Gallery-9305f294.mjs +357 -0
  24. package/dist/Gallery-dd29c7f6.js +1 -0
  25. package/dist/Gallery-dea27e94.js +1 -0
  26. package/dist/Image-22e17cef.js +9 -0
  27. package/dist/Image-a2c2ab9c.js +9 -0
  28. package/dist/Image-ad6d4f0f.mjs +477 -0
  29. package/dist/Image-c0ae2c5f.mjs +477 -0
  30. package/dist/Popup-383abb2e.js +1 -0
  31. package/dist/Popup-ad5f59d0.js +1 -0
  32. package/dist/Popup-e7c9a43e.mjs +76 -0
  33. package/dist/Popup-f7a5e86b.mjs +76 -0
  34. package/dist/Product-2d05acc8.mjs +839 -0
  35. package/dist/Product-b32fb0e1.js +7 -0
  36. package/dist/Product-d01e3a0d.mjs +839 -0
  37. package/dist/Product-d9c3b9b9.js +7 -0
  38. package/dist/ProductEdit-2b4d1d88.js +1 -0
  39. package/dist/ProductEdit-5e479343.mjs +300 -0
  40. package/dist/ProductEdit-ab0530e8.js +1 -0
  41. package/dist/ProductEdit-aca44ef7.mjs +300 -0
  42. package/dist/ProfileBlogposts-070cb7e9.mjs +65 -0
  43. package/dist/ProfileBlogposts-2063c511.mjs +65 -0
  44. package/dist/ProfileBlogposts-b6bf0c42.js +1 -0
  45. package/dist/ProfileBlogposts-eaecd267.js +1 -0
  46. package/dist/ProfileComments-1ae70859.js +1 -0
  47. package/dist/ProfileComments-78231e6a.mjs +44 -0
  48. package/dist/ProfileComments-8a0c489c.mjs +44 -0
  49. package/dist/ProfileComments-f0000ea6.js +1 -0
  50. package/dist/ProfileEvents-4a2fa422.mjs +57 -0
  51. package/dist/ProfileEvents-8b88287a.js +1 -0
  52. package/dist/ProfileEvents-90448f97.js +1 -0
  53. package/dist/ProfileEvents-d978617d.mjs +57 -0
  54. package/dist/ProfileLikes-74c78a16.mjs +44 -0
  55. package/dist/ProfileLikes-b48ce0ef.js +1 -0
  56. package/dist/ProfileLikes-d5f9f058.js +1 -0
  57. package/dist/ProfileLikes-f5ad4497.mjs +44 -0
  58. package/dist/ProfileOrganizations-422d1fa5.js +1 -0
  59. package/dist/ProfileOrganizations-43710687.js +1 -0
  60. package/dist/ProfileOrganizations-6b1bc5b2.mjs +213 -0
  61. package/dist/ProfileOrganizations-cf8a12f5.mjs +213 -0
  62. package/dist/Publics-5472f70c.mjs +123 -0
  63. package/dist/Publics-640d32fc.mjs +123 -0
  64. package/dist/Publics-71b9efbe.js +1 -0
  65. package/dist/Publics-8595ab7e.js +1 -0
  66. package/dist/Socials-43293869.js +1 -0
  67. package/dist/Tab-dcd62005.js +1 -0
  68. package/dist/UploadImage-0f488170.js +1 -0
  69. package/dist/UploadImage-3c627d89.mjs +83 -0
  70. package/dist/UploadImage-dfb36cdb.js +1 -0
  71. package/dist/UploadImage-e4418b43.mjs +83 -0
  72. package/dist/UploadImageMultiple-c9a7b54f.js +1 -0
  73. package/dist/UploadImageMultiple-cb6c7188.mjs +58 -0
  74. package/dist/UploadImageMultiple-d2d48f39.mjs +58 -0
  75. package/dist/UploadImageMultiple-eddaac87.js +1 -0
  76. package/dist/auth-4415a97a.js +7 -0
  77. package/dist/auth-45a454f2.js +7 -0
  78. package/dist/auth-5cd34aae.mjs +905 -0
  79. package/dist/auth-afa25b86.mjs +905 -0
  80. package/dist/auth.client.cjs +8 -8
  81. package/dist/auth.client.js +16 -15
  82. package/dist/auth.validation-3e93dc23.mjs +20 -0
  83. package/dist/auth.validation-4b016fa5.js +1 -0
  84. package/dist/auth.validation-a17cd085.js +1 -0
  85. package/dist/auth.validation-a52304cf.mjs +20 -0
  86. package/dist/backoffice.client.cjs +1 -0
  87. package/dist/backoffice.client.js +69 -0
  88. package/dist/carousel.es-cdfb392c.js +5 -0
  89. package/dist/community.client.cjs +1 -1
  90. package/dist/community.client.js +23 -22
  91. package/dist/components/EditImages/EditImages.vue.d.ts +7 -0
  92. package/dist/components/FieldPhone/FieldPhone(script-setup).vue.d.ts +3 -3
  93. package/dist/components/FieldPhone/FieldPhone.vue.d.ts +1 -1
  94. package/dist/events.client.cjs +2 -2
  95. package/dist/events.client.js +17 -16
  96. package/dist/files.server.js +149 -112
  97. package/dist/files.server.mjs +149 -112
  98. package/dist/gallery.server.js +148 -0
  99. package/dist/gallery.server.mjs +149 -0
  100. package/dist/index-2059e444.js +2 -0
  101. package/dist/index-4e469a71.mjs +941 -0
  102. package/dist/index-a661083c.mjs +934 -0
  103. package/dist/index-b41aac19.js +2 -0
  104. package/dist/landing.client.cjs +1 -1
  105. package/dist/modules/gallery/components/sections/Gallery.vue.d.ts +2 -0
  106. package/dist/modules/icons/navigation/IconChevronRight.vue.d.ts +13 -1
  107. package/dist/modules/mobile/components/Menu/MenuItem.vue.d.ts +14 -2
  108. package/dist/organizations-65937ba4.js +1 -0
  109. package/dist/organizations-81e762e7.mjs +122 -0
  110. package/dist/organizations-af965fcf.mjs +122 -0
  111. package/dist/organizations-cf1ab766.js +1 -0
  112. package/dist/organizations.client-1e9361ec.js +3 -0
  113. package/dist/organizations.client-43816e25.mjs +3018 -0
  114. package/dist/organizations.client-b692a78a.mjs +3018 -0
  115. package/dist/organizations.client-bdc9b044.js +3 -0
  116. package/dist/organizations.client.cjs +1 -1
  117. package/dist/organizations.client.js +44 -43
  118. package/dist/style.css +1 -1
  119. package/dist/users.client.cjs +1 -1
  120. package/dist/users.client.js +224 -184
  121. package/dist/vue-draggable-next.esm-bundler-21a209c6.js +10 -0
  122. package/dist/vuex.esm-bundler-685cf29f.js +5 -0
  123. package/package.json +10 -1
  124. package/src/components/EditImages/EditImages.vue +55 -0
  125. package/src/configurator/components/layouts/layoutConfigurator.vue +0 -40
  126. package/src/modules/backoffice/backoffice.client.js +15 -0
  127. package/src/modules/backoffice/components/layouts/Account.vue +48 -58
  128. package/src/modules/backoffice/router/backoffice.js +20 -0
  129. package/src/modules/files/controllers/files.controller.js +27 -131
  130. package/src/modules/files/middlewares/server/index.js +10 -0
  131. package/src/modules/files/middlewares/server/md.js +151 -0
  132. package/src/modules/files/middlewares/server/middlewareMulter.js +121 -0
  133. package/src/modules/files/routes/files.routes.js +20 -6
  134. package/src/modules/gallery/components/sections/Gallery.vue +414 -0
  135. package/src/modules/gallery/controllers/gallery.controller.js +87 -73
  136. package/src/modules/gallery/gallery.client.js +17 -0
  137. package/src/modules/gallery/gallery.server.js +13 -0
  138. package/src/modules/gallery/models/photo.model.js +20 -14
  139. package/src/modules/gallery/routes/gallery.routes.js +18 -9
  140. package/src/modules/gallery/store/gallery.js +25 -19
  141. package/src/modules/icons/navigation/IconChevronRight.vue +14 -2
  142. package/src/modules/mobile/components/Menu/Menu.vue +1 -1
  143. package/src/modules/mobile/components/Menu/MenuItem.vue +8 -2
  144. package/src/modules/users/components/pages/Profile.vue +22 -1
  145. package/src/modules/backoffice/components/pages/Profile.vue +0 -109
  146. package/src/modules/backoffice/components/pages/profile/ProfileEdit.vue +0 -132
@@ -0,0 +1,357 @@
1
+ import ee, { reactive as te, ref as f, watchEffect as le, openBlock as u, createElementBlock as m, createVNode as y, unref as $, withCtx as P, Fragment as Q, renderList as W, createElementVNode as s, computed as ae, onMounted as oe, createCommentVNode as j, Transition as J, createTextVNode as Y, toDisplayString as D, withDirectives as ne, vShow as se, pushScopeId as ie, popScopeId as re } from "vue";
2
+ import { a as Z } from "./index-4e469a71.mjs";
3
+ import { V as ce } from "./vue-draggable-next.esm-bundler-ff6e3f52.mjs";
4
+ import { _ as de } from "./UploadImageMultiple-d2d48f39.mjs";
5
+ import { useRoute as ue } from "vue-router";
6
+ import { _ as me } from "./_plugin-vue_export-helper-dad06003.mjs";
7
+ var F = {};
8
+ (function(o) {
9
+ Object.defineProperties(o, { __esModule: { value: !0 }, [Symbol.toStringTag]: { value: "Module" } });
10
+ var e = ee;
11
+ const c = { class: "flex-nowrap flex-v-center flex pd-medium bg-white" }, i = { key: 0, class: "t-left mn-r-small w-33" }, r = { class: "w-100" }, V = ["value", "placeholder"], w = e.defineComponent({ __name: "Field", props: { label: { default: "Label" }, placeholder: { default: "Enter something here" }, field: { default: null }, validation: { type: Boolean, default: !1 } }, emits: ["update:modelValue"], setup(t, { emit: a }) {
12
+ const l = t, d = e.ref(l.field);
13
+ return (p, b) => (e.openBlock(), e.createElementBlock("div", c, [t.label ? (e.openBlock(), e.createElementBlock("div", i, [e.createElementVNode("label", null, e.toDisplayString(t.label), 1)])) : e.createCommentVNode("", !0), e.createElementVNode("div", r, [e.createElementVNode("input", { onInput: b[0] || (b[0] = (z) => {
14
+ var g;
15
+ return d.value = a("update:modelValue", (g = z.target) == null ? void 0 : g.value);
16
+ }), type: "text", class: "w-100", value: t.field, placeholder: t.placeholder }, null, 40, V)])]));
17
+ } }), v = { class: "input-wrapper" }, C = { class: "t-transp p-small" }, x = { key: 0, class: "flex-nojustify flex-v-center flex-nowrap flex w-100" }, S = { key: 1, class: "w-100" }, N = ["onClick"], n = { __name: "Select", props: ["obj", "label", "prop", "value", "options", "content", "textarea", "placeholder", "size"], setup(t) {
18
+ const a = t, l = e.ref(null), d = e.ref(!1);
19
+ e.ref("Please select an item");
20
+ let p = e.computed(() => {
21
+ if (a.prop[a.content]) {
22
+ var g = a.options.indexOf(a.prop[a.content]), k = a.options.map((h) => h);
23
+ return g != -1 && k.splice(g, 1), k;
24
+ } else
25
+ return a.options;
26
+ });
27
+ a.prop[a.content] && (l.value = a.prop[a.content]);
28
+ function b() {
29
+ d.value = !d.value;
30
+ }
31
+ function z(g, k, h) {
32
+ var H = h;
33
+ l.value = H, d.value = !d.value, g[k] = H;
34
+ }
35
+ return (g, k) => (e.openBlock(), e.createElementBlock("div", v, [e.createElementVNode("span", C, e.toDisplayString(t.label), 1), e.createElementVNode("li", { onClick: k[0] || (k[0] = e.withModifiers((h) => b(), ["stop"])), class: e.normalizeClass([{ "input-small": t.size === "small" }, "pd-small flex-center flex-nowrap flex bg-grey input-select input"]) }, [l.value ? (e.openBlock(), e.createElementBlock("span", x, [e.createElementVNode("span", null, e.toDisplayString(l.value.name ? l.value.name : l.value), 1)])) : (e.openBlock(), e.createElementBlock("span", S, e.toDisplayString(t.placeholder ? t.placeholder : "Please select"), 1))], 2), d.value ? (e.openBlock(), e.createElementBlock("ul", { key: 0, class: e.normalizeClass([{ "dropdown-small": t.size === "small" }, "bg-grey dropdown-menu"]) }, [(e.openBlock(!0), e.createElementBlock(e.Fragment, null, e.renderList(e.unref(p), (h) => (e.openBlock(), e.createElementBlock("li", { class: e.normalizeClass([{ "input-small": t.size === "small" }, "pd-small bg-grey input-select input"]) }, [h ? (e.openBlock(), e.createElementBlock("span", { key: 0, onClick: (H) => z(t.prop, t.content, h), class: "flex-nojustify flex-v-center flex-nowrap flex w-100" }, [e.createElementVNode("span", null, e.toDisplayString(h.name ? h.name : h), 1)], 8, N)) : e.createCommentVNode("", !0)], 2))), 256))], 2)) : e.createCommentVNode("", !0)]));
36
+ } }, B = ["disabled"], I = { key: 0 }, R = { key: 0, class: "loading" }, E = e.createElementVNode("span", null, [e.createElementVNode("svg", { class: "i-default", width: "135", height: "140", viewBox: "0 0 135 140", xmlns: "http://www.w3.org/2000/svg", fill: "#fff" }, [e.createElementVNode("rect", { y: "10", width: "15", height: "120", rx: "6" }, [e.createElementVNode("animate", { attributeName: "height", begin: "0.5s", dur: "1s", values: "120;110;100;90;80;70;60;50;40;140;120", calcMode: "linear", repeatCount: "indefinite" }), e.createTextVNode(), e.createElementVNode("animate", { attributeName: "y", begin: "0.5s", dur: "1s", values: "10;15;20;25;30;35;40;45;50;0;10", calcMode: "linear", repeatCount: "indefinite" })]), e.createElementVNode("rect", { x: "30", y: "10", width: "15", height: "120", rx: "6" }, [e.createElementVNode("animate", { attributeName: "height", begin: "0.25s", dur: "1s", values: "120;110;100;90;80;70;60;50;40;140;120", calcMode: "linear", repeatCount: "indefinite" }), e.createTextVNode(), e.createElementVNode("animate", { attributeName: "y", begin: "0.25s", dur: "1s", values: "10;15;20;25;30;35;40;45;50;0;10", calcMode: "linear", repeatCount: "indefinite" })]), e.createElementVNode("rect", { x: "60", width: "15", height: "140", rx: "6" }, [e.createElementVNode("animate", { attributeName: "height", begin: "0s", dur: "1s", values: "120;110;100;90;80;70;60;50;40;140;120", calcMode: "linear", repeatCount: "indefinite" }), e.createTextVNode(), e.createElementVNode("animate", { attributeName: "y", begin: "0s", dur: "1s", values: "10;15;20;25;30;35;40;45;50;0;10", calcMode: "linear", repeatCount: "indefinite" })]), e.createElementVNode("rect", { x: "90", y: "10", width: "15", height: "120", rx: "6" }, [e.createElementVNode("animate", { attributeName: "height", begin: "0.25s", dur: "1s", values: "120;110;100;90;80;70;60;50;40;140;120", calcMode: "linear", repeatCount: "indefinite" }), e.createTextVNode(), e.createElementVNode("animate", { attributeName: "y", begin: "0.25s", dur: "1s", values: "10;15;20;25;30;35;40;45;50;0;10", calcMode: "linear", repeatCount: "indefinite" })]), e.createElementVNode("rect", { x: "120", y: "10", width: "15", height: "120", rx: "6" }, [e.createElementVNode("animate", { attributeName: "height", begin: "0.5s", dur: "1s", values: "120;110;100;90;80;70;60;50;40;140;120", calcMode: "linear", repeatCount: "indefinite" }), e.createTextVNode(), e.createElementVNode("animate", { attributeName: "y", begin: "0.5s", dur: "1s", values: "10;15;20;25;30;35;40;45;50;0;10", calcMode: "linear", repeatCount: "indefinite" })])])], -1), T = [E], A = { key: 0, class: "h4 loading" }, O = e.createElementVNode("span", { class: "t-white" }, "✔", -1), q = [O], X = { key: 0, class: "error" }, L = e.defineComponent({ __name: "Button", props: { submit: { type: Function, default: async () => {
37
+ console.log("Button click.");
38
+ } }, callback: { type: Function, default: async () => {
39
+ console.log("Button callback.");
40
+ } }, validation: { type: Boolean, default: !1 } }, setup(t) {
41
+ const a = t, l = e.ref(null), d = e.ref(null), p = e.ref(!1), b = e.ref(!1);
42
+ async function z() {
43
+ l.value.style["pointer-events"] = "none", d.value = null, p.value = !0;
44
+ try {
45
+ await a.submit(), l.value.classList.add("bg-light-blue"), l.value.classList.remove("bg-blue"), p.value = !1, b.value = !0, setTimeout(() => a.callback(), 750);
46
+ } catch {
47
+ l.value.classList.add("bg-light-red"), l.value.classList.remove("bg-blue"), d.value = "❌", setTimeout(() => {
48
+ l.value.classList.add("bg-blue"), l.value.classList.remove("bg-light-red"), l.value.style.pointerEvents = "auto", p.value = !1, b.value = !1, d.value = null;
49
+ }, 1e3);
50
+ }
51
+ }
52
+ return (g, k) => (e.openBlock(), e.createElementBlock("button", { onClick: z, disabled: t.validation, ref_key: "button", ref: l, class: "w-100 t-white bg-blue button" }, [e.createVNode(e.Transition, { mode: "out-in", name: "fadeIn" }, { default: e.withCtx(() => [!p.value && !d.value && !b.value ? (e.openBlock(), e.createElementBlock("span", I, [e.renderSlot(g.$slots, "default")])) : e.createCommentVNode("", !0)]), _: 3 }), e.createVNode(e.Transition, { mode: "out-in", name: "fadeIn" }, { default: e.withCtx(() => [p.value && !d.value ? (e.openBlock(), e.createElementBlock("div", R, T)) : e.createCommentVNode("", !0)]), _: 1 }), e.createVNode(e.Transition, { mode: "out-in", name: "fadeIn" }, { default: e.withCtx(() => [b.value ? (e.openBlock(), e.createElementBlock("div", A, q)) : e.createCommentVNode("", !0)]), _: 1 }), e.createVNode(e.Transition, { mode: "out-in", name: "fadeIn" }, { default: e.withCtx(() => [d.value ? (e.openBlock(), e.createElementBlock("div", X, [e.createElementVNode("span", null, e.toDisplayString(d.value), 1)])) : e.createCommentVNode("", !0)]), _: 1 })], 8, B));
53
+ } });
54
+ var U = { install: (t) => {
55
+ t.component("Field", w), t.component("Button", L), t.component("Select", n);
56
+ } };
57
+ o.Button = L, o.Field = w, o.Select = n, o.default = U;
58
+ })(F);
59
+ const pe = process.env.API_URL, K = Z.create({ baseURL: pe, withCredentials: !0 }), _ = te({
60
+ gallery: []
61
+ }), M = {
62
+ async fetchGallery(o, e) {
63
+ const c = [];
64
+ o && c.push(`page=${o}`), e && c.push(`limit=${e}`);
65
+ const i = `/api/gallery${c.length ? `?${c.join("&")}` : ""}`;
66
+ try {
67
+ const r = await K.get(i);
68
+ if (console.log(r), r && r.data)
69
+ return _.gallery = [..._.gallery, ...r.data], r.data;
70
+ } catch (r) {
71
+ throw console.error("Error fetching gallery:", r), r;
72
+ }
73
+ },
74
+ async createPhoto(o) {
75
+ try {
76
+ const e = await K.post("/api/gallery/create", o);
77
+ console.log(e.data), _.gallery = [...e.data, ..._.gallery];
78
+ } catch (e) {
79
+ console.error(e);
80
+ }
81
+ },
82
+ async updatePhoto(o) {
83
+ try {
84
+ const e = {
85
+ ...o,
86
+ categories: typeof o.categories == "string" ? o.categories.split(",").map((r) => r.trim()) : o.categories
87
+ }, c = await Z.post("/api/gallery/update", e), i = _.gallery.findIndex((r) => r._id === o._id);
88
+ i !== -1 && (_.gallery[i] = c.data);
89
+ } catch (e) {
90
+ console.error(e);
91
+ }
92
+ },
93
+ async deletePhoto(o) {
94
+ try {
95
+ const e = await K.post(`/api/gallery/delete/${o}`), c = _.gallery.findIndex((i) => i._id === o);
96
+ c !== -1 && _.gallery.splice(c, 1);
97
+ } catch (e) {
98
+ console.error(e);
99
+ }
100
+ }
101
+ };
102
+ const ve = { class: "pos-relative" }, ge = ["src"], he = ["onClick"], fe = {
103
+ __name: "EditImages",
104
+ props: {
105
+ images: Array
106
+ },
107
+ emits: ["update"],
108
+ setup(o, { emit: e }) {
109
+ const c = o, i = f([...c.images]);
110
+ le(() => {
111
+ i.value = [...c.images];
112
+ });
113
+ const r = () => {
114
+ e("update:images", i.value);
115
+ }, V = (v) => {
116
+ i.value = [...i.value, ...v], r();
117
+ }, w = (v) => {
118
+ i.value.splice(v, 1), r();
119
+ };
120
+ return (v, C) => (u(), m("div", null, [
121
+ y(de, {
122
+ "onUpdate:images": V,
123
+ uploadPath: "photos",
124
+ class: "mn-semi pd-small w-100 button bg-black t-white"
125
+ }),
126
+ y($(ce), {
127
+ class: "gap-small flex dragArea list-group w-full",
128
+ modelValue: i.value,
129
+ "onUpdate:modelValue": C[0] || (C[0] = (x) => i.value = x),
130
+ onChange: r
131
+ }, {
132
+ default: P(() => [
133
+ (u(!0), m(Q, null, W(i.value, (x, S) => (u(), m("div", ve, [
134
+ s("img", {
135
+ class: "i-extra radius-small o-hidden mn-thin",
136
+ src: (v.FILE_SERVER_URL || "") + x
137
+ }, null, 8, ge),
138
+ s("a", {
139
+ onClick: (N) => w(S),
140
+ class: "pos-absolute t-center radius-extra i-medium bg-red pos-t-0 pos-r-0"
141
+ }, "X", 8, he)
142
+ ]))), 256))
143
+ ]),
144
+ _: 1
145
+ }, 8, ["modelValue"])
146
+ ]));
147
+ }
148
+ };
149
+ const G = (o) => (ie("data-v-a2b32b3f"), o = o(), re(), o), _e = { class: "pos-relative w-100" }, be = { class: "w-100 o-hidden" }, ye = { class: "pd-medium flex-nowrap flex pd-t-thin pd-b-thin o-scroll" }, ke = ["data-id"], we = ["src", "onClick"], xe = {
150
+ key: 1,
151
+ class: "pd-small radius-small bg-white"
152
+ }, Ne = ["src", "onClick"], Ee = { class: "t-black p-small mn-small" }, Ve = /* @__PURE__ */ G(() => /* @__PURE__ */ s("span", { class: "uppercase t-transp" }, "Size", -1)), Ce = /* @__PURE__ */ G(() => /* @__PURE__ */ s("br", null, null, -1)), Be = { class: "pd-2px radius-big d-inline-block bg-grey" }, Se = { class: "t-black p-small mn-small uppe" }, Ie = /* @__PURE__ */ G(() => /* @__PURE__ */ s("span", { class: "uppercase t-transp" }, "Categories", -1)), ze = /* @__PURE__ */ G(() => /* @__PURE__ */ s("br", null, null, -1)), Me = { class: "pd-2px radius-big d-inline-block bg-grey t-semi" }, $e = { class: "flex-nowrap flex" }, Pe = ["onClick"], Te = { class: "modal pd-thin" }, Le = { class: "modal-content radius-big" }, Ue = { class: "" }, je = ["src"], De = {
153
+ key: 0,
154
+ class: "flex-v-center flex m modal pd-big"
155
+ }, Fe = { class: "modal-content radius-small pd-medium bg-white" }, Ge = ["src"], Re = ["src"], Ae = {
156
+ __name: "Gallery",
157
+ setup(o) {
158
+ ue();
159
+ const e = f(!0), c = f(null);
160
+ let i = 1;
161
+ const r = 10;
162
+ let V = f(null), w = f(!1);
163
+ const v = f([]), C = (t) => {
164
+ v.value = t;
165
+ }, x = ae(() => U.value === "all" ? _.gallery : _.gallery.filter((t) => t.categories.includes(U.value))), S = async () => {
166
+ w.value = !0, await M.fetchGallery(i, r), w.value = !1;
167
+ }, N = f(null), n = f({
168
+ categories: "",
169
+ size: "",
170
+ image: !1
171
+ }), B = f(null), I = (t) => {
172
+ console.log(e.value), e.value ? R(t) : (N.value = "modal", n.value.image = t, T());
173
+ }, R = (t) => {
174
+ N.value = "edit-modal", n.value = t || {
175
+ categories: "",
176
+ size: "",
177
+ image: null
178
+ }, T();
179
+ }, E = () => {
180
+ n.value = {
181
+ categories: "",
182
+ size: "",
183
+ image: !1
184
+ }, B.value = null, A();
185
+ }, T = () => {
186
+ document.body.style.overflow = "hidden", document.documentElement.style.overflow = "hidden";
187
+ }, A = () => {
188
+ document.body.style.overflow = "", document.documentElement.style.overflow = "";
189
+ }, O = [
190
+ { name: "Small", value: "" },
191
+ { name: "Regular", value: "grid-item--width1 grid-item--height1" },
192
+ { name: "Medium", value: "grid-item--width2 grid-item--height2" },
193
+ { name: "Big", value: "grid-item--width3 grid-item--height3" }
194
+ ], q = async (t) => {
195
+ await M.deletePhoto(t);
196
+ }, X = async () => {
197
+ await M.updatePhoto(n.value), E();
198
+ }, L = async (t) => {
199
+ if (v.length < 1 || !n.value.categories || !n.value.size) {
200
+ console.error("All fields are required.");
201
+ return;
202
+ }
203
+ await M.createPhoto({
204
+ images: v.value,
205
+ size: n.value.size,
206
+ categories: typeof n.value.categories == "string" ? n.value.categories.split(",").map((a) => a.trim()) : n.value.categories
207
+ }), E();
208
+ };
209
+ let U = f("all");
210
+ return oe(async () => {
211
+ await M.fetchGallery(i, r), typeof window < "u" && new IntersectionObserver((a) => {
212
+ a.some((l) => l.isIntersecting) && (i += 1, S());
213
+ }).observe(V.value);
214
+ }), (t, a) => (u(), m("div", _e, [
215
+ s("div", be, [
216
+ s("div", ye, [
217
+ e.value ? (u(), m("button", {
218
+ key: 0,
219
+ onClick: a[0] || (a[0] = (l) => I(null)),
220
+ class: "mn-r-small t-white t-black bg-second button-small button"
221
+ }, "Add photos +")) : j("", !0)
222
+ ])
223
+ ]),
224
+ s("div", {
225
+ ref_key: "grid",
226
+ ref: c,
227
+ class: "pd-medium cols-4 gap-thin"
228
+ }, [
229
+ (u(!0), m(Q, null, W($(x), (l, d) => (u(), m("div", {
230
+ key: l.id,
231
+ "data-id": l.id
232
+ }, [
233
+ y(J, {
234
+ name: "scaleIn",
235
+ mode: "in-out"
236
+ }, {
237
+ default: P(() => [
238
+ !e.value && c.value ? (u(), m("img", {
239
+ key: 0,
240
+ src: "https://thecommunephuket.com/photos/" + l.cover,
241
+ class: "w-100 h-100 o-hidden radius-medium object-fit-cover",
242
+ onClick: (p) => I(l.image)
243
+ }, null, 8, we)) : (u(), m("div", xe, [
244
+ Y(D(l._id) + " ", 1),
245
+ s("img", {
246
+ src: "https://thecommunephuket.com/photos/" + l.cover,
247
+ class: "w-100 radius-small mn-small h-10r object-fit-cover",
248
+ onClick: (p) => I(l)
249
+ }, null, 8, Ne),
250
+ s("p", Ee, [
251
+ Ve,
252
+ Ce,
253
+ s("span", Be, D(l.size.name), 1)
254
+ ]),
255
+ s("p", Se, [
256
+ Ie,
257
+ ze,
258
+ (u(!0), m(Q, null, W(l.categories, (p) => (u(), m("span", Me, D(p), 1))), 256))
259
+ ]),
260
+ s("div", $e, [
261
+ s("button", {
262
+ class: "button-small w-100 button",
263
+ onClick: (p) => q(l._id)
264
+ }, "Delete", 8, Pe)
265
+ ])
266
+ ]))
267
+ ]),
268
+ _: 2
269
+ }, 1024)
270
+ ], 8, ke))), 128)),
271
+ s("div", {
272
+ ref_key: "sentinel",
273
+ ref: V,
274
+ class: "sentinel"
275
+ }, null, 512),
276
+ y(J, { name: "modal" }, {
277
+ default: P(() => [
278
+ ne(s("div", Te, [
279
+ s("div", Le, [
280
+ s("div", Ue, [
281
+ s("span", {
282
+ class: "close",
283
+ onClick: E
284
+ }, "×"),
285
+ s("img", {
286
+ src: "https://thecommunephuket.com/photos/" + n.value.image
287
+ }, null, 8, je)
288
+ ])
289
+ ])
290
+ ], 512), [
291
+ [se, n.value.image !== !1 && N.value === "modal"]
292
+ ])
293
+ ]),
294
+ _: 1
295
+ }),
296
+ y(J, { name: "modal" }, {
297
+ default: P(() => [
298
+ n.value.image !== !1 && N.value === "edit-modal" ? (u(), m("div", De, [
299
+ s("div", Fe, [
300
+ s("span", {
301
+ class: "close",
302
+ onClick: E
303
+ }, "×"),
304
+ typeof B.value == "string" ? (u(), m("img", {
305
+ key: 0,
306
+ src: B.value,
307
+ class: "radius-small w-100 mn-small h-20r object-fit-cover"
308
+ }, null, 8, Ge)) : j("", !0),
309
+ typeof B.value == "object" && n.value.image !== null ? (u(), m("img", {
310
+ key: 1,
311
+ class: "radius-small w-100 mn-small h-20r object-fit-cover",
312
+ src: "/photos/" + n.value.cover
313
+ }, null, 8, Re)) : j("", !0),
314
+ y($(F.Select), {
315
+ options: O,
316
+ label: "Size",
317
+ select: n.value.size,
318
+ "onUpdate:select": a[1] || (a[1] = (l) => n.value.size = l),
319
+ placeholder: "Select Size",
320
+ class: "bg-grey pd-thin radius-small mn-thin t-black"
321
+ }, null, 8, ["select"]),
322
+ y($(F.Field), {
323
+ field: n.value.categories,
324
+ "onUpdate:field": a[2] || (a[2] = (l) => n.value.categories = l),
325
+ type: "text",
326
+ label: "Categories",
327
+ placeholder: "Enter categories for image (comma separated)",
328
+ class: "bg-grey pd-thin radius-small mn-medium t-black"
329
+ }, null, 8, ["field"]),
330
+ y(fe, {
331
+ images: v.value,
332
+ "onUpdate:images": C,
333
+ uploadPath: "photos",
334
+ class: "mn-semi"
335
+ }, null, 8, ["images"]),
336
+ y($(F.Button), {
337
+ submit: n.value._id ? X : L,
338
+ callback: E,
339
+ class: "mn-thin"
340
+ }, {
341
+ default: P(() => [
342
+ Y(D(n.value._id ? "Update" : "Create"), 1)
343
+ ]),
344
+ _: 1
345
+ }, 8, ["submit"])
346
+ ])
347
+ ])) : j("", !0)
348
+ ]),
349
+ _: 1
350
+ })
351
+ ], 512)
352
+ ]));
353
+ }
354
+ }, Qe = /* @__PURE__ */ me(Ae, [["__scopeId", "data-v-a2b32b3f"]]);
355
+ export {
356
+ Qe as default
357
+ };