{# # The plan's tasks, for the Tasks tab of the plan detail page and form. Same harmonized columns as the # other tabs: Pictogram (no label), Type, Name, Description, Start date, End date, Status (last). No ID # column. Rows are in tree order: each task is followed by its sub-tasks, indented under it. # # Parameters: # plan: the Plan # taskTree: rows from TaskModel::getTaskTree(): {task, depth}, in display order # readOnly: true on the plan form: no links, no filter, so that following one can't drop unsaved changes # taskPermissions: plan:tasks:* permissions (create, editown, editother), when not read-only # # Links carry returnTo=plan, so that Save and Cancel on the task form come back to this plan # (see TaskController). Opened from Planning > Tasks, the task form goes back to the task list. #} {% set readOnly = readOnly|default(false) %} {% set taskPermissions = taskPermissions|default({}) %} {% set canCreate = not readOnly and plan.id and taskPermissions['plan:tasks:create']|default(false) %} {% if canCreate %}
{{ 'mautic.plan.task.add'|trans }}
{% endif %} {% if not plan.id %}

{{ 'mautic.plan.task.save_plan_first'|trans }}

{% elseif taskTree is empty %}

{{ 'mautic.plan.task.empty'|trans }}

{% else %} {% if not readOnly %} {# Filter + click-to-sort on the detail page (plan.js). The form's read-only copy stays plain. #} {{ include('@Plan/Plan/_tab_table_filter.html.twig') }} {% endif %}
{% for row in taskTree %} {% set task = row.task %} {% set canEdit = not readOnly and securityHasEntityAccess(taskPermissions['plan:tasks:editown']|default(false), taskPermissions['plan:tasks:editother']|default(false), task.createdBy) %} {% set childCount = taskTree|filter(r => r.task.parent and r.task.parent.id == task.id)|length %} {% endfor %}
{{ 'mautic.plan.task.field.type'|trans }} {{ 'mautic.plan.task.field.name'|trans }} {{ 'mautic.plan.task.field.description'|trans }} {{ 'mautic.plan.task.field.start_date'|trans }} {{ 'mautic.plan.task.field.end_date'|trans }} {{ 'mautic.plan.task.field.status'|trans }}
{% set taskTypeIcon = plan_item_type_icon('task', task.type) %} {% if taskTypeIcon %}{% endif %} {{ plan_item_type_name('task', task.type) ?? 'mautic.plan.description_item.type.unknown'|trans({'%key%': task.type}) }} {% if row.depth > 0 %} {% endif %} {% if canEdit %} {{ task.name }} {% else %} {{ task.name }} {% endif %} {% if childCount > 0 %} ({{ childCount }}) {% endif %} {# Same 10-line clamp and read-more as the Description tab; URLs become links. #} {{ include('@Plan/Plan/_description_read_more.html.twig', { 'text': task.description|default('')|striptags, 'id': 'plan-task-desc-' ~ task.id, }) }} {{ task.startDate ? dateToFull(task.startDate) : '' }} {{ task.endDate ? dateToFull(task.endDate) : '' }} {{ task.status.labelKey|trans }}
{% endif %}