PageSourceSearch

https://solutio-scan-report.lovable.app/assets/admin.leads-Ch-k1Ihc.js

js solutio-scan-report.lovable.app collected 2026-10-03 03:45:55 UTC 18,034 bytes, 38 lines download raw bytes

1import{c as O,a as M,b as F,r as j,j as e,S as E,f as z}from"./index-Cj0z9rCj.js";import{c as P,r as T,u as L}from"./auth-middleware--da5Kgbb.js";import{c as k,t as q,C as R,I,B as $,a as C}from"./index-e9GUuL3j.js";import{F as B}from"./file-text-CQYwUqui.js";import"./clsx-B-dksMZM.js";const D=P({method:"GET"}).middleware([T]).handler(O("bd151d4a4a64cf467db3a4277f171ddb591a1efe2a393e29683fa0a46ef46428")),U=P({method:"POST"}).middleware([T]).handler(O("c8b5d92496f8e810e2e97d90a51fa8f8a037485e6072e40ea29edbfed9ffab8e"));const G=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],H=k("download",G);const V=[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]],J=k("mail",V);const Q=[["path",{d:"M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384",key:"9njp5v"}]],W=k("phone",Q);const X=[["path",{d:"M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2",key:"143wyd"}],["path",{d:"M6 9V3a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v6",key:"1itne7"}],["rect",{x:"6",y:"14",width:"12",height:"8",rx:"1",key:"1ue0tg"}]],K=k("printer",X);const Y=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Z=k("x",Y);function ee(t){const o=t==null?"":String(t);return/[",\n;]/.test(o)?'"'+o.replace(/"/g,'""')+'"':o}function se(t){const i=[["parcours","dossier","email","telephone","statut","etape","scoring","classement","prix_conseille","rapport_genere","cree_le","maj_le","user_id","dossier_id"].join(",")];for(const n of t)i.push([n.parcours,n.name,n.email,n.phone,n.status,n.currentStep,n.scoringTotal,n.scoringClassement,n.valuationPrix,n.hasReport?"oui":"non",n.createdAt,n.updatedAt,n.userId,n.id].map(ee).join(","));const a=new Blob(["\uFEFF"+i.join(`
2`)],{type:"text/csv;charset=utf-8;"}),u=URL.createObjectURL(a),l=document.createElement("a");l.href=u,l.download=`solutio-leads-${new Date().toISOString().slice(0,10)}.csv`,document.body.appendChild(l),l.click(),document.body.removeChild(l),URL.revokeObjectURL(u)}function ce(){const{user:t,loading:o}=M(),i=F(),a=L(D),u=L(U),[l,n]=j.useState(null),[h,m]=j.useState(""),[g,S]=j.useState("all"),[d,y]=j.useState(null),[f,w]=j.useState(!1);j.useEffect(()=>{if(!o){if(!t){i({to:"/auth",search:{redirect:"/admin/leads"},replace:!0});return}a().then(n).catch(s=>q.error(s instanceof Error?s.message:"Erreur"))}},[t,o,i,a]);const b=j.useMemo(()=>{if(!l)return[];const s=h.trim().toLowerCase();return l.filter(c=>g!=="all"&&c.parcours!==g?!1:s?[c.name,c.email,c.phone,c.status,c.scoringClassement].filter(
2Boolean).some(N=>String(N).toLowerCase().includes(s)):!0)},[l,h,g]);async function _(s){w(!0);try{const c=await u({data:{id:s.id,parcours:s.parcours}});y({row:s,data:c})}catch(c){q.error(c instanceof Error?c.message:"Erreur")}finally{w(!1)}}return e.jsxs("div",{className:"flex min-h-screen flex-col bg-[var(--gray-50)]",children:[e.jsx(E,{}),e.jsxs("main",{className:"flex-1",children:[e.jsx("div",{className:"border-b border-[var(--solutio-blue)]/10 bg-white",children:e.jsxs("div",{className:"mx-auto max-w-7xl px-4 py-6",children:[e.jsx("h1",{className:"text-2xl font-semibold text-[var(--solutio-blue-dark)]",children:"Leads & rapports DIAG&VAL"}),e.jsx("p",{className:"mt-1 text-sm text-[var(--gray-700)]",children:"Tous les dossiers cédants et repreneurs avec contacts et rapports générés."})]})}),e.jsxs("div",{className:"mx-auto max-w-7xl space-y-4 px-4 py-6",children:[e.jsxs(R,{className:"flex flex-col gap-3 border-[var(--solutio-blue)]/10 bg-white p-4 sm:flex-row sm:items-center",children:[e.jsx(I,{value:h,onChange:s=>m(s.target.value),placeholder:"Rechercher nom, email, téléphone…",className:"sm:max-w-sm"}),e.jsx("div",{className:"flex gap-1",children:["all","cedant","repreneur"].map(s=>e.jsx($,{size:"sm",variant:g===s?"default":"outline",onClick:()=>S(s),children:s==="all"?"Tous":s==="cedant"?"Cédants":"Repreneurs"},s))}),e.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[e.jsxs("span",{className:"text-xs text-muted-foreground",children:[b.length," dossier(s)"]}),e.jsxs($,{size:"sm",onClick:()=>se(b),disabled:!b.length,className:"bg-[var(--solutio-blue)] text-white hover:bg-[var(--solutio-blue-dark)]",children:[e.jsx(H,{className:"mr-2 h-4 w-4"})," Exporter CSV"]})]})]}),l===null?e.jsx("div",{className:"p-8 text-center text-sm text-muted-foreground",children:"Chargement…"}):b.length===0?e.jsx(R,{className:"p-8 text-center text-sm text-muted-foreground",children:"Aucun dossier."}):e.jsx(R,{className:"overflow-hidden border-[var(--solutio-blue)]/10 bg-white",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{className:"bg-[var(--solutio-blue-soft)] text-xs uppercase tracking-wider text-[var(--solutio-blue-dark)]",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-3 py-2 text-left",children:"Parcours"}),e.jsx("th",{className:"px-3 py-2 text-left",children:"Dossier"}),e.jsx("th",{className:"px-3 py-2 text-left",children:"Contact"}),e.jsx("th",{className:"px-3 py-2 text-left",children:"Statut"}),e.jsx("th",{className:"px-3 py-2 text-left",children:"Scoring"}),e.jsx("th",{className:"px-3 py-2 text-left",children:"MAJ"}),e.jsx("th",{className:"px-3 py-2 text-right",children:"Action"})]})}),e.jsx("tbody",{children:b.map(s=>e.jsxs("tr",{className:"border-t border-[var(--solutio-blue)]/5",children:[e.jsx("td",{className:"px-3 py-2",children:e.jsx(C,{variant:"outline",className:s.parcours==="cedant"?"border-[var(--solutio-orange)]/40":"border-[var(--solutio-blue)]/40",children:s.parcours==="cedant"?"Cédant":"Repreneur"})}),e.jsx("td",{className:"px-3 py-2 font-medium text-[var(--solutio-blue-dark)]",children:s.name}),e.jsx("td",{className:"px-3 py-2",children:e.jsxs("div",{className:"flex flex-col gap-0.5 text-xs",children:[s.email&&e.jsxs("a",{href:`mailto:${s.email}`,className:"flex items-center gap-1 text-[var(--solutio-blue)] hover:underline",children:[e.jsx(J,{className:"h-3 w-3"})," ",s.email]}),s.phone&&e.jsxs("a",{href:`tel:${s.phone}`,className:"flex items-center gap-1 text-[var(--solutio-blue)] hover:underline",children:[e.jsx(W,{className:"h-3 w-3"})," ",s.phone]}),!s.email&&!s.phone&&e.jsx("span",{className:"text-muted-foreground",children:"—"})]})}),e.jsx("td",{className:"px-3 py-2",children:s.hasReport?e.jsxs(C,{className:"bg-[var(--green,#16a34a)]/10 text-[var(--green,#16a34a)] hover:bg-[var(--green,#16a34a)]/10",children:[e.jsx(B,{className:"mr-1 h-3 w-3"})," Rapport"]}):e.jsxs("span",{className:"text-xs text-muted-foreground",children:[s.status," · étape ",s.currentStep]})}),e.jsx("td",{className:"px-3 py-2 text-xs",children:s.scoringTotal!=null?`${s.scoringTotal}/100 · ${s.scoringClassement??""}`:"—"}),e.jsx("td",{className:"px-3 py-2 text-xs text-muted-foreground",children:new Date(s.updatedAt).toLocaleDateString("fr-FR")}),e.jsx("td",{className:"px-3 py-2 text-right",children:e.jsx($,{size:"sm",variant:"outline",disabled:f,onClick:()=>_(s),children:"Voir"})})]},`${s.parcours}-${s.id}`))})]})})})]})]}),e.jsx(z,{}),d&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-start justify-center overflow-y-auto bg-black/50 p-4",onClick:()=>y(null),children:e.jsxs("div",{className:"my-8 w-full max-w-4xl rounded-xl bg-white p-6 shadow-2xl",onClick:s=>s.stopPropagation(),children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-xs uppercase tracking-wider text-[var(--solutio-orange)]",children:d.row.parcours==="cedant"?"Cédant":"Repreneur"}),e.jsx("h2",{className:"text-xl font-semibold text-[var(--solutio-blue-dark)]",children:d.row.name}),e.jsxs("div",{className:"mt-1 flex flex-wrap gap-3 text-xs text-[var(--gray-700)]",children:[d.data.contact.fullName&&e.jsx("span",{children:d.data.contact.fullName}),d.data.contact.email&&e.jsx("a",{href:`mailto:${d.data.contact.email}`,className:"text-[var(--solutio-blue)] hover:underline",children:d.data.contact.email}),d.data.contact.phone&&e.jsx("a",{href:`tel:${d.data.contact.phone}`,className:"text-[var(--solutio-blue)] hover:underline",children:d.data.contact.phone})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[d.data.dossier.report?e.jsxs($,{size:"sm",onClick:()=>ae(d.row,d.data),className:"bg-[var(--solutio-blue)] text-white hover:bg-[var(--solutio-blue-dark)]",children:[e.jsx(K,{className:"mr-2 h-4 w-4"})," Imprimer / PDF"]}):null,e.jsx($,{variant:"ghost",size:"icon",onClick:()=>y(null),children:e.jsx(Z,{className:"h-4 w-4"})})]})]}),e.jsx("div",{className:"mt-4 max-h-[70vh] overflow-y-auto rounded-lg bg-[var(--gray-50)] p-4",children:d.data.dossier.report?e.jsx(te,{report:d.data.dossier.report}):e.jsxs("div",{className:"text-sm text-muted-foreground",children:["Pas encore de rapport généré. Statut : ",d.data.dossier.status," · étape ",d.data.dossier.current_step??"?"]})})]})})]})}function r(t){return typeof t=="string"&&t.trim()?t:null}function x(t){return Array.isArray(t)?t:[]}function A(t){return t&&typeof t=="object"?t:{}}function p({title:t,children:o}){return e.jsxs("section",{className:"mb-5 rounded-lg border border-[var(--solutio-blue)]/10 bg-white p-4",children:[e.jsx("h3",{className:"mb-2 text-sm font-semibold uppercase tracking-wider text-[var(--solutio-blue-dark)]",children:t}),e.jsx("div",{className:"text-sm text-[var(--gray-700)]",children:o})]})}function v({items:t}){const o=t.map(r).filter(i=>!!i);return o.length?e.jsx("ul",{className:"list-disc space-y-1 pl-5",children:o.map((i,a)=>e.jsx("li",{children:i},a))}):e.jsx("p",{className:"italic text-muted-foreground",children:"—"})}function te({report:t}){const o=r(t.go_no_go),i=A(t.swot_cible),a=A(t.matching_pro),u=x(t.plan_100_jours),l=x(t.risques_principaux);return e.jsxs("div",{className:"space-y-1",children:[o&&e.jsxs("div",{className:"mb-4 flex items-center gap-3 rounded-lg border-2 border-[var(--solutio-blue)] bg-[var(--solutio-blue-soft)] p-4",children:[e.jsx("span",{className:"text-xs uppercase tracking-wider text-[var(--solutio-blue-dark)]",children:"Décision"}),e.jsx("span",{className:"text-2xl font-bold text-[var(--solutio-blue-dark)]",children:o})]}),r(t.resume_executif)&&e.jsx(p,{title:"Résumé exécutif",children:e.jsx("p",{className:"whitespace-pre-line",children:r(t.resume_executif)})}),r(t.justification_go_no_go)&&e.jsx(p,{title:"Justification Go / No-Go",children:e.jsx("p",{className:"whitespace-pre-line",children:r(t.justification_go_no_go)})}),r(t.analyse_prix)&&e.jsx(p,{title:"Analyse du prix",children:e.jsx("p",{className:"whitespace-pre-line",children:r(t.analyse_prix)})}),r(t.analyse_financabilite)&&e.jsx(p,{title:"Analyse de la finançabilité",children:e.jsx("p",{className:"whitespace-pre-line",children:r(t.analyse_financabilite)})}),r(t.synthese_banquier)&&e.jsx(p,{title:"Synthèse banquier",children:e.jsx("p",{className:"whitespace-pre-line",children:r(t.synthese_banquier)})}),!!(i.forces||i.faiblesses||i.opportunites||i.menaces)&&e.jsx(p,{title:"SWOT cible",children:e.jsxs("div",{className:"grid gap-3 md:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"mb-1 text-xs font-semibold text-green-700",children:"Forces"}),e.jsx(v,{items:x(i.forces)})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"mb-1 text-xs font-semibold text-orange-700",children:"Faiblesses"}),e.jsx(v,{items:x(i.faiblesses)})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"mb-1 text-xs font-semibold text-blue-700",children:"Opportunités"}),e.jsx(v,{items:x(i.opportunites)})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"mb-1 text-xs font-semibold text-red-700",children:"Menaces"}
2),e.jsx(v,{items:x(i.menaces)})]})]})}),l.length>0&&e.jsx(p,{title:"Risques principaux",children:e.jsx("ul",{className:"space-y-2",children:l.map((n,h)=>{const m=A(n);return e.jsxs("li",{className:"rounded border border-border p-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"font-medium",children:r(m.titre)??"Risque"}),r(m.niveau)&&e.jsx(C,{variant:"outline",children:r(m.niveau)})]}),r(m.description)&&e.jsx("p",{className:"mt-1 text-xs",children:r(m.description)}),r(m.mitigation)&&e.jsxs("p",{className:"mt-1 text-xs text-[var(--solutio-blue)]",children:[e.jsx("b",{children:"Mitigation :"})," ",r(m.mitigation)]})]},h)})})}),u.length>0&&e.jsx(p,{title:"Plan 100 jours",children:e.jsx("ul",{className:"space-y-2",children:u.map((n,h)=>{const m=A(n);return e.jsxs("li",{className:"rounded border border-border p-2",children:[e.jsxs("div",{className:"text-xs text-muted-foreground",children:[r(m.echeance)," · ",r(m.responsable)]}),e.jsx("div",{children:r(m.action)})]},h)})})}),x(t.points_due_dil).length>0&&e.jsx(p,{title:"Points de due diligence",children:e.jsx(v,{items:x(t.points_due_dil)})}),x(t.questions_a_poser_cedant).length>0&&e.jsx(p,{title:"Questions à poser au cédant",children:e.jsx(v,{items:x(t.questions_a_poser_cedant)})}),!!(a.secteurs||a.tailles_ca||a.profil_cible_ideal)&&e.jsxs(p,{title:"Matching pro",children:[x(a.secteurs).length>0&&e.jsxs("p",{children:[e.jsx("b",{children:"Secteurs :"})," ",x(a.secteurs).join(", ")]}),r(a.tailles_ca)&&e.jsxs("p",{children:[e.jsx("b",{children:"Tailles CA :"})," ",r(a.tailles_ca)]}),r(a.profil_cible_ideal)&&e.jsxs("p",{className:"mt-1",children:[e.jsx("b",{children:"Profil cible idéal :"})," ",r(a.profil_cible_ideal)]})]}),x(t.synergies_quantifiables).length>0&&e.jsx(p,{title:"Synergies quantifiables",children:e.jsx(v,{items:x(t.synergies_quantifiables)})}),r(t.recommandation_solutio_pro)&&e.jsx(p,{title:"Recommandation SOLUTIO PRO",children:e.jsx("p",{className:"whitespace-pre-line",children:r(t.recommandation_solutio_pro)})})]})}function ae(t,o){const i=o.dossier.report;if(!i)return;const a=s=>String(s??"").replace(/[&<>]/g,c=>({"&":"&amp;","<":"&lt;",">":"&gt;"})[c]),u=s=>{const c=(Array.isArray(s)?s:[]).map(N=>typeof N=="string"?N:"").filter(Boolean);return c.length?`<ul>${c.map(N=>`<li>${a(N)}</li>`).join("")}</ul>`:"<p><em>—</em></p>"},l=(s,c)=>`<section><h2>${a(s)}</h2>${c}</section>`,n=s=>{const c=i[s];return typeof c=="string"&&c.trim()?`<p>${a(c).replace(/\n/g,"<br/>")}</p>`:""},h=i.swot_cible??{},m=`<div class="grid">
3    <div><h3>Forces</h3>${u(h.forces)}</div>
4    <div><h3>Faiblesses</h3>${u(h.faiblesses)}</div>
5    <div><h3>Opportunités</h3>${u(h.opportunites)}</div>
6    <div><h3>Menaces</h3>${u(h.menaces)}</div>
7  </div>`,g=Array.isArray(i.risques_principaux)?i.risques_principaux:[],S=g.length?`<ul>${g.map(s=>`<li><b>${a(s.titre)}</b> <small>[${a(s.niveau)}]</small><br/>${a(s.description)}<br/><em>Mitigation :</em> ${a(s.mitigation)}</li>`).join("")}</ul>`:"",d=Array.isArray(i.plan_100_jours)?i.plan_100_jours:[],y=d.length?`<ul>${d.map(s=>`<li><small>${a(s.echeance)} · ${a(s.responsable)}</small><br/>${a(s.action)}</li>`).join("")}</ul>`:"",f=i.matching_pro??{},w=`${Array.isArray(f.secteurs)?`<p><b>Secteurs :</b> ${f.secteurs.map(a).join(", ")}</p>`:""}
8    ${typeof f.tailles_ca=="string"?`<p><b>Tailles CA :</b> ${a(f.tailles_ca)}</p>`:""}
9    ${typeof f.profil_cible_ideal=="string"?`<p><b>Profil cible :</b> ${a(f.profil_cible_ideal)}</p>`:""}`,b=`<!doctype html><html><head><meta charset="utf-8"/>
10    <title>Rapport — ${a(t.name)}</title>
11    <style>
12      body{font-family:-apple-system,Segoe UI,Roboto,sans-serif;color:#1a1a1a;max-width:780px;margin:24px auto;padding:0 24px;line-height:1.5}
13      h1{color:#1e3a8a;margin:0 0 4px} h2{color:#1e3a8a;border-bottom:2px solid #1e3a8a;padding-bottom:4px;margin-top:24px;font-size:14px;text-transform:uppercase;letter-spacing:.05em}
14      h3{font-size:12px;margin:8px 0 4px;color:#475569;text-transform:uppercase}
15      .meta{color:#64748b;font-size:12px;margin-bottom:16px}
16      .badge{display:inline-block;padding:6px 12px;background:#1e3a8a;color:#fff;border-radius:6px;font-weight:700;margin-bottom:16px}
17      .grid{display:grid;grid-template-columns:1fr 1fr;gap:12px}
18      ul{margin:4px 0;padding-left:20px} li{margin-bottom:4px} small{color:#64748b}
19      @media print{body{margin:0}}
20    </style></head><body>
21    <h1>Rapport SOLUTIO PRO — ${a(t.name)}</h1>
22    <div class="meta">${a(t.parcours==="cedant"?"Cédant":"Repreneur")}${o.contact.fullName?" · "+a(o.contact.fullName):""}${o.contact.email?" · "+a(o.contact.email):""}${o.contact.phone?" · "+a(o.contact.phone):""}</div>
23    ${typeof i.go_no_go=="string"?`<div class="badge">${a(i.go_no_go)}</div>`:""}
24    ${n("resume_executif")?l("Résumé exécutif",n("resume_executif")):""}
25    ${n("justification_go_no_go")?l("Justification Go / No-Go",n("justification_go_no_go")):""}
26    ${n("analyse_prix")?l("Analyse du prix",n("analyse_prix")):""}
27    ${n("analyse_financabilite")?l("Analyse de la finançabilité",n("analyse_financabilite")):""}
28    ${n("synthese_banquier")?l("Synthèse banquier",n("synthese_banquier")):""}
29    ${l("SWOT cible",m)}
30    ${S?l("Risques principaux",S):""}
31    ${y?l("Plan 100 jours",y):""}
32    ${Array.isArray(i.points_due_dil)?l("Points de due diligence",u(i.points_due_dil)):""}
33    ${Array.isArray(i.questions_a_poser_cedant)?l("Questions à poser au cédant",u(i.questions_a_poser_cedant)):""}
34    ${w?l("Matching pro",w):""}
35    ${Array.isArray(i.synergies_quantifiables)&&i.synergies_quantifiables.length?l("Synergies quantifiables",u(i.synergies_quantifiables)):""}
36    ${n("recommandation_solutio_pro")?l("Recommandation SOLUTIO PRO",n("recommandation_solutio_pro")):""}
37    <script>window.onload=()=>{setTimeout(()=>window.print(),300)}<\/script>
38    </body></html>`,_=window.open("","_blank");if(!_){q.error("Veuillez autoriser les pop-ups pour imprimer.");return}_.document.open(),_.document.write(b),_.document.close()}export{ce 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.