{# Panneaux repliables (couleur) + modale (icônes Tabler). Charger {{ asset('js/form-appearance-pickers.js') }} de préféré en defer sur la page. expandable_color_field(form.color, { optional: true }) pour couleur facultative (#RRGGBB ou vide). #} {% macro expandable_color_field(form_field, opts) %} {% set opts = opts|default({}) %} {% set optional = opts.optional|default(false) %} {% set id = form_field.vars.id %} {% set hexVal = form_field.vars.value ?? '' %} {% set hexValStr = hexVal is not null ? hexVal : '' %} {% set err = form_field.vars.errors %} {# Pastille VIIZIA + usages courants ERP / Airbnb-style #} {% set viz_palette = [ '#7C3AED', '#6366F1', '#3B82F6', '#0EA5E9', '#14B8A6', '#10B981', '#84CC16', '#EAB308', '#F59E0B', '#F97316', '#EF4444', '#EC4899', '#A855F7', '#78716C', '#111827', '#6B7280', '#059669' ] %} {% set isValidHex = hexValStr|length == 7 and hexValStr starts with '#' %} {% set previewBg = isValidHex ? hexValStr : ((not optional) ? '#6B7280' : '') %} {# value="" invalide pour {% if form_field.vars.help %}

{{ form_field.vars.help }}

{% endif %}
Palettes rapides
{% for c in viz_palette %} {% endfor %}
{# hex : un seul name soumis (#RRGGBB ou vide si optionnel). #} {{ form_widget(form_field, {'attr': { 'data-viz-color-hex': id, 'class': ('input mr-3 mb-3 is-family-monospace' ~ (err|length > 0 ? ' is-danger' : ''))|trim, 'style': 'max-width:11rem;', 'autocomplete': 'off' }}) }} {% if optional %} {% endif %}
{% if err|length > 0 %}

{% for e in err %}{{ e.message }}{% if not loop.last %}
{% endif %}{% endfor %}

{% endif %} {% endmacro %} {% macro expandable_icon_tabler_field(form_field) %} {% set id = form_field.vars.id %} {# Icônes Tabler Icons 3 souvent utilisées ou adaptées métier VIIZIA #} {% set tabler_pick_icons = [ 'ti-home', 'ti-building', 'ti-building-store', 'ti-building-skyscraper', 'ti-world', 'ti-map-pin', 'ti-shopping-cart', 'ti-shopping-bag', 'ti-credit-card', 'ti-cash', 'ti-currency-euro', 'ti-receipt', 'ti-wallet', 'ti-pig-money', 'ti-chart-line', 'ti-chart-bar', 'ti-transfer', 'ti-refresh', 'ti-bed', 'ti-plane', 'ti-car', 'ti-tools', 'ti-hammer', 'ti-tag', 'ti-tags', 'ti-category', 'ti-layout-grid', 'ti-device-laptop', 'ti-notes', 'ti-book', 'ti-briefcase', 'ti-calendar', 'ti-calendar-event', 'ti-clock', 'ti-user', 'ti-users', 'ti-photo', 'ti-phone', 'ti-mail', 'ti-flag', 'ti-alert-circle', 'ti-info-circle', 'ti-circle-check', 'ti-thumb-up', 'ti-folder', 'ti-settings', 'ti-adjustments-horizontal', 'ti-adjustments-vertical', 'ti-bolt', 'ti-flame' ] %} {% set err = form_field.vars.errors %}
{% if form_field.vars.help %}

{{ form_field.vars.help }}

{% endif %}
{{ form_widget(form_field, {'attr': { 'placeholder': 'ex. ti-building-skyscraper', 'class': ('input is-family-monospace' ~ (err|length > 0 ? ' is-danger' : ''))|trim, 'data-viz-icon-input': id, 'autocomplete': 'off' }}) }}

{% if err|length > 0 %}

{% for e in err %}{{ e.message }}{% if not loop.last %}
{% endif %}{% endfor %}

{% endif %}
{% endmacro %}