1import{i as o}from"./imageURLreturn-BI9YqGmO.js";import{_ as t,W as e,N as a,G as s,u as l,m as i,n,q as r,f as c,v as d,t as u,r as p,y as m,e as g,D as h,a8 as v,a0 as f,g as S,z as w,F as b,x as D,V as k,a2 as _,B as y}from"./index-M5qy_4Wm.js";import{C}from"./customInput-CRuVXa_j.js";import{H as x}from"./hostAppBar-Nsn6mbm2.js";import"./croppie-COvZV25I.js";import"./customSearch-sElyVGsZ.js";import"./drawerIcon-D6p8KgWU.js";const V={key:0},L={key:1},I={class:"d-flex justify-center align-center"},U=["src"];const B={class:"d-flex justify-end mx-3"},j={key:0},A={src:"https://firebasestorage.googleapis.com/v0/b/forged-7adb7.appspot.com/o/global%2Fstar-full.svg?alt=media&token=c90fcbf9-b740-4df3-b233-c0e4685647f5",class:"star"},W={src:"https://firebasestorage.googleapis.com/v0/b/forged-7adb7.appspot.com/o/global%2Fstar.svg?alt=media&token=bbdad6df-5233-4ebe-b355-d65efb9dee26",class:"star"},E={key:0},F={key:1};const H=t({components:{HostAppBar:x,addSponsor:t({props:{sponsor:Object},emits:["closeDialog"],components:{CustomInput:C,imageURLreturn:o},data(){return{imgDialog:{show:!1,windowWidth:350,currentImage:"",updateDBlocation:"/trash",updateDBitem:"img",updateStorageLocation:"/venues/"+this.venueStore.venue.locationSlug+"/sponsors/"+this.generalStore.dateToday+"/",ratioWidth:"1",ratioHeight:"1",saveWidth:"800",saveFormat:"jpeg"},localSponsor:{content:{}},validationErrors:{title:"",link:""}}},mounted(){this.localSponsor=this.sponsor},watch:{sponsor(){this.localSponsor=this.sponsor}},setup:()=>({venueStore:l(),generalStore:i()}),methods:{isValid(){const o=this.localSponsor.content.title||"",t=this.localSponsor.content.link||"";return!o.length&&(this.validationErrors.title="Please fill up this field"),!t.length&&(this.validationErrors.link="URL is required"),Boolean(o.length&&t.length)},closeImageDialog(o){void 0!==o&&(this.localSponsor.content.img=o),this.imgDialog.show=!1},hasImage(){return void 0!==this.localSponsor.content.img},save(){if(this.isValid())return this.hasImage()?void("new"===this.localSponsor.type?e(a("/venues/"+this.venueStore.venue.locationSlug+"/sponsors"),{img:this.localSponsor.content.img,active:this.localSponsor.content.active,link:this.localSponsor.content.link,title:this.localSponsor.content.title,fav:this.localSponsor.fav,date:Date.now()}).then(()=>{this.$emit("closeDialog")}).catch(o=>{this._console(o)}):s(a("/venues/".concat(this.venueStore.venue.locationSlug,"/sponsors/").concat(this.localSponsor.content[".key"])),{img:this.localSponsor.content.img,active:this.localSponsor.content.active,link:this.localSponsor.content.link,title:this.localSponsor.content.title,date:Date.now()}).then(()=>{this.$emit("closeDialog")}).catch(o=>{this._console(o)})):(alert("You must upload an image"),void(this.imgDialog.show=!0))}}},[["render",function(o,t,e,a,s,l){const i=p("v-icon"),w=p("v-btn"),b=p("v-toolbar-title"),D=p("v-spacer"),k=p("v-toolbar"),_=p("v-col"),y=p("v-row"),C=p("custom-input"),x=p("v-checkbox"),B=p("v-card-text"),j=p("imageURLreturn"),A=p("v-dialog"),W=p("v-card");return S(),n(W,{tile:"",style:{"background-color":"var(--theme-dialog)"}},{default:r(()=>[c(w,{icon:"",class:"closeAbsolute",onClick:t[0]||(t[0]=t=>o.$emit("closeDialog"))},{default:r(()=>[c(i,null,{default:r(()=>[...t[9]||(t[9]=[m("mdi-close",-1)])]),_:1})]),_:1}),c(k,null,{default:r(()=>[c(b,null,{default:r(()=>["new"===s.localSponsor.type?(S(),g("span",V,"Add Sponsor")):(S(),g("span",L,"Edit Sponsor"))]),_:1}),c(D)]),_:1}),d("form",{id:"formSponsor",onSubmit:t[7]||(t[7]=f(o=>l.save(),["prevent"]))},[c(B,null,{default:r(()=>[c(y,{class:"sponsorInfo"},{default:r(()=>[c(_,{cols:"4",class:"offset-xs1"},{default:r(()=>[c(y,null,{default:r(()=>[c(_,{cols:"12",class:"pa-3"},{default:r(()=>[t[11]||(t[11]=d("div",{class:"input-label mb-1"},"Sponsor Image",-1)),d("div",{class:"logo-container",onClick:t[1]||(t[1]=o=>s.imgDialog.show=!0)},[d("div",I,[c(i,null,{default:r(()=>[...t[10]||(t[10]=[m("mdi-camera-plus",-1)])]),_:1})]),h(d("img",{src:s.localSponsor.content.img,alt:"logo"},null,8,U),[[v,void 0!==s.localSponsor.content.img]]),h(d("div",null," Click to Upload Image ",512),[[v,""===s.localSponsor.content.img]])])]),_:1})]),_:1})]),_:1}),c(_,{cols:"6"},{default:r(()=>
1[c(_,{cols:"12",class:"pa-3"},{default:r(()=>[c(C,{"top-text":"Text*",modelValue:s.localSponsor.content.title,"onUpdate:modelValue":t[2]||(t[2]=o=>s.localSponsor.content.title=o),"bottom-warning":s.validationErrors.title,onKeyUp:t[3]||(t[3]=o=>s.validationErrors.title="")},null,8,["modelValue","bottom-warning"])]),_:1}),c(_,{cols:"12",class:"pa-3"},{default:r(()=>[c(C,{"top-text":"URL (ex. http://www.mywebsite.com)*",modelValue:s.localSponsor.content.link,"onUpdate:modelValue":t[4]||(t[4]=o=>s.localSponsor.content.link=o),"bottom-warning":s.validationErrors.link,onKeyUp:t[5]||(t[5]=o=>s.validationErrors.link="")},null,8,["modelValue","bottom-warning"])]),_:1}),c(_,{cols:"12",class:"px-3"},{default:r(()=>[c(x,{dark:"",color:"var(--clr-blue)",label:"Active","false-value":"Disabled","true-value":"Active",modelValue:s.localSponsor.content.active,"onUpdate:modelValue":t[6]||(t[6]=o=>s.localSponsor.content.active=o)},null,8,["modelValue"])]),_:1}),c(w,{color:"primary",class:"mt-4",type:"submit",form:"formSponsor"},{default:r(()=>[...t[12]||(t[12]=[m("Save",-1)])]),_:1})]),_:1})]),_:1})]),_:1})],32),s.imgDialog.show?(S(),n(A,{key:0,modelValue:s.imgDialog.show,"onUpdate:modelValue":t[8]||(t[8]=o=>s.imgDialog.show=o),scrollable:"",width:this.imgDialog.windowWidth,style:{background:"var(--theme-dialog)"}},{default:r(()=>[c(j,{currentImage:s.imgDialog.currentImage,ratioWidth:s.imgDialog.ratioWidth,ratioHeight:s.imgDialog.ratioHeight,updateDBlocation:s.imgDialog.updateDBlocation,updateDBitem:s.imgDialog.updateDBitem,updateStorageLocation:s.imgDialog.updateStorageLocation,saveWidth:s.imgDialog.saveWidth,saveFormat:s.imgDialog.saveFormat,onCloseImageDialog:l.closeImageDialog},null,8,["currentImage","ratioWidth","ratioHeight","updateDBlocation","updateDBitem","updateStorageLocation","saveWidth","saveFormat","onCloseImageDialog"])]),_:1},8,["modelValue","width"])):u("",!0)]),_:1})}],["__scopeId","data-v-f6aadb53"]])},data:()=>({activeTab:0,search:"",imgDialog:{show:!1},sponsor:{content:{active:"Active"},show:!1,fav:!1,type:"new"},sponsors:[]}),setup:()=>({venueStore:l()}),computed:{filteredList(){return[...this.sponsors.map(o=>{if(o.fav)return o}).filter(o=>o),...this.sponsors.map(o=>{if(!o.fav)return o}).filter(o=>o)].filter(o=>void 0!==this.search?o.active.toLowerCase().includes(this.search.toLowerCase())||o.link.toLowerCase().includes(this.search.toLowerCase())||o.title.toLowerCase().includes(this.search.toLowerCase()):o)}},methods:{favEvent(o){s(a("/venues/".concat(this.venueStore.venue.locationSlug,"/sponsors/").concat(o.id)),{fav:!o.fav}).catch(o=>{this._console(o)})},showMore(o){this.filteredList[o].more=!this.filteredList[o].more,this.$forceUpdate()},confirmDelete:()=>confirm("Are you sure you want to delete?"),deleteSponsor(o){this.confirmDelete()&&k(a("/venues/".concat(this.venueStore.venue.locationSlug,"/sponsors/").concat(o.id)))},edit(o){this.sponsor.content={...o},this.sponsor.type="edit",this.sponsor.show=!0,this.sponsor.content[".key"]=o.id},closeDialog(o){this.sponsor.content={active:"Active"},this.sponsor.type="new",this.sponsor.show=!1},getSponsors(){this.$databaseBind("sponsors",a("/venues/"+this.venueStore.venue.locationSlug+"/sponsors"))}},mounted(){this.getSponsors()}},[["render",function(o,t,e,a,s,l){const i=p("host-app-bar"),k=p("v-btn"),C=p("v-col"),x=p("v-icon"),V=p("v-row"),L=p("addSponsor"),I=p("v-dialog");return S(),g("div",null,[c(i,{title:"Sponsors",modelValue:s.search,"onUpdate:modelValue":t[0]||(t[0]=o=>s.search=o)},null,8,["modelValue"]),d("div",B,[c(k,{color:" primary",class:w(["btn-width",o.$vuetify.display.xs?"w-100 mx-0":"w-auto"]),onClick:t[1]||(t[1]=o=>s.sponsor.show=!0)},{default:r(()=>[...t[3]||(t[3]=[m("Add Sponsor",-1)])]),_:1},8,["class"])]),0===s.activeTab?(S(),g("span",j,[c(V,{class:"ma-0"},{default:r(()=>[(S(!0),g(b,null,D(l.filteredList,(o,e)=>(S(),n(C,{key:o.id,cols:"12",md:"6",class:"pa-2"},{default:r(()=>[c(V,{class:"align-center item ma-1 pa-2",style:{"background-color":"white"}},{default:r(()=>[c(C,{cols:"12",sm:"8",class:"pa-2 list-title"},{default:r(()=>[c(k,{variant:"flat",color:"none",onClick:t=>l.favEvent(o)},{default:r(()=>[h(d("img",A,null,512),[[v,o.fav]]),h(d("img",W,null,512),[[v,!o.fav]])]),_:2},1032,["onClick"]),d("div",{class:"card-img mr-2",style:_({"background-image":"url("+o.img+")"})},null,4),d("span",null,y(o.title),1)]),_:2},1024),c(C,{cols:"6",sm:"3",style:{"white-space":"nowrap"},class:"px-2 text-right"},{default:r(()=>[o.more?(S(),g("div",E,[c(k,{icon:"",onClick:t=>l.edit(o),style:{height:"100%",margin:"auto 0"}},{default:r(()=>[c(x,{color:"primary"},{default:r(()=>[...t[4]||(t[4]=[m("mdi-pencil",-1)])]),_:1})]),_:1},8,["onClick"]),c(k,{icon:"",style:{height:"100%",margin:"auto 15px"},onClick:f(t=>l.deleteSponsor(o),["stop"])},{default:r(()=>[c(x,{color:"#e1233d"},{default:r(()=>[...t[5]||(t[5]=[m("mdi-delete",-1)])]),_:1})]),_:1},8,["onClick"])])):(S(),g("div",F,[c(k,{variant:"outlined",class:w(["status",{active:"Active"==o.active}])},{default:r(()=>[m(y(o.active),1)]),_:2},1032,["class"])]))]),_:2},1024),c(C,{cols:"6",sm:"1",class:"text-center px-2"},{default:r(()=>[c(k,{icon:"",variant:"flat",onClick:f(o=>l.showMore(e),["stop"])},{default:r(()=>[...t[6]||(t[6]=[d("i",{class:"icon-more"},null,-1)])]),_:1},8,["onClick"])]),_:2},1024)]),_:2},1024)]),_:2},1024))),128))]),_:1})])):u("",!0),c(I,{fullscreen:"",transition:"dialog-bottom-transition",scrollable:"",modelValue:s.sponsor.show,"onUpdate:modelValue":t[2]||(t[2]=o=>s.sponsor.show=o)},{default:r(()=>[c(L,{sponsor:s.sponsor,onCloseDialog:l.closeDialog},null,8,["sponsor","onCloseDialog"])]),_:1},8,["modelValue"])])}],["__scopeId","data-v-7fad7869"]]);export{H as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.