{# Macros dédiés à la page de gestion des tâches (évite les collisions de signatures) #} {% macro _priority_badge(priority) -%} {% set cls = {'haute':'bg-danger','normale':'bg-primary','basse':'bg-success'} %} {{ priority|capitalize }} {%- endmacro %} {% macro _status_badge(status) -%} {% set cls = {'todo':'bg-warning text-dark','done':'bg-success','canceled':'bg-danger'} %} {% set labels = {'todo': 'À faire', 'done': 'Fait', 'canceled': 'Annulée'} %} {{ labels.get(status, status) }} {%- endmacro %} {% macro _entity_badge(entity_type) -%} {% if entity_type %} {% set labels = {'client': 'Client', 'prospect': 'Prospect', 'project': 'Projet', 'campaign': 'Campagne'} %} {{ labels.get(entity_type, entity_type|capitalize) }} {% endif %} {%- endmacro %} {% macro render_tasks_table_actions(tasks, show_entity=True, show_due_date=True, empty_text="Aucune tâche") -%}
{% set cols = 3 + (1 if show_entity else 0) + (1 if show_due_date else 0) + 1 %} {% if show_entity %}{% endif %} {% if show_due_date %}{% endif %} {% if tasks and tasks|length > 0 %} {% for task in tasks %} {% if show_entity %} {% endif %} {% if show_due_date %} {% endif %} {% endfor %} {% else %} {% endif %}
Statut TâcheLiée àÉchéancePriorité Actions
{{ _status_badge(task.status) }}
{{ task.title }}
{% if task.description %}
{{ task.description }}
{% endif %} {% if task.metadata and task.metadata.ref %}
Ref: {{ task.metadata.ref }}
{% endif %}
{{ _entity_badge(task.entity_type) }} {% if task.entity_id %}
{{ task.entity_id }}
{% endif %}
{{ task.due_date }} {% if task.completed_at and task.status == 'done' %}
Clôturée: {{ task.completed_at }}
{% endif %}
{{ _priority_badge(task.priority) }}
{{ empty_text }}
{%- endmacro %}