@ozdao/prometheus-framework 0.0.86 → 0.0.87

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. package/dist/Breadcrumbs.vue_vue_type_style_index_0_lang-15e71ec4.js +1 -0
  2. package/dist/Breadcrumbs.vue_vue_type_style_index_0_lang-cdbafd07.mjs +1944 -0
  3. package/dist/CardOrganization-ee5c34ab.js +1 -0
  4. package/dist/CardOrganization-f70bd169.mjs +202 -0
  5. package/dist/Comments-63f154a6.js +9 -0
  6. package/dist/Comments-c5afa4d6.mjs +459 -0
  7. package/dist/Feed-8fd41524.js +1 -0
  8. package/dist/Feed-ecf37814.mjs +367 -0
  9. package/dist/IconEdit-736c89be.js +1 -0
  10. package/dist/IconEdit-e9fd4c6c.mjs +21 -0
  11. package/dist/Popup-105ef2c3.js +1 -0
  12. package/dist/Popup-82fb2c8a.mjs +76 -0
  13. package/dist/Product-2f3d592f.mjs +837 -0
  14. package/dist/Product-2fbf9d99.js +7 -0
  15. package/dist/ProductEdit-20709821.mjs +349 -0
  16. package/dist/ProductEdit-a81d13b9.js +1 -0
  17. package/dist/ProfileBlogposts-eca9916c.js +1 -0
  18. package/dist/ProfileBlogposts-fb014bc6.mjs +63 -0
  19. package/dist/ProfileComments-58094a50.mjs +43 -0
  20. package/dist/ProfileComments-b919f021.js +1 -0
  21. package/dist/ProfileEvents-05485e20.js +1 -0
  22. package/dist/ProfileEvents-5d206e3d.mjs +55 -0
  23. package/dist/ProfileLikes-2f3a4488.js +1 -0
  24. package/dist/ProfileLikes-b5ac7f48.mjs +43 -0
  25. package/dist/ProfileOrganizations-0b76e38f.js +1 -0
  26. package/dist/ProfileOrganizations-32ab1e30.mjs +211 -0
  27. package/dist/Publics-3f277c17.js +1 -0
  28. package/dist/Publics-9ebffff1.mjs +122 -0
  29. package/dist/Tab-58cd105f.mjs +46 -0
  30. package/dist/Tab-6f0a4909.js +1 -0
  31. package/dist/UploadImage-441e8526.js +1 -0
  32. package/dist/UploadImage-ff8f9a0c.mjs +83 -0
  33. package/dist/auth.client.cjs +2 -2
  34. package/dist/auth.client.js +60 -40
  35. package/dist/community.client.cjs +1 -9
  36. package/dist/community.client.js +367 -739
  37. package/dist/community.server.js +16 -4
  38. package/dist/community.server.mjs +16 -4
  39. package/dist/events.client.cjs +1 -1
  40. package/dist/events.client.js +431 -329
  41. package/dist/events.server.js +19 -2
  42. package/dist/events.server.mjs +19 -2
  43. package/dist/inputs.validation-24ae76b9.js +1 -0
  44. package/dist/modules/constructor/components/elements/Bullets.vue.d.ts +15 -0
  45. package/dist/modules/constructor/components/elements/Caption.vue.d.ts +15 -0
  46. package/dist/modules/constructor/components/elements/H2.vue.d.ts +16 -0
  47. package/dist/modules/constructor/components/elements/Image.vue.d.ts +8 -0
  48. package/dist/modules/constructor/components/elements/ImageUpload.vue.d.ts +9 -0
  49. package/dist/modules/constructor/components/elements/Textarea.vue.d.ts +12 -0
  50. package/dist/modules/constructor/components/sections/Constructor.vue.d.ts +7 -0
  51. package/dist/modules/events/components/sections/Feed.vue.d.ts +1 -0
  52. package/dist/organizations-1b4c84ee.mjs +121 -0
  53. package/dist/organizations-af43bda4.js +1 -0
  54. package/dist/organizations.client-253c8068.mjs +3179 -0
  55. package/dist/organizations.client-c60d7659.js +3 -0
  56. package/dist/organizations.client.cjs +1 -3
  57. package/dist/organizations.client.js +49 -3025
  58. package/dist/style.css +1 -1
  59. package/dist/users.client.cjs +1 -1
  60. package/dist/users.client.js +10 -10
  61. package/package.json +1 -1
  62. package/src/modules/auth/router/auth.js +28 -7
  63. package/src/modules/community/community.client.js +1 -12
  64. package/src/modules/community/components/pages/BlogPost.vue +1 -1
  65. package/src/modules/community/components/pages/CreateBlogPost.vue +8 -151
  66. package/src/modules/community/middlewares/server/verifyBlogpost.js +24 -11
  67. package/src/modules/{community → constructor}/components/elements/Textarea.vue +3 -11
  68. package/src/modules/constructor/components/sections/Constructor.vue +167 -0
  69. package/src/modules/events/components/blocks/CardEvent.vue +14 -6
  70. package/src/modules/events/components/pages/EditEvent.vue +228 -133
  71. package/src/modules/events/components/sections/Feed.vue +7 -1
  72. package/src/modules/events/controllers/events.controller.js +9 -0
  73. package/src/modules/events/controllers/tickets.controller.js +2 -1
  74. package/src/modules/events/models/event.model.js +10 -0
  75. package/src/modules/events/store/events.js +15 -19
  76. package/src/modules/organizations/components/blocks/CardOrganization.vue +1 -3
  77. package/src/modules/organizations/components/sections/Publics.vue +2 -3
  78. package/src/modules/organizations/organizations.client.js +0 -2
  79. package/src/modules/users/components/pages/ProfileEvents.vue +3 -3
  80. package/src/modules/organizations/components/blocks/CardOrganizationSocial.vue +0 -46
  81. /package/src/modules/{community → constructor}/components/elements/Bullets.vue +0 -0
  82. /package/src/modules/{community → constructor}/components/elements/Caption.vue +0 -0
  83. /package/src/modules/{community → constructor}/components/elements/H2.vue +0 -0
  84. /package/src/modules/{community → constructor}/components/elements/Image.vue +0 -0
  85. /package/src/modules/{community → constructor}/components/elements/ImageUpload.vue +0 -0
@@ -562,15 +562,27 @@ function requireVerifyBlogpost() {
562
562
  try {
563
563
  const url = req.body.url ? req.body.url : req.body.name.toLowerCase().replace(/ /g, "-").replace(/[^\w-]+/g, "");
564
564
  if (!req.body._id) {
565
- res.status(400).send({ errorCode: "MISSING_BLOGPOST_ID", accessToken: null });
565
+ const blogpost = await Blogpost.findOne({ url });
566
+ if (blogpost) {
567
+ res.status(400).send({ errorCode: "POST_URL_ALREADY_IN_USE", accessToken: null });
568
+ return;
569
+ }
570
+ next();
566
571
  return;
567
572
  }
568
- const blogpost = await Blogpost.findOne({ url });
569
573
  const updatingBlogpostId = req.body._id;
570
- if (blogpost && String(blogpost._id) !== String(updatingBlogpostId)) {
571
- res.status(400).send({ errorCode: "POST_URL_ALREADY_IN_USE", accessToken: null });
574
+ const existingBlogpost = await Blogpost.findById(updatingBlogpostId);
575
+ if (!existingBlogpost) {
576
+ res.status(404).send({ errorCode: "BLOGPOST_NOT_FOUND", accessToken: null });
572
577
  return;
573
578
  }
579
+ if (existingBlogpost.url !== url) {
580
+ const blogpost = await Blogpost.findOne({ url });
581
+ if (blogpost) {
582
+ res.status(400).send({ errorCode: "POST_URL_ALREADY_IN_USE", accessToken: null });
583
+ return;
584
+ }
585
+ }
574
586
  next();
575
587
  } catch (err) {
576
588
  console.log(err);
@@ -561,15 +561,27 @@ function requireVerifyBlogpost() {
561
561
  try {
562
562
  const url = req.body.url ? req.body.url : req.body.name.toLowerCase().replace(/ /g, "-").replace(/[^\w-]+/g, "");
563
563
  if (!req.body._id) {
564
- res.status(400).send({ errorCode: "MISSING_BLOGPOST_ID", accessToken: null });
564
+ const blogpost = await Blogpost.findOne({ url });
565
+ if (blogpost) {
566
+ res.status(400).send({ errorCode: "POST_URL_ALREADY_IN_USE", accessToken: null });
567
+ return;
568
+ }
569
+ next();
565
570
  return;
566
571
  }
567
- const blogpost = await Blogpost.findOne({ url });
568
572
  const updatingBlogpostId = req.body._id;
569
- if (blogpost && String(blogpost._id) !== String(updatingBlogpostId)) {
570
- res.status(400).send({ errorCode: "POST_URL_ALREADY_IN_USE", accessToken: null });
573
+ const existingBlogpost = await Blogpost.findById(updatingBlogpostId);
574
+ if (!existingBlogpost) {
575
+ res.status(404).send({ errorCode: "BLOGPOST_NOT_FOUND", accessToken: null });
571
576
  return;
572
577
  }
578
+ if (existingBlogpost.url !== url) {
579
+ const blogpost = await Blogpost.findOne({ url });
580
+ if (blogpost) {
581
+ res.status(400).send({ errorCode: "POST_URL_ALREADY_IN_USE", accessToken: null });
582
+ return;
583
+ }
584
+ }
573
585
  next();
574
586
  } catch (err) {
575
587
  console.log(err);
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("./Feed-f4cad6c3.js"),e=require("vue"),C=require("./EmptyState-7658d7d6.js"),g=require("./auth-5aa8e90c.js"),v=require("vue-router"),T=require("./Breadcrumbs.vue_vue_type_style_index_0_lang-c6f3a0f0.js"),d=require("./categories-75b7d14b.js");require("./Tab.vue_vue_type_style_index_0_lang-0ea8fbf8.js");require("vue-i18n");const b=require("./EditProductImages-11510b66.js"),E=require("./globals-928eb13c.js"),P=require("./Comments-1aec0e5e.js");require("./CardHeader-925a972b.js");require("./PlaceholderUserpic-d64d6dd5.js");require("./vuex.esm-bundler-e8cf3cd2.js");require("./vue-draggable-next.esm-bundler-80731ae0.js");const I={},q={width:"100%",height:"50",xmlns:"http://www.w3.org/2000/svg"},z=e.createStaticVNode('<rect x="0" y="0" width="100%" height="100%" fill="rgb(var(--grey))"></rect><rect x="15" y="15" rx="3" ry="3" width="40" height="20" fill="rgba(var(--black),0.05)"></rect><rect x="65" y="15" rx="3" ry="3" width="150" height="20" fill="rgba(var(--black),0.05)"></rect><circle cx="250" cy="25" r="10" fill="rgba(var(--black),0.1)"></circle><circle cx="265" cy="25" r="10" fill="rgba(var(--black),0.05)"></circle><circle cx="280" cy="25" r="10" fill="rgba(var(--black),0.025)"></circle><rect x="-25%" y="0" width="25%" height="100%" fill="#fff" opacity="0.3"><animate attributeName="x" from="-25%" to="100%" dur="2s" repeatCount="indefinite"></animate></rect>',7),L=[z];function j(c,t){return e.openBlock(),e.createElementBlock("svg",q,L)}const O=g._export_sfc(I,[["render",j]]);const F={class:"today-events"},R={__name:"List",props:{category:{type:String,default:null},organization:{type:String,default:null},owner:{type:String,default:null},user:{type:[String,Number],default:null},period:{type:String,default:null},status:{type:String,default:null}},setup(c){const t=c,a=e.ref([]),r=e.ref(!0),n=e.ref(0),u=e.ref(5);return e.onMounted(async()=>{const o=await m.read({skip:n.value,limit:u.value,sortOrder:"desc",category:t.category,user:t.user,owner:t.owner,organization:t.organization,period:t.period,status:t.status});a.value=o,r.value=!1}),(o,l)=>(e.openBlock(),e.createElementBlock("section",F,[e.createVNode(e.TransitionGroup,{tag:"ul",name:"fade",class:"o-hidden bg-grey radius-big"},{default:e.withCtx(()=>[r.value?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(u.value,i=>(e.openBlock(),e.createBlock(O,{key:i}))),128)):e.createCommentVNode("",!0)]),_:1}),e.createVNode(e.Transition,{name:"fade"},{default:e.withCtx(()=>[!r.value&&a.value.length<1?(e.openBlock(),e.createBlock(C._sfc_main,{key:0,title:"No Events Today",description:"Today, are no events available. Please check back later.",class:"pd-medium mn-thin bg-grey radius-big"})):e.createCommentVNode("",!0)]),_:1}),e.createVNode(e.TransitionGroup,{tag:"ul",name:"fade",class:"container"},{default:e.withCtx(()=>[!r.value&&a.value.length>0?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(a.value,(i,f)=>(e.openBlock(),e.createBlock(m._sfc_main$1,{onClick:_=>o.$router.push({name:"Event",params:{url:i.url}}),key:i._id,event:i,owner:c.user,type:"short",class:e.normalizeClass(["pd-medium",{"br-b br-solid br-black-transp-10":f!==a.value.length-1}])},null,8,["onClick","event","owner","class"]))),128)):e.createCommentVNode("",!0)]),_:1})]))}},A=["onClick"],M={class:"t-transp"},U={__name:"DatePicker",props:["date","locale"],setup(c,{emit:t}){const a=c,r=e.ref(null);let n;if(a.date){const s=parseInt(a.date.substring(0,2)),h=parseInt(a.date.substring(2,4))-1,p=parseInt(a.date.substring(4));n=new Date(p,h,s),console.log("Data"+n)}else n=new Date,console.log("No data"+n);n.setHours(0,0,0,0);const u=e.ref(new Date(n)),o=_(n,30);e.onMounted(()=>{if(r.value){const s=r.value.getElementsByClassName("selected")[0]||r.value.getElementsByClassName("bg-main")[0];s&&(r.value.scrollLeft=s.offsetLeft-r.value.offsetWidth/2+s.offsetWidth/2)}});function l(s){u.value=s;const h=i(s);t("update:date",h)}function i(s){return`${s.getDate().toString().padStart(2,"0")}${(s.getMonth()+1).toString().padStart(2,"0")}${s.getFullYear()}`}function f(s){return s.toLocaleDateString(a.locale?a.locale:"en",{weekday:"narrow"}).toUpperCase()}function _(s,h){const p=[];for(let k=-15;k<h-15;k++){const B=new Date(s);B.setDate(s.getDate()+k),B.setHours(0,0,0,0),p.push(B)}return p}return(s,h)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("div",{class:"w-100 o-scroll flex-nowrap flex",ref_key:"scrollContainer",ref:r,style:{"scroll-snap-type":"x mandatory"}},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(o),p=>(e.openBlock(),e.createElementBlock("div",{key:p.toString(),onClick:k=>l(p),class:e.normalizeClass([{selected:u.value.toDateString()===p.toDateString()},"cursor-pointer mn-r-small mn-l-small flex-column flex-center flex"])},[e.createElementVNode("span",M,e.toDisplayString(f(p)),1),e.createElementVNode("span",{class:e.normalizeClass([{"bg-main":u.value.toDateString()===p.toDateString()},"transition-ease-in-out t-semi flex-center flex radius-big i-semi day-number"])},e.toDisplayString(p.getDate()),3)],10,A))),128))],512)]))}},J={class:"pd-thin min-h-100vh"},G=e.createElementVNode("div",{class:"mn-thin br-solid br-1px br-grey bg-grey radius-big"},null,-1),H={class:""},V={__name:"layoutEvents",setup(c){const t=v.useRoute(),a=v.useRouter(),n=u(new Date);function u(o){return`${o.getDate().toString().padStart(2,"0")}${(o.getMonth()+1).toString().padStart(2,"0")}${o.getFullYear()}`}if(t.query){const o=t.query,l={tags:o.tags?o.tags.split(","):null,date:o.date?o.date:n};m.state.filter=l}else{const o={date:n};m.state.filter=o}return e.watch(()=>m.state.filter,(o,l)=>{const i={...t.query};Object.keys(l).forEach(_=>{i[_]&&delete i[_]});const f=Object.fromEntries(Object.entries(o).filter(([_,s])=>Array.isArray(s)&&s.length>0||typeof s=="string"&&s).map(([_,s])=>[_,Array.isArray(s)?s.join(","):s]));Object.assign(i,f),a.push({query:i})},{deep:!0}),(o,l)=>{const i=e.resolveComponent("router-view");return e.openBlock(),e.createElementBlock("div",J,[e.createVNode(U,{date:m.state.filter.date,"onUpdate:date":l[0]||(l[0]=f=>m.state.filter.date=f),locale:o.$i18n.locale,class:"radius-small bg-grey pd-l-zero pd-r-zero pd-medium"},null,8,["date","locale"]),G,e.createElementVNode("section",H,[e.createVNode(i,null,{default:e.withCtx(({Component:f,route:_})=>[e.createVNode(e.Transition,{name:"scaleIn",mode:"out-in"},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(f),{ref:"page",key:_.query}))]),_:2},1024)]),_:1})])])}}};const W={class:"for-transition w-100"},Y={class:"pd-b-zero pd-t-zero pd-thin"},Q={class:"pd-thin"},K={class:"flex-nowrap flex bg-grey pd-medium radius-big"},X={key:0,class:"mn-r-auto"},Z={key:1,class:"mn-r-auto"},ee={class:"flex-nowrap flex pd-thin"},te={class:"pd-b-zero pd-t-zero pd-thin cols-2 gap-thin"},re={class:"mn-thin bg-grey pd-medium o-hidden radius-big"},ae=e.createElementVNode("h3",{class:"mn-semi"},"Profile",-1),ne={class:"mn-semi"},oe=e.createElementVNode("h5",null,"Categories",-1),se={class:""},ce={class:"mn-thin bg-grey pd-medium o-hidden radius-big"},le=e.createElementVNode("h3",{class:"mn-semi"},"Images",-1),S={__name:"EditEvent",async setup(c){let t,a;const r=v.useRoute(),n=v.useRouter();[t,a]=e.withAsyncContext(()=>d.actions.fetchCategories()),await t,a(),r.params.product&&([t,a]=e.withAsyncContext(()=>d.actions$1.read({_id:r.params.product})),await t,a());function u(){d.state.current.information.push({name:"",value:""})}function o(s){d.state.current.information.splice(s,1)}function l(){d.state.current.localization.push({locale:"",text:""})}function i(s){d.state.current.localization.splice(s,1)}function f(){r.params.product?d.actions$1.update(r.params.product,d.state.current):d.actions$1.create(r.params._id,d.state.current)}function _(){n.push({name:"ProductEdit",params:{_id:r.params._id,product:d.state.current._id}})}return(s,h)=>(e.openBlock(),e.createElementBlock("div",W,[e.createElementVNode("div",Y,[e.createVNode(d._sfc_main,{class:"pd-medium bg-grey radius-big"})]),e.createElementVNode("div",Q,[e.createElementVNode("header",K,[e.unref(r).params.product?(e.openBlock(),e.createElementBlock("h1",X,"Edit Product")):(e.openBlock(),e.createElementBlock("h1",Z,"Create Product")),e.createElementVNode("section",ee,[e.createVNode(g._sfc_main,{submit:f,callback:_},{default:e.withCtx(()=>[e.createTextVNode("Save Product")]),_:1})])])]),e.createElementVNode("div",te,[e.createElementVNode("div",re,[ae,e.createVNode(b._sfc_main,{product:d.state.current},null,8,["product"]),e.createElementVNode("div",ne,[oe,(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.state$1.all,(p,k)=>(e.openBlock(),e.createBlock(T.Checkbox,{label:p.name,name:"categories",value:p.url,class:"w-100 mn-t-small bg-white radius-small pd-small",radio:d.state.current.category},null,8,["label","value","radio"]))),256))]),e.createVNode(b._sfc_main$1,{items:d.state.current.information,title:"Parameters",emptyMessage:"No parameters",addButtonLabel:"Add parameter",keyName:"name",valueName:"value",onAddInfo:u,onDeleteInfo:o},null,8,["items"]),e.createVNode(b._sfc_main$1,{items:d.state.current.localization,title:"Localization",emptyMessage:"No localizations",addButtonLabel:"Add localization",keyName:"locale",valueName:"text",onAddInfo:l,onDeleteInfo:i},null,8,["items"])]),e.createElementVNode("div",se,[e.createElementVNode("div",ce,[le,e.createVNode(b._sfc_main$2,{product:d.state.current},null,8,["product"])])])])]))}},x=Object.freeze(Object.defineProperty({__proto__:null,default:S},Symbol.toStringTag,{value:"Module"})),w=g.axios.create({baseURL:process.env.API_URL,withCredentials:!0}),y=e.reactive({tickets:[],error:null}),N={async read({user:c,type:t,target:a,role:r}){try{const n=await w.get("/api/tickets",{params:{user:c,type:t,target:a,role:r}});return y.error=null,y.tickets=n.data,Promise.resolve(n.data)}catch(n){return E.setError(n),Promise.reject(n)}},async create(c){try{const t=await w.post("/api/tickets/create",c);return y.error=null,Promise.resolve(t.data)}catch(t){return E.setError(t),Promise.reject(t)}},async update(c){try{const t=await w.post("/api/tickets/update",c);return y.error=null,Promise.resolve(t.data)}catch(t){return E.setError(t),Promise.reject(t)}},async delete(c){try{const t=await w.post("/api/tickets/delete",c);return y.error=null,Promise.resolve(t.data)}catch(t){return E.setError(t),Promise.reject(t)}}},ie={handleTicketUpdate(c,t,a){let r;if(Array.isArray(c)?r=c.find(n=>n._id===t.target):typeof c=="object"&&c._id===t.target&&(r=c),r)if(r.hasTicket=a,a)r.tickets.push(t),r.numberOfTickets+=1;else{const n=r.tickets.findIndex(u=>u._id===t._id);n!==-1&&(r.tickets.splice(n,1),r.numberOfTickets-=1)}}};e.watch(y,c=>{});const ue={__name:"ButtonJoin",props:{type:{type:String,required:!0},userId:{type:String,required:!0},hasTicket:{type:Boolean,required:!0},targetId:{type:String,required:!0}},emits:["updateTicket"],setup(c,{emit:t}){const a=c,r=async()=>{a.hasTicket?await u(a.targetId):await n(a.targetId)};async function n(o){try{const l={type:a.type,target:o,user:a.userId},i=await N.create(l);t("updateTicket",{ticket:i,hasTicket:!0,targetId:a.targetId})}catch(l){throw console.log(l),l}}async function u(o){const l={type:a.type,target:o,user:a.userId};try{const i=await N.delete(l);t("updateTicket",{ticket:i,hasTicket:!1,targetId:a.targetId})}catch(i){throw console.log(i),i}}return(o,l)=>(e.openBlock(),e.createBlock(g._sfc_main,{submit:r,class:"bg-main button-small button"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(c.hasTicket?"Leave":"Join"),1)]),_:1}))}},de=g._export_sfc(ue,[["__scopeId","data-v-d5c351bb"]]),me={class:"pd-thin"},$={__name:"Event",setup(c){const t=v.useRoute(),a=({ticket:u,hasTicket:o,targetId:l})=>{ie.handleTicketUpdate(r.value,u,o,l)},r=e.ref(null),n=e.ref(!0);return e.onMounted(async()=>{n.value=!0;const u=await m.read({user:g.state.user._id,url:t.params.url});r.value=u[0],n.value=!1}),(u,o)=>(e.openBlock(),e.createElementBlock("section",me,[e.createVNode(e.TransitionGroup,{tag:"ul",name:"fade",class:"o-hidden bg-grey radius-big"},{default:e.withCtx(()=>[n.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},e.renderList(3,l=>e.createVNode(m.SkeletonEvent,{key:l})),64)):e.createCommentVNode("",!0)]),_:1}),e.createVNode(e.Transition,{name:"fade"},{default:e.withCtx(()=>[!n.value&&!r.value?(e.openBlock(),e.createBlock(C._sfc_main,{key:0,title:"No Event Found",description:"Currently, there are no events available. Please check back later.",class:"pd-medium mn-thin bg-grey radius-big"})):e.createCommentVNode("",!0)]),_:1}),e.createVNode(e.TransitionGroup,{tag:"ul",name:"fade",class:"container"},{default:e.withCtx(()=>[!n.value&&r.value?(e.openBlock(),e.createBlock(m._sfc_main$1,{key:0,onClick:o[0]||(o[0]=l=>u.$router.push({name:"Event",params:{url:r.value.url}})),event:r.value,owner:r.value.owner,user:g.state.user._id,type:"normal",class:e.normalizeClass(["mn-medium",{"br-b br-solid br-black-transp-10":u.index!==r.value.length-1}])},{default:e.withCtx(()=>[g.state.user._id?(e.openBlock(),e.createBlock(de,{key:0,type:"event",hasTicket:r.value.hasTicket,targetId:r.value._id,userId:g.state.user._id,class:"mn-small w-100 pd-medium mn-auto",onUpdateTicket:a},null,8,["hasTicket","targetId","userId"])):e.createCommentVNode("",!0)]),_:1},8,["event","owner","user","class"])):e.createCommentVNode("",!0),!n.value&&r.value?(e.openBlock(),e.createBlock(P._sfc_main,{key:1,type:"event",target:r.value._id,owner:g.state.user._id},null,8,["target","owner"])):e.createCommentVNode("",!0)]),_:1})]))}},pe=Object.freeze(Object.defineProperty({__proto__:null,default:$},Symbol.toStringTag,{value:"Module"})),D={__name:"Events",setup(c){const t=v.useRoute();return v.useRouter(),(a,r)=>(e.openBlock(),e.createElementBlock("section",null,[e.createVNode(m._sfc_main,{category:e.unref(t).params.category,user:g.state.user._id,period:e.unref(t).query.period,selectedDate:m.state.filter.date},null,8,["category","user","period","selectedDate"])]))}},_e=Object.freeze(Object.defineProperty({__proto__:null,default:D},Symbol.toStringTag,{value:"Module"})),fe=[{path:"events",component:V,meta:{title:{en:"Events",ru:"События"}},children:[{path:":category?",name:"Events",component:()=>Promise.resolve().then(()=>_e)}]},{path:"events/create",name:"Create Event",meta:{title:{en:"Create Event",ru:"Создать Событие"},authorize:[]},component:()=>Promise.resolve().then(()=>x)},{path:"events/:url",name:"Event",meta:{title:{en:"Event",ru:"Событие"}},component:()=>Promise.resolve().then(()=>pe)},{path:"events/:url/edit",name:"Edit Event",meta:{authorize:[]},component:()=>Promise.resolve().then(()=>x)}];exports.CardEvent=m._sfc_main$1;exports.Feed=m._sfc_main;exports.eventsStore=m.events;exports.EditEvent=S;exports.EventPage=$;exports.EventsLayout=V;exports.EventsPage=D;exports.List=R;exports.eventsRoutes=fe;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("./Feed-8fd41524.js"),e=require("vue"),V=require("./EmptyState-7658d7d6.js"),g=require("./auth-5aa8e90c.js"),y=require("vue-router"),E=require("./Breadcrumbs.vue_vue_type_style_index_0_lang-15e71ec4.js"),x=require("./Comments-63f154a6.js"),T=require("./Popup-105ef2c3.js"),$=require("./UploadImage-441e8526.js"),q=require("./organizations-af43bda4.js"),b=require("./globals-928eb13c.js");require("vue-i18n");require("./CardHeader-925a972b.js");require("./PlaceholderUserpic-d64d6dd5.js");require("./vue-draggable-next.esm-bundler-80731ae0.js");const I={},O={width:"100%",height:"50",xmlns:"http://www.w3.org/2000/svg"},z=e.createStaticVNode('<rect x="0" y="0" width="100%" height="100%" fill="rgb(var(--grey))"></rect><rect x="15" y="15" rx="3" ry="3" width="40" height="20" fill="rgba(var(--black),0.05)"></rect><rect x="65" y="15" rx="3" ry="3" width="150" height="20" fill="rgba(var(--black),0.05)"></rect><circle cx="250" cy="25" r="10" fill="rgba(var(--black),0.1)"></circle><circle cx="265" cy="25" r="10" fill="rgba(var(--black),0.05)"></circle><circle cx="280" cy="25" r="10" fill="rgba(var(--black),0.025)"></circle><rect x="-25%" y="0" width="25%" height="100%" fill="#fff" opacity="0.3"><animate attributeName="x" from="-25%" to="100%" dur="2s" repeatCount="indefinite"></animate></rect>',7),j=[z];function F(c,r){return e.openBlock(),e.createElementBlock("svg",O,j)}const L=g._export_sfc(I,[["render",F]]);const U={class:"today-events"},R={__name:"List",props:{category:{type:String,default:null},organization:{type:String,default:null},owner:{type:String,default:null},user:{type:[String,Number],default:null},period:{type:String,default:null},status:{type:String,default:null}},setup(c){const r=c,n=e.ref([]),t=e.ref(!0),s=e.ref(0),m=e.ref(5);return e.onMounted(async()=>{const a=await f.read({skip:s.value,limit:m.value,sortOrder:"desc",category:r.category,user:r.user,owner:r.owner,organization:r.organization,period:r.period,status:r.status});n.value=a,t.value=!1}),(a,u)=>(e.openBlock(),e.createElementBlock("section",U,[e.createVNode(e.TransitionGroup,{tag:"ul",name:"fade",class:"o-hidden bg-grey radius-big"},{default:e.withCtx(()=>[t.value?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(m.value,p=>(e.openBlock(),e.createBlock(L,{key:p}))),128)):e.createCommentVNode("",!0)]),_:1}),e.createVNode(e.Transition,{name:"fade"},{default:e.withCtx(()=>[!t.value&&n.value.length<1?(e.openBlock(),e.createBlock(V._sfc_main,{key:0,title:"No Events Today",description:"Today, are no events available. Please check back later.",class:"pd-medium mn-thin bg-grey radius-big"})):e.createCommentVNode("",!0)]),_:1}),e.createVNode(e.TransitionGroup,{tag:"ul",name:"fade",class:"container"},{default:e.withCtx(()=>[!t.value&&n.value.length>0?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(n.value,(p,_)=>(e.openBlock(),e.createBlock(f._sfc_main$1,{onClick:v=>a.$router.push({name:"Event",params:{url:p.url}}),key:p._id,event:p,owner:c.user,type:"short",class:e.normalizeClass(["pd-medium",{"br-b br-solid br-black-transp-10":_!==n.value.length-1}])},null,8,["onClick","event","owner","class"]))),128)):e.createCommentVNode("",!0)]),_:1})]))}},M=["onClick"],A={class:"t-transp"},J={__name:"DatePicker",props:["date","locale"],setup(c,{emit:r}){const n=c,t=e.ref(null);let s;if(n.date){const i=parseInt(n.date.substring(0,2)),h=parseInt(n.date.substring(2,4))-1,o=parseInt(n.date.substring(4));s=new Date(o,h,i),console.log("Data"+s)}else s=new Date,console.log("No data"+s);s.setHours(0,0,0,0);const m=e.ref(new Date(s)),a=v(s,30);e.onMounted(()=>{if(t.value){const i=t.value.getElementsByClassName("selected")[0]||t.value.getElementsByClassName("bg-main")[0];i&&(t.value.scrollLeft=i.offsetLeft-t.value.offsetWidth/2+i.offsetWidth/2)}});function u(i){m.value=i;const h=p(i);r("update:date",h)}function p(i){return`${i.getDate().toString().padStart(2,"0")}${(i.getMonth()+1).toString().padStart(2,"0")}${i.getFullYear()}`}function _(i){return i.toLocaleDateString(n.locale?n.locale:"en",{weekday:"narrow"}).toUpperCase()}function v(i,h){const o=[];for(let l=-15;l<h-15;l++){const d=new Date(i);d.setDate(i.getDate()+l),d.setHours(0,0,0,0),o.push(d)}return o}return(i,h)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("div",{class:"w-100 o-scroll flex-nowrap flex",ref_key:"scrollContainer",ref:t,style:{"scroll-snap-type":"x mandatory"}},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(a),o=>(e.openBlock(),e.createElementBlock("div",{key:o.toString(),onClick:l=>u(o),class:e.normalizeClass([{selected:m.value.toDateString()===o.toDateString()},"cursor-pointer mn-r-small mn-l-small flex-column flex-center flex"])},[e.createElementVNode("span",A,e.toDisplayString(_(o)),1),e.createElementVNode("span",{class:e.normalizeClass([{"bg-main":m.value.toDateString()===o.toDateString()},"transition-ease-in-out t-semi flex-center flex radius-big i-semi day-number"])},e.toDisplayString(o.getDate()),3)],10,M))),128))],512)]))}},G={class:"pd-thin min-h-100vh"},H=e.createElementVNode("div",{class:"mn-thin br-solid br-1px br-grey bg-grey radius-big"},null,-1),W={class:""},C={__name:"layoutEvents",setup(c){const r=y.useRoute(),n=y.useRouter(),s=m(new Date);function m(a){return`${a.getDate().toString().padStart(2,"0")}${(a.getMonth()+1).toString().padStart(2,"0")}${a.getFullYear()}`}if(r.query){const a=r.query,u={tags:a.tags?a.tags.split(","):null,date:a.date?a.date:s};f.state.filter=u}else{const a={date:s};f.state.filter=a}return e.watch(()=>f.state.filter,(a,u)=>{const p={...r.query};Object.keys(u).forEach(v=>{p[v]&&delete p[v]});const _=Object.fromEntries(Object.entries(a).filter(([v,i])=>Array.isArray(i)&&i.length>0||typeof i=="string"&&i).map(([v,i])=>[v,Array.isArray(i)?i.join(","):i]));Object.assign(p,_),n.push({query:p})},{deep:!0}),(a,u)=>{const p=e.resolveComponent("router-view");return e.openBlock(),e.createElementBlock("div",G,[e.createVNode(J,{date:f.state.filter.date,"onUpdate:date":u[0]||(u[0]=_=>f.state.filter.date=_),locale:a.$i18n.locale,class:"radius-small bg-grey pd-l-zero pd-r-zero pd-medium"},null,8,["date","locale"]),H,e.createElementVNode("section",W,[e.createVNode(p,null,{default:e.withCtx(({Component:_,route:v})=>[e.createVNode(e.Transition,{name:"scaleIn",mode:"out-in"},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(_),{ref:"page",key:v.query}))]),_:2},1024)]),_:1})])])}}},Y={key:0,class:"pd-thin"},Q={class:"mn-thin radius-small w-100 h-10r bg-grey flex-center flex-column flex"},K=e.createElementVNode("h4",null,"Upload Event Cover",-1),X=e.createElementVNode("h3",{class:"mn-small"},"Date",-1),Z=e.createElementVNode("h3",{class:"mn-small"},"Description",-1),ee={key:0,class:"w-100 bg-grey pd-big radius-big"},te={key:1,class:"pd-thin pos-fixed pos-l-0 pos-b-0 w-100"},re={class:"pd-thin radius-big bg-main w-100 flex-nowrap flex"},ae={class:"w-m-66r t-left pd-big bg-white radius-big"},ne=e.createElementVNode("h3",{class:"mn-small"},"Final Touches",-1),oe=e.createElementVNode("h5",{class:"mn-thin"},"Add to public:",-1),se={key:0,class:"mn-thin"},le={key:1,class:"mn-medium br-grey br-2px br-solid pd-small radius-big"},S={__name:"EditEvent",setup(c){const r=y.useRoute(),n=y.useRouter();let t=e.ref(null),s=e.ref(null);const m=e.ref([]),a=e.ref(null);e.onMounted(async()=>{if(r.params.url){const l=await f.read({user:g.state.user._id,url:r.params.url});t.value=l.pop()}else f.clean(),t.value=f.state.current;t.value.owner||(t.value.owner={target:g.state.user._id,type:"user"}),t.value.creator||(t.value.creator={target:g.state.user._id,type:"user",hidden:!1}),t.value.owner.type==="organization"&&(a.value={_id:t.value.owner.target._id,name:t.value.owner.target.profile.name,photo:t.value.owner.target.profile.photo});const o=await q.actions.read({user:g.state.user._id,postable:g.state.user._id});s.value=o.map(l=>({name:l.profile.name,_id:l._id,photo:l.profile.photo}))});const u=e.ref(!1);function p(){u.value=!0}function _(){u.value=!1}function v(){m.value.length>0&&m.value.map(o=>o.text),t.value.status="draft",r.params.url?f.update(t.value).then(o=>{n.push({name:"Event",params:{url:o.url}})}).catch(o=>{console.error(o)}):f.create(t.value).then(o=>{n.push({name:"Event",params:{url:o.url}})}).catch(o=>{console.error(o)})}function i(){confirm("Are you sure you want to delete this event?")&&(void 0)(t.value._id).then(o=>{n.push({name:"Drafts"})}).catch(o=>{console.error(o)})}function h(){a.value&&(t.value.owner={target:a.value._id,type:"organization"}),a.value||(t.value.creator.hidden=!1),a.value||(t.value.organization=t.value.creator),t.value.status="published",console.log(t.value),r.params.url?f.update(t.value).then(o=>{n.push({name:"Blogevent",params:{url:o.url}})}).catch(o=>{console.log(o)}):f.create(t.value).then(o=>{n.push({name:"Blogevent",params:{url:o.url}})}).catch(o=>{console.log(o)})}return(o,l)=>e.unref(t)?(e.openBlock(),e.createElementBlock("article",Y,[e.createElementVNode("div",Q,[e.createVNode($._sfc_main,{photo:e.unref(t).cover,"onUpdate:photo":l[0]||(l[0]=d=>e.unref(t).cover=d),uploadPath:"users/"+g.state.user._id+"/events",class:"h-4r w-4r aspect-1x1 o-hidden mn-thin radius-extra"},null,8,["photo","uploadPath"]),K]),e.createVNode(g.Field,{field:e.unref(t).name,"onUpdate:field":l[1]||(l[1]=d=>e.unref(t).name=d),placeholder:"Event name",class:"mn-thin w-100 bg-grey pd-medium radius-small"},null,8,["field"]),e.createVNode(g.Field,{field:e.unref(t).description,"onUpdate:field":l[2]||(l[2]=d=>e.unref(t).description=d),type:"textfield",placeholder:"Enter short description",class:"mn-thin w-100 bg-grey pd-medium radius-small"},null,8,["field"]),X,e.createVNode(g.Field,{field:e.unref(t).date.start,"onUpdate:field":l[3]||(l[3]=d=>e.unref(t).date.start=d),label:"Start",type:"datetime-local",placeholder:"Not specified",class:"mn-thin w-100 bg-grey pd-medium radius-small"},null,8,["field"]),e.createVNode(g.Field,{field:e.unref(t).date.end,"onUpdate:field":l[4]||(l[4]=d=>e.unref(t).date.end=d),label:"End",type:"datetime-local",placeholder:"Not specified",class:"mn-thin w-100 bg-grey pd-medium radius-small"},null,8,["field"]),Z,e.unref(t)?(e.openBlock(),e.createElementBlock("section",ee,[e.createVNode(x._sfc_main,{content:e.unref(t).content,onUpdate:l[5]||(l[5]=d=>e.unref(t).content=d)},null,8,["content"])])):e.createCommentVNode("",!0),e.unref(t)?(e.openBlock(),e.createElementBlock("section",te,[e.createElementVNode("div",re,[e.unref(r).params.url?(e.openBlock(),e.createElementBlock("a",{key:0,onClick:l[6]||(l[6]=d=>i()),class:"mn-r-auto bg-red t-white t-black button"},"Delete")):e.createCommentVNode("",!0),e.createElementVNode("a",{onClick:l[7]||(l[7]=d=>v()),class:"mn-l-auto bg-white t-black button"},"To Drafts"),e.createElementVNode("a",{onClick:l[8]||(l[8]=d=>p()),class:"mn-l-thin bg-black t-white button"},"Publish")])])):e.createCommentVNode("",!0),e.createVNode(T._sfc_main,{title:"Добавить участника",onClosePopup:_,isPopupOpen:u.value},{default:e.withCtx(()=>[e.createElementVNode("div",ae,[ne,e.createVNode(E._sfc_main,{onTagsChanged:l[9]||(l[9]=d=>e.unref(t).tags=d),tags:e.unref(t).tags},null,8,["tags"]),oe,e.createVNode(E.SelectMulti,{modelValue:a.value,"onUpdate:modelValue":l[10]||(l[10]=d=>a.value=d),options:e.unref(s),multiple:!1,taggable:!1,placeholder:"Type to search or add tag",label:"name","track-by":"_id",class:"mn-medium bg-grey radius-medium pd-small"},null,8,["modelValue","options"]),a.value?(e.openBlock(),e.createElementBlock("h5",se,"Options:")):e.createCommentVNode("",!0),a.value?(e.openBlock(),e.createElementBlock("div",le,[e.createVNode(E.Checkbox,{label:"Hide Author",radio:e.unref(t).creator.hidden,"onUpdate:radio":l[11]||(l[11]=d=>e.unref(t).creator.hidden=d),name:"prices",class:"w-100"},null,8,["radio"])])):e.createCommentVNode("",!0),e.createVNode(g._sfc_main,{submit:h,callback:o.redirectTo,class:"w-100 bg-black t-white"},{default:e.withCtx(()=>[e.createTextVNode("Publish")]),_:1},8,["callback"])])]),_:1},8,["isPopupOpen"])])):e.createCommentVNode("",!0)}},N=Object.freeze(Object.defineProperty({__proto__:null,default:S},Symbol.toStringTag,{value:"Module"})),w=g.axios.create({baseURL:process.env.API_URL,withCredentials:!0}),k=e.reactive({tickets:[],error:null}),B={async read({user:c,type:r,target:n,role:t}){try{const s=await w.get("/api/tickets",{params:{user:c,type:r,target:n,role:t}});return k.error=null,k.tickets=s.data,Promise.resolve(s.data)}catch(s){return b.setError(s),Promise.reject(s)}},async create(c){try{const r=await w.post("/api/tickets/create",c);return k.error=null,Promise.resolve(r.data)}catch(r){return b.setError(r),Promise.reject(r)}},async update(c){try{const r=await w.post("/api/tickets/update",c);return k.error=null,Promise.resolve(r.data)}catch(r){return b.setError(r),Promise.reject(r)}},async delete(c){try{const r=await w.post("/api/tickets/delete",c);return k.error=null,Promise.resolve(r.data)}catch(r){return b.setError(r),Promise.reject(r)}}},ie={handleTicketUpdate(c,r,n){let t;if(Array.isArray(c)?t=c.find(s=>s._id===r.target):typeof c=="object"&&c._id===r.target&&(t=c),t)if(t.hasTicket=n,n)t.tickets.push(r),t.numberOfTickets+=1;else{const s=t.tickets.findIndex(m=>m._id===r._id);s!==-1&&(t.tickets.splice(s,1),t.numberOfTickets-=1)}}};e.watch(k,c=>{});const ce={__name:"ButtonJoin",props:{type:{type:String,required:!0},userId:{type:String,required:!0},hasTicket:{type:Boolean,required:!0},targetId:{type:String,required:!0}},emits:["updateTicket"],setup(c,{emit:r}){const n=c,t=async()=>{n.hasTicket?await m(n.targetId):await s(n.targetId)};async function s(a){try{const u={type:n.type,target:a,user:n.userId},p=await B.create(u);r("updateTicket",{ticket:p,hasTicket:!0,targetId:n.targetId})}catch(u){throw console.log(u),u}}async function m(a){const u={type:n.type,target:a,user:n.userId};try{const p=await B.delete(u);r("updateTicket",{ticket:p,hasTicket:!1,targetId:n.targetId})}catch(p){throw console.log(p),p}}return(a,u)=>(e.openBlock(),e.createBlock(g._sfc_main,{submit:t,class:"bg-main button-small button"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(c.hasTicket?"Leave":"Join"),1)]),_:1}))}},ue=g._export_sfc(ce,[["__scopeId","data-v-d5c351bb"]]),de={class:"pd-thin"},D={__name:"Event",setup(c){const r=y.useRoute(),n=({ticket:m,hasTicket:a,targetId:u})=>{ie.handleTicketUpdate(t.value,m,a,u)},t=e.ref(null),s=e.ref(!0);return e.onMounted(async()=>{s.value=!0;const m=await f.read({user:g.state.user._id,url:r.params.url});t.value=m[0],s.value=!1}),(m,a)=>(e.openBlock(),e.createElementBlock("section",de,[e.createVNode(e.TransitionGroup,{tag:"ul",name:"fade",class:"o-hidden bg-grey radius-big"},{default:e.withCtx(()=>[s.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},e.renderList(3,u=>e.createVNode(f.SkeletonEvent,{key:u})),64)):e.createCommentVNode("",!0)]),_:1}),e.createVNode(e.Transition,{name:"fade"},{default:e.withCtx(()=>[!s.value&&!t.value?(e.openBlock(),e.createBlock(V._sfc_main,{key:0,title:"No Event Found",description:"Currently, there are no events available. Please check back later.",class:"pd-medium mn-thin bg-grey radius-big"})):e.createCommentVNode("",!0)]),_:1}),e.createVNode(e.TransitionGroup,{tag:"ul",name:"fade",class:"container"},{default:e.withCtx(()=>[!s.value&&t.value?(e.openBlock(),e.createBlock(f._sfc_main$1,{key:0,onClick:a[0]||(a[0]=u=>m.$router.push({name:"Event",params:{url:t.value.url}})),event:t.value,owner:t.value.owner,user:g.state.user._id,type:"normal",class:e.normalizeClass(["mn-medium",{"br-b br-solid br-black-transp-10":m.index!==t.value.length-1}])},{default:e.withCtx(()=>[g.state.user._id?(e.openBlock(),e.createBlock(ue,{key:0,type:"event",hasTicket:t.value.hasTicket,targetId:t.value._id,userId:g.state.user._id,class:"mn-small w-100 pd-medium mn-auto",onUpdateTicket:n},null,8,["hasTicket","targetId","userId"])):e.createCommentVNode("",!0)]),_:1},8,["event","owner","user","class"])):e.createCommentVNode("",!0),!s.value&&t.value?(e.openBlock(),e.createBlock(x._sfc_main$1,{key:1,type:"event",target:t.value._id,owner:g.state.user._id},null,8,["target","owner"])):e.createCommentVNode("",!0)]),_:1})]))}},pe=Object.freeze(Object.defineProperty({__proto__:null,default:D},Symbol.toStringTag,{value:"Module"})),P={__name:"Events",setup(c){const r=y.useRoute();return y.useRouter(),(n,t)=>(e.openBlock(),e.createElementBlock("section",null,[e.createVNode(f._sfc_main,{category:e.unref(r).params.category,user:g.state.user._id,period:e.unref(r).query.period,selectedDate:f.state.filter.date},null,8,["category","user","period","selectedDate"])]))}},me=Object.freeze(Object.defineProperty({__proto__:null,default:P},Symbol.toStringTag,{value:"Module"})),fe=[{path:"events",component:C,meta:{title:{en:"Events",ru:"События"}},children:[{path:":category?",name:"Events",component:()=>Promise.resolve().then(()=>me)}]},{path:"events/create",name:"Create Event",meta:{title:{en:"Create Event",ru:"Создать Событие"},authorize:[]},component:()=>Promise.resolve().then(()=>N)},{path:"events/:url",name:"Event",meta:{title:{en:"Event",ru:"Событие"}},component:()=>Promise.resolve().then(()=>pe)},{path:"events/:url/edit",name:"Edit Event",meta:{authorize:[]},component:()=>Promise.resolve().then(()=>N)}];exports.CardEvent=f._sfc_main$1;exports.Feed=f._sfc_main;exports.eventsStore=f.events;exports.EditEvent=S;exports.EventPage=D;exports.EventsLayout=C;exports.EventsPage=P;exports.List=R;exports.eventsRoutes=fe;