feat: Add TargetType form and migration for plan targets

- Implemented TargetType form for managing target details including name, type, priority, stages, estimated size, profile criteria, pain points, value proposition, and preferred channels.
- Created migration scripts for adding type and priority columns to plan objectives and tasks.
- Added migration for creating plan targets and plan target stages tables, including foreign key constraints.
- Introduced stakeholder management with forms and views for creating, editing, and listing stakeholders.
- Enhanced UI with read more functionality for long text descriptions and filtering options in plan tab tables.
This commit is contained in:
Alexandre Gain committed 2026-11-08 11:54:25 +01:00
1 parent 8c8d7a6f95
commit 8696acd01c
52 files changed
+3178 -125

No files matched your search

+194 -43
View File
@@ -86,6 +86,8 @@
'description': descriptionItems|length,
'objectives': objectives|length,
'allocation': allocationItems|length,
'targets': item.targets|length,
'stakeholders': item.stakeholders|length,
'tasks': taskTree|length,
}}) }}
@@ -151,14 +153,17 @@
{% if descriptionItems is empty %}
<p class="text-muted">{{ 'mautic.plan.description_item.empty'|trans }}</p>
{% else %}
{# Three columns: the type's pictogram, the type, the description. #}
{# Harmonized columns: Pictogram (no label), Type, Description. Description items have no
name of their own, so the Name column is left out here. Filter + click-to-sort (plan.js). #}
{{ include('@Plan/Plan/_tab_table_filter.html.twig') }}
<div class="table-responsive">
<table class="table table-hover plan-description-items-view">
<table class="table table-hover plan-tab-table plan-description-items-view"
data-plan-tab-table data-empty-text="{{ 'mautic.plan.filter.no_match'|trans }}" data-sort-hint="{{ 'mautic.plan.filter.sort_hint'|trans }}">
<thead>
<tr>
<th class="text-center" style="width: 1%;">{{ 'mautic.plan.description_item.field.pictogram'|trans }}</th>
<th class="col-md-3">{{ 'mautic.plan.description_item.field.type'|trans }}</th>
<th>{{ 'mautic.plan.description_item.field.description'|trans }}</th>
<th class="plan-col-pictogram" aria-label="{{ 'mautic.plan.description_item.field.pictogram'|trans }}"></th>
<th class="plan-col-type">{{ 'mautic.plan.description_item.field.type'|trans }}</th>
<th class="plan-col-description">{{ 'mautic.plan.description_item.field.description'|trans }}</th>
</tr>
</thead>
<tbody>
@@ -167,15 +172,18 @@
{% set typeDescription = plan_item_type_description('description', descriptionItem.type) %}
{% set typeIcon = plan_item_type_icon('description', descriptionItem.type) %}
<tr>
<td class="text-center">
<td class="plan-col-pictogram text-center">
{% if typeIcon %}<i class="{{ typeIcon }} plan-item-type-icon" style="font-size: 24px;" aria-hidden="true"></i>{% endif %}
</td>
<td>
<strong{% if typeDescription %} title="{{ typeDescription }}" data-toggle="tooltip"{% endif %}>
{{ typeName ?? 'mautic.plan.description_item.type.unknown'|trans({'%key%': descriptionItem.type}) }}
</strong>
<td class="plan-col-type"{% if typeDescription %} title="{{ typeDescription }}" data-toggle="tooltip"{% endif %}>
{{ typeName ?? 'mautic.plan.description_item.type.unknown'|trans({'%key%': descriptionItem.type}) }}
</td>
<td class="plan-col-description">
{{ include('@Plan/Plan/_description_read_more.html.twig', {
'text': descriptionItem.description,
'id': 'plan-desc-item-' ~ descriptionItem.id,
}) }}
</td>
<td style="white-space: pre-wrap;">{{ descriptionItem.description }}</td>
</tr>
{% endfor %}
</tbody>
@@ -192,21 +200,49 @@
<p class="text-muted plan-objectives-progress">
{{ 'mautic.plan.objective.progress'|trans({'%achieved%': achievedCount, '%total%': objectives|length}) }}
</p>
<ol class="list-group plan-objectives-view">
{% for objective in objectives %}
<li class="list-group-item">
{% if objective.achieved %}
<i class="ri-checkbox-circle-fill text-success" title="{{ 'mautic.plan.objective.achieved'|trans }}"></i>
{% else %}
<i class="ri-checkbox-blank-circle-line text-muted" title="{{ 'mautic.plan.objective.not_achieved'|trans }}"></i>
{% endif %}
<strong>{{ objective.title }}</strong>
{% if objective.description is not empty %}
<div class="text-muted mt-xs" style="white-space: pre-wrap;">{{ objective.description }}</div>
{% endif %}
</li>
{% endfor %}
</ol>
{# Harmonized columns: Pictogram (no label), Type, Name (title), Description, Priority,
Status (achieved). Filter + click-to-sort (plan.js). #}
{{ include('@Plan/Plan/_tab_table_filter.html.twig') }}
<div class="table-responsive">
<table class="table table-hover plan-tab-table plan-objectives-view"
data-plan-tab-table data-empty-text="{{ 'mautic.plan.filter.no_match'|trans }}" data-sort-hint="{{ 'mautic.plan.filter.sort_hint'|trans }}">
<thead>
<tr>
<th class="plan-col-pictogram" aria-label="{{ 'mautic.plan.objective.field.pictogram'|trans }}"></th>
<th class="plan-col-type">{{ 'mautic.plan.objective.field.type'|trans }}</th>
<th class="plan-col-name">{{ 'mautic.plan.objective.field.name'|trans }}</th>
<th class="plan-col-description">{{ 'mautic.plan.objective.field.description'|trans }}</th>
<th class="plan-col-priority">{{ 'mautic.plan.objective.field.priority'|trans }}</th>
<th class="plan-col-status">{{ 'mautic.plan.objective.field.is_achieved'|trans }}</th>
</tr>
</thead>
<tbody>
{% for objective in objectives %}
{% set typeName = plan_item_type_name('objective', objective.type) %}
{% set typeDescription = plan_item_type_description('objective', objective.type) %}
{% set typeIcon = plan_item_type_icon('objective', objective.type) %}
<tr>
<td class="plan-col-pictogram text-center">
{% if typeIcon %}<i class="{{ typeIcon }} plan-item-type-icon" style="font-size: 24px;" aria-hidden="true"></i>{% endif %}
</td>
<td class="plan-col-type"{% if typeDescription %} title="{{ typeDescription }}" data-toggle="tooltip"{% endif %}>
{{ typeName ?? 'mautic.plan.description_item.type.unknown'|trans({'%key%': objective.type}) }}
</td>
<td class="plan-col-name">{{ objective.title }}</td>
<td class="plan-col-description text-muted" style="white-space: pre-wrap;">{{ objective.description|plan_linkify }}</td>
<td class="plan-col-priority">{{ objective.priority ?? '—' }}</td>
<td class="plan-col-status">
{% if objective.achieved %}
<span class="label label-success"><i class="ri-checkbox-circle-fill" title="{{ 'mautic.plan.objective.achieved'|trans }}"></i> {{ 'mautic.plan.objective.achieved'|trans }}</span>
{% else %}
<span class="label label-default"><i class="ri-checkbox-blank-circle-line" title="{{ 'mautic.plan.objective.not_achieved'|trans }}"></i> {{ 'mautic.plan.objective.not_achieved'|trans }}</span>
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endif %}
</div>
@@ -231,16 +267,20 @@
{% if allocationItems is empty %}
<p class="text-muted">{{ 'mautic.plan.allocation_item.empty'|trans }}</p>
{% else %}
{# Harmonized columns: Pictogram (no label), Type, Name, Description, then the costs.
Filter + click-to-sort (plan.js). #}
{{ include('@Plan/Plan/_tab_table_filter.html.twig') }}
<div class="table-responsive">
<table class="table table-hover plan-allocation-items-view">
<table class="table table-hover plan-tab-table plan-allocation-items-view"
data-plan-tab-table data-empty-text="{{ 'mautic.plan.filter.no_match'|trans }}" data-sort-hint="{{ 'mautic.plan.filter.sort_hint'|trans }}">
<thead>
<tr>
<th class="text-center" style="width: 1%;">{{ 'mautic.plan.allocation_item.field.pictogram'|trans }}</th>
<th>{{ 'mautic.plan.allocation_item.field.type'|trans }}</th>
<th>{{ 'mautic.plan.allocation_item.field.name'|trans }}</th>
<th class="visible-md visible-lg">{{ 'mautic.plan.allocation_item.field.description'|trans }}</th>
<th class="text-right">{{ 'mautic.plan.allocation_item.field.planned_cost'|trans }}</th>
<th class="text-right">{{ 'mautic.plan.allocation_item.field.real_cost'|trans }}</th>
<th class="plan-col-pictogram" aria-label="{{ 'mautic.plan.allocation_item.field.pictogram'|trans }}"></th>
<th class="plan-col-type">{{ 'mautic.plan.allocation_item.field.type'|trans }}</th>
<th class="plan-col-name">{{ 'mautic.plan.allocation_item.field.name'|trans }}</th>
<th class="plan-col-description">{{ 'mautic.plan.allocation_item.field.description'|trans }}</th>
<th class="plan-col-cost text-right">{{ 'mautic.plan.allocation_item.field.planned_cost'|trans }}</th>
<th class="plan-col-cost text-right">{{ 'mautic.plan.allocation_item.field.real_cost'|trans }}</th>
</tr>
</thead>
<tbody>
@@ -249,18 +289,18 @@
{% set typeDescription = plan_item_type_description('allocation', allocationItem.type) %}
{% set typeIcon = plan_item_type_icon('allocation', allocationItem.type) %}
<tr>
<td class="text-center">
<td class="plan-col-pictogram text-center">
{% if typeIcon %}<i class="{{ typeIcon }} plan-item-type-icon" style="font-size: 24px;" aria-hidden="true"></i>{% endif %}
</td>
<td{% if typeDescription %} title="{{ typeDescription }}"{% endif %}>
<td class="plan-col-type"{% if typeDescription %} title="{{ typeDescription }}" data-toggle="tooltip"{% endif %}>
{{ typeName ?? 'mautic.plan.description_item.type.unknown'|trans({'%key%': allocationItem.type}) }}
</td>
<td>{{ allocationItem.name }}</td>
<td class="visible-md visible-lg text-muted" style="white-space: pre-wrap;">{{ allocationItem.description }}</td>
<td class="text-right text-nowrap">
<td class="plan-col-name">{{ allocationItem.name }}</td>
<td class="plan-col-description text-muted" style="white-space: pre-wrap;">{{ allocationItem.description|plan_linkify }}</td>
<td class="plan-col-cost text-right text-nowrap">
{% if allocationItem.plannedCost is not null %}{{ plan_money(allocationItem.plannedCost) }} {{ plan_currency() }}{% endif %}
</td>
<td class="text-right text-nowrap">
<td class="plan-col-cost text-right text-nowrap">
{% if allocationItem.realCost is not null %}{{ plan_money(allocationItem.realCost) }} {{ plan_currency() }}{% endif %}
</td>
</tr>
@@ -269,10 +309,10 @@
<tfoot>
<tr class="plan-allocation-total">
<th colspan="4">{{ 'mautic.plan.allocation.total'|trans }}</th>
<th class="text-right text-nowrap">
<th class="plan-col-cost text-right text-nowrap">
{% if allocationTotals.planned is not null %}{{ plan_money(allocationTotals.planned) }} {{ plan_currency() }}{% endif %}
</th>
<th class="text-right text-nowrap">
<th class="plan-col-cost text-right text-nowrap">
{% if allocationTotals.real is not null %}{{ plan_money(allocationTotals.real) }} {{ plan_currency() }}{% endif %}
</th>
</tr>
@@ -282,9 +322,120 @@
{% endif %}
</div>
{# Targets #}
{# Stakeholders: the plan's links to the global directory, harmonized like the other tabs. #}
<div class="tab-pane bdr-w-0" id="plan-tab-stakeholders" role="tabpanel">
{% set stakeholders = item.stakeholders %}
{% if stakeholders is empty %}
<p class="text-muted">{{ 'mautic.plan.stakeholder.empty'|trans }}</p>
{% else %}
{# Harmonized columns: Pictogram (no label), Type, Name, then the link's own fields.
Filter + click-to-sort (plan.js). #}
{{ include('@Plan/Plan/_tab_table_filter.html.twig') }}
<div class="table-responsive">
<table class="table table-hover plan-tab-table plan-stakeholders-view"
data-plan-tab-table data-empty-text="{{ 'mautic.plan.filter.no_match'|trans }}" data-sort-hint="{{ 'mautic.plan.filter.sort_hint'|trans }}">
<thead>
<tr>
<th class="plan-col-pictogram" aria-label="{{ 'mautic.plan.stakeholder.field.pictogram'|trans }}"></th>
<th class="plan-col-type">{{ 'mautic.plan.stakeholder.field.type'|trans }}</th>
<th class="plan-col-name">{{ 'mautic.plan.stakeholder.field.name'|trans }}</th>
<th class="plan-col-role">{{ 'mautic.plan.stakeholder.field.role_in_plan'|trans }}</th>
<th class="plan-col-role">{{ 'mautic.plan.stakeholder.field.role'|trans }}</th>
<th class="plan-col-email">{{ 'mautic.plan.stakeholder.field.email'|trans }}</th>
<th class="plan-col-phone">{{ 'mautic.plan.stakeholder.field.phone'|trans }}</th>
<th class="plan-col-active">{{ 'mautic.plan.stakeholder.field.active'|trans }}</th>
</tr>
</thead>
<tbody>
{% for link in stakeholders %}
{% set stakeholder = link.stakeholder %}
<tr>
<td class="plan-col-pictogram text-center">
{% set typeIcon = plan_item_type_icon('stakeholder', stakeholder.type) %}
{% if typeIcon %}<i class="{{ typeIcon }} plan-item-type-icon" style="font-size: 24px;" aria-hidden="true"></i>{% endif %}
</td>
<td class="plan-col-type"{% if plan_item_type_description('stakeholder', stakeholder.type) %} title="{{ plan_item_type_description('stakeholder', stakeholder.type) }}" data-toggle="tooltip"{% endif %}>
{{ plan_item_type_name('stakeholder', stakeholder.type) ?? 'mautic.plan.description_item.type.unknown'|trans({'%key%': stakeholder.type}) }}
</td>
<td class="plan-col-name">
<a href="{{ path('plan_stakeholder_action', {'objectAction': 'view', 'objectId': stakeholder.id}) }}" data-toggle="ajax">{{ stakeholder.name }}</a>
</td>
<td class="plan-col-role">{{ link.roleInPlan }}</td>
<td class="plan-col-role text-muted">{{ stakeholder.role }}</td>
<td class="plan-col-email">
{% if stakeholder.email %}<a href="mailto:{{ stakeholder.email }}">{{ stakeholder.email }}</a>{% endif %}
</td>
<td class="plan-col-phone text-nowrap">
{% if stakeholder.phone %}<a href="tel:{{ stakeholder.phone|replace({' ': ''}) }}">{{ stakeholder.phone }}</a>{% endif %}
</td>
<td class="plan-col-active">
<span class="label {{ stakeholder.isPublished ? 'label-success' : 'label-gray' }}">
{{ (stakeholder.isPublished ? 'mautic.plan.stakeholder.active' : 'mautic.plan.stakeholder.inactive')|trans }}
</span>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endif %}
</div>
{# Targets: the plan's audiences, harmonized like the other tabs. #}
<div class="tab-pane bdr-w-0" id="plan-tab-targets" role="tabpanel">
<p class="text-muted">{{ 'mautic.plan.target.empty'|trans }}</p>
{% set targets = item.targets %}
{% if targets is empty %}
<p class="text-muted">{{ 'mautic.plan.target.empty'|trans }}</p>
{% else %}
{# Harmonized columns: Pictogram (no label, fixed per target type), Type, Name, then the
target's own fields. Filter + click-to-sort (plan.js). #}
{{ include('@Plan/Plan/_tab_table_filter.html.twig') }}
<div class="table-responsive">
<table class="table table-hover plan-tab-table plan-targets-view"
data-plan-tab-table data-empty-text="{{ 'mautic.plan.filter.no_match'|trans }}" data-sort-hint="{{ 'mautic.plan.filter.sort_hint'|trans }}">
<thead>
<tr>
<th class="plan-col-pictogram" aria-label="{{ 'mautic.plan.target.field.pictogram'|trans }}"></th>
<th class="plan-col-type">{{ 'mautic.plan.target.field.type'|trans }}</th>
<th class="plan-col-name">{{ 'mautic.plan.target.field.name'|trans }}</th>
<th class="plan-col-priority">{{ 'mautic.plan.target.field.priority'|trans }}</th>
<th class="plan-col-stages">{{ 'mautic.plan.target.field.stages'|trans }}</th>
<th class="plan-col-size text-right">{{ 'mautic.plan.target.field.estimated_size'|trans }}</th>
<th class="plan-col-description">{{ 'mautic.plan.target.field.profile_criteria'|trans }}</th>
<th class="plan-col-description">{{ 'mautic.plan.target.field.pain_points'|trans }}</th>
<th class="plan-col-description">{{ 'mautic.plan.target.field.value_proposition'|trans }}</th>
<th class="plan-col-channels">{{ 'mautic.plan.target.field.preferred_channels'|trans }}</th>
</tr>
</thead>
<tbody>
{% for target in targets %}
<tr>
<td class="plan-col-pictogram text-center">
<i class="{{ target.targetType.icon }} plan-item-type-icon" style="font-size: 24px;" aria-hidden="true"></i>
</td>
<td class="plan-col-type">{{ target.targetType.labelKey|trans }}</td>
<td class="plan-col-name">{{ target.name }}</td>
<td class="plan-col-priority">
<span class="label {{ target.priority.labelClass }}">{{ target.priority.labelKey|trans }}</span>
</td>
<td class="plan-col-stages text-muted">
{{ target.stages|map(stage => stage.name)|join(', ') }}
</td>
<td class="plan-col-size text-right text-nowrap">{{ target.estimatedSize }}</td>
<td class="plan-col-description text-muted" style="white-space: pre-wrap;">{{ target.profileCriteria }}</td>
<td class="plan-col-description text-muted" style="white-space: pre-wrap;">{{ target.painPoints }}</td>
<td class="plan-col-description text-muted" style="white-space: pre-wrap;">{{ target.valueProposition }}</td>
<td class="plan-col-channels">
{% for channel in target.preferredChannels ?? [] %}
<span class="label label-default">{{ plan_target_channel_label(channel)|trans }}</span>
{% endfor %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endif %}
</div>
{# Tasks: same columns as Planning > Tasks, in tree order. #}