Files
harheimertc/.output/public/_nuxt/Cx_3U4cr.js

12 lines
13 KiB
JavaScript

import{e as B,k as K,r as p,g as T,h as I,c as l,a as e,j as i,p as $,d as h,s as G,u as n,t as d,b as u,F as b,i as D,l as E,m as y,v as m,o as a,n as O}from"#entry";import{u as J}from"./C_U-NUAd.js";import{U as Q}from"./oN0_bS6A.js";import{L as j}from"./CUq_0rkE.js";import{S as A}from"./6EY4_GXp.js";import{T as U}from"./FF_cyd6S.js";import{M as F}from"./BC4PNGtJ.js";import{P as R}from"./DdHhmCne.js";import{M as W,C as X}from"./C5SyyWEb.js";import{F as Y}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 ee=B("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 te=B("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"}]]),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"},fe=["href"],ve={key:1,class:"text-sm text-gray-400"},he={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"},Ce={class:"flex items-center space-x-2"},Ne={key:0,class:"px-2 py-1 bg-green-100 text-green-800 text-xs font-medium rounded-full"},ze={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"},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"},Ee={class:"flex justify-between items-start"},je={class:"flex-1"},Ae={class:"flex items-center mb-2"},Ue={class:"text-xl font-semibold text-gray-900"},Fe={key:0,class:"ml-3 px-2 py-1 bg-green-100 text-green-800 text-xs font-medium rounded-full"},Be={key:1,class:"ml-2 px-2 py-1 bg-blue-100 text-blue-800 text-xs font-medium rounded-full"},Pe={key:2,class:"ml-2 px-2 py-1 bg-purple-100 text-purple-800 text-xs font-medium rounded-full"},He={class:"grid sm:grid-cols-2 gap-3 text-gray-600"},qe={key:0,class:"flex items-center"},Ke=["href"],Ie={key:1,class:"flex items-center"},Ge=["href"],Oe={key:1,class:"col-span-2 flex items-center text-gray-500 text-sm italic"},Je={key:2,class:"flex items-start col-span-2"},Qe={key:3,class:"flex items-start col-span-2"},Re={key:4,class:"flex items-center col-span-2 text-sm text-gray-500"},We={key:0,class:"flex space-x-2 ml-4"},Xe=["onClick"],Ye=["onClick"],Ze={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"],Ct={__name:"mitglieder",setup(xt){const w=K(),M=p(!0),c=p(!1),g=p([]),_=p(!1),f=p(null),x=p(""),v=p("cards"),r=p({firstName:"",lastName:"",email:"",phone:"",address:"",notes:""}),k=T(()=>w.role==="admin"||w.role==="vorstand"),C=T(()=>{const o=w.role;return console.log("Current role:",o,"Can view contact:",o==="vorstand"),o==="vorstand"}),N=async()=>{M.value=!0;try{const o=await $fetch("/api/members");g.value=o.members}catch(o){console.error("Fehler beim Laden der Mitglieder:",o)}finally{M.value=!1}},P=()=>{f.value=null,r.value={firstName:"",lastName:"",email:"",phone:"",address:"",notes:""},_.value=!0,x.value=""},V=o=>{f.value=o,r.value={firstName:o.firstName||"",lastName:o.lastName||"",email:o.email||"",phone:o.phone||"",address:o.address||"",notes:o.notes||""},_.value=!0,x.value=""},z=()=>{_.value=!1,f.value=null,x.value=""},H=async()=>{c.value=!0,x.value="";try{await $fetch("/api/members",{method:"POST",body:{id:f.value?.id,...r.value}}),z(),await N()}catch(o){x.value=o.data?.message||"Fehler beim Speichern des Mitglieds."}finally{c.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 N()}catch{alert("Fehler beim Löschen des Mitglieds.")}},q=o=>o?new Date(o).toLocaleDateString("de-DE",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}):"";return I(()=>{N()}),J({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(),$(G(v.value==="cards"?n(te):n(ee)),{size:20,class:"mr-2"})),h(" "+d(v.value==="cards"?"Tabelle":"Karten"),1)]),k.value?(a(),l("button",{key:0,onClick:P,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(Q),{size:20,class:"mr-2"}),s[7]||(s[7]=h(" Mitglied hinzufügen ",-1))])):i("",!0)])]),M.value?(a(),l("div",ie,[u(n(j),{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)),k.value?(a(),l("th",ce,"Aktionen")):i("",!0)])]),e("tbody",pe,[(a(!0),l(b,null,D(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,[C.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,fe)):(a(),l("span",ve,"-"))],64)):(a(),l("span",he,"Nur für Vorstand"))]),e("td",be,[C.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",Ce,[t.hasLogin?(a(),l("span",Ne," 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)])]),k.value?(a(),l("td",ze,[t.editable?(a(),l("div",Le,[e("button",{onClick:L=>V(t),class:"text-blue-600 hover:text-blue-900",title:"Bearbeiten"},[u(n(A),{size:18})],8,Ve),e("button",{onClick:L=>S(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,D(g.value,t=>(a(),l("div",{key:t.id,class:"bg-white p-6 rounded-xl shadow-lg border border-gray-100"},[e("div",Ee,[e("div",je,[e("div",Ae,[e("h3",Ue,d(t.name),1),t.hasLogin?(a(),l("span",Fe," Hat Login ")):i("",!0),t.source==="manual"?(a(),l("span",Be," Manuell ")):(a(),l("span",Pe," Aus Login-System "))]),e("div",He,[C.value?(a(),l(b,{key:0},[t.email?(a(),l("div",qe,[u(n(F),{size:16,class:"mr-2 text-primary-600"}),e("a",{href:`mailto:${t.email}`,class:"hover:text-primary-600"},d(t.email),9,Ke)])):i("",!0),t.phone?(a(),l("div",Ie,[u(n(R),{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(F),{size:16,class:"mr-2"}),s[13]||(s[13]=h(" Kontaktdaten nur für Vorstand sichtbar ",-1))])),t.address?(a(),l("div",Je,[u(n(W),{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",Qe,[u(n(Y),{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",Re,[u(n(X),{size:16,class:"mr-2"}),h(" Letzter Login: "+d(q(t.lastLogin)),1)])):i("",!0)])]),k.value&&t.editable?(a(),l("div",We,[e("button",{onClick:L=>V(t),class:"p-2 text-blue-600 hover:bg-blue-50 rounded-lg transition-colors",title:"Bearbeiten"},[u(n(A),{size:20})],8,Xe),e("button",{onClick:L=>S(t),class:"p-2 text-red-600 hover:bg-red-50 rounded-lg transition-colors",title:"Löschen"},[u(n(U),{size:20})],8,Ye)])):i("",!0)])]))),128)),g.value.length===0?(a(),l("div",Ze," Keine Mitglieder gefunden. ")):i("",!0)])),_.value?(a(),l("div",{key:3,class:"fixed inset-0 z-50 bg-black/50 flex items-center justify-center p-4",onClick:E(z,["self"])},[e("div",et,[e("h2",tt,d(f.value?"Mitglied bearbeiten":"Mitglied hinzufügen"),1),e("form",{onSubmit:E(H,["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(Z),{size:20,class:"mr-2"}),h(" "+d(x.value),1)])):i("",!0),e("div",ut,[e("button",{type:"button",onClick:z,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(),$(n(j),{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{Ct as default};