monthly budget, monthly report, unified report calculation (#2684)

This commit is contained in:
Kevin Papst
2021-08-06 18:38:41 +02:00
committed by GitHub
parent 21f785638c
commit cefd747e91
196 changed files with 5031 additions and 2167 deletions

View File

@@ -109,6 +109,9 @@
{# change the next if, once data_table_header_options() will be deleted #}
{% if classes is iterable %}
{% set classes = classes.class %}
{% if columns[column].columnClass is defined %}
{% set classes = classes ~ ' ' ~ columns[column].columnClass %}
{% endif %}
{% endif %}
{% if 'alwaysVisible' in classes %}
{# as this column should always be visible, we remove every class that includes hidden #}

View File

@@ -6,6 +6,8 @@
{% set formatter = options['format'] ?? null %}
{% set currency = options['currency'] ?? null %}
{% set percentDecimals = options['decimals'] ?? 1 %}
{% set transPercentOpen = options['trans_percent_open'] ?? 'stats.percentUsedLeft' %}
{% set transPercentSpent = options['trans_percent_spent'] ?? 'stats.percentUsed' %}
{% if formatter == 'duration' %}
{% set currentFormatted = current|duration %}
{% set maxFormatted = max|duration %}
@@ -44,9 +46,9 @@
<div class="progress-bar {{ progressbar_color(percentReached, reverseColors) }}" role="progressbar" aria-valuenow="{{ width }}" aria-valuemin="0" aria-valuemax="100" style="width: {{ width }}%"></div>
</div>
{% if open is not null and open > 0 %}
<small>{{ 'stats.percentUsedLeft'|trans({'%percent%': percentReached|number_format(percentDecimals), '%left%': openFormatted}) }}</small>
<small>{{ transPercentOpen|trans({'%percent%': percentReached|number_format(percentDecimals), '%left%': openFormatted}) }}</small>
{% else %}
<small>{{ 'stats.percentUsed'|trans({'%percent%': percentReached|number_format(percentDecimals)}) }}</small>
<small>{{ transPercentSpent|trans({'%percent%': percentReached|number_format(percentDecimals)}) }}</small>
{% endif %}
</div>
{% endmacro %}
@@ -104,3 +106,47 @@
{% endif %}
</div>
{% endmacro %}
{#
@param \App\Model\BudgetStatisticModelInterface budgetStatisticModel
@param string currency
#}
{% macro progressbar_budget(budgetStatisticModel, currency) %}
{% if budgetStatisticModel.hasBudget() %}
{% set options = {
'max': budgetStatisticModel.getBudget(),
'current': budgetStatisticModel.getBudgetSpent(),
'open': (budgetStatisticModel.getBudgetOpen()),
'format': 'money',
'currency': currency,
} %}
{% if budgetStatisticModel.isMonthlyBudget() %}
{% set options = options|merge({
'trans_percent_open': 'stats.percentUsedLeft_month',
'trans_percent_spent': 'stats.percentUsed_month',
}) %}
{% endif %}
{{ _self.progressbar_full(options) }}
{% endif %}
{% endmacro %}
{#
@param \App\Model\BudgetStatisticModelInterface budgetStatisticModel
#}
{% macro progressbar_timebudget(budgetStatisticModel) %}
{% if budgetStatisticModel.hasTimeBudget() %}
{% set options = {
'max': budgetStatisticModel.getTimeBudget(),
'current': budgetStatisticModel.getTimeBudgetSpent(),
'open': (budgetStatisticModel.getTimeBudgetOpen()),
'format': 'duration',
} %}
{% if budgetStatisticModel.isMonthlyBudget() %}
{% set options = options|merge({
'trans_percent_open': 'stats.percentUsedLeft_month',
'trans_percent_spent': 'stats.percentUsed_month',
}) %}
{% endif %}
{{ _self.progressbar_full(options) }}
{% endif %}
{% endmacro %}

View File

@@ -504,7 +504,7 @@
{% if showTitle %}
<thead>
<tr>
<th>{{ 'label.team'|trans }}</th>
<th class="hw-min">{{ 'label.team'|trans }}</th>
<th>{{ 'label.user'|trans }}</th>
</tr>
</thead>
@@ -515,7 +515,7 @@
{% set userTeamCount = users|length %}
<tr{% if is_granted('edit', team) %} class="modal-ajax-form open-edit" data-href="{{ path('admin_team_member', {'id': team.id}) }}"{% endif %}>
<td>
{{ team.name }}
{{ _self.label_team(team) }}
</td>
<td class="avatars">
{{ _self.user_avatar(team.teamlead, ('label.teamlead'|trans ~ ': ' ~ team.teamlead.displayName), 'teamlead') }}
@@ -655,3 +655,11 @@
{% endfor %}
</div>
{% endmacro %}
{% macro percent(maximum, current) %}
{% if maximum > 0 %}
{{ (current / (maximum / 100))|number_format(2) }} %
{% else %}
{{ 0|number_format(2) }} %
{% endif %}
{% endmacro %}