{% extends '@MauticCore/Default/content.html.twig' %} {% block mauticContent %}mt3sMpProgram{% endblock %} {# # No routeBase on the page_actions includes: core would turn it into mautic_mt3s_marketing_program_* route names. # The buttons use actionRoute (mt3s_marketing_program_action) from the controller, and the close button gets its URL here. #} {% block preHeader %} {{- include('@MauticCore/Helper/page_actions.html.twig', { 'item': item, 'templateButtons': { 'close': true, }, 'closeUrl': path('mt3s_marketing_program_index'), 'targetLabel': 'mt3s.marketing_program.header.index'|trans, }) -}} {# Core's helper renders an empty pill when there is no category. #} {% if item.category %} {{ include('@MauticCore/Modules/category--inline.html.twig', {'category': item.category}) }} {% endif %} {% endblock %} {% block headerTitle %}{{ item.name }}{% endblock %} {# # Under the title, as on an email's page: the plan status, then the total planned and real costs of the # allocation items, in the general currency. A real total above the planned total is red, otherwise green. #} {% block publishStatus %} {% set statusColors = { 'draft': 'warm-gray', 'planned': 'blue', 'active': 'green', 'paused': 'warning', 'completed': 'teal', 'archived': 'cool-gray', } %} {% include '@MauticCore/Helper/_tag.html.twig' with { tags: [{ color: statusColors[item.status.value]|default('gray'), label: item.status.labelKey, icon: 'ri-flag-line', attributes: {'class': 'program-status-tag'}, }] } %} {% set totals = item.allocationTotals %} {% if totals.planned is not null or totals.real is not null %}
{% set totalTags = [] %} {% if totals.planned is not null %} {% set totalTags = totalTags|merge([{ color: 'high-contrast', icon: 'ri-wallet-3-line', label: 'mt3s.marketing_program.header.total_planned'|trans({'%amount%': mt3s_marketing_program_money(totals.planned), '%currency%': mt3s_marketing_program_currency()}), attributes: {'class': 'program-total-planned', 'title': 'mt3s.marketing_program.header.total_planned.tooltip'|trans, 'data-toggle': 'tooltip'}, }]) %} {% endif %} {% if totals.real is not null %} {% set overPlan = totals.planned is not null and (totals.real + 0) > (totals.planned + 0) %} {% set totalTags = totalTags|merge([{ color: overPlan ? 'red' : 'green', icon: overPlan ? 'ri-error-warning-line' : 'ri-checkbox-circle-line', label: 'mt3s.marketing_program.header.total_real'|trans({'%amount%': mt3s_marketing_program_money(totals.real), '%currency%': mt3s_marketing_program_currency()}), attributes: {'class': 'program-total-real', 'title': (overPlan ? 'mt3s.marketing_program.header.total_real.over' : 'mt3s.marketing_program.header.total_real.tooltip')|trans, 'data-toggle': 'tooltip'}, }]) %} {% endif %} {% include '@MauticCore/Helper/_tag.html.twig' with { tags: totalTags } %} {% endif %} {% endblock %} {% block actions %} {{- include('@MauticCore/Helper/page_actions.html.twig', { 'item': item, 'templateButtons': { 'edit': securityHasEntityAccess(permissions['mt3smarketingprogram:programs:editown'], permissions['mt3smarketingprogram:programs:editother'], item.createdBy), 'delete': securityHasEntityAccess(permissions['mt3smarketingprogram:programs:deleteown'], permissions['mt3smarketingprogram:programs:deleteother'], item.createdBy), }, 'langVar': 'program', }) -}} {% endblock %} {% block content %} {% set objectives = item.objectives %} {% set achievedCount = objectives|filter(o => o.achieved)|length %} {% set descriptionItems = item.descriptionItems %} {% set allocationItems = item.allocationItems %} {% set allocationTotals = item.allocationTotals %} {{ include('@MT3SMarketingProgram/Program/_tabs.html.twig', {'programId': item.id, 'counts': { 'description': descriptionItems|length, 'objectives': objectives|length, 'allocation': allocationItems|length, 'audiences': item.audiences|length, 'stakeholders': item.stakeholders|length, 'tasks': taskTree|length, }}) }}
{# Details #}
{% if item.completedAt %} {% endif %} {% if item.dateModified %} {% endif %}
{{ 'mt3s.marketing_program.field.status'|trans }} {{ item.status.labelKey|trans }}
{{ 'mt3s.marketing_program.field.completed_at'|trans }} {{ dateToFull(item.completedAt) }}
{{ 'mt3s.marketing_program.field.version'|trans }} {{ item.version }}
{{ 'mt3s.marketing_program.field.owner'|trans }} {{ item.owner ? item.owner.name : 'mt3s.marketing_program.owner.none'|trans }}
{{ 'mt3s.marketing_program.field.start_date'|trans }} {{ item.startDate ? dateToFull(item.startDate) : 'mt3s.marketing_program.value.none'|trans }}
{{ 'mt3s.marketing_program.field.end_date'|trans }} {{ item.endDate ? dateToFull(item.endDate) : 'mt3s.marketing_program.value.none'|trans }}
{{ 'mautic.core.category'|trans }} {{ item.category ? item.category.title : 'mt3s.marketing_program.value.none'|trans }}
{{ 'mautic.core.form.available'|trans }} {{ (item.isPublished ? 'mautic.core.form.yes' : 'mautic.core.form.no')|trans }}
{{ 'mautic.core.created'|trans }} {{ item.dateAdded ? dateToFull(item.dateAdded) : '' }}{% if item.createdByUser %} ({{ item.createdByUser }}){% endif %}
{{ 'mautic.core.modified'|trans }} {{ dateToFull(item.dateModified) }}{% if item.modifiedByUser %} ({{ item.modifiedByUser }}){% endif %}
{{ 'mautic.core.id'|trans }} {{ item.id }}
{# Description #}
{% if descriptionItems is empty %}

{{ 'mt3s.marketing_program.description_item.empty'|trans }}

{% else %} {# 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 (mt3s-mp-program.js). #} {{ include('@MT3SMarketingProgram/Program/_tab_table_filter.html.twig') }}
{% for descriptionItem in descriptionItems %} {% set typeName = mt3s_marketing_program_item_type_name('description', descriptionItem.type) %} {% set typeDescription = mt3s_marketing_program_item_type_description('description', descriptionItem.type) %} {% set typeIcon = mt3s_marketing_program_item_type_icon('description', descriptionItem.type) %} {% endfor %}
{{ 'mt3s.marketing_program.description_item.field.type'|trans }} {{ 'mt3s.marketing_program.description_item.field.description'|trans }}
{% if typeIcon %}{% endif %} {{ typeName ?? 'mt3s.marketing_program.description_item.type.unknown'|trans({'%key%': descriptionItem.type}) }} {{ include('@MT3SMarketingProgram/Program/_description_read_more.html.twig', { 'text': descriptionItem.description, 'id': 'program-desc-item-' ~ descriptionItem.id, }) }}
{% endif %}
{# Objectives #}
{% if objectives is empty %}

{{ 'mt3s.marketing_program.objective.empty'|trans }}

{% else %}

{{ 'mt3s.marketing_program.objective.progress'|trans({'%achieved%': achievedCount, '%total%': objectives|length}) }}

{# Harmonized columns: Pictogram (no label), Type, Name (title), Description, Priority, Status (achieved). Filter + click-to-sort (mt3s-mp-program.js). #} {{ include('@MT3SMarketingProgram/Program/_tab_table_filter.html.twig') }}
{% for objective in objectives %} {% set typeName = mt3s_marketing_program_item_type_name('objective', objective.type) %} {% set typeDescription = mt3s_marketing_program_item_type_description('objective', objective.type) %} {% set typeIcon = mt3s_marketing_program_item_type_icon('objective', objective.type) %} {% endfor %}
{{ 'mt3s.marketing_program.objective.field.type'|trans }} {{ 'mt3s.marketing_program.objective.field.name'|trans }} {{ 'mt3s.marketing_program.objective.field.description'|trans }} {{ 'mt3s.marketing_program.objective.field.priority'|trans }} {{ 'mt3s.marketing_program.objective.field.is_achieved'|trans }}
{% if typeIcon %}{% endif %} {{ typeName ?? 'mt3s.marketing_program.description_item.type.unknown'|trans({'%key%': objective.type}) }} {{ objective.title }} {{ objective.description|mt3s_marketing_program_linkify }} {{ objective.priority ?? '—' }} {% if objective.achieved %} {{ 'mt3s.marketing_program.objective.achieved'|trans }} {% else %} {{ 'mt3s.marketing_program.objective.not_achieved'|trans }} {% endif %}
{% endif %}
{# Allocation: the program's budget, then the allocation items (cost lines) with their totals. #}
{{ 'mt3s.marketing_program.field.budget_planned'|trans }} {% if item.budgetPlanned is not null %} {{ mt3s_marketing_program_money(item.budgetPlanned) }} {{ mt3s_marketing_program_currency() }} {% else %} {{ 'mt3s.marketing_program.value.none'|trans }} {% endif %}

{{ 'mt3s.marketing_program.field.allocation_items'|trans }}

{% if allocationItems is empty %}

{{ 'mt3s.marketing_program.allocation_item.empty'|trans }}

{% else %} {# Harmonized columns: Pictogram (no label), Type, Name, Description, then the costs. Filter + click-to-sort (mt3s-mp-program.js). #} {{ include('@MT3SMarketingProgram/Program/_tab_table_filter.html.twig') }}
{% for allocationItem in allocationItems %} {% set typeName = mt3s_marketing_program_item_type_name('allocation', allocationItem.type) %} {% set typeDescription = mt3s_marketing_program_item_type_description('allocation', allocationItem.type) %} {% set typeIcon = mt3s_marketing_program_item_type_icon('allocation', allocationItem.type) %} {% endfor %}
{{ 'mt3s.marketing_program.allocation_item.field.type'|trans }} {{ 'mt3s.marketing_program.allocation_item.field.name'|trans }} {{ 'mt3s.marketing_program.allocation_item.field.description'|trans }} {{ 'mt3s.marketing_program.allocation_item.field.planned_cost'|trans }} {{ 'mt3s.marketing_program.allocation_item.field.real_cost'|trans }}
{% if typeIcon %}{% endif %} {{ typeName ?? 'mt3s.marketing_program.description_item.type.unknown'|trans({'%key%': allocationItem.type}) }} {{ allocationItem.name }} {{ allocationItem.description|mt3s_marketing_program_linkify }} {% if allocationItem.plannedCost is not null %}{{ mt3s_marketing_program_money(allocationItem.plannedCost) }} {{ mt3s_marketing_program_currency() }}{% endif %} {% if allocationItem.realCost is not null %}{{ mt3s_marketing_program_money(allocationItem.realCost) }} {{ mt3s_marketing_program_currency() }}{% endif %}
{{ 'mt3s.marketing_program.allocation.total'|trans }} {% if allocationTotals.planned is not null %}{{ mt3s_marketing_program_money(allocationTotals.planned) }} {{ mt3s_marketing_program_currency() }}{% endif %} {% if allocationTotals.real is not null %}{{ mt3s_marketing_program_money(allocationTotals.real) }} {{ mt3s_marketing_program_currency() }}{% endif %}
{% endif %}
{# Stakeholders: the program's links to the global directory, harmonized like the other tabs. #}
{% set stakeholders = item.stakeholders %} {% if stakeholders is empty %}

{{ 'mt3s.marketing_program.stakeholder.empty'|trans }}

{% else %} {# Harmonized columns: Pictogram (no label), Type, Name, then the link's own fields. Filter + click-to-sort (mt3s-mp-program.js). #} {{ include('@MT3SMarketingProgram/Program/_tab_table_filter.html.twig') }}
{% for link in stakeholders %} {% set stakeholder = link.stakeholder %} {% endfor %}
{{ 'mt3s.marketing_program.stakeholder.field.type'|trans }} {{ 'mt3s.marketing_program.stakeholder.field.name'|trans }} {{ 'mt3s.marketing_program.stakeholder.field.role_in_program'|trans }} {{ 'mt3s.marketing_program.stakeholder.field.role'|trans }} {{ 'mt3s.marketing_program.stakeholder.field.phone'|trans }} {{ 'mt3s.marketing_program.stakeholder.field.active'|trans }}
{% set typeIcon = mt3s_marketing_program_item_type_icon('stakeholder', stakeholder.type) %} {% if typeIcon %}{% endif %} {{ mt3s_marketing_program_item_type_name('stakeholder', stakeholder.type) ?? 'mt3s.marketing_program.description_item.type.unknown'|trans({'%key%': stakeholder.type}) }} {{ stakeholder.name }} {{ link.roleInProgram }} {{ stakeholder.role }} {% if stakeholder.phone %}{{ stakeholder.phone }}{% endif %} {{ (stakeholder.isPublished ? 'mt3s.marketing_program.stakeholder.active' : 'mt3s.marketing_program.stakeholder.inactive')|trans }}
{% endif %}
{# Audiences: the program's links to the global directory (Programs > Audiences), harmonized like the other tabs: pictogram, Type, Name (link to the audience's page), priority in this plan, then the audience's own attributes. Filter + click-to-sort (mt3s-mp-program.js). #}
{% set audiences = item.audiences %} {% if audiences is empty %}

{{ 'mt3s.marketing_program.audience.empty'|trans }}

{% else %} {{ include('@MT3SMarketingProgram/Program/_tab_table_filter.html.twig') }}
{% for link in audiences %} {% set audience = link.audience %} {% endfor %}
{{ 'mt3s.marketing_program.audience.field.type'|trans }} {{ 'mt3s.marketing_program.audience.field.name'|trans }} {{ 'mt3s.marketing_program.audience.field.priority'|trans }} {{ 'mt3s.marketing_program.audience.field.stages'|trans }} {{ 'mt3s.marketing_program.audience.field.estimated_size'|trans }} {{ 'mt3s.marketing_program.audience.field.value_proposition'|trans }} {{ 'mt3s.marketing_program.audience.field.preferred_channels'|trans }}
{{ audience.audienceType.labelKey|trans }} {{ audience.name }} {{ link.priority.labelKey|trans }} {{ audience.stages|map(stage => stage.name)|join(', ') }} {{ audience.estimatedSize }} {{ link.valueProposition }} {% for channel in audience.preferredChannels ?? [] %} {{ mt3s_marketing_program_audience_channel_label(channel)|trans }} {% endfor %}
{% endif %}
{# Tasks: same columns as Programs > Tasks, in tree order. #}
{{ include('@MT3SMarketingProgram/Program/_task_table.html.twig', { 'program': item, 'taskTree': taskTree, 'taskPermissions': taskPermissions, }) }}
{% endblock %}