- Introduced migration Version_0_13_0 to update task schema: - Changed start_date and end_date to DATE type, truncating time. - Added new columns: task_kind, definition_of_done, planned_work. - Removed parent_id and its index, replacing with a dependency graph. - Created new tables: plan_task_dependencies and plan_task_raci, including a join table for stakeholders. - Updated Version_0_4_0 migration to remove references to parent_id. - Refactored TaskModel to return tasks as flat rows with dependencies and RACI assignments. - Modified task table view to display tasks without hierarchical structure, adding badges for milestones and phases. - Enhanced task form to include dependencies and RACI roles, with appropriate macros for rendering. - Updated task list view to reflect new task structure and display status based on task kind. - Added new validation constraints for task dependencies and dates, ensuring no cycles or self-references. - Removed obsolete ValidTaskParent validation as parent-child relationships are no longer supported. - Updated translations to reflect changes in task management and new fields. - Revised documentation to describe new task handling and features.
94 lines
6.2 KiB
Twig
94 lines
6.2 KiB
Twig
{#
|
|
# 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 %}
|
|
<div class="mb-md">
|
|
<a class="btn btn-ghost plan-task-add" href="{{ path('plan_task_action', {'objectAction': 'new', 'plan': plan.id, 'returnTo': 'plan'}) }}" data-toggle="ajax">
|
|
<i class="ri-add-line"></i> {{ 'mautic.plan.task.add'|trans }}
|
|
</a>
|
|
</div>
|
|
{% endif %}
|
|
|
|
{% if not plan.id %}
|
|
<p class="text-muted">{{ 'mautic.plan.task.save_plan_first'|trans }}</p>
|
|
{% elseif taskTree is empty %}
|
|
<p class="text-muted">{{ 'mautic.plan.task.empty'|trans }}</p>
|
|
{% 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 %}
|
|
<div class="table-responsive">
|
|
<table class="table table-hover plan-tab-table plan-task-table{% if not readOnly %}" data-plan-tab-table data-empty-text="{{ 'mautic.plan.filter.no_match'|trans }}" data-sort-hint="{{ 'mautic.plan.filter.sort_hint'|trans }}{% endif %}">
|
|
<thead>
|
|
<tr>
|
|
<th class="plan-col-pictogram" aria-label="{{ 'mautic.plan.task.field.pictogram'|trans }}"></th>
|
|
<th class="plan-col-type">{{ 'mautic.plan.task.field.type'|trans }}</th>
|
|
<th class="plan-col-name">{{ 'mautic.plan.task.field.name'|trans }}</th>
|
|
<th class="plan-col-description">{{ 'mautic.plan.task.field.description'|trans }}</th>
|
|
<th class="plan-col-date">{{ 'mautic.plan.task.field.start_date'|trans }}</th>
|
|
<th class="plan-col-date">{{ 'mautic.plan.task.field.end_date'|trans }}</th>
|
|
<th class="plan-col-status">{{ 'mautic.plan.task.field.status'|trans }}</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% 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) %}
|
|
<tr class="plan-task" data-task-id="{{ task.id }}">
|
|
<td class="plan-col-pictogram text-center">
|
|
{% set taskTypeIcon = plan_item_type_icon('task', task.type) %}
|
|
{% if taskTypeIcon %}<i class="{{ taskTypeIcon }} plan-item-type-icon" style="font-size: 24px;" aria-hidden="true"></i>{% endif %}
|
|
</td>
|
|
<td class="plan-col-type"{% if plan_item_type_description('task', task.type) %} title="{{ plan_item_type_description('task', task.type) }}" data-toggle="tooltip"{% endif %}>
|
|
{{ plan_item_type_name('task', task.type) ?? 'mautic.plan.description_item.type.unknown'|trans({'%key%': task.type}) }}
|
|
</td>
|
|
<td class="plan-col-name">
|
|
{% if canEdit %}
|
|
<a href="{{ path('plan_task_action', {'objectAction': 'edit', 'objectId': task.id, 'returnTo': 'plan'}) }}" data-toggle="ajax">{{ task.name }}</a>
|
|
{% else %}
|
|
{{ task.name }}
|
|
{% endif %}
|
|
{% if task.taskKind == constant('MauticPlugin\\PlanBundle\\Entity\\TaskKind::Milestone') %}
|
|
<span class="label label-success" title="{{ 'mautic.plan.task.kind.milestone'|trans }}">{{ 'mautic.plan.task.kind.milestone_short'|trans }}</span>
|
|
{% elseif task.taskKind == constant('MauticPlugin\\PlanBundle\\Entity\\TaskKind::Phase') %}
|
|
<span class="label label-primary" title="{{ 'mautic.plan.task.kind.phase'|trans }}">{{ 'mautic.plan.task.kind.phase_short'|trans }}</span>
|
|
{% endif %}
|
|
</td>
|
|
<td class="plan-col-description text-muted">
|
|
{# 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,
|
|
}) }}
|
|
</td>
|
|
<td class="plan-col-date">{{ task.startDate ? task.startDate|date('Y-m-d') : '' }}</td>
|
|
<td class="plan-col-date">{{ task.endDate ? task.endDate|date('Y-m-d') : '' }}</td>
|
|
<td class="plan-col-status">
|
|
{# A phase has no status of its own — skip the column value. #}
|
|
{% if task.taskKind != constant('MauticPlugin\\PlanBundle\\Entity\\TaskKind::Phase') %}
|
|
<span class="label {{ task.status.labelClass }}">{{ task.status.labelKey|trans }}</span>
|
|
{% endif %}
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
{% endif %}
|