{% extends '@MauticCore/Default/content.html.twig' %} {% block mauticContent %}plan{% endblock %} {# # No routeBase on the page_actions includes: core would turn it into mautic_plan_* route names. # The buttons use actionRoute (plan_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('plan_index'), 'targetLabel': 'mautic.plan.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': 'plan-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: 'mautic.plan.header.total_planned'|trans({'%amount%': plan_money(totals.planned), '%currency%': plan_currency()}), attributes: {'class': 'plan-total-planned', 'title': 'mautic.plan.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: 'mautic.plan.header.total_real'|trans({'%amount%': plan_money(totals.real), '%currency%': plan_currency()}), attributes: {'class': 'plan-total-real', 'title': (overPlan ? 'mautic.plan.header.total_real.over' : 'mautic.plan.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['plan:plans:editown'], permissions['plan:plans:editother'], item.createdBy), 'delete': securityHasEntityAccess(permissions['plan:plans:deleteown'], permissions['plan:plans:deleteother'], item.createdBy), }, 'langVar': 'plan', }) -}} {% 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('@Plan/Plan/_tabs.html.twig', {'planId': item.id, 'counts': { 'description': descriptionItems|length, 'objectives': objectives|length, 'allocation': allocationItems|length, 'tasks': taskTree|length, }}) }}
{# Details #}
{% if item.completedAt %} {% endif %} {% if item.dateModified %} {% endif %}
{{ 'mautic.plan.field.status'|trans }} {{ item.status.labelKey|trans }}
{{ 'mautic.plan.field.completed_at'|trans }} {{ dateToFull(item.completedAt) }}
{{ 'mautic.plan.field.version'|trans }} {{ item.version }}
{{ 'mautic.plan.field.owner'|trans }} {{ item.owner ? item.owner.name : 'mautic.plan.owner.none'|trans }}
{{ 'mautic.plan.field.start_date'|trans }} {{ item.startDate ? dateToFull(item.startDate) : 'mautic.plan.value.none'|trans }}
{{ 'mautic.plan.field.end_date'|trans }} {{ item.endDate ? dateToFull(item.endDate) : 'mautic.plan.value.none'|trans }}
{{ 'mautic.core.category'|trans }} {{ item.category ? item.category.title : 'mautic.plan.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 %}

{{ 'mautic.plan.description_item.empty'|trans }}

{% else %} {# Three columns: the type's pictogram, the type, the description. #}
{% for descriptionItem in descriptionItems %} {% set typeName = plan_item_type_name('description', descriptionItem.type) %} {% set typeDescription = plan_item_type_description('description', descriptionItem.type) %} {% set typeIcon = plan_item_type_icon('description', descriptionItem.type) %} {% endfor %}
{{ 'mautic.plan.description_item.field.pictogram'|trans }} {{ 'mautic.plan.description_item.field.type'|trans }} {{ 'mautic.plan.description_item.field.description'|trans }}
{% if typeIcon %}{% endif %} {{ typeName ?? 'mautic.plan.description_item.type.unknown'|trans({'%key%': descriptionItem.type}) }} {{ descriptionItem.description }}
{% endif %}
{# Objectives #}
{% if objectives is empty %}

{{ 'mautic.plan.objective.empty'|trans }}

{% else %}

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

    {% for objective in objectives %}
  1. {% if objective.achieved %} {% else %} {% endif %} {{ objective.title }} {% if objective.description is not empty %}
    {{ objective.description }}
    {% endif %}
  2. {% endfor %}
{% endif %}
{# Allocation: the plan's budget, then the allocation items (cost lines) with their totals. #}
{{ 'mautic.plan.field.budget_planned'|trans }} {% if item.budgetPlanned is not null %} {{ plan_money(item.budgetPlanned) }} {{ plan_currency() }} {% else %} {{ 'mautic.plan.value.none'|trans }} {% endif %}

{{ 'mautic.plan.field.allocation_items'|trans }}

{% if allocationItems is empty %}

{{ 'mautic.plan.allocation_item.empty'|trans }}

{% else %}
{% for allocationItem in allocationItems %} {% set typeName = plan_item_type_name('allocation', allocationItem.type) %} {% set typeDescription = plan_item_type_description('allocation', allocationItem.type) %} {{ typeName ?? 'mautic.plan.description_item.type.unknown'|trans({'%key%': allocationItem.type}) }} {% endfor %}
{{ 'mautic.plan.allocation_item.field.type'|trans }} {{ 'mautic.plan.allocation_item.field.name'|trans }} {{ 'mautic.plan.allocation_item.field.description'|trans }} {{ 'mautic.plan.allocation_item.field.planned_cost'|trans }} {{ 'mautic.plan.allocation_item.field.real_cost'|trans }}
{{ allocationItem.name }} {{ allocationItem.description }} {% if allocationItem.plannedCost is not null %}{{ plan_money(allocationItem.plannedCost) }} {{ plan_currency() }}{% endif %} {% if allocationItem.realCost is not null %}{{ plan_money(allocationItem.realCost) }} {{ plan_currency() }}{% endif %}
{{ 'mautic.plan.allocation.total'|trans }} {% if allocationTotals.planned is not null %}{{ plan_money(allocationTotals.planned) }} {{ plan_currency() }}{% endif %} {% if allocationTotals.real is not null %}{{ plan_money(allocationTotals.real) }} {{ plan_currency() }}{% endif %}
{% endif %}
{# Targets #}

{{ 'mautic.plan.target.empty'|trans }}

{# Tasks: same columns as Planning > Tasks, in tree order. #}
{{ include('@Plan/Plan/_task_table.html.twig', { 'plan': item, 'taskTree': taskTree, 'taskPermissions': taskPermissions, }) }}
{% endblock %}