from fasthtml.common import * import os import json def render_interface_gestion_admin(admin_nom, solde_global_openrouter, stats_utilisateurs): """Génère l'Interface de Gestion (IDG) visible uniquement par l'administrateur.""" if admin_nom.lower() != "xavier": return Div("Accès non autorisé.", style="color:red;") return Div( H2("🛡️ Interface de Gestion (IDG) - Administration Aethas38"), Div( P(f"💰 Solde global OpenRouter : {solde_global_openrouter} $"), P("📊 Suivi financier et consommation par utilisateur :"), Table( Thead(Tr(Th("Utilisateur"), Th("Crédit Restant"), Th("Consommation Totale"))), Tbody( *[Tr(Td(u['nom']), Td(f"{u['solde']} $"), Td(f"{u['conso']} $")) for u in stats_utilisateurs] ) ), style="background:#1a1a1a; padding:20px; border-radius:8px; border:1px solid #444;" ), cls="idg-container", style="padding: 20px; color: #fff;" )