PageSourceSearch

https://callflow.dev/assets/TraineeReviews-QQ04_ZLt.js

js callflow.dev collected 2026-10-08 05:58:17 UTC 10,463 bytes, 2 lines download raw bytes

1import{d as L,r as c,j as e}from"./vendor-react-BejaPDzU.js";import{u as M,s as v,B as z,e as B}from"./index-B6Tyvt9P.js";import{A as w}from"./AppLayout-Nsg2RFJV.js";import{C as t,d as a,a as u,b as h}from"./card-Dl5bEXx2.js";import{B as y}from"./badge-OW0agykM.js";import{S as D}from"./scroll-area-CwM_w71O.js";import{P as I}from"./progress-F-kqFZb8.js";import{u as $,P as E}from"./PaginationControls-COWmSTUQ.js";import{A as H}from"./arrow-left-viqocy51.js";import{C as g}from"./circle-check-C0t50smJ.js";import{S as O}from"./star-6NWsolCO.js";import{M as _}from"./index-CYT-XJPw.js";import{M as S}from"./message-square-DDNSefya.js";import{F as C}from"./file-text-BuwfvdQT.js";import{C as k}from"./calendar-C8paUzPI.js";import{C as G}from"./clock-BJ14rlqt.js";import"./vendor-query-DdyZXiDU.js";import"./vendor-ui--X5BZniO.js";import"./vendor-supabase-FIOcN6HE.js";import"./crown-DuK_wRJT.js";import"./shield-BrfVeZWH.js";import"./user-CI3eJVPv.js";import"./credit-card-BNCInpWV.js";import"./lock-CIxnjdoP.js";import"./dialog-BuASFBqZ.js";import"./index-BAQWsOKG.js";import"./index-aOMPTBki.js";import"./check-5ruikr_P.js";import"./trending-down-Dfyj699h.js";import"./index-BuVK54E4.js";import"./index-DrBC9ePF.js";import"./index-BLB-hL8W.js";import"./circle-DpCXuugA.js";import"./trophy-Chv8EbjU.js";import"./award-ZjIN6ZhU.js";import"./phone-qf_RBItm.js";import"./building-2-DRIne6JZ.js";import"./graduation-cap-CXdt3xTa.js";import"./chart-column-BhxPBFDw.js";import"./settings-wilwGLPn.js";import"./dollar-sign-xW6zi3JC.js";import"./circle-x-KjexKQES.js";import"./users-C4L8Xy2y.js";import"./briefcase-3QIVXJHg.js";import"./mail-Do-P7hm5.js";import"./target-Ch3VcIky.js";import"./send-CfoUftgC.js";import"./zap-C3cOGATG.js";import"./search-Ct9P-NMr.js";import"./paintbrush-bnC3_emt.js";import"./index-BdQq_4o_.js";import"./select-lfjxjYVy.js";import"./index-BH3fl-Co.js";import"./chevron-left-B_h8trOY.js";function Ke(){const{user:l}=M();L();const[m,P]=c.useState([]),[R,j]=c.useState(!0),[o,f]=c.useState(null),[A,F]=c.useState([]),n=$(10);c.useEffect(()=>{l&&T()},[l]);const T=async()=>{j(!0),console.log("[TraineeReviews] Fetching for user:",l.id);const{data:s,error:r}=await v.from("training_sessions").select("*, scenarios(name, difficulty, category), session_scores(overall_score, rapport_building, needs_identification, product_knowledge, objection_handling, closing_technique, ai_feedback, admin_notes, admin_override, scored_by)").eq("user_id",l.id).eq("status","completed").order("created_at",{ascending:!1});console.log("[TraineeReviews] Query result:",{data:s,error:r,count:s?.length}),s?.[0]&&console.log("[TraineeReviews] First session scores:",s[0].session_scores),P(s||[]),j(!1)},b=async s=>{f(s);const{data:r}=await v.from("session_messages").select("*").eq("session_id",s.id).order("created_at");F(r?.filter(p=>p.role!=="system")||[])},x=s=>s>=8?"text-success":s>=6?"text-warning":"text-destructive",i=s=>{if(!s)return null;const r=s.session_scores;return Array.isArray(r)?r[0]:r},q=(()=>{const s=i(o);return s?[{label:"Rapport Building",value:s.rapport_building},{label:"Needs Identification",value:s.needs_identification},{label:"Product Knowledge",value:s.product_knowledge},{label:"Objection Handling",value:s.objection_handling},{label:"Closing Technique",value:s.closing_technique}]:[]})(),N=m.filter(s=>i(s)?.admin_override===!0),d=m.filter(s=>i(s)&&i(s).admin_override!==!0);if(o){const s=i(o);return e.jsx(w,{children:e.jsxs("div",{className:"p-4 md:p-8 max-w-4xl mx-auto space-y-6",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(z,{variant:"ghost",size:"icon",onClick:()=>f(null),className:"text-muted-foreground hover:text-foreground",children:e.jsx(H,{className:"w-4 h-4"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-bold text-foreground",children:o.scenarios?.name}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:[new Date(o.created_at).toLocaleString(),s?.admin_override&&e.jsxs(y,{variant:"outline",className:"ml-2 text-[10px] border-success/30 text-success",children:[e.jsx(g,{className:"w-3 h-3 mr-1"})," Supervisor Reviewed"]})]})]})]}),s?e.jsxs(e.Fragment,{children:[e.jsx(t,{className:"border-2 border-primary/20 bg-card shadow-sm",children:e.jsxs(a,{className:"p-6 text-center",children:[e.jsx("p",{className:"text-sm text-muted-foreground mb-1",children:"Overall Score"}),e.jsxs("p",{className:"text-5xl font-extrabold text-primary",children:[s.overall_score,e.jsx("span",{className:"text-lg text-muted-foreground",children:"/10"})]})]})}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:q.map(r=>e.jsx(t,{className:"border border-border bg-card shadow-sm",children:e.jsxs(a,{className:"p-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-sm font-medium text-foreground",children:r.label}),e.jsxs("span",{className:`font-bold ${r.value?x(r.value):""}`,children:[r.value??"-","/10"]})]}),e.jsx(I,{value:(r.value||0)/10*100,className:"h-1.5"})]})},r.label))}),s.ai_feedback&&e.jsxs(t,{className:"border border-border bg-card shadow-sm",children:[e.jsx(u,{children:e.jsxs(h,{className:"text-base flex items-center gap-2",children:[e.jsx(O,{className:"w-4 h-4 text-warning"})," AI Feedback"]})}),e.jsx(a,{children:e.jsx("div",{className:"prose prose-sm max-w-none",children:e.jsx(_,{children:s.ai_feedback})})})]}),s.admin_notes&&(()=>{const r=s.admin_notes.replace(/<!--RATINGS:.*?-->/,"").trim();return r?e.jsxs(t,{className:"border-2 border-primary/20 bg-card shadow-sm",children:[e.jsx(u,{children:e.jsxs(h,{className:"text-base flex items-center gap-2",children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-primary"})," Supervisor Feedback"]})}),e.jsx(a,{children:e.jsx("div",{className:"prose prose-sm max-w-none",children:e.jsx(_,{children:r})})})]}):null})()]}):e.jsx(t,{className:"border border-border bg-card",children:e.jsx(a,{className:"p-8 text-center text-muted-foreground",children:"Scores are being generated..."})}),e.jsxs(t,{className:"border border-border bg-card shadow-sm",children:[e.jsx(u,{children:e.jsxs(h,{className:"text-base flex items-center gap-2",children:[e.jsx(S,{className:"w-4 h-4 text-primary"})," Conversation Transcript"]})}),e.jsx(a,{children:e.jsx(D,{className:"h-96",children:e.jsx("div",{className:"space-y-3",children:A.map((r,p)=>e.jsx("div",{className:`flex ${r.role==="user"?"justify-end":"justify-start"}`,children:e.jsx("div",{className:`max-w-[80%] rounded-2xl px-4 py-2 text-sm ${r.role==="user"?"bg-primary text-primary-foreground rounded-br-md":"bg-muted rounded-bl-md"}`,children:r.content})},p))})})})]})]})})}return e.jsx(w,{children:e.jsxs("div",{className:"p-4 md:p-8 max-w-6xl mx-auto 
1space-y-6",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg bg-primary/10 flex items-center justify-center",children:e.jsx(C,{className:"w-5 h-5 text-primary"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl md:text-3xl font-bold tracking-tight text-foreground",children:"Reviews"}),e.jsx("p",{className:"text-muted-foreground text-sm",children:"View your supervisor feedback and session scores"})]})]}),R?e.jsx("div",{className:"flex justify-center p-12",children:e.jsx(B,{className:"w-6 h-6 animate-spin text-primary"})}):m.length===0?e.jsx(t,{className:"border border-border bg-card",children:e.jsxs(a,{className:"p-8 text-center text-muted-foreground",children:[e.jsx(C,{className:"w-10 h-10 mx-auto mb-3 opacity-40"}),e.jsx("p",{className:"font-medium",children:"No completed sessions yet"}),e.jsx("p",{className:"text-sm mt-1",children:"Complete training sessions to receive feedback"})]})}):e.jsxs(e.Fragment,{children:[N.length>0&&e.jsxs("div",{children:[e.jsxs("h2",{className:"text-lg font-semibold text-foreground mb-3 flex items-center gap-2",children:[e.jsx(g,{className:"w-5 h-5 text-success"})," Supervisor Reviews"]}),e.jsx("div",{className:"space-y-2",children:N.map(s=>{const r=i(s)?.overall_score;return e.jsx(t,{className:"border border-border bg-card cursor-pointer hover:shadow-sm hover:border-primary/20 transition-all",onClick:()=>b(s),children:e.jsxs(a,{className:"p-4 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx("div",{className:"w-9 h-9 rounded-lg bg-success/10 flex items-center justify-center shrink-0",children:e.jsx(g,{className:"w-4 h-4 text-success"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-sm font-medium truncate",children:s.scenarios?.name}),e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[e.jsx(k,{className:"w-3 h-3"}),new Date(s.created_at).toLocaleDateString()]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[i(s)?.admin_notes&&e.jsx(y,{variant:"outline",className:"text-[10px]",children:"Has Feedback"}),r!=null&&e.jsxs("span",{className:`text-sm font-bold ${x(r)}`,children:[r,"/10"]})]})]})},s.id)})})]}),d.length>0&&e.jsxs("div",{children:[e.jsxs("h2",{className:"text-lg font-semibold text-foreground mb-3 flex items-center gap-2",children:[e.jsx(G,{className:"w-5 h-5 text-muted-foreground"})," AI Scored (Pending Supervisor Review)"]}),e.jsx("div",{className:"space-y-2",children:n.paginate(d).map(s=>{const r=i(s)?.overall_score;return e.jsx(t,{className:"border border-border bg-card cursor-pointer hover:shadow-sm hover:border-primary/20 transition-all",onClick:()=>b(s),children:e.jsxs(a,{className:"p-4 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx("div",{className:"w-9 h-9 rounded-lg bg-muted flex items-center justify-center shrink-0",children:e.jsx(S,{className:"w-4 h-4 text-muted-foreground"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-sm font-medium truncate",children:s.scenarios?.name}),e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[e.jsx(k,{className:"w-3 h-3"}),new Date(s.created_at).toLocaleDateString()]})]})]}),r!=null&&e.jsxs("span",{className:`text-sm font-bold ${x(r)}`,children:[r,"/10"]})]})},s.id)})}),d.length>n.pageSize&&e.jsx(E,{currentPage:n.currentPage,totalItems:d.length,pageSize:n.pageSize,onPageChange:n.setCurrentPage,onPageSizeChange:n.setPageSize})]})]})]})})}export{Ke as default};
2//# sourceMappingURL=TraineeReviews-QQ04_ZLt.js.map

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.