{% macro document_image(documents, document, slug, label, text, subtext, userRole) %} {% set str = vich_uploader_asset(documents, slug ~ 'File') %} {% set extension = str|split('.')|last %} {% set strLastPoint = str|split('.')|last %} {% set strBeforeLastPoint = str|split('.')|slice(0, -1)|join('.') %} {% set strModified = strBeforeLastPoint|slice(19, -23) %} {% set extension = str|split('.')|last %} {# si il y a un fichier #} {% if document is not null %}
{% if extension == 'pdf' %}
{% elseif extension in ['jpg', 'jpeg', 'png', 'gif', 'webp'] %}
{{ label }}
{% else %}
{{ label }}
{{ extension|upper }}
{% endif %}

{{ text }}

{% if extension in ['pdf', 'jpg', 'jpeg', 'png', 'gif', 'webp'] %}

voir

{% endif %}
{% if userRole == 'ROLE_ADMIN' %}
{% endif %}
{% if document|split('.')|last|lower == 'pdf' %} {% endif %} {% endif %} {# si il n'y a pas de fichier #} {% if document is null %}

{{ text }}

{{ subtext }}

téléverser

{% endif %} {% endmacro %} {% macro cleanstring(string, cutstart, cutend) %} {% set string_trimmed = string|slice(cutstart) %} {% set parts = string_trimmed|split('.') %} {% set extension = parts|last %} {% set base = parts|slice(0, parts|length - 1)|join('.') %} {% set resultat_base = base|slice(0, base|length - cutend) %} {% set resultat = resultat_base ~ '.' ~ extension %} {{ resultat }} {% endmacro %} {% macro cutstring(string, maxLength = 20, truncateLength = 18) %} {% if string|length > maxLength %} {% set resultat = string|slice(0, truncateLength) ~ '...' %} {% else %} {% set resultat = string %} {% endif %} {{ resultat }} {% endmacro %} {% macro alertbox() %} {% endmacro %} {% macro uploadedcard(array, imgkey, keyFile, dir, company) %} {% import _self as macros %} {% for elt in array %} {% set extension = attribute(elt, imgkey)|split('.')|last|lower %} {% set downloadFileName = macros.cleanstring(attribute(elt, imgkey), 0, 23)|trim|replace({' ': '_'}) %} {% set cleanedName = macros.cleanstring(attribute(elt, imgkey), 0, 23) %} {% set cutCleanedName = macros.cutstring(cleanedName, 14, 12) %}
{% if extension == 'pdf' %}
{% elseif extension in ['jpg', 'jpeg', 'png', 'gif', 'webp'] %}
element graphique
{% else %}
logo element graphique
{{ extension|upper }}
{% endif %}

{{ cutCleanedName }}

{% if extension in ['pdf', 'jpg', 'jpeg', 'png', 'gif', 'webp'] %}

voir

{% endif %}

télécharger

{% if extension == 'pdf' %} {% endif %} {% endfor %} {% endmacro %} {% macro form_card(iscomplete, img, name, slug, userRole, company, pdfname) %}
{% if iscomplete %} {% if userRole == 'ROLE_ADMIN' %}
document complété
{% if img == 'file_logo.svg' %}
PDF
{% endif %} {% else %}
document complété
{% if img == 'file_logo.svg' %}
PDF
{% endif %} {% endif %}

{{ name }}

{% if userRole == 'ROLE_USER' %}

télécharger

{% endif %} {% if userRole == 'ROLE_ADMIN' %}

voir

télécharger

{% endif %}
{% else %}

{{ name }}

remplir

{% endif %}
{% endmacro %} {% macro download_btn(slug, userRole, company = null) %} {% set route_name = 'download_' ~ slug %} {% set path_args = {} %} {% if userRole == 'ROLE_ADMIN' and company is not null %} {% set path_args = {'id': company.id} %} {% endif %}
{% endmacro %}