{% extends 'base.html.twig' %} {% block title %}Dashboard - Bubul{% endblock %} {% block meta_description %}Tableau de bord Bubul : statistiques, accès rapides aux outils IA et gestion de vos contenus pédagogiques.{% endblock %} {% block body %}
{# ================================================================ AMBIENT DECORATION - Orbes de couleur en arriere-plan ================================================================ #}
{# ================================================================ HEADER - Salutation contextuelle + user pill ================================================================ #}

Tableau de bord

{{ greeting }}, {{ user.firstName }} 👋

Retrouvez vos statistiques, explorez vos outils IA et suivez votre empreinte écologique en un coup d'œil.

{% include '_molecules/daily-reward-card/daily-reward-card.html.twig' with { canClaim: dailyStatus.canClaim, nextClaimAt: dailyStatus.nextClaimAt, claimUrl: dailyClaimUrl } only %}
{# ================================================================ STATISTIQUES (5 stat-cards en ligne) ================================================================ #} {% set percentAvailable = stats.tokens_total > 0 ? (stats.tokens_remaining / stats.tokens_total * 100)|round : 0 %}
{%- set currentPlanSlug = app.user.plan ? app.user.plan.slug : 'freemium' -%} {%- set nextPlanName = {'freemium': 'Pro', 'starter': 'Pro', 'pro': 'Expert'}[currentPlanSlug] ?? null -%} {% if not app.user.company and nextPlanName %} {% include '_atoms/icon/icon.html.twig' with { name: 'crown', size: 'xs', color: 'white' } only %} Passer en {{ nextPlanName }} {% endif %}
{% include '_molecules/stat-card/stat-card.html.twig' with { icon: 'token', label: 'Tokens restants', value: stats.tokens_remaining|format_number(locale='fr'), detail: 'sur ' ~ stats.tokens_max_storable|format_number(locale='fr') ~ ' stockables', variant: 'primary', size: 'sm' } only %}
{% include '_molecules/stat-card/stat-card.html.twig' with { icon: 'edit', label: 'Cours créés', value: stats.courses_created, detail: 'Déployés sur Moodle', variant: 'success', size: 'sm' } only %} {% include '_molecules/stat-card/stat-card.html.twig' with { icon: 'clock', label: 'Temps économisé', value: stats.time_saved_hours|number_format(0, ',', ' ') ~ 'h', detail: '≈ ' ~ (stats.time_saved_hours / 8)|round ~ ' jours', variant: 'cohorts', size: 'sm' } only %} {% include '_molecules/stat-card/stat-card.html.twig' with { icon: 'bolt', label: 'Énergie totale', value: stats.energy_wh|number_format(1, ',', ' ') ~ ' Wh', detail: (stats.energy_wh * 0.590)|number_format(1, ',', ' ') ~ 'g CO₂', variant: 'warning', size: 'sm' } only %}
{# ================================================================ OUTILS (contenu éditorial en dur, stats dynamiques via toolStats) ================================================================ #}
{% embed '_molecules/section-divider/section-divider.html.twig' with { title: 'Vos outils', subtitle: totalToolTokens|format_number(locale='fr') ~ ' tokens ce mois', icon: 'widget-add', iconColor: 'primary' } %} {% block right %}
{% include '_atoms/button/button.html.twig' with { label: 'Masquer les stats', icon: 'eye-slash', variant: 'ghost', size: 'sm', attr: {'data-action': 'click->shared--tool-stats#toggle'} } only %}
{% include '_atoms/button/button.html.twig' with { label: 'Afficher les stats', icon: 'eye', variant: 'ghost', size: 'sm', attr: {'data-action': 'click->shared--tool-stats#toggle'} } only %}
{% endblock %} {% endembed %} {% set isAdminOrManager = is_granted('ROLE_ADMIN') or (is_granted('ROLE_COMPANY_MANAGER') and can_access_tool('sam')) %}
{# --- Moodia --- #} {% include '_molecules/tool-card/tool-card.html.twig' with { name: 'Moodia', code: 'moodia', tagline: 'PDF → Cours Moodle', description: 'Transformez vos PDF en cours interactifs Moodle avec quiz, audio et images.', href: path('app_moodia'), stats: toolStats.moodia ?? {}, weekUsage: (toolStats.moodia ?? {}).weekUsage ?? [], percentage: (toolStats.moodia ?? {}).percentage ?? 0, locked: (toolStats.moodia ?? {}).locked ?? false } only %} {# --- Serenia --- #} {% include '_molecules/tool-card/tool-card.html.twig' with { name: 'Serenia', code: 'serenia', tagline: 'Assistant IA conversationnel', description: 'Chatbot IA pédagogique avec analyse de fichiers et génération d\'images.', href: path('app_seren_ia'), stats: toolStats.serenia ?? {}, weekUsage: (toolStats.serenia ?? {}).weekUsage ?? [], percentage: (toolStats.serenia ?? {}).percentage ?? 0, locked: (toolStats.serenia ?? {}).locked ?? false } only %} {# --- Slidia --- #} {% include '_molecules/tool-card/tool-card.html.twig' with { name: 'Slidia', code: 'slidia', tagline: 'Générateur de présentations', description: 'Créez des présentations PowerPoint professionnelles à partir de vos contenus.', href: path('app_slidia'), stats: toolStats.slidia ?? {}, weekUsage: (toolStats.slidia ?? {}).weekUsage ?? [], percentage: (toolStats.slidia ?? {}).percentage ?? 0, locked: (toolStats.slidia ?? {}).locked ?? false } only %} {# --- Monalisia --- #} {% include '_molecules/tool-card/tool-card.html.twig' with { name: 'Monalisia', code: 'monalisia', tagline: 'Création d\'infographies', description: 'Générez des infographies pédagogiques à partir de vos documents.', href: path('app_monalisia'), stats: toolStats.monalisia ?? {}, weekUsage: (toolStats.monalisia ?? {}).weekUsage ?? [], percentage: (toolStats.monalisia ?? {}).percentage ?? 0, locked: (toolStats.monalisia ?? {}).locked ?? false } only %} {# --- Pixia --- #} {% set pixiaStats = toolStats.pixia ?? {} %} {% include '_molecules/tool-card/tool-card.html.twig' with { name: 'Pixia', code: 'pixia', tagline: 'Générateur d\'images IA', description: 'Créez des illustrations pédagogiques professionnelles à partir de vos prompts ou documents.', href: path('app_pixia'), stats: pixiaStats, weekUsage: pixiaStats.weekUsage ?? [], percentage: pixiaStats.percentage ?? 0, locked: pixiaStats.locked ?? false, statColumns: [ { value: (pixiaStats.generated ?? 0)|format_number(locale='fr'), label: 'images générées' }, { value: (pixiaStats.tokens ?? 0)|format_number(locale='fr'), label: 'tokens' }, { value: (pixiaStats.wh ?? 0)|number_format(1, ',', ' '), label: 'Wh' } ] } only %} {# --- Castia --- #} {% include '_molecules/tool-card/tool-card.html.twig' with { name: 'Castia', code: 'castia', tagline: 'Création de podcasts', description: 'Transformez vos contenus en podcasts audio professionnels.', href: path('app_castia'), stats: toolStats.castia ?? {}, weekUsage: (toolStats.castia ?? {}).weekUsage ?? [], percentage: (toolStats.castia ?? {}).percentage ?? 0, locked: (toolStats.castia ?? {}).locked ?? false } only %} {# --- Scormia --- #} {% include '_molecules/tool-card/tool-card.html.twig' with { name: 'Scormia', code: 'scormia', tagline: 'Modules SCORM interactifs', description: 'Créez des modules e-learning SCORM à votre image : pages, blocs interactifs, quiz notés — exportables dans Moodle.', href: path('app_scormia'), stats: toolStats.scormia ?? {}, weekUsage: (toolStats.scormia ?? {}).weekUsage ?? [], percentage: (toolStats.scormia ?? {}).percentage ?? 0, locked: (toolStats.scormia ?? {}).locked ?? false, isNew: 'scormia' in new_tool_codes|default([]), newLabel: 'BETA', proBadge: scormia_needs_pro|default(false) } only %} {# --- Promptly --- #} {% set promptlyStats = toolStats.promptly ?? {} %} {% include '_molecules/tool-card/tool-card.html.twig' with { name: 'Promptly', code: 'promptly', tagline: 'Bibliothèque de prompts', description: 'Créez, partagez et réutilisez vos meilleurs prompts IA en un clic.', href: path('app_promptly'), stats: promptlyStats, weekUsage: promptlyStats.weekUsage ?? [], percentage: promptlyStats.percentage ?? 0, locked: promptlyStats.locked ?? false, isNew: 'promptly' in new_tool_codes|default([]), statColumns: [ { value: (promptlyStats.libraryTotal ?? 0)|format_number(locale='fr'), label: 'prompts bibliothèque' }, { value: (promptlyStats.myPrompts ?? 0)|format_number(locale='fr'), label: 'mes prompts' }, { value: (promptlyStats.totalCopies ?? 0)|format_number(locale='fr'), label: 'copies effectuées' }, ] } only %} {# --- SAM (admin/manager uniquement) --- #} {% if isAdminOrManager %} {% include '_molecules/tool-card/tool-card.html.twig' with { name: 'SAM', code: 'sam', tagline: 'Gestion étudiants Moodle', description: 'Suivez vos apprenants, cohortes et cours depuis Moodle.', href: path('app_sam_index'), stats: toolStats.sam ?? {}, weekUsage: (toolStats.sam ?? {}).weekUsage ?? [], percentage: (toolStats.sam ?? {}).percentage ?? 0, locked: 'sam' not in accessible_tools, statColumns: [ { value: samStats.users|format_number(locale='fr'), label: 'utilisateurs' }, { value: samStats.tokens|format_number(locale='fr'), label: 'tokens/mois' }, { value: samStats.courses|format_number(locale='fr'), label: 'cours dispo' } ] } only %} {% endif %} {# --- Carte "Proposer un outil" : affichée seulement si nb d'outils impair --- #} {% set visibleToolCount = 7 + (isAdminOrManager ? 1 : 0) %} {% if visibleToolCount is odd %}
{# Gradient décoratif gris #}
{# ===== HEADER ZONE (miroir de tool-card) ===== #}
{# Icône grise #}
{% include '_atoms/icon/icon.html.twig' with { name: 'lightbulb-bolt', size: 'lg', color: 'gray' } only %}
{# Contenu #}
Nouvel outil {# Pastille animée "en cours" #}
Bientôt disponible

De nouveaux outils sont en préparation. Vous avez une idée ? Partagez-la !

{# ===== STATS ROW (placeholder gris) ===== #}
{# ===== FOOTER (CTA) ===== #}
{% endif %}
{# /data-controller="shared--tool-stats" #}
{# ================================================================ EMPREINTE ÉCOLOGIQUE ================================================================ #}
{% include '_molecules/section-divider/section-divider.html.twig' with { title: 'Empreinte écologique', subtitle: 'Consommation globale', icon: 'earth', iconColor: 'success' } only %} {% include '_organisms/eco-footprint/eco-footprint.html.twig' with { totalWh: ecoData.totalWh, period: ecoData.period, weeklyData: ecoData.weeklyData, weekDelta: ecoData.weekDelta } only %}
{# ================================================================ BADGES ================================================================ #} {% if dashboardBadges is defined and dashboardBadges|length > 0 %}
{% embed '_molecules/section-divider/section-divider.html.twig' with { title: 'Mes badges', subtitle: 'Progression et récompenses', icon: 'crown', iconColor: 'warning' } %} {% block right %} Voir tout {% endblock %} {% endembed %}
{% for item in dashboardBadges %} {% if item.componentType == 'group-card' %} {% include '_molecules/badge-group-card/badge-group-card.html.twig' with { levels: item.levels, hexColorInner: item.hexColorInner, hexColorOuter: item.hexColorOuter, class: 'shrink-0 w-[155px] sm:w-[175px] h-auto', } only %} {% endif %} {% endfor %}
{% endif %} {# ================================================================ ACTIVITÉS RÉCENTES ================================================================ #}
{% embed '_molecules/section-divider/section-divider.html.twig' with { title: 'Activités récentes', subtitle: recentActivity|length ~ ' actions ce mois', icon: 'clock', iconColor: 'primary' } %} {% block right %} Voir tout {% endblock %} {% endembed %}
{% include '_organisms/dashboard-activity/dashboard-activity.html.twig' with { activities: recentActivity, limit: 5, viewMoreHref: path('app_activity_history') } only %}
{% endblock %}