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