{# # The plan's tasks, for the Tasks tab of the plan detail page and form. Same columns as the task list # (Planning > Tasks): ID, Name, Description, Start date, End date, Status. 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, 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 %}
{% 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.core.id'|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 }}
{{ task.id }} {% if row.depth > 0 %} {% endif %} {% if canEdit %} {{ task.name }} {% else %} {{ task.name }} {% endif %} {% if childCount > 0 %} ({{ childCount }}) {% endif %} {% set description = task.description|default('')|striptags|trim %} {{ description|length > 120 ? description|slice(0, 120) ~ '…' : description }} {{ task.startDate ? dateToFull(task.startDate) : '' }} {{ task.endDate ? dateToFull(task.endDate) : '' }} {{ task.status.labelKey|trans }}
{% endif %}