show total hourly rate in detail pages (#3441)

This commit is contained in:
Kevin Papst
2022-07-27 00:52:10 +02:00
committed by GitHub
parent 95ab9bda2d
commit 1b8948a086

View File

@@ -1,4 +1,6 @@
{% if is_granted('time', entity) %}
{% set timeBudgetVisible = is_granted('time', entity) %}
{% set durationTrans = entity.isMonthlyBudget() ? 'stats.durationMonth' : 'stats.durationTotal' %}
{% if timeBudgetVisible %}
{% embed '@AdminLTE/Widgets/box-widget.html.twig' %}
{% import "macros/progressbar.html.twig" as progress %}
{% import "macros/widgets.html.twig" as widgets %}
@@ -8,7 +10,6 @@
{% block box_body_class %}no-padding{% endblock %}
{% block box_attributes %}id="time_budget_box"{% endblock %}
{% block box_body %}
{% set durationTrans = entity.isMonthlyBudget() ? 'stats.durationMonth' : 'stats.durationTotal' %}
<div class="row">
<div class="col-xs-12 col-sm-5">
<table class="table table-hover dataTable">
@@ -130,8 +131,16 @@
<td class="text-nowrap text-right">{{ stats.internalRate|money(currency) }}</td>
<td class="text-nowrap text-right">{{ percentReached|number_format(2) }}%</td>
</tr>
{% if entity.budget > 0 %}
{% if not entity.isMonthlyBudget() and timeBudgetVisible and stats.duration > 0 %}
{% set realHourlyRate = stats.rateBillable / stats.duration|chart_duration %}
<tr>
<td>{{ 'label.hourlyRate'|trans }} ({{ 'label.billable'|trans }} / {{ durationTrans|trans }})</td>
<td class="text-nowrap text-right">{{ realHourlyRate|money(currency) }}</td>
<td class="text-nowrap text-right">-</td>
</tr>
{% endif %}
{% if entity.budget > 0 %}
<tr>
<th colspan="3" class="text-nowrap text-right">
{% if totalPercentReached < 100 %}
{{ 'stats.percentUsedLeft'|trans({'%percent%': totalPercentReached|number_format(2), '%left%': (entity.budget - stats.rateBillable)|money(currency)}) }}