added new permission to separate time and money budget (#3352)

This commit is contained in:
Kevin Papst
2022-06-11 12:23:02 +02:00
committed by GitHub
parent 3f827b3104
commit b46fdcefad
47 changed files with 853 additions and 346 deletions

View File

@@ -67,14 +67,18 @@
{{ form_row(form.fax) }}
</div>
</div>
{% if form.budget is defined %}
{% if form.budgetType is defined %}
<div class="row">
<div class="col-md-4">
{{ form_row(form.budget) }}
</div>
<div class="col-md-4">
{{ form_row(form.timeBudget) }}
</div>
{% if form.budget is defined %}
<div class="col-md-4">
{{ form_row(form.budget) }}
</div>
{% endif %}
{% if form.timeBudget is defined %}
<div class="col-md-4">
{{ form_row(form.timeBudget) }}
</div>
{% endif %}
<div class="col-md-4">
{{ form_row(form.budgetType) }}
</div>

View File

@@ -6,7 +6,7 @@
id="project_list_box" data-href="{{ path('customer_projects', {'id': customer.id}) }}" data-reload="kimai.projectUpdate kimai.projectDelete"
{% endblock %}
{% block box_tools %}
{% if is_granted('view_reporting') and is_granted('budget_project') %}
{% if is_granted('view_reporting') and is_granted('budget_any', 'project') %}
<a class="btn btn-default btn-sm btn-pager" href="{{ path('report_project_view', {'customer': customer.id}) }}" data-toggle="tooltip" data-placement="top" title="{{ 'report_project_view'|trans({}, 'reporting') }}"><i class="{{ 'reporting'|icon }}"></i></a>
{% endif %}
{% if customer.visible and is_granted('create_project') %}

View File

@@ -25,9 +25,17 @@
('mf_' ~ field.name): {'title': field.label|trans, 'class': 'hidden-xs hidden-sm mf_' ~ field.name, 'orderBy': false}
}) %}
{% endfor %}
{% if is_granted('budget_money', 'customer') %}
{% set columns = columns|merge({
'budget': {'class': 'hidden-xs hidden-sm hidden text-right w-min', 'title': 'label.budget'|trans},
}) %}
{% endif %}
{% if is_granted('budget_time', 'customer') %}
{% set columns = columns|merge({
'timeBudget': {'class': 'hidden-xs hidden-sm hidden text-right w-min', 'title': 'label.timeBudget'|trans},
}) %}
{% endif %}
{% set columns = columns|merge({
'budget': {'class': 'hidden-xs hidden-sm hidden text-right w-min'},
'timeBudget': {'class': 'hidden-xs hidden-sm hidden text-right w-min'},
'team': {'class': 'text-center w-min', 'orderBy': false},
'visible': {'class': 'text-center hidden w-min'},
'actions': {'class': 'actions alwaysVisible'},
@@ -74,14 +82,14 @@
</td>
{% endfor %}
<td class="{{ tables.data_table_column_class(tableName, columns, 'budget') }}">
{% if entry.hasBudget() %}
{% if entry.hasBudget() and is_granted('budget', entry) %}
{{ entry.budget|money(entry.currency) }}
{% else %}
&ndash;
{% endif %}
</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'timeBudget') }}">
{% if entry.hasTimeBudget() %}
{% if entry.hasTimeBudget() and is_granted('time', entry) %}
{{ entry.timeBudget|duration }}
{% else %}
&ndash;