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

@@ -0,0 +1,99 @@
{% extends '@MauticCore/Default/content.html.twig' %}
{% block mauticContent %}planStakeholder{% endblock %}
{% block preHeader %}
{{- include('@MauticCore/Helper/page_actions.html.twig', {
'item': item,
'templateButtons': {
'close': true,
},
'closeUrl': path('plan_stakeholder_index'),
'targetLabel': 'mautic.plan.stakeholder.header.index'|trans,
}) -}}
{% endblock %}
{% block headerTitle %}{{ item.name }}{% endblock %}
{% block publishStatus %}
{% include '@MauticCore/Helper/_tag.html.twig' with { tags: [{
color: item.isPublished ? 'green' : 'cool-gray',
label: (item.isPublished ? 'mautic.plan.stakeholder.active' : 'mautic.plan.stakeholder.inactive')|trans,
icon: item.isPublished ? 'ri-checkbox-circle-line' : 'ri-time-line',
attributes: {'class': 'plan-stakeholder-status-tag'},
}] } %}
{% endblock %}
{% block actions %}
{{- include('@MauticCore/Helper/page_actions.html.twig', {
'item': item,
'templateButtons': {
'edit': securityHasEntityAccess(permissions['plan:stakeholders:editown'], permissions['plan:stakeholders:editother'], item.createdBy),
'delete': securityHasEntityAccess(permissions['plan:stakeholders:deleteown'], permissions['plan:stakeholders:deleteother'], item.createdBy),
},
'langVar': 'plan.stakeholder',
}) -}}
{% endblock %}
{% block content %}
<div class="pa-md">
<table class="table table-hover mb-md plan-stakeholder-details">
<tbody>
<tr>
<td class="col-md-3 text-muted">{{ 'mautic.plan.stakeholder.field.type'|trans }}</td>
<td>
{% set typeIcon = plan_item_type_icon('stakeholder', item.type) %}
{% if typeIcon %}<i class="{{ typeIcon }} plan-item-type-icon" style="font-size: 24px;" aria-hidden="true"></i> {% endif %}
{{ plan_item_type_name('stakeholder', item.type) ?? 'mautic.plan.description_item.type.unknown'|trans({'%key%': item.type}) }}
</td>
</tr>
<tr>
<td class="text-muted">{{ 'mautic.plan.stakeholder.field.role'|trans }}</td>
<td>{{ item.role|default('mautic.plan.value.none'|trans) }}</td>
</tr>
<tr>
<td class="text-muted">{{ 'mautic.plan.stakeholder.field.email'|trans }}</td>
<td>{% if item.email %}<a href="mailto:{{ item.email }}">{{ item.email }}</a>{% else %}{{ 'mautic.plan.value.none'|trans }}{% endif %}</td>
</tr>
<tr>
<td class="text-muted">{{ 'mautic.plan.stakeholder.field.phone'|trans }}</td>
<td>{% if item.phone %}<a href="tel:{{ item.phone|replace({' ': ''}) }}">{{ item.phone }}</a>{% else %}{{ 'mautic.plan.value.none'|trans }}{% endif %}</td>
</tr>
<tr>
<td class="text-muted">{{ 'mautic.core.created'|trans }}</td>
<td>{{ item.dateAdded ? dateToFull(item.dateAdded) : '' }}{% if item.createdByUser %} ({{ item.createdByUser }}){% endif %}</td>
</tr>
<tr>
<td class="text-muted">{{ 'mautic.core.id'|trans }}</td>
<td>{{ item.id }}</td>
</tr>
</tbody>
</table>
<h4 class="mb-sm">{{ 'mautic.plan.stakeholder.field.plans'|trans }}</h4>
{% if item.planLinks is empty %}
<p class="text-muted">{{ 'mautic.plan.stakeholder.no_plans'|trans }}</p>
{% else %}
<div class="table-responsive">
<table class="table table-hover plan-stakeholder-plans-view">
<thead>
<tr>
<th>{{ 'mautic.plan.field.name'|trans }}</th>
<th>{{ 'mautic.plan.stakeholder.field.role_in_plan'|trans }}</th>
<th>{{ 'mautic.plan.field.status'|trans }}</th>
</tr>
</thead>
<tbody>
{% for link in item.planLinks %}
<tr>
<td><a href="{{ path('plan_action', {'objectAction': 'view', 'objectId': link.plan.id}) }}" data-toggle="ajax">{{ link.plan.name }}</a></td>
<td class="text-muted">{{ link.roleInPlan|default('—') }}</td>
<td><span class="label {{ link.plan.status.labelClass }}">{{ link.plan.status.labelKey|trans }}</span></td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endif %}
</div>
{% endblock %}
@@ -0,0 +1,43 @@
{% extends '@MauticCore/Default/content.html.twig' %}
{% block mauticContent %}planStakeholder{% endblock %}
{% block headerTitle %}
{% if entity.id %}
{{ 'mautic.plan.stakeholder.header.edit'|trans({'%name%': entity.name}) }}
{% else %}
{{ 'mautic.plan.stakeholder.header.new'|trans }}
{% endif %}
{% endblock %}
{% block content %}
{{ form_start(form) }}
<div class="box-layout">
<div class="col-md-9 height-auto bdr-r">
<div class="pa-md">
{{ form_row(form.name) }}
<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('stakeholder', form.type.vars.value) }}" style="font-size: 28px;" aria-hidden="true"></i>
</div>
<div class="col-xs-11">
{{ form_row(form.type) }}
{# Filled with the selected type's description by plan.js. #}
<p class="help-block plan-item-type-help">{{ plan_item_type_description('stakeholder', form.type.vars.value) }}</p>
</div>
</div>
{{ form_row(form.role) }}
</div>
</div>
<div class="col-md-3 height-auto">
<div class="pr-lg pl-lg pt-md pb-md">
{{ form_row(form.isPublished) }}
{{ form_row(form.email) }}
{{ form_row(form.phone) }}
<p class="text-muted small">{{ 'mautic.plan.stakeholder.phone.help'|trans }}</p>
</div>
</div>
</div>
{{ form_end(form) }}
{% endblock %}
+169
View File
@@ -0,0 +1,169 @@
{% set isIndex = 'index' == tmpl ? true : false %}
{% set tmpl = 'list' %}
{% extends isIndex ? '@MauticCore/Default/content.html.twig' : '@MauticCore/Default/raw_output.html.twig' %}
{% block mauticContent %}planStakeholder{% endblock %}
{% block headerTitle %}{{ 'mautic.plan.stakeholder.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:stakeholders:create'],
},
'langVar': 'plan.stakeholder',
},
'bulk_actions': {
'langVar': 'plan.stakeholder',
'templateButtons': {
'delete': permissions['plan:stakeholders:deleteown'] or permissions['plan:stakeholders:deleteother'],
},
},
}) -}}
<div class="page-list">
{% if items is defined and items is not empty %}
<div class="table-responsive">
<table class="table table-hover" id="planStakeholderTable">
<thead>
<tr>
{{ include('@MauticCore/Helper/tableheader.html.twig', {
'checkall': 'true',
'target': '#planStakeholderTable',
}) }}
{# Columns: ID, Pictogram, Type, Name, Role, Email, Phone, Active, Assigned plans. #}
{{ include('@MauticCore/Helper/tableheader.html.twig', {
'sessionVar': 'plan.stakeholder',
'orderBy': 's.id',
'text': 'mautic.core.id',
'class': 'col-plan-stakeholder-id',
}) }}
{{ include('@MauticCore/Helper/tableheader.html.twig', {
'sessionVar': 'plan.stakeholder',
'text': 'mautic.plan.stakeholder.field.pictogram',
'class': 'col-plan-stakeholder-pictogram',
}) }}
{{ include('@MauticCore/Helper/tableheader.html.twig', {
'sessionVar': 'plan.stakeholder',
'orderBy': 's.type',
'text': 'mautic.plan.stakeholder.field.type',
'class': 'col-plan-stakeholder-type',
}) }}
{{ include('@MauticCore/Helper/tableheader.html.twig', {
'sessionVar': 'plan.stakeholder',
'orderBy': 's.name',
'text': 'mautic.plan.stakeholder.field.name',
'class': 'col-plan-stakeholder-name',
'default': true,
}) }}
{{ include('@MauticCore/Helper/tableheader.html.twig', {
'sessionVar': 'plan.stakeholder',
'orderBy': 's.role',
'text': 'mautic.plan.stakeholder.field.role',
'class': 'visible-md visible-lg col-plan-stakeholder-role',
}) }}
{{ include('@MauticCore/Helper/tableheader.html.twig', {
'sessionVar': 'plan.stakeholder',
'orderBy': 's.email',
'text': 'mautic.plan.stakeholder.field.email',
'class': 'col-plan-stakeholder-email',
}) }}
{{ include('@MauticCore/Helper/tableheader.html.twig', {
'sessionVar': 'plan.stakeholder',
'text': 'mautic.plan.stakeholder.field.phone',
'class': 'col-plan-stakeholder-phone',
}) }}
{{ include('@MauticCore/Helper/tableheader.html.twig', {
'sessionVar': 'plan.stakeholder',
'orderBy': 's.isPublished',
'text': 'mautic.plan.stakeholder.field.active',
'class': 'col-plan-stakeholder-active',
}) }}
{{ include('@MauticCore/Helper/tableheader.html.twig', {
'sessionVar': 'plan.stakeholder',
'text': 'mautic.plan.stakeholder.field.plans',
'class': 'visible-md visible-lg col-plan-stakeholder-plans',
}) }}
</tr>
</thead>
<tbody>
{% for item in items %}
{% set canEdit = securityHasEntityAccess(permissions['plan:stakeholders:editown'], permissions['plan:stakeholders:editother'], item.createdBy) %}
<tr>
<td>
{{- include('@MauticCore/Helper/list_actions.html.twig', {
'item': item,
'templateButtons': {
'edit': canEdit,
'delete': securityHasEntityAccess(permissions['plan:stakeholders:deleteown'], permissions['plan:stakeholders:deleteother'], item.createdBy),
},
'langVar': 'plan.stakeholder',
}) -}}
</td>
<td>{{ item.id }}</td>
<td class="text-center">
{% set typeIcon = plan_item_type_icon('stakeholder', 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('stakeholder', item.type) %} title="{{ plan_item_type_description('stakeholder', item.type) }}"{% endif %}>
{{ plan_item_type_name('stakeholder', item.type) ?? 'mautic.plan.description_item.type.unknown'|trans({'%key%': item.type}) }}
</td>
<td>
{% if canEdit %}
<a href="{{ path('plan_stakeholder_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">{{ item.role }}</td>
<td>
{% if item.email %}<a href="mailto:{{ item.email }}">{{ item.email }}</a>{% endif %}
</td>
<td class="text-nowrap">
{% if item.phone %}<a href="tel:{{ item.phone|replace({' ': ''}) }}">{{ item.phone }}</a>{% endif %}
</td>
<td>
<span class="label {{ item.isPublished ? 'label-success' : 'label-gray' }}">
{{ (item.isPublished ? 'mautic.plan.stakeholder.active' : 'mautic.plan.stakeholder.inactive')|trans }}
</span>
</td>
<td class="visible-md visible-lg">
{# The plans this stakeholder is assigned to, through their Stakeholders tab. #}
{% set plans = item.planLinks|default([]) %}
{% for link in plans %}
<a href="{{ path('plan_action', {'objectAction': 'view', 'objectId': link.plan.id}) }}" data-toggle="ajax">{{ link.plan.name }}</a>{% if link.roleInPlan %} <span class="text-muted small">({{ link.roleInPlan }})</span>{% endif %}{% if not loop.last %}, {% endif %}
{% else %}
<span class="text-muted">{{ 'mautic.plan.stakeholder.no_plans'|trans }}</span>
{% endfor %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
<div class="panel-footer">
{{- include('@MauticCore/Helper/pagination.html.twig', {
'totalItems': totalItems,
'page': page,
'limit': limit,
'baseUrl': path('plan_stakeholder_index'),
'sessionVar': 'plan.stakeholder',
}) -}}
</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.stakeholder.onboarding.heading',
'subheading': 'mautic.plan.stakeholder.onboarding.subheading',
'copy': 'mautic.plan.stakeholder.onboarding.copy',
}) }}
</div>
{% endif %}
</div>
</div>
{% endblock %}