first delivery

This commit is contained in:
Alexandre Gain committed 2026-11-07 19:31:49 +01:00
1 parent 793fbc0c91
commit f6684f3b2e
65 files changed
+5828

No files matched your search

+31
View File
@@ -0,0 +1,31 @@
{#
# Tab bar shared by the plan form and the plan detail page.
#
# Parameters:
# planId: the plan's id (null for a new plan)
# counts (optional): tab id => number shown next to the tab name
#
# The tab panes use the ids plan-tab-<id>. Assets/js/plan.js reopens the tab last used for this plan
# (so Edit, Save and Cancel keep the same tab), and on the form marks the tabs whose pane contains a
# validation error and opens the first of them.
#}
{% set planTabs = {
'details': 'mautic.plan.tab.details',
'description': 'mautic.plan.tab.description',
'objectives': 'mautic.plan.tab.objectives',
'allocation': 'mautic.plan.tab.allocation',
'targets': 'mautic.plan.tab.targets',
'tasks': 'mautic.plan.tab.tasks',
} %}
<ul class="nav nav-tabs nav-tabs-contained tabs-horizontal plan-tabs" role="tablist" data-plan-id="{{ planId|default('') }}">
{% for id, label in planTabs %}
<li class="{{ loop.first ? 'active' : '' }}" data-tab-id="plan-tab-{{ id }}">
<a href="#plan-tab-{{ id }}" role="tab" data-toggle="tab">
<span>{{ label|trans }}</span>
{% if counts is defined and counts[id] is defined %}
<span class="badge">{{ counts[id] }}</span>
{% endif %}
</a>
</li>
{% endfor %}
</ul>
@@ -0,0 +1,78 @@
{#
# The plan's tasks, for the Tasks tab of the plan detail page and form. Same columns as the task list
# (Planning > Tasks): ID, Name, Description, Start date, End date, Status. Rows are in tree order:
# each task is followed by its sub-tasks, indented under it.
#
# Parameters:
# plan: the Plan
# taskTree: rows from TaskModel::getTaskTree(): {task, depth}, in display order
# readOnly: true on the plan form: no links, so that following one can't drop unsaved changes
# taskPermissions: plan:tasks:* permissions (create, editown, editother), when not read-only
#
# Links carry returnTo=plan, so that Save and Cancel on the task form come back to this plan
# (see TaskController). Opened from Planning > Tasks, the task form goes back to the task list.
#}
{% set readOnly = readOnly|default(false) %}
{% set taskPermissions = taskPermissions|default({}) %}
{% set canCreate = not readOnly and plan.id and taskPermissions['plan:tasks:create']|default(false) %}
{% if canCreate %}
<div class="mb-md">
<a class="btn btn-ghost plan-task-add" href="{{ path('plan_task_action', {'objectAction': 'new', 'plan': plan.id, 'returnTo': 'plan'}) }}" data-toggle="ajax">
<i class="ri-add-line"></i> {{ 'mautic.plan.task.add'|trans }}
</a>
</div>
{% endif %}
{% if not plan.id %}
<p class="text-muted">{{ 'mautic.plan.task.save_plan_first'|trans }}</p>
{% elseif taskTree is empty %}
<p class="text-muted">{{ 'mautic.plan.task.empty'|trans }}</p>
{% else %}
<div class="table-responsive">
<table class="table table-hover plan-task-table">
<thead>
<tr>
<th class="col-plan-task-id">{{ 'mautic.core.id'|trans }}</th>
<th class="col-plan-task-name">{{ 'mautic.plan.task.field.name'|trans }}</th>
<th class="visible-md visible-lg col-plan-task-description">{{ 'mautic.plan.task.field.description'|trans }}</th>
<th class="col-plan-task-start">{{ 'mautic.plan.task.field.start_date'|trans }}</th>
<th class="col-plan-task-end">{{ 'mautic.plan.task.field.end_date'|trans }}</th>
<th class="col-plan-task-status">{{ 'mautic.plan.task.field.status'|trans }}</th>
</tr>
</thead>
<tbody>
{% for row in taskTree %}
{% set task = row.task %}
{% set canEdit = not readOnly and securityHasEntityAccess(taskPermissions['plan:tasks:editown']|default(false), taskPermissions['plan:tasks:editother']|default(false), task.createdBy) %}
{% set childCount = taskTree|filter(r => r.task.parent and r.task.parent.id == task.id)|length %}
<tr class="plan-task" data-task-id="{{ task.id }}" data-depth="{{ row.depth }}">
<td>{{ task.id }}</td>
<td>
<span style="display: inline-block; padding-left: {{ row.depth * 24 }}px;">
{% if row.depth > 0 %}
<i class="ri-corner-down-right-line text-muted" title="{{ 'mautic.plan.task.subtask_of'|trans({'%parent%': task.parent.name}) }}"></i>
{% endif %}
{% if canEdit %}
<a href="{{ path('plan_task_action', {'objectAction': 'edit', 'objectId': task.id, 'returnTo': 'plan'}) }}" data-toggle="ajax">{{ task.name }}</a>
{% else %}
{{ task.name }}
{% endif %}
{% if childCount > 0 %}
<span class="text-muted small" title="{{ 'mautic.plan.task.subtasks'|trans }}">({{ childCount }})</span>
{% endif %}
</span>
</td>
<td class="visible-md visible-lg text-muted">
{% set description = task.description|default('')|striptags|trim %}
{{ description|length > 120 ? description|slice(0, 120) ~ '…' : description }}
</td>
<td>{{ task.startDate ? dateToFull(task.startDate) : '' }}</td>
<td>{{ task.endDate ? dateToFull(task.endDate) : '' }}</td>
<td><span class="label {{ task.status.labelClass }}">{{ task.status.labelKey|trans }}</span></td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endif %}
+294
View File
@@ -0,0 +1,294 @@
{% 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 %}
<div class="label__divider"></div>
{% 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,
}}) }}
<div class="tab-content pa-md">
{# Details #}
<div class="tab-pane active bdr-w-0" id="plan-tab-details" role="tabpanel">
<table class="table table-hover mb-0 plan-details">
<tbody>
<tr>
<td class="col-md-3 text-muted">{{ 'mautic.plan.field.status'|trans }}</td>
<td>{{ item.status.labelKey|trans }}</td>
</tr>
{% if item.completedAt %}
<tr>
<td class="text-muted">{{ 'mautic.plan.field.completed_at'|trans }}</td>
<td>{{ dateToFull(item.completedAt) }}</td>
</tr>
{% endif %}
<tr>
<td class="text-muted">{{ 'mautic.plan.field.version'|trans }}</td>
<td>{{ item.version }}</td>
</tr>
<tr>
<td class="text-muted">{{ 'mautic.plan.field.owner'|trans }}</td>
<td>{{ item.owner ? item.owner.name : 'mautic.plan.owner.none'|trans }}</td>
</tr>
<tr>
<td class="text-muted">{{ 'mautic.plan.field.start_date'|trans }}</td>
<td>{{ item.startDate ? dateToFull(item.startDate) : 'mautic.plan.value.none'|trans }}</td>
</tr>
<tr>
<td class="text-muted">{{ 'mautic.plan.field.end_date'|trans }}</td>
<td>{{ item.endDate ? dateToFull(item.endDate) : 'mautic.plan.value.none'|trans }}</td>
</tr>
<tr>
<td class="text-muted">{{ 'mautic.core.category'|trans }}</td>
<td>{{ item.category ? item.category.title : 'mautic.plan.value.none'|trans }}</td>
</tr>
<tr>
<td class="text-muted">{{ 'mautic.core.form.available'|trans }}</td>
<td>{{ (item.isPublished ? 'mautic.core.form.yes' : 'mautic.core.form.no')|trans }}</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>
{% if item.dateModified %}
<tr>
<td class="text-muted">{{ 'mautic.core.modified'|trans }}</td>
<td>{{ dateToFull(item.dateModified) }}{% if item.modifiedByUser %} ({{ item.modifiedByUser }}){% endif %}</td>
</tr>
{% endif %}
<tr>
<td class="text-muted">{{ 'mautic.core.id'|trans }}</td>
<td>{{ item.id }}</td>
</tr>
</tbody>
</table>
</div>
{# Description #}
<div class="tab-pane bdr-w-0" id="plan-tab-description" role="tabpanel">
{% if descriptionItems is empty %}
<p class="text-muted">{{ 'mautic.plan.description_item.empty'|trans }}</p>
{% else %}
{# Three columns: the type's pictogram, the type, the description. #}
<div class="table-responsive">
<table class="table table-hover plan-description-items-view">
<thead>
<tr>
<th class="text-center" style="width: 1%;">{{ 'mautic.plan.description_item.field.pictogram'|trans }}</th>
<th class="col-md-3">{{ 'mautic.plan.description_item.field.type'|trans }}</th>
<th>{{ 'mautic.plan.description_item.field.description'|trans }}</th>
</tr>
</thead>
<tbody>
{% 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) %}
<tr>
<td class="text-center">
{% if typeIcon %}<i class="{{ typeIcon }} plan-item-type-icon" style="font-size: 24px;" aria-hidden="true"></i>{% endif %}
</td>
<td>
<strong{% if typeDescription %} title="{{ typeDescription }}" data-toggle="tooltip"{% endif %}>
{{ typeName ?? 'mautic.plan.description_item.type.unknown'|trans({'%key%': descriptionItem.type}) }}
</strong>
</td>
<td style="white-space: pre-wrap;">{{ descriptionItem.description }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endif %}
</div>
{# Objectives #}
<div class="tab-pane bdr-w-0" id="plan-tab-objectives" role="tabpanel">
{% if objectives is empty %}
<p class="text-muted">{{ 'mautic.plan.objective.empty'|trans }}</p>
{% else %}
<p class="text-muted plan-objectives-progress">
{{ 'mautic.plan.objective.progress'|trans({'%achieved%': achievedCount, '%total%': objectives|length}) }}
</p>
<ol class="list-group plan-objectives-view">
{% for objective in objectives %}
<li class="list-group-item">
{% if objective.achieved %}
<i class="ri-checkbox-circle-fill text-success" title="{{ 'mautic.plan.objective.achieved'|trans }}"></i>
{% else %}
<i class="ri-checkbox-blank-circle-line text-muted" title="{{ 'mautic.plan.objective.not_achieved'|trans }}"></i>
{% endif %}
<strong>{{ objective.title }}</strong>
{% if objective.description is not empty %}
<div class="text-muted mt-xs" style="white-space: pre-wrap;">{{ objective.description }}</div>
{% endif %}
</li>
{% endfor %}
</ol>
{% endif %}
</div>
{# Allocation: the plan's budget, then the allocation items (cost lines) with their totals. #}
<div class="tab-pane bdr-w-0" id="plan-tab-allocation" role="tabpanel">
<table class="table table-hover mb-md plan-allocation">
<tbody>
<tr>
<td class="col-md-3 text-muted">{{ 'mautic.plan.field.budget_planned'|trans }}</td>
<td>
{% if item.budgetPlanned is not null %}
{{ plan_money(item.budgetPlanned) }} {{ plan_currency() }}
{% else %}
{{ 'mautic.plan.value.none'|trans }}
{% endif %}
</td>
</tr>
</tbody>
</table>
<h4 class="mb-sm">{{ 'mautic.plan.field.allocation_items'|trans }}</h4>
{% if allocationItems is empty %}
<p class="text-muted">{{ 'mautic.plan.allocation_item.empty'|trans }}</p>
{% else %}
<div class="table-responsive">
<table class="table table-hover plan-allocation-items-view">
<thead>
<tr>
<th>{{ 'mautic.plan.allocation_item.field.type'|trans }}</th>
<th>{{ 'mautic.plan.allocation_item.field.name'|trans }}</th>
<th class="visible-md visible-lg">{{ 'mautic.plan.allocation_item.field.description'|trans }}</th>
<th class="text-right">{{ 'mautic.plan.allocation_item.field.planned_cost'|trans }}</th>
<th class="text-right">{{ 'mautic.plan.allocation_item.field.real_cost'|trans }}</th>
</tr>
</thead>
<tbody>
{% for allocationItem in allocationItems %}
{% set typeName = plan_item_type_name('allocation', allocationItem.type) %}
{% set typeDescription = plan_item_type_description('allocation', allocationItem.type) %}
<tr>
<td{% if typeDescription %} title="{{ typeDescription }}"{% endif %}>
{{ typeName ?? 'mautic.plan.description_item.type.unknown'|trans({'%key%': allocationItem.type}) }}
</td>
<td>{{ allocationItem.name }}</td>
<td class="visible-md visible-lg text-muted" style="white-space: pre-wrap;">{{ allocationItem.description }}</td>
<td class="text-right text-nowrap">
{% if allocationItem.plannedCost is not null %}{{ plan_money(allocationItem.plannedCost) }} {{ plan_currency() }}{% endif %}
</td>
<td class="text-right text-nowrap">
{% if allocationItem.realCost is not null %}{{ plan_money(allocationItem.realCost) }} {{ plan_currency() }}{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
<tfoot>
<tr class="plan-allocation-total">
<th colspan="3">{{ 'mautic.plan.allocation.total'|trans }}</th>
<th class="text-right text-nowrap">
{% if allocationTotals.planned is not null %}{{ plan_money(allocationTotals.planned) }} {{ plan_currency() }}{% endif %}
</th>
<th class="text-right text-nowrap">
{% if allocationTotals.real is not null %}{{ plan_money(allocationTotals.real) }} {{ plan_currency() }}{% endif %}
</th>
</tr>
</tfoot>
</table>
</div>
{% endif %}
</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: same columns as Planning > Tasks, in tree order. #}
<div class="tab-pane bdr-w-0" id="plan-tab-tasks" role="tabpanel">
{{ include('@Plan/Plan/_task_table.html.twig', {
'plan': item,
'taskTree': taskTree,
'taskPermissions': taskPermissions,
}) }}
</div>
</div>
{% endblock %}
+216
View File
@@ -0,0 +1,216 @@
{% 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">
<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>
{{ 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 %}
+151
View File
@@ -0,0 +1,151 @@
{% set isIndex = 'index' == tmpl ? true : false %}
{% set tmpl = 'list' %}
{% extends isIndex ? '@MauticCore/Default/content.html.twig' : '@MauticCore/Default/raw_output.html.twig' %}
{% block mauticContent %}plan{% endblock %}
{% block headerTitle %}{{ 'mautic.plan.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:plans:create'],
},
'routeBase': 'plan',
'langVar': 'plan',
},
'bulk_actions': {
'langVar': 'plan',
'routeBase': 'plan',
'templateButtons': {
'delete': permissions['plan:plans:deleteown'] or permissions['plan:plans:deleteother'],
},
},
}) -}}
<div class="page-list">
{% if items is defined and items is not empty %}
<div class="table-responsive">
<table class="table table-hover" id="planTable">
<thead>
<tr>
{{ include('@MauticCore/Helper/tableheader.html.twig', {
'checkall': 'true',
'target': '#planTable',
}) }}
{{ include('@MauticCore/Helper/tableheader.html.twig', {
'sessionVar': 'plan',
'orderBy': 'p.name',
'text': 'mautic.plan.field.name',
'class': 'col-plan-name',
'default': true,
}) }}
{{ include('@MauticCore/Helper/tableheader.html.twig', {
'sessionVar': 'plan',
'orderBy': 'p.status',
'text': 'mautic.plan.field.status',
'class': 'col-plan-status',
}) }}
{{ include('@MauticCore/Helper/tableheader.html.twig', {
'sessionVar': 'plan',
'text': 'mautic.plan.field.owner',
'class': 'visible-md visible-lg col-plan-owner',
}) }}
{{ include('@MauticCore/Helper/tableheader.html.twig', {
'sessionVar': 'plan',
'orderBy': 'p.startDate',
'text': 'mautic.plan.field.start_date',
'class': 'visible-md visible-lg col-plan-start',
}) }}
{{ include('@MauticCore/Helper/tableheader.html.twig', {
'sessionVar': 'plan',
'orderBy': 'p.endDate',
'text': 'mautic.plan.field.end_date',
'class': 'visible-md visible-lg col-plan-end',
}) }}
{{ include('@MauticCore/Helper/tableheader.html.twig', {
'sessionVar': 'plan',
'orderBy': 'p.budgetPlanned',
'text': 'mautic.plan.field.budget_planned',
'class': 'visible-md visible-lg col-plan-budget text-right',
}) }}
{{ include('@MauticCore/Helper/tableheader.html.twig', {
'sessionVar': 'plan',
'orderBy': 'p.id',
'text': 'mautic.core.id',
'class': 'visible-md visible-lg col-plan-id',
}) }}
</tr>
</thead>
<tbody>
{% for item in items %}
{% set canEdit = securityHasEntityAccess(permissions['plan:plans:editown'], permissions['plan:plans:editother'], item.createdBy) %}
<tr>
<td>
{{- include('@MauticCore/Helper/list_actions.html.twig', {
'item': item,
'templateButtons': {
'edit': canEdit,
'delete': securityHasEntityAccess(permissions['plan:plans:deleteown'], permissions['plan:plans:deleteother'], item.createdBy),
},
'routeBase': 'plan',
'langVar': 'plan',
}) -}}
</td>
<td>
<div>
{{- include('@MauticCore/Helper/publishstatus_icon.html.twig', {
'item': item,
'model': 'plan',
}) -}}
<a href="{{ path('plan_action', {'objectAction': 'view', 'objectId': item.id}) }}" data-toggle="ajax">
{{ item.name }}
</a>
{% if item.category %}
<span class="label label-default">{{ item.category.title }}</span>
{% endif %}
</div>
</td>
<td>{{ item.status.labelKey|trans }}</td>
<td class="visible-md visible-lg">
{{ item.owner ? item.owner.name : 'mautic.plan.owner.none'|trans }}
</td>
<td class="visible-md visible-lg">{{ item.startDate ? dateToDate(item.startDate) : '' }}</td>
<td class="visible-md visible-lg">{{ item.endDate ? dateToDate(item.endDate) : '' }}</td>
<td class="visible-md visible-lg text-right">
{% if item.budgetPlanned is not null %}
{{ plan_money(item.budgetPlanned) }} {{ plan_currency() }}
{% endif %}
</td>
<td class="visible-md visible-lg">{{ item.id }}</td>
</tr>
{% endfor %}
</tbody>
</table>
<div class="panel-footer">
{{- include('@MauticCore/Helper/pagination.html.twig', {
'totalItems': totalItems,
'page': page,
'limit': limit,
'baseUrl': path('plan_index'),
'sessionVar': 'plan',
}) -}}
</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.onboarding.heading',
'subheading': 'mautic.plan.onboarding.subheading',
'copy': 'mautic.plan.onboarding.copy',
}) }}
</div>
{% endif %}
</div>
</div>
{% endblock %}