1import{b8 as C,r as N,u as E,j as e,bT as f,C as n,b as d,bn as A,bg as S,h as k,bs as T,bP as b,U as L,F,bq as R,B as o}from"./index-2upL18V-.js";import{T as B,a as P,b as m,c as r,d as _,e as a}from"./table-Ce40x48p.js";import{D as M,b as q,c as z,d as H}from"./dialog-h4OZW20M.js";import{S as w}from"./StatusBadge-Byum5pRf.js";import{C as I}from"./calendar-Cr11xU0p.js";function Y(){var g;C();const[x,D]=N.useState(""),[s,h]=N.useState(null),{data:p,isLoading:u}=E({queryKey:["/api/claims",{pageSize:500,status:"all"}],queryFn:async()=>{const t=await fetch("/api/claims?pageSize=500&status=all");if(!t.ok)throw new Error("Erreur chargement dossiers");return t.json()}}),i=((p==null?void 0:p.claims)??[]).filter(t=>{if(!x.trim())return!0;const c=x.toLowerCase();return(t.claimNumber??"").toLowerCase().includes(c)||(t.insuredName??"").toLowerCase().includes(c)||(t.medicationName??"").toLowerCase().includes(c)||(t.pathology??"").toLowerCase().includes(c)}),v=t=>!!t.medecinExpertDecision,j=t=>!!(t.fondDossier||t.pathology),l=t=>t?t==="avis_favorable"?e.jsx(o,{className:"bg-green-100 text-green-800 dark:bg-green-900/40 dark:text-green-300",children:"Favorable"}):t==="avis_defavorable"?e.jsx(o,{className:"bg-red-100 text-red-800 dark:bg-red-900/40 dark:text-red-300",children:"Défavorable"}):t==="complement_demande"?e.jsx(o,{className:"bg-orange-100 text-orange-800 dark:bg-orange-900/40 dark:text-orange-300",children:"Complément demandé"}):e.jsx(o,{variant:"secondary",children:t}):null;return e.jsxs("div",{className:"p-6 space-y-6",children:[e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsxs("h1",{className:"text-2xl font-bold flex items-center gap-2",children:[e.jsx(f,{className:"h-6 w-6 text-primary"}),"Dossiers médicaux assurés"]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Consultation des dossiers médicaux et décisions des médecins experts pour chaque réclamation."})]}),!u&&e.jsxs("div",{className:"grid grid-cols-2 gap-4 sm:grid-cols-4",children:[e.jsx(n,{children:e.jsxs(d,{className:"pt-4 pb-4",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"Total dossiers"}),e.jsx("p",{className:"text-2xl font-bold",children:i.length})]})}),e.jsx(n,{children:e.jsxs(d,{className:"pt-4 pb-4",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"Avec dossier médical"}),e.jsx("p",{className:"text-2xl font-bold text-blue-600",children:i.filter(j).length})]})}),e.jsx(n,{children:e.jsxs(d,{className:"pt-4 pb-4",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"Avec décision expert"}),e.jsx("p",{className:"text-2xl font-bold text-green-600",children:i.filter(v).length})]})}),e.jsx(n,{children:e.jsxs(d,{className:"pt-4 pb-4",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"Sans dossier médical"}),e.jsx("p",{className:"text-2xl font-bold text-muted-foreground",children:i.filter(t=>!j(t)).length})]})})]}),e.jsxs("div",{className:"relative max-w-sm",children:[e.jsx(A,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(S,{placeholder:"Rechercher par N°, assuré, médicament, pathologieâ¦",className:"pl-9",value:x,onChange:t=>D(t.target.value),"data-testid":"input-search-dossiers"})]}),e.jsx(n,{children:e.jsx(d,{className:"p-0",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs(B,{children:[e.jsx(P,{children:e.jsxs(m,{className:"bg-muted/30",children:[e.jsx(r,{className:"whitespace-nowrap",children:"N° Dossier"}),e.jsx(r,{className:"whitespace-nowrap",children:"Assuré"}),e.jsx(r,{className:"whitespace-nowrap",children:"Médicament"}),e.jsx(r,{className:"whitespace-nowrap",children:"Pathologie"}),e.jsx(r,{className:"whitespace-nowrap",children:"Statut"}),e.jsx(r,{className:"whitespace-nowrap",children:"Décision Expert"}),e.jsx(r,{className:"text-right whitespace-nowrap",children:"Actions"})]})}),e.jsx(_,{children:u?Array.from({length:8}).map((t,c)=>e.jsx(m,{children:Array.from({length:7}).map((O,y)=>e.jsx(a,{children:e.jsx("div",{className:"h-4 bg-muted rounded animate-pulse w-24"})},y))},c)):i.length===0?e.jsx(m,{children:e.jsx(a,{colSpan:7,className:"text-center py-10 text-muted-foreground",children:"Aucun dossier trouvé"})}):i.map(t=>e.jsxs(m,{"data-testid":`row-dossier-${t.id}`,className:"hover:bg-muted/20",children:[e.jsx(a,{className:"font-mono text-xs whitespace-nowrap",children:t.claimNumber||"â"}),e.jsxs(a,{children:[e.jsx("p",{className:"font-medium text-sm",children:t.insuredName||"â"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:t.organism})]}),e.jsx(a,{className:"max-w-[160px]",children:e.jsx("p",{className:"text-sm truncate",children:t.medicationName||"â"})}),e.jsx(a,{className:"max-w-[180px]",children:t.pathology?e.jsx("p",{className:"text-sm truncate text-blue-700 dark:text-blue-300",children:t.pathology}):e.jsx("span",{className:"text-xs text-muted-foreground italic",children:"Non renseignée"})}),e.jsx(a,{children:e.jsx(w,{status:t.status})}),e.jsx(a,{children:t.medecinExpertDecision?l(t.medecinExpertDecision.decision):e.jsx("span",{className:"text-xs text-muted-foreground italic",children:"â"})}),e.jsx(a,{className:"text-right",children:e.jsx(k,{size:"icon",variant:"ghost",onClick:()=>h(t),"data-testid":`button-view-dossier-${t.id}`,title:"Voir le dossier médical",children:e.jsx(T,{className:"h-4 w-4"})})})]},t.id))})]})})})}),e.jsx(M,{open:!!s,onOpenChange:()=>h(null),children:e.jsxs(q,{className:"max-w-2xl max-h-[85vh] overflow-y-auto",children:[e.jsx(z,{children:e.jsxs(H,{
1className:"flex items-center gap-2",children:[e.jsx(b,{className:"h-5 w-5 text-primary"}),"Dossier médical â ",s==null?void 0:s.claimNumber]})}),s&&e.jsxs("div",{className:"space-y-5 mt-2",children:[e.jsxs("div",{className:"rounded-lg border p-4 space-y-2",children:[e.jsxs("h3",{className:"font-semibold text-sm flex items-center gap-2",children:[e.jsx(L,{className:"h-4 w-4 text-muted-foreground"}),"Informations de l'assuré"]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"Nom complet"}),e.jsx("p",{className:"font-medium",children:s.insuredName||"â"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"Organisme"}),e.jsx("p",{className:"font-medium",children:s.organism||"â"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"Médicament demandé"}),e.jsx("p",{className:"font-medium",children:s.medicationName||"â"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"Statut dossier"}),e.jsx(w,{status:s.status})]})]})]}),e.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[e.jsxs("h3",{className:"font-semibold text-sm flex items-center gap-2",children:[e.jsx(F,{className:"h-4 w-4 text-muted-foreground"}),"Dossier médical de l'assuré"]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide mb-1",children:"Pathologie"}),s.pathology?e.jsx("p",{className:"text-sm bg-muted/40 rounded-md p-3 whitespace-pre-wrap",children:s.pathology}):e.jsx("p",{className:"text-sm text-muted-foreground italic",children:"Pathologie non renseignée"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide mb-1",children:"Fond de dossier"}),s.fondDossier?e.jsx("p",{className:"text-sm bg-muted/40 rounded-md p-3 whitespace-pre-wrap",children:s.fondDossier}):e.jsx("p",{className:"text-sm text-muted-foreground italic",children:"Fond de dossier non renseigné"})]})]})]}),e.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[e.jsxs("h3",{className:"font-semibold text-sm flex items-center gap-2",children:[e.jsx(b,{className:"h-4 w-4 text-muted-foreground"}),"Décision du médecin expert"]}),s.medecinExpertDecision?e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"Avis"}),l(s.medecinExpertDecision.decision)]}),s.medecinExpertDecision.createdAt&&e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"Date"}),e.jsxs("p",{className:"text-sm flex items-center gap-1",children:[e.jsx(I,{className:"h-3 w-3"}),new Date(s.medecinExpertDecision.createdAt).toLocaleDateString("fr-FR",{day:"2-digit",month:"long",year:"numeric"})]})]})]}),s.medecinExpertDecision.comments&&e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide mb-1",children:"Commentaires / Motif"}),e.jsx("p",{className:"text-sm bg-muted/40 rounded-md p-3 whitespace-pre-wrap",children:s.medecinExpertDecision.comments})]}),((g=s.medecinExpertDecision)==null?void 0:g.member)&&e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"Expert"}),e.jsxs("p",{className:"text-sm font-medium",children:[s.medecinExpertDecision.member.fullName||"â",s.medecinExpertDecision.member.specialty&&e.jsxs("span",{className:"text-muted-foreground text-xs ml-2",children:["(",R[s.medecinExpertDecision.member.specialty]||s.medecinExpertDecision.member.specialty,")"]})]})]})]}):e.jsx("p",{className:"text-sm text-muted-foreground italic",children:"Aucune décision d'expert enregistrée pour ce dossier."})]}),(s.ctDecision||s.rcpDecision)&&e.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[e.jsxs("h3",{className:"font-semibold text-sm flex items-center gap-2",children:[e.jsx(f,{className:"h-4 w-4 text-muted-foreground"}),"Autres décisions de commission"]}),s.ctDecision&&e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Commission de Transparence (CT)"}),e.jsxs("div",{className:"flex items-center gap-2",children:[l(s.ctDecision.decision),s.ctDecision.createdAt&&e.jsx("span",{className:"text-xs text-muted-foreground",children:new Date(s.ctDecision.createdAt).toLocaleDateString("fr-FR")})]}),s.ctDecision.comments&&e.jsx("p",{className:"text-sm bg-muted/40 rounded-md p-2 mt-1",children:s.ctDecision.comments})]}),s.rcpDecision&&e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"RCP"}),e.jsxs("div",{className:"flex items-center gap-2",children:[l(s.rcpDecision.decision),s.rcpDecision.createdAt&&e.jsx("span",{className:"text-xs text-muted-foreground",children:new Date(s.rcpDecision.createdAt).toLocaleDateString("fr-FR")})]}),s.rcpDecision.comments&&e.jsx("p",{className:"text-sm bg-muted/40 rounded-md p-2 mt-1",children:s.rcpDecision.comments})]})]})]})]})})]})}export{Y 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.