{# Macros de rendu pour les tâches #} {% macro priority_badge(priority) -%} {% set classes = { 'haute': 'background:#ffe5e5;color:#b30000;padding:.15rem .4rem;border-radius:.3rem;font-size:.8rem;', 'normale': 'background:#e8f1ff;color:#003a8c;padding:.15rem .4rem;border-radius:.3rem;font-size:.8rem;', 'basse': 'background:#e9f7ef;color:#1b5e20;padding:.15rem .4rem;border-radius:.3rem;font-size:.8rem;' } %} {{ priority|capitalize }} {%- endmacro %} {% macro status_badge(status) -%} {% set classes = { 'todo': 'background:#fff3cd;color:#8a6d3b;padding:.15rem .4rem;border-radius:.3rem;font-size:.8rem;', 'done': 'background:#e6ffed;color:#155724;padding:.15rem .4rem;border-radius:.3rem;font-size:.8rem;', 'canceled': 'background:#f8d7da;color:#721c24;padding:.15rem .4rem;border-radius:.3rem;font-size:.8rem;' } %} {% set labels = {'todo': 'À faire', 'done': 'Fait', 'canceled': 'Annulée'} %} {{ labels.get(status, status) }} {%- endmacro %} {# Macros de rendu pour les tâches #} {% macro priority_badge(priority) -%} {% set classes = { 'haute': 'background:#ffe5e5;color:#b30000;padding:.15rem .4rem;border-radius:.3rem;font-size:.8rem;', 'normale': 'background:#e8f1ff;color:#003a8c;padding:.15rem .4rem;border-radius:.3rem;font-size:.8rem;', 'basse': 'background:#e9f7ef;color:#1b5e20;padding:.15rem .4rem;border-radius:.3rem;font-size:.8rem;' } %} {{ priority|capitalize }} {%- endmacro %} {% macro status_badge(status) -%} {% set classes = { 'todo': 'background:#fff3cd;color:#8a6d3b;padding:.15rem .4rem;border-radius:.3rem;font-size:.8rem;', 'done': 'background:#e6ffed;color:#155724;padding:.15rem .4rem;border-radius:.3rem;font-size:.8rem;', 'canceled': 'background:#f8d7da;color:#721c24;padding:.15rem .4rem;border-radius:.3rem;font-size:.8rem;' } %} {% 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_task_row(task, show_entity=True, show_due_date=True) -%} {{ status_badge(task.status) }}
{{ task.title }}
{% if task.description %}
{{ task.description }}
{% endif %} {% if task.metadata and task.metadata.ref %}
Ref: {{ task.metadata.ref }}
{% endif %} {% if show_entity %} {{ entity_badge(task.entity_type) }} {% if task.entity_id %} {{ task.entity_id }} {% endif %} {% endif %} {% if show_due_date %} {{ task.due_date }} {% if task.completed_at and task.status == 'done' %}
Clôturée: {{ task.completed_at }}
{% endif %} {% endif %} {{ priority_badge(task.priority) }} {%- endmacro %} {# Macros de rendu pour les tâches #} {% 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_task_row(task, show_entity=True, show_due_date=True, show_actions=False) -%} {{ status_badge(task.status) }}
{{ task.title }}
{% if task.description %}
{{ task.description }}
{% endif %} {% if task.metadata and task.metadata.ref %}
Ref: {{ task.metadata.ref }}
{% endif %} {% if show_entity %} {{ entity_badge(task.entity_type) }} {% if task.entity_id %}
{{ task.entity_id }}
{% endif %} {% endif %} {% if show_due_date %} {{ task.due_date }} {% if task.completed_at and task.status == 'done' %}
Clôturée: {{ task.completed_at }}
{% endif %} {% endif %} {{ priority_badge(task.priority) }} {% if show_actions %}
{% endif %} {%- endmacro %} {% macro render_tasks_table(tasks, show_entity=True, show_due_date=True, empty_text="Aucune tâche", show_actions=False, today=None) -%}
{% set cols = 3 + (1 if show_entity else 0) + (1 if show_due_date else 0) + (1 if show_actions else 0) %} {% if show_entity %}{% endif %} {% if show_due_date %}{% endif %} {% if show_actions %}{% endif %} {% if tasks and tasks|length > 0 %} {% for task in tasks %} {{ render_task_row(task, show_entity=show_entity, show_due_date=show_due_date, show_actions=show_actions) }} {% endfor %} {% else %} {% endif %}
Statut TâcheLiée àÉchéancePrioritéActions
{{ empty_text }}
{%- endmacro %} {% macro render_tasks_table(tasks, show_entity=True, show_due_date=True, empty_text="Aucune tâche", show_actions=False, today=None) -%}
{% set cols = 3 + (1 if show_entity else 0) + (1 if show_due_date else 0) + (1 if show_actions else 0) %} {% if show_entity %}{% endif %} {% if show_due_date %}{% endif %} {% if show_actions %}{% endif %} {% if tasks and tasks|length > 0 %} {% for task in tasks %} {% if show_entity %} {% endif %} {% if show_due_date %} {% endif %} {% if show_actions %} {% 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 %} {% 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_task_row(task, show_entity=True, show_due_date=True) -%} {{ status_badge(task.status) }}
{{ task.title }}
{% if task.description %}
{{ task.description }}
{% endif %} {% if task.metadata and task.metadata.ref %}
Ref: {{ task.metadata.ref }}
{% endif %} {% if show_entity %} {{ entity_badge(task.entity_type) }} {% if task.entity_id %} {{ task.entity_id }} {% endif %} {% endif %} {% if show_due_date %} {{ task.due_date }} {% if task.completed_at and task.status == 'done' %}
Clôturée: {{ task.completed_at }}
{% endif %} {% endif %} {{ priority_badge(task.priority) }} {%- endmacro %} {% macro render_tasks_table(tasks, show_entity=True, show_due_date=True, empty_text="Aucune tâche") -%}
{% if show_entity %}{% endif %} {% if show_due_date %}{% endif %} {% if tasks and tasks|length > 0 %} {% for task in tasks %} {{ render_task_row(task, show_entity=show_entity, show_due_date=show_due_date) }} {% endfor %} {% else %} {% endif %}
Statut TâcheLiée àÉchéancePriorité
{{ empty_text }}
{%- endmacro %}