1import{j as e}from"./vendor-radix-BgQ1tEw6.js";import{u as z}from"./CabinetContext-B3RK9jmY.js";import{r as h,L as H}from"./vendor-react-DXpIY7U8.js";import{O as M,P as V,Q as P,R as $,S as q}from"./actions-Bb3mMmsA.js";import{B as _}from"./badge-t1Mm-JRA.js";import{C as p,w as N,Q as v,E as S,a as g,P as I,o as W,B as E,p as G}from"./index-DjWeVXQh.js";import{C as K,a as T,b as Q,c as U,d as X,e as J}from"./command-u2RjvPzH.js";import{u as Y}from"./useFirmSearch-isn2Og4X.js";import{aD as Z,aO as ee,b as se,X as ae,be as te,bm as re,af as ne,s as B,r as le}from"./vendor-utils-C1PKCXFi.js";import{R as ie,v as oe}from"./generateCategoricalChart-m93VUye3.js";import{R as ce,P as de,a as me,b as ue,c as D}from"./RadarChart-BzJWBWRb.js";import"./constants.structure-config-BpDh2bXB.js";import"./firm-utils-BjUfpR4x.js";import"./app-BwwgxGmm.js";import"./vendor-supabase-DoLSl-Em.js";function he({firmId:a,firmName:r,selectedFirms:t,loading:s,onAddFirm:l,onRemoveFirm:d,hasSavedCompetitors:j}){const[b,f]=h.useState(!1),{firms:x,loading:w,search:C,handleSearchChange:y}=Y({initialLimit:50}),k=new Set(t.map(n=>n.id)),R=x.filter(n=>n.id!==a&&!k.has(n.id)),i=new Map;x.forEach(n=>i.set(n.id,n.logo_url));const m=n=>{const u=x.find(L=>L.id===n);u&&l(u.id,u.name),f(!1),y("")},o=({name:n,logoUrl:u,size:L="sm"})=>{const F=L==="md"?"w-7 h-7":"w-5 h-5";return u?e.jsx("img",{src:u,alt:"",className:`${F} rounded object-contain bg-white flex-shrink-0`}):e.jsx("div",{className:`${F} rounded bg-gradient-to-br from-primary/20 to-primary/5 flex items-center justify-center flex-shrink-0`,children:e.jsx("span",{className:"text-[10px] font-bold text-primary/60",children:n.charAt(0)})})};return e.jsxs(p,{children:[e.jsxs(N,{children:[e.jsxs(v,{className:"flex items-center gap-2",children:[e.jsx(Z,{className:"h-5 w-5 text-primary"}),"Comparer avec d'autres structures"]}),e.jsxs(S,{children:["Sélectionnez jusqu'à 3 structures pour comparer vos performances",j&&e.jsxs("span",{className:"inline-flex items-center gap-1 ml-2 text-primary",children:[e.jsx(ee,{className:"h-3 w-3"})," Vos concurrents sont sauvegardés"]})]})]}),e.jsxs(g,{className:"space-y-4",children:[e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs(_,{variant:"default",className:"gap-2 px-3 py-1.5 text-sm",children:[e.jsx(se,{className:"h-4 w-4"}),r," (votre structure)"]}),t.map((n,u)=>e.jsxs(_,{variant:"secondary",className:"gap-2 px-3 py-1.5 text-sm",style:{borderColor:c[u+1],borderWidth:2},children:[e.jsx(o,{name:n.name,logoUrl:i.get(n.id)}),n.name,e.jsx("button",{onClick:()=>d(n.id),className:"hover:bg-muted rounded-full p-0.5",children:e.jsx(ae,{className:"h-3 w-3"})})]},n.id))]}),t.length<3&&!s&&e.jsxs(I,{open:b,onOpenChange:f,children:[e.jsx(W,{asChild:!0,children:e.jsxs(E,{variant:"outline",role:"combobox","aria-expanded":b,className:"w-[300px] justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:"Ajouter une structure..."}),e.jsx(te,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(G,{className:"w-[300px] p-0",align:"start",children:e.jsxs(K,{shouldFilter:!1,children:[e.jsx(T,{placeholder:"Rechercher une structure...",value:C,onValueChange:y}),e.jsxs(Q,{children:[e.jsx(U,{children:w?"Recherche...":"Aucune structure trouvée."}),e.jsx(X,{children:R.map(n=>e.jsxs(J,{value:n.id,onSelect:()=>m(n.id),className:"flex items-center gap-2",children:[e.jsx(o,{name:n.name,logoUrl:n.logo_url,size:"md"}),e.jsx("span",{children:n.name})]},n.id))})]})]})})]})]})]})}function xe({radarData:a,firmName:r,selectedFirms:t}){return e.jsxs(p,{children:[e.jsxs(N,{children:[e.jsx(v,{children:"Comparaison visuelle"}),e.jsx(S,{children:"Superposition des profils de performance"})]}),e.jsx(g,{children:e.jsx("div",{className:"h-[450px]",children:e.jsx(ie,{width:"100%",height:"100%",children:e.jsxs(ce,{data:a,margin:{top:40,right:80,bottom:40,left:80},children:[e.jsx(de,{stroke:"hsl(var(--border))"}),e.jsx(me,{dataKey:"subject",tick:{fill:"hsl(var(--foreground))",fontSize:11}}),e.jsx(ue,{angle:90,domain:[0,5],tick:{fill:"hsl(var(--muted-foreground))",fontSize:10}}),e.jsx(D,{name:r,dataKey:r,stroke:c[0],fill:c[0],fillOpacity:.3,strokeWidth:2}),t.map((s,l)=>e.jsx(D,{name:s.name,dataKey:s.name,stroke:c[l+1],fill:c[l+1],fillOpacity:.15,strokeWidth:2},s.id)),e.jsx(oe,{})]})})})})]})}const pe=[{key:"culture",shortLabel:"Culture"},{key:"compensation",shortLabel:"Rémunération"},{key:"pride",shortLabel:"Fierté"},{key:"wellbeing",shortLabel:"Bien-être"},{key:"management",shortLabel:"Management"}
1,{key:"atmosphere",shortLabel:"Ambiance"},{key:"worklifebalance",shortLabel:"Ãquilibre"},{key:"training",shortLabel:"Formation"}],O=a=>{const r=Object.values(a);return r.reduce((t,s)=>t+s,0)/r.length};function ge({firmName:a,firmRatings:r,selectedFirms:t}){return e.jsxs(p,{children:[e.jsx(N,{children:e.jsx(v,{children:"Performance globale"})}),e.jsx(g,{children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b",children:[e.jsx("th",{className:"text-left py-3 px-2 font-medium",children:"Critère"}),e.jsx("th",{className:"text-center py-3 px-2 font-medium",style:{color:c[0]},children:a}),t.map((s,l)=>e.jsx("th",{className:"text-center py-3 px-2 font-medium",style:{color:c[l+1]},children:s.name},s.id))]})}),e.jsxs("tbody",{children:[pe.map(({key:s,shortLabel:l})=>e.jsxs("tr",{className:"border-b",children:[e.jsx("td",{className:"py-3 px-2",children:l}),e.jsx("td",{className:"text-center py-3 px-2 font-semibold",children:r[s].toFixed(1)}),t.map(d=>e.jsx("td",{className:"text-center py-3 px-2",children:d.ratings[s].toFixed(1)},d.id))]},s)),e.jsxs("tr",{className:"bg-muted/50 font-semibold",children:[e.jsx("td",{className:"py-3 px-2",children:"Moyenne générale"}),e.jsx("td",{className:"text-center py-3 px-2",style:{color:c[0]},children:O(r).toFixed(1)}),t.map((s,l)=>e.jsx("td",{className:"text-center py-3 px-2",style:{color:c[l+1]},children:O(s.ratings).toFixed(1)},s.id))]})]})]})})})]})}const je={"0-2-semaines":"0-2 sem.","2-4-semaines":"2-4 sem.","1-2-mois":"1-2 mois","2-4-mois":"2-4 mois","4-6-mois":"4-6 mois","+6-mois":"+6 mois"};function A(a){return a!=null?`${a}%`:"â"}function be(a){return a!=null?`${a.toFixed(1)}/5`:"â"}function fe(a){return a!=null?`${a}`:"â"}function ye(a){return a?je[a]||a:"â"}const Ne=[{label:"Télétravail (% favorable)",getValue:a=>A(a?.remoteWorkPercent??null)},{label:"Recommanderait (%)",getValue:a=>A(a?.wouldRecommendPercent??null)},{label:"Process recrutement",getValue:a=>be(a?.recruitmentRating??null)},{label:"Nb moyen d'entretiens",getValue:a=>fe(a?.avgInterviewCount??null)},{label:"Durée recrutement",getValue:a=>ye(a?.avgRecruitmentDuration??null)}];function ve({firmName:a,ownHR:r,selectedFirms:t}){return e.jsxs(p,{children:[e.jsxs(N,{children:[e.jsx(v,{children:"Indicateurs RH & Recrutement"}),e.jsx(S,{children:"Données issues des avis des collaborateurs"})]}),e.jsx(g,{children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b",children:[e.jsx("th",{className:"text-left py-3 px-2 font-medium",children:"Indicateur"}),e.jsx("th",{className:"text-center py-3 px-2 font-medium",style:{color:c[0]},children:a}),t.map((s,l)=>e.jsx("th",{className:"text-center py-3 px-2 font-medium",style:{color:c[l+1]},children:s.name},s.id))]})}),e.jsx("tbody",{children:Ne.map(({label:s,getValue:l})=>e.jsxs("tr",{className:"border-b",children:[e.jsx("td",{className:"py-3 px-2",children:s}),e.jsx("td",{className:"text-center py-3 px-2 font-semibold",children:l(r)}),t.map(d=>e.jsx("td",{className:"text-center py-3 px-2",children:l(d.hrIndicators)},d.id))]},s))})]})})})]})}const c=["hsl(var(--primary))","hsl(220, 70%, 50%)","hsl(280, 70%, 50%)","hsl(160, 70%, 40%)"],we=[{key:"culture",shortLabel:"Culture"},{key:"compensation",shortLabel:"Rémunération"},{key:"pride",shortLabel:"Fierté"},{key:"wellbeing",shortLabel:"Bien-être"},{key:"management",shortLabel:"Management"},{key:"atmosphere",shortLabel:"Ambiance"},{key:"worklifebalance",shortLabel:"Ãquilibre"},{key:"training",shortLabel:"Formation"}];function Ce({firmId:a,firmName:r,firmRatings:t}){const[s,l]=h.useState([]),[d,j]=h.useState(!0),[b,f]=h.useState([]),[x,w]=h.useState(null);h.useEffect(()=>{C()},[a]);const C=async()=>{j(!0);try{const[i,m]=await Promise.all([M(a),V(a)]);if(i.success&&i.data.length>0){f(i.data);const o=await P(i.data);o.success&&l(o.data)}m.success&&w(m.data)}catch(i){console.error("Error loading comparison data:",i)}finally{j(!1)}},y=async(i,m)=>{if(s.length>=3||s.find(n=>n.id===i))return;const o=await P([i]);o.success&&o.data.length>0&&(l(n=>[...n,o.data[0]]),await q(a,i))},k=async i=>{l(m=>m.filter(o=>o.id!==i)),await $(a,i)},R=h.useMemo(()=>we.map(({key:i,shortLabel:m})=>{const o={subject:m,[r]:t[i],fullMark:5};
1return s.forEach(n=>{o[n.name]=n.ratings[i]}),o}),[t,s,r]);return e.jsxs("div",{className:"space-y-6",children:[e.jsx(he,{firmId:a,firmName:r,selectedFirms:s,loading:d,onAddFirm:y,onRemoveFirm:k,hasSavedCompetitors:b.length>0}),e.jsx(xe,{radarData:R,firmName:r,selectedFirms:s}),s.length>0&&e.jsxs(e.Fragment,{children:[e.jsx(ge,{firmName:r,firmRatings:t,selectedFirms:s}),e.jsx(ve,{firmName:r,ownHR:x,selectedFirms:s})]})]})}function Ve(){const{firmData:a,reviews:r}=z();return a?a.is_premium?e.jsxs("div",{className:"container mx-auto py-6 space-y-6",children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"Benchmark concurrentiel"}),e.jsx(Ce,{firmId:a.id,firmName:a.name,firmRatings:r.length>0?{culture:r.reduce((t,s)=>t+s.culture_rating,0)/r.length,compensation:r.reduce((t,s)=>t+s.compensation_rating,0)/r.length,pride:r.reduce((t,s)=>t+s.pride_rating,0)/r.length,wellbeing:r.reduce((t,s)=>t+s.wellbeing_rating,0)/r.length,management:r.reduce((t,s)=>t+s.management_rating,0)/r.length,atmosphere:r.reduce((t,s)=>t+s.atmosphere_rating,0)/r.length,worklifebalance:r.reduce((t,s)=>t+s.worklifebalance_rating,0)/r.length,training:(()=>{const t=r.filter(s=>s.training_rating&&s.training_rating>0);return t.length>0?t.reduce((s,l)=>s+(l.training_rating||0),0)/t.length:5})()}:{culture:0,compensation:0,pride:0,wellbeing:0,management:0,atmosphere:0,worklifebalance:0,training:5}})]}):e.jsxs("div",{className:"container mx-auto py-6 space-y-6",children:[e.jsxs("h2",{className:"text-2xl font-bold tracking-tight flex items-center gap-2",children:[e.jsx(re,{className:"h-6 w-6 text-primary"}),"Benchmark concurrentiel",e.jsx(ne,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsx(p,{className:"border-primary/20 bg-gradient-to-br from-primary/5 to-transparent",children:e.jsxs(g,{className:"p-8 space-y-6 text-center",children:[e.jsx("div",{className:"w-14 h-14 mx-auto rounded-full bg-primary/10 flex items-center justify-center",children:e.jsx(B,{className:"h-7 w-7 text-primary"})}),e.jsxs("div",{className:"space-y-2 max-w-xl mx-auto",children:[e.jsx("h3",{className:"text-xl font-semibold",children:"Fonctionnalité réservée aux structures premium"}),e.jsx("p",{className:"text-muted-foreground text-sm",children:"Comparez votre structure aux concurrents directs sur les 8 critères de réputation (culture, rémunération, management, équilibre pro/persoâ¦) et identifiez vos axes de progrès."})]}),e.jsx("ul",{className:"text-sm text-left max-w-md mx-auto space-y-2",children:["Comparaison sur 8 critères vs concurrents","Radar visuel positionnement marché","Suivi de vos progrès dans le temps"].map(t=>e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx(le,{className:"h-4 w-4 text-primary mt-0.5 shrink-0"}),e.jsx("span",{children:t})]},t))}),e.jsx(E,{asChild:!0,size:"lg",className:"gap-2",children:e.jsxs(H,{to:"/cabinet/parametres",children:[e.jsx(B,{className:"h-4 w-4"}),"Passer au premium"]})})]})})]}):null}export{Ve 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.