PageSourceSearch

https://baobab-scholar.com/build/assets/index-CHhdCHYL.js

js baobab-scholar.com collected 2026-10-02 01:24:21 UTC 3,894 bytes, 1 lines download raw bytes

1import{at as q,r,j as e,P as L,B as f,l as E,m as R,n as G,p as J,E as K,T as O,q as U,v as C,w as D,x as V,y as S,z as $,G as Q,H as W,J as X,K as w,aM as Y,aq as Z,t as i}from"./app-Cmw2D6MA.js";import{T as h}from"./TypeDocumentService-kOXYy2M4.js";import{A as ee,E as se,D as te}from"./DetailModal-CxfQa9Pv.js";import{D as ae}from"./DeleteFormModal-CqJBYba7.js";import{E as oe}from"./eye-DK92qdAV.js";import{P as ne}from"./pencil-B3xUHpOo.js";import"./ApiRoute-BN4CwzK7.js";const x=c=>{var o;const t=(o=c.response)==null?void 0:o.data;t!=null&&t.message&&i.error(t.message),t!=null&&t.errors&&Object.values(t.errors).flat().forEach(d=>i.error(d)),t||i.error("Une erreur inattendue s'est produite.")},pe=()=>{const{id:c}=q(),[t,o]=r.useState(!0),[d,u]=r.useState([]),[m,v]=r.useState(null),[b,p]=r.useState(!1),[N,j]=r.useState(!1),[T,A]=r.useState(null),[z,y]=r.useState(!1),[P,M]=r.useState(null),[H,g]=r.useState(!1),[I,_]=r.useState(null);r.useEffect(()=>{(async()=>{var n,s;o(!0);try{const l=await h.liste(c);u(((n=l==null?void 0:l.data)==null?void 0:n.type_documents)||[]),v(((s=l==null?void 0:l.data)==null?void 0:s.country)||null)}catch(l){x(l)}finally{o(!1)}})()},[c]);const B=async a=>{var n;try{o(!0);const s=await h.ajoutTypeDocument(c,a);p(!1),u(((n=s==null?void 0:s.data)==null?void 0:n.type_documents)||[]),i.success((s==null?void 0:s.message)||"Type de document ajouté avec succès !")}catch(s){x(s)}finally{o(!1)}},F=async a=>{var n;try{o(!0);const s=await h.updateTypeDocument(c,T.id,a);j(!1),u(((n=s==null?void 0:s.data)==null?void 0:n.type_documents)||[]),i.success("Type de document mis à jour avec succès !")}catch(s){x(s)}finally{o(!1)}},k=async a=>{var n;o(!0);try{const s=await h.deleteTypeDocument(c,P.id,a);y(!1),u(((n=s==null?void 0:s.data)==null?void 0:n.type_documents)||[]),i.success("Type de document supprimé avec succès !")}catch(s){throw x(s),s}finally{o(!1)}};return e.jsxs("div",{className:"mx-auto max-w-5xl",children:[e.jsx(L,{title:"Types de documents",description:m!=null&&m.name?`Pays : ${m.name}`:void 0,breadcrumb:[{label:"Pays",href:"/admin/pays"},{label:"Types de documents"}],actions:e.jsx(f,{leftIcon:e.jsx(E,{size:16}),onClick:()=>p(!0),children:"Nouveau type"})}),e.jsx(R,{children:e.jsx(G,{className:"p-0",children:t?e.jsxs("div",{className:"flex flex-col items-center gap-2 py-16 text-muted-foreground",children:[e.jsx(J,{size:"lg",className:"text-primary"}),e.jsx("p",{children:"Chargement…"})]}):d.length===0?e.jsx(K,{title:"Aucun type de document",description:"Aucun type de document n'est enregistré pour ce pays.",action:e.jsx(f,{leftIcon:e.jsx(E,{size:16}),onClick:()=>p(!0),children:"Ajouter un type"})}):e.jsxs(O,{wrapClassName:"border-0",children:[e.jsx(U,{children:e.jsxs(C,{className:"hover:bg-transparent",children:[e.jsx(D,{children:"Nom"}),e.jsx(D,{children:"Sigle"}),e.jsx(D,{className:"text-right",children:"Actions"})]})}),e.jsx(V,{children:d.map(a=>e.jsxs(C,{children:[e.jsx(S,{className:"font-medium",children:a.nom||"---"}),e.jsx(S,{children:a.sigle||"---"}),e.jsx(S,{className:"text-right",children:e.jsxs($,{children:[e.jsx(Q,{asChild:!0,children:e.jsx(f,{variant:"ghost",size:"icon",children:e.jsx(W,{size:18})})}),e.jsxs(X,{children:[e.jsxs(w,{onSelect:()=>{_(a),g(!0)},children:[e.jsx(oe,{size:16})," Détail"]}),e.jsxs(w,{onSelect:()=>{A(a),j(!0)},children:[e.jsx(ne,{size:16})," Édition"]}),e.jsx(Y,{}),e.jsxs(w,{destructive:!0,onSelect:()=>{M(a),y(!0)},children:[e.jsx(Z,{size:16})," Suppression"]})]})]})})]},a.id))})]})})}),e.jsx(ee,{title:"Ajouter un type de document",show:b,onClose:()=>p(!1),onSubmit:B,isLoading:t}),e.jsx(se,{title:"Modifier le type de document",show:N,onClose:()=>j(!1),onSubmit:F,isLoading:t,initialData:T}),e.jsx(ae,{show:z,onClose:()=>y(!1),onSubmit:k,isLoading:t}),e.jsx(te,{title:"Détails du type de document",show:H,onClose:()=>g(!1),entite:I})]})};export{pe 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.