PageSourceSearch

https://ecole.fidesassurances.fr/assets/AttestationHub-D36aLiF0.js

js fidesassurances.fr collected 2026-10-05 10:31:38 UTC 11,078 bytes, 1 lines download raw bytes

1import{s as g,D as w,d as Z,j as e,I as H,B as I,h as ee}from"./index-Chtp3ooj.js";import{r as a}from"./recharts-D7Th9nWn.js";import{C as B}from"./card-bDSgrk93.js";import{L as f}from"./label-jiPIBGgE.js";import{S as T,a as E,b as D,c as G,d as _}from"./select-CaYex8Mn.js";import te from"./AttestationScolaire-CUF-GR9K.js";import se from"./AttestationRC-g0867_Sb.js";import ae from"./AttestationMultirisques-SOkrvNSE.js";import{f as ne}from"./immeubles-contract-filter-aOWtqtfy.js";import{r as U,d as Y}from"./resolve-attestation-contract-dates-BzfmjEY8.js";import{D as ie}from"./DatePicker-DxXQtCdO.js";import{C as re}from"./checkbox-5NZOrwa3.js";import{A as le}from"./address-autocomplete-nIVgVVHU.js";import{d as ce}from"./download-pdf-blob-BcwOZ8cR.js";import{d as oe}from"./pdf-template-builder-utils-B9J6XPc_.js";import{c as de,d as me,e as ue,f as xe,h as pe,i as he}from"./pdf-template-request-builders-DBjEeNaO.js";import{r as fe}from"./insurer-routing-LUeQPzry.js";import{C as ge}from"./circle-check-iP5pZaIc.js";import{D as ye}from"./download-CZSBrMD2.js";import{A as je}from"./arrow-left-CoUhInmm.js";import"./supabase-CZSOkAWR.js";import"./index-BdQq_4o_.js";import"./index-OGt32nKC.js";import"./build-school-insurance-certificate-generali-request-BCYrxHqZ.js";import"./popover-DqxCoxNV.js";import"./fr-DxArNyby.js";import"./post-pdf-template-CgL1PjU5.js";import"./entity-contract-helpers-CCvWpqGI.js";import"./type-guards-yZbAtGhy.js";import"./chunked-in-k4LFsKaW.js";const P="Multirisques",ve=t=>{const[i,n]=a.useState([]),[y,r]=a.useState(!0),[N,l]=a.useState("");return a.useEffect(()=>{(async()=>{var v,S;if(!t)return;const{data:j}=await g.from("ecole_utilisateurs").select("entity_id").eq("user_id",t.id),m=(j??[]).map(h=>h.entity_id).filter(Boolean);if(m.length===0){r(!1);return}const{data:o}=await g.from("ecoles").select("nom, espace").in("id",m),d=(o??[]).find(h=>h.espace==="syndic");let u=(d==null?void 0:d.nom)??"",x=[...m];const{data:C}=await g.from("fondation_ecoles").select("child_entity_id").in("parent_entity_id",m);if(C&&C.length>0&&(x=[...new Set([...x,...C.map(h=>h.child_entity_id)])]),!u){const{data:h}=await g.from("fondation_ecoles").select("parent_entity_id").in("child_entity_id",m),A=(h??[]).map(c=>c.parent_entity_id).filter(Boolean);if(A.length>0){const{data:c}=await g.from("ecoles").select("nom").in("id",A).eq("espace","syndic").limit(1).maybeSingle();u=(c==null?void 0:c.nom)??((v=o==null?void 0:o[0])==null?void 0:v.nom)??""}else u=((S=o==null?void 0:o[0])==null?void 0:S.nom)??""}l(u);const{data:b}=await g.from("ecoles").select("id, nom, adresse, code_postal, ville, espace").in("id",x).eq("espace","immeuble").order("nom",{ascending:!0}),M=await ne(b??[],[P],{excludeArchived:!0});n(M),r(!1)})()},[t]),{immeubles:i,loadingImmeubles:y,syndicName:N}},be=t=>{const[i,n]=a.useState(null),[y,r]=a.useState(null),[N,l]=a.useState(!1);return a.useEffect(()=>{(async()=>{if(!t){n(null),r(null),l(!1);return}l(!1);const{data:j}=await g.from("contrats").select("numero, compagnie, date_effet, date_fin").eq("entity_id",t).eq("type_contrat",P);if(j&&j.length>0){const{contract:d,status:u}=U(j);n(d),r(Y(u)),l(!0);return}const{data:m}=await g.from("fondation_ecoles").select("parent_entity_id").eq("child_entity_id",t),o=(m??[]).map(d=>d.parent_entity_id).filter(Boolean);if(o.length>0){const{data:d}=await g.from("contrats").select("numero, compagnie, date_effet, date_fin").in("entity_id",o).eq("type_contrat",P).eq("is_shared",!0),{contract:u,status:x}=U(d??[]);n(u),r(Y(x))}else n(null),r(null);l(!0)})()},[t]),{contrat:i,contratBlockingMessage:y,contratLoaded:N}},Ne={AG:{generali:he,other:pe},CS:{generali:xe,other:ue},RCOP:{generali:me,other:de}};function Ce(t){return{OutputFileName:oe("Multirisques",t.contractNumber??t.buildingName),BuildingName:t.buildingName,BuildingPrimaryAddress:t.buildingPrimaryAddress,SyndicName:t.syndicName,ContractNumber:t.contractNumber??"",OccupationDate:w(t.occupationDate,"dd/MM/yyyy"),StartTime:t.startTime,EndTime:t.endTime,OccupationAddress:t.occupationAddress,CurrentDate:w(new Date,"dd/MM/yyyy")}}function Se(t){const i=Ce(t),n=Ne[t.meetingType];return fe(t.contractCompany,"syndicMultiRisk",()=>n.generali(i),()=>n.other(i),"attestation Multirisques")}const Ae=[{value:"AG",label:"Assemblée générale"},{value:"CS",label:"Conseil syndical"},{value:"RCOP",label:"Réunion de copropriétaires"}],_e=()=>{const{user:t}
1=Z(),{immeubles:i,loadingImmeubles:n,syndicName:y}=ve(t),[r,N]=a.useState(""),{contrat:l,contratBlockingMessage:k,contratLoaded:j}=be(r);a.useEffect(()=>{!r&&i.length===1&&N(i[0].id)},[i,r]);const[m,o]=a.useState(""),[d,u]=a.useState(""),[x,C]=a.useState(),[b,M]=a.useState(""),[v,S]=a.useState(""),[h,A]=a.useState(!1),[c,L]=a.useState(null),[J,F]=a.useState(""),[O,z]=a.useState(!1),[V,q]=a.useState(null),p=i.find(s=>s.id===r)??null,R=!!b&&!!v&&v<=b,$=!!p&&j&&!!l&&!!m&&!!d.trim()&&!!x&&!!b&&!!v&&!R&&h,Q=async()=>{if(!(!$||!p||!x||!m)){z(!0),q(null);try{const s=await Se({meetingType:m,buildingName:p.nom,buildingPrimaryAddress:`${p.adresse} ${p.code_postal} ${p.ville}`.trim(),syndicName:y,contractNumber:(l==null?void 0:l.numero)??null,contractCompany:(l==null?void 0:l.compagnie)??null,occupationDate:x,startTime:b,endTime:v,occupationAddress:d}),X=`Fides_Attestation_Multirisques_${w(x,"dd-MM-yyyy")}.pdf`;L(s),F(X)}catch(s){q(s instanceof Error?s.message:"La génération API du PDF est indisponible.")}finally{z(!1)}}},K=()=>{c&&ce(c,J)},W=()=>{L(null),F(""),o(""),u(""),C(void 0),M(""),S(""),A(!1),q(null)};return e.jsxs("div",{className:"mx-auto max-w-2xl space-y-8",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Obtenir une attestation d'assurance Multirisques Immeubles"}),e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Remplissez les informations pour générer votre attestation."})]}),e.jsxs(B,{className:"surface-section-card p-6 space-y-4",children:[e.jsx("h2",{className:"surface-section-title text-lg font-semibold",children:"Immeuble concerné"}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(f,{children:["Immeuble ",e.jsx("span",{className:"text-destructive",children:"*"})]}),n?e.jsx("p",{className:"text-sm text-muted-foreground",children:"Chargement…"}):i.length===0?e.jsx("p",{className:"text-sm text-destructive",children:"Aucun immeuble associé à votre compte."}):e.jsxs(T,{value:r,onValueChange:N,disabled:!!c,children:[e.jsx(E,{children:e.jsx(D,{placeholder:"Choisir un immeuble"})}),e.jsx(G,{children:i.map(s=>e.jsx(_,{value:s.id,children:s.nom},s.id))})]})]}),p&&e.jsxs("div",{className:"space-y-1",children:[e.jsx(f,{className:"text-muted-foreground text-xs",children:"Adresse principale"}),e.jsxs("p",{className:"text-sm font-medium text-foreground",children:[p.adresse," ",p.code_postal," ",p.ville]})]}),p&&j&&!l&&e.jsx("p",{className:"text-sm text-destructive",children:k??"Aucun contrat Multirisques trouvé pour cet immeuble. Contactez votre gestionnaire."})]}),e.jsxs(B,{className:"surface-section-card p-6 space-y-5",children:[e.jsx("h2",{className:"surface-section-title text-lg font-semibold",children:"Concerne"}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(f,{children:["Type ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsxs(T,{value:m,onValueChange:s=>o(s),disabled:!!c,children:[e.jsx(E,{children:e.jsx(D,{placeholder:"Choisir un type"})}),e.jsx(G,{children:Ae.map(s=>e.jsx(_,{value:s.value,children:s.label},s.value))})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(f,{children:["Adresse de l'évènement ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(le,{value:d,onChange:u,onSelect:s=>u(`${s.name} ${s.postcode} ${s.city.toUpperCase()}`),placeholder:"Rechercher une adresse…"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(f,{children:["Date de l'évènement ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(ie,{value:x,onChange:C,disabled:!!c})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(f,{children:["Heure de début ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(H,{type:"time",value:b,onChange:s=>M(s.target.value),disabled:!!c})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(f,{children:["Heure de fin ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(H,{type:"time",value:v,onChange:s=>S(s.target.value),disabled:!!c,className:R?"border-destructive":""}),R&&e.jsx("p",{className:"text-xs text-destructive",children:"L'heure de fin doit être postérieure à l'heure de début."})]})]})]}),c?e.jsxs(B,{className:"flex flex-col items-center gap-4 p-8 bg-emerald-50 border-emerald-200",children:[e.jsx(ge,{className:"h-10 w-10 text-emerald-600"}),e.jsx("p",{className:"text-center text-sm font-medium text-emerald-800",children:"Votre attestation a été générée avec succès."}),e.jsxs(I,{onClick:K,size:"lg",className:"gap-2 w-full",children:[e.jsx(ye,{className:"h-4 w-4"}),"Télécharger l'attestation"]}),e.jsx(I,{variant:"ghost",size:"sm",onClick:W,children:"Générer une nouvelle attestation"})]}):e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(re,{id:"confirm-multirisques-syndic",checked:h,onCheckedChange:s=>A(s===!0)}),e.jsx(f,{htmlFor:"confirm-multirisques-syndic",className:"text-sm leading-snug cursor-pointer",children:"Je confirme l'exactitude des informations ci-dessus."})]}),V&&e.jsx("p",{className:"text-sm text-destructive",children:V}),e.jsx(I,{onClick:Q,disabled:!$||O,className:"primary-action-button w-full",size:"lg",children:O?"Génération en cours…":"Valider"})]})]})},at=()=>{const{espace:t,loading:i}=ee(),[n,y]=a.useState("");return i?null:t==="syndic"?e.jsx(_e,{}):n?e.jsxs("div",{children:[e.jsx("div",{className:"mx-auto max-w-2xl mb-4",children:e.jsxs(I,{variant:"ghost",size:"sm",onClick:()=>y(""),className:"gap-1.5 text-muted-foreground hover:text-foreground",children:[e.jsx(je,{className:"h-4 w-4"}),"Retour au choix du type d'attestation"]})}),n==="eleve"&&e.jsx(te,{}),n==="rc"&&e.jsx(se,{}),n==="multirisques"&&e.jsx(ae,{})]}):e.jsxs("div",{className:"mx-auto max-w-2xl space-y-8",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Obtenir une attestation"}),e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Sélectionnez le type d'attestation souhaité."})]}),e.jsx(B,{className:"p-6 space-y-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsxs(f,{children:["Type d'attestation ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsxs(T,{value:n,onValueChange:r=>y(r),children:[e.jsx(E,{children:e.jsx(D,{placeholder:"Choisir un type d'attestation"})}),e.jsxs(G,{children:[t!=="entreprise"&&e.jsx(_,{value:"eleve",children:"Pour un élève"}),e.jsx(_,{value:"rc",children:"Responsabilité civile"}),e.jsx(_,{value:"multirisques",children:"Multirisques"})]})]})]})})]})};export{at 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.