225 lines
10 KiB
Twig
225 lines
10 KiB
Twig
{% extends '@MauticCore/Default/content.html.twig' %}
|
|
|
|
{% block mauticContent %}plan{% endblock %}
|
|
|
|
{% block headerTitle %}
|
|
{% if entity.id %}
|
|
{{ 'mautic.plan.header.edit'|trans({'%name%': entity.name}) }}
|
|
{% else %}
|
|
{{ 'mautic.plan.header.new'|trans }}
|
|
{% endif %}
|
|
{% endblock %}
|
|
|
|
{#
|
|
# Editable, sortable rows (objectives, description items). Each macro renders one row, for existing
|
|
# rows and, through data-prototype, for new ones. Adding, removing and reordering rows is handled by
|
|
# Assets/js/plan.js, through the plan-collection-* classes.
|
|
#}
|
|
{% macro row_start(dragLabel) %}
|
|
<li class="plan-collection-row list-group-item">
|
|
<div class="row">
|
|
<div class="col-xs-1 text-center">
|
|
<span class="plan-collection-handle text-muted" title="{{ dragLabel|trans }}" style="cursor: move;">
|
|
<i class="ri-draggable ri-lg"></i>
|
|
</span>
|
|
</div>
|
|
<div class="col-xs-10">
|
|
{% endmacro %}
|
|
|
|
{% macro row_end(removeLabel) %}
|
|
</div>
|
|
<div class="col-xs-1 text-right">
|
|
<button type="button" class="btn btn-ghost btn-sm plan-collection-remove" title="{{ removeLabel|trans }}">
|
|
<i class="ri-delete-bin-line"></i>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
{% endmacro %}
|
|
|
|
{% macro objective_row(objective) %}
|
|
{{ _self.row_start('mautic.plan.objective.drag') }}
|
|
{{ form_row(objective.title) }}
|
|
{{ form_row(objective.description) }}
|
|
{{ form_row(objective.isAchieved) }}
|
|
{{ form_widget(objective.position) }}
|
|
{{ _self.row_end('mautic.plan.objective.remove') }}
|
|
{% endmacro %}
|
|
|
|
{% macro description_item_row(item) %}
|
|
{{ _self.row_start('mautic.plan.description_item.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('description', item.type.vars.value) }}" style="font-size: 28px;" aria-hidden="true"></i>
|
|
</div>
|
|
<div class="col-xs-11">
|
|
{{ form_row(item.type) }}
|
|
{# Filled with the selected type's description by plan.js. #}
|
|
<p class="help-block plan-item-type-help">{{ plan_item_type_description('description', item.type.vars.value) }}</p>
|
|
</div>
|
|
</div>
|
|
{{ form_row(item.description) }}
|
|
{{ form_widget(item.position) }}
|
|
{{ _self.row_end('mautic.plan.description_item.remove') }}
|
|
{% endmacro %}
|
|
|
|
{% macro allocation_item_row(item) %}
|
|
{{ _self.row_start('mautic.plan.allocation_item.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('allocation', item.type.vars.value) }}" style="font-size: 28px;" aria-hidden="true"></i>
|
|
</div>
|
|
<div class="col-xs-11">
|
|
<div class="row">
|
|
<div class="col-md-6">
|
|
{{ form_row(item.type) }}
|
|
{# Filled with the selected type's description by plan.js. #}
|
|
<p class="help-block plan-item-type-help">{{ plan_item_type_description('allocation', item.type.vars.value) }}</p>
|
|
</div>
|
|
<div class="col-md-6">{{ form_row(item.name) }}</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{{ form_row(item.description) }}
|
|
<div class="row">
|
|
<div class="col-md-6">{{ form_row(item.plannedCost) }}</div>
|
|
<div class="col-md-6">{{ form_row(item.realCost) }}</div>
|
|
</div>
|
|
{{ form_widget(item.position) }}
|
|
{{ _self.row_end('mautic.plan.allocation_item.remove') }}
|
|
{% endmacro %}
|
|
|
|
{% block content %}
|
|
{{ form_start(form) }}
|
|
<div class="pa-md pb-0">
|
|
{{ form_row(form.name) }}
|
|
</div>
|
|
|
|
{{ include('@Plan/Plan/_tabs.html.twig', {'planId': entity.id}) }}
|
|
|
|
<div class="tab-content pa-md">
|
|
{# Details #}
|
|
<div class="tab-pane active bdr-w-0" id="plan-tab-details" role="tabpanel">
|
|
<div class="row">
|
|
<div class="col-md-4">{{ form_row(form.status) }}</div>
|
|
<div class="col-md-4">{{ form_row(form.version) }}</div>
|
|
<div class="col-md-4">{{ form_row(form.owner) }}</div>
|
|
</div>
|
|
{% if entity.completedAt %}
|
|
<div class="form-group">
|
|
<label class="control-label">{{ 'mautic.plan.field.completed_at'|trans }}</label>
|
|
<p class="form-control-static">{{ dateToFull(entity.completedAt) }}</p>
|
|
</div>
|
|
{% endif %}
|
|
<div class="row">
|
|
<div class="col-md-6">{{ form_row(form.startDate) }}</div>
|
|
<div class="col-md-6">{{ form_row(form.endDate) }}</div>
|
|
</div>
|
|
<div class="row">
|
|
<div class="col-md-6">{{ form_row(form.category) }}</div>
|
|
<div class="col-md-6">{{ form_row(form.isPublished) }}</div>
|
|
</div>
|
|
</div>
|
|
|
|
{# Description: description items. #}
|
|
<div class="tab-pane bdr-w-0" id="plan-tab-description" role="tabpanel">
|
|
{% set hasTypes = form.descriptionItems.vars.prototype.type.vars.choices is not empty %}
|
|
<div class="plan-collection plan-description-items"
|
|
data-prototype="{{ _self.description_item_row(form.descriptionItems.vars.prototype)|e('html_attr') }}"
|
|
data-prototype-name="__descitem__">
|
|
{{ form_errors(form.descriptionItems) }}
|
|
{% if not hasTypes %}
|
|
<div class="alert alert-info">{{ 'mautic.plan.description_item.no_types'|trans }}</div>
|
|
{% endif %}
|
|
<p class="text-muted plan-collection-empty{% if form.descriptionItems|length > 0 %} hide{% endif %}">
|
|
{{ 'mautic.plan.description_item.empty'|trans }}
|
|
</p>
|
|
<ul class="list-group plan-collection-list">
|
|
{% for item in form.descriptionItems %}
|
|
{{ _self.description_item_row(item) }}
|
|
{% endfor %}
|
|
</ul>
|
|
{% if hasTypes %}
|
|
<button type="button" class="btn btn-ghost plan-collection-add">
|
|
<i class="ri-add-line"></i> {{ 'mautic.plan.description_item.add'|trans }}
|
|
</button>
|
|
{% endif %}
|
|
</div>
|
|
{% do form.descriptionItems.setRendered %}
|
|
</div>
|
|
|
|
{# Objectives #}
|
|
<div class="tab-pane bdr-w-0" id="plan-tab-objectives" role="tabpanel">
|
|
<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) }}
|
|
<p class="text-muted plan-collection-empty{% if form.objectives|length > 0 %} hide{% endif %}">
|
|
{{ 'mautic.plan.objective.empty'|trans }}
|
|
</p>
|
|
<ul class="list-group plan-collection-list">
|
|
{% for objective in form.objectives %}
|
|
{{ _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>
|
|
</div>
|
|
{% do form.objectives.setRendered %}
|
|
</div>
|
|
|
|
{# Allocation: the plan's budget, then the allocation items (cost lines). #}
|
|
<div class="tab-pane bdr-w-0" id="plan-tab-allocation" role="tabpanel">
|
|
<div class="row">
|
|
<div class="col-md-6">{{ form_row(form.budgetPlanned) }}</div>
|
|
</div>
|
|
|
|
{% set hasAllocationTypes = form.allocationItems.vars.prototype.type.vars.choices is not empty %}
|
|
<div class="plan-collection plan-allocation-items"
|
|
data-prototype="{{ _self.allocation_item_row(form.allocationItems.vars.prototype)|e('html_attr') }}"
|
|
data-prototype-name="__allocitem__">
|
|
<h4 class="mt-lg mb-sm">{{ 'mautic.plan.field.allocation_items'|trans }}</h4>
|
|
{{ form_errors(form.allocationItems) }}
|
|
{% if not hasAllocationTypes %}
|
|
<div class="alert alert-info">{{ 'mautic.plan.allocation_item.no_types'|trans }}</div>
|
|
{% endif %}
|
|
<p class="text-muted plan-collection-empty{% if form.allocationItems|length > 0 %} hide{% endif %}">
|
|
{{ 'mautic.plan.allocation_item.empty'|trans }}
|
|
</p>
|
|
<ul class="list-group plan-collection-list">
|
|
{% for item in form.allocationItems %}
|
|
{{ _self.allocation_item_row(item) }}
|
|
{% endfor %}
|
|
</ul>
|
|
{% if hasAllocationTypes %}
|
|
<button type="button" class="btn btn-ghost plan-collection-add">
|
|
<i class="ri-add-line"></i> {{ 'mautic.plan.allocation_item.add'|trans }}
|
|
</button>
|
|
{% endif %}
|
|
</div>
|
|
{% do form.allocationItems.setRendered %}
|
|
</div>
|
|
|
|
{# Targets #}
|
|
<div class="tab-pane bdr-w-0" id="plan-tab-targets" role="tabpanel">
|
|
<p class="text-muted">{{ 'mautic.plan.target.empty'|trans }}</p>
|
|
</div>
|
|
|
|
{# Tasks: read-only here, so that following a link doesn't drop unsaved changes to the plan. #}
|
|
<div class="tab-pane bdr-w-0" id="plan-tab-tasks" role="tabpanel">
|
|
{% if entity.id %}
|
|
<p class="text-muted small">{{ 'mautic.plan.task.manage_from_plan_page'|trans }}</p>
|
|
{% endif %}
|
|
{{ include('@Plan/Plan/_task_table.html.twig', {
|
|
'plan': entity,
|
|
'taskTree': taskTree|default([]),
|
|
'readOnly': true,
|
|
}) }}
|
|
</div>
|
|
</div>
|
|
{{ form_end(form) }}
|
|
{% endblock %}
|