Rename the Plan bundle to Program across config, routes, menus, and controllers (Plan -> Initiative), bump version to 0.16.0, and introduce new audience and UTM taxonomy routes and permissions to support the expanded Programs feature set.
94 lines
6.5 KiB
Twig
94 lines
6.5 KiB
Twig
{#
|
|
# The initiative's tasks, for the Tasks tab of the initiative 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:
|
|
# initiative: the Initiative
|
|
# taskTree: rows from TaskModel::getTaskTree(): {task, depth}, in display order
|
|
# readOnly: true on the initiative form: no links, no filter, so that following one can't drop unsaved changes
|
|
# taskPermissions: program:tasks:* permissions (create, editown, editother), when not read-only
|
|
#
|
|
# Links carry returnTo=initiative, so that Save and Cancel on the task form come back to this initiative page
|
|
# (see TaskController). Opened from Programs > Tasks, the task form goes back to the task list.
|
|
#}
|
|
{% set readOnly = readOnly|default(false) %}
|
|
{% set taskPermissions = taskPermissions|default({}) %}
|
|
{% set canCreate = not readOnly and initiative.id and taskPermissions['program:tasks:create']|default(false) %}
|
|
|
|
{% if canCreate %}
|
|
<div class="mb-md">
|
|
<a class="btn btn-ghost initiative-task-add" href="{{ path('initiative_task_action', {'objectAction': 'new', 'initiative': initiative.id, 'returnTo': 'initiative'}) }}" data-toggle="ajax">
|
|
<i class="ri-add-line"></i> {{ 'mautic.program.task.add'|trans }}
|
|
</a>
|
|
</div>
|
|
{% endif %}
|
|
|
|
{% if not initiative.id %}
|
|
<p class="text-muted">{{ 'mautic.program.task.save_initiative_first'|trans }}</p>
|
|
{% elseif taskTree is empty %}
|
|
<p class="text-muted">{{ 'mautic.program.task.empty'|trans }}</p>
|
|
{% else %}
|
|
{% if not readOnly %}
|
|
{# Filter + click-to-sort on the detail page (program.js). The form's read-only copy stays plain. #}
|
|
{{ include('@Program/Initiative/_tab_table_filter.html.twig') }}
|
|
{% endif %}
|
|
<div class="table-responsive">
|
|
<table class="table table-hover initiative-tab-table initiative-task-table{% if not readOnly %}" data-initiative-tab-table data-empty-text="{{ 'mautic.program.filter.no_match'|trans }}" data-sort-hint="{{ 'mautic.program.filter.sort_hint'|trans }}{% endif %}">
|
|
<thead>
|
|
<tr>
|
|
<th class="initiative-col-pictogram" aria-label="{{ 'mautic.program.task.field.pictogram'|trans }}"></th>
|
|
<th class="initiative-col-type">{{ 'mautic.program.task.field.type'|trans }}</th>
|
|
<th class="initiative-col-name">{{ 'mautic.program.task.field.name'|trans }}</th>
|
|
<th class="initiative-col-description">{{ 'mautic.program.task.field.description'|trans }}</th>
|
|
<th class="initiative-col-date">{{ 'mautic.program.task.field.start_date'|trans }}</th>
|
|
<th class="initiative-col-date">{{ 'mautic.program.task.field.end_date'|trans }}</th>
|
|
<th class="initiative-col-status">{{ 'mautic.program.task.field.status'|trans }}</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for row in taskTree %}
|
|
{% set task = row.task %}
|
|
{% set canEdit = not readOnly and securityHasEntityAccess(taskPermissions['program:tasks:editown']|default(false), taskPermissions['program:tasks:editother']|default(false), task.createdBy) %}
|
|
<tr class="initiative-task" data-task-id="{{ task.id }}">
|
|
<td class="initiative-col-pictogram text-center">
|
|
{% set taskTypeIcon = program_item_type_icon('task', task.type) %}
|
|
{% if taskTypeIcon %}<i class="{{ taskTypeIcon }} initiative-item-type-icon" style="font-size: 24px;" aria-hidden="true"></i>{% endif %}
|
|
</td>
|
|
<td class="initiative-col-type"{% if program_item_type_description('task', task.type) %} title="{{ program_item_type_description('task', task.type) }}" data-toggle="tooltip"{% endif %}>
|
|
{{ program_item_type_name('task', task.type) ?? 'mautic.program.description_item.type.unknown'|trans({'%key%': task.type}) }}
|
|
</td>
|
|
<td class="initiative-col-name">
|
|
{% if canEdit %}
|
|
<a href="{{ path('initiative_task_action', {'objectAction': 'edit', 'objectId': task.id, 'returnTo': 'initiative'}) }}" data-toggle="ajax">{{ task.name }}</a>
|
|
{% else %}
|
|
{{ task.name }}
|
|
{% endif %}
|
|
{% if task.taskKind == constant('MauticPlugin\\ProgramBundle\\Entity\\TaskKind::Milestone') %}
|
|
<span class="label label-success" title="{{ 'mautic.program.task.kind.milestone'|trans }}">{{ 'mautic.program.task.kind.milestone_short'|trans }}</span>
|
|
{% elseif task.taskKind == constant('MauticPlugin\\ProgramBundle\\Entity\\TaskKind::Phase') %}
|
|
<span class="label label-primary" title="{{ 'mautic.program.task.kind.phase'|trans }}">{{ 'mautic.program.task.kind.phase_short'|trans }}</span>
|
|
{% endif %}
|
|
</td>
|
|
<td class="initiative-col-description text-muted">
|
|
{# Same 10-line clamp and read-more as the Description tab; URLs become links. #}
|
|
{{ include('@Program/Initiative/_description_read_more.html.twig', {
|
|
'text': task.description|default('')|striptags,
|
|
'id': 'initiative-task-desc-' ~ task.id,
|
|
}) }}
|
|
</td>
|
|
<td class="initiative-col-date">{{ task.startDate ? task.startDate|date('Y-m-d') : '' }}</td>
|
|
<td class="initiative-col-date">{{ task.endDate ? task.endDate|date('Y-m-d') : '' }}</td>
|
|
<td class="initiative-col-status">
|
|
{# A phase has no status of its own — skip the column value. #}
|
|
{% if task.taskKind != constant('MauticPlugin\\ProgramBundle\\Entity\\TaskKind::Phase') %}
|
|
<span class="label {{ task.status.labelClass }}">{{ task.status.labelKey|trans }}</span>
|
|
{% endif %}
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
{% endif %}
|