@ozdao/prometheus-framework 0.0.87 → 0.0.88

Sign up to get free protection for your applications and to get access to all the features.
@@ -1 +1 @@
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;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("./Feed-51e4e232.js"),e=require("vue"),V=require("./EmptyState-7658d7d6.js"),v=require("./auth-5aa8e90c.js"),y=require("vue-router"),E=require("./Breadcrumbs.vue_vue_type_style_index_0_lang-15e71ec4.js"),B=require("./Image-9a870c88.js"),P=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={},L={width:"100%",height:"50",xmlns:"http://www.w3.org/2000/svg"},O=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),U=[O];function F(p,r){return e.openBlock(),e.createElementBlock("svg",L,U)}const j=v._export_sfc(I,[["render",F]]);const z={class:"today-events"},M={__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(p){const r=p,n=e.ref([]),t=e.ref(!0),i=e.ref(0),c=e.ref(5);return e.onMounted(async()=>{const a=await g.read({skip:i.value,limit:c.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,o)=>(e.openBlock(),e.createElementBlock("section",z,[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(c.value,d=>(e.openBlock(),e.createBlock(j,{key:d}))),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,(d,f)=>(e.openBlock(),e.createBlock(g._sfc_main$1,{onClick:_=>a.$router.push({name:"Event",params:{url:d.url}}),key:d._id,event:d,owner:p.user,type:"short",class:e.normalizeClass(["pd-medium",{"br-b br-solid br-black-transp-10":f!==n.value.length-1}])},null,8,["onClick","event","owner","class"]))),128)):e.createCommentVNode("",!0)]),_:1})]))}},R=["onClick"],A={class:"t-transp"},H={__name:"DatePicker",props:["date","locale"],setup(p,{emit:r}){const n=p,t=e.ref(null);let i;if(n.date){const u=parseInt(n.date.substring(0,2)),h=parseInt(n.date.substring(2,4))-1,s=parseInt(n.date.substring(4));i=new Date(s,h,u),console.log("Data"+i)}else i=new Date,console.log("No data"+i);i.setHours(0,0,0,0);const c=e.ref(new Date(i)),a=_(i,30);e.onMounted(()=>{if(t.value){const u=t.value.getElementsByClassName("selected")[0]||t.value.getElementsByClassName("bg-main")[0];u&&(t.value.scrollLeft=u.offsetLeft-t.value.offsetWidth/2+u.offsetWidth/2)}});function o(u){c.value=u;const h=d(u);r("update:date",h)}function d(u){return`${u.getDate().toString().padStart(2,"0")}${(u.getMonth()+1).toString().padStart(2,"0")}${u.getFullYear()}`}function f(u){return u.toLocaleDateString(n.locale?n.locale:"en",{weekday:"narrow"}).toUpperCase()}function _(u,h){const s=[];for(let l=-15;l<h-15;l++){const m=new Date(u);m.setDate(u.getDate()+l),m.setHours(0,0,0,0),s.push(m)}return s}return(u,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),s=>(e.openBlock(),e.createElementBlock("div",{key:s.toString(),onClick:l=>o(s),class:e.normalizeClass([{selected:c.value.toDateString()===s.toDateString()},"cursor-pointer mn-r-small mn-l-small flex-column flex-center flex"])},[e.createElementVNode("span",A,e.toDisplayString(f(s)),1),e.createElementVNode("span",{class:e.normalizeClass([{"bg-main":c.value.toDateString()===s.toDateString()},"transition-ease-in-out t-semi flex-center flex radius-big i-semi day-number"])},e.toDisplayString(s.getDate()),3)],10,R))),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),W={class:""},C={__name:"layoutEvents",setup(p){const r=y.useRoute(),n=y.useRouter(),i=c(new Date);function c(a){return`${a.getDate().toString().padStart(2,"0")}${(a.getMonth()+1).toString().padStart(2,"0")}${a.getFullYear()}`}if(r.query){const a=r.query,o={tags:a.tags?a.tags.split(","):null,date:a.date?a.date:i};g.state.filter=o}else{const a={date:i};g.state.filter=a}return e.watch(()=>g.state.filter,(a,o)=>{const d={...r.query};Object.keys(o).forEach(_=>{d[_]&&delete d[_]});const f=Object.fromEntries(Object.entries(a).filter(([_,u])=>Array.isArray(u)&&u.length>0||typeof u=="string"&&u).map(([_,u])=>[_,Array.isArray(u)?u.join(","):u]));Object.assign(d,f),n.push({query:d})},{deep:!0}),(a,o)=>{const d=e.resolveComponent("router-view");return e.openBlock(),e.createElementBlock("div",J,[e.createVNode(H,{date:g.state.filter.date,"onUpdate:date":o[0]||(o[0]=f=>g.state.filter.date=f),locale:a.$i18n.locale,class:"radius-small bg-grey pd-l-zero pd-r-zero pd-medium"},null,8,["date","locale"]),G,e.createElementVNode("section",W,[e.createVNode(d,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})])])}}},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:"pd-b-extra 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"},D={__name:"EditEvent",setup(p){const r=y.useRoute(),n=y.useRouter();let t=e.ref(null),i=e.ref(null);const c=e.ref([]),a=e.ref(null);e.onMounted(async()=>{if(r.params.url){const l=await g.read({user:v.state.user._id,url:r.params.url});t.value=l.pop(),t.value.date.start=t.value.date.start.slice(0,16),t.value.date.end=t.value.date.end.slice(0,16)}else g.clean(),t.value=g.state.current;t.value.owner||(t.value.owner={target:v.state.user._id,type:"user"}),t.value.creator||(t.value.creator={target:v.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 s=await q.actions.read({user:v.state.user._id,postable:v.state.user._id});i.value=s.map(l=>({name:l.profile.name,_id:l._id,photo:l.profile.photo}))});const o=e.ref(!1);function d(){o.value=!0}function f(){o.value=!1}function _(){c.value.length>0&&c.value.map(s=>s.text),t.value.status="draft",r.params.url?g.update(t.value).then(s=>{n.push({name:"Event",params:{url:s.url}})}).catch(s=>{console.error(s)}):g.create(t.value).then(s=>{n.push({name:"Event",params:{url:s.url}})}).catch(s=>{console.error(s)})}function u(){confirm("Are you sure you want to delete this event?")&&(void 0)(t.value._id).then(s=>{n.push({name:"Drafts"})}).catch(s=>{console.error(s)})}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?g.update(t.value).then(s=>{n.push({name:"Blogevent",params:{url:s.url}})}).catch(s=>{console.log(s)}):g.create(t.value).then(s=>{n.push({name:"Event",params:{url:s.url}})}).catch(s=>{console.log(s)})}return(s,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]=m=>e.unref(t).cover=m),uploadPath:"users/"+v.state.user._id+"/events",class:"h-4r w-4r aspect-1x1 o-hidden mn-thin radius-extra"},null,8,["photo","uploadPath"]),K]),e.createVNode(v.Field,{field:e.unref(t).name,"onUpdate:field":l[1]||(l[1]=m=>e.unref(t).name=m),placeholder:"Event name",class:"mn-thin w-100 bg-grey pd-medium radius-small"},null,8,["field"]),e.createVNode(v.Field,{field:e.unref(t).description,"onUpdate:field":l[2]||(l[2]=m=>e.unref(t).description=m),type:"textfield",placeholder:"Enter short description",class:"mn-thin w-100 bg-grey pd-medium radius-small"},null,8,["field"]),X,e.createTextVNode(" "+e.toDisplayString(e.unref(t).date.start)+" ",1),e.createVNode(v.Field,{field:e.unref(t).date.start,"onUpdate:field":l[3]||(l[3]=m=>e.unref(t).date.start=m),label:"Start",type:"datetime-local",placeholder:"Not specified",class:"mn-thin w-100 bg-grey pd-medium radius-small"},null,8,["field"]),e.createVNode(v.Field,{field:e.unref(t).date.end,"onUpdate:field":l[4]||(l[4]=m=>e.unref(t).date.end=m),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(B._sfc_main,{content:e.unref(t).content,onUpdate:l[5]||(l[5]=m=>e.unref(t).content=m)},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]=m=>u()),class:"mn-r-auto bg-red t-white t-black button"},"Delete")):e.createCommentVNode("",!0),e.createElementVNode("a",{onClick:l[7]||(l[7]=m=>_()),class:"mn-l-auto bg-white t-black button"},"To Drafts"),e.createElementVNode("a",{onClick:l[8]||(l[8]=m=>d()),class:"mn-l-thin bg-black t-white button"},"Publish")])])):e.createCommentVNode("",!0),e.createVNode(P._sfc_main,{title:"Добавить участника",onClosePopup:f,isPopupOpen:o.value},{default:e.withCtx(()=>[e.createElementVNode("div",ae,[ne,e.createVNode(E._sfc_main,{onTagsChanged:l[9]||(l[9]=m=>e.unref(t).tags=m),tags:e.unref(t).tags},null,8,["tags"]),oe,e.createVNode(E.SelectMulti,{modelValue:a.value,"onUpdate:modelValue":l[10]||(l[10]=m=>a.value=m),options:e.unref(i),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]=m=>e.unref(t).creator.hidden=m),name:"prices",class:"w-100"},null,8,["radio"])])):e.createCommentVNode("",!0),e.createVNode(v._sfc_main,{submit:h,callback:s.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:D},Symbol.toStringTag,{value:"Module"})),w=v.axios.create({baseURL:process.env.API_URL,withCredentials:!0}),k=e.reactive({tickets:[],error:null}),x={async read({user:p,type:r,target:n,role:t}){try{const i=await w.get("/api/tickets",{params:{user:p,type:r,target:n,role:t}});return k.error=null,k.tickets=i.data,Promise.resolve(i.data)}catch(i){return b.setError(i),Promise.reject(i)}},async create(p){try{const r=await w.post("/api/tickets/create",p);return k.error=null,Promise.resolve(r.data)}catch(r){return b.setError(r),Promise.reject(r)}},async update(p){try{const r=await w.post("/api/tickets/update",p);return k.error=null,Promise.resolve(r.data)}catch(r){return b.setError(r),Promise.reject(r)}},async delete(p){try{const r=await w.post("/api/tickets/delete",p);return k.error=null,Promise.resolve(r.data)}catch(r){return b.setError(r),Promise.reject(r)}}},ie={handleTicketUpdate(p,r,n){let t;if(Array.isArray(p)?t=p.find(i=>i._id===r.target):typeof p=="object"&&p._id===r.target&&(t=p),t)if(t.hasTicket=n,n)t.tickets.push(r),t.numberOfTickets+=1;else{const i=t.tickets.findIndex(c=>c._id===r._id);i!==-1&&(t.tickets.splice(i,1),t.numberOfTickets-=1)}}};e.watch(k,p=>{});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(p,{emit:r}){const n=p,t=async()=>{n.hasTicket?await c(n.targetId):await i(n.targetId)};async function i(a){try{const o={type:n.type,target:a,user:n.userId},d=await x.create(o);r("updateTicket",{ticket:d,hasTicket:!0,targetId:n.targetId})}catch(o){throw console.log(o),o}}async function c(a){const o={type:n.type,target:a,user:n.userId};try{const d=await x.delete(o);r("updateTicket",{ticket:d,hasTicket:!1,targetId:n.targetId})}catch(d){throw console.log(d),d}}return(a,o)=>(e.openBlock(),e.createBlock(v._sfc_main,{submit:t,class:"bg-main button-small button"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(p.hasTicket?"Leave":"Join"),1)]),_:1}))}},ue=v._export_sfc(ce,[["__scopeId","data-v-d5c351bb"]]),de={class:"pd-thin"},S={__name:"Event",setup(p){const r=y.useRoute(),n=({ticket:o,hasTicket:d,targetId:f})=>{ie.handleTicketUpdate(c.value,o,d,f)},t={Textarea:"p",H2:"h2",Bullets:"p",Caption:"p",ImageUpload:B._sfc_main$2};function i(o){return o.type==="Textarea"?{innerHTML:o.content,class:"p-medium"}:o.type==="H2"?{innerHTML:o.content,class:"h3"}:o.type==="Caption"?{innerHTML:o.content}:o.type==="ImageUpload"?{src:o.content}:{}}const c=e.ref(null),a=e.ref(!0);return e.onMounted(async()=>{a.value=!0;const o=await g.read({user:v.state.user._id,url:r.params.url});c.value=o[0],a.value=!1}),(o,d)=>(e.openBlock(),e.createElementBlock("section",de,[e.createVNode(e.TransitionGroup,{tag:"ul",name:"fade",class:"o-hidden bg-grey radius-big"},{default:e.withCtx(()=>[a.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},e.renderList(3,f=>e.createVNode(g.SkeletonEvent,{key:f})),64)):e.createCommentVNode("",!0)]),_:1}),e.createVNode(e.Transition,{name:"fade"},{default:e.withCtx(()=>[!a.value&&!c.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(()=>[!a.value&&c.value?(e.openBlock(),e.createBlock(g._sfc_main$1,{key:0,onClick:d[0]||(d[0]=f=>o.$router.push({name:"Event",params:{url:c.value.url}})),event:c.value,owner:c.value.owner,user:v.state.user._id,type:"normal",class:"mn-medium bg-grey radius-big"},{default:e.withCtx(()=>[v.state.user._id?(e.openBlock(),e.createBlock(ue,{key:0,type:"event",hasTicket:c.value.hasTicket,targetId:c.value._id,userId:v.state.user._id,class:"mn-small w-100 pd-medium mn-auto",onUpdateTicket:n},null,8,["hasTicket","targetId","userId"])):e.createCommentVNode("",!0),e.createElementVNode("section",null,[c.value&&c.value.content?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(c.value.content,(f,_)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t[f.type]),e.mergeProps({key:_,index:_,component:f,prop:f,class:f.class,content:"content"},i(f),{class:"mn-regular"}),null,16,["index","component","prop","class"]))),128)):e.createCommentVNode("",!0)])]),_:1},8,["event","owner","user"])):e.createCommentVNode("",!0),!a.value&&c.value?(e.openBlock(),e.createBlock(B._sfc_main$1,{key:1,type:"event",target:c.value._id,owner:v.state.user._id},null,8,["target","owner"])):e.createCommentVNode("",!0)]),_:1})]))}},pe=Object.freeze(Object.defineProperty({__proto__:null,default:S},Symbol.toStringTag,{value:"Module"})),T={__name:"Events",setup(p){const r=y.useRoute();return y.useRouter(),(n,t)=>(e.openBlock(),e.createElementBlock("section",null,[e.createVNode(g._sfc_main,{category:e.unref(r).params.category,user:v.state.user._id,period:e.unref(r).query.period,selectedDate:g.state.filter.date},null,8,["category","user","period","selectedDate"])]))}},me=Object.freeze(Object.defineProperty({__proto__:null,default:T},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=g._sfc_main$1;exports.Feed=g._sfc_main;exports.eventsStore=g.events;exports.EditEvent=D;exports.EventPage=S;exports.EventsLayout=C;exports.EventsPage=T;exports.List=M;exports.eventsRoutes=fe;