PageSourceSearch

https://hyscore.io/assets/admin.statistics.contact-actions-C3NAHx55.js

js hyscore.io collected 2026-10-01 11:36:33 UTC 10,425 bytes, 2 lines download raw bytes

1import{a3 as ee,a4 as te,a5 as se,r,b as ae,f as ne,j as e,E as S,I as re}from"./index-DfAU25pB.js";import{C as g,c as p,a as b,b as N}from"./card-BkdHWbbX.js";import{T as oe,a as ie,b as F,c as k,d as le,e as f}from"./table-CptRuMYt.js";import{C as I,a as M}from"./action-kinds-CoB1ffPf.js";import{R as ce,C as de,X as me,Y as xe,T as ue,L as he,B as P}from"./generateCategoricalChart-DpcALo47.js";import{B as ge}from"./BarChart-BSnMhn0X.js";import"./index-C7yKKq-w.js";const pe=ee({method:"POST"}).middleware([te]).handler(se("d5ead71a1c33f43bba7671442d58d235c1af4a56219e1584867c8e9607082ffd")),c=new Intl.NumberFormat("de-DE"),T=new Intl.DateTimeFormat("de-DE",{day:"2-digit",month:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit"}),fe=["Januar","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"];function ye(){const d=new Date,[A,W]=r.useState(d.getFullYear()),[w,q]=r.useState(d.getMonth()+1),[K,H]=r.useState(""),[j,_]=r.useState("all"),[v,U]=r.useState("total"),[R,O]=r.useState(!1),[y,J]=r.useState(25),[X,m]=r.useState(1),$=-d.getTimezoneOffset(),G=ae(pe),n=ne({queryKey:["contact-actions",A,w,$],queryFn:()=>G({data:{year:A,month:w,tzOffsetMinutes:$}}),staleTime:6e4}),Q=r.useMemo(()=>{const t=[],s=new Date(d.getFullYear(),d.getMonth(),1);for(let o=0;o<24;o++){const a=new Date(s.getFullYear(),s.getMonth()-o,1);t.push({label:`${fe[a.getMonth()]} ${a.getFullYear()}`,year:a.getFullYear(),month:a.getMonth()+1})}return t},[d.getFullYear(),d.getMonth()]),B=n.data?.rows??[],L=r.useMemo(()=>new Intl.Collator("de-DE",{sensitivity:"base"}),[]),x=r.useMemo(()=>{const t=K.trim().toLowerCase();let s=B;return j!=="all"&&(s=s.filter(a=>(a.by_kind[j]??0)>0)),t&&(s=s.filter(a=>a.name.toLowerCase().includes(t)||(a.company??"").toLowerCase().includes(t)||(a.email??"").toLowerCase().includes(t))),[...s].sort((a,h)=>{let i=0;return v==="total"?i=a.total-h.total:v==="name"?i=L.compare(a.name,h.name):v==="company"?i=L.compare(a.company??"",h.company??""):i=a.last_at.localeCompare(h.last_at),R?i:-i})},[B,K,j,v,R,L]),D=Math.max(1,Math.ceil(x.length/y)),u=Math.min(X,D),Y=x.slice((u-1)*y,u*y),z=r.useMemo(()=>I.filter(t=>(n.data?.totals[t]??0)>0),[n.data]),V=r.useMemo(()=>x.reduce((t,s)=>t+s.total,0),[x]),C=t=>{v===t?O(s=>!s):(U(t),O(t==="name"||t==="company")),m(1)},Z=()=>{const t=z,o=[["Kontakt","Firma","E-Mail","Aktionen gesamt",...t.map(l=>M[l]),"Erste Aktion","Letzte Aktion"].join(";")];for(const l of x)o.push([l.name,l.company??"",l.email??"",String(l.total),...t.map(E=>String(l.by_kind[E]??0)),T.format(new Date(l.first_at)),T.format(new Date(l.last_at))].map(E=>`"${E.replace(/"/g,'""')}"`).join(";"));const a=new Blob(["\uFEFF"+o.join(`\r
2`)],{type:"text/csv;charset=utf-8;"}),h=URL.createObjectURL(a),i=document.createElement("a");i.href=h,i.download=`kontakte-aktionen-${A}-${String(w).padStart(2,"0")}.csv`,i.click(),URL.revokeObjectURL(h)};return e.jsxs("div",{className:"w-full space-y-6 p-6",children:[e.jsxs("div",{className:"flex flex-wrap items-end justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-semibold",children:"Kontakte mit Aktionen"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Alle Kontakte mit mindestens einer Aktivität im gewählten Monat. Als Aktion zählt jede Aktivität (E-Mails, Öffnungen, Klicks, Landingpages, Notizen, Aufgaben, Termine, Abwesenheiten und Datenänderungen)."})]}),e.jsxs("div",{className:"flex items-end gap-2",children:[e.jsxs("label",{className:"text-sm",children:[e.jsx("span",{className:"mb-1 block text-muted-foreground",children:"Monat"}),e.jsx("select",{className:"h-9 rounded-md border border-input bg-background px-2 text-sm",value:`${A}-${w}`,onChange:t=>{const[s,o]=t.target.value.split("-").map(Number);W(s),q(o),m(1)},children:Q.map(t=>e.jsx("option",{value:`${t.year}-${t.month}`,children:t.label},`${t.year}-${t.month}`))})]}),e.jsx(S,{variant:"outline",onClick:Z,disabled:x.length===0,children:"CSV exportieren"})]})]}),n.isError&&e.jsx(g,{children:e.jsx(p,{className:"p-4 text-sm text-destructive",children:"Der Report konnte nicht geladen werden. Bitte die Seite neu laden."})}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-3",children:[e.jsxs(g,{children:[e.jsx(b,{className:"pb-2",children:e.jsx(N,{className:"text-sm text-muted-foreground",children:"Kontakte mit Aktionen"})}),e.jsx(p,{className:"text-3xl font-semibold",children:n.isLoading?"…":c.format(n.data?.contactsWithActions??0)})]}),e.jsxs(g,{children:[e.jsx(b,{className:"pb-2",children:e.jsx(N,{className:"text-sm text-muted-foreground",children:"Aktionen gesamt"})}),e.jsx(p,{className:"text-3xl font-semibold",children:n.isLoading?"…":c.format(n.data?.total??0)})]}),e.jsxs(g,{children:[e.jsx(b,{className:"pb-2",children:e.jsx(N,{className:"text-sm text-muted-foreground",children:"Ø Aktionen pro Kontakt"})}),e.jsx(p,{className:"text-3xl font-semibold",children:n.isLoading?"…":(n.data?.contactsWithActions??0)===0?"0":((n.data?.total??0)/(n.data?.contactsWithActions??1)).toLocaleStr
2ing("de-DE",{minimumFractionDigits:1,maximumFractionDigits:1})})]})]}),e.jsxs(g,{children:[e.jsx(b,{className:"pb-2",children:e.jsx(N,{className:"text-base",children:"Aktionen pro Tag"})}),e.jsx(p,{className:"h-72",children:e.jsx(ce,{width:"100%",height:"100%",children:e.jsxs(ge,{data:n.data?.series??[],children:[e.jsx(de,{strokeDasharray:"3 3",stroke:"var(--border)"}),e.jsx(me,{dataKey:"key",tickFormatter:t=>t.slice(8),stroke:"var(--muted-foreground)",fontSize:12}),e.jsx(xe,{stroke:"var(--muted-foreground)",fontSize:12,allowDecimals:!1}),e.jsx(ue,{cursor:{fill:"color-mix(in oklab, var(--foreground) 10%, transparent)"},content:({active:t,payload:s,label:o})=>!t||!s||s.length===0?null:e.jsxs("div",{className:"min-w-52 rounded-lg border border-border bg-popover p-3 text-popover-foreground shadow-lg",children:[e.jsx("div",{className:"mb-2 border-b border-border pb-1.5 text-xs font-semibold",children:T.format(new Date(String(o)+"T12:00:00")).slice(0,10)}),e.jsx("div",{className:"flex flex-col gap-1",children:s.map(a=>e.jsxs("div",{className:"flex items-center justify-between gap-4 text-xs",children:[e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"inline-block size-2.5 rounded-[3px]",style:{backgroundColor:a.color}}),e.jsx("span",{children:a.dataKey==="contacts"?"Kontakte":"Aktionen"})]}),e.jsx("span",{className:"tabular-nums font-semibold",children:c.format(Number(a.value??0))})]},String(a.dataKey)))})]})}),e.jsx(he,{verticalAlign:"top",height:28,formatter:t=>e.jsx("span",{style:{color:"var(--foreground)",fontSize:12},children:t})}),e.jsx(P,{dataKey:"count",name:"Aktionen",fill:"var(--chart-1)",radius:[4,4,0,0]}),e.jsx(P,{dataKey:"contacts",name:"Kontakte",fill:"var(--chart-2)",radius:[4,4,0,0]})]})})})]}),e.jsxs(g,{children:[e.jsx(b,{className:"pb-2",children:e.jsx(N,{className:"text-base",children:"Aktionen nach Art"})}),e.jsxs(p,{className:"p-0",children:[z.length===0&&e.jsx("span",{className:"block px-6 py-4 text-sm text-muted-foreground",children:n.isLoading?"Wird geladen …":"Keine Aktionen in diesem Monat."}),e.jsx("div",{className:"divide-y divide-border",children:z.map(t=>e.jsxs("button",{type:"button",onClick:()=>{_(s=>s===t?"all":t),m(1)},className:`flex w-full items-center justify-between gap-4 px-6 py-2.5 text-left text-sm transition-colors hover:bg-muted/60 ${j===t?"bg-muted font-medium text-foreground":"text-foreground"}`,children:[e.jsx("span",{children:M[t]}),e.jsx("span",{className:"tabular-nums font-medium",children:c.format(n.data?.totals[t]??0)})]},t))})]})]}),e.jsxs(g,{children:[e.jsxs(b,{className:"flex flex-row flex-wrap items-center justify-between gap-3 pb-2",children:[e.jsxs(N,{className:"text-base",children:["Kontakte (",c.format(x.length)," · ",c.format(V)," ","Aktionen)"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[j!=="all"&&e.jsxs(S,{variant:"ghost",size:"sm",onClick:()=>_("all"),children:["Filter „",M[j],"“ entfernen"]}),e.jsx(re,{value:K,onChange:t=>{H(t.target.value),m(1)},placeholder:"Name, Firma oder E-Mail suchen",className:"w-64"}),e.jsx("select",{className:"h-9 rounded-md border border-input bg-background px-2 text-sm",value:y,onChange:t=>{J(Number(t.target.value)),m(1)},children:[25,50,100,250].map(t=>e.jsxs("option",{value:t,children:[t," pro Seite"]},t))})]})]}),e.jsxs(p,{className:"space-y-3",children:[e.jsx("div",{className:"overflow-x-auto",children:e.jsxs(oe,{children:[e.jsx(ie,{children:e.jsxs(F,{children:[e.jsx(k,{className:"cursor-pointer",onClick:()=>C("name"),children:"Kontakt"}),e.jsx(k,{className:"cursor-pointer",onClick:()=>C("company"),children:"Firma"}),e.jsx(k,{className:"w-28 cursor-pointer text-right",onClick:()=>C("total"),children:"Aktionen"}),e.jsx(k,{children:"Aufschlüsselung"}),e.jsx(k,{className:"w-40 cursor-pointer",onClick:()=>C("last"),children:"Letzte Aktion"})]})}),e.jsxs(le,{children:[n.isLoading&&e.jsx(F,{children:e.jsx(f,{colSpan:5,className:"text-sm text-muted-foreground",children:"Wird geladen …"})}),!n.isLoading&&Y.length===0&&e.jsx(F,{children:e.jsx(f,{colSpan:5,className:"text-sm text-muted-foreground",children:"Keine Kontakte mit Aktionen gefunden."})}),Y.map(t=>e.jsxs(F,{children:[e.jsxs(f,{children:[e.jsx("div",{className:"font-medium",children:t.name}),t.email&&e.jsx("div",{className:"text-xs text-muted-foreground",children:t.email})]}),e.jsx(f,{className:"text-sm",children:t.company??"—"}),e.jsx(f,{className:"text-right font-medium",children:c.format(t.total)}),e.jsx(f,{className:"align-top",children:e.jsx("div",{className:"flex flex-col gap-0.5 text-xs",children:I.filter(s=>(t.by_kind[s]??0)>0).map(s=>e.jsxs("div",{className:"flex justify-between gap-3",children:[e.jsx("span",{className:"text-muted-foreground",children:M[s]}),e.jsx("span",{className:"tabular-nums",children:c.format(t.by_kind[s]??0)})]},s))})}),e.jsx(f,{className:"text-sm",children:T.format(new Date(t.last_at))})]},t.contact_id))]})]})}),e.jsxs("div",{className:"flex items-center justify-between text-sm text-muted-foreground",children:[e.jsxs("span",{children:["Seite ",u," von ",D]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(S,{variant:"outline",size:"sm",disabled:u<=1,onClick:()=>m(u-1),children:"Zurück"}),e.jsx(S,{variant:"outline",size:"sm",disabled:u>=D,onClick:()=>m(u+1),children:"Weiter"})]})]})]})]})]})}export{ye as component};

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.