PageSourceSearch

https://medifit-nienburg.de/assets/StudiosHub-5Z2vr1Lc.js

js medifit-nienburg.de collected 2026-10-04 03:32:54 UTC 14,309 bytes, 3 lines download raw bytes

1import{a as o,j as e}from"./trpc-vendor-Bta84Nsh.js";import{L as W,u as U}from"./react-vendor-DpXpH6G7.js";import{t as u,B as j,C as D,h as T,I as v,D as O,a as Z,b as Q,c as H,L,d as Y}from"./index-_3-B0itT.js";import{S as K,a as X,b as q,c as J,d as w}from"./select-DqcHU93A.js";import{t as b,p as _,j as R,aC as E,cA as z,aa as ee,ah as te,X as ae,d as se}from"./ui-vendor-NEZNvIbV.js";function ce(){const k=o.useMemo(()=>{const t=new Date;return{dateFrom:new Date(t.getFullYear(),t.getMonth(),1).getTime(),dateTo:t.getTime()}},[]),m=u.useUtils(),{data:C=[],isLoading:N}=u.studioStats.comparison.useQuery(k,{staleTime:5*6e4,refetchOnWindowFocus:!1}),d=C,[l,n]=o.useState(null),p=u.brands.update.useMutation({onSuccess:()=>{m.studioStats.comparison.invalidate(),b.success("Ziele gespeichert"),n(null)},onError:t=>b.error(t?.message??"Fehler beim Speichern")}),c=t=>t==null?"text-muted-foreground":t>=80?"text-emerald-400":t>=50?"text-yellow-400":"text-red-400",{data:g}=u.brands.list.useQuery(void 0,{staleTime:60*6e4}),h=o.useMemo(()=>new Map((g??[]).map(t=>[t.id,t.slug])),[g]),f=o.useMemo(()=>{const t=new Set(d.map(a=>a.brandId));return(g??[]).filter(a=>!t.has(a.id)).map(a=>({brandId:a.id,name:a.studioName||a.name||`Studio ${a.id}`,brandMode:a.brandMode||"",totalLeads:0,totalAppointments:0,totalSales:0,showsContracts:0,onlineContracts:0,openFeedbacks:0,totalRevenue:0,totalProvision:0,goal:0,goalPct:null,conversionRate:0,pending:!0}))},[d,g]),[s,S]=o.useState("smart"),A=o.useMemo(()=>{const t=[...d,...f];return s==="az"?t.sort((a,i)=>a.name.localeCompare(i.name,"de")):t.sort((a,i)=>{if(!!a.pending!=!!i.pending)return a.pending?-1:1;const y=a.totalLeads+a.totalSales>0,r=i.totalLeads+i.totalSales>0;return y!==r?y?-1:1:a.totalSales!==i.totalSales?i.totalSales-a.totalSales:a.name.localeCompare(i.name,"de")})},[d,f,s]),B=t=>t.toLocaleString("de-DE",{style:"currency",currency:"EUR",maximumFractionDigits:0}),[G,I]=o.useState(!1),{data:M=[]}=u.brands.listArchived.useQuery(void 0,{staleTime:6e4}),P=()=>{m.studioStats.comparison.invalidate(),m.brands.list.invalidate(),m.brands.listArchived.invalidate()},F=u.brands.archive.useMutation({onSuccess:()=>{b.success("Studio archiviert — überall ausgeblendet"),P()}}),$=u.brands.unarchive.useMutation({onSuccess:()=>{b.success("Studio wiederhergestellt"),P()}}),V=(t,a)=>{window.confirm(`Studio „${a}" archivieren?
2
3Es verschwindet komplett aus allen Listen, Cockpits, Leads und Automatisierungen (Ads/WhatsApp/Reports). Inhaber-Zugänge werden gesperrt. Alle Daten bleiben erhalten — du kannst es jederzeit wiederherstellen.`)&&F.mutate({id:t})};return e.jsxs("div",{className:"p-6 max-w-7xl mx-auto space-y-6",children:[e.jsxs("div",{className:"flex items-start justify-between flex-wrap gap-3",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl font-bold flex items-center gap-2 text-foreground",children:[e.jsx(_,{className:"w-6 h-6 text-primary"}),"Studios"]}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Zentrale Übersicht aller Studios. Klick auf ein Studio öffnet die Detail-Seite mit allen Tools (Sprint, Performance, Mailings, Marketing, Setup)."})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsxs("div",{className:"inline-flex rounded-lg border border-border overflow-hidden",children:[e.jsx("button",{onClick:()=>S("smart"),className:`text-xs px-3 py-1.5 ${s==="smart"?"bg-primary text-primary-foreground font-semibold":"text-foreground hover:bg-muted/40"}`,children:"Standard"}),e.jsx("button",{onClick:()=>S("az"),className:`text-xs px-3 py-1.5 ${s==="az"?"bg-primary text-primary-foreground font-semibold":"text-foreground hover:bg-muted/40"}`,children:"A–Z"})]}),e.jsxs(j,{onClick:()=>I(!0),className:"gap-2",children:[e.jsx(R,{className:"w-4 h-4"}),"Neues Studio anlegen"]})]})]}),e.jsx(ne,{open:G,onClose:()=>I(!1)}),N?e.jsx("p",{className:"text-sm text-muted-foreground py-12 text-center",children:"Lade Studios…"}):A.length===0?e.jsx("p",{className:"text-sm text-muted-foreground py-12 text-center",children:"Noch keine Studios angelegt."}):e.jsx(D,{children:e.jsx(T,{className:"p-0",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{children:e.jsx("tr",{className:"border-b border-border bg-muted/10",children:["Studio","Modus","Leads","Termine","Verträge","Conversion","Ziel-Erreichung","Umsatz (Monat)",""].map((t,a)=>e.jsx("th",{className:`px-3 py-2.5 font-medium text-muted-foreground uppercase tracking-wider text-[10px] ${["Leads","Termine","Verträge","Conversion"].includes(t)?"text-right":"text-left"}`,children:t},a))})}),e.jsx("tbody",{children:A.map(t=>{const a=t.pending||t.totalLeads+t.totalSales>0,i=t.conversionRate>=30?"text-emerald-400":t.conversionRate>=15?"text-yellow-400":t.conversionRate>0?"text-orange-400":"text-muted-foreground",y=t.goalPct==null?"text-muted-foreground":t.goalPct>=80?"text-emerald-400":t.goalPct>=50?"text-yellow-400":"text-red-400";return e.jsxs(o.Fragment,{children:[e.jsxs("tr",{className:`border-b border-border/40 hover:bg-muted/15 transition-colors cursor-pointer ${a?"":"opacity-60"}`,onClick:()=>{window.location.href=`/admin/studios/${t.brandId}`},children:[e.jsxs("td",{className:"px-3 py-2.5 font-medium text-foreground",children:[e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx(W,{href:`/admin/studios/${t.brandId}
3`,children:e.jsx("span",{className:"hover:text-primary cursor-pointer",children:t.name})}),t.pending&&e.jsx("span",{className:"text-[9px] font-bold uppercase tracking-wide rounded-full px-1.5 py-0.5 bg-amber-100 text-amber-800 border border-amber-300",children:"In Onboarding"})]}),h.get(t.brandId)&&e.jsxs("button",{type:"button",title:"Slug kopieren",onClick:r=>{r.stopPropagation(),navigator.clipboard?.writeText(String(h.get(t.brandId))),b.success("Slug kopiert")},className:"block text-[10px] font-mono text-muted-foreground hover:text-primary text-left",children:["/",h.get(t.brandId)]})]}),e.jsx("td",{className:"px-3 py-2.5 text-[10px] uppercase text-muted-foreground tracking-wider",children:t.brandMode||"—"}),e.jsxs("td",{className:"px-3 py-2.5 text-right tabular-nums",children:[e.jsx("span",{className:"text-blue-400 font-semibold",children:t.totalLeads}),(t.leadGoal??0)>0&&e.jsxs("span",{className:`ml-1 text-[10px] ${c(t.leadGoalPct)}`,children:["/",t.leadGoal]})]}),e.jsxs("td",{className:"px-3 py-2.5 text-right tabular-nums",children:[e.jsx("span",{className:"text-purple-400 font-semibold",children:t.totalAppointments}),(t.appointmentGoal??0)>0&&e.jsxs("span",{className:`ml-1 text-[10px] ${c(t.appointmentGoalPct)}`,children:["/",t.appointmentGoal]})]}),e.jsxs("td",{className:"px-3 py-2.5 text-right tabular-nums",children:[e.jsx("span",{className:"text-emerald-400 font-semibold",children:t.totalSales}),t.goal>0&&e.jsxs("span",{className:`ml-1 text-[10px] ${c(t.goalPct)}`,children:["/",t.goal]})]}),e.jsxs("td",{className:`px-3 py-2.5 text-right tabular-nums font-medium ${i}`,children:[t.conversionRate,"%"]}),e.jsx("td",{className:"px-3 py-2.5",children:t.goal>0?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-16 h-1.5 bg-muted rounded-full overflow-hidden shrink-0",children:e.jsx("div",{className:`h-full rounded-full ${(t.goalPct??0)>=80?"bg-emerald-400":(t.goalPct??0)>=50?"bg-yellow-400":"bg-red-400"}`,style:{width:`${Math.min(t.goalPct??0,100)}%`}})}),e.jsxs("span",{className:`text-[11px] ${y}`,children:[t.totalSales,"/",t.goal," (",t.goalPct??0,"%)"]})]}):e.jsx("span",{className:"text-muted-foreground",children:"—"})}),e.jsx("td",{className:"px-3 py-2.5 tabular-nums font-medium text-foreground",children:B(t.totalRevenue)}),e.jsx("td",{className:"px-3 py-2.5",children:e.jsxs("div",{className:"flex items-center gap-1.5 justify-end",onClick:r=>r.stopPropagation(),children:[e.jsx("button",{type:"button",title:"Monatsziele setzen (Leads / Termine / Verträge)",onClick:()=>n(l?.brandId===t.brandId?null:{brandId:t.brandId,lead:String(t.leadGoal??0),appt:String(t.appointmentGoal??0),contract:String(t.goal??0)}),className:`hover:text-primary ${l?.brandId===t.brandId?"text-primary":"text-muted-foreground"}`,children:e.jsx(E,{className:"w-4 h-4"})}),e.jsx("button",{type:"button",title:"Studio archivieren (überall ausblenden, reversibel)",onClick:()=>V(t.brandId,t.name),className:"text-muted-foreground hover:text-red-500",children:e.jsx(z,{className:"w-4 h-4"})}),e.jsx(ee,{className:"w-4 h-4 text-muted-foreground"})]})})]}),l?.brandId===t.brandId&&e.jsx("tr",{className:"border-b border-border/40 bg-muted/10",children:e.jsx("td",{colSpan:9,className:"px-3 py-3",children:e.jsxs("div",{className:"flex flex-wrap items-end gap-3",onClick:r=>r.stopPropagation(),children:[e.jsxs("span",{className:"text-[11px] font-semibold text-foreground inline-flex items-center gap-1",children:[e.jsx(E,{className:"w-3.5 h-3.5 text-primary"})," Monatsziele · ",t.name]}),e.jsxs("label",{className:"text-[10px] text-muted-foreground",children:["Leads",e.jsx(v,{type:"number",value:l.lead,onChange:r=>n(x=>x&&{...x,lead:r.target.value}),className:"h-8 w-24 text-xs mt-0.5"})]}),e.jsxs("label",{className:"text-[10px] text-muted-foreground",children:["Termine",e.jsx(v,{type:"number",value:l.appt,onChange:r=>n(x=>x&&{...x,appt:r.target.value}),className:"h-8 w-24 text-xs mt-0.5"})]}),e.jsxs("label",{className:"text-[10px] text-muted-foreground",children:["Verträge",e.jsx(v,{type:"number",value:l.contract,onChange:r=>n(x=>x&&{...x,contract:r.target.value}),className:"h-8 w-24 text-xs mt-0.5"})]}),e.jsxs(j,{size:"sm",className:"h-8 text-xs gap-1",disabled:p.isPending,onClick:()=>p.mutate({id:t.brandId,leadGoal:Number(l.lead)||0,appointmentGoal:Number(l.appt)||0,contractGoal:Number(l.contract)||0}),children:[e.jsx(te,{className:"w-3.5 h-3.5"})," ",p.isPending?"Speichert…":"Speichern"]}),e.jsx("button",{type:"button",onClick:()=>n(null),className:"text-muted-foreground hover:text-foreground p-1.5",children:e.jsx(ae,{className:"w-4 h-4"})})]})})})]},t.brandId)})})]})})})}),M.length>0&&e.jsx(D,{children:e.jsxs(T,{className:"p-4",children:[e.jsxs("h2",{className:"text-sm font-semibold text-foreground flex items-center gap-2 mb-1",children:[e.jsx(z,{className:"w-4 h-4 text-muted-foreground"})," Archiv (",M.length,")"]}),e.jsx("p",{className:"text-[11px] text-muted-foreground mb-3",children:"Diese Studios sind komplett ausgeblendet (Listen, Cockpits, Leads, Automatisierungen, Inhaber-Zugang). Daten bleiben erhalten."}),e.jsx("div",{className:"space-y-2",children:M.map(t=>e.jsxs("div",{className:"flex items-center justify-between border border-border/50 rounded-lg px-3 py-2 gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-sm font-medium text-foreground truncate",children:t.studioName||t.name}),e.jsxs("div",{className:"text-[11px] text-muted-foreground truncate",children:["/",t.slug," · ",t.leadCount," Leads · ",t.contractCount," Verträge · archiviert ",t.archivedAt?new Date(t.archivedAt).toLocaleDateString("de-DE"):"—"]})]}),e.jsxs(j,{size:"sm",variant:"outline",className:"gap-1.5 shrink-0",onClick:()=>$.mutate({id:t.id}),disabled:$.isPending,children:[e.jsx(se,{className:"w-3.5 h-3.5"})," Wiederherstellen"]})]},t.id))})]})})]})}function ne({open:k,onClose:m}
3){const[,C]=U(),N=u.useUtils(),[d,l]=o.useState(""),[n,p]=o.useState(""),[c,g]=o.useState("gym"),h=u.brands.create.useMutation({onSuccess:s=>{b.success(`Marke "${s.name}" angelegt — weiter im Onboarding-Wizard`),N.brands.list.invalidate(),N.studioStats.comparison.invalidate(),m(),l(""),p(""),g("gym"),C(`/admin/studios/${s.id}/onboarding`)},onError:s=>b.error(`Fehler: ${s.message}`)}),f=s=>s.toLowerCase().replace(/[äöüß]/g,S=>({ä:"ae",ö:"oe",ü:"ue",ß:"ss"})[S]).replace(/[^a-z0-9-]+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"");return e.jsx(O,{open:k,onOpenChange:s=>!s&&m(),children:e.jsxs(Z,{className:"max-w-md max-h-[90vh] overflow-y-auto",children:[e.jsx(Q,{children:e.jsxs(H,{className:"flex items-center gap-2",children:[e.jsx(R,{className:"w-5 h-5 text-primary"}),"Neues Studio anlegen"]})}),e.jsxs("div",{className:"space-y-4 py-2",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"Nur Name, Slug und Modus. Alles Weitere (Adresse, Logo, Magicline, Angebot …) kommt danach im Onboarding."}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(L,{children:"Studio-Name *"}),e.jsx(v,{value:d,onChange:s=>{l(s.target.value),(!n||n===f(d))&&p(f(s.target.value))},placeholder:"z.B. EASYFITNESS Vellmar",autoFocus:!0})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(L,{children:"URL-Slug *"}),e.jsx(v,{value:n,onChange:s=>p(f(s.target.value)),placeholder:"easyfitness-vellmar"}),e.jsxs("p",{className:"text-[10px] text-muted-foreground",children:["Wird in URLs verwendet: ",e.jsxs("span",{className:"font-mono",children:["members.up.railway.app/",n||"..."]})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(L,{children:"Modus *"}),e.jsxs(K,{value:c,onValueChange:s=>g(s),children:[e.jsx(X,{children:e.jsx(q,{})}),e.jsxs(J,{children:[e.jsx(w,{value:"gym",children:"Bestehendes Studio (Sprints, laufender Betrieb)"}),e.jsx(w,{value:"presale",children:"Vorverkauf (Neueroeffnung)"}),e.jsx(w,{value:"agentur",children:"Agentur (kein Studio-Verkauf)"}),e.jsx(w,{value:"partner",children:"Partner (Marketing, Leads, WhatsApp & Website — kein Studio)"})]})]}),e.jsx("p",{className:"text-[10px] text-muted-foreground",children:c==="gym"?"Laufendes Studio mit Magicline-Anbindung — wir machen Sprints + Empfehlungsprogramm.":c==="agentur"?"Eigene Agentur-Marke (z.B. MoreMembers) — keine Mitglieder-/Vertragsziele, nur Website, Termine & Flows.":c==="partner"?"Partner/Multiplikator (z.B. Getränkehersteller) — volle Marketing-Tools (Leads, WhatsApp, Website, Mailings), aber ohne Fitness-/Vertrags-Module.":"Studio in Eroeffnungsphase — Vorverkauf, dann Uebergang in laufenden Betrieb."})]})]}),e.jsxs(Y,{children:[e.jsx(j,{variant:"outline",onClick:m,children:"Abbrechen"}),e.jsx(j,{disabled:!d.trim()||!n.trim()||h.isPending,onClick:()=>h.mutate({name:d.trim(),slug:n.trim(),brandMode:c}),children:h.isPending?"Lege an…":"Anlegen + Onboarding starten"})]})]})})}export{ce 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.