Files
miriamgemeinde/public/js/187.80c77f03.js

2 lines
3.8 KiB
JavaScript

"use strict";(self["webpackChunkmiriamgemeinde"]=self["webpackChunkmiriamgemeinde"]||[]).push([[187],{8187:function(e,t,n){n.r(t),n.d(t,{default:function(){return k}});var l=n(641),a=n(3751),i=n(33);const c={class:"event-places-management"},d=["onClick"],o=["onClick"];function r(e,t,n,r,s,u){return(0,l.uX)(),(0,l.CE)("div",c,[t[16]||(t[16]=(0,l.Lk)("h2",null,"Veranstaltungsorte verwalten",-1)),(0,l.Lk)("form",{onSubmit:t[7]||(t[7]=(0,a.D$)((...e)=>u.addEventPlace&&u.addEventPlace(...e),["prevent"]))},[t[8]||(t[8]=(0,l.Lk)("label",{for:"name"},"Name:",-1)),(0,l.bo)((0,l.Lk)("input",{type:"text",id:"name","onUpdate:modelValue":t[0]||(t[0]=e=>s.newEventPlace.name=e),placeholder:"Name",required:""},null,512),[[a.Jo,s.newEventPlace.name]]),t[9]||(t[9]=(0,l.Lk)("label",{for:"street"},"Straße:",-1)),(0,l.bo)((0,l.Lk)("input",{type:"text",id:"street","onUpdate:modelValue":t[1]||(t[1]=e=>s.newEventPlace.street=e),placeholder:"Straße",required:""},null,512),[[a.Jo,s.newEventPlace.street]]),t[10]||(t[10]=(0,l.Lk)("label",{for:"zipcode"},"PLZ:",-1)),(0,l.bo)((0,l.Lk)("input",{type:"text",id:"zipcode","onUpdate:modelValue":t[2]||(t[2]=e=>s.newEventPlace.zipcode=e),placeholder:"PLZ",required:""},null,512),[[a.Jo,s.newEventPlace.zipcode]]),t[11]||(t[11]=(0,l.Lk)("label",{for:"city"},"Stadt:",-1)),(0,l.bo)((0,l.Lk)("input",{type:"text",id:"city","onUpdate:modelValue":t[3]||(t[3]=e=>s.newEventPlace.city=e),placeholder:"Stadt",required:""},null,512),[[a.Jo,s.newEventPlace.city]]),t[12]||(t[12]=(0,l.Lk)("label",{for:"city"},"Webseite:",-1)),(0,l.bo)((0,l.Lk)("input",{type:"text",id:"website","onUpdate:modelValue":t[4]||(t[4]=e=>s.newEventPlace.website=e),placeholder:"Webseite",required:""},null,512),[[a.Jo,s.newEventPlace.website]]),t[13]||(t[13]=(0,l.Lk)("label",{for:"backgroundColor"},"Hintergrundfarbe:",-1)),(0,l.bo)((0,l.Lk)("input",{type:"color",id:"backgroundColor","onUpdate:modelValue":t[5]||(t[5]=e=>s.newEventPlace.backgroundColor=e)},null,512),[[a.Jo,s.newEventPlace.backgroundColor]]),t[14]||(t[14]=(0,l.Lk)("button",{type:"submit"},"Speichern",-1)),s.editMode?((0,l.uX)(),(0,l.CE)("button",{key:0,type:"button",onClick:t[6]||(t[6]=(...e)=>u.resetForm&&u.resetForm(...e))},"Neuen Veranstaltungsort erstellen")):(0,l.Q3)("",!0)],32),(0,l.Lk)("table",null,[t[15]||(t[15]=(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)),(0,l.Lk)("tbody",null,[((0,l.uX)(!0),(0,l.CE)(l.FK,null,(0,l.pI)(s.eventPlaces,e=>((0,l.uX)(),(0,l.CE)("tr",{key:e.id},[(0,l.Lk)("td",null,(0,i.v_)(e.name),1),(0,l.Lk)("td",null,[(0,l.Lk)("button",{onClick:t=>u.editEventPlace(e)},"Bearbeiten",8,d)]),(0,l.Lk)("td",null,[(0,l.Lk)("button",{onClick:t=>u.deleteEventPlace(e.id)},"Löschen",8,o)])]))),128))])])])}n(4114);var s=n(4335),u={data(){return{eventPlaces:[],newEventPlace:{name:"",street:"",zipcode:"",city:"",backgroundColor:"#ffffff",website:""},editMode:!1,editId:null}},methods:{async fetchEventPlaces(){const e=await s.A.get("/event-places");this.eventPlaces=e.data},async addEventPlace(){if(this.editMode)await s.A.put(`/event-places/${this.editId}`,this.newEventPlace);else{const e=await s.A.post("/event-places",this.newEventPlace);this.eventPlaces.push(e.data)}this.resetForm(),await this.fetchEventPlaces()},async updateEventPlace(e){await s.A.put(`/event-places/${e.id}`,e),this.fetchEventPlaces()},async deleteEventPlace(e){await s.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",website:""},this.editMode=!1,this.editId=null}},created(){this.fetchEventPlaces()}},p=n(6262);const v=(0,p.A)(u,[["render",r],["__scopeId","data-v-4e6631f7"]]);var k=v}}]);
//# sourceMappingURL=187.80c77f03.js.map