1 line
3.8 KiB
JavaScript
1 line
3.8 KiB
JavaScript
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,6655,e=>{"use strict";let a=e.i(47167).default.env.NEXT_PUBLIC_API_URL??"/admin/api/v1";e.s(["ADMIN_API_BASE",0,a])},33553,e=>{"use strict";var a=e.i(43476),s=e.i(71645),t=e.i(22016),l=e.i(51224),r=e.i(6655);e.s(["default",0,function(){let{language:e,dict:i}=(0,l.useAdminI18n)(),n={en:{kpis:["Total companies","Active companies","Total renters","Total reservations"],platformOverview:"Platform overview",cards:[["Companies","List, search, suspend, reactivate, and review subscription state.","View all →"],["Renters","Support flows for blocking and unblocking marketplace renters.","View all →"],["Audit logs","Full trace of every admin action taken on the platform.","View logs →"]]},fr:{kpis:["Entreprises totales","Entreprises actives","Locataires totaux","Réservations totales"],platformOverview:"Vue d’ensemble de la plateforme",cards:[["Entreprises","Lister, rechercher, suspendre, réactiver et consulter l’état des abonnements.","Voir tout →"],["Locataires","Gérer l’assistance liée au blocage et au déblocage des locataires de la marketplace.","Voir tout →"],["Journaux d’audit","Consulter la trace complète de chaque action d’administration sur la plateforme.","Voir les journaux →"]]},ar:{kpis:["إجمالي الشركات","الشركات النشطة","إجمالي المستأجرين","إجمالي الحجوزات"],platformOverview:"نظرة عامة على المنصة",cards:[["الشركات","اعرض الشركات وابحث عنها وعلّقها وأعد تفعيلها وراجع حالة الاشتراك.","عرض الكل ←"],["المستأجرون","إدارة طلبات الدعم الخاصة بحظر مستأجري السوق وفك الحظر عنهم.","عرض الكل ←"],["سجلات التدقيق","مراجعة السجل الكامل لكل إجراء إداري تم على المنصة.","عرض السجلات ←"]]}}[e],[c,o]=(0,s.useState)(null),[d,m]=(0,s.useState)(!0);(0,s.useEffect)(()=>{fetch(`${r.ADMIN_API_BASE}/admin/metrics`,{credentials:"include",cache:"no-store"}).then(e=>e.json()).then(e=>o(e.data)).catch(()=>null).finally(()=>m(!1))},[]);let p=c?[{label:"Total companies",value:c.totalCompanies},{label:n.kpis[1],value:c.activeCompanies},{label:n.kpis[2],value:c.totalRenters},{label:n.kpis[3],value:c.totalReservations}]:[];return p.length>0&&(p[0].label=n.kpis[0]),(0,a.jsxs)("div",{className:"shell py-8 space-y-8",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-xs uppercase tracking-[0.2em] text-emerald-400",children:i.admin}),(0,a.jsx)("h1",{className:"mt-1 text-3xl font-black",children:n.platformOverview})]}),(0,a.jsx)("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-4",children:d?Array.from({length:4}).map((e,s)=>(0,a.jsxs)("div",{className:"panel p-6 animate-pulse",children:[(0,a.jsx)("div",{className:"h-3 w-24 rounded bg-zinc-800"}),(0,a.jsx)("div",{className:"mt-3 h-8 w-16 rounded bg-zinc-800"})]},s)):p.map(e=>(0,a.jsxs)("div",{className:"panel p-6",children:[(0,a.jsx)("p",{className:"text-xs text-zinc-500",children:e.label}),(0,a.jsx)("p",{className:"mt-1 text-3xl font-black",children:e.value?.toLocaleString()??"—"})]},e.label))}),(0,a.jsx)("div",{className:"grid gap-6 md:grid-cols-3",children:[["/dashboard/companies",...n.cards[0]],["/dashboard/renters",...n.cards[1]],["/dashboard/audit-logs",...n.cards[2]]].map(([e,s,l,r])=>(0,a.jsxs)(t.default,{href:e,className:"panel p-6 hover:border-zinc-700 transition-colors block",children:[(0,a.jsx)("p",{className:"text-sm font-semibold text-zinc-200",children:s}),(0,a.jsx)("p",{className:"mt-2 text-sm text-zinc-500",children:l}),(0,a.jsx)("p",{className:"mt-4 text-xs text-emerald-400 font-medium",children:r})]},e))})]})}])}]); |