Files
e-cosplay/templates/form_admin.twig
Serreau Jovann a3dc9f5801 ```
 feat(templates/cota.twig): Ajoute template pour confirmation cotisation
 feat(templates/admin/dashboard.twig): Affiche stats membres et commandes
🐛 fix(src/Controller/WebhooksController.php): Gère paiement et reçu cotisation
 feat(src/Service/Payments/PaymentClient.php): Ajoute paiement cotisation
 feat(.env): Met à jour URL de dev
 feat(src/Controller/Admin/AdminController.php): Ajoute validation et lien paiement
 feat(src/Controller/DonsController.php): Ajoute route validation cotisation
 feat(assets/admin.js): Ajoute assets admin
 feat(templates/form_admin.twig): Ajoute thème formulaire admin
 feat(assets/admin.scss): Ajoute style admin
 feat(src/Service/Pdf/CotaReceiptGenerator.php): Génère reçu de cotisation
 feat(src/Form/MembersType.php): Ajoute champs et options formulaire membre
 feat(templates/admin/base.twig): Ajoute base admin
 feat(templates/admin/member/add.twig): Ajoute template ajout/édition membre
 feat(src/Entity/Members.php): Ajoute champs et relations entité Membre
 feat(templates/admin/members.twig): Affiche liste membres
 feat(templates/mails/coti_payment.twig): Ajoute template mail paiement cotisation
 feat(src/Controller/MembersController.php): Filtre membres actifs
 feat(templates/mails/cota_validation.twig): Ajoute template mail validation cota
```
2025-11-22 20:36:20 +01:00

149 lines
5.9 KiB
Twig

{% use 'form_div_layout.html.twig' %}
{# ---------- FORM START / END ---------- #}
{% block form_start -%}
{{ parent() }}
{%- endblock %}
{% block form_end -%}
{{ parent() }}
{%- endblock %}
{# ---------- ROW ---------- #}
{% block form_row %}
{# La ROW est le conteneur du label, du widget et des erreurs. #}
<div class="mb-5">
{{ form_label(form) }}
<div class="mt-1">
{{ form_widget(form) }}
</div>
{% if not compound and not form.vars.valid %}
{# Affiche l'erreur en bas du champ simple #}
<p class="text-sm text-red-400 mt-1">{{ form_errors(form) }}</p>
{% else %}
{# Affiche l'erreur pour les champs composés (si form_errors n'est pas déjà dans le widget) #}
{{ form_errors(form) }}
{% endif %}
</div>
{% endblock %}
{# ---------- LABEL ---------- #}
{% block form_label %}
{% if label is not same as(false) %}
<label for="{{ id }}" class="block text-sm font-medium text-gray-300">
{{ label|trans({}, translation_domain) }}
{% if required %}
<span class="text-red-400">*</span>
{% endif %}
</label>
{% endif %}
{% endblock %}
{# ---------- ERRORS ---------- #}
{% block form_errors %}
{% if errors|length > 0 %}
{# Utilisation de red-400 pour mieux ressortir sur un fond sombre #}
<ul class="mt-1 text-sm text-red-400 list-disc list-inside">
{% for error in errors %}
<li>{{ error.message }}</li>
{% endfor %}
</ul>
{% endif %}
{% endblock %}
{# ---------- WIDGET DISPATCH ---------- #}
{% block form_widget %}
{% if compound %}
{{ block('form_widget_compound') }}
{% else %}
{{ block('form_widget_simple') }}
{% endif %}
{% endblock %}
{# --- STYLE COMMUN POUR WIDGETS (DARK MODE) --- #}
{# ---------- SIMPLE INPUTS (text, email, number...) ---------- #}
{% block form_widget_simple %}
{% set type = type|default('text') %}
<input
type="{{ type }}"
{{ block('widget_attributes') }}
value="{{ value }}"
{# DARK MODE: bg-gray-700, border-gray-600, text-white #}
class="form-input mt-1 block w-full px-3 py-2 bg-gray-700 border border-gray-600 text-white placeholder-gray-400 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm transition duration-150"
/>
{% endblock %}
{# ---------- TEXTAREA ---------- #}
{% block textarea_widget %}
<textarea
{{ block('widget_attributes') }}
{# DARK MODE: bg-gray-700, border-gray-600, text-white #}
class="form-textarea form-input mt-1 block w-full px-3 py-2 bg-gray-700 border border-gray-600 text-white placeholder-gray-400 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm transition duration-150"
>{{ value }}</textarea>
{% endblock %}
{# ---------- SELECT ---------- #}
{% block choice_widget_collapsed %}
<select
{{ block('widget_attributes') }}
{# DARK MODE: bg-gray-700, border-gray-600, text-white #}
class="form-select form-input mt-1 block w-full px-3 py-2 bg-gray-700 border border-gray-600 text-white rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm transition duration-150"
>
{% if placeholder is not none %}
<option value="" {% if required and value is empty %}selected{% endif %}>
{{ placeholder != '' ? (placeholder|trans({}, translation_domain)) : '' }}
</option>
{% endif %}
{% for group_label, choice in choices %}
{% if choice is iterable %}
<optgroup label="{{ group_label|trans({}, translation_domain) }}">
{% for nested_choice in choice %}
<option value="{{ nested_choice.value }}" {% if nested_choice is selectedchoice(value) %}selected{% endif %}>
{{ nested_choice.label|trans({}, translation_domain) }}
</option>
{% endfor %}
</optgroup>
{% else %}
<option value="{{ choice.value }}" {% if choice is selectedchoice(value) %}selected{% endif %}>
{{ choice.label|trans({}, translation_domain) }}
</option>
{% endif %}
{% endfor %}
</select>
{% endblock %}
{# ---------- CHECKBOX ---------- #}
{% block checkbox_widget %}
<div class="flex items-center">
<input type="checkbox"
{{ block('widget_attributes') }}
{% if value not in ['', null] %} value="{{ value }}"{% endif %}
{% if checked %}checked="checked"{% endif %}
{# DARK MODE: bg-gray-700, border-gray-600 #}
class="form-checkbox h-5 w-5 text-indigo-500 border-gray-600 bg-gray-700 rounded focus:ring-indigo-500">
</div>
{% endblock %}
{# ---------- RADIO ---------- #}
{% block radio_widget %}
<input type="radio"
{{ block('widget_attributes') }}
value="{{ value }}"
{% if checked %}checked="checked"{% endif %}
{# DARK MODE: bg-gray-700, border-gray-600 #}
class="form-radio h-5 w-5 text-indigo-500 border-gray-600 bg-gray-700 focus:ring-indigo-500">
{% endblock %}
{# ---------- FILE ---------- #}
{% block file_widget %}
<input type="file"
{{ block('widget_attributes') }}
{# DARK MODE: Outer bg-gray-700, border-gray-600, text-gray-300 #}
class="block w-full text-sm text-gray-300 file:mr-4 file:py-2 file:px-4
file:rounded-md file:border-0
file:text-sm file:font-semibold
file:bg-indigo-600 file:text-white
hover:file:bg-indigo-700
bg-gray-700 border border-gray-600 rounded-md shadow-sm">
{% endblock %}