{# # ============================================================================ # PAGE: MOODIA CONFIGURATION # ============================================================================ # # Formulaire de configuration avec split-view et preview live. # Utilise les composants Atomic Design : card, page-header, button, icon. # # ============================================================================ # STIMULUS CONTROLLER # ============================================================================ # # data-controller="moodia--config" # Targets: form, aiButton, submitBtn, data, preview, previewTitle, # previewPublic, previewLevel, previewLanguage, previewDuration, previewApproach # # ============================================================================ # DONNÉES REQUISES # ============================================================================ # # | Variable | Type | Description | # |-------------------|--------|--------------------------------| # | form | Form | Formulaire Symfony | # | mode | string | 'pdf' ou 'prompt' | # | prompt | string | Prompt initial (si mode=prompt)| # | estimatedDuration | int | Durée estimée du PDF | # # ============================================================================ #} {% extends 'base.html.twig' %} {% block title %}Configuration - Moodia{% endblock %} {% block meta_description %}Configurez les paramètres de votre cours Moodle : titre, public, niveau, durée et objectifs pédagogiques.{% endblock %} {% block body %}
{# ==================================================================== EN-TÊTE DE PAGE (Molecule: page-header) ==================================================================== #} {% include '_molecules/page-header/page-header.html.twig' with { title: 'Configurez votre cours', subtitle: 'Personnalisez les paramètres pédagogiques avant la génération', icon: 'settings', class: '!pt-0' } only %} {# ==================================================================== SPLIT-VIEW : FORMULAIRE + PREVIEW ==================================================================== #}
{# ============================================================ COLONNE GAUCHE : FORMULAIRE ============================================================ #}
{{ form_start(form, { 'attr': { 'class': 'space-y-6', 'data-moodia--config-target': 'form', 'novalidate': 'novalidate' } }) }} {# ====================================================== Section 1 : Identité du cours (Molecule: card) ====================================================== #} {% embed '_molecules/card/card.html.twig' with { title: 'Identité du cours', subtitle: 'Informations principales', icon: 'book', iconColor: 'primary', padding: 'md', form: form } %} {% block body %}
{# Titre du cours #}
{{ form_label(form.courseTitle, null, { 'label_attr': {'class': 'block text-sm font-medium text-gray-700 mb-1.5'} }) }} {{ form_widget(form.courseTitle, { 'attr': { 'class': 'w-full px-4 py-2.5 text-base border border-gray-200 rounded-xl focus:border-primary focus:ring-2 focus:ring-primary/20 transition-all', 'data-action': 'input->moodia--config#updatePreview' } }) }} {{ form_errors(form.courseTitle) }}
{# Public cible #}
{{ form_label(form.publicTarget, null, { 'label_attr': {'class': 'block text-sm font-medium text-gray-700 mb-1.5'} }) }} {{ form_widget(form.publicTarget, { 'attr': { 'class': 'w-full px-4 py-2.5 text-base border border-gray-200 rounded-xl focus:border-primary focus:ring-2 focus:ring-primary/20 transition-all', 'data-action': 'input->moodia--config#updatePreview' } }) }} {{ form_errors(form.publicTarget) }}
{% endblock %} {% endembed %} {# ====================================================== Section 2 : Paramètres pédagogiques (Molecule: card) ====================================================== #} {% embed '_molecules/card/card.html.twig' with { title: 'Paramètres pédagogiques', subtitle: 'Niveau et durée', icon: 'chart', iconColor: 'success', padding: 'md', form: form, estimatedDuration: estimatedDuration } %} {% block body %}
{# Niveau #}
{{ form_label(form.level, null, { 'label_attr': {'class': 'block text-sm font-medium text-gray-700 mb-1.5'} }) }} {{ form_widget(form.level, { 'attr': { 'class': 'w-full px-4 py-2.5 text-base bg-white border border-gray-200 rounded-xl focus:border-primary focus:ring-2 focus:ring-primary/20 transition-all', 'data-action': 'change->moodia--config#updatePreview' } }) }} {{ form_errors(form.level) }}
{# Langue #}
{{ form_label(form.language, null, { 'label_attr': {'class': 'block text-sm font-medium text-gray-700 mb-1.5'} }) }} {{ form_widget(form.language, { 'attr': { 'class': 'w-full px-4 py-2.5 text-base bg-white border border-gray-200 rounded-xl focus:border-primary focus:ring-2 focus:ring-primary/20 transition-all', 'data-action': 'change->moodia--config#updatePreview' } }) }} {{ form_errors(form.language) }}
{# Durée #}
{{ form_label(form.duration, null, { 'label_attr': {'class': 'block text-sm font-medium text-gray-700 mb-1.5'} }) }} {{ form_widget(form.duration, { 'attr': form.duration.vars.attr|merge({ 'class': 'w-full px-4 py-2.5 text-base border border-gray-200 rounded-xl focus:border-primary focus:ring-2 focus:ring-primary/20 transition-all', 'data-estimated-duration': estimatedDuration|default(''), 'data-action': 'input->moodia--config#updatePreview' }) }) }} {{ form_errors(form.duration) }}
{% endblock %} {% endembed %} {# ====================================================== Section 3 : Approche pédagogique (Molecule: card) ====================================================== #} {% embed '_molecules/card/card.html.twig' with { title: 'Approche pédagogique', subtitle: 'Type de contenu généré', icon: 'list', iconColor: 'primary', padding: 'md', form: form } %} {% block body %}
{% for child in form.approach %} {% endfor %}
{% endblock %} {% endembed %} {# ====================================================== Section 4 : Objectifs pédagogiques (Molecule: card) ====================================================== #} {% embed '_molecules/card/card.html.twig' with { title: 'Objectifs pédagogiques', subtitle: 'Compétences à acquérir', icon: 'target', iconColor: 'warning', padding: 'md', form: form } %} {% block headerAction %} {% include '_atoms/button/button.html.twig' with { label: 'Générer', variant: 'soft-cohorts', size: 'md', icon: 'magic-stick', radius: 'xl', type: 'button', attr: { 'data-action': 'click->moodia--config#generateObjectives', 'data-moodia--config-target': 'aiButton' } } only %} {% endblock %} {% block body %} {{ form_widget(form.objectives, { 'attr': { 'class': 'w-full min-h-[160px] px-4 py-3 text-base border border-gray-200 rounded-xl focus:border-primary focus:ring-2 focus:ring-primary/20 transition-all resize-y', 'placeholder': 'Décrivez les compétences que les apprenants devront acquérir...', 'rows': 6, 'data-action': 'input->moodia--config#updatePreview' } }) }} {{ form_errors(form.objectives) }}

Minimum 20 caractères

{% endblock %} {% endembed %} {# ====================================================== Section 5 : Instructions additionnelles (Molecule: card collapsible) ====================================================== #} {% embed '_molecules/card/card.html.twig' with { title: 'Instructions additionnelles', subtitle: 'Optionnel', icon: 'chat', iconColor: 'gray', collapsible: true, collapsed: true, padding: 'md', form: form } %} {% block body %} {{ form_widget(form.additionalInstructions, { 'attr': { 'class': 'w-full min-h-[80px] px-4 py-3 text-base border border-gray-200 rounded-xl focus:border-primary focus:ring-2 focus:ring-primary/20 transition-all resize-none', 'placeholder': 'Instructions spécifiques pour personnaliser la génération...' } }) }} {% endblock %} {% endembed %} {# ====================================================== Actions (Atoms: button) ====================================================== #}
{% include '_atoms/button/button.html.twig' with { variant: 'back', href: path('app_moodia_new') } only %} {% include '_atoms/button/button.html.twig' with { label: 'Générer le cours', variant: 'primary', size: 'lg', icon: 'rocket', type: 'submit', attr: { 'data-moodia--config-target': 'submitBtn' } } only %}
{{ form_end(form) }}
{# ============================================================ COLONNE DROITE : PREVIEW LIVE (Molecule: card) ============================================================ #}
{# Données pour le JS #}
{% endblock %}