17 lines
8.9 KiB
JavaScript
17 lines
8.9 KiB
JavaScript
import{e as M,j as P,r as m,f as $,g as A,c as o,a as e,h as n,b as u,d as k,u as d,F,i as U,k as z,t as c,l as x,v as f,m as H,o as a}from"#entry";import{u as N}from"./Qy3ajxTk.js";import{L as S}from"./CUq_0rkE.js";import{M as B,P as q}from"./SRZHqrjk.js";import{M as I,C as K}from"./C5SyyWEb.js";import{F as O}from"./BteKZQ9T.js";import{A as Z}from"./C8kQt0fa.js";/**
|
|
* @license lucide-vue-next v0.344.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const G=M("SquarePenIcon",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a2.121 2.121 0 1 1 3 3L12 15l-4 1 1-4Z",key:"1lpok0"}]]);/**
|
|
* @license lucide-vue-next v0.344.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const J=M("Trash2Icon",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/**
|
|
* @license lucide-vue-next v0.344.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const Q=M("UserPlusIcon",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]),R={class:"min-h-full py-16 bg-gray-50"},W={class:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8"},X={class:"flex justify-between items-center mb-6"},Y={key:0,class:"flex items-center justify-center py-12"},ee={key:1,class:"space-y-4"},te={class:"flex justify-between items-start"},se={class:"flex-1"},le={class:"flex items-center mb-2"},ae={class:"text-xl font-semibold text-gray-900"},oe={key:0,class:"ml-3 px-2 py-1 bg-green-100 text-green-800 text-xs font-medium rounded-full"},ie={key:1,class:"ml-2 px-2 py-1 bg-blue-100 text-blue-800 text-xs font-medium rounded-full"},ne={key:2,class:"ml-2 px-2 py-1 bg-purple-100 text-purple-800 text-xs font-medium rounded-full"},re={class:"grid sm:grid-cols-2 gap-3 text-gray-600"},de={key:0,class:"flex items-center"},ue=["href"],ce={key:1,class:"flex items-center"},pe=["href"],me={key:2,class:"flex items-start col-span-2"},ye={key:3,class:"flex items-start col-span-2"},xe={key:4,class:"flex items-center col-span-2 text-sm text-gray-500"},fe={key:0,class:"flex space-x-2 ml-4"},ve=["onClick"],ge=["onClick"],he={key:0,class:"text-center py-12 text-gray-500"},be={class:"bg-white rounded-xl shadow-2xl max-w-2xl w-full p-8"},_e={class:"text-2xl font-display font-bold text-gray-900 mb-6"},ke=["disabled"],Me=["disabled"],we=["disabled"],Le=["disabled"],ze=["disabled"],Se={key:0,class:"flex items-center p-3 rounded-md bg-red-50 text-red-700 text-sm"},Ce={class:"flex justify-end space-x-4 pt-4"},Ve=["disabled"],De=["disabled"],He={__name:"mitglieder",setup(Te){const w=P(),g=m(!0),r=m(!1),h=m([]),v=m(!1),y=m(null),p=m(""),i=m({name:"",email:"",phone:"",address:"",notes:""}),L=$(()=>w.role==="admin"||w.role==="vorstand"),b=async()=>{g.value=!0;try{const l=await $fetch("/api/members");h.value=l.members}catch(l){console.error("Fehler beim Laden der Mitglieder:",l)}finally{g.value=!1}},C=()=>{y.value=null,i.value={name:"",email:"",phone:"",address:"",notes:""},v.value=!0,p.value=""},V=l=>{y.value=l,i.value={name:l.name,email:l.email||"",phone:l.phone||"",address:l.address||"",notes:l.notes||""},v.value=!0,p.value=""},_=()=>{v.value=!1,y.value=null,p.value=""},D=async()=>{r.value=!0,p.value="";try{await $fetch("/api/members",{method:"POST",body:{id:y.value?.id,...i.value}}),_(),await b()}catch(l){p.value=l.data?.message||"Fehler beim Speichern des Mitglieds."}finally{r.value=!1}},T=async l=>{if(confirm(`Möchten Sie "${l.name}" wirklich löschen?`))try{await $fetch("/api/members",{method:"DELETE",body:{id:l.id}}),await b()}catch{alert("Fehler beim Löschen des Mitglieds.")}},j=l=>l?new Date(l).toLocaleDateString("de-DE",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}):"";return A(()=>{b()}),N({title:"Mitgliederliste - Harheimer TC"}),(l,s)=>(a(),o("div",R,[e("div",W,[e("div",X,[s[6]||(s[6]=e("div",null,[e("h1",{class:"text-4xl sm:text-5xl font-display font-bold text-gray-900 mb-2"}," Mitgliederliste "),e("div",{class:"w-24 h-1 bg-primary-600 mb-4"})],-1)),L.value?(a(),o("button",{key:0,onClick:C,class:"flex items-center px-4 py-2 bg-primary-600 hover:bg-primary-700 text-white font-semibold rounded-lg transition-colors"},[u(d(Q),{size:20,class:"mr-2"}),s[5]||(s[5]=k(" Mitglied hinzufügen ",-1))])):n("",!0)]),g.value?(a(),o("div",Y,[u(d(S),{size:40,class:"animate-spin text-primary-600"})])):(a(),o("div",ee,[(a(!0),o(F,null,U(h.value,t=>(a(),o("div",{key:t.id,class:"bg-white p-6 rounded-xl shadow-lg border border-gray-100"},[e("div",te,[e("div",se,[e("div",le,[e("h3",ae,c(t.name),1),t.hasLogin?(a(),o("span",oe," Hat Login ")):n("",!0),t.source==="manual"?(a(),o("span",ie," Manuell ")):(a(),o("span",ne," Aus Login-System "))]),e("div",re,[t.email?(a(),o("div",de,[u(d(B),{size:16,class:"mr-2 text-primary-600"}),e("a",{href:`mailto:${t.email}`,class:"hover:text-primary-600"},c(t.email),9,ue)])):n("",!0),t.phone?(a(),o("div",ce,[u(d(q),{size:16,class:"mr-2 text-primary-600"}),e("a",{href:`tel:${t.phone}`,class:"hover:text-primary-600"},c(t.phone),9,pe)])):n("",!0),t.address?(a(),o("div",me,[u(d(I),{size:16,class:"mr-2 text-primary-600 mt-0.5"}),e("span",null,c(t.address),1)])):n("",!0),t.notes?(a(),o("div",ye,[u(d(O),{size:16,class:"mr-2 text-primary-600 mt-0.5"}),e("span",null,c(t.notes),1)])):n("",!0),t.lastLogin?(a(),o("div",xe,[u(d(K),{size:16,class:"mr-2"}),k(" Letzter Login: "+c(j(t.lastLogin)),1)])):n("",!0)])]),L.value&&t.editable?(a(),o("div",fe,[e("button",{onClick:E=>V(t),class:"p-2 text-blue-600 hover:bg-blue-50 rounded-lg transition-colors",title:"Bearbeiten"},[u(d(G),{size:20})],8,ve),e("button",{onClick:E=>T(t),class:"p-2 text-red-600 hover:bg-red-50 rounded-lg transition-colors",title:"Löschen"},[u(d(J),{size:20})],8,ge)])):n("",!0)])]))),128)),h.value.length===0?(a(),o("div",he," Keine Mitglieder gefunden. ")):n("",!0)])),v.value?(a(),o("div",{key:2,class:"fixed inset-0 z-50 bg-black/50 flex items-center justify-center p-4",onClick:z(_,["self"])},[e("div",be,[e("h2",_e,c(y.value?"Mitglied bearbeiten":"Mitglied hinzufügen"),1),e("form",{onSubmit:z(D,["prevent"]),class:"space-y-4"},[e("div",null,[s[7]||(s[7]=e("label",{class:"block text-sm font-medium text-gray-700 mb-2"},"Name *",-1)),x(e("input",{"onUpdate:modelValue":s[0]||(s[0]=t=>i.value.name=t),type:"text",required:"",class:"w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500",disabled:r.value},null,8,ke),[[f,i.value.name]])]),e("div",null,[s[8]||(s[8]=e("label",{class:"block text-sm font-medium text-gray-700 mb-2"},"E-Mail",-1)),x(e("input",{"onUpdate:modelValue":s[1]||(s[1]=t=>i.value.email=t),type:"email",class:"w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500",disabled:r.value},null,8,Me),[[f,i.value.email]])]),e("div",null,[s[9]||(s[9]=e("label",{class:"block text-sm font-medium text-gray-700 mb-2"},"Telefon",-1)),x(e("input",{"onUpdate:modelValue":s[2]||(s[2]=t=>i.value.phone=t),type:"tel",class:"w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500",disabled:r.value},null,8,we),[[f,i.value.phone]])]),e("div",null,[s[10]||(s[10]=e("label",{class:"block text-sm font-medium text-gray-700 mb-2"},"Adresse",-1)),x(e("input",{"onUpdate:modelValue":s[3]||(s[3]=t=>i.value.address=t),type:"text",class:"w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500",disabled:r.value},null,8,Le),[[f,i.value.address]])]),e("div",null,[s[11]||(s[11]=e("label",{class:"block text-sm font-medium text-gray-700 mb-2"},"Notizen",-1)),x(e("textarea",{"onUpdate:modelValue":s[4]||(s[4]=t=>i.value.notes=t),rows:"3",class:"w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500",disabled:r.value},null,8,ze),[[f,i.value.notes]])]),p.value?(a(),o("div",Se,[u(d(Z),{size:20,class:"mr-2"}),k(" "+c(p.value),1)])):n("",!0),e("div",Ce,[e("button",{type:"button",onClick:_,class:"px-6 py-2 border border-gray-300 text-gray-700 rounded-lg hover:bg-gray-50 transition-colors",disabled:r.value}," Abbrechen ",8,Ve),e("button",{type:"submit",class:"px-6 py-2 bg-primary-600 hover:bg-primary-700 text-white font-semibold rounded-lg transition-colors flex items-center",disabled:r.value},[r.value?(a(),H(d(S),{key:0,size:20,class:"animate-spin mr-2"})):n("",!0),e("span",null,c(r.value?"Speichert...":"Speichern"),1)],8,De)])],32)])])):n("",!0)])]))}};export{He as default};
|