{# Reusable Form Components for Admin Provides consistent Tailwind CSS styling across all admin forms #} {# Text Input Field #} {% macro input(name, label, value = '', type = 'text', placeholder = '', required = false, disabled = false, attributes = {}) %}
{% if label %} {% endif %}
{% endmacro %} {# Select Dropdown #} {% macro select(name, label, value = '', options = [], required = false, disabled = false, attributes = {}) %}
{% if label %} {% endif %}
{% endmacro %} {# Textarea Field #} {% macro textarea(name, label, value = '', rows = 3, placeholder = '', required = false, disabled = false, attributes = {}) %}
{% if label %} {% endif %}
{% endmacro %} {# Date Input Field #} {% macro date(name, label, value = '', required = false, disabled = false, attributes = {}) %}
{% if label %} {% endif %}
{% endmacro %} {# Number Input Field #} {% macro number(name, label, value = '', min = null, max = null, step = 1, placeholder = '', required = false, disabled = false, attributes = {}) %}
{% if label %} {% endif %}
{% endmacro %} {# Checkbox Field #} {% macro checkbox(name, label, checked = false, disabled = false, attributes = {}) %}
{% if label %}
{% endif %}
{% endmacro %} {# Radio Button Field #} {% macro radio(name, label, value, checked = false, disabled = false, attributes = {}) %}
{% if label %}
{% endif %}
{% endmacro %} {# Submit Button with Loading State #} {% macro submitButton(text = 'Enregistrer', loadingText = 'Chargement...', icon = 'fa-save', variant = 'primary') %} {% set buttonClass = variant == 'primary' ? 'bg-indigo-600 hover:bg-indigo-700 text-white' : 'bg-white hover:bg-gray-50 text-gray-700 border border-gray-300' %} {% endmacro %} {# Cancel/Back Button #} {% macro cancelButton(url, text = 'Annuler', icon = 'fa-times') %} {% if icon %} {% endif %} {{ text }} {% endmacro %} {# Filter Button #} {% macro filterButton(text = 'Filtrer', icon = 'fa-filter') %} {% endmacro %} {# Reset/Clear Button #} {% macro resetButton(url, text = 'Réinitialiser', icon = 'fa-times') %} {% if icon %} {% endif %} {{ text }} {% endmacro %}