27 lines
14 KiB
JavaScript
27 lines
14 KiB
JavaScript
import{e as _,j as I,r as p,f as $,g as K,c as l,a as e,h as i,m as D,d as f,s as G,u as n,t as d,b as u,F as b,i as j,k as E,l as y,v as m,o as a,n as O}from"#entry";import{u as Z}from"./Qy3ajxTk.js";import{L as A}from"./CUq_0rkE.js";import{M as H,P as J}from"./SRZHqrjk.js";import{M as Q,C as R}from"./C5SyyWEb.js";import{F as W}from"./BteKZQ9T.js";import{A as X}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 Y=_("Grid3x3Icon",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/**
|
|
* @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 P=_("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 ee=_("Table2Icon",[["path",{d:"M9 3H5a2 2 0 0 0-2 2v4m6-6h10a2 2 0 0 1 2 2v4M9 3v18m0 0h10a2 2 0 0 0 2-2V9M9 21H5a2 2 0 0 1-2-2V9m0 0h18",key:"gugj83"}]]);/**
|
|
* @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 U=_("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 te=_("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"}]]),se={class:"min-h-full py-16 bg-gray-50"},ae={class:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8"},le={class:"flex justify-between items-center mb-6"},oe={class:"flex items-center space-x-3"},ie={key:0,class:"flex items-center justify-center py-12"},ne={key:1,class:"bg-white rounded-xl shadow-lg overflow-hidden"},re={class:"overflow-x-auto"},de={class:"min-w-full divide-y divide-gray-200"},ue={class:"bg-gray-50"},ce={key:0,class:"px-4 py-3 text-right text-xs font-medium text-gray-500 uppercase tracking-wider"},pe={class:"bg-white divide-y divide-gray-200"},xe={class:"px-4 py-3 whitespace-nowrap"},ye={class:"text-sm font-medium text-gray-900"},me={key:0,class:"text-xs text-gray-500"},ge={class:"px-4 py-3 whitespace-nowrap"},he=["href"],ve={key:1,class:"text-sm text-gray-400"},fe={key:1,class:"text-sm text-gray-400"},be={class:"px-4 py-3 whitespace-nowrap"},_e=["href"],ke={key:1,class:"text-sm text-gray-400"},we={key:1,class:"text-sm text-gray-400"},Me={class:"px-4 py-3 whitespace-nowrap"},Ne={class:"flex items-center space-x-2"},ze={key:0,class:"px-2 py-1 bg-green-100 text-green-800 text-xs font-medium rounded-full"},Le={key:0,class:"px-4 py-3 whitespace-nowrap text-right text-sm font-medium"},Ce={key:0,class:"flex justify-end space-x-2"},Ve=["onClick"],Se=["onClick"],Te={key:1,class:"text-gray-400 text-xs"},$e={key:0,class:"text-center py-12 text-gray-500"},De={key:2,class:"space-y-4"},je={class:"flex justify-between items-start"},Ee={class:"flex-1"},Ae={class:"flex items-center mb-2"},He={class:"text-xl font-semibold text-gray-900"},Pe={key:0,class:"ml-3 px-2 py-1 bg-green-100 text-green-800 text-xs font-medium rounded-full"},Ue={key:1,class:"ml-2 px-2 py-1 bg-blue-100 text-blue-800 text-xs font-medium rounded-full"},Fe={key:2,class:"ml-2 px-2 py-1 bg-purple-100 text-purple-800 text-xs font-medium rounded-full"},qe={class:"grid sm:grid-cols-2 gap-3 text-gray-600"},Be={key:0,class:"flex items-center"},Ie=["href"],Ke={key:1,class:"flex items-center"},Ge=["href"],Oe={key:1,class:"col-span-2 flex items-center text-gray-500 text-sm italic"},Ze={key:2,class:"flex items-start col-span-2"},Je={key:3,class:"flex items-start col-span-2"},Qe={key:4,class:"flex items-center col-span-2 text-sm text-gray-500"},Re={key:0,class:"flex space-x-2 ml-4"},We=["onClick"],Xe=["onClick"],Ye={key:0,class:"text-center py-12 text-gray-500"},et={class:"bg-white rounded-xl shadow-2xl max-w-2xl w-full p-8"},tt={class:"text-2xl font-display font-bold text-gray-900 mb-6"},st={class:"grid grid-cols-2 gap-4"},at=["disabled"],lt=["disabled"],ot=["disabled"],it=["disabled"],nt=["disabled"],rt=["disabled"],dt={key:0,class:"flex items-center p-3 rounded-md bg-red-50 text-red-700 text-sm"},ut={class:"flex justify-end space-x-4 pt-4"},ct=["disabled"],pt=["disabled"],_t={__name:"mitglieder",setup(xt){const M=I(),N=p(!0),c=p(!1),g=p([]),k=p(!1),h=p(null),x=p(""),v=p("cards"),r=p({firstName:"",lastName:"",email:"",phone:"",address:"",notes:""}),w=$(()=>M.role==="admin"||M.role==="vorstand"),z=$(()=>M.role==="vorstand"),L=async()=>{N.value=!0;try{const o=await $fetch("/api/members");g.value=o.members}catch(o){console.error("Fehler beim Laden der Mitglieder:",o)}finally{N.value=!1}},F=()=>{h.value=null,r.value={firstName:"",lastName:"",email:"",phone:"",address:"",notes:""},k.value=!0,x.value=""},S=o=>{h.value=o,r.value={firstName:o.firstName||"",lastName:o.lastName||"",email:o.email||"",phone:o.phone||"",address:o.address||"",notes:o.notes||""},k.value=!0,x.value=""},C=()=>{k.value=!1,h.value=null,x.value=""},q=async()=>{c.value=!0,x.value="";try{await $fetch("/api/members",{method:"POST",body:{id:h.value?.id,...r.value}}),C(),await L()}catch(o){x.value=o.data?.message||"Fehler beim Speichern des Mitglieds."}finally{c.value=!1}},T=async o=>{if(confirm(`Möchten Sie "${o.name}" wirklich löschen?`))try{await $fetch("/api/members",{method:"DELETE",body:{id:o.id}}),await L()}catch{alert("Fehler beim Löschen des Mitglieds.")}},B=o=>o?new Date(o).toLocaleDateString("de-DE",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}):"";return K(()=>{L()}),Z({title:"Mitgliederliste - Harheimer TC"}),(o,s)=>(a(),l("div",se,[e("div",ae,[e("div",le,[s[8]||(s[8]=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)),e("div",oe,[e("button",{onClick:s[0]||(s[0]=t=>v.value=v.value==="cards"?"table":"cards"),class:"flex items-center px-4 py-2 bg-gray-100 hover:bg-gray-200 text-gray-700 font-semibold rounded-lg transition-colors"},[(a(),D(G(v.value==="cards"?n(ee):n(Y)),{size:20,class:"mr-2"})),f(" "+d(v.value==="cards"?"Tabelle":"Karten"),1)]),w.value?(a(),l("button",{key:0,onClick:F,class:"flex items-center px-4 py-2 bg-primary-600 hover:bg-primary-700 text-white font-semibold rounded-lg transition-colors"},[u(n(te),{size:20,class:"mr-2"}),s[7]||(s[7]=f(" Mitglied hinzufügen ",-1))])):i("",!0)])]),N.value?(a(),l("div",ie,[u(n(A),{size:40,class:"animate-spin text-primary-600"})])):v.value==="table"?(a(),l("div",ne,[e("div",re,[e("table",de,[e("thead",ue,[e("tr",null,[s[9]||(s[9]=e("th",{class:"px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider"},"Name",-1)),s[10]||(s[10]=e("th",{class:"px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider"},"E-Mail",-1)),s[11]||(s[11]=e("th",{class:"px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider"},"Telefon",-1)),s[12]||(s[12]=e("th",{class:"px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider"},"Status",-1)),w.value?(a(),l("th",ce,"Aktionen")):i("",!0)])]),e("tbody",pe,[(a(!0),l(b,null,j(g.value,t=>(a(),l("tr",{key:t.id,class:"hover:bg-gray-50"},[e("td",xe,[e("div",ye,d(t.name),1),t.notes?(a(),l("div",me,d(t.notes),1)):i("",!0)]),e("td",ge,[z.value?(a(),l(b,{key:0},[t.email?(a(),l("a",{key:0,href:`mailto:${t.email}`,class:"text-sm text-primary-600 hover:text-primary-800"},d(t.email),9,he)):(a(),l("span",ve,"-"))],64)):(a(),l("span",fe,"Nur für Vorstand"))]),e("td",be,[z.value?(a(),l(b,{key:0},[t.phone?(a(),l("a",{key:0,href:`tel:${t.phone}`,class:"text-sm text-primary-600 hover:text-primary-800"},d(t.phone),9,_e)):(a(),l("span",ke,"-"))],64)):(a(),l("span",we,"Nur für Vorstand"))]),e("td",Me,[e("div",Ne,[t.hasLogin?(a(),l("span",ze," Login ")):i("",!0),e("span",{class:O([t.source==="manual"?"bg-blue-100 text-blue-800":"bg-purple-100 text-purple-800","px-2 py-1 text-xs font-medium rounded-full"])},d(t.source==="manual"?"Manuell":"System"),3)])]),w.value?(a(),l("td",Le,[t.editable?(a(),l("div",Ce,[e("button",{onClick:V=>S(t),class:"text-blue-600 hover:text-blue-900",title:"Bearbeiten"},[u(n(P),{size:18})],8,Ve),e("button",{onClick:V=>T(t),class:"text-red-600 hover:text-red-900",title:"Löschen"},[u(n(U),{size:18})],8,Se)])):(a(),l("span",Te,"Nicht editierbar"))])):i("",!0)]))),128))])])]),g.value.length===0?(a(),l("div",$e," Keine Mitglieder gefunden. ")):i("",!0)])):(a(),l("div",De,[(a(!0),l(b,null,j(g.value,t=>(a(),l("div",{key:t.id,class:"bg-white p-6 rounded-xl shadow-lg border border-gray-100"},[e("div",je,[e("div",Ee,[e("div",Ae,[e("h3",He,d(t.name),1),t.hasLogin?(a(),l("span",Pe," Hat Login ")):i("",!0),t.source==="manual"?(a(),l("span",Ue," Manuell ")):(a(),l("span",Fe," Aus Login-System "))]),e("div",qe,[z.value?(a(),l(b,{key:0},[t.email?(a(),l("div",Be,[u(n(H),{size:16,class:"mr-2 text-primary-600"}),e("a",{href:`mailto:${t.email}`,class:"hover:text-primary-600"},d(t.email),9,Ie)])):i("",!0),t.phone?(a(),l("div",Ke,[u(n(J),{size:16,class:"mr-2 text-primary-600"}),e("a",{href:`tel:${t.phone}`,class:"hover:text-primary-600"},d(t.phone),9,Ge)])):i("",!0)],64)):(a(),l("div",Oe,[u(n(H),{size:16,class:"mr-2"}),s[13]||(s[13]=f(" Kontaktdaten nur für Vorstand sichtbar ",-1))])),t.address?(a(),l("div",Ze,[u(n(Q),{size:16,class:"mr-2 text-primary-600 mt-0.5"}),e("span",null,d(t.address),1)])):i("",!0),t.notes?(a(),l("div",Je,[u(n(W),{size:16,class:"mr-2 text-primary-600 mt-0.5"}),e("span",null,d(t.notes),1)])):i("",!0),t.lastLogin?(a(),l("div",Qe,[u(n(R),{size:16,class:"mr-2"}),f(" Letzter Login: "+d(B(t.lastLogin)),1)])):i("",!0)])]),w.value&&t.editable?(a(),l("div",Re,[e("button",{onClick:V=>S(t),class:"p-2 text-blue-600 hover:bg-blue-50 rounded-lg transition-colors",title:"Bearbeiten"},[u(n(P),{size:20})],8,We),e("button",{onClick:V=>T(t),class:"p-2 text-red-600 hover:bg-red-50 rounded-lg transition-colors",title:"Löschen"},[u(n(U),{size:20})],8,Xe)])):i("",!0)])]))),128)),g.value.length===0?(a(),l("div",Ye," Keine Mitglieder gefunden. ")):i("",!0)])),k.value?(a(),l("div",{key:3,class:"fixed inset-0 z-50 bg-black/50 flex items-center justify-center p-4",onClick:E(C,["self"])},[e("div",et,[e("h2",tt,d(h.value?"Mitglied bearbeiten":"Mitglied hinzufügen"),1),e("form",{onSubmit:E(q,["prevent"]),class:"space-y-4"},[e("div",st,[e("div",null,[s[14]||(s[14]=e("label",{class:"block text-sm font-medium text-gray-700 mb-2"},"Vorname *",-1)),y(e("input",{"onUpdate:modelValue":s[1]||(s[1]=t=>r.value.firstName=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:c.value},null,8,at),[[m,r.value.firstName]])]),e("div",null,[s[15]||(s[15]=e("label",{class:"block text-sm font-medium text-gray-700 mb-2"},"Nachname *",-1)),y(e("input",{"onUpdate:modelValue":s[2]||(s[2]=t=>r.value.lastName=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:c.value},null,8,lt),[[m,r.value.lastName]])])]),e("div",null,[s[16]||(s[16]=e("label",{class:"block text-sm font-medium text-gray-700 mb-2"},"E-Mail",-1)),y(e("input",{"onUpdate:modelValue":s[3]||(s[3]=t=>r.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:c.value},null,8,ot),[[m,r.value.email]])]),e("div",null,[s[17]||(s[17]=e("label",{class:"block text-sm font-medium text-gray-700 mb-2"},"Telefon",-1)),y(e("input",{"onUpdate:modelValue":s[4]||(s[4]=t=>r.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:c.value},null,8,it),[[m,r.value.phone]])]),e("div",null,[s[18]||(s[18]=e("label",{class:"block text-sm font-medium text-gray-700 mb-2"},"Adresse",-1)),y(e("input",{"onUpdate:modelValue":s[5]||(s[5]=t=>r.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:c.value},null,8,nt),[[m,r.value.address]])]),e("div",null,[s[19]||(s[19]=e("label",{class:"block text-sm font-medium text-gray-700 mb-2"},"Notizen",-1)),y(e("textarea",{"onUpdate:modelValue":s[6]||(s[6]=t=>r.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:c.value},null,8,rt),[[m,r.value.notes]])]),x.value?(a(),l("div",dt,[u(n(X),{size:20,class:"mr-2"}),f(" "+d(x.value),1)])):i("",!0),e("div",ut,[e("button",{type:"button",onClick:C,class:"px-6 py-2 border border-gray-300 text-gray-700 rounded-lg hover:bg-gray-50 transition-colors",disabled:c.value}," Abbrechen ",8,ct),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:c.value},[c.value?(a(),D(n(A),{key:0,size:20,class:"animate-spin mr-2"})):i("",!0),e("span",null,d(c.value?"Speichert...":"Speichern"),1)],8,pt)])],32)])])):i("",!0)])]))}};export{_t as default};
|