PageSourceSearch

https://baobab-scholar.com/build/assets/stats-gVo5juoj.js

js baobab-scholar.com collected 2026-10-02 01:25:14 UTC 4,062 bytes, 1 lines download raw bytes

1import{at as F,r as o,t as P,j as e,p as R,P as $,m as A,n as w,U as z,a_ as H,a6 as M,a7 as U,a8 as W,a9 as Y,E as B,T as O,q as V,v as C,w as u,x as G,y as m,Y as J}from"./app-Cmw2D6MA.js";import{S as n}from"./SubscriptionPlanService-DLQGRB_z.js";import{C as K}from"./countryService-BUQmyx_y.js";import"./ApiRoute-BN4CwzK7.js";const N=[["day","Aujourd'hui"],["week","Semaine"],["month","Mois"],["year","Année"],["total","Total"]],D=s=>Array.isArray(s)?s:Array.isArray(s==null?void 0:s.data)?s.data:[],Q=s=>typeof s=="number"?s:(s==null?void 0:s.total)??(s==null?void 0:s.revenue)??(s==null?void 0:s.amount)??0,se=()=>{const{countryId:s,id:t}=F(),[E,T]=o.useState(!0),[b,L]=o.useState(null),[h,_]=o.useState({}),[q,I]=o.useState("day");return o.useEffect(()=>{if(!s||!t){P.error("Paramètres requis.");return}(async()=>{var r,i;T(!0);try{await K.show(s);const l=await Promise.all([n.subscribersToday(s,t),n.revenueToday(s,t),n.subscribersWeek(s,t),n.revenueWeek(s,t),n.subscribersMonth(s,t),n.revenueMonth(s,t),n.subscribersYear(s,t),n.revenueYear(s,t),n.subscribersTotal(s,t),n.revenueTotal(s,t),n.stats(s,t)]),[a,c,d,x,p,j,g,f,v,S,y]=l;L(y==null?void 0:y.data),_({day:{subscribers:a==null?void 0:a.data,revenue:c==null?void 0:c.data},week:{subscribers:d==null?void 0:d.data,revenue:x==null?void 0:x.data},month:{subscribers:p==null?void 0:p.data,revenue:j==null?void 0:j.data},year:{subscribers:g==null?void 0:g.data,revenue:f==null?void 0:f.data},total:{subscribers:v==null?void 0:v.data,revenue:S==null?void 0:S.data}})}catch(l){P.error(((i=(r=l.response)==null?void 0:r.data)==null?void 0:i.message)||"Erreur lors de la récupération des statistiques.")}finally{T(!1)}})()},[s,t]),E?e.jsxs("div",{className:"flex flex-col items-center gap-2 py-20 text-muted-foreground",children:[e.jsx(R,{size:"lg",className:"text-primary"}),e.jsx("p",{children:"Chargement…"})]}):e.jsxs("div",{className:"mx-auto max-w-6xl",children:[e.jsx($,{title:`Statistiques — ${(b==null?void 0:b.name)||"Plan"}`,breadcrumb:[{label:"Pays",href:"/admin/pays"},{label:"Plans",href:`/admin/pays/${s}/subscription-plans`},{label:"Statistiques"}]}),e.jsx("div",{className:"mb-6 grid gap-4 sm:grid-cols-2 lg:grid-cols-5",children:N.map(([r,i])=>{var c,d;const l=D((c=h[r])==null?void 0:c.subscribers).length,a=Q((d=h[r])==null?void 0:d.revenue);return e.jsx(A,{children:e.jsxs(w,{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:i}),e.jsxs("p",{className:"flex items-center gap-1.5 text-sm text-muted-foreground",children:[e.jsx(z,{size:14})," ",l," abonné(s)"]}),e.jsxs("p",{className:"flex items-center gap-1.5 text-sm text-muted-foreground",children:[e.jsx(H,{size:14})," ",Number(a).toLocaleString("fr-FR")," FCFA"]})]})},r)})}),e.jsx(A,{children:e.jsx(w,{children:e.jsxs(M,{value:q,onValueChange:I,children:[e.jsx(U,{className:"flex-wrap",children:N.map(([r,i])=>e.jsx(W,{value:r,children:i},r))}),N.map(([r])=>{var l;const i=D((l=h[r])==null?void 0:l.subscribers);return e.jsx(Y,{value:r,children:i.length===0?e.jsx(B,{title:"Aucun abonnement",description:"Aucun abonnement pour cette période."}):e.jsxs(O,{wrapClassName:"border-0",children:[e.jsx(V,{children:e.jsxs(C,{className:"hover:bg-transparent",children:[e.jsx(u,{children:"Utilisateur"}),e.jsx(u,{children:"Email"}),e.jsx(u,{children:"Début"}),e.jsx(u,{children:"Fin"}),e.jsx(u,{children:"Statut"})]})}),e.jsx(G,{children:i.map(a=>{var c;return e.jsxs(C,{children:[e.jsx(m,{className:"font-medium",children:a.user?`${a.user.prenom} ${a.user.nom}`:"Inconnu"}),e.jsx(m,{className:"text-muted-foreground",children:((c=a.user)==null?void 0:c.email)||"N/A"}),e.jsx(m,{className:"text-xs text-muted-foreground",children:a.start_date?new Date(a.start_date).toLocaleDateString():"—"}),e.jsx(m,{className:"text-xs text-muted-foreground",children:a.end_date?new Date(a.end_date).toLocaleDateString():"—"}),e.jsx(m,{children:e.jsx(J,{variant:a.is_active?"success":"danger",children:a.is_active?"Actif":"Inactif"})})]},a.id)})})]})},r)})]})})})]})};export{se 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.