"use strict";(self["webpackChunkmiriamgemeinde"]=self["webpackChunkmiriamgemeinde"]||[]).push([[8074],{5693:function(e,t,n){n.r(t),n.d(t,{default:function(){return y}});var l=n(6768),a=n(5688),c=n(5187);const d=e=>((0,l.Qi)("data-v-920e5ffc"),e=e(),(0,l.jt)(),e),o={class:"event-places-management"},i=d((()=>(0,l.Lk)("h2",null,"Veranstaltungsorte verwalten",-1))),r=d((()=>(0,l.Lk)("label",{for:"name"},"Name:",-1))),s=d((()=>(0,l.Lk)("label",{for:"street"},"Straße:",-1))),u=d((()=>(0,l.Lk)("label",{for:"zipcode"},"PLZ:",-1))),v=d((()=>(0,l.Lk)("label",{for:"city"},"Stadt:",-1))),p=d((()=>(0,l.Lk)("label",{for:"backgroundColor"},"Hintergrundfarbe:",-1))),k=d((()=>(0,l.Lk)("button",{type:"submit"},"Speichern",-1))),h=d((()=>(0,l.Lk)("thead",null,[(0,l.Lk)("tr",null,[(0,l.Lk)("th",null,"Name"),(0,l.Lk)("th",null,"Bearbeiten"),(0,l.Lk)("th",null,"Löschen")])],-1))),f=["onClick"],P=["onClick"];function E(e,t,n,d,E,m){return(0,l.uX)(),(0,l.CE)("div",o,[i,(0,l.Lk)("form",{onSubmit:t[6]||(t[6]=(0,a.D$)(((...e)=>m.addEventPlace&&m.addEventPlace(...e)),["prevent"]))},[r,(0,l.bo)((0,l.Lk)("input",{type:"text",id:"name","onUpdate:modelValue":t[0]||(t[0]=e=>E.newEventPlace.name=e),placeholder:"Name",required:""},null,512),[[a.Jo,E.newEventPlace.name]]),s,(0,l.bo)((0,l.Lk)("input",{type:"text",id:"street","onUpdate:modelValue":t[1]||(t[1]=e=>E.newEventPlace.street=e),placeholder:"Straße",required:""},null,512),[[a.Jo,E.newEventPlace.street]]),u,(0,l.bo)((0,l.Lk)("input",{type:"text",id:"zipcode","onUpdate:modelValue":t[2]||(t[2]=e=>E.newEventPlace.zipcode=e),placeholder:"PLZ",required:""},null,512),[[a.Jo,E.newEventPlace.zipcode]]),v,(0,l.bo)((0,l.Lk)("input",{type:"text",id:"city","onUpdate:modelValue":t[3]||(t[3]=e=>E.newEventPlace.city=e),placeholder:"Stadt",required:""},null,512),[[a.Jo,E.newEventPlace.city]]),p,(0,l.bo)((0,l.Lk)("input",{type:"color",id:"backgroundColor","onUpdate:modelValue":t[4]||(t[4]=e=>E.newEventPlace.backgroundColor=e)},null,512),[[a.Jo,E.newEventPlace.backgroundColor]]),k,E.editMode?((0,l.uX)(),(0,l.CE)("button",{key:0,type:"button",onClick:t[5]||(t[5]=(...e)=>m.resetForm&&m.resetForm(...e))},"Neuen Veranstaltungsort erstellen")):(0,l.Q3)("",!0)],32),(0,l.Lk)("table",null,[h,(0,l.Lk)("tbody",null,[((0,l.uX)(!0),(0,l.CE)(l.FK,null,(0,l.pI)(E.eventPlaces,(e=>((0,l.uX)(),(0,l.CE)("tr",{key:e.id},[(0,l.Lk)("td",null,(0,c.v_)(e.name),1),(0,l.Lk)("td",null,[(0,l.Lk)("button",{onClick:t=>m.editEventPlace(e)},"Bearbeiten",8,f)]),(0,l.Lk)("td",null,[(0,l.Lk)("button",{onClick:t=>m.deleteEventPlace(e.id)},"Löschen",8,P)])])))),128))])])])}n(4114);var m=n(4373),b={data(){return{eventPlaces:[],newEventPlace:{name:"",street:"",zipcode:"",city:"",backgroundColor:"#ffffff"},editMode:!1,editId:null}},methods:{async fetchEventPlaces(){const e=await m.A.get("/event-places");this.eventPlaces=e.data},async addEventPlace(){if(this.editMode)await m.A.put(`/event-places/${this.editId}`,this.newEventPlace);else{const e=await m.A.post("/event-places",this.newEventPlace);this.eventPlaces.push(e.data)}this.resetForm(),await this.fetchEventPlaces()},async updateEventPlace(e){await m.A.put(`/event-places/${e.id}`,e),this.fetchEventPlaces()},async deleteEventPlace(e){await m.A.delete(`/event-places/${e}`),this.fetchEventPlaces()},editEventPlace(e){this.newEventPlace={...e},this.editMode=!0,this.editId=e.id},resetForm(){this.newEventPlace={name:"",street:"",zipcode:"",city:"",backgroundColor:"#ffffff"},this.editMode=!1,this.editId=null}},created(){this.fetchEventPlaces()}},L=n(1241);const w=(0,L.A)(b,[["render",E],["__scopeId","data-v-920e5ffc"]]);var y=w}}]); //# sourceMappingURL=8074.dfd9f966.js.map