{% macro boolean(value) %}
{% if value %}
{% trans %}bool.true{% endtrans %}
{% else %}
{% trans %}bool.false{% endtrans %}
{% endif %}
{% endmacro %}
{% macro attachment_icon(attachment, attachment_helper, class = "fa-fw fas fa-3x", link = true) %}
{% if not attachment_helper or attachment_helper.fileExisting(attachment) %}
{% if attachment.picture %}
{% else %}
{% endif %}
{% elseif not attachment_helper.fileExisting(attachment) %}
{% endif %}
{% endmacro %}
{% macro string_to_tags(string, class="badge badge-info") %}
{% for tag in string|split(',') %}
{{ tag | trim }}
{% endfor %}
{% endmacro %}
{% macro m_status_to_badge(status, class="badge") %}
{% if status is not empty %}
{% set color = " badge-secondary" %}
{% if status == "active" %}
{% set color = " badge-success" %}
{% elseif status == "nrfnd" %}
{% set color = " badge-warning" %}
{% elseif status == "eol" %}
{% set color = " badge-warning" %}
{% elseif status == "discontinued" %}
{% set color = " badge-danger" %}
{% endif %}
{{ ("m_status." ~ status) | trans }}
{% endif %}
{% endmacro %}
{% macro structural_entity_link(entity, link_type = "list_parts") %}
{# @var entity \App\Entity\Base\StructuralDBElement #}
{% if entity %}