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

+90 -6
View File
@@ -39,9 +39,23 @@
{% macro objective_row(objective) %}
{{ _self.row_start('mautic.plan.objective.drag') }}
<div class="row">
{# The selected type's pictogram; updated by plan.js when the type changes. #}
<div class="col-xs-1 text-center pt-lg">
<i class="plan-item-type-icon {{ plan_item_type_icon('objective', objective.type.vars.value) }}" style="font-size: 28px;" aria-hidden="true"></i>
</div>
<div class="col-xs-11">
{{ form_row(objective.type) }}
{# Filled with the selected type's description by plan.js. #}
<p class="help-block plan-item-type-help">{{ plan_item_type_description('objective', objective.type.vars.value) }}</p>
</div>
</div>
{{ form_row(objective.title) }}
<div class="row">
<div class="col-md-6">{{ form_row(objective.priority) }}</div>
<div class="col-md-6">{{ form_row(objective.isAchieved) }}</div>
</div>
{{ form_row(objective.description) }}
{{ form_row(objective.isAchieved) }}
{{ form_widget(objective.position) }}
{{ _self.row_end('mautic.plan.objective.remove') }}
{% endmacro %}
@@ -64,6 +78,33 @@
{{ _self.row_end('mautic.plan.description_item.remove') }}
{% endmacro %}
{% macro stakeholder_row(link) %}
{{ _self.row_start('mautic.plan.stakeholder.drag') }}
<div class="row">
<div class="col-md-6">{{ form_row(link.stakeholder) }}</div>
<div class="col-md-6">{{ form_row(link.roleInPlan) }}</div>
</div>
{{ form_widget(link.position) }}
{{ _self.row_end('mautic.plan.stakeholder.remove') }}
{% endmacro %}
{% macro target_row(target) %}
{{ _self.row_start('mautic.plan.target.drag') }}
{{ form_row(target.name) }}
<div class="row">
<div class="col-md-4">{{ form_row(target.targetType) }}</div>
<div class="col-md-4">{{ form_row(target.priority) }}</div>
<div class="col-md-4">{{ form_row(target.estimatedSize) }}</div>
</div>
{{ form_row(target.stages) }}
{{ form_row(target.profileCriteria) }}
{{ form_row(target.painPoints) }}
{{ form_row(target.valueProposition) }}
{{ form_row(target.preferredChannels) }}
{{ form_widget(target.position) }}
{{ _self.row_end('mautic.plan.target.remove') }}
{% endmacro %}
{% macro allocation_item_row(item) %}
{{ _self.row_start('mautic.plan.allocation_item.drag') }}
<div class="row">
@@ -152,10 +193,14 @@
{# Objectives #}
<div class="tab-pane bdr-w-0" id="plan-tab-objectives" role="tabpanel">
{% set hasObjectiveTypes = form.objectives.vars.prototype.type.vars.choices is not empty %}
<div class="plan-collection plan-objectives"
data-prototype="{{ _self.objective_row(form.objectives.vars.prototype)|e('html_attr') }}"
data-prototype-name="__objective__">
{{ form_errors(form.objectives) }}
{% if not hasObjectiveTypes %}
<div class="alert alert-info">{{ 'mautic.plan.objective.no_types'|trans }}</div>
{% endif %}
<p class="text-muted plan-collection-empty{% if form.objectives|length > 0 %} hide{% endif %}">
{{ 'mautic.plan.objective.empty'|trans }}
</p>
@@ -164,9 +209,11 @@
{{ _self.objective_row(objective) }}
{% endfor %}
</ul>
<button type="button" class="btn btn-ghost plan-collection-add">
<i class="ri-add-line"></i> {{ 'mautic.plan.objective.add'|trans }}
</button>
{% if hasObjectiveTypes %}
<button type="button" class="btn btn-ghost plan-collection-add">
<i class="ri-add-line"></i> {{ 'mautic.plan.objective.add'|trans }}
</button>
{% endif %}
</div>
{% do form.objectives.setRendered %}
</div>
@@ -203,9 +250,46 @@
{% do form.allocationItems.setRendered %}
</div>
{# Targets #}
{# Stakeholders: links to the global directory (Planning > Stakeholders). #}
<div class="tab-pane bdr-w-0" id="plan-tab-stakeholders" role="tabpanel">
<div class="plan-collection plan-stakeholders"
data-prototype="{{ _self.stakeholder_row(form.stakeholders.vars.prototype)|e('html_attr') }}"
data-prototype-name="__stakeholder__">
{{ form_errors(form.stakeholders) }}
<p class="text-muted plan-collection-empty{% if form.stakeholders|length > 0 %} hide{% endif %}">
{{ 'mautic.plan.stakeholder.empty'|trans }}
</p>
<ul class="list-group plan-collection-list">
{% for link in form.stakeholders %}
{{ _self.stakeholder_row(link) }}
{% endfor %}
</ul>
<button type="button" class="btn btn-ghost plan-collection-add">
<i class="ri-add-line"></i> {{ 'mautic.plan.stakeholder.add'|trans }}
</button>
</div>
{% do form.stakeholders.setRendered %}
</div>
{# Targets: the plan's audiences. #}
<div class="tab-pane bdr-w-0" id="plan-tab-targets" role="tabpanel">
<p class="text-muted">{{ 'mautic.plan.target.empty'|trans }}</p>
<div class="plan-collection plan-targets"
data-prototype="{{ _self.target_row(form.targets.vars.prototype)|e('html_attr') }}"
data-prototype-name="__target__">
{{ form_errors(form.targets) }}
<p class="text-muted plan-collection-empty{% if form.targets|length > 0 %} hide{% endif %}">
{{ 'mautic.plan.target.empty'|trans }}
</p>
<ul class="list-group plan-collection-list">
{% for target in form.targets %}
{{ _self.target_row(target) }}
{% endfor %}
</ul>
<button type="button" class="btn btn-ghost plan-collection-add">
<i class="ri-add-line"></i> {{ 'mautic.plan.target.add'|trans }}
</button>
</div>
{% do form.targets.setRendered %}
</div>
{# Tasks: read-only here, so that following a link doesn't drop unsaved changes to the plan. #}