Files
mautic-marketing-program-bu…/Resources/views/Task/list.html.twig
T
Alexandre Gain 8268fad886 feat: Rework task management in PlanBundle
- 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.
2026-11-13 21:58:45 +01:00

158 lines
9.1 KiB
Twig

{% set isIndex = 'index' == tmpl ? true : false %}
{% set tmpl = 'list' %}
{% extends isIndex ? '@MauticCore/Default/content.html.twig' : '@MauticCore/Default/raw_output.html.twig' %}
{% block mauticContent %}planTask{% endblock %}
{% block headerTitle %}{{ 'mautic.plan.task.header.index'|trans }}{% endblock %}
{% block content %}
<div id="page-list-wrapper" class="{% if items|length > 0 or searchValue is not empty %}panel {% endif %}panel-default">
{{- include('@MauticCore/Helper/list_toolbar.html.twig', {
'searchValue': searchValue,
'action': currentRoute,
'page_actions': {
'templateButtons': {
'new': permissions['plan:tasks:create'],
},
'langVar': 'plan.task',
},
'bulk_actions': {
'langVar': 'plan.task',
'templateButtons': {
'delete': permissions['plan:tasks:deleteown'] or permissions['plan:tasks:deleteother'],
},
},
}) -}}
<div class="page-list">
{% if items is defined and items is not empty %}
<div class="table-responsive">
<table class="table table-hover" id="planTaskTable">
<thead>
<tr>
{{ include('@MauticCore/Helper/tableheader.html.twig', {
'checkall': 'true',
'target': '#planTaskTable',
}) }}
{# Columns: ID, Pictogram, Type, Name, Description, Start date, End date, Status. #}
{{ include('@MauticCore/Helper/tableheader.html.twig', {
'sessionVar': 'plan.task',
'orderBy': 't.id',
'text': 'mautic.core.id',
'class': 'col-plan-task-id',
}) }}
{{ include('@MauticCore/Helper/tableheader.html.twig', {
'sessionVar': 'plan.task',
'text': 'mautic.plan.task.field.pictogram',
'class': 'col-plan-task-pictogram',
}) }}
{{ include('@MauticCore/Helper/tableheader.html.twig', {
'sessionVar': 'plan.task',
'orderBy': 't.type',
'text': 'mautic.plan.task.field.type',
'class': 'col-plan-task-type',
}) }}
{{ include('@MauticCore/Helper/tableheader.html.twig', {
'sessionVar': 'plan.task',
'orderBy': 't.name',
'text': 'mautic.plan.task.field.name',
'class': 'col-plan-task-name',
'default': true,
}) }}
{{ include('@MauticCore/Helper/tableheader.html.twig', {
'sessionVar': 'plan.task',
'text': 'mautic.plan.task.field.description',
'class': 'visible-md visible-lg col-plan-task-description',
}) }}
{{ include('@MauticCore/Helper/tableheader.html.twig', {
'sessionVar': 'plan.task',
'orderBy': 't.startDate',
'text': 'mautic.plan.task.field.start_date',
'class': 'col-plan-task-start',
}) }}
{{ include('@MauticCore/Helper/tableheader.html.twig', {
'sessionVar': 'plan.task',
'orderBy': 't.endDate',
'text': 'mautic.plan.task.field.end_date',
'class': 'col-plan-task-end',
}) }}
{{ include('@MauticCore/Helper/tableheader.html.twig', {
'sessionVar': 'plan.task',
'orderBy': 't.status',
'text': 'mautic.plan.task.field.status',
'class': 'col-plan-task-status',
}) }}
</tr>
</thead>
<tbody>
{% for item in items %}
{% set canEdit = securityHasEntityAccess(permissions['plan:tasks:editown'], permissions['plan:tasks:editother'], item.createdBy) %}
<tr>
<td>
{{- include('@MauticCore/Helper/list_actions.html.twig', {
'item': item,
'templateButtons': {
'edit': canEdit,
'delete': securityHasEntityAccess(permissions['plan:tasks:deleteown'], permissions['plan:tasks:deleteother'], item.createdBy),
},
'langVar': 'plan.task',
}) -}}
</td>
<td>{{ item.id }}</td>
<td class="text-center">
{% set typeIcon = plan_item_type_icon('task', item.type) %}
{% if typeIcon %}<i class="{{ typeIcon }} plan-item-type-icon" style="font-size: 24px;" aria-hidden="true"></i>{% endif %}
</td>
<td{% if plan_item_type_description('task', item.type) %} title="{{ plan_item_type_description('task', item.type) }}"{% endif %}>
{{ plan_item_type_name('task', item.type) ?? 'mautic.plan.description_item.type.unknown'|trans({'%key%': item.type}) }}
</td>
<td>
{% if canEdit %}
<a href="{{ path('plan_task_action', {'objectAction': 'edit', 'objectId': item.id}) }}" data-toggle="ajax">{{ item.name }}</a>
{% else %}
{{ item.name }}
{% endif %}
</td>
<td class="visible-md visible-lg text-muted">
{% set description = item.description|default('')|striptags|trim %}
{{ (description|length > 120 ? description|slice(0, 120) ~ '…' : description)|plan_linkify }}
</td>
<td>{{ item.startDate ? item.startDate|date('Y-m-d') : '' }}</td>
<td>{{ item.endDate ? item.endDate|date('Y-m-d') : '' }}</td>
<td>
{# A phase has no status of its own: its state comes from its tasks. #}
{% if item.taskKind != constant('MauticPlugin\\PlanBundle\\Entity\\TaskKind::Phase') %}
<span class="label {{ item.status.labelClass }}">{{ item.status.labelKey|trans }}</span>
{% else %}
<span class="label label-primary">{{ 'mautic.plan.task.kind.phase_short'|trans }}</span>
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
<div class="panel-footer">
{{- include('@MauticCore/Helper/pagination.html.twig', {
'totalItems': totalItems,
'page': page,
'limit': limit,
'baseUrl': path('plan_task_index'),
'sessionVar': 'plan.task',
}) -}}
</div>
</div>
{% elseif searchValue is not empty %}
{{ include('@MauticCore/Helper/noresults.html.twig') }}
{% else %}
<div class="mt-80 col-md-offset-2 col-lg-offset-3 col-md-8 col-lg-5 height-auto">
{{ include('@MauticCore/Components/content-block.html.twig', {
'heading': 'mautic.plan.task.onboarding.heading',
'subheading': 'mautic.plan.task.onboarding.subheading',
'copy': 'mautic.plan.task.onboarding.copy',
}) }}
</div>
{% endif %}
</div>
</div>
{% endblock %}