PageSourceSearch

https://hesatek-ajanvaraus.com/assets/analytiikka.palaute-vAVio-bf.js

js hesatek-ajanvaraus.com collected 2026-10-09 22:04:10 UTC 8,660 bytes, 1 lines download raw bytes

1import{u as N,i as y,r as o,l as e,n as g,L as v}from"./index-BdD0LGg8.js";import{A as k}from"./AnalyticsShell-Dz-mhNTa.js";import{l as w}from"./feedback.functions-THtA4rZL.js";import{S as E}from"./star-dgp0v9GP.js";function u({value:l}){return l?e.jsx("span",{className:"inline-flex items-center gap-0.5","aria-label":`${l} / 5`,children:[1,2,3,4,5].map(s=>e.jsx(E,{className:g("h-3.5 w-3.5",s<=l?"fill-amber-400 text-amber-400":"text-muted-foreground/30")},s))}):e.jsx("span",{className:"text-muted-foreground",children:"—"})}function c(l){const s=l.map(r=>r.rating).filter(r=>typeof r=="number");return s.length===0?"—":(s.reduce((r,i)=>r+i,0)/s.length).toFixed(2).replace(".",",")}function h(l){return l?new Date(l).toLocaleDateString("fi-FI",{day:"numeric",month:"numeric",year:"numeric",timeZone:"Europe/Helsinki"}):"—"}function p({title:l,groups:s}){return e.jsxs("section",{className:"rounded-lg border border-border bg-card p-4 sm:p-6",children:[e.jsx("h2",{className:"text-base font-semibold tracking-tight text-foreground",children:l}),e.jsx("div",{className:"mt-3 grid gap-2 sm:hidden",children:s.length===0?e.jsx("p",{className:"py-2 text-sm text-muted-foreground",children:"Ei palautteita."}):s.map(r=>e.jsxs("div",{className:"rounded-lg border border-border bg-background p-3",children:[e.jsx("div",{className:"min-w-0 text-sm font-medium leading-snug text-foreground",children:r.key}),e.jsxs("div",{className:"mt-2 flex items-center justify-between text-xs text-muted-foreground",children:[e.jsxs("span",{children:[r.rows.length," palautetta"]}),e.jsxs("span",{className:"font-semibold tabular-nums text-foreground",children:["ka. ",c(r.rows)]})]})]},r.key))}),e.jsxs("table",{className:"mt-3 hidden w-full text-sm sm:table",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b text-left text-[11px] text-muted-foreground",children:[e.jsx("th",{className:"py-2 font-medium",children:"Nimi"}),e.jsx("th",{className:"py-2 text-right font-medium",children:"Palautteita"}),e.jsx("th",{className:"py-2 text-right font-medium",children:"Keskiarvo"})]})}),e.jsx("tbody",{children:s.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:3,className:"py-4 text-muted-foreground",children:"Ei palautteita."})}):s.map(r=>e.jsxs("tr",{className:"border-b last:border-0",children:[e.jsx("td",{className:"py-2",children:r.key}),e.jsx("td",{className:"py-2 text-right",children:r.rows.length}),e.jsx("td",{className:"py-2 text-right font-semibold",children:c(r.rows)})]},r.key))})]})]})}function M(){const l=N(w),{data:s,isLoading:r}=y({queryKey:["admin-feedback"],queryFn:()=>l()}),[i,f]=o.useState("all"),m=o.useMemo(()=>s?.authorized?s.rows.filter(t=>t.submittedAt):[],[s]),n=o.useMemo(()=>i==="all"?m:m.filter(t=>t.kind===i),[m,i]),j=o.useMemo(()=>{const t=new Map;for(const a of n){const d=a.sellerName??"Ei myyjää";t.set(d,[...t.get(d)??[],a])}return[...t.entries()].map(([a,d])=>({key:a,rows:d})).sort((a,d)=>d.rows.length-a.rows.length)},[n]),b=o.useMemo(()=>{const t=new Map;for(const a of n)t.set(a.serviceLabel,[...t.get(a.serviceLabel)??[],a]);return[...t.entries()].map(([a,d])=>({key:a,rows:d})).sort((a,d)=>d.rows.length-a.rows.length)},[n]),x=s?.authorized?s.rows.length:0;return e.jsx(k,{children:e.jsxs("div",{className:"space-y-6 p-4 sm:p-6",children:[e.jsxs("header",{className:"grid grid-cols-1 items-end gap-3 sm:grid-cols-[minmax(0,1fr)_auto]",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("h1",{className:"text-2xl font-bold",children:"Asiakaspalautteet"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Kartoitusten ja huoltojen palautteet myyjä- ja palvelukohtaisesti."})]}),e.jsx("div",{className:"grid grid-cols-3 rounded-md bg-muted p-1 sm:inline-flex sm:items-center",role:"group","aria-label":"Palautetyyppi",children:["all","kartoitus","huolto"].map(t=>e.jsx("button",{type:"button",onClick:()=>f(t),"aria-pressed":i===t,className:g("h-8 min-w-0 rounded-lg px-2 text-xs font-semibold leading-none transition-colors duration-200 [@media(pointer:coarse)]:h-11 sm:px-3",i===t?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground"),children:t==="all"?"Kaikki":t==="kartoitus"?"Kartoitukset":"Huollot"},t))})]}),r?e.jsx("div",{className:"flex justify-center py-16",children:e.jsx(v,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):s?.authorized?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid gap-4 sm:grid-cols-3",children:[e.jsxs("div",{className:"rounded-lg border border-border bg-card p-4",children:[e.jsx("p",{className:"text-[13px] font-semibold leading-5 text-foreground",children:"Keskiarvo"}),e.jsx("p",{className:"mt-4 text-[28px] font-bold leading-none tracking-[-0.035em] tabular-nums text-foreground sm:text-[32px]",children:c(n)})]}),e.jsxs("div",{className:"rounded-lg border border-border bg-card p-4",children:[e.jsx("p",{className:"text-[13px] font-semibold leading-5 text-foreground",children:"Vastauksia"}),e.jsx("p",{className:"mt-4 text-[28px] font-bold leading-none tracking-[-0.035em] tabular-nums text-foreground sm:text-[32px]",children:n.length})]}),e.jsxs("div",{className:"rounded-lg border border-border bg-card p-4",children:[e.jsx("p",{className:"text-[13px] font-semibold leading-5 text-foreground",children:"Vastausprosentti"}),e.jsx("p",{className:"mt-4 text-[28px] font-bold leading-none tracking-[-0.035em] tabular-nums text-foreground sm:text-[32px]",children:x===0?"—":`${Math.round(m.length/x*100)} %`})]})]}),e.jsxs("div",{className:"grid gap-4 lg:grid-cols-2",children:[e.jsx(p,{title:"Myyjittäin",groups:j}),e.jsx(p,{title:"Palveluittain",groups:b})]}),e.jsxs("section",{className:"rounded-lg border border-border bg-card p-4 sm:p-6",children:[e.jsx("h2",{className:"text-base font-semibold tracking-tight text-foreground",children:"Kaikki palautteet"}),e.jsx("div",{className:"mt-3 grid gap-3 sm:hidden",children:n.length===0?e.jsx("p",{className:"py-2 text-sm text-muted-foreground",children:"Ei palautteita vielä."}):n.map(t=>e.jsxs("article",{className:"rounded-lg border border-border bg-background p-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-sm font-medium text-foreground",children:t.customerName??"—"}),e.jsxs("div",{className:"mt-0.5 text-xs text-muted-foreground",children:[h(t.submittedAt)," · ",t.kind]})]}),e.jsx(u,{value:t.rating})]}),e.jsx("div",{className:"mt-2 text-sm text-foreground",children:t.serviceLabel}),e.jsx("div",{className:"text-xs text-muted-foreground",children:t.sellerName??"Ei myyjää"}),(t.liked||t.improvement)&&e.jsx("p",{className:"mt-2 text-sm leading-relaxed text-muted-foreground",children:t.liked||t.improvement}),e.jsxs("div",{className:"mt-2 text-xs text-muted-foreground",children:["Referenssilupa: ",t.allowReference===!0?"Kyllä":t.allowReference===!1?"Ei":"—"]})]},t.id))}),e.jsx("div",{className:"mt-3 hidden overflow-x-auto sm:block",children:e.jsxs("table",{className:"w-full min-w-[860px] text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b text-left text-[11px] text-muted-foreground",children:[e.jsx("th",{className:"py-2 font-medium",children:"Päivä"}),e.jsx("th",{className:"py-2 font-medium",children:"Tyyppi"}),e.jsx("th",{className:"py-2 font-medium",children:"Myyjä"}),e.jsx("th",{className:"py-2 font-medium",children:"Palvelu"}),e.jsx("th",{className:"py-2 font-medium",children:"Asiakas"}),e.jsx("th",{className:"py-2 font-medium",children:"Arvosana"}),e.jsx("th",{className:"py-2 font-medium",children:"Kommentti"}),e.jsx("th",{className:"py-2 font-medium",children:"Referenssilupa"})]})}),e.jsx("tbody",{children:n.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:8,className:"py-4 text-muted-foreground",children:"Ei palautteita vielä."})}):n.map(t=>e.jsxs("tr",{className:"border-b align-top last:border-0",children:[e.jsx("td",{className:"py-2 whitespace-nowrap",children:h(t.submittedAt)}),e.jsx("td",{className:"py-2 capitalize",children:t.kind}),e.jsx("td",{className:"py-2",children:t.sellerName??"—"}),e.jsx("td",{className:"py-2",children:t.serviceLabel}),e.jsx("td",{className:"py-2",children:t.customerName??"—"}),e.jsx("td",{className:"py-2 whitespace-nowrap",children:e.jsx(u,{value:t.rating})}),e.jsx("td",{className:"max-w-[320px] py-2 text-muted-foreground",children:t.liked||t.improvement||"—"}),e.jsx("td",{className:"py-2",children:t.allowReference===!0?"Kyllä":t.allowReference===!1?"Ei":"—"})]},t.id))})]})})]})]}):e.jsx("p",{className:"text-sm text-muted-foreground",children:"Ei käyttöoikeutta."})]})})}export{M 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.