PageSourceSearch

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

js baobab-scholar.com collected 2026-10-02 01:23:53 UTC 5,952 bytes, 1 lines download raw bytes

1import{r,j as e,P as J,B as l,l as Z,b as C,m as F,W as _,X as L,n as R,F as x,I as k,o as q,S as B,e as I,f as M,g as V,h as j,p as ee,E as se,a1 as te,T as ae,q as ie,v as D,w as c,x as re,y as o,Y as ne,aq as le,ah as ce,ai as oe,aj as de,ak as ue,al as he,ao as xe,ap as je,t as m}from"./app-Cmw2D6MA.js";import{P as H}from"./PostService-chH5GZOd.js";import{L as U}from"./LocationService-BcMIqKc_.js";import{R as me}from"./rotate-ccw-D2l6HhT7.js";import{E as ge}from"./eye-DK92qdAV.js";import{P as pe}from"./pencil-B3xUHpOo.js";import"./ApiMultipartService-CmgOODpV.js";const fe={published:"success",draft:"neutral",archived:"warning"},ze=()=>{const[S,$]=r.useState([]),[G,b]=r.useState(!0),[N,T]=r.useState(""),[K,O]=r.useState([]),[z,g]=r.useState([]),[A,P]=r.useState(""),[w,p]=r.useState(""),[d,f]=r.useState(null),[v,y]=r.useState(""),[Q,E]=r.useState(!1),u=async(s={})=>{var t,i;b(!0);try{const a=await H.liste(s),n=(a==null?void 0:a.data)||a;$((n==null?void 0:n.posts)||[])}catch(a){m.error(((i=(t=a.response)==null?void 0:t.data)==null?void 0:i.message)||"Erreur lors du chargement.")}finally{b(!1)}};r.useEffect(()=>{u(),(async()=>{var s;try{const t=await U.countries();O(((s=t==null?void 0:t.data)==null?void 0:s.countries)||[])}catch{}})()},[]);const h=(s={})=>{const t={},i=s.q??N,a=s.country_id??A,n=s.universite_id??w;i&&(t.q=i),a&&(t.country_id=a),n&&(t.universite_id=n),u(t)},W=async s=>{var i;const t=s==="all"?"":s;if(P(t),p(""),g([]),t)try{const a=await U.universitesByCountry(t);g(((i=a==null?void 0:a.data)==null?void 0:i.universites)||[])}catch{}h({country_id:t,universite_id:""})},X=()=>{T(""),P(""),p(""),g([]),u()},Y=async()=>{var s,t;if(!v){m.error("Le code admin est requis.");return}E(!0);try{await H.delete(d.id,{code_admin:v}),m.success("Article supprimé."),f(null),y(""),u()}catch(i){m.error(((t=(s=i.response)==null?void 0:s.data)==null?void 0:t.message)||"Erreur lors de la suppression.")}finally{E(!1)}};return e.jsxs("div",{className:"mx-auto max-w-7xl",children:[e.jsx(J,{title:"Articles",description:"Articles du blog.",breadcrumb:[{label:"Blog"},{label:"Articles"}],actions:e.jsx(l,{asChild:!0,leftIcon:e.jsx(Z,{size:16}),children:e.jsx(C,{to:"/admin/blog/articles/ajout",children:"Nouvel article"})})}),e.jsxs(F,{className:"mb-6",children:[e.jsx(_,{children:e.jsx(L,{children:"Filtres"})}),e.jsx(R,{children:e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[e.jsx(x,{label:"Recherche",children:e.jsx(k,{value:N,onChange:s=>T(s.target.value),onKeyDown:s=>{s.key==="Enter"&&h()},placeholder:"Titre, contenu…",leftIcon:e.jsx(q,{size:16})})}),e.jsx(x,{label:"Pays",children:e.jsxs(B,{value:A||"all",onValueChange:W,children:[e.jsx(I,{children:e.jsx(M,{placeholder:"Tous (Global)"})}),e.jsxs(V,{children:[e.jsx(j,{value:"all",children:"Tous (Global)"}),K.map(s=>e.jsx(j,{value:String(s.id),children:s.name},s.id))]})]})}),e.jsx(x,{label:"Université",children:e.jsxs(B,{value:w||"all",onValueChange:s=>{const t=s==="all"?"":s;p(t),h({universite_id:t})},disabled:!z.length,children:[e.jsx(I,{children:e.jsx(M,{placeholder:"Toutes"})}),e.jsxs(V,{children:[e.jsx(j,{value:"all",children:"Toutes"}),z.map(s=>e.jsx(j,{value:String(s.id),children:s.nom},s.id))]})]})}),e.jsxs("div",{className:"flex items-end gap-2",children:[e.jsx(l,{className:"flex-1",leftIcon:e.jsx(q,{size:16}),onClick:()=>h(),children:"Rechercher"}),e.jsx(l,{variant:"secondary",size:"icon",onClick:X,title:"Réinitialiser",children:e.jsx(me,{size:16})})]})]})})]}),e.jsxs(F,{children:[e.jsx(_,{children:e.jsx(L,{children:"Liste des articles"})}),e.jsx(R,{className:"p-0",children:G?e.jsx("div",{className:"flex justify-center py-16",children:e.jsx(ee,{size:"lg",className:"text-primary"})}):S.length===0?e.jsx(se,{icon:te,title:"Aucun article",description:"Aucune donnée disponible."}):e.jsxs(ae,{wrapClassName:"border-0",children:[e.jsx(ie,{children:e.jsxs(D,{className:"hover:bg-transparent",children:[e.jsx(c,{children:"Titre"}),e.jsx(c,{children:"Auteur"}),e.jsx(c,{children:"Statut"}),e.jsx(c,{children:"Visibilité"}),e.jsx(c,{children:"Pays / Université"}),e.jsx(c,{className:"text-right",children:"Action"})]})}),e.jsx(re,{children:S.map(s=>{var t,i,a,n;return e.jsxs(D,{children:[e.jsx(o,{className:"font-medium",children:s.title}),e.jsx(o,{className:"text-muted-foreground",children:(t=s.author)!=null&&t.prenom?`${s.author.prenom} ${s.author.nom}`:((i=s.author)==null?void 0:i.email)||"—"}),e.jsx(o,{children:e.jsx(ne,{variant:fe[s.status]||"neutral",children:s.status})}),e.jsx(o,{className:"text-muted-foreground",children:s.visibility}),e.jsx(o,{className:"text-muted-foreground",children:((a=s.country)==null?void 0:a.name)||((n=s.universite)==null?void 0:n.nom)||"—"}),e.jsx(o,{children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(l,{asChild:!0,size:"icon",variant:"ghost",title:"Voir",children:e.jsx(C,{to:`/admin/blog/articles/${s.id}`,children:e.jsx(ge,{size:16})})}),e.jsx(l,{asChild:!0,size:"icon",variant:"ghost",title:"Éditer",children:e.jsx(C,{to:`/admin/blog/articles/${s.id}/edition`,children:e.jsx(pe,{size:16})})}),e.jsx(l,{size:"icon",variant:"ghost",className:"text-danger",title:"Supprimer",onClick:()=>f(s),children:e.jsx(le,{size:16})})]})})]},s.id)})})]})})]}),e.jsx(ce,{open:!!d,onOpenChange:s=>{s||(f(null),y(""))},children:e.jsxs(oe,{size:"sm",children:[e.jsx(de,{children:e.jsx(ue,{children:"Supprimer l'article"})}),e.jsxs(he,{className:"space-y-4",children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Confirmer la suppression de « ",d==null?void 0:d.title," » ? Saisissez votre code admin."]}
1),e.jsx(x,{label:"Code admin",children:e.jsx(k,{value:v,onChange:s=>y(s.target.value),placeholder:"••••••"})})]}),e.jsxs(xe,{children:[e.jsx(je,{asChild:!0,children:e.jsx(l,{variant:"secondary",children:"Annuler"})}),e.jsx(l,{variant:"danger",onClick:Y,loading:Q,children:"Supprimer"})]})]})})]})};export{ze 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.