1import{bk as ts,r as c,s as v,j as e,V as as,cu as Me,ad as R,af as z,ag as T,ah as B,aj as y,bH as Pe,cv as Se,B as b,I as ns,cw as rs,bY as ls,m as x,n as g,G as L,cx as is,b9 as os,U as cs,g as _,at as ie}from"./index-C3wyiG4j.js";import{S as De}from"./switch-CDwPwMUc.js";import{T as ds,a as xs,b as oe,c as ce}from"./tabs-BpFB6M4d.js";import{S as ms}from"./save-cElh8r1F.js";import{R as Re,B as ze,C as Te,X as Be,Y as Le,T as Ae,L as hs,a as de}from"./BarChart-CT4Ufhav.js";import{f as w}from"./format-CRNufvVK.js";import"./string-Dx7P_S-w.js";import"./linear-DGECpK-G.js";import"./init-Dmth1JHB.js";import"./defaultLocale-C4B-KCzX.js";import"./time-ByyzYylg.js";import"./band-CquvqAHh.js";import"./ordinal-DILIJJjt.js";const Ge=p=>({id:p,package:"silver",duration:"24m",mrr:0,onboardingRevenue:0,consultingRevenue:0,hardwareRevenue:0,hardwareType:"cash",paymentCoreRevenue:0,paymentHighMarginRevenue:0,hasPayment:!0,isOnlineLead:!1}),us=[{value:"silver",label:"Silver"},{value:"gold",label:"Gold"},{value:"platin",label:"Platin"}],gs=[{value:"startup",label:"STARTUP (24M, kein Bonus)"},{value:"12m",label:"12 Monate (rollierend, kein Bonus)"},{value:"24m",label:"24 Monate"},{value:"36m",label:"36 Monate"},{value:"60m",label:"60 Monate"}],l=p=>p.toLocaleString("de-DE",{style:"currency",currency:"EUR"}),Ss=()=>{const{user:p,roles:xe}=ts(),[C,He]=c.useState([]),[k,me]=c.useState([]),[i,he]=c.useState(null),[j,M]=c.useState([Ge(1)]),[Ee,Oe]=c.useState(!0),[A,Ve]=c.useState(!1),[P,ue]=c.useState("calculator"),[S,Fe]=c.useState([]),[ge,pe]=c.useState(!1),[je,fe]=c.useState(!1),[ve,be]=c.useState(()=>w(new Date,"yyyy-MM"));c.useEffect(()=>{(async()=>{const{data:n}=await v.from("compensation_plans").select("*").eq("is_active",!0),r=n||[];He(r);const t=r.find(h=>xe.includes(h.role))||r[0]||null;if(t){he(t);const{data:h}=await v.from("commission_rates").select("*").eq("plan_id",t.id);me(h||[])}Oe(!1)})()},[xe]),c.useEffect(()=>{(P==="archive"||P==="trends")&&G()},[P]);const G=async()=>{pe(!0);const{data:s}=await v.from("commission_snapshots").select("*").order("month",{ascending:!1}).limit(24);Fe(s||[]),pe(!1)},Ue=async s=>{const n=C.find(d=>d.id===s);if(!n)return;he(n);const{data:r}=await v.from("commission_rates").select("*").eq("plan_id",s);me(r||[])},m=(s,n,r)=>{M(d=>d.map(t=>t.id===s?{...t,[n]:r}:t))},$e=()=>M(s=>[...s,Ge(s.length+1)]),Ke=s=>M(n=>n.filter(r=>r.id!==s)),f=(s,n)=>k.find(r=>r.category===s&&r.package_or_variant===n)||k.find(r=>r.category===s&&r.package_or_variant==="all"),a=c.useMemo(()=>{if(!i)return null;const s=i,n=j.length,r=s.free_deals_count,d=s.pay_gate_threshold,t=n>=d;let h=0,H=0,E=0,O=0,V=0,F=0,U=0;const Ye=j.map((o,Xe)=>{var ke;const q=Xe+1,I=q>r,u=o.isOnlineLead?s.online_lead_factor:1,N=o.hasPayment?1:s.payment_activation_factor,Je=o.hardwareRevenue*((((ke=s.target_bonus_calc_rules)==null?void 0:ke.hardware_percentage)||10)/100),Q=o.mrr+o.onboardingRevenue+o.consultingRevenue+Je;if(h+=Q,!I)return{dealNum:q,isProvisionable:I,commissions:{},total:0,qualRev:Q,factors:{factor:u,paymentFactor:N}};const Y=f("saas",o.package),Ce=o.duration!=="startup"&&o.duration!=="12m",Z=Ce?((Y==null?void 0:Y.rate_value)||0)*u*N:0;H+=Z;const W=f("abschlussbonus",o.duration),X=Ce?((W==null?void 0:W.rate_value)||0)*o.mrr*u*N:0;E+=X;const J=f("payment_core",o.package),ee=o.paymentCoreRevenue*(((J==null?void 0:J.rate_value)||0)/100)*u;O+=ee;const se=f("payment_high_margin",o.package),te=o.paymentHighMarginRevenue*(((se==null?void 0:se.rate_value)||0)/100)*u;V+=te;const ae=f("onboarding",o.package),ne=((ae==null?void 0:ae.rate_value)||0)*u*N;F+=ne;const es=o.hardwareType==="leasing"?"hardware_leasing":"hardware_cash",re=f(es,"all"),le=o.hardwareRevenue*(((re==null?void 0:re.rate_value)||0)/100)*u;U+=le;const ss=Z+X+ee+te+ne+le;return{dealNum:q,isProvisionable:I,qualRev:Q,factors:{factor:u,paymentFactor:N},commissions:{saas:Z,abschluss:X,payCore:ee,payHM:te,onb:ne,hw:le},total:ss}}),$=H+E+O+V+F+U,Ze=Math.max(0,n-d);let K=0;for(const o of s.accelerator_tiers||[])Ze>=o.deals_over_target&&(K=o.bonus_percent);const Ne=$*(K/100),ye=h>=s.target_bonus_threshold,_e=ye?s.target_bonus_amount:0,we=t?$+Ne:0,We=s.fixed_salary+_e+we;return{dealResults:Ye,totalDeals:n,freeDeals:r,payGate:d,meetsPayGate:t,totalQualifiedRevenue:h,meetsTarget:ye,targetBonus:_e,subtotal:$,acceleratorPercent:K,acceleratorBonus:Ne,totalCommission:we,totalSaasCommission:H,totalAbschlussbonus:E,totalPaymentCore:O,totalPaymentHighMargin:V,totalOnboarding:F,totalHardware:U,fixedSalary:s.fixed_salary,totalEarnings:We}},[j,i,k]),qe=async()=>
1{if(!p||!i||!a)return;fe(!0);const s=`${ve}-01`,n={user_id:p.id,plan_id:i.id,month:s,deals_data:j,calculation_result:a,total_deals:a.totalDeals,total_earnings:a.totalEarnings,total_commission:a.totalCommission,target_bonus:a.targetBonus},{error:r}=await v.from("commission_snapshots").upsert(n,{onConflict:"user_id,plan_id,month"});r?_.error("Fehler beim Speichern: "+r.message):(_.success(`Berechnung für ${w(new Date(s),"MMMM yyyy",{locale:ie})} gespeichert`),G()),fe(!1)},Ie=s=>{M(s.deals_data),be(w(new Date(s.month),"yyyy-MM")),ue("calculator"),_.success("Daten geladen")},Qe=async s=>{const{error:n}=await v.from("commission_snapshots").delete().eq("id",s);n?_.error("Fehler beim Löschen"):(_.success("Eintrag gelöscht"),G())},D=c.useMemo(()=>[...S].sort((s,n)=>s.month.localeCompare(n.month)).slice(-12).map(s=>({month:w(new Date(s.month),"MMM yy",{locale:ie}),Verdienst:Number(s.total_earnings),Provision:Number(s.total_commission),Bonus:Number(s.target_bonus),Deals:s.total_deals})),[S]);return Ee?e.jsx("div",{className:"py-12 text-center text-muted-foreground",children:"Ladenâ¦"}):C.length===0?e.jsx("div",{className:"py-12 text-center text-muted-foreground",children:"Noch kein Vergütungsmodell hinterlegt."}):e.jsxs("div",{className:"max-w-4xl w-full",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 mb-6 flex-wrap",children:[e.jsxs("div",{children:[e.jsx(as,{}),e.jsxs("h1",{className:"text-2xl font-bold text-foreground flex items-center gap-2",children:[e.jsx(Me,{size:24})," Provisionsrechner"]}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Berechne deine monatliche Provision basierend auf deinen Deals."})]}),C.length>1&&e.jsxs(R,{value:(i==null?void 0:i.id)||"none",onValueChange:s=>s!=="none"&&Ue(s),children:[e.jsx(z,{className:"w-56",children:e.jsx(T,{})}),e.jsx(B,{children:C.map(s=>e.jsx(y,{value:s.id,children:s.label||s.role},s.id))})]})]}),e.jsxs(ds,{value:P,onValueChange:ue,className:"mb-6",children:[e.jsxs(xs,{className:"grid w-full grid-cols-3",children:[e.jsxs(oe,{value:"calculator",className:"gap-1.5",children:[e.jsx(Me,{size:14})," Rechner"]}),e.jsxs(oe,{value:"archive",className:"gap-1.5",children:[e.jsx(Pe,{size:14})," Archiv"]}),e.jsxs(oe,{value:"trends",className:"gap-1.5",children:[e.jsx(Se,{size:14})," Trends"]})]}),e.jsxs(ce,{value:"calculator",children:[i&&e.jsxs("div",{className:"bg-card rounded-xl border p-5 mb-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("h2",{className:"text-sm font-bold uppercase tracking-wide text-muted-foreground",children:["Modell: ",i.label||i.role]}),e.jsxs(b,{variant:"ghost",size:"sm",onClick:()=>Ve(!A),className:"gap-1 text-xs",children:[e.jsx(ns,{size:12})," Regeln ",A?e.jsx(rs,{size:12}):e.jsx(ls,{size:12})]})]}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3 text-sm",children:[e.jsxs("div",{className:"bg-muted/50 rounded-lg p-3",children:[e.jsx("div",{className:"text-[10px] uppercase text-muted-foreground font-semibold",children:"Fixgehalt"}),e.jsx("div",{className:"text-lg font-bold text-foreground",children:l(i.fixed_salary)})]}),e.jsxs("div",{className:"bg-muted/50 rounded-lg p-3",children:[e.jsx("div",{className:"text-[10px] uppercase text-muted-foreground font-semibold",children:"Zielbonus"}),e.jsx("div",{className:"text-lg font-bold text-foreground",children:l(i.target_bonus_amount)}),e.jsxs("div",{className:"text-[10px] text-muted-foreground",children:["ab ",l(i.target_bonus_threshold)," Umsatz"]})]}),e.jsxs("div",{className:"bg-muted/50 rounded-lg p-3",children:[e.jsx("div",{className:"text-[10px] uppercase text-muted-foreground font-semibold",children:"Pay-Gate"}),e.jsxs("div",{className:"text-lg font-bold text-foreground",children:[i.pay_gate_threshold," Deals"]}
1),e.jsxs("div",{className:"text-[10px] text-muted-foreground",children:[i.free_deals_count," provisionsfrei"]})]}),e.jsxs("div",{className:"bg-muted/50 rounded-lg p-3",children:[e.jsx("div",{className:"text-[10px] uppercase text-muted-foreground font-semibold",children:"Carry-Forward"}),e.jsxs("div",{className:"text-lg font-bold text-foreground",children:[i.carry_forward_months," Mo."]}),e.jsxs("div",{className:"text-[10px] text-muted-foreground",children:["Faktor ",i.carry_forward_factor]})]})]}),A&&e.jsxs("div",{className:"mt-4 space-y-3 text-xs text-muted-foreground border-t pt-4",children:[e.jsxs("div",{children:[e.jsx("strong",{className:"text-foreground",children:"Accelerator:"}),(i.accelerator_tiers||[]).map((s,n)=>e.jsxs("span",{children:[" +",s.deals_over_target," Deals â +",s.bonus_percent,"%",n<i.accelerator_tiers.length-1?" |":""]},n))]}),e.jsxs("div",{children:[e.jsx("strong",{className:"text-foreground",children:"Payment-Faktor:"})," Ohne Payment: Ã",i.payment_activation_factor," | Online-Leads: Ã",i.online_lead_factor]}),e.jsxs("div",{children:[e.jsx("strong",{className:"text-foreground",children:"Clawback:"})," ",i.clawback_months," Monate nach Go-Live"]}),i.notes&&e.jsx("div",{className:"bg-amber-50 text-amber-800 rounded-lg p-2 text-xs",children:i.notes}),e.jsxs("div",{className:"mt-3",children:[e.jsx("strong",{className:"text-foreground block mb-2",children:"Provisionssätze:"}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b",children:[e.jsx("th",{className:"text-left p-1.5",children:"Kategorie"}),e.jsx("th",{className:"text-left p-1.5",children:"Variante"}),e.jsx("th",{className:"text-right p-1.5",children:"Wert"}),e.jsx("th",{className:"text-center p-1.5",children:"Max"})]})}),e.jsx("tbody",{children:k.map((s,n)=>e.jsxs("tr",{className:"border-b border-border/50",children:[e.jsx("td",{className:"p-1.5 capitalize",children:s.category.replace(/_/g," ")}),e.jsx("td",{className:"p-1.5 capitalize",children:s.package_or_variant}),e.jsxs("td",{className:"p-1.5 text-right font-mono",children:[s.rate_type==="percentage"?`${s.rate_value}%`:`${l(s.rate_value)}`,s.rate_type==="fixed_monthly"&&"/Mo"]}),e.jsx("td",{className:"p-1.5 text-center",children:s.max_months?`${s.max_months} Mo`:"â"})]},n))})]})})]})]})]}),e.jsxs("div",{className:"flex items-center gap-3 mb-4 flex-wrap",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(x,{className:"text-xs text-muted-foreground whitespace-nowrap",children:"Monat:"}),e.jsx(g,{type:"month",value:ve,onChange:s=>be(s.target.value),className:"h-8 text-xs w-40"})]}),e.jsxs(b,{size:"sm",variant:"outline",onClick:qe,disabled:je,className:"gap-1.5",children:[e.jsx(ms,{size:14})," ",je?"Speichernâ¦":"Monat speichern"]})]}),e.jsxs("div",{className:"space-y-3 mb-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h2",{className:"text-sm font-bold uppercase tracking-wide text-muted-foreground",children:"Deals diesen Monat"}),e.jsx(b,{size:"sm",variant:"outline",onClick:$e,className:"text-xs",children:"+ Deal hinzufügen"})]}),j.map((s,n)=>{const r=a==null?void 0:a.dealResults[n],d=(r==null?void 0:r.isProvisionable)??!1;return e.jsxs("div",{className:`bg-card rounded-xl border p-4 ${d?"":"opacity-60"}`,children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-xs font-bold text-muted-foreground",children:["Deal #",s.id]}),!d&&e.jsx(L,{variant:"secondary",className:"text-[10px]",children:"Provisionsfrei"}),d&&e.jsx(L,{className:"text-[10px] bg-green-100 text-green-800",children:"Provisionsfähig"})]}),j.length>1&&e.jsx(b,{variant:"ghost",size:"sm",className:"text-xs text-destructive h-6",onClick:()=>Ke(s.id),children:"Entfernen"})]}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3",children:[e.jsxs("div",{children:[e.jsx(x,{className:"text-[10px]",children:"Paket"}),e.jsxs(R,{value:s.package,onValueChange:t=>m(s.id,"package",t),children:[e.jsx(z,{className:"h-8 text-xs",children:e.jsx(T,{})}),e.jsx(B,{children:us.map(t=>e.jsx(y,{value:t.value,children:t.label},t.value))})]})]}),e.jsxs("div",{children:[e.jsx(x,{className:"text-[10px]",children:"Laufzeit"}),e.jsxs(R,{value:s.duration,onValueChange:t=>m(s.id,"duration",t),children:[e.jsx(z,{className:"h-8 text-xs",children:e.jsx(T,{})}),e.jsx(B,{children:gs.map(t=>e.jsx(y,{value:t.value,children:t.label},t.value))})]})]}),e.jsxs("div",{children:[e.jsx(x,{className:"text-[10px]",children:"MRR (â¬)"}),e.jsx(g,{type:"number",value:s.mrr||"",onChange:t=>m(s.id,"mrr",+t.target.value),className:"h-8 text-xs",placeholder:"0"})]}),e.jsxs("div",{children:[e.jsx(x,{className:"text-[10px]",children:"Onboarding (â¬)"}),e.jsx(g,{type:"number",value:s.onboardingRevenue||"",onChange:t=>m(s.id,"onboardingRevenue",+t.target.value),className:"h-8 text-xs",placeholder:"0"})]}),e.jsxs("div",{children:[e.jsx(x,{className:"text-[10px]",children:"Consulting (â¬)"}),e.jsx(g,{type:"number",value:s.consultingRevenue||"",onChange:t=>m(s.id,"consultingRevenue",+t.target.value),className:"h-8 text-xs",placeholder:"0"})]}),e.jsxs("div",{children:[e.jsx(x,{className:"text-[10px]",children:"Hardware (â¬)"}),e.jsx(g,{type:"number",value:s.hardwareRevenue||"",onChange:t=>m(s.id,"hardwareRevenue",+t.target.value),className:"h-8 text-xs",placeholder:"0"})]}),e.jsxs("div",{children:[e.jsx(x,{className:"text-[10px]",children:"HW-Typ"}),e.jsxs(R,{value:s.hardwareType,onValueChange:t=>m(s.id,"hardwareType",t),children:[e.jsx(z,{className:"h-8 text-xs",children:e.jsx(T,{})}),e.jsxs(B,{children:[e.jsx(y,{value:"cash",children:"Barverkauf"}),e.jsx(y,{value:"leasing",children:"Leasing"})]})]})]}),e.jsxs("div",{children:[e.jsx(x,{className:"text-[10px]",children:"Payment Core (â¬)"}),e.jsx(g,{type:"number",value:s.paymentCoreRevenue||"",onChange:t=>m(s.id,"paymentCoreRevenue",+t.target.value),className:"h-8 text-xs",placeholder:"0"})]}),e.jsxs("div",{children:[e.jsx(x,{className:"text-[10px]",children:"Payment HM (â¬)"}),e.jsx(g,{type:"number",value:s.paymentHighMarginRevenue||"",onChange:t=>m(s.id,"paymentHighMarginRevenue",+t.target.value),className:"h-8 text-xs",placeholder:"0"})]}),e.jsxs("div",{className:"flex items-center gap-2 col-span-1",children:[e.jsx(De,{checked:s.hasPayment,onCheckedChange:t=>m(s.id,"hasPayment",t)}),e.jsx(x,{className:"text-[10px]",children:"Payment aktiv"})]}),e.jsxs("div",{className:"flex items-center gap-2 col-span-1",children:[e.jsx(De,{checked:s.isOnlineLead,onCheckedChange:t=>m(s.id,"isOnlineLead",t)}),e.jsx(x,{className:"text-[10px]",children:"Online-Lead"})]})]}),d&&r&&e.jsxs("div",{className:"mt-3 pt-3 border-t flex flex-wrap gap-3 text-[10px] text-muted-foreground",children:[Object.entries(r.commissions).filter(([,t])=>t>0).map(([t,h])=>e.jsxs("span",{children:[e.jsxs("strong",{className:"text-foreground capitalize",children:[t,":"]})," ",l(h)]},t)),e.jsxs("span",{className:"font-bold text-foreground",children:["Gesamt: ",l(r.total)]})]})]},s.id)})]}),a&&e.jsxs("div",{className:"bg-card rounded-xl border p-5 sticky bottom-4 shadow-lg",children:[e.jsxs("h2",{className:"text-sm font-bold uppercase tracking-wide text-muted-foreground mb-4 flex items-center gap-2",children:[e.jsx(is,{size:14})," Monatliche Zusammenfassung"]}),!a.meetsPayGate&&e.jsxs("div",{className:"bg-amber-50 border border-amber-200 rounded-lg p-3 mb-4 flex items-start gap-2",children:[e.jsx(os,{size:14,className:"text-amber-600 mt-0.5 shrink-0"}),e.jsxs("div",{className:"text-xs text-amber-800",children:[e.jsx("strong",{children:"Pay-Gate nicht erreicht:"})," Du brauchst mindestens ",a.payGate," Deals für eine Provisionsauszahlung. Aktuell: ",a.totalDeals," Deals."]})]}),e.jsxs("div",{className:"space-y-2 text-sm",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:"Fixgehalt"}),e.jsx("span",{className:"font-mono font-bold",children:l(a.fixedSalary)})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsxs("span",{className:"text-muted-foreground",children:["Zielbonus ",a.meetsTarget?e.jsx(L,{className:"text-[9px] bg-green-100 text-green-800 ml-1",children:"â erreicht"}):e.jsxs(L,{variant:"secondary",className:"text-[9px] ml-1",children:["à nicht erreicht (",l(a.totalQualifiedRevenue)," / ",l(i.target_bonus_threshold),")"]})]}),e.jsx("span",{className:"font-mono font-bold",children:l(a.targetBonus)})]}),e.jsx("div",{className:"h-px bg-border my-1"}),e.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[e.jsx("span",{children:"SaaS-Provision (mtl.)"}),e.jsx("span",{className:"font-mono",children:l(a.totalSaasCommission)})]}),e.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[e.jsx("span",{children:"Absc
1hlussbonus"}),e.jsx("span",{className:"font-mono",children:l(a.totalAbschlussbonus)})]}),e.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[e.jsx("span",{children:"Payment Core"}),e.jsx("span",{className:"font-mono",children:l(a.totalPaymentCore)})]}),e.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[e.jsx("span",{children:"Payment High-Margin"}),e.jsx("span",{className:"font-mono",children:l(a.totalPaymentHighMargin)})]}),e.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[e.jsx("span",{children:"Onboarding"}),e.jsx("span",{className:"font-mono",children:l(a.totalOnboarding)})]}),e.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[e.jsx("span",{children:"Hardware"}),e.jsx("span",{className:"font-mono",children:l(a.totalHardware)})]}),a.acceleratorPercent>0&&e.jsxs("div",{className:"flex justify-between text-xs text-green-700",children:[e.jsxs("span",{children:["Accelerator (+",a.acceleratorPercent,"%)"]}),e.jsx("span",{className:"font-mono",children:l(a.acceleratorBonus)})]}),e.jsxs("div",{className:"flex justify-between text-muted-foreground",children:[e.jsxs("span",{children:["Provision gesamt ",!a.meetsPayGate&&"(gesperrt)"]}),e.jsx("span",{className:`font-mono font-bold ${a.meetsPayGate?"":"line-through text-muted-foreground"}`,children:l(a.subtotal+a.acceleratorBonus)})]}),e.jsx("div",{className:"h-px bg-border my-1"}),e.jsxs("div",{className:"flex justify-between text-lg font-bold",children:[e.jsx("span",{children:"Gesamtverdienst"}),e.jsx("span",{className:"font-mono text-primary",children:l(a.totalEarnings)})]}),e.jsxs("div",{className:"text-[10px] text-muted-foreground mt-2",children:[a.totalDeals," Deals | ",a.totalDeals-a.freeDeals>0?a.totalDeals-a.freeDeals:0," provisionsfähig | Qual. Umsatz: ",l(a.totalQualifiedRevenue)]})]})]})]}),e.jsx(ce,{value:"archive",children:e.jsx("div",{className:"bg-card rounded-xl border",children:ge?e.jsx("div",{className:"py-12 text-center text-muted-foreground",children:"Ladenâ¦"}):S.length===0?e.jsxs("div",{className:"py-12 text-center text-muted-foreground",children:[e.jsx(Pe,{className:"h-8 w-8 mx-auto mb-2 opacity-40"}),e.jsx("p",{children:"Noch keine gespeicherten Berechnungen."}),e.jsx("p",{className:"text-xs mt-1",children:'Nutze den Rechner und klicke âMonat speichern".'})]}):e.jsx("div",{className:"divide-y",children:S.map(s=>e.jsxs("div",{className:"p-4 flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"font-medium text-foreground",children:w(new Date(s.month),"MMMM yyyy",{locale:ie})}),e.jsxs("div",{className:"flex flex-wrap gap-3 mt-1 text-xs text-muted-foreground",children:[e.jsxs("span",{children:[s.total_deals," Deals"]}),e.jsxs("span",{children:["Provision: ",l(Number(s.total_commission))]}),e.jsxs("span",{children:["Bonus: ",l(Number(s.target_bonus))]}),e.jsxs("span",{className:"font-semibold text-foreground",children:["Gesamt: ",l(Number(s.total_earnings))]})]})]}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[e.jsx(b,{size:"sm",variant:"outline",className:"text-xs",onClick:()=>Ie(s),children:"Laden"}),e.jsx(b,{size:"sm",variant:"ghost",className:"text-destructive h-8 w-8 p-0",onClick:()=>Qe(s.id),children:e.jsx(cs,{size:14})})]})]},s.id))})})}),e.jsx(ce,{value:"trends",children:ge?e.jsx("div",{className:"py-12 text-center text-muted-foreground",children:"Ladenâ¦"}):D.length<2?e.jsxs("div",{className:"bg-card rounded-xl border py-12 text-center text-muted-foreground",children:[e.jsx(Se,{className:"h-8 w-8 mx-auto mb-2 opacity-40"}),e.jsx("p",{children:"Mindestens 2 gespeicherte Monate nötig für Trendanalyse."})]}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"bg-card rounded-xl border p-5",children:[e.jsx("h3",{className:"text-sm font-bold uppercase tracking-wide text-muted-foreground mb-4",children:"Verdienst-Entwicklung"}),e.jsx("div",{className:"h-64",children:e.jsx(Re,{width:"100%",height:"100%",children:e.jsxs(ze,{data:D,children:[e.jsx(Te,{strokeDasharray:"3 3",className:"opacity-30"}),e.jsx(Be,{dataKey:"month",tick:{fontSize:11}}),e.jsx(Le,{tick:{fontSize:11}
1,tickFormatter:s=>`${(s/1e3).toFixed(1)}k`}),e.jsx(Ae,{formatter:s=>l(s)}),e.jsx(hs,{wrapperStyle:{fontSize:12}}),e.jsx(de,{dataKey:"Provision",fill:"hsl(var(--primary))",radius:[4,4,0,0]}),e.jsx(de,{dataKey:"Bonus",fill:"hsl(142, 76%, 36%)",radius:[4,4,0,0]})]})})})]}),e.jsxs("div",{className:"bg-card rounded-xl border p-5",children:[e.jsx("h3",{className:"text-sm font-bold uppercase tracking-wide text-muted-foreground mb-4",children:"Deals pro Monat"}),e.jsx("div",{className:"h-48",children:e.jsx(Re,{width:"100%",height:"100%",children:e.jsxs(ze,{data:D,children:[e.jsx(Te,{strokeDasharray:"3 3",className:"opacity-30"}),e.jsx(Be,{dataKey:"month",tick:{fontSize:11}}),e.jsx(Le,{tick:{fontSize:11}}),e.jsx(Ae,{}),e.jsx(de,{dataKey:"Deals",fill:"hsl(var(--primary))",radius:[4,4,0,0]})]})})})]}),e.jsxs("div",{className:"bg-card rounded-xl border p-5",children:[e.jsx("h3",{className:"text-sm font-bold uppercase tracking-wide text-muted-foreground mb-4",children:"Monatsvergleich"}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b",children:[e.jsx("th",{className:"text-left p-2",children:"Monat"}),e.jsx("th",{className:"text-right p-2",children:"Deals"}),e.jsx("th",{className:"text-right p-2",children:"Provision"}),e.jsx("th",{className:"text-right p-2",children:"Bonus"}),e.jsx("th",{className:"text-right p-2 font-bold",children:"Gesamt"})]})}),e.jsx("tbody",{children:D.map((s,n)=>e.jsxs("tr",{className:"border-b border-border/50",children:[e.jsx("td",{className:"p-2 font-medium",children:s.month}),e.jsx("td",{className:"p-2 text-right font-mono",children:s.Deals}),e.jsx("td",{className:"p-2 text-right font-mono",children:l(s.Provision)}),e.jsx("td",{className:"p-2 text-right font-mono",children:l(s.Bonus)}),e.jsx("td",{className:"p-2 text-right font-mono font-bold",children:l(s.Verdienst)})]},n))})]})})]})]})})]})]})};export{Ss 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.