PageSourceSearch

https://yovendo.ai/assets/ReportDetail-rmgMelRE.js

js yovendo.ai collected 2026-10-05 14:48:06 UTC 16,286 bytes, 21 lines download raw bytes

1import{a2 as y,H as W,a4 as X,r as b,a as Y,b as ee,c as se,u as re,d as ae,j as e,$ as p,n as h,p as g,f as i,g as n,aP as te,a$ as j,y as l,z as c,b0 as B,aL as ie}from"./index-Dbzkh-cK.js";import{L as ne}from"./list-checks-BBIr4BB0.js";/**
2 * @license lucide-react v0.488.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const oe=[["path",{d:"M13 17V9",key:"1fwyjl"}],["path",{d:"M18 17V5",key:"sfb6ij"}],["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M8 17v-3",key:"17ska0"}]],le=y("chart-column-increasing",oe);/**
7 * @license lucide-react v0.488.0 - ISC
8 *
9 * This source code is licensed under the ISC license.
10 * See the LICENSE file in the root directory of this source tree.
11 */const ce=[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]],de=y("message-circle",ce);/**
12 * @license lucide-react v0.488.0 - ISC
13 *
14 * This source code is licensed under the ISC license.
15 * See the LICENSE file in the root directory of this source tree.
16 */const me=[["path",{d:"M6 9H4.5a2.5 2.5 0 0 1 0-5H6",key:"17hqa7"}],["path",{d:"M18 9h1.5a2.5 2.5 0 0 0 0-5H18",key:"lmptdp"}],["path",{d:"M4 22h16",key:"57wxv0"}],["path",{d:"M10 14.66V17c0 .55-.47.98-.97 1.21C7.85 18.75 7 20.24 7 22",key:"1nw9bq"}],["path",{d:"M14 14.66V17c0 .55.47.98.97 1.21C16.15 18.75 17 20.24 17 22",key:"1np0yb"}],["path",{d:"M18 2H6v7a6 6 0 0 0 12 0V2Z",key:"u46fv3"}]],G=y("trophy",me);function xe(){var I,S,k,T,E,A,C,$,M,R,D,L,_,P,F,q,H,O,Q;const d=W()[1],[w,m]=X("/report-detail/:id"),[x,J]=b.useState(null),{toast:o}=Y(),K=ee(),{hasPermission:z}=se();b.useEffect(()=>{z("view_reports")||(o({title:"Accesso non autorizzato",description:"Non hai i permessi per accedere a questa sezione",variant:"destructive"}),d("/dashboard"))},[z,d,o]),b.useEffect(()=>{w&&(m!=null&&m.id)?J(m.id):(o({title:"Errore",description:"Pagina non trovata",variant:"destructive"}),d("/reports"))},[w,d,m,o]);const{data:v,isLoading:U,error:N}=re({queryKey:["/api/performance/reports",x],queryFn:async()=>{if(!x)throw new Error("ID report non valido");const r=localStorage.getItem("auth_token"),a=await fetch(`/api/performance/reports/${x}`,{headers:{Authorization:`Bearer ${r}`,"Content-Type":"application/json"}});if(!a.ok)throw new Error(`Errore nel caricamento del report: ${a.status}`);return a.json()},enabled:!!x});if(ae({mutationFn:async r=>{const a=localStorage.getItem("auth_token"),V={};a&&(V.Authorization=`Bearer ${a}`);const Z=await fetch(`/api/performance/reports/${r}`,{method:"DELETE",headers:V});if(!Z.ok)throw new Error("Errore durante l'eliminazione del report");return await Z.json()},onSuccess:()=>{o({title:"Report eliminato",description:"Il report è stato eliminato con successo"}),K.invalidateQueries({queryKey:["/api/performance/reports"]}),d("/reports")},onError:r=>{o({title:"Errore",description:`Impossibile eliminare il report: ${r instanceof Error?r.message:"Errore sconosciuto"}`,variant:"destructive"})}}),U)return e.jsxs("div",{className:"flex-1 overflow-y-auto bg-neutral-100 p-6",children:[e.jsxs("div",{className:"flex justify-between items-center mb-6 bg-white py-4 px-6 border-b shadow-sm rounded-lg",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold text-neutral-800",children:"Caricamento report..."}),e.jsx("p",{className:"text-neutral-500",children:"Recupero dei dati del report in corso"})]}),e.jsx(p,{to:"/agent-reports",children:e.jsxs(h,{variant:"outline",className:"flex items-center",children:[e.jsx(g,{className:"h-4 w-4 mr-2"}),"Torna ai Report"]})})]}),e.jsxs("div",{className:"animate-pulse space-y-4",children:[e.jsx("div",{className:"h-40 bg-gray-200 rounded-lg w-full"}),e.jsx("div",{className:"h-60 bg-gray-200 rounded-lg w-full"}),e.jsx("div",{className:"h-60 bg-gray-200 rounded-lg w-full"})]})]});if(N)return e.jsxs("div",{className:"flex-1 overflow-y-auto bg-neutral-100 p-6",children:[e.jsxs("div",{className:"flex justify-between items-center mb-6 bg-white py-4 px-6 border-b shadow-sm rounded-lg",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold text-neutral-800",children:"Errore"}),e.jsx("p",{className:"text-neutral-500",children:"Si è verificato un errore durante il caricamento del report"})]}),e.jsx(p,{to:"/agent-reports",children:e.jsxs(h,{variant:"outline",className:"flex items-center",children:[e.jsx(g,{className:"h-4 w-4 mr-2"}),"Torna ai Report"]})})]}),e.jsx(i,{className:"border-red-200 bg-red-50 shadow-sm",children:e.jsx(n,{className:"py-6",children:e.jsx("p",{className:"text-red-700",children:N instanceof Error?N.message:"Errore durante il caricamento del report. Riprova più tardi."})})})]});if(!v||!v.report)return e.jsxs("div",{className:"flex-1 overflow-y-auto bg-neutral-100 p-6",children:[e.jsxs("div",{className:"flex justify-between items-center mb-6 bg-white py-4 px-6 border-b shadow-sm rounded-lg",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold text-neutral-800",children:"Report non trovato"}),e.jsx("p",{className:"text-neutral-500",children:"Il report richiesto non esiste o è stato eliminato"})]}),e.jsx(p,{to:"/agent-reports",children:e.jsxs(h,{variant:"outline",className:"flex items-center",children:[e.jsx(g,{className:"h-4 w-4 mr-2"}),"Torna ai Report"]})})]}),e.jsx(i,{className:"shadow-sm",children:e.jsxs(n,{className:"py-6 text-center",children:[e.jsx("p",{className:"text-neutral-600 mb-4",children:"Non è stato possibile trovare il report richiesto."}),e.jsx(p,{to:"/reports",children:e.jsx(h,{children:"Visualizza tutti i report"})})]})})]});const t=v.report,u=r=>{if(!r)return[];if(Array.isArray(r))return r;try{return JSON.parse(r)}catch{return[]}},f=r=>{if(!r)return null;if(r instanceof Date)return r;try{const a=new Date(r);return isNaN(a.getTime())?null:a}catch{return null}},s={...t,strengths:u(t.strengths),weaknesses:u(t.weaknesses),areasToImprove:u(t.areas_to_improve||t.areasToImprove),improvementSuggestions:u(t.improvement_suggestions||t.improvementSuggestions),suggestedActions:t.suggestedActions,periodStart:f(t.periodStart),periodEnd:f(t.periodEnd),createdAt:f(t.createdAt)};return console.log(s),e.jsxs("div",{className:"flex-1 overflow-y-auto bg-neutral-100 p-6",children:[e.jsxs("div",{className:"flex justify-between items-center mb-6 fixed top-0 left-72 right-0 z-30 bg-white py-4 px-6 border-b shadow-sm",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"h-12 w-12 rounded-full bg-primary flex items-center justify-center text-white",children:(I=s.agentInfo)!=null&&I.fullName?s.agentInfo.fullName.split(" ").map(r=>r[0]).join(""):e.jsx(te,{className:"h-6 w-6"})}),e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl font-bold text-neutral-800",children:["Report Performance: ",((S=s.agentInfo)==null?void 0:S.fullName)||`Agente ID: ${s.agentId}`]}),e.jsxs("p",{className:"text-neutral-500",children:["Periodo: ",j(s.periodStart)," - ",j(s.periodEnd)," • ",s.callsAnalyzed||s.totalCallsAnalyzed," chiamate analizzate"]})]})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(p,{to:"/agent-reports",children:e.jsxs(h,{variant:"outline",className:"flex items-center",children:[e.jsx(g,{className:"h-4 w-4 mr-2"}),"Torna ai Report"]})})})]}),e.jsxs("div",{className:"space-y-6 pt-24",children:[e.jsxs(i,{className:"border-purple-100 shadow-sm",children:[e.jsx(l,{className:"pb-2 bg-purple-50 dark:bg-purple-900/10 rounded-t-lg",children:e.jsxs(c,{className:"flex items-center text-purple-700 dark:text-purple-300",children:[e.jsx(de,{className:"h-5 w-5 mr-2"}),"Commento Dettagliato"]})}),e.jsx(n,{className:"pt-4",children:e.jsx("div",{className:"prose prose-gray max-w-none",children:e.jsx("div",{className:"whitespace-pre-line",children:s.detailedAnalysis?e.jsx("div",{dangerouslySetInnerHTML:{__html:s.detailedAnalysis.replace(/\n## /g,'<h3 class="mt-4 mb-2 text-lg font-medium">').replace(/\n# /g,'<h2 class="mt-4 mb-2 text-xl font-semibold">').replace(/\n\*/g,"<br/>*").replace(/\*\*/g,"<strong>").replace(/\n- /g,"<br/>• ").replace(/\n\d\. /g,"<br/>$& ").replace(/✔|❌|🎯/g,'<span class="inline-block font-bold">$&</span>').replace(/### (.*)/g,'<h4 class="mt-3 mb-1 text-md font-medium text-primary">$1</h4>').replace(/\*\*(.*?)\*\*/g,'<span class="font-bold text-primary">$1</span>')}}):e.jsxs("p",{className:"text-muted-foreground",children:["Analisi completa delle trascrizioni delle chiamate nel periodo ",j(s.periodStart)," - ",j(s.periodEnd),".",s.strengths&&s.strengths.length>0?e.jsxs("span",{children:[" ","L'agente ",((k=s.agentInfo)==null?void 0:k.fullName)||`#${s.agentId}`," ha dimostrato"," ",s.strengths[0].description?s.strengths[0].description.toLowerCase():"punti di forza notevoli"]}
16):"",s.weaknesses&&s.weaknesses.length>0?e.jsxs("span",{children:[" ","Tuttavia,"," ",s.weaknesses[0].description?s.weaknesses[0].description.toLowerCase():"sono state rilevate alcune criticità"]}):""]})})})})]}),e.jsxs(i,{className:"border-blue-100 shadow-sm",children:[e.jsx(l,{className:"pb-2 bg-blue-50 dark:bg-blue-900/10 rounded-t-lg",children:e.jsxs(c,{className:"flex items-center text-blue-700 dark:text-blue-300",children:[e.jsx(le,{className:"h-5 w-5 mr-2"}),"SEZIONE 1 – Riepilogo Generale"]})}),e.jsx(n,{className:"pt-4",children:e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4",children:[e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"text-sm text-gray-500",children:"Chiamate analizzate"}),e.jsx("span",{className:"text-lg font-semibold",children:s.totalCallsAnalyzed||s.callsAnalyzed||0})]}),e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"text-sm text-gray-500",children:"Qualità media"}),e.jsx("span",{className:"text-lg font-semibold",children:typeof s.averageQualityScore=="number"?`${s.averageQualityScore.toFixed(1)}/100`:typeof s.overallScore=="number"?`${s.overallScore.toFixed(1)}/100`:"N/D"})]})]})})]}),e.jsxs(i,{className:"border-green-100 shadow-sm",children:[e.jsx(l,{className:"pb-2 bg-green-50 dark:bg-green-900/10 rounded-t-lg",children:e.jsxs(c,{className:"flex items-center text-green-700 dark:text-green-300",children:[e.jsx(G,{className:"h-5 w-5 mr-2"}),"SEZIONE 2 – Punti di Forza"]})}),e.jsx(n,{className:"pt-4",children:e.jsx("ul",{className:"space-y-4",children:s.strengths&&s.strengths.length>0?s.strengths.map((r,a)=>e.jsx("li",{className:"border-b border-gray-100 pb-3 last:border-0",children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(G,{className:"h-5 w-5 text-green-500 mt-1 flex-shrink-0"}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium",children:r.title||"Punto di forza"}),e.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-line",children:r.description||"Dettaglio non disponibile"})]})]})},a)):e.jsx("li",{className:"text-gray-500",children:"Nessun punto di forza registrato"})})})]}),e.jsxs(i,{className:"border-red-100 shadow-sm",children:[e.jsx(l,{className:"pb-2 bg-red-50 dark:bg-red-900/10 rounded-t-lg",children:e.jsxs(c,{className:"flex items-center text-red-700 dark:text-red-300",children:[e.jsx(B,{className:"h-5 w-5 mr-2"}),"SEZIONE 3 – Errori e Criticità"]})}),e.jsx(n,{className:"pt-4",children:e.jsx("ul",{className:"space-y-4",children:s.weaknesses&&s.weaknesses.length>0?s.weaknesses.map((r,a)=>e.jsx("li",{className:"border-b border-gray-100 pb-3 last:border-0",children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(B,{className:"h-5 w-5 text-red-500 mt-1 flex-shrink-0"}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium",children:r.title||"Area critica"}),e.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-line",children:r.description||"Dettaglio non disponibile"})]})]})},a)):e.jsx("li",{className:"text-gray-500",children:"Nessuna criticità rilevata"})})})]}),e.jsxs(i,{className:"border-blue-100 shadow-sm",children:[e.jsx(l,{className:"pb-2 bg-blue-50 dark:bg-blue-900/10 rounded-t-lg",children:e.jsxs(c,{className:"flex items-center text-blue-700 dark:text-blue-300",children:[e.jsx(ie,{className:"h-5 w-5 mr-2"}),"SEZIONE 4 – Cosa Studiare / Migliorare"]})}),e.jsx(n,{className:"pt-4",children:e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium mb-2",children:"Tecniche da migliorare"}),e.jsxs("ul",{className:"space-y-2 ml-7 list-disc",children:[s.improvementSuggestions&&s.improvementSuggestions[0]||s.areasToImprove&&s.areasToImprove[0]?e.jsxs("li",{className:"text-sm",children:[e.jsx("strong",{children:s.improvementSuggestions&&((T=s.improvementSuggestions[0])==null?void 0:T.title)||s.areasToImprove&&((E=s.areasToImprove[0])==null?void 0:E.title)||"Gestione obiezioni"}),":",s.improvementSuggestions&&((A=s.improvementSuggestions[0])==null?void 0:A.description)||s.areasToImprove&&((C=s.areasToImprove[0])==null?void 0:C.description)||"Migliorare la gestione delle obiezioni durante la fase di presentazione del prezzo"]}):e.jsx("li",{className:"text-sm text-muted-foreground",children:"Focus sulla gestione delle obiezioni durante la fase di presentazione del prezzo"}),(s.improvementSuggestions&&s.improvementSuggestions[1]||s.areasToImprove&&s.areasToImprove[1])&&e.jsxs("li",{className:"text-sm",children:[e.jsx("strong",{children:s.improvementSuggestions&&(($=s.improvementSuggestions[1])==null?void 0:$.t
16itle)||s.areasToImprove&&((M=s.areasToImprove[1])==null?void 0:M.title)||"Seconda area"}),":",s.improvementSuggestions&&((R=s.improvementSuggestions[1])==null?void 0:R.description)||s.areasToImprove&&((D=s.areasToImprove[1])==null?void 0:D.description)||"Descrizione seconda area"]})]})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium mb-2",children:"Aspetti vocali"}),e.jsx("ul",{className:"space-y-2 ml-7 list-disc",children:s.improvementSuggestions&&s.improvementSuggestions[2]||s.areasToImprove&&s.areasToImprove[2]?e.jsxs("li",{className:"text-sm",children:[e.jsx("strong",{children:s.improvementSuggestions&&((L=s.improvementSuggestions[2])==null?void 0:L.title)||s.areasToImprove&&((_=s.areasToImprove[2])==null?void 0:_.title)||"Modulazione voce"}),":",s.improvementSuggestions&&((P=s.improvementSuggestions[2])==null?void 0:P.description)||s.areasToImprove&&((F=s.areasToImprove[2])==null?void 0:F.description)||"Migliorare la modulazione vocale per mantenere l'attenzione"]}):e.jsx("li",{className:"text-sm text-muted-foreground",children:"Gestione del ritmo: rallentare nei passaggi importanti e utilizzare pause strategiche"})})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium mb-2",children:"Argomenti tecnici"}),e.jsx("ul",{className:"space-y-2 ml-7 list-disc",children:s.improvementSuggestions&&s.improvementSuggestions[3]||s.areasToImprove&&s.areasToImprove[3]?e.jsxs("li",{className:"text-sm",children:[e.jsx("strong",{children:s.improvementSuggestions&&((q=s.improvementSuggestions[3])==null?void 0:q.title)||s.areasToImprove&&((H=s.areasToImprove[3])==null?void 0:H.title)||"Conoscenza prodotto"}),":",s.improvementSuggestions&&((O=s.improvementSuggestions[3])==null?void 0:O.description)||s.areasToImprove&&((Q=s.areasToImprove[3])==null?void 0:Q.description)||"Approfondire la conoscenza tecnica dei prodotti"]}):e.jsx("li",{className:"text-sm text-muted-foreground",children:"Approfondire la conoscenza dei dettagli tecnici dell'offerta e delle condizioni contrattuali"})})]})]})})]}),e.jsxs(i,{className:"shadow-sm",children:[e.jsx(l,{className:"pb-2",children:e.jsxs(c,{className:"text-md flex items-center",children:[e.jsx(ne,{className:"h-5 w-5 mr-2"}),"Piano d'Azione Consigliato"]})}),e.jsx(n,{children:e.jsx("p",{className:"text-sm whitespace-pre-line",children:s.suggestedActions?JSON.parse(s.suggestedActions).map((r,a)=>e.jsx("span",{children:`${a+1}. ${r.description}
17`},a)):`1. Rivedere insieme al team manager le registrazioni delle chiamate con punteggio più basso
182. Partecipare a una sessione di coaching focalizzata sulla gestione delle obiezioni
193. Esercitarsi con simulazioni di chiamata sui punti critici evidenziati
204. Migliorare l'analisi paraverbale con esercizi di modulazione vocale
215. Implementare un sistema di promemoria per le tecniche da utilizzare nelle prossime chiamate`})})]})]})]})}export{xe 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.