1import{a as y,j as e}from"./trpc-vendor-Bta84Nsh.js";import{t as o,v as ne,C as D,e as $,f as A,h as B,B as w,I as q,T as J,w as de,g as le}from"./index-_3-B0itT.js";import{aq as ie,C as ce,g as Q,aw as oe,l as z,n as W,m as X,F as Z,t as v,aj as T,U as me,cx as xe,a4 as ue,h as ge,a9 as he,M as be,G as pe,aA as je,aY as fe,cy as Ne,a_ as ve,ah as ye,X as ee,a8 as we,b0 as ke}from"./ui-vendor-NEZNvIbV.js";import{u as P}from"./react-vendor-DpXpH6G7.js";function Ce({brandId:n}){const m=o.useUtils(),{data:s,isLoading:t}=o.magicline.brandMonthlyStats.useQuery({brandId:n},{staleTime:5*6e4,refetchInterval:5*6e4}),a=o.magicline.syncMonthlyContracts.useMutation({onSuccess:p=>{v.success(`Magicline-Sync fertig: ${p.contractCount} Vertraege im aktuellen Monat`),m.magicline.brandMonthlyStats.invalidate({brandId:n})},onError:p=>v.error(`Sync-Fehler: ${p.message}`)});if(t)return e.jsxs("div",{className:"rounded-xl border border-border bg-card p-5 text-sm text-muted-foreground flex items-center gap-2",children:[e.jsx(T,{className:"w-4 h-4 animate-spin"})," Lade Magicline-Monatsstatsâ¦"]});if(!s||s.activeMembers==null)return null;const r=s.netGrowth??0,d=r>0?"text-emerald-400":r<0?"text-red-400":"text-muted-foreground",l=r>0?e.jsx(X,{className:"w-5 h-5"}):r<0?e.jsx(ke,{className:"w-5 h-5"}):null,x=s.magiclineContractsThisMonth,b=s.magiclineLastFetchedAt,u=s.crmOnlineContracts,h=b?Math.round((Date.now()-b)/6e4):null,N=h==null?null:h<60?`vor ${h} Min.`:h<1440?`vor ${Math.round(h/60)} Std.`:`vor ${Math.round(h/1440)} Tagen`;return e.jsxs("div",{className:"rounded-xl border border-border bg-card p-5",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4 flex-wrap gap-2",children:[e.jsxs("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:["Magicline-Bestand â ",s.monthLabel]}),e.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-muted-foreground",children:[x!=null?e.jsxs("span",{children:["Magicline-Daten ",N]}):e.jsxs("span",{className:"text-yellow-400",children:["â Nur CRM-Online-Vertraege (",u,") â kein Magicline-Sync"]}),e.jsx("button",{type:"button",disabled:a.isPending,onClick:()=>a.mutate({brandId:n}),className:"text-xs px-2 py-1 rounded border border-blue-500/40 bg-blue-500/10 text-blue-300 hover:bg-blue-500/20 disabled:opacity-60",title:"Holt aktuelle Verträge dieses Monats live aus Magicline (kann 1-3 Min dauern bei vielen Mitgliedern)",children:a.isPending?e.jsxs(e.Fragment,{children:[e.jsx(T,{className:"w-3 h-3 inline mr-1 animate-spin"})," Synchronisiereâ¦"]}):"ð Magicline-Sync"})]})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[e.jsxs("div",{className:"rounded-xl border border-emerald-500/20 bg-emerald-500/10 p-5 text-center",children:[e.jsx(me,{className:"w-6 h-6 text-emerald-400 mx-auto mb-2"}),e.jsx("div",{className:"text-4xl font-black text-emerald-400",children:s.newContracts}),e.jsxs("div",{className:"text-xs text-muted-foreground mt-1.5 font-medium",children:["Verträge gewonnen",x!=null&&u!==x&&e.jsxs("div",{className:"text-[10px] text-emerald-300/70 mt-0.5",children:["davon ",u," online · ",x-u," walk-in"]})]})]}),e.jsxs("div",{className:"rounded-xl border border-red-500/20 bg-red-500/10 p-5 text-center",children:[e.jsx(xe,{className:"w-6 h-6 text-red-400 mx-auto mb-2"}),e.jsx("div",{className:"text-4xl font-black text-red-400",children:s.cancellations}),e.jsx("div",{className:"text-xs text-muted-foreground mt-1.5 font-medium",children:"Abgänge"})]}),e.jsxs("div",{className:`rounded-xl border p-5 text-center ${r>0?"border-emerald-500/20 bg-emerald-500/10":r<0?"border-red-500/20 bg-red-500/10":"border-border bg-muted/30"}`,children:[l&&e.jsx("div",{className:`mx-auto mb-2 ${d}`,children:l}),e.jsxs("div",{className:`text-4xl font-black ${d}`,children:[r>0?"+":"",r]}),e.jsx("div",{className:"text-xs text-muted-foreground mt-1.5 font-medium",children:"Netto-Wachstum"})]}),e.jsxs("div",{className:"rounded-xl border border-blue-500/20 bg-blue-500/10 p-5 text-center",children:[e.jsx(z,{className:"w-6 h-6 text-blue-400 mx-auto mb-2"}),e.jsx("div",{className:"text-4xl font-black text-blue-400",children:s.activeMembers}),e.jsx("div",{className:"text-xs text-muted-foreground mt-1.5 font-medium",children:"Aktive Mitglieder"})]})]})]})}function Se({brandId:n,userId:m}){const s=new Date().toISOString().slice(0,10),t=o.useUtils(),{data:a,isLoading:r}=o.contractReports.get.useQuery({brandId:n,reportDate:s}),d=o.contractReports.upsert.useMutation({onSuccess:()=>{v.success("Tagesbericht gespeichert"),t.contractReports.get.invalidate(),t.contractReports.list.invali
1date(),b(!1)},onError:i=>v.error(i.message)}),{data:l}=o.contractReports.list.useQuery({brandId:n,limit:14}),[x,b]=y.useState(!1),[u,h]=y.useState(""),[N,p]=y.useState(""),f=()=>{h(a?.contractCount!==void 0?String(a.contractCount):""),p(a?.notes??""),b(!0)},c=()=>{const i=parseInt(u);if(isNaN(i)||i<0){v.error("Bitte eine gültige Anzahl eingeben");return}d.mutate({brandId:n,reportDate:s,contractCount:i,notes:N||void 0})},U=new Date().toLocaleDateString("de-DE",{weekday:"long",day:"2-digit",month:"long"});return e.jsxs(D,{className:"bg-card border-border",children:[e.jsx($,{className:"pb-2",children:e.jsxs(A,{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(Ne,{className:"h-4 w-4 text-primary"}),"Tagesbericht â ",U]})}),e.jsxs(B,{className:"space-y-4 pb-4",children:[r?e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(T,{className:"w-4 h-4 animate-spin"})," Lädt..."]}):!x&&a?e.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg bg-green-500/10 border border-green-500/20",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Q,{className:"w-4 h-4 text-green-400"}),e.jsxs("span",{className:"text-sm font-semibold text-foreground",children:[a.contractCount," Verträge gemeldet"]})]}),a.notes&&e.jsx("p",{className:"text-xs text-muted-foreground mt-1 ml-6",children:a.notes})]}),e.jsxs(w,{variant:"outline",size:"sm",onClick:f,children:[e.jsx(ve,{className:"w-3.5 h-3.5 mr-1"}),"Bearbeiten"]})]}):x?null:e.jsxs("div",{className:"text-center py-4",children:[e.jsx("p",{className:"text-sm text-muted-foreground mb-3",children:"Noch kein Bericht für heute. Wie viele Verträge wurden heute im Studio abgeschlossen?"}),e.jsxs(w,{onClick:f,className:"bg-primary text-white",children:[e.jsx(Z,{className:"w-4 h-4 mr-2"}),"Tagesbericht eintragen"]})]}),x&&e.jsxs("div",{className:"space-y-3 p-3 rounded-lg border border-border bg-muted/20",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Anzahl Verträge heute *"}),e.jsx(q,{type:"number",min:"0",value:u,onChange:i=>h(i.target.value),placeholder:"z.B. 3",className:"mt-1",autoFocus:!0})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Anmerkungen (optional)"}),e.jsx(J,{value:N,onChange:i=>p(i.target.value),placeholder:"z.B. 2 Jahresverträge, 1 Halbjahresvertrag...",rows:2,className:"mt-1 text-sm"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(w,{onClick:c,disabled:d.isPending,size:"sm",className:"bg-primary text-white",children:[d.isPending?e.jsx(T,{className:"w-3.5 h-3.5 animate-spin mr-1"}):e.jsx(ye,{className:"w-3.5 h-3.5 mr-1"}),"Speichern"]}),e.jsxs(w,{variant:"outline",size:"sm",onClick:()=>b(!1),children:[e.jsx(ee,{className:"w-3.5 h-3.5 mr-1"}),"Abbrechen"]})]})]}),(l??[]).length>1&&e.jsxs("div",{className:"border-t border-border pt-3",children:[e.jsx("p",{className:"text-xs font-medium text-muted-foreground mb-2",children:"Letzte Einträge"}),e.jsx("div",{className:"space-y-1",children:(l??[]).slice(0,7).map(i=>e.jsxs("div",{className:"flex items-center justify-between text-xs py-1",children:[e.jsx("span",{className:"text-muted-foreground",children:new Date(i.reportDate+"T00:00:00").toLocaleDateString("de-DE",{weekday:"short",day:"2-digit",month:"short"})}),e.jsxs("span",{className:"font-semibold text-foreground",children:[i.contractCount," Verträge"]})]},i.id))})]})]})]})}function Me({brandId:n,userName:m}){const s=o.useUtils(),{data:t}=o.tasks.list.useQuery({brandId:n,limit:5,status:"open"}),[,a]=P(),[r,d]=y.useState(!1),[l,x]=y.useState(""),[b,u]=y.useState(""),[h,N]=y.useState("normal"),p=o.tasks.createPublic.useMutation({onSuccess:()=>{v.success("Ticket eingereicht! Wir kümmern uns darum."),s.tasks.list.invalidate(),d(!1),x(""),u(""),N("normal")},onError:c=>v.error(c.message)}),f=()=>{if(!l.trim()){v.error("Bitte einen Betreff eingeben");return}p.mutate({brandId:n,title:l.trim(),description:b||void 0,priority:h,submittedBy:m})};return e.jsxs(D,{className:"bg-card border-border",children:[e.jsx($,{className:"pb-2",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(A,{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(we,{className:"h-4 w-4 text-primary"}),"Offene Tickets"]}),e.jsx(w,{size:"sm",className:"h-7 text-xs",onClick:()=>d(!r),children:r?e.jsx(ee,{className:"w-3.5 h-3.5"}):e.jsxs(e.Fragment,{children:[" ",e.jsx("span",{className:"mr-1",children:"+"}),"Ticket"]})})]})}),e.jsxs(B,{className:"pb-4 space-y-3",children:[r&&e.jsxs("div",{className:"rounded-lg border border-border bg-muted/20 p-3 space-y-2",children:[e.jsx(q,{value:l,onCh
1ange:c=>x(c.target.value),placeholder:"Betreff / Kurzbeschreibung *",className:"text-sm"}),e.jsx(J,{value:b,onChange:c=>u(c.target.value),placeholder:"Beschreibung (optional)",rows:2,className:"text-sm resize-none"}),e.jsxs("div",{className:"flex gap-2 items-center",children:[e.jsxs("select",{value:h,onChange:c=>N(c.target.value),className:"flex-1 h-8 rounded-md border border-input bg-background px-2 text-sm",children:[e.jsx("option",{value:"normal",children:"Normal"}),e.jsx("option",{value:"high",children:"Hoch"}),e.jsx("option",{value:"urgent",children:"Dringend"})]}),e.jsx(w,{size:"sm",className:"h-8",onClick:f,disabled:p.isPending,children:p.isPending?e.jsx(T,{className:"w-3.5 h-3.5 animate-spin"}):"Senden"})]})]}),(t??[]).length===0?e.jsxs("div",{className:"text-center py-4 text-sm text-muted-foreground",children:[e.jsx(Q,{className:"w-7 h-7 mx-auto mb-2 text-green-400 opacity-50"}),"Keine offenen Tickets"]}):e.jsx("div",{className:"space-y-2",children:(t??[]).slice(0,5).map(c=>e.jsxs("div",{className:"flex items-start gap-3 p-2 rounded-lg hover:bg-muted/30 cursor-pointer",onClick:()=>a("/tasks"),children:[e.jsx("div",{className:`mt-0.5 w-2 h-2 rounded-full shrink-0 ${c.priority==="urgent"?"bg-red-400":c.priority==="high"?"bg-yellow-400":"bg-gray-400"}`}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium truncate",children:c.title}),e.jsx("p",{className:"text-xs text-muted-foreground",children:de(c.createdAt)})]})]},c.id))})]})]})}function Le({slug:n,brand:m}){const s=ne(m),t=[{icon:ge,label:"Call-in",url:`${s}/${n}/call-in`,desc:"Telefonischen Termin buchen"},{icon:he,label:"Walk-in",url:`${s}/${n}/walk-in`,desc:"Walk-in Lead erfassen"},{icon:be,label:"Promo-Lead",url:`${s}/${n}/promo`,desc:"Promo-Aktion (vor Aldi etc.)"},{icon:pe,label:"Vertragsseite",url:`${s}/${n}/studio`,desc:"Studio-Vertrag ohne Provision"}],a=r=>{navigator.clipboard.writeText(r),v.success("Link kopiert!")};return e.jsxs(D,{className:"bg-card border-border",children:[e.jsx($,{className:"pb-2",children:e.jsxs(A,{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(ue,{className:"h-4 w-4 text-primary"}),"Studio-Links (kopieren & weitersenden)"]})}),e.jsx(B,{className:"pb-3 space-y-1.5",children:t.map(({icon:r,label:d,url:l,desc:x})=>e.jsxs("div",{className:"flex items-center gap-2 p-2 rounded-lg bg-muted/20 hover:bg-muted/40 transition-colors group",children:[e.jsx(r,{className:"w-3.5 h-3.5 text-primary shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-xs font-medium",children:d}),e.jsx("p",{className:"text-[10px] text-muted-foreground truncate",children:x})]}),e.jsxs("div",{className:"flex gap-1",children:[e.jsx("button",{onClick:()=>a(l),className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground",title:"Kopieren",children:e.jsx(je,{className:"w-3 h-3"})}),e.jsx("a",{href:l,target:"_blank",rel:"noopener noreferrer",className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground",title:"Ãffnen",children:e.jsx(fe,{className:"w-3 h-3"})})]})]},l))})]})}function Te({brandId:n}){const m=Date.now(),s=m+28*864e5,{data:t}=o.appointments.list.useQuery({from:m,to:s,brandId:n}),[,a]=P(),r=(t??[]).filter(d=>d.status!=="cancelled"&&d.status!=="no_show").slice(0,5);return e.jsxs(D,{className:"bg-card border-border",children:[e.jsx($,{className:"pb-2",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(A,{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(W,{className:"h-4 w-4 text-primary"}),"Nächste Termine"]}),e.jsx(w,{variant:"ghost",size:"sm",className:"h-7 text-xs",onClick:()=>a("/appointments"),children:"Kalender"})]})}),e.jsx(B,{className:"pb-4",children:r.length===0?e.jsxs("div",{className:"text-center py-6 text-sm text-muted-foreground",children:[e.jsx(W,{className:"w-8 h-8 mx-auto mb-2 opacity-30"}),"Keine anstehenden Termine"]}):e.jsx("div",{className:"space-y-2",children:r.map(d=>{const l=new Date(d.scheduledAt);return e.jsxs("div",{className:"flex items-center gap-3 p-2 rounded-lg bg-muted/20",children:[e.jsxs("div",{className:"w-10 h-10 rounded-lg bg-primary/10 flex flex-col items-center justify-center shrink-0",children:[e.jsx("span",{className:"text-xs font-bold text-primary leading-none",children:l.getDate()}),e.jsx("span",{className:"text-[9px] text-muted-foreground",children:l.toLocaleDateString("de-DE",{month:"short"})})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium truncate",children:d.isManual?d.manualTitle:d.leadName}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[l.toLocaleTimeString("de-DE",{hour:"2-digit",minute:"2-digit"})," Uhr"]})]})]},d.id)})})})]})}function Fe(){const[,n]=P(),{data:m}=o.auth.me.useQuery(),s=typeof window<"u"&&Number(new URLSearchParams(window.location.search).get("brand"))||void 0,t=s??m?.brandId??void 0,{data:a}=o.brands.get.useQuery({id:t??0},{enabled:!!t}),r=new Date,d=new Date(r.getFullYear(),r.getMonth(),1).getTime(),l=new Date(r.getFullYear(),r.getMonth()+1,0,23,59,59,999).getTime(),{data:x}=o.dashboard.kpis.useQuery({brandId:t,dateFrom:d,dateTo:l},{enabled:!!t}),b=!!s,u=new Date,h=`${u.getFullYear()}
1-${String(u.getMonth()+1).padStart(2,"0")}-01`,N=new Date(u.getFullYear(),u.getMonth()+1,0).toISOString().slice(0,10),{data:p}=o.ads.connection.useQuery({brandId:t},{enabled:!!t}),f=!!p?.id,{data:c}=o.ads.roi.useQuery({brandId:t,dateFrom:h,dateTo:N},{enabled:!!t&&f}),{data:U}=o.magicline.brandMonthlyStats.useQuery({brandId:t},{enabled:!!t,staleTime:5*6e4}),i=U?.activeMembers??null,I=`meeting-budget-${t??"x"}`,[K,te]=y.useState(()=>typeof window<"u"?localStorage.getItem(I)??"":""),se=parseFloat(K.replace(",","."))||0;if(!t)return e.jsx("div",{className:"flex items-center justify-center h-64 text-muted-foreground",children:e.jsxs("div",{className:"text-center",children:[e.jsx(ie,{className:"w-12 h-12 mx-auto mb-3 opacity-30"}),e.jsx("p",{className:"font-medium",children:"Kein Studio zugewiesen"}),e.jsx("p",{className:"text-sm mt-1",children:"Bitte wende dich an den Administrator."})]})});const k=x,j=k?.totalLeads??0,C=k?.totalAppointments??0,M=k?.showedUpCount??0,L=k?.totalContracts??0,re=k?.directContracts??0,R=k?.appointmentContracts??0,S=k?.openFeedbacks??0,O=j>0?Math.round(C/j*100):0,H=C>0?Math.round(M/C*100):0,ae=M>0?Math.round(R/M*100):0,E=j>0?Math.round(L/j*100):0,V=r.toLocaleDateString("de-DE",{month:"long",year:"numeric"});return e.jsxs("div",{className:"mm-premium space-y-6 p-4 md:p-6 rounded-2xl",style:{background:"var(--background)"},children:[b&&e.jsx("button",{onClick:()=>n("/"),className:"text-xs font-semibold text-muted-foreground hover:text-foreground -mb-2",children:"â Zur Admin-Ãbersicht"}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[11px] font-bold uppercase tracking-[.22em] text-muted-foreground",children:"Willkommen zurück"}),e.jsx("h1",{className:"mm-disp text-2xl font-black text-foreground",children:a?.studioName??a?.name??"Studio-Dashboard"}),e.jsxs("p",{className:"text-muted-foreground text-sm mt-0.5",children:[V," · Studio-Ãbersicht"]})]}),e.jsxs("button",{onClick:()=>n("/admin/feedbacks"),className:`flex items-center gap-3 rounded-lg border-2 px-4 py-2.5 text-sm transition-all hover:scale-[1.02] ${S>0?"border-orange-500/60 bg-orange-500/15 hover:bg-orange-500/20":"border-green-500/30 bg-green-500/10 hover:bg-green-500/15"}`,children:[S>0?e.jsx(ce,{className:"w-5 h-5 text-orange-400"}):e.jsx(Q,{className:"w-5 h-5 text-green-400"}),e.jsxs("div",{className:"text-left leading-tight",children:[e.jsxs("div",{className:`text-lg font-bold ${S>0?"text-orange-400":"text-green-400"}`,children:[S," offene",S===1?"s":""," Feedback",S===1?"":"s"]}),e.jsx("div",{className:"text-xs text-muted-foreground",children:S>0?"â jetzt erledigen":"alles erledigt"})]}),e.jsx(oe,{className:"w-4 h-4 text-muted-foreground ml-1"})]})]}),e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[{icon:z,label:"Leads",value:j,sub:`${V}`,accent:!0},{icon:W,label:"Termine",value:C,sub:j>0?`${O}% der Leads`:"â"},{icon:X,label:"Shows",value:M,sub:C>0?`${H}% der Termine`:"â"},{icon:Z,label:"Verträge",value:L,sub:j>0?`${E}% der Leads`:"â",gold:!0}].map((g,F)=>e.jsxs("div",{className:"relative overflow-hidden rounded-2xl border border-border bg-card p-5",children:[g.gold&&e.jsx("div",{className:"absolute top-0 left-0 h-[3px] w-2/5",style:{background:"linear-gradient(90deg,var(--primary),transparent)"}}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"text-[10px] font-bold uppercase tracking-[.16em] text-muted-foreground",children:g.label}),e.jsx(g.icon,{className:"h-4 w-4",style:{color:g.gold?"var(--primary)":"var(--muted-foreground)"}})]}),e.jsx("div",{className:"mm-disp mm-tnum font-black text-foreground mt-2",style:{fontSize:34,lineHeight:1},children:g.value}),e.jsx("div",{className:"text-[11px] text-muted-foreground mt-1.5",children:g.sub})]},F))}),t!=null&&e.jsx(Ce,{brandId:t}),e.jsxs("div",{className:"rounded-xl border border-border bg-card p-5",children:[e.jsxs("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider mb-4",children:["Lead-Conversion â ",V]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 text-center",children:[e.jsxs("div",{children:[e.jsxs("div",{className:`text-3xl font-black ${E>=20?"text-emerald-400":E>=10?"text-amber-400":"text-red-400"}`,children:[E,"%"]}),e.jsx("div",{className:"text-xs text-muted-foreground mt-1",children:"Lead â Vertrag"}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:[L," von ",j]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"text-3xl font-black text-cyan-400",children:[O,"%"]}),e.jsx("div",{className:"text-xs text-muted-foreground mt-1",children:"Lead â Termin"}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:[C," von ",j]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"text-3xl font-black text-violet-400",children:[H,"%"]}),e.jsx("div",{className:"text-xs text-muted-foreground mt-1",children:"Termin â Show"}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:[M," von ",C]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"text-3xl font-black text-emerald-400",children:[ae,"%"]}),e.jsx("div",{className:"text-xs text-muted-foreground mt-1",children:"Show â Vertrag"}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:[R," von ",M]})]})]}),e.jsxs("div",{className:"flex gap-4 mt-4 pt-4 border-t border-border text-sm",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-2 h-2 rounded-full bg-emerald-400"}),e.jsx("span",{className:"text-muted-foreground",children:"Direkt online:"}),e.jsx("span",{className:"font-bold text-emerald-400",children:re})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-2 h-2 rounded-full bg-blue-400"}),e.jsx("span",{className:"text-muted-foreground",children:"Via Termin:"}),e.jsx("span",{className:"font-bold text-blue-400",children:R})]})]})]}),(()=>{const g=f&&c?Number(c.spend??0):se,F=g>0&&j>0?g/j:null,Y=g>0&&L>0?g/L:null,G=g>0&&i&&i>0?g/i:null;return e.jsxs("div",{className:"rounded-xl border border-border bg-card p-5 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-3",children:[e.jsx("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:"Marketing-Effizienz"}),!f&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("label",{className:"text-xs text-muted-foreground",children:"Werbebudget (â¬)"}),e.jsx("input",{type:"number",min:"0",step:"100",value:K,onChange:_=>{te(_.target.value),localStorage.setItem(I,_.target.value)},placeholder:"z.B. 3000",className:"bg-background border border-border rounded-md px-3 py-1.5 text-sm text-foreground w-32"})]}),f&&e.jsx("span",{className:"text-xs bg-blue-500/20 text-blue-400 px-2 py-0.5 rounded-full",children:"Meta Ads â echtes Budget"})]}),g<=0?e.jsx("p",{className:"text-sm text-muted-foreground",children:f?"Kein Meta-Ads-Budget für diesen Monat.":"Budget eintragen um Kosten zu berechnen."}):e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 text-center",children:[e.jsxs("div",{className:"bg-muted/40 border border-border rounded-xl p-4",children:[e.jsx("div",{className:"text-[11px] text-muted-foreground mb-1",children:"Investiertes Budget"}),e.jsx("div",{className:"mm-disp mm-tnum text-2xl font-black text-foreground",children:g.toLocaleStr
1ing("de-DE",{style:"currency",currency:"EUR",maximumFractionDigits:0})})]}),e.jsxs("div",{className:"bg-muted/40 border border-border rounded-xl p-4",children:[e.jsx("div",{className:"text-[11px] text-muted-foreground mb-1",children:"Kosten pro Lead"}),e.jsx("div",{className:"mm-disp mm-tnum text-2xl font-black text-foreground",children:F!=null?F.toLocaleString("de-DE",{style:"currency",currency:"EUR"}):"â"})]}),e.jsxs("div",{className:"bg-muted/40 border border-border rounded-xl p-4",children:[e.jsx("div",{className:"text-[11px] text-muted-foreground mb-1",children:"Kosten pro Vertrag"}),e.jsx("div",{className:"mm-disp mm-tnum text-2xl font-black text-foreground",children:Y!=null?Y.toLocaleString("de-DE",{style:"currency",currency:"EUR"}):"â"})]}),e.jsxs("div",{className:"rounded-xl p-4 border",style:{background:"var(--accent)",borderColor:"var(--primary)"},children:[e.jsx("div",{className:"text-[11px] mb-1",style:{color:"var(--primary)"},children:"Kosten / Mitglied"}),e.jsx("div",{className:"mm-disp mm-tnum text-2xl font-black",style:{color:"var(--primary)"},children:G!=null?G.toLocaleString("de-DE",{style:"currency",currency:"EUR"}):"â"}),e.jsx("div",{className:"text-[10px] text-muted-foreground mt-1",children:i?`Werbung ÷ ${i} Mitglieder`:"aktive Mitglieder fehlen"})]})]})]})})(),!b&&a?.slug&&e.jsx(Le,{slug:a.slug,brand:a}),!b&&e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsx(Se,{brandId:t,userId:m?.id??0}),e.jsx(Me,{brandId:t,userName:m?.name??void 0})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsx(Te,{brandId:t}),e.jsx(De,{brandId:t})]})]})}function De({brandId:n}){const{data:m}=o.leads.list.useQuery({limit:5,offset:0,brandId:n}),[,s]=P();return e.jsxs(D,{className:"bg-card border-border",children:[e.jsx($,{className:"pb-2",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(A,{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(z,{className:"h-4 w-4 text-primary"}),"Neueste Leads"]}),e.jsx(w,{variant:"ghost",size:"sm",className:"h-7 text-xs",onClick:()=>s("/leads"),children:"Alle Leads"})]})}),e.jsx(B,{className:"pb-4",children:(m?.rows??[]).length===0?e.jsxs("div",{className:"text-center py-6 text-sm text-muted-foreground",children:[e.jsx(z,{className:"w-8 h-8 mx-auto mb-2 opacity-30"}),"Noch keine Leads"]}):e.jsx("div",{className:"space-y-2",children:(m?.rows??[]).slice(0,5).map(t=>e.jsxs("div",{className:"flex items-center gap-3 p-2 rounded-lg hover:bg-muted/30 cursor-pointer",onClick:()=>s(`/leads/${t.id}`),children:[e.jsxs("div",{className:"w-8 h-8 rounded-full bg-primary/10 flex items-center justify-center text-xs font-bold text-primary shrink-0",children:[t.firstName?.[0],t.lastName?.[0]]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("p",{className:"text-sm font-medium truncate",children:[t.firstName," ",t.lastName]}),e.jsx("p",{className:"text-xs text-muted-foreground truncate",children:t.phone||t.email})]}),e.jsx(le,{variant:"outline",className:"text-xs shrink-0",children:t.status})]},t.id))})})]})}export{Ce as MagiclineMonthlyStatsWidget,Fe as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.